var extendStatics=function(e,t){return(extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])})(e,t)};function __extends(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}extendStatics(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var util,__assign=function(){return(__assign=Object.assign||function(e){for(var t,r=1,n=arguments.length;rs[0]&&t[1]=e.length?void 0:e)&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function __read(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,a,o=r.call(e),s=[];try{for(;(void 0===t||0()[\]\.,;:\s@\"]+(\.[^<>()[\]\.,;:\s@\"]+)*)|(\".+\"))@(([^<>()[\]\.,;:\s@\"]+\.)+[^<>()[\]\.,;:\s@\"]{2,})$/i,ZodString=function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n._regex=function(t,e,r){return n.refinement(function(e){return t.test(e)},__assign({validation:e,code:ZodIssueCode.invalid_string},errorUtil.errToObj(r)))},n.nonempty=function(e){return n.min(1,errorUtil.errToObj(e))},n}return __extends(t,e),t.prototype._parse=function(e){var t,r,e=this._processInputParams(e),n=e.status,a=e.ctx;if(a.parsedType!==ZodParsedType.string)return addIssueToContext(a,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.string,received:a.parsedType}),INVALID;try{for(var o=__values(this._def.checks),s=o.next();!s.done;s=o.next()){var i=s.value;if("min"===i.kind)a.data.lengthi.value&&(addIssueToContext(a,{code:ZodIssueCode.too_big,maximum:i.value,type:"string",inclusive:!0,message:i.message}),n.dirty());else if("email"===i.kind)emailRegex.test(a.data)||(addIssueToContext(a,{validation:"email",code:ZodIssueCode.invalid_string,message:i.message}),n.dirty());else if("uuid"===i.kind)uuidRegex.test(a.data)||(addIssueToContext(a,{validation:"uuid",code:ZodIssueCode.invalid_string,message:i.message}),n.dirty());else if("cuid"===i.kind)cuidRegex.test(a.data)||(addIssueToContext(a,{validation:"cuid",code:ZodIssueCode.invalid_string,message:i.message}),n.dirty());else if("url"===i.kind)try{new URL(a.data)}catch(e){addIssueToContext(a,{validation:"url",code:ZodIssueCode.invalid_string,message:i.message}),n.dirty()}else"regex"===i.kind&&(i.regex.lastIndex=0,i.regex.test(a.data)||(addIssueToContext(a,{validation:"regex",code:ZodIssueCode.invalid_string,message:i.message}),n.dirty()))}}catch(e){t={error:e}}finally{try{s&&!s.done&&(r=o.return)&&r.call(o)}finally{if(t)throw t.error}}return{status:n.value,value:a.data}},t.prototype._addCheck=function(e){return new t(__assign(__assign({},this._def),{checks:__spreadArray(__spreadArray([],__read(this._def.checks),!1),[e],!1)}))},t.prototype.email=function(e){return this._addCheck(__assign({kind:"email"},errorUtil.errToObj(e)))},t.prototype.url=function(e){return this._addCheck(__assign({kind:"url"},errorUtil.errToObj(e)))},t.prototype.uuid=function(e){return this._addCheck(__assign({kind:"uuid"},errorUtil.errToObj(e)))},t.prototype.cuid=function(e){return this._addCheck(__assign({kind:"cuid"},errorUtil.errToObj(e)))},t.prototype.regex=function(e,t){return this._addCheck(__assign({kind:"regex",regex:e},errorUtil.errToObj(t)))},t.prototype.min=function(e,t){return this._addCheck(__assign({kind:"min",value:e},errorUtil.errToObj(t)))},t.prototype.max=function(e,t){return this._addCheck(__assign({kind:"max",value:e},errorUtil.errToObj(t)))},t.prototype.length=function(e,t){return this.min(e,t).max(e,t)},Object.defineProperty(t.prototype,"isEmail",{get:function(){return!!this._def.checks.find(function(e){return"email"===e.kind})},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isURL",{get:function(){return!!this._def.checks.find(function(e){return"url"===e.kind})},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isUUID",{get:function(){return!!this._def.checks.find(function(e){return"uuid"===e.kind})},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isCUID",{get:function(){return!!this._def.checks.find(function(e){return"cuid"===e.kind})},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"minLength",{get:function(){var t=-1/0;return this._def.checks.map(function(e){"min"===e.kind&&(null===t||e.value>t)&&(t=e.value)}),t},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"maxLength",{get:function(){var t=null;return this._def.checks.map(function(e){"max"===e.kind&&(null===t||e.valuei.value:a.data>=i.value)&&(addIssueToContext(a,{code:ZodIssueCode.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,message:i.message}),n.dirty()):"multipleOf"===i.kind?a.data%i.value!=0&&(addIssueToContext(a,{code:ZodIssueCode.not_multiple_of,multipleOf:i.value,message:i.message}),n.dirty()):util.assertNever(i)}}catch(e){t={error:e}}finally{try{s&&!s.done&&(r=o.return)&&r.call(o)}finally{if(t)throw t.error}}return{status:n.value,value:a.data}},a.prototype.gte=function(e,t){return this.setLimit("min",e,!0,errorUtil.toString(t))},a.prototype.gt=function(e,t){return this.setLimit("min",e,!1,errorUtil.toString(t))},a.prototype.lte=function(e,t){return this.setLimit("max",e,!0,errorUtil.toString(t))},a.prototype.lt=function(e,t){return this.setLimit("max",e,!1,errorUtil.toString(t))},a.prototype.setLimit=function(e,t,r,n){return new a(__assign(__assign({},this._def),{checks:__spreadArray(__spreadArray([],__read(this._def.checks),!1),[{kind:e,value:t,inclusive:r,message:errorUtil.toString(n)}],!1)}))},a.prototype._addCheck=function(e){return new a(__assign(__assign({},this._def),{checks:__spreadArray(__spreadArray([],__read(this._def.checks),!1),[e],!1)}))},a.prototype.int=function(e){return this._addCheck({kind:"int",message:errorUtil.toString(e)})},a.prototype.positive=function(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:errorUtil.toString(e)})},a.prototype.negative=function(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:errorUtil.toString(e)})},a.prototype.nonpositive=function(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:errorUtil.toString(e)})},a.prototype.nonnegative=function(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:errorUtil.toString(e)})},a.prototype.multipleOf=function(e,t){return this._addCheck({kind:"multipleOf",value:e,message:errorUtil.toString(t)})},Object.defineProperty(a.prototype,"minValue",{get:function(){var t,e,r=null;try{for(var n=__values(this._def.checks),a=n.next();!a.done;a=n.next()){var o=a.value;"min"===o.kind&&(null===r||o.value>r)&&(r=o.value)}}catch(e){t={error:e}}finally{try{a&&!a.done&&(e=n.return)&&e.call(n)}finally{if(t)throw t.error}}return r},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"maxValue",{get:function(){var t,e,r=null;try{for(var n=__values(this._def.checks),a=n.next();!a.done;a=n.next()){var o=a.value;"max"===o.kind&&(null===r||o.valuen.maxLength.value&&(addIssueToContext(r,{code:ZodIssueCode.too_big,maximum:n.maxLength.value,type:"array",inclusive:!0,message:n.maxLength.message}),t.dirty()),r.async)return Promise.all(r.data.map(function(e,t){return n.type._parseAsync({parent:r,path:__spreadArray(__spreadArray([],__read(r.path),!1),[t],!1),data:e})})).then(function(e){return ParseStatus.mergeArray(t,e)});e=r.data.map(function(e,t){return n.type._parseSync({parent:r,path:__spreadArray(__spreadArray([],__read(r.path),!1),[t],!1),data:e})});return ParseStatus.mergeArray(t,e)},Object.defineProperty(r.prototype,"element",{get:function(){return this._def.type},enumerable:!1,configurable:!0}),r.prototype.min=function(e,t){return new r(__assign(__assign({},this._def),{minLength:{value:e,message:errorUtil.toString(t)}}))},r.prototype.max=function(e,t){return new r(__assign(__assign({},this._def),{maxLength:{value:e,message:errorUtil.toString(t)}}))},r.prototype.length=function(e,t){return this.min(e,t).max(e,t)},r.prototype.nonempty=function(e){return this.min(1,e)},r.create=function(e,t){return new r(__assign({type:e,minLength:null,maxLength:null,typeName:ZodFirstPartyTypeKind.ZodArray},processCreateParams(t)))},r}(ZodType);(objectUtil||(objectUtil={})).mergeShapes=function(e,t){return __assign(__assign({},e),t)};var AugmentFactory=function(t){return function(e){return new ZodObject(__assign(__assign({},t),{shape:function(){return __assign(__assign({},t.shape()),e)}}))}};function deepPartialify(e){if(e instanceof ZodObject){var t,r={};for(t in e.shape){var n=e.shape[t];r[t]=ZodOptional.create(deepPartialify(n))}return new ZodObject(__assign(__assign({},e._def),{shape:function(){return r}}))}return e instanceof ZodArray?ZodArray.create(deepPartialify(e.element)):e instanceof ZodOptional?ZodOptional.create(deepPartialify(e.unwrap())):e instanceof ZodNullable?ZodNullable.create(deepPartialify(e.unwrap())):e instanceof ZodTuple?ZodTuple.create(e.items.map(function(e){return deepPartialify(e)})):e}var ZodObject=function(t){function s(){var e=null!==t&&t.apply(this,arguments)||this;return e._cached=null,e.nonstrict=e.passthrough,e.augment=AugmentFactory(e._def),e.extend=AugmentFactory(e._def),e}return __extends(s,t),s.prototype._getCached=function(){if(null!==this._cached)return this._cached;var e=this._def.shape(),t=util.objectKeys(e);return this._cached={shape:e,keys:t}},s.prototype._parse=function(e){var t,r,n,a,o,s=this,i=this._processInputParams(e),u=i.status,d=i.ctx;if(d.parsedType!==ZodParsedType.object)return addIssueToContext(d,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.object,received:d.parsedType}),INVALID;var e=this._getCached(),p=e.shape,i=e.keys,e=util.objectKeys(d.data).filter(function(e){return!(e in p)}),c=[];try{for(var l=__values(i),y=l.next();!y.done;y=l.next()){var f=y.value,_=p[f],h=d.data[f];c.push({key:{status:"valid",value:f},value:_._parse({parent:d,data:h,path:__spreadArray(__spreadArray([],__read(d.path),!1),[f],!1)}),alwaysSet:f in d.data})}}catch(e){v={error:e}}finally{try{y&&!y.done&&(t=l.return)&&t.call(l)}finally{if(v)throw v.error}}if(this._def.catchall instanceof ZodNever){var v=this._def.unknownKeys;if("passthrough"===v)try{for(var m=__values(e),Z=m.next();!Z.done;Z=m.next()){f=Z.value;c.push({key:{status:"valid",value:f},value:{status:"valid",value:d.data[f]}})}}catch(e){r={error:e}}finally{try{Z&&!Z.done&&(n=m.return)&&n.call(m)}finally{if(r)throw r.error}}else if("strict"===v)0this._def.items.length&&(addIssueToContext(a,{code:ZodIssueCode.too_big,maximum:this._def.items.length,inclusive:!0,type:"array"}),t.dirty());e=a.data.map(function(e,t){var r=n._def.items[t]||n._def.rest;return r?r._parse({data:e,path:__spreadArray(__spreadArray([],__read(a.path),!1),[t],!1),parent:a}):null}).filter(function(e){return!!e});return a.async?Promise.all(e).then(function(e){return ParseStatus.mergeArray(t,e)}):ParseStatus.mergeArray(t,e)},Object.defineProperty(r.prototype,"items",{get:function(){return this._def.items},enumerable:!1,configurable:!0}),r.prototype.rest=function(e){return new r(__assign(__assign({},this._def),{rest:e}))},r.create=function(e,t){return new r(__assign({items:e,typeName:ZodFirstPartyTypeKind.ZodTuple,rest:null},processCreateParams(t)))},r}(ZodType),ZodRecord=function(e){function n(){return null!==e&&e.apply(this,arguments)||this}return __extends(n,e),Object.defineProperty(n.prototype,"keySchema",{get:function(){return this._def.keyType},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"valueSchema",{get:function(){return this._def.valueType},enumerable:!1,configurable:!0}),n.prototype._parse=function(e){var t=this._processInputParams(e),e=t.status,r=t.ctx;if(r.parsedType!==ZodParsedType.object)return addIssueToContext(r,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.object,received:r.parsedType}),INVALID;var n,a=[],o=this._def.keyType,s=this._def.valueType;for(n in r.data)a.push({key:o._parse({data:n,path:__spreadArray(__spreadArray([],__read(r.path),!1),[n],!1),parent:r}),value:s._parse({data:r.data[n],path:__spreadArray(__spreadArray([],__read(r.path),!1),[n],!1),parent:r})});return r.async?ParseStatus.mergeObjectAsync(e,a):ParseStatus.mergeObjectSync(e,a)},Object.defineProperty(n.prototype,"element",{get:function(){return this._def.valueType},enumerable:!1,configurable:!0}),n.create=function(e,t,r){return new n(t instanceof ZodType?__assign({keyType:e,valueType:t,typeName:ZodFirstPartyTypeKind.ZodRecord},processCreateParams(r)):__assign({keyType:ZodString.create(),valueType:e,typeName:ZodFirstPartyTypeKind.ZodRecord},processCreateParams(t)))},n}(ZodType),ZodMap=function(e){function n(){return null!==e&&e.apply(this,arguments)||this}return __extends(n,e),n.prototype._parse=function(e){var t,r,n=this,e=this._processInputParams(e),u=e.status,a=e.ctx;if(a.parsedType!==ZodParsedType.map)return addIssueToContext(a,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.map,received:a.parsedType}),INVALID;var o=this._def.keyType,s=this._def.valueType,d=__spreadArray([],__read(a.data.entries()),!1).map(function(e,t){var r=__read(e,2),e=r[0],r=r[1];return{key:o._parse({data:e,path:__spreadArray(__spreadArray([],__read(a.path),!1),[t,"key"],!1),parent:a}),value:s._parse({data:r,path:__spreadArray(__spreadArray([],__read(a.path),!1),[t,"value"],!1),parent:a})}});if(a.async){var p=new Map;return Promise.resolve().then(function(){return __awaiter(n,void 0,void 0,function(){var t,r,n,a,o,s,i;return __generator(this,function(e){switch(e.label){case 0:e.trys.push([0,6,7,8]),t=__values(d),r=t.next(),e.label=1;case 1:return r.done?[3,5]:[4,(n=r.value).key];case 2:return a=e.sent(),[4,n.value];case 3:if(o=e.sent(),"aborted"===a.status||"aborted"===o.status)return[2,INVALID];"dirty"!==a.status&&"dirty"!==o.status||u.dirty(),p.set(a.value,o.value),e.label=4;case 4:return r=t.next(),[3,1];case 5:return[3,8];case 6:return s=e.sent(),s={error:s},[3,8];case 7:try{r&&!r.done&&(i=t.return)&&i.call(t)}finally{if(s)throw s.error}return[7];case 8:return[2,{status:u.value,value:p}]}})})})}var i=new Map;try{for(var c=__values(d),l=c.next();!l.done;l=c.next()){var y=l.value,f=y.key,_=y.value;if("aborted"===f.status||"aborted"===_.status)return INVALID;"dirty"!==f.status&&"dirty"!==_.status||u.dirty(),i.set(f.value,_.value)}}catch(e){t={error:e}}finally{try{l&&!l.done&&(r=c.return)&&r.call(c)}finally{if(t)throw t.error}}return{status:u.value,value:i}},n.create=function(e,t,r){return new n(__assign({valueType:t,keyType:e,typeName:ZodFirstPartyTypeKind.ZodMap},processCreateParams(r)))},n}(ZodType),ZodSet=function(e){function r(){return null!==e&&e.apply(this,arguments)||this}return __extends(r,e),r.prototype._parse=function(e){var e=this._processInputParams(e),i=e.status,r=e.ctx;if(r.parsedType!==ZodParsedType.set)return addIssueToContext(r,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.set,received:r.parsedType}),INVALID;var n=this._def.valueType;function t(e){var t,r,n=new Set;try{for(var a=__values(e),o=a.next();!o.done;o=a.next()){var s=o.value;if("aborted"===s.status)return INVALID;"dirty"===s.status&&i.dirty(),n.add(s.value)}}catch(e){t={error:e}}finally{try{o&&!o.done&&(r=a.return)&&r.call(a)}finally{if(t)throw t.error}}return{status:i.value,value:n}}e=__spreadArray([],__read(r.data.values()),!1).map(function(e,t){return n._parse({data:e,path:__spreadArray(__spreadArray([],__read(r.path),!1),[t],!1),parent:r})});return r.async?Promise.all(e).then(t):t(e)},r.create=function(e,t){return new r(__assign({valueType:e,typeName:ZodFirstPartyTypeKind.ZodSet},processCreateParams(t)))},r}(ZodType),ZodFunction=function(t){function n(){var e=null!==t&&t.apply(this,arguments)||this;return e.validate=e.implement,e}return __extends(n,t),n.prototype._parse=function(e){var o=this,r=this._processInputParams(e).ctx;if(r.parsedType!==ZodParsedType.function)return addIssueToContext(r,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.function,received:r.parsedType}),INVALID;function s(e,t){return makeIssue({data:e,path:r.path,errorMaps:[r.contextualErrorMap,r.schemaErrorMap,overrideErrorMap,defaultErrorMap].filter(function(e){return!!e}),issueData:{code:ZodIssueCode.invalid_arguments,argumentsError:t}})}function i(e,t){return makeIssue({data:e,path:r.path,errorMaps:[r.contextualErrorMap,r.schemaErrorMap,overrideErrorMap,defaultErrorMap].filter(function(e){return!!e}),issueData:{code:ZodIssueCode.invalid_return_type,returnTypeError:t}})}var u={errorMap:r.contextualErrorMap},d=r.data;return this._def.returns instanceof ZodPromise?OK(function(){for(var a=[],e=0;e