@smithery/cli 1.1.68 → 1.1.69
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 +2 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -80,7 +80,7 @@ Calls to async() callback can have unexpected results.`),h=!0,function(C,S){C?c(
|
|
|
80
80
|
`+Object.keys(n).map(i=>`${i}: ${n[i]}`).join(`\r
|
|
81
81
|
`)+`\r
|
|
82
82
|
\r
|
|
83
|
-
`+r)}function js(e,t,r,n,i){if(e.listenerCount("wsClientError")){let a=new Error(i);Error.captureStackTrace(a,js),e.emit("wsClientError",a,r,t)}else xp(r,n,i)}});var w4=oe(Ge());var no=["claude","cline","windsurf","roo-cline","witsy","enconvo","cursor","vscode","vscode-insiders"];var i8="https://smithery.ai/api/track";var ye;(function(e){e.assertEqual=i=>i;function t(i){}e.assertIs=t;function r(i){throw new Error}e.assertNever=r,e.arrayToEnum=i=>{let a={};for(let u of i)a[u]=u;return a},e.getValidEnumValues=i=>{let a=e.objectKeys(i).filter(p=>typeof i[i[p]]!="number"),u={};for(let p of a)u[p]=i[p];return e.objectValues(u)},e.objectValues=i=>e.objectKeys(i).map(function(a){return i[a]}),e.objectKeys=typeof Object.keys=="function"?i=>Object.keys(i):i=>{let a=[];for(let u in i)Object.prototype.hasOwnProperty.call(i,u)&&a.push(u);return a},e.find=(i,a)=>{for(let u of i)if(a(u))return u},e.isInteger=typeof Number.isInteger=="function"?i=>Number.isInteger(i):i=>typeof i=="number"&&isFinite(i)&&Math.floor(i)===i;function n(i,a=" | "){return i.map(u=>typeof u=="string"?`'${u}'`:u).join(a)}e.joinValues=n,e.jsonStringifyReplacer=(i,a)=>typeof a=="bigint"?a.toString():a})(ye||(ye={}));var s8;(function(e){e.mergeShapes=(t,r)=>({...t,...r})})(s8||(s8={}));var W=ye.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Ln=e=>{switch(typeof e){case"undefined":return W.undefined;case"string":return W.string;case"number":return isNaN(e)?W.nan:W.number;case"boolean":return W.boolean;case"function":return W.function;case"bigint":return W.bigint;case"symbol":return W.symbol;case"object":return Array.isArray(e)?W.array:e===null?W.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?W.promise:typeof Map<"u"&&e instanceof Map?W.map:typeof Set<"u"&&e instanceof Set?W.set:typeof Date<"u"&&e instanceof Date?W.date:W.object;default:return W.unknown}},M=ye.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"]),oK=e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:"),Zt=class e extends Error{get errors(){return this.issues}constructor(t){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};let r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=t}format(t){let r=t||function(a){return a.message},n={_errors:[]},i=a=>{for(let u of a.issues)if(u.code==="invalid_union")u.unionErrors.map(i);else if(u.code==="invalid_return_type")i(u.returnTypeError);else if(u.code==="invalid_arguments")i(u.argumentsError);else if(u.path.length===0)n._errors.push(r(u));else{let p=n,l=0;for(;l<u.path.length;){let c=u.path[l];l===u.path.length-1?(p[c]=p[c]||{_errors:[]},p[c]._errors.push(r(u))):p[c]=p[c]||{_errors:[]},p=p[c],l++}}};return i(this),n}static assert(t){if(!(t instanceof e))throw new Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,ye.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(t=r=>r.message){let r={},n=[];for(let i of this.issues)i.path.length>0?(r[i.path[0]]=r[i.path[0]]||[],r[i.path[0]].push(t(i))):n.push(t(i));return{formErrors:n,fieldErrors:r}}get formErrors(){return this.flatten()}};Zt.create=e=>new Zt(e);var so=(e,t)=>{let r;switch(e.code){case M.invalid_type:e.received===W.undefined?r="Required":r=`Expected ${e.expected}, received ${e.received}`;break;case M.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(e.expected,ye.jsonStringifyReplacer)}`;break;case M.unrecognized_keys:r=`Unrecognized key(s) in object: ${ye.joinValues(e.keys,", ")}`;break;case M.invalid_union:r="Invalid input";break;case M.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${ye.joinValues(e.options)}`;break;case M.invalid_enum_value:r=`Invalid enum value. Expected ${ye.joinValues(e.options)}, received '${e.received}'`;break;case M.invalid_arguments:r="Invalid function arguments";break;case M.invalid_return_type:r="Invalid function return type";break;case M.invalid_date:r="Invalid date";break;case M.invalid_string:typeof e.validation=="object"?"includes"in e.validation?(r=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position=="number"&&(r=`${r} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?r=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?r=`Invalid input: must end with "${e.validation.endsWith}"`:ye.assertNever(e.validation):e.validation!=="regex"?r=`Invalid ${e.validation}`:r="Invalid";break;case M.too_small:e.type==="array"?r=`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:e.type==="string"?r=`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:e.type==="number"?r=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="date"?r=`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:r="Invalid input";break;case M.too_big:e.type==="array"?r=`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:e.type==="string"?r=`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:e.type==="number"?r=`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="bigint"?r=`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="date"?r=`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:r="Invalid input";break;case M.custom:r="Invalid input";break;case M.invalid_intersection_types:r="Intersection results could not be merged";break;case M.not_multiple_of:r=`Number must be a multiple of ${e.multipleOf}`;break;case M.not_finite:r="Number must be finite";break;default:r=t.defaultError,ye.assertNever(e)}return{message:r}},Vb=so;function uK(e){Vb=e}function xd(){return Vb}var gd=e=>{let{data:t,path:r,errorMaps:n,issueData:i}=e,a=[...r,...i.path||[]],u={...i,path:a};if(i.message!==void 0)return{...i,path:a,message:i.message};let p="",l=n.filter(c=>!!c).slice().reverse();for(let c of l)p=c(u,{data:t,defaultError:p}).message;return{...i,path:a,message:p}},pK=[];function V(e,t){let r=xd(),n=gd({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,r,r===so?void 0:so].filter(i=>!!i)});e.common.issues.push(n)}var At=class e{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(t,r){let n=[];for(let i of r){if(i.status==="aborted")return ne;i.status==="dirty"&&t.dirty(),n.push(i.value)}return{status:t.value,value:n}}static async mergeObjectAsync(t,r){let n=[];for(let i of r){let a=await i.key,u=await i.value;n.push({key:a,value:u})}return e.mergeObjectSync(t,n)}static mergeObjectSync(t,r){let n={};for(let i of r){let{key:a,value:u}=i;if(a.status==="aborted"||u.status==="aborted")return ne;a.status==="dirty"&&t.dirty(),u.status==="dirty"&&t.dirty(),a.value!=="__proto__"&&(typeof u.value<"u"||i.alwaysSet)&&(n[a.value]=u.value)}return{status:t.value,value:n}}},ne=Object.freeze({status:"aborted"}),ao=e=>({status:"dirty",value:e}),Pt=e=>({status:"valid",value:e}),o8=e=>e.status==="aborted",u8=e=>e.status==="dirty",Ba=e=>e.status==="valid",I0=e=>typeof Promise<"u"&&e instanceof Promise;function _d(e,t,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof t=="function"?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(e):n?n.value:t.get(e)}function Ub(e,t,r,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof t=="function"?e!==t||!i:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(e,r):i?i.value=r:t.set(e,r),r}var Y;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t?.message})(Y||(Y={}));var N0,R0,fr=class{constructor(t,r,n,i){this._cachedPath=[],this.parent=t,this.data=r,this._path=n,this._key=i}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},kb=(e,t)=>{if(Ba(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let r=new Zt(e.common.issues);return this._error=r,this._error}}};function pe(e){if(!e)return{};let{errorMap:t,invalid_type_error:r,required_error:n,description:i}=e;if(t&&(r||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:i}:{errorMap:(u,p)=>{var l,c;let{message:h}=e;return u.code==="invalid_enum_value"?{message:h??p.defaultError}:typeof p.data>"u"?{message:(l=h??n)!==null&&l!==void 0?l:p.defaultError}:u.code!=="invalid_type"?{message:p.defaultError}:{message:(c=h??r)!==null&&c!==void 0?c:p.defaultError}},description:i}}var de=class{get description(){return this._def.description}_getType(t){return Ln(t.data)}_getOrReturnCtx(t,r){return r||{common:t.parent.common,data:t.data,parsedType:Ln(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new At,ctx:{common:t.parent.common,data:t.data,parsedType:Ln(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){let r=this._parse(t);if(I0(r))throw new Error("Synchronous parse encountered promise.");return r}_parseAsync(t){let r=this._parse(t);return Promise.resolve(r)}parse(t,r){let n=this.safeParse(t,r);if(n.success)return n.data;throw n.error}safeParse(t,r){var n;let i={common:{issues:[],async:(n=r?.async)!==null&&n!==void 0?n:!1,contextualErrorMap:r?.errorMap},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Ln(t)},a=this._parseSync({data:t,path:i.path,parent:i});return kb(i,a)}"~validate"(t){var r,n;let i={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Ln(t)};if(!this["~standard"].async)try{let a=this._parseSync({data:t,path:[],parent:i});return Ba(a)?{value:a.value}:{issues:i.common.issues}}catch(a){!((n=(r=a?.message)===null||r===void 0?void 0:r.toLowerCase())===null||n===void 0)&&n.includes("encountered")&&(this["~standard"].async=!0),i.common={issues:[],async:!0}}return this._parseAsync({data:t,path:[],parent:i}).then(a=>Ba(a)?{value:a.value}:{issues:i.common.issues})}async parseAsync(t,r){let n=await this.safeParseAsync(t,r);if(n.success)return n.data;throw n.error}async safeParseAsync(t,r){let n={common:{issues:[],contextualErrorMap:r?.errorMap,async:!0},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Ln(t)},i=this._parse({data:t,path:n.path,parent:n}),a=await(I0(i)?i:Promise.resolve(i));return kb(n,a)}refine(t,r){let n=i=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(i):r;return this._refinement((i,a)=>{let u=t(i),p=()=>a.addIssue({code:M.custom,...n(i)});return typeof Promise<"u"&&u instanceof Promise?u.then(l=>l?!0:(p(),!1)):u?!0:(p(),!1)})}refinement(t,r){return this._refinement((n,i)=>t(n)?!0:(i.addIssue(typeof r=="function"?r(n,i):r),!1))}_refinement(t){return new Jt({schema:this,typeName:re.ZodEffects,effect:{type:"refinement",refinement:t}})}superRefine(t){return this._refinement(t)}constructor(t){this.spa=this.safeParseAsync,this._def=t,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:r=>this["~validate"](r)}}optional(){return cr.create(this,this._def)}nullable(){return an.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Un.create(this)}promise(){return Ti.create(this,this._def)}or(t){return Ma.create([this,t],this._def)}and(t){return La.create(this,t,this._def)}transform(t){return new Jt({...pe(this._def),schema:this,typeName:re.ZodEffects,effect:{type:"transform",transform:t}})}default(t){let r=typeof t=="function"?t:()=>t;return new Ga({...pe(this._def),innerType:this,defaultValue:r,typeName:re.ZodDefault})}brand(){return new j0({typeName:re.ZodBranded,type:this,...pe(this._def)})}catch(t){let r=typeof t=="function"?t:()=>t;return new za({...pe(this._def),innerType:this,catchValue:r,typeName:re.ZodCatch})}describe(t){let r=this.constructor;return new r({...this._def,description:t})}pipe(t){return k0.create(this,t)}readonly(){return Ha.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},dK=/^c[^\s-]{8,}$/i,lK=/^[0-9a-z]+$/,cK=/^[0-9A-HJKMNP-TV-Z]{26}$/i,fK=/^[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,mK=/^[a-z0-9_-]{21}$/i,hK=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,vK=/^[-+]?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)?)??$/,xK=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,gK="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",a8,_K=/^(?:(?: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])$/,bK=/^(?:(?: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])$/,DK=/^(([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]))$/,yK=/^(([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])$/,EK=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,wK=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Wb="((\\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])))",FK=new RegExp(`^${Wb}$`);function $b(e){let t="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return e.precision?t=`${t}\\.\\d{${e.precision}}`:e.precision==null&&(t=`${t}(\\.\\d+)?`),t}function CK(e){return new RegExp(`^${$b(e)}$`)}function Gb(e){let t=`${Wb}T${$b(e)}`,r=[];return r.push(e.local?"Z?":"Z"),e.offset&&r.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${r.join("|")})`,new RegExp(`^${t}$`)}function SK(e,t){return!!((t==="v4"||!t)&&_K.test(e)||(t==="v6"||!t)&&DK.test(e))}function AK(e,t){if(!hK.test(e))return!1;try{let[r]=e.split("."),n=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),i=JSON.parse(atob(n));return!(typeof i!="object"||i===null||!i.typ||!i.alg||t&&i.alg!==t)}catch{return!1}}function OK(e,t){return!!((t==="v4"||!t)&&bK.test(e)||(t==="v6"||!t)&&yK.test(e))}var Ai=class e extends de{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==W.string){let a=this._getOrReturnCtx(t);return V(a,{code:M.invalid_type,expected:W.string,received:a.parsedType}),ne}let n=new At,i;for(let a of this._def.checks)if(a.kind==="min")t.data.length<a.value&&(i=this._getOrReturnCtx(t,i),V(i,{code:M.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),n.dirty());else if(a.kind==="max")t.data.length>a.value&&(i=this._getOrReturnCtx(t,i),V(i,{code:M.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),n.dirty());else if(a.kind==="length"){let u=t.data.length>a.value,p=t.data.length<a.value;(u||p)&&(i=this._getOrReturnCtx(t,i),u?V(i,{code:M.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}):p&&V(i,{code:M.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}),n.dirty())}else if(a.kind==="email")xK.test(t.data)||(i=this._getOrReturnCtx(t,i),V(i,{validation:"email",code:M.invalid_string,message:a.message}),n.dirty());else if(a.kind==="emoji")a8||(a8=new RegExp(gK,"u")),a8.test(t.data)||(i=this._getOrReturnCtx(t,i),V(i,{validation:"emoji",code:M.invalid_string,message:a.message}),n.dirty());else if(a.kind==="uuid")fK.test(t.data)||(i=this._getOrReturnCtx(t,i),V(i,{validation:"uuid",code:M.invalid_string,message:a.message}),n.dirty());else if(a.kind==="nanoid")mK.test(t.data)||(i=this._getOrReturnCtx(t,i),V(i,{validation:"nanoid",code:M.invalid_string,message:a.message}),n.dirty());else if(a.kind==="cuid")dK.test(t.data)||(i=this._getOrReturnCtx(t,i),V(i,{validation:"cuid",code:M.invalid_string,message:a.message}),n.dirty());else if(a.kind==="cuid2")lK.test(t.data)||(i=this._getOrReturnCtx(t,i),V(i,{validation:"cuid2",code:M.invalid_string,message:a.message}),n.dirty());else if(a.kind==="ulid")cK.test(t.data)||(i=this._getOrReturnCtx(t,i),V(i,{validation:"ulid",code:M.invalid_string,message:a.message}),n.dirty());else if(a.kind==="url")try{new URL(t.data)}catch{i=this._getOrReturnCtx(t,i),V(i,{validation:"url",code:M.invalid_string,message:a.message}),n.dirty()}else a.kind==="regex"?(a.regex.lastIndex=0,a.regex.test(t.data)||(i=this._getOrReturnCtx(t,i),V(i,{validation:"regex",code:M.invalid_string,message:a.message}),n.dirty())):a.kind==="trim"?t.data=t.data.trim():a.kind==="includes"?t.data.includes(a.value,a.position)||(i=this._getOrReturnCtx(t,i),V(i,{code:M.invalid_string,validation:{includes:a.value,position:a.position},message:a.message}),n.dirty()):a.kind==="toLowerCase"?t.data=t.data.toLowerCase():a.kind==="toUpperCase"?t.data=t.data.toUpperCase():a.kind==="startsWith"?t.data.startsWith(a.value)||(i=this._getOrReturnCtx(t,i),V(i,{code:M.invalid_string,validation:{startsWith:a.value},message:a.message}),n.dirty()):a.kind==="endsWith"?t.data.endsWith(a.value)||(i=this._getOrReturnCtx(t,i),V(i,{code:M.invalid_string,validation:{endsWith:a.value},message:a.message}),n.dirty()):a.kind==="datetime"?Gb(a).test(t.data)||(i=this._getOrReturnCtx(t,i),V(i,{code:M.invalid_string,validation:"datetime",message:a.message}),n.dirty()):a.kind==="date"?FK.test(t.data)||(i=this._getOrReturnCtx(t,i),V(i,{code:M.invalid_string,validation:"date",message:a.message}),n.dirty()):a.kind==="time"?CK(a).test(t.data)||(i=this._getOrReturnCtx(t,i),V(i,{code:M.invalid_string,validation:"time",message:a.message}),n.dirty()):a.kind==="duration"?vK.test(t.data)||(i=this._getOrReturnCtx(t,i),V(i,{validation:"duration",code:M.invalid_string,message:a.message}),n.dirty()):a.kind==="ip"?SK(t.data,a.version)||(i=this._getOrReturnCtx(t,i),V(i,{validation:"ip",code:M.invalid_string,message:a.message}),n.dirty()):a.kind==="jwt"?AK(t.data,a.alg)||(i=this._getOrReturnCtx(t,i),V(i,{validation:"jwt",code:M.invalid_string,message:a.message}),n.dirty()):a.kind==="cidr"?OK(t.data,a.version)||(i=this._getOrReturnCtx(t,i),V(i,{validation:"cidr",code:M.invalid_string,message:a.message}),n.dirty()):a.kind==="base64"?EK.test(t.data)||(i=this._getOrReturnCtx(t,i),V(i,{validation:"base64",code:M.invalid_string,message:a.message}),n.dirty()):a.kind==="base64url"?wK.test(t.data)||(i=this._getOrReturnCtx(t,i),V(i,{validation:"base64url",code:M.invalid_string,message:a.message}),n.dirty()):ye.assertNever(a);return{status:n.value,value:t.data}}_regex(t,r,n){return this.refinement(i=>t.test(i),{validation:r,code:M.invalid_string,...Y.errToObj(n)})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...Y.errToObj(t)})}url(t){return this._addCheck({kind:"url",...Y.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...Y.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...Y.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...Y.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...Y.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...Y.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...Y.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",...Y.errToObj(t)})}base64url(t){return this._addCheck({kind:"base64url",...Y.errToObj(t)})}jwt(t){return this._addCheck({kind:"jwt",...Y.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...Y.errToObj(t)})}cidr(t){return this._addCheck({kind:"cidr",...Y.errToObj(t)})}datetime(t){var r,n;return typeof t=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:t}):this._addCheck({kind:"datetime",precision:typeof t?.precision>"u"?null:t?.precision,offset:(r=t?.offset)!==null&&r!==void 0?r:!1,local:(n=t?.local)!==null&&n!==void 0?n:!1,...Y.errToObj(t?.message)})}date(t){return this._addCheck({kind:"date",message:t})}time(t){return typeof t=="string"?this._addCheck({kind:"time",precision:null,message:t}):this._addCheck({kind:"time",precision:typeof t?.precision>"u"?null:t?.precision,...Y.errToObj(t?.message)})}duration(t){return this._addCheck({kind:"duration",...Y.errToObj(t)})}regex(t,r){return this._addCheck({kind:"regex",regex:t,...Y.errToObj(r)})}includes(t,r){return this._addCheck({kind:"includes",value:t,position:r?.position,...Y.errToObj(r?.message)})}startsWith(t,r){return this._addCheck({kind:"startsWith",value:t,...Y.errToObj(r)})}endsWith(t,r){return this._addCheck({kind:"endsWith",value:t,...Y.errToObj(r)})}min(t,r){return this._addCheck({kind:"min",value:t,...Y.errToObj(r)})}max(t,r){return this._addCheck({kind:"max",value:t,...Y.errToObj(r)})}length(t,r){return this._addCheck({kind:"length",value:t,...Y.errToObj(r)})}nonempty(t){return this.min(1,Y.errToObj(t))}trim(){return new e({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new e({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new e({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(t=>t.kind==="datetime")}get isDate(){return!!this._def.checks.find(t=>t.kind==="date")}get isTime(){return!!this._def.checks.find(t=>t.kind==="time")}get isDuration(){return!!this._def.checks.find(t=>t.kind==="duration")}get isEmail(){return!!this._def.checks.find(t=>t.kind==="email")}get isURL(){return!!this._def.checks.find(t=>t.kind==="url")}get isEmoji(){return!!this._def.checks.find(t=>t.kind==="emoji")}get isUUID(){return!!this._def.checks.find(t=>t.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(t=>t.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(t=>t.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(t=>t.kind==="cuid2")}get isULID(){return!!this._def.checks.find(t=>t.kind==="ulid")}get isIP(){return!!this._def.checks.find(t=>t.kind==="ip")}get isCIDR(){return!!this._def.checks.find(t=>t.kind==="cidr")}get isBase64(){return!!this._def.checks.find(t=>t.kind==="base64")}get isBase64url(){return!!this._def.checks.find(t=>t.kind==="base64url")}get minLength(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxLength(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t}};Ai.create=e=>{var t;return new Ai({checks:[],typeName:re.ZodString,coerce:(t=e?.coerce)!==null&&t!==void 0?t:!1,...pe(e)})};function TK(e,t){let r=(e.toString().split(".")[1]||"").length,n=(t.toString().split(".")[1]||"").length,i=r>n?r:n,a=parseInt(e.toFixed(i).replace(".","")),u=parseInt(t.toFixed(i).replace(".",""));return a%u/Math.pow(10,i)}var Pa=class e extends de{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(t){if(this._def.coerce&&(t.data=Number(t.data)),this._getType(t)!==W.number){let a=this._getOrReturnCtx(t);return V(a,{code:M.invalid_type,expected:W.number,received:a.parsedType}),ne}let n,i=new At;for(let a of this._def.checks)a.kind==="int"?ye.isInteger(t.data)||(n=this._getOrReturnCtx(t,n),V(n,{code:M.invalid_type,expected:"integer",received:"float",message:a.message}),i.dirty()):a.kind==="min"?(a.inclusive?t.data<a.value:t.data<=a.value)&&(n=this._getOrReturnCtx(t,n),V(n,{code:M.too_small,minimum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),i.dirty()):a.kind==="max"?(a.inclusive?t.data>a.value:t.data>=a.value)&&(n=this._getOrReturnCtx(t,n),V(n,{code:M.too_big,maximum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),i.dirty()):a.kind==="multipleOf"?TK(t.data,a.value)!==0&&(n=this._getOrReturnCtx(t,n),V(n,{code:M.not_multiple_of,multipleOf:a.value,message:a.message}),i.dirty()):a.kind==="finite"?Number.isFinite(t.data)||(n=this._getOrReturnCtx(t,n),V(n,{code:M.not_finite,message:a.message}),i.dirty()):ye.assertNever(a);return{status:i.value,value:t.data}}gte(t,r){return this.setLimit("min",t,!0,Y.toString(r))}gt(t,r){return this.setLimit("min",t,!1,Y.toString(r))}lte(t,r){return this.setLimit("max",t,!0,Y.toString(r))}lt(t,r){return this.setLimit("max",t,!1,Y.toString(r))}setLimit(t,r,n,i){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:n,message:Y.toString(i)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:Y.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:Y.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:Y.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:Y.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:Y.toString(t)})}multipleOf(t,r){return this._addCheck({kind:"multipleOf",value:t,message:Y.toString(r)})}finite(t){return this._addCheck({kind:"finite",message:Y.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:Y.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:Y.toString(t)})}get minValue(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxValue(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t}get isInt(){return!!this._def.checks.find(t=>t.kind==="int"||t.kind==="multipleOf"&&ye.isInteger(t.value))}get isFinite(){let t=null,r=null;for(let n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(r===null||n.value>r)&&(r=n.value):n.kind==="max"&&(t===null||n.value<t)&&(t=n.value)}return Number.isFinite(r)&&Number.isFinite(t)}};Pa.create=e=>new Pa({checks:[],typeName:re.ZodNumber,coerce:e?.coerce||!1,...pe(e)});var Na=class e extends de{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(t){if(this._def.coerce)try{t.data=BigInt(t.data)}catch{return this._getInvalidInput(t)}if(this._getType(t)!==W.bigint)return this._getInvalidInput(t);let n,i=new At;for(let a of this._def.checks)a.kind==="min"?(a.inclusive?t.data<a.value:t.data<=a.value)&&(n=this._getOrReturnCtx(t,n),V(n,{code:M.too_small,type:"bigint",minimum:a.value,inclusive:a.inclusive,message:a.message}),i.dirty()):a.kind==="max"?(a.inclusive?t.data>a.value:t.data>=a.value)&&(n=this._getOrReturnCtx(t,n),V(n,{code:M.too_big,type:"bigint",maximum:a.value,inclusive:a.inclusive,message:a.message}),i.dirty()):a.kind==="multipleOf"?t.data%a.value!==BigInt(0)&&(n=this._getOrReturnCtx(t,n),V(n,{code:M.not_multiple_of,multipleOf:a.value,message:a.message}),i.dirty()):ye.assertNever(a);return{status:i.value,value:t.data}}_getInvalidInput(t){let r=this._getOrReturnCtx(t);return V(r,{code:M.invalid_type,expected:W.bigint,received:r.parsedType}),ne}gte(t,r){return this.setLimit("min",t,!0,Y.toString(r))}gt(t,r){return this.setLimit("min",t,!1,Y.toString(r))}lte(t,r){return this.setLimit("max",t,!0,Y.toString(r))}lt(t,r){return this.setLimit("max",t,!1,Y.toString(r))}setLimit(t,r,n,i){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:n,message:Y.toString(i)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}positive(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:Y.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:Y.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:Y.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:Y.toString(t)})}multipleOf(t,r){return this._addCheck({kind:"multipleOf",value:t,message:Y.toString(r)})}get minValue(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxValue(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t}};Na.create=e=>{var t;return new Na({checks:[],typeName:re.ZodBigInt,coerce:(t=e?.coerce)!==null&&t!==void 0?t:!1,...pe(e)})};var Ra=class extends de{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==W.boolean){let n=this._getOrReturnCtx(t);return V(n,{code:M.invalid_type,expected:W.boolean,received:n.parsedType}),ne}return Pt(t.data)}};Ra.create=e=>new Ra({typeName:re.ZodBoolean,coerce:e?.coerce||!1,...pe(e)});var Ia=class e extends de{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==W.date){let a=this._getOrReturnCtx(t);return V(a,{code:M.invalid_type,expected:W.date,received:a.parsedType}),ne}if(isNaN(t.data.getTime())){let a=this._getOrReturnCtx(t);return V(a,{code:M.invalid_date}),ne}let n=new At,i;for(let a of this._def.checks)a.kind==="min"?t.data.getTime()<a.value&&(i=this._getOrReturnCtx(t,i),V(i,{code:M.too_small,message:a.message,inclusive:!0,exact:!1,minimum:a.value,type:"date"}),n.dirty()):a.kind==="max"?t.data.getTime()>a.value&&(i=this._getOrReturnCtx(t,i),V(i,{code:M.too_big,message:a.message,inclusive:!0,exact:!1,maximum:a.value,type:"date"}),n.dirty()):ye.assertNever(a);return{status:n.value,value:new Date(t.data.getTime())}}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}min(t,r){return this._addCheck({kind:"min",value:t.getTime(),message:Y.toString(r)})}max(t,r){return this._addCheck({kind:"max",value:t.getTime(),message:Y.toString(r)})}get minDate(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t!=null?new Date(t):null}get maxDate(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t!=null?new Date(t):null}};Ia.create=e=>new Ia({checks:[],coerce:e?.coerce||!1,typeName:re.ZodDate,...pe(e)});var oo=class extends de{_parse(t){if(this._getType(t)!==W.symbol){let n=this._getOrReturnCtx(t);return V(n,{code:M.invalid_type,expected:W.symbol,received:n.parsedType}),ne}return Pt(t.data)}};oo.create=e=>new oo({typeName:re.ZodSymbol,...pe(e)});var ja=class extends de{_parse(t){if(this._getType(t)!==W.undefined){let n=this._getOrReturnCtx(t);return V(n,{code:M.invalid_type,expected:W.undefined,received:n.parsedType}),ne}return Pt(t.data)}};ja.create=e=>new ja({typeName:re.ZodUndefined,...pe(e)});var ka=class extends de{_parse(t){if(this._getType(t)!==W.null){let n=this._getOrReturnCtx(t);return V(n,{code:M.invalid_type,expected:W.null,received:n.parsedType}),ne}return Pt(t.data)}};ka.create=e=>new ka({typeName:re.ZodNull,...pe(e)});var Oi=class extends de{constructor(){super(...arguments),this._any=!0}_parse(t){return Pt(t.data)}};Oi.create=e=>new Oi({typeName:re.ZodAny,...pe(e)});var Vn=class extends de{constructor(){super(...arguments),this._unknown=!0}_parse(t){return Pt(t.data)}};Vn.create=e=>new Vn({typeName:re.ZodUnknown,...pe(e)});var Rr=class extends de{_parse(t){let r=this._getOrReturnCtx(t);return V(r,{code:M.invalid_type,expected:W.never,received:r.parsedType}),ne}};Rr.create=e=>new Rr({typeName:re.ZodNever,...pe(e)});var uo=class extends de{_parse(t){if(this._getType(t)!==W.undefined){let n=this._getOrReturnCtx(t);return V(n,{code:M.invalid_type,expected:W.void,received:n.parsedType}),ne}return Pt(t.data)}};uo.create=e=>new uo({typeName:re.ZodVoid,...pe(e)});var Un=class e extends de{_parse(t){let{ctx:r,status:n}=this._processInputParams(t),i=this._def;if(r.parsedType!==W.array)return V(r,{code:M.invalid_type,expected:W.array,received:r.parsedType}),ne;if(i.exactLength!==null){let u=r.data.length>i.exactLength.value,p=r.data.length<i.exactLength.value;(u||p)&&(V(r,{code:u?M.too_big:M.too_small,minimum:p?i.exactLength.value:void 0,maximum:u?i.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:i.exactLength.message}),n.dirty())}if(i.minLength!==null&&r.data.length<i.minLength.value&&(V(r,{code:M.too_small,minimum:i.minLength.value,type:"array",inclusive:!0,exact:!1,message:i.minLength.message}),n.dirty()),i.maxLength!==null&&r.data.length>i.maxLength.value&&(V(r,{code:M.too_big,maximum:i.maxLength.value,type:"array",inclusive:!0,exact:!1,message:i.maxLength.message}),n.dirty()),r.common.async)return Promise.all([...r.data].map((u,p)=>i.type._parseAsync(new fr(r,u,r.path,p)))).then(u=>At.mergeArray(n,u));let a=[...r.data].map((u,p)=>i.type._parseSync(new fr(r,u,r.path,p)));return At.mergeArray(n,a)}get element(){return this._def.type}min(t,r){return new e({...this._def,minLength:{value:t,message:Y.toString(r)}})}max(t,r){return new e({...this._def,maxLength:{value:t,message:Y.toString(r)}})}length(t,r){return new e({...this._def,exactLength:{value:t,message:Y.toString(r)}})}nonempty(t){return this.min(1,t)}};Un.create=(e,t)=>new Un({type:e,minLength:null,maxLength:null,exactLength:null,typeName:re.ZodArray,...pe(t)});function io(e){if(e instanceof kt){let t={};for(let r in e.shape){let n=e.shape[r];t[r]=cr.create(io(n))}return new kt({...e._def,shape:()=>t})}else return e instanceof Un?new Un({...e._def,type:io(e.element)}):e instanceof cr?cr.create(io(e.unwrap())):e instanceof an?an.create(io(e.unwrap())):e instanceof nn?nn.create(e.items.map(t=>io(t))):e}var kt=class e extends de{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let t=this._def.shape(),r=ye.objectKeys(t);return this._cached={shape:t,keys:r}}_parse(t){if(this._getType(t)!==W.object){let c=this._getOrReturnCtx(t);return V(c,{code:M.invalid_type,expected:W.object,received:c.parsedType}),ne}let{status:n,ctx:i}=this._processInputParams(t),{shape:a,keys:u}=this._getCached(),p=[];if(!(this._def.catchall instanceof Rr&&this._def.unknownKeys==="strip"))for(let c in i.data)u.includes(c)||p.push(c);let l=[];for(let c of u){let h=a[c],b=i.data[c];l.push({key:{status:"valid",value:c},value:h._parse(new fr(i,b,i.path,c)),alwaysSet:c in i.data})}if(this._def.catchall instanceof Rr){let c=this._def.unknownKeys;if(c==="passthrough")for(let h of p)l.push({key:{status:"valid",value:h},value:{status:"valid",value:i.data[h]}});else if(c==="strict")p.length>0&&(V(i,{code:M.unrecognized_keys,keys:p}),n.dirty());else if(c!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let c=this._def.catchall;for(let h of p){let b=i.data[h];l.push({key:{status:"valid",value:h},value:c._parse(new fr(i,b,i.path,h)),alwaysSet:h in i.data})}}return i.common.async?Promise.resolve().then(async()=>{let c=[];for(let h of l){let b=await h.key,w=await h.value;c.push({key:b,value:w,alwaysSet:h.alwaysSet})}return c}).then(c=>At.mergeObjectSync(n,c)):At.mergeObjectSync(n,l)}get shape(){return this._def.shape()}strict(t){return Y.errToObj,new e({...this._def,unknownKeys:"strict",...t!==void 0?{errorMap:(r,n)=>{var i,a,u,p;let l=(u=(a=(i=this._def).errorMap)===null||a===void 0?void 0:a.call(i,r,n).message)!==null&&u!==void 0?u:n.defaultError;return r.code==="unrecognized_keys"?{message:(p=Y.errToObj(t).message)!==null&&p!==void 0?p:l}:{message:l}}}:{}})}strip(){return new e({...this._def,unknownKeys:"strip"})}passthrough(){return new e({...this._def,unknownKeys:"passthrough"})}extend(t){return new e({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new e({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:re.ZodObject})}setKey(t,r){return this.augment({[t]:r})}catchall(t){return new e({...this._def,catchall:t})}pick(t){let r={};return ye.objectKeys(t).forEach(n=>{t[n]&&this.shape[n]&&(r[n]=this.shape[n])}),new e({...this._def,shape:()=>r})}omit(t){let r={};return ye.objectKeys(this.shape).forEach(n=>{t[n]||(r[n]=this.shape[n])}),new e({...this._def,shape:()=>r})}deepPartial(){return io(this)}partial(t){let r={};return ye.objectKeys(this.shape).forEach(n=>{let i=this.shape[n];t&&!t[n]?r[n]=i:r[n]=i.optional()}),new e({...this._def,shape:()=>r})}required(t){let r={};return ye.objectKeys(this.shape).forEach(n=>{if(t&&!t[n])r[n]=this.shape[n];else{let a=this.shape[n];for(;a instanceof cr;)a=a._def.innerType;r[n]=a}}),new e({...this._def,shape:()=>r})}keyof(){return zb(ye.objectKeys(this.shape))}};kt.create=(e,t)=>new kt({shape:()=>e,unknownKeys:"strip",catchall:Rr.create(),typeName:re.ZodObject,...pe(t)});kt.strictCreate=(e,t)=>new kt({shape:()=>e,unknownKeys:"strict",catchall:Rr.create(),typeName:re.ZodObject,...pe(t)});kt.lazycreate=(e,t)=>new kt({shape:e,unknownKeys:"strip",catchall:Rr.create(),typeName:re.ZodObject,...pe(t)});var Ma=class extends de{_parse(t){let{ctx:r}=this._processInputParams(t),n=this._def.options;function i(a){for(let p of a)if(p.result.status==="valid")return p.result;for(let p of a)if(p.result.status==="dirty")return r.common.issues.push(...p.ctx.common.issues),p.result;let u=a.map(p=>new Zt(p.ctx.common.issues));return V(r,{code:M.invalid_union,unionErrors:u}),ne}if(r.common.async)return Promise.all(n.map(async a=>{let u={...r,common:{...r.common,issues:[]},parent:null};return{result:await a._parseAsync({data:r.data,path:r.path,parent:u}),ctx:u}})).then(i);{let a,u=[];for(let l of n){let c={...r,common:{...r.common,issues:[]},parent:null},h=l._parseSync({data:r.data,path:r.path,parent:c});if(h.status==="valid")return h;h.status==="dirty"&&!a&&(a={result:h,ctx:c}),c.common.issues.length&&u.push(c.common.issues)}if(a)return r.common.issues.push(...a.ctx.common.issues),a.result;let p=u.map(l=>new Zt(l));return V(r,{code:M.invalid_union,unionErrors:p}),ne}}get options(){return this._def.options}};Ma.create=(e,t)=>new Ma({options:e,typeName:re.ZodUnion,...pe(t)});var Mn=e=>e instanceof Va?Mn(e.schema):e instanceof Jt?Mn(e.innerType()):e instanceof Ua?[e.value]:e instanceof Wa?e.options:e instanceof $a?ye.objectValues(e.enum):e instanceof Ga?Mn(e._def.innerType):e instanceof ja?[void 0]:e instanceof ka?[null]:e instanceof cr?[void 0,...Mn(e.unwrap())]:e instanceof an?[null,...Mn(e.unwrap())]:e instanceof j0||e instanceof Ha?Mn(e.unwrap()):e instanceof za?Mn(e._def.innerType):[],bd=class e extends de{_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==W.object)return V(r,{code:M.invalid_type,expected:W.object,received:r.parsedType}),ne;let n=this.discriminator,i=r.data[n],a=this.optionsMap.get(i);return a?r.common.async?a._parseAsync({data:r.data,path:r.path,parent:r}):a._parseSync({data:r.data,path:r.path,parent:r}):(V(r,{code:M.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),ne)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,r,n){let i=new Map;for(let a of r){let u=Mn(a.shape[t]);if(!u.length)throw new Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(let p of u){if(i.has(p))throw new Error(`Discriminator property ${String(t)} has duplicate value ${String(p)}`);i.set(p,a)}}return new e({typeName:re.ZodDiscriminatedUnion,discriminator:t,options:r,optionsMap:i,...pe(n)})}};function p8(e,t){let r=Ln(e),n=Ln(t);if(e===t)return{valid:!0,data:e};if(r===W.object&&n===W.object){let i=ye.objectKeys(t),a=ye.objectKeys(e).filter(p=>i.indexOf(p)!==-1),u={...e,...t};for(let p of a){let l=p8(e[p],t[p]);if(!l.valid)return{valid:!1};u[p]=l.data}return{valid:!0,data:u}}else if(r===W.array&&n===W.array){if(e.length!==t.length)return{valid:!1};let i=[];for(let a=0;a<e.length;a++){let u=e[a],p=t[a],l=p8(u,p);if(!l.valid)return{valid:!1};i.push(l.data)}return{valid:!0,data:i}}else return r===W.date&&n===W.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}var La=class extends de{_parse(t){let{status:r,ctx:n}=this._processInputParams(t),i=(a,u)=>{if(o8(a)||o8(u))return ne;let p=p8(a.value,u.value);return p.valid?((u8(a)||u8(u))&&r.dirty(),{status:r.value,value:p.data}):(V(n,{code:M.invalid_intersection_types}),ne)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([a,u])=>i(a,u)):i(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}};La.create=(e,t,r)=>new La({left:e,right:t,typeName:re.ZodIntersection,...pe(r)});var nn=class e extends de{_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==W.array)return V(n,{code:M.invalid_type,expected:W.array,received:n.parsedType}),ne;if(n.data.length<this._def.items.length)return V(n,{code:M.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),ne;!this._def.rest&&n.data.length>this._def.items.length&&(V(n,{code:M.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());let a=[...n.data].map((u,p)=>{let l=this._def.items[p]||this._def.rest;return l?l._parse(new fr(n,u,n.path,p)):null}).filter(u=>!!u);return n.common.async?Promise.all(a).then(u=>At.mergeArray(r,u)):At.mergeArray(r,a)}get items(){return this._def.items}rest(t){return new e({...this._def,rest:t})}};nn.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new nn({items:e,typeName:re.ZodTuple,rest:null,...pe(t)})};var Dd=class e extends de{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==W.object)return V(n,{code:M.invalid_type,expected:W.object,received:n.parsedType}),ne;let i=[],a=this._def.keyType,u=this._def.valueType;for(let p in n.data)i.push({key:a._parse(new fr(n,p,n.path,p)),value:u._parse(new fr(n,n.data[p],n.path,p)),alwaysSet:p in n.data});return n.common.async?At.mergeObjectAsync(r,i):At.mergeObjectSync(r,i)}get element(){return this._def.valueType}static create(t,r,n){return r instanceof de?new e({keyType:t,valueType:r,typeName:re.ZodRecord,...pe(n)}):new e({keyType:Ai.create(),valueType:t,typeName:re.ZodRecord,...pe(r)})}},po=class extends de{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==W.map)return V(n,{code:M.invalid_type,expected:W.map,received:n.parsedType}),ne;let i=this._def.keyType,a=this._def.valueType,u=[...n.data.entries()].map(([p,l],c)=>({key:i._parse(new fr(n,p,n.path,[c,"key"])),value:a._parse(new fr(n,l,n.path,[c,"value"]))}));if(n.common.async){let p=new Map;return Promise.resolve().then(async()=>{for(let l of u){let c=await l.key,h=await l.value;if(c.status==="aborted"||h.status==="aborted")return ne;(c.status==="dirty"||h.status==="dirty")&&r.dirty(),p.set(c.value,h.value)}return{status:r.value,value:p}})}else{let p=new Map;for(let l of u){let c=l.key,h=l.value;if(c.status==="aborted"||h.status==="aborted")return ne;(c.status==="dirty"||h.status==="dirty")&&r.dirty(),p.set(c.value,h.value)}return{status:r.value,value:p}}}};po.create=(e,t,r)=>new po({valueType:t,keyType:e,typeName:re.ZodMap,...pe(r)});var lo=class e extends de{_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==W.set)return V(n,{code:M.invalid_type,expected:W.set,received:n.parsedType}),ne;let i=this._def;i.minSize!==null&&n.data.size<i.minSize.value&&(V(n,{code:M.too_small,minimum:i.minSize.value,type:"set",inclusive:!0,exact:!1,message:i.minSize.message}),r.dirty()),i.maxSize!==null&&n.data.size>i.maxSize.value&&(V(n,{code:M.too_big,maximum:i.maxSize.value,type:"set",inclusive:!0,exact:!1,message:i.maxSize.message}),r.dirty());let a=this._def.valueType;function u(l){let c=new Set;for(let h of l){if(h.status==="aborted")return ne;h.status==="dirty"&&r.dirty(),c.add(h.value)}return{status:r.value,value:c}}let p=[...n.data.values()].map((l,c)=>a._parse(new fr(n,l,n.path,c)));return n.common.async?Promise.all(p).then(l=>u(l)):u(p)}min(t,r){return new e({...this._def,minSize:{value:t,message:Y.toString(r)}})}max(t,r){return new e({...this._def,maxSize:{value:t,message:Y.toString(r)}})}size(t,r){return this.min(t,r).max(t,r)}nonempty(t){return this.min(1,t)}};lo.create=(e,t)=>new lo({valueType:e,minSize:null,maxSize:null,typeName:re.ZodSet,...pe(t)});var yd=class e extends de{constructor(){super(...arguments),this.validate=this.implement}_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==W.function)return V(r,{code:M.invalid_type,expected:W.function,received:r.parsedType}),ne;function n(p,l){return gd({data:p,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,xd(),so].filter(c=>!!c),issueData:{code:M.invalid_arguments,argumentsError:l}})}function i(p,l){return gd({data:p,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,xd(),so].filter(c=>!!c),issueData:{code:M.invalid_return_type,returnTypeError:l}})}let a={errorMap:r.common.contextualErrorMap},u=r.data;if(this._def.returns instanceof Ti){let p=this;return Pt(async function(...l){let c=new Zt([]),h=await p._def.args.parseAsync(l,a).catch(O=>{throw c.addIssue(n(l,O)),c}),b=await Reflect.apply(u,this,h);return await p._def.returns._def.type.parseAsync(b,a).catch(O=>{throw c.addIssue(i(b,O)),c})})}else{let p=this;return Pt(function(...l){let c=p._def.args.safeParse(l,a);if(!c.success)throw new Zt([n(l,c.error)]);let h=Reflect.apply(u,this,c.data),b=p._def.returns.safeParse(h,a);if(!b.success)throw new Zt([i(h,b.error)]);return b.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new e({...this._def,args:nn.create(t).rest(Vn.create())})}returns(t){return new e({...this._def,returns:t})}implement(t){return this.parse(t)}strictImplement(t){return this.parse(t)}static create(t,r,n){return new e({args:t||nn.create([]).rest(Vn.create()),returns:r||Vn.create(),typeName:re.ZodFunction,...pe(n)})}},Va=class extends de{get schema(){return this._def.getter()}_parse(t){let{ctx:r}=this._processInputParams(t);return this._def.getter()._parse({data:r.data,path:r.path,parent:r})}};Va.create=(e,t)=>new Va({getter:e,typeName:re.ZodLazy,...pe(t)});var Ua=class extends de{_parse(t){if(t.data!==this._def.value){let r=this._getOrReturnCtx(t);return V(r,{received:r.data,code:M.invalid_literal,expected:this._def.value}),ne}return{status:"valid",value:t.data}}get value(){return this._def.value}};Ua.create=(e,t)=>new Ua({value:e,typeName:re.ZodLiteral,...pe(t)});function zb(e,t){return new Wa({values:e,typeName:re.ZodEnum,...pe(t)})}var Wa=class e extends de{constructor(){super(...arguments),N0.set(this,void 0)}_parse(t){if(typeof t.data!="string"){let r=this._getOrReturnCtx(t),n=this._def.values;return V(r,{expected:ye.joinValues(n),received:r.parsedType,code:M.invalid_type}),ne}if(_d(this,N0,"f")||Ub(this,N0,new Set(this._def.values),"f"),!_d(this,N0,"f").has(t.data)){let r=this._getOrReturnCtx(t),n=this._def.values;return V(r,{received:r.data,code:M.invalid_enum_value,options:n}),ne}return Pt(t.data)}get options(){return this._def.values}get enum(){let t={};for(let r of this._def.values)t[r]=r;return t}get Values(){let t={};for(let r of this._def.values)t[r]=r;return t}get Enum(){let t={};for(let r of this._def.values)t[r]=r;return t}extract(t,r=this._def){return e.create(t,{...this._def,...r})}exclude(t,r=this._def){return e.create(this.options.filter(n=>!t.includes(n)),{...this._def,...r})}};N0=new WeakMap;Wa.create=zb;var $a=class extends de{constructor(){super(...arguments),R0.set(this,void 0)}_parse(t){let r=ye.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(t);if(n.parsedType!==W.string&&n.parsedType!==W.number){let i=ye.objectValues(r);return V(n,{expected:ye.joinValues(i),received:n.parsedType,code:M.invalid_type}),ne}if(_d(this,R0,"f")||Ub(this,R0,new Set(ye.getValidEnumValues(this._def.values)),"f"),!_d(this,R0,"f").has(t.data)){let i=ye.objectValues(r);return V(n,{received:n.data,code:M.invalid_enum_value,options:i}),ne}return Pt(t.data)}get enum(){return this._def.values}};R0=new WeakMap;$a.create=(e,t)=>new $a({values:e,typeName:re.ZodNativeEnum,...pe(t)});var Ti=class extends de{unwrap(){return this._def.type}_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==W.promise&&r.common.async===!1)return V(r,{code:M.invalid_type,expected:W.promise,received:r.parsedType}),ne;let n=r.parsedType===W.promise?r.data:Promise.resolve(r.data);return Pt(n.then(i=>this._def.type.parseAsync(i,{path:r.path,errorMap:r.common.contextualErrorMap})))}};Ti.create=(e,t)=>new Ti({type:e,typeName:re.ZodPromise,...pe(t)});var Jt=class extends de{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===re.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){let{status:r,ctx:n}=this._processInputParams(t),i=this._def.effect||null,a={addIssue:u=>{V(n,u),u.fatal?r.abort():r.dirty()},get path(){return n.path}};if(a.addIssue=a.addIssue.bind(a),i.type==="preprocess"){let u=i.transform(n.data,a);if(n.common.async)return Promise.resolve(u).then(async p=>{if(r.value==="aborted")return ne;let l=await this._def.schema._parseAsync({data:p,path:n.path,parent:n});return l.status==="aborted"?ne:l.status==="dirty"||r.value==="dirty"?ao(l.value):l});{if(r.value==="aborted")return ne;let p=this._def.schema._parseSync({data:u,path:n.path,parent:n});return p.status==="aborted"?ne:p.status==="dirty"||r.value==="dirty"?ao(p.value):p}}if(i.type==="refinement"){let u=p=>{let l=i.refinement(p,a);if(n.common.async)return Promise.resolve(l);if(l instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return p};if(n.common.async===!1){let p=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return p.status==="aborted"?ne:(p.status==="dirty"&&r.dirty(),u(p.value),{status:r.value,value:p.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(p=>p.status==="aborted"?ne:(p.status==="dirty"&&r.dirty(),u(p.value).then(()=>({status:r.value,value:p.value}))))}if(i.type==="transform")if(n.common.async===!1){let u=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!Ba(u))return u;let p=i.transform(u.value,a);if(p instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:p}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(u=>Ba(u)?Promise.resolve(i.transform(u.value,a)).then(p=>({status:r.value,value:p})):u);ye.assertNever(i)}};Jt.create=(e,t,r)=>new Jt({schema:e,typeName:re.ZodEffects,effect:t,...pe(r)});Jt.createWithPreprocess=(e,t,r)=>new Jt({schema:t,effect:{type:"preprocess",transform:e},typeName:re.ZodEffects,...pe(r)});var cr=class extends de{_parse(t){return this._getType(t)===W.undefined?Pt(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};cr.create=(e,t)=>new cr({innerType:e,typeName:re.ZodOptional,...pe(t)});var an=class extends de{_parse(t){return this._getType(t)===W.null?Pt(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};an.create=(e,t)=>new an({innerType:e,typeName:re.ZodNullable,...pe(t)});var Ga=class extends de{_parse(t){let{ctx:r}=this._processInputParams(t),n=r.data;return r.parsedType===W.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};Ga.create=(e,t)=>new Ga({innerType:e,typeName:re.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...pe(t)});var za=class extends de{_parse(t){let{ctx:r}=this._processInputParams(t),n={...r,common:{...r.common,issues:[]}},i=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return I0(i)?i.then(a=>({status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new Zt(n.common.issues)},input:n.data})})):{status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new Zt(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};za.create=(e,t)=>new za({innerType:e,typeName:re.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...pe(t)});var co=class extends de{_parse(t){if(this._getType(t)!==W.nan){let n=this._getOrReturnCtx(t);return V(n,{code:M.invalid_type,expected:W.nan,received:n.parsedType}),ne}return{status:"valid",value:t.data}}};co.create=e=>new co({typeName:re.ZodNaN,...pe(e)});var qK=Symbol("zod_brand"),j0=class extends de{_parse(t){let{ctx:r}=this._processInputParams(t),n=r.data;return this._def.type._parse({data:n,path:r.path,parent:r})}unwrap(){return this._def.type}},k0=class e extends de{_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.common.async)return(async()=>{let a=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return a.status==="aborted"?ne:a.status==="dirty"?(r.dirty(),ao(a.value)):this._def.out._parseAsync({data:a.value,path:n.path,parent:n})})();{let i=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return i.status==="aborted"?ne:i.status==="dirty"?(r.dirty(),{status:"dirty",value:i.value}):this._def.out._parseSync({data:i.value,path:n.path,parent:n})}}static create(t,r){return new e({in:t,out:r,typeName:re.ZodPipeline})}},Ha=class extends de{_parse(t){let r=this._def.innerType._parse(t),n=i=>(Ba(i)&&(i.value=Object.freeze(i.value)),i);return I0(r)?r.then(i=>n(i)):n(r)}unwrap(){return this._def.innerType}};Ha.create=(e,t)=>new Ha({innerType:e,typeName:re.ZodReadonly,...pe(t)});function Mb(e,t){let r=typeof e=="function"?e(t):typeof e=="string"?{message:e}:e;return typeof r=="string"?{message:r}:r}function Hb(e,t={},r){return e?Oi.create().superRefine((n,i)=>{var a,u;let p=e(n);if(p instanceof Promise)return p.then(l=>{var c,h;if(!l){let b=Mb(t,n),w=(h=(c=b.fatal)!==null&&c!==void 0?c:r)!==null&&h!==void 0?h:!0;i.addIssue({code:"custom",...b,fatal:w})}});if(!p){let l=Mb(t,n),c=(u=(a=l.fatal)!==null&&a!==void 0?a:r)!==null&&u!==void 0?u:!0;i.addIssue({code:"custom",...l,fatal:c})}}):Oi.create()}var BK={object:kt.lazycreate},re;(function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"})(re||(re={}));var PK=(e,t={message:`Input not instance of ${e.name}`})=>Hb(r=>r instanceof e,t),Kb=Ai.create,Yb=Pa.create,NK=co.create,RK=Na.create,Zb=Ra.create,IK=Ia.create,jK=oo.create,kK=ja.create,MK=ka.create,LK=Oi.create,VK=Vn.create,UK=Rr.create,WK=uo.create,$K=Un.create,GK=kt.create,zK=kt.strictCreate,HK=Ma.create,KK=bd.create,YK=La.create,ZK=nn.create,JK=Dd.create,XK=po.create,QK=lo.create,eY=yd.create,tY=Va.create,rY=Ua.create,nY=Wa.create,iY=$a.create,aY=Ti.create,Lb=Jt.create,sY=cr.create,oY=an.create,uY=Jt.createWithPreprocess,pY=k0.create,dY=()=>Kb().optional(),lY=()=>Yb().optional(),cY=()=>Zb().optional(),fY={string:e=>Ai.create({...e,coerce:!0}),number:e=>Pa.create({...e,coerce:!0}),boolean:e=>Ra.create({...e,coerce:!0}),bigint:e=>Na.create({...e,coerce:!0}),date:e=>Ia.create({...e,coerce:!0})},mY=ne,D=Object.freeze({__proto__:null,defaultErrorMap:so,setErrorMap:uK,getErrorMap:xd,makeIssue:gd,EMPTY_PATH:pK,addIssueToContext:V,ParseStatus:At,INVALID:ne,DIRTY:ao,OK:Pt,isAborted:o8,isDirty:u8,isValid:Ba,isAsync:I0,get util(){return ye},get objectUtil(){return s8},ZodParsedType:W,getParsedType:Ln,ZodType:de,datetimeRegex:Gb,ZodString:Ai,ZodNumber:Pa,ZodBigInt:Na,ZodBoolean:Ra,ZodDate:Ia,ZodSymbol:oo,ZodUndefined:ja,ZodNull:ka,ZodAny:Oi,ZodUnknown:Vn,ZodNever:Rr,ZodVoid:uo,ZodArray:Un,ZodObject:kt,ZodUnion:Ma,ZodDiscriminatedUnion:bd,ZodIntersection:La,ZodTuple:nn,ZodRecord:Dd,ZodMap:po,ZodSet:lo,ZodFunction:yd,ZodLazy:Va,ZodLiteral:Ua,ZodEnum:Wa,ZodNativeEnum:$a,ZodPromise:Ti,ZodEffects:Jt,ZodTransformer:Jt,ZodOptional:cr,ZodNullable:an,ZodDefault:Ga,ZodCatch:za,ZodNaN:co,BRAND:qK,ZodBranded:j0,ZodPipeline:k0,ZodReadonly:Ha,custom:Hb,Schema:de,ZodSchema:de,late:BK,get ZodFirstPartyTypeKind(){return re},coerce:fY,any:LK,array:$K,bigint:RK,boolean:Zb,date:IK,discriminatedUnion:KK,effect:Lb,enum:nY,function:eY,instanceof:PK,intersection:YK,lazy:tY,literal:rY,map:XK,nan:NK,nativeEnum:iY,never:UK,null:MK,nullable:oY,number:Yb,object:GK,oboolean:cY,onumber:lY,optional:sY,ostring:dY,pipeline:pY,preprocess:uY,promise:aY,record:JK,set:QK,strictObject:zK,string:Kb,symbol:jK,transformer:Lb,tuple:ZK,undefined:kK,union:HK,unknown:VK,void:WK,NEVER:mY,ZodIssueCode:M,quotelessJson:oK,ZodError:Zt});var d8="2024-11-05",Jb=[d8,"2024-10-07"],Ed="2.0",Xb=D.union([D.string(),D.number().int()]),Qb=D.string(),Ir=D.object({_meta:D.optional(D.object({progressToken:D.optional(Xb)}).passthrough())}).passthrough(),Xt=D.object({method:D.string(),params:D.optional(Ir)}),M0=D.object({_meta:D.optional(D.object({}).passthrough())}).passthrough(),sn=D.object({method:D.string(),params:D.optional(M0)}),jr=D.object({_meta:D.optional(D.object({}).passthrough())}).passthrough(),wd=D.union([D.string(),D.number().int()]),hY=D.object({jsonrpc:D.literal(Ed),id:wd}).merge(Xt).strict(),vY=D.object({jsonrpc:D.literal(Ed)}).merge(sn).strict(),xY=D.object({jsonrpc:D.literal(Ed),id:wd,result:jr}).strict(),lt;(function(e){e[e.ConnectionClosed=-32e3]="ConnectionClosed",e[e.RequestTimeout=-32001]="RequestTimeout",e[e.ParseError=-32700]="ParseError",e[e.InvalidRequest=-32600]="InvalidRequest",e[e.MethodNotFound=-32601]="MethodNotFound",e[e.InvalidParams=-32602]="InvalidParams",e[e.InternalError=-32603]="InternalError"})(lt||(lt={}));var gY=D.object({jsonrpc:D.literal(Ed),id:wd,error:D.object({code:D.number().int(),message:D.string(),data:D.optional(D.unknown())})}).strict(),Fd=D.union([hY,vY,xY,gY]),Ya=jr.strict(),Cd=sn.extend({method:D.literal("notifications/cancelled"),params:M0.extend({requestId:wd,reason:D.string().optional()})}),eD=D.object({name:D.string(),version:D.string()}).passthrough(),_Y=D.object({experimental:D.optional(D.object({}).passthrough()),sampling:D.optional(D.object({}).passthrough()),roots:D.optional(D.object({listChanged:D.optional(D.boolean())}).passthrough())}).passthrough(),bY=Xt.extend({method:D.literal("initialize"),params:Ir.extend({protocolVersion:D.string(),capabilities:_Y,clientInfo:eD})}),DY=D.object({experimental:D.optional(D.object({}).passthrough()),logging:D.optional(D.object({}).passthrough()),prompts:D.optional(D.object({listChanged:D.optional(D.boolean())}).passthrough()),resources:D.optional(D.object({subscribe:D.optional(D.boolean()),listChanged:D.optional(D.boolean())}).passthrough()),tools:D.optional(D.object({listChanged:D.optional(D.boolean())}).passthrough())}).passthrough(),l8=jr.extend({protocolVersion:D.string(),capabilities:DY,serverInfo:eD,instructions:D.optional(D.string())}),yY=sn.extend({method:D.literal("notifications/initialized")}),Sd=Xt.extend({method:D.literal("ping")}),EY=D.object({progress:D.number(),total:D.optional(D.number())}).passthrough(),Ad=sn.extend({method:D.literal("notifications/progress"),params:M0.merge(EY).extend({progressToken:Xb})}),Od=Xt.extend({params:Ir.extend({cursor:D.optional(Qb)}).optional()}),Td=jr.extend({nextCursor:D.optional(Qb)}),tD=D.object({uri:D.string(),mimeType:D.optional(D.string())}).passthrough(),rD=tD.extend({text:D.string()}),nD=tD.extend({blob:D.string().base64()}),wY=D.object({uri:D.string(),name:D.string(),description:D.optional(D.string()),mimeType:D.optional(D.string())}).passthrough(),FY=D.object({uriTemplate:D.string(),name:D.string(),description:D.optional(D.string()),mimeType:D.optional(D.string())}).passthrough(),CY=Od.extend({method:D.literal("resources/list")}),c8=Td.extend({resources:D.array(wY)}),SY=Od.extend({method:D.literal("resources/templates/list")}),f8=Td.extend({resourceTemplates:D.array(FY)}),AY=Xt.extend({method:D.literal("resources/read"),params:Ir.extend({uri:D.string()})}),m8=jr.extend({contents:D.array(D.union([rD,nD]))}),OY=sn.extend({method:D.literal("notifications/resources/list_changed")}),TY=Xt.extend({method:D.literal("resources/subscribe"),params:Ir.extend({uri:D.string()})}),qY=Xt.extend({method:D.literal("resources/unsubscribe"),params:Ir.extend({uri:D.string()})}),BY=sn.extend({method:D.literal("notifications/resources/updated"),params:M0.extend({uri:D.string()})}),PY=D.object({name:D.string(),description:D.optional(D.string()),required:D.optional(D.boolean())}).passthrough(),NY=D.object({name:D.string(),description:D.optional(D.string()),arguments:D.optional(D.array(PY))}).passthrough(),RY=Od.extend({method:D.literal("prompts/list")}),h8=Td.extend({prompts:D.array(NY)}),IY=Xt.extend({method:D.literal("prompts/get"),params:Ir.extend({name:D.string(),arguments:D.optional(D.record(D.string()))})}),qd=D.object({type:D.literal("text"),text:D.string()}).passthrough(),Bd=D.object({type:D.literal("image"),data:D.string().base64(),mimeType:D.string()}).passthrough(),iD=D.object({type:D.literal("resource"),resource:D.union([rD,nD])}).passthrough(),jY=D.object({role:D.enum(["user","assistant"]),content:D.union([qd,Bd,iD])}).passthrough(),v8=jr.extend({description:D.optional(D.string()),messages:D.array(jY)}),kY=sn.extend({method:D.literal("notifications/prompts/list_changed")}),MY=D.object({name:D.string(),description:D.optional(D.string()),inputSchema:D.object({type:D.literal("object"),properties:D.optional(D.object({}).passthrough())}).passthrough()}).passthrough(),LY=Od.extend({method:D.literal("tools/list")}),x8=Td.extend({tools:D.array(MY)}),Pd=jr.extend({content:D.array(D.union([qd,Bd,iD])),isError:D.boolean().default(!1).optional()}),ICe=Pd.or(jr.extend({toolResult:D.unknown()})),g8=Xt.extend({method:D.literal("tools/call"),params:Ir.extend({name:D.string(),arguments:D.optional(D.record(D.unknown()))})}),VY=sn.extend({method:D.literal("notifications/tools/list_changed")}),aD=D.enum(["debug","info","notice","warning","error","critical","alert","emergency"]),UY=Xt.extend({method:D.literal("logging/setLevel"),params:Ir.extend({level:aD})}),_8=sn.extend({method:D.literal("notifications/message"),params:M0.extend({level:aD,logger:D.optional(D.string()),data:D.unknown()})}),WY=D.object({name:D.string().optional()}).passthrough(),$Y=D.object({hints:D.optional(D.array(WY)),costPriority:D.optional(D.number().min(0).max(1)),speedPriority:D.optional(D.number().min(0).max(1)),intelligencePriority:D.optional(D.number().min(0).max(1))}).passthrough(),GY=D.object({role:D.enum(["user","assistant"]),content:D.union([qd,Bd])}).passthrough(),zY=Xt.extend({method:D.literal("sampling/createMessage"),params:Ir.extend({messages:D.array(GY),systemPrompt:D.optional(D.string()),includeContext:D.optional(D.enum(["none","thisServer","allServers"])),temperature:D.optional(D.number()),maxTokens:D.number().int(),stopSequences:D.optional(D.array(D.string())),metadata:D.optional(D.object({}).passthrough()),modelPreferences:D.optional($Y)})}),HY=jr.extend({model:D.string(),stopReason:D.optional(D.enum(["endTurn","stopSequence","maxTokens"]).or(D.string())),role:D.enum(["user","assistant"]),content:D.discriminatedUnion("type",[qd,Bd])}),KY=D.object({type:D.literal("ref/resource"),uri:D.string()}).passthrough(),YY=D.object({type:D.literal("ref/prompt"),name:D.string()}).passthrough(),ZY=Xt.extend({method:D.literal("completion/complete"),params:Ir.extend({ref:D.union([YY,KY]),argument:D.object({name:D.string(),value:D.string()}).passthrough()})}),b8=jr.extend({completion:D.object({values:D.array(D.string()).max(100),total:D.optional(D.number().int()),hasMore:D.optional(D.boolean())}).passthrough()}),JY=D.object({uri:D.string().startsWith("file://"),name:D.optional(D.string())}).passthrough(),XY=Xt.extend({method:D.literal("roots/list")}),QY=jr.extend({roots:D.array(JY)}),eZ=sn.extend({method:D.literal("notifications/roots/list_changed")}),jCe=D.union([Sd,bY,ZY,UY,IY,RY,CY,SY,AY,TY,qY,g8,LY]),kCe=D.union([Cd,Ad,yY,eZ]),MCe=D.union([Ya,HY,QY]),LCe=D.union([Sd,zY,XY]),VCe=D.union([Cd,Ad,_8,BY,OY,VY,kY]),UCe=D.union([Ya,l8,b8,v8,h8,c8,f8,m8,Pd,x8]),Ka=class extends Error{constructor(t,r,n){super(`MCP error ${t}: ${r}`),this.code=t,this.data=n,this.name="McpError"}};var tZ=6e4,Nd=class{constructor(t){this._options=t,this._requestMessageId=0,this._requestHandlers=new Map,this._requestHandlerAbortControllers=new Map,this._notificationHandlers=new Map,this._responseHandlers=new Map,this._progressHandlers=new Map,this._timeoutInfo=new Map,this.setNotificationHandler(Cd,r=>{let n=this._requestHandlerAbortControllers.get(r.params.requestId);n?.abort(r.params.reason)}),this.setNotificationHandler(Ad,r=>{this._onprogress(r)}),this.setRequestHandler(Sd,r=>({}))}_setupTimeout(t,r,n,i){this._timeoutInfo.set(t,{timeoutId:setTimeout(i,r),startTime:Date.now(),timeout:r,maxTotalTimeout:n,onTimeout:i})}_resetTimeout(t){let r=this._timeoutInfo.get(t);if(!r)return!1;let n=Date.now()-r.startTime;if(r.maxTotalTimeout&&n>=r.maxTotalTimeout)throw this._timeoutInfo.delete(t),new Ka(lt.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:r.maxTotalTimeout,totalElapsed:n});return clearTimeout(r.timeoutId),r.timeoutId=setTimeout(r.onTimeout,r.timeout),!0}_cleanupTimeout(t){let r=this._timeoutInfo.get(t);r&&(clearTimeout(r.timeoutId),this._timeoutInfo.delete(t))}async connect(t){this._transport=t,this._transport.onclose=()=>{this._onclose()},this._transport.onerror=r=>{this._onerror(r)},this._transport.onmessage=r=>{"method"in r?"id"in r?this._onrequest(r):this._onnotification(r):this._onresponse(r)},await this._transport.start()}_onclose(){var t;let r=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._transport=void 0,(t=this.onclose)===null||t===void 0||t.call(this);let n=new Ka(lt.ConnectionClosed,"Connection closed");for(let i of r.values())i(n)}_onerror(t){var r;(r=this.onerror)===null||r===void 0||r.call(this,t)}_onnotification(t){var r;let n=(r=this._notificationHandlers.get(t.method))!==null&&r!==void 0?r:this.fallbackNotificationHandler;n!==void 0&&Promise.resolve().then(()=>n(t)).catch(i=>this._onerror(new Error(`Uncaught error in notification handler: ${i}`)))}_onrequest(t){var r,n,i;let a=(r=this._requestHandlers.get(t.method))!==null&&r!==void 0?r:this.fallbackRequestHandler;if(a===void 0){(n=this._transport)===null||n===void 0||n.send({jsonrpc:"2.0",id:t.id,error:{code:lt.MethodNotFound,message:"Method not found"}}).catch(l=>this._onerror(new Error(`Failed to send an error response: ${l}`)));return}let u=new AbortController;this._requestHandlerAbortControllers.set(t.id,u);let p={signal:u.signal,sessionId:(i=this._transport)===null||i===void 0?void 0:i.sessionId};Promise.resolve().then(()=>a(t,p)).then(l=>{var c;if(!u.signal.aborted)return(c=this._transport)===null||c===void 0?void 0:c.send({result:l,jsonrpc:"2.0",id:t.id})},l=>{var c,h;if(!u.signal.aborted)return(c=this._transport)===null||c===void 0?void 0:c.send({jsonrpc:"2.0",id:t.id,error:{code:Number.isSafeInteger(l.code)?l.code:lt.InternalError,message:(h=l.message)!==null&&h!==void 0?h:"Internal error"}})}).catch(l=>this._onerror(new Error(`Failed to send response: ${l}`))).finally(()=>{this._requestHandlerAbortControllers.delete(t.id)})}_onprogress(t){let{progressToken:r,...n}=t.params,i=Number(r),a=this._progressHandlers.get(i);if(!a){this._onerror(new Error(`Received a progress notification for an unknown token: ${JSON.stringify(t)}`));return}let u=this._responseHandlers.get(i);if(this._timeoutInfo.has(i)&&u)try{this._resetTimeout(i)}catch(p){u(p);return}a(n)}_onresponse(t){let r=Number(t.id),n=this._responseHandlers.get(r);if(n===void 0){this._onerror(new Error(`Received a response for an unknown message ID: ${JSON.stringify(t)}`));return}if(this._responseHandlers.delete(r),this._progressHandlers.delete(r),this._cleanupTimeout(r),"result"in t)n(t);else{let i=new Ka(t.error.code,t.error.message,t.error.data);n(i)}}get transport(){return this._transport}async close(){var t;await((t=this._transport)===null||t===void 0?void 0:t.close())}request(t,r,n){return new Promise((i,a)=>{var u,p,l,c;if(!this._transport){a(new Error("Not connected"));return}((u=this._options)===null||u===void 0?void 0:u.enforceStrictCapabilities)===!0&&this.assertCapabilityForMethod(t.method),(p=n?.signal)===null||p===void 0||p.throwIfAborted();let h=this._requestMessageId++,b={...t,jsonrpc:"2.0",id:h};n?.onprogress&&(this._progressHandlers.set(h,n.onprogress),b.params={...t.params,_meta:{progressToken:h}});let w=S=>{var q;this._responseHandlers.delete(h),this._progressHandlers.delete(h),this._cleanupTimeout(h),(q=this._transport)===null||q===void 0||q.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:h,reason:String(S)}}).catch(P=>this._onerror(new Error(`Failed to send cancellation: ${P}`))),a(S)};this._responseHandlers.set(h,S=>{var q;if(!(!((q=n?.signal)===null||q===void 0)&&q.aborted)){if(S instanceof Error)return a(S);try{let P=r.parse(S.result);i(P)}catch(P){a(P)}}}),(l=n?.signal)===null||l===void 0||l.addEventListener("abort",()=>{var S;w((S=n?.signal)===null||S===void 0?void 0:S.reason)});let O=(c=n?.timeout)!==null&&c!==void 0?c:tZ,C=()=>w(new Ka(lt.RequestTimeout,"Request timed out",{timeout:O}));this._setupTimeout(h,O,n?.maxTotalTimeout,C),this._transport.send(b).catch(S=>{this._cleanupTimeout(h),a(S)})})}async notification(t){if(!this._transport)throw new Error("Not connected");this.assertNotificationCapability(t.method);let r={...t,jsonrpc:"2.0"};await this._transport.send(r)}setRequestHandler(t,r){let n=t.shape.method.value;this.assertRequestHandlerCapability(n),this._requestHandlers.set(n,(i,a)=>Promise.resolve(r(t.parse(i),a)))}removeRequestHandler(t){this._requestHandlers.delete(t)}assertCanSetRequestHandler(t){if(this._requestHandlers.has(t))throw new Error(`A request handler for ${t} already exists, which would be overridden`)}setNotificationHandler(t,r){this._notificationHandlers.set(t.shape.method.value,n=>Promise.resolve(r(t.parse(n))))}removeNotificationHandler(t){this._notificationHandlers.delete(t)}};function sD(e,t){return Object.entries(t).reduce((r,[n,i])=>(i&&typeof i=="object"?r[n]=r[n]?{...r[n],...i}:i:r[n]=i,r),{...e})}var Rd=class extends Nd{constructor(t,r){var n;super(r),this._clientInfo=t,this._capabilities=(n=r?.capabilities)!==null&&n!==void 0?n:{}}registerCapabilities(t){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=sD(this._capabilities,t)}assertCapability(t,r){var n;if(!(!((n=this._serverCapabilities)===null||n===void 0)&&n[t]))throw new Error(`Server does not support ${t} (required for ${r})`)}async connect(t){await super.connect(t);try{let r=await this.request({method:"initialize",params:{protocolVersion:d8,capabilities:this._capabilities,clientInfo:this._clientInfo}},l8);if(r===void 0)throw new Error(`Server sent invalid initialize result: ${r}`);if(!Jb.includes(r.protocolVersion))throw new Error(`Server's protocol version is not supported: ${r.protocolVersion}`);this._serverCapabilities=r.capabilities,this._serverVersion=r.serverInfo,this._instructions=r.instructions,await this.notification({method:"notifications/initialized"})}catch(r){throw this.close(),r}}getServerCapabilities(){return this._serverCapabilities}getServerVersion(){return this._serverVersion}getInstructions(){return this._instructions}assertCapabilityForMethod(t){var r,n,i,a,u;switch(t){case"logging/setLevel":if(!(!((r=this._serverCapabilities)===null||r===void 0)&&r.logging))throw new Error(`Server does not support logging (required for ${t})`);break;case"prompts/get":case"prompts/list":if(!(!((n=this._serverCapabilities)===null||n===void 0)&&n.prompts))throw new Error(`Server does not support prompts (required for ${t})`);break;case"resources/list":case"resources/templates/list":case"resources/read":case"resources/subscribe":case"resources/unsubscribe":if(!(!((i=this._serverCapabilities)===null||i===void 0)&&i.resources))throw new Error(`Server does not support resources (required for ${t})`);if(t==="resources/subscribe"&&!this._serverCapabilities.resources.subscribe)throw new Error(`Server does not support resource subscriptions (required for ${t})`);break;case"tools/call":case"tools/list":if(!(!((a=this._serverCapabilities)===null||a===void 0)&&a.tools))throw new Error(`Server does not support tools (required for ${t})`);break;case"completion/complete":if(!(!((u=this._serverCapabilities)===null||u===void 0)&&u.prompts))throw new Error(`Server does not support prompts (required for ${t})`);break;case"initialize":break;case"ping":break}}assertNotificationCapability(t){var r;switch(t){case"notifications/roots/list_changed":if(!(!((r=this._capabilities.roots)===null||r===void 0)&&r.listChanged))throw new Error(`Client does not support roots list changed notifications (required for ${t})`);break;case"notifications/initialized":break;case"notifications/cancelled":break;case"notifications/progress":break}}assertRequestHandlerCapability(t){switch(t){case"sampling/createMessage":if(!this._capabilities.sampling)throw new Error(`Client does not support sampling capability (required for ${t})`);break;case"roots/list":if(!this._capabilities.roots)throw new Error(`Client does not support roots capability (required for ${t})`);break;case"ping":break}}async ping(t){return this.request({method:"ping"},Ya,t)}async complete(t,r){return this.request({method:"completion/complete",params:t},b8,r)}async setLoggingLevel(t,r){return this.request({method:"logging/setLevel",params:{level:t}},Ya,r)}async getPrompt(t,r){return this.request({method:"prompts/get",params:t},v8,r)}async listPrompts(t,r){return this.request({method:"prompts/list",params:t},h8,r)}async listResources(t,r){return this.request({method:"resources/list",params:t},c8,r)}async listResourceTemplates(t,r){return this.request({method:"resources/templates/list",params:t},f8,r)}async readResource(t,r){return this.request({method:"resources/read",params:t},m8,r)}async subscribeResource(t,r){return this.request({method:"resources/subscribe",params:t},Ya,r)}async unsubscribeResource(t,r){return this.request({method:"resources/unsubscribe",params:t},Ya,r)}async callTool(t,r=Pd,n){return this.request({method:"tools/call",params:t},r,n)}async listTools(t,r){return this.request({method:"tools/list",params:t},x8,r)}async sendRootsListChanged(){return this.notification({method:"notifications/roots/list_changed"})}};var ZD=oe(KD(),1),L0=oe(require("node:process"),1);var jd=class{append(t){this._buffer=this._buffer?Buffer.concat([this._buffer,t]):t}readMessage(){if(!this._buffer)return null;let t=this._buffer.indexOf(`
|
|
83
|
+
`+r)}function js(e,t,r,n,i){if(e.listenerCount("wsClientError")){let a=new Error(i);Error.captureStackTrace(a,js),e.emit("wsClientError",a,r,t)}else xp(r,n,i)}});var w4=oe(Ge());var no=["claude","cline","windsurf","roo-code","witsy","enconvo","cursor","vscode","vscode-insiders"];var i8="https://smithery.ai/api/track";var ye;(function(e){e.assertEqual=i=>i;function t(i){}e.assertIs=t;function r(i){throw new Error}e.assertNever=r,e.arrayToEnum=i=>{let a={};for(let u of i)a[u]=u;return a},e.getValidEnumValues=i=>{let a=e.objectKeys(i).filter(p=>typeof i[i[p]]!="number"),u={};for(let p of a)u[p]=i[p];return e.objectValues(u)},e.objectValues=i=>e.objectKeys(i).map(function(a){return i[a]}),e.objectKeys=typeof Object.keys=="function"?i=>Object.keys(i):i=>{let a=[];for(let u in i)Object.prototype.hasOwnProperty.call(i,u)&&a.push(u);return a},e.find=(i,a)=>{for(let u of i)if(a(u))return u},e.isInteger=typeof Number.isInteger=="function"?i=>Number.isInteger(i):i=>typeof i=="number"&&isFinite(i)&&Math.floor(i)===i;function n(i,a=" | "){return i.map(u=>typeof u=="string"?`'${u}'`:u).join(a)}e.joinValues=n,e.jsonStringifyReplacer=(i,a)=>typeof a=="bigint"?a.toString():a})(ye||(ye={}));var s8;(function(e){e.mergeShapes=(t,r)=>({...t,...r})})(s8||(s8={}));var W=ye.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Ln=e=>{switch(typeof e){case"undefined":return W.undefined;case"string":return W.string;case"number":return isNaN(e)?W.nan:W.number;case"boolean":return W.boolean;case"function":return W.function;case"bigint":return W.bigint;case"symbol":return W.symbol;case"object":return Array.isArray(e)?W.array:e===null?W.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?W.promise:typeof Map<"u"&&e instanceof Map?W.map:typeof Set<"u"&&e instanceof Set?W.set:typeof Date<"u"&&e instanceof Date?W.date:W.object;default:return W.unknown}},M=ye.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"]),oK=e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:"),Zt=class e extends Error{get errors(){return this.issues}constructor(t){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};let r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=t}format(t){let r=t||function(a){return a.message},n={_errors:[]},i=a=>{for(let u of a.issues)if(u.code==="invalid_union")u.unionErrors.map(i);else if(u.code==="invalid_return_type")i(u.returnTypeError);else if(u.code==="invalid_arguments")i(u.argumentsError);else if(u.path.length===0)n._errors.push(r(u));else{let p=n,l=0;for(;l<u.path.length;){let c=u.path[l];l===u.path.length-1?(p[c]=p[c]||{_errors:[]},p[c]._errors.push(r(u))):p[c]=p[c]||{_errors:[]},p=p[c],l++}}};return i(this),n}static assert(t){if(!(t instanceof e))throw new Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,ye.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(t=r=>r.message){let r={},n=[];for(let i of this.issues)i.path.length>0?(r[i.path[0]]=r[i.path[0]]||[],r[i.path[0]].push(t(i))):n.push(t(i));return{formErrors:n,fieldErrors:r}}get formErrors(){return this.flatten()}};Zt.create=e=>new Zt(e);var so=(e,t)=>{let r;switch(e.code){case M.invalid_type:e.received===W.undefined?r="Required":r=`Expected ${e.expected}, received ${e.received}`;break;case M.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(e.expected,ye.jsonStringifyReplacer)}`;break;case M.unrecognized_keys:r=`Unrecognized key(s) in object: ${ye.joinValues(e.keys,", ")}`;break;case M.invalid_union:r="Invalid input";break;case M.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${ye.joinValues(e.options)}`;break;case M.invalid_enum_value:r=`Invalid enum value. Expected ${ye.joinValues(e.options)}, received '${e.received}'`;break;case M.invalid_arguments:r="Invalid function arguments";break;case M.invalid_return_type:r="Invalid function return type";break;case M.invalid_date:r="Invalid date";break;case M.invalid_string:typeof e.validation=="object"?"includes"in e.validation?(r=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position=="number"&&(r=`${r} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?r=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?r=`Invalid input: must end with "${e.validation.endsWith}"`:ye.assertNever(e.validation):e.validation!=="regex"?r=`Invalid ${e.validation}`:r="Invalid";break;case M.too_small:e.type==="array"?r=`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:e.type==="string"?r=`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:e.type==="number"?r=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="date"?r=`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:r="Invalid input";break;case M.too_big:e.type==="array"?r=`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:e.type==="string"?r=`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:e.type==="number"?r=`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="bigint"?r=`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="date"?r=`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:r="Invalid input";break;case M.custom:r="Invalid input";break;case M.invalid_intersection_types:r="Intersection results could not be merged";break;case M.not_multiple_of:r=`Number must be a multiple of ${e.multipleOf}`;break;case M.not_finite:r="Number must be finite";break;default:r=t.defaultError,ye.assertNever(e)}return{message:r}},Vb=so;function uK(e){Vb=e}function xd(){return Vb}var gd=e=>{let{data:t,path:r,errorMaps:n,issueData:i}=e,a=[...r,...i.path||[]],u={...i,path:a};if(i.message!==void 0)return{...i,path:a,message:i.message};let p="",l=n.filter(c=>!!c).slice().reverse();for(let c of l)p=c(u,{data:t,defaultError:p}).message;return{...i,path:a,message:p}},pK=[];function V(e,t){let r=xd(),n=gd({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,r,r===so?void 0:so].filter(i=>!!i)});e.common.issues.push(n)}var At=class e{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(t,r){let n=[];for(let i of r){if(i.status==="aborted")return ne;i.status==="dirty"&&t.dirty(),n.push(i.value)}return{status:t.value,value:n}}static async mergeObjectAsync(t,r){let n=[];for(let i of r){let a=await i.key,u=await i.value;n.push({key:a,value:u})}return e.mergeObjectSync(t,n)}static mergeObjectSync(t,r){let n={};for(let i of r){let{key:a,value:u}=i;if(a.status==="aborted"||u.status==="aborted")return ne;a.status==="dirty"&&t.dirty(),u.status==="dirty"&&t.dirty(),a.value!=="__proto__"&&(typeof u.value<"u"||i.alwaysSet)&&(n[a.value]=u.value)}return{status:t.value,value:n}}},ne=Object.freeze({status:"aborted"}),ao=e=>({status:"dirty",value:e}),Pt=e=>({status:"valid",value:e}),o8=e=>e.status==="aborted",u8=e=>e.status==="dirty",Ba=e=>e.status==="valid",I0=e=>typeof Promise<"u"&&e instanceof Promise;function _d(e,t,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof t=="function"?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(e):n?n.value:t.get(e)}function Ub(e,t,r,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof t=="function"?e!==t||!i:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(e,r):i?i.value=r:t.set(e,r),r}var Y;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t?.message})(Y||(Y={}));var N0,R0,fr=class{constructor(t,r,n,i){this._cachedPath=[],this.parent=t,this.data=r,this._path=n,this._key=i}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},kb=(e,t)=>{if(Ba(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let r=new Zt(e.common.issues);return this._error=r,this._error}}};function pe(e){if(!e)return{};let{errorMap:t,invalid_type_error:r,required_error:n,description:i}=e;if(t&&(r||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:i}:{errorMap:(u,p)=>{var l,c;let{message:h}=e;return u.code==="invalid_enum_value"?{message:h??p.defaultError}:typeof p.data>"u"?{message:(l=h??n)!==null&&l!==void 0?l:p.defaultError}:u.code!=="invalid_type"?{message:p.defaultError}:{message:(c=h??r)!==null&&c!==void 0?c:p.defaultError}},description:i}}var de=class{get description(){return this._def.description}_getType(t){return Ln(t.data)}_getOrReturnCtx(t,r){return r||{common:t.parent.common,data:t.data,parsedType:Ln(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new At,ctx:{common:t.parent.common,data:t.data,parsedType:Ln(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){let r=this._parse(t);if(I0(r))throw new Error("Synchronous parse encountered promise.");return r}_parseAsync(t){let r=this._parse(t);return Promise.resolve(r)}parse(t,r){let n=this.safeParse(t,r);if(n.success)return n.data;throw n.error}safeParse(t,r){var n;let i={common:{issues:[],async:(n=r?.async)!==null&&n!==void 0?n:!1,contextualErrorMap:r?.errorMap},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Ln(t)},a=this._parseSync({data:t,path:i.path,parent:i});return kb(i,a)}"~validate"(t){var r,n;let i={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Ln(t)};if(!this["~standard"].async)try{let a=this._parseSync({data:t,path:[],parent:i});return Ba(a)?{value:a.value}:{issues:i.common.issues}}catch(a){!((n=(r=a?.message)===null||r===void 0?void 0:r.toLowerCase())===null||n===void 0)&&n.includes("encountered")&&(this["~standard"].async=!0),i.common={issues:[],async:!0}}return this._parseAsync({data:t,path:[],parent:i}).then(a=>Ba(a)?{value:a.value}:{issues:i.common.issues})}async parseAsync(t,r){let n=await this.safeParseAsync(t,r);if(n.success)return n.data;throw n.error}async safeParseAsync(t,r){let n={common:{issues:[],contextualErrorMap:r?.errorMap,async:!0},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Ln(t)},i=this._parse({data:t,path:n.path,parent:n}),a=await(I0(i)?i:Promise.resolve(i));return kb(n,a)}refine(t,r){let n=i=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(i):r;return this._refinement((i,a)=>{let u=t(i),p=()=>a.addIssue({code:M.custom,...n(i)});return typeof Promise<"u"&&u instanceof Promise?u.then(l=>l?!0:(p(),!1)):u?!0:(p(),!1)})}refinement(t,r){return this._refinement((n,i)=>t(n)?!0:(i.addIssue(typeof r=="function"?r(n,i):r),!1))}_refinement(t){return new Jt({schema:this,typeName:re.ZodEffects,effect:{type:"refinement",refinement:t}})}superRefine(t){return this._refinement(t)}constructor(t){this.spa=this.safeParseAsync,this._def=t,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:r=>this["~validate"](r)}}optional(){return cr.create(this,this._def)}nullable(){return an.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Un.create(this)}promise(){return Ti.create(this,this._def)}or(t){return Ma.create([this,t],this._def)}and(t){return La.create(this,t,this._def)}transform(t){return new Jt({...pe(this._def),schema:this,typeName:re.ZodEffects,effect:{type:"transform",transform:t}})}default(t){let r=typeof t=="function"?t:()=>t;return new Ga({...pe(this._def),innerType:this,defaultValue:r,typeName:re.ZodDefault})}brand(){return new j0({typeName:re.ZodBranded,type:this,...pe(this._def)})}catch(t){let r=typeof t=="function"?t:()=>t;return new za({...pe(this._def),innerType:this,catchValue:r,typeName:re.ZodCatch})}describe(t){let r=this.constructor;return new r({...this._def,description:t})}pipe(t){return k0.create(this,t)}readonly(){return Ha.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},dK=/^c[^\s-]{8,}$/i,lK=/^[0-9a-z]+$/,cK=/^[0-9A-HJKMNP-TV-Z]{26}$/i,fK=/^[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,mK=/^[a-z0-9_-]{21}$/i,hK=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,vK=/^[-+]?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)?)??$/,xK=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,gK="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",a8,_K=/^(?:(?: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])$/,bK=/^(?:(?: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])$/,DK=/^(([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]))$/,yK=/^(([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])$/,EK=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,wK=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Wb="((\\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])))",FK=new RegExp(`^${Wb}$`);function $b(e){let t="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return e.precision?t=`${t}\\.\\d{${e.precision}}`:e.precision==null&&(t=`${t}(\\.\\d+)?`),t}function CK(e){return new RegExp(`^${$b(e)}$`)}function Gb(e){let t=`${Wb}T${$b(e)}`,r=[];return r.push(e.local?"Z?":"Z"),e.offset&&r.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${r.join("|")})`,new RegExp(`^${t}$`)}function SK(e,t){return!!((t==="v4"||!t)&&_K.test(e)||(t==="v6"||!t)&&DK.test(e))}function AK(e,t){if(!hK.test(e))return!1;try{let[r]=e.split("."),n=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),i=JSON.parse(atob(n));return!(typeof i!="object"||i===null||!i.typ||!i.alg||t&&i.alg!==t)}catch{return!1}}function OK(e,t){return!!((t==="v4"||!t)&&bK.test(e)||(t==="v6"||!t)&&yK.test(e))}var Ai=class e extends de{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==W.string){let a=this._getOrReturnCtx(t);return V(a,{code:M.invalid_type,expected:W.string,received:a.parsedType}),ne}let n=new At,i;for(let a of this._def.checks)if(a.kind==="min")t.data.length<a.value&&(i=this._getOrReturnCtx(t,i),V(i,{code:M.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),n.dirty());else if(a.kind==="max")t.data.length>a.value&&(i=this._getOrReturnCtx(t,i),V(i,{code:M.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),n.dirty());else if(a.kind==="length"){let u=t.data.length>a.value,p=t.data.length<a.value;(u||p)&&(i=this._getOrReturnCtx(t,i),u?V(i,{code:M.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}):p&&V(i,{code:M.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}),n.dirty())}else if(a.kind==="email")xK.test(t.data)||(i=this._getOrReturnCtx(t,i),V(i,{validation:"email",code:M.invalid_string,message:a.message}),n.dirty());else if(a.kind==="emoji")a8||(a8=new RegExp(gK,"u")),a8.test(t.data)||(i=this._getOrReturnCtx(t,i),V(i,{validation:"emoji",code:M.invalid_string,message:a.message}),n.dirty());else if(a.kind==="uuid")fK.test(t.data)||(i=this._getOrReturnCtx(t,i),V(i,{validation:"uuid",code:M.invalid_string,message:a.message}),n.dirty());else if(a.kind==="nanoid")mK.test(t.data)||(i=this._getOrReturnCtx(t,i),V(i,{validation:"nanoid",code:M.invalid_string,message:a.message}),n.dirty());else if(a.kind==="cuid")dK.test(t.data)||(i=this._getOrReturnCtx(t,i),V(i,{validation:"cuid",code:M.invalid_string,message:a.message}),n.dirty());else if(a.kind==="cuid2")lK.test(t.data)||(i=this._getOrReturnCtx(t,i),V(i,{validation:"cuid2",code:M.invalid_string,message:a.message}),n.dirty());else if(a.kind==="ulid")cK.test(t.data)||(i=this._getOrReturnCtx(t,i),V(i,{validation:"ulid",code:M.invalid_string,message:a.message}),n.dirty());else if(a.kind==="url")try{new URL(t.data)}catch{i=this._getOrReturnCtx(t,i),V(i,{validation:"url",code:M.invalid_string,message:a.message}),n.dirty()}else a.kind==="regex"?(a.regex.lastIndex=0,a.regex.test(t.data)||(i=this._getOrReturnCtx(t,i),V(i,{validation:"regex",code:M.invalid_string,message:a.message}),n.dirty())):a.kind==="trim"?t.data=t.data.trim():a.kind==="includes"?t.data.includes(a.value,a.position)||(i=this._getOrReturnCtx(t,i),V(i,{code:M.invalid_string,validation:{includes:a.value,position:a.position},message:a.message}),n.dirty()):a.kind==="toLowerCase"?t.data=t.data.toLowerCase():a.kind==="toUpperCase"?t.data=t.data.toUpperCase():a.kind==="startsWith"?t.data.startsWith(a.value)||(i=this._getOrReturnCtx(t,i),V(i,{code:M.invalid_string,validation:{startsWith:a.value},message:a.message}),n.dirty()):a.kind==="endsWith"?t.data.endsWith(a.value)||(i=this._getOrReturnCtx(t,i),V(i,{code:M.invalid_string,validation:{endsWith:a.value},message:a.message}),n.dirty()):a.kind==="datetime"?Gb(a).test(t.data)||(i=this._getOrReturnCtx(t,i),V(i,{code:M.invalid_string,validation:"datetime",message:a.message}),n.dirty()):a.kind==="date"?FK.test(t.data)||(i=this._getOrReturnCtx(t,i),V(i,{code:M.invalid_string,validation:"date",message:a.message}),n.dirty()):a.kind==="time"?CK(a).test(t.data)||(i=this._getOrReturnCtx(t,i),V(i,{code:M.invalid_string,validation:"time",message:a.message}),n.dirty()):a.kind==="duration"?vK.test(t.data)||(i=this._getOrReturnCtx(t,i),V(i,{validation:"duration",code:M.invalid_string,message:a.message}),n.dirty()):a.kind==="ip"?SK(t.data,a.version)||(i=this._getOrReturnCtx(t,i),V(i,{validation:"ip",code:M.invalid_string,message:a.message}),n.dirty()):a.kind==="jwt"?AK(t.data,a.alg)||(i=this._getOrReturnCtx(t,i),V(i,{validation:"jwt",code:M.invalid_string,message:a.message}),n.dirty()):a.kind==="cidr"?OK(t.data,a.version)||(i=this._getOrReturnCtx(t,i),V(i,{validation:"cidr",code:M.invalid_string,message:a.message}),n.dirty()):a.kind==="base64"?EK.test(t.data)||(i=this._getOrReturnCtx(t,i),V(i,{validation:"base64",code:M.invalid_string,message:a.message}),n.dirty()):a.kind==="base64url"?wK.test(t.data)||(i=this._getOrReturnCtx(t,i),V(i,{validation:"base64url",code:M.invalid_string,message:a.message}),n.dirty()):ye.assertNever(a);return{status:n.value,value:t.data}}_regex(t,r,n){return this.refinement(i=>t.test(i),{validation:r,code:M.invalid_string,...Y.errToObj(n)})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...Y.errToObj(t)})}url(t){return this._addCheck({kind:"url",...Y.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...Y.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...Y.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...Y.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...Y.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...Y.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...Y.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",...Y.errToObj(t)})}base64url(t){return this._addCheck({kind:"base64url",...Y.errToObj(t)})}jwt(t){return this._addCheck({kind:"jwt",...Y.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...Y.errToObj(t)})}cidr(t){return this._addCheck({kind:"cidr",...Y.errToObj(t)})}datetime(t){var r,n;return typeof t=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:t}):this._addCheck({kind:"datetime",precision:typeof t?.precision>"u"?null:t?.precision,offset:(r=t?.offset)!==null&&r!==void 0?r:!1,local:(n=t?.local)!==null&&n!==void 0?n:!1,...Y.errToObj(t?.message)})}date(t){return this._addCheck({kind:"date",message:t})}time(t){return typeof t=="string"?this._addCheck({kind:"time",precision:null,message:t}):this._addCheck({kind:"time",precision:typeof t?.precision>"u"?null:t?.precision,...Y.errToObj(t?.message)})}duration(t){return this._addCheck({kind:"duration",...Y.errToObj(t)})}regex(t,r){return this._addCheck({kind:"regex",regex:t,...Y.errToObj(r)})}includes(t,r){return this._addCheck({kind:"includes",value:t,position:r?.position,...Y.errToObj(r?.message)})}startsWith(t,r){return this._addCheck({kind:"startsWith",value:t,...Y.errToObj(r)})}endsWith(t,r){return this._addCheck({kind:"endsWith",value:t,...Y.errToObj(r)})}min(t,r){return this._addCheck({kind:"min",value:t,...Y.errToObj(r)})}max(t,r){return this._addCheck({kind:"max",value:t,...Y.errToObj(r)})}length(t,r){return this._addCheck({kind:"length",value:t,...Y.errToObj(r)})}nonempty(t){return this.min(1,Y.errToObj(t))}trim(){return new e({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new e({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new e({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(t=>t.kind==="datetime")}get isDate(){return!!this._def.checks.find(t=>t.kind==="date")}get isTime(){return!!this._def.checks.find(t=>t.kind==="time")}get isDuration(){return!!this._def.checks.find(t=>t.kind==="duration")}get isEmail(){return!!this._def.checks.find(t=>t.kind==="email")}get isURL(){return!!this._def.checks.find(t=>t.kind==="url")}get isEmoji(){return!!this._def.checks.find(t=>t.kind==="emoji")}get isUUID(){return!!this._def.checks.find(t=>t.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(t=>t.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(t=>t.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(t=>t.kind==="cuid2")}get isULID(){return!!this._def.checks.find(t=>t.kind==="ulid")}get isIP(){return!!this._def.checks.find(t=>t.kind==="ip")}get isCIDR(){return!!this._def.checks.find(t=>t.kind==="cidr")}get isBase64(){return!!this._def.checks.find(t=>t.kind==="base64")}get isBase64url(){return!!this._def.checks.find(t=>t.kind==="base64url")}get minLength(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxLength(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t}};Ai.create=e=>{var t;return new Ai({checks:[],typeName:re.ZodString,coerce:(t=e?.coerce)!==null&&t!==void 0?t:!1,...pe(e)})};function TK(e,t){let r=(e.toString().split(".")[1]||"").length,n=(t.toString().split(".")[1]||"").length,i=r>n?r:n,a=parseInt(e.toFixed(i).replace(".","")),u=parseInt(t.toFixed(i).replace(".",""));return a%u/Math.pow(10,i)}var Pa=class e extends de{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(t){if(this._def.coerce&&(t.data=Number(t.data)),this._getType(t)!==W.number){let a=this._getOrReturnCtx(t);return V(a,{code:M.invalid_type,expected:W.number,received:a.parsedType}),ne}let n,i=new At;for(let a of this._def.checks)a.kind==="int"?ye.isInteger(t.data)||(n=this._getOrReturnCtx(t,n),V(n,{code:M.invalid_type,expected:"integer",received:"float",message:a.message}),i.dirty()):a.kind==="min"?(a.inclusive?t.data<a.value:t.data<=a.value)&&(n=this._getOrReturnCtx(t,n),V(n,{code:M.too_small,minimum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),i.dirty()):a.kind==="max"?(a.inclusive?t.data>a.value:t.data>=a.value)&&(n=this._getOrReturnCtx(t,n),V(n,{code:M.too_big,maximum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),i.dirty()):a.kind==="multipleOf"?TK(t.data,a.value)!==0&&(n=this._getOrReturnCtx(t,n),V(n,{code:M.not_multiple_of,multipleOf:a.value,message:a.message}),i.dirty()):a.kind==="finite"?Number.isFinite(t.data)||(n=this._getOrReturnCtx(t,n),V(n,{code:M.not_finite,message:a.message}),i.dirty()):ye.assertNever(a);return{status:i.value,value:t.data}}gte(t,r){return this.setLimit("min",t,!0,Y.toString(r))}gt(t,r){return this.setLimit("min",t,!1,Y.toString(r))}lte(t,r){return this.setLimit("max",t,!0,Y.toString(r))}lt(t,r){return this.setLimit("max",t,!1,Y.toString(r))}setLimit(t,r,n,i){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:n,message:Y.toString(i)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:Y.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:Y.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:Y.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:Y.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:Y.toString(t)})}multipleOf(t,r){return this._addCheck({kind:"multipleOf",value:t,message:Y.toString(r)})}finite(t){return this._addCheck({kind:"finite",message:Y.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:Y.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:Y.toString(t)})}get minValue(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxValue(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t}get isInt(){return!!this._def.checks.find(t=>t.kind==="int"||t.kind==="multipleOf"&&ye.isInteger(t.value))}get isFinite(){let t=null,r=null;for(let n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(r===null||n.value>r)&&(r=n.value):n.kind==="max"&&(t===null||n.value<t)&&(t=n.value)}return Number.isFinite(r)&&Number.isFinite(t)}};Pa.create=e=>new Pa({checks:[],typeName:re.ZodNumber,coerce:e?.coerce||!1,...pe(e)});var Na=class e extends de{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(t){if(this._def.coerce)try{t.data=BigInt(t.data)}catch{return this._getInvalidInput(t)}if(this._getType(t)!==W.bigint)return this._getInvalidInput(t);let n,i=new At;for(let a of this._def.checks)a.kind==="min"?(a.inclusive?t.data<a.value:t.data<=a.value)&&(n=this._getOrReturnCtx(t,n),V(n,{code:M.too_small,type:"bigint",minimum:a.value,inclusive:a.inclusive,message:a.message}),i.dirty()):a.kind==="max"?(a.inclusive?t.data>a.value:t.data>=a.value)&&(n=this._getOrReturnCtx(t,n),V(n,{code:M.too_big,type:"bigint",maximum:a.value,inclusive:a.inclusive,message:a.message}),i.dirty()):a.kind==="multipleOf"?t.data%a.value!==BigInt(0)&&(n=this._getOrReturnCtx(t,n),V(n,{code:M.not_multiple_of,multipleOf:a.value,message:a.message}),i.dirty()):ye.assertNever(a);return{status:i.value,value:t.data}}_getInvalidInput(t){let r=this._getOrReturnCtx(t);return V(r,{code:M.invalid_type,expected:W.bigint,received:r.parsedType}),ne}gte(t,r){return this.setLimit("min",t,!0,Y.toString(r))}gt(t,r){return this.setLimit("min",t,!1,Y.toString(r))}lte(t,r){return this.setLimit("max",t,!0,Y.toString(r))}lt(t,r){return this.setLimit("max",t,!1,Y.toString(r))}setLimit(t,r,n,i){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:n,message:Y.toString(i)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}positive(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:Y.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:Y.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:Y.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:Y.toString(t)})}multipleOf(t,r){return this._addCheck({kind:"multipleOf",value:t,message:Y.toString(r)})}get minValue(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxValue(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t}};Na.create=e=>{var t;return new Na({checks:[],typeName:re.ZodBigInt,coerce:(t=e?.coerce)!==null&&t!==void 0?t:!1,...pe(e)})};var Ra=class extends de{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==W.boolean){let n=this._getOrReturnCtx(t);return V(n,{code:M.invalid_type,expected:W.boolean,received:n.parsedType}),ne}return Pt(t.data)}};Ra.create=e=>new Ra({typeName:re.ZodBoolean,coerce:e?.coerce||!1,...pe(e)});var Ia=class e extends de{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==W.date){let a=this._getOrReturnCtx(t);return V(a,{code:M.invalid_type,expected:W.date,received:a.parsedType}),ne}if(isNaN(t.data.getTime())){let a=this._getOrReturnCtx(t);return V(a,{code:M.invalid_date}),ne}let n=new At,i;for(let a of this._def.checks)a.kind==="min"?t.data.getTime()<a.value&&(i=this._getOrReturnCtx(t,i),V(i,{code:M.too_small,message:a.message,inclusive:!0,exact:!1,minimum:a.value,type:"date"}),n.dirty()):a.kind==="max"?t.data.getTime()>a.value&&(i=this._getOrReturnCtx(t,i),V(i,{code:M.too_big,message:a.message,inclusive:!0,exact:!1,maximum:a.value,type:"date"}),n.dirty()):ye.assertNever(a);return{status:n.value,value:new Date(t.data.getTime())}}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}min(t,r){return this._addCheck({kind:"min",value:t.getTime(),message:Y.toString(r)})}max(t,r){return this._addCheck({kind:"max",value:t.getTime(),message:Y.toString(r)})}get minDate(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t!=null?new Date(t):null}get maxDate(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t!=null?new Date(t):null}};Ia.create=e=>new Ia({checks:[],coerce:e?.coerce||!1,typeName:re.ZodDate,...pe(e)});var oo=class extends de{_parse(t){if(this._getType(t)!==W.symbol){let n=this._getOrReturnCtx(t);return V(n,{code:M.invalid_type,expected:W.symbol,received:n.parsedType}),ne}return Pt(t.data)}};oo.create=e=>new oo({typeName:re.ZodSymbol,...pe(e)});var ja=class extends de{_parse(t){if(this._getType(t)!==W.undefined){let n=this._getOrReturnCtx(t);return V(n,{code:M.invalid_type,expected:W.undefined,received:n.parsedType}),ne}return Pt(t.data)}};ja.create=e=>new ja({typeName:re.ZodUndefined,...pe(e)});var ka=class extends de{_parse(t){if(this._getType(t)!==W.null){let n=this._getOrReturnCtx(t);return V(n,{code:M.invalid_type,expected:W.null,received:n.parsedType}),ne}return Pt(t.data)}};ka.create=e=>new ka({typeName:re.ZodNull,...pe(e)});var Oi=class extends de{constructor(){super(...arguments),this._any=!0}_parse(t){return Pt(t.data)}};Oi.create=e=>new Oi({typeName:re.ZodAny,...pe(e)});var Vn=class extends de{constructor(){super(...arguments),this._unknown=!0}_parse(t){return Pt(t.data)}};Vn.create=e=>new Vn({typeName:re.ZodUnknown,...pe(e)});var Rr=class extends de{_parse(t){let r=this._getOrReturnCtx(t);return V(r,{code:M.invalid_type,expected:W.never,received:r.parsedType}),ne}};Rr.create=e=>new Rr({typeName:re.ZodNever,...pe(e)});var uo=class extends de{_parse(t){if(this._getType(t)!==W.undefined){let n=this._getOrReturnCtx(t);return V(n,{code:M.invalid_type,expected:W.void,received:n.parsedType}),ne}return Pt(t.data)}};uo.create=e=>new uo({typeName:re.ZodVoid,...pe(e)});var Un=class e extends de{_parse(t){let{ctx:r,status:n}=this._processInputParams(t),i=this._def;if(r.parsedType!==W.array)return V(r,{code:M.invalid_type,expected:W.array,received:r.parsedType}),ne;if(i.exactLength!==null){let u=r.data.length>i.exactLength.value,p=r.data.length<i.exactLength.value;(u||p)&&(V(r,{code:u?M.too_big:M.too_small,minimum:p?i.exactLength.value:void 0,maximum:u?i.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:i.exactLength.message}),n.dirty())}if(i.minLength!==null&&r.data.length<i.minLength.value&&(V(r,{code:M.too_small,minimum:i.minLength.value,type:"array",inclusive:!0,exact:!1,message:i.minLength.message}),n.dirty()),i.maxLength!==null&&r.data.length>i.maxLength.value&&(V(r,{code:M.too_big,maximum:i.maxLength.value,type:"array",inclusive:!0,exact:!1,message:i.maxLength.message}),n.dirty()),r.common.async)return Promise.all([...r.data].map((u,p)=>i.type._parseAsync(new fr(r,u,r.path,p)))).then(u=>At.mergeArray(n,u));let a=[...r.data].map((u,p)=>i.type._parseSync(new fr(r,u,r.path,p)));return At.mergeArray(n,a)}get element(){return this._def.type}min(t,r){return new e({...this._def,minLength:{value:t,message:Y.toString(r)}})}max(t,r){return new e({...this._def,maxLength:{value:t,message:Y.toString(r)}})}length(t,r){return new e({...this._def,exactLength:{value:t,message:Y.toString(r)}})}nonempty(t){return this.min(1,t)}};Un.create=(e,t)=>new Un({type:e,minLength:null,maxLength:null,exactLength:null,typeName:re.ZodArray,...pe(t)});function io(e){if(e instanceof kt){let t={};for(let r in e.shape){let n=e.shape[r];t[r]=cr.create(io(n))}return new kt({...e._def,shape:()=>t})}else return e instanceof Un?new Un({...e._def,type:io(e.element)}):e instanceof cr?cr.create(io(e.unwrap())):e instanceof an?an.create(io(e.unwrap())):e instanceof nn?nn.create(e.items.map(t=>io(t))):e}var kt=class e extends de{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let t=this._def.shape(),r=ye.objectKeys(t);return this._cached={shape:t,keys:r}}_parse(t){if(this._getType(t)!==W.object){let c=this._getOrReturnCtx(t);return V(c,{code:M.invalid_type,expected:W.object,received:c.parsedType}),ne}let{status:n,ctx:i}=this._processInputParams(t),{shape:a,keys:u}=this._getCached(),p=[];if(!(this._def.catchall instanceof Rr&&this._def.unknownKeys==="strip"))for(let c in i.data)u.includes(c)||p.push(c);let l=[];for(let c of u){let h=a[c],b=i.data[c];l.push({key:{status:"valid",value:c},value:h._parse(new fr(i,b,i.path,c)),alwaysSet:c in i.data})}if(this._def.catchall instanceof Rr){let c=this._def.unknownKeys;if(c==="passthrough")for(let h of p)l.push({key:{status:"valid",value:h},value:{status:"valid",value:i.data[h]}});else if(c==="strict")p.length>0&&(V(i,{code:M.unrecognized_keys,keys:p}),n.dirty());else if(c!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let c=this._def.catchall;for(let h of p){let b=i.data[h];l.push({key:{status:"valid",value:h},value:c._parse(new fr(i,b,i.path,h)),alwaysSet:h in i.data})}}return i.common.async?Promise.resolve().then(async()=>{let c=[];for(let h of l){let b=await h.key,w=await h.value;c.push({key:b,value:w,alwaysSet:h.alwaysSet})}return c}).then(c=>At.mergeObjectSync(n,c)):At.mergeObjectSync(n,l)}get shape(){return this._def.shape()}strict(t){return Y.errToObj,new e({...this._def,unknownKeys:"strict",...t!==void 0?{errorMap:(r,n)=>{var i,a,u,p;let l=(u=(a=(i=this._def).errorMap)===null||a===void 0?void 0:a.call(i,r,n).message)!==null&&u!==void 0?u:n.defaultError;return r.code==="unrecognized_keys"?{message:(p=Y.errToObj(t).message)!==null&&p!==void 0?p:l}:{message:l}}}:{}})}strip(){return new e({...this._def,unknownKeys:"strip"})}passthrough(){return new e({...this._def,unknownKeys:"passthrough"})}extend(t){return new e({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new e({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:re.ZodObject})}setKey(t,r){return this.augment({[t]:r})}catchall(t){return new e({...this._def,catchall:t})}pick(t){let r={};return ye.objectKeys(t).forEach(n=>{t[n]&&this.shape[n]&&(r[n]=this.shape[n])}),new e({...this._def,shape:()=>r})}omit(t){let r={};return ye.objectKeys(this.shape).forEach(n=>{t[n]||(r[n]=this.shape[n])}),new e({...this._def,shape:()=>r})}deepPartial(){return io(this)}partial(t){let r={};return ye.objectKeys(this.shape).forEach(n=>{let i=this.shape[n];t&&!t[n]?r[n]=i:r[n]=i.optional()}),new e({...this._def,shape:()=>r})}required(t){let r={};return ye.objectKeys(this.shape).forEach(n=>{if(t&&!t[n])r[n]=this.shape[n];else{let a=this.shape[n];for(;a instanceof cr;)a=a._def.innerType;r[n]=a}}),new e({...this._def,shape:()=>r})}keyof(){return zb(ye.objectKeys(this.shape))}};kt.create=(e,t)=>new kt({shape:()=>e,unknownKeys:"strip",catchall:Rr.create(),typeName:re.ZodObject,...pe(t)});kt.strictCreate=(e,t)=>new kt({shape:()=>e,unknownKeys:"strict",catchall:Rr.create(),typeName:re.ZodObject,...pe(t)});kt.lazycreate=(e,t)=>new kt({shape:e,unknownKeys:"strip",catchall:Rr.create(),typeName:re.ZodObject,...pe(t)});var Ma=class extends de{_parse(t){let{ctx:r}=this._processInputParams(t),n=this._def.options;function i(a){for(let p of a)if(p.result.status==="valid")return p.result;for(let p of a)if(p.result.status==="dirty")return r.common.issues.push(...p.ctx.common.issues),p.result;let u=a.map(p=>new Zt(p.ctx.common.issues));return V(r,{code:M.invalid_union,unionErrors:u}),ne}if(r.common.async)return Promise.all(n.map(async a=>{let u={...r,common:{...r.common,issues:[]},parent:null};return{result:await a._parseAsync({data:r.data,path:r.path,parent:u}),ctx:u}})).then(i);{let a,u=[];for(let l of n){let c={...r,common:{...r.common,issues:[]},parent:null},h=l._parseSync({data:r.data,path:r.path,parent:c});if(h.status==="valid")return h;h.status==="dirty"&&!a&&(a={result:h,ctx:c}),c.common.issues.length&&u.push(c.common.issues)}if(a)return r.common.issues.push(...a.ctx.common.issues),a.result;let p=u.map(l=>new Zt(l));return V(r,{code:M.invalid_union,unionErrors:p}),ne}}get options(){return this._def.options}};Ma.create=(e,t)=>new Ma({options:e,typeName:re.ZodUnion,...pe(t)});var Mn=e=>e instanceof Va?Mn(e.schema):e instanceof Jt?Mn(e.innerType()):e instanceof Ua?[e.value]:e instanceof Wa?e.options:e instanceof $a?ye.objectValues(e.enum):e instanceof Ga?Mn(e._def.innerType):e instanceof ja?[void 0]:e instanceof ka?[null]:e instanceof cr?[void 0,...Mn(e.unwrap())]:e instanceof an?[null,...Mn(e.unwrap())]:e instanceof j0||e instanceof Ha?Mn(e.unwrap()):e instanceof za?Mn(e._def.innerType):[],bd=class e extends de{_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==W.object)return V(r,{code:M.invalid_type,expected:W.object,received:r.parsedType}),ne;let n=this.discriminator,i=r.data[n],a=this.optionsMap.get(i);return a?r.common.async?a._parseAsync({data:r.data,path:r.path,parent:r}):a._parseSync({data:r.data,path:r.path,parent:r}):(V(r,{code:M.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),ne)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,r,n){let i=new Map;for(let a of r){let u=Mn(a.shape[t]);if(!u.length)throw new Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(let p of u){if(i.has(p))throw new Error(`Discriminator property ${String(t)} has duplicate value ${String(p)}`);i.set(p,a)}}return new e({typeName:re.ZodDiscriminatedUnion,discriminator:t,options:r,optionsMap:i,...pe(n)})}};function p8(e,t){let r=Ln(e),n=Ln(t);if(e===t)return{valid:!0,data:e};if(r===W.object&&n===W.object){let i=ye.objectKeys(t),a=ye.objectKeys(e).filter(p=>i.indexOf(p)!==-1),u={...e,...t};for(let p of a){let l=p8(e[p],t[p]);if(!l.valid)return{valid:!1};u[p]=l.data}return{valid:!0,data:u}}else if(r===W.array&&n===W.array){if(e.length!==t.length)return{valid:!1};let i=[];for(let a=0;a<e.length;a++){let u=e[a],p=t[a],l=p8(u,p);if(!l.valid)return{valid:!1};i.push(l.data)}return{valid:!0,data:i}}else return r===W.date&&n===W.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}var La=class extends de{_parse(t){let{status:r,ctx:n}=this._processInputParams(t),i=(a,u)=>{if(o8(a)||o8(u))return ne;let p=p8(a.value,u.value);return p.valid?((u8(a)||u8(u))&&r.dirty(),{status:r.value,value:p.data}):(V(n,{code:M.invalid_intersection_types}),ne)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([a,u])=>i(a,u)):i(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}};La.create=(e,t,r)=>new La({left:e,right:t,typeName:re.ZodIntersection,...pe(r)});var nn=class e extends de{_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==W.array)return V(n,{code:M.invalid_type,expected:W.array,received:n.parsedType}),ne;if(n.data.length<this._def.items.length)return V(n,{code:M.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),ne;!this._def.rest&&n.data.length>this._def.items.length&&(V(n,{code:M.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());let a=[...n.data].map((u,p)=>{let l=this._def.items[p]||this._def.rest;return l?l._parse(new fr(n,u,n.path,p)):null}).filter(u=>!!u);return n.common.async?Promise.all(a).then(u=>At.mergeArray(r,u)):At.mergeArray(r,a)}get items(){return this._def.items}rest(t){return new e({...this._def,rest:t})}};nn.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new nn({items:e,typeName:re.ZodTuple,rest:null,...pe(t)})};var Dd=class e extends de{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==W.object)return V(n,{code:M.invalid_type,expected:W.object,received:n.parsedType}),ne;let i=[],a=this._def.keyType,u=this._def.valueType;for(let p in n.data)i.push({key:a._parse(new fr(n,p,n.path,p)),value:u._parse(new fr(n,n.data[p],n.path,p)),alwaysSet:p in n.data});return n.common.async?At.mergeObjectAsync(r,i):At.mergeObjectSync(r,i)}get element(){return this._def.valueType}static create(t,r,n){return r instanceof de?new e({keyType:t,valueType:r,typeName:re.ZodRecord,...pe(n)}):new e({keyType:Ai.create(),valueType:t,typeName:re.ZodRecord,...pe(r)})}},po=class extends de{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==W.map)return V(n,{code:M.invalid_type,expected:W.map,received:n.parsedType}),ne;let i=this._def.keyType,a=this._def.valueType,u=[...n.data.entries()].map(([p,l],c)=>({key:i._parse(new fr(n,p,n.path,[c,"key"])),value:a._parse(new fr(n,l,n.path,[c,"value"]))}));if(n.common.async){let p=new Map;return Promise.resolve().then(async()=>{for(let l of u){let c=await l.key,h=await l.value;if(c.status==="aborted"||h.status==="aborted")return ne;(c.status==="dirty"||h.status==="dirty")&&r.dirty(),p.set(c.value,h.value)}return{status:r.value,value:p}})}else{let p=new Map;for(let l of u){let c=l.key,h=l.value;if(c.status==="aborted"||h.status==="aborted")return ne;(c.status==="dirty"||h.status==="dirty")&&r.dirty(),p.set(c.value,h.value)}return{status:r.value,value:p}}}};po.create=(e,t,r)=>new po({valueType:t,keyType:e,typeName:re.ZodMap,...pe(r)});var lo=class e extends de{_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==W.set)return V(n,{code:M.invalid_type,expected:W.set,received:n.parsedType}),ne;let i=this._def;i.minSize!==null&&n.data.size<i.minSize.value&&(V(n,{code:M.too_small,minimum:i.minSize.value,type:"set",inclusive:!0,exact:!1,message:i.minSize.message}),r.dirty()),i.maxSize!==null&&n.data.size>i.maxSize.value&&(V(n,{code:M.too_big,maximum:i.maxSize.value,type:"set",inclusive:!0,exact:!1,message:i.maxSize.message}),r.dirty());let a=this._def.valueType;function u(l){let c=new Set;for(let h of l){if(h.status==="aborted")return ne;h.status==="dirty"&&r.dirty(),c.add(h.value)}return{status:r.value,value:c}}let p=[...n.data.values()].map((l,c)=>a._parse(new fr(n,l,n.path,c)));return n.common.async?Promise.all(p).then(l=>u(l)):u(p)}min(t,r){return new e({...this._def,minSize:{value:t,message:Y.toString(r)}})}max(t,r){return new e({...this._def,maxSize:{value:t,message:Y.toString(r)}})}size(t,r){return this.min(t,r).max(t,r)}nonempty(t){return this.min(1,t)}};lo.create=(e,t)=>new lo({valueType:e,minSize:null,maxSize:null,typeName:re.ZodSet,...pe(t)});var yd=class e extends de{constructor(){super(...arguments),this.validate=this.implement}_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==W.function)return V(r,{code:M.invalid_type,expected:W.function,received:r.parsedType}),ne;function n(p,l){return gd({data:p,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,xd(),so].filter(c=>!!c),issueData:{code:M.invalid_arguments,argumentsError:l}})}function i(p,l){return gd({data:p,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,xd(),so].filter(c=>!!c),issueData:{code:M.invalid_return_type,returnTypeError:l}})}let a={errorMap:r.common.contextualErrorMap},u=r.data;if(this._def.returns instanceof Ti){let p=this;return Pt(async function(...l){let c=new Zt([]),h=await p._def.args.parseAsync(l,a).catch(O=>{throw c.addIssue(n(l,O)),c}),b=await Reflect.apply(u,this,h);return await p._def.returns._def.type.parseAsync(b,a).catch(O=>{throw c.addIssue(i(b,O)),c})})}else{let p=this;return Pt(function(...l){let c=p._def.args.safeParse(l,a);if(!c.success)throw new Zt([n(l,c.error)]);let h=Reflect.apply(u,this,c.data),b=p._def.returns.safeParse(h,a);if(!b.success)throw new Zt([i(h,b.error)]);return b.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new e({...this._def,args:nn.create(t).rest(Vn.create())})}returns(t){return new e({...this._def,returns:t})}implement(t){return this.parse(t)}strictImplement(t){return this.parse(t)}static create(t,r,n){return new e({args:t||nn.create([]).rest(Vn.create()),returns:r||Vn.create(),typeName:re.ZodFunction,...pe(n)})}},Va=class extends de{get schema(){return this._def.getter()}_parse(t){let{ctx:r}=this._processInputParams(t);return this._def.getter()._parse({data:r.data,path:r.path,parent:r})}};Va.create=(e,t)=>new Va({getter:e,typeName:re.ZodLazy,...pe(t)});var Ua=class extends de{_parse(t){if(t.data!==this._def.value){let r=this._getOrReturnCtx(t);return V(r,{received:r.data,code:M.invalid_literal,expected:this._def.value}),ne}return{status:"valid",value:t.data}}get value(){return this._def.value}};Ua.create=(e,t)=>new Ua({value:e,typeName:re.ZodLiteral,...pe(t)});function zb(e,t){return new Wa({values:e,typeName:re.ZodEnum,...pe(t)})}var Wa=class e extends de{constructor(){super(...arguments),N0.set(this,void 0)}_parse(t){if(typeof t.data!="string"){let r=this._getOrReturnCtx(t),n=this._def.values;return V(r,{expected:ye.joinValues(n),received:r.parsedType,code:M.invalid_type}),ne}if(_d(this,N0,"f")||Ub(this,N0,new Set(this._def.values),"f"),!_d(this,N0,"f").has(t.data)){let r=this._getOrReturnCtx(t),n=this._def.values;return V(r,{received:r.data,code:M.invalid_enum_value,options:n}),ne}return Pt(t.data)}get options(){return this._def.values}get enum(){let t={};for(let r of this._def.values)t[r]=r;return t}get Values(){let t={};for(let r of this._def.values)t[r]=r;return t}get Enum(){let t={};for(let r of this._def.values)t[r]=r;return t}extract(t,r=this._def){return e.create(t,{...this._def,...r})}exclude(t,r=this._def){return e.create(this.options.filter(n=>!t.includes(n)),{...this._def,...r})}};N0=new WeakMap;Wa.create=zb;var $a=class extends de{constructor(){super(...arguments),R0.set(this,void 0)}_parse(t){let r=ye.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(t);if(n.parsedType!==W.string&&n.parsedType!==W.number){let i=ye.objectValues(r);return V(n,{expected:ye.joinValues(i),received:n.parsedType,code:M.invalid_type}),ne}if(_d(this,R0,"f")||Ub(this,R0,new Set(ye.getValidEnumValues(this._def.values)),"f"),!_d(this,R0,"f").has(t.data)){let i=ye.objectValues(r);return V(n,{received:n.data,code:M.invalid_enum_value,options:i}),ne}return Pt(t.data)}get enum(){return this._def.values}};R0=new WeakMap;$a.create=(e,t)=>new $a({values:e,typeName:re.ZodNativeEnum,...pe(t)});var Ti=class extends de{unwrap(){return this._def.type}_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==W.promise&&r.common.async===!1)return V(r,{code:M.invalid_type,expected:W.promise,received:r.parsedType}),ne;let n=r.parsedType===W.promise?r.data:Promise.resolve(r.data);return Pt(n.then(i=>this._def.type.parseAsync(i,{path:r.path,errorMap:r.common.contextualErrorMap})))}};Ti.create=(e,t)=>new Ti({type:e,typeName:re.ZodPromise,...pe(t)});var Jt=class extends de{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===re.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){let{status:r,ctx:n}=this._processInputParams(t),i=this._def.effect||null,a={addIssue:u=>{V(n,u),u.fatal?r.abort():r.dirty()},get path(){return n.path}};if(a.addIssue=a.addIssue.bind(a),i.type==="preprocess"){let u=i.transform(n.data,a);if(n.common.async)return Promise.resolve(u).then(async p=>{if(r.value==="aborted")return ne;let l=await this._def.schema._parseAsync({data:p,path:n.path,parent:n});return l.status==="aborted"?ne:l.status==="dirty"||r.value==="dirty"?ao(l.value):l});{if(r.value==="aborted")return ne;let p=this._def.schema._parseSync({data:u,path:n.path,parent:n});return p.status==="aborted"?ne:p.status==="dirty"||r.value==="dirty"?ao(p.value):p}}if(i.type==="refinement"){let u=p=>{let l=i.refinement(p,a);if(n.common.async)return Promise.resolve(l);if(l instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return p};if(n.common.async===!1){let p=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return p.status==="aborted"?ne:(p.status==="dirty"&&r.dirty(),u(p.value),{status:r.value,value:p.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(p=>p.status==="aborted"?ne:(p.status==="dirty"&&r.dirty(),u(p.value).then(()=>({status:r.value,value:p.value}))))}if(i.type==="transform")if(n.common.async===!1){let u=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!Ba(u))return u;let p=i.transform(u.value,a);if(p instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:p}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(u=>Ba(u)?Promise.resolve(i.transform(u.value,a)).then(p=>({status:r.value,value:p})):u);ye.assertNever(i)}};Jt.create=(e,t,r)=>new Jt({schema:e,typeName:re.ZodEffects,effect:t,...pe(r)});Jt.createWithPreprocess=(e,t,r)=>new Jt({schema:t,effect:{type:"preprocess",transform:e},typeName:re.ZodEffects,...pe(r)});var cr=class extends de{_parse(t){return this._getType(t)===W.undefined?Pt(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};cr.create=(e,t)=>new cr({innerType:e,typeName:re.ZodOptional,...pe(t)});var an=class extends de{_parse(t){return this._getType(t)===W.null?Pt(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};an.create=(e,t)=>new an({innerType:e,typeName:re.ZodNullable,...pe(t)});var Ga=class extends de{_parse(t){let{ctx:r}=this._processInputParams(t),n=r.data;return r.parsedType===W.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};Ga.create=(e,t)=>new Ga({innerType:e,typeName:re.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...pe(t)});var za=class extends de{_parse(t){let{ctx:r}=this._processInputParams(t),n={...r,common:{...r.common,issues:[]}},i=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return I0(i)?i.then(a=>({status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new Zt(n.common.issues)},input:n.data})})):{status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new Zt(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};za.create=(e,t)=>new za({innerType:e,typeName:re.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...pe(t)});var co=class extends de{_parse(t){if(this._getType(t)!==W.nan){let n=this._getOrReturnCtx(t);return V(n,{code:M.invalid_type,expected:W.nan,received:n.parsedType}),ne}return{status:"valid",value:t.data}}};co.create=e=>new co({typeName:re.ZodNaN,...pe(e)});var qK=Symbol("zod_brand"),j0=class extends de{_parse(t){let{ctx:r}=this._processInputParams(t),n=r.data;return this._def.type._parse({data:n,path:r.path,parent:r})}unwrap(){return this._def.type}},k0=class e extends de{_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.common.async)return(async()=>{let a=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return a.status==="aborted"?ne:a.status==="dirty"?(r.dirty(),ao(a.value)):this._def.out._parseAsync({data:a.value,path:n.path,parent:n})})();{let i=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return i.status==="aborted"?ne:i.status==="dirty"?(r.dirty(),{status:"dirty",value:i.value}):this._def.out._parseSync({data:i.value,path:n.path,parent:n})}}static create(t,r){return new e({in:t,out:r,typeName:re.ZodPipeline})}},Ha=class extends de{_parse(t){let r=this._def.innerType._parse(t),n=i=>(Ba(i)&&(i.value=Object.freeze(i.value)),i);return I0(r)?r.then(i=>n(i)):n(r)}unwrap(){return this._def.innerType}};Ha.create=(e,t)=>new Ha({innerType:e,typeName:re.ZodReadonly,...pe(t)});function Mb(e,t){let r=typeof e=="function"?e(t):typeof e=="string"?{message:e}:e;return typeof r=="string"?{message:r}:r}function Hb(e,t={},r){return e?Oi.create().superRefine((n,i)=>{var a,u;let p=e(n);if(p instanceof Promise)return p.then(l=>{var c,h;if(!l){let b=Mb(t,n),w=(h=(c=b.fatal)!==null&&c!==void 0?c:r)!==null&&h!==void 0?h:!0;i.addIssue({code:"custom",...b,fatal:w})}});if(!p){let l=Mb(t,n),c=(u=(a=l.fatal)!==null&&a!==void 0?a:r)!==null&&u!==void 0?u:!0;i.addIssue({code:"custom",...l,fatal:c})}}):Oi.create()}var BK={object:kt.lazycreate},re;(function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"})(re||(re={}));var PK=(e,t={message:`Input not instance of ${e.name}`})=>Hb(r=>r instanceof e,t),Kb=Ai.create,Yb=Pa.create,NK=co.create,RK=Na.create,Zb=Ra.create,IK=Ia.create,jK=oo.create,kK=ja.create,MK=ka.create,LK=Oi.create,VK=Vn.create,UK=Rr.create,WK=uo.create,$K=Un.create,GK=kt.create,zK=kt.strictCreate,HK=Ma.create,KK=bd.create,YK=La.create,ZK=nn.create,JK=Dd.create,XK=po.create,QK=lo.create,eY=yd.create,tY=Va.create,rY=Ua.create,nY=Wa.create,iY=$a.create,aY=Ti.create,Lb=Jt.create,sY=cr.create,oY=an.create,uY=Jt.createWithPreprocess,pY=k0.create,dY=()=>Kb().optional(),lY=()=>Yb().optional(),cY=()=>Zb().optional(),fY={string:e=>Ai.create({...e,coerce:!0}),number:e=>Pa.create({...e,coerce:!0}),boolean:e=>Ra.create({...e,coerce:!0}),bigint:e=>Na.create({...e,coerce:!0}),date:e=>Ia.create({...e,coerce:!0})},mY=ne,D=Object.freeze({__proto__:null,defaultErrorMap:so,setErrorMap:uK,getErrorMap:xd,makeIssue:gd,EMPTY_PATH:pK,addIssueToContext:V,ParseStatus:At,INVALID:ne,DIRTY:ao,OK:Pt,isAborted:o8,isDirty:u8,isValid:Ba,isAsync:I0,get util(){return ye},get objectUtil(){return s8},ZodParsedType:W,getParsedType:Ln,ZodType:de,datetimeRegex:Gb,ZodString:Ai,ZodNumber:Pa,ZodBigInt:Na,ZodBoolean:Ra,ZodDate:Ia,ZodSymbol:oo,ZodUndefined:ja,ZodNull:ka,ZodAny:Oi,ZodUnknown:Vn,ZodNever:Rr,ZodVoid:uo,ZodArray:Un,ZodObject:kt,ZodUnion:Ma,ZodDiscriminatedUnion:bd,ZodIntersection:La,ZodTuple:nn,ZodRecord:Dd,ZodMap:po,ZodSet:lo,ZodFunction:yd,ZodLazy:Va,ZodLiteral:Ua,ZodEnum:Wa,ZodNativeEnum:$a,ZodPromise:Ti,ZodEffects:Jt,ZodTransformer:Jt,ZodOptional:cr,ZodNullable:an,ZodDefault:Ga,ZodCatch:za,ZodNaN:co,BRAND:qK,ZodBranded:j0,ZodPipeline:k0,ZodReadonly:Ha,custom:Hb,Schema:de,ZodSchema:de,late:BK,get ZodFirstPartyTypeKind(){return re},coerce:fY,any:LK,array:$K,bigint:RK,boolean:Zb,date:IK,discriminatedUnion:KK,effect:Lb,enum:nY,function:eY,instanceof:PK,intersection:YK,lazy:tY,literal:rY,map:XK,nan:NK,nativeEnum:iY,never:UK,null:MK,nullable:oY,number:Yb,object:GK,oboolean:cY,onumber:lY,optional:sY,ostring:dY,pipeline:pY,preprocess:uY,promise:aY,record:JK,set:QK,strictObject:zK,string:Kb,symbol:jK,transformer:Lb,tuple:ZK,undefined:kK,union:HK,unknown:VK,void:WK,NEVER:mY,ZodIssueCode:M,quotelessJson:oK,ZodError:Zt});var d8="2024-11-05",Jb=[d8,"2024-10-07"],Ed="2.0",Xb=D.union([D.string(),D.number().int()]),Qb=D.string(),Ir=D.object({_meta:D.optional(D.object({progressToken:D.optional(Xb)}).passthrough())}).passthrough(),Xt=D.object({method:D.string(),params:D.optional(Ir)}),M0=D.object({_meta:D.optional(D.object({}).passthrough())}).passthrough(),sn=D.object({method:D.string(),params:D.optional(M0)}),jr=D.object({_meta:D.optional(D.object({}).passthrough())}).passthrough(),wd=D.union([D.string(),D.number().int()]),hY=D.object({jsonrpc:D.literal(Ed),id:wd}).merge(Xt).strict(),vY=D.object({jsonrpc:D.literal(Ed)}).merge(sn).strict(),xY=D.object({jsonrpc:D.literal(Ed),id:wd,result:jr}).strict(),lt;(function(e){e[e.ConnectionClosed=-32e3]="ConnectionClosed",e[e.RequestTimeout=-32001]="RequestTimeout",e[e.ParseError=-32700]="ParseError",e[e.InvalidRequest=-32600]="InvalidRequest",e[e.MethodNotFound=-32601]="MethodNotFound",e[e.InvalidParams=-32602]="InvalidParams",e[e.InternalError=-32603]="InternalError"})(lt||(lt={}));var gY=D.object({jsonrpc:D.literal(Ed),id:wd,error:D.object({code:D.number().int(),message:D.string(),data:D.optional(D.unknown())})}).strict(),Fd=D.union([hY,vY,xY,gY]),Ya=jr.strict(),Cd=sn.extend({method:D.literal("notifications/cancelled"),params:M0.extend({requestId:wd,reason:D.string().optional()})}),eD=D.object({name:D.string(),version:D.string()}).passthrough(),_Y=D.object({experimental:D.optional(D.object({}).passthrough()),sampling:D.optional(D.object({}).passthrough()),roots:D.optional(D.object({listChanged:D.optional(D.boolean())}).passthrough())}).passthrough(),bY=Xt.extend({method:D.literal("initialize"),params:Ir.extend({protocolVersion:D.string(),capabilities:_Y,clientInfo:eD})}),DY=D.object({experimental:D.optional(D.object({}).passthrough()),logging:D.optional(D.object({}).passthrough()),prompts:D.optional(D.object({listChanged:D.optional(D.boolean())}).passthrough()),resources:D.optional(D.object({subscribe:D.optional(D.boolean()),listChanged:D.optional(D.boolean())}).passthrough()),tools:D.optional(D.object({listChanged:D.optional(D.boolean())}).passthrough())}).passthrough(),l8=jr.extend({protocolVersion:D.string(),capabilities:DY,serverInfo:eD,instructions:D.optional(D.string())}),yY=sn.extend({method:D.literal("notifications/initialized")}),Sd=Xt.extend({method:D.literal("ping")}),EY=D.object({progress:D.number(),total:D.optional(D.number())}).passthrough(),Ad=sn.extend({method:D.literal("notifications/progress"),params:M0.merge(EY).extend({progressToken:Xb})}),Od=Xt.extend({params:Ir.extend({cursor:D.optional(Qb)}).optional()}),Td=jr.extend({nextCursor:D.optional(Qb)}),tD=D.object({uri:D.string(),mimeType:D.optional(D.string())}).passthrough(),rD=tD.extend({text:D.string()}),nD=tD.extend({blob:D.string().base64()}),wY=D.object({uri:D.string(),name:D.string(),description:D.optional(D.string()),mimeType:D.optional(D.string())}).passthrough(),FY=D.object({uriTemplate:D.string(),name:D.string(),description:D.optional(D.string()),mimeType:D.optional(D.string())}).passthrough(),CY=Od.extend({method:D.literal("resources/list")}),c8=Td.extend({resources:D.array(wY)}),SY=Od.extend({method:D.literal("resources/templates/list")}),f8=Td.extend({resourceTemplates:D.array(FY)}),AY=Xt.extend({method:D.literal("resources/read"),params:Ir.extend({uri:D.string()})}),m8=jr.extend({contents:D.array(D.union([rD,nD]))}),OY=sn.extend({method:D.literal("notifications/resources/list_changed")}),TY=Xt.extend({method:D.literal("resources/subscribe"),params:Ir.extend({uri:D.string()})}),qY=Xt.extend({method:D.literal("resources/unsubscribe"),params:Ir.extend({uri:D.string()})}),BY=sn.extend({method:D.literal("notifications/resources/updated"),params:M0.extend({uri:D.string()})}),PY=D.object({name:D.string(),description:D.optional(D.string()),required:D.optional(D.boolean())}).passthrough(),NY=D.object({name:D.string(),description:D.optional(D.string()),arguments:D.optional(D.array(PY))}).passthrough(),RY=Od.extend({method:D.literal("prompts/list")}),h8=Td.extend({prompts:D.array(NY)}),IY=Xt.extend({method:D.literal("prompts/get"),params:Ir.extend({name:D.string(),arguments:D.optional(D.record(D.string()))})}),qd=D.object({type:D.literal("text"),text:D.string()}).passthrough(),Bd=D.object({type:D.literal("image"),data:D.string().base64(),mimeType:D.string()}).passthrough(),iD=D.object({type:D.literal("resource"),resource:D.union([rD,nD])}).passthrough(),jY=D.object({role:D.enum(["user","assistant"]),content:D.union([qd,Bd,iD])}).passthrough(),v8=jr.extend({description:D.optional(D.string()),messages:D.array(jY)}),kY=sn.extend({method:D.literal("notifications/prompts/list_changed")}),MY=D.object({name:D.string(),description:D.optional(D.string()),inputSchema:D.object({type:D.literal("object"),properties:D.optional(D.object({}).passthrough())}).passthrough()}).passthrough(),LY=Od.extend({method:D.literal("tools/list")}),x8=Td.extend({tools:D.array(MY)}),Pd=jr.extend({content:D.array(D.union([qd,Bd,iD])),isError:D.boolean().default(!1).optional()}),ICe=Pd.or(jr.extend({toolResult:D.unknown()})),g8=Xt.extend({method:D.literal("tools/call"),params:Ir.extend({name:D.string(),arguments:D.optional(D.record(D.unknown()))})}),VY=sn.extend({method:D.literal("notifications/tools/list_changed")}),aD=D.enum(["debug","info","notice","warning","error","critical","alert","emergency"]),UY=Xt.extend({method:D.literal("logging/setLevel"),params:Ir.extend({level:aD})}),_8=sn.extend({method:D.literal("notifications/message"),params:M0.extend({level:aD,logger:D.optional(D.string()),data:D.unknown()})}),WY=D.object({name:D.string().optional()}).passthrough(),$Y=D.object({hints:D.optional(D.array(WY)),costPriority:D.optional(D.number().min(0).max(1)),speedPriority:D.optional(D.number().min(0).max(1)),intelligencePriority:D.optional(D.number().min(0).max(1))}).passthrough(),GY=D.object({role:D.enum(["user","assistant"]),content:D.union([qd,Bd])}).passthrough(),zY=Xt.extend({method:D.literal("sampling/createMessage"),params:Ir.extend({messages:D.array(GY),systemPrompt:D.optional(D.string()),includeContext:D.optional(D.enum(["none","thisServer","allServers"])),temperature:D.optional(D.number()),maxTokens:D.number().int(),stopSequences:D.optional(D.array(D.string())),metadata:D.optional(D.object({}).passthrough()),modelPreferences:D.optional($Y)})}),HY=jr.extend({model:D.string(),stopReason:D.optional(D.enum(["endTurn","stopSequence","maxTokens"]).or(D.string())),role:D.enum(["user","assistant"]),content:D.discriminatedUnion("type",[qd,Bd])}),KY=D.object({type:D.literal("ref/resource"),uri:D.string()}).passthrough(),YY=D.object({type:D.literal("ref/prompt"),name:D.string()}).passthrough(),ZY=Xt.extend({method:D.literal("completion/complete"),params:Ir.extend({ref:D.union([YY,KY]),argument:D.object({name:D.string(),value:D.string()}).passthrough()})}),b8=jr.extend({completion:D.object({values:D.array(D.string()).max(100),total:D.optional(D.number().int()),hasMore:D.optional(D.boolean())}).passthrough()}),JY=D.object({uri:D.string().startsWith("file://"),name:D.optional(D.string())}).passthrough(),XY=Xt.extend({method:D.literal("roots/list")}),QY=jr.extend({roots:D.array(JY)}),eZ=sn.extend({method:D.literal("notifications/roots/list_changed")}),jCe=D.union([Sd,bY,ZY,UY,IY,RY,CY,SY,AY,TY,qY,g8,LY]),kCe=D.union([Cd,Ad,yY,eZ]),MCe=D.union([Ya,HY,QY]),LCe=D.union([Sd,zY,XY]),VCe=D.union([Cd,Ad,_8,BY,OY,VY,kY]),UCe=D.union([Ya,l8,b8,v8,h8,c8,f8,m8,Pd,x8]),Ka=class extends Error{constructor(t,r,n){super(`MCP error ${t}: ${r}`),this.code=t,this.data=n,this.name="McpError"}};var tZ=6e4,Nd=class{constructor(t){this._options=t,this._requestMessageId=0,this._requestHandlers=new Map,this._requestHandlerAbortControllers=new Map,this._notificationHandlers=new Map,this._responseHandlers=new Map,this._progressHandlers=new Map,this._timeoutInfo=new Map,this.setNotificationHandler(Cd,r=>{let n=this._requestHandlerAbortControllers.get(r.params.requestId);n?.abort(r.params.reason)}),this.setNotificationHandler(Ad,r=>{this._onprogress(r)}),this.setRequestHandler(Sd,r=>({}))}_setupTimeout(t,r,n,i){this._timeoutInfo.set(t,{timeoutId:setTimeout(i,r),startTime:Date.now(),timeout:r,maxTotalTimeout:n,onTimeout:i})}_resetTimeout(t){let r=this._timeoutInfo.get(t);if(!r)return!1;let n=Date.now()-r.startTime;if(r.maxTotalTimeout&&n>=r.maxTotalTimeout)throw this._timeoutInfo.delete(t),new Ka(lt.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:r.maxTotalTimeout,totalElapsed:n});return clearTimeout(r.timeoutId),r.timeoutId=setTimeout(r.onTimeout,r.timeout),!0}_cleanupTimeout(t){let r=this._timeoutInfo.get(t);r&&(clearTimeout(r.timeoutId),this._timeoutInfo.delete(t))}async connect(t){this._transport=t,this._transport.onclose=()=>{this._onclose()},this._transport.onerror=r=>{this._onerror(r)},this._transport.onmessage=r=>{"method"in r?"id"in r?this._onrequest(r):this._onnotification(r):this._onresponse(r)},await this._transport.start()}_onclose(){var t;let r=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._transport=void 0,(t=this.onclose)===null||t===void 0||t.call(this);let n=new Ka(lt.ConnectionClosed,"Connection closed");for(let i of r.values())i(n)}_onerror(t){var r;(r=this.onerror)===null||r===void 0||r.call(this,t)}_onnotification(t){var r;let n=(r=this._notificationHandlers.get(t.method))!==null&&r!==void 0?r:this.fallbackNotificationHandler;n!==void 0&&Promise.resolve().then(()=>n(t)).catch(i=>this._onerror(new Error(`Uncaught error in notification handler: ${i}`)))}_onrequest(t){var r,n,i;let a=(r=this._requestHandlers.get(t.method))!==null&&r!==void 0?r:this.fallbackRequestHandler;if(a===void 0){(n=this._transport)===null||n===void 0||n.send({jsonrpc:"2.0",id:t.id,error:{code:lt.MethodNotFound,message:"Method not found"}}).catch(l=>this._onerror(new Error(`Failed to send an error response: ${l}`)));return}let u=new AbortController;this._requestHandlerAbortControllers.set(t.id,u);let p={signal:u.signal,sessionId:(i=this._transport)===null||i===void 0?void 0:i.sessionId};Promise.resolve().then(()=>a(t,p)).then(l=>{var c;if(!u.signal.aborted)return(c=this._transport)===null||c===void 0?void 0:c.send({result:l,jsonrpc:"2.0",id:t.id})},l=>{var c,h;if(!u.signal.aborted)return(c=this._transport)===null||c===void 0?void 0:c.send({jsonrpc:"2.0",id:t.id,error:{code:Number.isSafeInteger(l.code)?l.code:lt.InternalError,message:(h=l.message)!==null&&h!==void 0?h:"Internal error"}})}).catch(l=>this._onerror(new Error(`Failed to send response: ${l}`))).finally(()=>{this._requestHandlerAbortControllers.delete(t.id)})}_onprogress(t){let{progressToken:r,...n}=t.params,i=Number(r),a=this._progressHandlers.get(i);if(!a){this._onerror(new Error(`Received a progress notification for an unknown token: ${JSON.stringify(t)}`));return}let u=this._responseHandlers.get(i);if(this._timeoutInfo.has(i)&&u)try{this._resetTimeout(i)}catch(p){u(p);return}a(n)}_onresponse(t){let r=Number(t.id),n=this._responseHandlers.get(r);if(n===void 0){this._onerror(new Error(`Received a response for an unknown message ID: ${JSON.stringify(t)}`));return}if(this._responseHandlers.delete(r),this._progressHandlers.delete(r),this._cleanupTimeout(r),"result"in t)n(t);else{let i=new Ka(t.error.code,t.error.message,t.error.data);n(i)}}get transport(){return this._transport}async close(){var t;await((t=this._transport)===null||t===void 0?void 0:t.close())}request(t,r,n){return new Promise((i,a)=>{var u,p,l,c;if(!this._transport){a(new Error("Not connected"));return}((u=this._options)===null||u===void 0?void 0:u.enforceStrictCapabilities)===!0&&this.assertCapabilityForMethod(t.method),(p=n?.signal)===null||p===void 0||p.throwIfAborted();let h=this._requestMessageId++,b={...t,jsonrpc:"2.0",id:h};n?.onprogress&&(this._progressHandlers.set(h,n.onprogress),b.params={...t.params,_meta:{progressToken:h}});let w=S=>{var q;this._responseHandlers.delete(h),this._progressHandlers.delete(h),this._cleanupTimeout(h),(q=this._transport)===null||q===void 0||q.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:h,reason:String(S)}}).catch(P=>this._onerror(new Error(`Failed to send cancellation: ${P}`))),a(S)};this._responseHandlers.set(h,S=>{var q;if(!(!((q=n?.signal)===null||q===void 0)&&q.aborted)){if(S instanceof Error)return a(S);try{let P=r.parse(S.result);i(P)}catch(P){a(P)}}}),(l=n?.signal)===null||l===void 0||l.addEventListener("abort",()=>{var S;w((S=n?.signal)===null||S===void 0?void 0:S.reason)});let O=(c=n?.timeout)!==null&&c!==void 0?c:tZ,C=()=>w(new Ka(lt.RequestTimeout,"Request timed out",{timeout:O}));this._setupTimeout(h,O,n?.maxTotalTimeout,C),this._transport.send(b).catch(S=>{this._cleanupTimeout(h),a(S)})})}async notification(t){if(!this._transport)throw new Error("Not connected");this.assertNotificationCapability(t.method);let r={...t,jsonrpc:"2.0"};await this._transport.send(r)}setRequestHandler(t,r){let n=t.shape.method.value;this.assertRequestHandlerCapability(n),this._requestHandlers.set(n,(i,a)=>Promise.resolve(r(t.parse(i),a)))}removeRequestHandler(t){this._requestHandlers.delete(t)}assertCanSetRequestHandler(t){if(this._requestHandlers.has(t))throw new Error(`A request handler for ${t} already exists, which would be overridden`)}setNotificationHandler(t,r){this._notificationHandlers.set(t.shape.method.value,n=>Promise.resolve(r(t.parse(n))))}removeNotificationHandler(t){this._notificationHandlers.delete(t)}};function sD(e,t){return Object.entries(t).reduce((r,[n,i])=>(i&&typeof i=="object"?r[n]=r[n]?{...r[n],...i}:i:r[n]=i,r),{...e})}var Rd=class extends Nd{constructor(t,r){var n;super(r),this._clientInfo=t,this._capabilities=(n=r?.capabilities)!==null&&n!==void 0?n:{}}registerCapabilities(t){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=sD(this._capabilities,t)}assertCapability(t,r){var n;if(!(!((n=this._serverCapabilities)===null||n===void 0)&&n[t]))throw new Error(`Server does not support ${t} (required for ${r})`)}async connect(t){await super.connect(t);try{let r=await this.request({method:"initialize",params:{protocolVersion:d8,capabilities:this._capabilities,clientInfo:this._clientInfo}},l8);if(r===void 0)throw new Error(`Server sent invalid initialize result: ${r}`);if(!Jb.includes(r.protocolVersion))throw new Error(`Server's protocol version is not supported: ${r.protocolVersion}`);this._serverCapabilities=r.capabilities,this._serverVersion=r.serverInfo,this._instructions=r.instructions,await this.notification({method:"notifications/initialized"})}catch(r){throw this.close(),r}}getServerCapabilities(){return this._serverCapabilities}getServerVersion(){return this._serverVersion}getInstructions(){return this._instructions}assertCapabilityForMethod(t){var r,n,i,a,u;switch(t){case"logging/setLevel":if(!(!((r=this._serverCapabilities)===null||r===void 0)&&r.logging))throw new Error(`Server does not support logging (required for ${t})`);break;case"prompts/get":case"prompts/list":if(!(!((n=this._serverCapabilities)===null||n===void 0)&&n.prompts))throw new Error(`Server does not support prompts (required for ${t})`);break;case"resources/list":case"resources/templates/list":case"resources/read":case"resources/subscribe":case"resources/unsubscribe":if(!(!((i=this._serverCapabilities)===null||i===void 0)&&i.resources))throw new Error(`Server does not support resources (required for ${t})`);if(t==="resources/subscribe"&&!this._serverCapabilities.resources.subscribe)throw new Error(`Server does not support resource subscriptions (required for ${t})`);break;case"tools/call":case"tools/list":if(!(!((a=this._serverCapabilities)===null||a===void 0)&&a.tools))throw new Error(`Server does not support tools (required for ${t})`);break;case"completion/complete":if(!(!((u=this._serverCapabilities)===null||u===void 0)&&u.prompts))throw new Error(`Server does not support prompts (required for ${t})`);break;case"initialize":break;case"ping":break}}assertNotificationCapability(t){var r;switch(t){case"notifications/roots/list_changed":if(!(!((r=this._capabilities.roots)===null||r===void 0)&&r.listChanged))throw new Error(`Client does not support roots list changed notifications (required for ${t})`);break;case"notifications/initialized":break;case"notifications/cancelled":break;case"notifications/progress":break}}assertRequestHandlerCapability(t){switch(t){case"sampling/createMessage":if(!this._capabilities.sampling)throw new Error(`Client does not support sampling capability (required for ${t})`);break;case"roots/list":if(!this._capabilities.roots)throw new Error(`Client does not support roots capability (required for ${t})`);break;case"ping":break}}async ping(t){return this.request({method:"ping"},Ya,t)}async complete(t,r){return this.request({method:"completion/complete",params:t},b8,r)}async setLoggingLevel(t,r){return this.request({method:"logging/setLevel",params:{level:t}},Ya,r)}async getPrompt(t,r){return this.request({method:"prompts/get",params:t},v8,r)}async listPrompts(t,r){return this.request({method:"prompts/list",params:t},h8,r)}async listResources(t,r){return this.request({method:"resources/list",params:t},c8,r)}async listResourceTemplates(t,r){return this.request({method:"resources/templates/list",params:t},f8,r)}async readResource(t,r){return this.request({method:"resources/read",params:t},m8,r)}async subscribeResource(t,r){return this.request({method:"resources/subscribe",params:t},Ya,r)}async unsubscribeResource(t,r){return this.request({method:"resources/unsubscribe",params:t},Ya,r)}async callTool(t,r=Pd,n){return this.request({method:"tools/call",params:t},r,n)}async listTools(t,r){return this.request({method:"tools/list",params:t},x8,r)}async sendRootsListChanged(){return this.notification({method:"notifications/roots/list_changed"})}};var ZD=oe(KD(),1),L0=oe(require("node:process"),1);var jd=class{append(t){this._buffer=this._buffer?Buffer.concat([this._buffer,t]):t}readMessage(){if(!this._buffer)return null;let t=this._buffer.indexOf(`
|
|
84
84
|
`);if(t===-1)return null;let r=this._buffer.toString("utf8",0,t);return this._buffer=this._buffer.subarray(t+1),AZ(r)}clear(){this._buffer=void 0}};function AZ(e){return Fd.parse(JSON.parse(e))}function YD(e){return JSON.stringify(e)+`
|
|
85
85
|
`}var OZ=L0.default.platform==="win32"?["APPDATA","HOMEDRIVE","HOMEPATH","LOCALAPPDATA","PATH","PROCESSOR_ARCHITECTURE","SYSTEMDRIVE","SYSTEMROOT","TEMP","USERNAME","USERPROFILE"]:["HOME","LOGNAME","PATH","SHELL","TERM","USER"];function T8(){let e={};for(let t of OZ){let r=L0.default.env[t];r!==void 0&&(r.startsWith("()")||(e[t]=r))}return e}var ho=class{constructor(t){this._abortController=new AbortController,this._readBuffer=new jd,this._serverParams=t}async start(){if(this._process)throw new Error("StdioClientTransport already started! If using Client class, note that connect() calls start() automatically.");return new Promise((t,r)=>{var n,i,a,u,p,l;this._process=(0,ZD.default)(this._serverParams.command,(n=this._serverParams.args)!==null&&n!==void 0?n:[],{env:(i=this._serverParams.env)!==null&&i!==void 0?i:T8(),stdio:["pipe","pipe",(a=this._serverParams.stderr)!==null&&a!==void 0?a:"inherit"],shell:!1,signal:this._abortController.signal,windowsHide:L0.default.platform==="win32"&&TZ(),cwd:this._serverParams.cwd}),this._process.on("error",c=>{var h,b;if(c.name==="AbortError"){(h=this.onclose)===null||h===void 0||h.call(this);return}r(c),(b=this.onerror)===null||b===void 0||b.call(this,c)}),this._process.on("spawn",()=>{t()}),this._process.on("close",c=>{var h;this._process=void 0,(h=this.onclose)===null||h===void 0||h.call(this)}),(u=this._process.stdin)===null||u===void 0||u.on("error",c=>{var h;(h=this.onerror)===null||h===void 0||h.call(this,c)}),(p=this._process.stdout)===null||p===void 0||p.on("data",c=>{this._readBuffer.append(c),this.processReadBuffer()}),(l=this._process.stdout)===null||l===void 0||l.on("error",c=>{var h;(h=this.onerror)===null||h===void 0||h.call(this,c)})})}get stderr(){var t,r;return(r=(t=this._process)===null||t===void 0?void 0:t.stderr)!==null&&r!==void 0?r:null}processReadBuffer(){for(var t,r;;)try{let n=this._readBuffer.readMessage();if(n===null)break;(t=this.onmessage)===null||t===void 0||t.call(this,n)}catch(n){(r=this.onerror)===null||r===void 0||r.call(this,n)}}async close(){this._abortController.abort(),this._process=void 0,this._readBuffer.clear()}send(t){return new Promise(r=>{var n;if(!(!((n=this._process)===null||n===void 0)&&n.stdin))throw new Error("Not connected");let i=YD(t);this._process.stdin.write(i)?r():this._process.stdin.once("drain",r)})}};function TZ(){return"type"in L0.default}var wwe=oe(q8()),Uv=oe(V1()),pi=oe(Ge());var Qu=oe(require("node:process"),1);var zR=(e=0)=>t=>`\x1B[${t+e}m`,HR=(e=0)=>t=>`\x1B[${38+e};5;${t}m`,KR=(e=0)=>(t,r,n)=>`\x1B[${38+e};2;${t};${r};${n}m`,Ve={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],overline:[53,55],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],gray:[90,39],grey:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgGray:[100,49],bgGrey:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}},EIe=Object.keys(Ve.modifier),fye=Object.keys(Ve.color),mye=Object.keys(Ve.bgColor),wIe=[...fye,...mye];function hye(){let e=new Map;for(let[t,r]of Object.entries(Ve)){for(let[n,i]of Object.entries(r))Ve[n]={open:`\x1B[${i[0]}m`,close:`\x1B[${i[1]}m`},r[n]=Ve[n],e.set(i[0],i[1]);Object.defineProperty(Ve,t,{value:r,enumerable:!1})}return Object.defineProperty(Ve,"codes",{value:e,enumerable:!1}),Ve.color.close="\x1B[39m",Ve.bgColor.close="\x1B[49m",Ve.color.ansi=zR(),Ve.color.ansi256=HR(),Ve.color.ansi16m=KR(),Ve.bgColor.ansi=zR(10),Ve.bgColor.ansi256=HR(10),Ve.bgColor.ansi16m=KR(10),Object.defineProperties(Ve,{rgbToAnsi256:{value(t,r,n){return t===r&&r===n?t<8?16:t>248?231:Math.round((t-8)/247*24)+232:16+36*Math.round(t/255*5)+6*Math.round(r/255*5)+Math.round(n/255*5)},enumerable:!1},hexToRgb:{value(t){let r=/[a-f\d]{6}|[a-f\d]{3}/i.exec(t.toString(16));if(!r)return[0,0,0];let[n]=r;n.length===3&&(n=[...n].map(a=>a+a).join(""));let i=Number.parseInt(n,16);return[i>>16&255,i>>8&255,i&255]},enumerable:!1},hexToAnsi256:{value:t=>Ve.rgbToAnsi256(...Ve.hexToRgb(t)),enumerable:!1},ansi256ToAnsi:{value(t){if(t<8)return 30+t;if(t<16)return 90+(t-8);let r,n,i;if(t>=232)r=((t-232)*10+8)/255,n=r,i=r;else{t-=16;let p=t%36;r=Math.floor(t/36)/5,n=Math.floor(p/6)/5,i=p%6/5}let a=Math.max(r,n,i)*2;if(a===0)return 30;let u=30+(Math.round(i)<<2|Math.round(n)<<1|Math.round(r));return a===2&&(u+=60),u},enumerable:!1},rgbToAnsi:{value:(t,r,n)=>Ve.ansi256ToAnsi(Ve.rgbToAnsi256(t,r,n)),enumerable:!1},hexToAnsi:{value:t=>Ve.ansi256ToAnsi(Ve.hexToAnsi256(t)),enumerable:!1}}),Ve}var vye=hye(),zr=vye;var B6=oe(require("node:process"),1),ZR=oe(require("node:os"),1),Y7=oe(require("node:tty"),1);function Dr(e,t=globalThis.Deno?globalThis.Deno.args:B6.default.argv){let r=e.startsWith("-")?"":e.length===1?"-":"--",n=t.indexOf(r+e),i=t.indexOf("--");return n!==-1&&(i===-1||n<i)}var{env:Ye}=B6.default,q6;Dr("no-color")||Dr("no-colors")||Dr("color=false")||Dr("color=never")?q6=0:(Dr("color")||Dr("colors")||Dr("color=true")||Dr("color=always"))&&(q6=1);function xye(){if("FORCE_COLOR"in Ye)return Ye.FORCE_COLOR==="true"?1:Ye.FORCE_COLOR==="false"?0:Ye.FORCE_COLOR.length===0?1:Math.min(Number.parseInt(Ye.FORCE_COLOR,10),3)}function gye(e){return e===0?!1:{level:e,hasBasic:!0,has256:e>=2,has16m:e>=3}}function _ye(e,{streamIsTTY:t,sniffFlags:r=!0}={}){let n=xye();n!==void 0&&(q6=n);let i=r?q6:n;if(i===0)return 0;if(r){if(Dr("color=16m")||Dr("color=full")||Dr("color=truecolor"))return 3;if(Dr("color=256"))return 2}if("TF_BUILD"in Ye&&"AGENT_NAME"in Ye)return 1;if(e&&!t&&i===void 0)return 0;let a=i||0;if(Ye.TERM==="dumb")return a;if(B6.default.platform==="win32"){let u=ZR.default.release().split(".");return Number(u[0])>=10&&Number(u[2])>=10586?Number(u[2])>=14931?3:2:1}if("CI"in Ye)return["GITHUB_ACTIONS","GITEA_ACTIONS","CIRCLECI"].some(u=>u in Ye)?3:["TRAVIS","APPVEYOR","GITLAB_CI","BUILDKITE","DRONE"].some(u=>u in Ye)||Ye.CI_NAME==="codeship"?1:a;if("TEAMCITY_VERSION"in Ye)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(Ye.TEAMCITY_VERSION)?1:0;if(Ye.COLORTERM==="truecolor"||Ye.TERM==="xterm-kitty")return 3;if("TERM_PROGRAM"in Ye){let u=Number.parseInt((Ye.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(Ye.TERM_PROGRAM){case"iTerm.app":return u>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(Ye.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(Ye.TERM)||"COLORTERM"in Ye?1:a}function YR(e,t={}){let r=_ye(e,{streamIsTTY:e&&e.isTTY,...t});return gye(r)}var bye={stdout:YR({isTTY:Y7.default.isatty(1)}),stderr:YR({isTTY:Y7.default.isatty(2)})},JR=bye;function XR(e,t,r){let n=e.indexOf(t);if(n===-1)return e;let i=t.length,a=0,u="";do u+=e.slice(a,n)+t+r,a=n+i,n=e.indexOf(t,a);while(n!==-1);return u+=e.slice(a),u}function QR(e,t,r,n){let i=0,a="";do{let u=e[n-1]==="\r";a+=e.slice(i,u?n-1:n)+t+(u?`\r
|
|
86
86
|
`:`
|
|
@@ -99,7 +99,7 @@ For information on Smithery's data policy, please visit: ${ui.default.underline(
|
|
|
99
99
|
Tool: ${a.value.name}`)),console.log(pi.default.dim(`Description: ${a.value.description||"No description"}`)),console.log(pi.default.cyan(`
|
|
100
100
|
Input Schema:`)),console.dir(a.value.inputSchema,{depth:null,colors:!0}),console.log(`
|
|
101
101
|
`);continue}else if(a.type==="prompt"){let l=await Awe(a.value.arguments);p=yn(`Using prompt ${a.value.name}...`).start(),u=await r.getPrompt({name:a.value.name,arguments:l}).catch(c=>{p?.fail(c.message),p=void 0})}p&&p.succeed(),u&&(console.dir(u,{depth:null,colors:!0}),console.log(`
|
|
102
|
-
`))}}catch(n){t.fail(`Failed to connect to server: ${n instanceof Error?n.message:String(n)}`),r&&await r.close(),process.exit(1)}}async function Awe(e){return!e||e.length===0?{}:Uv.default.prompt(e.map(t=>({type:"text",name:t.name,message:pi.default.dim(`${t.required?"* ":""}${t.name}: ${t.description}`)})))}async function Nj(e){let t=yn(`Resolving ${e}...`).start(),r=null;try{let n=await Ts(e);j(`Resolved server package: ${e}`),t.succeed(`Successfully resolved ${e}`);let i=ha(n);j(`Selected connection type: ${i.type}`);let a=await X6(i);j(`Collected Configuration Structure: ${JSON.stringify(Object.keys(a),null,2)}`);let u=Q6({});j(`Runtime environment initialized with ${Object.keys(u).length} variables`),r=new ho({command:"npx",args:["-y","@smithery/cli@latest","run",e,"--config",JSON.stringify(JSON.stringify(a))],env:u}),j(`Created transport for server: ${e}`),await Swe(r)}catch(n){t.fail(`Failed to inspect ${e}`),n instanceof Error?console.error(pi.default.red(`Error: ${n.message}`)):console.error(pi.default.red("An unexpected error occurred during inspection")),r&&await r.close(),process.exit(1)}}var n0=oe(Ge());var xa=oe(require("node:fs")),Ij=oe(require("node:os")),wt=oe(require("node:path"));var jj=require("node:child_process"),Q1=Ij.default.homedir(),Owe={win32:{baseDir:process.env.APPDATA||wt.default.join(Q1,"AppData","Roaming"),vscodePath:wt.default.join("Code","User","globalStorage")},darwin:{baseDir:wt.default.join(Q1,"Library","Application Support"),vscodePath:wt.default.join("Code","User","globalStorage")},linux:{baseDir:process.env.XDG_CONFIG_HOME||wt.default.join(Q1,".config"),vscodePath:wt.default.join("Code/User/globalStorage")}},Twe=process.platform,{baseDir:e4,vscodePath:Rj}=Owe[Twe],kj=wt.default.join(e4,"Claude","claude_desktop_config.json"),qwe={claude:{type:"file",path:kj},cline:{type:"file",path:wt.default.join(e4,Rj,"saoudrizwan.claude-dev","settings","cline_mcp_settings.json")},"roo-
|
|
102
|
+
`))}}catch(n){t.fail(`Failed to connect to server: ${n instanceof Error?n.message:String(n)}`),r&&await r.close(),process.exit(1)}}async function Awe(e){return!e||e.length===0?{}:Uv.default.prompt(e.map(t=>({type:"text",name:t.name,message:pi.default.dim(`${t.required?"* ":""}${t.name}: ${t.description}`)})))}async function Nj(e){let t=yn(`Resolving ${e}...`).start(),r=null;try{let n=await Ts(e);j(`Resolved server package: ${e}`),t.succeed(`Successfully resolved ${e}`);let i=ha(n);j(`Selected connection type: ${i.type}`);let a=await X6(i);j(`Collected Configuration Structure: ${JSON.stringify(Object.keys(a),null,2)}`);let u=Q6({});j(`Runtime environment initialized with ${Object.keys(u).length} variables`),r=new ho({command:"npx",args:["-y","@smithery/cli@latest","run",e,"--config",JSON.stringify(JSON.stringify(a))],env:u}),j(`Created transport for server: ${e}`),await Swe(r)}catch(n){t.fail(`Failed to inspect ${e}`),n instanceof Error?console.error(pi.default.red(`Error: ${n.message}`)):console.error(pi.default.red("An unexpected error occurred during inspection")),r&&await r.close(),process.exit(1)}}var n0=oe(Ge());var xa=oe(require("node:fs")),Ij=oe(require("node:os")),wt=oe(require("node:path"));var jj=require("node:child_process"),Q1=Ij.default.homedir(),Owe={win32:{baseDir:process.env.APPDATA||wt.default.join(Q1,"AppData","Roaming"),vscodePath:wt.default.join("Code","User","globalStorage")},darwin:{baseDir:wt.default.join(Q1,"Library","Application Support"),vscodePath:wt.default.join("Code","User","globalStorage")},linux:{baseDir:process.env.XDG_CONFIG_HOME||wt.default.join(Q1,".config"),vscodePath:wt.default.join("Code/User/globalStorage")}},Twe=process.platform,{baseDir:e4,vscodePath:Rj}=Owe[Twe],kj=wt.default.join(e4,"Claude","claude_desktop_config.json"),qwe={claude:{type:"file",path:kj},cline:{type:"file",path:wt.default.join(e4,Rj,"saoudrizwan.claude-dev","settings","cline_mcp_settings.json")},"roo-code":{type:"file",path:wt.default.join(e4,Rj,"rooveterinaryinc.roo-cline","settings","mcp_settings.json")},windsurf:{type:"file",path:wt.default.join(Q1,".codeium","windsurf","mcp_config.json")},witsy:{type:"file",path:wt.default.join(e4,"Witsy","settings.json")},enconvo:{type:"file",path:wt.default.join(Q1,".config","enconvo","mcp_config.json")},cursor:{type:"file",path:wt.default.join(Q1,".cursor","mcp.json")},vscode:{type:"command",command:process.platform==="win32"?"code.cmd":"code"},"vscode-insiders":{type:"command",command:process.platform==="win32"?"code-insiders.cmd":"code-insiders"}};function e0(e){let t=e?.toLowerCase()||"claude";j(`Getting config path for client: ${t}`);let r=qwe[t]||{type:"file",path:wt.default.join(wt.default.dirname(kj),"..",e||"claude",`${t}_config.json`)};return j(`Config path resolved to: ${JSON.stringify(r)}`),r}function t0(e){j(`Reading config for client: ${e}`);try{let t=e0(e);if(t.type==="command")return{mcpServers:{}};if(j(`Checking if config file exists at: ${t}`),!xa.default.existsSync(t.path))return j("Config file not found, returning default empty config"),{mcpServers:{}};j("Reading config file content");let r=JSON.parse(xa.default.readFileSync(t.path,"utf8"));return j(`Config loaded successfully: ${JSON.stringify(r,null,2)}`),{...r,mcpServers:r.mcpServers||{}}}catch(t){return j(`Error reading config: ${t instanceof Error?t.stack:JSON.stringify(t)}`),{mcpServers:{}}}}function t4(e,t){if(j(`Writing config for client: ${t||"default"}`),j(`Config data: ${JSON.stringify(e,null,2)}`),!e.mcpServers||typeof e.mcpServers!="object")throw j("Invalid mcpServers structure in config"),new Error("Invalid mcpServers structure");let r=e0(t);r.type==="command"?Bwe(e,r):Pwe(e,r)}function Bwe(e,t){let r=[];for(let[n,i]of Object.entries(e.mcpServers))r.push("--add-mcp",JSON.stringify({...i,name:n}));j(`Running command: ${JSON.stringify([t.command,...r])}`);try{let n=(0,jj.execFileSync)(t.command,r);j(`Executed command successfully: ${n.toString()}`)}catch(n){throw j(`Error executing command: ${n instanceof Error?n.message:String(n)}`),n&&n.code==="ENOENT"?new Error(`Command '${t.command}' not found. Make sure ${t.command} is installed and on your PATH`):n}}function Pwe(e,t){let r=wt.default.dirname(t.path);j(`Ensuring config directory exists: ${r}`),xa.default.existsSync(r)||(j(`Creating directory: ${r}`),xa.default.mkdirSync(r,{recursive:!0}));let n={mcpServers:{}};try{xa.default.existsSync(t.path)&&(j("Reading existing config file for merging"),n=JSON.parse(xa.default.readFileSync(t.path,"utf8")),j(`Existing config loaded: ${JSON.stringify(n,null,2)}`))}catch(a){j(`Error reading existing config for merge: ${a instanceof Error?a.message:String(a)}`)}j("Merging configs");let i={...n,...e};j(`Merged config: ${JSON.stringify(i,null,2)}`),j(`Writing config to file: ${t.path}`),xa.default.writeFileSync(t.path,JSON.stringify(i,null,2)),j("Config successfully written")}var Gj=oe(V1()),zj=oe(Ge());var r0=require("node:os"),qs=require("node:path"),i4=require("node:fs");var Ft=[];for(let e=0;e<256;++e)Ft.push((e+256).toString(16).slice(1));function Mj(e,t=0){return(Ft[e[t+0]]+Ft[e[t+1]]+Ft[e[t+2]]+Ft[e[t+3]]+"-"+Ft[e[t+4]]+Ft[e[t+5]]+"-"+Ft[e[t+6]]+Ft[e[t+7]]+"-"+Ft[e[t+8]]+Ft[e[t+9]]+"-"+Ft[e[t+10]]+Ft[e[t+11]]+Ft[e[t+12]]+Ft[e[t+13]]+Ft[e[t+14]]+Ft[e[t+15]]).toLowerCase()}var Lj=require("crypto"),n4=new Uint8Array(256),r4=n4.length;function Wv(){return r4>n4.length-16&&((0,Lj.randomFillSync)(n4),r4=0),n4.slice(r4,r4+=16)}var Vj=require("crypto"),$v={randomUUID:Vj.randomUUID};function Nwe(e,t,r){if($v.randomUUID&&!t&&!e)return $v.randomUUID();e=e||{};let n=e.random??e.rng?.()??Wv();if(n.length<16)throw new Error("Random bytes length must be >= 16");if(n[6]=n[6]&15|64,n[8]=n[8]&63|128,t){if(r=r||0,r<0||r+16>t.length)throw new RangeError(`UUID byte range ${r}:${r+15} is out of buffer bounds`);for(let i=0;i<16;++i)t[r+i]=n[i];return t}return Mj(n)}var Gv=Nwe;var ga=null,zv=!1,Hv=()=>({userId:Gv(),analyticsConsent:!1,askedConsent:!1,cache:{servers:{}}}),Uj=()=>{if(process.env.SMITHERY_CONFIG_PATH)return process.env.SMITHERY_CONFIG_PATH;let e={win32:()=>(0,qs.join)(process.env.APPDATA||(0,qs.join)((0,r0.homedir)(),"AppData","Roaming"),"smithery"),darwin:()=>(0,qs.join)((0,r0.homedir)(),"Library","Application Support","smithery"),default:()=>(0,qs.join)((0,r0.homedir)(),".config","smithery")};return(e[(0,r0.platform)()]||e.default)()},Rwe=e=>{if(!e||typeof e!="object")return!1;let{userId:t,analyticsConsent:r,askedConsent:n}=e;return typeof t=="string"&&typeof r=="boolean"&&typeof n=="boolean"},Kv=(e,t)=>`Permission denied: Cannot ${t} settings at ${e}
|
|
103
103
|
Fix with: chmod 700 "${e}"
|
|
104
104
|
Or use: export SMITHERY_CONFIG_PATH="/custom/path"
|
|
105
105
|
Running in memory-only mode (settings won't persist).`,Yv=async(e,t)=>{j(`Saving settings to ${t}`),j(`Settings data: ${JSON.stringify(e,null,2)}`);try{try{j(`Ensuring directory exists: ${t}`),await i4.promises.mkdir(t,{recursive:!0}),j("Directory check completed")}catch(n){if(j(`Directory creation error: ${JSON.stringify(n)}`),n instanceof Error&&"code"in n&&n.code==="EACCES")return{success:!1,error:Kv(t,"write")};throw n}let r=(0,qs.join)(t,"settings.json");return j(`Writing settings to file: ${r}`),await i4.promises.writeFile(r,JSON.stringify(e,null,2)),j("Settings successfully written"),{success:!0,data:e}}catch(r){return j(`Settings save error: ${JSON.stringify(r)}`),{success:!1,error:r instanceof Error&&"code"in r&&r.code==="EACCES"?Kv(t,"write"):`Failed to save settings: ${r instanceof Error?r.message:String(r)}`}}},Iwe=async e=>{j(`Loading settings from ${e}`);try{let t=(0,qs.join)(e,"settings.json");j(`Reading settings file: ${t}`);try{let r=await i4.promises.readFile(t,"utf-8");j("Settings file content loaded");let n=JSON.parse(r);if(j(`Settings parsed: ${JSON.stringify(n,null,2)}`),!Rwe(n)){j("Settings validation failed, fixing settings");let i={...Hv(),...n};return i.analyticsConsent&&(i.askedConsent=!0),j(`Fixed settings: ${JSON.stringify(i,null,2)}`),await Yv(i,e),{success:!0,data:i}}return{success:!0,data:n}}catch(r){if(j(`Settings read error: ${JSON.stringify(r)}`),r instanceof Error&&"code"in r){if(r.code==="ENOENT"){j("Settings file not found, creating default settings");let n=Hv();return j(`Default settings: ${JSON.stringify(n,null,2)}`),await Yv(n,e)}if(r.code==="EACCES")return{success:!1,error:Kv(e,"read")}}throw r}}catch(t){return j(`Settings load error: ${JSON.stringify(t)}`),{success:!1,error:`Failed to load settings: ${t instanceof Error?t.message:String(t)}`}}},Bs=async()=>{if(zv&&ga)return{success:!0,data:ga};try{let e=Uj(),t=await Iwe(e);return t.success&&t.data&&(ga=t.data),zv=!0,t}catch(e){return ga=Hv(),zv=!0,{success:!0,data:ga,error:`Warning: Running in memory-only mode - ${e instanceof Error?e.message:String(e)}`}}};var a4=async()=>{let e=await Bs();return!e.success||!e.data?(console.warn("[Config] Failed to load analytics settings:",e.error),!1):e.data.analyticsConsent},Wj=async e=>{let t=await Bs();return!t.success||!t.data?t:(ga={...t.data,analyticsConsent:e,askedConsent:!0},await Yv(ga,Uj()))},$j=async()=>(await Bs(),ga?.askedConsent||!1);async function Hj(){let e=await Bs();if(!e.success){console.warn("[Analytics] Failed to initialize settings:",e.error);return}if(await a4())return;if(!await $j())try{let{EnableAnalytics:n}=await Gj.default.prompt([{type:"confirm",name:"EnableAnalytics",message:`Would you like to help improve Smithery by sending anonymized usage data?
|