@fern-api/java-dynamic-snippets 3.26.0 → 3.27.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -19,7 +19,7 @@ ${e}`)}return e}getContent(){let e=`package ${this.packageName};
19
19
  `,t=this.stringifyImports();return t.length>0?`${e}${t}
20
20
 
21
21
  ${this.buffer}`:e+this.buffer}stringifyImports(){return Array.from(this.imports).filter(e=>e!==this.packageName).map(e=>`import ${e};`).sort().join(`
22
- `)}};m();y();h();m();y();h();var D={};pr(D,{BRAND:()=>pu,DIRTY:()=>De,EMPTY_PATH:()=>qo,INVALID:()=>L,NEVER:()=>Ju,OK:()=>te,ParseStatus:()=>X,Schema:()=>O,ZodAny:()=>Be,ZodArray:()=>Ie,ZodBigInt:()=>qe,ZodBoolean:()=>We,ZodBranded:()=>Ot,ZodCatch:()=>tt,ZodDate:()=>ze,ZodDefault:()=>et,ZodDiscriminatedUnion:()=>Yt,ZodEffects:()=>fe,ZodEnum:()=>Qe,ZodError:()=>se,ZodFirstPartyTypeKind:()=>B,ZodFunction:()=>Qt,ZodIntersection:()=>Je,ZodIssueCode:()=>b,ZodLazy:()=>Ye,ZodLiteral:()=>Ke,ZodMap:()=>vt,ZodNaN:()=>bt,ZodNativeEnum:()=>Xe,ZodNever:()=>he,ZodNull:()=>Ge,ZodNullable:()=>we,ZodNumber:()=>Ve,ZodObject:()=>oe,ZodOptional:()=>pe,ZodParsedType:()=>I,ZodPipeline:()=>Ut,ZodPromise:()=>Pe,ZodReadonly:()=>rt,ZodRecord:()=>Kt,ZodSchema:()=>O,ZodSet:()=>wt,ZodString:()=>Le,ZodSymbol:()=>gt,ZodTransformer:()=>fe,ZodTuple:()=>ve,ZodType:()=>O,ZodUndefined:()=>Ze,ZodUnion:()=>He,ZodUnknown:()=>Re,ZodVoid:()=>xt,addIssueToContext:()=>R,any:()=>wu,array:()=>ku,bigint:()=>hu,boolean:()=>ki,coerce:()=>Hu,custom:()=>bi,date:()=>yu,datetimeRegex:()=>vi,defaultErrorMap:()=>ke,discriminatedUnion:()=>Eu,effect:()=>$u,enum:()=>Uu,function:()=>Pu,getErrorMap:()=>mt,getParsedType:()=>xe,instanceof:()=>fu,intersection:()=>Au,isAborted:()=>Ht,isAsync:()=>ht,isDirty:()=>Jt,isValid:()=>Ce,late:()=>du,lazy:()=>Fu,literal:()=>Ou,makeIssue:()=>Ft,map:()=>Lu,nan:()=>mu,nativeEnum:()=>ju,never:()=>Tu,null:()=>vu,nullable:()=>Vu,number:()=>_i,object:()=>Nu,objectUtil:()=>Tr,oboolean:()=>Gu,onumber:()=>Zu,optional:()=>Du,ostring:()=>zu,pipeline:()=>Wu,preprocess:()=>qu,promise:()=>Mu,quotelessJson:()=>$o,record:()=>Cu,set:()=>Bu,setErrorMap:()=>Vo,strictObject:()=>Ru,string:()=>Ti,symbol:()=>gu,transformer:()=>$u,tuple:()=>Su,undefined:()=>xu,union:()=>Iu,unknown:()=>bu,util:()=>j,void:()=>_u});m();y();h();m();y();h();m();y();h();m();y();h();m();y();h();var j;(function(n){n.assertEqual=a=>{};function e(a){}n.assertIs=e;function t(a){throw new Error}n.assertNever=t,n.arrayToEnum=a=>{let o={};for(let u of a)o[u]=u;return o},n.getValidEnumValues=a=>{let o=n.objectKeys(a).filter(p=>typeof a[a[p]]!="number"),u={};for(let p of o)u[p]=a[p];return n.objectValues(u)},n.objectValues=a=>n.objectKeys(a).map(function(o){return a[o]}),n.objectKeys=typeof Object.keys=="function"?a=>Object.keys(a):a=>{let o=[];for(let u in a)Object.prototype.hasOwnProperty.call(a,u)&&o.push(u);return o},n.find=(a,o)=>{for(let u of a)if(o(u))return u},n.isInteger=typeof Number.isInteger=="function"?a=>Number.isInteger(a):a=>typeof a=="number"&&Number.isFinite(a)&&Math.floor(a)===a;function r(a,o=" | "){return a.map(u=>typeof u=="string"?`'${u}'`:u).join(o)}n.joinValues=r,n.jsonStringifyReplacer=(a,o)=>typeof o=="bigint"?o.toString():o})(j||(j={}));var Tr;(function(n){n.mergeShapes=(e,t)=>({...e,...t})})(Tr||(Tr={}));var I=j.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),xe=n=>{switch(typeof n){case"undefined":return I.undefined;case"string":return I.string;case"number":return Number.isNaN(n)?I.nan:I.number;case"boolean":return I.boolean;case"function":return I.function;case"bigint":return I.bigint;case"symbol":return I.symbol;case"object":return Array.isArray(n)?I.array:n===null?I.null:n.then&&typeof n.then=="function"&&n.catch&&typeof n.catch=="function"?I.promise:typeof Map<"u"&&n instanceof Map?I.map:typeof Set<"u"&&n instanceof Set?I.set:typeof Date<"u"&&n instanceof Date?I.date:I.object;default:return I.unknown}};var b=j.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"]),$o=n=>JSON.stringify(n,null,2).replace(/"([^"]+)":/g,"$1:"),se=class n extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=r=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};let t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}format(e){let t=e||function(o){return o.message},r={_errors:[]},a=o=>{for(let u of o.issues)if(u.code==="invalid_union")u.unionErrors.map(a);else if(u.code==="invalid_return_type")a(u.returnTypeError);else if(u.code==="invalid_arguments")a(u.argumentsError);else if(u.path.length===0)r._errors.push(t(u));else{let p=r,x=0;for(;x<u.path.length;){let w=u.path[x];x===u.path.length-1?(p[w]=p[w]||{_errors:[]},p[w]._errors.push(t(u))):p[w]=p[w]||{_errors:[]},p=p[w],x++}}};return a(this),r}static assert(e){if(!(e instanceof n))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,j.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=t=>t.message){let t={},r=[];for(let a of this.issues)if(a.path.length>0){let o=a.path[0];t[o]=t[o]||[],t[o].push(e(a))}else r.push(e(a));return{formErrors:r,fieldErrors:t}}get formErrors(){return this.flatten()}};se.create=n=>new se(n);var Do=(n,e)=>{let t;switch(n.code){case b.invalid_type:n.received===I.undefined?t="Required":t=`Expected ${n.expected}, received ${n.received}`;break;case b.invalid_literal:t=`Invalid literal value, expected ${JSON.stringify(n.expected,j.jsonStringifyReplacer)}`;break;case b.unrecognized_keys:t=`Unrecognized key(s) in object: ${j.joinValues(n.keys,", ")}`;break;case b.invalid_union:t="Invalid input";break;case b.invalid_union_discriminator:t=`Invalid discriminator value. Expected ${j.joinValues(n.options)}`;break;case b.invalid_enum_value:t=`Invalid enum value. Expected ${j.joinValues(n.options)}, received '${n.received}'`;break;case b.invalid_arguments:t="Invalid function arguments";break;case b.invalid_return_type:t="Invalid function return type";break;case b.invalid_date:t="Invalid date";break;case b.invalid_string:typeof n.validation=="object"?"includes"in n.validation?(t=`Invalid input: must include "${n.validation.includes}"`,typeof n.validation.position=="number"&&(t=`${t} at one or more positions greater than or equal to ${n.validation.position}`)):"startsWith"in n.validation?t=`Invalid input: must start with "${n.validation.startsWith}"`:"endsWith"in n.validation?t=`Invalid input: must end with "${n.validation.endsWith}"`:j.assertNever(n.validation):n.validation!=="regex"?t=`Invalid ${n.validation}`:t="Invalid";break;case b.too_small:n.type==="array"?t=`Array must contain ${n.exact?"exactly":n.inclusive?"at least":"more than"} ${n.minimum} element(s)`:n.type==="string"?t=`String must contain ${n.exact?"exactly":n.inclusive?"at least":"over"} ${n.minimum} character(s)`:n.type==="number"?t=`Number must be ${n.exact?"exactly equal to ":n.inclusive?"greater than or equal to ":"greater than "}${n.minimum}`:n.type==="bigint"?t=`Number must be ${n.exact?"exactly equal to ":n.inclusive?"greater than or equal to ":"greater than "}${n.minimum}`:n.type==="date"?t=`Date must be ${n.exact?"exactly equal to ":n.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(n.minimum))}`:t="Invalid input";break;case b.too_big:n.type==="array"?t=`Array must contain ${n.exact?"exactly":n.inclusive?"at most":"less than"} ${n.maximum} element(s)`:n.type==="string"?t=`String must contain ${n.exact?"exactly":n.inclusive?"at most":"under"} ${n.maximum} character(s)`:n.type==="number"?t=`Number must be ${n.exact?"exactly":n.inclusive?"less than or equal to":"less than"} ${n.maximum}`:n.type==="bigint"?t=`BigInt must be ${n.exact?"exactly":n.inclusive?"less than or equal to":"less than"} ${n.maximum}`:n.type==="date"?t=`Date must be ${n.exact?"exactly":n.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(n.maximum))}`:t="Invalid input";break;case b.custom:t="Invalid input";break;case b.invalid_intersection_types:t="Intersection results could not be merged";break;case b.not_multiple_of:t=`Number must be a multiple of ${n.multipleOf}`;break;case b.not_finite:t="Number must be finite";break;default:t=e.defaultError,j.assertNever(n)}return{message:t}},ke=Do;var mi=ke;function Vo(n){mi=n}function mt(){return mi}m();y();h();var Ft=n=>{let{data:e,path:t,errorMaps:r,issueData:a}=n,o=[...t,...a.path||[]],u={...a,path:o};if(a.message!==void 0)return{...a,path:o,message:a.message};let p="",x=r.filter(w=>!!w).slice().reverse();for(let w of x)p=w(u,{data:e,defaultError:p}).message;return{...a,path:o,message:p}},qo=[];function R(n,e){let t=mt(),r=Ft({issueData:e,data:n.data,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,t,t===ke?void 0:ke].filter(a=>!!a)});n.common.issues.push(r)}var X=class n{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,t){let r=[];for(let a of t){if(a.status==="aborted")return L;a.status==="dirty"&&e.dirty(),r.push(a.value)}return{status:e.value,value:r}}static async mergeObjectAsync(e,t){let r=[];for(let a of t){let o=await a.key,u=await a.value;r.push({key:o,value:u})}return n.mergeObjectSync(e,r)}static mergeObjectSync(e,t){let r={};for(let a of t){let{key:o,value:u}=a;if(o.status==="aborted"||u.status==="aborted")return L;o.status==="dirty"&&e.dirty(),u.status==="dirty"&&e.dirty(),o.value!=="__proto__"&&(typeof u.value<"u"||a.alwaysSet)&&(r[o.value]=u.value)}return{status:e.value,value:r}}},L=Object.freeze({status:"aborted"}),De=n=>({status:"dirty",value:n}),te=n=>({status:"valid",value:n}),Ht=n=>n.status==="aborted",Jt=n=>n.status==="dirty",Ce=n=>n.status==="valid",ht=n=>typeof Promise<"u"&&n instanceof Promise;m();y();h();m();y();h();var A;(function(n){n.errToObj=e=>typeof e=="string"?{message:e}:e||{},n.toString=e=>typeof e=="string"?e:e?.message})(A||(A={}));var de=class{constructor(e,t,r,a){this._cachedPath=[],this.parent=e,this.data=t,this._path=r,this._key=a}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},hi=(n,e)=>{if(Ce(e))return{success:!0,data:e.value};if(!n.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let t=new se(n.common.issues);return this._error=t,this._error}}};function P(n){if(!n)return{};let{errorMap:e,invalid_type_error:t,required_error:r,description:a}=n;if(e&&(t||r))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:a}:{errorMap:(u,p)=>{let{message:x}=n;return u.code==="invalid_enum_value"?{message:x??p.defaultError}:typeof p.data>"u"?{message:x??r??p.defaultError}:u.code!=="invalid_type"?{message:p.defaultError}:{message:x??t??p.defaultError}},description:a}}var O=class{get description(){return this._def.description}_getType(e){return xe(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:xe(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new X,ctx:{common:e.parent.common,data:e.data,parsedType:xe(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let t=this._parse(e);if(ht(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){let t=this._parse(e);return Promise.resolve(t)}parse(e,t){let r=this.safeParse(e,t);if(r.success)return r.data;throw r.error}safeParse(e,t){let r={common:{issues:[],async:t?.async??!1,contextualErrorMap:t?.errorMap},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:xe(e)},a=this._parseSync({data:e,path:r.path,parent:r});return hi(r,a)}"~validate"(e){let t={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:xe(e)};if(!this["~standard"].async)try{let r=this._parseSync({data:e,path:[],parent:t});return Ce(r)?{value:r.value}:{issues:t.common.issues}}catch(r){r?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then(r=>Ce(r)?{value:r.value}:{issues:t.common.issues})}async parseAsync(e,t){let r=await this.safeParseAsync(e,t);if(r.success)return r.data;throw r.error}async safeParseAsync(e,t){let r={common:{issues:[],contextualErrorMap:t?.errorMap,async:!0},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:xe(e)},a=this._parse({data:e,path:r.path,parent:r}),o=await(ht(a)?a:Promise.resolve(a));return hi(r,o)}refine(e,t){let r=a=>typeof t=="string"||typeof t>"u"?{message:t}:typeof t=="function"?t(a):t;return this._refinement((a,o)=>{let u=e(a),p=()=>o.addIssue({code:b.custom,...r(a)});return typeof Promise<"u"&&u instanceof Promise?u.then(x=>x?!0:(p(),!1)):u?!0:(p(),!1)})}refinement(e,t){return this._refinement((r,a)=>e(r)?!0:(a.addIssue(typeof t=="function"?t(r,a):t),!1))}_refinement(e){return new fe({schema:this,typeName:B.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:t=>this["~validate"](t)}}optional(){return pe.create(this,this._def)}nullable(){return we.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Ie.create(this)}promise(){return Pe.create(this,this._def)}or(e){return He.create([this,e],this._def)}and(e){return Je.create(this,e,this._def)}transform(e){return new fe({...P(this._def),schema:this,typeName:B.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let t=typeof e=="function"?e:()=>e;return new et({...P(this._def),innerType:this,defaultValue:t,typeName:B.ZodDefault})}brand(){return new Ot({typeName:B.ZodBranded,type:this,...P(this._def)})}catch(e){let t=typeof e=="function"?e:()=>e;return new tt({...P(this._def),innerType:this,catchValue:t,typeName:B.ZodCatch})}describe(e){let t=this.constructor;return new t({...this._def,description:e})}pipe(e){return Ut.create(this,e)}readonly(){return rt.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},Wo=/^c[^\s-]{8,}$/i,zo=/^[0-9a-z]+$/,Zo=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Go=/^[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,Ho=/^[a-z0-9_-]{21}$/i,Jo=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Yo=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,Ko=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Qo="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",_r,Xo=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,eu=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,tu=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,ru=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,nu=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,au=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,gi="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",iu=new RegExp(`^${gi}$`);function xi(n){let e="[0-5]\\d";n.precision?e=`${e}\\.\\d{${n.precision}}`:n.precision==null&&(e=`${e}(\\.\\d+)?`);let t=n.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${t}`}function su(n){return new RegExp(`^${xi(n)}$`)}function vi(n){let e=`${gi}T${xi(n)}`,t=[];return t.push(n.local?"Z?":"Z"),n.offset&&t.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${t.join("|")})`,new RegExp(`^${e}$`)}function ou(n,e){return!!((e==="v4"||!e)&&Xo.test(n)||(e==="v6"||!e)&&tu.test(n))}function uu(n,e){if(!Jo.test(n))return!1;try{let[t]=n.split(".");if(!t)return!1;let r=t.replace(/-/g,"+").replace(/_/g,"/").padEnd(t.length+(4-t.length%4)%4,"="),a=JSON.parse(atob(r));return!(typeof a!="object"||a===null||"typ"in a&&a?.typ!=="JWT"||!a.alg||e&&a.alg!==e)}catch{return!1}}function lu(n,e){return!!((e==="v4"||!e)&&eu.test(n)||(e==="v6"||!e)&&ru.test(n))}var Le=class n extends O{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==I.string){let o=this._getOrReturnCtx(e);return R(o,{code:b.invalid_type,expected:I.string,received:o.parsedType}),L}let r=new X,a;for(let o of this._def.checks)if(o.kind==="min")e.data.length<o.value&&(a=this._getOrReturnCtx(e,a),R(a,{code:b.too_small,minimum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),r.dirty());else if(o.kind==="max")e.data.length>o.value&&(a=this._getOrReturnCtx(e,a),R(a,{code:b.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),r.dirty());else if(o.kind==="length"){let u=e.data.length>o.value,p=e.data.length<o.value;(u||p)&&(a=this._getOrReturnCtx(e,a),u?R(a,{code:b.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message}):p&&R(a,{code:b.too_small,minimum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message}),r.dirty())}else if(o.kind==="email")Ko.test(e.data)||(a=this._getOrReturnCtx(e,a),R(a,{validation:"email",code:b.invalid_string,message:o.message}),r.dirty());else if(o.kind==="emoji")_r||(_r=new RegExp(Qo,"u")),_r.test(e.data)||(a=this._getOrReturnCtx(e,a),R(a,{validation:"emoji",code:b.invalid_string,message:o.message}),r.dirty());else if(o.kind==="uuid")Go.test(e.data)||(a=this._getOrReturnCtx(e,a),R(a,{validation:"uuid",code:b.invalid_string,message:o.message}),r.dirty());else if(o.kind==="nanoid")Ho.test(e.data)||(a=this._getOrReturnCtx(e,a),R(a,{validation:"nanoid",code:b.invalid_string,message:o.message}),r.dirty());else if(o.kind==="cuid")Wo.test(e.data)||(a=this._getOrReturnCtx(e,a),R(a,{validation:"cuid",code:b.invalid_string,message:o.message}),r.dirty());else if(o.kind==="cuid2")zo.test(e.data)||(a=this._getOrReturnCtx(e,a),R(a,{validation:"cuid2",code:b.invalid_string,message:o.message}),r.dirty());else if(o.kind==="ulid")Zo.test(e.data)||(a=this._getOrReturnCtx(e,a),R(a,{validation:"ulid",code:b.invalid_string,message:o.message}),r.dirty());else if(o.kind==="url")try{new URL(e.data)}catch{a=this._getOrReturnCtx(e,a),R(a,{validation:"url",code:b.invalid_string,message:o.message}),r.dirty()}else o.kind==="regex"?(o.regex.lastIndex=0,o.regex.test(e.data)||(a=this._getOrReturnCtx(e,a),R(a,{validation:"regex",code:b.invalid_string,message:o.message}),r.dirty())):o.kind==="trim"?e.data=e.data.trim():o.kind==="includes"?e.data.includes(o.value,o.position)||(a=this._getOrReturnCtx(e,a),R(a,{code:b.invalid_string,validation:{includes:o.value,position:o.position},message:o.message}),r.dirty()):o.kind==="toLowerCase"?e.data=e.data.toLowerCase():o.kind==="toUpperCase"?e.data=e.data.toUpperCase():o.kind==="startsWith"?e.data.startsWith(o.value)||(a=this._getOrReturnCtx(e,a),R(a,{code:b.invalid_string,validation:{startsWith:o.value},message:o.message}),r.dirty()):o.kind==="endsWith"?e.data.endsWith(o.value)||(a=this._getOrReturnCtx(e,a),R(a,{code:b.invalid_string,validation:{endsWith:o.value},message:o.message}),r.dirty()):o.kind==="datetime"?vi(o).test(e.data)||(a=this._getOrReturnCtx(e,a),R(a,{code:b.invalid_string,validation:"datetime",message:o.message}),r.dirty()):o.kind==="date"?iu.test(e.data)||(a=this._getOrReturnCtx(e,a),R(a,{code:b.invalid_string,validation:"date",message:o.message}),r.dirty()):o.kind==="time"?su(o).test(e.data)||(a=this._getOrReturnCtx(e,a),R(a,{code:b.invalid_string,validation:"time",message:o.message}),r.dirty()):o.kind==="duration"?Yo.test(e.data)||(a=this._getOrReturnCtx(e,a),R(a,{validation:"duration",code:b.invalid_string,message:o.message}),r.dirty()):o.kind==="ip"?ou(e.data,o.version)||(a=this._getOrReturnCtx(e,a),R(a,{validation:"ip",code:b.invalid_string,message:o.message}),r.dirty()):o.kind==="jwt"?uu(e.data,o.alg)||(a=this._getOrReturnCtx(e,a),R(a,{validation:"jwt",code:b.invalid_string,message:o.message}),r.dirty()):o.kind==="cidr"?lu(e.data,o.version)||(a=this._getOrReturnCtx(e,a),R(a,{validation:"cidr",code:b.invalid_string,message:o.message}),r.dirty()):o.kind==="base64"?nu.test(e.data)||(a=this._getOrReturnCtx(e,a),R(a,{validation:"base64",code:b.invalid_string,message:o.message}),r.dirty()):o.kind==="base64url"?au.test(e.data)||(a=this._getOrReturnCtx(e,a),R(a,{validation:"base64url",code:b.invalid_string,message:o.message}),r.dirty()):j.assertNever(o);return{status:r.value,value:e.data}}_regex(e,t,r){return this.refinement(a=>e.test(a),{validation:t,code:b.invalid_string,...A.errToObj(r)})}_addCheck(e){return new n({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...A.errToObj(e)})}url(e){return this._addCheck({kind:"url",...A.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...A.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...A.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...A.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...A.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...A.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...A.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...A.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...A.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...A.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...A.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...A.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...A.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof e?.precision>"u"?null:e?.precision,...A.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...A.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...A.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t?.position,...A.errToObj(t?.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...A.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...A.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...A.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...A.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...A.errToObj(t)})}nonempty(e){return this.min(1,A.errToObj(e))}trim(){return new n({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new n({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new n({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}};Le.create=n=>new Le({checks:[],typeName:B.ZodString,coerce:n?.coerce??!1,...P(n)});function cu(n,e){let t=(n.toString().split(".")[1]||"").length,r=(e.toString().split(".")[1]||"").length,a=t>r?t:r,o=Number.parseInt(n.toFixed(a).replace(".","")),u=Number.parseInt(e.toFixed(a).replace(".",""));return o%u/10**a}var Ve=class n extends O{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==I.number){let o=this._getOrReturnCtx(e);return R(o,{code:b.invalid_type,expected:I.number,received:o.parsedType}),L}let r,a=new X;for(let o of this._def.checks)o.kind==="int"?j.isInteger(e.data)||(r=this._getOrReturnCtx(e,r),R(r,{code:b.invalid_type,expected:"integer",received:"float",message:o.message}),a.dirty()):o.kind==="min"?(o.inclusive?e.data<o.value:e.data<=o.value)&&(r=this._getOrReturnCtx(e,r),R(r,{code:b.too_small,minimum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),a.dirty()):o.kind==="max"?(o.inclusive?e.data>o.value:e.data>=o.value)&&(r=this._getOrReturnCtx(e,r),R(r,{code:b.too_big,maximum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),a.dirty()):o.kind==="multipleOf"?cu(e.data,o.value)!==0&&(r=this._getOrReturnCtx(e,r),R(r,{code:b.not_multiple_of,multipleOf:o.value,message:o.message}),a.dirty()):o.kind==="finite"?Number.isFinite(e.data)||(r=this._getOrReturnCtx(e,r),R(r,{code:b.not_finite,message:o.message}),a.dirty()):j.assertNever(o);return{status:a.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,A.toString(t))}gt(e,t){return this.setLimit("min",e,!1,A.toString(t))}lte(e,t){return this.setLimit("max",e,!0,A.toString(t))}lt(e,t){return this.setLimit("max",e,!1,A.toString(t))}setLimit(e,t,r,a){return new n({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:A.toString(a)}]})}_addCheck(e){return new n({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:A.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:A.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:A.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:A.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:A.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:A.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:A.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:A.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:A.toString(e)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&j.isInteger(e.value))}get isFinite(){let e=null,t=null;for(let r of this._def.checks){if(r.kind==="finite"||r.kind==="int"||r.kind==="multipleOf")return!0;r.kind==="min"?(t===null||r.value>t)&&(t=r.value):r.kind==="max"&&(e===null||r.value<e)&&(e=r.value)}return Number.isFinite(t)&&Number.isFinite(e)}};Ve.create=n=>new Ve({checks:[],typeName:B.ZodNumber,coerce:n?.coerce||!1,...P(n)});var qe=class n extends O{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==I.bigint)return this._getInvalidInput(e);let r,a=new X;for(let o of this._def.checks)o.kind==="min"?(o.inclusive?e.data<o.value:e.data<=o.value)&&(r=this._getOrReturnCtx(e,r),R(r,{code:b.too_small,type:"bigint",minimum:o.value,inclusive:o.inclusive,message:o.message}),a.dirty()):o.kind==="max"?(o.inclusive?e.data>o.value:e.data>=o.value)&&(r=this._getOrReturnCtx(e,r),R(r,{code:b.too_big,type:"bigint",maximum:o.value,inclusive:o.inclusive,message:o.message}),a.dirty()):o.kind==="multipleOf"?e.data%o.value!==BigInt(0)&&(r=this._getOrReturnCtx(e,r),R(r,{code:b.not_multiple_of,multipleOf:o.value,message:o.message}),a.dirty()):j.assertNever(o);return{status:a.value,value:e.data}}_getInvalidInput(e){let t=this._getOrReturnCtx(e);return R(t,{code:b.invalid_type,expected:I.bigint,received:t.parsedType}),L}gte(e,t){return this.setLimit("min",e,!0,A.toString(t))}gt(e,t){return this.setLimit("min",e,!1,A.toString(t))}lte(e,t){return this.setLimit("max",e,!0,A.toString(t))}lt(e,t){return this.setLimit("max",e,!1,A.toString(t))}setLimit(e,t,r,a){return new n({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:A.toString(a)}]})}_addCheck(e){return new n({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:A.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:A.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:A.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:A.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:A.toString(t)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}};qe.create=n=>new qe({checks:[],typeName:B.ZodBigInt,coerce:n?.coerce??!1,...P(n)});var We=class extends O{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==I.boolean){let r=this._getOrReturnCtx(e);return R(r,{code:b.invalid_type,expected:I.boolean,received:r.parsedType}),L}return te(e.data)}};We.create=n=>new We({typeName:B.ZodBoolean,coerce:n?.coerce||!1,...P(n)});var ze=class n extends O{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==I.date){let o=this._getOrReturnCtx(e);return R(o,{code:b.invalid_type,expected:I.date,received:o.parsedType}),L}if(Number.isNaN(e.data.getTime())){let o=this._getOrReturnCtx(e);return R(o,{code:b.invalid_date}),L}let r=new X,a;for(let o of this._def.checks)o.kind==="min"?e.data.getTime()<o.value&&(a=this._getOrReturnCtx(e,a),R(a,{code:b.too_small,message:o.message,inclusive:!0,exact:!1,minimum:o.value,type:"date"}),r.dirty()):o.kind==="max"?e.data.getTime()>o.value&&(a=this._getOrReturnCtx(e,a),R(a,{code:b.too_big,message:o.message,inclusive:!0,exact:!1,maximum:o.value,type:"date"}),r.dirty()):j.assertNever(o);return{status:r.value,value:new Date(e.data.getTime())}}_addCheck(e){return new n({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:A.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:A.toString(t)})}get minDate(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e!=null?new Date(e):null}};ze.create=n=>new ze({checks:[],coerce:n?.coerce||!1,typeName:B.ZodDate,...P(n)});var gt=class extends O{_parse(e){if(this._getType(e)!==I.symbol){let r=this._getOrReturnCtx(e);return R(r,{code:b.invalid_type,expected:I.symbol,received:r.parsedType}),L}return te(e.data)}};gt.create=n=>new gt({typeName:B.ZodSymbol,...P(n)});var Ze=class extends O{_parse(e){if(this._getType(e)!==I.undefined){let r=this._getOrReturnCtx(e);return R(r,{code:b.invalid_type,expected:I.undefined,received:r.parsedType}),L}return te(e.data)}};Ze.create=n=>new Ze({typeName:B.ZodUndefined,...P(n)});var Ge=class extends O{_parse(e){if(this._getType(e)!==I.null){let r=this._getOrReturnCtx(e);return R(r,{code:b.invalid_type,expected:I.null,received:r.parsedType}),L}return te(e.data)}};Ge.create=n=>new Ge({typeName:B.ZodNull,...P(n)});var Be=class extends O{constructor(){super(...arguments),this._any=!0}_parse(e){return te(e.data)}};Be.create=n=>new Be({typeName:B.ZodAny,...P(n)});var Re=class extends O{constructor(){super(...arguments),this._unknown=!0}_parse(e){return te(e.data)}};Re.create=n=>new Re({typeName:B.ZodUnknown,...P(n)});var he=class extends O{_parse(e){let t=this._getOrReturnCtx(e);return R(t,{code:b.invalid_type,expected:I.never,received:t.parsedType}),L}};he.create=n=>new he({typeName:B.ZodNever,...P(n)});var xt=class extends O{_parse(e){if(this._getType(e)!==I.undefined){let r=this._getOrReturnCtx(e);return R(r,{code:b.invalid_type,expected:I.void,received:r.parsedType}),L}return te(e.data)}};xt.create=n=>new xt({typeName:B.ZodVoid,...P(n)});var Ie=class n extends O{_parse(e){let{ctx:t,status:r}=this._processInputParams(e),a=this._def;if(t.parsedType!==I.array)return R(t,{code:b.invalid_type,expected:I.array,received:t.parsedType}),L;if(a.exactLength!==null){let u=t.data.length>a.exactLength.value,p=t.data.length<a.exactLength.value;(u||p)&&(R(t,{code:u?b.too_big:b.too_small,minimum:p?a.exactLength.value:void 0,maximum:u?a.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:a.exactLength.message}),r.dirty())}if(a.minLength!==null&&t.data.length<a.minLength.value&&(R(t,{code:b.too_small,minimum:a.minLength.value,type:"array",inclusive:!0,exact:!1,message:a.minLength.message}),r.dirty()),a.maxLength!==null&&t.data.length>a.maxLength.value&&(R(t,{code:b.too_big,maximum:a.maxLength.value,type:"array",inclusive:!0,exact:!1,message:a.maxLength.message}),r.dirty()),t.common.async)return Promise.all([...t.data].map((u,p)=>a.type._parseAsync(new de(t,u,t.path,p)))).then(u=>X.mergeArray(r,u));let o=[...t.data].map((u,p)=>a.type._parseSync(new de(t,u,t.path,p)));return X.mergeArray(r,o)}get element(){return this._def.type}min(e,t){return new n({...this._def,minLength:{value:e,message:A.toString(t)}})}max(e,t){return new n({...this._def,maxLength:{value:e,message:A.toString(t)}})}length(e,t){return new n({...this._def,exactLength:{value:e,message:A.toString(t)}})}nonempty(e){return this.min(1,e)}};Ie.create=(n,e)=>new Ie({type:n,minLength:null,maxLength:null,exactLength:null,typeName:B.ZodArray,...P(e)});function yt(n){if(n instanceof oe){let e={};for(let t in n.shape){let r=n.shape[t];e[t]=pe.create(yt(r))}return new oe({...n._def,shape:()=>e})}else return n instanceof Ie?new Ie({...n._def,type:yt(n.element)}):n instanceof pe?pe.create(yt(n.unwrap())):n instanceof we?we.create(yt(n.unwrap())):n instanceof ve?ve.create(n.items.map(e=>yt(e))):n}var oe=class n extends O{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),t=j.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==I.object){let w=this._getOrReturnCtx(e);return R(w,{code:b.invalid_type,expected:I.object,received:w.parsedType}),L}let{status:r,ctx:a}=this._processInputParams(e),{shape:o,keys:u}=this._getCached(),p=[];if(!(this._def.catchall instanceof he&&this._def.unknownKeys==="strip"))for(let w in a.data)u.includes(w)||p.push(w);let x=[];for(let w of u){let E=o[w],F=a.data[w];x.push({key:{status:"valid",value:w},value:E._parse(new de(a,F,a.path,w)),alwaysSet:w in a.data})}if(this._def.catchall instanceof he){let w=this._def.unknownKeys;if(w==="passthrough")for(let E of p)x.push({key:{status:"valid",value:E},value:{status:"valid",value:a.data[E]}});else if(w==="strict")p.length>0&&(R(a,{code:b.unrecognized_keys,keys:p}),r.dirty());else if(w!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let w=this._def.catchall;for(let E of p){let F=a.data[E];x.push({key:{status:"valid",value:E},value:w._parse(new de(a,F,a.path,E)),alwaysSet:E in a.data})}}return a.common.async?Promise.resolve().then(async()=>{let w=[];for(let E of x){let F=await E.key,J=await E.value;w.push({key:F,value:J,alwaysSet:E.alwaysSet})}return w}).then(w=>X.mergeObjectSync(r,w)):X.mergeObjectSync(r,x)}get shape(){return this._def.shape()}strict(e){return A.errToObj,new n({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,r)=>{let a=this._def.errorMap?.(t,r).message??r.defaultError;return t.code==="unrecognized_keys"?{message:A.errToObj(e).message??a}:{message:a}}}:{}})}strip(){return new n({...this._def,unknownKeys:"strip"})}passthrough(){return new n({...this._def,unknownKeys:"passthrough"})}extend(e){return new n({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new n({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:B.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new n({...this._def,catchall:e})}pick(e){let t={};for(let r of j.objectKeys(e))e[r]&&this.shape[r]&&(t[r]=this.shape[r]);return new n({...this._def,shape:()=>t})}omit(e){let t={};for(let r of j.objectKeys(this.shape))e[r]||(t[r]=this.shape[r]);return new n({...this._def,shape:()=>t})}deepPartial(){return yt(this)}partial(e){let t={};for(let r of j.objectKeys(this.shape)){let a=this.shape[r];e&&!e[r]?t[r]=a:t[r]=a.optional()}return new n({...this._def,shape:()=>t})}required(e){let t={};for(let r of j.objectKeys(this.shape))if(e&&!e[r])t[r]=this.shape[r];else{let o=this.shape[r];for(;o instanceof pe;)o=o._def.innerType;t[r]=o}return new n({...this._def,shape:()=>t})}keyof(){return wi(j.objectKeys(this.shape))}};oe.create=(n,e)=>new oe({shape:()=>n,unknownKeys:"strip",catchall:he.create(),typeName:B.ZodObject,...P(e)});oe.strictCreate=(n,e)=>new oe({shape:()=>n,unknownKeys:"strict",catchall:he.create(),typeName:B.ZodObject,...P(e)});oe.lazycreate=(n,e)=>new oe({shape:n,unknownKeys:"strip",catchall:he.create(),typeName:B.ZodObject,...P(e)});var He=class extends O{_parse(e){let{ctx:t}=this._processInputParams(e),r=this._def.options;function a(o){for(let p of o)if(p.result.status==="valid")return p.result;for(let p of o)if(p.result.status==="dirty")return t.common.issues.push(...p.ctx.common.issues),p.result;let u=o.map(p=>new se(p.ctx.common.issues));return R(t,{code:b.invalid_union,unionErrors:u}),L}if(t.common.async)return Promise.all(r.map(async o=>{let u={...t,common:{...t.common,issues:[]},parent:null};return{result:await o._parseAsync({data:t.data,path:t.path,parent:u}),ctx:u}})).then(a);{let o,u=[];for(let x of r){let w={...t,common:{...t.common,issues:[]},parent:null},E=x._parseSync({data:t.data,path:t.path,parent:w});if(E.status==="valid")return E;E.status==="dirty"&&!o&&(o={result:E,ctx:w}),w.common.issues.length&&u.push(w.common.issues)}if(o)return t.common.issues.push(...o.ctx.common.issues),o.result;let p=u.map(x=>new se(x));return R(t,{code:b.invalid_union,unionErrors:p}),L}}get options(){return this._def.options}};He.create=(n,e)=>new He({options:n,typeName:B.ZodUnion,...P(e)});var Ne=n=>n instanceof Ye?Ne(n.schema):n instanceof fe?Ne(n.innerType()):n instanceof Ke?[n.value]:n instanceof Qe?n.options:n instanceof Xe?j.objectValues(n.enum):n instanceof et?Ne(n._def.innerType):n instanceof Ze?[void 0]:n instanceof Ge?[null]:n instanceof pe?[void 0,...Ne(n.unwrap())]:n instanceof we?[null,...Ne(n.unwrap())]:n instanceof Ot||n instanceof rt?Ne(n.unwrap()):n instanceof tt?Ne(n._def.innerType):[],Yt=class n extends O{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==I.object)return R(t,{code:b.invalid_type,expected:I.object,received:t.parsedType}),L;let r=this.discriminator,a=t.data[r],o=this.optionsMap.get(a);return o?t.common.async?o._parseAsync({data:t.data,path:t.path,parent:t}):o._parseSync({data:t.data,path:t.path,parent:t}):(R(t,{code:b.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),L)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,r){let a=new Map;for(let o of t){let u=Ne(o.shape[e]);if(!u.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let p of u){if(a.has(p))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(p)}`);a.set(p,o)}}return new n({typeName:B.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:a,...P(r)})}};function kr(n,e){let t=xe(n),r=xe(e);if(n===e)return{valid:!0,data:n};if(t===I.object&&r===I.object){let a=j.objectKeys(e),o=j.objectKeys(n).filter(p=>a.indexOf(p)!==-1),u={...n,...e};for(let p of o){let x=kr(n[p],e[p]);if(!x.valid)return{valid:!1};u[p]=x.data}return{valid:!0,data:u}}else if(t===I.array&&r===I.array){if(n.length!==e.length)return{valid:!1};let a=[];for(let o=0;o<n.length;o++){let u=n[o],p=e[o],x=kr(u,p);if(!x.valid)return{valid:!1};a.push(x.data)}return{valid:!0,data:a}}else return t===I.date&&r===I.date&&+n==+e?{valid:!0,data:n}:{valid:!1}}var Je=class extends O{_parse(e){let{status:t,ctx:r}=this._processInputParams(e),a=(o,u)=>{if(Ht(o)||Ht(u))return L;let p=kr(o.value,u.value);return p.valid?((Jt(o)||Jt(u))&&t.dirty(),{status:t.value,value:p.data}):(R(r,{code:b.invalid_intersection_types}),L)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([o,u])=>a(o,u)):a(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}};Je.create=(n,e,t)=>new Je({left:n,right:e,typeName:B.ZodIntersection,...P(t)});var ve=class n extends O{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==I.array)return R(r,{code:b.invalid_type,expected:I.array,received:r.parsedType}),L;if(r.data.length<this._def.items.length)return R(r,{code:b.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),L;!this._def.rest&&r.data.length>this._def.items.length&&(R(r,{code:b.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());let o=[...r.data].map((u,p)=>{let x=this._def.items[p]||this._def.rest;return x?x._parse(new de(r,u,r.path,p)):null}).filter(u=>!!u);return r.common.async?Promise.all(o).then(u=>X.mergeArray(t,u)):X.mergeArray(t,o)}get items(){return this._def.items}rest(e){return new n({...this._def,rest:e})}};ve.create=(n,e)=>{if(!Array.isArray(n))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new ve({items:n,typeName:B.ZodTuple,rest:null,...P(e)})};var Kt=class n extends O{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==I.object)return R(r,{code:b.invalid_type,expected:I.object,received:r.parsedType}),L;let a=[],o=this._def.keyType,u=this._def.valueType;for(let p in r.data)a.push({key:o._parse(new de(r,p,r.path,p)),value:u._parse(new de(r,r.data[p],r.path,p)),alwaysSet:p in r.data});return r.common.async?X.mergeObjectAsync(t,a):X.mergeObjectSync(t,a)}get element(){return this._def.valueType}static create(e,t,r){return t instanceof O?new n({keyType:e,valueType:t,typeName:B.ZodRecord,...P(r)}):new n({keyType:Le.create(),valueType:e,typeName:B.ZodRecord,...P(t)})}},vt=class extends O{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==I.map)return R(r,{code:b.invalid_type,expected:I.map,received:r.parsedType}),L;let a=this._def.keyType,o=this._def.valueType,u=[...r.data.entries()].map(([p,x],w)=>({key:a._parse(new de(r,p,r.path,[w,"key"])),value:o._parse(new de(r,x,r.path,[w,"value"]))}));if(r.common.async){let p=new Map;return Promise.resolve().then(async()=>{for(let x of u){let w=await x.key,E=await x.value;if(w.status==="aborted"||E.status==="aborted")return L;(w.status==="dirty"||E.status==="dirty")&&t.dirty(),p.set(w.value,E.value)}return{status:t.value,value:p}})}else{let p=new Map;for(let x of u){let w=x.key,E=x.value;if(w.status==="aborted"||E.status==="aborted")return L;(w.status==="dirty"||E.status==="dirty")&&t.dirty(),p.set(w.value,E.value)}return{status:t.value,value:p}}}};vt.create=(n,e,t)=>new vt({valueType:e,keyType:n,typeName:B.ZodMap,...P(t)});var wt=class n extends O{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==I.set)return R(r,{code:b.invalid_type,expected:I.set,received:r.parsedType}),L;let a=this._def;a.minSize!==null&&r.data.size<a.minSize.value&&(R(r,{code:b.too_small,minimum:a.minSize.value,type:"set",inclusive:!0,exact:!1,message:a.minSize.message}),t.dirty()),a.maxSize!==null&&r.data.size>a.maxSize.value&&(R(r,{code:b.too_big,maximum:a.maxSize.value,type:"set",inclusive:!0,exact:!1,message:a.maxSize.message}),t.dirty());let o=this._def.valueType;function u(x){let w=new Set;for(let E of x){if(E.status==="aborted")return L;E.status==="dirty"&&t.dirty(),w.add(E.value)}return{status:t.value,value:w}}let p=[...r.data.values()].map((x,w)=>o._parse(new de(r,x,r.path,w)));return r.common.async?Promise.all(p).then(x=>u(x)):u(p)}min(e,t){return new n({...this._def,minSize:{value:e,message:A.toString(t)}})}max(e,t){return new n({...this._def,maxSize:{value:e,message:A.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}};wt.create=(n,e)=>new wt({valueType:n,minSize:null,maxSize:null,typeName:B.ZodSet,...P(e)});var Qt=class n extends O{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==I.function)return R(t,{code:b.invalid_type,expected:I.function,received:t.parsedType}),L;function r(p,x){return Ft({data:p,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,mt(),ke].filter(w=>!!w),issueData:{code:b.invalid_arguments,argumentsError:x}})}function a(p,x){return Ft({data:p,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,mt(),ke].filter(w=>!!w),issueData:{code:b.invalid_return_type,returnTypeError:x}})}let o={errorMap:t.common.contextualErrorMap},u=t.data;if(this._def.returns instanceof Pe){let p=this;return te(async function(...x){let w=new se([]),E=await p._def.args.parseAsync(x,o).catch(S=>{throw w.addIssue(r(x,S)),w}),F=await Reflect.apply(u,this,E);return await p._def.returns._def.type.parseAsync(F,o).catch(S=>{throw w.addIssue(a(F,S)),w})})}else{let p=this;return te(function(...x){let w=p._def.args.safeParse(x,o);if(!w.success)throw new se([r(x,w.error)]);let E=Reflect.apply(u,this,w.data),F=p._def.returns.safeParse(E,o);if(!F.success)throw new se([a(E,F.error)]);return F.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new n({...this._def,args:ve.create(e).rest(Re.create())})}returns(e){return new n({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,r){return new n({args:e||ve.create([]).rest(Re.create()),returns:t||Re.create(),typeName:B.ZodFunction,...P(r)})}},Ye=class extends O{get schema(){return this._def.getter()}_parse(e){let{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}};Ye.create=(n,e)=>new Ye({getter:n,typeName:B.ZodLazy,...P(e)});var Ke=class extends O{_parse(e){if(e.data!==this._def.value){let t=this._getOrReturnCtx(e);return R(t,{received:t.data,code:b.invalid_literal,expected:this._def.value}),L}return{status:"valid",value:e.data}}get value(){return this._def.value}};Ke.create=(n,e)=>new Ke({value:n,typeName:B.ZodLiteral,...P(e)});function wi(n,e){return new Qe({values:n,typeName:B.ZodEnum,...P(e)})}var Qe=class n extends O{_parse(e){if(typeof e.data!="string"){let t=this._getOrReturnCtx(e),r=this._def.values;return R(t,{expected:j.joinValues(r),received:t.parsedType,code:b.invalid_type}),L}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){let t=this._getOrReturnCtx(e),r=this._def.values;return R(t,{received:t.data,code:b.invalid_enum_value,options:r}),L}return te(e.data)}get options(){return this._def.values}get enum(){let e={};for(let t of this._def.values)e[t]=t;return e}get Values(){let e={};for(let t of this._def.values)e[t]=t;return e}get Enum(){let e={};for(let t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return n.create(e,{...this._def,...t})}exclude(e,t=this._def){return n.create(this.options.filter(r=>!e.includes(r)),{...this._def,...t})}};Qe.create=wi;var Xe=class extends O{_parse(e){let t=j.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==I.string&&r.parsedType!==I.number){let a=j.objectValues(t);return R(r,{expected:j.joinValues(a),received:r.parsedType,code:b.invalid_type}),L}if(this._cache||(this._cache=new Set(j.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let a=j.objectValues(t);return R(r,{received:r.data,code:b.invalid_enum_value,options:a}),L}return te(e.data)}get enum(){return this._def.values}};Xe.create=(n,e)=>new Xe({values:n,typeName:B.ZodNativeEnum,...P(e)});var Pe=class extends O{unwrap(){return this._def.type}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==I.promise&&t.common.async===!1)return R(t,{code:b.invalid_type,expected:I.promise,received:t.parsedType}),L;let r=t.parsedType===I.promise?t.data:Promise.resolve(t.data);return te(r.then(a=>this._def.type.parseAsync(a,{path:t.path,errorMap:t.common.contextualErrorMap})))}};Pe.create=(n,e)=>new Pe({type:n,typeName:B.ZodPromise,...P(e)});var fe=class extends O{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===B.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:t,ctx:r}=this._processInputParams(e),a=this._def.effect||null,o={addIssue:u=>{R(r,u),u.fatal?t.abort():t.dirty()},get path(){return r.path}};if(o.addIssue=o.addIssue.bind(o),a.type==="preprocess"){let u=a.transform(r.data,o);if(r.common.async)return Promise.resolve(u).then(async p=>{if(t.value==="aborted")return L;let x=await this._def.schema._parseAsync({data:p,path:r.path,parent:r});return x.status==="aborted"?L:x.status==="dirty"?De(x.value):t.value==="dirty"?De(x.value):x});{if(t.value==="aborted")return L;let p=this._def.schema._parseSync({data:u,path:r.path,parent:r});return p.status==="aborted"?L:p.status==="dirty"?De(p.value):t.value==="dirty"?De(p.value):p}}if(a.type==="refinement"){let u=p=>{let x=a.refinement(p,o);if(r.common.async)return Promise.resolve(x);if(x instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return p};if(r.common.async===!1){let p=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return p.status==="aborted"?L:(p.status==="dirty"&&t.dirty(),u(p.value),{status:t.value,value:p.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(p=>p.status==="aborted"?L:(p.status==="dirty"&&t.dirty(),u(p.value).then(()=>({status:t.value,value:p.value}))))}if(a.type==="transform")if(r.common.async===!1){let u=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!Ce(u))return L;let p=a.transform(u.value,o);if(p instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:p}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(u=>Ce(u)?Promise.resolve(a.transform(u.value,o)).then(p=>({status:t.value,value:p})):L);j.assertNever(a)}};fe.create=(n,e,t)=>new fe({schema:n,typeName:B.ZodEffects,effect:e,...P(t)});fe.createWithPreprocess=(n,e,t)=>new fe({schema:e,effect:{type:"preprocess",transform:n},typeName:B.ZodEffects,...P(t)});var pe=class extends O{_parse(e){return this._getType(e)===I.undefined?te(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};pe.create=(n,e)=>new pe({innerType:n,typeName:B.ZodOptional,...P(e)});var we=class extends O{_parse(e){return this._getType(e)===I.null?te(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};we.create=(n,e)=>new we({innerType:n,typeName:B.ZodNullable,...P(e)});var et=class extends O{_parse(e){let{ctx:t}=this._processInputParams(e),r=t.data;return t.parsedType===I.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:t.path,parent:t})}removeDefault(){return this._def.innerType}};et.create=(n,e)=>new et({innerType:n,typeName:B.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...P(e)});var tt=class extends O{_parse(e){let{ctx:t}=this._processInputParams(e),r={...t,common:{...t.common,issues:[]}},a=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return ht(a)?a.then(o=>({status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new se(r.common.issues)},input:r.data})})):{status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new se(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}};tt.create=(n,e)=>new tt({innerType:n,typeName:B.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...P(e)});var bt=class extends O{_parse(e){if(this._getType(e)!==I.nan){let r=this._getOrReturnCtx(e);return R(r,{code:b.invalid_type,expected:I.nan,received:r.parsedType}),L}return{status:"valid",value:e.data}}};bt.create=n=>new bt({typeName:B.ZodNaN,...P(n)});var pu=Symbol("zod_brand"),Ot=class extends O{_parse(e){let{ctx:t}=this._processInputParams(e),r=t.data;return this._def.type._parse({data:r,path:t.path,parent:t})}unwrap(){return this._def.type}},Ut=class n extends O{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.common.async)return(async()=>{let o=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return o.status==="aborted"?L:o.status==="dirty"?(t.dirty(),De(o.value)):this._def.out._parseAsync({data:o.value,path:r.path,parent:r})})();{let a=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return a.status==="aborted"?L:a.status==="dirty"?(t.dirty(),{status:"dirty",value:a.value}):this._def.out._parseSync({data:a.value,path:r.path,parent:r})}}static create(e,t){return new n({in:e,out:t,typeName:B.ZodPipeline})}},rt=class extends O{_parse(e){let t=this._def.innerType._parse(e),r=a=>(Ce(a)&&(a.value=Object.freeze(a.value)),a);return ht(t)?t.then(a=>r(a)):r(t)}unwrap(){return this._def.innerType}};rt.create=(n,e)=>new rt({innerType:n,typeName:B.ZodReadonly,...P(e)});function yi(n,e){let t=typeof n=="function"?n(e):typeof n=="string"?{message:n}:n;return typeof t=="string"?{message:t}:t}function bi(n,e={},t){return n?Be.create().superRefine((r,a)=>{let o=n(r);if(o instanceof Promise)return o.then(u=>{if(!u){let p=yi(e,r),x=p.fatal??t??!0;a.addIssue({code:"custom",...p,fatal:x})}});if(!o){let u=yi(e,r),p=u.fatal??t??!0;a.addIssue({code:"custom",...u,fatal:p})}}):Be.create()}var du={object:oe.lazycreate},B;(function(n){n.ZodString="ZodString",n.ZodNumber="ZodNumber",n.ZodNaN="ZodNaN",n.ZodBigInt="ZodBigInt",n.ZodBoolean="ZodBoolean",n.ZodDate="ZodDate",n.ZodSymbol="ZodSymbol",n.ZodUndefined="ZodUndefined",n.ZodNull="ZodNull",n.ZodAny="ZodAny",n.ZodUnknown="ZodUnknown",n.ZodNever="ZodNever",n.ZodVoid="ZodVoid",n.ZodArray="ZodArray",n.ZodObject="ZodObject",n.ZodUnion="ZodUnion",n.ZodDiscriminatedUnion="ZodDiscriminatedUnion",n.ZodIntersection="ZodIntersection",n.ZodTuple="ZodTuple",n.ZodRecord="ZodRecord",n.ZodMap="ZodMap",n.ZodSet="ZodSet",n.ZodFunction="ZodFunction",n.ZodLazy="ZodLazy",n.ZodLiteral="ZodLiteral",n.ZodEnum="ZodEnum",n.ZodEffects="ZodEffects",n.ZodNativeEnum="ZodNativeEnum",n.ZodOptional="ZodOptional",n.ZodNullable="ZodNullable",n.ZodDefault="ZodDefault",n.ZodCatch="ZodCatch",n.ZodPromise="ZodPromise",n.ZodBranded="ZodBranded",n.ZodPipeline="ZodPipeline",n.ZodReadonly="ZodReadonly"})(B||(B={}));var fu=(n,e={message:`Input not instance of ${n.name}`})=>bi(t=>t instanceof n,e),Ti=Le.create,_i=Ve.create,mu=bt.create,hu=qe.create,ki=We.create,yu=ze.create,gu=gt.create,xu=Ze.create,vu=Ge.create,wu=Be.create,bu=Re.create,Tu=he.create,_u=xt.create,ku=Ie.create,Nu=oe.create,Ru=oe.strictCreate,Iu=He.create,Eu=Yt.create,Au=Je.create,Su=ve.create,Cu=Kt.create,Lu=vt.create,Bu=wt.create,Pu=Qt.create,Fu=Ye.create,Ou=Ke.create,Uu=Qe.create,ju=Xe.create,Mu=Pe.create,$u=fe.create,Du=pe.create,Vu=we.create,qu=fe.createWithPreprocess,Wu=Ut.create,zu=()=>Ti().optional(),Zu=()=>_i().optional(),Gu=()=>ki().optional(),Hu={string:(n=>Le.create({...n,coerce:!0})),number:(n=>Ve.create({...n,coerce:!0})),boolean:(n=>We.create({...n,coerce:!0})),bigint:(n=>qe.create({...n,coerce:!0})),date:(n=>ze.create({...n,coerce:!0}))};var Ju=L;m();y();h();var Ni=D.strictObject({title:D.string(),content:D.string()});var Nr=D.object({"base-api-exception-class-name":D.string().optional(),"base-exception-class-name":D.string().optional(),"client-class-name":D.string().optional(),"inline-file-properties":D.boolean().optional(),"inline-path-parameters":D.boolean().optional(),"package-layout":D.enum(["flat","nested"]).optional(),"package-prefix":D.string().optional(),"use-local-date-for-dates":D.boolean().optional(),"custom-dependencies":D.array(D.string()).optional(),"disable-required-property-builder-checks":D.boolean().optional(),"enable-forward-compatible-enums":D.boolean().optional(),"enable-inline-types":D.boolean().optional(),"enable-public-constructors":D.boolean().optional(),"generate-unknown-as-json-node":D.boolean().optional(),"json-include":D.enum(["non-absent","non-empty"]).optional(),"enable-extensible-builders":D.boolean().optional(),"use-default-request-parameter-values":D.boolean().optional(),"enable-wire-tests":D.boolean().default(!1),"collapse-optional-nullable":D.boolean().optional(),"custom-readme-sections":D.array(Ni).optional(),"custom-pager-name":D.string().optional(),"default-timeout-in-seconds":D.number().optional(),"gradle-distribution-url":D.string().optional(),"gradle-plugin-management":D.string().optional(),"wrapped-aliases":D.boolean().optional()});var d={};pr(d,{Access:()=>Rr,AstNode:()=>Z,Class:()=>nt,ClassInstantiation:()=>at,ClassReference:()=>V,CodeBlock:()=>it,Method:()=>st,MethodInvocation:()=>ot,Parameter:()=>ut,Type:()=>jt,TypeLiteral:()=>ue,Writer:()=>$e,classReference:()=>yl,class_:()=>hl,codeblock:()=>ml,instantiateClass:()=>gl,invokeMethod:()=>xl,method:()=>vl,parameter:()=>wl});m();y();h();m();y();h();m();y();h();var Rr={Public:"public",Protected:"protected",Private:"private"};m();y();h();m();y();h();var Z=class extends je{async toStringAsync({packageName:e,customConfig:t,formatter:r}){let a=new Pt({packageName:e,customConfig:t,formatter:r});return this.write(a),a.toStringAsync()}toString({packageName:e,customConfig:t,formatter:r}){let a=new Pt({packageName:e,customConfig:t,formatter:r});return this.write(a),a.toString()}};var nt=class extends Z{constructor({name:t,access:r}){super();_(this,"name");_(this,"access");_(this,"methods",[]);this.name=t,this.access=r}write(t){if(t.write(`${this.access} class ${this.name}`),this.isEmpty()){t.writeLine(" {}");return}t.writeLine(" {"),t.indent();for(let r of this.methods)t.writeNode(r),t.newLine();t.dedent(),t.write("}")}addMethod(t){this.methods.push(t)}isEmpty(){return this.methods.length===0}};m();y();h();m();y();h();m();y();h();m();y();h();var V=class extends Z{constructor({name:t,packageName:r,fullyQualified:a}){super();_(this,"name");_(this,"packageName");_(this,"fullyQualified");this.name=t,this.packageName=r,this.fullyQualified=a??!1}write(t){if(t.addImport(`${this.packageName}.${this.name}`),this.fullyQualified){t.write(`${this.packageName}.${this.name}`);return}t.write(this.name)}};m();y();h();var jt=class extends Z{constructor(t){super();_(this,"internalType");this.internalType=t}write(t){switch(this.internalType.type){case"array":t.writeNode(this.internalType.value),t.write("[]");break;case"bigInteger":t.writeNode(Yu);break;case"boolean":t.write("Boolean");break;case"bytes":t.write("byte[]");break;case"date":t.write("String");break;case"dateTime":t.writeNode(Xu);break;case"double":t.write("Double");break;case"float":t.write("Float");break;case"generic":t.writeNode(this.internalType.value),t.write("<");for(let[r,a]of this.internalType.parameters.entries())t.writeNode(a),r<this.internalType.parameters.length-1&&t.write(", ");t.write(">");break;case"inputStream":t.writeNode(rl);break;case"integer":t.write("Integer");break;case"iterable":this.writeIterable({writer:t,iterable:this.internalType});break;case"list":{this.writeList({writer:t,list:this.internalType});break}case"long":{t.write("Long");break}case"map":{this.writeMap({writer:t,map:this.internalType});break}case"object":{t.write("Object");break}case"optional":{this.writeOptional({writer:t,optional:this.internalType});break}case"reference":t.writeNode(this.internalType.value);break;case"set":{this.writeSet({writer:t,set:this.internalType});break}case"string":t.write("String");break;case"uuid":t.writeNode(tl);break;case"void":t.write("Void");break;default:M(this.internalType)}}isOptional(){return this.internalType.type==="optional"}static array(t){return new this({type:"array",value:t})}static bigInteger(){return new this({type:"bigInteger"})}static boolean(){return new this({type:"boolean"})}static bytes(){return new this({type:"bytes"})}static date(){return new this({type:"date"})}static dateTime(){return new this({type:"dateTime"})}static double(){return new this({type:"double"})}static float(){return new this({type:"float"})}static integer(){return new this({type:"integer"})}static list(t){return new this({type:"list",value:t})}static long(){return new this({type:"long"})}static map(t,r){return new this({type:"map",keyType:t,valueType:r})}static object(){return new this({type:"object"})}static optional(t){return this.isAlreadyOptional(t)?t:new this({type:"optional",value:t})}static reference(t){return new this({type:"reference",value:t})}static generic(t,r){return new this({type:"generic",value:t,parameters:r})}static set(t){return new this({type:"set",value:t})}static string(){return new this({type:"string"})}static uuid(){return new this({type:"uuid"})}static void(){return new this({type:"void"})}static iterable(t){return new this({type:"iterable",value:t})}static inputStream(){return new this({type:"inputStream"})}writeList({writer:t,list:r}){t.writeNode(Ku),t.write("<"),r.value.write(t),t.write(">")}writeMap({writer:t,map:r}){t.writeNode(Qu),t.write("<"),r.keyType.write(t),t.write(", "),r.valueType.write(t),t.write(">")}writeOptional({writer:t,optional:r}){t.writeNode(Xt),t.write("<"),r.value.write(t),t.write(">")}writeIterable({writer:t,iterable:r}){t.writeNode(Xt),t.write("<"),r.value.write(t),t.write(">")}writeSet({writer:t,set:r}){t.writeNode(el),t.write("<"),r.value.write(t),t.write(">")}static isAlreadyOptional(t){return t.internalType.type==="optional"}},er=new V({name:"Arrays",packageName:"java.util"}),Yu=new V({name:"BigInteger",packageName:"java.math"}),sg=new V({name:"HashMap",packageName:"java.util"}),Ku=new V({name:"List",packageName:"java.util"}),Qu=new V({name:"Map",packageName:"java.util"}),Xu=new V({name:"OffsetDateTime",packageName:"java.time"}),Xt=new V({name:"Optional",packageName:"java.util"}),el=new V({name:"Set",packageName:"java.util"}),tl=new V({name:"UUID",packageName:"java.util"}),rl=new V({name:"InputStream",packageName:"java.io"});var ue=class n extends Z{constructor(t){super();_(this,"internalType");this.internalType=t}write(t){switch(this.internalType.type){case"bigInteger":this.writeBigInteger({writer:t,bigInteger:this.internalType});break;case"boolean":t.write(this.internalType.value.toString());break;case"builder":this.writeBuilder({writer:t,builder:this.internalType});break;case"bytes":t.write(`"${this.internalType.value}".getBytes()`);break;case"class":{this.writeClass({writer:t,class_:this.internalType});break}case"date":this.writeDate({writer:t,date:this.internalType});break;case"dateTime":this.writeDateTime({writer:t,dateTime:this.internalType});break;case"double":{let r=this.internalType.value.toString();!r.includes(".")&&!r.includes("e")&&!r.includes("E")?t.write(`${r}.0`):t.write(r);break}case"enum":this.writeEnum({writer:t,enum_:this.internalType});break;case"float":t.write(`${this.internalType.value}f`);break;case"integer":t.write(Math.floor(this.internalType.value).toString());break;case"list":{this.writeList({writer:t,list:this.internalType});break}case"long":{t.write(`${Math.floor(this.internalType.value)}L`);break}case"map":{this.writeMap({writer:t,map:this.internalType});break}case"optional":{this.writeOptional({writer:t,optional:this.internalType});break}case"raw":{this.internalType.value instanceof Z?t.writeNode(this.internalType.value):t.write(this.internalType.value);break}case"reference":t.writeNode(this.internalType.value);break;case"set":{this.writeSet({writer:t,set:this.internalType});break}case"string":t.write(`"${this.escapeString(this.internalType.value)}"`);break;case"unknown":this.writeUnknown({writer:t,value:this.internalType.value});break;case"uuid":this.writeUUID({writer:t,uuid:this.internalType});break;case"nop":break;default:M(this.internalType)}}isOptional(){return this.internalType.type==="optional"}static bigInteger(t){return new this({type:"bigInteger",value:t})}static boolean(t){return new this({type:"boolean",value:t})}static builder({classReference:t,parameters:r}){return new this({type:"builder",classReference:t,parameters:r})}static bytes(t){return new this({type:"bytes",value:t})}static class_({reference:t,parameters:r}){return new this({type:"class",reference:t,parameters:r})}static date(t){return new this({type:"date",value:t})}static dateTime(t){return new this({type:"dateTime",value:t})}static double(t){return new this({type:"double",value:t})}static enum_({classReference:t,value:r}){return new this({type:"enum",classReference:t,value:r})}static float(t){return new this({type:"float",value:t})}static integer(t){return new this({type:"integer",value:t})}static list({valueType:t,values:r,isParameter:a}){return new this({type:"list",valueType:t,values:r,isParameter:a})}static long(t){return new this({type:"long",value:t})}static map({keyType:t,valueType:r,entries:a}){return new this({type:"map",keyType:t,valueType:r,entries:a})}static optional({value:t,useOf:r}){return this.isAlreadyOptional(t)?t:new this({type:"optional",value:t,useOf:r})}static raw(t){return new this({type:"raw",value:t})}static reference(t){return new this({type:"reference",value:t})}static set({valueType:t,values:r}){return new this({type:"set",valueType:t,values:r})}static string(t){return new this({type:"string",value:t})}static unknown(t){return new this({type:"unknown",value:t})}static uuid(t){return new this({type:"uuid",value:t})}static nop(){return new this({type:"nop"})}static isNop(t){return t.internalType.type==="nop"}shouldWriteInLine(){switch(this.internalType.type){case"bigInteger":case"boolean":case"bytes":case"date":case"dateTime":case"double":case"enum":case"float":case"integer":case"long":case"nop":case"raw":case"string":case"unknown":case"uuid":return!0;case"optional":return this.internalType.value.shouldWriteInLine();case"builder":case"class":case"list":case"map":case"reference":case"set":return!1;default:M(this.internalType)}}writeBigInteger({writer:t,bigInteger:r}){t.write("new "),t.writeNode(d.instantiateClass({classReference:nl,arguments_:[n.string(r.value)]}))}writeBuilder({writer:t,builder:r}){t.writeNode(r.classReference),t.writeNewLineIfLastLineNot(),t.indent(),this.writeBuilderParameters({writer:t,parameters:this.orderBuilderParameters(ll({parameters:r.parameters}))}),t.dedent()}writeBuilderParameters({writer:t,parameters:r}){t.writeLine(".builder()");for(let a of r)t.write(`.${a.name}(`),a.value.shouldWriteInLine()||t.newLine(),t.indent(),t.writeNode(a.value),t.dedent(),a.value.shouldWriteInLine()||t.newLine(),t.writeLine(")");t.writeNewLineIfLastLineNot(),t.write(".build()")}orderBuilderParameters(t){return t.some(a=>!a.value.isOptional()&&!this.isCollection(a.value))?t.sort((a,o)=>{let u=this.isNonRequired(a.value),p=this.isNonRequired(o.value);return u&&!p?1:!u&&p?-1:0}):t.sort((a,o)=>{let u=a.value.isOptional(),p=o.value.isOptional();return u&&!p?1:!u&&p?-1:0})}isCollection(t){let r=t.internalType.type;return r==="list"||r==="set"||r==="map"}isNonRequired(t){return t.isOptional()||this.isCollection(t)}writeClass({writer:t,class_:r}){let a=ul({parameters:r.parameters});t.writeNode(d.instantiateClass({classReference:r.reference,arguments_:a.map(o=>o.value)}))}writeDate({writer:t,date:r}){t.writeNode(d.invokeMethod({on:il,method:"parse",arguments_:[n.string(r.value)]}))}writeDateTime({writer:t,dateTime:r}){t.writeNode(d.invokeMethod({on:sl,method:"parse",arguments_:[n.string(r.value)]}))}writeEnum({writer:t,enum_:r}){t.writeNode(r.classReference),t.write("."+r.value)}writeList({writer:t,list:r}){this.writeIterable({writer:t,iterable:r})}writeMap({writer:t,map:r}){let a=cl({entries:r.entries});if(a.length===0){t.write("new "),t.writeNode(tr),t.write("<"),t.writeNode(r.keyType),t.write(", "),t.writeNode(r.valueType),t.write(">()");return}t.write("new "),t.writeNode(tr),t.write("<"),t.writeNode(r.keyType),t.write(", "),t.writeNode(r.valueType),t.writeLine(">() {{"),t.indent();for(let o of a)t.write("put("),t.writeNode(o.key),t.write(", "),t.writeNode(o.value),t.writeLine(");");t.dedent(),t.write("}}")}writeOptional({writer:t,optional:r}){if(!r.useOf){t.writeNode(r.value);return}t.writeNode(d.invokeMethod({on:Xt,method:"of",arguments_:[r.value]}))}writeSet({writer:t,set:r}){this.writeIterable({writer:t,iterable:r})}writeIterable({writer:t,iterable:r}){let a=r.type==="list"?Ir:al,o=pl({values:r.values});if(r.type==="list"&&r.isParameter&&o.length>0){t.writeNode(d.invokeMethod({on:er,method:"asList",arguments_:o}));return}if(o.length===0){t.write(`new ${a.name}<`),t.writeNode(r.valueType),t.write(">()");return}t.write("new "),t.writeNode(a),t.write("<"),t.writeNode(r.valueType),t.writeLine(">("),t.indent(),t.writeNode(d.invokeMethod({on:er,method:"asList",arguments_:o})),t.writeNewLineIfLastLineNot(),t.dedent(),t.write(")")}writeUnknown({writer:t,value:r}){switch(typeof r){case"boolean":t.write(r.toString());return;case"string":t.write(`"${this.escapeString(r)}"`);return;case"number":t.write(r.toString());return;case"object":if(r==null){t.write("null");return}if(Array.isArray(r)){this.writeUnknownArray({writer:t,value:r});return}this.writeUnknownMap({writer:t,value:r});return;default:throw new Error(`Internal error; unsupported unknown type: ${typeof r}`)}}writeUnknownArray({writer:t,value:r}){if(r.length===0){t.write("new "),t.writeNode(Ir),t.write("<Object>()");return}t.write("new "),t.writeNode(Ir),t.write("<Object>("),t.writeNode(d.invokeMethod({on:er,method:"asList",arguments_:r.map(a=>n.unknown(a))})),t.write(")")}writeUnknownMap({writer:t,value:r}){let a=Object.entries(r);if(a.length===0){t.write("new "),t.writeNode(tr),t.write("<String, Object>()");return}t.writeLine("new "),t.writeNode(tr),t.write("<String, Object>() {{"),t.indent();for(let[o,u]of a)t.write(`put("${o}", `),t.writeNode(n.unknown(u)),t.writeLine(");");t.dedent(),t.write("}}")}writeUUID({writer:t,uuid:r}){t.writeNode(d.invokeMethod({on:ol,method:"fromString",arguments_:[n.string(r.value)]}))}escapeString(t){return t.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t")}static isAlreadyOptional(t){return t.internalType.type==="optional"}},Ir=new V({name:"ArrayList",packageName:"java.util"}),nl=new V({name:"BigInteger",packageName:"java.math"}),tr=new V({name:"HashMap",packageName:"java.util"}),al=new V({name:"HashSet",packageName:"java.util"}),gg=new V({name:"List",packageName:"java.util"}),il=new V({name:"LocalDate",packageName:"java.time"}),xg=new V({name:"Map",packageName:"java.util"}),sl=new V({name:"OffsetDateTime",packageName:"java.time"}),vg=new V({name:"Set",packageName:"java.util"}),ol=new V({name:"UUID",packageName:"java.util"});function ul({parameters:n}){return n.filter(e=>!ue.isNop(e.value))}function ll({parameters:n}){return n.filter(e=>!ue.isNop(e.value))}function cl({entries:n}){return n.filter(e=>!ue.isNop(e.key)&&!ue.isNop(e.value))}function pl({values:n}){return n.filter(e=>!ue.isNop(e))}function rr({writer:n,arguments_:e}){let t=fl(e);if(t.length===0){n.write("()");return}if(t.some(a=>a instanceof ue&&!a.shouldWriteInLine())){dl({writer:n,arguments_:t});return}n.write("("),t.forEach((a,o)=>{o>0&&n.write(", "),Ri({writer:n,argument:a})}),n.write(")")}function dl({writer:n,arguments_:e}){n.writeLine("("),n.indent(),e.forEach((t,r)=>{r>0&&n.writeLine(","),Ri({writer:n,argument:t})}),n.dedent(),e.length>0&&n.newLine(),n.write(")")}function Ri({writer:n,argument:e}){br(e)?n.writeNodeOrString(e.assignment):e.write(n)}function fl(n){return n.filter(e=>!(e instanceof ue&&ue.isNop(e)))}var at=class extends Z{constructor({classReference:t,arguments_:r}){super();_(this,"classReference");_(this,"arguments_");this.classReference=t,this.arguments_=r}write(t){t.writeNode(this.classReference),rr({writer:t,arguments_:this.arguments_})}};m();y();h();var it=class extends Z{constructor(t){super();_(this,"arg");this.arg=t}write(t){return new me(this.arg).write(t)}};m();y();h();var st=class extends Z{constructor({name:t,access:r,parameters:a,body:o,static_:u,return_:p}){super();_(this,"name");_(this,"access");_(this,"parameters");_(this,"body");_(this,"return_");_(this,"static_");this.name=t,this.access=r,this.parameters=a,this.body=o,this.return_=p,this.static_=u??!1}write(t){if(t.write(`${this.access} `),this.static_&&t.write("static "),this.return_!=null?t.writeNode(this.return_):t.write("void"),t.write(` ${this.name}`),this.parameters.length===0)t.write("()");else if(this.parameters.length===1){if(t.write("("),this.parameters[0]==null)throw new Error("Cannot render parameter "+this.parameters[0]);t.writeNode(this.parameters[0]),t.write(")")}else t.writeLine("("),t.indent(),this.parameters.forEach((r,a)=>{a>0&&t.writeLine(", "),t.writeNode(r)}),t.dedent(),t.write(")");if(this.body==null){t.write(";");return}t.writeLine(" {"),t.indent(),t.writeNode(this.body),t.writeNewLineIfLastLineNot(),t.dedent(),t.write("}")}};m();y();h();var ot=class extends Z{constructor({method:t,arguments_:r,on:a}){super();_(this,"on");_(this,"method");_(this,"arguments_");this.on=a,this.method=t,this.arguments_=r}write(t){this.on.write(t),t.write("."),t.write(this.method),rr({writer:t,arguments_:this.arguments_})}};m();y();h();var ut=class extends Z{constructor({name:t,type:r}){super();_(this,"name");_(this,"type");this.name=t,this.type=r}write(t){t.writeNode(this.type),t.write(` ${this.name}`)}};function ml(n){return new it(n)}function hl(n){return new nt(n)}function yl(n){return new V(n)}function gl(n){return new at(n)}function xl(n){return new ot(n)}function vl(n){return new st(n)}function wl(n){return new ut(n)}m();y();h();var nr=class{constructor({context:e}){_(this,"context");this.context=e}isNopTypeLiteral(e){return e.internalType?.type==="nop"}usesOptionalNullable(){return this.context.customConfig?.["collapse-optional-nullable"]===!0}wrapInOptionalIfNotNop(e,t=!1){return this.isNopTypeLiteral(e)?e:this.usesOptionalNullable()?this.context.getOptionalNullableOf(e):d.TypeLiteral.optional({value:e,useOf:t})}convert(e){if(e.value===null)return this.context.isNullable(e.typeReference)?this.context.getNullableOfNull():(this.context.errors.add({severity:$.Critical,message:"Expected non-null value, but got null"}),d.TypeLiteral.nop());if(e.value===void 0)return d.TypeLiteral.nop();switch(e.typeReference.type){case"list":return this.convertList({list:e.typeReference.value,value:e.value,as:e.as});case"literal":return this.convertLiteral({literal:e.typeReference.value,value:e.value});case"map":return this.convertMap({map:e.typeReference,value:e.value,as:e.as});case"named":{let t=this.context.resolveNamedType({typeId:e.typeReference.value});return t==null?d.TypeLiteral.nop():this.convertNamed({named:t,value:e.value,as:e.as,inUndiscriminatedUnion:e.inUndiscriminatedUnion})}case"nullable":case"optional":{if(e.value===void 0||typeof e.value=="object"&&e.value!==null&&Object.keys(e.value).length===0&&e.typeReference.value.type==="named")return this.usesOptionalNullable()?this.context.getOptionalNullableAbsent():d.TypeLiteral.reference(d.invokeMethod({on:d.classReference({name:"Optional",packageName:"java.util"}),method:"empty",arguments_:[]}));if(e.typeReference.value.type==="list"){let a=this.convertList({list:e.typeReference.value.value,value:e.value});return this.wrapInOptionalIfNotNop(a,!0)}if(this.usesOptionalNullable()&&(e.typeReference.value.type==="optional"||e.typeReference.value.type==="nullable"))return this.convert({typeReference:e.typeReference.value,value:e.value,as:e.as,inUndiscriminatedUnion:e.inUndiscriminatedUnion});let t=this.convert({typeReference:e.typeReference.value,value:e.value,as:e.as,inUndiscriminatedUnion:e.inUndiscriminatedUnion}),r=e.as==="mapValue"||e.inUndiscriminatedUnion===!0;return this.wrapInOptionalIfNotNop(t,r)}case"primitive":return this.convertPrimitive({primitive:e.typeReference.value,value:e.value,as:e.as});case"set":return this.convertSet({set:e.typeReference.value,value:e.value,as:e.as});case"unknown":return this.convertUnknown({value:e.value});default:M(e.typeReference)}}convertList({list:e,value:t,as:r}){if(!Array.isArray(t))return this.context.errors.add({severity:$.Critical,message:`Expected array but got: ${typeof t}`}),d.TypeLiteral.nop();let a=e.type==="optional"||e.type==="nullable";return d.TypeLiteral.list({valueType:this.context.dynamicTypeMapper.convert({typeReference:e}),values:t.map((o,u)=>{this.context.errors.scope({index:u});try{if(a){let p=this.convert({typeReference:e.value,value:o,as:r});return this.wrapInOptionalIfNotNop(p,!0)}return this.convert({typeReference:e,value:o,as:r})}finally{this.context.errors.unscope()}}),isParameter:!0})}convertLiteral({literal:e,value:t}){switch(e.type){case"boolean":{let r=this.context.getValueAsBoolean({value:t});return r==null?d.TypeLiteral.nop():d.TypeLiteral.boolean(r)}case"string":{let r=this.context.getValueAsString({value:t});return r==null?d.TypeLiteral.nop():d.TypeLiteral.string(r)}default:M(e)}}convertSet({set:e,value:t,as:r}){return Array.isArray(t)?d.TypeLiteral.set({valueType:this.context.dynamicTypeMapper.convert({typeReference:e}),values:t.map((a,o)=>{this.context.errors.scope({index:o});try{return this.convert({typeReference:e,value:a,as:r})}finally{this.context.errors.unscope()}})}):(this.context.errors.add({severity:$.Critical,message:`Expected array but got: ${typeof t}`}),d.TypeLiteral.nop())}convertMap({map:e,value:t,as:r}){return typeof t!="object"||t==null?(this.context.errors.add({severity:$.Critical,message:`Expected object but got: ${t==null?"null":typeof t}`}),d.TypeLiteral.nop()):d.TypeLiteral.map({keyType:this.context.dynamicTypeMapper.convert({typeReference:e.key}),valueType:this.context.dynamicTypeMapper.convert({typeReference:e.value}),entries:Object.entries(t).map(([a,o])=>{this.context.errors.scope(a);try{return{key:this.convert({typeReference:e.key,value:a,as:"mapKey"}),value:this.convert({typeReference:e.value,value:o,as:"mapValue"})}}finally{this.context.errors.unscope()}})})}convertNamed({named:e,value:t,as:r,inUndiscriminatedUnion:a}){switch(e.type){case"alias":return this.convert({typeReference:e.typeReference,value:t,as:r,inUndiscriminatedUnion:a});case"discriminatedUnion":return this.convertDiscriminatedUnion({discriminatedUnion:e,value:t});case"enum":return this.convertEnum({enum_:e,value:t});case"object":return this.convertObject({object_:e,value:t,as:r});case"undiscriminatedUnion":return this.convertUndiscriminatedUnion({undiscriminatedUnion:e,value:t});default:M(e)}}convertDiscriminatedUnion({discriminatedUnion:e,value:t}){let r=this.context.getJavaClassReferenceFromDeclaration({declaration:e.declaration}),a=this.context.resolveDiscriminatedUnionTypeInstance({discriminatedUnion:e,value:t});if(a==null)return d.TypeLiteral.nop();let o=a.singleDiscriminatedUnionType;switch(o.type){case"samePropertiesAsObject":{let u=this.context.resolveNamedType({typeId:o.typeId});return u==null?d.TypeLiteral.nop():d.TypeLiteral.reference(d.invokeMethod({on:r,method:this.context.getPropertyName(o.discriminantValue.name),arguments_:[this.convertNamed({named:u,value:a.value})]}))}case"singleProperty":{let u=this.context.getRecord(a.value);if(u==null)return d.TypeLiteral.nop();try{return this.context.errors.scope(o.discriminantValue.wireValue),d.TypeLiteral.reference(d.invokeMethod({on:r,method:this.context.getPropertyName(o.discriminantValue.name),arguments_:[this.convert({typeReference:o.typeReference,value:u["value"]})]}))}finally{this.context.errors.unscope()}}case"noProperties":return d.TypeLiteral.reference(d.invokeMethod({on:r,method:this.context.getPropertyName(o.discriminantValue.name),arguments_:[]}));default:M(o)}}convertObject({object_:e,value:t,as:r}){let a=this.context.associateByWireValue({parameters:e.properties,values:this.context.getRecord(t)??{}}),o=r==="request"?a.filter(u=>!this.context.isDirectLiteral(u.typeReference)):a;return d.TypeLiteral.builder({classReference:this.context.getJavaClassReferenceFromDeclaration({declaration:e.declaration}),parameters:o.map(u=>{this.context.errors.scope(u.name.wireValue);try{return{name:this.context.getMethodName(u.name.name),value:this.convert({typeReference:u.typeReference,value:u.value,as:r})}}finally{this.context.errors.unscope()}})})}convertEnum({enum_:e,value:t}){let r=this.getEnumValueName({enum_:e,value:t});return r==null?d.TypeLiteral.nop():d.TypeLiteral.enum_({classReference:this.context.getJavaClassReferenceFromDeclaration({declaration:e.declaration}),value:r})}getEnumValueName({enum_:e,value:t}){if(typeof t!="string"){this.context.errors.add({severity:$.Critical,message:`Expected enum value string, got: ${typeof t}`});return}let r=e.values.find(a=>a.wireValue===t);if(r==null){this.context.errors.add({severity:$.Critical,message:`An enum value named "${t}" does not exist in this context`});return}return this.context.getEnumName(r.name)}convertUndiscriminatedUnion({undiscriminatedUnion:e,value:t}){let r=this.findMatchingUndiscriminatedUnionType({undiscriminatedUnion:e,value:t});return r==null?d.TypeLiteral.nop():this.context.isPrimitive(r.valueTypeReference)?d.TypeLiteral.reference(d.invokeMethod({on:this.context.getJavaClassReferenceFromDeclaration({declaration:e.declaration}),method:"of",arguments_:[r.typeInstantiation]})):d.TypeLiteral.reference(d.invokeMethod({on:this.context.getJavaClassReferenceFromDeclaration({declaration:e.declaration}),method:"of",arguments_:[r.typeInstantiation]}))}findMatchingUndiscriminatedUnionType({undiscriminatedUnion:e,value:t}){let r=[],a=[];for(let p of e.types)try{r.push(JSON.stringify(p));let x=this.convert({typeReference:p,value:t,inUndiscriminatedUnion:!0});return{valueTypeReference:p,typeInstantiation:x}}catch(x){a.push(`Type ${JSON.stringify(p)}: ${x instanceof Error?x.message:String(x)}`);continue}this.context.errors.add({severity:$.Critical,message:`None of the types in the undiscriminated union matched the given "${typeof t}" value. Tried ${r.length} variants. Errors: ${a.join("; ")}`});let o=e.declaration.name??"UnknownUnion",u=a.map((p,x)=>` ${x+1}. ${p}`).join(`
22
+ `)}};m();y();h();m();y();h();var D={};pr(D,{BRAND:()=>pu,DIRTY:()=>De,EMPTY_PATH:()=>qo,INVALID:()=>L,NEVER:()=>Ju,OK:()=>te,ParseStatus:()=>X,Schema:()=>O,ZodAny:()=>Be,ZodArray:()=>Ie,ZodBigInt:()=>qe,ZodBoolean:()=>We,ZodBranded:()=>Ot,ZodCatch:()=>tt,ZodDate:()=>ze,ZodDefault:()=>et,ZodDiscriminatedUnion:()=>Yt,ZodEffects:()=>fe,ZodEnum:()=>Qe,ZodError:()=>se,ZodFirstPartyTypeKind:()=>B,ZodFunction:()=>Qt,ZodIntersection:()=>Je,ZodIssueCode:()=>b,ZodLazy:()=>Ye,ZodLiteral:()=>Ke,ZodMap:()=>vt,ZodNaN:()=>bt,ZodNativeEnum:()=>Xe,ZodNever:()=>he,ZodNull:()=>Ge,ZodNullable:()=>we,ZodNumber:()=>Ve,ZodObject:()=>oe,ZodOptional:()=>pe,ZodParsedType:()=>I,ZodPipeline:()=>Ut,ZodPromise:()=>Pe,ZodReadonly:()=>rt,ZodRecord:()=>Kt,ZodSchema:()=>O,ZodSet:()=>wt,ZodString:()=>Le,ZodSymbol:()=>gt,ZodTransformer:()=>fe,ZodTuple:()=>ve,ZodType:()=>O,ZodUndefined:()=>Ze,ZodUnion:()=>He,ZodUnknown:()=>Re,ZodVoid:()=>xt,addIssueToContext:()=>R,any:()=>wu,array:()=>ku,bigint:()=>hu,boolean:()=>ki,coerce:()=>Hu,custom:()=>bi,date:()=>yu,datetimeRegex:()=>vi,defaultErrorMap:()=>ke,discriminatedUnion:()=>Eu,effect:()=>$u,enum:()=>Uu,function:()=>Pu,getErrorMap:()=>mt,getParsedType:()=>xe,instanceof:()=>fu,intersection:()=>Au,isAborted:()=>Ht,isAsync:()=>ht,isDirty:()=>Jt,isValid:()=>Ce,late:()=>du,lazy:()=>Fu,literal:()=>Ou,makeIssue:()=>Ft,map:()=>Lu,nan:()=>mu,nativeEnum:()=>ju,never:()=>Tu,null:()=>vu,nullable:()=>Vu,number:()=>_i,object:()=>Nu,objectUtil:()=>Tr,oboolean:()=>Gu,onumber:()=>Zu,optional:()=>Du,ostring:()=>zu,pipeline:()=>Wu,preprocess:()=>qu,promise:()=>Mu,quotelessJson:()=>$o,record:()=>Cu,set:()=>Bu,setErrorMap:()=>Vo,strictObject:()=>Ru,string:()=>Ti,symbol:()=>gu,transformer:()=>$u,tuple:()=>Su,undefined:()=>xu,union:()=>Iu,unknown:()=>bu,util:()=>j,void:()=>_u});m();y();h();m();y();h();m();y();h();m();y();h();m();y();h();var j;(function(n){n.assertEqual=a=>{};function e(a){}n.assertIs=e;function t(a){throw new Error}n.assertNever=t,n.arrayToEnum=a=>{let o={};for(let u of a)o[u]=u;return o},n.getValidEnumValues=a=>{let o=n.objectKeys(a).filter(p=>typeof a[a[p]]!="number"),u={};for(let p of o)u[p]=a[p];return n.objectValues(u)},n.objectValues=a=>n.objectKeys(a).map(function(o){return a[o]}),n.objectKeys=typeof Object.keys=="function"?a=>Object.keys(a):a=>{let o=[];for(let u in a)Object.prototype.hasOwnProperty.call(a,u)&&o.push(u);return o},n.find=(a,o)=>{for(let u of a)if(o(u))return u},n.isInteger=typeof Number.isInteger=="function"?a=>Number.isInteger(a):a=>typeof a=="number"&&Number.isFinite(a)&&Math.floor(a)===a;function r(a,o=" | "){return a.map(u=>typeof u=="string"?`'${u}'`:u).join(o)}n.joinValues=r,n.jsonStringifyReplacer=(a,o)=>typeof o=="bigint"?o.toString():o})(j||(j={}));var Tr;(function(n){n.mergeShapes=(e,t)=>({...e,...t})})(Tr||(Tr={}));var I=j.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),xe=n=>{switch(typeof n){case"undefined":return I.undefined;case"string":return I.string;case"number":return Number.isNaN(n)?I.nan:I.number;case"boolean":return I.boolean;case"function":return I.function;case"bigint":return I.bigint;case"symbol":return I.symbol;case"object":return Array.isArray(n)?I.array:n===null?I.null:n.then&&typeof n.then=="function"&&n.catch&&typeof n.catch=="function"?I.promise:typeof Map<"u"&&n instanceof Map?I.map:typeof Set<"u"&&n instanceof Set?I.set:typeof Date<"u"&&n instanceof Date?I.date:I.object;default:return I.unknown}};var b=j.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"]),$o=n=>JSON.stringify(n,null,2).replace(/"([^"]+)":/g,"$1:"),se=class n extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=r=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};let t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}format(e){let t=e||function(o){return o.message},r={_errors:[]},a=o=>{for(let u of o.issues)if(u.code==="invalid_union")u.unionErrors.map(a);else if(u.code==="invalid_return_type")a(u.returnTypeError);else if(u.code==="invalid_arguments")a(u.argumentsError);else if(u.path.length===0)r._errors.push(t(u));else{let p=r,x=0;for(;x<u.path.length;){let w=u.path[x];x===u.path.length-1?(p[w]=p[w]||{_errors:[]},p[w]._errors.push(t(u))):p[w]=p[w]||{_errors:[]},p=p[w],x++}}};return a(this),r}static assert(e){if(!(e instanceof n))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,j.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=t=>t.message){let t={},r=[];for(let a of this.issues)if(a.path.length>0){let o=a.path[0];t[o]=t[o]||[],t[o].push(e(a))}else r.push(e(a));return{formErrors:r,fieldErrors:t}}get formErrors(){return this.flatten()}};se.create=n=>new se(n);var Do=(n,e)=>{let t;switch(n.code){case b.invalid_type:n.received===I.undefined?t="Required":t=`Expected ${n.expected}, received ${n.received}`;break;case b.invalid_literal:t=`Invalid literal value, expected ${JSON.stringify(n.expected,j.jsonStringifyReplacer)}`;break;case b.unrecognized_keys:t=`Unrecognized key(s) in object: ${j.joinValues(n.keys,", ")}`;break;case b.invalid_union:t="Invalid input";break;case b.invalid_union_discriminator:t=`Invalid discriminator value. Expected ${j.joinValues(n.options)}`;break;case b.invalid_enum_value:t=`Invalid enum value. Expected ${j.joinValues(n.options)}, received '${n.received}'`;break;case b.invalid_arguments:t="Invalid function arguments";break;case b.invalid_return_type:t="Invalid function return type";break;case b.invalid_date:t="Invalid date";break;case b.invalid_string:typeof n.validation=="object"?"includes"in n.validation?(t=`Invalid input: must include "${n.validation.includes}"`,typeof n.validation.position=="number"&&(t=`${t} at one or more positions greater than or equal to ${n.validation.position}`)):"startsWith"in n.validation?t=`Invalid input: must start with "${n.validation.startsWith}"`:"endsWith"in n.validation?t=`Invalid input: must end with "${n.validation.endsWith}"`:j.assertNever(n.validation):n.validation!=="regex"?t=`Invalid ${n.validation}`:t="Invalid";break;case b.too_small:n.type==="array"?t=`Array must contain ${n.exact?"exactly":n.inclusive?"at least":"more than"} ${n.minimum} element(s)`:n.type==="string"?t=`String must contain ${n.exact?"exactly":n.inclusive?"at least":"over"} ${n.minimum} character(s)`:n.type==="number"?t=`Number must be ${n.exact?"exactly equal to ":n.inclusive?"greater than or equal to ":"greater than "}${n.minimum}`:n.type==="bigint"?t=`Number must be ${n.exact?"exactly equal to ":n.inclusive?"greater than or equal to ":"greater than "}${n.minimum}`:n.type==="date"?t=`Date must be ${n.exact?"exactly equal to ":n.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(n.minimum))}`:t="Invalid input";break;case b.too_big:n.type==="array"?t=`Array must contain ${n.exact?"exactly":n.inclusive?"at most":"less than"} ${n.maximum} element(s)`:n.type==="string"?t=`String must contain ${n.exact?"exactly":n.inclusive?"at most":"under"} ${n.maximum} character(s)`:n.type==="number"?t=`Number must be ${n.exact?"exactly":n.inclusive?"less than or equal to":"less than"} ${n.maximum}`:n.type==="bigint"?t=`BigInt must be ${n.exact?"exactly":n.inclusive?"less than or equal to":"less than"} ${n.maximum}`:n.type==="date"?t=`Date must be ${n.exact?"exactly":n.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(n.maximum))}`:t="Invalid input";break;case b.custom:t="Invalid input";break;case b.invalid_intersection_types:t="Intersection results could not be merged";break;case b.not_multiple_of:t=`Number must be a multiple of ${n.multipleOf}`;break;case b.not_finite:t="Number must be finite";break;default:t=e.defaultError,j.assertNever(n)}return{message:t}},ke=Do;var mi=ke;function Vo(n){mi=n}function mt(){return mi}m();y();h();var Ft=n=>{let{data:e,path:t,errorMaps:r,issueData:a}=n,o=[...t,...a.path||[]],u={...a,path:o};if(a.message!==void 0)return{...a,path:o,message:a.message};let p="",x=r.filter(w=>!!w).slice().reverse();for(let w of x)p=w(u,{data:e,defaultError:p}).message;return{...a,path:o,message:p}},qo=[];function R(n,e){let t=mt(),r=Ft({issueData:e,data:n.data,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,t,t===ke?void 0:ke].filter(a=>!!a)});n.common.issues.push(r)}var X=class n{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,t){let r=[];for(let a of t){if(a.status==="aborted")return L;a.status==="dirty"&&e.dirty(),r.push(a.value)}return{status:e.value,value:r}}static async mergeObjectAsync(e,t){let r=[];for(let a of t){let o=await a.key,u=await a.value;r.push({key:o,value:u})}return n.mergeObjectSync(e,r)}static mergeObjectSync(e,t){let r={};for(let a of t){let{key:o,value:u}=a;if(o.status==="aborted"||u.status==="aborted")return L;o.status==="dirty"&&e.dirty(),u.status==="dirty"&&e.dirty(),o.value!=="__proto__"&&(typeof u.value<"u"||a.alwaysSet)&&(r[o.value]=u.value)}return{status:e.value,value:r}}},L=Object.freeze({status:"aborted"}),De=n=>({status:"dirty",value:n}),te=n=>({status:"valid",value:n}),Ht=n=>n.status==="aborted",Jt=n=>n.status==="dirty",Ce=n=>n.status==="valid",ht=n=>typeof Promise<"u"&&n instanceof Promise;m();y();h();m();y();h();var A;(function(n){n.errToObj=e=>typeof e=="string"?{message:e}:e||{},n.toString=e=>typeof e=="string"?e:e?.message})(A||(A={}));var de=class{constructor(e,t,r,a){this._cachedPath=[],this.parent=e,this.data=t,this._path=r,this._key=a}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},hi=(n,e)=>{if(Ce(e))return{success:!0,data:e.value};if(!n.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let t=new se(n.common.issues);return this._error=t,this._error}}};function P(n){if(!n)return{};let{errorMap:e,invalid_type_error:t,required_error:r,description:a}=n;if(e&&(t||r))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:a}:{errorMap:(u,p)=>{let{message:x}=n;return u.code==="invalid_enum_value"?{message:x??p.defaultError}:typeof p.data>"u"?{message:x??r??p.defaultError}:u.code!=="invalid_type"?{message:p.defaultError}:{message:x??t??p.defaultError}},description:a}}var O=class{get description(){return this._def.description}_getType(e){return xe(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:xe(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new X,ctx:{common:e.parent.common,data:e.data,parsedType:xe(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let t=this._parse(e);if(ht(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){let t=this._parse(e);return Promise.resolve(t)}parse(e,t){let r=this.safeParse(e,t);if(r.success)return r.data;throw r.error}safeParse(e,t){let r={common:{issues:[],async:t?.async??!1,contextualErrorMap:t?.errorMap},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:xe(e)},a=this._parseSync({data:e,path:r.path,parent:r});return hi(r,a)}"~validate"(e){let t={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:xe(e)};if(!this["~standard"].async)try{let r=this._parseSync({data:e,path:[],parent:t});return Ce(r)?{value:r.value}:{issues:t.common.issues}}catch(r){r?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then(r=>Ce(r)?{value:r.value}:{issues:t.common.issues})}async parseAsync(e,t){let r=await this.safeParseAsync(e,t);if(r.success)return r.data;throw r.error}async safeParseAsync(e,t){let r={common:{issues:[],contextualErrorMap:t?.errorMap,async:!0},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:xe(e)},a=this._parse({data:e,path:r.path,parent:r}),o=await(ht(a)?a:Promise.resolve(a));return hi(r,o)}refine(e,t){let r=a=>typeof t=="string"||typeof t>"u"?{message:t}:typeof t=="function"?t(a):t;return this._refinement((a,o)=>{let u=e(a),p=()=>o.addIssue({code:b.custom,...r(a)});return typeof Promise<"u"&&u instanceof Promise?u.then(x=>x?!0:(p(),!1)):u?!0:(p(),!1)})}refinement(e,t){return this._refinement((r,a)=>e(r)?!0:(a.addIssue(typeof t=="function"?t(r,a):t),!1))}_refinement(e){return new fe({schema:this,typeName:B.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:t=>this["~validate"](t)}}optional(){return pe.create(this,this._def)}nullable(){return we.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Ie.create(this)}promise(){return Pe.create(this,this._def)}or(e){return He.create([this,e],this._def)}and(e){return Je.create(this,e,this._def)}transform(e){return new fe({...P(this._def),schema:this,typeName:B.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let t=typeof e=="function"?e:()=>e;return new et({...P(this._def),innerType:this,defaultValue:t,typeName:B.ZodDefault})}brand(){return new Ot({typeName:B.ZodBranded,type:this,...P(this._def)})}catch(e){let t=typeof e=="function"?e:()=>e;return new tt({...P(this._def),innerType:this,catchValue:t,typeName:B.ZodCatch})}describe(e){let t=this.constructor;return new t({...this._def,description:e})}pipe(e){return Ut.create(this,e)}readonly(){return rt.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},Wo=/^c[^\s-]{8,}$/i,zo=/^[0-9a-z]+$/,Zo=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Go=/^[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,Ho=/^[a-z0-9_-]{21}$/i,Jo=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Yo=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,Ko=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Qo="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",_r,Xo=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,eu=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,tu=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,ru=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,nu=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,au=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,gi="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",iu=new RegExp(`^${gi}$`);function xi(n){let e="[0-5]\\d";n.precision?e=`${e}\\.\\d{${n.precision}}`:n.precision==null&&(e=`${e}(\\.\\d+)?`);let t=n.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${t}`}function su(n){return new RegExp(`^${xi(n)}$`)}function vi(n){let e=`${gi}T${xi(n)}`,t=[];return t.push(n.local?"Z?":"Z"),n.offset&&t.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${t.join("|")})`,new RegExp(`^${e}$`)}function ou(n,e){return!!((e==="v4"||!e)&&Xo.test(n)||(e==="v6"||!e)&&tu.test(n))}function uu(n,e){if(!Jo.test(n))return!1;try{let[t]=n.split(".");if(!t)return!1;let r=t.replace(/-/g,"+").replace(/_/g,"/").padEnd(t.length+(4-t.length%4)%4,"="),a=JSON.parse(atob(r));return!(typeof a!="object"||a===null||"typ"in a&&a?.typ!=="JWT"||!a.alg||e&&a.alg!==e)}catch{return!1}}function lu(n,e){return!!((e==="v4"||!e)&&eu.test(n)||(e==="v6"||!e)&&ru.test(n))}var Le=class n extends O{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==I.string){let o=this._getOrReturnCtx(e);return R(o,{code:b.invalid_type,expected:I.string,received:o.parsedType}),L}let r=new X,a;for(let o of this._def.checks)if(o.kind==="min")e.data.length<o.value&&(a=this._getOrReturnCtx(e,a),R(a,{code:b.too_small,minimum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),r.dirty());else if(o.kind==="max")e.data.length>o.value&&(a=this._getOrReturnCtx(e,a),R(a,{code:b.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),r.dirty());else if(o.kind==="length"){let u=e.data.length>o.value,p=e.data.length<o.value;(u||p)&&(a=this._getOrReturnCtx(e,a),u?R(a,{code:b.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message}):p&&R(a,{code:b.too_small,minimum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message}),r.dirty())}else if(o.kind==="email")Ko.test(e.data)||(a=this._getOrReturnCtx(e,a),R(a,{validation:"email",code:b.invalid_string,message:o.message}),r.dirty());else if(o.kind==="emoji")_r||(_r=new RegExp(Qo,"u")),_r.test(e.data)||(a=this._getOrReturnCtx(e,a),R(a,{validation:"emoji",code:b.invalid_string,message:o.message}),r.dirty());else if(o.kind==="uuid")Go.test(e.data)||(a=this._getOrReturnCtx(e,a),R(a,{validation:"uuid",code:b.invalid_string,message:o.message}),r.dirty());else if(o.kind==="nanoid")Ho.test(e.data)||(a=this._getOrReturnCtx(e,a),R(a,{validation:"nanoid",code:b.invalid_string,message:o.message}),r.dirty());else if(o.kind==="cuid")Wo.test(e.data)||(a=this._getOrReturnCtx(e,a),R(a,{validation:"cuid",code:b.invalid_string,message:o.message}),r.dirty());else if(o.kind==="cuid2")zo.test(e.data)||(a=this._getOrReturnCtx(e,a),R(a,{validation:"cuid2",code:b.invalid_string,message:o.message}),r.dirty());else if(o.kind==="ulid")Zo.test(e.data)||(a=this._getOrReturnCtx(e,a),R(a,{validation:"ulid",code:b.invalid_string,message:o.message}),r.dirty());else if(o.kind==="url")try{new URL(e.data)}catch{a=this._getOrReturnCtx(e,a),R(a,{validation:"url",code:b.invalid_string,message:o.message}),r.dirty()}else o.kind==="regex"?(o.regex.lastIndex=0,o.regex.test(e.data)||(a=this._getOrReturnCtx(e,a),R(a,{validation:"regex",code:b.invalid_string,message:o.message}),r.dirty())):o.kind==="trim"?e.data=e.data.trim():o.kind==="includes"?e.data.includes(o.value,o.position)||(a=this._getOrReturnCtx(e,a),R(a,{code:b.invalid_string,validation:{includes:o.value,position:o.position},message:o.message}),r.dirty()):o.kind==="toLowerCase"?e.data=e.data.toLowerCase():o.kind==="toUpperCase"?e.data=e.data.toUpperCase():o.kind==="startsWith"?e.data.startsWith(o.value)||(a=this._getOrReturnCtx(e,a),R(a,{code:b.invalid_string,validation:{startsWith:o.value},message:o.message}),r.dirty()):o.kind==="endsWith"?e.data.endsWith(o.value)||(a=this._getOrReturnCtx(e,a),R(a,{code:b.invalid_string,validation:{endsWith:o.value},message:o.message}),r.dirty()):o.kind==="datetime"?vi(o).test(e.data)||(a=this._getOrReturnCtx(e,a),R(a,{code:b.invalid_string,validation:"datetime",message:o.message}),r.dirty()):o.kind==="date"?iu.test(e.data)||(a=this._getOrReturnCtx(e,a),R(a,{code:b.invalid_string,validation:"date",message:o.message}),r.dirty()):o.kind==="time"?su(o).test(e.data)||(a=this._getOrReturnCtx(e,a),R(a,{code:b.invalid_string,validation:"time",message:o.message}),r.dirty()):o.kind==="duration"?Yo.test(e.data)||(a=this._getOrReturnCtx(e,a),R(a,{validation:"duration",code:b.invalid_string,message:o.message}),r.dirty()):o.kind==="ip"?ou(e.data,o.version)||(a=this._getOrReturnCtx(e,a),R(a,{validation:"ip",code:b.invalid_string,message:o.message}),r.dirty()):o.kind==="jwt"?uu(e.data,o.alg)||(a=this._getOrReturnCtx(e,a),R(a,{validation:"jwt",code:b.invalid_string,message:o.message}),r.dirty()):o.kind==="cidr"?lu(e.data,o.version)||(a=this._getOrReturnCtx(e,a),R(a,{validation:"cidr",code:b.invalid_string,message:o.message}),r.dirty()):o.kind==="base64"?nu.test(e.data)||(a=this._getOrReturnCtx(e,a),R(a,{validation:"base64",code:b.invalid_string,message:o.message}),r.dirty()):o.kind==="base64url"?au.test(e.data)||(a=this._getOrReturnCtx(e,a),R(a,{validation:"base64url",code:b.invalid_string,message:o.message}),r.dirty()):j.assertNever(o);return{status:r.value,value:e.data}}_regex(e,t,r){return this.refinement(a=>e.test(a),{validation:t,code:b.invalid_string,...A.errToObj(r)})}_addCheck(e){return new n({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...A.errToObj(e)})}url(e){return this._addCheck({kind:"url",...A.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...A.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...A.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...A.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...A.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...A.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...A.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...A.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...A.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...A.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...A.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...A.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...A.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof e?.precision>"u"?null:e?.precision,...A.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...A.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...A.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t?.position,...A.errToObj(t?.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...A.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...A.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...A.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...A.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...A.errToObj(t)})}nonempty(e){return this.min(1,A.errToObj(e))}trim(){return new n({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new n({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new n({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}};Le.create=n=>new Le({checks:[],typeName:B.ZodString,coerce:n?.coerce??!1,...P(n)});function cu(n,e){let t=(n.toString().split(".")[1]||"").length,r=(e.toString().split(".")[1]||"").length,a=t>r?t:r,o=Number.parseInt(n.toFixed(a).replace(".","")),u=Number.parseInt(e.toFixed(a).replace(".",""));return o%u/10**a}var Ve=class n extends O{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==I.number){let o=this._getOrReturnCtx(e);return R(o,{code:b.invalid_type,expected:I.number,received:o.parsedType}),L}let r,a=new X;for(let o of this._def.checks)o.kind==="int"?j.isInteger(e.data)||(r=this._getOrReturnCtx(e,r),R(r,{code:b.invalid_type,expected:"integer",received:"float",message:o.message}),a.dirty()):o.kind==="min"?(o.inclusive?e.data<o.value:e.data<=o.value)&&(r=this._getOrReturnCtx(e,r),R(r,{code:b.too_small,minimum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),a.dirty()):o.kind==="max"?(o.inclusive?e.data>o.value:e.data>=o.value)&&(r=this._getOrReturnCtx(e,r),R(r,{code:b.too_big,maximum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),a.dirty()):o.kind==="multipleOf"?cu(e.data,o.value)!==0&&(r=this._getOrReturnCtx(e,r),R(r,{code:b.not_multiple_of,multipleOf:o.value,message:o.message}),a.dirty()):o.kind==="finite"?Number.isFinite(e.data)||(r=this._getOrReturnCtx(e,r),R(r,{code:b.not_finite,message:o.message}),a.dirty()):j.assertNever(o);return{status:a.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,A.toString(t))}gt(e,t){return this.setLimit("min",e,!1,A.toString(t))}lte(e,t){return this.setLimit("max",e,!0,A.toString(t))}lt(e,t){return this.setLimit("max",e,!1,A.toString(t))}setLimit(e,t,r,a){return new n({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:A.toString(a)}]})}_addCheck(e){return new n({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:A.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:A.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:A.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:A.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:A.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:A.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:A.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:A.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:A.toString(e)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&j.isInteger(e.value))}get isFinite(){let e=null,t=null;for(let r of this._def.checks){if(r.kind==="finite"||r.kind==="int"||r.kind==="multipleOf")return!0;r.kind==="min"?(t===null||r.value>t)&&(t=r.value):r.kind==="max"&&(e===null||r.value<e)&&(e=r.value)}return Number.isFinite(t)&&Number.isFinite(e)}};Ve.create=n=>new Ve({checks:[],typeName:B.ZodNumber,coerce:n?.coerce||!1,...P(n)});var qe=class n extends O{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==I.bigint)return this._getInvalidInput(e);let r,a=new X;for(let o of this._def.checks)o.kind==="min"?(o.inclusive?e.data<o.value:e.data<=o.value)&&(r=this._getOrReturnCtx(e,r),R(r,{code:b.too_small,type:"bigint",minimum:o.value,inclusive:o.inclusive,message:o.message}),a.dirty()):o.kind==="max"?(o.inclusive?e.data>o.value:e.data>=o.value)&&(r=this._getOrReturnCtx(e,r),R(r,{code:b.too_big,type:"bigint",maximum:o.value,inclusive:o.inclusive,message:o.message}),a.dirty()):o.kind==="multipleOf"?e.data%o.value!==BigInt(0)&&(r=this._getOrReturnCtx(e,r),R(r,{code:b.not_multiple_of,multipleOf:o.value,message:o.message}),a.dirty()):j.assertNever(o);return{status:a.value,value:e.data}}_getInvalidInput(e){let t=this._getOrReturnCtx(e);return R(t,{code:b.invalid_type,expected:I.bigint,received:t.parsedType}),L}gte(e,t){return this.setLimit("min",e,!0,A.toString(t))}gt(e,t){return this.setLimit("min",e,!1,A.toString(t))}lte(e,t){return this.setLimit("max",e,!0,A.toString(t))}lt(e,t){return this.setLimit("max",e,!1,A.toString(t))}setLimit(e,t,r,a){return new n({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:A.toString(a)}]})}_addCheck(e){return new n({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:A.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:A.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:A.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:A.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:A.toString(t)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}};qe.create=n=>new qe({checks:[],typeName:B.ZodBigInt,coerce:n?.coerce??!1,...P(n)});var We=class extends O{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==I.boolean){let r=this._getOrReturnCtx(e);return R(r,{code:b.invalid_type,expected:I.boolean,received:r.parsedType}),L}return te(e.data)}};We.create=n=>new We({typeName:B.ZodBoolean,coerce:n?.coerce||!1,...P(n)});var ze=class n extends O{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==I.date){let o=this._getOrReturnCtx(e);return R(o,{code:b.invalid_type,expected:I.date,received:o.parsedType}),L}if(Number.isNaN(e.data.getTime())){let o=this._getOrReturnCtx(e);return R(o,{code:b.invalid_date}),L}let r=new X,a;for(let o of this._def.checks)o.kind==="min"?e.data.getTime()<o.value&&(a=this._getOrReturnCtx(e,a),R(a,{code:b.too_small,message:o.message,inclusive:!0,exact:!1,minimum:o.value,type:"date"}),r.dirty()):o.kind==="max"?e.data.getTime()>o.value&&(a=this._getOrReturnCtx(e,a),R(a,{code:b.too_big,message:o.message,inclusive:!0,exact:!1,maximum:o.value,type:"date"}),r.dirty()):j.assertNever(o);return{status:r.value,value:new Date(e.data.getTime())}}_addCheck(e){return new n({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:A.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:A.toString(t)})}get minDate(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e!=null?new Date(e):null}};ze.create=n=>new ze({checks:[],coerce:n?.coerce||!1,typeName:B.ZodDate,...P(n)});var gt=class extends O{_parse(e){if(this._getType(e)!==I.symbol){let r=this._getOrReturnCtx(e);return R(r,{code:b.invalid_type,expected:I.symbol,received:r.parsedType}),L}return te(e.data)}};gt.create=n=>new gt({typeName:B.ZodSymbol,...P(n)});var Ze=class extends O{_parse(e){if(this._getType(e)!==I.undefined){let r=this._getOrReturnCtx(e);return R(r,{code:b.invalid_type,expected:I.undefined,received:r.parsedType}),L}return te(e.data)}};Ze.create=n=>new Ze({typeName:B.ZodUndefined,...P(n)});var Ge=class extends O{_parse(e){if(this._getType(e)!==I.null){let r=this._getOrReturnCtx(e);return R(r,{code:b.invalid_type,expected:I.null,received:r.parsedType}),L}return te(e.data)}};Ge.create=n=>new Ge({typeName:B.ZodNull,...P(n)});var Be=class extends O{constructor(){super(...arguments),this._any=!0}_parse(e){return te(e.data)}};Be.create=n=>new Be({typeName:B.ZodAny,...P(n)});var Re=class extends O{constructor(){super(...arguments),this._unknown=!0}_parse(e){return te(e.data)}};Re.create=n=>new Re({typeName:B.ZodUnknown,...P(n)});var he=class extends O{_parse(e){let t=this._getOrReturnCtx(e);return R(t,{code:b.invalid_type,expected:I.never,received:t.parsedType}),L}};he.create=n=>new he({typeName:B.ZodNever,...P(n)});var xt=class extends O{_parse(e){if(this._getType(e)!==I.undefined){let r=this._getOrReturnCtx(e);return R(r,{code:b.invalid_type,expected:I.void,received:r.parsedType}),L}return te(e.data)}};xt.create=n=>new xt({typeName:B.ZodVoid,...P(n)});var Ie=class n extends O{_parse(e){let{ctx:t,status:r}=this._processInputParams(e),a=this._def;if(t.parsedType!==I.array)return R(t,{code:b.invalid_type,expected:I.array,received:t.parsedType}),L;if(a.exactLength!==null){let u=t.data.length>a.exactLength.value,p=t.data.length<a.exactLength.value;(u||p)&&(R(t,{code:u?b.too_big:b.too_small,minimum:p?a.exactLength.value:void 0,maximum:u?a.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:a.exactLength.message}),r.dirty())}if(a.minLength!==null&&t.data.length<a.minLength.value&&(R(t,{code:b.too_small,minimum:a.minLength.value,type:"array",inclusive:!0,exact:!1,message:a.minLength.message}),r.dirty()),a.maxLength!==null&&t.data.length>a.maxLength.value&&(R(t,{code:b.too_big,maximum:a.maxLength.value,type:"array",inclusive:!0,exact:!1,message:a.maxLength.message}),r.dirty()),t.common.async)return Promise.all([...t.data].map((u,p)=>a.type._parseAsync(new de(t,u,t.path,p)))).then(u=>X.mergeArray(r,u));let o=[...t.data].map((u,p)=>a.type._parseSync(new de(t,u,t.path,p)));return X.mergeArray(r,o)}get element(){return this._def.type}min(e,t){return new n({...this._def,minLength:{value:e,message:A.toString(t)}})}max(e,t){return new n({...this._def,maxLength:{value:e,message:A.toString(t)}})}length(e,t){return new n({...this._def,exactLength:{value:e,message:A.toString(t)}})}nonempty(e){return this.min(1,e)}};Ie.create=(n,e)=>new Ie({type:n,minLength:null,maxLength:null,exactLength:null,typeName:B.ZodArray,...P(e)});function yt(n){if(n instanceof oe){let e={};for(let t in n.shape){let r=n.shape[t];e[t]=pe.create(yt(r))}return new oe({...n._def,shape:()=>e})}else return n instanceof Ie?new Ie({...n._def,type:yt(n.element)}):n instanceof pe?pe.create(yt(n.unwrap())):n instanceof we?we.create(yt(n.unwrap())):n instanceof ve?ve.create(n.items.map(e=>yt(e))):n}var oe=class n extends O{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),t=j.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==I.object){let w=this._getOrReturnCtx(e);return R(w,{code:b.invalid_type,expected:I.object,received:w.parsedType}),L}let{status:r,ctx:a}=this._processInputParams(e),{shape:o,keys:u}=this._getCached(),p=[];if(!(this._def.catchall instanceof he&&this._def.unknownKeys==="strip"))for(let w in a.data)u.includes(w)||p.push(w);let x=[];for(let w of u){let E=o[w],F=a.data[w];x.push({key:{status:"valid",value:w},value:E._parse(new de(a,F,a.path,w)),alwaysSet:w in a.data})}if(this._def.catchall instanceof he){let w=this._def.unknownKeys;if(w==="passthrough")for(let E of p)x.push({key:{status:"valid",value:E},value:{status:"valid",value:a.data[E]}});else if(w==="strict")p.length>0&&(R(a,{code:b.unrecognized_keys,keys:p}),r.dirty());else if(w!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let w=this._def.catchall;for(let E of p){let F=a.data[E];x.push({key:{status:"valid",value:E},value:w._parse(new de(a,F,a.path,E)),alwaysSet:E in a.data})}}return a.common.async?Promise.resolve().then(async()=>{let w=[];for(let E of x){let F=await E.key,J=await E.value;w.push({key:F,value:J,alwaysSet:E.alwaysSet})}return w}).then(w=>X.mergeObjectSync(r,w)):X.mergeObjectSync(r,x)}get shape(){return this._def.shape()}strict(e){return A.errToObj,new n({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,r)=>{let a=this._def.errorMap?.(t,r).message??r.defaultError;return t.code==="unrecognized_keys"?{message:A.errToObj(e).message??a}:{message:a}}}:{}})}strip(){return new n({...this._def,unknownKeys:"strip"})}passthrough(){return new n({...this._def,unknownKeys:"passthrough"})}extend(e){return new n({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new n({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:B.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new n({...this._def,catchall:e})}pick(e){let t={};for(let r of j.objectKeys(e))e[r]&&this.shape[r]&&(t[r]=this.shape[r]);return new n({...this._def,shape:()=>t})}omit(e){let t={};for(let r of j.objectKeys(this.shape))e[r]||(t[r]=this.shape[r]);return new n({...this._def,shape:()=>t})}deepPartial(){return yt(this)}partial(e){let t={};for(let r of j.objectKeys(this.shape)){let a=this.shape[r];e&&!e[r]?t[r]=a:t[r]=a.optional()}return new n({...this._def,shape:()=>t})}required(e){let t={};for(let r of j.objectKeys(this.shape))if(e&&!e[r])t[r]=this.shape[r];else{let o=this.shape[r];for(;o instanceof pe;)o=o._def.innerType;t[r]=o}return new n({...this._def,shape:()=>t})}keyof(){return wi(j.objectKeys(this.shape))}};oe.create=(n,e)=>new oe({shape:()=>n,unknownKeys:"strip",catchall:he.create(),typeName:B.ZodObject,...P(e)});oe.strictCreate=(n,e)=>new oe({shape:()=>n,unknownKeys:"strict",catchall:he.create(),typeName:B.ZodObject,...P(e)});oe.lazycreate=(n,e)=>new oe({shape:n,unknownKeys:"strip",catchall:he.create(),typeName:B.ZodObject,...P(e)});var He=class extends O{_parse(e){let{ctx:t}=this._processInputParams(e),r=this._def.options;function a(o){for(let p of o)if(p.result.status==="valid")return p.result;for(let p of o)if(p.result.status==="dirty")return t.common.issues.push(...p.ctx.common.issues),p.result;let u=o.map(p=>new se(p.ctx.common.issues));return R(t,{code:b.invalid_union,unionErrors:u}),L}if(t.common.async)return Promise.all(r.map(async o=>{let u={...t,common:{...t.common,issues:[]},parent:null};return{result:await o._parseAsync({data:t.data,path:t.path,parent:u}),ctx:u}})).then(a);{let o,u=[];for(let x of r){let w={...t,common:{...t.common,issues:[]},parent:null},E=x._parseSync({data:t.data,path:t.path,parent:w});if(E.status==="valid")return E;E.status==="dirty"&&!o&&(o={result:E,ctx:w}),w.common.issues.length&&u.push(w.common.issues)}if(o)return t.common.issues.push(...o.ctx.common.issues),o.result;let p=u.map(x=>new se(x));return R(t,{code:b.invalid_union,unionErrors:p}),L}}get options(){return this._def.options}};He.create=(n,e)=>new He({options:n,typeName:B.ZodUnion,...P(e)});var Ne=n=>n instanceof Ye?Ne(n.schema):n instanceof fe?Ne(n.innerType()):n instanceof Ke?[n.value]:n instanceof Qe?n.options:n instanceof Xe?j.objectValues(n.enum):n instanceof et?Ne(n._def.innerType):n instanceof Ze?[void 0]:n instanceof Ge?[null]:n instanceof pe?[void 0,...Ne(n.unwrap())]:n instanceof we?[null,...Ne(n.unwrap())]:n instanceof Ot||n instanceof rt?Ne(n.unwrap()):n instanceof tt?Ne(n._def.innerType):[],Yt=class n extends O{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==I.object)return R(t,{code:b.invalid_type,expected:I.object,received:t.parsedType}),L;let r=this.discriminator,a=t.data[r],o=this.optionsMap.get(a);return o?t.common.async?o._parseAsync({data:t.data,path:t.path,parent:t}):o._parseSync({data:t.data,path:t.path,parent:t}):(R(t,{code:b.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),L)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,r){let a=new Map;for(let o of t){let u=Ne(o.shape[e]);if(!u.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let p of u){if(a.has(p))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(p)}`);a.set(p,o)}}return new n({typeName:B.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:a,...P(r)})}};function kr(n,e){let t=xe(n),r=xe(e);if(n===e)return{valid:!0,data:n};if(t===I.object&&r===I.object){let a=j.objectKeys(e),o=j.objectKeys(n).filter(p=>a.indexOf(p)!==-1),u={...n,...e};for(let p of o){let x=kr(n[p],e[p]);if(!x.valid)return{valid:!1};u[p]=x.data}return{valid:!0,data:u}}else if(t===I.array&&r===I.array){if(n.length!==e.length)return{valid:!1};let a=[];for(let o=0;o<n.length;o++){let u=n[o],p=e[o],x=kr(u,p);if(!x.valid)return{valid:!1};a.push(x.data)}return{valid:!0,data:a}}else return t===I.date&&r===I.date&&+n==+e?{valid:!0,data:n}:{valid:!1}}var Je=class extends O{_parse(e){let{status:t,ctx:r}=this._processInputParams(e),a=(o,u)=>{if(Ht(o)||Ht(u))return L;let p=kr(o.value,u.value);return p.valid?((Jt(o)||Jt(u))&&t.dirty(),{status:t.value,value:p.data}):(R(r,{code:b.invalid_intersection_types}),L)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([o,u])=>a(o,u)):a(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}};Je.create=(n,e,t)=>new Je({left:n,right:e,typeName:B.ZodIntersection,...P(t)});var ve=class n extends O{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==I.array)return R(r,{code:b.invalid_type,expected:I.array,received:r.parsedType}),L;if(r.data.length<this._def.items.length)return R(r,{code:b.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),L;!this._def.rest&&r.data.length>this._def.items.length&&(R(r,{code:b.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());let o=[...r.data].map((u,p)=>{let x=this._def.items[p]||this._def.rest;return x?x._parse(new de(r,u,r.path,p)):null}).filter(u=>!!u);return r.common.async?Promise.all(o).then(u=>X.mergeArray(t,u)):X.mergeArray(t,o)}get items(){return this._def.items}rest(e){return new n({...this._def,rest:e})}};ve.create=(n,e)=>{if(!Array.isArray(n))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new ve({items:n,typeName:B.ZodTuple,rest:null,...P(e)})};var Kt=class n extends O{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==I.object)return R(r,{code:b.invalid_type,expected:I.object,received:r.parsedType}),L;let a=[],o=this._def.keyType,u=this._def.valueType;for(let p in r.data)a.push({key:o._parse(new de(r,p,r.path,p)),value:u._parse(new de(r,r.data[p],r.path,p)),alwaysSet:p in r.data});return r.common.async?X.mergeObjectAsync(t,a):X.mergeObjectSync(t,a)}get element(){return this._def.valueType}static create(e,t,r){return t instanceof O?new n({keyType:e,valueType:t,typeName:B.ZodRecord,...P(r)}):new n({keyType:Le.create(),valueType:e,typeName:B.ZodRecord,...P(t)})}},vt=class extends O{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==I.map)return R(r,{code:b.invalid_type,expected:I.map,received:r.parsedType}),L;let a=this._def.keyType,o=this._def.valueType,u=[...r.data.entries()].map(([p,x],w)=>({key:a._parse(new de(r,p,r.path,[w,"key"])),value:o._parse(new de(r,x,r.path,[w,"value"]))}));if(r.common.async){let p=new Map;return Promise.resolve().then(async()=>{for(let x of u){let w=await x.key,E=await x.value;if(w.status==="aborted"||E.status==="aborted")return L;(w.status==="dirty"||E.status==="dirty")&&t.dirty(),p.set(w.value,E.value)}return{status:t.value,value:p}})}else{let p=new Map;for(let x of u){let w=x.key,E=x.value;if(w.status==="aborted"||E.status==="aborted")return L;(w.status==="dirty"||E.status==="dirty")&&t.dirty(),p.set(w.value,E.value)}return{status:t.value,value:p}}}};vt.create=(n,e,t)=>new vt({valueType:e,keyType:n,typeName:B.ZodMap,...P(t)});var wt=class n extends O{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==I.set)return R(r,{code:b.invalid_type,expected:I.set,received:r.parsedType}),L;let a=this._def;a.minSize!==null&&r.data.size<a.minSize.value&&(R(r,{code:b.too_small,minimum:a.minSize.value,type:"set",inclusive:!0,exact:!1,message:a.minSize.message}),t.dirty()),a.maxSize!==null&&r.data.size>a.maxSize.value&&(R(r,{code:b.too_big,maximum:a.maxSize.value,type:"set",inclusive:!0,exact:!1,message:a.maxSize.message}),t.dirty());let o=this._def.valueType;function u(x){let w=new Set;for(let E of x){if(E.status==="aborted")return L;E.status==="dirty"&&t.dirty(),w.add(E.value)}return{status:t.value,value:w}}let p=[...r.data.values()].map((x,w)=>o._parse(new de(r,x,r.path,w)));return r.common.async?Promise.all(p).then(x=>u(x)):u(p)}min(e,t){return new n({...this._def,minSize:{value:e,message:A.toString(t)}})}max(e,t){return new n({...this._def,maxSize:{value:e,message:A.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}};wt.create=(n,e)=>new wt({valueType:n,minSize:null,maxSize:null,typeName:B.ZodSet,...P(e)});var Qt=class n extends O{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==I.function)return R(t,{code:b.invalid_type,expected:I.function,received:t.parsedType}),L;function r(p,x){return Ft({data:p,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,mt(),ke].filter(w=>!!w),issueData:{code:b.invalid_arguments,argumentsError:x}})}function a(p,x){return Ft({data:p,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,mt(),ke].filter(w=>!!w),issueData:{code:b.invalid_return_type,returnTypeError:x}})}let o={errorMap:t.common.contextualErrorMap},u=t.data;if(this._def.returns instanceof Pe){let p=this;return te(async function(...x){let w=new se([]),E=await p._def.args.parseAsync(x,o).catch(S=>{throw w.addIssue(r(x,S)),w}),F=await Reflect.apply(u,this,E);return await p._def.returns._def.type.parseAsync(F,o).catch(S=>{throw w.addIssue(a(F,S)),w})})}else{let p=this;return te(function(...x){let w=p._def.args.safeParse(x,o);if(!w.success)throw new se([r(x,w.error)]);let E=Reflect.apply(u,this,w.data),F=p._def.returns.safeParse(E,o);if(!F.success)throw new se([a(E,F.error)]);return F.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new n({...this._def,args:ve.create(e).rest(Re.create())})}returns(e){return new n({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,r){return new n({args:e||ve.create([]).rest(Re.create()),returns:t||Re.create(),typeName:B.ZodFunction,...P(r)})}},Ye=class extends O{get schema(){return this._def.getter()}_parse(e){let{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}};Ye.create=(n,e)=>new Ye({getter:n,typeName:B.ZodLazy,...P(e)});var Ke=class extends O{_parse(e){if(e.data!==this._def.value){let t=this._getOrReturnCtx(e);return R(t,{received:t.data,code:b.invalid_literal,expected:this._def.value}),L}return{status:"valid",value:e.data}}get value(){return this._def.value}};Ke.create=(n,e)=>new Ke({value:n,typeName:B.ZodLiteral,...P(e)});function wi(n,e){return new Qe({values:n,typeName:B.ZodEnum,...P(e)})}var Qe=class n extends O{_parse(e){if(typeof e.data!="string"){let t=this._getOrReturnCtx(e),r=this._def.values;return R(t,{expected:j.joinValues(r),received:t.parsedType,code:b.invalid_type}),L}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){let t=this._getOrReturnCtx(e),r=this._def.values;return R(t,{received:t.data,code:b.invalid_enum_value,options:r}),L}return te(e.data)}get options(){return this._def.values}get enum(){let e={};for(let t of this._def.values)e[t]=t;return e}get Values(){let e={};for(let t of this._def.values)e[t]=t;return e}get Enum(){let e={};for(let t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return n.create(e,{...this._def,...t})}exclude(e,t=this._def){return n.create(this.options.filter(r=>!e.includes(r)),{...this._def,...t})}};Qe.create=wi;var Xe=class extends O{_parse(e){let t=j.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==I.string&&r.parsedType!==I.number){let a=j.objectValues(t);return R(r,{expected:j.joinValues(a),received:r.parsedType,code:b.invalid_type}),L}if(this._cache||(this._cache=new Set(j.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let a=j.objectValues(t);return R(r,{received:r.data,code:b.invalid_enum_value,options:a}),L}return te(e.data)}get enum(){return this._def.values}};Xe.create=(n,e)=>new Xe({values:n,typeName:B.ZodNativeEnum,...P(e)});var Pe=class extends O{unwrap(){return this._def.type}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==I.promise&&t.common.async===!1)return R(t,{code:b.invalid_type,expected:I.promise,received:t.parsedType}),L;let r=t.parsedType===I.promise?t.data:Promise.resolve(t.data);return te(r.then(a=>this._def.type.parseAsync(a,{path:t.path,errorMap:t.common.contextualErrorMap})))}};Pe.create=(n,e)=>new Pe({type:n,typeName:B.ZodPromise,...P(e)});var fe=class extends O{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===B.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:t,ctx:r}=this._processInputParams(e),a=this._def.effect||null,o={addIssue:u=>{R(r,u),u.fatal?t.abort():t.dirty()},get path(){return r.path}};if(o.addIssue=o.addIssue.bind(o),a.type==="preprocess"){let u=a.transform(r.data,o);if(r.common.async)return Promise.resolve(u).then(async p=>{if(t.value==="aborted")return L;let x=await this._def.schema._parseAsync({data:p,path:r.path,parent:r});return x.status==="aborted"?L:x.status==="dirty"?De(x.value):t.value==="dirty"?De(x.value):x});{if(t.value==="aborted")return L;let p=this._def.schema._parseSync({data:u,path:r.path,parent:r});return p.status==="aborted"?L:p.status==="dirty"?De(p.value):t.value==="dirty"?De(p.value):p}}if(a.type==="refinement"){let u=p=>{let x=a.refinement(p,o);if(r.common.async)return Promise.resolve(x);if(x instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return p};if(r.common.async===!1){let p=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return p.status==="aborted"?L:(p.status==="dirty"&&t.dirty(),u(p.value),{status:t.value,value:p.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(p=>p.status==="aborted"?L:(p.status==="dirty"&&t.dirty(),u(p.value).then(()=>({status:t.value,value:p.value}))))}if(a.type==="transform")if(r.common.async===!1){let u=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!Ce(u))return L;let p=a.transform(u.value,o);if(p instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:p}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(u=>Ce(u)?Promise.resolve(a.transform(u.value,o)).then(p=>({status:t.value,value:p})):L);j.assertNever(a)}};fe.create=(n,e,t)=>new fe({schema:n,typeName:B.ZodEffects,effect:e,...P(t)});fe.createWithPreprocess=(n,e,t)=>new fe({schema:e,effect:{type:"preprocess",transform:n},typeName:B.ZodEffects,...P(t)});var pe=class extends O{_parse(e){return this._getType(e)===I.undefined?te(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};pe.create=(n,e)=>new pe({innerType:n,typeName:B.ZodOptional,...P(e)});var we=class extends O{_parse(e){return this._getType(e)===I.null?te(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};we.create=(n,e)=>new we({innerType:n,typeName:B.ZodNullable,...P(e)});var et=class extends O{_parse(e){let{ctx:t}=this._processInputParams(e),r=t.data;return t.parsedType===I.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:t.path,parent:t})}removeDefault(){return this._def.innerType}};et.create=(n,e)=>new et({innerType:n,typeName:B.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...P(e)});var tt=class extends O{_parse(e){let{ctx:t}=this._processInputParams(e),r={...t,common:{...t.common,issues:[]}},a=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return ht(a)?a.then(o=>({status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new se(r.common.issues)},input:r.data})})):{status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new se(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}};tt.create=(n,e)=>new tt({innerType:n,typeName:B.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...P(e)});var bt=class extends O{_parse(e){if(this._getType(e)!==I.nan){let r=this._getOrReturnCtx(e);return R(r,{code:b.invalid_type,expected:I.nan,received:r.parsedType}),L}return{status:"valid",value:e.data}}};bt.create=n=>new bt({typeName:B.ZodNaN,...P(n)});var pu=Symbol("zod_brand"),Ot=class extends O{_parse(e){let{ctx:t}=this._processInputParams(e),r=t.data;return this._def.type._parse({data:r,path:t.path,parent:t})}unwrap(){return this._def.type}},Ut=class n extends O{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.common.async)return(async()=>{let o=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return o.status==="aborted"?L:o.status==="dirty"?(t.dirty(),De(o.value)):this._def.out._parseAsync({data:o.value,path:r.path,parent:r})})();{let a=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return a.status==="aborted"?L:a.status==="dirty"?(t.dirty(),{status:"dirty",value:a.value}):this._def.out._parseSync({data:a.value,path:r.path,parent:r})}}static create(e,t){return new n({in:e,out:t,typeName:B.ZodPipeline})}},rt=class extends O{_parse(e){let t=this._def.innerType._parse(e),r=a=>(Ce(a)&&(a.value=Object.freeze(a.value)),a);return ht(t)?t.then(a=>r(a)):r(t)}unwrap(){return this._def.innerType}};rt.create=(n,e)=>new rt({innerType:n,typeName:B.ZodReadonly,...P(e)});function yi(n,e){let t=typeof n=="function"?n(e):typeof n=="string"?{message:n}:n;return typeof t=="string"?{message:t}:t}function bi(n,e={},t){return n?Be.create().superRefine((r,a)=>{let o=n(r);if(o instanceof Promise)return o.then(u=>{if(!u){let p=yi(e,r),x=p.fatal??t??!0;a.addIssue({code:"custom",...p,fatal:x})}});if(!o){let u=yi(e,r),p=u.fatal??t??!0;a.addIssue({code:"custom",...u,fatal:p})}}):Be.create()}var du={object:oe.lazycreate},B;(function(n){n.ZodString="ZodString",n.ZodNumber="ZodNumber",n.ZodNaN="ZodNaN",n.ZodBigInt="ZodBigInt",n.ZodBoolean="ZodBoolean",n.ZodDate="ZodDate",n.ZodSymbol="ZodSymbol",n.ZodUndefined="ZodUndefined",n.ZodNull="ZodNull",n.ZodAny="ZodAny",n.ZodUnknown="ZodUnknown",n.ZodNever="ZodNever",n.ZodVoid="ZodVoid",n.ZodArray="ZodArray",n.ZodObject="ZodObject",n.ZodUnion="ZodUnion",n.ZodDiscriminatedUnion="ZodDiscriminatedUnion",n.ZodIntersection="ZodIntersection",n.ZodTuple="ZodTuple",n.ZodRecord="ZodRecord",n.ZodMap="ZodMap",n.ZodSet="ZodSet",n.ZodFunction="ZodFunction",n.ZodLazy="ZodLazy",n.ZodLiteral="ZodLiteral",n.ZodEnum="ZodEnum",n.ZodEffects="ZodEffects",n.ZodNativeEnum="ZodNativeEnum",n.ZodOptional="ZodOptional",n.ZodNullable="ZodNullable",n.ZodDefault="ZodDefault",n.ZodCatch="ZodCatch",n.ZodPromise="ZodPromise",n.ZodBranded="ZodBranded",n.ZodPipeline="ZodPipeline",n.ZodReadonly="ZodReadonly"})(B||(B={}));var fu=(n,e={message:`Input not instance of ${n.name}`})=>bi(t=>t instanceof n,e),Ti=Le.create,_i=Ve.create,mu=bt.create,hu=qe.create,ki=We.create,yu=ze.create,gu=gt.create,xu=Ze.create,vu=Ge.create,wu=Be.create,bu=Re.create,Tu=he.create,_u=xt.create,ku=Ie.create,Nu=oe.create,Ru=oe.strictCreate,Iu=He.create,Eu=Yt.create,Au=Je.create,Su=ve.create,Cu=Kt.create,Lu=vt.create,Bu=wt.create,Pu=Qt.create,Fu=Ye.create,Ou=Ke.create,Uu=Qe.create,ju=Xe.create,Mu=Pe.create,$u=fe.create,Du=pe.create,Vu=we.create,qu=fe.createWithPreprocess,Wu=Ut.create,zu=()=>Ti().optional(),Zu=()=>_i().optional(),Gu=()=>ki().optional(),Hu={string:(n=>Le.create({...n,coerce:!0})),number:(n=>Ve.create({...n,coerce:!0})),boolean:(n=>We.create({...n,coerce:!0})),bigint:(n=>qe.create({...n,coerce:!0})),date:(n=>ze.create({...n,coerce:!0}))};var Ju=L;m();y();h();var Ni=D.strictObject({title:D.string(),content:D.string()});var Nr=D.object({"base-api-exception-class-name":D.string().optional(),"base-exception-class-name":D.string().optional(),"client-class-name":D.string().optional(),"inline-file-properties":D.boolean().optional(),"inline-path-parameters":D.boolean().optional(),"package-layout":D.enum(["flat","nested"]).optional(),"package-prefix":D.string().optional(),"use-local-date-for-dates":D.boolean().optional(),"custom-dependencies":D.array(D.string()).optional(),"disable-required-property-builder-checks":D.boolean().optional(),"enable-forward-compatible-enums":D.boolean().optional(),"enable-inline-types":D.boolean().optional(),"enable-public-constructors":D.boolean().optional(),"generate-unknown-as-json-node":D.boolean().optional(),"json-include":D.enum(["non-absent","non-empty"]).optional(),"enable-extensible-builders":D.boolean().optional(),"use-default-request-parameter-values":D.boolean().optional(),"enable-wire-tests":D.boolean().default(!1),"collapse-optional-nullable":D.boolean().optional(),"custom-readme-sections":D.array(Ni).optional(),"custom-pager-name":D.string().optional(),"default-timeout-in-seconds":D.number().optional(),"gradle-distribution-url":D.string().optional(),"gradle-plugin-management":D.string().optional(),"gradle-central-dependency-management":D.boolean().optional(),"wrapped-aliases":D.boolean().optional()});var d={};pr(d,{Access:()=>Rr,AstNode:()=>Z,Class:()=>nt,ClassInstantiation:()=>at,ClassReference:()=>V,CodeBlock:()=>it,Method:()=>st,MethodInvocation:()=>ot,Parameter:()=>ut,Type:()=>jt,TypeLiteral:()=>ue,Writer:()=>$e,classReference:()=>yl,class_:()=>hl,codeblock:()=>ml,instantiateClass:()=>gl,invokeMethod:()=>xl,method:()=>vl,parameter:()=>wl});m();y();h();m();y();h();m();y();h();var Rr={Public:"public",Protected:"protected",Private:"private"};m();y();h();m();y();h();var Z=class extends je{async toStringAsync({packageName:e,customConfig:t,formatter:r}){let a=new Pt({packageName:e,customConfig:t,formatter:r});return this.write(a),a.toStringAsync()}toString({packageName:e,customConfig:t,formatter:r}){let a=new Pt({packageName:e,customConfig:t,formatter:r});return this.write(a),a.toString()}};var nt=class extends Z{constructor({name:t,access:r}){super();_(this,"name");_(this,"access");_(this,"methods",[]);this.name=t,this.access=r}write(t){if(t.write(`${this.access} class ${this.name}`),this.isEmpty()){t.writeLine(" {}");return}t.writeLine(" {"),t.indent();for(let r of this.methods)t.writeNode(r),t.newLine();t.dedent(),t.write("}")}addMethod(t){this.methods.push(t)}isEmpty(){return this.methods.length===0}};m();y();h();m();y();h();m();y();h();m();y();h();var V=class extends Z{constructor({name:t,packageName:r,fullyQualified:a}){super();_(this,"name");_(this,"packageName");_(this,"fullyQualified");this.name=t,this.packageName=r,this.fullyQualified=a??!1}write(t){if(t.addImport(`${this.packageName}.${this.name}`),this.fullyQualified){t.write(`${this.packageName}.${this.name}`);return}t.write(this.name)}};m();y();h();var jt=class extends Z{constructor(t){super();_(this,"internalType");this.internalType=t}write(t){switch(this.internalType.type){case"array":t.writeNode(this.internalType.value),t.write("[]");break;case"bigInteger":t.writeNode(Yu);break;case"boolean":t.write("Boolean");break;case"bytes":t.write("byte[]");break;case"date":t.write("String");break;case"dateTime":t.writeNode(Xu);break;case"double":t.write("Double");break;case"float":t.write("Float");break;case"generic":t.writeNode(this.internalType.value),t.write("<");for(let[r,a]of this.internalType.parameters.entries())t.writeNode(a),r<this.internalType.parameters.length-1&&t.write(", ");t.write(">");break;case"inputStream":t.writeNode(rl);break;case"integer":t.write("Integer");break;case"iterable":this.writeIterable({writer:t,iterable:this.internalType});break;case"list":{this.writeList({writer:t,list:this.internalType});break}case"long":{t.write("Long");break}case"map":{this.writeMap({writer:t,map:this.internalType});break}case"object":{t.write("Object");break}case"optional":{this.writeOptional({writer:t,optional:this.internalType});break}case"reference":t.writeNode(this.internalType.value);break;case"set":{this.writeSet({writer:t,set:this.internalType});break}case"string":t.write("String");break;case"uuid":t.writeNode(tl);break;case"void":t.write("Void");break;default:M(this.internalType)}}isOptional(){return this.internalType.type==="optional"}static array(t){return new this({type:"array",value:t})}static bigInteger(){return new this({type:"bigInteger"})}static boolean(){return new this({type:"boolean"})}static bytes(){return new this({type:"bytes"})}static date(){return new this({type:"date"})}static dateTime(){return new this({type:"dateTime"})}static double(){return new this({type:"double"})}static float(){return new this({type:"float"})}static integer(){return new this({type:"integer"})}static list(t){return new this({type:"list",value:t})}static long(){return new this({type:"long"})}static map(t,r){return new this({type:"map",keyType:t,valueType:r})}static object(){return new this({type:"object"})}static optional(t){return this.isAlreadyOptional(t)?t:new this({type:"optional",value:t})}static reference(t){return new this({type:"reference",value:t})}static generic(t,r){return new this({type:"generic",value:t,parameters:r})}static set(t){return new this({type:"set",value:t})}static string(){return new this({type:"string"})}static uuid(){return new this({type:"uuid"})}static void(){return new this({type:"void"})}static iterable(t){return new this({type:"iterable",value:t})}static inputStream(){return new this({type:"inputStream"})}writeList({writer:t,list:r}){t.writeNode(Ku),t.write("<"),r.value.write(t),t.write(">")}writeMap({writer:t,map:r}){t.writeNode(Qu),t.write("<"),r.keyType.write(t),t.write(", "),r.valueType.write(t),t.write(">")}writeOptional({writer:t,optional:r}){t.writeNode(Xt),t.write("<"),r.value.write(t),t.write(">")}writeIterable({writer:t,iterable:r}){t.writeNode(Xt),t.write("<"),r.value.write(t),t.write(">")}writeSet({writer:t,set:r}){t.writeNode(el),t.write("<"),r.value.write(t),t.write(">")}static isAlreadyOptional(t){return t.internalType.type==="optional"}},er=new V({name:"Arrays",packageName:"java.util"}),Yu=new V({name:"BigInteger",packageName:"java.math"}),sg=new V({name:"HashMap",packageName:"java.util"}),Ku=new V({name:"List",packageName:"java.util"}),Qu=new V({name:"Map",packageName:"java.util"}),Xu=new V({name:"OffsetDateTime",packageName:"java.time"}),Xt=new V({name:"Optional",packageName:"java.util"}),el=new V({name:"Set",packageName:"java.util"}),tl=new V({name:"UUID",packageName:"java.util"}),rl=new V({name:"InputStream",packageName:"java.io"});var ue=class n extends Z{constructor(t){super();_(this,"internalType");this.internalType=t}write(t){switch(this.internalType.type){case"bigInteger":this.writeBigInteger({writer:t,bigInteger:this.internalType});break;case"boolean":t.write(this.internalType.value.toString());break;case"builder":this.writeBuilder({writer:t,builder:this.internalType});break;case"bytes":t.write(`"${this.internalType.value}".getBytes()`);break;case"class":{this.writeClass({writer:t,class_:this.internalType});break}case"date":this.writeDate({writer:t,date:this.internalType});break;case"dateTime":this.writeDateTime({writer:t,dateTime:this.internalType});break;case"double":{let r=this.internalType.value.toString();!r.includes(".")&&!r.includes("e")&&!r.includes("E")?t.write(`${r}.0`):t.write(r);break}case"enum":this.writeEnum({writer:t,enum_:this.internalType});break;case"float":t.write(`${this.internalType.value}f`);break;case"integer":t.write(Math.floor(this.internalType.value).toString());break;case"list":{this.writeList({writer:t,list:this.internalType});break}case"long":{t.write(`${Math.floor(this.internalType.value)}L`);break}case"map":{this.writeMap({writer:t,map:this.internalType});break}case"optional":{this.writeOptional({writer:t,optional:this.internalType});break}case"raw":{this.internalType.value instanceof Z?t.writeNode(this.internalType.value):t.write(this.internalType.value);break}case"reference":t.writeNode(this.internalType.value);break;case"set":{this.writeSet({writer:t,set:this.internalType});break}case"string":t.write(`"${this.escapeString(this.internalType.value)}"`);break;case"unknown":this.writeUnknown({writer:t,value:this.internalType.value});break;case"uuid":this.writeUUID({writer:t,uuid:this.internalType});break;case"nop":break;default:M(this.internalType)}}isOptional(){return this.internalType.type==="optional"}static bigInteger(t){return new this({type:"bigInteger",value:t})}static boolean(t){return new this({type:"boolean",value:t})}static builder({classReference:t,parameters:r}){return new this({type:"builder",classReference:t,parameters:r})}static bytes(t){return new this({type:"bytes",value:t})}static class_({reference:t,parameters:r}){return new this({type:"class",reference:t,parameters:r})}static date(t){return new this({type:"date",value:t})}static dateTime(t){return new this({type:"dateTime",value:t})}static double(t){return new this({type:"double",value:t})}static enum_({classReference:t,value:r}){return new this({type:"enum",classReference:t,value:r})}static float(t){return new this({type:"float",value:t})}static integer(t){return new this({type:"integer",value:t})}static list({valueType:t,values:r,isParameter:a}){return new this({type:"list",valueType:t,values:r,isParameter:a})}static long(t){return new this({type:"long",value:t})}static map({keyType:t,valueType:r,entries:a}){return new this({type:"map",keyType:t,valueType:r,entries:a})}static optional({value:t,useOf:r}){return this.isAlreadyOptional(t)?t:new this({type:"optional",value:t,useOf:r})}static raw(t){return new this({type:"raw",value:t})}static reference(t){return new this({type:"reference",value:t})}static set({valueType:t,values:r}){return new this({type:"set",valueType:t,values:r})}static string(t){return new this({type:"string",value:t})}static unknown(t){return new this({type:"unknown",value:t})}static uuid(t){return new this({type:"uuid",value:t})}static nop(){return new this({type:"nop"})}static isNop(t){return t.internalType.type==="nop"}shouldWriteInLine(){switch(this.internalType.type){case"bigInteger":case"boolean":case"bytes":case"date":case"dateTime":case"double":case"enum":case"float":case"integer":case"long":case"nop":case"raw":case"string":case"unknown":case"uuid":return!0;case"optional":return this.internalType.value.shouldWriteInLine();case"builder":case"class":case"list":case"map":case"reference":case"set":return!1;default:M(this.internalType)}}writeBigInteger({writer:t,bigInteger:r}){t.write("new "),t.writeNode(d.instantiateClass({classReference:nl,arguments_:[n.string(r.value)]}))}writeBuilder({writer:t,builder:r}){t.writeNode(r.classReference),t.writeNewLineIfLastLineNot(),t.indent(),this.writeBuilderParameters({writer:t,parameters:this.orderBuilderParameters(ll({parameters:r.parameters}))}),t.dedent()}writeBuilderParameters({writer:t,parameters:r}){t.writeLine(".builder()");for(let a of r)t.write(`.${a.name}(`),a.value.shouldWriteInLine()||t.newLine(),t.indent(),t.writeNode(a.value),t.dedent(),a.value.shouldWriteInLine()||t.newLine(),t.writeLine(")");t.writeNewLineIfLastLineNot(),t.write(".build()")}orderBuilderParameters(t){return t.some(a=>!a.value.isOptional()&&!this.isCollection(a.value))?t.sort((a,o)=>{let u=this.isNonRequired(a.value),p=this.isNonRequired(o.value);return u&&!p?1:!u&&p?-1:0}):t.sort((a,o)=>{let u=a.value.isOptional(),p=o.value.isOptional();return u&&!p?1:!u&&p?-1:0})}isCollection(t){let r=t.internalType.type;return r==="list"||r==="set"||r==="map"}isNonRequired(t){return t.isOptional()||this.isCollection(t)}writeClass({writer:t,class_:r}){let a=ul({parameters:r.parameters});t.writeNode(d.instantiateClass({classReference:r.reference,arguments_:a.map(o=>o.value)}))}writeDate({writer:t,date:r}){t.writeNode(d.invokeMethod({on:il,method:"parse",arguments_:[n.string(r.value)]}))}writeDateTime({writer:t,dateTime:r}){t.writeNode(d.invokeMethod({on:sl,method:"parse",arguments_:[n.string(r.value)]}))}writeEnum({writer:t,enum_:r}){t.writeNode(r.classReference),t.write("."+r.value)}writeList({writer:t,list:r}){this.writeIterable({writer:t,iterable:r})}writeMap({writer:t,map:r}){let a=cl({entries:r.entries});if(a.length===0){t.write("new "),t.writeNode(tr),t.write("<"),t.writeNode(r.keyType),t.write(", "),t.writeNode(r.valueType),t.write(">()");return}t.write("new "),t.writeNode(tr),t.write("<"),t.writeNode(r.keyType),t.write(", "),t.writeNode(r.valueType),t.writeLine(">() {{"),t.indent();for(let o of a)t.write("put("),t.writeNode(o.key),t.write(", "),t.writeNode(o.value),t.writeLine(");");t.dedent(),t.write("}}")}writeOptional({writer:t,optional:r}){if(!r.useOf){t.writeNode(r.value);return}t.writeNode(d.invokeMethod({on:Xt,method:"of",arguments_:[r.value]}))}writeSet({writer:t,set:r}){this.writeIterable({writer:t,iterable:r})}writeIterable({writer:t,iterable:r}){let a=r.type==="list"?Ir:al,o=pl({values:r.values});if(r.type==="list"&&r.isParameter&&o.length>0){t.writeNode(d.invokeMethod({on:er,method:"asList",arguments_:o}));return}if(o.length===0){t.write(`new ${a.name}<`),t.writeNode(r.valueType),t.write(">()");return}t.write("new "),t.writeNode(a),t.write("<"),t.writeNode(r.valueType),t.writeLine(">("),t.indent(),t.writeNode(d.invokeMethod({on:er,method:"asList",arguments_:o})),t.writeNewLineIfLastLineNot(),t.dedent(),t.write(")")}writeUnknown({writer:t,value:r}){switch(typeof r){case"boolean":t.write(r.toString());return;case"string":t.write(`"${this.escapeString(r)}"`);return;case"number":t.write(r.toString());return;case"object":if(r==null){t.write("null");return}if(Array.isArray(r)){this.writeUnknownArray({writer:t,value:r});return}this.writeUnknownMap({writer:t,value:r});return;default:throw new Error(`Internal error; unsupported unknown type: ${typeof r}`)}}writeUnknownArray({writer:t,value:r}){if(r.length===0){t.write("new "),t.writeNode(Ir),t.write("<Object>()");return}t.write("new "),t.writeNode(Ir),t.write("<Object>("),t.writeNode(d.invokeMethod({on:er,method:"asList",arguments_:r.map(a=>n.unknown(a))})),t.write(")")}writeUnknownMap({writer:t,value:r}){let a=Object.entries(r);if(a.length===0){t.write("new "),t.writeNode(tr),t.write("<String, Object>()");return}t.writeLine("new "),t.writeNode(tr),t.write("<String, Object>() {{"),t.indent();for(let[o,u]of a)t.write(`put("${o}", `),t.writeNode(n.unknown(u)),t.writeLine(");");t.dedent(),t.write("}}")}writeUUID({writer:t,uuid:r}){t.writeNode(d.invokeMethod({on:ol,method:"fromString",arguments_:[n.string(r.value)]}))}escapeString(t){return t.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t")}static isAlreadyOptional(t){return t.internalType.type==="optional"}},Ir=new V({name:"ArrayList",packageName:"java.util"}),nl=new V({name:"BigInteger",packageName:"java.math"}),tr=new V({name:"HashMap",packageName:"java.util"}),al=new V({name:"HashSet",packageName:"java.util"}),gg=new V({name:"List",packageName:"java.util"}),il=new V({name:"LocalDate",packageName:"java.time"}),xg=new V({name:"Map",packageName:"java.util"}),sl=new V({name:"OffsetDateTime",packageName:"java.time"}),vg=new V({name:"Set",packageName:"java.util"}),ol=new V({name:"UUID",packageName:"java.util"});function ul({parameters:n}){return n.filter(e=>!ue.isNop(e.value))}function ll({parameters:n}){return n.filter(e=>!ue.isNop(e.value))}function cl({entries:n}){return n.filter(e=>!ue.isNop(e.key)&&!ue.isNop(e.value))}function pl({values:n}){return n.filter(e=>!ue.isNop(e))}function rr({writer:n,arguments_:e}){let t=fl(e);if(t.length===0){n.write("()");return}if(t.some(a=>a instanceof ue&&!a.shouldWriteInLine())){dl({writer:n,arguments_:t});return}n.write("("),t.forEach((a,o)=>{o>0&&n.write(", "),Ri({writer:n,argument:a})}),n.write(")")}function dl({writer:n,arguments_:e}){n.writeLine("("),n.indent(),e.forEach((t,r)=>{r>0&&n.writeLine(","),Ri({writer:n,argument:t})}),n.dedent(),e.length>0&&n.newLine(),n.write(")")}function Ri({writer:n,argument:e}){br(e)?n.writeNodeOrString(e.assignment):e.write(n)}function fl(n){return n.filter(e=>!(e instanceof ue&&ue.isNop(e)))}var at=class extends Z{constructor({classReference:t,arguments_:r}){super();_(this,"classReference");_(this,"arguments_");this.classReference=t,this.arguments_=r}write(t){t.writeNode(this.classReference),rr({writer:t,arguments_:this.arguments_})}};m();y();h();var it=class extends Z{constructor(t){super();_(this,"arg");this.arg=t}write(t){return new me(this.arg).write(t)}};m();y();h();var st=class extends Z{constructor({name:t,access:r,parameters:a,body:o,static_:u,return_:p}){super();_(this,"name");_(this,"access");_(this,"parameters");_(this,"body");_(this,"return_");_(this,"static_");this.name=t,this.access=r,this.parameters=a,this.body=o,this.return_=p,this.static_=u??!1}write(t){if(t.write(`${this.access} `),this.static_&&t.write("static "),this.return_!=null?t.writeNode(this.return_):t.write("void"),t.write(` ${this.name}`),this.parameters.length===0)t.write("()");else if(this.parameters.length===1){if(t.write("("),this.parameters[0]==null)throw new Error("Cannot render parameter "+this.parameters[0]);t.writeNode(this.parameters[0]),t.write(")")}else t.writeLine("("),t.indent(),this.parameters.forEach((r,a)=>{a>0&&t.writeLine(", "),t.writeNode(r)}),t.dedent(),t.write(")");if(this.body==null){t.write(";");return}t.writeLine(" {"),t.indent(),t.writeNode(this.body),t.writeNewLineIfLastLineNot(),t.dedent(),t.write("}")}};m();y();h();var ot=class extends Z{constructor({method:t,arguments_:r,on:a}){super();_(this,"on");_(this,"method");_(this,"arguments_");this.on=a,this.method=t,this.arguments_=r}write(t){this.on.write(t),t.write("."),t.write(this.method),rr({writer:t,arguments_:this.arguments_})}};m();y();h();var ut=class extends Z{constructor({name:t,type:r}){super();_(this,"name");_(this,"type");this.name=t,this.type=r}write(t){t.writeNode(this.type),t.write(` ${this.name}`)}};function ml(n){return new it(n)}function hl(n){return new nt(n)}function yl(n){return new V(n)}function gl(n){return new at(n)}function xl(n){return new ot(n)}function vl(n){return new st(n)}function wl(n){return new ut(n)}m();y();h();var nr=class{constructor({context:e}){_(this,"context");this.context=e}isNopTypeLiteral(e){return e.internalType?.type==="nop"}usesOptionalNullable(){return this.context.customConfig?.["collapse-optional-nullable"]===!0}wrapInOptionalIfNotNop(e,t=!1){return this.isNopTypeLiteral(e)?e:this.usesOptionalNullable()?this.context.getOptionalNullableOf(e):d.TypeLiteral.optional({value:e,useOf:t})}convert(e){if(e.value===null)return this.context.isNullable(e.typeReference)?this.context.getNullableOfNull():(this.context.errors.add({severity:$.Critical,message:"Expected non-null value, but got null"}),d.TypeLiteral.nop());if(e.value===void 0)return d.TypeLiteral.nop();switch(e.typeReference.type){case"list":return this.convertList({list:e.typeReference.value,value:e.value,as:e.as});case"literal":return this.convertLiteral({literal:e.typeReference.value,value:e.value});case"map":return this.convertMap({map:e.typeReference,value:e.value,as:e.as});case"named":{let t=this.context.resolveNamedType({typeId:e.typeReference.value});return t==null?d.TypeLiteral.nop():this.convertNamed({named:t,value:e.value,as:e.as,inUndiscriminatedUnion:e.inUndiscriminatedUnion})}case"nullable":case"optional":{if(e.value===void 0||typeof e.value=="object"&&e.value!==null&&Object.keys(e.value).length===0&&e.typeReference.value.type==="named")return this.usesOptionalNullable()?this.context.getOptionalNullableAbsent():d.TypeLiteral.reference(d.invokeMethod({on:d.classReference({name:"Optional",packageName:"java.util"}),method:"empty",arguments_:[]}));if(e.typeReference.value.type==="list"){let a=this.convertList({list:e.typeReference.value.value,value:e.value});return this.wrapInOptionalIfNotNop(a,!0)}if(this.usesOptionalNullable()&&(e.typeReference.value.type==="optional"||e.typeReference.value.type==="nullable"))return this.convert({typeReference:e.typeReference.value,value:e.value,as:e.as,inUndiscriminatedUnion:e.inUndiscriminatedUnion});let t=this.convert({typeReference:e.typeReference.value,value:e.value,as:e.as,inUndiscriminatedUnion:e.inUndiscriminatedUnion}),r=e.as==="mapValue"||e.inUndiscriminatedUnion===!0;return this.wrapInOptionalIfNotNop(t,r)}case"primitive":return this.convertPrimitive({primitive:e.typeReference.value,value:e.value,as:e.as});case"set":return this.convertSet({set:e.typeReference.value,value:e.value,as:e.as});case"unknown":return this.convertUnknown({value:e.value});default:M(e.typeReference)}}convertList({list:e,value:t,as:r}){if(!Array.isArray(t))return this.context.errors.add({severity:$.Critical,message:`Expected array but got: ${typeof t}`}),d.TypeLiteral.nop();let a=e.type==="optional"||e.type==="nullable";return d.TypeLiteral.list({valueType:this.context.dynamicTypeMapper.convert({typeReference:e}),values:t.map((o,u)=>{this.context.errors.scope({index:u});try{if(a){let p=this.convert({typeReference:e.value,value:o,as:r});return this.wrapInOptionalIfNotNop(p,!0)}return this.convert({typeReference:e,value:o,as:r})}finally{this.context.errors.unscope()}}),isParameter:!0})}convertLiteral({literal:e,value:t}){switch(e.type){case"boolean":{let r=this.context.getValueAsBoolean({value:t});return r==null?d.TypeLiteral.nop():d.TypeLiteral.boolean(r)}case"string":{let r=this.context.getValueAsString({value:t});return r==null?d.TypeLiteral.nop():d.TypeLiteral.string(r)}default:M(e)}}convertSet({set:e,value:t,as:r}){return Array.isArray(t)?d.TypeLiteral.set({valueType:this.context.dynamicTypeMapper.convert({typeReference:e}),values:t.map((a,o)=>{this.context.errors.scope({index:o});try{return this.convert({typeReference:e,value:a,as:r})}finally{this.context.errors.unscope()}})}):(this.context.errors.add({severity:$.Critical,message:`Expected array but got: ${typeof t}`}),d.TypeLiteral.nop())}convertMap({map:e,value:t,as:r}){return typeof t!="object"||t==null?(this.context.errors.add({severity:$.Critical,message:`Expected object but got: ${t==null?"null":typeof t}`}),d.TypeLiteral.nop()):d.TypeLiteral.map({keyType:this.context.dynamicTypeMapper.convert({typeReference:e.key}),valueType:this.context.dynamicTypeMapper.convert({typeReference:e.value}),entries:Object.entries(t).map(([a,o])=>{this.context.errors.scope(a);try{return{key:this.convert({typeReference:e.key,value:a,as:"mapKey"}),value:this.convert({typeReference:e.value,value:o,as:"mapValue"})}}finally{this.context.errors.unscope()}})})}convertNamed({named:e,value:t,as:r,inUndiscriminatedUnion:a}){switch(e.type){case"alias":return this.convert({typeReference:e.typeReference,value:t,as:r,inUndiscriminatedUnion:a});case"discriminatedUnion":return this.convertDiscriminatedUnion({discriminatedUnion:e,value:t});case"enum":return this.convertEnum({enum_:e,value:t});case"object":return this.convertObject({object_:e,value:t,as:r});case"undiscriminatedUnion":return this.convertUndiscriminatedUnion({undiscriminatedUnion:e,value:t});default:M(e)}}convertDiscriminatedUnion({discriminatedUnion:e,value:t}){let r=this.context.getJavaClassReferenceFromDeclaration({declaration:e.declaration}),a=this.context.resolveDiscriminatedUnionTypeInstance({discriminatedUnion:e,value:t});if(a==null)return d.TypeLiteral.nop();let o=a.singleDiscriminatedUnionType;switch(o.type){case"samePropertiesAsObject":{let u=this.context.resolveNamedType({typeId:o.typeId});return u==null?d.TypeLiteral.nop():d.TypeLiteral.reference(d.invokeMethod({on:r,method:this.context.getPropertyName(o.discriminantValue.name),arguments_:[this.convertNamed({named:u,value:a.value})]}))}case"singleProperty":{let u=this.context.getRecord(a.value);if(u==null)return d.TypeLiteral.nop();try{return this.context.errors.scope(o.discriminantValue.wireValue),d.TypeLiteral.reference(d.invokeMethod({on:r,method:this.context.getPropertyName(o.discriminantValue.name),arguments_:[this.convert({typeReference:o.typeReference,value:u["value"]})]}))}finally{this.context.errors.unscope()}}case"noProperties":return d.TypeLiteral.reference(d.invokeMethod({on:r,method:this.context.getPropertyName(o.discriminantValue.name),arguments_:[]}));default:M(o)}}convertObject({object_:e,value:t,as:r}){let a=this.context.associateByWireValue({parameters:e.properties,values:this.context.getRecord(t)??{}}),o=r==="request"?a.filter(u=>!this.context.isDirectLiteral(u.typeReference)):a;return d.TypeLiteral.builder({classReference:this.context.getJavaClassReferenceFromDeclaration({declaration:e.declaration}),parameters:o.map(u=>{this.context.errors.scope(u.name.wireValue);try{return{name:this.context.getMethodName(u.name.name),value:this.convert({typeReference:u.typeReference,value:u.value,as:r})}}finally{this.context.errors.unscope()}})})}convertEnum({enum_:e,value:t}){let r=this.getEnumValueName({enum_:e,value:t});return r==null?d.TypeLiteral.nop():d.TypeLiteral.enum_({classReference:this.context.getJavaClassReferenceFromDeclaration({declaration:e.declaration}),value:r})}getEnumValueName({enum_:e,value:t}){if(typeof t!="string"){this.context.errors.add({severity:$.Critical,message:`Expected enum value string, got: ${typeof t}`});return}let r=e.values.find(a=>a.wireValue===t);if(r==null){this.context.errors.add({severity:$.Critical,message:`An enum value named "${t}" does not exist in this context`});return}return this.context.getEnumName(r.name)}convertUndiscriminatedUnion({undiscriminatedUnion:e,value:t}){let r=this.findMatchingUndiscriminatedUnionType({undiscriminatedUnion:e,value:t});return r==null?d.TypeLiteral.nop():this.context.isPrimitive(r.valueTypeReference)?d.TypeLiteral.reference(d.invokeMethod({on:this.context.getJavaClassReferenceFromDeclaration({declaration:e.declaration}),method:"of",arguments_:[r.typeInstantiation]})):d.TypeLiteral.reference(d.invokeMethod({on:this.context.getJavaClassReferenceFromDeclaration({declaration:e.declaration}),method:"of",arguments_:[r.typeInstantiation]}))}findMatchingUndiscriminatedUnionType({undiscriminatedUnion:e,value:t}){let r=[],a=[];for(let p of e.types)try{r.push(JSON.stringify(p));let x=this.convert({typeReference:p,value:t,inUndiscriminatedUnion:!0});return{valueTypeReference:p,typeInstantiation:x}}catch(x){a.push(`Type ${JSON.stringify(p)}: ${x instanceof Error?x.message:String(x)}`);continue}this.context.errors.add({severity:$.Critical,message:`None of the types in the undiscriminated union matched the given "${typeof t}" value. Tried ${r.length} variants. Errors: ${a.join("; ")}`});let o=e.declaration.name??"UnknownUnion",u=a.map((p,x)=>` ${x+1}. ${p}`).join(`
23
23
  `);throw new Error(`Failed to match undiscriminated union "${o}" for ${typeof t} value.
24
24
  Value: ${JSON.stringify(t)}
25
25
  Attempted ${r.length} variants: