Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

directus-extension-okam-typesense

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

directus-extension-okam-typesense - npm Package Compare versions

Comparing version 1.0.0 to 1.0.1

2

dist/api.js

@@ -1,1 +0,1 @@

var e,t;!function(e){e.assertEqual=e=>e,e.assertIs=function(e){},e.assertNever=function(e){throw new Error},e.arrayToEnum=e=>{const t={};for(const s of e)t[s]=s;return t},e.getValidEnumValues=t=>{const s=e.objectKeys(t).filter((e=>"number"!=typeof t[t[e]])),a={};for(const e of s)a[e]=t[e];return e.objectValues(a)},e.objectValues=t=>e.objectKeys(t).map((function(e){return t[e]})),e.objectKeys="function"==typeof Object.keys?e=>Object.keys(e):e=>{const t=[];for(const s in e)Object.prototype.hasOwnProperty.call(e,s)&&t.push(s);return t},e.find=(e,t)=>{for(const s of e)if(t(s))return s},e.isInteger="function"==typeof Number.isInteger?e=>Number.isInteger(e):e=>"number"==typeof e&&isFinite(e)&&Math.floor(e)===e,e.joinValues=function(e,t=" | "){return e.map((e=>"string"==typeof e?`'${e}'`:e)).join(t)},e.jsonStringifyReplacer=(e,t)=>"bigint"==typeof t?t.toString():t}(e||(e={})),function(e){e.mergeShapes=(e,t)=>({...e,...t})}(t||(t={}));const s=e.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),a=e=>{switch(typeof e){case"undefined":return s.undefined;case"string":return s.string;case"number":return isNaN(e)?s.nan:s.number;case"boolean":return s.boolean;case"function":return s.function;case"bigint":return s.bigint;case"symbol":return s.symbol;case"object":return Array.isArray(e)?s.array:null===e?s.null:e.then&&"function"==typeof e.then&&e.catch&&"function"==typeof e.catch?s.promise:"undefined"!=typeof Map&&e instanceof Map?s.map:"undefined"!=typeof Set&&e instanceof Set?s.set:"undefined"!=typeof Date&&e instanceof Date?s.date:s.object;default:return s.unknown}},n=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"]);class r extends Error{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}get errors(){return this.issues}format(e){const t=e||function(e){return e.message},s={_errors:[]},a=e=>{for(const n of e.issues)if("invalid_union"===n.code)n.unionErrors.map(a);else if("invalid_return_type"===n.code)a(n.returnTypeError);else if("invalid_arguments"===n.code)a(n.argumentsError);else if(0===n.path.length)s._errors.push(t(n));else{let e=s,a=0;for(;a<n.path.length;){const s=n.path[a];a===n.path.length-1?(e[s]=e[s]||{_errors:[]},e[s]._errors.push(t(n))):e[s]=e[s]||{_errors:[]},e=e[s],a++}}};return a(this),s}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={},s=[];for(const a of this.issues)a.path.length>0?(t[a.path[0]]=t[a.path[0]]||[],t[a.path[0]].push(e(a))):s.push(e(a));return{formErrors:s,fieldErrors:t}}get formErrors(){return this.flatten()}}r.create=e=>new r(e);const i=(t,a)=>{let r;switch(t.code){case n.invalid_type:r=t.received===s.undefined?"Required":`Expected ${t.expected}, received ${t.received}`;break;case n.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(t.expected,e.jsonStringifyReplacer)}`;break;case n.unrecognized_keys:r=`Unrecognized key(s) in object: ${e.joinValues(t.keys,", ")}`;break;case n.invalid_union:r="Invalid input";break;case n.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${e.joinValues(t.options)}`;break;case n.invalid_enum_value:r=`Invalid enum value. Expected ${e.joinValues(t.options)}, received '${t.received}'`;break;case n.invalid_arguments:r="Invalid function arguments";break;case n.invalid_return_type:r="Invalid function return type";break;case n.invalid_date:r="Invalid date";break;case n.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 n.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?`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 n.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 n.custom:r="Invalid input";break;case n.invalid_intersection_types:r="Intersection results could not be merged";break;case n.not_multiple_of:r=`Number must be a multiple of ${t.multipleOf}`;break;case n.not_finite:r="Number must be finite";break;default:r=a.defaultError,e.assertNever(t)}return{message:r}};let o=i;function d(){return o}const c=e=>{const{data:t,path:s,errorMaps:a,issueData:n}=e,r=[...s,...n.path||[]],i={...n,path:r};let o="";const d=a.filter((e=>!!e)).slice().reverse();for(const e of d)o=e(i,{data:t,defaultError:o}).message;return{...n,path:r,message:n.message||o}};function u(e,t){const s=c({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,d(),i].filter((e=>!!e))});e.common.issues.push(s)}class l{constructor(){this.value="valid"}dirty(){"valid"===this.value&&(this.value="dirty")}abort(){"aborted"!==this.value&&(this.value="aborted")}static mergeArray(e,t){const s=[];for(const a of t){if("aborted"===a.status)return p;"dirty"===a.status&&e.dirty(),s.push(a.value)}return{status:e.value,value:s}}static async mergeObjectAsync(e,t){const s=[];for(const e of t)s.push({key:await e.key,value:await e.value});return l.mergeObjectSync(e,s)}static mergeObjectSync(e,t){const s={};for(const a of t){const{key:t,value:n}=a;if("aborted"===t.status)return p;if("aborted"===n.status)return p;"dirty"===t.status&&e.dirty(),"dirty"===n.status&&e.dirty(),"__proto__"===t.value||void 0===n.value&&!a.alwaysSet||(s[t.value]=n.value)}return{status:e.value,value:s}}}const p=Object.freeze({status:"aborted"}),h=e=>({status:"dirty",value:e}),m=e=>({status:"valid",value:e}),f=e=>"aborted"===e.status,y=e=>"dirty"===e.status,_=e=>"valid"===e.status,v=e=>"undefined"!=typeof Promise&&e instanceof Promise;var g;!function(e){e.errToObj=e=>"string"==typeof e?{message:e}:e||{},e.toString=e=>"string"==typeof e?e:null==e?void 0:e.message}(g||(g={}));class x{constructor(e,t,s,a){this._cachedPath=[],this.parent=e,this.data=t,this._path=s,this._key=a}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const b=(e,t)=>{if(_(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 r(e.common.issues);return this._error=t,this._error}}};function k(e){if(!e)return{};const{errorMap:t,invalid_type_error:s,required_error:a,description:n}=e;if(t&&(s||a))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:(e,t)=>"invalid_type"!==e.code?{message:t.defaultError}:void 0===t.data?{message:null!=a?a:t.defaultError}:{message:null!=s?s:t.defaultError},description:n}}class w{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)}get description(){return this._def.description}_getType(e){return a(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:a(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new l,ctx:{common:e.parent.common,data:e.data,parsedType:a(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(v(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 s=this.safeParse(e,t);if(s.success)return s.data;throw s.error}safeParse(e,t){var s;const n={common:{issues:[],async:null!==(s=null==t?void 0:t.async)&&void 0!==s&&s,contextualErrorMap:null==t?void 0:t.errorMap},path:(null==t?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:a(e)},r=this._parseSync({data:e,path:n.path,parent:n});return b(n,r)}async parseAsync(e,t){const s=await this.safeParseAsync(e,t);if(s.success)return s.data;throw s.error}async safeParseAsync(e,t){const s={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:a(e)},n=this._parse({data:e,path:s.path,parent:s}),r=await(v(n)?n:Promise.resolve(n));return b(s,r)}refine(e,t){const s=e=>"string"==typeof t||void 0===t?{message:t}:"function"==typeof t?t(e):t;return this._refinement(((t,a)=>{const r=e(t),i=()=>a.addIssue({code:n.custom,...s(t)});return"undefined"!=typeof Promise&&r instanceof Promise?r.then((e=>!!e||(i(),!1))):!!r||(i(),!1)}))}refinement(e,t){return this._refinement(((s,a)=>!!e(s)||(a.addIssue("function"==typeof t?t(s,a):t),!1)))}_refinement(e){return new ue({schema:this,typeName:ke.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}optional(){return le.create(this,this._def)}nullable(){return pe.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return F.create(this,this._def)}promise(){return ce.create(this,this._def)}or(e){return Y.create([this,e],this._def)}and(e){return X.create(this,e,this._def)}transform(e){return new ue({...k(this._def),schema:this,typeName:ke.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t="function"==typeof e?e:()=>e;return new he({...k(this._def),innerType:this,defaultValue:t,typeName:ke.ZodDefault})}brand(){return new _e({typeName:ke.ZodBranded,type:this,...k(this._def)})}catch(e){const t="function"==typeof e?e:()=>e;return new me({...k(this._def),innerType:this,catchValue:t,typeName:ke.ZodCatch})}describe(e){return new(0,this.constructor)({...this._def,description:e})}pipe(e){return ve.create(this,e)}readonly(){return ge.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const Z=/^c[^\s-]{8,}$/i,T=/^[a-z][a-z0-9]*$/,E=/^[0-9A-HJKMNP-TV-Z]{26}$/,S=/^[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,O=/^(?!\.)(?!.*\.\.)([A-Z0-9_+-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i;let N;const j=/^(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))$/,C=/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/;class P extends w{_parse(t){this._def.coerce&&(t.data=String(t.data));if(this._getType(t)!==s.string){const e=this._getOrReturnCtx(t);return u(e,{code:n.invalid_type,expected:s.string,received:e.parsedType}),p}const a=new l;let r;for(const s of this._def.checks)if("min"===s.kind)t.data.length<s.value&&(r=this._getOrReturnCtx(t,r),u(r,{code:n.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),a.dirty());else if("max"===s.kind)t.data.length>s.value&&(r=this._getOrReturnCtx(t,r),u(r,{code:n.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),a.dirty());else if("length"===s.kind){const e=t.data.length>s.value,i=t.data.length<s.value;(e||i)&&(r=this._getOrReturnCtx(t,r),e?u(r,{code:n.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}):i&&u(r,{code:n.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}),a.dirty())}else if("email"===s.kind)O.test(t.data)||(r=this._getOrReturnCtx(t,r),u(r,{validation:"email",code:n.invalid_string,message:s.message}),a.dirty());else if("emoji"===s.kind)N||(N=new RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),N.test(t.data)||(r=this._getOrReturnCtx(t,r),u(r,{validation:"emoji",code:n.invalid_string,message:s.message}),a.dirty());else if("uuid"===s.kind)S.test(t.data)||(r=this._getOrReturnCtx(t,r),u(r,{validation:"uuid",code:n.invalid_string,message:s.message}),a.dirty());else if("cuid"===s.kind)Z.test(t.data)||(r=this._getOrReturnCtx(t,r),u(r,{validation:"cuid",code:n.invalid_string,message:s.message}),a.dirty());else if("cuid2"===s.kind)T.test(t.data)||(r=this._getOrReturnCtx(t,r),u(r,{validation:"cuid2",code:n.invalid_string,message:s.message}),a.dirty());else if("ulid"===s.kind)E.test(t.data)||(r=this._getOrReturnCtx(t,r),u(r,{validation:"ulid",code:n.invalid_string,message:s.message}),a.dirty());else if("url"===s.kind)try{new URL(t.data)}catch(e){r=this._getOrReturnCtx(t,r),u(r,{validation:"url",code:n.invalid_string,message:s.message}),a.dirty()}else if("regex"===s.kind){s.regex.lastIndex=0;s.regex.test(t.data)||(r=this._getOrReturnCtx(t,r),u(r,{validation:"regex",code:n.invalid_string,message:s.message}),a.dirty())}else if("trim"===s.kind)t.data=t.data.trim();else if("includes"===s.kind)t.data.includes(s.value,s.position)||(r=this._getOrReturnCtx(t,r),u(r,{code:n.invalid_string,validation:{includes:s.value,position:s.position},message:s.message}),a.dirty());else if("toLowerCase"===s.kind)t.data=t.data.toLowerCase();else if("toUpperCase"===s.kind)t.data=t.data.toUpperCase();else if("startsWith"===s.kind)t.data.startsWith(s.value)||(r=this._getOrReturnCtx(t,r),u(r,{code:n.invalid_string,validation:{startsWith:s.value},message:s.message}),a.dirty());else if("endsWith"===s.kind)t.data.endsWith(s.value)||(r=this._getOrReturnCtx(t,r),u(r,{code:n.invalid_string,validation:{endsWith:s.value},message:s.message}),a.dirty());else if("datetime"===s.kind){((d=s).precision?d.offset?new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${d.precision}}(([+-]\\d{2}(:?\\d{2})?)|Z)$`):new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${d.precision}}Z$`):0===d.precision?d.offset?new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(([+-]\\d{2}(:?\\d{2})?)|Z)$"):new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}Z$"):d.offset?new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(([+-]\\d{2}(:?\\d{2})?)|Z)$"):new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?Z$")).test(t.data)||(r=this._getOrReturnCtx(t,r),u(r,{code:n.invalid_string,validation:"datetime",message:s.message}),a.dirty())}else"ip"===s.kind?(i=t.data,("v4"!==(o=s.version)&&o||!j.test(i))&&("v6"!==o&&o||!C.test(i))&&(r=this._getOrReturnCtx(t,r),u(r,{validation:"ip",code:n.invalid_string,message:s.message}),a.dirty())):e.assertNever(s);var i,o,d;return{status:a.value,value:t.data}}_regex(e,t,s){return this.refinement((t=>e.test(t)),{validation:t,code:n.invalid_string,...g.errToObj(s)})}_addCheck(e){return new P({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...g.errToObj(e)})}url(e){return this._addCheck({kind:"url",...g.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...g.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...g.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...g.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...g.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...g.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...g.errToObj(e)})}datetime(e){var t;return"string"==typeof e?this._addCheck({kind:"datetime",precision:null,offset:!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)&&void 0!==t&&t,...g.errToObj(null==e?void 0:e.message)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...g.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:null==t?void 0:t.position,...g.errToObj(null==t?void 0:t.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...g.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...g.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...g.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...g.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...g.errToObj(t)})}nonempty(e){return this.min(1,g.errToObj(e))}trim(){return new P({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new P({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new P({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find((e=>"datetime"===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 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 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 I(e,t){const s=(e.toString().split(".")[1]||"").length,a=(t.toString().split(".")[1]||"").length,n=s>a?s:a;return parseInt(e.toFixed(n).replace(".",""))%parseInt(t.toFixed(n).replace(".",""))/Math.pow(10,n)}P.create=e=>{var t;return new P({checks:[],typeName:ke.ZodString,coerce:null!==(t=null==e?void 0:e.coerce)&&void 0!==t&&t,...k(e)})};class R extends w{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)!==s.number){const e=this._getOrReturnCtx(t);return u(e,{code:n.invalid_type,expected:s.number,received:e.parsedType}),p}let a;const r=new l;for(const s of this._def.checks)if("int"===s.kind)e.isInteger(t.data)||(a=this._getOrReturnCtx(t,a),u(a,{code:n.invalid_type,expected:"integer",received:"float",message:s.message}),r.dirty());else if("min"===s.kind){(s.inclusive?t.data<s.value:t.data<=s.value)&&(a=this._getOrReturnCtx(t,a),u(a,{code:n.too_small,minimum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),r.dirty())}else if("max"===s.kind){(s.inclusive?t.data>s.value:t.data>=s.value)&&(a=this._getOrReturnCtx(t,a),u(a,{code:n.too_big,maximum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),r.dirty())}else"multipleOf"===s.kind?0!==I(t.data,s.value)&&(a=this._getOrReturnCtx(t,a),u(a,{code:n.not_multiple_of,multipleOf:s.value,message:s.message}),r.dirty()):"finite"===s.kind?Number.isFinite(t.data)||(a=this._getOrReturnCtx(t,a),u(a,{code:n.not_finite,message:s.message}),r.dirty()):e.assertNever(s);return{status:r.value,value:t.data}}gte(e,t){return this.setLimit("min",e,!0,g.toString(t))}gt(e,t){return this.setLimit("min",e,!1,g.toString(t))}lte(e,t){return this.setLimit("max",e,!0,g.toString(t))}lt(e,t){return this.setLimit("max",e,!1,g.toString(t))}setLimit(e,t,s,a){return new R({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:s,message:g.toString(a)}]})}_addCheck(e){return new R({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:g.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:g.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:g.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:g.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:g.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:g.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:g.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:g.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:g.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 s of this._def.checks){if("finite"===s.kind||"int"===s.kind||"multipleOf"===s.kind)return!0;"min"===s.kind?(null===t||s.value>t)&&(t=s.value):"max"===s.kind&&(null===e||s.value<e)&&(e=s.value)}return Number.isFinite(t)&&Number.isFinite(e)}}R.create=e=>new R({checks:[],typeName:ke.ZodNumber,coerce:(null==e?void 0:e.coerce)||!1,...k(e)});class A extends w{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(t){this._def.coerce&&(t.data=BigInt(t.data));if(this._getType(t)!==s.bigint){const e=this._getOrReturnCtx(t);return u(e,{code:n.invalid_type,expected:s.bigint,received:e.parsedType}),p}let a;const r=new l;for(const s of this._def.checks)if("min"===s.kind){(s.inclusive?t.data<s.value:t.data<=s.value)&&(a=this._getOrReturnCtx(t,a),u(a,{code:n.too_small,type:"bigint",minimum:s.value,inclusive:s.inclusive,message:s.message}),r.dirty())}else if("max"===s.kind){(s.inclusive?t.data>s.value:t.data>=s.value)&&(a=this._getOrReturnCtx(t,a),u(a,{code:n.too_big,type:"bigint",maximum:s.value,inclusive:s.inclusive,message:s.message}),r.dirty())}else"multipleOf"===s.kind?t.data%s.value!==BigInt(0)&&(a=this._getOrReturnCtx(t,a),u(a,{code:n.not_multiple_of,multipleOf:s.value,message:s.message}),r.dirty()):e.assertNever(s);return{status:r.value,value:t.data}}gte(e,t){return this.setLimit("min",e,!0,g.toString(t))}gt(e,t){return this.setLimit("min",e,!1,g.toString(t))}lte(e,t){return this.setLimit("max",e,!0,g.toString(t))}lt(e,t){return this.setLimit("max",e,!1,g.toString(t))}setLimit(e,t,s,a){return new A({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:s,message:g.toString(a)}]})}_addCheck(e){return new A({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:g.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:g.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:g.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:g.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:g.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}}A.create=e=>{var t;return new A({checks:[],typeName:ke.ZodBigInt,coerce:null!==(t=null==e?void 0:e.coerce)&&void 0!==t&&t,...k(e)})};class $ extends w{_parse(e){this._def.coerce&&(e.data=Boolean(e.data));if(this._getType(e)!==s.boolean){const t=this._getOrReturnCtx(e);return u(t,{code:n.invalid_type,expected:s.boolean,received:t.parsedType}),p}return m(e.data)}}$.create=e=>new $({typeName:ke.ZodBoolean,coerce:(null==e?void 0:e.coerce)||!1,...k(e)});class M extends w{_parse(t){this._def.coerce&&(t.data=new Date(t.data));if(this._getType(t)!==s.date){const e=this._getOrReturnCtx(t);return u(e,{code:n.invalid_type,expected:s.date,received:e.parsedType}),p}if(isNaN(t.data.getTime())){return u(this._getOrReturnCtx(t),{code:n.invalid_date}),p}const a=new l;let r;for(const s of this._def.checks)"min"===s.kind?t.data.getTime()<s.value&&(r=this._getOrReturnCtx(t,r),u(r,{code:n.too_small,message:s.message,inclusive:!0,exact:!1,minimum:s.value,type:"date"}),a.dirty()):"max"===s.kind?t.data.getTime()>s.value&&(r=this._getOrReturnCtx(t,r),u(r,{code:n.too_big,message:s.message,inclusive:!0,exact:!1,maximum:s.value,type:"date"}),a.dirty()):e.assertNever(s);return{status:a.value,value:new Date(t.data.getTime())}}_addCheck(e){return new M({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:g.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:g.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}}M.create=e=>new M({checks:[],coerce:(null==e?void 0:e.coerce)||!1,typeName:ke.ZodDate,...k(e)});class L extends w{_parse(e){if(this._getType(e)!==s.symbol){const t=this._getOrReturnCtx(e);return u(t,{code:n.invalid_type,expected:s.symbol,received:t.parsedType}),p}return m(e.data)}}L.create=e=>new L({typeName:ke.ZodSymbol,...k(e)});class D extends w{_parse(e){if(this._getType(e)!==s.undefined){const t=this._getOrReturnCtx(e);return u(t,{code:n.invalid_type,expected:s.undefined,received:t.parsedType}),p}return m(e.data)}}D.create=e=>new D({typeName:ke.ZodUndefined,...k(e)});class V extends w{_parse(e){if(this._getType(e)!==s.null){const t=this._getOrReturnCtx(e);return u(t,{code:n.invalid_type,expected:s.null,received:t.parsedType}),p}return m(e.data)}}V.create=e=>new V({typeName:ke.ZodNull,...k(e)});class z extends w{constructor(){super(...arguments),this._any=!0}_parse(e){return m(e.data)}}z.create=e=>new z({typeName:ke.ZodAny,...k(e)});class U extends w{constructor(){super(...arguments),this._unknown=!0}_parse(e){return m(e.data)}}U.create=e=>new U({typeName:ke.ZodUnknown,...k(e)});class K extends w{_parse(e){const t=this._getOrReturnCtx(e);return u(t,{code:n.invalid_type,expected:s.never,received:t.parsedType}),p}}K.create=e=>new K({typeName:ke.ZodNever,...k(e)});class B extends w{_parse(e){if(this._getType(e)!==s.undefined){const t=this._getOrReturnCtx(e);return u(t,{code:n.invalid_type,expected:s.void,received:t.parsedType}),p}return m(e.data)}}B.create=e=>new B({typeName:ke.ZodVoid,...k(e)});class F extends w{_parse(e){const{ctx:t,status:a}=this._processInputParams(e),r=this._def;if(t.parsedType!==s.array)return u(t,{code:n.invalid_type,expected:s.array,received:t.parsedType}),p;if(null!==r.exactLength){const e=t.data.length>r.exactLength.value,s=t.data.length<r.exactLength.value;(e||s)&&(u(t,{code:e?n.too_big:n.too_small,minimum:s?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&&(u(t,{code:n.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&&(u(t,{code:n.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,s)=>r.type._parseAsync(new x(t,e,t.path,s))))).then((e=>l.mergeArray(a,e)));const i=[...t.data].map(((e,s)=>r.type._parseSync(new x(t,e,t.path,s))));return l.mergeArray(a,i)}get element(){return this._def.type}min(e,t){return new F({...this._def,minLength:{value:e,message:g.toString(t)}})}max(e,t){return new F({...this._def,maxLength:{value:e,message:g.toString(t)}})}length(e,t){return new F({...this._def,exactLength:{value:e,message:g.toString(t)}})}nonempty(e){return this.min(1,e)}}function W(e){if(e instanceof q){const t={};for(const s in e.shape){const a=e.shape[s];t[s]=le.create(W(a))}return new q({...e._def,shape:()=>t})}return e instanceof F?new F({...e._def,type:W(e.element)}):e instanceof le?le.create(W(e.unwrap())):e instanceof pe?pe.create(W(e.unwrap())):e instanceof Q?Q.create(e.items.map((e=>W(e)))):e}F.create=(e,t)=>new F({type:e,minLength:null,maxLength:null,exactLength:null,typeName:ke.ZodArray,...k(t)});class q extends w{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(),s=e.objectKeys(t);return this._cached={shape:t,keys:s}}_parse(e){if(this._getType(e)!==s.object){const t=this._getOrReturnCtx(e);return u(t,{code:n.invalid_type,expected:s.object,received:t.parsedType}),p}const{status:t,ctx:a}=this._processInputParams(e),{shape:r,keys:i}=this._getCached(),o=[];if(!(this._def.catchall instanceof K&&"strip"===this._def.unknownKeys))for(const e in a.data)i.includes(e)||o.push(e);const d=[];for(const e of i){const t=r[e],s=a.data[e];d.push({key:{status:"valid",value:e},value:t._parse(new x(a,s,a.path,e)),alwaysSet:e in a.data})}if(this._def.catchall instanceof K){const e=this._def.unknownKeys;if("passthrough"===e)for(const e of o)d.push({key:{status:"valid",value:e},value:{status:"valid",value:a.data[e]}});else if("strict"===e)o.length>0&&(u(a,{code:n.unrecognized_keys,keys:o}),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 o){const s=a.data[t];d.push({key:{status:"valid",value:t},value:e._parse(new x(a,s,a.path,t)),alwaysSet:t in a.data})}}return a.common.async?Promise.resolve().then((async()=>{const e=[];for(const t of d){const s=await t.key;e.push({key:s,value:await t.value,alwaysSet:t.alwaysSet})}return e})).then((e=>l.mergeObjectSync(t,e))):l.mergeObjectSync(t,d)}get shape(){return this._def.shape()}strict(e){return g.errToObj,new q({...this._def,unknownKeys:"strict",...void 0!==e?{errorMap:(t,s)=>{var a,n,r,i;const o=null!==(r=null===(n=(a=this._def).errorMap)||void 0===n?void 0:n.call(a,t,s).message)&&void 0!==r?r:s.defaultError;return"unrecognized_keys"===t.code?{message:null!==(i=g.errToObj(e).message)&&void 0!==i?i:o}:{message:o}}}:{}})}strip(){return new q({...this._def,unknownKeys:"strip"})}passthrough(){return new q({...this._def,unknownKeys:"passthrough"})}extend(e){return new q({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new q({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 q({...this._def,catchall:e})}pick(t){const s={};return e.objectKeys(t).forEach((e=>{t[e]&&this.shape[e]&&(s[e]=this.shape[e])})),new q({...this._def,shape:()=>s})}omit(t){const s={};return e.objectKeys(this.shape).forEach((e=>{t[e]||(s[e]=this.shape[e])})),new q({...this._def,shape:()=>s})}deepPartial(){return W(this)}partial(t){const s={};return e.objectKeys(this.shape).forEach((e=>{const a=this.shape[e];t&&!t[e]?s[e]=a:s[e]=a.optional()})),new q({...this._def,shape:()=>s})}required(t){const s={};return e.objectKeys(this.shape).forEach((e=>{if(t&&!t[e])s[e]=this.shape[e];else{let t=this.shape[e];for(;t instanceof le;)t=t._def.innerType;s[e]=t}})),new q({...this._def,shape:()=>s})}keyof(){return ie(e.objectKeys(this.shape))}}q.create=(e,t)=>new q({shape:()=>e,unknownKeys:"strip",catchall:K.create(),typeName:ke.ZodObject,...k(t)}),q.strictCreate=(e,t)=>new q({shape:()=>e,unknownKeys:"strict",catchall:K.create(),typeName:ke.ZodObject,...k(t)}),q.lazycreate=(e,t)=>new q({shape:e,unknownKeys:"strip",catchall:K.create(),typeName:ke.ZodObject,...k(t)});class Y extends w{_parse(e){const{ctx:t}=this._processInputParams(e),s=this._def.options;if(t.common.async)return Promise.all(s.map((async e=>{const s={...t,common:{...t.common,issues:[]},parent:null};return{result:await e._parseAsync({data:t.data,path:t.path,parent:s}),ctx:s}}))).then((function(e){for(const t of e)if("valid"===t.result.status)return t.result;for(const s of e)if("dirty"===s.result.status)return t.common.issues.push(...s.ctx.common.issues),s.result;const s=e.map((e=>new r(e.ctx.common.issues)));return u(t,{code:n.invalid_union,unionErrors:s}),p}));{let e;const a=[];for(const n of s){const s={...t,common:{...t.common,issues:[]},parent:null},r=n._parseSync({data:t.data,path:t.path,parent:s});if("valid"===r.status)return r;"dirty"!==r.status||e||(e={result:r,ctx:s}),s.common.issues.length&&a.push(s.common.issues)}if(e)return t.common.issues.push(...e.ctx.common.issues),e.result;const i=a.map((e=>new r(e)));return u(t,{code:n.invalid_union,unionErrors:i}),p}}get options(){return this._def.options}}Y.create=(e,t)=>new Y({options:e,typeName:ke.ZodUnion,...k(t)});const J=e=>e instanceof ne?J(e.schema):e instanceof ue?J(e.innerType()):e instanceof re?[e.value]:e instanceof oe?e.options:e instanceof de?Object.keys(e.enum):e instanceof he?J(e._def.innerType):e instanceof D?[void 0]:e instanceof V?[null]:null;class H extends w{_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==s.object)return u(t,{code:n.invalid_type,expected:s.object,received:t.parsedType}),p;const a=this.discriminator,r=t.data[a],i=this.optionsMap.get(r);return i?t.common.async?i._parseAsync({data:t.data,path:t.path,parent:t}):i._parseSync({data:t.data,path:t.path,parent:t}):(u(t,{code:n.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[a]}),p)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,s){const a=new Map;for(const s of t){const t=J(s.shape[e]);if(!t)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const n of t){if(a.has(n))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(n)}`);a.set(n,s)}}return new H({typeName:ke.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:a,...k(s)})}}function G(t,n){const r=a(t),i=a(n);if(t===n)return{valid:!0,data:t};if(r===s.object&&i===s.object){const s=e.objectKeys(n),a=e.objectKeys(t).filter((e=>-1!==s.indexOf(e))),r={...t,...n};for(const e of a){const s=G(t[e],n[e]);if(!s.valid)return{valid:!1};r[e]=s.data}return{valid:!0,data:r}}if(r===s.array&&i===s.array){if(t.length!==n.length)return{valid:!1};const e=[];for(let s=0;s<t.length;s++){const a=G(t[s],n[s]);if(!a.valid)return{valid:!1};e.push(a.data)}return{valid:!0,data:e}}return r===s.date&&i===s.date&&+t==+n?{valid:!0,data:t}:{valid:!1}}class X extends w{_parse(e){const{status:t,ctx:s}=this._processInputParams(e),a=(e,a)=>{if(f(e)||f(a))return p;const r=G(e.value,a.value);return r.valid?((y(e)||y(a))&&t.dirty(),{status:t.value,value:r.data}):(u(s,{code:n.invalid_intersection_types}),p)};return s.common.async?Promise.all([this._def.left._parseAsync({data:s.data,path:s.path,parent:s}),this._def.right._parseAsync({data:s.data,path:s.path,parent:s})]).then((([e,t])=>a(e,t))):a(this._def.left._parseSync({data:s.data,path:s.path,parent:s}),this._def.right._parseSync({data:s.data,path:s.path,parent:s}))}}X.create=(e,t,s)=>new X({left:e,right:t,typeName:ke.ZodIntersection,...k(s)});class Q extends w{_parse(e){const{status:t,ctx:a}=this._processInputParams(e);if(a.parsedType!==s.array)return u(a,{code:n.invalid_type,expected:s.array,received:a.parsedType}),p;if(a.data.length<this._def.items.length)return u(a,{code:n.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),p;!this._def.rest&&a.data.length>this._def.items.length&&(u(a,{code:n.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());const r=[...a.data].map(((e,t)=>{const s=this._def.items[t]||this._def.rest;return s?s._parse(new x(a,e,a.path,t)):null})).filter((e=>!!e));return a.common.async?Promise.all(r).then((e=>l.mergeArray(t,e))):l.mergeArray(t,r)}get items(){return this._def.items}rest(e){return new Q({...this._def,rest:e})}}Q.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Q({items:e,typeName:ke.ZodTuple,rest:null,...k(t)})};class ee extends w{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!==s.object)return u(a,{code:n.invalid_type,expected:s.object,received:a.parsedType}),p;const r=[],i=this._def.keyType,o=this._def.valueType;for(const e in a.data)r.push({key:i._parse(new x(a,e,a.path,e)),value:o._parse(new x(a,a.data[e],a.path,e))});return a.common.async?l.mergeObjectAsync(t,r):l.mergeObjectSync(t,r)}get element(){return this._def.valueType}static create(e,t,s){return new ee(t instanceof w?{keyType:e,valueType:t,typeName:ke.ZodRecord,...k(s)}:{keyType:P.create(),valueType:e,typeName:ke.ZodRecord,...k(t)})}}class te extends w{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!==s.map)return u(a,{code:n.invalid_type,expected:s.map,received:a.parsedType}),p;const r=this._def.keyType,i=this._def.valueType,o=[...a.data.entries()].map((([e,t],s)=>({key:r._parse(new x(a,e,a.path,[s,"key"])),value:i._parse(new x(a,t,a.path,[s,"value"]))})));if(a.common.async){const e=new Map;return Promise.resolve().then((async()=>{for(const s of o){const a=await s.key,n=await s.value;if("aborted"===a.status||"aborted"===n.status)return p;"dirty"!==a.status&&"dirty"!==n.status||t.dirty(),e.set(a.value,n.value)}return{status:t.value,value:e}}))}{const e=new Map;for(const s of o){const a=s.key,n=s.value;if("aborted"===a.status||"aborted"===n.status)return p;"dirty"!==a.status&&"dirty"!==n.status||t.dirty(),e.set(a.value,n.value)}return{status:t.value,value:e}}}}te.create=(e,t,s)=>new te({valueType:t,keyType:e,typeName:ke.ZodMap,...k(s)});class se extends w{_parse(e){const{status:t,ctx:a}=this._processInputParams(e);if(a.parsedType!==s.set)return u(a,{code:n.invalid_type,expected:s.set,received:a.parsedType}),p;const r=this._def;null!==r.minSize&&a.data.size<r.minSize.value&&(u(a,{code:n.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&&(u(a,{code:n.too_big,maximum:r.maxSize.value,type:"set",inclusive:!0,exact:!1,message:r.maxSize.message}),t.dirty());const i=this._def.valueType;function o(e){const s=new Set;for(const a of e){if("aborted"===a.status)return p;"dirty"===a.status&&t.dirty(),s.add(a.value)}return{status:t.value,value:s}}const d=[...a.data.values()].map(((e,t)=>i._parse(new x(a,e,a.path,t))));return a.common.async?Promise.all(d).then((e=>o(e))):o(d)}min(e,t){return new se({...this._def,minSize:{value:e,message:g.toString(t)}})}max(e,t){return new se({...this._def,maxSize:{value:e,message:g.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}se.create=(e,t)=>new se({valueType:e,minSize:null,maxSize:null,typeName:ke.ZodSet,...k(t)});class ae extends w{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==s.function)return u(t,{code:n.invalid_type,expected:s.function,received:t.parsedType}),p;function a(e,s){return c({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,d(),i].filter((e=>!!e)),issueData:{code:n.invalid_arguments,argumentsError:s}})}function o(e,s){return c({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,d(),i].filter((e=>!!e)),issueData:{code:n.invalid_return_type,returnTypeError:s}})}const l={errorMap:t.common.contextualErrorMap},h=t.data;if(this._def.returns instanceof ce){const e=this;return m((async function(...t){const s=new r([]),n=await e._def.args.parseAsync(t,l).catch((e=>{throw s.addIssue(a(t,e)),s})),i=await Reflect.apply(h,this,n);return await e._def.returns._def.type.parseAsync(i,l).catch((e=>{throw s.addIssue(o(i,e)),s}))}))}{const e=this;return m((function(...t){const s=e._def.args.safeParse(t,l);if(!s.success)throw new r([a(t,s.error)]);const n=Reflect.apply(h,this,s.data),i=e._def.returns.safeParse(n,l);if(!i.success)throw new r([o(n,i.error)]);return i.data}))}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new ae({...this._def,args:Q.create(e).rest(U.create())})}returns(e){return new ae({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,s){return new ae({args:e||Q.create([]).rest(U.create()),returns:t||U.create(),typeName:ke.ZodFunction,...k(s)})}}class ne extends w{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})}}ne.create=(e,t)=>new ne({getter:e,typeName:ke.ZodLazy,...k(t)});class re extends w{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return u(t,{received:t.data,code:n.invalid_literal,expected:this._def.value}),p}return{status:"valid",value:e.data}}get value(){return this._def.value}}function ie(e,t){return new oe({values:e,typeName:ke.ZodEnum,...k(t)})}re.create=(e,t)=>new re({value:e,typeName:ke.ZodLiteral,...k(t)});class oe extends w{_parse(t){if("string"!=typeof t.data){const s=this._getOrReturnCtx(t),a=this._def.values;return u(s,{expected:e.joinValues(a),received:s.parsedType,code:n.invalid_type}),p}if(-1===this._def.values.indexOf(t.data)){const e=this._getOrReturnCtx(t),s=this._def.values;return u(e,{received:e.data,code:n.invalid_enum_value,options:s}),p}return m(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){return oe.create(e)}exclude(e){return oe.create(this.options.filter((t=>!e.includes(t))))}}oe.create=ie;class de extends w{_parse(t){const a=e.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(t);if(r.parsedType!==s.string&&r.parsedType!==s.number){const t=e.objectValues(a);return u(r,{expected:e.joinValues(t),received:r.parsedType,code:n.invalid_type}),p}if(-1===a.indexOf(t.data)){const t=e.objectValues(a);return u(r,{received:r.data,code:n.invalid_enum_value,options:t}),p}return m(t.data)}get enum(){return this._def.values}}de.create=(e,t)=>new de({values:e,typeName:ke.ZodNativeEnum,...k(t)});class ce extends w{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==s.promise&&!1===t.common.async)return u(t,{code:n.invalid_type,expected:s.promise,received:t.parsedType}),p;const a=t.parsedType===s.promise?t.data:Promise.resolve(t.data);return m(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,...k(t)});class ue extends w{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:s,ctx:a}=this._processInputParams(t),n=this._def.effect||null,r={addIssue:e=>{u(a,e),e.fatal?s.abort():s.dirty()},get path(){return a.path}};if(r.addIssue=r.addIssue.bind(r),"preprocess"===n.type){const e=n.transform(a.data,r);return a.common.issues.length?{status:"dirty",value:a.data}:a.common.async?Promise.resolve(e).then((e=>this._def.schema._parseAsync({data:e,path:a.path,parent:a}))):this._def.schema._parseSync({data:e,path:a.path,parent:a})}if("refinement"===n.type){const e=e=>{const t=n.refinement(e,r);if(a.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===a.common.async){const t=this._def.schema._parseSync({data:a.data,path:a.path,parent:a});return"aborted"===t.status?p:("dirty"===t.status&&s.dirty(),e(t.value),{status:s.value,value:t.value})}return this._def.schema._parseAsync({data:a.data,path:a.path,parent:a}).then((t=>"aborted"===t.status?p:("dirty"===t.status&&s.dirty(),e(t.value).then((()=>({status:s.value,value:t.value}))))))}if("transform"===n.type){if(!1===a.common.async){const e=this._def.schema._parseSync({data:a.data,path:a.path,parent:a});if(!_(e))return e;const t=n.transform(e.value,r);if(t instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:s.value,value:t}}return this._def.schema._parseAsync({data:a.data,path:a.path,parent:a}).then((e=>_(e)?Promise.resolve(n.transform(e.value,r)).then((e=>({status:s.value,value:e}))):e))}e.assertNever(n)}}ue.create=(e,t,s)=>new ue({schema:e,typeName:ke.ZodEffects,effect:t,...k(s)}),ue.createWithPreprocess=(e,t,s)=>new ue({schema:t,effect:{type:"preprocess",transform:e},typeName:ke.ZodEffects,...k(s)});class le extends w{_parse(e){return this._getType(e)===s.undefined?m(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}le.create=(e,t)=>new le({innerType:e,typeName:ke.ZodOptional,...k(t)});class pe extends w{_parse(e){return this._getType(e)===s.null?m(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}pe.create=(e,t)=>new pe({innerType:e,typeName:ke.ZodNullable,...k(t)});class he extends w{_parse(e){const{ctx:t}=this._processInputParams(e);let a=t.data;return t.parsedType===s.undefined&&(a=this._def.defaultValue()),this._def.innerType._parse({data:a,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}he.create=(e,t)=>new he({innerType:e,typeName:ke.ZodDefault,defaultValue:"function"==typeof t.default?t.default:()=>t.default,...k(t)});class me extends w{_parse(e){const{ctx:t}=this._processInputParams(e),s={...t,common:{...t.common,issues:[]}},a=this._def.innerType._parse({data:s.data,path:s.path,parent:{...s}});return v(a)?a.then((e=>({status:"valid",value:"valid"===e.status?e.value:this._def.catchValue({get error(){return new r(s.common.issues)},input:s.data})}))):{status:"valid",value:"valid"===a.status?a.value:this._def.catchValue({get error(){return new r(s.common.issues)},input:s.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,...k(t)});class fe extends w{_parse(e){if(this._getType(e)!==s.nan){const t=this._getOrReturnCtx(e);return u(t,{code:n.invalid_type,expected:s.nan,received:t.parsedType}),p}return{status:"valid",value:e.data}}}fe.create=e=>new fe({typeName:ke.ZodNaN,...k(e)});const ye=Symbol("zod_brand");class _e extends w{_parse(e){const{ctx:t}=this._processInputParams(e),s=t.data;return this._def.type._parse({data:s,path:t.path,parent:t})}unwrap(){return this._def.type}}class ve extends w{_parse(e){const{status:t,ctx:s}=this._processInputParams(e);if(s.common.async){return(async()=>{const e=await this._def.in._parseAsync({data:s.data,path:s.path,parent:s});return"aborted"===e.status?p:"dirty"===e.status?(t.dirty(),h(e.value)):this._def.out._parseAsync({data:e.value,path:s.path,parent:s})})()}{const e=this._def.in._parseSync({data:s.data,path:s.path,parent:s});return"aborted"===e.status?p:"dirty"===e.status?(t.dirty(),{status:"dirty",value:e.value}):this._def.out._parseSync({data:e.value,path:s.path,parent:s})}}static create(e,t){return new ve({in:e,out:t,typeName:ke.ZodPipeline})}}class ge extends w{_parse(e){const t=this._def.innerType._parse(e);return _(t)&&(t.value=Object.freeze(t.value)),t}}ge.create=(e,t)=>new ge({innerType:e,typeName:ke.ZodReadonly,...k(t)});const xe=(e,t={},s)=>e?z.create().superRefine(((a,n)=>{var r,i;if(!e(a)){const e="function"==typeof t?t(a):"string"==typeof t?{message:t}:t,o=null===(i=null!==(r=e.fatal)&&void 0!==r?r:s)||void 0===i||i,d="string"==typeof e?{message:e}:e;n.addIssue({code:"custom",...d,fatal:o})}})):z.create(),be={object:q.lazycreate};var ke;!function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"}(ke||(ke={}));const we=P.create,Ze=R.create,Te=fe.create,Ee=A.create,Se=$.create,Oe=M.create,Ne=L.create,je=D.create,Ce=V.create,Pe=z.create,Ie=U.create,Re=K.create,Ae=B.create,$e=F.create,Me=q.create,Le=q.strictCreate,De=Y.create,Ve=H.create,ze=X.create,Ue=Q.create,Ke=ee.create,Be=te.create,Fe=se.create,We=ae.create,qe=ne.create,Ye=re.create,Je=oe.create,He=de.create,Ge=ce.create,Xe=ue.create,Qe=le.create,et=pe.create,tt=ue.createWithPreprocess,st=ve.create,at={string:e=>P.create({...e,coerce:!0}),number:e=>R.create({...e,coerce:!0}),boolean:e=>$.create({...e,coerce:!0}),bigint:e=>A.create({...e,coerce:!0}),date:e=>M.create({...e,coerce:!0})},nt=p;var rt=Object.freeze({__proto__:null,defaultErrorMap:i,setErrorMap:function(e){o=e},getErrorMap:d,makeIssue:c,EMPTY_PATH:[],addIssueToContext:u,ParseStatus:l,INVALID:p,DIRTY:h,OK:m,isAborted:f,isDirty:y,isValid:_,isAsync:v,get util(){return e},get objectUtil(){return t},ZodParsedType:s,getParsedType:a,ZodType:w,ZodString:P,ZodNumber:R,ZodBigInt:A,ZodBoolean:$,ZodDate:M,ZodSymbol:L,ZodUndefined:D,ZodNull:V,ZodAny:z,ZodUnknown:U,ZodNever:K,ZodVoid:B,ZodArray:F,ZodObject:q,ZodUnion:Y,ZodDiscriminatedUnion:H,ZodIntersection:X,ZodTuple:Q,ZodRecord:ee,ZodMap:te,ZodSet:se,ZodFunction:ae,ZodLazy:ne,ZodLiteral:re,ZodEnum:oe,ZodNativeEnum:de,ZodPromise:ce,ZodEffects:ue,ZodTransformer:ue,ZodOptional:le,ZodNullable:pe,ZodDefault:he,ZodCatch:me,ZodNaN:fe,BRAND:ye,ZodBranded:_e,ZodPipeline:ve,ZodReadonly:ge,custom:xe,Schema:w,ZodSchema:w,late:be,get ZodFirstPartyTypeKind(){return ke},coerce:at,any:Pe,array:$e,bigint:Ee,boolean:Se,date:Oe,discriminatedUnion:Ve,effect:Xe,enum:Je,function:We,instanceof:(e,t={message:`Input not instance of ${e.name}`})=>xe((t=>t instanceof e),t),intersection:ze,lazy:qe,literal:Ye,map:Be,nan:Te,nativeEnum:He,never:Re,null:Ce,nullable:et,number:Ze,object:Me,oboolean:()=>Se().optional(),onumber:()=>Ze().optional(),optional:Qe,ostring:()=>we().optional(),pipeline:st,preprocess:tt,promise:Ge,record:Ke,set:Fe,strictObject:Le,string:we,symbol:Ne,transformer:Xe,tuple:Ue,undefined:je,union:De,unknown:Ie,void:Ae,NEVER:nt,ZodIssueCode:n,quotelessJson:e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:"),ZodError:r}),it=["interface","display","layout","module","panel","theme"],ot=["hook","endpoint"],dt=["operation"],ct=rt.object({app:rt.string(),api:rt.string()}),ut=rt.object({request:rt.optional(rt.object({urls:rt.array(rt.string()),methods:rt.array(rt.union([rt.literal("GET"),rt.literal("POST"),rt.literal("PATCH"),rt.literal("PUT"),rt.literal("DELETE")]))})),log:rt.optional(rt.object({})),sleep:rt.optional(rt.object({}))}),lt=rt.optional(rt.object({enabled:rt.boolean(),requestedScopes:ut})),pt=rt.union([rt.object({type:rt.enum(ot),name:rt.string(),source:rt.string()}),rt.object({type:rt.enum(it),name:rt.string(),source:rt.string()}),rt.object({type:rt.enum(dt),name:rt.string(),source:ct})]),ht=rt.object({host:rt.string(),hidden:rt.boolean().optional()}),mt=rt.object({type:rt.enum(it),path:rt.string(),source:rt.string()}),ft=rt.object({type:rt.enum(ot),path:rt.string(),source:rt.string(),sandbox:lt}),yt=rt.object({type:rt.enum(dt),path:ct,source:ct,sandbox:lt}),_t=rt.object({type:rt.literal("bundle"),path:ct,entries:rt.array(pt)});rt.array(pt);var vt=ht.and(rt.union([mt,ft,yt,_t]));rt.object({name:rt.string(),version:rt.string(),type:rt.union([rt.literal("module"),rt.literal("commonjs")]).optional(),description:rt.string().optional(),icon:rt.string().optional(),dependencies:rt.record(rt.string()).optional(),devDependencies:rt.record(rt.string()).optional(),"directus:extension":vt});const gt=[],xt=[],bt=[{name:"typesense-upsert",config:{id:"okam-typesense-upsert",handler:({collection:e,item:t,host_override:s,apikey_override:a})=>{const n=s||String(process.env.TYPESENSE_HOST),r=a||String(process.env.TYPESENSE_APIKEY_WRITE);if(!n||!r)return[];const i=null!==t&&"object"==typeof t?[t]:Array.isArray(t)?t:[];if(!i.length)return[];const o=`${n}/collections/${e}/documents?action=upsert`,d=i.map((e=>fetch(o,{method:"post",headers:{"X-TYPESENSE-API-KEY":r},body:JSON.stringify(e)}).then((e=>e.json())).catch((()=>null))));return Promise.all(d)}}},{name:"okam-typesense-delete",config:{id:"custom",handler:({collection:e,item:t,host_override:s,apikey_override:a})=>{const n=s||String(process.env.TYPESENSE_HOST),r=a||String(process.env.TYPESENSE_APIKEY_WRITE);if(!n||!r)return[];const i=null!==t&&"object"==typeof t?[t]:Array.isArray(t)?t:[];if(!i.length)return[];const o=`${n}/collections/${e}/documents`,d=i.map((({id:e})=>fetch(`${o}/${e}`,{method:"DELETE",headers:{"X-TYPESENSE-API-KEY":r}}).then((e=>e.json())).catch((()=>null))));return Promise.all(d)}}}];export{xt as endpoints,gt as hooks,bt as operations};
var e,t;!function(e){e.assertEqual=e=>e,e.assertIs=function(e){},e.assertNever=function(e){throw new Error},e.arrayToEnum=e=>{const t={};for(const s of e)t[s]=s;return t},e.getValidEnumValues=t=>{const s=e.objectKeys(t).filter((e=>"number"!=typeof t[t[e]])),a={};for(const e of s)a[e]=t[e];return e.objectValues(a)},e.objectValues=t=>e.objectKeys(t).map((function(e){return t[e]})),e.objectKeys="function"==typeof Object.keys?e=>Object.keys(e):e=>{const t=[];for(const s in e)Object.prototype.hasOwnProperty.call(e,s)&&t.push(s);return t},e.find=(e,t)=>{for(const s of e)if(t(s))return s},e.isInteger="function"==typeof Number.isInteger?e=>Number.isInteger(e):e=>"number"==typeof e&&isFinite(e)&&Math.floor(e)===e,e.joinValues=function(e,t=" | "){return e.map((e=>"string"==typeof e?`'${e}'`:e)).join(t)},e.jsonStringifyReplacer=(e,t)=>"bigint"==typeof t?t.toString():t}(e||(e={})),function(e){e.mergeShapes=(e,t)=>({...e,...t})}(t||(t={}));const s=e.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),a=e=>{switch(typeof e){case"undefined":return s.undefined;case"string":return s.string;case"number":return isNaN(e)?s.nan:s.number;case"boolean":return s.boolean;case"function":return s.function;case"bigint":return s.bigint;case"symbol":return s.symbol;case"object":return Array.isArray(e)?s.array:null===e?s.null:e.then&&"function"==typeof e.then&&e.catch&&"function"==typeof e.catch?s.promise:"undefined"!=typeof Map&&e instanceof Map?s.map:"undefined"!=typeof Set&&e instanceof Set?s.set:"undefined"!=typeof Date&&e instanceof Date?s.date:s.object;default:return s.unknown}},n=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"]);class r extends Error{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}get errors(){return this.issues}format(e){const t=e||function(e){return e.message},s={_errors:[]},a=e=>{for(const n of e.issues)if("invalid_union"===n.code)n.unionErrors.map(a);else if("invalid_return_type"===n.code)a(n.returnTypeError);else if("invalid_arguments"===n.code)a(n.argumentsError);else if(0===n.path.length)s._errors.push(t(n));else{let e=s,a=0;for(;a<n.path.length;){const s=n.path[a];a===n.path.length-1?(e[s]=e[s]||{_errors:[]},e[s]._errors.push(t(n))):e[s]=e[s]||{_errors:[]},e=e[s],a++}}};return a(this),s}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={},s=[];for(const a of this.issues)a.path.length>0?(t[a.path[0]]=t[a.path[0]]||[],t[a.path[0]].push(e(a))):s.push(e(a));return{formErrors:s,fieldErrors:t}}get formErrors(){return this.flatten()}}r.create=e=>new r(e);const i=(t,a)=>{let r;switch(t.code){case n.invalid_type:r=t.received===s.undefined?"Required":`Expected ${t.expected}, received ${t.received}`;break;case n.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(t.expected,e.jsonStringifyReplacer)}`;break;case n.unrecognized_keys:r=`Unrecognized key(s) in object: ${e.joinValues(t.keys,", ")}`;break;case n.invalid_union:r="Invalid input";break;case n.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${e.joinValues(t.options)}`;break;case n.invalid_enum_value:r=`Invalid enum value. Expected ${e.joinValues(t.options)}, received '${t.received}'`;break;case n.invalid_arguments:r="Invalid function arguments";break;case n.invalid_return_type:r="Invalid function return type";break;case n.invalid_date:r="Invalid date";break;case n.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 n.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?`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 n.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 n.custom:r="Invalid input";break;case n.invalid_intersection_types:r="Intersection results could not be merged";break;case n.not_multiple_of:r=`Number must be a multiple of ${t.multipleOf}`;break;case n.not_finite:r="Number must be finite";break;default:r=a.defaultError,e.assertNever(t)}return{message:r}};let o=i;function d(){return o}const c=e=>{const{data:t,path:s,errorMaps:a,issueData:n}=e,r=[...s,...n.path||[]],i={...n,path:r};let o="";const d=a.filter((e=>!!e)).slice().reverse();for(const e of d)o=e(i,{data:t,defaultError:o}).message;return{...n,path:r,message:n.message||o}};function u(e,t){const s=c({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,d(),i].filter((e=>!!e))});e.common.issues.push(s)}class l{constructor(){this.value="valid"}dirty(){"valid"===this.value&&(this.value="dirty")}abort(){"aborted"!==this.value&&(this.value="aborted")}static mergeArray(e,t){const s=[];for(const a of t){if("aborted"===a.status)return p;"dirty"===a.status&&e.dirty(),s.push(a.value)}return{status:e.value,value:s}}static async mergeObjectAsync(e,t){const s=[];for(const e of t)s.push({key:await e.key,value:await e.value});return l.mergeObjectSync(e,s)}static mergeObjectSync(e,t){const s={};for(const a of t){const{key:t,value:n}=a;if("aborted"===t.status)return p;if("aborted"===n.status)return p;"dirty"===t.status&&e.dirty(),"dirty"===n.status&&e.dirty(),"__proto__"===t.value||void 0===n.value&&!a.alwaysSet||(s[t.value]=n.value)}return{status:e.value,value:s}}}const p=Object.freeze({status:"aborted"}),h=e=>({status:"dirty",value:e}),m=e=>({status:"valid",value:e}),f=e=>"aborted"===e.status,y=e=>"dirty"===e.status,_=e=>"valid"===e.status,v=e=>"undefined"!=typeof Promise&&e instanceof Promise;var g;!function(e){e.errToObj=e=>"string"==typeof e?{message:e}:e||{},e.toString=e=>"string"==typeof e?e:null==e?void 0:e.message}(g||(g={}));class x{constructor(e,t,s,a){this._cachedPath=[],this.parent=e,this.data=t,this._path=s,this._key=a}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const b=(e,t)=>{if(_(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 r(e.common.issues);return this._error=t,this._error}}};function k(e){if(!e)return{};const{errorMap:t,invalid_type_error:s,required_error:a,description:n}=e;if(t&&(s||a))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:(e,t)=>"invalid_type"!==e.code?{message:t.defaultError}:void 0===t.data?{message:null!=a?a:t.defaultError}:{message:null!=s?s:t.defaultError},description:n}}class w{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)}get description(){return this._def.description}_getType(e){return a(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:a(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new l,ctx:{common:e.parent.common,data:e.data,parsedType:a(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(v(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 s=this.safeParse(e,t);if(s.success)return s.data;throw s.error}safeParse(e,t){var s;const n={common:{issues:[],async:null!==(s=null==t?void 0:t.async)&&void 0!==s&&s,contextualErrorMap:null==t?void 0:t.errorMap},path:(null==t?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:a(e)},r=this._parseSync({data:e,path:n.path,parent:n});return b(n,r)}async parseAsync(e,t){const s=await this.safeParseAsync(e,t);if(s.success)return s.data;throw s.error}async safeParseAsync(e,t){const s={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:a(e)},n=this._parse({data:e,path:s.path,parent:s}),r=await(v(n)?n:Promise.resolve(n));return b(s,r)}refine(e,t){const s=e=>"string"==typeof t||void 0===t?{message:t}:"function"==typeof t?t(e):t;return this._refinement(((t,a)=>{const r=e(t),i=()=>a.addIssue({code:n.custom,...s(t)});return"undefined"!=typeof Promise&&r instanceof Promise?r.then((e=>!!e||(i(),!1))):!!r||(i(),!1)}))}refinement(e,t){return this._refinement(((s,a)=>!!e(s)||(a.addIssue("function"==typeof t?t(s,a):t),!1)))}_refinement(e){return new ue({schema:this,typeName:ke.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}optional(){return le.create(this,this._def)}nullable(){return pe.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return F.create(this,this._def)}promise(){return ce.create(this,this._def)}or(e){return Y.create([this,e],this._def)}and(e){return X.create(this,e,this._def)}transform(e){return new ue({...k(this._def),schema:this,typeName:ke.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t="function"==typeof e?e:()=>e;return new he({...k(this._def),innerType:this,defaultValue:t,typeName:ke.ZodDefault})}brand(){return new _e({typeName:ke.ZodBranded,type:this,...k(this._def)})}catch(e){const t="function"==typeof e?e:()=>e;return new me({...k(this._def),innerType:this,catchValue:t,typeName:ke.ZodCatch})}describe(e){return new(0,this.constructor)({...this._def,description:e})}pipe(e){return ve.create(this,e)}readonly(){return ge.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const Z=/^c[^\s-]{8,}$/i,T=/^[a-z][a-z0-9]*$/,S=/^[0-9A-HJKMNP-TV-Z]{26}$/,E=/^[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,O=/^(?!\.)(?!.*\.\.)([A-Z0-9_+-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i;let N;const j=/^(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))$/,C=/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/;class P extends w{_parse(t){this._def.coerce&&(t.data=String(t.data));if(this._getType(t)!==s.string){const e=this._getOrReturnCtx(t);return u(e,{code:n.invalid_type,expected:s.string,received:e.parsedType}),p}const a=new l;let r;for(const s of this._def.checks)if("min"===s.kind)t.data.length<s.value&&(r=this._getOrReturnCtx(t,r),u(r,{code:n.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),a.dirty());else if("max"===s.kind)t.data.length>s.value&&(r=this._getOrReturnCtx(t,r),u(r,{code:n.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),a.dirty());else if("length"===s.kind){const e=t.data.length>s.value,i=t.data.length<s.value;(e||i)&&(r=this._getOrReturnCtx(t,r),e?u(r,{code:n.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}):i&&u(r,{code:n.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}),a.dirty())}else if("email"===s.kind)O.test(t.data)||(r=this._getOrReturnCtx(t,r),u(r,{validation:"email",code:n.invalid_string,message:s.message}),a.dirty());else if("emoji"===s.kind)N||(N=new RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),N.test(t.data)||(r=this._getOrReturnCtx(t,r),u(r,{validation:"emoji",code:n.invalid_string,message:s.message}),a.dirty());else if("uuid"===s.kind)E.test(t.data)||(r=this._getOrReturnCtx(t,r),u(r,{validation:"uuid",code:n.invalid_string,message:s.message}),a.dirty());else if("cuid"===s.kind)Z.test(t.data)||(r=this._getOrReturnCtx(t,r),u(r,{validation:"cuid",code:n.invalid_string,message:s.message}),a.dirty());else if("cuid2"===s.kind)T.test(t.data)||(r=this._getOrReturnCtx(t,r),u(r,{validation:"cuid2",code:n.invalid_string,message:s.message}),a.dirty());else if("ulid"===s.kind)S.test(t.data)||(r=this._getOrReturnCtx(t,r),u(r,{validation:"ulid",code:n.invalid_string,message:s.message}),a.dirty());else if("url"===s.kind)try{new URL(t.data)}catch(e){r=this._getOrReturnCtx(t,r),u(r,{validation:"url",code:n.invalid_string,message:s.message}),a.dirty()}else if("regex"===s.kind){s.regex.lastIndex=0;s.regex.test(t.data)||(r=this._getOrReturnCtx(t,r),u(r,{validation:"regex",code:n.invalid_string,message:s.message}),a.dirty())}else if("trim"===s.kind)t.data=t.data.trim();else if("includes"===s.kind)t.data.includes(s.value,s.position)||(r=this._getOrReturnCtx(t,r),u(r,{code:n.invalid_string,validation:{includes:s.value,position:s.position},message:s.message}),a.dirty());else if("toLowerCase"===s.kind)t.data=t.data.toLowerCase();else if("toUpperCase"===s.kind)t.data=t.data.toUpperCase();else if("startsWith"===s.kind)t.data.startsWith(s.value)||(r=this._getOrReturnCtx(t,r),u(r,{code:n.invalid_string,validation:{startsWith:s.value},message:s.message}),a.dirty());else if("endsWith"===s.kind)t.data.endsWith(s.value)||(r=this._getOrReturnCtx(t,r),u(r,{code:n.invalid_string,validation:{endsWith:s.value},message:s.message}),a.dirty());else if("datetime"===s.kind){((d=s).precision?d.offset?new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${d.precision}}(([+-]\\d{2}(:?\\d{2})?)|Z)$`):new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${d.precision}}Z$`):0===d.precision?d.offset?new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(([+-]\\d{2}(:?\\d{2})?)|Z)$"):new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}Z$"):d.offset?new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(([+-]\\d{2}(:?\\d{2})?)|Z)$"):new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?Z$")).test(t.data)||(r=this._getOrReturnCtx(t,r),u(r,{code:n.invalid_string,validation:"datetime",message:s.message}),a.dirty())}else"ip"===s.kind?(i=t.data,("v4"!==(o=s.version)&&o||!j.test(i))&&("v6"!==o&&o||!C.test(i))&&(r=this._getOrReturnCtx(t,r),u(r,{validation:"ip",code:n.invalid_string,message:s.message}),a.dirty())):e.assertNever(s);var i,o,d;return{status:a.value,value:t.data}}_regex(e,t,s){return this.refinement((t=>e.test(t)),{validation:t,code:n.invalid_string,...g.errToObj(s)})}_addCheck(e){return new P({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...g.errToObj(e)})}url(e){return this._addCheck({kind:"url",...g.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...g.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...g.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...g.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...g.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...g.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...g.errToObj(e)})}datetime(e){var t;return"string"==typeof e?this._addCheck({kind:"datetime",precision:null,offset:!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)&&void 0!==t&&t,...g.errToObj(null==e?void 0:e.message)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...g.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:null==t?void 0:t.position,...g.errToObj(null==t?void 0:t.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...g.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...g.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...g.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...g.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...g.errToObj(t)})}nonempty(e){return this.min(1,g.errToObj(e))}trim(){return new P({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new P({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new P({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find((e=>"datetime"===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 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 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 I(e,t){const s=(e.toString().split(".")[1]||"").length,a=(t.toString().split(".")[1]||"").length,n=s>a?s:a;return parseInt(e.toFixed(n).replace(".",""))%parseInt(t.toFixed(n).replace(".",""))/Math.pow(10,n)}P.create=e=>{var t;return new P({checks:[],typeName:ke.ZodString,coerce:null!==(t=null==e?void 0:e.coerce)&&void 0!==t&&t,...k(e)})};class R extends w{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)!==s.number){const e=this._getOrReturnCtx(t);return u(e,{code:n.invalid_type,expected:s.number,received:e.parsedType}),p}let a;const r=new l;for(const s of this._def.checks)if("int"===s.kind)e.isInteger(t.data)||(a=this._getOrReturnCtx(t,a),u(a,{code:n.invalid_type,expected:"integer",received:"float",message:s.message}),r.dirty());else if("min"===s.kind){(s.inclusive?t.data<s.value:t.data<=s.value)&&(a=this._getOrReturnCtx(t,a),u(a,{code:n.too_small,minimum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),r.dirty())}else if("max"===s.kind){(s.inclusive?t.data>s.value:t.data>=s.value)&&(a=this._getOrReturnCtx(t,a),u(a,{code:n.too_big,maximum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),r.dirty())}else"multipleOf"===s.kind?0!==I(t.data,s.value)&&(a=this._getOrReturnCtx(t,a),u(a,{code:n.not_multiple_of,multipleOf:s.value,message:s.message}),r.dirty()):"finite"===s.kind?Number.isFinite(t.data)||(a=this._getOrReturnCtx(t,a),u(a,{code:n.not_finite,message:s.message}),r.dirty()):e.assertNever(s);return{status:r.value,value:t.data}}gte(e,t){return this.setLimit("min",e,!0,g.toString(t))}gt(e,t){return this.setLimit("min",e,!1,g.toString(t))}lte(e,t){return this.setLimit("max",e,!0,g.toString(t))}lt(e,t){return this.setLimit("max",e,!1,g.toString(t))}setLimit(e,t,s,a){return new R({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:s,message:g.toString(a)}]})}_addCheck(e){return new R({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:g.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:g.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:g.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:g.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:g.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:g.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:g.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:g.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:g.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 s of this._def.checks){if("finite"===s.kind||"int"===s.kind||"multipleOf"===s.kind)return!0;"min"===s.kind?(null===t||s.value>t)&&(t=s.value):"max"===s.kind&&(null===e||s.value<e)&&(e=s.value)}return Number.isFinite(t)&&Number.isFinite(e)}}R.create=e=>new R({checks:[],typeName:ke.ZodNumber,coerce:(null==e?void 0:e.coerce)||!1,...k(e)});class A extends w{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(t){this._def.coerce&&(t.data=BigInt(t.data));if(this._getType(t)!==s.bigint){const e=this._getOrReturnCtx(t);return u(e,{code:n.invalid_type,expected:s.bigint,received:e.parsedType}),p}let a;const r=new l;for(const s of this._def.checks)if("min"===s.kind){(s.inclusive?t.data<s.value:t.data<=s.value)&&(a=this._getOrReturnCtx(t,a),u(a,{code:n.too_small,type:"bigint",minimum:s.value,inclusive:s.inclusive,message:s.message}),r.dirty())}else if("max"===s.kind){(s.inclusive?t.data>s.value:t.data>=s.value)&&(a=this._getOrReturnCtx(t,a),u(a,{code:n.too_big,type:"bigint",maximum:s.value,inclusive:s.inclusive,message:s.message}),r.dirty())}else"multipleOf"===s.kind?t.data%s.value!==BigInt(0)&&(a=this._getOrReturnCtx(t,a),u(a,{code:n.not_multiple_of,multipleOf:s.value,message:s.message}),r.dirty()):e.assertNever(s);return{status:r.value,value:t.data}}gte(e,t){return this.setLimit("min",e,!0,g.toString(t))}gt(e,t){return this.setLimit("min",e,!1,g.toString(t))}lte(e,t){return this.setLimit("max",e,!0,g.toString(t))}lt(e,t){return this.setLimit("max",e,!1,g.toString(t))}setLimit(e,t,s,a){return new A({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:s,message:g.toString(a)}]})}_addCheck(e){return new A({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:g.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:g.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:g.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:g.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:g.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}}A.create=e=>{var t;return new A({checks:[],typeName:ke.ZodBigInt,coerce:null!==(t=null==e?void 0:e.coerce)&&void 0!==t&&t,...k(e)})};class $ extends w{_parse(e){this._def.coerce&&(e.data=Boolean(e.data));if(this._getType(e)!==s.boolean){const t=this._getOrReturnCtx(e);return u(t,{code:n.invalid_type,expected:s.boolean,received:t.parsedType}),p}return m(e.data)}}$.create=e=>new $({typeName:ke.ZodBoolean,coerce:(null==e?void 0:e.coerce)||!1,...k(e)});class M extends w{_parse(t){this._def.coerce&&(t.data=new Date(t.data));if(this._getType(t)!==s.date){const e=this._getOrReturnCtx(t);return u(e,{code:n.invalid_type,expected:s.date,received:e.parsedType}),p}if(isNaN(t.data.getTime())){return u(this._getOrReturnCtx(t),{code:n.invalid_date}),p}const a=new l;let r;for(const s of this._def.checks)"min"===s.kind?t.data.getTime()<s.value&&(r=this._getOrReturnCtx(t,r),u(r,{code:n.too_small,message:s.message,inclusive:!0,exact:!1,minimum:s.value,type:"date"}),a.dirty()):"max"===s.kind?t.data.getTime()>s.value&&(r=this._getOrReturnCtx(t,r),u(r,{code:n.too_big,message:s.message,inclusive:!0,exact:!1,maximum:s.value,type:"date"}),a.dirty()):e.assertNever(s);return{status:a.value,value:new Date(t.data.getTime())}}_addCheck(e){return new M({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:g.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:g.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}}M.create=e=>new M({checks:[],coerce:(null==e?void 0:e.coerce)||!1,typeName:ke.ZodDate,...k(e)});class L extends w{_parse(e){if(this._getType(e)!==s.symbol){const t=this._getOrReturnCtx(e);return u(t,{code:n.invalid_type,expected:s.symbol,received:t.parsedType}),p}return m(e.data)}}L.create=e=>new L({typeName:ke.ZodSymbol,...k(e)});class D extends w{_parse(e){if(this._getType(e)!==s.undefined){const t=this._getOrReturnCtx(e);return u(t,{code:n.invalid_type,expected:s.undefined,received:t.parsedType}),p}return m(e.data)}}D.create=e=>new D({typeName:ke.ZodUndefined,...k(e)});class V extends w{_parse(e){if(this._getType(e)!==s.null){const t=this._getOrReturnCtx(e);return u(t,{code:n.invalid_type,expected:s.null,received:t.parsedType}),p}return m(e.data)}}V.create=e=>new V({typeName:ke.ZodNull,...k(e)});class z extends w{constructor(){super(...arguments),this._any=!0}_parse(e){return m(e.data)}}z.create=e=>new z({typeName:ke.ZodAny,...k(e)});class U extends w{constructor(){super(...arguments),this._unknown=!0}_parse(e){return m(e.data)}}U.create=e=>new U({typeName:ke.ZodUnknown,...k(e)});class K extends w{_parse(e){const t=this._getOrReturnCtx(e);return u(t,{code:n.invalid_type,expected:s.never,received:t.parsedType}),p}}K.create=e=>new K({typeName:ke.ZodNever,...k(e)});class B extends w{_parse(e){if(this._getType(e)!==s.undefined){const t=this._getOrReturnCtx(e);return u(t,{code:n.invalid_type,expected:s.void,received:t.parsedType}),p}return m(e.data)}}B.create=e=>new B({typeName:ke.ZodVoid,...k(e)});class F extends w{_parse(e){const{ctx:t,status:a}=this._processInputParams(e),r=this._def;if(t.parsedType!==s.array)return u(t,{code:n.invalid_type,expected:s.array,received:t.parsedType}),p;if(null!==r.exactLength){const e=t.data.length>r.exactLength.value,s=t.data.length<r.exactLength.value;(e||s)&&(u(t,{code:e?n.too_big:n.too_small,minimum:s?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&&(u(t,{code:n.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&&(u(t,{code:n.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,s)=>r.type._parseAsync(new x(t,e,t.path,s))))).then((e=>l.mergeArray(a,e)));const i=[...t.data].map(((e,s)=>r.type._parseSync(new x(t,e,t.path,s))));return l.mergeArray(a,i)}get element(){return this._def.type}min(e,t){return new F({...this._def,minLength:{value:e,message:g.toString(t)}})}max(e,t){return new F({...this._def,maxLength:{value:e,message:g.toString(t)}})}length(e,t){return new F({...this._def,exactLength:{value:e,message:g.toString(t)}})}nonempty(e){return this.min(1,e)}}function W(e){if(e instanceof q){const t={};for(const s in e.shape){const a=e.shape[s];t[s]=le.create(W(a))}return new q({...e._def,shape:()=>t})}return e instanceof F?new F({...e._def,type:W(e.element)}):e instanceof le?le.create(W(e.unwrap())):e instanceof pe?pe.create(W(e.unwrap())):e instanceof Q?Q.create(e.items.map((e=>W(e)))):e}F.create=(e,t)=>new F({type:e,minLength:null,maxLength:null,exactLength:null,typeName:ke.ZodArray,...k(t)});class q extends w{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(),s=e.objectKeys(t);return this._cached={shape:t,keys:s}}_parse(e){if(this._getType(e)!==s.object){const t=this._getOrReturnCtx(e);return u(t,{code:n.invalid_type,expected:s.object,received:t.parsedType}),p}const{status:t,ctx:a}=this._processInputParams(e),{shape:r,keys:i}=this._getCached(),o=[];if(!(this._def.catchall instanceof K&&"strip"===this._def.unknownKeys))for(const e in a.data)i.includes(e)||o.push(e);const d=[];for(const e of i){const t=r[e],s=a.data[e];d.push({key:{status:"valid",value:e},value:t._parse(new x(a,s,a.path,e)),alwaysSet:e in a.data})}if(this._def.catchall instanceof K){const e=this._def.unknownKeys;if("passthrough"===e)for(const e of o)d.push({key:{status:"valid",value:e},value:{status:"valid",value:a.data[e]}});else if("strict"===e)o.length>0&&(u(a,{code:n.unrecognized_keys,keys:o}),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 o){const s=a.data[t];d.push({key:{status:"valid",value:t},value:e._parse(new x(a,s,a.path,t)),alwaysSet:t in a.data})}}return a.common.async?Promise.resolve().then((async()=>{const e=[];for(const t of d){const s=await t.key;e.push({key:s,value:await t.value,alwaysSet:t.alwaysSet})}return e})).then((e=>l.mergeObjectSync(t,e))):l.mergeObjectSync(t,d)}get shape(){return this._def.shape()}strict(e){return g.errToObj,new q({...this._def,unknownKeys:"strict",...void 0!==e?{errorMap:(t,s)=>{var a,n,r,i;const o=null!==(r=null===(n=(a=this._def).errorMap)||void 0===n?void 0:n.call(a,t,s).message)&&void 0!==r?r:s.defaultError;return"unrecognized_keys"===t.code?{message:null!==(i=g.errToObj(e).message)&&void 0!==i?i:o}:{message:o}}}:{}})}strip(){return new q({...this._def,unknownKeys:"strip"})}passthrough(){return new q({...this._def,unknownKeys:"passthrough"})}extend(e){return new q({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new q({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 q({...this._def,catchall:e})}pick(t){const s={};return e.objectKeys(t).forEach((e=>{t[e]&&this.shape[e]&&(s[e]=this.shape[e])})),new q({...this._def,shape:()=>s})}omit(t){const s={};return e.objectKeys(this.shape).forEach((e=>{t[e]||(s[e]=this.shape[e])})),new q({...this._def,shape:()=>s})}deepPartial(){return W(this)}partial(t){const s={};return e.objectKeys(this.shape).forEach((e=>{const a=this.shape[e];t&&!t[e]?s[e]=a:s[e]=a.optional()})),new q({...this._def,shape:()=>s})}required(t){const s={};return e.objectKeys(this.shape).forEach((e=>{if(t&&!t[e])s[e]=this.shape[e];else{let t=this.shape[e];for(;t instanceof le;)t=t._def.innerType;s[e]=t}})),new q({...this._def,shape:()=>s})}keyof(){return ie(e.objectKeys(this.shape))}}q.create=(e,t)=>new q({shape:()=>e,unknownKeys:"strip",catchall:K.create(),typeName:ke.ZodObject,...k(t)}),q.strictCreate=(e,t)=>new q({shape:()=>e,unknownKeys:"strict",catchall:K.create(),typeName:ke.ZodObject,...k(t)}),q.lazycreate=(e,t)=>new q({shape:e,unknownKeys:"strip",catchall:K.create(),typeName:ke.ZodObject,...k(t)});class Y extends w{_parse(e){const{ctx:t}=this._processInputParams(e),s=this._def.options;if(t.common.async)return Promise.all(s.map((async e=>{const s={...t,common:{...t.common,issues:[]},parent:null};return{result:await e._parseAsync({data:t.data,path:t.path,parent:s}),ctx:s}}))).then((function(e){for(const t of e)if("valid"===t.result.status)return t.result;for(const s of e)if("dirty"===s.result.status)return t.common.issues.push(...s.ctx.common.issues),s.result;const s=e.map((e=>new r(e.ctx.common.issues)));return u(t,{code:n.invalid_union,unionErrors:s}),p}));{let e;const a=[];for(const n of s){const s={...t,common:{...t.common,issues:[]},parent:null},r=n._parseSync({data:t.data,path:t.path,parent:s});if("valid"===r.status)return r;"dirty"!==r.status||e||(e={result:r,ctx:s}),s.common.issues.length&&a.push(s.common.issues)}if(e)return t.common.issues.push(...e.ctx.common.issues),e.result;const i=a.map((e=>new r(e)));return u(t,{code:n.invalid_union,unionErrors:i}),p}}get options(){return this._def.options}}Y.create=(e,t)=>new Y({options:e,typeName:ke.ZodUnion,...k(t)});const J=e=>e instanceof ne?J(e.schema):e instanceof ue?J(e.innerType()):e instanceof re?[e.value]:e instanceof oe?e.options:e instanceof de?Object.keys(e.enum):e instanceof he?J(e._def.innerType):e instanceof D?[void 0]:e instanceof V?[null]:null;class H extends w{_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==s.object)return u(t,{code:n.invalid_type,expected:s.object,received:t.parsedType}),p;const a=this.discriminator,r=t.data[a],i=this.optionsMap.get(r);return i?t.common.async?i._parseAsync({data:t.data,path:t.path,parent:t}):i._parseSync({data:t.data,path:t.path,parent:t}):(u(t,{code:n.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[a]}),p)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,s){const a=new Map;for(const s of t){const t=J(s.shape[e]);if(!t)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const n of t){if(a.has(n))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(n)}`);a.set(n,s)}}return new H({typeName:ke.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:a,...k(s)})}}function G(t,n){const r=a(t),i=a(n);if(t===n)return{valid:!0,data:t};if(r===s.object&&i===s.object){const s=e.objectKeys(n),a=e.objectKeys(t).filter((e=>-1!==s.indexOf(e))),r={...t,...n};for(const e of a){const s=G(t[e],n[e]);if(!s.valid)return{valid:!1};r[e]=s.data}return{valid:!0,data:r}}if(r===s.array&&i===s.array){if(t.length!==n.length)return{valid:!1};const e=[];for(let s=0;s<t.length;s++){const a=G(t[s],n[s]);if(!a.valid)return{valid:!1};e.push(a.data)}return{valid:!0,data:e}}return r===s.date&&i===s.date&&+t==+n?{valid:!0,data:t}:{valid:!1}}class X extends w{_parse(e){const{status:t,ctx:s}=this._processInputParams(e),a=(e,a)=>{if(f(e)||f(a))return p;const r=G(e.value,a.value);return r.valid?((y(e)||y(a))&&t.dirty(),{status:t.value,value:r.data}):(u(s,{code:n.invalid_intersection_types}),p)};return s.common.async?Promise.all([this._def.left._parseAsync({data:s.data,path:s.path,parent:s}),this._def.right._parseAsync({data:s.data,path:s.path,parent:s})]).then((([e,t])=>a(e,t))):a(this._def.left._parseSync({data:s.data,path:s.path,parent:s}),this._def.right._parseSync({data:s.data,path:s.path,parent:s}))}}X.create=(e,t,s)=>new X({left:e,right:t,typeName:ke.ZodIntersection,...k(s)});class Q extends w{_parse(e){const{status:t,ctx:a}=this._processInputParams(e);if(a.parsedType!==s.array)return u(a,{code:n.invalid_type,expected:s.array,received:a.parsedType}),p;if(a.data.length<this._def.items.length)return u(a,{code:n.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),p;!this._def.rest&&a.data.length>this._def.items.length&&(u(a,{code:n.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());const r=[...a.data].map(((e,t)=>{const s=this._def.items[t]||this._def.rest;return s?s._parse(new x(a,e,a.path,t)):null})).filter((e=>!!e));return a.common.async?Promise.all(r).then((e=>l.mergeArray(t,e))):l.mergeArray(t,r)}get items(){return this._def.items}rest(e){return new Q({...this._def,rest:e})}}Q.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Q({items:e,typeName:ke.ZodTuple,rest:null,...k(t)})};class ee extends w{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!==s.object)return u(a,{code:n.invalid_type,expected:s.object,received:a.parsedType}),p;const r=[],i=this._def.keyType,o=this._def.valueType;for(const e in a.data)r.push({key:i._parse(new x(a,e,a.path,e)),value:o._parse(new x(a,a.data[e],a.path,e))});return a.common.async?l.mergeObjectAsync(t,r):l.mergeObjectSync(t,r)}get element(){return this._def.valueType}static create(e,t,s){return new ee(t instanceof w?{keyType:e,valueType:t,typeName:ke.ZodRecord,...k(s)}:{keyType:P.create(),valueType:e,typeName:ke.ZodRecord,...k(t)})}}class te extends w{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!==s.map)return u(a,{code:n.invalid_type,expected:s.map,received:a.parsedType}),p;const r=this._def.keyType,i=this._def.valueType,o=[...a.data.entries()].map((([e,t],s)=>({key:r._parse(new x(a,e,a.path,[s,"key"])),value:i._parse(new x(a,t,a.path,[s,"value"]))})));if(a.common.async){const e=new Map;return Promise.resolve().then((async()=>{for(const s of o){const a=await s.key,n=await s.value;if("aborted"===a.status||"aborted"===n.status)return p;"dirty"!==a.status&&"dirty"!==n.status||t.dirty(),e.set(a.value,n.value)}return{status:t.value,value:e}}))}{const e=new Map;for(const s of o){const a=s.key,n=s.value;if("aborted"===a.status||"aborted"===n.status)return p;"dirty"!==a.status&&"dirty"!==n.status||t.dirty(),e.set(a.value,n.value)}return{status:t.value,value:e}}}}te.create=(e,t,s)=>new te({valueType:t,keyType:e,typeName:ke.ZodMap,...k(s)});class se extends w{_parse(e){const{status:t,ctx:a}=this._processInputParams(e);if(a.parsedType!==s.set)return u(a,{code:n.invalid_type,expected:s.set,received:a.parsedType}),p;const r=this._def;null!==r.minSize&&a.data.size<r.minSize.value&&(u(a,{code:n.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&&(u(a,{code:n.too_big,maximum:r.maxSize.value,type:"set",inclusive:!0,exact:!1,message:r.maxSize.message}),t.dirty());const i=this._def.valueType;function o(e){const s=new Set;for(const a of e){if("aborted"===a.status)return p;"dirty"===a.status&&t.dirty(),s.add(a.value)}return{status:t.value,value:s}}const d=[...a.data.values()].map(((e,t)=>i._parse(new x(a,e,a.path,t))));return a.common.async?Promise.all(d).then((e=>o(e))):o(d)}min(e,t){return new se({...this._def,minSize:{value:e,message:g.toString(t)}})}max(e,t){return new se({...this._def,maxSize:{value:e,message:g.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}se.create=(e,t)=>new se({valueType:e,minSize:null,maxSize:null,typeName:ke.ZodSet,...k(t)});class ae extends w{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==s.function)return u(t,{code:n.invalid_type,expected:s.function,received:t.parsedType}),p;function a(e,s){return c({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,d(),i].filter((e=>!!e)),issueData:{code:n.invalid_arguments,argumentsError:s}})}function o(e,s){return c({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,d(),i].filter((e=>!!e)),issueData:{code:n.invalid_return_type,returnTypeError:s}})}const l={errorMap:t.common.contextualErrorMap},h=t.data;if(this._def.returns instanceof ce){const e=this;return m((async function(...t){const s=new r([]),n=await e._def.args.parseAsync(t,l).catch((e=>{throw s.addIssue(a(t,e)),s})),i=await Reflect.apply(h,this,n);return await e._def.returns._def.type.parseAsync(i,l).catch((e=>{throw s.addIssue(o(i,e)),s}))}))}{const e=this;return m((function(...t){const s=e._def.args.safeParse(t,l);if(!s.success)throw new r([a(t,s.error)]);const n=Reflect.apply(h,this,s.data),i=e._def.returns.safeParse(n,l);if(!i.success)throw new r([o(n,i.error)]);return i.data}))}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new ae({...this._def,args:Q.create(e).rest(U.create())})}returns(e){return new ae({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,s){return new ae({args:e||Q.create([]).rest(U.create()),returns:t||U.create(),typeName:ke.ZodFunction,...k(s)})}}class ne extends w{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})}}ne.create=(e,t)=>new ne({getter:e,typeName:ke.ZodLazy,...k(t)});class re extends w{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return u(t,{received:t.data,code:n.invalid_literal,expected:this._def.value}),p}return{status:"valid",value:e.data}}get value(){return this._def.value}}function ie(e,t){return new oe({values:e,typeName:ke.ZodEnum,...k(t)})}re.create=(e,t)=>new re({value:e,typeName:ke.ZodLiteral,...k(t)});class oe extends w{_parse(t){if("string"!=typeof t.data){const s=this._getOrReturnCtx(t),a=this._def.values;return u(s,{expected:e.joinValues(a),received:s.parsedType,code:n.invalid_type}),p}if(-1===this._def.values.indexOf(t.data)){const e=this._getOrReturnCtx(t),s=this._def.values;return u(e,{received:e.data,code:n.invalid_enum_value,options:s}),p}return m(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){return oe.create(e)}exclude(e){return oe.create(this.options.filter((t=>!e.includes(t))))}}oe.create=ie;class de extends w{_parse(t){const a=e.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(t);if(r.parsedType!==s.string&&r.parsedType!==s.number){const t=e.objectValues(a);return u(r,{expected:e.joinValues(t),received:r.parsedType,code:n.invalid_type}),p}if(-1===a.indexOf(t.data)){const t=e.objectValues(a);return u(r,{received:r.data,code:n.invalid_enum_value,options:t}),p}return m(t.data)}get enum(){return this._def.values}}de.create=(e,t)=>new de({values:e,typeName:ke.ZodNativeEnum,...k(t)});class ce extends w{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==s.promise&&!1===t.common.async)return u(t,{code:n.invalid_type,expected:s.promise,received:t.parsedType}),p;const a=t.parsedType===s.promise?t.data:Promise.resolve(t.data);return m(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,...k(t)});class ue extends w{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:s,ctx:a}=this._processInputParams(t),n=this._def.effect||null,r={addIssue:e=>{u(a,e),e.fatal?s.abort():s.dirty()},get path(){return a.path}};if(r.addIssue=r.addIssue.bind(r),"preprocess"===n.type){const e=n.transform(a.data,r);return a.common.issues.length?{status:"dirty",value:a.data}:a.common.async?Promise.resolve(e).then((e=>this._def.schema._parseAsync({data:e,path:a.path,parent:a}))):this._def.schema._parseSync({data:e,path:a.path,parent:a})}if("refinement"===n.type){const e=e=>{const t=n.refinement(e,r);if(a.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===a.common.async){const t=this._def.schema._parseSync({data:a.data,path:a.path,parent:a});return"aborted"===t.status?p:("dirty"===t.status&&s.dirty(),e(t.value),{status:s.value,value:t.value})}return this._def.schema._parseAsync({data:a.data,path:a.path,parent:a}).then((t=>"aborted"===t.status?p:("dirty"===t.status&&s.dirty(),e(t.value).then((()=>({status:s.value,value:t.value}))))))}if("transform"===n.type){if(!1===a.common.async){const e=this._def.schema._parseSync({data:a.data,path:a.path,parent:a});if(!_(e))return e;const t=n.transform(e.value,r);if(t instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:s.value,value:t}}return this._def.schema._parseAsync({data:a.data,path:a.path,parent:a}).then((e=>_(e)?Promise.resolve(n.transform(e.value,r)).then((e=>({status:s.value,value:e}))):e))}e.assertNever(n)}}ue.create=(e,t,s)=>new ue({schema:e,typeName:ke.ZodEffects,effect:t,...k(s)}),ue.createWithPreprocess=(e,t,s)=>new ue({schema:t,effect:{type:"preprocess",transform:e},typeName:ke.ZodEffects,...k(s)});class le extends w{_parse(e){return this._getType(e)===s.undefined?m(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}le.create=(e,t)=>new le({innerType:e,typeName:ke.ZodOptional,...k(t)});class pe extends w{_parse(e){return this._getType(e)===s.null?m(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}pe.create=(e,t)=>new pe({innerType:e,typeName:ke.ZodNullable,...k(t)});class he extends w{_parse(e){const{ctx:t}=this._processInputParams(e);let a=t.data;return t.parsedType===s.undefined&&(a=this._def.defaultValue()),this._def.innerType._parse({data:a,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}he.create=(e,t)=>new he({innerType:e,typeName:ke.ZodDefault,defaultValue:"function"==typeof t.default?t.default:()=>t.default,...k(t)});class me extends w{_parse(e){const{ctx:t}=this._processInputParams(e),s={...t,common:{...t.common,issues:[]}},a=this._def.innerType._parse({data:s.data,path:s.path,parent:{...s}});return v(a)?a.then((e=>({status:"valid",value:"valid"===e.status?e.value:this._def.catchValue({get error(){return new r(s.common.issues)},input:s.data})}))):{status:"valid",value:"valid"===a.status?a.value:this._def.catchValue({get error(){return new r(s.common.issues)},input:s.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,...k(t)});class fe extends w{_parse(e){if(this._getType(e)!==s.nan){const t=this._getOrReturnCtx(e);return u(t,{code:n.invalid_type,expected:s.nan,received:t.parsedType}),p}return{status:"valid",value:e.data}}}fe.create=e=>new fe({typeName:ke.ZodNaN,...k(e)});const ye=Symbol("zod_brand");class _e extends w{_parse(e){const{ctx:t}=this._processInputParams(e),s=t.data;return this._def.type._parse({data:s,path:t.path,parent:t})}unwrap(){return this._def.type}}class ve extends w{_parse(e){const{status:t,ctx:s}=this._processInputParams(e);if(s.common.async){return(async()=>{const e=await this._def.in._parseAsync({data:s.data,path:s.path,parent:s});return"aborted"===e.status?p:"dirty"===e.status?(t.dirty(),h(e.value)):this._def.out._parseAsync({data:e.value,path:s.path,parent:s})})()}{const e=this._def.in._parseSync({data:s.data,path:s.path,parent:s});return"aborted"===e.status?p:"dirty"===e.status?(t.dirty(),{status:"dirty",value:e.value}):this._def.out._parseSync({data:e.value,path:s.path,parent:s})}}static create(e,t){return new ve({in:e,out:t,typeName:ke.ZodPipeline})}}class ge extends w{_parse(e){const t=this._def.innerType._parse(e);return _(t)&&(t.value=Object.freeze(t.value)),t}}ge.create=(e,t)=>new ge({innerType:e,typeName:ke.ZodReadonly,...k(t)});const xe=(e,t={},s)=>e?z.create().superRefine(((a,n)=>{var r,i;if(!e(a)){const e="function"==typeof t?t(a):"string"==typeof t?{message:t}:t,o=null===(i=null!==(r=e.fatal)&&void 0!==r?r:s)||void 0===i||i,d="string"==typeof e?{message:e}:e;n.addIssue({code:"custom",...d,fatal:o})}})):z.create(),be={object:q.lazycreate};var ke;!function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"}(ke||(ke={}));const we=P.create,Ze=R.create,Te=fe.create,Se=A.create,Ee=$.create,Oe=M.create,Ne=L.create,je=D.create,Ce=V.create,Pe=z.create,Ie=U.create,Re=K.create,Ae=B.create,$e=F.create,Me=q.create,Le=q.strictCreate,De=Y.create,Ve=H.create,ze=X.create,Ue=Q.create,Ke=ee.create,Be=te.create,Fe=se.create,We=ae.create,qe=ne.create,Ye=re.create,Je=oe.create,He=de.create,Ge=ce.create,Xe=ue.create,Qe=le.create,et=pe.create,tt=ue.createWithPreprocess,st=ve.create,at={string:e=>P.create({...e,coerce:!0}),number:e=>R.create({...e,coerce:!0}),boolean:e=>$.create({...e,coerce:!0}),bigint:e=>A.create({...e,coerce:!0}),date:e=>M.create({...e,coerce:!0})},nt=p;var rt=Object.freeze({__proto__:null,defaultErrorMap:i,setErrorMap:function(e){o=e},getErrorMap:d,makeIssue:c,EMPTY_PATH:[],addIssueToContext:u,ParseStatus:l,INVALID:p,DIRTY:h,OK:m,isAborted:f,isDirty:y,isValid:_,isAsync:v,get util(){return e},get objectUtil(){return t},ZodParsedType:s,getParsedType:a,ZodType:w,ZodString:P,ZodNumber:R,ZodBigInt:A,ZodBoolean:$,ZodDate:M,ZodSymbol:L,ZodUndefined:D,ZodNull:V,ZodAny:z,ZodUnknown:U,ZodNever:K,ZodVoid:B,ZodArray:F,ZodObject:q,ZodUnion:Y,ZodDiscriminatedUnion:H,ZodIntersection:X,ZodTuple:Q,ZodRecord:ee,ZodMap:te,ZodSet:se,ZodFunction:ae,ZodLazy:ne,ZodLiteral:re,ZodEnum:oe,ZodNativeEnum:de,ZodPromise:ce,ZodEffects:ue,ZodTransformer:ue,ZodOptional:le,ZodNullable:pe,ZodDefault:he,ZodCatch:me,ZodNaN:fe,BRAND:ye,ZodBranded:_e,ZodPipeline:ve,ZodReadonly:ge,custom:xe,Schema:w,ZodSchema:w,late:be,get ZodFirstPartyTypeKind(){return ke},coerce:at,any:Pe,array:$e,bigint:Se,boolean:Ee,date:Oe,discriminatedUnion:Ve,effect:Xe,enum:Je,function:We,instanceof:(e,t={message:`Input not instance of ${e.name}`})=>xe((t=>t instanceof e),t),intersection:ze,lazy:qe,literal:Ye,map:Be,nan:Te,nativeEnum:He,never:Re,null:Ce,nullable:et,number:Ze,object:Me,oboolean:()=>Ee().optional(),onumber:()=>Ze().optional(),optional:Qe,ostring:()=>we().optional(),pipeline:st,preprocess:tt,promise:Ge,record:Ke,set:Fe,strictObject:Le,string:we,symbol:Ne,transformer:Xe,tuple:Ue,undefined:je,union:De,unknown:Ie,void:Ae,NEVER:nt,ZodIssueCode:n,quotelessJson:e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:"),ZodError:r}),it=["interface","display","layout","module","panel","theme"],ot=["hook","endpoint"],dt=["operation"],ct=rt.object({app:rt.string(),api:rt.string()}),ut=rt.object({request:rt.optional(rt.object({urls:rt.array(rt.string()),methods:rt.array(rt.union([rt.literal("GET"),rt.literal("POST"),rt.literal("PATCH"),rt.literal("PUT"),rt.literal("DELETE")]))})),log:rt.optional(rt.object({})),sleep:rt.optional(rt.object({}))}),lt=rt.optional(rt.object({enabled:rt.boolean(),requestedScopes:ut})),pt=rt.union([rt.object({type:rt.enum(ot),name:rt.string(),source:rt.string()}),rt.object({type:rt.enum(it),name:rt.string(),source:rt.string()}),rt.object({type:rt.enum(dt),name:rt.string(),source:ct})]),ht=rt.object({host:rt.string(),hidden:rt.boolean().optional()}),mt=rt.object({type:rt.enum(it),path:rt.string(),source:rt.string()}),ft=rt.object({type:rt.enum(ot),path:rt.string(),source:rt.string(),sandbox:lt}),yt=rt.object({type:rt.enum(dt),path:ct,source:ct,sandbox:lt}),_t=rt.object({type:rt.literal("bundle"),path:ct,entries:rt.array(pt)});rt.array(pt);var vt=ht.and(rt.union([mt,ft,yt,_t]));rt.object({name:rt.string(),version:rt.string(),type:rt.union([rt.literal("module"),rt.literal("commonjs")]).optional(),description:rt.string().optional(),icon:rt.string().optional(),dependencies:rt.record(rt.string()).optional(),devDependencies:rt.record(rt.string()).optional(),"directus:extension":vt});const gt=[],xt=[],bt=[{name:"okam-typesense-upsert",config:{id:"okam-typesense-upsert",handler:({collection:e,item:t,host_override:s,apikey_override:a})=>{const n=s||String(process.env.TYPESENSE_HOST),r=a||String(process.env.TYPESENSE_APIKEY_WRITE);if(!n||!r)return[];const i=null!==t&&"object"==typeof t?[t]:Array.isArray(t)?t:[];if(!i.length)return[];const o=`${n}/collections/${e}/documents?action=upsert`,d=i.map((e=>fetch(o,{method:"post",headers:{"X-TYPESENSE-API-KEY":r},body:JSON.stringify(e)}).then((e=>e.json())).catch((()=>null))));return Promise.all(d)}}},{name:"okam-typesense-delete",config:{id:"okam-typesense-delete",handler:({collection:e,key:t,item:s,host_override:a,apikey_override:n})=>{const r=a||String(process.env.TYPESENSE_HOST),i=n||String(process.env.TYPESENSE_APIKEY_WRITE);if(!r||!i)return[];const o=function(e,t){if(null!=e&&""!==e)return[{id:e}];const s="string"==typeof t?JSON.parse(t):t;return null!==s&&"object"==typeof s?[s]:Array.isArray(s)?s:[]}(t,s);if(!o.length)return[];const d=`${r}/collections/${e}/documents`,c=o.map((({id:e})=>e?fetch(`${d}/${e}`,{method:"DELETE",headers:{"X-TYPESENSE-API-KEY":i}}).then((e=>e.json())).catch((()=>null)):null));return Promise.all(c)}}}];export{xt as endpoints,gt as hooks,bt as operations};

@@ -1,1 +0,1 @@

import{defineOperationApp as e}from"@directus/extensions-sdk";const t=[],i=[],n=[],o=[],l=[],r=[],a=[e({id:"okam-typesense-upsert",name:"Typesense Upsert Document Operation",icon:"box",description:"Upsert a document(s) in typesense, using env TYPESENSE_HOST and TYPESENSE_APIKEY_WRITE",overview:({collection:e})=>[{label:"Collection",text:e}],options:[{field:"collection",name:"Collection",type:"string",meta:{width:"full",interface:"input"}},{field:"item",name:"Item",type:"JSON",meta:{width:"full",interface:"code"}},{field:"host_override",name:"Host Override",type:"string",meta:{width:"full",interface:"input"}},{field:"apikey_override",name:"API Key Override",type:"string",meta:{width:"full",interface:"input"}}]}),e({id:"okam-typesense-delete",name:"Typesense Delete Document Operation",icon:"box",description:"Delete a document(s) in typesense",overview:({collection:e})=>[{label:"Collection",text:e}],options:[{field:"collection",name:"Collection",type:"string",meta:{width:"full",interface:"input"}},{field:"item",name:"Item",type:"JSON",meta:{width:"full",interface:"code"}},{field:"host_override",name:"Host Override",type:"string",meta:{width:"full",interface:"input"}},{field:"apikey_override",name:"API Key Override",type:"string",meta:{width:"full",interface:"input"}}]})];export{i as displays,t as interfaces,n as layouts,o as modules,a as operations,l as panels,r as themes};
import{defineOperationApp as e}from"@directus/extensions-sdk";const t=[],i=[],n=[],o=[],l=[],s=[],r=[e({id:"okam-typesense-upsert",name:"Typesense Upsert Document Operation",icon:"box",description:"Upsert a document(s) in typesense, using env TYPESENSE_HOST and TYPESENSE_APIKEY_WRITE",overview:({collection:e})=>[{label:"Collection",text:e}],options:[{field:"collection",name:"Collection",type:"string",meta:{width:"full",interface:"input"}},{field:"item",name:"Item",type:"json",meta:{width:"full",interface:"input-code",options:{languages:"json"}}},{field:"host_override",name:"Host Override",type:"string",meta:{width:"full",interface:"input"}},{field:"apikey_override",name:"API Key Override",type:"string",meta:{width:"full",interface:"input"}}]}),e({id:"okam-typesense-delete",name:"Typesense Delete Document Operation",icon:"box",description:"Delete a document(s) in typesense",overview:({collection:e})=>[{label:"Collection",text:e}],options:[{field:"collection",name:"Collection",type:"string",meta:{width:"full",interface:"input"}},{field:"key",name:"Key",type:"string",meta:{width:"full",interface:"input"}},{field:"item",name:"Item",type:"json",meta:{width:"full",interface:"input-code",options:{languages:"json"}}},{field:"host_override",name:"Host Override",type:"string",meta:{width:"full",interface:"input"}},{field:"apikey_override",name:"API Key Override",type:"string",meta:{width:"full",interface:"input"}}]})];export{i as displays,t as interfaces,n as layouts,o as modules,r as operations,l as panels,s as themes};

@@ -5,3 +5,3 @@ {

"icon": "extension",
"version": "1.0.0",
"version": "1.0.1",
"keywords": [

@@ -22,3 +22,3 @@ "directus",

"type": "operation",
"name": "typesense-upsert",
"name": "okam-typesense-upsert",
"source": {

@@ -25,0 +25,0 @@ "app": "src/okam-typesense-upsert/app.ts",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc