@chatwork/mcp-server
Version:
MCP (Model Context Protocol) server for operating Chatwork from AI
9 lines • 120 kB
JavaScript
#! /usr/bin/env node
import sr from"node:process";var k;(function(r){r.assertEqual=a=>a;function e(a){}r.assertIs=e;function t(a){throw new Error}r.assertNever=t,r.arrayToEnum=a=>{let o={};for(let i of a)o[i]=i;return o},r.getValidEnumValues=a=>{let o=r.objectKeys(a).filter(c=>typeof a[a[c]]!="number"),i={};for(let c of o)i[c]=a[c];return r.objectValues(i)},r.objectValues=a=>r.objectKeys(a).map(function(o){return a[o]}),r.objectKeys=typeof Object.keys=="function"?a=>Object.keys(a):a=>{let o=[];for(let i in a)Object.prototype.hasOwnProperty.call(a,i)&&o.push(i);return o},r.find=(a,o)=>{for(let i of a)if(o(i))return i},r.isInteger=typeof Number.isInteger=="function"?a=>Number.isInteger(a):a=>typeof a=="number"&&isFinite(a)&&Math.floor(a)===a;function s(a,o=" | "){return a.map(i=>typeof i=="string"?`'${i}'`:i).join(o)}r.joinValues=s,r.jsonStringifyReplacer=(a,o)=>typeof o=="bigint"?o.toString():o})(k||(k={}));var gt;(function(r){r.mergeShapes=(e,t)=>({...e,...t})})(gt||(gt={}));var f=k.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),J=r=>{switch(typeof r){case"undefined":return f.undefined;case"string":return f.string;case"number":return isNaN(r)?f.nan:f.number;case"boolean":return f.boolean;case"function":return f.function;case"bigint":return f.bigint;case"symbol":return f.symbol;case"object":return Array.isArray(r)?f.array:r===null?f.null:r.then&&typeof r.then=="function"&&r.catch&&typeof r.catch=="function"?f.promise:typeof Map<"u"&&r instanceof Map?f.map:typeof Set<"u"&&r instanceof Set?f.set:typeof Date<"u"&&r instanceof Date?f.date:f.object;default:return f.unknown}},d=k.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"]),Vs=r=>JSON.stringify(r,null,2).replace(/"([^"]+)":/g,"$1:"),I=class r extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=s=>{this.issues=[...this.issues,s]},this.addIssues=(s=[])=>{this.issues=[...this.issues,...s]};let t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}format(e){let t=e||function(o){return o.message},s={_errors:[]},a=o=>{for(let i of o.issues)if(i.code==="invalid_union")i.unionErrors.map(a);else if(i.code==="invalid_return_type")a(i.returnTypeError);else if(i.code==="invalid_arguments")a(i.argumentsError);else if(i.path.length===0)s._errors.push(t(i));else{let c=s,l=0;for(;l<i.path.length;){let u=i.path[l];l===i.path.length-1?(c[u]=c[u]||{_errors:[]},c[u]._errors.push(t(i))):c[u]=c[u]||{_errors:[]},c=c[u],l++}}};return a(this),s}static assert(e){if(!(e instanceof r))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,k.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=t=>t.message){let t={},s=[];for(let a of this.issues)a.path.length>0?(t[a.path[0]]=t[a.path[0]]||[],t[a.path[0]].push(e(a))):s.push(e(a));return{formErrors:s,fieldErrors:t}}get formErrors(){return this.flatten()}};I.create=r=>new I(r);var xe=(r,e)=>{let t;switch(r.code){case d.invalid_type:r.received===f.undefined?t="Required":t=`Expected ${r.expected}, received ${r.received}`;break;case d.invalid_literal:t=`Invalid literal value, expected ${JSON.stringify(r.expected,k.jsonStringifyReplacer)}`;break;case d.unrecognized_keys:t=`Unrecognized key(s) in object: ${k.joinValues(r.keys,", ")}`;break;case d.invalid_union:t="Invalid input";break;case d.invalid_union_discriminator:t=`Invalid discriminator value. Expected ${k.joinValues(r.options)}`;break;case d.invalid_enum_value:t=`Invalid enum value. Expected ${k.joinValues(r.options)}, received '${r.received}'`;break;case d.invalid_arguments:t="Invalid function arguments";break;case d.invalid_return_type:t="Invalid function return type";break;case d.invalid_date:t="Invalid date";break;case d.invalid_string:typeof r.validation=="object"?"includes"in r.validation?(t=`Invalid input: must include "${r.validation.includes}"`,typeof r.validation.position=="number"&&(t=`${t} at one or more positions greater than or equal to ${r.validation.position}`)):"startsWith"in r.validation?t=`Invalid input: must start with "${r.validation.startsWith}"`:"endsWith"in r.validation?t=`Invalid input: must end with "${r.validation.endsWith}"`:k.assertNever(r.validation):r.validation!=="regex"?t=`Invalid ${r.validation}`:t="Invalid";break;case d.too_small:r.type==="array"?t=`Array must contain ${r.exact?"exactly":r.inclusive?"at least":"more than"} ${r.minimum} element(s)`:r.type==="string"?t=`String must contain ${r.exact?"exactly":r.inclusive?"at least":"over"} ${r.minimum} character(s)`:r.type==="number"?t=`Number must be ${r.exact?"exactly equal to ":r.inclusive?"greater than or equal to ":"greater than "}${r.minimum}`:r.type==="date"?t=`Date must be ${r.exact?"exactly equal to ":r.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(r.minimum))}`:t="Invalid input";break;case d.too_big:r.type==="array"?t=`Array must contain ${r.exact?"exactly":r.inclusive?"at most":"less than"} ${r.maximum} element(s)`:r.type==="string"?t=`String must contain ${r.exact?"exactly":r.inclusive?"at most":"under"} ${r.maximum} character(s)`:r.type==="number"?t=`Number must be ${r.exact?"exactly":r.inclusive?"less than or equal to":"less than"} ${r.maximum}`:r.type==="bigint"?t=`BigInt must be ${r.exact?"exactly":r.inclusive?"less than or equal to":"less than"} ${r.maximum}`:r.type==="date"?t=`Date must be ${r.exact?"exactly":r.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(r.maximum))}`:t="Invalid input";break;case d.custom:t="Invalid input";break;case d.invalid_intersection_types:t="Intersection results could not be merged";break;case d.not_multiple_of:t=`Number must be a multiple of ${r.multipleOf}`;break;case d.not_finite:t="Number must be finite";break;default:t=e.defaultError,k.assertNever(r)}return{message:t}},Nt=xe;function Fs(r){Nt=r}function Ze(){return Nt}var $e=r=>{let{data:e,path:t,errorMaps:s,issueData:a}=r,o=[...t,...a.path||[]],i={...a,path:o};if(a.message!==void 0)return{...a,path:o,message:a.message};let c="",l=s.filter(u=>!!u).slice().reverse();for(let u of l)c=u(i,{data:e,defaultError:c}).message;return{...a,path:o,message:c}},Us=[];function h(r,e){let t=Ze(),s=$e({issueData:e,data:r.data,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,t,t===xe?void 0:xe].filter(a=>!!a)});r.common.issues.push(s)}var j=class r{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,t){let s=[];for(let a of t){if(a.status==="aborted")return y;a.status==="dirty"&&e.dirty(),s.push(a.value)}return{status:e.value,value:s}}static async mergeObjectAsync(e,t){let s=[];for(let a of t){let o=await a.key,i=await a.value;s.push({key:o,value:i})}return r.mergeObjectSync(e,s)}static mergeObjectSync(e,t){let s={};for(let a of t){let{key:o,value:i}=a;if(o.status==="aborted"||i.status==="aborted")return y;o.status==="dirty"&&e.dirty(),i.status==="dirty"&&e.dirty(),o.value!=="__proto__"&&(typeof i.value<"u"||a.alwaysSet)&&(s[o.value]=i.value)}return{status:e.value,value:s}}},y=Object.freeze({status:"aborted"}),be=r=>({status:"dirty",value:r}),E=r=>({status:"valid",value:r}),_t=r=>r.status==="aborted",yt=r=>r.status==="dirty",re=r=>r.status==="valid",Ae=r=>typeof Promise<"u"&&r instanceof Promise;function qe(r,e,t,s){if(t==="a"&&!s)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!s:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?s:t==="a"?s.call(r):s?s.value:e.get(r)}function Zt(r,e,t,s,a){if(s==="m")throw new TypeError("Private method is not writable");if(s==="a"&&!a)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!a:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return s==="a"?a.call(r,t):a?a.value=t:e.set(r,t),t}var g;(function(r){r.errToObj=e=>typeof e=="string"?{message:e}:e||{},r.toString=e=>typeof e=="string"?e:e?.message})(g||(g={}));var Ce,Ee,q=class{constructor(e,t,s,a){this._cachedPath=[],this.parent=e,this.data=t,this._path=s,this._key=a}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},Ot=(r,e)=>{if(re(e))return{success:!0,data:e.value};if(!r.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let t=new I(r.common.issues);return this._error=t,this._error}}};function b(r){if(!r)return{};let{errorMap:e,invalid_type_error:t,required_error:s,description:a}=r;if(e&&(t||s))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:a}:{errorMap:(i,c)=>{var l,u;let{message:p}=r;return i.code==="invalid_enum_value"?{message:p??c.defaultError}:typeof c.data>"u"?{message:(l=p??s)!==null&&l!==void 0?l:c.defaultError}:i.code!=="invalid_type"?{message:c.defaultError}:{message:(u=p??t)!==null&&u!==void 0?u:c.defaultError}},description:a}}var v=class{get description(){return this._def.description}_getType(e){return J(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:J(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new j,ctx:{common:e.parent.common,data:e.data,parsedType:J(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let t=this._parse(e);if(Ae(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){let t=this._parse(e);return Promise.resolve(t)}parse(e,t){let s=this.safeParse(e,t);if(s.success)return s.data;throw s.error}safeParse(e,t){var s;let a={common:{issues:[],async:(s=t?.async)!==null&&s!==void 0?s:!1,contextualErrorMap:t?.errorMap},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:J(e)},o=this._parseSync({data:e,path:a.path,parent:a});return Ot(a,o)}"~validate"(e){var t,s;let a={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:J(e)};if(!this["~standard"].async)try{let o=this._parseSync({data:e,path:[],parent:a});return re(o)?{value:o.value}:{issues:a.common.issues}}catch(o){!((s=(t=o?.message)===null||t===void 0?void 0:t.toLowerCase())===null||s===void 0)&&s.includes("encountered")&&(this["~standard"].async=!0),a.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:a}).then(o=>re(o)?{value:o.value}:{issues:a.common.issues})}async parseAsync(e,t){let s=await this.safeParseAsync(e,t);if(s.success)return s.data;throw s.error}async safeParseAsync(e,t){let s={common:{issues:[],contextualErrorMap:t?.errorMap,async:!0},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:J(e)},a=this._parse({data:e,path:s.path,parent:s}),o=await(Ae(a)?a:Promise.resolve(a));return Ot(s,o)}refine(e,t){let s=a=>typeof t=="string"||typeof t>"u"?{message:t}:typeof t=="function"?t(a):t;return this._refinement((a,o)=>{let i=e(a),c=()=>o.addIssue({code:d.custom,...s(a)});return typeof Promise<"u"&&i instanceof Promise?i.then(l=>l?!0:(c(),!1)):i?!0:(c(),!1)})}refinement(e,t){return this._refinement((s,a)=>e(s)?!0:(a.addIssue(typeof t=="function"?t(s,a):t),!1))}_refinement(e){return new N({schema:this,typeName:m.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:t=>this["~validate"](t)}}optional(){return O.create(this,this._def)}nullable(){return U.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return X.create(this)}promise(){return Q.create(this,this._def)}or(e){return le.create([this,e],this._def)}and(e){return ue.create(this,e,this._def)}transform(e){return new N({...b(this._def),schema:this,typeName:m.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let t=typeof e=="function"?e:()=>e;return new fe({...b(this._def),innerType:this,defaultValue:t,typeName:m.ZodDefault})}brand(){return new Oe({typeName:m.ZodBranded,type:this,...b(this._def)})}catch(e){let t=typeof e=="function"?e:()=>e;return new ge({...b(this._def),innerType:this,catchValue:t,typeName:m.ZodCatch})}describe(e){let t=this.constructor;return new t({...this._def,description:e})}pipe(e){return Me.create(this,e)}readonly(){return _e.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},Bs=/^c[^\s-]{8,}$/i,Gs=/^[0-9a-z]+$/,Js=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Ws=/^[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,Xs=/^[a-z0-9_-]{21}$/i,Ks=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Ys=/^[-+]?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)?)??$/,Qs=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,ea="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",ft,ta=/^(?:(?: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])$/,ra=/^(?:(?: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])$/,sa=/^(([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]))$/,aa=/^(([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])$/,na=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,oa=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,$t="((\\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])))",ia=new RegExp(`^${$t}$`);function qt(r){let e="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return r.precision?e=`${e}\\.\\d{${r.precision}}`:r.precision==null&&(e=`${e}(\\.\\d+)?`),e}function ca(r){return new RegExp(`^${qt(r)}$`)}function Lt(r){let e=`${$t}T${qt(r)}`,t=[];return t.push(r.local?"Z?":"Z"),r.offset&&t.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${t.join("|")})`,new RegExp(`^${e}$`)}function la(r,e){return!!((e==="v4"||!e)&&ta.test(r)||(e==="v6"||!e)&&sa.test(r))}function ua(r,e){if(!Ks.test(r))return!1;try{let[t]=r.split("."),s=t.replace(/-/g,"+").replace(/_/g,"/").padEnd(t.length+(4-t.length%4)%4,"="),a=JSON.parse(atob(s));return!(typeof a!="object"||a===null||!a.typ||!a.alg||e&&a.alg!==e)}catch{return!1}}function da(r,e){return!!((e==="v4"||!e)&&ra.test(r)||(e==="v6"||!e)&&aa.test(r))}var K=class r extends v{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==f.string){let o=this._getOrReturnCtx(e);return h(o,{code:d.invalid_type,expected:f.string,received:o.parsedType}),y}let s=new j,a;for(let o of this._def.checks)if(o.kind==="min")e.data.length<o.value&&(a=this._getOrReturnCtx(e,a),h(a,{code:d.too_small,minimum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),s.dirty());else if(o.kind==="max")e.data.length>o.value&&(a=this._getOrReturnCtx(e,a),h(a,{code:d.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),s.dirty());else if(o.kind==="length"){let i=e.data.length>o.value,c=e.data.length<o.value;(i||c)&&(a=this._getOrReturnCtx(e,a),i?h(a,{code:d.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message}):c&&h(a,{code:d.too_small,minimum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message}),s.dirty())}else if(o.kind==="email")Qs.test(e.data)||(a=this._getOrReturnCtx(e,a),h(a,{validation:"email",code:d.invalid_string,message:o.message}),s.dirty());else if(o.kind==="emoji")ft||(ft=new RegExp(ea,"u")),ft.test(e.data)||(a=this._getOrReturnCtx(e,a),h(a,{validation:"emoji",code:d.invalid_string,message:o.message}),s.dirty());else if(o.kind==="uuid")Ws.test(e.data)||(a=this._getOrReturnCtx(e,a),h(a,{validation:"uuid",code:d.invalid_string,message:o.message}),s.dirty());else if(o.kind==="nanoid")Xs.test(e.data)||(a=this._getOrReturnCtx(e,a),h(a,{validation:"nanoid",code:d.invalid_string,message:o.message}),s.dirty());else if(o.kind==="cuid")Bs.test(e.data)||(a=this._getOrReturnCtx(e,a),h(a,{validation:"cuid",code:d.invalid_string,message:o.message}),s.dirty());else if(o.kind==="cuid2")Gs.test(e.data)||(a=this._getOrReturnCtx(e,a),h(a,{validation:"cuid2",code:d.invalid_string,message:o.message}),s.dirty());else if(o.kind==="ulid")Js.test(e.data)||(a=this._getOrReturnCtx(e,a),h(a,{validation:"ulid",code:d.invalid_string,message:o.message}),s.dirty());else if(o.kind==="url")try{new URL(e.data)}catch{a=this._getOrReturnCtx(e,a),h(a,{validation:"url",code:d.invalid_string,message:o.message}),s.dirty()}else o.kind==="regex"?(o.regex.lastIndex=0,o.regex.test(e.data)||(a=this._getOrReturnCtx(e,a),h(a,{validation:"regex",code:d.invalid_string,message:o.message}),s.dirty())):o.kind==="trim"?e.data=e.data.trim():o.kind==="includes"?e.data.includes(o.value,o.position)||(a=this._getOrReturnCtx(e,a),h(a,{code:d.invalid_string,validation:{includes:o.value,position:o.position},message:o.message}),s.dirty()):o.kind==="toLowerCase"?e.data=e.data.toLowerCase():o.kind==="toUpperCase"?e.data=e.data.toUpperCase():o.kind==="startsWith"?e.data.startsWith(o.value)||(a=this._getOrReturnCtx(e,a),h(a,{code:d.invalid_string,validation:{startsWith:o.value},message:o.message}),s.dirty()):o.kind==="endsWith"?e.data.endsWith(o.value)||(a=this._getOrReturnCtx(e,a),h(a,{code:d.invalid_string,validation:{endsWith:o.value},message:o.message}),s.dirty()):o.kind==="datetime"?Lt(o).test(e.data)||(a=this._getOrReturnCtx(e,a),h(a,{code:d.invalid_string,validation:"datetime",message:o.message}),s.dirty()):o.kind==="date"?ia.test(e.data)||(a=this._getOrReturnCtx(e,a),h(a,{code:d.invalid_string,validation:"date",message:o.message}),s.dirty()):o.kind==="time"?ca(o).test(e.data)||(a=this._getOrReturnCtx(e,a),h(a,{code:d.invalid_string,validation:"time",message:o.message}),s.dirty()):o.kind==="duration"?Ys.test(e.data)||(a=this._getOrReturnCtx(e,a),h(a,{validation:"duration",code:d.invalid_string,message:o.message}),s.dirty()):o.kind==="ip"?la(e.data,o.version)||(a=this._getOrReturnCtx(e,a),h(a,{validation:"ip",code:d.invalid_string,message:o.message}),s.dirty()):o.kind==="jwt"?ua(e.data,o.alg)||(a=this._getOrReturnCtx(e,a),h(a,{validation:"jwt",code:d.invalid_string,message:o.message}),s.dirty()):o.kind==="cidr"?da(e.data,o.version)||(a=this._getOrReturnCtx(e,a),h(a,{validation:"cidr",code:d.invalid_string,message:o.message}),s.dirty()):o.kind==="base64"?na.test(e.data)||(a=this._getOrReturnCtx(e,a),h(a,{validation:"base64",code:d.invalid_string,message:o.message}),s.dirty()):o.kind==="base64url"?oa.test(e.data)||(a=this._getOrReturnCtx(e,a),h(a,{validation:"base64url",code:d.invalid_string,message:o.message}),s.dirty()):k.assertNever(o);return{status:s.value,value:e.data}}_regex(e,t,s){return this.refinement(a=>e.test(a),{validation:t,code:d.invalid_string,...g.errToObj(s)})}_addCheck(e){return new r({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...g.errToObj(e)})}url(e){return this._addCheck({kind:"url",...g.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...g.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...g.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...g.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...g.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...g.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...g.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...g.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...g.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...g.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...g.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...g.errToObj(e)})}datetime(e){var t,s;return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:(t=e?.offset)!==null&&t!==void 0?t:!1,local:(s=e?.local)!==null&&s!==void 0?s:!1,...g.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof e?.precision>"u"?null:e?.precision,...g.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...g.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...g.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t?.position,...g.errToObj(t?.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...g.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...g.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...g.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...g.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...g.errToObj(t)})}nonempty(e){return this.min(1,g.errToObj(e))}trim(){return new r({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new r({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new r({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}};K.create=r=>{var e;return new K({checks:[],typeName:m.ZodString,coerce:(e=r?.coerce)!==null&&e!==void 0?e:!1,...b(r)})};function ma(r,e){let t=(r.toString().split(".")[1]||"").length,s=(e.toString().split(".")[1]||"").length,a=t>s?t:s,o=parseInt(r.toFixed(a).replace(".","")),i=parseInt(e.toFixed(a).replace(".",""));return o%i/Math.pow(10,a)}var se=class r extends v{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==f.number){let o=this._getOrReturnCtx(e);return h(o,{code:d.invalid_type,expected:f.number,received:o.parsedType}),y}let s,a=new j;for(let o of this._def.checks)o.kind==="int"?k.isInteger(e.data)||(s=this._getOrReturnCtx(e,s),h(s,{code:d.invalid_type,expected:"integer",received:"float",message:o.message}),a.dirty()):o.kind==="min"?(o.inclusive?e.data<o.value:e.data<=o.value)&&(s=this._getOrReturnCtx(e,s),h(s,{code:d.too_small,minimum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),a.dirty()):o.kind==="max"?(o.inclusive?e.data>o.value:e.data>=o.value)&&(s=this._getOrReturnCtx(e,s),h(s,{code:d.too_big,maximum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),a.dirty()):o.kind==="multipleOf"?ma(e.data,o.value)!==0&&(s=this._getOrReturnCtx(e,s),h(s,{code:d.not_multiple_of,multipleOf:o.value,message:o.message}),a.dirty()):o.kind==="finite"?Number.isFinite(e.data)||(s=this._getOrReturnCtx(e,s),h(s,{code:d.not_finite,message:o.message}),a.dirty()):k.assertNever(o);return{status:a.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,g.toString(t))}gt(e,t){return this.setLimit("min",e,!1,g.toString(t))}lte(e,t){return this.setLimit("max",e,!0,g.toString(t))}lt(e,t){return this.setLimit("max",e,!1,g.toString(t))}setLimit(e,t,s,a){return new r({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:s,message:g.toString(a)}]})}_addCheck(e){return new r({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:g.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:g.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:g.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:g.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:g.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:g.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:g.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:g.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:g.toString(e)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&k.isInteger(e.value))}get isFinite(){let e=null,t=null;for(let s of this._def.checks){if(s.kind==="finite"||s.kind==="int"||s.kind==="multipleOf")return!0;s.kind==="min"?(t===null||s.value>t)&&(t=s.value):s.kind==="max"&&(e===null||s.value<e)&&(e=s.value)}return Number.isFinite(t)&&Number.isFinite(e)}};se.create=r=>new se({checks:[],typeName:m.ZodNumber,coerce:r?.coerce||!1,...b(r)});var ae=class r extends v{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==f.bigint)return this._getInvalidInput(e);let s,a=new j;for(let o of this._def.checks)o.kind==="min"?(o.inclusive?e.data<o.value:e.data<=o.value)&&(s=this._getOrReturnCtx(e,s),h(s,{code:d.too_small,type:"bigint",minimum:o.value,inclusive:o.inclusive,message:o.message}),a.dirty()):o.kind==="max"?(o.inclusive?e.data>o.value:e.data>=o.value)&&(s=this._getOrReturnCtx(e,s),h(s,{code:d.too_big,type:"bigint",maximum:o.value,inclusive:o.inclusive,message:o.message}),a.dirty()):o.kind==="multipleOf"?e.data%o.value!==BigInt(0)&&(s=this._getOrReturnCtx(e,s),h(s,{code:d.not_multiple_of,multipleOf:o.value,message:o.message}),a.dirty()):k.assertNever(o);return{status:a.value,value:e.data}}_getInvalidInput(e){let t=this._getOrReturnCtx(e);return h(t,{code:d.invalid_type,expected:f.bigint,received:t.parsedType}),y}gte(e,t){return this.setLimit("min",e,!0,g.toString(t))}gt(e,t){return this.setLimit("min",e,!1,g.toString(t))}lte(e,t){return this.setLimit("max",e,!0,g.toString(t))}lt(e,t){return this.setLimit("max",e,!1,g.toString(t))}setLimit(e,t,s,a){return new r({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:s,message:g.toString(a)}]})}_addCheck(e){return new r({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:g.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:g.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:g.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:g.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:g.toString(t)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}};ae.create=r=>{var e;return new ae({checks:[],typeName:m.ZodBigInt,coerce:(e=r?.coerce)!==null&&e!==void 0?e:!1,...b(r)})};var ne=class extends v{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==f.boolean){let s=this._getOrReturnCtx(e);return h(s,{code:d.invalid_type,expected:f.boolean,received:s.parsedType}),y}return E(e.data)}};ne.create=r=>new ne({typeName:m.ZodBoolean,coerce:r?.coerce||!1,...b(r)});var oe=class r extends v{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==f.date){let o=this._getOrReturnCtx(e);return h(o,{code:d.invalid_type,expected:f.date,received:o.parsedType}),y}if(isNaN(e.data.getTime())){let o=this._getOrReturnCtx(e);return h(o,{code:d.invalid_date}),y}let s=new j,a;for(let o of this._def.checks)o.kind==="min"?e.data.getTime()<o.value&&(a=this._getOrReturnCtx(e,a),h(a,{code:d.too_small,message:o.message,inclusive:!0,exact:!1,minimum:o.value,type:"date"}),s.dirty()):o.kind==="max"?e.data.getTime()>o.value&&(a=this._getOrReturnCtx(e,a),h(a,{code:d.too_big,message:o.message,inclusive:!0,exact:!1,maximum:o.value,type:"date"}),s.dirty()):k.assertNever(o);return{status:s.value,value:new Date(e.data.getTime())}}_addCheck(e){return new r({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:g.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:g.toString(t)})}get minDate(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e!=null?new Date(e):null}};oe.create=r=>new oe({checks:[],coerce:r?.coerce||!1,typeName:m.ZodDate,...b(r)});var ke=class extends v{_parse(e){if(this._getType(e)!==f.symbol){let s=this._getOrReturnCtx(e);return h(s,{code:d.invalid_type,expected:f.symbol,received:s.parsedType}),y}return E(e.data)}};ke.create=r=>new ke({typeName:m.ZodSymbol,...b(r)});var ie=class extends v{_parse(e){if(this._getType(e)!==f.undefined){let s=this._getOrReturnCtx(e);return h(s,{code:d.invalid_type,expected:f.undefined,received:s.parsedType}),y}return E(e.data)}};ie.create=r=>new ie({typeName:m.ZodUndefined,...b(r)});var ce=class extends v{_parse(e){if(this._getType(e)!==f.null){let s=this._getOrReturnCtx(e);return h(s,{code:d.invalid_type,expected:f.null,received:s.parsedType}),y}return E(e.data)}};ce.create=r=>new ce({typeName:m.ZodNull,...b(r)});var Y=class extends v{constructor(){super(...arguments),this._any=!0}_parse(e){return E(e.data)}};Y.create=r=>new Y({typeName:m.ZodAny,...b(r)});var W=class extends v{constructor(){super(...arguments),this._unknown=!0}_parse(e){return E(e.data)}};W.create=r=>new W({typeName:m.ZodUnknown,...b(r)});var L=class extends v{_parse(e){let t=this._getOrReturnCtx(e);return h(t,{code:d.invalid_type,expected:f.never,received:t.parsedType}),y}};L.create=r=>new L({typeName:m.ZodNever,...b(r)});var Se=class extends v{_parse(e){if(this._getType(e)!==f.undefined){let s=this._getOrReturnCtx(e);return h(s,{code:d.invalid_type,expected:f.void,received:s.parsedType}),y}return E(e.data)}};Se.create=r=>new Se({typeName:m.ZodVoid,...b(r)});var X=class r extends v{_parse(e){let{ctx:t,status:s}=this._processInputParams(e),a=this._def;if(t.parsedType!==f.array)return h(t,{code:d.invalid_type,expected:f.array,received:t.parsedType}),y;if(a.exactLength!==null){let i=t.data.length>a.exactLength.value,c=t.data.length<a.exactLength.value;(i||c)&&(h(t,{code:i?d.too_big:d.too_small,minimum:c?a.exactLength.value:void 0,maximum:i?a.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:a.exactLength.message}),s.dirty())}if(a.minLength!==null&&t.data.length<a.minLength.value&&(h(t,{code:d.too_small,minimum:a.minLength.value,type:"array",inclusive:!0,exact:!1,message:a.minLength.message}),s.dirty()),a.maxLength!==null&&t.data.length>a.maxLength.value&&(h(t,{code:d.too_big,maximum:a.maxLength.value,type:"array",inclusive:!0,exact:!1,message:a.maxLength.message}),s.dirty()),t.common.async)return Promise.all([...t.data].map((i,c)=>a.type._parseAsync(new q(t,i,t.path,c)))).then(i=>j.mergeArray(s,i));let o=[...t.data].map((i,c)=>a.type._parseSync(new q(t,i,t.path,c)));return j.mergeArray(s,o)}get element(){return this._def.type}min(e,t){return new r({...this._def,minLength:{value:e,message:g.toString(t)}})}max(e,t){return new r({...this._def,maxLength:{value:e,message:g.toString(t)}})}length(e,t){return new r({...this._def,exactLength:{value:e,message:g.toString(t)}})}nonempty(e){return this.min(1,e)}};X.create=(r,e)=>new X({type:r,minLength:null,maxLength:null,exactLength:null,typeName:m.ZodArray,...b(e)});function ve(r){if(r instanceof M){let e={};for(let t in r.shape){let s=r.shape[t];e[t]=O.create(ve(s))}return new M({...r._def,shape:()=>e})}else return r instanceof X?new X({...r._def,type:ve(r.element)}):r instanceof O?O.create(ve(r.unwrap())):r instanceof U?U.create(ve(r.unwrap())):r instanceof F?F.create(r.items.map(e=>ve(e))):r}var M=class r extends v{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),t=k.objectKeys(e);return this._cached={shape:e,keys:t}}_parse(e){if(this._getType(e)!==f.object){let u=this._getOrReturnCtx(e);return h(u,{code:d.invalid_type,expected:f.object,received:u.parsedType}),y}let{status:s,ctx:a}=this._processInputParams(e),{shape:o,keys:i}=this._getCached(),c=[];if(!(this._def.catchall instanceof L&&this._def.unknownKeys==="strip"))for(let u in a.data)i.includes(u)||c.push(u);let l=[];for(let u of i){let p=o[u],w=a.data[u];l.push({key:{status:"valid",value:u},value:p._parse(new q(a,w,a.path,u)),alwaysSet:u in a.data})}if(this._def.catchall instanceof L){let u=this._def.unknownKeys;if(u==="passthrough")for(let p of c)l.push({key:{status:"valid",value:p},value:{status:"valid",value:a.data[p]}});else if(u==="strict")c.length>0&&(h(a,{code:d.unrecognized_keys,keys:c}),s.dirty());else if(u!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let u=this._def.catchall;for(let p of c){let w=a.data[p];l.push({key:{status:"valid",value:p},value:u._parse(new q(a,w,a.path,p)),alwaysSet:p in a.data})}}return a.common.async?Promise.resolve().then(async()=>{let u=[];for(let p of l){let w=await p.key,ee=await p.value;u.push({key:w,value:ee,alwaysSet:p.alwaysSet})}return u}).then(u=>j.mergeObjectSync(s,u)):j.mergeObjectSync(s,l)}get shape(){return this._def.shape()}strict(e){return g.errToObj,new r({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,s)=>{var a,o,i,c;let l=(i=(o=(a=this._def).errorMap)===null||o===void 0?void 0:o.call(a,t,s).message)!==null&&i!==void 0?i:s.defaultError;return t.code==="unrecognized_keys"?{message:(c=g.errToObj(e).message)!==null&&c!==void 0?c:l}:{message:l}}}:{}})}strip(){return new r({...this._def,unknownKeys:"strip"})}passthrough(){return new r({...this._def,unknownKeys:"passthrough"})}extend(e){return new r({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new r({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:m.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new r({...this._def,catchall:e})}pick(e){let t={};return k.objectKeys(e).forEach(s=>{e[s]&&this.shape[s]&&(t[s]=this.shape[s])}),new r({...this._def,shape:()=>t})}omit(e){let t={};return k.objectKeys(this.shape).forEach(s=>{e[s]||(t[s]=this.shape[s])}),new r({...this._def,shape:()=>t})}deepPartial(){return ve(this)}partial(e){let t={};return k.objectKeys(this.shape).forEach(s=>{let a=this.shape[s];e&&!e[s]?t[s]=a:t[s]=a.optional()}),new r({...this._def,shape:()=>t})}required(e){let t={};return k.objectKeys(this.shape).forEach(s=>{if(e&&!e[s])t[s]=this.shape[s];else{let o=this.shape[s];for(;o instanceof O;)o=o._def.innerType;t[s]=o}}),new r({...this._def,shape:()=>t})}keyof(){return Dt(k.objectKeys(this.shape))}};M.create=(r,e)=>new M({shape:()=>r,unknownKeys:"strip",catchall:L.create(),typeName:m.ZodObject,...b(e)});M.strictCreate=(r,e)=>new M({shape:()=>r,unknownKeys:"strict",catchall:L.create(),typeName:m.ZodObject,...b(e)});M.lazycreate=(r,e)=>new M({shape:r,unknownKeys:"strip",catchall:L.create(),typeName:m.ZodObject,...b(e)});var le=class extends v{_parse(e){let{ctx:t}=this._processInputParams(e),s=this._def.options;function a(o){for(let c of o)if(c.result.status==="valid")return c.result;for(let c of o)if(c.result.status==="dirty")return t.common.issues.push(...c.ctx.common.issues),c.result;let i=o.map(c=>new I(c.ctx.common.issues));return h(t,{code:d.invalid_union,unionErrors:i}),y}if(t.common.async)return Promise.all(s.map(async o=>{let i={...t,common:{...t.common,issues:[]},parent:null};return{result:await o._parseAsync({data:t.data,path:t.path,parent:i}),ctx:i}})).then(a);{let o,i=[];for(let l of s){let u={...t,common:{...t.common,issues:[]},parent:null},p=l._parseSync({data:t.data,path:t.path,parent:u});if(p.status==="valid")return p;p.status==="dirty"&&!o&&(o={result:p,ctx:u}),u.common.issues.length&&i.push(u.common.issues)}if(o)return t.common.issues.push(...o.ctx.common.issues),o.result;let c=i.map(l=>new I(l));return h(t,{code:d.invalid_union,unionErrors:c}),y}}get options(){return this._def.options}};le.create=(r,e)=>new le({options:r,typeName:m.ZodUnion,...b(e)});var G=r=>r instanceof de?G(r.schema):r instanceof N?G(r.innerType()):r instanceof me?[r.value]:r instanceof pe?r.options:r instanceof he?k.objectValues(r.enum):r instanceof fe?G(r._def.innerType):r instanceof ie?[void 0]:r instanceof ce?[null]:r instanceof O?[void 0,...G(r.unwrap())]:r instanceof U?[null,...G(r.unwrap())]:r instanceof Oe||r instanceof _e?G(r.unwrap()):r instanceof ge?G(r._def.innerType):[],Le=class r extends v{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==f.object)return h(t,{code:d.invalid_type,expected:f.object,received:t.parsedType}),y;let s=this.discriminator,a=t.data[s],o=this.optionsMap.get(a);return o?t.common.async?o._parseAsync({data:t.data,path:t.path,parent:t}):o._parseSync({data:t.data,path:t.path,parent:t}):(h(t,{code:d.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[s]}),y)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,s){let a=new Map;for(let o of t){let i=G(o.shape[e]);if(!i.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let c of i){if(a.has(c))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(c)}`);a.set(c,o)}}return new r({typeName:m.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:a,...b(s)})}};function vt(r,e){let t=J(r),s=J(e);if(r===e)return{valid:!0,data:r};if(t===f.object&&s===f.object){let a=k.objectKeys(e),o=k.objectKeys(r).filter(c=>a.indexOf(c)!==-1),i={...r,...e};for(let c of o){let l=vt(r[c],e[c]);if(!l.valid)return{valid:!1};i[c]=l.data}return{valid:!0,data:i}}else if(t===f.array&&s===f.array){if(r.length!==e.length)return{valid:!1};let a=[];for(let o=0;o<r.length;o++){let i=r[o],c=e[o],l=vt(i,c);if(!l.valid)return{valid:!1};a.push(l.data)}return{valid:!0,data:a}}else return t===f.date&&s===f.date&&+r==+e?{valid:!0,data:r}:{valid:!1}}var ue=class extends v{_parse(e){let{status:t,ctx:s}=this._processInputParams(e),a=(o,i)=>{if(_t(o)||_t(i))return y;let c=vt(o.value,i.value);return c.valid?((yt(o)||yt(i))&&t.dirty(),{status:t.value,value:c.data}):(h(s,{code:d.invalid_intersection_types}),y)};return s.common.async?Promise.all([this._def.left._parseAsync({data:s.data,path:s.path,parent:s}),this._def.right._parseAsync({data:s.data,path:s.path,parent:s})]).then(([o,i])=>a(o,i)):a(this._def.left._parseSync({data:s.data,path:s.path,parent:s}),this._def.right._parseSync({data:s.data,path:s.path,parent:s}))}};ue.create=(r,e,t)=>new ue({left:r,right:e,typeName:m.ZodIntersection,...b(t)});var F=class r extends v{_parse(e){let{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==f.array)return h(s,{code:d.invalid_type,expected:f.array,received:s.parsedType}),y;if(s.data.length<this._def.items.length)return h(s,{code:d.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),y;!this._def.rest&&s.data.length>this._def.items.length&&(h(s,{code:d.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());let o=[...s.data].map((i,c)=>{let l=this._def.items[c]||this._def.rest;return l?l._parse(new q(s,i,s.path,c)):null}).filter(i=>!!i);return s.common.async?Promise.all(o).then(i=>j.mergeArray(t,i)):j.mergeArray(t,o)}get items(){return this._def.items}rest(e){return new r({...this._def,rest:e})}};F.create=(r,e)=>{if(!Array.isArray(r))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new F({items:r,typeName:m.ZodTuple,rest:null,...b(e)})};var De=class r extends v{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==f.object)return h(s,{code:d.invalid_type,expected:f.object,received:s.parsedType}),y;let a=[],o=this._def.keyType,i=this._def.valueType;for(let c in s.data)a.push({key:o._parse(new q(s,c,s.path,c)),value:i._parse(new q(s,s.data[c],s.path,c)),alwaysSet:c in s.data});return s.common.async?j.mergeObjectAsync(t,a):j.mergeObjectSync(t,a)}get element(){return this._def.valueType}static create(e,t,s){return t instanceof v?new r({keyType:e,valueType:t,typeName:m.ZodRecord,...b(s)}):new r({keyType:K.create(),valueType:e,typeName:m.ZodRecord,...b(t)})}},Re=class extends v{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==f.map)return h(s,{code:d.invalid_type,expected:f.map,received:s.parsedType}),y;let a=this._def.keyType,o=this._def.valueType,i=[...s.data.entries()].map(([c,l],u)=>({key:a._parse(new q(s,c,s.path,[u,"key"])),value:o._parse(new q(s,l,s.path,[u,"value"]))}));if(s.common.async){let c=new Map;return Promise.resolve().then(async()=>{for(let l of i){let u=await l.key,p=await l.value;if(u.status==="aborted"||p.status==="aborted")return y;(u.status==="dirty"||p.status==="dirty")&&t.dirty(),c.set(u.value,p.value)}return{status:t.value,value:c}})}else{let c=new Map;for(let l of i){let u=l.key,p=l.value;if(u.status==="aborted"||p.status==="aborted")return y;(u.status==="dirty"||p.status==="dirty")&&t.dirty(),c.set(u.value,p.value)}return{status:t.value,value:c}}}};Re.create=(r,e,t)=>new Re({valueType:e,keyType:r,typeName:m.ZodMap,...b(t)});var Te=class r extends v{_parse(e){let{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==f.set)return h(s,{code:d.invalid_type,expected:f.set,received:s.parsedType}),y;let a=this._def;a.minSize!==null&&s.data.size<a.minSize.value&&(h(s,{code:d.too_small,minimum:a.minSize.value,type:"set",inclusive:!0,exact:!1,message:a.minSize.message}),t.dirty()),a.maxSize!==null&&s.data.size>a.maxSize.value&&(h(s,{code:d.too_big,maximum:a.maxSize.value,type:"set",inclusive:!0,exact:!1,message:a.maxSize.message}),t.dirty());let o=this._def.valueType;function i(l){let u=new Set;for(let p of l){if(p.status==="aborted")return y;p.status==="dirty"&&t.dirty(),u.add(p.value)}return{status:t.value,value:u}}let c=[...s.data.values()].map((l,u)=>o._parse(new q(s,l,s.path,u)));return s.common.async?Promise.all(c).then(l=>i(l)):i(c)}min(e,t){return new r({...this._def,minSize:{value:e,message:g.toString(t)}})}max(e,t){return new r({...this._def,maxSize:{value:e,message:g.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}};Te.create=(r,e)=>new Te({valueType:r,minSize:null,maxSize:null,typeName:m.ZodSet,...b(e)});var ze=class r extends v{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==f.function)return h(t,{code:d.invalid_type,expected:f.function,received:t.parsedType}),y;function s(c,l){return $e({data:c,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Ze(),xe].filter(u=>!!u),issueData:{code:d.invalid_arguments,argumentsError:l}})}function a(c,l){return $e({data:c,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Ze(),xe].filter(u=>!!u),issueData:{code:d.invalid_return_type,returnTypeError:l}})}let o={errorMap:t.common.contextualErrorMap},i=t.data;if(this._def.returns instanceof Q){let c=this;return E(async function(...l){let u=new I([]),p=await c._def.args.parseAsync(l,o).catch(ye=>{throw u.addIssue(s(l,ye)),u}),w=await Reflect.apply(i,this,p);return await c._def.returns._def.type.parseAsync(w,o).catch(ye=>{throw u.addIssue(a(w,ye)),u})})}else{let c=this;return E(function(...l){let u=c._def.args.safeParse(l,o);if(!u.success)throw new I([s(l,u.error)]);let p=Reflect.apply(i,this,u.data),w=c._def.returns.safeParse(p,o);if(!w.success)throw new I([a(p,w.error)]);return w.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new r({...this._def,args:F.create(e).rest(W.create())})}returns(e){return new r({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,s){return new r({args:e||F.create([]).rest(W.create()),returns:t||W.create(),typeName:m.ZodFunction,...b(s)})}},de=class extends v{get schema(){return this._def.getter()}_parse(e){let{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}};de.create=(r,e)=>new de({getter:r,typeName:m.ZodLazy,...b(e)});var me=class extends v{_parse(e){if(e.data!==this._def.value){let t=this._getOrReturnCtx(e);return h(t,{received:t.data,code:d.invalid_literal,expected:this._def.value}),y}return{status:"valid",value:e.data}}get value(){return this._def.value}};me.create=(r,e)=>new me({value:r,typeName:m.ZodLiteral,...b(e)});function Dt(r,e){return new pe({values:r,typeName:m.ZodEnum,...b(e)})}var pe=class r extends v{constructor(){super(...arguments),Ce.set(this,void 0)}_parse(e){if(typeof e.data!="string"){let t=this._getOrReturnCtx(e),s=this._def.values;return h(t,{expected:k.joinValues(s),received:t.parsedType,code:d.invalid_type}),y}if(qe(this,Ce,"f")||Zt(this,Ce,new Set(this._def.values),"f"),!qe(this,Ce,"f").has(e.data)){let t=this._getOrReturnCtx(e),s=this._def.values;return h(t,{received:t.data,code:d.invalid_enum_value,options:s}),y}return E(e.data)}get options(){return this._def.values}get enum(){let e={};for(let t of this._def.values)e[t]=t;return e}get Values(){let e={};for(let t of this._def.values)e[t]=t;return e}get Enum(){let e={};for(let t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return r.create(e,{...this._def,...t})}exclude(e,t=this._def){return r.create(this.options.filter(s=>!e.includes(s)),{...this._def,...t})}};Ce=new WeakMap;pe.create=Dt;var he=class extends v{constructor(){super(...arguments),Ee.set(this,void 0)}_parse(e){let t=k.getValidEnumValues(this._def.values),s=this._getOrReturnCtx(e);if(s.parsedType!==f.string&&s.parsedType!==f.number){let a=k.objectValues(t);return h(s,{expected:k.joinValues(a),received:s.parsedType,code:d.invalid_type}),y}if(qe(this,Ee,"f")||Zt(this,Ee,new Set(k.getValidEnumValues(this._def.values)),"f"),!qe(this,Ee,"f").has(e.data)){let a=k.objectValues(t);return h(s,{received:s.data,code:d.invalid_enum_value,options:a}),y}return E(e.data)}get enum(){return this._def.values}};Ee=new WeakMap;he.create=(r,e)=>new he({values:r,typeName:m.ZodNativeEnum,...b(e)});var Q=class extends v{unwrap(){return this._def.type}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==f.promise&&t.common.async===!1)return h(t,{code:d.invalid_type,expected:f.promise,received:t.parsedType}),y;let s=t.parsedType===f.promise?t.data:Promise.resolve(t.data);return E(s.then(a=>this._def.type.parseAsync(a,{path:t.path,errorMap:t.common.contextualErrorMap})))}};Q.create=(r,e)=>new Q({type:r,typeName:m.ZodPromise,...b(e)});var N=class extends v{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===m.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:t,ctx:s}=this._processInputParams(e),a=this._def.effect||null,o={addIssue:i=>{h(s,i),i.fatal?t.abort():t.dirty()},get path(){return s.path}};if(o.addIssue=o.addIssue.bind(o),a.type==="preprocess"){let i=a.transform(s.data,o);if(s.common.async)return Promise.resolve(i).then(async c=>{if(t.value==="aborted")return y;let l=await this._def.schema._parseAsync({data:c,path:s.path,parent:s});return l.status==="aborted"?y:l.status==="dirty"||t.value==="dirty"?be(l.value):l});{if(t.value==="aborted")return y;let c=this._def.schema._parseSync({data:i,path:s.path,parent:s});return c.status==="aborted"?y:c.status==="dirty"||t.value==="dirty"?be(c.value):c}}if(a.type==="refinement"){let i=c=>{let l=a.refinement(c,o);if(s.common.async)return Promise.resolve(l);if(l instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return c};if(s.common.async===!1){let c=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});return c.status==="aborted"?y:(c.status==="dirty"&&t.dirty(),i(c.value),{status:t.value,value:c.value})}else return this._def.schema._parseAsync({data:s.data,path:s.path,parent:s}).then(c=>c.status==="aborted"?y:(c.status==="dirty"&&t.dirty(),i(c.value).then(()=>({status:t.value,value:c.value}))))}if(a.type==="transform")if(s.common.async===!1){let i=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});if(!re(i))return i;let c=a.transform(i.value,o);if(c instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:c}}else return this._def.schema._parseAsync({data:s.data,path:s.path,parent:s}).then(i=>re(i)?Promise.resolve(a.transform(i.value,o)).then(c=>({status:t.value,value:c})):i);k.assertNever(a)}};N.create=(r,e,t)=>new N({schema:r,typeName:m.ZodEffects,effect:e,...b(t)});N.createWithPreprocess=(r,e,t)=>new N({schema:e,effect:{type:"preprocess",transform:r},typeName:m.ZodEffects,...b(t)});var O=class extends v{_parse(e){return this._getType(e)===f.undefined?E(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};O.create=(r,e)=>new O({innerType:r,typeName:m.ZodOptional,...b(e)});var U=class extends v{_parse(e){return this._getType(e)===f.null?E(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};U.create=(r,e)=>new U({innerType:r,typeName:m.ZodNullable,...b(e)});var fe=class extends v{_parse(e){let{ctx:t}=this._processInputParams(e),s=t.data;return t.parsedType===f.undefined&&(s=this._def.defaultValue()),this._def.innerType._parse({data:s,path:t.path,parent:t})}removeDefault(){return this._def.innerType}};fe.create=(r,e)=>new fe({innerType:r,typeName:m.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...b(e)});var ge=class extends v{_parse(e){let{ctx:t}=this._processInputParams(e),s={...t,common:{...t.common,issues:[]}},a=this._def.innerType._parse({data:s.data,path:s.path,parent:{...s}});return Ae(a)?a.then(o=>({status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new I(s.common.issues)},input:s.data})})):{status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new I(s.common.issues)},input:s.data})}}removeCatch(){return this._def.innerType}};ge.create=(r,e)=>new ge({innerType:r,typeName:m.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...b(e)});var we=class extends v{_parse(e){if(this._getType(e)!==f.nan){let s=this._getOrReturnCtx(e);return h(s,{code:d.invalid_type,expected:f.nan,received:s.parsedType}),y}return{status:"valid",value:e.data}}};we.create=r=>new we({typeName:m.ZodNaN,...b(r)});var pa=Symbol("zod_brand"),Oe=class extends v{_parse(e){let{ctx:t}=this._processInputParams(e),s=t.data;return this._def.type._parse({data:s,path:t.path,parent:t})}unwrap(){return this._def.type}},Me=class r extends v{_parse(e){let{status:t,ctx:s}=this._processInputParams(e);if(s.common.async)return(async()=>{let o=await this._def.in._parseAsync({data:s.data,path:s.path,parent:s});return o.status==="aborted"?y:o.status==="dirty"?(t.dirty(),be(o.value)):this._def.out._parseAsync({data:o.value,path:s.path,parent:s})})();{let a=this._def.in._parseSync({data:s.data,path:s.path,parent:s});return a.status==="aborted"?y:a.status==="dirty"?(t.dirty(),{status:"dirty",value:a.value}):this._def.out._parseSync({data:a.value,path:s.path,parent:s})}}static create(e,t){return new r({in:e,out:t,typeName:m.ZodPipeline})}},_e=class extends v{_parse(e){let t=this._def.innerType._parse(e),s=a=>(re(a)&&(a.value=Object.freeze(a.value)),a);return Ae(t)?t.then(a=>s(a)):s(t)}unwrap(){return this._def.innerType}};_e.create=(r,e)=>new _e({innerType:r,typeName:m.ZodReadonly,...b(e)});function Mt(r,e){let t=typeof r=="function"?r(e):typeof r=="string"?{message:r}:r;return typeof t=="string"?{message:t}:t}function zt(r,e={},t){return r?Y.create().superRefine((s,a)=>{var o,i;let c=r(s);if(c instanceof Promise)return c.then(l=>{var u,p;if(!l){let w=Mt(e,s),ee=(p=(u=w.fatal)!==null&&u!==void 0?u:t)!==null&&p!==void 0?p:!0;a.addIssue({code:"custom",...w,fatal:ee})}});if(!c){let l=Mt(e,s),u=(i=(o=l.fatal)!==null&&o!==void 0?o:t)!==null&&i!==void 0?i:!0;a.addIssue({code:"custom",...l,fatal:u})}}):Y.create()}var ha={object:M.lazycreate},m;(function(r){r.ZodString="ZodString",r.ZodNumber="ZodNumber",r.ZodNaN="ZodNaN",r.ZodBigInt="ZodBigInt",r.ZodBoolean="ZodBoolean",r.ZodDate="ZodDate",r.ZodSymbol="ZodSymbol",r.ZodUndefined="ZodUndefined",r.ZodNull="ZodNull",r.ZodAny="ZodAny",r.ZodUnknown="ZodUnknown",r.ZodNever="ZodNever",r.ZodVoid="ZodVoid",r.ZodArray="ZodArray",r.ZodObject="ZodObject",r.ZodUnion="ZodUnion",r.ZodDiscriminatedUnion="ZodDiscriminatedUnion",r.ZodIntersection="ZodIntersection",r.ZodTuple="ZodTuple",r.ZodRecord="ZodRecord",r.ZodMap="ZodMap",r.ZodSet="ZodSet",r.ZodFunction="ZodFunction",r.ZodLazy="ZodLazy",r.ZodLiteral="ZodLiteral",r.ZodEnum="ZodEnum",r.ZodEffects="ZodEffects",r.ZodNativeEnum="ZodNativeEnum",r.ZodOptional="ZodOptional",r.ZodNullable="ZodNullable",r.ZodDefault="ZodDefault",r.ZodCatch="ZodCatch",r.ZodPromise="ZodPromise",r.ZodBranded="ZodBranded",r.ZodPipeline="ZodPipeline",r.ZodReadonly="ZodReadonly"})(m||(m={}));var fa=(r,e={message:`Input not instance of ${r.name}`})=>zt(t=>t instanceof r,e),Ht=K.create,Vt=se.create,ga=we.create,_a=ae.create,Ft=ne.create,ya=oe.create,va=ke.create,ba=ie.create,xa=ce.create,ka=Y.create,Sa=W.create,Ra=L.create,Ta=Se.create,wa=X.create,Pa=M.create,ja=M.strictCreate,Ca=le.create,Ea=Le.create,Aa=ue.create,Oa=F.create,Ma=De.create,Ia=Re.create,Na=Te.create,Za=ze.create,$a=de.create,qa=me.create,La=pe.create,Da=he.create,za=Q.create,It=N.create,Ha=O.create,Va=U.create,Fa=N.createWithPreprocess,Ua=Me.create,Ba=()=>Ht().optional(),Ga=()=>Vt().optional(),Ja=()=>Ft().optional(),Wa={string:r=>K.create({...r,coerce:!0}),number:r=>se.create({...r,coerce:!0}),boolean:r=>ne.create({...r,coerce:!0}),bigint:r=>ae.create({...r,coerce:!0}),date:r=>oe.create({...r,coerce:!0})},Xa=y,n=Object.freeze({__proto__:null,defaultErrorMap:xe,setErrorMap:Fs,getErrorMap:Ze,makeIssue:$e,EMPTY_PATH:Us,addIssueToContext:h,ParseStatus:j,INVALID:y,DIRTY:be,OK:E,isAborted:_t,isDirty:yt,isValid:re,isAsync:Ae,get util(){return k},get objectUtil(){return gt},ZodParsedType:f,getParsedType:J,ZodType:v,datetimeRegex:Lt,ZodString:K,ZodNumber:se,ZodBigInt:ae,ZodBoolean:ne,ZodDate:oe,ZodSymbol:ke,ZodUndefined:ie,ZodNull:ce,ZodAny:Y,ZodUnknown:W,ZodNever:L,ZodVoid:Se,ZodArray:X,ZodObject:M,ZodUnion:le,ZodDiscriminatedUnion:Le,ZodIntersection:ue,ZodTuple:F,ZodRecord:De,ZodMap:Re,ZodSet:Te,ZodFunction:ze,ZodLazy:de,ZodLiteral:me,ZodEnum:pe,ZodNativeEnum:he,ZodPromise:Q,ZodEffects:N,ZodTransformer:N,ZodOptional:O,ZodNullable:U,ZodDefault:fe,ZodCatch:ge,ZodNaN:we,BRAND:pa,ZodBranded:Oe,ZodPipeline:Me,ZodReadonly:_e,custom:zt,Schema:v,ZodSchema:v,late:ha,get ZodFirstPartyTypeKind(){return m},coerce:Wa,any:ka,array:wa,bigint:_a,boolean:Ft,date:ya,discriminatedUnion:Ea,effect:It,enum:La,function:Za,instanceof:fa,intersection:Aa,lazy:$a,literal:qa,map:Ia,nan:ga,nativeEnum:Da,never:Ra,null:xa,nullable:Va,number:Vt,object:Pa,oboolean:Ja,onumber:Ga,optional:Ha,ostring:Ba,pipeline:Ua,preprocess:Fa,promise:za,record:Ma,set:Na,strictObject:ja,string:Ht,symbol:va,transformer:It,tuple:Oa,undefined:ba,union:Ca,unknown:Sa,void:Ta,NEVER:Xa,ZodIssueCode:d,quotelessJson:Vs,ZodError:I});var bt="2024-11-05",Ut=[bt,"2024-10-07"],He="2.0",Bt=n.union([n.string(),n.number().int()]),Gt=n.string(),D=n.object({_meta:n.optional(n.object({progressToken:n.optional(Bt)}).passthrough())}).passthrough(),Z=n.object({method:n.string(),params:n.optional(D)}),Ie=n.object({_meta:n.optional(n.object({}).passthrough())}).passthrough(),B=n.object({method:n.string(),params:n.optional(Ie)}),z=n.object({_meta:n.optional(n.object({}).passthrough())}).passthrough(),Ve=n.union([n.string(),n.number().int()]),Ka=n.object({jsonrpc:n.literal(He),id:Ve}).merge(Z).strict(),Ya=n.object({jsonrpc:n.literal(He)}).merge(B).strict(),Qa=n.object({jsonrpc:n.literal(He),id:Ve,result:z}).strict(),P;(function(r){r[r.ConnectionClosed=-32e3]="ConnectionClosed",r[r.RequestTimeout=-32001]="RequestTimeout",r[r.ParseError=-32700]="ParseError",r[r.InvalidRequest=-32600]="InvalidRequest",r[r.MethodNotFound=-32601]="MethodNotFound",r[r.InvalidParams=-32602]="InvalidParams",r[r.InternalError=-32603]="InternalError"})(P||(P={}));var en=n.object({jsonrpc:n.literal(He),id:Ve,error:n.object({code:n.number().int(),message:n.string(),data:n.optional(n.unknown())})}).strict(),Jt=n.union([Ka,Ya,Qa,en]),Fe=z.strict(),Ue=B.extend({method:n.literal("notifications/cancelled"),params:Ie.extend({requestId:Ve,reason:n.string().optional()})}),Wt=n.object({name:n.string(),version:n.string()}).passthrough(),tn=n.object({experimental:n.optional(n.object({}).passthrough()),sampling:n.optional(n.object({}).passthrough()),roots:n.optional(n.object({listChanged:n.optional(n.boolean())}).passthrough())}).passthrough(),xt=Z.extend({method:n.literal("initialize"),params:D.extend({protocolVersion:n.string(),capabilities:tn,clientInfo:Wt})}),rn=n.object({experimental:n.optional(n.object({}).passthrough()),logging:n.optional(n.object({}).passthrough()),prompts:n.optional(n.object({listChanged:n.optional(n.boolean())}).passthrough()),resources:n.optional(n.object({subscribe:n.optional(n.boolean()),listChanged:n.optional(n.boolean())}).passthrough()),tools:n.optional(n.object({listChanged:n.optional(n.boolean())}).passthrough())}).passthrough(),sn=z.extend({protocolVersion:n.string(),capabilities:rn,serverInfo:Wt,instructions:n.optional(n.string())}),kt=B.extend({method:n.literal("notifications/initialized")}),Be=Z.extend({method:n.literal("ping")}),an=n.object({progress:n.number(),total:n.optional(n.number())}).passthrough(),Ge=B.extend({method:n.literal("notifications/progress"),params:Ie.merge(an).extend({progressToken:Bt})}),Je=Z.extend({params:D.extend({cursor:n.optional(Gt)}).optional()}),We=z.extend({nextCursor:n.optional(Gt)}),Xt=n.object({uri:n.string(),mimeType:n.optional(n.string())}).passthrough(),Kt=Xt.extend({text:n.string()}),Yt=Xt.extend({blob:n.string().base64()}),nn=n.object({uri:n.string(),name:n.string(),description:n.optional(n.string()),mimeType:n.optional(n.string())}).passthrough(),on=n.object({uriTemplate:n.string(),name:n.string(),description:n.optional(n.string()),mimeType:n.optional(n.string())}).passthrough(),Xe=Je.extend({method:n.literal("resources/list")}),cn=We.extend({resources:n.array(nn)}),Ke=Je.extend({method:n.literal("resources/templates/list")}),ln=We.extend({resourceTemplates:n.array(on)}),Ye=Z.extend({method:n.literal("resources/read"),params:D.extend({uri:n.string()})}),un=z.extend({contents:n.array(n.union([Kt,Yt]))}),dn=B.extend({method:n.literal("notifications/resources/list_changed")}),mn=Z.extend({method:n.literal("resources/subscribe"),params:D.extend({uri:n.string()})}),pn=Z.extend({method:n.literal("resources/unsubscribe"),params:D.extend({uri:n.string()})}),hn=B.extend({method:n.literal("notifications/resources/updated"),params:Ie.extend({uri:n.string()})}),fn=n.object({name:n.string(),description:n.optional(n.string()),required:n.optional(n.boolean())}).passthrough(),gn=n.object({name:n.string(),description:n.optional(n.string()),arguments:n.optional(n.array(fn))}).passthrough(),Qe=Je.extend({method:n.literal("prompts/list")}),_n=We.extend({prompts:n.array(gn)}),et=Z.extend({method:n.literal("prompts/get"),params:D.extend({name:n.string(),arguments:n.optional(n.record(n.string()))})}),tt=n.object({type:n.literal("text"),text:n.string()}).passthrough(),rt=n.object({type:n.literal("image"),data:n.string().base64(),mimeType:n.string()}).passthrough(),Qt=n.object({type:n.literal("resource"),resource:n.union([Kt,Yt])}).passthrough(),yn=n.object({role:n.enum(["user","assistant"]),content:n.union([tt,rt,Qt])}).passthrough(),vn=z.extend({description:n.optional(n.string()),messages:n.array(yn)}),bn=B.extend({method:n.literal("notifications/prompts/list_changed")}),xn=n.object({name:n.string(),description:n.optional(n.string()),inputSchema:n.object({type:n.literal("object"),properties:n.optional(n.object({}).passthrough())}).passthrough()}).passthrough(),st=Je.extend({method:n.literal("tools/list")}),kn=We.extend({tools:n.array(xn)}),er=z.extend({content:n.array(n.union([tt,rt,Qt])),isError:n.boolean().default(!1).optional()}),eo=er.or(z.extend({toolResult:n.unknown()})),at=Z.extend({method:n.literal("tools/call"),params:D.extend({name:n.string(),arguments:n.optional(n.record(n.unknown()))})}),Sn=B.extend({method:n.literal("notifications/tools/list_changed")}),tr=n.enum(["debug","info","notice","warning","error","critical","alert","emergency"]),Rn=Z.extend({method:n.literal("logging/setLevel"),params:D.extend({level:tr})}),Tn=B.extend({method:n.literal("notifications/message"),params:Ie.extend({level:tr,logger:n.optional(n.string()),data:n.unknown()})}),wn=n.object({name:n.string().optional()}).passthrough(),Pn=n.object({hints:n.optional(n.array(wn)),costPriority:n.optional(n.number().min(0).max(1)),speedPriority:n.optional(n.number().min(0).max(1)),intelligencePriority:n.optional(n.number().min(0).max(1))}).passthrough(),jn=n.object({role:n.enum(["user","assistant"]),content:n.union([tt,rt])}).passthrough(),Cn=Z.extend({method:n.literal("sampling/createMessage"),params:D.extend({messages:n.array(jn),systemPrompt:n.optional(n.string()),includeContext:n.optional(n.enum(["none","thisServer","allServers"])),temperature:n.optional(n.number()),maxTokens:n.number().int(),stopSequences:n.optional(n.array(n.string())),metadata:n.optional(n.object({}).passthrough()),modelPreferences:n.optional(Pn)})}),St=z.extend({model:n.string(),stopReason:n.optional(n.enum(["endTurn","stopSequence","maxTokens"]).or(n.string())),role:n.enum(["user","assistant"]),content:n.discriminatedUnion("type",[tt,rt])}),En=n.object({type:n.literal("ref/resource"),uri:n.string()}).passthrough(),An=n.object({type:n.literal("ref/prompt"),name:n.string()}).passthrough(),nt=Z.extend({method:n.literal("completion/complete"),params:D.extend({ref:n.union([An,En]),argument:n.object({name:n.string(),value:n.string()}).passthrough()})}),On=z.extend({completion:n.object({values:n.array(n.string()).max(100),total:n.optional(n.number().int()),hasMore:n.optional(n.boolean())}).passthrough()}),Mn=n.object({uri:n.string().startsWith("file://"),name:n.optional(n.string())}).passthrough(),In=Z.extend({method:n.literal("roots/list")}),Rt=z.extend({roots:n.array(Mn)}),Nn=B.extend({method:n.literal("notifications/roots/list_changed")}),to=n.union([Be,xt,nt,Rn,et,Qe,Xe,Ke,Ye,mn,pn,at,st]),ro=n.union([Ue,Ge,kt,Nn]),so=n.union([Fe,St,Rt]),ao=n.union([Be,Cn,In]),no=n.union([Ue,Ge,Tn,hn,dn,Sn,bn]),oo=n.union([Fe,sn,On,vn,_n,cn,ln,un,er,kn]),C=class extends Error{constructor(e,t,s){super(`MCP error ${e}: ${t}`),this.code=e,this.data=s,this.name="McpError"}};var ot=class{append(e){this._buffer=this._buffer?Buffer.concat([this._buffer,e]):e}readMessage(){if(!this._buffer)return null;let e=this._buffer.indexOf(`
`);if(e===-1)return null;let t=this._buffer.toString("utf8",0,e);return this._buffer=this._buffer.subarray(e+1),Zn(t)}clear(){this._buffer=void 0}};function Zn(r){return Jt.parse(JSON.parse(r))}function rr(r){return JSON.stringify(r)+`
`}var it=class{constructor(e=sr.stdin,t=sr.stdout){this._stdin=e,this._stdout=t,this._readBuffer=new ot,this._started=!1,this._ondata=s=>{this._readBuffer.append(s),this.processReadBuffer()},this._onerror=s=>{var a;(a=this.onerror)===null||a===void 0||a.call(this,s)}}async start(){if(this._started)throw new Error("StdioServerTransport already started! If using Server class, note that connect() calls start() automatically.");this._started=!0,this._stdin.on("data",this._ondata),this._stdin.on("error",this._onerror)}processReadBuffer(){for(var e,t;;)try{let s=this._readBuffer.readMessage();if(s===null)break;(e=this.onmessage)===null||e===void 0||e.call(this,s)}catch(s){(t=this.onerror)===null||t===void 0||t.call(this,s)}}async close(){var e;this._stdin.off("data",this._ondata),this._stdin.off("error",this._onerror),this._stdin.listenerCount("data")===0&&this._stdin.pause(),this._readBuffer.clear(),(e=this.onclose)===null||e===void 0||e.call(this)}send(e){return new Promise(t=>{let s=rr(e);this._stdout.write(s)?t():this._stdout.once("drain",t)})}};var $n=6e4,ct=class{constructor(e){this._options=e,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(Ue,t=>{let s=this._requestHandlerAbortControllers.get(t.params.requestId);s?.abort(t.params.reason)}),this.setNotificationHandler(Ge,t=>{this._onprogress(t)}),this.setRequestHandler(Be,t=>({}))}_setupTimeout(e,t,s,a){this._timeoutInfo.set(e,{timeoutId:setTimeout(a,t),startTime:Date.now(),timeout:t,maxTotalTimeout:s,onTimeout:a})}_resetTimeout(e){let t=this._timeoutInfo.get(e);if(!t)return!1;let s=Date.now()-t.startTime;if(t.maxTotalTimeout&&s>=t.maxTotalTimeout)throw this._timeoutInfo.delete(e),new C(P.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:t.maxTotalTimeout,totalElapsed:s});return clearTimeout(t.timeoutId),t.timeoutId=setTimeout(t.onTimeout,t.timeout),!0}_cleanupTimeout(e){let t=this._timeoutInfo.get(e);t&&(clearTimeout(t.timeoutId),this._timeoutInfo.delete(e))}async connect(e){this._transport=e,this._transport.onclose=()=>{this._onclose()},this._transport.onerror=t=>{this._onerror(t)},this._transport.onmessage=t=>{"method"in t?"id"in t?this._onrequest(t):this._onnotification(t):this._onresponse(t)},await this._transport.start()}_onclose(){var e;let t=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._transport=void 0,(e=this.onclose)===null||e===void 0||e.call(this);let s=new C(P.ConnectionClosed,"Connection closed");for(let a of t.values())a(s)}_onerror(e){var t;(t=this.onerror)===null||t===void 0||t.call(this,e)}_onnotification(e){var t;let s=(t=this._notificationHandlers.get(e.method))!==null&&t!==void 0?t:this.fallbackNotificationHandler;s!==void 0&&Promise.resolve().then(()=>s(e)).catch(a=>this._onerror(new Error(`Uncaught error in notification handler: ${a}`)))}_onrequest(e){var t,s,a;let o=(t=this._requestHandlers.get(e.method))!==null&&t!==void 0?t:this.fallbackRequestHandler;if(o===void 0){(s=this._transport)===null||s===void 0||s.send({jsonrpc:"2.0",id:e.id,error:{code:P.MethodNotFound,message:"Method not found"}}).catch(l=>this._onerror(new Error(`Failed to send an error response: ${l}`)));return}let i=new AbortController;this._requestHandlerAbortControllers.set(e.id,i);let c={signal:i.signal,sessionId:(a=this._transport)===null||a===void 0?void 0:a.sessionId};Promise.resolve().then(()=>o(e,c)).then(l=>{var u;if(!i.signal.aborted)return(u=this._transport)===null||u===void 0?void 0:u.send({result:l,jsonrpc:"2.0",id:e.id})},l=>{var u,p;if(!i.signal.aborted)return(u=this._transport)===null||u===void 0?void 0:u.send({jsonrpc:"2.0",id:e.id,error:{code:Number.isSafeInteger(l.code)?l.code:P.InternalError,message:(p=l.message)!==null&&p!==void 0?p:"Internal error"}})}).catch(l=>this._onerror(new Error(`Failed to send response: ${l}`))).finally(()=>{this._requestHandlerAbortControllers.delete(e.id)})}_onprogress(e){let{progressToken:t,...s}=e.params,a=Number(t),o=this._progressHandlers.get(a);if(!o){this._onerror(new Error(`Received a progress notification for an unknown token: ${JSON.stringify(e)}`));return}let i=this._responseHandlers.get(a);if(this._timeoutInfo.has(a)&&i)try{this._resetTimeout(a)}catch(c){i(c);return}o(s)}_onresponse(e){let t=Number(e.id),s=this._responseHandlers.get(t);if(s===void 0){this._onerror(new Error(`Received a response for an unknown message ID: ${JSON.stringify(e)}`));return}if(this._responseHandlers.delete(t),this._progressHandlers.delete(t),this._cleanupTimeout(t),"result"in e)s(e);else{let a=new C(e.error.code,e.error.message,e.error.data);s(a)}}get transport(){return this._transport}async close(){var e;await((e=this._transport)===null||e===void 0?void 0:e.close())}request(e,t,s){return new Promise((a,o)=>{var i,c,l,u;if(!this._transport){o(new Error("Not connected"));return}((i=this._options)===null||i===void 0?void 0:i.enforceStrictCapabilities)===!0&&this.assertCapabilityForMethod(e.method),(c=s?.signal)===null||c===void 0||c.throwIfAborted();let p=this._requestMessageId++,w={...e,jsonrpc:"2.0",id:p};s?.onprogress&&(this._progressHandlers.set(p,s.onprogress),w.params={...e.params,_meta:{progressToken:p}});let ee=$=>{var te;this._responseHandlers.delete(p),this._progressHandlers.delete(p),this._cleanupTimeout(p),(te=this._transport)===null||te===void 0||te.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:p,reason:String($)}}).catch(je=>this._onerror(new Error(`Failed to send cancellation: ${je}`))),o($)};this._responseHandlers.set(p,$=>{var te;if(!(!((te=s?.signal)===null||te===void 0)&&te.aborted)){if($ instanceof Error)return o($);try{let je=t.parse($.result);a(je)}catch(je){o(je)}}}),(l=s?.signal)===null||l===void 0||l.addEventListener("abort",()=>{var $;ee(($=s?.signal)===null||$===void 0?void 0:$.reason)});let ye=(u=s?.timeout)!==null&&u!==void 0?u:$n,Hs=()=>ee(new C(P.RequestTimeout,"Request timed out",{timeout:ye}));this._setupTimeout(p,ye,s?.maxTotalTimeout,Hs),this._transport.send(w).catch($=>{this._cleanupTimeout(p),o($)})})}async notification(e){if(!this._transport)throw new Error("Not connected");this.assertNotificationCapability(e.method);let t={...e,jsonrpc:"2.0"};await this._transport.send(t)}setRequestHandler(e,t){let s=e.shape.method.value;this.assertRequestHandlerCapability(s),this._requestHandlers.set(s,(a,o)=>Promise.resolve(t(e.parse(a),o)))}removeRequestHandler(e){this._requestHandlers.delete(e)}assertCanSetRequestHandler(e){if(this._requestHandlers.has(e))throw new Error(`A request handler for ${e} already exists, which would be overridden`)}setNotificationHandler(e,t){this._notificationHandlers.set(e.shape.method.value,s=>Promise.resolve(t(e.parse(s))))}removeNotificationHandler(e){this._notificationHandlers.delete(e)}};function ar(r,e){return Object.entries(e).reduce((t,[s,a])=>(a&&typeof a=="object"?t[s]=t[s]?{...t[s],...a}:a:t[s]=a,t),{...r})}var lt=class extends ct{constructor(e,t){var s;super(t),this._serverInfo=e,this._capabilities=(s=t?.capabilities)!==null&&s!==void 0?s:{},this._instructions=t?.instructions,this.setRequestHandler(xt,a=>this._oninitialize(a)),this.setNotificationHandler(kt,()=>{var a;return(a=this.oninitialized)===null||a===void 0?void 0:a.call(this)})}registerCapabilities(e){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=ar(this._capabilities,e)}assertCapabilityForMethod(e){var t,s;switch(e){case"sampling/createMessage":if(!(!((t=this._clientCapabilities)===null||t===void 0)&&t.sampling))throw new Error(`Client does not support sampling (required for ${e})`);break;case"roots/list":if(!(!((s=this._clientCapabilities)===null||s===void 0)&&s.roots))throw new Error(`Client does not support listing roots (required for ${e})`);break;case"ping":break}}assertNotificationCapability(e){switch(e){case"notifications/message":if(!this._capabilities.logging)throw new Error(`Server does not support logging (required for ${e})`);break;case"notifications/resources/updated":case"notifications/resources/list_changed":if(!this._capabilities.resources)throw new Error(`Server does not support notifying about resources (required for ${e})`);break;case"notifications/tools/list_changed":if(!this._capabilities.tools)throw new Error(`Server does not support notifying of tool list changes (required for ${e})`);break;case"notifications/prompts/list_changed":if(!this._capabilities.prompts)throw new Error(`Server does not support notifying of prompt list changes (required for ${e})`);break;case"notifications/cancelled":break;case"notifications/progress":break}}assertRequestHandlerCapability(e){switch(e){case"sampling/createMessage":if(!this._capabilities.sampling)throw new Error(`Server does not support sampling (required for ${e})`);break;case"logging/setLevel":if(!this._capabilities.logging)throw new Error(`Server does not support logging (required for ${e})`);break;case"prompts/get":case"prompts/list":if(!this._capabilities.prompts)throw new Error(`Server does not support prompts (required for ${e})`);break;case"resources/list":case"resources/templates/list":case"resources/read":if(!this._capabilities.resources)throw new Error(`Server does not support resources (required for ${e})`);break;case"tools/call":case"tools/list":if(!this._capabilities.tools)throw new Error(`Server does not support tools (required for ${e})`);break;case"ping":case"initialize":break}}async _oninitialize(e){let t=e.params.protocolVersion;return this._clientCapabilities=e.params.capabilities,this._clientVersion=e.params.clientInfo,{protocolVersion:Ut.includes(t)?t:bt,capabilities:this.getCapabilities(),serverInfo:this._serverInfo,...this._instructions&&{instructions:this._instructions}}}getClientCapabilities(){return this._clientCapabilities}getClientVersion(){return this._clientVersion}getCapabilities(){return this._capabilities}async ping(){return this.request({method:"ping"},Fe)}async createMessage(e,t){return this.request({method:"sampling/createMessage",params:e},St,t)}async listRoots(e,t){return this.request({method:"roots/list",params:e},Rt,t)}async sendLoggingMessage(e){return this.notification({method:"notifications/message",params:e})}async sendResourceUpdated(e){return this.notification({method:"notifications/resources/updated",params:e})}async sendResourceListChanged(){return this.notification({method:"notifications/resources/list_changed"})}async sendToolListChanged(){return this.notification({method:"notifications/tools/list_changed"})}async sendPromptListChanged(){return this.notification({method:"notifications/prompts/list_changed"})}};var or=Symbol("Let zodToJsonSchema decide on which parser to use");var nr={name:void 0,$refStrategy:"root",basePath:["#"],effectStrategy:"input",pipeStrategy:"all",dateStrategy:"format:date-time",mapStrategy:"entries",removeAdditionalStrategy:"passthrough",allowedAdditionalProperties:!0,rejectedAdditionalProperties:!1,definitionPath:"definitions",target:"jsonSchema7",strictUnions:!1,definitions:{},errorMessages:!1,markdownDescription:!1,patternStrategy:"escape",applyRegexFlags:!1,emailStrategy:"format:email",base64Strategy:"contentEncoding:base64",nameStrategy:"ref"},ir=r=>typeof r=="string"?{...nr,name:r}:{...nr,...r};var cr=r=>{let e=ir(r),t=e.name!==void 0?[...e.basePath,e.definitionPath,e.name]:e.basePath;return{...e,currentPath:t,propertyPath:void 0,seen:new Map(Object.entries(e.definitions).map(([s,a])=>[a._def,{def:a._def,path:[...e.basePath,e.definitionPath,s],jsonSchema:void 0}]))}};function Tt(r,e,t,s){s?.errorMessages&&t&&(r.errorMessage={...r.errorMessage,[e]:t})}function x(r,e,t,s,a){r[e]=t,Tt(r,e,s,a)}function lr(){return{}}function ur(r,e){let t={type:"array"};return r.type?._def&&r.type?._def?.typeName!==m.ZodAny&&(t.items=_(r.type._def,{...e,currentPath:[...e.currentPath,"items"]})),r.minLength&&x(t,"minItems",r.minLength.value,r.minLength.message,e),r.maxLength&&x(t,"maxItems",r.maxLength.value,r.maxLength.message,e),r.exactLength&&(x(t,"minItems",r.exactLength.value,r.exactLength.message,e),x(t,"maxItems",r.exactLength.value,r.exactLength.message,e)),t}function dr(r,e){let t={type:"integer",format:"int64"};if(!r.checks)return t;for(let s of r.checks)switch(s.kind){case"min":e.target==="jsonSchema7"?s.inclusive?x(t,"minimum",s.value,s.message,e):x(t,"exclusiveMinimum",s.value,s.message,e):(s.inclusive||(t.exclusiveMinimum=!0),x(t,"minimum",s.value,s.message,e));break;case"max":e.target==="jsonSchema7"?s.inclusive?x(t,"maximum",s.value,s.message,e):x(t,"exclusiveMaximum",s.value,s.message,e):(s.inclusive||(t.exclusiveMaximum=!0),x(t,"maximum",s.value,s.message,e));break;case"multipleOf":x(t,"multipleOf",s.value,s.message,e);break}return t}function mr(){return{type:"boolean"}}function ut(r,e){return _(r.type._def,e)}var pr=(r,e)=>_(r.innerType._def,e);function wt(r,e,t){let s=t??e.dateStrategy;if(Array.isArray(s))return{anyOf:s.map((a,o)=>wt(r,e,a))};switch(s){case"string":case"format:date-time":return{type:"string",format:"date-time"};case"format:date":return{type:"string",format:"date"};case"integer":return qn(r,e)}}var qn=(r,e)=>{let t={type:"integer",format:"unix-time"};if(e.target==="openApi3")return t;for(let s of r.checks)switch(s.kind){case"min":x(t,"minimum",s.value,s.message,e);break;case"max":x(t,"maximum",s.value,s.message,e);break}return t};function hr(r,e){return{..._(r.innerType._def,e),default:r.defaultValue()}}function fr(r,e){return e.effectStrategy==="input"?_(r.schema._def,e):{}}function gr(r){return{type:"string",enum:Array.from(r.values)}}var Ln=r=>"type"in r&&r.type==="string"?!1:"allOf"in r;function _r(r,e){let t=[_(r.left._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),_(r.right._def,{...e,currentPath:[...e.currentPath,"allOf","1"]})].filter(o=>!!o),s=e.target==="jsonSchema2019-09"?{unevaluatedProperties:!1}:void 0,a=[];return t.forEach(o=>{if(Ln(o))a.push(...o.allOf),o.unevaluatedProperties===void 0&&(s=void 0);else{let i=o;if("additionalProperties"in o&&o.additionalProperties===!1){let{additionalProperties:c,...l}=o;i=l}else s=void 0;a.push(i)}}),a.length?{allOf:a,...s}:void 0}function yr(r,e){let t=typeof r.value;return t!=="bigint"&&t!=="number"&&t!=="boolean"&&t!=="string"?{type:Array.isArray(r.value)?"array":"object"}:e.target==="openApi3"?{type:t==="bigint"?"integer":t,enum:[r.value]}:{type:t==="bigint"?"integer":t,const:r.value}}var Pt,H={cuid:/^[cC][^\s-]{8,}$/,cuid2:/^[0-9a-z]+$/,ulid:/^[0-9A-HJKMNP-TV-Z]{26}$/,email:/^(?!\.)(?!.*\.\.)([a-zA-Z0-9_'+\-\.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9\-]*\.)+[a-zA-Z]{2,}$/,emoji:()=>(Pt===void 0&&(Pt=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),Pt),uuid:/^[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}$/,ipv4:/^(?:(?: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])$/,ipv4Cidr:/^(?:(?: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])$/,ipv6:/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,ipv6Cidr:/^(([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])$/,base64:/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,base64url:/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,nanoid:/^[a-zA-Z0-9_-]{21}$/,jwt:/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/};function dt(r,e){let t={type:"string"};if(r.checks)for(let s of r.checks)switch(s.kind){case"min":x(t,"minLength",typeof t.minLength=="number"?Math.max(t.minLength,s.value):s.value,s.message,e);break;case"max":x(t,"maxLength",typeof t.maxLength=="number"?Math.min(t.maxLength,s.value):s.value,s.message,e);break;case"email":switch(e.emailStrategy){case"format:email":V(t,"email",s.message,e);break;case"format:idn-email":V(t,"idn-email",s.message,e);break;case"pattern:zod":A(t,H.email,s.message,e);break}break;case"url":V(t,"uri",s.message,e);break;case"uuid":V(t,"uuid",s.message,e);break;case"regex":A(t,s.regex,s.message,e);break;case"cuid":A(t,H.cuid,s.message,e);break;case"cuid2":A(t,H.cuid2,s.message,e);break;case"startsWith":A(t,RegExp(`^${jt(s.value,e)}`),s.message,e);break;case"endsWith":A(t,RegExp(`${jt(s.value,e)}$`),s.message,e);break;case"datetime":V(t,"date-time",s.message,e);break;case"date":V(t,"date",s.message,e);break;case"time":V(t,"time",s.message,e);break;case"duration":V(t,"duration",s.message,e);break;case"length":x(t,"minLength",typeof t.minLength=="number"?Math.max(t.minLength,s.value):s.value,s.message,e),x(t,"maxLength",typeof t.maxLength=="number"?Math.min(t.maxLength,s.value):s.value,s.message,e);break;case"includes":{A(t,RegExp(jt(s.value,e)),s.message,e);break}case"ip":{s.version!=="v6"&&V(t,"ipv4",s.message,e),s.version!=="v4"&&V(t,"ipv6",s.message,e);break}case"base64url":A(t,H.base64url,s.message,e);break;case"jwt":A(t,H.jwt,s.message,e);break;case"cidr":{s.version!=="v6"&&A(t,H.ipv4Cidr,s.message,e),s.version!=="v4"&&A(t,H.ipv6Cidr,s.message,e);break}case"emoji":A(t,H.emoji(),s.message,e);break;case"ulid":{A(t,H.ulid,s.message,e);break}case"base64":{switch(e.base64Strategy){case"format:binary":{V(t,"binary",s.message,e);break}case"contentEncoding:base64":{x(t,"contentEncoding","base64",s.message,e);break}case"pattern:zod":{A(t,H.base64,s.message,e);break}}break}case"nanoid":A(t,H.nanoid,s.message,e);case"toLowerCase":case"toUpperCase":case"trim":break;default:}return t}function jt(r,e){return e.patternStrategy==="escape"?zn(r):r}var Dn=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function zn(r){let e="";for(let t=0;t<r.length;t++)Dn.has(r[t])||(e+="\\"),e+=r[t];return e}function V(r,e,t,s){r.format||r.anyOf?.some(a=>a.format)?(r.anyOf||(r.anyOf=[]),r.format&&(r.anyOf.push({format:r.format,...r.errorMessage&&s.errorMessages&&{errorMessage:{format:r.errorMessage.format}}}),delete r.format,r.errorMessage&&(delete r.errorMessage.format,Object.keys(r.errorMessage).length===0&&delete r.errorMessage)),r.anyOf.push({format:e,...t&&s.errorMessages&&{errorMessage:{format:t}}})):x(r,"format",e,t,s)}function A(r,e,t,s){r.pattern||r.allOf?.some(a=>a.pattern)?(r.allOf||(r.allOf=[]),r.pattern&&(r.allOf.push({pattern:r.pattern,...r.errorMessage&&s.errorMessages&&{errorMessage:{pattern:r.errorMessage.pattern}}}),delete r.pattern,r.errorMessage&&(delete r.errorMessage.pattern,Object.keys(r.errorMessage).length===0&&delete r.errorMessage)),r.allOf.push({pattern:vr(e,s),...t&&s.errorMessages&&{errorMessage:{pattern:t}}})):x(r,"pattern",vr(e,s),t,s)}function vr(r,e){if(!e.applyRegexFlags||!r.flags)return r.source;let t={i:r.flags.includes("i"),m:r.flags.includes("m"),s:r.flags.includes("s")},s=t.i?r.source.toLowerCase():r.source,a="",o=!1,i=!1,c=!1;for(let l=0;l<s.length;l++){if(o){a+=s[l],o=!1;continue}if(t.i){if(i){if(s[l].match(/[a-z]/)){c?(a+=s[l],a+=`${s[l-2]}-${s[l]}`.toUpperCase(),c=!1):s[l+1]==="-"&&s[l+2]?.match(/[a-z]/)?(a+=s[l],c=!0):a+=`${s[l]}${s[l].toUpperCase()}`;continue}}else if(s[l].match(/[a-z]/)){a+=`[${s[l]}${s[l].toUpperCase()}]`;continue}}if(t.m){if(s[l]==="^"){a+=`(^|(?<=[\r
]))`;continue}else if(s[l]==="$"){a+=`($|(?=[\r
]))`;continue}}if(t.s&&s[l]==="."){a+=i?`${s[l]}\r
`:`[${s[l]}\r
]`;continue}a+=s[l],s[l]==="\\"?o=!0:i&&s[l]==="]"?i=!1:!i&&s[l]==="["&&(i=!0)}try{new RegExp(a)}catch{return console.warn(`Could not convert regex pattern at ${e.currentPath.join("/")} to a flag-independent form! Falling back to the flag-ignorant source`),r.source}return a}function mt(r,e){if(e.target==="openAi"&&console.warn("Warning: OpenAI may not support records in schemas! Try an array of key-value pairs instead."),e.target==="openApi3"&&r.keyType?._def.typeName===m.ZodEnum)return{type:"object",required:r.keyType._def.values,properties:r.keyType._def.values.reduce((s,a)=>({...s,[a]:_(r.valueType._def,{...e,currentPath:[...e.currentPath,"properties",a]})??{}}),{}),additionalProperties:e.rejectedAdditionalProperties};let t={type:"object",additionalProperties:_(r.valueType._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]})??e.allowedAdditionalProperties};if(e.target==="openApi3")return t;if(r.keyType?._def.typeName===m.ZodString&&r.keyType._def.checks?.length){let{type:s,...a}=dt(r.keyType._def,e);return{...t,propertyNames:a}}else{if(r.keyType?._def.typeName===m.ZodEnum)return{...t,propertyNames:{enum:r.keyType._def.values}};if(r.keyType?._def.typeName===m.ZodBranded&&r.keyType._def.type._def.typeName===m.ZodString&&r.keyType._def.type._def.checks?.length){let{type:s,...a}=ut(r.keyType._def,e);return{...t,propertyNames:a}}}return t}function br(r,e){if(e.mapStrategy==="record")return mt(r,e);let t=_(r.keyType._def,{...e,currentPath:[...e.currentPath,"items","items","0"]})||{},s=_(r.valueType._def,{...e,currentPath:[...e.currentPath,"items","items","1"]})||{};return{type:"array",maxItems:125,items:{type:"array",items:[t,s],minItems:2,maxItems:2}}}function xr(r){let e=r.values,s=Object.keys(r.values).filter(o=>typeof e[e[o]]!="number").map(o=>e[o]),a=Array.from(new Set(s.map(o=>typeof o)));return{type:a.length===1?a[0]==="string"?"string":"number":["string","number"],enum:s}}function kr(){return{not:{}}}function Sr(r){return r.target==="openApi3"?{enum:["null"],nullable:!0}:{type:"null"}}var Ne={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};function Tr(r,e){if(e.target==="openApi3")return Rr(r,e);let t=r.options instanceof Map?Array.from(r.options.values()):r.options;if(t.every(s=>s._def.typeName in Ne&&(!s._def.checks||!s._def.checks.length))){let s=t.reduce((a,o)=>{let i=Ne[o._def.typeName];return i&&!a.includes(i)?[...a,i]:a},[]);return{type:s.length>1?s:s[0]}}else if(t.every(s=>s._def.typeName==="ZodLiteral"&&!s.description)){let s=t.reduce((a,o)=>{let i=typeof o._def.value;switch(i){case"string":case"number":case"boolean":return[...a,i];case"bigint":return[...a,"integer"];case"object":if(o._def.value===null)return[...a,"null"];case"symbol":case"undefined":case"function":default:return a}},[]);if(s.length===t.length){let a=s.filter((o,i,c)=>c.indexOf(o)===i);return{type:a.length>1?a:a[0],enum:t.reduce((o,i)=>o.includes(i._def.value)?o:[...o,i._def.value],[])}}}else if(t.every(s=>s._def.typeName==="ZodEnum"))return{type:"string",enum:t.reduce((s,a)=>[...s,...a._def.values.filter(o=>!s.includes(o))],[])};return Rr(r,e)}var Rr=(r,e)=>{let t=(r.options instanceof Map?Array.from(r.options.values()):r.options).map((s,a)=>_(s._def,{...e,currentPath:[...e.currentPath,"anyOf",`${a}`]})).filter(s=>!!s&&(!e.strictUnions||typeof s=="object"&&Object.keys(s).length>0));return t.length?{anyOf:t}:void 0};function wr(r,e){if(["ZodString","ZodNumber","ZodBigInt","ZodBoolean","ZodNull"].includes(r.innerType._def.typeName)&&(!r.innerType._def.checks||!r.innerType._def.checks.length))return e.target==="openApi3"?{type:Ne[r.innerType._def.typeName],nullable:!0}:{type:[Ne[r.innerType._def.typeName],"null"]};if(e.target==="openApi3"){let s=_(r.innerType._def,{...e,currentPath:[...e.currentPath]});return s&&"$ref"in s?{allOf:[s],nullable:!0}:s&&{...s,nullable:!0}}let t=_(r.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","0"]});return t&&{anyOf:[t,{type:"null"}]}}function Pr(r,e){let t={type:"number"};if(!r.checks)return t;for(let s of r.checks)switch(s.kind){case"int":t.type="integer",Tt(t,"type",s.message,e);break;case"min":e.target==="jsonSchema7"?s.inclusive?x(t,"minimum",s.value,s.message,e):x(t,"exclusiveMinimum",s.value,s.message,e):(s.inclusive||(t.exclusiveMinimum=!0),x(t,"minimum",s.value,s.message,e));break;case"max":e.target==="jsonSchema7"?s.inclusive?x(t,"maximum",s.value,s.message,e):x(t,"exclusiveMaximum",s.value,s.message,e):(s.inclusive||(t.exclusiveMaximum=!0),x(t,"maximum",s.value,s.message,e));break;case"multipleOf":x(t,"multipleOf",s.value,s.message,e);break}return t}function jr(r,e){let t=e.target==="openAi",s={type:"object",properties:{}},a=[],o=r.shape();for(let c in o){let l=o[c];if(l===void 0||l._def===void 0)continue;let u=Vn(l);u&&t&&(l instanceof O&&(l=l._def.innerType),l.isNullable()||(l=l.nullable()),u=!1);let p=_(l._def,{...e,currentPath:[...e.currentPath,"properties",c],propertyPath:[...e.currentPath,"properties",c]});p!==void 0&&(s.properties[c]=p,u||a.push(c))}a.length&&(s.required=a);let i=Hn(r,e);return i!==void 0&&(s.additionalProperties=i),s}function Hn(r,e){if(r.catchall._def.typeName!=="ZodNever")return _(r.catchall._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]});switch(r.unknownKeys){case"passthrough":return e.allowedAdditionalProperties;case"strict":return e.rejectedAdditionalProperties;case"strip":return e.removeAdditionalStrategy==="strict"?e.allowedAdditionalProperties:e.rejectedAdditionalProperties}}function Vn(r){try{return r.isOptional()}catch{return!0}}var Cr=(r,e)=>{if(e.currentPath.toString()===e.propertyPath?.toString())return _(r.innerType._def,e);let t=_(r.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","1"]});return t?{anyOf:[{not:{}},t]}:{}};var Er=(r,e)=>{if(e.pipeStrategy==="input")return _(r.in._def,e);if(e.pipeStrategy==="output")return _(r.out._def,e);let t=_(r.in._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),s=_(r.out._def,{...e,currentPath:[...e.currentPath,"allOf",t?"1":"0"]});return{allOf:[t,s].filter(a=>a!==void 0)}};function Ar(r,e){return _(r.type._def,e)}function Or(r,e){let s={type:"array",uniqueItems:!0,items:_(r.valueType._def,{...e,currentPath:[...e.currentPath,"items"]})};return r.minSize&&x(s,"minItems",r.minSize.value,r.minSize.message,e),r.maxSize&&x(s,"maxItems",r.maxSize.value,r.maxSize.message,e),s}function Mr(r,e){return r.rest?{type:"array",minItems:r.items.length,items:r.items.map((t,s)=>_(t._def,{...e,currentPath:[...e.currentPath,"items",`${s}`]})).reduce((t,s)=>s===void 0?t:[...t,s],[]),additionalItems:_(r.rest._def,{...e,currentPath:[...e.currentPath,"additionalItems"]})}:{type:"array",minItems:r.items.length,maxItems:r.items.length,items:r.items.map((t,s)=>_(t._def,{...e,currentPath:[...e.currentPath,"items",`${s}`]})).reduce((t,s)=>s===void 0?t:[...t,s],[])}}function Ir(){return{not:{}}}function Nr(){return{}}var Zr=(r,e)=>_(r.innerType._def,e);var $r=(r,e,t)=>{switch(e){case m.ZodString:return dt(r,t);case m.ZodNumber:return Pr(r,t);case m.ZodObject:return jr(r,t);case m.ZodBigInt:return dr(r,t);case m.ZodBoolean:return mr();case m.ZodDate:return wt(r,t);case m.ZodUndefined:return Ir();case m.ZodNull:return Sr(t);case m.ZodArray:return ur(r,t);case m.ZodUnion:case m.ZodDiscriminatedUnion:return Tr(r,t);case m.ZodIntersection:return _r(r,t);case m.ZodTuple:return Mr(r,t);case m.ZodRecord:return mt(r,t);case m.ZodLiteral:return yr(r,t);case m.ZodEnum:return gr(r);case m.ZodNativeEnum:return xr(r);case m.ZodNullable:return wr(r,t);case m.ZodOptional:return Cr(r,t);case m.ZodMap:return br(r,t);case m.ZodSet:return Or(r,t);case m.ZodLazy:return()=>r.getter()._def;case m.ZodPromise:return Ar(r,t);case m.ZodNaN:case m.ZodNever:return kr();case m.ZodEffects:return fr(r,t);case m.ZodAny:return lr();case m.ZodUnknown:return Nr();case m.ZodDefault:return hr(r,t);case m.ZodBranded:return ut(r,t);case m.ZodReadonly:return Zr(r,t);case m.ZodCatch:return pr(r,t);case m.ZodPipeline:return Er(r,t);case m.ZodFunction:case m.ZodVoid:case m.ZodSymbol:return;default:return(s=>{})(e)}};function _(r,e,t=!1){let s=e.seen.get(r);if(e.override){let c=e.override?.(r,e,s,t);if(c!==or)return c}if(s&&!t){let c=Fn(s,e);if(c!==void 0)return c}let a={def:r,path:e.currentPath,jsonSchema:void 0};e.seen.set(r,a);let o=$r(r,r.typeName,e),i=typeof o=="function"?_(o(),e):o;if(i&&Bn(r,e,i),e.postProcess){let c=e.postProcess(i,r,e);return a.jsonSchema=i,c}return a.jsonSchema=i,i}var Fn=(r,e)=>{switch(e.$refStrategy){case"root":return{$ref:r.path.join("/")};case"relative":return{$ref:Un(e.currentPath,r.path)};case"none":case"seen":return r.path.length<e.currentPath.length&&r.path.every((t,s)=>e.currentPath[s]===t)?(console.warn(`Recursive reference detected at ${e.currentPath.join("/")}! Defaulting to any`),{}):e.$refStrategy==="seen"?{}:void 0}},Un=(r,e)=>{let t=0;for(;t<r.length&&t<e.length&&r[t]===e[t];t++);return[(r.length-t).toString(),...e.slice(t)].join("/")},Bn=(r,e,t)=>(r.description&&(t.description=r.description,e.markdownDescription&&(t.markdownDescription=r.description)),t);var Ct=(r,e)=>{let t=cr(e),s=typeof e=="object"&&e.definitions?Object.entries(e.definitions).reduce((l,[u,p])=>({...l,[u]:_(p._def,{...t,currentPath:[...t.basePath,t.definitionPath,u]},!0)??{}}),{}):void 0,a=typeof e=="string"?e:e?.nameStrategy==="title"?void 0:e?.name,o=_(r._def,a===void 0?t:{...t,currentPath:[...t.basePath,t.definitionPath,a]},!1)??{},i=typeof e=="object"&&e.name!==void 0&&e.nameStrategy==="title"?e.name:void 0;i!==void 0&&(o.title=i);let c=a===void 0?s?{...o,[t.definitionPath]:s}:o:{$ref:[...t.$refStrategy==="relative"?[]:t.basePath,t.definitionPath,a].join("/"),[t.definitionPath]:{...s,[a]:o}};return t.target==="jsonSchema7"?c.$schema="http://json-schema.org/draft-07/schema#":(t.target==="jsonSchema2019-09"||t.target==="openAi")&&(c.$schema="https://json-schema.org/draft/2019-09/schema#"),t.target==="openAi"&&("anyOf"in c||"oneOf"in c||"allOf"in c||"type"in c&&Array.isArray(c.type))&&console.warn("Warning: OpenAI may not support schemas with unions as roots! Try wrapping it in an object property."),c};var Et;(function(r){r.Completable="McpCompletable"})(Et||(Et={}));var Pe=class extends v{_parse(e){let{ctx:t}=this._processInputParams(e),s=t.data;return this._def.type._parse({data:s,path:t.path,parent:t})}unwrap(){return this._def.type}};Pe.create=(r,e)=>new Pe({type:r,typeName:Et.Completable,complete:e.complete,...Gn(e)});function Gn(r){if(!r)return{};let{errorMap:e,invalid_type_error:t,required_error:s,description:a}=r;if(e&&(t||s))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:a}:{errorMap:(i,c)=>{var l,u;let{message:p}=r;return i.code==="invalid_enum_value"?{message:p??c.defaultError}:typeof c.data>"u"?{message:(l=p??s)!==null&&l!==void 0?l:c.defaultError}:i.code!=="invalid_type"?{message:c.defaultError}:{message:(u=p??t)!==null&&u!==void 0?u:c.defaultError}},description:a}}var ht=class{constructor(e,t){this._registeredResources={},this._registeredResourceTemplates={},this._registeredTools={},this._registeredPrompts={},this._toolHandlersInitialized=!1,this._completionHandlerInitialized=!1,this._resourceHandlersInitialized=!1,this._promptHandlersInitialized=!1,this.server=new lt(e,t)}async connect(e){return await this.server.connect(e)}async close(){await this.server.close()}setToolRequestHandlers(){this._toolHandlersInitialized||(this.server.assertCanSetRequestHandler(st.shape.method.value),this.server.assertCanSetRequestHandler(at.shape.method.value),this.server.registerCapabilities({tools:{}}),this.server.setRequestHandler(st,()=>({tools:Object.entries(this._registeredTools).map(([e,t])=>({name:e,description:t.description,inputSchema:t.inputSchema?Ct(t.inputSchema,{strictUnions:!0}):Jn}))})),this.server.setRequestHandler(at,async(e,t)=>{let s=this._registeredTools[e.params.name];if(!s)throw new C(P.InvalidParams,`Tool ${e.params.name} not found`);if(s.inputSchema){let a=await s.inputSchema.safeParseAsync(e.params.arguments);if(!a.success)throw new C(P.InvalidParams,`Invalid arguments for tool ${e.params.name}: ${a.error.message}`);let o=a.data,i=s.callback;try{return await Promise.resolve(i(o,t))}catch(c){return{content:[{type:"text",text:c instanceof Error?c.message:String(c)}],isError:!0}}}else{let a=s.callback;try{return await Promise.resolve(a(t))}catch(o){return{content:[{type:"text",text:o instanceof Error?o.message:String(o)}],isError:!0}}}}),this._toolHandlersInitialized=!0)}setCompletionRequestHandler(){this._completionHandlerInitialized||(this.server.assertCanSetRequestHandler(nt.shape.method.value),this.server.setRequestHandler(nt,async e=>{switch(e.params.ref.type){case"ref/prompt":return this.handlePromptCompletion(e,e.params.ref);case"ref/resource":return this.handleResourceCompletion(e,e.params.ref);default:throw new C(P.InvalidParams,`Invalid completion reference: ${e.params.ref}`)}}),this._completionHandlerInitialized=!0)}async handlePromptCompletion(e,t){let s=this._registeredPrompts[t.name];if(!s)throw new C(P.InvalidParams,`Prompt ${e.params.ref.name} not found`);if(!s.argsSchema)return pt;let a=s.argsSchema.shape[e.params.argument.name];if(!(a instanceof Pe))return pt;let i=await a._def.complete(e.params.argument.value);return qr(i)}async handleResourceCompletion(e,t){let s=Object.values(this._registeredResourceTemplates).find(i=>i.resourceTemplate.uriTemplate.toString()===t.uri);if(!s){if(this._registeredResources[t.uri])return pt;throw new C(P.InvalidParams,`Resource template ${e.params.ref.uri} not found`)}let a=s.resourceTemplate.completeCallback(e.params.argument.name);if(!a)return pt;let o=await a(e.params.argument.value);return qr(o)}setResourceRequestHandlers(){this._resourceHandlersInitialized||(this.server.assertCanSetRequestHandler(Xe.shape.method.value),this.server.assertCanSetRequestHandler(Ke.shape.method.value),this.server.assertCanSetRequestHandler(Ye.shape.method.value),this.server.registerCapabilities({resources:{}}),this.server.setRequestHandler(Xe,async(e,t)=>{let s=Object.entries(this._registeredResources).map(([o,i])=>({uri:o,name:i.name,...i.metadata})),a=[];for(let o of Object.values(this._registeredResourceTemplates)){if(!o.resourceTemplate.listCallback)continue;let i=await o.resourceTemplate.listCallback(t);for(let c of i.resources)a.push({...c,...o.metadata})}return{resources:[...s,...a]}}),this.server.setRequestHandler(Ke,async()=>({resourceTemplates:Object.entries(this._registeredResourceTemplates).map(([t,s])=>({name:t,uriTemplate:s.resourceTemplate.uriTemplate.toString(),...s.metadata}))})),this.server.setRequestHandler(Ye,async(e,t)=>{let s=new URL(e.params.uri),a=this._registeredResources[s.toString()];if(a)return a.readCallback(s,t);for(let o of Object.values(this._registeredResourceTemplates)){let i=o.resourceTemplate.uriTemplate.match(s.toString());if(i)return o.readCallback(s,i,t)}throw new C(P.InvalidParams,`Resource ${s} not found`)}),this.setCompletionRequestHandler(),this._resourceHandlersInitialized=!0)}setPromptRequestHandlers(){this._promptHandlersInitialized||(this.server.assertCanSetRequestHandler(Qe.shape.method.value),this.server.assertCanSetRequestHandler(et.shape.method.value),this.server.registerCapabilities({prompts:{}}),this.server.setRequestHandler(Qe,()=>({prompts:Object.entries(this._registeredPrompts).map(([e,t])=>({name:e,description:t.description,arguments:t.argsSchema?Wn(t.argsSchema):void 0}))})),this.server.setRequestHandler(et,async(e,t)=>{let s=this._registeredPrompts[e.params.name];if(!s)throw new C(P.InvalidParams,`Prompt ${e.params.name} not found`);if(s.argsSchema){let a=await s.argsSchema.safeParseAsync(e.params.arguments);if(!a.success)throw new C(P.InvalidParams,`Invalid arguments for prompt ${e.params.name}: ${a.error.message}`);let o=a.data,i=s.callback;return await Promise.resolve(i(o,t))}else{let a=s.callback;return await Promise.resolve(a(t))}}),this.setCompletionRequestHandler(),this._promptHandlersInitialized=!0)}resource(e,t,...s){let a;typeof s[0]=="object"&&(a=s.shift());let o=s[0];if(typeof t=="string"){if(this._registeredResources[t])throw new Error(`Resource ${t} is already registered`);this._registeredResources[t]={name:e,metadata:a,readCallback:o}}else{if(this._registeredResourceTemplates[e])throw new Error(`Resource template ${e} is already registered`);this._registeredResourceTemplates[e]={resourceTemplate:t,metadata:a,readCallback:o}}this.setResourceRequestHandlers()}tool(e,...t){if(this._registeredTools[e])throw new Error(`Tool ${e} is already registered`);let s;typeof t[0]=="string"&&(s=t.shift());let a;t.length>1&&(a=t.shift());let o=t[0];this._registeredTools[e]={description:s,inputSchema:a===void 0?void 0:n.object(a),callback:o},this.setToolRequestHandlers()}prompt(e,...t){if(this._registeredPrompts[e])throw new Error(`Prompt ${e} is already registered`);let s;typeof t[0]=="string"&&(s=t.shift());let a;t.length>1&&(a=t.shift());let o=t[0];this._registeredPrompts[e]={description:s,argsSchema:a===void 0?void 0:n.object(a),callback:o},this.setPromptRequestHandlers()}};var Jn={type:"object"};function Wn(r){return Object.entries(r.shape).map(([e,t])=>({name:e,description:t.description,required:!t.isOptional()}))}function qr(r){return{completion:{values:r.slice(0,100),total:r.length,hasMore:r.length>100}}}var pt={completion:{values:[],hasMore:!1}};var Lr=n.object({query:n.object({assigned_by_account_id:n.number(),status:n.union([n.literal("open"),n.literal("done")])})}),Dr=n.object({body:n.object({name:n.string(),description:n.string().optional(),link:n.union([n.literal(0),n.literal(1)]).optional(),link_code:n.string().optional(),link_need_acceptance:n.union([n.literal(0),n.literal(1)]).optional(),members_admin_ids:n.string(),members_member_ids:n.string().optional(),members_readonly_ids:n.string().optional(),icon_preset:n.string().optional()})}),zr=n.object({path:n.object({room_id:n.number()})}),Hr=n.object({path:n.object({room_id:n.number()}),body:n.object({name:n.string().optional(),description:n.string().optional(),icon_preset:n.string().optional()})}),Vr=n.object({path:n.object({room_id:n.number()}),body:n.object({action_type:n.union([n.literal("leave"),n.literal("delete")])})}),Fr=n.object({path:n.object({room_id:n.number()})}),Ur=n.object({path:n.object({room_id:n.number()}),body:n.object({members_admin_ids:n.string(),members_member_ids:n.string().optional(),members_readonly_ids:n.string().optional()})}),Br=n.object({path:n.object({room_id:n.number()}),query:n.object({force:n.union([n.literal(0),n.literal(1)]).optional()})}),Gr=n.object({path:n.object({room_id:n.number()}),body:n.object({body:n.string(),self_unread:n.union([n.literal(0),n.literal(1)]).optional()})}),Jr=n.object({path:n.object({room_id:n.number()}),body:n.object({message_id:n.string()})}),Wr=n.object({path:n.object({room_id:n.number()}),body:n.object({message_id:n.string()})}),Xr=n.object({path:n.object({room_id:n.number(),message_id:n.string()})}),Kr=n.object({path:n.object({room_id:n.number(),message_id:n.string()}),body:n.object({body:n.string()})}),Yr=n.object({path:n.object({room_id:n.number(),message_id:n.string()})}),Qr=n.object({path:n.object({room_id:n.number()}),query:n.object({account_id:n.number().optional(),assigned_by_account_id:n.number().optional(),status:n.union([n.literal("open"),n.literal("done")]).optional()})}),es=n.object({path:n.object({room_id:n.number()}),body:n.object({body:n.string(),to_ids:n.string(),limit:n.number().optional(),limit_type:n.union([n.literal("none"),n.literal("date"),n.literal("time")]).optional()})}),ts=n.object({path:n.object({room_id:n.number(),task_id:n.number()})}),rs=n.object({path:n.object({room_id:n.number(),task_id:n.number()}),body:n.object({body:n.union([n.literal("open"),n.literal("done")])})}),ss=n.object({path:n.object({room_id:n.number()}),query:n.object({account_id:n.number().optional()})}),as=n.object({path:n.object({room_id:n.number(),file_id:n.number()}),query:n.object({create_download_url:n.union([n.literal(0),n.literal(1)]).optional()})}),ns=n.object({path:n.object({room_id:n.number()})}),os=n.object({path:n.object({room_id:n.number()}),body:n.object({code:n.string().optional(),need_acceptance:n.union([n.literal(0),n.literal(1)]).optional(),description:n.string().optional()})}),is=n.object({path:n.object({room_id:n.number()}),body:n.object({code:n.string().optional(),need_acceptance:n.union([n.literal(0),n.literal(1)]).optional(),description:n.string().optional()})}),cs=n.object({path:n.object({room_id:n.number()})}),ls=n.object({path:n.object({request_id:n.number()})}),us=n.object({path:n.object({request_id:n.number()})});var At=class{token;constructor(e){this.token=e}async request(e){let t=new URL(`https://api.chatwork.com/v2${e.path}`);Object.entries(e.query).filter(([,l])=>l!==void 0).forEach(([l,u])=>{t.searchParams.append(l,String(u))});let s=new URLSearchParams;Object.entries(e.body).filter(([,l])=>l!==void 0).forEach(([l,u])=>{s.append(l,String(u))});let a={method:e.method,headers:{"X-ChatWorkToken":this.token,"Content-Type":"application/x-www-form-urlencoded"}};s.size>0&&(a.body=s);let o=await fetch(t.toString(),a),i=await o.text(),c;try{c=JSON.stringify(JSON.parse(i))}catch{c=i}return{uri:t.toString(),ok:o.ok,status:o.status,response:c}}};function R(){let r=process.env.CHATWORK_API_TOKEN;if(!r)throw new Error("CHATWORK_API_TOKEN is not set");return new At(r)}function T(r){return r.ok?{content:[{type:"resource",resource:{uri:r.uri,text:r.response}}]}:{isError:!0,content:[{type:"text",text:`Error: status code ${r.status}`},{type:"resource",resource:{uri:r.uri,text:r.response}}]}}var ds=()=>R().request({path:"/me",method:"GET",query:{},body:{}}).then(T),ms=()=>R().request({path:"/my/status",method:"GET",query:{},body:{}}).then(T),ps=r=>R().request({path:"/my/tasks",method:"GET",query:r.query,body:{}}).then(T),hs=()=>R().request({path:"/contacts",method:"GET",query:{},body:{}}).then(T),Xn=r=>{if(!r.ok||r.response.length<2500)return r;let t=JSON.parse(r.response).map(({room_id:s,name:a,type:o})=>({room_id:s,name:a,type:o}));return{...r,response:JSON.stringify(t)}},fs=()=>R().request({path:"/rooms",method:"GET",query:{},body:{}}).then(Xn).then(T),gs=r=>R().request({path:"/rooms",method:"POST",body:r.body,query:{}}).then(T),_s=r=>R().request({path:`/rooms/${r.path.room_id}`,method:"GET",query:{},body:{}}).then(T),ys=r=>R().request({path:`/rooms/${r.path.room_id}`,method:"PUT",query:{},body:r.body}).then(T),vs=r=>R().request({path:`/rooms/${r.path.room_id}`,method:"DELETE",query:{},body:r.body}).then(T),bs=r=>R().request({path:`/rooms/${r.path.room_id}/members`,method:"GET",query:{},body:{}}).then(T),xs=r=>R().request({path:`/rooms/${r.path.room_id}/members`,method:"PUT",query:{},body:r.body}).then(T),ks=r=>R().request({path:`/rooms/${r.path.room_id}/messages`,method:"GET",query:r.query,body:{}}).then(T),Ss=r=>R().request({path:`/rooms/${r.path.room_id}/messages`,method:"POST",query:{},body:r.body}).then(T),Rs=r=>R().request({path:`/rooms/${r.path.room_id}/messages/read`,method:"PUT",query:{},body:r.body}).then(T),Ts=r=>R().request({path:`/rooms/${r.path.room_id}/messages/unread`,method:"PUT",query:{},body:r.body}).then(T),ws=r=>R().request({path:`/rooms/${r.path.room_id}/messages/${r.path.message_id}`,method:"GET",query:{},body:{}}).then(T),Ps=r=>R().request({path:`/rooms/${r.path.room_id}/messages/${r.path.message_id}`,method:"PUT",query:{},body:r.body}).then(T),js=r=>R().request({path:`/rooms/${r.path.room_id}/messages/${r.path.message_id}`,method:"DELETE",query:{},body:{}}).then(T),Cs=r=>R().request({path:`/rooms/${r.path.room_id}/tasks`,method:"GET",query:r.query,body:{}}).then(T),Es=r=>R().request({path:`/rooms/${r.path.room_id}/tasks`,method:"POST",query:{},body:r.body}).then(T),As=r=>R().request({path:`/rooms/${r.path.room_id}/tasks/${r.path.task_id}`,method:"GET",query:{},body:{}}).then(T),Os=r=>R().request({path:`/rooms/${r.path.room_id}/tasks/${r.path.task_id}/status`,method:"PUT",query:{},body:r.body}).then(T),Ms=r=>R().request({path:`/rooms/${r.path.room_id}/files`,method:"GET",query:{},body:{}}).then(T),Is=r=>R().request({path:`/rooms/${r.path.room_id}/files/${r.path.file_id}`,method:"GET",query:r.query,body:{}}).then(T),Ns=r=>R().request({path:`/rooms/${r.path.room_id}/link`,method:"GET",query:{},body:{}}).then(T),Zs=r=>R().request({path:`/rooms/${r.path.room_id}/link`,method:"POST",query:{},body:r.body}).then(T),$s=r=>R().request({path:`/rooms/${r.path.room_id}/link`,method:"PUT",query:{},body:r.body}).then(T),qs=r=>R().request({path:`/rooms/${r.path.room_id}/link`,method:"DELETE",query:{},body:{}}).then(T),Ls=()=>R().request({path:"/incoming_requests",method:"GET",query:{},body:{}}).then(T),Ds=r=>R().request({path:`/incoming_requests/${r.path.request_id}/accept`,method:"PUT",query:{},body:{}}).then(T),zs=r=>R().request({path:`/incoming_requests/${r.path.request_id}/reject`,method:"DELETE",query:{},body:{}}).then(T);var S=new ht({name:"Chatwork",version:"0.0.1"});S.tool("get_me","\u81EA\u5206\u81EA\u8EAB\u306E\u60C5\u5831\u3092\u53D6\u5F97\u3057\u307E\u3059\u3002",ds);S.tool("get_my_status","\u81EA\u5206\u306E\u672A\u8AAD\u6570\u3001\u81EA\u5206\u5B9B\u3066\u306E\u672A\u8AAD\u306E\u6570\u3001\u672A\u5B8C\u4E86\u30BF\u30B9\u30AF\u6570\u3092\u53D6\u5F97\u3057\u307E\u3059\u3002",ms);S.tool("list_my_tasks","\u81EA\u5206\u306E\u30BF\u30B9\u30AF\u4E00\u89A7\u3092\u6700\u5927100\u4EF6\u307E\u3067\u53D6\u5F97\u3057\u307E\u3059\u3002",Lr.shape,ps);S.tool("list_contacts","\u81EA\u5206\u306E\u30B3\u30F3\u30BF\u30AF\u30C8\u4E00\u89A7\u3092\u53D6\u5F97\u3057\u307E\u3059\u3002",hs);S.tool("list_rooms","\u30C1\u30E3\u30C3\u30C8\u4E00\u89A7\u3092\u53D6\u5F97\u3057\u307E\u3059\u3002",fs);S.tool("create_room","\u65B0\u3057\u3044\u30B0\u30EB\u30FC\u30D7\u30C1\u30E3\u30C3\u30C8\u3092\u4F5C\u6210\u3057\u307E\u3059\u3002",Dr.shape,gs);S.tool("get_room","\u30C1\u30E3\u30C3\u30C8\u306E\u60C5\u5831\uFF08\u540D\u524D\u3001\u30A2\u30A4\u30B3\u30F3\u3001\u7A2E\u985E\u306A\u3069\uFF09\u3092\u53D6\u5F97\u3057\u307E\u3059\u3002",zr.shape,_s);S.tool("update_room","\u30C1\u30E3\u30C3\u30C8\u306E\u60C5\u5831\uFF08\u540D\u524D\u3001\u30A2\u30A4\u30B3\u30F3\u306A\u3069\uFF09\u3092\u5909\u66F4\u3057\u307E\u3059\u3002",Hr.shape,ys);S.tool("delete_or_leave_room","\u30B0\u30EB\u30FC\u30D7\u30C1\u30E3\u30C3\u30C8\u3092\u9000\u5E2D\u3001\u307E\u305F\u306F\u524A\u9664\u3057\u307E\u3059\u3002\u30B0\u30EB\u30FC\u30D7\u30C1\u30E3\u30C3\u30C8\u3092\u9000\u5E2D\u3059\u308B\u3068\u3001\u3053\u306E\u30B0\u30EB\u30FC\u30D7\u30C1\u30E3\u30C3\u30C8\u306B\u3042\u308B\u81EA\u5206\u304C\u62C5\u5F53\u8005\u306E\u30BF\u30B9\u30AF\u3001\u304A\u3088\u3073\u81EA\u5206\u304C\u9001\u4FE1\u3057\u305F\u30D5\u30A1\u30A4\u30EB\u304C\u3059\u3079\u3066\u524A\u9664\u3055\u308C\u307E\u3059\u3002\u30B0\u30EB\u30FC\u30D7\u30C1\u30E3\u30C3\u30C8\u3092\u524A\u9664\u3059\u308B\u3068\u3001\u3053\u306E\u30B0\u30EB\u30FC\u30D7\u30C1\u30E3\u30C3\u30C8\u306B\u3042\u308B\u30E1\u30C3\u30BB\u30FC\u30B8\u3001\u30BF\u30B9\u30AF\u3001\u30D5\u30A1\u30A4\u30EB\u304C\u3059\u3079\u3066\u524A\u9664\u3055\u308C\u307E\u3059\u3002\uFF08\u4E00\u5EA6\u524A\u9664\u3059\u308B\u3068\u5143\u306B\u623B\u305B\u307E\u305B\u3093\u3002\uFF09",Vr.shape,vs);S.tool("list_room_members","\u30C1\u30E3\u30C3\u30C8\u306E\u30E1\u30F3\u30D0\u30FC\u4E00\u89A7\u3092\u53D6\u5F97\u3057\u307E\u3059\u3002",Fr.shape,bs);S.tool("update_room_members","\u30C1\u30E3\u30C3\u30C8\u306E\u30E1\u30F3\u30D0\u30FC\u3092\u4E00\u62EC\u3067\u5909\u66F4\u3057\u307E\u3059\u3002",Ur.shape,xs);S.tool("list_room_messages","\u30C1\u30E3\u30C3\u30C8\u306E\u30E1\u30C3\u30BB\u30FC\u30B8\u4E00\u89A7\u3092\u6700\u5927100\u4EF6\u307E\u3067\u53D6\u5F97\u3057\u307E\u3059\u3002",Br.shape,ks);S.tool("post_room_message","\u30C1\u30E3\u30C3\u30C8\u306B\u65B0\u3057\u3044\u30E1\u30C3\u30BB\u30FC\u30B8\u3092\u6295\u7A3F\u3057\u307E\u3059\u3002",Gr.shape,Ss);S.tool("read_room_messages","\u30C1\u30E3\u30C3\u30C8\u306E\u30E1\u30C3\u30BB\u30FC\u30B8\u3092\u65E2\u8AAD\u306B\u3057\u307E\u3059\u3002",Jr.shape,Rs);S.tool("unread_room_message","\u30C1\u30E3\u30C3\u30C8\u306E\u30E1\u30C3\u30BB\u30FC\u30B8\u3092\u672A\u8AAD\u306B\u3057\u307E\u3059\u3002",Wr.shape,Ts);S.tool("get_room_message","\u30C1\u30E3\u30C3\u30C8\u306E\u30E1\u30C3\u30BB\u30FC\u30B8\u3092\u53D6\u5F97\u3057\u307E\u3059\u3002",Xr.shape,ws);S.tool("update_room_message","\u30C1\u30E3\u30C3\u30C8\u306E\u30E1\u30C3\u30BB\u30FC\u30B8\u3092\u66F4\u65B0\u3057\u307E\u3059\u3002",Kr.shape,Ps);S.tool("delete_room_message","\u30C1\u30E3\u30C3\u30C8\u306E\u30E1\u30C3\u30BB\u30FC\u30B8\u3092\u524A\u9664\u3057\u307E\u3059\u3002",Yr.shape,js);S.tool("list_room_tasks","\u30C1\u30E3\u30C3\u30C8\u306E\u30BF\u30B9\u30AF\u4E00\u89A7\u3092\u6700\u5927100\u4EF6\u307E\u3067\u53D6\u5F97\u3057\u307E\u3059\u3002",Qr.shape,Cs);S.tool("create_room_task","\u30C1\u30E3\u30C3\u30C8\u306B\u65B0\u3057\u3044\u30BF\u30B9\u30AF\u3092\u8FFD\u52A0\u3057\u307E\u3059\u3002",es.shape,Es);S.tool("get_room_task","\u30C1\u30E3\u30C3\u30C8\u306E\u30BF\u30B9\u30AF\u306E\u60C5\u5831\u3092\u53D6\u5F97\u3057\u307E\u3059\u3002",ts.shape,As);S.tool("update_room_task_status","\u30C1\u30E3\u30C3\u30C8\u306E\u30BF\u30B9\u30AF\u306E\u5B8C\u4E86\u72B6\u614B\u3092\u5909\u66F4\u3057\u307E\u3059\u3002",rs.shape,Os);S.tool("list_room_files","\u30C1\u30E3\u30C3\u30C8\u306E\u30D5\u30A1\u30A4\u30EB\u4E00\u89A7\u3092\u6700\u5927100\u4EF6\u307E\u3067\u53D6\u5F97\u3057\u307E\u3059\u3002",ss.shape,Ms);S.tool("get_room_file","\u30C1\u30E3\u30C3\u30C8\u306E\u30D5\u30A1\u30A4\u30EB\u306E\u60C5\u5831\u3092\u53D6\u5F97\u3057\u307E\u3059\u3002",as.shape,Is);S.tool("get_room_link","\u30C1\u30E3\u30C3\u30C8\u3078\u306E\u62DB\u5F85\u30EA\u30F3\u30AF\u3092\u53D6\u5F97\u3057\u307E\u3059\u3002",ns.shape,Ns);S.tool("create_room_link","\u30C1\u30E3\u30C3\u30C8\u3078\u306E\u62DB\u5F85\u30EA\u30F3\u30AF\u3092\u4F5C\u6210\u3057\u307E\u3059\u3002\u3059\u3067\u306B\u62DB\u5F85\u30EA\u30F3\u30AF\u304C\u4F5C\u6210\u3055\u308C\u3066\u3044\u308B\u5834\u5408\u306F400\u30A8\u30E9\u30FC\u3092\u8FD4\u3057\u307E\u3059\u3002",os.shape,Zs);S.tool("update_room_link","\u30C1\u30E3\u30C3\u30C8\u3078\u306E\u62DB\u5F85\u30EA\u30F3\u30AF\u3092\u5909\u66F4\u3057\u307E\u3059\u3002\u62DB\u5F85\u30EA\u30F3\u30AF\u304C\u7121\u52B9\u306B\u306A\u3063\u3066\u3044\u308B\u5834\u5408\u306F400\u30A8\u30E9\u30FC\u3092\u8FD4\u3057\u307E\u3059\u3002",is.shape,$s);S.tool("delete_room_link","\u30C1\u30E3\u30C3\u30C8\u3078\u306E\u62DB\u5F85\u30EA\u30F3\u30AF\u3092\u524A\u9664\u3057\u307E\u3059\u3002\u62DB\u5F85\u30EA\u30F3\u30AF\u304C\u7121\u52B9\u306B\u306A\u3063\u3066\u3044\u308B\u5834\u5408\u306F400\u30A8\u30E9\u30FC\u3092\u8FD4\u3057\u307E\u3059\u3002",cs.shape,qs);S.tool("list_incoming_requests","\u81EA\u5206\u3078\u306E\u30B3\u30F3\u30BF\u30AF\u30C8\u627F\u8A8D\u4F9D\u983C\u4E00\u89A7\u3092\u6700\u5927100\u4EF6\u307E\u3067\u53D6\u5F97\u3057\u307E\u3059\u3002",Ls);S.tool("accept_incoming_request","\u81EA\u5206\u3078\u306E\u30B3\u30F3\u30BF\u30AF\u30C8\u627F\u8A8D\u4F9D\u983C\u3092\u627F\u8A8D\u3057\u307E\u3059\u3002",ls.shape,Ds);S.tool("reject_incoming_request","\u81EA\u5206\u3078\u306E\u30B3\u30F3\u30BF\u30AF\u30C8\u627F\u8A8D\u4F9D\u983C\u3092\u62D2\u5426\u3057\u307E\u3059\u3002",us.shape,zs);async function Kn(){let r=new it;await S.connect(r)}Kn().catch(()=>{process.exit(1)});