@f2c/mcp 0.2.5 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +54 -54
- package/dist/cli.js +8 -15
- package/dist/cli.js.map +15 -16
- package/dist/stdio.js +8 -15
- package/dist/stdio.js.map +15 -16
- package/dist/streamable-http.js +70 -77
- package/dist/streamable-http.js.map +18 -19
- package/package.json +74 -74
- package/dist/cli.d.mts +0 -1
- package/dist/cli.d.ts +0 -1
- package/dist/cli.mjs +0 -8
- package/dist/stdio.d.mts +0 -2
- package/dist/stdio.d.ts +0 -2
- package/dist/stdio.mjs +0 -7
- package/dist/streamableHttp.d.mts +0 -2
- package/dist/streamableHttp.d.ts +0 -2
- package/dist/streamableHttp.js +0 -83
- package/dist/streamableHttp.mjs +0 -83
package/dist/cli.js
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
#!/usr/bin/env node
|
2
|
-
var E2=Object.create;var{getPrototypeOf:b2,defineProperty:L1,getOwnPropertyNames:v2}=Object;var k2=Object.prototype.hasOwnProperty;var c0=($,X,W)=>{W=$!=null?E2(b2($)):{};let Q=X||!$||!$.__esModule?L1(W,"default",{value:$,enumerable:!0}):W;for(let H of v2($))if(!k2.call(Q,H))L1(Q,H,{get:()=>$[H],enumerable:!0});return Q};var l6=($,X)=>()=>(X||$((X={exports:{}}).exports,X),X.exports);var n6=($,X)=>{for(var W in X)L1($,W,{get:X[W],enumerable:!0,configurable:!0,set:(Q)=>X[W]=()=>Q})};var F1=($,X)=>()=>($&&(X=$($=0)),X);function I2($){s1=$}function u0(){return s1}function A($,X){let W=u0(),Q=p0({issueData:X,data:$.data,path:$.path,errorMaps:[$.common.contextualErrorMap,$.schemaErrorMap,W,W===V0?void 0:V0].filter((H)=>!!H)});$.common.issues.push(Q)}class E{constructor(){this.value="valid"}dirty(){if(this.value==="valid")this.value="dirty"}abort(){if(this.value!=="aborted")this.value="aborted"}static mergeArray($,X){let W=[];for(let Q of X){if(Q.status==="aborted")return U;if(Q.status==="dirty")$.dirty();W.push(Q.value)}return{status:$.value,value:W}}static async mergeObjectAsync($,X){let W=[];for(let Q of X){let H=await Q.key,Y=await Q.value;W.push({key:H,value:Y})}return E.mergeObjectSync($,W)}static mergeObjectSync($,X){let W={};for(let Q of X){let{key:H,value:Y}=Q;if(H.status==="aborted")return U;if(Y.status==="aborted")return U;if(H.status==="dirty")$.dirty();if(Y.status==="dirty")$.dirty();if(H.value!=="__proto__"&&(typeof Y.value!=="undefined"||Q.alwaysSet))W[H.value]=Y.value}return{status:$.value,value:W}}}function i0($,X,W,Q){if(W==="a"&&!Q)throw new TypeError("Private accessor was defined without a getter");if(typeof X==="function"?$!==X||!Q:!X.has($))throw new TypeError("Cannot read private member from an object whose class did not declare it");return W==="m"?Q:W==="a"?Q.call($):Q?Q.value:X.get($)}function e1($,X,W,Q,H){if(Q==="m")throw new TypeError("Private method is not writable");if(Q==="a"&&!H)throw new TypeError("Private accessor was defined without a setter");if(typeof X==="function"?$!==X||!H:!X.has($))throw new TypeError("Cannot write private member to an object whose class did not declare it");return Q==="a"?H.call($,W):H?H.value=W:X.set($,W),W}class y{constructor($,X,W,Q){this._cachedPath=[],this.parent=$,this.data=X,this._path=W,this._key=Q}get path(){if(!this._cachedPath.length)if(this._key instanceof Array)this._cachedPath.push(...this._path,...this._key);else this._cachedPath.push(...this._path,this._key);return this._cachedPath}}function N($){if(!$)return{};let{errorMap:X,invalid_type_error:W,required_error:Q,description:H}=$;if(X&&(W||Q))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);if(X)return{errorMap:X,description:H};return{errorMap:(G,B)=>{var w,M;let{message:q}=$;if(G.code==="invalid_enum_value")return{message:q!==null&&q!==void 0?q:B.defaultError};if(typeof B.data==="undefined")return{message:(w=q!==null&&q!==void 0?q:Q)!==null&&w!==void 0?w:B.defaultError};if(G.code!=="invalid_type")return{message:B.defaultError};return{message:(M=q!==null&&q!==void 0?q:W)!==null&&M!==void 0?M:B.defaultError}},description:H}}class K{get description(){return this._def.description}_getType($){return t($.data)}_getOrReturnCtx($,X){return X||{common:$.parent.common,data:$.data,parsedType:t($.data),schemaErrorMap:this._def.errorMap,path:$.path,parent:$.parent}}_processInputParams($){return{status:new E,ctx:{common:$.parent.common,data:$.data,parsedType:t($.data),schemaErrorMap:this._def.errorMap,path:$.path,parent:$.parent}}}_parseSync($){let X=this._parse($);if(k0(X))throw new Error("Synchronous parse encountered promise.");return X}_parseAsync($){let X=this._parse($);return Promise.resolve(X)}parse($,X){let W=this.safeParse($,X);if(W.success)return W.data;throw W.error}safeParse($,X){var W;let Q={common:{issues:[],async:(W=X===null||X===void 0?void 0:X.async)!==null&&W!==void 0?W:!1,contextualErrorMap:X===null||X===void 0?void 0:X.errorMap},path:(X===null||X===void 0?void 0:X.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:$,parsedType:t($)},H=this._parseSync({data:$,path:Q.path,parent:Q});return r1(Q,H)}"~validate"($){var X,W;let Q={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:$,parsedType:t($)};if(!this["~standard"].async)try{let H=this._parseSync({data:$,path:[],parent:Q});return J0(H)?{value:H.value}:{issues:Q.common.issues}}catch(H){if((W=(X=H===null||H===void 0?void 0:H.message)===null||X===void 0?void 0:X.toLowerCase())===null||W===void 0?void 0:W.includes("encountered"))this["~standard"].async=!0;Q.common={issues:[],async:!0}}return this._parseAsync({data:$,path:[],parent:Q}).then((H)=>J0(H)?{value:H.value}:{issues:Q.common.issues})}async parseAsync($,X){let W=await this.safeParseAsync($,X);if(W.success)return W.data;throw W.error}async safeParseAsync($,X){let W={common:{issues:[],contextualErrorMap:X===null||X===void 0?void 0:X.errorMap,async:!0},path:(X===null||X===void 0?void 0:X.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:$,parsedType:t($)},Q=this._parse({data:$,path:W.path,parent:W}),H=await(k0(Q)?Q:Promise.resolve(Q));return r1(W,H)}refine($,X){let W=(Q)=>{if(typeof X==="string"||typeof X==="undefined")return{message:X};else if(typeof X==="function")return X(Q);else return X};return this._refinement((Q,H)=>{let Y=$(Q),G=()=>H.addIssue({code:D.custom,...W(Q)});if(typeof Promise!=="undefined"&&Y instanceof Promise)return Y.then((B)=>{if(!B)return G(),!1;else return!0});if(!Y)return G(),!1;else return!0})}refinement($,X){return this._refinement((W,Q)=>{if(!$(W))return Q.addIssue(typeof X==="function"?X(W,Q):X),!1;else return!0})}_refinement($){return new T({schema:this,typeName:z.ZodEffects,effect:{type:"refinement",refinement:$}})}superRefine($){return this._refinement($)}constructor($){this.spa=this.safeParseAsync,this._def=$,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:(X)=>this["~validate"](X)}}optional(){return I.create(this,this._def)}nullable(){return s.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return h.create(this)}promise(){return w0.create(this,this._def)}or($){return U0.create([this,$],this._def)}and($){return K0.create(this,$,this._def)}transform($){return new T({...N(this._def),schema:this,typeName:z.ZodEffects,effect:{type:"transform",transform:$}})}default($){let X=typeof $==="function"?$:()=>$;return new S0({...N(this._def),innerType:this,defaultValue:X,typeName:z.ZodDefault})}brand(){return new o0({typeName:z.ZodBranded,type:this,...N(this._def)})}catch($){let X=typeof $==="function"?$:()=>$;return new _0({...N(this._def),innerType:this,catchValue:X,typeName:z.ZodCatch})}describe($){return new this.constructor({...this._def,description:$})}pipe($){return g0.create(this,$)}readonly(){return R0.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}function X$($){let X="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";if($.precision)X=`${X}\\.\\d{${$.precision}}`;else if($.precision==null)X=`${X}(\\.\\d+)?`;return X}function r2($){return new RegExp(`^${X$($)}$`)}function W$($){let X=`${$$}T${X$($)}`,W=[];if(W.push($.local?"Z?":"Z"),$.offset)W.push("([+-]\\d{2}:?\\d{2})");return X=`${X}(${W.join("|")})`,new RegExp(`^${X}$`)}function a2($,X){if((X==="v4"||!X)&&n2.test($))return!0;if((X==="v6"||!X)&&u2.test($))return!0;return!1}function t2($,X){if(!y2.test($))return!1;try{let[W]=$.split("."),Q=W.replace(/-/g,"+").replace(/_/g,"/").padEnd(W.length+(4-W.length%4)%4,"="),H=JSON.parse(atob(Q));if(typeof H!=="object"||H===null)return!1;if(!H.typ||!H.alg)return!1;if(X&&H.alg!==X)return!1;return!0}catch(W){return!1}}function s2($,X){if((X==="v4"||!X)&&c2.test($))return!0;if((X==="v6"||!X)&&p2.test($))return!0;return!1}function e2($,X){let W=($.toString().split(".")[1]||"").length,Q=(X.toString().split(".")[1]||"").length,H=W>Q?W:Q,Y=parseInt($.toFixed(H).replace(".","")),G=parseInt(X.toFixed(H).replace(".",""));return Y%G/Math.pow(10,H)}function z0($){if($ instanceof S){let X={};for(let W in $.shape){let Q=$.shape[W];X[W]=I.create(z0(Q))}return new S({...$._def,shape:()=>X})}else if($ instanceof h)return new h({...$._def,type:z0($.element)});else if($ instanceof I)return I.create(z0($.unwrap()));else if($ instanceof s)return s.create(z0($.unwrap()));else if($ instanceof i)return i.create($.items.map((X)=>z0(X)));else return $}function b1($,X){let W=t($),Q=t(X);if($===X)return{valid:!0,data:$};else if(W===V.object&&Q===V.object){let H=F.objectKeys(X),Y=F.objectKeys($).filter((B)=>H.indexOf(B)!==-1),G={...$,...X};for(let B of Y){let w=b1($[B],X[B]);if(!w.valid)return{valid:!1};G[B]=w.data}return{valid:!0,data:G}}else if(W===V.array&&Q===V.array){if($.length!==X.length)return{valid:!1};let H=[];for(let Y=0;Y<$.length;Y++){let G=$[Y],B=X[Y],w=b1(G,B);if(!w.valid)return{valid:!1};H.push(w.data)}return{valid:!0,data:H}}else if(W===V.date&&Q===V.date&&+$===+X)return{valid:!0,data:$};else return{valid:!1}}function Q$($,X){return new W0({values:$,typeName:z.ZodEnum,...N(X)})}function a1($,X){let W=typeof $==="function"?$(X):typeof $==="string"?{message:$}:$;return typeof W==="string"?{message:W}:W}function H$($,X={},W){if($)return G0.create().superRefine((Q,H)=>{var Y,G;let B=$(Q);if(B instanceof Promise)return B.then((w)=>{var M,q;if(!w){let b=a1(X,Q),r=(q=(M=b.fatal)!==null&&M!==void 0?M:W)!==null&&q!==void 0?q:!0;H.addIssue({code:"custom",...b,fatal:r})}});if(!B){let w=a1(X,Q),M=(G=(Y=w.fatal)!==null&&Y!==void 0?Y:W)!==null&&G!==void 0?G:!0;H.addIssue({code:"custom",...w,fatal:M})}return});return G0.create()}var F,_1,V,t=($)=>{switch(typeof $){case"undefined":return V.undefined;case"string":return V.string;case"number":return isNaN($)?V.nan:V.number;case"boolean":return V.boolean;case"function":return V.function;case"bigint":return V.bigint;case"symbol":return V.symbol;case"object":if(Array.isArray($))return V.array;if($===null)return V.null;if($.then&&typeof $.then==="function"&&$.catch&&typeof $.catch==="function")return V.promise;if(typeof Map!=="undefined"&&$ instanceof Map)return V.map;if(typeof Set!=="undefined"&&$ instanceof Set)return V.set;if(typeof Date!=="undefined"&&$ instanceof Date)return V.date;return V.object;default:return V.unknown}},D,C2=($)=>{return JSON.stringify($,null,2).replace(/"([^"]+)":/g,"$1:")},C,V0=($,X)=>{let W;switch($.code){case D.invalid_type:if($.received===V.undefined)W="Required";else W=`Expected ${$.expected}, received ${$.received}`;break;case D.invalid_literal:W=`Invalid literal value, expected ${JSON.stringify($.expected,F.jsonStringifyReplacer)}`;break;case D.unrecognized_keys:W=`Unrecognized key(s) in object: ${F.joinValues($.keys,", ")}`;break;case D.invalid_union:W="Invalid input";break;case D.invalid_union_discriminator:W=`Invalid discriminator value. Expected ${F.joinValues($.options)}`;break;case D.invalid_enum_value:W=`Invalid enum value. Expected ${F.joinValues($.options)}, received '${$.received}'`;break;case D.invalid_arguments:W="Invalid function arguments";break;case D.invalid_return_type:W="Invalid function return type";break;case D.invalid_date:W="Invalid date";break;case D.invalid_string:if(typeof $.validation==="object")if("includes"in $.validation){if(W=`Invalid input: must include "${$.validation.includes}"`,typeof $.validation.position==="number")W=`${W} at one or more positions greater than or equal to ${$.validation.position}`}else if("startsWith"in $.validation)W=`Invalid input: must start with "${$.validation.startsWith}"`;else if("endsWith"in $.validation)W=`Invalid input: must end with "${$.validation.endsWith}"`;else F.assertNever($.validation);else if($.validation!=="regex")W=`Invalid ${$.validation}`;else W="Invalid";break;case D.too_small:if($.type==="array")W=`Array must contain ${$.exact?"exactly":$.inclusive?"at least":"more than"} ${$.minimum} element(s)`;else if($.type==="string")W=`String must contain ${$.exact?"exactly":$.inclusive?"at least":"over"} ${$.minimum} character(s)`;else if($.type==="number")W=`Number must be ${$.exact?"exactly equal to ":$.inclusive?"greater than or equal to ":"greater than "}${$.minimum}`;else if($.type==="date")W=`Date must be ${$.exact?"exactly equal to ":$.inclusive?"greater than or equal to ":"greater than "}${new Date(Number($.minimum))}`;else W="Invalid input";break;case D.too_big:if($.type==="array")W=`Array must contain ${$.exact?"exactly":$.inclusive?"at most":"less than"} ${$.maximum} element(s)`;else if($.type==="string")W=`String must contain ${$.exact?"exactly":$.inclusive?"at most":"under"} ${$.maximum} character(s)`;else if($.type==="number")W=`Number must be ${$.exact?"exactly":$.inclusive?"less than or equal to":"less than"} ${$.maximum}`;else if($.type==="bigint")W=`BigInt must be ${$.exact?"exactly":$.inclusive?"less than or equal to":"less than"} ${$.maximum}`;else if($.type==="date")W=`Date must be ${$.exact?"exactly":$.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number($.maximum))}`;else W="Invalid input";break;case D.custom:W="Invalid input";break;case D.invalid_intersection_types:W="Intersection results could not be merged";break;case D.not_multiple_of:W=`Number must be a multiple of ${$.multipleOf}`;break;case D.not_finite:W="Number must be finite";break;default:W=X.defaultError,F.assertNever($)}return{message:W}},s1,p0=($)=>{let{data:X,path:W,errorMaps:Q,issueData:H}=$,Y=[...W,...H.path||[]],G={...H,path:Y};if(H.message!==void 0)return{...H,path:Y,message:H.message};let B="",w=Q.filter((M)=>!!M).slice().reverse();for(let M of w)B=M(G,{data:X,defaultError:B}).message;return{...H,path:Y,message:B}},P2,U,M0=($)=>({status:"dirty",value:$}),v=($)=>({status:"valid",value:$}),R1=($)=>$.status==="aborted",E1=($)=>$.status==="dirty",J0=($)=>$.status==="valid",k0=($)=>typeof Promise!=="undefined"&&$ instanceof Promise,j,b0,v0,r1=($,X)=>{if(J0(X))return{success:!0,data:X.value};else{if(!$.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let W=new C($.common.issues);return this._error=W,this._error}}}},f2,T2,g2,x2,h2,y2,Z2,m2,l2="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",S1,n2,c2,u2,p2,i2,d2,$$="((\\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])))",o2,x,$0,X0,j0,Y0,C0,q0,O0,G0,e,p,I0,h,S,U0,a=($)=>{if($ instanceof N0)return a($.schema);else if($ instanceof T)return a($.innerType());else if($ instanceof L0)return[$.value];else if($ instanceof W0)return $.options;else if($ instanceof F0)return F.objectValues($.enum);else if($ instanceof S0)return a($._def.innerType);else if($ instanceof q0)return[void 0];else if($ instanceof O0)return[null];else if($ instanceof I)return[void 0,...a($.unwrap())];else if($ instanceof s)return[null,...a($.unwrap())];else if($ instanceof o0)return a($.unwrap());else if($ instanceof R0)return a($.unwrap());else if($ instanceof _0)return a($._def.innerType);else return[]},d0,K0,i,P0,f0,B0,A0,N0,L0,W0,F0,w0,T,I,s,S0,_0,T0,$4,o0,g0,R0,X4,z,W4=($,X={message:`Input not instance of ${$.name}`})=>H$((W)=>W instanceof $,X),J$,Y$,Q4,H4,G$,J4,Y4,G4,B4,w4,D4,z4,M4,A4,V4,j4,q4,O4,U4,K4,N4,L4,F4,S4,_4,R4,E4,b4,v4,t1,k4,C4,I4,P4,f4=()=>J$().optional(),T4=()=>Y$().optional(),g4=()=>G$().optional(),x4,h4,J;var d=F1(()=>{(function($){$.assertEqual=(H)=>H;function X(H){}$.assertIs=X;function W(H){throw new Error}$.assertNever=W,$.arrayToEnum=(H)=>{let Y={};for(let G of H)Y[G]=G;return Y},$.getValidEnumValues=(H)=>{let Y=$.objectKeys(H).filter((B)=>typeof H[H[B]]!=="number"),G={};for(let B of Y)G[B]=H[B];return $.objectValues(G)},$.objectValues=(H)=>{return $.objectKeys(H).map(function(Y){return H[Y]})},$.objectKeys=typeof Object.keys==="function"?(H)=>Object.keys(H):(H)=>{let Y=[];for(let G in H)if(Object.prototype.hasOwnProperty.call(H,G))Y.push(G);return Y},$.find=(H,Y)=>{for(let G of H)if(Y(G))return G;return},$.isInteger=typeof Number.isInteger==="function"?(H)=>Number.isInteger(H):(H)=>typeof H==="number"&&isFinite(H)&&Math.floor(H)===H;function Q(H,Y=" | "){return H.map((G)=>typeof G==="string"?`'${G}'`:G).join(Y)}$.joinValues=Q,$.jsonStringifyReplacer=(H,Y)=>{if(typeof Y==="bigint")return Y.toString();return Y}})(F||(F={}));(function($){$.mergeShapes=(X,W)=>{return{...X,...W}}})(_1||(_1={}));V=F.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),D=F.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"]);C=class C extends Error{get errors(){return this.issues}constructor($){super();this.issues=[],this.addIssue=(W)=>{this.issues=[...this.issues,W]},this.addIssues=(W=[])=>{this.issues=[...this.issues,...W]};let X=new.target.prototype;if(Object.setPrototypeOf)Object.setPrototypeOf(this,X);else this.__proto__=X;this.name="ZodError",this.issues=$}format($){let X=$||function(H){return H.message},W={_errors:[]},Q=(H)=>{for(let Y of H.issues)if(Y.code==="invalid_union")Y.unionErrors.map(Q);else if(Y.code==="invalid_return_type")Q(Y.returnTypeError);else if(Y.code==="invalid_arguments")Q(Y.argumentsError);else if(Y.path.length===0)W._errors.push(X(Y));else{let G=W,B=0;while(B<Y.path.length){let w=Y.path[B];if(B!==Y.path.length-1)G[w]=G[w]||{_errors:[]};else G[w]=G[w]||{_errors:[]},G[w]._errors.push(X(Y));G=G[w],B++}}};return Q(this),W}static assert($){if(!($ instanceof C))throw new Error(`Not a ZodError: ${$}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,F.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten($=(X)=>X.message){let X={},W=[];for(let Q of this.issues)if(Q.path.length>0)X[Q.path[0]]=X[Q.path[0]]||[],X[Q.path[0]].push($(Q));else W.push($(Q));return{formErrors:W,fieldErrors:X}}get formErrors(){return this.flatten()}};C.create=($)=>{return new C($)};s1=V0;P2=[];U=Object.freeze({status:"aborted"});(function($){$.errToObj=(X)=>typeof X==="string"?{message:X}:X||{},$.toString=(X)=>typeof X==="string"?X:X===null||X===void 0?void 0:X.message})(j||(j={}));f2=/^c[^\s-]{8,}$/i,T2=/^[0-9a-z]+$/,g2=/^[0-9A-HJKMNP-TV-Z]{26}$/i,x2=/^[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,h2=/^[a-z0-9_-]{21}$/i,y2=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Z2=/^[-+]?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)?)??$/,m2=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,n2=/^(?:(?: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])$/,c2=/^(?:(?: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])$/,u2=/^(([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]))$/,p2=/^(([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])$/,i2=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,d2=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,o2=new RegExp(`^${$$}$`);x=class x extends K{_parse($){if(this._def.coerce)$.data=String($.data);if(this._getType($)!==V.string){let H=this._getOrReturnCtx($);return A(H,{code:D.invalid_type,expected:V.string,received:H.parsedType}),U}let W=new E,Q=void 0;for(let H of this._def.checks)if(H.kind==="min"){if($.data.length<H.value)Q=this._getOrReturnCtx($,Q),A(Q,{code:D.too_small,minimum:H.value,type:"string",inclusive:!0,exact:!1,message:H.message}),W.dirty()}else if(H.kind==="max"){if($.data.length>H.value)Q=this._getOrReturnCtx($,Q),A(Q,{code:D.too_big,maximum:H.value,type:"string",inclusive:!0,exact:!1,message:H.message}),W.dirty()}else if(H.kind==="length"){let Y=$.data.length>H.value,G=$.data.length<H.value;if(Y||G){if(Q=this._getOrReturnCtx($,Q),Y)A(Q,{code:D.too_big,maximum:H.value,type:"string",inclusive:!0,exact:!0,message:H.message});else if(G)A(Q,{code:D.too_small,minimum:H.value,type:"string",inclusive:!0,exact:!0,message:H.message});W.dirty()}}else if(H.kind==="email"){if(!m2.test($.data))Q=this._getOrReturnCtx($,Q),A(Q,{validation:"email",code:D.invalid_string,message:H.message}),W.dirty()}else if(H.kind==="emoji"){if(!S1)S1=new RegExp(l2,"u");if(!S1.test($.data))Q=this._getOrReturnCtx($,Q),A(Q,{validation:"emoji",code:D.invalid_string,message:H.message}),W.dirty()}else if(H.kind==="uuid"){if(!x2.test($.data))Q=this._getOrReturnCtx($,Q),A(Q,{validation:"uuid",code:D.invalid_string,message:H.message}),W.dirty()}else if(H.kind==="nanoid"){if(!h2.test($.data))Q=this._getOrReturnCtx($,Q),A(Q,{validation:"nanoid",code:D.invalid_string,message:H.message}),W.dirty()}else if(H.kind==="cuid"){if(!f2.test($.data))Q=this._getOrReturnCtx($,Q),A(Q,{validation:"cuid",code:D.invalid_string,message:H.message}),W.dirty()}else if(H.kind==="cuid2"){if(!T2.test($.data))Q=this._getOrReturnCtx($,Q),A(Q,{validation:"cuid2",code:D.invalid_string,message:H.message}),W.dirty()}else if(H.kind==="ulid"){if(!g2.test($.data))Q=this._getOrReturnCtx($,Q),A(Q,{validation:"ulid",code:D.invalid_string,message:H.message}),W.dirty()}else if(H.kind==="url")try{new URL($.data)}catch(Y){Q=this._getOrReturnCtx($,Q),A(Q,{validation:"url",code:D.invalid_string,message:H.message}),W.dirty()}else if(H.kind==="regex"){if(H.regex.lastIndex=0,!H.regex.test($.data))Q=this._getOrReturnCtx($,Q),A(Q,{validation:"regex",code:D.invalid_string,message:H.message}),W.dirty()}else if(H.kind==="trim")$.data=$.data.trim();else if(H.kind==="includes"){if(!$.data.includes(H.value,H.position))Q=this._getOrReturnCtx($,Q),A(Q,{code:D.invalid_string,validation:{includes:H.value,position:H.position},message:H.message}),W.dirty()}else if(H.kind==="toLowerCase")$.data=$.data.toLowerCase();else if(H.kind==="toUpperCase")$.data=$.data.toUpperCase();else if(H.kind==="startsWith"){if(!$.data.startsWith(H.value))Q=this._getOrReturnCtx($,Q),A(Q,{code:D.invalid_string,validation:{startsWith:H.value},message:H.message}),W.dirty()}else if(H.kind==="endsWith"){if(!$.data.endsWith(H.value))Q=this._getOrReturnCtx($,Q),A(Q,{code:D.invalid_string,validation:{endsWith:H.value},message:H.message}),W.dirty()}else if(H.kind==="datetime"){if(!W$(H).test($.data))Q=this._getOrReturnCtx($,Q),A(Q,{code:D.invalid_string,validation:"datetime",message:H.message}),W.dirty()}else if(H.kind==="date"){if(!o2.test($.data))Q=this._getOrReturnCtx($,Q),A(Q,{code:D.invalid_string,validation:"date",message:H.message}),W.dirty()}else if(H.kind==="time"){if(!r2(H).test($.data))Q=this._getOrReturnCtx($,Q),A(Q,{code:D.invalid_string,validation:"time",message:H.message}),W.dirty()}else if(H.kind==="duration"){if(!Z2.test($.data))Q=this._getOrReturnCtx($,Q),A(Q,{validation:"duration",code:D.invalid_string,message:H.message}),W.dirty()}else if(H.kind==="ip"){if(!a2($.data,H.version))Q=this._getOrReturnCtx($,Q),A(Q,{validation:"ip",code:D.invalid_string,message:H.message}),W.dirty()}else if(H.kind==="jwt"){if(!t2($.data,H.alg))Q=this._getOrReturnCtx($,Q),A(Q,{validation:"jwt",code:D.invalid_string,message:H.message}),W.dirty()}else if(H.kind==="cidr"){if(!s2($.data,H.version))Q=this._getOrReturnCtx($,Q),A(Q,{validation:"cidr",code:D.invalid_string,message:H.message}),W.dirty()}else if(H.kind==="base64"){if(!i2.test($.data))Q=this._getOrReturnCtx($,Q),A(Q,{validation:"base64",code:D.invalid_string,message:H.message}),W.dirty()}else if(H.kind==="base64url"){if(!d2.test($.data))Q=this._getOrReturnCtx($,Q),A(Q,{validation:"base64url",code:D.invalid_string,message:H.message}),W.dirty()}else F.assertNever(H);return{status:W.value,value:$.data}}_regex($,X,W){return this.refinement((Q)=>$.test(Q),{validation:X,code:D.invalid_string,...j.errToObj(W)})}_addCheck($){return new x({...this._def,checks:[...this._def.checks,$]})}email($){return this._addCheck({kind:"email",...j.errToObj($)})}url($){return this._addCheck({kind:"url",...j.errToObj($)})}emoji($){return this._addCheck({kind:"emoji",...j.errToObj($)})}uuid($){return this._addCheck({kind:"uuid",...j.errToObj($)})}nanoid($){return this._addCheck({kind:"nanoid",...j.errToObj($)})}cuid($){return this._addCheck({kind:"cuid",...j.errToObj($)})}cuid2($){return this._addCheck({kind:"cuid2",...j.errToObj($)})}ulid($){return this._addCheck({kind:"ulid",...j.errToObj($)})}base64($){return this._addCheck({kind:"base64",...j.errToObj($)})}base64url($){return this._addCheck({kind:"base64url",...j.errToObj($)})}jwt($){return this._addCheck({kind:"jwt",...j.errToObj($)})}ip($){return this._addCheck({kind:"ip",...j.errToObj($)})}cidr($){return this._addCheck({kind:"cidr",...j.errToObj($)})}datetime($){var X,W;if(typeof $==="string")return this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:$});return this._addCheck({kind:"datetime",precision:typeof($===null||$===void 0?void 0:$.precision)==="undefined"?null:$===null||$===void 0?void 0:$.precision,offset:(X=$===null||$===void 0?void 0:$.offset)!==null&&X!==void 0?X:!1,local:(W=$===null||$===void 0?void 0:$.local)!==null&&W!==void 0?W:!1,...j.errToObj($===null||$===void 0?void 0:$.message)})}date($){return this._addCheck({kind:"date",message:$})}time($){if(typeof $==="string")return this._addCheck({kind:"time",precision:null,message:$});return this._addCheck({kind:"time",precision:typeof($===null||$===void 0?void 0:$.precision)==="undefined"?null:$===null||$===void 0?void 0:$.precision,...j.errToObj($===null||$===void 0?void 0:$.message)})}duration($){return this._addCheck({kind:"duration",...j.errToObj($)})}regex($,X){return this._addCheck({kind:"regex",regex:$,...j.errToObj(X)})}includes($,X){return this._addCheck({kind:"includes",value:$,position:X===null||X===void 0?void 0:X.position,...j.errToObj(X===null||X===void 0?void 0:X.message)})}startsWith($,X){return this._addCheck({kind:"startsWith",value:$,...j.errToObj(X)})}endsWith($,X){return this._addCheck({kind:"endsWith",value:$,...j.errToObj(X)})}min($,X){return this._addCheck({kind:"min",value:$,...j.errToObj(X)})}max($,X){return this._addCheck({kind:"max",value:$,...j.errToObj(X)})}length($,X){return this._addCheck({kind:"length",value:$,...j.errToObj(X)})}nonempty($){return this.min(1,j.errToObj($))}trim(){return new x({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new x({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new x({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(($)=>$.kind==="datetime")}get isDate(){return!!this._def.checks.find(($)=>$.kind==="date")}get isTime(){return!!this._def.checks.find(($)=>$.kind==="time")}get isDuration(){return!!this._def.checks.find(($)=>$.kind==="duration")}get isEmail(){return!!this._def.checks.find(($)=>$.kind==="email")}get isURL(){return!!this._def.checks.find(($)=>$.kind==="url")}get isEmoji(){return!!this._def.checks.find(($)=>$.kind==="emoji")}get isUUID(){return!!this._def.checks.find(($)=>$.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(($)=>$.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(($)=>$.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(($)=>$.kind==="cuid2")}get isULID(){return!!this._def.checks.find(($)=>$.kind==="ulid")}get isIP(){return!!this._def.checks.find(($)=>$.kind==="ip")}get isCIDR(){return!!this._def.checks.find(($)=>$.kind==="cidr")}get isBase64(){return!!this._def.checks.find(($)=>$.kind==="base64")}get isBase64url(){return!!this._def.checks.find(($)=>$.kind==="base64url")}get minLength(){let $=null;for(let X of this._def.checks)if(X.kind==="min"){if($===null||X.value>$)$=X.value}return $}get maxLength(){let $=null;for(let X of this._def.checks)if(X.kind==="max"){if($===null||X.value<$)$=X.value}return $}};x.create=($)=>{var X;return new x({checks:[],typeName:z.ZodString,coerce:(X=$===null||$===void 0?void 0:$.coerce)!==null&&X!==void 0?X:!1,...N($)})};$0=class $0 extends K{constructor(){super(...arguments);this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse($){if(this._def.coerce)$.data=Number($.data);if(this._getType($)!==V.number){let H=this._getOrReturnCtx($);return A(H,{code:D.invalid_type,expected:V.number,received:H.parsedType}),U}let W=void 0,Q=new E;for(let H of this._def.checks)if(H.kind==="int"){if(!F.isInteger($.data))W=this._getOrReturnCtx($,W),A(W,{code:D.invalid_type,expected:"integer",received:"float",message:H.message}),Q.dirty()}else if(H.kind==="min"){if(H.inclusive?$.data<H.value:$.data<=H.value)W=this._getOrReturnCtx($,W),A(W,{code:D.too_small,minimum:H.value,type:"number",inclusive:H.inclusive,exact:!1,message:H.message}),Q.dirty()}else if(H.kind==="max"){if(H.inclusive?$.data>H.value:$.data>=H.value)W=this._getOrReturnCtx($,W),A(W,{code:D.too_big,maximum:H.value,type:"number",inclusive:H.inclusive,exact:!1,message:H.message}),Q.dirty()}else if(H.kind==="multipleOf"){if(e2($.data,H.value)!==0)W=this._getOrReturnCtx($,W),A(W,{code:D.not_multiple_of,multipleOf:H.value,message:H.message}),Q.dirty()}else if(H.kind==="finite"){if(!Number.isFinite($.data))W=this._getOrReturnCtx($,W),A(W,{code:D.not_finite,message:H.message}),Q.dirty()}else F.assertNever(H);return{status:Q.value,value:$.data}}gte($,X){return this.setLimit("min",$,!0,j.toString(X))}gt($,X){return this.setLimit("min",$,!1,j.toString(X))}lte($,X){return this.setLimit("max",$,!0,j.toString(X))}lt($,X){return this.setLimit("max",$,!1,j.toString(X))}setLimit($,X,W,Q){return new $0({...this._def,checks:[...this._def.checks,{kind:$,value:X,inclusive:W,message:j.toString(Q)}]})}_addCheck($){return new $0({...this._def,checks:[...this._def.checks,$]})}int($){return this._addCheck({kind:"int",message:j.toString($)})}positive($){return this._addCheck({kind:"min",value:0,inclusive:!1,message:j.toString($)})}negative($){return this._addCheck({kind:"max",value:0,inclusive:!1,message:j.toString($)})}nonpositive($){return this._addCheck({kind:"max",value:0,inclusive:!0,message:j.toString($)})}nonnegative($){return this._addCheck({kind:"min",value:0,inclusive:!0,message:j.toString($)})}multipleOf($,X){return this._addCheck({kind:"multipleOf",value:$,message:j.toString(X)})}finite($){return this._addCheck({kind:"finite",message:j.toString($)})}safe($){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:j.toString($)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:j.toString($)})}get minValue(){let $=null;for(let X of this._def.checks)if(X.kind==="min"){if($===null||X.value>$)$=X.value}return $}get maxValue(){let $=null;for(let X of this._def.checks)if(X.kind==="max"){if($===null||X.value<$)$=X.value}return $}get isInt(){return!!this._def.checks.find(($)=>$.kind==="int"||$.kind==="multipleOf"&&F.isInteger($.value))}get isFinite(){let $=null,X=null;for(let W of this._def.checks)if(W.kind==="finite"||W.kind==="int"||W.kind==="multipleOf")return!0;else if(W.kind==="min"){if(X===null||W.value>X)X=W.value}else if(W.kind==="max"){if($===null||W.value<$)$=W.value}return Number.isFinite(X)&&Number.isFinite($)}};$0.create=($)=>{return new $0({checks:[],typeName:z.ZodNumber,coerce:($===null||$===void 0?void 0:$.coerce)||!1,...N($)})};X0=class X0 extends K{constructor(){super(...arguments);this.min=this.gte,this.max=this.lte}_parse($){if(this._def.coerce)try{$.data=BigInt($.data)}catch(H){return this._getInvalidInput($)}if(this._getType($)!==V.bigint)return this._getInvalidInput($);let W=void 0,Q=new E;for(let H of this._def.checks)if(H.kind==="min"){if(H.inclusive?$.data<H.value:$.data<=H.value)W=this._getOrReturnCtx($,W),A(W,{code:D.too_small,type:"bigint",minimum:H.value,inclusive:H.inclusive,message:H.message}),Q.dirty()}else if(H.kind==="max"){if(H.inclusive?$.data>H.value:$.data>=H.value)W=this._getOrReturnCtx($,W),A(W,{code:D.too_big,type:"bigint",maximum:H.value,inclusive:H.inclusive,message:H.message}),Q.dirty()}else if(H.kind==="multipleOf"){if($.data%H.value!==BigInt(0))W=this._getOrReturnCtx($,W),A(W,{code:D.not_multiple_of,multipleOf:H.value,message:H.message}),Q.dirty()}else F.assertNever(H);return{status:Q.value,value:$.data}}_getInvalidInput($){let X=this._getOrReturnCtx($);return A(X,{code:D.invalid_type,expected:V.bigint,received:X.parsedType}),U}gte($,X){return this.setLimit("min",$,!0,j.toString(X))}gt($,X){return this.setLimit("min",$,!1,j.toString(X))}lte($,X){return this.setLimit("max",$,!0,j.toString(X))}lt($,X){return this.setLimit("max",$,!1,j.toString(X))}setLimit($,X,W,Q){return new X0({...this._def,checks:[...this._def.checks,{kind:$,value:X,inclusive:W,message:j.toString(Q)}]})}_addCheck($){return new X0({...this._def,checks:[...this._def.checks,$]})}positive($){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:j.toString($)})}negative($){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:j.toString($)})}nonpositive($){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:j.toString($)})}nonnegative($){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:j.toString($)})}multipleOf($,X){return this._addCheck({kind:"multipleOf",value:$,message:j.toString(X)})}get minValue(){let $=null;for(let X of this._def.checks)if(X.kind==="min"){if($===null||X.value>$)$=X.value}return $}get maxValue(){let $=null;for(let X of this._def.checks)if(X.kind==="max"){if($===null||X.value<$)$=X.value}return $}};X0.create=($)=>{var X;return new X0({checks:[],typeName:z.ZodBigInt,coerce:(X=$===null||$===void 0?void 0:$.coerce)!==null&&X!==void 0?X:!1,...N($)})};j0=class j0 extends K{_parse($){if(this._def.coerce)$.data=Boolean($.data);if(this._getType($)!==V.boolean){let W=this._getOrReturnCtx($);return A(W,{code:D.invalid_type,expected:V.boolean,received:W.parsedType}),U}return v($.data)}};j0.create=($)=>{return new j0({typeName:z.ZodBoolean,coerce:($===null||$===void 0?void 0:$.coerce)||!1,...N($)})};Y0=class Y0 extends K{_parse($){if(this._def.coerce)$.data=new Date($.data);if(this._getType($)!==V.date){let H=this._getOrReturnCtx($);return A(H,{code:D.invalid_type,expected:V.date,received:H.parsedType}),U}if(isNaN($.data.getTime())){let H=this._getOrReturnCtx($);return A(H,{code:D.invalid_date}),U}let W=new E,Q=void 0;for(let H of this._def.checks)if(H.kind==="min"){if($.data.getTime()<H.value)Q=this._getOrReturnCtx($,Q),A(Q,{code:D.too_small,message:H.message,inclusive:!0,exact:!1,minimum:H.value,type:"date"}),W.dirty()}else if(H.kind==="max"){if($.data.getTime()>H.value)Q=this._getOrReturnCtx($,Q),A(Q,{code:D.too_big,message:H.message,inclusive:!0,exact:!1,maximum:H.value,type:"date"}),W.dirty()}else F.assertNever(H);return{status:W.value,value:new Date($.data.getTime())}}_addCheck($){return new Y0({...this._def,checks:[...this._def.checks,$]})}min($,X){return this._addCheck({kind:"min",value:$.getTime(),message:j.toString(X)})}max($,X){return this._addCheck({kind:"max",value:$.getTime(),message:j.toString(X)})}get minDate(){let $=null;for(let X of this._def.checks)if(X.kind==="min"){if($===null||X.value>$)$=X.value}return $!=null?new Date($):null}get maxDate(){let $=null;for(let X of this._def.checks)if(X.kind==="max"){if($===null||X.value<$)$=X.value}return $!=null?new Date($):null}};Y0.create=($)=>{return new Y0({checks:[],coerce:($===null||$===void 0?void 0:$.coerce)||!1,typeName:z.ZodDate,...N($)})};C0=class C0 extends K{_parse($){if(this._getType($)!==V.symbol){let W=this._getOrReturnCtx($);return A(W,{code:D.invalid_type,expected:V.symbol,received:W.parsedType}),U}return v($.data)}};C0.create=($)=>{return new C0({typeName:z.ZodSymbol,...N($)})};q0=class q0 extends K{_parse($){if(this._getType($)!==V.undefined){let W=this._getOrReturnCtx($);return A(W,{code:D.invalid_type,expected:V.undefined,received:W.parsedType}),U}return v($.data)}};q0.create=($)=>{return new q0({typeName:z.ZodUndefined,...N($)})};O0=class O0 extends K{_parse($){if(this._getType($)!==V.null){let W=this._getOrReturnCtx($);return A(W,{code:D.invalid_type,expected:V.null,received:W.parsedType}),U}return v($.data)}};O0.create=($)=>{return new O0({typeName:z.ZodNull,...N($)})};G0=class G0 extends K{constructor(){super(...arguments);this._any=!0}_parse($){return v($.data)}};G0.create=($)=>{return new G0({typeName:z.ZodAny,...N($)})};e=class e extends K{constructor(){super(...arguments);this._unknown=!0}_parse($){return v($.data)}};e.create=($)=>{return new e({typeName:z.ZodUnknown,...N($)})};p=class p extends K{_parse($){let X=this._getOrReturnCtx($);return A(X,{code:D.invalid_type,expected:V.never,received:X.parsedType}),U}};p.create=($)=>{return new p({typeName:z.ZodNever,...N($)})};I0=class I0 extends K{_parse($){if(this._getType($)!==V.undefined){let W=this._getOrReturnCtx($);return A(W,{code:D.invalid_type,expected:V.void,received:W.parsedType}),U}return v($.data)}};I0.create=($)=>{return new I0({typeName:z.ZodVoid,...N($)})};h=class h extends K{_parse($){let{ctx:X,status:W}=this._processInputParams($),Q=this._def;if(X.parsedType!==V.array)return A(X,{code:D.invalid_type,expected:V.array,received:X.parsedType}),U;if(Q.exactLength!==null){let Y=X.data.length>Q.exactLength.value,G=X.data.length<Q.exactLength.value;if(Y||G)A(X,{code:Y?D.too_big:D.too_small,minimum:G?Q.exactLength.value:void 0,maximum:Y?Q.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:Q.exactLength.message}),W.dirty()}if(Q.minLength!==null){if(X.data.length<Q.minLength.value)A(X,{code:D.too_small,minimum:Q.minLength.value,type:"array",inclusive:!0,exact:!1,message:Q.minLength.message}),W.dirty()}if(Q.maxLength!==null){if(X.data.length>Q.maxLength.value)A(X,{code:D.too_big,maximum:Q.maxLength.value,type:"array",inclusive:!0,exact:!1,message:Q.maxLength.message}),W.dirty()}if(X.common.async)return Promise.all([...X.data].map((Y,G)=>{return Q.type._parseAsync(new y(X,Y,X.path,G))})).then((Y)=>{return E.mergeArray(W,Y)});let H=[...X.data].map((Y,G)=>{return Q.type._parseSync(new y(X,Y,X.path,G))});return E.mergeArray(W,H)}get element(){return this._def.type}min($,X){return new h({...this._def,minLength:{value:$,message:j.toString(X)}})}max($,X){return new h({...this._def,maxLength:{value:$,message:j.toString(X)}})}length($,X){return new h({...this._def,exactLength:{value:$,message:j.toString(X)}})}nonempty($){return this.min(1,$)}};h.create=($,X)=>{return new h({type:$,minLength:null,maxLength:null,exactLength:null,typeName:z.ZodArray,...N(X)})};S=class S extends K{constructor(){super(...arguments);this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let $=this._def.shape(),X=F.objectKeys($);return this._cached={shape:$,keys:X}}_parse($){if(this._getType($)!==V.object){let w=this._getOrReturnCtx($);return A(w,{code:D.invalid_type,expected:V.object,received:w.parsedType}),U}let{status:W,ctx:Q}=this._processInputParams($),{shape:H,keys:Y}=this._getCached(),G=[];if(!(this._def.catchall instanceof p&&this._def.unknownKeys==="strip")){for(let w in Q.data)if(!Y.includes(w))G.push(w)}let B=[];for(let w of Y){let M=H[w],q=Q.data[w];B.push({key:{status:"valid",value:w},value:M._parse(new y(Q,q,Q.path,w)),alwaysSet:w in Q.data})}if(this._def.catchall instanceof p){let w=this._def.unknownKeys;if(w==="passthrough")for(let M of G)B.push({key:{status:"valid",value:M},value:{status:"valid",value:Q.data[M]}});else if(w==="strict"){if(G.length>0)A(Q,{code:D.unrecognized_keys,keys:G}),W.dirty()}else if(w==="strip");else throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let w=this._def.catchall;for(let M of G){let q=Q.data[M];B.push({key:{status:"valid",value:M},value:w._parse(new y(Q,q,Q.path,M)),alwaysSet:M in Q.data})}}if(Q.common.async)return Promise.resolve().then(async()=>{let w=[];for(let M of B){let q=await M.key,b=await M.value;w.push({key:q,value:b,alwaysSet:M.alwaysSet})}return w}).then((w)=>{return E.mergeObjectSync(W,w)});else return E.mergeObjectSync(W,B)}get shape(){return this._def.shape()}strict($){return j.errToObj,new S({...this._def,unknownKeys:"strict",...$!==void 0?{errorMap:(X,W)=>{var Q,H,Y,G;let B=(Y=(H=(Q=this._def).errorMap)===null||H===void 0?void 0:H.call(Q,X,W).message)!==null&&Y!==void 0?Y:W.defaultError;if(X.code==="unrecognized_keys")return{message:(G=j.errToObj($).message)!==null&&G!==void 0?G:B};return{message:B}}}:{}})}strip(){return new S({...this._def,unknownKeys:"strip"})}passthrough(){return new S({...this._def,unknownKeys:"passthrough"})}extend($){return new S({...this._def,shape:()=>({...this._def.shape(),...$})})}merge($){return new S({unknownKeys:$._def.unknownKeys,catchall:$._def.catchall,shape:()=>({...this._def.shape(),...$._def.shape()}),typeName:z.ZodObject})}setKey($,X){return this.augment({[$]:X})}catchall($){return new S({...this._def,catchall:$})}pick($){let X={};return F.objectKeys($).forEach((W)=>{if($[W]&&this.shape[W])X[W]=this.shape[W]}),new S({...this._def,shape:()=>X})}omit($){let X={};return F.objectKeys(this.shape).forEach((W)=>{if(!$[W])X[W]=this.shape[W]}),new S({...this._def,shape:()=>X})}deepPartial(){return z0(this)}partial($){let X={};return F.objectKeys(this.shape).forEach((W)=>{let Q=this.shape[W];if($&&!$[W])X[W]=Q;else X[W]=Q.optional()}),new S({...this._def,shape:()=>X})}required($){let X={};return F.objectKeys(this.shape).forEach((W)=>{if($&&!$[W])X[W]=this.shape[W];else{let H=this.shape[W];while(H instanceof I)H=H._def.innerType;X[W]=H}}),new S({...this._def,shape:()=>X})}keyof(){return Q$(F.objectKeys(this.shape))}};S.create=($,X)=>{return new S({shape:()=>$,unknownKeys:"strip",catchall:p.create(),typeName:z.ZodObject,...N(X)})};S.strictCreate=($,X)=>{return new S({shape:()=>$,unknownKeys:"strict",catchall:p.create(),typeName:z.ZodObject,...N(X)})};S.lazycreate=($,X)=>{return new S({shape:$,unknownKeys:"strip",catchall:p.create(),typeName:z.ZodObject,...N(X)})};U0=class U0 extends K{_parse($){let{ctx:X}=this._processInputParams($),W=this._def.options;function Q(H){for(let G of H)if(G.result.status==="valid")return G.result;for(let G of H)if(G.result.status==="dirty")return X.common.issues.push(...G.ctx.common.issues),G.result;let Y=H.map((G)=>new C(G.ctx.common.issues));return A(X,{code:D.invalid_union,unionErrors:Y}),U}if(X.common.async)return Promise.all(W.map(async(H)=>{let Y={...X,common:{...X.common,issues:[]},parent:null};return{result:await H._parseAsync({data:X.data,path:X.path,parent:Y}),ctx:Y}})).then(Q);else{let H=void 0,Y=[];for(let B of W){let w={...X,common:{...X.common,issues:[]},parent:null},M=B._parseSync({data:X.data,path:X.path,parent:w});if(M.status==="valid")return M;else if(M.status==="dirty"&&!H)H={result:M,ctx:w};if(w.common.issues.length)Y.push(w.common.issues)}if(H)return X.common.issues.push(...H.ctx.common.issues),H.result;let G=Y.map((B)=>new C(B));return A(X,{code:D.invalid_union,unionErrors:G}),U}}get options(){return this._def.options}};U0.create=($,X)=>{return new U0({options:$,typeName:z.ZodUnion,...N(X)})};d0=class d0 extends K{_parse($){let{ctx:X}=this._processInputParams($);if(X.parsedType!==V.object)return A(X,{code:D.invalid_type,expected:V.object,received:X.parsedType}),U;let W=this.discriminator,Q=X.data[W],H=this.optionsMap.get(Q);if(!H)return A(X,{code:D.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[W]}),U;if(X.common.async)return H._parseAsync({data:X.data,path:X.path,parent:X});else return H._parseSync({data:X.data,path:X.path,parent:X})}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create($,X,W){let Q=new Map;for(let H of X){let Y=a(H.shape[$]);if(!Y.length)throw new Error(`A discriminator value for key \`${$}\` could not be extracted from all schema options`);for(let G of Y){if(Q.has(G))throw new Error(`Discriminator property ${String($)} has duplicate value ${String(G)}`);Q.set(G,H)}}return new d0({typeName:z.ZodDiscriminatedUnion,discriminator:$,options:X,optionsMap:Q,...N(W)})}};K0=class K0 extends K{_parse($){let{status:X,ctx:W}=this._processInputParams($),Q=(H,Y)=>{if(R1(H)||R1(Y))return U;let G=b1(H.value,Y.value);if(!G.valid)return A(W,{code:D.invalid_intersection_types}),U;if(E1(H)||E1(Y))X.dirty();return{status:X.value,value:G.data}};if(W.common.async)return Promise.all([this._def.left._parseAsync({data:W.data,path:W.path,parent:W}),this._def.right._parseAsync({data:W.data,path:W.path,parent:W})]).then(([H,Y])=>Q(H,Y));else return Q(this._def.left._parseSync({data:W.data,path:W.path,parent:W}),this._def.right._parseSync({data:W.data,path:W.path,parent:W}))}};K0.create=($,X,W)=>{return new K0({left:$,right:X,typeName:z.ZodIntersection,...N(W)})};i=class i extends K{_parse($){let{status:X,ctx:W}=this._processInputParams($);if(W.parsedType!==V.array)return A(W,{code:D.invalid_type,expected:V.array,received:W.parsedType}),U;if(W.data.length<this._def.items.length)return A(W,{code:D.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),U;if(!this._def.rest&&W.data.length>this._def.items.length)A(W,{code:D.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),X.dirty();let H=[...W.data].map((Y,G)=>{let B=this._def.items[G]||this._def.rest;if(!B)return null;return B._parse(new y(W,Y,W.path,G))}).filter((Y)=>!!Y);if(W.common.async)return Promise.all(H).then((Y)=>{return E.mergeArray(X,Y)});else return E.mergeArray(X,H)}get items(){return this._def.items}rest($){return new i({...this._def,rest:$})}};i.create=($,X)=>{if(!Array.isArray($))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new i({items:$,typeName:z.ZodTuple,rest:null,...N(X)})};P0=class P0 extends K{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse($){let{status:X,ctx:W}=this._processInputParams($);if(W.parsedType!==V.object)return A(W,{code:D.invalid_type,expected:V.object,received:W.parsedType}),U;let Q=[],H=this._def.keyType,Y=this._def.valueType;for(let G in W.data)Q.push({key:H._parse(new y(W,G,W.path,G)),value:Y._parse(new y(W,W.data[G],W.path,G)),alwaysSet:G in W.data});if(W.common.async)return E.mergeObjectAsync(X,Q);else return E.mergeObjectSync(X,Q)}get element(){return this._def.valueType}static create($,X,W){if(X instanceof K)return new P0({keyType:$,valueType:X,typeName:z.ZodRecord,...N(W)});return new P0({keyType:x.create(),valueType:$,typeName:z.ZodRecord,...N(X)})}};f0=class f0 extends K{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse($){let{status:X,ctx:W}=this._processInputParams($);if(W.parsedType!==V.map)return A(W,{code:D.invalid_type,expected:V.map,received:W.parsedType}),U;let Q=this._def.keyType,H=this._def.valueType,Y=[...W.data.entries()].map(([G,B],w)=>{return{key:Q._parse(new y(W,G,W.path,[w,"key"])),value:H._parse(new y(W,B,W.path,[w,"value"]))}});if(W.common.async){let G=new Map;return Promise.resolve().then(async()=>{for(let B of Y){let w=await B.key,M=await B.value;if(w.status==="aborted"||M.status==="aborted")return U;if(w.status==="dirty"||M.status==="dirty")X.dirty();G.set(w.value,M.value)}return{status:X.value,value:G}})}else{let G=new Map;for(let B of Y){let{key:w,value:M}=B;if(w.status==="aborted"||M.status==="aborted")return U;if(w.status==="dirty"||M.status==="dirty")X.dirty();G.set(w.value,M.value)}return{status:X.value,value:G}}}};f0.create=($,X,W)=>{return new f0({valueType:X,keyType:$,typeName:z.ZodMap,...N(W)})};B0=class B0 extends K{_parse($){let{status:X,ctx:W}=this._processInputParams($);if(W.parsedType!==V.set)return A(W,{code:D.invalid_type,expected:V.set,received:W.parsedType}),U;let Q=this._def;if(Q.minSize!==null){if(W.data.size<Q.minSize.value)A(W,{code:D.too_small,minimum:Q.minSize.value,type:"set",inclusive:!0,exact:!1,message:Q.minSize.message}),X.dirty()}if(Q.maxSize!==null){if(W.data.size>Q.maxSize.value)A(W,{code:D.too_big,maximum:Q.maxSize.value,type:"set",inclusive:!0,exact:!1,message:Q.maxSize.message}),X.dirty()}let H=this._def.valueType;function Y(B){let w=new Set;for(let M of B){if(M.status==="aborted")return U;if(M.status==="dirty")X.dirty();w.add(M.value)}return{status:X.value,value:w}}let G=[...W.data.values()].map((B,w)=>H._parse(new y(W,B,W.path,w)));if(W.common.async)return Promise.all(G).then((B)=>Y(B));else return Y(G)}min($,X){return new B0({...this._def,minSize:{value:$,message:j.toString(X)}})}max($,X){return new B0({...this._def,maxSize:{value:$,message:j.toString(X)}})}size($,X){return this.min($,X).max($,X)}nonempty($){return this.min(1,$)}};B0.create=($,X)=>{return new B0({valueType:$,minSize:null,maxSize:null,typeName:z.ZodSet,...N(X)})};A0=class A0 extends K{constructor(){super(...arguments);this.validate=this.implement}_parse($){let{ctx:X}=this._processInputParams($);if(X.parsedType!==V.function)return A(X,{code:D.invalid_type,expected:V.function,received:X.parsedType}),U;function W(G,B){return p0({data:G,path:X.path,errorMaps:[X.common.contextualErrorMap,X.schemaErrorMap,u0(),V0].filter((w)=>!!w),issueData:{code:D.invalid_arguments,argumentsError:B}})}function Q(G,B){return p0({data:G,path:X.path,errorMaps:[X.common.contextualErrorMap,X.schemaErrorMap,u0(),V0].filter((w)=>!!w),issueData:{code:D.invalid_return_type,returnTypeError:B}})}let H={errorMap:X.common.contextualErrorMap},Y=X.data;if(this._def.returns instanceof w0){let G=this;return v(async function(...B){let w=new C([]),M=await G._def.args.parseAsync(B,H).catch((r)=>{throw w.addIssue(W(B,r)),w}),q=await Reflect.apply(Y,this,M);return await G._def.returns._def.type.parseAsync(q,H).catch((r)=>{throw w.addIssue(Q(q,r)),w})})}else{let G=this;return v(function(...B){let w=G._def.args.safeParse(B,H);if(!w.success)throw new C([W(B,w.error)]);let M=Reflect.apply(Y,this,w.data),q=G._def.returns.safeParse(M,H);if(!q.success)throw new C([Q(M,q.error)]);return q.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...$){return new A0({...this._def,args:i.create($).rest(e.create())})}returns($){return new A0({...this._def,returns:$})}implement($){return this.parse($)}strictImplement($){return this.parse($)}static create($,X,W){return new A0({args:$?$:i.create([]).rest(e.create()),returns:X||e.create(),typeName:z.ZodFunction,...N(W)})}};N0=class N0 extends K{get schema(){return this._def.getter()}_parse($){let{ctx:X}=this._processInputParams($);return this._def.getter()._parse({data:X.data,path:X.path,parent:X})}};N0.create=($,X)=>{return new N0({getter:$,typeName:z.ZodLazy,...N(X)})};L0=class L0 extends K{_parse($){if($.data!==this._def.value){let X=this._getOrReturnCtx($);return A(X,{received:X.data,code:D.invalid_literal,expected:this._def.value}),U}return{status:"valid",value:$.data}}get value(){return this._def.value}};L0.create=($,X)=>{return new L0({value:$,typeName:z.ZodLiteral,...N(X)})};W0=class W0 extends K{constructor(){super(...arguments);b0.set(this,void 0)}_parse($){if(typeof $.data!=="string"){let X=this._getOrReturnCtx($),W=this._def.values;return A(X,{expected:F.joinValues(W),received:X.parsedType,code:D.invalid_type}),U}if(!i0(this,b0,"f"))e1(this,b0,new Set(this._def.values),"f");if(!i0(this,b0,"f").has($.data)){let X=this._getOrReturnCtx($),W=this._def.values;return A(X,{received:X.data,code:D.invalid_enum_value,options:W}),U}return v($.data)}get options(){return this._def.values}get enum(){let $={};for(let X of this._def.values)$[X]=X;return $}get Values(){let $={};for(let X of this._def.values)$[X]=X;return $}get Enum(){let $={};for(let X of this._def.values)$[X]=X;return $}extract($,X=this._def){return W0.create($,{...this._def,...X})}exclude($,X=this._def){return W0.create(this.options.filter((W)=>!$.includes(W)),{...this._def,...X})}};b0=new WeakMap;W0.create=Q$;F0=class F0 extends K{constructor(){super(...arguments);v0.set(this,void 0)}_parse($){let X=F.getValidEnumValues(this._def.values),W=this._getOrReturnCtx($);if(W.parsedType!==V.string&&W.parsedType!==V.number){let Q=F.objectValues(X);return A(W,{expected:F.joinValues(Q),received:W.parsedType,code:D.invalid_type}),U}if(!i0(this,v0,"f"))e1(this,v0,new Set(F.getValidEnumValues(this._def.values)),"f");if(!i0(this,v0,"f").has($.data)){let Q=F.objectValues(X);return A(W,{received:W.data,code:D.invalid_enum_value,options:Q}),U}return v($.data)}get enum(){return this._def.values}};v0=new WeakMap;F0.create=($,X)=>{return new F0({values:$,typeName:z.ZodNativeEnum,...N(X)})};w0=class w0 extends K{unwrap(){return this._def.type}_parse($){let{ctx:X}=this._processInputParams($);if(X.parsedType!==V.promise&&X.common.async===!1)return A(X,{code:D.invalid_type,expected:V.promise,received:X.parsedType}),U;let W=X.parsedType===V.promise?X.data:Promise.resolve(X.data);return v(W.then((Q)=>{return this._def.type.parseAsync(Q,{path:X.path,errorMap:X.common.contextualErrorMap})}))}};w0.create=($,X)=>{return new w0({type:$,typeName:z.ZodPromise,...N(X)})};T=class T extends K{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===z.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse($){let{status:X,ctx:W}=this._processInputParams($),Q=this._def.effect||null,H={addIssue:(Y)=>{if(A(W,Y),Y.fatal)X.abort();else X.dirty()},get path(){return W.path}};if(H.addIssue=H.addIssue.bind(H),Q.type==="preprocess"){let Y=Q.transform(W.data,H);if(W.common.async)return Promise.resolve(Y).then(async(G)=>{if(X.value==="aborted")return U;let B=await this._def.schema._parseAsync({data:G,path:W.path,parent:W});if(B.status==="aborted")return U;if(B.status==="dirty")return M0(B.value);if(X.value==="dirty")return M0(B.value);return B});else{if(X.value==="aborted")return U;let G=this._def.schema._parseSync({data:Y,path:W.path,parent:W});if(G.status==="aborted")return U;if(G.status==="dirty")return M0(G.value);if(X.value==="dirty")return M0(G.value);return G}}if(Q.type==="refinement"){let Y=(G)=>{let B=Q.refinement(G,H);if(W.common.async)return Promise.resolve(B);if(B instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return G};if(W.common.async===!1){let G=this._def.schema._parseSync({data:W.data,path:W.path,parent:W});if(G.status==="aborted")return U;if(G.status==="dirty")X.dirty();return Y(G.value),{status:X.value,value:G.value}}else return this._def.schema._parseAsync({data:W.data,path:W.path,parent:W}).then((G)=>{if(G.status==="aborted")return U;if(G.status==="dirty")X.dirty();return Y(G.value).then(()=>{return{status:X.value,value:G.value}})})}if(Q.type==="transform")if(W.common.async===!1){let Y=this._def.schema._parseSync({data:W.data,path:W.path,parent:W});if(!J0(Y))return Y;let G=Q.transform(Y.value,H);if(G instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:X.value,value:G}}else return this._def.schema._parseAsync({data:W.data,path:W.path,parent:W}).then((Y)=>{if(!J0(Y))return Y;return Promise.resolve(Q.transform(Y.value,H)).then((G)=>({status:X.value,value:G}))});F.assertNever(Q)}};T.create=($,X,W)=>{return new T({schema:$,typeName:z.ZodEffects,effect:X,...N(W)})};T.createWithPreprocess=($,X,W)=>{return new T({schema:X,effect:{type:"preprocess",transform:$},typeName:z.ZodEffects,...N(W)})};I=class I extends K{_parse($){if(this._getType($)===V.undefined)return v(void 0);return this._def.innerType._parse($)}unwrap(){return this._def.innerType}};I.create=($,X)=>{return new I({innerType:$,typeName:z.ZodOptional,...N(X)})};s=class s extends K{_parse($){if(this._getType($)===V.null)return v(null);return this._def.innerType._parse($)}unwrap(){return this._def.innerType}};s.create=($,X)=>{return new s({innerType:$,typeName:z.ZodNullable,...N(X)})};S0=class S0 extends K{_parse($){let{ctx:X}=this._processInputParams($),W=X.data;if(X.parsedType===V.undefined)W=this._def.defaultValue();return this._def.innerType._parse({data:W,path:X.path,parent:X})}removeDefault(){return this._def.innerType}};S0.create=($,X)=>{return new S0({innerType:$,typeName:z.ZodDefault,defaultValue:typeof X.default==="function"?X.default:()=>X.default,...N(X)})};_0=class _0 extends K{_parse($){let{ctx:X}=this._processInputParams($),W={...X,common:{...X.common,issues:[]}},Q=this._def.innerType._parse({data:W.data,path:W.path,parent:{...W}});if(k0(Q))return Q.then((H)=>{return{status:"valid",value:H.status==="valid"?H.value:this._def.catchValue({get error(){return new C(W.common.issues)},input:W.data})}});else return{status:"valid",value:Q.status==="valid"?Q.value:this._def.catchValue({get error(){return new C(W.common.issues)},input:W.data})}}removeCatch(){return this._def.innerType}};_0.create=($,X)=>{return new _0({innerType:$,typeName:z.ZodCatch,catchValue:typeof X.catch==="function"?X.catch:()=>X.catch,...N(X)})};T0=class T0 extends K{_parse($){if(this._getType($)!==V.nan){let W=this._getOrReturnCtx($);return A(W,{code:D.invalid_type,expected:V.nan,received:W.parsedType}),U}return{status:"valid",value:$.data}}};T0.create=($)=>{return new T0({typeName:z.ZodNaN,...N($)})};$4=Symbol("zod_brand");o0=class o0 extends K{_parse($){let{ctx:X}=this._processInputParams($),W=X.data;return this._def.type._parse({data:W,path:X.path,parent:X})}unwrap(){return this._def.type}};g0=class g0 extends K{_parse($){let{status:X,ctx:W}=this._processInputParams($);if(W.common.async)return(async()=>{let H=await this._def.in._parseAsync({data:W.data,path:W.path,parent:W});if(H.status==="aborted")return U;if(H.status==="dirty")return X.dirty(),M0(H.value);else return this._def.out._parseAsync({data:H.value,path:W.path,parent:W})})();else{let Q=this._def.in._parseSync({data:W.data,path:W.path,parent:W});if(Q.status==="aborted")return U;if(Q.status==="dirty")return X.dirty(),{status:"dirty",value:Q.value};else return this._def.out._parseSync({data:Q.value,path:W.path,parent:W})}}static create($,X){return new g0({in:$,out:X,typeName:z.ZodPipeline})}};R0=class R0 extends K{_parse($){let X=this._def.innerType._parse($),W=(Q)=>{if(J0(Q))Q.value=Object.freeze(Q.value);return Q};return k0(X)?X.then((Q)=>W(Q)):W(X)}unwrap(){return this._def.innerType}};R0.create=($,X)=>{return new R0({innerType:$,typeName:z.ZodReadonly,...N(X)})};X4={object:S.lazycreate};(function($){$.ZodString="ZodString",$.ZodNumber="ZodNumber",$.ZodNaN="ZodNaN",$.ZodBigInt="ZodBigInt",$.ZodBoolean="ZodBoolean",$.ZodDate="ZodDate",$.ZodSymbol="ZodSymbol",$.ZodUndefined="ZodUndefined",$.ZodNull="ZodNull",$.ZodAny="ZodAny",$.ZodUnknown="ZodUnknown",$.ZodNever="ZodNever",$.ZodVoid="ZodVoid",$.ZodArray="ZodArray",$.ZodObject="ZodObject",$.ZodUnion="ZodUnion",$.ZodDiscriminatedUnion="ZodDiscriminatedUnion",$.ZodIntersection="ZodIntersection",$.ZodTuple="ZodTuple",$.ZodRecord="ZodRecord",$.ZodMap="ZodMap",$.ZodSet="ZodSet",$.ZodFunction="ZodFunction",$.ZodLazy="ZodLazy",$.ZodLiteral="ZodLiteral",$.ZodEnum="ZodEnum",$.ZodEffects="ZodEffects",$.ZodNativeEnum="ZodNativeEnum",$.ZodOptional="ZodOptional",$.ZodNullable="ZodNullable",$.ZodDefault="ZodDefault",$.ZodCatch="ZodCatch",$.ZodPromise="ZodPromise",$.ZodBranded="ZodBranded",$.ZodPipeline="ZodPipeline",$.ZodReadonly="ZodReadonly"})(z||(z={}));J$=x.create,Y$=$0.create,Q4=T0.create,H4=X0.create,G$=j0.create,J4=Y0.create,Y4=C0.create,G4=q0.create,B4=O0.create,w4=G0.create,D4=e.create,z4=p.create,M4=I0.create,A4=h.create,V4=S.create,j4=S.strictCreate,q4=U0.create,O4=d0.create,U4=K0.create,K4=i.create,N4=P0.create,L4=f0.create,F4=B0.create,S4=A0.create,_4=N0.create,R4=L0.create,E4=W0.create,b4=F0.create,v4=w0.create,t1=T.create,k4=I.create,C4=s.create,I4=T.createWithPreprocess,P4=g0.create,x4={string:($)=>x.create({...$,coerce:!0}),number:($)=>$0.create({...$,coerce:!0}),boolean:($)=>j0.create({...$,coerce:!0}),bigint:($)=>X0.create({...$,coerce:!0}),date:($)=>Y0.create({...$,coerce:!0})},h4=U,J=Object.freeze({__proto__:null,defaultErrorMap:V0,setErrorMap:I2,getErrorMap:u0,makeIssue:p0,EMPTY_PATH:P2,addIssueToContext:A,ParseStatus:E,INVALID:U,DIRTY:M0,OK:v,isAborted:R1,isDirty:E1,isValid:J0,isAsync:k0,get util(){return F},get objectUtil(){return _1},ZodParsedType:V,getParsedType:t,ZodType:K,datetimeRegex:W$,ZodString:x,ZodNumber:$0,ZodBigInt:X0,ZodBoolean:j0,ZodDate:Y0,ZodSymbol:C0,ZodUndefined:q0,ZodNull:O0,ZodAny:G0,ZodUnknown:e,ZodNever:p,ZodVoid:I0,ZodArray:h,ZodObject:S,ZodUnion:U0,ZodDiscriminatedUnion:d0,ZodIntersection:K0,ZodTuple:i,ZodRecord:P0,ZodMap:f0,ZodSet:B0,ZodFunction:A0,ZodLazy:N0,ZodLiteral:L0,ZodEnum:W0,ZodNativeEnum:F0,ZodPromise:w0,ZodEffects:T,ZodTransformer:T,ZodOptional:I,ZodNullable:s,ZodDefault:S0,ZodCatch:_0,ZodNaN:T0,BRAND:$4,ZodBranded:o0,ZodPipeline:g0,ZodReadonly:R0,custom:H$,Schema:K,ZodSchema:K,late:X4,get ZodFirstPartyTypeKind(){return z},coerce:x4,any:w4,array:A4,bigint:H4,boolean:G$,date:J4,discriminatedUnion:O4,effect:t1,enum:E4,function:S4,instanceof:W4,intersection:U4,lazy:_4,literal:R4,map:L4,nan:Q4,nativeEnum:b4,never:z4,null:B4,nullable:C4,number:Y$,object:V4,oboolean:g4,onumber:T4,optional:k4,ostring:f4,pipeline:P4,preprocess:I4,promise:v4,record:N4,set:F4,strictObject:j4,string:J$,symbol:Y4,transformer:t1,tuple:K4,undefined:G4,union:q4,unknown:D4,void:M4,NEVER:h4,ZodIssueCode:D,quotelessJson:C2,ZodError:C})});var v1="2025-03-26",B$,r0="2.0",w$,D$,y4,Z,P,x0,o,m,a0,z$,M$=($)=>z$.safeParse($).success,A$,V$=($)=>A$.safeParse($).success,j$,k1=($)=>j$.safeParse($).success,_,q$,O$=($)=>q$.safeParse($).success,U$,t0,s0,K$,Z4,e0,i6=($)=>e0.safeParse($).success,m4,l4,C1,$1,n4,X1,W1,Q1,N$,L$,F$,c4,u4,H1,p4,J1,i4,Y1,d4,o4,r4,a4,t4,s4,e4,G1,$6,B1,w1,D1,z1,S$,X6,W6,Q6,H6,J6,M1,Y6,_$,d6,A1,G6,R$,B6,w6,D6,z6,M6,A6,I1,V6,j6,V1,q6,O6,U6,P1,K6,o6,r6,a6,t6,s6,e6,R;var h0=F1(()=>{d();B$=[v1,"2024-11-05","2024-10-07"],w$=J.union([J.string(),J.number().int()]),D$=J.string(),y4=J.object({progressToken:J.optional(w$)}).passthrough(),Z=J.object({_meta:J.optional(y4)}).passthrough(),P=J.object({method:J.string(),params:J.optional(Z)}),x0=J.object({_meta:J.optional(J.object({}).passthrough())}).passthrough(),o=J.object({method:J.string(),params:J.optional(x0)}),m=J.object({_meta:J.optional(J.object({}).passthrough())}).passthrough(),a0=J.union([J.string(),J.number().int()]),z$=J.object({jsonrpc:J.literal(r0),id:a0}).merge(P).strict(),A$=J.object({jsonrpc:J.literal(r0)}).merge(o).strict(),j$=J.object({jsonrpc:J.literal(r0),id:a0,result:m}).strict();(function($){$[$.ConnectionClosed=-32000]="ConnectionClosed",$[$.RequestTimeout=-32001]="RequestTimeout",$[$.ParseError=-32700]="ParseError",$[$.InvalidRequest=-32600]="InvalidRequest",$[$.MethodNotFound=-32601]="MethodNotFound",$[$.InvalidParams=-32602]="InvalidParams",$[$.InternalError=-32603]="InternalError"})(_||(_={}));q$=J.object({jsonrpc:J.literal(r0),id:a0,error:J.object({code:J.number().int(),message:J.string(),data:J.optional(J.unknown())})}).strict(),U$=J.union([z$,A$,j$,q$]),t0=m.strict(),s0=o.extend({method:J.literal("notifications/cancelled"),params:x0.extend({requestId:a0,reason:J.string().optional()})}),K$=J.object({name:J.string(),version:J.string()}).passthrough(),Z4=J.object({experimental:J.optional(J.object({}).passthrough()),sampling:J.optional(J.object({}).passthrough()),roots:J.optional(J.object({listChanged:J.optional(J.boolean())}).passthrough())}).passthrough(),e0=P.extend({method:J.literal("initialize"),params:Z.extend({protocolVersion:J.string(),capabilities:Z4,clientInfo:K$})}),m4=J.object({experimental:J.optional(J.object({}).passthrough()),logging:J.optional(J.object({}).passthrough()),completions:J.optional(J.object({}).passthrough()),prompts:J.optional(J.object({listChanged:J.optional(J.boolean())}).passthrough()),resources:J.optional(J.object({subscribe:J.optional(J.boolean()),listChanged:J.optional(J.boolean())}).passthrough()),tools:J.optional(J.object({listChanged:J.optional(J.boolean())}).passthrough())}).passthrough(),l4=m.extend({protocolVersion:J.string(),capabilities:m4,serverInfo:K$,instructions:J.optional(J.string())}),C1=o.extend({method:J.literal("notifications/initialized")}),$1=P.extend({method:J.literal("ping")}),n4=J.object({progress:J.number(),total:J.optional(J.number()),message:J.optional(J.string())}).passthrough(),X1=o.extend({method:J.literal("notifications/progress"),params:x0.merge(n4).extend({progressToken:w$})}),W1=P.extend({params:Z.extend({cursor:J.optional(D$)}).optional()}),Q1=m.extend({nextCursor:J.optional(D$)}),N$=J.object({uri:J.string(),mimeType:J.optional(J.string())}).passthrough(),L$=N$.extend({text:J.string()}),F$=N$.extend({blob:J.string().base64()}),c4=J.object({uri:J.string(),name:J.string(),description:J.optional(J.string()),mimeType:J.optional(J.string())}).passthrough(),u4=J.object({uriTemplate:J.string(),name:J.string(),description:J.optional(J.string()),mimeType:J.optional(J.string())}).passthrough(),H1=W1.extend({method:J.literal("resources/list")}),p4=Q1.extend({resources:J.array(c4)}),J1=W1.extend({method:J.literal("resources/templates/list")}),i4=Q1.extend({resourceTemplates:J.array(u4)}),Y1=P.extend({method:J.literal("resources/read"),params:Z.extend({uri:J.string()})}),d4=m.extend({contents:J.array(J.union([L$,F$]))}),o4=o.extend({method:J.literal("notifications/resources/list_changed")}),r4=P.extend({method:J.literal("resources/subscribe"),params:Z.extend({uri:J.string()})}),a4=P.extend({method:J.literal("resources/unsubscribe"),params:Z.extend({uri:J.string()})}),t4=o.extend({method:J.literal("notifications/resources/updated"),params:x0.extend({uri:J.string()})}),s4=J.object({name:J.string(),description:J.optional(J.string()),required:J.optional(J.boolean())}).passthrough(),e4=J.object({name:J.string(),description:J.optional(J.string()),arguments:J.optional(J.array(s4))}).passthrough(),G1=W1.extend({method:J.literal("prompts/list")}),$6=Q1.extend({prompts:J.array(e4)}),B1=P.extend({method:J.literal("prompts/get"),params:Z.extend({name:J.string(),arguments:J.optional(J.record(J.string()))})}),w1=J.object({type:J.literal("text"),text:J.string()}).passthrough(),D1=J.object({type:J.literal("image"),data:J.string().base64(),mimeType:J.string()}).passthrough(),z1=J.object({type:J.literal("audio"),data:J.string().base64(),mimeType:J.string()}).passthrough(),S$=J.object({type:J.literal("resource"),resource:J.union([L$,F$])}).passthrough(),X6=J.object({role:J.enum(["user","assistant"]),content:J.union([w1,D1,z1,S$])}).passthrough(),W6=m.extend({description:J.optional(J.string()),messages:J.array(X6)}),Q6=o.extend({method:J.literal("notifications/prompts/list_changed")}),H6=J.object({title:J.optional(J.string()),readOnlyHint:J.optional(J.boolean()),destructiveHint:J.optional(J.boolean()),idempotentHint:J.optional(J.boolean()),openWorldHint:J.optional(J.boolean())}).passthrough(),J6=J.object({name:J.string(),description:J.optional(J.string()),inputSchema:J.object({type:J.literal("object"),properties:J.optional(J.object({}).passthrough()),required:J.optional(J.array(J.string()))}).passthrough(),outputSchema:J.optional(J.object({type:J.literal("object"),properties:J.optional(J.object({}).passthrough()),required:J.optional(J.array(J.string()))}).passthrough()),annotations:J.optional(H6)}).passthrough(),M1=W1.extend({method:J.literal("tools/list")}),Y6=Q1.extend({tools:J.array(J6)}),_$=m.extend({content:J.array(J.union([w1,D1,z1,S$])).default([]),structuredContent:J.object({}).passthrough().optional(),isError:J.optional(J.boolean())}),d6=_$.or(m.extend({toolResult:J.unknown()})),A1=P.extend({method:J.literal("tools/call"),params:Z.extend({name:J.string(),arguments:J.optional(J.record(J.unknown()))})}),G6=o.extend({method:J.literal("notifications/tools/list_changed")}),R$=J.enum(["debug","info","notice","warning","error","critical","alert","emergency"]),B6=P.extend({method:J.literal("logging/setLevel"),params:Z.extend({level:R$})}),w6=o.extend({method:J.literal("notifications/message"),params:x0.extend({level:R$,logger:J.optional(J.string()),data:J.unknown()})}),D6=J.object({name:J.string().optional()}).passthrough(),z6=J.object({hints:J.optional(J.array(D6)),costPriority:J.optional(J.number().min(0).max(1)),speedPriority:J.optional(J.number().min(0).max(1)),intelligencePriority:J.optional(J.number().min(0).max(1))}).passthrough(),M6=J.object({role:J.enum(["user","assistant"]),content:J.union([w1,D1,z1])}).passthrough(),A6=P.extend({method:J.literal("sampling/createMessage"),params:Z.extend({messages:J.array(M6),systemPrompt:J.optional(J.string()),includeContext:J.optional(J.enum(["none","thisServer","allServers"])),temperature:J.optional(J.number()),maxTokens:J.number().int(),stopSequences:J.optional(J.array(J.string())),metadata:J.optional(J.object({}).passthrough()),modelPreferences:J.optional(z6)})}),I1=m.extend({model:J.string(),stopReason:J.optional(J.enum(["endTurn","stopSequence","maxTokens"]).or(J.string())),role:J.enum(["user","assistant"]),content:J.discriminatedUnion("type",[w1,D1,z1])}),V6=J.object({type:J.literal("ref/resource"),uri:J.string()}).passthrough(),j6=J.object({type:J.literal("ref/prompt"),name:J.string()}).passthrough(),V1=P.extend({method:J.literal("completion/complete"),params:Z.extend({ref:J.union([j6,V6]),argument:J.object({name:J.string(),value:J.string()}).passthrough()})}),q6=m.extend({completion:J.object({values:J.array(J.string()).max(100),total:J.optional(J.number().int()),hasMore:J.optional(J.boolean())}).passthrough()}),O6=J.object({uri:J.string().startsWith("file://"),name:J.optional(J.string())}).passthrough(),U6=P.extend({method:J.literal("roots/list")}),P1=m.extend({roots:J.array(O6)}),K6=o.extend({method:J.literal("notifications/roots/list_changed")}),o6=J.union([$1,e0,V1,B6,B1,G1,H1,J1,Y1,r4,a4,A1,M1]),r6=J.union([s0,X1,C1,K6]),a6=J.union([t0,I1,P1]),t6=J.union([$1,A6,U6]),s6=J.union([s0,X1,w6,t4,o4,G6,Q6]),e6=J.union([t0,l4,q6,W6,$6,p4,i4,d4,_$,Y6]);R=class R extends Error{constructor($,X,W){super(`MCP error ${$}: ${X}`);this.code=$,this.data=W,this.name="McpError"}}});function T6(){let $=process.argv.join(" ");return $.includes("streamable-http.js")||$.includes("streamable-http.ts")}class D2{context;level;constructor($,X=1){this.context=$,this.level=X}setLevel($){this.level=$}log(...$){if(w2)console.log(...$);else console.error(...$)}logWarn(...$){if(w2)console.warn(...$);else console.error(...$)}debug(...$){if(this.level<=0)this.log(`[DEBUG] [${this.context}]`,...$)}info(...$){if(this.level<=1)this.log(`[INFO] [${this.context}]`,...$)}warn(...$){if(this.level<=2)this.logWarn(`[WARN] [${this.context}]`,...$)}error(...$){if(this.level<=3)console.error(`[ERROR] [${this.context}]`,...$)}}var w2,g=($,X=1)=>new D2($,X);var D0=F1(()=>{w2=T6()});h0();var N6=60000;class f1{constructor($){this._options=$,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(s0,(X)=>{let W=this._requestHandlerAbortControllers.get(X.params.requestId);W===null||W===void 0||W.abort(X.params.reason)}),this.setNotificationHandler(X1,(X)=>{this._onprogress(X)}),this.setRequestHandler($1,(X)=>({}))}_setupTimeout($,X,W,Q,H=!1){this._timeoutInfo.set($,{timeoutId:setTimeout(Q,X),startTime:Date.now(),timeout:X,maxTotalTimeout:W,resetTimeoutOnProgress:H,onTimeout:Q})}_resetTimeout($){let X=this._timeoutInfo.get($);if(!X)return!1;let W=Date.now()-X.startTime;if(X.maxTotalTimeout&&W>=X.maxTotalTimeout)throw this._timeoutInfo.delete($),new R(_.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:X.maxTotalTimeout,totalElapsed:W});return clearTimeout(X.timeoutId),X.timeoutId=setTimeout(X.onTimeout,X.timeout),!0}_cleanupTimeout($){let X=this._timeoutInfo.get($);if(X)clearTimeout(X.timeoutId),this._timeoutInfo.delete($)}async connect($){this._transport=$,this._transport.onclose=()=>{this._onclose()},this._transport.onerror=(X)=>{this._onerror(X)},this._transport.onmessage=(X,W)=>{if(k1(X)||O$(X))this._onresponse(X);else if(M$(X))this._onrequest(X,W);else if(V$(X))this._onnotification(X);else this._onerror(new Error(`Unknown message type: ${JSON.stringify(X)}`))},await this._transport.start()}_onclose(){var $;let X=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._transport=void 0,($=this.onclose)===null||$===void 0||$.call(this);let W=new R(_.ConnectionClosed,"Connection closed");for(let Q of X.values())Q(W)}_onerror($){var X;(X=this.onerror)===null||X===void 0||X.call(this,$)}_onnotification($){var X;let W=(X=this._notificationHandlers.get($.method))!==null&&X!==void 0?X:this.fallbackNotificationHandler;if(W===void 0)return;Promise.resolve().then(()=>W($)).catch((Q)=>this._onerror(new Error(`Uncaught error in notification handler: ${Q}`)))}_onrequest($,X){var W,Q,H,Y;let G=(W=this._requestHandlers.get($.method))!==null&&W!==void 0?W:this.fallbackRequestHandler;if(G===void 0){(Q=this._transport)===null||Q===void 0||Q.send({jsonrpc:"2.0",id:$.id,error:{code:_.MethodNotFound,message:"Method not found"}}).catch((M)=>this._onerror(new Error(`Failed to send an error response: ${M}`)));return}let B=new AbortController;this._requestHandlerAbortControllers.set($.id,B);let w={signal:B.signal,sessionId:(H=this._transport)===null||H===void 0?void 0:H.sessionId,_meta:(Y=$.params)===null||Y===void 0?void 0:Y._meta,sendNotification:(M)=>this.notification(M,{relatedRequestId:$.id}),sendRequest:(M,q,b)=>this.request(M,q,{...b,relatedRequestId:$.id}),authInfo:X===null||X===void 0?void 0:X.authInfo,requestId:$.id};Promise.resolve().then(()=>G($,w)).then((M)=>{var q;if(B.signal.aborted)return;return(q=this._transport)===null||q===void 0?void 0:q.send({result:M,jsonrpc:"2.0",id:$.id})},(M)=>{var q,b;if(B.signal.aborted)return;return(q=this._transport)===null||q===void 0?void 0:q.send({jsonrpc:"2.0",id:$.id,error:{code:Number.isSafeInteger(M.code)?M.code:_.InternalError,message:(b=M.message)!==null&&b!==void 0?b:"Internal error"}})}).catch((M)=>this._onerror(new Error(`Failed to send response: ${M}`))).finally(()=>{this._requestHandlerAbortControllers.delete($.id)})}_onprogress($){let{progressToken:X,...W}=$.params,Q=Number(X),H=this._progressHandlers.get(Q);if(!H){this._onerror(new Error(`Received a progress notification for an unknown token: ${JSON.stringify($)}`));return}let Y=this._responseHandlers.get(Q),G=this._timeoutInfo.get(Q);if(G&&Y&&G.resetTimeoutOnProgress)try{this._resetTimeout(Q)}catch(B){Y(B);return}H(W)}_onresponse($){let X=Number($.id),W=this._responseHandlers.get(X);if(W===void 0){this._onerror(new Error(`Received a response for an unknown message ID: ${JSON.stringify($)}`));return}if(this._responseHandlers.delete(X),this._progressHandlers.delete(X),this._cleanupTimeout(X),k1($))W($);else{let Q=new R($.error.code,$.error.message,$.error.data);W(Q)}}get transport(){return this._transport}async close(){var $;await(($=this._transport)===null||$===void 0?void 0:$.close())}request($,X,W){let{relatedRequestId:Q,resumptionToken:H,onresumptiontoken:Y}=W!==null&&W!==void 0?W:{};return new Promise((G,B)=>{var w,M,q,b,r,N1;if(!this._transport){B(new Error("Not connected"));return}if(((w=this._options)===null||w===void 0?void 0:w.enforceStrictCapabilities)===!0)this.assertCapabilityForMethod($.method);(M=W===null||W===void 0?void 0:W.signal)===null||M===void 0||M.throwIfAborted();let u=this._requestMessageId++,i1={...$,jsonrpc:"2.0",id:u};if(W===null||W===void 0?void 0:W.onprogress)this._progressHandlers.set(u,W.onprogress),i1.params={...$.params,_meta:{...((q=$.params)===null||q===void 0?void 0:q._meta)||{},progressToken:u}};let d1=(f)=>{var H0;this._responseHandlers.delete(u),this._progressHandlers.delete(u),this._cleanupTimeout(u),(H0=this._transport)===null||H0===void 0||H0.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:u,reason:String(f)}},{relatedRequestId:Q,resumptionToken:H,onresumptiontoken:Y}).catch((E0)=>this._onerror(new Error(`Failed to send cancellation: ${E0}`))),B(f)};this._responseHandlers.set(u,(f)=>{var H0;if((H0=W===null||W===void 0?void 0:W.signal)===null||H0===void 0?void 0:H0.aborted)return;if(f instanceof Error)return B(f);try{let E0=X.parse(f.result);G(E0)}catch(E0){B(E0)}}),(b=W===null||W===void 0?void 0:W.signal)===null||b===void 0||b.addEventListener("abort",()=>{var f;d1((f=W===null||W===void 0?void 0:W.signal)===null||f===void 0?void 0:f.reason)});let o1=(r=W===null||W===void 0?void 0:W.timeout)!==null&&r!==void 0?r:N6,R2=()=>d1(new R(_.RequestTimeout,"Request timed out",{timeout:o1}));this._setupTimeout(u,o1,W===null||W===void 0?void 0:W.maxTotalTimeout,R2,(N1=W===null||W===void 0?void 0:W.resetTimeoutOnProgress)!==null&&N1!==void 0?N1:!1),this._transport.send(i1,{relatedRequestId:Q,resumptionToken:H,onresumptiontoken:Y}).catch((f)=>{this._cleanupTimeout(u),B(f)})})}async notification($,X){if(!this._transport)throw new Error("Not connected");this.assertNotificationCapability($.method);let W={...$,jsonrpc:"2.0"};await this._transport.send(W,X)}setRequestHandler($,X){let W=$.shape.method.value;this.assertRequestHandlerCapability(W),this._requestHandlers.set(W,(Q,H)=>{return Promise.resolve(X($.parse(Q),H))})}removeRequestHandler($){this._requestHandlers.delete($)}assertCanSetRequestHandler($){if(this._requestHandlers.has($))throw new Error(`A request handler for ${$} already exists, which would be overridden`)}setNotificationHandler($,X){this._notificationHandlers.set($.shape.method.value,(W)=>Promise.resolve(X($.parse(W))))}removeNotificationHandler($){this._notificationHandlers.delete($)}}function E$($,X){return Object.entries(X).reduce((W,[Q,H])=>{if(H&&typeof H==="object")W[Q]=W[Q]?{...W[Q],...H}:H;else W[Q]=H;return W},{...$})}h0();class T1 extends f1{constructor($,X){var W;super(X);this._serverInfo=$,this._capabilities=(W=X===null||X===void 0?void 0:X.capabilities)!==null&&W!==void 0?W:{},this._instructions=X===null||X===void 0?void 0:X.instructions,this.setRequestHandler(e0,(Q)=>this._oninitialize(Q)),this.setNotificationHandler(C1,()=>{var Q;return(Q=this.oninitialized)===null||Q===void 0?void 0:Q.call(this)})}registerCapabilities($){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=E$(this._capabilities,$)}assertCapabilityForMethod($){var X,W;switch($){case"sampling/createMessage":if(!((X=this._clientCapabilities)===null||X===void 0?void 0:X.sampling))throw new Error(`Client does not support sampling (required for ${$})`);break;case"roots/list":if(!((W=this._clientCapabilities)===null||W===void 0?void 0:W.roots))throw new Error(`Client does not support listing roots (required for ${$})`);break;case"ping":break}}assertNotificationCapability($){switch($){case"notifications/message":if(!this._capabilities.logging)throw new Error(`Server does not support logging (required for ${$})`);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 ${$})`);break;case"notifications/tools/list_changed":if(!this._capabilities.tools)throw new Error(`Server does not support notifying of tool list changes (required for ${$})`);break;case"notifications/prompts/list_changed":if(!this._capabilities.prompts)throw new Error(`Server does not support notifying of prompt list changes (required for ${$})`);break;case"notifications/cancelled":break;case"notifications/progress":break}}assertRequestHandlerCapability($){switch($){case"sampling/createMessage":if(!this._capabilities.sampling)throw new Error(`Server does not support sampling (required for ${$})`);break;case"logging/setLevel":if(!this._capabilities.logging)throw new Error(`Server does not support logging (required for ${$})`);break;case"prompts/get":case"prompts/list":if(!this._capabilities.prompts)throw new Error(`Server does not support prompts (required for ${$})`);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 ${$})`);break;case"tools/call":case"tools/list":if(!this._capabilities.tools)throw new Error(`Server does not support tools (required for ${$})`);break;case"ping":case"initialize":break}}async _oninitialize($){let X=$.params.protocolVersion;return this._clientCapabilities=$.params.capabilities,this._clientVersion=$.params.clientInfo,{protocolVersion:B$.includes(X)?X:v1,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"},t0)}async createMessage($,X){return this.request({method:"sampling/createMessage",params:$},I1,X)}async listRoots($,X){return this.request({method:"roots/list",params:$},P1,X)}async sendLoggingMessage($){return this.notification({method:"notifications/message",params:$})}async sendResourceUpdated($){return this.notification({method:"notifications/resources/updated",params:$})}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 v$=Symbol("Let zodToJsonSchema decide on which parser to use");var b$={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"},k$=($)=>typeof $==="string"?{...b$,name:$}:{...b$,...$};var C$=($)=>{let X=k$($),W=X.name!==void 0?[...X.basePath,X.definitionPath,X.name]:X.basePath;return{...X,currentPath:W,propertyPath:void 0,seen:new Map(Object.entries(X.definitions).map(([Q,H])=>[H._def,{def:H._def,path:[...X.basePath,X.definitionPath,Q],jsonSchema:void 0}]))}};function g1($,X,W,Q){if(!Q?.errorMessages)return;if(W)$.errorMessage={...$.errorMessage,[X]:W}}function L($,X,W,Q,H){$[X]=W,g1($,X,Q,H)}d();function I$(){return{}}d();function P$($,X){let W={type:"array"};if($.type?._def&&$.type?._def?.typeName!==z.ZodAny)W.items=O($.type._def,{...X,currentPath:[...X.currentPath,"items"]});if($.minLength)L(W,"minItems",$.minLength.value,$.minLength.message,X);if($.maxLength)L(W,"maxItems",$.maxLength.value,$.maxLength.message,X);if($.exactLength)L(W,"minItems",$.exactLength.value,$.exactLength.message,X),L(W,"maxItems",$.exactLength.value,$.exactLength.message,X);return W}function f$($,X){let W={type:"integer",format:"int64"};if(!$.checks)return W;for(let Q of $.checks)switch(Q.kind){case"min":if(X.target==="jsonSchema7")if(Q.inclusive)L(W,"minimum",Q.value,Q.message,X);else L(W,"exclusiveMinimum",Q.value,Q.message,X);else{if(!Q.inclusive)W.exclusiveMinimum=!0;L(W,"minimum",Q.value,Q.message,X)}break;case"max":if(X.target==="jsonSchema7")if(Q.inclusive)L(W,"maximum",Q.value,Q.message,X);else L(W,"exclusiveMaximum",Q.value,Q.message,X);else{if(!Q.inclusive)W.exclusiveMaximum=!0;L(W,"maximum",Q.value,Q.message,X)}break;case"multipleOf":L(W,"multipleOf",Q.value,Q.message,X);break}return W}function T$(){return{type:"boolean"}}function j1($,X){return O($.type._def,X)}var g$=($,X)=>{return O($.innerType._def,X)};function x1($,X,W){let Q=W??X.dateStrategy;if(Array.isArray(Q))return{anyOf:Q.map((H,Y)=>x1($,X,H))};switch(Q){case"string":case"format:date-time":return{type:"string",format:"date-time"};case"format:date":return{type:"string",format:"date"};case"integer":return L6($,X)}}var L6=($,X)=>{let W={type:"integer",format:"unix-time"};if(X.target==="openApi3")return W;for(let Q of $.checks)switch(Q.kind){case"min":L(W,"minimum",Q.value,Q.message,X);break;case"max":L(W,"maximum",Q.value,Q.message,X);break}return W};function x$($,X){return{...O($.innerType._def,X),default:$.defaultValue()}}function h$($,X){return X.effectStrategy==="input"?O($.schema._def,X):{}}function y$($){return{type:"string",enum:Array.from($.values)}}var F6=($)=>{if("type"in $&&$.type==="string")return!1;return"allOf"in $};function Z$($,X){let W=[O($.left._def,{...X,currentPath:[...X.currentPath,"allOf","0"]}),O($.right._def,{...X,currentPath:[...X.currentPath,"allOf","1"]})].filter((Y)=>!!Y),Q=X.target==="jsonSchema2019-09"?{unevaluatedProperties:!1}:void 0,H=[];return W.forEach((Y)=>{if(F6(Y)){if(H.push(...Y.allOf),Y.unevaluatedProperties===void 0)Q=void 0}else{let G=Y;if("additionalProperties"in Y&&Y.additionalProperties===!1){let{additionalProperties:B,...w}=Y;G=w}else Q=void 0;H.push(G)}}),H.length?{allOf:H,...Q}:void 0}function m$($,X){let W=typeof $.value;if(W!=="bigint"&&W!=="number"&&W!=="boolean"&&W!=="string")return{type:Array.isArray($.value)?"array":"object"};if(X.target==="openApi3")return{type:W==="bigint"?"integer":W,enum:[$.value]};return{type:W==="bigint"?"integer":W,const:$.value}}d();var h1=void 0,l={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:()=>{if(h1===void 0)h1=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u");return h1},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 q1($,X){let W={type:"string"};if($.checks)for(let Q of $.checks)switch(Q.kind){case"min":L(W,"minLength",typeof W.minLength==="number"?Math.max(W.minLength,Q.value):Q.value,Q.message,X);break;case"max":L(W,"maxLength",typeof W.maxLength==="number"?Math.min(W.maxLength,Q.value):Q.value,Q.message,X);break;case"email":switch(X.emailStrategy){case"format:email":n(W,"email",Q.message,X);break;case"format:idn-email":n(W,"idn-email",Q.message,X);break;case"pattern:zod":k(W,l.email,Q.message,X);break}break;case"url":n(W,"uri",Q.message,X);break;case"uuid":n(W,"uuid",Q.message,X);break;case"regex":k(W,Q.regex,Q.message,X);break;case"cuid":k(W,l.cuid,Q.message,X);break;case"cuid2":k(W,l.cuid2,Q.message,X);break;case"startsWith":k(W,RegExp(`^${y1(Q.value,X)}`),Q.message,X);break;case"endsWith":k(W,RegExp(`${y1(Q.value,X)}$`),Q.message,X);break;case"datetime":n(W,"date-time",Q.message,X);break;case"date":n(W,"date",Q.message,X);break;case"time":n(W,"time",Q.message,X);break;case"duration":n(W,"duration",Q.message,X);break;case"length":L(W,"minLength",typeof W.minLength==="number"?Math.max(W.minLength,Q.value):Q.value,Q.message,X),L(W,"maxLength",typeof W.maxLength==="number"?Math.min(W.maxLength,Q.value):Q.value,Q.message,X);break;case"includes":{k(W,RegExp(y1(Q.value,X)),Q.message,X);break}case"ip":{if(Q.version!=="v6")n(W,"ipv4",Q.message,X);if(Q.version!=="v4")n(W,"ipv6",Q.message,X);break}case"base64url":k(W,l.base64url,Q.message,X);break;case"jwt":k(W,l.jwt,Q.message,X);break;case"cidr":{if(Q.version!=="v6")k(W,l.ipv4Cidr,Q.message,X);if(Q.version!=="v4")k(W,l.ipv6Cidr,Q.message,X);break}case"emoji":k(W,l.emoji(),Q.message,X);break;case"ulid":{k(W,l.ulid,Q.message,X);break}case"base64":{switch(X.base64Strategy){case"format:binary":{n(W,"binary",Q.message,X);break}case"contentEncoding:base64":{L(W,"contentEncoding","base64",Q.message,X);break}case"pattern:zod":{k(W,l.base64,Q.message,X);break}}break}case"nanoid":k(W,l.nanoid,Q.message,X);case"toLowerCase":case"toUpperCase":case"trim":break;default:((H)=>{})(Q)}return W}function y1($,X){return X.patternStrategy==="escape"?_6($):$}var S6=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function _6($){let X="";for(let W=0;W<$.length;W++){if(!S6.has($[W]))X+="\\";X+=$[W]}return X}function n($,X,W,Q){if($.format||$.anyOf?.some((H)=>H.format)){if(!$.anyOf)$.anyOf=[];if($.format){if($.anyOf.push({format:$.format,...$.errorMessage&&Q.errorMessages&&{errorMessage:{format:$.errorMessage.format}}}),delete $.format,$.errorMessage){if(delete $.errorMessage.format,Object.keys($.errorMessage).length===0)delete $.errorMessage}}$.anyOf.push({format:X,...W&&Q.errorMessages&&{errorMessage:{format:W}}})}else L($,"format",X,W,Q)}function k($,X,W,Q){if($.pattern||$.allOf?.some((H)=>H.pattern)){if(!$.allOf)$.allOf=[];if($.pattern){if($.allOf.push({pattern:$.pattern,...$.errorMessage&&Q.errorMessages&&{errorMessage:{pattern:$.errorMessage.pattern}}}),delete $.pattern,$.errorMessage){if(delete $.errorMessage.pattern,Object.keys($.errorMessage).length===0)delete $.errorMessage}}$.allOf.push({pattern:l$(X,Q),...W&&Q.errorMessages&&{errorMessage:{pattern:W}}})}else L($,"pattern",l$(X,Q),W,Q)}function l$($,X){if(!X.applyRegexFlags||!$.flags)return $.source;let W={i:$.flags.includes("i"),m:$.flags.includes("m"),s:$.flags.includes("s")},Q=W.i?$.source.toLowerCase():$.source,H="",Y=!1,G=!1,B=!1;for(let w=0;w<Q.length;w++){if(Y){H+=Q[w],Y=!1;continue}if(W.i){if(G){if(Q[w].match(/[a-z]/)){if(B)H+=Q[w],H+=`${Q[w-2]}-${Q[w]}`.toUpperCase(),B=!1;else if(Q[w+1]==="-"&&Q[w+2]?.match(/[a-z]/))H+=Q[w],B=!0;else H+=`${Q[w]}${Q[w].toUpperCase()}`;continue}}else if(Q[w].match(/[a-z]/)){H+=`[${Q[w]}${Q[w].toUpperCase()}]`;continue}}if(W.m){if(Q[w]==="^"){H+=`(^|(?<=[\r
|
2
|
+
var R3=Object.create;var{getPrototypeOf:E3,defineProperty:L2,getOwnPropertyNames:b3}=Object;var v3=Object.prototype.hasOwnProperty;var n0=($,X,W)=>{W=$!=null?R3(E3($)):{};let Q=X||!$||!$.__esModule?L2(W,"default",{value:$,enumerable:!0}):W;for(let H of b3($))if(!v3.call(Q,H))L2(Q,H,{get:()=>$[H],enumerable:!0});return Q};var m9=($,X)=>()=>(X||$((X={exports:{}}).exports,X),X.exports);var l9=($,X)=>{for(var W in X)L2($,W,{get:X[W],enumerable:!0,configurable:!0,set:(Q)=>X[W]=()=>Q})};var F2=($,X)=>()=>($&&(X=$($=0)),X);function C3($){s2=$}function c0(){return s2}function A($,X){let W=c0(),Q=u0({issueData:X,data:$.data,path:$.path,errorMaps:[$.common.contextualErrorMap,$.schemaErrorMap,W,W===V0?void 0:V0].filter((H)=>!!H)});$.common.issues.push(Q)}class E{constructor(){this.value="valid"}dirty(){if(this.value==="valid")this.value="dirty"}abort(){if(this.value!=="aborted")this.value="aborted"}static mergeArray($,X){let W=[];for(let Q of X){if(Q.status==="aborted")return U;if(Q.status==="dirty")$.dirty();W.push(Q.value)}return{status:$.value,value:W}}static async mergeObjectAsync($,X){let W=[];for(let Q of X){let H=await Q.key,Y=await Q.value;W.push({key:H,value:Y})}return E.mergeObjectSync($,W)}static mergeObjectSync($,X){let W={};for(let Q of X){let{key:H,value:Y}=Q;if(H.status==="aborted")return U;if(Y.status==="aborted")return U;if(H.status==="dirty")$.dirty();if(Y.status==="dirty")$.dirty();if(H.value!=="__proto__"&&(typeof Y.value!=="undefined"||Q.alwaysSet))W[H.value]=Y.value}return{status:$.value,value:W}}}function p0($,X,W,Q){if(W==="a"&&!Q)throw new TypeError("Private accessor was defined without a getter");if(typeof X==="function"?$!==X||!Q:!X.has($))throw new TypeError("Cannot read private member from an object whose class did not declare it");return W==="m"?Q:W==="a"?Q.call($):Q?Q.value:X.get($)}function e2($,X,W,Q,H){if(Q==="m")throw new TypeError("Private method is not writable");if(Q==="a"&&!H)throw new TypeError("Private accessor was defined without a setter");if(typeof X==="function"?$!==X||!H:!X.has($))throw new TypeError("Cannot write private member to an object whose class did not declare it");return Q==="a"?H.call($,W):H?H.value=W:X.set($,W),W}class y{constructor($,X,W,Q){this._cachedPath=[],this.parent=$,this.data=X,this._path=W,this._key=Q}get path(){if(!this._cachedPath.length)if(this._key instanceof Array)this._cachedPath.push(...this._path,...this._key);else this._cachedPath.push(...this._path,this._key);return this._cachedPath}}function N($){if(!$)return{};let{errorMap:X,invalid_type_error:W,required_error:Q,description:H}=$;if(X&&(W||Q))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);if(X)return{errorMap:X,description:H};return{errorMap:(G,B)=>{var w,M;let{message:q}=$;if(G.code==="invalid_enum_value")return{message:q!==null&&q!==void 0?q:B.defaultError};if(typeof B.data==="undefined")return{message:(w=q!==null&&q!==void 0?q:Q)!==null&&w!==void 0?w:B.defaultError};if(G.code!=="invalid_type")return{message:B.defaultError};return{message:(M=q!==null&&q!==void 0?q:W)!==null&&M!==void 0?M:B.defaultError}},description:H}}class K{get description(){return this._def.description}_getType($){return a($.data)}_getOrReturnCtx($,X){return X||{common:$.parent.common,data:$.data,parsedType:a($.data),schemaErrorMap:this._def.errorMap,path:$.path,parent:$.parent}}_processInputParams($){return{status:new E,ctx:{common:$.parent.common,data:$.data,parsedType:a($.data),schemaErrorMap:this._def.errorMap,path:$.path,parent:$.parent}}}_parseSync($){let X=this._parse($);if(k0(X))throw new Error("Synchronous parse encountered promise.");return X}_parseAsync($){let X=this._parse($);return Promise.resolve(X)}parse($,X){let W=this.safeParse($,X);if(W.success)return W.data;throw W.error}safeParse($,X){var W;let Q={common:{issues:[],async:(W=X===null||X===void 0?void 0:X.async)!==null&&W!==void 0?W:!1,contextualErrorMap:X===null||X===void 0?void 0:X.errorMap},path:(X===null||X===void 0?void 0:X.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:$,parsedType:a($)},H=this._parseSync({data:$,path:Q.path,parent:Q});return r2(Q,H)}"~validate"($){var X,W;let Q={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:$,parsedType:a($)};if(!this["~standard"].async)try{let H=this._parseSync({data:$,path:[],parent:Q});return J0(H)?{value:H.value}:{issues:Q.common.issues}}catch(H){if((W=(X=H===null||H===void 0?void 0:H.message)===null||X===void 0?void 0:X.toLowerCase())===null||W===void 0?void 0:W.includes("encountered"))this["~standard"].async=!0;Q.common={issues:[],async:!0}}return this._parseAsync({data:$,path:[],parent:Q}).then((H)=>J0(H)?{value:H.value}:{issues:Q.common.issues})}async parseAsync($,X){let W=await this.safeParseAsync($,X);if(W.success)return W.data;throw W.error}async safeParseAsync($,X){let W={common:{issues:[],contextualErrorMap:X===null||X===void 0?void 0:X.errorMap,async:!0},path:(X===null||X===void 0?void 0:X.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:$,parsedType:a($)},Q=this._parse({data:$,path:W.path,parent:W}),H=await(k0(Q)?Q:Promise.resolve(Q));return r2(W,H)}refine($,X){let W=(Q)=>{if(typeof X==="string"||typeof X==="undefined")return{message:X};else if(typeof X==="function")return X(Q);else return X};return this._refinement((Q,H)=>{let Y=$(Q),G=()=>H.addIssue({code:D.custom,...W(Q)});if(typeof Promise!=="undefined"&&Y instanceof Promise)return Y.then((B)=>{if(!B)return G(),!1;else return!0});if(!Y)return G(),!1;else return!0})}refinement($,X){return this._refinement((W,Q)=>{if(!$(W))return Q.addIssue(typeof X==="function"?X(W,Q):X),!1;else return!0})}_refinement($){return new T({schema:this,typeName:z.ZodEffects,effect:{type:"refinement",refinement:$}})}superRefine($){return this._refinement($)}constructor($){this.spa=this.safeParseAsync,this._def=$,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:(X)=>this["~validate"](X)}}optional(){return I.create(this,this._def)}nullable(){return t.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return h.create(this)}promise(){return w0.create(this,this._def)}or($){return U0.create([this,$],this._def)}and($){return K0.create(this,$,this._def)}transform($){return new T({...N(this._def),schema:this,typeName:z.ZodEffects,effect:{type:"transform",transform:$}})}default($){let X=typeof $==="function"?$:()=>$;return new S0({...N(this._def),innerType:this,defaultValue:X,typeName:z.ZodDefault})}brand(){return new d0({typeName:z.ZodBranded,type:this,...N(this._def)})}catch($){let X=typeof $==="function"?$:()=>$;return new _0({...N(this._def),innerType:this,catchValue:X,typeName:z.ZodCatch})}describe($){return new this.constructor({...this._def,description:$})}pipe($){return g0.create(this,$)}readonly(){return R0.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}function X1($){let X="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";if($.precision)X=`${X}\\.\\d{${$.precision}}`;else if($.precision==null)X=`${X}(\\.\\d+)?`;return X}function o3($){return new RegExp(`^${X1($)}$`)}function W1($){let X=`${$1}T${X1($)}`,W=[];if(W.push($.local?"Z?":"Z"),$.offset)W.push("([+-]\\d{2}:?\\d{2})");return X=`${X}(${W.join("|")})`,new RegExp(`^${X}$`)}function r3($,X){if((X==="v4"||!X)&&l3.test($))return!0;if((X==="v6"||!X)&&c3.test($))return!0;return!1}function a3($,X){if(!h3.test($))return!1;try{let[W]=$.split("."),Q=W.replace(/-/g,"+").replace(/_/g,"/").padEnd(W.length+(4-W.length%4)%4,"="),H=JSON.parse(atob(Q));if(typeof H!=="object"||H===null)return!1;if(!H.typ||!H.alg)return!1;if(X&&H.alg!==X)return!1;return!0}catch(W){return!1}}function t3($,X){if((X==="v4"||!X)&&n3.test($))return!0;if((X==="v6"||!X)&&u3.test($))return!0;return!1}function s3($,X){let W=($.toString().split(".")[1]||"").length,Q=(X.toString().split(".")[1]||"").length,H=W>Q?W:Q,Y=parseInt($.toFixed(H).replace(".","")),G=parseInt(X.toFixed(H).replace(".",""));return Y%G/Math.pow(10,H)}function z0($){if($ instanceof S){let X={};for(let W in $.shape){let Q=$.shape[W];X[W]=I.create(z0(Q))}return new S({...$._def,shape:()=>X})}else if($ instanceof h)return new h({...$._def,type:z0($.element)});else if($ instanceof I)return I.create(z0($.unwrap()));else if($ instanceof t)return t.create(z0($.unwrap()));else if($ instanceof i)return i.create($.items.map((X)=>z0(X)));else return $}function b2($,X){let W=a($),Q=a(X);if($===X)return{valid:!0,data:$};else if(W===V.object&&Q===V.object){let H=F.objectKeys(X),Y=F.objectKeys($).filter((B)=>H.indexOf(B)!==-1),G={...$,...X};for(let B of Y){let w=b2($[B],X[B]);if(!w.valid)return{valid:!1};G[B]=w.data}return{valid:!0,data:G}}else if(W===V.array&&Q===V.array){if($.length!==X.length)return{valid:!1};let H=[];for(let Y=0;Y<$.length;Y++){let G=$[Y],B=X[Y],w=b2(G,B);if(!w.valid)return{valid:!1};H.push(w.data)}return{valid:!0,data:H}}else if(W===V.date&&Q===V.date&&+$===+X)return{valid:!0,data:$};else return{valid:!1}}function Q1($,X){return new W0({values:$,typeName:z.ZodEnum,...N(X)})}function a2($,X){let W=typeof $==="function"?$(X):typeof $==="string"?{message:$}:$;return typeof W==="string"?{message:W}:W}function H1($,X={},W){if($)return G0.create().superRefine((Q,H)=>{var Y,G;let B=$(Q);if(B instanceof Promise)return B.then((w)=>{var M,q;if(!w){let b=a2(X,Q),o=(q=(M=b.fatal)!==null&&M!==void 0?M:W)!==null&&q!==void 0?q:!0;H.addIssue({code:"custom",...b,fatal:o})}});if(!B){let w=a2(X,Q),M=(G=(Y=w.fatal)!==null&&Y!==void 0?Y:W)!==null&&G!==void 0?G:!0;H.addIssue({code:"custom",...w,fatal:M})}return});return G0.create()}var F,_2,V,a=($)=>{switch(typeof $){case"undefined":return V.undefined;case"string":return V.string;case"number":return isNaN($)?V.nan:V.number;case"boolean":return V.boolean;case"function":return V.function;case"bigint":return V.bigint;case"symbol":return V.symbol;case"object":if(Array.isArray($))return V.array;if($===null)return V.null;if($.then&&typeof $.then==="function"&&$.catch&&typeof $.catch==="function")return V.promise;if(typeof Map!=="undefined"&&$ instanceof Map)return V.map;if(typeof Set!=="undefined"&&$ instanceof Set)return V.set;if(typeof Date!=="undefined"&&$ instanceof Date)return V.date;return V.object;default:return V.unknown}},D,k3=($)=>{return JSON.stringify($,null,2).replace(/"([^"]+)":/g,"$1:")},C,V0=($,X)=>{let W;switch($.code){case D.invalid_type:if($.received===V.undefined)W="Required";else W=`Expected ${$.expected}, received ${$.received}`;break;case D.invalid_literal:W=`Invalid literal value, expected ${JSON.stringify($.expected,F.jsonStringifyReplacer)}`;break;case D.unrecognized_keys:W=`Unrecognized key(s) in object: ${F.joinValues($.keys,", ")}`;break;case D.invalid_union:W="Invalid input";break;case D.invalid_union_discriminator:W=`Invalid discriminator value. Expected ${F.joinValues($.options)}`;break;case D.invalid_enum_value:W=`Invalid enum value. Expected ${F.joinValues($.options)}, received '${$.received}'`;break;case D.invalid_arguments:W="Invalid function arguments";break;case D.invalid_return_type:W="Invalid function return type";break;case D.invalid_date:W="Invalid date";break;case D.invalid_string:if(typeof $.validation==="object")if("includes"in $.validation){if(W=`Invalid input: must include "${$.validation.includes}"`,typeof $.validation.position==="number")W=`${W} at one or more positions greater than or equal to ${$.validation.position}`}else if("startsWith"in $.validation)W=`Invalid input: must start with "${$.validation.startsWith}"`;else if("endsWith"in $.validation)W=`Invalid input: must end with "${$.validation.endsWith}"`;else F.assertNever($.validation);else if($.validation!=="regex")W=`Invalid ${$.validation}`;else W="Invalid";break;case D.too_small:if($.type==="array")W=`Array must contain ${$.exact?"exactly":$.inclusive?"at least":"more than"} ${$.minimum} element(s)`;else if($.type==="string")W=`String must contain ${$.exact?"exactly":$.inclusive?"at least":"over"} ${$.minimum} character(s)`;else if($.type==="number")W=`Number must be ${$.exact?"exactly equal to ":$.inclusive?"greater than or equal to ":"greater than "}${$.minimum}`;else if($.type==="date")W=`Date must be ${$.exact?"exactly equal to ":$.inclusive?"greater than or equal to ":"greater than "}${new Date(Number($.minimum))}`;else W="Invalid input";break;case D.too_big:if($.type==="array")W=`Array must contain ${$.exact?"exactly":$.inclusive?"at most":"less than"} ${$.maximum} element(s)`;else if($.type==="string")W=`String must contain ${$.exact?"exactly":$.inclusive?"at most":"under"} ${$.maximum} character(s)`;else if($.type==="number")W=`Number must be ${$.exact?"exactly":$.inclusive?"less than or equal to":"less than"} ${$.maximum}`;else if($.type==="bigint")W=`BigInt must be ${$.exact?"exactly":$.inclusive?"less than or equal to":"less than"} ${$.maximum}`;else if($.type==="date")W=`Date must be ${$.exact?"exactly":$.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number($.maximum))}`;else W="Invalid input";break;case D.custom:W="Invalid input";break;case D.invalid_intersection_types:W="Intersection results could not be merged";break;case D.not_multiple_of:W=`Number must be a multiple of ${$.multipleOf}`;break;case D.not_finite:W="Number must be finite";break;default:W=X.defaultError,F.assertNever($)}return{message:W}},s2,u0=($)=>{let{data:X,path:W,errorMaps:Q,issueData:H}=$,Y=[...W,...H.path||[]],G={...H,path:Y};if(H.message!==void 0)return{...H,path:Y,message:H.message};let B="",w=Q.filter((M)=>!!M).slice().reverse();for(let M of w)B=M(G,{data:X,defaultError:B}).message;return{...H,path:Y,message:B}},I3,U,M0=($)=>({status:"dirty",value:$}),v=($)=>({status:"valid",value:$}),R2=($)=>$.status==="aborted",E2=($)=>$.status==="dirty",J0=($)=>$.status==="valid",k0=($)=>typeof Promise!=="undefined"&&$ instanceof Promise,j,b0,v0,r2=($,X)=>{if(J0(X))return{success:!0,data:X.value};else{if(!$.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let W=new C($.common.issues);return this._error=W,this._error}}}},P3,f3,T3,g3,x3,h3,y3,Z3,m3="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",S2,l3,n3,c3,u3,p3,i3,$1="((\\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])))",d3,x,$0,X0,j0,Y0,C0,q0,O0,G0,e,p,I0,h,S,U0,r=($)=>{if($ instanceof N0)return r($.schema);else if($ instanceof T)return r($.innerType());else if($ instanceof L0)return[$.value];else if($ instanceof W0)return $.options;else if($ instanceof F0)return F.objectValues($.enum);else if($ instanceof S0)return r($._def.innerType);else if($ instanceof q0)return[void 0];else if($ instanceof O0)return[null];else if($ instanceof I)return[void 0,...r($.unwrap())];else if($ instanceof t)return[null,...r($.unwrap())];else if($ instanceof d0)return r($.unwrap());else if($ instanceof R0)return r($.unwrap());else if($ instanceof _0)return r($._def.innerType);else return[]},i0,K0,i,P0,f0,B0,A0,N0,L0,W0,F0,w0,T,I,t,S0,_0,T0,e3,d0,g0,R0,$6,z,X6=($,X={message:`Input not instance of ${$.name}`})=>H1((W)=>W instanceof $,X),J1,Y1,W6,Q6,G1,H6,J6,Y6,G6,B6,w6,D6,z6,M6,A6,V6,j6,q6,O6,U6,K6,N6,L6,F6,S6,_6,R6,E6,b6,t2,v6,k6,C6,I6,P6=()=>J1().optional(),f6=()=>Y1().optional(),T6=()=>G1().optional(),g6,x6,J;var s=F2(()=>{(function($){$.assertEqual=(H)=>H;function X(H){}$.assertIs=X;function W(H){throw new Error}$.assertNever=W,$.arrayToEnum=(H)=>{let Y={};for(let G of H)Y[G]=G;return Y},$.getValidEnumValues=(H)=>{let Y=$.objectKeys(H).filter((B)=>typeof H[H[B]]!=="number"),G={};for(let B of Y)G[B]=H[B];return $.objectValues(G)},$.objectValues=(H)=>{return $.objectKeys(H).map(function(Y){return H[Y]})},$.objectKeys=typeof Object.keys==="function"?(H)=>Object.keys(H):(H)=>{let Y=[];for(let G in H)if(Object.prototype.hasOwnProperty.call(H,G))Y.push(G);return Y},$.find=(H,Y)=>{for(let G of H)if(Y(G))return G;return},$.isInteger=typeof Number.isInteger==="function"?(H)=>Number.isInteger(H):(H)=>typeof H==="number"&&isFinite(H)&&Math.floor(H)===H;function Q(H,Y=" | "){return H.map((G)=>typeof G==="string"?`'${G}'`:G).join(Y)}$.joinValues=Q,$.jsonStringifyReplacer=(H,Y)=>{if(typeof Y==="bigint")return Y.toString();return Y}})(F||(F={}));(function($){$.mergeShapes=(X,W)=>{return{...X,...W}}})(_2||(_2={}));V=F.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),D=F.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"]);C=class C extends Error{get errors(){return this.issues}constructor($){super();this.issues=[],this.addIssue=(W)=>{this.issues=[...this.issues,W]},this.addIssues=(W=[])=>{this.issues=[...this.issues,...W]};let X=new.target.prototype;if(Object.setPrototypeOf)Object.setPrototypeOf(this,X);else this.__proto__=X;this.name="ZodError",this.issues=$}format($){let X=$||function(H){return H.message},W={_errors:[]},Q=(H)=>{for(let Y of H.issues)if(Y.code==="invalid_union")Y.unionErrors.map(Q);else if(Y.code==="invalid_return_type")Q(Y.returnTypeError);else if(Y.code==="invalid_arguments")Q(Y.argumentsError);else if(Y.path.length===0)W._errors.push(X(Y));else{let G=W,B=0;while(B<Y.path.length){let w=Y.path[B];if(B!==Y.path.length-1)G[w]=G[w]||{_errors:[]};else G[w]=G[w]||{_errors:[]},G[w]._errors.push(X(Y));G=G[w],B++}}};return Q(this),W}static assert($){if(!($ instanceof C))throw new Error(`Not a ZodError: ${$}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,F.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten($=(X)=>X.message){let X={},W=[];for(let Q of this.issues)if(Q.path.length>0)X[Q.path[0]]=X[Q.path[0]]||[],X[Q.path[0]].push($(Q));else W.push($(Q));return{formErrors:W,fieldErrors:X}}get formErrors(){return this.flatten()}};C.create=($)=>{return new C($)};s2=V0;I3=[];U=Object.freeze({status:"aborted"});(function($){$.errToObj=(X)=>typeof X==="string"?{message:X}:X||{},$.toString=(X)=>typeof X==="string"?X:X===null||X===void 0?void 0:X.message})(j||(j={}));P3=/^c[^\s-]{8,}$/i,f3=/^[0-9a-z]+$/,T3=/^[0-9A-HJKMNP-TV-Z]{26}$/i,g3=/^[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,x3=/^[a-z0-9_-]{21}$/i,h3=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,y3=/^[-+]?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)?)??$/,Z3=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,l3=/^(?:(?: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])$/,n3=/^(?:(?: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])$/,c3=/^(([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]))$/,u3=/^(([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])$/,p3=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,i3=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,d3=new RegExp(`^${$1}$`);x=class x extends K{_parse($){if(this._def.coerce)$.data=String($.data);if(this._getType($)!==V.string){let H=this._getOrReturnCtx($);return A(H,{code:D.invalid_type,expected:V.string,received:H.parsedType}),U}let W=new E,Q=void 0;for(let H of this._def.checks)if(H.kind==="min"){if($.data.length<H.value)Q=this._getOrReturnCtx($,Q),A(Q,{code:D.too_small,minimum:H.value,type:"string",inclusive:!0,exact:!1,message:H.message}),W.dirty()}else if(H.kind==="max"){if($.data.length>H.value)Q=this._getOrReturnCtx($,Q),A(Q,{code:D.too_big,maximum:H.value,type:"string",inclusive:!0,exact:!1,message:H.message}),W.dirty()}else if(H.kind==="length"){let Y=$.data.length>H.value,G=$.data.length<H.value;if(Y||G){if(Q=this._getOrReturnCtx($,Q),Y)A(Q,{code:D.too_big,maximum:H.value,type:"string",inclusive:!0,exact:!0,message:H.message});else if(G)A(Q,{code:D.too_small,minimum:H.value,type:"string",inclusive:!0,exact:!0,message:H.message});W.dirty()}}else if(H.kind==="email"){if(!Z3.test($.data))Q=this._getOrReturnCtx($,Q),A(Q,{validation:"email",code:D.invalid_string,message:H.message}),W.dirty()}else if(H.kind==="emoji"){if(!S2)S2=new RegExp(m3,"u");if(!S2.test($.data))Q=this._getOrReturnCtx($,Q),A(Q,{validation:"emoji",code:D.invalid_string,message:H.message}),W.dirty()}else if(H.kind==="uuid"){if(!g3.test($.data))Q=this._getOrReturnCtx($,Q),A(Q,{validation:"uuid",code:D.invalid_string,message:H.message}),W.dirty()}else if(H.kind==="nanoid"){if(!x3.test($.data))Q=this._getOrReturnCtx($,Q),A(Q,{validation:"nanoid",code:D.invalid_string,message:H.message}),W.dirty()}else if(H.kind==="cuid"){if(!P3.test($.data))Q=this._getOrReturnCtx($,Q),A(Q,{validation:"cuid",code:D.invalid_string,message:H.message}),W.dirty()}else if(H.kind==="cuid2"){if(!f3.test($.data))Q=this._getOrReturnCtx($,Q),A(Q,{validation:"cuid2",code:D.invalid_string,message:H.message}),W.dirty()}else if(H.kind==="ulid"){if(!T3.test($.data))Q=this._getOrReturnCtx($,Q),A(Q,{validation:"ulid",code:D.invalid_string,message:H.message}),W.dirty()}else if(H.kind==="url")try{new URL($.data)}catch(Y){Q=this._getOrReturnCtx($,Q),A(Q,{validation:"url",code:D.invalid_string,message:H.message}),W.dirty()}else if(H.kind==="regex"){if(H.regex.lastIndex=0,!H.regex.test($.data))Q=this._getOrReturnCtx($,Q),A(Q,{validation:"regex",code:D.invalid_string,message:H.message}),W.dirty()}else if(H.kind==="trim")$.data=$.data.trim();else if(H.kind==="includes"){if(!$.data.includes(H.value,H.position))Q=this._getOrReturnCtx($,Q),A(Q,{code:D.invalid_string,validation:{includes:H.value,position:H.position},message:H.message}),W.dirty()}else if(H.kind==="toLowerCase")$.data=$.data.toLowerCase();else if(H.kind==="toUpperCase")$.data=$.data.toUpperCase();else if(H.kind==="startsWith"){if(!$.data.startsWith(H.value))Q=this._getOrReturnCtx($,Q),A(Q,{code:D.invalid_string,validation:{startsWith:H.value},message:H.message}),W.dirty()}else if(H.kind==="endsWith"){if(!$.data.endsWith(H.value))Q=this._getOrReturnCtx($,Q),A(Q,{code:D.invalid_string,validation:{endsWith:H.value},message:H.message}),W.dirty()}else if(H.kind==="datetime"){if(!W1(H).test($.data))Q=this._getOrReturnCtx($,Q),A(Q,{code:D.invalid_string,validation:"datetime",message:H.message}),W.dirty()}else if(H.kind==="date"){if(!d3.test($.data))Q=this._getOrReturnCtx($,Q),A(Q,{code:D.invalid_string,validation:"date",message:H.message}),W.dirty()}else if(H.kind==="time"){if(!o3(H).test($.data))Q=this._getOrReturnCtx($,Q),A(Q,{code:D.invalid_string,validation:"time",message:H.message}),W.dirty()}else if(H.kind==="duration"){if(!y3.test($.data))Q=this._getOrReturnCtx($,Q),A(Q,{validation:"duration",code:D.invalid_string,message:H.message}),W.dirty()}else if(H.kind==="ip"){if(!r3($.data,H.version))Q=this._getOrReturnCtx($,Q),A(Q,{validation:"ip",code:D.invalid_string,message:H.message}),W.dirty()}else if(H.kind==="jwt"){if(!a3($.data,H.alg))Q=this._getOrReturnCtx($,Q),A(Q,{validation:"jwt",code:D.invalid_string,message:H.message}),W.dirty()}else if(H.kind==="cidr"){if(!t3($.data,H.version))Q=this._getOrReturnCtx($,Q),A(Q,{validation:"cidr",code:D.invalid_string,message:H.message}),W.dirty()}else if(H.kind==="base64"){if(!p3.test($.data))Q=this._getOrReturnCtx($,Q),A(Q,{validation:"base64",code:D.invalid_string,message:H.message}),W.dirty()}else if(H.kind==="base64url"){if(!i3.test($.data))Q=this._getOrReturnCtx($,Q),A(Q,{validation:"base64url",code:D.invalid_string,message:H.message}),W.dirty()}else F.assertNever(H);return{status:W.value,value:$.data}}_regex($,X,W){return this.refinement((Q)=>$.test(Q),{validation:X,code:D.invalid_string,...j.errToObj(W)})}_addCheck($){return new x({...this._def,checks:[...this._def.checks,$]})}email($){return this._addCheck({kind:"email",...j.errToObj($)})}url($){return this._addCheck({kind:"url",...j.errToObj($)})}emoji($){return this._addCheck({kind:"emoji",...j.errToObj($)})}uuid($){return this._addCheck({kind:"uuid",...j.errToObj($)})}nanoid($){return this._addCheck({kind:"nanoid",...j.errToObj($)})}cuid($){return this._addCheck({kind:"cuid",...j.errToObj($)})}cuid2($){return this._addCheck({kind:"cuid2",...j.errToObj($)})}ulid($){return this._addCheck({kind:"ulid",...j.errToObj($)})}base64($){return this._addCheck({kind:"base64",...j.errToObj($)})}base64url($){return this._addCheck({kind:"base64url",...j.errToObj($)})}jwt($){return this._addCheck({kind:"jwt",...j.errToObj($)})}ip($){return this._addCheck({kind:"ip",...j.errToObj($)})}cidr($){return this._addCheck({kind:"cidr",...j.errToObj($)})}datetime($){var X,W;if(typeof $==="string")return this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:$});return this._addCheck({kind:"datetime",precision:typeof($===null||$===void 0?void 0:$.precision)==="undefined"?null:$===null||$===void 0?void 0:$.precision,offset:(X=$===null||$===void 0?void 0:$.offset)!==null&&X!==void 0?X:!1,local:(W=$===null||$===void 0?void 0:$.local)!==null&&W!==void 0?W:!1,...j.errToObj($===null||$===void 0?void 0:$.message)})}date($){return this._addCheck({kind:"date",message:$})}time($){if(typeof $==="string")return this._addCheck({kind:"time",precision:null,message:$});return this._addCheck({kind:"time",precision:typeof($===null||$===void 0?void 0:$.precision)==="undefined"?null:$===null||$===void 0?void 0:$.precision,...j.errToObj($===null||$===void 0?void 0:$.message)})}duration($){return this._addCheck({kind:"duration",...j.errToObj($)})}regex($,X){return this._addCheck({kind:"regex",regex:$,...j.errToObj(X)})}includes($,X){return this._addCheck({kind:"includes",value:$,position:X===null||X===void 0?void 0:X.position,...j.errToObj(X===null||X===void 0?void 0:X.message)})}startsWith($,X){return this._addCheck({kind:"startsWith",value:$,...j.errToObj(X)})}endsWith($,X){return this._addCheck({kind:"endsWith",value:$,...j.errToObj(X)})}min($,X){return this._addCheck({kind:"min",value:$,...j.errToObj(X)})}max($,X){return this._addCheck({kind:"max",value:$,...j.errToObj(X)})}length($,X){return this._addCheck({kind:"length",value:$,...j.errToObj(X)})}nonempty($){return this.min(1,j.errToObj($))}trim(){return new x({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new x({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new x({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(($)=>$.kind==="datetime")}get isDate(){return!!this._def.checks.find(($)=>$.kind==="date")}get isTime(){return!!this._def.checks.find(($)=>$.kind==="time")}get isDuration(){return!!this._def.checks.find(($)=>$.kind==="duration")}get isEmail(){return!!this._def.checks.find(($)=>$.kind==="email")}get isURL(){return!!this._def.checks.find(($)=>$.kind==="url")}get isEmoji(){return!!this._def.checks.find(($)=>$.kind==="emoji")}get isUUID(){return!!this._def.checks.find(($)=>$.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(($)=>$.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(($)=>$.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(($)=>$.kind==="cuid2")}get isULID(){return!!this._def.checks.find(($)=>$.kind==="ulid")}get isIP(){return!!this._def.checks.find(($)=>$.kind==="ip")}get isCIDR(){return!!this._def.checks.find(($)=>$.kind==="cidr")}get isBase64(){return!!this._def.checks.find(($)=>$.kind==="base64")}get isBase64url(){return!!this._def.checks.find(($)=>$.kind==="base64url")}get minLength(){let $=null;for(let X of this._def.checks)if(X.kind==="min"){if($===null||X.value>$)$=X.value}return $}get maxLength(){let $=null;for(let X of this._def.checks)if(X.kind==="max"){if($===null||X.value<$)$=X.value}return $}};x.create=($)=>{var X;return new x({checks:[],typeName:z.ZodString,coerce:(X=$===null||$===void 0?void 0:$.coerce)!==null&&X!==void 0?X:!1,...N($)})};$0=class $0 extends K{constructor(){super(...arguments);this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse($){if(this._def.coerce)$.data=Number($.data);if(this._getType($)!==V.number){let H=this._getOrReturnCtx($);return A(H,{code:D.invalid_type,expected:V.number,received:H.parsedType}),U}let W=void 0,Q=new E;for(let H of this._def.checks)if(H.kind==="int"){if(!F.isInteger($.data))W=this._getOrReturnCtx($,W),A(W,{code:D.invalid_type,expected:"integer",received:"float",message:H.message}),Q.dirty()}else if(H.kind==="min"){if(H.inclusive?$.data<H.value:$.data<=H.value)W=this._getOrReturnCtx($,W),A(W,{code:D.too_small,minimum:H.value,type:"number",inclusive:H.inclusive,exact:!1,message:H.message}),Q.dirty()}else if(H.kind==="max"){if(H.inclusive?$.data>H.value:$.data>=H.value)W=this._getOrReturnCtx($,W),A(W,{code:D.too_big,maximum:H.value,type:"number",inclusive:H.inclusive,exact:!1,message:H.message}),Q.dirty()}else if(H.kind==="multipleOf"){if(s3($.data,H.value)!==0)W=this._getOrReturnCtx($,W),A(W,{code:D.not_multiple_of,multipleOf:H.value,message:H.message}),Q.dirty()}else if(H.kind==="finite"){if(!Number.isFinite($.data))W=this._getOrReturnCtx($,W),A(W,{code:D.not_finite,message:H.message}),Q.dirty()}else F.assertNever(H);return{status:Q.value,value:$.data}}gte($,X){return this.setLimit("min",$,!0,j.toString(X))}gt($,X){return this.setLimit("min",$,!1,j.toString(X))}lte($,X){return this.setLimit("max",$,!0,j.toString(X))}lt($,X){return this.setLimit("max",$,!1,j.toString(X))}setLimit($,X,W,Q){return new $0({...this._def,checks:[...this._def.checks,{kind:$,value:X,inclusive:W,message:j.toString(Q)}]})}_addCheck($){return new $0({...this._def,checks:[...this._def.checks,$]})}int($){return this._addCheck({kind:"int",message:j.toString($)})}positive($){return this._addCheck({kind:"min",value:0,inclusive:!1,message:j.toString($)})}negative($){return this._addCheck({kind:"max",value:0,inclusive:!1,message:j.toString($)})}nonpositive($){return this._addCheck({kind:"max",value:0,inclusive:!0,message:j.toString($)})}nonnegative($){return this._addCheck({kind:"min",value:0,inclusive:!0,message:j.toString($)})}multipleOf($,X){return this._addCheck({kind:"multipleOf",value:$,message:j.toString(X)})}finite($){return this._addCheck({kind:"finite",message:j.toString($)})}safe($){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:j.toString($)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:j.toString($)})}get minValue(){let $=null;for(let X of this._def.checks)if(X.kind==="min"){if($===null||X.value>$)$=X.value}return $}get maxValue(){let $=null;for(let X of this._def.checks)if(X.kind==="max"){if($===null||X.value<$)$=X.value}return $}get isInt(){return!!this._def.checks.find(($)=>$.kind==="int"||$.kind==="multipleOf"&&F.isInteger($.value))}get isFinite(){let $=null,X=null;for(let W of this._def.checks)if(W.kind==="finite"||W.kind==="int"||W.kind==="multipleOf")return!0;else if(W.kind==="min"){if(X===null||W.value>X)X=W.value}else if(W.kind==="max"){if($===null||W.value<$)$=W.value}return Number.isFinite(X)&&Number.isFinite($)}};$0.create=($)=>{return new $0({checks:[],typeName:z.ZodNumber,coerce:($===null||$===void 0?void 0:$.coerce)||!1,...N($)})};X0=class X0 extends K{constructor(){super(...arguments);this.min=this.gte,this.max=this.lte}_parse($){if(this._def.coerce)try{$.data=BigInt($.data)}catch(H){return this._getInvalidInput($)}if(this._getType($)!==V.bigint)return this._getInvalidInput($);let W=void 0,Q=new E;for(let H of this._def.checks)if(H.kind==="min"){if(H.inclusive?$.data<H.value:$.data<=H.value)W=this._getOrReturnCtx($,W),A(W,{code:D.too_small,type:"bigint",minimum:H.value,inclusive:H.inclusive,message:H.message}),Q.dirty()}else if(H.kind==="max"){if(H.inclusive?$.data>H.value:$.data>=H.value)W=this._getOrReturnCtx($,W),A(W,{code:D.too_big,type:"bigint",maximum:H.value,inclusive:H.inclusive,message:H.message}),Q.dirty()}else if(H.kind==="multipleOf"){if($.data%H.value!==BigInt(0))W=this._getOrReturnCtx($,W),A(W,{code:D.not_multiple_of,multipleOf:H.value,message:H.message}),Q.dirty()}else F.assertNever(H);return{status:Q.value,value:$.data}}_getInvalidInput($){let X=this._getOrReturnCtx($);return A(X,{code:D.invalid_type,expected:V.bigint,received:X.parsedType}),U}gte($,X){return this.setLimit("min",$,!0,j.toString(X))}gt($,X){return this.setLimit("min",$,!1,j.toString(X))}lte($,X){return this.setLimit("max",$,!0,j.toString(X))}lt($,X){return this.setLimit("max",$,!1,j.toString(X))}setLimit($,X,W,Q){return new X0({...this._def,checks:[...this._def.checks,{kind:$,value:X,inclusive:W,message:j.toString(Q)}]})}_addCheck($){return new X0({...this._def,checks:[...this._def.checks,$]})}positive($){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:j.toString($)})}negative($){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:j.toString($)})}nonpositive($){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:j.toString($)})}nonnegative($){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:j.toString($)})}multipleOf($,X){return this._addCheck({kind:"multipleOf",value:$,message:j.toString(X)})}get minValue(){let $=null;for(let X of this._def.checks)if(X.kind==="min"){if($===null||X.value>$)$=X.value}return $}get maxValue(){let $=null;for(let X of this._def.checks)if(X.kind==="max"){if($===null||X.value<$)$=X.value}return $}};X0.create=($)=>{var X;return new X0({checks:[],typeName:z.ZodBigInt,coerce:(X=$===null||$===void 0?void 0:$.coerce)!==null&&X!==void 0?X:!1,...N($)})};j0=class j0 extends K{_parse($){if(this._def.coerce)$.data=Boolean($.data);if(this._getType($)!==V.boolean){let W=this._getOrReturnCtx($);return A(W,{code:D.invalid_type,expected:V.boolean,received:W.parsedType}),U}return v($.data)}};j0.create=($)=>{return new j0({typeName:z.ZodBoolean,coerce:($===null||$===void 0?void 0:$.coerce)||!1,...N($)})};Y0=class Y0 extends K{_parse($){if(this._def.coerce)$.data=new Date($.data);if(this._getType($)!==V.date){let H=this._getOrReturnCtx($);return A(H,{code:D.invalid_type,expected:V.date,received:H.parsedType}),U}if(isNaN($.data.getTime())){let H=this._getOrReturnCtx($);return A(H,{code:D.invalid_date}),U}let W=new E,Q=void 0;for(let H of this._def.checks)if(H.kind==="min"){if($.data.getTime()<H.value)Q=this._getOrReturnCtx($,Q),A(Q,{code:D.too_small,message:H.message,inclusive:!0,exact:!1,minimum:H.value,type:"date"}),W.dirty()}else if(H.kind==="max"){if($.data.getTime()>H.value)Q=this._getOrReturnCtx($,Q),A(Q,{code:D.too_big,message:H.message,inclusive:!0,exact:!1,maximum:H.value,type:"date"}),W.dirty()}else F.assertNever(H);return{status:W.value,value:new Date($.data.getTime())}}_addCheck($){return new Y0({...this._def,checks:[...this._def.checks,$]})}min($,X){return this._addCheck({kind:"min",value:$.getTime(),message:j.toString(X)})}max($,X){return this._addCheck({kind:"max",value:$.getTime(),message:j.toString(X)})}get minDate(){let $=null;for(let X of this._def.checks)if(X.kind==="min"){if($===null||X.value>$)$=X.value}return $!=null?new Date($):null}get maxDate(){let $=null;for(let X of this._def.checks)if(X.kind==="max"){if($===null||X.value<$)$=X.value}return $!=null?new Date($):null}};Y0.create=($)=>{return new Y0({checks:[],coerce:($===null||$===void 0?void 0:$.coerce)||!1,typeName:z.ZodDate,...N($)})};C0=class C0 extends K{_parse($){if(this._getType($)!==V.symbol){let W=this._getOrReturnCtx($);return A(W,{code:D.invalid_type,expected:V.symbol,received:W.parsedType}),U}return v($.data)}};C0.create=($)=>{return new C0({typeName:z.ZodSymbol,...N($)})};q0=class q0 extends K{_parse($){if(this._getType($)!==V.undefined){let W=this._getOrReturnCtx($);return A(W,{code:D.invalid_type,expected:V.undefined,received:W.parsedType}),U}return v($.data)}};q0.create=($)=>{return new q0({typeName:z.ZodUndefined,...N($)})};O0=class O0 extends K{_parse($){if(this._getType($)!==V.null){let W=this._getOrReturnCtx($);return A(W,{code:D.invalid_type,expected:V.null,received:W.parsedType}),U}return v($.data)}};O0.create=($)=>{return new O0({typeName:z.ZodNull,...N($)})};G0=class G0 extends K{constructor(){super(...arguments);this._any=!0}_parse($){return v($.data)}};G0.create=($)=>{return new G0({typeName:z.ZodAny,...N($)})};e=class e extends K{constructor(){super(...arguments);this._unknown=!0}_parse($){return v($.data)}};e.create=($)=>{return new e({typeName:z.ZodUnknown,...N($)})};p=class p extends K{_parse($){let X=this._getOrReturnCtx($);return A(X,{code:D.invalid_type,expected:V.never,received:X.parsedType}),U}};p.create=($)=>{return new p({typeName:z.ZodNever,...N($)})};I0=class I0 extends K{_parse($){if(this._getType($)!==V.undefined){let W=this._getOrReturnCtx($);return A(W,{code:D.invalid_type,expected:V.void,received:W.parsedType}),U}return v($.data)}};I0.create=($)=>{return new I0({typeName:z.ZodVoid,...N($)})};h=class h extends K{_parse($){let{ctx:X,status:W}=this._processInputParams($),Q=this._def;if(X.parsedType!==V.array)return A(X,{code:D.invalid_type,expected:V.array,received:X.parsedType}),U;if(Q.exactLength!==null){let Y=X.data.length>Q.exactLength.value,G=X.data.length<Q.exactLength.value;if(Y||G)A(X,{code:Y?D.too_big:D.too_small,minimum:G?Q.exactLength.value:void 0,maximum:Y?Q.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:Q.exactLength.message}),W.dirty()}if(Q.minLength!==null){if(X.data.length<Q.minLength.value)A(X,{code:D.too_small,minimum:Q.minLength.value,type:"array",inclusive:!0,exact:!1,message:Q.minLength.message}),W.dirty()}if(Q.maxLength!==null){if(X.data.length>Q.maxLength.value)A(X,{code:D.too_big,maximum:Q.maxLength.value,type:"array",inclusive:!0,exact:!1,message:Q.maxLength.message}),W.dirty()}if(X.common.async)return Promise.all([...X.data].map((Y,G)=>{return Q.type._parseAsync(new y(X,Y,X.path,G))})).then((Y)=>{return E.mergeArray(W,Y)});let H=[...X.data].map((Y,G)=>{return Q.type._parseSync(new y(X,Y,X.path,G))});return E.mergeArray(W,H)}get element(){return this._def.type}min($,X){return new h({...this._def,minLength:{value:$,message:j.toString(X)}})}max($,X){return new h({...this._def,maxLength:{value:$,message:j.toString(X)}})}length($,X){return new h({...this._def,exactLength:{value:$,message:j.toString(X)}})}nonempty($){return this.min(1,$)}};h.create=($,X)=>{return new h({type:$,minLength:null,maxLength:null,exactLength:null,typeName:z.ZodArray,...N(X)})};S=class S extends K{constructor(){super(...arguments);this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let $=this._def.shape(),X=F.objectKeys($);return this._cached={shape:$,keys:X}}_parse($){if(this._getType($)!==V.object){let w=this._getOrReturnCtx($);return A(w,{code:D.invalid_type,expected:V.object,received:w.parsedType}),U}let{status:W,ctx:Q}=this._processInputParams($),{shape:H,keys:Y}=this._getCached(),G=[];if(!(this._def.catchall instanceof p&&this._def.unknownKeys==="strip")){for(let w in Q.data)if(!Y.includes(w))G.push(w)}let B=[];for(let w of Y){let M=H[w],q=Q.data[w];B.push({key:{status:"valid",value:w},value:M._parse(new y(Q,q,Q.path,w)),alwaysSet:w in Q.data})}if(this._def.catchall instanceof p){let w=this._def.unknownKeys;if(w==="passthrough")for(let M of G)B.push({key:{status:"valid",value:M},value:{status:"valid",value:Q.data[M]}});else if(w==="strict"){if(G.length>0)A(Q,{code:D.unrecognized_keys,keys:G}),W.dirty()}else if(w==="strip");else throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let w=this._def.catchall;for(let M of G){let q=Q.data[M];B.push({key:{status:"valid",value:M},value:w._parse(new y(Q,q,Q.path,M)),alwaysSet:M in Q.data})}}if(Q.common.async)return Promise.resolve().then(async()=>{let w=[];for(let M of B){let q=await M.key,b=await M.value;w.push({key:q,value:b,alwaysSet:M.alwaysSet})}return w}).then((w)=>{return E.mergeObjectSync(W,w)});else return E.mergeObjectSync(W,B)}get shape(){return this._def.shape()}strict($){return j.errToObj,new S({...this._def,unknownKeys:"strict",...$!==void 0?{errorMap:(X,W)=>{var Q,H,Y,G;let B=(Y=(H=(Q=this._def).errorMap)===null||H===void 0?void 0:H.call(Q,X,W).message)!==null&&Y!==void 0?Y:W.defaultError;if(X.code==="unrecognized_keys")return{message:(G=j.errToObj($).message)!==null&&G!==void 0?G:B};return{message:B}}}:{}})}strip(){return new S({...this._def,unknownKeys:"strip"})}passthrough(){return new S({...this._def,unknownKeys:"passthrough"})}extend($){return new S({...this._def,shape:()=>({...this._def.shape(),...$})})}merge($){return new S({unknownKeys:$._def.unknownKeys,catchall:$._def.catchall,shape:()=>({...this._def.shape(),...$._def.shape()}),typeName:z.ZodObject})}setKey($,X){return this.augment({[$]:X})}catchall($){return new S({...this._def,catchall:$})}pick($){let X={};return F.objectKeys($).forEach((W)=>{if($[W]&&this.shape[W])X[W]=this.shape[W]}),new S({...this._def,shape:()=>X})}omit($){let X={};return F.objectKeys(this.shape).forEach((W)=>{if(!$[W])X[W]=this.shape[W]}),new S({...this._def,shape:()=>X})}deepPartial(){return z0(this)}partial($){let X={};return F.objectKeys(this.shape).forEach((W)=>{let Q=this.shape[W];if($&&!$[W])X[W]=Q;else X[W]=Q.optional()}),new S({...this._def,shape:()=>X})}required($){let X={};return F.objectKeys(this.shape).forEach((W)=>{if($&&!$[W])X[W]=this.shape[W];else{let H=this.shape[W];while(H instanceof I)H=H._def.innerType;X[W]=H}}),new S({...this._def,shape:()=>X})}keyof(){return Q1(F.objectKeys(this.shape))}};S.create=($,X)=>{return new S({shape:()=>$,unknownKeys:"strip",catchall:p.create(),typeName:z.ZodObject,...N(X)})};S.strictCreate=($,X)=>{return new S({shape:()=>$,unknownKeys:"strict",catchall:p.create(),typeName:z.ZodObject,...N(X)})};S.lazycreate=($,X)=>{return new S({shape:$,unknownKeys:"strip",catchall:p.create(),typeName:z.ZodObject,...N(X)})};U0=class U0 extends K{_parse($){let{ctx:X}=this._processInputParams($),W=this._def.options;function Q(H){for(let G of H)if(G.result.status==="valid")return G.result;for(let G of H)if(G.result.status==="dirty")return X.common.issues.push(...G.ctx.common.issues),G.result;let Y=H.map((G)=>new C(G.ctx.common.issues));return A(X,{code:D.invalid_union,unionErrors:Y}),U}if(X.common.async)return Promise.all(W.map(async(H)=>{let Y={...X,common:{...X.common,issues:[]},parent:null};return{result:await H._parseAsync({data:X.data,path:X.path,parent:Y}),ctx:Y}})).then(Q);else{let H=void 0,Y=[];for(let B of W){let w={...X,common:{...X.common,issues:[]},parent:null},M=B._parseSync({data:X.data,path:X.path,parent:w});if(M.status==="valid")return M;else if(M.status==="dirty"&&!H)H={result:M,ctx:w};if(w.common.issues.length)Y.push(w.common.issues)}if(H)return X.common.issues.push(...H.ctx.common.issues),H.result;let G=Y.map((B)=>new C(B));return A(X,{code:D.invalid_union,unionErrors:G}),U}}get options(){return this._def.options}};U0.create=($,X)=>{return new U0({options:$,typeName:z.ZodUnion,...N(X)})};i0=class i0 extends K{_parse($){let{ctx:X}=this._processInputParams($);if(X.parsedType!==V.object)return A(X,{code:D.invalid_type,expected:V.object,received:X.parsedType}),U;let W=this.discriminator,Q=X.data[W],H=this.optionsMap.get(Q);if(!H)return A(X,{code:D.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[W]}),U;if(X.common.async)return H._parseAsync({data:X.data,path:X.path,parent:X});else return H._parseSync({data:X.data,path:X.path,parent:X})}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create($,X,W){let Q=new Map;for(let H of X){let Y=r(H.shape[$]);if(!Y.length)throw new Error(`A discriminator value for key \`${$}\` could not be extracted from all schema options`);for(let G of Y){if(Q.has(G))throw new Error(`Discriminator property ${String($)} has duplicate value ${String(G)}`);Q.set(G,H)}}return new i0({typeName:z.ZodDiscriminatedUnion,discriminator:$,options:X,optionsMap:Q,...N(W)})}};K0=class K0 extends K{_parse($){let{status:X,ctx:W}=this._processInputParams($),Q=(H,Y)=>{if(R2(H)||R2(Y))return U;let G=b2(H.value,Y.value);if(!G.valid)return A(W,{code:D.invalid_intersection_types}),U;if(E2(H)||E2(Y))X.dirty();return{status:X.value,value:G.data}};if(W.common.async)return Promise.all([this._def.left._parseAsync({data:W.data,path:W.path,parent:W}),this._def.right._parseAsync({data:W.data,path:W.path,parent:W})]).then(([H,Y])=>Q(H,Y));else return Q(this._def.left._parseSync({data:W.data,path:W.path,parent:W}),this._def.right._parseSync({data:W.data,path:W.path,parent:W}))}};K0.create=($,X,W)=>{return new K0({left:$,right:X,typeName:z.ZodIntersection,...N(W)})};i=class i extends K{_parse($){let{status:X,ctx:W}=this._processInputParams($);if(W.parsedType!==V.array)return A(W,{code:D.invalid_type,expected:V.array,received:W.parsedType}),U;if(W.data.length<this._def.items.length)return A(W,{code:D.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),U;if(!this._def.rest&&W.data.length>this._def.items.length)A(W,{code:D.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),X.dirty();let H=[...W.data].map((Y,G)=>{let B=this._def.items[G]||this._def.rest;if(!B)return null;return B._parse(new y(W,Y,W.path,G))}).filter((Y)=>!!Y);if(W.common.async)return Promise.all(H).then((Y)=>{return E.mergeArray(X,Y)});else return E.mergeArray(X,H)}get items(){return this._def.items}rest($){return new i({...this._def,rest:$})}};i.create=($,X)=>{if(!Array.isArray($))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new i({items:$,typeName:z.ZodTuple,rest:null,...N(X)})};P0=class P0 extends K{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse($){let{status:X,ctx:W}=this._processInputParams($);if(W.parsedType!==V.object)return A(W,{code:D.invalid_type,expected:V.object,received:W.parsedType}),U;let Q=[],H=this._def.keyType,Y=this._def.valueType;for(let G in W.data)Q.push({key:H._parse(new y(W,G,W.path,G)),value:Y._parse(new y(W,W.data[G],W.path,G)),alwaysSet:G in W.data});if(W.common.async)return E.mergeObjectAsync(X,Q);else return E.mergeObjectSync(X,Q)}get element(){return this._def.valueType}static create($,X,W){if(X instanceof K)return new P0({keyType:$,valueType:X,typeName:z.ZodRecord,...N(W)});return new P0({keyType:x.create(),valueType:$,typeName:z.ZodRecord,...N(X)})}};f0=class f0 extends K{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse($){let{status:X,ctx:W}=this._processInputParams($);if(W.parsedType!==V.map)return A(W,{code:D.invalid_type,expected:V.map,received:W.parsedType}),U;let Q=this._def.keyType,H=this._def.valueType,Y=[...W.data.entries()].map(([G,B],w)=>{return{key:Q._parse(new y(W,G,W.path,[w,"key"])),value:H._parse(new y(W,B,W.path,[w,"value"]))}});if(W.common.async){let G=new Map;return Promise.resolve().then(async()=>{for(let B of Y){let w=await B.key,M=await B.value;if(w.status==="aborted"||M.status==="aborted")return U;if(w.status==="dirty"||M.status==="dirty")X.dirty();G.set(w.value,M.value)}return{status:X.value,value:G}})}else{let G=new Map;for(let B of Y){let{key:w,value:M}=B;if(w.status==="aborted"||M.status==="aborted")return U;if(w.status==="dirty"||M.status==="dirty")X.dirty();G.set(w.value,M.value)}return{status:X.value,value:G}}}};f0.create=($,X,W)=>{return new f0({valueType:X,keyType:$,typeName:z.ZodMap,...N(W)})};B0=class B0 extends K{_parse($){let{status:X,ctx:W}=this._processInputParams($);if(W.parsedType!==V.set)return A(W,{code:D.invalid_type,expected:V.set,received:W.parsedType}),U;let Q=this._def;if(Q.minSize!==null){if(W.data.size<Q.minSize.value)A(W,{code:D.too_small,minimum:Q.minSize.value,type:"set",inclusive:!0,exact:!1,message:Q.minSize.message}),X.dirty()}if(Q.maxSize!==null){if(W.data.size>Q.maxSize.value)A(W,{code:D.too_big,maximum:Q.maxSize.value,type:"set",inclusive:!0,exact:!1,message:Q.maxSize.message}),X.dirty()}let H=this._def.valueType;function Y(B){let w=new Set;for(let M of B){if(M.status==="aborted")return U;if(M.status==="dirty")X.dirty();w.add(M.value)}return{status:X.value,value:w}}let G=[...W.data.values()].map((B,w)=>H._parse(new y(W,B,W.path,w)));if(W.common.async)return Promise.all(G).then((B)=>Y(B));else return Y(G)}min($,X){return new B0({...this._def,minSize:{value:$,message:j.toString(X)}})}max($,X){return new B0({...this._def,maxSize:{value:$,message:j.toString(X)}})}size($,X){return this.min($,X).max($,X)}nonempty($){return this.min(1,$)}};B0.create=($,X)=>{return new B0({valueType:$,minSize:null,maxSize:null,typeName:z.ZodSet,...N(X)})};A0=class A0 extends K{constructor(){super(...arguments);this.validate=this.implement}_parse($){let{ctx:X}=this._processInputParams($);if(X.parsedType!==V.function)return A(X,{code:D.invalid_type,expected:V.function,received:X.parsedType}),U;function W(G,B){return u0({data:G,path:X.path,errorMaps:[X.common.contextualErrorMap,X.schemaErrorMap,c0(),V0].filter((w)=>!!w),issueData:{code:D.invalid_arguments,argumentsError:B}})}function Q(G,B){return u0({data:G,path:X.path,errorMaps:[X.common.contextualErrorMap,X.schemaErrorMap,c0(),V0].filter((w)=>!!w),issueData:{code:D.invalid_return_type,returnTypeError:B}})}let H={errorMap:X.common.contextualErrorMap},Y=X.data;if(this._def.returns instanceof w0){let G=this;return v(async function(...B){let w=new C([]),M=await G._def.args.parseAsync(B,H).catch((o)=>{throw w.addIssue(W(B,o)),w}),q=await Reflect.apply(Y,this,M);return await G._def.returns._def.type.parseAsync(q,H).catch((o)=>{throw w.addIssue(Q(q,o)),w})})}else{let G=this;return v(function(...B){let w=G._def.args.safeParse(B,H);if(!w.success)throw new C([W(B,w.error)]);let M=Reflect.apply(Y,this,w.data),q=G._def.returns.safeParse(M,H);if(!q.success)throw new C([Q(M,q.error)]);return q.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...$){return new A0({...this._def,args:i.create($).rest(e.create())})}returns($){return new A0({...this._def,returns:$})}implement($){return this.parse($)}strictImplement($){return this.parse($)}static create($,X,W){return new A0({args:$?$:i.create([]).rest(e.create()),returns:X||e.create(),typeName:z.ZodFunction,...N(W)})}};N0=class N0 extends K{get schema(){return this._def.getter()}_parse($){let{ctx:X}=this._processInputParams($);return this._def.getter()._parse({data:X.data,path:X.path,parent:X})}};N0.create=($,X)=>{return new N0({getter:$,typeName:z.ZodLazy,...N(X)})};L0=class L0 extends K{_parse($){if($.data!==this._def.value){let X=this._getOrReturnCtx($);return A(X,{received:X.data,code:D.invalid_literal,expected:this._def.value}),U}return{status:"valid",value:$.data}}get value(){return this._def.value}};L0.create=($,X)=>{return new L0({value:$,typeName:z.ZodLiteral,...N(X)})};W0=class W0 extends K{constructor(){super(...arguments);b0.set(this,void 0)}_parse($){if(typeof $.data!=="string"){let X=this._getOrReturnCtx($),W=this._def.values;return A(X,{expected:F.joinValues(W),received:X.parsedType,code:D.invalid_type}),U}if(!p0(this,b0,"f"))e2(this,b0,new Set(this._def.values),"f");if(!p0(this,b0,"f").has($.data)){let X=this._getOrReturnCtx($),W=this._def.values;return A(X,{received:X.data,code:D.invalid_enum_value,options:W}),U}return v($.data)}get options(){return this._def.values}get enum(){let $={};for(let X of this._def.values)$[X]=X;return $}get Values(){let $={};for(let X of this._def.values)$[X]=X;return $}get Enum(){let $={};for(let X of this._def.values)$[X]=X;return $}extract($,X=this._def){return W0.create($,{...this._def,...X})}exclude($,X=this._def){return W0.create(this.options.filter((W)=>!$.includes(W)),{...this._def,...X})}};b0=new WeakMap;W0.create=Q1;F0=class F0 extends K{constructor(){super(...arguments);v0.set(this,void 0)}_parse($){let X=F.getValidEnumValues(this._def.values),W=this._getOrReturnCtx($);if(W.parsedType!==V.string&&W.parsedType!==V.number){let Q=F.objectValues(X);return A(W,{expected:F.joinValues(Q),received:W.parsedType,code:D.invalid_type}),U}if(!p0(this,v0,"f"))e2(this,v0,new Set(F.getValidEnumValues(this._def.values)),"f");if(!p0(this,v0,"f").has($.data)){let Q=F.objectValues(X);return A(W,{received:W.data,code:D.invalid_enum_value,options:Q}),U}return v($.data)}get enum(){return this._def.values}};v0=new WeakMap;F0.create=($,X)=>{return new F0({values:$,typeName:z.ZodNativeEnum,...N(X)})};w0=class w0 extends K{unwrap(){return this._def.type}_parse($){let{ctx:X}=this._processInputParams($);if(X.parsedType!==V.promise&&X.common.async===!1)return A(X,{code:D.invalid_type,expected:V.promise,received:X.parsedType}),U;let W=X.parsedType===V.promise?X.data:Promise.resolve(X.data);return v(W.then((Q)=>{return this._def.type.parseAsync(Q,{path:X.path,errorMap:X.common.contextualErrorMap})}))}};w0.create=($,X)=>{return new w0({type:$,typeName:z.ZodPromise,...N(X)})};T=class T extends K{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===z.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse($){let{status:X,ctx:W}=this._processInputParams($),Q=this._def.effect||null,H={addIssue:(Y)=>{if(A(W,Y),Y.fatal)X.abort();else X.dirty()},get path(){return W.path}};if(H.addIssue=H.addIssue.bind(H),Q.type==="preprocess"){let Y=Q.transform(W.data,H);if(W.common.async)return Promise.resolve(Y).then(async(G)=>{if(X.value==="aborted")return U;let B=await this._def.schema._parseAsync({data:G,path:W.path,parent:W});if(B.status==="aborted")return U;if(B.status==="dirty")return M0(B.value);if(X.value==="dirty")return M0(B.value);return B});else{if(X.value==="aborted")return U;let G=this._def.schema._parseSync({data:Y,path:W.path,parent:W});if(G.status==="aborted")return U;if(G.status==="dirty")return M0(G.value);if(X.value==="dirty")return M0(G.value);return G}}if(Q.type==="refinement"){let Y=(G)=>{let B=Q.refinement(G,H);if(W.common.async)return Promise.resolve(B);if(B instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return G};if(W.common.async===!1){let G=this._def.schema._parseSync({data:W.data,path:W.path,parent:W});if(G.status==="aborted")return U;if(G.status==="dirty")X.dirty();return Y(G.value),{status:X.value,value:G.value}}else return this._def.schema._parseAsync({data:W.data,path:W.path,parent:W}).then((G)=>{if(G.status==="aborted")return U;if(G.status==="dirty")X.dirty();return Y(G.value).then(()=>{return{status:X.value,value:G.value}})})}if(Q.type==="transform")if(W.common.async===!1){let Y=this._def.schema._parseSync({data:W.data,path:W.path,parent:W});if(!J0(Y))return Y;let G=Q.transform(Y.value,H);if(G instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:X.value,value:G}}else return this._def.schema._parseAsync({data:W.data,path:W.path,parent:W}).then((Y)=>{if(!J0(Y))return Y;return Promise.resolve(Q.transform(Y.value,H)).then((G)=>({status:X.value,value:G}))});F.assertNever(Q)}};T.create=($,X,W)=>{return new T({schema:$,typeName:z.ZodEffects,effect:X,...N(W)})};T.createWithPreprocess=($,X,W)=>{return new T({schema:X,effect:{type:"preprocess",transform:$},typeName:z.ZodEffects,...N(W)})};I=class I extends K{_parse($){if(this._getType($)===V.undefined)return v(void 0);return this._def.innerType._parse($)}unwrap(){return this._def.innerType}};I.create=($,X)=>{return new I({innerType:$,typeName:z.ZodOptional,...N(X)})};t=class t extends K{_parse($){if(this._getType($)===V.null)return v(null);return this._def.innerType._parse($)}unwrap(){return this._def.innerType}};t.create=($,X)=>{return new t({innerType:$,typeName:z.ZodNullable,...N(X)})};S0=class S0 extends K{_parse($){let{ctx:X}=this._processInputParams($),W=X.data;if(X.parsedType===V.undefined)W=this._def.defaultValue();return this._def.innerType._parse({data:W,path:X.path,parent:X})}removeDefault(){return this._def.innerType}};S0.create=($,X)=>{return new S0({innerType:$,typeName:z.ZodDefault,defaultValue:typeof X.default==="function"?X.default:()=>X.default,...N(X)})};_0=class _0 extends K{_parse($){let{ctx:X}=this._processInputParams($),W={...X,common:{...X.common,issues:[]}},Q=this._def.innerType._parse({data:W.data,path:W.path,parent:{...W}});if(k0(Q))return Q.then((H)=>{return{status:"valid",value:H.status==="valid"?H.value:this._def.catchValue({get error(){return new C(W.common.issues)},input:W.data})}});else return{status:"valid",value:Q.status==="valid"?Q.value:this._def.catchValue({get error(){return new C(W.common.issues)},input:W.data})}}removeCatch(){return this._def.innerType}};_0.create=($,X)=>{return new _0({innerType:$,typeName:z.ZodCatch,catchValue:typeof X.catch==="function"?X.catch:()=>X.catch,...N(X)})};T0=class T0 extends K{_parse($){if(this._getType($)!==V.nan){let W=this._getOrReturnCtx($);return A(W,{code:D.invalid_type,expected:V.nan,received:W.parsedType}),U}return{status:"valid",value:$.data}}};T0.create=($)=>{return new T0({typeName:z.ZodNaN,...N($)})};e3=Symbol("zod_brand");d0=class d0 extends K{_parse($){let{ctx:X}=this._processInputParams($),W=X.data;return this._def.type._parse({data:W,path:X.path,parent:X})}unwrap(){return this._def.type}};g0=class g0 extends K{_parse($){let{status:X,ctx:W}=this._processInputParams($);if(W.common.async)return(async()=>{let H=await this._def.in._parseAsync({data:W.data,path:W.path,parent:W});if(H.status==="aborted")return U;if(H.status==="dirty")return X.dirty(),M0(H.value);else return this._def.out._parseAsync({data:H.value,path:W.path,parent:W})})();else{let Q=this._def.in._parseSync({data:W.data,path:W.path,parent:W});if(Q.status==="aborted")return U;if(Q.status==="dirty")return X.dirty(),{status:"dirty",value:Q.value};else return this._def.out._parseSync({data:Q.value,path:W.path,parent:W})}}static create($,X){return new g0({in:$,out:X,typeName:z.ZodPipeline})}};R0=class R0 extends K{_parse($){let X=this._def.innerType._parse($),W=(Q)=>{if(J0(Q))Q.value=Object.freeze(Q.value);return Q};return k0(X)?X.then((Q)=>W(Q)):W(X)}unwrap(){return this._def.innerType}};R0.create=($,X)=>{return new R0({innerType:$,typeName:z.ZodReadonly,...N(X)})};$6={object:S.lazycreate};(function($){$.ZodString="ZodString",$.ZodNumber="ZodNumber",$.ZodNaN="ZodNaN",$.ZodBigInt="ZodBigInt",$.ZodBoolean="ZodBoolean",$.ZodDate="ZodDate",$.ZodSymbol="ZodSymbol",$.ZodUndefined="ZodUndefined",$.ZodNull="ZodNull",$.ZodAny="ZodAny",$.ZodUnknown="ZodUnknown",$.ZodNever="ZodNever",$.ZodVoid="ZodVoid",$.ZodArray="ZodArray",$.ZodObject="ZodObject",$.ZodUnion="ZodUnion",$.ZodDiscriminatedUnion="ZodDiscriminatedUnion",$.ZodIntersection="ZodIntersection",$.ZodTuple="ZodTuple",$.ZodRecord="ZodRecord",$.ZodMap="ZodMap",$.ZodSet="ZodSet",$.ZodFunction="ZodFunction",$.ZodLazy="ZodLazy",$.ZodLiteral="ZodLiteral",$.ZodEnum="ZodEnum",$.ZodEffects="ZodEffects",$.ZodNativeEnum="ZodNativeEnum",$.ZodOptional="ZodOptional",$.ZodNullable="ZodNullable",$.ZodDefault="ZodDefault",$.ZodCatch="ZodCatch",$.ZodPromise="ZodPromise",$.ZodBranded="ZodBranded",$.ZodPipeline="ZodPipeline",$.ZodReadonly="ZodReadonly"})(z||(z={}));J1=x.create,Y1=$0.create,W6=T0.create,Q6=X0.create,G1=j0.create,H6=Y0.create,J6=C0.create,Y6=q0.create,G6=O0.create,B6=G0.create,w6=e.create,D6=p.create,z6=I0.create,M6=h.create,A6=S.create,V6=S.strictCreate,j6=U0.create,q6=i0.create,O6=K0.create,U6=i.create,K6=P0.create,N6=f0.create,L6=B0.create,F6=A0.create,S6=N0.create,_6=L0.create,R6=W0.create,E6=F0.create,b6=w0.create,t2=T.create,v6=I.create,k6=t.create,C6=T.createWithPreprocess,I6=g0.create,g6={string:($)=>x.create({...$,coerce:!0}),number:($)=>$0.create({...$,coerce:!0}),boolean:($)=>j0.create({...$,coerce:!0}),bigint:($)=>X0.create({...$,coerce:!0}),date:($)=>Y0.create({...$,coerce:!0})},x6=U,J=Object.freeze({__proto__:null,defaultErrorMap:V0,setErrorMap:C3,getErrorMap:c0,makeIssue:u0,EMPTY_PATH:I3,addIssueToContext:A,ParseStatus:E,INVALID:U,DIRTY:M0,OK:v,isAborted:R2,isDirty:E2,isValid:J0,isAsync:k0,get util(){return F},get objectUtil(){return _2},ZodParsedType:V,getParsedType:a,ZodType:K,datetimeRegex:W1,ZodString:x,ZodNumber:$0,ZodBigInt:X0,ZodBoolean:j0,ZodDate:Y0,ZodSymbol:C0,ZodUndefined:q0,ZodNull:O0,ZodAny:G0,ZodUnknown:e,ZodNever:p,ZodVoid:I0,ZodArray:h,ZodObject:S,ZodUnion:U0,ZodDiscriminatedUnion:i0,ZodIntersection:K0,ZodTuple:i,ZodRecord:P0,ZodMap:f0,ZodSet:B0,ZodFunction:A0,ZodLazy:N0,ZodLiteral:L0,ZodEnum:W0,ZodNativeEnum:F0,ZodPromise:w0,ZodEffects:T,ZodTransformer:T,ZodOptional:I,ZodNullable:t,ZodDefault:S0,ZodCatch:_0,ZodNaN:T0,BRAND:e3,ZodBranded:d0,ZodPipeline:g0,ZodReadonly:R0,custom:H1,Schema:K,ZodSchema:K,late:$6,get ZodFirstPartyTypeKind(){return z},coerce:g6,any:B6,array:M6,bigint:Q6,boolean:G1,date:H6,discriminatedUnion:q6,effect:t2,enum:R6,function:F6,instanceof:X6,intersection:O6,lazy:S6,literal:_6,map:N6,nan:W6,nativeEnum:E6,never:D6,null:G6,nullable:k6,number:Y1,object:A6,oboolean:T6,onumber:f6,optional:v6,ostring:P6,pipeline:I6,preprocess:C6,promise:b6,record:K6,set:L6,strictObject:V6,string:J1,symbol:J6,transformer:t2,tuple:U6,undefined:Y6,union:j6,unknown:w6,void:z6,NEVER:x6,ZodIssueCode:D,quotelessJson:k3,ZodError:C})});var v2="2025-03-26",B1,o0="2.0",w1,D1,h6,Z,P,x0,d,m,r0,z1,M1=($)=>z1.safeParse($).success,A1,V1=($)=>A1.safeParse($).success,j1,k2=($)=>j1.safeParse($).success,_,q1,O1=($)=>q1.safeParse($).success,U1,a0,t0,K1,y6,s0,p9=($)=>s0.safeParse($).success,Z6,m6,C2,e0,l6,$2,X2,W2,N1,L1,F1,n6,c6,Q2,u6,H2,p6,J2,i6,d6,o6,r6,a6,t6,s6,Y2,e6,G2,B2,w2,D2,S1,$9,X9,W9,Q9,H9,z2,J9,_1,i9,M2,Y9,R1,G9,B9,w9,D9,z9,M9,I2,A9,V9,A2,j9,q9,O9,P2,U9,d9,o9,r9,a9,t9,s9,R;var h0=F2(()=>{s();B1=[v2,"2024-11-05","2024-10-07"],w1=J.union([J.string(),J.number().int()]),D1=J.string(),h6=J.object({progressToken:J.optional(w1)}).passthrough(),Z=J.object({_meta:J.optional(h6)}).passthrough(),P=J.object({method:J.string(),params:J.optional(Z)}),x0=J.object({_meta:J.optional(J.object({}).passthrough())}).passthrough(),d=J.object({method:J.string(),params:J.optional(x0)}),m=J.object({_meta:J.optional(J.object({}).passthrough())}).passthrough(),r0=J.union([J.string(),J.number().int()]),z1=J.object({jsonrpc:J.literal(o0),id:r0}).merge(P).strict(),A1=J.object({jsonrpc:J.literal(o0)}).merge(d).strict(),j1=J.object({jsonrpc:J.literal(o0),id:r0,result:m}).strict();(function($){$[$.ConnectionClosed=-32000]="ConnectionClosed",$[$.RequestTimeout=-32001]="RequestTimeout",$[$.ParseError=-32700]="ParseError",$[$.InvalidRequest=-32600]="InvalidRequest",$[$.MethodNotFound=-32601]="MethodNotFound",$[$.InvalidParams=-32602]="InvalidParams",$[$.InternalError=-32603]="InternalError"})(_||(_={}));q1=J.object({jsonrpc:J.literal(o0),id:r0,error:J.object({code:J.number().int(),message:J.string(),data:J.optional(J.unknown())})}).strict(),U1=J.union([z1,A1,j1,q1]),a0=m.strict(),t0=d.extend({method:J.literal("notifications/cancelled"),params:x0.extend({requestId:r0,reason:J.string().optional()})}),K1=J.object({name:J.string(),version:J.string()}).passthrough(),y6=J.object({experimental:J.optional(J.object({}).passthrough()),sampling:J.optional(J.object({}).passthrough()),roots:J.optional(J.object({listChanged:J.optional(J.boolean())}).passthrough())}).passthrough(),s0=P.extend({method:J.literal("initialize"),params:Z.extend({protocolVersion:J.string(),capabilities:y6,clientInfo:K1})}),Z6=J.object({experimental:J.optional(J.object({}).passthrough()),logging:J.optional(J.object({}).passthrough()),completions:J.optional(J.object({}).passthrough()),prompts:J.optional(J.object({listChanged:J.optional(J.boolean())}).passthrough()),resources:J.optional(J.object({subscribe:J.optional(J.boolean()),listChanged:J.optional(J.boolean())}).passthrough()),tools:J.optional(J.object({listChanged:J.optional(J.boolean())}).passthrough())}).passthrough(),m6=m.extend({protocolVersion:J.string(),capabilities:Z6,serverInfo:K1,instructions:J.optional(J.string())}),C2=d.extend({method:J.literal("notifications/initialized")}),e0=P.extend({method:J.literal("ping")}),l6=J.object({progress:J.number(),total:J.optional(J.number()),message:J.optional(J.string())}).passthrough(),$2=d.extend({method:J.literal("notifications/progress"),params:x0.merge(l6).extend({progressToken:w1})}),X2=P.extend({params:Z.extend({cursor:J.optional(D1)}).optional()}),W2=m.extend({nextCursor:J.optional(D1)}),N1=J.object({uri:J.string(),mimeType:J.optional(J.string())}).passthrough(),L1=N1.extend({text:J.string()}),F1=N1.extend({blob:J.string().base64()}),n6=J.object({uri:J.string(),name:J.string(),description:J.optional(J.string()),mimeType:J.optional(J.string())}).passthrough(),c6=J.object({uriTemplate:J.string(),name:J.string(),description:J.optional(J.string()),mimeType:J.optional(J.string())}).passthrough(),Q2=X2.extend({method:J.literal("resources/list")}),u6=W2.extend({resources:J.array(n6)}),H2=X2.extend({method:J.literal("resources/templates/list")}),p6=W2.extend({resourceTemplates:J.array(c6)}),J2=P.extend({method:J.literal("resources/read"),params:Z.extend({uri:J.string()})}),i6=m.extend({contents:J.array(J.union([L1,F1]))}),d6=d.extend({method:J.literal("notifications/resources/list_changed")}),o6=P.extend({method:J.literal("resources/subscribe"),params:Z.extend({uri:J.string()})}),r6=P.extend({method:J.literal("resources/unsubscribe"),params:Z.extend({uri:J.string()})}),a6=d.extend({method:J.literal("notifications/resources/updated"),params:x0.extend({uri:J.string()})}),t6=J.object({name:J.string(),description:J.optional(J.string()),required:J.optional(J.boolean())}).passthrough(),s6=J.object({name:J.string(),description:J.optional(J.string()),arguments:J.optional(J.array(t6))}).passthrough(),Y2=X2.extend({method:J.literal("prompts/list")}),e6=W2.extend({prompts:J.array(s6)}),G2=P.extend({method:J.literal("prompts/get"),params:Z.extend({name:J.string(),arguments:J.optional(J.record(J.string()))})}),B2=J.object({type:J.literal("text"),text:J.string()}).passthrough(),w2=J.object({type:J.literal("image"),data:J.string().base64(),mimeType:J.string()}).passthrough(),D2=J.object({type:J.literal("audio"),data:J.string().base64(),mimeType:J.string()}).passthrough(),S1=J.object({type:J.literal("resource"),resource:J.union([L1,F1])}).passthrough(),$9=J.object({role:J.enum(["user","assistant"]),content:J.union([B2,w2,D2,S1])}).passthrough(),X9=m.extend({description:J.optional(J.string()),messages:J.array($9)}),W9=d.extend({method:J.literal("notifications/prompts/list_changed")}),Q9=J.object({title:J.optional(J.string()),readOnlyHint:J.optional(J.boolean()),destructiveHint:J.optional(J.boolean()),idempotentHint:J.optional(J.boolean()),openWorldHint:J.optional(J.boolean())}).passthrough(),H9=J.object({name:J.string(),description:J.optional(J.string()),inputSchema:J.object({type:J.literal("object"),properties:J.optional(J.object({}).passthrough()),required:J.optional(J.array(J.string()))}).passthrough(),outputSchema:J.optional(J.object({type:J.literal("object"),properties:J.optional(J.object({}).passthrough()),required:J.optional(J.array(J.string()))}).passthrough()),annotations:J.optional(Q9)}).passthrough(),z2=X2.extend({method:J.literal("tools/list")}),J9=W2.extend({tools:J.array(H9)}),_1=m.extend({content:J.array(J.union([B2,w2,D2,S1])).default([]),structuredContent:J.object({}).passthrough().optional(),isError:J.optional(J.boolean())}),i9=_1.or(m.extend({toolResult:J.unknown()})),M2=P.extend({method:J.literal("tools/call"),params:Z.extend({name:J.string(),arguments:J.optional(J.record(J.unknown()))})}),Y9=d.extend({method:J.literal("notifications/tools/list_changed")}),R1=J.enum(["debug","info","notice","warning","error","critical","alert","emergency"]),G9=P.extend({method:J.literal("logging/setLevel"),params:Z.extend({level:R1})}),B9=d.extend({method:J.literal("notifications/message"),params:x0.extend({level:R1,logger:J.optional(J.string()),data:J.unknown()})}),w9=J.object({name:J.string().optional()}).passthrough(),D9=J.object({hints:J.optional(J.array(w9)),costPriority:J.optional(J.number().min(0).max(1)),speedPriority:J.optional(J.number().min(0).max(1)),intelligencePriority:J.optional(J.number().min(0).max(1))}).passthrough(),z9=J.object({role:J.enum(["user","assistant"]),content:J.union([B2,w2,D2])}).passthrough(),M9=P.extend({method:J.literal("sampling/createMessage"),params:Z.extend({messages:J.array(z9),systemPrompt:J.optional(J.string()),includeContext:J.optional(J.enum(["none","thisServer","allServers"])),temperature:J.optional(J.number()),maxTokens:J.number().int(),stopSequences:J.optional(J.array(J.string())),metadata:J.optional(J.object({}).passthrough()),modelPreferences:J.optional(D9)})}),I2=m.extend({model:J.string(),stopReason:J.optional(J.enum(["endTurn","stopSequence","maxTokens"]).or(J.string())),role:J.enum(["user","assistant"]),content:J.discriminatedUnion("type",[B2,w2,D2])}),A9=J.object({type:J.literal("ref/resource"),uri:J.string()}).passthrough(),V9=J.object({type:J.literal("ref/prompt"),name:J.string()}).passthrough(),A2=P.extend({method:J.literal("completion/complete"),params:Z.extend({ref:J.union([V9,A9]),argument:J.object({name:J.string(),value:J.string()}).passthrough()})}),j9=m.extend({completion:J.object({values:J.array(J.string()).max(100),total:J.optional(J.number().int()),hasMore:J.optional(J.boolean())}).passthrough()}),q9=J.object({uri:J.string().startsWith("file://"),name:J.optional(J.string())}).passthrough(),O9=P.extend({method:J.literal("roots/list")}),P2=m.extend({roots:J.array(q9)}),U9=d.extend({method:J.literal("notifications/roots/list_changed")}),d9=J.union([e0,s0,A2,G9,G2,Y2,Q2,H2,J2,o6,r6,M2,z2]),o9=J.union([t0,$2,C2,U9]),r9=J.union([a0,I2,P2]),a9=J.union([e0,M9,O9]),t9=J.union([t0,$2,B9,a6,d6,Y9,W9]),s9=J.union([a0,m6,j9,X9,e6,u6,p6,i6,_1,J9]);R=class R extends Error{constructor($,X,W){super(`MCP error ${$}: ${X}`);this.code=$,this.data=W,this.name="McpError"}}});function f9(){let $=process.argv.join(" ");return $.includes("streamable-http.js")||$.includes("streamable-http.ts")}class D3{context;level;constructor($,X=1){this.context=$,this.level=X}setLevel($){this.level=$}log(...$){if(w3)console.log(...$);else console.error(...$)}logWarn(...$){if(w3)console.warn(...$);else console.error(...$)}debug(...$){if(this.level<=0)this.log(`[DEBUG] [${this.context}]`,...$)}info(...$){if(this.level<=1)this.log(`[INFO] [${this.context}]`,...$)}warn(...$){if(this.level<=2)this.logWarn(`[WARN] [${this.context}]`,...$)}error(...$){if(this.level<=3)console.error(`[ERROR] [${this.context}]`,...$)}}var w3,g=($,X=1)=>new D3($,X);var D0=F2(()=>{w3=f9()});h0();var K9=60000;class f2{constructor($){this._options=$,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(t0,(X)=>{let W=this._requestHandlerAbortControllers.get(X.params.requestId);W===null||W===void 0||W.abort(X.params.reason)}),this.setNotificationHandler($2,(X)=>{this._onprogress(X)}),this.setRequestHandler(e0,(X)=>({}))}_setupTimeout($,X,W,Q,H=!1){this._timeoutInfo.set($,{timeoutId:setTimeout(Q,X),startTime:Date.now(),timeout:X,maxTotalTimeout:W,resetTimeoutOnProgress:H,onTimeout:Q})}_resetTimeout($){let X=this._timeoutInfo.get($);if(!X)return!1;let W=Date.now()-X.startTime;if(X.maxTotalTimeout&&W>=X.maxTotalTimeout)throw this._timeoutInfo.delete($),new R(_.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:X.maxTotalTimeout,totalElapsed:W});return clearTimeout(X.timeoutId),X.timeoutId=setTimeout(X.onTimeout,X.timeout),!0}_cleanupTimeout($){let X=this._timeoutInfo.get($);if(X)clearTimeout(X.timeoutId),this._timeoutInfo.delete($)}async connect($){this._transport=$,this._transport.onclose=()=>{this._onclose()},this._transport.onerror=(X)=>{this._onerror(X)},this._transport.onmessage=(X,W)=>{if(k2(X)||O1(X))this._onresponse(X);else if(M1(X))this._onrequest(X,W);else if(V1(X))this._onnotification(X);else this._onerror(new Error(`Unknown message type: ${JSON.stringify(X)}`))},await this._transport.start()}_onclose(){var $;let X=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._transport=void 0,($=this.onclose)===null||$===void 0||$.call(this);let W=new R(_.ConnectionClosed,"Connection closed");for(let Q of X.values())Q(W)}_onerror($){var X;(X=this.onerror)===null||X===void 0||X.call(this,$)}_onnotification($){var X;let W=(X=this._notificationHandlers.get($.method))!==null&&X!==void 0?X:this.fallbackNotificationHandler;if(W===void 0)return;Promise.resolve().then(()=>W($)).catch((Q)=>this._onerror(new Error(`Uncaught error in notification handler: ${Q}`)))}_onrequest($,X){var W,Q,H,Y;let G=(W=this._requestHandlers.get($.method))!==null&&W!==void 0?W:this.fallbackRequestHandler;if(G===void 0){(Q=this._transport)===null||Q===void 0||Q.send({jsonrpc:"2.0",id:$.id,error:{code:_.MethodNotFound,message:"Method not found"}}).catch((M)=>this._onerror(new Error(`Failed to send an error response: ${M}`)));return}let B=new AbortController;this._requestHandlerAbortControllers.set($.id,B);let w={signal:B.signal,sessionId:(H=this._transport)===null||H===void 0?void 0:H.sessionId,_meta:(Y=$.params)===null||Y===void 0?void 0:Y._meta,sendNotification:(M)=>this.notification(M,{relatedRequestId:$.id}),sendRequest:(M,q,b)=>this.request(M,q,{...b,relatedRequestId:$.id}),authInfo:X===null||X===void 0?void 0:X.authInfo,requestId:$.id};Promise.resolve().then(()=>G($,w)).then((M)=>{var q;if(B.signal.aborted)return;return(q=this._transport)===null||q===void 0?void 0:q.send({result:M,jsonrpc:"2.0",id:$.id})},(M)=>{var q,b;if(B.signal.aborted)return;return(q=this._transport)===null||q===void 0?void 0:q.send({jsonrpc:"2.0",id:$.id,error:{code:Number.isSafeInteger(M.code)?M.code:_.InternalError,message:(b=M.message)!==null&&b!==void 0?b:"Internal error"}})}).catch((M)=>this._onerror(new Error(`Failed to send response: ${M}`))).finally(()=>{this._requestHandlerAbortControllers.delete($.id)})}_onprogress($){let{progressToken:X,...W}=$.params,Q=Number(X),H=this._progressHandlers.get(Q);if(!H){this._onerror(new Error(`Received a progress notification for an unknown token: ${JSON.stringify($)}`));return}let Y=this._responseHandlers.get(Q),G=this._timeoutInfo.get(Q);if(G&&Y&&G.resetTimeoutOnProgress)try{this._resetTimeout(Q)}catch(B){Y(B);return}H(W)}_onresponse($){let X=Number($.id),W=this._responseHandlers.get(X);if(W===void 0){this._onerror(new Error(`Received a response for an unknown message ID: ${JSON.stringify($)}`));return}if(this._responseHandlers.delete(X),this._progressHandlers.delete(X),this._cleanupTimeout(X),k2($))W($);else{let Q=new R($.error.code,$.error.message,$.error.data);W(Q)}}get transport(){return this._transport}async close(){var $;await(($=this._transport)===null||$===void 0?void 0:$.close())}request($,X,W){let{relatedRequestId:Q,resumptionToken:H,onresumptiontoken:Y}=W!==null&&W!==void 0?W:{};return new Promise((G,B)=>{var w,M,q,b,o,N2;if(!this._transport){B(new Error("Not connected"));return}if(((w=this._options)===null||w===void 0?void 0:w.enforceStrictCapabilities)===!0)this.assertCapabilityForMethod($.method);(M=W===null||W===void 0?void 0:W.signal)===null||M===void 0||M.throwIfAborted();let u=this._requestMessageId++,i2={...$,jsonrpc:"2.0",id:u};if(W===null||W===void 0?void 0:W.onprogress)this._progressHandlers.set(u,W.onprogress),i2.params={...$.params,_meta:{...((q=$.params)===null||q===void 0?void 0:q._meta)||{},progressToken:u}};let d2=(f)=>{var H0;this._responseHandlers.delete(u),this._progressHandlers.delete(u),this._cleanupTimeout(u),(H0=this._transport)===null||H0===void 0||H0.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:u,reason:String(f)}},{relatedRequestId:Q,resumptionToken:H,onresumptiontoken:Y}).catch((E0)=>this._onerror(new Error(`Failed to send cancellation: ${E0}`))),B(f)};this._responseHandlers.set(u,(f)=>{var H0;if((H0=W===null||W===void 0?void 0:W.signal)===null||H0===void 0?void 0:H0.aborted)return;if(f instanceof Error)return B(f);try{let E0=X.parse(f.result);G(E0)}catch(E0){B(E0)}}),(b=W===null||W===void 0?void 0:W.signal)===null||b===void 0||b.addEventListener("abort",()=>{var f;d2((f=W===null||W===void 0?void 0:W.signal)===null||f===void 0?void 0:f.reason)});let o2=(o=W===null||W===void 0?void 0:W.timeout)!==null&&o!==void 0?o:K9,_3=()=>d2(new R(_.RequestTimeout,"Request timed out",{timeout:o2}));this._setupTimeout(u,o2,W===null||W===void 0?void 0:W.maxTotalTimeout,_3,(N2=W===null||W===void 0?void 0:W.resetTimeoutOnProgress)!==null&&N2!==void 0?N2:!1),this._transport.send(i2,{relatedRequestId:Q,resumptionToken:H,onresumptiontoken:Y}).catch((f)=>{this._cleanupTimeout(u),B(f)})})}async notification($,X){if(!this._transport)throw new Error("Not connected");this.assertNotificationCapability($.method);let W={...$,jsonrpc:"2.0"};await this._transport.send(W,X)}setRequestHandler($,X){let W=$.shape.method.value;this.assertRequestHandlerCapability(W),this._requestHandlers.set(W,(Q,H)=>{return Promise.resolve(X($.parse(Q),H))})}removeRequestHandler($){this._requestHandlers.delete($)}assertCanSetRequestHandler($){if(this._requestHandlers.has($))throw new Error(`A request handler for ${$} already exists, which would be overridden`)}setNotificationHandler($,X){this._notificationHandlers.set($.shape.method.value,(W)=>Promise.resolve(X($.parse(W))))}removeNotificationHandler($){this._notificationHandlers.delete($)}}function E1($,X){return Object.entries(X).reduce((W,[Q,H])=>{if(H&&typeof H==="object")W[Q]=W[Q]?{...W[Q],...H}:H;else W[Q]=H;return W},{...$})}h0();class T2 extends f2{constructor($,X){var W;super(X);this._serverInfo=$,this._capabilities=(W=X===null||X===void 0?void 0:X.capabilities)!==null&&W!==void 0?W:{},this._instructions=X===null||X===void 0?void 0:X.instructions,this.setRequestHandler(s0,(Q)=>this._oninitialize(Q)),this.setNotificationHandler(C2,()=>{var Q;return(Q=this.oninitialized)===null||Q===void 0?void 0:Q.call(this)})}registerCapabilities($){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=E1(this._capabilities,$)}assertCapabilityForMethod($){var X,W;switch($){case"sampling/createMessage":if(!((X=this._clientCapabilities)===null||X===void 0?void 0:X.sampling))throw new Error(`Client does not support sampling (required for ${$})`);break;case"roots/list":if(!((W=this._clientCapabilities)===null||W===void 0?void 0:W.roots))throw new Error(`Client does not support listing roots (required for ${$})`);break;case"ping":break}}assertNotificationCapability($){switch($){case"notifications/message":if(!this._capabilities.logging)throw new Error(`Server does not support logging (required for ${$})`);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 ${$})`);break;case"notifications/tools/list_changed":if(!this._capabilities.tools)throw new Error(`Server does not support notifying of tool list changes (required for ${$})`);break;case"notifications/prompts/list_changed":if(!this._capabilities.prompts)throw new Error(`Server does not support notifying of prompt list changes (required for ${$})`);break;case"notifications/cancelled":break;case"notifications/progress":break}}assertRequestHandlerCapability($){switch($){case"sampling/createMessage":if(!this._capabilities.sampling)throw new Error(`Server does not support sampling (required for ${$})`);break;case"logging/setLevel":if(!this._capabilities.logging)throw new Error(`Server does not support logging (required for ${$})`);break;case"prompts/get":case"prompts/list":if(!this._capabilities.prompts)throw new Error(`Server does not support prompts (required for ${$})`);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 ${$})`);break;case"tools/call":case"tools/list":if(!this._capabilities.tools)throw new Error(`Server does not support tools (required for ${$})`);break;case"ping":case"initialize":break}}async _oninitialize($){let X=$.params.protocolVersion;return this._clientCapabilities=$.params.capabilities,this._clientVersion=$.params.clientInfo,{protocolVersion:B1.includes(X)?X:v2,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"},a0)}async createMessage($,X){return this.request({method:"sampling/createMessage",params:$},I2,X)}async listRoots($,X){return this.request({method:"roots/list",params:$},P2,X)}async sendLoggingMessage($){return this.notification({method:"notifications/message",params:$})}async sendResourceUpdated($){return this.notification({method:"notifications/resources/updated",params:$})}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 v1=Symbol("Let zodToJsonSchema decide on which parser to use");var b1={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"},k1=($)=>typeof $==="string"?{...b1,name:$}:{...b1,...$};var C1=($)=>{let X=k1($),W=X.name!==void 0?[...X.basePath,X.definitionPath,X.name]:X.basePath;return{...X,currentPath:W,propertyPath:void 0,seen:new Map(Object.entries(X.definitions).map(([Q,H])=>[H._def,{def:H._def,path:[...X.basePath,X.definitionPath,Q],jsonSchema:void 0}]))}};function g2($,X,W,Q){if(!Q?.errorMessages)return;if(W)$.errorMessage={...$.errorMessage,[X]:W}}function L($,X,W,Q,H){$[X]=W,g2($,X,Q,H)}s();function I1(){return{}}s();function P1($,X){let W={type:"array"};if($.type?._def&&$.type?._def?.typeName!==z.ZodAny)W.items=O($.type._def,{...X,currentPath:[...X.currentPath,"items"]});if($.minLength)L(W,"minItems",$.minLength.value,$.minLength.message,X);if($.maxLength)L(W,"maxItems",$.maxLength.value,$.maxLength.message,X);if($.exactLength)L(W,"minItems",$.exactLength.value,$.exactLength.message,X),L(W,"maxItems",$.exactLength.value,$.exactLength.message,X);return W}function f1($,X){let W={type:"integer",format:"int64"};if(!$.checks)return W;for(let Q of $.checks)switch(Q.kind){case"min":if(X.target==="jsonSchema7")if(Q.inclusive)L(W,"minimum",Q.value,Q.message,X);else L(W,"exclusiveMinimum",Q.value,Q.message,X);else{if(!Q.inclusive)W.exclusiveMinimum=!0;L(W,"minimum",Q.value,Q.message,X)}break;case"max":if(X.target==="jsonSchema7")if(Q.inclusive)L(W,"maximum",Q.value,Q.message,X);else L(W,"exclusiveMaximum",Q.value,Q.message,X);else{if(!Q.inclusive)W.exclusiveMaximum=!0;L(W,"maximum",Q.value,Q.message,X)}break;case"multipleOf":L(W,"multipleOf",Q.value,Q.message,X);break}return W}function T1(){return{type:"boolean"}}function V2($,X){return O($.type._def,X)}var g1=($,X)=>{return O($.innerType._def,X)};function x2($,X,W){let Q=W??X.dateStrategy;if(Array.isArray(Q))return{anyOf:Q.map((H,Y)=>x2($,X,H))};switch(Q){case"string":case"format:date-time":return{type:"string",format:"date-time"};case"format:date":return{type:"string",format:"date"};case"integer":return N9($,X)}}var N9=($,X)=>{let W={type:"integer",format:"unix-time"};if(X.target==="openApi3")return W;for(let Q of $.checks)switch(Q.kind){case"min":L(W,"minimum",Q.value,Q.message,X);break;case"max":L(W,"maximum",Q.value,Q.message,X);break}return W};function x1($,X){return{...O($.innerType._def,X),default:$.defaultValue()}}function h1($,X){return X.effectStrategy==="input"?O($.schema._def,X):{}}function y1($){return{type:"string",enum:Array.from($.values)}}var L9=($)=>{if("type"in $&&$.type==="string")return!1;return"allOf"in $};function Z1($,X){let W=[O($.left._def,{...X,currentPath:[...X.currentPath,"allOf","0"]}),O($.right._def,{...X,currentPath:[...X.currentPath,"allOf","1"]})].filter((Y)=>!!Y),Q=X.target==="jsonSchema2019-09"?{unevaluatedProperties:!1}:void 0,H=[];return W.forEach((Y)=>{if(L9(Y)){if(H.push(...Y.allOf),Y.unevaluatedProperties===void 0)Q=void 0}else{let G=Y;if("additionalProperties"in Y&&Y.additionalProperties===!1){let{additionalProperties:B,...w}=Y;G=w}else Q=void 0;H.push(G)}}),H.length?{allOf:H,...Q}:void 0}function m1($,X){let W=typeof $.value;if(W!=="bigint"&&W!=="number"&&W!=="boolean"&&W!=="string")return{type:Array.isArray($.value)?"array":"object"};if(X.target==="openApi3")return{type:W==="bigint"?"integer":W,enum:[$.value]};return{type:W==="bigint"?"integer":W,const:$.value}}s();var h2=void 0,l={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:()=>{if(h2===void 0)h2=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u");return h2},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 j2($,X){let W={type:"string"};if($.checks)for(let Q of $.checks)switch(Q.kind){case"min":L(W,"minLength",typeof W.minLength==="number"?Math.max(W.minLength,Q.value):Q.value,Q.message,X);break;case"max":L(W,"maxLength",typeof W.maxLength==="number"?Math.min(W.maxLength,Q.value):Q.value,Q.message,X);break;case"email":switch(X.emailStrategy){case"format:email":n(W,"email",Q.message,X);break;case"format:idn-email":n(W,"idn-email",Q.message,X);break;case"pattern:zod":k(W,l.email,Q.message,X);break}break;case"url":n(W,"uri",Q.message,X);break;case"uuid":n(W,"uuid",Q.message,X);break;case"regex":k(W,Q.regex,Q.message,X);break;case"cuid":k(W,l.cuid,Q.message,X);break;case"cuid2":k(W,l.cuid2,Q.message,X);break;case"startsWith":k(W,RegExp(`^${y2(Q.value,X)}`),Q.message,X);break;case"endsWith":k(W,RegExp(`${y2(Q.value,X)}$`),Q.message,X);break;case"datetime":n(W,"date-time",Q.message,X);break;case"date":n(W,"date",Q.message,X);break;case"time":n(W,"time",Q.message,X);break;case"duration":n(W,"duration",Q.message,X);break;case"length":L(W,"minLength",typeof W.minLength==="number"?Math.max(W.minLength,Q.value):Q.value,Q.message,X),L(W,"maxLength",typeof W.maxLength==="number"?Math.min(W.maxLength,Q.value):Q.value,Q.message,X);break;case"includes":{k(W,RegExp(y2(Q.value,X)),Q.message,X);break}case"ip":{if(Q.version!=="v6")n(W,"ipv4",Q.message,X);if(Q.version!=="v4")n(W,"ipv6",Q.message,X);break}case"base64url":k(W,l.base64url,Q.message,X);break;case"jwt":k(W,l.jwt,Q.message,X);break;case"cidr":{if(Q.version!=="v6")k(W,l.ipv4Cidr,Q.message,X);if(Q.version!=="v4")k(W,l.ipv6Cidr,Q.message,X);break}case"emoji":k(W,l.emoji(),Q.message,X);break;case"ulid":{k(W,l.ulid,Q.message,X);break}case"base64":{switch(X.base64Strategy){case"format:binary":{n(W,"binary",Q.message,X);break}case"contentEncoding:base64":{L(W,"contentEncoding","base64",Q.message,X);break}case"pattern:zod":{k(W,l.base64,Q.message,X);break}}break}case"nanoid":k(W,l.nanoid,Q.message,X);case"toLowerCase":case"toUpperCase":case"trim":break;default:((H)=>{})(Q)}return W}function y2($,X){return X.patternStrategy==="escape"?S9($):$}var F9=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function S9($){let X="";for(let W=0;W<$.length;W++){if(!F9.has($[W]))X+="\\";X+=$[W]}return X}function n($,X,W,Q){if($.format||$.anyOf?.some((H)=>H.format)){if(!$.anyOf)$.anyOf=[];if($.format){if($.anyOf.push({format:$.format,...$.errorMessage&&Q.errorMessages&&{errorMessage:{format:$.errorMessage.format}}}),delete $.format,$.errorMessage){if(delete $.errorMessage.format,Object.keys($.errorMessage).length===0)delete $.errorMessage}}$.anyOf.push({format:X,...W&&Q.errorMessages&&{errorMessage:{format:W}}})}else L($,"format",X,W,Q)}function k($,X,W,Q){if($.pattern||$.allOf?.some((H)=>H.pattern)){if(!$.allOf)$.allOf=[];if($.pattern){if($.allOf.push({pattern:$.pattern,...$.errorMessage&&Q.errorMessages&&{errorMessage:{pattern:$.errorMessage.pattern}}}),delete $.pattern,$.errorMessage){if(delete $.errorMessage.pattern,Object.keys($.errorMessage).length===0)delete $.errorMessage}}$.allOf.push({pattern:l1(X,Q),...W&&Q.errorMessages&&{errorMessage:{pattern:W}}})}else L($,"pattern",l1(X,Q),W,Q)}function l1($,X){if(!X.applyRegexFlags||!$.flags)return $.source;let W={i:$.flags.includes("i"),m:$.flags.includes("m"),s:$.flags.includes("s")},Q=W.i?$.source.toLowerCase():$.source,H="",Y=!1,G=!1,B=!1;for(let w=0;w<Q.length;w++){if(Y){H+=Q[w],Y=!1;continue}if(W.i){if(G){if(Q[w].match(/[a-z]/)){if(B)H+=Q[w],H+=`${Q[w-2]}-${Q[w]}`.toUpperCase(),B=!1;else if(Q[w+1]==="-"&&Q[w+2]?.match(/[a-z]/))H+=Q[w],B=!0;else H+=`${Q[w]}${Q[w].toUpperCase()}`;continue}}else if(Q[w].match(/[a-z]/)){H+=`[${Q[w]}${Q[w].toUpperCase()}]`;continue}}if(W.m){if(Q[w]==="^"){H+=`(^|(?<=[\r
|
3
3
|
]))`;continue}else if(Q[w]==="$"){H+=`($|(?=[\r
|
4
4
|
]))`;continue}}if(W.s&&Q[w]==="."){H+=G?`${Q[w]}\r
|
5
5
|
`:`[${Q[w]}\r
|
6
|
-
]`;continue}if(H+=Q[w],Q[w]==="\\")Y=!0;else if(G&&Q[w]==="]")G=!1;else if(!G&&Q[w]==="[")G=!0}try{new RegExp(H)}catch{return console.warn(`Could not convert regex pattern at ${X.currentPath.join("/")} to a flag-independent form! Falling back to the flag-ignorant source`),$.source}return H}function O1($,X){if(X.target==="openAi")console.warn("Warning: OpenAI may not support records in schemas! Try an array of key-value pairs instead.");if(X.target==="openApi3"&&$.keyType?._def.typeName===z.ZodEnum)return{type:"object",required:$.keyType._def.values,properties:$.keyType._def.values.reduce((Q,H)=>({...Q,[H]:O($.valueType._def,{...X,currentPath:[...X.currentPath,"properties",H]})??{}}),{}),additionalProperties:X.rejectedAdditionalProperties};let W={type:"object",additionalProperties:O($.valueType._def,{...X,currentPath:[...X.currentPath,"additionalProperties"]})??X.allowedAdditionalProperties};if(X.target==="openApi3")return W;if($.keyType?._def.typeName===z.ZodString&&$.keyType._def.checks?.length){let{type:Q,...H}=q1($.keyType._def,X);return{...W,propertyNames:H}}else if($.keyType?._def.typeName===z.ZodEnum)return{...W,propertyNames:{enum:$.keyType._def.values}};else if($.keyType?._def.typeName===z.ZodBranded&&$.keyType._def.type._def.typeName===z.ZodString&&$.keyType._def.type._def.checks?.length){let{type:Q,...H}=j1($.keyType._def,X);return{...W,propertyNames:H}}return W}function n$($,X){if(X.mapStrategy==="record")return O1($,X);let W=O($.keyType._def,{...X,currentPath:[...X.currentPath,"items","items","0"]})||{},Q=O($.valueType._def,{...X,currentPath:[...X.currentPath,"items","items","1"]})||{};return{type:"array",maxItems:125,items:{type:"array",items:[W,Q],minItems:2,maxItems:2}}}function c$($){let X=$.values,Q=Object.keys($.values).filter((Y)=>{return typeof X[X[Y]]!=="number"}).map((Y)=>X[Y]),H=Array.from(new Set(Q.map((Y)=>typeof Y)));return{type:H.length===1?H[0]==="string"?"string":"number":["string","number"],enum:Q}}function u$(){return{not:{}}}function p$($){return $.target==="openApi3"?{enum:["null"],nullable:!0}:{type:"null"}}var y0={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};function d$($,X){if(X.target==="openApi3")return i$($,X);let W=$.options instanceof Map?Array.from($.options.values()):$.options;if(W.every((Q)=>(Q._def.typeName in y0)&&(!Q._def.checks||!Q._def.checks.length))){let Q=W.reduce((H,Y)=>{let G=y0[Y._def.typeName];return G&&!H.includes(G)?[...H,G]:H},[]);return{type:Q.length>1?Q:Q[0]}}else if(W.every((Q)=>Q._def.typeName==="ZodLiteral"&&!Q.description)){let Q=W.reduce((H,Y)=>{let G=typeof Y._def.value;switch(G){case"string":case"number":case"boolean":return[...H,G];case"bigint":return[...H,"integer"];case"object":if(Y._def.value===null)return[...H,"null"];case"symbol":case"undefined":case"function":default:return H}},[]);if(Q.length===W.length){let H=Q.filter((Y,G,B)=>B.indexOf(Y)===G);return{type:H.length>1?H:H[0],enum:W.reduce((Y,G)=>{return Y.includes(G._def.value)?Y:[...Y,G._def.value]},[])}}}else if(W.every((Q)=>Q._def.typeName==="ZodEnum"))return{type:"string",enum:W.reduce((Q,H)=>[...Q,...H._def.values.filter((Y)=>!Q.includes(Y))],[])};return i$($,X)}var i$=($,X)=>{let W=($.options instanceof Map?Array.from($.options.values()):$.options).map((Q,H)=>O(Q._def,{...X,currentPath:[...X.currentPath,"anyOf",`${H}`]})).filter((Q)=>!!Q&&(!X.strictUnions||typeof Q==="object"&&Object.keys(Q).length>0));return W.length?{anyOf:W}:void 0};function o$($,X){if(["ZodString","ZodNumber","ZodBigInt","ZodBoolean","ZodNull"].includes($.innerType._def.typeName)&&(!$.innerType._def.checks||!$.innerType._def.checks.length)){if(X.target==="openApi3")return{type:y0[$.innerType._def.typeName],nullable:!0};return{type:[y0[$.innerType._def.typeName],"null"]}}if(X.target==="openApi3"){let Q=O($.innerType._def,{...X,currentPath:[...X.currentPath]});if(Q&&"$ref"in Q)return{allOf:[Q],nullable:!0};return Q&&{...Q,nullable:!0}}let W=O($.innerType._def,{...X,currentPath:[...X.currentPath,"anyOf","0"]});return W&&{anyOf:[W,{type:"null"}]}}function r$($,X){let W={type:"number"};if(!$.checks)return W;for(let Q of $.checks)switch(Q.kind){case"int":W.type="integer",g1(W,"type",Q.message,X);break;case"min":if(X.target==="jsonSchema7")if(Q.inclusive)L(W,"minimum",Q.value,Q.message,X);else L(W,"exclusiveMinimum",Q.value,Q.message,X);else{if(!Q.inclusive)W.exclusiveMinimum=!0;L(W,"minimum",Q.value,Q.message,X)}break;case"max":if(X.target==="jsonSchema7")if(Q.inclusive)L(W,"maximum",Q.value,Q.message,X);else L(W,"exclusiveMaximum",Q.value,Q.message,X);else{if(!Q.inclusive)W.exclusiveMaximum=!0;L(W,"maximum",Q.value,Q.message,X)}break;case"multipleOf":L(W,"multipleOf",Q.value,Q.message,X);break}return W}d();function a$($,X){let W=X.target==="openAi",Q={type:"object",properties:{}},H=[],Y=$.shape();for(let B in Y){let w=Y[B];if(w===void 0||w._def===void 0)continue;let M=E6(w);if(M&&W){if(w instanceof I)w=w._def.innerType;if(!w.isNullable())w=w.nullable();M=!1}let q=O(w._def,{...X,currentPath:[...X.currentPath,"properties",B],propertyPath:[...X.currentPath,"properties",B]});if(q===void 0)continue;if(Q.properties[B]=q,!M)H.push(B)}if(H.length)Q.required=H;let G=R6($,X);if(G!==void 0)Q.additionalProperties=G;return Q}function R6($,X){if($.catchall._def.typeName!=="ZodNever")return O($.catchall._def,{...X,currentPath:[...X.currentPath,"additionalProperties"]});switch($.unknownKeys){case"passthrough":return X.allowedAdditionalProperties;case"strict":return X.rejectedAdditionalProperties;case"strip":return X.removeAdditionalStrategy==="strict"?X.allowedAdditionalProperties:X.rejectedAdditionalProperties}}function E6($){try{return $.isOptional()}catch{return!0}}var t$=($,X)=>{if(X.currentPath.toString()===X.propertyPath?.toString())return O($.innerType._def,X);let W=O($.innerType._def,{...X,currentPath:[...X.currentPath,"anyOf","1"]});return W?{anyOf:[{not:{}},W]}:{}};var s$=($,X)=>{if(X.pipeStrategy==="input")return O($.in._def,X);else if(X.pipeStrategy==="output")return O($.out._def,X);let W=O($.in._def,{...X,currentPath:[...X.currentPath,"allOf","0"]}),Q=O($.out._def,{...X,currentPath:[...X.currentPath,"allOf",W?"1":"0"]});return{allOf:[W,Q].filter((H)=>H!==void 0)}};function e$($,X){return O($.type._def,X)}function $2($,X){let Q={type:"array",uniqueItems:!0,items:O($.valueType._def,{...X,currentPath:[...X.currentPath,"items"]})};if($.minSize)L(Q,"minItems",$.minSize.value,$.minSize.message,X);if($.maxSize)L(Q,"maxItems",$.maxSize.value,$.maxSize.message,X);return Q}function X2($,X){if($.rest)return{type:"array",minItems:$.items.length,items:$.items.map((W,Q)=>O(W._def,{...X,currentPath:[...X.currentPath,"items",`${Q}`]})).reduce((W,Q)=>Q===void 0?W:[...W,Q],[]),additionalItems:O($.rest._def,{...X,currentPath:[...X.currentPath,"additionalItems"]})};else return{type:"array",minItems:$.items.length,maxItems:$.items.length,items:$.items.map((W,Q)=>O(W._def,{...X,currentPath:[...X.currentPath,"items",`${Q}`]})).reduce((W,Q)=>Q===void 0?W:[...W,Q],[])}}function W2(){return{not:{}}}function Q2(){return{}}var H2=($,X)=>{return O($.innerType._def,X)};var J2=($,X,W)=>{switch(X){case z.ZodString:return q1($,W);case z.ZodNumber:return r$($,W);case z.ZodObject:return a$($,W);case z.ZodBigInt:return f$($,W);case z.ZodBoolean:return T$();case z.ZodDate:return x1($,W);case z.ZodUndefined:return W2();case z.ZodNull:return p$(W);case z.ZodArray:return P$($,W);case z.ZodUnion:case z.ZodDiscriminatedUnion:return d$($,W);case z.ZodIntersection:return Z$($,W);case z.ZodTuple:return X2($,W);case z.ZodRecord:return O1($,W);case z.ZodLiteral:return m$($,W);case z.ZodEnum:return y$($);case z.ZodNativeEnum:return c$($);case z.ZodNullable:return o$($,W);case z.ZodOptional:return t$($,W);case z.ZodMap:return n$($,W);case z.ZodSet:return $2($,W);case z.ZodLazy:return()=>$.getter()._def;case z.ZodPromise:return e$($,W);case z.ZodNaN:case z.ZodNever:return u$();case z.ZodEffects:return h$($,W);case z.ZodAny:return I$();case z.ZodUnknown:return Q2();case z.ZodDefault:return x$($,W);case z.ZodBranded:return j1($,W);case z.ZodReadonly:return H2($,W);case z.ZodCatch:return g$($,W);case z.ZodPipeline:return s$($,W);case z.ZodFunction:case z.ZodVoid:case z.ZodSymbol:return;default:return((Q)=>{return})(X)}};function O($,X,W=!1){let Q=X.seen.get($);if(X.override){let B=X.override?.($,X,Q,W);if(B!==v$)return B}if(Q&&!W){let B=b6(Q,X);if(B!==void 0)return B}let H={def:$,path:X.currentPath,jsonSchema:void 0};X.seen.set($,H);let Y=J2($,$.typeName,X),G=typeof Y==="function"?O(Y(),X):Y;if(G)k6($,X,G);if(X.postProcess){let B=X.postProcess(G,$,X);return H.jsonSchema=G,B}return H.jsonSchema=G,G}var b6=($,X)=>{switch(X.$refStrategy){case"root":return{$ref:$.path.join("/")};case"relative":return{$ref:v6(X.currentPath,$.path)};case"none":case"seen":{if($.path.length<X.currentPath.length&&$.path.every((W,Q)=>X.currentPath[Q]===W))return console.warn(`Recursive reference detected at ${X.currentPath.join("/")}! Defaulting to any`),{};return X.$refStrategy==="seen"?{}:void 0}}},v6=($,X)=>{let W=0;for(;W<$.length&&W<X.length;W++)if($[W]!==X[W])break;return[($.length-W).toString(),...X.slice(W)].join("/")},k6=($,X,W)=>{if($.description){if(W.description=$.description,X.markdownDescription)W.markdownDescription=$.description}return W};var U1=($,X)=>{let W=C$(X),Q=typeof X==="object"&&X.definitions?Object.entries(X.definitions).reduce((w,[M,q])=>({...w,[M]:O(q._def,{...W,currentPath:[...W.basePath,W.definitionPath,M]},!0)??{}}),{}):void 0,H=typeof X==="string"?X:X?.nameStrategy==="title"?void 0:X?.name,Y=O($._def,H===void 0?W:{...W,currentPath:[...W.basePath,W.definitionPath,H]},!1)??{},G=typeof X==="object"&&X.name!==void 0&&X.nameStrategy==="title"?X.name:void 0;if(G!==void 0)Y.title=G;let B=H===void 0?Q?{...Y,[W.definitionPath]:Q}:Y:{$ref:[...W.$refStrategy==="relative"?[]:W.basePath,W.definitionPath,H].join("/"),[W.definitionPath]:{...Q,[H]:Y}};if(W.target==="jsonSchema7")B.$schema="http://json-schema.org/draft-07/schema#";else if(W.target==="jsonSchema2019-09"||W.target==="openAi")B.$schema="https://json-schema.org/draft/2019-09/schema#";if(W.target==="openAi"&&(("anyOf"in B)||("oneOf"in B)||("allOf"in B)||("type"in B)&&Array.isArray(B.type)))console.warn("Warning: OpenAI may not support schemas with unions as roots! Try wrapping it in an object property.");return B};d();h0();d();var Z1;(function($){$.Completable="McpCompletable"})(Z1||(Z1={}));class Z0 extends K{_parse($){let{ctx:X}=this._processInputParams($),W=X.data;return this._def.type._parse({data:W,path:X.path,parent:X})}unwrap(){return this._def.type}}Z0.create=($,X)=>{return new Z0({type:$,typeName:Z1.Completable,complete:X.complete,...C6(X)})};function C6($){if(!$)return{};let{errorMap:X,invalid_type_error:W,required_error:Q,description:H}=$;if(X&&(W||Q))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);if(X)return{errorMap:X,description:H};return{errorMap:(G,B)=>{var w,M;let{message:q}=$;if(G.code==="invalid_enum_value")return{message:q!==null&&q!==void 0?q:B.defaultError};if(typeof B.data==="undefined")return{message:(w=q!==null&&q!==void 0?q:Q)!==null&&w!==void 0?w:B.defaultError};if(G.code!=="invalid_type")return{message:B.defaultError};return{message:(M=q!==null&&q!==void 0?q:W)!==null&&M!==void 0?M:B.defaultError}},description:H}}class m1{constructor($,X){this._registeredResources={},this._registeredResourceTemplates={},this._registeredTools={},this._registeredPrompts={},this._toolHandlersInitialized=!1,this._completionHandlerInitialized=!1,this._resourceHandlersInitialized=!1,this._promptHandlersInitialized=!1,this.server=new T1($,X)}async connect($){return await this.server.connect($)}async close(){await this.server.close()}setToolRequestHandlers(){if(this._toolHandlersInitialized)return;this.server.assertCanSetRequestHandler(M1.shape.method.value),this.server.assertCanSetRequestHandler(A1.shape.method.value),this.server.registerCapabilities({tools:{listChanged:!0}}),this.server.setRequestHandler(M1,()=>({tools:Object.entries(this._registeredTools).filter(([,$])=>$.enabled).map(([$,X])=>{let W={name:$,description:X.description,inputSchema:X.inputSchema?U1(X.inputSchema,{strictUnions:!0}):I6,annotations:X.annotations};if(X.outputSchema)W.outputSchema=U1(X.outputSchema,{strictUnions:!0});return W})})),this.server.setRequestHandler(A1,async($,X)=>{let W=this._registeredTools[$.params.name];if(!W)throw new R(_.InvalidParams,`Tool ${$.params.name} not found`);if(!W.enabled)throw new R(_.InvalidParams,`Tool ${$.params.name} disabled`);let Q;if(W.inputSchema){let H=await W.inputSchema.safeParseAsync($.params.arguments);if(!H.success)throw new R(_.InvalidParams,`Invalid arguments for tool ${$.params.name}: ${H.error.message}`);let Y=H.data,G=W.callback;try{Q=await Promise.resolve(G(Y,X))}catch(B){Q={content:[{type:"text",text:B instanceof Error?B.message:String(B)}],isError:!0}}}else{let H=W.callback;try{Q=await Promise.resolve(H(X))}catch(Y){Q={content:[{type:"text",text:Y instanceof Error?Y.message:String(Y)}],isError:!0}}}if(W.outputSchema){if(!Q.structuredContent)throw new R(_.InvalidParams,`Tool ${$.params.name} has an output schema but no structured content was provided`);let H=await W.outputSchema.safeParseAsync(Q.structuredContent);if(!H.success)throw new R(_.InvalidParams,`Invalid structured content for tool ${$.params.name}: ${H.error.message}`)}return Q}),this._toolHandlersInitialized=!0}setCompletionRequestHandler(){if(this._completionHandlerInitialized)return;this.server.assertCanSetRequestHandler(V1.shape.method.value),this.server.setRequestHandler(V1,async($)=>{switch($.params.ref.type){case"ref/prompt":return this.handlePromptCompletion($,$.params.ref);case"ref/resource":return this.handleResourceCompletion($,$.params.ref);default:throw new R(_.InvalidParams,`Invalid completion reference: ${$.params.ref}`)}}),this._completionHandlerInitialized=!0}async handlePromptCompletion($,X){let W=this._registeredPrompts[X.name];if(!W)throw new R(_.InvalidParams,`Prompt ${X.name} not found`);if(!W.enabled)throw new R(_.InvalidParams,`Prompt ${X.name} disabled`);if(!W.argsSchema)return K1;let Q=W.argsSchema.shape[$.params.argument.name];if(!(Q instanceof Z0))return K1;let Y=await Q._def.complete($.params.argument.value);return G2(Y)}async handleResourceCompletion($,X){let W=Object.values(this._registeredResourceTemplates).find((Y)=>Y.resourceTemplate.uriTemplate.toString()===X.uri);if(!W){if(this._registeredResources[X.uri])return K1;throw new R(_.InvalidParams,`Resource template ${$.params.ref.uri} not found`)}let Q=W.resourceTemplate.completeCallback($.params.argument.name);if(!Q)return K1;let H=await Q($.params.argument.value);return G2(H)}setResourceRequestHandlers(){if(this._resourceHandlersInitialized)return;this.server.assertCanSetRequestHandler(H1.shape.method.value),this.server.assertCanSetRequestHandler(J1.shape.method.value),this.server.assertCanSetRequestHandler(Y1.shape.method.value),this.server.registerCapabilities({resources:{listChanged:!0}}),this.server.setRequestHandler(H1,async($,X)=>{let W=Object.entries(this._registeredResources).filter(([H,Y])=>Y.enabled).map(([H,Y])=>({uri:H,name:Y.name,...Y.metadata})),Q=[];for(let H of Object.values(this._registeredResourceTemplates)){if(!H.resourceTemplate.listCallback)continue;let Y=await H.resourceTemplate.listCallback(X);for(let G of Y.resources)Q.push({...G,...H.metadata})}return{resources:[...W,...Q]}}),this.server.setRequestHandler(J1,async()=>{return{resourceTemplates:Object.entries(this._registeredResourceTemplates).map(([X,W])=>({name:X,uriTemplate:W.resourceTemplate.uriTemplate.toString(),...W.metadata}))}}),this.server.setRequestHandler(Y1,async($,X)=>{let W=new URL($.params.uri),Q=this._registeredResources[W.toString()];if(Q){if(!Q.enabled)throw new R(_.InvalidParams,`Resource ${W} disabled`);return Q.readCallback(W,X)}for(let H of Object.values(this._registeredResourceTemplates)){let Y=H.resourceTemplate.uriTemplate.match(W.toString());if(Y)return H.readCallback(W,Y,X)}throw new R(_.InvalidParams,`Resource ${W} not found`)}),this.setCompletionRequestHandler(),this._resourceHandlersInitialized=!0}setPromptRequestHandlers(){if(this._promptHandlersInitialized)return;this.server.assertCanSetRequestHandler(G1.shape.method.value),this.server.assertCanSetRequestHandler(B1.shape.method.value),this.server.registerCapabilities({prompts:{listChanged:!0}}),this.server.setRequestHandler(G1,()=>({prompts:Object.entries(this._registeredPrompts).filter(([,$])=>$.enabled).map(([$,X])=>{return{name:$,description:X.description,arguments:X.argsSchema?f6(X.argsSchema):void 0}})})),this.server.setRequestHandler(B1,async($,X)=>{let W=this._registeredPrompts[$.params.name];if(!W)throw new R(_.InvalidParams,`Prompt ${$.params.name} not found`);if(!W.enabled)throw new R(_.InvalidParams,`Prompt ${$.params.name} disabled`);if(W.argsSchema){let Q=await W.argsSchema.safeParseAsync($.params.arguments);if(!Q.success)throw new R(_.InvalidParams,`Invalid arguments for prompt ${$.params.name}: ${Q.error.message}`);let H=Q.data,Y=W.callback;return await Promise.resolve(Y(H,X))}else{let Q=W.callback;return await Promise.resolve(Q(X))}}),this.setCompletionRequestHandler(),this._promptHandlersInitialized=!0}resource($,X,...W){let Q;if(typeof W[0]==="object")Q=W.shift();let H=W[0];if(typeof X==="string"){if(this._registeredResources[X])throw new Error(`Resource ${X} is already registered`);let Y={name:$,metadata:Q,readCallback:H,enabled:!0,disable:()=>Y.update({enabled:!1}),enable:()=>Y.update({enabled:!0}),remove:()=>Y.update({uri:null}),update:(G)=>{if(typeof G.uri!=="undefined"&&G.uri!==X){if(delete this._registeredResources[X],G.uri)this._registeredResources[G.uri]=Y}if(typeof G.name!=="undefined")Y.name=G.name;if(typeof G.metadata!=="undefined")Y.metadata=G.metadata;if(typeof G.callback!=="undefined")Y.readCallback=G.callback;if(typeof G.enabled!=="undefined")Y.enabled=G.enabled;this.sendResourceListChanged()}};return this._registeredResources[X]=Y,this.setResourceRequestHandlers(),this.sendResourceListChanged(),Y}else{if(this._registeredResourceTemplates[$])throw new Error(`Resource template ${$} is already registered`);let Y={resourceTemplate:X,metadata:Q,readCallback:H,enabled:!0,disable:()=>Y.update({enabled:!1}),enable:()=>Y.update({enabled:!0}),remove:()=>Y.update({name:null}),update:(G)=>{if(typeof G.name!=="undefined"&&G.name!==$){if(delete this._registeredResourceTemplates[$],G.name)this._registeredResourceTemplates[G.name]=Y}if(typeof G.template!=="undefined")Y.resourceTemplate=G.template;if(typeof G.metadata!=="undefined")Y.metadata=G.metadata;if(typeof G.callback!=="undefined")Y.readCallback=G.callback;if(typeof G.enabled!=="undefined")Y.enabled=G.enabled;this.sendResourceListChanged()}};return this._registeredResourceTemplates[$]=Y,this.setResourceRequestHandlers(),this.sendResourceListChanged(),Y}}_createRegisteredTool($,X,W,Q,H,Y){let G={description:X,inputSchema:W===void 0?void 0:J.object(W),outputSchema:Q===void 0?void 0:J.object(Q),annotations:H,callback:Y,enabled:!0,disable:()=>G.update({enabled:!1}),enable:()=>G.update({enabled:!0}),remove:()=>G.update({name:null}),update:(B)=>{if(typeof B.name!=="undefined"&&B.name!==$){if(delete this._registeredTools[$],B.name)this._registeredTools[B.name]=G}if(typeof B.description!=="undefined")G.description=B.description;if(typeof B.paramsSchema!=="undefined")G.inputSchema=J.object(B.paramsSchema);if(typeof B.callback!=="undefined")G.callback=B.callback;if(typeof B.annotations!=="undefined")G.annotations=B.annotations;if(typeof B.enabled!=="undefined")G.enabled=B.enabled;this.sendToolListChanged()}};return this._registeredTools[$]=G,this.setToolRequestHandlers(),this.sendToolListChanged(),G}tool($,...X){if(this._registeredTools[$])throw new Error(`Tool ${$} is already registered`);let W,Q,H,Y;if(typeof X[0]==="string")W=X.shift();if(X.length>1){let B=X[0];if(Y2(B)){if(Q=X.shift(),X.length>1&&typeof X[0]==="object"&&X[0]!==null&&!Y2(X[0]))Y=X.shift()}else if(typeof B==="object"&&B!==null)Y=X.shift()}let G=X[0];return this._createRegisteredTool($,W,Q,H,Y,G)}registerTool($,X,W){if(this._registeredTools[$])throw new Error(`Tool ${$} is already registered`);let{description:Q,inputSchema:H,outputSchema:Y,annotations:G}=X;return this._createRegisteredTool($,Q,H,Y,G,W)}prompt($,...X){if(this._registeredPrompts[$])throw new Error(`Prompt ${$} is already registered`);let W;if(typeof X[0]==="string")W=X.shift();let Q;if(X.length>1)Q=X.shift();let H=X[0],Y={description:W,argsSchema:Q===void 0?void 0:J.object(Q),callback:H,enabled:!0,disable:()=>Y.update({enabled:!1}),enable:()=>Y.update({enabled:!0}),remove:()=>Y.update({name:null}),update:(G)=>{if(typeof G.name!=="undefined"&&G.name!==$){if(delete this._registeredPrompts[$],G.name)this._registeredPrompts[G.name]=Y}if(typeof G.description!=="undefined")Y.description=G.description;if(typeof G.argsSchema!=="undefined")Y.argsSchema=J.object(G.argsSchema);if(typeof G.callback!=="undefined")Y.callback=G.callback;if(typeof G.enabled!=="undefined")Y.enabled=G.enabled;this.sendPromptListChanged()}};return this._registeredPrompts[$]=Y,this.setPromptRequestHandlers(),this.sendPromptListChanged(),Y}isConnected(){return this.server.transport!==void 0}sendResourceListChanged(){if(this.isConnected())this.server.sendResourceListChanged()}sendToolListChanged(){if(this.isConnected())this.server.sendToolListChanged()}sendPromptListChanged(){if(this.isConnected())this.server.sendPromptListChanged()}}var I6={type:"object"};function Y2($){if(typeof $!=="object"||$===null)return!1;return Object.keys($).length===0||Object.values($).some(P6)}function P6($){return $!==null&&typeof $==="object"&&"parse"in $&&typeof $.parse==="function"&&"safeParse"in $&&typeof $.safeParse==="function"}function f6($){return Object.entries($.shape).map(([X,W])=>({name:X,description:W.description,required:!W.isOptional()}))}function G2($){return{completion:{values:$.slice(0,100),total:$.length,hasMore:$.length>100}}}var K1={completion:{values:[],hasMore:!1}};function B2($,X){let W=process.argv,Q=`--${$}=`;for(let H of W)if(H.startsWith(Q))return H.substring(Q.length);return X}D0();var x6=g("FigmaConfig",1),m0=B2("figma-api-key")||process.env.FIGMA_API_KEY||"",z2="F2C MCP",M2=process.env.FIGMA_VERSION||"0.0.1";x6.debug("DEFAULT_PERSONAL_TOKEN",m0);D0();var A2=g("F2cApi",1);class V2{f2cHost="https://f2c-figma-api.yy.com/api";personalToken=m0;async nodeToCode($){let X={fileKey:$.fileKey,nodeIds:$.ids,personal_token:$.personalToken||this.personalToken,option:{cssFramework:"inlinecss",imgFormat:$.imgFormat||"png",scaleSize:$.scaleSize||2},format:"files"};if($.format==="react-cssmodules")X.option.cssFramework="cssmodules";else if($.format==="react-tailwind")X.option.cssFramework="tailwindcss";let W=this.opToUrl(`${this.f2cHost}/nodes`,X);return this.fetch(W,"json")}async fetch($,X="json"){try{let W={method:"GET"};A2.debug("fetch",$);let Q=await fetch($,W);if(!Q.ok)throw new Error(`HTTP error! status: ${Q.status}`);return X==="text"?await Q.text():await Q.json()}catch(W){throw A2.error("HTTP error",W),W}}opToUrl($,X={}){if(Object.keys(X).length===0)return $;let W=new URL($);for(let[Q,H]of Object.entries(X))if(typeof H==="object"&&H!==null)for(let[Y,G]of Object.entries(H))W.searchParams.append(`${Q}[${Y}]`,G);else W.searchParams.append(Q,H);return W.toString()}}var j2=new V2;D0();d();var l0=c0(require("fs")),Q0=c0(require("path")),l1=c0(require("fs/promises"));D0();var c=g("Downloader");class q2{op;assetsPath="";savePath="";setup($){if(this.op=$,this.op.localPath)this.assetsPath=Q0.default.join(this.op.localPath,"assets"),this.savePath=this.op.localPath}async downloadImage($,X){let{imgFormat:W}=this.op,Q=this.assetsPath;try{if(!l0.default.existsSync(Q))l0.default.mkdirSync(Q,{recursive:!0});let H=`${X}.${W}`,Y=Q0.default.join(Q,H),G=await fetch($);if(!G.ok)throw new Error(`下载失败: ${G.status} ${G.statusText}`);let B=await G.arrayBuffer();return l0.default.writeFileSync(Y,new Uint8Array(B)),Q0.default.join(Q0.default.basename(Q),H).replace(/\\/g,"/")}catch(H){throw c.error("图片下载错误:",H),H}}async downLoadImageAndReplaceContent($){try{let X=/https:\/\/figma-alpha-api\.s3\.us-west-2\.amazonaws\.com\/images\/[a-f0-9-]+/g,W=$.match(X);if(!W)return $;let Q=[...new Set(W)],H=new Map;await Promise.all(Q.map(async(G)=>{let B=Q0.default.basename(G),w=await this.downloadImage(G,B);H.set(G,w)}));let Y=$;for(let[G,B]of H.entries()){let w=new RegExp(G.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),"g");Y=Y.replace(w,B)}return Y}catch(X){throw c.error("内容处理错误:",X),X}}async checkLocalAndDownload($){if(!this.op.localPath)return;await Promise.all($.map(async(X)=>{X.content=await this.downLoadImageAndReplaceContent(X.content)}));for(let X of $)try{let W=await this.saveContentToFile(X.content,X.path);c.debug(`Successfully saved: ${W}`)}catch(W){c.error(`Failed to save file ${X.path}:`,W)}}async ensureDirectoryExists($){if(!l0.default.existsSync($))c.debug(`Creating directory: ${$}`),await l1.default.mkdir($,{recursive:!0})}async saveContentToFile($,X){try{let W=Q0.default.join(this.savePath,X),Q=Q0.default.dirname(W);if(c.debug(`Full path: ${W}, directory: ${Q}`),await this.ensureDirectoryExists(Q),X.endsWith(".html"))c.debug("Wrapping content with HTML template"),$=this.wrapHtmlContent($);return c.debug(`Writing ${$.length} bytes to file`),await l1.default.writeFile(W,$),c.info(`File saved: ${W}`),W}catch(W){throw c.error("File save error:",X,W),W}}wrapHtmlContent($){return c.debug("Wrapping content with HTML template"),`<!DOCTYPE html>
|
6
|
+
]`;continue}if(H+=Q[w],Q[w]==="\\")Y=!0;else if(G&&Q[w]==="]")G=!1;else if(!G&&Q[w]==="[")G=!0}try{new RegExp(H)}catch{return console.warn(`Could not convert regex pattern at ${X.currentPath.join("/")} to a flag-independent form! Falling back to the flag-ignorant source`),$.source}return H}function q2($,X){if(X.target==="openAi")console.warn("Warning: OpenAI may not support records in schemas! Try an array of key-value pairs instead.");if(X.target==="openApi3"&&$.keyType?._def.typeName===z.ZodEnum)return{type:"object",required:$.keyType._def.values,properties:$.keyType._def.values.reduce((Q,H)=>({...Q,[H]:O($.valueType._def,{...X,currentPath:[...X.currentPath,"properties",H]})??{}}),{}),additionalProperties:X.rejectedAdditionalProperties};let W={type:"object",additionalProperties:O($.valueType._def,{...X,currentPath:[...X.currentPath,"additionalProperties"]})??X.allowedAdditionalProperties};if(X.target==="openApi3")return W;if($.keyType?._def.typeName===z.ZodString&&$.keyType._def.checks?.length){let{type:Q,...H}=j2($.keyType._def,X);return{...W,propertyNames:H}}else if($.keyType?._def.typeName===z.ZodEnum)return{...W,propertyNames:{enum:$.keyType._def.values}};else if($.keyType?._def.typeName===z.ZodBranded&&$.keyType._def.type._def.typeName===z.ZodString&&$.keyType._def.type._def.checks?.length){let{type:Q,...H}=V2($.keyType._def,X);return{...W,propertyNames:H}}return W}function n1($,X){if(X.mapStrategy==="record")return q2($,X);let W=O($.keyType._def,{...X,currentPath:[...X.currentPath,"items","items","0"]})||{},Q=O($.valueType._def,{...X,currentPath:[...X.currentPath,"items","items","1"]})||{};return{type:"array",maxItems:125,items:{type:"array",items:[W,Q],minItems:2,maxItems:2}}}function c1($){let X=$.values,Q=Object.keys($.values).filter((Y)=>{return typeof X[X[Y]]!=="number"}).map((Y)=>X[Y]),H=Array.from(new Set(Q.map((Y)=>typeof Y)));return{type:H.length===1?H[0]==="string"?"string":"number":["string","number"],enum:Q}}function u1(){return{not:{}}}function p1($){return $.target==="openApi3"?{enum:["null"],nullable:!0}:{type:"null"}}var y0={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};function d1($,X){if(X.target==="openApi3")return i1($,X);let W=$.options instanceof Map?Array.from($.options.values()):$.options;if(W.every((Q)=>(Q._def.typeName in y0)&&(!Q._def.checks||!Q._def.checks.length))){let Q=W.reduce((H,Y)=>{let G=y0[Y._def.typeName];return G&&!H.includes(G)?[...H,G]:H},[]);return{type:Q.length>1?Q:Q[0]}}else if(W.every((Q)=>Q._def.typeName==="ZodLiteral"&&!Q.description)){let Q=W.reduce((H,Y)=>{let G=typeof Y._def.value;switch(G){case"string":case"number":case"boolean":return[...H,G];case"bigint":return[...H,"integer"];case"object":if(Y._def.value===null)return[...H,"null"];case"symbol":case"undefined":case"function":default:return H}},[]);if(Q.length===W.length){let H=Q.filter((Y,G,B)=>B.indexOf(Y)===G);return{type:H.length>1?H:H[0],enum:W.reduce((Y,G)=>{return Y.includes(G._def.value)?Y:[...Y,G._def.value]},[])}}}else if(W.every((Q)=>Q._def.typeName==="ZodEnum"))return{type:"string",enum:W.reduce((Q,H)=>[...Q,...H._def.values.filter((Y)=>!Q.includes(Y))],[])};return i1($,X)}var i1=($,X)=>{let W=($.options instanceof Map?Array.from($.options.values()):$.options).map((Q,H)=>O(Q._def,{...X,currentPath:[...X.currentPath,"anyOf",`${H}`]})).filter((Q)=>!!Q&&(!X.strictUnions||typeof Q==="object"&&Object.keys(Q).length>0));return W.length?{anyOf:W}:void 0};function o1($,X){if(["ZodString","ZodNumber","ZodBigInt","ZodBoolean","ZodNull"].includes($.innerType._def.typeName)&&(!$.innerType._def.checks||!$.innerType._def.checks.length)){if(X.target==="openApi3")return{type:y0[$.innerType._def.typeName],nullable:!0};return{type:[y0[$.innerType._def.typeName],"null"]}}if(X.target==="openApi3"){let Q=O($.innerType._def,{...X,currentPath:[...X.currentPath]});if(Q&&"$ref"in Q)return{allOf:[Q],nullable:!0};return Q&&{...Q,nullable:!0}}let W=O($.innerType._def,{...X,currentPath:[...X.currentPath,"anyOf","0"]});return W&&{anyOf:[W,{type:"null"}]}}function r1($,X){let W={type:"number"};if(!$.checks)return W;for(let Q of $.checks)switch(Q.kind){case"int":W.type="integer",g2(W,"type",Q.message,X);break;case"min":if(X.target==="jsonSchema7")if(Q.inclusive)L(W,"minimum",Q.value,Q.message,X);else L(W,"exclusiveMinimum",Q.value,Q.message,X);else{if(!Q.inclusive)W.exclusiveMinimum=!0;L(W,"minimum",Q.value,Q.message,X)}break;case"max":if(X.target==="jsonSchema7")if(Q.inclusive)L(W,"maximum",Q.value,Q.message,X);else L(W,"exclusiveMaximum",Q.value,Q.message,X);else{if(!Q.inclusive)W.exclusiveMaximum=!0;L(W,"maximum",Q.value,Q.message,X)}break;case"multipleOf":L(W,"multipleOf",Q.value,Q.message,X);break}return W}s();function a1($,X){let W=X.target==="openAi",Q={type:"object",properties:{}},H=[],Y=$.shape();for(let B in Y){let w=Y[B];if(w===void 0||w._def===void 0)continue;let M=R9(w);if(M&&W){if(w instanceof I)w=w._def.innerType;if(!w.isNullable())w=w.nullable();M=!1}let q=O(w._def,{...X,currentPath:[...X.currentPath,"properties",B],propertyPath:[...X.currentPath,"properties",B]});if(q===void 0)continue;if(Q.properties[B]=q,!M)H.push(B)}if(H.length)Q.required=H;let G=_9($,X);if(G!==void 0)Q.additionalProperties=G;return Q}function _9($,X){if($.catchall._def.typeName!=="ZodNever")return O($.catchall._def,{...X,currentPath:[...X.currentPath,"additionalProperties"]});switch($.unknownKeys){case"passthrough":return X.allowedAdditionalProperties;case"strict":return X.rejectedAdditionalProperties;case"strip":return X.removeAdditionalStrategy==="strict"?X.allowedAdditionalProperties:X.rejectedAdditionalProperties}}function R9($){try{return $.isOptional()}catch{return!0}}var t1=($,X)=>{if(X.currentPath.toString()===X.propertyPath?.toString())return O($.innerType._def,X);let W=O($.innerType._def,{...X,currentPath:[...X.currentPath,"anyOf","1"]});return W?{anyOf:[{not:{}},W]}:{}};var s1=($,X)=>{if(X.pipeStrategy==="input")return O($.in._def,X);else if(X.pipeStrategy==="output")return O($.out._def,X);let W=O($.in._def,{...X,currentPath:[...X.currentPath,"allOf","0"]}),Q=O($.out._def,{...X,currentPath:[...X.currentPath,"allOf",W?"1":"0"]});return{allOf:[W,Q].filter((H)=>H!==void 0)}};function e1($,X){return O($.type._def,X)}function $3($,X){let Q={type:"array",uniqueItems:!0,items:O($.valueType._def,{...X,currentPath:[...X.currentPath,"items"]})};if($.minSize)L(Q,"minItems",$.minSize.value,$.minSize.message,X);if($.maxSize)L(Q,"maxItems",$.maxSize.value,$.maxSize.message,X);return Q}function X3($,X){if($.rest)return{type:"array",minItems:$.items.length,items:$.items.map((W,Q)=>O(W._def,{...X,currentPath:[...X.currentPath,"items",`${Q}`]})).reduce((W,Q)=>Q===void 0?W:[...W,Q],[]),additionalItems:O($.rest._def,{...X,currentPath:[...X.currentPath,"additionalItems"]})};else return{type:"array",minItems:$.items.length,maxItems:$.items.length,items:$.items.map((W,Q)=>O(W._def,{...X,currentPath:[...X.currentPath,"items",`${Q}`]})).reduce((W,Q)=>Q===void 0?W:[...W,Q],[])}}function W3(){return{not:{}}}function Q3(){return{}}var H3=($,X)=>{return O($.innerType._def,X)};var J3=($,X,W)=>{switch(X){case z.ZodString:return j2($,W);case z.ZodNumber:return r1($,W);case z.ZodObject:return a1($,W);case z.ZodBigInt:return f1($,W);case z.ZodBoolean:return T1();case z.ZodDate:return x2($,W);case z.ZodUndefined:return W3();case z.ZodNull:return p1(W);case z.ZodArray:return P1($,W);case z.ZodUnion:case z.ZodDiscriminatedUnion:return d1($,W);case z.ZodIntersection:return Z1($,W);case z.ZodTuple:return X3($,W);case z.ZodRecord:return q2($,W);case z.ZodLiteral:return m1($,W);case z.ZodEnum:return y1($);case z.ZodNativeEnum:return c1($);case z.ZodNullable:return o1($,W);case z.ZodOptional:return t1($,W);case z.ZodMap:return n1($,W);case z.ZodSet:return $3($,W);case z.ZodLazy:return()=>$.getter()._def;case z.ZodPromise:return e1($,W);case z.ZodNaN:case z.ZodNever:return u1();case z.ZodEffects:return h1($,W);case z.ZodAny:return I1();case z.ZodUnknown:return Q3();case z.ZodDefault:return x1($,W);case z.ZodBranded:return V2($,W);case z.ZodReadonly:return H3($,W);case z.ZodCatch:return g1($,W);case z.ZodPipeline:return s1($,W);case z.ZodFunction:case z.ZodVoid:case z.ZodSymbol:return;default:return((Q)=>{return})(X)}};function O($,X,W=!1){let Q=X.seen.get($);if(X.override){let B=X.override?.($,X,Q,W);if(B!==v1)return B}if(Q&&!W){let B=E9(Q,X);if(B!==void 0)return B}let H={def:$,path:X.currentPath,jsonSchema:void 0};X.seen.set($,H);let Y=J3($,$.typeName,X),G=typeof Y==="function"?O(Y(),X):Y;if(G)v9($,X,G);if(X.postProcess){let B=X.postProcess(G,$,X);return H.jsonSchema=G,B}return H.jsonSchema=G,G}var E9=($,X)=>{switch(X.$refStrategy){case"root":return{$ref:$.path.join("/")};case"relative":return{$ref:b9(X.currentPath,$.path)};case"none":case"seen":{if($.path.length<X.currentPath.length&&$.path.every((W,Q)=>X.currentPath[Q]===W))return console.warn(`Recursive reference detected at ${X.currentPath.join("/")}! Defaulting to any`),{};return X.$refStrategy==="seen"?{}:void 0}}},b9=($,X)=>{let W=0;for(;W<$.length&&W<X.length;W++)if($[W]!==X[W])break;return[($.length-W).toString(),...X.slice(W)].join("/")},v9=($,X,W)=>{if($.description){if(W.description=$.description,X.markdownDescription)W.markdownDescription=$.description}return W};var O2=($,X)=>{let W=C1(X),Q=typeof X==="object"&&X.definitions?Object.entries(X.definitions).reduce((w,[M,q])=>({...w,[M]:O(q._def,{...W,currentPath:[...W.basePath,W.definitionPath,M]},!0)??{}}),{}):void 0,H=typeof X==="string"?X:X?.nameStrategy==="title"?void 0:X?.name,Y=O($._def,H===void 0?W:{...W,currentPath:[...W.basePath,W.definitionPath,H]},!1)??{},G=typeof X==="object"&&X.name!==void 0&&X.nameStrategy==="title"?X.name:void 0;if(G!==void 0)Y.title=G;let B=H===void 0?Q?{...Y,[W.definitionPath]:Q}:Y:{$ref:[...W.$refStrategy==="relative"?[]:W.basePath,W.definitionPath,H].join("/"),[W.definitionPath]:{...Q,[H]:Y}};if(W.target==="jsonSchema7")B.$schema="http://json-schema.org/draft-07/schema#";else if(W.target==="jsonSchema2019-09"||W.target==="openAi")B.$schema="https://json-schema.org/draft/2019-09/schema#";if(W.target==="openAi"&&(("anyOf"in B)||("oneOf"in B)||("allOf"in B)||("type"in B)&&Array.isArray(B.type)))console.warn("Warning: OpenAI may not support schemas with unions as roots! Try wrapping it in an object property.");return B};s();h0();s();var Z2;(function($){$.Completable="McpCompletable"})(Z2||(Z2={}));class Z0 extends K{_parse($){let{ctx:X}=this._processInputParams($),W=X.data;return this._def.type._parse({data:W,path:X.path,parent:X})}unwrap(){return this._def.type}}Z0.create=($,X)=>{return new Z0({type:$,typeName:Z2.Completable,complete:X.complete,...k9(X)})};function k9($){if(!$)return{};let{errorMap:X,invalid_type_error:W,required_error:Q,description:H}=$;if(X&&(W||Q))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);if(X)return{errorMap:X,description:H};return{errorMap:(G,B)=>{var w,M;let{message:q}=$;if(G.code==="invalid_enum_value")return{message:q!==null&&q!==void 0?q:B.defaultError};if(typeof B.data==="undefined")return{message:(w=q!==null&&q!==void 0?q:Q)!==null&&w!==void 0?w:B.defaultError};if(G.code!=="invalid_type")return{message:B.defaultError};return{message:(M=q!==null&&q!==void 0?q:W)!==null&&M!==void 0?M:B.defaultError}},description:H}}class m2{constructor($,X){this._registeredResources={},this._registeredResourceTemplates={},this._registeredTools={},this._registeredPrompts={},this._toolHandlersInitialized=!1,this._completionHandlerInitialized=!1,this._resourceHandlersInitialized=!1,this._promptHandlersInitialized=!1,this.server=new T2($,X)}async connect($){return await this.server.connect($)}async close(){await this.server.close()}setToolRequestHandlers(){if(this._toolHandlersInitialized)return;this.server.assertCanSetRequestHandler(z2.shape.method.value),this.server.assertCanSetRequestHandler(M2.shape.method.value),this.server.registerCapabilities({tools:{listChanged:!0}}),this.server.setRequestHandler(z2,()=>({tools:Object.entries(this._registeredTools).filter(([,$])=>$.enabled).map(([$,X])=>{let W={name:$,description:X.description,inputSchema:X.inputSchema?O2(X.inputSchema,{strictUnions:!0}):C9,annotations:X.annotations};if(X.outputSchema)W.outputSchema=O2(X.outputSchema,{strictUnions:!0});return W})})),this.server.setRequestHandler(M2,async($,X)=>{let W=this._registeredTools[$.params.name];if(!W)throw new R(_.InvalidParams,`Tool ${$.params.name} not found`);if(!W.enabled)throw new R(_.InvalidParams,`Tool ${$.params.name} disabled`);let Q;if(W.inputSchema){let H=await W.inputSchema.safeParseAsync($.params.arguments);if(!H.success)throw new R(_.InvalidParams,`Invalid arguments for tool ${$.params.name}: ${H.error.message}`);let Y=H.data,G=W.callback;try{Q=await Promise.resolve(G(Y,X))}catch(B){Q={content:[{type:"text",text:B instanceof Error?B.message:String(B)}],isError:!0}}}else{let H=W.callback;try{Q=await Promise.resolve(H(X))}catch(Y){Q={content:[{type:"text",text:Y instanceof Error?Y.message:String(Y)}],isError:!0}}}if(W.outputSchema){if(!Q.structuredContent)throw new R(_.InvalidParams,`Tool ${$.params.name} has an output schema but no structured content was provided`);let H=await W.outputSchema.safeParseAsync(Q.structuredContent);if(!H.success)throw new R(_.InvalidParams,`Invalid structured content for tool ${$.params.name}: ${H.error.message}`)}return Q}),this._toolHandlersInitialized=!0}setCompletionRequestHandler(){if(this._completionHandlerInitialized)return;this.server.assertCanSetRequestHandler(A2.shape.method.value),this.server.setRequestHandler(A2,async($)=>{switch($.params.ref.type){case"ref/prompt":return this.handlePromptCompletion($,$.params.ref);case"ref/resource":return this.handleResourceCompletion($,$.params.ref);default:throw new R(_.InvalidParams,`Invalid completion reference: ${$.params.ref}`)}}),this._completionHandlerInitialized=!0}async handlePromptCompletion($,X){let W=this._registeredPrompts[X.name];if(!W)throw new R(_.InvalidParams,`Prompt ${X.name} not found`);if(!W.enabled)throw new R(_.InvalidParams,`Prompt ${X.name} disabled`);if(!W.argsSchema)return U2;let Q=W.argsSchema.shape[$.params.argument.name];if(!(Q instanceof Z0))return U2;let Y=await Q._def.complete($.params.argument.value);return G3(Y)}async handleResourceCompletion($,X){let W=Object.values(this._registeredResourceTemplates).find((Y)=>Y.resourceTemplate.uriTemplate.toString()===X.uri);if(!W){if(this._registeredResources[X.uri])return U2;throw new R(_.InvalidParams,`Resource template ${$.params.ref.uri} not found`)}let Q=W.resourceTemplate.completeCallback($.params.argument.name);if(!Q)return U2;let H=await Q($.params.argument.value);return G3(H)}setResourceRequestHandlers(){if(this._resourceHandlersInitialized)return;this.server.assertCanSetRequestHandler(Q2.shape.method.value),this.server.assertCanSetRequestHandler(H2.shape.method.value),this.server.assertCanSetRequestHandler(J2.shape.method.value),this.server.registerCapabilities({resources:{listChanged:!0}}),this.server.setRequestHandler(Q2,async($,X)=>{let W=Object.entries(this._registeredResources).filter(([H,Y])=>Y.enabled).map(([H,Y])=>({uri:H,name:Y.name,...Y.metadata})),Q=[];for(let H of Object.values(this._registeredResourceTemplates)){if(!H.resourceTemplate.listCallback)continue;let Y=await H.resourceTemplate.listCallback(X);for(let G of Y.resources)Q.push({...G,...H.metadata})}return{resources:[...W,...Q]}}),this.server.setRequestHandler(H2,async()=>{return{resourceTemplates:Object.entries(this._registeredResourceTemplates).map(([X,W])=>({name:X,uriTemplate:W.resourceTemplate.uriTemplate.toString(),...W.metadata}))}}),this.server.setRequestHandler(J2,async($,X)=>{let W=new URL($.params.uri),Q=this._registeredResources[W.toString()];if(Q){if(!Q.enabled)throw new R(_.InvalidParams,`Resource ${W} disabled`);return Q.readCallback(W,X)}for(let H of Object.values(this._registeredResourceTemplates)){let Y=H.resourceTemplate.uriTemplate.match(W.toString());if(Y)return H.readCallback(W,Y,X)}throw new R(_.InvalidParams,`Resource ${W} not found`)}),this.setCompletionRequestHandler(),this._resourceHandlersInitialized=!0}setPromptRequestHandlers(){if(this._promptHandlersInitialized)return;this.server.assertCanSetRequestHandler(Y2.shape.method.value),this.server.assertCanSetRequestHandler(G2.shape.method.value),this.server.registerCapabilities({prompts:{listChanged:!0}}),this.server.setRequestHandler(Y2,()=>({prompts:Object.entries(this._registeredPrompts).filter(([,$])=>$.enabled).map(([$,X])=>{return{name:$,description:X.description,arguments:X.argsSchema?P9(X.argsSchema):void 0}})})),this.server.setRequestHandler(G2,async($,X)=>{let W=this._registeredPrompts[$.params.name];if(!W)throw new R(_.InvalidParams,`Prompt ${$.params.name} not found`);if(!W.enabled)throw new R(_.InvalidParams,`Prompt ${$.params.name} disabled`);if(W.argsSchema){let Q=await W.argsSchema.safeParseAsync($.params.arguments);if(!Q.success)throw new R(_.InvalidParams,`Invalid arguments for prompt ${$.params.name}: ${Q.error.message}`);let H=Q.data,Y=W.callback;return await Promise.resolve(Y(H,X))}else{let Q=W.callback;return await Promise.resolve(Q(X))}}),this.setCompletionRequestHandler(),this._promptHandlersInitialized=!0}resource($,X,...W){let Q;if(typeof W[0]==="object")Q=W.shift();let H=W[0];if(typeof X==="string"){if(this._registeredResources[X])throw new Error(`Resource ${X} is already registered`);let Y={name:$,metadata:Q,readCallback:H,enabled:!0,disable:()=>Y.update({enabled:!1}),enable:()=>Y.update({enabled:!0}),remove:()=>Y.update({uri:null}),update:(G)=>{if(typeof G.uri!=="undefined"&&G.uri!==X){if(delete this._registeredResources[X],G.uri)this._registeredResources[G.uri]=Y}if(typeof G.name!=="undefined")Y.name=G.name;if(typeof G.metadata!=="undefined")Y.metadata=G.metadata;if(typeof G.callback!=="undefined")Y.readCallback=G.callback;if(typeof G.enabled!=="undefined")Y.enabled=G.enabled;this.sendResourceListChanged()}};return this._registeredResources[X]=Y,this.setResourceRequestHandlers(),this.sendResourceListChanged(),Y}else{if(this._registeredResourceTemplates[$])throw new Error(`Resource template ${$} is already registered`);let Y={resourceTemplate:X,metadata:Q,readCallback:H,enabled:!0,disable:()=>Y.update({enabled:!1}),enable:()=>Y.update({enabled:!0}),remove:()=>Y.update({name:null}),update:(G)=>{if(typeof G.name!=="undefined"&&G.name!==$){if(delete this._registeredResourceTemplates[$],G.name)this._registeredResourceTemplates[G.name]=Y}if(typeof G.template!=="undefined")Y.resourceTemplate=G.template;if(typeof G.metadata!=="undefined")Y.metadata=G.metadata;if(typeof G.callback!=="undefined")Y.readCallback=G.callback;if(typeof G.enabled!=="undefined")Y.enabled=G.enabled;this.sendResourceListChanged()}};return this._registeredResourceTemplates[$]=Y,this.setResourceRequestHandlers(),this.sendResourceListChanged(),Y}}_createRegisteredTool($,X,W,Q,H,Y){let G={description:X,inputSchema:W===void 0?void 0:J.object(W),outputSchema:Q===void 0?void 0:J.object(Q),annotations:H,callback:Y,enabled:!0,disable:()=>G.update({enabled:!1}),enable:()=>G.update({enabled:!0}),remove:()=>G.update({name:null}),update:(B)=>{if(typeof B.name!=="undefined"&&B.name!==$){if(delete this._registeredTools[$],B.name)this._registeredTools[B.name]=G}if(typeof B.description!=="undefined")G.description=B.description;if(typeof B.paramsSchema!=="undefined")G.inputSchema=J.object(B.paramsSchema);if(typeof B.callback!=="undefined")G.callback=B.callback;if(typeof B.annotations!=="undefined")G.annotations=B.annotations;if(typeof B.enabled!=="undefined")G.enabled=B.enabled;this.sendToolListChanged()}};return this._registeredTools[$]=G,this.setToolRequestHandlers(),this.sendToolListChanged(),G}tool($,...X){if(this._registeredTools[$])throw new Error(`Tool ${$} is already registered`);let W,Q,H,Y;if(typeof X[0]==="string")W=X.shift();if(X.length>1){let B=X[0];if(Y3(B)){if(Q=X.shift(),X.length>1&&typeof X[0]==="object"&&X[0]!==null&&!Y3(X[0]))Y=X.shift()}else if(typeof B==="object"&&B!==null)Y=X.shift()}let G=X[0];return this._createRegisteredTool($,W,Q,H,Y,G)}registerTool($,X,W){if(this._registeredTools[$])throw new Error(`Tool ${$} is already registered`);let{description:Q,inputSchema:H,outputSchema:Y,annotations:G}=X;return this._createRegisteredTool($,Q,H,Y,G,W)}prompt($,...X){if(this._registeredPrompts[$])throw new Error(`Prompt ${$} is already registered`);let W;if(typeof X[0]==="string")W=X.shift();let Q;if(X.length>1)Q=X.shift();let H=X[0],Y={description:W,argsSchema:Q===void 0?void 0:J.object(Q),callback:H,enabled:!0,disable:()=>Y.update({enabled:!1}),enable:()=>Y.update({enabled:!0}),remove:()=>Y.update({name:null}),update:(G)=>{if(typeof G.name!=="undefined"&&G.name!==$){if(delete this._registeredPrompts[$],G.name)this._registeredPrompts[G.name]=Y}if(typeof G.description!=="undefined")Y.description=G.description;if(typeof G.argsSchema!=="undefined")Y.argsSchema=J.object(G.argsSchema);if(typeof G.callback!=="undefined")Y.callback=G.callback;if(typeof G.enabled!=="undefined")Y.enabled=G.enabled;this.sendPromptListChanged()}};return this._registeredPrompts[$]=Y,this.setPromptRequestHandlers(),this.sendPromptListChanged(),Y}isConnected(){return this.server.transport!==void 0}sendResourceListChanged(){if(this.isConnected())this.server.sendResourceListChanged()}sendToolListChanged(){if(this.isConnected())this.server.sendToolListChanged()}sendPromptListChanged(){if(this.isConnected())this.server.sendPromptListChanged()}}var C9={type:"object"};function Y3($){if(typeof $!=="object"||$===null)return!1;return Object.keys($).length===0||Object.values($).some(I9)}function I9($){return $!==null&&typeof $==="object"&&"parse"in $&&typeof $.parse==="function"&&"safeParse"in $&&typeof $.safeParse==="function"}function P9($){return Object.entries($.shape).map(([X,W])=>({name:X,description:W.description,required:!W.isOptional()}))}function G3($){return{completion:{values:$.slice(0,100),total:$.length,hasMore:$.length>100}}}var U2={completion:{values:[],hasMore:!1}};function B3($,X){let W=process.argv,Q=`--${$}=`;for(let H of W)if(H.startsWith(Q))return H.substring(Q.length);return X}D0();var g9=g("FigmaConfig",1),m0=B3("figma-api-key")||process.env.FIGMA_API_KEY||"",z3="F2C MCP",M3=process.env.FIGMA_VERSION||"0.0.1";g9.debug("DEFAULT_PERSONAL_TOKEN",m0);var A3=($)=>{};var V3=($)=>{A3($)};D0();var j3=g("F2cApi",1);class q3{f2cHost="https://f2c-figma-api.yy.com/api";personalToken=m0;async nodeToCode($){let X={fileKey:$.fileKey,nodeIds:$.ids,personal_token:$.personalToken||this.personalToken,option:{cssFramework:"inlinecss",imgFormat:$.imgFormat||"png",scaleSize:$.scaleSize||2},format:"files"};if($.format==="react-cssmodules")X.option.cssFramework="cssmodules";else if($.format==="react-tailwind")X.option.cssFramework="tailwindcss";let W=this.opToUrl(`${this.f2cHost}/nodes`,X);return this.fetch(W,"json")}async fetch($,X="json"){try{let W={method:"GET",headers:{"F2c-Api-Platform":"mcp"}};j3.debug("fetch",$);let Q=await fetch($,W);if(!Q.ok)throw new Error(`HTTP error! status: ${Q.status}`);return X==="text"?await Q.text():await Q.json()}catch(W){throw j3.error("HTTP error",W),W}}opToUrl($,X={}){if(Object.keys(X).length===0)return $;let W=new URL($);for(let[Q,H]of Object.entries(X))if(typeof H==="object"&&H!==null)for(let[Y,G]of Object.entries(H))W.searchParams.append(`${Q}[${Y}]`,G);else W.searchParams.append(Q,H);return W.toString()}}var O3=new q3;D0();var x9=g("FigmaRestApi");class U3{figmaHost="https://api.figma.com/v1";personalToken=m0;async files($){let X;if($.ids)X=this.opToUrl(`${this.figmaHost}/files/${$.fileKey}/nodes`,$);else X=this.opToUrl(`${this.figmaHost}/files/${$.fileKey}`,$);return this.fetch(X)}async images($){let X=this.opToUrl(`${this.figmaHost}/images/${$.fileKey}`,$);return this.fetch(X)}async imageFills($){let X=this.opToUrl(`${this.figmaHost}/files/${$.fileKey}/images`,$);return this.fetch(X)}async meta($){let X=this.opToUrl(`${this.figmaHost}/files/${$.fileKey}/meta`,$);return this.fetch(X)}async fetch($,X="json"){try{let W={method:"GET",headers:{"X-FIGMA-TOKEN":this.personalToken}},Q=await fetch($,W);if(!Q.ok)throw new Error(`HTTP error! status: ${Q.status}`);return X==="text"?await Q.text():await Q.json()}catch(W){throw x9.error("HTTP error",W),W}}opToUrl($,X={},W=["fileKey","personalToken"]){if(Object.keys(X).length===0)return $;if(X.personalToken)this.personalToken=X.personalToken;let Q=new URL($);for(let[H,Y]of Object.entries(X))if(!W.includes(H))Q.searchParams.append(H,Y);return Q.toString()}}var K3=new U3;D0();s();var l0=n0(require("fs")),Q0=n0(require("path")),l2=n0(require("fs/promises"));D0();var c=g("Downloader");class N3{op;assetsPath="";savePath="";setup($){if(this.op=$,this.op.localPath)this.assetsPath=Q0.default.join(this.op.localPath,"assets"),this.savePath=this.op.localPath}async downloadImage($,X){let{imgFormat:W}=this.op,Q=this.assetsPath;try{if(!l0.default.existsSync(Q))l0.default.mkdirSync(Q,{recursive:!0});let H=`${X}.${W}`,Y=Q0.default.join(Q,H),G=await fetch($);if(!G.ok)throw new Error(`下载失败: ${G.status} ${G.statusText}`);let B=await G.arrayBuffer();return l0.default.writeFileSync(Y,new Uint8Array(B)),Q0.default.join(Q0.default.basename(Q),H).replace(/\\/g,"/")}catch(H){throw c.error("图片下载错误:",H),H}}async downLoadImageAndReplaceContent($){try{let X=/https:\/\/figma-alpha-api\.s3\.us-west-2\.amazonaws\.com\/images\/[a-f0-9-]+/g,W=$.match(X);if(!W)return $;let Q=[...new Set(W)],H=new Map;await Promise.all(Q.map(async(G)=>{let B=Q0.default.basename(G),w=await this.downloadImage(G,B);H.set(G,w)}));let Y=$;for(let[G,B]of H.entries()){let w=new RegExp(G.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),"g");Y=Y.replace(w,B)}return Y}catch(X){throw c.error("内容处理错误:",X),X}}async checkLocalAndDownload($){if(!this.op.localPath)return;await Promise.all($.map(async(X)=>{X.content=await this.downLoadImageAndReplaceContent(X.content)}));for(let X of $)try{let W=await this.saveContentToFile(X.content,X.path);c.debug(`Successfully saved: ${W}`)}catch(W){c.error(`Failed to save file ${X.path}:`,W)}}async ensureDirectoryExists($){if(!l0.default.existsSync($))c.debug(`Creating directory: ${$}`),await l2.default.mkdir($,{recursive:!0})}async saveContentToFile($,X){try{let W=Q0.default.join(this.savePath,X),Q=Q0.default.dirname(W);if(c.debug(`Full path: ${W}, directory: ${Q}`),await this.ensureDirectoryExists(Q),X.endsWith(".html"))c.debug("Wrapping content with HTML template"),$=this.wrapHtmlContent($);return c.debug(`Writing ${$.length} bytes to file`),await l2.default.writeFile(W,$),c.info(`File saved: ${W}`),W}catch(W){throw c.error("File save error:",X,W),W}}wrapHtmlContent($){return c.debug("Wrapping content with HTML template"),`<!DOCTYPE html>
|
7
7
|
<html>
|
8
8
|
<head>
|
9
9
|
<meta charset="UTF-8">
|
@@ -13,25 +13,18 @@ var E2=Object.create;var{getPrototypeOf:b2,defineProperty:L1,getOwnPropertyNames
|
|
13
13
|
<body>
|
14
14
|
${$}
|
15
15
|
</body>
|
16
|
-
</html>`}}var
|
16
|
+
</html>`}}var n2=new N3;var h9=g("V3Tool"),L3=($)=>{$.tool("get_code","Generate UI code for a given node or the currently selected node in the Figma desktop app. Use the nodeId parameter to specify a node id. If no node id is provided, the currently selected node will be used. If a URL is provided, extract the node id from the URL, for example, if given the URL https://figma.com/design/:fileKey/:fileName?node-id=1-2, the extracted nodeId would be 1:2. IMPORTANT: After you call this tool, you should call get_image to get an image of the node for context.",{fileKey:J.string().describe("The Figma file identifier found in the file URL (e.g., https://www.figma.com/file/XXXXXXXXXXXX/). Extract the XXXXXXXXXXXX portion as the fileKey."),ids:J.string().describe('Comma-separated list of Figma node IDs for conversion. To obtain node IDs, select elements in Figma, right-click and select "Copy/Paste as" → "Copy ID".'),personalToken:J.string().optional().describe("Figma personal access token for API authentication.The parameters are not required when the tool is called."),localPath:J.string().optional().describe("Absolute path for asset(e.g., images) and code storage. Directory will be created if non-existent. Path must follow OS-specific format without special character escaping. When this path is set, all code-related static resources are stored in this directory, while other assets (e.g., images) will be saved into the subdirectory named assets under this path."),imgFormat:J.enum(["png","jpg","svg"]).default("png").describe('Export format for image assets: "png" for lossless quality, "jpg" for compressed files, or "svg" for vector graphics.'),scaleSize:J.number().min(1).max(4).default(2).describe("Image export scale factor (1-4). Higher values yield better quality at the cost of larger file sizes.")},async(X)=>{n2.setup(X);try{let W=await O3.nodeToCode({...X,format:"react-tailwind"})||[];if(await n2.checkLocalAndDownload(W),!W)return{content:[{type:"text",text:"Failed to generate any code. Please check if the provided Figma node IDs are correct or if the nodes can be converted to code."}]};let Q=Array.isArray(W)?W:[W];if(Q.length===0)return{content:[{type:"text",text:"Conversion succeeded but no files were generated. Please check if the selected Figma nodes contain convertible content."}]};let H=Q.filter((G)=>!G.path.endsWith("/index.scss")).map((G,B)=>`${B+1}. ${G.path}`).join(`
|
17
17
|
`);if(X.localPath)return{content:[{type:"text",text:`# Files Saved Locally
|
18
18
|
|
19
19
|
## Save Location
|
20
20
|
${X.localPath}
|
21
21
|
|
22
22
|
## Generated Files
|
23
|
-
${H}. Convert the Tailwind to vanilla CSS if not already used in the codebase. Do not install any dependencies.`}]};
|
24
|
-
\`\`\`${w}
|
25
|
-
${G.content}
|
26
|
-
\`\`\``}).join(`
|
23
|
+
${H}. Convert the Tailwind to vanilla CSS if not already used in the codebase. Do not install any dependencies.`}]};return{content:[{type:"text",text:`${Q.filter((G)=>G.path.endsWith(".tsx")).map((G)=>G.content).join(`
|
27
24
|
|
28
|
-
`);return{content:[{type:"text",text
|
29
|
-
${
|
25
|
+
`)} Convert the Tailwind to vanilla CSS if not already used in the codebase. Do not install any dependencies.`}]}}catch(W){return h9.error("Tool execution error:",W),{content:[{type:"text",text:`Error: ${W.message}`}]}}}),$.tool("get_image","Generate an image for a given node or the currently selected node in the Figma desktop app. Use the nodeId parameter to specify a node id. If no node id is provided, the currently selected node will be used. If a URL is provided, extract the node id from the URL, for example, if given the URL https://figma.com/design/:fileKey/:fileName?node-id=1-2, the extracted nodeId would be 1:2. Also export Figma design images for visual verification and design fidelity validation. Essential for comparing generated code output against original designs, ensuring pixel-perfect implementation and catching visual discrepancies during the design-to-code process.",{fileKey:J.string().describe("Figma file identifier from the URL for accessing the design source"),ids:J.string().describe('Comma-separated node IDs to export. Use "Copy ID" from Figma context menu to get precise element references for comparison'),format:J.enum(["jpg","png","svg","pdf"]).optional().describe('Export format for verification: "png" for pixel-perfect comparison with transparency, "jpg" for quick previews, "svg" for scalable reference, "pdf" for print validation'),scale:J.number().optional().describe("Scale factor (1-4x) for high-resolution comparison. Use 2x+ for detailed fidelity checks on retina displays"),svg_include_id:J.boolean().optional().describe("Include element IDs in SVG for precise element mapping during code validation"),svg_simplify_stroke:J.boolean().optional().describe("Simplify stroke paths for cleaner reference images during visual comparison"),use_absolute_bounds:J.boolean().optional().describe("Use absolute positioning for accurate layout verification against implemented code"),version:J.string().optional().describe("Specific design version for consistent comparison baseline"),personalToken:J.string().optional().describe("Figma personal access token for authenticated access to design files")},async(X)=>{try{let W=await K3.images(X);return{content:[{type:"text",text:JSON.stringify(W)}]}}catch(W){return{content:[{type:"text",text:`Error: ${W.message}`}]}}})};var K2=new m2({name:z3,version:M3},{capabilities:{logging:{}}});V3(K2);L3(K2);var u2=n0(require("node:process"));h0();class c2{append($){this._buffer=this._buffer?Buffer.concat([this._buffer,$]):$}readMessage(){if(!this._buffer)return null;let $=this._buffer.indexOf(`
|
26
|
+
`);if($===-1)return null;let X=this._buffer.toString("utf8",0,$).replace(/\r$/,"");return this._buffer=this._buffer.subarray($+1),y9(X)}clear(){this._buffer=void 0}}function y9($){return U1.parse(JSON.parse($))}function F3($){return JSON.stringify($)+`
|
27
|
+
`}class p2{constructor($=u2.default.stdin,X=u2.default.stdout){this._stdin=$,this._stdout=X,this._readBuffer=new c2,this._started=!1,this._ondata=(W)=>{this._readBuffer.append(W),this.processReadBuffer()},this._onerror=(W)=>{var Q;(Q=this.onerror)===null||Q===void 0||Q.call(this,W)}}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(){var $,X;while(!0)try{let W=this._readBuffer.readMessage();if(W===null)break;($=this.onmessage)===null||$===void 0||$.call(this,W)}catch(W){(X=this.onerror)===null||X===void 0||X.call(this,W)}}async close(){var $;if(this._stdin.off("data",this._ondata),this._stdin.off("error",this._onerror),this._stdin.listenerCount("data")===0)this._stdin.pause();this._readBuffer.clear(),($=this.onclose)===null||$===void 0||$.call(this)}send($){return new Promise((X)=>{let W=F3($);if(this._stdout.write(W))X();else this._stdout.once("drain",X)})}}D0();var Z9=g("StdioTransport");async function S3($){try{let X=new p2;await $.connect(X)}catch(X){Z9.info(JSON.stringify({jsonrpc:"2.0",id:null,error:{code:-32000,message:`Server startup failed: ${X.message}`}})),process.exit(1)}}S3(K2);
|
30
28
|
|
31
|
-
|
32
|
-
${Y}. Convert the Tailwind to vanilla CSS if not already used in the codebase. Do not install any dependencies.`}]}}catch(W){return h6.error("Tool execution error:",W),{content:[{type:"text",text:`Error: ${W.message}`}]}}})};D0();var y6=g("FigmaRestApi");class U2{figmaHost="https://api.figma.com/v1";personalToken=m0;async files($){let X;if($.ids)X=this.opToUrl(`${this.figmaHost}/files/${$.fileKey}/nodes`,$);else X=this.opToUrl(`${this.figmaHost}/files/${$.fileKey}`,$);return this.fetch(X)}async images($){let X=this.opToUrl(`${this.figmaHost}/images/${$.fileKey}`,$);return this.fetch(X)}async imageFills($){let X=this.opToUrl(`${this.figmaHost}/files/${$.fileKey}/images`,$);return this.fetch(X)}async meta($){let X=this.opToUrl(`${this.figmaHost}/files/${$.fileKey}/meta`,$);return this.fetch(X)}async fetch($,X="json"){try{let W={method:"GET",headers:{"X-FIGMA-TOKEN":this.personalToken}},Q=await fetch($,W);if(!Q.ok)throw new Error(`HTTP error! status: ${Q.status}`);return X==="text"?await Q.text():await Q.json()}catch(W){throw y6.error("HTTP error",W),W}}opToUrl($,X={},W=["fileKey","personalToken"]){if(Object.keys(X).length===0)return $;if(X.personalToken)this.personalToken=X.personalToken;let Q=new URL($);for(let[H,Y]of Object.entries(X))if(!W.includes(H))Q.searchParams.append(H,Y);return Q.toString()}}var K2=new U2;d();var N2=($)=>{$.tool("figma_get_images","Get images of Figma nodes",{fileKey:J.string().describe("Unique identifier of the Figma file"),ids:J.string().describe("Node IDs to get images for, comma separated"),format:J.enum(["jpg","png","svg","pdf"]).optional().describe("Image format, e.g., png, jpg, svg"),scale:J.number().optional().describe("Image scale factor"),svg_include_id:J.boolean().optional().describe("Whether SVG includes ID"),svg_simplify_stroke:J.boolean().optional().describe("Whether to simplify SVG strokes"),use_absolute_bounds:J.boolean().optional().describe("Whether to use absolute bounds"),version:J.string().optional().describe("Specify the version to return"),personalToken:J.string().optional().describe("Your Figma personal access token, The parameters are not required when the tool is called.")},async(X)=>{try{let W=await K2.images(X);return{content:[{type:"text",text:JSON.stringify(W)}]}}catch(W){return{content:[{type:"text",text:`Error: ${W.message}`}]}}})};var L2=($)=>{};var F2=($)=>{L2($)};var n0=new m1({name:z2,version:M2},{capabilities:{logging:{}}});F2(n0);N2(n0);O2(n0);var u1=c0(require("node:process"));h0();class c1{append($){this._buffer=this._buffer?Buffer.concat([this._buffer,$]):$}readMessage(){if(!this._buffer)return null;let $=this._buffer.indexOf(`
|
33
|
-
`);if($===-1)return null;let X=this._buffer.toString("utf8",0,$).replace(/\r$/,"");return this._buffer=this._buffer.subarray($+1),Z6(X)}clear(){this._buffer=void 0}}function Z6($){return U$.parse(JSON.parse($))}function S2($){return JSON.stringify($)+`
|
34
|
-
`}class p1{constructor($=u1.default.stdin,X=u1.default.stdout){this._stdin=$,this._stdout=X,this._readBuffer=new c1,this._started=!1,this._ondata=(W)=>{this._readBuffer.append(W),this.processReadBuffer()},this._onerror=(W)=>{var Q;(Q=this.onerror)===null||Q===void 0||Q.call(this,W)}}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(){var $,X;while(!0)try{let W=this._readBuffer.readMessage();if(W===null)break;($=this.onmessage)===null||$===void 0||$.call(this,W)}catch(W){(X=this.onerror)===null||X===void 0||X.call(this,W)}}async close(){var $;if(this._stdin.off("data",this._ondata),this._stdin.off("error",this._onerror),this._stdin.listenerCount("data")===0)this._stdin.pause();this._readBuffer.clear(),($=this.onclose)===null||$===void 0||$.call(this)}send($){return new Promise((X)=>{let W=S2($);if(this._stdout.write(W))X();else this._stdout.once("drain",X)})}}D0();var m6=g("StdioTransport");async function _2($){try{let X=new p1;await $.connect(X)}catch(X){m6.info(JSON.stringify({jsonrpc:"2.0",id:null,error:{code:-32000,message:`Server startup failed: ${X.message}`}})),process.exit(1)}}_2(n0);
|
35
|
-
|
36
|
-
//# debugId=A6FF0D00BA3AA8A064756E2164756E21
|
29
|
+
//# debugId=AD1E656459AB5C3164756E2164756E21
|
37
30
|
//# sourceMappingURL=cli.js.map
|