@walkeros/server-destination-aws 0.2.0 → 0.2.1
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/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var e=Object.defineProperty,n=(n,t)=>{for(var o in t)e(n,o,{get:t[o],enumerable:!0})};function t(e){var n;return Boolean(e&&"object"==typeof e&&"AWS"in e&&(null==(n=e.AWS)?void 0:n.FirehoseClient))}function o(e,n){const{streamName:o,region:r="eu-central-1",config:i={}}=e;o||function(e){throw new Error(String(e))}("Firehose: Config custom streamName missing"),i.region||(i.region=r);let s=e.client;return!s&&t(n)&&(s=new n.AWS.FirehoseClient(i)),{streamName:o,client:s,region:r}}var r=async function(e,{config:n,collector:o,env:r}){const{firehose:i}=n.settings||{};i&&async function(e,n,o){const{client:r,streamName:i}=n;if(!r)return{queue:e};const s=e.map(({event:e})=>({Data:Buffer.from(JSON.stringify(e))}));if(t(o))await r.send(new o.AWS.PutRecordBatchCommand({DeliveryStreamName:i,Records:s}));else{const{PutRecordBatchCommand:e}=await import("@aws-sdk/client-firehose");await r.send(new e({DeliveryStreamName:i,Records:s}))}}([{event:e}],i,r)},i={},s={};n(s,{env:()=>c});var c={};n(c,{push:()=>a});var a={AWS:{FirehoseClient:class{constructor(e){this.config=e}async send(e){return{RecordId:"mock-record-id",ResponseMetadata:{RequestId:"mock-request-id"}}}},PutRecordBatchCommand:class{constructor(e){this.input=e}}}},f={type:"aws-firehose",config:{},async init({config:e,env:n}){const t=function(e={},n){const t=e.settings||{};return t.firehose&&(t.firehose=o(t.firehose,n)),{settings:t}}(e,n);return typeof t.settings==typeof{}&&t},push:async(e,{config:n,collector:t,env:o})=>await r(e,{config:n,collector:t,env:o})},u={};n(u,{firehose:()=>s});export{i as DestinationFirehose,f as destinationFirehose,u as examples};//# sourceMappingURL=index.mjs.map
|
|
1
|
+
var e,t,a,r=Object.defineProperty,n=(e,t)=>{for(var a in t)r(e,a,{get:t[a],enumerable:!0})},s={};n(s,{BRAND:()=>Le,DIRTY:()=>x,EMPTY_PATH:()=>g,INVALID:()=>k,NEVER:()=>$t,OK:()=>Z,ParseStatus:()=>b,Schema:()=>C,ZodAny:()=>ue,ZodArray:()=>me,ZodBigInt:()=>ne,ZodBoolean:()=>se,ZodBranded:()=>ze,ZodCatch:()=>Me,ZodDate:()=>ie,ZodDefault:()=>Re,ZodDiscriminatedUnion:()=>_e,ZodEffects:()=>$e,ZodEnum:()=>Ne,ZodError:()=>u,ZodFirstPartyTypeKind:()=>Ke,ZodFunction:()=>Te,ZodIntersection:()=>ke,ZodIssueCode:()=>d,ZodLazy:()=>Se,ZodLiteral:()=>Oe,ZodMap:()=>we,ZodNaN:()=>Fe,ZodNativeEnum:()=>je,ZodNever:()=>pe,ZodNull:()=>ce,ZodNullable:()=>Ee,ZodNumber:()=>re,ZodObject:()=>ge,ZodOptional:()=>Ie,ZodParsedType:()=>i,ZodPipeline:()=>De,ZodPromise:()=>Ce,ZodReadonly:()=>Ve,ZodRecord:()=>Ze,ZodSchema:()=>C,ZodSet:()=>Ae,ZodString:()=>te,ZodSymbol:()=>oe,ZodTransformer:()=>$e,ZodTuple:()=>xe,ZodType:()=>C,ZodUndefined:()=>de,ZodUnion:()=>ye,ZodUnknown:()=>le,ZodVoid:()=>he,addIssueToContext:()=>y,any:()=>nt,array:()=>dt,bigint:()=>Xe,boolean:()=>Qe,coerce:()=>Ct,custom:()=>Be,date:()=>et,datetimeRegex:()=>G,defaultErrorMap:()=>l,discriminatedUnion:()=>pt,effect:()=>wt,enum:()=>kt,function:()=>vt,getErrorMap:()=>m,getParsedType:()=>o,instanceof:()=>Je,intersection:()=>ht,isAborted:()=>w,isAsync:()=>S,isDirty:()=>A,isValid:()=>T,late:()=>qe,lazy:()=>_t,literal:()=>bt,makeIssue:()=>f,map:()=>gt,nan:()=>Ge,nativeEnum:()=>xt,never:()=>it,null:()=>rt,nullable:()=>Tt,number:()=>Ye,object:()=>ct,objectUtil:()=>a,oboolean:()=>jt,onumber:()=>Nt,optional:()=>At,ostring:()=>Pt,pipeline:()=>Ot,preprocess:()=>St,promise:()=>Zt,quotelessJson:()=>c,record:()=>ft,set:()=>yt,setErrorMap:()=>h,strictObject:()=>ut,string:()=>He,symbol:()=>tt,transformer:()=>wt,tuple:()=>mt,undefined:()=>at,union:()=>lt,unknown:()=>st,util:()=>e,void:()=>ot}),(t=e||(e={})).assertEqual=e=>{},t.assertIs=function(e){},t.assertNever=function(e){throw new Error},t.arrayToEnum=e=>{const t={};for(const a of e)t[a]=a;return t},t.getValidEnumValues=e=>{const a=t.objectKeys(e).filter(t=>"number"!=typeof e[e[t]]),r={};for(const t of a)r[t]=e[t];return t.objectValues(r)},t.objectValues=e=>t.objectKeys(e).map(function(t){return e[t]}),t.objectKeys="function"==typeof Object.keys?e=>Object.keys(e):e=>{const t=[];for(const a in e)Object.prototype.hasOwnProperty.call(e,a)&&t.push(a);return t},t.find=(e,t)=>{for(const a of e)if(t(a))return a},t.isInteger="function"==typeof Number.isInteger?e=>Number.isInteger(e):e=>"number"==typeof e&&Number.isFinite(e)&&Math.floor(e)===e,t.joinValues=function(e,t=" | "){return e.map(e=>"string"==typeof e?`'${e}'`:e).join(t)},t.jsonStringifyReplacer=(e,t)=>"bigint"==typeof t?t.toString():t,(a||(a={})).mergeShapes=(e,t)=>({...e,...t});var i=e.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),o=e=>{switch(typeof e){case"undefined":return i.undefined;case"string":return i.string;case"number":return Number.isNaN(e)?i.nan:i.number;case"boolean":return i.boolean;case"function":return i.function;case"bigint":return i.bigint;case"symbol":return i.symbol;case"object":return Array.isArray(e)?i.array:null===e?i.null:e.then&&"function"==typeof e.then&&e.catch&&"function"==typeof e.catch?i.promise:"undefined"!=typeof Map&&e instanceof Map?i.map:"undefined"!=typeof Set&&e instanceof Set?i.set:"undefined"!=typeof Date&&e instanceof Date?i.date:i.object;default:return i.unknown}},d=e.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),c=e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:"),u=class t extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=e=>{this.issues=[...this.issues,e]},this.addIssues=(e=[])=>{this.issues=[...this.issues,...e]};const t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}format(e){const t=e||function(e){return e.message},a={_errors:[]},r=e=>{for(const n of e.issues)if("invalid_union"===n.code)n.unionErrors.map(r);else if("invalid_return_type"===n.code)r(n.returnTypeError);else if("invalid_arguments"===n.code)r(n.argumentsError);else if(0===n.path.length)a._errors.push(t(n));else{let e=a,r=0;for(;r<n.path.length;){const a=n.path[r];r===n.path.length-1?(e[a]=e[a]||{_errors:[]},e[a]._errors.push(t(n))):e[a]=e[a]||{_errors:[]},e=e[a],r++}}};return r(this),a}static assert(e){if(!(e instanceof t))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,e.jsonStringifyReplacer,2)}get isEmpty(){return 0===this.issues.length}flatten(e=e=>e.message){const t={},a=[];for(const r of this.issues)if(r.path.length>0){const a=r.path[0];t[a]=t[a]||[],t[a].push(e(r))}else a.push(e(r));return{formErrors:a,fieldErrors:t}}get formErrors(){return this.flatten()}};u.create=e=>new u(e);var l=(t,a)=>{let r;switch(t.code){case d.invalid_type:r=t.received===i.undefined?"Required":`Expected ${t.expected}, received ${t.received}`;break;case d.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(t.expected,e.jsonStringifyReplacer)}`;break;case d.unrecognized_keys:r=`Unrecognized key(s) in object: ${e.joinValues(t.keys,", ")}`;break;case d.invalid_union:r="Invalid input";break;case d.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${e.joinValues(t.options)}`;break;case d.invalid_enum_value:r=`Invalid enum value. Expected ${e.joinValues(t.options)}, received '${t.received}'`;break;case d.invalid_arguments:r="Invalid function arguments";break;case d.invalid_return_type:r="Invalid function return type";break;case d.invalid_date:r="Invalid date";break;case d.invalid_string:"object"==typeof t.validation?"includes"in t.validation?(r=`Invalid input: must include "${t.validation.includes}"`,"number"==typeof t.validation.position&&(r=`${r} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?r=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?r=`Invalid input: must end with "${t.validation.endsWith}"`:e.assertNever(t.validation):r="regex"!==t.validation?`Invalid ${t.validation}`:"Invalid";break;case d.too_small:r="array"===t.type?`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:"string"===t.type?`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:"number"===t.type||"bigint"===t.type?`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:"date"===t.type?`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:"Invalid input";break;case d.too_big:r="array"===t.type?`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:"string"===t.type?`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:"number"===t.type?`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:"bigint"===t.type?`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:"date"===t.type?`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:"Invalid input";break;case d.custom:r="Invalid input";break;case d.invalid_intersection_types:r="Intersection results could not be merged";break;case d.not_multiple_of:r=`Number must be a multiple of ${t.multipleOf}`;break;case d.not_finite:r="Number must be finite";break;default:r=a.defaultError,e.assertNever(t)}return{message:r}},p=l;function h(e){p=e}function m(){return p}var f=e=>{const{data:t,path:a,errorMaps:r,issueData:n}=e,s=[...a,...n.path||[]],i={...n,path:s};if(void 0!==n.message)return{...n,path:s,message:n.message};let o="";const d=r.filter(e=>!!e).slice().reverse();for(const e of d)o=e(i,{data:t,defaultError:o}).message;return{...n,path:s,message:o}},g=[];function y(e,t){const a=m(),r=f({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,a,a===l?void 0:l].filter(e=>!!e)});e.common.issues.push(r)}var v,_,b=class e{constructor(){this.value="valid"}dirty(){"valid"===this.value&&(this.value="dirty")}abort(){"aborted"!==this.value&&(this.value="aborted")}static mergeArray(e,t){const a=[];for(const r of t){if("aborted"===r.status)return k;"dirty"===r.status&&e.dirty(),a.push(r.value)}return{status:e.value,value:a}}static async mergeObjectAsync(t,a){const r=[];for(const e of a){const t=await e.key,a=await e.value;r.push({key:t,value:a})}return e.mergeObjectSync(t,r)}static mergeObjectSync(e,t){const a={};for(const r of t){const{key:t,value:n}=r;if("aborted"===t.status)return k;if("aborted"===n.status)return k;"dirty"===t.status&&e.dirty(),"dirty"===n.status&&e.dirty(),"__proto__"===t.value||void 0===n.value&&!r.alwaysSet||(a[t.value]=n.value)}return{status:e.value,value:a}}},k=Object.freeze({status:"aborted"}),x=e=>({status:"dirty",value:e}),Z=e=>({status:"valid",value:e}),w=e=>"aborted"===e.status,A=e=>"dirty"===e.status,T=e=>"valid"===e.status,S=e=>"undefined"!=typeof Promise&&e instanceof Promise;(_=v||(v={})).errToObj=e=>"string"==typeof e?{message:e}:e||{},_.toString=e=>"string"==typeof e?e:null==e?void 0:e.message;var O=class{constructor(e,t,a,r){this._cachedPath=[],this.parent=e,this.data=t,this._path=a,this._key=r}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},P=(e,t)=>{if(T(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const t=new u(e.common.issues);return this._error=t,this._error}}};function N(e){if(!e)return{};const{errorMap:t,invalid_type_error:a,required_error:r,description:n}=e;if(t&&(a||r))throw new Error('Can\'t use "invalid_type_error" or "required_error" in conjunction with custom error map.');if(t)return{errorMap:t,description:n};return{errorMap:(t,n)=>{var s,i;const{message:o}=e;return"invalid_enum_value"===t.code?{message:null!=o?o:n.defaultError}:void 0===n.data?{message:null!=(s=null!=o?o:r)?s:n.defaultError}:"invalid_type"!==t.code?{message:n.defaultError}:{message:null!=(i=null!=o?o:a)?i:n.defaultError}},description:n}}var j,C=class{get description(){return this._def.description}_getType(e){return o(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:o(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new b,ctx:{common:e.parent.common,data:e.data,parsedType:o(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(S(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){const t=this._parse(e);return Promise.resolve(t)}parse(e,t){const a=this.safeParse(e,t);if(a.success)return a.data;throw a.error}safeParse(e,t){var a;const r={common:{issues:[],async:null!=(a=null==t?void 0:t.async)&&a,contextualErrorMap:null==t?void 0:t.errorMap},path:(null==t?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:o(e)},n=this._parseSync({data:e,path:r.path,parent:r});return P(r,n)}"~validate"(e){var t,a;const r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:o(e)};if(!this["~standard"].async)try{const t=this._parseSync({data:e,path:[],parent:r});return T(t)?{value:t.value}:{issues:r.common.issues}}catch(e){(null==(a=null==(t=null==e?void 0:e.message)?void 0:t.toLowerCase())?void 0:a.includes("encountered"))&&(this["~standard"].async=!0),r.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:r}).then(e=>T(e)?{value:e.value}:{issues:r.common.issues})}async parseAsync(e,t){const a=await this.safeParseAsync(e,t);if(a.success)return a.data;throw a.error}async safeParseAsync(e,t){const a={common:{issues:[],contextualErrorMap:null==t?void 0:t.errorMap,async:!0},path:(null==t?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:o(e)},r=this._parse({data:e,path:a.path,parent:a}),n=await(S(r)?r:Promise.resolve(r));return P(a,n)}refine(e,t){const a=e=>"string"==typeof t||void 0===t?{message:t}:"function"==typeof t?t(e):t;return this._refinement((t,r)=>{const n=e(t),s=()=>r.addIssue({code:d.custom,...a(t)});return"undefined"!=typeof Promise&&n instanceof Promise?n.then(e=>!!e||(s(),!1)):!!n||(s(),!1)})}refinement(e,t){return this._refinement((a,r)=>!!e(a)||(r.addIssue("function"==typeof t?t(a,r):t),!1))}_refinement(e){return new $e({schema:this,typeName:Ke.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:e=>this["~validate"](e)}}optional(){return Ie.create(this,this._def)}nullable(){return Ee.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return me.create(this)}promise(){return Ce.create(this,this._def)}or(e){return ye.create([this,e],this._def)}and(e){return ke.create(this,e,this._def)}transform(e){return new $e({...N(this._def),schema:this,typeName:Ke.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t="function"==typeof e?e:()=>e;return new Re({...N(this._def),innerType:this,defaultValue:t,typeName:Ke.ZodDefault})}brand(){return new ze({typeName:Ke.ZodBranded,type:this,...N(this._def)})}catch(e){const t="function"==typeof e?e:()=>e;return new Me({...N(this._def),innerType:this,catchValue:t,typeName:Ke.ZodCatch})}describe(e){return new(0,this.constructor)({...this._def,description:e})}pipe(e){return De.create(this,e)}readonly(){return Ve.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},$=/^c[^\s-]{8,}$/i,I=/^[0-9a-z]+$/,E=/^[0-9A-HJKMNP-TV-Z]{26}$/i,R=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,M=/^[a-z0-9_-]{21}$/i,F=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,L=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,z=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,D=/^(?:(?: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])$/,V=/^(?:(?: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])$/,U=/^(([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]))$/,B=/^(([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])$/,K=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,W=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,q="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",J=new RegExp(`^${q}$`);function H(e){let t="[0-5]\\d";e.precision?t=`${t}\\.\\d{${e.precision}}`:null==e.precision&&(t=`${t}(\\.\\d+)?`);return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${e.precision?"+":"?"}`}function Y(e){return new RegExp(`^${H(e)}$`)}function G(e){let t=`${q}T${H(e)}`;const a=[];return a.push(e.local?"Z?":"Z"),e.offset&&a.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${a.join("|")})`,new RegExp(`^${t}$`)}function X(e,t){return!("v4"!==t&&t||!D.test(e))||!("v6"!==t&&t||!U.test(e))}function Q(e,t){if(!F.test(e))return!1;try{const[a]=e.split(".");if(!a)return!1;const r=a.replace(/-/g,"+").replace(/_/g,"/").padEnd(a.length+(4-a.length%4)%4,"="),n=JSON.parse(atob(r));return"object"==typeof n&&null!==n&&((!("typ"in n)||"JWT"===(null==n?void 0:n.typ))&&(!!n.alg&&(!t||n.alg===t)))}catch(e){return!1}}function ee(e,t){return!("v4"!==t&&t||!V.test(e))||!("v6"!==t&&t||!B.test(e))}var te=class t extends C{_parse(t){this._def.coerce&&(t.data=String(t.data));if(this._getType(t)!==i.string){const e=this._getOrReturnCtx(t);return y(e,{code:d.invalid_type,expected:i.string,received:e.parsedType}),k}const a=new b;let r;for(const n of this._def.checks)if("min"===n.kind)t.data.length<n.value&&(r=this._getOrReturnCtx(t,r),y(r,{code:d.too_small,minimum:n.value,type:"string",inclusive:!0,exact:!1,message:n.message}),a.dirty());else if("max"===n.kind)t.data.length>n.value&&(r=this._getOrReturnCtx(t,r),y(r,{code:d.too_big,maximum:n.value,type:"string",inclusive:!0,exact:!1,message:n.message}),a.dirty());else if("length"===n.kind){const e=t.data.length>n.value,s=t.data.length<n.value;(e||s)&&(r=this._getOrReturnCtx(t,r),e?y(r,{code:d.too_big,maximum:n.value,type:"string",inclusive:!0,exact:!0,message:n.message}):s&&y(r,{code:d.too_small,minimum:n.value,type:"string",inclusive:!0,exact:!0,message:n.message}),a.dirty())}else if("email"===n.kind)z.test(t.data)||(r=this._getOrReturnCtx(t,r),y(r,{validation:"email",code:d.invalid_string,message:n.message}),a.dirty());else if("emoji"===n.kind)j||(j=new RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),j.test(t.data)||(r=this._getOrReturnCtx(t,r),y(r,{validation:"emoji",code:d.invalid_string,message:n.message}),a.dirty());else if("uuid"===n.kind)R.test(t.data)||(r=this._getOrReturnCtx(t,r),y(r,{validation:"uuid",code:d.invalid_string,message:n.message}),a.dirty());else if("nanoid"===n.kind)M.test(t.data)||(r=this._getOrReturnCtx(t,r),y(r,{validation:"nanoid",code:d.invalid_string,message:n.message}),a.dirty());else if("cuid"===n.kind)$.test(t.data)||(r=this._getOrReturnCtx(t,r),y(r,{validation:"cuid",code:d.invalid_string,message:n.message}),a.dirty());else if("cuid2"===n.kind)I.test(t.data)||(r=this._getOrReturnCtx(t,r),y(r,{validation:"cuid2",code:d.invalid_string,message:n.message}),a.dirty());else if("ulid"===n.kind)E.test(t.data)||(r=this._getOrReturnCtx(t,r),y(r,{validation:"ulid",code:d.invalid_string,message:n.message}),a.dirty());else if("url"===n.kind)try{new URL(t.data)}catch(e){r=this._getOrReturnCtx(t,r),y(r,{validation:"url",code:d.invalid_string,message:n.message}),a.dirty()}else if("regex"===n.kind){n.regex.lastIndex=0;n.regex.test(t.data)||(r=this._getOrReturnCtx(t,r),y(r,{validation:"regex",code:d.invalid_string,message:n.message}),a.dirty())}else if("trim"===n.kind)t.data=t.data.trim();else if("includes"===n.kind)t.data.includes(n.value,n.position)||(r=this._getOrReturnCtx(t,r),y(r,{code:d.invalid_string,validation:{includes:n.value,position:n.position},message:n.message}),a.dirty());else if("toLowerCase"===n.kind)t.data=t.data.toLowerCase();else if("toUpperCase"===n.kind)t.data=t.data.toUpperCase();else if("startsWith"===n.kind)t.data.startsWith(n.value)||(r=this._getOrReturnCtx(t,r),y(r,{code:d.invalid_string,validation:{startsWith:n.value},message:n.message}),a.dirty());else if("endsWith"===n.kind)t.data.endsWith(n.value)||(r=this._getOrReturnCtx(t,r),y(r,{code:d.invalid_string,validation:{endsWith:n.value},message:n.message}),a.dirty());else if("datetime"===n.kind){G(n).test(t.data)||(r=this._getOrReturnCtx(t,r),y(r,{code:d.invalid_string,validation:"datetime",message:n.message}),a.dirty())}else if("date"===n.kind){J.test(t.data)||(r=this._getOrReturnCtx(t,r),y(r,{code:d.invalid_string,validation:"date",message:n.message}),a.dirty())}else if("time"===n.kind){Y(n).test(t.data)||(r=this._getOrReturnCtx(t,r),y(r,{code:d.invalid_string,validation:"time",message:n.message}),a.dirty())}else"duration"===n.kind?L.test(t.data)||(r=this._getOrReturnCtx(t,r),y(r,{validation:"duration",code:d.invalid_string,message:n.message}),a.dirty()):"ip"===n.kind?X(t.data,n.version)||(r=this._getOrReturnCtx(t,r),y(r,{validation:"ip",code:d.invalid_string,message:n.message}),a.dirty()):"jwt"===n.kind?Q(t.data,n.alg)||(r=this._getOrReturnCtx(t,r),y(r,{validation:"jwt",code:d.invalid_string,message:n.message}),a.dirty()):"cidr"===n.kind?ee(t.data,n.version)||(r=this._getOrReturnCtx(t,r),y(r,{validation:"cidr",code:d.invalid_string,message:n.message}),a.dirty()):"base64"===n.kind?K.test(t.data)||(r=this._getOrReturnCtx(t,r),y(r,{validation:"base64",code:d.invalid_string,message:n.message}),a.dirty()):"base64url"===n.kind?W.test(t.data)||(r=this._getOrReturnCtx(t,r),y(r,{validation:"base64url",code:d.invalid_string,message:n.message}),a.dirty()):e.assertNever(n);return{status:a.value,value:t.data}}_regex(e,t,a){return this.refinement(t=>e.test(t),{validation:t,code:d.invalid_string,...v.errToObj(a)})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...v.errToObj(e)})}url(e){return this._addCheck({kind:"url",...v.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...v.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...v.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...v.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...v.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...v.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...v.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...v.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...v.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...v.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...v.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...v.errToObj(e)})}datetime(e){var t,a;return"string"==typeof e?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:void 0===(null==e?void 0:e.precision)?null:null==e?void 0:e.precision,offset:null!=(t=null==e?void 0:e.offset)&&t,local:null!=(a=null==e?void 0:e.local)&&a,...v.errToObj(null==e?void 0:e.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return"string"==typeof e?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:void 0===(null==e?void 0:e.precision)?null:null==e?void 0:e.precision,...v.errToObj(null==e?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...v.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...v.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:null==t?void 0:t.position,...v.errToObj(null==t?void 0:t.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...v.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...v.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...v.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...v.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...v.errToObj(t)})}nonempty(e){return this.min(1,v.errToObj(e))}trim(){return new t({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>"datetime"===e.kind)}get isDate(){return!!this._def.checks.find(e=>"date"===e.kind)}get isTime(){return!!this._def.checks.find(e=>"time"===e.kind)}get isDuration(){return!!this._def.checks.find(e=>"duration"===e.kind)}get isEmail(){return!!this._def.checks.find(e=>"email"===e.kind)}get isURL(){return!!this._def.checks.find(e=>"url"===e.kind)}get isEmoji(){return!!this._def.checks.find(e=>"emoji"===e.kind)}get isUUID(){return!!this._def.checks.find(e=>"uuid"===e.kind)}get isNANOID(){return!!this._def.checks.find(e=>"nanoid"===e.kind)}get isCUID(){return!!this._def.checks.find(e=>"cuid"===e.kind)}get isCUID2(){return!!this._def.checks.find(e=>"cuid2"===e.kind)}get isULID(){return!!this._def.checks.find(e=>"ulid"===e.kind)}get isIP(){return!!this._def.checks.find(e=>"ip"===e.kind)}get isCIDR(){return!!this._def.checks.find(e=>"cidr"===e.kind)}get isBase64(){return!!this._def.checks.find(e=>"base64"===e.kind)}get isBase64url(){return!!this._def.checks.find(e=>"base64url"===e.kind)}get minLength(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}};function ae(e,t){const a=(e.toString().split(".")[1]||"").length,r=(t.toString().split(".")[1]||"").length,n=a>r?a:r;return Number.parseInt(e.toFixed(n).replace(".",""))%Number.parseInt(t.toFixed(n).replace(".",""))/10**n}te.create=e=>{var t;return new te({checks:[],typeName:Ke.ZodString,coerce:null!=(t=null==e?void 0:e.coerce)&&t,...N(e)})};var re=class t extends C{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(t){this._def.coerce&&(t.data=Number(t.data));if(this._getType(t)!==i.number){const e=this._getOrReturnCtx(t);return y(e,{code:d.invalid_type,expected:i.number,received:e.parsedType}),k}let a;const r=new b;for(const n of this._def.checks)if("int"===n.kind)e.isInteger(t.data)||(a=this._getOrReturnCtx(t,a),y(a,{code:d.invalid_type,expected:"integer",received:"float",message:n.message}),r.dirty());else if("min"===n.kind){(n.inclusive?t.data<n.value:t.data<=n.value)&&(a=this._getOrReturnCtx(t,a),y(a,{code:d.too_small,minimum:n.value,type:"number",inclusive:n.inclusive,exact:!1,message:n.message}),r.dirty())}else if("max"===n.kind){(n.inclusive?t.data>n.value:t.data>=n.value)&&(a=this._getOrReturnCtx(t,a),y(a,{code:d.too_big,maximum:n.value,type:"number",inclusive:n.inclusive,exact:!1,message:n.message}),r.dirty())}else"multipleOf"===n.kind?0!==ae(t.data,n.value)&&(a=this._getOrReturnCtx(t,a),y(a,{code:d.not_multiple_of,multipleOf:n.value,message:n.message}),r.dirty()):"finite"===n.kind?Number.isFinite(t.data)||(a=this._getOrReturnCtx(t,a),y(a,{code:d.not_finite,message:n.message}),r.dirty()):e.assertNever(n);return{status:r.value,value:t.data}}gte(e,t){return this.setLimit("min",e,!0,v.toString(t))}gt(e,t){return this.setLimit("min",e,!1,v.toString(t))}lte(e,t){return this.setLimit("max",e,!0,v.toString(t))}lt(e,t){return this.setLimit("max",e,!1,v.toString(t))}setLimit(e,a,r,n){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:a,inclusive:r,message:v.toString(n)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:v.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:v.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:v.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:v.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:v.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:v.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:v.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:v.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:v.toString(e)})}get minValue(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find(t=>"int"===t.kind||"multipleOf"===t.kind&&e.isInteger(t.value))}get isFinite(){let e=null,t=null;for(const a of this._def.checks){if("finite"===a.kind||"int"===a.kind||"multipleOf"===a.kind)return!0;"min"===a.kind?(null===t||a.value>t)&&(t=a.value):"max"===a.kind&&(null===e||a.value<e)&&(e=a.value)}return Number.isFinite(t)&&Number.isFinite(e)}};re.create=e=>new re({checks:[],typeName:Ke.ZodNumber,coerce:(null==e?void 0:e.coerce)||!1,...N(e)});var ne=class t extends C{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(t){if(this._def.coerce)try{t.data=BigInt(t.data)}catch(e){return this._getInvalidInput(t)}if(this._getType(t)!==i.bigint)return this._getInvalidInput(t);let a;const r=new b;for(const n of this._def.checks)if("min"===n.kind){(n.inclusive?t.data<n.value:t.data<=n.value)&&(a=this._getOrReturnCtx(t,a),y(a,{code:d.too_small,type:"bigint",minimum:n.value,inclusive:n.inclusive,message:n.message}),r.dirty())}else if("max"===n.kind){(n.inclusive?t.data>n.value:t.data>=n.value)&&(a=this._getOrReturnCtx(t,a),y(a,{code:d.too_big,type:"bigint",maximum:n.value,inclusive:n.inclusive,message:n.message}),r.dirty())}else"multipleOf"===n.kind?t.data%n.value!==BigInt(0)&&(a=this._getOrReturnCtx(t,a),y(a,{code:d.not_multiple_of,multipleOf:n.value,message:n.message}),r.dirty()):e.assertNever(n);return{status:r.value,value:t.data}}_getInvalidInput(e){const t=this._getOrReturnCtx(e);return y(t,{code:d.invalid_type,expected:i.bigint,received:t.parsedType}),k}gte(e,t){return this.setLimit("min",e,!0,v.toString(t))}gt(e,t){return this.setLimit("min",e,!1,v.toString(t))}lte(e,t){return this.setLimit("max",e,!0,v.toString(t))}lt(e,t){return this.setLimit("max",e,!1,v.toString(t))}setLimit(e,a,r,n){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:a,inclusive:r,message:v.toString(n)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:v.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:v.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:v.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:v.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:v.toString(t)})}get minValue(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}};ne.create=e=>{var t;return new ne({checks:[],typeName:Ke.ZodBigInt,coerce:null!=(t=null==e?void 0:e.coerce)&&t,...N(e)})};var se=class extends C{_parse(e){this._def.coerce&&(e.data=Boolean(e.data));if(this._getType(e)!==i.boolean){const t=this._getOrReturnCtx(e);return y(t,{code:d.invalid_type,expected:i.boolean,received:t.parsedType}),k}return Z(e.data)}};se.create=e=>new se({typeName:Ke.ZodBoolean,coerce:(null==e?void 0:e.coerce)||!1,...N(e)});var ie=class t extends C{_parse(t){this._def.coerce&&(t.data=new Date(t.data));if(this._getType(t)!==i.date){const e=this._getOrReturnCtx(t);return y(e,{code:d.invalid_type,expected:i.date,received:e.parsedType}),k}if(Number.isNaN(t.data.getTime())){return y(this._getOrReturnCtx(t),{code:d.invalid_date}),k}const a=new b;let r;for(const n of this._def.checks)"min"===n.kind?t.data.getTime()<n.value&&(r=this._getOrReturnCtx(t,r),y(r,{code:d.too_small,message:n.message,inclusive:!0,exact:!1,minimum:n.value,type:"date"}),a.dirty()):"max"===n.kind?t.data.getTime()>n.value&&(r=this._getOrReturnCtx(t,r),y(r,{code:d.too_big,message:n.message,inclusive:!0,exact:!1,maximum:n.value,type:"date"}),a.dirty()):e.assertNever(n);return{status:a.value,value:new Date(t.data.getTime())}}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:v.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:v.toString(t)})}get minDate(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return null!=e?new Date(e):null}get maxDate(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return null!=e?new Date(e):null}};ie.create=e=>new ie({checks:[],coerce:(null==e?void 0:e.coerce)||!1,typeName:Ke.ZodDate,...N(e)});var oe=class extends C{_parse(e){if(this._getType(e)!==i.symbol){const t=this._getOrReturnCtx(e);return y(t,{code:d.invalid_type,expected:i.symbol,received:t.parsedType}),k}return Z(e.data)}};oe.create=e=>new oe({typeName:Ke.ZodSymbol,...N(e)});var de=class extends C{_parse(e){if(this._getType(e)!==i.undefined){const t=this._getOrReturnCtx(e);return y(t,{code:d.invalid_type,expected:i.undefined,received:t.parsedType}),k}return Z(e.data)}};de.create=e=>new de({typeName:Ke.ZodUndefined,...N(e)});var ce=class extends C{_parse(e){if(this._getType(e)!==i.null){const t=this._getOrReturnCtx(e);return y(t,{code:d.invalid_type,expected:i.null,received:t.parsedType}),k}return Z(e.data)}};ce.create=e=>new ce({typeName:Ke.ZodNull,...N(e)});var ue=class extends C{constructor(){super(...arguments),this._any=!0}_parse(e){return Z(e.data)}};ue.create=e=>new ue({typeName:Ke.ZodAny,...N(e)});var le=class extends C{constructor(){super(...arguments),this._unknown=!0}_parse(e){return Z(e.data)}};le.create=e=>new le({typeName:Ke.ZodUnknown,...N(e)});var pe=class extends C{_parse(e){const t=this._getOrReturnCtx(e);return y(t,{code:d.invalid_type,expected:i.never,received:t.parsedType}),k}};pe.create=e=>new pe({typeName:Ke.ZodNever,...N(e)});var he=class extends C{_parse(e){if(this._getType(e)!==i.undefined){const t=this._getOrReturnCtx(e);return y(t,{code:d.invalid_type,expected:i.void,received:t.parsedType}),k}return Z(e.data)}};he.create=e=>new he({typeName:Ke.ZodVoid,...N(e)});var me=class e extends C{_parse(e){const{ctx:t,status:a}=this._processInputParams(e),r=this._def;if(t.parsedType!==i.array)return y(t,{code:d.invalid_type,expected:i.array,received:t.parsedType}),k;if(null!==r.exactLength){const e=t.data.length>r.exactLength.value,n=t.data.length<r.exactLength.value;(e||n)&&(y(t,{code:e?d.too_big:d.too_small,minimum:n?r.exactLength.value:void 0,maximum:e?r.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:r.exactLength.message}),a.dirty())}if(null!==r.minLength&&t.data.length<r.minLength.value&&(y(t,{code:d.too_small,minimum:r.minLength.value,type:"array",inclusive:!0,exact:!1,message:r.minLength.message}),a.dirty()),null!==r.maxLength&&t.data.length>r.maxLength.value&&(y(t,{code:d.too_big,maximum:r.maxLength.value,type:"array",inclusive:!0,exact:!1,message:r.maxLength.message}),a.dirty()),t.common.async)return Promise.all([...t.data].map((e,a)=>r.type._parseAsync(new O(t,e,t.path,a)))).then(e=>b.mergeArray(a,e));const n=[...t.data].map((e,a)=>r.type._parseSync(new O(t,e,t.path,a)));return b.mergeArray(a,n)}get element(){return this._def.type}min(t,a){return new e({...this._def,minLength:{value:t,message:v.toString(a)}})}max(t,a){return new e({...this._def,maxLength:{value:t,message:v.toString(a)}})}length(t,a){return new e({...this._def,exactLength:{value:t,message:v.toString(a)}})}nonempty(e){return this.min(1,e)}};function fe(e){if(e instanceof ge){const t={};for(const a in e.shape){const r=e.shape[a];t[a]=Ie.create(fe(r))}return new ge({...e._def,shape:()=>t})}return e instanceof me?new me({...e._def,type:fe(e.element)}):e instanceof Ie?Ie.create(fe(e.unwrap())):e instanceof Ee?Ee.create(fe(e.unwrap())):e instanceof xe?xe.create(e.items.map(e=>fe(e))):e}me.create=(e,t)=>new me({type:e,minLength:null,maxLength:null,exactLength:null,typeName:Ke.ZodArray,...N(t)});var ge=class t extends C{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(null!==this._cached)return this._cached;const t=this._def.shape(),a=e.objectKeys(t);return this._cached={shape:t,keys:a},this._cached}_parse(e){if(this._getType(e)!==i.object){const t=this._getOrReturnCtx(e);return y(t,{code:d.invalid_type,expected:i.object,received:t.parsedType}),k}const{status:t,ctx:a}=this._processInputParams(e),{shape:r,keys:n}=this._getCached(),s=[];if(!(this._def.catchall instanceof pe&&"strip"===this._def.unknownKeys))for(const e in a.data)n.includes(e)||s.push(e);const o=[];for(const e of n){const t=r[e],n=a.data[e];o.push({key:{status:"valid",value:e},value:t._parse(new O(a,n,a.path,e)),alwaysSet:e in a.data})}if(this._def.catchall instanceof pe){const e=this._def.unknownKeys;if("passthrough"===e)for(const e of s)o.push({key:{status:"valid",value:e},value:{status:"valid",value:a.data[e]}});else if("strict"===e)s.length>0&&(y(a,{code:d.unrecognized_keys,keys:s}),t.dirty());else if("strip"!==e)throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const e=this._def.catchall;for(const t of s){const r=a.data[t];o.push({key:{status:"valid",value:t},value:e._parse(new O(a,r,a.path,t)),alwaysSet:t in a.data})}}return a.common.async?Promise.resolve().then(async()=>{const e=[];for(const t of o){const a=await t.key,r=await t.value;e.push({key:a,value:r,alwaysSet:t.alwaysSet})}return e}).then(e=>b.mergeObjectSync(t,e)):b.mergeObjectSync(t,o)}get shape(){return this._def.shape()}strict(e){return v.errToObj,new t({...this._def,unknownKeys:"strict",...void 0!==e?{errorMap:(t,a)=>{var r,n,s,i;const o=null!=(s=null==(n=(r=this._def).errorMap)?void 0:n.call(r,t,a).message)?s:a.defaultError;return"unrecognized_keys"===t.code?{message:null!=(i=v.errToObj(e).message)?i:o}:{message:o}}}:{}})}strip(){return new t({...this._def,unknownKeys:"strip"})}passthrough(){return new t({...this._def,unknownKeys:"passthrough"})}extend(e){return new t({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new t({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:Ke.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new t({...this._def,catchall:e})}pick(a){const r={};for(const t of e.objectKeys(a))a[t]&&this.shape[t]&&(r[t]=this.shape[t]);return new t({...this._def,shape:()=>r})}omit(a){const r={};for(const t of e.objectKeys(this.shape))a[t]||(r[t]=this.shape[t]);return new t({...this._def,shape:()=>r})}deepPartial(){return fe(this)}partial(a){const r={};for(const t of e.objectKeys(this.shape)){const e=this.shape[t];a&&!a[t]?r[t]=e:r[t]=e.optional()}return new t({...this._def,shape:()=>r})}required(a){const r={};for(const t of e.objectKeys(this.shape))if(a&&!a[t])r[t]=this.shape[t];else{let e=this.shape[t];for(;e instanceof Ie;)e=e._def.innerType;r[t]=e}return new t({...this._def,shape:()=>r})}keyof(){return Pe(e.objectKeys(this.shape))}};ge.create=(e,t)=>new ge({shape:()=>e,unknownKeys:"strip",catchall:pe.create(),typeName:Ke.ZodObject,...N(t)}),ge.strictCreate=(e,t)=>new ge({shape:()=>e,unknownKeys:"strict",catchall:pe.create(),typeName:Ke.ZodObject,...N(t)}),ge.lazycreate=(e,t)=>new ge({shape:e,unknownKeys:"strip",catchall:pe.create(),typeName:Ke.ZodObject,...N(t)});var ye=class extends C{_parse(e){const{ctx:t}=this._processInputParams(e),a=this._def.options;if(t.common.async)return Promise.all(a.map(async e=>{const a={...t,common:{...t.common,issues:[]},parent:null};return{result:await e._parseAsync({data:t.data,path:t.path,parent:a}),ctx:a}})).then(function(e){for(const t of e)if("valid"===t.result.status)return t.result;for(const a of e)if("dirty"===a.result.status)return t.common.issues.push(...a.ctx.common.issues),a.result;const a=e.map(e=>new u(e.ctx.common.issues));return y(t,{code:d.invalid_union,unionErrors:a}),k});{let e;const r=[];for(const n of a){const a={...t,common:{...t.common,issues:[]},parent:null},s=n._parseSync({data:t.data,path:t.path,parent:a});if("valid"===s.status)return s;"dirty"!==s.status||e||(e={result:s,ctx:a}),a.common.issues.length&&r.push(a.common.issues)}if(e)return t.common.issues.push(...e.ctx.common.issues),e.result;const n=r.map(e=>new u(e));return y(t,{code:d.invalid_union,unionErrors:n}),k}}get options(){return this._def.options}};ye.create=(e,t)=>new ye({options:e,typeName:Ke.ZodUnion,...N(t)});var ve=t=>t instanceof Se?ve(t.schema):t instanceof $e?ve(t.innerType()):t instanceof Oe?[t.value]:t instanceof Ne?t.options:t instanceof je?e.objectValues(t.enum):t instanceof Re?ve(t._def.innerType):t instanceof de?[void 0]:t instanceof ce?[null]:t instanceof Ie?[void 0,...ve(t.unwrap())]:t instanceof Ee?[null,...ve(t.unwrap())]:t instanceof ze||t instanceof Ve?ve(t.unwrap()):t instanceof Me?ve(t._def.innerType):[],_e=class e extends C{_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==i.object)return y(t,{code:d.invalid_type,expected:i.object,received:t.parsedType}),k;const a=this.discriminator,r=t.data[a],n=this.optionsMap.get(r);return n?t.common.async?n._parseAsync({data:t.data,path:t.path,parent:t}):n._parseSync({data:t.data,path:t.path,parent:t}):(y(t,{code:d.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[a]}),k)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,a,r){const n=new Map;for(const e of a){const a=ve(e.shape[t]);if(!a.length)throw new Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(const r of a){if(n.has(r))throw new Error(`Discriminator property ${String(t)} has duplicate value ${String(r)}`);n.set(r,e)}}return new e({typeName:Ke.ZodDiscriminatedUnion,discriminator:t,options:a,optionsMap:n,...N(r)})}};function be(t,a){const r=o(t),n=o(a);if(t===a)return{valid:!0,data:t};if(r===i.object&&n===i.object){const r=e.objectKeys(a),n=e.objectKeys(t).filter(e=>-1!==r.indexOf(e)),s={...t,...a};for(const e of n){const r=be(t[e],a[e]);if(!r.valid)return{valid:!1};s[e]=r.data}return{valid:!0,data:s}}if(r===i.array&&n===i.array){if(t.length!==a.length)return{valid:!1};const e=[];for(let r=0;r<t.length;r++){const n=be(t[r],a[r]);if(!n.valid)return{valid:!1};e.push(n.data)}return{valid:!0,data:e}}return r===i.date&&n===i.date&&+t===+a?{valid:!0,data:t}:{valid:!1}}var ke=class extends C{_parse(e){const{status:t,ctx:a}=this._processInputParams(e),r=(e,r)=>{if(w(e)||w(r))return k;const n=be(e.value,r.value);return n.valid?((A(e)||A(r))&&t.dirty(),{status:t.value,value:n.data}):(y(a,{code:d.invalid_intersection_types}),k)};return a.common.async?Promise.all([this._def.left._parseAsync({data:a.data,path:a.path,parent:a}),this._def.right._parseAsync({data:a.data,path:a.path,parent:a})]).then(([e,t])=>r(e,t)):r(this._def.left._parseSync({data:a.data,path:a.path,parent:a}),this._def.right._parseSync({data:a.data,path:a.path,parent:a}))}};ke.create=(e,t,a)=>new ke({left:e,right:t,typeName:Ke.ZodIntersection,...N(a)});var xe=class e extends C{_parse(e){const{status:t,ctx:a}=this._processInputParams(e);if(a.parsedType!==i.array)return y(a,{code:d.invalid_type,expected:i.array,received:a.parsedType}),k;if(a.data.length<this._def.items.length)return y(a,{code:d.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),k;!this._def.rest&&a.data.length>this._def.items.length&&(y(a,{code:d.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());const r=[...a.data].map((e,t)=>{const r=this._def.items[t]||this._def.rest;return r?r._parse(new O(a,e,a.path,t)):null}).filter(e=>!!e);return a.common.async?Promise.all(r).then(e=>b.mergeArray(t,e)):b.mergeArray(t,r)}get items(){return this._def.items}rest(t){return new e({...this._def,rest:t})}};xe.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new xe({items:e,typeName:Ke.ZodTuple,rest:null,...N(t)})};var Ze=class e extends C{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:a}=this._processInputParams(e);if(a.parsedType!==i.object)return y(a,{code:d.invalid_type,expected:i.object,received:a.parsedType}),k;const r=[],n=this._def.keyType,s=this._def.valueType;for(const e in a.data)r.push({key:n._parse(new O(a,e,a.path,e)),value:s._parse(new O(a,a.data[e],a.path,e)),alwaysSet:e in a.data});return a.common.async?b.mergeObjectAsync(t,r):b.mergeObjectSync(t,r)}get element(){return this._def.valueType}static create(t,a,r){return new e(a instanceof C?{keyType:t,valueType:a,typeName:Ke.ZodRecord,...N(r)}:{keyType:te.create(),valueType:t,typeName:Ke.ZodRecord,...N(a)})}},we=class extends C{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:a}=this._processInputParams(e);if(a.parsedType!==i.map)return y(a,{code:d.invalid_type,expected:i.map,received:a.parsedType}),k;const r=this._def.keyType,n=this._def.valueType,s=[...a.data.entries()].map(([e,t],s)=>({key:r._parse(new O(a,e,a.path,[s,"key"])),value:n._parse(new O(a,t,a.path,[s,"value"]))}));if(a.common.async){const e=new Map;return Promise.resolve().then(async()=>{for(const a of s){const r=await a.key,n=await a.value;if("aborted"===r.status||"aborted"===n.status)return k;"dirty"!==r.status&&"dirty"!==n.status||t.dirty(),e.set(r.value,n.value)}return{status:t.value,value:e}})}{const e=new Map;for(const a of s){const r=a.key,n=a.value;if("aborted"===r.status||"aborted"===n.status)return k;"dirty"!==r.status&&"dirty"!==n.status||t.dirty(),e.set(r.value,n.value)}return{status:t.value,value:e}}}};we.create=(e,t,a)=>new we({valueType:t,keyType:e,typeName:Ke.ZodMap,...N(a)});var Ae=class e extends C{_parse(e){const{status:t,ctx:a}=this._processInputParams(e);if(a.parsedType!==i.set)return y(a,{code:d.invalid_type,expected:i.set,received:a.parsedType}),k;const r=this._def;null!==r.minSize&&a.data.size<r.minSize.value&&(y(a,{code:d.too_small,minimum:r.minSize.value,type:"set",inclusive:!0,exact:!1,message:r.minSize.message}),t.dirty()),null!==r.maxSize&&a.data.size>r.maxSize.value&&(y(a,{code:d.too_big,maximum:r.maxSize.value,type:"set",inclusive:!0,exact:!1,message:r.maxSize.message}),t.dirty());const n=this._def.valueType;function s(e){const a=new Set;for(const r of e){if("aborted"===r.status)return k;"dirty"===r.status&&t.dirty(),a.add(r.value)}return{status:t.value,value:a}}const o=[...a.data.values()].map((e,t)=>n._parse(new O(a,e,a.path,t)));return a.common.async?Promise.all(o).then(e=>s(e)):s(o)}min(t,a){return new e({...this._def,minSize:{value:t,message:v.toString(a)}})}max(t,a){return new e({...this._def,maxSize:{value:t,message:v.toString(a)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}};Ae.create=(e,t)=>new Ae({valueType:e,minSize:null,maxSize:null,typeName:Ke.ZodSet,...N(t)});var Te=class e extends C{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==i.function)return y(t,{code:d.invalid_type,expected:i.function,received:t.parsedType}),k;function a(e,a){return f({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,m(),l].filter(e=>!!e),issueData:{code:d.invalid_arguments,argumentsError:a}})}function r(e,a){return f({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,m(),l].filter(e=>!!e),issueData:{code:d.invalid_return_type,returnTypeError:a}})}const n={errorMap:t.common.contextualErrorMap},s=t.data;if(this._def.returns instanceof Ce){const e=this;return Z(async function(...t){const i=new u([]),o=await e._def.args.parseAsync(t,n).catch(e=>{throw i.addIssue(a(t,e)),i}),d=await Reflect.apply(s,this,o);return await e._def.returns._def.type.parseAsync(d,n).catch(e=>{throw i.addIssue(r(d,e)),i})})}{const e=this;return Z(function(...t){const i=e._def.args.safeParse(t,n);if(!i.success)throw new u([a(t,i.error)]);const o=Reflect.apply(s,this,i.data),d=e._def.returns.safeParse(o,n);if(!d.success)throw new u([r(o,d.error)]);return d.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new e({...this._def,args:xe.create(t).rest(le.create())})}returns(t){return new e({...this._def,returns:t})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(t,a,r){return new e({args:t||xe.create([]).rest(le.create()),returns:a||le.create(),typeName:Ke.ZodFunction,...N(r)})}},Se=class extends C{get schema(){return this._def.getter()}_parse(e){const{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}};Se.create=(e,t)=>new Se({getter:e,typeName:Ke.ZodLazy,...N(t)});var Oe=class extends C{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return y(t,{received:t.data,code:d.invalid_literal,expected:this._def.value}),k}return{status:"valid",value:e.data}}get value(){return this._def.value}};function Pe(e,t){return new Ne({values:e,typeName:Ke.ZodEnum,...N(t)})}Oe.create=(e,t)=>new Oe({value:e,typeName:Ke.ZodLiteral,...N(t)});var Ne=class t extends C{_parse(t){if("string"!=typeof t.data){const a=this._getOrReturnCtx(t),r=this._def.values;return y(a,{expected:e.joinValues(r),received:a.parsedType,code:d.invalid_type}),k}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(t.data)){const e=this._getOrReturnCtx(t),a=this._def.values;return y(e,{received:e.data,code:d.invalid_enum_value,options:a}),k}return Z(t.data)}get options(){return this._def.values}get enum(){const e={};for(const t of this._def.values)e[t]=t;return e}get Values(){const e={};for(const t of this._def.values)e[t]=t;return e}get Enum(){const e={};for(const t of this._def.values)e[t]=t;return e}extract(e,a=this._def){return t.create(e,{...this._def,...a})}exclude(e,a=this._def){return t.create(this.options.filter(t=>!e.includes(t)),{...this._def,...a})}};Ne.create=Pe;var je=class extends C{_parse(t){const a=e.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(t);if(r.parsedType!==i.string&&r.parsedType!==i.number){const t=e.objectValues(a);return y(r,{expected:e.joinValues(t),received:r.parsedType,code:d.invalid_type}),k}if(this._cache||(this._cache=new Set(e.getValidEnumValues(this._def.values))),!this._cache.has(t.data)){const t=e.objectValues(a);return y(r,{received:r.data,code:d.invalid_enum_value,options:t}),k}return Z(t.data)}get enum(){return this._def.values}};je.create=(e,t)=>new je({values:e,typeName:Ke.ZodNativeEnum,...N(t)});var Ce=class extends C{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==i.promise&&!1===t.common.async)return y(t,{code:d.invalid_type,expected:i.promise,received:t.parsedType}),k;const a=t.parsedType===i.promise?t.data:Promise.resolve(t.data);return Z(a.then(e=>this._def.type.parseAsync(e,{path:t.path,errorMap:t.common.contextualErrorMap})))}};Ce.create=(e,t)=>new Ce({type:e,typeName:Ke.ZodPromise,...N(t)});var $e=class extends C{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Ke.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){const{status:a,ctx:r}=this._processInputParams(t),n=this._def.effect||null,s={addIssue:e=>{y(r,e),e.fatal?a.abort():a.dirty()},get path(){return r.path}};if(s.addIssue=s.addIssue.bind(s),"preprocess"===n.type){const e=n.transform(r.data,s);if(r.common.async)return Promise.resolve(e).then(async e=>{if("aborted"===a.value)return k;const t=await this._def.schema._parseAsync({data:e,path:r.path,parent:r});return"aborted"===t.status?k:"dirty"===t.status||"dirty"===a.value?x(t.value):t});{if("aborted"===a.value)return k;const t=this._def.schema._parseSync({data:e,path:r.path,parent:r});return"aborted"===t.status?k:"dirty"===t.status||"dirty"===a.value?x(t.value):t}}if("refinement"===n.type){const e=e=>{const t=n.refinement(e,s);if(r.common.async)return Promise.resolve(t);if(t instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return e};if(!1===r.common.async){const t=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return"aborted"===t.status?k:("dirty"===t.status&&a.dirty(),e(t.value),{status:a.value,value:t.value})}return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(t=>"aborted"===t.status?k:("dirty"===t.status&&a.dirty(),e(t.value).then(()=>({status:a.value,value:t.value}))))}if("transform"===n.type){if(!1===r.common.async){const e=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!T(e))return k;const t=n.transform(e.value,s);if(t instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:a.value,value:t}}return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(e=>T(e)?Promise.resolve(n.transform(e.value,s)).then(e=>({status:a.value,value:e})):k)}e.assertNever(n)}};$e.create=(e,t,a)=>new $e({schema:e,typeName:Ke.ZodEffects,effect:t,...N(a)}),$e.createWithPreprocess=(e,t,a)=>new $e({schema:t,effect:{type:"preprocess",transform:e},typeName:Ke.ZodEffects,...N(a)});var Ie=class extends C{_parse(e){return this._getType(e)===i.undefined?Z(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Ie.create=(e,t)=>new Ie({innerType:e,typeName:Ke.ZodOptional,...N(t)});var Ee=class extends C{_parse(e){return this._getType(e)===i.null?Z(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Ee.create=(e,t)=>new Ee({innerType:e,typeName:Ke.ZodNullable,...N(t)});var Re=class extends C{_parse(e){const{ctx:t}=this._processInputParams(e);let a=t.data;return t.parsedType===i.undefined&&(a=this._def.defaultValue()),this._def.innerType._parse({data:a,path:t.path,parent:t})}removeDefault(){return this._def.innerType}};Re.create=(e,t)=>new Re({innerType:e,typeName:Ke.ZodDefault,defaultValue:"function"==typeof t.default?t.default:()=>t.default,...N(t)});var Me=class extends C{_parse(e){const{ctx:t}=this._processInputParams(e),a={...t,common:{...t.common,issues:[]}},r=this._def.innerType._parse({data:a.data,path:a.path,parent:{...a}});return S(r)?r.then(e=>({status:"valid",value:"valid"===e.status?e.value:this._def.catchValue({get error(){return new u(a.common.issues)},input:a.data})})):{status:"valid",value:"valid"===r.status?r.value:this._def.catchValue({get error(){return new u(a.common.issues)},input:a.data})}}removeCatch(){return this._def.innerType}};Me.create=(e,t)=>new Me({innerType:e,typeName:Ke.ZodCatch,catchValue:"function"==typeof t.catch?t.catch:()=>t.catch,...N(t)});var Fe=class extends C{_parse(e){if(this._getType(e)!==i.nan){const t=this._getOrReturnCtx(e);return y(t,{code:d.invalid_type,expected:i.nan,received:t.parsedType}),k}return{status:"valid",value:e.data}}};Fe.create=e=>new Fe({typeName:Ke.ZodNaN,...N(e)});var Le=Symbol("zod_brand"),ze=class extends C{_parse(e){const{ctx:t}=this._processInputParams(e),a=t.data;return this._def.type._parse({data:a,path:t.path,parent:t})}unwrap(){return this._def.type}},De=class e extends C{_parse(e){const{status:t,ctx:a}=this._processInputParams(e);if(a.common.async){return(async()=>{const e=await this._def.in._parseAsync({data:a.data,path:a.path,parent:a});return"aborted"===e.status?k:"dirty"===e.status?(t.dirty(),x(e.value)):this._def.out._parseAsync({data:e.value,path:a.path,parent:a})})()}{const e=this._def.in._parseSync({data:a.data,path:a.path,parent:a});return"aborted"===e.status?k:"dirty"===e.status?(t.dirty(),{status:"dirty",value:e.value}):this._def.out._parseSync({data:e.value,path:a.path,parent:a})}}static create(t,a){return new e({in:t,out:a,typeName:Ke.ZodPipeline})}},Ve=class extends C{_parse(e){const t=this._def.innerType._parse(e),a=e=>(T(e)&&(e.value=Object.freeze(e.value)),e);return S(t)?t.then(e=>a(e)):a(t)}unwrap(){return this._def.innerType}};function Ue(e,t){const a="function"==typeof e?e(t):"string"==typeof e?{message:e}:e;return"string"==typeof a?{message:a}:a}function Be(e,t={},a){return e?ue.create().superRefine((r,n)=>{var s,i;const o=e(r);if(o instanceof Promise)return o.then(e=>{var s,i;if(!e){const e=Ue(t,r),o=null==(i=null!=(s=e.fatal)?s:a)||i;n.addIssue({code:"custom",...e,fatal:o})}});if(!o){const e=Ue(t,r),o=null==(i=null!=(s=e.fatal)?s:a)||i;n.addIssue({code:"custom",...e,fatal:o})}}):ue.create()}Ve.create=(e,t)=>new Ve({innerType:e,typeName:Ke.ZodReadonly,...N(t)});var Ke,We,qe={object:ge.lazycreate};(We=Ke||(Ke={})).ZodString="ZodString",We.ZodNumber="ZodNumber",We.ZodNaN="ZodNaN",We.ZodBigInt="ZodBigInt",We.ZodBoolean="ZodBoolean",We.ZodDate="ZodDate",We.ZodSymbol="ZodSymbol",We.ZodUndefined="ZodUndefined",We.ZodNull="ZodNull",We.ZodAny="ZodAny",We.ZodUnknown="ZodUnknown",We.ZodNever="ZodNever",We.ZodVoid="ZodVoid",We.ZodArray="ZodArray",We.ZodObject="ZodObject",We.ZodUnion="ZodUnion",We.ZodDiscriminatedUnion="ZodDiscriminatedUnion",We.ZodIntersection="ZodIntersection",We.ZodTuple="ZodTuple",We.ZodRecord="ZodRecord",We.ZodMap="ZodMap",We.ZodSet="ZodSet",We.ZodFunction="ZodFunction",We.ZodLazy="ZodLazy",We.ZodLiteral="ZodLiteral",We.ZodEnum="ZodEnum",We.ZodEffects="ZodEffects",We.ZodNativeEnum="ZodNativeEnum",We.ZodOptional="ZodOptional",We.ZodNullable="ZodNullable",We.ZodDefault="ZodDefault",We.ZodCatch="ZodCatch",We.ZodPromise="ZodPromise",We.ZodBranded="ZodBranded",We.ZodPipeline="ZodPipeline",We.ZodReadonly="ZodReadonly";var Je=(e,t={message:`Input not instance of ${e.name}`})=>Be(t=>t instanceof e,t),He=te.create,Ye=re.create,Ge=Fe.create,Xe=ne.create,Qe=se.create,et=ie.create,tt=oe.create,at=de.create,rt=ce.create,nt=ue.create,st=le.create,it=pe.create,ot=he.create,dt=me.create,ct=ge.create,ut=ge.strictCreate,lt=ye.create,pt=_e.create,ht=ke.create,mt=xe.create,ft=Ze.create,gt=we.create,yt=Ae.create,vt=Te.create,_t=Se.create,bt=Oe.create,kt=Ne.create,xt=je.create,Zt=Ce.create,wt=$e.create,At=Ie.create,Tt=Ee.create,St=$e.createWithPreprocess,Ot=De.create,Pt=()=>He().optional(),Nt=()=>Ye().optional(),jt=()=>Qe().optional(),Ct={string:e=>te.create({...e,coerce:!0}),number:e=>re.create({...e,coerce:!0}),boolean:e=>se.create({...e,coerce:!0}),bigint:e=>ne.create({...e,coerce:!0}),date:e=>ie.create({...e,coerce:!0})},$t=k,It=Symbol("Let zodToJsonSchema decide on which parser to use"),Et={name:void 0,$refStrategy:"root",basePath:["#"],effectStrategy:"input",pipeStrategy:"all",dateStrategy:"format:date-time",mapStrategy:"entries",removeAdditionalStrategy:"passthrough",allowedAdditionalProperties:!0,rejectedAdditionalProperties:!1,definitionPath:"definitions",target:"jsonSchema7",strictUnions:!1,definitions:{},errorMessages:!1,markdownDescription:!1,patternStrategy:"escape",applyRegexFlags:!1,emailStrategy:"format:email",base64Strategy:"contentEncoding:base64",nameStrategy:"ref",openAiAnyTypeName:"OpenAiAnyType"},Rt=e=>{const t=(e=>"string"==typeof e?{...Et,name:e}:{...Et,...e})(e),a=void 0!==t.name?[...t.basePath,t.definitionPath,t.name]:t.basePath;return{...t,flags:{hasReferencedOpenAiAnyType:!1},currentPath:a,propertyPath:void 0,seen:new Map(Object.entries(t.definitions).map(([e,a])=>[a._def,{def:a._def,path:[...t.basePath,t.definitionPath,e],jsonSchema:void 0}]))}};function Mt(e,t,a,r){(null==r?void 0:r.errorMessages)&&a&&(e.errorMessage={...e.errorMessage,[t]:a})}function Ft(e,t,a,r,n){e[t]=a,Mt(e,t,r,n)}var Lt=(e,t)=>{let a=0;for(;a<e.length&&a<t.length&&e[a]===t[a];a++);return[(e.length-a).toString(),...t.slice(a)].join("/")};function zt(e){if("openAi"!==e.target)return{};const t=[...e.basePath,e.definitionPath,e.openAiAnyTypeName];return e.flags.hasReferencedOpenAiAnyType=!0,{$ref:"relative"===e.$refStrategy?Lt(t,e.currentPath):t.join("/")}}function Dt(e,t){return ma(e.type._def,t)}function Vt(e,t,a){const r=null!=a?a:t.dateStrategy;if(Array.isArray(r))return{anyOf:r.map((a,r)=>Vt(e,t,a))};switch(r){case"string":case"format:date-time":return{type:"string",format:"date-time"};case"format:date":return{type:"string",format:"date"};case"integer":return Ut(e,t)}}var Ut=(e,t)=>{const a={type:"integer",format:"unix-time"};if("openApi3"===t.target)return a;for(const r of e.checks)switch(r.kind){case"min":Ft(a,"minimum",r.value,r.message,t);break;case"max":Ft(a,"maximum",r.value,r.message,t)}return a};var Bt=void 0,Kt=/^[cC][^\s-]{8,}$/,Wt=/^[0-9a-z]+$/,qt=/^[0-9A-HJKMNP-TV-Z]{26}$/,Jt=/^(?!\.)(?!.*\.\.)([a-zA-Z0-9_'+\-\.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9\-]*\.)+[a-zA-Z]{2,}$/,Ht=()=>(void 0===Bt&&(Bt=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),Bt),Yt=/^(?:(?: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])$/,Gt=/^(([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])$/,Xt=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Qt=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,ea=/^[a-zA-Z0-9_-]{21}$/,ta=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/;function aa(e,t){const a={type:"string"};if(e.checks)for(const r of e.checks)switch(r.kind){case"min":Ft(a,"minLength","number"==typeof a.minLength?Math.max(a.minLength,r.value):r.value,r.message,t);break;case"max":Ft(a,"maxLength","number"==typeof a.maxLength?Math.min(a.maxLength,r.value):r.value,r.message,t);break;case"email":switch(t.emailStrategy){case"format:email":sa(a,"email",r.message,t);break;case"format:idn-email":sa(a,"idn-email",r.message,t);break;case"pattern:zod":ia(a,Jt,r.message,t)}break;case"url":sa(a,"uri",r.message,t);break;case"uuid":sa(a,"uuid",r.message,t);break;case"regex":ia(a,r.regex,r.message,t);break;case"cuid":ia(a,Kt,r.message,t);break;case"cuid2":ia(a,Wt,r.message,t);break;case"startsWith":ia(a,RegExp(`^${ra(r.value,t)}`),r.message,t);break;case"endsWith":ia(a,RegExp(`${ra(r.value,t)}$`),r.message,t);break;case"datetime":sa(a,"date-time",r.message,t);break;case"date":sa(a,"date",r.message,t);break;case"time":sa(a,"time",r.message,t);break;case"duration":sa(a,"duration",r.message,t);break;case"length":Ft(a,"minLength","number"==typeof a.minLength?Math.max(a.minLength,r.value):r.value,r.message,t),Ft(a,"maxLength","number"==typeof a.maxLength?Math.min(a.maxLength,r.value):r.value,r.message,t);break;case"includes":ia(a,RegExp(ra(r.value,t)),r.message,t);break;case"ip":"v6"!==r.version&&sa(a,"ipv4",r.message,t),"v4"!==r.version&&sa(a,"ipv6",r.message,t);break;case"base64url":ia(a,Qt,r.message,t);break;case"jwt":ia(a,ta,r.message,t);break;case"cidr":"v6"!==r.version&&ia(a,Yt,r.message,t),"v4"!==r.version&&ia(a,Gt,r.message,t);break;case"emoji":ia(a,Ht(),r.message,t);break;case"ulid":ia(a,qt,r.message,t);break;case"base64":switch(t.base64Strategy){case"format:binary":sa(a,"binary",r.message,t);break;case"contentEncoding:base64":Ft(a,"contentEncoding","base64",r.message,t);break;case"pattern:zod":ia(a,Xt,r.message,t)}break;case"nanoid":ia(a,ea,r.message,t)}return a}function ra(e,t){return"escape"===t.patternStrategy?function(e){let t="";for(let a=0;a<e.length;a++)na.has(e[a])||(t+="\\"),t+=e[a];return t}(e):e}var na=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function sa(e,t,a,r){var n;e.format||(null==(n=e.anyOf)?void 0:n.some(e=>e.format))?(e.anyOf||(e.anyOf=[]),e.format&&(e.anyOf.push({format:e.format,...e.errorMessage&&r.errorMessages&&{errorMessage:{format:e.errorMessage.format}}}),delete e.format,e.errorMessage&&(delete e.errorMessage.format,0===Object.keys(e.errorMessage).length&&delete e.errorMessage)),e.anyOf.push({format:t,...a&&r.errorMessages&&{errorMessage:{format:a}}})):Ft(e,"format",t,a,r)}function ia(e,t,a,r){var n;e.pattern||(null==(n=e.allOf)?void 0:n.some(e=>e.pattern))?(e.allOf||(e.allOf=[]),e.pattern&&(e.allOf.push({pattern:e.pattern,...e.errorMessage&&r.errorMessages&&{errorMessage:{pattern:e.errorMessage.pattern}}}),delete e.pattern,e.errorMessage&&(delete e.errorMessage.pattern,0===Object.keys(e.errorMessage).length&&delete e.errorMessage)),e.allOf.push({pattern:oa(t,r),...a&&r.errorMessages&&{errorMessage:{pattern:a}}})):Ft(e,"pattern",oa(t,r),a,r)}function oa(e,t){var a;if(!t.applyRegexFlags||!e.flags)return e.source;const r=e.flags.includes("i"),n=e.flags.includes("m"),s=e.flags.includes("s"),i=r?e.source.toLowerCase():e.source;let o="",d=!1,c=!1,u=!1;for(let e=0;e<i.length;e++)if(d)o+=i[e],d=!1;else{if(r)if(c){if(i[e].match(/[a-z]/)){u?(o+=i[e],o+=`${i[e-2]}-${i[e]}`.toUpperCase(),u=!1):"-"===i[e+1]&&(null==(a=i[e+2])?void 0:a.match(/[a-z]/))?(o+=i[e],u=!0):o+=`${i[e]}${i[e].toUpperCase()}`;continue}}else if(i[e].match(/[a-z]/)){o+=`[${i[e]}${i[e].toUpperCase()}]`;continue}if(n){if("^"===i[e]){o+="(^|(?<=[\r\n]))";continue}if("$"===i[e]){o+="($|(?=[\r\n]))";continue}}s&&"."===i[e]?o+=c?`${i[e]}\r\n`:`[${i[e]}\r\n]`:(o+=i[e],"\\"===i[e]?d=!0:c&&"]"===i[e]?c=!1:c||"["!==i[e]||(c=!0))}try{new RegExp(o)}catch(a){return console.warn(`Could not convert regex pattern at ${t.currentPath.join("/")} to a flag-independent form! Falling back to the flag-ignorant source`),e.source}return o}function da(e,t){var a,r,n,s,i,o,d;if("openAi"===t.target&&console.warn("Warning: OpenAI may not support records in schemas! Try an array of key-value pairs instead."),"openApi3"===t.target&&(null==(a=e.keyType)?void 0:a._def.typeName)===Ke.ZodEnum)return{type:"object",required:e.keyType._def.values,properties:e.keyType._def.values.reduce((a,r)=>{var n;return{...a,[r]:null!=(n=ma(e.valueType._def,{...t,currentPath:[...t.currentPath,"properties",r]}))?n:zt(t)}},{}),additionalProperties:t.rejectedAdditionalProperties};const c={type:"object",additionalProperties:null!=(r=ma(e.valueType._def,{...t,currentPath:[...t.currentPath,"additionalProperties"]}))?r:t.allowedAdditionalProperties};if("openApi3"===t.target)return c;if((null==(n=e.keyType)?void 0:n._def.typeName)===Ke.ZodString&&(null==(s=e.keyType._def.checks)?void 0:s.length)){const{type:a,...r}=aa(e.keyType._def,t);return{...c,propertyNames:r}}if((null==(i=e.keyType)?void 0:i._def.typeName)===Ke.ZodEnum)return{...c,propertyNames:{enum:e.keyType._def.values}};if((null==(o=e.keyType)?void 0:o._def.typeName)===Ke.ZodBranded&&e.keyType._def.type._def.typeName===Ke.ZodString&&(null==(d=e.keyType._def.type._def.checks)?void 0:d.length)){const{type:a,...r}=Dt(e.keyType._def,t);return{...c,propertyNames:r}}return c}var ca={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};var ua=(e,t)=>{const a=(e.options instanceof Map?Array.from(e.options.values()):e.options).map((e,a)=>ma(e._def,{...t,currentPath:[...t.currentPath,"anyOf",`${a}`]})).filter(e=>!!e&&(!t.strictUnions||"object"==typeof e&&Object.keys(e).length>0));return a.length?{anyOf:a}:void 0};function la(e,t){const a="openAi"===t.target,r={type:"object",properties:{}},n=[],s=e.shape();for(const e in s){let i=s[e];if(void 0===i||void 0===i._def)continue;let o=pa(i);o&&a&&("ZodOptional"===i._def.typeName&&(i=i._def.innerType),i.isNullable()||(i=i.nullable()),o=!1);const d=ma(i._def,{...t,currentPath:[...t.currentPath,"properties",e],propertyPath:[...t.currentPath,"properties",e]});void 0!==d&&(r.properties[e]=d,o||n.push(e))}n.length&&(r.required=n);const i=function(e,t){if("ZodNever"!==e.catchall._def.typeName)return ma(e.catchall._def,{...t,currentPath:[...t.currentPath,"additionalProperties"]});switch(e.unknownKeys){case"passthrough":return t.allowedAdditionalProperties;case"strict":return t.rejectedAdditionalProperties;case"strip":return"strict"===t.removeAdditionalStrategy?t.allowedAdditionalProperties:t.rejectedAdditionalProperties}}(e,t);return void 0!==i&&(r.additionalProperties=i),r}function pa(e){try{return e.isOptional()}catch(e){return!0}}var ha=(e,t,a)=>{switch(t){case Ke.ZodString:return aa(e,a);case Ke.ZodNumber:return function(e,t){const a={type:"number"};if(!e.checks)return a;for(const r of e.checks)switch(r.kind){case"int":a.type="integer",Mt(a,"type",r.message,t);break;case"min":"jsonSchema7"===t.target?r.inclusive?Ft(a,"minimum",r.value,r.message,t):Ft(a,"exclusiveMinimum",r.value,r.message,t):(r.inclusive||(a.exclusiveMinimum=!0),Ft(a,"minimum",r.value,r.message,t));break;case"max":"jsonSchema7"===t.target?r.inclusive?Ft(a,"maximum",r.value,r.message,t):Ft(a,"exclusiveMaximum",r.value,r.message,t):(r.inclusive||(a.exclusiveMaximum=!0),Ft(a,"maximum",r.value,r.message,t));break;case"multipleOf":Ft(a,"multipleOf",r.value,r.message,t)}return a}(e,a);case Ke.ZodObject:return la(e,a);case Ke.ZodBigInt:return function(e,t){const a={type:"integer",format:"int64"};if(!e.checks)return a;for(const r of e.checks)switch(r.kind){case"min":"jsonSchema7"===t.target?r.inclusive?Ft(a,"minimum",r.value,r.message,t):Ft(a,"exclusiveMinimum",r.value,r.message,t):(r.inclusive||(a.exclusiveMinimum=!0),Ft(a,"minimum",r.value,r.message,t));break;case"max":"jsonSchema7"===t.target?r.inclusive?Ft(a,"maximum",r.value,r.message,t):Ft(a,"exclusiveMaximum",r.value,r.message,t):(r.inclusive||(a.exclusiveMaximum=!0),Ft(a,"maximum",r.value,r.message,t));break;case"multipleOf":Ft(a,"multipleOf",r.value,r.message,t)}return a}(e,a);case Ke.ZodBoolean:return{type:"boolean"};case Ke.ZodDate:return Vt(e,a);case Ke.ZodUndefined:return function(e){return{not:zt(e)}}(a);case Ke.ZodNull:return function(e){return"openApi3"===e.target?{enum:["null"],nullable:!0}:{type:"null"}}(a);case Ke.ZodArray:return function(e,t){var a,r,n;const s={type:"array"};return(null==(a=e.type)?void 0:a._def)&&(null==(n=null==(r=e.type)?void 0:r._def)?void 0:n.typeName)!==Ke.ZodAny&&(s.items=ma(e.type._def,{...t,currentPath:[...t.currentPath,"items"]})),e.minLength&&Ft(s,"minItems",e.minLength.value,e.minLength.message,t),e.maxLength&&Ft(s,"maxItems",e.maxLength.value,e.maxLength.message,t),e.exactLength&&(Ft(s,"minItems",e.exactLength.value,e.exactLength.message,t),Ft(s,"maxItems",e.exactLength.value,e.exactLength.message,t)),s}(e,a);case Ke.ZodUnion:case Ke.ZodDiscriminatedUnion:return function(e,t){if("openApi3"===t.target)return ua(e,t);const a=e.options instanceof Map?Array.from(e.options.values()):e.options;if(a.every(e=>e._def.typeName in ca&&(!e._def.checks||!e._def.checks.length))){const e=a.reduce((e,t)=>{const a=ca[t._def.typeName];return a&&!e.includes(a)?[...e,a]:e},[]);return{type:e.length>1?e:e[0]}}if(a.every(e=>"ZodLiteral"===e._def.typeName&&!e.description)){const e=a.reduce((e,t)=>{const a=typeof t._def.value;switch(a){case"string":case"number":case"boolean":return[...e,a];case"bigint":return[...e,"integer"];case"object":if(null===t._def.value)return[...e,"null"];default:return e}},[]);if(e.length===a.length){const t=e.filter((e,t,a)=>a.indexOf(e)===t);return{type:t.length>1?t:t[0],enum:a.reduce((e,t)=>e.includes(t._def.value)?e:[...e,t._def.value],[])}}}else if(a.every(e=>"ZodEnum"===e._def.typeName))return{type:"string",enum:a.reduce((e,t)=>[...e,...t._def.values.filter(t=>!e.includes(t))],[])};return ua(e,t)}(e,a);case Ke.ZodIntersection:return function(e,t){const a=[ma(e.left._def,{...t,currentPath:[...t.currentPath,"allOf","0"]}),ma(e.right._def,{...t,currentPath:[...t.currentPath,"allOf","1"]})].filter(e=>!!e);let r="jsonSchema2019-09"===t.target?{unevaluatedProperties:!1}:void 0;const n=[];return a.forEach(e=>{if("type"in(t=e)&&"string"===t.type||!("allOf"in t)){let t=e;if("additionalProperties"in e&&!1===e.additionalProperties){const{additionalProperties:a,...r}=e;t=r}else r=void 0;n.push(t)}else n.push(...e.allOf),void 0===e.unevaluatedProperties&&(r=void 0);var t}),n.length?{allOf:n,...r}:void 0}(e,a);case Ke.ZodTuple:return function(e,t){return e.rest?{type:"array",minItems:e.items.length,items:e.items.map((e,a)=>ma(e._def,{...t,currentPath:[...t.currentPath,"items",`${a}`]})).reduce((e,t)=>void 0===t?e:[...e,t],[]),additionalItems:ma(e.rest._def,{...t,currentPath:[...t.currentPath,"additionalItems"]})}:{type:"array",minItems:e.items.length,maxItems:e.items.length,items:e.items.map((e,a)=>ma(e._def,{...t,currentPath:[...t.currentPath,"items",`${a}`]})).reduce((e,t)=>void 0===t?e:[...e,t],[])}}(e,a);case Ke.ZodRecord:return da(e,a);case Ke.ZodLiteral:return function(e,t){const a=typeof e.value;return"bigint"!==a&&"number"!==a&&"boolean"!==a&&"string"!==a?{type:Array.isArray(e.value)?"array":"object"}:"openApi3"===t.target?{type:"bigint"===a?"integer":a,enum:[e.value]}:{type:"bigint"===a?"integer":a,const:e.value}}(e,a);case Ke.ZodEnum:return function(e){return{type:"string",enum:Array.from(e.values)}}(e);case Ke.ZodNativeEnum:return function(e){const t=e.values,a=Object.keys(e.values).filter(e=>"number"!=typeof t[t[e]]).map(e=>t[e]),r=Array.from(new Set(a.map(e=>typeof e)));return{type:1===r.length?"string"===r[0]?"string":"number":["string","number"],enum:a}}(e);case Ke.ZodNullable:return function(e,t){if(["ZodString","ZodNumber","ZodBigInt","ZodBoolean","ZodNull"].includes(e.innerType._def.typeName)&&(!e.innerType._def.checks||!e.innerType._def.checks.length))return"openApi3"===t.target?{type:ca[e.innerType._def.typeName],nullable:!0}:{type:[ca[e.innerType._def.typeName],"null"]};if("openApi3"===t.target){const a=ma(e.innerType._def,{...t,currentPath:[...t.currentPath]});return a&&"$ref"in a?{allOf:[a],nullable:!0}:a&&{...a,nullable:!0}}const a=ma(e.innerType._def,{...t,currentPath:[...t.currentPath,"anyOf","0"]});return a&&{anyOf:[a,{type:"null"}]}}(e,a);case Ke.ZodOptional:return((e,t)=>{var a;if(t.currentPath.toString()===(null==(a=t.propertyPath)?void 0:a.toString()))return ma(e.innerType._def,t);const r=ma(e.innerType._def,{...t,currentPath:[...t.currentPath,"anyOf","1"]});return r?{anyOf:[{not:zt(t)},r]}:zt(t)})(e,a);case Ke.ZodMap:return function(e,t){return"record"===t.mapStrategy?da(e,t):{type:"array",maxItems:125,items:{type:"array",items:[ma(e.keyType._def,{...t,currentPath:[...t.currentPath,"items","items","0"]})||zt(t),ma(e.valueType._def,{...t,currentPath:[...t.currentPath,"items","items","1"]})||zt(t)],minItems:2,maxItems:2}}}(e,a);case Ke.ZodSet:return function(e,t){const a={type:"array",uniqueItems:!0,items:ma(e.valueType._def,{...t,currentPath:[...t.currentPath,"items"]})};return e.minSize&&Ft(a,"minItems",e.minSize.value,e.minSize.message,t),e.maxSize&&Ft(a,"maxItems",e.maxSize.value,e.maxSize.message,t),a}(e,a);case Ke.ZodLazy:return()=>e.getter()._def;case Ke.ZodPromise:return function(e,t){return ma(e.type._def,t)}(e,a);case Ke.ZodNaN:case Ke.ZodNever:return function(e){return"openAi"===e.target?void 0:{not:zt({...e,currentPath:[...e.currentPath,"not"]})}}(a);case Ke.ZodEffects:return function(e,t){return"input"===t.effectStrategy?ma(e.schema._def,t):zt(t)}(e,a);case Ke.ZodAny:return zt(a);case Ke.ZodUnknown:return function(e){return zt(e)}(a);case Ke.ZodDefault:return function(e,t){return{...ma(e.innerType._def,t),default:e.defaultValue()}}(e,a);case Ke.ZodBranded:return Dt(e,a);case Ke.ZodReadonly:case Ke.ZodCatch:return((e,t)=>ma(e.innerType._def,t))(e,a);case Ke.ZodPipeline:return((e,t)=>{if("input"===t.pipeStrategy)return ma(e.in._def,t);if("output"===t.pipeStrategy)return ma(e.out._def,t);const a=ma(e.in._def,{...t,currentPath:[...t.currentPath,"allOf","0"]});return{allOf:[a,ma(e.out._def,{...t,currentPath:[...t.currentPath,"allOf",a?"1":"0"]})].filter(e=>void 0!==e)}})(e,a);case Ke.ZodFunction:case Ke.ZodVoid:case Ke.ZodSymbol:default:return}};function ma(e,t,a=!1){var r;const n=t.seen.get(e);if(t.override){const s=null==(r=t.override)?void 0:r.call(t,e,t,n,a);if(s!==It)return s}if(n&&!a){const e=fa(n,t);if(void 0!==e)return e}const s={def:e,path:t.currentPath,jsonSchema:void 0};t.seen.set(e,s);const i=ha(e,e.typeName,t),o="function"==typeof i?ma(i(),t):i;if(o&&ga(e,t,o),t.postProcess){const a=t.postProcess(o,e,t);return s.jsonSchema=o,a}return s.jsonSchema=o,o}var fa=(e,t)=>{switch(t.$refStrategy){case"root":return{$ref:e.path.join("/")};case"relative":return{$ref:Lt(t.currentPath,e.path)};case"none":case"seen":return e.path.length<t.currentPath.length&&e.path.every((e,a)=>t.currentPath[a]===e)?(console.warn(`Recursive reference detected at ${t.currentPath.join("/")}! Defaulting to any`),zt(t)):"seen"===t.$refStrategy?zt(t):void 0}},ga=(e,t,a)=>(e.description&&(a.description=e.description,t.markdownDescription&&(a.markdownDescription=e.description)),a),ya=(e,t)=>{var a;const r=Rt(t);let n="object"==typeof t&&t.definitions?Object.entries(t.definitions).reduce((e,[t,a])=>{var n;return{...e,[t]:null!=(n=ma(a._def,{...r,currentPath:[...r.basePath,r.definitionPath,t]},!0))?n:zt(r)}},{}):void 0;const s="string"==typeof t?t:"title"===(null==t?void 0:t.nameStrategy)||null==t?void 0:t.name,i=null!=(a=ma(e._def,void 0===s?r:{...r,currentPath:[...r.basePath,r.definitionPath,s]},!1))?a:zt(r),o="object"==typeof t&&void 0!==t.name&&"title"===t.nameStrategy?t.name:void 0;void 0!==o&&(i.title=o),r.flags.hasReferencedOpenAiAnyType&&(n||(n={}),n[r.openAiAnyTypeName]||(n[r.openAiAnyTypeName]={type:["string","number","integer","boolean","array","null"],items:{$ref:"relative"===r.$refStrategy?"1":[...r.basePath,r.definitionPath,r.openAiAnyTypeName].join("/")}}));const d=void 0===s?n?{...i,[r.definitionPath]:n}:i:{$ref:[..."relative"===r.$refStrategy?[]:r.basePath,r.definitionPath,s].join("/"),[r.definitionPath]:{...n,[s]:i}};return"jsonSchema7"===r.target?d.$schema="http://json-schema.org/draft-07/schema#":"jsonSchema2019-09"!==r.target&&"openAi"!==r.target||(d.$schema="https://json-schema.org/draft/2019-09/schema#"),"openAi"===r.target&&("anyOf"in d||"oneOf"in d||"allOf"in d||"type"in d&&Array.isArray(d.type))&&console.warn("Warning: OpenAI may not support schemas with unions as roots! Try wrapping it in an object property."),d},va=s.record(s.string(),s.boolean()).describe("Consent requirement mapping"),_a=s.lazy(()=>s.union([s.string(),s.number(),s.boolean(),Za,s.array(_a)])),ba=s.tuple([_a,_a]).describe("Loop: [source, transform] tuple for array transformations"),ka=s.array(_a).describe("Set: Array of values"),xa=s.record(s.string(),_a).describe("Map: Object mapping keys to values"),Za=s.object({key:s.string().optional().describe('Property path (e.g., "data.id")'),value:s.union([s.string(),s.number(),s.boolean()]).optional().describe("Static primitive value"),fn:s.string().optional().describe("Function string for custom transformation"),map:xa.optional().describe("Object with key-value mappings"),loop:ba.optional().describe("Tuple [source, transform]"),set:ka.optional().describe("Array of values"),consent:va.optional().describe("Required consent states"),condition:s.string().optional().describe("Condition function string"),validate:s.string().optional().describe("Validation function string")}).refine(e=>Object.keys(e).length>0,{message:"ValueConfig must have at least one property"}).describe("Value configuration for transformations"),wa=ba,Aa=ka,Ta=xa;ya(Za,{target:"jsonSchema7",$refStrategy:"relative",name:"ValueConfig"}),ya(wa,{target:"jsonSchema7",$refStrategy:"relative",name:"Loop"}),ya(Aa,{target:"jsonSchema7",$refStrategy:"relative",name:"Set"}),ya(Ta,{target:"jsonSchema7",$refStrategy:"relative",name:"Map"});function Sa(e){var t;return Boolean(e&&"object"==typeof e&&"AWS"in e&&(null==(t=e.AWS)?void 0:t.FirehoseClient))}function Oa(e,t){const{streamName:a,region:r="eu-central-1",config:n={}}=e;a||function(e){throw new Error(String(e))}("Firehose: Config custom streamName missing"),n.region||(n.region=r);let s=e.client;return!s&&Sa(t)&&(s=new t.AWS.FirehoseClient(n)),{streamName:a,client:s,region:r}}var Pa=async function(e,{config:t,collector:a,env:r}){const{firehose:n}=t.settings||{};n&&async function(e,t,a){const{client:r,streamName:n}=t;if(!r)return{queue:e};const s=e.map(({event:e})=>({Data:Buffer.from(JSON.stringify(e))}));if(Sa(a))await r.send(new a.AWS.PutRecordBatchCommand({DeliveryStreamName:n,Records:s}));else{const{PutRecordBatchCommand:e}=await import("@aws-sdk/client-firehose");await r.send(new e({DeliveryStreamName:n,Records:s}))}}([{event:e}],n,r)},Na={},ja={};n(ja,{env:()=>Ca});var Ca={};n(Ca,{push:()=>$a});var $a={AWS:{FirehoseClient:class{constructor(e){this.config=e}async send(e){return{RecordId:"mock-record-id",ResponseMetadata:{RequestId:"mock-request-id"}}}},PutRecordBatchCommand:class{constructor(e){this.input=e}}}},Ia={type:"aws-firehose",config:{},async init({config:e,env:t}){const a=function(e={},t){const a=e.settings||{};return a.firehose&&(a.firehose=Oa(a.firehose,t)),{settings:a}}(e,t);return typeof a.settings==typeof{}&&a},push:async(e,{config:t,collector:a,env:r})=>await Pa(e,{config:t,collector:a,env:r})},Ea={};n(Ea,{firehose:()=>ja});export{Na as DestinationFirehose,Ia as destinationFirehose,Ea as examples};//# sourceMappingURL=index.mjs.map
|