@f2c/mcp 0.4.7 → 0.4.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +186 -244
- package/dist/cli.js.map +35 -75
- package/dist/stdio.js +186 -244
- package/dist/stdio.js.map +35 -75
- package/dist/streamable-http.js +255 -308
- package/dist/streamable-http.js.map +40 -79
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -1,105 +1,95 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
var eJ=Object.create;var{getPrototypeOf:v6,defineProperty:C0,getOwnPropertyNames:f6}=Object;var Q6=Object.prototype.hasOwnProperty;var x1=(f,v,h)=>{h=f!=null?eJ(v6(f)):{};let J=v||!f||!f.__esModule?C0(h,"default",{value:f,enumerable:!0}):h;for(let Q of f6(f))if(!Q6.call(J,Q))C0(J,Q,{get:()=>f[Q],enumerable:!0});return J};var n=(f,v)=>()=>(v||f((v={exports:{}}).exports,v),v.exports);var $X=(f,v)=>{for(var h in v)C0(f,h,{get:v[h],enumerable:!0,configurable:!0,set:(J)=>v[h]=()=>J})};var T0=(f,v)=>()=>(f&&(v=f(f=0)),v);function J6(f){fh=f}function Z1(){return fh}function g(f,v){let h=Z1(),J=r1({issueData:v,data:f.data,path:f.path,errorMaps:[f.common.contextualErrorMap,f.schemaErrorMap,h,h===ef?void 0:ef].filter((Q)=>!!Q)});f.common.issues.push(J)}class Rv{constructor(){this.value="valid"}dirty(){if(this.value==="valid")this.value="dirty"}abort(){if(this.value!=="aborted")this.value="aborted"}static mergeArray(f,v){let h=[];for(let J of v){if(J.status==="aborted")return p;if(J.status==="dirty")f.dirty();h.push(J.value)}return{status:f.value,value:h}}static async mergeObjectAsync(f,v){let h=[];for(let J of v){let Q=await J.key,W=await J.value;h.push({key:Q,value:W})}return Rv.mergeObjectSync(f,h)}static mergeObjectSync(f,v){let h={};for(let J of v){let{key:Q,value:W}=J;if(Q.status==="aborted")return p;if(W.status==="aborted")return p;if(Q.status==="dirty")f.dirty();if(W.status==="dirty")f.dirty();if(Q.value!=="__proto__"&&(typeof W.value!=="undefined"||J.alwaysSet))h[Q.value]=W.value}return{status:f.value,value:h}}}function u1(f,v,h,J){if(h==="a"&&!J)throw new TypeError("Private accessor was defined without a getter");if(typeof v==="function"?f!==v||!J:!v.has(f))throw new TypeError("Cannot read private member from an object whose class did not declare it");return h==="m"?J:h==="a"?J.call(f):J?J.value:v.get(f)}function Qh(f,v,h,J,Q){if(J==="m")throw new TypeError("Private method is not writable");if(J==="a"&&!Q)throw new TypeError("Private accessor was defined without a setter");if(typeof v==="function"?f!==v||!Q:!v.has(f))throw new TypeError("Cannot write private member to an object whose class did not declare it");return J==="a"?Q.call(f,h):Q?Q.value=h:v.set(f,h),h}class ff{constructor(f,v,h,J){this._cachedPath=[],this.parent=f,this.data=v,this._path=h,this._key=J}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 d(f){if(!f)return{};let{errorMap:v,invalid_type_error:h,required_error:J,description:Q}=f;if(v&&(h||J))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);if(v)return{errorMap:v,description:Q};return{errorMap:(X,Y)=>{var B,q;let{message:D}=f;if(X.code==="invalid_enum_value")return{message:D!==null&&D!==void 0?D:Y.defaultError};if(typeof Y.data==="undefined")return{message:(B=D!==null&&D!==void 0?D:J)!==null&&B!==void 0?B:Y.defaultError};if(X.code!=="invalid_type")return{message:Y.defaultError};return{message:(q=D!==null&&D!==void 0?D:h)!==null&&q!==void 0?q:Y.defaultError}},description:Q}}class i{get description(){return this._def.description}_getType(f){return Kf(f.data)}_getOrReturnCtx(f,v){return v||{common:f.parent.common,data:f.data,parsedType:Kf(f.data),schemaErrorMap:this._def.errorMap,path:f.path,parent:f.parent}}_processInputParams(f){return{status:new Rv,ctx:{common:f.parent.common,data:f.data,parsedType:Kf(f.data),schemaErrorMap:this._def.errorMap,path:f.path,parent:f.parent}}}_parseSync(f){let v=this._parse(f);if(M1(v))throw new Error("Synchronous parse encountered promise.");return v}_parseAsync(f){let v=this._parse(f);return Promise.resolve(v)}parse(f,v){let h=this.safeParse(f,v);if(h.success)return h.data;throw h.error}safeParse(f,v){var h;let J={common:{issues:[],async:(h=v===null||v===void 0?void 0:v.async)!==null&&h!==void 0?h:!1,contextualErrorMap:v===null||v===void 0?void 0:v.errorMap},path:(v===null||v===void 0?void 0:v.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:f,parsedType:Kf(f)},Q=this._parseSync({data:f,path:J.path,parent:J});return oQ(J,Q)}"~validate"(f){var v,h;let J={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:f,parsedType:Kf(f)};if(!this["~standard"].async)try{let Q=this._parseSync({data:f,path:[],parent:J});return gf(Q)?{value:Q.value}:{issues:J.common.issues}}catch(Q){if((h=(v=Q===null||Q===void 0?void 0:Q.message)===null||v===void 0?void 0:v.toLowerCase())===null||h===void 0?void 0:h.includes("encountered"))this["~standard"].async=!0;J.common={issues:[],async:!0}}return this._parseAsync({data:f,path:[],parent:J}).then((Q)=>gf(Q)?{value:Q.value}:{issues:J.common.issues})}async parseAsync(f,v){let h=await this.safeParseAsync(f,v);if(h.success)return h.data;throw h.error}async safeParseAsync(f,v){let h={common:{issues:[],contextualErrorMap:v===null||v===void 0?void 0:v.errorMap,async:!0},path:(v===null||v===void 0?void 0:v.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:f,parsedType:Kf(f)},J=this._parse({data:f,path:h.path,parent:h}),Q=await(M1(J)?J:Promise.resolve(J));return oQ(h,Q)}refine(f,v){let h=(J)=>{if(typeof v==="string"||typeof v==="undefined")return{message:v};else if(typeof v==="function")return v(J);else return v};return this._refinement((J,Q)=>{let W=f(J),X=()=>Q.addIssue({code:U.custom,...h(J)});if(typeof Promise!=="undefined"&&W instanceof Promise)return W.then((Y)=>{if(!Y)return X(),!1;else return!0});if(!W)return X(),!1;else return!0})}refinement(f,v){return this._refinement((h,J)=>{if(!f(h))return J.addIssue(typeof v==="function"?v(h,J):v),!1;else return!0})}_refinement(f){return new iv({schema:this,typeName:z.ZodEffects,effect:{type:"refinement",refinement:f}})}superRefine(f){return this._refinement(f)}constructor(f){this.spa=this.safeParseAsync,this._def=f,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:(v)=>this["~validate"](v)}}optional(){return mv.create(this,this._def)}nullable(){return $f.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return vf.create(this)}promise(){return Tf.create(this,this._def)}or(f){return h1.create([this,f],this._def)}and(f){return J1.create(this,f,this._def)}transform(f){return new iv({...d(this._def),schema:this,typeName:z.ZodEffects,effect:{type:"transform",transform:f}})}default(f){let v=typeof f==="function"?f:()=>f;return new Y1({...d(this._def),innerType:this,defaultValue:v,typeName:z.ZodDefault})}brand(){return new a1({typeName:z.ZodBranded,type:this,...d(this._def)})}catch(f){let v=typeof f==="function"?f:()=>f;return new B1({...d(this._def),innerType:this,catchValue:v,typeName:z.ZodCatch})}describe(f){return new this.constructor({...this._def,description:f})}pipe(f){return z1.create(this,f)}readonly(){return G1.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}function Jh(f){let v="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";if(f.precision)v=`${v}\\.\\d{${f.precision}}`;else if(f.precision==null)v=`${v}(\\.\\d+)?`;return v}function V6(f){return new RegExp(`^${Jh(f)}$`)}function Wh(f){let v=`${hh}T${Jh(f)}`,h=[];if(h.push(f.local?"Z?":"Z"),f.offset)h.push("([+-]\\d{2}:?\\d{2})");return v=`${v}(${h.join("|")})`,new RegExp(`^${v}$`)}function F6(f,v){if((v==="v4"||!v)&&O6.test(f))return!0;if((v==="v6"||!v)&&$6.test(f))return!0;return!1}function N6(f,v){if(!w6.test(f))return!1;try{let[h]=f.split("."),J=h.replace(/-/g,"+").replace(/_/g,"/").padEnd(h.length+(4-h.length%4)%4,"="),Q=JSON.parse(atob(J));if(typeof Q!=="object"||Q===null)return!1;if(!Q.typ||!Q.alg)return!1;if(v&&Q.alg!==v)return!1;return!0}catch(h){return!1}}function U6(f,v){if((v==="v4"||!v)&&K6.test(f))return!0;if((v==="v6"||!v)&&j6.test(f))return!0;return!1}function z6(f,v){let h=(f.toString().split(".")[1]||"").length,J=(v.toString().split(".")[1]||"").length,Q=h>J?h:J,W=parseInt(f.toFixed(Q).replace(".","")),X=parseInt(v.toFixed(Q).replace(".",""));return W%X/Math.pow(10,Q)}function tf(f){if(f instanceof $v){let v={};for(let h in f.shape){let J=f.shape[h];v[h]=mv.create(tf(J))}return new $v({...f._def,shape:()=>v})}else if(f instanceof vf)return new vf({...f._def,type:tf(f.element)});else if(f instanceof mv)return mv.create(tf(f.unwrap()));else if(f instanceof $f)return $f.create(tf(f.unwrap()));else if(f instanceof Yf)return Yf.create(f.items.map((v)=>tf(v)));else return f}function m0(f,v){let h=Kf(f),J=Kf(v);if(f===v)return{valid:!0,data:f};else if(h===I.object&&J===I.object){let Q=hv.objectKeys(v),W=hv.objectKeys(f).filter((Y)=>Q.indexOf(Y)!==-1),X={...f,...v};for(let Y of W){let B=m0(f[Y],v[Y]);if(!B.valid)return{valid:!1};X[Y]=B.data}return{valid:!0,data:X}}else if(h===I.array&&J===I.array){if(f.length!==v.length)return{valid:!1};let Q=[];for(let W=0;W<f.length;W++){let X=f[W],Y=v[W],B=m0(X,Y);if(!B.valid)return{valid:!1};Q.push(B.data)}return{valid:!0,data:Q}}else if(h===I.date&&J===I.date&&+f===+v)return{valid:!0,data:f};else return{valid:!1}}function Ph(f,v){return new Nf({values:f,typeName:z.ZodEnum,...d(v)})}function eQ(f,v){let h=typeof f==="function"?f(v):typeof f==="string"?{message:f}:f;return typeof h==="string"?{message:h}:h}function Xh(f,v={},h){if(f)return If.create().superRefine((J,Q)=>{var W,X;let Y=f(J);if(Y instanceof Promise)return Y.then((B)=>{var q,D;if(!B){let j=eQ(v,J),L=(D=(q=j.fatal)!==null&&q!==void 0?q:h)!==null&&D!==void 0?D:!0;Q.addIssue({code:"custom",...j,fatal:L})}});if(!Y){let B=eQ(v,J),q=(X=(W=B.fatal)!==null&&W!==void 0?W:h)!==null&&X!==void 0?X:!0;Q.addIssue({code:"custom",...B,fatal:q})}return});return If.create()}var hv,Z0,I,Kf=(f)=>{switch(typeof f){case"undefined":return I.undefined;case"string":return I.string;case"number":return isNaN(f)?I.nan:I.number;case"boolean":return I.boolean;case"function":return I.function;case"bigint":return I.bigint;case"symbol":return I.symbol;case"object":if(Array.isArray(f))return I.array;if(f===null)return I.null;if(f.then&&typeof f.then==="function"&&f.catch&&typeof f.catch==="function")return I.promise;if(typeof Map!=="undefined"&&f instanceof Map)return I.map;if(typeof Set!=="undefined"&&f instanceof Set)return I.set;if(typeof Date!=="undefined"&&f instanceof Date)return I.date;return I.object;default:return I.unknown}},U,h6=(f)=>{return JSON.stringify(f,null,2).replace(/"([^"]+)":/g,"$1:")},uv,ef=(f,v)=>{let h;switch(f.code){case U.invalid_type:if(f.received===I.undefined)h="Required";else h=`Expected ${f.expected}, received ${f.received}`;break;case U.invalid_literal:h=`Invalid literal value, expected ${JSON.stringify(f.expected,hv.jsonStringifyReplacer)}`;break;case U.unrecognized_keys:h=`Unrecognized key(s) in object: ${hv.joinValues(f.keys,", ")}`;break;case U.invalid_union:h="Invalid input";break;case U.invalid_union_discriminator:h=`Invalid discriminator value. Expected ${hv.joinValues(f.options)}`;break;case U.invalid_enum_value:h=`Invalid enum value. Expected ${hv.joinValues(f.options)}, received '${f.received}'`;break;case U.invalid_arguments:h="Invalid function arguments";break;case U.invalid_return_type:h="Invalid function return type";break;case U.invalid_date:h="Invalid date";break;case U.invalid_string:if(typeof f.validation==="object")if("includes"in f.validation){if(h=`Invalid input: must include "${f.validation.includes}"`,typeof f.validation.position==="number")h=`${h} at one or more positions greater than or equal to ${f.validation.position}`}else if("startsWith"in f.validation)h=`Invalid input: must start with "${f.validation.startsWith}"`;else if("endsWith"in f.validation)h=`Invalid input: must end with "${f.validation.endsWith}"`;else hv.assertNever(f.validation);else if(f.validation!=="regex")h=`Invalid ${f.validation}`;else h="Invalid";break;case U.too_small:if(f.type==="array")h=`Array must contain ${f.exact?"exactly":f.inclusive?"at least":"more than"} ${f.minimum} element(s)`;else if(f.type==="string")h=`String must contain ${f.exact?"exactly":f.inclusive?"at least":"over"} ${f.minimum} character(s)`;else if(f.type==="number")h=`Number must be ${f.exact?"exactly equal to ":f.inclusive?"greater than or equal to ":"greater than "}${f.minimum}`;else if(f.type==="date")h=`Date must be ${f.exact?"exactly equal to ":f.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(f.minimum))}`;else h="Invalid input";break;case U.too_big:if(f.type==="array")h=`Array must contain ${f.exact?"exactly":f.inclusive?"at most":"less than"} ${f.maximum} element(s)`;else if(f.type==="string")h=`String must contain ${f.exact?"exactly":f.inclusive?"at most":"under"} ${f.maximum} character(s)`;else if(f.type==="number")h=`Number must be ${f.exact?"exactly":f.inclusive?"less than or equal to":"less than"} ${f.maximum}`;else if(f.type==="bigint")h=`BigInt must be ${f.exact?"exactly":f.inclusive?"less than or equal to":"less than"} ${f.maximum}`;else if(f.type==="date")h=`Date must be ${f.exact?"exactly":f.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(f.maximum))}`;else h="Invalid input";break;case U.custom:h="Invalid input";break;case U.invalid_intersection_types:h="Intersection results could not be merged";break;case U.not_multiple_of:h=`Number must be a multiple of ${f.multipleOf}`;break;case U.not_finite:h="Number must be finite";break;default:h=v.defaultError,hv.assertNever(f)}return{message:h}},fh,r1=(f)=>{let{data:v,path:h,errorMaps:J,issueData:Q}=f,W=[...h,...Q.path||[]],X={...Q,path:W};if(Q.message!==void 0)return{...Q,path:W,message:Q.message};let Y="",B=J.filter((q)=>!!q).slice().reverse();for(let q of B)Y=q(X,{data:v,defaultError:Y}).message;return{...Q,path:W,message:Y}},W6,p,sf=(f)=>({status:"dirty",value:f}),gv=(f)=>({status:"valid",value:f}),r0=(f)=>f.status==="aborted",u0=(f)=>f.status==="dirty",gf=(f)=>f.status==="valid",M1=(f)=>typeof Promise!=="undefined"&&f instanceof Promise,u,j1,L1,oQ=(f,v)=>{if(gf(v))return{success:!0,data:v.value};else{if(!f.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let h=new uv(f.common.issues);return this._error=h,this._error}}}},P6,X6,Y6,B6,G6,w6,q6,D6,H6="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",x0,O6,K6,$6,j6,L6,M6,hh="((\\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])))",E6,ev,Vf,Ff,v1,yf,E1,f1,Q1,If,Ef,Xf,V1,vf,$v,h1,Of=(f)=>{if(f instanceof W1)return Of(f.schema);else if(f instanceof iv)return Of(f.innerType());else if(f instanceof P1)return[f.value];else if(f instanceof Nf)return f.options;else if(f instanceof X1)return hv.objectValues(f.enum);else if(f instanceof Y1)return Of(f._def.innerType);else if(f instanceof f1)return[void 0];else if(f instanceof Q1)return[null];else if(f instanceof mv)return[void 0,...Of(f.unwrap())];else if(f instanceof $f)return[null,...Of(f.unwrap())];else if(f instanceof a1)return Of(f.unwrap());else if(f instanceof G1)return Of(f.unwrap());else if(f instanceof B1)return Of(f._def.innerType);else return[]},m1,J1,Yf,F1,N1,Cf,of,W1,P1,Nf,X1,Tf,iv,mv,$f,Y1,B1,U1,A6,a1,z1,G1,S6,z,b6=(f,v={message:`Input not instance of ${f.name}`})=>Xh((h)=>h instanceof f,v),Yh,Bh,R6,_6,Gh,l6,k6,g6,y6,I6,C6,T6,x6,Z6,r6,u6,m6,a6,c6,p6,n6,i6,d6,t6,s6,o6,e6,vW,fW,vh,QW,hW,JW,WW,PW=()=>Yh().optional(),XW=()=>Bh().optional(),YW=()=>Gh().optional(),BW,GW,P;var av=T0(()=>{(function(f){f.assertEqual=(Q)=>Q;function v(Q){}f.assertIs=v;function h(Q){throw new Error}f.assertNever=h,f.arrayToEnum=(Q)=>{let W={};for(let X of Q)W[X]=X;return W},f.getValidEnumValues=(Q)=>{let W=f.objectKeys(Q).filter((Y)=>typeof Q[Q[Y]]!=="number"),X={};for(let Y of W)X[Y]=Q[Y];return f.objectValues(X)},f.objectValues=(Q)=>{return f.objectKeys(Q).map(function(W){return Q[W]})},f.objectKeys=typeof Object.keys==="function"?(Q)=>Object.keys(Q):(Q)=>{let W=[];for(let X in Q)if(Object.prototype.hasOwnProperty.call(Q,X))W.push(X);return W},f.find=(Q,W)=>{for(let X of Q)if(W(X))return X;return},f.isInteger=typeof Number.isInteger==="function"?(Q)=>Number.isInteger(Q):(Q)=>typeof Q==="number"&&isFinite(Q)&&Math.floor(Q)===Q;function J(Q,W=" | "){return Q.map((X)=>typeof X==="string"?`'${X}'`:X).join(W)}f.joinValues=J,f.jsonStringifyReplacer=(Q,W)=>{if(typeof W==="bigint")return W.toString();return W}})(hv||(hv={}));(function(f){f.mergeShapes=(v,h)=>{return{...v,...h}}})(Z0||(Z0={}));I=hv.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),U=hv.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"]);uv=class uv extends Error{get errors(){return this.issues}constructor(f){super();this.issues=[],this.addIssue=(h)=>{this.issues=[...this.issues,h]},this.addIssues=(h=[])=>{this.issues=[...this.issues,...h]};let v=new.target.prototype;if(Object.setPrototypeOf)Object.setPrototypeOf(this,v);else this.__proto__=v;this.name="ZodError",this.issues=f}format(f){let v=f||function(Q){return Q.message},h={_errors:[]},J=(Q)=>{for(let W of Q.issues)if(W.code==="invalid_union")W.unionErrors.map(J);else if(W.code==="invalid_return_type")J(W.returnTypeError);else if(W.code==="invalid_arguments")J(W.argumentsError);else if(W.path.length===0)h._errors.push(v(W));else{let X=h,Y=0;while(Y<W.path.length){let B=W.path[Y];if(Y!==W.path.length-1)X[B]=X[B]||{_errors:[]};else X[B]=X[B]||{_errors:[]},X[B]._errors.push(v(W));X=X[B],Y++}}};return J(this),h}static assert(f){if(!(f instanceof uv))throw new Error(`Not a ZodError: ${f}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,hv.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(f=(v)=>v.message){let v={},h=[];for(let J of this.issues)if(J.path.length>0)v[J.path[0]]=v[J.path[0]]||[],v[J.path[0]].push(f(J));else h.push(f(J));return{formErrors:h,fieldErrors:v}}get formErrors(){return this.flatten()}};uv.create=(f)=>{return new uv(f)};fh=ef;W6=[];p=Object.freeze({status:"aborted"});(function(f){f.errToObj=(v)=>typeof v==="string"?{message:v}:v||{},f.toString=(v)=>typeof v==="string"?v:v===null||v===void 0?void 0:v.message})(u||(u={}));P6=/^c[^\s-]{8,}$/i,X6=/^[0-9a-z]+$/,Y6=/^[0-9A-HJKMNP-TV-Z]{26}$/i,B6=/^[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,G6=/^[a-z0-9_-]{21}$/i,w6=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,q6=/^[-+]?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)?)??$/,D6=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,O6=/^(?:(?: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])$/,K6=/^(?:(?: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])$/,$6=/^(([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]))$/,j6=/^(([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])$/,L6=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,M6=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,E6=new RegExp(`^${hh}$`);ev=class ev extends i{_parse(f){if(this._def.coerce)f.data=String(f.data);if(this._getType(f)!==I.string){let Q=this._getOrReturnCtx(f);return g(Q,{code:U.invalid_type,expected:I.string,received:Q.parsedType}),p}let h=new Rv,J=void 0;for(let Q of this._def.checks)if(Q.kind==="min"){if(f.data.length<Q.value)J=this._getOrReturnCtx(f,J),g(J,{code:U.too_small,minimum:Q.value,type:"string",inclusive:!0,exact:!1,message:Q.message}),h.dirty()}else if(Q.kind==="max"){if(f.data.length>Q.value)J=this._getOrReturnCtx(f,J),g(J,{code:U.too_big,maximum:Q.value,type:"string",inclusive:!0,exact:!1,message:Q.message}),h.dirty()}else if(Q.kind==="length"){let W=f.data.length>Q.value,X=f.data.length<Q.value;if(W||X){if(J=this._getOrReturnCtx(f,J),W)g(J,{code:U.too_big,maximum:Q.value,type:"string",inclusive:!0,exact:!0,message:Q.message});else if(X)g(J,{code:U.too_small,minimum:Q.value,type:"string",inclusive:!0,exact:!0,message:Q.message});h.dirty()}}else if(Q.kind==="email"){if(!D6.test(f.data))J=this._getOrReturnCtx(f,J),g(J,{validation:"email",code:U.invalid_string,message:Q.message}),h.dirty()}else if(Q.kind==="emoji"){if(!x0)x0=new RegExp(H6,"u");if(!x0.test(f.data))J=this._getOrReturnCtx(f,J),g(J,{validation:"emoji",code:U.invalid_string,message:Q.message}),h.dirty()}else if(Q.kind==="uuid"){if(!B6.test(f.data))J=this._getOrReturnCtx(f,J),g(J,{validation:"uuid",code:U.invalid_string,message:Q.message}),h.dirty()}else if(Q.kind==="nanoid"){if(!G6.test(f.data))J=this._getOrReturnCtx(f,J),g(J,{validation:"nanoid",code:U.invalid_string,message:Q.message}),h.dirty()}else if(Q.kind==="cuid"){if(!P6.test(f.data))J=this._getOrReturnCtx(f,J),g(J,{validation:"cuid",code:U.invalid_string,message:Q.message}),h.dirty()}else if(Q.kind==="cuid2"){if(!X6.test(f.data))J=this._getOrReturnCtx(f,J),g(J,{validation:"cuid2",code:U.invalid_string,message:Q.message}),h.dirty()}else if(Q.kind==="ulid"){if(!Y6.test(f.data))J=this._getOrReturnCtx(f,J),g(J,{validation:"ulid",code:U.invalid_string,message:Q.message}),h.dirty()}else if(Q.kind==="url")try{new URL(f.data)}catch(W){J=this._getOrReturnCtx(f,J),g(J,{validation:"url",code:U.invalid_string,message:Q.message}),h.dirty()}else if(Q.kind==="regex"){if(Q.regex.lastIndex=0,!Q.regex.test(f.data))J=this._getOrReturnCtx(f,J),g(J,{validation:"regex",code:U.invalid_string,message:Q.message}),h.dirty()}else if(Q.kind==="trim")f.data=f.data.trim();else if(Q.kind==="includes"){if(!f.data.includes(Q.value,Q.position))J=this._getOrReturnCtx(f,J),g(J,{code:U.invalid_string,validation:{includes:Q.value,position:Q.position},message:Q.message}),h.dirty()}else if(Q.kind==="toLowerCase")f.data=f.data.toLowerCase();else if(Q.kind==="toUpperCase")f.data=f.data.toUpperCase();else if(Q.kind==="startsWith"){if(!f.data.startsWith(Q.value))J=this._getOrReturnCtx(f,J),g(J,{code:U.invalid_string,validation:{startsWith:Q.value},message:Q.message}),h.dirty()}else if(Q.kind==="endsWith"){if(!f.data.endsWith(Q.value))J=this._getOrReturnCtx(f,J),g(J,{code:U.invalid_string,validation:{endsWith:Q.value},message:Q.message}),h.dirty()}else if(Q.kind==="datetime"){if(!Wh(Q).test(f.data))J=this._getOrReturnCtx(f,J),g(J,{code:U.invalid_string,validation:"datetime",message:Q.message}),h.dirty()}else if(Q.kind==="date"){if(!E6.test(f.data))J=this._getOrReturnCtx(f,J),g(J,{code:U.invalid_string,validation:"date",message:Q.message}),h.dirty()}else if(Q.kind==="time"){if(!V6(Q).test(f.data))J=this._getOrReturnCtx(f,J),g(J,{code:U.invalid_string,validation:"time",message:Q.message}),h.dirty()}else if(Q.kind==="duration"){if(!q6.test(f.data))J=this._getOrReturnCtx(f,J),g(J,{validation:"duration",code:U.invalid_string,message:Q.message}),h.dirty()}else if(Q.kind==="ip"){if(!F6(f.data,Q.version))J=this._getOrReturnCtx(f,J),g(J,{validation:"ip",code:U.invalid_string,message:Q.message}),h.dirty()}else if(Q.kind==="jwt"){if(!N6(f.data,Q.alg))J=this._getOrReturnCtx(f,J),g(J,{validation:"jwt",code:U.invalid_string,message:Q.message}),h.dirty()}else if(Q.kind==="cidr"){if(!U6(f.data,Q.version))J=this._getOrReturnCtx(f,J),g(J,{validation:"cidr",code:U.invalid_string,message:Q.message}),h.dirty()}else if(Q.kind==="base64"){if(!L6.test(f.data))J=this._getOrReturnCtx(f,J),g(J,{validation:"base64",code:U.invalid_string,message:Q.message}),h.dirty()}else if(Q.kind==="base64url"){if(!M6.test(f.data))J=this._getOrReturnCtx(f,J),g(J,{validation:"base64url",code:U.invalid_string,message:Q.message}),h.dirty()}else hv.assertNever(Q);return{status:h.value,value:f.data}}_regex(f,v,h){return this.refinement((J)=>f.test(J),{validation:v,code:U.invalid_string,...u.errToObj(h)})}_addCheck(f){return new ev({...this._def,checks:[...this._def.checks,f]})}email(f){return this._addCheck({kind:"email",...u.errToObj(f)})}url(f){return this._addCheck({kind:"url",...u.errToObj(f)})}emoji(f){return this._addCheck({kind:"emoji",...u.errToObj(f)})}uuid(f){return this._addCheck({kind:"uuid",...u.errToObj(f)})}nanoid(f){return this._addCheck({kind:"nanoid",...u.errToObj(f)})}cuid(f){return this._addCheck({kind:"cuid",...u.errToObj(f)})}cuid2(f){return this._addCheck({kind:"cuid2",...u.errToObj(f)})}ulid(f){return this._addCheck({kind:"ulid",...u.errToObj(f)})}base64(f){return this._addCheck({kind:"base64",...u.errToObj(f)})}base64url(f){return this._addCheck({kind:"base64url",...u.errToObj(f)})}jwt(f){return this._addCheck({kind:"jwt",...u.errToObj(f)})}ip(f){return this._addCheck({kind:"ip",...u.errToObj(f)})}cidr(f){return this._addCheck({kind:"cidr",...u.errToObj(f)})}datetime(f){var v,h;if(typeof f==="string")return this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:f});return this._addCheck({kind:"datetime",precision:typeof(f===null||f===void 0?void 0:f.precision)==="undefined"?null:f===null||f===void 0?void 0:f.precision,offset:(v=f===null||f===void 0?void 0:f.offset)!==null&&v!==void 0?v:!1,local:(h=f===null||f===void 0?void 0:f.local)!==null&&h!==void 0?h:!1,...u.errToObj(f===null||f===void 0?void 0:f.message)})}date(f){return this._addCheck({kind:"date",message:f})}time(f){if(typeof f==="string")return this._addCheck({kind:"time",precision:null,message:f});return this._addCheck({kind:"time",precision:typeof(f===null||f===void 0?void 0:f.precision)==="undefined"?null:f===null||f===void 0?void 0:f.precision,...u.errToObj(f===null||f===void 0?void 0:f.message)})}duration(f){return this._addCheck({kind:"duration",...u.errToObj(f)})}regex(f,v){return this._addCheck({kind:"regex",regex:f,...u.errToObj(v)})}includes(f,v){return this._addCheck({kind:"includes",value:f,position:v===null||v===void 0?void 0:v.position,...u.errToObj(v===null||v===void 0?void 0:v.message)})}startsWith(f,v){return this._addCheck({kind:"startsWith",value:f,...u.errToObj(v)})}endsWith(f,v){return this._addCheck({kind:"endsWith",value:f,...u.errToObj(v)})}min(f,v){return this._addCheck({kind:"min",value:f,...u.errToObj(v)})}max(f,v){return this._addCheck({kind:"max",value:f,...u.errToObj(v)})}length(f,v){return this._addCheck({kind:"length",value:f,...u.errToObj(v)})}nonempty(f){return this.min(1,u.errToObj(f))}trim(){return new ev({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new ev({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new ev({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find((f)=>f.kind==="datetime")}get isDate(){return!!this._def.checks.find((f)=>f.kind==="date")}get isTime(){return!!this._def.checks.find((f)=>f.kind==="time")}get isDuration(){return!!this._def.checks.find((f)=>f.kind==="duration")}get isEmail(){return!!this._def.checks.find((f)=>f.kind==="email")}get isURL(){return!!this._def.checks.find((f)=>f.kind==="url")}get isEmoji(){return!!this._def.checks.find((f)=>f.kind==="emoji")}get isUUID(){return!!this._def.checks.find((f)=>f.kind==="uuid")}get isNANOID(){return!!this._def.checks.find((f)=>f.kind==="nanoid")}get isCUID(){return!!this._def.checks.find((f)=>f.kind==="cuid")}get isCUID2(){return!!this._def.checks.find((f)=>f.kind==="cuid2")}get isULID(){return!!this._def.checks.find((f)=>f.kind==="ulid")}get isIP(){return!!this._def.checks.find((f)=>f.kind==="ip")}get isCIDR(){return!!this._def.checks.find((f)=>f.kind==="cidr")}get isBase64(){return!!this._def.checks.find((f)=>f.kind==="base64")}get isBase64url(){return!!this._def.checks.find((f)=>f.kind==="base64url")}get minLength(){let f=null;for(let v of this._def.checks)if(v.kind==="min"){if(f===null||v.value>f)f=v.value}return f}get maxLength(){let f=null;for(let v of this._def.checks)if(v.kind==="max"){if(f===null||v.value<f)f=v.value}return f}};ev.create=(f)=>{var v;return new ev({checks:[],typeName:z.ZodString,coerce:(v=f===null||f===void 0?void 0:f.coerce)!==null&&v!==void 0?v:!1,...d(f)})};Vf=class Vf extends i{constructor(){super(...arguments);this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(f){if(this._def.coerce)f.data=Number(f.data);if(this._getType(f)!==I.number){let Q=this._getOrReturnCtx(f);return g(Q,{code:U.invalid_type,expected:I.number,received:Q.parsedType}),p}let h=void 0,J=new Rv;for(let Q of this._def.checks)if(Q.kind==="int"){if(!hv.isInteger(f.data))h=this._getOrReturnCtx(f,h),g(h,{code:U.invalid_type,expected:"integer",received:"float",message:Q.message}),J.dirty()}else if(Q.kind==="min"){if(Q.inclusive?f.data<Q.value:f.data<=Q.value)h=this._getOrReturnCtx(f,h),g(h,{code:U.too_small,minimum:Q.value,type:"number",inclusive:Q.inclusive,exact:!1,message:Q.message}),J.dirty()}else if(Q.kind==="max"){if(Q.inclusive?f.data>Q.value:f.data>=Q.value)h=this._getOrReturnCtx(f,h),g(h,{code:U.too_big,maximum:Q.value,type:"number",inclusive:Q.inclusive,exact:!1,message:Q.message}),J.dirty()}else if(Q.kind==="multipleOf"){if(z6(f.data,Q.value)!==0)h=this._getOrReturnCtx(f,h),g(h,{code:U.not_multiple_of,multipleOf:Q.value,message:Q.message}),J.dirty()}else if(Q.kind==="finite"){if(!Number.isFinite(f.data))h=this._getOrReturnCtx(f,h),g(h,{code:U.not_finite,message:Q.message}),J.dirty()}else hv.assertNever(Q);return{status:J.value,value:f.data}}gte(f,v){return this.setLimit("min",f,!0,u.toString(v))}gt(f,v){return this.setLimit("min",f,!1,u.toString(v))}lte(f,v){return this.setLimit("max",f,!0,u.toString(v))}lt(f,v){return this.setLimit("max",f,!1,u.toString(v))}setLimit(f,v,h,J){return new Vf({...this._def,checks:[...this._def.checks,{kind:f,value:v,inclusive:h,message:u.toString(J)}]})}_addCheck(f){return new Vf({...this._def,checks:[...this._def.checks,f]})}int(f){return this._addCheck({kind:"int",message:u.toString(f)})}positive(f){return this._addCheck({kind:"min",value:0,inclusive:!1,message:u.toString(f)})}negative(f){return this._addCheck({kind:"max",value:0,inclusive:!1,message:u.toString(f)})}nonpositive(f){return this._addCheck({kind:"max",value:0,inclusive:!0,message:u.toString(f)})}nonnegative(f){return this._addCheck({kind:"min",value:0,inclusive:!0,message:u.toString(f)})}multipleOf(f,v){return this._addCheck({kind:"multipleOf",value:f,message:u.toString(v)})}finite(f){return this._addCheck({kind:"finite",message:u.toString(f)})}safe(f){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:u.toString(f)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:u.toString(f)})}get minValue(){let f=null;for(let v of this._def.checks)if(v.kind==="min"){if(f===null||v.value>f)f=v.value}return f}get maxValue(){let f=null;for(let v of this._def.checks)if(v.kind==="max"){if(f===null||v.value<f)f=v.value}return f}get isInt(){return!!this._def.checks.find((f)=>f.kind==="int"||f.kind==="multipleOf"&&hv.isInteger(f.value))}get isFinite(){let f=null,v=null;for(let h of this._def.checks)if(h.kind==="finite"||h.kind==="int"||h.kind==="multipleOf")return!0;else if(h.kind==="min"){if(v===null||h.value>v)v=h.value}else if(h.kind==="max"){if(f===null||h.value<f)f=h.value}return Number.isFinite(v)&&Number.isFinite(f)}};Vf.create=(f)=>{return new Vf({checks:[],typeName:z.ZodNumber,coerce:(f===null||f===void 0?void 0:f.coerce)||!1,...d(f)})};Ff=class Ff extends i{constructor(){super(...arguments);this.min=this.gte,this.max=this.lte}_parse(f){if(this._def.coerce)try{f.data=BigInt(f.data)}catch(Q){return this._getInvalidInput(f)}if(this._getType(f)!==I.bigint)return this._getInvalidInput(f);let h=void 0,J=new Rv;for(let Q of this._def.checks)if(Q.kind==="min"){if(Q.inclusive?f.data<Q.value:f.data<=Q.value)h=this._getOrReturnCtx(f,h),g(h,{code:U.too_small,type:"bigint",minimum:Q.value,inclusive:Q.inclusive,message:Q.message}),J.dirty()}else if(Q.kind==="max"){if(Q.inclusive?f.data>Q.value:f.data>=Q.value)h=this._getOrReturnCtx(f,h),g(h,{code:U.too_big,type:"bigint",maximum:Q.value,inclusive:Q.inclusive,message:Q.message}),J.dirty()}else if(Q.kind==="multipleOf"){if(f.data%Q.value!==BigInt(0))h=this._getOrReturnCtx(f,h),g(h,{code:U.not_multiple_of,multipleOf:Q.value,message:Q.message}),J.dirty()}else hv.assertNever(Q);return{status:J.value,value:f.data}}_getInvalidInput(f){let v=this._getOrReturnCtx(f);return g(v,{code:U.invalid_type,expected:I.bigint,received:v.parsedType}),p}gte(f,v){return this.setLimit("min",f,!0,u.toString(v))}gt(f,v){return this.setLimit("min",f,!1,u.toString(v))}lte(f,v){return this.setLimit("max",f,!0,u.toString(v))}lt(f,v){return this.setLimit("max",f,!1,u.toString(v))}setLimit(f,v,h,J){return new Ff({...this._def,checks:[...this._def.checks,{kind:f,value:v,inclusive:h,message:u.toString(J)}]})}_addCheck(f){return new Ff({...this._def,checks:[...this._def.checks,f]})}positive(f){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:u.toString(f)})}negative(f){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:u.toString(f)})}nonpositive(f){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:u.toString(f)})}nonnegative(f){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:u.toString(f)})}multipleOf(f,v){return this._addCheck({kind:"multipleOf",value:f,message:u.toString(v)})}get minValue(){let f=null;for(let v of this._def.checks)if(v.kind==="min"){if(f===null||v.value>f)f=v.value}return f}get maxValue(){let f=null;for(let v of this._def.checks)if(v.kind==="max"){if(f===null||v.value<f)f=v.value}return f}};Ff.create=(f)=>{var v;return new Ff({checks:[],typeName:z.ZodBigInt,coerce:(v=f===null||f===void 0?void 0:f.coerce)!==null&&v!==void 0?v:!1,...d(f)})};v1=class v1 extends i{_parse(f){if(this._def.coerce)f.data=Boolean(f.data);if(this._getType(f)!==I.boolean){let h=this._getOrReturnCtx(f);return g(h,{code:U.invalid_type,expected:I.boolean,received:h.parsedType}),p}return gv(f.data)}};v1.create=(f)=>{return new v1({typeName:z.ZodBoolean,coerce:(f===null||f===void 0?void 0:f.coerce)||!1,...d(f)})};yf=class yf extends i{_parse(f){if(this._def.coerce)f.data=new Date(f.data);if(this._getType(f)!==I.date){let Q=this._getOrReturnCtx(f);return g(Q,{code:U.invalid_type,expected:I.date,received:Q.parsedType}),p}if(isNaN(f.data.getTime())){let Q=this._getOrReturnCtx(f);return g(Q,{code:U.invalid_date}),p}let h=new Rv,J=void 0;for(let Q of this._def.checks)if(Q.kind==="min"){if(f.data.getTime()<Q.value)J=this._getOrReturnCtx(f,J),g(J,{code:U.too_small,message:Q.message,inclusive:!0,exact:!1,minimum:Q.value,type:"date"}),h.dirty()}else if(Q.kind==="max"){if(f.data.getTime()>Q.value)J=this._getOrReturnCtx(f,J),g(J,{code:U.too_big,message:Q.message,inclusive:!0,exact:!1,maximum:Q.value,type:"date"}),h.dirty()}else hv.assertNever(Q);return{status:h.value,value:new Date(f.data.getTime())}}_addCheck(f){return new yf({...this._def,checks:[...this._def.checks,f]})}min(f,v){return this._addCheck({kind:"min",value:f.getTime(),message:u.toString(v)})}max(f,v){return this._addCheck({kind:"max",value:f.getTime(),message:u.toString(v)})}get minDate(){let f=null;for(let v of this._def.checks)if(v.kind==="min"){if(f===null||v.value>f)f=v.value}return f!=null?new Date(f):null}get maxDate(){let f=null;for(let v of this._def.checks)if(v.kind==="max"){if(f===null||v.value<f)f=v.value}return f!=null?new Date(f):null}};yf.create=(f)=>{return new yf({checks:[],coerce:(f===null||f===void 0?void 0:f.coerce)||!1,typeName:z.ZodDate,...d(f)})};E1=class E1 extends i{_parse(f){if(this._getType(f)!==I.symbol){let h=this._getOrReturnCtx(f);return g(h,{code:U.invalid_type,expected:I.symbol,received:h.parsedType}),p}return gv(f.data)}};E1.create=(f)=>{return new E1({typeName:z.ZodSymbol,...d(f)})};f1=class f1 extends i{_parse(f){if(this._getType(f)!==I.undefined){let h=this._getOrReturnCtx(f);return g(h,{code:U.invalid_type,expected:I.undefined,received:h.parsedType}),p}return gv(f.data)}};f1.create=(f)=>{return new f1({typeName:z.ZodUndefined,...d(f)})};Q1=class Q1 extends i{_parse(f){if(this._getType(f)!==I.null){let h=this._getOrReturnCtx(f);return g(h,{code:U.invalid_type,expected:I.null,received:h.parsedType}),p}return gv(f.data)}};Q1.create=(f)=>{return new Q1({typeName:z.ZodNull,...d(f)})};If=class If extends i{constructor(){super(...arguments);this._any=!0}_parse(f){return gv(f.data)}};If.create=(f)=>{return new If({typeName:z.ZodAny,...d(f)})};Ef=class Ef extends i{constructor(){super(...arguments);this._unknown=!0}_parse(f){return gv(f.data)}};Ef.create=(f)=>{return new Ef({typeName:z.ZodUnknown,...d(f)})};Xf=class Xf extends i{_parse(f){let v=this._getOrReturnCtx(f);return g(v,{code:U.invalid_type,expected:I.never,received:v.parsedType}),p}};Xf.create=(f)=>{return new Xf({typeName:z.ZodNever,...d(f)})};V1=class V1 extends i{_parse(f){if(this._getType(f)!==I.undefined){let h=this._getOrReturnCtx(f);return g(h,{code:U.invalid_type,expected:I.void,received:h.parsedType}),p}return gv(f.data)}};V1.create=(f)=>{return new V1({typeName:z.ZodVoid,...d(f)})};vf=class vf extends i{_parse(f){let{ctx:v,status:h}=this._processInputParams(f),J=this._def;if(v.parsedType!==I.array)return g(v,{code:U.invalid_type,expected:I.array,received:v.parsedType}),p;if(J.exactLength!==null){let W=v.data.length>J.exactLength.value,X=v.data.length<J.exactLength.value;if(W||X)g(v,{code:W?U.too_big:U.too_small,minimum:X?J.exactLength.value:void 0,maximum:W?J.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:J.exactLength.message}),h.dirty()}if(J.minLength!==null){if(v.data.length<J.minLength.value)g(v,{code:U.too_small,minimum:J.minLength.value,type:"array",inclusive:!0,exact:!1,message:J.minLength.message}),h.dirty()}if(J.maxLength!==null){if(v.data.length>J.maxLength.value)g(v,{code:U.too_big,maximum:J.maxLength.value,type:"array",inclusive:!0,exact:!1,message:J.maxLength.message}),h.dirty()}if(v.common.async)return Promise.all([...v.data].map((W,X)=>{return J.type._parseAsync(new ff(v,W,v.path,X))})).then((W)=>{return Rv.mergeArray(h,W)});let Q=[...v.data].map((W,X)=>{return J.type._parseSync(new ff(v,W,v.path,X))});return Rv.mergeArray(h,Q)}get element(){return this._def.type}min(f,v){return new vf({...this._def,minLength:{value:f,message:u.toString(v)}})}max(f,v){return new vf({...this._def,maxLength:{value:f,message:u.toString(v)}})}length(f,v){return new vf({...this._def,exactLength:{value:f,message:u.toString(v)}})}nonempty(f){return this.min(1,f)}};vf.create=(f,v)=>{return new vf({type:f,minLength:null,maxLength:null,exactLength:null,typeName:z.ZodArray,...d(v)})};$v=class $v extends i{constructor(){super(...arguments);this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let f=this._def.shape(),v=hv.objectKeys(f);return this._cached={shape:f,keys:v}}_parse(f){if(this._getType(f)!==I.object){let B=this._getOrReturnCtx(f);return g(B,{code:U.invalid_type,expected:I.object,received:B.parsedType}),p}let{status:h,ctx:J}=this._processInputParams(f),{shape:Q,keys:W}=this._getCached(),X=[];if(!(this._def.catchall instanceof Xf&&this._def.unknownKeys==="strip")){for(let B in J.data)if(!W.includes(B))X.push(B)}let Y=[];for(let B of W){let q=Q[B],D=J.data[B];Y.push({key:{status:"valid",value:B},value:q._parse(new ff(J,D,J.path,B)),alwaysSet:B in J.data})}if(this._def.catchall instanceof Xf){let B=this._def.unknownKeys;if(B==="passthrough")for(let q of X)Y.push({key:{status:"valid",value:q},value:{status:"valid",value:J.data[q]}});else if(B==="strict"){if(X.length>0)g(J,{code:U.unrecognized_keys,keys:X}),h.dirty()}else if(B==="strip");else throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let B=this._def.catchall;for(let q of X){let D=J.data[q];Y.push({key:{status:"valid",value:q},value:B._parse(new ff(J,D,J.path,q)),alwaysSet:q in J.data})}}if(J.common.async)return Promise.resolve().then(async()=>{let B=[];for(let q of Y){let D=await q.key,j=await q.value;B.push({key:D,value:j,alwaysSet:q.alwaysSet})}return B}).then((B)=>{return Rv.mergeObjectSync(h,B)});else return Rv.mergeObjectSync(h,Y)}get shape(){return this._def.shape()}strict(f){return u.errToObj,new $v({...this._def,unknownKeys:"strict",...f!==void 0?{errorMap:(v,h)=>{var J,Q,W,X;let Y=(W=(Q=(J=this._def).errorMap)===null||Q===void 0?void 0:Q.call(J,v,h).message)!==null&&W!==void 0?W:h.defaultError;if(v.code==="unrecognized_keys")return{message:(X=u.errToObj(f).message)!==null&&X!==void 0?X:Y};return{message:Y}}}:{}})}strip(){return new $v({...this._def,unknownKeys:"strip"})}passthrough(){return new $v({...this._def,unknownKeys:"passthrough"})}extend(f){return new $v({...this._def,shape:()=>({...this._def.shape(),...f})})}merge(f){return new $v({unknownKeys:f._def.unknownKeys,catchall:f._def.catchall,shape:()=>({...this._def.shape(),...f._def.shape()}),typeName:z.ZodObject})}setKey(f,v){return this.augment({[f]:v})}catchall(f){return new $v({...this._def,catchall:f})}pick(f){let v={};return hv.objectKeys(f).forEach((h)=>{if(f[h]&&this.shape[h])v[h]=this.shape[h]}),new $v({...this._def,shape:()=>v})}omit(f){let v={};return hv.objectKeys(this.shape).forEach((h)=>{if(!f[h])v[h]=this.shape[h]}),new $v({...this._def,shape:()=>v})}deepPartial(){return tf(this)}partial(f){let v={};return hv.objectKeys(this.shape).forEach((h)=>{let J=this.shape[h];if(f&&!f[h])v[h]=J;else v[h]=J.optional()}),new $v({...this._def,shape:()=>v})}required(f){let v={};return hv.objectKeys(this.shape).forEach((h)=>{if(f&&!f[h])v[h]=this.shape[h];else{let Q=this.shape[h];while(Q instanceof mv)Q=Q._def.innerType;v[h]=Q}}),new $v({...this._def,shape:()=>v})}keyof(){return Ph(hv.objectKeys(this.shape))}};$v.create=(f,v)=>{return new $v({shape:()=>f,unknownKeys:"strip",catchall:Xf.create(),typeName:z.ZodObject,...d(v)})};$v.strictCreate=(f,v)=>{return new $v({shape:()=>f,unknownKeys:"strict",catchall:Xf.create(),typeName:z.ZodObject,...d(v)})};$v.lazycreate=(f,v)=>{return new $v({shape:f,unknownKeys:"strip",catchall:Xf.create(),typeName:z.ZodObject,...d(v)})};h1=class h1 extends i{_parse(f){let{ctx:v}=this._processInputParams(f),h=this._def.options;function J(Q){for(let X of Q)if(X.result.status==="valid")return X.result;for(let X of Q)if(X.result.status==="dirty")return v.common.issues.push(...X.ctx.common.issues),X.result;let W=Q.map((X)=>new uv(X.ctx.common.issues));return g(v,{code:U.invalid_union,unionErrors:W}),p}if(v.common.async)return Promise.all(h.map(async(Q)=>{let W={...v,common:{...v.common,issues:[]},parent:null};return{result:await Q._parseAsync({data:v.data,path:v.path,parent:W}),ctx:W}})).then(J);else{let Q=void 0,W=[];for(let Y of h){let B={...v,common:{...v.common,issues:[]},parent:null},q=Y._parseSync({data:v.data,path:v.path,parent:B});if(q.status==="valid")return q;else if(q.status==="dirty"&&!Q)Q={result:q,ctx:B};if(B.common.issues.length)W.push(B.common.issues)}if(Q)return v.common.issues.push(...Q.ctx.common.issues),Q.result;let X=W.map((Y)=>new uv(Y));return g(v,{code:U.invalid_union,unionErrors:X}),p}}get options(){return this._def.options}};h1.create=(f,v)=>{return new h1({options:f,typeName:z.ZodUnion,...d(v)})};m1=class m1 extends i{_parse(f){let{ctx:v}=this._processInputParams(f);if(v.parsedType!==I.object)return g(v,{code:U.invalid_type,expected:I.object,received:v.parsedType}),p;let h=this.discriminator,J=v.data[h],Q=this.optionsMap.get(J);if(!Q)return g(v,{code:U.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[h]}),p;if(v.common.async)return Q._parseAsync({data:v.data,path:v.path,parent:v});else return Q._parseSync({data:v.data,path:v.path,parent:v})}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(f,v,h){let J=new Map;for(let Q of v){let W=Of(Q.shape[f]);if(!W.length)throw new Error(`A discriminator value for key \`${f}\` could not be extracted from all schema options`);for(let X of W){if(J.has(X))throw new Error(`Discriminator property ${String(f)} has duplicate value ${String(X)}`);J.set(X,Q)}}return new m1({typeName:z.ZodDiscriminatedUnion,discriminator:f,options:v,optionsMap:J,...d(h)})}};J1=class J1 extends i{_parse(f){let{status:v,ctx:h}=this._processInputParams(f),J=(Q,W)=>{if(r0(Q)||r0(W))return p;let X=m0(Q.value,W.value);if(!X.valid)return g(h,{code:U.invalid_intersection_types}),p;if(u0(Q)||u0(W))v.dirty();return{status:v.value,value:X.data}};if(h.common.async)return Promise.all([this._def.left._parseAsync({data:h.data,path:h.path,parent:h}),this._def.right._parseAsync({data:h.data,path:h.path,parent:h})]).then(([Q,W])=>J(Q,W));else return J(this._def.left._parseSync({data:h.data,path:h.path,parent:h}),this._def.right._parseSync({data:h.data,path:h.path,parent:h}))}};J1.create=(f,v,h)=>{return new J1({left:f,right:v,typeName:z.ZodIntersection,...d(h)})};Yf=class Yf extends i{_parse(f){let{status:v,ctx:h}=this._processInputParams(f);if(h.parsedType!==I.array)return g(h,{code:U.invalid_type,expected:I.array,received:h.parsedType}),p;if(h.data.length<this._def.items.length)return g(h,{code:U.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),p;if(!this._def.rest&&h.data.length>this._def.items.length)g(h,{code:U.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),v.dirty();let Q=[...h.data].map((W,X)=>{let Y=this._def.items[X]||this._def.rest;if(!Y)return null;return Y._parse(new ff(h,W,h.path,X))}).filter((W)=>!!W);if(h.common.async)return Promise.all(Q).then((W)=>{return Rv.mergeArray(v,W)});else return Rv.mergeArray(v,Q)}get items(){return this._def.items}rest(f){return new Yf({...this._def,rest:f})}};Yf.create=(f,v)=>{if(!Array.isArray(f))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Yf({items:f,typeName:z.ZodTuple,rest:null,...d(v)})};F1=class F1 extends i{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(f){let{status:v,ctx:h}=this._processInputParams(f);if(h.parsedType!==I.object)return g(h,{code:U.invalid_type,expected:I.object,received:h.parsedType}),p;let J=[],Q=this._def.keyType,W=this._def.valueType;for(let X in h.data)J.push({key:Q._parse(new ff(h,X,h.path,X)),value:W._parse(new ff(h,h.data[X],h.path,X)),alwaysSet:X in h.data});if(h.common.async)return Rv.mergeObjectAsync(v,J);else return Rv.mergeObjectSync(v,J)}get element(){return this._def.valueType}static create(f,v,h){if(v instanceof i)return new F1({keyType:f,valueType:v,typeName:z.ZodRecord,...d(h)});return new F1({keyType:ev.create(),valueType:f,typeName:z.ZodRecord,...d(v)})}};N1=class N1 extends i{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(f){let{status:v,ctx:h}=this._processInputParams(f);if(h.parsedType!==I.map)return g(h,{code:U.invalid_type,expected:I.map,received:h.parsedType}),p;let J=this._def.keyType,Q=this._def.valueType,W=[...h.data.entries()].map(([X,Y],B)=>{return{key:J._parse(new ff(h,X,h.path,[B,"key"])),value:Q._parse(new ff(h,Y,h.path,[B,"value"]))}});if(h.common.async){let X=new Map;return Promise.resolve().then(async()=>{for(let Y of W){let B=await Y.key,q=await Y.value;if(B.status==="aborted"||q.status==="aborted")return p;if(B.status==="dirty"||q.status==="dirty")v.dirty();X.set(B.value,q.value)}return{status:v.value,value:X}})}else{let X=new Map;for(let Y of W){let{key:B,value:q}=Y;if(B.status==="aborted"||q.status==="aborted")return p;if(B.status==="dirty"||q.status==="dirty")v.dirty();X.set(B.value,q.value)}return{status:v.value,value:X}}}};N1.create=(f,v,h)=>{return new N1({valueType:v,keyType:f,typeName:z.ZodMap,...d(h)})};Cf=class Cf extends i{_parse(f){let{status:v,ctx:h}=this._processInputParams(f);if(h.parsedType!==I.set)return g(h,{code:U.invalid_type,expected:I.set,received:h.parsedType}),p;let J=this._def;if(J.minSize!==null){if(h.data.size<J.minSize.value)g(h,{code:U.too_small,minimum:J.minSize.value,type:"set",inclusive:!0,exact:!1,message:J.minSize.message}),v.dirty()}if(J.maxSize!==null){if(h.data.size>J.maxSize.value)g(h,{code:U.too_big,maximum:J.maxSize.value,type:"set",inclusive:!0,exact:!1,message:J.maxSize.message}),v.dirty()}let Q=this._def.valueType;function W(Y){let B=new Set;for(let q of Y){if(q.status==="aborted")return p;if(q.status==="dirty")v.dirty();B.add(q.value)}return{status:v.value,value:B}}let X=[...h.data.values()].map((Y,B)=>Q._parse(new ff(h,Y,h.path,B)));if(h.common.async)return Promise.all(X).then((Y)=>W(Y));else return W(X)}min(f,v){return new Cf({...this._def,minSize:{value:f,message:u.toString(v)}})}max(f,v){return new Cf({...this._def,maxSize:{value:f,message:u.toString(v)}})}size(f,v){return this.min(f,v).max(f,v)}nonempty(f){return this.min(1,f)}};Cf.create=(f,v)=>{return new Cf({valueType:f,minSize:null,maxSize:null,typeName:z.ZodSet,...d(v)})};of=class of extends i{constructor(){super(...arguments);this.validate=this.implement}_parse(f){let{ctx:v}=this._processInputParams(f);if(v.parsedType!==I.function)return g(v,{code:U.invalid_type,expected:I.function,received:v.parsedType}),p;function h(X,Y){return r1({data:X,path:v.path,errorMaps:[v.common.contextualErrorMap,v.schemaErrorMap,Z1(),ef].filter((B)=>!!B),issueData:{code:U.invalid_arguments,argumentsError:Y}})}function J(X,Y){return r1({data:X,path:v.path,errorMaps:[v.common.contextualErrorMap,v.schemaErrorMap,Z1(),ef].filter((B)=>!!B),issueData:{code:U.invalid_return_type,returnTypeError:Y}})}let Q={errorMap:v.common.contextualErrorMap},W=v.data;if(this._def.returns instanceof Tf){let X=this;return gv(async function(...Y){let B=new uv([]),q=await X._def.args.parseAsync(Y,Q).catch((L)=>{throw B.addIssue(h(Y,L)),B}),D=await Reflect.apply(W,this,q);return await X._def.returns._def.type.parseAsync(D,Q).catch((L)=>{throw B.addIssue(J(D,L)),B})})}else{let X=this;return gv(function(...Y){let B=X._def.args.safeParse(Y,Q);if(!B.success)throw new uv([h(Y,B.error)]);let q=Reflect.apply(W,this,B.data),D=X._def.returns.safeParse(q,Q);if(!D.success)throw new uv([J(q,D.error)]);return D.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...f){return new of({...this._def,args:Yf.create(f).rest(Ef.create())})}returns(f){return new of({...this._def,returns:f})}implement(f){return this.parse(f)}strictImplement(f){return this.parse(f)}static create(f,v,h){return new of({args:f?f:Yf.create([]).rest(Ef.create()),returns:v||Ef.create(),typeName:z.ZodFunction,...d(h)})}};W1=class W1 extends i{get schema(){return this._def.getter()}_parse(f){let{ctx:v}=this._processInputParams(f);return this._def.getter()._parse({data:v.data,path:v.path,parent:v})}};W1.create=(f,v)=>{return new W1({getter:f,typeName:z.ZodLazy,...d(v)})};P1=class P1 extends i{_parse(f){if(f.data!==this._def.value){let v=this._getOrReturnCtx(f);return g(v,{received:v.data,code:U.invalid_literal,expected:this._def.value}),p}return{status:"valid",value:f.data}}get value(){return this._def.value}};P1.create=(f,v)=>{return new P1({value:f,typeName:z.ZodLiteral,...d(v)})};Nf=class Nf extends i{constructor(){super(...arguments);j1.set(this,void 0)}_parse(f){if(typeof f.data!=="string"){let v=this._getOrReturnCtx(f),h=this._def.values;return g(v,{expected:hv.joinValues(h),received:v.parsedType,code:U.invalid_type}),p}if(!u1(this,j1,"f"))Qh(this,j1,new Set(this._def.values),"f");if(!u1(this,j1,"f").has(f.data)){let v=this._getOrReturnCtx(f),h=this._def.values;return g(v,{received:v.data,code:U.invalid_enum_value,options:h}),p}return gv(f.data)}get options(){return this._def.values}get enum(){let f={};for(let v of this._def.values)f[v]=v;return f}get Values(){let f={};for(let v of this._def.values)f[v]=v;return f}get Enum(){let f={};for(let v of this._def.values)f[v]=v;return f}extract(f,v=this._def){return Nf.create(f,{...this._def,...v})}exclude(f,v=this._def){return Nf.create(this.options.filter((h)=>!f.includes(h)),{...this._def,...v})}};j1=new WeakMap;Nf.create=Ph;X1=class X1 extends i{constructor(){super(...arguments);L1.set(this,void 0)}_parse(f){let v=hv.getValidEnumValues(this._def.values),h=this._getOrReturnCtx(f);if(h.parsedType!==I.string&&h.parsedType!==I.number){let J=hv.objectValues(v);return g(h,{expected:hv.joinValues(J),received:h.parsedType,code:U.invalid_type}),p}if(!u1(this,L1,"f"))Qh(this,L1,new Set(hv.getValidEnumValues(this._def.values)),"f");if(!u1(this,L1,"f").has(f.data)){let J=hv.objectValues(v);return g(h,{received:h.data,code:U.invalid_enum_value,options:J}),p}return gv(f.data)}get enum(){return this._def.values}};L1=new WeakMap;X1.create=(f,v)=>{return new X1({values:f,typeName:z.ZodNativeEnum,...d(v)})};Tf=class Tf extends i{unwrap(){return this._def.type}_parse(f){let{ctx:v}=this._processInputParams(f);if(v.parsedType!==I.promise&&v.common.async===!1)return g(v,{code:U.invalid_type,expected:I.promise,received:v.parsedType}),p;let h=v.parsedType===I.promise?v.data:Promise.resolve(v.data);return gv(h.then((J)=>{return this._def.type.parseAsync(J,{path:v.path,errorMap:v.common.contextualErrorMap})}))}};Tf.create=(f,v)=>{return new Tf({type:f,typeName:z.ZodPromise,...d(v)})};iv=class iv extends i{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===z.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(f){let{status:v,ctx:h}=this._processInputParams(f),J=this._def.effect||null,Q={addIssue:(W)=>{if(g(h,W),W.fatal)v.abort();else v.dirty()},get path(){return h.path}};if(Q.addIssue=Q.addIssue.bind(Q),J.type==="preprocess"){let W=J.transform(h.data,Q);if(h.common.async)return Promise.resolve(W).then(async(X)=>{if(v.value==="aborted")return p;let Y=await this._def.schema._parseAsync({data:X,path:h.path,parent:h});if(Y.status==="aborted")return p;if(Y.status==="dirty")return sf(Y.value);if(v.value==="dirty")return sf(Y.value);return Y});else{if(v.value==="aborted")return p;let X=this._def.schema._parseSync({data:W,path:h.path,parent:h});if(X.status==="aborted")return p;if(X.status==="dirty")return sf(X.value);if(v.value==="dirty")return sf(X.value);return X}}if(J.type==="refinement"){let W=(X)=>{let Y=J.refinement(X,Q);if(h.common.async)return Promise.resolve(Y);if(Y instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return X};if(h.common.async===!1){let X=this._def.schema._parseSync({data:h.data,path:h.path,parent:h});if(X.status==="aborted")return p;if(X.status==="dirty")v.dirty();return W(X.value),{status:v.value,value:X.value}}else return this._def.schema._parseAsync({data:h.data,path:h.path,parent:h}).then((X)=>{if(X.status==="aborted")return p;if(X.status==="dirty")v.dirty();return W(X.value).then(()=>{return{status:v.value,value:X.value}})})}if(J.type==="transform")if(h.common.async===!1){let W=this._def.schema._parseSync({data:h.data,path:h.path,parent:h});if(!gf(W))return W;let X=J.transform(W.value,Q);if(X instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:v.value,value:X}}else return this._def.schema._parseAsync({data:h.data,path:h.path,parent:h}).then((W)=>{if(!gf(W))return W;return Promise.resolve(J.transform(W.value,Q)).then((X)=>({status:v.value,value:X}))});hv.assertNever(J)}};iv.create=(f,v,h)=>{return new iv({schema:f,typeName:z.ZodEffects,effect:v,...d(h)})};iv.createWithPreprocess=(f,v,h)=>{return new iv({schema:v,effect:{type:"preprocess",transform:f},typeName:z.ZodEffects,...d(h)})};mv=class mv extends i{_parse(f){if(this._getType(f)===I.undefined)return gv(void 0);return this._def.innerType._parse(f)}unwrap(){return this._def.innerType}};mv.create=(f,v)=>{return new mv({innerType:f,typeName:z.ZodOptional,...d(v)})};$f=class $f extends i{_parse(f){if(this._getType(f)===I.null)return gv(null);return this._def.innerType._parse(f)}unwrap(){return this._def.innerType}};$f.create=(f,v)=>{return new $f({innerType:f,typeName:z.ZodNullable,...d(v)})};Y1=class Y1 extends i{_parse(f){let{ctx:v}=this._processInputParams(f),h=v.data;if(v.parsedType===I.undefined)h=this._def.defaultValue();return this._def.innerType._parse({data:h,path:v.path,parent:v})}removeDefault(){return this._def.innerType}};Y1.create=(f,v)=>{return new Y1({innerType:f,typeName:z.ZodDefault,defaultValue:typeof v.default==="function"?v.default:()=>v.default,...d(v)})};B1=class B1 extends i{_parse(f){let{ctx:v}=this._processInputParams(f),h={...v,common:{...v.common,issues:[]}},J=this._def.innerType._parse({data:h.data,path:h.path,parent:{...h}});if(M1(J))return J.then((Q)=>{return{status:"valid",value:Q.status==="valid"?Q.value:this._def.catchValue({get error(){return new uv(h.common.issues)},input:h.data})}});else return{status:"valid",value:J.status==="valid"?J.value:this._def.catchValue({get error(){return new uv(h.common.issues)},input:h.data})}}removeCatch(){return this._def.innerType}};B1.create=(f,v)=>{return new B1({innerType:f,typeName:z.ZodCatch,catchValue:typeof v.catch==="function"?v.catch:()=>v.catch,...d(v)})};U1=class U1 extends i{_parse(f){if(this._getType(f)!==I.nan){let h=this._getOrReturnCtx(f);return g(h,{code:U.invalid_type,expected:I.nan,received:h.parsedType}),p}return{status:"valid",value:f.data}}};U1.create=(f)=>{return new U1({typeName:z.ZodNaN,...d(f)})};A6=Symbol("zod_brand");a1=class a1 extends i{_parse(f){let{ctx:v}=this._processInputParams(f),h=v.data;return this._def.type._parse({data:h,path:v.path,parent:v})}unwrap(){return this._def.type}};z1=class z1 extends i{_parse(f){let{status:v,ctx:h}=this._processInputParams(f);if(h.common.async)return(async()=>{let Q=await this._def.in._parseAsync({data:h.data,path:h.path,parent:h});if(Q.status==="aborted")return p;if(Q.status==="dirty")return v.dirty(),sf(Q.value);else return this._def.out._parseAsync({data:Q.value,path:h.path,parent:h})})();else{let J=this._def.in._parseSync({data:h.data,path:h.path,parent:h});if(J.status==="aborted")return p;if(J.status==="dirty")return v.dirty(),{status:"dirty",value:J.value};else return this._def.out._parseSync({data:J.value,path:h.path,parent:h})}}static create(f,v){return new z1({in:f,out:v,typeName:z.ZodPipeline})}};G1=class G1 extends i{_parse(f){let v=this._def.innerType._parse(f),h=(J)=>{if(gf(J))J.value=Object.freeze(J.value);return J};return M1(v)?v.then((J)=>h(J)):h(v)}unwrap(){return this._def.innerType}};G1.create=(f,v)=>{return new G1({innerType:f,typeName:z.ZodReadonly,...d(v)})};S6={object:$v.lazycreate};(function(f){f.ZodString="ZodString",f.ZodNumber="ZodNumber",f.ZodNaN="ZodNaN",f.ZodBigInt="ZodBigInt",f.ZodBoolean="ZodBoolean",f.ZodDate="ZodDate",f.ZodSymbol="ZodSymbol",f.ZodUndefined="ZodUndefined",f.ZodNull="ZodNull",f.ZodAny="ZodAny",f.ZodUnknown="ZodUnknown",f.ZodNever="ZodNever",f.ZodVoid="ZodVoid",f.ZodArray="ZodArray",f.ZodObject="ZodObject",f.ZodUnion="ZodUnion",f.ZodDiscriminatedUnion="ZodDiscriminatedUnion",f.ZodIntersection="ZodIntersection",f.ZodTuple="ZodTuple",f.ZodRecord="ZodRecord",f.ZodMap="ZodMap",f.ZodSet="ZodSet",f.ZodFunction="ZodFunction",f.ZodLazy="ZodLazy",f.ZodLiteral="ZodLiteral",f.ZodEnum="ZodEnum",f.ZodEffects="ZodEffects",f.ZodNativeEnum="ZodNativeEnum",f.ZodOptional="ZodOptional",f.ZodNullable="ZodNullable",f.ZodDefault="ZodDefault",f.ZodCatch="ZodCatch",f.ZodPromise="ZodPromise",f.ZodBranded="ZodBranded",f.ZodPipeline="ZodPipeline",f.ZodReadonly="ZodReadonly"})(z||(z={}));Yh=ev.create,Bh=Vf.create,R6=U1.create,_6=Ff.create,Gh=v1.create,l6=yf.create,k6=E1.create,g6=f1.create,y6=Q1.create,I6=If.create,C6=Ef.create,T6=Xf.create,x6=V1.create,Z6=vf.create,r6=$v.create,u6=$v.strictCreate,m6=h1.create,a6=m1.create,c6=J1.create,p6=Yf.create,n6=F1.create,i6=N1.create,d6=Cf.create,t6=of.create,s6=W1.create,o6=P1.create,e6=Nf.create,vW=X1.create,fW=Tf.create,vh=iv.create,QW=mv.create,hW=$f.create,JW=iv.createWithPreprocess,WW=z1.create,BW={string:(f)=>ev.create({...f,coerce:!0}),number:(f)=>Vf.create({...f,coerce:!0}),boolean:(f)=>v1.create({...f,coerce:!0}),bigint:(f)=>Ff.create({...f,coerce:!0}),date:(f)=>yf.create({...f,coerce:!0})},GW=p,P=Object.freeze({__proto__:null,defaultErrorMap:ef,setErrorMap:J6,getErrorMap:Z1,makeIssue:r1,EMPTY_PATH:W6,addIssueToContext:g,ParseStatus:Rv,INVALID:p,DIRTY:sf,OK:gv,isAborted:r0,isDirty:u0,isValid:gf,isAsync:M1,get util(){return hv},get objectUtil(){return Z0},ZodParsedType:I,getParsedType:Kf,ZodType:i,datetimeRegex:Wh,ZodString:ev,ZodNumber:Vf,ZodBigInt:Ff,ZodBoolean:v1,ZodDate:yf,ZodSymbol:E1,ZodUndefined:f1,ZodNull:Q1,ZodAny:If,ZodUnknown:Ef,ZodNever:Xf,ZodVoid:V1,ZodArray:vf,ZodObject:$v,ZodUnion:h1,ZodDiscriminatedUnion:m1,ZodIntersection:J1,ZodTuple:Yf,ZodRecord:F1,ZodMap:N1,ZodSet:Cf,ZodFunction:of,ZodLazy:W1,ZodLiteral:P1,ZodEnum:Nf,ZodNativeEnum:X1,ZodPromise:Tf,ZodEffects:iv,ZodTransformer:iv,ZodOptional:mv,ZodNullable:$f,ZodDefault:Y1,ZodCatch:B1,ZodNaN:U1,BRAND:A6,ZodBranded:a1,ZodPipeline:z1,ZodReadonly:G1,custom:Xh,Schema:i,ZodSchema:i,late:S6,get ZodFirstPartyTypeKind(){return z},coerce:BW,any:I6,array:Z6,bigint:_6,boolean:Gh,date:l6,discriminatedUnion:a6,effect:vh,enum:e6,function:t6,instanceof:b6,intersection:c6,lazy:s6,literal:o6,map:i6,nan:R6,nativeEnum:vW,never:T6,null:y6,nullable:hW,number:Bh,object:r6,oboolean:YW,onumber:XW,optional:QW,ostring:PW,pipeline:WW,preprocess:JW,promise:fW,record:n6,set:d6,strictObject:u6,string:Yh,symbol:k6,transformer:vh,tuple:p6,undefined:g6,union:m6,unknown:C6,void:x6,NEVER:GW,ZodIssueCode:U,quotelessJson:h6,ZodError:uv})});var a0="2025-06-18",EX="2025-03-26",wh,c1="2.0",qh,Dh,wW,dv,Tv,A1,Bf,tv,p1,Hh,Oh=(f)=>Hh.safeParse(f).success,Kh,$h=(f)=>Kh.safeParse(f).success,jh,c0=(f)=>jh.safeParse(f).success,qv,Lh,Mh=(f)=>Lh.safeParse(f).success,Eh,n1,i1,S1,Vh,qW,d1,VX=(f)=>d1.safeParse(f).success,DW,HW,p0,t1,OW,s1,o1,e1,Fh,Nh,n0,Uh,zh,KW,v0,$W,f0,jW,Q0,LW,MW,EW,VW,FW,NW,UW,h0,zW,J0,i0,d0,t0,AW,SW,Ah,bW,RW,_W,lW,kW,W0,gW,Sh,FX,P0,yW,bh,IW,CW,TW,xW,ZW,rW,s0,uW,mW,aW,cW,pW,nW,o0,iW,dW,X0,tW,sW,oW,e0,eW,NX,UX,zX,AX,SX,bX,Dv;var b1=T0(()=>{av();wh=[a0,"2025-03-26","2024-11-05","2024-10-07"],qh=P.union([P.string(),P.number().int()]),Dh=P.string(),wW=P.object({progressToken:P.optional(qh)}).passthrough(),dv=P.object({_meta:P.optional(wW)}).passthrough(),Tv=P.object({method:P.string(),params:P.optional(dv)}),A1=P.object({_meta:P.optional(P.object({}).passthrough())}).passthrough(),Bf=P.object({method:P.string(),params:P.optional(A1)}),tv=P.object({_meta:P.optional(P.object({}).passthrough())}).passthrough(),p1=P.union([P.string(),P.number().int()]),Hh=P.object({jsonrpc:P.literal(c1),id:p1}).merge(Tv).strict(),Kh=P.object({jsonrpc:P.literal(c1)}).merge(Bf).strict(),jh=P.object({jsonrpc:P.literal(c1),id:p1,result:tv}).strict();(function(f){f[f.ConnectionClosed=-32000]="ConnectionClosed",f[f.RequestTimeout=-32001]="RequestTimeout",f[f.ParseError=-32700]="ParseError",f[f.InvalidRequest=-32600]="InvalidRequest",f[f.MethodNotFound=-32601]="MethodNotFound",f[f.InvalidParams=-32602]="InvalidParams",f[f.InternalError=-32603]="InternalError"})(qv||(qv={}));Lh=P.object({jsonrpc:P.literal(c1),id:p1,error:P.object({code:P.number().int(),message:P.string(),data:P.optional(P.unknown())})}).strict(),Eh=P.union([Hh,Kh,jh,Lh]),n1=tv.strict(),i1=Bf.extend({method:P.literal("notifications/cancelled"),params:A1.extend({requestId:p1,reason:P.string().optional()})}),S1=P.object({name:P.string(),title:P.optional(P.string())}).passthrough(),Vh=S1.extend({version:P.string()}),qW=P.object({experimental:P.optional(P.object({}).passthrough()),sampling:P.optional(P.object({}).passthrough()),elicitation:P.optional(P.object({}).passthrough()),roots:P.optional(P.object({listChanged:P.optional(P.boolean())}).passthrough())}).passthrough(),d1=Tv.extend({method:P.literal("initialize"),params:dv.extend({protocolVersion:P.string(),capabilities:qW,clientInfo:Vh})}),DW=P.object({experimental:P.optional(P.object({}).passthrough()),logging:P.optional(P.object({}).passthrough()),completions:P.optional(P.object({}).passthrough()),prompts:P.optional(P.object({listChanged:P.optional(P.boolean())}).passthrough()),resources:P.optional(P.object({subscribe:P.optional(P.boolean()),listChanged:P.optional(P.boolean())}).passthrough()),tools:P.optional(P.object({listChanged:P.optional(P.boolean())}).passthrough())}).passthrough(),HW=tv.extend({protocolVersion:P.string(),capabilities:DW,serverInfo:Vh,instructions:P.optional(P.string())}),p0=Bf.extend({method:P.literal("notifications/initialized")}),t1=Tv.extend({method:P.literal("ping")}),OW=P.object({progress:P.number(),total:P.optional(P.number()),message:P.optional(P.string())}).passthrough(),s1=Bf.extend({method:P.literal("notifications/progress"),params:A1.merge(OW).extend({progressToken:qh})}),o1=Tv.extend({params:dv.extend({cursor:P.optional(Dh)}).optional()}),e1=tv.extend({nextCursor:P.optional(Dh)}),Fh=P.object({uri:P.string(),mimeType:P.optional(P.string()),_meta:P.optional(P.object({}).passthrough())}).passthrough(),Nh=Fh.extend({text:P.string()}),n0=P.string().refine((f)=>{try{return atob(f),!0}catch(v){return!1}},{message:"Invalid Base64 string"}),Uh=Fh.extend({blob:n0}),zh=S1.extend({uri:P.string(),description:P.optional(P.string()),mimeType:P.optional(P.string()),_meta:P.optional(P.object({}).passthrough())}),KW=S1.extend({uriTemplate:P.string(),description:P.optional(P.string()),mimeType:P.optional(P.string()),_meta:P.optional(P.object({}).passthrough())}),v0=o1.extend({method:P.literal("resources/list")}),$W=e1.extend({resources:P.array(zh)}),f0=o1.extend({method:P.literal("resources/templates/list")}),jW=e1.extend({resourceTemplates:P.array(KW)}),Q0=Tv.extend({method:P.literal("resources/read"),params:dv.extend({uri:P.string()})}),LW=tv.extend({contents:P.array(P.union([Nh,Uh]))}),MW=Bf.extend({method:P.literal("notifications/resources/list_changed")}),EW=Tv.extend({method:P.literal("resources/subscribe"),params:dv.extend({uri:P.string()})}),VW=Tv.extend({method:P.literal("resources/unsubscribe"),params:dv.extend({uri:P.string()})}),FW=Bf.extend({method:P.literal("notifications/resources/updated"),params:A1.extend({uri:P.string()})}),NW=P.object({name:P.string(),description:P.optional(P.string()),required:P.optional(P.boolean())}).passthrough(),UW=S1.extend({description:P.optional(P.string()),arguments:P.optional(P.array(NW)),_meta:P.optional(P.object({}).passthrough())}),h0=o1.extend({method:P.literal("prompts/list")}),zW=e1.extend({prompts:P.array(UW)}),J0=Tv.extend({method:P.literal("prompts/get"),params:dv.extend({name:P.string(),arguments:P.optional(P.record(P.string()))})}),i0=P.object({type:P.literal("text"),text:P.string(),_meta:P.optional(P.object({}).passthrough())}).passthrough(),d0=P.object({type:P.literal("image"),data:n0,mimeType:P.string(),_meta:P.optional(P.object({}).passthrough())}).passthrough(),t0=P.object({type:P.literal("audio"),data:n0,mimeType:P.string(),_meta:P.optional(P.object({}).passthrough())}).passthrough(),AW=P.object({type:P.literal("resource"),resource:P.union([Nh,Uh]),_meta:P.optional(P.object({}).passthrough())}).passthrough(),SW=zh.extend({type:P.literal("resource_link")}),Ah=P.union([i0,d0,t0,SW,AW]),bW=P.object({role:P.enum(["user","assistant"]),content:Ah}).passthrough(),RW=tv.extend({description:P.optional(P.string()),messages:P.array(bW)}),_W=Bf.extend({method:P.literal("notifications/prompts/list_changed")}),lW=P.object({title:P.optional(P.string()),readOnlyHint:P.optional(P.boolean()),destructiveHint:P.optional(P.boolean()),idempotentHint:P.optional(P.boolean()),openWorldHint:P.optional(P.boolean())}).passthrough(),kW=S1.extend({description:P.optional(P.string()),inputSchema:P.object({type:P.literal("object"),properties:P.optional(P.object({}).passthrough()),required:P.optional(P.array(P.string()))}).passthrough(),outputSchema:P.optional(P.object({type:P.literal("object"),properties:P.optional(P.object({}).passthrough()),required:P.optional(P.array(P.string()))}).passthrough()),annotations:P.optional(lW),_meta:P.optional(P.object({}).passthrough())}),W0=o1.extend({method:P.literal("tools/list")}),gW=e1.extend({tools:P.array(kW)}),Sh=tv.extend({content:P.array(Ah).default([]),structuredContent:P.object({}).passthrough().optional(),isError:P.optional(P.boolean())}),FX=Sh.or(tv.extend({toolResult:P.unknown()})),P0=Tv.extend({method:P.literal("tools/call"),params:dv.extend({name:P.string(),arguments:P.optional(P.record(P.unknown()))})}),yW=Bf.extend({method:P.literal("notifications/tools/list_changed")}),bh=P.enum(["debug","info","notice","warning","error","critical","alert","emergency"]),IW=Tv.extend({method:P.literal("logging/setLevel"),params:dv.extend({level:bh})}),CW=Bf.extend({method:P.literal("notifications/message"),params:A1.extend({level:bh,logger:P.optional(P.string()),data:P.unknown()})}),TW=P.object({name:P.string().optional()}).passthrough(),xW=P.object({hints:P.optional(P.array(TW)),costPriority:P.optional(P.number().min(0).max(1)),speedPriority:P.optional(P.number().min(0).max(1)),intelligencePriority:P.optional(P.number().min(0).max(1))}).passthrough(),ZW=P.object({role:P.enum(["user","assistant"]),content:P.union([i0,d0,t0])}).passthrough(),rW=Tv.extend({method:P.literal("sampling/createMessage"),params:dv.extend({messages:P.array(ZW),systemPrompt:P.optional(P.string()),includeContext:P.optional(P.enum(["none","thisServer","allServers"])),temperature:P.optional(P.number()),maxTokens:P.number().int(),stopSequences:P.optional(P.array(P.string())),metadata:P.optional(P.object({}).passthrough()),modelPreferences:P.optional(xW)})}),s0=tv.extend({model:P.string(),stopReason:P.optional(P.enum(["endTurn","stopSequence","maxTokens"]).or(P.string())),role:P.enum(["user","assistant"]),content:P.discriminatedUnion("type",[i0,d0,t0])}),uW=P.object({type:P.literal("boolean"),title:P.optional(P.string()),description:P.optional(P.string()),default:P.optional(P.boolean())}).passthrough(),mW=P.object({type:P.literal("string"),title:P.optional(P.string()),description:P.optional(P.string()),minLength:P.optional(P.number()),maxLength:P.optional(P.number()),format:P.optional(P.enum(["email","uri","date","date-time"]))}).passthrough(),aW=P.object({type:P.enum(["number","integer"]),title:P.optional(P.string()),description:P.optional(P.string()),minimum:P.optional(P.number()),maximum:P.optional(P.number())}).passthrough(),cW=P.object({type:P.literal("string"),title:P.optional(P.string()),description:P.optional(P.string()),enum:P.array(P.string()),enumNames:P.optional(P.array(P.string()))}).passthrough(),pW=P.union([uW,mW,aW,cW]),nW=Tv.extend({method:P.literal("elicitation/create"),params:dv.extend({message:P.string(),requestedSchema:P.object({type:P.literal("object"),properties:P.record(P.string(),pW),required:P.optional(P.array(P.string()))}).passthrough()})}),o0=tv.extend({action:P.enum(["accept","decline","cancel"]),content:P.optional(P.record(P.string(),P.unknown()))}),iW=P.object({type:P.literal("ref/resource"),uri:P.string()}).passthrough(),dW=P.object({type:P.literal("ref/prompt"),name:P.string()}).passthrough(),X0=Tv.extend({method:P.literal("completion/complete"),params:dv.extend({ref:P.union([dW,iW]),argument:P.object({name:P.string(),value:P.string()}).passthrough(),context:P.optional(P.object({arguments:P.optional(P.record(P.string(),P.string()))}))})}),tW=tv.extend({completion:P.object({values:P.array(P.string()).max(100),total:P.optional(P.number().int()),hasMore:P.optional(P.boolean())}).passthrough()}),sW=P.object({uri:P.string().startsWith("file://"),name:P.optional(P.string()),_meta:P.optional(P.object({}).passthrough())}).passthrough(),oW=Tv.extend({method:P.literal("roots/list")}),e0=tv.extend({roots:P.array(sW)}),eW=Bf.extend({method:P.literal("notifications/roots/list_changed")}),NX=P.union([t1,d1,X0,IW,J0,h0,v0,f0,Q0,EW,VW,P0,W0]),UX=P.union([i1,s1,p0,eW]),zX=P.union([n1,s0,o0,e0]),AX=P.union([t1,rW,nW,oW]),SX=P.union([i1,s1,CW,FW,MW,yW,_W]),bX=P.union([n1,HW,tW,RW,zW,$W,jW,LW,Sh,gW]);Dv=class Dv extends Error{constructor(f,v,h){super(`MCP error ${f}: ${v}`);this.code=f,this.data=h,this.name="McpError"}}});var lh=n((Y0,_h)=>{(function(f,v){typeof Y0==="object"&&typeof _h!=="undefined"?v(Y0):typeof define==="function"&&define.amd?define(["exports"],v):v(f.URI=f.URI||{})})(Y0,function(f){function v(){for(var H=arguments.length,w=Array(H),$=0;$<H;$++)w[$]=arguments[$];if(w.length>1){w[0]=w[0].slice(0,-1);var E=w.length-1;for(var V=1;V<E;++V)w[V]=w[V].slice(1,-1);return w[E]=w[E].slice(1),w.join("")}else return w[0]}function h(H){return"(?:"+H+")"}function J(H){return H===void 0?"undefined":H===null?"null":Object.prototype.toString.call(H).split(" ").pop().split("]").shift().toLowerCase()}function Q(H){return H.toUpperCase()}function W(H){return H!==void 0&&H!==null?H instanceof Array?H:typeof H.length!=="number"||H.split||H.setInterval||H.call?[H]:Array.prototype.slice.call(H):[]}function X(H,w){var $=H;if(w)for(var E in w)$[E]=w[E];return $}function Y(H){var w="[A-Za-z]",$="[\\x0D]",E="[0-9]",V="[\\x22]",y=v(E,"[A-Fa-f]"),t="[\\x0A]",Jv="[\\x20]",Yv=h(h("%[EFef]"+y+"%"+y+y+"%"+y+y)+"|"+h("%[89A-Fa-f]"+y+"%"+y+y)+"|"+h("%"+y+y)),Nv="[\\:\\/\\?\\#\\[\\]\\@]",Qv="[\\!\\$\\&\\'\\(\\)\\*\\+\\,\\;\\=]",Ov=v(Nv,Qv),Uv=H?"[\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]":"[]",Hv=H?"[\\uE000-\\uF8FF]":"[]",Pv=v(w,E,"[\\-\\.\\_\\~]",Uv),Kv=h(w+v(w,E,"[\\+\\-\\.]")+"*"),Gv=h(h(Yv+"|"+v(Pv,Qv,"[\\:]"))+"*"),_f=h(h("25[0-5]")+"|"+h("2[0-4]"+E)+"|"+h("1"+E+E)+"|"+h("[1-9]"+E)+"|"+E),Zv=h(h("25[0-5]")+"|"+h("2[0-4]"+E)+"|"+h("1"+E+E)+"|"+h("0?[1-9]"+E)+"|0?0?"+E),pv=h(Zv+"\\."+Zv+"\\."+Zv+"\\."+Zv),wv=h(y+"{1,4}"),rv=h(h(wv+"\\:"+wv)+"|"+pv),nv=h(h(wv+"\\:")+"{6}"+rv),Pf=h("\\:\\:"+h(wv+"\\:")+"{5}"+rv),lf=h(h(wv)+"?\\:\\:"+h(wv+"\\:")+"{4}"+rv),qf=h(h(h(wv+"\\:")+"{0,1}"+wv)+"?\\:\\:"+h(wv+"\\:")+"{3}"+rv),D1=h(h(h(wv+"\\:")+"{0,2}"+wv)+"?\\:\\:"+h(wv+"\\:")+"{2}"+rv),I1=h(h(h(wv+"\\:")+"{0,3}"+wv)+"?\\:\\:"+wv+"\\:"+rv),C1=h(h(h(wv+"\\:")+"{0,4}"+wv)+"?\\:\\:"+rv),mf=h(h(h(wv+"\\:")+"{0,5}"+wv)+"?\\:\\:"+wv),af=h(h(h(wv+"\\:")+"{0,6}"+wv)+"?\\:\\:"),Df=h([nv,Pf,lf,qf,D1,I1,C1,mf,af].join("|")),cf=h(h(Pv+"|"+Yv)+"+"),y0=h(Df+"\\%25"+cf),kf=h(Df+h("\\%25|\\%(?!"+y+"{2})")+cf),pJ=h("[vV]"+y+"+\\."+v(Pv,Qv,"[\\:]")+"+"),nJ=h("\\["+h(kf+"|"+Df+"|"+pJ)+"\\]"),iQ=h(h(Yv+"|"+v(Pv,Qv))+"*"),H1=h(nJ+"|"+pv+"(?!"+iQ+")|"+iQ),O1=h(E+"*"),dQ=h(h(Gv+"@")+"?"+H1+h("\\:"+O1)+"?"),K1=h(Yv+"|"+v(Pv,Qv,"[\\:\\@]")),iJ=h(K1+"*"),tQ=h(K1+"+"),dJ=h(h(Yv+"|"+v(Pv,Qv,"[\\@]"))+"+"),Hf=h(h("\\/"+iJ)+"*"),pf=h("\\/"+h(tQ+Hf)+"?"),I0=h(dJ+Hf),T1=h(tQ+Hf),nf="(?!"+K1+")",BX=h(Hf+"|"+pf+"|"+I0+"|"+T1+"|"+nf),df=h(h(K1+"|"+v("[\\/\\?]",Hv))+"*"),$1=h(h(K1+"|[\\/\\?]")+"*"),sQ=h(h("\\/\\/"+dQ+Hf)+"|"+pf+"|"+T1+"|"+nf),tJ=h(Kv+"\\:"+sQ+h("\\?"+df)+"?"+h("\\#"+$1)+"?"),sJ=h(h("\\/\\/"+dQ+Hf)+"|"+pf+"|"+I0+"|"+nf),oJ=h(sJ+h("\\?"+df)+"?"+h("\\#"+$1)+"?"),GX=h(tJ+"|"+oJ),wX=h(Kv+"\\:"+sQ+h("\\?"+df)+"?"),qX="^("+Kv+")\\:"+h(h("\\/\\/("+h("("+Gv+")@")+"?("+H1+")"+h("\\:("+O1+")")+"?)")+"?("+Hf+"|"+pf+"|"+T1+"|"+nf+")")+h("\\?("+df+")")+"?"+h("\\#("+$1+")")+"?$",DX="^(){0}"+h(h("\\/\\/("+h("("+Gv+")@")+"?("+H1+")"+h("\\:("+O1+")")+"?)")+"?("+Hf+"|"+pf+"|"+I0+"|"+nf+")")+h("\\?("+df+")")+"?"+h("\\#("+$1+")")+"?$",HX="^("+Kv+")\\:"+h(h("\\/\\/("+h("("+Gv+")@")+"?("+H1+")"+h("\\:("+O1+")")+"?)")+"?("+Hf+"|"+pf+"|"+T1+"|"+nf+")")+h("\\?("+df+")")+"?$",OX="^"+h("\\#("+$1+")")+"?$",KX="^"+h("("+Gv+")@")+"?("+H1+")"+h("\\:("+O1+")")+"?$";return{NOT_SCHEME:new RegExp(v("[^]",w,E,"[\\+\\-\\.]"),"g"),NOT_USERINFO:new RegExp(v("[^\\%\\:]",Pv,Qv),"g"),NOT_HOST:new RegExp(v("[^\\%\\[\\]\\:]",Pv,Qv),"g"),NOT_PATH:new RegExp(v("[^\\%\\/\\:\\@]",Pv,Qv),"g"),NOT_PATH_NOSCHEME:new RegExp(v("[^\\%\\/\\@]",Pv,Qv),"g"),NOT_QUERY:new RegExp(v("[^\\%]",Pv,Qv,"[\\:\\@\\/\\?]",Hv),"g"),NOT_FRAGMENT:new RegExp(v("[^\\%]",Pv,Qv,"[\\:\\@\\/\\?]"),"g"),ESCAPE:new RegExp(v("[^]",Pv,Qv),"g"),UNRESERVED:new RegExp(Pv,"g"),OTHER_CHARS:new RegExp(v("[^\\%]",Pv,Ov),"g"),PCT_ENCODED:new RegExp(Yv,"g"),IPV4ADDRESS:new RegExp("^("+pv+")$"),IPV6ADDRESS:new RegExp("^\\[?("+Df+")"+h(h("\\%25|\\%(?!"+y+"{2})")+"("+cf+")")+"?\\]?$")}}var B=Y(!1),q=Y(!0),D=function(){function H(w,$){var E=[],V=!0,y=!1,t=void 0;try{for(var Jv=w[Symbol.iterator](),Yv;!(V=(Yv=Jv.next()).done);V=!0)if(E.push(Yv.value),$&&E.length===$)break}catch(Nv){y=!0,t=Nv}finally{try{if(!V&&Jv.return)Jv.return()}finally{if(y)throw t}}return E}return function(w,$){if(Array.isArray(w))return w;else if(Symbol.iterator in Object(w))return H(w,$);else throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),j=function(H){if(Array.isArray(H)){for(var w=0,$=Array(H.length);w<H.length;w++)$[w]=H[w];return $}else return Array.from(H)},L=2147483647,G=36,O=1,M=26,K=38,F=700,S=72,N=128,A="-",b=/^xn--/,k=/[^\0-\x7E]/,m=/[\x2E\u3002\uFF0E\uFF61]/g,Z={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},_=G-O,r=Math.floor,x=String.fromCharCode;function C(H){throw new RangeError(Z[H])}function R(H,w){var $=[],E=H.length;while(E--)$[E]=w(H[E]);return $}function l(H,w){var $=H.split("@"),E="";if($.length>1)E=$[0]+"@",H=$[1];H=H.replace(m,".");var V=H.split("."),y=R(V,w).join(".");return E+y}function T(H){var w=[],$=0,E=H.length;while($<E){var V=H.charCodeAt($++);if(V>=55296&&V<=56319&&$<E){var y=H.charCodeAt($++);if((y&64512)==56320)w.push(((V&1023)<<10)+(y&1023)+65536);else w.push(V),$--}else w.push(V)}return w}var Bv=function H(w){return String.fromCodePoint.apply(String,j(w))},e=function H(w){if(w-48<10)return w-22;if(w-65<26)return w-65;if(w-97<26)return w-97;return G},fv=function H(w,$){return w+22+75*(w<26)-(($!=0)<<5)},o=function H(w,$,E){var V=0;w=E?r(w/F):w>>1,w+=r(w/$);for(;w>_*M>>1;V+=G)w=r(w/_);return r(V+(_+1)*w/(w+K))},a=function H(w){var $=[],E=w.length,V=0,y=N,t=S,Jv=w.lastIndexOf(A);if(Jv<0)Jv=0;for(var Yv=0;Yv<Jv;++Yv){if(w.charCodeAt(Yv)>=128)C("not-basic");$.push(w.charCodeAt(Yv))}for(var Nv=Jv>0?Jv+1:0;Nv<E;){var Qv=V;for(var Ov=1,Uv=G;;Uv+=G){if(Nv>=E)C("invalid-input");var Hv=e(w.charCodeAt(Nv++));if(Hv>=G||Hv>r((L-V)/Ov))C("overflow");V+=Hv*Ov;var Pv=Uv<=t?O:Uv>=t+M?M:Uv-t;if(Hv<Pv)break;var Kv=G-Pv;if(Ov>r(L/Kv))C("overflow");Ov*=Kv}var Gv=$.length+1;if(t=o(V-Qv,Gv,Qv==0),r(V/Gv)>L-y)C("overflow");y+=r(V/Gv),V%=Gv,$.splice(V++,0,y)}return String.fromCodePoint.apply(String,$)},jv=function H(w){var $=[];w=T(w);var E=w.length,V=N,y=0,t=S,Jv=!0,Yv=!1,Nv=void 0;try{for(var Qv=w[Symbol.iterator](),Ov;!(Jv=(Ov=Qv.next()).done);Jv=!0){var Uv=Ov.value;if(Uv<128)$.push(x(Uv))}}catch(kf){Yv=!0,Nv=kf}finally{try{if(!Jv&&Qv.return)Qv.return()}finally{if(Yv)throw Nv}}var Hv=$.length,Pv=Hv;if(Hv)$.push(A);while(Pv<E){var Kv=L,Gv=!0,_f=!1,Zv=void 0;try{for(var pv=w[Symbol.iterator](),wv;!(Gv=(wv=pv.next()).done);Gv=!0){var rv=wv.value;if(rv>=V&&rv<Kv)Kv=rv}}catch(kf){_f=!0,Zv=kf}finally{try{if(!Gv&&pv.return)pv.return()}finally{if(_f)throw Zv}}var nv=Pv+1;if(Kv-V>r((L-y)/nv))C("overflow");y+=(Kv-V)*nv,V=Kv;var Pf=!0,lf=!1,qf=void 0;try{for(var D1=w[Symbol.iterator](),I1;!(Pf=(I1=D1.next()).done);Pf=!0){var C1=I1.value;if(C1<V&&++y>L)C("overflow");if(C1==V){var mf=y;for(var af=G;;af+=G){var Df=af<=t?O:af>=t+M?M:af-t;if(mf<Df)break;var cf=mf-Df,y0=G-Df;$.push(x(fv(Df+cf%y0,0))),mf=r(cf/y0)}$.push(x(fv(mf,0))),t=o(y,nv,Pv==Hv),y=0,++Pv}}}catch(kf){lf=!0,qf=kf}finally{try{if(!Pf&&D1.return)D1.return()}finally{if(lf)throw qf}}++y,++V}return $.join("")},Sv=function H(w){return l(w,function($){return b.test($)?a($.slice(4).toLowerCase()):$})},_v=function H(w){return l(w,function($){return k.test($)?"xn--"+jv($):$})},Wv={version:"2.1.0",ucs2:{decode:T,encode:Bv},decode:a,encode:jv,toASCII:_v,toUnicode:Sv},Vv={};function zv(H){var w=H.charCodeAt(0),$=void 0;if(w<16)$="%0"+w.toString(16).toUpperCase();else if(w<128)$="%"+w.toString(16).toUpperCase();else if(w<2048)$="%"+(w>>6|192).toString(16).toUpperCase()+"%"+(w&63|128).toString(16).toUpperCase();else $="%"+(w>>12|224).toString(16).toUpperCase()+"%"+(w>>6&63|128).toString(16).toUpperCase()+"%"+(w&63|128).toString(16).toUpperCase();return $}function lv(H){var w="",$=0,E=H.length;while($<E){var V=parseInt(H.substr($+1,2),16);if(V<128)w+=String.fromCharCode(V),$+=3;else if(V>=194&&V<224){if(E-$>=6){var y=parseInt(H.substr($+4,2),16);w+=String.fromCharCode((V&31)<<6|y&63)}else w+=H.substr($,6);$+=6}else if(V>=224){if(E-$>=9){var t=parseInt(H.substr($+4,2),16),Jv=parseInt(H.substr($+7,2),16);w+=String.fromCharCode((V&15)<<12|(t&63)<<6|Jv&63)}else w+=H.substr($,9);$+=9}else w+=H.substr($,3),$+=3}return w}function Lf(H,w){function $(E){var V=lv(E);return!V.match(w.UNRESERVED)?E:V}if(H.scheme)H.scheme=String(H.scheme).replace(w.PCT_ENCODED,$).toLowerCase().replace(w.NOT_SCHEME,"");if(H.userinfo!==void 0)H.userinfo=String(H.userinfo).replace(w.PCT_ENCODED,$).replace(w.NOT_USERINFO,zv).replace(w.PCT_ENCODED,Q);if(H.host!==void 0)H.host=String(H.host).replace(w.PCT_ENCODED,$).toLowerCase().replace(w.NOT_HOST,zv).replace(w.PCT_ENCODED,Q);if(H.path!==void 0)H.path=String(H.path).replace(w.PCT_ENCODED,$).replace(H.scheme?w.NOT_PATH:w.NOT_PATH_NOSCHEME,zv).replace(w.PCT_ENCODED,Q);if(H.query!==void 0)H.query=String(H.query).replace(w.PCT_ENCODED,$).replace(w.NOT_QUERY,zv).replace(w.PCT_ENCODED,Q);if(H.fragment!==void 0)H.fragment=String(H.fragment).replace(w.PCT_ENCODED,$).replace(w.NOT_FRAGMENT,zv).replace(w.PCT_ENCODED,Q);return H}function Gf(H){return H.replace(/^0*(.*)/,"$1")||"0"}function Fv(H,w){var $=H.match(w.IPV4ADDRESS)||[],E=D($,2),V=E[1];if(V)return V.split(".").map(Gf).join(".");else return H}function Lv(H,w){var $=H.match(w.IPV6ADDRESS)||[],E=D($,3),V=E[1],y=E[2];if(V){var t=V.toLowerCase().split("::").reverse(),Jv=D(t,2),Yv=Jv[0],Nv=Jv[1],Qv=Nv?Nv.split(":").map(Gf):[],Ov=Yv.split(":").map(Gf),Uv=w.IPV4ADDRESS.test(Ov[Ov.length-1]),Hv=Uv?7:8,Pv=Ov.length-Hv,Kv=Array(Hv);for(var Gv=0;Gv<Hv;++Gv)Kv[Gv]=Qv[Gv]||Ov[Pv+Gv]||"";if(Uv)Kv[Hv-1]=Fv(Kv[Hv-1],w);var _f=Kv.reduce(function(nv,Pf,lf){if(!Pf||Pf==="0"){var qf=nv[nv.length-1];if(qf&&qf.index+qf.length===lf)qf.length++;else nv.push({index:lf,length:1})}return nv},[]),Zv=_f.sort(function(nv,Pf){return Pf.length-nv.length})[0],pv=void 0;if(Zv&&Zv.length>1){var wv=Kv.slice(0,Zv.index),rv=Kv.slice(Zv.index+Zv.length);pv=wv.join(":")+"::"+rv.join(":")}else pv=Kv.join(":");if(y)pv+="%"+y;return pv}else return H}var Sf=/^(?:([^:\/?#]+):)?(?:\/\/((?:([^\/?#@]*)@)?(\[[^\/?#\]]+\]|[^\/?#:]*)(?:\:(\d*))?))?([^?#]*)(?:\?([^#]*))?(?:#((?:.|\n|\r)*))?/i,bv="".match(/(){0}/)[1]===void 0;function Xv(H){var w=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},$={},E=w.iri!==!1?q:B;if(w.reference==="suffix")H=(w.scheme?w.scheme+":":"")+"//"+H;var V=H.match(Sf);if(V){if(bv){if($.scheme=V[1],$.userinfo=V[3],$.host=V[4],$.port=parseInt(V[5],10),$.path=V[6]||"",$.query=V[7],$.fragment=V[8],isNaN($.port))$.port=V[5]}else if($.scheme=V[1]||void 0,$.userinfo=H.indexOf("@")!==-1?V[3]:void 0,$.host=H.indexOf("//")!==-1?V[4]:void 0,$.port=parseInt(V[5],10),$.path=V[6]||"",$.query=H.indexOf("?")!==-1?V[7]:void 0,$.fragment=H.indexOf("#")!==-1?V[8]:void 0,isNaN($.port))$.port=H.match(/\/\/(?:.|\n)*\:(?:\/|\?|\#|$)/)?V[4]:void 0;if($.host)$.host=Lv(Fv($.host,E),E);if($.scheme===void 0&&$.userinfo===void 0&&$.host===void 0&&$.port===void 0&&!$.path&&$.query===void 0)$.reference="same-document";else if($.scheme===void 0)$.reference="relative";else if($.fragment===void 0)$.reference="absolute";else $.reference="uri";if(w.reference&&w.reference!=="suffix"&&w.reference!==$.reference)$.error=$.error||"URI is not a "+w.reference+" reference.";var y=Vv[(w.scheme||$.scheme||"").toLowerCase()];if(!w.unicodeSupport&&(!y||!y.unicodeSupport)){if($.host&&(w.domainHost||y&&y.domainHost))try{$.host=Wv.toASCII($.host.replace(E.PCT_ENCODED,lv).toLowerCase())}catch(t){$.error=$.error||"Host's domain name can not be converted to ASCII via punycode: "+t}Lf($,B)}else Lf($,E);if(y&&y.parse)y.parse($,w)}else $.error=$.error||"URI can not be parsed.";return $}function Mf(H,w){var $=w.iri!==!1?q:B,E=[];if(H.userinfo!==void 0)E.push(H.userinfo),E.push("@");if(H.host!==void 0)E.push(Lv(Fv(String(H.host),$),$).replace($.IPV6ADDRESS,function(V,y,t){return"["+y+(t?"%25"+t:"")+"]"}));if(typeof H.port==="number"||typeof H.port==="string")E.push(":"),E.push(String(H.port));return E.length?E.join(""):void 0}var wf=/^\.\.?\//,bf=/^\/\.(\/|$)/,Rf=/^\/\.\.(\/|$)/,Av=/^\/?(?:.|\n)*?(?=\/|$)/;function cv(H){var w=[];while(H.length)if(H.match(wf))H=H.replace(wf,"");else if(H.match(bf))H=H.replace(bf,"/");else if(H.match(Rf))H=H.replace(Rf,"/"),w.pop();else if(H==="."||H==="..")H="";else{var $=H.match(Av);if($){var E=$[0];H=H.slice(E.length),w.push(E)}else throw new Error("Unexpected dot segment condition")}return w.join("")}function Cv(H){var w=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},$=w.iri?q:B,E=[],V=Vv[(w.scheme||H.scheme||"").toLowerCase()];if(V&&V.serialize)V.serialize(H,w);if(H.host){if($.IPV6ADDRESS.test(H.host));else if(w.domainHost||V&&V.domainHost)try{H.host=!w.iri?Wv.toASCII(H.host.replace($.PCT_ENCODED,lv).toLowerCase()):Wv.toUnicode(H.host)}catch(Jv){H.error=H.error||"Host's domain name can not be converted to "+(!w.iri?"ASCII":"Unicode")+" via punycode: "+Jv}}if(Lf(H,$),w.reference!=="suffix"&&H.scheme)E.push(H.scheme),E.push(":");var y=Mf(H,w);if(y!==void 0){if(w.reference!=="suffix")E.push("//");if(E.push(y),H.path&&H.path.charAt(0)!=="/")E.push("/")}if(H.path!==void 0){var t=H.path;if(!w.absolutePath&&(!V||!V.absolutePath))t=cv(t);if(y===void 0)t=t.replace(/^\/\//,"/%2F");E.push(t)}if(H.query!==void 0)E.push("?"),E.push(H.query);if(H.fragment!==void 0)E.push("#"),E.push(H.fragment);return E.join("")}function kv(H,w){var $=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},E=arguments[3],V={};if(!E)H=Xv(Cv(H,$),$),w=Xv(Cv(w,$),$);if($=$||{},!$.tolerant&&w.scheme)V.scheme=w.scheme,V.userinfo=w.userinfo,V.host=w.host,V.port=w.port,V.path=cv(w.path||""),V.query=w.query;else{if(w.userinfo!==void 0||w.host!==void 0||w.port!==void 0)V.userinfo=w.userinfo,V.host=w.host,V.port=w.port,V.path=cv(w.path||""),V.query=w.query;else{if(!w.path)if(V.path=H.path,w.query!==void 0)V.query=w.query;else V.query=H.query;else{if(w.path.charAt(0)==="/")V.path=cv(w.path);else{if((H.userinfo!==void 0||H.host!==void 0||H.port!==void 0)&&!H.path)V.path="/"+w.path;else if(!H.path)V.path=w.path;else V.path=H.path.slice(0,H.path.lastIndexOf("/")+1)+w.path;V.path=cv(V.path)}V.query=w.query}V.userinfo=H.userinfo,V.host=H.host,V.port=H.port}V.scheme=H.scheme}return V.fragment=w.fragment,V}function Jf(H,w,$){var E=X({scheme:"null"},$);return Cv(kv(Xv(H,E),Xv(w,E),E,!0),E)}function xv(H,w){if(typeof H==="string")H=Cv(Xv(H,w),w);else if(J(H)==="object")H=Xv(Cv(H,w),w);return H}function y1(H,w,$){if(typeof H==="string")H=Cv(Xv(H,$),$);else if(J(H)==="object")H=Cv(H,$);if(typeof w==="string")w=Cv(Xv(w,$),$);else if(J(w)==="object")w=Cv(w,$);return H===w}function k0(H,w){return H&&H.toString().replace(!w||!w.iri?B.ESCAPE:q.ESCAPE,zv)}function ov(H,w){return H&&H.toString().replace(!w||!w.iri?B.PCT_ENCODED:q.PCT_ENCODED,lv)}var w1={scheme:"http",domainHost:!0,parse:function H(w,$){if(!w.host)w.error=w.error||"HTTP URIs must have a host.";return w},serialize:function H(w,$){var E=String(w.scheme).toLowerCase()==="https";if(w.port===(E?443:80)||w.port==="")w.port=void 0;if(!w.path)w.path="/";return w}},ZQ={scheme:"https",domainHost:w1.domainHost,parse:w1.parse,serialize:w1.serialize};function rQ(H){return typeof H.secure==="boolean"?H.secure:String(H.scheme).toLowerCase()==="wss"}var q1={scheme:"ws",domainHost:!0,parse:function H(w,$){var E=w;return E.secure=rQ(E),E.resourceName=(E.path||"/")+(E.query?"?"+E.query:""),E.path=void 0,E.query=void 0,E},serialize:function H(w,$){if(w.port===(rQ(w)?443:80)||w.port==="")w.port=void 0;if(typeof w.secure==="boolean")w.scheme=w.secure?"wss":"ws",w.secure=void 0;if(w.resourceName){var E=w.resourceName.split("?"),V=D(E,2),y=V[0],t=V[1];w.path=y&&y!=="/"?y:void 0,w.query=t,w.resourceName=void 0}return w.fragment=void 0,w}},uQ={scheme:"wss",domainHost:q1.domainHost,parse:q1.parse,serialize:q1.serialize},gJ={},yJ=!0,mQ="[A-Za-z0-9\\-\\.\\_\\~"+(yJ?"\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF":"")+"]",Wf="[0-9A-Fa-f]",IJ=h(h("%[EFef]"+Wf+"%"+Wf+Wf+"%"+Wf+Wf)+"|"+h("%[89A-Fa-f]"+Wf+"%"+Wf+Wf)+"|"+h("%"+Wf+Wf)),CJ="[A-Za-z0-9\\!\\$\\%\\'\\*\\+\\-\\^\\_\\`\\{\\|\\}\\~]",TJ="[\\!\\$\\%\\'\\(\\)\\*\\+\\,\\-\\.0-9\\<\\>A-Z\\x5E-\\x7E]",xJ=v(TJ,"[\\\"\\\\]"),ZJ="[\\!\\$\\'\\(\\)\\*\\+\\,\\;\\:\\@]",rJ=new RegExp(mQ,"g"),uf=new RegExp(IJ,"g"),uJ=new RegExp(v("[^]",CJ,"[\\.]","[\\\"]",xJ),"g"),aQ=new RegExp(v("[^]",mQ,ZJ),"g"),mJ=aQ;function g0(H){var w=lv(H);return!w.match(rJ)?H:w}var cQ={scheme:"mailto",parse:function H(w,$){var E=w,V=E.to=E.path?E.path.split(","):[];if(E.path=void 0,E.query){var y=!1,t={},Jv=E.query.split("&");for(var Yv=0,Nv=Jv.length;Yv<Nv;++Yv){var Qv=Jv[Yv].split("=");switch(Qv[0]){case"to":var Ov=Qv[1].split(",");for(var Uv=0,Hv=Ov.length;Uv<Hv;++Uv)V.push(Ov[Uv]);break;case"subject":E.subject=ov(Qv[1],$);break;case"body":E.body=ov(Qv[1],$);break;default:y=!0,t[ov(Qv[0],$)]=ov(Qv[1],$);break}}if(y)E.headers=t}E.query=void 0;for(var Pv=0,Kv=V.length;Pv<Kv;++Pv){var Gv=V[Pv].split("@");if(Gv[0]=ov(Gv[0]),!$.unicodeSupport)try{Gv[1]=Wv.toASCII(ov(Gv[1],$).toLowerCase())}catch(_f){E.error=E.error||"Email address's domain name can not be converted to ASCII via punycode: "+_f}else Gv[1]=ov(Gv[1],$).toLowerCase();V[Pv]=Gv.join("@")}return E},serialize:function H(w,$){var E=w,V=W(w.to);if(V){for(var y=0,t=V.length;y<t;++y){var Jv=String(V[y]),Yv=Jv.lastIndexOf("@"),Nv=Jv.slice(0,Yv).replace(uf,g0).replace(uf,Q).replace(uJ,zv),Qv=Jv.slice(Yv+1);try{Qv=!$.iri?Wv.toASCII(ov(Qv,$).toLowerCase()):Wv.toUnicode(Qv)}catch(Pv){E.error=E.error||"Email address's domain name can not be converted to "+(!$.iri?"ASCII":"Unicode")+" via punycode: "+Pv}V[y]=Nv+"@"+Qv}E.path=V.join(",")}var Ov=w.headers=w.headers||{};if(w.subject)Ov.subject=w.subject;if(w.body)Ov.body=w.body;var Uv=[];for(var Hv in Ov)if(Ov[Hv]!==gJ[Hv])Uv.push(Hv.replace(uf,g0).replace(uf,Q).replace(aQ,zv)+"="+Ov[Hv].replace(uf,g0).replace(uf,Q).replace(mJ,zv));if(Uv.length)E.query=Uv.join("&");return E}},aJ=/^([^\:]+)\:(.*)/,pQ={scheme:"urn",parse:function H(w,$){var E=w.path&&w.path.match(aJ),V=w;if(E){var y=$.scheme||V.scheme||"urn",t=E[1].toLowerCase(),Jv=E[2],Yv=y+":"+($.nid||t),Nv=Vv[Yv];if(V.nid=t,V.nss=Jv,V.path=void 0,Nv)V=Nv.parse(V,$)}else V.error=V.error||"URN can not be parsed.";return V},serialize:function H(w,$){var E=$.scheme||w.scheme||"urn",V=w.nid,y=E+":"+($.nid||V),t=Vv[y];if(t)w=t.serialize(w,$);var Jv=w,Yv=w.nss;return Jv.path=(V||$.nid)+":"+Yv,Jv}},cJ=/^[0-9A-Fa-f]{8}(?:\-[0-9A-Fa-f]{4}){3}\-[0-9A-Fa-f]{12}$/,nQ={scheme:"urn:uuid",parse:function H(w,$){var E=w;if(E.uuid=E.nss,E.nss=void 0,!$.tolerant&&(!E.uuid||!E.uuid.match(cJ)))E.error=E.error||"UUID is not valid.";return E},serialize:function H(w,$){var E=w;return E.nss=(w.uuid||"").toLowerCase(),E}};Vv[w1.scheme]=w1,Vv[ZQ.scheme]=ZQ,Vv[q1.scheme]=q1,Vv[uQ.scheme]=uQ,Vv[cQ.scheme]=cQ,Vv[pQ.scheme]=pQ,Vv[nQ.scheme]=nQ,f.SCHEMES=Vv,f.pctEncChar=zv,f.pctDecChars=lv,f.parse=Xv,f.removeDotSegments=cv,f.serialize=Cv,f.resolveComponents=kv,f.resolve=Jf,f.normalize=xv,f.equal=y1,f.escapeComponent=k0,f.unescapeComponent=ov,Object.defineProperty(f,"__esModule",{value:!0})})});var B0=n((kX,kh)=>{kh.exports=function f(v,h){if(v===h)return!0;if(v&&h&&typeof v=="object"&&typeof h=="object"){if(v.constructor!==h.constructor)return!1;var J,Q,W;if(Array.isArray(v)){if(J=v.length,J!=h.length)return!1;for(Q=J;Q--!==0;)if(!f(v[Q],h[Q]))return!1;return!0}if(v.constructor===RegExp)return v.source===h.source&&v.flags===h.flags;if(v.valueOf!==Object.prototype.valueOf)return v.valueOf()===h.valueOf();if(v.toString!==Object.prototype.toString)return v.toString()===h.toString();if(W=Object.keys(v),J=W.length,J!==Object.keys(h).length)return!1;for(Q=J;Q--!==0;)if(!Object.prototype.hasOwnProperty.call(h,W[Q]))return!1;for(Q=J;Q--!==0;){var X=W[Q];if(!f(v[X],h[X]))return!1}return!0}return v!==v&&h!==h}});var yh=n((gX,gh)=>{gh.exports=function f(v){var h=0,J=v.length,Q=0,W;while(Q<J)if(h++,W=v.charCodeAt(Q++),W>=55296&&W<=56319&&Q<J){if(W=v.charCodeAt(Q),(W&64512)==56320)Q++}return h}});var xf=n((yX,Th)=>{Th.exports={copy:fP,checkDataType:fQ,checkDataTypes:QP,coerceToTypes:hP,toHash:hQ,getProperty:JQ,escapeQuotes:WQ,equal:B0(),ucs2length:yh(),varOccurences:PP,varReplace:XP,schemaHasRules:YP,schemaHasRulesExcept:BP,schemaUnknownRules:GP,toQuotedString:QQ,getPathExpr:wP,getPath:qP,getData:OP,unescapeFragment:KP,unescapeJsonPointer:XQ,escapeFragment:$P,escapeJsonPointer:PQ};function fP(f,v){v=v||{};for(var h in f)v[h]=f[h];return v}function fQ(f,v,h,J){var Q=J?" !== ":" === ",W=J?" || ":" && ",X=J?"!":"",Y=J?"":"!";switch(f){case"null":return v+Q+"null";case"array":return X+"Array.isArray("+v+")";case"object":return"("+X+v+W+"typeof "+v+Q+'"object"'+W+Y+"Array.isArray("+v+"))";case"integer":return"(typeof "+v+Q+'"number"'+W+Y+"("+v+" % 1)"+W+v+Q+v+(h?W+X+"isFinite("+v+")":"")+")";case"number":return"(typeof "+v+Q+'"'+f+'"'+(h?W+X+"isFinite("+v+")":"")+")";default:return"typeof "+v+Q+'"'+f+'"'}}function QP(f,v,h){switch(f.length){case 1:return fQ(f[0],v,h,!0);default:var J="",Q=hQ(f);if(Q.array&&Q.object)J=Q.null?"(":"(!"+v+" || ",J+="typeof "+v+' !== "object")',delete Q.null,delete Q.array,delete Q.object;if(Q.number)delete Q.integer;for(var W in Q)J+=(J?" && ":"")+fQ(W,v,h,!0);return J}}var Ih=hQ(["string","number","integer","boolean","null"]);function hP(f,v){if(Array.isArray(v)){var h=[];for(var J=0;J<v.length;J++){var Q=v[J];if(Ih[Q])h[h.length]=Q;else if(f==="array"&&Q==="array")h[h.length]=Q}if(h.length)return h}else if(Ih[v])return[v];else if(f==="array"&&v==="array")return["array"]}function hQ(f){var v={};for(var h=0;h<f.length;h++)v[f[h]]=!0;return v}var JP=/^[a-z$_][a-z$_0-9]*$/i,WP=/'|\\/g;function JQ(f){return typeof f=="number"?"["+f+"]":JP.test(f)?"."+f:"['"+WQ(f)+"']"}function WQ(f){return f.replace(WP,"\\$&").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\f/g,"\\f").replace(/\t/g,"\\t")}function PP(f,v){v+="[^0-9]";var h=f.match(new RegExp(v,"g"));return h?h.length:0}function XP(f,v,h){return v+="([^0-9])",h=h.replace(/\$/g,"$$$$"),f.replace(new RegExp(v,"g"),h+"$1")}function YP(f,v){if(typeof f=="boolean")return!f;for(var h in f)if(v[h])return!0}function BP(f,v,h){if(typeof f=="boolean")return!f&&h!="not";for(var J in f)if(J!=h&&v[J])return!0}function GP(f,v){if(typeof f=="boolean")return;for(var h in f)if(!v[h])return h}function QQ(f){return"'"+WQ(f)+"'"}function wP(f,v,h,J){var Q=h?"'/' + "+v+(J?"":".replace(/~/g, '~0').replace(/\\//g, '~1')"):J?"'[' + "+v+" + ']'":"'[\\'' + "+v+" + '\\']'";return Ch(f,Q)}function qP(f,v,h){var J=h?QQ("/"+PQ(v)):QQ(JQ(v));return Ch(f,J)}var DP=/^\/(?:[^~]|~0|~1)*$/,HP=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function OP(f,v,h){var J,Q,W,X;if(f==="")return"rootData";if(f[0]=="/"){if(!DP.test(f))throw new Error("Invalid JSON-pointer: "+f);Q=f,W="rootData"}else{if(X=f.match(HP),!X)throw new Error("Invalid JSON-pointer: "+f);if(J=+X[1],Q=X[2],Q=="#"){if(J>=v)throw new Error("Cannot access property/index "+J+" levels up, current level is "+v);return h[v-J]}if(J>v)throw new Error("Cannot access data "+J+" levels up, current level is "+v);if(W="data"+(v-J||""),!Q)return W}var Y=W,B=Q.split("/");for(var q=0;q<B.length;q++){var D=B[q];if(D)W+=JQ(XQ(D)),Y+=" && "+W}return Y}function Ch(f,v){if(f=='""')return v;return(f+" + "+v).replace(/([^\\])' \+ '/g,"$1")}function KP(f){return XQ(decodeURIComponent(f))}function $P(f){return encodeURIComponent(PQ(f))}function PQ(f){return f.replace(/~/g,"~0").replace(/\//g,"~1")}function XQ(f){return f.replace(/~1/g,"/").replace(/~0/g,"~")}});var YQ=n((IX,xh)=>{var jP=xf();xh.exports=LP;function LP(f){jP.copy(f,this)}});var rh=n((CX,Zh)=>{var Uf=Zh.exports=function(f,v,h){if(typeof v=="function")h=v,v={};h=v.cb||h;var J=typeof h=="function"?h:h.pre||function(){},Q=h.post||function(){};G0(v,J,Q,f,"",f)};Uf.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0};Uf.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};Uf.propsKeywords={definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};Uf.skipKeywords={default:!0,enum:!0,const:!0,required:!0,maximum:!0,minimum:!0,exclusiveMaximum:!0,exclusiveMinimum:!0,multipleOf:!0,maxLength:!0,minLength:!0,pattern:!0,format:!0,maxItems:!0,minItems:!0,uniqueItems:!0,maxProperties:!0,minProperties:!0};function G0(f,v,h,J,Q,W,X,Y,B,q){if(J&&typeof J=="object"&&!Array.isArray(J)){v(J,Q,W,X,Y,B,q);for(var D in J){var j=J[D];if(Array.isArray(j)){if(D in Uf.arrayKeywords)for(var L=0;L<j.length;L++)G0(f,v,h,j[L],Q+"/"+D+"/"+L,W,Q,D,J,L)}else if(D in Uf.propsKeywords){if(j&&typeof j=="object")for(var G in j)G0(f,v,h,j[G],Q+"/"+D+"/"+MP(G),W,Q,D,J,G)}else if(D in Uf.keywords||f.allKeys&&!(D in Uf.skipKeywords))G0(f,v,h,j,Q+"/"+D,W,Q,D,J)}h(J,Q,W,X,Y,B,q)}}function MP(f){return f.replace(/~/g,"~0").replace(/\//g,"~1")}});var K0=n((TX,ch)=>{var R1=lh(),uh=B0(),H0=xf(),w0=YQ(),EP=rh();ch.exports=Af;Af.normalizeId=zf;Af.fullPath=q0;Af.url=D0;Af.ids=zP;Af.inlineRef=BQ;Af.schema=O0;function Af(f,v,h){var J=this._refs[h];if(typeof J=="string")if(this._refs[J])J=this._refs[J];else return Af.call(this,f,v,J);if(J=J||this._schemas[h],J instanceof w0)return BQ(J.schema,this._opts.inlineRefs)?J.schema:J.validate||this._compile(J);var Q=O0.call(this,v,h),W,X,Y;if(Q)W=Q.schema,v=Q.root,Y=Q.baseId;if(W instanceof w0)X=W.validate||f.call(this,W.schema,v,void 0,Y);else if(W!==void 0)X=BQ(W,this._opts.inlineRefs)?W:f.call(this,W,v,void 0,Y);return X}function O0(f,v){var h=R1.parse(v),J=ah(h),Q=q0(this._getId(f.schema));if(Object.keys(f.schema).length===0||J!==Q){var W=zf(J),X=this._refs[W];if(typeof X=="string")return VP.call(this,f,X,h);else if(X instanceof w0){if(!X.validate)this._compile(X);f=X}else if(X=this._schemas[W],X instanceof w0){if(!X.validate)this._compile(X);if(W==zf(v))return{schema:X,root:f,baseId:Q};f=X}else return;if(!f.schema)return;Q=q0(this._getId(f.schema))}return mh.call(this,h,Q,f.schema,f)}function VP(f,v,h){var J=O0.call(this,f,v);if(J){var{schema:Q,baseId:W}=J;f=J.root;var X=this._getId(Q);if(X)W=D0(W,X);return mh.call(this,h,W,Q,f)}}var FP=H0.toHash(["properties","patternProperties","enum","dependencies","definitions"]);function mh(f,v,h,J){if(f.fragment=f.fragment||"",f.fragment.slice(0,1)!="/")return;var Q=f.fragment.split("/");for(var W=1;W<Q.length;W++){var X=Q[W];if(X){if(X=H0.unescapeFragment(X),h=h[X],h===void 0)break;var Y;if(!FP[X]){if(Y=this._getId(h),Y)v=D0(v,Y);if(h.$ref){var B=D0(v,h.$ref),q=O0.call(this,J,B);if(q)h=q.schema,J=q.root,v=q.baseId}}}}if(h!==void 0&&h!==J.schema)return{schema:h,root:J,baseId:v}}var NP=H0.toHash(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum"]);function BQ(f,v){if(v===!1)return!1;if(v===void 0||v===!0)return GQ(f);else if(v)return wQ(f)<=v}function GQ(f){var v;if(Array.isArray(f)){for(var h=0;h<f.length;h++)if(v=f[h],typeof v=="object"&&!GQ(v))return!1}else for(var J in f){if(J=="$ref")return!1;if(v=f[J],typeof v=="object"&&!GQ(v))return!1}return!0}function wQ(f){var v=0,h;if(Array.isArray(f))for(var J=0;J<f.length;J++){if(h=f[J],typeof h=="object")v+=wQ(h);if(v==1/0)return 1/0}else for(var Q in f){if(Q=="$ref")return 1/0;if(NP[Q])v++;else{if(h=f[Q],typeof h=="object")v+=wQ(h)+1;if(v==1/0)return 1/0}}return v}function q0(f,v){if(v!==!1)f=zf(f);var h=R1.parse(f);return ah(h)}function ah(f){return R1.serialize(f).split("#")[0]+"#"}var UP=/#\/?$/;function zf(f){return f?f.replace(UP,""):""}function D0(f,v){return v=zf(v),R1.resolve(f,v)}function zP(f){var v=zf(this._getId(f)),h={"":v},J={"":q0(v,!1)},Q={},W=this;return EP(f,{allKeys:!0},function(X,Y,B,q,D,j,L){if(Y==="")return;var G=W._getId(X),O=h[q],M=J[q]+"/"+D;if(L!==void 0)M+="/"+(typeof L=="number"?L:H0.escapeFragment(L));if(typeof G=="string"){G=O=zf(O?R1.resolve(O,G):G);var K=W._refs[G];if(typeof K=="string")K=W._refs[K];if(K&&K.schema){if(!uh(X,K.schema))throw new Error('id "'+G+'" resolves to more than one schema')}else if(G!=zf(M))if(G[0]=="#"){if(Q[G]&&!uh(X,Q[G]))throw new Error('id "'+G+'" resolves to more than one schema');Q[G]=X}else W._refs[G]=M}h[Y]=O,J[Y]=M}),Q}});var $0=n((xX,nh)=>{var qQ=K0();nh.exports={Validation:ph(AP),MissingRef:ph(DQ)};function AP(f){this.message="validation failed",this.errors=f,this.ajv=this.validation=!0}DQ.message=function(f,v){return"can't resolve reference "+v+" from id "+f};function DQ(f,v,h){this.message=h||DQ.message(f,v),this.missingRef=qQ.url(f,v),this.missingSchema=qQ.normalizeId(qQ.fullPath(this.missingRef))}function ph(f){return f.prototype=Object.create(Error.prototype),f.prototype.constructor=f,f}});var HQ=n((ZX,ih)=>{ih.exports=function(f,v){if(!v)v={};if(typeof v==="function")v={cmp:v};var h=typeof v.cycles==="boolean"?v.cycles:!1,J=v.cmp&&function(W){return function(X){return function(Y,B){var q={key:Y,value:X[Y]},D={key:B,value:X[B]};return W(q,D)}}}(v.cmp),Q=[];return function W(X){if(X&&X.toJSON&&typeof X.toJSON==="function")X=X.toJSON();if(X===void 0)return;if(typeof X=="number")return isFinite(X)?""+X:"null";if(typeof X!=="object")return JSON.stringify(X);var Y,B;if(Array.isArray(X)){B="[";for(Y=0;Y<X.length;Y++){if(Y)B+=",";B+=W(X[Y])||"null"}return B+"]"}if(X===null)return"null";if(Q.indexOf(X)!==-1){if(h)return JSON.stringify("__cycle__");throw new TypeError("Converting circular structure to JSON")}var q=Q.push(X)-1,D=Object.keys(X).sort(J&&J(X));B="";for(Y=0;Y<D.length;Y++){var j=D[Y],L=W(X[j]);if(!L)continue;if(B)B+=",";B+=JSON.stringify(j)+":"+L}return Q.splice(q,1),"{"+B+"}"}(f)}});var OQ=n((rX,dh)=>{dh.exports=function f(v,h,J){var Q="",W=v.schema.$async===!0,X=v.util.schemaHasRulesExcept(v.schema,v.RULES.all,"$ref"),Y=v.self._getId(v.schema);if(v.opts.strictKeywords){var B=v.util.schemaUnknownRules(v.schema,v.RULES.keywords);if(B){var q="unknown keyword: "+B;if(v.opts.strictKeywords==="log")v.logger.warn(q);else throw new Error(q)}}if(v.isTop){if(Q+=" var validate = ",W)v.async=!0,Q+="async ";if(Q+="function(data, dataPath, parentData, parentDataProperty, rootData) { 'use strict'; ",Y&&(v.opts.sourceCode||v.opts.processCode))Q+=" "+("/*# sourceURL="+Y+" */")+" "}if(typeof v.schema=="boolean"||!(X||v.schema.$ref)){var h="false schema",D=v.level,j=v.dataLevel,L=v.schema[h],G=v.schemaPath+v.util.getProperty(h),O=v.errSchemaPath+"/"+h,b=!v.opts.allErrors,Z,M="data"+(j||""),A="valid"+D;if(v.schema===!1){if(v.isTop)b=!0;else Q+=" var "+A+" = false; ";var K=K||[];if(K.push(Q),Q="",v.createErrors!==!1){if(Q+=" { keyword: '"+(Z||"false schema")+"' , dataPath: (dataPath || '') + "+v.errorPath+" , schemaPath: "+v.util.toQuotedString(O)+" , params: {} ",v.opts.messages!==!1)Q+=" , message: 'boolean schema is false' ";if(v.opts.verbose)Q+=" , schema: false , parentSchema: validate.schema"+v.schemaPath+" , data: "+M+" ";Q+=" } "}else Q+=" {} ";var F=Q;if(Q=K.pop(),!v.compositeRule&&b)if(v.async)Q+=" throw new ValidationError(["+F+"]); ";else Q+=" validate.errors = ["+F+"]; return false; ";else Q+=" var err = "+F+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "}else if(v.isTop)if(W)Q+=" return data; ";else Q+=" validate.errors = null; return true; ";else Q+=" var "+A+" = true; ";if(v.isTop)Q+=" }; return validate; ";return Q}if(v.isTop){var S=v.isTop,D=v.level=0,j=v.dataLevel=0,M="data";if(v.rootId=v.resolve.fullPath(v.self._getId(v.root.schema)),v.baseId=v.baseId||v.rootId,delete v.isTop,v.dataPathArr=[""],v.schema.default!==void 0&&v.opts.useDefaults&&v.opts.strictDefaults){var N="default is ignored in the schema root";if(v.opts.strictDefaults==="log")v.logger.warn(N);else throw new Error(N)}Q+=" var vErrors = null; ",Q+=" var errors = 0; ",Q+=" if (rootData === undefined) rootData = data; "}else{var{level:D,dataLevel:j}=v,M="data"+(j||"");if(Y)v.baseId=v.resolve.url(v.baseId,Y);if(W&&!v.async)throw new Error("async schema in sync schema");Q+=" var errs_"+D+" = errors;"}var A="valid"+D,b=!v.opts.allErrors,k="",m="",Z,_=v.schema.type,r=Array.isArray(_);if(_&&v.opts.nullable&&v.schema.nullable===!0){if(r){if(_.indexOf("null")==-1)_=_.concat("null")}else if(_!="null")_=[_,"null"],r=!0}if(r&&_.length==1)_=_[0],r=!1;if(v.schema.$ref&&X){if(v.opts.extendRefs=="fail")throw new Error('$ref: validation keywords used in schema at path "'+v.errSchemaPath+'" (see option extendRefs)');else if(v.opts.extendRefs!==!0)X=!1,v.logger.warn('$ref: keywords ignored in schema at path "'+v.errSchemaPath+'"')}if(v.schema.$comment&&v.opts.$comment)Q+=" "+v.RULES.all.$comment.code(v,"$comment");if(_){if(v.opts.coerceTypes)var x=v.util.coerceToTypes(v.opts.coerceTypes,_);var C=v.RULES.types[_];if(x||r||C===!0||C&&!Av(C)){var G=v.schemaPath+".type",O=v.errSchemaPath+"/type",G=v.schemaPath+".type",O=v.errSchemaPath+"/type",R=r?"checkDataTypes":"checkDataType";if(Q+=" if ("+v.util[R](_,M,v.opts.strictNumbers,!0)+") { ",x){var l="dataType"+D,T="coerced"+D;if(Q+=" var "+l+" = typeof "+M+"; var "+T+" = undefined; ",v.opts.coerceTypes=="array")Q+=" if ("+l+" == 'object' && Array.isArray("+M+") && "+M+".length == 1) { "+M+" = "+M+"[0]; "+l+" = typeof "+M+"; if ("+v.util.checkDataType(v.schema.type,M,v.opts.strictNumbers)+") "+T+" = "+M+"; } ";Q+=" if ("+T+" !== undefined) ; ";var Bv=x;if(Bv){var e,fv=-1,o=Bv.length-1;while(fv<o)if(e=Bv[fv+=1],e=="string")Q+=" else if ("+l+" == 'number' || "+l+" == 'boolean') "+T+" = '' + "+M+"; else if ("+M+" === null) "+T+" = ''; ";else if(e=="number"||e=="integer"){if(Q+=" else if ("+l+" == 'boolean' || "+M+" === null || ("+l+" == 'string' && "+M+" && "+M+" == +"+M+" ",e=="integer")Q+=" && !("+M+" % 1)";Q+=")) "+T+" = +"+M+"; "}else if(e=="boolean")Q+=" else if ("+M+" === 'false' || "+M+" === 0 || "+M+" === null) "+T+" = false; else if ("+M+" === 'true' || "+M+" === 1) "+T+" = true; ";else if(e=="null")Q+=" else if ("+M+" === '' || "+M+" === 0 || "+M+" === false) "+T+" = null; ";else if(v.opts.coerceTypes=="array"&&e=="array")Q+=" else if ("+l+" == 'string' || "+l+" == 'number' || "+l+" == 'boolean' || "+M+" == null) "+T+" = ["+M+"]; "}Q+=" else { ";var K=K||[];if(K.push(Q),Q="",v.createErrors!==!1){if(Q+=" { keyword: '"+(Z||"type")+"' , dataPath: (dataPath || '') + "+v.errorPath+" , schemaPath: "+v.util.toQuotedString(O)+" , params: { type: '",r)Q+=""+_.join(",");else Q+=""+_;if(Q+="' } ",v.opts.messages!==!1){if(Q+=" , message: 'should be ",r)Q+=""+_.join(",");else Q+=""+_;Q+="' "}if(v.opts.verbose)Q+=" , schema: validate.schema"+G+" , parentSchema: validate.schema"+v.schemaPath+" , data: "+M+" ";Q+=" } "}else Q+=" {} ";var F=Q;if(Q=K.pop(),!v.compositeRule&&b)if(v.async)Q+=" throw new ValidationError(["+F+"]); ";else Q+=" validate.errors = ["+F+"]; return false; ";else Q+=" var err = "+F+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";Q+=" } if ("+T+" !== undefined) { ";var a=j?"data"+(j-1||""):"parentData",jv=j?v.dataPathArr[j]:"parentDataProperty";if(Q+=" "+M+" = "+T+"; ",!j)Q+="if ("+a+" !== undefined)";Q+=" "+a+"["+jv+"] = "+T+"; } "}else{var K=K||[];if(K.push(Q),Q="",v.createErrors!==!1){if(Q+=" { keyword: '"+(Z||"type")+"' , dataPath: (dataPath || '') + "+v.errorPath+" , schemaPath: "+v.util.toQuotedString(O)+" , params: { type: '",r)Q+=""+_.join(",");else Q+=""+_;if(Q+="' } ",v.opts.messages!==!1){if(Q+=" , message: 'should be ",r)Q+=""+_.join(",");else Q+=""+_;Q+="' "}if(v.opts.verbose)Q+=" , schema: validate.schema"+G+" , parentSchema: validate.schema"+v.schemaPath+" , data: "+M+" ";Q+=" } "}else Q+=" {} ";var F=Q;if(Q=K.pop(),!v.compositeRule&&b)if(v.async)Q+=" throw new ValidationError(["+F+"]); ";else Q+=" validate.errors = ["+F+"]; return false; ";else Q+=" var err = "+F+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "}Q+=" } "}}if(v.schema.$ref&&!X){if(Q+=" "+v.RULES.all.$ref.code(v,"$ref")+" ",b){if(Q+=" } if (errors === ",S)Q+="0";else Q+="errs_"+D;Q+=") { ",m+="}"}}else{var Sv=v.RULES;if(Sv){var C,_v=-1,Wv=Sv.length-1;while(_v<Wv)if(C=Sv[_v+=1],Av(C)){if(C.type)Q+=" if ("+v.util.checkDataType(C.type,M,v.opts.strictNumbers)+") { ";if(v.opts.useDefaults){if(C.type=="object"&&v.schema.properties){var L=v.schema.properties,Vv=Object.keys(L),zv=Vv;if(zv){var lv,Lf=-1,Gf=zv.length-1;while(Lf<Gf){lv=zv[Lf+=1];var Fv=L[lv];if(Fv.default!==void 0){var Lv=M+v.util.getProperty(lv);if(v.compositeRule){if(v.opts.strictDefaults){var N="default is ignored for: "+Lv;if(v.opts.strictDefaults==="log")v.logger.warn(N);else throw new Error(N)}}else{if(Q+=" if ("+Lv+" === undefined ",v.opts.useDefaults=="empty")Q+=" || "+Lv+" === null || "+Lv+" === '' ";if(Q+=" ) "+Lv+" = ",v.opts.useDefaults=="shared")Q+=" "+v.useDefault(Fv.default)+" ";else Q+=" "+JSON.stringify(Fv.default)+" ";Q+="; "}}}}}else if(C.type=="array"&&Array.isArray(v.schema.items)){var Sf=v.schema.items;if(Sf){var Fv,fv=-1,bv=Sf.length-1;while(fv<bv)if(Fv=Sf[fv+=1],Fv.default!==void 0){var Lv=M+"["+fv+"]";if(v.compositeRule){if(v.opts.strictDefaults){var N="default is ignored for: "+Lv;if(v.opts.strictDefaults==="log")v.logger.warn(N);else throw new Error(N)}}else{if(Q+=" if ("+Lv+" === undefined ",v.opts.useDefaults=="empty")Q+=" || "+Lv+" === null || "+Lv+" === '' ";if(Q+=" ) "+Lv+" = ",v.opts.useDefaults=="shared")Q+=" "+v.useDefault(Fv.default)+" ";else Q+=" "+JSON.stringify(Fv.default)+" ";Q+="; "}}}}}var Xv=C.rules;if(Xv){var Mf,wf=-1,bf=Xv.length-1;while(wf<bf)if(Mf=Xv[wf+=1],cv(Mf)){var Rf=Mf.code(v,Mf.keyword,C.type);if(Rf){if(Q+=" "+Rf+" ",b)k+="}"}}}if(b)Q+=" "+k+" ",k="";if(C.type){if(Q+=" } ",_&&_===C.type&&!x){Q+=" else { ";var G=v.schemaPath+".type",O=v.errSchemaPath+"/type",K=K||[];if(K.push(Q),Q="",v.createErrors!==!1){if(Q+=" { keyword: '"+(Z||"type")+"' , dataPath: (dataPath || '') + "+v.errorPath+" , schemaPath: "+v.util.toQuotedString(O)+" , params: { type: '",r)Q+=""+_.join(",");else Q+=""+_;if(Q+="' } ",v.opts.messages!==!1){if(Q+=" , message: 'should be ",r)Q+=""+_.join(",");else Q+=""+_;Q+="' "}if(v.opts.verbose)Q+=" , schema: validate.schema"+G+" , parentSchema: validate.schema"+v.schemaPath+" , data: "+M+" ";Q+=" } "}else Q+=" {} ";var F=Q;if(Q=K.pop(),!v.compositeRule&&b)if(v.async)Q+=" throw new ValidationError(["+F+"]); ";else Q+=" validate.errors = ["+F+"]; return false; ";else Q+=" var err = "+F+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";Q+=" } "}}if(b){if(Q+=" if (errors === ",S)Q+="0";else Q+="errs_"+D;Q+=") { ",m+="}"}}}}if(b)Q+=" "+m+" ";if(S){if(W)Q+=" if (errors === 0) return data; ",Q+=" else throw new ValidationError(vErrors); ";else Q+=" validate.errors = vErrors; ",Q+=" return errors === 0; ";Q+=" }; return validate;"}else Q+=" var "+A+" = errors === errs_"+D+";";function Av(kv){var Jf=kv.rules;for(var xv=0;xv<Jf.length;xv++)if(cv(Jf[xv]))return!0}function cv(kv){return v.schema[kv.keyword]!==void 0||kv.implements&&Cv(kv)}function Cv(kv){var Jf=kv.implements;for(var xv=0;xv<Jf.length;xv++)if(v.schema[Jf[xv]]!==void 0)return!0}return Q}});var v9=n((uX,eh)=>{var j0=K0(),M0=xf(),sh=$0(),SP=HQ(),th=OQ(),bP=M0.ucs2length,RP=B0(),_P=sh.Validation;eh.exports=KQ;function KQ(f,v,h,J){var Q=this,W=this._opts,X=[void 0],Y={},B=[],q={},D=[],j={},L=[];v=v||{schema:f,refVal:X,refs:Y};var G=lP.call(this,f,v,J),O=this._compilations[G.index];if(G.compiling)return O.callValidate=N;var M=this._formats,K=this.RULES;try{var F=A(f,v,h,J);O.validate=F;var S=O.callValidate;if(S){if(S.schema=F.schema,S.errors=null,S.refs=F.refs,S.refVal=F.refVal,S.root=F.root,S.$async=F.$async,W.sourceCode)S.source=F.source}return F}finally{kP.call(this,f,v,J)}function N(){var R=O.validate,l=R.apply(this,arguments);return N.errors=R.errors,l}function A(R,l,T,Bv){var e=!l||l&&l.schema==R;if(l.schema!=v.schema)return KQ.call(Q,R,l,T,Bv);var fv=R.$async===!0,o=th({isTop:!0,schema:R,isRoot:e,baseId:Bv,root:l,schemaPath:"",errSchemaPath:"#",errorPath:'""',MissingRefError:sh.MissingRef,RULES:K,validate:th,util:M0,resolve:j0,resolveRef:b,usePattern:r,useDefault:x,useCustomRule:C,opts:W,formats:M,logger:Q.logger,self:Q});if(o=L0(X,IP)+L0(B,gP)+L0(D,yP)+L0(L,CP)+o,W.processCode)o=W.processCode(o,R);var a;try{var jv=new Function("self","RULES","formats","root","refVal","defaults","customRules","equal","ucs2length","ValidationError",o);a=jv(Q,K,M,v,X,D,L,RP,bP,_P),X[0]=a}catch(Sv){throw Q.logger.error("Error compiling schema, function code:",o),Sv}if(a.schema=R,a.errors=null,a.refs=Y,a.refVal=X,a.root=e?a:l,fv)a.$async=!0;if(W.sourceCode===!0)a.source={code:o,patterns:B,defaults:D};return a}function b(R,l,T){l=j0.url(R,l);var Bv=Y[l],e,fv;if(Bv!==void 0)return e=X[Bv],fv="refVal["+Bv+"]",_(e,fv);if(!T&&v.refs){var o=v.refs[l];if(o!==void 0)return e=v.refVal[o],fv=k(l,e),_(e,fv)}fv=k(l);var a=j0.call(Q,A,v,l);if(a===void 0){var jv=h&&h[l];if(jv)a=j0.inlineRef(jv,W.inlineRefs)?jv:KQ.call(Q,jv,v,h,R)}if(a===void 0)m(l);else return Z(l,a),_(a,fv)}function k(R,l){var T=X.length;return X[T]=l,Y[R]=T,"refVal"+T}function m(R){delete Y[R]}function Z(R,l){var T=Y[R];X[T]=l}function _(R,l){return typeof R=="object"||typeof R=="boolean"?{code:l,schema:R,inline:!0}:{code:l,$async:R&&!!R.$async}}function r(R){var l=q[R];if(l===void 0)l=q[R]=B.length,B[l]=R;return"pattern"+l}function x(R){switch(typeof R){case"boolean":case"number":return""+R;case"string":return M0.toQuotedString(R);case"object":if(R===null)return"null";var l=SP(R),T=j[l];if(T===void 0)T=j[l]=D.length,D[T]=R;return"default"+T}}function C(R,l,T,Bv){if(Q._opts.validateSchema!==!1){var e=R.definition.dependencies;if(e&&!e.every(function(zv){return Object.prototype.hasOwnProperty.call(T,zv)}))throw new Error("parent schema must have all required keywords: "+e.join(","));var fv=R.definition.validateSchema;if(fv){var o=fv(l);if(!o){var a="keyword schema is invalid: "+Q.errorsText(fv.errors);if(Q._opts.validateSchema=="log")Q.logger.error(a);else throw new Error(a)}}}var jv=R.definition.compile,Sv=R.definition.inline,_v=R.definition.macro,Wv;if(jv)Wv=jv.call(Q,l,T,Bv);else if(_v){if(Wv=_v.call(Q,l,T,Bv),W.validateSchema!==!1)Q.validateSchema(Wv,!0)}else if(Sv)Wv=Sv.call(Q,Bv,R.keyword,l,T);else if(Wv=R.definition.validate,!Wv)return;if(Wv===void 0)throw new Error('custom keyword "'+R.keyword+'"failed to compile');var Vv=L.length;return L[Vv]=Wv,{code:"customRule"+Vv,validate:Wv}}}function lP(f,v,h){var J=oh.call(this,f,v,h);if(J>=0)return{index:J,compiling:!0};return J=this._compilations.length,this._compilations[J]={schema:f,root:v,baseId:h},{index:J,compiling:!1}}function kP(f,v,h){var J=oh.call(this,f,v,h);if(J>=0)this._compilations.splice(J,1)}function oh(f,v,h){for(var J=0;J<this._compilations.length;J++){var Q=this._compilations[J];if(Q.schema==f&&Q.root==v&&Q.baseId==h)return J}return-1}function gP(f,v){return"var pattern"+f+" = new RegExp("+M0.toQuotedString(v[f])+");"}function yP(f){return"var default"+f+" = defaults["+f+"];"}function IP(f,v){return v[f]===void 0?"":"var refVal"+f+" = refVal["+f+"];"}function CP(f){return"var customRule"+f+" = customRules["+f+"];"}function L0(f,v){if(!f.length)return"";var h="";for(var J=0;J<f.length;J++)h+=v(J,f);return h}});var Q9=n((mX,f9)=>{var E0=f9.exports=function f(){this._cache={}};E0.prototype.put=function f(v,h){this._cache[v]=h};E0.prototype.get=function f(v){return this._cache[v]};E0.prototype.del=function f(v){delete this._cache[v]};E0.prototype.clear=function f(){this._cache={}}});var H9=n((aX,D9)=>{var TP=xf(),xP=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,ZP=[0,31,28,31,30,31,30,31,31,30,31,30,31],rP=/^(\d\d):(\d\d):(\d\d)(\.\d+)?(z|[+-]\d\d(?::?\d\d)?)?$/i,h9=/^(?=.{1,253}\.?$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*\.?$/i,uP=/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)(?:\?(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,mP=/^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,J9=/^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i,W9=/^(?:(?:http[s\u017F]?|ftp):\/\/)(?:(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+(?::(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*)?@)?(?:(?!10(?:\.[0-9]{1,3}){3})(?!127(?:\.[0-9]{1,3}){3})(?!169\.254(?:\.[0-9]{1,3}){2})(?!192\.168(?:\.[0-9]{1,3}){2})(?!172\.(?:1[6-9]|2[0-9]|3[01])(?:\.[0-9]{1,3}){2})(?:[1-9][0-9]?|1[0-9][0-9]|2[01][0-9]|22[0-3])(?:\.(?:1?[0-9]{1,2}|2[0-4][0-9]|25[0-5])){2}(?:\.(?:[1-9][0-9]?|1[0-9][0-9]|2[0-4][0-9]|25[0-4]))|(?:(?:(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+-)*(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+)(?:\.(?:(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+-)*(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+)*(?:\.(?:(?:[a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]){2,})))(?::[0-9]{2,5})?(?:\/(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*)?$/i,P9=/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,X9=/^(?:\/(?:[^~/]|~0|~1)*)*$/,Y9=/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,B9=/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/;D9.exports=V0;function V0(f){return f=f=="full"?"full":"fast",TP.copy(V0[f])}V0.fast={date:/^\d\d\d\d-[0-1]\d-[0-3]\d$/,time:/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,"date-time":/^\d\d\d\d-[0-1]\d-[0-3]\d[t\s](?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,uri:/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i,"uri-reference":/^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,"uri-template":J9,url:W9,email:/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i,hostname:h9,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/,ipv6:/^\s*(?:(?:(?:[0-9a-f]{1,4}:){7}(?:[0-9a-f]{1,4}|:))|(?:(?:[0-9a-f]{1,4}:){6}(?::[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){5}(?:(?:(?::[0-9a-f]{1,4}){1,2})|:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){4}(?:(?:(?::[0-9a-f]{1,4}){1,3})|(?:(?::[0-9a-f]{1,4})?:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){3}(?:(?:(?::[0-9a-f]{1,4}){1,4})|(?:(?::[0-9a-f]{1,4}){0,2}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){2}(?:(?:(?::[0-9a-f]{1,4}){1,5})|(?:(?::[0-9a-f]{1,4}){0,3}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){1}(?:(?:(?::[0-9a-f]{1,4}){1,6})|(?:(?::[0-9a-f]{1,4}){0,4}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?::(?:(?:(?::[0-9a-f]{1,4}){1,7})|(?:(?::[0-9a-f]{1,4}){0,5}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(?:%.+)?\s*$/i,regex:q9,uuid:P9,"json-pointer":X9,"json-pointer-uri-fragment":Y9,"relative-json-pointer":B9};V0.full={date:G9,time:w9,"date-time":pP,uri:iP,"uri-reference":mP,"uri-template":J9,url:W9,email:/^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i,hostname:h9,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/,ipv6:/^\s*(?:(?:(?:[0-9a-f]{1,4}:){7}(?:[0-9a-f]{1,4}|:))|(?:(?:[0-9a-f]{1,4}:){6}(?::[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){5}(?:(?:(?::[0-9a-f]{1,4}){1,2})|:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){4}(?:(?:(?::[0-9a-f]{1,4}){1,3})|(?:(?::[0-9a-f]{1,4})?:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){3}(?:(?:(?::[0-9a-f]{1,4}){1,4})|(?:(?::[0-9a-f]{1,4}){0,2}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){2}(?:(?:(?::[0-9a-f]{1,4}){1,5})|(?:(?::[0-9a-f]{1,4}){0,3}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){1}(?:(?:(?::[0-9a-f]{1,4}){1,6})|(?:(?::[0-9a-f]{1,4}){0,4}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?::(?:(?:(?::[0-9a-f]{1,4}){1,7})|(?:(?::[0-9a-f]{1,4}){0,5}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(?:%.+)?\s*$/i,regex:q9,uuid:P9,"json-pointer":X9,"json-pointer-uri-fragment":Y9,"relative-json-pointer":B9};function aP(f){return f%4===0&&(f%100!==0||f%400===0)}function G9(f){var v=f.match(xP);if(!v)return!1;var h=+v[1],J=+v[2],Q=+v[3];return J>=1&&J<=12&&Q>=1&&Q<=(J==2&&aP(h)?29:ZP[J])}function w9(f,v){var h=f.match(rP);if(!h)return!1;var J=h[1],Q=h[2],W=h[3],X=h[5];return(J<=23&&Q<=59&&W<=59||J==23&&Q==59&&W==60)&&(!v||X)}var cP=/t|\s/i;function pP(f){var v=f.split(cP);return v.length==2&&G9(v[0])&&w9(v[1],!0)}var nP=/\/|:/;function iP(f){return nP.test(f)&&uP.test(f)}var dP=/[^\\]\\Z/;function q9(f){if(dP.test(f))return!1;try{return new RegExp(f),!0}catch(v){return!1}}});var K9=n((cX,O9)=>{O9.exports=function f(v,h,J){var Q=" ",W=v.level,X=v.dataLevel,Y=v.schema[h],B=v.errSchemaPath+"/"+h,q=!v.opts.allErrors,D="data"+(X||""),j="valid"+W,L,G;if(Y=="#"||Y=="#/")if(v.isRoot)L=v.async,G="validate";else L=v.root.schema.$async===!0,G="root.refVal[0]";else{var O=v.resolveRef(v.baseId,Y,v.isRoot);if(O===void 0){var M=v.MissingRefError.message(v.baseId,Y);if(v.opts.missingRefs=="fail"){v.logger.error(M);var K=K||[];if(K.push(Q),Q="",v.createErrors!==!1){if(Q+=" { keyword: '$ref' , dataPath: (dataPath || '') + "+v.errorPath+" , schemaPath: "+v.util.toQuotedString(B)+" , params: { ref: '"+v.util.escapeQuotes(Y)+"' } ",v.opts.messages!==!1)Q+=" , message: 'can\\'t resolve reference "+v.util.escapeQuotes(Y)+"' ";if(v.opts.verbose)Q+=" , schema: "+v.util.toQuotedString(Y)+" , parentSchema: validate.schema"+v.schemaPath+" , data: "+D+" ";Q+=" } "}else Q+=" {} ";var F=Q;if(Q=K.pop(),!v.compositeRule&&q)if(v.async)Q+=" throw new ValidationError(["+F+"]); ";else Q+=" validate.errors = ["+F+"]; return false; ";else Q+=" var err = "+F+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";if(q)Q+=" if (false) { "}else if(v.opts.missingRefs=="ignore"){if(v.logger.warn(M),q)Q+=" if (true) { "}else throw new v.MissingRefError(v.baseId,Y,M)}else if(O.inline){var S=v.util.copy(v);S.level++;var N="valid"+S.level;S.schema=O.schema,S.schemaPath="",S.errSchemaPath=Y;var A=v.validate(S).replace(/validate\.schema/g,O.code);if(Q+=" "+A+" ",q)Q+=" if ("+N+") { "}else L=O.$async===!0||v.async&&O.$async!==!1,G=O.code}if(G){var K=K||[];if(K.push(Q),Q="",v.opts.passContext)Q+=" "+G+".call(this, ";else Q+=" "+G+"( ";if(Q+=" "+D+", (dataPath || '')",v.errorPath!='""')Q+=" + "+v.errorPath;var b=X?"data"+(X-1||""):"parentData",k=X?v.dataPathArr[X]:"parentDataProperty";Q+=" , "+b+" , "+k+", rootData) ";var m=Q;if(Q=K.pop(),L){if(!v.async)throw new Error("async schema referenced by sync schema");if(q)Q+=" var "+j+"; ";if(Q+=" try { await "+m+"; ",q)Q+=" "+j+" = true; ";if(Q+=" } catch (e) { if (!(e instanceof ValidationError)) throw e; if (vErrors === null) vErrors = e.errors; else vErrors = vErrors.concat(e.errors); errors = vErrors.length; ",q)Q+=" "+j+" = false; ";if(Q+=" } ",q)Q+=" if ("+j+") { "}else if(Q+=" if (!"+m+") { if (vErrors === null) vErrors = "+G+".errors; else vErrors = vErrors.concat("+G+".errors); errors = vErrors.length; } ",q)Q+=" else { "}return Q}});var j9=n((pX,$9)=>{$9.exports=function f(v,h,J){var Q=" ",W=v.schema[h],X=v.schemaPath+v.util.getProperty(h),Y=v.errSchemaPath+"/"+h,B=!v.opts.allErrors,q=v.util.copy(v),D="";q.level++;var j="valid"+q.level,L=q.baseId,G=!0,O=W;if(O){var M,K=-1,F=O.length-1;while(K<F)if(M=O[K+=1],v.opts.strictKeywords?typeof M=="object"&&Object.keys(M).length>0||M===!1:v.util.schemaHasRules(M,v.RULES.all)){if(G=!1,q.schema=M,q.schemaPath=X+"["+K+"]",q.errSchemaPath=Y+"/"+K,Q+=" "+v.validate(q)+" ",q.baseId=L,B)Q+=" if ("+j+") { ",D+="}"}}if(B)if(G)Q+=" if (true) { ";else Q+=" "+D.slice(0,-1)+" ";return Q}});var M9=n((nX,L9)=>{L9.exports=function f(v,h,J){var Q=" ",W=v.level,X=v.dataLevel,Y=v.schema[h],B=v.schemaPath+v.util.getProperty(h),q=v.errSchemaPath+"/"+h,D=!v.opts.allErrors,j="data"+(X||""),L="valid"+W,G="errs__"+W,O=v.util.copy(v),M="";O.level++;var K="valid"+O.level,F=Y.every(function(Z){return v.opts.strictKeywords?typeof Z=="object"&&Object.keys(Z).length>0||Z===!1:v.util.schemaHasRules(Z,v.RULES.all)});if(F){var S=O.baseId;Q+=" var "+G+" = errors; var "+L+" = false; ";var N=v.compositeRule;v.compositeRule=O.compositeRule=!0;var A=Y;if(A){var b,k=-1,m=A.length-1;while(k<m)b=A[k+=1],O.schema=b,O.schemaPath=B+"["+k+"]",O.errSchemaPath=q+"/"+k,Q+=" "+v.validate(O)+" ",O.baseId=S,Q+=" "+L+" = "+L+" || "+K+"; if (!"+L+") { ",M+="}"}if(v.compositeRule=O.compositeRule=N,Q+=" "+M+" if (!"+L+") { var err = ",v.createErrors!==!1){if(Q+=" { keyword: 'anyOf' , dataPath: (dataPath || '') + "+v.errorPath+" , schemaPath: "+v.util.toQuotedString(q)+" , params: {} ",v.opts.messages!==!1)Q+=" , message: 'should match some schema in anyOf' ";if(v.opts.verbose)Q+=" , schema: validate.schema"+B+" , parentSchema: validate.schema"+v.schemaPath+" , data: "+j+" ";Q+=" } "}else Q+=" {} ";if(Q+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!v.compositeRule&&D)if(v.async)Q+=" throw new ValidationError(vErrors); ";else Q+=" validate.errors = vErrors; return false; ";if(Q+=" } else { errors = "+G+"; if (vErrors !== null) { if ("+G+") vErrors.length = "+G+"; else vErrors = null; } ",v.opts.allErrors)Q+=" } "}else if(D)Q+=" if (true) { ";return Q}});var V9=n((iX,E9)=>{E9.exports=function f(v,h,J){var Q=" ",W=v.schema[h],X=v.errSchemaPath+"/"+h,Y=!v.opts.allErrors,B=v.util.toQuotedString(W);if(v.opts.$comment===!0)Q+=" console.log("+B+");";else if(typeof v.opts.$comment=="function")Q+=" self._opts.$comment("+B+", "+v.util.toQuotedString(X)+", validate.root.schema);";return Q}});var N9=n((dX,F9)=>{F9.exports=function f(v,h,J){var Q=" ",W=v.level,X=v.dataLevel,Y=v.schema[h],B=v.schemaPath+v.util.getProperty(h),q=v.errSchemaPath+"/"+h,D=!v.opts.allErrors,j="data"+(X||""),L="valid"+W,G=v.opts.$data&&Y&&Y.$data,O;if(G)Q+=" var schema"+W+" = "+v.util.getData(Y.$data,X,v.dataPathArr)+"; ",O="schema"+W;else O=Y;if(!G)Q+=" var schema"+W+" = validate.schema"+B+";";Q+="var "+L+" = equal("+j+", schema"+W+"); if (!"+L+") { ";var M=M||[];if(M.push(Q),Q="",v.createErrors!==!1){if(Q+=" { keyword: 'const' , dataPath: (dataPath || '') + "+v.errorPath+" , schemaPath: "+v.util.toQuotedString(q)+" , params: { allowedValue: schema"+W+" } ",v.opts.messages!==!1)Q+=" , message: 'should be equal to constant' ";if(v.opts.verbose)Q+=" , schema: validate.schema"+B+" , parentSchema: validate.schema"+v.schemaPath+" , data: "+j+" ";Q+=" } "}else Q+=" {} ";var K=Q;if(Q=M.pop(),!v.compositeRule&&D)if(v.async)Q+=" throw new ValidationError(["+K+"]); ";else Q+=" validate.errors = ["+K+"]; return false; ";else Q+=" var err = "+K+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";if(Q+=" }",D)Q+=" else { ";return Q}});var z9=n((tX,U9)=>{U9.exports=function f(v,h,J){var Q=" ",W=v.level,X=v.dataLevel,Y=v.schema[h],B=v.schemaPath+v.util.getProperty(h),q=v.errSchemaPath+"/"+h,D=!v.opts.allErrors,j="data"+(X||""),L="valid"+W,G="errs__"+W,O=v.util.copy(v),M="";O.level++;var K="valid"+O.level,F="i"+W,S=O.dataLevel=v.dataLevel+1,N="data"+S,A=v.baseId,b=v.opts.strictKeywords?typeof Y=="object"&&Object.keys(Y).length>0||Y===!1:v.util.schemaHasRules(Y,v.RULES.all);if(Q+="var "+G+" = errors;var "+L+";",b){var k=v.compositeRule;v.compositeRule=O.compositeRule=!0,O.schema=Y,O.schemaPath=B,O.errSchemaPath=q,Q+=" var "+K+" = false; for (var "+F+" = 0; "+F+" < "+j+".length; "+F+"++) { ",O.errorPath=v.util.getPathExpr(v.errorPath,F,v.opts.jsonPointers,!0);var m=j+"["+F+"]";O.dataPathArr[S]=F;var Z=v.validate(O);if(O.baseId=A,v.util.varOccurences(Z,N)<2)Q+=" "+v.util.varReplace(Z,N,m)+" ";else Q+=" var "+N+" = "+m+"; "+Z+" ";Q+=" if ("+K+") break; } ",v.compositeRule=O.compositeRule=k,Q+=" "+M+" if (!"+K+") {"}else Q+=" if ("+j+".length == 0) {";var _=_||[];if(_.push(Q),Q="",v.createErrors!==!1){if(Q+=" { keyword: 'contains' , dataPath: (dataPath || '') + "+v.errorPath+" , schemaPath: "+v.util.toQuotedString(q)+" , params: {} ",v.opts.messages!==!1)Q+=" , message: 'should contain a valid item' ";if(v.opts.verbose)Q+=" , schema: validate.schema"+B+" , parentSchema: validate.schema"+v.schemaPath+" , data: "+j+" ";Q+=" } "}else Q+=" {} ";var r=Q;if(Q=_.pop(),!v.compositeRule&&D)if(v.async)Q+=" throw new ValidationError(["+r+"]); ";else Q+=" validate.errors = ["+r+"]; return false; ";else Q+=" var err = "+r+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";if(Q+=" } else { ",b)Q+=" errors = "+G+"; if (vErrors !== null) { if ("+G+") vErrors.length = "+G+"; else vErrors = null; } ";if(v.opts.allErrors)Q+=" } ";return Q}});var S9=n((sX,A9)=>{A9.exports=function f(v,h,J){var Q=" ",W=v.level,X=v.dataLevel,Y=v.schema[h],B=v.schemaPath+v.util.getProperty(h),q=v.errSchemaPath+"/"+h,D=!v.opts.allErrors,j="data"+(X||""),L="errs__"+W,G=v.util.copy(v),O="";G.level++;var M="valid"+G.level,K={},F={},S=v.opts.ownProperties;for(k in Y){if(k=="__proto__")continue;var N=Y[k],A=Array.isArray(N)?F:K;A[k]=N}Q+="var "+L+" = errors;";var b=v.errorPath;Q+="var missing"+W+";";for(var k in F)if(A=F[k],A.length){if(Q+=" if ( "+j+v.util.getProperty(k)+" !== undefined ",S)Q+=" && Object.prototype.hasOwnProperty.call("+j+", '"+v.util.escapeQuotes(k)+"') ";if(D){Q+=" && ( ";var m=A;if(m){var Z,_=-1,r=m.length-1;while(_<r){if(Z=m[_+=1],_)Q+=" || ";var x=v.util.getProperty(Z),C=j+x;if(Q+=" ( ( "+C+" === undefined ",S)Q+=" || ! Object.prototype.hasOwnProperty.call("+j+", '"+v.util.escapeQuotes(Z)+"') ";Q+=") && (missing"+W+" = "+v.util.toQuotedString(v.opts.jsonPointers?Z:x)+") ) "}}Q+=")) { ";var R="missing"+W,l="' + "+R+" + '";if(v.opts._errorDataPathProperty)v.errorPath=v.opts.jsonPointers?v.util.getPathExpr(b,R,!0):b+" + "+R;var T=T||[];if(T.push(Q),Q="",v.createErrors!==!1){if(Q+=" { keyword: 'dependencies' , dataPath: (dataPath || '') + "+v.errorPath+" , schemaPath: "+v.util.toQuotedString(q)+" , params: { property: '"+v.util.escapeQuotes(k)+"', missingProperty: '"+l+"', depsCount: "+A.length+", deps: '"+v.util.escapeQuotes(A.length==1?A[0]:A.join(", "))+"' } ",v.opts.messages!==!1){if(Q+=" , message: 'should have ",A.length==1)Q+="property "+v.util.escapeQuotes(A[0]);else Q+="properties "+v.util.escapeQuotes(A.join(", "));Q+=" when property "+v.util.escapeQuotes(k)+" is present' "}if(v.opts.verbose)Q+=" , schema: validate.schema"+B+" , parentSchema: validate.schema"+v.schemaPath+" , data: "+j+" ";Q+=" } "}else Q+=" {} ";var Bv=Q;if(Q=T.pop(),!v.compositeRule&&D)if(v.async)Q+=" throw new ValidationError(["+Bv+"]); ";else Q+=" validate.errors = ["+Bv+"]; return false; ";else Q+=" var err = "+Bv+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "}else{Q+=" ) { ";var e=A;if(e){var Z,fv=-1,o=e.length-1;while(fv<o){Z=e[fv+=1];var x=v.util.getProperty(Z),l=v.util.escapeQuotes(Z),C=j+x;if(v.opts._errorDataPathProperty)v.errorPath=v.util.getPath(b,Z,v.opts.jsonPointers);if(Q+=" if ( "+C+" === undefined ",S)Q+=" || ! Object.prototype.hasOwnProperty.call("+j+", '"+v.util.escapeQuotes(Z)+"') ";if(Q+=") { var err = ",v.createErrors!==!1){if(Q+=" { keyword: 'dependencies' , dataPath: (dataPath || '') + "+v.errorPath+" , schemaPath: "+v.util.toQuotedString(q)+" , params: { property: '"+v.util.escapeQuotes(k)+"', missingProperty: '"+l+"', depsCount: "+A.length+", deps: '"+v.util.escapeQuotes(A.length==1?A[0]:A.join(", "))+"' } ",v.opts.messages!==!1){if(Q+=" , message: 'should have ",A.length==1)Q+="property "+v.util.escapeQuotes(A[0]);else Q+="properties "+v.util.escapeQuotes(A.join(", "));Q+=" when property "+v.util.escapeQuotes(k)+" is present' "}if(v.opts.verbose)Q+=" , schema: validate.schema"+B+" , parentSchema: validate.schema"+v.schemaPath+" , data: "+j+" ";Q+=" } "}else Q+=" {} ";Q+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } "}}}if(Q+=" } ",D)O+="}",Q+=" else { "}v.errorPath=b;var a=G.baseId;for(var k in K){var N=K[k];if(v.opts.strictKeywords?typeof N=="object"&&Object.keys(N).length>0||N===!1:v.util.schemaHasRules(N,v.RULES.all)){if(Q+=" "+M+" = true; if ( "+j+v.util.getProperty(k)+" !== undefined ",S)Q+=" && Object.prototype.hasOwnProperty.call("+j+", '"+v.util.escapeQuotes(k)+"') ";if(Q+=") { ",G.schema=N,G.schemaPath=B+v.util.getProperty(k),G.errSchemaPath=q+"/"+v.util.escapeFragment(k),Q+=" "+v.validate(G)+" ",G.baseId=a,Q+=" } ",D)Q+=" if ("+M+") { ",O+="}"}}if(D)Q+=" "+O+" if ("+L+" == errors) {";return Q}});var R9=n((oX,b9)=>{b9.exports=function f(v,h,J){var Q=" ",W=v.level,X=v.dataLevel,Y=v.schema[h],B=v.schemaPath+v.util.getProperty(h),q=v.errSchemaPath+"/"+h,D=!v.opts.allErrors,j="data"+(X||""),L="valid"+W,G=v.opts.$data&&Y&&Y.$data,O;if(G)Q+=" var schema"+W+" = "+v.util.getData(Y.$data,X,v.dataPathArr)+"; ",O="schema"+W;else O=Y;var M="i"+W,K="schema"+W;if(!G)Q+=" var "+K+" = validate.schema"+B+";";if(Q+="var "+L+";",G)Q+=" if (schema"+W+" === undefined) "+L+" = true; else if (!Array.isArray(schema"+W+")) "+L+" = false; else {";if(Q+=""+L+" = false;for (var "+M+"=0; "+M+"<"+K+".length; "+M+"++) if (equal("+j+", "+K+"["+M+"])) { "+L+" = true; break; }",G)Q+=" } ";Q+=" if (!"+L+") { ";var F=F||[];if(F.push(Q),Q="",v.createErrors!==!1){if(Q+=" { keyword: 'enum' , dataPath: (dataPath || '') + "+v.errorPath+" , schemaPath: "+v.util.toQuotedString(q)+" , params: { allowedValues: schema"+W+" } ",v.opts.messages!==!1)Q+=" , message: 'should be equal to one of the allowed values' ";if(v.opts.verbose)Q+=" , schema: validate.schema"+B+" , parentSchema: validate.schema"+v.schemaPath+" , data: "+j+" ";Q+=" } "}else Q+=" {} ";var S=Q;if(Q=F.pop(),!v.compositeRule&&D)if(v.async)Q+=" throw new ValidationError(["+S+"]); ";else Q+=" validate.errors = ["+S+"]; return false; ";else Q+=" var err = "+S+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";if(Q+=" }",D)Q+=" else { ";return Q}});var l9=n((eX,_9)=>{_9.exports=function f(v,h,J){var Q=" ",W=v.level,X=v.dataLevel,Y=v.schema[h],B=v.schemaPath+v.util.getProperty(h),q=v.errSchemaPath+"/"+h,D=!v.opts.allErrors,j="data"+(X||"");if(v.opts.format===!1){if(D)Q+=" if (true) { ";return Q}var L=v.opts.$data&&Y&&Y.$data,G;if(L)Q+=" var schema"+W+" = "+v.util.getData(Y.$data,X,v.dataPathArr)+"; ",G="schema"+W;else G=Y;var O=v.opts.unknownFormats,M=Array.isArray(O);if(L){var K="format"+W,F="isObject"+W,S="formatType"+W;if(Q+=" var "+K+" = formats["+G+"]; var "+F+" = typeof "+K+" == 'object' && !("+K+" instanceof RegExp) && "+K+".validate; var "+S+" = "+F+" && "+K+".type || 'string'; if ("+F+") { ",v.async)Q+=" var async"+W+" = "+K+".async; ";if(Q+=" "+K+" = "+K+".validate; } if ( ",L)Q+=" ("+G+" !== undefined && typeof "+G+" != 'string') || ";if(Q+=" (",O!="ignore"){if(Q+=" ("+G+" && !"+K+" ",M)Q+=" && self._opts.unknownFormats.indexOf("+G+") == -1 ";Q+=") || "}if(Q+=" ("+K+" && "+S+" == '"+J+"' && !(typeof "+K+" == 'function' ? ",v.async)Q+=" (async"+W+" ? await "+K+"("+j+") : "+K+"("+j+")) ";else Q+=" "+K+"("+j+") ";Q+=" : "+K+".test("+j+"))))) {"}else{var K=v.formats[Y];if(!K)if(O=="ignore"){if(v.logger.warn('unknown format "'+Y+'" ignored in schema at path "'+v.errSchemaPath+'"'),D)Q+=" if (true) { ";return Q}else if(M&&O.indexOf(Y)>=0){if(D)Q+=" if (true) { ";return Q}else throw new Error('unknown format "'+Y+'" is used in schema at path "'+v.errSchemaPath+'"');var F=typeof K=="object"&&!(K instanceof RegExp)&&K.validate,S=F&&K.type||"string";if(F){var N=K.async===!0;K=K.validate}if(S!=J){if(D)Q+=" if (true) { ";return Q}if(N){if(!v.async)throw new Error("async format in sync schema");var A="formats"+v.util.getProperty(Y)+".validate";Q+=" if (!(await "+A+"("+j+"))) { "}else{Q+=" if (! ";var A="formats"+v.util.getProperty(Y);if(F)A+=".validate";if(typeof K=="function")Q+=" "+A+"("+j+") ";else Q+=" "+A+".test("+j+") ";Q+=") { "}}var b=b||[];if(b.push(Q),Q="",v.createErrors!==!1){if(Q+=" { keyword: 'format' , dataPath: (dataPath || '') + "+v.errorPath+" , schemaPath: "+v.util.toQuotedString(q)+" , params: { format: ",L)Q+=""+G;else Q+=""+v.util.toQuotedString(Y);if(Q+=" } ",v.opts.messages!==!1){if(Q+=` , message: 'should match format "`,L)Q+="' + "+G+" + '";else Q+=""+v.util.escapeQuotes(Y);Q+=`"' `}if(v.opts.verbose){if(Q+=" , schema: ",L)Q+="validate.schema"+B;else Q+=""+v.util.toQuotedString(Y);Q+=" , parentSchema: validate.schema"+v.schemaPath+" , data: "+j+" "}Q+=" } "}else Q+=" {} ";var k=Q;if(Q=b.pop(),!v.compositeRule&&D)if(v.async)Q+=" throw new ValidationError(["+k+"]); ";else Q+=" validate.errors = ["+k+"]; return false; ";else Q+=" var err = "+k+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";if(Q+=" } ",D)Q+=" else { ";return Q}});var g9=n((vY,k9)=>{k9.exports=function f(v,h,J){var Q=" ",W=v.level,X=v.dataLevel,Y=v.schema[h],B=v.schemaPath+v.util.getProperty(h),q=v.errSchemaPath+"/"+h,D=!v.opts.allErrors,j="data"+(X||""),L="valid"+W,G="errs__"+W,O=v.util.copy(v);O.level++;var M="valid"+O.level,K=v.schema.then,F=v.schema.else,S=K!==void 0&&(v.opts.strictKeywords?typeof K=="object"&&Object.keys(K).length>0||K===!1:v.util.schemaHasRules(K,v.RULES.all)),N=F!==void 0&&(v.opts.strictKeywords?typeof F=="object"&&Object.keys(F).length>0||F===!1:v.util.schemaHasRules(F,v.RULES.all)),A=O.baseId;if(S||N){var b;O.createErrors=!1,O.schema=Y,O.schemaPath=B,O.errSchemaPath=q,Q+=" var "+G+" = errors; var "+L+" = true; ";var k=v.compositeRule;if(v.compositeRule=O.compositeRule=!0,Q+=" "+v.validate(O)+" ",O.baseId=A,O.createErrors=!0,Q+=" errors = "+G+"; if (vErrors !== null) { if ("+G+") vErrors.length = "+G+"; else vErrors = null; } ",v.compositeRule=O.compositeRule=k,S){if(Q+=" if ("+M+") { ",O.schema=v.schema.then,O.schemaPath=v.schemaPath+".then",O.errSchemaPath=v.errSchemaPath+"/then",Q+=" "+v.validate(O)+" ",O.baseId=A,Q+=" "+L+" = "+M+"; ",S&&N)b="ifClause"+W,Q+=" var "+b+" = 'then'; ";else b="'then'";if(Q+=" } ",N)Q+=" else { "}else Q+=" if (!"+M+") { ";if(N){if(O.schema=v.schema.else,O.schemaPath=v.schemaPath+".else",O.errSchemaPath=v.errSchemaPath+"/else",Q+=" "+v.validate(O)+" ",O.baseId=A,Q+=" "+L+" = "+M+"; ",S&&N)b="ifClause"+W,Q+=" var "+b+" = 'else'; ";else b="'else'";Q+=" } "}if(Q+=" if (!"+L+") { var err = ",v.createErrors!==!1){if(Q+=" { keyword: 'if' , dataPath: (dataPath || '') + "+v.errorPath+" , schemaPath: "+v.util.toQuotedString(q)+" , params: { failingKeyword: "+b+" } ",v.opts.messages!==!1)Q+=` , message: 'should match "' + `+b+` + '" schema' `;if(v.opts.verbose)Q+=" , schema: validate.schema"+B+" , parentSchema: validate.schema"+v.schemaPath+" , data: "+j+" ";Q+=" } "}else Q+=" {} ";if(Q+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!v.compositeRule&&D)if(v.async)Q+=" throw new ValidationError(vErrors); ";else Q+=" validate.errors = vErrors; return false; ";if(Q+=" } ",D)Q+=" else { "}else if(D)Q+=" if (true) { ";return Q}});var I9=n((fY,y9)=>{y9.exports=function f(v,h,J){var Q=" ",W=v.level,X=v.dataLevel,Y=v.schema[h],B=v.schemaPath+v.util.getProperty(h),q=v.errSchemaPath+"/"+h,D=!v.opts.allErrors,j="data"+(X||""),L="valid"+W,G="errs__"+W,O=v.util.copy(v),M="";O.level++;var K="valid"+O.level,F="i"+W,S=O.dataLevel=v.dataLevel+1,N="data"+S,A=v.baseId;if(Q+="var "+G+" = errors;var "+L+";",Array.isArray(Y)){var b=v.schema.additionalItems;if(b===!1){Q+=" "+L+" = "+j+".length <= "+Y.length+"; ";var k=q;q=v.errSchemaPath+"/additionalItems",Q+=" if (!"+L+") { ";var m=m||[];if(m.push(Q),Q="",v.createErrors!==!1){if(Q+=" { keyword: 'additionalItems' , dataPath: (dataPath || '') + "+v.errorPath+" , schemaPath: "+v.util.toQuotedString(q)+" , params: { limit: "+Y.length+" } ",v.opts.messages!==!1)Q+=" , message: 'should NOT have more than "+Y.length+" items' ";if(v.opts.verbose)Q+=" , schema: false , parentSchema: validate.schema"+v.schemaPath+" , data: "+j+" ";Q+=" } "}else Q+=" {} ";var Z=Q;if(Q=m.pop(),!v.compositeRule&&D)if(v.async)Q+=" throw new ValidationError(["+Z+"]); ";else Q+=" validate.errors = ["+Z+"]; return false; ";else Q+=" var err = "+Z+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";if(Q+=" } ",q=k,D)M+="}",Q+=" else { "}var _=Y;if(_){var r,x=-1,C=_.length-1;while(x<C)if(r=_[x+=1],v.opts.strictKeywords?typeof r=="object"&&Object.keys(r).length>0||r===!1:v.util.schemaHasRules(r,v.RULES.all)){Q+=" "+K+" = true; if ("+j+".length > "+x+") { ";var R=j+"["+x+"]";O.schema=r,O.schemaPath=B+"["+x+"]",O.errSchemaPath=q+"/"+x,O.errorPath=v.util.getPathExpr(v.errorPath,x,v.opts.jsonPointers,!0),O.dataPathArr[S]=x;var l=v.validate(O);if(O.baseId=A,v.util.varOccurences(l,N)<2)Q+=" "+v.util.varReplace(l,N,R)+" ";else Q+=" var "+N+" = "+R+"; "+l+" ";if(Q+=" } ",D)Q+=" if ("+K+") { ",M+="}"}}if(typeof b=="object"&&(v.opts.strictKeywords?typeof b=="object"&&Object.keys(b).length>0||b===!1:v.util.schemaHasRules(b,v.RULES.all))){O.schema=b,O.schemaPath=v.schemaPath+".additionalItems",O.errSchemaPath=v.errSchemaPath+"/additionalItems",Q+=" "+K+" = true; if ("+j+".length > "+Y.length+") { for (var "+F+" = "+Y.length+"; "+F+" < "+j+".length; "+F+"++) { ",O.errorPath=v.util.getPathExpr(v.errorPath,F,v.opts.jsonPointers,!0);var R=j+"["+F+"]";O.dataPathArr[S]=F;var l=v.validate(O);if(O.baseId=A,v.util.varOccurences(l,N)<2)Q+=" "+v.util.varReplace(l,N,R)+" ";else Q+=" var "+N+" = "+R+"; "+l+" ";if(D)Q+=" if (!"+K+") break; ";if(Q+=" } } ",D)Q+=" if ("+K+") { ",M+="}"}}else if(v.opts.strictKeywords?typeof Y=="object"&&Object.keys(Y).length>0||Y===!1:v.util.schemaHasRules(Y,v.RULES.all)){O.schema=Y,O.schemaPath=B,O.errSchemaPath=q,Q+=" for (var "+F+" = 0; "+F+" < "+j+".length; "+F+"++) { ",O.errorPath=v.util.getPathExpr(v.errorPath,F,v.opts.jsonPointers,!0);var R=j+"["+F+"]";O.dataPathArr[S]=F;var l=v.validate(O);if(O.baseId=A,v.util.varOccurences(l,N)<2)Q+=" "+v.util.varReplace(l,N,R)+" ";else Q+=" var "+N+" = "+R+"; "+l+" ";if(D)Q+=" if (!"+K+") break; ";Q+=" }"}if(D)Q+=" "+M+" if ("+G+" == errors) {";return Q}});var $Q=n((QY,C9)=>{C9.exports=function f(v,h,J){var Q=" ",W=v.level,X=v.dataLevel,Y=v.schema[h],B=v.schemaPath+v.util.getProperty(h),q=v.errSchemaPath+"/"+h,D=!v.opts.allErrors,A,j="data"+(X||""),L=v.opts.$data&&Y&&Y.$data,G;if(L)Q+=" var schema"+W+" = "+v.util.getData(Y.$data,X,v.dataPathArr)+"; ",G="schema"+W;else G=Y;var O=h=="maximum",M=O?"exclusiveMaximum":"exclusiveMinimum",K=v.schema[M],F=v.opts.$data&&K&&K.$data,S=O?"<":">",N=O?">":"<",A=void 0;if(!(L||typeof Y=="number"||Y===void 0))throw new Error(h+" must be number");if(!(F||K===void 0||typeof K=="number"||typeof K=="boolean"))throw new Error(M+" must be number or boolean");if(F){var b=v.util.getData(K.$data,X,v.dataPathArr),k="exclusive"+W,m="exclType"+W,Z="exclIsNumber"+W,_="op"+W,r="' + "+_+" + '";Q+=" var schemaExcl"+W+" = "+b+"; ",b="schemaExcl"+W,Q+=" var "+k+"; var "+m+" = typeof "+b+"; if ("+m+" != 'boolean' && "+m+" != 'undefined' && "+m+" != 'number') { ";var A=M,x=x||[];if(x.push(Q),Q="",v.createErrors!==!1){if(Q+=" { keyword: '"+(A||"_exclusiveLimit")+"' , dataPath: (dataPath || '') + "+v.errorPath+" , schemaPath: "+v.util.toQuotedString(q)+" , params: {} ",v.opts.messages!==!1)Q+=" , message: '"+M+" should be boolean' ";if(v.opts.verbose)Q+=" , schema: validate.schema"+B+" , parentSchema: validate.schema"+v.schemaPath+" , data: "+j+" ";Q+=" } "}else Q+=" {} ";var C=Q;if(Q=x.pop(),!v.compositeRule&&D)if(v.async)Q+=" throw new ValidationError(["+C+"]); ";else Q+=" validate.errors = ["+C+"]; return false; ";else Q+=" var err = "+C+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";if(Q+=" } else if ( ",L)Q+=" ("+G+" !== undefined && typeof "+G+" != 'number') || ";if(Q+=" "+m+" == 'number' ? ( ("+k+" = "+G+" === undefined || "+b+" "+S+"= "+G+") ? "+j+" "+N+"= "+b+" : "+j+" "+N+" "+G+" ) : ( ("+k+" = "+b+" === true) ? "+j+" "+N+"= "+G+" : "+j+" "+N+" "+G+" ) || "+j+" !== "+j+") { var op"+W+" = "+k+" ? '"+S+"' : '"+S+"='; ",Y===void 0)A=M,q=v.errSchemaPath+"/"+M,G=b,L=F}else{var Z=typeof K=="number",r=S;if(Z&&L){var _="'"+r+"'";if(Q+=" if ( ",L)Q+=" ("+G+" !== undefined && typeof "+G+" != 'number') || ";Q+=" ( "+G+" === undefined || "+K+" "+S+"= "+G+" ? "+j+" "+N+"= "+K+" : "+j+" "+N+" "+G+" ) || "+j+" !== "+j+") { "}else{if(Z&&Y===void 0)k=!0,A=M,q=v.errSchemaPath+"/"+M,G=K,N+="=";else{if(Z)G=Math[O?"min":"max"](K,Y);if(K===(Z?G:!0))k=!0,A=M,q=v.errSchemaPath+"/"+M,N+="=";else k=!1,r+="="}var _="'"+r+"'";if(Q+=" if ( ",L)Q+=" ("+G+" !== undefined && typeof "+G+" != 'number') || ";Q+=" "+j+" "+N+" "+G+" || "+j+" !== "+j+") { "}}A=A||h;var x=x||[];if(x.push(Q),Q="",v.createErrors!==!1){if(Q+=" { keyword: '"+(A||"_limit")+"' , dataPath: (dataPath || '') + "+v.errorPath+" , schemaPath: "+v.util.toQuotedString(q)+" , params: { comparison: "+_+", limit: "+G+", exclusive: "+k+" } ",v.opts.messages!==!1)if(Q+=" , message: 'should be "+r+" ",L)Q+="' + "+G;else Q+=""+G+"'";if(v.opts.verbose){if(Q+=" , schema: ",L)Q+="validate.schema"+B;else Q+=""+Y;Q+=" , parentSchema: validate.schema"+v.schemaPath+" , data: "+j+" "}Q+=" } "}else Q+=" {} ";var C=Q;if(Q=x.pop(),!v.compositeRule&&D)if(v.async)Q+=" throw new ValidationError(["+C+"]); ";else Q+=" validate.errors = ["+C+"]; return false; ";else Q+=" var err = "+C+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";if(Q+=" } ",D)Q+=" else { ";return Q}});var jQ=n((hY,T9)=>{T9.exports=function f(v,h,J){var Q=" ",W=v.level,X=v.dataLevel,Y=v.schema[h],B=v.schemaPath+v.util.getProperty(h),q=v.errSchemaPath+"/"+h,D=!v.opts.allErrors,M,j="data"+(X||""),L=v.opts.$data&&Y&&Y.$data,G;if(L)Q+=" var schema"+W+" = "+v.util.getData(Y.$data,X,v.dataPathArr)+"; ",G="schema"+W;else G=Y;if(!(L||typeof Y=="number"))throw new Error(h+" must be number");var O=h=="maxItems"?">":"<";if(Q+="if ( ",L)Q+=" ("+G+" !== undefined && typeof "+G+" != 'number') || ";Q+=" "+j+".length "+O+" "+G+") { ";var M=h,K=K||[];if(K.push(Q),Q="",v.createErrors!==!1){if(Q+=" { keyword: '"+(M||"_limitItems")+"' , dataPath: (dataPath || '') + "+v.errorPath+" , schemaPath: "+v.util.toQuotedString(q)+" , params: { limit: "+G+" } ",v.opts.messages!==!1){if(Q+=" , message: 'should NOT have ",h=="maxItems")Q+="more";else Q+="fewer";if(Q+=" than ",L)Q+="' + "+G+" + '";else Q+=""+Y;Q+=" items' "}if(v.opts.verbose){if(Q+=" , schema: ",L)Q+="validate.schema"+B;else Q+=""+Y;Q+=" , parentSchema: validate.schema"+v.schemaPath+" , data: "+j+" "}Q+=" } "}else Q+=" {} ";var F=Q;if(Q=K.pop(),!v.compositeRule&&D)if(v.async)Q+=" throw new ValidationError(["+F+"]); ";else Q+=" validate.errors = ["+F+"]; return false; ";else Q+=" var err = "+F+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";if(Q+="} ",D)Q+=" else { ";return Q}});var LQ=n((JY,x9)=>{x9.exports=function f(v,h,J){var Q=" ",W=v.level,X=v.dataLevel,Y=v.schema[h],B=v.schemaPath+v.util.getProperty(h),q=v.errSchemaPath+"/"+h,D=!v.opts.allErrors,M,j="data"+(X||""),L=v.opts.$data&&Y&&Y.$data,G;if(L)Q+=" var schema"+W+" = "+v.util.getData(Y.$data,X,v.dataPathArr)+"; ",G="schema"+W;else G=Y;if(!(L||typeof Y=="number"))throw new Error(h+" must be number");var O=h=="maxLength"?">":"<";if(Q+="if ( ",L)Q+=" ("+G+" !== undefined && typeof "+G+" != 'number') || ";if(v.opts.unicode===!1)Q+=" "+j+".length ";else Q+=" ucs2length("+j+") ";Q+=" "+O+" "+G+") { ";var M=h,K=K||[];if(K.push(Q),Q="",v.createErrors!==!1){if(Q+=" { keyword: '"+(M||"_limitLength")+"' , dataPath: (dataPath || '') + "+v.errorPath+" , schemaPath: "+v.util.toQuotedString(q)+" , params: { limit: "+G+" } ",v.opts.messages!==!1){if(Q+=" , message: 'should NOT be ",h=="maxLength")Q+="longer";else Q+="shorter";if(Q+=" than ",L)Q+="' + "+G+" + '";else Q+=""+Y;Q+=" characters' "}if(v.opts.verbose){if(Q+=" , schema: ",L)Q+="validate.schema"+B;else Q+=""+Y;Q+=" , parentSchema: validate.schema"+v.schemaPath+" , data: "+j+" "}Q+=" } "}else Q+=" {} ";var F=Q;if(Q=K.pop(),!v.compositeRule&&D)if(v.async)Q+=" throw new ValidationError(["+F+"]); ";else Q+=" validate.errors = ["+F+"]; return false; ";else Q+=" var err = "+F+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";if(Q+="} ",D)Q+=" else { ";return Q}});var MQ=n((WY,Z9)=>{Z9.exports=function f(v,h,J){var Q=" ",W=v.level,X=v.dataLevel,Y=v.schema[h],B=v.schemaPath+v.util.getProperty(h),q=v.errSchemaPath+"/"+h,D=!v.opts.allErrors,M,j="data"+(X||""),L=v.opts.$data&&Y&&Y.$data,G;if(L)Q+=" var schema"+W+" = "+v.util.getData(Y.$data,X,v.dataPathArr)+"; ",G="schema"+W;else G=Y;if(!(L||typeof Y=="number"))throw new Error(h+" must be number");var O=h=="maxProperties"?">":"<";if(Q+="if ( ",L)Q+=" ("+G+" !== undefined && typeof "+G+" != 'number') || ";Q+=" Object.keys("+j+").length "+O+" "+G+") { ";var M=h,K=K||[];if(K.push(Q),Q="",v.createErrors!==!1){if(Q+=" { keyword: '"+(M||"_limitProperties")+"' , dataPath: (dataPath || '') + "+v.errorPath+" , schemaPath: "+v.util.toQuotedString(q)+" , params: { limit: "+G+" } ",v.opts.messages!==!1){if(Q+=" , message: 'should NOT have ",h=="maxProperties")Q+="more";else Q+="fewer";if(Q+=" than ",L)Q+="' + "+G+" + '";else Q+=""+Y;Q+=" properties' "}if(v.opts.verbose){if(Q+=" , schema: ",L)Q+="validate.schema"+B;else Q+=""+Y;Q+=" , parentSchema: validate.schema"+v.schemaPath+" , data: "+j+" "}Q+=" } "}else Q+=" {} ";var F=Q;if(Q=K.pop(),!v.compositeRule&&D)if(v.async)Q+=" throw new ValidationError(["+F+"]); ";else Q+=" validate.errors = ["+F+"]; return false; ";else Q+=" var err = "+F+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";if(Q+="} ",D)Q+=" else { ";return Q}});var u9=n((PY,r9)=>{r9.exports=function f(v,h,J){var Q=" ",W=v.level,X=v.dataLevel,Y=v.schema[h],B=v.schemaPath+v.util.getProperty(h),q=v.errSchemaPath+"/"+h,D=!v.opts.allErrors,j="data"+(X||""),L=v.opts.$data&&Y&&Y.$data,G;if(L)Q+=" var schema"+W+" = "+v.util.getData(Y.$data,X,v.dataPathArr)+"; ",G="schema"+W;else G=Y;if(!(L||typeof Y=="number"))throw new Error(h+" must be number");if(Q+="var division"+W+";if (",L)Q+=" "+G+" !== undefined && ( typeof "+G+" != 'number' || ";if(Q+=" (division"+W+" = "+j+" / "+G+", ",v.opts.multipleOfPrecision)Q+=" Math.abs(Math.round(division"+W+") - division"+W+") > 1e-"+v.opts.multipleOfPrecision+" ";else Q+=" division"+W+" !== parseInt(division"+W+") ";if(Q+=" ) ",L)Q+=" ) ";Q+=" ) { ";var O=O||[];if(O.push(Q),Q="",v.createErrors!==!1){if(Q+=" { keyword: 'multipleOf' , dataPath: (dataPath || '') + "+v.errorPath+" , schemaPath: "+v.util.toQuotedString(q)+" , params: { multipleOf: "+G+" } ",v.opts.messages!==!1)if(Q+=" , message: 'should be multiple of ",L)Q+="' + "+G;else Q+=""+G+"'";if(v.opts.verbose){if(Q+=" , schema: ",L)Q+="validate.schema"+B;else Q+=""+Y;Q+=" , parentSchema: validate.schema"+v.schemaPath+" , data: "+j+" "}Q+=" } "}else Q+=" {} ";var M=Q;if(Q=O.pop(),!v.compositeRule&&D)if(v.async)Q+=" throw new ValidationError(["+M+"]); ";else Q+=" validate.errors = ["+M+"]; return false; ";else Q+=" var err = "+M+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";if(Q+="} ",D)Q+=" else { ";return Q}});var a9=n((XY,m9)=>{m9.exports=function f(v,h,J){var Q=" ",W=v.level,X=v.dataLevel,Y=v.schema[h],B=v.schemaPath+v.util.getProperty(h),q=v.errSchemaPath+"/"+h,D=!v.opts.allErrors,j="data"+(X||""),L="errs__"+W,G=v.util.copy(v);G.level++;var O="valid"+G.level;if(v.opts.strictKeywords?typeof Y=="object"&&Object.keys(Y).length>0||Y===!1:v.util.schemaHasRules(Y,v.RULES.all)){G.schema=Y,G.schemaPath=B,G.errSchemaPath=q,Q+=" var "+L+" = errors; ";var M=v.compositeRule;v.compositeRule=G.compositeRule=!0,G.createErrors=!1;var K;if(G.opts.allErrors)K=G.opts.allErrors,G.opts.allErrors=!1;if(Q+=" "+v.validate(G)+" ",G.createErrors=!0,K)G.opts.allErrors=K;v.compositeRule=G.compositeRule=M,Q+=" if ("+O+") { ";var F=F||[];if(F.push(Q),Q="",v.createErrors!==!1){if(Q+=" { keyword: 'not' , dataPath: (dataPath || '') + "+v.errorPath+" , schemaPath: "+v.util.toQuotedString(q)+" , params: {} ",v.opts.messages!==!1)Q+=" , message: 'should NOT be valid' ";if(v.opts.verbose)Q+=" , schema: validate.schema"+B+" , parentSchema: validate.schema"+v.schemaPath+" , data: "+j+" ";Q+=" } "}else Q+=" {} ";var S=Q;if(Q=F.pop(),!v.compositeRule&&D)if(v.async)Q+=" throw new ValidationError(["+S+"]); ";else Q+=" validate.errors = ["+S+"]; return false; ";else Q+=" var err = "+S+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";if(Q+=" } else { errors = "+L+"; if (vErrors !== null) { if ("+L+") vErrors.length = "+L+"; else vErrors = null; } ",v.opts.allErrors)Q+=" } "}else{if(Q+=" var err = ",v.createErrors!==!1){if(Q+=" { keyword: 'not' , dataPath: (dataPath || '') + "+v.errorPath+" , schemaPath: "+v.util.toQuotedString(q)+" , params: {} ",v.opts.messages!==!1)Q+=" , message: 'should NOT be valid' ";if(v.opts.verbose)Q+=" , schema: validate.schema"+B+" , parentSchema: validate.schema"+v.schemaPath+" , data: "+j+" ";Q+=" } "}else Q+=" {} ";if(Q+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",D)Q+=" if (false) { "}return Q}});var p9=n((YY,c9)=>{c9.exports=function f(v,h,J){var Q=" ",W=v.level,X=v.dataLevel,Y=v.schema[h],B=v.schemaPath+v.util.getProperty(h),q=v.errSchemaPath+"/"+h,D=!v.opts.allErrors,j="data"+(X||""),L="valid"+W,G="errs__"+W,O=v.util.copy(v),M="";O.level++;var K="valid"+O.level,F=O.baseId,S="prevValid"+W,N="passingSchemas"+W;Q+="var "+G+" = errors , "+S+" = false , "+L+" = false , "+N+" = null; ";var A=v.compositeRule;v.compositeRule=O.compositeRule=!0;var b=Y;if(b){var k,m=-1,Z=b.length-1;while(m<Z){if(k=b[m+=1],v.opts.strictKeywords?typeof k=="object"&&Object.keys(k).length>0||k===!1:v.util.schemaHasRules(k,v.RULES.all))O.schema=k,O.schemaPath=B+"["+m+"]",O.errSchemaPath=q+"/"+m,Q+=" "+v.validate(O)+" ",O.baseId=F;else Q+=" var "+K+" = true; ";if(m)Q+=" if ("+K+" && "+S+") { "+L+" = false; "+N+" = ["+N+", "+m+"]; } else { ",M+="}";Q+=" if ("+K+") { "+L+" = "+S+" = true; "+N+" = "+m+"; }"}}if(v.compositeRule=O.compositeRule=A,Q+=""+M+"if (!"+L+") { var err = ",v.createErrors!==!1){if(Q+=" { keyword: 'oneOf' , dataPath: (dataPath || '') + "+v.errorPath+" , schemaPath: "+v.util.toQuotedString(q)+" , params: { passingSchemas: "+N+" } ",v.opts.messages!==!1)Q+=" , message: 'should match exactly one schema in oneOf' ";if(v.opts.verbose)Q+=" , schema: validate.schema"+B+" , parentSchema: validate.schema"+v.schemaPath+" , data: "+j+" ";Q+=" } "}else Q+=" {} ";if(Q+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!v.compositeRule&&D)if(v.async)Q+=" throw new ValidationError(vErrors); ";else Q+=" validate.errors = vErrors; return false; ";if(Q+="} else { errors = "+G+"; if (vErrors !== null) { if ("+G+") vErrors.length = "+G+"; else vErrors = null; }",v.opts.allErrors)Q+=" } ";return Q}});var i9=n((BY,n9)=>{n9.exports=function f(v,h,J){var Q=" ",W=v.level,X=v.dataLevel,Y=v.schema[h],B=v.schemaPath+v.util.getProperty(h),q=v.errSchemaPath+"/"+h,D=!v.opts.allErrors,j="data"+(X||""),L=v.opts.$data&&Y&&Y.$data,G;if(L)Q+=" var schema"+W+" = "+v.util.getData(Y.$data,X,v.dataPathArr)+"; ",G="schema"+W;else G=Y;var O=L?"(new RegExp("+G+"))":v.usePattern(Y);if(Q+="if ( ",L)Q+=" ("+G+" !== undefined && typeof "+G+" != 'string') || ";Q+=" !"+O+".test("+j+") ) { ";var M=M||[];if(M.push(Q),Q="",v.createErrors!==!1){if(Q+=" { keyword: 'pattern' , dataPath: (dataPath || '') + "+v.errorPath+" , schemaPath: "+v.util.toQuotedString(q)+" , params: { pattern: ",L)Q+=""+G;else Q+=""+v.util.toQuotedString(Y);if(Q+=" } ",v.opts.messages!==!1){if(Q+=` , message: 'should match pattern "`,L)Q+="' + "+G+" + '";else Q+=""+v.util.escapeQuotes(Y);Q+=`"' `}if(v.opts.verbose){if(Q+=" , schema: ",L)Q+="validate.schema"+B;else Q+=""+v.util.toQuotedString(Y);Q+=" , parentSchema: validate.schema"+v.schemaPath+" , data: "+j+" "}Q+=" } "}else Q+=" {} ";var K=Q;if(Q=M.pop(),!v.compositeRule&&D)if(v.async)Q+=" throw new ValidationError(["+K+"]); ";else Q+=" validate.errors = ["+K+"]; return false; ";else Q+=" var err = "+K+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";if(Q+="} ",D)Q+=" else { ";return Q}});var t9=n((GY,d9)=>{d9.exports=function f(v,h,J){var Q=" ",W=v.level,X=v.dataLevel,Y=v.schema[h],B=v.schemaPath+v.util.getProperty(h),q=v.errSchemaPath+"/"+h,D=!v.opts.allErrors,j="data"+(X||""),L="errs__"+W,G=v.util.copy(v),O="";G.level++;var M="valid"+G.level,K="key"+W,F="idx"+W,S=G.dataLevel=v.dataLevel+1,N="data"+S,A="dataProperties"+W,b=Object.keys(Y||{}).filter(fv),k=v.schema.patternProperties||{},m=Object.keys(k).filter(fv),Z=v.schema.additionalProperties,_=b.length||m.length,r=Z===!1,x=typeof Z=="object"&&Object.keys(Z).length,C=v.opts.removeAdditional,R=r||x||C,l=v.opts.ownProperties,T=v.baseId,Bv=v.schema.required;if(Bv&&!(v.opts.$data&&Bv.$data)&&Bv.length<v.opts.loopRequired)var e=v.util.toHash(Bv);function fv(ov){return ov!=="__proto__"}if(Q+="var "+L+" = errors;var "+M+" = true;",l)Q+=" var "+A+" = undefined;";if(R){if(l)Q+=" "+A+" = "+A+" || Object.keys("+j+"); for (var "+F+"=0; "+F+"<"+A+".length; "+F+"++) { var "+K+" = "+A+"["+F+"]; ";else Q+=" for (var "+K+" in "+j+") { ";if(_){if(Q+=" var isAdditional"+W+" = !(false ",b.length)if(b.length>8)Q+=" || validate.schema"+B+".hasOwnProperty("+K+") ";else{var o=b;if(o){var a,jv=-1,Sv=o.length-1;while(jv<Sv)a=o[jv+=1],Q+=" || "+K+" == "+v.util.toQuotedString(a)+" "}}if(m.length){var _v=m;if(_v){var Wv,Vv=-1,zv=_v.length-1;while(Vv<zv)Wv=_v[Vv+=1],Q+=" || "+v.usePattern(Wv)+".test("+K+") "}}Q+=" ); if (isAdditional"+W+") { "}if(C=="all")Q+=" delete "+j+"["+K+"]; ";else{var lv=v.errorPath,Lf="' + "+K+" + '";if(v.opts._errorDataPathProperty)v.errorPath=v.util.getPathExpr(v.errorPath,K,v.opts.jsonPointers);if(r)if(C)Q+=" delete "+j+"["+K+"]; ";else{Q+=" "+M+" = false; ";var Gf=q;q=v.errSchemaPath+"/additionalProperties";var Fv=Fv||[];if(Fv.push(Q),Q="",v.createErrors!==!1){if(Q+=" { keyword: 'additionalProperties' , dataPath: (dataPath || '') + "+v.errorPath+" , schemaPath: "+v.util.toQuotedString(q)+" , params: { additionalProperty: '"+Lf+"' } ",v.opts.messages!==!1){if(Q+=" , message: '",v.opts._errorDataPathProperty)Q+="is an invalid additional property";else Q+="should NOT have additional properties";Q+="' "}if(v.opts.verbose)Q+=" , schema: false , parentSchema: validate.schema"+v.schemaPath+" , data: "+j+" ";Q+=" } "}else Q+=" {} ";var Lv=Q;if(Q=Fv.pop(),!v.compositeRule&&D)if(v.async)Q+=" throw new ValidationError(["+Lv+"]); ";else Q+=" validate.errors = ["+Lv+"]; return false; ";else Q+=" var err = "+Lv+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";if(q=Gf,D)Q+=" break; "}else if(x)if(C=="failing"){Q+=" var "+L+" = errors; ";var Sf=v.compositeRule;v.compositeRule=G.compositeRule=!0,G.schema=Z,G.schemaPath=v.schemaPath+".additionalProperties",G.errSchemaPath=v.errSchemaPath+"/additionalProperties",G.errorPath=v.opts._errorDataPathProperty?v.errorPath:v.util.getPathExpr(v.errorPath,K,v.opts.jsonPointers);var bv=j+"["+K+"]";G.dataPathArr[S]=K;var Xv=v.validate(G);if(G.baseId=T,v.util.varOccurences(Xv,N)<2)Q+=" "+v.util.varReplace(Xv,N,bv)+" ";else Q+=" var "+N+" = "+bv+"; "+Xv+" ";Q+=" if (!"+M+") { errors = "+L+"; if (validate.errors !== null) { if (errors) validate.errors.length = errors; else validate.errors = null; } delete "+j+"["+K+"]; } ",v.compositeRule=G.compositeRule=Sf}else{G.schema=Z,G.schemaPath=v.schemaPath+".additionalProperties",G.errSchemaPath=v.errSchemaPath+"/additionalProperties",G.errorPath=v.opts._errorDataPathProperty?v.errorPath:v.util.getPathExpr(v.errorPath,K,v.opts.jsonPointers);var bv=j+"["+K+"]";G.dataPathArr[S]=K;var Xv=v.validate(G);if(G.baseId=T,v.util.varOccurences(Xv,N)<2)Q+=" "+v.util.varReplace(Xv,N,bv)+" ";else Q+=" var "+N+" = "+bv+"; "+Xv+" ";if(D)Q+=" if (!"+M+") break; "}v.errorPath=lv}if(_)Q+=" } ";if(Q+=" } ",D)Q+=" if ("+M+") { ",O+="}"}var Mf=v.opts.useDefaults&&!v.compositeRule;if(b.length){var wf=b;if(wf){var a,bf=-1,Rf=wf.length-1;while(bf<Rf){a=wf[bf+=1];var Av=Y[a];if(v.opts.strictKeywords?typeof Av=="object"&&Object.keys(Av).length>0||Av===!1:v.util.schemaHasRules(Av,v.RULES.all)){var cv=v.util.getProperty(a),bv=j+cv,Cv=Mf&&Av.default!==void 0;G.schema=Av,G.schemaPath=B+cv,G.errSchemaPath=q+"/"+v.util.escapeFragment(a),G.errorPath=v.util.getPath(v.errorPath,a,v.opts.jsonPointers),G.dataPathArr[S]=v.util.toQuotedString(a);var Xv=v.validate(G);if(G.baseId=T,v.util.varOccurences(Xv,N)<2){Xv=v.util.varReplace(Xv,N,bv);var kv=bv}else{var kv=N;Q+=" var "+N+" = "+bv+"; "}if(Cv)Q+=" "+Xv+" ";else{if(e&&e[a]){if(Q+=" if ( "+kv+" === undefined ",l)Q+=" || ! Object.prototype.hasOwnProperty.call("+j+", '"+v.util.escapeQuotes(a)+"') ";Q+=") { "+M+" = false; ";var lv=v.errorPath,Gf=q,Jf=v.util.escapeQuotes(a);if(v.opts._errorDataPathProperty)v.errorPath=v.util.getPath(lv,a,v.opts.jsonPointers);q=v.errSchemaPath+"/required";var Fv=Fv||[];if(Fv.push(Q),Q="",v.createErrors!==!1){if(Q+=" { keyword: 'required' , dataPath: (dataPath || '') + "+v.errorPath+" , schemaPath: "+v.util.toQuotedString(q)+" , params: { missingProperty: '"+Jf+"' } ",v.opts.messages!==!1){if(Q+=" , message: '",v.opts._errorDataPathProperty)Q+="is a required property";else Q+="should have required property \\'"+Jf+"\\'";Q+="' "}if(v.opts.verbose)Q+=" , schema: validate.schema"+B+" , parentSchema: validate.schema"+v.schemaPath+" , data: "+j+" ";Q+=" } "}else Q+=" {} ";var Lv=Q;if(Q=Fv.pop(),!v.compositeRule&&D)if(v.async)Q+=" throw new ValidationError(["+Lv+"]); ";else Q+=" validate.errors = ["+Lv+"]; return false; ";else Q+=" var err = "+Lv+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";q=Gf,v.errorPath=lv,Q+=" } else { "}else if(D){if(Q+=" if ( "+kv+" === undefined ",l)Q+=" || ! Object.prototype.hasOwnProperty.call("+j+", '"+v.util.escapeQuotes(a)+"') ";Q+=") { "+M+" = true; } else { "}else{if(Q+=" if ("+kv+" !== undefined ",l)Q+=" && Object.prototype.hasOwnProperty.call("+j+", '"+v.util.escapeQuotes(a)+"') ";Q+=" ) { "}Q+=" "+Xv+" } "}}if(D)Q+=" if ("+M+") { ",O+="}"}}}if(m.length){var xv=m;if(xv){var Wv,y1=-1,k0=xv.length-1;while(y1<k0){Wv=xv[y1+=1];var Av=k[Wv];if(v.opts.strictKeywords?typeof Av=="object"&&Object.keys(Av).length>0||Av===!1:v.util.schemaHasRules(Av,v.RULES.all)){if(G.schema=Av,G.schemaPath=v.schemaPath+".patternProperties"+v.util.getProperty(Wv),G.errSchemaPath=v.errSchemaPath+"/patternProperties/"+v.util.escapeFragment(Wv),l)Q+=" "+A+" = "+A+" || Object.keys("+j+"); for (var "+F+"=0; "+F+"<"+A+".length; "+F+"++) { var "+K+" = "+A+"["+F+"]; ";else Q+=" for (var "+K+" in "+j+") { ";Q+=" if ("+v.usePattern(Wv)+".test("+K+")) { ",G.errorPath=v.util.getPathExpr(v.errorPath,K,v.opts.jsonPointers);var bv=j+"["+K+"]";G.dataPathArr[S]=K;var Xv=v.validate(G);if(G.baseId=T,v.util.varOccurences(Xv,N)<2)Q+=" "+v.util.varReplace(Xv,N,bv)+" ";else Q+=" var "+N+" = "+bv+"; "+Xv+" ";if(D)Q+=" if (!"+M+") break; ";if(Q+=" } ",D)Q+=" else "+M+" = true; ";if(Q+=" } ",D)Q+=" if ("+M+") { ",O+="}"}}}}if(D)Q+=" "+O+" if ("+L+" == errors) {";return Q}});var o9=n((wY,s9)=>{s9.exports=function f(v,h,J){var Q=" ",W=v.level,X=v.dataLevel,Y=v.schema[h],B=v.schemaPath+v.util.getProperty(h),q=v.errSchemaPath+"/"+h,D=!v.opts.allErrors,j="data"+(X||""),L="errs__"+W,G=v.util.copy(v),O="";G.level++;var M="valid"+G.level;if(Q+="var "+L+" = errors;",v.opts.strictKeywords?typeof Y=="object"&&Object.keys(Y).length>0||Y===!1:v.util.schemaHasRules(Y,v.RULES.all)){G.schema=Y,G.schemaPath=B,G.errSchemaPath=q;var K="key"+W,F="idx"+W,S="i"+W,N="' + "+K+" + '",A=G.dataLevel=v.dataLevel+1,b="data"+A,k="dataProperties"+W,m=v.opts.ownProperties,Z=v.baseId;if(m)Q+=" var "+k+" = undefined; ";if(m)Q+=" "+k+" = "+k+" || Object.keys("+j+"); for (var "+F+"=0; "+F+"<"+k+".length; "+F+"++) { var "+K+" = "+k+"["+F+"]; ";else Q+=" for (var "+K+" in "+j+") { ";Q+=" var startErrs"+W+" = errors; ";var _=K,r=v.compositeRule;v.compositeRule=G.compositeRule=!0;var x=v.validate(G);if(G.baseId=Z,v.util.varOccurences(x,b)<2)Q+=" "+v.util.varReplace(x,b,_)+" ";else Q+=" var "+b+" = "+_+"; "+x+" ";if(v.compositeRule=G.compositeRule=r,Q+=" if (!"+M+") { for (var "+S+"=startErrs"+W+"; "+S+"<errors; "+S+"++) { vErrors["+S+"].propertyName = "+K+"; } var err = ",v.createErrors!==!1){if(Q+=" { keyword: 'propertyNames' , dataPath: (dataPath || '') + "+v.errorPath+" , schemaPath: "+v.util.toQuotedString(q)+" , params: { propertyName: '"+N+"' } ",v.opts.messages!==!1)Q+=" , message: 'property name \\'"+N+"\\' is invalid' ";if(v.opts.verbose)Q+=" , schema: validate.schema"+B+" , parentSchema: validate.schema"+v.schemaPath+" , data: "+j+" ";Q+=" } "}else Q+=" {} ";if(Q+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!v.compositeRule&&D)if(v.async)Q+=" throw new ValidationError(vErrors); ";else Q+=" validate.errors = vErrors; return false; ";if(D)Q+=" break; ";Q+=" } }"}if(D)Q+=" "+O+" if ("+L+" == errors) {";return Q}});var v8=n((qY,e9)=>{e9.exports=function f(v,h,J){var Q=" ",W=v.level,X=v.dataLevel,Y=v.schema[h],B=v.schemaPath+v.util.getProperty(h),q=v.errSchemaPath+"/"+h,D=!v.opts.allErrors,j="data"+(X||""),L="valid"+W,G=v.opts.$data&&Y&&Y.$data,O;if(G)Q+=" var schema"+W+" = "+v.util.getData(Y.$data,X,v.dataPathArr)+"; ",O="schema"+W;else O=Y;var M="schema"+W;if(!G)if(Y.length<v.opts.loopRequired&&v.schema.properties&&Object.keys(v.schema.properties).length){var K=[],F=Y;if(F){var S,N=-1,A=F.length-1;while(N<A){S=F[N+=1];var b=v.schema.properties[S];if(!(b&&(v.opts.strictKeywords?typeof b=="object"&&Object.keys(b).length>0||b===!1:v.util.schemaHasRules(b,v.RULES.all))))K[K.length]=S}}}else var K=Y;if(G||K.length){var k=v.errorPath,m=G||K.length>=v.opts.loopRequired,Z=v.opts.ownProperties;if(D)if(Q+=" var missing"+W+"; ",m){if(!G)Q+=" var "+M+" = validate.schema"+B+"; ";var _="i"+W,r="schema"+W+"["+_+"]",x="' + "+r+" + '";if(v.opts._errorDataPathProperty)v.errorPath=v.util.getPathExpr(k,r,v.opts.jsonPointers);if(Q+=" var "+L+" = true; ",G)Q+=" if (schema"+W+" === undefined) "+L+" = true; else if (!Array.isArray(schema"+W+")) "+L+" = false; else {";if(Q+=" for (var "+_+" = 0; "+_+" < "+M+".length; "+_+"++) { "+L+" = "+j+"["+M+"["+_+"]] !== undefined ",Z)Q+=" && Object.prototype.hasOwnProperty.call("+j+", "+M+"["+_+"]) ";if(Q+="; if (!"+L+") break; } ",G)Q+=" } ";Q+=" if (!"+L+") { ";var C=C||[];if(C.push(Q),Q="",v.createErrors!==!1){if(Q+=" { keyword: 'required' , dataPath: (dataPath || '') + "+v.errorPath+" , schemaPath: "+v.util.toQuotedString(q)+" , params: { missingProperty: '"+x+"' } ",v.opts.messages!==!1){if(Q+=" , message: '",v.opts._errorDataPathProperty)Q+="is a required property";else Q+="should have required property \\'"+x+"\\'";Q+="' "}if(v.opts.verbose)Q+=" , schema: validate.schema"+B+" , parentSchema: validate.schema"+v.schemaPath+" , data: "+j+" ";Q+=" } "}else Q+=" {} ";var R=Q;if(Q=C.pop(),!v.compositeRule&&D)if(v.async)Q+=" throw new ValidationError(["+R+"]); ";else Q+=" validate.errors = ["+R+"]; return false; ";else Q+=" var err = "+R+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";Q+=" } else { "}else{Q+=" if ( ";var l=K;if(l){var T,_=-1,Bv=l.length-1;while(_<Bv){if(T=l[_+=1],_)Q+=" || ";var e=v.util.getProperty(T),fv=j+e;if(Q+=" ( ( "+fv+" === undefined ",Z)Q+=" || ! Object.prototype.hasOwnProperty.call("+j+", '"+v.util.escapeQuotes(T)+"') ";Q+=") && (missing"+W+" = "+v.util.toQuotedString(v.opts.jsonPointers?T:e)+") ) "}}Q+=") { ";var r="missing"+W,x="' + "+r+" + '";if(v.opts._errorDataPathProperty)v.errorPath=v.opts.jsonPointers?v.util.getPathExpr(k,r,!0):k+" + "+r;var C=C||[];if(C.push(Q),Q="",v.createErrors!==!1){if(Q+=" { keyword: 'required' , dataPath: (dataPath || '') + "+v.errorPath+" , schemaPath: "+v.util.toQuotedString(q)+" , params: { missingProperty: '"+x+"' } ",v.opts.messages!==!1){if(Q+=" , message: '",v.opts._errorDataPathProperty)Q+="is a required property";else Q+="should have required property \\'"+x+"\\'";Q+="' "}if(v.opts.verbose)Q+=" , schema: validate.schema"+B+" , parentSchema: validate.schema"+v.schemaPath+" , data: "+j+" ";Q+=" } "}else Q+=" {} ";var R=Q;if(Q=C.pop(),!v.compositeRule&&D)if(v.async)Q+=" throw new ValidationError(["+R+"]); ";else Q+=" validate.errors = ["+R+"]; return false; ";else Q+=" var err = "+R+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";Q+=" } else { "}else if(m){if(!G)Q+=" var "+M+" = validate.schema"+B+"; ";var _="i"+W,r="schema"+W+"["+_+"]",x="' + "+r+" + '";if(v.opts._errorDataPathProperty)v.errorPath=v.util.getPathExpr(k,r,v.opts.jsonPointers);if(G){if(Q+=" if ("+M+" && !Array.isArray("+M+")) { var err = ",v.createErrors!==!1){if(Q+=" { keyword: 'required' , dataPath: (dataPath || '') + "+v.errorPath+" , schemaPath: "+v.util.toQuotedString(q)+" , params: { missingProperty: '"+x+"' } ",v.opts.messages!==!1){if(Q+=" , message: '",v.opts._errorDataPathProperty)Q+="is a required property";else Q+="should have required property \\'"+x+"\\'";Q+="' "}if(v.opts.verbose)Q+=" , schema: validate.schema"+B+" , parentSchema: validate.schema"+v.schemaPath+" , data: "+j+" ";Q+=" } "}else Q+=" {} ";Q+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } else if ("+M+" !== undefined) { "}if(Q+=" for (var "+_+" = 0; "+_+" < "+M+".length; "+_+"++) { if ("+j+"["+M+"["+_+"]] === undefined ",Z)Q+=" || ! Object.prototype.hasOwnProperty.call("+j+", "+M+"["+_+"]) ";if(Q+=") { var err = ",v.createErrors!==!1){if(Q+=" { keyword: 'required' , dataPath: (dataPath || '') + "+v.errorPath+" , schemaPath: "+v.util.toQuotedString(q)+" , params: { missingProperty: '"+x+"' } ",v.opts.messages!==!1){if(Q+=" , message: '",v.opts._errorDataPathProperty)Q+="is a required property";else Q+="should have required property \\'"+x+"\\'";Q+="' "}if(v.opts.verbose)Q+=" , schema: validate.schema"+B+" , parentSchema: validate.schema"+v.schemaPath+" , data: "+j+" ";Q+=" } "}else Q+=" {} ";if(Q+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } } ",G)Q+=" } "}else{var o=K;if(o){var T,a=-1,jv=o.length-1;while(a<jv){T=o[a+=1];var e=v.util.getProperty(T),x=v.util.escapeQuotes(T),fv=j+e;if(v.opts._errorDataPathProperty)v.errorPath=v.util.getPath(k,T,v.opts.jsonPointers);if(Q+=" if ( "+fv+" === undefined ",Z)Q+=" || ! Object.prototype.hasOwnProperty.call("+j+", '"+v.util.escapeQuotes(T)+"') ";if(Q+=") { var err = ",v.createErrors!==!1){if(Q+=" { keyword: 'required' , dataPath: (dataPath || '') + "+v.errorPath+" , schemaPath: "+v.util.toQuotedString(q)+" , params: { missingProperty: '"+x+"' } ",v.opts.messages!==!1){if(Q+=" , message: '",v.opts._errorDataPathProperty)Q+="is a required property";else Q+="should have required property \\'"+x+"\\'";Q+="' "}if(v.opts.verbose)Q+=" , schema: validate.schema"+B+" , parentSchema: validate.schema"+v.schemaPath+" , data: "+j+" ";Q+=" } "}else Q+=" {} ";Q+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } "}}}v.errorPath=k}else if(D)Q+=" if (true) {";return Q}});var Q8=n((DY,f8)=>{f8.exports=function f(v,h,J){var Q=" ",W=v.level,X=v.dataLevel,Y=v.schema[h],B=v.schemaPath+v.util.getProperty(h),q=v.errSchemaPath+"/"+h,D=!v.opts.allErrors,j="data"+(X||""),L="valid"+W,G=v.opts.$data&&Y&&Y.$data,O;if(G)Q+=" var schema"+W+" = "+v.util.getData(Y.$data,X,v.dataPathArr)+"; ",O="schema"+W;else O=Y;if((Y||G)&&v.opts.uniqueItems!==!1){if(G)Q+=" var "+L+"; if ("+O+" === false || "+O+" === undefined) "+L+" = true; else if (typeof "+O+" != 'boolean') "+L+" = false; else { ";Q+=" var i = "+j+".length , "+L+" = true , j; if (i > 1) { ";var M=v.schema.items&&v.schema.items.type,K=Array.isArray(M);if(!M||M=="object"||M=="array"||K&&(M.indexOf("object")>=0||M.indexOf("array")>=0))Q+=" outer: for (;i--;) { for (j = i; j--;) { if (equal("+j+"[i], "+j+"[j])) { "+L+" = false; break outer; } } } ";else{Q+=" var itemIndices = {}, item; for (;i--;) { var item = "+j+"[i]; ";var F="checkDataType"+(K?"s":"");if(Q+=" if ("+v.util[F](M,"item",v.opts.strictNumbers,!0)+") continue; ",K)Q+=` if (typeof item == 'string') item = '"' + item; `;Q+=" if (typeof itemIndices[item] == 'number') { "+L+" = false; j = itemIndices[item]; break; } itemIndices[item] = i; } "}if(Q+=" } ",G)Q+=" } ";Q+=" if (!"+L+") { ";var S=S||[];if(S.push(Q),Q="",v.createErrors!==!1){if(Q+=" { keyword: 'uniqueItems' , dataPath: (dataPath || '') + "+v.errorPath+" , schemaPath: "+v.util.toQuotedString(q)+" , params: { i: i, j: j } ",v.opts.messages!==!1)Q+=" , message: 'should NOT have duplicate items (items ## ' + j + ' and ' + i + ' are identical)' ";if(v.opts.verbose){if(Q+=" , schema: ",G)Q+="validate.schema"+B;else Q+=""+Y;Q+=" , parentSchema: validate.schema"+v.schemaPath+" , data: "+j+" "}Q+=" } "}else Q+=" {} ";var N=Q;if(Q=S.pop(),!v.compositeRule&&D)if(v.async)Q+=" throw new ValidationError(["+N+"]); ";else Q+=" validate.errors = ["+N+"]; return false; ";else Q+=" var err = "+N+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";if(Q+=" } ",D)Q+=" else { "}else if(D)Q+=" if (true) { ";return Q}});var J8=n((HY,h8)=>{h8.exports={$ref:K9(),allOf:j9(),anyOf:M9(),$comment:V9(),const:N9(),contains:z9(),dependencies:S9(),enum:R9(),format:l9(),if:g9(),items:I9(),maximum:$Q(),minimum:$Q(),maxItems:jQ(),minItems:jQ(),maxLength:LQ(),minLength:LQ(),maxProperties:MQ(),minProperties:MQ(),multipleOf:u9(),not:a9(),oneOf:p9(),pattern:i9(),properties:t9(),propertyNames:o9(),required:v8(),uniqueItems:Q8(),validate:OQ()}});var X8=n((OY,P8)=>{var W8=J8(),EQ=xf().toHash;P8.exports=function f(){var v=[{type:"number",rules:[{maximum:["exclusiveMaximum"]},{minimum:["exclusiveMinimum"]},"multipleOf","format"]},{type:"string",rules:["maxLength","minLength","pattern","format"]},{type:"array",rules:["maxItems","minItems","items","contains","uniqueItems"]},{type:"object",rules:["maxProperties","minProperties","required","dependencies","propertyNames",{properties:["additionalProperties","patternProperties"]}]},{rules:["$ref","const","enum","not","anyOf","oneOf","allOf","if"]}],h=["type","$comment"],J=["$schema","$id","id","$data","$async","title","description","default","definitions","examples","readOnly","writeOnly","contentMediaType","contentEncoding","additionalItems","then","else"],Q=["number","integer","string","array","object","boolean","null"];return v.all=EQ(h),v.types=EQ(Q),v.forEach(function(W){if(W.rules=W.rules.map(function(X){var Y;if(typeof X=="object"){var B=Object.keys(X)[0];Y=X[B],X=B,Y.forEach(function(D){h.push(D),v.all[D]=!0})}h.push(X);var q=v.all[X]={keyword:X,code:W8[X],implements:Y};return q}),v.all.$comment={keyword:"$comment",code:W8.$comment},W.type)v.types[W.type]=W}),v.keywords=EQ(h.concat(J)),v.custom={},v}});var G8=n((KY,B8)=>{var Y8=["multipleOf","maximum","exclusiveMaximum","minimum","exclusiveMinimum","maxLength","minLength","pattern","additionalItems","maxItems","minItems","uniqueItems","maxProperties","minProperties","required","additionalProperties","enum","format","const"];B8.exports=function(f,v){for(var h=0;h<v.length;h++){f=JSON.parse(JSON.stringify(f));var J=v[h].split("/"),Q=f,W;for(W=1;W<J.length;W++)Q=Q[J[W]];for(W=0;W<Y8.length;W++){var X=Y8[W],Y=Q[X];if(Y)Q[X]={anyOf:[Y,{$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"}]}}}return f}});var D8=n(($Y,q8)=>{var tP=$0().MissingRef;q8.exports=w8;function w8(f,v,h){var J=this;if(typeof this._opts.loadSchema!="function")throw new Error("options.loadSchema should be a function");if(typeof v=="function")h=v,v=void 0;var Q=W(f).then(function(){var Y=J._addSchema(f,void 0,v);return Y.validate||X(Y)});if(h)Q.then(function(Y){h(null,Y)},h);return Q;function W(Y){var B=Y.$schema;return B&&!J.getSchema(B)?w8.call(J,{$ref:B},!0):Promise.resolve()}function X(Y){try{return J._compile(Y)}catch(q){if(q instanceof tP)return B(q);throw q}function B(q){var D=q.missingSchema;if(G(D))throw new Error("Schema "+D+" is loaded but "+q.missingRef+" cannot be resolved");var j=J._loadingSchemas[D];if(!j)j=J._loadingSchemas[D]=J._opts.loadSchema(D),j.then(L,L);return j.then(function(O){if(!G(D))return W(O).then(function(){if(!G(D))J.addSchema(O,D,void 0,v)})}).then(function(){return X(Y)});function L(){delete J._loadingSchemas[D]}function G(O){return J._refs[O]||J._schemas[O]}}}}});var O8=n((jY,H8)=>{H8.exports=function f(v,h,J){var Q=" ",W=v.level,X=v.dataLevel,Y=v.schema[h],B=v.schemaPath+v.util.getProperty(h),q=v.errSchemaPath+"/"+h,D=!v.opts.allErrors,j,L="data"+(X||""),G="valid"+W,O="errs__"+W,M=v.opts.$data&&Y&&Y.$data,K;if(M)Q+=" var schema"+W+" = "+v.util.getData(Y.$data,X,v.dataPathArr)+"; ",K="schema"+W;else K=Y;var F=this,S="definition"+W,N=F.definition,A="",b,k,m,Z,_;if(M&&N.$data){_="keywordValidate"+W;var r=N.validateSchema;Q+=" var "+S+" = RULES.custom['"+h+"'].definition; var "+_+" = "+S+".validate;"}else{if(Z=v.useCustomRule(F,Y,v.schema,v),!Z)return;K="validate.schema"+B,_=Z.code,b=N.compile,k=N.inline,m=N.macro}var x=_+".errors",C="i"+W,R="ruleErr"+W,l=N.async;if(l&&!v.async)throw new Error("async keyword in sync schema");if(!(k||m))Q+=""+x+" = null;";if(Q+="var "+O+" = errors;var "+G+";",M&&N.$data){if(A+="}",Q+=" if ("+K+" === undefined) { "+G+" = true; } else { ",r)A+="}",Q+=" "+G+" = "+S+".validateSchema("+K+"); if ("+G+") { "}if(k)if(N.statements)Q+=" "+Z.validate+" ";else Q+=" "+G+" = "+Z.validate+"; ";else if(m){var T=v.util.copy(v),A="";T.level++;var Bv="valid"+T.level;T.schema=Z.validate,T.schemaPath="";var e=v.compositeRule;v.compositeRule=T.compositeRule=!0;var fv=v.validate(T).replace(/validate\.schema/g,_);v.compositeRule=T.compositeRule=e,Q+=" "+fv}else{var o=o||[];if(o.push(Q),Q="",Q+=" "+_+".call( ",v.opts.passContext)Q+="this";else Q+="self";if(b||N.schema===!1)Q+=" , "+L+" ";else Q+=" , "+K+" , "+L+" , validate.schema"+v.schemaPath+" ";if(Q+=" , (dataPath || '')",v.errorPath!='""')Q+=" + "+v.errorPath;var a=X?"data"+(X-1||""):"parentData",jv=X?v.dataPathArr[X]:"parentDataProperty";Q+=" , "+a+" , "+jv+" , rootData ) ";var Sv=Q;if(Q=o.pop(),N.errors===!1){if(Q+=" "+G+" = ",l)Q+="await ";Q+=""+Sv+"; "}else if(l)x="customErrors"+W,Q+=" var "+x+" = null; try { "+G+" = await "+Sv+"; } catch (e) { "+G+" = false; if (e instanceof ValidationError) "+x+" = e.errors; else throw e; } ";else Q+=" "+x+" = null; "+G+" = "+Sv+"; "}if(N.modifying)Q+=" if ("+a+") "+L+" = "+a+"["+jv+"];";if(Q+=""+A,N.valid){if(D)Q+=" if (true) { "}else{if(Q+=" if ( ",N.valid===void 0)if(Q+=" !",m)Q+=""+Bv;else Q+=""+G;else Q+=" "+!N.valid+" ";Q+=") { ",j=F.keyword;var o=o||[];o.push(Q),Q="";var o=o||[];if(o.push(Q),Q="",v.createErrors!==!1){if(Q+=" { keyword: '"+(j||"custom")+"' , dataPath: (dataPath || '') + "+v.errorPath+" , schemaPath: "+v.util.toQuotedString(q)+" , params: { keyword: '"+F.keyword+"' } ",v.opts.messages!==!1)Q+=` , message: 'should pass "`+F.keyword+`" keyword validation' `;if(v.opts.verbose)Q+=" , schema: validate.schema"+B+" , parentSchema: validate.schema"+v.schemaPath+" , data: "+L+" ";Q+=" } "}else Q+=" {} ";var _v=Q;if(Q=o.pop(),!v.compositeRule&&D)if(v.async)Q+=" throw new ValidationError(["+_v+"]); ";else Q+=" validate.errors = ["+_v+"]; return false; ";else Q+=" var err = "+_v+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";var Wv=Q;if(Q=o.pop(),k)if(N.errors){if(N.errors!="full"){if(Q+=" for (var "+C+"="+O+"; "+C+"<errors; "+C+"++) { var "+R+" = vErrors["+C+"]; if ("+R+".dataPath === undefined) "+R+".dataPath = (dataPath || '') + "+v.errorPath+"; if ("+R+".schemaPath === undefined) { "+R+'.schemaPath = "'+q+'"; } ',v.opts.verbose)Q+=" "+R+".schema = "+K+"; "+R+".data = "+L+"; ";Q+=" } "}}else if(N.errors===!1)Q+=" "+Wv+" ";else{if(Q+=" if ("+O+" == errors) { "+Wv+" } else { for (var "+C+"="+O+"; "+C+"<errors; "+C+"++) { var "+R+" = vErrors["+C+"]; if ("+R+".dataPath === undefined) "+R+".dataPath = (dataPath || '') + "+v.errorPath+"; if ("+R+".schemaPath === undefined) { "+R+'.schemaPath = "'+q+'"; } ',v.opts.verbose)Q+=" "+R+".schema = "+K+"; "+R+".data = "+L+"; ";Q+=" } } "}else if(m){if(Q+=" var err = ",v.createErrors!==!1){if(Q+=" { keyword: '"+(j||"custom")+"' , dataPath: (dataPath || '') + "+v.errorPath+" , schemaPath: "+v.util.toQuotedString(q)+" , params: { keyword: '"+F.keyword+"' } ",v.opts.messages!==!1)Q+=` , message: 'should pass "`+F.keyword+`" keyword validation' `;if(v.opts.verbose)Q+=" , schema: validate.schema"+B+" , parentSchema: validate.schema"+v.schemaPath+" , data: "+L+" ";Q+=" } "}else Q+=" {} ";if(Q+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!v.compositeRule&&D)if(v.async)Q+=" throw new ValidationError(vErrors); ";else Q+=" validate.errors = vErrors; return false; "}else if(N.errors===!1)Q+=" "+Wv+" ";else{if(Q+=" if (Array.isArray("+x+")) { if (vErrors === null) vErrors = "+x+"; else vErrors = vErrors.concat("+x+"); errors = vErrors.length; for (var "+C+"="+O+"; "+C+"<errors; "+C+"++) { var "+R+" = vErrors["+C+"]; if ("+R+".dataPath === undefined) "+R+".dataPath = (dataPath || '') + "+v.errorPath+"; "+R+'.schemaPath = "'+q+'"; ',v.opts.verbose)Q+=" "+R+".schema = "+K+"; "+R+".data = "+L+"; ";Q+=" } } else { "+Wv+" } "}if(Q+=" } ",D)Q+=" else { "}return Q}});var VQ=n((LY,sP)=>{sP.exports={$schema:"http://json-schema.org/draft-07/schema#",$id:"http://json-schema.org/draft-07/schema#",title:"Core schema meta-schema",definitions:{schemaArray:{type:"array",minItems:1,items:{$ref:"#"}},nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{allOf:[{$ref:"#/definitions/nonNegativeInteger"},{default:0}]},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}},type:["object","boolean"],properties:{$id:{type:"string",format:"uri-reference"},$schema:{type:"string",format:"uri"},$ref:{type:"string",format:"uri-reference"},$comment:{type:"string"},title:{type:"string"},description:{type:"string"},default:!0,readOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0},multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/definitions/nonNegativeInteger"},minLength:{$ref:"#/definitions/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},additionalItems:{$ref:"#"},items:{anyOf:[{$ref:"#"},{$ref:"#/definitions/schemaArray"}],default:!0},maxItems:{$ref:"#/definitions/nonNegativeInteger"},minItems:{$ref:"#/definitions/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},contains:{$ref:"#"},maxProperties:{$ref:"#/definitions/nonNegativeInteger"},minProperties:{$ref:"#/definitions/nonNegativeIntegerDefault0"},required:{$ref:"#/definitions/stringArray"},additionalProperties:{$ref:"#"},definitions:{type:"object",additionalProperties:{$ref:"#"},default:{}},properties:{type:"object",additionalProperties:{$ref:"#"},default:{}},patternProperties:{type:"object",additionalProperties:{$ref:"#"},propertyNames:{format:"regex"},default:{}},dependencies:{type:"object",additionalProperties:{anyOf:[{$ref:"#"},{$ref:"#/definitions/stringArray"}]}},propertyNames:{$ref:"#"},const:!0,enum:{type:"array",items:!0,minItems:1,uniqueItems:!0},type:{anyOf:[{$ref:"#/definitions/simpleTypes"},{type:"array",items:{$ref:"#/definitions/simpleTypes"},minItems:1,uniqueItems:!0}]},format:{type:"string"},contentMediaType:{type:"string"},contentEncoding:{type:"string"},if:{$ref:"#"},then:{$ref:"#"},else:{$ref:"#"},allOf:{$ref:"#/definitions/schemaArray"},anyOf:{$ref:"#/definitions/schemaArray"},oneOf:{$ref:"#/definitions/schemaArray"},not:{$ref:"#"}},default:!0}});var j8=n((MY,$8)=>{var K8=VQ();$8.exports={$id:"https://github.com/ajv-validator/ajv/blob/master/lib/definition_schema.js",definitions:{simpleTypes:K8.definitions.simpleTypes},type:"object",dependencies:{schema:["validate"],$data:["validate"],statements:["inline"],valid:{not:{required:["macro"]}}},properties:{type:K8.properties.type,schema:{type:"boolean"},statements:{type:"boolean"},dependencies:{type:"array",items:{type:"string"}},metaSchema:{type:"object"},modifying:{type:"boolean"},valid:{type:"boolean"},$data:{type:"boolean"},async:{type:"boolean"},errors:{anyOf:[{type:"boolean"},{const:"full"}]}}}});var M8=n((EY,L8)=>{var oP=/^[a-z_$][a-z0-9_$-]*$/i,eP=O8(),v5=j8();L8.exports={add:f5,get:Q5,remove:h5,validate:FQ};function f5(f,v){var h=this.RULES;if(h.keywords[f])throw new Error("Keyword "+f+" is already defined");if(!oP.test(f))throw new Error("Keyword "+f+" is not a valid identifier");if(v){this.validateKeyword(v,!0);var J=v.type;if(Array.isArray(J))for(var Q=0;Q<J.length;Q++)X(f,J[Q],v);else X(f,J,v);var W=v.metaSchema;if(W){if(v.$data&&this._opts.$data)W={anyOf:[W,{$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"}]};v.validateSchema=this.compile(W,!0)}}h.keywords[f]=h.all[f]=!0;function X(Y,B,q){var D;for(var j=0;j<h.length;j++){var L=h[j];if(L.type==B){D=L;break}}if(!D)D={type:B,rules:[]},h.push(D);var G={keyword:Y,definition:q,custom:!0,code:eP,implements:q.implements};D.rules.push(G),h.custom[Y]=G}return this}function Q5(f){var v=this.RULES.custom[f];return v?v.definition:this.RULES.keywords[f]||!1}function h5(f){var v=this.RULES;delete v.keywords[f],delete v.all[f],delete v.custom[f];for(var h=0;h<v.length;h++){var J=v[h].rules;for(var Q=0;Q<J.length;Q++)if(J[Q].keyword==f){J.splice(Q,1);break}}return this}function FQ(f,v){FQ.errors=null;var h=this._validateKeyword=this._validateKeyword||this.compile(v5,!0);if(h(f))return!0;if(FQ.errors=h.errors,v)throw new Error("custom keyword definition is invalid: "+this.errorsText(h.errors));else return!1}});var E8=n((VY,J5)=>{J5.exports={$schema:"http://json-schema.org/draft-07/schema#",$id:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#",description:"Meta-schema for $data reference (JSON Schema extension proposal)",type:"object",required:["$data"],properties:{$data:{type:"string",anyOf:[{format:"relative-json-pointer"},{format:"json-pointer"}]}},additionalProperties:!1}});var _8=n((FY,R8)=>{var F8=v9(),Zf=K0(),W5=Q9(),N8=YQ(),P5=HQ(),X5=H9(),Y5=X8(),U8=G8(),z8=xf();R8.exports=Mv;Mv.prototype.validate=G5;Mv.prototype.compile=w5;Mv.prototype.addSchema=q5;Mv.prototype.addMetaSchema=D5;Mv.prototype.validateSchema=H5;Mv.prototype.getSchema=K5;Mv.prototype.removeSchema=j5;Mv.prototype.addFormat=z5;Mv.prototype.errorsText=U5;Mv.prototype._addSchema=L5;Mv.prototype._compile=M5;Mv.prototype.compileAsync=D8();var U0=M8();Mv.prototype.addKeyword=U0.add;Mv.prototype.getKeyword=U0.get;Mv.prototype.removeKeyword=U0.remove;Mv.prototype.validateKeyword=U0.validate;var A8=$0();Mv.ValidationError=A8.Validation;Mv.MissingRefError=A8.MissingRef;Mv.$dataMetaSchema=U8;var N0="http://json-schema.org/draft-07/schema",V8=["removeAdditional","useDefaults","coerceTypes","strictDefaults"],B5=["/properties"];function Mv(f){if(!(this instanceof Mv))return new Mv(f);if(f=this._opts=z8.copy(f)||{},l5(this),this._schemas={},this._refs={},this._fragments={},this._formats=X5(f.format),this._cache=f.cache||new W5,this._loadingSchemas={},this._compilations=[],this.RULES=Y5(),this._getId=E5(f),f.loopRequired=f.loopRequired||1/0,f.errorDataPath=="property")f._errorDataPathProperty=!0;if(f.serialize===void 0)f.serialize=P5;if(this._metaOpts=_5(this),f.formats)b5(this);if(f.keywords)R5(this);if(A5(this),typeof f.meta=="object")this.addMetaSchema(f.meta);if(f.nullable)this.addKeyword("nullable",{metaSchema:{type:"boolean"}});S5(this)}function G5(f,v){var h;if(typeof f=="string"){if(h=this.getSchema(f),!h)throw new Error('no schema with key or ref "'+f+'"')}else{var J=this._addSchema(f);h=J.validate||this._compile(J)}var Q=h(v);if(h.$async!==!0)this.errors=h.errors;return Q}function w5(f,v){var h=this._addSchema(f,void 0,v);return h.validate||this._compile(h)}function q5(f,v,h,J){if(Array.isArray(f)){for(var Q=0;Q<f.length;Q++)this.addSchema(f[Q],void 0,h,J);return this}var W=this._getId(f);if(W!==void 0&&typeof W!="string")throw new Error("schema id must be string");return v=Zf.normalizeId(v||W),b8(this,v),this._schemas[v]=this._addSchema(f,h,J,!0),this}function D5(f,v,h){return this.addSchema(f,v,h,!0),this}function H5(f,v){var h=f.$schema;if(h!==void 0&&typeof h!="string")throw new Error("$schema must be a string");if(h=h||this._opts.defaultMeta||O5(this),!h)return this.logger.warn("meta-schema not available"),this.errors=null,!0;var J=this.validate(h,f);if(!J&&v){var Q="schema is invalid: "+this.errorsText();if(this._opts.validateSchema=="log")this.logger.error(Q);else throw new Error(Q)}return J}function O5(f){var v=f._opts.meta;return f._opts.defaultMeta=typeof v=="object"?f._getId(v)||v:f.getSchema(N0)?N0:void 0,f._opts.defaultMeta}function K5(f){var v=S8(this,f);switch(typeof v){case"object":return v.validate||this._compile(v);case"string":return this.getSchema(v);case"undefined":return $5(this,f)}}function $5(f,v){var h=Zf.schema.call(f,{schema:{}},v);if(h){var{schema:J,root:Q,baseId:W}=h,X=F8.call(f,J,Q,void 0,W);return f._fragments[v]=new N8({ref:v,fragment:!0,schema:J,root:Q,baseId:W,validate:X}),X}}function S8(f,v){return v=Zf.normalizeId(v),f._schemas[v]||f._refs[v]||f._fragments[v]}function j5(f){if(f instanceof RegExp)return F0(this,this._schemas,f),F0(this,this._refs,f),this;switch(typeof f){case"undefined":return F0(this,this._schemas),F0(this,this._refs),this._cache.clear(),this;case"string":var v=S8(this,f);if(v)this._cache.del(v.cacheKey);return delete this._schemas[f],delete this._refs[f],this;case"object":var h=this._opts.serialize,J=h?h(f):f;this._cache.del(J);var Q=this._getId(f);if(Q)Q=Zf.normalizeId(Q),delete this._schemas[Q],delete this._refs[Q]}return this}function F0(f,v,h){for(var J in v){var Q=v[J];if(!Q.meta&&(!h||h.test(J)))f._cache.del(Q.cacheKey),delete v[J]}}function L5(f,v,h,J){if(typeof f!="object"&&typeof f!="boolean")throw new Error("schema should be object or boolean");var Q=this._opts.serialize,W=Q?Q(f):f,X=this._cache.get(W);if(X)return X;J=J||this._opts.addUsedSchema!==!1;var Y=Zf.normalizeId(this._getId(f));if(Y&&J)b8(this,Y);var B=this._opts.validateSchema!==!1&&!v,q;if(B&&!(q=Y&&Y==Zf.normalizeId(f.$schema)))this.validateSchema(f,!0);var D=Zf.ids.call(this,f),j=new N8({id:Y,schema:f,localRefs:D,cacheKey:W,meta:h});if(Y[0]!="#"&&J)this._refs[Y]=j;if(this._cache.put(W,j),B&&q)this.validateSchema(f,!0);return j}function M5(f,v){if(f.compiling){if(f.validate=Q,Q.schema=f.schema,Q.errors=null,Q.root=v?v:Q,f.schema.$async===!0)Q.$async=!0;return Q}f.compiling=!0;var h;if(f.meta)h=this._opts,this._opts=this._metaOpts;var J;try{J=F8.call(this,f.schema,v,f.localRefs)}catch(W){throw delete f.validate,W}finally{if(f.compiling=!1,f.meta)this._opts=h}return f.validate=J,f.refs=J.refs,f.refVal=J.refVal,f.root=J.root,J;function Q(){var W=f.validate,X=W.apply(this,arguments);return Q.errors=W.errors,X}}function E5(f){switch(f.schemaId){case"auto":return N5;case"id":return V5;default:return F5}}function V5(f){if(f.$id)this.logger.warn("schema $id ignored",f.$id);return f.id}function F5(f){if(f.id)this.logger.warn("schema id ignored",f.id);return f.$id}function N5(f){if(f.$id&&f.id&&f.$id!=f.id)throw new Error("schema $id is different from id");return f.$id||f.id}function U5(f,v){if(f=f||this.errors,!f)return"No errors";v=v||{};var h=v.separator===void 0?", ":v.separator,J=v.dataVar===void 0?"data":v.dataVar,Q="";for(var W=0;W<f.length;W++){var X=f[W];if(X)Q+=J+X.dataPath+" "+X.message+h}return Q.slice(0,-h.length)}function z5(f,v){if(typeof v=="string")v=new RegExp(v);return this._formats[f]=v,this}function A5(f){var v;if(f._opts.$data)v=E8(),f.addMetaSchema(v,v.$id,!0);if(f._opts.meta===!1)return;var h=VQ();if(f._opts.$data)h=U8(h,B5);f.addMetaSchema(h,N0,!0),f._refs["http://json-schema.org/schema"]=N0}function S5(f){var v=f._opts.schemas;if(!v)return;if(Array.isArray(v))f.addSchema(v);else for(var h in v)f.addSchema(v[h],h)}function b5(f){for(var v in f._opts.formats){var h=f._opts.formats[v];f.addFormat(v,h)}}function R5(f){for(var v in f._opts.keywords){var h=f._opts.keywords[v];f.addKeyword(v,h)}}function b8(f,v){if(f._schemas[v]||f._refs[v])throw new Error('schema with key or id "'+v+'" already exists')}function _5(f){var v=z8.copy(f._opts);for(var h=0;h<V8.length;h++)delete v[V8[h]];return v}function l5(f){var v=f._opts.logger;if(v===!1)f.logger={log:NQ,warn:NQ,error:NQ};else{if(v===void 0)v=console;if(!(typeof v=="object"&&v.log&&v.warn&&v.error))throw new Error("logger must implement log, warn and error methods");f.logger=v}}function NQ(){}});function p5(){let f=process.argv.join(" ");return f.includes("streamable-http.js")||f.includes("streamable-http.ts")}class KJ{context;level;constructor(f,v=1){this.context=f,this.level=v}setLevel(f){this.level=f}log(...f){if(OJ)console.log(...f);else console.error(...f)}logWarn(...f){if(OJ)console.warn(...f);else console.error(...f)}debug(...f){if(this.level<=0)this.log(`[DEBUG] [${this.context}]`,...f)}info(...f){if(this.level<=1)this.log(`[INFO] [${this.context}]`,...f)}warn(...f){if(this.level<=2)this.logWarn(`[WARN] [${this.context}]`,...f)}error(...f){if(this.level<=3)console.error(`[ERROR] [${this.context}]`,...f)}}var OJ,sv=(f,v=1)=>new KJ(f,v);var rf=T0(()=>{OJ=p5()});b1();var vP=60000;class vQ{constructor(f){this._options=f,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._pendingDebouncedNotifications=new Set,this.setNotificationHandler(i1,(v)=>{let h=this._requestHandlerAbortControllers.get(v.params.requestId);h===null||h===void 0||h.abort(v.params.reason)}),this.setNotificationHandler(s1,(v)=>{this._onprogress(v)}),this.setRequestHandler(t1,(v)=>({}))}_setupTimeout(f,v,h,J,Q=!1){this._timeoutInfo.set(f,{timeoutId:setTimeout(J,v),startTime:Date.now(),timeout:v,maxTotalTimeout:h,resetTimeoutOnProgress:Q,onTimeout:J})}_resetTimeout(f){let v=this._timeoutInfo.get(f);if(!v)return!1;let h=Date.now()-v.startTime;if(v.maxTotalTimeout&&h>=v.maxTotalTimeout)throw this._timeoutInfo.delete(f),new Dv(qv.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:v.maxTotalTimeout,totalElapsed:h});return clearTimeout(v.timeoutId),v.timeoutId=setTimeout(v.onTimeout,v.timeout),!0}_cleanupTimeout(f){let v=this._timeoutInfo.get(f);if(v)clearTimeout(v.timeoutId),this._timeoutInfo.delete(f)}async connect(f){var v,h,J;this._transport=f;let Q=(v=this.transport)===null||v===void 0?void 0:v.onclose;this._transport.onclose=()=>{Q===null||Q===void 0||Q(),this._onclose()};let W=(h=this.transport)===null||h===void 0?void 0:h.onerror;this._transport.onerror=(Y)=>{W===null||W===void 0||W(Y),this._onerror(Y)};let X=(J=this._transport)===null||J===void 0?void 0:J.onmessage;this._transport.onmessage=(Y,B)=>{if(X===null||X===void 0||X(Y,B),c0(Y)||Mh(Y))this._onresponse(Y);else if(Oh(Y))this._onrequest(Y,B);else if($h(Y))this._onnotification(Y);else this._onerror(new Error(`Unknown message type: ${JSON.stringify(Y)}`))},await this._transport.start()}_onclose(){var f;let v=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._pendingDebouncedNotifications.clear(),this._transport=void 0,(f=this.onclose)===null||f===void 0||f.call(this);let h=new Dv(qv.ConnectionClosed,"Connection closed");for(let J of v.values())J(h)}_onerror(f){var v;(v=this.onerror)===null||v===void 0||v.call(this,f)}_onnotification(f){var v;let h=(v=this._notificationHandlers.get(f.method))!==null&&v!==void 0?v:this.fallbackNotificationHandler;if(h===void 0)return;Promise.resolve().then(()=>h(f)).catch((J)=>this._onerror(new Error(`Uncaught error in notification handler: ${J}`)))}_onrequest(f,v){var h,J;let Q=(h=this._requestHandlers.get(f.method))!==null&&h!==void 0?h:this.fallbackRequestHandler,W=this._transport;if(Q===void 0){W===null||W===void 0||W.send({jsonrpc:"2.0",id:f.id,error:{code:qv.MethodNotFound,message:"Method not found"}}).catch((B)=>this._onerror(new Error(`Failed to send an error response: ${B}`)));return}let X=new AbortController;this._requestHandlerAbortControllers.set(f.id,X);let Y={signal:X.signal,sessionId:W===null||W===void 0?void 0:W.sessionId,_meta:(J=f.params)===null||J===void 0?void 0:J._meta,sendNotification:(B)=>this.notification(B,{relatedRequestId:f.id}),sendRequest:(B,q,D)=>this.request(B,q,{...D,relatedRequestId:f.id}),authInfo:v===null||v===void 0?void 0:v.authInfo,requestId:f.id,requestInfo:v===null||v===void 0?void 0:v.requestInfo};Promise.resolve().then(()=>Q(f,Y)).then((B)=>{if(X.signal.aborted)return;return W===null||W===void 0?void 0:W.send({result:B,jsonrpc:"2.0",id:f.id})},(B)=>{var q;if(X.signal.aborted)return;return W===null||W===void 0?void 0:W.send({jsonrpc:"2.0",id:f.id,error:{code:Number.isSafeInteger(B.code)?B.code:qv.InternalError,message:(q=B.message)!==null&&q!==void 0?q:"Internal error"}})}).catch((B)=>this._onerror(new Error(`Failed to send response: ${B}`))).finally(()=>{this._requestHandlerAbortControllers.delete(f.id)})}_onprogress(f){let{progressToken:v,...h}=f.params,J=Number(v),Q=this._progressHandlers.get(J);if(!Q){this._onerror(new Error(`Received a progress notification for an unknown token: ${JSON.stringify(f)}`));return}let W=this._responseHandlers.get(J),X=this._timeoutInfo.get(J);if(X&&W&&X.resetTimeoutOnProgress)try{this._resetTimeout(J)}catch(Y){W(Y);return}Q(h)}_onresponse(f){let v=Number(f.id),h=this._responseHandlers.get(v);if(h===void 0){this._onerror(new Error(`Received a response for an unknown message ID: ${JSON.stringify(f)}`));return}if(this._responseHandlers.delete(v),this._progressHandlers.delete(v),this._cleanupTimeout(v),c0(f))h(f);else{let J=new Dv(f.error.code,f.error.message,f.error.data);h(J)}}get transport(){return this._transport}async close(){var f;await((f=this._transport)===null||f===void 0?void 0:f.close())}request(f,v,h){let{relatedRequestId:J,resumptionToken:Q,onresumptiontoken:W}=h!==null&&h!==void 0?h:{};return new Promise((X,Y)=>{var B,q,D,j,L,G;if(!this._transport){Y(new Error("Not connected"));return}if(((B=this._options)===null||B===void 0?void 0:B.enforceStrictCapabilities)===!0)this.assertCapabilityForMethod(f.method);(q=h===null||h===void 0?void 0:h.signal)===null||q===void 0||q.throwIfAborted();let O=this._requestMessageId++,M={...f,jsonrpc:"2.0",id:O};if(h===null||h===void 0?void 0:h.onprogress)this._progressHandlers.set(O,h.onprogress),M.params={...f.params,_meta:{...((D=f.params)===null||D===void 0?void 0:D._meta)||{},progressToken:O}};let K=(N)=>{var A;this._responseHandlers.delete(O),this._progressHandlers.delete(O),this._cleanupTimeout(O),(A=this._transport)===null||A===void 0||A.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:O,reason:String(N)}},{relatedRequestId:J,resumptionToken:Q,onresumptiontoken:W}).catch((b)=>this._onerror(new Error(`Failed to send cancellation: ${b}`))),Y(N)};this._responseHandlers.set(O,(N)=>{var A;if((A=h===null||h===void 0?void 0:h.signal)===null||A===void 0?void 0:A.aborted)return;if(N instanceof Error)return Y(N);try{let b=v.parse(N.result);X(b)}catch(b){Y(b)}}),(j=h===null||h===void 0?void 0:h.signal)===null||j===void 0||j.addEventListener("abort",()=>{var N;K((N=h===null||h===void 0?void 0:h.signal)===null||N===void 0?void 0:N.reason)});let F=(L=h===null||h===void 0?void 0:h.timeout)!==null&&L!==void 0?L:vP,S=()=>K(new Dv(qv.RequestTimeout,"Request timed out",{timeout:F}));this._setupTimeout(O,F,h===null||h===void 0?void 0:h.maxTotalTimeout,S,(G=h===null||h===void 0?void 0:h.resetTimeoutOnProgress)!==null&&G!==void 0?G:!1),this._transport.send(M,{relatedRequestId:J,resumptionToken:Q,onresumptiontoken:W}).catch((N)=>{this._cleanupTimeout(O),Y(N)})})}async notification(f,v){var h,J;if(!this._transport)throw new Error("Not connected");if(this.assertNotificationCapability(f.method),((J=(h=this._options)===null||h===void 0?void 0:h.debouncedNotificationMethods)!==null&&J!==void 0?J:[]).includes(f.method)&&!f.params&&!(v===null||v===void 0?void 0:v.relatedRequestId)){if(this._pendingDebouncedNotifications.has(f.method))return;this._pendingDebouncedNotifications.add(f.method),Promise.resolve().then(()=>{var Y;if(this._pendingDebouncedNotifications.delete(f.method),!this._transport)return;let B={...f,jsonrpc:"2.0"};(Y=this._transport)===null||Y===void 0||Y.send(B,v).catch((q)=>this._onerror(q))});return}let X={...f,jsonrpc:"2.0"};await this._transport.send(X,v)}setRequestHandler(f,v){let h=f.shape.method.value;this.assertRequestHandlerCapability(h),this._requestHandlers.set(h,(J,Q)=>{return Promise.resolve(v(f.parse(J),Q))})}removeRequestHandler(f){this._requestHandlers.delete(f)}assertCanSetRequestHandler(f){if(this._requestHandlers.has(f))throw new Error(`A request handler for ${f} already exists, which would be overridden`)}setNotificationHandler(f,v){this._notificationHandlers.set(f.shape.method.value,(h)=>Promise.resolve(v(f.parse(h))))}removeNotificationHandler(f){this._notificationHandlers.delete(f)}}function Rh(f,v){return Object.entries(v).reduce((h,[J,Q])=>{if(Q&&typeof Q==="object")h[J]=h[J]?{...h[J],...Q}:Q;else h[J]=Q;return h},{...f})}b1();var l8=x1(_8());class UQ extends vQ{constructor(f,v){var h;super(v);this._serverInfo=f,this._capabilities=(h=v===null||v===void 0?void 0:v.capabilities)!==null&&h!==void 0?h:{},this._instructions=v===null||v===void 0?void 0:v.instructions,this.setRequestHandler(d1,(J)=>this._oninitialize(J)),this.setNotificationHandler(p0,()=>{var J;return(J=this.oninitialized)===null||J===void 0?void 0:J.call(this)})}registerCapabilities(f){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=Rh(this._capabilities,f)}assertCapabilityForMethod(f){var v,h,J;switch(f){case"sampling/createMessage":if(!((v=this._clientCapabilities)===null||v===void 0?void 0:v.sampling))throw new Error(`Client does not support sampling (required for ${f})`);break;case"elicitation/create":if(!((h=this._clientCapabilities)===null||h===void 0?void 0:h.elicitation))throw new Error(`Client does not support elicitation (required for ${f})`);break;case"roots/list":if(!((J=this._clientCapabilities)===null||J===void 0?void 0:J.roots))throw new Error(`Client does not support listing roots (required for ${f})`);break;case"ping":break}}assertNotificationCapability(f){switch(f){case"notifications/message":if(!this._capabilities.logging)throw new Error(`Server does not support logging (required for ${f})`);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 ${f})`);break;case"notifications/tools/list_changed":if(!this._capabilities.tools)throw new Error(`Server does not support notifying of tool list changes (required for ${f})`);break;case"notifications/prompts/list_changed":if(!this._capabilities.prompts)throw new Error(`Server does not support notifying of prompt list changes (required for ${f})`);break;case"notifications/cancelled":break;case"notifications/progress":break}}assertRequestHandlerCapability(f){switch(f){case"sampling/createMessage":if(!this._capabilities.sampling)throw new Error(`Server does not support sampling (required for ${f})`);break;case"logging/setLevel":if(!this._capabilities.logging)throw new Error(`Server does not support logging (required for ${f})`);break;case"prompts/get":case"prompts/list":if(!this._capabilities.prompts)throw new Error(`Server does not support prompts (required for ${f})`);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 ${f})`);break;case"tools/call":case"tools/list":if(!this._capabilities.tools)throw new Error(`Server does not support tools (required for ${f})`);break;case"ping":case"initialize":break}}async _oninitialize(f){let v=f.params.protocolVersion;return this._clientCapabilities=f.params.capabilities,this._clientVersion=f.params.clientInfo,{protocolVersion:wh.includes(v)?v:a0,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"},n1)}async createMessage(f,v){return this.request({method:"sampling/createMessage",params:f},s0,v)}async elicitInput(f,v){let h=await this.request({method:"elicitation/create",params:f},o0,v);if(h.action==="accept"&&h.content)try{let J=new l8.default,Q=J.compile(f.requestedSchema);if(!Q(h.content))throw new Dv(qv.InvalidParams,`Elicitation response content does not match requested schema: ${J.errorsText(Q.errors)}`)}catch(J){if(J instanceof Dv)throw J;throw new Dv(qv.InternalError,`Error validating elicitation response: ${J}`)}return h}async listRoots(f,v){return this.request({method:"roots/list",params:f},e0,v)}async sendLoggingMessage(f){return this.notification({method:"notifications/message",params:f})}async sendResourceUpdated(f){return this.notification({method:"notifications/resources/updated",params:f})}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 g8=Symbol("Let zodToJsonSchema decide on which parser to use");var k8={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"},y8=(f)=>typeof f==="string"?{...k8,name:f}:{...k8,...f};var I8=(f)=>{let v=y8(f),h=v.name!==void 0?[...v.basePath,v.definitionPath,v.name]:v.basePath;return{...v,currentPath:h,propertyPath:void 0,seen:new Map(Object.entries(v.definitions).map(([J,Q])=>[Q._def,{def:Q._def,path:[...v.basePath,v.definitionPath,J],jsonSchema:void 0}]))}};function zQ(f,v,h,J){if(!J?.errorMessages)return;if(h)f.errorMessage={...f.errorMessage,[v]:h}}function vv(f,v,h,J,Q){f[v]=h,zQ(f,v,J,Q)}av();function C8(){return{}}av();function T8(f,v){let h={type:"array"};if(f.type?._def&&f.type?._def?.typeName!==z.ZodAny)h.items=c(f.type._def,{...v,currentPath:[...v.currentPath,"items"]});if(f.minLength)vv(h,"minItems",f.minLength.value,f.minLength.message,v);if(f.maxLength)vv(h,"maxItems",f.maxLength.value,f.maxLength.message,v);if(f.exactLength)vv(h,"minItems",f.exactLength.value,f.exactLength.message,v),vv(h,"maxItems",f.exactLength.value,f.exactLength.message,v);return h}function x8(f,v){let h={type:"integer",format:"int64"};if(!f.checks)return h;for(let J of f.checks)switch(J.kind){case"min":if(v.target==="jsonSchema7")if(J.inclusive)vv(h,"minimum",J.value,J.message,v);else vv(h,"exclusiveMinimum",J.value,J.message,v);else{if(!J.inclusive)h.exclusiveMinimum=!0;vv(h,"minimum",J.value,J.message,v)}break;case"max":if(v.target==="jsonSchema7")if(J.inclusive)vv(h,"maximum",J.value,J.message,v);else vv(h,"exclusiveMaximum",J.value,J.message,v);else{if(!J.inclusive)h.exclusiveMaximum=!0;vv(h,"maximum",J.value,J.message,v)}break;case"multipleOf":vv(h,"multipleOf",J.value,J.message,v);break}return h}function Z8(){return{type:"boolean"}}function z0(f,v){return c(f.type._def,v)}var r8=(f,v)=>{return c(f.innerType._def,v)};function AQ(f,v,h){let J=h??v.dateStrategy;if(Array.isArray(J))return{anyOf:J.map((Q,W)=>AQ(f,v,Q))};switch(J){case"string":case"format:date-time":return{type:"string",format:"date-time"};case"format:date":return{type:"string",format:"date"};case"integer":return k5(f,v)}}var k5=(f,v)=>{let h={type:"integer",format:"unix-time"};if(v.target==="openApi3")return h;for(let J of f.checks)switch(J.kind){case"min":vv(h,"minimum",J.value,J.message,v);break;case"max":vv(h,"maximum",J.value,J.message,v);break}return h};function u8(f,v){return{...c(f.innerType._def,v),default:f.defaultValue()}}function m8(f,v){return v.effectStrategy==="input"?c(f.schema._def,v):{}}function a8(f){return{type:"string",enum:Array.from(f.values)}}var g5=(f)=>{if("type"in f&&f.type==="string")return!1;return"allOf"in f};function c8(f,v){let h=[c(f.left._def,{...v,currentPath:[...v.currentPath,"allOf","0"]}),c(f.right._def,{...v,currentPath:[...v.currentPath,"allOf","1"]})].filter((W)=>!!W),J=v.target==="jsonSchema2019-09"?{unevaluatedProperties:!1}:void 0,Q=[];return h.forEach((W)=>{if(g5(W)){if(Q.push(...W.allOf),W.unevaluatedProperties===void 0)J=void 0}else{let X=W;if("additionalProperties"in W&&W.additionalProperties===!1){let{additionalProperties:Y,...B}=W;X=B}else J=void 0;Q.push(X)}}),Q.length?{allOf:Q,...J}:void 0}function p8(f,v){let h=typeof f.value;if(h!=="bigint"&&h!=="number"&&h!=="boolean"&&h!=="string")return{type:Array.isArray(f.value)?"array":"object"};if(v.target==="openApi3")return{type:h==="bigint"?"integer":h,enum:[f.value]};return{type:h==="bigint"?"integer":h,const:f.value}}av();var SQ=void 0,Qf={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(SQ===void 0)SQ=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u");return SQ},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 A0(f,v){let h={type:"string"};if(f.checks)for(let J of f.checks)switch(J.kind){case"min":vv(h,"minLength",typeof h.minLength==="number"?Math.max(h.minLength,J.value):J.value,J.message,v);break;case"max":vv(h,"maxLength",typeof h.maxLength==="number"?Math.min(h.maxLength,J.value):J.value,J.message,v);break;case"email":switch(v.emailStrategy){case"format:email":hf(h,"email",J.message,v);break;case"format:idn-email":hf(h,"idn-email",J.message,v);break;case"pattern:zod":yv(h,Qf.email,J.message,v);break}break;case"url":hf(h,"uri",J.message,v);break;case"uuid":hf(h,"uuid",J.message,v);break;case"regex":yv(h,J.regex,J.message,v);break;case"cuid":yv(h,Qf.cuid,J.message,v);break;case"cuid2":yv(h,Qf.cuid2,J.message,v);break;case"startsWith":yv(h,RegExp(`^${bQ(J.value,v)}`),J.message,v);break;case"endsWith":yv(h,RegExp(`${bQ(J.value,v)}$`),J.message,v);break;case"datetime":hf(h,"date-time",J.message,v);break;case"date":hf(h,"date",J.message,v);break;case"time":hf(h,"time",J.message,v);break;case"duration":hf(h,"duration",J.message,v);break;case"length":vv(h,"minLength",typeof h.minLength==="number"?Math.max(h.minLength,J.value):J.value,J.message,v),vv(h,"maxLength",typeof h.maxLength==="number"?Math.min(h.maxLength,J.value):J.value,J.message,v);break;case"includes":{yv(h,RegExp(bQ(J.value,v)),J.message,v);break}case"ip":{if(J.version!=="v6")hf(h,"ipv4",J.message,v);if(J.version!=="v4")hf(h,"ipv6",J.message,v);break}case"base64url":yv(h,Qf.base64url,J.message,v);break;case"jwt":yv(h,Qf.jwt,J.message,v);break;case"cidr":{if(J.version!=="v6")yv(h,Qf.ipv4Cidr,J.message,v);if(J.version!=="v4")yv(h,Qf.ipv6Cidr,J.message,v);break}case"emoji":yv(h,Qf.emoji(),J.message,v);break;case"ulid":{yv(h,Qf.ulid,J.message,v);break}case"base64":{switch(v.base64Strategy){case"format:binary":{hf(h,"binary",J.message,v);break}case"contentEncoding:base64":{vv(h,"contentEncoding","base64",J.message,v);break}case"pattern:zod":{yv(h,Qf.base64,J.message,v);break}}break}case"nanoid":yv(h,Qf.nanoid,J.message,v);case"toLowerCase":case"toUpperCase":case"trim":break;default:((Q)=>{})(J)}return h}function bQ(f,v){return v.patternStrategy==="escape"?I5(f):f}var y5=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function I5(f){let v="";for(let h=0;h<f.length;h++){if(!y5.has(f[h]))v+="\\";v+=f[h]}return v}function hf(f,v,h,J){if(f.format||f.anyOf?.some((Q)=>Q.format)){if(!f.anyOf)f.anyOf=[];if(f.format){if(f.anyOf.push({format:f.format,...f.errorMessage&&J.errorMessages&&{errorMessage:{format:f.errorMessage.format}}}),delete f.format,f.errorMessage){if(delete f.errorMessage.format,Object.keys(f.errorMessage).length===0)delete f.errorMessage}}f.anyOf.push({format:v,...h&&J.errorMessages&&{errorMessage:{format:h}}})}else vv(f,"format",v,h,J)}function yv(f,v,h,J){if(f.pattern||f.allOf?.some((Q)=>Q.pattern)){if(!f.allOf)f.allOf=[];if(f.pattern){if(f.allOf.push({pattern:f.pattern,...f.errorMessage&&J.errorMessages&&{errorMessage:{pattern:f.errorMessage.pattern}}}),delete f.pattern,f.errorMessage){if(delete f.errorMessage.pattern,Object.keys(f.errorMessage).length===0)delete f.errorMessage}}f.allOf.push({pattern:n8(v,J),...h&&J.errorMessages&&{errorMessage:{pattern:h}}})}else vv(f,"pattern",n8(v,J),h,J)}function n8(f,v){if(!v.applyRegexFlags||!f.flags)return f.source;let h={i:f.flags.includes("i"),m:f.flags.includes("m"),s:f.flags.includes("s")},J=h.i?f.source.toLowerCase():f.source,Q="",W=!1,X=!1,Y=!1;for(let B=0;B<J.length;B++){if(W){Q+=J[B],W=!1;continue}if(h.i){if(X){if(J[B].match(/[a-z]/)){if(Y)Q+=J[B],Q+=`${J[B-2]}-${J[B]}`.toUpperCase(),Y=!1;else if(J[B+1]==="-"&&J[B+2]?.match(/[a-z]/))Q+=J[B],Y=!0;else Q+=`${J[B]}${J[B].toUpperCase()}`;continue}}else if(J[B].match(/[a-z]/)){Q+=`[${J[B]}${J[B].toUpperCase()}]`;continue}}if(h.m){if(J[B]==="^"){Q+=`(^|(?<=[\r
|
|
3
|
-
]))`;continue}else if(
|
|
4
|
-
]))`;continue}}if(
|
|
5
|
-
`:`[${
|
|
6
|
-
]`;continue}if(Q+=J[B],J[B]==="\\")W=!0;else if(X&&J[B]==="]")X=!1;else if(!X&&J[B]==="[")X=!0}try{new RegExp(Q)}catch{return console.warn(`Could not convert regex pattern at ${v.currentPath.join("/")} to a flag-independent form! Falling back to the flag-ignorant source`),f.source}return Q}function S0(f,v){if(v.target==="openAi")console.warn("Warning: OpenAI may not support records in schemas! Try an array of key-value pairs instead.");if(v.target==="openApi3"&&f.keyType?._def.typeName===z.ZodEnum)return{type:"object",required:f.keyType._def.values,properties:f.keyType._def.values.reduce((J,Q)=>({...J,[Q]:c(f.valueType._def,{...v,currentPath:[...v.currentPath,"properties",Q]})??{}}),{}),additionalProperties:v.rejectedAdditionalProperties};let h={type:"object",additionalProperties:c(f.valueType._def,{...v,currentPath:[...v.currentPath,"additionalProperties"]})??v.allowedAdditionalProperties};if(v.target==="openApi3")return h;if(f.keyType?._def.typeName===z.ZodString&&f.keyType._def.checks?.length){let{type:J,...Q}=A0(f.keyType._def,v);return{...h,propertyNames:Q}}else if(f.keyType?._def.typeName===z.ZodEnum)return{...h,propertyNames:{enum:f.keyType._def.values}};else if(f.keyType?._def.typeName===z.ZodBranded&&f.keyType._def.type._def.typeName===z.ZodString&&f.keyType._def.type._def.checks?.length){let{type:J,...Q}=z0(f.keyType._def,v);return{...h,propertyNames:Q}}return h}function i8(f,v){if(v.mapStrategy==="record")return S0(f,v);let h=c(f.keyType._def,{...v,currentPath:[...v.currentPath,"items","items","0"]})||{},J=c(f.valueType._def,{...v,currentPath:[...v.currentPath,"items","items","1"]})||{};return{type:"array",maxItems:125,items:{type:"array",items:[h,J],minItems:2,maxItems:2}}}function d8(f){let v=f.values,J=Object.keys(f.values).filter((W)=>{return typeof v[v[W]]!=="number"}).map((W)=>v[W]),Q=Array.from(new Set(J.map((W)=>typeof W)));return{type:Q.length===1?Q[0]==="string"?"string":"number":["string","number"],enum:J}}function t8(){return{not:{}}}function s8(f){return f.target==="openApi3"?{enum:["null"],nullable:!0}:{type:"null"}}var _1={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};function e8(f,v){if(v.target==="openApi3")return o8(f,v);let h=f.options instanceof Map?Array.from(f.options.values()):f.options;if(h.every((J)=>(J._def.typeName in _1)&&(!J._def.checks||!J._def.checks.length))){let J=h.reduce((Q,W)=>{let X=_1[W._def.typeName];return X&&!Q.includes(X)?[...Q,X]:Q},[]);return{type:J.length>1?J:J[0]}}else if(h.every((J)=>J._def.typeName==="ZodLiteral"&&!J.description)){let J=h.reduce((Q,W)=>{let X=typeof W._def.value;switch(X){case"string":case"number":case"boolean":return[...Q,X];case"bigint":return[...Q,"integer"];case"object":if(W._def.value===null)return[...Q,"null"];case"symbol":case"undefined":case"function":default:return Q}},[]);if(J.length===h.length){let Q=J.filter((W,X,Y)=>Y.indexOf(W)===X);return{type:Q.length>1?Q:Q[0],enum:h.reduce((W,X)=>{return W.includes(X._def.value)?W:[...W,X._def.value]},[])}}}else if(h.every((J)=>J._def.typeName==="ZodEnum"))return{type:"string",enum:h.reduce((J,Q)=>[...J,...Q._def.values.filter((W)=>!J.includes(W))],[])};return o8(f,v)}var o8=(f,v)=>{let h=(f.options instanceof Map?Array.from(f.options.values()):f.options).map((J,Q)=>c(J._def,{...v,currentPath:[...v.currentPath,"anyOf",`${Q}`]})).filter((J)=>!!J&&(!v.strictUnions||typeof J==="object"&&Object.keys(J).length>0));return h.length?{anyOf:h}:void 0};function vJ(f,v){if(["ZodString","ZodNumber","ZodBigInt","ZodBoolean","ZodNull"].includes(f.innerType._def.typeName)&&(!f.innerType._def.checks||!f.innerType._def.checks.length)){if(v.target==="openApi3")return{type:_1[f.innerType._def.typeName],nullable:!0};return{type:[_1[f.innerType._def.typeName],"null"]}}if(v.target==="openApi3"){let J=c(f.innerType._def,{...v,currentPath:[...v.currentPath]});if(J&&"$ref"in J)return{allOf:[J],nullable:!0};return J&&{...J,nullable:!0}}let h=c(f.innerType._def,{...v,currentPath:[...v.currentPath,"anyOf","0"]});return h&&{anyOf:[h,{type:"null"}]}}function fJ(f,v){let h={type:"number"};if(!f.checks)return h;for(let J of f.checks)switch(J.kind){case"int":h.type="integer",zQ(h,"type",J.message,v);break;case"min":if(v.target==="jsonSchema7")if(J.inclusive)vv(h,"minimum",J.value,J.message,v);else vv(h,"exclusiveMinimum",J.value,J.message,v);else{if(!J.inclusive)h.exclusiveMinimum=!0;vv(h,"minimum",J.value,J.message,v)}break;case"max":if(v.target==="jsonSchema7")if(J.inclusive)vv(h,"maximum",J.value,J.message,v);else vv(h,"exclusiveMaximum",J.value,J.message,v);else{if(!J.inclusive)h.exclusiveMaximum=!0;vv(h,"maximum",J.value,J.message,v)}break;case"multipleOf":vv(h,"multipleOf",J.value,J.message,v);break}return h}av();function QJ(f,v){let h=v.target==="openAi",J={type:"object",properties:{}},Q=[],W=f.shape();for(let Y in W){let B=W[Y];if(B===void 0||B._def===void 0)continue;let q=T5(B);if(q&&h){if(B instanceof mv)B=B._def.innerType;if(!B.isNullable())B=B.nullable();q=!1}let D=c(B._def,{...v,currentPath:[...v.currentPath,"properties",Y],propertyPath:[...v.currentPath,"properties",Y]});if(D===void 0)continue;if(J.properties[Y]=D,!q)Q.push(Y)}if(Q.length)J.required=Q;let X=C5(f,v);if(X!==void 0)J.additionalProperties=X;return J}function C5(f,v){if(f.catchall._def.typeName!=="ZodNever")return c(f.catchall._def,{...v,currentPath:[...v.currentPath,"additionalProperties"]});switch(f.unknownKeys){case"passthrough":return v.allowedAdditionalProperties;case"strict":return v.rejectedAdditionalProperties;case"strip":return v.removeAdditionalStrategy==="strict"?v.allowedAdditionalProperties:v.rejectedAdditionalProperties}}function T5(f){try{return f.isOptional()}catch{return!0}}var hJ=(f,v)=>{if(v.currentPath.toString()===v.propertyPath?.toString())return c(f.innerType._def,v);let h=c(f.innerType._def,{...v,currentPath:[...v.currentPath,"anyOf","1"]});return h?{anyOf:[{not:{}},h]}:{}};var JJ=(f,v)=>{if(v.pipeStrategy==="input")return c(f.in._def,v);else if(v.pipeStrategy==="output")return c(f.out._def,v);let h=c(f.in._def,{...v,currentPath:[...v.currentPath,"allOf","0"]}),J=c(f.out._def,{...v,currentPath:[...v.currentPath,"allOf",h?"1":"0"]});return{allOf:[h,J].filter((Q)=>Q!==void 0)}};function WJ(f,v){return c(f.type._def,v)}function PJ(f,v){let J={type:"array",uniqueItems:!0,items:c(f.valueType._def,{...v,currentPath:[...v.currentPath,"items"]})};if(f.minSize)vv(J,"minItems",f.minSize.value,f.minSize.message,v);if(f.maxSize)vv(J,"maxItems",f.maxSize.value,f.maxSize.message,v);return J}function XJ(f,v){if(f.rest)return{type:"array",minItems:f.items.length,items:f.items.map((h,J)=>c(h._def,{...v,currentPath:[...v.currentPath,"items",`${J}`]})).reduce((h,J)=>J===void 0?h:[...h,J],[]),additionalItems:c(f.rest._def,{...v,currentPath:[...v.currentPath,"additionalItems"]})};else return{type:"array",minItems:f.items.length,maxItems:f.items.length,items:f.items.map((h,J)=>c(h._def,{...v,currentPath:[...v.currentPath,"items",`${J}`]})).reduce((h,J)=>J===void 0?h:[...h,J],[])}}function YJ(){return{not:{}}}function BJ(){return{}}var GJ=(f,v)=>{return c(f.innerType._def,v)};var wJ=(f,v,h)=>{switch(v){case z.ZodString:return A0(f,h);case z.ZodNumber:return fJ(f,h);case z.ZodObject:return QJ(f,h);case z.ZodBigInt:return x8(f,h);case z.ZodBoolean:return Z8();case z.ZodDate:return AQ(f,h);case z.ZodUndefined:return YJ();case z.ZodNull:return s8(h);case z.ZodArray:return T8(f,h);case z.ZodUnion:case z.ZodDiscriminatedUnion:return e8(f,h);case z.ZodIntersection:return c8(f,h);case z.ZodTuple:return XJ(f,h);case z.ZodRecord:return S0(f,h);case z.ZodLiteral:return p8(f,h);case z.ZodEnum:return a8(f);case z.ZodNativeEnum:return d8(f);case z.ZodNullable:return vJ(f,h);case z.ZodOptional:return hJ(f,h);case z.ZodMap:return i8(f,h);case z.ZodSet:return PJ(f,h);case z.ZodLazy:return()=>f.getter()._def;case z.ZodPromise:return WJ(f,h);case z.ZodNaN:case z.ZodNever:return t8();case z.ZodEffects:return m8(f,h);case z.ZodAny:return C8();case z.ZodUnknown:return BJ();case z.ZodDefault:return u8(f,h);case z.ZodBranded:return z0(f,h);case z.ZodReadonly:return GJ(f,h);case z.ZodCatch:return r8(f,h);case z.ZodPipeline:return JJ(f,h);case z.ZodFunction:case z.ZodVoid:case z.ZodSymbol:return;default:return((J)=>{return})(v)}};function c(f,v,h=!1){let J=v.seen.get(f);if(v.override){let Y=v.override?.(f,v,J,h);if(Y!==g8)return Y}if(J&&!h){let Y=x5(J,v);if(Y!==void 0)return Y}let Q={def:f,path:v.currentPath,jsonSchema:void 0};v.seen.set(f,Q);let W=wJ(f,f.typeName,v),X=typeof W==="function"?c(W(),v):W;if(X)r5(f,v,X);if(v.postProcess){let Y=v.postProcess(X,f,v);return Q.jsonSchema=X,Y}return Q.jsonSchema=X,X}var x5=(f,v)=>{switch(v.$refStrategy){case"root":return{$ref:f.path.join("/")};case"relative":return{$ref:Z5(v.currentPath,f.path)};case"none":case"seen":{if(f.path.length<v.currentPath.length&&f.path.every((h,J)=>v.currentPath[J]===h))return console.warn(`Recursive reference detected at ${v.currentPath.join("/")}! Defaulting to any`),{};return v.$refStrategy==="seen"?{}:void 0}}},Z5=(f,v)=>{let h=0;for(;h<f.length&&h<v.length;h++)if(f[h]!==v[h])break;return[(f.length-h).toString(),...v.slice(h)].join("/")},r5=(f,v,h)=>{if(f.description){if(h.description=f.description,v.markdownDescription)h.markdownDescription=f.description}return h};var b0=(f,v)=>{let h=I8(v),J=typeof v==="object"&&v.definitions?Object.entries(v.definitions).reduce((B,[q,D])=>({...B,[q]:c(D._def,{...h,currentPath:[...h.basePath,h.definitionPath,q]},!0)??{}}),{}):void 0,Q=typeof v==="string"?v:v?.nameStrategy==="title"?void 0:v?.name,W=c(f._def,Q===void 0?h:{...h,currentPath:[...h.basePath,h.definitionPath,Q]},!1)??{},X=typeof v==="object"&&v.name!==void 0&&v.nameStrategy==="title"?v.name:void 0;if(X!==void 0)W.title=X;let Y=Q===void 0?J?{...W,[h.definitionPath]:J}:W:{$ref:[...h.$refStrategy==="relative"?[]:h.basePath,h.definitionPath,Q].join("/"),[h.definitionPath]:{...J,[Q]:W}};if(h.target==="jsonSchema7")Y.$schema="http://json-schema.org/draft-07/schema#";else if(h.target==="jsonSchema2019-09"||h.target==="openAi")Y.$schema="https://json-schema.org/draft/2019-09/schema#";if(h.target==="openAi"&&(("anyOf"in Y)||("oneOf"in Y)||("allOf"in Y)||("type"in Y)&&Array.isArray(Y.type)))console.warn("Warning: OpenAI may not support schemas with unions as roots! Try wrapping it in an object property.");return Y};av();b1();av();var RQ;(function(f){f.Completable="McpCompletable"})(RQ||(RQ={}));class l1 extends i{_parse(f){let{ctx:v}=this._processInputParams(f),h=v.data;return this._def.type._parse({data:h,path:v.path,parent:v})}unwrap(){return this._def.type}}l1.create=(f,v)=>{return new l1({type:f,typeName:RQ.Completable,complete:v.complete,...u5(v)})};function u5(f){if(!f)return{};let{errorMap:v,invalid_type_error:h,required_error:J,description:Q}=f;if(v&&(h||J))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);if(v)return{errorMap:v,description:Q};return{errorMap:(X,Y)=>{var B,q;let{message:D}=f;if(X.code==="invalid_enum_value")return{message:D!==null&&D!==void 0?D:Y.defaultError};if(typeof Y.data==="undefined")return{message:(B=D!==null&&D!==void 0?D:J)!==null&&B!==void 0?B:Y.defaultError};if(X.code!=="invalid_type")return{message:Y.defaultError};return{message:(q=D!==null&&D!==void 0?D:h)!==null&&q!==void 0?q:Y.defaultError}},description:Q}}class _Q{constructor(f,v){this._registeredResources={},this._registeredResourceTemplates={},this._registeredTools={},this._registeredPrompts={},this._toolHandlersInitialized=!1,this._completionHandlerInitialized=!1,this._resourceHandlersInitialized=!1,this._promptHandlersInitialized=!1,this.server=new UQ(f,v)}async connect(f){return await this.server.connect(f)}async close(){await this.server.close()}setToolRequestHandlers(){if(this._toolHandlersInitialized)return;this.server.assertCanSetRequestHandler(W0.shape.method.value),this.server.assertCanSetRequestHandler(P0.shape.method.value),this.server.registerCapabilities({tools:{listChanged:!0}}),this.server.setRequestHandler(W0,()=>({tools:Object.entries(this._registeredTools).filter(([,f])=>f.enabled).map(([f,v])=>{let h={name:f,title:v.title,description:v.description,inputSchema:v.inputSchema?b0(v.inputSchema,{strictUnions:!0}):m5,annotations:v.annotations};if(v.outputSchema)h.outputSchema=b0(v.outputSchema,{strictUnions:!0});return h})})),this.server.setRequestHandler(P0,async(f,v)=>{let h=this._registeredTools[f.params.name];if(!h)throw new Dv(qv.InvalidParams,`Tool ${f.params.name} not found`);if(!h.enabled)throw new Dv(qv.InvalidParams,`Tool ${f.params.name} disabled`);let J;if(h.inputSchema){let Q=await h.inputSchema.safeParseAsync(f.params.arguments);if(!Q.success)throw new Dv(qv.InvalidParams,`Invalid arguments for tool ${f.params.name}: ${Q.error.message}`);let W=Q.data,X=h.callback;try{J=await Promise.resolve(X(W,v))}catch(Y){J={content:[{type:"text",text:Y instanceof Error?Y.message:String(Y)}],isError:!0}}}else{let Q=h.callback;try{J=await Promise.resolve(Q(v))}catch(W){J={content:[{type:"text",text:W instanceof Error?W.message:String(W)}],isError:!0}}}if(h.outputSchema&&!J.isError){if(!J.structuredContent)throw new Dv(qv.InvalidParams,`Tool ${f.params.name} has an output schema but no structured content was provided`);let Q=await h.outputSchema.safeParseAsync(J.structuredContent);if(!Q.success)throw new Dv(qv.InvalidParams,`Invalid structured content for tool ${f.params.name}: ${Q.error.message}`)}return J}),this._toolHandlersInitialized=!0}setCompletionRequestHandler(){if(this._completionHandlerInitialized)return;this.server.assertCanSetRequestHandler(X0.shape.method.value),this.server.registerCapabilities({completions:{}}),this.server.setRequestHandler(X0,async(f)=>{switch(f.params.ref.type){case"ref/prompt":return this.handlePromptCompletion(f,f.params.ref);case"ref/resource":return this.handleResourceCompletion(f,f.params.ref);default:throw new Dv(qv.InvalidParams,`Invalid completion reference: ${f.params.ref}`)}}),this._completionHandlerInitialized=!0}async handlePromptCompletion(f,v){let h=this._registeredPrompts[v.name];if(!h)throw new Dv(qv.InvalidParams,`Prompt ${v.name} not found`);if(!h.enabled)throw new Dv(qv.InvalidParams,`Prompt ${v.name} disabled`);if(!h.argsSchema)return R0;let J=h.argsSchema.shape[f.params.argument.name];if(!(J instanceof l1))return R0;let W=await J._def.complete(f.params.argument.value,f.params.context);return DJ(W)}async handleResourceCompletion(f,v){let h=Object.values(this._registeredResourceTemplates).find((W)=>W.resourceTemplate.uriTemplate.toString()===v.uri);if(!h){if(this._registeredResources[v.uri])return R0;throw new Dv(qv.InvalidParams,`Resource template ${f.params.ref.uri} not found`)}let J=h.resourceTemplate.completeCallback(f.params.argument.name);if(!J)return R0;let Q=await J(f.params.argument.value,f.params.context);return DJ(Q)}setResourceRequestHandlers(){if(this._resourceHandlersInitialized)return;this.server.assertCanSetRequestHandler(v0.shape.method.value),this.server.assertCanSetRequestHandler(f0.shape.method.value),this.server.assertCanSetRequestHandler(Q0.shape.method.value),this.server.registerCapabilities({resources:{listChanged:!0}}),this.server.setRequestHandler(v0,async(f,v)=>{let h=Object.entries(this._registeredResources).filter(([Q,W])=>W.enabled).map(([Q,W])=>({uri:Q,name:W.name,...W.metadata})),J=[];for(let Q of Object.values(this._registeredResourceTemplates)){if(!Q.resourceTemplate.listCallback)continue;let W=await Q.resourceTemplate.listCallback(v);for(let X of W.resources)J.push({...Q.metadata,...X})}return{resources:[...h,...J]}}),this.server.setRequestHandler(f0,async()=>{return{resourceTemplates:Object.entries(this._registeredResourceTemplates).map(([v,h])=>({name:v,uriTemplate:h.resourceTemplate.uriTemplate.toString(),...h.metadata}))}}),this.server.setRequestHandler(Q0,async(f,v)=>{let h=new URL(f.params.uri),J=this._registeredResources[h.toString()];if(J){if(!J.enabled)throw new Dv(qv.InvalidParams,`Resource ${h} disabled`);return J.readCallback(h,v)}for(let Q of Object.values(this._registeredResourceTemplates)){let W=Q.resourceTemplate.uriTemplate.match(h.toString());if(W)return Q.readCallback(h,W,v)}throw new Dv(qv.InvalidParams,`Resource ${h} not found`)}),this.setCompletionRequestHandler(),this._resourceHandlersInitialized=!0}setPromptRequestHandlers(){if(this._promptHandlersInitialized)return;this.server.assertCanSetRequestHandler(h0.shape.method.value),this.server.assertCanSetRequestHandler(J0.shape.method.value),this.server.registerCapabilities({prompts:{listChanged:!0}}),this.server.setRequestHandler(h0,()=>({prompts:Object.entries(this._registeredPrompts).filter(([,f])=>f.enabled).map(([f,v])=>{return{name:f,title:v.title,description:v.description,arguments:v.argsSchema?c5(v.argsSchema):void 0}})})),this.server.setRequestHandler(J0,async(f,v)=>{let h=this._registeredPrompts[f.params.name];if(!h)throw new Dv(qv.InvalidParams,`Prompt ${f.params.name} not found`);if(!h.enabled)throw new Dv(qv.InvalidParams,`Prompt ${f.params.name} disabled`);if(h.argsSchema){let J=await h.argsSchema.safeParseAsync(f.params.arguments);if(!J.success)throw new Dv(qv.InvalidParams,`Invalid arguments for prompt ${f.params.name}: ${J.error.message}`);let Q=J.data,W=h.callback;return await Promise.resolve(W(Q,v))}else{let J=h.callback;return await Promise.resolve(J(v))}}),this.setCompletionRequestHandler(),this._promptHandlersInitialized=!0}resource(f,v,...h){let J;if(typeof h[0]==="object")J=h.shift();let Q=h[0];if(typeof v==="string"){if(this._registeredResources[v])throw new Error(`Resource ${v} is already registered`);let W=this._createRegisteredResource(f,void 0,v,J,Q);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),W}else{if(this._registeredResourceTemplates[f])throw new Error(`Resource template ${f} is already registered`);let W=this._createRegisteredResourceTemplate(f,void 0,v,J,Q);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),W}}registerResource(f,v,h,J){if(typeof v==="string"){if(this._registeredResources[v])throw new Error(`Resource ${v} is already registered`);let Q=this._createRegisteredResource(f,h.title,v,h,J);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),Q}else{if(this._registeredResourceTemplates[f])throw new Error(`Resource template ${f} is already registered`);let Q=this._createRegisteredResourceTemplate(f,h.title,v,h,J);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),Q}}_createRegisteredResource(f,v,h,J,Q){let W={name:f,title:v,metadata:J,readCallback:Q,enabled:!0,disable:()=>W.update({enabled:!1}),enable:()=>W.update({enabled:!0}),remove:()=>W.update({uri:null}),update:(X)=>{if(typeof X.uri!=="undefined"&&X.uri!==h){if(delete this._registeredResources[h],X.uri)this._registeredResources[X.uri]=W}if(typeof X.name!=="undefined")W.name=X.name;if(typeof X.title!=="undefined")W.title=X.title;if(typeof X.metadata!=="undefined")W.metadata=X.metadata;if(typeof X.callback!=="undefined")W.readCallback=X.callback;if(typeof X.enabled!=="undefined")W.enabled=X.enabled;this.sendResourceListChanged()}};return this._registeredResources[h]=W,W}_createRegisteredResourceTemplate(f,v,h,J,Q){let W={resourceTemplate:h,title:v,metadata:J,readCallback:Q,enabled:!0,disable:()=>W.update({enabled:!1}),enable:()=>W.update({enabled:!0}),remove:()=>W.update({name:null}),update:(X)=>{if(typeof X.name!=="undefined"&&X.name!==f){if(delete this._registeredResourceTemplates[f],X.name)this._registeredResourceTemplates[X.name]=W}if(typeof X.title!=="undefined")W.title=X.title;if(typeof X.template!=="undefined")W.resourceTemplate=X.template;if(typeof X.metadata!=="undefined")W.metadata=X.metadata;if(typeof X.callback!=="undefined")W.readCallback=X.callback;if(typeof X.enabled!=="undefined")W.enabled=X.enabled;this.sendResourceListChanged()}};return this._registeredResourceTemplates[f]=W,W}_createRegisteredPrompt(f,v,h,J,Q){let W={title:v,description:h,argsSchema:J===void 0?void 0:P.object(J),callback:Q,enabled:!0,disable:()=>W.update({enabled:!1}),enable:()=>W.update({enabled:!0}),remove:()=>W.update({name:null}),update:(X)=>{if(typeof X.name!=="undefined"&&X.name!==f){if(delete this._registeredPrompts[f],X.name)this._registeredPrompts[X.name]=W}if(typeof X.title!=="undefined")W.title=X.title;if(typeof X.description!=="undefined")W.description=X.description;if(typeof X.argsSchema!=="undefined")W.argsSchema=P.object(X.argsSchema);if(typeof X.callback!=="undefined")W.callback=X.callback;if(typeof X.enabled!=="undefined")W.enabled=X.enabled;this.sendPromptListChanged()}};return this._registeredPrompts[f]=W,W}_createRegisteredTool(f,v,h,J,Q,W,X){let Y={title:v,description:h,inputSchema:J===void 0?void 0:P.object(J),outputSchema:Q===void 0?void 0:P.object(Q),annotations:W,callback:X,enabled:!0,disable:()=>Y.update({enabled:!1}),enable:()=>Y.update({enabled:!0}),remove:()=>Y.update({name:null}),update:(B)=>{if(typeof B.name!=="undefined"&&B.name!==f){if(delete this._registeredTools[f],B.name)this._registeredTools[B.name]=Y}if(typeof B.title!=="undefined")Y.title=B.title;if(typeof B.description!=="undefined")Y.description=B.description;if(typeof B.paramsSchema!=="undefined")Y.inputSchema=P.object(B.paramsSchema);if(typeof B.callback!=="undefined")Y.callback=B.callback;if(typeof B.annotations!=="undefined")Y.annotations=B.annotations;if(typeof B.enabled!=="undefined")Y.enabled=B.enabled;this.sendToolListChanged()}};return this._registeredTools[f]=Y,this.setToolRequestHandlers(),this.sendToolListChanged(),Y}tool(f,...v){if(this._registeredTools[f])throw new Error(`Tool ${f} is already registered`);let h,J,Q,W;if(typeof v[0]==="string")h=v.shift();if(v.length>1){let Y=v[0];if(qJ(Y)){if(J=v.shift(),v.length>1&&typeof v[0]==="object"&&v[0]!==null&&!qJ(v[0]))W=v.shift()}else if(typeof Y==="object"&&Y!==null)W=v.shift()}let X=v[0];return this._createRegisteredTool(f,void 0,h,J,Q,W,X)}registerTool(f,v,h){if(this._registeredTools[f])throw new Error(`Tool ${f} is already registered`);let{title:J,description:Q,inputSchema:W,outputSchema:X,annotations:Y}=v;return this._createRegisteredTool(f,J,Q,W,X,Y,h)}prompt(f,...v){if(this._registeredPrompts[f])throw new Error(`Prompt ${f} is already registered`);let h;if(typeof v[0]==="string")h=v.shift();let J;if(v.length>1)J=v.shift();let Q=v[0],W=this._createRegisteredPrompt(f,void 0,h,J,Q);return this.setPromptRequestHandlers(),this.sendPromptListChanged(),W}registerPrompt(f,v,h){if(this._registeredPrompts[f])throw new Error(`Prompt ${f} is already registered`);let{title:J,description:Q,argsSchema:W}=v,X=this._createRegisteredPrompt(f,J,Q,W,h);return this.setPromptRequestHandlers(),this.sendPromptListChanged(),X}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 m5={type:"object",properties:{}};function qJ(f){if(typeof f!=="object"||f===null)return!1;return Object.keys(f).length===0||Object.values(f).some(a5)}function a5(f){return f!==null&&typeof f==="object"&&"parse"in f&&typeof f.parse==="function"&&"safeParse"in f&&typeof f.safeParse==="function"}function c5(f){return Object.entries(f.shape).map(([v,h])=>({name:v,description:h.description,required:!h.isOptional()}))}function DJ(f){return{completion:{values:f.slice(0,100),total:f.length,hasMore:f.length>100}}}var R0={completion:{values:[],hasMore:!1}};function HJ(f,v){let h=process.argv,J=`--${f}=`;for(let Q of h)if(Q.startsWith(J))return Q.substring(J.length);return v}rf();var n5=sv("FigmaConfig",1),lQ=HJ("figma-api-key")||process.env.FIGMA_API_KEY||process.env.personalToken||"",$J="F2C MCP",jJ=process.env.FIGMA_VERSION||"0.0.1";n5.debug("DEFAULT_PERSONAL_TOKEN",lQ);av();var VJ=require("node:crypto");rf();var Ev=sv("ptdTool"),Iv=null,k1=0,LJ=10,i5=1000,l0=null,d5=process.argv.slice(2),MJ=d5.find((f)=>f.startsWith("--server=")),_0=MJ?MJ.split("=")[1]:"localhost",EJ=_0==="localhost"?`ws://${_0}`:`wss://${_0}`,jf=new Map;function kQ(f=3055){if(Iv&&Iv.readyState===WebSocket.OPEN){Ev.info("Already connected to Figma");return}let v=_0==="localhost"?`${EJ}:${f}`:EJ;Ev.info(`Connecting to Figma socket server at ${v}...`),Iv=new WebSocket(v),Ev.info("Connecting",Iv.readyState,WebSocket.OPEN),Iv.onopen=()=>{Ev.info("Successfully connected to Figma socket server"),l0=null,k1=0},Iv.onmessage=(h)=>{try{let J=JSON.parse(h.data);if(Ev.log("onmessage"+JSON.stringify(J)),J.type==="ping"){Iv?.send(JSON.stringify({type:"pong"}));return}let Q=J.message;if(Q.id&&jf.has(Q.id)&&Q.result){let W=jf.get(Q.id);if(clearTimeout(W.timeout),Q.error)Ev.error(`Error from Figma: ${Q.error}`),W.reject(new Error(Q.error));else if(Q.result)W.resolve(Q.result);jf.delete(Q.id)}else Ev.info(`Received broadcast message: ${JSON.stringify(Q)}`)}catch(J){Ev.error(`Error parsing message: ${J instanceof Error?J.message:String(J)}`)}},Iv.onerror=(h)=>{Ev.error(`Socket error: ${h instanceof Error?h.message:String(h)}`,h)},Iv.onclose=(h)=>{Ev.info(`Disconnected from Figma socket server, Code: ${h.code}, Reason: ${h.reason}`),Iv=null;for(let[J,Q]of jf.entries())clearTimeout(Q.timeout),Q.reject(new Error("Connection closed")),jf.delete(J);if(k1<LJ){let J=i5*2**k1;Ev.info(`Attempting to reconnect in ${J/1000} seconds... (Attempt ${k1+1}/${LJ})`),setTimeout(()=>kQ(f),J),k1++}else Ev.error("Max reconnection attempts reached. Will not try again.")}}async function FJ(){try{console.log("FigmaMCP server starting...");let f=process.env.PORT?Number.parseInt(process.env.PORT,10):3055;kQ(f)}catch(f){Ev.warn(`Could not connect to Figma initially: ${f instanceof Error?f.message:String(f)}`),Ev.warn("Will try to connect when the first command is sent")}Ev.info("FigmaMCP server running on stdio")}async function NJ(f){if(!Iv||Iv.readyState!==WebSocket.OPEN)throw new Error("Not connected to Figma");try{await s("join",{channel:f}),l0=f,Ev.info(`Joined channel: ${f}`)}catch(v){throw Ev.error(`Failed to join channel: ${v instanceof Error?v.message:String(v)}`),v}}function s(f,v={},h=30000){return Ev.info("sendCommandToFigmaReq",f,v),new Promise((J,Q)=>{if(!Iv||Iv.readyState!==WebSocket.OPEN){kQ(),Q(new Error("Not connected to Figma. Attempting to connect..."));return}if(f!=="join"&&!l0){Q(new Error("Must join a channel before sending commands"));return}let X=VJ.randomUUID(),Y={id:X,type:f==="join"?"join":"message",...f==="join"?{channel:v.channel}:{channel:l0},message:{id:X,command:f,params:{...v,commandId:X}}};Ev.info(`Sending command to Figma: ${JSON.stringify(Y)}`);let B=setTimeout(()=>{if(jf.has(X)){let{reject:q,...D}=jf.get(X);Ev.error(`Request to Figma timed out after ${h/1000} seconds. Request details: ${JSON.stringify(D)}`),jf.delete(X),Q(new Error("Request to Figma timed out"))}},h);jf.set(X,{resolve:J,reject:Q,timeout:B,lastActivity:Date.now()}),Ev.info(`Request details: ${JSON.stringify(Y)}`),Iv.send(JSON.stringify(Y))})}rf();var gQ=x1(require("fs")),g1=x1(require("path"));rf();var yQ=sv("filterComponent");function t5(f){return f.meta.component_sets.map((v)=>({key:v.key,name:v.name,description:v.description}))}function s5(f){let v={};return f.forEach((h)=>{let J="其他组件";if(h.name.includes("导航")||h.name.includes("步骤")||h.name.includes("Menu"))J="导航组件";else if(h.name.includes("反馈")||h.name.includes("缺省")||h.name.includes("Result"))J="反馈组件";else if(h.name.includes("Table")||h.name.includes("表格"))J="数据展示";else if(h.name.includes("Input")||h.name.includes("Tag")||h.name.includes("Select"))J="数据录入";else if(h.name.includes("Button")||h.name.includes("按钮"))J="通用组件";else if(h.name.includes("时间")||h.name.includes("Timeline")||h.name.includes("Badge")||h.name.includes("Watermark"))J="数据展示";if(!v[J])v[J]=[];v[J].push(h)}),Object.entries(v).map(([h,J])=>({name:h,components:J.sort((Q,W)=>Q.name.localeCompare(W.name))})).sort((h,J)=>h.name.localeCompare(J.name))}function o5(f){let v=s5(f),h=`---
|
|
7
|
-
`;return h+=`description: Figma组件库文档
|
|
8
|
-
`,h+=`globs:
|
|
9
|
-
`,h+=`alwaysApply: true
|
|
10
|
-
`,h+=`---
|
|
11
|
-
|
|
12
|
-
`,h+=`# Figma 组件库文档
|
|
13
|
-
|
|
14
|
-
`,h+=`本文档包含了从 Figma 设计系统中提取的组件信息,包括组件的基本属性和描述。
|
|
15
|
-
|
|
16
|
-
`,h+=`> 共包含 ${f.length} 个组件,分为 ${v.length} 个类别
|
|
17
|
-
|
|
18
|
-
`,h+=`## 组件概览
|
|
19
|
-
|
|
20
|
-
`,h+=`|类别|组件数量|组件列表|
|
|
21
|
-
`,h+=`|---|---|---|
|
|
22
|
-
`,v.forEach((J)=>{let Q=J.components.map((W)=>W.name).join("、");h+=`|${J.name}|${J.components.length}|${Q}|
|
|
23
|
-
`}),h+=`
|
|
24
|
-
`,h+=`## 目录
|
|
25
|
-
|
|
26
|
-
`,v.forEach((J,Q)=>{h+=`### ${J.name}
|
|
27
|
-
|
|
28
|
-
`,J.components.forEach((W,X)=>{let Y=W.name.toLowerCase().replace(/[^a-z0-9\u4e00-\u9fa5]/g,"-");h+=`${Q+1}.${X+1} [${W.name}](#${Y})
|
|
29
|
-
`}),h+=`
|
|
30
|
-
`}),v.forEach((J,Q)=>{h+=`## ${J.name}
|
|
31
|
-
|
|
32
|
-
`,J.components.forEach((W,X)=>{if(h+=`### ${W.name}
|
|
33
|
-
|
|
34
|
-
`,W.description&&W.description.trim())h+=`${W.description}
|
|
35
|
-
|
|
36
|
-
`;else h+=`暂无组件描述。
|
|
37
|
-
|
|
38
|
-
`;if(h+=`#### 组件属性
|
|
39
|
-
|
|
40
|
-
`,h+=`|属性|说明|默认值|
|
|
41
|
-
`,h+=`|---|---|---|
|
|
42
|
-
`,h+=`|key|组件唯一标识|\`${W.key}\`|
|
|
43
|
-
`,h+=`|name|组件名称|${W.name}|
|
|
44
|
-
`,h+=`|description|组件描述|${W.description||"暂无描述"}|
|
|
45
|
-
`,h+=`
|
|
46
|
-
`,!(Q===v.length-1&&X===J.components.length-1))h+=`---
|
|
47
|
-
|
|
48
|
-
`})}),h}async function e5(f,v){if(!f||typeof f!=="string")throw new Error("内容不能为空且必须是字符串类型");if(!v||typeof v!=="string")throw new Error("文件路径不能为空且必须是字符串类型");let h;if(g1.default.isAbsolute(v))h=v;else{let Q=process.cwd();h=g1.default.resolve(Q,v)}let J=g1.default.normalize(h);if(J.includes(".."))throw new Error("文件路径不安全,包含相对路径");try{let Q=g1.default.dirname(J);await gQ.default.promises.mkdir(Q,{recursive:!0}),await gQ.default.promises.writeFile(J,f,"utf8"),yQ.log(`Markdown文件已保存到: ${J}`)}catch(Q){let W=`保存文件失败 [${J}]: ${Q instanceof Error?Q.message:String(Q)}`;throw yQ.error(W),new Error(W)}}function UJ(f,v="./components.md"){try{let h=t5(f),J=o5(h);e5(J,v),yQ.log(`成功处理 ${h.length} 个组件`)}catch(h){throw console.error("处理组件数据时出错:",h),h}}var vX=sv("ptdTool"),fX=(f)=>{f.tool("get_file_components_set_or_component","Retrieve the list of published component sets or components in the file library. If a file link is provided, extract the filekey to obtain the component set list. If a component key is provided, obtain individual component information",{fileKey:P.string().describe("The Figma file identifier found in the file URL"),componentKey:P.string().describe("The Figma component identifier found in the component URL")},async({fileKey:v,componentKey:h})=>{try{let J=lQ;if(vX.log("token",J),!J)return{content:[{type:"text",text:JSON.stringify({success:!1,error:"Personal token not found. Please provide personalToken parameter or set FIGMA_API_KEY environment variable."})}]};if(v){let Q=await fetch(`https://api.figma.com/v1/files/${v}/component_sets`,{headers:{"X-Figma-Token":J}});if(!Q.ok){let Y=await Q.text();return{content:[{type:"text",text:JSON.stringify({success:!1,error:`API request failed: ${Q.status} ${Q.statusText}`,details:Y})}]}}let W=await Q.json(),X=Date.now();if(W.meta.component_sets){let Y=`./generated-ui/components_${X}.md`;UJ(W,Y)}return{content:[{type:"text",text:JSON.stringify({success:!0,fileKey:v,randomId:X})}]}}else if(h){let Q=await fetch(`https://api.figma.com/v1/components/${h}`,{headers:{"X-Figma-Token":J}});if(!Q.ok){let X=await Q.text();return{content:[{type:"text",text:JSON.stringify({success:!1,error:`API request failed: ${Q.status} ${Q.statusText}`,details:X})}]}}let W=await Q.json();return{content:[{type:"text",text:JSON.stringify({success:!0,componentKey:h,component:W})}]}}return{content:[{type:"text",text:JSON.stringify({success:!1,error:"Error getting file components: please provide fileKey or componentKey"})}]}}catch(J){return{content:[{type:"text",text:JSON.stringify({success:!1,error:`Error getting file components: ${J instanceof Error?J.message:String(J)}`})}]}}}),f.tool("get_component","Get detailed information about a specific component by its key",{componentKey:P.string().describe("The unique key identifier of the component"),personalToken:P.string().optional().describe("Optional personal token, will use environment token if not provided")},async({componentKey:v,personalToken:h})=>{try{let J=h;if(!J){if(J=process.env.personalToken,!J)return{content:[{type:"text",text:JSON.stringify({success:!1,error:"Personal token not found. Please provide personalToken parameter or set FIGMA_API_KEY environment variable."})}]}}let Q=await fetch(`https://api.figma.com/v1/components/${v}`,{headers:{"X-Figma-Token":J}});if(!Q.ok){let X=await Q.text();return{content:[{type:"text",text:JSON.stringify({success:!1,error:`API request failed: ${Q.status} ${Q.statusText}`,details:X})}]}}let W=await Q.json();return{content:[{type:"text",text:JSON.stringify({success:!0,componentKey:v,component:W})}]}}catch(J){return{content:[{type:"text",text:JSON.stringify({success:!1,error:`Error getting component: ${J instanceof Error?J.message:String(J)}`})}]}}}),f.tool("get_instance_overrides","Get all override properties from a selected component instance. These overrides can be applied to other instances, which will swap them to match the source component.",{nodeId:P.string().optional().describe("Optional ID of the component instance to get overrides from. If not provided, currently selected instance will be used.")},async({nodeId:v})=>{try{let J=await s("get_instance_overrides",{instanceNodeId:v||null});return{content:[{type:"text",text:J.success?`Successfully got instance overrides: ${J.message}`:`Failed to get instance overrides: ${J.message}`}]}}catch(h){return{content:[{type:"text",text:`Error copying instance overrides: ${h instanceof Error?h.message:String(h)}`}]}}})},zJ=fX;rf();av();av();var QX=(f)=>{f.tool("join_channel","Join a specific channel to communicate with Figma",{channel:P.string().describe("The name of the channel to join").default("")},async({channel:v})=>{try{if(!v)return{content:[{type:"text",text:"Please provide a channel name to join:"}],followUp:{tool:"join_channel",description:"Join the specified channel"}};return await NJ(v),{content:[{type:"text",text:`Successfully joined channel: ${v}`}]}}catch(h){return{content:[{type:"text",text:`Error joining channel: ${h instanceof Error?h.message:String(h)}`}]}}})},AJ=QX;av();var hX=(f)=>{f.tool("create_rectangle","Create a new rectangle in Figma",{x:P.number().describe("X position"),y:P.number().describe("Y position"),width:P.number().describe("Width of the rectangle"),height:P.number().describe("Height of the rectangle"),name:P.string().optional().describe("Optional name for the rectangle"),parentId:P.string().optional().describe("Optional parent node ID to append the rectangle to")},async({x:v,y:h,width:J,height:Q,name:W,parentId:X})=>{try{let Y=await s("create_rectangle",{x:v,y:h,width:J,height:Q,name:W||"Rectangle",parentId:X});return{content:[{type:"text",text:`Created rectangle "${JSON.stringify(Y)}"`}]}}catch(Y){return{content:[{type:"text",text:`Error creating rectangle: ${Y instanceof Error?Y.message:String(Y)}`}]}}}),f.tool("create_frame","Create a new frame in Figma",{x:P.number().describe("X position"),y:P.number().describe("Y position"),width:P.number().describe("Width of the frame"),height:P.number().describe("Height of the frame"),name:P.string().optional().describe("Optional name for the frame"),parentId:P.string().optional().describe("Optional parent node ID to append the frame to"),fillColor:P.object({r:P.number().min(0).max(1).describe("Red component (0-1)"),g:P.number().min(0).max(1).describe("Green component (0-1)"),b:P.number().min(0).max(1).describe("Blue component (0-1)"),a:P.number().min(0).max(1).optional().describe("Alpha component (0-1)")}).optional().describe("Fill color in RGBA format"),strokeColor:P.object({r:P.number().min(0).max(1).describe("Red component (0-1)"),g:P.number().min(0).max(1).describe("Green component (0-1)"),b:P.number().min(0).max(1).describe("Blue component (0-1)"),a:P.number().min(0).max(1).optional().describe("Alpha component (0-1)")}).optional().describe("Stroke color in RGBA format"),strokeWeight:P.number().positive().optional().describe("Stroke weight"),layoutMode:P.enum(["NONE","HORIZONTAL","VERTICAL"]).optional().describe("Auto-layout mode for the frame"),layoutWrap:P.enum(["NO_WRAP","WRAP"]).optional().describe("Whether the auto-layout frame wraps its children"),paddingTop:P.number().optional().describe("Top padding for auto-layout frame"),paddingRight:P.number().optional().describe("Right padding for auto-layout frame"),paddingBottom:P.number().optional().describe("Bottom padding for auto-layout frame"),paddingLeft:P.number().optional().describe("Left padding for auto-layout frame"),primaryAxisAlignItems:P.enum(["MIN","MAX","CENTER","SPACE_BETWEEN"]).optional().describe("Primary axis alignment for auto-layout frame. Note: When set to SPACE_BETWEEN, itemSpacing will be ignored as children will be evenly spaced."),counterAxisAlignItems:P.enum(["MIN","MAX","CENTER","BASELINE"]).optional().describe("Counter axis alignment for auto-layout frame"),layoutSizingHorizontal:P.enum(["FIXED","HUG","FILL"]).optional().describe("Horizontal sizing mode for auto-layout frame"),layoutSizingVertical:P.enum(["FIXED","HUG","FILL"]).optional().describe("Vertical sizing mode for auto-layout frame"),itemSpacing:P.number().optional().describe("Distance between children in auto-layout frame. Note: This value will be ignored if primaryAxisAlignItems is set to SPACE_BETWEEN.")},async({x:v,y:h,width:J,height:Q,name:W,parentId:X,fillColor:Y,strokeColor:B,strokeWeight:q,layoutMode:D,layoutWrap:j,paddingTop:L,paddingRight:G,paddingBottom:O,paddingLeft:M,primaryAxisAlignItems:K,counterAxisAlignItems:F,layoutSizingHorizontal:S,layoutSizingVertical:N,itemSpacing:A})=>{try{let k=await s("create_frame",{x:v,y:h,width:J,height:Q,name:W||"Frame",parentId:X,fillColor:Y||{r:1,g:1,b:1,a:1},strokeColor:B,strokeWeight:q,layoutMode:D,layoutWrap:j,paddingTop:L,paddingRight:G,paddingBottom:O,paddingLeft:M,primaryAxisAlignItems:K,counterAxisAlignItems:F,layoutSizingHorizontal:S,layoutSizingVertical:N,itemSpacing:A});return{content:[{type:"text",text:`Created frame "${k.name}" with ID: ${k.id}. Use the ID as the parentId to appendChild inside this frame.`}]}}catch(b){return{content:[{type:"text",text:`Error creating frame: ${b instanceof Error?b.message:String(b)}`}]}}}),f.tool("create_text","Create a new text element in Figma",{x:P.number().describe("X position"),y:P.number().describe("Y position"),text:P.string().describe("Text content"),fontSize:P.number().optional().describe("Font size (default: 14)"),fontWeight:P.number().optional().describe("Font weight (e.g., 400 for Regular, 700 for Bold)"),fontColor:P.object({r:P.number().min(0).max(1).describe("Red component (0-1)"),g:P.number().min(0).max(1).describe("Green component (0-1)"),b:P.number().min(0).max(1).describe("Blue component (0-1)"),a:P.number().min(0).max(1).optional().describe("Alpha component (0-1)")}).optional().describe("Font color in RGBA format"),name:P.string().optional().describe("Semantic layer name for the text node"),parentId:P.string().optional().describe("Optional parent node ID to append the text to")},async({x:v,y:h,text:J,fontSize:Q,fontWeight:W,fontColor:X,name:Y,parentId:B})=>{try{let D=await s("create_text",{x:v,y:h,text:J,fontSize:Q||14,fontWeight:W||400,fontColor:X||{r:0,g:0,b:0,a:1},name:Y||"Text",parentId:B});return{content:[{type:"text",text:`Created text "${D.name}" with ID: ${D.id}`}]}}catch(q){return{content:[{type:"text",text:`Error creating text: ${q instanceof Error?q.message:String(q)}`}]}}}),f.tool("set_fill_color","Set the fill color of a node in Figma can be TextNode or FrameNode",{nodeId:P.string().describe("The ID of the node to modify"),r:P.number().min(0).max(1).describe("Red component (0-1)"),g:P.number().min(0).max(1).describe("Green component (0-1)"),b:P.number().min(0).max(1).describe("Blue component (0-1)"),a:P.number().min(0).max(1).optional().describe("Alpha component (0-1)")},async({nodeId:v,r:h,g:J,b:Q,a:W})=>{try{return{content:[{type:"text",text:`Set fill color of node "${(await s("set_fill_color",{nodeId:v,color:{r:h,g:J,b:Q,a:W||1}})).name}" to RGBA(${h}, ${J}, ${Q}, ${W||1})`}]}}catch(X){return{content:[{type:"text",text:`Error setting fill color: ${X instanceof Error?X.message:String(X)}`}]}}}),f.tool("set_stroke_color","Set the stroke color of a node in Figma",{nodeId:P.string().describe("The ID of the node to modify"),r:P.number().min(0).max(1).describe("Red component (0-1)"),g:P.number().min(0).max(1).describe("Green component (0-1)"),b:P.number().min(0).max(1).describe("Blue component (0-1)"),a:P.number().min(0).max(1).optional().describe("Alpha component (0-1)"),weight:P.number().positive().optional().describe("Stroke weight")},async({nodeId:v,r:h,g:J,b:Q,a:W,weight:X})=>{try{return{content:[{type:"text",text:`Set stroke color of node "${(await s("set_stroke_color",{nodeId:v,color:{r:h,g:J,b:Q,a:W||1},weight:X||1})).name}" to RGBA(${h}, ${J}, ${Q}, ${W||1}) with weight ${X||1}`}]}}catch(Y){return{content:[{type:"text",text:`Error setting stroke color: ${Y instanceof Error?Y.message:String(Y)}`}]}}}),f.tool("set_text_content","Set the text content of an existing text node in Figma",{nodeId:P.string().describe("The ID of the text node to modify"),text:P.string().describe("New text content")},async({nodeId:v,text:h})=>{try{return{content:[{type:"text",text:`Updated text content of node "${(await s("set_text_content",{nodeId:v,text:h})).name}" to "${h}"`}]}}catch(J){return{content:[{type:"text",text:`Error setting text content: ${J instanceof Error?J.message:String(J)}`}]}}}),f.tool("set_multiple_annotations","Set multiple annotations parallelly in a node",{nodeId:P.string().describe("The ID of the node containing the elements to annotate"),annotations:P.array(P.object({nodeId:P.string().describe("The ID of the node to annotate"),labelMarkdown:P.string().describe("The annotation text in markdown format"),categoryId:P.string().optional().describe("The ID of the annotation category"),annotationId:P.string().optional().describe("The ID of the annotation to update (if updating existing annotation)"),properties:P.array(P.object({type:P.string()})).optional().describe("Additional properties for the annotation")})).describe("Array of annotations to apply")},async({nodeId:v,annotations:h},J)=>{try{if(!h||h.length===0)return{content:[{type:"text",text:"No annotations provided"}]};let Q={type:"text",text:`Starting annotation process for ${h.length} nodes. This will be processed in batches of 5...`},W=0,X=h.length,B=await s("set_multiple_annotations",{nodeId:v,annotations:h}),q=B.annotationsApplied&&B.annotationsApplied>0,D=`
|
|
2
|
+
var C1=Object.create;var{getPrototypeOf:I1,defineProperty:C3,getOwnPropertyNames:T1}=Object;var x1=Object.prototype.hasOwnProperty;var y1=($,X,Q)=>{Q=$!=null?C1(I1($)):{};let Y=X||!$||!$.__esModule?C3(Q,"default",{value:$,enumerable:!0}):Q;for(let G of T1($))if(!x1.call(Y,G))C3(Y,G,{get:()=>$[G],enumerable:!0});return Y};var t6=($,X)=>()=>(X||$((X={exports:{}}).exports,X),X.exports);var h1=($,X)=>{for(var Q in X)C3($,Q,{get:X[Q],enumerable:!0,configurable:!0,set:(Y)=>X[Q]=()=>Y})};var g=($,X)=>()=>($&&(X=$($=0)),X);var L,I3,M,t=($)=>{switch(typeof $){case"undefined":return M.undefined;case"string":return M.string;case"number":return Number.isNaN($)?M.nan:M.number;case"boolean":return M.boolean;case"function":return M.function;case"bigint":return M.bigint;case"symbol":return M.symbol;case"object":if(Array.isArray($))return M.array;if($===null)return M.null;if($.then&&typeof $.then==="function"&&$.catch&&typeof $.catch==="function")return M.promise;if(typeof Map!=="undefined"&&$ instanceof Map)return M.map;if(typeof Set!=="undefined"&&$ instanceof Set)return M.set;if(typeof Date!=="undefined"&&$ instanceof Date)return M.date;return M.object;default:return M.unknown}};var I$=g(()=>{(function($){$.assertEqual=(G)=>{};function X(G){}$.assertIs=X;function Q(G){throw new Error}$.assertNever=Q,$.arrayToEnum=(G)=>{let W={};for(let H of G)W[H]=H;return W},$.getValidEnumValues=(G)=>{let W=$.objectKeys(G).filter((B)=>typeof G[G[B]]!=="number"),H={};for(let B of W)H[B]=G[B];return $.objectValues(H)},$.objectValues=(G)=>{return $.objectKeys(G).map(function(W){return G[W]})},$.objectKeys=typeof Object.keys==="function"?(G)=>Object.keys(G):(G)=>{let W=[];for(let H in G)if(Object.prototype.hasOwnProperty.call(G,H))W.push(H);return W},$.find=(G,W)=>{for(let H of G)if(W(H))return H;return},$.isInteger=typeof Number.isInteger==="function"?(G)=>Number.isInteger(G):(G)=>typeof G==="number"&&Number.isFinite(G)&&Math.floor(G)===G;function Y(G,W=" | "){return G.map((H)=>typeof H==="string"?`'${H}'`:H).join(W)}$.joinValues=Y,$.jsonStringifyReplacer=(G,W)=>{if(typeof W==="bigint")return W.toString();return W}})(L||(L={}));(function($){$.mergeShapes=(X,Q)=>{return{...X,...Q}}})(I3||(I3={}));M=L.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"])});var w,Z1=($)=>{return JSON.stringify($,null,2).replace(/"([^"]+)":/g,"$1:")},h;var r$=g(()=>{I$();w=L.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"]);h=class h extends Error{get errors(){return this.issues}constructor($){super();this.issues=[],this.addIssue=(Q)=>{this.issues=[...this.issues,Q]},this.addIssues=(Q=[])=>{this.issues=[...this.issues,...Q]};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(G){return G.message},Q={_errors:[]},Y=(G)=>{for(let W of G.issues)if(W.code==="invalid_union")W.unionErrors.map(Y);else if(W.code==="invalid_return_type")Y(W.returnTypeError);else if(W.code==="invalid_arguments")Y(W.argumentsError);else if(W.path.length===0)Q._errors.push(X(W));else{let H=Q,B=0;while(B<W.path.length){let D=W.path[B];if(B!==W.path.length-1)H[D]=H[D]||{_errors:[]};else H[D]=H[D]||{_errors:[]},H[D]._errors.push(X(W));H=H[D],B++}}};return Y(this),Q}static assert($){if(!($ instanceof h))throw new Error(`Not a ZodError: ${$}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,L.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten($=(X)=>X.message){let X={},Q=[];for(let Y of this.issues)if(Y.path.length>0){let G=Y.path[0];X[G]=X[G]||[],X[G].push($(Y))}else Q.push($(Y));return{formErrors:Q,fieldErrors:X}}get formErrors(){return this.flatten()}};h.create=($)=>{return new h($)}});var g1=($,X)=>{let Q;switch($.code){case w.invalid_type:if($.received===M.undefined)Q="Required";else Q=`Expected ${$.expected}, received ${$.received}`;break;case w.invalid_literal:Q=`Invalid literal value, expected ${JSON.stringify($.expected,L.jsonStringifyReplacer)}`;break;case w.unrecognized_keys:Q=`Unrecognized key(s) in object: ${L.joinValues($.keys,", ")}`;break;case w.invalid_union:Q="Invalid input";break;case w.invalid_union_discriminator:Q=`Invalid discriminator value. Expected ${L.joinValues($.options)}`;break;case w.invalid_enum_value:Q=`Invalid enum value. Expected ${L.joinValues($.options)}, received '${$.received}'`;break;case w.invalid_arguments:Q="Invalid function arguments";break;case w.invalid_return_type:Q="Invalid function return type";break;case w.invalid_date:Q="Invalid date";break;case w.invalid_string:if(typeof $.validation==="object")if("includes"in $.validation){if(Q=`Invalid input: must include "${$.validation.includes}"`,typeof $.validation.position==="number")Q=`${Q} at one or more positions greater than or equal to ${$.validation.position}`}else if("startsWith"in $.validation)Q=`Invalid input: must start with "${$.validation.startsWith}"`;else if("endsWith"in $.validation)Q=`Invalid input: must end with "${$.validation.endsWith}"`;else L.assertNever($.validation);else if($.validation!=="regex")Q=`Invalid ${$.validation}`;else Q="Invalid";break;case w.too_small:if($.type==="array")Q=`Array must contain ${$.exact?"exactly":$.inclusive?"at least":"more than"} ${$.minimum} element(s)`;else if($.type==="string")Q=`String must contain ${$.exact?"exactly":$.inclusive?"at least":"over"} ${$.minimum} character(s)`;else if($.type==="number")Q=`Number must be ${$.exact?"exactly equal to ":$.inclusive?"greater than or equal to ":"greater than "}${$.minimum}`;else if($.type==="bigint")Q=`Number must be ${$.exact?"exactly equal to ":$.inclusive?"greater than or equal to ":"greater than "}${$.minimum}`;else if($.type==="date")Q=`Date must be ${$.exact?"exactly equal to ":$.inclusive?"greater than or equal to ":"greater than "}${new Date(Number($.minimum))}`;else Q="Invalid input";break;case w.too_big:if($.type==="array")Q=`Array must contain ${$.exact?"exactly":$.inclusive?"at most":"less than"} ${$.maximum} element(s)`;else if($.type==="string")Q=`String must contain ${$.exact?"exactly":$.inclusive?"at most":"under"} ${$.maximum} character(s)`;else if($.type==="number")Q=`Number must be ${$.exact?"exactly":$.inclusive?"less than or equal to":"less than"} ${$.maximum}`;else if($.type==="bigint")Q=`BigInt must be ${$.exact?"exactly":$.inclusive?"less than or equal to":"less than"} ${$.maximum}`;else if($.type==="date")Q=`Date must be ${$.exact?"exactly":$.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number($.maximum))}`;else Q="Invalid input";break;case w.custom:Q="Invalid input";break;case w.invalid_intersection_types:Q="Intersection results could not be merged";break;case w.not_multiple_of:Q=`Number must be a multiple of ${$.multipleOf}`;break;case w.not_finite:Q="Number must be finite";break;default:Q=X.defaultError,L.assertNever($)}return{message:Q}},Q$;var T3=g(()=>{r$();I$();Q$=g1});function l1($){J0=$}function b$(){return J0}var J0;var t$=g(()=>{T3();J0=Q$});function N($,X){let Q=b$(),Y=T$({issueData:X,data:$.data,path:$.path,errorMaps:[$.common.contextualErrorMap,$.schemaErrorMap,Q,Q===Q$?void 0:Q$].filter((G)=>!!G)});$.common.issues.push(Y)}class f{constructor(){this.value="valid"}dirty(){if(this.value==="valid")this.value="dirty"}abort(){if(this.value!=="aborted")this.value="aborted"}static mergeArray($,X){let Q=[];for(let Y of X){if(Y.status==="aborted")return A;if(Y.status==="dirty")$.dirty();Q.push(Y.value)}return{status:$.value,value:Q}}static async mergeObjectAsync($,X){let Q=[];for(let Y of X){let G=await Y.key,W=await Y.value;Q.push({key:G,value:W})}return f.mergeObjectSync($,Q)}static mergeObjectSync($,X){let Q={};for(let Y of X){let{key:G,value:W}=Y;if(G.status==="aborted")return A;if(W.status==="aborted")return A;if(G.status==="dirty")$.dirty();if(W.status==="dirty")$.dirty();if(G.value!=="__proto__"&&(typeof W.value!=="undefined"||Y.alwaysSet))Q[G.value]=W.value}return{status:$.value,value:Q}}}var T$=($)=>{let{data:X,path:Q,errorMaps:Y,issueData:G}=$,W=[...Q,...G.path||[]],H={...G,path:W};if(G.message!==void 0)return{...G,path:W,message:G.message};let B="",D=Y.filter((V)=>!!V).slice().reverse();for(let V of D)B=V(H,{data:X,defaultError:B}).message;return{...G,path:W,message:B}},m1,A,V$=($)=>({status:"dirty",value:$}),C=($)=>({status:"valid",value:$}),s$=($)=>$.status==="aborted",e$=($)=>$.status==="dirty",W$=($)=>$.status==="valid",U$=($)=>typeof Promise!=="undefined"&&$ instanceof Promise;var x3=g(()=>{t$();T3();m1=[];A=Object.freeze({status:"aborted"})});var W0=()=>{};var O;var H0=g(()=>{(function($){$.errToObj=(X)=>typeof X==="string"?{message:X}:X||{},$.toString=(X)=>typeof X==="string"?X:X?.message})(O||(O={}))});class n{constructor($,X,Q,Y){this._cachedPath=[],this.parent=$,this.data=X,this._path=Q,this._key=Y}get path(){if(!this._cachedPath.length)if(Array.isArray(this._key))this._cachedPath.push(...this._path,...this._key);else this._cachedPath.push(...this._path,this._key);return this._cachedPath}}function U($){if(!$)return{};let{errorMap:X,invalid_type_error:Q,required_error:Y,description:G}=$;if(X&&(Q||Y))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);if(X)return{errorMap:X,description:G};return{errorMap:(H,B)=>{let{message:D}=$;if(H.code==="invalid_enum_value")return{message:D??B.defaultError};if(typeof B.data==="undefined")return{message:D??Y??B.defaultError};if(H.code!=="invalid_type")return{message:B.defaultError};return{message:D??Q??B.defaultError}},description:G}}class q{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 f,ctx:{common:$.parent.common,data:$.data,parsedType:t($.data),schemaErrorMap:this._def.errorMap,path:$.path,parent:$.parent}}}_parseSync($){let X=this._parse($);if(U$(X))throw new Error("Synchronous parse encountered promise.");return X}_parseAsync($){let X=this._parse($);return Promise.resolve(X)}parse($,X){let Q=this.safeParse($,X);if(Q.success)return Q.data;throw Q.error}safeParse($,X){let Q={common:{issues:[],async:X?.async??!1,contextualErrorMap:X?.errorMap},path:X?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:$,parsedType:t($)},Y=this._parseSync({data:$,path:Q.path,parent:Q});return B0(Q,Y)}"~validate"($){let X={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:$,parsedType:t($)};if(!this["~standard"].async)try{let Q=this._parseSync({data:$,path:[],parent:X});return W$(Q)?{value:Q.value}:{issues:X.common.issues}}catch(Q){if(Q?.message?.toLowerCase()?.includes("encountered"))this["~standard"].async=!0;X.common={issues:[],async:!0}}return this._parseAsync({data:$,path:[],parent:X}).then((Q)=>W$(Q)?{value:Q.value}:{issues:X.common.issues})}async parseAsync($,X){let Q=await this.safeParseAsync($,X);if(Q.success)return Q.data;throw Q.error}async safeParseAsync($,X){let Q={common:{issues:[],contextualErrorMap:X?.errorMap,async:!0},path:X?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:$,parsedType:t($)},Y=this._parse({data:$,path:Q.path,parent:Q}),G=await(U$(Y)?Y:Promise.resolve(Y));return B0(Q,G)}refine($,X){let Q=(Y)=>{if(typeof X==="string"||typeof X==="undefined")return{message:X};else if(typeof X==="function")return X(Y);else return X};return this._refinement((Y,G)=>{let W=$(Y),H=()=>G.addIssue({code:w.custom,...Q(Y)});if(typeof Promise!=="undefined"&&W instanceof Promise)return W.then((B)=>{if(!B)return H(),!1;else return!0});if(!W)return H(),!1;else return!0})}refinement($,X){return this._refinement((Q,Y)=>{if(!$(Q))return Y.addIssue(typeof X==="function"?X(Q,Y):X),!1;else return!0})}_refinement($){return new p({schema:this,typeName:_.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 c.create(this,this._def)}nullable(){return G$.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return u.create(this)}promise(){return A$.create(this,this._def)}or($){return F$.create([this,$],this._def)}and($){return z$.create(this,$,this._def)}transform($){return new p({...U(this._def),schema:this,typeName:_.ZodEffects,effect:{type:"transform",transform:$}})}default($){let X=typeof $==="function"?$:()=>$;return new f$({...U(this._def),innerType:this,defaultValue:X,typeName:_.ZodDefault})}brand(){return new X3({typeName:_.ZodBranded,type:this,...U(this._def)})}catch($){let X=typeof $==="function"?$:()=>$;return new P$({...U(this._def),innerType:this,catchValue:X,typeName:_.ZodCatch})}describe($){return new this.constructor({...this._def,description:$})}pipe($){return l$.create(this,$)}readonly(){return C$.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}function _0($){let X="[0-5]\\d";if($.precision)X=`${X}\\.\\d{${$.precision}}`;else if($.precision==null)X=`${X}(\\.\\d+)?`;let Q=$.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${X})${Q}`}function G2($){return new RegExp(`^${_0($)}$`)}function M0($){let X=`${w0}T${_0($)}`,Q=[];if(Q.push($.local?"Z?":"Z"),$.offset)Q.push("([+-]\\d{2}:?\\d{2})");return X=`${X}(${Q.join("|")})`,new RegExp(`^${X}$`)}function J2($,X){if((X==="v4"||!X)&&t1.test($))return!0;if((X==="v6"||!X)&&e1.test($))return!0;return!1}function W2($,X){if(!d1.test($))return!1;try{let[Q]=$.split(".");if(!Q)return!1;let Y=Q.replace(/-/g,"+").replace(/_/g,"/").padEnd(Q.length+(4-Q.length%4)%4,"="),G=JSON.parse(atob(Y));if(typeof G!=="object"||G===null)return!1;if("typ"in G&&G?.typ!=="JWT")return!1;if(!G.alg)return!1;if(X&&G.alg!==X)return!1;return!0}catch{return!1}}function H2($,X){if((X==="v4"||!X)&&s1.test($))return!0;if((X==="v6"||!X)&&$2.test($))return!0;return!1}function B2($,X){let Q=($.toString().split(".")[1]||"").length,Y=(X.toString().split(".")[1]||"").length,G=Q>Y?Q:Y,W=Number.parseInt($.toFixed(G).replace(".","")),H=Number.parseInt(X.toFixed(G).replace(".",""));return W%H/10**G}function q$($){if($ instanceof F){let X={};for(let Q in $.shape){let Y=$.shape[Q];X[Q]=c.create(q$(Y))}return new F({...$._def,shape:()=>X})}else if($ instanceof u)return new u({...$._def,type:q$($.element)});else if($ instanceof c)return c.create(q$($.unwrap()));else if($ instanceof G$)return G$.create(q$($.unwrap()));else if($ instanceof e)return e.create($.items.map((X)=>q$(X)));else return $}function h3($,X){let Q=t($),Y=t(X);if($===X)return{valid:!0,data:$};else if(Q===M.object&&Y===M.object){let G=L.objectKeys(X),W=L.objectKeys($).filter((B)=>G.indexOf(B)!==-1),H={...$,...X};for(let B of W){let D=h3($[B],X[B]);if(!D.valid)return{valid:!1};H[B]=D.data}return{valid:!0,data:H}}else if(Q===M.array&&Y===M.array){if($.length!==X.length)return{valid:!1};let G=[];for(let W=0;W<$.length;W++){let H=$[W],B=X[W],D=h3(H,B);if(!D.valid)return{valid:!1};G.push(D.data)}return{valid:!0,data:G}}else if(Q===M.date&&Y===M.date&&+$===+X)return{valid:!0,data:$};else return{valid:!1}}function V0($,X){return new w$({values:$,typeName:_.ZodEnum,...U(X)})}function D0($,X){let Q=typeof $==="function"?$(X):typeof $==="string"?{message:$}:$;return typeof Q==="string"?{message:Q}:Q}function N0($,X={},Q){if($)return O$.create().superRefine((Y,G)=>{let W=$(Y);if(W instanceof Promise)return W.then((H)=>{if(!H){let B=D0(X,Y),D=B.fatal??Q??!0;G.addIssue({code:"custom",...B,fatal:D})}});if(!W){let H=D0(X,Y),B=H.fatal??Q??!0;G.addIssue({code:"custom",...H,fatal:B})}return});return O$.create()}var B0=($,X)=>{if(W$(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 Q=new h($.common.issues);return this._error=Q,this._error}}}},u1,c1,n1,p1,i1,d1,o1,a1,r1="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",y3,t1,s1,e1,$2,X2,Q2,w0="((\\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])))",Y2,m,B$,D$,L$,N$,x$,E$,S$,O$,H$,s,y$,u,F,F$,Y$=($)=>{if($ instanceof R$)return Y$($.schema);else if($ instanceof p)return Y$($.innerType());else if($ instanceof v$)return[$.value];else if($ instanceof w$)return $.options;else if($ instanceof k$)return L.objectValues($.enum);else if($ instanceof f$)return Y$($._def.innerType);else if($ instanceof E$)return[void 0];else if($ instanceof S$)return[null];else if($ instanceof c)return[void 0,...Y$($.unwrap())];else if($ instanceof G$)return[null,...Y$($.unwrap())];else if($ instanceof X3)return Y$($.unwrap());else if($ instanceof C$)return Y$($.unwrap());else if($ instanceof P$)return Y$($._def.innerType);else return[]},$3,z$,e,h$,Z$,j$,K$,R$,v$,w$,k$,A$,p,c,G$,f$,P$,g$,D2,X3,l$,C$,w2,_,_2=($,X={message:`Input not instance of ${$.name}`})=>N0((Q)=>Q instanceof $,X),O0,j0,M2,V2,A0,N2,O2,j2,A2,b2,U2,q2,K2,L2,E2,S2,F2,z2,R2,v2,k2,f2,P2,C2,I2,T2,x2,y2,h2,Z2,g2,l2,m2,u2,c2=()=>O0().optional(),n2=()=>j0().optional(),p2=()=>A0().optional(),i2,d2;var b0=g(()=>{r$();t$();H0();x3();I$();u1=/^c[^\s-]{8,}$/i,c1=/^[0-9a-z]+$/,n1=/^[0-9A-HJKMNP-TV-Z]{26}$/i,p1=/^[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,i1=/^[a-z0-9_-]{21}$/i,d1=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,o1=/^[-+]?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)?)??$/,a1=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,t1=/^(?:(?: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])$/,s1=/^(?:(?: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])$/,e1=/^(([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]))$/,$2=/^(([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])$/,X2=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Q2=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Y2=new RegExp(`^${w0}$`);m=class m extends q{_parse($){if(this._def.coerce)$.data=String($.data);if(this._getType($)!==M.string){let G=this._getOrReturnCtx($);return N(G,{code:w.invalid_type,expected:M.string,received:G.parsedType}),A}let Q=new f,Y=void 0;for(let G of this._def.checks)if(G.kind==="min"){if($.data.length<G.value)Y=this._getOrReturnCtx($,Y),N(Y,{code:w.too_small,minimum:G.value,type:"string",inclusive:!0,exact:!1,message:G.message}),Q.dirty()}else if(G.kind==="max"){if($.data.length>G.value)Y=this._getOrReturnCtx($,Y),N(Y,{code:w.too_big,maximum:G.value,type:"string",inclusive:!0,exact:!1,message:G.message}),Q.dirty()}else if(G.kind==="length"){let W=$.data.length>G.value,H=$.data.length<G.value;if(W||H){if(Y=this._getOrReturnCtx($,Y),W)N(Y,{code:w.too_big,maximum:G.value,type:"string",inclusive:!0,exact:!0,message:G.message});else if(H)N(Y,{code:w.too_small,minimum:G.value,type:"string",inclusive:!0,exact:!0,message:G.message});Q.dirty()}}else if(G.kind==="email"){if(!a1.test($.data))Y=this._getOrReturnCtx($,Y),N(Y,{validation:"email",code:w.invalid_string,message:G.message}),Q.dirty()}else if(G.kind==="emoji"){if(!y3)y3=new RegExp(r1,"u");if(!y3.test($.data))Y=this._getOrReturnCtx($,Y),N(Y,{validation:"emoji",code:w.invalid_string,message:G.message}),Q.dirty()}else if(G.kind==="uuid"){if(!p1.test($.data))Y=this._getOrReturnCtx($,Y),N(Y,{validation:"uuid",code:w.invalid_string,message:G.message}),Q.dirty()}else if(G.kind==="nanoid"){if(!i1.test($.data))Y=this._getOrReturnCtx($,Y),N(Y,{validation:"nanoid",code:w.invalid_string,message:G.message}),Q.dirty()}else if(G.kind==="cuid"){if(!u1.test($.data))Y=this._getOrReturnCtx($,Y),N(Y,{validation:"cuid",code:w.invalid_string,message:G.message}),Q.dirty()}else if(G.kind==="cuid2"){if(!c1.test($.data))Y=this._getOrReturnCtx($,Y),N(Y,{validation:"cuid2",code:w.invalid_string,message:G.message}),Q.dirty()}else if(G.kind==="ulid"){if(!n1.test($.data))Y=this._getOrReturnCtx($,Y),N(Y,{validation:"ulid",code:w.invalid_string,message:G.message}),Q.dirty()}else if(G.kind==="url")try{new URL($.data)}catch{Y=this._getOrReturnCtx($,Y),N(Y,{validation:"url",code:w.invalid_string,message:G.message}),Q.dirty()}else if(G.kind==="regex"){if(G.regex.lastIndex=0,!G.regex.test($.data))Y=this._getOrReturnCtx($,Y),N(Y,{validation:"regex",code:w.invalid_string,message:G.message}),Q.dirty()}else if(G.kind==="trim")$.data=$.data.trim();else if(G.kind==="includes"){if(!$.data.includes(G.value,G.position))Y=this._getOrReturnCtx($,Y),N(Y,{code:w.invalid_string,validation:{includes:G.value,position:G.position},message:G.message}),Q.dirty()}else if(G.kind==="toLowerCase")$.data=$.data.toLowerCase();else if(G.kind==="toUpperCase")$.data=$.data.toUpperCase();else if(G.kind==="startsWith"){if(!$.data.startsWith(G.value))Y=this._getOrReturnCtx($,Y),N(Y,{code:w.invalid_string,validation:{startsWith:G.value},message:G.message}),Q.dirty()}else if(G.kind==="endsWith"){if(!$.data.endsWith(G.value))Y=this._getOrReturnCtx($,Y),N(Y,{code:w.invalid_string,validation:{endsWith:G.value},message:G.message}),Q.dirty()}else if(G.kind==="datetime"){if(!M0(G).test($.data))Y=this._getOrReturnCtx($,Y),N(Y,{code:w.invalid_string,validation:"datetime",message:G.message}),Q.dirty()}else if(G.kind==="date"){if(!Y2.test($.data))Y=this._getOrReturnCtx($,Y),N(Y,{code:w.invalid_string,validation:"date",message:G.message}),Q.dirty()}else if(G.kind==="time"){if(!G2(G).test($.data))Y=this._getOrReturnCtx($,Y),N(Y,{code:w.invalid_string,validation:"time",message:G.message}),Q.dirty()}else if(G.kind==="duration"){if(!o1.test($.data))Y=this._getOrReturnCtx($,Y),N(Y,{validation:"duration",code:w.invalid_string,message:G.message}),Q.dirty()}else if(G.kind==="ip"){if(!J2($.data,G.version))Y=this._getOrReturnCtx($,Y),N(Y,{validation:"ip",code:w.invalid_string,message:G.message}),Q.dirty()}else if(G.kind==="jwt"){if(!W2($.data,G.alg))Y=this._getOrReturnCtx($,Y),N(Y,{validation:"jwt",code:w.invalid_string,message:G.message}),Q.dirty()}else if(G.kind==="cidr"){if(!H2($.data,G.version))Y=this._getOrReturnCtx($,Y),N(Y,{validation:"cidr",code:w.invalid_string,message:G.message}),Q.dirty()}else if(G.kind==="base64"){if(!X2.test($.data))Y=this._getOrReturnCtx($,Y),N(Y,{validation:"base64",code:w.invalid_string,message:G.message}),Q.dirty()}else if(G.kind==="base64url"){if(!Q2.test($.data))Y=this._getOrReturnCtx($,Y),N(Y,{validation:"base64url",code:w.invalid_string,message:G.message}),Q.dirty()}else L.assertNever(G);return{status:Q.value,value:$.data}}_regex($,X,Q){return this.refinement((Y)=>$.test(Y),{validation:X,code:w.invalid_string,...O.errToObj(Q)})}_addCheck($){return new m({...this._def,checks:[...this._def.checks,$]})}email($){return this._addCheck({kind:"email",...O.errToObj($)})}url($){return this._addCheck({kind:"url",...O.errToObj($)})}emoji($){return this._addCheck({kind:"emoji",...O.errToObj($)})}uuid($){return this._addCheck({kind:"uuid",...O.errToObj($)})}nanoid($){return this._addCheck({kind:"nanoid",...O.errToObj($)})}cuid($){return this._addCheck({kind:"cuid",...O.errToObj($)})}cuid2($){return this._addCheck({kind:"cuid2",...O.errToObj($)})}ulid($){return this._addCheck({kind:"ulid",...O.errToObj($)})}base64($){return this._addCheck({kind:"base64",...O.errToObj($)})}base64url($){return this._addCheck({kind:"base64url",...O.errToObj($)})}jwt($){return this._addCheck({kind:"jwt",...O.errToObj($)})}ip($){return this._addCheck({kind:"ip",...O.errToObj($)})}cidr($){return this._addCheck({kind:"cidr",...O.errToObj($)})}datetime($){if(typeof $==="string")return this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:$});return this._addCheck({kind:"datetime",precision:typeof $?.precision==="undefined"?null:$?.precision,offset:$?.offset??!1,local:$?.local??!1,...O.errToObj($?.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 $?.precision==="undefined"?null:$?.precision,...O.errToObj($?.message)})}duration($){return this._addCheck({kind:"duration",...O.errToObj($)})}regex($,X){return this._addCheck({kind:"regex",regex:$,...O.errToObj(X)})}includes($,X){return this._addCheck({kind:"includes",value:$,position:X?.position,...O.errToObj(X?.message)})}startsWith($,X){return this._addCheck({kind:"startsWith",value:$,...O.errToObj(X)})}endsWith($,X){return this._addCheck({kind:"endsWith",value:$,...O.errToObj(X)})}min($,X){return this._addCheck({kind:"min",value:$,...O.errToObj(X)})}max($,X){return this._addCheck({kind:"max",value:$,...O.errToObj(X)})}length($,X){return this._addCheck({kind:"length",value:$,...O.errToObj(X)})}nonempty($){return this.min(1,O.errToObj($))}trim(){return new m({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new m({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new m({...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 $}};m.create=($)=>{return new m({checks:[],typeName:_.ZodString,coerce:$?.coerce??!1,...U($)})};B$=class B$ extends q{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($)!==M.number){let G=this._getOrReturnCtx($);return N(G,{code:w.invalid_type,expected:M.number,received:G.parsedType}),A}let Q=void 0,Y=new f;for(let G of this._def.checks)if(G.kind==="int"){if(!L.isInteger($.data))Q=this._getOrReturnCtx($,Q),N(Q,{code:w.invalid_type,expected:"integer",received:"float",message:G.message}),Y.dirty()}else if(G.kind==="min"){if(G.inclusive?$.data<G.value:$.data<=G.value)Q=this._getOrReturnCtx($,Q),N(Q,{code:w.too_small,minimum:G.value,type:"number",inclusive:G.inclusive,exact:!1,message:G.message}),Y.dirty()}else if(G.kind==="max"){if(G.inclusive?$.data>G.value:$.data>=G.value)Q=this._getOrReturnCtx($,Q),N(Q,{code:w.too_big,maximum:G.value,type:"number",inclusive:G.inclusive,exact:!1,message:G.message}),Y.dirty()}else if(G.kind==="multipleOf"){if(B2($.data,G.value)!==0)Q=this._getOrReturnCtx($,Q),N(Q,{code:w.not_multiple_of,multipleOf:G.value,message:G.message}),Y.dirty()}else if(G.kind==="finite"){if(!Number.isFinite($.data))Q=this._getOrReturnCtx($,Q),N(Q,{code:w.not_finite,message:G.message}),Y.dirty()}else L.assertNever(G);return{status:Y.value,value:$.data}}gte($,X){return this.setLimit("min",$,!0,O.toString(X))}gt($,X){return this.setLimit("min",$,!1,O.toString(X))}lte($,X){return this.setLimit("max",$,!0,O.toString(X))}lt($,X){return this.setLimit("max",$,!1,O.toString(X))}setLimit($,X,Q,Y){return new B$({...this._def,checks:[...this._def.checks,{kind:$,value:X,inclusive:Q,message:O.toString(Y)}]})}_addCheck($){return new B$({...this._def,checks:[...this._def.checks,$]})}int($){return this._addCheck({kind:"int",message:O.toString($)})}positive($){return this._addCheck({kind:"min",value:0,inclusive:!1,message:O.toString($)})}negative($){return this._addCheck({kind:"max",value:0,inclusive:!1,message:O.toString($)})}nonpositive($){return this._addCheck({kind:"max",value:0,inclusive:!0,message:O.toString($)})}nonnegative($){return this._addCheck({kind:"min",value:0,inclusive:!0,message:O.toString($)})}multipleOf($,X){return this._addCheck({kind:"multipleOf",value:$,message:O.toString(X)})}finite($){return this._addCheck({kind:"finite",message:O.toString($)})}safe($){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:O.toString($)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:O.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"&&L.isInteger($.value))}get isFinite(){let $=null,X=null;for(let Q of this._def.checks)if(Q.kind==="finite"||Q.kind==="int"||Q.kind==="multipleOf")return!0;else if(Q.kind==="min"){if(X===null||Q.value>X)X=Q.value}else if(Q.kind==="max"){if($===null||Q.value<$)$=Q.value}return Number.isFinite(X)&&Number.isFinite($)}};B$.create=($)=>{return new B$({checks:[],typeName:_.ZodNumber,coerce:$?.coerce||!1,...U($)})};D$=class D$ extends q{constructor(){super(...arguments);this.min=this.gte,this.max=this.lte}_parse($){if(this._def.coerce)try{$.data=BigInt($.data)}catch{return this._getInvalidInput($)}if(this._getType($)!==M.bigint)return this._getInvalidInput($);let Q=void 0,Y=new f;for(let G of this._def.checks)if(G.kind==="min"){if(G.inclusive?$.data<G.value:$.data<=G.value)Q=this._getOrReturnCtx($,Q),N(Q,{code:w.too_small,type:"bigint",minimum:G.value,inclusive:G.inclusive,message:G.message}),Y.dirty()}else if(G.kind==="max"){if(G.inclusive?$.data>G.value:$.data>=G.value)Q=this._getOrReturnCtx($,Q),N(Q,{code:w.too_big,type:"bigint",maximum:G.value,inclusive:G.inclusive,message:G.message}),Y.dirty()}else if(G.kind==="multipleOf"){if($.data%G.value!==BigInt(0))Q=this._getOrReturnCtx($,Q),N(Q,{code:w.not_multiple_of,multipleOf:G.value,message:G.message}),Y.dirty()}else L.assertNever(G);return{status:Y.value,value:$.data}}_getInvalidInput($){let X=this._getOrReturnCtx($);return N(X,{code:w.invalid_type,expected:M.bigint,received:X.parsedType}),A}gte($,X){return this.setLimit("min",$,!0,O.toString(X))}gt($,X){return this.setLimit("min",$,!1,O.toString(X))}lte($,X){return this.setLimit("max",$,!0,O.toString(X))}lt($,X){return this.setLimit("max",$,!1,O.toString(X))}setLimit($,X,Q,Y){return new D$({...this._def,checks:[...this._def.checks,{kind:$,value:X,inclusive:Q,message:O.toString(Y)}]})}_addCheck($){return new D$({...this._def,checks:[...this._def.checks,$]})}positive($){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:O.toString($)})}negative($){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:O.toString($)})}nonpositive($){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:O.toString($)})}nonnegative($){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:O.toString($)})}multipleOf($,X){return this._addCheck({kind:"multipleOf",value:$,message:O.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 $}};D$.create=($)=>{return new D$({checks:[],typeName:_.ZodBigInt,coerce:$?.coerce??!1,...U($)})};L$=class L$ extends q{_parse($){if(this._def.coerce)$.data=Boolean($.data);if(this._getType($)!==M.boolean){let Q=this._getOrReturnCtx($);return N(Q,{code:w.invalid_type,expected:M.boolean,received:Q.parsedType}),A}return C($.data)}};L$.create=($)=>{return new L$({typeName:_.ZodBoolean,coerce:$?.coerce||!1,...U($)})};N$=class N$ extends q{_parse($){if(this._def.coerce)$.data=new Date($.data);if(this._getType($)!==M.date){let G=this._getOrReturnCtx($);return N(G,{code:w.invalid_type,expected:M.date,received:G.parsedType}),A}if(Number.isNaN($.data.getTime())){let G=this._getOrReturnCtx($);return N(G,{code:w.invalid_date}),A}let Q=new f,Y=void 0;for(let G of this._def.checks)if(G.kind==="min"){if($.data.getTime()<G.value)Y=this._getOrReturnCtx($,Y),N(Y,{code:w.too_small,message:G.message,inclusive:!0,exact:!1,minimum:G.value,type:"date"}),Q.dirty()}else if(G.kind==="max"){if($.data.getTime()>G.value)Y=this._getOrReturnCtx($,Y),N(Y,{code:w.too_big,message:G.message,inclusive:!0,exact:!1,maximum:G.value,type:"date"}),Q.dirty()}else L.assertNever(G);return{status:Q.value,value:new Date($.data.getTime())}}_addCheck($){return new N$({...this._def,checks:[...this._def.checks,$]})}min($,X){return this._addCheck({kind:"min",value:$.getTime(),message:O.toString(X)})}max($,X){return this._addCheck({kind:"max",value:$.getTime(),message:O.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}};N$.create=($)=>{return new N$({checks:[],coerce:$?.coerce||!1,typeName:_.ZodDate,...U($)})};x$=class x$ extends q{_parse($){if(this._getType($)!==M.symbol){let Q=this._getOrReturnCtx($);return N(Q,{code:w.invalid_type,expected:M.symbol,received:Q.parsedType}),A}return C($.data)}};x$.create=($)=>{return new x$({typeName:_.ZodSymbol,...U($)})};E$=class E$ extends q{_parse($){if(this._getType($)!==M.undefined){let Q=this._getOrReturnCtx($);return N(Q,{code:w.invalid_type,expected:M.undefined,received:Q.parsedType}),A}return C($.data)}};E$.create=($)=>{return new E$({typeName:_.ZodUndefined,...U($)})};S$=class S$ extends q{_parse($){if(this._getType($)!==M.null){let Q=this._getOrReturnCtx($);return N(Q,{code:w.invalid_type,expected:M.null,received:Q.parsedType}),A}return C($.data)}};S$.create=($)=>{return new S$({typeName:_.ZodNull,...U($)})};O$=class O$ extends q{constructor(){super(...arguments);this._any=!0}_parse($){return C($.data)}};O$.create=($)=>{return new O$({typeName:_.ZodAny,...U($)})};H$=class H$ extends q{constructor(){super(...arguments);this._unknown=!0}_parse($){return C($.data)}};H$.create=($)=>{return new H$({typeName:_.ZodUnknown,...U($)})};s=class s extends q{_parse($){let X=this._getOrReturnCtx($);return N(X,{code:w.invalid_type,expected:M.never,received:X.parsedType}),A}};s.create=($)=>{return new s({typeName:_.ZodNever,...U($)})};y$=class y$ extends q{_parse($){if(this._getType($)!==M.undefined){let Q=this._getOrReturnCtx($);return N(Q,{code:w.invalid_type,expected:M.void,received:Q.parsedType}),A}return C($.data)}};y$.create=($)=>{return new y$({typeName:_.ZodVoid,...U($)})};u=class u extends q{_parse($){let{ctx:X,status:Q}=this._processInputParams($),Y=this._def;if(X.parsedType!==M.array)return N(X,{code:w.invalid_type,expected:M.array,received:X.parsedType}),A;if(Y.exactLength!==null){let W=X.data.length>Y.exactLength.value,H=X.data.length<Y.exactLength.value;if(W||H)N(X,{code:W?w.too_big:w.too_small,minimum:H?Y.exactLength.value:void 0,maximum:W?Y.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:Y.exactLength.message}),Q.dirty()}if(Y.minLength!==null){if(X.data.length<Y.minLength.value)N(X,{code:w.too_small,minimum:Y.minLength.value,type:"array",inclusive:!0,exact:!1,message:Y.minLength.message}),Q.dirty()}if(Y.maxLength!==null){if(X.data.length>Y.maxLength.value)N(X,{code:w.too_big,maximum:Y.maxLength.value,type:"array",inclusive:!0,exact:!1,message:Y.maxLength.message}),Q.dirty()}if(X.common.async)return Promise.all([...X.data].map((W,H)=>{return Y.type._parseAsync(new n(X,W,X.path,H))})).then((W)=>{return f.mergeArray(Q,W)});let G=[...X.data].map((W,H)=>{return Y.type._parseSync(new n(X,W,X.path,H))});return f.mergeArray(Q,G)}get element(){return this._def.type}min($,X){return new u({...this._def,minLength:{value:$,message:O.toString(X)}})}max($,X){return new u({...this._def,maxLength:{value:$,message:O.toString(X)}})}length($,X){return new u({...this._def,exactLength:{value:$,message:O.toString(X)}})}nonempty($){return this.min(1,$)}};u.create=($,X)=>{return new u({type:$,minLength:null,maxLength:null,exactLength:null,typeName:_.ZodArray,...U(X)})};F=class F extends q{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=L.objectKeys($);return this._cached={shape:$,keys:X},this._cached}_parse($){if(this._getType($)!==M.object){let D=this._getOrReturnCtx($);return N(D,{code:w.invalid_type,expected:M.object,received:D.parsedType}),A}let{status:Q,ctx:Y}=this._processInputParams($),{shape:G,keys:W}=this._getCached(),H=[];if(!(this._def.catchall instanceof s&&this._def.unknownKeys==="strip")){for(let D in Y.data)if(!W.includes(D))H.push(D)}let B=[];for(let D of W){let V=G[D],j=Y.data[D];B.push({key:{status:"valid",value:D},value:V._parse(new n(Y,j,Y.path,D)),alwaysSet:D in Y.data})}if(this._def.catchall instanceof s){let D=this._def.unknownKeys;if(D==="passthrough")for(let V of H)B.push({key:{status:"valid",value:V},value:{status:"valid",value:Y.data[V]}});else if(D==="strict"){if(H.length>0)N(Y,{code:w.unrecognized_keys,keys:H}),Q.dirty()}else if(D==="strip");else throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let D=this._def.catchall;for(let V of H){let j=Y.data[V];B.push({key:{status:"valid",value:V},value:D._parse(new n(Y,j,Y.path,V)),alwaysSet:V in Y.data})}}if(Y.common.async)return Promise.resolve().then(async()=>{let D=[];for(let V of B){let j=await V.key,P=await V.value;D.push({key:j,value:P,alwaysSet:V.alwaysSet})}return D}).then((D)=>{return f.mergeObjectSync(Q,D)});else return f.mergeObjectSync(Q,B)}get shape(){return this._def.shape()}strict($){return O.errToObj,new F({...this._def,unknownKeys:"strict",...$!==void 0?{errorMap:(X,Q)=>{let Y=this._def.errorMap?.(X,Q).message??Q.defaultError;if(X.code==="unrecognized_keys")return{message:O.errToObj($).message??Y};return{message:Y}}}:{}})}strip(){return new F({...this._def,unknownKeys:"strip"})}passthrough(){return new F({...this._def,unknownKeys:"passthrough"})}extend($){return new F({...this._def,shape:()=>({...this._def.shape(),...$})})}merge($){return new F({unknownKeys:$._def.unknownKeys,catchall:$._def.catchall,shape:()=>({...this._def.shape(),...$._def.shape()}),typeName:_.ZodObject})}setKey($,X){return this.augment({[$]:X})}catchall($){return new F({...this._def,catchall:$})}pick($){let X={};for(let Q of L.objectKeys($))if($[Q]&&this.shape[Q])X[Q]=this.shape[Q];return new F({...this._def,shape:()=>X})}omit($){let X={};for(let Q of L.objectKeys(this.shape))if(!$[Q])X[Q]=this.shape[Q];return new F({...this._def,shape:()=>X})}deepPartial(){return q$(this)}partial($){let X={};for(let Q of L.objectKeys(this.shape)){let Y=this.shape[Q];if($&&!$[Q])X[Q]=Y;else X[Q]=Y.optional()}return new F({...this._def,shape:()=>X})}required($){let X={};for(let Q of L.objectKeys(this.shape))if($&&!$[Q])X[Q]=this.shape[Q];else{let G=this.shape[Q];while(G instanceof c)G=G._def.innerType;X[Q]=G}return new F({...this._def,shape:()=>X})}keyof(){return V0(L.objectKeys(this.shape))}};F.create=($,X)=>{return new F({shape:()=>$,unknownKeys:"strip",catchall:s.create(),typeName:_.ZodObject,...U(X)})};F.strictCreate=($,X)=>{return new F({shape:()=>$,unknownKeys:"strict",catchall:s.create(),typeName:_.ZodObject,...U(X)})};F.lazycreate=($,X)=>{return new F({shape:$,unknownKeys:"strip",catchall:s.create(),typeName:_.ZodObject,...U(X)})};F$=class F$ extends q{_parse($){let{ctx:X}=this._processInputParams($),Q=this._def.options;function Y(G){for(let H of G)if(H.result.status==="valid")return H.result;for(let H of G)if(H.result.status==="dirty")return X.common.issues.push(...H.ctx.common.issues),H.result;let W=G.map((H)=>new h(H.ctx.common.issues));return N(X,{code:w.invalid_union,unionErrors:W}),A}if(X.common.async)return Promise.all(Q.map(async(G)=>{let W={...X,common:{...X.common,issues:[]},parent:null};return{result:await G._parseAsync({data:X.data,path:X.path,parent:W}),ctx:W}})).then(Y);else{let G=void 0,W=[];for(let B of Q){let D={...X,common:{...X.common,issues:[]},parent:null},V=B._parseSync({data:X.data,path:X.path,parent:D});if(V.status==="valid")return V;else if(V.status==="dirty"&&!G)G={result:V,ctx:D};if(D.common.issues.length)W.push(D.common.issues)}if(G)return X.common.issues.push(...G.ctx.common.issues),G.result;let H=W.map((B)=>new h(B));return N(X,{code:w.invalid_union,unionErrors:H}),A}}get options(){return this._def.options}};F$.create=($,X)=>{return new F$({options:$,typeName:_.ZodUnion,...U(X)})};$3=class $3 extends q{_parse($){let{ctx:X}=this._processInputParams($);if(X.parsedType!==M.object)return N(X,{code:w.invalid_type,expected:M.object,received:X.parsedType}),A;let Q=this.discriminator,Y=X.data[Q],G=this.optionsMap.get(Y);if(!G)return N(X,{code:w.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[Q]}),A;if(X.common.async)return G._parseAsync({data:X.data,path:X.path,parent:X});else return G._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,Q){let Y=new Map;for(let G of X){let W=Y$(G.shape[$]);if(!W.length)throw new Error(`A discriminator value for key \`${$}\` could not be extracted from all schema options`);for(let H of W){if(Y.has(H))throw new Error(`Discriminator property ${String($)} has duplicate value ${String(H)}`);Y.set(H,G)}}return new $3({typeName:_.ZodDiscriminatedUnion,discriminator:$,options:X,optionsMap:Y,...U(Q)})}};z$=class z$ extends q{_parse($){let{status:X,ctx:Q}=this._processInputParams($),Y=(G,W)=>{if(s$(G)||s$(W))return A;let H=h3(G.value,W.value);if(!H.valid)return N(Q,{code:w.invalid_intersection_types}),A;if(e$(G)||e$(W))X.dirty();return{status:X.value,value:H.data}};if(Q.common.async)return Promise.all([this._def.left._parseAsync({data:Q.data,path:Q.path,parent:Q}),this._def.right._parseAsync({data:Q.data,path:Q.path,parent:Q})]).then(([G,W])=>Y(G,W));else return Y(this._def.left._parseSync({data:Q.data,path:Q.path,parent:Q}),this._def.right._parseSync({data:Q.data,path:Q.path,parent:Q}))}};z$.create=($,X,Q)=>{return new z$({left:$,right:X,typeName:_.ZodIntersection,...U(Q)})};e=class e extends q{_parse($){let{status:X,ctx:Q}=this._processInputParams($);if(Q.parsedType!==M.array)return N(Q,{code:w.invalid_type,expected:M.array,received:Q.parsedType}),A;if(Q.data.length<this._def.items.length)return N(Q,{code:w.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),A;if(!this._def.rest&&Q.data.length>this._def.items.length)N(Q,{code:w.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),X.dirty();let G=[...Q.data].map((W,H)=>{let B=this._def.items[H]||this._def.rest;if(!B)return null;return B._parse(new n(Q,W,Q.path,H))}).filter((W)=>!!W);if(Q.common.async)return Promise.all(G).then((W)=>{return f.mergeArray(X,W)});else return f.mergeArray(X,G)}get items(){return this._def.items}rest($){return new e({...this._def,rest:$})}};e.create=($,X)=>{if(!Array.isArray($))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new e({items:$,typeName:_.ZodTuple,rest:null,...U(X)})};h$=class h$ extends q{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse($){let{status:X,ctx:Q}=this._processInputParams($);if(Q.parsedType!==M.object)return N(Q,{code:w.invalid_type,expected:M.object,received:Q.parsedType}),A;let Y=[],G=this._def.keyType,W=this._def.valueType;for(let H in Q.data)Y.push({key:G._parse(new n(Q,H,Q.path,H)),value:W._parse(new n(Q,Q.data[H],Q.path,H)),alwaysSet:H in Q.data});if(Q.common.async)return f.mergeObjectAsync(X,Y);else return f.mergeObjectSync(X,Y)}get element(){return this._def.valueType}static create($,X,Q){if(X instanceof q)return new h$({keyType:$,valueType:X,typeName:_.ZodRecord,...U(Q)});return new h$({keyType:m.create(),valueType:$,typeName:_.ZodRecord,...U(X)})}};Z$=class Z$ extends q{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse($){let{status:X,ctx:Q}=this._processInputParams($);if(Q.parsedType!==M.map)return N(Q,{code:w.invalid_type,expected:M.map,received:Q.parsedType}),A;let Y=this._def.keyType,G=this._def.valueType,W=[...Q.data.entries()].map(([H,B],D)=>{return{key:Y._parse(new n(Q,H,Q.path,[D,"key"])),value:G._parse(new n(Q,B,Q.path,[D,"value"]))}});if(Q.common.async){let H=new Map;return Promise.resolve().then(async()=>{for(let B of W){let D=await B.key,V=await B.value;if(D.status==="aborted"||V.status==="aborted")return A;if(D.status==="dirty"||V.status==="dirty")X.dirty();H.set(D.value,V.value)}return{status:X.value,value:H}})}else{let H=new Map;for(let B of W){let{key:D,value:V}=B;if(D.status==="aborted"||V.status==="aborted")return A;if(D.status==="dirty"||V.status==="dirty")X.dirty();H.set(D.value,V.value)}return{status:X.value,value:H}}}};Z$.create=($,X,Q)=>{return new Z$({valueType:X,keyType:$,typeName:_.ZodMap,...U(Q)})};j$=class j$ extends q{_parse($){let{status:X,ctx:Q}=this._processInputParams($);if(Q.parsedType!==M.set)return N(Q,{code:w.invalid_type,expected:M.set,received:Q.parsedType}),A;let Y=this._def;if(Y.minSize!==null){if(Q.data.size<Y.minSize.value)N(Q,{code:w.too_small,minimum:Y.minSize.value,type:"set",inclusive:!0,exact:!1,message:Y.minSize.message}),X.dirty()}if(Y.maxSize!==null){if(Q.data.size>Y.maxSize.value)N(Q,{code:w.too_big,maximum:Y.maxSize.value,type:"set",inclusive:!0,exact:!1,message:Y.maxSize.message}),X.dirty()}let G=this._def.valueType;function W(B){let D=new Set;for(let V of B){if(V.status==="aborted")return A;if(V.status==="dirty")X.dirty();D.add(V.value)}return{status:X.value,value:D}}let H=[...Q.data.values()].map((B,D)=>G._parse(new n(Q,B,Q.path,D)));if(Q.common.async)return Promise.all(H).then((B)=>W(B));else return W(H)}min($,X){return new j$({...this._def,minSize:{value:$,message:O.toString(X)}})}max($,X){return new j$({...this._def,maxSize:{value:$,message:O.toString(X)}})}size($,X){return this.min($,X).max($,X)}nonempty($){return this.min(1,$)}};j$.create=($,X)=>{return new j$({valueType:$,minSize:null,maxSize:null,typeName:_.ZodSet,...U(X)})};K$=class K$ extends q{constructor(){super(...arguments);this.validate=this.implement}_parse($){let{ctx:X}=this._processInputParams($);if(X.parsedType!==M.function)return N(X,{code:w.invalid_type,expected:M.function,received:X.parsedType}),A;function Q(H,B){return T$({data:H,path:X.path,errorMaps:[X.common.contextualErrorMap,X.schemaErrorMap,b$(),Q$].filter((D)=>!!D),issueData:{code:w.invalid_arguments,argumentsError:B}})}function Y(H,B){return T$({data:H,path:X.path,errorMaps:[X.common.contextualErrorMap,X.schemaErrorMap,b$(),Q$].filter((D)=>!!D),issueData:{code:w.invalid_return_type,returnTypeError:B}})}let G={errorMap:X.common.contextualErrorMap},W=X.data;if(this._def.returns instanceof A$){let H=this;return C(async function(...B){let D=new h([]),V=await H._def.args.parseAsync(B,G).catch((I)=>{throw D.addIssue(Q(B,I)),D}),j=await Reflect.apply(W,this,V);return await H._def.returns._def.type.parseAsync(j,G).catch((I)=>{throw D.addIssue(Y(j,I)),D})})}else{let H=this;return C(function(...B){let D=H._def.args.safeParse(B,G);if(!D.success)throw new h([Q(B,D.error)]);let V=Reflect.apply(W,this,D.data),j=H._def.returns.safeParse(V,G);if(!j.success)throw new h([Y(V,j.error)]);return j.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...$){return new K$({...this._def,args:e.create($).rest(H$.create())})}returns($){return new K$({...this._def,returns:$})}implement($){return this.parse($)}strictImplement($){return this.parse($)}static create($,X,Q){return new K$({args:$?$:e.create([]).rest(H$.create()),returns:X||H$.create(),typeName:_.ZodFunction,...U(Q)})}};R$=class R$ extends q{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})}};R$.create=($,X)=>{return new R$({getter:$,typeName:_.ZodLazy,...U(X)})};v$=class v$ extends q{_parse($){if($.data!==this._def.value){let X=this._getOrReturnCtx($);return N(X,{received:X.data,code:w.invalid_literal,expected:this._def.value}),A}return{status:"valid",value:$.data}}get value(){return this._def.value}};v$.create=($,X)=>{return new v$({value:$,typeName:_.ZodLiteral,...U(X)})};w$=class w$ extends q{_parse($){if(typeof $.data!=="string"){let X=this._getOrReturnCtx($),Q=this._def.values;return N(X,{expected:L.joinValues(Q),received:X.parsedType,code:w.invalid_type}),A}if(!this._cache)this._cache=new Set(this._def.values);if(!this._cache.has($.data)){let X=this._getOrReturnCtx($),Q=this._def.values;return N(X,{received:X.data,code:w.invalid_enum_value,options:Q}),A}return C($.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 w$.create($,{...this._def,...X})}exclude($,X=this._def){return w$.create(this.options.filter((Q)=>!$.includes(Q)),{...this._def,...X})}};w$.create=V0;k$=class k$ extends q{_parse($){let X=L.getValidEnumValues(this._def.values),Q=this._getOrReturnCtx($);if(Q.parsedType!==M.string&&Q.parsedType!==M.number){let Y=L.objectValues(X);return N(Q,{expected:L.joinValues(Y),received:Q.parsedType,code:w.invalid_type}),A}if(!this._cache)this._cache=new Set(L.getValidEnumValues(this._def.values));if(!this._cache.has($.data)){let Y=L.objectValues(X);return N(Q,{received:Q.data,code:w.invalid_enum_value,options:Y}),A}return C($.data)}get enum(){return this._def.values}};k$.create=($,X)=>{return new k$({values:$,typeName:_.ZodNativeEnum,...U(X)})};A$=class A$ extends q{unwrap(){return this._def.type}_parse($){let{ctx:X}=this._processInputParams($);if(X.parsedType!==M.promise&&X.common.async===!1)return N(X,{code:w.invalid_type,expected:M.promise,received:X.parsedType}),A;let Q=X.parsedType===M.promise?X.data:Promise.resolve(X.data);return C(Q.then((Y)=>{return this._def.type.parseAsync(Y,{path:X.path,errorMap:X.common.contextualErrorMap})}))}};A$.create=($,X)=>{return new A$({type:$,typeName:_.ZodPromise,...U(X)})};p=class p extends q{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===_.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse($){let{status:X,ctx:Q}=this._processInputParams($),Y=this._def.effect||null,G={addIssue:(W)=>{if(N(Q,W),W.fatal)X.abort();else X.dirty()},get path(){return Q.path}};if(G.addIssue=G.addIssue.bind(G),Y.type==="preprocess"){let W=Y.transform(Q.data,G);if(Q.common.async)return Promise.resolve(W).then(async(H)=>{if(X.value==="aborted")return A;let B=await this._def.schema._parseAsync({data:H,path:Q.path,parent:Q});if(B.status==="aborted")return A;if(B.status==="dirty")return V$(B.value);if(X.value==="dirty")return V$(B.value);return B});else{if(X.value==="aborted")return A;let H=this._def.schema._parseSync({data:W,path:Q.path,parent:Q});if(H.status==="aborted")return A;if(H.status==="dirty")return V$(H.value);if(X.value==="dirty")return V$(H.value);return H}}if(Y.type==="refinement"){let W=(H)=>{let B=Y.refinement(H,G);if(Q.common.async)return Promise.resolve(B);if(B instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return H};if(Q.common.async===!1){let H=this._def.schema._parseSync({data:Q.data,path:Q.path,parent:Q});if(H.status==="aborted")return A;if(H.status==="dirty")X.dirty();return W(H.value),{status:X.value,value:H.value}}else return this._def.schema._parseAsync({data:Q.data,path:Q.path,parent:Q}).then((H)=>{if(H.status==="aborted")return A;if(H.status==="dirty")X.dirty();return W(H.value).then(()=>{return{status:X.value,value:H.value}})})}if(Y.type==="transform")if(Q.common.async===!1){let W=this._def.schema._parseSync({data:Q.data,path:Q.path,parent:Q});if(!W$(W))return A;let H=Y.transform(W.value,G);if(H instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:X.value,value:H}}else return this._def.schema._parseAsync({data:Q.data,path:Q.path,parent:Q}).then((W)=>{if(!W$(W))return A;return Promise.resolve(Y.transform(W.value,G)).then((H)=>({status:X.value,value:H}))});L.assertNever(Y)}};p.create=($,X,Q)=>{return new p({schema:$,typeName:_.ZodEffects,effect:X,...U(Q)})};p.createWithPreprocess=($,X,Q)=>{return new p({schema:X,effect:{type:"preprocess",transform:$},typeName:_.ZodEffects,...U(Q)})};c=class c extends q{_parse($){if(this._getType($)===M.undefined)return C(void 0);return this._def.innerType._parse($)}unwrap(){return this._def.innerType}};c.create=($,X)=>{return new c({innerType:$,typeName:_.ZodOptional,...U(X)})};G$=class G$ extends q{_parse($){if(this._getType($)===M.null)return C(null);return this._def.innerType._parse($)}unwrap(){return this._def.innerType}};G$.create=($,X)=>{return new G$({innerType:$,typeName:_.ZodNullable,...U(X)})};f$=class f$ extends q{_parse($){let{ctx:X}=this._processInputParams($),Q=X.data;if(X.parsedType===M.undefined)Q=this._def.defaultValue();return this._def.innerType._parse({data:Q,path:X.path,parent:X})}removeDefault(){return this._def.innerType}};f$.create=($,X)=>{return new f$({innerType:$,typeName:_.ZodDefault,defaultValue:typeof X.default==="function"?X.default:()=>X.default,...U(X)})};P$=class P$ extends q{_parse($){let{ctx:X}=this._processInputParams($),Q={...X,common:{...X.common,issues:[]}},Y=this._def.innerType._parse({data:Q.data,path:Q.path,parent:{...Q}});if(U$(Y))return Y.then((G)=>{return{status:"valid",value:G.status==="valid"?G.value:this._def.catchValue({get error(){return new h(Q.common.issues)},input:Q.data})}});else return{status:"valid",value:Y.status==="valid"?Y.value:this._def.catchValue({get error(){return new h(Q.common.issues)},input:Q.data})}}removeCatch(){return this._def.innerType}};P$.create=($,X)=>{return new P$({innerType:$,typeName:_.ZodCatch,catchValue:typeof X.catch==="function"?X.catch:()=>X.catch,...U(X)})};g$=class g$ extends q{_parse($){if(this._getType($)!==M.nan){let Q=this._getOrReturnCtx($);return N(Q,{code:w.invalid_type,expected:M.nan,received:Q.parsedType}),A}return{status:"valid",value:$.data}}};g$.create=($)=>{return new g$({typeName:_.ZodNaN,...U($)})};D2=Symbol("zod_brand");X3=class X3 extends q{_parse($){let{ctx:X}=this._processInputParams($),Q=X.data;return this._def.type._parse({data:Q,path:X.path,parent:X})}unwrap(){return this._def.type}};l$=class l$ extends q{_parse($){let{status:X,ctx:Q}=this._processInputParams($);if(Q.common.async)return(async()=>{let G=await this._def.in._parseAsync({data:Q.data,path:Q.path,parent:Q});if(G.status==="aborted")return A;if(G.status==="dirty")return X.dirty(),V$(G.value);else return this._def.out._parseAsync({data:G.value,path:Q.path,parent:Q})})();else{let Y=this._def.in._parseSync({data:Q.data,path:Q.path,parent:Q});if(Y.status==="aborted")return A;if(Y.status==="dirty")return X.dirty(),{status:"dirty",value:Y.value};else return this._def.out._parseSync({data:Y.value,path:Q.path,parent:Q})}}static create($,X){return new l$({in:$,out:X,typeName:_.ZodPipeline})}};C$=class C$ extends q{_parse($){let X=this._def.innerType._parse($),Q=(Y)=>{if(W$(Y))Y.value=Object.freeze(Y.value);return Y};return U$(X)?X.then((Y)=>Q(Y)):Q(X)}unwrap(){return this._def.innerType}};C$.create=($,X)=>{return new C$({innerType:$,typeName:_.ZodReadonly,...U(X)})};w2={object:F.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"})(_||(_={}));O0=m.create,j0=B$.create,M2=g$.create,V2=D$.create,A0=L$.create,N2=N$.create,O2=x$.create,j2=E$.create,A2=S$.create,b2=O$.create,U2=H$.create,q2=s.create,K2=y$.create,L2=u.create,E2=F.create,S2=F.strictCreate,F2=F$.create,z2=$3.create,R2=z$.create,v2=e.create,k2=h$.create,f2=Z$.create,P2=j$.create,C2=K$.create,I2=R$.create,T2=v$.create,x2=w$.create,y2=k$.create,h2=A$.create,Z2=p.create,g2=c.create,l2=G$.create,m2=p.createWithPreprocess,u2=l$.create,i2={string:($)=>m.create({...$,coerce:!0}),number:($)=>B$.create({...$,coerce:!0}),boolean:($)=>L$.create({...$,coerce:!0}),bigint:($)=>D$.create({...$,coerce:!0}),date:($)=>N$.create({...$,coerce:!0})},d2=A});var J={};h1(J,{void:()=>K2,util:()=>L,unknown:()=>U2,union:()=>F2,undefined:()=>j2,tuple:()=>v2,transformer:()=>Z2,symbol:()=>O2,string:()=>O0,strictObject:()=>S2,setErrorMap:()=>l1,set:()=>P2,record:()=>k2,quotelessJson:()=>Z1,promise:()=>h2,preprocess:()=>m2,pipeline:()=>u2,ostring:()=>c2,optional:()=>g2,onumber:()=>n2,oboolean:()=>p2,objectUtil:()=>I3,object:()=>E2,number:()=>j0,nullable:()=>l2,null:()=>A2,never:()=>q2,nativeEnum:()=>y2,nan:()=>M2,map:()=>f2,makeIssue:()=>T$,literal:()=>T2,lazy:()=>I2,late:()=>w2,isValid:()=>W$,isDirty:()=>e$,isAsync:()=>U$,isAborted:()=>s$,intersection:()=>R2,instanceof:()=>_2,getParsedType:()=>t,getErrorMap:()=>b$,function:()=>C2,enum:()=>x2,effect:()=>Z2,discriminatedUnion:()=>z2,defaultErrorMap:()=>Q$,datetimeRegex:()=>M0,date:()=>N2,custom:()=>N0,coerce:()=>i2,boolean:()=>A0,bigint:()=>V2,array:()=>L2,any:()=>b2,addIssueToContext:()=>N,ZodVoid:()=>y$,ZodUnknown:()=>H$,ZodUnion:()=>F$,ZodUndefined:()=>E$,ZodType:()=>q,ZodTuple:()=>e,ZodTransformer:()=>p,ZodSymbol:()=>x$,ZodString:()=>m,ZodSet:()=>j$,ZodSchema:()=>q,ZodRecord:()=>h$,ZodReadonly:()=>C$,ZodPromise:()=>A$,ZodPipeline:()=>l$,ZodParsedType:()=>M,ZodOptional:()=>c,ZodObject:()=>F,ZodNumber:()=>B$,ZodNullable:()=>G$,ZodNull:()=>S$,ZodNever:()=>s,ZodNativeEnum:()=>k$,ZodNaN:()=>g$,ZodMap:()=>Z$,ZodLiteral:()=>v$,ZodLazy:()=>R$,ZodIssueCode:()=>w,ZodIntersection:()=>z$,ZodFunction:()=>K$,ZodFirstPartyTypeKind:()=>_,ZodError:()=>h,ZodEnum:()=>w$,ZodEffects:()=>p,ZodDiscriminatedUnion:()=>$3,ZodDefault:()=>f$,ZodDate:()=>N$,ZodCatch:()=>P$,ZodBranded:()=>X3,ZodBoolean:()=>L$,ZodBigInt:()=>D$,ZodArray:()=>u,ZodAny:()=>O$,Schema:()=>q,ParseStatus:()=>f,OK:()=>C,NEVER:()=>d2,INVALID:()=>A,EMPTY_PATH:()=>m1,DIRTY:()=>V$,BRAND:()=>D2});var Z3=g(()=>{t$();x3();W0();I$();b0();r$()});var _$=g(()=>{Z3();Z3()});var g3="2025-03-26",U0,Q3="2.0",q0,K0,o2,i,Z,m$,$$,d,Y3,L0,E0=($)=>L0.safeParse($).success,S0,F0=($)=>S0.safeParse($).success,z0,l3=($)=>z0.safeParse($).success,z,R0,v0=($)=>R0.safeParse($).success,k0,G3,J3,f0,a2,W3,zX=($)=>W3.safeParse($).success,r2,t2,m3,H3,s2,B3,D3,w3,P0,C0,I0,e2,$6,_3,X6,M3,Q6,V3,Y6,G6,J6,W6,H6,B6,D6,N3,w6,O3,j3,A3,b3,T0,_6,M6,V6,N6,O6,U3,j6,x0,RX,q3,A6,y0,b6,U6,q6,K6,L6,E6,u3,S6,F6,K3,z6,R6,v6,c3,k6,vX,kX,fX,PX,CX,IX,v;var u$=g(()=>{_$();U0=[g3,"2024-11-05","2024-10-07"],q0=J.union([J.string(),J.number().int()]),K0=J.string(),o2=J.object({progressToken:J.optional(q0)}).passthrough(),i=J.object({_meta:J.optional(o2)}).passthrough(),Z=J.object({method:J.string(),params:J.optional(i)}),m$=J.object({_meta:J.optional(J.object({}).passthrough())}).passthrough(),$$=J.object({method:J.string(),params:J.optional(m$)}),d=J.object({_meta:J.optional(J.object({}).passthrough())}).passthrough(),Y3=J.union([J.string(),J.number().int()]),L0=J.object({jsonrpc:J.literal(Q3),id:Y3}).merge(Z).strict(),S0=J.object({jsonrpc:J.literal(Q3)}).merge($$).strict(),z0=J.object({jsonrpc:J.literal(Q3),id:Y3,result:d}).strict();(function($){$[$.ConnectionClosed=-32000]="ConnectionClosed",$[$.RequestTimeout=-32001]="RequestTimeout",$[$.ParseError=-32700]="ParseError",$[$.InvalidRequest=-32600]="InvalidRequest",$[$.MethodNotFound=-32601]="MethodNotFound",$[$.InvalidParams=-32602]="InvalidParams",$[$.InternalError=-32603]="InternalError"})(z||(z={}));R0=J.object({jsonrpc:J.literal(Q3),id:Y3,error:J.object({code:J.number().int(),message:J.string(),data:J.optional(J.unknown())})}).strict(),k0=J.union([L0,S0,z0,R0]),G3=d.strict(),J3=$$.extend({method:J.literal("notifications/cancelled"),params:m$.extend({requestId:Y3,reason:J.string().optional()})}),f0=J.object({name:J.string(),version:J.string()}).passthrough(),a2=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(),W3=Z.extend({method:J.literal("initialize"),params:i.extend({protocolVersion:J.string(),capabilities:a2,clientInfo:f0})}),r2=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(),t2=d.extend({protocolVersion:J.string(),capabilities:r2,serverInfo:f0,instructions:J.optional(J.string())}),m3=$$.extend({method:J.literal("notifications/initialized")}),H3=Z.extend({method:J.literal("ping")}),s2=J.object({progress:J.number(),total:J.optional(J.number()),message:J.optional(J.string())}).passthrough(),B3=$$.extend({method:J.literal("notifications/progress"),params:m$.merge(s2).extend({progressToken:q0})}),D3=Z.extend({params:i.extend({cursor:J.optional(K0)}).optional()}),w3=d.extend({nextCursor:J.optional(K0)}),P0=J.object({uri:J.string(),mimeType:J.optional(J.string())}).passthrough(),C0=P0.extend({text:J.string()}),I0=P0.extend({blob:J.string().base64()}),e2=J.object({uri:J.string(),name:J.string(),description:J.optional(J.string()),mimeType:J.optional(J.string())}).passthrough(),$6=J.object({uriTemplate:J.string(),name:J.string(),description:J.optional(J.string()),mimeType:J.optional(J.string())}).passthrough(),_3=D3.extend({method:J.literal("resources/list")}),X6=w3.extend({resources:J.array(e2)}),M3=D3.extend({method:J.literal("resources/templates/list")}),Q6=w3.extend({resourceTemplates:J.array($6)}),V3=Z.extend({method:J.literal("resources/read"),params:i.extend({uri:J.string()})}),Y6=d.extend({contents:J.array(J.union([C0,I0]))}),G6=$$.extend({method:J.literal("notifications/resources/list_changed")}),J6=Z.extend({method:J.literal("resources/subscribe"),params:i.extend({uri:J.string()})}),W6=Z.extend({method:J.literal("resources/unsubscribe"),params:i.extend({uri:J.string()})}),H6=$$.extend({method:J.literal("notifications/resources/updated"),params:m$.extend({uri:J.string()})}),B6=J.object({name:J.string(),description:J.optional(J.string()),required:J.optional(J.boolean())}).passthrough(),D6=J.object({name:J.string(),description:J.optional(J.string()),arguments:J.optional(J.array(B6))}).passthrough(),N3=D3.extend({method:J.literal("prompts/list")}),w6=w3.extend({prompts:J.array(D6)}),O3=Z.extend({method:J.literal("prompts/get"),params:i.extend({name:J.string(),arguments:J.optional(J.record(J.string()))})}),j3=J.object({type:J.literal("text"),text:J.string()}).passthrough(),A3=J.object({type:J.literal("image"),data:J.string().base64(),mimeType:J.string()}).passthrough(),b3=J.object({type:J.literal("audio"),data:J.string().base64(),mimeType:J.string()}).passthrough(),T0=J.object({type:J.literal("resource"),resource:J.union([C0,I0])}).passthrough(),_6=J.object({role:J.enum(["user","assistant"]),content:J.union([j3,A3,b3,T0])}).passthrough(),M6=d.extend({description:J.optional(J.string()),messages:J.array(_6)}),V6=$$.extend({method:J.literal("notifications/prompts/list_changed")}),N6=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(),O6=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(N6)}).passthrough(),U3=D3.extend({method:J.literal("tools/list")}),j6=w3.extend({tools:J.array(O6)}),x0=d.extend({content:J.array(J.union([j3,A3,b3,T0])).default([]),structuredContent:J.object({}).passthrough().optional(),isError:J.optional(J.boolean())}),RX=x0.or(d.extend({toolResult:J.unknown()})),q3=Z.extend({method:J.literal("tools/call"),params:i.extend({name:J.string(),arguments:J.optional(J.record(J.unknown()))})}),A6=$$.extend({method:J.literal("notifications/tools/list_changed")}),y0=J.enum(["debug","info","notice","warning","error","critical","alert","emergency"]),b6=Z.extend({method:J.literal("logging/setLevel"),params:i.extend({level:y0})}),U6=$$.extend({method:J.literal("notifications/message"),params:m$.extend({level:y0,logger:J.optional(J.string()),data:J.unknown()})}),q6=J.object({name:J.string().optional()}).passthrough(),K6=J.object({hints:J.optional(J.array(q6)),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(),L6=J.object({role:J.enum(["user","assistant"]),content:J.union([j3,A3,b3])}).passthrough(),E6=Z.extend({method:J.literal("sampling/createMessage"),params:i.extend({messages:J.array(L6),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(K6)})}),u3=d.extend({model:J.string(),stopReason:J.optional(J.enum(["endTurn","stopSequence","maxTokens"]).or(J.string())),role:J.enum(["user","assistant"]),content:J.discriminatedUnion("type",[j3,A3,b3])}),S6=J.object({type:J.literal("ref/resource"),uri:J.string()}).passthrough(),F6=J.object({type:J.literal("ref/prompt"),name:J.string()}).passthrough(),K3=Z.extend({method:J.literal("completion/complete"),params:i.extend({ref:J.union([F6,S6]),argument:J.object({name:J.string(),value:J.string()}).passthrough()})}),z6=d.extend({completion:J.object({values:J.array(J.string()).max(100),total:J.optional(J.number().int()),hasMore:J.optional(J.boolean())}).passthrough()}),R6=J.object({uri:J.string().startsWith("file://"),name:J.optional(J.string())}).passthrough(),v6=Z.extend({method:J.literal("roots/list")}),c3=d.extend({roots:J.array(R6)}),k6=$$.extend({method:J.literal("notifications/roots/list_changed")}),vX=J.union([H3,W3,K3,b6,O3,N3,_3,M3,V3,J6,W6,q3,U3]),kX=J.union([J3,B3,m3,k6]),fX=J.union([G3,u3,c3]),PX=J.union([H3,E6,v6]),CX=J.union([J3,B3,U6,H6,G6,A6,V6]),IX=J.union([G3,t2,z6,M6,w6,X6,Q6,Y6,x0,j6]);v=class v extends Error{constructor($,X,Q){super(`MCP error ${$}: ${X}`);this.code=$,this.data=Q,this.name="McpError"}}});function c6(){let $=process.argv.join(" ");return $.includes("streamable-http.js")||$.includes("streamable-http.ts")}class q1{context;level;constructor($,X=1){this.context=$,this.level=X}setLevel($){this.level=$}log(...$){if(U1)console.log(...$);else console.error(...$)}logWarn(...$){if(U1)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 U1,M$=($,X=1)=>new q1($,X);var p$=g(()=>{U1=c6()});u$();var f6=60000;class n3{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(J3,(X)=>{let Q=this._requestHandlerAbortControllers.get(X.params.requestId);Q===null||Q===void 0||Q.abort(X.params.reason)}),this.setNotificationHandler(B3,(X)=>{this._onprogress(X)}),this.setRequestHandler(H3,(X)=>({}))}_setupTimeout($,X,Q,Y,G=!1){this._timeoutInfo.set($,{timeoutId:setTimeout(Y,X),startTime:Date.now(),timeout:X,maxTotalTimeout:Q,resetTimeoutOnProgress:G,onTimeout:Y})}_resetTimeout($){let X=this._timeoutInfo.get($);if(!X)return!1;let Q=Date.now()-X.startTime;if(X.maxTotalTimeout&&Q>=X.maxTotalTimeout)throw this._timeoutInfo.delete($),new v(z.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:X.maxTotalTimeout,totalElapsed:Q});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,Q)=>{if(l3(X)||v0(X))this._onresponse(X);else if(E0(X))this._onrequest(X,Q);else if(F0(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 Q=new v(z.ConnectionClosed,"Connection closed");for(let Y of X.values())Y(Q)}_onerror($){var X;(X=this.onerror)===null||X===void 0||X.call(this,$)}_onnotification($){var X;let Q=(X=this._notificationHandlers.get($.method))!==null&&X!==void 0?X:this.fallbackNotificationHandler;if(Q===void 0)return;Promise.resolve().then(()=>Q($)).catch((Y)=>this._onerror(new Error(`Uncaught error in notification handler: ${Y}`)))}_onrequest($,X){var Q,Y,G,W;let H=(Q=this._requestHandlers.get($.method))!==null&&Q!==void 0?Q:this.fallbackRequestHandler;if(H===void 0){(Y=this._transport)===null||Y===void 0||Y.send({jsonrpc:"2.0",id:$.id,error:{code:z.MethodNotFound,message:"Method not found"}}).catch((V)=>this._onerror(new Error(`Failed to send an error response: ${V}`)));return}let B=new AbortController;this._requestHandlerAbortControllers.set($.id,B);let D={signal:B.signal,sessionId:(G=this._transport)===null||G===void 0?void 0:G.sessionId,_meta:(W=$.params)===null||W===void 0?void 0:W._meta,sendNotification:(V)=>this.notification(V,{relatedRequestId:$.id}),sendRequest:(V,j,P)=>this.request(V,j,{...P,relatedRequestId:$.id}),authInfo:X===null||X===void 0?void 0:X.authInfo,requestId:$.id};Promise.resolve().then(()=>H($,D)).then((V)=>{var j;if(B.signal.aborted)return;return(j=this._transport)===null||j===void 0?void 0:j.send({result:V,jsonrpc:"2.0",id:$.id})},(V)=>{var j,P;if(B.signal.aborted)return;return(j=this._transport)===null||j===void 0?void 0:j.send({jsonrpc:"2.0",id:$.id,error:{code:Number.isSafeInteger(V.code)?V.code:z.InternalError,message:(P=V.message)!==null&&P!==void 0?P:"Internal error"}})}).catch((V)=>this._onerror(new Error(`Failed to send response: ${V}`))).finally(()=>{this._requestHandlerAbortControllers.delete($.id)})}_onprogress($){let{progressToken:X,...Q}=$.params,Y=Number(X),G=this._progressHandlers.get(Y);if(!G){this._onerror(new Error(`Received a progress notification for an unknown token: ${JSON.stringify($)}`));return}let W=this._responseHandlers.get(Y),H=this._timeoutInfo.get(Y);if(H&&W&&H.resetTimeoutOnProgress)try{this._resetTimeout(Y)}catch(B){W(B);return}G(Q)}_onresponse($){let X=Number($.id),Q=this._responseHandlers.get(X);if(Q===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),l3($))Q($);else{let Y=new v($.error.code,$.error.message,$.error.data);Q(Y)}}get transport(){return this._transport}async close(){var $;await(($=this._transport)===null||$===void 0?void 0:$.close())}request($,X,Q){let{relatedRequestId:Y,resumptionToken:G,onresumptiontoken:W}=Q!==null&&Q!==void 0?Q:{};return new Promise((H,B)=>{var D,V,j,P,I,l;if(!this._transport){B(new Error("Not connected"));return}if(((D=this._options)===null||D===void 0?void 0:D.enforceStrictCapabilities)===!0)this.assertCapabilityForMethod($.method);(V=Q===null||Q===void 0?void 0:Q.signal)===null||V===void 0||V.throwIfAborted();let R=this._requestMessageId++,d$={...$,jsonrpc:"2.0",id:R};if(Q===null||Q===void 0?void 0:Q.onprogress)this._progressHandlers.set(R,Q.onprogress),d$.params={...$.params,_meta:{...((j=$.params)===null||j===void 0?void 0:j._meta)||{},progressToken:R}};let o$=(y)=>{var X$;this._responseHandlers.delete(R),this._progressHandlers.delete(R),this._cleanupTimeout(R),(X$=this._transport)===null||X$===void 0||X$.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:R,reason:String(y)}},{relatedRequestId:Y,resumptionToken:G,onresumptiontoken:W}).catch((r)=>this._onerror(new Error(`Failed to send cancellation: ${r}`))),B(y)};this._responseHandlers.set(R,(y)=>{var X$;if((X$=Q===null||Q===void 0?void 0:Q.signal)===null||X$===void 0?void 0:X$.aborted)return;if(y instanceof Error)return B(y);try{let r=X.parse(y.result);H(r)}catch(r){B(r)}}),(P=Q===null||Q===void 0?void 0:Q.signal)===null||P===void 0||P.addEventListener("abort",()=>{var y;o$((y=Q===null||Q===void 0?void 0:Q.signal)===null||y===void 0?void 0:y.reason)});let a$=(I=Q===null||Q===void 0?void 0:Q.timeout)!==null&&I!==void 0?I:f6,P3=()=>o$(new v(z.RequestTimeout,"Request timed out",{timeout:a$}));this._setupTimeout(R,a$,Q===null||Q===void 0?void 0:Q.maxTotalTimeout,P3,(l=Q===null||Q===void 0?void 0:Q.resetTimeoutOnProgress)!==null&&l!==void 0?l:!1),this._transport.send(d$,{relatedRequestId:Y,resumptionToken:G,onresumptiontoken:W}).catch((y)=>{this._cleanupTimeout(R),B(y)})})}async notification($,X){if(!this._transport)throw new Error("Not connected");this.assertNotificationCapability($.method);let Q={...$,jsonrpc:"2.0"};await this._transport.send(Q,X)}setRequestHandler($,X){let Q=$.shape.method.value;this.assertRequestHandlerCapability(Q),this._requestHandlers.set(Q,(Y,G)=>{return Promise.resolve(X($.parse(Y),G))})}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,(Q)=>Promise.resolve(X($.parse(Q))))}removeNotificationHandler($){this._notificationHandlers.delete($)}}function h0($,X){return Object.entries(X).reduce((Q,[Y,G])=>{if(G&&typeof G==="object")Q[Y]=Q[Y]?{...Q[Y],...G}:G;else Q[Y]=G;return Q},{...$})}u$();class p3 extends n3{constructor($,X){var Q;super(X);this._serverInfo=$,this._capabilities=(Q=X===null||X===void 0?void 0:X.capabilities)!==null&&Q!==void 0?Q:{},this._instructions=X===null||X===void 0?void 0:X.instructions,this.setRequestHandler(W3,(Y)=>this._oninitialize(Y)),this.setNotificationHandler(m3,()=>{var Y;return(Y=this.oninitialized)===null||Y===void 0?void 0:Y.call(this)})}registerCapabilities($){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=h0(this._capabilities,$)}assertCapabilityForMethod($){var X,Q;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(!((Q=this._clientCapabilities)===null||Q===void 0?void 0:Q.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:U0.includes(X)?X:g3,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"},G3)}async createMessage($,X){return this.request({method:"sampling/createMessage",params:$},u3,X)}async listRoots($,X){return this.request({method:"roots/list",params:$},c3,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 g0=Symbol("Let zodToJsonSchema decide on which parser to use");var Z0={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",openAiAnyTypeName:"OpenAiAnyType"},l0=($)=>typeof $==="string"?{...Z0,name:$}:{...Z0,...$};var m0=($)=>{let X=l0($),Q=X.name!==void 0?[...X.basePath,X.definitionPath,X.name]:X.basePath;return{...X,flags:{hasReferencedOpenAiAnyType:!1},currentPath:Q,propertyPath:void 0,seen:new Map(Object.entries(X.definitions).map(([Y,G])=>[G._def,{def:G._def,path:[...X.basePath,X.definitionPath,Y],jsonSchema:void 0}]))}};function i3($,X,Q,Y){if(!Y?.errorMessages)return;if(Q)$.errorMessage={...$.errorMessage,[X]:Q}}function E($,X,Q,Y,G){$[X]=Q,i3($,X,Y,G)}var L3=($,X)=>{let Q=0;for(;Q<$.length&&Q<X.length;Q++)if($[Q]!==X[Q])break;return[($.length-Q).toString(),...X.slice(Q)].join("/")};_$();function S($){if($.target!=="openAi")return{};let X=[...$.basePath,$.definitionPath,$.openAiAnyTypeName];return $.flags.hasReferencedOpenAiAnyType=!0,{$ref:$.$refStrategy==="relative"?L3(X,$.currentPath):X.join("/")}}_$();function u0($,X){let Q={type:"array"};if($.type?._def&&$.type?._def?.typeName!==_.ZodAny)Q.items=b($.type._def,{...X,currentPath:[...X.currentPath,"items"]});if($.minLength)E(Q,"minItems",$.minLength.value,$.minLength.message,X);if($.maxLength)E(Q,"maxItems",$.maxLength.value,$.maxLength.message,X);if($.exactLength)E(Q,"minItems",$.exactLength.value,$.exactLength.message,X),E(Q,"maxItems",$.exactLength.value,$.exactLength.message,X);return Q}function c0($,X){let Q={type:"integer",format:"int64"};if(!$.checks)return Q;for(let Y of $.checks)switch(Y.kind){case"min":if(X.target==="jsonSchema7")if(Y.inclusive)E(Q,"minimum",Y.value,Y.message,X);else E(Q,"exclusiveMinimum",Y.value,Y.message,X);else{if(!Y.inclusive)Q.exclusiveMinimum=!0;E(Q,"minimum",Y.value,Y.message,X)}break;case"max":if(X.target==="jsonSchema7")if(Y.inclusive)E(Q,"maximum",Y.value,Y.message,X);else E(Q,"exclusiveMaximum",Y.value,Y.message,X);else{if(!Y.inclusive)Q.exclusiveMaximum=!0;E(Q,"maximum",Y.value,Y.message,X)}break;case"multipleOf":E(Q,"multipleOf",Y.value,Y.message,X);break}return Q}function n0(){return{type:"boolean"}}function E3($,X){return b($.type._def,X)}var p0=($,X)=>{return b($.innerType._def,X)};function d3($,X,Q){let Y=Q??X.dateStrategy;if(Array.isArray(Y))return{anyOf:Y.map((G,W)=>d3($,X,G))};switch(Y){case"string":case"format:date-time":return{type:"string",format:"date-time"};case"format:date":return{type:"string",format:"date"};case"integer":return P6($,X)}}var P6=($,X)=>{let Q={type:"integer",format:"unix-time"};if(X.target==="openApi3")return Q;for(let Y of $.checks)switch(Y.kind){case"min":E(Q,"minimum",Y.value,Y.message,X);break;case"max":E(Q,"maximum",Y.value,Y.message,X);break}return Q};function i0($,X){return{...b($.innerType._def,X),default:$.defaultValue()}}function d0($,X){return X.effectStrategy==="input"?b($.schema._def,X):S(X)}function o0($){return{type:"string",enum:Array.from($.values)}}var C6=($)=>{if("type"in $&&$.type==="string")return!1;return"allOf"in $};function a0($,X){let Q=[b($.left._def,{...X,currentPath:[...X.currentPath,"allOf","0"]}),b($.right._def,{...X,currentPath:[...X.currentPath,"allOf","1"]})].filter((W)=>!!W),Y=X.target==="jsonSchema2019-09"?{unevaluatedProperties:!1}:void 0,G=[];return Q.forEach((W)=>{if(C6(W)){if(G.push(...W.allOf),W.unevaluatedProperties===void 0)Y=void 0}else{let H=W;if("additionalProperties"in W&&W.additionalProperties===!1){let{additionalProperties:B,...D}=W;H=D}else Y=void 0;G.push(H)}}),G.length?{allOf:G,...Y}:void 0}function r0($,X){let Q=typeof $.value;if(Q!=="bigint"&&Q!=="number"&&Q!=="boolean"&&Q!=="string")return{type:Array.isArray($.value)?"array":"object"};if(X.target==="openApi3")return{type:Q==="bigint"?"integer":Q,enum:[$.value]};return{type:Q==="bigint"?"integer":Q,const:$.value}}_$();var o3=void 0,o={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(o3===void 0)o3=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u");return o3},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 S3($,X){let Q={type:"string"};if($.checks)for(let Y of $.checks)switch(Y.kind){case"min":E(Q,"minLength",typeof Q.minLength==="number"?Math.max(Q.minLength,Y.value):Y.value,Y.message,X);break;case"max":E(Q,"maxLength",typeof Q.maxLength==="number"?Math.min(Q.maxLength,Y.value):Y.value,Y.message,X);break;case"email":switch(X.emailStrategy){case"format:email":a(Q,"email",Y.message,X);break;case"format:idn-email":a(Q,"idn-email",Y.message,X);break;case"pattern:zod":T(Q,o.email,Y.message,X);break}break;case"url":a(Q,"uri",Y.message,X);break;case"uuid":a(Q,"uuid",Y.message,X);break;case"regex":T(Q,Y.regex,Y.message,X);break;case"cuid":T(Q,o.cuid,Y.message,X);break;case"cuid2":T(Q,o.cuid2,Y.message,X);break;case"startsWith":T(Q,RegExp(`^${a3(Y.value,X)}`),Y.message,X);break;case"endsWith":T(Q,RegExp(`${a3(Y.value,X)}$`),Y.message,X);break;case"datetime":a(Q,"date-time",Y.message,X);break;case"date":a(Q,"date",Y.message,X);break;case"time":a(Q,"time",Y.message,X);break;case"duration":a(Q,"duration",Y.message,X);break;case"length":E(Q,"minLength",typeof Q.minLength==="number"?Math.max(Q.minLength,Y.value):Y.value,Y.message,X),E(Q,"maxLength",typeof Q.maxLength==="number"?Math.min(Q.maxLength,Y.value):Y.value,Y.message,X);break;case"includes":{T(Q,RegExp(a3(Y.value,X)),Y.message,X);break}case"ip":{if(Y.version!=="v6")a(Q,"ipv4",Y.message,X);if(Y.version!=="v4")a(Q,"ipv6",Y.message,X);break}case"base64url":T(Q,o.base64url,Y.message,X);break;case"jwt":T(Q,o.jwt,Y.message,X);break;case"cidr":{if(Y.version!=="v6")T(Q,o.ipv4Cidr,Y.message,X);if(Y.version!=="v4")T(Q,o.ipv6Cidr,Y.message,X);break}case"emoji":T(Q,o.emoji(),Y.message,X);break;case"ulid":{T(Q,o.ulid,Y.message,X);break}case"base64":{switch(X.base64Strategy){case"format:binary":{a(Q,"binary",Y.message,X);break}case"contentEncoding:base64":{E(Q,"contentEncoding","base64",Y.message,X);break}case"pattern:zod":{T(Q,o.base64,Y.message,X);break}}break}case"nanoid":T(Q,o.nanoid,Y.message,X);case"toLowerCase":case"toUpperCase":case"trim":break;default:((G)=>{})(Y)}return Q}function a3($,X){return X.patternStrategy==="escape"?T6($):$}var I6=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function T6($){let X="";for(let Q=0;Q<$.length;Q++){if(!I6.has($[Q]))X+="\\";X+=$[Q]}return X}function a($,X,Q,Y){if($.format||$.anyOf?.some((G)=>G.format)){if(!$.anyOf)$.anyOf=[];if($.format){if($.anyOf.push({format:$.format,...$.errorMessage&&Y.errorMessages&&{errorMessage:{format:$.errorMessage.format}}}),delete $.format,$.errorMessage){if(delete $.errorMessage.format,Object.keys($.errorMessage).length===0)delete $.errorMessage}}$.anyOf.push({format:X,...Q&&Y.errorMessages&&{errorMessage:{format:Q}}})}else E($,"format",X,Q,Y)}function T($,X,Q,Y){if($.pattern||$.allOf?.some((G)=>G.pattern)){if(!$.allOf)$.allOf=[];if($.pattern){if($.allOf.push({pattern:$.pattern,...$.errorMessage&&Y.errorMessages&&{errorMessage:{pattern:$.errorMessage.pattern}}}),delete $.pattern,$.errorMessage){if(delete $.errorMessage.pattern,Object.keys($.errorMessage).length===0)delete $.errorMessage}}$.allOf.push({pattern:t0(X,Y),...Q&&Y.errorMessages&&{errorMessage:{pattern:Q}}})}else E($,"pattern",t0(X,Y),Q,Y)}function t0($,X){if(!X.applyRegexFlags||!$.flags)return $.source;let Q={i:$.flags.includes("i"),m:$.flags.includes("m"),s:$.flags.includes("s")},Y=Q.i?$.source.toLowerCase():$.source,G="",W=!1,H=!1,B=!1;for(let D=0;D<Y.length;D++){if(W){G+=Y[D],W=!1;continue}if(Q.i){if(H){if(Y[D].match(/[a-z]/)){if(B)G+=Y[D],G+=`${Y[D-2]}-${Y[D]}`.toUpperCase(),B=!1;else if(Y[D+1]==="-"&&Y[D+2]?.match(/[a-z]/))G+=Y[D],B=!0;else G+=`${Y[D]}${Y[D].toUpperCase()}`;continue}}else if(Y[D].match(/[a-z]/)){G+=`[${Y[D]}${Y[D].toUpperCase()}]`;continue}}if(Q.m){if(Y[D]==="^"){G+=`(^|(?<=[\r
|
|
3
|
+
]))`;continue}else if(Y[D]==="$"){G+=`($|(?=[\r
|
|
4
|
+
]))`;continue}}if(Q.s&&Y[D]==="."){G+=H?`${Y[D]}\r
|
|
5
|
+
`:`[${Y[D]}\r
|
|
6
|
+
]`;continue}if(G+=Y[D],Y[D]==="\\")W=!0;else if(H&&Y[D]==="]")H=!1;else if(!H&&Y[D]==="[")H=!0}try{new RegExp(G)}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 G}function F3($,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===_.ZodEnum)return{type:"object",required:$.keyType._def.values,properties:$.keyType._def.values.reduce((Y,G)=>({...Y,[G]:b($.valueType._def,{...X,currentPath:[...X.currentPath,"properties",G]})??S(X)}),{}),additionalProperties:X.rejectedAdditionalProperties};let Q={type:"object",additionalProperties:b($.valueType._def,{...X,currentPath:[...X.currentPath,"additionalProperties"]})??X.allowedAdditionalProperties};if(X.target==="openApi3")return Q;if($.keyType?._def.typeName===_.ZodString&&$.keyType._def.checks?.length){let{type:Y,...G}=S3($.keyType._def,X);return{...Q,propertyNames:G}}else if($.keyType?._def.typeName===_.ZodEnum)return{...Q,propertyNames:{enum:$.keyType._def.values}};else if($.keyType?._def.typeName===_.ZodBranded&&$.keyType._def.type._def.typeName===_.ZodString&&$.keyType._def.type._def.checks?.length){let{type:Y,...G}=E3($.keyType._def,X);return{...Q,propertyNames:G}}return Q}function s0($,X){if(X.mapStrategy==="record")return F3($,X);let Q=b($.keyType._def,{...X,currentPath:[...X.currentPath,"items","items","0"]})||S(X),Y=b($.valueType._def,{...X,currentPath:[...X.currentPath,"items","items","1"]})||S(X);return{type:"array",maxItems:125,items:{type:"array",items:[Q,Y],minItems:2,maxItems:2}}}function e0($){let X=$.values,Y=Object.keys($.values).filter((W)=>{return typeof X[X[W]]!=="number"}).map((W)=>X[W]),G=Array.from(new Set(Y.map((W)=>typeof W)));return{type:G.length===1?G[0]==="string"?"string":"number":["string","number"],enum:Y}}function $1($){return $.target==="openAi"?void 0:{not:S({...$,currentPath:[...$.currentPath,"not"]})}}function X1($){return $.target==="openApi3"?{enum:["null"],nullable:!0}:{type:"null"}}var c$={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};function Y1($,X){if(X.target==="openApi3")return Q1($,X);let Q=$.options instanceof Map?Array.from($.options.values()):$.options;if(Q.every((Y)=>(Y._def.typeName in c$)&&(!Y._def.checks||!Y._def.checks.length))){let Y=Q.reduce((G,W)=>{let H=c$[W._def.typeName];return H&&!G.includes(H)?[...G,H]:G},[]);return{type:Y.length>1?Y:Y[0]}}else if(Q.every((Y)=>Y._def.typeName==="ZodLiteral"&&!Y.description)){let Y=Q.reduce((G,W)=>{let H=typeof W._def.value;switch(H){case"string":case"number":case"boolean":return[...G,H];case"bigint":return[...G,"integer"];case"object":if(W._def.value===null)return[...G,"null"];case"symbol":case"undefined":case"function":default:return G}},[]);if(Y.length===Q.length){let G=Y.filter((W,H,B)=>B.indexOf(W)===H);return{type:G.length>1?G:G[0],enum:Q.reduce((W,H)=>{return W.includes(H._def.value)?W:[...W,H._def.value]},[])}}}else if(Q.every((Y)=>Y._def.typeName==="ZodEnum"))return{type:"string",enum:Q.reduce((Y,G)=>[...Y,...G._def.values.filter((W)=>!Y.includes(W))],[])};return Q1($,X)}var Q1=($,X)=>{let Q=($.options instanceof Map?Array.from($.options.values()):$.options).map((Y,G)=>b(Y._def,{...X,currentPath:[...X.currentPath,"anyOf",`${G}`]})).filter((Y)=>!!Y&&(!X.strictUnions||typeof Y==="object"&&Object.keys(Y).length>0));return Q.length?{anyOf:Q}:void 0};function G1($,X){if(["ZodString","ZodNumber","ZodBigInt","ZodBoolean","ZodNull"].includes($.innerType._def.typeName)&&(!$.innerType._def.checks||!$.innerType._def.checks.length)){if(X.target==="openApi3")return{type:c$[$.innerType._def.typeName],nullable:!0};return{type:[c$[$.innerType._def.typeName],"null"]}}if(X.target==="openApi3"){let Y=b($.innerType._def,{...X,currentPath:[...X.currentPath]});if(Y&&"$ref"in Y)return{allOf:[Y],nullable:!0};return Y&&{...Y,nullable:!0}}let Q=b($.innerType._def,{...X,currentPath:[...X.currentPath,"anyOf","0"]});return Q&&{anyOf:[Q,{type:"null"}]}}function J1($,X){let Q={type:"number"};if(!$.checks)return Q;for(let Y of $.checks)switch(Y.kind){case"int":Q.type="integer",i3(Q,"type",Y.message,X);break;case"min":if(X.target==="jsonSchema7")if(Y.inclusive)E(Q,"minimum",Y.value,Y.message,X);else E(Q,"exclusiveMinimum",Y.value,Y.message,X);else{if(!Y.inclusive)Q.exclusiveMinimum=!0;E(Q,"minimum",Y.value,Y.message,X)}break;case"max":if(X.target==="jsonSchema7")if(Y.inclusive)E(Q,"maximum",Y.value,Y.message,X);else E(Q,"exclusiveMaximum",Y.value,Y.message,X);else{if(!Y.inclusive)Q.exclusiveMaximum=!0;E(Q,"maximum",Y.value,Y.message,X)}break;case"multipleOf":E(Q,"multipleOf",Y.value,Y.message,X);break}return Q}function W1($,X){let Q=X.target==="openAi",Y={type:"object",properties:{}},G=[],W=$.shape();for(let B in W){let D=W[B];if(D===void 0||D._def===void 0)continue;let V=y6(D);if(V&&Q){if(D._def.typeName==="ZodOptional")D=D._def.innerType;if(!D.isNullable())D=D.nullable();V=!1}let j=b(D._def,{...X,currentPath:[...X.currentPath,"properties",B],propertyPath:[...X.currentPath,"properties",B]});if(j===void 0)continue;if(Y.properties[B]=j,!V)G.push(B)}if(G.length)Y.required=G;let H=x6($,X);if(H!==void 0)Y.additionalProperties=H;return Y}function x6($,X){if($.catchall._def.typeName!=="ZodNever")return b($.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 y6($){try{return $.isOptional()}catch{return!0}}var H1=($,X)=>{if(X.currentPath.toString()===X.propertyPath?.toString())return b($.innerType._def,X);let Q=b($.innerType._def,{...X,currentPath:[...X.currentPath,"anyOf","1"]});return Q?{anyOf:[{not:S(X)},Q]}:S(X)};var B1=($,X)=>{if(X.pipeStrategy==="input")return b($.in._def,X);else if(X.pipeStrategy==="output")return b($.out._def,X);let Q=b($.in._def,{...X,currentPath:[...X.currentPath,"allOf","0"]}),Y=b($.out._def,{...X,currentPath:[...X.currentPath,"allOf",Q?"1":"0"]});return{allOf:[Q,Y].filter((G)=>G!==void 0)}};function D1($,X){return b($.type._def,X)}function w1($,X){let Y={type:"array",uniqueItems:!0,items:b($.valueType._def,{...X,currentPath:[...X.currentPath,"items"]})};if($.minSize)E(Y,"minItems",$.minSize.value,$.minSize.message,X);if($.maxSize)E(Y,"maxItems",$.maxSize.value,$.maxSize.message,X);return Y}function _1($,X){if($.rest)return{type:"array",minItems:$.items.length,items:$.items.map((Q,Y)=>b(Q._def,{...X,currentPath:[...X.currentPath,"items",`${Y}`]})).reduce((Q,Y)=>Y===void 0?Q:[...Q,Y],[]),additionalItems:b($.rest._def,{...X,currentPath:[...X.currentPath,"additionalItems"]})};else return{type:"array",minItems:$.items.length,maxItems:$.items.length,items:$.items.map((Q,Y)=>b(Q._def,{...X,currentPath:[...X.currentPath,"items",`${Y}`]})).reduce((Q,Y)=>Y===void 0?Q:[...Q,Y],[])}}function M1($){return{not:S($)}}function V1($){return S($)}var N1=($,X)=>{return b($.innerType._def,X)};var O1=($,X,Q)=>{switch(X){case _.ZodString:return S3($,Q);case _.ZodNumber:return J1($,Q);case _.ZodObject:return W1($,Q);case _.ZodBigInt:return c0($,Q);case _.ZodBoolean:return n0();case _.ZodDate:return d3($,Q);case _.ZodUndefined:return M1(Q);case _.ZodNull:return X1(Q);case _.ZodArray:return u0($,Q);case _.ZodUnion:case _.ZodDiscriminatedUnion:return Y1($,Q);case _.ZodIntersection:return a0($,Q);case _.ZodTuple:return _1($,Q);case _.ZodRecord:return F3($,Q);case _.ZodLiteral:return r0($,Q);case _.ZodEnum:return o0($);case _.ZodNativeEnum:return e0($);case _.ZodNullable:return G1($,Q);case _.ZodOptional:return H1($,Q);case _.ZodMap:return s0($,Q);case _.ZodSet:return w1($,Q);case _.ZodLazy:return()=>$.getter()._def;case _.ZodPromise:return D1($,Q);case _.ZodNaN:case _.ZodNever:return $1(Q);case _.ZodEffects:return d0($,Q);case _.ZodAny:return S(Q);case _.ZodUnknown:return V1(Q);case _.ZodDefault:return i0($,Q);case _.ZodBranded:return E3($,Q);case _.ZodReadonly:return N1($,Q);case _.ZodCatch:return p0($,Q);case _.ZodPipeline:return B1($,Q);case _.ZodFunction:case _.ZodVoid:case _.ZodSymbol:return;default:return((Y)=>{return})(X)}};function b($,X,Q=!1){let Y=X.seen.get($);if(X.override){let B=X.override?.($,X,Y,Q);if(B!==g0)return B}if(Y&&!Q){let B=h6(Y,X);if(B!==void 0)return B}let G={def:$,path:X.currentPath,jsonSchema:void 0};X.seen.set($,G);let W=O1($,$.typeName,X),H=typeof W==="function"?b(W(),X):W;if(H)Z6($,X,H);if(X.postProcess){let B=X.postProcess(H,$,X);return G.jsonSchema=H,B}return G.jsonSchema=H,H}var h6=($,X)=>{switch(X.$refStrategy){case"root":return{$ref:$.path.join("/")};case"relative":return{$ref:L3(X.currentPath,$.path)};case"none":case"seen":{if($.path.length<X.currentPath.length&&$.path.every((Q,Y)=>X.currentPath[Y]===Q))return console.warn(`Recursive reference detected at ${X.currentPath.join("/")}! Defaulting to any`),S(X);return X.$refStrategy==="seen"?S(X):void 0}}},Z6=($,X,Q)=>{if($.description){if(Q.description=$.description,X.markdownDescription)Q.markdownDescription=$.description}return Q};var z3=($,X)=>{let Q=m0(X),Y=typeof X==="object"&&X.definitions?Object.entries(X.definitions).reduce((D,[V,j])=>({...D,[V]:b(j._def,{...Q,currentPath:[...Q.basePath,Q.definitionPath,V]},!0)??S(Q)}),{}):void 0,G=typeof X==="string"?X:X?.nameStrategy==="title"?void 0:X?.name,W=b($._def,G===void 0?Q:{...Q,currentPath:[...Q.basePath,Q.definitionPath,G]},!1)??S(Q),H=typeof X==="object"&&X.name!==void 0&&X.nameStrategy==="title"?X.name:void 0;if(H!==void 0)W.title=H;if(Q.flags.hasReferencedOpenAiAnyType){if(!Y)Y={};if(!Y[Q.openAiAnyTypeName])Y[Q.openAiAnyTypeName]={type:["string","number","integer","boolean","array","null"],items:{$ref:Q.$refStrategy==="relative"?"1":[...Q.basePath,Q.definitionPath,Q.openAiAnyTypeName].join("/")}}}let B=G===void 0?Y?{...W,[Q.definitionPath]:Y}:W:{$ref:[...Q.$refStrategy==="relative"?[]:Q.basePath,Q.definitionPath,G].join("/"),[Q.definitionPath]:{...Y,[G]:W}};if(Q.target==="jsonSchema7")B.$schema="http://json-schema.org/draft-07/schema#";else if(Q.target==="jsonSchema2019-09"||Q.target==="openAi")B.$schema="https://json-schema.org/draft/2019-09/schema#";if(Q.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};_$();u$();_$();var r3;(function($){$.Completable="McpCompletable"})(r3||(r3={}));class n$ extends q{_parse($){let{ctx:X}=this._processInputParams($),Q=X.data;return this._def.type._parse({data:Q,path:X.path,parent:X})}unwrap(){return this._def.type}}n$.create=($,X)=>{return new n$({type:$,typeName:r3.Completable,complete:X.complete,...g6(X)})};function g6($){if(!$)return{};let{errorMap:X,invalid_type_error:Q,required_error:Y,description:G}=$;if(X&&(Q||Y))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);if(X)return{errorMap:X,description:G};return{errorMap:(H,B)=>{var D,V;let{message:j}=$;if(H.code==="invalid_enum_value")return{message:j!==null&&j!==void 0?j:B.defaultError};if(typeof B.data==="undefined")return{message:(D=j!==null&&j!==void 0?j:Y)!==null&&D!==void 0?D:B.defaultError};if(H.code!=="invalid_type")return{message:B.defaultError};return{message:(V=j!==null&&j!==void 0?j:Q)!==null&&V!==void 0?V:B.defaultError}},description:G}}class t3{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 p3($,X)}async connect($){return await this.server.connect($)}async close(){await this.server.close()}setToolRequestHandlers(){if(this._toolHandlersInitialized)return;this.server.assertCanSetRequestHandler(U3.shape.method.value),this.server.assertCanSetRequestHandler(q3.shape.method.value),this.server.registerCapabilities({tools:{listChanged:!0}}),this.server.setRequestHandler(U3,()=>({tools:Object.entries(this._registeredTools).filter(([,$])=>$.enabled).map(([$,X])=>{let Q={name:$,description:X.description,inputSchema:X.inputSchema?z3(X.inputSchema,{strictUnions:!0}):l6,annotations:X.annotations};if(X.outputSchema)Q.outputSchema=z3(X.outputSchema,{strictUnions:!0});return Q})})),this.server.setRequestHandler(q3,async($,X)=>{let Q=this._registeredTools[$.params.name];if(!Q)throw new v(z.InvalidParams,`Tool ${$.params.name} not found`);if(!Q.enabled)throw new v(z.InvalidParams,`Tool ${$.params.name} disabled`);let Y;if(Q.inputSchema){let G=await Q.inputSchema.safeParseAsync($.params.arguments);if(!G.success)throw new v(z.InvalidParams,`Invalid arguments for tool ${$.params.name}: ${G.error.message}`);let W=G.data,H=Q.callback;try{Y=await Promise.resolve(H(W,X))}catch(B){Y={content:[{type:"text",text:B instanceof Error?B.message:String(B)}],isError:!0}}}else{let G=Q.callback;try{Y=await Promise.resolve(G(X))}catch(W){Y={content:[{type:"text",text:W instanceof Error?W.message:String(W)}],isError:!0}}}if(Q.outputSchema){if(!Y.structuredContent)throw new v(z.InvalidParams,`Tool ${$.params.name} has an output schema but no structured content was provided`);let G=await Q.outputSchema.safeParseAsync(Y.structuredContent);if(!G.success)throw new v(z.InvalidParams,`Invalid structured content for tool ${$.params.name}: ${G.error.message}`)}return Y}),this._toolHandlersInitialized=!0}setCompletionRequestHandler(){if(this._completionHandlerInitialized)return;this.server.assertCanSetRequestHandler(K3.shape.method.value),this.server.setRequestHandler(K3,async($)=>{switch($.params.ref.type){case"ref/prompt":return this.handlePromptCompletion($,$.params.ref);case"ref/resource":return this.handleResourceCompletion($,$.params.ref);default:throw new v(z.InvalidParams,`Invalid completion reference: ${$.params.ref}`)}}),this._completionHandlerInitialized=!0}async handlePromptCompletion($,X){let Q=this._registeredPrompts[X.name];if(!Q)throw new v(z.InvalidParams,`Prompt ${X.name} not found`);if(!Q.enabled)throw new v(z.InvalidParams,`Prompt ${X.name} disabled`);if(!Q.argsSchema)return R3;let Y=Q.argsSchema.shape[$.params.argument.name];if(!(Y instanceof n$))return R3;let W=await Y._def.complete($.params.argument.value);return A1(W)}async handleResourceCompletion($,X){let Q=Object.values(this._registeredResourceTemplates).find((W)=>W.resourceTemplate.uriTemplate.toString()===X.uri);if(!Q){if(this._registeredResources[X.uri])return R3;throw new v(z.InvalidParams,`Resource template ${$.params.ref.uri} not found`)}let Y=Q.resourceTemplate.completeCallback($.params.argument.name);if(!Y)return R3;let G=await Y($.params.argument.value);return A1(G)}setResourceRequestHandlers(){if(this._resourceHandlersInitialized)return;this.server.assertCanSetRequestHandler(_3.shape.method.value),this.server.assertCanSetRequestHandler(M3.shape.method.value),this.server.assertCanSetRequestHandler(V3.shape.method.value),this.server.registerCapabilities({resources:{listChanged:!0}}),this.server.setRequestHandler(_3,async($,X)=>{let Q=Object.entries(this._registeredResources).filter(([G,W])=>W.enabled).map(([G,W])=>({uri:G,name:W.name,...W.metadata})),Y=[];for(let G of Object.values(this._registeredResourceTemplates)){if(!G.resourceTemplate.listCallback)continue;let W=await G.resourceTemplate.listCallback(X);for(let H of W.resources)Y.push({...H,...G.metadata})}return{resources:[...Q,...Y]}}),this.server.setRequestHandler(M3,async()=>{return{resourceTemplates:Object.entries(this._registeredResourceTemplates).map(([X,Q])=>({name:X,uriTemplate:Q.resourceTemplate.uriTemplate.toString(),...Q.metadata}))}}),this.server.setRequestHandler(V3,async($,X)=>{let Q=new URL($.params.uri),Y=this._registeredResources[Q.toString()];if(Y){if(!Y.enabled)throw new v(z.InvalidParams,`Resource ${Q} disabled`);return Y.readCallback(Q,X)}for(let G of Object.values(this._registeredResourceTemplates)){let W=G.resourceTemplate.uriTemplate.match(Q.toString());if(W)return G.readCallback(Q,W,X)}throw new v(z.InvalidParams,`Resource ${Q} not found`)}),this.setCompletionRequestHandler(),this._resourceHandlersInitialized=!0}setPromptRequestHandlers(){if(this._promptHandlersInitialized)return;this.server.assertCanSetRequestHandler(N3.shape.method.value),this.server.assertCanSetRequestHandler(O3.shape.method.value),this.server.registerCapabilities({prompts:{listChanged:!0}}),this.server.setRequestHandler(N3,()=>({prompts:Object.entries(this._registeredPrompts).filter(([,$])=>$.enabled).map(([$,X])=>{return{name:$,description:X.description,arguments:X.argsSchema?u6(X.argsSchema):void 0}})})),this.server.setRequestHandler(O3,async($,X)=>{let Q=this._registeredPrompts[$.params.name];if(!Q)throw new v(z.InvalidParams,`Prompt ${$.params.name} not found`);if(!Q.enabled)throw new v(z.InvalidParams,`Prompt ${$.params.name} disabled`);if(Q.argsSchema){let Y=await Q.argsSchema.safeParseAsync($.params.arguments);if(!Y.success)throw new v(z.InvalidParams,`Invalid arguments for prompt ${$.params.name}: ${Y.error.message}`);let G=Y.data,W=Q.callback;return await Promise.resolve(W(G,X))}else{let Y=Q.callback;return await Promise.resolve(Y(X))}}),this.setCompletionRequestHandler(),this._promptHandlersInitialized=!0}resource($,X,...Q){let Y;if(typeof Q[0]==="object")Y=Q.shift();let G=Q[0];if(typeof X==="string"){if(this._registeredResources[X])throw new Error(`Resource ${X} is already registered`);let W={name:$,metadata:Y,readCallback:G,enabled:!0,disable:()=>W.update({enabled:!1}),enable:()=>W.update({enabled:!0}),remove:()=>W.update({uri:null}),update:(H)=>{if(typeof H.uri!=="undefined"&&H.uri!==X){if(delete this._registeredResources[X],H.uri)this._registeredResources[H.uri]=W}if(typeof H.name!=="undefined")W.name=H.name;if(typeof H.metadata!=="undefined")W.metadata=H.metadata;if(typeof H.callback!=="undefined")W.readCallback=H.callback;if(typeof H.enabled!=="undefined")W.enabled=H.enabled;this.sendResourceListChanged()}};return this._registeredResources[X]=W,this.setResourceRequestHandlers(),this.sendResourceListChanged(),W}else{if(this._registeredResourceTemplates[$])throw new Error(`Resource template ${$} is already registered`);let W={resourceTemplate:X,metadata:Y,readCallback:G,enabled:!0,disable:()=>W.update({enabled:!1}),enable:()=>W.update({enabled:!0}),remove:()=>W.update({name:null}),update:(H)=>{if(typeof H.name!=="undefined"&&H.name!==$){if(delete this._registeredResourceTemplates[$],H.name)this._registeredResourceTemplates[H.name]=W}if(typeof H.template!=="undefined")W.resourceTemplate=H.template;if(typeof H.metadata!=="undefined")W.metadata=H.metadata;if(typeof H.callback!=="undefined")W.readCallback=H.callback;if(typeof H.enabled!=="undefined")W.enabled=H.enabled;this.sendResourceListChanged()}};return this._registeredResourceTemplates[$]=W,this.setResourceRequestHandlers(),this.sendResourceListChanged(),W}}_createRegisteredTool($,X,Q,Y,G,W){let H={description:X,inputSchema:Q===void 0?void 0:J.object(Q),outputSchema:Y===void 0?void 0:J.object(Y),annotations:G,callback:W,enabled:!0,disable:()=>H.update({enabled:!1}),enable:()=>H.update({enabled:!0}),remove:()=>H.update({name:null}),update:(B)=>{if(typeof B.name!=="undefined"&&B.name!==$){if(delete this._registeredTools[$],B.name)this._registeredTools[B.name]=H}if(typeof B.description!=="undefined")H.description=B.description;if(typeof B.paramsSchema!=="undefined")H.inputSchema=J.object(B.paramsSchema);if(typeof B.callback!=="undefined")H.callback=B.callback;if(typeof B.annotations!=="undefined")H.annotations=B.annotations;if(typeof B.enabled!=="undefined")H.enabled=B.enabled;this.sendToolListChanged()}};return this._registeredTools[$]=H,this.setToolRequestHandlers(),this.sendToolListChanged(),H}tool($,...X){if(this._registeredTools[$])throw new Error(`Tool ${$} is already registered`);let Q,Y,G,W;if(typeof X[0]==="string")Q=X.shift();if(X.length>1){let B=X[0];if(j1(B)){if(Y=X.shift(),X.length>1&&typeof X[0]==="object"&&X[0]!==null&&!j1(X[0]))W=X.shift()}else if(typeof B==="object"&&B!==null)W=X.shift()}let H=X[0];return this._createRegisteredTool($,Q,Y,G,W,H)}registerTool($,X,Q){if(this._registeredTools[$])throw new Error(`Tool ${$} is already registered`);let{description:Y,inputSchema:G,outputSchema:W,annotations:H}=X;return this._createRegisteredTool($,Y,G,W,H,Q)}prompt($,...X){if(this._registeredPrompts[$])throw new Error(`Prompt ${$} is already registered`);let Q;if(typeof X[0]==="string")Q=X.shift();let Y;if(X.length>1)Y=X.shift();let G=X[0],W={description:Q,argsSchema:Y===void 0?void 0:J.object(Y),callback:G,enabled:!0,disable:()=>W.update({enabled:!1}),enable:()=>W.update({enabled:!0}),remove:()=>W.update({name:null}),update:(H)=>{if(typeof H.name!=="undefined"&&H.name!==$){if(delete this._registeredPrompts[$],H.name)this._registeredPrompts[H.name]=W}if(typeof H.description!=="undefined")W.description=H.description;if(typeof H.argsSchema!=="undefined")W.argsSchema=J.object(H.argsSchema);if(typeof H.callback!=="undefined")W.callback=H.callback;if(typeof H.enabled!=="undefined")W.enabled=H.enabled;this.sendPromptListChanged()}};return this._registeredPrompts[$]=W,this.setPromptRequestHandlers(),this.sendPromptListChanged(),W}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 l6={type:"object"};function j1($){if(typeof $!=="object"||$===null)return!1;return Object.keys($).length===0||Object.values($).some(m6)}function m6($){return $!==null&&typeof $==="object"&&"parse"in $&&typeof $.parse==="function"&&"safeParse"in $&&typeof $.safeParse==="function"}function u6($){return Object.entries($.shape).map(([X,Q])=>({name:X,description:Q.description,required:!Q.isOptional()}))}function A1($){return{completion:{values:$.slice(0,100),total:$.length,hasMore:$.length>100}}}var R3={completion:{values:[],hasMore:!1}};function b1($,X){let Q=process.argv,Y=`--${$}=`;for(let G of Q)if(G.startsWith(Y))return G.substring(Y.length);return X}p$();var n6=M$("FigmaConfig",1),p6=b1("figma-api-key")||process.env.FIGMA_API_KEY||"",K1="F2C MCP",L1=process.env.FIGMA_VERSION||"0.0.1";n6.debug("DEFAULT_PERSONAL_TOKEN",p6);_$();p$();var z1=require("node:crypto");p$();var k=M$("ptdTool"),x=null,i$=0,E1=10,i6=1000,k3=null,d6=process.argv.slice(2),S1=d6.find(($)=>$.startsWith("--server=")),v3=S1?S1.split("=")[1]:"localhost",F1=v3==="localhost"?`ws://${v3}`:`wss://${v3}`,J$=new Map;function s3($=3055){if(x&&x.readyState===WebSocket.OPEN){k.info("Already connected to Figma");return}let X=v3==="localhost"?`${F1}:${$}`:F1;k.info(`Connecting to Figma socket server at ${X}...`),x=new WebSocket(X),k.info("Connecting",x.readyState,WebSocket.OPEN),x.onopen=()=>{k.info("Successfully connected to Figma socket server"),k3=null,i$=0},x.onmessage=(Q)=>{try{let Y=JSON.parse(Q.data);if(k.log("onmessage"+JSON.stringify(Y)),Y.type==="ping"){x?.send(JSON.stringify({type:"pong"}));return}let G=Y.message;if(G.id&&J$.has(G.id)&&G.result){let W=J$.get(G.id);if(clearTimeout(W.timeout),G.error)k.error(`Error from Figma: ${G.error}`),W.reject(new Error(G.error));else if(G.result)W.resolve(G.result);J$.delete(G.id)}else k.info(`Received broadcast message: ${JSON.stringify(G)}`)}catch(Y){k.error(`Error parsing message: ${Y instanceof Error?Y.message:String(Y)}`)}},x.onerror=(Q)=>{k.error(`Socket error: ${Q instanceof Error?Q.message:String(Q)}`,Q)},x.onclose=(Q)=>{k.info(`Disconnected from Figma socket server, Code: ${Q.code}, Reason: ${Q.reason}`),x=null;for(let[Y,G]of J$.entries())clearTimeout(G.timeout),G.reject(new Error("Connection closed")),J$.delete(Y);if(i$<E1){let Y=i6*Math.pow(2,i$);k.info(`Attempting to reconnect in ${Y/1000} seconds... (Attempt ${i$+1}/${E1})`),setTimeout(()=>s3($),Y),i$++}else k.error("Max reconnection attempts reached. Will not try again.")}}async function R1(){try{console.log("FigmaMCP server starting...");let $=process.env.PORT?parseInt(process.env.PORT,10):3055;s3($)}catch($){k.warn(`Could not connect to Figma initially: ${$ instanceof Error?$.message:String($)}`),k.warn("Will try to connect when the first command is sent")}k.info("FigmaMCP server running on stdio")}async function v1($){if(!x||x.readyState!==WebSocket.OPEN)throw new Error("Not connected to Figma");try{await K("join",{channel:$}),k3=$,k.info(`Joined channel: ${$}`)}catch(X){throw k.error(`Failed to join channel: ${X instanceof Error?X.message:String(X)}`),X}}function K($,X={},Q=30000){return new Promise((Y,G)=>{if(!x||x.readyState!==WebSocket.OPEN){s3(),G(new Error("Not connected to Figma. Attempting to connect..."));return}if($!=="join"&&!k3){G(new Error("Must join a channel before sending commands"));return}let H=z1.randomUUID(),B={id:H,type:$==="join"?"join":"message",...$==="join"?{channel:X.channel}:{channel:k3},message:{id:H,command:$,params:{...X,commandId:H}}};k.info(`Sending command to Figma: ${JSON.stringify(B)}`);let D=setTimeout(()=>{if(J$.has(H)){let{reject:V,...j}=J$.get(H);k.error(`Request to Figma timed out after ${Q/1000} seconds. Request details: ${JSON.stringify(j)}`),J$.delete(H),G(new Error("Request to Figma timed out"))}},Q);J$.set(H,{resolve:Y,reject:G,timeout:D,lastActivity:Date.now()}),k.info(`Sending command to Figma: ${$}`),k.debug(`Request details: ${JSON.stringify(B)}`),x.send(JSON.stringify(B))})}function e3($){if($.startsWith("#"))return $;let X=Math.round($.r*255),Q=Math.round($.g*255),Y=Math.round($.b*255),G=Math.round($.a*255);return`#${X.toString(16).padStart(2,"0")}${Q.toString(16).padStart(2,"0")}${Y.toString(16).padStart(2,"0")}${G===255?"":G.toString(16).padStart(2,"0")}`}function f3($){if($.type==="VECTOR")return null;let X={id:$.id,name:$.name,type:$.type};if($.fills&&$.fills.length>0)X.fills=$.fills.map((Q)=>{let Y={...Q};if(delete Y.boundVariables,delete Y.imageRef,Y.gradientStops)Y.gradientStops=Y.gradientStops.map((G)=>{let W={...G};if(W.color)W.color=e3(W.color);return delete W.boundVariables,W});if(Y.color)Y.color=e3(Y.color);return Y});if($.strokes&&$.strokes.length>0)X.strokes=$.strokes.map((Q)=>{let Y={...Q};if(delete Y.boundVariables,Y.color)Y.color=e3(Y.color);return Y});if($.cornerRadius!==void 0)X.cornerRadius=$.cornerRadius;if($.absoluteBoundingBox)X.absoluteBoundingBox=$.absoluteBoundingBox;if($.characters)X.characters=$.characters;if($.style)X.style={fontFamily:$.style.fontFamily,fontStyle:$.style.fontStyle,fontWeight:$.style.fontWeight,fontSize:$.style.fontSize,textAlignHorizontal:$.style.textAlignHorizontal,letterSpacing:$.style.letterSpacing,lineHeightPx:$.style.lineHeightPx};if($.children)X.children=$.children.map((Q)=>f3(Q)).filter((Q)=>Q!==null);return X}var o6=M$("ptdTool");function k1($){$.tool("get_document_info","Get detailed information about the current Figma document",{},async()=>{try{let X=await K("get_document_info");return{content:[{type:"text",text:JSON.stringify(X)}]}}catch(X){return{content:[{type:"text",text:`Error getting document info: ${X instanceof Error?X.message:String(X)}`}]}}}),$.tool("get_selection","Get information about the current selection in Figma",{},async()=>{try{let X=await K("get_selection");return{content:[{type:"text",text:JSON.stringify(X)}]}}catch(X){return{content:[{type:"text",text:`Error getting selection: ${X instanceof Error?X.message:String(X)}`}]}}}),$.tool("get_node_info","Get detailed information about a specific node in Figma",{nodeId:J.string().describe("The ID of the node to get information about")},async({nodeId:X})=>{try{let Q=await K("get_node_info",{nodeId:X});return{content:[{type:"text",text:JSON.stringify(f3(Q))}]}}catch(Q){return{content:[{type:"text",text:`Error getting node info: ${Q instanceof Error?Q.message:String(Q)}`}]}}}),$.tool("get_nodes_info","Get detailed information about multiple nodes in Figma",{nodeIds:J.array(J.string()).describe("Array of node IDs to get information about")},async({nodeIds:X})=>{try{let Q=await Promise.all(X.map(async(Y)=>{let G=await K("get_node_info",{nodeId:Y});return{nodeId:Y,info:G}}));return{content:[{type:"text",text:JSON.stringify(Q.map((Y)=>f3(Y.info)))}]}}catch(Q){return{content:[{type:"text",text:`Error getting nodes info: ${Q instanceof Error?Q.message:String(Q)}`}]}}}),$.tool("create_rectangle","Create a new rectangle in Figma",{x:J.number().describe("X position"),y:J.number().describe("Y position"),width:J.number().describe("Width of the rectangle"),height:J.number().describe("Height of the rectangle"),name:J.string().optional().describe("Optional name for the rectangle"),parentId:J.string().optional().describe("Optional parent node ID to append the rectangle to")},async({x:X,y:Q,width:Y,height:G,name:W,parentId:H})=>{try{let B=await K("create_rectangle",{x:X,y:Q,width:Y,height:G,name:W||"Rectangle",parentId:H});return{content:[{type:"text",text:`Created rectangle "${JSON.stringify(B)}"`}]}}catch(B){return{content:[{type:"text",text:`Error creating rectangle: ${B instanceof Error?B.message:String(B)}`}]}}}),$.tool("create_frame","Create a new frame in Figma",{x:J.number().describe("X position"),y:J.number().describe("Y position"),width:J.number().describe("Width of the frame"),height:J.number().describe("Height of the frame"),name:J.string().optional().describe("Optional name for the frame"),parentId:J.string().optional().describe("Optional parent node ID to append the frame to"),fillColor:J.object({r:J.number().min(0).max(1).describe("Red component (0-1)"),g:J.number().min(0).max(1).describe("Green component (0-1)"),b:J.number().min(0).max(1).describe("Blue component (0-1)"),a:J.number().min(0).max(1).optional().describe("Alpha component (0-1)")}).optional().describe("Fill color in RGBA format"),strokeColor:J.object({r:J.number().min(0).max(1).describe("Red component (0-1)"),g:J.number().min(0).max(1).describe("Green component (0-1)"),b:J.number().min(0).max(1).describe("Blue component (0-1)"),a:J.number().min(0).max(1).optional().describe("Alpha component (0-1)")}).optional().describe("Stroke color in RGBA format"),strokeWeight:J.number().positive().optional().describe("Stroke weight"),layoutMode:J.enum(["NONE","HORIZONTAL","VERTICAL"]).optional().describe("Auto-layout mode for the frame"),layoutWrap:J.enum(["NO_WRAP","WRAP"]).optional().describe("Whether the auto-layout frame wraps its children"),paddingTop:J.number().optional().describe("Top padding for auto-layout frame"),paddingRight:J.number().optional().describe("Right padding for auto-layout frame"),paddingBottom:J.number().optional().describe("Bottom padding for auto-layout frame"),paddingLeft:J.number().optional().describe("Left padding for auto-layout frame"),primaryAxisAlignItems:J.enum(["MIN","MAX","CENTER","SPACE_BETWEEN"]).optional().describe("Primary axis alignment for auto-layout frame. Note: When set to SPACE_BETWEEN, itemSpacing will be ignored as children will be evenly spaced."),counterAxisAlignItems:J.enum(["MIN","MAX","CENTER","BASELINE"]).optional().describe("Counter axis alignment for auto-layout frame"),layoutSizingHorizontal:J.enum(["FIXED","HUG","FILL"]).optional().describe("Horizontal sizing mode for auto-layout frame"),layoutSizingVertical:J.enum(["FIXED","HUG","FILL"]).optional().describe("Vertical sizing mode for auto-layout frame"),itemSpacing:J.number().optional().describe("Distance between children in auto-layout frame. Note: This value will be ignored if primaryAxisAlignItems is set to SPACE_BETWEEN.")},async({x:X,y:Q,width:Y,height:G,name:W,parentId:H,fillColor:B,strokeColor:D,strokeWeight:V,layoutMode:j,layoutWrap:P,paddingTop:I,paddingRight:l,paddingBottom:R,paddingLeft:d$,primaryAxisAlignItems:o$,counterAxisAlignItems:a$,layoutSizingHorizontal:P3,layoutSizingVertical:y,itemSpacing:X$})=>{try{let G0=await K("create_frame",{x:X,y:Q,width:Y,height:G,name:W||"Frame",parentId:H,fillColor:B||{r:1,g:1,b:1,a:1},strokeColor:D,strokeWeight:V,layoutMode:j,layoutWrap:P,paddingTop:I,paddingRight:l,paddingBottom:R,paddingLeft:d$,primaryAxisAlignItems:o$,counterAxisAlignItems:a$,layoutSizingHorizontal:P3,layoutSizingVertical:y,itemSpacing:X$});return{content:[{type:"text",text:`Created frame "${G0.name}" with ID: ${G0.id}. Use the ID as the parentId to appendChild inside this frame.`}]}}catch(r){return{content:[{type:"text",text:`Error creating frame: ${r instanceof Error?r.message:String(r)}`}]}}}),$.tool("create_text","Create a new text element in Figma",{x:J.number().describe("X position"),y:J.number().describe("Y position"),text:J.string().describe("Text content"),fontSize:J.number().optional().describe("Font size (default: 14)"),fontWeight:J.number().optional().describe("Font weight (e.g., 400 for Regular, 700 for Bold)"),fontColor:J.object({r:J.number().min(0).max(1).describe("Red component (0-1)"),g:J.number().min(0).max(1).describe("Green component (0-1)"),b:J.number().min(0).max(1).describe("Blue component (0-1)"),a:J.number().min(0).max(1).optional().describe("Alpha component (0-1)")}).optional().describe("Font color in RGBA format"),name:J.string().optional().describe("Semantic layer name for the text node"),parentId:J.string().optional().describe("Optional parent node ID to append the text to")},async({x:X,y:Q,text:Y,fontSize:G,fontWeight:W,fontColor:H,name:B,parentId:D})=>{try{let j=await K("create_text",{x:X,y:Q,text:Y,fontSize:G||14,fontWeight:W||400,fontColor:H||{r:0,g:0,b:0,a:1},name:B||"Text",parentId:D});return{content:[{type:"text",text:`Created text "${j.name}" with ID: ${j.id}`}]}}catch(V){return{content:[{type:"text",text:`Error creating text: ${V instanceof Error?V.message:String(V)}`}]}}}),$.tool("set_fill_color","Set the fill color of a node in Figma can be TextNode or FrameNode",{nodeId:J.string().describe("The ID of the node to modify"),r:J.number().min(0).max(1).describe("Red component (0-1)"),g:J.number().min(0).max(1).describe("Green component (0-1)"),b:J.number().min(0).max(1).describe("Blue component (0-1)"),a:J.number().min(0).max(1).optional().describe("Alpha component (0-1)")},async({nodeId:X,r:Q,g:Y,b:G,a:W})=>{try{return{content:[{type:"text",text:`Set fill color of node "${(await K("set_fill_color",{nodeId:X,color:{r:Q,g:Y,b:G,a:W||1}})).name}" to RGBA(${Q}, ${Y}, ${G}, ${W||1})`}]}}catch(H){return{content:[{type:"text",text:`Error setting fill color: ${H instanceof Error?H.message:String(H)}`}]}}}),$.tool("set_stroke_color","Set the stroke color of a node in Figma",{nodeId:J.string().describe("The ID of the node to modify"),r:J.number().min(0).max(1).describe("Red component (0-1)"),g:J.number().min(0).max(1).describe("Green component (0-1)"),b:J.number().min(0).max(1).describe("Blue component (0-1)"),a:J.number().min(0).max(1).optional().describe("Alpha component (0-1)"),weight:J.number().positive().optional().describe("Stroke weight")},async({nodeId:X,r:Q,g:Y,b:G,a:W,weight:H})=>{try{return{content:[{type:"text",text:`Set stroke color of node "${(await K("set_stroke_color",{nodeId:X,color:{r:Q,g:Y,b:G,a:W||1},weight:H||1})).name}" to RGBA(${Q}, ${Y}, ${G}, ${W||1}) with weight ${H||1}`}]}}catch(B){return{content:[{type:"text",text:`Error setting stroke color: ${B instanceof Error?B.message:String(B)}`}]}}}),$.tool("move_node","Move a node to a new position in Figma",{nodeId:J.string().describe("The ID of the node to move"),x:J.number().describe("New X position"),y:J.number().describe("New Y position")},async({nodeId:X,x:Q,y:Y})=>{try{return{content:[{type:"text",text:`Moved node "${(await K("move_node",{nodeId:X,x:Q,y:Y})).name}" to position (${Q}, ${Y})`}]}}catch(G){return{content:[{type:"text",text:`Error moving node: ${G instanceof Error?G.message:String(G)}`}]}}}),$.tool("clone_node","Clone an existing node in Figma",{nodeId:J.string().describe("The ID of the node to clone"),x:J.number().optional().describe("New X position for the clone"),y:J.number().optional().describe("New Y position for the clone")},async({nodeId:X,x:Q,y:Y})=>{try{let W=await K("clone_node",{nodeId:X,x:Q,y:Y});return{content:[{type:"text",text:`Cloned node "${W.name}" with new ID: ${W.id}${Q!==void 0&&Y!==void 0?` at position (${Q}, ${Y})`:""}`}]}}catch(G){return{content:[{type:"text",text:`Error cloning node: ${G instanceof Error?G.message:String(G)}`}]}}}),$.tool("resize_node","Resize a node in Figma",{nodeId:J.string().describe("The ID of the node to resize"),width:J.number().positive().describe("New width"),height:J.number().positive().describe("New height")},async({nodeId:X,width:Q,height:Y})=>{try{return{content:[{type:"text",text:`Resized node "${(await K("resize_node",{nodeId:X,width:Q,height:Y})).name}" to width ${Q} and height ${Y}`}]}}catch(G){return{content:[{type:"text",text:`Error resizing node: ${G instanceof Error?G.message:String(G)}`}]}}}),$.tool("delete_multiple_nodes","Delete multiple nodes from Figma at once",{nodeIds:J.array(J.string()).describe("Array of node IDs to delete")},async({nodeIds:X})=>{try{let Q=await K("delete_multiple_nodes",{nodeIds:X});return{content:[{type:"text",text:JSON.stringify(Q)}]}}catch(Q){return{content:[{type:"text",text:`Error deleting multiple nodes: ${Q instanceof Error?Q.message:String(Q)}`}]}}}),$.tool("export_node_as_image","Export a node as an image from Figma",{nodeId:J.string().describe("The ID of the node to export"),format:J.enum(["PNG","JPG","SVG","PDF"]).optional().describe("Export format"),scale:J.number().positive().optional().describe("Export scale")},async({nodeId:X,format:Q,scale:Y})=>{try{let W=await K("export_node_as_image",{nodeId:X,format:Q||"PNG",scale:Y||1});return{content:[{type:"image",data:W.imageData,mimeType:W.mimeType||"image/png"}]}}catch(G){return{content:[{type:"text",text:`Error exporting node as image: ${G instanceof Error?G.message:String(G)}`}]}}}),$.tool("set_text_content","Set the text content of an existing text node in Figma",{nodeId:J.string().describe("The ID of the text node to modify"),text:J.string().describe("New text content")},async({nodeId:X,text:Q})=>{try{return{content:[{type:"text",text:`Updated text content of node "${(await K("set_text_content",{nodeId:X,text:Q})).name}" to "${Q}"`}]}}catch(Y){return{content:[{type:"text",text:`Error setting text content: ${Y instanceof Error?Y.message:String(Y)}`}]}}}),$.tool("get_styles","Get all styles from the current Figma document",{},async()=>{try{let X=await K("get_styles");return{content:[{type:"text",text:JSON.stringify(X)}]}}catch(X){return{content:[{type:"text",text:`Error getting styles: ${X instanceof Error?X.message:String(X)}`}]}}}),$.tool("get_local_components","Get all local components from the Figma document",{},async()=>{try{let X=await K("get_local_components");return{content:[{type:"text",text:JSON.stringify(X)}]}}catch(X){return{content:[{type:"text",text:`Error getting local components: ${X instanceof Error?X.message:String(X)}`}]}}}),$.tool("get_annotations","Get all annotations in the current document or specific node",{nodeId:J.string().optional().describe("Optional node ID to get annotations for specific node"),includeCategories:J.boolean().optional().default(!0).describe("Whether to include category information")},async({nodeId:X,includeCategories:Q})=>{try{let Y=await K("get_annotations",{nodeId:X,includeCategories:Q});return{content:[{type:"text",text:JSON.stringify(Y)}]}}catch(Y){return{content:[{type:"text",text:`Error getting annotations: ${Y instanceof Error?Y.message:String(Y)}`}]}}}),$.tool("set_multiple_annotations","Set multiple annotations parallelly in a node",{nodeId:J.string().describe("The ID of the node containing the elements to annotate"),annotations:J.array(J.object({nodeId:J.string().describe("The ID of the node to annotate"),labelMarkdown:J.string().describe("The annotation text in markdown format"),categoryId:J.string().optional().describe("The ID of the annotation category"),annotationId:J.string().optional().describe("The ID of the annotation to update (if updating existing annotation)"),properties:J.array(J.object({type:J.string()})).optional().describe("Additional properties for the annotation")})).describe("Array of annotations to apply")},async({nodeId:X,annotations:Q},Y)=>{try{if(!Q||Q.length===0)return{content:[{type:"text",text:"No annotations provided"}]};let G={type:"text",text:`Starting annotation process for ${Q.length} nodes. This will be processed in batches of 5...`},W=0,H=Q.length,D=await K("set_multiple_annotations",{nodeId:X,annotations:Q}),V=D.annotationsApplied&&D.annotationsApplied>0,j=`
|
|
49
7
|
Annotation process completed:
|
|
50
|
-
- ${
|
|
51
|
-
- ${
|
|
52
|
-
- Processed in ${
|
|
53
|
-
`,
|
|
8
|
+
- ${D.annotationsApplied||0} of ${H} successfully applied
|
|
9
|
+
- ${D.annotationsFailed||0} failed
|
|
10
|
+
- Processed in ${D.completedInChunks||1} batches
|
|
11
|
+
`,I=(D.results||[]).filter((R)=>!R.success),l="";if(I.length>0)l=`
|
|
54
12
|
|
|
55
13
|
Nodes that failed:
|
|
56
|
-
${
|
|
57
|
-
`)}`;return{content:[
|
|
58
|
-
Text replacement completed:
|
|
59
|
-
- ${B.replacementsApplied||0} of ${X} successfully updated
|
|
60
|
-
- ${B.replacementsFailed||0} failed
|
|
61
|
-
- Processed in ${B.completedInChunks||1} batches
|
|
62
|
-
`,L=(B.results||[]).filter((O)=>!O.success),G="";if(L.length>0)G=`
|
|
14
|
+
${I.map((R)=>`- ${R.nodeId}: ${R.error||"Unknown error"}`).join(`
|
|
15
|
+
`)}`;return{content:[G,{type:"text",text:j+l}]}}catch(G){return{content:[{type:"text",text:`Error setting multiple annotations: ${G instanceof Error?G.message:String(G)}`}]}}}),$.tool("create_component_instance","Create an instance of a component in Figma",{componentKey:J.string().describe("Key of the component to instantiate"),x:J.number().describe("X position"),y:J.number().describe("Y position")},async({componentKey:X,x:Q,y:Y})=>{try{let W=await K("create_component_instance",{componentKey:X,x:Q,y:Y});return{content:[{type:"text",text:JSON.stringify(W)}]}}catch(G){return{content:[{type:"text",text:`Error creating component instance: ${G instanceof Error?G.message:String(G)}`}]}}}),$.tool("get_instance_overrides","Get all override properties from a selected component instance. These overrides can be applied to other instances, which will swap them to match the source component.",{nodeId:J.string().optional().describe("Optional ID of the component instance to get overrides from. If not provided, currently selected instance will be used.")},async({nodeId:X})=>{try{let Y=await K("get_instance_overrides",{instanceNodeId:X||null});return{content:[{type:"text",text:Y.success?`Successfully got instance overrides: ${Y.message}`:`Failed to get instance overrides: ${Y.message}`}]}}catch(Q){return{content:[{type:"text",text:`Error copying instance overrides: ${Q instanceof Error?Q.message:String(Q)}`}]}}}),$.tool("set_instance_overrides","Apply previously copied overrides to selected component instances. Target instances will be swapped to the source component and all copied override properties will be applied.",{sourceInstanceId:J.string().describe("ID of the source component instance"),targetNodeIds:J.array(J.string()).describe("Array of target instance IDs. Currently selected instances will be used.")},async({sourceInstanceId:X,targetNodeIds:Q})=>{try{let G=await K("set_instance_overrides",{sourceInstanceId:X,targetNodeIds:Q||[]});if(G.success){let W=G.results?.filter((H)=>H.success).length||0;return{content:[{type:"text",text:`Successfully applied ${G.totalCount||0} overrides to ${W} instances.`}]}}else return{content:[{type:"text",text:`Failed to set instance overrides: ${G.message}`}]}}catch(Y){return{content:[{type:"text",text:`Error setting instance overrides: ${Y instanceof Error?Y.message:String(Y)}`}]}}}),$.tool("set_corner_radius","Set the corner radius of a node in Figma",{nodeId:J.string().describe("The ID of the node to modify"),radius:J.number().min(0).describe("Corner radius value"),corners:J.array(J.boolean()).length(4).optional().describe("Optional array of 4 booleans to specify which corners to round [topLeft, topRight, bottomRight, bottomLeft]")},async({nodeId:X,radius:Q,corners:Y})=>{try{return{content:[{type:"text",text:`Set corner radius of node "${(await K("set_corner_radius",{nodeId:X,radius:Q,corners:Y||[!0,!0,!0,!0]})).name}" to ${Q}px`}]}}catch(G){return{content:[{type:"text",text:`Error setting corner radius: ${G instanceof Error?G.message:String(G)}`}]}}}),$.prompt("design_strategy","Best practices for working with Figma designs",(X)=>{return{messages:[{role:"assistant",content:{type:"text",text:`When working with Figma designs, follow these best practices:
|
|
63
16
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
17
|
+
1. Start with Document Structure:
|
|
18
|
+
- First use get_document_info() to understand the current document
|
|
19
|
+
- Plan your layout hierarchy before creating elements
|
|
20
|
+
- Create a main container frame for each screen/section
|
|
21
|
+
- If a component library has already been provided, please prioritize creating elements using component instances
|
|
22
|
+
2. Naming Conventions:
|
|
23
|
+
- Use descriptive, semantic names for all elements
|
|
24
|
+
- Follow a consistent naming pattern (e.g., "Login Screen", "Logo Container", "Email Input")
|
|
25
|
+
- Group related elements with meaningful names
|
|
67
26
|
|
|
68
|
-
|
|
69
|
-
|
|
27
|
+
3. Layout Hierarchy:
|
|
28
|
+
- Create parent frames first, then add child elements
|
|
29
|
+
- For forms/login screens:
|
|
30
|
+
* Start with the main screen container frame
|
|
31
|
+
* Create a logo container at the top
|
|
32
|
+
* Group input fields in their own containers
|
|
33
|
+
* Place action buttons (login, submit) after inputs
|
|
34
|
+
* Add secondary elements (forgot password, signup links) last
|
|
70
35
|
|
|
71
|
-
|
|
36
|
+
4. Input Fields Structure:
|
|
37
|
+
- Create a container frame for each input field
|
|
38
|
+
- Include a label text above or inside the input
|
|
39
|
+
- Group related inputs (e.g., username/password) together
|
|
72
40
|
|
|
73
|
-
|
|
74
|
-
- Use
|
|
75
|
-
-
|
|
76
|
-
-
|
|
77
|
-
|
|
41
|
+
5. Element Creation:
|
|
42
|
+
- Use create_frame() for containers and input fields
|
|
43
|
+
- Use create_text() for labels, buttons text, and links
|
|
44
|
+
- Set appropriate colors and styles:
|
|
45
|
+
* Use fillColor for backgrounds
|
|
46
|
+
* Use strokeColor for borders
|
|
47
|
+
* Set proper fontWeight for different text elements
|
|
78
48
|
|
|
79
|
-
|
|
80
|
-
-
|
|
81
|
-
- This captures text content, property values, and style overrides
|
|
82
|
-
- Command syntax: \`get_instance_overrides({ nodeId: "source-instance-id" })\`
|
|
83
|
-
- Look for successful response like "Got component information from [instance name]"
|
|
49
|
+
6. Mofifying existing elements:
|
|
50
|
+
- use set_text_content() to modify text content.
|
|
84
51
|
|
|
85
|
-
|
|
86
|
-
-
|
|
87
|
-
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
\`\`\`
|
|
52
|
+
7. Visual Hierarchy:
|
|
53
|
+
- Position elements in logical reading order (top to bottom)
|
|
54
|
+
- Maintain consistent spacing between elements
|
|
55
|
+
- Use appropriate font sizes for different text types:
|
|
56
|
+
* Larger for headings/welcome text
|
|
57
|
+
* Medium for input labels
|
|
58
|
+
* Standard for button text
|
|
59
|
+
* Smaller for helper text/links
|
|
94
60
|
|
|
95
|
-
|
|
96
|
-
- Verify
|
|
97
|
-
-
|
|
61
|
+
8. Best Practices:
|
|
62
|
+
- Verify each creation with get_node_info()
|
|
63
|
+
- Use parentId to maintain proper hierarchy
|
|
64
|
+
- Group related elements together in frames
|
|
65
|
+
- Keep consistent spacing and alignment
|
|
98
66
|
|
|
99
|
-
|
|
100
|
-
-
|
|
101
|
-
-
|
|
102
|
-
-
|
|
67
|
+
Example Login Screen Structure:
|
|
68
|
+
- Login Screen (main frame)
|
|
69
|
+
- Logo Container (frame)
|
|
70
|
+
- Logo (image/text)
|
|
71
|
+
- Welcome Text (text)
|
|
72
|
+
- Input Container (frame)
|
|
73
|
+
- Email Input (frame)
|
|
74
|
+
- Email Label (text)
|
|
75
|
+
- Email Field (frame)
|
|
76
|
+
- Password Input (frame)
|
|
77
|
+
- Password Label (text)
|
|
78
|
+
- Password Field (frame)
|
|
79
|
+
- Login Button (frame)
|
|
80
|
+
- Button Text (text)
|
|
81
|
+
- Helper Links (frame)
|
|
82
|
+
- Forgot Password (text)
|
|
83
|
+
- Don't have account (text)`}}],description:"Best practices for working with Figma designs"}}),$.prompt("read_design_strategy","Best practices for reading Figma designs",(X)=>{return{messages:[{role:"assistant",content:{type:"text",text:`When reading Figma designs, follow these best practices:
|
|
84
|
+
|
|
85
|
+
1. Start with selection:
|
|
86
|
+
- First use read_my_design() to understand the current selection
|
|
87
|
+
- If no selection ask user to select single or multiple nodes
|
|
88
|
+
`}}],description:"Best practices for reading Figma designs"}}),$.tool("scan_text_nodes","Scan all text nodes in the selected Figma node",{nodeId:J.string().describe("ID of the node to scan")},async({nodeId:X})=>{try{let Q={type:"text",text:"Starting text node scanning. This may take a moment for large designs..."},Y=await K("scan_text_nodes",{nodeId:X,useChunking:!0,chunkSize:10});if(Y&&typeof Y==="object"&&"chunks"in Y){let G=Y,W=`
|
|
89
|
+
Scan completed:
|
|
90
|
+
- Found ${G.totalNodes} text nodes
|
|
91
|
+
- Processed in ${G.chunks} chunks
|
|
92
|
+
`;return{content:[Q,{type:"text",text:W},{type:"text",text:JSON.stringify(G.textNodes,null,2)}]}}return{content:[Q,{type:"text",text:JSON.stringify(Y,null,2)}]}}catch(Q){return{content:[{type:"text",text:`Error scanning text nodes: ${Q instanceof Error?Q.message:String(Q)}`}]}}}),$.tool("scan_nodes_by_types","Scan for child nodes with specific types in the selected Figma node",{nodeId:J.string().describe("ID of the node to scan"),types:J.array(J.string()).describe("Array of node types to find in the child nodes (e.g. ['COMPONENT', 'FRAME'])")},async({nodeId:X,types:Q})=>{try{let Y={type:"text",text:`Starting node type scanning for types: ${Q.join(", ")}...`},G=await K("scan_nodes_by_types",{nodeId:X,types:Q});if(G&&typeof G==="object"&&"matchingNodes"in G){let W=G,H=`Scan completed: Found ${W.count} nodes matching types: ${W.searchedTypes.join(", ")}`;return{content:[Y,{type:"text",text:H},{type:"text",text:JSON.stringify(W.matchingNodes,null,2)}]}}return{content:[Y,{type:"text",text:JSON.stringify(G,null,2)}]}}catch(Y){return{content:[{type:"text",text:`Error scanning nodes by types: ${Y instanceof Error?Y.message:String(Y)}`}]}}}),$.prompt("text_replacement_strategy","Systematic approach for replacing text in Figma designs",(X)=>{return{messages:[{role:"assistant",content:{type:"text",text:`# Intelligent Text Replacement Strategy
|
|
103
93
|
|
|
104
94
|
## 1. Analyze Design & Identify Structure
|
|
105
95
|
- Scan text nodes to understand the overall structure of the design
|
|
@@ -213,7 +203,16 @@ export_node_as_image(nodeId: "chunk-node-id", format: "PNG", scale: 0.5)
|
|
|
213
203
|
- **Balance Automation & Control**: Let AI handle repetitive replacements but maintain oversight
|
|
214
204
|
- **Respect Content Relationships**: Keep related content consistent across chunks
|
|
215
205
|
|
|
216
|
-
Remember that text is never just text—it's a core design element that must work harmoniously with the overall composition. This chunk-based strategy allows you to methodically transform text while maintaining design integrity.`}}],description:"Systematic approach for replacing text in Figma designs"}}),
|
|
206
|
+
Remember that text is never just text—it's a core design element that must work harmoniously with the overall composition. This chunk-based strategy allows you to methodically transform text while maintaining design integrity.`}}],description:"Systematic approach for replacing text in Figma designs"}}),$.tool("set_multiple_text_contents","Set multiple text contents parallelly in a node",{nodeId:J.string().describe("The ID of the node containing the text nodes to replace"),text:J.array(J.object({nodeId:J.string().describe("The ID of the text node"),text:J.string().describe("The replacement text")})).describe("Array of text node IDs and their replacement texts")},async({nodeId:X,text:Q},Y)=>{try{if(!Q||Q.length===0)return{content:[{type:"text",text:"No text provided"}]};let G={type:"text",text:`Starting text replacement for ${Q.length} nodes. This will be processed in batches of 5...`},W=0,H=Q.length,D=await K("set_multiple_text_contents",{nodeId:X,text:Q}),V=D.replacementsApplied&&D.replacementsApplied>0,j=`
|
|
207
|
+
Text replacement completed:
|
|
208
|
+
- ${D.replacementsApplied||0} of ${H} successfully updated
|
|
209
|
+
- ${D.replacementsFailed||0} failed
|
|
210
|
+
- Processed in ${D.completedInChunks||1} batches
|
|
211
|
+
`,I=(D.results||[]).filter((R)=>!R.success),l="";if(I.length>0)l=`
|
|
212
|
+
|
|
213
|
+
Nodes that failed:
|
|
214
|
+
${I.map((R)=>`- ${R.nodeId}: ${R.error||"Unknown error"}`).join(`
|
|
215
|
+
`)}`;return{content:[G,{type:"text",text:j+l}]}}catch(G){return{content:[{type:"text",text:`Error setting multiple text contents: ${G instanceof Error?G.message:String(G)}`}]}}}),$.tool("read_my_design","Get detailed information about the current selection in Figma, including all node details",{},async()=>{try{let X=await K("read_my_design",{});return{content:[{type:"text",text:JSON.stringify(X)}]}}catch(X){return{content:[{type:"text",text:`Error getting node info: ${X instanceof Error?X.message:String(X)}`}]}}}),$.prompt("annotation_conversion_strategy","Strategy for converting manual annotations to Figma's native annotations",(X)=>{return{messages:[{role:"assistant",content:{type:"text",text:`# Automatic Annotation Conversion
|
|
217
216
|
|
|
218
217
|
## Process Overview
|
|
219
218
|
|
|
@@ -350,166 +349,109 @@ if (annotationsToApply.length > 0) {
|
|
|
350
349
|
\`\`\`
|
|
351
350
|
|
|
352
351
|
|
|
353
|
-
This strategy focuses on practical implementation based on real-world usage patterns, emphasizing the importance of handling various UI elements as annotation targets, not just text nodes.`}}],description:"Strategy for converting manual annotations to Figma's native annotations"}})
|
|
354
|
-
|
|
355
|
-
1. Start with Document Structure:
|
|
356
|
-
- First use get_document_info() to understand the current document
|
|
357
|
-
- Plan your layout hierarchy before creating elements
|
|
358
|
-
- Create a main container frame for each screen/section
|
|
359
|
-
- If a component library has already been provided, please prioritize creating elements using component instances
|
|
360
|
-
2. Naming Conventions:
|
|
361
|
-
- Use descriptive, semantic names for all elements
|
|
362
|
-
- Follow a consistent naming pattern (e.g., "Login Screen", "Logo Container", "Email Input")
|
|
363
|
-
- Group related elements with meaningful names
|
|
352
|
+
This strategy focuses on practical implementation based on real-world usage patterns, emphasizing the importance of handling various UI elements as annotation targets, not just text nodes.`}}],description:"Strategy for converting manual annotations to Figma's native annotations"}}),$.prompt("swap_overrides_instances","Guide to swap instance overrides between instances",(X)=>{return{messages:[{role:"assistant",content:{type:"text",text:`# Swap Component Instance and Override Strategy
|
|
364
353
|
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
- For forms/login screens:
|
|
368
|
-
* Start with the main screen container frame
|
|
369
|
-
* Create a logo container at the top
|
|
370
|
-
* Group input fields in their own containers
|
|
371
|
-
* Place action buttons (login, submit) after inputs
|
|
372
|
-
* Add secondary elements (forgot password, signup links) last
|
|
354
|
+
## Overview
|
|
355
|
+
This strategy enables transferring content and property overrides from a source instance to one or more target instances in Figma, maintaining design consistency while reducing manual work.
|
|
373
356
|
|
|
374
|
-
|
|
375
|
-
- Create a container frame for each input field
|
|
376
|
-
- Include a label text above or inside the input
|
|
377
|
-
- Group related inputs (e.g., username/password) together
|
|
357
|
+
## Step-by-Step Process
|
|
378
358
|
|
|
379
|
-
|
|
380
|
-
- Use
|
|
381
|
-
-
|
|
382
|
-
-
|
|
383
|
-
|
|
384
|
-
* Use strokeColor for borders
|
|
385
|
-
* Set proper fontWeight for different text elements
|
|
359
|
+
### 1. Selection Analysis
|
|
360
|
+
- Use \`get_selection()\` to identify the parent component or selected instances
|
|
361
|
+
- For parent components, scan for instances with \`scan_nodes_by_types({ nodeId: "parent-id", types: ["INSTANCE"] })\`
|
|
362
|
+
- Identify custom slots by name patterns (e.g. "Custom Slot*" or "Instance Slot") or by examining text content
|
|
363
|
+
- Determine which is the source instance (with content to copy) and which are targets (where to apply content)
|
|
386
364
|
|
|
387
|
-
|
|
388
|
-
-
|
|
365
|
+
### 2. Extract Source Overrides
|
|
366
|
+
- Use \`get_instance_overrides()\` to extract customizations from the source instance
|
|
367
|
+
- This captures text content, property values, and style overrides
|
|
368
|
+
- Command syntax: \`get_instance_overrides({ nodeId: "source-instance-id" })\`
|
|
369
|
+
- Look for successful response like "Got component information from [instance name]"
|
|
389
370
|
|
|
390
|
-
|
|
391
|
-
-
|
|
392
|
-
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
371
|
+
### 3. Apply Overrides to Targets
|
|
372
|
+
- Apply captured overrides using \`set_instance_overrides()\`
|
|
373
|
+
- Command syntax:
|
|
374
|
+
\`\`\`
|
|
375
|
+
set_instance_overrides({
|
|
376
|
+
sourceInstanceId: "source-instance-id",
|
|
377
|
+
targetNodeIds: ["target-id-1", "target-id-2", ...]
|
|
378
|
+
})
|
|
379
|
+
\`\`\`
|
|
398
380
|
|
|
399
|
-
|
|
400
|
-
- Verify
|
|
401
|
-
-
|
|
402
|
-
- Group related elements together in frames
|
|
403
|
-
- Keep consistent spacing and alignment
|
|
381
|
+
### 4. Verification
|
|
382
|
+
- Verify results with \`get_node_info()\` or \`read_my_design()\`
|
|
383
|
+
- Confirm text content and style overrides have transferred successfully
|
|
404
384
|
|
|
405
|
-
|
|
406
|
-
-
|
|
407
|
-
-
|
|
408
|
-
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
-
|
|
421
|
-
|
|
385
|
+
## Key Tips
|
|
386
|
+
- Always join the appropriate channel first with \`join_channel()\`
|
|
387
|
+
- When working with multiple targets, check the full selection with \`get_selection()\`
|
|
388
|
+
- Preserve component relationships by using instance overrides rather than direct text manipulation`}}],description:"Strategy for transferring overrides between component instances in Figma"}}),$.tool("set_layout_mode","Set the layout mode and wrap behavior of a frame in Figma",{nodeId:J.string().describe("The ID of the frame to modify"),layoutMode:J.enum(["NONE","HORIZONTAL","VERTICAL"]).describe("Layout mode for the frame"),layoutWrap:J.enum(["NO_WRAP","WRAP"]).optional().describe("Whether the auto-layout frame wraps its children")},async({nodeId:X,layoutMode:Q,layoutWrap:Y})=>{try{return{content:[{type:"text",text:`Set layout mode of frame "${(await K("set_layout_mode",{nodeId:X,layoutMode:Q,layoutWrap:Y||"NO_WRAP"})).name}" to ${Q}${Y?` with ${Y}`:""}`}]}}catch(G){return{content:[{type:"text",text:`Error setting layout mode: ${G instanceof Error?G.message:String(G)}`}]}}}),$.tool("set_annotation","Create or update an annotation",{nodeId:J.string().describe("The ID of the node to annotate"),annotationId:J.string().optional().describe("The ID of the annotation to update (if updating existing annotation)"),labelMarkdown:J.string().describe("The annotation text in markdown format"),categoryId:J.string().optional().describe("The ID of the annotation category"),properties:J.array(J.object({type:J.string()})).optional().describe("Additional properties for the annotation")},async({nodeId:X,annotationId:Q,labelMarkdown:Y,categoryId:G,properties:W})=>{try{let H=await K("set_annotation",{nodeId:X,annotationId:Q,labelMarkdown:Y,categoryId:G,properties:W});return{content:[{type:"text",text:JSON.stringify(H)}]}}catch(H){return{content:[{type:"text",text:`Error setting annotation: ${H instanceof Error?H.message:String(H)}`}]}}}),$.tool("set_padding","Set padding values for an auto-layout frame in Figma",{nodeId:J.string().describe("The ID of the frame to modify"),paddingTop:J.number().optional().describe("Top padding value"),paddingRight:J.number().optional().describe("Right padding value"),paddingBottom:J.number().optional().describe("Bottom padding value"),paddingLeft:J.number().optional().describe("Left padding value")},async({nodeId:X,paddingTop:Q,paddingRight:Y,paddingBottom:G,paddingLeft:W})=>{try{let B=await K("set_padding",{nodeId:X,paddingTop:Q,paddingRight:Y,paddingBottom:G,paddingLeft:W}),D=[];if(Q!==void 0)D.push(`top: ${Q}`);if(Y!==void 0)D.push(`right: ${Y}`);if(G!==void 0)D.push(`bottom: ${G}`);if(W!==void 0)D.push(`left: ${W}`);return{content:[{type:"text",text:`Set ${D.length>0?`padding (${D.join(", ")})`:"padding"} for frame "${B.name}"`}]}}catch(H){return{content:[{type:"text",text:`Error setting padding: ${H instanceof Error?H.message:String(H)}`}]}}}),$.tool("set_axis_align","Set primary and counter axis alignment for an auto-layout frame in Figma",{nodeId:J.string().describe("The ID of the frame to modify"),primaryAxisAlignItems:J.enum(["MIN","MAX","CENTER","SPACE_BETWEEN"]).optional().describe("Primary axis alignment (MIN/MAX = left/right in horizontal, top/bottom in vertical). Note: When set to SPACE_BETWEEN, itemSpacing will be ignored as children will be evenly spaced."),counterAxisAlignItems:J.enum(["MIN","MAX","CENTER","BASELINE"]).optional().describe("Counter axis alignment (MIN/MAX = top/bottom in horizontal, left/right in vertical)")},async({nodeId:X,primaryAxisAlignItems:Q,counterAxisAlignItems:Y})=>{try{let W=await K("set_axis_align",{nodeId:X,primaryAxisAlignItems:Q,counterAxisAlignItems:Y}),H=[];if(Q!==void 0)H.push(`primary: ${Q}`);if(Y!==void 0)H.push(`counter: ${Y}`);return{content:[{type:"text",text:`Set ${H.length>0?`axis alignment (${H.join(", ")})`:"axis alignment"} for frame "${W.name}"`}]}}catch(G){return{content:[{type:"text",text:`Error setting axis alignment: ${G instanceof Error?G.message:String(G)}`}]}}}),$.tool("set_layout_sizing","Set horizontal and vertical sizing modes for an auto-layout frame in Figma",{nodeId:J.string().describe("The ID of the frame to modify"),layoutSizingHorizontal:J.enum(["FIXED","HUG","FILL"]).optional().describe("Horizontal sizing mode (HUG for frames/text only, FILL for auto-layout children only)"),layoutSizingVertical:J.enum(["FIXED","HUG","FILL"]).optional().describe("Vertical sizing mode (HUG for frames/text only, FILL for auto-layout children only)")},async({nodeId:X,layoutSizingHorizontal:Q,layoutSizingVertical:Y})=>{try{let W=await K("set_layout_sizing",{nodeId:X,layoutSizingHorizontal:Q,layoutSizingVertical:Y}),H=[];if(Q!==void 0)H.push(`horizontal: ${Q}`);if(Y!==void 0)H.push(`vertical: ${Y}`);return{content:[{type:"text",text:`Set ${H.length>0?`layout sizing (${H.join(", ")})`:"layout sizing"} for frame "${W.name}"`}]}}catch(G){return{content:[{type:"text",text:`Error setting layout sizing: ${G instanceof Error?G.message:String(G)}`}]}}}),$.tool("set_item_spacing","Set distance between children in an auto-layout frame",{nodeId:J.string().describe("The ID of the frame to modify"),itemSpacing:J.number().describe("Distance between children. Note: This value will be ignored if primaryAxisAlignItems is set to SPACE_BETWEEN.")},async({nodeId:X,itemSpacing:Q})=>{try{let G=await K("set_item_spacing",{nodeId:X,itemSpacing:Q});return{content:[{type:"text",text:`Set item spacing to ${Q} for frame "${G.name}"`}]}}catch(Y){return{content:[{type:"text",text:`Error setting item spacing: ${Y instanceof Error?Y.message:String(Y)}`}]}}}),$.tool("get_reactions","Get Figma Prototyping Reactions from multiple nodes. CRITICAL: The output MUST be processed using the 'reaction_to_connector_strategy' prompt IMMEDIATELY to generate parameters for connector lines via the 'create_connections' tool.",{nodeIds:J.array(J.string()).describe("Array of node IDs to get reactions from")},async({nodeIds:X})=>{try{let Q=await K("get_reactions",{nodeIds:X});return{content:[{type:"text",text:JSON.stringify(Q)},{type:"text",text:"IMPORTANT: You MUST now use the reaction data above and follow the `reaction_to_connector_strategy` prompt to prepare the parameters for the `create_connections` tool call. This is a required next step."}],followUp:{type:"prompt",prompt:"reaction_to_connector_strategy"}}}catch(Q){return{content:[{type:"text",text:`Error getting reactions: ${Q instanceof Error?Q.message:String(Q)}`}]}}}),$.tool("set_default_connector","Set a copied connector node as the default connector",{connectorId:J.string().optional().describe("The ID of the connector node to set as default")},async({connectorId:X})=>{try{let Q=await K("set_default_connector",{connectorId:X});return{content:[{type:"text",text:`Default connector set: ${JSON.stringify(Q)}`}]}}catch(Q){return{content:[{type:"text",text:`Error setting default connector: ${Q instanceof Error?Q.message:String(Q)}`}]}}}),$.tool("delete_node","Delete a node from Figma",{nodeId:J.string().describe("The ID of the node to delete")},async({nodeId:X})=>{try{return await K("delete_node",{nodeId:X}),{content:[{type:"text",text:`Deleted node with ID: ${X}`}]}}catch(Q){return{content:[{type:"text",text:`Error deleting node: ${Q instanceof Error?Q.message:String(Q)}`}]}}}),$.tool("create_connections","Create connections between nodes using the default connector style",{connections:J.array(J.object({startNodeId:J.string().describe("ID of the starting node"),endNodeId:J.string().describe("ID of the ending node"),text:J.string().optional().describe("Optional text to display on the connector")})).describe("Array of node connections to create")},async({connections:X})=>{try{if(!X||X.length===0)return{content:[{type:"text",text:"No connections provided"}]};let Q=await K("create_connections",{connections:X});return{content:[{type:"text",text:`Created ${X.length} connections: ${JSON.stringify(Q)}`}]}}catch(Q){return{content:[{type:"text",text:`Error creating connections: ${Q instanceof Error?Q.message:String(Q)}`}]}}}),$.prompt("reaction_to_connector_strategy","Strategy for converting Figma prototype reactions to connector lines using the output of 'get_reactions'",(X)=>{return{messages:[{role:"assistant",content:{type:"text",text:`# Strategy: Convert Figma Prototype Reactions to Connector Lines
|
|
389
|
+
|
|
390
|
+
## Goal
|
|
391
|
+
Process the JSON output from the \`get_reactions\` tool to generate an array of connection objects suitable for the \`create_connections\` tool. This visually represents prototype flows as connector lines on the Figma canvas.
|
|
392
|
+
|
|
393
|
+
## Input Data
|
|
394
|
+
You will receive JSON data from the \`get_reactions\` tool. This data contains an array of nodes, each with potential reactions. A typical reaction object looks like this:
|
|
395
|
+
\`\`\`json
|
|
396
|
+
{
|
|
397
|
+
"trigger": { "type": "ON_CLICK" },
|
|
398
|
+
"action": {
|
|
399
|
+
"type": "NAVIGATE",
|
|
400
|
+
"destinationId": "destination-node-id",
|
|
401
|
+
"navigationTransition": { ... },
|
|
402
|
+
"preserveScrollPosition": false
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
\`\`\`
|
|
422
406
|
|
|
423
|
-
|
|
424
|
-
- First use read_my_design() to understand the current selection
|
|
425
|
-
- If no selection ask user to select single or multiple nodes
|
|
426
|
-
`}}],description:"Best practices for reading Figma designs"}}),f.prompt("best_design_principle","Figma Design Best Practices",()=>{return{messages:[{role:"assistant",content:{type:"text",text:`
|
|
427
|
-
# 资深 Figma UX/UI 设计专家
|
|
428
|
-
|
|
429
|
-
你将担任资深UX/UI设计专家,在以用户为中心的设计、交互原型和设计系统方面拥有10+年经验,尤其精通Figma。你擅长运用最新方法创建直观、可访问、高转化率的数字界面。
|
|
430
|
-
|
|
431
|
-
核心任务:针对我的设计需求,提供专业、可落地的解决方案,始终优先考虑用户价值、业务目标、可访问性(WCAG 2.1+)和 Figma 高效实现。
|
|
432
|
-
|
|
433
|
-
响应流程 (请严格遵循):
|
|
434
|
-
|
|
435
|
-
1. \uD83D\uDD0D 需求解析与组件扫描
|
|
436
|
-
* 拆解需求:清晰阐述核心设计目标、用户场景和关键任务
|
|
437
|
-
* 组件库分析(当提供时):
|
|
438
|
-
- 扫描组件库文档,识别所有潜在适用组件
|
|
439
|
-
- 提取最匹配组件的key列表
|
|
440
|
-
- 标注组件匹配度(完全匹配/需修改/部分适用)
|
|
441
|
-
* 约束识别:明确技术限制和可访问性要求
|
|
442
|
-
|
|
443
|
-
2. \uD83E\uDDE9 设计策略与组件匹配
|
|
444
|
-
* 原则映射:列出3-5个核心UX/UI设计原则
|
|
445
|
-
* 组件化策略(当提供组件库时):
|
|
446
|
-
- 基于提取的key列表,详细说明每个组件的应用场景
|
|
447
|
-
- 说明组件选择理由及适配方案
|
|
448
|
-
- 当无完全匹配组件时,建议最小修改方案
|
|
449
|
-
* 独立设计策略(无组件库时):
|
|
450
|
-
- 推荐最佳交互模式
|
|
451
|
-
- 创建新组件的合理性和方案
|
|
452
|
-
|
|
453
|
-
3. ⚙️ 解决方案设计
|
|
454
|
-
* 核心方案描述:
|
|
455
|
-
- 当有组件库:基于选定组件的整体架构
|
|
456
|
-
- 当无组件库:完整设计方案描述
|
|
457
|
-
* Figma 实现要点:
|
|
458
|
-
* 组件应用(当有组件库):
|
|
459
|
-
- 指定使用的组件key及变体配置
|
|
460
|
-
- 组件组合的布局逻辑
|
|
461
|
-
* 原型交互:关键交互流程说明
|
|
462
|
-
* 设计系统集成:组件修改/扩展方案
|
|
463
|
-
|
|
464
|
-
4. \uD83D\uDE80 结论与优化
|
|
465
|
-
* 方案精要:总结核心优势
|
|
466
|
-
* 组件应用清单(当有组件库):表格形式列出所有使用组件的key
|
|
467
|
-
* 测试建议:组件级或整体可用性测试方案
|
|
468
|
-
* 迭代方向:现有组件优化或新组件创建建议
|
|
469
|
-
|
|
470
|
-
响应格式 (必须严格遵守):
|
|
471
|
-
\uD83D\uDCCB 需求摘要
|
|
472
|
-
* [1-2句话概括核心需求]
|
|
473
|
-
|
|
474
|
-
\uD83D\uDD0D 需求解析与组件扫描
|
|
475
|
-
* [需求拆解 + 组件扫描结果(含key列表)]
|
|
476
|
-
|
|
477
|
-
\uD83E\uDDE9 设计策略与组件匹配
|
|
478
|
-
* [设计原则 + 详细组件匹配方案]
|
|
479
|
-
|
|
480
|
-
⚙️ 解决方案设计
|
|
481
|
-
* [基于组件/独立的设计方案描述]
|
|
482
|
-
* [关键实现要点]
|
|
483
|
-
|
|
484
|
-
\uD83D\uDE80 结论与优化
|
|
485
|
-
* [总结 + 组件清单表格(如适用)]
|
|
486
|
-
|
|
487
|
-
❓ 澄清问题 (可选)
|
|
488
|
-
* [仅当组件信息不足时提问]
|
|
489
|
-
|
|
490
|
-
专业知识深度要求 (必须精通):
|
|
491
|
-
- 设计系统组件库分析与应用
|
|
492
|
-
- 组件复用策略与变体配置
|
|
493
|
-
- Figma组件开发与维护
|
|
494
|
-
- 设计思维与UCD方法论
|
|
495
|
-
- 响应式/移动优先设计
|
|
496
|
-
- WCAG 2.1/2.2可访问性标准
|
|
497
|
-
|
|
498
|
-
行为准则:
|
|
499
|
-
1. 组件优先原则:当提供组件库时,必须优先使用现有组件
|
|
500
|
-
2. 精确引用:通过key标识明确指定组件
|
|
501
|
-
3. 最小修改:无匹配组件时才建议创建新组件
|
|
502
|
-
4. 组件清单:在结论部分表格化列出所有使用组件的key
|
|
503
|
-
5. 双模式设计:明确区分组件库/独立设计流程
|
|
504
|
-
6. 用户价值优先
|
|
505
|
-
7. 强制可访问性整合
|
|
506
|
-
`}}],description:"Best practices for reading Figma designs"}})},RJ=WX;var PX=sv("ptdTool");function _J(f){AJ(f),SJ(f),bJ(f),zJ(f),RJ(f),f.tool("move_node","Move a node to a new position in Figma",{nodeId:P.string().describe("The ID of the node to move"),x:P.number().describe("New X position"),y:P.number().describe("New Y position")},async({nodeId:v,x:h,y:J})=>{try{return{content:[{type:"text",text:`Moved node "${(await s("move_node",{nodeId:v,x:h,y:J})).name}" to position (${h}, ${J})`}]}}catch(Q){return{content:[{type:"text",text:`Error moving node: ${Q instanceof Error?Q.message:String(Q)}`}]}}}),f.tool("clone_node","Clone an existing node in Figma",{nodeId:P.string().describe("The ID of the node to clone"),x:P.number().optional().describe("New X position for the clone"),y:P.number().optional().describe("New Y position for the clone")},async({nodeId:v,x:h,y:J})=>{try{let W=await s("clone_node",{nodeId:v,x:h,y:J});return{content:[{type:"text",text:`Cloned node "${W.name}" with new ID: ${W.id}${h!==void 0&&J!==void 0?` at position (${h}, ${J})`:""}`}]}}catch(Q){return{content:[{type:"text",text:`Error cloning node: ${Q instanceof Error?Q.message:String(Q)}`}]}}}),f.tool("resize_node","Resize a node in Figma",{nodeId:P.string().describe("The ID of the node to resize"),width:P.number().positive().describe("New width"),height:P.number().positive().describe("New height")},async({nodeId:v,width:h,height:J})=>{try{return{content:[{type:"text",text:`Resized node "${(await s("resize_node",{nodeId:v,width:h,height:J})).name}" to width ${h} and height ${J}`}]}}catch(Q){return{content:[{type:"text",text:`Error resizing node: ${Q instanceof Error?Q.message:String(Q)}`}]}}}),f.tool("delete_multiple_nodes","Delete multiple nodes from Figma at once",{nodeIds:P.array(P.string()).describe("Array of node IDs to delete")},async({nodeIds:v})=>{try{let h=await s("delete_multiple_nodes",{nodeIds:v});return{content:[{type:"text",text:JSON.stringify(h)}]}}catch(h){return{content:[{type:"text",text:`Error deleting multiple nodes: ${h instanceof Error?h.message:String(h)}`}]}}}),f.tool("export_node_as_image","Export a node as an image from Figma",{nodeId:P.string().describe("The ID of the node to export"),format:P.enum(["PNG","JPG","SVG","PDF"]).optional().describe("Export format"),scale:P.number().positive().optional().describe("Export scale")},async({nodeId:v,format:h,scale:J})=>{try{let W=await s("export_node_as_image",{nodeId:v,format:h||"PNG",scale:J||1});return{content:[{type:"image",data:W.imageData,mimeType:W.mimeType||"image/png"}]}}catch(Q){return{content:[{type:"text",text:`Error exporting node as image: ${Q instanceof Error?Q.message:String(Q)}`}]}}}),f.tool("get_annotations","Get all annotations in the current document or specific node",{nodeId:P.string().optional().describe("Optional node ID to get annotations for specific node"),includeCategories:P.boolean().optional().default(!0).describe("Whether to include category information")},async({nodeId:v,includeCategories:h})=>{try{let J=await s("get_annotations",{nodeId:v,includeCategories:h});return{content:[{type:"text",text:JSON.stringify(J)}]}}catch(J){return{content:[{type:"text",text:`Error getting annotations: ${J instanceof Error?J.message:String(J)}`}]}}}),f.tool("scan_text_nodes","Scan all text nodes in the selected Figma node",{nodeId:P.string().describe("ID of the node to scan")},async({nodeId:v})=>{try{let h={type:"text",text:"Starting text node scanning. This may take a moment for large designs..."},J=await s("scan_text_nodes",{nodeId:v,useChunking:!0,chunkSize:10});if(J&&typeof J==="object"&&"chunks"in J){let Q=J,W=`
|
|
507
|
-
Scan completed:
|
|
508
|
-
- Found ${Q.totalNodes} text nodes
|
|
509
|
-
- Processed in ${Q.chunks} chunks
|
|
510
|
-
`;return{content:[h,{type:"text",text:W},{type:"text",text:JSON.stringify(Q.textNodes,null,2)}]}}return{content:[h,{type:"text",text:JSON.stringify(J,null,2)}]}}catch(h){return{content:[{type:"text",text:`Error scanning text nodes: ${h instanceof Error?h.message:String(h)}`}]}}}),f.tool("scan_nodes_by_types","Scan for child nodes with specific types in the selected Figma node",{nodeId:P.string().describe("ID of the node to scan"),types:P.array(P.string()).describe("Array of node types to find in the child nodes (e.g. ['COMPONENT', 'FRAME'])")},async({nodeId:v,types:h})=>{try{let J={type:"text",text:`Starting node type scanning for types: ${h.join(", ")}...`},Q=await s("scan_nodes_by_types",{nodeId:v,types:h});if(Q&&typeof Q==="object"&&"matchingNodes"in Q){let W=Q,X=`Scan completed: Found ${W.count} nodes matching types: ${W.searchedTypes.join(", ")}`;return{content:[J,{type:"text",text:X},{type:"text",text:JSON.stringify(W.matchingNodes,null,2)}]}}return{content:[J,{type:"text",text:JSON.stringify(Q,null,2)}]}}catch(J){return{content:[{type:"text",text:`Error scanning nodes by types: ${J instanceof Error?J.message:String(J)}`}]}}}),f.tool("read_my_design","Get detailed information about the current selection in Figma, including all node details",{},async()=>{try{let v=await s("read_my_design",{});return{content:[{type:"text",text:JSON.stringify(v)}]}}catch(v){return{content:[{type:"text",text:`Error getting node info: ${v instanceof Error?v.message:String(v)}`}]}}}),f.tool("get_reactions","Get Figma Prototyping Reactions from multiple nodes. CRITICAL: The output MUST be processed using the 'reaction_to_connector_strategy' prompt IMMEDIATELY to generate parameters for connector lines via the 'create_connections' tool.",{nodeIds:P.array(P.string()).describe("Array of node IDs to get reactions from")},async({nodeIds:v})=>{try{let h=await s("get_reactions",{nodeIds:v});return{content:[{type:"text",text:JSON.stringify(h)},{type:"text",text:"IMPORTANT: You MUST now use the reaction data above and follow the `reaction_to_connector_strategy` prompt to prepare the parameters for the `create_connections` tool call. This is a required next step."}],followUp:{type:"prompt",prompt:"reaction_to_connector_strategy"}}}catch(h){return{content:[{type:"text",text:`Error getting reactions: ${h instanceof Error?h.message:String(h)}`}]}}}),f.tool("set_default_connector","Set a copied connector node as the default connector",{connectorId:P.string().optional().describe("The ID of the connector node to set as default")},async({connectorId:v})=>{try{let h=await s("set_default_connector",{connectorId:v});return{content:[{type:"text",text:`Default connector set: ${JSON.stringify(h)}`}]}}catch(h){return{content:[{type:"text",text:`Error setting default connector: ${h instanceof Error?h.message:String(h)}`}]}}}),f.tool("delete_node","Delete a node from Figma",{nodeId:P.string().describe("The ID of the node to delete")},async({nodeId:v})=>{try{return await s("delete_node",{nodeId:v}),{content:[{type:"text",text:`Deleted node with ID: ${v}`}]}}catch(h){return{content:[{type:"text",text:`Error deleting node: ${h instanceof Error?h.message:String(h)}`}]}}}),f.tool("create_connections","Create connections between nodes using the default connector style",{connections:P.array(P.object({startNodeId:P.string().describe("ID of the starting node"),endNodeId:P.string().describe("ID of the ending node"),text:P.string().optional().describe("Optional text to display on the connector")})).describe("Array of node connections to create")},async({connections:v})=>{try{if(!v||v.length===0)return{content:[{type:"text",text:"No connections provided"}]};let h=await s("create_connections",{connections:v});return{content:[{type:"text",text:`Created ${v.length} connections: ${JSON.stringify(h)}`}]}}catch(h){return{content:[{type:"text",text:`Error creating connections: ${h instanceof Error?h.message:String(h)}`}]}}})}FJ().catch((f)=>{PX.error(`Error starting FigmaMCP server: ${f instanceof Error?f.message:String(f)}`),process.exit(1)});var IQ=new _Q({name:$J,version:jJ},{capabilities:{logging:{}}});_J(IQ);var TQ=x1(require("node:process"));b1();class CQ{append(f){this._buffer=this._buffer?Buffer.concat([this._buffer,f]):f}readMessage(){if(!this._buffer)return null;let f=this._buffer.indexOf(`
|
|
511
|
-
`);if(f===-1)return null;let v=this._buffer.toString("utf8",0,f).replace(/\r$/,"");return this._buffer=this._buffer.subarray(f+1),XX(v)}clear(){this._buffer=void 0}}function XX(f){return Eh.parse(JSON.parse(f))}function lJ(f){return JSON.stringify(f)+`
|
|
512
|
-
`}class xQ{constructor(f=TQ.default.stdin,v=TQ.default.stdout){this._stdin=f,this._stdout=v,this._readBuffer=new CQ,this._started=!1,this._ondata=(h)=>{this._readBuffer.append(h),this.processReadBuffer()},this._onerror=(h)=>{var J;(J=this.onerror)===null||J===void 0||J.call(this,h)}}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 f,v;while(!0)try{let h=this._readBuffer.readMessage();if(h===null)break;(f=this.onmessage)===null||f===void 0||f.call(this,h)}catch(h){(v=this.onerror)===null||v===void 0||v.call(this,h)}}async close(){var f;if(this._stdin.off("data",this._ondata),this._stdin.off("error",this._onerror),this._stdin.listenerCount("data")===0)this._stdin.pause();this._readBuffer.clear(),(f=this.onclose)===null||f===void 0||f.call(this)}send(f){return new Promise((v)=>{let h=lJ(f);if(this._stdout.write(h))v();else this._stdout.once("drain",v)})}}rf();var YX=sv("StdioTransport");async function kJ(f){try{let v=new xQ;await f.connect(v)}catch(v){YX.info(JSON.stringify({jsonrpc:"2.0",id:null,error:{code:-32000,message:`Server startup failed: ${v.message}`}})),process.exit(1)}}kJ(IQ);
|
|
407
|
+
## Step-by-Step Process
|
|
513
408
|
|
|
514
|
-
|
|
409
|
+
### 1. Preparation & Context Gathering
|
|
410
|
+
- **Action:** Call \`read_my_design\` on the relevant node(s) to get context about the nodes involved (names, types, etc.). This helps in generating meaningful connector labels later.
|
|
411
|
+
- **Action:** Call \`set_default_connector\` **without** the \`connectorId\` parameter.
|
|
412
|
+
- **Check Result:** Analyze the response from \`set_default_connector\`.
|
|
413
|
+
- If it confirms a default connector is already set (e.g., "Default connector is already set"), proceed to Step 2.
|
|
414
|
+
- If it indicates no default connector is set (e.g., "No default connector set..."), you **cannot** proceed with \`create_connections\` yet. Inform the user they need to manually copy a connector from FigJam, paste it onto the current page, select it, and then you can run \`set_default_connector({ connectorId: "SELECTED_NODE_ID" })\` before attempting \`create_connections\`. **Do not proceed to Step 2 until a default connector is confirmed.**
|
|
415
|
+
|
|
416
|
+
### 2. Filter and Transform Reactions from \`get_reactions\` Output
|
|
417
|
+
- **Iterate:** Go through the JSON array provided by \`get_reactions\`. For each node in the array:
|
|
418
|
+
- Iterate through its \`reactions\` array.
|
|
419
|
+
- **Filter:** Keep only reactions where the \`action\` meets these criteria:
|
|
420
|
+
- Has a \`type\` that implies a connection (e.g., \`NAVIGATE\`, \`OPEN_OVERLAY\`, \`SWAP_OVERLAY\`). **Ignore** types like \`CHANGE_TO\`, \`CLOSE_OVERLAY\`, etc.
|
|
421
|
+
- Has a valid \`destinationId\` property.
|
|
422
|
+
- **Extract:** For each valid reaction, extract the following information:
|
|
423
|
+
- \`sourceNodeId\`: The ID of the node the reaction belongs to (from the outer loop).
|
|
424
|
+
- \`destinationNodeId\`: The value of \`action.destinationId\`.
|
|
425
|
+
- \`actionType\`: The value of \`action.type\`.
|
|
426
|
+
- \`triggerType\`: The value of \`trigger.type\`.
|
|
427
|
+
|
|
428
|
+
### 3. Generate Connector Text Labels
|
|
429
|
+
- **For each extracted connection:** Create a concise, descriptive text label string.
|
|
430
|
+
- **Combine Information:** Use the \`actionType\`, \`triggerType\`, and potentially the names of the source/destination nodes (obtained from Step 1's \`read_my_design\` or by calling \`get_node_info\` if necessary) to generate the label.
|
|
431
|
+
- **Example Labels:**
|
|
432
|
+
- If \`triggerType\` is "ON_CLICK" and \`actionType\` is "NAVIGATE": "On click, navigate to [Destination Node Name]"
|
|
433
|
+
- If \`triggerType\` is "ON_DRAG" and \`actionType\` is "OPEN_OVERLAY": "On drag, open [Destination Node Name] overlay"
|
|
434
|
+
- **Keep it brief and informative.** Let this generated string be \`generatedText\`.
|
|
435
|
+
|
|
436
|
+
### 4. Prepare the \`connections\` Array for \`create_connections\`
|
|
437
|
+
- **Structure:** Create a JSON array where each element is an object representing a connection.
|
|
438
|
+
- **Format:** Each object in the array must have the following structure:
|
|
439
|
+
\`\`\`json
|
|
440
|
+
{
|
|
441
|
+
"startNodeId": "sourceNodeId_from_step_2",
|
|
442
|
+
"endNodeId": "destinationNodeId_from_step_2",
|
|
443
|
+
"text": "generatedText_from_step_3"
|
|
444
|
+
}
|
|
445
|
+
\`\`\`
|
|
446
|
+
- **Result:** This final array is the value you will pass to the \`connections\` parameter when calling the \`create_connections\` tool.
|
|
447
|
+
|
|
448
|
+
### 5. Execute Connection Creation
|
|
449
|
+
- **Action:** Call the \`create_connections\` tool, passing the array generated in Step 4 as the \`connections\` argument.
|
|
450
|
+
- **Verify:** Check the response from \`create_connections\` to confirm success or failure.
|
|
451
|
+
|
|
452
|
+
This detailed process ensures you correctly interpret the reaction data, prepare the necessary information, and use the appropriate tools to create the connector lines.`}}],description:"Strategy for converting Figma prototype reactions to connector lines using the output of 'get_reactions'"}}),$.tool("join_channel","Join a specific channel to communicate with Figma",{channel:J.string().describe("The name of the channel to join").default("")},async({channel:X})=>{try{if(!X)return{content:[{type:"text",text:"Please provide a channel name to join:"}],followUp:{tool:"join_channel",description:"Join the specified channel"}};return await v1(X),{content:[{type:"text",text:`Successfully joined channel: ${X}`}]}}catch(Q){return{content:[{type:"text",text:`Error joining channel: ${Q instanceof Error?Q.message:String(Q)}`}]}}}),$.tool("get_file_components","Get all components from a specific Figma file",{fileKey:J.string().describe("The Figma file identifier found in the file URL"),personalToken:J.string().optional().describe("Optional personal token, will use environment token if not provided")},async({fileKey:X,personalToken:Q})=>{try{let Y=Q;if(!Y){if(Y=process.env.personalToken,!Y)return{content:[{type:"text",text:JSON.stringify({success:!1,error:"Personal token not found. Please provide personalToken parameter or set FIGMA_API_KEY environment variable."})}]}}let G=await fetch(`https://api.figma.com/v1/files/${X}/components`,{headers:{Authorization:`Bearer ${Y}`,"X-Figma-Token":Y}});if(!G.ok){let H=await G.text();return{content:[{type:"text",text:JSON.stringify({success:!1,error:`API request failed: ${G.status} ${G.statusText}`,details:H})}]}}let W=await G.json();return{content:[{type:"text",text:JSON.stringify({success:!0,fileKey:X,components:W})}]}}catch(Y){return{content:[{type:"text",text:JSON.stringify({success:!1,error:`Error getting file components: ${Y instanceof Error?Y.message:String(Y)}`})}]}}}),$.tool("get_component","Get detailed information about a specific component by its key",{componentKey:J.string().describe("The unique key identifier of the component"),personalToken:J.string().optional().describe("Optional personal token, will use environment token if not provided")},async({componentKey:X,personalToken:Q})=>{try{let Y=Q;if(!Y){if(Y=process.env.personalToken,!Y)return{content:[{type:"text",text:JSON.stringify({success:!1,error:"Personal token not found. Please provide personalToken parameter or set FIGMA_API_KEY environment variable."})}]}}let G=await fetch(`https://api.figma.com/v1/components/${X}`,{headers:{Authorization:`Bearer ${Y}`,"X-Figma-Token":Y}});if(!G.ok){let H=await G.text();return{content:[{type:"text",text:JSON.stringify({success:!1,error:`API request failed: ${G.status} ${G.statusText}`,details:H})}]}}let W=await G.json();return{content:[{type:"text",text:JSON.stringify({success:!0,componentKey:X,component:W})}]}}catch(Y){return{content:[{type:"text",text:JSON.stringify({success:!1,error:`Error getting component: ${Y instanceof Error?Y.message:String(Y)}`})}]}}})}R1().catch(($)=>{o6.error(`Error starting FigmaMCP server: ${$ instanceof Error?$.message:String($)}`),process.exit(1)});var $0=new t3({name:K1,version:L1},{capabilities:{logging:{}}});k1($0);var Q0=y1(require("node:process"));u$();class X0{append($){this._buffer=this._buffer?Buffer.concat([this._buffer,$]):$}readMessage(){if(!this._buffer)return null;let $=this._buffer.indexOf(`
|
|
453
|
+
`);if($===-1)return null;let X=this._buffer.toString("utf8",0,$).replace(/\r$/,"");return this._buffer=this._buffer.subarray($+1),a6(X)}clear(){this._buffer=void 0}}function a6($){return k0.parse(JSON.parse($))}function f1($){return JSON.stringify($)+`
|
|
454
|
+
`}class Y0{constructor($=Q0.default.stdin,X=Q0.default.stdout){this._stdin=$,this._stdout=X,this._readBuffer=new X0,this._started=!1,this._ondata=(Q)=>{this._readBuffer.append(Q),this.processReadBuffer()},this._onerror=(Q)=>{var Y;(Y=this.onerror)===null||Y===void 0||Y.call(this,Q)}}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 Q=this._readBuffer.readMessage();if(Q===null)break;($=this.onmessage)===null||$===void 0||$.call(this,Q)}catch(Q){(X=this.onerror)===null||X===void 0||X.call(this,Q)}}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 Q=f1($);if(this._stdout.write(Q))X();else this._stdout.once("drain",X)})}}p$();var r6=M$("StdioTransport");async function P1($){try{let X=new Y0;await $.connect(X)}catch(X){r6.info(JSON.stringify({jsonrpc:"2.0",id:null,error:{code:-32000,message:`Server startup failed: ${X.message}`}})),process.exit(1)}}P1($0);
|
|
455
|
+
|
|
456
|
+
//# debugId=3EA45C7EDFB5A7C564756E2164756E21
|
|
515
457
|
//# sourceMappingURL=cli.js.map
|