@mastra/server 1.57.0-alpha.2 → 1.57.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +41 -0
- package/dist/_types/@mastra_schema-compat/dist/_types/@internal_ai-sdk-v5/dist/index.d.ts +16 -217
- package/dist/_types/@mastra_schema-compat/dist/_types/@internal_ai-v6/dist/index.d.ts +31 -378
- package/dist/{dist-BvR1YpT5.cjs → dist-COHIL6fR.cjs} +128 -40
- package/dist/dist-COHIL6fR.cjs.map +1 -0
- package/dist/{dist-B1RiUqwz.js → dist-DGqlUp0b.js} +128 -40
- package/dist/dist-DGqlUp0b.js.map +1 -0
- package/dist/docs/SKILL.md +1 -1
- package/dist/docs/assets/SOURCE_MAP.json +1 -1
- package/dist/route-builder-CIk5k35M.js.map +1 -1
- package/dist/route-builder-CgLVYL1c.cjs.map +1 -1
- package/dist/server/handlers/agent-builder.cjs +1 -1
- package/dist/server/handlers/agent-builder.js +1 -1
- package/dist/server/handlers/mcp-client-versions.cjs +1 -1
- package/dist/server/handlers/mcp-client-versions.js +1 -1
- package/dist/server/handlers/prompt-block-versions.cjs +1 -1
- package/dist/server/handlers/prompt-block-versions.js +1 -1
- package/dist/server/handlers/scorer-versions.cjs +1 -1
- package/dist/server/handlers/scorer-versions.js +1 -1
- package/dist/server/handlers/stored-mcp-clients.cjs +1 -1
- package/dist/server/handlers/stored-mcp-clients.js +1 -1
- package/dist/server/handlers/stored-prompt-blocks.cjs +1 -1
- package/dist/server/handlers/stored-prompt-blocks.js +1 -1
- package/dist/server/handlers/stored-scorers.cjs +1 -1
- package/dist/server/handlers/stored-scorers.js +1 -1
- package/dist/server/handlers/stored-skill-favorites.cjs +1 -1
- package/dist/server/handlers/stored-skill-favorites.js +1 -1
- package/dist/server/handlers/stored-skills.cjs +1 -1
- package/dist/server/handlers/stored-skills.js +1 -1
- package/dist/server/schemas/index.cjs +1 -1
- package/dist/server/schemas/index.js +1 -1
- package/package.json +10 -10
- package/dist/dist-B1RiUqwz.js.map +0 -1
- package/dist/dist-BvR1YpT5.cjs.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"route-builder-CgLVYL1c.cjs","names":["z","z2","z3","z4","z5","z6","z7","z8","z9","arraySchema","z10","z11","z12","z13","z14","ZodFirstPartyTypeKind","zodToJsonSchema","z$1","require_json_schema_traverse","standardSchemaToJSONSchema","z","ZodOptional","ZodNullable","ZodArray","ZodRecord","ZodObject"],"sources":["../../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/zod-from-json-schema/0.5.2/103d891574c9abae075269aefe33fa44ba23fd41234be556312b9d6c20485b4b/node_modules/zod-from-json-schema/dist/index.mjs","../../schema-compat/dist/index.js","../src/server/server-adapter/openapi-utils.ts","../src/server/server-adapter/routes/route-builder.ts"],"sourcesContent":["// src/core/converter.ts\nimport { z as z14 } from \"zod/v4\";\n\n// src/handlers/primitive/type.ts\nimport { z } from \"zod/v4\";\nvar TypeHandler = class {\n apply(types, schema) {\n if (!schema.type) return;\n const allowedTypes = Array.isArray(schema.type) ? schema.type : [schema.type];\n const typeSet = new Set(allowedTypes);\n if (!typeSet.has(\"string\")) {\n types.string = false;\n }\n if (!typeSet.has(\"number\") && !typeSet.has(\"integer\")) {\n types.number = false;\n }\n if (!typeSet.has(\"boolean\")) {\n types.boolean = false;\n }\n if (!typeSet.has(\"null\")) {\n types.null = false;\n }\n if (!typeSet.has(\"array\")) {\n types.array = false;\n }\n if (!typeSet.has(\"object\")) {\n types.object = false;\n }\n if (typeSet.has(\"integer\") && types.number !== false) {\n const currentNumber = types.number || z.number();\n if (currentNumber instanceof z.ZodNumber) {\n types.number = currentNumber.int();\n }\n }\n }\n};\n\n// src/handlers/primitive/const.ts\nimport { z as z2 } from \"zod/v4\";\nvar ConstHandler = class {\n apply(types, schema) {\n if (schema.const === void 0) return;\n const constValue = schema.const;\n types.string = false;\n types.number = false;\n types.boolean = false;\n types.null = false;\n types.array = false;\n types.object = false;\n if (typeof constValue === \"string\") {\n types.string = z2.literal(constValue);\n } else if (typeof constValue === \"number\") {\n types.number = z2.literal(constValue);\n } else if (typeof constValue === \"boolean\") {\n types.boolean = z2.literal(constValue);\n } else if (constValue === null) {\n types.null = z2.null();\n } else if (Array.isArray(constValue)) {\n types.array = void 0;\n } else if (typeof constValue === \"object\") {\n types.object = void 0;\n }\n }\n};\n\n// src/handlers/primitive/enum.ts\nimport { z as z3 } from \"zod/v4\";\nvar EnumHandler = class {\n apply(types, schema) {\n if (!schema.enum) return;\n if (schema.enum.length === 0) {\n if (!schema.type) {\n types.string = false;\n types.number = false;\n types.boolean = false;\n types.null = false;\n types.array = false;\n types.object = false;\n }\n return;\n }\n const valuesByType = {\n string: schema.enum.filter((v) => typeof v === \"string\"),\n number: schema.enum.filter((v) => typeof v === \"number\"),\n boolean: schema.enum.filter((v) => typeof v === \"boolean\"),\n null: schema.enum.filter((v) => v === null),\n array: schema.enum.filter((v) => Array.isArray(v)),\n object: schema.enum.filter((v) => typeof v === \"object\" && v !== null && !Array.isArray(v))\n };\n types.string = this.createTypeSchema(valuesByType.string, \"string\");\n types.number = this.createTypeSchema(valuesByType.number, \"number\");\n types.boolean = this.createTypeSchema(valuesByType.boolean, \"boolean\");\n types.null = valuesByType.null.length > 0 ? z3.null() : false;\n types.array = valuesByType.array.length > 0 ? void 0 : false;\n types.object = valuesByType.object.length > 0 ? void 0 : false;\n }\n createTypeSchema(values, type) {\n if (values.length === 0) return false;\n if (values.length === 1) {\n return z3.literal(values[0]);\n }\n if (type === \"string\") {\n return z3.enum(values);\n }\n if (type === \"number\") {\n const [first, second, ...rest] = values;\n return z3.union([z3.literal(first), z3.literal(second), ...rest.map((v) => z3.literal(v))]);\n }\n if (type === \"boolean\") {\n return z3.union([z3.literal(true), z3.literal(false)]);\n }\n return false;\n }\n};\n\n// src/handlers/primitive/file.ts\nimport { z as z4 } from \"zod/v4\";\nvar FileHandler = class {\n apply(types, schema) {\n const stringSchema = schema;\n if (stringSchema.type === \"string\" && stringSchema.format === \"binary\" && stringSchema.contentEncoding === \"binary\") {\n let fileSchema = z4.file();\n if (stringSchema.minLength !== void 0) {\n fileSchema = fileSchema.min(stringSchema.minLength);\n }\n if (stringSchema.maxLength !== void 0) {\n fileSchema = fileSchema.max(stringSchema.maxLength);\n }\n if (stringSchema.contentMediaType !== void 0) {\n fileSchema = fileSchema.mime(stringSchema.contentMediaType);\n }\n types.file = fileSchema;\n types.string = false;\n }\n }\n};\n\n// src/handlers/primitive/string.ts\nimport { z as z5 } from \"zod/v4\";\nvar ImplicitStringHandler = class {\n apply(types, schema) {\n const stringSchema = schema;\n if (schema.type === void 0 && (stringSchema.minLength !== void 0 || stringSchema.maxLength !== void 0 || stringSchema.pattern !== void 0)) {\n if (types.string === void 0) {\n types.string = z5.string();\n }\n }\n }\n};\nvar MinLengthHandler = class {\n apply(types, schema) {\n const stringSchema = schema;\n if (stringSchema.minLength === void 0) return;\n if (types.string !== false) {\n const currentString = types.string || z5.string();\n if (currentString instanceof z5.ZodString) {\n types.string = currentString.refine(\n (value) => {\n const graphemeLength = Array.from(value).length;\n return graphemeLength >= stringSchema.minLength;\n },\n { message: `String must be at least ${stringSchema.minLength} characters long` }\n );\n }\n }\n }\n};\nvar MaxLengthHandler = class {\n apply(types, schema) {\n const stringSchema = schema;\n if (stringSchema.maxLength === void 0) return;\n if (types.string !== false) {\n const currentString = types.string || z5.string();\n if (currentString instanceof z5.ZodString) {\n types.string = currentString.refine(\n (value) => {\n const graphemeLength = Array.from(value).length;\n return graphemeLength <= stringSchema.maxLength;\n },\n { message: `String must be at most ${stringSchema.maxLength} characters long` }\n );\n }\n }\n }\n};\nvar PatternHandler = class {\n apply(types, schema) {\n const stringSchema = schema;\n if (!stringSchema.pattern) return;\n if (types.string !== false) {\n const currentString = types.string || z5.string();\n if (currentString instanceof z5.ZodString) {\n const regex = new RegExp(stringSchema.pattern);\n types.string = currentString.regex(regex);\n }\n }\n }\n};\n\n// src/handlers/primitive/number.ts\nimport { z as z6 } from \"zod/v4\";\nvar MinimumHandler = class {\n apply(types, schema) {\n const numberSchema = schema;\n if (numberSchema.minimum === void 0) return;\n if (types.number !== false) {\n const currentNumber = types.number || z6.number();\n if (currentNumber instanceof z6.ZodNumber) {\n types.number = currentNumber.min(numberSchema.minimum);\n }\n }\n }\n};\nvar MaximumHandler = class {\n apply(types, schema) {\n const numberSchema = schema;\n if (numberSchema.maximum === void 0) return;\n if (types.number !== false) {\n const currentNumber = types.number || z6.number();\n if (currentNumber instanceof z6.ZodNumber) {\n types.number = currentNumber.max(numberSchema.maximum);\n }\n }\n }\n};\nvar ExclusiveMinimumHandler = class {\n apply(types, schema) {\n const numberSchema = schema;\n if (numberSchema.exclusiveMinimum === void 0) return;\n if (types.number !== false) {\n const currentNumber = types.number || z6.number();\n if (currentNumber instanceof z6.ZodNumber) {\n if (typeof numberSchema.exclusiveMinimum === \"number\") {\n types.number = currentNumber.gt(numberSchema.exclusiveMinimum);\n } else {\n types.number = false;\n }\n }\n }\n }\n};\nvar ExclusiveMaximumHandler = class {\n apply(types, schema) {\n const numberSchema = schema;\n if (numberSchema.exclusiveMaximum === void 0) return;\n if (types.number !== false) {\n const currentNumber = types.number || z6.number();\n if (currentNumber instanceof z6.ZodNumber) {\n if (typeof numberSchema.exclusiveMaximum === \"number\") {\n types.number = currentNumber.lt(numberSchema.exclusiveMaximum);\n } else {\n types.number = false;\n }\n }\n }\n }\n};\nvar MultipleOfHandler = class {\n apply(types, schema) {\n const numberSchema = schema;\n if (numberSchema.multipleOf === void 0) return;\n if (types.number !== false) {\n const currentNumber = types.number || z6.number();\n if (currentNumber instanceof z6.ZodNumber) {\n types.number = currentNumber.refine(\n (value) => {\n if (numberSchema.multipleOf === 0) return false;\n const quotient = value / numberSchema.multipleOf;\n const rounded = Math.round(quotient);\n const tolerance = Math.min(\n Math.abs(value) * Number.EPSILON * 10,\n Math.abs(numberSchema.multipleOf) * Number.EPSILON * 10\n );\n return Math.abs(quotient - rounded) <= tolerance / Math.abs(numberSchema.multipleOf);\n },\n { message: `Must be a multiple of ${numberSchema.multipleOf}` }\n );\n }\n }\n }\n};\n\n// src/handlers/primitive/array.ts\nimport { z as z7 } from \"zod/v4\";\nvar ImplicitArrayHandler = class {\n apply(types, schema) {\n const arraySchema = schema;\n if (schema.type === void 0 && (arraySchema.minItems !== void 0 || arraySchema.maxItems !== void 0 || arraySchema.items !== void 0 || arraySchema.prefixItems !== void 0)) {\n if (types.array === void 0) {\n types.array = z7.array(z7.any());\n }\n }\n }\n};\nvar MinItemsHandler = class {\n apply(types, schema) {\n const arraySchema = schema;\n if (arraySchema.minItems === void 0) return;\n if (types.array !== false) {\n types.array = (types.array || z7.array(z7.any())).min(arraySchema.minItems);\n }\n }\n};\nvar MaxItemsHandler = class {\n apply(types, schema) {\n const arraySchema = schema;\n if (arraySchema.maxItems === void 0) return;\n if (types.array !== false) {\n types.array = (types.array || z7.array(z7.any())).max(arraySchema.maxItems);\n }\n }\n};\nvar ItemsHandler = class {\n apply(types, schema) {\n const arraySchema = schema;\n if (types.array === false) return;\n if (Array.isArray(arraySchema.items)) {\n types.array = types.array || z7.array(z7.any());\n } else if (arraySchema.items && typeof arraySchema.items !== \"boolean\" && !arraySchema.prefixItems) {\n const itemSchema = convertJsonSchemaToZod(arraySchema.items);\n let newArray = z7.array(itemSchema);\n if (types.array && types.array instanceof z7.ZodArray) {\n const existingDef = types.array._def;\n if (existingDef.checks) {\n existingDef.checks.forEach((check) => {\n if (check._zod && check._zod.def) {\n const def = check._zod.def;\n if (def.check === \"min_length\" && def.minimum !== void 0) {\n newArray = newArray.min(def.minimum);\n } else if (def.check === \"max_length\" && def.maximum !== void 0) {\n newArray = newArray.max(def.maximum);\n }\n }\n });\n }\n }\n types.array = newArray;\n } else if (typeof arraySchema.items === \"boolean\" && arraySchema.items === false) {\n if (!arraySchema.prefixItems) {\n types.array = z7.array(z7.any()).max(0);\n } else {\n types.array = types.array || z7.array(z7.any());\n }\n } else if (typeof arraySchema.items === \"boolean\" && arraySchema.items === true) {\n types.array = types.array || z7.array(z7.any());\n } else if (arraySchema.prefixItems) {\n types.array = types.array || z7.array(z7.any());\n }\n }\n};\n\n// src/handlers/primitive/tuple.ts\nimport { z as z8 } from \"zod/v4\";\nvar TupleHandler = class {\n apply(types, schema) {\n if (schema.type !== \"array\") return;\n const arraySchema = schema;\n if (!Array.isArray(arraySchema.items)) return;\n if (types.array === false) return;\n const itemSchemas = arraySchema.items.map((itemSchema) => convertJsonSchemaToZod(itemSchema));\n let tuple;\n if (itemSchemas.length === 0) {\n tuple = z8.tuple([]);\n } else {\n tuple = z8.tuple(itemSchemas);\n }\n if (arraySchema.minItems !== void 0 && arraySchema.minItems > itemSchemas.length) {\n tuple = false;\n }\n if (arraySchema.maxItems !== void 0 && arraySchema.maxItems < itemSchemas.length) {\n tuple = false;\n }\n types.tuple = tuple;\n types.array = false;\n }\n};\n\n// src/handlers/primitive/object.ts\nimport { z as z9 } from \"zod/v4\";\nvar PropertiesHandler = class {\n apply(types, schema) {\n const objectSchema = schema;\n if (types.object === false) return;\n if (objectSchema.properties || objectSchema.required || objectSchema.additionalProperties !== void 0) {\n types.object = types.object || z9.object({}).passthrough();\n }\n }\n};\nvar ImplicitObjectHandler = class {\n apply(types, schema) {\n const objectSchema = schema;\n if (schema.type === void 0 && (objectSchema.maxProperties !== void 0 || objectSchema.minProperties !== void 0)) {\n if (types.object === void 0) {\n types.object = z9.object({}).passthrough();\n }\n }\n }\n};\nvar MaxPropertiesHandler = class {\n apply(types, schema) {\n const objectSchema = schema;\n if (objectSchema.maxProperties === void 0) return;\n if (types.object !== false) {\n const baseObject = types.object || z9.object({}).passthrough();\n types.object = baseObject.refine(\n (obj) => Object.keys(obj).length <= objectSchema.maxProperties,\n { message: `Object must have at most ${objectSchema.maxProperties} properties` }\n );\n }\n }\n};\nvar MinPropertiesHandler = class {\n apply(types, schema) {\n const objectSchema = schema;\n if (objectSchema.minProperties === void 0) return;\n if (types.object !== false) {\n const baseObject = types.object || z9.object({}).passthrough();\n types.object = baseObject.refine(\n (obj) => Object.keys(obj).length >= objectSchema.minProperties,\n { message: `Object must have at least ${objectSchema.minProperties} properties` }\n );\n }\n }\n};\n\n// src/core/utils.ts\nfunction deepEqual(a, b) {\n if (a === b) return true;\n if (a == null || b == null) return a === b;\n if (typeof a !== typeof b) return false;\n if (Array.isArray(a) && Array.isArray(b)) {\n if (a.length !== b.length) return false;\n return a.every((item, index) => deepEqual(item, b[index]));\n }\n if (typeof a === \"object\" && typeof b === \"object\") {\n const keysA = Object.keys(a);\n const keysB = Object.keys(b);\n if (keysA.length !== keysB.length) return false;\n return keysA.every((key) => keysB.includes(key) && deepEqual(a[key], b[key]));\n }\n return false;\n}\nfunction createUniqueItemsValidator() {\n return (value) => {\n if (!Array.isArray(value)) {\n return true;\n }\n const seen = [];\n return value.every((item) => {\n const isDuplicate = seen.some((seenItem) => deepEqual(item, seenItem));\n if (isDuplicate) {\n return false;\n }\n seen.push(item);\n return true;\n });\n };\n}\nfunction isValidWithSchema(schema, value) {\n return schema.safeParse(value).success;\n}\n\n// src/handlers/refinement/not.ts\nvar NotHandler = class {\n apply(zodSchema, schema) {\n if (!schema.not) return zodSchema;\n const notSchema = convertJsonSchemaToZod(schema.not);\n return zodSchema.refine(\n (value) => !isValidWithSchema(notSchema, value),\n { message: \"Value must not match the 'not' schema\" }\n );\n }\n};\n\n// src/handlers/refinement/uniqueItems.ts\nvar UniqueItemsHandler = class {\n apply(zodSchema, schema) {\n const arraySchema = schema;\n if (arraySchema.uniqueItems !== true) return zodSchema;\n return zodSchema.refine(createUniqueItemsValidator(), {\n message: \"Array items must be unique\"\n });\n }\n};\n\n// src/handlers/refinement/allOf.ts\nimport { z as z10 } from \"zod/v4\";\nvar AllOfHandler = class {\n apply(zodSchema, schema) {\n if (!schema.allOf || schema.allOf.length === 0) return zodSchema;\n const allOfSchemas = schema.allOf.map((s) => convertJsonSchemaToZod(s));\n return allOfSchemas.reduce(\n (acc, s) => z10.intersection(acc, s),\n zodSchema\n );\n }\n};\n\n// src/handlers/refinement/anyOf.ts\nimport { z as z11 } from \"zod/v4\";\nvar AnyOfHandler = class {\n apply(zodSchema, schema) {\n if (!schema.anyOf || schema.anyOf.length === 0) return zodSchema;\n const anyOfSchema = schema.anyOf.length === 1 ? convertJsonSchemaToZod(schema.anyOf[0]) : z11.union([\n convertJsonSchemaToZod(schema.anyOf[0]),\n convertJsonSchemaToZod(schema.anyOf[1]),\n ...schema.anyOf.slice(2).map((s) => convertJsonSchemaToZod(s))\n ]);\n return z11.intersection(zodSchema, anyOfSchema);\n }\n};\n\n// src/handlers/refinement/oneOf.ts\nvar OneOfHandler = class {\n apply(zodSchema, schema) {\n if (!schema.oneOf || schema.oneOf.length === 0) return zodSchema;\n const oneOfSchemas = schema.oneOf.map((s) => convertJsonSchemaToZod(s));\n return zodSchema.refine(\n (value) => {\n let validCount = 0;\n for (const oneOfSchema of oneOfSchemas) {\n const result = oneOfSchema.safeParse(value);\n if (result.success) {\n validCount++;\n if (validCount > 1) return false;\n }\n }\n return validCount === 1;\n },\n { message: \"Value must match exactly one of the oneOf schemas\" }\n );\n }\n};\n\n// src/handlers/refinement/arrayItems.ts\nvar PrefixItemsHandler = class {\n apply(zodSchema, schema) {\n const arraySchema = schema;\n if (arraySchema.prefixItems && Array.isArray(arraySchema.prefixItems)) {\n const prefixItems = arraySchema.prefixItems;\n const prefixSchemas = prefixItems.map((itemSchema) => convertJsonSchemaToZod(itemSchema));\n return zodSchema.refine(\n (value) => {\n if (!Array.isArray(value)) return true;\n for (let i = 0; i < Math.min(value.length, prefixSchemas.length); i++) {\n if (!isValidWithSchema(prefixSchemas[i], value[i])) {\n return false;\n }\n }\n if (value.length > prefixSchemas.length) {\n if (typeof arraySchema.items === \"boolean\" && arraySchema.items === false) {\n return false;\n } else if (arraySchema.items && typeof arraySchema.items === \"object\" && !Array.isArray(arraySchema.items)) {\n const additionalItemSchema = convertJsonSchemaToZod(arraySchema.items);\n for (let i = prefixSchemas.length; i < value.length; i++) {\n if (!isValidWithSchema(additionalItemSchema, value[i])) {\n return false;\n }\n }\n }\n }\n return true;\n },\n { message: \"Array does not match prefixItems schema\" }\n );\n }\n return zodSchema;\n }\n};\n\n// src/handlers/refinement/objectProperties.ts\nimport { z as z12 } from \"zod/v4\";\nvar ObjectPropertiesHandler = class {\n apply(zodSchema, schema) {\n const objectSchema = schema;\n if (!objectSchema.properties && !objectSchema.required && objectSchema.additionalProperties !== false) {\n return zodSchema;\n }\n if (zodSchema instanceof z12.ZodObject || zodSchema instanceof z12.ZodRecord) {\n const shape = {};\n if (objectSchema.properties) {\n for (const [key, propSchema] of Object.entries(objectSchema.properties)) {\n if (propSchema !== void 0) {\n shape[key] = convertJsonSchemaToZod(propSchema);\n }\n }\n }\n if (objectSchema.required && Array.isArray(objectSchema.required)) {\n const required = new Set(objectSchema.required);\n for (const key of Object.keys(shape)) {\n if (!required.has(key)) {\n shape[key] = shape[key].optional();\n }\n }\n } else {\n for (const key of Object.keys(shape)) {\n shape[key] = shape[key].optional();\n }\n }\n if (objectSchema.additionalProperties === false) {\n return z12.object(shape);\n } else {\n return z12.object(shape).passthrough();\n }\n }\n return zodSchema.refine(\n (value) => {\n if (typeof value !== \"object\" || value === null || Array.isArray(value)) {\n return true;\n }\n if (objectSchema.properties) {\n for (const [propName, propSchema] of Object.entries(objectSchema.properties)) {\n if (propSchema !== void 0) {\n const propExists = Object.getOwnPropertyDescriptor(value, propName) !== void 0;\n if (propExists) {\n const zodPropSchema = convertJsonSchemaToZod(propSchema);\n const propResult = zodPropSchema.safeParse(value[propName]);\n if (!propResult.success) {\n return false;\n }\n }\n }\n }\n }\n if (objectSchema.required && Array.isArray(objectSchema.required)) {\n for (const requiredProp of objectSchema.required) {\n const propExists = Object.getOwnPropertyDescriptor(value, requiredProp) !== void 0;\n if (!propExists) {\n return false;\n }\n }\n }\n if (objectSchema.additionalProperties === false && objectSchema.properties) {\n const allowedProps = new Set(Object.keys(objectSchema.properties));\n for (const prop in value) {\n if (!allowedProps.has(prop)) {\n return false;\n }\n }\n }\n return true;\n },\n { message: \"Object constraints validation failed\" }\n );\n }\n};\n\n// src/handlers/refinement/enumComplex.ts\nvar EnumComplexHandler = class {\n apply(zodSchema, schema) {\n if (!schema.enum || schema.enum.length === 0) return zodSchema;\n const complexValues = schema.enum.filter(\n (v) => Array.isArray(v) || typeof v === \"object\" && v !== null\n );\n if (complexValues.length === 0) return zodSchema;\n return zodSchema.refine(\n (value) => {\n if (typeof value !== \"object\" || value === null) return true;\n return complexValues.some(\n (enumValue) => deepEqual(value, enumValue)\n );\n },\n { message: \"Value must match one of the enum values\" }\n );\n }\n};\n\n// src/handlers/refinement/constComplex.ts\nvar ConstComplexHandler = class {\n apply(zodSchema, schema) {\n if (schema.const === void 0) return zodSchema;\n const constValue = schema.const;\n if (typeof constValue !== \"object\" || constValue === null) {\n return zodSchema;\n }\n return zodSchema.refine(\n (value) => deepEqual(value, constValue),\n { message: \"Value must equal the const value\" }\n );\n }\n};\n\n// src/handlers/refinement/metadata.ts\nvar MetadataHandler = class {\n apply(zodSchema, schema) {\n if (schema.description) {\n zodSchema = zodSchema.describe(schema.description);\n }\n return zodSchema;\n }\n};\n\n// src/handlers/refinement/protoRequired.ts\nimport { z as z13 } from \"zod/v4\";\nvar ProtoRequiredHandler = class {\n apply(zodSchema, schema) {\n var _a;\n const objectSchema = schema;\n if (!((_a = objectSchema.required) == null ? void 0 : _a.includes(\"__proto__\")) || schema.type !== void 0) {\n return zodSchema;\n }\n return z13.any().refine(\n (value) => this.validateRequired(value, objectSchema.required),\n { message: \"Missing required properties\" }\n );\n }\n validateRequired(value, required) {\n if (typeof value !== \"object\" || value === null || Array.isArray(value)) {\n return true;\n }\n return required.every(\n (prop) => Object.prototype.hasOwnProperty.call(value, prop)\n );\n }\n};\n\n// src/handlers/refinement/contains.ts\nvar ContainsHandler = class {\n apply(zodSchema, schema) {\n var _a;\n const arraySchema = schema;\n if (arraySchema.contains === void 0) return zodSchema;\n const containsSchema = convertJsonSchemaToZod(arraySchema.contains);\n const minContains = (_a = arraySchema.minContains) != null ? _a : 1;\n const maxContains = arraySchema.maxContains;\n return zodSchema.refine(\n (value) => {\n if (!Array.isArray(value)) {\n return true;\n }\n let matchCount = 0;\n for (const item of value) {\n if (isValidWithSchema(containsSchema, item)) {\n matchCount++;\n }\n }\n if (matchCount < minContains) {\n return false;\n }\n if (maxContains !== void 0 && matchCount > maxContains) {\n return false;\n }\n return true;\n },\n { message: \"Array must contain required items matching the schema\" }\n );\n }\n};\n\n// src/handlers/refinement/default.ts\nvar DefaultHandler = class {\n apply(zodSchema, schema) {\n const { default: v } = schema;\n if (v === void 0) return zodSchema;\n if (!zodSchema.safeParse(v).success) {\n return zodSchema;\n }\n return zodSchema.default(v);\n }\n};\n\n// src/core/converter.ts\nvar primitiveHandlers = [\n // Type constraints - should run first\n new ConstHandler(),\n new EnumHandler(),\n new TypeHandler(),\n // File schema detection - must run before string constraints\n new FileHandler(),\n // Implicit type detection - must run before other constraints\n new ImplicitStringHandler(),\n new ImplicitArrayHandler(),\n new ImplicitObjectHandler(),\n // String constraints\n new MinLengthHandler(),\n new MaxLengthHandler(),\n new PatternHandler(),\n // Number constraints\n new MinimumHandler(),\n new MaximumHandler(),\n new ExclusiveMinimumHandler(),\n new ExclusiveMaximumHandler(),\n new MultipleOfHandler(),\n // Array constraints - TupleHandler must run before ItemsHandler\n new TupleHandler(),\n new MinItemsHandler(),\n new MaxItemsHandler(),\n new ItemsHandler(),\n // Object constraints\n new MaxPropertiesHandler(),\n new MinPropertiesHandler(),\n new PropertiesHandler()\n];\nvar refinementHandlers = [\n // Handle special cases first\n new ProtoRequiredHandler(),\n new EnumComplexHandler(),\n new ConstComplexHandler(),\n // Logical combinations\n new AllOfHandler(),\n new AnyOfHandler(),\n new OneOfHandler(),\n // Type-specific refinements\n new PrefixItemsHandler(),\n new ObjectPropertiesHandler(),\n // Array refinements\n new ContainsHandler(),\n // Other refinements\n new NotHandler(),\n new UniqueItemsHandler(),\n new DefaultHandler(),\n // Metadata last\n new MetadataHandler()\n];\nfunction convertJsonSchemaToZod(schema) {\n if (typeof schema === \"boolean\") {\n return schema ? z14.any() : z14.never();\n }\n const types = {};\n for (const handler of primitiveHandlers) {\n handler.apply(types, schema);\n }\n const allowedSchemas = [];\n if (types.string !== false) {\n allowedSchemas.push(types.string || z14.string());\n }\n if (types.number !== false) {\n allowedSchemas.push(types.number || z14.number());\n }\n if (types.boolean !== false) {\n allowedSchemas.push(types.boolean || z14.boolean());\n }\n if (types.null !== false) {\n allowedSchemas.push(types.null || z14.null());\n }\n if (types.array !== false) {\n allowedSchemas.push(types.array || z14.array(z14.any()));\n }\n if (types.tuple !== false && types.tuple !== void 0) {\n allowedSchemas.push(types.tuple);\n }\n if (types.object !== false) {\n if (types.object) {\n allowedSchemas.push(types.object);\n } else {\n const objectSchema = z14.custom((val) => {\n return typeof val === \"object\" && val !== null && !Array.isArray(val);\n }, \"Must be an object, not an array\");\n allowedSchemas.push(objectSchema);\n }\n }\n if (types.file !== false && types.file !== void 0) {\n allowedSchemas.push(types.file);\n }\n let zodSchema;\n if (allowedSchemas.length === 0) {\n zodSchema = z14.never();\n } else if (allowedSchemas.length === 1) {\n zodSchema = allowedSchemas[0];\n } else {\n const hasConstraints = Object.keys(schema).some(\n (key) => key !== \"$schema\" && key !== \"title\" && key !== \"description\"\n );\n if (!hasConstraints) {\n zodSchema = z14.any();\n } else {\n zodSchema = z14.union(allowedSchemas);\n }\n }\n for (const handler of refinementHandlers) {\n zodSchema = handler.apply(zodSchema, schema);\n }\n return zodSchema;\n}\n\n// src/index.ts\nfunction jsonSchemaObjectToZodRawShape(schema) {\n var _a;\n const raw = {};\n const requiredArray = Array.isArray(schema.required) ? schema.required : [];\n const requiredFields = new Set(requiredArray);\n for (const [key, value] of Object.entries((_a = schema.properties) != null ? _a : {})) {\n if (value === void 0) continue;\n let zodType = convertJsonSchemaToZod(value);\n if (requiredArray.length > 0) {\n if (!requiredFields.has(key)) {\n zodType = zodType.optional();\n }\n } else {\n zodType = zodType.optional();\n }\n raw[key] = zodType;\n }\n return raw;\n}\nexport {\n convertJsonSchemaToZod,\n createUniqueItemsValidator,\n isValidWithSchema,\n jsonSchemaObjectToZodRawShape\n};\n","import { r as __toESM$1, t as require_json_schema_traverse } from \"./json-schema-traverse-B35mHRM8.js\";\nimport { ensureAllPropertiesRequired, prepareJsonSchemaForOpenAIStrictMode, zodToJsonSchema as zodToJsonSchema$1 } from \"./zod-to-json.js\";\nimport { a as standardSchemaToJSONSchema, i as isStandardSchemaWithJSON, n as isStandardJSONSchema, o as toStandardSchema, r as isStandardSchema, t as JSON_SCHEMA_LIBRARY_OPTIONS } from \"./schema-Bv9OdW1f.js\";\nimport { ZodArray, ZodDate, ZodDefault, ZodFirstPartyTypeKind, ZodIntersection, ZodNull, ZodNullable, ZodNumber, ZodObject, ZodOptional, ZodString, ZodUnion, z } from \"zod/v3\";\nimport { z as z$1 } from \"zod\";\nimport { convertJsonSchemaToZod } from \"zod-from-json-schema\";\nimport { convertJsonSchemaToZod as convertJsonSchemaToZod$1 } from \"zod-from-json-schema-v3\";\nimport { ZodArray as ZodArray$1, ZodDate as ZodDate$1, ZodDefault as ZodDefault$1, ZodIntersection as ZodIntersection$1, ZodNull as ZodNull$1, ZodNullable as ZodNullable$1, ZodNumber as ZodNumber$1, ZodObject as ZodObject$1, ZodOptional as ZodOptional$1, ZodString as ZodString$1, ZodUnion as ZodUnion$1, z as z$2 } from \"zod/v4\";\n//#region ../_vendored/ai_v4/dist/dist-Cm5DZgxA.js\nvar marker$1 = \"vercel.ai.error\";\nvar symbol$1 = Symbol.for(marker$1);\nvar _a$1;\nvar _AISDKError = class _AISDKError extends Error {\n\t/**\n\t* Creates an AI SDK Error.\n\t*\n\t* @param {Object} params - The parameters for creating the error.\n\t* @param {string} params.name - The name of the error.\n\t* @param {string} params.message - The error message.\n\t* @param {unknown} [params.cause] - The underlying cause of the error.\n\t*/\n\tconstructor({ name: name14, message, cause }) {\n\t\tsuper(message);\n\t\tthis[_a$1] = true;\n\t\tthis.name = name14;\n\t\tthis.cause = cause;\n\t}\n\t/**\n\t* Checks if the given error is an AI SDK Error.\n\t* @param {unknown} error - The error to check.\n\t* @returns {boolean} True if the error is an AI SDK Error, false otherwise.\n\t*/\n\tstatic isInstance(error) {\n\t\treturn _AISDKError.hasMarker(error, marker$1);\n\t}\n\tstatic hasMarker(error, marker15) {\n\t\tconst markerSymbol = Symbol.for(marker15);\n\t\treturn error != null && typeof error === \"object\" && markerSymbol in error && typeof error[markerSymbol] === \"boolean\" && error[markerSymbol] === true;\n\t}\n};\n_a$1 = symbol$1;\nvar AISDKError = _AISDKError;\nfunction getErrorMessage(error) {\n\tif (error == null) return \"unknown error\";\n\tif (typeof error === \"string\") return error;\n\tif (error instanceof Error) return error.message;\n\treturn JSON.stringify(error);\n}\nvar name3$1 = \"AI_InvalidArgumentError\";\nvar marker4$1 = `vercel.ai.error.${name3$1}`;\nvar symbol4$1 = Symbol.for(marker4$1);\nvar _a4$1;\nvar InvalidArgumentError = class extends AISDKError {\n\tconstructor({ message, cause, argument }) {\n\t\tsuper({\n\t\t\tname: name3$1,\n\t\t\tmessage,\n\t\t\tcause\n\t\t});\n\t\tthis[_a4$1] = true;\n\t\tthis.argument = argument;\n\t}\n\tstatic isInstance(error) {\n\t\treturn AISDKError.hasMarker(error, marker4$1);\n\t}\n};\n_a4$1 = symbol4$1;\nvar name6$1 = \"AI_JSONParseError\";\nvar marker7$1 = `vercel.ai.error.${name6$1}`;\nvar symbol7$1 = Symbol.for(marker7$1);\nvar _a7$1;\nvar JSONParseError = class extends AISDKError {\n\tconstructor({ text, cause }) {\n\t\tsuper({\n\t\t\tname: name6$1,\n\t\t\tmessage: `JSON parsing failed: Text: ${text}.\nError message: ${getErrorMessage(cause)}`,\n\t\t\tcause\n\t\t});\n\t\tthis[_a7$1] = true;\n\t\tthis.text = text;\n\t}\n\tstatic isInstance(error) {\n\t\treturn AISDKError.hasMarker(error, marker7$1);\n\t}\n};\n_a7$1 = symbol7$1;\nvar name12$1 = \"AI_TypeValidationError\";\nvar marker13$1 = `vercel.ai.error.${name12$1}`;\nvar symbol13$1 = Symbol.for(marker13$1);\nvar _a13$1;\nvar _TypeValidationError = class _TypeValidationError extends AISDKError {\n\tconstructor({ value, cause }) {\n\t\tsuper({\n\t\t\tname: name12$1,\n\t\t\tmessage: `Type validation failed: Value: ${JSON.stringify(value)}.\nError message: ${getErrorMessage(cause)}`,\n\t\t\tcause\n\t\t});\n\t\tthis[_a13$1] = true;\n\t\tthis.value = value;\n\t}\n\tstatic isInstance(error) {\n\t\treturn AISDKError.hasMarker(error, marker13$1);\n\t}\n\t/**\n\t* Wraps an error into a TypeValidationError.\n\t* If the cause is already a TypeValidationError with the same value, it returns the cause.\n\t* Otherwise, it creates a new TypeValidationError.\n\t*\n\t* @param {Object} params - The parameters for wrapping the error.\n\t* @param {unknown} params.value - The value that failed validation.\n\t* @param {unknown} params.cause - The original error or cause of the validation failure.\n\t* @returns {TypeValidationError} A TypeValidationError instance.\n\t*/\n\tstatic wrap({ value, cause }) {\n\t\treturn _TypeValidationError.isInstance(cause) && cause.value === value ? cause : new _TypeValidationError({\n\t\t\tvalue,\n\t\t\tcause\n\t\t});\n\t}\n};\n_a13$1 = symbol13$1;\nvar TypeValidationError = _TypeValidationError;\n//#endregion\n//#region ../_vendored/ai_v4/dist/dist-e6zV1w-k.js\nvar __create = Object.create;\nvar __defProp$1 = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __getProtoOf = Object.getPrototypeOf;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod), cb = null), mod.exports);\nvar __copyProps = (to, from, except, desc) => {\n\tif (from && typeof from === \"object\" || typeof from === \"function\") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {\n\t\tkey = keys[i];\n\t\tif (!__hasOwnProp.call(to, key) && key !== except) __defProp$1(to, key, {\n\t\t\tget: ((k) => from[k]).bind(null, key),\n\t\t\tenumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable\n\t\t});\n\t}\n\treturn to;\n};\nvar __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp$1(target, \"default\", {\n\tvalue: mod,\n\tenumerable: true\n}) : target, mod));\nlet customAlphabet = (alphabet, defaultSize = 21) => {\n\treturn (size = defaultSize) => {\n\t\tlet id = \"\";\n\t\tlet i = size | 0;\n\t\twhile (i--) id += alphabet[Math.random() * alphabet.length | 0];\n\t\treturn id;\n\t};\n};\nvar import_secure_json_parse = /* @__PURE__ */ __toESM((/* @__PURE__ */ __commonJSMin(((exports, module) => {\n\tconst hasBuffer = typeof Buffer !== \"undefined\";\n\tconst suspectProtoRx = /\"(?:_|\\\\u005[Ff])(?:_|\\\\u005[Ff])(?:p|\\\\u0070)(?:r|\\\\u0072)(?:o|\\\\u006[Ff])(?:t|\\\\u0074)(?:o|\\\\u006[Ff])(?:_|\\\\u005[Ff])(?:_|\\\\u005[Ff])\"\\s*:/;\n\tconst suspectConstructorRx = /\"(?:c|\\\\u0063)(?:o|\\\\u006[Ff])(?:n|\\\\u006[Ee])(?:s|\\\\u0073)(?:t|\\\\u0074)(?:r|\\\\u0072)(?:u|\\\\u0075)(?:c|\\\\u0063)(?:t|\\\\u0074)(?:o|\\\\u006[Ff])(?:r|\\\\u0072)\"\\s*:/;\n\tfunction _parse(text, reviver, options) {\n\t\tif (options == null) {\n\t\t\tif (reviver !== null && typeof reviver === \"object\") {\n\t\t\t\toptions = reviver;\n\t\t\t\treviver = void 0;\n\t\t\t}\n\t\t}\n\t\tif (hasBuffer && Buffer.isBuffer(text)) text = text.toString();\n\t\tif (text && text.charCodeAt(0) === 65279) text = text.slice(1);\n\t\tconst obj = JSON.parse(text, reviver);\n\t\tif (obj === null || typeof obj !== \"object\") return obj;\n\t\tconst protoAction = options && options.protoAction || \"error\";\n\t\tconst constructorAction = options && options.constructorAction || \"error\";\n\t\tif (protoAction === \"ignore\" && constructorAction === \"ignore\") return obj;\n\t\tif (protoAction !== \"ignore\" && constructorAction !== \"ignore\") {\n\t\t\tif (suspectProtoRx.test(text) === false && suspectConstructorRx.test(text) === false) return obj;\n\t\t} else if (protoAction !== \"ignore\" && constructorAction === \"ignore\") {\n\t\t\tif (suspectProtoRx.test(text) === false) return obj;\n\t\t} else if (suspectConstructorRx.test(text) === false) return obj;\n\t\treturn filter(obj, {\n\t\t\tprotoAction,\n\t\t\tconstructorAction,\n\t\t\tsafe: options && options.safe\n\t\t});\n\t}\n\tfunction filter(obj, { protoAction = \"error\", constructorAction = \"error\", safe } = {}) {\n\t\tlet next = [obj];\n\t\twhile (next.length) {\n\t\t\tconst nodes = next;\n\t\t\tnext = [];\n\t\t\tfor (const node of nodes) {\n\t\t\t\tif (protoAction !== \"ignore\" && Object.prototype.hasOwnProperty.call(node, \"__proto__\")) {\n\t\t\t\t\tif (safe === true) return null;\n\t\t\t\t\telse if (protoAction === \"error\") throw new SyntaxError(\"Object contains forbidden prototype property\");\n\t\t\t\t\tdelete node.__proto__;\n\t\t\t\t}\n\t\t\t\tif (constructorAction !== \"ignore\" && Object.prototype.hasOwnProperty.call(node, \"constructor\") && Object.prototype.hasOwnProperty.call(node.constructor, \"prototype\")) {\n\t\t\t\t\tif (safe === true) return null;\n\t\t\t\t\telse if (constructorAction === \"error\") throw new SyntaxError(\"Object contains forbidden prototype property\");\n\t\t\t\t\tdelete node.constructor;\n\t\t\t\t}\n\t\t\t\tfor (const key in node) {\n\t\t\t\t\tconst value = node[key];\n\t\t\t\t\tif (value && typeof value === \"object\") next.push(value);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn obj;\n\t}\n\tfunction parse(text, reviver, options) {\n\t\tconst stackTraceLimit = Error.stackTraceLimit;\n\t\tError.stackTraceLimit = 0;\n\t\ttry {\n\t\t\treturn _parse(text, reviver, options);\n\t\t} finally {\n\t\t\tError.stackTraceLimit = stackTraceLimit;\n\t\t}\n\t}\n\tfunction safeParse(text, reviver) {\n\t\tconst stackTraceLimit = Error.stackTraceLimit;\n\t\tError.stackTraceLimit = 0;\n\t\ttry {\n\t\t\treturn _parse(text, reviver, { safe: true });\n\t\t} catch (_e) {\n\t\t\treturn null;\n\t\t} finally {\n\t\t\tError.stackTraceLimit = stackTraceLimit;\n\t\t}\n\t}\n\tmodule.exports = parse;\n\tmodule.exports.default = parse;\n\tmodule.exports.parse = parse;\n\tmodule.exports.safeParse = safeParse;\n\tmodule.exports.scan = filter;\n})))(), 1);\nfunction convertAsyncIteratorToReadableStream(iterator) {\n\treturn new ReadableStream({\n\t\t/**\n\t\t* Called when the consumer wants to pull more data from the stream.\n\t\t*\n\t\t* @param {ReadableStreamDefaultController<T>} controller - The controller to enqueue data into the stream.\n\t\t* @returns {Promise<void>}\n\t\t*/\n\t\tasync pull(controller) {\n\t\t\ttry {\n\t\t\t\tconst { value, done } = await iterator.next();\n\t\t\t\tif (done) controller.close();\n\t\t\t\telse controller.enqueue(value);\n\t\t\t} catch (error) {\n\t\t\t\tcontroller.error(error);\n\t\t\t}\n\t\t},\n\t\t/**\n\t\t* Called when the consumer cancels the stream.\n\t\t*/\n\t\tcancel() {}\n\t});\n}\nvar createIdGenerator = ({ prefix, size: defaultSize = 16, alphabet = \"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz\", separator = \"-\" } = {}) => {\n\tconst generator = customAlphabet(alphabet, defaultSize);\n\tif (prefix == null) return generator;\n\tif (alphabet.includes(separator)) throw new InvalidArgumentError({\n\t\targument: \"separator\",\n\t\tmessage: `The separator \"${separator}\" must not be part of the alphabet \"${alphabet}\".`\n\t});\n\treturn (size) => `${prefix}${separator}${generator(size)}`;\n};\ncreateIdGenerator();\nvar validatorSymbol = Symbol.for(\"vercel.ai.validator\");\nfunction validator(validate) {\n\treturn {\n\t\t[validatorSymbol]: true,\n\t\tvalidate\n\t};\n}\nfunction isValidator(value) {\n\treturn typeof value === \"object\" && value !== null && validatorSymbol in value && value[validatorSymbol] === true && \"validate\" in value;\n}\nfunction asValidator(value) {\n\treturn isValidator(value) ? value : zodValidator(value);\n}\nfunction zodValidator(zodSchema) {\n\treturn validator((value) => {\n\t\tconst result = zodSchema.safeParse(value);\n\t\treturn result.success ? {\n\t\t\tsuccess: true,\n\t\t\tvalue: result.data\n\t\t} : {\n\t\t\tsuccess: false,\n\t\t\terror: result.error\n\t\t};\n\t});\n}\nfunction safeValidateTypes({ value, schema }) {\n\tconst validator2 = asValidator(schema);\n\ttry {\n\t\tif (validator2.validate == null) return {\n\t\t\tsuccess: true,\n\t\t\tvalue\n\t\t};\n\t\tconst result = validator2.validate(value);\n\t\tif (result.success) return result;\n\t\treturn {\n\t\t\tsuccess: false,\n\t\t\terror: TypeValidationError.wrap({\n\t\t\t\tvalue,\n\t\t\t\tcause: result.error\n\t\t\t})\n\t\t};\n\t} catch (error) {\n\t\treturn {\n\t\t\tsuccess: false,\n\t\t\terror: TypeValidationError.wrap({\n\t\t\t\tvalue,\n\t\t\t\tcause: error\n\t\t\t})\n\t\t};\n\t}\n}\nfunction safeParseJSON({ text, schema }) {\n\ttry {\n\t\tconst value = import_secure_json_parse.default.parse(text);\n\t\tif (schema == null) return {\n\t\t\tsuccess: true,\n\t\t\tvalue,\n\t\t\trawValue: value\n\t\t};\n\t\tconst validationResult = safeValidateTypes({\n\t\t\tvalue,\n\t\t\tschema\n\t\t});\n\t\treturn validationResult.success ? {\n\t\t\t...validationResult,\n\t\t\trawValue: value\n\t\t} : validationResult;\n\t} catch (error) {\n\t\treturn {\n\t\t\tsuccess: false,\n\t\t\terror: JSONParseError.isInstance(error) ? error : new JSONParseError({\n\t\t\t\ttext,\n\t\t\t\tcause: error\n\t\t\t})\n\t\t};\n\t}\n}\nvar { btoa, atob } = globalThis;\n//#endregion\n//#region ../_vendored/ai_v4/dist/index.js\nconst ignoreOverride = Symbol(\"Let zodToJsonSchema decide on which parser to use\");\nconst defaultOptions = {\n\tname: void 0,\n\t$refStrategy: \"root\",\n\tbasePath: [\"#\"],\n\teffectStrategy: \"input\",\n\tpipeStrategy: \"all\",\n\tdateStrategy: \"format:date-time\",\n\tmapStrategy: \"entries\",\n\tremoveAdditionalStrategy: \"passthrough\",\n\tallowedAdditionalProperties: true,\n\trejectedAdditionalProperties: false,\n\tdefinitionPath: \"definitions\",\n\ttarget: \"jsonSchema7\",\n\tstrictUnions: false,\n\tdefinitions: {},\n\terrorMessages: false,\n\tmarkdownDescription: false,\n\tpatternStrategy: \"escape\",\n\tapplyRegexFlags: false,\n\temailStrategy: \"format:email\",\n\tbase64Strategy: \"contentEncoding:base64\",\n\tnameStrategy: \"ref\",\n\topenAiAnyTypeName: \"OpenAiAnyType\"\n};\nconst getDefaultOptions = (options) => typeof options === \"string\" ? {\n\t...defaultOptions,\n\tname: options\n} : {\n\t...defaultOptions,\n\t...options\n};\nconst getRefs = (options) => {\n\tconst _options = getDefaultOptions(options);\n\tconst currentPath = _options.name !== void 0 ? [\n\t\t..._options.basePath,\n\t\t_options.definitionPath,\n\t\t_options.name\n\t] : _options.basePath;\n\treturn {\n\t\t..._options,\n\t\tflags: { hasReferencedOpenAiAnyType: false },\n\t\tcurrentPath,\n\t\tpropertyPath: void 0,\n\t\tseen: new Map(Object.entries(_options.definitions).map(([name, def]) => [def._def, {\n\t\t\tdef: def._def,\n\t\t\tpath: [\n\t\t\t\t..._options.basePath,\n\t\t\t\t_options.definitionPath,\n\t\t\t\tname\n\t\t\t],\n\t\t\tjsonSchema: void 0\n\t\t}]))\n\t};\n};\nfunction addErrorMessage(res, key, errorMessage, refs) {\n\tif (!refs?.errorMessages) return;\n\tif (errorMessage) res.errorMessage = {\n\t\t...res.errorMessage,\n\t\t[key]: errorMessage\n\t};\n}\nfunction setResponseValueAndErrors(res, key, value, errorMessage, refs) {\n\tres[key] = value;\n\taddErrorMessage(res, key, errorMessage, refs);\n}\nconst getRelativePath = (pathA, pathB) => {\n\tlet i = 0;\n\tfor (; i < pathA.length && i < pathB.length; i++) if (pathA[i] !== pathB[i]) break;\n\treturn [(pathA.length - i).toString(), ...pathB.slice(i)].join(\"/\");\n};\nfunction parseAnyDef(refs) {\n\tif (refs.target !== \"openAi\") return {};\n\tconst anyDefinitionPath = [\n\t\t...refs.basePath,\n\t\trefs.definitionPath,\n\t\trefs.openAiAnyTypeName\n\t];\n\trefs.flags.hasReferencedOpenAiAnyType = true;\n\treturn { $ref: refs.$refStrategy === \"relative\" ? getRelativePath(anyDefinitionPath, refs.currentPath) : anyDefinitionPath.join(\"/\") };\n}\nfunction parseArrayDef(def, refs) {\n\tconst res = { type: \"array\" };\n\tif (def.type?._def && def.type?._def?.typeName !== ZodFirstPartyTypeKind.ZodAny) res.items = parseDef(def.type._def, {\n\t\t...refs,\n\t\tcurrentPath: [...refs.currentPath, \"items\"]\n\t});\n\tif (def.minLength) setResponseValueAndErrors(res, \"minItems\", def.minLength.value, def.minLength.message, refs);\n\tif (def.maxLength) setResponseValueAndErrors(res, \"maxItems\", def.maxLength.value, def.maxLength.message, refs);\n\tif (def.exactLength) {\n\t\tsetResponseValueAndErrors(res, \"minItems\", def.exactLength.value, def.exactLength.message, refs);\n\t\tsetResponseValueAndErrors(res, \"maxItems\", def.exactLength.value, def.exactLength.message, refs);\n\t}\n\treturn res;\n}\nfunction parseBigintDef(def, refs) {\n\tconst res = {\n\t\ttype: \"integer\",\n\t\tformat: \"int64\"\n\t};\n\tif (!def.checks) return res;\n\tfor (const check of def.checks) switch (check.kind) {\n\t\tcase \"min\":\n\t\t\tif (refs.target === \"jsonSchema7\") if (check.inclusive) setResponseValueAndErrors(res, \"minimum\", check.value, check.message, refs);\n\t\t\telse setResponseValueAndErrors(res, \"exclusiveMinimum\", check.value, check.message, refs);\n\t\t\telse {\n\t\t\t\tif (!check.inclusive) res.exclusiveMinimum = true;\n\t\t\t\tsetResponseValueAndErrors(res, \"minimum\", check.value, check.message, refs);\n\t\t\t}\n\t\t\tbreak;\n\t\tcase \"max\":\n\t\t\tif (refs.target === \"jsonSchema7\") if (check.inclusive) setResponseValueAndErrors(res, \"maximum\", check.value, check.message, refs);\n\t\t\telse setResponseValueAndErrors(res, \"exclusiveMaximum\", check.value, check.message, refs);\n\t\t\telse {\n\t\t\t\tif (!check.inclusive) res.exclusiveMaximum = true;\n\t\t\t\tsetResponseValueAndErrors(res, \"maximum\", check.value, check.message, refs);\n\t\t\t}\n\t\t\tbreak;\n\t\tcase \"multipleOf\":\n\t\t\tsetResponseValueAndErrors(res, \"multipleOf\", check.value, check.message, refs);\n\t\t\tbreak;\n\t}\n\treturn res;\n}\nfunction parseBooleanDef() {\n\treturn { type: \"boolean\" };\n}\nfunction parseBrandedDef(_def, refs) {\n\treturn parseDef(_def.type._def, refs);\n}\nconst parseCatchDef = (def, refs) => {\n\treturn parseDef(def.innerType._def, refs);\n};\nfunction parseDateDef(def, refs, overrideDateStrategy) {\n\tconst strategy = overrideDateStrategy ?? refs.dateStrategy;\n\tif (Array.isArray(strategy)) return { anyOf: strategy.map((item, i) => parseDateDef(def, refs, item)) };\n\tswitch (strategy) {\n\t\tcase \"string\":\n\t\tcase \"format:date-time\": return {\n\t\t\ttype: \"string\",\n\t\t\tformat: \"date-time\"\n\t\t};\n\t\tcase \"format:date\": return {\n\t\t\ttype: \"string\",\n\t\t\tformat: \"date\"\n\t\t};\n\t\tcase \"integer\": return integerDateParser(def, refs);\n\t}\n}\nconst integerDateParser = (def, refs) => {\n\tconst res = {\n\t\ttype: \"integer\",\n\t\tformat: \"unix-time\"\n\t};\n\tif (refs.target === \"openApi3\") return res;\n\tfor (const check of def.checks) switch (check.kind) {\n\t\tcase \"min\":\n\t\t\tsetResponseValueAndErrors(res, \"minimum\", check.value, check.message, refs);\n\t\t\tbreak;\n\t\tcase \"max\":\n\t\t\tsetResponseValueAndErrors(res, \"maximum\", check.value, check.message, refs);\n\t\t\tbreak;\n\t}\n\treturn res;\n};\nfunction parseDefaultDef(_def, refs) {\n\treturn {\n\t\t...parseDef(_def.innerType._def, refs),\n\t\tdefault: _def.defaultValue()\n\t};\n}\nfunction parseEffectsDef(_def, refs) {\n\treturn refs.effectStrategy === \"input\" ? parseDef(_def.schema._def, refs) : parseAnyDef(refs);\n}\nfunction parseEnumDef(def) {\n\treturn {\n\t\ttype: \"string\",\n\t\tenum: Array.from(def.values)\n\t};\n}\nconst isJsonSchema7AllOfType = (type) => {\n\tif (\"type\" in type && type.type === \"string\") return false;\n\treturn \"allOf\" in type;\n};\nfunction parseIntersectionDef(def, refs) {\n\tconst allOf = [parseDef(def.left._def, {\n\t\t...refs,\n\t\tcurrentPath: [\n\t\t\t...refs.currentPath,\n\t\t\t\"allOf\",\n\t\t\t\"0\"\n\t\t]\n\t}), parseDef(def.right._def, {\n\t\t...refs,\n\t\tcurrentPath: [\n\t\t\t...refs.currentPath,\n\t\t\t\"allOf\",\n\t\t\t\"1\"\n\t\t]\n\t})].filter((x) => !!x);\n\tlet unevaluatedProperties = refs.target === \"jsonSchema2019-09\" ? { unevaluatedProperties: false } : void 0;\n\tconst mergedAllOf = [];\n\tallOf.forEach((schema) => {\n\t\tif (isJsonSchema7AllOfType(schema)) {\n\t\t\tmergedAllOf.push(...schema.allOf);\n\t\t\tif (schema.unevaluatedProperties === void 0) unevaluatedProperties = void 0;\n\t\t} else {\n\t\t\tlet nestedSchema = schema;\n\t\t\tif (\"additionalProperties\" in schema && schema.additionalProperties === false) {\n\t\t\t\tconst { additionalProperties, ...rest } = schema;\n\t\t\t\tnestedSchema = rest;\n\t\t\t} else unevaluatedProperties = void 0;\n\t\t\tmergedAllOf.push(nestedSchema);\n\t\t}\n\t});\n\treturn mergedAllOf.length ? {\n\t\tallOf: mergedAllOf,\n\t\t...unevaluatedProperties\n\t} : void 0;\n}\nfunction parseLiteralDef(def, refs) {\n\tconst parsedType = typeof def.value;\n\tif (parsedType !== \"bigint\" && parsedType !== \"number\" && parsedType !== \"boolean\" && parsedType !== \"string\") return { type: Array.isArray(def.value) ? \"array\" : \"object\" };\n\tif (refs.target === \"openApi3\") return {\n\t\ttype: parsedType === \"bigint\" ? \"integer\" : parsedType,\n\t\tenum: [def.value]\n\t};\n\treturn {\n\t\ttype: parsedType === \"bigint\" ? \"integer\" : parsedType,\n\t\tconst: def.value\n\t};\n}\nlet emojiRegex = void 0;\n/**\n* Generated from the regular expressions found here as of 2024-05-22:\n* https://github.com/colinhacks/zod/blob/master/src/types.ts.\n*\n* Expressions with /i flag have been changed accordingly.\n*/\nconst zodPatterns = {\n\t/**\n\t* `c` was changed to `[cC]` to replicate /i flag\n\t*/\n\tcuid: /^[cC][^\\s-]{8,}$/,\n\tcuid2: /^[0-9a-z]+$/,\n\tulid: /^[0-9A-HJKMNP-TV-Z]{26}$/,\n\t/**\n\t* `a-z` was added to replicate /i flag\n\t*/\n\temail: /^(?!\\.)(?!.*\\.\\.)([a-zA-Z0-9_'+\\-\\.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9\\-]*\\.)+[a-zA-Z]{2,}$/,\n\t/**\n\t* Constructed a valid Unicode RegExp\n\t*\n\t* Lazily instantiate since this type of regex isn't supported\n\t* in all envs (e.g. React Native).\n\t*\n\t* See:\n\t* https://github.com/colinhacks/zod/issues/2433\n\t* Fix in Zod:\n\t* https://github.com/colinhacks/zod/commit/9340fd51e48576a75adc919bff65dbc4a5d4c99b\n\t*/\n\temoji: () => {\n\t\tif (emojiRegex === void 0) emojiRegex = RegExp(\"^(\\\\p{Extended_Pictographic}|\\\\p{Emoji_Component})+$\", \"u\");\n\t\treturn emojiRegex;\n\t},\n\t/**\n\t* Unused\n\t*/\n\tuuid: /^[0-9a-fA-F]{8}\\b-[0-9a-fA-F]{4}\\b-[0-9a-fA-F]{4}\\b-[0-9a-fA-F]{4}\\b-[0-9a-fA-F]{12}$/,\n\t/**\n\t* Unused\n\t*/\n\tipv4: /^(?:(?: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])$/,\n\tipv4Cidr: /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\\/(3[0-2]|[12]?[0-9])$/,\n\t/**\n\t* Unused\n\t*/\n\tipv6: /^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,\n\tipv6Cidr: /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,\n\tbase64: /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,\n\tbase64url: /^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,\n\tnanoid: /^[a-zA-Z0-9_-]{21}$/,\n\tjwt: /^[A-Za-z0-9-_]+\\.[A-Za-z0-9-_]+\\.[A-Za-z0-9-_]*$/\n};\nfunction parseStringDef(def, refs) {\n\tconst res = { type: \"string\" };\n\tif (def.checks) for (const check of def.checks) switch (check.kind) {\n\t\tcase \"min\":\n\t\t\tsetResponseValueAndErrors(res, \"minLength\", typeof res.minLength === \"number\" ? Math.max(res.minLength, check.value) : check.value, check.message, refs);\n\t\t\tbreak;\n\t\tcase \"max\":\n\t\t\tsetResponseValueAndErrors(res, \"maxLength\", typeof res.maxLength === \"number\" ? Math.min(res.maxLength, check.value) : check.value, check.message, refs);\n\t\t\tbreak;\n\t\tcase \"email\":\n\t\t\tswitch (refs.emailStrategy) {\n\t\t\t\tcase \"format:email\":\n\t\t\t\t\taddFormat(res, \"email\", check.message, refs);\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"format:idn-email\":\n\t\t\t\t\taddFormat(res, \"idn-email\", check.message, refs);\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"pattern:zod\":\n\t\t\t\t\taddPattern(res, zodPatterns.email, check.message, refs);\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t\tbreak;\n\t\tcase \"url\":\n\t\t\taddFormat(res, \"uri\", check.message, refs);\n\t\t\tbreak;\n\t\tcase \"uuid\":\n\t\t\taddFormat(res, \"uuid\", check.message, refs);\n\t\t\tbreak;\n\t\tcase \"regex\":\n\t\t\taddPattern(res, check.regex, check.message, refs);\n\t\t\tbreak;\n\t\tcase \"cuid\":\n\t\t\taddPattern(res, zodPatterns.cuid, check.message, refs);\n\t\t\tbreak;\n\t\tcase \"cuid2\":\n\t\t\taddPattern(res, zodPatterns.cuid2, check.message, refs);\n\t\t\tbreak;\n\t\tcase \"startsWith\":\n\t\t\taddPattern(res, RegExp(`^${escapeLiteralCheckValue(check.value, refs)}`), check.message, refs);\n\t\t\tbreak;\n\t\tcase \"endsWith\":\n\t\t\taddPattern(res, RegExp(`${escapeLiteralCheckValue(check.value, refs)}$`), check.message, refs);\n\t\t\tbreak;\n\t\tcase \"datetime\":\n\t\t\taddFormat(res, \"date-time\", check.message, refs);\n\t\t\tbreak;\n\t\tcase \"date\":\n\t\t\taddFormat(res, \"date\", check.message, refs);\n\t\t\tbreak;\n\t\tcase \"time\":\n\t\t\taddFormat(res, \"time\", check.message, refs);\n\t\t\tbreak;\n\t\tcase \"duration\":\n\t\t\taddFormat(res, \"duration\", check.message, refs);\n\t\t\tbreak;\n\t\tcase \"length\":\n\t\t\tsetResponseValueAndErrors(res, \"minLength\", typeof res.minLength === \"number\" ? Math.max(res.minLength, check.value) : check.value, check.message, refs);\n\t\t\tsetResponseValueAndErrors(res, \"maxLength\", typeof res.maxLength === \"number\" ? Math.min(res.maxLength, check.value) : check.value, check.message, refs);\n\t\t\tbreak;\n\t\tcase \"includes\":\n\t\t\taddPattern(res, RegExp(escapeLiteralCheckValue(check.value, refs)), check.message, refs);\n\t\t\tbreak;\n\t\tcase \"ip\":\n\t\t\tif (check.version !== \"v6\") addFormat(res, \"ipv4\", check.message, refs);\n\t\t\tif (check.version !== \"v4\") addFormat(res, \"ipv6\", check.message, refs);\n\t\t\tbreak;\n\t\tcase \"base64url\":\n\t\t\taddPattern(res, zodPatterns.base64url, check.message, refs);\n\t\t\tbreak;\n\t\tcase \"jwt\":\n\t\t\taddPattern(res, zodPatterns.jwt, check.message, refs);\n\t\t\tbreak;\n\t\tcase \"cidr\":\n\t\t\tif (check.version !== \"v6\") addPattern(res, zodPatterns.ipv4Cidr, check.message, refs);\n\t\t\tif (check.version !== \"v4\") addPattern(res, zodPatterns.ipv6Cidr, check.message, refs);\n\t\t\tbreak;\n\t\tcase \"emoji\":\n\t\t\taddPattern(res, zodPatterns.emoji(), check.message, refs);\n\t\t\tbreak;\n\t\tcase \"ulid\":\n\t\t\taddPattern(res, zodPatterns.ulid, check.message, refs);\n\t\t\tbreak;\n\t\tcase \"base64\":\n\t\t\tswitch (refs.base64Strategy) {\n\t\t\t\tcase \"format:binary\":\n\t\t\t\t\taddFormat(res, \"binary\", check.message, refs);\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"contentEncoding:base64\":\n\t\t\t\t\tsetResponseValueAndErrors(res, \"contentEncoding\", \"base64\", check.message, refs);\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"pattern:zod\":\n\t\t\t\t\taddPattern(res, zodPatterns.base64, check.message, refs);\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t\tbreak;\n\t\tcase \"nanoid\": addPattern(res, zodPatterns.nanoid, check.message, refs);\n\t\tcase \"toLowerCase\":\n\t\tcase \"toUpperCase\":\n\t\tcase \"trim\": break;\n\t\tdefault:\n\t}\n\treturn res;\n}\nfunction escapeLiteralCheckValue(literal, refs) {\n\treturn refs.patternStrategy === \"escape\" ? escapeNonAlphaNumeric(literal) : literal;\n}\nconst ALPHA_NUMERIC = /* @__PURE__ */ new Set(\"ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789\");\nfunction escapeNonAlphaNumeric(source) {\n\tlet result = \"\";\n\tfor (let i = 0; i < source.length; i++) {\n\t\tif (!ALPHA_NUMERIC.has(source[i])) result += \"\\\\\";\n\t\tresult += source[i];\n\t}\n\treturn result;\n}\nfunction addFormat(schema, value, message, refs) {\n\tif (schema.format || schema.anyOf?.some((x) => x.format)) {\n\t\tif (!schema.anyOf) schema.anyOf = [];\n\t\tif (schema.format) {\n\t\t\tschema.anyOf.push({\n\t\t\t\tformat: schema.format,\n\t\t\t\t...schema.errorMessage && refs.errorMessages && { errorMessage: { format: schema.errorMessage.format } }\n\t\t\t});\n\t\t\tdelete schema.format;\n\t\t\tif (schema.errorMessage) {\n\t\t\t\tdelete schema.errorMessage.format;\n\t\t\t\tif (Object.keys(schema.errorMessage).length === 0) delete schema.errorMessage;\n\t\t\t}\n\t\t}\n\t\tschema.anyOf.push({\n\t\t\tformat: value,\n\t\t\t...message && refs.errorMessages && { errorMessage: { format: message } }\n\t\t});\n\t} else setResponseValueAndErrors(schema, \"format\", value, message, refs);\n}\nfunction addPattern(schema, regex, message, refs) {\n\tif (schema.pattern || schema.allOf?.some((x) => x.pattern)) {\n\t\tif (!schema.allOf) schema.allOf = [];\n\t\tif (schema.pattern) {\n\t\t\tschema.allOf.push({\n\t\t\t\tpattern: schema.pattern,\n\t\t\t\t...schema.errorMessage && refs.errorMessages && { errorMessage: { pattern: schema.errorMessage.pattern } }\n\t\t\t});\n\t\t\tdelete schema.pattern;\n\t\t\tif (schema.errorMessage) {\n\t\t\t\tdelete schema.errorMessage.pattern;\n\t\t\t\tif (Object.keys(schema.errorMessage).length === 0) delete schema.errorMessage;\n\t\t\t}\n\t\t}\n\t\tschema.allOf.push({\n\t\t\tpattern: stringifyRegExpWithFlags(regex, refs),\n\t\t\t...message && refs.errorMessages && { errorMessage: { pattern: message } }\n\t\t});\n\t} else setResponseValueAndErrors(schema, \"pattern\", stringifyRegExpWithFlags(regex, refs), message, refs);\n}\nfunction stringifyRegExpWithFlags(regex, refs) {\n\tif (!refs.applyRegexFlags || !regex.flags) return regex.source;\n\tconst flags = {\n\t\ti: regex.flags.includes(\"i\"),\n\t\tm: regex.flags.includes(\"m\"),\n\t\ts: regex.flags.includes(\"s\")\n\t};\n\tconst source = flags.i ? regex.source.toLowerCase() : regex.source;\n\tlet pattern = \"\";\n\tlet isEscaped = false;\n\tlet inCharGroup = false;\n\tlet inCharRange = false;\n\tfor (let i = 0; i < source.length; i++) {\n\t\tif (isEscaped) {\n\t\t\tpattern += source[i];\n\t\t\tisEscaped = false;\n\t\t\tcontinue;\n\t\t}\n\t\tif (flags.i) {\n\t\t\tif (inCharGroup) {\n\t\t\t\tif (source[i].match(/[a-z]/)) {\n\t\t\t\t\tif (inCharRange) {\n\t\t\t\t\t\tpattern += source[i];\n\t\t\t\t\t\tpattern += `${source[i - 2]}-${source[i]}`.toUpperCase();\n\t\t\t\t\t\tinCharRange = false;\n\t\t\t\t\t} else if (source[i + 1] === \"-\" && source[i + 2]?.match(/[a-z]/)) {\n\t\t\t\t\t\tpattern += source[i];\n\t\t\t\t\t\tinCharRange = true;\n\t\t\t\t\t} else pattern += `${source[i]}${source[i].toUpperCase()}`;\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t} else if (source[i].match(/[a-z]/)) {\n\t\t\t\tpattern += `[${source[i]}${source[i].toUpperCase()}]`;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t}\n\t\tif (flags.m) {\n\t\t\tif (source[i] === \"^\") {\n\t\t\t\tpattern += `(^|(?<=[\\r\\n]))`;\n\t\t\t\tcontinue;\n\t\t\t} else if (source[i] === \"$\") {\n\t\t\t\tpattern += `($|(?=[\\r\\n]))`;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t}\n\t\tif (flags.s && source[i] === \".\") {\n\t\t\tpattern += inCharGroup ? `${source[i]}\\r\\n` : `[${source[i]}\\r\\n]`;\n\t\t\tcontinue;\n\t\t}\n\t\tpattern += source[i];\n\t\tif (source[i] === \"\\\\\") isEscaped = true;\n\t\telse if (inCharGroup && source[i] === \"]\") inCharGroup = false;\n\t\telse if (!inCharGroup && source[i] === \"[\") inCharGroup = true;\n\t}\n\ttry {\n\t\tnew RegExp(pattern);\n\t} catch {\n\t\tconsole.warn(`Could not convert regex pattern at ${refs.currentPath.join(\"/\")} to a flag-independent form! Falling back to the flag-ignorant source`);\n\t\treturn regex.source;\n\t}\n\treturn pattern;\n}\nfunction parseRecordDef(def, refs) {\n\tif (refs.target === \"openAi\") console.warn(\"Warning: OpenAI may not support records in schemas! Try an array of key-value pairs instead.\");\n\tif (refs.target === \"openApi3\" && def.keyType?._def.typeName === ZodFirstPartyTypeKind.ZodEnum) return {\n\t\ttype: \"object\",\n\t\trequired: def.keyType._def.values,\n\t\tproperties: def.keyType._def.values.reduce((acc, key) => ({\n\t\t\t...acc,\n\t\t\t[key]: parseDef(def.valueType._def, {\n\t\t\t\t...refs,\n\t\t\t\tcurrentPath: [\n\t\t\t\t\t...refs.currentPath,\n\t\t\t\t\t\"properties\",\n\t\t\t\t\tkey\n\t\t\t\t]\n\t\t\t}) ?? parseAnyDef(refs)\n\t\t}), {}),\n\t\tadditionalProperties: refs.rejectedAdditionalProperties\n\t};\n\tconst schema = {\n\t\ttype: \"object\",\n\t\tadditionalProperties: parseDef(def.valueType._def, {\n\t\t\t...refs,\n\t\t\tcurrentPath: [...refs.currentPath, \"additionalProperties\"]\n\t\t}) ?? refs.allowedAdditionalProperties\n\t};\n\tif (refs.target === \"openApi3\") return schema;\n\tif (def.keyType?._def.typeName === ZodFirstPartyTypeKind.ZodString && def.keyType._def.checks?.length) {\n\t\tconst { type, ...keyType } = parseStringDef(def.keyType._def, refs);\n\t\treturn {\n\t\t\t...schema,\n\t\t\tpropertyNames: keyType\n\t\t};\n\t} else if (def.keyType?._def.typeName === ZodFirstPartyTypeKind.ZodEnum) return {\n\t\t...schema,\n\t\tpropertyNames: { enum: def.keyType._def.values }\n\t};\n\telse if (def.keyType?._def.typeName === ZodFirstPartyTypeKind.ZodBranded && def.keyType._def.type._def.typeName === ZodFirstPartyTypeKind.ZodString && def.keyType._def.type._def.checks?.length) {\n\t\tconst { type, ...keyType } = parseBrandedDef(def.keyType._def, refs);\n\t\treturn {\n\t\t\t...schema,\n\t\t\tpropertyNames: keyType\n\t\t};\n\t}\n\treturn schema;\n}\nfunction parseMapDef(def, refs) {\n\tif (refs.mapStrategy === \"record\") return parseRecordDef(def, refs);\n\treturn {\n\t\ttype: \"array\",\n\t\tmaxItems: 125,\n\t\titems: {\n\t\t\ttype: \"array\",\n\t\t\titems: [parseDef(def.keyType._def, {\n\t\t\t\t...refs,\n\t\t\t\tcurrentPath: [\n\t\t\t\t\t...refs.currentPath,\n\t\t\t\t\t\"items\",\n\t\t\t\t\t\"items\",\n\t\t\t\t\t\"0\"\n\t\t\t\t]\n\t\t\t}) || parseAnyDef(refs), parseDef(def.valueType._def, {\n\t\t\t\t...refs,\n\t\t\t\tcurrentPath: [\n\t\t\t\t\t...refs.currentPath,\n\t\t\t\t\t\"items\",\n\t\t\t\t\t\"items\",\n\t\t\t\t\t\"1\"\n\t\t\t\t]\n\t\t\t}) || parseAnyDef(refs)],\n\t\t\tminItems: 2,\n\t\t\tmaxItems: 2\n\t\t}\n\t};\n}\nfunction parseNativeEnumDef(def) {\n\tconst object = def.values;\n\tconst actualValues = Object.keys(def.values).filter((key) => {\n\t\treturn typeof object[object[key]] !== \"number\";\n\t}).map((key) => object[key]);\n\tconst parsedTypes = Array.from(new Set(actualValues.map((values) => typeof values)));\n\treturn {\n\t\ttype: parsedTypes.length === 1 ? parsedTypes[0] === \"string\" ? \"string\" : \"number\" : [\"string\", \"number\"],\n\t\tenum: actualValues\n\t};\n}\nfunction parseNeverDef(refs) {\n\treturn refs.target === \"openAi\" ? void 0 : { not: parseAnyDef({\n\t\t...refs,\n\t\tcurrentPath: [...refs.currentPath, \"not\"]\n\t}) };\n}\nfunction parseNullDef(refs) {\n\treturn refs.target === \"openApi3\" ? {\n\t\tenum: [\"null\"],\n\t\tnullable: true\n\t} : { type: \"null\" };\n}\nconst primitiveMappings = {\n\tZodString: \"string\",\n\tZodNumber: \"number\",\n\tZodBigInt: \"integer\",\n\tZodBoolean: \"boolean\",\n\tZodNull: \"null\"\n};\nfunction parseUnionDef(def, refs) {\n\tif (refs.target === \"openApi3\") return asAnyOf(def, refs);\n\tconst options = def.options instanceof Map ? Array.from(def.options.values()) : def.options;\n\tif (options.every((x) => x._def.typeName in primitiveMappings && (!x._def.checks || !x._def.checks.length))) {\n\t\tconst types = options.reduce((types, x) => {\n\t\t\tconst type = primitiveMappings[x._def.typeName];\n\t\t\treturn type && !types.includes(type) ? [...types, type] : types;\n\t\t}, []);\n\t\treturn { type: types.length > 1 ? types : types[0] };\n\t} else if (options.every((x) => x._def.typeName === \"ZodLiteral\" && !x.description)) {\n\t\tconst types = options.reduce((acc, x) => {\n\t\t\tconst type = typeof x._def.value;\n\t\t\tswitch (type) {\n\t\t\t\tcase \"string\":\n\t\t\t\tcase \"number\":\n\t\t\t\tcase \"boolean\": return [...acc, type];\n\t\t\t\tcase \"bigint\": return [...acc, \"integer\"];\n\t\t\t\tcase \"object\": if (x._def.value === null) return [...acc, \"null\"];\n\t\t\t\tdefault: return acc;\n\t\t\t}\n\t\t}, []);\n\t\tif (types.length === options.length) {\n\t\t\tconst uniqueTypes = types.filter((x, i, a) => a.indexOf(x) === i);\n\t\t\treturn {\n\t\t\t\ttype: uniqueTypes.length > 1 ? uniqueTypes : uniqueTypes[0],\n\t\t\t\tenum: options.reduce((acc, x) => {\n\t\t\t\t\treturn acc.includes(x._def.value) ? acc : [...acc, x._def.value];\n\t\t\t\t}, [])\n\t\t\t};\n\t\t}\n\t} else if (options.every((x) => x._def.typeName === \"ZodEnum\")) return {\n\t\ttype: \"string\",\n\t\tenum: options.reduce((acc, x) => [...acc, ...x._def.values.filter((x) => !acc.includes(x))], [])\n\t};\n\treturn asAnyOf(def, refs);\n}\nconst asAnyOf = (def, refs) => {\n\tconst anyOf = (def.options instanceof Map ? Array.from(def.options.values()) : def.options).map((x, i) => parseDef(x._def, {\n\t\t...refs,\n\t\tcurrentPath: [\n\t\t\t...refs.currentPath,\n\t\t\t\"anyOf\",\n\t\t\t`${i}`\n\t\t]\n\t})).filter((x) => !!x && (!refs.strictUnions || typeof x === \"object\" && Object.keys(x).length > 0));\n\treturn anyOf.length ? { anyOf } : void 0;\n};\nfunction parseNullableDef(def, refs) {\n\tif ([\n\t\t\"ZodString\",\n\t\t\"ZodNumber\",\n\t\t\"ZodBigInt\",\n\t\t\"ZodBoolean\",\n\t\t\"ZodNull\"\n\t].includes(def.innerType._def.typeName) && (!def.innerType._def.checks || !def.innerType._def.checks.length)) {\n\t\tif (refs.target === \"openApi3\") return {\n\t\t\ttype: primitiveMappings[def.innerType._def.typeName],\n\t\t\tnullable: true\n\t\t};\n\t\treturn { type: [primitiveMappings[def.innerType._def.typeName], \"null\"] };\n\t}\n\tif (refs.target === \"openApi3\") {\n\t\tconst base = parseDef(def.innerType._def, {\n\t\t\t...refs,\n\t\t\tcurrentPath: [...refs.currentPath]\n\t\t});\n\t\tif (base && \"$ref\" in base) return {\n\t\t\tallOf: [base],\n\t\t\tnullable: true\n\t\t};\n\t\treturn base && {\n\t\t\t...base,\n\t\t\tnullable: true\n\t\t};\n\t}\n\tconst base = parseDef(def.innerType._def, {\n\t\t...refs,\n\t\tcurrentPath: [\n\t\t\t...refs.currentPath,\n\t\t\t\"anyOf\",\n\t\t\t\"0\"\n\t\t]\n\t});\n\treturn base && { anyOf: [base, { type: \"null\" }] };\n}\nfunction parseNumberDef(def, refs) {\n\tconst res = { type: \"number\" };\n\tif (!def.checks) return res;\n\tfor (const check of def.checks) switch (check.kind) {\n\t\tcase \"int\":\n\t\t\tres.type = \"integer\";\n\t\t\taddErrorMessage(res, \"type\", check.message, refs);\n\t\t\tbreak;\n\t\tcase \"min\":\n\t\t\tif (refs.target === \"jsonSchema7\") if (check.inclusive) setResponseValueAndErrors(res, \"minimum\", check.value, check.message, refs);\n\t\t\telse setResponseValueAndErrors(res, \"exclusiveMinimum\", check.value, check.message, refs);\n\t\t\telse {\n\t\t\t\tif (!check.inclusive) res.exclusiveMinimum = true;\n\t\t\t\tsetResponseValueAndErrors(res, \"minimum\", check.value, check.message, refs);\n\t\t\t}\n\t\t\tbreak;\n\t\tcase \"max\":\n\t\t\tif (refs.target === \"jsonSchema7\") if (check.inclusive) setResponseValueAndErrors(res, \"maximum\", check.value, check.message, refs);\n\t\t\telse setResponseValueAndErrors(res, \"exclusiveMaximum\", check.value, check.message, refs);\n\t\t\telse {\n\t\t\t\tif (!check.inclusive) res.exclusiveMaximum = true;\n\t\t\t\tsetResponseValueAndErrors(res, \"maximum\", check.value, check.message, refs);\n\t\t\t}\n\t\t\tbreak;\n\t\tcase \"multipleOf\":\n\t\t\tsetResponseValueAndErrors(res, \"multipleOf\", check.value, check.message, refs);\n\t\t\tbreak;\n\t}\n\treturn res;\n}\nfunction parseObjectDef(def, refs) {\n\tconst forceOptionalIntoNullable = refs.target === \"openAi\";\n\tconst result = {\n\t\ttype: \"object\",\n\t\tproperties: {}\n\t};\n\tconst required = [];\n\tconst shape = def.shape();\n\tfor (const propName in shape) {\n\t\tlet propDef = shape[propName];\n\t\tif (propDef === void 0 || propDef._def === void 0) continue;\n\t\tlet propOptional = safeIsOptional(propDef);\n\t\tif (propOptional && forceOptionalIntoNullable) {\n\t\t\tif (propDef._def.typeName === \"ZodOptional\") propDef = propDef._def.innerType;\n\t\t\tif (!propDef.isNullable()) propDef = propDef.nullable();\n\t\t\tpropOptional = false;\n\t\t}\n\t\tconst parsedDef = parseDef(propDef._def, {\n\t\t\t...refs,\n\t\t\tcurrentPath: [\n\t\t\t\t...refs.currentPath,\n\t\t\t\t\"properties\",\n\t\t\t\tpropName\n\t\t\t],\n\t\t\tpropertyPath: [\n\t\t\t\t...refs.currentPath,\n\t\t\t\t\"properties\",\n\t\t\t\tpropName\n\t\t\t]\n\t\t});\n\t\tif (parsedDef === void 0) continue;\n\t\tresult.properties[propName] = parsedDef;\n\t\tif (!propOptional) required.push(propName);\n\t}\n\tif (required.length) result.required = required;\n\tconst additionalProperties = decideAdditionalProperties(def, refs);\n\tif (additionalProperties !== void 0) result.additionalProperties = additionalProperties;\n\treturn result;\n}\nfunction decideAdditionalProperties(def, refs) {\n\tif (def.catchall._def.typeName !== \"ZodNever\") return parseDef(def.catchall._def, {\n\t\t...refs,\n\t\tcurrentPath: [...refs.currentPath, \"additionalProperties\"]\n\t});\n\tswitch (def.unknownKeys) {\n\t\tcase \"passthrough\": return refs.allowedAdditionalProperties;\n\t\tcase \"strict\": return refs.rejectedAdditionalProperties;\n\t\tcase \"strip\": return refs.removeAdditionalStrategy === \"strict\" ? refs.allowedAdditionalProperties : refs.rejectedAdditionalProperties;\n\t}\n}\nfunction safeIsOptional(schema) {\n\ttry {\n\t\treturn schema.isOptional();\n\t} catch {\n\t\treturn true;\n\t}\n}\nconst parseOptionalDef = (def, refs) => {\n\tif (refs.currentPath.toString() === refs.propertyPath?.toString()) return parseDef(def.innerType._def, refs);\n\tconst innerSchema = parseDef(def.innerType._def, {\n\t\t...refs,\n\t\tcurrentPath: [\n\t\t\t...refs.currentPath,\n\t\t\t\"anyOf\",\n\t\t\t\"1\"\n\t\t]\n\t});\n\treturn innerSchema ? { anyOf: [{ not: parseAnyDef(refs) }, innerSchema] } : parseAnyDef(refs);\n};\nconst parsePipelineDef = (def, refs) => {\n\tif (refs.pipeStrategy === \"input\") return parseDef(def.in._def, refs);\n\telse if (refs.pipeStrategy === \"output\") return parseDef(def.out._def, refs);\n\tconst a = parseDef(def.in._def, {\n\t\t...refs,\n\t\tcurrentPath: [\n\t\t\t...refs.currentPath,\n\t\t\t\"allOf\",\n\t\t\t\"0\"\n\t\t]\n\t});\n\treturn { allOf: [a, parseDef(def.out._def, {\n\t\t...refs,\n\t\tcurrentPath: [\n\t\t\t...refs.currentPath,\n\t\t\t\"allOf\",\n\t\t\ta ? \"1\" : \"0\"\n\t\t]\n\t})].filter((x) => x !== void 0) };\n};\nfunction parsePromiseDef(def, refs) {\n\treturn parseDef(def.type._def, refs);\n}\nfunction parseSetDef(def, refs) {\n\tconst schema = {\n\t\ttype: \"array\",\n\t\tuniqueItems: true,\n\t\titems: parseDef(def.valueType._def, {\n\t\t\t...refs,\n\t\t\tcurrentPath: [...refs.currentPath, \"items\"]\n\t\t})\n\t};\n\tif (def.minSize) setResponseValueAndErrors(schema, \"minItems\", def.minSize.value, def.minSize.message, refs);\n\tif (def.maxSize) setResponseValueAndErrors(schema, \"maxItems\", def.maxSize.value, def.maxSize.message, refs);\n\treturn schema;\n}\nfunction parseTupleDef(def, refs) {\n\tif (def.rest) return {\n\t\ttype: \"array\",\n\t\tminItems: def.items.length,\n\t\titems: def.items.map((x, i) => parseDef(x._def, {\n\t\t\t...refs,\n\t\t\tcurrentPath: [\n\t\t\t\t...refs.currentPath,\n\t\t\t\t\"items\",\n\t\t\t\t`${i}`\n\t\t\t]\n\t\t})).reduce((acc, x) => x === void 0 ? acc : [...acc, x], []),\n\t\tadditionalItems: parseDef(def.rest._def, {\n\t\t\t...refs,\n\t\t\tcurrentPath: [...refs.currentPath, \"additionalItems\"]\n\t\t})\n\t};\n\telse return {\n\t\ttype: \"array\",\n\t\tminItems: def.items.length,\n\t\tmaxItems: def.items.length,\n\t\titems: def.items.map((x, i) => parseDef(x._def, {\n\t\t\t...refs,\n\t\t\tcurrentPath: [\n\t\t\t\t...refs.currentPath,\n\t\t\t\t\"items\",\n\t\t\t\t`${i}`\n\t\t\t]\n\t\t})).reduce((acc, x) => x === void 0 ? acc : [...acc, x], [])\n\t};\n}\nfunction parseUndefinedDef(refs) {\n\treturn { not: parseAnyDef(refs) };\n}\nfunction parseUnknownDef(refs) {\n\treturn parseAnyDef(refs);\n}\nconst parseReadonlyDef = (def, refs) => {\n\treturn parseDef(def.innerType._def, refs);\n};\nconst selectParser = (def, typeName, refs) => {\n\tswitch (typeName) {\n\t\tcase ZodFirstPartyTypeKind.ZodString: return parseStringDef(def, refs);\n\t\tcase ZodFirstPartyTypeKind.ZodNumber: return parseNumberDef(def, refs);\n\t\tcase ZodFirstPartyTypeKind.ZodObject: return parseObjectDef(def, refs);\n\t\tcase ZodFirstPartyTypeKind.ZodBigInt: return parseBigintDef(def, refs);\n\t\tcase ZodFirstPartyTypeKind.ZodBoolean: return parseBooleanDef();\n\t\tcase ZodFirstPartyTypeKind.ZodDate: return parseDateDef(def, refs);\n\t\tcase ZodFirstPartyTypeKind.ZodUndefined: return parseUndefinedDef(refs);\n\t\tcase ZodFirstPartyTypeKind.ZodNull: return parseNullDef(refs);\n\t\tcase ZodFirstPartyTypeKind.ZodArray: return parseArrayDef(def, refs);\n\t\tcase ZodFirstPartyTypeKind.ZodUnion:\n\t\tcase ZodFirstPartyTypeKind.ZodDiscriminatedUnion: return parseUnionDef(def, refs);\n\t\tcase ZodFirstPartyTypeKind.ZodIntersection: return parseIntersectionDef(def, refs);\n\t\tcase ZodFirstPartyTypeKind.ZodTuple: return parseTupleDef(def, refs);\n\t\tcase ZodFirstPartyTypeKind.ZodRecord: return parseRecordDef(def, refs);\n\t\tcase ZodFirstPartyTypeKind.ZodLiteral: return parseLiteralDef(def, refs);\n\t\tcase ZodFirstPartyTypeKind.ZodEnum: return parseEnumDef(def);\n\t\tcase ZodFirstPartyTypeKind.ZodNativeEnum: return parseNativeEnumDef(def);\n\t\tcase ZodFirstPartyTypeKind.ZodNullable: return parseNullableDef(def, refs);\n\t\tcase ZodFirstPartyTypeKind.ZodOptional: return parseOptionalDef(def, refs);\n\t\tcase ZodFirstPartyTypeKind.ZodMap: return parseMapDef(def, refs);\n\t\tcase ZodFirstPartyTypeKind.ZodSet: return parseSetDef(def, refs);\n\t\tcase ZodFirstPartyTypeKind.ZodLazy: return () => def.getter()._def;\n\t\tcase ZodFirstPartyTypeKind.ZodPromise: return parsePromiseDef(def, refs);\n\t\tcase ZodFirstPartyTypeKind.ZodNaN:\n\t\tcase ZodFirstPartyTypeKind.ZodNever: return parseNeverDef(refs);\n\t\tcase ZodFirstPartyTypeKind.ZodEffects: return parseEffectsDef(def, refs);\n\t\tcase ZodFirstPartyTypeKind.ZodAny: return parseAnyDef(refs);\n\t\tcase ZodFirstPartyTypeKind.ZodUnknown: return parseUnknownDef(refs);\n\t\tcase ZodFirstPartyTypeKind.ZodDefault: return parseDefaultDef(def, refs);\n\t\tcase ZodFirstPartyTypeKind.ZodBranded: return parseBrandedDef(def, refs);\n\t\tcase ZodFirstPartyTypeKind.ZodReadonly: return parseReadonlyDef(def, refs);\n\t\tcase ZodFirstPartyTypeKind.ZodCatch: return parseCatchDef(def, refs);\n\t\tcase ZodFirstPartyTypeKind.ZodPipeline: return parsePipelineDef(def, refs);\n\t\tcase ZodFirstPartyTypeKind.ZodFunction:\n\t\tcase ZodFirstPartyTypeKind.ZodVoid:\n\t\tcase ZodFirstPartyTypeKind.ZodSymbol: return;\n\t\tdefault: return ((_) => void 0)(typeName);\n\t}\n};\nfunction parseDef(def, refs, forceResolution = false) {\n\tconst seenItem = refs.seen.get(def);\n\tif (refs.override) {\n\t\tconst overrideResult = refs.override?.(def, refs, seenItem, forceResolution);\n\t\tif (overrideResult !== ignoreOverride) return overrideResult;\n\t}\n\tif (seenItem && !forceResolution) {\n\t\tconst seenSchema = get$ref(seenItem, refs);\n\t\tif (seenSchema !== void 0) return seenSchema;\n\t}\n\tconst newItem = {\n\t\tdef,\n\t\tpath: refs.currentPath,\n\t\tjsonSchema: void 0\n\t};\n\trefs.seen.set(def, newItem);\n\tconst jsonSchemaOrGetter = selectParser(def, def.typeName, refs);\n\tconst jsonSchema = typeof jsonSchemaOrGetter === \"function\" ? parseDef(jsonSchemaOrGetter(), refs) : jsonSchemaOrGetter;\n\tif (jsonSchema) addMeta(def, refs, jsonSchema);\n\tif (refs.postProcess) {\n\t\tconst postProcessResult = refs.postProcess(jsonSchema, def, refs);\n\t\tnewItem.jsonSchema = jsonSchema;\n\t\treturn postProcessResult;\n\t}\n\tnewItem.jsonSchema = jsonSchema;\n\treturn jsonSchema;\n}\nconst get$ref = (item, refs) => {\n\tswitch (refs.$refStrategy) {\n\t\tcase \"root\": return { $ref: item.path.join(\"/\") };\n\t\tcase \"relative\": return { $ref: getRelativePath(refs.currentPath, item.path) };\n\t\tcase \"none\":\n\t\tcase \"seen\":\n\t\t\tif (item.path.length < refs.currentPath.length && item.path.every((value, index) => refs.currentPath[index] === value)) {\n\t\t\t\tconsole.warn(`Recursive reference detected at ${refs.currentPath.join(\"/\")}! Defaulting to any`);\n\t\t\t\treturn parseAnyDef(refs);\n\t\t\t}\n\t\t\treturn refs.$refStrategy === \"seen\" ? parseAnyDef(refs) : void 0;\n\t}\n};\nconst addMeta = (def, refs, jsonSchema) => {\n\tif (def.description) {\n\t\tjsonSchema.description = def.description;\n\t\tif (refs.markdownDescription) jsonSchema.markdownDescription = def.description;\n\t}\n\treturn jsonSchema;\n};\nconst zodToJsonSchema = (schema, options) => {\n\tconst refs = getRefs(options);\n\tlet definitions = typeof options === \"object\" && options.definitions ? Object.entries(options.definitions).reduce((acc, [name, schema]) => ({\n\t\t...acc,\n\t\t[name]: parseDef(schema._def, {\n\t\t\t...refs,\n\t\t\tcurrentPath: [\n\t\t\t\t...refs.basePath,\n\t\t\t\trefs.definitionPath,\n\t\t\t\tname\n\t\t\t]\n\t\t}, true) ?? parseAnyDef(refs)\n\t}), {}) : void 0;\n\tconst name = typeof options === \"string\" ? options : options?.nameStrategy === \"title\" ? void 0 : options?.name;\n\tconst main = parseDef(schema._def, name === void 0 ? refs : {\n\t\t...refs,\n\t\tcurrentPath: [\n\t\t\t...refs.basePath,\n\t\t\trefs.definitionPath,\n\t\t\tname\n\t\t]\n\t}, false) ?? parseAnyDef(refs);\n\tconst title = typeof options === \"object\" && options.name !== void 0 && options.nameStrategy === \"title\" ? options.name : void 0;\n\tif (title !== void 0) main.title = title;\n\tif (refs.flags.hasReferencedOpenAiAnyType) {\n\t\tif (!definitions) definitions = {};\n\t\tif (!definitions[refs.openAiAnyTypeName]) definitions[refs.openAiAnyTypeName] = {\n\t\t\ttype: [\n\t\t\t\t\"string\",\n\t\t\t\t\"number\",\n\t\t\t\t\"integer\",\n\t\t\t\t\"boolean\",\n\t\t\t\t\"array\",\n\t\t\t\t\"null\"\n\t\t\t],\n\t\t\titems: { $ref: refs.$refStrategy === \"relative\" ? \"1\" : [\n\t\t\t\t...refs.basePath,\n\t\t\t\trefs.definitionPath,\n\t\t\t\trefs.openAiAnyTypeName\n\t\t\t].join(\"/\") }\n\t\t};\n\t}\n\tconst combined = name === void 0 ? definitions ? {\n\t\t...main,\n\t\t[refs.definitionPath]: definitions\n\t} : main : {\n\t\t$ref: [\n\t\t\t...refs.$refStrategy === \"relative\" ? [] : refs.basePath,\n\t\t\trefs.definitionPath,\n\t\t\tname\n\t\t].join(\"/\"),\n\t\t[refs.definitionPath]: {\n\t\t\t...definitions,\n\t\t\t[name]: main\n\t\t}\n\t};\n\tif (refs.target === \"jsonSchema7\") combined.$schema = \"http://json-schema.org/draft-07/schema#\";\n\telse if (refs.target === \"jsonSchema2019-09\" || refs.target === \"openAi\") combined.$schema = \"https://json-schema.org/draft/2019-09/schema#\";\n\tif (refs.target === \"openAi\" && (\"anyOf\" in combined || \"oneOf\" in combined || \"allOf\" in combined || \"type\" in combined && Array.isArray(combined.type))) console.warn(\"Warning: OpenAI may not support schemas with unions as roots! Try wrapping it in an object property.\");\n\treturn combined;\n};\nvar esm_default = zodToJsonSchema;\nvar textStreamPart = {\n\tcode: \"0\",\n\tname: \"text\",\n\tparse: (value) => {\n\t\tif (typeof value !== \"string\") throw new Error(\"\\\"text\\\" parts expect a string value.\");\n\t\treturn {\n\t\t\ttype: \"text\",\n\t\t\tvalue\n\t\t};\n\t}\n};\nvar errorStreamPart = {\n\tcode: \"3\",\n\tname: \"error\",\n\tparse: (value) => {\n\t\tif (typeof value !== \"string\") throw new Error(\"\\\"error\\\" parts expect a string value.\");\n\t\treturn {\n\t\t\ttype: \"error\",\n\t\t\tvalue\n\t\t};\n\t}\n};\nvar assistantMessageStreamPart = {\n\tcode: \"4\",\n\tname: \"assistant_message\",\n\tparse: (value) => {\n\t\tif (value == null || typeof value !== \"object\" || !(\"id\" in value) || !(\"role\" in value) || !(\"content\" in value) || typeof value.id !== \"string\" || typeof value.role !== \"string\" || value.role !== \"assistant\" || !Array.isArray(value.content) || !value.content.every((item) => item != null && typeof item === \"object\" && \"type\" in item && item.type === \"text\" && \"text\" in item && item.text != null && typeof item.text === \"object\" && \"value\" in item.text && typeof item.text.value === \"string\")) throw new Error(\"\\\"assistant_message\\\" parts expect an object with an \\\"id\\\", \\\"role\\\", and \\\"content\\\" property.\");\n\t\treturn {\n\t\t\ttype: \"assistant_message\",\n\t\t\tvalue\n\t\t};\n\t}\n};\nvar assistantControlDataStreamPart = {\n\tcode: \"5\",\n\tname: \"assistant_control_data\",\n\tparse: (value) => {\n\t\tif (value == null || typeof value !== \"object\" || !(\"threadId\" in value) || !(\"messageId\" in value) || typeof value.threadId !== \"string\" || typeof value.messageId !== \"string\") throw new Error(\"\\\"assistant_control_data\\\" parts expect an object with a \\\"threadId\\\" and \\\"messageId\\\" property.\");\n\t\treturn {\n\t\t\ttype: \"assistant_control_data\",\n\t\t\tvalue: {\n\t\t\t\tthreadId: value.threadId,\n\t\t\t\tmessageId: value.messageId\n\t\t\t}\n\t\t};\n\t}\n};\nvar dataMessageStreamPart = {\n\tcode: \"6\",\n\tname: \"data_message\",\n\tparse: (value) => {\n\t\tif (value == null || typeof value !== \"object\" || !(\"role\" in value) || !(\"data\" in value) || typeof value.role !== \"string\" || value.role !== \"data\") throw new Error(\"\\\"data_message\\\" parts expect an object with a \\\"role\\\" and \\\"data\\\" property.\");\n\t\treturn {\n\t\t\ttype: \"data_message\",\n\t\t\tvalue\n\t\t};\n\t}\n};\nvar assistantStreamParts = [\n\ttextStreamPart,\n\terrorStreamPart,\n\tassistantMessageStreamPart,\n\tassistantControlDataStreamPart,\n\tdataMessageStreamPart\n];\ntextStreamPart.code, errorStreamPart.code, assistantMessageStreamPart.code, assistantControlDataStreamPart.code, dataMessageStreamPart.code;\ntextStreamPart.name, textStreamPart.code, errorStreamPart.name, errorStreamPart.code, assistantMessageStreamPart.name, assistantMessageStreamPart.code, assistantControlDataStreamPart.name, assistantControlDataStreamPart.code, dataMessageStreamPart.name, dataMessageStreamPart.code;\nassistantStreamParts.map((part) => part.code);\nfunction fixJson(input) {\n\tconst stack = [\"ROOT\"];\n\tlet lastValidIndex = -1;\n\tlet literalStart = null;\n\tfunction processValueStart(char, i, swapState) {\n\t\tswitch (char) {\n\t\t\tcase \"\\\"\":\n\t\t\t\tlastValidIndex = i;\n\t\t\t\tstack.pop();\n\t\t\t\tstack.push(swapState);\n\t\t\t\tstack.push(\"INSIDE_STRING\");\n\t\t\t\tbreak;\n\t\t\tcase \"f\":\n\t\t\tcase \"t\":\n\t\t\tcase \"n\":\n\t\t\t\tlastValidIndex = i;\n\t\t\t\tliteralStart = i;\n\t\t\t\tstack.pop();\n\t\t\t\tstack.push(swapState);\n\t\t\t\tstack.push(\"INSIDE_LITERAL\");\n\t\t\t\tbreak;\n\t\t\tcase \"-\":\n\t\t\t\tstack.pop();\n\t\t\t\tstack.push(swapState);\n\t\t\t\tstack.push(\"INSIDE_NUMBER\");\n\t\t\t\tbreak;\n\t\t\tcase \"0\":\n\t\t\tcase \"1\":\n\t\t\tcase \"2\":\n\t\t\tcase \"3\":\n\t\t\tcase \"4\":\n\t\t\tcase \"5\":\n\t\t\tcase \"6\":\n\t\t\tcase \"7\":\n\t\t\tcase \"8\":\n\t\t\tcase \"9\":\n\t\t\t\tlastValidIndex = i;\n\t\t\t\tstack.pop();\n\t\t\t\tstack.push(swapState);\n\t\t\t\tstack.push(\"INSIDE_NUMBER\");\n\t\t\t\tbreak;\n\t\t\tcase \"{\":\n\t\t\t\tlastValidIndex = i;\n\t\t\t\tstack.pop();\n\t\t\t\tstack.push(swapState);\n\t\t\t\tstack.push(\"INSIDE_OBJECT_START\");\n\t\t\t\tbreak;\n\t\t\tcase \"[\":\n\t\t\t\tlastValidIndex = i;\n\t\t\t\tstack.pop();\n\t\t\t\tstack.push(swapState);\n\t\t\t\tstack.push(\"INSIDE_ARRAY_START\");\n\t\t\t\tbreak;\n\t\t}\n\t}\n\tfunction processAfterObjectValue(char, i) {\n\t\tswitch (char) {\n\t\t\tcase \",\":\n\t\t\t\tstack.pop();\n\t\t\t\tstack.push(\"INSIDE_OBJECT_AFTER_COMMA\");\n\t\t\t\tbreak;\n\t\t\tcase \"}\":\n\t\t\t\tlastValidIndex = i;\n\t\t\t\tstack.pop();\n\t\t\t\tbreak;\n\t\t}\n\t}\n\tfunction processAfterArrayValue(char, i) {\n\t\tswitch (char) {\n\t\t\tcase \",\":\n\t\t\t\tstack.pop();\n\t\t\t\tstack.push(\"INSIDE_ARRAY_AFTER_COMMA\");\n\t\t\t\tbreak;\n\t\t\tcase \"]\":\n\t\t\t\tlastValidIndex = i;\n\t\t\t\tstack.pop();\n\t\t\t\tbreak;\n\t\t}\n\t}\n\tfor (let i = 0; i < input.length; i++) {\n\t\tconst char = input[i];\n\t\tswitch (stack[stack.length - 1]) {\n\t\t\tcase \"ROOT\":\n\t\t\t\tprocessValueStart(char, i, \"FINISH\");\n\t\t\t\tbreak;\n\t\t\tcase \"INSIDE_OBJECT_START\":\n\t\t\t\tswitch (char) {\n\t\t\t\t\tcase \"\\\"\":\n\t\t\t\t\t\tstack.pop();\n\t\t\t\t\t\tstack.push(\"INSIDE_OBJECT_KEY\");\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"}\":\n\t\t\t\t\t\tlastValidIndex = i;\n\t\t\t\t\t\tstack.pop();\n\t\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase \"INSIDE_OBJECT_AFTER_COMMA\":\n\t\t\t\tswitch (char) {\n\t\t\t\t\tcase \"\\\"\":\n\t\t\t\t\t\tstack.pop();\n\t\t\t\t\t\tstack.push(\"INSIDE_OBJECT_KEY\");\n\t\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase \"INSIDE_OBJECT_KEY\":\n\t\t\t\tswitch (char) {\n\t\t\t\t\tcase \"\\\"\":\n\t\t\t\t\t\tstack.pop();\n\t\t\t\t\t\tstack.push(\"INSIDE_OBJECT_AFTER_KEY\");\n\t\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase \"INSIDE_OBJECT_AFTER_KEY\":\n\t\t\t\tswitch (char) {\n\t\t\t\t\tcase \":\":\n\t\t\t\t\t\tstack.pop();\n\t\t\t\t\t\tstack.push(\"INSIDE_OBJECT_BEFORE_VALUE\");\n\t\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase \"INSIDE_OBJECT_BEFORE_VALUE\":\n\t\t\t\tprocessValueStart(char, i, \"INSIDE_OBJECT_AFTER_VALUE\");\n\t\t\t\tbreak;\n\t\t\tcase \"INSIDE_OBJECT_AFTER_VALUE\":\n\t\t\t\tprocessAfterObjectValue(char, i);\n\t\t\t\tbreak;\n\t\t\tcase \"INSIDE_STRING\":\n\t\t\t\tswitch (char) {\n\t\t\t\t\tcase \"\\\"\":\n\t\t\t\t\t\tstack.pop();\n\t\t\t\t\t\tlastValidIndex = i;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"\\\\\":\n\t\t\t\t\t\tstack.push(\"INSIDE_STRING_ESCAPE\");\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tdefault: lastValidIndex = i;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase \"INSIDE_ARRAY_START\":\n\t\t\t\tswitch (char) {\n\t\t\t\t\tcase \"]\":\n\t\t\t\t\t\tlastValidIndex = i;\n\t\t\t\t\t\tstack.pop();\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tlastValidIndex = i;\n\t\t\t\t\t\tprocessValueStart(char, i, \"INSIDE_ARRAY_AFTER_VALUE\");\n\t\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase \"INSIDE_ARRAY_AFTER_VALUE\":\n\t\t\t\tswitch (char) {\n\t\t\t\t\tcase \",\":\n\t\t\t\t\t\tstack.pop();\n\t\t\t\t\t\tstack.push(\"INSIDE_ARRAY_AFTER_COMMA\");\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"]\":\n\t\t\t\t\t\tlastValidIndex = i;\n\t\t\t\t\t\tstack.pop();\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tlastValidIndex = i;\n\t\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase \"INSIDE_ARRAY_AFTER_COMMA\":\n\t\t\t\tprocessValueStart(char, i, \"INSIDE_ARRAY_AFTER_VALUE\");\n\t\t\t\tbreak;\n\t\t\tcase \"INSIDE_STRING_ESCAPE\":\n\t\t\t\tstack.pop();\n\t\t\t\tlastValidIndex = i;\n\t\t\t\tbreak;\n\t\t\tcase \"INSIDE_NUMBER\":\n\t\t\t\tswitch (char) {\n\t\t\t\t\tcase \"0\":\n\t\t\t\t\tcase \"1\":\n\t\t\t\t\tcase \"2\":\n\t\t\t\t\tcase \"3\":\n\t\t\t\t\tcase \"4\":\n\t\t\t\t\tcase \"5\":\n\t\t\t\t\tcase \"6\":\n\t\t\t\t\tcase \"7\":\n\t\t\t\t\tcase \"8\":\n\t\t\t\t\tcase \"9\":\n\t\t\t\t\t\tlastValidIndex = i;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"e\":\n\t\t\t\t\tcase \"E\":\n\t\t\t\t\tcase \"-\":\n\t\t\t\t\tcase \".\": break;\n\t\t\t\t\tcase \",\":\n\t\t\t\t\t\tstack.pop();\n\t\t\t\t\t\tif (stack[stack.length - 1] === \"INSIDE_ARRAY_AFTER_VALUE\") processAfterArrayValue(char, i);\n\t\t\t\t\t\tif (stack[stack.length - 1] === \"INSIDE_OBJECT_AFTER_VALUE\") processAfterObjectValue(char, i);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"}\":\n\t\t\t\t\t\tstack.pop();\n\t\t\t\t\t\tif (stack[stack.length - 1] === \"INSIDE_OBJECT_AFTER_VALUE\") processAfterObjectValue(char, i);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"]\":\n\t\t\t\t\t\tstack.pop();\n\t\t\t\t\t\tif (stack[stack.length - 1] === \"INSIDE_ARRAY_AFTER_VALUE\") processAfterArrayValue(char, i);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tstack.pop();\n\t\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase \"INSIDE_LITERAL\": {\n\t\t\t\tconst partialLiteral = input.substring(literalStart, i + 1);\n\t\t\t\tif (!\"false\".startsWith(partialLiteral) && !\"true\".startsWith(partialLiteral) && !\"null\".startsWith(partialLiteral)) {\n\t\t\t\t\tstack.pop();\n\t\t\t\t\tif (stack[stack.length - 1] === \"INSIDE_OBJECT_AFTER_VALUE\") processAfterObjectValue(char, i);\n\t\t\t\t\telse if (stack[stack.length - 1] === \"INSIDE_ARRAY_AFTER_VALUE\") processAfterArrayValue(char, i);\n\t\t\t\t} else lastValidIndex = i;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\tlet result = input.slice(0, lastValidIndex + 1);\n\tfor (let i = stack.length - 1; i >= 0; i--) switch (stack[i]) {\n\t\tcase \"INSIDE_STRING\":\n\t\t\tresult += \"\\\"\";\n\t\t\tbreak;\n\t\tcase \"INSIDE_OBJECT_KEY\":\n\t\tcase \"INSIDE_OBJECT_AFTER_KEY\":\n\t\tcase \"INSIDE_OBJECT_AFTER_COMMA\":\n\t\tcase \"INSIDE_OBJECT_START\":\n\t\tcase \"INSIDE_OBJECT_BEFORE_VALUE\":\n\t\tcase \"INSIDE_OBJECT_AFTER_VALUE\":\n\t\t\tresult += \"}\";\n\t\t\tbreak;\n\t\tcase \"INSIDE_ARRAY_START\":\n\t\tcase \"INSIDE_ARRAY_AFTER_COMMA\":\n\t\tcase \"INSIDE_ARRAY_AFTER_VALUE\":\n\t\t\tresult += \"]\";\n\t\t\tbreak;\n\t\tcase \"INSIDE_LITERAL\": {\n\t\t\tconst partialLiteral = input.substring(literalStart, input.length);\n\t\t\tif (\"true\".startsWith(partialLiteral)) result += \"true\".slice(partialLiteral.length);\n\t\t\telse if (\"false\".startsWith(partialLiteral)) result += \"false\".slice(partialLiteral.length);\n\t\t\telse if (\"null\".startsWith(partialLiteral)) result += \"null\".slice(partialLiteral.length);\n\t\t}\n\t}\n\treturn result;\n}\nfunction parsePartialJson(jsonText) {\n\tif (jsonText === void 0) return {\n\t\tvalue: void 0,\n\t\tstate: \"undefined-input\"\n\t};\n\tlet result = safeParseJSON({ text: jsonText });\n\tif (result.success) return {\n\t\tvalue: result.value,\n\t\tstate: \"successful-parse\"\n\t};\n\tresult = safeParseJSON({ text: fixJson(jsonText) });\n\tif (result.success) return {\n\t\tvalue: result.value,\n\t\tstate: \"repaired-parse\"\n\t};\n\treturn {\n\t\tvalue: void 0,\n\t\tstate: \"failed-parse\"\n\t};\n}\nvar dataStreamParts = [\n\t{\n\t\tcode: \"0\",\n\t\tname: \"text\",\n\t\tparse: (value) => {\n\t\t\tif (typeof value !== \"string\") throw new Error(\"\\\"text\\\" parts expect a string value.\");\n\t\t\treturn {\n\t\t\t\ttype: \"text\",\n\t\t\t\tvalue\n\t\t\t};\n\t\t}\n\t},\n\t{\n\t\tcode: \"2\",\n\t\tname: \"data\",\n\t\tparse: (value) => {\n\t\t\tif (!Array.isArray(value)) throw new Error(\"\\\"data\\\" parts expect an array value.\");\n\t\t\treturn {\n\t\t\t\ttype: \"data\",\n\t\t\t\tvalue\n\t\t\t};\n\t\t}\n\t},\n\t{\n\t\tcode: \"3\",\n\t\tname: \"error\",\n\t\tparse: (value) => {\n\t\t\tif (typeof value !== \"string\") throw new Error(\"\\\"error\\\" parts expect a string value.\");\n\t\t\treturn {\n\t\t\t\ttype: \"error\",\n\t\t\t\tvalue\n\t\t\t};\n\t\t}\n\t},\n\t{\n\t\tcode: \"8\",\n\t\tname: \"message_annotations\",\n\t\tparse: (value) => {\n\t\t\tif (!Array.isArray(value)) throw new Error(\"\\\"message_annotations\\\" parts expect an array value.\");\n\t\t\treturn {\n\t\t\t\ttype: \"message_annotations\",\n\t\t\t\tvalue\n\t\t\t};\n\t\t}\n\t},\n\t{\n\t\tcode: \"9\",\n\t\tname: \"tool_call\",\n\t\tparse: (value) => {\n\t\t\tif (value == null || typeof value !== \"object\" || !(\"toolCallId\" in value) || typeof value.toolCallId !== \"string\" || !(\"toolName\" in value) || typeof value.toolName !== \"string\" || !(\"args\" in value) || typeof value.args !== \"object\") throw new Error(\"\\\"tool_call\\\" parts expect an object with a \\\"toolCallId\\\", \\\"toolName\\\", and \\\"args\\\" property.\");\n\t\t\treturn {\n\t\t\t\ttype: \"tool_call\",\n\t\t\t\tvalue\n\t\t\t};\n\t\t}\n\t},\n\t{\n\t\tcode: \"a\",\n\t\tname: \"tool_result\",\n\t\tparse: (value) => {\n\t\t\tif (value == null || typeof value !== \"object\" || !(\"toolCallId\" in value) || typeof value.toolCallId !== \"string\" || !(\"result\" in value)) throw new Error(\"\\\"tool_result\\\" parts expect an object with a \\\"toolCallId\\\" and a \\\"result\\\" property.\");\n\t\t\treturn {\n\t\t\t\ttype: \"tool_result\",\n\t\t\t\tvalue\n\t\t\t};\n\t\t}\n\t},\n\t{\n\t\tcode: \"b\",\n\t\tname: \"tool_call_streaming_start\",\n\t\tparse: (value) => {\n\t\t\tif (value == null || typeof value !== \"object\" || !(\"toolCallId\" in value) || typeof value.toolCallId !== \"string\" || !(\"toolName\" in value) || typeof value.toolName !== \"string\") throw new Error(\"\\\"tool_call_streaming_start\\\" parts expect an object with a \\\"toolCallId\\\" and \\\"toolName\\\" property.\");\n\t\t\treturn {\n\t\t\t\ttype: \"tool_call_streaming_start\",\n\t\t\t\tvalue\n\t\t\t};\n\t\t}\n\t},\n\t{\n\t\tcode: \"c\",\n\t\tname: \"tool_call_delta\",\n\t\tparse: (value) => {\n\t\t\tif (value == null || typeof value !== \"object\" || !(\"toolCallId\" in value) || typeof value.toolCallId !== \"string\" || !(\"argsTextDelta\" in value) || typeof value.argsTextDelta !== \"string\") throw new Error(\"\\\"tool_call_delta\\\" parts expect an object with a \\\"toolCallId\\\" and \\\"argsTextDelta\\\" property.\");\n\t\t\treturn {\n\t\t\t\ttype: \"tool_call_delta\",\n\t\t\t\tvalue\n\t\t\t};\n\t\t}\n\t},\n\t{\n\t\tcode: \"d\",\n\t\tname: \"finish_message\",\n\t\tparse: (value) => {\n\t\t\tif (value == null || typeof value !== \"object\" || !(\"finishReason\" in value) || typeof value.finishReason !== \"string\") throw new Error(\"\\\"finish_message\\\" parts expect an object with a \\\"finishReason\\\" property.\");\n\t\t\tconst result = { finishReason: value.finishReason };\n\t\t\tif (\"usage\" in value && value.usage != null && typeof value.usage === \"object\" && \"promptTokens\" in value.usage && \"completionTokens\" in value.usage) result.usage = {\n\t\t\t\tpromptTokens: typeof value.usage.promptTokens === \"number\" ? value.usage.promptTokens : NaN,\n\t\t\t\tcompletionTokens: typeof value.usage.completionTokens === \"number\" ? value.usage.completionTokens : NaN\n\t\t\t};\n\t\t\treturn {\n\t\t\t\ttype: \"finish_message\",\n\t\t\t\tvalue: result\n\t\t\t};\n\t\t}\n\t},\n\t{\n\t\tcode: \"e\",\n\t\tname: \"finish_step\",\n\t\tparse: (value) => {\n\t\t\tif (value == null || typeof value !== \"object\" || !(\"finishReason\" in value) || typeof value.finishReason !== \"string\") throw new Error(\"\\\"finish_step\\\" parts expect an object with a \\\"finishReason\\\" property.\");\n\t\t\tconst result = {\n\t\t\t\tfinishReason: value.finishReason,\n\t\t\t\tisContinued: false\n\t\t\t};\n\t\t\tif (\"usage\" in value && value.usage != null && typeof value.usage === \"object\" && \"promptTokens\" in value.usage && \"completionTokens\" in value.usage) result.usage = {\n\t\t\t\tpromptTokens: typeof value.usage.promptTokens === \"number\" ? value.usage.promptTokens : NaN,\n\t\t\t\tcompletionTokens: typeof value.usage.completionTokens === \"number\" ? value.usage.completionTokens : NaN\n\t\t\t};\n\t\t\tif (\"isContinued\" in value && typeof value.isContinued === \"boolean\") result.isContinued = value.isContinued;\n\t\t\treturn {\n\t\t\t\ttype: \"finish_step\",\n\t\t\t\tvalue: result\n\t\t\t};\n\t\t}\n\t},\n\t{\n\t\tcode: \"f\",\n\t\tname: \"start_step\",\n\t\tparse: (value) => {\n\t\t\tif (value == null || typeof value !== \"object\" || !(\"messageId\" in value) || typeof value.messageId !== \"string\") throw new Error(\"\\\"start_step\\\" parts expect an object with an \\\"id\\\" property.\");\n\t\t\treturn {\n\t\t\t\ttype: \"start_step\",\n\t\t\t\tvalue: { messageId: value.messageId }\n\t\t\t};\n\t\t}\n\t},\n\t{\n\t\tcode: \"g\",\n\t\tname: \"reasoning\",\n\t\tparse: (value) => {\n\t\t\tif (typeof value !== \"string\") throw new Error(\"\\\"reasoning\\\" parts expect a string value.\");\n\t\t\treturn {\n\t\t\t\ttype: \"reasoning\",\n\t\t\t\tvalue\n\t\t\t};\n\t\t}\n\t},\n\t{\n\t\tcode: \"h\",\n\t\tname: \"source\",\n\t\tparse: (value) => {\n\t\t\tif (value == null || typeof value !== \"object\") throw new Error(\"\\\"source\\\" parts expect a Source object.\");\n\t\t\treturn {\n\t\t\t\ttype: \"source\",\n\t\t\t\tvalue\n\t\t\t};\n\t\t}\n\t},\n\t{\n\t\tcode: \"i\",\n\t\tname: \"redacted_reasoning\",\n\t\tparse: (value) => {\n\t\t\tif (value == null || typeof value !== \"object\" || !(\"data\" in value) || typeof value.data !== \"string\") throw new Error(\"\\\"redacted_reasoning\\\" parts expect an object with a \\\"data\\\" property.\");\n\t\t\treturn {\n\t\t\t\ttype: \"redacted_reasoning\",\n\t\t\t\tvalue: { data: value.data }\n\t\t\t};\n\t\t}\n\t},\n\t{\n\t\tcode: \"j\",\n\t\tname: \"reasoning_signature\",\n\t\tparse: (value) => {\n\t\t\tif (value == null || typeof value !== \"object\" || !(\"signature\" in value) || typeof value.signature !== \"string\") throw new Error(\"\\\"reasoning_signature\\\" parts expect an object with a \\\"signature\\\" property.\");\n\t\t\treturn {\n\t\t\t\ttype: \"reasoning_signature\",\n\t\t\t\tvalue: { signature: value.signature }\n\t\t\t};\n\t\t}\n\t},\n\t{\n\t\tcode: \"k\",\n\t\tname: \"file\",\n\t\tparse: (value) => {\n\t\t\tif (value == null || typeof value !== \"object\" || !(\"data\" in value) || typeof value.data !== \"string\" || !(\"mimeType\" in value) || typeof value.mimeType !== \"string\") throw new Error(\"\\\"file\\\" parts expect an object with a \\\"data\\\" and \\\"mimeType\\\" property.\");\n\t\t\treturn {\n\t\t\t\ttype: \"file\",\n\t\t\t\tvalue\n\t\t\t};\n\t\t}\n\t}\n];\nObject.fromEntries(dataStreamParts.map((part) => [part.code, part]));\nObject.fromEntries(dataStreamParts.map((part) => [part.name, part.code]));\ndataStreamParts.map((part) => part.code);\nfunction formatDataStreamPart(type, value) {\n\tconst streamPart = dataStreamParts.find((part) => part.name === type);\n\tif (!streamPart) throw new Error(`Invalid stream part type: ${type}`);\n\treturn `${streamPart.code}:${JSON.stringify(value)}\n`;\n}\n\"\\n\".charCodeAt(0);\n\"\\n\".charCodeAt(0);\nfunction zodSchema(zodSchema2, options) {\n\tvar _a;\n\treturn jsonSchema(esm_default(zodSchema2, {\n\t\t$refStrategy: ((_a = options == null ? void 0 : options.useReferences) != null ? _a : false) ? \"root\" : \"none\",\n\t\ttarget: \"jsonSchema7\"\n\t}), { validate: (value) => {\n\t\tconst result = zodSchema2.safeParse(value);\n\t\treturn result.success ? {\n\t\t\tsuccess: true,\n\t\t\tvalue: result.data\n\t\t} : {\n\t\t\tsuccess: false,\n\t\t\terror: result.error\n\t\t};\n\t} });\n}\nvar schemaSymbol = Symbol.for(\"vercel.ai.schema\");\nfunction jsonSchema(jsonSchema2, { validate } = {}) {\n\treturn {\n\t\t[schemaSymbol]: true,\n\t\t_type: void 0,\n\t\t[validatorSymbol]: true,\n\t\tjsonSchema: jsonSchema2,\n\t\tvalidate\n\t};\n}\nfunction isSchema(value) {\n\treturn typeof value === \"object\" && value !== null && schemaSymbol in value && value[schemaSymbol] === true && \"jsonSchema\" in value && \"validate\" in value;\n}\nfunction asSchema(schema) {\n\treturn isSchema(schema) ? schema : zodSchema(schema);\n}\n/** only globals that common to node and browsers are allowed */\nvar _globalThis = typeof globalThis === \"object\" ? globalThis : global;\nvar VERSION = \"1.9.0\";\nvar re = /^(\\d+)\\.(\\d+)\\.(\\d+)(-(.+))?$/;\n/**\n* Create a function to test an API version to see if it is compatible with the provided ownVersion.\n*\n* The returned function has the following semantics:\n* - Exact match is always compatible\n* - Major versions must match exactly\n* - 1.x package cannot use global 2.x package\n* - 2.x package cannot use global 1.x package\n* - The minor version of the API module requesting access to the global API must be less than or equal to the minor version of this API\n* - 1.3 package may use 1.4 global because the later global contains all functions 1.3 expects\n* - 1.4 package may NOT use 1.3 global because it may try to call functions which don't exist on 1.3\n* - If the major version is 0, the minor version is treated as the major and the patch is treated as the minor\n* - Patch and build tag differences are not considered at this time\n*\n* @param ownVersion version which should be checked against\n*/\nfunction _makeCompatibilityCheck(ownVersion) {\n\tvar acceptedVersions = /* @__PURE__ */ new Set([ownVersion]);\n\tvar rejectedVersions = /* @__PURE__ */ new Set();\n\tvar myVersionMatch = ownVersion.match(re);\n\tif (!myVersionMatch) return function() {\n\t\treturn false;\n\t};\n\tvar ownVersionParsed = {\n\t\tmajor: +myVersionMatch[1],\n\t\tminor: +myVersionMatch[2],\n\t\tpatch: +myVersionMatch[3],\n\t\tprerelease: myVersionMatch[4]\n\t};\n\tif (ownVersionParsed.prerelease != null) return function isExactmatch(globalVersion) {\n\t\treturn globalVersion === ownVersion;\n\t};\n\tfunction _reject(v) {\n\t\trejectedVersions.add(v);\n\t\treturn false;\n\t}\n\tfunction _accept(v) {\n\t\tacceptedVersions.add(v);\n\t\treturn true;\n\t}\n\treturn function isCompatible(globalVersion) {\n\t\tif (acceptedVersions.has(globalVersion)) return true;\n\t\tif (rejectedVersions.has(globalVersion)) return false;\n\t\tvar globalVersionMatch = globalVersion.match(re);\n\t\tif (!globalVersionMatch) return _reject(globalVersion);\n\t\tvar globalVersionParsed = {\n\t\t\tmajor: +globalVersionMatch[1],\n\t\t\tminor: +globalVersionMatch[2],\n\t\t\tpatch: +globalVersionMatch[3],\n\t\t\tprerelease: globalVersionMatch[4]\n\t\t};\n\t\tif (globalVersionParsed.prerelease != null) return _reject(globalVersion);\n\t\tif (ownVersionParsed.major !== globalVersionParsed.major) return _reject(globalVersion);\n\t\tif (ownVersionParsed.major === 0) {\n\t\t\tif (ownVersionParsed.minor === globalVersionParsed.minor && ownVersionParsed.patch <= globalVersionParsed.patch) return _accept(globalVersion);\n\t\t\treturn _reject(globalVersion);\n\t\t}\n\t\tif (ownVersionParsed.minor <= globalVersionParsed.minor) return _accept(globalVersion);\n\t\treturn _reject(globalVersion);\n\t};\n}\n/**\n* Test an API version to see if it is compatible with this API.\n*\n* - Exact match is always compatible\n* - Major versions must match exactly\n* - 1.x package cannot use global 2.x package\n* - 2.x package cannot use global 1.x package\n* - The minor version of the API module requesting access to the global API must be less than or equal to the minor version of this API\n* - 1.3 package may use 1.4 global because the later global contains all functions 1.3 expects\n* - 1.4 package may NOT use 1.3 global because it may try to call functions which don't exist on 1.3\n* - If the major version is 0, the minor version is treated as the major and the patch is treated as the minor\n* - Patch and build tag differences are not considered at this time\n*\n* @param version version of the API requesting an instance of the global API\n*/\nvar isCompatible = _makeCompatibilityCheck(VERSION);\nvar major = VERSION.split(\".\")[0];\nvar GLOBAL_OPENTELEMETRY_API_KEY = Symbol.for(\"opentelemetry.js.api.\" + major);\nvar _global = _globalThis;\nfunction registerGlobal(type, instance, diag, allowOverride) {\n\tvar _a;\n\tif (allowOverride === void 0) allowOverride = false;\n\tvar api = _global[GLOBAL_OPENTELEMETRY_API_KEY] = (_a = _global[GLOBAL_OPENTELEMETRY_API_KEY]) !== null && _a !== void 0 ? _a : { version: VERSION };\n\tif (!allowOverride && api[type]) {\n\t\tvar err = /* @__PURE__ */ new Error(\"@opentelemetry/api: Attempted duplicate registration of API: \" + type);\n\t\tdiag.error(err.stack || err.message);\n\t\treturn false;\n\t}\n\tif (api.version !== \"1.9.0\") {\n\t\tvar err = /* @__PURE__ */ new Error(\"@opentelemetry/api: Registration of version v\" + api.version + \" for \" + type + \" does not match previously registered API v\" + VERSION);\n\t\tdiag.error(err.stack || err.message);\n\t\treturn false;\n\t}\n\tapi[type] = instance;\n\tdiag.debug(\"@opentelemetry/api: Registered a global for \" + type + \" v\" + VERSION + \".\");\n\treturn true;\n}\nfunction getGlobal(type) {\n\tvar _a, _b;\n\tvar globalVersion = (_a = _global[GLOBAL_OPENTELEMETRY_API_KEY]) === null || _a === void 0 ? void 0 : _a.version;\n\tif (!globalVersion || !isCompatible(globalVersion)) return;\n\treturn (_b = _global[GLOBAL_OPENTELEMETRY_API_KEY]) === null || _b === void 0 ? void 0 : _b[type];\n}\nfunction unregisterGlobal(type, diag) {\n\tdiag.debug(\"@opentelemetry/api: Unregistering a global for \" + type + \" v\" + VERSION + \".\");\n\tvar api = _global[GLOBAL_OPENTELEMETRY_API_KEY];\n\tif (api) delete api[type];\n}\nvar __read$3 = function(o, n) {\n\tvar m = typeof Symbol === \"function\" && o[Symbol.iterator];\n\tif (!m) return o;\n\tvar i = m.call(o), r, ar = [], e;\n\ttry {\n\t\twhile ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\n\t} catch (error) {\n\t\te = { error };\n\t} finally {\n\t\ttry {\n\t\t\tif (r && !r.done && (m = i[\"return\"])) m.call(i);\n\t\t} finally {\n\t\t\tif (e) throw e.error;\n\t\t}\n\t}\n\treturn ar;\n};\nvar __spreadArray$3 = function(to, from, pack) {\n\tif (pack || arguments.length === 2) {\n\t\tfor (var i = 0, l = from.length, ar; i < l; i++) if (ar || !(i in from)) {\n\t\t\tif (!ar) ar = Array.prototype.slice.call(from, 0, i);\n\t\t\tar[i] = from[i];\n\t\t}\n\t}\n\treturn to.concat(ar || Array.prototype.slice.call(from));\n};\n/**\n* Component Logger which is meant to be used as part of any component which\n* will add automatically additional namespace in front of the log message.\n* It will then forward all message to global diag logger\n* @example\n* const cLogger = diag.createComponentLogger({ namespace: '@opentelemetry/instrumentation-http' });\n* cLogger.debug('test');\n* // @opentelemetry/instrumentation-http test\n*/\nvar DiagComponentLogger = function() {\n\tfunction DiagComponentLogger(props) {\n\t\tthis._namespace = props.namespace || \"DiagComponentLogger\";\n\t}\n\tDiagComponentLogger.prototype.debug = function() {\n\t\tvar args = [];\n\t\tfor (var _i = 0; _i < arguments.length; _i++) args[_i] = arguments[_i];\n\t\treturn logProxy(\"debug\", this._namespace, args);\n\t};\n\tDiagComponentLogger.prototype.error = function() {\n\t\tvar args = [];\n\t\tfor (var _i = 0; _i < arguments.length; _i++) args[_i] = arguments[_i];\n\t\treturn logProxy(\"error\", this._namespace, args);\n\t};\n\tDiagComponentLogger.prototype.info = function() {\n\t\tvar args = [];\n\t\tfor (var _i = 0; _i < arguments.length; _i++) args[_i] = arguments[_i];\n\t\treturn logProxy(\"info\", this._namespace, args);\n\t};\n\tDiagComponentLogger.prototype.warn = function() {\n\t\tvar args = [];\n\t\tfor (var _i = 0; _i < arguments.length; _i++) args[_i] = arguments[_i];\n\t\treturn logProxy(\"warn\", this._namespace, args);\n\t};\n\tDiagComponentLogger.prototype.verbose = function() {\n\t\tvar args = [];\n\t\tfor (var _i = 0; _i < arguments.length; _i++) args[_i] = arguments[_i];\n\t\treturn logProxy(\"verbose\", this._namespace, args);\n\t};\n\treturn DiagComponentLogger;\n}();\nfunction logProxy(funcName, namespace, args) {\n\tvar logger = getGlobal(\"diag\");\n\tif (!logger) return;\n\targs.unshift(namespace);\n\treturn logger[funcName].apply(logger, __spreadArray$3([], __read$3(args), false));\n}\n/**\n* Defines the available internal logging levels for the diagnostic logger, the numeric values\n* of the levels are defined to match the original values from the initial LogLevel to avoid\n* compatibility/migration issues for any implementation that assume the numeric ordering.\n*/\nvar DiagLogLevel;\n(function(DiagLogLevel) {\n\t/** Diagnostic Logging level setting to disable all logging (except and forced logs) */\n\tDiagLogLevel[DiagLogLevel[\"NONE\"] = 0] = \"NONE\";\n\t/** Identifies an error scenario */\n\tDiagLogLevel[DiagLogLevel[\"ERROR\"] = 30] = \"ERROR\";\n\t/** Identifies a warning scenario */\n\tDiagLogLevel[DiagLogLevel[\"WARN\"] = 50] = \"WARN\";\n\t/** General informational log message */\n\tDiagLogLevel[DiagLogLevel[\"INFO\"] = 60] = \"INFO\";\n\t/** General debug log message */\n\tDiagLogLevel[DiagLogLevel[\"DEBUG\"] = 70] = \"DEBUG\";\n\t/**\n\t* Detailed trace level logging should only be used for development, should only be set\n\t* in a development environment.\n\t*/\n\tDiagLogLevel[DiagLogLevel[\"VERBOSE\"] = 80] = \"VERBOSE\";\n\t/** Used to set the logging level to include all logging */\n\tDiagLogLevel[DiagLogLevel[\"ALL\"] = 9999] = \"ALL\";\n})(DiagLogLevel || (DiagLogLevel = {}));\nfunction createLogLevelDiagLogger(maxLevel, logger) {\n\tif (maxLevel < DiagLogLevel.NONE) maxLevel = DiagLogLevel.NONE;\n\telse if (maxLevel > DiagLogLevel.ALL) maxLevel = DiagLogLevel.ALL;\n\tlogger = logger || {};\n\tfunction _filterFunc(funcName, theLevel) {\n\t\tvar theFunc = logger[funcName];\n\t\tif (typeof theFunc === \"function\" && maxLevel >= theLevel) return theFunc.bind(logger);\n\t\treturn function() {};\n\t}\n\treturn {\n\t\terror: _filterFunc(\"error\", DiagLogLevel.ERROR),\n\t\twarn: _filterFunc(\"warn\", DiagLogLevel.WARN),\n\t\tinfo: _filterFunc(\"info\", DiagLogLevel.INFO),\n\t\tdebug: _filterFunc(\"debug\", DiagLogLevel.DEBUG),\n\t\tverbose: _filterFunc(\"verbose\", DiagLogLevel.VERBOSE)\n\t};\n}\nvar __read$2 = function(o, n) {\n\tvar m = typeof Symbol === \"function\" && o[Symbol.iterator];\n\tif (!m) return o;\n\tvar i = m.call(o), r, ar = [], e;\n\ttry {\n\t\twhile ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\n\t} catch (error) {\n\t\te = { error };\n\t} finally {\n\t\ttry {\n\t\t\tif (r && !r.done && (m = i[\"return\"])) m.call(i);\n\t\t} finally {\n\t\t\tif (e) throw e.error;\n\t\t}\n\t}\n\treturn ar;\n};\nvar __spreadArray$2 = function(to, from, pack) {\n\tif (pack || arguments.length === 2) {\n\t\tfor (var i = 0, l = from.length, ar; i < l; i++) if (ar || !(i in from)) {\n\t\t\tif (!ar) ar = Array.prototype.slice.call(from, 0, i);\n\t\t\tar[i] = from[i];\n\t\t}\n\t}\n\treturn to.concat(ar || Array.prototype.slice.call(from));\n};\nvar API_NAME$2 = \"diag\";\n/**\n* Singleton object which represents the entry point to the OpenTelemetry internal\n* diagnostic API\n*/\nvar DiagAPI = function() {\n\t/**\n\t* Private internal constructor\n\t* @private\n\t*/\n\tfunction DiagAPI() {\n\t\tfunction _logProxy(funcName) {\n\t\t\treturn function() {\n\t\t\t\tvar args = [];\n\t\t\t\tfor (var _i = 0; _i < arguments.length; _i++) args[_i] = arguments[_i];\n\t\t\t\tvar logger = getGlobal(\"diag\");\n\t\t\t\tif (!logger) return;\n\t\t\t\treturn logger[funcName].apply(logger, __spreadArray$2([], __read$2(args), false));\n\t\t\t};\n\t\t}\n\t\tvar self = this;\n\t\tvar setLogger = function(logger, optionsOrLogLevel) {\n\t\t\tvar _a, _b, _c;\n\t\t\tif (optionsOrLogLevel === void 0) optionsOrLogLevel = { logLevel: DiagLogLevel.INFO };\n\t\t\tif (logger === self) {\n\t\t\t\tvar err = /* @__PURE__ */ new Error(\"Cannot use diag as the logger for itself. Please use a DiagLogger implementation like ConsoleDiagLogger or a custom implementation\");\n\t\t\t\tself.error((_a = err.stack) !== null && _a !== void 0 ? _a : err.message);\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\tif (typeof optionsOrLogLevel === \"number\") optionsOrLogLevel = { logLevel: optionsOrLogLevel };\n\t\t\tvar oldLogger = getGlobal(\"diag\");\n\t\t\tvar newLogger = createLogLevelDiagLogger((_b = optionsOrLogLevel.logLevel) !== null && _b !== void 0 ? _b : DiagLogLevel.INFO, logger);\n\t\t\tif (oldLogger && !optionsOrLogLevel.suppressOverrideMessage) {\n\t\t\t\tvar stack = (_c = (/* @__PURE__ */ new Error()).stack) !== null && _c !== void 0 ? _c : \"<failed to generate stacktrace>\";\n\t\t\t\toldLogger.warn(\"Current logger will be overwritten from \" + stack);\n\t\t\t\tnewLogger.warn(\"Current logger will overwrite one already registered from \" + stack);\n\t\t\t}\n\t\t\treturn registerGlobal(\"diag\", newLogger, self, true);\n\t\t};\n\t\tself.setLogger = setLogger;\n\t\tself.disable = function() {\n\t\t\tunregisterGlobal(API_NAME$2, self);\n\t\t};\n\t\tself.createComponentLogger = function(options) {\n\t\t\treturn new DiagComponentLogger(options);\n\t\t};\n\t\tself.verbose = _logProxy(\"verbose\");\n\t\tself.debug = _logProxy(\"debug\");\n\t\tself.info = _logProxy(\"info\");\n\t\tself.warn = _logProxy(\"warn\");\n\t\tself.error = _logProxy(\"error\");\n\t}\n\t/** Get the singleton instance of the DiagAPI API */\n\tDiagAPI.instance = function() {\n\t\tif (!this._instance) this._instance = new DiagAPI();\n\t\treturn this._instance;\n\t};\n\treturn DiagAPI;\n}();\n/** Get a key to uniquely identify a context value */\nfunction createContextKey(description) {\n\treturn Symbol.for(description);\n}\n/** The root context is used as the default parent context when there is no active context */\nvar ROOT_CONTEXT = new (function() {\n\t/**\n\t* Construct a new context which inherits values from an optional parent context.\n\t*\n\t* @param parentContext a context from which to inherit values\n\t*/\n\tfunction BaseContext(parentContext) {\n\t\tvar self = this;\n\t\tself._currentContext = parentContext ? new Map(parentContext) : /* @__PURE__ */ new Map();\n\t\tself.getValue = function(key) {\n\t\t\treturn self._currentContext.get(key);\n\t\t};\n\t\tself.setValue = function(key, value) {\n\t\t\tvar context = new BaseContext(self._currentContext);\n\t\t\tcontext._currentContext.set(key, value);\n\t\t\treturn context;\n\t\t};\n\t\tself.deleteValue = function(key) {\n\t\t\tvar context = new BaseContext(self._currentContext);\n\t\t\tcontext._currentContext.delete(key);\n\t\t\treturn context;\n\t\t};\n\t}\n\treturn BaseContext;\n}())();\nvar __read$1 = function(o, n) {\n\tvar m = typeof Symbol === \"function\" && o[Symbol.iterator];\n\tif (!m) return o;\n\tvar i = m.call(o), r, ar = [], e;\n\ttry {\n\t\twhile ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\n\t} catch (error) {\n\t\te = { error };\n\t} finally {\n\t\ttry {\n\t\t\tif (r && !r.done && (m = i[\"return\"])) m.call(i);\n\t\t} finally {\n\t\t\tif (e) throw e.error;\n\t\t}\n\t}\n\treturn ar;\n};\nvar __spreadArray$1 = function(to, from, pack) {\n\tif (pack || arguments.length === 2) {\n\t\tfor (var i = 0, l = from.length, ar; i < l; i++) if (ar || !(i in from)) {\n\t\t\tif (!ar) ar = Array.prototype.slice.call(from, 0, i);\n\t\t\tar[i] = from[i];\n\t\t}\n\t}\n\treturn to.concat(ar || Array.prototype.slice.call(from));\n};\nvar NoopContextManager = function() {\n\tfunction NoopContextManager() {}\n\tNoopContextManager.prototype.active = function() {\n\t\treturn ROOT_CONTEXT;\n\t};\n\tNoopContextManager.prototype.with = function(_context, fn, thisArg) {\n\t\tvar args = [];\n\t\tfor (var _i = 3; _i < arguments.length; _i++) args[_i - 3] = arguments[_i];\n\t\treturn fn.call.apply(fn, __spreadArray$1([thisArg], __read$1(args), false));\n\t};\n\tNoopContextManager.prototype.bind = function(_context, target) {\n\t\treturn target;\n\t};\n\tNoopContextManager.prototype.enable = function() {\n\t\treturn this;\n\t};\n\tNoopContextManager.prototype.disable = function() {\n\t\treturn this;\n\t};\n\treturn NoopContextManager;\n}();\nvar __read = function(o, n) {\n\tvar m = typeof Symbol === \"function\" && o[Symbol.iterator];\n\tif (!m) return o;\n\tvar i = m.call(o), r, ar = [], e;\n\ttry {\n\t\twhile ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\n\t} catch (error) {\n\t\te = { error };\n\t} finally {\n\t\ttry {\n\t\t\tif (r && !r.done && (m = i[\"return\"])) m.call(i);\n\t\t} finally {\n\t\t\tif (e) throw e.error;\n\t\t}\n\t}\n\treturn ar;\n};\nvar __spreadArray = function(to, from, pack) {\n\tif (pack || arguments.length === 2) {\n\t\tfor (var i = 0, l = from.length, ar; i < l; i++) if (ar || !(i in from)) {\n\t\t\tif (!ar) ar = Array.prototype.slice.call(from, 0, i);\n\t\t\tar[i] = from[i];\n\t\t}\n\t}\n\treturn to.concat(ar || Array.prototype.slice.call(from));\n};\nvar API_NAME$1 = \"context\";\nvar NOOP_CONTEXT_MANAGER = new NoopContextManager();\n/**\n* Singleton object which represents the entry point to the OpenTelemetry Context API\n*/\nvar ContextAPI = function() {\n\t/** Empty private constructor prevents end users from constructing a new instance of the API */\n\tfunction ContextAPI() {}\n\t/** Get the singleton instance of the Context API */\n\tContextAPI.getInstance = function() {\n\t\tif (!this._instance) this._instance = new ContextAPI();\n\t\treturn this._instance;\n\t};\n\t/**\n\t* Set the current context manager.\n\t*\n\t* @returns true if the context manager was successfully registered, else false\n\t*/\n\tContextAPI.prototype.setGlobalContextManager = function(contextManager) {\n\t\treturn registerGlobal(API_NAME$1, contextManager, DiagAPI.instance());\n\t};\n\t/**\n\t* Get the currently active context\n\t*/\n\tContextAPI.prototype.active = function() {\n\t\treturn this._getContextManager().active();\n\t};\n\t/**\n\t* Execute a function with an active context\n\t*\n\t* @param context context to be active during function execution\n\t* @param fn function to execute in a context\n\t* @param thisArg optional receiver to be used for calling fn\n\t* @param args optional arguments forwarded to fn\n\t*/\n\tContextAPI.prototype.with = function(context, fn, thisArg) {\n\t\tvar _a;\n\t\tvar args = [];\n\t\tfor (var _i = 3; _i < arguments.length; _i++) args[_i - 3] = arguments[_i];\n\t\treturn (_a = this._getContextManager()).with.apply(_a, __spreadArray([\n\t\t\tcontext,\n\t\t\tfn,\n\t\t\tthisArg\n\t\t], __read(args), false));\n\t};\n\t/**\n\t* Bind a context to a target function or event emitter\n\t*\n\t* @param context context to bind to the event emitter or function. Defaults to the currently active context\n\t* @param target function or event emitter to bind\n\t*/\n\tContextAPI.prototype.bind = function(context, target) {\n\t\treturn this._getContextManager().bind(context, target);\n\t};\n\tContextAPI.prototype._getContextManager = function() {\n\t\treturn getGlobal(API_NAME$1) || NOOP_CONTEXT_MANAGER;\n\t};\n\t/** Disable and remove the global context manager */\n\tContextAPI.prototype.disable = function() {\n\t\tthis._getContextManager().disable();\n\t\tunregisterGlobal(API_NAME$1, DiagAPI.instance());\n\t};\n\treturn ContextAPI;\n}();\nvar TraceFlags;\n(function(TraceFlags) {\n\t/** Represents no flag set. */\n\tTraceFlags[TraceFlags[\"NONE\"] = 0] = \"NONE\";\n\t/** Bit to represent whether trace is sampled in trace flags. */\n\tTraceFlags[TraceFlags[\"SAMPLED\"] = 1] = \"SAMPLED\";\n})(TraceFlags || (TraceFlags = {}));\nvar INVALID_SPAN_CONTEXT = {\n\ttraceId: \"00000000000000000000000000000000\",\n\tspanId: \"0000000000000000\",\n\ttraceFlags: TraceFlags.NONE\n};\n/**\n* The NonRecordingSpan is the default {@link Span} that is used when no Span\n* implementation is available. All operations are no-op including context\n* propagation.\n*/\nvar NonRecordingSpan = function() {\n\tfunction NonRecordingSpan(_spanContext) {\n\t\tif (_spanContext === void 0) _spanContext = INVALID_SPAN_CONTEXT;\n\t\tthis._spanContext = _spanContext;\n\t}\n\tNonRecordingSpan.prototype.spanContext = function() {\n\t\treturn this._spanContext;\n\t};\n\tNonRecordingSpan.prototype.setAttribute = function(_key, _value) {\n\t\treturn this;\n\t};\n\tNonRecordingSpan.prototype.setAttributes = function(_attributes) {\n\t\treturn this;\n\t};\n\tNonRecordingSpan.prototype.addEvent = function(_name, _attributes) {\n\t\treturn this;\n\t};\n\tNonRecordingSpan.prototype.addLink = function(_link) {\n\t\treturn this;\n\t};\n\tNonRecordingSpan.prototype.addLinks = function(_links) {\n\t\treturn this;\n\t};\n\tNonRecordingSpan.prototype.setStatus = function(_status) {\n\t\treturn this;\n\t};\n\tNonRecordingSpan.prototype.updateName = function(_name) {\n\t\treturn this;\n\t};\n\tNonRecordingSpan.prototype.end = function(_endTime) {};\n\tNonRecordingSpan.prototype.isRecording = function() {\n\t\treturn false;\n\t};\n\tNonRecordingSpan.prototype.recordException = function(_exception, _time) {};\n\treturn NonRecordingSpan;\n}();\n/**\n* span key\n*/\nvar SPAN_KEY = createContextKey(\"OpenTelemetry Context Key SPAN\");\n/**\n* Return the span if one exists\n*\n* @param context context to get span from\n*/\nfunction getSpan(context) {\n\treturn context.getValue(SPAN_KEY) || void 0;\n}\n/**\n* Gets the span from the current context, if one exists.\n*/\nfunction getActiveSpan() {\n\treturn getSpan(ContextAPI.getInstance().active());\n}\n/**\n* Set the span on a context\n*\n* @param context context to use as parent\n* @param span span to set active\n*/\nfunction setSpan(context, span) {\n\treturn context.setValue(SPAN_KEY, span);\n}\n/**\n* Remove current span stored in the context\n*\n* @param context context to delete span from\n*/\nfunction deleteSpan(context) {\n\treturn context.deleteValue(SPAN_KEY);\n}\n/**\n* Wrap span context in a NoopSpan and set as span in a new\n* context\n*\n* @param context context to set active span on\n* @param spanContext span context to be wrapped\n*/\nfunction setSpanContext(context, spanContext) {\n\treturn setSpan(context, new NonRecordingSpan(spanContext));\n}\n/**\n* Get the span context of the span if it exists.\n*\n* @param context context to get values from\n*/\nfunction getSpanContext(context) {\n\tvar _a;\n\treturn (_a = getSpan(context)) === null || _a === void 0 ? void 0 : _a.spanContext();\n}\nvar VALID_TRACEID_REGEX = /^([0-9a-f]{32})$/i;\nvar VALID_SPANID_REGEX = /^[0-9a-f]{16}$/i;\nfunction isValidTraceId(traceId) {\n\treturn VALID_TRACEID_REGEX.test(traceId) && traceId !== \"00000000000000000000000000000000\";\n}\nfunction isValidSpanId(spanId) {\n\treturn VALID_SPANID_REGEX.test(spanId) && spanId !== \"0000000000000000\";\n}\n/**\n* Returns true if this {@link SpanContext} is valid.\n* @return true if this {@link SpanContext} is valid.\n*/\nfunction isSpanContextValid(spanContext) {\n\treturn isValidTraceId(spanContext.traceId) && isValidSpanId(spanContext.spanId);\n}\n/**\n* Wrap the given {@link SpanContext} in a new non-recording {@link Span}\n*\n* @param spanContext span context to be wrapped\n* @returns a new non-recording {@link Span} with the provided context\n*/\nfunction wrapSpanContext(spanContext) {\n\treturn new NonRecordingSpan(spanContext);\n}\nvar contextApi = ContextAPI.getInstance();\n/**\n* No-op implementations of {@link Tracer}.\n*/\nvar NoopTracer = function() {\n\tfunction NoopTracer() {}\n\tNoopTracer.prototype.startSpan = function(name, options, context) {\n\t\tif (context === void 0) context = contextApi.active();\n\t\tif (Boolean(options === null || options === void 0 ? void 0 : options.root)) return new NonRecordingSpan();\n\t\tvar parentFromContext = context && getSpanContext(context);\n\t\tif (isSpanContext(parentFromContext) && isSpanContextValid(parentFromContext)) return new NonRecordingSpan(parentFromContext);\n\t\telse return new NonRecordingSpan();\n\t};\n\tNoopTracer.prototype.startActiveSpan = function(name, arg2, arg3, arg4) {\n\t\tvar opts;\n\t\tvar ctx;\n\t\tvar fn;\n\t\tif (arguments.length < 2) return;\n\t\telse if (arguments.length === 2) fn = arg2;\n\t\telse if (arguments.length === 3) {\n\t\t\topts = arg2;\n\t\t\tfn = arg3;\n\t\t} else {\n\t\t\topts = arg2;\n\t\t\tctx = arg3;\n\t\t\tfn = arg4;\n\t\t}\n\t\tvar parentContext = ctx !== null && ctx !== void 0 ? ctx : contextApi.active();\n\t\tvar span = this.startSpan(name, opts, parentContext);\n\t\tvar contextWithSpanSet = setSpan(parentContext, span);\n\t\treturn contextApi.with(contextWithSpanSet, fn, void 0, span);\n\t};\n\treturn NoopTracer;\n}();\nfunction isSpanContext(spanContext) {\n\treturn typeof spanContext === \"object\" && typeof spanContext[\"spanId\"] === \"string\" && typeof spanContext[\"traceId\"] === \"string\" && typeof spanContext[\"traceFlags\"] === \"number\";\n}\nvar NOOP_TRACER = new NoopTracer();\n/**\n* Proxy tracer provided by the proxy tracer provider\n*/\nvar ProxyTracer = function() {\n\tfunction ProxyTracer(_provider, name, version, options) {\n\t\tthis._provider = _provider;\n\t\tthis.name = name;\n\t\tthis.version = version;\n\t\tthis.options = options;\n\t}\n\tProxyTracer.prototype.startSpan = function(name, options, context) {\n\t\treturn this._getTracer().startSpan(name, options, context);\n\t};\n\tProxyTracer.prototype.startActiveSpan = function(_name, _options, _context, _fn) {\n\t\tvar tracer = this._getTracer();\n\t\treturn Reflect.apply(tracer.startActiveSpan, tracer, arguments);\n\t};\n\t/**\n\t* Try to get a tracer from the proxy tracer provider.\n\t* If the proxy tracer provider has no delegate, return a noop tracer.\n\t*/\n\tProxyTracer.prototype._getTracer = function() {\n\t\tif (this._delegate) return this._delegate;\n\t\tvar tracer = this._provider.getDelegateTracer(this.name, this.version, this.options);\n\t\tif (!tracer) return NOOP_TRACER;\n\t\tthis._delegate = tracer;\n\t\treturn this._delegate;\n\t};\n\treturn ProxyTracer;\n}();\nvar NOOP_TRACER_PROVIDER = new (function() {\n\tfunction NoopTracerProvider() {}\n\tNoopTracerProvider.prototype.getTracer = function(_name, _version, _options) {\n\t\treturn new NoopTracer();\n\t};\n\treturn NoopTracerProvider;\n}())();\n/**\n* Tracer provider which provides {@link ProxyTracer}s.\n*\n* Before a delegate is set, tracers provided are NoOp.\n* When a delegate is set, traces are provided from the delegate.\n* When a delegate is set after tracers have already been provided,\n* all tracers already provided will use the provided delegate implementation.\n*/\nvar ProxyTracerProvider = function() {\n\tfunction ProxyTracerProvider() {}\n\t/**\n\t* Get a {@link ProxyTracer}\n\t*/\n\tProxyTracerProvider.prototype.getTracer = function(name, version, options) {\n\t\tvar _a;\n\t\treturn (_a = this.getDelegateTracer(name, version, options)) !== null && _a !== void 0 ? _a : new ProxyTracer(this, name, version, options);\n\t};\n\tProxyTracerProvider.prototype.getDelegate = function() {\n\t\tvar _a;\n\t\treturn (_a = this._delegate) !== null && _a !== void 0 ? _a : NOOP_TRACER_PROVIDER;\n\t};\n\t/**\n\t* Set the delegate tracer provider\n\t*/\n\tProxyTracerProvider.prototype.setDelegate = function(delegate) {\n\t\tthis._delegate = delegate;\n\t};\n\tProxyTracerProvider.prototype.getDelegateTracer = function(name, version, options) {\n\t\tvar _a;\n\t\treturn (_a = this._delegate) === null || _a === void 0 ? void 0 : _a.getTracer(name, version, options);\n\t};\n\treturn ProxyTracerProvider;\n}();\n/**\n* An enumeration of status codes.\n*/\nvar SpanStatusCode;\n(function(SpanStatusCode) {\n\t/**\n\t* The default status.\n\t*/\n\tSpanStatusCode[SpanStatusCode[\"UNSET\"] = 0] = \"UNSET\";\n\t/**\n\t* The operation has been validated by an Application developer or\n\t* Operator to have completed successfully.\n\t*/\n\tSpanStatusCode[SpanStatusCode[\"OK\"] = 1] = \"OK\";\n\t/**\n\t* The operation contains an error.\n\t*/\n\tSpanStatusCode[SpanStatusCode[\"ERROR\"] = 2] = \"ERROR\";\n})(SpanStatusCode || (SpanStatusCode = {}));\nvar API_NAME = \"trace\";\n(function() {\n\t/** Empty private constructor prevents end users from constructing a new instance of the API */\n\tfunction TraceAPI() {\n\t\tthis._proxyTracerProvider = new ProxyTracerProvider();\n\t\tthis.wrapSpanContext = wrapSpanContext;\n\t\tthis.isSpanContextValid = isSpanContextValid;\n\t\tthis.deleteSpan = deleteSpan;\n\t\tthis.getSpan = getSpan;\n\t\tthis.getActiveSpan = getActiveSpan;\n\t\tthis.getSpanContext = getSpanContext;\n\t\tthis.setSpan = setSpan;\n\t\tthis.setSpanContext = setSpanContext;\n\t}\n\t/** Get the singleton instance of the Trace API */\n\tTraceAPI.getInstance = function() {\n\t\tif (!this._instance) this._instance = new TraceAPI();\n\t\treturn this._instance;\n\t};\n\t/**\n\t* Set the current global tracer.\n\t*\n\t* @returns true if the tracer provider was successfully registered, else false\n\t*/\n\tTraceAPI.prototype.setGlobalTracerProvider = function(provider) {\n\t\tvar success = registerGlobal(API_NAME, this._proxyTracerProvider, DiagAPI.instance());\n\t\tif (success) this._proxyTracerProvider.setDelegate(provider);\n\t\treturn success;\n\t};\n\t/**\n\t* Returns the global tracer provider.\n\t*/\n\tTraceAPI.prototype.getTracerProvider = function() {\n\t\treturn getGlobal(API_NAME) || this._proxyTracerProvider;\n\t};\n\t/**\n\t* Returns a tracer from the global tracer provider.\n\t*/\n\tTraceAPI.prototype.getTracer = function(name, version) {\n\t\treturn this.getTracerProvider().getTracer(name, version);\n\t};\n\t/** Remove the global tracer provider */\n\tTraceAPI.prototype.disable = function() {\n\t\tunregisterGlobal(API_NAME, DiagAPI.instance());\n\t\tthis._proxyTracerProvider = new ProxyTracerProvider();\n\t};\n\treturn TraceAPI;\n})().getInstance();\nvar __defProp = Object.defineProperty;\nvar __export = (target, all) => {\n\tfor (var name17 in all) __defProp(target, name17, {\n\t\tget: all[name17],\n\t\tenumerable: true\n\t});\n};\nfunction prepareResponseHeaders(headers, { contentType, dataStreamVersion }) {\n\tconst responseHeaders = new Headers(headers != null ? headers : {});\n\tif (!responseHeaders.has(\"Content-Type\")) responseHeaders.set(\"Content-Type\", contentType);\n\tif (dataStreamVersion !== void 0) responseHeaders.set(\"X-Vercel-AI-Data-Stream\", dataStreamVersion);\n\treturn responseHeaders;\n}\nvar name4 = \"AI_NoObjectGeneratedError\";\nvar marker4 = `vercel.ai.error.${name4}`;\nvar symbol4 = Symbol.for(marker4);\nvar _a4;\nvar NoObjectGeneratedError = class extends AISDKError {\n\tconstructor({ message = \"No object generated.\", cause, text: text2, response, usage, finishReason }) {\n\t\tsuper({\n\t\t\tname: name4,\n\t\t\tmessage,\n\t\t\tcause\n\t\t});\n\t\tthis[_a4] = true;\n\t\tthis.text = text2;\n\t\tthis.response = response;\n\t\tthis.usage = usage;\n\t\tthis.finishReason = finishReason;\n\t}\n\tstatic isInstance(error) {\n\t\treturn AISDKError.hasMarker(error, marker4);\n\t}\n};\n_a4 = symbol4;\nvar dataContentSchema = z$1.union([\n\tz$1.string(),\n\tz$1.instanceof(Uint8Array),\n\tz$1.instanceof(ArrayBuffer),\n\tz$1.custom((value) => {\n\t\tvar _a17, _b;\n\t\treturn (_b = (_a17 = globalThis.Buffer) == null ? void 0 : _a17.isBuffer(value)) != null ? _b : false;\n\t}, { message: \"Must be a Buffer\" })\n]);\nvar jsonValueSchema = z$1.lazy(() => z$1.union([\n\tz$1.null(),\n\tz$1.string(),\n\tz$1.number(),\n\tz$1.boolean(),\n\tz$1.record(z$1.string(), jsonValueSchema),\n\tz$1.array(jsonValueSchema)\n]));\nvar providerMetadataSchema = z$1.record(z$1.string(), z$1.record(z$1.string(), jsonValueSchema));\nvar toolResultContentSchema = z$1.array(z$1.union([z$1.object({\n\ttype: z$1.literal(\"text\"),\n\ttext: z$1.string()\n}), z$1.object({\n\ttype: z$1.literal(\"image\"),\n\tdata: z$1.string(),\n\tmimeType: z$1.string().optional()\n})]));\nvar textPartSchema = z$1.object({\n\ttype: z$1.literal(\"text\"),\n\ttext: z$1.string(),\n\tproviderOptions: providerMetadataSchema.optional(),\n\texperimental_providerMetadata: providerMetadataSchema.optional()\n});\nvar imagePartSchema = z$1.object({\n\ttype: z$1.literal(\"image\"),\n\timage: z$1.union([dataContentSchema, z$1.instanceof(URL)]),\n\tmimeType: z$1.string().optional(),\n\tproviderOptions: providerMetadataSchema.optional(),\n\texperimental_providerMetadata: providerMetadataSchema.optional()\n});\nvar filePartSchema = z$1.object({\n\ttype: z$1.literal(\"file\"),\n\tdata: z$1.union([dataContentSchema, z$1.instanceof(URL)]),\n\tfilename: z$1.string().optional(),\n\tmimeType: z$1.string(),\n\tproviderOptions: providerMetadataSchema.optional(),\n\texperimental_providerMetadata: providerMetadataSchema.optional()\n});\nvar reasoningPartSchema = z$1.object({\n\ttype: z$1.literal(\"reasoning\"),\n\ttext: z$1.string(),\n\tproviderOptions: providerMetadataSchema.optional(),\n\texperimental_providerMetadata: providerMetadataSchema.optional()\n});\nvar redactedReasoningPartSchema = z$1.object({\n\ttype: z$1.literal(\"redacted-reasoning\"),\n\tdata: z$1.string(),\n\tproviderOptions: providerMetadataSchema.optional(),\n\texperimental_providerMetadata: providerMetadataSchema.optional()\n});\nvar toolCallPartSchema = z$1.object({\n\ttype: z$1.literal(\"tool-call\"),\n\ttoolCallId: z$1.string(),\n\ttoolName: z$1.string(),\n\targs: z$1.unknown(),\n\tproviderOptions: providerMetadataSchema.optional(),\n\texperimental_providerMetadata: providerMetadataSchema.optional()\n});\nvar toolResultPartSchema = z$1.object({\n\ttype: z$1.literal(\"tool-result\"),\n\ttoolCallId: z$1.string(),\n\ttoolName: z$1.string(),\n\tresult: z$1.unknown(),\n\tcontent: toolResultContentSchema.optional(),\n\tisError: z$1.boolean().optional(),\n\tproviderOptions: providerMetadataSchema.optional(),\n\texperimental_providerMetadata: providerMetadataSchema.optional()\n});\nvar coreSystemMessageSchema = z$1.object({\n\trole: z$1.literal(\"system\"),\n\tcontent: z$1.string(),\n\tproviderOptions: providerMetadataSchema.optional(),\n\texperimental_providerMetadata: providerMetadataSchema.optional()\n});\nvar coreUserMessageSchema = z$1.object({\n\trole: z$1.literal(\"user\"),\n\tcontent: z$1.union([z$1.string(), z$1.array(z$1.union([\n\t\ttextPartSchema,\n\t\timagePartSchema,\n\t\tfilePartSchema\n\t]))]),\n\tproviderOptions: providerMetadataSchema.optional(),\n\texperimental_providerMetadata: providerMetadataSchema.optional()\n});\nvar coreAssistantMessageSchema = z$1.object({\n\trole: z$1.literal(\"assistant\"),\n\tcontent: z$1.union([z$1.string(), z$1.array(z$1.union([\n\t\ttextPartSchema,\n\t\tfilePartSchema,\n\t\treasoningPartSchema,\n\t\tredactedReasoningPartSchema,\n\t\ttoolCallPartSchema\n\t]))]),\n\tproviderOptions: providerMetadataSchema.optional(),\n\texperimental_providerMetadata: providerMetadataSchema.optional()\n});\nvar coreToolMessageSchema = z$1.object({\n\trole: z$1.literal(\"tool\"),\n\tcontent: z$1.array(toolResultPartSchema),\n\tproviderOptions: providerMetadataSchema.optional(),\n\texperimental_providerMetadata: providerMetadataSchema.optional()\n});\nz$1.union([\n\tcoreSystemMessageSchema,\n\tcoreUserMessageSchema,\n\tcoreAssistantMessageSchema,\n\tcoreToolMessageSchema\n]);\nvar DEFAULT_SCHEMA_PREFIX = \"JSON schema:\";\nvar DEFAULT_SCHEMA_SUFFIX = \"You MUST answer with a JSON object that matches the JSON schema above.\";\nvar DEFAULT_GENERIC_SUFFIX = \"You MUST answer with JSON.\";\nfunction injectJsonInstruction({ prompt, schema, schemaPrefix = schema != null ? DEFAULT_SCHEMA_PREFIX : void 0, schemaSuffix = schema != null ? DEFAULT_SCHEMA_SUFFIX : DEFAULT_GENERIC_SUFFIX }) {\n\treturn [\n\t\tprompt != null && prompt.length > 0 ? prompt : void 0,\n\t\tprompt != null && prompt.length > 0 ? \"\" : void 0,\n\t\tschemaPrefix,\n\t\tschema != null ? JSON.stringify(schema) : void 0,\n\t\tschemaSuffix\n\t].filter((line) => line != null).join(\"\\n\");\n}\ncreateIdGenerator({\n\tprefix: \"aiobj\",\n\tsize: 24\n});\ncreateIdGenerator({\n\tprefix: \"aiobj\",\n\tsize: 24\n});\ncreateIdGenerator({\n\tprefix: \"aitxt\",\n\tsize: 24\n});\ncreateIdGenerator({\n\tprefix: \"msg\",\n\tsize: 24\n});\n__export({}, {\n\tobject: () => object,\n\ttext: () => text\n});\nvar text = () => ({\n\ttype: \"text\",\n\tresponseFormat: () => ({ type: \"text\" }),\n\tinjectIntoSystemPrompt({ system }) {\n\t\treturn system;\n\t},\n\tparsePartial({ text: text2 }) {\n\t\treturn { partial: text2 };\n\t},\n\tparseOutput({ text: text2 }) {\n\t\treturn text2;\n\t}\n});\nvar object = ({ schema: inputSchema }) => {\n\tconst schema = asSchema(inputSchema);\n\treturn {\n\t\ttype: \"object\",\n\t\tresponseFormat: ({ model }) => ({\n\t\t\ttype: \"json\",\n\t\t\tschema: model.supportsStructuredOutputs ? schema.jsonSchema : void 0\n\t\t}),\n\t\tinjectIntoSystemPrompt({ system, model }) {\n\t\t\treturn model.supportsStructuredOutputs ? system : injectJsonInstruction({\n\t\t\t\tprompt: system,\n\t\t\t\tschema: schema.jsonSchema\n\t\t\t});\n\t\t},\n\t\tparsePartial({ text: text2 }) {\n\t\t\tconst result = parsePartialJson(text2);\n\t\t\tswitch (result.state) {\n\t\t\t\tcase \"failed-parse\":\n\t\t\t\tcase \"undefined-input\": return;\n\t\t\t\tcase \"repaired-parse\":\n\t\t\t\tcase \"successful-parse\": return { partial: result.value };\n\t\t\t\tdefault: {\n\t\t\t\t\tconst _exhaustiveCheck = result.state;\n\t\t\t\t\tthrow new Error(`Unsupported parse state: ${_exhaustiveCheck}`);\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t\tparseOutput({ text: text2 }, context) {\n\t\t\tconst parseResult = safeParseJSON({ text: text2 });\n\t\t\tif (!parseResult.success) throw new NoObjectGeneratedError({\n\t\t\t\tmessage: \"No object generated: could not parse the response.\",\n\t\t\t\tcause: parseResult.error,\n\t\t\t\ttext: text2,\n\t\t\t\tresponse: context.response,\n\t\t\t\tusage: context.usage,\n\t\t\t\tfinishReason: context.finishReason\n\t\t\t});\n\t\t\tconst validationResult = safeValidateTypes({\n\t\t\t\tvalue: parseResult.value,\n\t\t\t\tschema\n\t\t\t});\n\t\t\tif (!validationResult.success) throw new NoObjectGeneratedError({\n\t\t\t\tmessage: \"No object generated: response did not match schema.\",\n\t\t\t\tcause: validationResult.error,\n\t\t\t\ttext: text2,\n\t\t\t\tresponse: context.response,\n\t\t\t\tusage: context.usage,\n\t\t\t\tfinishReason: context.finishReason\n\t\t\t});\n\t\t\treturn validationResult.value;\n\t\t}\n\t};\n};\nfunction mergeStreams(stream1, stream2) {\n\tconst reader1 = stream1.getReader();\n\tconst reader2 = stream2.getReader();\n\tlet lastRead1 = void 0;\n\tlet lastRead2 = void 0;\n\tlet stream1Done = false;\n\tlet stream2Done = false;\n\tasync function readStream1(controller) {\n\t\ttry {\n\t\t\tif (lastRead1 == null) lastRead1 = reader1.read();\n\t\t\tconst result = await lastRead1;\n\t\t\tlastRead1 = void 0;\n\t\t\tif (!result.done) controller.enqueue(result.value);\n\t\t\telse controller.close();\n\t\t} catch (error) {\n\t\t\tcontroller.error(error);\n\t\t}\n\t}\n\tasync function readStream2(controller) {\n\t\ttry {\n\t\t\tif (lastRead2 == null) lastRead2 = reader2.read();\n\t\t\tconst result = await lastRead2;\n\t\t\tlastRead2 = void 0;\n\t\t\tif (!result.done) controller.enqueue(result.value);\n\t\t\telse controller.close();\n\t\t} catch (error) {\n\t\t\tcontroller.error(error);\n\t\t}\n\t}\n\treturn new ReadableStream({\n\t\tasync pull(controller) {\n\t\t\ttry {\n\t\t\t\tif (stream1Done) {\n\t\t\t\t\tawait readStream2(controller);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tif (stream2Done) {\n\t\t\t\t\tawait readStream1(controller);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tif (lastRead1 == null) lastRead1 = reader1.read();\n\t\t\t\tif (lastRead2 == null) lastRead2 = reader2.read();\n\t\t\t\tconst { result, reader } = await Promise.race([lastRead1.then((result2) => ({\n\t\t\t\t\tresult: result2,\n\t\t\t\t\treader: reader1\n\t\t\t\t})), lastRead2.then((result2) => ({\n\t\t\t\t\tresult: result2,\n\t\t\t\t\treader: reader2\n\t\t\t\t}))]);\n\t\t\t\tif (!result.done) controller.enqueue(result.value);\n\t\t\t\tif (reader === reader1) {\n\t\t\t\t\tlastRead1 = void 0;\n\t\t\t\t\tif (result.done) {\n\t\t\t\t\t\tawait readStream2(controller);\n\t\t\t\t\t\tstream1Done = true;\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tlastRead2 = void 0;\n\t\t\t\t\tif (result.done) {\n\t\t\t\t\t\tstream2Done = true;\n\t\t\t\t\t\tawait readStream1(controller);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} catch (error) {\n\t\t\t\tcontroller.error(error);\n\t\t\t}\n\t\t},\n\t\tcancel() {\n\t\t\treader1.cancel();\n\t\t\treader2.cancel();\n\t\t}\n\t});\n}\ncreateIdGenerator({\n\tprefix: \"aitxt\",\n\tsize: 24\n});\ncreateIdGenerator({\n\tprefix: \"msg\",\n\tsize: 24\n});\nvar ClientOrServerImplementationSchema = z$1.object({\n\tname: z$1.string(),\n\tversion: z$1.string()\n}).passthrough();\nvar BaseParamsSchema = z$1.object({ _meta: z$1.optional(z$1.object({}).passthrough()) }).passthrough();\nvar ResultSchema = BaseParamsSchema;\nvar RequestSchema = z$1.object({\n\tmethod: z$1.string(),\n\tparams: z$1.optional(BaseParamsSchema)\n});\nvar ServerCapabilitiesSchema = z$1.object({\n\texperimental: z$1.optional(z$1.object({}).passthrough()),\n\tlogging: z$1.optional(z$1.object({}).passthrough()),\n\tprompts: z$1.optional(z$1.object({ listChanged: z$1.optional(z$1.boolean()) }).passthrough()),\n\tresources: z$1.optional(z$1.object({\n\t\tsubscribe: z$1.optional(z$1.boolean()),\n\t\tlistChanged: z$1.optional(z$1.boolean())\n\t}).passthrough()),\n\ttools: z$1.optional(z$1.object({ listChanged: z$1.optional(z$1.boolean()) }).passthrough())\n}).passthrough();\nResultSchema.extend({\n\tprotocolVersion: z$1.string(),\n\tcapabilities: ServerCapabilitiesSchema,\n\tserverInfo: ClientOrServerImplementationSchema,\n\tinstructions: z$1.optional(z$1.string())\n});\nvar PaginatedResultSchema = ResultSchema.extend({ nextCursor: z$1.optional(z$1.string()) });\nvar ToolSchema = z$1.object({\n\tname: z$1.string(),\n\tdescription: z$1.optional(z$1.string()),\n\tinputSchema: z$1.object({\n\t\ttype: z$1.literal(\"object\"),\n\t\tproperties: z$1.optional(z$1.object({}).passthrough())\n\t}).passthrough()\n}).passthrough();\nPaginatedResultSchema.extend({ tools: z$1.array(ToolSchema) });\nvar TextContentSchema = z$1.object({\n\ttype: z$1.literal(\"text\"),\n\ttext: z$1.string()\n}).passthrough();\nvar ImageContentSchema = z$1.object({\n\ttype: z$1.literal(\"image\"),\n\tdata: z$1.string().base64(),\n\tmimeType: z$1.string()\n}).passthrough();\nvar ResourceContentsSchema = z$1.object({\n\t/**\n\t* The URI of this resource.\n\t*/\n\turi: z$1.string(),\n\t/**\n\t* The MIME type of this resource, if known.\n\t*/\n\tmimeType: z$1.optional(z$1.string())\n}).passthrough();\nvar TextResourceContentsSchema = ResourceContentsSchema.extend({ text: z$1.string() });\nvar BlobResourceContentsSchema = ResourceContentsSchema.extend({ blob: z$1.string().base64() });\nvar EmbeddedResourceSchema = z$1.object({\n\ttype: z$1.literal(\"resource\"),\n\tresource: z$1.union([TextResourceContentsSchema, BlobResourceContentsSchema])\n}).passthrough();\nResultSchema.extend({\n\tcontent: z$1.array(z$1.union([\n\t\tTextContentSchema,\n\t\tImageContentSchema,\n\t\tEmbeddedResourceSchema\n\t])),\n\tisError: z$1.boolean().default(false).optional()\n}).or(ResultSchema.extend({ toolResult: z$1.unknown() }));\nvar JSONRPC_VERSION = \"2.0\";\nvar JSONRPCRequestSchema = z$1.object({\n\tjsonrpc: z$1.literal(JSONRPC_VERSION),\n\tid: z$1.union([z$1.string(), z$1.number().int()])\n}).merge(RequestSchema).strict();\nvar JSONRPCResponseSchema = z$1.object({\n\tjsonrpc: z$1.literal(JSONRPC_VERSION),\n\tid: z$1.union([z$1.string(), z$1.number().int()]),\n\tresult: ResultSchema\n}).strict();\nvar JSONRPCErrorSchema = z$1.object({\n\tjsonrpc: z$1.literal(JSONRPC_VERSION),\n\tid: z$1.union([z$1.string(), z$1.number().int()]),\n\terror: z$1.object({\n\t\tcode: z$1.number().int(),\n\t\tmessage: z$1.string(),\n\t\tdata: z$1.optional(z$1.unknown())\n\t})\n}).strict();\nvar JSONRPCNotificationSchema = z$1.object({ jsonrpc: z$1.literal(JSONRPC_VERSION) }).merge(z$1.object({\n\tmethod: z$1.string(),\n\tparams: z$1.optional(BaseParamsSchema)\n})).strict();\nz$1.union([\n\tJSONRPCRequestSchema,\n\tJSONRPCNotificationSchema,\n\tJSONRPCResponseSchema,\n\tJSONRPCErrorSchema\n]);\n__export({}, {\n\tmergeIntoDataStream: () => mergeIntoDataStream,\n\ttoDataStream: () => toDataStream,\n\ttoDataStreamResponse: () => toDataStreamResponse\n});\nfunction createCallbacksTransformer(callbacks = {}) {\n\tconst textEncoder = new TextEncoder();\n\tlet aggregatedResponse = \"\";\n\treturn new TransformStream({\n\t\tasync start() {\n\t\t\tif (callbacks.onStart) await callbacks.onStart();\n\t\t},\n\t\tasync transform(message, controller) {\n\t\t\tcontroller.enqueue(textEncoder.encode(message));\n\t\t\taggregatedResponse += message;\n\t\t\tif (callbacks.onToken) await callbacks.onToken(message);\n\t\t\tif (callbacks.onText && typeof message === \"string\") await callbacks.onText(message);\n\t\t},\n\t\tasync flush() {\n\t\t\tif (callbacks.onCompletion) await callbacks.onCompletion(aggregatedResponse);\n\t\t\tif (callbacks.onFinal) await callbacks.onFinal(aggregatedResponse);\n\t\t}\n\t});\n}\nfunction toDataStreamInternal(stream, callbacks) {\n\treturn stream.pipeThrough(new TransformStream({ transform: async (value, controller) => {\n\t\tvar _a17;\n\t\tif (typeof value === \"string\") {\n\t\t\tcontroller.enqueue(value);\n\t\t\treturn;\n\t\t}\n\t\tif (\"event\" in value) {\n\t\t\tif (value.event === \"on_chat_model_stream\") forwardAIMessageChunk((_a17 = value.data) == null ? void 0 : _a17.chunk, controller);\n\t\t\treturn;\n\t\t}\n\t\tforwardAIMessageChunk(value, controller);\n\t} })).pipeThrough(createCallbacksTransformer(callbacks)).pipeThrough(new TextDecoderStream()).pipeThrough(new TransformStream({ transform: async (chunk, controller) => {\n\t\tcontroller.enqueue(formatDataStreamPart(\"text\", chunk));\n\t} }));\n}\nfunction toDataStream(stream, callbacks) {\n\treturn toDataStreamInternal(stream, callbacks).pipeThrough(new TextEncoderStream());\n}\nfunction toDataStreamResponse(stream, options) {\n\tvar _a17;\n\tconst dataStream = toDataStreamInternal(stream, options == null ? void 0 : options.callbacks).pipeThrough(new TextEncoderStream());\n\tconst data = options == null ? void 0 : options.data;\n\tconst init = options == null ? void 0 : options.init;\n\tconst responseStream = data ? mergeStreams(data.stream, dataStream) : dataStream;\n\treturn new Response(responseStream, {\n\t\tstatus: (_a17 = init == null ? void 0 : init.status) != null ? _a17 : 200,\n\t\tstatusText: init == null ? void 0 : init.statusText,\n\t\theaders: prepareResponseHeaders(init == null ? void 0 : init.headers, {\n\t\t\tcontentType: \"text/plain; charset=utf-8\",\n\t\t\tdataStreamVersion: \"v1\"\n\t\t})\n\t});\n}\nfunction mergeIntoDataStream(stream, options) {\n\toptions.dataStream.merge(toDataStreamInternal(stream, options.callbacks));\n}\nfunction forwardAIMessageChunk(chunk, controller) {\n\tif (typeof chunk.content === \"string\") controller.enqueue(chunk.content);\n\telse {\n\t\tconst content = chunk.content;\n\t\tfor (const item of content) if (item.type === \"text\") controller.enqueue(item.text);\n\t}\n}\n__export({}, {\n\tmergeIntoDataStream: () => mergeIntoDataStream2,\n\ttoDataStream: () => toDataStream2,\n\ttoDataStreamResponse: () => toDataStreamResponse2\n});\nfunction toDataStreamInternal2(stream, callbacks) {\n\tconst trimStart = trimStartOfStream();\n\treturn convertAsyncIteratorToReadableStream(stream[Symbol.asyncIterator]()).pipeThrough(new TransformStream({ async transform(message, controller) {\n\t\tcontroller.enqueue(trimStart(message.delta));\n\t} })).pipeThrough(createCallbacksTransformer(callbacks)).pipeThrough(new TextDecoderStream()).pipeThrough(new TransformStream({ transform: async (chunk, controller) => {\n\t\tcontroller.enqueue(formatDataStreamPart(\"text\", chunk));\n\t} }));\n}\nfunction toDataStream2(stream, callbacks) {\n\treturn toDataStreamInternal2(stream, callbacks).pipeThrough(new TextEncoderStream());\n}\nfunction toDataStreamResponse2(stream, options = {}) {\n\tvar _a17;\n\tconst { init, data, callbacks } = options;\n\tconst dataStream = toDataStreamInternal2(stream, callbacks).pipeThrough(new TextEncoderStream());\n\tconst responseStream = data ? mergeStreams(data.stream, dataStream) : dataStream;\n\treturn new Response(responseStream, {\n\t\tstatus: (_a17 = init == null ? void 0 : init.status) != null ? _a17 : 200,\n\t\tstatusText: init == null ? void 0 : init.statusText,\n\t\theaders: prepareResponseHeaders(init == null ? void 0 : init.headers, {\n\t\t\tcontentType: \"text/plain; charset=utf-8\",\n\t\t\tdataStreamVersion: \"v1\"\n\t\t})\n\t});\n}\nfunction mergeIntoDataStream2(stream, options) {\n\toptions.dataStream.merge(toDataStreamInternal2(stream, options.callbacks));\n}\nfunction trimStartOfStream() {\n\tlet isStreamStart = true;\n\treturn (text2) => {\n\t\tif (isStreamStart) {\n\t\t\ttext2 = text2.trimStart();\n\t\t\tif (text2) isStreamStart = false;\n\t\t}\n\t\treturn text2;\n\t};\n}\n//#endregion\n//#region src/utils.ts\n/**\n* Converts a Zod schema to an AI SDK Schema with validation support.\n*\n* This function mirrors the behavior of Vercel's AI SDK zod-schema utility but allows\n* customization of the JSON Schema target format.\n*\n* @param zodSchema - The Zod schema to convert\n* @param target - The JSON Schema target format (defaults to 'jsonSchema7')\n* @returns An AI SDK Schema object with built-in validation\n*\n* @example\n* ```typescript\n* import { z } from 'zod';\n* import { convertZodSchemaToAISDKSchema } from '@mastra/schema-compat';\n*\n* const userSchema = z.object({\n* name: z.string(),\n* age: z.number().min(0)\n* });\n*\n* const aiSchema = convertZodSchemaToAISDKSchema(userSchema);\n* ```\n*/\nfunction convertZodSchemaToAISDKSchema(zodSchema, target = \"jsonSchema7\") {\n\treturn jsonSchema(zodToJsonSchema$1(zodSchema, target), { validate: (value) => {\n\t\tconst result = zodSchema.safeParse(value);\n\t\treturn result.success ? {\n\t\t\tsuccess: true,\n\t\t\tvalue: result.data\n\t\t} : {\n\t\t\tsuccess: false,\n\t\t\terror: result.error\n\t\t};\n\t} });\n}\n/**\n* Checks if a value is a Zod type by examining its properties and methods.\n*\n* @param value - The value to check\n* @returns True if the value is a Zod type, false otherwise\n* @internal\n*/\nfunction isZodType(value) {\n\treturn typeof value === \"object\" && value !== null && (\"_def\" in value || \"_zod\" in value) && \"parse\" in value && typeof value.parse === \"function\" && \"safeParse\" in value && typeof value.safeParse === \"function\";\n}\n/**\n* Converts an AI SDK Schema or Zod schema to a Zod schema.\n*\n* If the input is already a Zod schema, it returns it unchanged.\n* If the input is an AI SDK Schema, it extracts the JSON schema and converts it to Zod.\n*\n* @param schema - The schema to convert (AI SDK Schema or Zod schema)\n* @returns A Zod schema equivalent of the input\n* @throws Error if the conversion fails\n*\n* @example\n* ```typescript\n* import { jsonSchema } from 'ai';\n* import { convertSchemaToZod } from '@mastra/schema-compat';\n*\n* const aiSchema = jsonSchema({\n* type: 'object',\n* properties: {\n* name: { type: 'string' }\n* }\n* });\n*\n* const zodSchema = convertSchemaToZod(aiSchema);\n* ```\n*/\nfunction convertSchemaToZod(schema) {\n\tif (isZodType(schema)) return schema;\n\telse {\n\t\tconst jsonSchemaToConvert = \"jsonSchema\" in schema ? schema.jsonSchema : schema;\n\t\ttry {\n\t\t\tif (\"toJSONSchema\" in z$1) return convertJsonSchemaToZod(jsonSchemaToConvert);\n\t\t\telse return convertJsonSchemaToZod$1(jsonSchemaToConvert);\n\t\t} catch (e) {\n\t\t\tconst errorMessage = `[Schema Builder] Failed to convert schema parameters to Zod. Original schema: ${JSON.stringify(jsonSchemaToConvert)}`;\n\t\t\tconsole.error(errorMessage, e);\n\t\t\tthrow new Error(errorMessage + (e instanceof Error ? `\\n${e.stack}` : \"\\nUnknown error object\"));\n\t\t}\n\t}\n}\n/**\n* Processes a schema using provider compatibility layers and converts it to the specified format.\n*\n* This function automatically applies the first matching compatibility layer from the provided\n* list based on the model configuration. If no compatibility applies, it falls back to\n* standard conversion.\n*\n* @param options - Configuration object for schema processing\n* @param options.schema - The schema to process (AI SDK Schema or Zod object schema)\n* @param options.compatLayers - Array of compatibility layers to try\n* @param options.mode - Output format: 'jsonSchema' for JSONSchema7 or 'aiSdkSchema' for AI SDK Schema\n* @returns Processed schema in the requested format\n*\n* @example\n* ```typescript\n* import { z } from 'zod';\n* import { applyCompatLayer, OpenAISchemaCompatLayer, AnthropicSchemaCompatLayer } from '@mastra/schema-compat';\n*\n* const schema = z.object({\n* query: z.string().email(),\n* limit: z.number().min(1).max(100)\n* });\n*\n* const compatLayers = [\n* new OpenAISchemaCompatLayer(model),\n* new AnthropicSchemaCompatLayer(model)\n* ];\n*\n* const result = applyCompatLayer({\n* schema,\n* compatLayers,\n* mode: 'aiSdkSchema'\n* });\n* ```\n*/\nfunction applyCompatLayer({ schema, compatLayers, mode }) {\n\tif (mode === \"jsonSchema\") {\n\t\tconst standardSchema = toStandardSchema(schema);\n\t\tfor (const compat of compatLayers) if (compat.shouldApply()) return standardSchemaToJSONSchema(compat.processToCompatSchema(standardSchema));\n\t\treturn standardSchemaToJSONSchema(standardSchema);\n\t} else {\n\t\tlet zodSchema;\n\t\tif (isZodType(schema)) zodSchema = schema;\n\t\telse {\n\t\t\tif (isStandardSchemaWithJSON(schema)) throw new Error(\"StandardSchemaWithJSON is not supported for applyCompatLayer and aiSdkSchema mode\");\n\t\t\tzodSchema = convertSchemaToZod(schema);\n\t\t}\n\t\tfor (const compat of compatLayers) if (compat.shouldApply()) return compat.processToAISDKSchema(zodSchema);\n\t\treturn convertZodSchemaToAISDKSchema(zodSchema);\n\t}\n}\n//#endregion\n//#region src/schema-compatibility-v3.ts\n/**\n* All supported string validation check types that can be processed or converted to descriptions.\n* @constant\n*/\nconst ALL_STRING_CHECKS = [\n\t\"regex\",\n\t\"emoji\",\n\t\"email\",\n\t\"url\",\n\t\"uuid\",\n\t\"cuid\",\n\t\"min\",\n\t\"max\"\n];\n/**\n* All supported number validation check types that can be processed or converted to descriptions.\n* @constant\n*/\nconst ALL_NUMBER_CHECKS = [\n\t\"min\",\n\t\"max\",\n\t\"multipleOf\"\n];\n/**\n* All supported array validation check types that can be processed or converted to descriptions.\n* @constant\n*/\nconst ALL_ARRAY_CHECKS = [\n\t\"min\",\n\t\"max\",\n\t\"length\"\n];\nconst isOptional = (v) => v instanceof ZodOptional;\nconst isObj = (v) => v instanceof ZodObject;\nconst isArr = (v) => v instanceof ZodArray;\nconst isUnion = (v) => v instanceof ZodUnion;\nconst isString = (v) => v instanceof ZodString;\nconst isNumber = (v) => v instanceof ZodNumber;\n/**\n* Zod types that are not supported by most AI model providers and should be avoided.\n* @constant\n*/\nconst UNSUPPORTED_ZOD_TYPES = [\n\t\"ZodIntersection\",\n\t\"ZodNever\",\n\t\"ZodNull\",\n\t\"ZodTuple\",\n\t\"ZodUndefined\"\n];\n/**\n* Zod types that are generally supported by AI model providers.\n* @constant\n*/\nconst SUPPORTED_ZOD_TYPES = [\n\t\"ZodObject\",\n\t\"ZodArray\",\n\t\"ZodUnion\",\n\t\"ZodString\",\n\t\"ZodNumber\",\n\t\"ZodDate\",\n\t\"ZodAny\",\n\t\"ZodDefault\",\n\t\"ZodNullable\"\n];\n/**\n* All Zod types (both supported and unsupported).\n* @constant\n*/\nconst ALL_ZOD_TYPES = [...SUPPORTED_ZOD_TYPES, ...UNSUPPORTED_ZOD_TYPES];\n/**\n* Abstract base class for creating schema compatibility layers for different AI model providers.\n*\n* This class provides a framework for transforming Zod schemas to work with specific AI model\n* provider requirements and limitations. Each provider may have different support levels for\n* JSON Schema features, validation constraints, and data types.\n*\n*\n* @example\n* ```typescript\n* import { SchemaCompatLayer } from '@mastra/schema-compat';\n* import type { LanguageModelV1 } from 'ai';\n*\n* class CustomProviderCompat extends SchemaCompatLayer {\n* constructor(model: ModelInformation) {\n* super(model);\n* }\n*\n* shouldApply(): boolean {\n* return this.getModel().provider === 'custom-provider';\n* }\n*\n* getSchemaTarget() {\n* return 'jsonSchema7';\n* }\n*\n* processZodType<T extends z.AnyZodObject>(value: z.ZodTypeAny): ShapeValue<T> {\n* // Custom processing logic for this provider\n* switch (value._def.typeName) {\n* case 'ZodString':\n* return this.defaultZodStringHandler(value, ['email', 'url']);\n* default:\n* return this.defaultUnsupportedZodTypeHandler(value);\n* }\n* }\n* }\n* ```\n*/\nvar SchemaCompatLayer$1 = class {\n\tmodel;\n\tparent;\n\t/**\n\t* Creates a new schema compatibility instance.\n\t*\n\t* @param model - The language model this compatibility layer applies to\n\t*/\n\tconstructor(model, parent) {\n\t\tthis.model = model;\n\t\tthis.parent = parent;\n\t}\n\t/**\n\t* Gets the language model associated with this compatibility layer.\n\t*\n\t* @returns The language model instance\n\t*/\n\tgetModel() {\n\t\treturn this.model;\n\t}\n\tgetUnsupportedZodTypes() {\n\t\treturn UNSUPPORTED_ZOD_TYPES;\n\t}\n\t/**\n\t* Type guard for optional Zod types\n\t*/\n\tisOptional(v) {\n\t\treturn v instanceof ZodOptional;\n\t}\n\t/**\n\t* Type guard for object Zod types\n\t*/\n\tisObj(v) {\n\t\treturn v instanceof ZodObject;\n\t}\n\t/**\n\t* Type guard for null Zod types\n\t*/\n\tisNull(v) {\n\t\treturn v instanceof ZodNull;\n\t}\n\t/**\n\t* Type guard for nullable Zod types\n\t*/\n\tisNullable(v) {\n\t\treturn v instanceof ZodNullable;\n\t}\n\t/**\n\t* Type guard for array Zod types\n\t*/\n\tisArr(v) {\n\t\treturn v instanceof ZodArray;\n\t}\n\t/**\n\t* Type guard for union Zod types\n\t*/\n\tisUnion(v) {\n\t\treturn v instanceof ZodUnion;\n\t}\n\t/**\n\t* Type guard for string Zod types\n\t*/\n\tisString(v) {\n\t\treturn v instanceof ZodString;\n\t}\n\t/**\n\t* Type guard for number Zod types\n\t*/\n\tisNumber(v) {\n\t\treturn v instanceof ZodNumber;\n\t}\n\t/**\n\t* Type guard for date Zod types\n\t*/\n\tisDate(v) {\n\t\treturn v instanceof ZodDate;\n\t}\n\t/**\n\t* Type guard for default Zod types\n\t*/\n\tisDefault(v) {\n\t\treturn v instanceof ZodDefault;\n\t}\n\t/**\n\t* Type guard for intersection Zod types\n\t*/\n\tisIntersection(v) {\n\t\treturn v instanceof ZodIntersection;\n\t}\n\t/**\n\t* Determines whether this compatibility layer should be applied for the current model.\n\t*\n\t* @returns True if this compatibility layer should be used, false otherwise\n\t* @abstract\n\t*/\n\tshouldApply() {\n\t\treturn this.parent.shouldApply();\n\t}\n\t/**\n\t* Returns the JSON Schema target format for this provider.\n\t*\n\t* @returns The schema target format, or undefined to use the default 'jsonSchema7'\n\t* @abstract\n\t*/\n\tgetSchemaTarget() {\n\t\treturn this.parent.getSchemaTarget();\n\t}\n\t/**\n\t* Processes a specific Zod type according to the provider's requirements.\n\t*\n\t* @param value - The Zod type to process\n\t* @returns The processed Zod type\n\t* @abstract\n\t*/\n\tprocessZodType(value) {\n\t\treturn this.parent.processZodType(value);\n\t}\n\t/**\n\t* Default handler for Zod object types. Recursively processes all properties in the object.\n\t*\n\t* @param value - The Zod object to process\n\t* @returns The processed Zod object\n\t*/\n\tdefaultZodObjectHandler(value, options = { passthrough: true }) {\n\t\tconst processedShape = Object.entries(value.shape).reduce((acc, [key, propValue]) => {\n\t\t\tacc[key] = this.processZodType(propValue);\n\t\t\treturn acc;\n\t\t}, {});\n\t\tlet result = z.object(processedShape);\n\t\tif (value._def.unknownKeys === \"strict\") result = result.strict();\n\t\tif (value._def.catchall && !(value._def.catchall instanceof z.ZodNever)) result = result.catchall(value._def.catchall);\n\t\tif (value.description) result = result.describe(value.description);\n\t\tif (options.passthrough && value._def.unknownKeys === \"passthrough\") result = result.passthrough();\n\t\treturn result;\n\t}\n\t/**\n\t* Merges validation constraints into a parameter description.\n\t*\n\t* This helper method converts validation constraints that may not be supported\n\t* by a provider into human-readable descriptions.\n\t*\n\t* @param description - The existing parameter description\n\t* @param constraints - The validation constraints to merge\n\t* @returns The updated description with constraints, or undefined if no constraints\n\t*/\n\tmergeParameterDescription(description, constraints) {\n\t\tif (constraints.length > 0) return (description ? description + \"\\n\" : \"\") + `constraints: ${constraints.join(`, `)}`;\n\t\telse return description;\n\t}\n\t/**\n\t* Default handler for unsupported Zod types. Throws an error for specified unsupported types.\n\t*\n\t* @param value - The Zod type to check\n\t* @param throwOnTypes - Array of type names to throw errors for\n\t* @returns The original value if not in the throw list\n\t* @throws Error if the type is in the unsupported list\n\t*/\n\tdefaultUnsupportedZodTypeHandler(value, throwOnTypes = UNSUPPORTED_ZOD_TYPES) {\n\t\tif (throwOnTypes.includes(value._def?.typeName)) throw new Error(`${this.model.modelId} does not support zod type: ${value._def?.typeName}`);\n\t\treturn value;\n\t}\n\t/**\n\t* Default handler for Zod array types. Processes array constraints according to provider support.\n\t*\n\t* @param value - The Zod array to process\n\t* @param handleChecks - Array constraints to convert to descriptions vs keep as validation\n\t* @returns The processed Zod array\n\t*/\n\tdefaultZodArrayHandler(value, handleChecks = ALL_ARRAY_CHECKS) {\n\t\tconst zodArrayDef = value._def;\n\t\tconst processedType = this.processZodType(zodArrayDef.type);\n\t\tlet result = z.array(processedType);\n\t\tconst constraints = [];\n\t\tif (zodArrayDef.minLength?.value !== void 0) if (handleChecks.includes(\"min\")) constraints.push(`minimum length ${zodArrayDef.minLength.value}`);\n\t\telse result = result.min(zodArrayDef.minLength.value);\n\t\tif (zodArrayDef.maxLength?.value !== void 0) if (handleChecks.includes(\"max\")) constraints.push(`maximum length ${zodArrayDef.maxLength.value}`);\n\t\telse result = result.max(zodArrayDef.maxLength.value);\n\t\tif (zodArrayDef.exactLength?.value !== void 0) if (handleChecks.includes(\"length\")) constraints.push(`exact length ${zodArrayDef.exactLength.value}`);\n\t\telse result = result.length(zodArrayDef.exactLength.value);\n\t\tconst description = this.mergeParameterDescription(value.description, constraints);\n\t\tif (description) result = result.describe(description);\n\t\treturn result;\n\t}\n\t/**\n\t* Default handler for Zod union types. Processes all union options.\n\t*\n\t* @param value - The Zod union to process\n\t* @returns The processed Zod union\n\t* @throws Error if union has fewer than 2 options\n\t*/\n\tdefaultZodUnionHandler(value) {\n\t\tconst processedOptions = value._def.options.map((option) => this.processZodType(option));\n\t\tif (processedOptions.length < 2) throw new Error(\"Union must have at least 2 options\");\n\t\tlet result = z.union(processedOptions);\n\t\tif (value.description) result = result.describe(value.description);\n\t\treturn result;\n\t}\n\t/**\n\t* Default handler for Zod string types. Processes string validation constraints.\n\t*\n\t* @param value - The Zod string to process\n\t* @param handleChecks - String constraints to convert to descriptions vs keep as validation\n\t* @returns The processed Zod string\n\t*/\n\tdefaultZodStringHandler(value, handleChecks = ALL_STRING_CHECKS) {\n\t\tconst constraints = [];\n\t\tconst checks = value._def.checks || [];\n\t\tconst newChecks = [];\n\t\tfor (const check of checks) if (\"kind\" in check) if (handleChecks.includes(check.kind)) switch (check.kind) {\n\t\t\tcase \"regex\":\n\t\t\t\tconstraints.push(`input must match this regex ${check.regex.source}`);\n\t\t\t\tbreak;\n\t\t\tcase \"emoji\":\n\t\t\tcase \"email\":\n\t\t\tcase \"url\":\n\t\t\tcase \"uuid\":\n\t\t\tcase \"cuid\":\n\t\t\t\tconstraints.push(`a valid ${check.kind}`);\n\t\t\t\tbreak;\n\t\t\tcase \"min\":\n\t\t\tcase \"max\":\n\t\t\t\tconstraints.push(`${check.kind}imum length ${check.value}`);\n\t\t\t\tbreak;\n\t\t}\n\t\telse newChecks.push(check);\n\t\tlet result = z.string();\n\t\tfor (const check of newChecks) result = result._addCheck(check);\n\t\tconst description = this.mergeParameterDescription(value.description, constraints);\n\t\tif (description) result = result.describe(description);\n\t\treturn result;\n\t}\n\t/**\n\t* Default handler for Zod number types. Processes number validation constraints.\n\t*\n\t* @param value - The Zod number to process\n\t* @param handleChecks - Number constraints to convert to descriptions vs keep as validation\n\t* @returns The processed Zod number\n\t*/\n\tdefaultZodNumberHandler(value, handleChecks = ALL_NUMBER_CHECKS) {\n\t\tconst constraints = [];\n\t\tconst checks = value._def.checks || [];\n\t\tconst newChecks = [];\n\t\tfor (const check of checks) if (\"kind\" in check) if (handleChecks.includes(check.kind)) switch (check.kind) {\n\t\t\tcase \"min\":\n\t\t\t\tif (check.inclusive) constraints.push(`greater than or equal to ${check.value}`);\n\t\t\t\telse constraints.push(`greater than ${check.value}`);\n\t\t\t\tbreak;\n\t\t\tcase \"max\":\n\t\t\t\tif (check.inclusive) constraints.push(`lower than or equal to ${check.value}`);\n\t\t\t\telse constraints.push(`lower than ${check.value}`);\n\t\t\t\tbreak;\n\t\t\tcase \"multipleOf\":\n\t\t\t\tconstraints.push(`multiple of ${check.value}`);\n\t\t\t\tbreak;\n\t\t}\n\t\telse newChecks.push(check);\n\t\tlet result = z.number();\n\t\tfor (const check of newChecks) switch (check.kind) {\n\t\t\tcase \"int\":\n\t\t\t\tresult = result.int();\n\t\t\t\tbreak;\n\t\t\tcase \"finite\":\n\t\t\t\tresult = result.finite();\n\t\t\t\tbreak;\n\t\t\tdefault: result = result._addCheck(check);\n\t\t}\n\t\tconst description = this.mergeParameterDescription(value.description, constraints);\n\t\tif (description) result = result.describe(description);\n\t\treturn result;\n\t}\n\t/**\n\t* Default handler for Zod date types. Converts dates to ISO strings with constraint descriptions.\n\t*\n\t* @param value - The Zod date to process\n\t* @returns A Zod string schema representing the date in ISO format\n\t*/\n\tdefaultZodDateHandler(value) {\n\t\tconst constraints = [];\n\t\tconst checks = value._def.checks || [];\n\t\tconst newChecks = [];\n\t\tfor (const check of checks) if (\"kind\" in check) switch (check.kind) {\n\t\t\tcase \"min\":\n\t\t\t\tconst minDate = new Date(check.value);\n\t\t\t\tif (!isNaN(minDate.getTime())) constraints.push(`Date must be newer than ${minDate.toISOString()} (ISO)`);\n\t\t\t\tbreak;\n\t\t\tcase \"max\":\n\t\t\t\tconst maxDate = new Date(check.value);\n\t\t\t\tif (!isNaN(maxDate.getTime())) constraints.push(`Date must be older than ${maxDate.toISOString()} (ISO)`);\n\t\t\t\tbreak;\n\t\t\tdefault: newChecks.push(check);\n\t\t}\n\t\tconstraints.push(`Date format is date-time`);\n\t\tlet result = z.string().describe(\"date-time\");\n\t\tconst description = this.mergeParameterDescription(value.description, constraints);\n\t\tif (description) result = result.describe(description);\n\t\treturn result;\n\t}\n\t/**\n\t* Default handler for Zod optional types. Processes the inner type and maintains optionality.\n\t*\n\t* @param value - The Zod optional to process\n\t* @param handleTypes - Types that should be processed vs passed through\n\t* @returns The processed Zod optional\n\t*/\n\tdefaultZodOptionalHandler(value, handleTypes = SUPPORTED_ZOD_TYPES) {\n\t\tif (handleTypes.includes(value._def.innerType._def.typeName)) return this.processZodType(value._def.innerType).optional();\n\t\telse return value;\n\t}\n\t/**\n\t* Default handler for Zod nullable types. Processes the inner type and maintains nullability.\n\t*\n\t* @param value - The Zod nullable to process\n\t* @param handleTypes - Types that should be processed vs passed through\n\t* @returns The processed Zod nullable\n\t*/\n\tdefaultZodNullableHandler(value, handleTypes = SUPPORTED_ZOD_TYPES) {\n\t\tif (handleTypes.includes(value._def.innerType._def.typeName)) return this.processZodType(value._def.innerType).nullable();\n\t\telse return value;\n\t}\n\t/**\n\t* Recursively collects leaf types from a ZodIntersection tree.\n\t*/\n\tcollectIntersectionLeaves(value) {\n\t\tif (value instanceof ZodIntersection) return [...this.collectIntersectionLeaves(value._def.left), ...this.collectIntersectionLeaves(value._def.right)];\n\t\treturn [value];\n\t}\n\t/**\n\t* Default handler for Zod intersection types.\n\t* Flattens the intersection tree and merges object shapes into a single z.object().\n\t* Falls back to z.any() for non-object intersections.\n\t*/\n\tdefaultZodIntersectionHandler(value) {\n\t\tconst processed = this.collectIntersectionLeaves(value).map((leaf) => this.processZodType(leaf));\n\t\tif (processed.every((p) => p instanceof ZodObject)) {\n\t\t\tconst mergedShape = {};\n\t\t\tfor (const obj of processed) Object.assign(mergedShape, obj.shape);\n\t\t\tlet result = z.object(mergedShape);\n\t\t\tif (value.description) result = result.describe(value.description);\n\t\t\treturn result;\n\t\t}\n\t\treturn z.any().describe(value.description || \"intersection type\");\n\t}\n\t/**\n\t* Processes a Zod object schema and converts it to an AI SDK Schema.\n\t*\n\t* @param zodSchema - The Zod object schema to process\n\t* @returns An AI SDK Schema with provider-specific compatibility applied\n\t*/\n\tprocessToAISDKSchema(zodSchema) {\n\t\treturn convertZodSchemaToAISDKSchema(this.processZodType(zodSchema), this.getSchemaTarget());\n\t}\n\t/**\n\t* Processes a Zod object schema and converts it to a JSON Schema.\n\t*\n\t* @param zodSchema - The Zod object schema to process\n\t* @returns A JSONSchema7 object with provider-specific compatibility applied\n\t*/\n\tprocessToJSONSchema(zodSchema) {\n\t\treturn this.processToAISDKSchema(zodSchema).jsonSchema;\n\t}\n};\n//#endregion\n//#region src/schema-compatibility-v4.ts\n/**\n* All supported string validation check types that can be processed or converted to descriptions.\n* @constant\n*/\nconst ALL_STRING_CHECKS$1 = [\n\t\"regex\",\n\t\"emoji\",\n\t\"email\",\n\t\"url\",\n\t\"uuid\",\n\t\"cuid\",\n\t\"min_length\",\n\t\"max_length\",\n\t\"string_format\"\n];\n/**\n* All supported number validation check types that can be processed or converted to descriptions.\n* @constant\n*/\nconst ALL_NUMBER_CHECKS$1 = [\n\t\"greater_than\",\n\t\"less_than\",\n\t\"multiple_of\"\n];\n/**\n* All supported array validation check types that can be processed or converted to descriptions.\n* @constant\n*/\nconst ALL_ARRAY_CHECKS$1 = [\n\t\"min\",\n\t\"max\",\n\t\"length\"\n];\n/**\n* Zod types that are not supported by most AI model providers and should be avoided.\n* @constant\n*/\nconst UNSUPPORTED_ZOD_TYPES$2 = [\n\t\"ZodIntersection\",\n\t\"ZodNever\",\n\t\"ZodNull\",\n\t\"ZodTuple\",\n\t\"ZodUndefined\"\n];\n/**\n* Zod types that are generally supported by AI model providers.\n* @constant\n*/\nconst SUPPORTED_ZOD_TYPES$2 = [\n\t\"ZodObject\",\n\t\"ZodArray\",\n\t\"ZodUnion\",\n\t\"ZodString\",\n\t\"ZodNumber\",\n\t\"ZodDate\",\n\t\"ZodAny\",\n\t\"ZodDefault\",\n\t\"ZodNullable\"\n];\n[...SUPPORTED_ZOD_TYPES$2, ...UNSUPPORTED_ZOD_TYPES$2];\n/**\n* Returns the v3-style type name (e.g. \"ZodString\") for a Zod v4 schema. Zod v4\n* stores the kind as a lowercase `type` (e.g. \"string\"), so this normalizes it\n* for comparison against the `*_ZOD_TYPES` lists, mirroring the dispatcher in\n* `schema-compatibility.ts`.\n*/\nfunction zodV4TypeName(value) {\n\tconst v4Type = value?._zod?.def?.type;\n\treturn v4Type ? \"Zod\" + v4Type.charAt(0).toUpperCase() + v4Type.slice(1) : \"\";\n}\n/**\n* Abstract base class for creating schema compatibility layers for different AI model providers.\n*\n* This class provides a framework for transforming Zod schemas to work with specific AI model\n* provider requirements and limitations. Each provider may have different support levels for\n* JSON Schema features, validation constraints, and data types.\n*\n*\n* @example\n* ```typescript\n* import { SchemaCompatLayer } from '@mastra/schema-compat';\n* import type { LanguageModelV1 } from 'ai';\n*\n* class CustomProviderCompat extends SchemaCompatLayer {\n* constructor(model: LanguageModelV1) {\n* super(model);\n* }\n*\n* shouldApply(): boolean {\n* return this.getModel().provider === 'custom-provider';\n* }\n*\n* getSchemaTarget() {\n* return 'jsonSchema7';\n* }\n*\n* processZodType<T extends z.AnyZodObject>(value: z.ZodAny): ShapeValue<T> {\n* // Custom processing logic for this provider\n* switch (value._def.typeName) {\n* case 'ZodString':\n* return this.defaultZodStringHandler(value, ['email', 'url']);\n* default:\n* return this.defaultUnsupportedZodTypeHandler(value);\n* }\n* }\n* }\n* ```\n*/\nvar SchemaCompatLayer$2 = class {\n\tmodel;\n\tparent;\n\t/**\n\t* Creates a new schema compatibility instance.\n\t*\n\t* @param model - The language model this compatibility layer applies to\n\t*/\n\tconstructor(model, parent) {\n\t\tthis.model = model;\n\t\tthis.parent = parent;\n\t}\n\t/**\n\t* Gets the language model associated with this compatibility layer.\n\t*\n\t* @returns The language model instance\n\t*/\n\tgetModel() {\n\t\treturn this.model;\n\t}\n\tgetUnsupportedZodTypes() {\n\t\treturn UNSUPPORTED_ZOD_TYPES$2;\n\t}\n\t/**\n\t* Type guard for optional Zod types\n\t*/\n\tisOptional(v) {\n\t\treturn v instanceof ZodOptional$1;\n\t}\n\t/**\n\t* Type guard for object Zod types\n\t*/\n\tisObj(v) {\n\t\treturn v instanceof ZodObject$1;\n\t}\n\t/**\n\t* Type guard for null Zod types\n\t*/\n\tisNull(v) {\n\t\treturn v instanceof ZodNull$1;\n\t}\n\t/**\n\t* Type guard for nullable Zod types\n\t*/\n\tisNullable(v) {\n\t\treturn v instanceof ZodNullable$1;\n\t}\n\t/**\n\t* Type guard for array Zod types\n\t*/\n\tisArr(v) {\n\t\treturn v instanceof ZodArray$1;\n\t}\n\t/**\n\t* Type guard for union Zod types\n\t*/\n\tisUnion(v) {\n\t\treturn v instanceof ZodUnion$1;\n\t}\n\t/**\n\t* Type guard for string Zod types\n\t*/\n\tisString(v) {\n\t\treturn v instanceof ZodString$1;\n\t}\n\t/**\n\t* Type guard for number Zod types\n\t*/\n\tisNumber(v) {\n\t\treturn v instanceof ZodNumber$1;\n\t}\n\t/**\n\t* Type guard for date Zod types\n\t*/\n\tisDate(v) {\n\t\treturn v instanceof ZodDate$1;\n\t}\n\t/**\n\t* Type guard for default Zod types\n\t*/\n\tisDefault(v) {\n\t\treturn v instanceof ZodDefault$1;\n\t}\n\t/**\n\t* Type guard for intersection Zod types\n\t*/\n\tisIntersection(v) {\n\t\treturn v instanceof ZodIntersection$1;\n\t}\n\t/**\n\t* Determines whether this compatibility layer should be applied for the current model.\n\t*\n\t* @returns True if this compatibility layer should be used, false otherwise\n\t* @abstract\n\t*/\n\tshouldApply() {\n\t\treturn this.parent.shouldApply();\n\t}\n\t/**\n\t* Returns the JSON Schema target format for this provider.\n\t*\n\t* @returns The schema target format, or undefined to use the default 'jsonSchema7'\n\t* @abstract\n\t*/\n\tgetSchemaTarget() {\n\t\treturn this.parent.getSchemaTarget();\n\t}\n\t/**\n\t* Processes a specific Zod type according to the provider's requirements.\n\t*\n\t* @param value - The Zod type to process\n\t* @returns The processed Zod type\n\t* @abstract\n\t*/\n\tprocessZodType(value) {\n\t\treturn this.parent.processZodType(value);\n\t}\n\t/**\n\t* Default handler for Zod object types. Recursively processes all properties in the object.\n\t*\n\t* @param value - The Zod object to process\n\t* @returns The processed Zod object\n\t*/\n\tdefaultZodObjectHandler(value, options = { passthrough: true }) {\n\t\tconst processedShape = Object.entries(value.shape).reduce((acc, [key, propValue]) => {\n\t\t\tacc[key] = this.processZodType(propValue);\n\t\t\treturn acc;\n\t\t}, {});\n\t\tlet result = z$2.object(processedShape);\n\t\tif (value._zod.def.catchall instanceof z$2.ZodNever) result = z$2.strictObject(processedShape);\n\t\telse if (value._zod.def.catchall instanceof z$2.ZodUnknown) {\n\t\t\tif (options.passthrough) result = z$2.looseObject(processedShape);\n\t\t} else if (value._zod.def.catchall) result = result.catchall(value._zod.def.catchall);\n\t\tif (value.description) result = result.describe(value.description);\n\t\treturn result;\n\t}\n\t/**\n\t* Merges validation constraints into a parameter description.\n\t*\n\t* This helper method converts validation constraints that may not be supported\n\t* by a provider into human-readable descriptions.\n\t*\n\t* @param description - The existing parameter description\n\t* @param constraints - The validation constraints to merge\n\t* @returns The updated description with constraints, or undefined if no constraints\n\t*/\n\tmergeParameterDescription(description, constraints) {\n\t\tif (constraints.length > 0) return (description ? description + \"\\n\" : \"\") + `constraints: ${constraints.join(`, `)}`;\n\t\telse return description;\n\t}\n\t/**\n\t* Default handler for unsupported Zod types. Throws an error for specified unsupported types.\n\t*\n\t* @param value - The Zod type to check\n\t* @param throwOnTypes - Array of type names to throw errors for\n\t* @returns The original value if not in the throw list\n\t* @throws Error if the type is in the unsupported list\n\t*/\n\tdefaultUnsupportedZodTypeHandler(value, throwOnTypes = UNSUPPORTED_ZOD_TYPES$2) {\n\t\tif (throwOnTypes.includes(value.constructor.name)) throw new Error(`${this.model.modelId} does not support zod type: ${value.constructor.name}`);\n\t\treturn value;\n\t}\n\t/**\n\t* Default handler for Zod array types. Processes array constraints according to provider support.\n\t*\n\t* @param value - The Zod array to process\n\t* @param handleChecks - Array constraints to convert to descriptions vs keep as validation\n\t* @returns The processed Zod array\n\t*/\n\tdefaultZodArrayHandler(value, handleChecks = ALL_ARRAY_CHECKS$1) {\n\t\tconst zodArrayDef = value._zod.def;\n\t\tconst processedType = this.processZodType(zodArrayDef.element);\n\t\tlet result = z$2.array(processedType);\n\t\tconst constraints = [];\n\t\tif (zodArrayDef.checks) for (const check of zodArrayDef.checks) {\n\t\t\tif (check._zod.def.check === \"min_length\") if (handleChecks.includes(\"min\")) constraints.push(`minimum length ${check._zod.def.minimum}`);\n\t\t\telse result = result.min(check._zod.def.minimum);\n\t\t\tif (check._zod.def.check === \"max_length\") if (handleChecks.includes(\"max\")) constraints.push(`maximum length ${check._zod.def.maximum}`);\n\t\t\telse result = result.max(check._zod.def.maximum);\n\t\t\tif (check._zod.def.check === \"length_equals\") if (handleChecks.includes(\"length\")) constraints.push(`exact length ${check._zod.def.length}`);\n\t\t\telse result = result.length(check._zod.def.length);\n\t\t}\n\t\tconst metaDescription = value.meta()?.description;\n\t\tconst legacyDescription = value.description;\n\t\tconst description = this.mergeParameterDescription(metaDescription || legacyDescription, constraints);\n\t\tif (description) result = result.describe(description);\n\t\treturn result;\n\t}\n\t/**\n\t* Default handler for Zod union types. Processes all union options.\n\t*\n\t* @param value - The Zod union to process\n\t* @returns The processed Zod union\n\t* @throws Error if union has fewer than 2 options\n\t*/\n\tdefaultZodUnionHandler(value) {\n\t\tconst processedOptions = value._zod.def.options.map((option) => this.processZodType(option));\n\t\tif (processedOptions.length < 2) throw new Error(\"Union must have at least 2 options\");\n\t\tlet result = z$2.union(processedOptions);\n\t\tif (value.description) result = result.describe(value.description);\n\t\treturn result;\n\t}\n\t/**\n\t* Default handler for Zod string types. Processes string validation constraints.\n\t*\n\t* @param value - The Zod string to process\n\t* @param handleChecks - String constraints to convert to descriptions vs keep as validation\n\t* @returns The processed Zod string\n\t*/\n\tdefaultZodStringHandler(value, handleChecks = ALL_STRING_CHECKS$1) {\n\t\tconst constraints = [];\n\t\tconst checks = value._zod.def.checks || [];\n\t\tconst newChecks = [];\n\t\tif (checks) for (const check of checks) if (handleChecks.includes(check._zod.def.check)) switch (check._zod.def.check) {\n\t\t\tcase \"min_length\":\n\t\t\t\tconstraints.push(`minimum length ${check._zod.def.minimum}`);\n\t\t\t\tbreak;\n\t\t\tcase \"max_length\":\n\t\t\t\tconstraints.push(`maximum length ${check._zod.def.maximum}`);\n\t\t\t\tbreak;\n\t\t\tcase \"string_format\":\n\t\t\t\tswitch (check._zod.def.format) {\n\t\t\t\t\tcase \"email\":\n\t\t\t\t\tcase \"url\":\n\t\t\t\t\tcase \"emoji\":\n\t\t\t\t\tcase \"uuid\":\n\t\t\t\t\tcase \"cuid\":\n\t\t\t\t\t\tconstraints.push(`a valid ${check._zod.def.format}`);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"regex\":\n\t\t\t\t\t\tconstraints.push(`input must match this regex ${check._zod.def.pattern}`);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tnewChecks.push(check);\n\t\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t}\n\t\telse newChecks.push(check);\n\t\tlet result = z$2.string();\n\t\tfor (const check of newChecks) result = result.check(check);\n\t\tconst metaDescription = value.meta()?.description;\n\t\tconst legacyDescription = value.description;\n\t\tconst description = this.mergeParameterDescription(metaDescription || legacyDescription, constraints);\n\t\tif (description) result = result.describe(description);\n\t\treturn result;\n\t}\n\t/**\n\t* Default handler for Zod number types. Processes number validation constraints.\n\t*\n\t* @param value - The Zod number to process\n\t* @param handleChecks - Number constraints to convert to descriptions vs keep as validation\n\t* @returns The processed Zod number\n\t*/\n\tdefaultZodNumberHandler(value, handleChecks = ALL_NUMBER_CHECKS$1) {\n\t\tconst constraints = [];\n\t\tconst checks = value._zod.def.checks || [];\n\t\tconst newChecks = [];\n\t\tif (checks) for (const check of checks) if (handleChecks.includes(check._zod.def.check)) switch (check._zod.def.check) {\n\t\t\tcase \"greater_than\":\n\t\t\t\tif (check._zod.def.inclusive) constraints.push(`greater than or equal to ${check._zod.def.value}`);\n\t\t\t\telse constraints.push(`greater than ${check._zod.def.value}`);\n\t\t\t\tbreak;\n\t\t\tcase \"less_than\":\n\t\t\t\tif (check._zod.def.inclusive) constraints.push(`lower than or equal to ${check._zod.def.value}`);\n\t\t\t\telse constraints.push(`lower than ${check._zod.def.value}`);\n\t\t\t\tbreak;\n\t\t\tcase \"multiple_of\":\n\t\t\t\tconstraints.push(`multiple of ${check._zod.def.value}`);\n\t\t\t\tbreak;\n\t\t}\n\t\telse newChecks.push(check);\n\t\tlet result = z$2.number();\n\t\tfor (const check of newChecks) switch (check._zod.def.check) {\n\t\t\tcase \"number_format\":\n\t\t\t\tswitch (check._zod.def.format) {\n\t\t\t\t\tcase \"safeint\":\n\t\t\t\t\t\tresult = result.int();\n\t\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tdefault: result = result.check(check);\n\t\t}\n\t\tconst description = this.mergeParameterDescription(value.description, constraints);\n\t\tif (description) result = result.describe(description);\n\t\treturn result;\n\t}\n\t/**\n\t* Default handler for Zod date types. Converts dates to ISO strings with constraint descriptions.\n\t*\n\t* @param value - The Zod date to process\n\t* @returns A Zod string schema representing the date in ISO format\n\t*/\n\tdefaultZodDateHandler(value) {\n\t\tconst constraints = [];\n\t\tconst checks = value._zod.def.checks || [];\n\t\tconst newChecks = [];\n\t\tif (checks) for (const check of checks) switch (check._zod.def.check) {\n\t\t\tcase \"less_than\":\n\t\t\t\tconst maxDate = new Date(check._zod.def.value);\n\t\t\t\tif (!isNaN(maxDate.getTime())) constraints.push(`Date must be older than ${maxDate.toISOString()} (ISO)`);\n\t\t\t\tbreak;\n\t\t\tcase \"greater_than\":\n\t\t\t\tconst minDate = new Date(check._zod.def.value);\n\t\t\t\tif (!isNaN(minDate.getTime())) constraints.push(`Date must be newer than ${minDate.toISOString()} (ISO)`);\n\t\t\t\tbreak;\n\t\t\tdefault: newChecks.push(check);\n\t\t}\n\t\tconstraints.push(`Date format is date-time`);\n\t\tlet result = z$2.string().describe(\"date-time\");\n\t\tconst description = this.mergeParameterDescription(value.description, constraints);\n\t\tif (description) result = result.describe(description);\n\t\treturn result;\n\t}\n\t/**\n\t* Default handler for Zod optional types. Processes the inner type and maintains optionality.\n\t*\n\t* @param value - The Zod optional to process\n\t* @param handleTypes - Types that should be processed vs passed through\n\t* @returns The processed Zod optional\n\t*/\n\tdefaultZodOptionalHandler(value, handleTypes = SUPPORTED_ZOD_TYPES$2) {\n\t\tconst innerType = value._zod?.def?.innerType;\n\t\tif (innerType && handleTypes.includes(zodV4TypeName(innerType))) return this.processZodType(innerType).optional();\n\t\telse return value;\n\t}\n\t/**\n\t* Default handler for Zod nullable types. Processes the inner type and maintains nullability.\n\t*\n\t* @param value - The Zod nullable to process\n\t* @param handleTypes - Types that should be processed vs passed through\n\t* @returns The processed Zod nullable\n\t*/\n\tdefaultZodNullableHandler(value, handleTypes = SUPPORTED_ZOD_TYPES$2) {\n\t\tconst innerType = value._zod?.def?.innerType;\n\t\tif (innerType && handleTypes.includes(zodV4TypeName(innerType))) return this.processZodType(innerType).nullable();\n\t\telse return value;\n\t}\n\t/**\n\t* Recursively collects leaf types from a ZodIntersection tree.\n\t*/\n\tcollectIntersectionLeaves(value) {\n\t\tif (value instanceof ZodIntersection$1) return [...this.collectIntersectionLeaves(value._zod.def.left), ...this.collectIntersectionLeaves(value._zod.def.right)];\n\t\treturn [value];\n\t}\n\t/**\n\t* Default handler for Zod intersection types.\n\t* Flattens the intersection tree and merges object shapes into a single z.object().\n\t* Falls back to z.any() for non-object intersections.\n\t*/\n\tdefaultZodIntersectionHandler(value) {\n\t\tconst processed = this.collectIntersectionLeaves(value).map((leaf) => this.processZodType(leaf));\n\t\tif (processed.every((p) => p instanceof ZodObject$1)) {\n\t\t\tconst mergedShape = {};\n\t\t\tfor (const obj of processed) for (const [key, field] of Object.entries(obj.shape)) {\n\t\t\t\tif (key in mergedShape) throw new Error(\"Cannot flatten intersections with overlapping keys\");\n\t\t\t\tmergedShape[key] = field;\n\t\t\t}\n\t\t\tlet result = z$2.object(mergedShape);\n\t\t\tif (value.description) result = result.describe(value.description);\n\t\t\treturn result;\n\t\t}\n\t\treturn z$2.any().describe(value.description || \"intersection type\");\n\t}\n\t/**\n\t* Processes a Zod object schema and converts it to an AI SDK Schema.\n\t*\n\t* @param zodSchema - The Zod object schema to process\n\t* @returns An AI SDK Schema with provider-specific compatibility applied\n\t*/\n\tprocessToAISDKSchema(zodSchema) {\n\t\treturn convertZodSchemaToAISDKSchema(this.processZodType(zodSchema), this.getSchemaTarget());\n\t}\n\t/**\n\t* Processes a Zod object schema and converts it to a JSON Schema.\n\t*\n\t* @param zodSchema - The Zod object schema to process\n\t* @returns A JSONSchema7 object with provider-specific compatibility applied\n\t*/\n\tprocessToJSONSchema(zodSchema) {\n\t\treturn this.processToAISDKSchema(zodSchema).jsonSchema;\n\t}\n};\n//#endregion\n//#region src/json-schema/utils.ts\nvar import_json_schema_traverse = /* @__PURE__ */ __toESM$1(require_json_schema_traverse(), 1);\n/**\n* Type guard to check if a JSON Schema has a specific type\n*/\nfunction hasType(schema, type) {\n\tif (schema.type === type) return true;\n\tif (Array.isArray(schema.type) && schema.type.includes(type)) return true;\n\treturn false;\n}\n/**\n* Check if a JSON Schema represents an object type\n*/\nfunction isObjectSchema(schema) {\n\treturn hasType(schema, \"object\") || schema.properties !== void 0;\n}\n/**\n* Check if a JSON Schema represents an array type\n*/\nfunction isArraySchema(schema) {\n\treturn hasType(schema, \"array\") || schema.items !== void 0;\n}\n/**\n* Check if a JSON Schema represents a string type\n*/\nfunction isStringSchema(schema) {\n\treturn hasType(schema, \"string\");\n}\n/**\n* Check if a JSON Schema represents a number type (number or integer)\n*/\nfunction isNumberSchema(schema) {\n\treturn hasType(schema, \"number\") || hasType(schema, \"integer\");\n}\n/**\n* Check if a JSON Schema uses anyOf\n*/\nfunction isAnyOfSchema(schema) {\n\treturn Array.isArray(schema.anyOf) && schema.anyOf.length > 0;\n}\n/**\n* Check if a JSON Schema uses oneOf\n*/\nfunction isOneOfSchema(schema) {\n\treturn Array.isArray(schema.oneOf) && schema.oneOf.length > 0;\n}\n/**\n* Check if a JSON Schema is a union type (anyOf or oneOf)\n*/\nfunction isUnionSchema(schema) {\n\treturn isAnyOfSchema(schema) || isOneOfSchema(schema) || Array.isArray(schema.type);\n}\n/**\n* Check if a JSON Schema uses allOf (intersection)\n*/\nfunction isAllOfSchema(schema) {\n\treturn Array.isArray(schema.allOf) && schema.allOf.length > 0;\n}\n/**\n* Check if a property is optional within a parent object schema.\n* A property is optional if it's not in the parent's `required` array.\n* @param propertyName - The name of the property to check\n* @param parentSchema - The parent object schema containing the property\n*/\nfunction isOptionalSchema(propertyName, parentSchema) {\n\tif (!parentSchema.required || !Array.isArray(parentSchema.required)) return true;\n\treturn !parentSchema.required.includes(propertyName);\n}\n//#endregion\n//#region src/schema-compatibility.ts\nvar SchemaCompatLayer = class {\n\tmodel;\n\tv3Layer;\n\tv4Layer;\n\t/**\n\t* Creates a new schema compatibility instance.\n\t*\n\t* @param model - The language model this compatibility layer applies to\n\t*/\n\tconstructor(model) {\n\t\tthis.model = model;\n\t\tthis.v3Layer = new SchemaCompatLayer$1(model, this);\n\t\tthis.v4Layer = new SchemaCompatLayer$2(model, this);\n\t}\n\tpreProcessJSONNode(_schema, _parentSchema) {}\n\tpostProcessJSONNode(_schema, _parentSchema) {}\n\t/**\n\t* Gets the language model associated with this compatibility layer.\n\t*\n\t* @returns The language model instance\n\t*/\n\tgetModel() {\n\t\treturn this.model;\n\t}\n\tgetUnsupportedZodTypes(value) {\n\t\tif (\"_zod\" in value) return this.v4Layer.getUnsupportedZodTypes();\n\t\telse return this.v3Layer.getUnsupportedZodTypes();\n\t}\n\tisOptional(v) {\n\t\tif (\"_zod\" in v) return this.v4Layer.isOptional(v);\n\t\telse return this.v3Layer.isOptional(v);\n\t}\n\tisObj(v) {\n\t\tif (\"_zod\" in v) return this.v4Layer.isObj(v);\n\t\telse return this.v3Layer.isObj(v);\n\t}\n\tisNull(v) {\n\t\tif (\"_zod\" in v) return this.v4Layer.isNull(v);\n\t\telse return this.v3Layer.isNull(v);\n\t}\n\tisNullable(v) {\n\t\tif (\"_zod\" in v) return this.v4Layer.isNullable(v);\n\t\telse return this.v3Layer.isNullable(v);\n\t}\n\tisArr(v) {\n\t\tif (\"_zod\" in v) return this.v4Layer.isArr(v);\n\t\telse return this.v3Layer.isArr(v);\n\t}\n\tisUnion(v) {\n\t\tif (\"_zod\" in v) return this.v4Layer.isUnion(v);\n\t\telse return this.v3Layer.isUnion(v);\n\t}\n\tisString(v) {\n\t\tif (\"_zod\" in v) return this.v4Layer.isString(v);\n\t\telse return this.v3Layer.isString(v);\n\t}\n\tisNumber(v) {\n\t\tif (\"_zod\" in v) return this.v4Layer.isNumber(v);\n\t\telse return this.v3Layer.isNumber(v);\n\t}\n\tisDate(v) {\n\t\tif (\"_zod\" in v) return this.v4Layer.isDate(v);\n\t\telse return this.v3Layer.isDate(v);\n\t}\n\tisDefault(v) {\n\t\tif (\"_zod\" in v) return this.v4Layer.isDefault(v);\n\t\telse return this.v3Layer.isDefault(v);\n\t}\n\tisIntersection(v) {\n\t\tif (\"_zod\" in v) return this.v4Layer.isIntersection(v);\n\t\telse return this.v3Layer.isIntersection(v);\n\t}\n\tdefaultZodObjectHandler(value, options = { passthrough: true }) {\n\t\tif (\"_zod\" in value) return this.v4Layer.defaultZodObjectHandler(value, options);\n\t\telse return this.v3Layer.defaultZodObjectHandler(value, options);\n\t}\n\tmergeParameterDescription(description, constraints) {\n\t\treturn this.v3Layer.mergeParameterDescription(description, constraints);\n\t}\n\tdefaultUnsupportedZodTypeHandler(value, throwOnTypes) {\n\t\tif (\"_zod\" in value) return this.v4Layer.defaultUnsupportedZodTypeHandler(value, throwOnTypes ?? UNSUPPORTED_ZOD_TYPES$2);\n\t\telse return this.v3Layer.defaultUnsupportedZodTypeHandler(value, throwOnTypes ?? UNSUPPORTED_ZOD_TYPES);\n\t}\n\tdefaultZodArrayHandler(value, handleChecks = ALL_ARRAY_CHECKS) {\n\t\tif (\"_zod\" in value) return this.v4Layer.defaultZodArrayHandler(value, handleChecks);\n\t\telse return this.v3Layer.defaultZodArrayHandler(value, handleChecks);\n\t}\n\tdefaultZodUnionHandler(value) {\n\t\tif (\"_zod\" in value) return this.v4Layer.defaultZodUnionHandler(value);\n\t\telse return this.v3Layer.defaultZodUnionHandler(value);\n\t}\n\tdefaultZodStringHandler(value, handleChecks = ALL_STRING_CHECKS) {\n\t\tif (\"_zod\" in value) return this.v4Layer.defaultZodStringHandler(value);\n\t\telse return this.v3Layer.defaultZodStringHandler(value, handleChecks);\n\t}\n\tdefaultZodNumberHandler(value, handleChecks = ALL_NUMBER_CHECKS) {\n\t\tif (\"_zod\" in value) return this.v4Layer.defaultZodNumberHandler(value);\n\t\telse return this.v3Layer.defaultZodNumberHandler(value, handleChecks);\n\t}\n\tdefaultZodDateHandler(value) {\n\t\tif (\"_zod\" in value) return this.v4Layer.defaultZodDateHandler(value);\n\t\telse return this.v3Layer.defaultZodDateHandler(value);\n\t}\n\tdefaultZodOptionalHandler(value, handleTypes) {\n\t\tif (!handleTypes) handleTypes = [\n\t\t\t\"ZodObject\",\n\t\t\t\"ZodArray\",\n\t\t\t\"ZodUnion\",\n\t\t\t\"ZodString\",\n\t\t\t\"ZodNumber\"\n\t\t];\n\t\tlet innerTypeName;\n\t\tif (\"_zod\" in value) {\n\t\t\tconst v4Type = (value._zod?.def?.innerType)?._zod?.def?.type;\n\t\t\tif (!v4Type) return value;\n\t\t\tinnerTypeName = \"Zod\" + v4Type.charAt(0).toUpperCase() + v4Type.slice(1);\n\t\t} else innerTypeName = value._def.innerType._def.typeName;\n\t\tif (handleTypes.includes(innerTypeName)) if (\"_zod\" in value) {\n\t\t\tconst innerType = value._zod?.def?.innerType;\n\t\t\tif (!innerType) return value;\n\t\t\treturn this.processZodType(innerType).optional();\n\t\t} else return this.processZodType(value._def.innerType).optional();\n\t\telse return value;\n\t}\n\tdefaultZodNullableHandler(value, handleTypes) {\n\t\tif (\"_zod\" in value) return this.v4Layer.defaultZodNullableHandler(value, handleTypes ?? SUPPORTED_ZOD_TYPES$2);\n\t\telse return this.v3Layer.defaultZodNullableHandler(value, handleTypes ?? SUPPORTED_ZOD_TYPES);\n\t}\n\tdefaultZodIntersectionHandler(value) {\n\t\tif (\"_zod\" in value) return this.v4Layer.defaultZodIntersectionHandler(value);\n\t\telse return this.v3Layer.defaultZodIntersectionHandler(value);\n\t}\n\t/**\n\t* @deprecated please use processToCompatSchema to usse StandardSchemaWithJSON\n\t* @param zodSchema\n\t* @returns\n\t*/\n\tprocessToAISDKSchema(zodSchema) {\n\t\treturn convertZodSchemaToAISDKSchema(this.processZodType(zodSchema), this.getSchemaTarget());\n\t}\n\t/**\n\t* @param schema\n\t* @returns\n\t*/\n\tprocessToJSONSchema(schema, io = \"input\") {\n\t\tconst jsonSchema = standardSchemaToJSONSchema(toStandardSchema(schema), {\n\t\t\ttarget: \"draft-07\",\n\t\t\tio\n\t\t});\n\t\t(0, import_json_schema_traverse.default)(jsonSchema, { cb: {\n\t\t\tpre: (schema) => {\n\t\t\t\tthis.preProcessJSONNode(schema);\n\t\t\t},\n\t\t\tpost: (schema) => {\n\t\t\t\tthis.postProcessJSONNode(schema);\n\t\t\t}\n\t\t} });\n\t\treturn jsonSchema;\n\t}\n\tprocessToCompatSchema(schema) {\n\t\treturn { \"~standard\": {\n\t\t\tversion: 1,\n\t\t\tvendor: \"mastra\",\n\t\t\tvalidate: (value) => toStandardSchema(schema)[\"~standard\"].validate(value),\n\t\t\tjsonSchema: {\n\t\t\t\tinput: () => {\n\t\t\t\t\treturn this.processToJSONSchema(schema, \"input\");\n\t\t\t\t},\n\t\t\t\toutput: () => {\n\t\t\t\t\treturn this.processToJSONSchema(schema, \"output\");\n\t\t\t\t}\n\t\t\t}\n\t\t} };\n\t}\n\t/**\n\t* Default handler for JSON Schema objects.\n\t* Processes object schemas with properties and required fields.\n\t*/\n\tdefaultObjectHandler(schema) {\n\t\tif (schema.properties && schema.additionalProperties === void 0) schema.additionalProperties = false;\n\t\tif (!Object.keys(schema.properties ?? {}).length) schema.required = [];\n\t\treturn schema;\n\t}\n\t/**\n\t* Default handler for JSON Schema arrays.\n\t* Converts array constraints (minItems, maxItems) to description text.\n\t*/\n\tdefaultArrayHandler(schema) {\n\t\tlet constraints = [];\n\t\tconst minItems = schema.minItems;\n\t\tconst maxItems = schema.maxItems;\n\t\tif (minItems !== void 0 && maxItems !== void 0 && minItems === maxItems) {\n\t\t\tconstraints = [`exact length ${minItems}`];\n\t\t\tdelete schema.minItems;\n\t\t\tdelete schema.maxItems;\n\t\t} else {\n\t\t\tif (minItems !== void 0) {\n\t\t\t\tconstraints.push(`minimum length ${minItems}`);\n\t\t\t\tdelete schema.minItems;\n\t\t\t}\n\t\t\tif (maxItems !== void 0) {\n\t\t\t\tconstraints.push(`maximum length ${maxItems}`);\n\t\t\t\tdelete schema.maxItems;\n\t\t\t}\n\t\t}\n\t\tif (constraints.length) schema.description = this.mergeParameterDescription(schema.description, constraints);\n\t\treturn schema;\n\t}\n\t/**\n\t* Default handler for JSON Schema strings.\n\t* Converts string constraints (minLength, maxLength, pattern, format) to description text.\n\t*/\n\tdefaultStringHandler(schema) {\n\t\tconst constraints = [];\n\t\tif (schema.minLength !== void 0) {\n\t\t\tconstraints.push(`minimum length ${schema.minLength}`);\n\t\t\tdelete schema.minLength;\n\t\t}\n\t\tif (schema.maxLength !== void 0) {\n\t\t\tconstraints.push(`maximum length ${schema.maxLength}`);\n\t\t\tdelete schema.maxLength;\n\t\t}\n\t\tswitch (schema.format) {\n\t\t\tcase \"email\":\n\t\t\tcase \"emoji\":\n\t\t\tcase \"uri\":\n\t\t\tcase \"uuid\":\n\t\t\tcase \"date-time\":\n\t\t\tcase \"date\":\n\t\t\tcase \"time\":\n\t\t\t\tconstraints.push(`a valid ${schema.format}`);\n\t\t\t\tdelete schema.pattern;\n\t\t\t\tdelete schema.format;\n\t\t\t\tbreak;\n\t\t}\n\t\tif (constraints.length === 0 && schema.pattern !== void 0) {\n\t\t\tconstraints.push(`input must match this regex ${schema.pattern}`);\n\t\t\tdelete schema.pattern;\n\t\t}\n\t\tif (constraints.length) schema.description = this.mergeParameterDescription(schema.description, constraints);\n\t\treturn schema;\n\t}\n\t/**\n\t* Default handler for JSON Schema numbers/integers.\n\t* Converts number constraints (minimum, maximum, multipleOf, exclusiveMinimum, exclusiveMaximum) to description text.\n\t*/\n\tdefaultNumberHandler(schema) {\n\t\tconst constraints = [];\n\t\tif (schema.minimum !== void 0) {\n\t\t\tif (schema.minimum !== Number.MIN_SAFE_INTEGER) constraints.push(`greater than or equal to ${schema.minimum}`);\n\t\t\tdelete schema.minimum;\n\t\t}\n\t\tif (schema.maximum !== void 0) {\n\t\t\tif (schema.maximum !== Number.MAX_SAFE_INTEGER) constraints.push(`lower than or equal to ${schema.maximum}`);\n\t\t\tdelete schema.maximum;\n\t\t}\n\t\tif (schema.exclusiveMinimum !== void 0) {\n\t\t\tconstraints.push(`greater than ${schema.exclusiveMinimum}`);\n\t\t\tdelete schema.exclusiveMinimum;\n\t\t}\n\t\tif (schema.exclusiveMaximum !== void 0) {\n\t\t\tconstraints.push(`lower than ${schema.exclusiveMaximum}`);\n\t\t\tdelete schema.exclusiveMaximum;\n\t\t}\n\t\tif (schema.multipleOf !== void 0) {\n\t\t\tconstraints.push(`multiple of ${schema.multipleOf}`);\n\t\t\tdelete schema.multipleOf;\n\t\t}\n\t\tif (constraints.length) schema.description = this.mergeParameterDescription(schema.description, constraints);\n\t\treturn schema;\n\t}\n\t/**\n\t* Default handler for JSON Schema unions (anyOf/oneOf).\n\t* Processes union schemas and can convert anyOf patterns to type arrays for simple primitives.\n\t*/\n\tdefaultUnionHandler(schema) {\n\t\tif (Array.isArray(schema.anyOf)) {\n\t\t\tschema.anyOf = schema.anyOf.map((subSchema) => {\n\t\t\t\tif (typeof subSchema !== \"object\" || subSchema === null) return false;\n\t\t\t\tthis.preProcessJSONNode(subSchema);\n\t\t\t\tthis.postProcessJSONNode(subSchema);\n\t\t\t\treturn subSchema;\n\t\t\t}).filter(Boolean);\n\t\t\tif (schema.anyOf.length === 1) schema = schema.anyOf[0];\n\t\t}\n\t\treturn schema;\n\t}\n\t/**\n\t* Default handler for JSON Schema allOf (intersection) types.\n\t* Flattens allOf sub-schemas by merging properties and required arrays into a single object schema.\n\t*/\n\tdefaultAllOfHandler(schema) {\n\t\tif (!schema.allOf || !Array.isArray(schema.allOf)) return schema;\n\t\tconst mergedProperties = {};\n\t\tconst mergedRequired = [];\n\t\tfor (const subSchema of schema.allOf) {\n\t\t\tif (subSchema.properties) Object.assign(mergedProperties, subSchema.properties);\n\t\t\tif (Array.isArray(subSchema.required)) mergedRequired.push(...subSchema.required);\n\t\t}\n\t\tdelete schema.allOf;\n\t\tschema.type = \"object\";\n\t\tschema.properties = mergedProperties;\n\t\tif (mergedRequired.length > 0) schema.required = [...new Set(mergedRequired)];\n\t\tschema.additionalProperties = false;\n\t\treturn schema;\n\t}\n\t/**\n\t* Default handler for JSON Schema nullable types.\n\t* Ensures nullable types are represented correctly.\n\t*/\n\tdefaultNullableHandler(schema) {\n\t\treturn this.defaultUnionHandler(schema);\n\t}\n\t/**\n\t* Default handler for JSON Schema dates (string with date/date-time format).\n\t* Converts date formats to string type with format constraint in description.\n\t*/\n\tdefaultDateHandler(schema) {\n\t\tif (schema.format === \"date\" || schema.format === \"date-time\") {\n\t\t\tconst format = schema.format;\n\t\t\tdelete schema.format;\n\t\t\tschema.description = this.mergeParameterDescription(schema.description, [`format: ${format}`]);\n\t\t}\n\t\treturn schema;\n\t}\n\t/**\n\t* Default handler for empty JSON schemas.\n\t* Converts empty {} schemas to a union of primitive types.\n\t*/\n\tdefaultEmptySchemaHandler(schema) {\n\t\tif (Object.keys(schema).length === 0) schema.type = [\n\t\t\t\"string\",\n\t\t\t\"number\",\n\t\t\t\"boolean\",\n\t\t\t\"null\"\n\t\t];\n\t\treturn schema;\n\t}\n\t/**\n\t* Default handler for unsupported JSON Schema features.\n\t* Can be used to strip or convert unsupported keywords.\n\t*/\n\tdefaultUnsupportedHandler(schema, unsupportedKeywords = []) {\n\t\tfor (const keyword of unsupportedKeywords) if (keyword in schema) delete schema[keyword];\n\t\treturn schema;\n\t}\n\tisObjectSchema(schema) {\n\t\treturn isObjectSchema(schema);\n\t}\n\tisArraySchema(schema) {\n\t\treturn isArraySchema(schema);\n\t}\n\tisStringSchema(schema) {\n\t\treturn isStringSchema(schema);\n\t}\n\tisNumberSchema(schema) {\n\t\treturn isNumberSchema(schema);\n\t}\n\tisUnionSchema(schema) {\n\t\treturn isUnionSchema(schema);\n\t}\n\tisAllOfSchema(schema) {\n\t\treturn isAllOfSchema(schema);\n\t}\n\t/**\n\t* Checks if a property is optional within a parent object schema.\n\t* A property is optional if it's not in the parent's `required` array.\n\t* @param propertyName - The name of the property to check\n\t* @param parentSchema - The parent object schema containing the property\n\t*/\n\tisOptionalProperty(propertyName, parentSchema) {\n\t\treturn isOptionalSchema(propertyName, parentSchema);\n\t}\n\t/**\n\t* Converts a Zod schema to JSON Schema using the standard-schema interface\n\t* and applies pre/post processing via traverse.\n\t*\n\t* Uses 'input' io mode so that fields with defaults are optional (appropriate for tool parameters).\n\t* @deprecated please use processToCompatSchema\n\t*/\n\ttoJSONSchema(zodSchema) {\n\t\tconst SCHEMA_TARGET_TO_STANDARD = {\n\t\t\tjsonSchema7: \"draft-07\",\n\t\t\t\"jsonSchema2019-09\": \"draft-2020-12\",\n\t\t\topenApi3: \"openapi-3.0\"\n\t\t};\n\t\tconst schemaTarget = this.getSchemaTarget();\n\t\tconst target = (schemaTarget && SCHEMA_TARGET_TO_STANDARD[schemaTarget]) ?? schemaTarget;\n\t\tconst jsonSchema = standardSchemaToJSONSchema(toStandardSchema(zodSchema), {\n\t\t\ttarget,\n\t\t\tio: \"input\"\n\t\t});\n\t\t(0, import_json_schema_traverse.default)(jsonSchema, { cb: {\n\t\t\tpre: (schema) => {\n\t\t\t\tthis.preProcessJSONNode(schema);\n\t\t\t},\n\t\t\tpost: (schema) => {\n\t\t\t\tthis.postProcessJSONNode(schema);\n\t\t\t}\n\t\t} });\n\t\treturn jsonSchema;\n\t}\n};\n//#endregion\n//#region src/null-to-undefined.ts\n/**\n* Recursively converts null values to undefined in an object based on which\n* properties are optional in the JSON Schema. This is needed because OpenAI\n* strict mode sends null for optional fields, but schemas like Zod's .optional()\n* reject null.\n*\n* Only converts null→undefined for properties that are NOT in the schema's\n* `required` array, preserving null for explicitly .nullable() fields.\n*/\nfunction transformNullToUndefined(value, jsonSchema) {\n\tif (value === null || value === void 0) return value;\n\tif (typeof value !== \"object\" || Array.isArray(value)) {\n\t\tif (Array.isArray(value) && jsonSchema.items && typeof jsonSchema.items === \"object\") return value.map((item) => transformNullToUndefined(item, jsonSchema.items));\n\t\treturn value;\n\t}\n\tconst properties = jsonSchema.properties;\n\tif (!properties) return value;\n\tconst required = jsonSchema.required || [];\n\tconst result = {};\n\tfor (const [key, val] of Object.entries(value)) if (val === null && !required.includes(key)) result[key] = void 0;\n\telse if (val !== null && typeof val === \"object\" && properties[key]) result[key] = transformNullToUndefined(val, properties[key]);\n\telse result[key] = val;\n\treturn result;\n}\n/**\n* Wraps a StandardSchemaWithJSON to transform null values to undefined for\n* optional fields before validation. This is a schema-agnostic solution for\n* OpenAI strict mode, which sends null for optional fields.\n*\n* The wrapper:\n* 1. Extracts the JSON Schema from the inner schema to determine optional fields\n* 2. Before validation, transforms null→undefined for non-required properties\n* 3. Delegates validation to the inner schema with the transformed value\n* 4. Delegates JSON Schema conversion to the inner schema unchanged\n*/\nfunction wrapSchemaWithNullTransform(schema) {\n\tlet jsonSchema;\n\ttry {\n\t\tjsonSchema = schema[\"~standard\"].jsonSchema.input({ target: \"draft-07\" });\n\t} catch {}\n\tif (!jsonSchema) return schema;\n\tconst innerProps = schema[\"~standard\"];\n\treturn { \"~standard\": {\n\t\tversion: innerProps.version,\n\t\tvendor: innerProps.vendor,\n\t\ttypes: innerProps.types,\n\t\tvalidate: (value, options) => {\n\t\t\tconst transformed = transformNullToUndefined(value, jsonSchema);\n\t\t\treturn innerProps.validate(transformed, options);\n\t\t},\n\t\tjsonSchema: innerProps.jsonSchema\n\t} };\n}\nfunction isOptional$1(z) {\n\treturn (v) => v instanceof z[\"ZodOptional\"];\n}\nfunction isObj$1(z) {\n\treturn (v) => v instanceof z[\"ZodObject\"];\n}\nfunction isNull(z) {\n\treturn (v) => v instanceof z[\"ZodNull\"];\n}\nfunction isArr$1(z) {\n\treturn (v) => v instanceof z[\"ZodArray\"];\n}\nfunction isUnion$1(z) {\n\treturn (v) => v instanceof z[\"ZodUnion\"];\n}\nfunction isString$1(z) {\n\treturn (v) => v instanceof z[\"ZodString\"];\n}\nfunction isNumber$1(z) {\n\treturn (v) => v instanceof z[\"ZodNumber\"];\n}\nfunction isDate(z) {\n\treturn (v) => v instanceof z[\"ZodDate\"];\n}\nfunction isDefault(z) {\n\treturn (v) => v instanceof z[\"ZodDefault\"];\n}\nfunction isNullable(z) {\n\treturn (v) => v instanceof z[\"ZodNullable\"];\n}\nfunction isIntersection(z) {\n\treturn (v) => v instanceof z[\"ZodIntersection\"];\n}\n//#endregion\n//#region src/provider-compats/openai.ts\nconst allowedStringFormats = [\n\t\"date-time\",\n\t\"time\",\n\t\"date\",\n\t\"duration\",\n\t\"email\",\n\t\"hostname\",\n\t\"ipv4\",\n\t\"ipv6\",\n\t\"uuid\"\n];\nvar OpenAISchemaCompatLayer = class extends SchemaCompatLayer {\n\tgetSchemaTarget() {\n\t\treturn `jsonSchema7`;\n\t}\n\tisReasoningModel() {\n\t\tconst modelId = this.getModel().modelId;\n\t\tif (!modelId) return false;\n\t\treturn modelId.includes(`o3`) || modelId.includes(`o4`) || modelId.includes(`o1`);\n\t}\n\tshouldApply() {\n\t\tconst model = this.getModel();\n\t\tif (!this.isReasoningModel() && (model.provider.includes(`openai`) || model.modelId?.includes(`openai`) || model.provider.includes(`groq`))) return true;\n\t\treturn false;\n\t}\n\tprocessZodType(value) {\n\t\tif (isOptional$1(z$1)(value)) {\n\t\t\tconst innerType = \"_def\" in value ? value._def.innerType : value._zod?.def?.innerType;\n\t\t\tif (innerType) {\n\t\t\t\tif (isNullable(z$1)(innerType)) return this.processZodType(innerType).transform((val) => val === null ? void 0 : val);\n\t\t\t\treturn this.processZodType(innerType).nullable().transform((val) => val === null ? void 0 : val);\n\t\t\t}\n\t\t\treturn value;\n\t\t} else if (isNullable(z$1)(value)) {\n\t\t\tconst innerType = \"_def\" in value ? value._def.innerType : value._zod?.def?.innerType;\n\t\t\tif (innerType) {\n\t\t\t\tif (isOptional$1(z$1)(innerType)) {\n\t\t\t\t\tconst innerInnerType = \"_def\" in innerType ? innerType._def.innerType : innerType._zod?.def?.innerType;\n\t\t\t\t\tif (innerInnerType) return this.processZodType(innerInnerType).nullable().transform((val) => val === null ? void 0 : val);\n\t\t\t\t}\n\t\t\t\treturn this.processZodType(innerType).nullable();\n\t\t\t}\n\t\t\treturn value;\n\t\t} else if (isDefault(z$1)(value)) {\n\t\t\tconst innerType = \"_def\" in value ? value._def.innerType : value._zod?.def?.innerType;\n\t\t\tconst defaultValue = \"_def\" in value ? value._def.defaultValue : value._zod?.def?.defaultValue;\n\t\t\tif (innerType) return this.processZodType(innerType).nullable().transform((val) => {\n\t\t\t\tif (val === null) return typeof defaultValue === \"function\" ? defaultValue() : defaultValue;\n\t\t\t\treturn val;\n\t\t\t});\n\t\t\treturn value;\n\t\t} else if (isObj$1(z$1)(value)) return this.defaultZodObjectHandler(value);\n\t\telse if (isUnion$1(z$1)(value)) return this.defaultZodUnionHandler(value);\n\t\telse if (isArr$1(z$1)(value)) return this.defaultZodArrayHandler(value);\n\t\telse if (isString$1(z$1)(value)) {\n\t\t\tconst model = this.getModel();\n\t\t\tconst checks = [\"emoji\"];\n\t\t\tif (model.modelId?.includes(\"gpt-4o-mini\")) return this.defaultZodStringHandler(value, [\"emoji\", \"regex\"]);\n\t\t\treturn this.defaultZodStringHandler(value, checks);\n\t\t}\n\t\tif (isIntersection(z$1)(value)) return this.defaultZodIntersectionHandler(value);\n\t\treturn this.defaultUnsupportedZodTypeHandler(value, [\n\t\t\t\"ZodNever\",\n\t\t\t\"ZodUndefined\",\n\t\t\t\"ZodTuple\"\n\t\t]);\n\t}\n\t/**\n\t* Override to apply the same JSON Schema fixes (additionalProperties, required fields)\n\t* that processToJSONSchema applies. The base implementation skips JSON Schema traversal,\n\t* which causes OpenAI strict mode to reject tool schemas missing additionalProperties: false.\n\t*/\n\tprocessToAISDKSchema(zodSchema) {\n\t\tconst transformedJsonSchema = standardSchemaToJSONSchema(this.processToCompatSchema(zodSchema));\n\t\treturn jsonSchema(transformedJsonSchema, { validate: (value) => {\n\t\t\tconst transformed = this.#traverse(value, transformedJsonSchema);\n\t\t\tconst result = zodSchema.safeParse(transformed);\n\t\t\treturn result.success ? {\n\t\t\t\tsuccess: true,\n\t\t\t\tvalue: result.data\n\t\t\t} : {\n\t\t\t\tsuccess: false,\n\t\t\t\terror: result.error\n\t\t\t};\n\t\t} });\n\t}\n\tprocessToCompatSchema(schema) {\n\t\tconst originalStandardSchema = toStandardSchema(schema);\n\t\treturn { \"~standard\": {\n\t\t\tversion: 1,\n\t\t\tvendor: \"mastra\",\n\t\t\tvalidate: (value) => {\n\t\t\t\tconst transformedJsonSchema = this.processToJSONSchema(schema, \"input\");\n\t\t\t\tconst transformed = this.#traverse(value, transformedJsonSchema);\n\t\t\t\treturn originalStandardSchema[\"~standard\"].validate(transformed);\n\t\t\t},\n\t\t\tjsonSchema: {\n\t\t\t\tinput: () => {\n\t\t\t\t\treturn this.processToJSONSchema(schema, \"input\");\n\t\t\t\t},\n\t\t\t\toutput: () => {\n\t\t\t\t\treturn this.processToJSONSchema(schema, \"output\");\n\t\t\t\t}\n\t\t\t}\n\t\t} };\n\t}\n\tpreProcessJSONNode(schema, _parentSchema) {\n\t\tif (isAllOfSchema(schema)) this.defaultAllOfHandler(schema);\n\t\tif (isObjectSchema(schema)) this.defaultObjectHandler(schema);\n\t\telse if (isArraySchema(schema)) this.defaultArrayHandler(schema);\n\t\telse if (isNumberSchema(schema)) this.defaultNumberHandler(schema);\n\t\telse if (isStringSchema(schema)) {\n\t\t\tif (schema.format) {\n\t\t\t\tif (!allowedStringFormats.includes(schema.format)) {\n\t\t\t\t\tdelete schema.format;\n\t\t\t\t\tdelete schema.pattern;\n\t\t\t\t}\n\t\t\t}\n\t\t\tthis.defaultStringHandler(schema);\n\t\t}\n\t}\n\tpostProcessJSONNode(schema) {\n\t\tif (isUnionSchema(schema)) this.defaultUnionHandler(schema);\n\t\tif (schema.type === void 0 && !schema.anyOf) {\n\t\t\tlet subSchema = {};\n\t\t\tfor (const key of Object.keys(schema)) {\n\t\t\t\tsubSchema[key] = schema[key];\n\t\t\t\tdelete schema[key];\n\t\t\t}\n\t\t\tschema.anyOf = [subSchema, { type: \"null\" }];\n\t\t}\n\t\tif (isObjectSchema(schema)) {\n\t\t\tschema.additionalProperties = false;\n\t\t\tif (schema.properties) for (const key of Object.keys(schema.properties)) {\n\t\t\t\tconst prop = schema.properties[key];\n\t\t\t\tif (!schema.required) schema.required = [];\n\t\t\t\tif (!schema.required?.includes(key)) {\n\t\t\t\t\tschema[\"x-optional\"] = [...schema[\"x-optional\"] || [], key];\n\t\t\t\t\tschema.required?.push(key);\n\t\t\t\t\tif (prop.type) {\n\t\t\t\t\t\tif (Array.isArray(prop.type)) {\n\t\t\t\t\t\t\tconst types = [...prop.type];\n\t\t\t\t\t\t\tif (!types.includes(\"null\")) types.push(\"null\");\n\t\t\t\t\t\t\tconst propSchema = { ...prop };\n\t\t\t\t\t\t\tdelete propSchema.anyOf;\n\t\t\t\t\t\t\tdelete propSchema.type;\n\t\t\t\t\t\t\tdelete prop.type;\n\t\t\t\t\t\t\tprop.anyOf = types.map((type) => type === \"null\" ? { type: \"null\" } : {\n\t\t\t\t\t\t\t\t...propSchema,\n\t\t\t\t\t\t\t\ttype\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t} else if (prop.type !== \"null\") {\n\t\t\t\t\t\t\tconst originalType = prop.type;\n\t\t\t\t\t\t\tconst propSchema = { ...prop };\n\t\t\t\t\t\t\tdelete propSchema.anyOf;\n\t\t\t\t\t\t\tdelete propSchema.type;\n\t\t\t\t\t\t\tdelete prop.type;\n\t\t\t\t\t\t\tprop.anyOf = [{\n\t\t\t\t\t\t\t\t...propSchema,\n\t\t\t\t\t\t\t\ttype: originalType\n\t\t\t\t\t\t\t}, { type: \"null\" }];\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\t#traverse(value, schema) {\n\t\tconst resolved = this.#resolveAnyOf(schema);\n\t\tif ((isDateFormat(resolved) || resolved[\"x-date\"] === true) && typeof value === \"string\") return new Date(value);\n\t\tif (resolved.type === \"array\" || Array.isArray(resolved.type) && resolved.type.includes(\"array\")) {\n\t\t\tif (!Array.isArray(value)) return value;\n\t\t\treturn value.map((item) => this.#traverse(item, resolved.items));\n\t\t}\n\t\tif (!(resolved.type === \"object\" || Array.isArray(resolved.type) && resolved.type.includes(\"object\"))) return value;\n\t\tconst properties = resolved.properties;\n\t\tif (!properties || !value) return value;\n\t\tconst obj = value;\n\t\tconst optionalProperties = resolved[\"x-optional\"] ?? [];\n\t\tfor (const key in obj) if (optionalProperties.includes(key) && obj[key] === null) obj[key] = void 0;\n\t\telse if (properties[key]) obj[key] = this.#traverse(obj[key], properties[key]);\n\t\treturn obj;\n\t}\n\t/**\n\t* If schema has anyOf, return the first non-null variant for traversal.\n\t* Otherwise return the schema itself.\n\t*/\n\t#resolveAnyOf(schema) {\n\t\tif (Array.isArray(schema.anyOf)) {\n\t\t\tconst nonNull = schema.anyOf.find((s) => s.type !== \"null\");\n\t\t\tif (nonNull) return nonNull;\n\t\t}\n\t\treturn schema;\n\t}\n};\nfunction isDateFormat(schema) {\n\treturn schema.format === \"date-time\" || schema.format === \"date\";\n}\n//#endregion\n//#region src/provider-compats/openai-reasoning.ts\nvar OpenAIReasoningSchemaCompatLayer = class extends OpenAISchemaCompatLayer {\n\tgetSchemaTarget() {\n\t\treturn `openApi3`;\n\t}\n\tisReasoningModel() {\n\t\tconst modelId = this.getModel().modelId;\n\t\tif (!modelId) return false;\n\t\treturn modelId.includes(`o3`) || modelId.includes(`o4`) || modelId.includes(`o1`);\n\t}\n\tshouldApply() {\n\t\tconst model = this.getModel();\n\t\tif (this.isReasoningModel() && (model.provider.includes(`openai`) || model.modelId?.includes(`openai`))) return true;\n\t\treturn false;\n\t}\n\tprocessZodType(value) {\n\t\tif (isOptional$1(z$1)(value)) {\n\t\t\tconst innerType = \"_def\" in value ? value._def.innerType : value._zod?.def?.innerType;\n\t\t\tif (innerType) {\n\t\t\t\tif (isNullable(z$1)(innerType)) return this.processZodType(innerType).transform((val) => val === null ? void 0 : val);\n\t\t\t\treturn this.processZodType(innerType).nullable().transform((val) => val === null ? void 0 : val);\n\t\t\t}\n\t\t\treturn value;\n\t\t} else if (isNullable(z$1)(value)) {\n\t\t\tconst innerType = \"_def\" in value ? value._def.innerType : value._zod?.def?.innerType;\n\t\t\tif (innerType && isOptional$1(z$1)(innerType)) {\n\t\t\t\tconst innerInnerType = \"_def\" in innerType ? innerType._def.innerType : innerType._zod?.def?.innerType;\n\t\t\t\tif (innerInnerType) return this.processZodType(innerInnerType).nullable().transform((val) => val === null ? void 0 : val);\n\t\t\t}\n\t\t\tif (innerType) return this.processZodType(innerType).nullable();\n\t\t\treturn value;\n\t\t} else if (isObj$1(z$1)(value)) return this.defaultZodObjectHandler(value, { passthrough: false });\n\t\telse if (isArr$1(z$1)(value)) return this.defaultZodArrayHandler(value);\n\t\telse if (isUnion$1(z$1)(value)) return this.defaultZodUnionHandler(value);\n\t\telse if (isDefault(z$1)(value)) {\n\t\t\tconst defaultDef = value._def;\n\t\t\tconst innerType = defaultDef.innerType;\n\t\t\tconst defaultValue = typeof defaultDef.defaultValue === \"function\" ? defaultDef.defaultValue() : defaultDef.defaultValue;\n\t\t\tconst constraints = [];\n\t\t\tif (defaultValue !== void 0) constraints.push(`the default value is ${defaultValue}`);\n\t\t\tconst description = this.mergeParameterDescription(value.description, constraints);\n\t\t\tlet result = this.processZodType(innerType);\n\t\t\tif (description) result = result.describe(description);\n\t\t\treturn result;\n\t\t} else if (isNumber$1(z$1)(value)) return this.defaultZodNumberHandler(value);\n\t\telse if (isString$1(z$1)(value)) return this.defaultZodStringHandler(value);\n\t\telse if (isDate(z$1)(value)) return this.defaultZodDateHandler(value);\n\t\telse if (isNull(z$1)(value)) return z$1.any().refine((v) => v === null, { message: \"must be null\" }).describe(value.description || \"must be null\");\n\t\telse if (value.constructor.name === \"ZodAny\") return z$1.string().describe((value.description ?? \"\") + `\\nArgument was an \"any\" type, but you (the LLM) do not support \"any\", so it was cast to a \"string\" type`);\n\t\tif (isIntersection(z$1)(value)) return this.defaultZodIntersectionHandler(value);\n\t\treturn this.defaultUnsupportedZodTypeHandler(value);\n\t}\n};\n//#endregion\n//#region src/standard-schema-compat.ts\n/**\n* Standard Schema compatibility utilities\n*\n* This module provides utilities to apply provider-specific schema transformations\n* to StandardSchemaWithJSON types, particularly for OpenAI compatibility.\n*/\n/**\n* Extracts the underlying Zod schema from a schema value.\n*\n* Handles both:\n* - Raw Zod schemas (z.object(...))\n* - StandardSchemaWithJSON wrappers that preserve Zod methods via prototype\n*\n* @param schema - The schema to extract from\n* @returns The underlying Zod schema, or null if not a Zod schema\n*/\nfunction extractZodSchema(schema) {\n\tif (!isZodType(schema)) return null;\n\treturn schema;\n}\n/**\n* Applies OpenAI schema compatibility transforms to a schema.\n*\n* For OpenAI models, converts `.optional()` fields to `.nullable().transform()`\n* to work around OpenAI's limitation with optional fields in structured outputs.\n*\n* @param schema - The schema to process (raw Zod or StandardSchemaWithJSON)\n* @param modelInfo - Information about the target model\n* @returns The processed schema as StandardSchemaWithJSON, or original if not applicable\n*\n* @example\n* ```typescript\n* const schema = z.object({\n* name: z.string(),\n* age: z.number().optional(), // Will be converted to .nullable().transform()\n* });\n*\n* const processed = applyOpenAICompatTransforms(schema, {\n* provider: 'openai',\n* modelId: 'gpt-4',\n* supportsStructuredOutputs: false,\n* });\n* ```\n*/\nfunction applyOpenAICompatTransforms(schema, modelInfo) {\n\tif (!(modelInfo.provider?.includes(\"openai\") || modelInfo.modelId?.includes(\"openai\"))) return schema;\n\tconst zodSchema = extractZodSchema(schema);\n\tif (!zodSchema) return schema;\n\tconst compatLayer = /^o[1-5]/.test(modelInfo.modelId) ? new OpenAIReasoningSchemaCompatLayer(modelInfo) : new OpenAISchemaCompatLayer(modelInfo);\n\tif (!compatLayer.shouldApply()) return schema;\n\treturn toStandardSchema(compatLayer.processZodType(zodSchema));\n}\n/**\n* Applies OpenAI compat transforms to all tools in a toolset.\n*\n* Processes each tool's inputSchema (if present) with OpenAI compatibility transforms.\n*\n* @param tools - The toolset to process\n* @param modelInfo - Information about the target model\n* @returns The processed toolset with transformed schemas\n*\n* @example\n* ```typescript\n* const tools = {\n* getTodo: {\n* inputSchema: z.object({\n* id: z.string(),\n* includeCompleted: z.boolean().optional(), // Will be transformed\n* }),\n* execute: async (input) => { ... },\n* },\n* };\n*\n* const processed = applyOpenAICompatToTools(tools, {\n* provider: 'openai',\n* modelId: 'gpt-4',\n* supportsStructuredOutputs: false,\n* });\n* ```\n*/\nfunction applyOpenAICompatToTools(tools, modelInfo) {\n\tif (!tools) return tools;\n\tconst transformedTools = {};\n\tfor (const [name, tool] of Object.entries(tools)) if (tool.inputSchema) {\n\t\tconst processedSchema = applyOpenAICompatTransforms(tool.inputSchema, modelInfo);\n\t\ttransformedTools[name] = {\n\t\t\t...tool,\n\t\t\tinputSchema: processedSchema\n\t\t};\n\t} else transformedTools[name] = tool;\n\treturn transformedTools;\n}\n//#endregion\n//#region src/provider-compats/anthropic.ts\nvar AnthropicSchemaCompatLayer = class extends SchemaCompatLayer {\n\tconstructor(model) {\n\t\tsuper(model);\n\t}\n\tgetSchemaTarget() {\n\t\treturn \"jsonSchema7\";\n\t}\n\tprocessToJSONSchema(schema, io = \"input\") {\n\t\tconst jsonSchema = super.processToJSONSchema(schema, io);\n\t\tconst union = jsonSchema.anyOf ?? jsonSchema.oneOf;\n\t\tif (io !== \"input\" || !Array.isArray(union)) return jsonSchema;\n\t\tconst objectSchemas = union.filter((subSchema) => typeof subSchema === \"object\" && subSchema !== null && subSchema.type === \"object\");\n\t\tif (objectSchemas.length === 0 || objectSchemas.length !== union.length) return jsonSchema;\n\t\tdelete jsonSchema.anyOf;\n\t\tdelete jsonSchema.oneOf;\n\t\tjsonSchema.type = \"object\";\n\t\tconst mergedProperties = {};\n\t\tfor (const subSchema of objectSchemas) for (const [key, propSchema] of Object.entries(subSchema.properties ?? {})) {\n\t\t\tconst variants = mergedProperties[key] ??= [];\n\t\t\tif (!variants.some((existing) => JSON.stringify(existing) === JSON.stringify(propSchema))) variants.push(propSchema);\n\t\t}\n\t\tjsonSchema.properties = Object.fromEntries(Object.entries(mergedProperties).map(([key, variants]) => [key, variants.length === 1 ? variants[0] : { anyOf: variants }]));\n\t\tjsonSchema.required = objectSchemas.map((subSchema) => subSchema.required ?? []).reduce((required, branchRequired) => required.filter((key) => branchRequired.includes(key)));\n\t\tjsonSchema.additionalProperties = false;\n\t\treturn jsonSchema;\n\t}\n\tshouldApply() {\n\t\treturn this.getModel().modelId.includes(\"claude\");\n\t}\n\tprocessZodType(value) {\n\t\tif (this.isOptional(value)) {\n\t\t\tconst handleTypes = [\n\t\t\t\t\"ZodObject\",\n\t\t\t\t\"ZodArray\",\n\t\t\t\t\"ZodUnion\",\n\t\t\t\t\"ZodNever\",\n\t\t\t\t\"ZodUndefined\",\n\t\t\t\t\"ZodTuple\"\n\t\t\t];\n\t\t\tif (this.getModel().modelId.includes(\"claude-3.5-haiku\")) handleTypes.push(\"ZodString\");\n\t\t\treturn this.defaultZodOptionalHandler(value, handleTypes);\n\t\t} else if (this.isObj(value)) return this.defaultZodObjectHandler(value);\n\t\telse if (this.isArr(value)) return this.defaultZodArrayHandler(value, []);\n\t\telse if (this.isUnion(value)) return this.defaultZodUnionHandler(value);\n\t\telse if (this.isString(value)) if (this.getModel().modelId.includes(\"claude-3.5-haiku\")) return this.defaultZodStringHandler(value, [\"max\", \"min\"]);\n\t\telse return value;\n\t\telse if (isNull(z$1)(value)) return z$1.any().refine((v) => v === null, { message: \"must be null\" }).describe(value.description || \"must be null\");\n\t\telse if (isIntersection(z$1)(value)) return this.defaultZodIntersectionHandler(value);\n\t\treturn this.defaultUnsupportedZodTypeHandler(value);\n\t}\n\tprocessToAISDKSchema(zodSchema) {\n\t\tconst transformedJsonSchema = standardSchemaToJSONSchema(this.processToCompatSchema(zodSchema));\n\t\treturn jsonSchema(transformedJsonSchema, { validate: (value) => {\n\t\t\tconst transformed = this.#traverse(value, transformedJsonSchema);\n\t\t\tconst result = zodSchema.safeParse(transformed);\n\t\t\treturn result.success ? {\n\t\t\t\tsuccess: true,\n\t\t\t\tvalue: result.data\n\t\t\t} : {\n\t\t\t\tsuccess: false,\n\t\t\t\terror: result.error\n\t\t\t};\n\t\t} });\n\t}\n\tprocessToCompatSchema(schema) {\n\t\tconst originalStandardSchema = toStandardSchema(schema);\n\t\treturn { \"~standard\": {\n\t\t\tversion: 1,\n\t\t\tvendor: \"mastra\",\n\t\t\tvalidate: (value) => {\n\t\t\t\tconst transformedJsonSchema = this.processToJSONSchema(schema, \"input\");\n\t\t\t\tconst transformed = this.#traverse(value, transformedJsonSchema);\n\t\t\t\treturn originalStandardSchema[\"~standard\"].validate(transformed);\n\t\t\t},\n\t\t\tjsonSchema: {\n\t\t\t\tinput: () => {\n\t\t\t\t\treturn this.processToJSONSchema(schema, \"input\");\n\t\t\t\t},\n\t\t\t\toutput: () => {\n\t\t\t\t\treturn this.processToJSONSchema(schema, \"output\");\n\t\t\t\t}\n\t\t\t}\n\t\t} };\n\t}\n\tpreProcessJSONNode(schema) {\n\t\tif (isAllOfSchema(schema)) this.defaultAllOfHandler(schema);\n\t\tif (isObjectSchema(schema)) this.defaultObjectHandler(schema);\n\t\telse if (isArraySchema(schema)) this.defaultArrayHandler(schema);\n\t\telse if (isNumberSchema(schema)) this.defaultNumberHandler(schema);\n\t\telse if (isStringSchema(schema)) this.defaultStringHandler(schema);\n\t}\n\tpostProcessJSONNode(schema) {\n\t\tif (isUnionSchema(schema)) this.defaultUnionHandler(schema);\n\t}\n\t#traverse(value, schema) {\n\t\tconst resolved = this.#resolveSchemaForValue(schema, value);\n\t\tif (resolved[\"x-date\"] === true && typeof value === \"string\") return new Date(value);\n\t\tif (resolved.type === \"array\" || Array.isArray(resolved.type) && resolved.type.includes(\"array\")) {\n\t\t\tif (!Array.isArray(value)) return value;\n\t\t\treturn value.map((item) => this.#traverse(item, resolved.items));\n\t\t}\n\t\tif (!(resolved.type === \"object\" || Array.isArray(resolved.type) && resolved.type.includes(\"object\"))) return value;\n\t\tconst properties = resolved.properties;\n\t\tif (!properties || !value) return value;\n\t\tconst obj = value;\n\t\tfor (const key in obj) if (properties[key]) obj[key] = this.#traverse(obj[key], properties[key]);\n\t\treturn obj;\n\t}\n\t#resolveSchemaForValue(schema, value) {\n\t\tif (!Array.isArray(schema.anyOf)) return schema;\n\t\tconst variants = schema.anyOf;\n\t\tconst nonNullVariants = variants.filter((variant) => variant.type !== \"null\");\n\t\tif (variants.length === 2 && nonNullVariants.length === 1) return nonNullVariants[0];\n\t\tconst keys = value && typeof value === \"object\" ? Object.keys(value) : [];\n\t\treturn nonNullVariants.find((variant) => {\n\t\t\tconst properties = variant.properties;\n\t\t\treturn !!properties && keys.some((key) => key in properties);\n\t\t}) ?? schema;\n\t}\n};\n//#endregion\n//#region src/provider-compats/deepseek.ts\nvar DeepSeekSchemaCompatLayer = class extends SchemaCompatLayer {\n\tconstructor(model) {\n\t\tsuper(model);\n\t}\n\tgetSchemaTarget() {\n\t\treturn \"jsonSchema7\";\n\t}\n\tshouldApply() {\n\t\treturn this.getModel().modelId.includes(\"deepseek\") && !this.getModel().modelId.includes(\"r1\");\n\t}\n\tprocessZodType(value) {\n\t\tif (isOptional$1(z$1)(value)) return this.defaultZodOptionalHandler(value, [\n\t\t\t\"ZodObject\",\n\t\t\t\"ZodArray\",\n\t\t\t\"ZodUnion\",\n\t\t\t\"ZodString\",\n\t\t\t\"ZodNumber\"\n\t\t]);\n\t\telse if (isObj$1(z$1)(value)) return this.defaultZodObjectHandler(value);\n\t\telse if (isArr$1(z$1)(value)) return this.defaultZodArrayHandler(value, [\"min\", \"max\"]);\n\t\telse if (isUnion$1(z$1)(value)) return this.defaultZodUnionHandler(value);\n\t\telse if (isString$1(z$1)(value)) return this.defaultZodStringHandler(value);\n\t\telse if (isIntersection(z$1)(value)) return this.defaultZodIntersectionHandler(value);\n\t\treturn value;\n\t}\n\tprocessToAISDKSchema(zodSchema) {\n\t\tconst transformedJsonSchema = standardSchemaToJSONSchema(this.processToCompatSchema(zodSchema));\n\t\treturn jsonSchema(transformedJsonSchema, { validate: (value) => {\n\t\t\tconst transformed = this.#traverse(value, transformedJsonSchema);\n\t\t\tconst result = zodSchema.safeParse(transformed);\n\t\t\treturn result.success ? {\n\t\t\t\tsuccess: true,\n\t\t\t\tvalue: result.data\n\t\t\t} : {\n\t\t\t\tsuccess: false,\n\t\t\t\terror: result.error\n\t\t\t};\n\t\t} });\n\t}\n\tprocessToCompatSchema(schema) {\n\t\tconst originalStandardSchema = toStandardSchema(schema);\n\t\treturn { \"~standard\": {\n\t\t\tversion: 1,\n\t\t\tvendor: \"mastra\",\n\t\t\tvalidate: (value) => {\n\t\t\t\tconst transformedJsonSchema = this.processToJSONSchema(schema, \"input\");\n\t\t\t\tconst transformed = this.#traverse(value, transformedJsonSchema);\n\t\t\t\treturn originalStandardSchema[\"~standard\"].validate(transformed);\n\t\t\t},\n\t\t\tjsonSchema: {\n\t\t\t\tinput: () => {\n\t\t\t\t\treturn this.processToJSONSchema(schema, \"input\");\n\t\t\t\t},\n\t\t\t\toutput: () => {\n\t\t\t\t\treturn this.processToJSONSchema(schema, \"output\");\n\t\t\t\t}\n\t\t\t}\n\t\t} };\n\t}\n\tpreProcessJSONNode(schema) {\n\t\tif (isAllOfSchema(schema)) this.defaultAllOfHandler(schema);\n\t\tif (isObjectSchema(schema)) this.defaultObjectHandler(schema);\n\t\telse if (isArraySchema(schema)) this.defaultArrayHandler(schema);\n\t\telse if (isNumberSchema(schema)) this.defaultNumberHandler(schema);\n\t\telse if (isStringSchema(schema)) this.defaultStringHandler(schema);\n\t}\n\tpostProcessJSONNode(schema) {\n\t\tif (isUnionSchema(schema)) this.defaultUnionHandler(schema);\n\t}\n\t#traverse(value, schema) {\n\t\tconst resolved = this.#resolveAnyOf(schema);\n\t\tif (resolved[\"x-date\"] === true && typeof value === \"string\") return new Date(value);\n\t\tif (resolved.type === \"array\" || Array.isArray(resolved.type) && resolved.type.includes(\"array\")) {\n\t\t\tif (!Array.isArray(value)) return value;\n\t\t\treturn value.map((item) => this.#traverse(item, resolved.items));\n\t\t}\n\t\tif (!(resolved.type === \"object\" || Array.isArray(resolved.type) && resolved.type.includes(\"object\"))) return value;\n\t\tconst properties = resolved.properties;\n\t\tif (!properties || !value) return value;\n\t\tconst obj = value;\n\t\tfor (const key in obj) if (properties[key]) obj[key] = this.#traverse(obj[key], properties[key]);\n\t\treturn obj;\n\t}\n\t#resolveAnyOf(schema) {\n\t\tif (Array.isArray(schema.anyOf)) {\n\t\t\tconst nonNull = schema.anyOf.find((s) => s.type !== \"null\");\n\t\t\tif (nonNull) return nonNull;\n\t\t}\n\t\treturn schema;\n\t}\n};\n//#endregion\n//#region src/provider-compats/google.ts\nfunction fixAISDKNullableUnionTypes(schema) {\n\tif (typeof schema !== \"object\" || schema === null) return schema;\n\tconst result = { ...schema };\n\tif (Array.isArray(result.type)) {\n\t\tconst nonNullTypes = result.type.filter((t) => t !== \"null\");\n\t\tif (nonNullTypes.length === 1) {\n\t\t\tresult.type = nonNullTypes[0];\n\t\t\tresult.nullable = true;\n\t\t} else {\n\t\t\tdelete result.type;\n\t\t\tdelete result.nullable;\n\t\t}\n\t}\n\tif (Array.isArray(result.enum) && result.enum.some((value) => typeof value !== \"string\")) delete result.enum;\n\tif (\"const\" in result && typeof result.const !== \"string\") delete result.const;\n\tif (result.anyOf && Array.isArray(result.anyOf)) {\n\t\tconst nullSchema = result.anyOf.find((s) => typeof s === \"object\" && s !== null && s.type === \"null\");\n\t\tconst nonNullSchemas = result.anyOf.filter((s) => !(typeof s === \"object\" && s !== null && s.type === \"null\"));\n\t\tif (nullSchema) {\n\t\t\tconst { anyOf: _, ...rest } = result;\n\t\t\tif (nonNullSchemas.length === 1 && typeof nonNullSchemas[0] === \"object\" && nonNullSchemas[0] !== null) {\n\t\t\t\tconst fixedOther = fixAISDKNullableUnionTypes(nonNullSchemas[0]);\n\t\t\t\treturn fixedOther.type ? {\n\t\t\t\t\t...rest,\n\t\t\t\t\t...fixedOther,\n\t\t\t\t\tnullable: true\n\t\t\t\t} : {\n\t\t\t\t\t...rest,\n\t\t\t\t\t...fixedOther\n\t\t\t\t};\n\t\t\t}\n\t\t\treturn rest;\n\t\t}\n\t}\n\tif (result.properties && typeof result.properties === \"object\") result.properties = Object.fromEntries(Object.entries(result.properties).map(([key, value]) => [key, fixAISDKNullableUnionTypes(value)]));\n\tif (result.items) if (Array.isArray(result.items)) result.items = result.items.map((item) => fixAISDKNullableUnionTypes(item));\n\telse result.items = fixAISDKNullableUnionTypes(result.items);\n\tif (result.additionalProperties && typeof result.additionalProperties === \"object\") result.additionalProperties = fixAISDKNullableUnionTypes(result.additionalProperties);\n\tif (result.anyOf && Array.isArray(result.anyOf)) result.anyOf = result.anyOf.map((s) => fixAISDKNullableUnionTypes(s));\n\tif (result.oneOf && Array.isArray(result.oneOf)) result.oneOf = result.oneOf.map((s) => fixAISDKNullableUnionTypes(s));\n\tif (result.allOf && Array.isArray(result.allOf)) result.allOf = result.allOf.map((s) => fixAISDKNullableUnionTypes(s));\n\tif (result.anyOf && Array.isArray(result.anyOf)) {\n\t\tif (result.description) {\n\t\t\tfor (const item of result.anyOf) if (typeof item === \"object\" && item !== null && !item.description) item.description = result.description;\n\t\t}\n\t\treturn { anyOf: result.anyOf };\n\t}\n\treturn result;\n}\n/**\n* Inline `$ref` pointers one level and drop `definitions`/`$defs`.\n* Gemini can't follow JSON Schema `$ref`s — they cause silent mis-fills.\n* Self-references (recursive schemas) are collapsed to `{ type: 'object' }`\n* to avoid infinite expansion.\n*/\nfunction inlineRefsAndDropDefinitions(schema) {\n\tconst json = JSON.stringify(schema);\n\tif (!json.includes(\"\\\"$ref\\\"\")) return;\n\tconst defs = schema[\"definitions\"] ?? schema[\"$defs\"];\n\tconst snapshot = JSON.parse(json);\n\tresolveRefs(schema, snapshot, snapshot[\"definitions\"] ?? snapshot[\"$defs\"] ?? defs ?? {}, /* @__PURE__ */ new Set());\n\tdelete schema[\"definitions\"];\n\tdelete schema[\"$defs\"];\n}\nfunction resolveRefs(node, rootSnapshot, defs, visiting) {\n\tif (typeof node !== \"object\" || node === null) return;\n\tfor (const [key, value] of Object.entries(node)) if (key === \"$ref\" && typeof value === \"string\") {\n\t\tconst resolved = resolveRef(value, rootSnapshot, defs);\n\t\tif (!resolved || visiting.has(value)) {\n\t\t\tdelete node[\"$ref\"];\n\t\t\tnode[\"type\"] = \"object\";\n\t\t} else {\n\t\t\tdelete node[\"$ref\"];\n\t\t\tvisiting.add(value);\n\t\t\tconst clone = JSON.parse(JSON.stringify(resolved));\n\t\t\tresolveRefs(clone, rootSnapshot, defs, visiting);\n\t\t\tvisiting.delete(value);\n\t\t\tObject.assign(node, clone);\n\t\t}\n\t} else if (Array.isArray(value)) {\n\t\tfor (const item of value) if (typeof item === \"object\" && item !== null) resolveRefs(item, rootSnapshot, defs, visiting);\n\t} else if (typeof value === \"object\" && value !== null) resolveRefs(value, rootSnapshot, defs, visiting);\n}\nfunction resolveRef(ref, rootSnapshot, defs) {\n\tif (ref === \"#\") return rootSnapshot;\n\tconst match = ref.match(/^#\\/(?:definitions|\\$defs)\\/(.+)$/);\n\tif (match) return defs[match[1]];\n}\nvar GoogleSchemaCompatLayer = class extends SchemaCompatLayer {\n\tconstructor(model) {\n\t\tsuper(model);\n\t}\n\tgetSchemaTarget() {\n\t\treturn \"jsonSchema7\";\n\t}\n\tshouldApply() {\n\t\treturn this.getModel().provider.includes(\"google\") || this.getModel().modelId.includes(\"gemini-\") || this.getModel().modelId.includes(\"google\");\n\t}\n\tprocessZodType(value) {\n\t\tif (isOptional$1(z$1)(value)) return this.defaultZodOptionalHandler(value, [\n\t\t\t\"ZodObject\",\n\t\t\t\"ZodArray\",\n\t\t\t\"ZodUnion\",\n\t\t\t\"ZodString\",\n\t\t\t\"ZodNumber\",\n\t\t\t\"ZodNullable\"\n\t\t]);\n\t\telse if (isNullable(z$1)(value)) return this.defaultZodNullableHandler(value);\n\t\telse if (isNull(z$1)(value)) return z$1.any().refine((v) => v === null, { message: \"must be null\" }).describe(value.description || \"must be null\");\n\t\telse if (isObj$1(z$1)(value)) return this.defaultZodObjectHandler(value);\n\t\telse if (isArr$1(z$1)(value)) return this.defaultZodArrayHandler(value, []);\n\t\telse if (isUnion$1(z$1)(value)) return this.defaultZodUnionHandler(value);\n\t\telse if (isString$1(z$1)(value)) return this.defaultZodStringHandler(value);\n\t\telse if (isNumber$1(z$1)(value)) return this.defaultZodNumberHandler(value);\n\t\telse if (isIntersection(z$1)(value)) return this.defaultZodIntersectionHandler(value);\n\t\treturn this.defaultUnsupportedZodTypeHandler(value);\n\t}\n\tprocessToJSONSchema(schema, io) {\n\t\tconst result = super.processToJSONSchema(schema, io);\n\t\tinlineRefsAndDropDefinitions(result);\n\t\treturn result;\n\t}\n\tprocessToAISDKSchema(zodSchema) {\n\t\tconst fixedJsonSchema = fixAISDKNullableUnionTypes(standardSchemaToJSONSchema(this.processToCompatSchema(zodSchema)));\n\t\treturn jsonSchema(fixedJsonSchema, { validate: (value) => {\n\t\t\tconst transformed = this.#traverse(value, fixedJsonSchema);\n\t\t\tconst result = zodSchema.safeParse(transformed);\n\t\t\treturn result.success ? {\n\t\t\t\tsuccess: true,\n\t\t\t\tvalue: result.data\n\t\t\t} : {\n\t\t\t\tsuccess: false,\n\t\t\t\terror: result.error\n\t\t\t};\n\t\t} });\n\t}\n\tprocessToCompatSchema(schema) {\n\t\tconst originalStandardSchema = toStandardSchema(schema);\n\t\treturn { \"~standard\": {\n\t\t\tversion: 1,\n\t\t\tvendor: \"mastra\",\n\t\t\tvalidate: (value) => {\n\t\t\t\tconst transformedJsonSchema = this.processToJSONSchema(schema, \"input\");\n\t\t\t\tconst transformed = this.#traverse(value, transformedJsonSchema);\n\t\t\t\treturn originalStandardSchema[\"~standard\"].validate(transformed);\n\t\t\t},\n\t\t\tjsonSchema: {\n\t\t\t\tinput: () => {\n\t\t\t\t\treturn this.processToJSONSchema(schema, \"input\");\n\t\t\t\t},\n\t\t\t\toutput: () => {\n\t\t\t\t\treturn this.processToJSONSchema(schema, \"output\");\n\t\t\t\t}\n\t\t\t}\n\t\t} };\n\t}\n\tpreProcessJSONNode(schema) {\n\t\tif (isAllOfSchema(schema)) this.defaultAllOfHandler(schema);\n\t\tif (isObjectSchema(schema)) this.defaultObjectHandler(schema);\n\t\telse if (isNumberSchema(schema)) this.defaultNumberHandler(schema);\n\t\telse if (isArraySchema(schema)) this.defaultArrayHandler(schema);\n\t\telse if (isStringSchema(schema)) this.defaultStringHandler(schema);\n\t}\n\tpostProcessJSONNode(schema) {\n\t\tif (isUnionSchema(schema)) this.defaultUnionHandler(schema);\n\t\tconst s = schema;\n\t\tdelete s[\"$schema\"];\n\t\tdelete s[\"additionalProperties\"];\n\t\tdelete s[\"propertyNames\"];\n\t\tif (Array.isArray(s[\"type\"])) {\n\t\t\tconst types = s[\"type\"];\n\t\t\tconst nonNull = types.filter((t) => t !== \"null\");\n\t\t\tconst hasNull = types.includes(\"null\");\n\t\t\tif (nonNull.length === 1) {\n\t\t\t\ts[\"type\"] = nonNull[0];\n\t\t\t\tif (hasNull) s[\"nullable\"] = true;\n\t\t\t} else if (nonNull.length === 0 && hasNull) {\n\t\t\t\ts[\"type\"] = \"object\";\n\t\t\t\ts[\"nullable\"] = true;\n\t\t\t} else {\n\t\t\t\tdelete s[\"type\"];\n\t\t\t\tdelete s[\"nullable\"];\n\t\t\t}\n\t\t}\n\t\tif (Array.isArray(s[\"oneOf\"])) {\n\t\t\ts[\"anyOf\"] = s[\"oneOf\"];\n\t\t\tdelete s[\"oneOf\"];\n\t\t}\n\t\tif (\"const\" in s) {\n\t\t\ts[\"enum\"] = [s[\"const\"]];\n\t\t\tdelete s[\"const\"];\n\t\t}\n\t\tif (Array.isArray(s[\"items\"])) {\n\t\t\ts[\"items\"] = { anyOf: s[\"items\"] };\n\t\t\tdelete s[\"minItems\"];\n\t\t\tdelete s[\"maxItems\"];\n\t\t}\n\t\tif (Array.isArray(s[\"anyOf\"])) {\n\t\t\tconst variants = s[\"anyOf\"];\n\t\t\tconst nonNull = variants.filter((v) => v && typeof v === \"object\" && v[\"type\"] !== \"null\");\n\t\t\tconst hasNull = variants.some((v) => v && typeof v === \"object\" && v[\"type\"] === \"null\");\n\t\t\tif (hasNull && nonNull.length === 1) {\n\t\t\t\tconst base = nonNull[0];\n\t\t\t\tdelete s[\"anyOf\"];\n\t\t\t\tObject.assign(s, base);\n\t\t\t\ts[\"nullable\"] = true;\n\t\t\t} else if (hasNull && nonNull.length > 1) {\n\t\t\t\ts[\"anyOf\"] = nonNull;\n\t\t\t\ts[\"nullable\"] = true;\n\t\t\t}\n\t\t}\n\t}\n\t#traverse(value, schema) {\n\t\tconst resolved = this.#resolveAnyOf(schema);\n\t\tif (resolved[\"x-date\"] === true && typeof value === \"string\") return new Date(value);\n\t\tif (resolved.type === \"array\" || Array.isArray(resolved.type) && resolved.type.includes(\"array\")) {\n\t\t\tif (!Array.isArray(value)) return value;\n\t\t\treturn value.map((item) => this.#traverse(item, resolved.items));\n\t\t}\n\t\tif (!(resolved.type === \"object\" || Array.isArray(resolved.type) && resolved.type.includes(\"object\"))) return value;\n\t\tconst properties = resolved.properties;\n\t\tif (!properties || !value) return value;\n\t\tconst obj = value;\n\t\tfor (const key in obj) if (properties[key]) obj[key] = this.#traverse(obj[key], properties[key]);\n\t\treturn obj;\n\t}\n\t#resolveAnyOf(schema) {\n\t\tif (Array.isArray(schema.anyOf)) {\n\t\t\tconst nonNull = schema.anyOf.find((s) => s.type !== \"null\");\n\t\t\tif (nonNull) return nonNull;\n\t\t}\n\t\treturn schema;\n\t}\n};\n//#endregion\n//#region src/provider-compats/meta.ts\nvar MetaSchemaCompatLayer = class extends SchemaCompatLayer {\n\tconstructor(model) {\n\t\tsuper(model);\n\t}\n\tgetSchemaTarget() {\n\t\treturn \"jsonSchema7\";\n\t}\n\tshouldApply() {\n\t\treturn this.getModel().modelId.includes(\"meta\");\n\t}\n\tprocessZodType(value) {\n\t\tif (isOptional$1(z$1)(value)) return this.defaultZodOptionalHandler(value, [\n\t\t\t\"ZodObject\",\n\t\t\t\"ZodArray\",\n\t\t\t\"ZodUnion\",\n\t\t\t\"ZodString\",\n\t\t\t\"ZodNumber\"\n\t\t]);\n\t\telse if (isObj$1(z$1)(value)) return this.defaultZodObjectHandler(value);\n\t\telse if (isArr$1(z$1)(value)) return this.defaultZodArrayHandler(value, [\"min\", \"max\"]);\n\t\telse if (isUnion$1(z$1)(value)) return this.defaultZodUnionHandler(value);\n\t\telse if (isNumber$1(z$1)(value)) return this.defaultZodNumberHandler(value);\n\t\telse if (isString$1(z$1)(value)) return this.defaultZodStringHandler(value);\n\t\telse if (isIntersection(z$1)(value)) return this.defaultZodIntersectionHandler(value);\n\t\treturn value;\n\t}\n\tprocessToAISDKSchema(zodSchema) {\n\t\tconst transformedJsonSchema = standardSchemaToJSONSchema(this.processToCompatSchema(zodSchema));\n\t\treturn jsonSchema(transformedJsonSchema, { validate: (value) => {\n\t\t\tconst transformed = this.#traverse(value, transformedJsonSchema);\n\t\t\tconst result = zodSchema.safeParse(transformed);\n\t\t\treturn result.success ? {\n\t\t\t\tsuccess: true,\n\t\t\t\tvalue: result.data\n\t\t\t} : {\n\t\t\t\tsuccess: false,\n\t\t\t\terror: result.error\n\t\t\t};\n\t\t} });\n\t}\n\tprocessToCompatSchema(schema) {\n\t\tconst originalStandardSchema = toStandardSchema(schema);\n\t\treturn { \"~standard\": {\n\t\t\tversion: 1,\n\t\t\tvendor: \"mastra\",\n\t\t\tvalidate: (value) => {\n\t\t\t\tconst transformedJsonSchema = this.processToJSONSchema(schema, \"input\");\n\t\t\t\tconst transformed = this.#traverse(value, transformedJsonSchema);\n\t\t\t\treturn originalStandardSchema[\"~standard\"].validate(transformed);\n\t\t\t},\n\t\t\tjsonSchema: {\n\t\t\t\tinput: () => {\n\t\t\t\t\treturn this.processToJSONSchema(schema, \"input\");\n\t\t\t\t},\n\t\t\t\toutput: () => {\n\t\t\t\t\treturn this.processToJSONSchema(schema, \"output\");\n\t\t\t\t}\n\t\t\t}\n\t\t} };\n\t}\n\tpreProcessJSONNode(schema) {\n\t\tif (isAllOfSchema(schema)) this.defaultAllOfHandler(schema);\n\t\tif (isObjectSchema(schema)) this.defaultObjectHandler(schema);\n\t\telse if (isArraySchema(schema)) this.defaultArrayHandler(schema);\n\t\telse if (isNumberSchema(schema)) this.defaultNumberHandler(schema);\n\t\telse if (isStringSchema(schema)) this.defaultStringHandler(schema);\n\t}\n\tpostProcessJSONNode(schema) {\n\t\tif (isUnionSchema(schema)) this.defaultUnionHandler(schema);\n\t}\n\t#traverse(value, schema) {\n\t\tconst resolved = this.#resolveAnyOf(schema);\n\t\tif (resolved[\"x-date\"] === true && typeof value === \"string\") return new Date(value);\n\t\tif (resolved.type === \"array\" || Array.isArray(resolved.type) && resolved.type.includes(\"array\")) {\n\t\t\tif (!Array.isArray(value)) return value;\n\t\t\treturn value.map((item) => this.#traverse(item, resolved.items));\n\t\t}\n\t\tif (!(resolved.type === \"object\" || Array.isArray(resolved.type) && resolved.type.includes(\"object\"))) return value;\n\t\tconst properties = resolved.properties;\n\t\tif (!properties || !value) return value;\n\t\tconst obj = value;\n\t\tfor (const key in obj) if (properties[key]) obj[key] = this.#traverse(obj[key], properties[key]);\n\t\treturn obj;\n\t}\n\t#resolveAnyOf(schema) {\n\t\tif (Array.isArray(schema.anyOf)) {\n\t\t\tconst nonNull = schema.anyOf.find((s) => s.type !== \"null\");\n\t\t\tif (nonNull) return nonNull;\n\t\t}\n\t\treturn schema;\n\t}\n};\n//#endregion\nexport { ALL_ARRAY_CHECKS, ALL_NUMBER_CHECKS, ALL_STRING_CHECKS, ALL_ZOD_TYPES, AnthropicSchemaCompatLayer, DeepSeekSchemaCompatLayer, GoogleSchemaCompatLayer, JSON_SCHEMA_LIBRARY_OPTIONS, MetaSchemaCompatLayer, OpenAIReasoningSchemaCompatLayer, OpenAISchemaCompatLayer, SUPPORTED_ZOD_TYPES, SchemaCompatLayer, SchemaCompatLayer$1 as SchemaCompatLayerV3, SchemaCompatLayer$2 as SchemaCompatLayerV4, UNSUPPORTED_ZOD_TYPES, applyCompatLayer, applyOpenAICompatToTools, applyOpenAICompatTransforms, convertSchemaToZod, convertZodSchemaToAISDKSchema, ensureAllPropertiesRequired, extractZodSchema, isArr, isNumber, isObj, isOptional, isStandardJSONSchema, isStandardSchema, isStandardSchemaWithJSON, isString, isUnion, isZodType, jsonSchema, prepareJsonSchemaForOpenAIStrictMode, standardSchemaToJSONSchema, toStandardSchema, wrapSchemaWithNullTransform };\n\n//# sourceMappingURL=index.js.map","import type { PublicSchema } from '@mastra/core/schema';\nimport { toStandardSchema } from '@mastra/core/schema';\nimport type { ApiRoute } from '@mastra/core/server';\nimport { zodToJsonSchema } from '@mastra/core/utils/zod-to-json';\nimport { standardSchemaToJSONSchema } from '@mastra/schema-compat';\nimport type { JSONSchema7 } from '@mastra/schema-compat';\nimport type { ServerRoute } from './routes';\n\ninterface RouteOpenAPIConfig {\n method: 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH';\n path: string;\n summary?: string;\n description?: string;\n tags?: string[];\n pathParamSchema?: PublicSchema<unknown>;\n queryParamSchema?: PublicSchema<unknown>;\n bodySchema?: PublicSchema<unknown>;\n responseSchema?: PublicSchema<unknown>;\n deprecated?: boolean;\n}\n\nexport interface OpenAPIRoute {\n summary?: string;\n description?: string;\n tags?: string[];\n deprecated?: boolean;\n requestParams?: {\n path?: PublicSchema<unknown>;\n query?: PublicSchema<unknown>;\n };\n requestBody?: {\n content: {\n 'application/json': {\n schema: PublicSchema<unknown>;\n };\n };\n };\n responses: {\n [statusCode: string]: {\n description: string;\n content?: {\n 'application/json': {\n schema: PublicSchema<unknown>;\n };\n };\n };\n };\n}\n\n/**\n * Generates OpenAPI specification for a single route\n * Extracts path parameters, query parameters, request body, and response schemas\n */\nexport function generateRouteOpenAPI({\n method,\n path,\n summary,\n description,\n tags = [],\n pathParamSchema,\n queryParamSchema,\n bodySchema,\n responseSchema,\n deprecated,\n}: RouteOpenAPIConfig): OpenAPIRoute {\n const route: OpenAPIRoute = {\n summary: summary || `${method} ${path}`,\n description,\n tags,\n deprecated,\n responses: {\n 200: {\n description: 'Successful response',\n },\n },\n };\n\n // Add path and query parameters\n if (pathParamSchema || queryParamSchema) {\n route.requestParams = {};\n\n if (pathParamSchema) {\n route.requestParams.path = pathParamSchema;\n }\n\n if (queryParamSchema) {\n route.requestParams.query = queryParamSchema;\n }\n }\n\n // Add request body with raw Zod schema\n if (bodySchema) {\n route.requestBody = {\n content: {\n 'application/json': {\n schema: bodySchema,\n },\n },\n };\n }\n\n // Add response schema with raw Zod schema\n if (responseSchema) {\n route.responses[200] = {\n description: 'Successful response',\n content: {\n 'application/json': {\n schema: responseSchema,\n },\n },\n };\n }\n\n return route;\n}\n\n/**\n * Helper to convert any PublicSchema to JSON Schema for OpenAPI\n */\nexport function schemaToJsonSchema(schema: PublicSchema<unknown>): JSONSchema7 {\n const standardSchema = toStandardSchema(schema);\n\n return standardSchemaToJSONSchema(standardSchema);\n}\n\n/**\n * Converts an OpenAPI route spec with PublicSchema to one with JSON Schema\n */\nfunction convertToJsonSchema(spec: OpenAPIRoute): any {\n const converted: any = {\n summary: spec.summary,\n description: spec.description,\n tags: spec.tags,\n responses: {},\n };\n\n const parameters: any[] = [];\n\n // Convert path parameters\n if (spec.requestParams?.path) {\n const pathSchema = schemaToJsonSchema(spec.requestParams.path) as any;\n const properties = pathSchema.properties || {};\n\n Object.entries(properties).forEach(([name, schema]) => {\n parameters.push({\n name,\n in: 'path',\n required: true,\n description: (schema as any).description || `The ${name} parameter`,\n schema,\n });\n });\n }\n\n // Convert query parameters\n if (spec.requestParams?.query) {\n const querySchema = schemaToJsonSchema(spec.requestParams.query) as any;\n const properties = querySchema.properties || {};\n const required = querySchema.required || [];\n\n Object.entries(properties).forEach(([name, schema]) => {\n parameters.push({\n name,\n in: 'query',\n required: required.includes(name),\n description: (schema as any).description || `Query parameter: ${name}`,\n schema,\n });\n });\n }\n\n if (parameters.length > 0) {\n converted.parameters = parameters;\n }\n\n // Convert request body\n if (spec.requestBody?.content?.['application/json']?.schema) {\n converted.requestBody = {\n required: true,\n content: {\n 'application/json': {\n schema: schemaToJsonSchema(spec.requestBody.content['application/json'].schema),\n },\n },\n };\n }\n\n // Convert response schemas\n Object.entries(spec.responses).forEach(([statusCode, response]) => {\n converted.responses[statusCode] = {\n description: response.description,\n };\n\n if (response.content?.['application/json']?.schema) {\n converted.responses[statusCode].content = {\n 'application/json': {\n schema: schemaToJsonSchema(response.content['application/json'].schema),\n },\n };\n }\n });\n\n return converted;\n}\n\n/**\n * Generates a complete OpenAPI 3.1.0 document from server routes\n * @param routes - Array of ServerRoute objects with OpenAPI specifications\n * @param info - API metadata (title, version, description)\n * @returns Complete OpenAPI 3.1.0 document\n */\nexport function generateOpenAPIDocument(\n routes: readonly ServerRoute[],\n info: { title: string; version: string; description?: string },\n): any {\n // Use a null-prototype map so that route paths like \"__proto__\" cannot\n // pollute Object.prototype via the assignment below.\n const paths: Record<string, any> = Object.create(null);\n\n // Build paths object from routes\n // Convert Express-style :param to OpenAPI-style {param}\n routes.forEach(route => {\n if (!route.openapi) return;\n\n const openapiPath = route.path.replace(/:(\\w+)/g, '{$1}');\n if (!paths[openapiPath]) {\n paths[openapiPath] = Object.create(null);\n }\n\n // Convert Zod schemas to JSON Schema\n paths[openapiPath][route.method.toLowerCase()] = convertToJsonSchema(route.openapi);\n });\n\n return {\n openapi: '3.1.0',\n info: {\n title: info.title,\n version: info.version,\n description: info.description,\n },\n paths,\n };\n}\n\n/**\n * Converts custom API routes with DescribeRouteOptions to OpenAPI path entries.\n * The DescribeRouteOptions from hono-openapi extends OpenAPIV3_1.OperationObject,\n * so it already has the standard OpenAPI structure (parameters, requestBody, responses, etc.).\n *\n * @param routes - Array of ApiRoute objects with optional openapi specifications\n * @returns OpenAPI paths object to be merged into the main spec\n */\nexport function convertCustomRoutesToOpenAPIPaths(routes: ApiRoute[]): Record<string, any> {\n const paths: Record<string, any> = {};\n\n for (const route of routes) {\n // Skip routes without openapi metadata or routes marked as hidden\n if (!route.openapi || route.openapi.hide) {\n continue;\n }\n\n // Skip routes with method 'ALL' as they don't map well to OpenAPI\n if (route.method === 'ALL') {\n continue;\n }\n\n // Convert Express-style :param to OpenAPI-style {param}\n const openapiPath = route.path.replace(/:(\\w+)/g, '{$1}');\n\n if (!paths[openapiPath]) {\n paths[openapiPath] = {};\n }\n\n const method = route.method.toLowerCase();\n const openapi = route.openapi;\n\n // Build the OpenAPI operation object from DescribeRouteOptions\n // DescribeRouteOptions extends OpenAPIV3_1.OperationObject, so it already has:\n // - summary, description, tags, deprecated, externalDocs, operationId\n // - parameters (array of OpenAPIV3_1.ParameterObject)\n // - requestBody (OpenAPIV3_1.RequestBodyObject)\n // - responses (OpenAPIV3_1.ResponsesObject)\n // - security, servers, callbacks\n const operation: Record<string, any> = {\n summary: openapi.summary || `${route.method} ${route.path}`,\n description: openapi.description,\n tags: openapi.tags || ['custom'],\n deprecated: openapi.deprecated,\n externalDocs: openapi.externalDocs,\n security: openapi.security,\n servers: openapi.servers,\n };\n\n // Copy parameters directly if provided (already in OpenAPI format)\n if (openapi.parameters && Array.isArray(openapi.parameters)) {\n operation.parameters = openapi.parameters.map((param: any) => {\n // Convert Zod schemas in parameter schemas if needed\n if (param.schema && typeof param.schema === 'object' && '_def' in param.schema) {\n return {\n ...param,\n schema: zodToJsonSchema(param.schema, 'openApi3', 'none'),\n };\n }\n return param;\n });\n }\n\n // Handle request body - convert Zod schemas if needed\n if (openapi.requestBody) {\n const requestBody = openapi.requestBody as any;\n operation.requestBody = { ...requestBody };\n\n // Convert Zod schemas in requestBody content\n if (requestBody.content) {\n operation.requestBody.content = {};\n for (const [mediaType, mediaContent] of Object.entries(requestBody.content as Record<string, any>)) {\n if (mediaContent?.schema && typeof mediaContent.schema === 'object' && '_def' in mediaContent.schema) {\n operation.requestBody.content[mediaType] = {\n ...mediaContent,\n schema: zodToJsonSchema(mediaContent.schema, 'openApi3', 'none'),\n };\n } else {\n operation.requestBody.content[mediaType] = mediaContent;\n }\n }\n }\n }\n\n // Handle responses - convert Zod schemas if needed\n if (openapi.responses) {\n operation.responses = {};\n for (const [statusCode, response] of Object.entries(openapi.responses as Record<string, any>)) {\n if (!response) continue;\n\n // Handle reference objects\n if ('$ref' in response) {\n operation.responses[statusCode] = response;\n continue;\n }\n\n operation.responses[statusCode] = { ...response };\n\n // Convert Zod schemas in response content\n if (response.content) {\n operation.responses[statusCode].content = {};\n for (const [mediaType, mediaContent] of Object.entries(response.content as Record<string, any>)) {\n if (mediaContent?.schema && typeof mediaContent.schema === 'object' && '_def' in mediaContent.schema) {\n operation.responses[statusCode].content[mediaType] = {\n ...mediaContent,\n schema: zodToJsonSchema(mediaContent.schema, 'openApi3', 'none'),\n };\n } else {\n operation.responses[statusCode].content[mediaType] = mediaContent;\n }\n }\n }\n }\n } else {\n // Provide default response if none specified\n operation.responses = {\n 200: {\n description: 'Successful response',\n },\n };\n }\n\n // Remove undefined values\n Object.keys(operation).forEach(key => {\n if (operation[key] === undefined) {\n delete operation[key];\n }\n });\n\n paths[openapiPath][method] = operation;\n }\n\n return paths;\n}\n","import type { FGARouteConfig, MastraFGAPermissionInput } from '@mastra/core/auth/ee';\nimport type { ValidationErrorHook } from '@mastra/core/server';\nimport type { ZodRawShape, ZodTypeAny } from 'zod/v4';\nimport { z, ZodObject, ZodOptional, ZodNullable, ZodArray, ZodRecord } from 'zod/v4';\nimport { generateRouteOpenAPI } from '../openapi-utils';\nimport type { InferParams, ResponseType, RouteSchemas, ServerRoute, ServerRouteHandler } from './index';\n\n/**\n * Extracts parameters matching a Zod schema's shape from a params object.\n * Useful for separating schema-defined params from ServerContext in handlers.\n *\n * @example\n * ```typescript\n * const querySchema = z.object({ page: z.number(), name: z.string() });\n *\n * handler: async (params) => {\n * const query = pickParams(querySchema, params);\n * // query is typed as { page: number, name: string }\n * }\n * ```\n */\nexport function pickParams<T extends z.ZodRawShape, P extends Record<string, unknown>>(\n schema: z.ZodObject<T>,\n params: P,\n): z.infer<z.ZodObject<T>> {\n const keys = Object.keys(schema.shape);\n const result = {} as z.infer<z.ZodObject<T>>;\n for (const key of keys) {\n if (key in params) {\n (result as any)[key] = params[key];\n }\n }\n return result;\n}\n\n/**\n * Wraps a Zod schema to accept either the expected type OR a JSON string.\n * Used for complex query parameters (arrays, objects) that are serialized as JSON in URLs.\n *\n * - If input is already the expected type, passes through to schema validation\n * - If input is a string, attempts JSON.parse then validates\n * - Provides clear error messages for JSON parse failures\n *\n * @example\n * ```typescript\n * const tagsSchema = jsonQueryParam(z.array(z.string()));\n * // Accepts: [\"tag1\", \"tag2\"] OR '[\"tag1\", \"tag2\"]'\n *\n * const dateRangeSchema = jsonQueryParam(z.object({ gte: z.coerce.date() }));\n * // Accepts: { gte: \"2024-01-01\" } OR '{\"gte\": \"2024-01-01\"}'\n * ```\n */\nexport function jsonQueryParam<T extends ZodTypeAny>(schema: T): z.ZodType<z.infer<T>> {\n return z.union([\n schema, // Already the expected type (non-string input)\n z.string().transform((val, ctx) => {\n try {\n const parsed = JSON.parse(val);\n const result = schema.safeParse(parsed);\n if (!result.success) {\n for (const issue of result.error.issues) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: issue.message,\n path: issue.path,\n });\n }\n return z.NEVER;\n }\n return result.data;\n } catch (e) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: `Invalid JSON: ${e instanceof Error ? e.message : 'parse error'}`,\n });\n return z.NEVER;\n }\n }),\n ]) as z.ZodType<z.infer<T>>;\n}\n\n/**\n * Checks if a Zod schema represents a complex type that needs JSON parsing from query strings.\n * Complex types: arrays, objects, records (these can't be represented as simple strings)\n * Simple types: strings, numbers, booleans, enums (can use z.coerce for conversion)\n */\nfunction isComplexType(schema: ZodTypeAny): boolean {\n // Unwrap all optional/nullable layers to check the inner type\n // Note: .partial() can create nested optionals (e.g., ZodOptional<ZodOptional<ZodObject>>)\n let inner: ZodTypeAny = schema;\n\n while (inner instanceof ZodOptional || inner instanceof ZodNullable) {\n inner = inner.unwrap() as ZodTypeAny;\n }\n\n // Complex types that need JSON parsing\n return inner instanceof ZodArray || inner instanceof ZodRecord || inner instanceof ZodObject;\n}\n\n/**\n * Wraps a Zod object schema for HTTP query parameter handling.\n * Automatically detects complex fields (arrays, objects, records) and wraps them\n * with jsonQueryParam() to accept JSON strings from query parameters.\n *\n * Simple fields (strings, numbers, booleans, enums) are left unchanged and should\n * use z.coerce for string-to-type conversion.\n *\n * @example\n * ```typescript\n * // Base schema (for internal/storage use)\n * const tracesFilterSchema = z.object({\n * tags: z.array(z.string()).optional(),\n * startedAt: dateRangeSchema.optional(),\n * perPage: z.coerce.number().optional(),\n * });\n *\n * // HTTP schema (accepts JSON strings for complex fields)\n * const httpTracesFilterSchema = wrapSchemaForQueryParams(tracesFilterSchema);\n *\n * // Now accepts:\n * // ?tags=[\"tag1\",\"tag2\"]&startedAt={\"gte\":\"2024-01-01\"}&perPage=10\n * ```\n */\nexport function wrapSchemaForQueryParams<T extends ZodRawShape>(schema: ZodObject<T>): ZodObject<ZodRawShape> {\n const newShape: Record<string, ZodTypeAny> = {};\n\n // schema.shape is Readonly in Zod v4, so we need to create a mutable copy\n const shape = schema.shape as unknown as Record<string, ZodTypeAny>;\n for (const [key, fieldSchema] of Object.entries(shape)) {\n if (isComplexType(fieldSchema)) {\n // Wrap complex types to accept JSON strings\n newShape[key] = jsonQueryParam(fieldSchema);\n } else {\n // Keep simple types as-is\n newShape[key] = fieldSchema;\n }\n }\n\n return z.object(newShape);\n}\n\ninterface RouteConfig<\n TPathSchema extends z.ZodTypeAny | undefined = undefined,\n TQuerySchema extends z.ZodTypeAny | undefined = undefined,\n TBodySchema extends z.ZodTypeAny | undefined = undefined,\n TResponseSchema extends z.ZodTypeAny | undefined = undefined,\n TResponseType extends ResponseType = 'json',\n TMethod extends string = string,\n TPath extends string = string,\n> {\n method: TMethod;\n path: TPath;\n responseType: TResponseType;\n streamFormat?: 'sse' | 'stream'; // Only used when responseType is 'stream'\n sseFlushOnConnect?: boolean;\n handler: ServerRouteHandler<\n InferParams<TPathSchema, TQuerySchema, TBodySchema>,\n TResponseSchema extends z.ZodTypeAny ? z.infer<TResponseSchema> : unknown,\n TResponseType\n >;\n pathParamSchema?: TPathSchema;\n queryParamSchema?: TQuerySchema;\n bodySchema?: TBodySchema;\n responseSchema?: TResponseSchema;\n summary?: string;\n description?: string;\n tags?: string[];\n deprecated?: boolean;\n maxBodySize?: number;\n requiresAuth?: boolean; // Explicit auth requirement for this route\n /**\n * Permission required to access this route (EE feature).\n * If set, the user must have this permission to access the route.\n * Uses the format: `resource:action` or `resource:action:resourceId`\n *\n * When an array is provided, the user needs ANY ONE of the listed permissions.\n */\n requiresPermission?: MastraFGAPermissionInput | MastraFGAPermissionInput[];\n /**\n * FGA authorization config for this route (EE feature).\n * If set, the user must have the specified permission on the resource.\n */\n fga?: FGARouteConfig;\n onValidationError?: ValidationErrorHook;\n}\n\n/**\n * Creates a server route with auto-generated OpenAPI specification and type-safe handler inference.\n *\n * ## Permission System\n *\n * Routes use a convention-based permission system. Permissions are automatically derived\n * from the route path and method using the format: `{resource}:{action}`\n *\n * - **resource**: First path segment (e.g., 'agents', 'workflows', 'memory')\n * - **action**: Derived from HTTP method:\n * - GET → 'read'\n * - POST → 'write' (or 'execute' for operation endpoints like /generate, /stream)\n * - PUT/PATCH → 'write'\n * - DELETE → 'delete'\n *\n * ### Examples:\n * - `GET /agents/:id` → `agents:read`\n * - `POST /agents/:id/generate` → `agents:execute`\n * - `DELETE /workflows/:id` → `workflows:delete`\n *\n * ### Overriding:\n * - Use `requiresPermission` to explicitly set a custom permission\n * - Use `createPublicRoute()` for routes that should bypass auth entirely\n *\n * The handler parameters are automatically inferred from the provided schemas:\n * - pathParamSchema: Infers path parameter types (e.g., :agentId)\n * - queryParamSchema: Infers query parameter types\n * - bodySchema: Infers request body types\n * - Runtime context (mastra, requestContext, tools, taskStore) is always available\n *\n * @param config - Route configuration including schemas, handler, and metadata\n * @returns Complete ServerRoute with OpenAPI spec\n *\n * @example\n * ```typescript\n * // Protected route (default) - permission auto-derived as 'agents:read'\n * export const getAgentRoute = createRoute({\n * method: 'GET',\n * path: '/agents/:agentId',\n * responseType: 'json',\n * pathParamSchema: z.object({ agentId: z.string() }),\n * responseSchema: serializedAgentSchema,\n * handler: async ({ agentId, mastra, requestContext }) => {\n * return mastra.getAgentById(agentId);\n * },\n * summary: 'Get agent by ID',\n * tags: ['Agents'],\n * });\n *\n * // Protected route with explicit permission override\n * export const adminRoute = createRoute({\n * method: 'POST',\n * path: '/agents/:agentId/admin-action',\n * responseType: 'json',\n * requiresPermission: 'agents:admin', // Override derived 'agents:write'\n * handler: async (ctx) => { ... },\n * });\n * ```\n */\nexport function createRoute<\n TPathSchema extends z.ZodTypeAny | undefined = undefined,\n TQuerySchema extends z.ZodTypeAny | undefined = undefined,\n TBodySchema extends z.ZodTypeAny | undefined = undefined,\n TResponseSchema extends z.ZodTypeAny | undefined = undefined,\n TResponseType extends ResponseType = 'json',\n TMethod extends string = string,\n TPath extends string = string,\n>(\n config: RouteConfig<TPathSchema, TQuerySchema, TBodySchema, TResponseSchema, TResponseType, TMethod, TPath>,\n): ServerRoute<\n InferParams<TPathSchema, TQuerySchema, TBodySchema>,\n TResponseSchema extends z.ZodTypeAny ? z.infer<TResponseSchema> : unknown,\n TResponseType,\n RouteSchemas<TPathSchema, TQuerySchema, TBodySchema, TResponseSchema>,\n TMethod,\n TPath\n> {\n const { summary, description, tags, deprecated, requiresAuth, requiresPermission, onValidationError, ...baseRoute } =\n config;\n\n // Generate OpenAPI specification from the route config\n // Skip OpenAPI generation for 'ALL' method as it doesn't map to OpenAPI\n const openapi =\n config.method !== 'ALL'\n ? generateRouteOpenAPI({\n method: config.method as 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH',\n path: config.path,\n summary,\n description,\n tags,\n pathParamSchema: config.pathParamSchema,\n queryParamSchema: config.queryParamSchema,\n bodySchema: config.bodySchema,\n responseSchema: config.responseSchema,\n deprecated,\n })\n : undefined;\n\n return {\n ...baseRoute,\n openapi,\n deprecated,\n requiresAuth,\n requiresPermission,\n onValidationError,\n };\n}\n\n/**\n * Creates a public server route that bypasses authentication and authorization.\n *\n * Use this for routes that must be accessible without authentication, such as:\n * - Auth endpoints (login, logout, OAuth callbacks)\n * - Health checks\n * - Public API endpoints\n *\n * This is equivalent to calling `createRoute({ ...config, requiresAuth: false })`.\n *\n * @param config - Route configuration (same as createRoute, but requiresAuth is forced to false)\n * @returns Complete ServerRoute marked as public\n *\n * @example\n * ```typescript\n * // Public route - no authentication required\n * export const healthCheckRoute = createPublicRoute({\n * method: 'GET',\n * path: '/health',\n * responseType: 'json',\n * handler: async () => ({ status: 'ok' }),\n * summary: 'Health check',\n * tags: ['System'],\n * });\n *\n * // Auth callback - must be public for OAuth flow\n * export const ssoCallbackRoute = createPublicRoute({\n * method: 'GET',\n * path: '/auth/sso/callback',\n * responseType: 'datastream-response',\n * handler: async (ctx) => { ... },\n * summary: 'Handle SSO callback',\n * tags: ['Auth'],\n * });\n * ```\n */\nexport function createPublicRoute<\n TPathSchema extends z.ZodTypeAny | undefined = undefined,\n TQuerySchema extends z.ZodTypeAny | undefined = undefined,\n TBodySchema extends z.ZodTypeAny | undefined = undefined,\n TResponseSchema extends z.ZodTypeAny | undefined = undefined,\n TResponseType extends ResponseType = 'json',\n TMethod extends string = string,\n TPath extends string = string,\n>(\n config: Omit<\n RouteConfig<TPathSchema, TQuerySchema, TBodySchema, TResponseSchema, TResponseType, TMethod, TPath>,\n 'requiresAuth'\n >,\n): ServerRoute<\n InferParams<TPathSchema, TQuerySchema, TBodySchema>,\n TResponseSchema extends z.ZodTypeAny ? z.infer<TResponseSchema> : unknown,\n TResponseType,\n RouteSchemas<TPathSchema, TQuerySchema, TBodySchema, TResponseSchema>,\n TMethod,\n TPath\n> {\n return createRoute({\n ...config,\n requiresAuth: false,\n });\n}\n"],"x_google_ignoreList":[0],"mappings":";;;;;;;AAKA,IAAI,cAAc,MAAM;CACtB,MAAM,OAAO,QAAQ;EACnB,IAAI,CAAC,OAAO,MAAM;EAClB,MAAM,eAAe,MAAM,QAAQ,OAAO,IAAI,IAAI,OAAO,OAAO,CAAC,OAAO,IAAI;EAC5E,MAAM,UAAU,IAAI,IAAI,YAAY;EACpC,IAAI,CAAC,QAAQ,IAAI,QAAQ,GACvB,MAAM,SAAS;EAEjB,IAAI,CAAC,QAAQ,IAAI,QAAQ,KAAK,CAAC,QAAQ,IAAI,SAAS,GAClD,MAAM,SAAS;EAEjB,IAAI,CAAC,QAAQ,IAAI,SAAS,GACxB,MAAM,UAAU;EAElB,IAAI,CAAC,QAAQ,IAAI,MAAM,GACrB,MAAM,OAAO;EAEf,IAAI,CAAC,QAAQ,IAAI,OAAO,GACtB,MAAM,QAAQ;EAEhB,IAAI,CAAC,QAAQ,IAAI,QAAQ,GACvB,MAAM,SAAS;EAEjB,IAAI,QAAQ,IAAI,SAAS,KAAK,MAAM,WAAW,OAAO;GACpD,MAAM,gBAAgB,MAAM,UAAUA,OAAAA,EAAE,OAAO;GAC/C,IAAI,yBAAyBA,OAAAA,EAAE,WAC7B,MAAM,SAAS,cAAc,IAAI;EAErC;CACF;AACF;AAIA,IAAI,eAAe,MAAM;CACvB,MAAM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d,QAWA;CACA,OAAO,YAAY;EACjB,GAAG;EACH,cAAc;CAChB,CAAC;AACH"}
|
|
1
|
+
{"version":3,"file":"route-builder-CgLVYL1c.cjs","names":["z","z2","z3","z4","z5","z6","z7","z8","z9","arraySchema","z10","z11","z12","z13","z14","ZodFirstPartyTypeKind","zodToJsonSchema","z$1","require_json_schema_traverse","standardSchemaToJSONSchema","z","ZodOptional","ZodNullable","ZodArray","ZodRecord","ZodObject"],"sources":["../../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/zod-from-json-schema/0.5.2/103d891574c9abae075269aefe33fa44ba23fd41234be556312b9d6c20485b4b/node_modules/zod-from-json-schema/dist/index.mjs","../../schema-compat/dist/index.js","../src/server/server-adapter/openapi-utils.ts","../src/server/server-adapter/routes/route-builder.ts"],"sourcesContent":["// src/core/converter.ts\nimport { z as z14 } from \"zod/v4\";\n\n// src/handlers/primitive/type.ts\nimport { z } from \"zod/v4\";\nvar TypeHandler = class {\n apply(types, schema) {\n if (!schema.type) return;\n const allowedTypes = Array.isArray(schema.type) ? schema.type : [schema.type];\n const typeSet = new Set(allowedTypes);\n if (!typeSet.has(\"string\")) {\n types.string = false;\n }\n if (!typeSet.has(\"number\") && !typeSet.has(\"integer\")) {\n types.number = false;\n }\n if (!typeSet.has(\"boolean\")) {\n types.boolean = false;\n }\n if (!typeSet.has(\"null\")) {\n types.null = false;\n }\n if (!typeSet.has(\"array\")) {\n types.array = false;\n }\n if (!typeSet.has(\"object\")) {\n types.object = false;\n }\n if (typeSet.has(\"integer\") && types.number !== false) {\n const currentNumber = types.number || z.number();\n if (currentNumber instanceof z.ZodNumber) {\n types.number = currentNumber.int();\n }\n }\n }\n};\n\n// src/handlers/primitive/const.ts\nimport { z as z2 } from \"zod/v4\";\nvar ConstHandler = class {\n apply(types, schema) {\n if (schema.const === void 0) return;\n const constValue = schema.const;\n types.string = false;\n types.number = false;\n types.boolean = false;\n types.null = false;\n types.array = false;\n types.object = false;\n if (typeof constValue === \"string\") {\n types.string = z2.literal(constValue);\n } else if (typeof constValue === \"number\") {\n types.number = z2.literal(constValue);\n } else if (typeof constValue === \"boolean\") {\n types.boolean = z2.literal(constValue);\n } else if (constValue === null) {\n types.null = z2.null();\n } else if (Array.isArray(constValue)) {\n types.array = void 0;\n } else if (typeof constValue === \"object\") {\n types.object = void 0;\n }\n }\n};\n\n// src/handlers/primitive/enum.ts\nimport { z as z3 } from \"zod/v4\";\nvar EnumHandler = class {\n apply(types, schema) {\n if (!schema.enum) return;\n if (schema.enum.length === 0) {\n if (!schema.type) {\n types.string = false;\n types.number = false;\n types.boolean = false;\n types.null = false;\n types.array = false;\n types.object = false;\n }\n return;\n }\n const valuesByType = {\n string: schema.enum.filter((v) => typeof v === \"string\"),\n number: schema.enum.filter((v) => typeof v === \"number\"),\n boolean: schema.enum.filter((v) => typeof v === \"boolean\"),\n null: schema.enum.filter((v) => v === null),\n array: schema.enum.filter((v) => Array.isArray(v)),\n object: schema.enum.filter((v) => typeof v === \"object\" && v !== null && !Array.isArray(v))\n };\n types.string = this.createTypeSchema(valuesByType.string, \"string\");\n types.number = this.createTypeSchema(valuesByType.number, \"number\");\n types.boolean = this.createTypeSchema(valuesByType.boolean, \"boolean\");\n types.null = valuesByType.null.length > 0 ? z3.null() : false;\n types.array = valuesByType.array.length > 0 ? void 0 : false;\n types.object = valuesByType.object.length > 0 ? void 0 : false;\n }\n createTypeSchema(values, type) {\n if (values.length === 0) return false;\n if (values.length === 1) {\n return z3.literal(values[0]);\n }\n if (type === \"string\") {\n return z3.enum(values);\n }\n if (type === \"number\") {\n const [first, second, ...rest] = values;\n return z3.union([z3.literal(first), z3.literal(second), ...rest.map((v) => z3.literal(v))]);\n }\n if (type === \"boolean\") {\n return z3.union([z3.literal(true), z3.literal(false)]);\n }\n return false;\n }\n};\n\n// src/handlers/primitive/file.ts\nimport { z as z4 } from \"zod/v4\";\nvar FileHandler = class {\n apply(types, schema) {\n const stringSchema = schema;\n if (stringSchema.type === \"string\" && stringSchema.format === \"binary\" && stringSchema.contentEncoding === \"binary\") {\n let fileSchema = z4.file();\n if (stringSchema.minLength !== void 0) {\n fileSchema = fileSchema.min(stringSchema.minLength);\n }\n if (stringSchema.maxLength !== void 0) {\n fileSchema = fileSchema.max(stringSchema.maxLength);\n }\n if (stringSchema.contentMediaType !== void 0) {\n fileSchema = fileSchema.mime(stringSchema.contentMediaType);\n }\n types.file = fileSchema;\n types.string = false;\n }\n }\n};\n\n// src/handlers/primitive/string.ts\nimport { z as z5 } from \"zod/v4\";\nvar ImplicitStringHandler = class {\n apply(types, schema) {\n const stringSchema = schema;\n if (schema.type === void 0 && (stringSchema.minLength !== void 0 || stringSchema.maxLength !== void 0 || stringSchema.pattern !== void 0)) {\n if (types.string === void 0) {\n types.string = z5.string();\n }\n }\n }\n};\nvar MinLengthHandler = class {\n apply(types, schema) {\n const stringSchema = schema;\n if (stringSchema.minLength === void 0) return;\n if (types.string !== false) {\n const currentString = types.string || z5.string();\n if (currentString instanceof z5.ZodString) {\n types.string = currentString.refine(\n (value) => {\n const graphemeLength = Array.from(value).length;\n return graphemeLength >= stringSchema.minLength;\n },\n { message: `String must be at least ${stringSchema.minLength} characters long` }\n );\n }\n }\n }\n};\nvar MaxLengthHandler = class {\n apply(types, schema) {\n const stringSchema = schema;\n if (stringSchema.maxLength === void 0) return;\n if (types.string !== false) {\n const currentString = types.string || z5.string();\n if (currentString instanceof z5.ZodString) {\n types.string = currentString.refine(\n (value) => {\n const graphemeLength = Array.from(value).length;\n return graphemeLength <= stringSchema.maxLength;\n },\n { message: `String must be at most ${stringSchema.maxLength} characters long` }\n );\n }\n }\n }\n};\nvar PatternHandler = class {\n apply(types, schema) {\n const stringSchema = schema;\n if (!stringSchema.pattern) return;\n if (types.string !== false) {\n const currentString = types.string || z5.string();\n if (currentString instanceof z5.ZodString) {\n const regex = new RegExp(stringSchema.pattern);\n types.string = currentString.regex(regex);\n }\n }\n }\n};\n\n// src/handlers/primitive/number.ts\nimport { z as z6 } from \"zod/v4\";\nvar MinimumHandler = class {\n apply(types, schema) {\n const numberSchema = schema;\n if (numberSchema.minimum === void 0) return;\n if (types.number !== false) {\n const currentNumber = types.number || z6.number();\n if (currentNumber instanceof z6.ZodNumber) {\n types.number = currentNumber.min(numberSchema.minimum);\n }\n }\n }\n};\nvar MaximumHandler = class {\n apply(types, schema) {\n const numberSchema = schema;\n if (numberSchema.maximum === void 0) return;\n if (types.number !== false) {\n const currentNumber = types.number || z6.number();\n if (currentNumber instanceof z6.ZodNumber) {\n types.number = currentNumber.max(numberSchema.maximum);\n }\n }\n }\n};\nvar ExclusiveMinimumHandler = class {\n apply(types, schema) {\n const numberSchema = schema;\n if (numberSchema.exclusiveMinimum === void 0) return;\n if (types.number !== false) {\n const currentNumber = types.number || z6.number();\n if (currentNumber instanceof z6.ZodNumber) {\n if (typeof numberSchema.exclusiveMinimum === \"number\") {\n types.number = currentNumber.gt(numberSchema.exclusiveMinimum);\n } else {\n types.number = false;\n }\n }\n }\n }\n};\nvar ExclusiveMaximumHandler = class {\n apply(types, schema) {\n const numberSchema = schema;\n if (numberSchema.exclusiveMaximum === void 0) return;\n if (types.number !== false) {\n const currentNumber = types.number || z6.number();\n if (currentNumber instanceof z6.ZodNumber) {\n if (typeof numberSchema.exclusiveMaximum === \"number\") {\n types.number = currentNumber.lt(numberSchema.exclusiveMaximum);\n } else {\n types.number = false;\n }\n }\n }\n }\n};\nvar MultipleOfHandler = class {\n apply(types, schema) {\n const numberSchema = schema;\n if (numberSchema.multipleOf === void 0) return;\n if (types.number !== false) {\n const currentNumber = types.number || z6.number();\n if (currentNumber instanceof z6.ZodNumber) {\n types.number = currentNumber.refine(\n (value) => {\n if (numberSchema.multipleOf === 0) return false;\n const quotient = value / numberSchema.multipleOf;\n const rounded = Math.round(quotient);\n const tolerance = Math.min(\n Math.abs(value) * Number.EPSILON * 10,\n Math.abs(numberSchema.multipleOf) * Number.EPSILON * 10\n );\n return Math.abs(quotient - rounded) <= tolerance / Math.abs(numberSchema.multipleOf);\n },\n { message: `Must be a multiple of ${numberSchema.multipleOf}` }\n );\n }\n }\n }\n};\n\n// src/handlers/primitive/array.ts\nimport { z as z7 } from \"zod/v4\";\nvar ImplicitArrayHandler = class {\n apply(types, schema) {\n const arraySchema = schema;\n if (schema.type === void 0 && (arraySchema.minItems !== void 0 || arraySchema.maxItems !== void 0 || arraySchema.items !== void 0 || arraySchema.prefixItems !== void 0)) {\n if (types.array === void 0) {\n types.array = z7.array(z7.any());\n }\n }\n }\n};\nvar MinItemsHandler = class {\n apply(types, schema) {\n const arraySchema = schema;\n if (arraySchema.minItems === void 0) return;\n if (types.array !== false) {\n types.array = (types.array || z7.array(z7.any())).min(arraySchema.minItems);\n }\n }\n};\nvar MaxItemsHandler = class {\n apply(types, schema) {\n const arraySchema = schema;\n if (arraySchema.maxItems === void 0) return;\n if (types.array !== false) {\n types.array = (types.array || z7.array(z7.any())).max(arraySchema.maxItems);\n }\n }\n};\nvar ItemsHandler = class {\n apply(types, schema) {\n const arraySchema = schema;\n if (types.array === false) return;\n if (Array.isArray(arraySchema.items)) {\n types.array = types.array || z7.array(z7.any());\n } else if (arraySchema.items && typeof arraySchema.items !== \"boolean\" && !arraySchema.prefixItems) {\n const itemSchema = convertJsonSchemaToZod(arraySchema.items);\n let newArray = z7.array(itemSchema);\n if (types.array && types.array instanceof z7.ZodArray) {\n const existingDef = types.array._def;\n if (existingDef.checks) {\n existingDef.checks.forEach((check) => {\n if (check._zod && check._zod.def) {\n const def = check._zod.def;\n if (def.check === \"min_length\" && def.minimum !== void 0) {\n newArray = newArray.min(def.minimum);\n } else if (def.check === \"max_length\" && def.maximum !== void 0) {\n newArray = newArray.max(def.maximum);\n }\n }\n });\n }\n }\n types.array = newArray;\n } else if (typeof arraySchema.items === \"boolean\" && arraySchema.items === false) {\n if (!arraySchema.prefixItems) {\n types.array = z7.array(z7.any()).max(0);\n } else {\n types.array = types.array || z7.array(z7.any());\n }\n } else if (typeof arraySchema.items === \"boolean\" && arraySchema.items === true) {\n types.array = types.array || z7.array(z7.any());\n } else if (arraySchema.prefixItems) {\n types.array = types.array || z7.array(z7.any());\n }\n }\n};\n\n// src/handlers/primitive/tuple.ts\nimport { z as z8 } from \"zod/v4\";\nvar TupleHandler = class {\n apply(types, schema) {\n if (schema.type !== \"array\") return;\n const arraySchema = schema;\n if (!Array.isArray(arraySchema.items)) return;\n if (types.array === false) return;\n const itemSchemas = arraySchema.items.map((itemSchema) => convertJsonSchemaToZod(itemSchema));\n let tuple;\n if (itemSchemas.length === 0) {\n tuple = z8.tuple([]);\n } else {\n tuple = z8.tuple(itemSchemas);\n }\n if (arraySchema.minItems !== void 0 && arraySchema.minItems > itemSchemas.length) {\n tuple = false;\n }\n if (arraySchema.maxItems !== void 0 && arraySchema.maxItems < itemSchemas.length) {\n tuple = false;\n }\n types.tuple = tuple;\n types.array = false;\n }\n};\n\n// src/handlers/primitive/object.ts\nimport { z as z9 } from \"zod/v4\";\nvar PropertiesHandler = class {\n apply(types, schema) {\n const objectSchema = schema;\n if (types.object === false) return;\n if (objectSchema.properties || objectSchema.required || objectSchema.additionalProperties !== void 0) {\n types.object = types.object || z9.object({}).passthrough();\n }\n }\n};\nvar ImplicitObjectHandler = class {\n apply(types, schema) {\n const objectSchema = schema;\n if (schema.type === void 0 && (objectSchema.maxProperties !== void 0 || objectSchema.minProperties !== void 0)) {\n if (types.object === void 0) {\n types.object = z9.object({}).passthrough();\n }\n }\n }\n};\nvar MaxPropertiesHandler = class {\n apply(types, schema) {\n const objectSchema = schema;\n if (objectSchema.maxProperties === void 0) return;\n if (types.object !== false) {\n const baseObject = types.object || z9.object({}).passthrough();\n types.object = baseObject.refine(\n (obj) => Object.keys(obj).length <= objectSchema.maxProperties,\n { message: `Object must have at most ${objectSchema.maxProperties} properties` }\n );\n }\n }\n};\nvar MinPropertiesHandler = class {\n apply(types, schema) {\n const objectSchema = schema;\n if (objectSchema.minProperties === void 0) return;\n if (types.object !== false) {\n const baseObject = types.object || z9.object({}).passthrough();\n types.object = baseObject.refine(\n (obj) => Object.keys(obj).length >= objectSchema.minProperties,\n { message: `Object must have at least ${objectSchema.minProperties} properties` }\n );\n }\n }\n};\n\n// src/core/utils.ts\nfunction deepEqual(a, b) {\n if (a === b) return true;\n if (a == null || b == null) return a === b;\n if (typeof a !== typeof b) return false;\n if (Array.isArray(a) && Array.isArray(b)) {\n if (a.length !== b.length) return false;\n return a.every((item, index) => deepEqual(item, b[index]));\n }\n if (typeof a === \"object\" && typeof b === \"object\") {\n const keysA = Object.keys(a);\n const keysB = Object.keys(b);\n if (keysA.length !== keysB.length) return false;\n return keysA.every((key) => keysB.includes(key) && deepEqual(a[key], b[key]));\n }\n return false;\n}\nfunction createUniqueItemsValidator() {\n return (value) => {\n if (!Array.isArray(value)) {\n return true;\n }\n const seen = [];\n return value.every((item) => {\n const isDuplicate = seen.some((seenItem) => deepEqual(item, seenItem));\n if (isDuplicate) {\n return false;\n }\n seen.push(item);\n return true;\n });\n };\n}\nfunction isValidWithSchema(schema, value) {\n return schema.safeParse(value).success;\n}\n\n// src/handlers/refinement/not.ts\nvar NotHandler = class {\n apply(zodSchema, schema) {\n if (!schema.not) return zodSchema;\n const notSchema = convertJsonSchemaToZod(schema.not);\n return zodSchema.refine(\n (value) => !isValidWithSchema(notSchema, value),\n { message: \"Value must not match the 'not' schema\" }\n );\n }\n};\n\n// src/handlers/refinement/uniqueItems.ts\nvar UniqueItemsHandler = class {\n apply(zodSchema, schema) {\n const arraySchema = schema;\n if (arraySchema.uniqueItems !== true) return zodSchema;\n return zodSchema.refine(createUniqueItemsValidator(), {\n message: \"Array items must be unique\"\n });\n }\n};\n\n// src/handlers/refinement/allOf.ts\nimport { z as z10 } from \"zod/v4\";\nvar AllOfHandler = class {\n apply(zodSchema, schema) {\n if (!schema.allOf || schema.allOf.length === 0) return zodSchema;\n const allOfSchemas = schema.allOf.map((s) => convertJsonSchemaToZod(s));\n return allOfSchemas.reduce(\n (acc, s) => z10.intersection(acc, s),\n zodSchema\n );\n }\n};\n\n// src/handlers/refinement/anyOf.ts\nimport { z as z11 } from \"zod/v4\";\nvar AnyOfHandler = class {\n apply(zodSchema, schema) {\n if (!schema.anyOf || schema.anyOf.length === 0) return zodSchema;\n const anyOfSchema = schema.anyOf.length === 1 ? convertJsonSchemaToZod(schema.anyOf[0]) : z11.union([\n convertJsonSchemaToZod(schema.anyOf[0]),\n convertJsonSchemaToZod(schema.anyOf[1]),\n ...schema.anyOf.slice(2).map((s) => convertJsonSchemaToZod(s))\n ]);\n return z11.intersection(zodSchema, anyOfSchema);\n }\n};\n\n// src/handlers/refinement/oneOf.ts\nvar OneOfHandler = class {\n apply(zodSchema, schema) {\n if (!schema.oneOf || schema.oneOf.length === 0) return zodSchema;\n const oneOfSchemas = schema.oneOf.map((s) => convertJsonSchemaToZod(s));\n return zodSchema.refine(\n (value) => {\n let validCount = 0;\n for (const oneOfSchema of oneOfSchemas) {\n const result = oneOfSchema.safeParse(value);\n if (result.success) {\n validCount++;\n if (validCount > 1) return false;\n }\n }\n return validCount === 1;\n },\n { message: \"Value must match exactly one of the oneOf schemas\" }\n );\n }\n};\n\n// src/handlers/refinement/arrayItems.ts\nvar PrefixItemsHandler = class {\n apply(zodSchema, schema) {\n const arraySchema = schema;\n if (arraySchema.prefixItems && Array.isArray(arraySchema.prefixItems)) {\n const prefixItems = arraySchema.prefixItems;\n const prefixSchemas = prefixItems.map((itemSchema) => convertJsonSchemaToZod(itemSchema));\n return zodSchema.refine(\n (value) => {\n if (!Array.isArray(value)) return true;\n for (let i = 0; i < Math.min(value.length, prefixSchemas.length); i++) {\n if (!isValidWithSchema(prefixSchemas[i], value[i])) {\n return false;\n }\n }\n if (value.length > prefixSchemas.length) {\n if (typeof arraySchema.items === \"boolean\" && arraySchema.items === false) {\n return false;\n } else if (arraySchema.items && typeof arraySchema.items === \"object\" && !Array.isArray(arraySchema.items)) {\n const additionalItemSchema = convertJsonSchemaToZod(arraySchema.items);\n for (let i = prefixSchemas.length; i < value.length; i++) {\n if (!isValidWithSchema(additionalItemSchema, value[i])) {\n return false;\n }\n }\n }\n }\n return true;\n },\n { message: \"Array does not match prefixItems schema\" }\n );\n }\n return zodSchema;\n }\n};\n\n// src/handlers/refinement/objectProperties.ts\nimport { z as z12 } from \"zod/v4\";\nvar ObjectPropertiesHandler = class {\n apply(zodSchema, schema) {\n const objectSchema = schema;\n if (!objectSchema.properties && !objectSchema.required && objectSchema.additionalProperties !== false) {\n return zodSchema;\n }\n if (zodSchema instanceof z12.ZodObject || zodSchema instanceof z12.ZodRecord) {\n const shape = {};\n if (objectSchema.properties) {\n for (const [key, propSchema] of Object.entries(objectSchema.properties)) {\n if (propSchema !== void 0) {\n shape[key] = convertJsonSchemaToZod(propSchema);\n }\n }\n }\n if (objectSchema.required && Array.isArray(objectSchema.required)) {\n const required = new Set(objectSchema.required);\n for (const key of Object.keys(shape)) {\n if (!required.has(key)) {\n shape[key] = shape[key].optional();\n }\n }\n } else {\n for (const key of Object.keys(shape)) {\n shape[key] = shape[key].optional();\n }\n }\n if (objectSchema.additionalProperties === false) {\n return z12.object(shape);\n } else {\n return z12.object(shape).passthrough();\n }\n }\n return zodSchema.refine(\n (value) => {\n if (typeof value !== \"object\" || value === null || Array.isArray(value)) {\n return true;\n }\n if (objectSchema.properties) {\n for (const [propName, propSchema] of Object.entries(objectSchema.properties)) {\n if (propSchema !== void 0) {\n const propExists = Object.getOwnPropertyDescriptor(value, propName) !== void 0;\n if (propExists) {\n const zodPropSchema = convertJsonSchemaToZod(propSchema);\n const propResult = zodPropSchema.safeParse(value[propName]);\n if (!propResult.success) {\n return false;\n }\n }\n }\n }\n }\n if (objectSchema.required && Array.isArray(objectSchema.required)) {\n for (const requiredProp of objectSchema.required) {\n const propExists = Object.getOwnPropertyDescriptor(value, requiredProp) !== void 0;\n if (!propExists) {\n return false;\n }\n }\n }\n if (objectSchema.additionalProperties === false && objectSchema.properties) {\n const allowedProps = new Set(Object.keys(objectSchema.properties));\n for (const prop in value) {\n if (!allowedProps.has(prop)) {\n return false;\n }\n }\n }\n return true;\n },\n { message: \"Object constraints validation failed\" }\n );\n }\n};\n\n// src/handlers/refinement/enumComplex.ts\nvar EnumComplexHandler = class {\n apply(zodSchema, schema) {\n if (!schema.enum || schema.enum.length === 0) return zodSchema;\n const complexValues = schema.enum.filter(\n (v) => Array.isArray(v) || typeof v === \"object\" && v !== null\n );\n if (complexValues.length === 0) return zodSchema;\n return zodSchema.refine(\n (value) => {\n if (typeof value !== \"object\" || value === null) return true;\n return complexValues.some(\n (enumValue) => deepEqual(value, enumValue)\n );\n },\n { message: \"Value must match one of the enum values\" }\n );\n }\n};\n\n// src/handlers/refinement/constComplex.ts\nvar ConstComplexHandler = class {\n apply(zodSchema, schema) {\n if (schema.const === void 0) return zodSchema;\n const constValue = schema.const;\n if (typeof constValue !== \"object\" || constValue === null) {\n return zodSchema;\n }\n return zodSchema.refine(\n (value) => deepEqual(value, constValue),\n { message: \"Value must equal the const value\" }\n );\n }\n};\n\n// src/handlers/refinement/metadata.ts\nvar MetadataHandler = class {\n apply(zodSchema, schema) {\n if (schema.description) {\n zodSchema = zodSchema.describe(schema.description);\n }\n return zodSchema;\n }\n};\n\n// src/handlers/refinement/protoRequired.ts\nimport { z as z13 } from \"zod/v4\";\nvar ProtoRequiredHandler = class {\n apply(zodSchema, schema) {\n var _a;\n const objectSchema = schema;\n if (!((_a = objectSchema.required) == null ? void 0 : _a.includes(\"__proto__\")) || schema.type !== void 0) {\n return zodSchema;\n }\n return z13.any().refine(\n (value) => this.validateRequired(value, objectSchema.required),\n { message: \"Missing required properties\" }\n );\n }\n validateRequired(value, required) {\n if (typeof value !== \"object\" || value === null || Array.isArray(value)) {\n return true;\n }\n return required.every(\n (prop) => Object.prototype.hasOwnProperty.call(value, prop)\n );\n }\n};\n\n// src/handlers/refinement/contains.ts\nvar ContainsHandler = class {\n apply(zodSchema, schema) {\n var _a;\n const arraySchema = schema;\n if (arraySchema.contains === void 0) return zodSchema;\n const containsSchema = convertJsonSchemaToZod(arraySchema.contains);\n const minContains = (_a = arraySchema.minContains) != null ? _a : 1;\n const maxContains = arraySchema.maxContains;\n return zodSchema.refine(\n (value) => {\n if (!Array.isArray(value)) {\n return true;\n }\n let matchCount = 0;\n for (const item of value) {\n if (isValidWithSchema(containsSchema, item)) {\n matchCount++;\n }\n }\n if (matchCount < minContains) {\n return false;\n }\n if (maxContains !== void 0 && matchCount > maxContains) {\n return false;\n }\n return true;\n },\n { message: \"Array must contain required items matching the schema\" }\n );\n }\n};\n\n// src/handlers/refinement/default.ts\nvar DefaultHandler = class {\n apply(zodSchema, schema) {\n const { default: v } = schema;\n if (v === void 0) return zodSchema;\n if (!zodSchema.safeParse(v).success) {\n return zodSchema;\n }\n return zodSchema.default(v);\n }\n};\n\n// src/core/converter.ts\nvar primitiveHandlers = [\n // Type constraints - should run first\n new ConstHandler(),\n new EnumHandler(),\n new TypeHandler(),\n // File schema detection - must run before string constraints\n new FileHandler(),\n // Implicit type detection - must run before other constraints\n new ImplicitStringHandler(),\n new ImplicitArrayHandler(),\n new ImplicitObjectHandler(),\n // String constraints\n new MinLengthHandler(),\n new MaxLengthHandler(),\n new PatternHandler(),\n // Number constraints\n new MinimumHandler(),\n new MaximumHandler(),\n new ExclusiveMinimumHandler(),\n new ExclusiveMaximumHandler(),\n new MultipleOfHandler(),\n // Array constraints - TupleHandler must run before ItemsHandler\n new TupleHandler(),\n new MinItemsHandler(),\n new MaxItemsHandler(),\n new ItemsHandler(),\n // Object constraints\n new MaxPropertiesHandler(),\n new MinPropertiesHandler(),\n new PropertiesHandler()\n];\nvar refinementHandlers = [\n // Handle special cases first\n new ProtoRequiredHandler(),\n new EnumComplexHandler(),\n new ConstComplexHandler(),\n // Logical combinations\n new AllOfHandler(),\n new AnyOfHandler(),\n new OneOfHandler(),\n // Type-specific refinements\n new PrefixItemsHandler(),\n new ObjectPropertiesHandler(),\n // Array refinements\n new ContainsHandler(),\n // Other refinements\n new NotHandler(),\n new UniqueItemsHandler(),\n new DefaultHandler(),\n // Metadata last\n new MetadataHandler()\n];\nfunction convertJsonSchemaToZod(schema) {\n if (typeof schema === \"boolean\") {\n return schema ? z14.any() : z14.never();\n }\n const types = {};\n for (const handler of primitiveHandlers) {\n handler.apply(types, schema);\n }\n const allowedSchemas = [];\n if (types.string !== false) {\n allowedSchemas.push(types.string || z14.string());\n }\n if (types.number !== false) {\n allowedSchemas.push(types.number || z14.number());\n }\n if (types.boolean !== false) {\n allowedSchemas.push(types.boolean || z14.boolean());\n }\n if (types.null !== false) {\n allowedSchemas.push(types.null || z14.null());\n }\n if (types.array !== false) {\n allowedSchemas.push(types.array || z14.array(z14.any()));\n }\n if (types.tuple !== false && types.tuple !== void 0) {\n allowedSchemas.push(types.tuple);\n }\n if (types.object !== false) {\n if (types.object) {\n allowedSchemas.push(types.object);\n } else {\n const objectSchema = z14.custom((val) => {\n return typeof val === \"object\" && val !== null && !Array.isArray(val);\n }, \"Must be an object, not an array\");\n allowedSchemas.push(objectSchema);\n }\n }\n if (types.file !== false && types.file !== void 0) {\n allowedSchemas.push(types.file);\n }\n let zodSchema;\n if (allowedSchemas.length === 0) {\n zodSchema = z14.never();\n } else if (allowedSchemas.length === 1) {\n zodSchema = allowedSchemas[0];\n } else {\n const hasConstraints = Object.keys(schema).some(\n (key) => key !== \"$schema\" && key !== \"title\" && key !== \"description\"\n );\n if (!hasConstraints) {\n zodSchema = z14.any();\n } else {\n zodSchema = z14.union(allowedSchemas);\n }\n }\n for (const handler of refinementHandlers) {\n zodSchema = handler.apply(zodSchema, schema);\n }\n return zodSchema;\n}\n\n// src/index.ts\nfunction jsonSchemaObjectToZodRawShape(schema) {\n var _a;\n const raw = {};\n const requiredArray = Array.isArray(schema.required) ? schema.required : [];\n const requiredFields = new Set(requiredArray);\n for (const [key, value] of Object.entries((_a = schema.properties) != null ? _a : {})) {\n if (value === void 0) continue;\n let zodType = convertJsonSchemaToZod(value);\n if (requiredArray.length > 0) {\n if (!requiredFields.has(key)) {\n zodType = zodType.optional();\n }\n } else {\n zodType = zodType.optional();\n }\n raw[key] = zodType;\n }\n return raw;\n}\nexport {\n convertJsonSchemaToZod,\n createUniqueItemsValidator,\n isValidWithSchema,\n jsonSchemaObjectToZodRawShape\n};\n","import { r as __toESM$1, t as require_json_schema_traverse } from \"./json-schema-traverse-B35mHRM8.js\";\nimport { ensureAllPropertiesRequired, prepareJsonSchemaForOpenAIStrictMode, zodToJsonSchema as zodToJsonSchema$1 } from \"./zod-to-json.js\";\nimport { a as standardSchemaToJSONSchema, i as isStandardSchemaWithJSON, n as isStandardJSONSchema, o as toStandardSchema, r as isStandardSchema, t as JSON_SCHEMA_LIBRARY_OPTIONS } from \"./schema-Bv9OdW1f.js\";\nimport { ZodArray, ZodDate, ZodDefault, ZodFirstPartyTypeKind, ZodIntersection, ZodNull, ZodNullable, ZodNumber, ZodObject, ZodOptional, ZodString, ZodUnion, z } from \"zod/v3\";\nimport { z as z$1 } from \"zod\";\nimport { convertJsonSchemaToZod } from \"zod-from-json-schema\";\nimport { convertJsonSchemaToZod as convertJsonSchemaToZod$1 } from \"zod-from-json-schema-v3\";\nimport { ZodArray as ZodArray$1, ZodDate as ZodDate$1, ZodDefault as ZodDefault$1, ZodIntersection as ZodIntersection$1, ZodNull as ZodNull$1, ZodNullable as ZodNullable$1, ZodNumber as ZodNumber$1, ZodObject as ZodObject$1, ZodOptional as ZodOptional$1, ZodString as ZodString$1, ZodUnion as ZodUnion$1, z as z$2 } from \"zod/v4\";\n//#region ../_vendored/ai_v4/dist/dist-Cm5DZgxA.js\nvar marker$1 = \"vercel.ai.error\";\nvar symbol$1 = Symbol.for(marker$1);\nvar _a$1;\nvar _AISDKError = class _AISDKError extends Error {\n\t/**\n\t* Creates an AI SDK Error.\n\t*\n\t* @param {Object} params - The parameters for creating the error.\n\t* @param {string} params.name - The name of the error.\n\t* @param {string} params.message - The error message.\n\t* @param {unknown} [params.cause] - The underlying cause of the error.\n\t*/\n\tconstructor({ name: name14, message, cause }) {\n\t\tsuper(message);\n\t\tthis[_a$1] = true;\n\t\tthis.name = name14;\n\t\tthis.cause = cause;\n\t}\n\t/**\n\t* Checks if the given error is an AI SDK Error.\n\t* @param {unknown} error - The error to check.\n\t* @returns {boolean} True if the error is an AI SDK Error, false otherwise.\n\t*/\n\tstatic isInstance(error) {\n\t\treturn _AISDKError.hasMarker(error, marker$1);\n\t}\n\tstatic hasMarker(error, marker15) {\n\t\tconst markerSymbol = Symbol.for(marker15);\n\t\treturn error != null && typeof error === \"object\" && markerSymbol in error && typeof error[markerSymbol] === \"boolean\" && error[markerSymbol] === true;\n\t}\n};\n_a$1 = symbol$1;\nvar AISDKError = _AISDKError;\nfunction getErrorMessage(error) {\n\tif (error == null) return \"unknown error\";\n\tif (typeof error === \"string\") return error;\n\tif (error instanceof Error) return error.message;\n\treturn JSON.stringify(error);\n}\nvar name3$1 = \"AI_InvalidArgumentError\";\nvar marker4$1 = `vercel.ai.error.${name3$1}`;\nvar symbol4$1 = Symbol.for(marker4$1);\nvar _a4$1;\nvar InvalidArgumentError = class extends AISDKError {\n\tconstructor({ message, cause, argument }) {\n\t\tsuper({\n\t\t\tname: name3$1,\n\t\t\tmessage,\n\t\t\tcause\n\t\t});\n\t\tthis[_a4$1] = true;\n\t\tthis.argument = argument;\n\t}\n\tstatic isInstance(error) {\n\t\treturn AISDKError.hasMarker(error, marker4$1);\n\t}\n};\n_a4$1 = symbol4$1;\nvar name6$1 = \"AI_JSONParseError\";\nvar marker7$1 = `vercel.ai.error.${name6$1}`;\nvar symbol7$1 = Symbol.for(marker7$1);\nvar _a7$1;\nvar JSONParseError = class extends AISDKError {\n\tconstructor({ text, cause }) {\n\t\tsuper({\n\t\t\tname: name6$1,\n\t\t\tmessage: `JSON parsing failed: Text: ${text}.\nError message: ${getErrorMessage(cause)}`,\n\t\t\tcause\n\t\t});\n\t\tthis[_a7$1] = true;\n\t\tthis.text = text;\n\t}\n\tstatic isInstance(error) {\n\t\treturn AISDKError.hasMarker(error, marker7$1);\n\t}\n};\n_a7$1 = symbol7$1;\nvar name12$1 = \"AI_TypeValidationError\";\nvar marker13$1 = `vercel.ai.error.${name12$1}`;\nvar symbol13$1 = Symbol.for(marker13$1);\nvar _a13$1;\nvar _TypeValidationError = class _TypeValidationError extends AISDKError {\n\tconstructor({ value, cause }) {\n\t\tsuper({\n\t\t\tname: name12$1,\n\t\t\tmessage: `Type validation failed: Value: ${JSON.stringify(value)}.\nError message: ${getErrorMessage(cause)}`,\n\t\t\tcause\n\t\t});\n\t\tthis[_a13$1] = true;\n\t\tthis.value = value;\n\t}\n\tstatic isInstance(error) {\n\t\treturn AISDKError.hasMarker(error, marker13$1);\n\t}\n\t/**\n\t* Wraps an error into a TypeValidationError.\n\t* If the cause is already a TypeValidationError with the same value, it returns the cause.\n\t* Otherwise, it creates a new TypeValidationError.\n\t*\n\t* @param {Object} params - The parameters for wrapping the error.\n\t* @param {unknown} params.value - The value that failed validation.\n\t* @param {unknown} params.cause - The original error or cause of the validation failure.\n\t* @returns {TypeValidationError} A TypeValidationError instance.\n\t*/\n\tstatic wrap({ value, cause }) {\n\t\treturn _TypeValidationError.isInstance(cause) && cause.value === value ? cause : new _TypeValidationError({\n\t\t\tvalue,\n\t\t\tcause\n\t\t});\n\t}\n};\n_a13$1 = symbol13$1;\nvar TypeValidationError = _TypeValidationError;\n//#endregion\n//#region ../_vendored/ai_v4/dist/index.js\nvar __create = Object.create;\nvar __defProp$1 = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __getProtoOf = Object.getPrototypeOf;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod), cb = null), mod.exports);\nvar __copyProps = (to, from, except, desc) => {\n\tif (from && typeof from === \"object\" || typeof from === \"function\") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {\n\t\tkey = keys[i];\n\t\tif (!__hasOwnProp.call(to, key) && key !== except) __defProp$1(to, key, {\n\t\t\tget: ((k) => from[k]).bind(null, key),\n\t\t\tenumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable\n\t\t});\n\t}\n\treturn to;\n};\nvar __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp$1(target, \"default\", {\n\tvalue: mod,\n\tenumerable: true\n}) : target, mod));\nlet customAlphabet = (alphabet, defaultSize = 21) => {\n\treturn (size = defaultSize) => {\n\t\tlet id = \"\";\n\t\tlet i = size | 0;\n\t\twhile (i--) id += alphabet[Math.random() * alphabet.length | 0];\n\t\treturn id;\n\t};\n};\nvar import_secure_json_parse = /* @__PURE__ */ __toESM((/* @__PURE__ */ __commonJSMin(((exports, module) => {\n\tconst hasBuffer = typeof Buffer !== \"undefined\";\n\tconst suspectProtoRx = /\"(?:_|\\\\u005[Ff])(?:_|\\\\u005[Ff])(?:p|\\\\u0070)(?:r|\\\\u0072)(?:o|\\\\u006[Ff])(?:t|\\\\u0074)(?:o|\\\\u006[Ff])(?:_|\\\\u005[Ff])(?:_|\\\\u005[Ff])\"\\s*:/;\n\tconst suspectConstructorRx = /\"(?:c|\\\\u0063)(?:o|\\\\u006[Ff])(?:n|\\\\u006[Ee])(?:s|\\\\u0073)(?:t|\\\\u0074)(?:r|\\\\u0072)(?:u|\\\\u0075)(?:c|\\\\u0063)(?:t|\\\\u0074)(?:o|\\\\u006[Ff])(?:r|\\\\u0072)\"\\s*:/;\n\tfunction _parse(text, reviver, options) {\n\t\tif (options == null) {\n\t\t\tif (reviver !== null && typeof reviver === \"object\") {\n\t\t\t\toptions = reviver;\n\t\t\t\treviver = void 0;\n\t\t\t}\n\t\t}\n\t\tif (hasBuffer && Buffer.isBuffer(text)) text = text.toString();\n\t\tif (text && text.charCodeAt(0) === 65279) text = text.slice(1);\n\t\tconst obj = JSON.parse(text, reviver);\n\t\tif (obj === null || typeof obj !== \"object\") return obj;\n\t\tconst protoAction = options && options.protoAction || \"error\";\n\t\tconst constructorAction = options && options.constructorAction || \"error\";\n\t\tif (protoAction === \"ignore\" && constructorAction === \"ignore\") return obj;\n\t\tif (protoAction !== \"ignore\" && constructorAction !== \"ignore\") {\n\t\t\tif (suspectProtoRx.test(text) === false && suspectConstructorRx.test(text) === false) return obj;\n\t\t} else if (protoAction !== \"ignore\" && constructorAction === \"ignore\") {\n\t\t\tif (suspectProtoRx.test(text) === false) return obj;\n\t\t} else if (suspectConstructorRx.test(text) === false) return obj;\n\t\treturn filter(obj, {\n\t\t\tprotoAction,\n\t\t\tconstructorAction,\n\t\t\tsafe: options && options.safe\n\t\t});\n\t}\n\tfunction filter(obj, { protoAction = \"error\", constructorAction = \"error\", safe } = {}) {\n\t\tlet next = [obj];\n\t\twhile (next.length) {\n\t\t\tconst nodes = next;\n\t\t\tnext = [];\n\t\t\tfor (const node of nodes) {\n\t\t\t\tif (protoAction !== \"ignore\" && Object.prototype.hasOwnProperty.call(node, \"__proto__\")) {\n\t\t\t\t\tif (safe === true) return null;\n\t\t\t\t\telse if (protoAction === \"error\") throw new SyntaxError(\"Object contains forbidden prototype property\");\n\t\t\t\t\tdelete node.__proto__;\n\t\t\t\t}\n\t\t\t\tif (constructorAction !== \"ignore\" && Object.prototype.hasOwnProperty.call(node, \"constructor\") && Object.prototype.hasOwnProperty.call(node.constructor, \"prototype\")) {\n\t\t\t\t\tif (safe === true) return null;\n\t\t\t\t\telse if (constructorAction === \"error\") throw new SyntaxError(\"Object contains forbidden prototype property\");\n\t\t\t\t\tdelete node.constructor;\n\t\t\t\t}\n\t\t\t\tfor (const key in node) {\n\t\t\t\t\tconst value = node[key];\n\t\t\t\t\tif (value && typeof value === \"object\") next.push(value);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn obj;\n\t}\n\tfunction parse(text, reviver, options) {\n\t\tconst stackTraceLimit = Error.stackTraceLimit;\n\t\tError.stackTraceLimit = 0;\n\t\ttry {\n\t\t\treturn _parse(text, reviver, options);\n\t\t} finally {\n\t\t\tError.stackTraceLimit = stackTraceLimit;\n\t\t}\n\t}\n\tfunction safeParse(text, reviver) {\n\t\tconst stackTraceLimit = Error.stackTraceLimit;\n\t\tError.stackTraceLimit = 0;\n\t\ttry {\n\t\t\treturn _parse(text, reviver, { safe: true });\n\t\t} catch (_e) {\n\t\t\treturn null;\n\t\t} finally {\n\t\t\tError.stackTraceLimit = stackTraceLimit;\n\t\t}\n\t}\n\tmodule.exports = parse;\n\tmodule.exports.default = parse;\n\tmodule.exports.parse = parse;\n\tmodule.exports.safeParse = safeParse;\n\tmodule.exports.scan = filter;\n})))(), 1);\nfunction convertAsyncIteratorToReadableStream(iterator) {\n\treturn new ReadableStream({\n\t\t/**\n\t\t* Called when the consumer wants to pull more data from the stream.\n\t\t*\n\t\t* @param {ReadableStreamDefaultController<T>} controller - The controller to enqueue data into the stream.\n\t\t* @returns {Promise<void>}\n\t\t*/\n\t\tasync pull(controller) {\n\t\t\ttry {\n\t\t\t\tconst { value, done } = await iterator.next();\n\t\t\t\tif (done) controller.close();\n\t\t\t\telse controller.enqueue(value);\n\t\t\t} catch (error) {\n\t\t\t\tcontroller.error(error);\n\t\t\t}\n\t\t},\n\t\t/**\n\t\t* Called when the consumer cancels the stream.\n\t\t*/\n\t\tcancel() {}\n\t});\n}\nvar createIdGenerator = ({ prefix, size: defaultSize = 16, alphabet = \"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz\", separator = \"-\" } = {}) => {\n\tconst generator = customAlphabet(alphabet, defaultSize);\n\tif (prefix == null) return generator;\n\tif (alphabet.includes(separator)) throw new InvalidArgumentError({\n\t\targument: \"separator\",\n\t\tmessage: `The separator \"${separator}\" must not be part of the alphabet \"${alphabet}\".`\n\t});\n\treturn (size) => `${prefix}${separator}${generator(size)}`;\n};\ncreateIdGenerator();\nvar validatorSymbol = Symbol.for(\"vercel.ai.validator\");\nfunction validator(validate) {\n\treturn {\n\t\t[validatorSymbol]: true,\n\t\tvalidate\n\t};\n}\nfunction isValidator(value) {\n\treturn typeof value === \"object\" && value !== null && validatorSymbol in value && value[validatorSymbol] === true && \"validate\" in value;\n}\nfunction asValidator(value) {\n\treturn isValidator(value) ? value : zodValidator(value);\n}\nfunction zodValidator(zodSchema) {\n\treturn validator((value) => {\n\t\tconst result = zodSchema.safeParse(value);\n\t\treturn result.success ? {\n\t\t\tsuccess: true,\n\t\t\tvalue: result.data\n\t\t} : {\n\t\t\tsuccess: false,\n\t\t\terror: result.error\n\t\t};\n\t});\n}\nfunction safeValidateTypes({ value, schema }) {\n\tconst validator2 = asValidator(schema);\n\ttry {\n\t\tif (validator2.validate == null) return {\n\t\t\tsuccess: true,\n\t\t\tvalue\n\t\t};\n\t\tconst result = validator2.validate(value);\n\t\tif (result.success) return result;\n\t\treturn {\n\t\t\tsuccess: false,\n\t\t\terror: TypeValidationError.wrap({\n\t\t\t\tvalue,\n\t\t\t\tcause: result.error\n\t\t\t})\n\t\t};\n\t} catch (error) {\n\t\treturn {\n\t\t\tsuccess: false,\n\t\t\terror: TypeValidationError.wrap({\n\t\t\t\tvalue,\n\t\t\t\tcause: error\n\t\t\t})\n\t\t};\n\t}\n}\nfunction safeParseJSON({ text, schema }) {\n\ttry {\n\t\tconst value = import_secure_json_parse.default.parse(text);\n\t\tif (schema == null) return {\n\t\t\tsuccess: true,\n\t\t\tvalue,\n\t\t\trawValue: value\n\t\t};\n\t\tconst validationResult = safeValidateTypes({\n\t\t\tvalue,\n\t\t\tschema\n\t\t});\n\t\treturn validationResult.success ? {\n\t\t\t...validationResult,\n\t\t\trawValue: value\n\t\t} : validationResult;\n\t} catch (error) {\n\t\treturn {\n\t\t\tsuccess: false,\n\t\t\terror: JSONParseError.isInstance(error) ? error : new JSONParseError({\n\t\t\t\ttext,\n\t\t\t\tcause: error\n\t\t\t})\n\t\t};\n\t}\n}\nvar { btoa, atob } = globalThis;\nconst ignoreOverride = Symbol(\"Let zodToJsonSchema decide on which parser to use\");\nconst defaultOptions = {\n\tname: void 0,\n\t$refStrategy: \"root\",\n\tbasePath: [\"#\"],\n\teffectStrategy: \"input\",\n\tpipeStrategy: \"all\",\n\tdateStrategy: \"format:date-time\",\n\tmapStrategy: \"entries\",\n\tremoveAdditionalStrategy: \"passthrough\",\n\tallowedAdditionalProperties: true,\n\trejectedAdditionalProperties: false,\n\tdefinitionPath: \"definitions\",\n\ttarget: \"jsonSchema7\",\n\tstrictUnions: false,\n\tdefinitions: {},\n\terrorMessages: false,\n\tmarkdownDescription: false,\n\tpatternStrategy: \"escape\",\n\tapplyRegexFlags: false,\n\temailStrategy: \"format:email\",\n\tbase64Strategy: \"contentEncoding:base64\",\n\tnameStrategy: \"ref\",\n\topenAiAnyTypeName: \"OpenAiAnyType\"\n};\nconst getDefaultOptions = (options) => typeof options === \"string\" ? {\n\t...defaultOptions,\n\tname: options\n} : {\n\t...defaultOptions,\n\t...options\n};\nconst getRefs = (options) => {\n\tconst _options = getDefaultOptions(options);\n\tconst currentPath = _options.name !== void 0 ? [\n\t\t..._options.basePath,\n\t\t_options.definitionPath,\n\t\t_options.name\n\t] : _options.basePath;\n\treturn {\n\t\t..._options,\n\t\tflags: { hasReferencedOpenAiAnyType: false },\n\t\tcurrentPath,\n\t\tpropertyPath: void 0,\n\t\tseen: new Map(Object.entries(_options.definitions).map(([name, def]) => [def._def, {\n\t\t\tdef: def._def,\n\t\t\tpath: [\n\t\t\t\t..._options.basePath,\n\t\t\t\t_options.definitionPath,\n\t\t\t\tname\n\t\t\t],\n\t\t\tjsonSchema: void 0\n\t\t}]))\n\t};\n};\nfunction addErrorMessage(res, key, errorMessage, refs) {\n\tif (!refs?.errorMessages) return;\n\tif (errorMessage) res.errorMessage = {\n\t\t...res.errorMessage,\n\t\t[key]: errorMessage\n\t};\n}\nfunction setResponseValueAndErrors(res, key, value, errorMessage, refs) {\n\tres[key] = value;\n\taddErrorMessage(res, key, errorMessage, refs);\n}\nconst getRelativePath = (pathA, pathB) => {\n\tlet i = 0;\n\tfor (; i < pathA.length && i < pathB.length; i++) if (pathA[i] !== pathB[i]) break;\n\treturn [(pathA.length - i).toString(), ...pathB.slice(i)].join(\"/\");\n};\nfunction parseAnyDef(refs) {\n\tif (refs.target !== \"openAi\") return {};\n\tconst anyDefinitionPath = [\n\t\t...refs.basePath,\n\t\trefs.definitionPath,\n\t\trefs.openAiAnyTypeName\n\t];\n\trefs.flags.hasReferencedOpenAiAnyType = true;\n\treturn { $ref: refs.$refStrategy === \"relative\" ? getRelativePath(anyDefinitionPath, refs.currentPath) : anyDefinitionPath.join(\"/\") };\n}\nfunction parseArrayDef(def, refs) {\n\tconst res = { type: \"array\" };\n\tif (def.type?._def && def.type?._def?.typeName !== ZodFirstPartyTypeKind.ZodAny) res.items = parseDef(def.type._def, {\n\t\t...refs,\n\t\tcurrentPath: [...refs.currentPath, \"items\"]\n\t});\n\tif (def.minLength) setResponseValueAndErrors(res, \"minItems\", def.minLength.value, def.minLength.message, refs);\n\tif (def.maxLength) setResponseValueAndErrors(res, \"maxItems\", def.maxLength.value, def.maxLength.message, refs);\n\tif (def.exactLength) {\n\t\tsetResponseValueAndErrors(res, \"minItems\", def.exactLength.value, def.exactLength.message, refs);\n\t\tsetResponseValueAndErrors(res, \"maxItems\", def.exactLength.value, def.exactLength.message, refs);\n\t}\n\treturn res;\n}\nfunction parseBigintDef(def, refs) {\n\tconst res = {\n\t\ttype: \"integer\",\n\t\tformat: \"int64\"\n\t};\n\tif (!def.checks) return res;\n\tfor (const check of def.checks) switch (check.kind) {\n\t\tcase \"min\":\n\t\t\tif (refs.target === \"jsonSchema7\") if (check.inclusive) setResponseValueAndErrors(res, \"minimum\", check.value, check.message, refs);\n\t\t\telse setResponseValueAndErrors(res, \"exclusiveMinimum\", check.value, check.message, refs);\n\t\t\telse {\n\t\t\t\tif (!check.inclusive) res.exclusiveMinimum = true;\n\t\t\t\tsetResponseValueAndErrors(res, \"minimum\", check.value, check.message, refs);\n\t\t\t}\n\t\t\tbreak;\n\t\tcase \"max\":\n\t\t\tif (refs.target === \"jsonSchema7\") if (check.inclusive) setResponseValueAndErrors(res, \"maximum\", check.value, check.message, refs);\n\t\t\telse setResponseValueAndErrors(res, \"exclusiveMaximum\", check.value, check.message, refs);\n\t\t\telse {\n\t\t\t\tif (!check.inclusive) res.exclusiveMaximum = true;\n\t\t\t\tsetResponseValueAndErrors(res, \"maximum\", check.value, check.message, refs);\n\t\t\t}\n\t\t\tbreak;\n\t\tcase \"multipleOf\":\n\t\t\tsetResponseValueAndErrors(res, \"multipleOf\", check.value, check.message, refs);\n\t\t\tbreak;\n\t}\n\treturn res;\n}\nfunction parseBooleanDef() {\n\treturn { type: \"boolean\" };\n}\nfunction parseBrandedDef(_def, refs) {\n\treturn parseDef(_def.type._def, refs);\n}\nconst parseCatchDef = (def, refs) => {\n\treturn parseDef(def.innerType._def, refs);\n};\nfunction parseDateDef(def, refs, overrideDateStrategy) {\n\tconst strategy = overrideDateStrategy ?? refs.dateStrategy;\n\tif (Array.isArray(strategy)) return { anyOf: strategy.map((item, i) => parseDateDef(def, refs, item)) };\n\tswitch (strategy) {\n\t\tcase \"string\":\n\t\tcase \"format:date-time\": return {\n\t\t\ttype: \"string\",\n\t\t\tformat: \"date-time\"\n\t\t};\n\t\tcase \"format:date\": return {\n\t\t\ttype: \"string\",\n\t\t\tformat: \"date\"\n\t\t};\n\t\tcase \"integer\": return integerDateParser(def, refs);\n\t}\n}\nconst integerDateParser = (def, refs) => {\n\tconst res = {\n\t\ttype: \"integer\",\n\t\tformat: \"unix-time\"\n\t};\n\tif (refs.target === \"openApi3\") return res;\n\tfor (const check of def.checks) switch (check.kind) {\n\t\tcase \"min\":\n\t\t\tsetResponseValueAndErrors(res, \"minimum\", check.value, check.message, refs);\n\t\t\tbreak;\n\t\tcase \"max\":\n\t\t\tsetResponseValueAndErrors(res, \"maximum\", check.value, check.message, refs);\n\t\t\tbreak;\n\t}\n\treturn res;\n};\nfunction parseDefaultDef(_def, refs) {\n\treturn {\n\t\t...parseDef(_def.innerType._def, refs),\n\t\tdefault: _def.defaultValue()\n\t};\n}\nfunction parseEffectsDef(_def, refs) {\n\treturn refs.effectStrategy === \"input\" ? parseDef(_def.schema._def, refs) : parseAnyDef(refs);\n}\nfunction parseEnumDef(def) {\n\treturn {\n\t\ttype: \"string\",\n\t\tenum: Array.from(def.values)\n\t};\n}\nconst isJsonSchema7AllOfType = (type) => {\n\tif (\"type\" in type && type.type === \"string\") return false;\n\treturn \"allOf\" in type;\n};\nfunction parseIntersectionDef(def, refs) {\n\tconst allOf = [parseDef(def.left._def, {\n\t\t...refs,\n\t\tcurrentPath: [\n\t\t\t...refs.currentPath,\n\t\t\t\"allOf\",\n\t\t\t\"0\"\n\t\t]\n\t}), parseDef(def.right._def, {\n\t\t...refs,\n\t\tcurrentPath: [\n\t\t\t...refs.currentPath,\n\t\t\t\"allOf\",\n\t\t\t\"1\"\n\t\t]\n\t})].filter((x) => !!x);\n\tlet unevaluatedProperties = refs.target === \"jsonSchema2019-09\" ? { unevaluatedProperties: false } : void 0;\n\tconst mergedAllOf = [];\n\tallOf.forEach((schema) => {\n\t\tif (isJsonSchema7AllOfType(schema)) {\n\t\t\tmergedAllOf.push(...schema.allOf);\n\t\t\tif (schema.unevaluatedProperties === void 0) unevaluatedProperties = void 0;\n\t\t} else {\n\t\t\tlet nestedSchema = schema;\n\t\t\tif (\"additionalProperties\" in schema && schema.additionalProperties === false) {\n\t\t\t\tconst { additionalProperties, ...rest } = schema;\n\t\t\t\tnestedSchema = rest;\n\t\t\t} else unevaluatedProperties = void 0;\n\t\t\tmergedAllOf.push(nestedSchema);\n\t\t}\n\t});\n\treturn mergedAllOf.length ? {\n\t\tallOf: mergedAllOf,\n\t\t...unevaluatedProperties\n\t} : void 0;\n}\nfunction parseLiteralDef(def, refs) {\n\tconst parsedType = typeof def.value;\n\tif (parsedType !== \"bigint\" && parsedType !== \"number\" && parsedType !== \"boolean\" && parsedType !== \"string\") return { type: Array.isArray(def.value) ? \"array\" : \"object\" };\n\tif (refs.target === \"openApi3\") return {\n\t\ttype: parsedType === \"bigint\" ? \"integer\" : parsedType,\n\t\tenum: [def.value]\n\t};\n\treturn {\n\t\ttype: parsedType === \"bigint\" ? \"integer\" : parsedType,\n\t\tconst: def.value\n\t};\n}\nlet emojiRegex = void 0;\n/**\n* Generated from the regular expressions found here as of 2024-05-22:\n* https://github.com/colinhacks/zod/blob/master/src/types.ts.\n*\n* Expressions with /i flag have been changed accordingly.\n*/\nconst zodPatterns = {\n\t/**\n\t* `c` was changed to `[cC]` to replicate /i flag\n\t*/\n\tcuid: /^[cC][^\\s-]{8,}$/,\n\tcuid2: /^[0-9a-z]+$/,\n\tulid: /^[0-9A-HJKMNP-TV-Z]{26}$/,\n\t/**\n\t* `a-z` was added to replicate /i flag\n\t*/\n\temail: /^(?!\\.)(?!.*\\.\\.)([a-zA-Z0-9_'+\\-\\.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9\\-]*\\.)+[a-zA-Z]{2,}$/,\n\t/**\n\t* Constructed a valid Unicode RegExp\n\t*\n\t* Lazily instantiate since this type of regex isn't supported\n\t* in all envs (e.g. React Native).\n\t*\n\t* See:\n\t* https://github.com/colinhacks/zod/issues/2433\n\t* Fix in Zod:\n\t* https://github.com/colinhacks/zod/commit/9340fd51e48576a75adc919bff65dbc4a5d4c99b\n\t*/\n\temoji: () => {\n\t\tif (emojiRegex === void 0) emojiRegex = RegExp(\"^(\\\\p{Extended_Pictographic}|\\\\p{Emoji_Component})+$\", \"u\");\n\t\treturn emojiRegex;\n\t},\n\t/**\n\t* Unused\n\t*/\n\tuuid: /^[0-9a-fA-F]{8}\\b-[0-9a-fA-F]{4}\\b-[0-9a-fA-F]{4}\\b-[0-9a-fA-F]{4}\\b-[0-9a-fA-F]{12}$/,\n\t/**\n\t* Unused\n\t*/\n\tipv4: /^(?:(?: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])$/,\n\tipv4Cidr: /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\\/(3[0-2]|[12]?[0-9])$/,\n\t/**\n\t* Unused\n\t*/\n\tipv6: /^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,\n\tipv6Cidr: /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,\n\tbase64: /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,\n\tbase64url: /^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,\n\tnanoid: /^[a-zA-Z0-9_-]{21}$/,\n\tjwt: /^[A-Za-z0-9-_]+\\.[A-Za-z0-9-_]+\\.[A-Za-z0-9-_]*$/\n};\nfunction parseStringDef(def, refs) {\n\tconst res = { type: \"string\" };\n\tif (def.checks) for (const check of def.checks) switch (check.kind) {\n\t\tcase \"min\":\n\t\t\tsetResponseValueAndErrors(res, \"minLength\", typeof res.minLength === \"number\" ? Math.max(res.minLength, check.value) : check.value, check.message, refs);\n\t\t\tbreak;\n\t\tcase \"max\":\n\t\t\tsetResponseValueAndErrors(res, \"maxLength\", typeof res.maxLength === \"number\" ? Math.min(res.maxLength, check.value) : check.value, check.message, refs);\n\t\t\tbreak;\n\t\tcase \"email\":\n\t\t\tswitch (refs.emailStrategy) {\n\t\t\t\tcase \"format:email\":\n\t\t\t\t\taddFormat(res, \"email\", check.message, refs);\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"format:idn-email\":\n\t\t\t\t\taddFormat(res, \"idn-email\", check.message, refs);\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"pattern:zod\":\n\t\t\t\t\taddPattern(res, zodPatterns.email, check.message, refs);\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t\tbreak;\n\t\tcase \"url\":\n\t\t\taddFormat(res, \"uri\", check.message, refs);\n\t\t\tbreak;\n\t\tcase \"uuid\":\n\t\t\taddFormat(res, \"uuid\", check.message, refs);\n\t\t\tbreak;\n\t\tcase \"regex\":\n\t\t\taddPattern(res, check.regex, check.message, refs);\n\t\t\tbreak;\n\t\tcase \"cuid\":\n\t\t\taddPattern(res, zodPatterns.cuid, check.message, refs);\n\t\t\tbreak;\n\t\tcase \"cuid2\":\n\t\t\taddPattern(res, zodPatterns.cuid2, check.message, refs);\n\t\t\tbreak;\n\t\tcase \"startsWith\":\n\t\t\taddPattern(res, RegExp(`^${escapeLiteralCheckValue(check.value, refs)}`), check.message, refs);\n\t\t\tbreak;\n\t\tcase \"endsWith\":\n\t\t\taddPattern(res, RegExp(`${escapeLiteralCheckValue(check.value, refs)}$`), check.message, refs);\n\t\t\tbreak;\n\t\tcase \"datetime\":\n\t\t\taddFormat(res, \"date-time\", check.message, refs);\n\t\t\tbreak;\n\t\tcase \"date\":\n\t\t\taddFormat(res, \"date\", check.message, refs);\n\t\t\tbreak;\n\t\tcase \"time\":\n\t\t\taddFormat(res, \"time\", check.message, refs);\n\t\t\tbreak;\n\t\tcase \"duration\":\n\t\t\taddFormat(res, \"duration\", check.message, refs);\n\t\t\tbreak;\n\t\tcase \"length\":\n\t\t\tsetResponseValueAndErrors(res, \"minLength\", typeof res.minLength === \"number\" ? Math.max(res.minLength, check.value) : check.value, check.message, refs);\n\t\t\tsetResponseValueAndErrors(res, \"maxLength\", typeof res.maxLength === \"number\" ? Math.min(res.maxLength, check.value) : check.value, check.message, refs);\n\t\t\tbreak;\n\t\tcase \"includes\":\n\t\t\taddPattern(res, RegExp(escapeLiteralCheckValue(check.value, refs)), check.message, refs);\n\t\t\tbreak;\n\t\tcase \"ip\":\n\t\t\tif (check.version !== \"v6\") addFormat(res, \"ipv4\", check.message, refs);\n\t\t\tif (check.version !== \"v4\") addFormat(res, \"ipv6\", check.message, refs);\n\t\t\tbreak;\n\t\tcase \"base64url\":\n\t\t\taddPattern(res, zodPatterns.base64url, check.message, refs);\n\t\t\tbreak;\n\t\tcase \"jwt\":\n\t\t\taddPattern(res, zodPatterns.jwt, check.message, refs);\n\t\t\tbreak;\n\t\tcase \"cidr\":\n\t\t\tif (check.version !== \"v6\") addPattern(res, zodPatterns.ipv4Cidr, check.message, refs);\n\t\t\tif (check.version !== \"v4\") addPattern(res, zodPatterns.ipv6Cidr, check.message, refs);\n\t\t\tbreak;\n\t\tcase \"emoji\":\n\t\t\taddPattern(res, zodPatterns.emoji(), check.message, refs);\n\t\t\tbreak;\n\t\tcase \"ulid\":\n\t\t\taddPattern(res, zodPatterns.ulid, check.message, refs);\n\t\t\tbreak;\n\t\tcase \"base64\":\n\t\t\tswitch (refs.base64Strategy) {\n\t\t\t\tcase \"format:binary\":\n\t\t\t\t\taddFormat(res, \"binary\", check.message, refs);\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"contentEncoding:base64\":\n\t\t\t\t\tsetResponseValueAndErrors(res, \"contentEncoding\", \"base64\", check.message, refs);\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"pattern:zod\":\n\t\t\t\t\taddPattern(res, zodPatterns.base64, check.message, refs);\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t\tbreak;\n\t\tcase \"nanoid\": addPattern(res, zodPatterns.nanoid, check.message, refs);\n\t\tcase \"toLowerCase\":\n\t\tcase \"toUpperCase\":\n\t\tcase \"trim\": break;\n\t\tdefault:\n\t}\n\treturn res;\n}\nfunction escapeLiteralCheckValue(literal, refs) {\n\treturn refs.patternStrategy === \"escape\" ? escapeNonAlphaNumeric(literal) : literal;\n}\nconst ALPHA_NUMERIC = /* @__PURE__ */ new Set(\"ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789\");\nfunction escapeNonAlphaNumeric(source) {\n\tlet result = \"\";\n\tfor (let i = 0; i < source.length; i++) {\n\t\tif (!ALPHA_NUMERIC.has(source[i])) result += \"\\\\\";\n\t\tresult += source[i];\n\t}\n\treturn result;\n}\nfunction addFormat(schema, value, message, refs) {\n\tif (schema.format || schema.anyOf?.some((x) => x.format)) {\n\t\tif (!schema.anyOf) schema.anyOf = [];\n\t\tif (schema.format) {\n\t\t\tschema.anyOf.push({\n\t\t\t\tformat: schema.format,\n\t\t\t\t...schema.errorMessage && refs.errorMessages && { errorMessage: { format: schema.errorMessage.format } }\n\t\t\t});\n\t\t\tdelete schema.format;\n\t\t\tif (schema.errorMessage) {\n\t\t\t\tdelete schema.errorMessage.format;\n\t\t\t\tif (Object.keys(schema.errorMessage).length === 0) delete schema.errorMessage;\n\t\t\t}\n\t\t}\n\t\tschema.anyOf.push({\n\t\t\tformat: value,\n\t\t\t...message && refs.errorMessages && { errorMessage: { format: message } }\n\t\t});\n\t} else setResponseValueAndErrors(schema, \"format\", value, message, refs);\n}\nfunction addPattern(schema, regex, message, refs) {\n\tif (schema.pattern || schema.allOf?.some((x) => x.pattern)) {\n\t\tif (!schema.allOf) schema.allOf = [];\n\t\tif (schema.pattern) {\n\t\t\tschema.allOf.push({\n\t\t\t\tpattern: schema.pattern,\n\t\t\t\t...schema.errorMessage && refs.errorMessages && { errorMessage: { pattern: schema.errorMessage.pattern } }\n\t\t\t});\n\t\t\tdelete schema.pattern;\n\t\t\tif (schema.errorMessage) {\n\t\t\t\tdelete schema.errorMessage.pattern;\n\t\t\t\tif (Object.keys(schema.errorMessage).length === 0) delete schema.errorMessage;\n\t\t\t}\n\t\t}\n\t\tschema.allOf.push({\n\t\t\tpattern: stringifyRegExpWithFlags(regex, refs),\n\t\t\t...message && refs.errorMessages && { errorMessage: { pattern: message } }\n\t\t});\n\t} else setResponseValueAndErrors(schema, \"pattern\", stringifyRegExpWithFlags(regex, refs), message, refs);\n}\nfunction stringifyRegExpWithFlags(regex, refs) {\n\tif (!refs.applyRegexFlags || !regex.flags) return regex.source;\n\tconst flags = {\n\t\ti: regex.flags.includes(\"i\"),\n\t\tm: regex.flags.includes(\"m\"),\n\t\ts: regex.flags.includes(\"s\")\n\t};\n\tconst source = flags.i ? regex.source.toLowerCase() : regex.source;\n\tlet pattern = \"\";\n\tlet isEscaped = false;\n\tlet inCharGroup = false;\n\tlet inCharRange = false;\n\tfor (let i = 0; i < source.length; i++) {\n\t\tif (isEscaped) {\n\t\t\tpattern += source[i];\n\t\t\tisEscaped = false;\n\t\t\tcontinue;\n\t\t}\n\t\tif (flags.i) {\n\t\t\tif (inCharGroup) {\n\t\t\t\tif (source[i].match(/[a-z]/)) {\n\t\t\t\t\tif (inCharRange) {\n\t\t\t\t\t\tpattern += source[i];\n\t\t\t\t\t\tpattern += `${source[i - 2]}-${source[i]}`.toUpperCase();\n\t\t\t\t\t\tinCharRange = false;\n\t\t\t\t\t} else if (source[i + 1] === \"-\" && source[i + 2]?.match(/[a-z]/)) {\n\t\t\t\t\t\tpattern += source[i];\n\t\t\t\t\t\tinCharRange = true;\n\t\t\t\t\t} else pattern += `${source[i]}${source[i].toUpperCase()}`;\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t} else if (source[i].match(/[a-z]/)) {\n\t\t\t\tpattern += `[${source[i]}${source[i].toUpperCase()}]`;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t}\n\t\tif (flags.m) {\n\t\t\tif (source[i] === \"^\") {\n\t\t\t\tpattern += `(^|(?<=[\\r\\n]))`;\n\t\t\t\tcontinue;\n\t\t\t} else if (source[i] === \"$\") {\n\t\t\t\tpattern += `($|(?=[\\r\\n]))`;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t}\n\t\tif (flags.s && source[i] === \".\") {\n\t\t\tpattern += inCharGroup ? `${source[i]}\\r\\n` : `[${source[i]}\\r\\n]`;\n\t\t\tcontinue;\n\t\t}\n\t\tpattern += source[i];\n\t\tif (source[i] === \"\\\\\") isEscaped = true;\n\t\telse if (inCharGroup && source[i] === \"]\") inCharGroup = false;\n\t\telse if (!inCharGroup && source[i] === \"[\") inCharGroup = true;\n\t}\n\ttry {\n\t\tnew RegExp(pattern);\n\t} catch {\n\t\tconsole.warn(`Could not convert regex pattern at ${refs.currentPath.join(\"/\")} to a flag-independent form! Falling back to the flag-ignorant source`);\n\t\treturn regex.source;\n\t}\n\treturn pattern;\n}\nfunction parseRecordDef(def, refs) {\n\tif (refs.target === \"openAi\") console.warn(\"Warning: OpenAI may not support records in schemas! Try an array of key-value pairs instead.\");\n\tif (refs.target === \"openApi3\" && def.keyType?._def.typeName === ZodFirstPartyTypeKind.ZodEnum) return {\n\t\ttype: \"object\",\n\t\trequired: def.keyType._def.values,\n\t\tproperties: def.keyType._def.values.reduce((acc, key) => ({\n\t\t\t...acc,\n\t\t\t[key]: parseDef(def.valueType._def, {\n\t\t\t\t...refs,\n\t\t\t\tcurrentPath: [\n\t\t\t\t\t...refs.currentPath,\n\t\t\t\t\t\"properties\",\n\t\t\t\t\tkey\n\t\t\t\t]\n\t\t\t}) ?? parseAnyDef(refs)\n\t\t}), {}),\n\t\tadditionalProperties: refs.rejectedAdditionalProperties\n\t};\n\tconst schema = {\n\t\ttype: \"object\",\n\t\tadditionalProperties: parseDef(def.valueType._def, {\n\t\t\t...refs,\n\t\t\tcurrentPath: [...refs.currentPath, \"additionalProperties\"]\n\t\t}) ?? refs.allowedAdditionalProperties\n\t};\n\tif (refs.target === \"openApi3\") return schema;\n\tif (def.keyType?._def.typeName === ZodFirstPartyTypeKind.ZodString && def.keyType._def.checks?.length) {\n\t\tconst { type, ...keyType } = parseStringDef(def.keyType._def, refs);\n\t\treturn {\n\t\t\t...schema,\n\t\t\tpropertyNames: keyType\n\t\t};\n\t} else if (def.keyType?._def.typeName === ZodFirstPartyTypeKind.ZodEnum) return {\n\t\t...schema,\n\t\tpropertyNames: { enum: def.keyType._def.values }\n\t};\n\telse if (def.keyType?._def.typeName === ZodFirstPartyTypeKind.ZodBranded && def.keyType._def.type._def.typeName === ZodFirstPartyTypeKind.ZodString && def.keyType._def.type._def.checks?.length) {\n\t\tconst { type, ...keyType } = parseBrandedDef(def.keyType._def, refs);\n\t\treturn {\n\t\t\t...schema,\n\t\t\tpropertyNames: keyType\n\t\t};\n\t}\n\treturn schema;\n}\nfunction parseMapDef(def, refs) {\n\tif (refs.mapStrategy === \"record\") return parseRecordDef(def, refs);\n\treturn {\n\t\ttype: \"array\",\n\t\tmaxItems: 125,\n\t\titems: {\n\t\t\ttype: \"array\",\n\t\t\titems: [parseDef(def.keyType._def, {\n\t\t\t\t...refs,\n\t\t\t\tcurrentPath: [\n\t\t\t\t\t...refs.currentPath,\n\t\t\t\t\t\"items\",\n\t\t\t\t\t\"items\",\n\t\t\t\t\t\"0\"\n\t\t\t\t]\n\t\t\t}) || parseAnyDef(refs), parseDef(def.valueType._def, {\n\t\t\t\t...refs,\n\t\t\t\tcurrentPath: [\n\t\t\t\t\t...refs.currentPath,\n\t\t\t\t\t\"items\",\n\t\t\t\t\t\"items\",\n\t\t\t\t\t\"1\"\n\t\t\t\t]\n\t\t\t}) || parseAnyDef(refs)],\n\t\t\tminItems: 2,\n\t\t\tmaxItems: 2\n\t\t}\n\t};\n}\nfunction parseNativeEnumDef(def) {\n\tconst object = def.values;\n\tconst actualValues = Object.keys(def.values).filter((key) => {\n\t\treturn typeof object[object[key]] !== \"number\";\n\t}).map((key) => object[key]);\n\tconst parsedTypes = Array.from(new Set(actualValues.map((values) => typeof values)));\n\treturn {\n\t\ttype: parsedTypes.length === 1 ? parsedTypes[0] === \"string\" ? \"string\" : \"number\" : [\"string\", \"number\"],\n\t\tenum: actualValues\n\t};\n}\nfunction parseNeverDef(refs) {\n\treturn refs.target === \"openAi\" ? void 0 : { not: parseAnyDef({\n\t\t...refs,\n\t\tcurrentPath: [...refs.currentPath, \"not\"]\n\t}) };\n}\nfunction parseNullDef(refs) {\n\treturn refs.target === \"openApi3\" ? {\n\t\tenum: [\"null\"],\n\t\tnullable: true\n\t} : { type: \"null\" };\n}\nconst primitiveMappings = {\n\tZodString: \"string\",\n\tZodNumber: \"number\",\n\tZodBigInt: \"integer\",\n\tZodBoolean: \"boolean\",\n\tZodNull: \"null\"\n};\nfunction parseUnionDef(def, refs) {\n\tif (refs.target === \"openApi3\") return asAnyOf(def, refs);\n\tconst options = def.options instanceof Map ? Array.from(def.options.values()) : def.options;\n\tif (options.every((x) => x._def.typeName in primitiveMappings && (!x._def.checks || !x._def.checks.length))) {\n\t\tconst types = options.reduce((types, x) => {\n\t\t\tconst type = primitiveMappings[x._def.typeName];\n\t\t\treturn type && !types.includes(type) ? [...types, type] : types;\n\t\t}, []);\n\t\treturn { type: types.length > 1 ? types : types[0] };\n\t} else if (options.every((x) => x._def.typeName === \"ZodLiteral\" && !x.description)) {\n\t\tconst types = options.reduce((acc, x) => {\n\t\t\tconst type = typeof x._def.value;\n\t\t\tswitch (type) {\n\t\t\t\tcase \"string\":\n\t\t\t\tcase \"number\":\n\t\t\t\tcase \"boolean\": return [...acc, type];\n\t\t\t\tcase \"bigint\": return [...acc, \"integer\"];\n\t\t\t\tcase \"object\": if (x._def.value === null) return [...acc, \"null\"];\n\t\t\t\tdefault: return acc;\n\t\t\t}\n\t\t}, []);\n\t\tif (types.length === options.length) {\n\t\t\tconst uniqueTypes = types.filter((x, i, a) => a.indexOf(x) === i);\n\t\t\treturn {\n\t\t\t\ttype: uniqueTypes.length > 1 ? uniqueTypes : uniqueTypes[0],\n\t\t\t\tenum: options.reduce((acc, x) => {\n\t\t\t\t\treturn acc.includes(x._def.value) ? acc : [...acc, x._def.value];\n\t\t\t\t}, [])\n\t\t\t};\n\t\t}\n\t} else if (options.every((x) => x._def.typeName === \"ZodEnum\")) return {\n\t\ttype: \"string\",\n\t\tenum: options.reduce((acc, x) => [...acc, ...x._def.values.filter((x) => !acc.includes(x))], [])\n\t};\n\treturn asAnyOf(def, refs);\n}\nconst asAnyOf = (def, refs) => {\n\tconst anyOf = (def.options instanceof Map ? Array.from(def.options.values()) : def.options).map((x, i) => parseDef(x._def, {\n\t\t...refs,\n\t\tcurrentPath: [\n\t\t\t...refs.currentPath,\n\t\t\t\"anyOf\",\n\t\t\t`${i}`\n\t\t]\n\t})).filter((x) => !!x && (!refs.strictUnions || typeof x === \"object\" && Object.keys(x).length > 0));\n\treturn anyOf.length ? { anyOf } : void 0;\n};\nfunction parseNullableDef(def, refs) {\n\tif ([\n\t\t\"ZodString\",\n\t\t\"ZodNumber\",\n\t\t\"ZodBigInt\",\n\t\t\"ZodBoolean\",\n\t\t\"ZodNull\"\n\t].includes(def.innerType._def.typeName) && (!def.innerType._def.checks || !def.innerType._def.checks.length)) {\n\t\tif (refs.target === \"openApi3\") return {\n\t\t\ttype: primitiveMappings[def.innerType._def.typeName],\n\t\t\tnullable: true\n\t\t};\n\t\treturn { type: [primitiveMappings[def.innerType._def.typeName], \"null\"] };\n\t}\n\tif (refs.target === \"openApi3\") {\n\t\tconst base = parseDef(def.innerType._def, {\n\t\t\t...refs,\n\t\t\tcurrentPath: [...refs.currentPath]\n\t\t});\n\t\tif (base && \"$ref\" in base) return {\n\t\t\tallOf: [base],\n\t\t\tnullable: true\n\t\t};\n\t\treturn base && {\n\t\t\t...base,\n\t\t\tnullable: true\n\t\t};\n\t}\n\tconst base = parseDef(def.innerType._def, {\n\t\t...refs,\n\t\tcurrentPath: [\n\t\t\t...refs.currentPath,\n\t\t\t\"anyOf\",\n\t\t\t\"0\"\n\t\t]\n\t});\n\treturn base && { anyOf: [base, { type: \"null\" }] };\n}\nfunction parseNumberDef(def, refs) {\n\tconst res = { type: \"number\" };\n\tif (!def.checks) return res;\n\tfor (const check of def.checks) switch (check.kind) {\n\t\tcase \"int\":\n\t\t\tres.type = \"integer\";\n\t\t\taddErrorMessage(res, \"type\", check.message, refs);\n\t\t\tbreak;\n\t\tcase \"min\":\n\t\t\tif (refs.target === \"jsonSchema7\") if (check.inclusive) setResponseValueAndErrors(res, \"minimum\", check.value, check.message, refs);\n\t\t\telse setResponseValueAndErrors(res, \"exclusiveMinimum\", check.value, check.message, refs);\n\t\t\telse {\n\t\t\t\tif (!check.inclusive) res.exclusiveMinimum = true;\n\t\t\t\tsetResponseValueAndErrors(res, \"minimum\", check.value, check.message, refs);\n\t\t\t}\n\t\t\tbreak;\n\t\tcase \"max\":\n\t\t\tif (refs.target === \"jsonSchema7\") if (check.inclusive) setResponseValueAndErrors(res, \"maximum\", check.value, check.message, refs);\n\t\t\telse setResponseValueAndErrors(res, \"exclusiveMaximum\", check.value, check.message, refs);\n\t\t\telse {\n\t\t\t\tif (!check.inclusive) res.exclusiveMaximum = true;\n\t\t\t\tsetResponseValueAndErrors(res, \"maximum\", check.value, check.message, refs);\n\t\t\t}\n\t\t\tbreak;\n\t\tcase \"multipleOf\":\n\t\t\tsetResponseValueAndErrors(res, \"multipleOf\", check.value, check.message, refs);\n\t\t\tbreak;\n\t}\n\treturn res;\n}\nfunction parseObjectDef(def, refs) {\n\tconst forceOptionalIntoNullable = refs.target === \"openAi\";\n\tconst result = {\n\t\ttype: \"object\",\n\t\tproperties: {}\n\t};\n\tconst required = [];\n\tconst shape = def.shape();\n\tfor (const propName in shape) {\n\t\tlet propDef = shape[propName];\n\t\tif (propDef === void 0 || propDef._def === void 0) continue;\n\t\tlet propOptional = safeIsOptional(propDef);\n\t\tif (propOptional && forceOptionalIntoNullable) {\n\t\t\tif (propDef._def.typeName === \"ZodOptional\") propDef = propDef._def.innerType;\n\t\t\tif (!propDef.isNullable()) propDef = propDef.nullable();\n\t\t\tpropOptional = false;\n\t\t}\n\t\tconst parsedDef = parseDef(propDef._def, {\n\t\t\t...refs,\n\t\t\tcurrentPath: [\n\t\t\t\t...refs.currentPath,\n\t\t\t\t\"properties\",\n\t\t\t\tpropName\n\t\t\t],\n\t\t\tpropertyPath: [\n\t\t\t\t...refs.currentPath,\n\t\t\t\t\"properties\",\n\t\t\t\tpropName\n\t\t\t]\n\t\t});\n\t\tif (parsedDef === void 0) continue;\n\t\tresult.properties[propName] = parsedDef;\n\t\tif (!propOptional) required.push(propName);\n\t}\n\tif (required.length) result.required = required;\n\tconst additionalProperties = decideAdditionalProperties(def, refs);\n\tif (additionalProperties !== void 0) result.additionalProperties = additionalProperties;\n\treturn result;\n}\nfunction decideAdditionalProperties(def, refs) {\n\tif (def.catchall._def.typeName !== \"ZodNever\") return parseDef(def.catchall._def, {\n\t\t...refs,\n\t\tcurrentPath: [...refs.currentPath, \"additionalProperties\"]\n\t});\n\tswitch (def.unknownKeys) {\n\t\tcase \"passthrough\": return refs.allowedAdditionalProperties;\n\t\tcase \"strict\": return refs.rejectedAdditionalProperties;\n\t\tcase \"strip\": return refs.removeAdditionalStrategy === \"strict\" ? refs.allowedAdditionalProperties : refs.rejectedAdditionalProperties;\n\t}\n}\nfunction safeIsOptional(schema) {\n\ttry {\n\t\treturn schema.isOptional();\n\t} catch {\n\t\treturn true;\n\t}\n}\nconst parseOptionalDef = (def, refs) => {\n\tif (refs.currentPath.toString() === refs.propertyPath?.toString()) return parseDef(def.innerType._def, refs);\n\tconst innerSchema = parseDef(def.innerType._def, {\n\t\t...refs,\n\t\tcurrentPath: [\n\t\t\t...refs.currentPath,\n\t\t\t\"anyOf\",\n\t\t\t\"1\"\n\t\t]\n\t});\n\treturn innerSchema ? { anyOf: [{ not: parseAnyDef(refs) }, innerSchema] } : parseAnyDef(refs);\n};\nconst parsePipelineDef = (def, refs) => {\n\tif (refs.pipeStrategy === \"input\") return parseDef(def.in._def, refs);\n\telse if (refs.pipeStrategy === \"output\") return parseDef(def.out._def, refs);\n\tconst a = parseDef(def.in._def, {\n\t\t...refs,\n\t\tcurrentPath: [\n\t\t\t...refs.currentPath,\n\t\t\t\"allOf\",\n\t\t\t\"0\"\n\t\t]\n\t});\n\treturn { allOf: [a, parseDef(def.out._def, {\n\t\t...refs,\n\t\tcurrentPath: [\n\t\t\t...refs.currentPath,\n\t\t\t\"allOf\",\n\t\t\ta ? \"1\" : \"0\"\n\t\t]\n\t})].filter((x) => x !== void 0) };\n};\nfunction parsePromiseDef(def, refs) {\n\treturn parseDef(def.type._def, refs);\n}\nfunction parseSetDef(def, refs) {\n\tconst schema = {\n\t\ttype: \"array\",\n\t\tuniqueItems: true,\n\t\titems: parseDef(def.valueType._def, {\n\t\t\t...refs,\n\t\t\tcurrentPath: [...refs.currentPath, \"items\"]\n\t\t})\n\t};\n\tif (def.minSize) setResponseValueAndErrors(schema, \"minItems\", def.minSize.value, def.minSize.message, refs);\n\tif (def.maxSize) setResponseValueAndErrors(schema, \"maxItems\", def.maxSize.value, def.maxSize.message, refs);\n\treturn schema;\n}\nfunction parseTupleDef(def, refs) {\n\tif (def.rest) return {\n\t\ttype: \"array\",\n\t\tminItems: def.items.length,\n\t\titems: def.items.map((x, i) => parseDef(x._def, {\n\t\t\t...refs,\n\t\t\tcurrentPath: [\n\t\t\t\t...refs.currentPath,\n\t\t\t\t\"items\",\n\t\t\t\t`${i}`\n\t\t\t]\n\t\t})).reduce((acc, x) => x === void 0 ? acc : [...acc, x], []),\n\t\tadditionalItems: parseDef(def.rest._def, {\n\t\t\t...refs,\n\t\t\tcurrentPath: [...refs.currentPath, \"additionalItems\"]\n\t\t})\n\t};\n\telse return {\n\t\ttype: \"array\",\n\t\tminItems: def.items.length,\n\t\tmaxItems: def.items.length,\n\t\titems: def.items.map((x, i) => parseDef(x._def, {\n\t\t\t...refs,\n\t\t\tcurrentPath: [\n\t\t\t\t...refs.currentPath,\n\t\t\t\t\"items\",\n\t\t\t\t`${i}`\n\t\t\t]\n\t\t})).reduce((acc, x) => x === void 0 ? acc : [...acc, x], [])\n\t};\n}\nfunction parseUndefinedDef(refs) {\n\treturn { not: parseAnyDef(refs) };\n}\nfunction parseUnknownDef(refs) {\n\treturn parseAnyDef(refs);\n}\nconst parseReadonlyDef = (def, refs) => {\n\treturn parseDef(def.innerType._def, refs);\n};\nconst selectParser = (def, typeName, refs) => {\n\tswitch (typeName) {\n\t\tcase ZodFirstPartyTypeKind.ZodString: return parseStringDef(def, refs);\n\t\tcase ZodFirstPartyTypeKind.ZodNumber: return parseNumberDef(def, refs);\n\t\tcase ZodFirstPartyTypeKind.ZodObject: return parseObjectDef(def, refs);\n\t\tcase ZodFirstPartyTypeKind.ZodBigInt: return parseBigintDef(def, refs);\n\t\tcase ZodFirstPartyTypeKind.ZodBoolean: return parseBooleanDef();\n\t\tcase ZodFirstPartyTypeKind.ZodDate: return parseDateDef(def, refs);\n\t\tcase ZodFirstPartyTypeKind.ZodUndefined: return parseUndefinedDef(refs);\n\t\tcase ZodFirstPartyTypeKind.ZodNull: return parseNullDef(refs);\n\t\tcase ZodFirstPartyTypeKind.ZodArray: return parseArrayDef(def, refs);\n\t\tcase ZodFirstPartyTypeKind.ZodUnion:\n\t\tcase ZodFirstPartyTypeKind.ZodDiscriminatedUnion: return parseUnionDef(def, refs);\n\t\tcase ZodFirstPartyTypeKind.ZodIntersection: return parseIntersectionDef(def, refs);\n\t\tcase ZodFirstPartyTypeKind.ZodTuple: return parseTupleDef(def, refs);\n\t\tcase ZodFirstPartyTypeKind.ZodRecord: return parseRecordDef(def, refs);\n\t\tcase ZodFirstPartyTypeKind.ZodLiteral: return parseLiteralDef(def, refs);\n\t\tcase ZodFirstPartyTypeKind.ZodEnum: return parseEnumDef(def);\n\t\tcase ZodFirstPartyTypeKind.ZodNativeEnum: return parseNativeEnumDef(def);\n\t\tcase ZodFirstPartyTypeKind.ZodNullable: return parseNullableDef(def, refs);\n\t\tcase ZodFirstPartyTypeKind.ZodOptional: return parseOptionalDef(def, refs);\n\t\tcase ZodFirstPartyTypeKind.ZodMap: return parseMapDef(def, refs);\n\t\tcase ZodFirstPartyTypeKind.ZodSet: return parseSetDef(def, refs);\n\t\tcase ZodFirstPartyTypeKind.ZodLazy: return () => def.getter()._def;\n\t\tcase ZodFirstPartyTypeKind.ZodPromise: return parsePromiseDef(def, refs);\n\t\tcase ZodFirstPartyTypeKind.ZodNaN:\n\t\tcase ZodFirstPartyTypeKind.ZodNever: return parseNeverDef(refs);\n\t\tcase ZodFirstPartyTypeKind.ZodEffects: return parseEffectsDef(def, refs);\n\t\tcase ZodFirstPartyTypeKind.ZodAny: return parseAnyDef(refs);\n\t\tcase ZodFirstPartyTypeKind.ZodUnknown: return parseUnknownDef(refs);\n\t\tcase ZodFirstPartyTypeKind.ZodDefault: return parseDefaultDef(def, refs);\n\t\tcase ZodFirstPartyTypeKind.ZodBranded: return parseBrandedDef(def, refs);\n\t\tcase ZodFirstPartyTypeKind.ZodReadonly: return parseReadonlyDef(def, refs);\n\t\tcase ZodFirstPartyTypeKind.ZodCatch: return parseCatchDef(def, refs);\n\t\tcase ZodFirstPartyTypeKind.ZodPipeline: return parsePipelineDef(def, refs);\n\t\tcase ZodFirstPartyTypeKind.ZodFunction:\n\t\tcase ZodFirstPartyTypeKind.ZodVoid:\n\t\tcase ZodFirstPartyTypeKind.ZodSymbol: return;\n\t\tdefault: return ((_) => void 0)(typeName);\n\t}\n};\nfunction parseDef(def, refs, forceResolution = false) {\n\tconst seenItem = refs.seen.get(def);\n\tif (refs.override) {\n\t\tconst overrideResult = refs.override?.(def, refs, seenItem, forceResolution);\n\t\tif (overrideResult !== ignoreOverride) return overrideResult;\n\t}\n\tif (seenItem && !forceResolution) {\n\t\tconst seenSchema = get$ref(seenItem, refs);\n\t\tif (seenSchema !== void 0) return seenSchema;\n\t}\n\tconst newItem = {\n\t\tdef,\n\t\tpath: refs.currentPath,\n\t\tjsonSchema: void 0\n\t};\n\trefs.seen.set(def, newItem);\n\tconst jsonSchemaOrGetter = selectParser(def, def.typeName, refs);\n\tconst jsonSchema = typeof jsonSchemaOrGetter === \"function\" ? parseDef(jsonSchemaOrGetter(), refs) : jsonSchemaOrGetter;\n\tif (jsonSchema) addMeta(def, refs, jsonSchema);\n\tif (refs.postProcess) {\n\t\tconst postProcessResult = refs.postProcess(jsonSchema, def, refs);\n\t\tnewItem.jsonSchema = jsonSchema;\n\t\treturn postProcessResult;\n\t}\n\tnewItem.jsonSchema = jsonSchema;\n\treturn jsonSchema;\n}\nconst get$ref = (item, refs) => {\n\tswitch (refs.$refStrategy) {\n\t\tcase \"root\": return { $ref: item.path.join(\"/\") };\n\t\tcase \"relative\": return { $ref: getRelativePath(refs.currentPath, item.path) };\n\t\tcase \"none\":\n\t\tcase \"seen\":\n\t\t\tif (item.path.length < refs.currentPath.length && item.path.every((value, index) => refs.currentPath[index] === value)) {\n\t\t\t\tconsole.warn(`Recursive reference detected at ${refs.currentPath.join(\"/\")}! Defaulting to any`);\n\t\t\t\treturn parseAnyDef(refs);\n\t\t\t}\n\t\t\treturn refs.$refStrategy === \"seen\" ? parseAnyDef(refs) : void 0;\n\t}\n};\nconst addMeta = (def, refs, jsonSchema) => {\n\tif (def.description) {\n\t\tjsonSchema.description = def.description;\n\t\tif (refs.markdownDescription) jsonSchema.markdownDescription = def.description;\n\t}\n\treturn jsonSchema;\n};\nconst zodToJsonSchema = (schema, options) => {\n\tconst refs = getRefs(options);\n\tlet definitions = typeof options === \"object\" && options.definitions ? Object.entries(options.definitions).reduce((acc, [name, schema]) => ({\n\t\t...acc,\n\t\t[name]: parseDef(schema._def, {\n\t\t\t...refs,\n\t\t\tcurrentPath: [\n\t\t\t\t...refs.basePath,\n\t\t\t\trefs.definitionPath,\n\t\t\t\tname\n\t\t\t]\n\t\t}, true) ?? parseAnyDef(refs)\n\t}), {}) : void 0;\n\tconst name = typeof options === \"string\" ? options : options?.nameStrategy === \"title\" ? void 0 : options?.name;\n\tconst main = parseDef(schema._def, name === void 0 ? refs : {\n\t\t...refs,\n\t\tcurrentPath: [\n\t\t\t...refs.basePath,\n\t\t\trefs.definitionPath,\n\t\t\tname\n\t\t]\n\t}, false) ?? parseAnyDef(refs);\n\tconst title = typeof options === \"object\" && options.name !== void 0 && options.nameStrategy === \"title\" ? options.name : void 0;\n\tif (title !== void 0) main.title = title;\n\tif (refs.flags.hasReferencedOpenAiAnyType) {\n\t\tif (!definitions) definitions = {};\n\t\tif (!definitions[refs.openAiAnyTypeName]) definitions[refs.openAiAnyTypeName] = {\n\t\t\ttype: [\n\t\t\t\t\"string\",\n\t\t\t\t\"number\",\n\t\t\t\t\"integer\",\n\t\t\t\t\"boolean\",\n\t\t\t\t\"array\",\n\t\t\t\t\"null\"\n\t\t\t],\n\t\t\titems: { $ref: refs.$refStrategy === \"relative\" ? \"1\" : [\n\t\t\t\t...refs.basePath,\n\t\t\t\trefs.definitionPath,\n\t\t\t\trefs.openAiAnyTypeName\n\t\t\t].join(\"/\") }\n\t\t};\n\t}\n\tconst combined = name === void 0 ? definitions ? {\n\t\t...main,\n\t\t[refs.definitionPath]: definitions\n\t} : main : {\n\t\t$ref: [\n\t\t\t...refs.$refStrategy === \"relative\" ? [] : refs.basePath,\n\t\t\trefs.definitionPath,\n\t\t\tname\n\t\t].join(\"/\"),\n\t\t[refs.definitionPath]: {\n\t\t\t...definitions,\n\t\t\t[name]: main\n\t\t}\n\t};\n\tif (refs.target === \"jsonSchema7\") combined.$schema = \"http://json-schema.org/draft-07/schema#\";\n\telse if (refs.target === \"jsonSchema2019-09\" || refs.target === \"openAi\") combined.$schema = \"https://json-schema.org/draft/2019-09/schema#\";\n\tif (refs.target === \"openAi\" && (\"anyOf\" in combined || \"oneOf\" in combined || \"allOf\" in combined || \"type\" in combined && Array.isArray(combined.type))) console.warn(\"Warning: OpenAI may not support schemas with unions as roots! Try wrapping it in an object property.\");\n\treturn combined;\n};\nvar esm_default = zodToJsonSchema;\nvar textStreamPart = {\n\tcode: \"0\",\n\tname: \"text\",\n\tparse: (value) => {\n\t\tif (typeof value !== \"string\") throw new Error(\"\\\"text\\\" parts expect a string value.\");\n\t\treturn {\n\t\t\ttype: \"text\",\n\t\t\tvalue\n\t\t};\n\t}\n};\nvar errorStreamPart = {\n\tcode: \"3\",\n\tname: \"error\",\n\tparse: (value) => {\n\t\tif (typeof value !== \"string\") throw new Error(\"\\\"error\\\" parts expect a string value.\");\n\t\treturn {\n\t\t\ttype: \"error\",\n\t\t\tvalue\n\t\t};\n\t}\n};\nvar assistantMessageStreamPart = {\n\tcode: \"4\",\n\tname: \"assistant_message\",\n\tparse: (value) => {\n\t\tif (value == null || typeof value !== \"object\" || !(\"id\" in value) || !(\"role\" in value) || !(\"content\" in value) || typeof value.id !== \"string\" || typeof value.role !== \"string\" || value.role !== \"assistant\" || !Array.isArray(value.content) || !value.content.every((item) => item != null && typeof item === \"object\" && \"type\" in item && item.type === \"text\" && \"text\" in item && item.text != null && typeof item.text === \"object\" && \"value\" in item.text && typeof item.text.value === \"string\")) throw new Error(\"\\\"assistant_message\\\" parts expect an object with an \\\"id\\\", \\\"role\\\", and \\\"content\\\" property.\");\n\t\treturn {\n\t\t\ttype: \"assistant_message\",\n\t\t\tvalue\n\t\t};\n\t}\n};\nvar assistantControlDataStreamPart = {\n\tcode: \"5\",\n\tname: \"assistant_control_data\",\n\tparse: (value) => {\n\t\tif (value == null || typeof value !== \"object\" || !(\"threadId\" in value) || !(\"messageId\" in value) || typeof value.threadId !== \"string\" || typeof value.messageId !== \"string\") throw new Error(\"\\\"assistant_control_data\\\" parts expect an object with a \\\"threadId\\\" and \\\"messageId\\\" property.\");\n\t\treturn {\n\t\t\ttype: \"assistant_control_data\",\n\t\t\tvalue: {\n\t\t\t\tthreadId: value.threadId,\n\t\t\t\tmessageId: value.messageId\n\t\t\t}\n\t\t};\n\t}\n};\nvar dataMessageStreamPart = {\n\tcode: \"6\",\n\tname: \"data_message\",\n\tparse: (value) => {\n\t\tif (value == null || typeof value !== \"object\" || !(\"role\" in value) || !(\"data\" in value) || typeof value.role !== \"string\" || value.role !== \"data\") throw new Error(\"\\\"data_message\\\" parts expect an object with a \\\"role\\\" and \\\"data\\\" property.\");\n\t\treturn {\n\t\t\ttype: \"data_message\",\n\t\t\tvalue\n\t\t};\n\t}\n};\nvar assistantStreamParts = [\n\ttextStreamPart,\n\terrorStreamPart,\n\tassistantMessageStreamPart,\n\tassistantControlDataStreamPart,\n\tdataMessageStreamPart\n];\ntextStreamPart.code, errorStreamPart.code, assistantMessageStreamPart.code, assistantControlDataStreamPart.code, dataMessageStreamPart.code;\ntextStreamPart.name, textStreamPart.code, errorStreamPart.name, errorStreamPart.code, assistantMessageStreamPart.name, assistantMessageStreamPart.code, assistantControlDataStreamPart.name, assistantControlDataStreamPart.code, dataMessageStreamPart.name, dataMessageStreamPart.code;\nassistantStreamParts.map((part) => part.code);\nfunction fixJson(input) {\n\tconst stack = [\"ROOT\"];\n\tlet lastValidIndex = -1;\n\tlet literalStart = null;\n\tfunction processValueStart(char, i, swapState) {\n\t\tswitch (char) {\n\t\t\tcase \"\\\"\":\n\t\t\t\tlastValidIndex = i;\n\t\t\t\tstack.pop();\n\t\t\t\tstack.push(swapState);\n\t\t\t\tstack.push(\"INSIDE_STRING\");\n\t\t\t\tbreak;\n\t\t\tcase \"f\":\n\t\t\tcase \"t\":\n\t\t\tcase \"n\":\n\t\t\t\tlastValidIndex = i;\n\t\t\t\tliteralStart = i;\n\t\t\t\tstack.pop();\n\t\t\t\tstack.push(swapState);\n\t\t\t\tstack.push(\"INSIDE_LITERAL\");\n\t\t\t\tbreak;\n\t\t\tcase \"-\":\n\t\t\t\tstack.pop();\n\t\t\t\tstack.push(swapState);\n\t\t\t\tstack.push(\"INSIDE_NUMBER\");\n\t\t\t\tbreak;\n\t\t\tcase \"0\":\n\t\t\tcase \"1\":\n\t\t\tcase \"2\":\n\t\t\tcase \"3\":\n\t\t\tcase \"4\":\n\t\t\tcase \"5\":\n\t\t\tcase \"6\":\n\t\t\tcase \"7\":\n\t\t\tcase \"8\":\n\t\t\tcase \"9\":\n\t\t\t\tlastValidIndex = i;\n\t\t\t\tstack.pop();\n\t\t\t\tstack.push(swapState);\n\t\t\t\tstack.push(\"INSIDE_NUMBER\");\n\t\t\t\tbreak;\n\t\t\tcase \"{\":\n\t\t\t\tlastValidIndex = i;\n\t\t\t\tstack.pop();\n\t\t\t\tstack.push(swapState);\n\t\t\t\tstack.push(\"INSIDE_OBJECT_START\");\n\t\t\t\tbreak;\n\t\t\tcase \"[\":\n\t\t\t\tlastValidIndex = i;\n\t\t\t\tstack.pop();\n\t\t\t\tstack.push(swapState);\n\t\t\t\tstack.push(\"INSIDE_ARRAY_START\");\n\t\t\t\tbreak;\n\t\t}\n\t}\n\tfunction processAfterObjectValue(char, i) {\n\t\tswitch (char) {\n\t\t\tcase \",\":\n\t\t\t\tstack.pop();\n\t\t\t\tstack.push(\"INSIDE_OBJECT_AFTER_COMMA\");\n\t\t\t\tbreak;\n\t\t\tcase \"}\":\n\t\t\t\tlastValidIndex = i;\n\t\t\t\tstack.pop();\n\t\t\t\tbreak;\n\t\t}\n\t}\n\tfunction processAfterArrayValue(char, i) {\n\t\tswitch (char) {\n\t\t\tcase \",\":\n\t\t\t\tstack.pop();\n\t\t\t\tstack.push(\"INSIDE_ARRAY_AFTER_COMMA\");\n\t\t\t\tbreak;\n\t\t\tcase \"]\":\n\t\t\t\tlastValidIndex = i;\n\t\t\t\tstack.pop();\n\t\t\t\tbreak;\n\t\t}\n\t}\n\tfor (let i = 0; i < input.length; i++) {\n\t\tconst char = input[i];\n\t\tswitch (stack[stack.length - 1]) {\n\t\t\tcase \"ROOT\":\n\t\t\t\tprocessValueStart(char, i, \"FINISH\");\n\t\t\t\tbreak;\n\t\t\tcase \"INSIDE_OBJECT_START\":\n\t\t\t\tswitch (char) {\n\t\t\t\t\tcase \"\\\"\":\n\t\t\t\t\t\tstack.pop();\n\t\t\t\t\t\tstack.push(\"INSIDE_OBJECT_KEY\");\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"}\":\n\t\t\t\t\t\tlastValidIndex = i;\n\t\t\t\t\t\tstack.pop();\n\t\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase \"INSIDE_OBJECT_AFTER_COMMA\":\n\t\t\t\tswitch (char) {\n\t\t\t\t\tcase \"\\\"\":\n\t\t\t\t\t\tstack.pop();\n\t\t\t\t\t\tstack.push(\"INSIDE_OBJECT_KEY\");\n\t\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase \"INSIDE_OBJECT_KEY\":\n\t\t\t\tswitch (char) {\n\t\t\t\t\tcase \"\\\"\":\n\t\t\t\t\t\tstack.pop();\n\t\t\t\t\t\tstack.push(\"INSIDE_OBJECT_AFTER_KEY\");\n\t\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase \"INSIDE_OBJECT_AFTER_KEY\":\n\t\t\t\tswitch (char) {\n\t\t\t\t\tcase \":\":\n\t\t\t\t\t\tstack.pop();\n\t\t\t\t\t\tstack.push(\"INSIDE_OBJECT_BEFORE_VALUE\");\n\t\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase \"INSIDE_OBJECT_BEFORE_VALUE\":\n\t\t\t\tprocessValueStart(char, i, \"INSIDE_OBJECT_AFTER_VALUE\");\n\t\t\t\tbreak;\n\t\t\tcase \"INSIDE_OBJECT_AFTER_VALUE\":\n\t\t\t\tprocessAfterObjectValue(char, i);\n\t\t\t\tbreak;\n\t\t\tcase \"INSIDE_STRING\":\n\t\t\t\tswitch (char) {\n\t\t\t\t\tcase \"\\\"\":\n\t\t\t\t\t\tstack.pop();\n\t\t\t\t\t\tlastValidIndex = i;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"\\\\\":\n\t\t\t\t\t\tstack.push(\"INSIDE_STRING_ESCAPE\");\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tdefault: lastValidIndex = i;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase \"INSIDE_ARRAY_START\":\n\t\t\t\tswitch (char) {\n\t\t\t\t\tcase \"]\":\n\t\t\t\t\t\tlastValidIndex = i;\n\t\t\t\t\t\tstack.pop();\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tlastValidIndex = i;\n\t\t\t\t\t\tprocessValueStart(char, i, \"INSIDE_ARRAY_AFTER_VALUE\");\n\t\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase \"INSIDE_ARRAY_AFTER_VALUE\":\n\t\t\t\tswitch (char) {\n\t\t\t\t\tcase \",\":\n\t\t\t\t\t\tstack.pop();\n\t\t\t\t\t\tstack.push(\"INSIDE_ARRAY_AFTER_COMMA\");\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"]\":\n\t\t\t\t\t\tlastValidIndex = i;\n\t\t\t\t\t\tstack.pop();\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tlastValidIndex = i;\n\t\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase \"INSIDE_ARRAY_AFTER_COMMA\":\n\t\t\t\tprocessValueStart(char, i, \"INSIDE_ARRAY_AFTER_VALUE\");\n\t\t\t\tbreak;\n\t\t\tcase \"INSIDE_STRING_ESCAPE\":\n\t\t\t\tstack.pop();\n\t\t\t\tlastValidIndex = i;\n\t\t\t\tbreak;\n\t\t\tcase \"INSIDE_NUMBER\":\n\t\t\t\tswitch (char) {\n\t\t\t\t\tcase \"0\":\n\t\t\t\t\tcase \"1\":\n\t\t\t\t\tcase \"2\":\n\t\t\t\t\tcase \"3\":\n\t\t\t\t\tcase \"4\":\n\t\t\t\t\tcase \"5\":\n\t\t\t\t\tcase \"6\":\n\t\t\t\t\tcase \"7\":\n\t\t\t\t\tcase \"8\":\n\t\t\t\t\tcase \"9\":\n\t\t\t\t\t\tlastValidIndex = i;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"e\":\n\t\t\t\t\tcase \"E\":\n\t\t\t\t\tcase \"-\":\n\t\t\t\t\tcase \".\": break;\n\t\t\t\t\tcase \",\":\n\t\t\t\t\t\tstack.pop();\n\t\t\t\t\t\tif (stack[stack.length - 1] === \"INSIDE_ARRAY_AFTER_VALUE\") processAfterArrayValue(char, i);\n\t\t\t\t\t\tif (stack[stack.length - 1] === \"INSIDE_OBJECT_AFTER_VALUE\") processAfterObjectValue(char, i);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"}\":\n\t\t\t\t\t\tstack.pop();\n\t\t\t\t\t\tif (stack[stack.length - 1] === \"INSIDE_OBJECT_AFTER_VALUE\") processAfterObjectValue(char, i);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"]\":\n\t\t\t\t\t\tstack.pop();\n\t\t\t\t\t\tif (stack[stack.length - 1] === \"INSIDE_ARRAY_AFTER_VALUE\") processAfterArrayValue(char, i);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tstack.pop();\n\t\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase \"INSIDE_LITERAL\": {\n\t\t\t\tconst partialLiteral = input.substring(literalStart, i + 1);\n\t\t\t\tif (!\"false\".startsWith(partialLiteral) && !\"true\".startsWith(partialLiteral) && !\"null\".startsWith(partialLiteral)) {\n\t\t\t\t\tstack.pop();\n\t\t\t\t\tif (stack[stack.length - 1] === \"INSIDE_OBJECT_AFTER_VALUE\") processAfterObjectValue(char, i);\n\t\t\t\t\telse if (stack[stack.length - 1] === \"INSIDE_ARRAY_AFTER_VALUE\") processAfterArrayValue(char, i);\n\t\t\t\t} else lastValidIndex = i;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\tlet result = input.slice(0, lastValidIndex + 1);\n\tfor (let i = stack.length - 1; i >= 0; i--) switch (stack[i]) {\n\t\tcase \"INSIDE_STRING\":\n\t\t\tresult += \"\\\"\";\n\t\t\tbreak;\n\t\tcase \"INSIDE_OBJECT_KEY\":\n\t\tcase \"INSIDE_OBJECT_AFTER_KEY\":\n\t\tcase \"INSIDE_OBJECT_AFTER_COMMA\":\n\t\tcase \"INSIDE_OBJECT_START\":\n\t\tcase \"INSIDE_OBJECT_BEFORE_VALUE\":\n\t\tcase \"INSIDE_OBJECT_AFTER_VALUE\":\n\t\t\tresult += \"}\";\n\t\t\tbreak;\n\t\tcase \"INSIDE_ARRAY_START\":\n\t\tcase \"INSIDE_ARRAY_AFTER_COMMA\":\n\t\tcase \"INSIDE_ARRAY_AFTER_VALUE\":\n\t\t\tresult += \"]\";\n\t\t\tbreak;\n\t\tcase \"INSIDE_LITERAL\": {\n\t\t\tconst partialLiteral = input.substring(literalStart, input.length);\n\t\t\tif (\"true\".startsWith(partialLiteral)) result += \"true\".slice(partialLiteral.length);\n\t\t\telse if (\"false\".startsWith(partialLiteral)) result += \"false\".slice(partialLiteral.length);\n\t\t\telse if (\"null\".startsWith(partialLiteral)) result += \"null\".slice(partialLiteral.length);\n\t\t}\n\t}\n\treturn result;\n}\nfunction parsePartialJson(jsonText) {\n\tif (jsonText === void 0) return {\n\t\tvalue: void 0,\n\t\tstate: \"undefined-input\"\n\t};\n\tlet result = safeParseJSON({ text: jsonText });\n\tif (result.success) return {\n\t\tvalue: result.value,\n\t\tstate: \"successful-parse\"\n\t};\n\tresult = safeParseJSON({ text: fixJson(jsonText) });\n\tif (result.success) return {\n\t\tvalue: result.value,\n\t\tstate: \"repaired-parse\"\n\t};\n\treturn {\n\t\tvalue: void 0,\n\t\tstate: \"failed-parse\"\n\t};\n}\nvar dataStreamParts = [\n\t{\n\t\tcode: \"0\",\n\t\tname: \"text\",\n\t\tparse: (value) => {\n\t\t\tif (typeof value !== \"string\") throw new Error(\"\\\"text\\\" parts expect a string value.\");\n\t\t\treturn {\n\t\t\t\ttype: \"text\",\n\t\t\t\tvalue\n\t\t\t};\n\t\t}\n\t},\n\t{\n\t\tcode: \"2\",\n\t\tname: \"data\",\n\t\tparse: (value) => {\n\t\t\tif (!Array.isArray(value)) throw new Error(\"\\\"data\\\" parts expect an array value.\");\n\t\t\treturn {\n\t\t\t\ttype: \"data\",\n\t\t\t\tvalue\n\t\t\t};\n\t\t}\n\t},\n\t{\n\t\tcode: \"3\",\n\t\tname: \"error\",\n\t\tparse: (value) => {\n\t\t\tif (typeof value !== \"string\") throw new Error(\"\\\"error\\\" parts expect a string value.\");\n\t\t\treturn {\n\t\t\t\ttype: \"error\",\n\t\t\t\tvalue\n\t\t\t};\n\t\t}\n\t},\n\t{\n\t\tcode: \"8\",\n\t\tname: \"message_annotations\",\n\t\tparse: (value) => {\n\t\t\tif (!Array.isArray(value)) throw new Error(\"\\\"message_annotations\\\" parts expect an array value.\");\n\t\t\treturn {\n\t\t\t\ttype: \"message_annotations\",\n\t\t\t\tvalue\n\t\t\t};\n\t\t}\n\t},\n\t{\n\t\tcode: \"9\",\n\t\tname: \"tool_call\",\n\t\tparse: (value) => {\n\t\t\tif (value == null || typeof value !== \"object\" || !(\"toolCallId\" in value) || typeof value.toolCallId !== \"string\" || !(\"toolName\" in value) || typeof value.toolName !== \"string\" || !(\"args\" in value) || typeof value.args !== \"object\") throw new Error(\"\\\"tool_call\\\" parts expect an object with a \\\"toolCallId\\\", \\\"toolName\\\", and \\\"args\\\" property.\");\n\t\t\treturn {\n\t\t\t\ttype: \"tool_call\",\n\t\t\t\tvalue\n\t\t\t};\n\t\t}\n\t},\n\t{\n\t\tcode: \"a\",\n\t\tname: \"tool_result\",\n\t\tparse: (value) => {\n\t\t\tif (value == null || typeof value !== \"object\" || !(\"toolCallId\" in value) || typeof value.toolCallId !== \"string\" || !(\"result\" in value)) throw new Error(\"\\\"tool_result\\\" parts expect an object with a \\\"toolCallId\\\" and a \\\"result\\\" property.\");\n\t\t\treturn {\n\t\t\t\ttype: \"tool_result\",\n\t\t\t\tvalue\n\t\t\t};\n\t\t}\n\t},\n\t{\n\t\tcode: \"b\",\n\t\tname: \"tool_call_streaming_start\",\n\t\tparse: (value) => {\n\t\t\tif (value == null || typeof value !== \"object\" || !(\"toolCallId\" in value) || typeof value.toolCallId !== \"string\" || !(\"toolName\" in value) || typeof value.toolName !== \"string\") throw new Error(\"\\\"tool_call_streaming_start\\\" parts expect an object with a \\\"toolCallId\\\" and \\\"toolName\\\" property.\");\n\t\t\treturn {\n\t\t\t\ttype: \"tool_call_streaming_start\",\n\t\t\t\tvalue\n\t\t\t};\n\t\t}\n\t},\n\t{\n\t\tcode: \"c\",\n\t\tname: \"tool_call_delta\",\n\t\tparse: (value) => {\n\t\t\tif (value == null || typeof value !== \"object\" || !(\"toolCallId\" in value) || typeof value.toolCallId !== \"string\" || !(\"argsTextDelta\" in value) || typeof value.argsTextDelta !== \"string\") throw new Error(\"\\\"tool_call_delta\\\" parts expect an object with a \\\"toolCallId\\\" and \\\"argsTextDelta\\\" property.\");\n\t\t\treturn {\n\t\t\t\ttype: \"tool_call_delta\",\n\t\t\t\tvalue\n\t\t\t};\n\t\t}\n\t},\n\t{\n\t\tcode: \"d\",\n\t\tname: \"finish_message\",\n\t\tparse: (value) => {\n\t\t\tif (value == null || typeof value !== \"object\" || !(\"finishReason\" in value) || typeof value.finishReason !== \"string\") throw new Error(\"\\\"finish_message\\\" parts expect an object with a \\\"finishReason\\\" property.\");\n\t\t\tconst result = { finishReason: value.finishReason };\n\t\t\tif (\"usage\" in value && value.usage != null && typeof value.usage === \"object\" && \"promptTokens\" in value.usage && \"completionTokens\" in value.usage) result.usage = {\n\t\t\t\tpromptTokens: typeof value.usage.promptTokens === \"number\" ? value.usage.promptTokens : NaN,\n\t\t\t\tcompletionTokens: typeof value.usage.completionTokens === \"number\" ? value.usage.completionTokens : NaN\n\t\t\t};\n\t\t\treturn {\n\t\t\t\ttype: \"finish_message\",\n\t\t\t\tvalue: result\n\t\t\t};\n\t\t}\n\t},\n\t{\n\t\tcode: \"e\",\n\t\tname: \"finish_step\",\n\t\tparse: (value) => {\n\t\t\tif (value == null || typeof value !== \"object\" || !(\"finishReason\" in value) || typeof value.finishReason !== \"string\") throw new Error(\"\\\"finish_step\\\" parts expect an object with a \\\"finishReason\\\" property.\");\n\t\t\tconst result = {\n\t\t\t\tfinishReason: value.finishReason,\n\t\t\t\tisContinued: false\n\t\t\t};\n\t\t\tif (\"usage\" in value && value.usage != null && typeof value.usage === \"object\" && \"promptTokens\" in value.usage && \"completionTokens\" in value.usage) result.usage = {\n\t\t\t\tpromptTokens: typeof value.usage.promptTokens === \"number\" ? value.usage.promptTokens : NaN,\n\t\t\t\tcompletionTokens: typeof value.usage.completionTokens === \"number\" ? value.usage.completionTokens : NaN\n\t\t\t};\n\t\t\tif (\"isContinued\" in value && typeof value.isContinued === \"boolean\") result.isContinued = value.isContinued;\n\t\t\treturn {\n\t\t\t\ttype: \"finish_step\",\n\t\t\t\tvalue: result\n\t\t\t};\n\t\t}\n\t},\n\t{\n\t\tcode: \"f\",\n\t\tname: \"start_step\",\n\t\tparse: (value) => {\n\t\t\tif (value == null || typeof value !== \"object\" || !(\"messageId\" in value) || typeof value.messageId !== \"string\") throw new Error(\"\\\"start_step\\\" parts expect an object with an \\\"id\\\" property.\");\n\t\t\treturn {\n\t\t\t\ttype: \"start_step\",\n\t\t\t\tvalue: { messageId: value.messageId }\n\t\t\t};\n\t\t}\n\t},\n\t{\n\t\tcode: \"g\",\n\t\tname: \"reasoning\",\n\t\tparse: (value) => {\n\t\t\tif (typeof value !== \"string\") throw new Error(\"\\\"reasoning\\\" parts expect a string value.\");\n\t\t\treturn {\n\t\t\t\ttype: \"reasoning\",\n\t\t\t\tvalue\n\t\t\t};\n\t\t}\n\t},\n\t{\n\t\tcode: \"h\",\n\t\tname: \"source\",\n\t\tparse: (value) => {\n\t\t\tif (value == null || typeof value !== \"object\") throw new Error(\"\\\"source\\\" parts expect a Source object.\");\n\t\t\treturn {\n\t\t\t\ttype: \"source\",\n\t\t\t\tvalue\n\t\t\t};\n\t\t}\n\t},\n\t{\n\t\tcode: \"i\",\n\t\tname: \"redacted_reasoning\",\n\t\tparse: (value) => {\n\t\t\tif (value == null || typeof value !== \"object\" || !(\"data\" in value) || typeof value.data !== \"string\") throw new Error(\"\\\"redacted_reasoning\\\" parts expect an object with a \\\"data\\\" property.\");\n\t\t\treturn {\n\t\t\t\ttype: \"redacted_reasoning\",\n\t\t\t\tvalue: { data: value.data }\n\t\t\t};\n\t\t}\n\t},\n\t{\n\t\tcode: \"j\",\n\t\tname: \"reasoning_signature\",\n\t\tparse: (value) => {\n\t\t\tif (value == null || typeof value !== \"object\" || !(\"signature\" in value) || typeof value.signature !== \"string\") throw new Error(\"\\\"reasoning_signature\\\" parts expect an object with a \\\"signature\\\" property.\");\n\t\t\treturn {\n\t\t\t\ttype: \"reasoning_signature\",\n\t\t\t\tvalue: { signature: value.signature }\n\t\t\t};\n\t\t}\n\t},\n\t{\n\t\tcode: \"k\",\n\t\tname: \"file\",\n\t\tparse: (value) => {\n\t\t\tif (value == null || typeof value !== \"object\" || !(\"data\" in value) || typeof value.data !== \"string\" || !(\"mimeType\" in value) || typeof value.mimeType !== \"string\") throw new Error(\"\\\"file\\\" parts expect an object with a \\\"data\\\" and \\\"mimeType\\\" property.\");\n\t\t\treturn {\n\t\t\t\ttype: \"file\",\n\t\t\t\tvalue\n\t\t\t};\n\t\t}\n\t}\n];\nObject.fromEntries(dataStreamParts.map((part) => [part.code, part]));\nObject.fromEntries(dataStreamParts.map((part) => [part.name, part.code]));\ndataStreamParts.map((part) => part.code);\nfunction formatDataStreamPart(type, value) {\n\tconst streamPart = dataStreamParts.find((part) => part.name === type);\n\tif (!streamPart) throw new Error(`Invalid stream part type: ${type}`);\n\treturn `${streamPart.code}:${JSON.stringify(value)}\n`;\n}\n\"\\n\".charCodeAt(0);\n\"\\n\".charCodeAt(0);\nfunction zodSchema(zodSchema2, options) {\n\tvar _a;\n\treturn jsonSchema(esm_default(zodSchema2, {\n\t\t$refStrategy: ((_a = options == null ? void 0 : options.useReferences) != null ? _a : false) ? \"root\" : \"none\",\n\t\ttarget: \"jsonSchema7\"\n\t}), { validate: (value) => {\n\t\tconst result = zodSchema2.safeParse(value);\n\t\treturn result.success ? {\n\t\t\tsuccess: true,\n\t\t\tvalue: result.data\n\t\t} : {\n\t\t\tsuccess: false,\n\t\t\terror: result.error\n\t\t};\n\t} });\n}\nvar schemaSymbol = Symbol.for(\"vercel.ai.schema\");\nfunction jsonSchema(jsonSchema2, { validate } = {}) {\n\treturn {\n\t\t[schemaSymbol]: true,\n\t\t_type: void 0,\n\t\t[validatorSymbol]: true,\n\t\tjsonSchema: jsonSchema2,\n\t\tvalidate\n\t};\n}\nfunction isSchema(value) {\n\treturn typeof value === \"object\" && value !== null && schemaSymbol in value && value[schemaSymbol] === true && \"jsonSchema\" in value && \"validate\" in value;\n}\nfunction asSchema(schema) {\n\treturn isSchema(schema) ? schema : zodSchema(schema);\n}\n/** only globals that common to node and browsers are allowed */\nvar _globalThis = typeof globalThis === \"object\" ? globalThis : global;\nvar VERSION = \"1.9.0\";\nvar re = /^(\\d+)\\.(\\d+)\\.(\\d+)(-(.+))?$/;\n/**\n* Create a function to test an API version to see if it is compatible with the provided ownVersion.\n*\n* The returned function has the following semantics:\n* - Exact match is always compatible\n* - Major versions must match exactly\n* - 1.x package cannot use global 2.x package\n* - 2.x package cannot use global 1.x package\n* - The minor version of the API module requesting access to the global API must be less than or equal to the minor version of this API\n* - 1.3 package may use 1.4 global because the later global contains all functions 1.3 expects\n* - 1.4 package may NOT use 1.3 global because it may try to call functions which don't exist on 1.3\n* - If the major version is 0, the minor version is treated as the major and the patch is treated as the minor\n* - Patch and build tag differences are not considered at this time\n*\n* @param ownVersion version which should be checked against\n*/\nfunction _makeCompatibilityCheck(ownVersion) {\n\tvar acceptedVersions = /* @__PURE__ */ new Set([ownVersion]);\n\tvar rejectedVersions = /* @__PURE__ */ new Set();\n\tvar myVersionMatch = ownVersion.match(re);\n\tif (!myVersionMatch) return function() {\n\t\treturn false;\n\t};\n\tvar ownVersionParsed = {\n\t\tmajor: +myVersionMatch[1],\n\t\tminor: +myVersionMatch[2],\n\t\tpatch: +myVersionMatch[3],\n\t\tprerelease: myVersionMatch[4]\n\t};\n\tif (ownVersionParsed.prerelease != null) return function isExactmatch(globalVersion) {\n\t\treturn globalVersion === ownVersion;\n\t};\n\tfunction _reject(v) {\n\t\trejectedVersions.add(v);\n\t\treturn false;\n\t}\n\tfunction _accept(v) {\n\t\tacceptedVersions.add(v);\n\t\treturn true;\n\t}\n\treturn function isCompatible(globalVersion) {\n\t\tif (acceptedVersions.has(globalVersion)) return true;\n\t\tif (rejectedVersions.has(globalVersion)) return false;\n\t\tvar globalVersionMatch = globalVersion.match(re);\n\t\tif (!globalVersionMatch) return _reject(globalVersion);\n\t\tvar globalVersionParsed = {\n\t\t\tmajor: +globalVersionMatch[1],\n\t\t\tminor: +globalVersionMatch[2],\n\t\t\tpatch: +globalVersionMatch[3],\n\t\t\tprerelease: globalVersionMatch[4]\n\t\t};\n\t\tif (globalVersionParsed.prerelease != null) return _reject(globalVersion);\n\t\tif (ownVersionParsed.major !== globalVersionParsed.major) return _reject(globalVersion);\n\t\tif (ownVersionParsed.major === 0) {\n\t\t\tif (ownVersionParsed.minor === globalVersionParsed.minor && ownVersionParsed.patch <= globalVersionParsed.patch) return _accept(globalVersion);\n\t\t\treturn _reject(globalVersion);\n\t\t}\n\t\tif (ownVersionParsed.minor <= globalVersionParsed.minor) return _accept(globalVersion);\n\t\treturn _reject(globalVersion);\n\t};\n}\n/**\n* Test an API version to see if it is compatible with this API.\n*\n* - Exact match is always compatible\n* - Major versions must match exactly\n* - 1.x package cannot use global 2.x package\n* - 2.x package cannot use global 1.x package\n* - The minor version of the API module requesting access to the global API must be less than or equal to the minor version of this API\n* - 1.3 package may use 1.4 global because the later global contains all functions 1.3 expects\n* - 1.4 package may NOT use 1.3 global because it may try to call functions which don't exist on 1.3\n* - If the major version is 0, the minor version is treated as the major and the patch is treated as the minor\n* - Patch and build tag differences are not considered at this time\n*\n* @param version version of the API requesting an instance of the global API\n*/\nvar isCompatible = _makeCompatibilityCheck(VERSION);\nvar major = VERSION.split(\".\")[0];\nvar GLOBAL_OPENTELEMETRY_API_KEY = Symbol.for(\"opentelemetry.js.api.\" + major);\nvar _global = _globalThis;\nfunction registerGlobal(type, instance, diag, allowOverride) {\n\tvar _a;\n\tif (allowOverride === void 0) allowOverride = false;\n\tvar api = _global[GLOBAL_OPENTELEMETRY_API_KEY] = (_a = _global[GLOBAL_OPENTELEMETRY_API_KEY]) !== null && _a !== void 0 ? _a : { version: VERSION };\n\tif (!allowOverride && api[type]) {\n\t\tvar err = /* @__PURE__ */ new Error(\"@opentelemetry/api: Attempted duplicate registration of API: \" + type);\n\t\tdiag.error(err.stack || err.message);\n\t\treturn false;\n\t}\n\tif (api.version !== \"1.9.0\") {\n\t\tvar err = /* @__PURE__ */ new Error(\"@opentelemetry/api: Registration of version v\" + api.version + \" for \" + type + \" does not match previously registered API v\" + VERSION);\n\t\tdiag.error(err.stack || err.message);\n\t\treturn false;\n\t}\n\tapi[type] = instance;\n\tdiag.debug(\"@opentelemetry/api: Registered a global for \" + type + \" v\" + VERSION + \".\");\n\treturn true;\n}\nfunction getGlobal(type) {\n\tvar _a, _b;\n\tvar globalVersion = (_a = _global[GLOBAL_OPENTELEMETRY_API_KEY]) === null || _a === void 0 ? void 0 : _a.version;\n\tif (!globalVersion || !isCompatible(globalVersion)) return;\n\treturn (_b = _global[GLOBAL_OPENTELEMETRY_API_KEY]) === null || _b === void 0 ? void 0 : _b[type];\n}\nfunction unregisterGlobal(type, diag) {\n\tdiag.debug(\"@opentelemetry/api: Unregistering a global for \" + type + \" v\" + VERSION + \".\");\n\tvar api = _global[GLOBAL_OPENTELEMETRY_API_KEY];\n\tif (api) delete api[type];\n}\nvar __read$3 = function(o, n) {\n\tvar m = typeof Symbol === \"function\" && o[Symbol.iterator];\n\tif (!m) return o;\n\tvar i = m.call(o), r, ar = [], e;\n\ttry {\n\t\twhile ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\n\t} catch (error) {\n\t\te = { error };\n\t} finally {\n\t\ttry {\n\t\t\tif (r && !r.done && (m = i[\"return\"])) m.call(i);\n\t\t} finally {\n\t\t\tif (e) throw e.error;\n\t\t}\n\t}\n\treturn ar;\n};\nvar __spreadArray$3 = function(to, from, pack) {\n\tif (pack || arguments.length === 2) {\n\t\tfor (var i = 0, l = from.length, ar; i < l; i++) if (ar || !(i in from)) {\n\t\t\tif (!ar) ar = Array.prototype.slice.call(from, 0, i);\n\t\t\tar[i] = from[i];\n\t\t}\n\t}\n\treturn to.concat(ar || Array.prototype.slice.call(from));\n};\n/**\n* Component Logger which is meant to be used as part of any component which\n* will add automatically additional namespace in front of the log message.\n* It will then forward all message to global diag logger\n* @example\n* const cLogger = diag.createComponentLogger({ namespace: '@opentelemetry/instrumentation-http' });\n* cLogger.debug('test');\n* // @opentelemetry/instrumentation-http test\n*/\nvar DiagComponentLogger = function() {\n\tfunction DiagComponentLogger(props) {\n\t\tthis._namespace = props.namespace || \"DiagComponentLogger\";\n\t}\n\tDiagComponentLogger.prototype.debug = function() {\n\t\tvar args = [];\n\t\tfor (var _i = 0; _i < arguments.length; _i++) args[_i] = arguments[_i];\n\t\treturn logProxy(\"debug\", this._namespace, args);\n\t};\n\tDiagComponentLogger.prototype.error = function() {\n\t\tvar args = [];\n\t\tfor (var _i = 0; _i < arguments.length; _i++) args[_i] = arguments[_i];\n\t\treturn logProxy(\"error\", this._namespace, args);\n\t};\n\tDiagComponentLogger.prototype.info = function() {\n\t\tvar args = [];\n\t\tfor (var _i = 0; _i < arguments.length; _i++) args[_i] = arguments[_i];\n\t\treturn logProxy(\"info\", this._namespace, args);\n\t};\n\tDiagComponentLogger.prototype.warn = function() {\n\t\tvar args = [];\n\t\tfor (var _i = 0; _i < arguments.length; _i++) args[_i] = arguments[_i];\n\t\treturn logProxy(\"warn\", this._namespace, args);\n\t};\n\tDiagComponentLogger.prototype.verbose = function() {\n\t\tvar args = [];\n\t\tfor (var _i = 0; _i < arguments.length; _i++) args[_i] = arguments[_i];\n\t\treturn logProxy(\"verbose\", this._namespace, args);\n\t};\n\treturn DiagComponentLogger;\n}();\nfunction logProxy(funcName, namespace, args) {\n\tvar logger = getGlobal(\"diag\");\n\tif (!logger) return;\n\targs.unshift(namespace);\n\treturn logger[funcName].apply(logger, __spreadArray$3([], __read$3(args), false));\n}\n/**\n* Defines the available internal logging levels for the diagnostic logger, the numeric values\n* of the levels are defined to match the original values from the initial LogLevel to avoid\n* compatibility/migration issues for any implementation that assume the numeric ordering.\n*/\nvar DiagLogLevel;\n(function(DiagLogLevel) {\n\t/** Diagnostic Logging level setting to disable all logging (except and forced logs) */\n\tDiagLogLevel[DiagLogLevel[\"NONE\"] = 0] = \"NONE\";\n\t/** Identifies an error scenario */\n\tDiagLogLevel[DiagLogLevel[\"ERROR\"] = 30] = \"ERROR\";\n\t/** Identifies a warning scenario */\n\tDiagLogLevel[DiagLogLevel[\"WARN\"] = 50] = \"WARN\";\n\t/** General informational log message */\n\tDiagLogLevel[DiagLogLevel[\"INFO\"] = 60] = \"INFO\";\n\t/** General debug log message */\n\tDiagLogLevel[DiagLogLevel[\"DEBUG\"] = 70] = \"DEBUG\";\n\t/**\n\t* Detailed trace level logging should only be used for development, should only be set\n\t* in a development environment.\n\t*/\n\tDiagLogLevel[DiagLogLevel[\"VERBOSE\"] = 80] = \"VERBOSE\";\n\t/** Used to set the logging level to include all logging */\n\tDiagLogLevel[DiagLogLevel[\"ALL\"] = 9999] = \"ALL\";\n})(DiagLogLevel || (DiagLogLevel = {}));\nfunction createLogLevelDiagLogger(maxLevel, logger) {\n\tif (maxLevel < DiagLogLevel.NONE) maxLevel = DiagLogLevel.NONE;\n\telse if (maxLevel > DiagLogLevel.ALL) maxLevel = DiagLogLevel.ALL;\n\tlogger = logger || {};\n\tfunction _filterFunc(funcName, theLevel) {\n\t\tvar theFunc = logger[funcName];\n\t\tif (typeof theFunc === \"function\" && maxLevel >= theLevel) return theFunc.bind(logger);\n\t\treturn function() {};\n\t}\n\treturn {\n\t\terror: _filterFunc(\"error\", DiagLogLevel.ERROR),\n\t\twarn: _filterFunc(\"warn\", DiagLogLevel.WARN),\n\t\tinfo: _filterFunc(\"info\", DiagLogLevel.INFO),\n\t\tdebug: _filterFunc(\"debug\", DiagLogLevel.DEBUG),\n\t\tverbose: _filterFunc(\"verbose\", DiagLogLevel.VERBOSE)\n\t};\n}\nvar __read$2 = function(o, n) {\n\tvar m = typeof Symbol === \"function\" && o[Symbol.iterator];\n\tif (!m) return o;\n\tvar i = m.call(o), r, ar = [], e;\n\ttry {\n\t\twhile ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\n\t} catch (error) {\n\t\te = { error };\n\t} finally {\n\t\ttry {\n\t\t\tif (r && !r.done && (m = i[\"return\"])) m.call(i);\n\t\t} finally {\n\t\t\tif (e) throw e.error;\n\t\t}\n\t}\n\treturn ar;\n};\nvar __spreadArray$2 = function(to, from, pack) {\n\tif (pack || arguments.length === 2) {\n\t\tfor (var i = 0, l = from.length, ar; i < l; i++) if (ar || !(i in from)) {\n\t\t\tif (!ar) ar = Array.prototype.slice.call(from, 0, i);\n\t\t\tar[i] = from[i];\n\t\t}\n\t}\n\treturn to.concat(ar || Array.prototype.slice.call(from));\n};\nvar API_NAME$2 = \"diag\";\n/**\n* Singleton object which represents the entry point to the OpenTelemetry internal\n* diagnostic API\n*/\nvar DiagAPI = function() {\n\t/**\n\t* Private internal constructor\n\t* @private\n\t*/\n\tfunction DiagAPI() {\n\t\tfunction _logProxy(funcName) {\n\t\t\treturn function() {\n\t\t\t\tvar args = [];\n\t\t\t\tfor (var _i = 0; _i < arguments.length; _i++) args[_i] = arguments[_i];\n\t\t\t\tvar logger = getGlobal(\"diag\");\n\t\t\t\tif (!logger) return;\n\t\t\t\treturn logger[funcName].apply(logger, __spreadArray$2([], __read$2(args), false));\n\t\t\t};\n\t\t}\n\t\tvar self = this;\n\t\tvar setLogger = function(logger, optionsOrLogLevel) {\n\t\t\tvar _a, _b, _c;\n\t\t\tif (optionsOrLogLevel === void 0) optionsOrLogLevel = { logLevel: DiagLogLevel.INFO };\n\t\t\tif (logger === self) {\n\t\t\t\tvar err = /* @__PURE__ */ new Error(\"Cannot use diag as the logger for itself. Please use a DiagLogger implementation like ConsoleDiagLogger or a custom implementation\");\n\t\t\t\tself.error((_a = err.stack) !== null && _a !== void 0 ? _a : err.message);\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\tif (typeof optionsOrLogLevel === \"number\") optionsOrLogLevel = { logLevel: optionsOrLogLevel };\n\t\t\tvar oldLogger = getGlobal(\"diag\");\n\t\t\tvar newLogger = createLogLevelDiagLogger((_b = optionsOrLogLevel.logLevel) !== null && _b !== void 0 ? _b : DiagLogLevel.INFO, logger);\n\t\t\tif (oldLogger && !optionsOrLogLevel.suppressOverrideMessage) {\n\t\t\t\tvar stack = (_c = (/* @__PURE__ */ new Error()).stack) !== null && _c !== void 0 ? _c : \"<failed to generate stacktrace>\";\n\t\t\t\toldLogger.warn(\"Current logger will be overwritten from \" + stack);\n\t\t\t\tnewLogger.warn(\"Current logger will overwrite one already registered from \" + stack);\n\t\t\t}\n\t\t\treturn registerGlobal(\"diag\", newLogger, self, true);\n\t\t};\n\t\tself.setLogger = setLogger;\n\t\tself.disable = function() {\n\t\t\tunregisterGlobal(API_NAME$2, self);\n\t\t};\n\t\tself.createComponentLogger = function(options) {\n\t\t\treturn new DiagComponentLogger(options);\n\t\t};\n\t\tself.verbose = _logProxy(\"verbose\");\n\t\tself.debug = _logProxy(\"debug\");\n\t\tself.info = _logProxy(\"info\");\n\t\tself.warn = _logProxy(\"warn\");\n\t\tself.error = _logProxy(\"error\");\n\t}\n\t/** Get the singleton instance of the DiagAPI API */\n\tDiagAPI.instance = function() {\n\t\tif (!this._instance) this._instance = new DiagAPI();\n\t\treturn this._instance;\n\t};\n\treturn DiagAPI;\n}();\n/** Get a key to uniquely identify a context value */\nfunction createContextKey(description) {\n\treturn Symbol.for(description);\n}\n/** The root context is used as the default parent context when there is no active context */\nvar ROOT_CONTEXT = new (function() {\n\t/**\n\t* Construct a new context which inherits values from an optional parent context.\n\t*\n\t* @param parentContext a context from which to inherit values\n\t*/\n\tfunction BaseContext(parentContext) {\n\t\tvar self = this;\n\t\tself._currentContext = parentContext ? new Map(parentContext) : /* @__PURE__ */ new Map();\n\t\tself.getValue = function(key) {\n\t\t\treturn self._currentContext.get(key);\n\t\t};\n\t\tself.setValue = function(key, value) {\n\t\t\tvar context = new BaseContext(self._currentContext);\n\t\t\tcontext._currentContext.set(key, value);\n\t\t\treturn context;\n\t\t};\n\t\tself.deleteValue = function(key) {\n\t\t\tvar context = new BaseContext(self._currentContext);\n\t\t\tcontext._currentContext.delete(key);\n\t\t\treturn context;\n\t\t};\n\t}\n\treturn BaseContext;\n}())();\nvar __read$1 = function(o, n) {\n\tvar m = typeof Symbol === \"function\" && o[Symbol.iterator];\n\tif (!m) return o;\n\tvar i = m.call(o), r, ar = [], e;\n\ttry {\n\t\twhile ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\n\t} catch (error) {\n\t\te = { error };\n\t} finally {\n\t\ttry {\n\t\t\tif (r && !r.done && (m = i[\"return\"])) m.call(i);\n\t\t} finally {\n\t\t\tif (e) throw e.error;\n\t\t}\n\t}\n\treturn ar;\n};\nvar __spreadArray$1 = function(to, from, pack) {\n\tif (pack || arguments.length === 2) {\n\t\tfor (var i = 0, l = from.length, ar; i < l; i++) if (ar || !(i in from)) {\n\t\t\tif (!ar) ar = Array.prototype.slice.call(from, 0, i);\n\t\t\tar[i] = from[i];\n\t\t}\n\t}\n\treturn to.concat(ar || Array.prototype.slice.call(from));\n};\nvar NoopContextManager = function() {\n\tfunction NoopContextManager() {}\n\tNoopContextManager.prototype.active = function() {\n\t\treturn ROOT_CONTEXT;\n\t};\n\tNoopContextManager.prototype.with = function(_context, fn, thisArg) {\n\t\tvar args = [];\n\t\tfor (var _i = 3; _i < arguments.length; _i++) args[_i - 3] = arguments[_i];\n\t\treturn fn.call.apply(fn, __spreadArray$1([thisArg], __read$1(args), false));\n\t};\n\tNoopContextManager.prototype.bind = function(_context, target) {\n\t\treturn target;\n\t};\n\tNoopContextManager.prototype.enable = function() {\n\t\treturn this;\n\t};\n\tNoopContextManager.prototype.disable = function() {\n\t\treturn this;\n\t};\n\treturn NoopContextManager;\n}();\nvar __read = function(o, n) {\n\tvar m = typeof Symbol === \"function\" && o[Symbol.iterator];\n\tif (!m) return o;\n\tvar i = m.call(o), r, ar = [], e;\n\ttry {\n\t\twhile ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\n\t} catch (error) {\n\t\te = { error };\n\t} finally {\n\t\ttry {\n\t\t\tif (r && !r.done && (m = i[\"return\"])) m.call(i);\n\t\t} finally {\n\t\t\tif (e) throw e.error;\n\t\t}\n\t}\n\treturn ar;\n};\nvar __spreadArray = function(to, from, pack) {\n\tif (pack || arguments.length === 2) {\n\t\tfor (var i = 0, l = from.length, ar; i < l; i++) if (ar || !(i in from)) {\n\t\t\tif (!ar) ar = Array.prototype.slice.call(from, 0, i);\n\t\t\tar[i] = from[i];\n\t\t}\n\t}\n\treturn to.concat(ar || Array.prototype.slice.call(from));\n};\nvar API_NAME$1 = \"context\";\nvar NOOP_CONTEXT_MANAGER = new NoopContextManager();\n/**\n* Singleton object which represents the entry point to the OpenTelemetry Context API\n*/\nvar ContextAPI = function() {\n\t/** Empty private constructor prevents end users from constructing a new instance of the API */\n\tfunction ContextAPI() {}\n\t/** Get the singleton instance of the Context API */\n\tContextAPI.getInstance = function() {\n\t\tif (!this._instance) this._instance = new ContextAPI();\n\t\treturn this._instance;\n\t};\n\t/**\n\t* Set the current context manager.\n\t*\n\t* @returns true if the context manager was successfully registered, else false\n\t*/\n\tContextAPI.prototype.setGlobalContextManager = function(contextManager) {\n\t\treturn registerGlobal(API_NAME$1, contextManager, DiagAPI.instance());\n\t};\n\t/**\n\t* Get the currently active context\n\t*/\n\tContextAPI.prototype.active = function() {\n\t\treturn this._getContextManager().active();\n\t};\n\t/**\n\t* Execute a function with an active context\n\t*\n\t* @param context context to be active during function execution\n\t* @param fn function to execute in a context\n\t* @param thisArg optional receiver to be used for calling fn\n\t* @param args optional arguments forwarded to fn\n\t*/\n\tContextAPI.prototype.with = function(context, fn, thisArg) {\n\t\tvar _a;\n\t\tvar args = [];\n\t\tfor (var _i = 3; _i < arguments.length; _i++) args[_i - 3] = arguments[_i];\n\t\treturn (_a = this._getContextManager()).with.apply(_a, __spreadArray([\n\t\t\tcontext,\n\t\t\tfn,\n\t\t\tthisArg\n\t\t], __read(args), false));\n\t};\n\t/**\n\t* Bind a context to a target function or event emitter\n\t*\n\t* @param context context to bind to the event emitter or function. Defaults to the currently active context\n\t* @param target function or event emitter to bind\n\t*/\n\tContextAPI.prototype.bind = function(context, target) {\n\t\treturn this._getContextManager().bind(context, target);\n\t};\n\tContextAPI.prototype._getContextManager = function() {\n\t\treturn getGlobal(API_NAME$1) || NOOP_CONTEXT_MANAGER;\n\t};\n\t/** Disable and remove the global context manager */\n\tContextAPI.prototype.disable = function() {\n\t\tthis._getContextManager().disable();\n\t\tunregisterGlobal(API_NAME$1, DiagAPI.instance());\n\t};\n\treturn ContextAPI;\n}();\nvar TraceFlags;\n(function(TraceFlags) {\n\t/** Represents no flag set. */\n\tTraceFlags[TraceFlags[\"NONE\"] = 0] = \"NONE\";\n\t/** Bit to represent whether trace is sampled in trace flags. */\n\tTraceFlags[TraceFlags[\"SAMPLED\"] = 1] = \"SAMPLED\";\n})(TraceFlags || (TraceFlags = {}));\nvar INVALID_SPAN_CONTEXT = {\n\ttraceId: \"00000000000000000000000000000000\",\n\tspanId: \"0000000000000000\",\n\ttraceFlags: TraceFlags.NONE\n};\n/**\n* The NonRecordingSpan is the default {@link Span} that is used when no Span\n* implementation is available. All operations are no-op including context\n* propagation.\n*/\nvar NonRecordingSpan = function() {\n\tfunction NonRecordingSpan(_spanContext) {\n\t\tif (_spanContext === void 0) _spanContext = INVALID_SPAN_CONTEXT;\n\t\tthis._spanContext = _spanContext;\n\t}\n\tNonRecordingSpan.prototype.spanContext = function() {\n\t\treturn this._spanContext;\n\t};\n\tNonRecordingSpan.prototype.setAttribute = function(_key, _value) {\n\t\treturn this;\n\t};\n\tNonRecordingSpan.prototype.setAttributes = function(_attributes) {\n\t\treturn this;\n\t};\n\tNonRecordingSpan.prototype.addEvent = function(_name, _attributes) {\n\t\treturn this;\n\t};\n\tNonRecordingSpan.prototype.addLink = function(_link) {\n\t\treturn this;\n\t};\n\tNonRecordingSpan.prototype.addLinks = function(_links) {\n\t\treturn this;\n\t};\n\tNonRecordingSpan.prototype.setStatus = function(_status) {\n\t\treturn this;\n\t};\n\tNonRecordingSpan.prototype.updateName = function(_name) {\n\t\treturn this;\n\t};\n\tNonRecordingSpan.prototype.end = function(_endTime) {};\n\tNonRecordingSpan.prototype.isRecording = function() {\n\t\treturn false;\n\t};\n\tNonRecordingSpan.prototype.recordException = function(_exception, _time) {};\n\treturn NonRecordingSpan;\n}();\n/**\n* span key\n*/\nvar SPAN_KEY = createContextKey(\"OpenTelemetry Context Key SPAN\");\n/**\n* Return the span if one exists\n*\n* @param context context to get span from\n*/\nfunction getSpan(context) {\n\treturn context.getValue(SPAN_KEY) || void 0;\n}\n/**\n* Gets the span from the current context, if one exists.\n*/\nfunction getActiveSpan() {\n\treturn getSpan(ContextAPI.getInstance().active());\n}\n/**\n* Set the span on a context\n*\n* @param context context to use as parent\n* @param span span to set active\n*/\nfunction setSpan(context, span) {\n\treturn context.setValue(SPAN_KEY, span);\n}\n/**\n* Remove current span stored in the context\n*\n* @param context context to delete span from\n*/\nfunction deleteSpan(context) {\n\treturn context.deleteValue(SPAN_KEY);\n}\n/**\n* Wrap span context in a NoopSpan and set as span in a new\n* context\n*\n* @param context context to set active span on\n* @param spanContext span context to be wrapped\n*/\nfunction setSpanContext(context, spanContext) {\n\treturn setSpan(context, new NonRecordingSpan(spanContext));\n}\n/**\n* Get the span context of the span if it exists.\n*\n* @param context context to get values from\n*/\nfunction getSpanContext(context) {\n\tvar _a;\n\treturn (_a = getSpan(context)) === null || _a === void 0 ? void 0 : _a.spanContext();\n}\nvar VALID_TRACEID_REGEX = /^([0-9a-f]{32})$/i;\nvar VALID_SPANID_REGEX = /^[0-9a-f]{16}$/i;\nfunction isValidTraceId(traceId) {\n\treturn VALID_TRACEID_REGEX.test(traceId) && traceId !== \"00000000000000000000000000000000\";\n}\nfunction isValidSpanId(spanId) {\n\treturn VALID_SPANID_REGEX.test(spanId) && spanId !== \"0000000000000000\";\n}\n/**\n* Returns true if this {@link SpanContext} is valid.\n* @return true if this {@link SpanContext} is valid.\n*/\nfunction isSpanContextValid(spanContext) {\n\treturn isValidTraceId(spanContext.traceId) && isValidSpanId(spanContext.spanId);\n}\n/**\n* Wrap the given {@link SpanContext} in a new non-recording {@link Span}\n*\n* @param spanContext span context to be wrapped\n* @returns a new non-recording {@link Span} with the provided context\n*/\nfunction wrapSpanContext(spanContext) {\n\treturn new NonRecordingSpan(spanContext);\n}\nvar contextApi = ContextAPI.getInstance();\n/**\n* No-op implementations of {@link Tracer}.\n*/\nvar NoopTracer = function() {\n\tfunction NoopTracer() {}\n\tNoopTracer.prototype.startSpan = function(name, options, context) {\n\t\tif (context === void 0) context = contextApi.active();\n\t\tif (Boolean(options === null || options === void 0 ? void 0 : options.root)) return new NonRecordingSpan();\n\t\tvar parentFromContext = context && getSpanContext(context);\n\t\tif (isSpanContext(parentFromContext) && isSpanContextValid(parentFromContext)) return new NonRecordingSpan(parentFromContext);\n\t\telse return new NonRecordingSpan();\n\t};\n\tNoopTracer.prototype.startActiveSpan = function(name, arg2, arg3, arg4) {\n\t\tvar opts;\n\t\tvar ctx;\n\t\tvar fn;\n\t\tif (arguments.length < 2) return;\n\t\telse if (arguments.length === 2) fn = arg2;\n\t\telse if (arguments.length === 3) {\n\t\t\topts = arg2;\n\t\t\tfn = arg3;\n\t\t} else {\n\t\t\topts = arg2;\n\t\t\tctx = arg3;\n\t\t\tfn = arg4;\n\t\t}\n\t\tvar parentContext = ctx !== null && ctx !== void 0 ? ctx : contextApi.active();\n\t\tvar span = this.startSpan(name, opts, parentContext);\n\t\tvar contextWithSpanSet = setSpan(parentContext, span);\n\t\treturn contextApi.with(contextWithSpanSet, fn, void 0, span);\n\t};\n\treturn NoopTracer;\n}();\nfunction isSpanContext(spanContext) {\n\treturn typeof spanContext === \"object\" && typeof spanContext[\"spanId\"] === \"string\" && typeof spanContext[\"traceId\"] === \"string\" && typeof spanContext[\"traceFlags\"] === \"number\";\n}\nvar NOOP_TRACER = new NoopTracer();\n/**\n* Proxy tracer provided by the proxy tracer provider\n*/\nvar ProxyTracer = function() {\n\tfunction ProxyTracer(_provider, name, version, options) {\n\t\tthis._provider = _provider;\n\t\tthis.name = name;\n\t\tthis.version = version;\n\t\tthis.options = options;\n\t}\n\tProxyTracer.prototype.startSpan = function(name, options, context) {\n\t\treturn this._getTracer().startSpan(name, options, context);\n\t};\n\tProxyTracer.prototype.startActiveSpan = function(_name, _options, _context, _fn) {\n\t\tvar tracer = this._getTracer();\n\t\treturn Reflect.apply(tracer.startActiveSpan, tracer, arguments);\n\t};\n\t/**\n\t* Try to get a tracer from the proxy tracer provider.\n\t* If the proxy tracer provider has no delegate, return a noop tracer.\n\t*/\n\tProxyTracer.prototype._getTracer = function() {\n\t\tif (this._delegate) return this._delegate;\n\t\tvar tracer = this._provider.getDelegateTracer(this.name, this.version, this.options);\n\t\tif (!tracer) return NOOP_TRACER;\n\t\tthis._delegate = tracer;\n\t\treturn this._delegate;\n\t};\n\treturn ProxyTracer;\n}();\nvar NOOP_TRACER_PROVIDER = new (function() {\n\tfunction NoopTracerProvider() {}\n\tNoopTracerProvider.prototype.getTracer = function(_name, _version, _options) {\n\t\treturn new NoopTracer();\n\t};\n\treturn NoopTracerProvider;\n}())();\n/**\n* Tracer provider which provides {@link ProxyTracer}s.\n*\n* Before a delegate is set, tracers provided are NoOp.\n* When a delegate is set, traces are provided from the delegate.\n* When a delegate is set after tracers have already been provided,\n* all tracers already provided will use the provided delegate implementation.\n*/\nvar ProxyTracerProvider = function() {\n\tfunction ProxyTracerProvider() {}\n\t/**\n\t* Get a {@link ProxyTracer}\n\t*/\n\tProxyTracerProvider.prototype.getTracer = function(name, version, options) {\n\t\tvar _a;\n\t\treturn (_a = this.getDelegateTracer(name, version, options)) !== null && _a !== void 0 ? _a : new ProxyTracer(this, name, version, options);\n\t};\n\tProxyTracerProvider.prototype.getDelegate = function() {\n\t\tvar _a;\n\t\treturn (_a = this._delegate) !== null && _a !== void 0 ? _a : NOOP_TRACER_PROVIDER;\n\t};\n\t/**\n\t* Set the delegate tracer provider\n\t*/\n\tProxyTracerProvider.prototype.setDelegate = function(delegate) {\n\t\tthis._delegate = delegate;\n\t};\n\tProxyTracerProvider.prototype.getDelegateTracer = function(name, version, options) {\n\t\tvar _a;\n\t\treturn (_a = this._delegate) === null || _a === void 0 ? void 0 : _a.getTracer(name, version, options);\n\t};\n\treturn ProxyTracerProvider;\n}();\n/**\n* An enumeration of status codes.\n*/\nvar SpanStatusCode;\n(function(SpanStatusCode) {\n\t/**\n\t* The default status.\n\t*/\n\tSpanStatusCode[SpanStatusCode[\"UNSET\"] = 0] = \"UNSET\";\n\t/**\n\t* The operation has been validated by an Application developer or\n\t* Operator to have completed successfully.\n\t*/\n\tSpanStatusCode[SpanStatusCode[\"OK\"] = 1] = \"OK\";\n\t/**\n\t* The operation contains an error.\n\t*/\n\tSpanStatusCode[SpanStatusCode[\"ERROR\"] = 2] = \"ERROR\";\n})(SpanStatusCode || (SpanStatusCode = {}));\nvar API_NAME = \"trace\";\n(function() {\n\t/** Empty private constructor prevents end users from constructing a new instance of the API */\n\tfunction TraceAPI() {\n\t\tthis._proxyTracerProvider = new ProxyTracerProvider();\n\t\tthis.wrapSpanContext = wrapSpanContext;\n\t\tthis.isSpanContextValid = isSpanContextValid;\n\t\tthis.deleteSpan = deleteSpan;\n\t\tthis.getSpan = getSpan;\n\t\tthis.getActiveSpan = getActiveSpan;\n\t\tthis.getSpanContext = getSpanContext;\n\t\tthis.setSpan = setSpan;\n\t\tthis.setSpanContext = setSpanContext;\n\t}\n\t/** Get the singleton instance of the Trace API */\n\tTraceAPI.getInstance = function() {\n\t\tif (!this._instance) this._instance = new TraceAPI();\n\t\treturn this._instance;\n\t};\n\t/**\n\t* Set the current global tracer.\n\t*\n\t* @returns true if the tracer provider was successfully registered, else false\n\t*/\n\tTraceAPI.prototype.setGlobalTracerProvider = function(provider) {\n\t\tvar success = registerGlobal(API_NAME, this._proxyTracerProvider, DiagAPI.instance());\n\t\tif (success) this._proxyTracerProvider.setDelegate(provider);\n\t\treturn success;\n\t};\n\t/**\n\t* Returns the global tracer provider.\n\t*/\n\tTraceAPI.prototype.getTracerProvider = function() {\n\t\treturn getGlobal(API_NAME) || this._proxyTracerProvider;\n\t};\n\t/**\n\t* Returns a tracer from the global tracer provider.\n\t*/\n\tTraceAPI.prototype.getTracer = function(name, version) {\n\t\treturn this.getTracerProvider().getTracer(name, version);\n\t};\n\t/** Remove the global tracer provider */\n\tTraceAPI.prototype.disable = function() {\n\t\tunregisterGlobal(API_NAME, DiagAPI.instance());\n\t\tthis._proxyTracerProvider = new ProxyTracerProvider();\n\t};\n\treturn TraceAPI;\n})().getInstance();\nvar __defProp = Object.defineProperty;\nvar __export = (target, all) => {\n\tfor (var name17 in all) __defProp(target, name17, {\n\t\tget: all[name17],\n\t\tenumerable: true\n\t});\n};\nfunction prepareResponseHeaders(headers, { contentType, dataStreamVersion }) {\n\tconst responseHeaders = new Headers(headers != null ? headers : {});\n\tif (!responseHeaders.has(\"Content-Type\")) responseHeaders.set(\"Content-Type\", contentType);\n\tif (dataStreamVersion !== void 0) responseHeaders.set(\"X-Vercel-AI-Data-Stream\", dataStreamVersion);\n\treturn responseHeaders;\n}\nvar name4 = \"AI_NoObjectGeneratedError\";\nvar marker4 = `vercel.ai.error.${name4}`;\nvar symbol4 = Symbol.for(marker4);\nvar _a4;\nvar NoObjectGeneratedError = class extends AISDKError {\n\tconstructor({ message = \"No object generated.\", cause, text: text2, response, usage, finishReason }) {\n\t\tsuper({\n\t\t\tname: name4,\n\t\t\tmessage,\n\t\t\tcause\n\t\t});\n\t\tthis[_a4] = true;\n\t\tthis.text = text2;\n\t\tthis.response = response;\n\t\tthis.usage = usage;\n\t\tthis.finishReason = finishReason;\n\t}\n\tstatic isInstance(error) {\n\t\treturn AISDKError.hasMarker(error, marker4);\n\t}\n};\n_a4 = symbol4;\nvar dataContentSchema = z$1.union([\n\tz$1.string(),\n\tz$1.instanceof(Uint8Array),\n\tz$1.instanceof(ArrayBuffer),\n\tz$1.custom((value) => {\n\t\tvar _a17, _b;\n\t\treturn (_b = (_a17 = globalThis.Buffer) == null ? void 0 : _a17.isBuffer(value)) != null ? _b : false;\n\t}, { message: \"Must be a Buffer\" })\n]);\nvar jsonValueSchema = z$1.lazy(() => z$1.union([\n\tz$1.null(),\n\tz$1.string(),\n\tz$1.number(),\n\tz$1.boolean(),\n\tz$1.record(z$1.string(), jsonValueSchema),\n\tz$1.array(jsonValueSchema)\n]));\nvar providerMetadataSchema = z$1.record(z$1.string(), z$1.record(z$1.string(), jsonValueSchema));\nvar toolResultContentSchema = z$1.array(z$1.union([z$1.object({\n\ttype: z$1.literal(\"text\"),\n\ttext: z$1.string()\n}), z$1.object({\n\ttype: z$1.literal(\"image\"),\n\tdata: z$1.string(),\n\tmimeType: z$1.string().optional()\n})]));\nvar textPartSchema = z$1.object({\n\ttype: z$1.literal(\"text\"),\n\ttext: z$1.string(),\n\tproviderOptions: providerMetadataSchema.optional(),\n\texperimental_providerMetadata: providerMetadataSchema.optional()\n});\nvar imagePartSchema = z$1.object({\n\ttype: z$1.literal(\"image\"),\n\timage: z$1.union([dataContentSchema, z$1.instanceof(URL)]),\n\tmimeType: z$1.string().optional(),\n\tproviderOptions: providerMetadataSchema.optional(),\n\texperimental_providerMetadata: providerMetadataSchema.optional()\n});\nvar filePartSchema = z$1.object({\n\ttype: z$1.literal(\"file\"),\n\tdata: z$1.union([dataContentSchema, z$1.instanceof(URL)]),\n\tfilename: z$1.string().optional(),\n\tmimeType: z$1.string(),\n\tproviderOptions: providerMetadataSchema.optional(),\n\texperimental_providerMetadata: providerMetadataSchema.optional()\n});\nvar reasoningPartSchema = z$1.object({\n\ttype: z$1.literal(\"reasoning\"),\n\ttext: z$1.string(),\n\tproviderOptions: providerMetadataSchema.optional(),\n\texperimental_providerMetadata: providerMetadataSchema.optional()\n});\nvar redactedReasoningPartSchema = z$1.object({\n\ttype: z$1.literal(\"redacted-reasoning\"),\n\tdata: z$1.string(),\n\tproviderOptions: providerMetadataSchema.optional(),\n\texperimental_providerMetadata: providerMetadataSchema.optional()\n});\nvar toolCallPartSchema = z$1.object({\n\ttype: z$1.literal(\"tool-call\"),\n\ttoolCallId: z$1.string(),\n\ttoolName: z$1.string(),\n\targs: z$1.unknown(),\n\tproviderOptions: providerMetadataSchema.optional(),\n\texperimental_providerMetadata: providerMetadataSchema.optional()\n});\nvar toolResultPartSchema = z$1.object({\n\ttype: z$1.literal(\"tool-result\"),\n\ttoolCallId: z$1.string(),\n\ttoolName: z$1.string(),\n\tresult: z$1.unknown(),\n\tcontent: toolResultContentSchema.optional(),\n\tisError: z$1.boolean().optional(),\n\tproviderOptions: providerMetadataSchema.optional(),\n\texperimental_providerMetadata: providerMetadataSchema.optional()\n});\nvar coreSystemMessageSchema = z$1.object({\n\trole: z$1.literal(\"system\"),\n\tcontent: z$1.string(),\n\tproviderOptions: providerMetadataSchema.optional(),\n\texperimental_providerMetadata: providerMetadataSchema.optional()\n});\nvar coreUserMessageSchema = z$1.object({\n\trole: z$1.literal(\"user\"),\n\tcontent: z$1.union([z$1.string(), z$1.array(z$1.union([\n\t\ttextPartSchema,\n\t\timagePartSchema,\n\t\tfilePartSchema\n\t]))]),\n\tproviderOptions: providerMetadataSchema.optional(),\n\texperimental_providerMetadata: providerMetadataSchema.optional()\n});\nvar coreAssistantMessageSchema = z$1.object({\n\trole: z$1.literal(\"assistant\"),\n\tcontent: z$1.union([z$1.string(), z$1.array(z$1.union([\n\t\ttextPartSchema,\n\t\tfilePartSchema,\n\t\treasoningPartSchema,\n\t\tredactedReasoningPartSchema,\n\t\ttoolCallPartSchema\n\t]))]),\n\tproviderOptions: providerMetadataSchema.optional(),\n\texperimental_providerMetadata: providerMetadataSchema.optional()\n});\nvar coreToolMessageSchema = z$1.object({\n\trole: z$1.literal(\"tool\"),\n\tcontent: z$1.array(toolResultPartSchema),\n\tproviderOptions: providerMetadataSchema.optional(),\n\texperimental_providerMetadata: providerMetadataSchema.optional()\n});\nz$1.union([\n\tcoreSystemMessageSchema,\n\tcoreUserMessageSchema,\n\tcoreAssistantMessageSchema,\n\tcoreToolMessageSchema\n]);\nvar DEFAULT_SCHEMA_PREFIX = \"JSON schema:\";\nvar DEFAULT_SCHEMA_SUFFIX = \"You MUST answer with a JSON object that matches the JSON schema above.\";\nvar DEFAULT_GENERIC_SUFFIX = \"You MUST answer with JSON.\";\nfunction injectJsonInstruction({ prompt, schema, schemaPrefix = schema != null ? DEFAULT_SCHEMA_PREFIX : void 0, schemaSuffix = schema != null ? DEFAULT_SCHEMA_SUFFIX : DEFAULT_GENERIC_SUFFIX }) {\n\treturn [\n\t\tprompt != null && prompt.length > 0 ? prompt : void 0,\n\t\tprompt != null && prompt.length > 0 ? \"\" : void 0,\n\t\tschemaPrefix,\n\t\tschema != null ? JSON.stringify(schema) : void 0,\n\t\tschemaSuffix\n\t].filter((line) => line != null).join(\"\\n\");\n}\ncreateIdGenerator({\n\tprefix: \"aiobj\",\n\tsize: 24\n});\ncreateIdGenerator({\n\tprefix: \"aiobj\",\n\tsize: 24\n});\ncreateIdGenerator({\n\tprefix: \"aitxt\",\n\tsize: 24\n});\ncreateIdGenerator({\n\tprefix: \"msg\",\n\tsize: 24\n});\n__export({}, {\n\tobject: () => object,\n\ttext: () => text\n});\nvar text = () => ({\n\ttype: \"text\",\n\tresponseFormat: () => ({ type: \"text\" }),\n\tinjectIntoSystemPrompt({ system }) {\n\t\treturn system;\n\t},\n\tparsePartial({ text: text2 }) {\n\t\treturn { partial: text2 };\n\t},\n\tparseOutput({ text: text2 }) {\n\t\treturn text2;\n\t}\n});\nvar object = ({ schema: inputSchema }) => {\n\tconst schema = asSchema(inputSchema);\n\treturn {\n\t\ttype: \"object\",\n\t\tresponseFormat: ({ model }) => ({\n\t\t\ttype: \"json\",\n\t\t\tschema: model.supportsStructuredOutputs ? schema.jsonSchema : void 0\n\t\t}),\n\t\tinjectIntoSystemPrompt({ system, model }) {\n\t\t\treturn model.supportsStructuredOutputs ? system : injectJsonInstruction({\n\t\t\t\tprompt: system,\n\t\t\t\tschema: schema.jsonSchema\n\t\t\t});\n\t\t},\n\t\tparsePartial({ text: text2 }) {\n\t\t\tconst result = parsePartialJson(text2);\n\t\t\tswitch (result.state) {\n\t\t\t\tcase \"failed-parse\":\n\t\t\t\tcase \"undefined-input\": return;\n\t\t\t\tcase \"repaired-parse\":\n\t\t\t\tcase \"successful-parse\": return { partial: result.value };\n\t\t\t\tdefault: {\n\t\t\t\t\tconst _exhaustiveCheck = result.state;\n\t\t\t\t\tthrow new Error(`Unsupported parse state: ${_exhaustiveCheck}`);\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t\tparseOutput({ text: text2 }, context) {\n\t\t\tconst parseResult = safeParseJSON({ text: text2 });\n\t\t\tif (!parseResult.success) throw new NoObjectGeneratedError({\n\t\t\t\tmessage: \"No object generated: could not parse the response.\",\n\t\t\t\tcause: parseResult.error,\n\t\t\t\ttext: text2,\n\t\t\t\tresponse: context.response,\n\t\t\t\tusage: context.usage,\n\t\t\t\tfinishReason: context.finishReason\n\t\t\t});\n\t\t\tconst validationResult = safeValidateTypes({\n\t\t\t\tvalue: parseResult.value,\n\t\t\t\tschema\n\t\t\t});\n\t\t\tif (!validationResult.success) throw new NoObjectGeneratedError({\n\t\t\t\tmessage: \"No object generated: response did not match schema.\",\n\t\t\t\tcause: validationResult.error,\n\t\t\t\ttext: text2,\n\t\t\t\tresponse: context.response,\n\t\t\t\tusage: context.usage,\n\t\t\t\tfinishReason: context.finishReason\n\t\t\t});\n\t\t\treturn validationResult.value;\n\t\t}\n\t};\n};\nfunction mergeStreams(stream1, stream2) {\n\tconst reader1 = stream1.getReader();\n\tconst reader2 = stream2.getReader();\n\tlet lastRead1 = void 0;\n\tlet lastRead2 = void 0;\n\tlet stream1Done = false;\n\tlet stream2Done = false;\n\tasync function readStream1(controller) {\n\t\ttry {\n\t\t\tif (lastRead1 == null) lastRead1 = reader1.read();\n\t\t\tconst result = await lastRead1;\n\t\t\tlastRead1 = void 0;\n\t\t\tif (!result.done) controller.enqueue(result.value);\n\t\t\telse controller.close();\n\t\t} catch (error) {\n\t\t\tcontroller.error(error);\n\t\t}\n\t}\n\tasync function readStream2(controller) {\n\t\ttry {\n\t\t\tif (lastRead2 == null) lastRead2 = reader2.read();\n\t\t\tconst result = await lastRead2;\n\t\t\tlastRead2 = void 0;\n\t\t\tif (!result.done) controller.enqueue(result.value);\n\t\t\telse controller.close();\n\t\t} catch (error) {\n\t\t\tcontroller.error(error);\n\t\t}\n\t}\n\treturn new ReadableStream({\n\t\tasync pull(controller) {\n\t\t\ttry {\n\t\t\t\tif (stream1Done) {\n\t\t\t\t\tawait readStream2(controller);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tif (stream2Done) {\n\t\t\t\t\tawait readStream1(controller);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tif (lastRead1 == null) lastRead1 = reader1.read();\n\t\t\t\tif (lastRead2 == null) lastRead2 = reader2.read();\n\t\t\t\tconst { result, reader } = await Promise.race([lastRead1.then((result2) => ({\n\t\t\t\t\tresult: result2,\n\t\t\t\t\treader: reader1\n\t\t\t\t})), lastRead2.then((result2) => ({\n\t\t\t\t\tresult: result2,\n\t\t\t\t\treader: reader2\n\t\t\t\t}))]);\n\t\t\t\tif (!result.done) controller.enqueue(result.value);\n\t\t\t\tif (reader === reader1) {\n\t\t\t\t\tlastRead1 = void 0;\n\t\t\t\t\tif (result.done) {\n\t\t\t\t\t\tawait readStream2(controller);\n\t\t\t\t\t\tstream1Done = true;\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tlastRead2 = void 0;\n\t\t\t\t\tif (result.done) {\n\t\t\t\t\t\tstream2Done = true;\n\t\t\t\t\t\tawait readStream1(controller);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} catch (error) {\n\t\t\t\tcontroller.error(error);\n\t\t\t}\n\t\t},\n\t\tcancel() {\n\t\t\treader1.cancel();\n\t\t\treader2.cancel();\n\t\t}\n\t});\n}\ncreateIdGenerator({\n\tprefix: \"aitxt\",\n\tsize: 24\n});\ncreateIdGenerator({\n\tprefix: \"msg\",\n\tsize: 24\n});\nvar ClientOrServerImplementationSchema = z$1.object({\n\tname: z$1.string(),\n\tversion: z$1.string()\n}).passthrough();\nvar BaseParamsSchema = z$1.object({ _meta: z$1.optional(z$1.object({}).passthrough()) }).passthrough();\nvar ResultSchema = BaseParamsSchema;\nvar RequestSchema = z$1.object({\n\tmethod: z$1.string(),\n\tparams: z$1.optional(BaseParamsSchema)\n});\nvar ServerCapabilitiesSchema = z$1.object({\n\texperimental: z$1.optional(z$1.object({}).passthrough()),\n\tlogging: z$1.optional(z$1.object({}).passthrough()),\n\tprompts: z$1.optional(z$1.object({ listChanged: z$1.optional(z$1.boolean()) }).passthrough()),\n\tresources: z$1.optional(z$1.object({\n\t\tsubscribe: z$1.optional(z$1.boolean()),\n\t\tlistChanged: z$1.optional(z$1.boolean())\n\t}).passthrough()),\n\ttools: z$1.optional(z$1.object({ listChanged: z$1.optional(z$1.boolean()) }).passthrough())\n}).passthrough();\nResultSchema.extend({\n\tprotocolVersion: z$1.string(),\n\tcapabilities: ServerCapabilitiesSchema,\n\tserverInfo: ClientOrServerImplementationSchema,\n\tinstructions: z$1.optional(z$1.string())\n});\nvar PaginatedResultSchema = ResultSchema.extend({ nextCursor: z$1.optional(z$1.string()) });\nvar ToolSchema = z$1.object({\n\tname: z$1.string(),\n\tdescription: z$1.optional(z$1.string()),\n\tinputSchema: z$1.object({\n\t\ttype: z$1.literal(\"object\"),\n\t\tproperties: z$1.optional(z$1.object({}).passthrough())\n\t}).passthrough()\n}).passthrough();\nPaginatedResultSchema.extend({ tools: z$1.array(ToolSchema) });\nvar TextContentSchema = z$1.object({\n\ttype: z$1.literal(\"text\"),\n\ttext: z$1.string()\n}).passthrough();\nvar ImageContentSchema = z$1.object({\n\ttype: z$1.literal(\"image\"),\n\tdata: z$1.string().base64(),\n\tmimeType: z$1.string()\n}).passthrough();\nvar ResourceContentsSchema = z$1.object({\n\t/**\n\t* The URI of this resource.\n\t*/\n\turi: z$1.string(),\n\t/**\n\t* The MIME type of this resource, if known.\n\t*/\n\tmimeType: z$1.optional(z$1.string())\n}).passthrough();\nvar TextResourceContentsSchema = ResourceContentsSchema.extend({ text: z$1.string() });\nvar BlobResourceContentsSchema = ResourceContentsSchema.extend({ blob: z$1.string().base64() });\nvar EmbeddedResourceSchema = z$1.object({\n\ttype: z$1.literal(\"resource\"),\n\tresource: z$1.union([TextResourceContentsSchema, BlobResourceContentsSchema])\n}).passthrough();\nResultSchema.extend({\n\tcontent: z$1.array(z$1.union([\n\t\tTextContentSchema,\n\t\tImageContentSchema,\n\t\tEmbeddedResourceSchema\n\t])),\n\tisError: z$1.boolean().default(false).optional()\n}).or(ResultSchema.extend({ toolResult: z$1.unknown() }));\nvar JSONRPC_VERSION = \"2.0\";\nvar JSONRPCRequestSchema = z$1.object({\n\tjsonrpc: z$1.literal(JSONRPC_VERSION),\n\tid: z$1.union([z$1.string(), z$1.number().int()])\n}).merge(RequestSchema).strict();\nvar JSONRPCResponseSchema = z$1.object({\n\tjsonrpc: z$1.literal(JSONRPC_VERSION),\n\tid: z$1.union([z$1.string(), z$1.number().int()]),\n\tresult: ResultSchema\n}).strict();\nvar JSONRPCErrorSchema = z$1.object({\n\tjsonrpc: z$1.literal(JSONRPC_VERSION),\n\tid: z$1.union([z$1.string(), z$1.number().int()]),\n\terror: z$1.object({\n\t\tcode: z$1.number().int(),\n\t\tmessage: z$1.string(),\n\t\tdata: z$1.optional(z$1.unknown())\n\t})\n}).strict();\nvar JSONRPCNotificationSchema = z$1.object({ jsonrpc: z$1.literal(JSONRPC_VERSION) }).merge(z$1.object({\n\tmethod: z$1.string(),\n\tparams: z$1.optional(BaseParamsSchema)\n})).strict();\nz$1.union([\n\tJSONRPCRequestSchema,\n\tJSONRPCNotificationSchema,\n\tJSONRPCResponseSchema,\n\tJSONRPCErrorSchema\n]);\n__export({}, {\n\tmergeIntoDataStream: () => mergeIntoDataStream,\n\ttoDataStream: () => toDataStream,\n\ttoDataStreamResponse: () => toDataStreamResponse\n});\nfunction createCallbacksTransformer(callbacks = {}) {\n\tconst textEncoder = new TextEncoder();\n\tlet aggregatedResponse = \"\";\n\treturn new TransformStream({\n\t\tasync start() {\n\t\t\tif (callbacks.onStart) await callbacks.onStart();\n\t\t},\n\t\tasync transform(message, controller) {\n\t\t\tcontroller.enqueue(textEncoder.encode(message));\n\t\t\taggregatedResponse += message;\n\t\t\tif (callbacks.onToken) await callbacks.onToken(message);\n\t\t\tif (callbacks.onText && typeof message === \"string\") await callbacks.onText(message);\n\t\t},\n\t\tasync flush() {\n\t\t\tif (callbacks.onCompletion) await callbacks.onCompletion(aggregatedResponse);\n\t\t\tif (callbacks.onFinal) await callbacks.onFinal(aggregatedResponse);\n\t\t}\n\t});\n}\nfunction toDataStreamInternal(stream, callbacks) {\n\treturn stream.pipeThrough(new TransformStream({ transform: async (value, controller) => {\n\t\tvar _a17;\n\t\tif (typeof value === \"string\") {\n\t\t\tcontroller.enqueue(value);\n\t\t\treturn;\n\t\t}\n\t\tif (\"event\" in value) {\n\t\t\tif (value.event === \"on_chat_model_stream\") forwardAIMessageChunk((_a17 = value.data) == null ? void 0 : _a17.chunk, controller);\n\t\t\treturn;\n\t\t}\n\t\tforwardAIMessageChunk(value, controller);\n\t} })).pipeThrough(createCallbacksTransformer(callbacks)).pipeThrough(new TextDecoderStream()).pipeThrough(new TransformStream({ transform: async (chunk, controller) => {\n\t\tcontroller.enqueue(formatDataStreamPart(\"text\", chunk));\n\t} }));\n}\nfunction toDataStream(stream, callbacks) {\n\treturn toDataStreamInternal(stream, callbacks).pipeThrough(new TextEncoderStream());\n}\nfunction toDataStreamResponse(stream, options) {\n\tvar _a17;\n\tconst dataStream = toDataStreamInternal(stream, options == null ? void 0 : options.callbacks).pipeThrough(new TextEncoderStream());\n\tconst data = options == null ? void 0 : options.data;\n\tconst init = options == null ? void 0 : options.init;\n\tconst responseStream = data ? mergeStreams(data.stream, dataStream) : dataStream;\n\treturn new Response(responseStream, {\n\t\tstatus: (_a17 = init == null ? void 0 : init.status) != null ? _a17 : 200,\n\t\tstatusText: init == null ? void 0 : init.statusText,\n\t\theaders: prepareResponseHeaders(init == null ? void 0 : init.headers, {\n\t\t\tcontentType: \"text/plain; charset=utf-8\",\n\t\t\tdataStreamVersion: \"v1\"\n\t\t})\n\t});\n}\nfunction mergeIntoDataStream(stream, options) {\n\toptions.dataStream.merge(toDataStreamInternal(stream, options.callbacks));\n}\nfunction forwardAIMessageChunk(chunk, controller) {\n\tif (typeof chunk.content === \"string\") controller.enqueue(chunk.content);\n\telse {\n\t\tconst content = chunk.content;\n\t\tfor (const item of content) if (item.type === \"text\") controller.enqueue(item.text);\n\t}\n}\n__export({}, {\n\tmergeIntoDataStream: () => mergeIntoDataStream2,\n\ttoDataStream: () => toDataStream2,\n\ttoDataStreamResponse: () => toDataStreamResponse2\n});\nfunction toDataStreamInternal2(stream, callbacks) {\n\tconst trimStart = trimStartOfStream();\n\treturn convertAsyncIteratorToReadableStream(stream[Symbol.asyncIterator]()).pipeThrough(new TransformStream({ async transform(message, controller) {\n\t\tcontroller.enqueue(trimStart(message.delta));\n\t} })).pipeThrough(createCallbacksTransformer(callbacks)).pipeThrough(new TextDecoderStream()).pipeThrough(new TransformStream({ transform: async (chunk, controller) => {\n\t\tcontroller.enqueue(formatDataStreamPart(\"text\", chunk));\n\t} }));\n}\nfunction toDataStream2(stream, callbacks) {\n\treturn toDataStreamInternal2(stream, callbacks).pipeThrough(new TextEncoderStream());\n}\nfunction toDataStreamResponse2(stream, options = {}) {\n\tvar _a17;\n\tconst { init, data, callbacks } = options;\n\tconst dataStream = toDataStreamInternal2(stream, callbacks).pipeThrough(new TextEncoderStream());\n\tconst responseStream = data ? mergeStreams(data.stream, dataStream) : dataStream;\n\treturn new Response(responseStream, {\n\t\tstatus: (_a17 = init == null ? void 0 : init.status) != null ? _a17 : 200,\n\t\tstatusText: init == null ? void 0 : init.statusText,\n\t\theaders: prepareResponseHeaders(init == null ? void 0 : init.headers, {\n\t\t\tcontentType: \"text/plain; charset=utf-8\",\n\t\t\tdataStreamVersion: \"v1\"\n\t\t})\n\t});\n}\nfunction mergeIntoDataStream2(stream, options) {\n\toptions.dataStream.merge(toDataStreamInternal2(stream, options.callbacks));\n}\nfunction trimStartOfStream() {\n\tlet isStreamStart = true;\n\treturn (text2) => {\n\t\tif (isStreamStart) {\n\t\t\ttext2 = text2.trimStart();\n\t\t\tif (text2) isStreamStart = false;\n\t\t}\n\t\treturn text2;\n\t};\n}\n//#endregion\n//#region src/utils.ts\n/**\n* Converts a Zod schema to an AI SDK Schema with validation support.\n*\n* This function mirrors the behavior of Vercel's AI SDK zod-schema utility but allows\n* customization of the JSON Schema target format.\n*\n* @param zodSchema - The Zod schema to convert\n* @param target - The JSON Schema target format (defaults to 'jsonSchema7')\n* @returns An AI SDK Schema object with built-in validation\n*\n* @example\n* ```typescript\n* import { z } from 'zod';\n* import { convertZodSchemaToAISDKSchema } from '@mastra/schema-compat';\n*\n* const userSchema = z.object({\n* name: z.string(),\n* age: z.number().min(0)\n* });\n*\n* const aiSchema = convertZodSchemaToAISDKSchema(userSchema);\n* ```\n*/\nfunction convertZodSchemaToAISDKSchema(zodSchema, target = \"jsonSchema7\") {\n\treturn jsonSchema(zodToJsonSchema$1(zodSchema, target), { validate: (value) => {\n\t\tconst result = zodSchema.safeParse(value);\n\t\treturn result.success ? {\n\t\t\tsuccess: true,\n\t\t\tvalue: result.data\n\t\t} : {\n\t\t\tsuccess: false,\n\t\t\terror: result.error\n\t\t};\n\t} });\n}\n/**\n* Checks if a value is a Zod type by examining its properties and methods.\n*\n* @param value - The value to check\n* @returns True if the value is a Zod type, false otherwise\n* @internal\n*/\nfunction isZodType(value) {\n\treturn typeof value === \"object\" && value !== null && (\"_def\" in value || \"_zod\" in value) && \"parse\" in value && typeof value.parse === \"function\" && \"safeParse\" in value && typeof value.safeParse === \"function\";\n}\n/**\n* Converts an AI SDK Schema or Zod schema to a Zod schema.\n*\n* If the input is already a Zod schema, it returns it unchanged.\n* If the input is an AI SDK Schema, it extracts the JSON schema and converts it to Zod.\n*\n* @param schema - The schema to convert (AI SDK Schema or Zod schema)\n* @returns A Zod schema equivalent of the input\n* @throws Error if the conversion fails\n*\n* @example\n* ```typescript\n* import { jsonSchema } from 'ai';\n* import { convertSchemaToZod } from '@mastra/schema-compat';\n*\n* const aiSchema = jsonSchema({\n* type: 'object',\n* properties: {\n* name: { type: 'string' }\n* }\n* });\n*\n* const zodSchema = convertSchemaToZod(aiSchema);\n* ```\n*/\nfunction convertSchemaToZod(schema) {\n\tif (isZodType(schema)) return schema;\n\telse {\n\t\tconst jsonSchemaToConvert = \"jsonSchema\" in schema ? schema.jsonSchema : schema;\n\t\ttry {\n\t\t\tif (\"toJSONSchema\" in z$1) return convertJsonSchemaToZod(jsonSchemaToConvert);\n\t\t\telse return convertJsonSchemaToZod$1(jsonSchemaToConvert);\n\t\t} catch (e) {\n\t\t\tconst errorMessage = `[Schema Builder] Failed to convert schema parameters to Zod. Original schema: ${JSON.stringify(jsonSchemaToConvert)}`;\n\t\t\tconsole.error(errorMessage, e);\n\t\t\tthrow new Error(errorMessage + (e instanceof Error ? `\\n${e.stack}` : \"\\nUnknown error object\"));\n\t\t}\n\t}\n}\n/**\n* Processes a schema using provider compatibility layers and converts it to the specified format.\n*\n* This function automatically applies the first matching compatibility layer from the provided\n* list based on the model configuration. If no compatibility applies, it falls back to\n* standard conversion.\n*\n* @param options - Configuration object for schema processing\n* @param options.schema - The schema to process (AI SDK Schema or Zod object schema)\n* @param options.compatLayers - Array of compatibility layers to try\n* @param options.mode - Output format: 'jsonSchema' for JSONSchema7 or 'aiSdkSchema' for AI SDK Schema\n* @returns Processed schema in the requested format\n*\n* @example\n* ```typescript\n* import { z } from 'zod';\n* import { applyCompatLayer, OpenAISchemaCompatLayer, AnthropicSchemaCompatLayer } from '@mastra/schema-compat';\n*\n* const schema = z.object({\n* query: z.string().email(),\n* limit: z.number().min(1).max(100)\n* });\n*\n* const compatLayers = [\n* new OpenAISchemaCompatLayer(model),\n* new AnthropicSchemaCompatLayer(model)\n* ];\n*\n* const result = applyCompatLayer({\n* schema,\n* compatLayers,\n* mode: 'aiSdkSchema'\n* });\n* ```\n*/\nfunction applyCompatLayer({ schema, compatLayers, mode }) {\n\tif (mode === \"jsonSchema\") {\n\t\tconst standardSchema = toStandardSchema(schema);\n\t\tfor (const compat of compatLayers) if (compat.shouldApply()) return standardSchemaToJSONSchema(compat.processToCompatSchema(standardSchema));\n\t\treturn standardSchemaToJSONSchema(standardSchema);\n\t} else {\n\t\tlet zodSchema;\n\t\tif (isZodType(schema)) zodSchema = schema;\n\t\telse {\n\t\t\tif (isStandardSchemaWithJSON(schema)) throw new Error(\"StandardSchemaWithJSON is not supported for applyCompatLayer and aiSdkSchema mode\");\n\t\t\tzodSchema = convertSchemaToZod(schema);\n\t\t}\n\t\tfor (const compat of compatLayers) if (compat.shouldApply()) return compat.processToAISDKSchema(zodSchema);\n\t\treturn convertZodSchemaToAISDKSchema(zodSchema);\n\t}\n}\n//#endregion\n//#region src/schema-compatibility-v3.ts\n/**\n* All supported string validation check types that can be processed or converted to descriptions.\n* @constant\n*/\nconst ALL_STRING_CHECKS = [\n\t\"regex\",\n\t\"emoji\",\n\t\"email\",\n\t\"url\",\n\t\"uuid\",\n\t\"cuid\",\n\t\"min\",\n\t\"max\"\n];\n/**\n* All supported number validation check types that can be processed or converted to descriptions.\n* @constant\n*/\nconst ALL_NUMBER_CHECKS = [\n\t\"min\",\n\t\"max\",\n\t\"multipleOf\"\n];\n/**\n* All supported array validation check types that can be processed or converted to descriptions.\n* @constant\n*/\nconst ALL_ARRAY_CHECKS = [\n\t\"min\",\n\t\"max\",\n\t\"length\"\n];\nconst isOptional = (v) => v instanceof ZodOptional;\nconst isObj = (v) => v instanceof ZodObject;\nconst isArr = (v) => v instanceof ZodArray;\nconst isUnion = (v) => v instanceof ZodUnion;\nconst isString = (v) => v instanceof ZodString;\nconst isNumber = (v) => v instanceof ZodNumber;\n/**\n* Zod types that are not supported by most AI model providers and should be avoided.\n* @constant\n*/\nconst UNSUPPORTED_ZOD_TYPES = [\n\t\"ZodIntersection\",\n\t\"ZodNever\",\n\t\"ZodNull\",\n\t\"ZodTuple\",\n\t\"ZodUndefined\"\n];\n/**\n* Zod types that are generally supported by AI model providers.\n* @constant\n*/\nconst SUPPORTED_ZOD_TYPES = [\n\t\"ZodObject\",\n\t\"ZodArray\",\n\t\"ZodUnion\",\n\t\"ZodString\",\n\t\"ZodNumber\",\n\t\"ZodDate\",\n\t\"ZodAny\",\n\t\"ZodDefault\",\n\t\"ZodNullable\"\n];\n/**\n* All Zod types (both supported and unsupported).\n* @constant\n*/\nconst ALL_ZOD_TYPES = [...SUPPORTED_ZOD_TYPES, ...UNSUPPORTED_ZOD_TYPES];\n/**\n* Abstract base class for creating schema compatibility layers for different AI model providers.\n*\n* This class provides a framework for transforming Zod schemas to work with specific AI model\n* provider requirements and limitations. Each provider may have different support levels for\n* JSON Schema features, validation constraints, and data types.\n*\n*\n* @example\n* ```typescript\n* import { SchemaCompatLayer } from '@mastra/schema-compat';\n* import type { LanguageModelV1 } from 'ai';\n*\n* class CustomProviderCompat extends SchemaCompatLayer {\n* constructor(model: ModelInformation) {\n* super(model);\n* }\n*\n* shouldApply(): boolean {\n* return this.getModel().provider === 'custom-provider';\n* }\n*\n* getSchemaTarget() {\n* return 'jsonSchema7';\n* }\n*\n* processZodType<T extends z.AnyZodObject>(value: z.ZodTypeAny): ShapeValue<T> {\n* // Custom processing logic for this provider\n* switch (value._def.typeName) {\n* case 'ZodString':\n* return this.defaultZodStringHandler(value, ['email', 'url']);\n* default:\n* return this.defaultUnsupportedZodTypeHandler(value);\n* }\n* }\n* }\n* ```\n*/\nvar SchemaCompatLayer$1 = class {\n\tmodel;\n\tparent;\n\t/**\n\t* Creates a new schema compatibility instance.\n\t*\n\t* @param model - The language model this compatibility layer applies to\n\t*/\n\tconstructor(model, parent) {\n\t\tthis.model = model;\n\t\tthis.parent = parent;\n\t}\n\t/**\n\t* Gets the language model associated with this compatibility layer.\n\t*\n\t* @returns The language model instance\n\t*/\n\tgetModel() {\n\t\treturn this.model;\n\t}\n\tgetUnsupportedZodTypes() {\n\t\treturn UNSUPPORTED_ZOD_TYPES;\n\t}\n\t/**\n\t* Type guard for optional Zod types\n\t*/\n\tisOptional(v) {\n\t\treturn v instanceof ZodOptional;\n\t}\n\t/**\n\t* Type guard for object Zod types\n\t*/\n\tisObj(v) {\n\t\treturn v instanceof ZodObject;\n\t}\n\t/**\n\t* Type guard for null Zod types\n\t*/\n\tisNull(v) {\n\t\treturn v instanceof ZodNull;\n\t}\n\t/**\n\t* Type guard for nullable Zod types\n\t*/\n\tisNullable(v) {\n\t\treturn v instanceof ZodNullable;\n\t}\n\t/**\n\t* Type guard for array Zod types\n\t*/\n\tisArr(v) {\n\t\treturn v instanceof ZodArray;\n\t}\n\t/**\n\t* Type guard for union Zod types\n\t*/\n\tisUnion(v) {\n\t\treturn v instanceof ZodUnion;\n\t}\n\t/**\n\t* Type guard for string Zod types\n\t*/\n\tisString(v) {\n\t\treturn v instanceof ZodString;\n\t}\n\t/**\n\t* Type guard for number Zod types\n\t*/\n\tisNumber(v) {\n\t\treturn v instanceof ZodNumber;\n\t}\n\t/**\n\t* Type guard for date Zod types\n\t*/\n\tisDate(v) {\n\t\treturn v instanceof ZodDate;\n\t}\n\t/**\n\t* Type guard for default Zod types\n\t*/\n\tisDefault(v) {\n\t\treturn v instanceof ZodDefault;\n\t}\n\t/**\n\t* Type guard for intersection Zod types\n\t*/\n\tisIntersection(v) {\n\t\treturn v instanceof ZodIntersection;\n\t}\n\t/**\n\t* Determines whether this compatibility layer should be applied for the current model.\n\t*\n\t* @returns True if this compatibility layer should be used, false otherwise\n\t* @abstract\n\t*/\n\tshouldApply() {\n\t\treturn this.parent.shouldApply();\n\t}\n\t/**\n\t* Returns the JSON Schema target format for this provider.\n\t*\n\t* @returns The schema target format, or undefined to use the default 'jsonSchema7'\n\t* @abstract\n\t*/\n\tgetSchemaTarget() {\n\t\treturn this.parent.getSchemaTarget();\n\t}\n\t/**\n\t* Processes a specific Zod type according to the provider's requirements.\n\t*\n\t* @param value - The Zod type to process\n\t* @returns The processed Zod type\n\t* @abstract\n\t*/\n\tprocessZodType(value) {\n\t\treturn this.parent.processZodType(value);\n\t}\n\t/**\n\t* Default handler for Zod object types. Recursively processes all properties in the object.\n\t*\n\t* @param value - The Zod object to process\n\t* @returns The processed Zod object\n\t*/\n\tdefaultZodObjectHandler(value, options = { passthrough: true }) {\n\t\tconst processedShape = Object.entries(value.shape).reduce((acc, [key, propValue]) => {\n\t\t\tacc[key] = this.processZodType(propValue);\n\t\t\treturn acc;\n\t\t}, {});\n\t\tlet result = z.object(processedShape);\n\t\tif (value._def.unknownKeys === \"strict\") result = result.strict();\n\t\tif (value._def.catchall && !(value._def.catchall instanceof z.ZodNever)) result = result.catchall(value._def.catchall);\n\t\tif (value.description) result = result.describe(value.description);\n\t\tif (options.passthrough && value._def.unknownKeys === \"passthrough\") result = result.passthrough();\n\t\treturn result;\n\t}\n\t/**\n\t* Merges validation constraints into a parameter description.\n\t*\n\t* This helper method converts validation constraints that may not be supported\n\t* by a provider into human-readable descriptions.\n\t*\n\t* @param description - The existing parameter description\n\t* @param constraints - The validation constraints to merge\n\t* @returns The updated description with constraints, or undefined if no constraints\n\t*/\n\tmergeParameterDescription(description, constraints) {\n\t\tif (constraints.length > 0) return (description ? description + \"\\n\" : \"\") + `constraints: ${constraints.join(`, `)}`;\n\t\telse return description;\n\t}\n\t/**\n\t* Default handler for unsupported Zod types. Throws an error for specified unsupported types.\n\t*\n\t* @param value - The Zod type to check\n\t* @param throwOnTypes - Array of type names to throw errors for\n\t* @returns The original value if not in the throw list\n\t* @throws Error if the type is in the unsupported list\n\t*/\n\tdefaultUnsupportedZodTypeHandler(value, throwOnTypes = UNSUPPORTED_ZOD_TYPES) {\n\t\tif (throwOnTypes.includes(value._def?.typeName)) throw new Error(`${this.model.modelId} does not support zod type: ${value._def?.typeName}`);\n\t\treturn value;\n\t}\n\t/**\n\t* Default handler for Zod array types. Processes array constraints according to provider support.\n\t*\n\t* @param value - The Zod array to process\n\t* @param handleChecks - Array constraints to convert to descriptions vs keep as validation\n\t* @returns The processed Zod array\n\t*/\n\tdefaultZodArrayHandler(value, handleChecks = ALL_ARRAY_CHECKS) {\n\t\tconst zodArrayDef = value._def;\n\t\tconst processedType = this.processZodType(zodArrayDef.type);\n\t\tlet result = z.array(processedType);\n\t\tconst constraints = [];\n\t\tif (zodArrayDef.minLength?.value !== void 0) if (handleChecks.includes(\"min\")) constraints.push(`minimum length ${zodArrayDef.minLength.value}`);\n\t\telse result = result.min(zodArrayDef.minLength.value);\n\t\tif (zodArrayDef.maxLength?.value !== void 0) if (handleChecks.includes(\"max\")) constraints.push(`maximum length ${zodArrayDef.maxLength.value}`);\n\t\telse result = result.max(zodArrayDef.maxLength.value);\n\t\tif (zodArrayDef.exactLength?.value !== void 0) if (handleChecks.includes(\"length\")) constraints.push(`exact length ${zodArrayDef.exactLength.value}`);\n\t\telse result = result.length(zodArrayDef.exactLength.value);\n\t\tconst description = this.mergeParameterDescription(value.description, constraints);\n\t\tif (description) result = result.describe(description);\n\t\treturn result;\n\t}\n\t/**\n\t* Default handler for Zod union types. Processes all union options.\n\t*\n\t* @param value - The Zod union to process\n\t* @returns The processed Zod union\n\t* @throws Error if union has fewer than 2 options\n\t*/\n\tdefaultZodUnionHandler(value) {\n\t\tconst processedOptions = value._def.options.map((option) => this.processZodType(option));\n\t\tif (processedOptions.length < 2) throw new Error(\"Union must have at least 2 options\");\n\t\tlet result = z.union(processedOptions);\n\t\tif (value.description) result = result.describe(value.description);\n\t\treturn result;\n\t}\n\t/**\n\t* Default handler for Zod string types. Processes string validation constraints.\n\t*\n\t* @param value - The Zod string to process\n\t* @param handleChecks - String constraints to convert to descriptions vs keep as validation\n\t* @returns The processed Zod string\n\t*/\n\tdefaultZodStringHandler(value, handleChecks = ALL_STRING_CHECKS) {\n\t\tconst constraints = [];\n\t\tconst checks = value._def.checks || [];\n\t\tconst newChecks = [];\n\t\tfor (const check of checks) if (\"kind\" in check) if (handleChecks.includes(check.kind)) switch (check.kind) {\n\t\t\tcase \"regex\":\n\t\t\t\tconstraints.push(`input must match this regex ${check.regex.source}`);\n\t\t\t\tbreak;\n\t\t\tcase \"emoji\":\n\t\t\tcase \"email\":\n\t\t\tcase \"url\":\n\t\t\tcase \"uuid\":\n\t\t\tcase \"cuid\":\n\t\t\t\tconstraints.push(`a valid ${check.kind}`);\n\t\t\t\tbreak;\n\t\t\tcase \"min\":\n\t\t\tcase \"max\":\n\t\t\t\tconstraints.push(`${check.kind}imum length ${check.value}`);\n\t\t\t\tbreak;\n\t\t}\n\t\telse newChecks.push(check);\n\t\tlet result = z.string();\n\t\tfor (const check of newChecks) result = result._addCheck(check);\n\t\tconst description = this.mergeParameterDescription(value.description, constraints);\n\t\tif (description) result = result.describe(description);\n\t\treturn result;\n\t}\n\t/**\n\t* Default handler for Zod number types. Processes number validation constraints.\n\t*\n\t* @param value - The Zod number to process\n\t* @param handleChecks - Number constraints to convert to descriptions vs keep as validation\n\t* @returns The processed Zod number\n\t*/\n\tdefaultZodNumberHandler(value, handleChecks = ALL_NUMBER_CHECKS) {\n\t\tconst constraints = [];\n\t\tconst checks = value._def.checks || [];\n\t\tconst newChecks = [];\n\t\tfor (const check of checks) if (\"kind\" in check) if (handleChecks.includes(check.kind)) switch (check.kind) {\n\t\t\tcase \"min\":\n\t\t\t\tif (check.inclusive) constraints.push(`greater than or equal to ${check.value}`);\n\t\t\t\telse constraints.push(`greater than ${check.value}`);\n\t\t\t\tbreak;\n\t\t\tcase \"max\":\n\t\t\t\tif (check.inclusive) constraints.push(`lower than or equal to ${check.value}`);\n\t\t\t\telse constraints.push(`lower than ${check.value}`);\n\t\t\t\tbreak;\n\t\t\tcase \"multipleOf\":\n\t\t\t\tconstraints.push(`multiple of ${check.value}`);\n\t\t\t\tbreak;\n\t\t}\n\t\telse newChecks.push(check);\n\t\tlet result = z.number();\n\t\tfor (const check of newChecks) switch (check.kind) {\n\t\t\tcase \"int\":\n\t\t\t\tresult = result.int();\n\t\t\t\tbreak;\n\t\t\tcase \"finite\":\n\t\t\t\tresult = result.finite();\n\t\t\t\tbreak;\n\t\t\tdefault: result = result._addCheck(check);\n\t\t}\n\t\tconst description = this.mergeParameterDescription(value.description, constraints);\n\t\tif (description) result = result.describe(description);\n\t\treturn result;\n\t}\n\t/**\n\t* Default handler for Zod date types. Converts dates to ISO strings with constraint descriptions.\n\t*\n\t* @param value - The Zod date to process\n\t* @returns A Zod string schema representing the date in ISO format\n\t*/\n\tdefaultZodDateHandler(value) {\n\t\tconst constraints = [];\n\t\tconst checks = value._def.checks || [];\n\t\tconst newChecks = [];\n\t\tfor (const check of checks) if (\"kind\" in check) switch (check.kind) {\n\t\t\tcase \"min\":\n\t\t\t\tconst minDate = new Date(check.value);\n\t\t\t\tif (!isNaN(minDate.getTime())) constraints.push(`Date must be newer than ${minDate.toISOString()} (ISO)`);\n\t\t\t\tbreak;\n\t\t\tcase \"max\":\n\t\t\t\tconst maxDate = new Date(check.value);\n\t\t\t\tif (!isNaN(maxDate.getTime())) constraints.push(`Date must be older than ${maxDate.toISOString()} (ISO)`);\n\t\t\t\tbreak;\n\t\t\tdefault: newChecks.push(check);\n\t\t}\n\t\tconstraints.push(`Date format is date-time`);\n\t\tlet result = z.string().describe(\"date-time\");\n\t\tconst description = this.mergeParameterDescription(value.description, constraints);\n\t\tif (description) result = result.describe(description);\n\t\treturn result;\n\t}\n\t/**\n\t* Default handler for Zod optional types. Processes the inner type and maintains optionality.\n\t*\n\t* @param value - The Zod optional to process\n\t* @param handleTypes - Types that should be processed vs passed through\n\t* @returns The processed Zod optional\n\t*/\n\tdefaultZodOptionalHandler(value, handleTypes = SUPPORTED_ZOD_TYPES) {\n\t\tif (handleTypes.includes(value._def.innerType._def.typeName)) return this.processZodType(value._def.innerType).optional();\n\t\telse return value;\n\t}\n\t/**\n\t* Default handler for Zod nullable types. Processes the inner type and maintains nullability.\n\t*\n\t* @param value - The Zod nullable to process\n\t* @param handleTypes - Types that should be processed vs passed through\n\t* @returns The processed Zod nullable\n\t*/\n\tdefaultZodNullableHandler(value, handleTypes = SUPPORTED_ZOD_TYPES) {\n\t\tif (handleTypes.includes(value._def.innerType._def.typeName)) return this.processZodType(value._def.innerType).nullable();\n\t\telse return value;\n\t}\n\t/**\n\t* Recursively collects leaf types from a ZodIntersection tree.\n\t*/\n\tcollectIntersectionLeaves(value) {\n\t\tif (value instanceof ZodIntersection) return [...this.collectIntersectionLeaves(value._def.left), ...this.collectIntersectionLeaves(value._def.right)];\n\t\treturn [value];\n\t}\n\t/**\n\t* Default handler for Zod intersection types.\n\t* Flattens the intersection tree and merges object shapes into a single z.object().\n\t* Falls back to z.any() for non-object intersections.\n\t*/\n\tdefaultZodIntersectionHandler(value) {\n\t\tconst processed = this.collectIntersectionLeaves(value).map((leaf) => this.processZodType(leaf));\n\t\tif (processed.every((p) => p instanceof ZodObject)) {\n\t\t\tconst mergedShape = {};\n\t\t\tfor (const obj of processed) Object.assign(mergedShape, obj.shape);\n\t\t\tlet result = z.object(mergedShape);\n\t\t\tif (value.description) result = result.describe(value.description);\n\t\t\treturn result;\n\t\t}\n\t\treturn z.any().describe(value.description || \"intersection type\");\n\t}\n\t/**\n\t* Processes a Zod object schema and converts it to an AI SDK Schema.\n\t*\n\t* @param zodSchema - The Zod object schema to process\n\t* @returns An AI SDK Schema with provider-specific compatibility applied\n\t*/\n\tprocessToAISDKSchema(zodSchema) {\n\t\treturn convertZodSchemaToAISDKSchema(this.processZodType(zodSchema), this.getSchemaTarget());\n\t}\n\t/**\n\t* Processes a Zod object schema and converts it to a JSON Schema.\n\t*\n\t* @param zodSchema - The Zod object schema to process\n\t* @returns A JSONSchema7 object with provider-specific compatibility applied\n\t*/\n\tprocessToJSONSchema(zodSchema) {\n\t\treturn this.processToAISDKSchema(zodSchema).jsonSchema;\n\t}\n};\n//#endregion\n//#region src/schema-compatibility-v4.ts\n/**\n* All supported string validation check types that can be processed or converted to descriptions.\n* @constant\n*/\nconst ALL_STRING_CHECKS$1 = [\n\t\"regex\",\n\t\"emoji\",\n\t\"email\",\n\t\"url\",\n\t\"uuid\",\n\t\"cuid\",\n\t\"min_length\",\n\t\"max_length\",\n\t\"string_format\"\n];\n/**\n* All supported number validation check types that can be processed or converted to descriptions.\n* @constant\n*/\nconst ALL_NUMBER_CHECKS$1 = [\n\t\"greater_than\",\n\t\"less_than\",\n\t\"multiple_of\"\n];\n/**\n* All supported array validation check types that can be processed or converted to descriptions.\n* @constant\n*/\nconst ALL_ARRAY_CHECKS$1 = [\n\t\"min\",\n\t\"max\",\n\t\"length\"\n];\n/**\n* Zod types that are not supported by most AI model providers and should be avoided.\n* @constant\n*/\nconst UNSUPPORTED_ZOD_TYPES$2 = [\n\t\"ZodIntersection\",\n\t\"ZodNever\",\n\t\"ZodNull\",\n\t\"ZodTuple\",\n\t\"ZodUndefined\"\n];\n/**\n* Zod types that are generally supported by AI model providers.\n* @constant\n*/\nconst SUPPORTED_ZOD_TYPES$2 = [\n\t\"ZodObject\",\n\t\"ZodArray\",\n\t\"ZodUnion\",\n\t\"ZodString\",\n\t\"ZodNumber\",\n\t\"ZodDate\",\n\t\"ZodAny\",\n\t\"ZodDefault\",\n\t\"ZodNullable\"\n];\n[...SUPPORTED_ZOD_TYPES$2, ...UNSUPPORTED_ZOD_TYPES$2];\n/**\n* Returns the v3-style type name (e.g. \"ZodString\") for a Zod v4 schema. Zod v4\n* stores the kind as a lowercase `type` (e.g. \"string\"), so this normalizes it\n* for comparison against the `*_ZOD_TYPES` lists, mirroring the dispatcher in\n* `schema-compatibility.ts`.\n*/\nfunction zodV4TypeName(value) {\n\tconst v4Type = value?._zod?.def?.type;\n\treturn v4Type ? \"Zod\" + v4Type.charAt(0).toUpperCase() + v4Type.slice(1) : \"\";\n}\n/**\n* Abstract base class for creating schema compatibility layers for different AI model providers.\n*\n* This class provides a framework for transforming Zod schemas to work with specific AI model\n* provider requirements and limitations. Each provider may have different support levels for\n* JSON Schema features, validation constraints, and data types.\n*\n*\n* @example\n* ```typescript\n* import { SchemaCompatLayer } from '@mastra/schema-compat';\n* import type { LanguageModelV1 } from 'ai';\n*\n* class CustomProviderCompat extends SchemaCompatLayer {\n* constructor(model: LanguageModelV1) {\n* super(model);\n* }\n*\n* shouldApply(): boolean {\n* return this.getModel().provider === 'custom-provider';\n* }\n*\n* getSchemaTarget() {\n* return 'jsonSchema7';\n* }\n*\n* processZodType<T extends z.AnyZodObject>(value: z.ZodAny): ShapeValue<T> {\n* // Custom processing logic for this provider\n* switch (value._def.typeName) {\n* case 'ZodString':\n* return this.defaultZodStringHandler(value, ['email', 'url']);\n* default:\n* return this.defaultUnsupportedZodTypeHandler(value);\n* }\n* }\n* }\n* ```\n*/\nvar SchemaCompatLayer$2 = class {\n\tmodel;\n\tparent;\n\t/**\n\t* Creates a new schema compatibility instance.\n\t*\n\t* @param model - The language model this compatibility layer applies to\n\t*/\n\tconstructor(model, parent) {\n\t\tthis.model = model;\n\t\tthis.parent = parent;\n\t}\n\t/**\n\t* Gets the language model associated with this compatibility layer.\n\t*\n\t* @returns The language model instance\n\t*/\n\tgetModel() {\n\t\treturn this.model;\n\t}\n\tgetUnsupportedZodTypes() {\n\t\treturn UNSUPPORTED_ZOD_TYPES$2;\n\t}\n\t/**\n\t* Type guard for optional Zod types\n\t*/\n\tisOptional(v) {\n\t\treturn v instanceof ZodOptional$1;\n\t}\n\t/**\n\t* Type guard for object Zod types\n\t*/\n\tisObj(v) {\n\t\treturn v instanceof ZodObject$1;\n\t}\n\t/**\n\t* Type guard for null Zod types\n\t*/\n\tisNull(v) {\n\t\treturn v instanceof ZodNull$1;\n\t}\n\t/**\n\t* Type guard for nullable Zod types\n\t*/\n\tisNullable(v) {\n\t\treturn v instanceof ZodNullable$1;\n\t}\n\t/**\n\t* Type guard for array Zod types\n\t*/\n\tisArr(v) {\n\t\treturn v instanceof ZodArray$1;\n\t}\n\t/**\n\t* Type guard for union Zod types\n\t*/\n\tisUnion(v) {\n\t\treturn v instanceof ZodUnion$1;\n\t}\n\t/**\n\t* Type guard for string Zod types\n\t*/\n\tisString(v) {\n\t\treturn v instanceof ZodString$1;\n\t}\n\t/**\n\t* Type guard for number Zod types\n\t*/\n\tisNumber(v) {\n\t\treturn v instanceof ZodNumber$1;\n\t}\n\t/**\n\t* Type guard for date Zod types\n\t*/\n\tisDate(v) {\n\t\treturn v instanceof ZodDate$1;\n\t}\n\t/**\n\t* Type guard for default Zod types\n\t*/\n\tisDefault(v) {\n\t\treturn v instanceof ZodDefault$1;\n\t}\n\t/**\n\t* Type guard for intersection Zod types\n\t*/\n\tisIntersection(v) {\n\t\treturn v instanceof ZodIntersection$1;\n\t}\n\t/**\n\t* Determines whether this compatibility layer should be applied for the current model.\n\t*\n\t* @returns True if this compatibility layer should be used, false otherwise\n\t* @abstract\n\t*/\n\tshouldApply() {\n\t\treturn this.parent.shouldApply();\n\t}\n\t/**\n\t* Returns the JSON Schema target format for this provider.\n\t*\n\t* @returns The schema target format, or undefined to use the default 'jsonSchema7'\n\t* @abstract\n\t*/\n\tgetSchemaTarget() {\n\t\treturn this.parent.getSchemaTarget();\n\t}\n\t/**\n\t* Processes a specific Zod type according to the provider's requirements.\n\t*\n\t* @param value - The Zod type to process\n\t* @returns The processed Zod type\n\t* @abstract\n\t*/\n\tprocessZodType(value) {\n\t\treturn this.parent.processZodType(value);\n\t}\n\t/**\n\t* Default handler for Zod object types. Recursively processes all properties in the object.\n\t*\n\t* @param value - The Zod object to process\n\t* @returns The processed Zod object\n\t*/\n\tdefaultZodObjectHandler(value, options = { passthrough: true }) {\n\t\tconst processedShape = Object.entries(value.shape).reduce((acc, [key, propValue]) => {\n\t\t\tacc[key] = this.processZodType(propValue);\n\t\t\treturn acc;\n\t\t}, {});\n\t\tlet result = z$2.object(processedShape);\n\t\tif (value._zod.def.catchall instanceof z$2.ZodNever) result = z$2.strictObject(processedShape);\n\t\telse if (value._zod.def.catchall instanceof z$2.ZodUnknown) {\n\t\t\tif (options.passthrough) result = z$2.looseObject(processedShape);\n\t\t} else if (value._zod.def.catchall) result = result.catchall(value._zod.def.catchall);\n\t\tif (value.description) result = result.describe(value.description);\n\t\treturn result;\n\t}\n\t/**\n\t* Merges validation constraints into a parameter description.\n\t*\n\t* This helper method converts validation constraints that may not be supported\n\t* by a provider into human-readable descriptions.\n\t*\n\t* @param description - The existing parameter description\n\t* @param constraints - The validation constraints to merge\n\t* @returns The updated description with constraints, or undefined if no constraints\n\t*/\n\tmergeParameterDescription(description, constraints) {\n\t\tif (constraints.length > 0) return (description ? description + \"\\n\" : \"\") + `constraints: ${constraints.join(`, `)}`;\n\t\telse return description;\n\t}\n\t/**\n\t* Default handler for unsupported Zod types. Throws an error for specified unsupported types.\n\t*\n\t* @param value - The Zod type to check\n\t* @param throwOnTypes - Array of type names to throw errors for\n\t* @returns The original value if not in the throw list\n\t* @throws Error if the type is in the unsupported list\n\t*/\n\tdefaultUnsupportedZodTypeHandler(value, throwOnTypes = UNSUPPORTED_ZOD_TYPES$2) {\n\t\tif (throwOnTypes.includes(value.constructor.name)) throw new Error(`${this.model.modelId} does not support zod type: ${value.constructor.name}`);\n\t\treturn value;\n\t}\n\t/**\n\t* Default handler for Zod array types. Processes array constraints according to provider support.\n\t*\n\t* @param value - The Zod array to process\n\t* @param handleChecks - Array constraints to convert to descriptions vs keep as validation\n\t* @returns The processed Zod array\n\t*/\n\tdefaultZodArrayHandler(value, handleChecks = ALL_ARRAY_CHECKS$1) {\n\t\tconst zodArrayDef = value._zod.def;\n\t\tconst processedType = this.processZodType(zodArrayDef.element);\n\t\tlet result = z$2.array(processedType);\n\t\tconst constraints = [];\n\t\tif (zodArrayDef.checks) for (const check of zodArrayDef.checks) {\n\t\t\tif (check._zod.def.check === \"min_length\") if (handleChecks.includes(\"min\")) constraints.push(`minimum length ${check._zod.def.minimum}`);\n\t\t\telse result = result.min(check._zod.def.minimum);\n\t\t\tif (check._zod.def.check === \"max_length\") if (handleChecks.includes(\"max\")) constraints.push(`maximum length ${check._zod.def.maximum}`);\n\t\t\telse result = result.max(check._zod.def.maximum);\n\t\t\tif (check._zod.def.check === \"length_equals\") if (handleChecks.includes(\"length\")) constraints.push(`exact length ${check._zod.def.length}`);\n\t\t\telse result = result.length(check._zod.def.length);\n\t\t}\n\t\tconst metaDescription = value.meta()?.description;\n\t\tconst legacyDescription = value.description;\n\t\tconst description = this.mergeParameterDescription(metaDescription || legacyDescription, constraints);\n\t\tif (description) result = result.describe(description);\n\t\treturn result;\n\t}\n\t/**\n\t* Default handler for Zod union types. Processes all union options.\n\t*\n\t* @param value - The Zod union to process\n\t* @returns The processed Zod union\n\t* @throws Error if union has fewer than 2 options\n\t*/\n\tdefaultZodUnionHandler(value) {\n\t\tconst processedOptions = value._zod.def.options.map((option) => this.processZodType(option));\n\t\tif (processedOptions.length < 2) throw new Error(\"Union must have at least 2 options\");\n\t\tlet result = z$2.union(processedOptions);\n\t\tif (value.description) result = result.describe(value.description);\n\t\treturn result;\n\t}\n\t/**\n\t* Default handler for Zod string types. Processes string validation constraints.\n\t*\n\t* @param value - The Zod string to process\n\t* @param handleChecks - String constraints to convert to descriptions vs keep as validation\n\t* @returns The processed Zod string\n\t*/\n\tdefaultZodStringHandler(value, handleChecks = ALL_STRING_CHECKS$1) {\n\t\tconst constraints = [];\n\t\tconst checks = value._zod.def.checks || [];\n\t\tconst newChecks = [];\n\t\tif (checks) for (const check of checks) if (handleChecks.includes(check._zod.def.check)) switch (check._zod.def.check) {\n\t\t\tcase \"min_length\":\n\t\t\t\tconstraints.push(`minimum length ${check._zod.def.minimum}`);\n\t\t\t\tbreak;\n\t\t\tcase \"max_length\":\n\t\t\t\tconstraints.push(`maximum length ${check._zod.def.maximum}`);\n\t\t\t\tbreak;\n\t\t\tcase \"string_format\":\n\t\t\t\tswitch (check._zod.def.format) {\n\t\t\t\t\tcase \"email\":\n\t\t\t\t\tcase \"url\":\n\t\t\t\t\tcase \"emoji\":\n\t\t\t\t\tcase \"uuid\":\n\t\t\t\t\tcase \"cuid\":\n\t\t\t\t\t\tconstraints.push(`a valid ${check._zod.def.format}`);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"regex\":\n\t\t\t\t\t\tconstraints.push(`input must match this regex ${check._zod.def.pattern}`);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tnewChecks.push(check);\n\t\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t}\n\t\telse newChecks.push(check);\n\t\tlet result = z$2.string();\n\t\tfor (const check of newChecks) result = result.check(check);\n\t\tconst metaDescription = value.meta()?.description;\n\t\tconst legacyDescription = value.description;\n\t\tconst description = this.mergeParameterDescription(metaDescription || legacyDescription, constraints);\n\t\tif (description) result = result.describe(description);\n\t\treturn result;\n\t}\n\t/**\n\t* Default handler for Zod number types. Processes number validation constraints.\n\t*\n\t* @param value - The Zod number to process\n\t* @param handleChecks - Number constraints to convert to descriptions vs keep as validation\n\t* @returns The processed Zod number\n\t*/\n\tdefaultZodNumberHandler(value, handleChecks = ALL_NUMBER_CHECKS$1) {\n\t\tconst constraints = [];\n\t\tconst checks = value._zod.def.checks || [];\n\t\tconst newChecks = [];\n\t\tif (checks) for (const check of checks) if (handleChecks.includes(check._zod.def.check)) switch (check._zod.def.check) {\n\t\t\tcase \"greater_than\":\n\t\t\t\tif (check._zod.def.inclusive) constraints.push(`greater than or equal to ${check._zod.def.value}`);\n\t\t\t\telse constraints.push(`greater than ${check._zod.def.value}`);\n\t\t\t\tbreak;\n\t\t\tcase \"less_than\":\n\t\t\t\tif (check._zod.def.inclusive) constraints.push(`lower than or equal to ${check._zod.def.value}`);\n\t\t\t\telse constraints.push(`lower than ${check._zod.def.value}`);\n\t\t\t\tbreak;\n\t\t\tcase \"multiple_of\":\n\t\t\t\tconstraints.push(`multiple of ${check._zod.def.value}`);\n\t\t\t\tbreak;\n\t\t}\n\t\telse newChecks.push(check);\n\t\tlet result = z$2.number();\n\t\tfor (const check of newChecks) switch (check._zod.def.check) {\n\t\t\tcase \"number_format\":\n\t\t\t\tswitch (check._zod.def.format) {\n\t\t\t\t\tcase \"safeint\":\n\t\t\t\t\t\tresult = result.int();\n\t\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tdefault: result = result.check(check);\n\t\t}\n\t\tconst description = this.mergeParameterDescription(value.description, constraints);\n\t\tif (description) result = result.describe(description);\n\t\treturn result;\n\t}\n\t/**\n\t* Default handler for Zod date types. Converts dates to ISO strings with constraint descriptions.\n\t*\n\t* @param value - The Zod date to process\n\t* @returns A Zod string schema representing the date in ISO format\n\t*/\n\tdefaultZodDateHandler(value) {\n\t\tconst constraints = [];\n\t\tconst checks = value._zod.def.checks || [];\n\t\tconst newChecks = [];\n\t\tif (checks) for (const check of checks) switch (check._zod.def.check) {\n\t\t\tcase \"less_than\":\n\t\t\t\tconst maxDate = new Date(check._zod.def.value);\n\t\t\t\tif (!isNaN(maxDate.getTime())) constraints.push(`Date must be older than ${maxDate.toISOString()} (ISO)`);\n\t\t\t\tbreak;\n\t\t\tcase \"greater_than\":\n\t\t\t\tconst minDate = new Date(check._zod.def.value);\n\t\t\t\tif (!isNaN(minDate.getTime())) constraints.push(`Date must be newer than ${minDate.toISOString()} (ISO)`);\n\t\t\t\tbreak;\n\t\t\tdefault: newChecks.push(check);\n\t\t}\n\t\tconstraints.push(`Date format is date-time`);\n\t\tlet result = z$2.string().describe(\"date-time\");\n\t\tconst description = this.mergeParameterDescription(value.description, constraints);\n\t\tif (description) result = result.describe(description);\n\t\treturn result;\n\t}\n\t/**\n\t* Default handler for Zod optional types. Processes the inner type and maintains optionality.\n\t*\n\t* @param value - The Zod optional to process\n\t* @param handleTypes - Types that should be processed vs passed through\n\t* @returns The processed Zod optional\n\t*/\n\tdefaultZodOptionalHandler(value, handleTypes = SUPPORTED_ZOD_TYPES$2) {\n\t\tconst innerType = value._zod?.def?.innerType;\n\t\tif (innerType && handleTypes.includes(zodV4TypeName(innerType))) return this.processZodType(innerType).optional();\n\t\telse return value;\n\t}\n\t/**\n\t* Default handler for Zod nullable types. Processes the inner type and maintains nullability.\n\t*\n\t* @param value - The Zod nullable to process\n\t* @param handleTypes - Types that should be processed vs passed through\n\t* @returns The processed Zod nullable\n\t*/\n\tdefaultZodNullableHandler(value, handleTypes = SUPPORTED_ZOD_TYPES$2) {\n\t\tconst innerType = value._zod?.def?.innerType;\n\t\tif (innerType && handleTypes.includes(zodV4TypeName(innerType))) return this.processZodType(innerType).nullable();\n\t\telse return value;\n\t}\n\t/**\n\t* Recursively collects leaf types from a ZodIntersection tree.\n\t*/\n\tcollectIntersectionLeaves(value) {\n\t\tif (value instanceof ZodIntersection$1) return [...this.collectIntersectionLeaves(value._zod.def.left), ...this.collectIntersectionLeaves(value._zod.def.right)];\n\t\treturn [value];\n\t}\n\t/**\n\t* Default handler for Zod intersection types.\n\t* Flattens the intersection tree and merges object shapes into a single z.object().\n\t* Falls back to z.any() for non-object intersections.\n\t*/\n\tdefaultZodIntersectionHandler(value) {\n\t\tconst processed = this.collectIntersectionLeaves(value).map((leaf) => this.processZodType(leaf));\n\t\tif (processed.every((p) => p instanceof ZodObject$1)) {\n\t\t\tconst mergedShape = {};\n\t\t\tfor (const obj of processed) for (const [key, field] of Object.entries(obj.shape)) {\n\t\t\t\tif (key in mergedShape) throw new Error(\"Cannot flatten intersections with overlapping keys\");\n\t\t\t\tmergedShape[key] = field;\n\t\t\t}\n\t\t\tlet result = z$2.object(mergedShape);\n\t\t\tif (value.description) result = result.describe(value.description);\n\t\t\treturn result;\n\t\t}\n\t\treturn z$2.any().describe(value.description || \"intersection type\");\n\t}\n\t/**\n\t* Processes a Zod object schema and converts it to an AI SDK Schema.\n\t*\n\t* @param zodSchema - The Zod object schema to process\n\t* @returns An AI SDK Schema with provider-specific compatibility applied\n\t*/\n\tprocessToAISDKSchema(zodSchema) {\n\t\treturn convertZodSchemaToAISDKSchema(this.processZodType(zodSchema), this.getSchemaTarget());\n\t}\n\t/**\n\t* Processes a Zod object schema and converts it to a JSON Schema.\n\t*\n\t* @param zodSchema - The Zod object schema to process\n\t* @returns A JSONSchema7 object with provider-specific compatibility applied\n\t*/\n\tprocessToJSONSchema(zodSchema) {\n\t\treturn this.processToAISDKSchema(zodSchema).jsonSchema;\n\t}\n};\n//#endregion\n//#region src/json-schema/utils.ts\nvar import_json_schema_traverse = /* @__PURE__ */ __toESM$1(require_json_schema_traverse(), 1);\n/**\n* Type guard to check if a JSON Schema has a specific type\n*/\nfunction hasType(schema, type) {\n\tif (schema.type === type) return true;\n\tif (Array.isArray(schema.type) && schema.type.includes(type)) return true;\n\treturn false;\n}\n/**\n* Check if a JSON Schema represents an object type\n*/\nfunction isObjectSchema(schema) {\n\treturn hasType(schema, \"object\") || schema.properties !== void 0;\n}\n/**\n* Check if a JSON Schema represents an array type\n*/\nfunction isArraySchema(schema) {\n\treturn hasType(schema, \"array\") || schema.items !== void 0;\n}\n/**\n* Check if a JSON Schema represents a string type\n*/\nfunction isStringSchema(schema) {\n\treturn hasType(schema, \"string\");\n}\n/**\n* Check if a JSON Schema represents a number type (number or integer)\n*/\nfunction isNumberSchema(schema) {\n\treturn hasType(schema, \"number\") || hasType(schema, \"integer\");\n}\n/**\n* Check if a JSON Schema uses anyOf\n*/\nfunction isAnyOfSchema(schema) {\n\treturn Array.isArray(schema.anyOf) && schema.anyOf.length > 0;\n}\n/**\n* Check if a JSON Schema uses oneOf\n*/\nfunction isOneOfSchema(schema) {\n\treturn Array.isArray(schema.oneOf) && schema.oneOf.length > 0;\n}\n/**\n* Check if a JSON Schema is a union type (anyOf or oneOf)\n*/\nfunction isUnionSchema(schema) {\n\treturn isAnyOfSchema(schema) || isOneOfSchema(schema) || Array.isArray(schema.type);\n}\n/**\n* Check if a JSON Schema uses allOf (intersection)\n*/\nfunction isAllOfSchema(schema) {\n\treturn Array.isArray(schema.allOf) && schema.allOf.length > 0;\n}\n/**\n* Check if a property is optional within a parent object schema.\n* A property is optional if it's not in the parent's `required` array.\n* @param propertyName - The name of the property to check\n* @param parentSchema - The parent object schema containing the property\n*/\nfunction isOptionalSchema(propertyName, parentSchema) {\n\tif (!parentSchema.required || !Array.isArray(parentSchema.required)) return true;\n\treturn !parentSchema.required.includes(propertyName);\n}\n//#endregion\n//#region src/schema-compatibility.ts\nvar SchemaCompatLayer = class {\n\tmodel;\n\tv3Layer;\n\tv4Layer;\n\t/**\n\t* Creates a new schema compatibility instance.\n\t*\n\t* @param model - The language model this compatibility layer applies to\n\t*/\n\tconstructor(model) {\n\t\tthis.model = model;\n\t\tthis.v3Layer = new SchemaCompatLayer$1(model, this);\n\t\tthis.v4Layer = new SchemaCompatLayer$2(model, this);\n\t}\n\tpreProcessJSONNode(_schema, _parentSchema) {}\n\tpostProcessJSONNode(_schema, _parentSchema) {}\n\t/**\n\t* Gets the language model associated with this compatibility layer.\n\t*\n\t* @returns The language model instance\n\t*/\n\tgetModel() {\n\t\treturn this.model;\n\t}\n\tgetUnsupportedZodTypes(value) {\n\t\tif (\"_zod\" in value) return this.v4Layer.getUnsupportedZodTypes();\n\t\telse return this.v3Layer.getUnsupportedZodTypes();\n\t}\n\tisOptional(v) {\n\t\tif (\"_zod\" in v) return this.v4Layer.isOptional(v);\n\t\telse return this.v3Layer.isOptional(v);\n\t}\n\tisObj(v) {\n\t\tif (\"_zod\" in v) return this.v4Layer.isObj(v);\n\t\telse return this.v3Layer.isObj(v);\n\t}\n\tisNull(v) {\n\t\tif (\"_zod\" in v) return this.v4Layer.isNull(v);\n\t\telse return this.v3Layer.isNull(v);\n\t}\n\tisNullable(v) {\n\t\tif (\"_zod\" in v) return this.v4Layer.isNullable(v);\n\t\telse return this.v3Layer.isNullable(v);\n\t}\n\tisArr(v) {\n\t\tif (\"_zod\" in v) return this.v4Layer.isArr(v);\n\t\telse return this.v3Layer.isArr(v);\n\t}\n\tisUnion(v) {\n\t\tif (\"_zod\" in v) return this.v4Layer.isUnion(v);\n\t\telse return this.v3Layer.isUnion(v);\n\t}\n\tisString(v) {\n\t\tif (\"_zod\" in v) return this.v4Layer.isString(v);\n\t\telse return this.v3Layer.isString(v);\n\t}\n\tisNumber(v) {\n\t\tif (\"_zod\" in v) return this.v4Layer.isNumber(v);\n\t\telse return this.v3Layer.isNumber(v);\n\t}\n\tisDate(v) {\n\t\tif (\"_zod\" in v) return this.v4Layer.isDate(v);\n\t\telse return this.v3Layer.isDate(v);\n\t}\n\tisDefault(v) {\n\t\tif (\"_zod\" in v) return this.v4Layer.isDefault(v);\n\t\telse return this.v3Layer.isDefault(v);\n\t}\n\tisIntersection(v) {\n\t\tif (\"_zod\" in v) return this.v4Layer.isIntersection(v);\n\t\telse return this.v3Layer.isIntersection(v);\n\t}\n\tdefaultZodObjectHandler(value, options = { passthrough: true }) {\n\t\tif (\"_zod\" in value) return this.v4Layer.defaultZodObjectHandler(value, options);\n\t\telse return this.v3Layer.defaultZodObjectHandler(value, options);\n\t}\n\tmergeParameterDescription(description, constraints) {\n\t\treturn this.v3Layer.mergeParameterDescription(description, constraints);\n\t}\n\tdefaultUnsupportedZodTypeHandler(value, throwOnTypes) {\n\t\tif (\"_zod\" in value) return this.v4Layer.defaultUnsupportedZodTypeHandler(value, throwOnTypes ?? UNSUPPORTED_ZOD_TYPES$2);\n\t\telse return this.v3Layer.defaultUnsupportedZodTypeHandler(value, throwOnTypes ?? UNSUPPORTED_ZOD_TYPES);\n\t}\n\tdefaultZodArrayHandler(value, handleChecks = ALL_ARRAY_CHECKS) {\n\t\tif (\"_zod\" in value) return this.v4Layer.defaultZodArrayHandler(value, handleChecks);\n\t\telse return this.v3Layer.defaultZodArrayHandler(value, handleChecks);\n\t}\n\tdefaultZodUnionHandler(value) {\n\t\tif (\"_zod\" in value) return this.v4Layer.defaultZodUnionHandler(value);\n\t\telse return this.v3Layer.defaultZodUnionHandler(value);\n\t}\n\tdefaultZodStringHandler(value, handleChecks = ALL_STRING_CHECKS) {\n\t\tif (\"_zod\" in value) return this.v4Layer.defaultZodStringHandler(value);\n\t\telse return this.v3Layer.defaultZodStringHandler(value, handleChecks);\n\t}\n\tdefaultZodNumberHandler(value, handleChecks = ALL_NUMBER_CHECKS) {\n\t\tif (\"_zod\" in value) return this.v4Layer.defaultZodNumberHandler(value);\n\t\telse return this.v3Layer.defaultZodNumberHandler(value, handleChecks);\n\t}\n\tdefaultZodDateHandler(value) {\n\t\tif (\"_zod\" in value) return this.v4Layer.defaultZodDateHandler(value);\n\t\telse return this.v3Layer.defaultZodDateHandler(value);\n\t}\n\tdefaultZodOptionalHandler(value, handleTypes) {\n\t\tif (!handleTypes) handleTypes = [\n\t\t\t\"ZodObject\",\n\t\t\t\"ZodArray\",\n\t\t\t\"ZodUnion\",\n\t\t\t\"ZodString\",\n\t\t\t\"ZodNumber\"\n\t\t];\n\t\tlet innerTypeName;\n\t\tif (\"_zod\" in value) {\n\t\t\tconst v4Type = (value._zod?.def?.innerType)?._zod?.def?.type;\n\t\t\tif (!v4Type) return value;\n\t\t\tinnerTypeName = \"Zod\" + v4Type.charAt(0).toUpperCase() + v4Type.slice(1);\n\t\t} else innerTypeName = value._def.innerType._def.typeName;\n\t\tif (handleTypes.includes(innerTypeName)) if (\"_zod\" in value) {\n\t\t\tconst innerType = value._zod?.def?.innerType;\n\t\t\tif (!innerType) return value;\n\t\t\treturn this.processZodType(innerType).optional();\n\t\t} else return this.processZodType(value._def.innerType).optional();\n\t\telse return value;\n\t}\n\tdefaultZodNullableHandler(value, handleTypes) {\n\t\tif (\"_zod\" in value) return this.v4Layer.defaultZodNullableHandler(value, handleTypes ?? SUPPORTED_ZOD_TYPES$2);\n\t\telse return this.v3Layer.defaultZodNullableHandler(value, handleTypes ?? SUPPORTED_ZOD_TYPES);\n\t}\n\tdefaultZodIntersectionHandler(value) {\n\t\tif (\"_zod\" in value) return this.v4Layer.defaultZodIntersectionHandler(value);\n\t\telse return this.v3Layer.defaultZodIntersectionHandler(value);\n\t}\n\t/**\n\t* @deprecated please use processToCompatSchema to usse StandardSchemaWithJSON\n\t* @param zodSchema\n\t* @returns\n\t*/\n\tprocessToAISDKSchema(zodSchema) {\n\t\treturn convertZodSchemaToAISDKSchema(this.processZodType(zodSchema), this.getSchemaTarget());\n\t}\n\t/**\n\t* @param schema\n\t* @returns\n\t*/\n\tprocessToJSONSchema(schema, io = \"input\") {\n\t\tconst jsonSchema = standardSchemaToJSONSchema(toStandardSchema(schema), {\n\t\t\ttarget: \"draft-07\",\n\t\t\tio\n\t\t});\n\t\t(0, import_json_schema_traverse.default)(jsonSchema, { cb: {\n\t\t\tpre: (schema) => {\n\t\t\t\tthis.preProcessJSONNode(schema);\n\t\t\t},\n\t\t\tpost: (schema) => {\n\t\t\t\tthis.postProcessJSONNode(schema);\n\t\t\t}\n\t\t} });\n\t\treturn jsonSchema;\n\t}\n\tprocessToCompatSchema(schema) {\n\t\treturn { \"~standard\": {\n\t\t\tversion: 1,\n\t\t\tvendor: \"mastra\",\n\t\t\tvalidate: (value) => toStandardSchema(schema)[\"~standard\"].validate(value),\n\t\t\tjsonSchema: {\n\t\t\t\tinput: () => {\n\t\t\t\t\treturn this.processToJSONSchema(schema, \"input\");\n\t\t\t\t},\n\t\t\t\toutput: () => {\n\t\t\t\t\treturn this.processToJSONSchema(schema, \"output\");\n\t\t\t\t}\n\t\t\t}\n\t\t} };\n\t}\n\t/**\n\t* Default handler for JSON Schema objects.\n\t* Processes object schemas with properties and required fields.\n\t*/\n\tdefaultObjectHandler(schema) {\n\t\tif (schema.properties && schema.additionalProperties === void 0) schema.additionalProperties = false;\n\t\tif (!Object.keys(schema.properties ?? {}).length) schema.required = [];\n\t\treturn schema;\n\t}\n\t/**\n\t* Default handler for JSON Schema arrays.\n\t* Converts array constraints (minItems, maxItems) to description text.\n\t*/\n\tdefaultArrayHandler(schema) {\n\t\tlet constraints = [];\n\t\tconst minItems = schema.minItems;\n\t\tconst maxItems = schema.maxItems;\n\t\tif (minItems !== void 0 && maxItems !== void 0 && minItems === maxItems) {\n\t\t\tconstraints = [`exact length ${minItems}`];\n\t\t\tdelete schema.minItems;\n\t\t\tdelete schema.maxItems;\n\t\t} else {\n\t\t\tif (minItems !== void 0) {\n\t\t\t\tconstraints.push(`minimum length ${minItems}`);\n\t\t\t\tdelete schema.minItems;\n\t\t\t}\n\t\t\tif (maxItems !== void 0) {\n\t\t\t\tconstraints.push(`maximum length ${maxItems}`);\n\t\t\t\tdelete schema.maxItems;\n\t\t\t}\n\t\t}\n\t\tif (constraints.length) schema.description = this.mergeParameterDescription(schema.description, constraints);\n\t\treturn schema;\n\t}\n\t/**\n\t* Default handler for JSON Schema strings.\n\t* Converts string constraints (minLength, maxLength, pattern, format) to description text.\n\t*/\n\tdefaultStringHandler(schema) {\n\t\tconst constraints = [];\n\t\tif (schema.minLength !== void 0) {\n\t\t\tconstraints.push(`minimum length ${schema.minLength}`);\n\t\t\tdelete schema.minLength;\n\t\t}\n\t\tif (schema.maxLength !== void 0) {\n\t\t\tconstraints.push(`maximum length ${schema.maxLength}`);\n\t\t\tdelete schema.maxLength;\n\t\t}\n\t\tswitch (schema.format) {\n\t\t\tcase \"email\":\n\t\t\tcase \"emoji\":\n\t\t\tcase \"uri\":\n\t\t\tcase \"uuid\":\n\t\t\tcase \"date-time\":\n\t\t\tcase \"date\":\n\t\t\tcase \"time\":\n\t\t\t\tconstraints.push(`a valid ${schema.format}`);\n\t\t\t\tdelete schema.pattern;\n\t\t\t\tdelete schema.format;\n\t\t\t\tbreak;\n\t\t}\n\t\tif (constraints.length === 0 && schema.pattern !== void 0) {\n\t\t\tconstraints.push(`input must match this regex ${schema.pattern}`);\n\t\t\tdelete schema.pattern;\n\t\t}\n\t\tif (constraints.length) schema.description = this.mergeParameterDescription(schema.description, constraints);\n\t\treturn schema;\n\t}\n\t/**\n\t* Default handler for JSON Schema numbers/integers.\n\t* Converts number constraints (minimum, maximum, multipleOf, exclusiveMinimum, exclusiveMaximum) to description text.\n\t*/\n\tdefaultNumberHandler(schema) {\n\t\tconst constraints = [];\n\t\tif (schema.minimum !== void 0) {\n\t\t\tif (schema.minimum !== Number.MIN_SAFE_INTEGER) constraints.push(`greater than or equal to ${schema.minimum}`);\n\t\t\tdelete schema.minimum;\n\t\t}\n\t\tif (schema.maximum !== void 0) {\n\t\t\tif (schema.maximum !== Number.MAX_SAFE_INTEGER) constraints.push(`lower than or equal to ${schema.maximum}`);\n\t\t\tdelete schema.maximum;\n\t\t}\n\t\tif (schema.exclusiveMinimum !== void 0) {\n\t\t\tconstraints.push(`greater than ${schema.exclusiveMinimum}`);\n\t\t\tdelete schema.exclusiveMinimum;\n\t\t}\n\t\tif (schema.exclusiveMaximum !== void 0) {\n\t\t\tconstraints.push(`lower than ${schema.exclusiveMaximum}`);\n\t\t\tdelete schema.exclusiveMaximum;\n\t\t}\n\t\tif (schema.multipleOf !== void 0) {\n\t\t\tconstraints.push(`multiple of ${schema.multipleOf}`);\n\t\t\tdelete schema.multipleOf;\n\t\t}\n\t\tif (constraints.length) schema.description = this.mergeParameterDescription(schema.description, constraints);\n\t\treturn schema;\n\t}\n\t/**\n\t* Default handler for JSON Schema unions (anyOf/oneOf).\n\t* Processes union schemas and can convert anyOf patterns to type arrays for simple primitives.\n\t*/\n\tdefaultUnionHandler(schema) {\n\t\tif (Array.isArray(schema.anyOf)) {\n\t\t\tschema.anyOf = schema.anyOf.map((subSchema) => {\n\t\t\t\tif (typeof subSchema !== \"object\" || subSchema === null) return false;\n\t\t\t\tthis.preProcessJSONNode(subSchema);\n\t\t\t\tthis.postProcessJSONNode(subSchema);\n\t\t\t\treturn subSchema;\n\t\t\t}).filter(Boolean);\n\t\t\tif (schema.anyOf.length === 1) schema = schema.anyOf[0];\n\t\t}\n\t\treturn schema;\n\t}\n\t/**\n\t* Default handler for JSON Schema allOf (intersection) types.\n\t* Flattens allOf sub-schemas by merging properties and required arrays into a single object schema.\n\t*/\n\tdefaultAllOfHandler(schema) {\n\t\tif (!schema.allOf || !Array.isArray(schema.allOf)) return schema;\n\t\tconst mergedProperties = {};\n\t\tconst mergedRequired = [];\n\t\tfor (const subSchema of schema.allOf) {\n\t\t\tif (subSchema.properties) Object.assign(mergedProperties, subSchema.properties);\n\t\t\tif (Array.isArray(subSchema.required)) mergedRequired.push(...subSchema.required);\n\t\t}\n\t\tdelete schema.allOf;\n\t\tschema.type = \"object\";\n\t\tschema.properties = mergedProperties;\n\t\tif (mergedRequired.length > 0) schema.required = [...new Set(mergedRequired)];\n\t\tschema.additionalProperties = false;\n\t\treturn schema;\n\t}\n\t/**\n\t* Default handler for JSON Schema nullable types.\n\t* Ensures nullable types are represented correctly.\n\t*/\n\tdefaultNullableHandler(schema) {\n\t\treturn this.defaultUnionHandler(schema);\n\t}\n\t/**\n\t* Default handler for JSON Schema dates (string with date/date-time format).\n\t* Converts date formats to string type with format constraint in description.\n\t*/\n\tdefaultDateHandler(schema) {\n\t\tif (schema.format === \"date\" || schema.format === \"date-time\") {\n\t\t\tconst format = schema.format;\n\t\t\tdelete schema.format;\n\t\t\tschema.description = this.mergeParameterDescription(schema.description, [`format: ${format}`]);\n\t\t}\n\t\treturn schema;\n\t}\n\t/**\n\t* Default handler for empty JSON schemas.\n\t* Converts empty {} schemas to a union of primitive types.\n\t*/\n\tdefaultEmptySchemaHandler(schema) {\n\t\tif (Object.keys(schema).length === 0) schema.type = [\n\t\t\t\"string\",\n\t\t\t\"number\",\n\t\t\t\"boolean\",\n\t\t\t\"null\"\n\t\t];\n\t\treturn schema;\n\t}\n\t/**\n\t* Default handler for unsupported JSON Schema features.\n\t* Can be used to strip or convert unsupported keywords.\n\t*/\n\tdefaultUnsupportedHandler(schema, unsupportedKeywords = []) {\n\t\tfor (const keyword of unsupportedKeywords) if (keyword in schema) delete schema[keyword];\n\t\treturn schema;\n\t}\n\tisObjectSchema(schema) {\n\t\treturn isObjectSchema(schema);\n\t}\n\tisArraySchema(schema) {\n\t\treturn isArraySchema(schema);\n\t}\n\tisStringSchema(schema) {\n\t\treturn isStringSchema(schema);\n\t}\n\tisNumberSchema(schema) {\n\t\treturn isNumberSchema(schema);\n\t}\n\tisUnionSchema(schema) {\n\t\treturn isUnionSchema(schema);\n\t}\n\tisAllOfSchema(schema) {\n\t\treturn isAllOfSchema(schema);\n\t}\n\t/**\n\t* Checks if a property is optional within a parent object schema.\n\t* A property is optional if it's not in the parent's `required` array.\n\t* @param propertyName - The name of the property to check\n\t* @param parentSchema - The parent object schema containing the property\n\t*/\n\tisOptionalProperty(propertyName, parentSchema) {\n\t\treturn isOptionalSchema(propertyName, parentSchema);\n\t}\n\t/**\n\t* Converts a Zod schema to JSON Schema using the standard-schema interface\n\t* and applies pre/post processing via traverse.\n\t*\n\t* Uses 'input' io mode so that fields with defaults are optional (appropriate for tool parameters).\n\t* @deprecated please use processToCompatSchema\n\t*/\n\ttoJSONSchema(zodSchema) {\n\t\tconst SCHEMA_TARGET_TO_STANDARD = {\n\t\t\tjsonSchema7: \"draft-07\",\n\t\t\t\"jsonSchema2019-09\": \"draft-2020-12\",\n\t\t\topenApi3: \"openapi-3.0\"\n\t\t};\n\t\tconst schemaTarget = this.getSchemaTarget();\n\t\tconst target = (schemaTarget && SCHEMA_TARGET_TO_STANDARD[schemaTarget]) ?? schemaTarget;\n\t\tconst jsonSchema = standardSchemaToJSONSchema(toStandardSchema(zodSchema), {\n\t\t\ttarget,\n\t\t\tio: \"input\"\n\t\t});\n\t\t(0, import_json_schema_traverse.default)(jsonSchema, { cb: {\n\t\t\tpre: (schema) => {\n\t\t\t\tthis.preProcessJSONNode(schema);\n\t\t\t},\n\t\t\tpost: (schema) => {\n\t\t\t\tthis.postProcessJSONNode(schema);\n\t\t\t}\n\t\t} });\n\t\treturn jsonSchema;\n\t}\n};\n//#endregion\n//#region src/null-to-undefined.ts\n/**\n* Recursively converts null values to undefined in an object based on which\n* properties are optional in the JSON Schema. This is needed because OpenAI\n* strict mode sends null for optional fields, but schemas like Zod's .optional()\n* reject null.\n*\n* Only converts null→undefined for properties that are NOT in the schema's\n* `required` array, preserving null for explicitly .nullable() fields.\n*/\nfunction transformNullToUndefined(value, jsonSchema) {\n\tif (value === null || value === void 0) return value;\n\tif (typeof value !== \"object\" || Array.isArray(value)) {\n\t\tif (Array.isArray(value) && jsonSchema.items && typeof jsonSchema.items === \"object\") return value.map((item) => transformNullToUndefined(item, jsonSchema.items));\n\t\treturn value;\n\t}\n\tconst properties = jsonSchema.properties;\n\tif (!properties) return value;\n\tconst required = jsonSchema.required || [];\n\tconst result = {};\n\tfor (const [key, val] of Object.entries(value)) if (val === null && !required.includes(key)) result[key] = void 0;\n\telse if (val !== null && typeof val === \"object\" && properties[key]) result[key] = transformNullToUndefined(val, properties[key]);\n\telse result[key] = val;\n\treturn result;\n}\n/**\n* Wraps a StandardSchemaWithJSON to transform null values to undefined for\n* optional fields before validation. This is a schema-agnostic solution for\n* OpenAI strict mode, which sends null for optional fields.\n*\n* The wrapper:\n* 1. Extracts the JSON Schema from the inner schema to determine optional fields\n* 2. Before validation, transforms null→undefined for non-required properties\n* 3. Delegates validation to the inner schema with the transformed value\n* 4. Delegates JSON Schema conversion to the inner schema unchanged\n*/\nfunction wrapSchemaWithNullTransform(schema) {\n\tlet jsonSchema;\n\ttry {\n\t\tjsonSchema = schema[\"~standard\"].jsonSchema.input({ target: \"draft-07\" });\n\t} catch {}\n\tif (!jsonSchema) return schema;\n\tconst innerProps = schema[\"~standard\"];\n\treturn { \"~standard\": {\n\t\tversion: innerProps.version,\n\t\tvendor: innerProps.vendor,\n\t\ttypes: innerProps.types,\n\t\tvalidate: (value, options) => {\n\t\t\tconst transformed = transformNullToUndefined(value, jsonSchema);\n\t\t\treturn innerProps.validate(transformed, options);\n\t\t},\n\t\tjsonSchema: innerProps.jsonSchema\n\t} };\n}\nfunction isOptional$1(z) {\n\treturn (v) => v instanceof z[\"ZodOptional\"];\n}\nfunction isObj$1(z) {\n\treturn (v) => v instanceof z[\"ZodObject\"];\n}\nfunction isNull(z) {\n\treturn (v) => v instanceof z[\"ZodNull\"];\n}\nfunction isArr$1(z) {\n\treturn (v) => v instanceof z[\"ZodArray\"];\n}\nfunction isUnion$1(z) {\n\treturn (v) => v instanceof z[\"ZodUnion\"];\n}\nfunction isString$1(z) {\n\treturn (v) => v instanceof z[\"ZodString\"];\n}\nfunction isNumber$1(z) {\n\treturn (v) => v instanceof z[\"ZodNumber\"];\n}\nfunction isDate(z) {\n\treturn (v) => v instanceof z[\"ZodDate\"];\n}\nfunction isDefault(z) {\n\treturn (v) => v instanceof z[\"ZodDefault\"];\n}\nfunction isNullable(z) {\n\treturn (v) => v instanceof z[\"ZodNullable\"];\n}\nfunction isIntersection(z) {\n\treturn (v) => v instanceof z[\"ZodIntersection\"];\n}\n//#endregion\n//#region src/provider-compats/openai.ts\nconst allowedStringFormats = [\n\t\"date-time\",\n\t\"time\",\n\t\"date\",\n\t\"duration\",\n\t\"email\",\n\t\"hostname\",\n\t\"ipv4\",\n\t\"ipv6\",\n\t\"uuid\"\n];\nvar OpenAISchemaCompatLayer = class extends SchemaCompatLayer {\n\tgetSchemaTarget() {\n\t\treturn `jsonSchema7`;\n\t}\n\tisReasoningModel() {\n\t\tconst modelId = this.getModel().modelId;\n\t\tif (!modelId) return false;\n\t\treturn modelId.includes(`o3`) || modelId.includes(`o4`) || modelId.includes(`o1`);\n\t}\n\tshouldApply() {\n\t\tconst model = this.getModel();\n\t\tif (!this.isReasoningModel() && (model.provider.includes(`openai`) || model.modelId?.includes(`openai`) || model.provider.includes(`groq`))) return true;\n\t\treturn false;\n\t}\n\tprocessZodType(value) {\n\t\tif (isOptional$1(z$1)(value)) {\n\t\t\tconst innerType = \"_def\" in value ? value._def.innerType : value._zod?.def?.innerType;\n\t\t\tif (innerType) {\n\t\t\t\tif (isNullable(z$1)(innerType)) return this.processZodType(innerType).transform((val) => val === null ? void 0 : val);\n\t\t\t\treturn this.processZodType(innerType).nullable().transform((val) => val === null ? void 0 : val);\n\t\t\t}\n\t\t\treturn value;\n\t\t} else if (isNullable(z$1)(value)) {\n\t\t\tconst innerType = \"_def\" in value ? value._def.innerType : value._zod?.def?.innerType;\n\t\t\tif (innerType) {\n\t\t\t\tif (isOptional$1(z$1)(innerType)) {\n\t\t\t\t\tconst innerInnerType = \"_def\" in innerType ? innerType._def.innerType : innerType._zod?.def?.innerType;\n\t\t\t\t\tif (innerInnerType) return this.processZodType(innerInnerType).nullable().transform((val) => val === null ? void 0 : val);\n\t\t\t\t}\n\t\t\t\treturn this.processZodType(innerType).nullable();\n\t\t\t}\n\t\t\treturn value;\n\t\t} else if (isDefault(z$1)(value)) {\n\t\t\tconst innerType = \"_def\" in value ? value._def.innerType : value._zod?.def?.innerType;\n\t\t\tconst defaultValue = \"_def\" in value ? value._def.defaultValue : value._zod?.def?.defaultValue;\n\t\t\tif (innerType) return this.processZodType(innerType).nullable().transform((val) => {\n\t\t\t\tif (val === null) return typeof defaultValue === \"function\" ? defaultValue() : defaultValue;\n\t\t\t\treturn val;\n\t\t\t});\n\t\t\treturn value;\n\t\t} else if (isObj$1(z$1)(value)) return this.defaultZodObjectHandler(value);\n\t\telse if (isUnion$1(z$1)(value)) return this.defaultZodUnionHandler(value);\n\t\telse if (isArr$1(z$1)(value)) return this.defaultZodArrayHandler(value);\n\t\telse if (isString$1(z$1)(value)) {\n\t\t\tconst model = this.getModel();\n\t\t\tconst checks = [\"emoji\"];\n\t\t\tif (model.modelId?.includes(\"gpt-4o-mini\")) return this.defaultZodStringHandler(value, [\"emoji\", \"regex\"]);\n\t\t\treturn this.defaultZodStringHandler(value, checks);\n\t\t}\n\t\tif (isIntersection(z$1)(value)) return this.defaultZodIntersectionHandler(value);\n\t\treturn this.defaultUnsupportedZodTypeHandler(value, [\n\t\t\t\"ZodNever\",\n\t\t\t\"ZodUndefined\",\n\t\t\t\"ZodTuple\"\n\t\t]);\n\t}\n\t/**\n\t* Override to apply the same JSON Schema fixes (additionalProperties, required fields)\n\t* that processToJSONSchema applies. The base implementation skips JSON Schema traversal,\n\t* which causes OpenAI strict mode to reject tool schemas missing additionalProperties: false.\n\t*/\n\tprocessToAISDKSchema(zodSchema) {\n\t\tconst transformedJsonSchema = standardSchemaToJSONSchema(this.processToCompatSchema(zodSchema));\n\t\treturn jsonSchema(transformedJsonSchema, { validate: (value) => {\n\t\t\tconst transformed = this.#traverse(value, transformedJsonSchema);\n\t\t\tconst result = zodSchema.safeParse(transformed);\n\t\t\treturn result.success ? {\n\t\t\t\tsuccess: true,\n\t\t\t\tvalue: result.data\n\t\t\t} : {\n\t\t\t\tsuccess: false,\n\t\t\t\terror: result.error\n\t\t\t};\n\t\t} });\n\t}\n\tprocessToCompatSchema(schema) {\n\t\tconst originalStandardSchema = toStandardSchema(schema);\n\t\treturn { \"~standard\": {\n\t\t\tversion: 1,\n\t\t\tvendor: \"mastra\",\n\t\t\tvalidate: (value) => {\n\t\t\t\tconst transformedJsonSchema = this.processToJSONSchema(schema, \"input\");\n\t\t\t\tconst transformed = this.#traverse(value, transformedJsonSchema);\n\t\t\t\treturn originalStandardSchema[\"~standard\"].validate(transformed);\n\t\t\t},\n\t\t\tjsonSchema: {\n\t\t\t\tinput: () => {\n\t\t\t\t\treturn this.processToJSONSchema(schema, \"input\");\n\t\t\t\t},\n\t\t\t\toutput: () => {\n\t\t\t\t\treturn this.processToJSONSchema(schema, \"output\");\n\t\t\t\t}\n\t\t\t}\n\t\t} };\n\t}\n\tpreProcessJSONNode(schema, _parentSchema) {\n\t\tif (isAllOfSchema(schema)) this.defaultAllOfHandler(schema);\n\t\tif (isObjectSchema(schema)) this.defaultObjectHandler(schema);\n\t\telse if (isArraySchema(schema)) this.defaultArrayHandler(schema);\n\t\telse if (isNumberSchema(schema)) this.defaultNumberHandler(schema);\n\t\telse if (isStringSchema(schema)) {\n\t\t\tif (schema.format) {\n\t\t\t\tif (!allowedStringFormats.includes(schema.format)) {\n\t\t\t\t\tdelete schema.format;\n\t\t\t\t\tdelete schema.pattern;\n\t\t\t\t}\n\t\t\t}\n\t\t\tthis.defaultStringHandler(schema);\n\t\t}\n\t}\n\tpostProcessJSONNode(schema) {\n\t\tif (isUnionSchema(schema)) this.defaultUnionHandler(schema);\n\t\tif (schema.type === void 0 && !schema.anyOf) {\n\t\t\tlet subSchema = {};\n\t\t\tfor (const key of Object.keys(schema)) {\n\t\t\t\tsubSchema[key] = schema[key];\n\t\t\t\tdelete schema[key];\n\t\t\t}\n\t\t\tschema.anyOf = [subSchema, { type: \"null\" }];\n\t\t}\n\t\tif (isObjectSchema(schema)) {\n\t\t\tschema.additionalProperties = false;\n\t\t\tif (schema.properties) for (const key of Object.keys(schema.properties)) {\n\t\t\t\tconst prop = schema.properties[key];\n\t\t\t\tif (!schema.required) schema.required = [];\n\t\t\t\tif (!schema.required?.includes(key)) {\n\t\t\t\t\tschema[\"x-optional\"] = [...schema[\"x-optional\"] || [], key];\n\t\t\t\t\tschema.required?.push(key);\n\t\t\t\t\tif (prop.type) {\n\t\t\t\t\t\tif (Array.isArray(prop.type)) {\n\t\t\t\t\t\t\tconst types = [...prop.type];\n\t\t\t\t\t\t\tif (!types.includes(\"null\")) types.push(\"null\");\n\t\t\t\t\t\t\tconst propSchema = { ...prop };\n\t\t\t\t\t\t\tdelete propSchema.anyOf;\n\t\t\t\t\t\t\tdelete propSchema.type;\n\t\t\t\t\t\t\tdelete prop.type;\n\t\t\t\t\t\t\tprop.anyOf = types.map((type) => type === \"null\" ? { type: \"null\" } : {\n\t\t\t\t\t\t\t\t...propSchema,\n\t\t\t\t\t\t\t\ttype\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t} else if (prop.type !== \"null\") {\n\t\t\t\t\t\t\tconst originalType = prop.type;\n\t\t\t\t\t\t\tconst propSchema = { ...prop };\n\t\t\t\t\t\t\tdelete propSchema.anyOf;\n\t\t\t\t\t\t\tdelete propSchema.type;\n\t\t\t\t\t\t\tdelete prop.type;\n\t\t\t\t\t\t\tprop.anyOf = [{\n\t\t\t\t\t\t\t\t...propSchema,\n\t\t\t\t\t\t\t\ttype: originalType\n\t\t\t\t\t\t\t}, { type: \"null\" }];\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\t#traverse(value, schema) {\n\t\tconst resolved = this.#resolveAnyOf(schema);\n\t\tif ((isDateFormat(resolved) || resolved[\"x-date\"] === true) && typeof value === \"string\") return new Date(value);\n\t\tif (resolved.type === \"array\" || Array.isArray(resolved.type) && resolved.type.includes(\"array\")) {\n\t\t\tif (!Array.isArray(value)) return value;\n\t\t\treturn value.map((item) => this.#traverse(item, resolved.items));\n\t\t}\n\t\tif (!(resolved.type === \"object\" || Array.isArray(resolved.type) && resolved.type.includes(\"object\"))) return value;\n\t\tconst properties = resolved.properties;\n\t\tif (!properties || !value) return value;\n\t\tconst obj = value;\n\t\tconst optionalProperties = resolved[\"x-optional\"] ?? [];\n\t\tfor (const key in obj) if (optionalProperties.includes(key) && obj[key] === null) obj[key] = void 0;\n\t\telse if (properties[key]) obj[key] = this.#traverse(obj[key], properties[key]);\n\t\treturn obj;\n\t}\n\t/**\n\t* If schema has anyOf, return the first non-null variant for traversal.\n\t* Otherwise return the schema itself.\n\t*/\n\t#resolveAnyOf(schema) {\n\t\tif (Array.isArray(schema.anyOf)) {\n\t\t\tconst nonNull = schema.anyOf.find((s) => s.type !== \"null\");\n\t\t\tif (nonNull) return nonNull;\n\t\t}\n\t\treturn schema;\n\t}\n};\nfunction isDateFormat(schema) {\n\treturn schema.format === \"date-time\" || schema.format === \"date\";\n}\n//#endregion\n//#region src/provider-compats/openai-reasoning.ts\nvar OpenAIReasoningSchemaCompatLayer = class extends OpenAISchemaCompatLayer {\n\tgetSchemaTarget() {\n\t\treturn `openApi3`;\n\t}\n\tisReasoningModel() {\n\t\tconst modelId = this.getModel().modelId;\n\t\tif (!modelId) return false;\n\t\treturn modelId.includes(`o3`) || modelId.includes(`o4`) || modelId.includes(`o1`);\n\t}\n\tshouldApply() {\n\t\tconst model = this.getModel();\n\t\tif (this.isReasoningModel() && (model.provider.includes(`openai`) || model.modelId?.includes(`openai`))) return true;\n\t\treturn false;\n\t}\n\tprocessZodType(value) {\n\t\tif (isOptional$1(z$1)(value)) {\n\t\t\tconst innerType = \"_def\" in value ? value._def.innerType : value._zod?.def?.innerType;\n\t\t\tif (innerType) {\n\t\t\t\tif (isNullable(z$1)(innerType)) return this.processZodType(innerType).transform((val) => val === null ? void 0 : val);\n\t\t\t\treturn this.processZodType(innerType).nullable().transform((val) => val === null ? void 0 : val);\n\t\t\t}\n\t\t\treturn value;\n\t\t} else if (isNullable(z$1)(value)) {\n\t\t\tconst innerType = \"_def\" in value ? value._def.innerType : value._zod?.def?.innerType;\n\t\t\tif (innerType && isOptional$1(z$1)(innerType)) {\n\t\t\t\tconst innerInnerType = \"_def\" in innerType ? innerType._def.innerType : innerType._zod?.def?.innerType;\n\t\t\t\tif (innerInnerType) return this.processZodType(innerInnerType).nullable().transform((val) => val === null ? void 0 : val);\n\t\t\t}\n\t\t\tif (innerType) return this.processZodType(innerType).nullable();\n\t\t\treturn value;\n\t\t} else if (isObj$1(z$1)(value)) return this.defaultZodObjectHandler(value, { passthrough: false });\n\t\telse if (isArr$1(z$1)(value)) return this.defaultZodArrayHandler(value);\n\t\telse if (isUnion$1(z$1)(value)) return this.defaultZodUnionHandler(value);\n\t\telse if (isDefault(z$1)(value)) {\n\t\t\tconst defaultDef = value._def;\n\t\t\tconst innerType = defaultDef.innerType;\n\t\t\tconst defaultValue = typeof defaultDef.defaultValue === \"function\" ? defaultDef.defaultValue() : defaultDef.defaultValue;\n\t\t\tconst constraints = [];\n\t\t\tif (defaultValue !== void 0) constraints.push(`the default value is ${defaultValue}`);\n\t\t\tconst description = this.mergeParameterDescription(value.description, constraints);\n\t\t\tlet result = this.processZodType(innerType);\n\t\t\tif (description) result = result.describe(description);\n\t\t\treturn result;\n\t\t} else if (isNumber$1(z$1)(value)) return this.defaultZodNumberHandler(value);\n\t\telse if (isString$1(z$1)(value)) return this.defaultZodStringHandler(value);\n\t\telse if (isDate(z$1)(value)) return this.defaultZodDateHandler(value);\n\t\telse if (isNull(z$1)(value)) return z$1.any().refine((v) => v === null, { message: \"must be null\" }).describe(value.description || \"must be null\");\n\t\telse if (value.constructor.name === \"ZodAny\") return z$1.string().describe((value.description ?? \"\") + `\\nArgument was an \"any\" type, but you (the LLM) do not support \"any\", so it was cast to a \"string\" type`);\n\t\tif (isIntersection(z$1)(value)) return this.defaultZodIntersectionHandler(value);\n\t\treturn this.defaultUnsupportedZodTypeHandler(value);\n\t}\n};\n//#endregion\n//#region src/standard-schema-compat.ts\n/**\n* Standard Schema compatibility utilities\n*\n* This module provides utilities to apply provider-specific schema transformations\n* to StandardSchemaWithJSON types, particularly for OpenAI compatibility.\n*/\n/**\n* Extracts the underlying Zod schema from a schema value.\n*\n* Handles both:\n* - Raw Zod schemas (z.object(...))\n* - StandardSchemaWithJSON wrappers that preserve Zod methods via prototype\n*\n* @param schema - The schema to extract from\n* @returns The underlying Zod schema, or null if not a Zod schema\n*/\nfunction extractZodSchema(schema) {\n\tif (!isZodType(schema)) return null;\n\treturn schema;\n}\n/**\n* Applies OpenAI schema compatibility transforms to a schema.\n*\n* For OpenAI models, converts `.optional()` fields to `.nullable().transform()`\n* to work around OpenAI's limitation with optional fields in structured outputs.\n*\n* @param schema - The schema to process (raw Zod or StandardSchemaWithJSON)\n* @param modelInfo - Information about the target model\n* @returns The processed schema as StandardSchemaWithJSON, or original if not applicable\n*\n* @example\n* ```typescript\n* const schema = z.object({\n* name: z.string(),\n* age: z.number().optional(), // Will be converted to .nullable().transform()\n* });\n*\n* const processed = applyOpenAICompatTransforms(schema, {\n* provider: 'openai',\n* modelId: 'gpt-4',\n* supportsStructuredOutputs: false,\n* });\n* ```\n*/\nfunction applyOpenAICompatTransforms(schema, modelInfo) {\n\tif (!(modelInfo.provider?.includes(\"openai\") || modelInfo.modelId?.includes(\"openai\"))) return schema;\n\tconst zodSchema = extractZodSchema(schema);\n\tif (!zodSchema) return schema;\n\tconst compatLayer = /^o[1-5]/.test(modelInfo.modelId) ? new OpenAIReasoningSchemaCompatLayer(modelInfo) : new OpenAISchemaCompatLayer(modelInfo);\n\tif (!compatLayer.shouldApply()) return schema;\n\treturn toStandardSchema(compatLayer.processZodType(zodSchema));\n}\n/**\n* Applies OpenAI compat transforms to all tools in a toolset.\n*\n* Processes each tool's inputSchema (if present) with OpenAI compatibility transforms.\n*\n* @param tools - The toolset to process\n* @param modelInfo - Information about the target model\n* @returns The processed toolset with transformed schemas\n*\n* @example\n* ```typescript\n* const tools = {\n* getTodo: {\n* inputSchema: z.object({\n* id: z.string(),\n* includeCompleted: z.boolean().optional(), // Will be transformed\n* }),\n* execute: async (input) => { ... },\n* },\n* };\n*\n* const processed = applyOpenAICompatToTools(tools, {\n* provider: 'openai',\n* modelId: 'gpt-4',\n* supportsStructuredOutputs: false,\n* });\n* ```\n*/\nfunction applyOpenAICompatToTools(tools, modelInfo) {\n\tif (!tools) return tools;\n\tconst transformedTools = {};\n\tfor (const [name, tool] of Object.entries(tools)) if (tool.inputSchema) {\n\t\tconst processedSchema = applyOpenAICompatTransforms(tool.inputSchema, modelInfo);\n\t\ttransformedTools[name] = {\n\t\t\t...tool,\n\t\t\tinputSchema: processedSchema\n\t\t};\n\t} else transformedTools[name] = tool;\n\treturn transformedTools;\n}\n//#endregion\n//#region src/provider-compats/anthropic.ts\nvar AnthropicSchemaCompatLayer = class extends SchemaCompatLayer {\n\tconstructor(model) {\n\t\tsuper(model);\n\t}\n\tgetSchemaTarget() {\n\t\treturn \"jsonSchema7\";\n\t}\n\tprocessToJSONSchema(schema, io = \"input\") {\n\t\tconst jsonSchema = super.processToJSONSchema(schema, io);\n\t\tconst union = jsonSchema.anyOf ?? jsonSchema.oneOf;\n\t\tif (io !== \"input\" || !Array.isArray(union)) return jsonSchema;\n\t\tconst objectSchemas = union.filter((subSchema) => typeof subSchema === \"object\" && subSchema !== null && subSchema.type === \"object\");\n\t\tif (objectSchemas.length === 0 || objectSchemas.length !== union.length) return jsonSchema;\n\t\tdelete jsonSchema.anyOf;\n\t\tdelete jsonSchema.oneOf;\n\t\tjsonSchema.type = \"object\";\n\t\tconst mergedProperties = {};\n\t\tfor (const subSchema of objectSchemas) for (const [key, propSchema] of Object.entries(subSchema.properties ?? {})) {\n\t\t\tconst variants = mergedProperties[key] ??= [];\n\t\t\tif (!variants.some((existing) => JSON.stringify(existing) === JSON.stringify(propSchema))) variants.push(propSchema);\n\t\t}\n\t\tjsonSchema.properties = Object.fromEntries(Object.entries(mergedProperties).map(([key, variants]) => [key, variants.length === 1 ? variants[0] : { anyOf: variants }]));\n\t\tjsonSchema.required = objectSchemas.map((subSchema) => subSchema.required ?? []).reduce((required, branchRequired) => required.filter((key) => branchRequired.includes(key)));\n\t\tjsonSchema.additionalProperties = false;\n\t\treturn jsonSchema;\n\t}\n\tshouldApply() {\n\t\treturn this.getModel().modelId.includes(\"claude\");\n\t}\n\tprocessZodType(value) {\n\t\tif (this.isOptional(value)) {\n\t\t\tconst handleTypes = [\n\t\t\t\t\"ZodObject\",\n\t\t\t\t\"ZodArray\",\n\t\t\t\t\"ZodUnion\",\n\t\t\t\t\"ZodNever\",\n\t\t\t\t\"ZodUndefined\",\n\t\t\t\t\"ZodTuple\"\n\t\t\t];\n\t\t\tif (this.getModel().modelId.includes(\"claude-3.5-haiku\")) handleTypes.push(\"ZodString\");\n\t\t\treturn this.defaultZodOptionalHandler(value, handleTypes);\n\t\t} else if (this.isObj(value)) return this.defaultZodObjectHandler(value);\n\t\telse if (this.isArr(value)) return this.defaultZodArrayHandler(value, []);\n\t\telse if (this.isUnion(value)) return this.defaultZodUnionHandler(value);\n\t\telse if (this.isString(value)) if (this.getModel().modelId.includes(\"claude-3.5-haiku\")) return this.defaultZodStringHandler(value, [\"max\", \"min\"]);\n\t\telse return value;\n\t\telse if (isNull(z$1)(value)) return z$1.any().refine((v) => v === null, { message: \"must be null\" }).describe(value.description || \"must be null\");\n\t\telse if (isIntersection(z$1)(value)) return this.defaultZodIntersectionHandler(value);\n\t\treturn this.defaultUnsupportedZodTypeHandler(value);\n\t}\n\tprocessToAISDKSchema(zodSchema) {\n\t\tconst transformedJsonSchema = standardSchemaToJSONSchema(this.processToCompatSchema(zodSchema));\n\t\treturn jsonSchema(transformedJsonSchema, { validate: (value) => {\n\t\t\tconst transformed = this.#traverse(value, transformedJsonSchema);\n\t\t\tconst result = zodSchema.safeParse(transformed);\n\t\t\treturn result.success ? {\n\t\t\t\tsuccess: true,\n\t\t\t\tvalue: result.data\n\t\t\t} : {\n\t\t\t\tsuccess: false,\n\t\t\t\terror: result.error\n\t\t\t};\n\t\t} });\n\t}\n\tprocessToCompatSchema(schema) {\n\t\tconst originalStandardSchema = toStandardSchema(schema);\n\t\treturn { \"~standard\": {\n\t\t\tversion: 1,\n\t\t\tvendor: \"mastra\",\n\t\t\tvalidate: (value) => {\n\t\t\t\tconst transformedJsonSchema = this.processToJSONSchema(schema, \"input\");\n\t\t\t\tconst transformed = this.#traverse(value, transformedJsonSchema);\n\t\t\t\treturn originalStandardSchema[\"~standard\"].validate(transformed);\n\t\t\t},\n\t\t\tjsonSchema: {\n\t\t\t\tinput: () => {\n\t\t\t\t\treturn this.processToJSONSchema(schema, \"input\");\n\t\t\t\t},\n\t\t\t\toutput: () => {\n\t\t\t\t\treturn this.processToJSONSchema(schema, \"output\");\n\t\t\t\t}\n\t\t\t}\n\t\t} };\n\t}\n\tpreProcessJSONNode(schema) {\n\t\tif (isAllOfSchema(schema)) this.defaultAllOfHandler(schema);\n\t\tif (isObjectSchema(schema)) this.defaultObjectHandler(schema);\n\t\telse if (isArraySchema(schema)) this.defaultArrayHandler(schema);\n\t\telse if (isNumberSchema(schema)) this.defaultNumberHandler(schema);\n\t\telse if (isStringSchema(schema)) this.defaultStringHandler(schema);\n\t}\n\tpostProcessJSONNode(schema) {\n\t\tif (isUnionSchema(schema)) this.defaultUnionHandler(schema);\n\t}\n\t#traverse(value, schema) {\n\t\tconst resolved = this.#resolveSchemaForValue(schema, value);\n\t\tif (resolved[\"x-date\"] === true && typeof value === \"string\") return new Date(value);\n\t\tif (resolved.type === \"array\" || Array.isArray(resolved.type) && resolved.type.includes(\"array\")) {\n\t\t\tif (!Array.isArray(value)) return value;\n\t\t\treturn value.map((item) => this.#traverse(item, resolved.items));\n\t\t}\n\t\tif (!(resolved.type === \"object\" || Array.isArray(resolved.type) && resolved.type.includes(\"object\"))) return value;\n\t\tconst properties = resolved.properties;\n\t\tif (!properties || !value) return value;\n\t\tconst obj = value;\n\t\tfor (const key in obj) if (properties[key]) obj[key] = this.#traverse(obj[key], properties[key]);\n\t\treturn obj;\n\t}\n\t#resolveSchemaForValue(schema, value) {\n\t\tif (!Array.isArray(schema.anyOf)) return schema;\n\t\tconst variants = schema.anyOf;\n\t\tconst nonNullVariants = variants.filter((variant) => variant.type !== \"null\");\n\t\tif (variants.length === 2 && nonNullVariants.length === 1) return nonNullVariants[0];\n\t\tconst keys = value && typeof value === \"object\" ? Object.keys(value) : [];\n\t\treturn nonNullVariants.find((variant) => {\n\t\t\tconst properties = variant.properties;\n\t\t\treturn !!properties && keys.some((key) => key in properties);\n\t\t}) ?? schema;\n\t}\n};\n//#endregion\n//#region src/provider-compats/deepseek.ts\nvar DeepSeekSchemaCompatLayer = class extends SchemaCompatLayer {\n\tconstructor(model) {\n\t\tsuper(model);\n\t}\n\tgetSchemaTarget() {\n\t\treturn \"jsonSchema7\";\n\t}\n\tshouldApply() {\n\t\treturn this.getModel().modelId.includes(\"deepseek\") && !this.getModel().modelId.includes(\"r1\");\n\t}\n\tprocessZodType(value) {\n\t\tif (isOptional$1(z$1)(value)) return this.defaultZodOptionalHandler(value, [\n\t\t\t\"ZodObject\",\n\t\t\t\"ZodArray\",\n\t\t\t\"ZodUnion\",\n\t\t\t\"ZodString\",\n\t\t\t\"ZodNumber\"\n\t\t]);\n\t\telse if (isObj$1(z$1)(value)) return this.defaultZodObjectHandler(value);\n\t\telse if (isArr$1(z$1)(value)) return this.defaultZodArrayHandler(value, [\"min\", \"max\"]);\n\t\telse if (isUnion$1(z$1)(value)) return this.defaultZodUnionHandler(value);\n\t\telse if (isString$1(z$1)(value)) return this.defaultZodStringHandler(value);\n\t\telse if (isIntersection(z$1)(value)) return this.defaultZodIntersectionHandler(value);\n\t\treturn value;\n\t}\n\tprocessToAISDKSchema(zodSchema) {\n\t\tconst transformedJsonSchema = standardSchemaToJSONSchema(this.processToCompatSchema(zodSchema));\n\t\treturn jsonSchema(transformedJsonSchema, { validate: (value) => {\n\t\t\tconst transformed = this.#traverse(value, transformedJsonSchema);\n\t\t\tconst result = zodSchema.safeParse(transformed);\n\t\t\treturn result.success ? {\n\t\t\t\tsuccess: true,\n\t\t\t\tvalue: result.data\n\t\t\t} : {\n\t\t\t\tsuccess: false,\n\t\t\t\terror: result.error\n\t\t\t};\n\t\t} });\n\t}\n\tprocessToCompatSchema(schema) {\n\t\tconst originalStandardSchema = toStandardSchema(schema);\n\t\treturn { \"~standard\": {\n\t\t\tversion: 1,\n\t\t\tvendor: \"mastra\",\n\t\t\tvalidate: (value) => {\n\t\t\t\tconst transformedJsonSchema = this.processToJSONSchema(schema, \"input\");\n\t\t\t\tconst transformed = this.#traverse(value, transformedJsonSchema);\n\t\t\t\treturn originalStandardSchema[\"~standard\"].validate(transformed);\n\t\t\t},\n\t\t\tjsonSchema: {\n\t\t\t\tinput: () => {\n\t\t\t\t\treturn this.processToJSONSchema(schema, \"input\");\n\t\t\t\t},\n\t\t\t\toutput: () => {\n\t\t\t\t\treturn this.processToJSONSchema(schema, \"output\");\n\t\t\t\t}\n\t\t\t}\n\t\t} };\n\t}\n\tpreProcessJSONNode(schema) {\n\t\tif (isAllOfSchema(schema)) this.defaultAllOfHandler(schema);\n\t\tif (isObjectSchema(schema)) this.defaultObjectHandler(schema);\n\t\telse if (isArraySchema(schema)) this.defaultArrayHandler(schema);\n\t\telse if (isNumberSchema(schema)) this.defaultNumberHandler(schema);\n\t\telse if (isStringSchema(schema)) this.defaultStringHandler(schema);\n\t}\n\tpostProcessJSONNode(schema) {\n\t\tif (isUnionSchema(schema)) this.defaultUnionHandler(schema);\n\t}\n\t#traverse(value, schema) {\n\t\tconst resolved = this.#resolveAnyOf(schema);\n\t\tif (resolved[\"x-date\"] === true && typeof value === \"string\") return new Date(value);\n\t\tif (resolved.type === \"array\" || Array.isArray(resolved.type) && resolved.type.includes(\"array\")) {\n\t\t\tif (!Array.isArray(value)) return value;\n\t\t\treturn value.map((item) => this.#traverse(item, resolved.items));\n\t\t}\n\t\tif (!(resolved.type === \"object\" || Array.isArray(resolved.type) && resolved.type.includes(\"object\"))) return value;\n\t\tconst properties = resolved.properties;\n\t\tif (!properties || !value) return value;\n\t\tconst obj = value;\n\t\tfor (const key in obj) if (properties[key]) obj[key] = this.#traverse(obj[key], properties[key]);\n\t\treturn obj;\n\t}\n\t#resolveAnyOf(schema) {\n\t\tif (Array.isArray(schema.anyOf)) {\n\t\t\tconst nonNull = schema.anyOf.find((s) => s.type !== \"null\");\n\t\t\tif (nonNull) return nonNull;\n\t\t}\n\t\treturn schema;\n\t}\n};\n//#endregion\n//#region src/provider-compats/google.ts\nfunction fixAISDKNullableUnionTypes(schema) {\n\tif (typeof schema !== \"object\" || schema === null) return schema;\n\tconst result = { ...schema };\n\tif (Array.isArray(result.type)) {\n\t\tconst nonNullTypes = result.type.filter((t) => t !== \"null\");\n\t\tif (nonNullTypes.length === 1) {\n\t\t\tresult.type = nonNullTypes[0];\n\t\t\tresult.nullable = true;\n\t\t} else {\n\t\t\tdelete result.type;\n\t\t\tdelete result.nullable;\n\t\t}\n\t}\n\tif (Array.isArray(result.enum) && result.enum.some((value) => typeof value !== \"string\")) delete result.enum;\n\tif (\"const\" in result && typeof result.const !== \"string\") delete result.const;\n\tif (result.anyOf && Array.isArray(result.anyOf)) {\n\t\tconst nullSchema = result.anyOf.find((s) => typeof s === \"object\" && s !== null && s.type === \"null\");\n\t\tconst nonNullSchemas = result.anyOf.filter((s) => !(typeof s === \"object\" && s !== null && s.type === \"null\"));\n\t\tif (nullSchema) {\n\t\t\tconst { anyOf: _, ...rest } = result;\n\t\t\tif (nonNullSchemas.length === 1 && typeof nonNullSchemas[0] === \"object\" && nonNullSchemas[0] !== null) {\n\t\t\t\tconst fixedOther = fixAISDKNullableUnionTypes(nonNullSchemas[0]);\n\t\t\t\treturn fixedOther.type ? {\n\t\t\t\t\t...rest,\n\t\t\t\t\t...fixedOther,\n\t\t\t\t\tnullable: true\n\t\t\t\t} : {\n\t\t\t\t\t...rest,\n\t\t\t\t\t...fixedOther\n\t\t\t\t};\n\t\t\t}\n\t\t\treturn rest;\n\t\t}\n\t}\n\tif (result.properties && typeof result.properties === \"object\") result.properties = Object.fromEntries(Object.entries(result.properties).map(([key, value]) => [key, fixAISDKNullableUnionTypes(value)]));\n\tif (result.items) if (Array.isArray(result.items)) result.items = result.items.map((item) => fixAISDKNullableUnionTypes(item));\n\telse result.items = fixAISDKNullableUnionTypes(result.items);\n\tif (result.additionalProperties && typeof result.additionalProperties === \"object\") result.additionalProperties = fixAISDKNullableUnionTypes(result.additionalProperties);\n\tif (result.anyOf && Array.isArray(result.anyOf)) result.anyOf = result.anyOf.map((s) => fixAISDKNullableUnionTypes(s));\n\tif (result.oneOf && Array.isArray(result.oneOf)) result.oneOf = result.oneOf.map((s) => fixAISDKNullableUnionTypes(s));\n\tif (result.allOf && Array.isArray(result.allOf)) result.allOf = result.allOf.map((s) => fixAISDKNullableUnionTypes(s));\n\tif (result.anyOf && Array.isArray(result.anyOf)) {\n\t\tif (result.description) {\n\t\t\tfor (const item of result.anyOf) if (typeof item === \"object\" && item !== null && !item.description) item.description = result.description;\n\t\t}\n\t\treturn { anyOf: result.anyOf };\n\t}\n\treturn result;\n}\n/**\n* Inline `$ref` pointers one level and drop `definitions`/`$defs`.\n* Gemini can't follow JSON Schema `$ref`s — they cause silent mis-fills.\n* Self-references (recursive schemas) are collapsed to `{ type: 'object' }`\n* to avoid infinite expansion.\n*/\nfunction inlineRefsAndDropDefinitions(schema) {\n\tconst json = JSON.stringify(schema);\n\tif (!json.includes(\"\\\"$ref\\\"\")) return;\n\tconst defs = schema[\"definitions\"] ?? schema[\"$defs\"];\n\tconst snapshot = JSON.parse(json);\n\tresolveRefs(schema, snapshot, snapshot[\"definitions\"] ?? snapshot[\"$defs\"] ?? defs ?? {}, /* @__PURE__ */ new Set());\n\tdelete schema[\"definitions\"];\n\tdelete schema[\"$defs\"];\n}\nfunction resolveRefs(node, rootSnapshot, defs, visiting) {\n\tif (typeof node !== \"object\" || node === null) return;\n\tfor (const [key, value] of Object.entries(node)) if (key === \"$ref\" && typeof value === \"string\") {\n\t\tconst resolved = resolveRef(value, rootSnapshot, defs);\n\t\tif (!resolved || visiting.has(value)) {\n\t\t\tdelete node[\"$ref\"];\n\t\t\tnode[\"type\"] = \"object\";\n\t\t} else {\n\t\t\tdelete node[\"$ref\"];\n\t\t\tvisiting.add(value);\n\t\t\tconst clone = JSON.parse(JSON.stringify(resolved));\n\t\t\tresolveRefs(clone, rootSnapshot, defs, visiting);\n\t\t\tvisiting.delete(value);\n\t\t\tObject.assign(node, clone);\n\t\t}\n\t} else if (Array.isArray(value)) {\n\t\tfor (const item of value) if (typeof item === \"object\" && item !== null) resolveRefs(item, rootSnapshot, defs, visiting);\n\t} else if (typeof value === \"object\" && value !== null) resolveRefs(value, rootSnapshot, defs, visiting);\n}\nfunction resolveRef(ref, rootSnapshot, defs) {\n\tif (ref === \"#\") return rootSnapshot;\n\tconst match = ref.match(/^#\\/(?:definitions|\\$defs)\\/(.+)$/);\n\tif (match) return defs[match[1]];\n}\nvar GoogleSchemaCompatLayer = class extends SchemaCompatLayer {\n\tconstructor(model) {\n\t\tsuper(model);\n\t}\n\tgetSchemaTarget() {\n\t\treturn \"jsonSchema7\";\n\t}\n\tshouldApply() {\n\t\treturn this.getModel().provider.includes(\"google\") || this.getModel().modelId.includes(\"gemini-\") || this.getModel().modelId.includes(\"google\");\n\t}\n\tprocessZodType(value) {\n\t\tif (isOptional$1(z$1)(value)) return this.defaultZodOptionalHandler(value, [\n\t\t\t\"ZodObject\",\n\t\t\t\"ZodArray\",\n\t\t\t\"ZodUnion\",\n\t\t\t\"ZodString\",\n\t\t\t\"ZodNumber\",\n\t\t\t\"ZodNullable\"\n\t\t]);\n\t\telse if (isNullable(z$1)(value)) return this.defaultZodNullableHandler(value);\n\t\telse if (isNull(z$1)(value)) return z$1.any().refine((v) => v === null, { message: \"must be null\" }).describe(value.description || \"must be null\");\n\t\telse if (isObj$1(z$1)(value)) return this.defaultZodObjectHandler(value);\n\t\telse if (isArr$1(z$1)(value)) return this.defaultZodArrayHandler(value, []);\n\t\telse if (isUnion$1(z$1)(value)) return this.defaultZodUnionHandler(value);\n\t\telse if (isString$1(z$1)(value)) return this.defaultZodStringHandler(value);\n\t\telse if (isNumber$1(z$1)(value)) return this.defaultZodNumberHandler(value);\n\t\telse if (isIntersection(z$1)(value)) return this.defaultZodIntersectionHandler(value);\n\t\treturn this.defaultUnsupportedZodTypeHandler(value);\n\t}\n\tprocessToJSONSchema(schema, io) {\n\t\tconst result = super.processToJSONSchema(schema, io);\n\t\tinlineRefsAndDropDefinitions(result);\n\t\treturn result;\n\t}\n\tprocessToAISDKSchema(zodSchema) {\n\t\tconst fixedJsonSchema = fixAISDKNullableUnionTypes(standardSchemaToJSONSchema(this.processToCompatSchema(zodSchema)));\n\t\treturn jsonSchema(fixedJsonSchema, { validate: (value) => {\n\t\t\tconst transformed = this.#traverse(value, fixedJsonSchema);\n\t\t\tconst result = zodSchema.safeParse(transformed);\n\t\t\treturn result.success ? {\n\t\t\t\tsuccess: true,\n\t\t\t\tvalue: result.data\n\t\t\t} : {\n\t\t\t\tsuccess: false,\n\t\t\t\terror: result.error\n\t\t\t};\n\t\t} });\n\t}\n\tprocessToCompatSchema(schema) {\n\t\tconst originalStandardSchema = toStandardSchema(schema);\n\t\treturn { \"~standard\": {\n\t\t\tversion: 1,\n\t\t\tvendor: \"mastra\",\n\t\t\tvalidate: (value) => {\n\t\t\t\tconst transformedJsonSchema = this.processToJSONSchema(schema, \"input\");\n\t\t\t\tconst transformed = this.#traverse(value, transformedJsonSchema);\n\t\t\t\treturn originalStandardSchema[\"~standard\"].validate(transformed);\n\t\t\t},\n\t\t\tjsonSchema: {\n\t\t\t\tinput: () => {\n\t\t\t\t\treturn this.processToJSONSchema(schema, \"input\");\n\t\t\t\t},\n\t\t\t\toutput: () => {\n\t\t\t\t\treturn this.processToJSONSchema(schema, \"output\");\n\t\t\t\t}\n\t\t\t}\n\t\t} };\n\t}\n\tpreProcessJSONNode(schema) {\n\t\tif (isAllOfSchema(schema)) this.defaultAllOfHandler(schema);\n\t\tif (isObjectSchema(schema)) this.defaultObjectHandler(schema);\n\t\telse if (isNumberSchema(schema)) this.defaultNumberHandler(schema);\n\t\telse if (isArraySchema(schema)) this.defaultArrayHandler(schema);\n\t\telse if (isStringSchema(schema)) this.defaultStringHandler(schema);\n\t}\n\tpostProcessJSONNode(schema) {\n\t\tif (isUnionSchema(schema)) this.defaultUnionHandler(schema);\n\t\tconst s = schema;\n\t\tdelete s[\"$schema\"];\n\t\tdelete s[\"additionalProperties\"];\n\t\tdelete s[\"propertyNames\"];\n\t\tif (Array.isArray(s[\"type\"])) {\n\t\t\tconst types = s[\"type\"];\n\t\t\tconst nonNull = types.filter((t) => t !== \"null\");\n\t\t\tconst hasNull = types.includes(\"null\");\n\t\t\tif (nonNull.length === 1) {\n\t\t\t\ts[\"type\"] = nonNull[0];\n\t\t\t\tif (hasNull) s[\"nullable\"] = true;\n\t\t\t} else if (nonNull.length === 0 && hasNull) {\n\t\t\t\ts[\"type\"] = \"object\";\n\t\t\t\ts[\"nullable\"] = true;\n\t\t\t} else {\n\t\t\t\tdelete s[\"type\"];\n\t\t\t\tdelete s[\"nullable\"];\n\t\t\t}\n\t\t}\n\t\tif (Array.isArray(s[\"oneOf\"])) {\n\t\t\ts[\"anyOf\"] = s[\"oneOf\"];\n\t\t\tdelete s[\"oneOf\"];\n\t\t}\n\t\tif (\"const\" in s) {\n\t\t\ts[\"enum\"] = [s[\"const\"]];\n\t\t\tdelete s[\"const\"];\n\t\t}\n\t\tif (Array.isArray(s[\"items\"])) {\n\t\t\ts[\"items\"] = { anyOf: s[\"items\"] };\n\t\t\tdelete s[\"minItems\"];\n\t\t\tdelete s[\"maxItems\"];\n\t\t}\n\t\tif (Array.isArray(s[\"anyOf\"])) {\n\t\t\tconst variants = s[\"anyOf\"];\n\t\t\tconst nonNull = variants.filter((v) => v && typeof v === \"object\" && v[\"type\"] !== \"null\");\n\t\t\tconst hasNull = variants.some((v) => v && typeof v === \"object\" && v[\"type\"] === \"null\");\n\t\t\tif (hasNull && nonNull.length === 1) {\n\t\t\t\tconst base = nonNull[0];\n\t\t\t\tdelete s[\"anyOf\"];\n\t\t\t\tObject.assign(s, base);\n\t\t\t\ts[\"nullable\"] = true;\n\t\t\t} else if (hasNull && nonNull.length > 1) {\n\t\t\t\ts[\"anyOf\"] = nonNull;\n\t\t\t\ts[\"nullable\"] = true;\n\t\t\t}\n\t\t}\n\t}\n\t#traverse(value, schema) {\n\t\tconst resolved = this.#resolveAnyOf(schema);\n\t\tif (resolved[\"x-date\"] === true && typeof value === \"string\") return new Date(value);\n\t\tif (resolved.type === \"array\" || Array.isArray(resolved.type) && resolved.type.includes(\"array\")) {\n\t\t\tif (!Array.isArray(value)) return value;\n\t\t\treturn value.map((item) => this.#traverse(item, resolved.items));\n\t\t}\n\t\tif (!(resolved.type === \"object\" || Array.isArray(resolved.type) && resolved.type.includes(\"object\"))) return value;\n\t\tconst properties = resolved.properties;\n\t\tif (!properties || !value) return value;\n\t\tconst obj = value;\n\t\tfor (const key in obj) if (properties[key]) obj[key] = this.#traverse(obj[key], properties[key]);\n\t\treturn obj;\n\t}\n\t#resolveAnyOf(schema) {\n\t\tif (Array.isArray(schema.anyOf)) {\n\t\t\tconst nonNull = schema.anyOf.find((s) => s.type !== \"null\");\n\t\t\tif (nonNull) return nonNull;\n\t\t}\n\t\treturn schema;\n\t}\n};\n//#endregion\n//#region src/provider-compats/meta.ts\nvar MetaSchemaCompatLayer = class extends SchemaCompatLayer {\n\tconstructor(model) {\n\t\tsuper(model);\n\t}\n\tgetSchemaTarget() {\n\t\treturn \"jsonSchema7\";\n\t}\n\tshouldApply() {\n\t\treturn this.getModel().modelId.includes(\"meta\");\n\t}\n\tprocessZodType(value) {\n\t\tif (isOptional$1(z$1)(value)) return this.defaultZodOptionalHandler(value, [\n\t\t\t\"ZodObject\",\n\t\t\t\"ZodArray\",\n\t\t\t\"ZodUnion\",\n\t\t\t\"ZodString\",\n\t\t\t\"ZodNumber\"\n\t\t]);\n\t\telse if (isObj$1(z$1)(value)) return this.defaultZodObjectHandler(value);\n\t\telse if (isArr$1(z$1)(value)) return this.defaultZodArrayHandler(value, [\"min\", \"max\"]);\n\t\telse if (isUnion$1(z$1)(value)) return this.defaultZodUnionHandler(value);\n\t\telse if (isNumber$1(z$1)(value)) return this.defaultZodNumberHandler(value);\n\t\telse if (isString$1(z$1)(value)) return this.defaultZodStringHandler(value);\n\t\telse if (isIntersection(z$1)(value)) return this.defaultZodIntersectionHandler(value);\n\t\treturn value;\n\t}\n\tprocessToAISDKSchema(zodSchema) {\n\t\tconst transformedJsonSchema = standardSchemaToJSONSchema(this.processToCompatSchema(zodSchema));\n\t\treturn jsonSchema(transformedJsonSchema, { validate: (value) => {\n\t\t\tconst transformed = this.#traverse(value, transformedJsonSchema);\n\t\t\tconst result = zodSchema.safeParse(transformed);\n\t\t\treturn result.success ? {\n\t\t\t\tsuccess: true,\n\t\t\t\tvalue: result.data\n\t\t\t} : {\n\t\t\t\tsuccess: false,\n\t\t\t\terror: result.error\n\t\t\t};\n\t\t} });\n\t}\n\tprocessToCompatSchema(schema) {\n\t\tconst originalStandardSchema = toStandardSchema(schema);\n\t\treturn { \"~standard\": {\n\t\t\tversion: 1,\n\t\t\tvendor: \"mastra\",\n\t\t\tvalidate: (value) => {\n\t\t\t\tconst transformedJsonSchema = this.processToJSONSchema(schema, \"input\");\n\t\t\t\tconst transformed = this.#traverse(value, transformedJsonSchema);\n\t\t\t\treturn originalStandardSchema[\"~standard\"].validate(transformed);\n\t\t\t},\n\t\t\tjsonSchema: {\n\t\t\t\tinput: () => {\n\t\t\t\t\treturn this.processToJSONSchema(schema, \"input\");\n\t\t\t\t},\n\t\t\t\toutput: () => {\n\t\t\t\t\treturn this.processToJSONSchema(schema, \"output\");\n\t\t\t\t}\n\t\t\t}\n\t\t} };\n\t}\n\tpreProcessJSONNode(schema) {\n\t\tif (isAllOfSchema(schema)) this.defaultAllOfHandler(schema);\n\t\tif (isObjectSchema(schema)) this.defaultObjectHandler(schema);\n\t\telse if (isArraySchema(schema)) this.defaultArrayHandler(schema);\n\t\telse if (isNumberSchema(schema)) this.defaultNumberHandler(schema);\n\t\telse if (isStringSchema(schema)) this.defaultStringHandler(schema);\n\t}\n\tpostProcessJSONNode(schema) {\n\t\tif (isUnionSchema(schema)) this.defaultUnionHandler(schema);\n\t}\n\t#traverse(value, schema) {\n\t\tconst resolved = this.#resolveAnyOf(schema);\n\t\tif (resolved[\"x-date\"] === true && typeof value === \"string\") return new Date(value);\n\t\tif (resolved.type === \"array\" || Array.isArray(resolved.type) && resolved.type.includes(\"array\")) {\n\t\t\tif (!Array.isArray(value)) return value;\n\t\t\treturn value.map((item) => this.#traverse(item, resolved.items));\n\t\t}\n\t\tif (!(resolved.type === \"object\" || Array.isArray(resolved.type) && resolved.type.includes(\"object\"))) return value;\n\t\tconst properties = resolved.properties;\n\t\tif (!properties || !value) return value;\n\t\tconst obj = value;\n\t\tfor (const key in obj) if (properties[key]) obj[key] = this.#traverse(obj[key], properties[key]);\n\t\treturn obj;\n\t}\n\t#resolveAnyOf(schema) {\n\t\tif (Array.isArray(schema.anyOf)) {\n\t\t\tconst nonNull = schema.anyOf.find((s) => s.type !== \"null\");\n\t\t\tif (nonNull) return nonNull;\n\t\t}\n\t\treturn schema;\n\t}\n};\n//#endregion\nexport { ALL_ARRAY_CHECKS, ALL_NUMBER_CHECKS, ALL_STRING_CHECKS, ALL_ZOD_TYPES, AnthropicSchemaCompatLayer, DeepSeekSchemaCompatLayer, GoogleSchemaCompatLayer, JSON_SCHEMA_LIBRARY_OPTIONS, MetaSchemaCompatLayer, OpenAIReasoningSchemaCompatLayer, OpenAISchemaCompatLayer, SUPPORTED_ZOD_TYPES, SchemaCompatLayer, SchemaCompatLayer$1 as SchemaCompatLayerV3, SchemaCompatLayer$2 as SchemaCompatLayerV4, UNSUPPORTED_ZOD_TYPES, applyCompatLayer, applyOpenAICompatToTools, applyOpenAICompatTransforms, convertSchemaToZod, convertZodSchemaToAISDKSchema, ensureAllPropertiesRequired, extractZodSchema, isArr, isNumber, isObj, isOptional, isStandardJSONSchema, isStandardSchema, isStandardSchemaWithJSON, isString, isUnion, isZodType, jsonSchema, prepareJsonSchemaForOpenAIStrictMode, standardSchemaToJSONSchema, toStandardSchema, wrapSchemaWithNullTransform };\n\n//# sourceMappingURL=index.js.map","import type { PublicSchema } from '@mastra/core/schema';\nimport { toStandardSchema } from '@mastra/core/schema';\nimport type { ApiRoute } from '@mastra/core/server';\nimport { zodToJsonSchema } from '@mastra/core/utils/zod-to-json';\nimport { standardSchemaToJSONSchema } from '@mastra/schema-compat';\nimport type { JSONSchema7 } from '@mastra/schema-compat';\nimport type { ServerRoute } from './routes';\n\ninterface RouteOpenAPIConfig {\n method: 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH';\n path: string;\n summary?: string;\n description?: string;\n tags?: string[];\n pathParamSchema?: PublicSchema<unknown>;\n queryParamSchema?: PublicSchema<unknown>;\n bodySchema?: PublicSchema<unknown>;\n responseSchema?: PublicSchema<unknown>;\n deprecated?: boolean;\n}\n\nexport interface OpenAPIRoute {\n summary?: string;\n description?: string;\n tags?: string[];\n deprecated?: boolean;\n requestParams?: {\n path?: PublicSchema<unknown>;\n query?: PublicSchema<unknown>;\n };\n requestBody?: {\n content: {\n 'application/json': {\n schema: PublicSchema<unknown>;\n };\n };\n };\n responses: {\n [statusCode: string]: {\n description: string;\n content?: {\n 'application/json': {\n schema: PublicSchema<unknown>;\n };\n };\n };\n };\n}\n\n/**\n * Generates OpenAPI specification for a single route\n * Extracts path parameters, query parameters, request body, and response schemas\n */\nexport function generateRouteOpenAPI({\n method,\n path,\n summary,\n description,\n tags = [],\n pathParamSchema,\n queryParamSchema,\n bodySchema,\n responseSchema,\n deprecated,\n}: RouteOpenAPIConfig): OpenAPIRoute {\n const route: OpenAPIRoute = {\n summary: summary || `${method} ${path}`,\n description,\n tags,\n deprecated,\n responses: {\n 200: {\n description: 'Successful response',\n },\n },\n };\n\n // Add path and query parameters\n if (pathParamSchema || queryParamSchema) {\n route.requestParams = {};\n\n if (pathParamSchema) {\n route.requestParams.path = pathParamSchema;\n }\n\n if (queryParamSchema) {\n route.requestParams.query = queryParamSchema;\n }\n }\n\n // Add request body with raw Zod schema\n if (bodySchema) {\n route.requestBody = {\n content: {\n 'application/json': {\n schema: bodySchema,\n },\n },\n };\n }\n\n // Add response schema with raw Zod schema\n if (responseSchema) {\n route.responses[200] = {\n description: 'Successful response',\n content: {\n 'application/json': {\n schema: responseSchema,\n },\n },\n };\n }\n\n return route;\n}\n\n/**\n * Helper to convert any PublicSchema to JSON Schema for OpenAPI\n */\nexport function schemaToJsonSchema(schema: PublicSchema<unknown>): JSONSchema7 {\n const standardSchema = toStandardSchema(schema);\n\n return standardSchemaToJSONSchema(standardSchema);\n}\n\n/**\n * Converts an OpenAPI route spec with PublicSchema to one with JSON Schema\n */\nfunction convertToJsonSchema(spec: OpenAPIRoute): any {\n const converted: any = {\n summary: spec.summary,\n description: spec.description,\n tags: spec.tags,\n responses: {},\n };\n\n const parameters: any[] = [];\n\n // Convert path parameters\n if (spec.requestParams?.path) {\n const pathSchema = schemaToJsonSchema(spec.requestParams.path) as any;\n const properties = pathSchema.properties || {};\n\n Object.entries(properties).forEach(([name, schema]) => {\n parameters.push({\n name,\n in: 'path',\n required: true,\n description: (schema as any).description || `The ${name} parameter`,\n schema,\n });\n });\n }\n\n // Convert query parameters\n if (spec.requestParams?.query) {\n const querySchema = schemaToJsonSchema(spec.requestParams.query) as any;\n const properties = querySchema.properties || {};\n const required = querySchema.required || [];\n\n Object.entries(properties).forEach(([name, schema]) => {\n parameters.push({\n name,\n in: 'query',\n required: required.includes(name),\n description: (schema as any).description || `Query parameter: ${name}`,\n schema,\n });\n });\n }\n\n if (parameters.length > 0) {\n converted.parameters = parameters;\n }\n\n // Convert request body\n if (spec.requestBody?.content?.['application/json']?.schema) {\n converted.requestBody = {\n required: true,\n content: {\n 'application/json': {\n schema: schemaToJsonSchema(spec.requestBody.content['application/json'].schema),\n },\n },\n };\n }\n\n // Convert response schemas\n Object.entries(spec.responses).forEach(([statusCode, response]) => {\n converted.responses[statusCode] = {\n description: response.description,\n };\n\n if (response.content?.['application/json']?.schema) {\n converted.responses[statusCode].content = {\n 'application/json': {\n schema: schemaToJsonSchema(response.content['application/json'].schema),\n },\n };\n }\n });\n\n return converted;\n}\n\n/**\n * Generates a complete OpenAPI 3.1.0 document from server routes\n * @param routes - Array of ServerRoute objects with OpenAPI specifications\n * @param info - API metadata (title, version, description)\n * @returns Complete OpenAPI 3.1.0 document\n */\nexport function generateOpenAPIDocument(\n routes: readonly ServerRoute[],\n info: { title: string; version: string; description?: string },\n): any {\n // Use a null-prototype map so that route paths like \"__proto__\" cannot\n // pollute Object.prototype via the assignment below.\n const paths: Record<string, any> = Object.create(null);\n\n // Build paths object from routes\n // Convert Express-style :param to OpenAPI-style {param}\n routes.forEach(route => {\n if (!route.openapi) return;\n\n const openapiPath = route.path.replace(/:(\\w+)/g, '{$1}');\n if (!paths[openapiPath]) {\n paths[openapiPath] = Object.create(null);\n }\n\n // Convert Zod schemas to JSON Schema\n paths[openapiPath][route.method.toLowerCase()] = convertToJsonSchema(route.openapi);\n });\n\n return {\n openapi: '3.1.0',\n info: {\n title: info.title,\n version: info.version,\n description: info.description,\n },\n paths,\n };\n}\n\n/**\n * Converts custom API routes with DescribeRouteOptions to OpenAPI path entries.\n * The DescribeRouteOptions from hono-openapi extends OpenAPIV3_1.OperationObject,\n * so it already has the standard OpenAPI structure (parameters, requestBody, responses, etc.).\n *\n * @param routes - Array of ApiRoute objects with optional openapi specifications\n * @returns OpenAPI paths object to be merged into the main spec\n */\nexport function convertCustomRoutesToOpenAPIPaths(routes: ApiRoute[]): Record<string, any> {\n const paths: Record<string, any> = {};\n\n for (const route of routes) {\n // Skip routes without openapi metadata or routes marked as hidden\n if (!route.openapi || route.openapi.hide) {\n continue;\n }\n\n // Skip routes with method 'ALL' as they don't map well to OpenAPI\n if (route.method === 'ALL') {\n continue;\n }\n\n // Convert Express-style :param to OpenAPI-style {param}\n const openapiPath = route.path.replace(/:(\\w+)/g, '{$1}');\n\n if (!paths[openapiPath]) {\n paths[openapiPath] = {};\n }\n\n const method = route.method.toLowerCase();\n const openapi = route.openapi;\n\n // Build the OpenAPI operation object from DescribeRouteOptions\n // DescribeRouteOptions extends OpenAPIV3_1.OperationObject, so it already has:\n // - summary, description, tags, deprecated, externalDocs, operationId\n // - parameters (array of OpenAPIV3_1.ParameterObject)\n // - requestBody (OpenAPIV3_1.RequestBodyObject)\n // - responses (OpenAPIV3_1.ResponsesObject)\n // - security, servers, callbacks\n const operation: Record<string, any> = {\n summary: openapi.summary || `${route.method} ${route.path}`,\n description: openapi.description,\n tags: openapi.tags || ['custom'],\n deprecated: openapi.deprecated,\n externalDocs: openapi.externalDocs,\n security: openapi.security,\n servers: openapi.servers,\n };\n\n // Copy parameters directly if provided (already in OpenAPI format)\n if (openapi.parameters && Array.isArray(openapi.parameters)) {\n operation.parameters = openapi.parameters.map((param: any) => {\n // Convert Zod schemas in parameter schemas if needed\n if (param.schema && typeof param.schema === 'object' && '_def' in param.schema) {\n return {\n ...param,\n schema: zodToJsonSchema(param.schema, 'openApi3', 'none'),\n };\n }\n return param;\n });\n }\n\n // Handle request body - convert Zod schemas if needed\n if (openapi.requestBody) {\n const requestBody = openapi.requestBody as any;\n operation.requestBody = { ...requestBody };\n\n // Convert Zod schemas in requestBody content\n if (requestBody.content) {\n operation.requestBody.content = {};\n for (const [mediaType, mediaContent] of Object.entries(requestBody.content as Record<string, any>)) {\n if (mediaContent?.schema && typeof mediaContent.schema === 'object' && '_def' in mediaContent.schema) {\n operation.requestBody.content[mediaType] = {\n ...mediaContent,\n schema: zodToJsonSchema(mediaContent.schema, 'openApi3', 'none'),\n };\n } else {\n operation.requestBody.content[mediaType] = mediaContent;\n }\n }\n }\n }\n\n // Handle responses - convert Zod schemas if needed\n if (openapi.responses) {\n operation.responses = {};\n for (const [statusCode, response] of Object.entries(openapi.responses as Record<string, any>)) {\n if (!response) continue;\n\n // Handle reference objects\n if ('$ref' in response) {\n operation.responses[statusCode] = response;\n continue;\n }\n\n operation.responses[statusCode] = { ...response };\n\n // Convert Zod schemas in response content\n if (response.content) {\n operation.responses[statusCode].content = {};\n for (const [mediaType, mediaContent] of Object.entries(response.content as Record<string, any>)) {\n if (mediaContent?.schema && typeof mediaContent.schema === 'object' && '_def' in mediaContent.schema) {\n operation.responses[statusCode].content[mediaType] = {\n ...mediaContent,\n schema: zodToJsonSchema(mediaContent.schema, 'openApi3', 'none'),\n };\n } else {\n operation.responses[statusCode].content[mediaType] = mediaContent;\n }\n }\n }\n }\n } else {\n // Provide default response if none specified\n operation.responses = {\n 200: {\n description: 'Successful response',\n },\n };\n }\n\n // Remove undefined values\n Object.keys(operation).forEach(key => {\n if (operation[key] === undefined) {\n delete operation[key];\n }\n });\n\n paths[openapiPath][method] = operation;\n }\n\n return paths;\n}\n","import type { FGARouteConfig, MastraFGAPermissionInput } from '@mastra/core/auth/ee';\nimport type { ValidationErrorHook } from '@mastra/core/server';\nimport type { ZodRawShape, ZodTypeAny } from 'zod/v4';\nimport { z, ZodObject, ZodOptional, ZodNullable, ZodArray, ZodRecord } from 'zod/v4';\nimport { generateRouteOpenAPI } from '../openapi-utils';\nimport type { InferParams, ResponseType, RouteSchemas, ServerRoute, ServerRouteHandler } from './index';\n\n/**\n * Extracts parameters matching a Zod schema's shape from a params object.\n * Useful for separating schema-defined params from ServerContext in handlers.\n *\n * @example\n * ```typescript\n * const querySchema = z.object({ page: z.number(), name: z.string() });\n *\n * handler: async (params) => {\n * const query = pickParams(querySchema, params);\n * // query is typed as { page: number, name: string }\n * }\n * ```\n */\nexport function pickParams<T extends z.ZodRawShape, P extends Record<string, unknown>>(\n schema: z.ZodObject<T>,\n params: P,\n): z.infer<z.ZodObject<T>> {\n const keys = Object.keys(schema.shape);\n const result = {} as z.infer<z.ZodObject<T>>;\n for (const key of keys) {\n if (key in params) {\n (result as any)[key] = params[key];\n }\n }\n return result;\n}\n\n/**\n * Wraps a Zod schema to accept either the expected type OR a JSON string.\n * Used for complex query parameters (arrays, objects) that are serialized as JSON in URLs.\n *\n * - If input is already the expected type, passes through to schema validation\n * - If input is a string, attempts JSON.parse then validates\n * - Provides clear error messages for JSON parse failures\n *\n * @example\n * ```typescript\n * const tagsSchema = jsonQueryParam(z.array(z.string()));\n * // Accepts: [\"tag1\", \"tag2\"] OR '[\"tag1\", \"tag2\"]'\n *\n * const dateRangeSchema = jsonQueryParam(z.object({ gte: z.coerce.date() }));\n * // Accepts: { gte: \"2024-01-01\" } OR '{\"gte\": \"2024-01-01\"}'\n * ```\n */\nexport function jsonQueryParam<T extends ZodTypeAny>(schema: T): z.ZodType<z.infer<T>> {\n return z.union([\n schema, // Already the expected type (non-string input)\n z.string().transform((val, ctx) => {\n try {\n const parsed = JSON.parse(val);\n const result = schema.safeParse(parsed);\n if (!result.success) {\n for (const issue of result.error.issues) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: issue.message,\n path: issue.path,\n });\n }\n return z.NEVER;\n }\n return result.data;\n } catch (e) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: `Invalid JSON: ${e instanceof Error ? e.message : 'parse error'}`,\n });\n return z.NEVER;\n }\n }),\n ]) as z.ZodType<z.infer<T>>;\n}\n\n/**\n * Checks if a Zod schema represents a complex type that needs JSON parsing from query strings.\n * Complex types: arrays, objects, records (these can't be represented as simple strings)\n * Simple types: strings, numbers, booleans, enums (can use z.coerce for conversion)\n */\nfunction isComplexType(schema: ZodTypeAny): boolean {\n // Unwrap all optional/nullable layers to check the inner type\n // Note: .partial() can create nested optionals (e.g., ZodOptional<ZodOptional<ZodObject>>)\n let inner: ZodTypeAny = schema;\n\n while (inner instanceof ZodOptional || inner instanceof ZodNullable) {\n inner = inner.unwrap() as ZodTypeAny;\n }\n\n // Complex types that need JSON parsing\n return inner instanceof ZodArray || inner instanceof ZodRecord || inner instanceof ZodObject;\n}\n\n/**\n * Wraps a Zod object schema for HTTP query parameter handling.\n * Automatically detects complex fields (arrays, objects, records) and wraps them\n * with jsonQueryParam() to accept JSON strings from query parameters.\n *\n * Simple fields (strings, numbers, booleans, enums) are left unchanged and should\n * use z.coerce for string-to-type conversion.\n *\n * @example\n * ```typescript\n * // Base schema (for internal/storage use)\n * const tracesFilterSchema = z.object({\n * tags: z.array(z.string()).optional(),\n * startedAt: dateRangeSchema.optional(),\n * perPage: z.coerce.number().optional(),\n * });\n *\n * // HTTP schema (accepts JSON strings for complex fields)\n * const httpTracesFilterSchema = wrapSchemaForQueryParams(tracesFilterSchema);\n *\n * // Now accepts:\n * // ?tags=[\"tag1\",\"tag2\"]&startedAt={\"gte\":\"2024-01-01\"}&perPage=10\n * ```\n */\nexport function wrapSchemaForQueryParams<T extends ZodRawShape>(schema: ZodObject<T>): ZodObject<ZodRawShape> {\n const newShape: Record<string, ZodTypeAny> = {};\n\n // schema.shape is Readonly in Zod v4, so we need to create a mutable copy\n const shape = schema.shape as unknown as Record<string, ZodTypeAny>;\n for (const [key, fieldSchema] of Object.entries(shape)) {\n if (isComplexType(fieldSchema)) {\n // Wrap complex types to accept JSON strings\n newShape[key] = jsonQueryParam(fieldSchema);\n } else {\n // Keep simple types as-is\n newShape[key] = fieldSchema;\n }\n }\n\n return z.object(newShape);\n}\n\ninterface RouteConfig<\n TPathSchema extends z.ZodTypeAny | undefined = undefined,\n TQuerySchema extends z.ZodTypeAny | undefined = undefined,\n TBodySchema extends z.ZodTypeAny | undefined = undefined,\n TResponseSchema extends z.ZodTypeAny | undefined = undefined,\n TResponseType extends ResponseType = 'json',\n TMethod extends string = string,\n TPath extends string = string,\n> {\n method: TMethod;\n path: TPath;\n responseType: TResponseType;\n streamFormat?: 'sse' | 'stream'; // Only used when responseType is 'stream'\n sseFlushOnConnect?: boolean;\n handler: ServerRouteHandler<\n InferParams<TPathSchema, TQuerySchema, TBodySchema>,\n TResponseSchema extends z.ZodTypeAny ? z.infer<TResponseSchema> : unknown,\n TResponseType\n >;\n pathParamSchema?: TPathSchema;\n queryParamSchema?: TQuerySchema;\n bodySchema?: TBodySchema;\n responseSchema?: TResponseSchema;\n summary?: string;\n description?: string;\n tags?: string[];\n deprecated?: boolean;\n maxBodySize?: number;\n requiresAuth?: boolean; // Explicit auth requirement for this route\n /**\n * Permission required to access this route (EE feature).\n * If set, the user must have this permission to access the route.\n * Uses the format: `resource:action` or `resource:action:resourceId`\n *\n * When an array is provided, the user needs ANY ONE of the listed permissions.\n */\n requiresPermission?: MastraFGAPermissionInput | MastraFGAPermissionInput[];\n /**\n * FGA authorization config for this route (EE feature).\n * If set, the user must have the specified permission on the resource.\n */\n fga?: FGARouteConfig;\n onValidationError?: ValidationErrorHook;\n}\n\n/**\n * Creates a server route with auto-generated OpenAPI specification and type-safe handler inference.\n *\n * ## Permission System\n *\n * Routes use a convention-based permission system. Permissions are automatically derived\n * from the route path and method using the format: `{resource}:{action}`\n *\n * - **resource**: First path segment (e.g., 'agents', 'workflows', 'memory')\n * - **action**: Derived from HTTP method:\n * - GET → 'read'\n * - POST → 'write' (or 'execute' for operation endpoints like /generate, /stream)\n * - PUT/PATCH → 'write'\n * - DELETE → 'delete'\n *\n * ### Examples:\n * - `GET /agents/:id` → `agents:read`\n * - `POST /agents/:id/generate` → `agents:execute`\n * - `DELETE /workflows/:id` → `workflows:delete`\n *\n * ### Overriding:\n * - Use `requiresPermission` to explicitly set a custom permission\n * - Use `createPublicRoute()` for routes that should bypass auth entirely\n *\n * The handler parameters are automatically inferred from the provided schemas:\n * - pathParamSchema: Infers path parameter types (e.g., :agentId)\n * - queryParamSchema: Infers query parameter types\n * - bodySchema: Infers request body types\n * - Runtime context (mastra, requestContext, tools, taskStore) is always available\n *\n * @param config - Route configuration including schemas, handler, and metadata\n * @returns Complete ServerRoute with OpenAPI spec\n *\n * @example\n * ```typescript\n * // Protected route (default) - permission auto-derived as 'agents:read'\n * export const getAgentRoute = createRoute({\n * method: 'GET',\n * path: '/agents/:agentId',\n * responseType: 'json',\n * pathParamSchema: z.object({ agentId: z.string() }),\n * responseSchema: serializedAgentSchema,\n * handler: async ({ agentId, mastra, requestContext }) => {\n * return mastra.getAgentById(agentId);\n * },\n * summary: 'Get agent by ID',\n * tags: ['Agents'],\n * });\n *\n * // Protected route with explicit permission override\n * export const adminRoute = createRoute({\n * method: 'POST',\n * path: '/agents/:agentId/admin-action',\n * responseType: 'json',\n * requiresPermission: 'agents:admin', // Override derived 'agents:write'\n * handler: async (ctx) => { ... },\n * });\n * ```\n */\nexport function createRoute<\n TPathSchema extends z.ZodTypeAny | undefined = undefined,\n TQuerySchema extends z.ZodTypeAny | undefined = undefined,\n TBodySchema extends z.ZodTypeAny | undefined = undefined,\n TResponseSchema extends z.ZodTypeAny | undefined = undefined,\n TResponseType extends ResponseType = 'json',\n TMethod extends string = string,\n TPath extends string = string,\n>(\n config: RouteConfig<TPathSchema, TQuerySchema, TBodySchema, TResponseSchema, TResponseType, TMethod, TPath>,\n): ServerRoute<\n InferParams<TPathSchema, TQuerySchema, TBodySchema>,\n TResponseSchema extends z.ZodTypeAny ? z.infer<TResponseSchema> : unknown,\n TResponseType,\n RouteSchemas<TPathSchema, TQuerySchema, TBodySchema, TResponseSchema>,\n TMethod,\n TPath\n> {\n const { summary, description, tags, deprecated, requiresAuth, requiresPermission, onValidationError, ...baseRoute } =\n config;\n\n // Generate OpenAPI specification from the route config\n // Skip OpenAPI generation for 'ALL' method as it doesn't map to OpenAPI\n const openapi =\n config.method !== 'ALL'\n ? generateRouteOpenAPI({\n method: config.method as 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH',\n path: config.path,\n summary,\n description,\n tags,\n pathParamSchema: config.pathParamSchema,\n queryParamSchema: config.queryParamSchema,\n bodySchema: config.bodySchema,\n responseSchema: config.responseSchema,\n deprecated,\n })\n : undefined;\n\n return {\n ...baseRoute,\n openapi,\n deprecated,\n requiresAuth,\n requiresPermission,\n onValidationError,\n };\n}\n\n/**\n * Creates a public server route that bypasses authentication and authorization.\n *\n * Use this for routes that must be accessible without authentication, such as:\n * - Auth endpoints (login, logout, OAuth callbacks)\n * - Health checks\n * - Public API endpoints\n *\n * This is equivalent to calling `createRoute({ ...config, requiresAuth: false })`.\n *\n * @param config - Route configuration (same as createRoute, but requiresAuth is forced to false)\n * @returns Complete ServerRoute marked as public\n *\n * @example\n * ```typescript\n * // Public route - no authentication required\n * export const healthCheckRoute = createPublicRoute({\n * method: 'GET',\n * path: '/health',\n * responseType: 'json',\n * handler: async () => ({ status: 'ok' }),\n * summary: 'Health check',\n * tags: ['System'],\n * });\n *\n * // Auth callback - must be public for OAuth flow\n * export const ssoCallbackRoute = createPublicRoute({\n * method: 'GET',\n * path: '/auth/sso/callback',\n * responseType: 'datastream-response',\n * handler: async (ctx) => { ... },\n * summary: 'Handle SSO callback',\n * tags: ['Auth'],\n * });\n * ```\n */\nexport function createPublicRoute<\n TPathSchema extends z.ZodTypeAny | undefined = undefined,\n TQuerySchema extends z.ZodTypeAny | undefined = undefined,\n TBodySchema extends z.ZodTypeAny | undefined = undefined,\n TResponseSchema extends z.ZodTypeAny | undefined = undefined,\n TResponseType extends ResponseType = 'json',\n TMethod extends string = string,\n TPath extends string = string,\n>(\n config: Omit<\n RouteConfig<TPathSchema, TQuerySchema, TBodySchema, TResponseSchema, TResponseType, TMethod, TPath>,\n 'requiresAuth'\n >,\n): ServerRoute<\n InferParams<TPathSchema, TQuerySchema, TBodySchema>,\n TResponseSchema extends z.ZodTypeAny ? z.infer<TResponseSchema> : unknown,\n TResponseType,\n RouteSchemas<TPathSchema, TQuerySchema, TBodySchema, TResponseSchema>,\n TMethod,\n TPath\n> {\n return createRoute({\n ...config,\n requiresAuth: false,\n });\n}\n"],"x_google_ignoreList":[0],"mappings":";;;;;;;AAKA,IAAI,cAAc,MAAM;CACtB,MAAM,OAAO,QAAQ;EACnB,IAAI,CAAC,OAAO,MAAM;EAClB,MAAM,eAAe,MAAM,QAAQ,OAAO,IAAI,IAAI,OAAO,OAAO,CAAC,OAAO,IAAI;EAC5E,MAAM,UAAU,IAAI,IAAI,YAAY;EACpC,IAAI,CAAC,QAAQ,IAAI,QAAQ,GACvB,MAAM,SAAS;EAEjB,IAAI,CAAC,QAAQ,IAAI,QAAQ,KAAK,CAAC,QAAQ,IAAI,SAAS,GAClD,MAAM,SAAS;EAEjB,IAAI,CAAC,QAAQ,IAAI,SAAS,GACxB,MAAM,UAAU;EAElB,IAAI,CAAC,QAAQ,IAAI,MAAM,GACrB,MAAM,OAAO;EAEf,IAAI,CAAC,QAAQ,IAAI,OAAO,GACtB,MAAM,QAAQ;EAEhB,IAAI,CAAC,QAAQ,IAAI,QAAQ,GACvB,MAAM,SAAS;EAEjB,IAAI,QAAQ,IAAI,SAAS,KAAK,MAAM,WAAW,OAAO;GACpD,MAAM,gBAAgB,MAAM,UAAUA,OAAAA,EAAE,OAAO;GAC/C,IAAI,yBAAyBA,OAAAA,EAAE,WAC7B,MAAM,SAAS,cAAc,IAAI;EAErC;CACF;AACF;AAIA,IAAI,eAAe,MAAM;CACvB,MAAM,OAAO,QAAQ;EACnB,IAAI,OAAO,UAAU,KAAK,GAAG;EAC7B,MAAM,aAAa,OAAO;EAC1B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