@f2c/mcp 0.3.2 → 0.3.4

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 CHANGED
@@ -1,22 +1,22 @@
1
1
  #!/usr/bin/env node
2
- var iJ=Object.create;var{getPrototypeOf:dJ,defineProperty:A2,getOwnPropertyNames:oJ}=Object;var rJ=Object.prototype.hasOwnProperty;var x$=($,X,Q)=>{Q=$!=null?iJ(dJ($)):{};let J=X||!$||!$.__esModule?A2(Q,"default",{value:$,enumerable:!0}):Q;for(let G of oJ($))if(!rJ.call(J,G))A2(J,G,{get:()=>$[G],enumerable:!0});return J};var j2=($,X)=>()=>(X||$((X={exports:{}}).exports,X),X.exports);var K2=($,X)=>{for(var Q in X)A2($,Q,{get:X[Q],enumerable:!0,configurable:!0,set:(J)=>X[Q]=()=>J})};var z$=($,X)=>()=>($&&(X=$($=0)),X);function tJ($){F3=$}function TX(){return F3}function F($,X){let Q=TX(),J=xX({issueData:X,data:$.data,path:$.path,errorMaps:[$.common.contextualErrorMap,$.schemaErrorMap,Q,Q===Z4?void 0:Z4].filter((G)=>!!G)});$.common.issues.push(J)}class _${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 J of X){if(J.status==="aborted")return T;if(J.status==="dirty")$.dirty();Q.push(J.value)}return{status:$.value,value:Q}}static async mergeObjectAsync($,X){let Q=[];for(let J of X){let G=await J.key,H=await J.value;Q.push({key:G,value:H})}return _$.mergeObjectSync($,Q)}static mergeObjectSync($,X){let Q={};for(let J of X){let{key:G,value:H}=J;if(G.status==="aborted")return T;if(H.status==="aborted")return T;if(G.status==="dirty")$.dirty();if(H.status==="dirty")$.dirty();if(G.value!=="__proto__"&&(typeof H.value!=="undefined"||J.alwaysSet))Q[G.value]=H.value}return{status:$.value,value:Q}}}function hX($,X,Q,J){if(Q==="a"&&!J)throw new TypeError("Private accessor was defined without a getter");if(typeof X==="function"?$!==X||!J:!X.has($))throw new TypeError("Cannot read private member from an object whose class did not declare it");return Q==="m"?J:Q==="a"?J.call($):J?J.value:X.get($)}function E3($,X,Q,J,G){if(J==="m")throw new TypeError("Private method is not writable");if(J==="a"&&!G)throw new TypeError("Private accessor was defined without a setter");if(typeof X==="function"?$!==X||!G:!X.has($))throw new TypeError("Cannot write private member to an object whose class did not declare it");return J==="a"?G.call($,Q):G?G.value=Q:X.set($,Q),Q}class p${constructor($,X,Q,J){this._cachedPath=[],this.parent=$,this.data=X,this._path=Q,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 u($){if(!$)return{};let{errorMap:X,invalid_type_error:Q,required_error:J,description:G}=$;if(X&&(Q||J))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:(M,z)=>{var D,O;let{message:_}=$;if(M.code==="invalid_enum_value")return{message:_!==null&&_!==void 0?_:z.defaultError};if(typeof z.data==="undefined")return{message:(D=_!==null&&_!==void 0?_:J)!==null&&D!==void 0?D:z.defaultError};if(M.code!=="invalid_type")return{message:z.defaultError};return{message:(O=_!==null&&_!==void 0?_:Q)!==null&&O!==void 0?O:z.defaultError}},description:G}}class c{get description(){return this._def.description}_getType($){return R0($.data)}_getOrReturnCtx($,X){return X||{common:$.parent.common,data:$.data,parsedType:R0($.data),schemaErrorMap:this._def.errorMap,path:$.path,parent:$.parent}}_processInputParams($){return{status:new _$,ctx:{common:$.parent.common,data:$.data,parsedType:R0($.data),schemaErrorMap:this._def.errorMap,path:$.path,parent:$.parent}}}_parseSync($){let X=this._parse($);if(P6(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){var Q;let J={common:{issues:[],async:(Q=X===null||X===void 0?void 0:X.async)!==null&&Q!==void 0?Q:!1,contextualErrorMap:X===null||X===void 0?void 0:X.errorMap},path:(X===null||X===void 0?void 0:X.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:$,parsedType:R0($)},G=this._parseSync({data:$,path:J.path,parent:J});return N3(J,G)}"~validate"($){var X,Q;let J={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:$,parsedType:R0($)};if(!this["~standard"].async)try{let G=this._parseSync({data:$,path:[],parent:J});return z4(G)?{value:G.value}:{issues:J.common.issues}}catch(G){if((Q=(X=G===null||G===void 0?void 0:G.message)===null||X===void 0?void 0:X.toLowerCase())===null||Q===void 0?void 0:Q.includes("encountered"))this["~standard"].async=!0;J.common={issues:[],async:!0}}return this._parseAsync({data:$,path:[],parent:J}).then((G)=>z4(G)?{value:G.value}:{issues:J.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===null||X===void 0?void 0:X.errorMap,async:!0},path:(X===null||X===void 0?void 0:X.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:$,parsedType:R0($)},J=this._parse({data:$,path:Q.path,parent:Q}),G=await(P6(J)?J:Promise.resolve(J));return N3(Q,G)}refine($,X){let Q=(J)=>{if(typeof X==="string"||typeof X==="undefined")return{message:X};else if(typeof X==="function")return X(J);else return X};return this._refinement((J,G)=>{let H=$(J),M=()=>G.addIssue({code:U.custom,...Q(J)});if(typeof Promise!=="undefined"&&H instanceof Promise)return H.then((z)=>{if(!z)return M(),!1;else return!0});if(!H)return M(),!1;else return!0})}refinement($,X){return this._refinement((Q,J)=>{if(!$(Q))return J.addIssue(typeof X==="function"?X(Q,J):X),!1;else return!0})}_refinement($){return new h$({schema:this,typeName:N.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 k$.create(this,this._def)}nullable(){return v0.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return u$.create(this)}promise(){return O4.create(this,this._def)}or($){return u4.create([this,$],this._def)}and($){return p4.create(this,$,this._def)}transform($){return new h$({...u(this._def),schema:this,typeName:N.ZodEffects,effect:{type:"transform",transform:$}})}default($){let X=typeof $==="function"?$:()=>$;return new o4({...u(this._def),innerType:this,defaultValue:X,typeName:N.ZodDefault})}brand(){return new ZX({typeName:N.ZodBranded,type:this,...u(this._def)})}catch($){let X=typeof $==="function"?$:()=>$;return new r4({...u(this._def),innerType:this,catchValue:X,typeName:N.ZodCatch})}describe($){return new this.constructor({...this._def,description:$})}pipe($){return y6.create(this,$)}readonly(){return a4.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}function v3($){let X="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";if($.precision)X=`${X}\\.\\d{${$.precision}}`;else if($.precision==null)X=`${X}(\\.\\d+)?`;return X}function q5($){return new RegExp(`^${v3($)}$`)}function C3($){let X=`${R3}T${v3($)}`,Q=[];if(Q.push($.local?"Z?":"Z"),$.offset)Q.push("([+-]\\d{2}:?\\d{2})");return X=`${X}(${Q.join("|")})`,new RegExp(`^${X}$`)}function _5($,X){if((X==="v4"||!X)&&M5.test($))return!0;if((X==="v6"||!X)&&z5.test($))return!0;return!1}function A5($,X){if(!J5.test($))return!1;try{let[Q]=$.split("."),J=Q.replace(/-/g,"+").replace(/_/g,"/").padEnd(Q.length+(4-Q.length%4)%4,"="),G=JSON.parse(atob(J));if(typeof G!=="object"||G===null)return!1;if(!G.typ||!G.alg)return!1;if(X&&G.alg!==X)return!1;return!0}catch(Q){return!1}}function j5($,X){if((X==="v4"||!X)&&w5.test($))return!0;if((X==="v6"||!X)&&B5.test($))return!0;return!1}function K5($,X){let Q=($.toString().split(".")[1]||"").length,J=(X.toString().split(".")[1]||"").length,G=Q>J?Q:J,H=parseInt($.toFixed(G).replace(".","")),M=parseInt(X.toFixed(G).replace(".",""));return H%M/Math.pow(10,G)}function x4($){if($ instanceof Y$){let X={};for(let Q in $.shape){let J=$.shape[Q];X[Q]=k$.create(x4(J))}return new Y$({...$._def,shape:()=>X})}else if($ instanceof u$)return new u$({...$._def,type:x4($.element)});else if($ instanceof k$)return k$.create(x4($.unwrap()));else if($ instanceof v0)return v0.create(x4($.unwrap()));else if($ instanceof w0)return w0.create($.items.map((X)=>x4(X)));else return $}function F2($,X){let Q=R0($),J=R0(X);if($===X)return{valid:!0,data:$};else if(Q===E.object&&J===E.object){let G=e.objectKeys(X),H=e.objectKeys($).filter((z)=>G.indexOf(z)!==-1),M={...$,...X};for(let z of H){let D=F2($[z],X[z]);if(!D.valid)return{valid:!1};M[z]=D.data}return{valid:!0,data:M}}else if(Q===E.array&&J===E.array){if($.length!==X.length)return{valid:!1};let G=[];for(let H=0;H<$.length;H++){let M=$[H],z=X[H],D=F2(M,z);if(!D.valid)return{valid:!1};G.push(D.data)}return{valid:!0,data:G}}else if(Q===E.date&&J===E.date&&+$===+X)return{valid:!0,data:$};else return{valid:!1}}function k3($,X){return new u0({values:$,typeName:N.ZodEnum,...u(X)})}function L3($,X){let Q=typeof $==="function"?$(X):typeof $==="string"?{message:$}:$;return typeof Q==="string"?{message:Q}:Q}function I3($,X={},Q){if($)return D4.create().superRefine((J,G)=>{var H,M;let z=$(J);if(z instanceof Promise)return z.then((D)=>{var O,_;if(!D){let m=L3(X,J),x=(_=(O=m.fatal)!==null&&O!==void 0?O:Q)!==null&&_!==void 0?_:!0;G.addIssue({code:"custom",...m,fatal:x})}});if(!z){let D=L3(X,J),O=(M=(H=D.fatal)!==null&&H!==void 0?H:Q)!==null&&M!==void 0?M:!0;G.addIssue({code:"custom",...D,fatal:O})}return});return D4.create()}var e,N2,E,R0=($)=>{switch(typeof $){case"undefined":return E.undefined;case"string":return E.string;case"number":return isNaN($)?E.nan:E.number;case"boolean":return E.boolean;case"function":return E.function;case"bigint":return E.bigint;case"symbol":return E.symbol;case"object":if(Array.isArray($))return E.array;if($===null)return E.null;if($.then&&typeof $.then==="function"&&$.catch&&typeof $.catch==="function")return E.promise;if(typeof Map!=="undefined"&&$ instanceof Map)return E.map;if(typeof Set!=="undefined"&&$ instanceof Set)return E.set;if(typeof Date!=="undefined"&&$ instanceof Date)return E.date;return E.object;default:return E.unknown}},U,aJ=($)=>{return JSON.stringify($,null,2).replace(/"([^"]+)":/g,"$1:")},C$,Z4=($,X)=>{let Q;switch($.code){case U.invalid_type:if($.received===E.undefined)Q="Required";else Q=`Expected ${$.expected}, received ${$.received}`;break;case U.invalid_literal:Q=`Invalid literal value, expected ${JSON.stringify($.expected,e.jsonStringifyReplacer)}`;break;case U.unrecognized_keys:Q=`Unrecognized key(s) in object: ${e.joinValues($.keys,", ")}`;break;case U.invalid_union:Q="Invalid input";break;case U.invalid_union_discriminator:Q=`Invalid discriminator value. Expected ${e.joinValues($.options)}`;break;case U.invalid_enum_value:Q=`Invalid enum value. Expected ${e.joinValues($.options)}, received '${$.received}'`;break;case U.invalid_arguments:Q="Invalid function arguments";break;case U.invalid_return_type:Q="Invalid function return type";break;case U.invalid_date:Q="Invalid date";break;case U.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 e.assertNever($.validation);else if($.validation!=="regex")Q=`Invalid ${$.validation}`;else Q="Invalid";break;case U.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==="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 U.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 U.custom:Q="Invalid input";break;case U.invalid_intersection_types:Q="Intersection results could not be merged";break;case U.not_multiple_of:Q=`Number must be a multiple of ${$.multipleOf}`;break;case U.not_finite:Q="Number must be finite";break;default:Q=X.defaultError,e.assertNever($)}return{message:Q}},F3,xX=($)=>{let{data:X,path:Q,errorMaps:J,issueData:G}=$,H=[...Q,...G.path||[]],M={...G,path:H};if(G.message!==void 0)return{...G,path:H,message:G.message};let z="",D=J.filter((O)=>!!O).slice().reverse();for(let O of D)z=O(M,{data:X,defaultError:z}).message;return{...G,path:H,message:z}},sJ,T,h4=($)=>({status:"dirty",value:$}),U$=($)=>({status:"valid",value:$}),L2=($)=>$.status==="aborted",S2=($)=>$.status==="dirty",z4=($)=>$.status==="valid",P6=($)=>typeof Promise!=="undefined"&&$ instanceof Promise,C,I6,b6,N3=($,X)=>{if(z4(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 C$($.common.issues);return this._error=Q,this._error}}}},eJ,$5,X5,Q5,W5,J5,G5,Y5,H5="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",U2,M5,w5,z5,B5,D5,V5,R3="((\\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])))",O5,c$,l0,c0,m4,B4,f6,l4,c4,D4,m0,M0,g6,u$,Y$,u4,E0=($)=>{if($ instanceof n4)return E0($.schema);else if($ instanceof h$)return E0($.innerType());else if($ instanceof i4)return[$.value];else if($ instanceof u0)return $.options;else if($ instanceof d4)return e.objectValues($.enum);else if($ instanceof o4)return E0($._def.innerType);else if($ instanceof l4)return[void 0];else if($ instanceof c4)return[null];else if($ instanceof k$)return[void 0,...E0($.unwrap())];else if($ instanceof v0)return[null,...E0($.unwrap())];else if($ instanceof ZX)return E0($.unwrap());else if($ instanceof a4)return E0($.unwrap());else if($ instanceof r4)return E0($._def.innerType);else return[]},yX,p4,w0,T6,x6,V4,y4,n4,i4,u0,d4,O4,h$,k$,v0,o4,r4,h6,U5,ZX,y6,a4,N5,N,L5=($,X={message:`Input not instance of ${$.name}`})=>I3((Q)=>Q instanceof $,X),b3,P3,S5,F5,f3,E5,R5,v5,C5,k5,I5,b5,P5,f5,g5,T5,x5,h5,y5,Z5,m5,l5,c5,u5,p5,n5,i5,d5,o5,S3,r5,a5,t5,s5,e5=()=>b3().optional(),$9=()=>P3().optional(),X9=()=>f3().optional(),Q9,W9,B;var p0=z$(()=>{(function($){$.assertEqual=(G)=>G;function X(G){}$.assertIs=X;function Q(G){throw new Error}$.assertNever=Q,$.arrayToEnum=(G)=>{let H={};for(let M of G)H[M]=M;return H},$.getValidEnumValues=(G)=>{let H=$.objectKeys(G).filter((z)=>typeof G[G[z]]!=="number"),M={};for(let z of H)M[z]=G[z];return $.objectValues(M)},$.objectValues=(G)=>{return $.objectKeys(G).map(function(H){return G[H]})},$.objectKeys=typeof Object.keys==="function"?(G)=>Object.keys(G):(G)=>{let H=[];for(let M in G)if(Object.prototype.hasOwnProperty.call(G,M))H.push(M);return H},$.find=(G,H)=>{for(let M of G)if(H(M))return M;return},$.isInteger=typeof Number.isInteger==="function"?(G)=>Number.isInteger(G):(G)=>typeof G==="number"&&isFinite(G)&&Math.floor(G)===G;function J(G,H=" | "){return G.map((M)=>typeof M==="string"?`'${M}'`:M).join(H)}$.joinValues=J,$.jsonStringifyReplacer=(G,H)=>{if(typeof H==="bigint")return H.toString();return H}})(e||(e={}));(function($){$.mergeShapes=(X,Q)=>{return{...X,...Q}}})(N2||(N2={}));E=e.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),U=e.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);C$=class C$ extends Error{get errors(){return this.issues}constructor($){super();this.issues=[],this.addIssue=(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:[]},J=(G)=>{for(let H of G.issues)if(H.code==="invalid_union")H.unionErrors.map(J);else if(H.code==="invalid_return_type")J(H.returnTypeError);else if(H.code==="invalid_arguments")J(H.argumentsError);else if(H.path.length===0)Q._errors.push(X(H));else{let M=Q,z=0;while(z<H.path.length){let D=H.path[z];if(z!==H.path.length-1)M[D]=M[D]||{_errors:[]};else M[D]=M[D]||{_errors:[]},M[D]._errors.push(X(H));M=M[D],z++}}};return J(this),Q}static assert($){if(!($ instanceof C$))throw new Error(`Not a ZodError: ${$}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,e.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten($=(X)=>X.message){let X={},Q=[];for(let J of this.issues)if(J.path.length>0)X[J.path[0]]=X[J.path[0]]||[],X[J.path[0]].push($(J));else Q.push($(J));return{formErrors:Q,fieldErrors:X}}get formErrors(){return this.flatten()}};C$.create=($)=>{return new C$($)};F3=Z4;sJ=[];T=Object.freeze({status:"aborted"});(function($){$.errToObj=(X)=>typeof X==="string"?{message:X}:X||{},$.toString=(X)=>typeof X==="string"?X:X===null||X===void 0?void 0:X.message})(C||(C={}));eJ=/^c[^\s-]{8,}$/i,$5=/^[0-9a-z]+$/,X5=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Q5=/^[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,W5=/^[a-z0-9_-]{21}$/i,J5=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,G5=/^[-+]?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)?)??$/,Y5=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,M5=/^(?:(?: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])$/,w5=/^(?:(?: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])$/,z5=/^(([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]))$/,B5=/^(([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])$/,D5=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,V5=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,O5=new RegExp(`^${R3}$`);c$=class c$ extends c{_parse($){if(this._def.coerce)$.data=String($.data);if(this._getType($)!==E.string){let G=this._getOrReturnCtx($);return F(G,{code:U.invalid_type,expected:E.string,received:G.parsedType}),T}let Q=new _$,J=void 0;for(let G of this._def.checks)if(G.kind==="min"){if($.data.length<G.value)J=this._getOrReturnCtx($,J),F(J,{code:U.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)J=this._getOrReturnCtx($,J),F(J,{code:U.too_big,maximum:G.value,type:"string",inclusive:!0,exact:!1,message:G.message}),Q.dirty()}else if(G.kind==="length"){let H=$.data.length>G.value,M=$.data.length<G.value;if(H||M){if(J=this._getOrReturnCtx($,J),H)F(J,{code:U.too_big,maximum:G.value,type:"string",inclusive:!0,exact:!0,message:G.message});else if(M)F(J,{code:U.too_small,minimum:G.value,type:"string",inclusive:!0,exact:!0,message:G.message});Q.dirty()}}else if(G.kind==="email"){if(!Y5.test($.data))J=this._getOrReturnCtx($,J),F(J,{validation:"email",code:U.invalid_string,message:G.message}),Q.dirty()}else if(G.kind==="emoji"){if(!U2)U2=new RegExp(H5,"u");if(!U2.test($.data))J=this._getOrReturnCtx($,J),F(J,{validation:"emoji",code:U.invalid_string,message:G.message}),Q.dirty()}else if(G.kind==="uuid"){if(!Q5.test($.data))J=this._getOrReturnCtx($,J),F(J,{validation:"uuid",code:U.invalid_string,message:G.message}),Q.dirty()}else if(G.kind==="nanoid"){if(!W5.test($.data))J=this._getOrReturnCtx($,J),F(J,{validation:"nanoid",code:U.invalid_string,message:G.message}),Q.dirty()}else if(G.kind==="cuid"){if(!eJ.test($.data))J=this._getOrReturnCtx($,J),F(J,{validation:"cuid",code:U.invalid_string,message:G.message}),Q.dirty()}else if(G.kind==="cuid2"){if(!$5.test($.data))J=this._getOrReturnCtx($,J),F(J,{validation:"cuid2",code:U.invalid_string,message:G.message}),Q.dirty()}else if(G.kind==="ulid"){if(!X5.test($.data))J=this._getOrReturnCtx($,J),F(J,{validation:"ulid",code:U.invalid_string,message:G.message}),Q.dirty()}else if(G.kind==="url")try{new URL($.data)}catch(H){J=this._getOrReturnCtx($,J),F(J,{validation:"url",code:U.invalid_string,message:G.message}),Q.dirty()}else if(G.kind==="regex"){if(G.regex.lastIndex=0,!G.regex.test($.data))J=this._getOrReturnCtx($,J),F(J,{validation:"regex",code:U.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))J=this._getOrReturnCtx($,J),F(J,{code:U.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))J=this._getOrReturnCtx($,J),F(J,{code:U.invalid_string,validation:{startsWith:G.value},message:G.message}),Q.dirty()}else if(G.kind==="endsWith"){if(!$.data.endsWith(G.value))J=this._getOrReturnCtx($,J),F(J,{code:U.invalid_string,validation:{endsWith:G.value},message:G.message}),Q.dirty()}else if(G.kind==="datetime"){if(!C3(G).test($.data))J=this._getOrReturnCtx($,J),F(J,{code:U.invalid_string,validation:"datetime",message:G.message}),Q.dirty()}else if(G.kind==="date"){if(!O5.test($.data))J=this._getOrReturnCtx($,J),F(J,{code:U.invalid_string,validation:"date",message:G.message}),Q.dirty()}else if(G.kind==="time"){if(!q5(G).test($.data))J=this._getOrReturnCtx($,J),F(J,{code:U.invalid_string,validation:"time",message:G.message}),Q.dirty()}else if(G.kind==="duration"){if(!G5.test($.data))J=this._getOrReturnCtx($,J),F(J,{validation:"duration",code:U.invalid_string,message:G.message}),Q.dirty()}else if(G.kind==="ip"){if(!_5($.data,G.version))J=this._getOrReturnCtx($,J),F(J,{validation:"ip",code:U.invalid_string,message:G.message}),Q.dirty()}else if(G.kind==="jwt"){if(!A5($.data,G.alg))J=this._getOrReturnCtx($,J),F(J,{validation:"jwt",code:U.invalid_string,message:G.message}),Q.dirty()}else if(G.kind==="cidr"){if(!j5($.data,G.version))J=this._getOrReturnCtx($,J),F(J,{validation:"cidr",code:U.invalid_string,message:G.message}),Q.dirty()}else if(G.kind==="base64"){if(!D5.test($.data))J=this._getOrReturnCtx($,J),F(J,{validation:"base64",code:U.invalid_string,message:G.message}),Q.dirty()}else if(G.kind==="base64url"){if(!V5.test($.data))J=this._getOrReturnCtx($,J),F(J,{validation:"base64url",code:U.invalid_string,message:G.message}),Q.dirty()}else e.assertNever(G);return{status:Q.value,value:$.data}}_regex($,X,Q){return this.refinement((J)=>$.test(J),{validation:X,code:U.invalid_string,...C.errToObj(Q)})}_addCheck($){return new c$({...this._def,checks:[...this._def.checks,$]})}email($){return this._addCheck({kind:"email",...C.errToObj($)})}url($){return this._addCheck({kind:"url",...C.errToObj($)})}emoji($){return this._addCheck({kind:"emoji",...C.errToObj($)})}uuid($){return this._addCheck({kind:"uuid",...C.errToObj($)})}nanoid($){return this._addCheck({kind:"nanoid",...C.errToObj($)})}cuid($){return this._addCheck({kind:"cuid",...C.errToObj($)})}cuid2($){return this._addCheck({kind:"cuid2",...C.errToObj($)})}ulid($){return this._addCheck({kind:"ulid",...C.errToObj($)})}base64($){return this._addCheck({kind:"base64",...C.errToObj($)})}base64url($){return this._addCheck({kind:"base64url",...C.errToObj($)})}jwt($){return this._addCheck({kind:"jwt",...C.errToObj($)})}ip($){return this._addCheck({kind:"ip",...C.errToObj($)})}cidr($){return this._addCheck({kind:"cidr",...C.errToObj($)})}datetime($){var X,Q;if(typeof $==="string")return this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:$});return this._addCheck({kind:"datetime",precision:typeof($===null||$===void 0?void 0:$.precision)==="undefined"?null:$===null||$===void 0?void 0:$.precision,offset:(X=$===null||$===void 0?void 0:$.offset)!==null&&X!==void 0?X:!1,local:(Q=$===null||$===void 0?void 0:$.local)!==null&&Q!==void 0?Q:!1,...C.errToObj($===null||$===void 0?void 0:$.message)})}date($){return this._addCheck({kind:"date",message:$})}time($){if(typeof $==="string")return this._addCheck({kind:"time",precision:null,message:$});return this._addCheck({kind:"time",precision:typeof($===null||$===void 0?void 0:$.precision)==="undefined"?null:$===null||$===void 0?void 0:$.precision,...C.errToObj($===null||$===void 0?void 0:$.message)})}duration($){return this._addCheck({kind:"duration",...C.errToObj($)})}regex($,X){return this._addCheck({kind:"regex",regex:$,...C.errToObj(X)})}includes($,X){return this._addCheck({kind:"includes",value:$,position:X===null||X===void 0?void 0:X.position,...C.errToObj(X===null||X===void 0?void 0:X.message)})}startsWith($,X){return this._addCheck({kind:"startsWith",value:$,...C.errToObj(X)})}endsWith($,X){return this._addCheck({kind:"endsWith",value:$,...C.errToObj(X)})}min($,X){return this._addCheck({kind:"min",value:$,...C.errToObj(X)})}max($,X){return this._addCheck({kind:"max",value:$,...C.errToObj(X)})}length($,X){return this._addCheck({kind:"length",value:$,...C.errToObj(X)})}nonempty($){return this.min(1,C.errToObj($))}trim(){return new c$({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new c$({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new c$({...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 $}};c$.create=($)=>{var X;return new c$({checks:[],typeName:N.ZodString,coerce:(X=$===null||$===void 0?void 0:$.coerce)!==null&&X!==void 0?X:!1,...u($)})};l0=class l0 extends c{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($)!==E.number){let G=this._getOrReturnCtx($);return F(G,{code:U.invalid_type,expected:E.number,received:G.parsedType}),T}let Q=void 0,J=new _$;for(let G of this._def.checks)if(G.kind==="int"){if(!e.isInteger($.data))Q=this._getOrReturnCtx($,Q),F(Q,{code:U.invalid_type,expected:"integer",received:"float",message:G.message}),J.dirty()}else if(G.kind==="min"){if(G.inclusive?$.data<G.value:$.data<=G.value)Q=this._getOrReturnCtx($,Q),F(Q,{code:U.too_small,minimum:G.value,type:"number",inclusive:G.inclusive,exact:!1,message:G.message}),J.dirty()}else if(G.kind==="max"){if(G.inclusive?$.data>G.value:$.data>=G.value)Q=this._getOrReturnCtx($,Q),F(Q,{code:U.too_big,maximum:G.value,type:"number",inclusive:G.inclusive,exact:!1,message:G.message}),J.dirty()}else if(G.kind==="multipleOf"){if(K5($.data,G.value)!==0)Q=this._getOrReturnCtx($,Q),F(Q,{code:U.not_multiple_of,multipleOf:G.value,message:G.message}),J.dirty()}else if(G.kind==="finite"){if(!Number.isFinite($.data))Q=this._getOrReturnCtx($,Q),F(Q,{code:U.not_finite,message:G.message}),J.dirty()}else e.assertNever(G);return{status:J.value,value:$.data}}gte($,X){return this.setLimit("min",$,!0,C.toString(X))}gt($,X){return this.setLimit("min",$,!1,C.toString(X))}lte($,X){return this.setLimit("max",$,!0,C.toString(X))}lt($,X){return this.setLimit("max",$,!1,C.toString(X))}setLimit($,X,Q,J){return new l0({...this._def,checks:[...this._def.checks,{kind:$,value:X,inclusive:Q,message:C.toString(J)}]})}_addCheck($){return new l0({...this._def,checks:[...this._def.checks,$]})}int($){return this._addCheck({kind:"int",message:C.toString($)})}positive($){return this._addCheck({kind:"min",value:0,inclusive:!1,message:C.toString($)})}negative($){return this._addCheck({kind:"max",value:0,inclusive:!1,message:C.toString($)})}nonpositive($){return this._addCheck({kind:"max",value:0,inclusive:!0,message:C.toString($)})}nonnegative($){return this._addCheck({kind:"min",value:0,inclusive:!0,message:C.toString($)})}multipleOf($,X){return this._addCheck({kind:"multipleOf",value:$,message:C.toString(X)})}finite($){return this._addCheck({kind:"finite",message:C.toString($)})}safe($){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:C.toString($)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:C.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"&&e.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($)}};l0.create=($)=>{return new l0({checks:[],typeName:N.ZodNumber,coerce:($===null||$===void 0?void 0:$.coerce)||!1,...u($)})};c0=class c0 extends c{constructor(){super(...arguments);this.min=this.gte,this.max=this.lte}_parse($){if(this._def.coerce)try{$.data=BigInt($.data)}catch(G){return this._getInvalidInput($)}if(this._getType($)!==E.bigint)return this._getInvalidInput($);let Q=void 0,J=new _$;for(let G of this._def.checks)if(G.kind==="min"){if(G.inclusive?$.data<G.value:$.data<=G.value)Q=this._getOrReturnCtx($,Q),F(Q,{code:U.too_small,type:"bigint",minimum:G.value,inclusive:G.inclusive,message:G.message}),J.dirty()}else if(G.kind==="max"){if(G.inclusive?$.data>G.value:$.data>=G.value)Q=this._getOrReturnCtx($,Q),F(Q,{code:U.too_big,type:"bigint",maximum:G.value,inclusive:G.inclusive,message:G.message}),J.dirty()}else if(G.kind==="multipleOf"){if($.data%G.value!==BigInt(0))Q=this._getOrReturnCtx($,Q),F(Q,{code:U.not_multiple_of,multipleOf:G.value,message:G.message}),J.dirty()}else e.assertNever(G);return{status:J.value,value:$.data}}_getInvalidInput($){let X=this._getOrReturnCtx($);return F(X,{code:U.invalid_type,expected:E.bigint,received:X.parsedType}),T}gte($,X){return this.setLimit("min",$,!0,C.toString(X))}gt($,X){return this.setLimit("min",$,!1,C.toString(X))}lte($,X){return this.setLimit("max",$,!0,C.toString(X))}lt($,X){return this.setLimit("max",$,!1,C.toString(X))}setLimit($,X,Q,J){return new c0({...this._def,checks:[...this._def.checks,{kind:$,value:X,inclusive:Q,message:C.toString(J)}]})}_addCheck($){return new c0({...this._def,checks:[...this._def.checks,$]})}positive($){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:C.toString($)})}negative($){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:C.toString($)})}nonpositive($){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:C.toString($)})}nonnegative($){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:C.toString($)})}multipleOf($,X){return this._addCheck({kind:"multipleOf",value:$,message:C.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 $}};c0.create=($)=>{var X;return new c0({checks:[],typeName:N.ZodBigInt,coerce:(X=$===null||$===void 0?void 0:$.coerce)!==null&&X!==void 0?X:!1,...u($)})};m4=class m4 extends c{_parse($){if(this._def.coerce)$.data=Boolean($.data);if(this._getType($)!==E.boolean){let Q=this._getOrReturnCtx($);return F(Q,{code:U.invalid_type,expected:E.boolean,received:Q.parsedType}),T}return U$($.data)}};m4.create=($)=>{return new m4({typeName:N.ZodBoolean,coerce:($===null||$===void 0?void 0:$.coerce)||!1,...u($)})};B4=class B4 extends c{_parse($){if(this._def.coerce)$.data=new Date($.data);if(this._getType($)!==E.date){let G=this._getOrReturnCtx($);return F(G,{code:U.invalid_type,expected:E.date,received:G.parsedType}),T}if(isNaN($.data.getTime())){let G=this._getOrReturnCtx($);return F(G,{code:U.invalid_date}),T}let Q=new _$,J=void 0;for(let G of this._def.checks)if(G.kind==="min"){if($.data.getTime()<G.value)J=this._getOrReturnCtx($,J),F(J,{code:U.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)J=this._getOrReturnCtx($,J),F(J,{code:U.too_big,message:G.message,inclusive:!0,exact:!1,maximum:G.value,type:"date"}),Q.dirty()}else e.assertNever(G);return{status:Q.value,value:new Date($.data.getTime())}}_addCheck($){return new B4({...this._def,checks:[...this._def.checks,$]})}min($,X){return this._addCheck({kind:"min",value:$.getTime(),message:C.toString(X)})}max($,X){return this._addCheck({kind:"max",value:$.getTime(),message:C.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}};B4.create=($)=>{return new B4({checks:[],coerce:($===null||$===void 0?void 0:$.coerce)||!1,typeName:N.ZodDate,...u($)})};f6=class f6 extends c{_parse($){if(this._getType($)!==E.symbol){let Q=this._getOrReturnCtx($);return F(Q,{code:U.invalid_type,expected:E.symbol,received:Q.parsedType}),T}return U$($.data)}};f6.create=($)=>{return new f6({typeName:N.ZodSymbol,...u($)})};l4=class l4 extends c{_parse($){if(this._getType($)!==E.undefined){let Q=this._getOrReturnCtx($);return F(Q,{code:U.invalid_type,expected:E.undefined,received:Q.parsedType}),T}return U$($.data)}};l4.create=($)=>{return new l4({typeName:N.ZodUndefined,...u($)})};c4=class c4 extends c{_parse($){if(this._getType($)!==E.null){let Q=this._getOrReturnCtx($);return F(Q,{code:U.invalid_type,expected:E.null,received:Q.parsedType}),T}return U$($.data)}};c4.create=($)=>{return new c4({typeName:N.ZodNull,...u($)})};D4=class D4 extends c{constructor(){super(...arguments);this._any=!0}_parse($){return U$($.data)}};D4.create=($)=>{return new D4({typeName:N.ZodAny,...u($)})};m0=class m0 extends c{constructor(){super(...arguments);this._unknown=!0}_parse($){return U$($.data)}};m0.create=($)=>{return new m0({typeName:N.ZodUnknown,...u($)})};M0=class M0 extends c{_parse($){let X=this._getOrReturnCtx($);return F(X,{code:U.invalid_type,expected:E.never,received:X.parsedType}),T}};M0.create=($)=>{return new M0({typeName:N.ZodNever,...u($)})};g6=class g6 extends c{_parse($){if(this._getType($)!==E.undefined){let Q=this._getOrReturnCtx($);return F(Q,{code:U.invalid_type,expected:E.void,received:Q.parsedType}),T}return U$($.data)}};g6.create=($)=>{return new g6({typeName:N.ZodVoid,...u($)})};u$=class u$ extends c{_parse($){let{ctx:X,status:Q}=this._processInputParams($),J=this._def;if(X.parsedType!==E.array)return F(X,{code:U.invalid_type,expected:E.array,received:X.parsedType}),T;if(J.exactLength!==null){let H=X.data.length>J.exactLength.value,M=X.data.length<J.exactLength.value;if(H||M)F(X,{code:H?U.too_big:U.too_small,minimum:M?J.exactLength.value:void 0,maximum:H?J.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:J.exactLength.message}),Q.dirty()}if(J.minLength!==null){if(X.data.length<J.minLength.value)F(X,{code:U.too_small,minimum:J.minLength.value,type:"array",inclusive:!0,exact:!1,message:J.minLength.message}),Q.dirty()}if(J.maxLength!==null){if(X.data.length>J.maxLength.value)F(X,{code:U.too_big,maximum:J.maxLength.value,type:"array",inclusive:!0,exact:!1,message:J.maxLength.message}),Q.dirty()}if(X.common.async)return Promise.all([...X.data].map((H,M)=>{return J.type._parseAsync(new p$(X,H,X.path,M))})).then((H)=>{return _$.mergeArray(Q,H)});let G=[...X.data].map((H,M)=>{return J.type._parseSync(new p$(X,H,X.path,M))});return _$.mergeArray(Q,G)}get element(){return this._def.type}min($,X){return new u$({...this._def,minLength:{value:$,message:C.toString(X)}})}max($,X){return new u$({...this._def,maxLength:{value:$,message:C.toString(X)}})}length($,X){return new u$({...this._def,exactLength:{value:$,message:C.toString(X)}})}nonempty($){return this.min(1,$)}};u$.create=($,X)=>{return new u$({type:$,minLength:null,maxLength:null,exactLength:null,typeName:N.ZodArray,...u(X)})};Y$=class Y$ extends c{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=e.objectKeys($);return this._cached={shape:$,keys:X}}_parse($){if(this._getType($)!==E.object){let D=this._getOrReturnCtx($);return F(D,{code:U.invalid_type,expected:E.object,received:D.parsedType}),T}let{status:Q,ctx:J}=this._processInputParams($),{shape:G,keys:H}=this._getCached(),M=[];if(!(this._def.catchall instanceof M0&&this._def.unknownKeys==="strip")){for(let D in J.data)if(!H.includes(D))M.push(D)}let z=[];for(let D of H){let O=G[D],_=J.data[D];z.push({key:{status:"valid",value:D},value:O._parse(new p$(J,_,J.path,D)),alwaysSet:D in J.data})}if(this._def.catchall instanceof M0){let D=this._def.unknownKeys;if(D==="passthrough")for(let O of M)z.push({key:{status:"valid",value:O},value:{status:"valid",value:J.data[O]}});else if(D==="strict"){if(M.length>0)F(J,{code:U.unrecognized_keys,keys:M}),Q.dirty()}else if(D==="strip");else throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let D=this._def.catchall;for(let O of M){let _=J.data[O];z.push({key:{status:"valid",value:O},value:D._parse(new p$(J,_,J.path,O)),alwaysSet:O in J.data})}}if(J.common.async)return Promise.resolve().then(async()=>{let D=[];for(let O of z){let _=await O.key,m=await O.value;D.push({key:_,value:m,alwaysSet:O.alwaysSet})}return D}).then((D)=>{return _$.mergeObjectSync(Q,D)});else return _$.mergeObjectSync(Q,z)}get shape(){return this._def.shape()}strict($){return C.errToObj,new Y$({...this._def,unknownKeys:"strict",...$!==void 0?{errorMap:(X,Q)=>{var J,G,H,M;let z=(H=(G=(J=this._def).errorMap)===null||G===void 0?void 0:G.call(J,X,Q).message)!==null&&H!==void 0?H:Q.defaultError;if(X.code==="unrecognized_keys")return{message:(M=C.errToObj($).message)!==null&&M!==void 0?M:z};return{message:z}}}:{}})}strip(){return new Y$({...this._def,unknownKeys:"strip"})}passthrough(){return new Y$({...this._def,unknownKeys:"passthrough"})}extend($){return new Y$({...this._def,shape:()=>({...this._def.shape(),...$})})}merge($){return new Y$({unknownKeys:$._def.unknownKeys,catchall:$._def.catchall,shape:()=>({...this._def.shape(),...$._def.shape()}),typeName:N.ZodObject})}setKey($,X){return this.augment({[$]:X})}catchall($){return new Y$({...this._def,catchall:$})}pick($){let X={};return e.objectKeys($).forEach((Q)=>{if($[Q]&&this.shape[Q])X[Q]=this.shape[Q]}),new Y$({...this._def,shape:()=>X})}omit($){let X={};return e.objectKeys(this.shape).forEach((Q)=>{if(!$[Q])X[Q]=this.shape[Q]}),new Y$({...this._def,shape:()=>X})}deepPartial(){return x4(this)}partial($){let X={};return e.objectKeys(this.shape).forEach((Q)=>{let J=this.shape[Q];if($&&!$[Q])X[Q]=J;else X[Q]=J.optional()}),new Y$({...this._def,shape:()=>X})}required($){let X={};return e.objectKeys(this.shape).forEach((Q)=>{if($&&!$[Q])X[Q]=this.shape[Q];else{let G=this.shape[Q];while(G instanceof k$)G=G._def.innerType;X[Q]=G}}),new Y$({...this._def,shape:()=>X})}keyof(){return k3(e.objectKeys(this.shape))}};Y$.create=($,X)=>{return new Y$({shape:()=>$,unknownKeys:"strip",catchall:M0.create(),typeName:N.ZodObject,...u(X)})};Y$.strictCreate=($,X)=>{return new Y$({shape:()=>$,unknownKeys:"strict",catchall:M0.create(),typeName:N.ZodObject,...u(X)})};Y$.lazycreate=($,X)=>{return new Y$({shape:$,unknownKeys:"strip",catchall:M0.create(),typeName:N.ZodObject,...u(X)})};u4=class u4 extends c{_parse($){let{ctx:X}=this._processInputParams($),Q=this._def.options;function J(G){for(let M of G)if(M.result.status==="valid")return M.result;for(let M of G)if(M.result.status==="dirty")return X.common.issues.push(...M.ctx.common.issues),M.result;let H=G.map((M)=>new C$(M.ctx.common.issues));return F(X,{code:U.invalid_union,unionErrors:H}),T}if(X.common.async)return Promise.all(Q.map(async(G)=>{let H={...X,common:{...X.common,issues:[]},parent:null};return{result:await G._parseAsync({data:X.data,path:X.path,parent:H}),ctx:H}})).then(J);else{let G=void 0,H=[];for(let z of Q){let D={...X,common:{...X.common,issues:[]},parent:null},O=z._parseSync({data:X.data,path:X.path,parent:D});if(O.status==="valid")return O;else if(O.status==="dirty"&&!G)G={result:O,ctx:D};if(D.common.issues.length)H.push(D.common.issues)}if(G)return X.common.issues.push(...G.ctx.common.issues),G.result;let M=H.map((z)=>new C$(z));return F(X,{code:U.invalid_union,unionErrors:M}),T}}get options(){return this._def.options}};u4.create=($,X)=>{return new u4({options:$,typeName:N.ZodUnion,...u(X)})};yX=class yX extends c{_parse($){let{ctx:X}=this._processInputParams($);if(X.parsedType!==E.object)return F(X,{code:U.invalid_type,expected:E.object,received:X.parsedType}),T;let Q=this.discriminator,J=X.data[Q],G=this.optionsMap.get(J);if(!G)return F(X,{code:U.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[Q]}),T;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 J=new Map;for(let G of X){let H=E0(G.shape[$]);if(!H.length)throw new Error(`A discriminator value for key \`${$}\` could not be extracted from all schema options`);for(let M of H){if(J.has(M))throw new Error(`Discriminator property ${String($)} has duplicate value ${String(M)}`);J.set(M,G)}}return new yX({typeName:N.ZodDiscriminatedUnion,discriminator:$,options:X,optionsMap:J,...u(Q)})}};p4=class p4 extends c{_parse($){let{status:X,ctx:Q}=this._processInputParams($),J=(G,H)=>{if(L2(G)||L2(H))return T;let M=F2(G.value,H.value);if(!M.valid)return F(Q,{code:U.invalid_intersection_types}),T;if(S2(G)||S2(H))X.dirty();return{status:X.value,value:M.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,H])=>J(G,H));else return J(this._def.left._parseSync({data:Q.data,path:Q.path,parent:Q}),this._def.right._parseSync({data:Q.data,path:Q.path,parent:Q}))}};p4.create=($,X,Q)=>{return new p4({left:$,right:X,typeName:N.ZodIntersection,...u(Q)})};w0=class w0 extends c{_parse($){let{status:X,ctx:Q}=this._processInputParams($);if(Q.parsedType!==E.array)return F(Q,{code:U.invalid_type,expected:E.array,received:Q.parsedType}),T;if(Q.data.length<this._def.items.length)return F(Q,{code:U.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),T;if(!this._def.rest&&Q.data.length>this._def.items.length)F(Q,{code:U.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),X.dirty();let G=[...Q.data].map((H,M)=>{let z=this._def.items[M]||this._def.rest;if(!z)return null;return z._parse(new p$(Q,H,Q.path,M))}).filter((H)=>!!H);if(Q.common.async)return Promise.all(G).then((H)=>{return _$.mergeArray(X,H)});else return _$.mergeArray(X,G)}get items(){return this._def.items}rest($){return new w0({...this._def,rest:$})}};w0.create=($,X)=>{if(!Array.isArray($))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new w0({items:$,typeName:N.ZodTuple,rest:null,...u(X)})};T6=class T6 extends c{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse($){let{status:X,ctx:Q}=this._processInputParams($);if(Q.parsedType!==E.object)return F(Q,{code:U.invalid_type,expected:E.object,received:Q.parsedType}),T;let J=[],G=this._def.keyType,H=this._def.valueType;for(let M in Q.data)J.push({key:G._parse(new p$(Q,M,Q.path,M)),value:H._parse(new p$(Q,Q.data[M],Q.path,M)),alwaysSet:M in Q.data});if(Q.common.async)return _$.mergeObjectAsync(X,J);else return _$.mergeObjectSync(X,J)}get element(){return this._def.valueType}static create($,X,Q){if(X instanceof c)return new T6({keyType:$,valueType:X,typeName:N.ZodRecord,...u(Q)});return new T6({keyType:c$.create(),valueType:$,typeName:N.ZodRecord,...u(X)})}};x6=class x6 extends c{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse($){let{status:X,ctx:Q}=this._processInputParams($);if(Q.parsedType!==E.map)return F(Q,{code:U.invalid_type,expected:E.map,received:Q.parsedType}),T;let J=this._def.keyType,G=this._def.valueType,H=[...Q.data.entries()].map(([M,z],D)=>{return{key:J._parse(new p$(Q,M,Q.path,[D,"key"])),value:G._parse(new p$(Q,z,Q.path,[D,"value"]))}});if(Q.common.async){let M=new Map;return Promise.resolve().then(async()=>{for(let z of H){let D=await z.key,O=await z.value;if(D.status==="aborted"||O.status==="aborted")return T;if(D.status==="dirty"||O.status==="dirty")X.dirty();M.set(D.value,O.value)}return{status:X.value,value:M}})}else{let M=new Map;for(let z of H){let{key:D,value:O}=z;if(D.status==="aborted"||O.status==="aborted")return T;if(D.status==="dirty"||O.status==="dirty")X.dirty();M.set(D.value,O.value)}return{status:X.value,value:M}}}};x6.create=($,X,Q)=>{return new x6({valueType:X,keyType:$,typeName:N.ZodMap,...u(Q)})};V4=class V4 extends c{_parse($){let{status:X,ctx:Q}=this._processInputParams($);if(Q.parsedType!==E.set)return F(Q,{code:U.invalid_type,expected:E.set,received:Q.parsedType}),T;let J=this._def;if(J.minSize!==null){if(Q.data.size<J.minSize.value)F(Q,{code:U.too_small,minimum:J.minSize.value,type:"set",inclusive:!0,exact:!1,message:J.minSize.message}),X.dirty()}if(J.maxSize!==null){if(Q.data.size>J.maxSize.value)F(Q,{code:U.too_big,maximum:J.maxSize.value,type:"set",inclusive:!0,exact:!1,message:J.maxSize.message}),X.dirty()}let G=this._def.valueType;function H(z){let D=new Set;for(let O of z){if(O.status==="aborted")return T;if(O.status==="dirty")X.dirty();D.add(O.value)}return{status:X.value,value:D}}let M=[...Q.data.values()].map((z,D)=>G._parse(new p$(Q,z,Q.path,D)));if(Q.common.async)return Promise.all(M).then((z)=>H(z));else return H(M)}min($,X){return new V4({...this._def,minSize:{value:$,message:C.toString(X)}})}max($,X){return new V4({...this._def,maxSize:{value:$,message:C.toString(X)}})}size($,X){return this.min($,X).max($,X)}nonempty($){return this.min(1,$)}};V4.create=($,X)=>{return new V4({valueType:$,minSize:null,maxSize:null,typeName:N.ZodSet,...u(X)})};y4=class y4 extends c{constructor(){super(...arguments);this.validate=this.implement}_parse($){let{ctx:X}=this._processInputParams($);if(X.parsedType!==E.function)return F(X,{code:U.invalid_type,expected:E.function,received:X.parsedType}),T;function Q(M,z){return xX({data:M,path:X.path,errorMaps:[X.common.contextualErrorMap,X.schemaErrorMap,TX(),Z4].filter((D)=>!!D),issueData:{code:U.invalid_arguments,argumentsError:z}})}function J(M,z){return xX({data:M,path:X.path,errorMaps:[X.common.contextualErrorMap,X.schemaErrorMap,TX(),Z4].filter((D)=>!!D),issueData:{code:U.invalid_return_type,returnTypeError:z}})}let G={errorMap:X.common.contextualErrorMap},H=X.data;if(this._def.returns instanceof O4){let M=this;return U$(async function(...z){let D=new C$([]),O=await M._def.args.parseAsync(z,G).catch((x)=>{throw D.addIssue(Q(z,x)),D}),_=await Reflect.apply(H,this,O);return await M._def.returns._def.type.parseAsync(_,G).catch((x)=>{throw D.addIssue(J(_,x)),D})})}else{let M=this;return U$(function(...z){let D=M._def.args.safeParse(z,G);if(!D.success)throw new C$([Q(z,D.error)]);let O=Reflect.apply(H,this,D.data),_=M._def.returns.safeParse(O,G);if(!_.success)throw new C$([J(O,_.error)]);return _.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...$){return new y4({...this._def,args:w0.create($).rest(m0.create())})}returns($){return new y4({...this._def,returns:$})}implement($){return this.parse($)}strictImplement($){return this.parse($)}static create($,X,Q){return new y4({args:$?$:w0.create([]).rest(m0.create()),returns:X||m0.create(),typeName:N.ZodFunction,...u(Q)})}};n4=class n4 extends c{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})}};n4.create=($,X)=>{return new n4({getter:$,typeName:N.ZodLazy,...u(X)})};i4=class i4 extends c{_parse($){if($.data!==this._def.value){let X=this._getOrReturnCtx($);return F(X,{received:X.data,code:U.invalid_literal,expected:this._def.value}),T}return{status:"valid",value:$.data}}get value(){return this._def.value}};i4.create=($,X)=>{return new i4({value:$,typeName:N.ZodLiteral,...u(X)})};u0=class u0 extends c{constructor(){super(...arguments);I6.set(this,void 0)}_parse($){if(typeof $.data!=="string"){let X=this._getOrReturnCtx($),Q=this._def.values;return F(X,{expected:e.joinValues(Q),received:X.parsedType,code:U.invalid_type}),T}if(!hX(this,I6,"f"))E3(this,I6,new Set(this._def.values),"f");if(!hX(this,I6,"f").has($.data)){let X=this._getOrReturnCtx($),Q=this._def.values;return F(X,{received:X.data,code:U.invalid_enum_value,options:Q}),T}return U$($.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 u0.create($,{...this._def,...X})}exclude($,X=this._def){return u0.create(this.options.filter((Q)=>!$.includes(Q)),{...this._def,...X})}};I6=new WeakMap;u0.create=k3;d4=class d4 extends c{constructor(){super(...arguments);b6.set(this,void 0)}_parse($){let X=e.getValidEnumValues(this._def.values),Q=this._getOrReturnCtx($);if(Q.parsedType!==E.string&&Q.parsedType!==E.number){let J=e.objectValues(X);return F(Q,{expected:e.joinValues(J),received:Q.parsedType,code:U.invalid_type}),T}if(!hX(this,b6,"f"))E3(this,b6,new Set(e.getValidEnumValues(this._def.values)),"f");if(!hX(this,b6,"f").has($.data)){let J=e.objectValues(X);return F(Q,{received:Q.data,code:U.invalid_enum_value,options:J}),T}return U$($.data)}get enum(){return this._def.values}};b6=new WeakMap;d4.create=($,X)=>{return new d4({values:$,typeName:N.ZodNativeEnum,...u(X)})};O4=class O4 extends c{unwrap(){return this._def.type}_parse($){let{ctx:X}=this._processInputParams($);if(X.parsedType!==E.promise&&X.common.async===!1)return F(X,{code:U.invalid_type,expected:E.promise,received:X.parsedType}),T;let Q=X.parsedType===E.promise?X.data:Promise.resolve(X.data);return U$(Q.then((J)=>{return this._def.type.parseAsync(J,{path:X.path,errorMap:X.common.contextualErrorMap})}))}};O4.create=($,X)=>{return new O4({type:$,typeName:N.ZodPromise,...u(X)})};h$=class h$ extends c{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===N.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse($){let{status:X,ctx:Q}=this._processInputParams($),J=this._def.effect||null,G={addIssue:(H)=>{if(F(Q,H),H.fatal)X.abort();else X.dirty()},get path(){return Q.path}};if(G.addIssue=G.addIssue.bind(G),J.type==="preprocess"){let H=J.transform(Q.data,G);if(Q.common.async)return Promise.resolve(H).then(async(M)=>{if(X.value==="aborted")return T;let z=await this._def.schema._parseAsync({data:M,path:Q.path,parent:Q});if(z.status==="aborted")return T;if(z.status==="dirty")return h4(z.value);if(X.value==="dirty")return h4(z.value);return z});else{if(X.value==="aborted")return T;let M=this._def.schema._parseSync({data:H,path:Q.path,parent:Q});if(M.status==="aborted")return T;if(M.status==="dirty")return h4(M.value);if(X.value==="dirty")return h4(M.value);return M}}if(J.type==="refinement"){let H=(M)=>{let z=J.refinement(M,G);if(Q.common.async)return Promise.resolve(z);if(z instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return M};if(Q.common.async===!1){let M=this._def.schema._parseSync({data:Q.data,path:Q.path,parent:Q});if(M.status==="aborted")return T;if(M.status==="dirty")X.dirty();return H(M.value),{status:X.value,value:M.value}}else return this._def.schema._parseAsync({data:Q.data,path:Q.path,parent:Q}).then((M)=>{if(M.status==="aborted")return T;if(M.status==="dirty")X.dirty();return H(M.value).then(()=>{return{status:X.value,value:M.value}})})}if(J.type==="transform")if(Q.common.async===!1){let H=this._def.schema._parseSync({data:Q.data,path:Q.path,parent:Q});if(!z4(H))return H;let M=J.transform(H.value,G);if(M instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:X.value,value:M}}else return this._def.schema._parseAsync({data:Q.data,path:Q.path,parent:Q}).then((H)=>{if(!z4(H))return H;return Promise.resolve(J.transform(H.value,G)).then((M)=>({status:X.value,value:M}))});e.assertNever(J)}};h$.create=($,X,Q)=>{return new h$({schema:$,typeName:N.ZodEffects,effect:X,...u(Q)})};h$.createWithPreprocess=($,X,Q)=>{return new h$({schema:X,effect:{type:"preprocess",transform:$},typeName:N.ZodEffects,...u(Q)})};k$=class k$ extends c{_parse($){if(this._getType($)===E.undefined)return U$(void 0);return this._def.innerType._parse($)}unwrap(){return this._def.innerType}};k$.create=($,X)=>{return new k$({innerType:$,typeName:N.ZodOptional,...u(X)})};v0=class v0 extends c{_parse($){if(this._getType($)===E.null)return U$(null);return this._def.innerType._parse($)}unwrap(){return this._def.innerType}};v0.create=($,X)=>{return new v0({innerType:$,typeName:N.ZodNullable,...u(X)})};o4=class o4 extends c{_parse($){let{ctx:X}=this._processInputParams($),Q=X.data;if(X.parsedType===E.undefined)Q=this._def.defaultValue();return this._def.innerType._parse({data:Q,path:X.path,parent:X})}removeDefault(){return this._def.innerType}};o4.create=($,X)=>{return new o4({innerType:$,typeName:N.ZodDefault,defaultValue:typeof X.default==="function"?X.default:()=>X.default,...u(X)})};r4=class r4 extends c{_parse($){let{ctx:X}=this._processInputParams($),Q={...X,common:{...X.common,issues:[]}},J=this._def.innerType._parse({data:Q.data,path:Q.path,parent:{...Q}});if(P6(J))return J.then((G)=>{return{status:"valid",value:G.status==="valid"?G.value:this._def.catchValue({get error(){return new C$(Q.common.issues)},input:Q.data})}});else return{status:"valid",value:J.status==="valid"?J.value:this._def.catchValue({get error(){return new C$(Q.common.issues)},input:Q.data})}}removeCatch(){return this._def.innerType}};r4.create=($,X)=>{return new r4({innerType:$,typeName:N.ZodCatch,catchValue:typeof X.catch==="function"?X.catch:()=>X.catch,...u(X)})};h6=class h6 extends c{_parse($){if(this._getType($)!==E.nan){let Q=this._getOrReturnCtx($);return F(Q,{code:U.invalid_type,expected:E.nan,received:Q.parsedType}),T}return{status:"valid",value:$.data}}};h6.create=($)=>{return new h6({typeName:N.ZodNaN,...u($)})};U5=Symbol("zod_brand");ZX=class ZX extends c{_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}};y6=class y6 extends c{_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 T;if(G.status==="dirty")return X.dirty(),h4(G.value);else return this._def.out._parseAsync({data:G.value,path:Q.path,parent:Q})})();else{let J=this._def.in._parseSync({data:Q.data,path:Q.path,parent:Q});if(J.status==="aborted")return T;if(J.status==="dirty")return X.dirty(),{status:"dirty",value:J.value};else return this._def.out._parseSync({data:J.value,path:Q.path,parent:Q})}}static create($,X){return new y6({in:$,out:X,typeName:N.ZodPipeline})}};a4=class a4 extends c{_parse($){let X=this._def.innerType._parse($),Q=(J)=>{if(z4(J))J.value=Object.freeze(J.value);return J};return P6(X)?X.then((J)=>Q(J)):Q(X)}unwrap(){return this._def.innerType}};a4.create=($,X)=>{return new a4({innerType:$,typeName:N.ZodReadonly,...u(X)})};N5={object:Y$.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"})(N||(N={}));b3=c$.create,P3=l0.create,S5=h6.create,F5=c0.create,f3=m4.create,E5=B4.create,R5=f6.create,v5=l4.create,C5=c4.create,k5=D4.create,I5=m0.create,b5=M0.create,P5=g6.create,f5=u$.create,g5=Y$.create,T5=Y$.strictCreate,x5=u4.create,h5=yX.create,y5=p4.create,Z5=w0.create,m5=T6.create,l5=x6.create,c5=V4.create,u5=y4.create,p5=n4.create,n5=i4.create,i5=u0.create,d5=d4.create,o5=O4.create,S3=h$.create,r5=k$.create,a5=v0.create,t5=h$.createWithPreprocess,s5=y6.create,Q9={string:($)=>c$.create({...$,coerce:!0}),number:($)=>l0.create({...$,coerce:!0}),boolean:($)=>m4.create({...$,coerce:!0}),bigint:($)=>c0.create({...$,coerce:!0}),date:($)=>B4.create({...$,coerce:!0})},W9=T,B=Object.freeze({__proto__:null,defaultErrorMap:Z4,setErrorMap:tJ,getErrorMap:TX,makeIssue:xX,EMPTY_PATH:sJ,addIssueToContext:F,ParseStatus:_$,INVALID:T,DIRTY:h4,OK:U$,isAborted:L2,isDirty:S2,isValid:z4,isAsync:P6,get util(){return e},get objectUtil(){return N2},ZodParsedType:E,getParsedType:R0,ZodType:c,datetimeRegex:C3,ZodString:c$,ZodNumber:l0,ZodBigInt:c0,ZodBoolean:m4,ZodDate:B4,ZodSymbol:f6,ZodUndefined:l4,ZodNull:c4,ZodAny:D4,ZodUnknown:m0,ZodNever:M0,ZodVoid:g6,ZodArray:u$,ZodObject:Y$,ZodUnion:u4,ZodDiscriminatedUnion:yX,ZodIntersection:p4,ZodTuple:w0,ZodRecord:T6,ZodMap:x6,ZodSet:V4,ZodFunction:y4,ZodLazy:n4,ZodLiteral:i4,ZodEnum:u0,ZodNativeEnum:d4,ZodPromise:O4,ZodEffects:h$,ZodTransformer:h$,ZodOptional:k$,ZodNullable:v0,ZodDefault:o4,ZodCatch:r4,ZodNaN:h6,BRAND:U5,ZodBranded:ZX,ZodPipeline:y6,ZodReadonly:a4,custom:I3,Schema:c,ZodSchema:c,late:N5,get ZodFirstPartyTypeKind(){return N},coerce:Q9,any:k5,array:f5,bigint:F5,boolean:f3,date:E5,discriminatedUnion:h5,effect:S3,enum:i5,function:u5,instanceof:L5,intersection:y5,lazy:p5,literal:n5,map:l5,nan:S5,nativeEnum:d5,never:b5,null:C5,nullable:a5,number:P3,object:g5,oboolean:X9,onumber:$9,optional:r5,ostring:e5,pipeline:s5,preprocess:t5,promise:o5,record:m5,set:c5,strictObject:T5,string:b3,symbol:R5,transformer:S3,tuple:Z5,undefined:v5,union:x5,unknown:I5,void:P5,NEVER:W9,ZodIssueCode:U,quotelessJson:aJ,ZodError:C$})});var E2="2025-03-26",g3,mX="2.0",T3,x3,J9,n$,I$,Z6,z0,i$,lX,h3,y3=($)=>h3.safeParse($).success,Z3,m3=($)=>Z3.safeParse($).success,l3,R2=($)=>l3.safeParse($).success,H$,c3,u3=($)=>c3.safeParse($).success,p3,cX,uX,n3,G9,pX,pY=($)=>pX.safeParse($).success,Y9,H9,v2,nX,M9,iX,dX,oX,i3,d3,o3,w9,z9,rX,B9,aX,D9,tX,V9,O9,q9,_9,A9,j9,K9,sX,U9,eX,$1,X1,Q1,r3,N9,L9,S9,F9,E9,W1,R9,a3,nY,J1,v9,t3,C9,k9,I9,b9,P9,f9,C2,g9,T9,G1,x9,h9,y9,k2,Z9,iY,dY,oY,rY,aY,tY,w$;var m6=z$(()=>{p0();g3=[E2,"2024-11-05","2024-10-07"],T3=B.union([B.string(),B.number().int()]),x3=B.string(),J9=B.object({progressToken:B.optional(T3)}).passthrough(),n$=B.object({_meta:B.optional(J9)}).passthrough(),I$=B.object({method:B.string(),params:B.optional(n$)}),Z6=B.object({_meta:B.optional(B.object({}).passthrough())}).passthrough(),z0=B.object({method:B.string(),params:B.optional(Z6)}),i$=B.object({_meta:B.optional(B.object({}).passthrough())}).passthrough(),lX=B.union([B.string(),B.number().int()]),h3=B.object({jsonrpc:B.literal(mX),id:lX}).merge(I$).strict(),Z3=B.object({jsonrpc:B.literal(mX)}).merge(z0).strict(),l3=B.object({jsonrpc:B.literal(mX),id:lX,result:i$}).strict();(function($){$[$.ConnectionClosed=-32000]="ConnectionClosed",$[$.RequestTimeout=-32001]="RequestTimeout",$[$.ParseError=-32700]="ParseError",$[$.InvalidRequest=-32600]="InvalidRequest",$[$.MethodNotFound=-32601]="MethodNotFound",$[$.InvalidParams=-32602]="InvalidParams",$[$.InternalError=-32603]="InternalError"})(H$||(H$={}));c3=B.object({jsonrpc:B.literal(mX),id:lX,error:B.object({code:B.number().int(),message:B.string(),data:B.optional(B.unknown())})}).strict(),p3=B.union([h3,Z3,l3,c3]),cX=i$.strict(),uX=z0.extend({method:B.literal("notifications/cancelled"),params:Z6.extend({requestId:lX,reason:B.string().optional()})}),n3=B.object({name:B.string(),version:B.string()}).passthrough(),G9=B.object({experimental:B.optional(B.object({}).passthrough()),sampling:B.optional(B.object({}).passthrough()),roots:B.optional(B.object({listChanged:B.optional(B.boolean())}).passthrough())}).passthrough(),pX=I$.extend({method:B.literal("initialize"),params:n$.extend({protocolVersion:B.string(),capabilities:G9,clientInfo:n3})}),Y9=B.object({experimental:B.optional(B.object({}).passthrough()),logging:B.optional(B.object({}).passthrough()),completions:B.optional(B.object({}).passthrough()),prompts:B.optional(B.object({listChanged:B.optional(B.boolean())}).passthrough()),resources:B.optional(B.object({subscribe:B.optional(B.boolean()),listChanged:B.optional(B.boolean())}).passthrough()),tools:B.optional(B.object({listChanged:B.optional(B.boolean())}).passthrough())}).passthrough(),H9=i$.extend({protocolVersion:B.string(),capabilities:Y9,serverInfo:n3,instructions:B.optional(B.string())}),v2=z0.extend({method:B.literal("notifications/initialized")}),nX=I$.extend({method:B.literal("ping")}),M9=B.object({progress:B.number(),total:B.optional(B.number()),message:B.optional(B.string())}).passthrough(),iX=z0.extend({method:B.literal("notifications/progress"),params:Z6.merge(M9).extend({progressToken:T3})}),dX=I$.extend({params:n$.extend({cursor:B.optional(x3)}).optional()}),oX=i$.extend({nextCursor:B.optional(x3)}),i3=B.object({uri:B.string(),mimeType:B.optional(B.string())}).passthrough(),d3=i3.extend({text:B.string()}),o3=i3.extend({blob:B.string().base64()}),w9=B.object({uri:B.string(),name:B.string(),description:B.optional(B.string()),mimeType:B.optional(B.string())}).passthrough(),z9=B.object({uriTemplate:B.string(),name:B.string(),description:B.optional(B.string()),mimeType:B.optional(B.string())}).passthrough(),rX=dX.extend({method:B.literal("resources/list")}),B9=oX.extend({resources:B.array(w9)}),aX=dX.extend({method:B.literal("resources/templates/list")}),D9=oX.extend({resourceTemplates:B.array(z9)}),tX=I$.extend({method:B.literal("resources/read"),params:n$.extend({uri:B.string()})}),V9=i$.extend({contents:B.array(B.union([d3,o3]))}),O9=z0.extend({method:B.literal("notifications/resources/list_changed")}),q9=I$.extend({method:B.literal("resources/subscribe"),params:n$.extend({uri:B.string()})}),_9=I$.extend({method:B.literal("resources/unsubscribe"),params:n$.extend({uri:B.string()})}),A9=z0.extend({method:B.literal("notifications/resources/updated"),params:Z6.extend({uri:B.string()})}),j9=B.object({name:B.string(),description:B.optional(B.string()),required:B.optional(B.boolean())}).passthrough(),K9=B.object({name:B.string(),description:B.optional(B.string()),arguments:B.optional(B.array(j9))}).passthrough(),sX=dX.extend({method:B.literal("prompts/list")}),U9=oX.extend({prompts:B.array(K9)}),eX=I$.extend({method:B.literal("prompts/get"),params:n$.extend({name:B.string(),arguments:B.optional(B.record(B.string()))})}),$1=B.object({type:B.literal("text"),text:B.string()}).passthrough(),X1=B.object({type:B.literal("image"),data:B.string().base64(),mimeType:B.string()}).passthrough(),Q1=B.object({type:B.literal("audio"),data:B.string().base64(),mimeType:B.string()}).passthrough(),r3=B.object({type:B.literal("resource"),resource:B.union([d3,o3])}).passthrough(),N9=B.object({role:B.enum(["user","assistant"]),content:B.union([$1,X1,Q1,r3])}).passthrough(),L9=i$.extend({description:B.optional(B.string()),messages:B.array(N9)}),S9=z0.extend({method:B.literal("notifications/prompts/list_changed")}),F9=B.object({title:B.optional(B.string()),readOnlyHint:B.optional(B.boolean()),destructiveHint:B.optional(B.boolean()),idempotentHint:B.optional(B.boolean()),openWorldHint:B.optional(B.boolean())}).passthrough(),E9=B.object({name:B.string(),description:B.optional(B.string()),inputSchema:B.object({type:B.literal("object"),properties:B.optional(B.object({}).passthrough()),required:B.optional(B.array(B.string()))}).passthrough(),outputSchema:B.optional(B.object({type:B.literal("object"),properties:B.optional(B.object({}).passthrough()),required:B.optional(B.array(B.string()))}).passthrough()),annotations:B.optional(F9)}).passthrough(),W1=dX.extend({method:B.literal("tools/list")}),R9=oX.extend({tools:B.array(E9)}),a3=i$.extend({content:B.array(B.union([$1,X1,Q1,r3])).default([]),structuredContent:B.object({}).passthrough().optional(),isError:B.optional(B.boolean())}),nY=a3.or(i$.extend({toolResult:B.unknown()})),J1=I$.extend({method:B.literal("tools/call"),params:n$.extend({name:B.string(),arguments:B.optional(B.record(B.unknown()))})}),v9=z0.extend({method:B.literal("notifications/tools/list_changed")}),t3=B.enum(["debug","info","notice","warning","error","critical","alert","emergency"]),C9=I$.extend({method:B.literal("logging/setLevel"),params:n$.extend({level:t3})}),k9=z0.extend({method:B.literal("notifications/message"),params:Z6.extend({level:t3,logger:B.optional(B.string()),data:B.unknown()})}),I9=B.object({name:B.string().optional()}).passthrough(),b9=B.object({hints:B.optional(B.array(I9)),costPriority:B.optional(B.number().min(0).max(1)),speedPriority:B.optional(B.number().min(0).max(1)),intelligencePriority:B.optional(B.number().min(0).max(1))}).passthrough(),P9=B.object({role:B.enum(["user","assistant"]),content:B.union([$1,X1,Q1])}).passthrough(),f9=I$.extend({method:B.literal("sampling/createMessage"),params:n$.extend({messages:B.array(P9),systemPrompt:B.optional(B.string()),includeContext:B.optional(B.enum(["none","thisServer","allServers"])),temperature:B.optional(B.number()),maxTokens:B.number().int(),stopSequences:B.optional(B.array(B.string())),metadata:B.optional(B.object({}).passthrough()),modelPreferences:B.optional(b9)})}),C2=i$.extend({model:B.string(),stopReason:B.optional(B.enum(["endTurn","stopSequence","maxTokens"]).or(B.string())),role:B.enum(["user","assistant"]),content:B.discriminatedUnion("type",[$1,X1,Q1])}),g9=B.object({type:B.literal("ref/resource"),uri:B.string()}).passthrough(),T9=B.object({type:B.literal("ref/prompt"),name:B.string()}).passthrough(),G1=I$.extend({method:B.literal("completion/complete"),params:n$.extend({ref:B.union([T9,g9]),argument:B.object({name:B.string(),value:B.string()}).passthrough()})}),x9=i$.extend({completion:B.object({values:B.array(B.string()).max(100),total:B.optional(B.number().int()),hasMore:B.optional(B.boolean())}).passthrough()}),h9=B.object({uri:B.string().startsWith("file://"),name:B.optional(B.string())}).passthrough(),y9=I$.extend({method:B.literal("roots/list")}),k2=i$.extend({roots:B.array(h9)}),Z9=z0.extend({method:B.literal("notifications/roots/list_changed")}),iY=B.union([nX,pX,G1,C9,eX,sX,rX,aX,tX,q9,_9,J1,W1]),dY=B.union([uX,iX,v2,Z9]),oY=B.union([cX,C2,k2]),rY=B.union([nX,f9,y9]),aY=B.union([uX,iX,k9,A9,O9,v9,S9]),tY=B.union([cX,H9,x9,L9,U9,B9,D9,V9,a3,R9]);w$=class w$ extends Error{constructor($,X,Q){super(`MCP error ${$}: ${X}`);this.code=$,this.data=Q,this.name="McpError"}}});function $G(){let $=process.argv.join(" ");return $.includes("streamable-http.js")||$.includes("streamable-http.ts")}class xQ{context;level;constructor($,X=1){this.context=$,this.level=X}setLevel($){this.level=$}log(...$){if(TQ)console.log(...$);else console.error(...$)}logWarn(...$){if(TQ)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 TQ,y$=($,X=1)=>new xQ($,X);var q4=z$(()=>{TQ=$G()});function WG($){if(!/^data:/i.test($))throw new TypeError('`uri` does not appear to be a Data URI (must begin with "data:")');$=$.replace(/\r?\n/g,"");let X=$.indexOf(",");if(X===-1||X<=4)throw new TypeError("malformed data: URI");let Q=$.substring(5,X).split(";"),J="",G=!1,H=Q[0]||"text/plain",M=H;for(let _=1;_<Q.length;_++)if(Q[_]==="base64")G=!0;else if(Q[_]){if(M+=`;${Q[_]}`,Q[_].indexOf("charset=")===0)J=Q[_].substring(8)}if(!Q[0]&&!J.length)M+=";charset=US-ASCII",J="US-ASCII";let z=G?"base64":"ascii",D=unescape($.substring(X+1)),O=Buffer.from(D,z);return O.type=H,O.typeFull=M,O.charset=J,O}var lQ;var cQ=z$(()=>{lQ=WG});var pQ=j2((B1,uQ)=>{(function($,X){typeof B1==="object"&&typeof uQ!=="undefined"?X(B1):typeof define==="function"&&define.amd?define(["exports"],X):($=typeof globalThis!=="undefined"?globalThis:$||self,X($.WebStreamsPolyfill={}))})(B1,function($){function X(){return}function Q(W){return typeof W==="object"&&W!==null||typeof W==="function"}let J=X;function G(W,Y){try{Object.defineProperty(W,"name",{value:Y,configurable:!0})}catch(w){}}let H=Promise,M=Promise.prototype.then,z=Promise.reject.bind(H);function D(W){return new H(W)}function O(W){return D((Y)=>Y(W))}function _(W){return z(W)}function m(W,Y,w){return M.call(W,Y,w)}function x(W,Y,w){m(m(W,Y,w),void 0,J)}function h(W,Y){x(W,Y)}function k(W,Y){x(W,void 0,Y)}function X$(W,Y,w){return m(W,Y,w)}function s(W){m(W,void 0,J)}let Z=(W)=>{if(typeof queueMicrotask==="function")Z=queueMicrotask;else{let Y=O(void 0);Z=(w)=>m(Y,w)}return Z(W)};function G$(W,Y,w){if(typeof W!=="function")throw new TypeError("Argument is not a function");return Function.prototype.apply.call(W,Y,w)}function a(W,Y,w){try{return O(G$(W,Y,w))}catch(V){return _(V)}}let $$=16384;class n{constructor(){this._cursor=0,this._size=0,this._front={_elements:[],_next:void 0},this._back=this._front,this._cursor=0,this._size=0}get length(){return this._size}push(W){let Y=this._back,w=Y;if(Y._elements.length===$$-1)w={_elements:[],_next:void 0};if(Y._elements.push(W),w!==Y)this._back=w,Y._next=w;++this._size}shift(){let W=this._front,Y=W,w=this._cursor,V=w+1,q=W._elements,A=q[w];if(V===$$)Y=W._next,V=0;if(--this._size,this._cursor=V,W!==Y)this._front=Y;return q[w]=void 0,A}forEach(W){let Y=this._cursor,w=this._front,V=w._elements;while(Y!==V.length||w._next!==void 0){if(Y===V.length){if(w=w._next,V=w._elements,Y=0,V.length===0)break}W(V[Y]),++Y}}peek(){let W=this._front,Y=this._cursor;return W._elements[Y]}}let B$=Symbol("[[AbortSteps]]"),q6=Symbol("[[ErrorSteps]]"),_6=Symbol("[[CancelSteps]]"),I1=Symbol("[[PullSteps]]"),b1=Symbol("[[ReleaseSteps]]");function Y8(W,Y){if(W._ownerReadableStream=Y,Y._reader=W,Y._state==="readable")f1(W);else if(Y._state==="closed")QW(W);else H8(W,Y._storedError)}function P1(W,Y){let w=W._ownerReadableStream;return l$(w,Y)}function q0(W){let Y=W._ownerReadableStream;if(Y._state==="readable")g1(W,new TypeError("Reader was released and can no longer be used to monitor the stream's closedness"));else WW(W,new TypeError("Reader was released and can no longer be used to monitor the stream's closedness"));Y._readableStreamController[b1](),Y._reader=void 0,W._ownerReadableStream=void 0}function MX(W){return new TypeError("Cannot "+W+" a stream using a released reader")}function f1(W){W._closedPromise=D((Y,w)=>{W._closedPromise_resolve=Y,W._closedPromise_reject=w})}function H8(W,Y){f1(W),g1(W,Y)}function QW(W){f1(W),M8(W)}function g1(W,Y){if(W._closedPromise_reject===void 0)return;s(W._closedPromise),W._closedPromise_reject(Y),W._closedPromise_resolve=void 0,W._closedPromise_reject=void 0}function WW(W,Y){H8(W,Y)}function M8(W){if(W._closedPromise_resolve===void 0)return;W._closedPromise_resolve(void 0),W._closedPromise_resolve=void 0,W._closedPromise_reject=void 0}let w8=Number.isFinite||function(W){return typeof W==="number"&&isFinite(W)},JW=Math.trunc||function(W){return W<0?Math.ceil(W):Math.floor(W)};function GW(W){return typeof W==="object"||typeof W==="function"}function W0(W,Y){if(W!==void 0&&!GW(W))throw new TypeError(`${Y} is not an object.`)}function f$(W,Y){if(typeof W!=="function")throw new TypeError(`${Y} is not a function.`)}function YW(W){return typeof W==="object"&&W!==null||typeof W==="function"}function z8(W,Y){if(!YW(W))throw new TypeError(`${Y} is not an object.`)}function _0(W,Y,w){if(W===void 0)throw new TypeError(`Parameter ${Y} is required in '${w}'.`)}function T1(W,Y,w){if(W===void 0)throw new TypeError(`${Y} is required in '${w}'.`)}function x1(W){return Number(W)}function B8(W){return W===0?0:W}function HW(W){return B8(JW(W))}function h1(W,Y){let V=Number.MAX_SAFE_INTEGER,q=Number(W);if(q=B8(q),!w8(q))throw new TypeError(`${Y} is not a finite number`);if(q=HW(q),q<0||q>V)throw new TypeError(`${Y} is outside the accepted range of 0 to ${V}, inclusive`);if(!w8(q)||q===0)return 0;return q}function y1(W,Y){if(!h0(W))throw new TypeError(`${Y} is not a ReadableStream.`)}function E4(W){return new A0(W)}function D8(W,Y){W._reader._readRequests.push(Y)}function Z1(W,Y,w){let q=W._reader._readRequests.shift();if(w)q._closeSteps();else q._chunkSteps(Y)}function wX(W){return W._reader._readRequests.length}function V8(W){let Y=W._reader;if(Y===void 0)return!1;if(!f0(Y))return!1;return!0}class A0{constructor(W){if(_0(W,1,"ReadableStreamDefaultReader"),y1(W,"First parameter"),y0(W))throw new TypeError("This stream has already been locked for exclusive reading by another reader");Y8(this,W),this._readRequests=new n}get closed(){if(!f0(this))return _(zX("closed"));return this._closedPromise}cancel(W=void 0){if(!f0(this))return _(zX("cancel"));if(this._ownerReadableStream===void 0)return _(MX("cancel"));return P1(this,W)}read(){if(!f0(this))return _(zX("read"));if(this._ownerReadableStream===void 0)return _(MX("read from"));let W,Y,w=D((q,A)=>{W=q,Y=A});return A6(this,{_chunkSteps:(q)=>W({value:q,done:!1}),_closeSteps:()=>W({value:void 0,done:!0}),_errorSteps:(q)=>Y(q)}),w}releaseLock(){if(!f0(this))throw zX("releaseLock");if(this._ownerReadableStream===void 0)return;MW(this)}}if(Object.defineProperties(A0.prototype,{cancel:{enumerable:!0},read:{enumerable:!0},releaseLock:{enumerable:!0},closed:{enumerable:!0}}),G(A0.prototype.cancel,"cancel"),G(A0.prototype.read,"read"),G(A0.prototype.releaseLock,"releaseLock"),typeof Symbol.toStringTag==="symbol")Object.defineProperty(A0.prototype,Symbol.toStringTag,{value:"ReadableStreamDefaultReader",configurable:!0});function f0(W){if(!Q(W))return!1;if(!Object.prototype.hasOwnProperty.call(W,"_readRequests"))return!1;return W instanceof A0}function A6(W,Y){let w=W._ownerReadableStream;if(w._disturbed=!0,w._state==="closed")Y._closeSteps();else if(w._state==="errored")Y._errorSteps(w._storedError);else w._readableStreamController[I1](Y)}function MW(W){q0(W);let Y=new TypeError("Reader was released");O8(W,Y)}function O8(W,Y){let w=W._readRequests;W._readRequests=new n,w.forEach((V)=>{V._errorSteps(Y)})}function zX(W){return new TypeError(`ReadableStreamDefaultReader.prototype.${W} can only be used on a ReadableStreamDefaultReader`)}let wW=Object.getPrototypeOf(Object.getPrototypeOf(async function*(){}).prototype);class m1{constructor(W,Y){this._ongoingPromise=void 0,this._isFinished=!1,this._reader=W,this._preventCancel=Y}next(){let W=()=>this._nextSteps();return this._ongoingPromise=this._ongoingPromise?X$(this._ongoingPromise,W,W):W(),this._ongoingPromise}return(W){let Y=()=>this._returnSteps(W);return this._ongoingPromise?X$(this._ongoingPromise,Y,Y):Y()}_nextSteps(){if(this._isFinished)return Promise.resolve({value:void 0,done:!0});let W=this._reader,Y,w,V=D((A,j)=>{Y=A,w=j});return A6(W,{_chunkSteps:(A)=>{this._ongoingPromise=void 0,Z(()=>Y({value:A,done:!1}))},_closeSteps:()=>{this._ongoingPromise=void 0,this._isFinished=!0,q0(W),Y({value:void 0,done:!0})},_errorSteps:(A)=>{this._ongoingPromise=void 0,this._isFinished=!0,q0(W),w(A)}}),V}_returnSteps(W){if(this._isFinished)return Promise.resolve({value:W,done:!0});this._isFinished=!0;let Y=this._reader;if(!this._preventCancel){let w=P1(Y,W);return q0(Y),X$(w,()=>({value:W,done:!0}))}return q0(Y),O({value:W,done:!0})}}let q8={next(){if(!_8(this))return _(A8("next"));return this._asyncIteratorImpl.next()},return(W){if(!_8(this))return _(A8("return"));return this._asyncIteratorImpl.return(W)}};Object.setPrototypeOf(q8,wW);function zW(W,Y){let w=E4(W),V=new m1(w,Y),q=Object.create(q8);return q._asyncIteratorImpl=V,q}function _8(W){if(!Q(W))return!1;if(!Object.prototype.hasOwnProperty.call(W,"_asyncIteratorImpl"))return!1;try{return W._asyncIteratorImpl instanceof m1}catch(Y){return!1}}function A8(W){return new TypeError(`ReadableStreamAsyncIterator.${W} can only be used on a ReadableSteamAsyncIterator`)}let j8=Number.isNaN||function(W){return W!==W};var l1,c1,u1;function j6(W){return W.slice()}function K8(W,Y,w,V,q){new Uint8Array(W).set(new Uint8Array(w,V,q),Y)}let j0=(W)=>{if(typeof W.transfer==="function")j0=(Y)=>Y.transfer();else if(typeof structuredClone==="function")j0=(Y)=>structuredClone(Y,{transfer:[Y]});else j0=(Y)=>Y;return j0(W)},g0=(W)=>{if(typeof W.detached==="boolean")g0=(Y)=>Y.detached;else g0=(Y)=>Y.byteLength===0;return g0(W)};function U8(W,Y,w){if(W.slice)return W.slice(Y,w);let V=w-Y,q=new ArrayBuffer(V);return K8(q,0,W,Y,V),q}function BX(W,Y){let w=W[Y];if(w===void 0||w===null)return;if(typeof w!=="function")throw new TypeError(`${String(Y)} is not a function`);return w}function BW(W){let Y={[Symbol.iterator]:()=>W.iterator},w=async function*(){return yield*Y}(),V=w.next;return{iterator:w,nextMethod:V,done:!1}}let p1=(u1=(l1=Symbol.asyncIterator)!==null&&l1!==void 0?l1:(c1=Symbol.for)===null||c1===void 0?void 0:c1.call(Symbol,"Symbol.asyncIterator"))!==null&&u1!==void 0?u1:"@@asyncIterator";function N8(W,Y="sync",w){if(w===void 0)if(Y==="async"){if(w=BX(W,p1),w===void 0){let A=BX(W,Symbol.iterator),j=N8(W,"sync",A);return BW(j)}}else w=BX(W,Symbol.iterator);if(w===void 0)throw new TypeError("The object is not iterable");let V=G$(w,W,[]);if(!Q(V))throw new TypeError("The iterator method must return an object");let q=V.next;return{iterator:V,nextMethod:q,done:!1}}function DW(W){let Y=G$(W.nextMethod,W.iterator,[]);if(!Q(Y))throw new TypeError("The iterator.next() method must return an object");return Y}function VW(W){return Boolean(W.done)}function OW(W){return W.value}function qW(W){if(typeof W!=="number")return!1;if(j8(W))return!1;if(W<0)return!1;return!0}function L8(W){let Y=U8(W.buffer,W.byteOffset,W.byteOffset+W.byteLength);return new Uint8Array(Y)}function n1(W){let Y=W._queue.shift();if(W._queueTotalSize-=Y.size,W._queueTotalSize<0)W._queueTotalSize=0;return Y.value}function i1(W,Y,w){if(!qW(w)||w===1/0)throw new RangeError("Size must be a finite, non-NaN, non-negative number.");W._queue.push({value:Y,size:w}),W._queueTotalSize+=w}function _W(W){return W._queue.peek().value}function T0(W){W._queue=new n,W._queueTotalSize=0}function S8(W){return W===DataView}function AW(W){return S8(W.constructor)}function jW(W){if(S8(W))return 1;return W.BYTES_PER_ELEMENT}class x0{constructor(){throw new TypeError("Illegal constructor")}get view(){if(!d1(this))throw s1("view");return this._view}respond(W){if(!d1(this))throw s1("respond");if(_0(W,1,"respond"),W=h1(W,"First parameter"),this._associatedReadableByteStreamController===void 0)throw new TypeError("This BYOB request has been invalidated");if(g0(this._view.buffer))throw new TypeError("The BYOB request's buffer has been detached and so cannot be used as a response");qX(this._associatedReadableByteStreamController,W)}respondWithNewView(W){if(!d1(this))throw s1("respondWithNewView");if(_0(W,1,"respondWithNewView"),!ArrayBuffer.isView(W))throw new TypeError("You can only respond with array buffer views");if(this._associatedReadableByteStreamController===void 0)throw new TypeError("This BYOB request has been invalidated");if(g0(W.buffer))throw new TypeError("The given view's buffer has been detached and so cannot be used as a response");_X(this._associatedReadableByteStreamController,W)}}if(Object.defineProperties(x0.prototype,{respond:{enumerable:!0},respondWithNewView:{enumerable:!0},view:{enumerable:!0}}),G(x0.prototype.respond,"respond"),G(x0.prototype.respondWithNewView,"respondWithNewView"),typeof Symbol.toStringTag==="symbol")Object.defineProperty(x0.prototype,Symbol.toStringTag,{value:"ReadableStreamBYOBRequest",configurable:!0});class J0{constructor(){throw new TypeError("Illegal constructor")}get byobRequest(){if(!Q4(this))throw U6("byobRequest");return t1(this)}get desiredSize(){if(!Q4(this))throw U6("desiredSize");return f8(this)}close(){if(!Q4(this))throw U6("close");if(this._closeRequested)throw new TypeError("The stream has already been closed; do not close it again!");let W=this._controlledReadableByteStream._state;if(W!=="readable")throw new TypeError(`The stream (in ${W} state) is not in the readable state and cannot be closed`);K6(this)}enqueue(W){if(!Q4(this))throw U6("enqueue");if(_0(W,1,"enqueue"),!ArrayBuffer.isView(W))throw new TypeError("chunk must be an array buffer view");if(W.byteLength===0)throw new TypeError("chunk must have non-zero byteLength");if(W.buffer.byteLength===0)throw new TypeError("chunk's buffer must have non-zero byteLength");if(this._closeRequested)throw new TypeError("stream is closed or draining");let Y=this._controlledReadableByteStream._state;if(Y!=="readable")throw new TypeError(`The stream (in ${Y} state) is not in the readable state and cannot be enqueued to`);OX(this,W)}error(W=void 0){if(!Q4(this))throw U6("error");g$(this,W)}[_6](W){F8(this),T0(this);let Y=this._cancelAlgorithm(W);return VX(this),Y}[I1](W){let Y=this._controlledReadableByteStream;if(this._queueTotalSize>0){P8(this,W);return}let w=this._autoAllocateChunkSize;if(w!==void 0){let V;try{V=new ArrayBuffer(w)}catch(A){W._errorSteps(A);return}let q={buffer:V,bufferByteLength:w,byteOffset:0,byteLength:w,bytesFilled:0,minimumFill:1,elementSize:1,viewConstructor:Uint8Array,readerType:"default"};this._pendingPullIntos.push(q)}D8(Y,W),W4(this)}[b1](){if(this._pendingPullIntos.length>0){let W=this._pendingPullIntos.peek();W.readerType="none",this._pendingPullIntos=new n,this._pendingPullIntos.push(W)}}}if(Object.defineProperties(J0.prototype,{close:{enumerable:!0},enqueue:{enumerable:!0},error:{enumerable:!0},byobRequest:{enumerable:!0},desiredSize:{enumerable:!0}}),G(J0.prototype.close,"close"),G(J0.prototype.enqueue,"enqueue"),G(J0.prototype.error,"error"),typeof Symbol.toStringTag==="symbol")Object.defineProperty(J0.prototype,Symbol.toStringTag,{value:"ReadableByteStreamController",configurable:!0});function Q4(W){if(!Q(W))return!1;if(!Object.prototype.hasOwnProperty.call(W,"_controlledReadableByteStream"))return!1;return W instanceof J0}function d1(W){if(!Q(W))return!1;if(!Object.prototype.hasOwnProperty.call(W,"_associatedReadableByteStreamController"))return!1;return W instanceof x0}function W4(W){if(!SW(W))return;if(W._pulling){W._pullAgain=!0;return}W._pulling=!0;let w=W._pullAlgorithm();x(w,()=>{if(W._pulling=!1,W._pullAgain)W._pullAgain=!1,W4(W);return null},(V)=>{return g$(W,V),null})}function F8(W){r1(W),W._pendingPullIntos=new n}function o1(W,Y){let w=!1;if(W._state==="closed")w=!0;let V=E8(Y);if(Y.readerType==="default")Z1(W,V,w);else kW(W,V,w)}function E8(W){let{bytesFilled:Y,elementSize:w}=W;return new W.viewConstructor(W.buffer,W.byteOffset,Y/w)}function DX(W,Y,w,V){W._queue.push({buffer:Y,byteOffset:w,byteLength:V}),W._queueTotalSize+=V}function R8(W,Y,w,V){let q;try{q=U8(Y,w,w+V)}catch(A){throw g$(W,A),A}DX(W,q,0,V)}function v8(W,Y){if(Y.bytesFilled>0)R8(W,Y.buffer,Y.byteOffset,Y.bytesFilled);R4(W)}function C8(W,Y){let w=Math.min(W._queueTotalSize,Y.byteLength-Y.bytesFilled),V=Y.bytesFilled+w,q=w,A=!1,j=V%Y.elementSize,R=V-j;if(R>=Y.minimumFill)q=R-Y.bytesFilled,A=!0;let I=W._queue;while(q>0){let y=I.peek(),l=Math.min(q,y.byteLength),d=Y.byteOffset+Y.bytesFilled;if(K8(Y.buffer,d,y.buffer,y.byteOffset,l),y.byteLength===l)I.shift();else y.byteOffset+=l,y.byteLength-=l;W._queueTotalSize-=l,k8(W,l,Y),q-=l}return A}function k8(W,Y,w){w.bytesFilled+=Y}function I8(W){if(W._queueTotalSize===0&&W._closeRequested)VX(W),R6(W._controlledReadableByteStream);else W4(W)}function r1(W){if(W._byobRequest===null)return;W._byobRequest._associatedReadableByteStreamController=void 0,W._byobRequest._view=null,W._byobRequest=null}function a1(W){while(W._pendingPullIntos.length>0){if(W._queueTotalSize===0)return;let Y=W._pendingPullIntos.peek();if(C8(W,Y))R4(W),o1(W._controlledReadableByteStream,Y)}}function KW(W){let Y=W._controlledReadableByteStream._reader;while(Y._readRequests.length>0){if(W._queueTotalSize===0)return;let w=Y._readRequests.shift();P8(W,w)}}function UW(W,Y,w,V){let q=W._controlledReadableByteStream,A=Y.constructor,j=jW(A),{byteOffset:R,byteLength:I}=Y,y=w*j,l;try{l=j0(Y.buffer)}catch(Q$){V._errorSteps(Q$);return}let d={buffer:l,bufferByteLength:l.byteLength,byteOffset:R,byteLength:I,bytesFilled:0,minimumFill:y,elementSize:j,viewConstructor:A,readerType:"byob"};if(W._pendingPullIntos.length>0){W._pendingPullIntos.push(d),x8(q,V);return}if(q._state==="closed"){let Q$=new A(d.buffer,d.byteOffset,0);V._closeSteps(Q$);return}if(W._queueTotalSize>0){if(C8(W,d)){let Q$=E8(d);I8(W),V._chunkSteps(Q$);return}if(W._closeRequested){let Q$=new TypeError("Insufficient bytes to fill elements in the given buffer");g$(W,Q$),V._errorSteps(Q$);return}}W._pendingPullIntos.push(d),x8(q,V),W4(W)}function NW(W,Y){if(Y.readerType==="none")R4(W);let w=W._controlledReadableByteStream;if(e1(w))while(h8(w)>0){let V=R4(W);o1(w,V)}}function LW(W,Y,w){if(k8(W,Y,w),w.readerType==="none"){v8(W,w),a1(W);return}if(w.bytesFilled<w.minimumFill)return;R4(W);let V=w.bytesFilled%w.elementSize;if(V>0){let q=w.byteOffset+w.bytesFilled;R8(W,w.buffer,q-V,V)}w.bytesFilled-=V,o1(W._controlledReadableByteStream,w),a1(W)}function b8(W,Y){let w=W._pendingPullIntos.peek();if(r1(W),W._controlledReadableByteStream._state==="closed")NW(W,w);else LW(W,Y,w);W4(W)}function R4(W){return W._pendingPullIntos.shift()}function SW(W){let Y=W._controlledReadableByteStream;if(Y._state!=="readable")return!1;if(W._closeRequested)return!1;if(!W._started)return!1;if(V8(Y)&&wX(Y)>0)return!0;if(e1(Y)&&h8(Y)>0)return!0;if(f8(W)>0)return!0;return!1}function VX(W){W._pullAlgorithm=void 0,W._cancelAlgorithm=void 0}function K6(W){let Y=W._controlledReadableByteStream;if(W._closeRequested||Y._state!=="readable")return;if(W._queueTotalSize>0){W._closeRequested=!0;return}if(W._pendingPullIntos.length>0){let w=W._pendingPullIntos.peek();if(w.bytesFilled%w.elementSize!==0){let V=new TypeError("Insufficient bytes to fill elements in the given buffer");throw g$(W,V),V}}VX(W),R6(Y)}function OX(W,Y){let w=W._controlledReadableByteStream;if(W._closeRequested||w._state!=="readable")return;let{buffer:V,byteOffset:q,byteLength:A}=Y;if(g0(V))throw new TypeError("chunk's buffer is detached and so cannot be enqueued");let j=j0(V);if(W._pendingPullIntos.length>0){let R=W._pendingPullIntos.peek();if(g0(R.buffer))throw new TypeError("The BYOB request's buffer has been detached and so cannot be filled with an enqueued chunk");if(r1(W),R.buffer=j0(R.buffer),R.readerType==="none")v8(W,R)}if(V8(w))if(KW(W),wX(w)===0)DX(W,j,q,A);else{if(W._pendingPullIntos.length>0)R4(W);let R=new Uint8Array(j,q,A);Z1(w,R,!1)}else if(e1(w))DX(W,j,q,A),a1(W);else DX(W,j,q,A);W4(W)}function g$(W,Y){let w=W._controlledReadableByteStream;if(w._state!=="readable")return;F8(W),T0(W),VX(W),H3(w,Y)}function P8(W,Y){let w=W._queue.shift();W._queueTotalSize-=w.byteLength,I8(W);let V=new Uint8Array(w.buffer,w.byteOffset,w.byteLength);Y._chunkSteps(V)}function t1(W){if(W._byobRequest===null&&W._pendingPullIntos.length>0){let Y=W._pendingPullIntos.peek(),w=new Uint8Array(Y.buffer,Y.byteOffset+Y.bytesFilled,Y.byteLength-Y.bytesFilled),V=Object.create(x0.prototype);EW(V,W,w),W._byobRequest=V}return W._byobRequest}function f8(W){let Y=W._controlledReadableByteStream._state;if(Y==="errored")return null;if(Y==="closed")return 0;return W._strategyHWM-W._queueTotalSize}function qX(W,Y){let w=W._pendingPullIntos.peek();if(W._controlledReadableByteStream._state==="closed"){if(Y!==0)throw new TypeError("bytesWritten must be 0 when calling respond() on a closed stream")}else{if(Y===0)throw new TypeError("bytesWritten must be greater than 0 when calling respond() on a readable stream");if(w.bytesFilled+Y>w.byteLength)throw new RangeError("bytesWritten out of range")}w.buffer=j0(w.buffer),b8(W,Y)}function _X(W,Y){let w=W._pendingPullIntos.peek();if(W._controlledReadableByteStream._state==="closed"){if(Y.byteLength!==0)throw new TypeError("The view's length must be 0 when calling respondWithNewView() on a closed stream")}else if(Y.byteLength===0)throw new TypeError("The view's length must be greater than 0 when calling respondWithNewView() on a readable stream");if(w.byteOffset+w.bytesFilled!==Y.byteOffset)throw new RangeError("The region specified by view does not match byobRequest");if(w.bufferByteLength!==Y.buffer.byteLength)throw new RangeError("The buffer of view has different capacity than byobRequest");if(w.bytesFilled+Y.byteLength>w.byteLength)throw new RangeError("The region specified by view is larger than byobRequest");let q=Y.byteLength;w.buffer=j0(Y.buffer),b8(W,q)}function g8(W,Y,w,V,q,A,j){Y._controlledReadableByteStream=W,Y._pullAgain=!1,Y._pulling=!1,Y._byobRequest=null,Y._queue=Y._queueTotalSize=void 0,T0(Y),Y._closeRequested=!1,Y._started=!1,Y._strategyHWM=A,Y._pullAlgorithm=V,Y._cancelAlgorithm=q,Y._autoAllocateChunkSize=j,Y._pendingPullIntos=new n,W._readableStreamController=Y;let R=w();x(O(R),()=>{return Y._started=!0,W4(Y),null},(I)=>{return g$(Y,I),null})}function FW(W,Y,w){let V=Object.create(J0.prototype),q,A,j;if(Y.start!==void 0)q=()=>Y.start(V);else q=()=>{return};if(Y.pull!==void 0)A=()=>Y.pull(V);else A=()=>O(void 0);if(Y.cancel!==void 0)j=(I)=>Y.cancel(I);else j=()=>O(void 0);let R=Y.autoAllocateChunkSize;if(R===0)throw new TypeError("autoAllocateChunkSize must be greater than 0");g8(W,V,q,A,j,w,R)}function EW(W,Y,w){W._associatedReadableByteStreamController=Y,W._view=w}function s1(W){return new TypeError(`ReadableStreamBYOBRequest.prototype.${W} can only be used on a ReadableStreamBYOBRequest`)}function U6(W){return new TypeError(`ReadableByteStreamController.prototype.${W} can only be used on a ReadableByteStreamController`)}function RW(W,Y){W0(W,Y);let w=W===null||W===void 0?void 0:W.mode;return{mode:w===void 0?void 0:vW(w,`${Y} has member 'mode' that`)}}function vW(W,Y){if(W=`${W}`,W!=="byob")throw new TypeError(`${Y} '${W}' is not a valid enumeration value for ReadableStreamReaderMode`);return W}function CW(W,Y){var w;W0(W,Y);let V=(w=W===null||W===void 0?void 0:W.min)!==null&&w!==void 0?w:1;return{min:h1(V,`${Y} has member 'min' that`)}}function T8(W){return new K0(W)}function x8(W,Y){W._reader._readIntoRequests.push(Y)}function kW(W,Y,w){let q=W._reader._readIntoRequests.shift();if(w)q._closeSteps(Y);else q._chunkSteps(Y)}function h8(W){return W._reader._readIntoRequests.length}function e1(W){let Y=W._reader;if(Y===void 0)return!1;if(!J4(Y))return!1;return!0}class K0{constructor(W){if(_0(W,1,"ReadableStreamBYOBReader"),y1(W,"First parameter"),y0(W))throw new TypeError("This stream has already been locked for exclusive reading by another reader");if(!Q4(W._readableStreamController))throw new TypeError("Cannot construct a ReadableStreamBYOBReader for a stream not constructed with a byte source");Y8(this,W),this._readIntoRequests=new n}get closed(){if(!J4(this))return _(AX("closed"));return this._closedPromise}cancel(W=void 0){if(!J4(this))return _(AX("cancel"));if(this._ownerReadableStream===void 0)return _(MX("cancel"));return P1(this,W)}read(W,Y={}){if(!J4(this))return _(AX("read"));if(!ArrayBuffer.isView(W))return _(new TypeError("view must be an array buffer view"));if(W.byteLength===0)return _(new TypeError("view must have non-zero byteLength"));if(W.buffer.byteLength===0)return _(new TypeError("view's buffer must have non-zero byteLength"));if(g0(W.buffer))return _(new TypeError("view's buffer has been detached"));let w;try{w=CW(Y,"options")}catch(I){return _(I)}let V=w.min;if(V===0)return _(new TypeError("options.min must be greater than 0"));if(!AW(W)){if(V>W.length)return _(new RangeError("options.min must be less than or equal to view's length"))}else if(V>W.byteLength)return _(new RangeError("options.min must be less than or equal to view's byteLength"));if(this._ownerReadableStream===void 0)return _(MX("read from"));let q,A,j=D((I,y)=>{q=I,A=y});return y8(this,W,V,{_chunkSteps:(I)=>q({value:I,done:!1}),_closeSteps:(I)=>q({value:I,done:!0}),_errorSteps:(I)=>A(I)}),j}releaseLock(){if(!J4(this))throw AX("releaseLock");if(this._ownerReadableStream===void 0)return;IW(this)}}if(Object.defineProperties(K0.prototype,{cancel:{enumerable:!0},read:{enumerable:!0},releaseLock:{enumerable:!0},closed:{enumerable:!0}}),G(K0.prototype.cancel,"cancel"),G(K0.prototype.read,"read"),G(K0.prototype.releaseLock,"releaseLock"),typeof Symbol.toStringTag==="symbol")Object.defineProperty(K0.prototype,Symbol.toStringTag,{value:"ReadableStreamBYOBReader",configurable:!0});function J4(W){if(!Q(W))return!1;if(!Object.prototype.hasOwnProperty.call(W,"_readIntoRequests"))return!1;return W instanceof K0}function y8(W,Y,w,V){let q=W._ownerReadableStream;if(q._disturbed=!0,q._state==="errored")V._errorSteps(q._storedError);else UW(q._readableStreamController,Y,w,V)}function IW(W){q0(W);let Y=new TypeError("Reader was released");Z8(W,Y)}function Z8(W,Y){let w=W._readIntoRequests;W._readIntoRequests=new n,w.forEach((V)=>{V._errorSteps(Y)})}function AX(W){return new TypeError(`ReadableStreamBYOBReader.prototype.${W} can only be used on a ReadableStreamBYOBReader`)}function N6(W,Y){let{highWaterMark:w}=W;if(w===void 0)return Y;if(j8(w)||w<0)throw new RangeError("Invalid highWaterMark");return w}function jX(W){let{size:Y}=W;if(!Y)return()=>1;return Y}function KX(W,Y){W0(W,Y);let w=W===null||W===void 0?void 0:W.highWaterMark,V=W===null||W===void 0?void 0:W.size;return{highWaterMark:w===void 0?void 0:x1(w),size:V===void 0?void 0:bW(V,`${Y} has member 'size' that`)}}function bW(W,Y){return f$(W,Y),(w)=>x1(W(w))}function PW(W,Y){W0(W,Y);let w=W===null||W===void 0?void 0:W.abort,V=W===null||W===void 0?void 0:W.close,q=W===null||W===void 0?void 0:W.start,A=W===null||W===void 0?void 0:W.type,j=W===null||W===void 0?void 0:W.write;return{abort:w===void 0?void 0:fW(w,W,`${Y} has member 'abort' that`),close:V===void 0?void 0:gW(V,W,`${Y} has member 'close' that`),start:q===void 0?void 0:TW(q,W,`${Y} has member 'start' that`),write:j===void 0?void 0:xW(j,W,`${Y} has member 'write' that`),type:A}}function fW(W,Y,w){return f$(W,w),(V)=>a(W,Y,[V])}function gW(W,Y,w){return f$(W,w),()=>a(W,Y,[])}function TW(W,Y,w){return f$(W,w),(V)=>G$(W,Y,[V])}function xW(W,Y,w){return f$(W,w),(V,q)=>a(W,Y,[V,q])}function m8(W,Y){if(!v4(W))throw new TypeError(`${Y} is not a WritableStream.`)}function hW(W){if(typeof W!=="object"||W===null)return!1;try{return typeof W.aborted==="boolean"}catch(Y){return!1}}let yW=typeof AbortController==="function";function ZW(){if(yW)return new AbortController;return}class U0{constructor(W={},Y={}){if(W===void 0)W=null;else z8(W,"First parameter");let w=KX(Y,"Second parameter"),V=PW(W,"First parameter");if(c8(this),V.type!==void 0)throw new RangeError("Invalid type is specified");let A=jX(w),j=N6(w,1);eW(this,V,j,A)}get locked(){if(!v4(this))throw FX("locked");return C4(this)}abort(W=void 0){if(!v4(this))return _(FX("abort"));if(C4(this))return _(new TypeError("Cannot abort a stream that already has a writer"));return UX(this,W)}close(){if(!v4(this))return _(FX("close"));if(C4(this))return _(new TypeError("Cannot close a stream that already has a writer"));if(G0(this))return _(new TypeError("Cannot close an already-closing stream"));return u8(this)}getWriter(){if(!v4(this))throw FX("getWriter");return l8(this)}}if(Object.defineProperties(U0.prototype,{abort:{enumerable:!0},close:{enumerable:!0},getWriter:{enumerable:!0},locked:{enumerable:!0}}),G(U0.prototype.abort,"abort"),G(U0.prototype.close,"close"),G(U0.prototype.getWriter,"getWriter"),typeof Symbol.toStringTag==="symbol")Object.defineProperty(U0.prototype,Symbol.toStringTag,{value:"WritableStream",configurable:!0});function l8(W){return new Y0(W)}function mW(W,Y,w,V,q=1,A=()=>1){let j=Object.create(U0.prototype);c8(j);let R=Object.create(Y4.prototype);return r8(j,R,W,Y,w,V,q,A),j}function c8(W){W._state="writable",W._storedError=void 0,W._writer=void 0,W._writableStreamController=void 0,W._writeRequests=new n,W._inFlightWriteRequest=void 0,W._closeRequest=void 0,W._inFlightCloseRequest=void 0,W._pendingAbortRequest=void 0,W._backpressure=!1}function v4(W){if(!Q(W))return!1;if(!Object.prototype.hasOwnProperty.call(W,"_writableStreamController"))return!1;return W instanceof U0}function C4(W){if(W._writer===void 0)return!1;return!0}function UX(W,Y){var w;if(W._state==="closed"||W._state==="errored")return O(void 0);W._writableStreamController._abortReason=Y,(w=W._writableStreamController._abortController)===null||w===void 0||w.abort(Y);let V=W._state;if(V==="closed"||V==="errored")return O(void 0);if(W._pendingAbortRequest!==void 0)return W._pendingAbortRequest._promise;let q=!1;if(V==="erroring")q=!0,Y=void 0;let A=D((j,R)=>{W._pendingAbortRequest={_promise:void 0,_resolve:j,_reject:R,_reason:Y,_wasAlreadyErroring:q}});if(W._pendingAbortRequest._promise=A,!q)X2(W,Y);return A}function u8(W){let Y=W._state;if(Y==="closed"||Y==="errored")return _(new TypeError(`The stream (in ${Y} state) is not in the writable state and cannot be closed`));let w=D((q,A)=>{let j={_resolve:q,_reject:A};W._closeRequest=j}),V=W._writer;if(V!==void 0&&W._backpressure&&Y==="writable")w2(V);return $J(W._writableStreamController),w}function lW(W){return D((w,V)=>{let q={_resolve:w,_reject:V};W._writeRequests.push(q)})}function $2(W,Y){if(W._state==="writable"){X2(W,Y);return}Q2(W)}function X2(W,Y){let w=W._writableStreamController;W._state="erroring",W._storedError=Y;let V=W._writer;if(V!==void 0)n8(V,Y);if(!iW(W)&&w._started)Q2(W)}function Q2(W){W._state="errored",W._writableStreamController[q6]();let Y=W._storedError;if(W._writeRequests.forEach((q)=>{q._reject(Y)}),W._writeRequests=new n,W._pendingAbortRequest===void 0){NX(W);return}let w=W._pendingAbortRequest;if(W._pendingAbortRequest=void 0,w._wasAlreadyErroring){w._reject(Y),NX(W);return}let V=W._writableStreamController[B$](w._reason);x(V,()=>{return w._resolve(),NX(W),null},(q)=>{return w._reject(q),NX(W),null})}function cW(W){W._inFlightWriteRequest._resolve(void 0),W._inFlightWriteRequest=void 0}function uW(W,Y){W._inFlightWriteRequest._reject(Y),W._inFlightWriteRequest=void 0,$2(W,Y)}function pW(W){if(W._inFlightCloseRequest._resolve(void 0),W._inFlightCloseRequest=void 0,W._state==="erroring"){if(W._storedError=void 0,W._pendingAbortRequest!==void 0)W._pendingAbortRequest._resolve(),W._pendingAbortRequest=void 0}W._state="closed";let w=W._writer;if(w!==void 0)e8(w)}function nW(W,Y){if(W._inFlightCloseRequest._reject(Y),W._inFlightCloseRequest=void 0,W._pendingAbortRequest!==void 0)W._pendingAbortRequest._reject(Y),W._pendingAbortRequest=void 0;$2(W,Y)}function G0(W){if(W._closeRequest===void 0&&W._inFlightCloseRequest===void 0)return!1;return!0}function iW(W){if(W._inFlightWriteRequest===void 0&&W._inFlightCloseRequest===void 0)return!1;return!0}function dW(W){W._inFlightCloseRequest=W._closeRequest,W._closeRequest=void 0}function oW(W){W._inFlightWriteRequest=W._writeRequests.shift()}function NX(W){if(W._closeRequest!==void 0)W._closeRequest._reject(W._storedError),W._closeRequest=void 0;let Y=W._writer;if(Y!==void 0)H2(Y,W._storedError)}function W2(W,Y){let w=W._writer;if(w!==void 0&&Y!==W._backpressure)if(Y)HJ(w);else w2(w);W._backpressure=Y}class Y0{constructor(W){if(_0(W,1,"WritableStreamDefaultWriter"),m8(W,"First parameter"),C4(W))throw new TypeError("This stream has already been locked for exclusive writing by another writer");this._ownerWritableStream=W,W._writer=this;let Y=W._state;if(Y==="writable"){if(!G0(W)&&W._backpressure)RX(this);else $3(this);EX(this)}else if(Y==="erroring")M2(this,W._storedError),EX(this);else if(Y==="closed")$3(this),GJ(this);else{let w=W._storedError;M2(this,w),s8(this,w)}}get closed(){if(!G4(this))return _(H4("closed"));return this._closedPromise}get desiredSize(){if(!G4(this))throw H4("desiredSize");if(this._ownerWritableStream===void 0)throw S6("desiredSize");return sW(this)}get ready(){if(!G4(this))return _(H4("ready"));return this._readyPromise}abort(W=void 0){if(!G4(this))return _(H4("abort"));if(this._ownerWritableStream===void 0)return _(S6("abort"));return rW(this,W)}close(){if(!G4(this))return _(H4("close"));let W=this._ownerWritableStream;if(W===void 0)return _(S6("close"));if(G0(W))return _(new TypeError("Cannot close an already-closing stream"));return p8(this)}releaseLock(){if(!G4(this))throw H4("releaseLock");if(this._ownerWritableStream===void 0)return;i8(this)}write(W=void 0){if(!G4(this))return _(H4("write"));if(this._ownerWritableStream===void 0)return _(S6("write to"));return d8(this,W)}}if(Object.defineProperties(Y0.prototype,{abort:{enumerable:!0},close:{enumerable:!0},releaseLock:{enumerable:!0},write:{enumerable:!0},closed:{enumerable:!0},desiredSize:{enumerable:!0},ready:{enumerable:!0}}),G(Y0.prototype.abort,"abort"),G(Y0.prototype.close,"close"),G(Y0.prototype.releaseLock,"releaseLock"),G(Y0.prototype.write,"write"),typeof Symbol.toStringTag==="symbol")Object.defineProperty(Y0.prototype,Symbol.toStringTag,{value:"WritableStreamDefaultWriter",configurable:!0});function G4(W){if(!Q(W))return!1;if(!Object.prototype.hasOwnProperty.call(W,"_ownerWritableStream"))return!1;return W instanceof Y0}function rW(W,Y){let w=W._ownerWritableStream;return UX(w,Y)}function p8(W){let Y=W._ownerWritableStream;return u8(Y)}function aW(W){let Y=W._ownerWritableStream,w=Y._state;if(G0(Y)||w==="closed")return O(void 0);if(w==="errored")return _(Y._storedError);return p8(W)}function tW(W,Y){if(W._closedPromiseState==="pending")H2(W,Y);else YJ(W,Y)}function n8(W,Y){if(W._readyPromiseState==="pending")X3(W,Y);else MJ(W,Y)}function sW(W){let Y=W._ownerWritableStream,w=Y._state;if(w==="errored"||w==="erroring")return null;if(w==="closed")return 0;return a8(Y._writableStreamController)}function i8(W){let Y=W._ownerWritableStream,w=new TypeError("Writer was released and can no longer be used to monitor the stream's closedness");n8(W,w),tW(W,w),Y._writer=void 0,W._ownerWritableStream=void 0}function d8(W,Y){let w=W._ownerWritableStream,V=w._writableStreamController,q=XJ(V,Y);if(w!==W._ownerWritableStream)return _(S6("write to"));let A=w._state;if(A==="errored")return _(w._storedError);if(G0(w)||A==="closed")return _(new TypeError("The stream is closing or closed and cannot be written to"));if(A==="erroring")return _(w._storedError);let j=lW(w);return QJ(V,Y,q),j}let o8={};class Y4{constructor(){throw new TypeError("Illegal constructor")}get abortReason(){if(!J2(this))throw Y2("abortReason");return this._abortReason}get signal(){if(!J2(this))throw Y2("signal");if(this._abortController===void 0)throw new TypeError("WritableStreamDefaultController.prototype.signal is not supported");return this._abortController.signal}error(W=void 0){if(!J2(this))throw Y2("error");if(this._controlledWritableStream._state!=="writable")return;t8(this,W)}[B$](W){let Y=this._abortAlgorithm(W);return LX(this),Y}[q6](){T0(this)}}if(Object.defineProperties(Y4.prototype,{abortReason:{enumerable:!0},signal:{enumerable:!0},error:{enumerable:!0}}),typeof Symbol.toStringTag==="symbol")Object.defineProperty(Y4.prototype,Symbol.toStringTag,{value:"WritableStreamDefaultController",configurable:!0});function J2(W){if(!Q(W))return!1;if(!Object.prototype.hasOwnProperty.call(W,"_controlledWritableStream"))return!1;return W instanceof Y4}function r8(W,Y,w,V,q,A,j,R){Y._controlledWritableStream=W,W._writableStreamController=Y,Y._queue=void 0,Y._queueTotalSize=void 0,T0(Y),Y._abortReason=void 0,Y._abortController=ZW(),Y._started=!1,Y._strategySizeAlgorithm=R,Y._strategyHWM=j,Y._writeAlgorithm=V,Y._closeAlgorithm=q,Y._abortAlgorithm=A;let I=G2(Y);W2(W,I);let y=w(),l=O(y);x(l,()=>{return Y._started=!0,SX(Y),null},(d)=>{return Y._started=!0,$2(W,d),null})}function eW(W,Y,w,V){let q=Object.create(Y4.prototype),A,j,R,I;if(Y.start!==void 0)A=()=>Y.start(q);else A=()=>{return};if(Y.write!==void 0)j=(y)=>Y.write(y,q);else j=()=>O(void 0);if(Y.close!==void 0)R=()=>Y.close();else R=()=>O(void 0);if(Y.abort!==void 0)I=(y)=>Y.abort(y);else I=()=>O(void 0);r8(W,q,A,j,R,I,w,V)}function LX(W){W._writeAlgorithm=void 0,W._closeAlgorithm=void 0,W._abortAlgorithm=void 0,W._strategySizeAlgorithm=void 0}function $J(W){i1(W,o8,0),SX(W)}function XJ(W,Y){try{return W._strategySizeAlgorithm(Y)}catch(w){return L6(W,w),1}}function a8(W){return W._strategyHWM-W._queueTotalSize}function QJ(W,Y,w){try{i1(W,Y,w)}catch(q){L6(W,q);return}let V=W._controlledWritableStream;if(!G0(V)&&V._state==="writable"){let q=G2(W);W2(V,q)}SX(W)}function SX(W){let Y=W._controlledWritableStream;if(!W._started)return;if(Y._inFlightWriteRequest!==void 0)return;if(Y._state==="erroring"){Q2(Y);return}if(W._queue.length===0)return;let V=_W(W);if(V===o8)WJ(W);else JJ(W,V)}function L6(W,Y){if(W._controlledWritableStream._state==="writable")t8(W,Y)}function WJ(W){let Y=W._controlledWritableStream;dW(Y),n1(W);let w=W._closeAlgorithm();LX(W),x(w,()=>{return pW(Y),null},(V)=>{return nW(Y,V),null})}function JJ(W,Y){let w=W._controlledWritableStream;oW(w);let V=W._writeAlgorithm(Y);x(V,()=>{cW(w);let q=w._state;if(n1(W),!G0(w)&&q==="writable"){let A=G2(W);W2(w,A)}return SX(W),null},(q)=>{if(w._state==="writable")LX(W);return uW(w,q),null})}function G2(W){return a8(W)<=0}function t8(W,Y){let w=W._controlledWritableStream;LX(W),X2(w,Y)}function FX(W){return new TypeError(`WritableStream.prototype.${W} can only be used on a WritableStream`)}function Y2(W){return new TypeError(`WritableStreamDefaultController.prototype.${W} can only be used on a WritableStreamDefaultController`)}function H4(W){return new TypeError(`WritableStreamDefaultWriter.prototype.${W} can only be used on a WritableStreamDefaultWriter`)}function S6(W){return new TypeError("Cannot "+W+" a stream using a released writer")}function EX(W){W._closedPromise=D((Y,w)=>{W._closedPromise_resolve=Y,W._closedPromise_reject=w,W._closedPromiseState="pending"})}function s8(W,Y){EX(W),H2(W,Y)}function GJ(W){EX(W),e8(W)}function H2(W,Y){if(W._closedPromise_reject===void 0)return;s(W._closedPromise),W._closedPromise_reject(Y),W._closedPromise_resolve=void 0,W._closedPromise_reject=void 0,W._closedPromiseState="rejected"}function YJ(W,Y){s8(W,Y)}function e8(W){if(W._closedPromise_resolve===void 0)return;W._closedPromise_resolve(void 0),W._closedPromise_resolve=void 0,W._closedPromise_reject=void 0,W._closedPromiseState="resolved"}function RX(W){W._readyPromise=D((Y,w)=>{W._readyPromise_resolve=Y,W._readyPromise_reject=w}),W._readyPromiseState="pending"}function M2(W,Y){RX(W),X3(W,Y)}function $3(W){RX(W),w2(W)}function X3(W,Y){if(W._readyPromise_reject===void 0)return;s(W._readyPromise),W._readyPromise_reject(Y),W._readyPromise_resolve=void 0,W._readyPromise_reject=void 0,W._readyPromiseState="rejected"}function HJ(W){RX(W)}function MJ(W,Y){M2(W,Y)}function w2(W){if(W._readyPromise_resolve===void 0)return;W._readyPromise_resolve(void 0),W._readyPromise_resolve=void 0,W._readyPromise_reject=void 0,W._readyPromiseState="fulfilled"}function wJ(){if(typeof globalThis!=="undefined")return globalThis;else if(typeof self!=="undefined")return self;else if(typeof global!=="undefined")return global;return}let z2=wJ();function zJ(W){if(!(typeof W==="function"||typeof W==="object"))return!1;if(W.name!=="DOMException")return!1;try{return new W,!0}catch(Y){return!1}}function BJ(){let W=z2===null||z2===void 0?void 0:z2.DOMException;return zJ(W)?W:void 0}function DJ(){let W=function Y(w,V){if(this.message=w||"",this.name=V||"Error",Error.captureStackTrace)Error.captureStackTrace(this,this.constructor)};return G(W,"DOMException"),W.prototype=Object.create(Error.prototype),Object.defineProperty(W.prototype,"constructor",{value:W,writable:!0,configurable:!0}),W}let VJ=BJ()||DJ();function Q3(W,Y,w,V,q,A){let j=E4(W),R=l8(Y);W._disturbed=!0;let I=!1,y=O(void 0);return D((l,d)=>{let Q$;if(A!==void 0){if(Q$=()=>{let b=A.reason!==void 0?A.reason:new VJ("Aborted","AbortError"),r=[];if(!V)r.push(()=>{if(Y._state==="writable")return UX(Y,b);return O(void 0)});if(!q)r.push(()=>{if(W._state==="readable")return l$(W,b);return O(void 0)});L$(()=>Promise.all(r.map((W$)=>W$())),!0,b)},A.aborted){Q$();return}A.addEventListener("abort",Q$)}function L0(){return D((b,r)=>{function W$(v$){if(v$)b();else m(P4(),W$,r)}W$(!1)})}function P4(){if(I)return O(!0);return m(R._readyPromise,()=>{return D((b,r)=>{A6(j,{_chunkSteps:(W$)=>{y=m(d8(R,W$),void 0,X),b(!1)},_closeSteps:()=>b(!0),_errorSteps:r})})})}if(S0(W,j._closedPromise,(b)=>{if(!V)L$(()=>UX(Y,b),!0,b);else T$(!0,b);return null}),S0(Y,R._closedPromise,(b)=>{if(!q)L$(()=>l$(W,b),!0,b);else T$(!0,b);return null}),K$(W,j._closedPromise,()=>{if(!w)L$(()=>aW(R));else T$();return null}),G0(Y)||Y._state==="closed"){let b=new TypeError("the destination writable stream closed before all data could be piped to it");if(!q)L$(()=>l$(W,b),!0,b);else T$(!0,b)}s(L0());function Z0(){let b=y;return m(y,()=>b!==y?Z0():void 0)}function S0(b,r,W$){if(b._state==="errored")W$(b._storedError);else k(r,W$)}function K$(b,r,W$){if(b._state==="closed")W$();else h(r,W$)}function L$(b,r,W$){if(I)return;if(I=!0,Y._state==="writable"&&!G0(Y))h(Z0(),v$);else v$();function v$(){return x(b(),()=>F0(r,W$),(f4)=>F0(!0,f4)),null}}function T$(b,r){if(I)return;if(I=!0,Y._state==="writable"&&!G0(Y))h(Z0(),()=>F0(b,r));else F0(b,r)}function F0(b,r){if(i8(R),q0(j),A!==void 0)A.removeEventListener("abort",Q$);if(b)d(r);else l(void 0);return null}})}class H0{constructor(){throw new TypeError("Illegal constructor")}get desiredSize(){if(!vX(this))throw kX("desiredSize");return B2(this)}close(){if(!vX(this))throw kX("close");if(!I4(this))throw new TypeError("The stream is not in a state that permits close");M4(this)}enqueue(W=void 0){if(!vX(this))throw kX("enqueue");if(!I4(this))throw new TypeError("The stream is not in a state that permits enqueue");return k4(this,W)}error(W=void 0){if(!vX(this))throw kX("error");m$(this,W)}[_6](W){T0(this);let Y=this._cancelAlgorithm(W);return CX(this),Y}[I1](W){let Y=this._controlledReadableStream;if(this._queue.length>0){let w=n1(this);if(this._closeRequested&&this._queue.length===0)CX(this),R6(Y);else F6(this);W._chunkSteps(w)}else D8(Y,W),F6(this)}[b1](){}}if(Object.defineProperties(H0.prototype,{close:{enumerable:!0},enqueue:{enumerable:!0},error:{enumerable:!0},desiredSize:{enumerable:!0}}),G(H0.prototype.close,"close"),G(H0.prototype.enqueue,"enqueue"),G(H0.prototype.error,"error"),typeof Symbol.toStringTag==="symbol")Object.defineProperty(H0.prototype,Symbol.toStringTag,{value:"ReadableStreamDefaultController",configurable:!0});function vX(W){if(!Q(W))return!1;if(!Object.prototype.hasOwnProperty.call(W,"_controlledReadableStream"))return!1;return W instanceof H0}function F6(W){if(!W3(W))return;if(W._pulling){W._pullAgain=!0;return}W._pulling=!0;let w=W._pullAlgorithm();x(w,()=>{if(W._pulling=!1,W._pullAgain)W._pullAgain=!1,F6(W);return null},(V)=>{return m$(W,V),null})}function W3(W){let Y=W._controlledReadableStream;if(!I4(W))return!1;if(!W._started)return!1;if(y0(Y)&&wX(Y)>0)return!0;if(B2(W)>0)return!0;return!1}function CX(W){W._pullAlgorithm=void 0,W._cancelAlgorithm=void 0,W._strategySizeAlgorithm=void 0}function M4(W){if(!I4(W))return;let Y=W._controlledReadableStream;if(W._closeRequested=!0,W._queue.length===0)CX(W),R6(Y)}function k4(W,Y){if(!I4(W))return;let w=W._controlledReadableStream;if(y0(w)&&wX(w)>0)Z1(w,Y,!1);else{let V;try{V=W._strategySizeAlgorithm(Y)}catch(q){throw m$(W,q),q}try{i1(W,Y,V)}catch(q){throw m$(W,q),q}}F6(W)}function m$(W,Y){let w=W._controlledReadableStream;if(w._state!=="readable")return;T0(W),CX(W),H3(w,Y)}function B2(W){let Y=W._controlledReadableStream._state;if(Y==="errored")return null;if(Y==="closed")return 0;return W._strategyHWM-W._queueTotalSize}function OJ(W){if(W3(W))return!1;return!0}function I4(W){let Y=W._controlledReadableStream._state;if(!W._closeRequested&&Y==="readable")return!0;return!1}function J3(W,Y,w,V,q,A,j){Y._controlledReadableStream=W,Y._queue=void 0,Y._queueTotalSize=void 0,T0(Y),Y._started=!1,Y._closeRequested=!1,Y._pullAgain=!1,Y._pulling=!1,Y._strategySizeAlgorithm=j,Y._strategyHWM=A,Y._pullAlgorithm=V,Y._cancelAlgorithm=q,W._readableStreamController=Y;let R=w();x(O(R),()=>{return Y._started=!0,F6(Y),null},(I)=>{return m$(Y,I),null})}function qJ(W,Y,w,V){let q=Object.create(H0.prototype),A,j,R;if(Y.start!==void 0)A=()=>Y.start(q);else A=()=>{return};if(Y.pull!==void 0)j=()=>Y.pull(q);else j=()=>O(void 0);if(Y.cancel!==void 0)R=(I)=>Y.cancel(I);else R=()=>O(void 0);J3(W,q,A,j,R,w,V)}function kX(W){return new TypeError(`ReadableStreamDefaultController.prototype.${W} can only be used on a ReadableStreamDefaultController`)}function _J(W,Y){if(Q4(W._readableStreamController))return jJ(W);return AJ(W)}function AJ(W,Y){let w=E4(W),V=!1,q=!1,A=!1,j=!1,R,I,y,l,d,Q$=D((K$)=>{d=K$});function L0(){if(V)return q=!0,O(void 0);return V=!0,A6(w,{_chunkSteps:(L$)=>{Z(()=>{q=!1;let T$=L$,F0=L$;if(!A)k4(y._readableStreamController,T$);if(!j)k4(l._readableStreamController,F0);if(V=!1,q)L0()})},_closeSteps:()=>{if(V=!1,!A)M4(y._readableStreamController);if(!j)M4(l._readableStreamController);if(!A||!j)d(void 0)},_errorSteps:()=>{V=!1}}),O(void 0)}function P4(K$){if(A=!0,R=K$,j){let L$=j6([R,I]),T$=l$(W,L$);d(T$)}return Q$}function Z0(K$){if(j=!0,I=K$,A){let L$=j6([R,I]),T$=l$(W,L$);d(T$)}return Q$}function S0(){}return y=E6(S0,L0,P4),l=E6(S0,L0,Z0),k(w._closedPromise,(K$)=>{if(m$(y._readableStreamController,K$),m$(l._readableStreamController,K$),!A||!j)d(void 0);return null}),[y,l]}function jJ(W){let Y=E4(W),w=!1,V=!1,q=!1,A=!1,j=!1,R,I,y,l,d,Q$=D((b)=>{d=b});function L0(b){k(b._closedPromise,(r)=>{if(b!==Y)return null;if(g$(y._readableStreamController,r),g$(l._readableStreamController,r),!A||!j)d(void 0);return null})}function P4(){if(J4(Y))q0(Y),Y=E4(W),L0(Y);A6(Y,{_chunkSteps:(r)=>{Z(()=>{V=!1,q=!1;let W$=r,v$=r;if(!A&&!j)try{v$=L8(r)}catch(f4){g$(y._readableStreamController,f4),g$(l._readableStreamController,f4),d(l$(W,f4));return}if(!A)OX(y._readableStreamController,W$);if(!j)OX(l._readableStreamController,v$);if(w=!1,V)S0();else if(q)K$()})},_closeSteps:()=>{if(w=!1,!A)K6(y._readableStreamController);if(!j)K6(l._readableStreamController);if(y._readableStreamController._pendingPullIntos.length>0)qX(y._readableStreamController,0);if(l._readableStreamController._pendingPullIntos.length>0)qX(l._readableStreamController,0);if(!A||!j)d(void 0)},_errorSteps:()=>{w=!1}})}function Z0(b,r){if(f0(Y))q0(Y),Y=T8(W),L0(Y);let W$=r?l:y,v$=r?y:l;y8(Y,b,1,{_chunkSteps:(g4)=>{Z(()=>{V=!1,q=!1;let T4=r?j:A;if(!(r?A:j)){let U3;try{U3=L8(g4)}catch(_2){g$(W$._readableStreamController,_2),g$(v$._readableStreamController,_2),d(l$(W,_2));return}if(!T4)_X(W$._readableStreamController,g4);OX(v$._readableStreamController,U3)}else if(!T4)_X(W$._readableStreamController,g4);if(w=!1,V)S0();else if(q)K$()})},_closeSteps:(g4)=>{w=!1;let T4=r?j:A,gX=r?A:j;if(!T4)K6(W$._readableStreamController);if(!gX)K6(v$._readableStreamController);if(g4!==void 0){if(!T4)_X(W$._readableStreamController,g4);if(!gX&&v$._readableStreamController._pendingPullIntos.length>0)qX(v$._readableStreamController,0)}if(!T4||!gX)d(void 0)},_errorSteps:()=>{w=!1}})}function S0(){if(w)return V=!0,O(void 0);w=!0;let b=t1(y._readableStreamController);if(b===null)P4();else Z0(b._view,!1);return O(void 0)}function K$(){if(w)return q=!0,O(void 0);w=!0;let b=t1(l._readableStreamController);if(b===null)P4();else Z0(b._view,!0);return O(void 0)}function L$(b){if(A=!0,R=b,j){let r=j6([R,I]),W$=l$(W,r);d(W$)}return Q$}function T$(b){if(j=!0,I=b,A){let r=j6([R,I]),W$=l$(W,r);d(W$)}return Q$}function F0(){return}return y=Y3(F0,S0,L$),l=Y3(F0,K$,T$),L0(Y),[y,l]}function KJ(W){return Q(W)&&typeof W.getReader!=="undefined"}function UJ(W){if(KJ(W))return LJ(W.getReader());return NJ(W)}function NJ(W){let Y,w=N8(W,"async"),V=X;function q(){let j;try{j=DW(w)}catch(I){return _(I)}let R=O(j);return X$(R,(I)=>{if(!Q(I))throw new TypeError("The promise returned by the iterator.next() method must fulfill with an object");if(VW(I))M4(Y._readableStreamController);else{let l=OW(I);k4(Y._readableStreamController,l)}})}function A(j){let R=w.iterator,I;try{I=BX(R,"return")}catch(d){return _(d)}if(I===void 0)return O(void 0);let y;try{y=G$(I,R,[j])}catch(d){return _(d)}let l=O(y);return X$(l,(d)=>{if(!Q(d))throw new TypeError("The promise returned by the iterator.return() method must fulfill with an object");return})}return Y=E6(V,q,A,0),Y}function LJ(W){let Y,w=X;function V(){let A;try{A=W.read()}catch(j){return _(j)}return X$(A,(j)=>{if(!Q(j))throw new TypeError("The promise returned by the reader.read() method must fulfill with an object");if(j.done)M4(Y._readableStreamController);else{let R=j.value;k4(Y._readableStreamController,R)}})}function q(A){try{return O(W.cancel(A))}catch(j){return _(j)}}return Y=E6(w,V,q,0),Y}function SJ(W,Y){W0(W,Y);let w=W,V=w===null||w===void 0?void 0:w.autoAllocateChunkSize,q=w===null||w===void 0?void 0:w.cancel,A=w===null||w===void 0?void 0:w.pull,j=w===null||w===void 0?void 0:w.start,R=w===null||w===void 0?void 0:w.type;return{autoAllocateChunkSize:V===void 0?void 0:h1(V,`${Y} has member 'autoAllocateChunkSize' that`),cancel:q===void 0?void 0:FJ(q,w,`${Y} has member 'cancel' that`),pull:A===void 0?void 0:EJ(A,w,`${Y} has member 'pull' that`),start:j===void 0?void 0:RJ(j,w,`${Y} has member 'start' that`),type:R===void 0?void 0:vJ(R,`${Y} has member 'type' that`)}}function FJ(W,Y,w){return f$(W,w),(V)=>a(W,Y,[V])}function EJ(W,Y,w){return f$(W,w),(V)=>a(W,Y,[V])}function RJ(W,Y,w){return f$(W,w),(V)=>G$(W,Y,[V])}function vJ(W,Y){if(W=`${W}`,W!=="bytes")throw new TypeError(`${Y} '${W}' is not a valid enumeration value for ReadableStreamType`);return W}function CJ(W,Y){W0(W,Y);let w=W===null||W===void 0?void 0:W.preventCancel;return{preventCancel:Boolean(w)}}function G3(W,Y){W0(W,Y);let w=W===null||W===void 0?void 0:W.preventAbort,V=W===null||W===void 0?void 0:W.preventCancel,q=W===null||W===void 0?void 0:W.preventClose,A=W===null||W===void 0?void 0:W.signal;if(A!==void 0)kJ(A,`${Y} has member 'signal' that`);return{preventAbort:Boolean(w),preventCancel:Boolean(V),preventClose:Boolean(q),signal:A}}function kJ(W,Y){if(!hW(W))throw new TypeError(`${Y} is not an AbortSignal.`)}function IJ(W,Y){W0(W,Y);let w=W===null||W===void 0?void 0:W.readable;T1(w,"readable","ReadableWritablePair"),y1(w,`${Y} has member 'readable' that`);let V=W===null||W===void 0?void 0:W.writable;return T1(V,"writable","ReadableWritablePair"),m8(V,`${Y} has member 'writable' that`),{readable:w,writable:V}}class O${constructor(W={},Y={}){if(W===void 0)W=null;else z8(W,"First parameter");let w=KX(Y,"Second parameter"),V=SJ(W,"First parameter");if(D2(this),V.type==="bytes"){if(w.size!==void 0)throw new RangeError("The strategy for a byte stream cannot have a size function");let q=N6(w,0);FW(this,V,q)}else{let q=jX(w),A=N6(w,1);qJ(this,V,A,q)}}get locked(){if(!h0(this))throw w4("locked");return y0(this)}cancel(W=void 0){if(!h0(this))return _(w4("cancel"));if(y0(this))return _(new TypeError("Cannot cancel a stream that already has a reader"));return l$(this,W)}getReader(W=void 0){if(!h0(this))throw w4("getReader");if(RW(W,"First parameter").mode===void 0)return E4(this);return T8(this)}pipeThrough(W,Y={}){if(!h0(this))throw w4("pipeThrough");_0(W,1,"pipeThrough");let w=IJ(W,"First parameter"),V=G3(Y,"Second parameter");if(y0(this))throw new TypeError("ReadableStream.prototype.pipeThrough cannot be used on a locked ReadableStream");if(C4(w.writable))throw new TypeError("ReadableStream.prototype.pipeThrough cannot be used on a locked WritableStream");let q=Q3(this,w.writable,V.preventClose,V.preventAbort,V.preventCancel,V.signal);return s(q),w.readable}pipeTo(W,Y={}){if(!h0(this))return _(w4("pipeTo"));if(W===void 0)return _("Parameter 1 is required in 'pipeTo'.");if(!v4(W))return _(new TypeError("ReadableStream.prototype.pipeTo's first argument must be a WritableStream"));let w;try{w=G3(Y,"Second parameter")}catch(V){return _(V)}if(y0(this))return _(new TypeError("ReadableStream.prototype.pipeTo cannot be used on a locked ReadableStream"));if(C4(W))return _(new TypeError("ReadableStream.prototype.pipeTo cannot be used on a locked WritableStream"));return Q3(this,W,w.preventClose,w.preventAbort,w.preventCancel,w.signal)}tee(){if(!h0(this))throw w4("tee");let W=_J(this);return j6(W)}values(W=void 0){if(!h0(this))throw w4("values");let Y=CJ(W,"First parameter");return zW(this,Y.preventCancel)}[p1](W){return this.values(W)}static from(W){return UJ(W)}}if(Object.defineProperties(O$,{from:{enumerable:!0}}),Object.defineProperties(O$.prototype,{cancel:{enumerable:!0},getReader:{enumerable:!0},pipeThrough:{enumerable:!0},pipeTo:{enumerable:!0},tee:{enumerable:!0},values:{enumerable:!0},locked:{enumerable:!0}}),G(O$.from,"from"),G(O$.prototype.cancel,"cancel"),G(O$.prototype.getReader,"getReader"),G(O$.prototype.pipeThrough,"pipeThrough"),G(O$.prototype.pipeTo,"pipeTo"),G(O$.prototype.tee,"tee"),G(O$.prototype.values,"values"),typeof Symbol.toStringTag==="symbol")Object.defineProperty(O$.prototype,Symbol.toStringTag,{value:"ReadableStream",configurable:!0});Object.defineProperty(O$.prototype,p1,{value:O$.prototype.values,writable:!0,configurable:!0});function E6(W,Y,w,V=1,q=()=>1){let A=Object.create(O$.prototype);D2(A);let j=Object.create(H0.prototype);return J3(A,j,W,Y,w,V,q),A}function Y3(W,Y,w){let V=Object.create(O$.prototype);D2(V);let q=Object.create(J0.prototype);return g8(V,q,W,Y,w,0,void 0),V}function D2(W){W._state="readable",W._reader=void 0,W._storedError=void 0,W._disturbed=!1}function h0(W){if(!Q(W))return!1;if(!Object.prototype.hasOwnProperty.call(W,"_readableStreamController"))return!1;return W instanceof O$}function y0(W){if(W._reader===void 0)return!1;return!0}function l$(W,Y){if(W._disturbed=!0,W._state==="closed")return O(void 0);if(W._state==="errored")return _(W._storedError);R6(W);let w=W._reader;if(w!==void 0&&J4(w)){let q=w._readIntoRequests;w._readIntoRequests=new n,q.forEach((A)=>{A._closeSteps(void 0)})}let V=W._readableStreamController[_6](Y);return X$(V,X)}function R6(W){W._state="closed";let Y=W._reader;if(Y===void 0)return;if(M8(Y),f0(Y)){let w=Y._readRequests;Y._readRequests=new n,w.forEach((V)=>{V._closeSteps()})}}function H3(W,Y){W._state="errored",W._storedError=Y;let w=W._reader;if(w===void 0)return;if(g1(w,Y),f0(w))O8(w,Y);else Z8(w,Y)}function w4(W){return new TypeError(`ReadableStream.prototype.${W} can only be used on a ReadableStream`)}function M3(W,Y){W0(W,Y);let w=W===null||W===void 0?void 0:W.highWaterMark;return T1(w,"highWaterMark","QueuingStrategyInit"),{highWaterMark:x1(w)}}let w3=(W)=>{return W.byteLength};G(w3,"size");class v6{constructor(W){_0(W,1,"ByteLengthQueuingStrategy"),W=M3(W,"First parameter"),this._byteLengthQueuingStrategyHighWaterMark=W.highWaterMark}get highWaterMark(){if(!B3(this))throw z3("highWaterMark");return this._byteLengthQueuingStrategyHighWaterMark}get size(){if(!B3(this))throw z3("size");return w3}}if(Object.defineProperties(v6.prototype,{highWaterMark:{enumerable:!0},size:{enumerable:!0}}),typeof Symbol.toStringTag==="symbol")Object.defineProperty(v6.prototype,Symbol.toStringTag,{value:"ByteLengthQueuingStrategy",configurable:!0});function z3(W){return new TypeError(`ByteLengthQueuingStrategy.prototype.${W} can only be used on a ByteLengthQueuingStrategy`)}function B3(W){if(!Q(W))return!1;if(!Object.prototype.hasOwnProperty.call(W,"_byteLengthQueuingStrategyHighWaterMark"))return!1;return W instanceof v6}let D3=()=>{return 1};G(D3,"size");class C6{constructor(W){_0(W,1,"CountQueuingStrategy"),W=M3(W,"First parameter"),this._countQueuingStrategyHighWaterMark=W.highWaterMark}get highWaterMark(){if(!O3(this))throw V3("highWaterMark");return this._countQueuingStrategyHighWaterMark}get size(){if(!O3(this))throw V3("size");return D3}}if(Object.defineProperties(C6.prototype,{highWaterMark:{enumerable:!0},size:{enumerable:!0}}),typeof Symbol.toStringTag==="symbol")Object.defineProperty(C6.prototype,Symbol.toStringTag,{value:"CountQueuingStrategy",configurable:!0});function V3(W){return new TypeError(`CountQueuingStrategy.prototype.${W} can only be used on a CountQueuingStrategy`)}function O3(W){if(!Q(W))return!1;if(!Object.prototype.hasOwnProperty.call(W,"_countQueuingStrategyHighWaterMark"))return!1;return W instanceof C6}function bJ(W,Y){W0(W,Y);let w=W===null||W===void 0?void 0:W.cancel,V=W===null||W===void 0?void 0:W.flush,q=W===null||W===void 0?void 0:W.readableType,A=W===null||W===void 0?void 0:W.start,j=W===null||W===void 0?void 0:W.transform,R=W===null||W===void 0?void 0:W.writableType;return{cancel:w===void 0?void 0:TJ(w,W,`${Y} has member 'cancel' that`),flush:V===void 0?void 0:PJ(V,W,`${Y} has member 'flush' that`),readableType:q,start:A===void 0?void 0:fJ(A,W,`${Y} has member 'start' that`),transform:j===void 0?void 0:gJ(j,W,`${Y} has member 'transform' that`),writableType:R}}function PJ(W,Y,w){return f$(W,w),(V)=>a(W,Y,[V])}function fJ(W,Y,w){return f$(W,w),(V)=>G$(W,Y,[V])}function gJ(W,Y,w){return f$(W,w),(V,q)=>a(W,Y,[V,q])}function TJ(W,Y,w){return f$(W,w),(V)=>a(W,Y,[V])}class k6{constructor(W={},Y={},w={}){if(W===void 0)W=null;let V=KX(Y,"Second parameter"),q=KX(w,"Third parameter"),A=bJ(W,"First parameter");if(A.readableType!==void 0)throw new RangeError("Invalid readableType specified");if(A.writableType!==void 0)throw new RangeError("Invalid writableType specified");let j=N6(q,0),R=jX(q),I=N6(V,1),y=jX(V),l,d=D((Q$)=>{l=Q$});if(xJ(this,d,I,y,j,R),yJ(this,A),A.start!==void 0)l(A.start(this._transformStreamController));else l(void 0)}get readable(){if(!q3(this))throw K3("readable");return this._readable}get writable(){if(!q3(this))throw K3("writable");return this._writable}}if(Object.defineProperties(k6.prototype,{readable:{enumerable:!0},writable:{enumerable:!0}}),typeof Symbol.toStringTag==="symbol")Object.defineProperty(k6.prototype,Symbol.toStringTag,{value:"TransformStream",configurable:!0});function xJ(W,Y,w,V,q,A){function j(){return Y}function R(Q$){return lJ(W,Q$)}function I(Q$){return cJ(W,Q$)}function y(){return uJ(W)}W._writable=mW(j,R,y,I,w,V);function l(){return pJ(W)}function d(Q$){return nJ(W,Q$)}W._readable=E6(j,l,d,q,A),W._backpressure=void 0,W._backpressureChangePromise=void 0,W._backpressureChangePromise_resolve=void 0,IX(W,!0),W._transformStreamController=void 0}function q3(W){if(!Q(W))return!1;if(!Object.prototype.hasOwnProperty.call(W,"_transformStreamController"))return!1;return W instanceof k6}function _3(W,Y){m$(W._readable._readableStreamController,Y),V2(W,Y)}function V2(W,Y){PX(W._transformStreamController),L6(W._writable._writableStreamController,Y),O2(W)}function O2(W){if(W._backpressure)IX(W,!1)}function IX(W,Y){if(W._backpressureChangePromise!==void 0)W._backpressureChangePromise_resolve();W._backpressureChangePromise=D((w)=>{W._backpressureChangePromise_resolve=w}),W._backpressure=Y}class N0{constructor(){throw new TypeError("Illegal constructor")}get desiredSize(){if(!bX(this))throw fX("desiredSize");let W=this._controlledTransformStream._readable._readableStreamController;return B2(W)}enqueue(W=void 0){if(!bX(this))throw fX("enqueue");A3(this,W)}error(W=void 0){if(!bX(this))throw fX("error");ZJ(this,W)}terminate(){if(!bX(this))throw fX("terminate");mJ(this)}}if(Object.defineProperties(N0.prototype,{enqueue:{enumerable:!0},error:{enumerable:!0},terminate:{enumerable:!0},desiredSize:{enumerable:!0}}),G(N0.prototype.enqueue,"enqueue"),G(N0.prototype.error,"error"),G(N0.prototype.terminate,"terminate"),typeof Symbol.toStringTag==="symbol")Object.defineProperty(N0.prototype,Symbol.toStringTag,{value:"TransformStreamDefaultController",configurable:!0});function bX(W){if(!Q(W))return!1;if(!Object.prototype.hasOwnProperty.call(W,"_controlledTransformStream"))return!1;return W instanceof N0}function hJ(W,Y,w,V,q){Y._controlledTransformStream=W,W._transformStreamController=Y,Y._transformAlgorithm=w,Y._flushAlgorithm=V,Y._cancelAlgorithm=q,Y._finishPromise=void 0,Y._finishPromise_resolve=void 0,Y._finishPromise_reject=void 0}function yJ(W,Y){let w=Object.create(N0.prototype),V,q,A;if(Y.transform!==void 0)V=(j)=>Y.transform(j,w);else V=(j)=>{try{return A3(w,j),O(void 0)}catch(R){return _(R)}};if(Y.flush!==void 0)q=()=>Y.flush(w);else q=()=>O(void 0);if(Y.cancel!==void 0)A=(j)=>Y.cancel(j);else A=()=>O(void 0);hJ(W,w,V,q,A)}function PX(W){W._transformAlgorithm=void 0,W._flushAlgorithm=void 0,W._cancelAlgorithm=void 0}function A3(W,Y){let w=W._controlledTransformStream,V=w._readable._readableStreamController;if(!I4(V))throw new TypeError("Readable side is not in a state that permits enqueue");try{k4(V,Y)}catch(A){throw V2(w,A),w._readable._storedError}if(OJ(V)!==w._backpressure)IX(w,!0)}function ZJ(W,Y){_3(W._controlledTransformStream,Y)}function j3(W,Y){let w=W._transformAlgorithm(Y);return X$(w,void 0,(V)=>{throw _3(W._controlledTransformStream,V),V})}function mJ(W){let Y=W._controlledTransformStream,w=Y._readable._readableStreamController;M4(w);let V=new TypeError("TransformStream terminated");V2(Y,V)}function lJ(W,Y){let w=W._transformStreamController;if(W._backpressure){let V=W._backpressureChangePromise;return X$(V,()=>{let q=W._writable;if(q._state==="erroring")throw q._storedError;return j3(w,Y)})}return j3(w,Y)}function cJ(W,Y){let w=W._transformStreamController;if(w._finishPromise!==void 0)return w._finishPromise;let V=W._readable;w._finishPromise=D((A,j)=>{w._finishPromise_resolve=A,w._finishPromise_reject=j});let q=w._cancelAlgorithm(Y);return PX(w),x(q,()=>{if(V._state==="errored")b4(w,V._storedError);else m$(V._readableStreamController,Y),q2(w);return null},(A)=>{return m$(V._readableStreamController,A),b4(w,A),null}),w._finishPromise}function uJ(W){let Y=W._transformStreamController;if(Y._finishPromise!==void 0)return Y._finishPromise;let w=W._readable;Y._finishPromise=D((q,A)=>{Y._finishPromise_resolve=q,Y._finishPromise_reject=A});let V=Y._flushAlgorithm();return PX(Y),x(V,()=>{if(w._state==="errored")b4(Y,w._storedError);else M4(w._readableStreamController),q2(Y);return null},(q)=>{return m$(w._readableStreamController,q),b4(Y,q),null}),Y._finishPromise}function pJ(W){return IX(W,!1),W._backpressureChangePromise}function nJ(W,Y){let w=W._transformStreamController;if(w._finishPromise!==void 0)return w._finishPromise;let V=W._writable;w._finishPromise=D((A,j)=>{w._finishPromise_resolve=A,w._finishPromise_reject=j});let q=w._cancelAlgorithm(Y);return PX(w),x(q,()=>{if(V._state==="errored")b4(w,V._storedError);else L6(V._writableStreamController,Y),O2(W),q2(w);return null},(A)=>{return L6(V._writableStreamController,A),O2(W),b4(w,A),null}),w._finishPromise}function fX(W){return new TypeError(`TransformStreamDefaultController.prototype.${W} can only be used on a TransformStreamDefaultController`)}function q2(W){if(W._finishPromise_resolve===void 0)return;W._finishPromise_resolve(),W._finishPromise_resolve=void 0,W._finishPromise_reject=void 0}function b4(W,Y){if(W._finishPromise_reject===void 0)return;s(W._finishPromise),W._finishPromise_reject(Y),W._finishPromise_resolve=void 0,W._finishPromise_reject=void 0}function K3(W){return new TypeError(`TransformStream.prototype.${W} can only be used on a TransformStream`)}$.ByteLengthQueuingStrategy=v6,$.CountQueuingStrategy=C6,$.ReadableByteStreamController=J0,$.ReadableStream=O$,$.ReadableStreamBYOBReader=K0,$.ReadableStreamBYOBRequest=x0,$.ReadableStreamDefaultController=H0,$.ReadableStreamDefaultReader=A0,$.TransformStream=k6,$.TransformStreamDefaultController=N0,$.WritableStream=U0,$.WritableStreamDefaultController=Y4,$.WritableStreamDefaultWriter=Y0})});var nQ=j2(()=>{if(!globalThis.ReadableStream)try{let $=require("node:process"),{emitWarning:X}=$;try{$.emitWarning=()=>{},Object.assign(globalThis,require("node:stream/web")),$.emitWarning=X}catch(Q){throw $.emitWarning=X,Q}}catch($){Object.assign(globalThis,pQ())}try{let{Blob:$}=require("buffer");if($&&!$.prototype.stream)$.prototype.stream=function X(Q){let J=0,G=this;return new ReadableStream({type:"bytes",async pull(H){let z=await G.slice(J,Math.min(G.size,J+65536)).arrayBuffer();if(J+=z.byteLength,H.enqueue(new Uint8Array(z)),J===G.size)H.close()}})}}catch($){}});async function*y2($,X=!0){for(let Q of $)if("stream"in Q)yield*Q.stream();else if(ArrayBuffer.isView(Q))if(X){let J=Q.byteOffset,G=Q.byteOffset+Q.byteLength;while(J!==G){let H=Math.min(G-J,iQ),M=Q.buffer.slice(J,J+H);J+=M.byteLength,yield new Uint8Array(M)}}else yield Q;else{let J=0,G=Q;while(J!==G.size){let M=await G.slice(J,Math.min(G.size,J+iQ)).arrayBuffer();J+=M.byteLength,yield new Uint8Array(M)}}}var Gz,iQ=65536,dQ,JG,r$;var p6=z$(()=>{Gz=x$(nQ());/*! fetch-blob. MIT License. Jimmy Wärting <https://jimmy.warting.se/opensource> */dQ=class ${#$=[];#X="";#Q=0;#W="transparent";constructor(X=[],Q={}){if(typeof X!=="object"||X===null)throw new TypeError("Failed to construct 'Blob': The provided value cannot be converted to a sequence.");if(typeof X[Symbol.iterator]!=="function")throw new TypeError("Failed to construct 'Blob': The object must have a callable @@iterator property.");if(typeof Q!=="object"&&typeof Q!=="function")throw new TypeError("Failed to construct 'Blob': parameter 2 cannot convert to dictionary.");if(Q===null)Q={};let J=new TextEncoder;for(let H of X){let M;if(ArrayBuffer.isView(H))M=new Uint8Array(H.buffer.slice(H.byteOffset,H.byteOffset+H.byteLength));else if(H instanceof ArrayBuffer)M=new Uint8Array(H.slice(0));else if(H instanceof $)M=H;else M=J.encode(`${H}`);this.#Q+=ArrayBuffer.isView(M)?M.byteLength:M.size,this.#$.push(M)}this.#W=`${Q.endings===void 0?"transparent":Q.endings}`;let G=Q.type===void 0?"":String(Q.type);this.#X=/^[\x20-\x7E]*$/.test(G)?G:""}get size(){return this.#Q}get type(){return this.#X}async text(){let X=new TextDecoder,Q="";for await(let J of y2(this.#$,!1))Q+=X.decode(J,{stream:!0});return Q+=X.decode(),Q}async arrayBuffer(){let X=new Uint8Array(this.size),Q=0;for await(let J of y2(this.#$,!1))X.set(J,Q),Q+=J.length;return X.buffer}stream(){let X=y2(this.#$,!0);return new globalThis.ReadableStream({type:"bytes",async pull(Q){let J=await X.next();J.done?Q.close():Q.enqueue(J.value)},async cancel(){await X.return()}})}slice(X=0,Q=this.size,J=""){let{size:G}=this,H=X<0?Math.max(G+X,0):Math.min(X,G),M=Q<0?Math.max(G+Q,0):Math.min(Q,G),z=Math.max(M-H,0),D=this.#$,O=[],_=0;for(let x of D){if(_>=z)break;let h=ArrayBuffer.isView(x)?x.byteLength:x.size;if(H&&h<=H)H-=h,M-=h;else{let k;if(ArrayBuffer.isView(x))k=x.subarray(H,Math.min(h,M)),_+=k.byteLength;else k=x.slice(H,Math.min(h,M)),_+=k.size;M-=h,O.push(k),H=0}}let m=new $([],{type:String(J).toLowerCase()});return m.#Q=z,m.#$=O,m}get[Symbol.toStringTag](){return"Blob"}static[Symbol.hasInstance](X){return X&&typeof X==="object"&&typeof X.constructor==="function"&&(typeof X.stream==="function"||typeof X.arrayBuffer==="function")&&/^(Blob|File)$/.test(X[Symbol.toStringTag])}};Object.defineProperties(dQ.prototype,{size:{enumerable:!0},type:{enumerable:!0},slice:{enumerable:!0}});JG=dQ,r$=JG});var GG,YG,n0;var Z2=z$(()=>{p6();GG=class $ extends r${#$=0;#X="";constructor(X,Q,J={}){if(arguments.length<2)throw new TypeError(`Failed to construct 'File': 2 arguments required, but only ${arguments.length} present.`);super(X,J);if(J===null)J={};let G=J.lastModified===void 0?Date.now():Number(J.lastModified);if(!Number.isNaN(G))this.#$=G;this.#X=String(Q)}get name(){return this.#X}get lastModified(){return this.#$}get[Symbol.toStringTag](){return"File"}static[Symbol.hasInstance](X){return!!X&&X instanceof r$&&/^(File)$/.test(X[Symbol.toStringTag])}},YG=GG,n0=YG});function aQ($,X=r$){var Q=`${oQ()}${oQ()}`.replace(/\./g,"").slice(-28).padStart(32,"-"),J=[],G=`--${Q}\r
3
- Content-Disposition: form-data; name="`;return $.forEach((H,M)=>typeof H=="string"?J.push(G+m2(M)+`"\r
2
+ var s9=Object.create;var{getPrototypeOf:e9,defineProperty:k6,getOwnPropertyNames:_7,getOwnPropertyDescriptor:$2}=Object,L7=Object.prototype.hasOwnProperty;var C$=($,X,Q)=>{Q=$!=null?s9(e9($)):{};let J=X||!$||!$.__esModule?k6(Q,"default",{value:$,enumerable:!0}):Q;for(let G of _7($))if(!L7.call(J,G))k6(J,G,{get:()=>$[G],enumerable:!0});return J},E7=new WeakMap,X2=($)=>{var X=E7.get($),Q;if(X)return X;if(X=k6({},"__esModule",{value:!0}),$&&typeof $==="object"||typeof $==="function")_7($).map((J)=>!L7.call(X,J)&&k6(X,J,{get:()=>$[J],enumerable:!(Q=$2($,J))||Q.enumerable}));return E7.set($,X),X},xX=($,X)=>()=>(X||$((X={exports:{}}).exports,X),X.exports);var U8=($,X)=>{for(var Q in X)k6($,Q,{get:X[Q],enumerable:!0,configurable:!0,set:(J)=>X[Q]=()=>J})};var B$=($,X)=>()=>($&&(X=$($=0)),X);function W2($){I7=$}function hX(){return I7}function R($,X){let Q=hX(),J=ZX({issueData:X,data:$.data,path:$.path,errorMaps:[$.common.contextualErrorMap,$.schemaErrorMap,Q,Q===l4?void 0:l4].filter((G)=>!!G)});$.common.issues.push(J)}class A${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 J of X){if(J.status==="aborted")return l;if(J.status==="dirty")$.dirty();Q.push(J.value)}return{status:$.value,value:Q}}static async mergeObjectAsync($,X){let Q=[];for(let J of X){let G=await J.key,H=await J.value;Q.push({key:G,value:H})}return A$.mergeObjectSync($,Q)}static mergeObjectSync($,X){let Q={};for(let J of X){let{key:G,value:H}=J;if(G.status==="aborted")return l;if(H.status==="aborted")return l;if(G.status==="dirty")$.dirty();if(H.status==="dirty")$.dirty();if(G.value!=="__proto__"&&(typeof H.value!=="undefined"||J.alwaysSet))Q[G.value]=H.value}return{status:$.value,value:Q}}}function yX($,X,Q,J){if(Q==="a"&&!J)throw new TypeError("Private accessor was defined without a getter");if(typeof X==="function"?$!==X||!J:!X.has($))throw new TypeError("Cannot read private member from an object whose class did not declare it");return Q==="m"?J:Q==="a"?J.call($):J?J.value:X.get($)}function k7($,X,Q,J,G){if(J==="m")throw new TypeError("Private method is not writable");if(J==="a"&&!G)throw new TypeError("Private accessor was defined without a setter");if(typeof X==="function"?$!==X||!G:!X.has($))throw new TypeError("Cannot write private member to an object whose class did not declare it");return J==="a"?G.call($,Q):G?G.value=Q:X.set($,Q),Q}class n${constructor($,X,Q,J){this._cachedPath=[],this.parent=$,this.data=X,this._path=Q,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 i($){if(!$)return{};let{errorMap:X,invalid_type_error:Q,required_error:J,description:G}=$;if(X&&(Q||J))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:(M,z)=>{var B,O;let{message:q}=$;if(M.code==="invalid_enum_value")return{message:q!==null&&q!==void 0?q:z.defaultError};if(typeof z.data==="undefined")return{message:(B=q!==null&&q!==void 0?q:J)!==null&&B!==void 0?B:z.defaultError};if(M.code!=="invalid_type")return{message:z.defaultError};return{message:(O=q!==null&&q!==void 0?q:Q)!==null&&O!==void 0?O:z.defaultError}},description:G}}class p{get description(){return this._def.description}_getType($){return v0($.data)}_getOrReturnCtx($,X){return X||{common:$.parent.common,data:$.data,parsedType:v0($.data),schemaErrorMap:this._def.errorMap,path:$.path,parent:$.parent}}_processInputParams($){return{status:new A$,ctx:{common:$.parent.common,data:$.data,parsedType:v0($.data),schemaErrorMap:this._def.errorMap,path:$.path,parent:$.parent}}}_parseSync($){let X=this._parse($);if(f6(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){var Q;let J={common:{issues:[],async:(Q=X===null||X===void 0?void 0:X.async)!==null&&Q!==void 0?Q:!1,contextualErrorMap:X===null||X===void 0?void 0:X.errorMap},path:(X===null||X===void 0?void 0:X.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:$,parsedType:v0($)},G=this._parseSync({data:$,path:J.path,parent:J});return R7(J,G)}"~validate"($){var X,Q;let J={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:$,parsedType:v0($)};if(!this["~standard"].async)try{let G=this._parseSync({data:$,path:[],parent:J});return D4(G)?{value:G.value}:{issues:J.common.issues}}catch(G){if((Q=(X=G===null||G===void 0?void 0:G.message)===null||X===void 0?void 0:X.toLowerCase())===null||Q===void 0?void 0:Q.includes("encountered"))this["~standard"].async=!0;J.common={issues:[],async:!0}}return this._parseAsync({data:$,path:[],parent:J}).then((G)=>D4(G)?{value:G.value}:{issues:J.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===null||X===void 0?void 0:X.errorMap,async:!0},path:(X===null||X===void 0?void 0:X.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:$,parsedType:v0($)},J=this._parse({data:$,path:Q.path,parent:Q}),G=await(f6(J)?J:Promise.resolve(J));return R7(Q,G)}refine($,X){let Q=(J)=>{if(typeof X==="string"||typeof X==="undefined")return{message:X};else if(typeof X==="function")return X(J);else return X};return this._refinement((J,G)=>{let H=$(J),M=()=>G.addIssue({code:N.custom,...Q(J)});if(typeof Promise!=="undefined"&&H instanceof Promise)return H.then((z)=>{if(!z)return M(),!1;else return!0});if(!H)return M(),!1;else return!0})}refinement($,X){return this._refinement((Q,J)=>{if(!$(Q))return J.addIssue(typeof X==="function"?X(Q,J):X),!1;else return!0})}_refinement($){return new h$({schema:this,typeName:S.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 k$.create(this,this._def)}nullable(){return C0.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return u$.create(this)}promise(){return A4.create(this,this._def)}or($){return p4.create([this,$],this._def)}and($){return i4.create(this,$,this._def)}transform($){return new h$({...i(this._def),schema:this,typeName:S.ZodEffects,effect:{type:"transform",transform:$}})}default($){let X=typeof $==="function"?$:()=>$;return new r4({...i(this._def),innerType:this,defaultValue:X,typeName:S.ZodDefault})}brand(){return new lX({typeName:S.ZodBranded,type:this,...i(this._def)})}catch($){let X=typeof $==="function"?$:()=>$;return new t4({...i(this._def),innerType:this,catchValue:X,typeName:S.ZodCatch})}describe($){return new this.constructor({...this._def,description:$})}pipe($){return y6.create(this,$)}readonly(){return s4.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}function b7($){let X="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";if($.precision)X=`${X}\\.\\d{${$.precision}}`;else if($.precision==null)X=`${X}(\\.\\d+)?`;return X}function S2($){return new RegExp(`^${b7($)}$`)}function f7($){let X=`${P7}T${b7($)}`,Q=[];if(Q.push($.local?"Z?":"Z"),$.offset)Q.push("([+-]\\d{2}:?\\d{2})");return X=`${X}(${Q.join("|")})`,new RegExp(`^${X}$`)}function F2($,X){if((X==="v4"||!X)&&O2.test($))return!0;if((X==="v6"||!X)&&A2.test($))return!0;return!1}function E2($,X){if(!z2.test($))return!1;try{let[Q]=$.split("."),J=Q.replace(/-/g,"+").replace(/_/g,"/").padEnd(Q.length+(4-Q.length%4)%4,"="),G=JSON.parse(atob(J));if(typeof G!=="object"||G===null)return!1;if(!G.typ||!G.alg)return!1;if(X&&G.alg!==X)return!1;return!0}catch(Q){return!1}}function _2($,X){if((X==="v4"||!X)&&q2.test($))return!0;if((X==="v6"||!X)&&j2.test($))return!0;return!1}function L2($,X){let Q=($.toString().split(".")[1]||"").length,J=(X.toString().split(".")[1]||"").length,G=Q>J?Q:J,H=parseInt($.toFixed(G).replace(".","")),M=parseInt(X.toFixed(G).replace(".",""));return H%M/Math.pow(10,G)}function Z4($){if($ instanceof Y$){let X={};for(let Q in $.shape){let J=$.shape[Q];X[Q]=k$.create(Z4(J))}return new Y$({...$._def,shape:()=>X})}else if($ instanceof u$)return new u$({...$._def,type:Z4($.element)});else if($ instanceof k$)return k$.create(Z4($.unwrap()));else if($ instanceof C0)return C0.create(Z4($.unwrap()));else if($ instanceof z0)return z0.create($.items.map((X)=>Z4(X)));else return $}function _8($,X){let Q=v0($),J=v0(X);if($===X)return{valid:!0,data:$};else if(Q===v.object&&J===v.object){let G=X$.objectKeys(X),H=X$.objectKeys($).filter((z)=>G.indexOf(z)!==-1),M={...$,...X};for(let z of H){let B=_8($[z],X[z]);if(!B.valid)return{valid:!1};M[z]=B.data}return{valid:!0,data:M}}else if(Q===v.array&&J===v.array){if($.length!==X.length)return{valid:!1};let G=[];for(let H=0;H<$.length;H++){let M=$[H],z=X[H],B=_8(M,z);if(!B.valid)return{valid:!1};G.push(B.data)}return{valid:!0,data:G}}else if(Q===v.date&&J===v.date&&+$===+X)return{valid:!0,data:$};else return{valid:!1}}function T7($,X){return new p0({values:$,typeName:S.ZodEnum,...i(X)})}function v7($,X){let Q=typeof $==="function"?$(X):typeof $==="string"?{message:$}:$;return typeof Q==="string"?{message:Q}:Q}function g7($,X={},Q){if($)return O4.create().superRefine((J,G)=>{var H,M;let z=$(J);if(z instanceof Promise)return z.then((B)=>{var O,q;if(!B){let x=v7(X,J),T=(q=(O=x.fatal)!==null&&O!==void 0?O:Q)!==null&&q!==void 0?q:!0;G.addIssue({code:"custom",...x,fatal:T})}});if(!z){let B=v7(X,J),O=(M=(H=B.fatal)!==null&&H!==void 0?H:Q)!==null&&M!==void 0?M:!0;G.addIssue({code:"custom",...B,fatal:O})}return});return O4.create()}var X$,S8,v,v0=($)=>{switch(typeof $){case"undefined":return v.undefined;case"string":return v.string;case"number":return isNaN($)?v.nan:v.number;case"boolean":return v.boolean;case"function":return v.function;case"bigint":return v.bigint;case"symbol":return v.symbol;case"object":if(Array.isArray($))return v.array;if($===null)return v.null;if($.then&&typeof $.then==="function"&&$.catch&&typeof $.catch==="function")return v.promise;if(typeof Map!=="undefined"&&$ instanceof Map)return v.map;if(typeof Set!=="undefined"&&$ instanceof Set)return v.set;if(typeof Date!=="undefined"&&$ instanceof Date)return v.date;return v.object;default:return v.unknown}},N,Q2=($)=>{return JSON.stringify($,null,2).replace(/"([^"]+)":/g,"$1:")},I$,l4=($,X)=>{let Q;switch($.code){case N.invalid_type:if($.received===v.undefined)Q="Required";else Q=`Expected ${$.expected}, received ${$.received}`;break;case N.invalid_literal:Q=`Invalid literal value, expected ${JSON.stringify($.expected,X$.jsonStringifyReplacer)}`;break;case N.unrecognized_keys:Q=`Unrecognized key(s) in object: ${X$.joinValues($.keys,", ")}`;break;case N.invalid_union:Q="Invalid input";break;case N.invalid_union_discriminator:Q=`Invalid discriminator value. Expected ${X$.joinValues($.options)}`;break;case N.invalid_enum_value:Q=`Invalid enum value. Expected ${X$.joinValues($.options)}, received '${$.received}'`;break;case N.invalid_arguments:Q="Invalid function arguments";break;case N.invalid_return_type:Q="Invalid function return type";break;case N.invalid_date:Q="Invalid date";break;case N.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 X$.assertNever($.validation);else if($.validation!=="regex")Q=`Invalid ${$.validation}`;else Q="Invalid";break;case N.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==="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 N.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 N.custom:Q="Invalid input";break;case N.invalid_intersection_types:Q="Intersection results could not be merged";break;case N.not_multiple_of:Q=`Number must be a multiple of ${$.multipleOf}`;break;case N.not_finite:Q="Number must be finite";break;default:Q=X.defaultError,X$.assertNever($)}return{message:Q}},I7,ZX=($)=>{let{data:X,path:Q,errorMaps:J,issueData:G}=$,H=[...Q,...G.path||[]],M={...G,path:H};if(G.message!==void 0)return{...G,path:H,message:G.message};let z="",B=J.filter((O)=>!!O).slice().reverse();for(let O of B)z=O(M,{data:X,defaultError:z}).message;return{...G,path:H,message:z}},J2,l,y4=($)=>({status:"dirty",value:$}),N$=($)=>({status:"valid",value:$}),F8=($)=>$.status==="aborted",E8=($)=>$.status==="dirty",D4=($)=>$.status==="valid",f6=($)=>typeof Promise!=="undefined"&&$ instanceof Promise,b,P6,b6,R7=($,X)=>{if(D4(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 I$($.common.issues);return this._error=Q,this._error}}}},G2,Y2,H2,M2,w2,z2,B2,D2,V2="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",N8,O2,q2,A2,j2,K2,U2,P7="((\\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])))",N2,c$,u0,n0,c4,V4,T6,u4,n4,O4,c0,w0,g6,u$,Y$,p4,R0=($)=>{if($ instanceof d4)return R0($.schema);else if($ instanceof h$)return R0($.innerType());else if($ instanceof o4)return[$.value];else if($ instanceof p0)return $.options;else if($ instanceof a4)return X$.objectValues($.enum);else if($ instanceof r4)return R0($._def.innerType);else if($ instanceof u4)return[void 0];else if($ instanceof n4)return[null];else if($ instanceof k$)return[void 0,...R0($.unwrap())];else if($ instanceof C0)return[null,...R0($.unwrap())];else if($ instanceof lX)return R0($.unwrap());else if($ instanceof s4)return R0($.unwrap());else if($ instanceof t4)return R0($._def.innerType);else return[]},mX,i4,z0,x6,h6,q4,m4,d4,o4,p0,a4,A4,h$,k$,C0,r4,t4,Z6,R2,lX,y6,s4,v2,S,C2=($,X={message:`Input not instance of ${$.name}`})=>g7((Q)=>Q instanceof $,X),x7,h7,I2,k2,Z7,P2,b2,f2,T2,g2,x2,h2,Z2,y2,m2,l2,c2,u2,n2,p2,i2,d2,o2,a2,r2,t2,s2,e2,$3,C7,X3,Q3,W3,J3,G3=()=>x7().optional(),Y3=()=>h7().optional(),H3=()=>Z7().optional(),M3,w3,D;var i0=B$(()=>{(function($){$.assertEqual=(G)=>G;function X(G){}$.assertIs=X;function Q(G){throw new Error}$.assertNever=Q,$.arrayToEnum=(G)=>{let H={};for(let M of G)H[M]=M;return H},$.getValidEnumValues=(G)=>{let H=$.objectKeys(G).filter((z)=>typeof G[G[z]]!=="number"),M={};for(let z of H)M[z]=G[z];return $.objectValues(M)},$.objectValues=(G)=>{return $.objectKeys(G).map(function(H){return G[H]})},$.objectKeys=typeof Object.keys==="function"?(G)=>Object.keys(G):(G)=>{let H=[];for(let M in G)if(Object.prototype.hasOwnProperty.call(G,M))H.push(M);return H},$.find=(G,H)=>{for(let M of G)if(H(M))return M;return},$.isInteger=typeof Number.isInteger==="function"?(G)=>Number.isInteger(G):(G)=>typeof G==="number"&&isFinite(G)&&Math.floor(G)===G;function J(G,H=" | "){return G.map((M)=>typeof M==="string"?`'${M}'`:M).join(H)}$.joinValues=J,$.jsonStringifyReplacer=(G,H)=>{if(typeof H==="bigint")return H.toString();return H}})(X$||(X$={}));(function($){$.mergeShapes=(X,Q)=>{return{...X,...Q}}})(S8||(S8={}));v=X$.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),N=X$.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"]);I$=class I$ 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:[]},J=(G)=>{for(let H of G.issues)if(H.code==="invalid_union")H.unionErrors.map(J);else if(H.code==="invalid_return_type")J(H.returnTypeError);else if(H.code==="invalid_arguments")J(H.argumentsError);else if(H.path.length===0)Q._errors.push(X(H));else{let M=Q,z=0;while(z<H.path.length){let B=H.path[z];if(z!==H.path.length-1)M[B]=M[B]||{_errors:[]};else M[B]=M[B]||{_errors:[]},M[B]._errors.push(X(H));M=M[B],z++}}};return J(this),Q}static assert($){if(!($ instanceof I$))throw new Error(`Not a ZodError: ${$}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,X$.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten($=(X)=>X.message){let X={},Q=[];for(let J of this.issues)if(J.path.length>0)X[J.path[0]]=X[J.path[0]]||[],X[J.path[0]].push($(J));else Q.push($(J));return{formErrors:Q,fieldErrors:X}}get formErrors(){return this.flatten()}};I$.create=($)=>{return new I$($)};I7=l4;J2=[];l=Object.freeze({status:"aborted"});(function($){$.errToObj=(X)=>typeof X==="string"?{message:X}:X||{},$.toString=(X)=>typeof X==="string"?X:X===null||X===void 0?void 0:X.message})(b||(b={}));G2=/^c[^\s-]{8,}$/i,Y2=/^[0-9a-z]+$/,H2=/^[0-9A-HJKMNP-TV-Z]{26}$/i,M2=/^[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,w2=/^[a-z0-9_-]{21}$/i,z2=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,B2=/^[-+]?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)?)??$/,D2=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,O2=/^(?:(?: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])$/,q2=/^(?:(?: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])$/,A2=/^(([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]))$/,j2=/^(([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])$/,K2=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,U2=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,N2=new RegExp(`^${P7}$`);c$=class c$ extends p{_parse($){if(this._def.coerce)$.data=String($.data);if(this._getType($)!==v.string){let G=this._getOrReturnCtx($);return R(G,{code:N.invalid_type,expected:v.string,received:G.parsedType}),l}let Q=new A$,J=void 0;for(let G of this._def.checks)if(G.kind==="min"){if($.data.length<G.value)J=this._getOrReturnCtx($,J),R(J,{code:N.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)J=this._getOrReturnCtx($,J),R(J,{code:N.too_big,maximum:G.value,type:"string",inclusive:!0,exact:!1,message:G.message}),Q.dirty()}else if(G.kind==="length"){let H=$.data.length>G.value,M=$.data.length<G.value;if(H||M){if(J=this._getOrReturnCtx($,J),H)R(J,{code:N.too_big,maximum:G.value,type:"string",inclusive:!0,exact:!0,message:G.message});else if(M)R(J,{code:N.too_small,minimum:G.value,type:"string",inclusive:!0,exact:!0,message:G.message});Q.dirty()}}else if(G.kind==="email"){if(!D2.test($.data))J=this._getOrReturnCtx($,J),R(J,{validation:"email",code:N.invalid_string,message:G.message}),Q.dirty()}else if(G.kind==="emoji"){if(!N8)N8=new RegExp(V2,"u");if(!N8.test($.data))J=this._getOrReturnCtx($,J),R(J,{validation:"emoji",code:N.invalid_string,message:G.message}),Q.dirty()}else if(G.kind==="uuid"){if(!M2.test($.data))J=this._getOrReturnCtx($,J),R(J,{validation:"uuid",code:N.invalid_string,message:G.message}),Q.dirty()}else if(G.kind==="nanoid"){if(!w2.test($.data))J=this._getOrReturnCtx($,J),R(J,{validation:"nanoid",code:N.invalid_string,message:G.message}),Q.dirty()}else if(G.kind==="cuid"){if(!G2.test($.data))J=this._getOrReturnCtx($,J),R(J,{validation:"cuid",code:N.invalid_string,message:G.message}),Q.dirty()}else if(G.kind==="cuid2"){if(!Y2.test($.data))J=this._getOrReturnCtx($,J),R(J,{validation:"cuid2",code:N.invalid_string,message:G.message}),Q.dirty()}else if(G.kind==="ulid"){if(!H2.test($.data))J=this._getOrReturnCtx($,J),R(J,{validation:"ulid",code:N.invalid_string,message:G.message}),Q.dirty()}else if(G.kind==="url")try{new URL($.data)}catch(H){J=this._getOrReturnCtx($,J),R(J,{validation:"url",code:N.invalid_string,message:G.message}),Q.dirty()}else if(G.kind==="regex"){if(G.regex.lastIndex=0,!G.regex.test($.data))J=this._getOrReturnCtx($,J),R(J,{validation:"regex",code:N.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))J=this._getOrReturnCtx($,J),R(J,{code:N.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))J=this._getOrReturnCtx($,J),R(J,{code:N.invalid_string,validation:{startsWith:G.value},message:G.message}),Q.dirty()}else if(G.kind==="endsWith"){if(!$.data.endsWith(G.value))J=this._getOrReturnCtx($,J),R(J,{code:N.invalid_string,validation:{endsWith:G.value},message:G.message}),Q.dirty()}else if(G.kind==="datetime"){if(!f7(G).test($.data))J=this._getOrReturnCtx($,J),R(J,{code:N.invalid_string,validation:"datetime",message:G.message}),Q.dirty()}else if(G.kind==="date"){if(!N2.test($.data))J=this._getOrReturnCtx($,J),R(J,{code:N.invalid_string,validation:"date",message:G.message}),Q.dirty()}else if(G.kind==="time"){if(!S2(G).test($.data))J=this._getOrReturnCtx($,J),R(J,{code:N.invalid_string,validation:"time",message:G.message}),Q.dirty()}else if(G.kind==="duration"){if(!B2.test($.data))J=this._getOrReturnCtx($,J),R(J,{validation:"duration",code:N.invalid_string,message:G.message}),Q.dirty()}else if(G.kind==="ip"){if(!F2($.data,G.version))J=this._getOrReturnCtx($,J),R(J,{validation:"ip",code:N.invalid_string,message:G.message}),Q.dirty()}else if(G.kind==="jwt"){if(!E2($.data,G.alg))J=this._getOrReturnCtx($,J),R(J,{validation:"jwt",code:N.invalid_string,message:G.message}),Q.dirty()}else if(G.kind==="cidr"){if(!_2($.data,G.version))J=this._getOrReturnCtx($,J),R(J,{validation:"cidr",code:N.invalid_string,message:G.message}),Q.dirty()}else if(G.kind==="base64"){if(!K2.test($.data))J=this._getOrReturnCtx($,J),R(J,{validation:"base64",code:N.invalid_string,message:G.message}),Q.dirty()}else if(G.kind==="base64url"){if(!U2.test($.data))J=this._getOrReturnCtx($,J),R(J,{validation:"base64url",code:N.invalid_string,message:G.message}),Q.dirty()}else X$.assertNever(G);return{status:Q.value,value:$.data}}_regex($,X,Q){return this.refinement((J)=>$.test(J),{validation:X,code:N.invalid_string,...b.errToObj(Q)})}_addCheck($){return new c$({...this._def,checks:[...this._def.checks,$]})}email($){return this._addCheck({kind:"email",...b.errToObj($)})}url($){return this._addCheck({kind:"url",...b.errToObj($)})}emoji($){return this._addCheck({kind:"emoji",...b.errToObj($)})}uuid($){return this._addCheck({kind:"uuid",...b.errToObj($)})}nanoid($){return this._addCheck({kind:"nanoid",...b.errToObj($)})}cuid($){return this._addCheck({kind:"cuid",...b.errToObj($)})}cuid2($){return this._addCheck({kind:"cuid2",...b.errToObj($)})}ulid($){return this._addCheck({kind:"ulid",...b.errToObj($)})}base64($){return this._addCheck({kind:"base64",...b.errToObj($)})}base64url($){return this._addCheck({kind:"base64url",...b.errToObj($)})}jwt($){return this._addCheck({kind:"jwt",...b.errToObj($)})}ip($){return this._addCheck({kind:"ip",...b.errToObj($)})}cidr($){return this._addCheck({kind:"cidr",...b.errToObj($)})}datetime($){var X,Q;if(typeof $==="string")return this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:$});return this._addCheck({kind:"datetime",precision:typeof($===null||$===void 0?void 0:$.precision)==="undefined"?null:$===null||$===void 0?void 0:$.precision,offset:(X=$===null||$===void 0?void 0:$.offset)!==null&&X!==void 0?X:!1,local:(Q=$===null||$===void 0?void 0:$.local)!==null&&Q!==void 0?Q:!1,...b.errToObj($===null||$===void 0?void 0:$.message)})}date($){return this._addCheck({kind:"date",message:$})}time($){if(typeof $==="string")return this._addCheck({kind:"time",precision:null,message:$});return this._addCheck({kind:"time",precision:typeof($===null||$===void 0?void 0:$.precision)==="undefined"?null:$===null||$===void 0?void 0:$.precision,...b.errToObj($===null||$===void 0?void 0:$.message)})}duration($){return this._addCheck({kind:"duration",...b.errToObj($)})}regex($,X){return this._addCheck({kind:"regex",regex:$,...b.errToObj(X)})}includes($,X){return this._addCheck({kind:"includes",value:$,position:X===null||X===void 0?void 0:X.position,...b.errToObj(X===null||X===void 0?void 0:X.message)})}startsWith($,X){return this._addCheck({kind:"startsWith",value:$,...b.errToObj(X)})}endsWith($,X){return this._addCheck({kind:"endsWith",value:$,...b.errToObj(X)})}min($,X){return this._addCheck({kind:"min",value:$,...b.errToObj(X)})}max($,X){return this._addCheck({kind:"max",value:$,...b.errToObj(X)})}length($,X){return this._addCheck({kind:"length",value:$,...b.errToObj(X)})}nonempty($){return this.min(1,b.errToObj($))}trim(){return new c$({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new c$({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new c$({...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 $}};c$.create=($)=>{var X;return new c$({checks:[],typeName:S.ZodString,coerce:(X=$===null||$===void 0?void 0:$.coerce)!==null&&X!==void 0?X:!1,...i($)})};u0=class u0 extends p{constructor(){super(...arguments);this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse($){if(this._def.coerce)$.data=Number($.data);if(this._getType($)!==v.number){let G=this._getOrReturnCtx($);return R(G,{code:N.invalid_type,expected:v.number,received:G.parsedType}),l}let Q=void 0,J=new A$;for(let G of this._def.checks)if(G.kind==="int"){if(!X$.isInteger($.data))Q=this._getOrReturnCtx($,Q),R(Q,{code:N.invalid_type,expected:"integer",received:"float",message:G.message}),J.dirty()}else if(G.kind==="min"){if(G.inclusive?$.data<G.value:$.data<=G.value)Q=this._getOrReturnCtx($,Q),R(Q,{code:N.too_small,minimum:G.value,type:"number",inclusive:G.inclusive,exact:!1,message:G.message}),J.dirty()}else if(G.kind==="max"){if(G.inclusive?$.data>G.value:$.data>=G.value)Q=this._getOrReturnCtx($,Q),R(Q,{code:N.too_big,maximum:G.value,type:"number",inclusive:G.inclusive,exact:!1,message:G.message}),J.dirty()}else if(G.kind==="multipleOf"){if(L2($.data,G.value)!==0)Q=this._getOrReturnCtx($,Q),R(Q,{code:N.not_multiple_of,multipleOf:G.value,message:G.message}),J.dirty()}else if(G.kind==="finite"){if(!Number.isFinite($.data))Q=this._getOrReturnCtx($,Q),R(Q,{code:N.not_finite,message:G.message}),J.dirty()}else X$.assertNever(G);return{status:J.value,value:$.data}}gte($,X){return this.setLimit("min",$,!0,b.toString(X))}gt($,X){return this.setLimit("min",$,!1,b.toString(X))}lte($,X){return this.setLimit("max",$,!0,b.toString(X))}lt($,X){return this.setLimit("max",$,!1,b.toString(X))}setLimit($,X,Q,J){return new u0({...this._def,checks:[...this._def.checks,{kind:$,value:X,inclusive:Q,message:b.toString(J)}]})}_addCheck($){return new u0({...this._def,checks:[...this._def.checks,$]})}int($){return this._addCheck({kind:"int",message:b.toString($)})}positive($){return this._addCheck({kind:"min",value:0,inclusive:!1,message:b.toString($)})}negative($){return this._addCheck({kind:"max",value:0,inclusive:!1,message:b.toString($)})}nonpositive($){return this._addCheck({kind:"max",value:0,inclusive:!0,message:b.toString($)})}nonnegative($){return this._addCheck({kind:"min",value:0,inclusive:!0,message:b.toString($)})}multipleOf($,X){return this._addCheck({kind:"multipleOf",value:$,message:b.toString(X)})}finite($){return this._addCheck({kind:"finite",message:b.toString($)})}safe($){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:b.toString($)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:b.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"&&X$.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($)}};u0.create=($)=>{return new u0({checks:[],typeName:S.ZodNumber,coerce:($===null||$===void 0?void 0:$.coerce)||!1,...i($)})};n0=class n0 extends p{constructor(){super(...arguments);this.min=this.gte,this.max=this.lte}_parse($){if(this._def.coerce)try{$.data=BigInt($.data)}catch(G){return this._getInvalidInput($)}if(this._getType($)!==v.bigint)return this._getInvalidInput($);let Q=void 0,J=new A$;for(let G of this._def.checks)if(G.kind==="min"){if(G.inclusive?$.data<G.value:$.data<=G.value)Q=this._getOrReturnCtx($,Q),R(Q,{code:N.too_small,type:"bigint",minimum:G.value,inclusive:G.inclusive,message:G.message}),J.dirty()}else if(G.kind==="max"){if(G.inclusive?$.data>G.value:$.data>=G.value)Q=this._getOrReturnCtx($,Q),R(Q,{code:N.too_big,type:"bigint",maximum:G.value,inclusive:G.inclusive,message:G.message}),J.dirty()}else if(G.kind==="multipleOf"){if($.data%G.value!==BigInt(0))Q=this._getOrReturnCtx($,Q),R(Q,{code:N.not_multiple_of,multipleOf:G.value,message:G.message}),J.dirty()}else X$.assertNever(G);return{status:J.value,value:$.data}}_getInvalidInput($){let X=this._getOrReturnCtx($);return R(X,{code:N.invalid_type,expected:v.bigint,received:X.parsedType}),l}gte($,X){return this.setLimit("min",$,!0,b.toString(X))}gt($,X){return this.setLimit("min",$,!1,b.toString(X))}lte($,X){return this.setLimit("max",$,!0,b.toString(X))}lt($,X){return this.setLimit("max",$,!1,b.toString(X))}setLimit($,X,Q,J){return new n0({...this._def,checks:[...this._def.checks,{kind:$,value:X,inclusive:Q,message:b.toString(J)}]})}_addCheck($){return new n0({...this._def,checks:[...this._def.checks,$]})}positive($){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:b.toString($)})}negative($){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:b.toString($)})}nonpositive($){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:b.toString($)})}nonnegative($){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:b.toString($)})}multipleOf($,X){return this._addCheck({kind:"multipleOf",value:$,message:b.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 $}};n0.create=($)=>{var X;return new n0({checks:[],typeName:S.ZodBigInt,coerce:(X=$===null||$===void 0?void 0:$.coerce)!==null&&X!==void 0?X:!1,...i($)})};c4=class c4 extends p{_parse($){if(this._def.coerce)$.data=Boolean($.data);if(this._getType($)!==v.boolean){let Q=this._getOrReturnCtx($);return R(Q,{code:N.invalid_type,expected:v.boolean,received:Q.parsedType}),l}return N$($.data)}};c4.create=($)=>{return new c4({typeName:S.ZodBoolean,coerce:($===null||$===void 0?void 0:$.coerce)||!1,...i($)})};V4=class V4 extends p{_parse($){if(this._def.coerce)$.data=new Date($.data);if(this._getType($)!==v.date){let G=this._getOrReturnCtx($);return R(G,{code:N.invalid_type,expected:v.date,received:G.parsedType}),l}if(isNaN($.data.getTime())){let G=this._getOrReturnCtx($);return R(G,{code:N.invalid_date}),l}let Q=new A$,J=void 0;for(let G of this._def.checks)if(G.kind==="min"){if($.data.getTime()<G.value)J=this._getOrReturnCtx($,J),R(J,{code:N.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)J=this._getOrReturnCtx($,J),R(J,{code:N.too_big,message:G.message,inclusive:!0,exact:!1,maximum:G.value,type:"date"}),Q.dirty()}else X$.assertNever(G);return{status:Q.value,value:new Date($.data.getTime())}}_addCheck($){return new V4({...this._def,checks:[...this._def.checks,$]})}min($,X){return this._addCheck({kind:"min",value:$.getTime(),message:b.toString(X)})}max($,X){return this._addCheck({kind:"max",value:$.getTime(),message:b.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}};V4.create=($)=>{return new V4({checks:[],coerce:($===null||$===void 0?void 0:$.coerce)||!1,typeName:S.ZodDate,...i($)})};T6=class T6 extends p{_parse($){if(this._getType($)!==v.symbol){let Q=this._getOrReturnCtx($);return R(Q,{code:N.invalid_type,expected:v.symbol,received:Q.parsedType}),l}return N$($.data)}};T6.create=($)=>{return new T6({typeName:S.ZodSymbol,...i($)})};u4=class u4 extends p{_parse($){if(this._getType($)!==v.undefined){let Q=this._getOrReturnCtx($);return R(Q,{code:N.invalid_type,expected:v.undefined,received:Q.parsedType}),l}return N$($.data)}};u4.create=($)=>{return new u4({typeName:S.ZodUndefined,...i($)})};n4=class n4 extends p{_parse($){if(this._getType($)!==v.null){let Q=this._getOrReturnCtx($);return R(Q,{code:N.invalid_type,expected:v.null,received:Q.parsedType}),l}return N$($.data)}};n4.create=($)=>{return new n4({typeName:S.ZodNull,...i($)})};O4=class O4 extends p{constructor(){super(...arguments);this._any=!0}_parse($){return N$($.data)}};O4.create=($)=>{return new O4({typeName:S.ZodAny,...i($)})};c0=class c0 extends p{constructor(){super(...arguments);this._unknown=!0}_parse($){return N$($.data)}};c0.create=($)=>{return new c0({typeName:S.ZodUnknown,...i($)})};w0=class w0 extends p{_parse($){let X=this._getOrReturnCtx($);return R(X,{code:N.invalid_type,expected:v.never,received:X.parsedType}),l}};w0.create=($)=>{return new w0({typeName:S.ZodNever,...i($)})};g6=class g6 extends p{_parse($){if(this._getType($)!==v.undefined){let Q=this._getOrReturnCtx($);return R(Q,{code:N.invalid_type,expected:v.void,received:Q.parsedType}),l}return N$($.data)}};g6.create=($)=>{return new g6({typeName:S.ZodVoid,...i($)})};u$=class u$ extends p{_parse($){let{ctx:X,status:Q}=this._processInputParams($),J=this._def;if(X.parsedType!==v.array)return R(X,{code:N.invalid_type,expected:v.array,received:X.parsedType}),l;if(J.exactLength!==null){let H=X.data.length>J.exactLength.value,M=X.data.length<J.exactLength.value;if(H||M)R(X,{code:H?N.too_big:N.too_small,minimum:M?J.exactLength.value:void 0,maximum:H?J.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:J.exactLength.message}),Q.dirty()}if(J.minLength!==null){if(X.data.length<J.minLength.value)R(X,{code:N.too_small,minimum:J.minLength.value,type:"array",inclusive:!0,exact:!1,message:J.minLength.message}),Q.dirty()}if(J.maxLength!==null){if(X.data.length>J.maxLength.value)R(X,{code:N.too_big,maximum:J.maxLength.value,type:"array",inclusive:!0,exact:!1,message:J.maxLength.message}),Q.dirty()}if(X.common.async)return Promise.all([...X.data].map((H,M)=>{return J.type._parseAsync(new n$(X,H,X.path,M))})).then((H)=>{return A$.mergeArray(Q,H)});let G=[...X.data].map((H,M)=>{return J.type._parseSync(new n$(X,H,X.path,M))});return A$.mergeArray(Q,G)}get element(){return this._def.type}min($,X){return new u$({...this._def,minLength:{value:$,message:b.toString(X)}})}max($,X){return new u$({...this._def,maxLength:{value:$,message:b.toString(X)}})}length($,X){return new u$({...this._def,exactLength:{value:$,message:b.toString(X)}})}nonempty($){return this.min(1,$)}};u$.create=($,X)=>{return new u$({type:$,minLength:null,maxLength:null,exactLength:null,typeName:S.ZodArray,...i(X)})};Y$=class Y$ extends p{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=X$.objectKeys($);return this._cached={shape:$,keys:X}}_parse($){if(this._getType($)!==v.object){let B=this._getOrReturnCtx($);return R(B,{code:N.invalid_type,expected:v.object,received:B.parsedType}),l}let{status:Q,ctx:J}=this._processInputParams($),{shape:G,keys:H}=this._getCached(),M=[];if(!(this._def.catchall instanceof w0&&this._def.unknownKeys==="strip")){for(let B in J.data)if(!H.includes(B))M.push(B)}let z=[];for(let B of H){let O=G[B],q=J.data[B];z.push({key:{status:"valid",value:B},value:O._parse(new n$(J,q,J.path,B)),alwaysSet:B in J.data})}if(this._def.catchall instanceof w0){let B=this._def.unknownKeys;if(B==="passthrough")for(let O of M)z.push({key:{status:"valid",value:O},value:{status:"valid",value:J.data[O]}});else if(B==="strict"){if(M.length>0)R(J,{code:N.unrecognized_keys,keys:M}),Q.dirty()}else if(B==="strip");else throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let B=this._def.catchall;for(let O of M){let q=J.data[O];z.push({key:{status:"valid",value:O},value:B._parse(new n$(J,q,J.path,O)),alwaysSet:O in J.data})}}if(J.common.async)return Promise.resolve().then(async()=>{let B=[];for(let O of z){let q=await O.key,x=await O.value;B.push({key:q,value:x,alwaysSet:O.alwaysSet})}return B}).then((B)=>{return A$.mergeObjectSync(Q,B)});else return A$.mergeObjectSync(Q,z)}get shape(){return this._def.shape()}strict($){return b.errToObj,new Y$({...this._def,unknownKeys:"strict",...$!==void 0?{errorMap:(X,Q)=>{var J,G,H,M;let z=(H=(G=(J=this._def).errorMap)===null||G===void 0?void 0:G.call(J,X,Q).message)!==null&&H!==void 0?H:Q.defaultError;if(X.code==="unrecognized_keys")return{message:(M=b.errToObj($).message)!==null&&M!==void 0?M:z};return{message:z}}}:{}})}strip(){return new Y$({...this._def,unknownKeys:"strip"})}passthrough(){return new Y$({...this._def,unknownKeys:"passthrough"})}extend($){return new Y$({...this._def,shape:()=>({...this._def.shape(),...$})})}merge($){return new Y$({unknownKeys:$._def.unknownKeys,catchall:$._def.catchall,shape:()=>({...this._def.shape(),...$._def.shape()}),typeName:S.ZodObject})}setKey($,X){return this.augment({[$]:X})}catchall($){return new Y$({...this._def,catchall:$})}pick($){let X={};return X$.objectKeys($).forEach((Q)=>{if($[Q]&&this.shape[Q])X[Q]=this.shape[Q]}),new Y$({...this._def,shape:()=>X})}omit($){let X={};return X$.objectKeys(this.shape).forEach((Q)=>{if(!$[Q])X[Q]=this.shape[Q]}),new Y$({...this._def,shape:()=>X})}deepPartial(){return Z4(this)}partial($){let X={};return X$.objectKeys(this.shape).forEach((Q)=>{let J=this.shape[Q];if($&&!$[Q])X[Q]=J;else X[Q]=J.optional()}),new Y$({...this._def,shape:()=>X})}required($){let X={};return X$.objectKeys(this.shape).forEach((Q)=>{if($&&!$[Q])X[Q]=this.shape[Q];else{let G=this.shape[Q];while(G instanceof k$)G=G._def.innerType;X[Q]=G}}),new Y$({...this._def,shape:()=>X})}keyof(){return T7(X$.objectKeys(this.shape))}};Y$.create=($,X)=>{return new Y$({shape:()=>$,unknownKeys:"strip",catchall:w0.create(),typeName:S.ZodObject,...i(X)})};Y$.strictCreate=($,X)=>{return new Y$({shape:()=>$,unknownKeys:"strict",catchall:w0.create(),typeName:S.ZodObject,...i(X)})};Y$.lazycreate=($,X)=>{return new Y$({shape:$,unknownKeys:"strip",catchall:w0.create(),typeName:S.ZodObject,...i(X)})};p4=class p4 extends p{_parse($){let{ctx:X}=this._processInputParams($),Q=this._def.options;function J(G){for(let M of G)if(M.result.status==="valid")return M.result;for(let M of G)if(M.result.status==="dirty")return X.common.issues.push(...M.ctx.common.issues),M.result;let H=G.map((M)=>new I$(M.ctx.common.issues));return R(X,{code:N.invalid_union,unionErrors:H}),l}if(X.common.async)return Promise.all(Q.map(async(G)=>{let H={...X,common:{...X.common,issues:[]},parent:null};return{result:await G._parseAsync({data:X.data,path:X.path,parent:H}),ctx:H}})).then(J);else{let G=void 0,H=[];for(let z of Q){let B={...X,common:{...X.common,issues:[]},parent:null},O=z._parseSync({data:X.data,path:X.path,parent:B});if(O.status==="valid")return O;else if(O.status==="dirty"&&!G)G={result:O,ctx:B};if(B.common.issues.length)H.push(B.common.issues)}if(G)return X.common.issues.push(...G.ctx.common.issues),G.result;let M=H.map((z)=>new I$(z));return R(X,{code:N.invalid_union,unionErrors:M}),l}}get options(){return this._def.options}};p4.create=($,X)=>{return new p4({options:$,typeName:S.ZodUnion,...i(X)})};mX=class mX extends p{_parse($){let{ctx:X}=this._processInputParams($);if(X.parsedType!==v.object)return R(X,{code:N.invalid_type,expected:v.object,received:X.parsedType}),l;let Q=this.discriminator,J=X.data[Q],G=this.optionsMap.get(J);if(!G)return R(X,{code:N.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[Q]}),l;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 J=new Map;for(let G of X){let H=R0(G.shape[$]);if(!H.length)throw new Error(`A discriminator value for key \`${$}\` could not be extracted from all schema options`);for(let M of H){if(J.has(M))throw new Error(`Discriminator property ${String($)} has duplicate value ${String(M)}`);J.set(M,G)}}return new mX({typeName:S.ZodDiscriminatedUnion,discriminator:$,options:X,optionsMap:J,...i(Q)})}};i4=class i4 extends p{_parse($){let{status:X,ctx:Q}=this._processInputParams($),J=(G,H)=>{if(F8(G)||F8(H))return l;let M=_8(G.value,H.value);if(!M.valid)return R(Q,{code:N.invalid_intersection_types}),l;if(E8(G)||E8(H))X.dirty();return{status:X.value,value:M.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,H])=>J(G,H));else return J(this._def.left._parseSync({data:Q.data,path:Q.path,parent:Q}),this._def.right._parseSync({data:Q.data,path:Q.path,parent:Q}))}};i4.create=($,X,Q)=>{return new i4({left:$,right:X,typeName:S.ZodIntersection,...i(Q)})};z0=class z0 extends p{_parse($){let{status:X,ctx:Q}=this._processInputParams($);if(Q.parsedType!==v.array)return R(Q,{code:N.invalid_type,expected:v.array,received:Q.parsedType}),l;if(Q.data.length<this._def.items.length)return R(Q,{code:N.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),l;if(!this._def.rest&&Q.data.length>this._def.items.length)R(Q,{code:N.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),X.dirty();let G=[...Q.data].map((H,M)=>{let z=this._def.items[M]||this._def.rest;if(!z)return null;return z._parse(new n$(Q,H,Q.path,M))}).filter((H)=>!!H);if(Q.common.async)return Promise.all(G).then((H)=>{return A$.mergeArray(X,H)});else return A$.mergeArray(X,G)}get items(){return this._def.items}rest($){return new z0({...this._def,rest:$})}};z0.create=($,X)=>{if(!Array.isArray($))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new z0({items:$,typeName:S.ZodTuple,rest:null,...i(X)})};x6=class x6 extends p{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse($){let{status:X,ctx:Q}=this._processInputParams($);if(Q.parsedType!==v.object)return R(Q,{code:N.invalid_type,expected:v.object,received:Q.parsedType}),l;let J=[],G=this._def.keyType,H=this._def.valueType;for(let M in Q.data)J.push({key:G._parse(new n$(Q,M,Q.path,M)),value:H._parse(new n$(Q,Q.data[M],Q.path,M)),alwaysSet:M in Q.data});if(Q.common.async)return A$.mergeObjectAsync(X,J);else return A$.mergeObjectSync(X,J)}get element(){return this._def.valueType}static create($,X,Q){if(X instanceof p)return new x6({keyType:$,valueType:X,typeName:S.ZodRecord,...i(Q)});return new x6({keyType:c$.create(),valueType:$,typeName:S.ZodRecord,...i(X)})}};h6=class h6 extends p{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse($){let{status:X,ctx:Q}=this._processInputParams($);if(Q.parsedType!==v.map)return R(Q,{code:N.invalid_type,expected:v.map,received:Q.parsedType}),l;let J=this._def.keyType,G=this._def.valueType,H=[...Q.data.entries()].map(([M,z],B)=>{return{key:J._parse(new n$(Q,M,Q.path,[B,"key"])),value:G._parse(new n$(Q,z,Q.path,[B,"value"]))}});if(Q.common.async){let M=new Map;return Promise.resolve().then(async()=>{for(let z of H){let B=await z.key,O=await z.value;if(B.status==="aborted"||O.status==="aborted")return l;if(B.status==="dirty"||O.status==="dirty")X.dirty();M.set(B.value,O.value)}return{status:X.value,value:M}})}else{let M=new Map;for(let z of H){let{key:B,value:O}=z;if(B.status==="aborted"||O.status==="aborted")return l;if(B.status==="dirty"||O.status==="dirty")X.dirty();M.set(B.value,O.value)}return{status:X.value,value:M}}}};h6.create=($,X,Q)=>{return new h6({valueType:X,keyType:$,typeName:S.ZodMap,...i(Q)})};q4=class q4 extends p{_parse($){let{status:X,ctx:Q}=this._processInputParams($);if(Q.parsedType!==v.set)return R(Q,{code:N.invalid_type,expected:v.set,received:Q.parsedType}),l;let J=this._def;if(J.minSize!==null){if(Q.data.size<J.minSize.value)R(Q,{code:N.too_small,minimum:J.minSize.value,type:"set",inclusive:!0,exact:!1,message:J.minSize.message}),X.dirty()}if(J.maxSize!==null){if(Q.data.size>J.maxSize.value)R(Q,{code:N.too_big,maximum:J.maxSize.value,type:"set",inclusive:!0,exact:!1,message:J.maxSize.message}),X.dirty()}let G=this._def.valueType;function H(z){let B=new Set;for(let O of z){if(O.status==="aborted")return l;if(O.status==="dirty")X.dirty();B.add(O.value)}return{status:X.value,value:B}}let M=[...Q.data.values()].map((z,B)=>G._parse(new n$(Q,z,Q.path,B)));if(Q.common.async)return Promise.all(M).then((z)=>H(z));else return H(M)}min($,X){return new q4({...this._def,minSize:{value:$,message:b.toString(X)}})}max($,X){return new q4({...this._def,maxSize:{value:$,message:b.toString(X)}})}size($,X){return this.min($,X).max($,X)}nonempty($){return this.min(1,$)}};q4.create=($,X)=>{return new q4({valueType:$,minSize:null,maxSize:null,typeName:S.ZodSet,...i(X)})};m4=class m4 extends p{constructor(){super(...arguments);this.validate=this.implement}_parse($){let{ctx:X}=this._processInputParams($);if(X.parsedType!==v.function)return R(X,{code:N.invalid_type,expected:v.function,received:X.parsedType}),l;function Q(M,z){return ZX({data:M,path:X.path,errorMaps:[X.common.contextualErrorMap,X.schemaErrorMap,hX(),l4].filter((B)=>!!B),issueData:{code:N.invalid_arguments,argumentsError:z}})}function J(M,z){return ZX({data:M,path:X.path,errorMaps:[X.common.contextualErrorMap,X.schemaErrorMap,hX(),l4].filter((B)=>!!B),issueData:{code:N.invalid_return_type,returnTypeError:z}})}let G={errorMap:X.common.contextualErrorMap},H=X.data;if(this._def.returns instanceof A4){let M=this;return N$(async function(...z){let B=new I$([]),O=await M._def.args.parseAsync(z,G).catch((T)=>{throw B.addIssue(Q(z,T)),B}),q=await Reflect.apply(H,this,O);return await M._def.returns._def.type.parseAsync(q,G).catch((T)=>{throw B.addIssue(J(q,T)),B})})}else{let M=this;return N$(function(...z){let B=M._def.args.safeParse(z,G);if(!B.success)throw new I$([Q(z,B.error)]);let O=Reflect.apply(H,this,B.data),q=M._def.returns.safeParse(O,G);if(!q.success)throw new I$([J(O,q.error)]);return q.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...$){return new m4({...this._def,args:z0.create($).rest(c0.create())})}returns($){return new m4({...this._def,returns:$})}implement($){return this.parse($)}strictImplement($){return this.parse($)}static create($,X,Q){return new m4({args:$?$:z0.create([]).rest(c0.create()),returns:X||c0.create(),typeName:S.ZodFunction,...i(Q)})}};d4=class d4 extends p{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})}};d4.create=($,X)=>{return new d4({getter:$,typeName:S.ZodLazy,...i(X)})};o4=class o4 extends p{_parse($){if($.data!==this._def.value){let X=this._getOrReturnCtx($);return R(X,{received:X.data,code:N.invalid_literal,expected:this._def.value}),l}return{status:"valid",value:$.data}}get value(){return this._def.value}};o4.create=($,X)=>{return new o4({value:$,typeName:S.ZodLiteral,...i(X)})};p0=class p0 extends p{constructor(){super(...arguments);P6.set(this,void 0)}_parse($){if(typeof $.data!=="string"){let X=this._getOrReturnCtx($),Q=this._def.values;return R(X,{expected:X$.joinValues(Q),received:X.parsedType,code:N.invalid_type}),l}if(!yX(this,P6,"f"))k7(this,P6,new Set(this._def.values),"f");if(!yX(this,P6,"f").has($.data)){let X=this._getOrReturnCtx($),Q=this._def.values;return R(X,{received:X.data,code:N.invalid_enum_value,options:Q}),l}return N$($.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 p0.create($,{...this._def,...X})}exclude($,X=this._def){return p0.create(this.options.filter((Q)=>!$.includes(Q)),{...this._def,...X})}};P6=new WeakMap;p0.create=T7;a4=class a4 extends p{constructor(){super(...arguments);b6.set(this,void 0)}_parse($){let X=X$.getValidEnumValues(this._def.values),Q=this._getOrReturnCtx($);if(Q.parsedType!==v.string&&Q.parsedType!==v.number){let J=X$.objectValues(X);return R(Q,{expected:X$.joinValues(J),received:Q.parsedType,code:N.invalid_type}),l}if(!yX(this,b6,"f"))k7(this,b6,new Set(X$.getValidEnumValues(this._def.values)),"f");if(!yX(this,b6,"f").has($.data)){let J=X$.objectValues(X);return R(Q,{received:Q.data,code:N.invalid_enum_value,options:J}),l}return N$($.data)}get enum(){return this._def.values}};b6=new WeakMap;a4.create=($,X)=>{return new a4({values:$,typeName:S.ZodNativeEnum,...i(X)})};A4=class A4 extends p{unwrap(){return this._def.type}_parse($){let{ctx:X}=this._processInputParams($);if(X.parsedType!==v.promise&&X.common.async===!1)return R(X,{code:N.invalid_type,expected:v.promise,received:X.parsedType}),l;let Q=X.parsedType===v.promise?X.data:Promise.resolve(X.data);return N$(Q.then((J)=>{return this._def.type.parseAsync(J,{path:X.path,errorMap:X.common.contextualErrorMap})}))}};A4.create=($,X)=>{return new A4({type:$,typeName:S.ZodPromise,...i(X)})};h$=class h$ extends p{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===S.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse($){let{status:X,ctx:Q}=this._processInputParams($),J=this._def.effect||null,G={addIssue:(H)=>{if(R(Q,H),H.fatal)X.abort();else X.dirty()},get path(){return Q.path}};if(G.addIssue=G.addIssue.bind(G),J.type==="preprocess"){let H=J.transform(Q.data,G);if(Q.common.async)return Promise.resolve(H).then(async(M)=>{if(X.value==="aborted")return l;let z=await this._def.schema._parseAsync({data:M,path:Q.path,parent:Q});if(z.status==="aborted")return l;if(z.status==="dirty")return y4(z.value);if(X.value==="dirty")return y4(z.value);return z});else{if(X.value==="aborted")return l;let M=this._def.schema._parseSync({data:H,path:Q.path,parent:Q});if(M.status==="aborted")return l;if(M.status==="dirty")return y4(M.value);if(X.value==="dirty")return y4(M.value);return M}}if(J.type==="refinement"){let H=(M)=>{let z=J.refinement(M,G);if(Q.common.async)return Promise.resolve(z);if(z instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return M};if(Q.common.async===!1){let M=this._def.schema._parseSync({data:Q.data,path:Q.path,parent:Q});if(M.status==="aborted")return l;if(M.status==="dirty")X.dirty();return H(M.value),{status:X.value,value:M.value}}else return this._def.schema._parseAsync({data:Q.data,path:Q.path,parent:Q}).then((M)=>{if(M.status==="aborted")return l;if(M.status==="dirty")X.dirty();return H(M.value).then(()=>{return{status:X.value,value:M.value}})})}if(J.type==="transform")if(Q.common.async===!1){let H=this._def.schema._parseSync({data:Q.data,path:Q.path,parent:Q});if(!D4(H))return H;let M=J.transform(H.value,G);if(M instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:X.value,value:M}}else return this._def.schema._parseAsync({data:Q.data,path:Q.path,parent:Q}).then((H)=>{if(!D4(H))return H;return Promise.resolve(J.transform(H.value,G)).then((M)=>({status:X.value,value:M}))});X$.assertNever(J)}};h$.create=($,X,Q)=>{return new h$({schema:$,typeName:S.ZodEffects,effect:X,...i(Q)})};h$.createWithPreprocess=($,X,Q)=>{return new h$({schema:X,effect:{type:"preprocess",transform:$},typeName:S.ZodEffects,...i(Q)})};k$=class k$ extends p{_parse($){if(this._getType($)===v.undefined)return N$(void 0);return this._def.innerType._parse($)}unwrap(){return this._def.innerType}};k$.create=($,X)=>{return new k$({innerType:$,typeName:S.ZodOptional,...i(X)})};C0=class C0 extends p{_parse($){if(this._getType($)===v.null)return N$(null);return this._def.innerType._parse($)}unwrap(){return this._def.innerType}};C0.create=($,X)=>{return new C0({innerType:$,typeName:S.ZodNullable,...i(X)})};r4=class r4 extends p{_parse($){let{ctx:X}=this._processInputParams($),Q=X.data;if(X.parsedType===v.undefined)Q=this._def.defaultValue();return this._def.innerType._parse({data:Q,path:X.path,parent:X})}removeDefault(){return this._def.innerType}};r4.create=($,X)=>{return new r4({innerType:$,typeName:S.ZodDefault,defaultValue:typeof X.default==="function"?X.default:()=>X.default,...i(X)})};t4=class t4 extends p{_parse($){let{ctx:X}=this._processInputParams($),Q={...X,common:{...X.common,issues:[]}},J=this._def.innerType._parse({data:Q.data,path:Q.path,parent:{...Q}});if(f6(J))return J.then((G)=>{return{status:"valid",value:G.status==="valid"?G.value:this._def.catchValue({get error(){return new I$(Q.common.issues)},input:Q.data})}});else return{status:"valid",value:J.status==="valid"?J.value:this._def.catchValue({get error(){return new I$(Q.common.issues)},input:Q.data})}}removeCatch(){return this._def.innerType}};t4.create=($,X)=>{return new t4({innerType:$,typeName:S.ZodCatch,catchValue:typeof X.catch==="function"?X.catch:()=>X.catch,...i(X)})};Z6=class Z6 extends p{_parse($){if(this._getType($)!==v.nan){let Q=this._getOrReturnCtx($);return R(Q,{code:N.invalid_type,expected:v.nan,received:Q.parsedType}),l}return{status:"valid",value:$.data}}};Z6.create=($)=>{return new Z6({typeName:S.ZodNaN,...i($)})};R2=Symbol("zod_brand");lX=class lX extends p{_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}};y6=class y6 extends p{_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 l;if(G.status==="dirty")return X.dirty(),y4(G.value);else return this._def.out._parseAsync({data:G.value,path:Q.path,parent:Q})})();else{let J=this._def.in._parseSync({data:Q.data,path:Q.path,parent:Q});if(J.status==="aborted")return l;if(J.status==="dirty")return X.dirty(),{status:"dirty",value:J.value};else return this._def.out._parseSync({data:J.value,path:Q.path,parent:Q})}}static create($,X){return new y6({in:$,out:X,typeName:S.ZodPipeline})}};s4=class s4 extends p{_parse($){let X=this._def.innerType._parse($),Q=(J)=>{if(D4(J))J.value=Object.freeze(J.value);return J};return f6(X)?X.then((J)=>Q(J)):Q(X)}unwrap(){return this._def.innerType}};s4.create=($,X)=>{return new s4({innerType:$,typeName:S.ZodReadonly,...i(X)})};v2={object:Y$.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"})(S||(S={}));x7=c$.create,h7=u0.create,I2=Z6.create,k2=n0.create,Z7=c4.create,P2=V4.create,b2=T6.create,f2=u4.create,T2=n4.create,g2=O4.create,x2=c0.create,h2=w0.create,Z2=g6.create,y2=u$.create,m2=Y$.create,l2=Y$.strictCreate,c2=p4.create,u2=mX.create,n2=i4.create,p2=z0.create,i2=x6.create,d2=h6.create,o2=q4.create,a2=m4.create,r2=d4.create,t2=o4.create,s2=p0.create,e2=a4.create,$3=A4.create,C7=h$.create,X3=k$.create,Q3=C0.create,W3=h$.createWithPreprocess,J3=y6.create,M3={string:($)=>c$.create({...$,coerce:!0}),number:($)=>u0.create({...$,coerce:!0}),boolean:($)=>c4.create({...$,coerce:!0}),bigint:($)=>n0.create({...$,coerce:!0}),date:($)=>V4.create({...$,coerce:!0})},w3=l,D=Object.freeze({__proto__:null,defaultErrorMap:l4,setErrorMap:W2,getErrorMap:hX,makeIssue:ZX,EMPTY_PATH:J2,addIssueToContext:R,ParseStatus:A$,INVALID:l,DIRTY:y4,OK:N$,isAborted:F8,isDirty:E8,isValid:D4,isAsync:f6,get util(){return X$},get objectUtil(){return S8},ZodParsedType:v,getParsedType:v0,ZodType:p,datetimeRegex:f7,ZodString:c$,ZodNumber:u0,ZodBigInt:n0,ZodBoolean:c4,ZodDate:V4,ZodSymbol:T6,ZodUndefined:u4,ZodNull:n4,ZodAny:O4,ZodUnknown:c0,ZodNever:w0,ZodVoid:g6,ZodArray:u$,ZodObject:Y$,ZodUnion:p4,ZodDiscriminatedUnion:mX,ZodIntersection:i4,ZodTuple:z0,ZodRecord:x6,ZodMap:h6,ZodSet:q4,ZodFunction:m4,ZodLazy:d4,ZodLiteral:o4,ZodEnum:p0,ZodNativeEnum:a4,ZodPromise:A4,ZodEffects:h$,ZodTransformer:h$,ZodOptional:k$,ZodNullable:C0,ZodDefault:r4,ZodCatch:t4,ZodNaN:Z6,BRAND:R2,ZodBranded:lX,ZodPipeline:y6,ZodReadonly:s4,custom:g7,Schema:p,ZodSchema:p,late:v2,get ZodFirstPartyTypeKind(){return S},coerce:M3,any:g2,array:y2,bigint:k2,boolean:Z7,date:P2,discriminatedUnion:u2,effect:C7,enum:s2,function:a2,instanceof:C2,intersection:n2,lazy:r2,literal:t2,map:d2,nan:I2,nativeEnum:e2,never:h2,null:T2,nullable:Q3,number:h7,object:m2,oboolean:H3,onumber:Y3,optional:X3,ostring:G3,pipeline:J3,preprocess:W3,promise:$3,record:i2,set:o2,strictObject:l2,string:x7,symbol:b2,transformer:C7,tuple:p2,undefined:f2,union:c2,unknown:x2,void:Z2,NEVER:w3,ZodIssueCode:N,quotelessJson:Q2,ZodError:I$})});var L8="2025-03-26",y7,cX="2.0",m7,l7,z3,p$,P$,m6,B0,i$,uX,c7,u7=($)=>c7.safeParse($).success,n7,p7=($)=>n7.safeParse($).success,i7,R8=($)=>i7.safeParse($).success,H$,d7,o7=($)=>d7.safeParse($).success,a7,nX,pX,r7,B3,iX,rY=($)=>iX.safeParse($).success,D3,V3,v8,dX,O3,oX,aX,rX,t7,s7,e7,q3,A3,tX,j3,sX,K3,eX,U3,N3,S3,F3,E3,_3,L3,$1,R3,X1,Q1,W1,J1,$W,v3,C3,I3,k3,P3,G1,b3,XW,tY,Y1,f3,QW,T3,g3,x3,h3,Z3,y3,C8,m3,l3,H1,c3,u3,n3,I8,p3,sY,eY,$H,XH,QH,WH,w$;var l6=B$(()=>{i0();y7=[L8,"2024-11-05","2024-10-07"],m7=D.union([D.string(),D.number().int()]),l7=D.string(),z3=D.object({progressToken:D.optional(m7)}).passthrough(),p$=D.object({_meta:D.optional(z3)}).passthrough(),P$=D.object({method:D.string(),params:D.optional(p$)}),m6=D.object({_meta:D.optional(D.object({}).passthrough())}).passthrough(),B0=D.object({method:D.string(),params:D.optional(m6)}),i$=D.object({_meta:D.optional(D.object({}).passthrough())}).passthrough(),uX=D.union([D.string(),D.number().int()]),c7=D.object({jsonrpc:D.literal(cX),id:uX}).merge(P$).strict(),n7=D.object({jsonrpc:D.literal(cX)}).merge(B0).strict(),i7=D.object({jsonrpc:D.literal(cX),id:uX,result:i$}).strict();(function($){$[$.ConnectionClosed=-32000]="ConnectionClosed",$[$.RequestTimeout=-32001]="RequestTimeout",$[$.ParseError=-32700]="ParseError",$[$.InvalidRequest=-32600]="InvalidRequest",$[$.MethodNotFound=-32601]="MethodNotFound",$[$.InvalidParams=-32602]="InvalidParams",$[$.InternalError=-32603]="InternalError"})(H$||(H$={}));d7=D.object({jsonrpc:D.literal(cX),id:uX,error:D.object({code:D.number().int(),message:D.string(),data:D.optional(D.unknown())})}).strict(),a7=D.union([c7,n7,i7,d7]),nX=i$.strict(),pX=B0.extend({method:D.literal("notifications/cancelled"),params:m6.extend({requestId:uX,reason:D.string().optional()})}),r7=D.object({name:D.string(),version:D.string()}).passthrough(),B3=D.object({experimental:D.optional(D.object({}).passthrough()),sampling:D.optional(D.object({}).passthrough()),roots:D.optional(D.object({listChanged:D.optional(D.boolean())}).passthrough())}).passthrough(),iX=P$.extend({method:D.literal("initialize"),params:p$.extend({protocolVersion:D.string(),capabilities:B3,clientInfo:r7})}),D3=D.object({experimental:D.optional(D.object({}).passthrough()),logging:D.optional(D.object({}).passthrough()),completions:D.optional(D.object({}).passthrough()),prompts:D.optional(D.object({listChanged:D.optional(D.boolean())}).passthrough()),resources:D.optional(D.object({subscribe:D.optional(D.boolean()),listChanged:D.optional(D.boolean())}).passthrough()),tools:D.optional(D.object({listChanged:D.optional(D.boolean())}).passthrough())}).passthrough(),V3=i$.extend({protocolVersion:D.string(),capabilities:D3,serverInfo:r7,instructions:D.optional(D.string())}),v8=B0.extend({method:D.literal("notifications/initialized")}),dX=P$.extend({method:D.literal("ping")}),O3=D.object({progress:D.number(),total:D.optional(D.number()),message:D.optional(D.string())}).passthrough(),oX=B0.extend({method:D.literal("notifications/progress"),params:m6.merge(O3).extend({progressToken:m7})}),aX=P$.extend({params:p$.extend({cursor:D.optional(l7)}).optional()}),rX=i$.extend({nextCursor:D.optional(l7)}),t7=D.object({uri:D.string(),mimeType:D.optional(D.string())}).passthrough(),s7=t7.extend({text:D.string()}),e7=t7.extend({blob:D.string().base64()}),q3=D.object({uri:D.string(),name:D.string(),description:D.optional(D.string()),mimeType:D.optional(D.string())}).passthrough(),A3=D.object({uriTemplate:D.string(),name:D.string(),description:D.optional(D.string()),mimeType:D.optional(D.string())}).passthrough(),tX=aX.extend({method:D.literal("resources/list")}),j3=rX.extend({resources:D.array(q3)}),sX=aX.extend({method:D.literal("resources/templates/list")}),K3=rX.extend({resourceTemplates:D.array(A3)}),eX=P$.extend({method:D.literal("resources/read"),params:p$.extend({uri:D.string()})}),U3=i$.extend({contents:D.array(D.union([s7,e7]))}),N3=B0.extend({method:D.literal("notifications/resources/list_changed")}),S3=P$.extend({method:D.literal("resources/subscribe"),params:p$.extend({uri:D.string()})}),F3=P$.extend({method:D.literal("resources/unsubscribe"),params:p$.extend({uri:D.string()})}),E3=B0.extend({method:D.literal("notifications/resources/updated"),params:m6.extend({uri:D.string()})}),_3=D.object({name:D.string(),description:D.optional(D.string()),required:D.optional(D.boolean())}).passthrough(),L3=D.object({name:D.string(),description:D.optional(D.string()),arguments:D.optional(D.array(_3))}).passthrough(),$1=aX.extend({method:D.literal("prompts/list")}),R3=rX.extend({prompts:D.array(L3)}),X1=P$.extend({method:D.literal("prompts/get"),params:p$.extend({name:D.string(),arguments:D.optional(D.record(D.string()))})}),Q1=D.object({type:D.literal("text"),text:D.string()}).passthrough(),W1=D.object({type:D.literal("image"),data:D.string().base64(),mimeType:D.string()}).passthrough(),J1=D.object({type:D.literal("audio"),data:D.string().base64(),mimeType:D.string()}).passthrough(),$W=D.object({type:D.literal("resource"),resource:D.union([s7,e7])}).passthrough(),v3=D.object({role:D.enum(["user","assistant"]),content:D.union([Q1,W1,J1,$W])}).passthrough(),C3=i$.extend({description:D.optional(D.string()),messages:D.array(v3)}),I3=B0.extend({method:D.literal("notifications/prompts/list_changed")}),k3=D.object({title:D.optional(D.string()),readOnlyHint:D.optional(D.boolean()),destructiveHint:D.optional(D.boolean()),idempotentHint:D.optional(D.boolean()),openWorldHint:D.optional(D.boolean())}).passthrough(),P3=D.object({name:D.string(),description:D.optional(D.string()),inputSchema:D.object({type:D.literal("object"),properties:D.optional(D.object({}).passthrough()),required:D.optional(D.array(D.string()))}).passthrough(),outputSchema:D.optional(D.object({type:D.literal("object"),properties:D.optional(D.object({}).passthrough()),required:D.optional(D.array(D.string()))}).passthrough()),annotations:D.optional(k3)}).passthrough(),G1=aX.extend({method:D.literal("tools/list")}),b3=rX.extend({tools:D.array(P3)}),XW=i$.extend({content:D.array(D.union([Q1,W1,J1,$W])).default([]),structuredContent:D.object({}).passthrough().optional(),isError:D.optional(D.boolean())}),tY=XW.or(i$.extend({toolResult:D.unknown()})),Y1=P$.extend({method:D.literal("tools/call"),params:p$.extend({name:D.string(),arguments:D.optional(D.record(D.unknown()))})}),f3=B0.extend({method:D.literal("notifications/tools/list_changed")}),QW=D.enum(["debug","info","notice","warning","error","critical","alert","emergency"]),T3=P$.extend({method:D.literal("logging/setLevel"),params:p$.extend({level:QW})}),g3=B0.extend({method:D.literal("notifications/message"),params:m6.extend({level:QW,logger:D.optional(D.string()),data:D.unknown()})}),x3=D.object({name:D.string().optional()}).passthrough(),h3=D.object({hints:D.optional(D.array(x3)),costPriority:D.optional(D.number().min(0).max(1)),speedPriority:D.optional(D.number().min(0).max(1)),intelligencePriority:D.optional(D.number().min(0).max(1))}).passthrough(),Z3=D.object({role:D.enum(["user","assistant"]),content:D.union([Q1,W1,J1])}).passthrough(),y3=P$.extend({method:D.literal("sampling/createMessage"),params:p$.extend({messages:D.array(Z3),systemPrompt:D.optional(D.string()),includeContext:D.optional(D.enum(["none","thisServer","allServers"])),temperature:D.optional(D.number()),maxTokens:D.number().int(),stopSequences:D.optional(D.array(D.string())),metadata:D.optional(D.object({}).passthrough()),modelPreferences:D.optional(h3)})}),C8=i$.extend({model:D.string(),stopReason:D.optional(D.enum(["endTurn","stopSequence","maxTokens"]).or(D.string())),role:D.enum(["user","assistant"]),content:D.discriminatedUnion("type",[Q1,W1,J1])}),m3=D.object({type:D.literal("ref/resource"),uri:D.string()}).passthrough(),l3=D.object({type:D.literal("ref/prompt"),name:D.string()}).passthrough(),H1=P$.extend({method:D.literal("completion/complete"),params:p$.extend({ref:D.union([l3,m3]),argument:D.object({name:D.string(),value:D.string()}).passthrough()})}),c3=i$.extend({completion:D.object({values:D.array(D.string()).max(100),total:D.optional(D.number().int()),hasMore:D.optional(D.boolean())}).passthrough()}),u3=D.object({uri:D.string().startsWith("file://"),name:D.optional(D.string())}).passthrough(),n3=P$.extend({method:D.literal("roots/list")}),I8=i$.extend({roots:D.array(u3)}),p3=B0.extend({method:D.literal("notifications/roots/list_changed")}),sY=D.union([dX,iX,H1,T3,X1,$1,tX,sX,eX,S3,F3,Y1,G1]),eY=D.union([pX,oX,v8,p3]),$H=D.union([nX,C8,I8]),XH=D.union([dX,y3,n3]),QH=D.union([pX,oX,g3,E3,N3,f3,I3]),WH=D.union([nX,V3,c3,C3,R3,j3,K3,U3,XW,b3]);w$=class w$ extends Error{constructor($,X,Q){super(`MCP error ${$}: ${X}`);this.code=$,this.data=Q,this.name="McpError"}}});function YG(){let $=process.argv.join(" ");return $.includes("streamable-http.js")||$.includes("streamable-http.ts")}class lW{context;level;constructor($,X=1){this.context=$,this.level=X}setLevel($){this.level=$}log(...$){if(mW)console.log(...$);else console.error(...$)}logWarn(...$){if(mW)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 mW,Z$=($,X=1)=>new lW($,X);var j4=B$(()=>{mW=YG()});function wG($){if(!/^data:/i.test($))throw new TypeError('`uri` does not appear to be a Data URI (must begin with "data:")');$=$.replace(/\r?\n/g,"");let X=$.indexOf(",");if(X===-1||X<=4)throw new TypeError("malformed data: URI");let Q=$.substring(5,X).split(";"),J="",G=!1,H=Q[0]||"text/plain",M=H;for(let q=1;q<Q.length;q++)if(Q[q]==="base64")G=!0;else if(Q[q]){if(M+=`;${Q[q]}`,Q[q].indexOf("charset=")===0)J=Q[q].substring(8)}if(!Q[0]&&!J.length)M+=";charset=US-ASCII",J="US-ASCII";let z=G?"base64":"ascii",B=unescape($.substring(X+1)),O=Buffer.from(B,z);return O.type=H,O.typeFull=M,O.charset=J,O}var iW;var dW=B$(()=>{iW=wG});var aW=xX((V1,oW)=>{(function($,X){typeof V1==="object"&&typeof oW!=="undefined"?X(V1):typeof define==="function"&&define.amd?define(["exports"],X):($=typeof globalThis!=="undefined"?globalThis:$||self,X($.WebStreamsPolyfill={}))})(V1,function($){function X(){return}function Q(W){return typeof W==="object"&&W!==null||typeof W==="function"}let J=X;function G(W,Y){try{Object.defineProperty(W,"name",{value:Y,configurable:!0})}catch(w){}}let H=Promise,M=Promise.prototype.then,z=Promise.reject.bind(H);function B(W){return new H(W)}function O(W){return B((Y)=>Y(W))}function q(W){return z(W)}function x(W,Y,w){return M.call(W,Y,w)}function T(W,Y,w){x(x(W,Y,w),void 0,J)}function _(W,Y){T(W,Y)}function F(W,Y){T(W,void 0,Y)}function f(W,Y,w){return x(W,Y,w)}function P(W){x(W,void 0,J)}let I=(W)=>{if(typeof queueMicrotask==="function")I=queueMicrotask;else{let Y=O(void 0);I=(w)=>x(Y,w)}return I(W)};function Q$(W,Y,w){if(typeof W!=="function")throw new TypeError("Argument is not a function");return Function.prototype.apply.call(W,Y,w)}function o(W,Y,w){try{return O(Q$(W,Y,w))}catch(V){return q(V)}}let r=16384;class u{constructor(){this._cursor=0,this._size=0,this._front={_elements:[],_next:void 0},this._back=this._front,this._cursor=0,this._size=0}get length(){return this._size}push(W){let Y=this._back,w=Y;if(Y._elements.length===r-1)w={_elements:[],_next:void 0};if(Y._elements.push(W),w!==Y)this._back=w,Y._next=w;++this._size}shift(){let W=this._front,Y=W,w=this._cursor,V=w+1,A=W._elements,j=A[w];if(V===r)Y=W._next,V=0;if(--this._size,this._cursor=V,W!==Y)this._front=Y;return A[w]=void 0,j}forEach(W){let Y=this._cursor,w=this._front,V=w._elements;while(Y!==V.length||w._next!==void 0){if(Y===V.length){if(w=w._next,V=w._elements,Y=0,V.length===0)break}W(V[Y]),++Y}}peek(){let W=this._front,Y=this._cursor;return W._elements[Y]}}let z$=Symbol("[[AbortSteps]]"),T0=Symbol("[[ErrorSteps]]"),W0=Symbol("[[CancelSteps]]"),b1=Symbol("[[PullSteps]]"),f1=Symbol("[[ReleaseSteps]]");function MQ(W,Y){if(W._ownerReadableStream=Y,Y._reader=W,Y._state==="readable")g1(W);else if(Y._state==="closed")M5(W);else wQ(W,Y._storedError)}function T1(W,Y){let w=W._ownerReadableStream;return l$(w,Y)}function A0(W){let Y=W._ownerReadableStream;if(Y._state==="readable")x1(W,new TypeError("Reader was released and can no longer be used to monitor the stream's closedness"));else w5(W,new TypeError("Reader was released and can no longer be used to monitor the stream's closedness"));Y._readableStreamController[f1](),Y._reader=void 0,W._ownerReadableStream=void 0}function wX(W){return new TypeError("Cannot "+W+" a stream using a released reader")}function g1(W){W._closedPromise=B((Y,w)=>{W._closedPromise_resolve=Y,W._closedPromise_reject=w})}function wQ(W,Y){g1(W),x1(W,Y)}function M5(W){g1(W),zQ(W)}function x1(W,Y){if(W._closedPromise_reject===void 0)return;P(W._closedPromise),W._closedPromise_reject(Y),W._closedPromise_resolve=void 0,W._closedPromise_reject=void 0}function w5(W,Y){wQ(W,Y)}function zQ(W){if(W._closedPromise_resolve===void 0)return;W._closedPromise_resolve(void 0),W._closedPromise_resolve=void 0,W._closedPromise_reject=void 0}let BQ=Number.isFinite||function(W){return typeof W==="number"&&isFinite(W)},z5=Math.trunc||function(W){return W<0?Math.ceil(W):Math.floor(W)};function B5(W){return typeof W==="object"||typeof W==="function"}function J0(W,Y){if(W!==void 0&&!B5(W))throw new TypeError(`${Y} is not an object.`)}function T$(W,Y){if(typeof W!=="function")throw new TypeError(`${Y} is not a function.`)}function D5(W){return typeof W==="object"&&W!==null||typeof W==="function"}function DQ(W,Y){if(!D5(W))throw new TypeError(`${Y} is not an object.`)}function j0(W,Y,w){if(W===void 0)throw new TypeError(`Parameter ${Y} is required in '${w}'.`)}function h1(W,Y,w){if(W===void 0)throw new TypeError(`${Y} is required in '${w}'.`)}function Z1(W){return Number(W)}function VQ(W){return W===0?0:W}function V5(W){return VQ(z5(W))}function y1(W,Y){let V=Number.MAX_SAFE_INTEGER,A=Number(W);if(A=VQ(A),!BQ(A))throw new TypeError(`${Y} is not a finite number`);if(A=V5(A),A<0||A>V)throw new TypeError(`${Y} is outside the accepted range of 0 to ${V}, inclusive`);if(!BQ(A)||A===0)return 0;return A}function m1(W,Y){if(!y0(W))throw new TypeError(`${Y} is not a ReadableStream.`)}function v4(W){return new K0(W)}function OQ(W,Y){W._reader._readRequests.push(Y)}function l1(W,Y,w){let A=W._reader._readRequests.shift();if(w)A._closeSteps();else A._chunkSteps(Y)}function zX(W){return W._reader._readRequests.length}function qQ(W){let Y=W._reader;if(Y===void 0)return!1;if(!g0(Y))return!1;return!0}class K0{constructor(W){if(j0(W,1,"ReadableStreamDefaultReader"),m1(W,"First parameter"),m0(W))throw new TypeError("This stream has already been locked for exclusive reading by another reader");MQ(this,W),this._readRequests=new u}get closed(){if(!g0(this))return q(BX("closed"));return this._closedPromise}cancel(W=void 0){if(!g0(this))return q(BX("cancel"));if(this._ownerReadableStream===void 0)return q(wX("cancel"));return T1(this,W)}read(){if(!g0(this))return q(BX("read"));if(this._ownerReadableStream===void 0)return q(wX("read from"));let W,Y,w=B((A,j)=>{W=A,Y=j});return j6(this,{_chunkSteps:(A)=>W({value:A,done:!1}),_closeSteps:()=>W({value:void 0,done:!0}),_errorSteps:(A)=>Y(A)}),w}releaseLock(){if(!g0(this))throw BX("releaseLock");if(this._ownerReadableStream===void 0)return;O5(this)}}if(Object.defineProperties(K0.prototype,{cancel:{enumerable:!0},read:{enumerable:!0},releaseLock:{enumerable:!0},closed:{enumerable:!0}}),G(K0.prototype.cancel,"cancel"),G(K0.prototype.read,"read"),G(K0.prototype.releaseLock,"releaseLock"),typeof Symbol.toStringTag==="symbol")Object.defineProperty(K0.prototype,Symbol.toStringTag,{value:"ReadableStreamDefaultReader",configurable:!0});function g0(W){if(!Q(W))return!1;if(!Object.prototype.hasOwnProperty.call(W,"_readRequests"))return!1;return W instanceof K0}function j6(W,Y){let w=W._ownerReadableStream;if(w._disturbed=!0,w._state==="closed")Y._closeSteps();else if(w._state==="errored")Y._errorSteps(w._storedError);else w._readableStreamController[b1](Y)}function O5(W){A0(W);let Y=new TypeError("Reader was released");AQ(W,Y)}function AQ(W,Y){let w=W._readRequests;W._readRequests=new u,w.forEach((V)=>{V._errorSteps(Y)})}function BX(W){return new TypeError(`ReadableStreamDefaultReader.prototype.${W} can only be used on a ReadableStreamDefaultReader`)}let q5=Object.getPrototypeOf(Object.getPrototypeOf(async function*(){}).prototype);class c1{constructor(W,Y){this._ongoingPromise=void 0,this._isFinished=!1,this._reader=W,this._preventCancel=Y}next(){let W=()=>this._nextSteps();return this._ongoingPromise=this._ongoingPromise?f(this._ongoingPromise,W,W):W(),this._ongoingPromise}return(W){let Y=()=>this._returnSteps(W);return this._ongoingPromise?f(this._ongoingPromise,Y,Y):Y()}_nextSteps(){if(this._isFinished)return Promise.resolve({value:void 0,done:!0});let W=this._reader,Y,w,V=B((j,K)=>{Y=j,w=K});return j6(W,{_chunkSteps:(j)=>{this._ongoingPromise=void 0,I(()=>Y({value:j,done:!1}))},_closeSteps:()=>{this._ongoingPromise=void 0,this._isFinished=!0,A0(W),Y({value:void 0,done:!0})},_errorSteps:(j)=>{this._ongoingPromise=void 0,this._isFinished=!0,A0(W),w(j)}}),V}_returnSteps(W){if(this._isFinished)return Promise.resolve({value:W,done:!0});this._isFinished=!0;let Y=this._reader;if(!this._preventCancel){let w=T1(Y,W);return A0(Y),f(w,()=>({value:W,done:!0}))}return A0(Y),O({value:W,done:!0})}}let jQ={next(){if(!KQ(this))return q(UQ("next"));return this._asyncIteratorImpl.next()},return(W){if(!KQ(this))return q(UQ("return"));return this._asyncIteratorImpl.return(W)}};Object.setPrototypeOf(jQ,q5);function A5(W,Y){let w=v4(W),V=new c1(w,Y),A=Object.create(jQ);return A._asyncIteratorImpl=V,A}function KQ(W){if(!Q(W))return!1;if(!Object.prototype.hasOwnProperty.call(W,"_asyncIteratorImpl"))return!1;try{return W._asyncIteratorImpl instanceof c1}catch(Y){return!1}}function UQ(W){return new TypeError(`ReadableStreamAsyncIterator.${W} can only be used on a ReadableSteamAsyncIterator`)}let NQ=Number.isNaN||function(W){return W!==W};var u1,n1,p1;function K6(W){return W.slice()}function SQ(W,Y,w,V,A){new Uint8Array(W).set(new Uint8Array(w,V,A),Y)}let U0=(W)=>{if(typeof W.transfer==="function")U0=(Y)=>Y.transfer();else if(typeof structuredClone==="function")U0=(Y)=>structuredClone(Y,{transfer:[Y]});else U0=(Y)=>Y;return U0(W)},x0=(W)=>{if(typeof W.detached==="boolean")x0=(Y)=>Y.detached;else x0=(Y)=>Y.byteLength===0;return x0(W)};function FQ(W,Y,w){if(W.slice)return W.slice(Y,w);let V=w-Y,A=new ArrayBuffer(V);return SQ(A,0,W,Y,V),A}function DX(W,Y){let w=W[Y];if(w===void 0||w===null)return;if(typeof w!=="function")throw new TypeError(`${String(Y)} is not a function`);return w}function j5(W){let Y={[Symbol.iterator]:()=>W.iterator},w=async function*(){return yield*Y}(),V=w.next;return{iterator:w,nextMethod:V,done:!1}}let i1=(p1=(u1=Symbol.asyncIterator)!==null&&u1!==void 0?u1:(n1=Symbol.for)===null||n1===void 0?void 0:n1.call(Symbol,"Symbol.asyncIterator"))!==null&&p1!==void 0?p1:"@@asyncIterator";function EQ(W,Y="sync",w){if(w===void 0)if(Y==="async"){if(w=DX(W,i1),w===void 0){let j=DX(W,Symbol.iterator),K=EQ(W,"sync",j);return j5(K)}}else w=DX(W,Symbol.iterator);if(w===void 0)throw new TypeError("The object is not iterable");let V=Q$(w,W,[]);if(!Q(V))throw new TypeError("The iterator method must return an object");let A=V.next;return{iterator:V,nextMethod:A,done:!1}}function K5(W){let Y=Q$(W.nextMethod,W.iterator,[]);if(!Q(Y))throw new TypeError("The iterator.next() method must return an object");return Y}function U5(W){return Boolean(W.done)}function N5(W){return W.value}function S5(W){if(typeof W!=="number")return!1;if(NQ(W))return!1;if(W<0)return!1;return!0}function _Q(W){let Y=FQ(W.buffer,W.byteOffset,W.byteOffset+W.byteLength);return new Uint8Array(Y)}function d1(W){let Y=W._queue.shift();if(W._queueTotalSize-=Y.size,W._queueTotalSize<0)W._queueTotalSize=0;return Y.value}function o1(W,Y,w){if(!S5(w)||w===1/0)throw new RangeError("Size must be a finite, non-NaN, non-negative number.");W._queue.push({value:Y,size:w}),W._queueTotalSize+=w}function F5(W){return W._queue.peek().value}function h0(W){W._queue=new u,W._queueTotalSize=0}function LQ(W){return W===DataView}function E5(W){return LQ(W.constructor)}function _5(W){if(LQ(W))return 1;return W.BYTES_PER_ELEMENT}class Z0{constructor(){throw new TypeError("Illegal constructor")}get view(){if(!a1(this))throw $8("view");return this._view}respond(W){if(!a1(this))throw $8("respond");if(j0(W,1,"respond"),W=y1(W,"First parameter"),this._associatedReadableByteStreamController===void 0)throw new TypeError("This BYOB request has been invalidated");if(x0(this._view.buffer))throw new TypeError("The BYOB request's buffer has been detached and so cannot be used as a response");AX(this._associatedReadableByteStreamController,W)}respondWithNewView(W){if(!a1(this))throw $8("respondWithNewView");if(j0(W,1,"respondWithNewView"),!ArrayBuffer.isView(W))throw new TypeError("You can only respond with array buffer views");if(this._associatedReadableByteStreamController===void 0)throw new TypeError("This BYOB request has been invalidated");if(x0(W.buffer))throw new TypeError("The given view's buffer has been detached and so cannot be used as a response");jX(this._associatedReadableByteStreamController,W)}}if(Object.defineProperties(Z0.prototype,{respond:{enumerable:!0},respondWithNewView:{enumerable:!0},view:{enumerable:!0}}),G(Z0.prototype.respond,"respond"),G(Z0.prototype.respondWithNewView,"respondWithNewView"),typeof Symbol.toStringTag==="symbol")Object.defineProperty(Z0.prototype,Symbol.toStringTag,{value:"ReadableStreamBYOBRequest",configurable:!0});class G0{constructor(){throw new TypeError("Illegal constructor")}get byobRequest(){if(!J4(this))throw N6("byobRequest");return e1(this)}get desiredSize(){if(!J4(this))throw N6("desiredSize");return gQ(this)}close(){if(!J4(this))throw N6("close");if(this._closeRequested)throw new TypeError("The stream has already been closed; do not close it again!");let W=this._controlledReadableByteStream._state;if(W!=="readable")throw new TypeError(`The stream (in ${W} state) is not in the readable state and cannot be closed`);U6(this)}enqueue(W){if(!J4(this))throw N6("enqueue");if(j0(W,1,"enqueue"),!ArrayBuffer.isView(W))throw new TypeError("chunk must be an array buffer view");if(W.byteLength===0)throw new TypeError("chunk must have non-zero byteLength");if(W.buffer.byteLength===0)throw new TypeError("chunk's buffer must have non-zero byteLength");if(this._closeRequested)throw new TypeError("stream is closed or draining");let Y=this._controlledReadableByteStream._state;if(Y!=="readable")throw new TypeError(`The stream (in ${Y} state) is not in the readable state and cannot be enqueued to`);qX(this,W)}error(W=void 0){if(!J4(this))throw N6("error");g$(this,W)}[W0](W){RQ(this),h0(this);let Y=this._cancelAlgorithm(W);return OX(this),Y}[b1](W){let Y=this._controlledReadableByteStream;if(this._queueTotalSize>0){TQ(this,W);return}let w=this._autoAllocateChunkSize;if(w!==void 0){let V;try{V=new ArrayBuffer(w)}catch(j){W._errorSteps(j);return}let A={buffer:V,bufferByteLength:w,byteOffset:0,byteLength:w,bytesFilled:0,minimumFill:1,elementSize:1,viewConstructor:Uint8Array,readerType:"default"};this._pendingPullIntos.push(A)}OQ(Y,W),G4(this)}[f1](){if(this._pendingPullIntos.length>0){let W=this._pendingPullIntos.peek();W.readerType="none",this._pendingPullIntos=new u,this._pendingPullIntos.push(W)}}}if(Object.defineProperties(G0.prototype,{close:{enumerable:!0},enqueue:{enumerable:!0},error:{enumerable:!0},byobRequest:{enumerable:!0},desiredSize:{enumerable:!0}}),G(G0.prototype.close,"close"),G(G0.prototype.enqueue,"enqueue"),G(G0.prototype.error,"error"),typeof Symbol.toStringTag==="symbol")Object.defineProperty(G0.prototype,Symbol.toStringTag,{value:"ReadableByteStreamController",configurable:!0});function J4(W){if(!Q(W))return!1;if(!Object.prototype.hasOwnProperty.call(W,"_controlledReadableByteStream"))return!1;return W instanceof G0}function a1(W){if(!Q(W))return!1;if(!Object.prototype.hasOwnProperty.call(W,"_associatedReadableByteStreamController"))return!1;return W instanceof Z0}function G4(W){if(!I5(W))return;if(W._pulling){W._pullAgain=!0;return}W._pulling=!0;let w=W._pullAlgorithm();T(w,()=>{if(W._pulling=!1,W._pullAgain)W._pullAgain=!1,G4(W);return null},(V)=>{return g$(W,V),null})}function RQ(W){t1(W),W._pendingPullIntos=new u}function r1(W,Y){let w=!1;if(W._state==="closed")w=!0;let V=vQ(Y);if(Y.readerType==="default")l1(W,V,w);else g5(W,V,w)}function vQ(W){let{bytesFilled:Y,elementSize:w}=W;return new W.viewConstructor(W.buffer,W.byteOffset,Y/w)}function VX(W,Y,w,V){W._queue.push({buffer:Y,byteOffset:w,byteLength:V}),W._queueTotalSize+=V}function CQ(W,Y,w,V){let A;try{A=FQ(Y,w,w+V)}catch(j){throw g$(W,j),j}VX(W,A,0,V)}function IQ(W,Y){if(Y.bytesFilled>0)CQ(W,Y.buffer,Y.byteOffset,Y.bytesFilled);C4(W)}function kQ(W,Y){let w=Math.min(W._queueTotalSize,Y.byteLength-Y.bytesFilled),V=Y.bytesFilled+w,A=w,j=!1,K=V%Y.elementSize,C=V-K;if(C>=Y.minimumFill)A=C-Y.bytesFilled,j=!0;let g=W._queue;while(A>0){let c=g.peek(),n=Math.min(A,c.byteLength),t=Y.byteOffset+Y.bytesFilled;if(SQ(Y.buffer,t,c.buffer,c.byteOffset,n),c.byteLength===n)g.shift();else c.byteOffset+=n,c.byteLength-=n;W._queueTotalSize-=n,PQ(W,n,Y),A-=n}return j}function PQ(W,Y,w){w.bytesFilled+=Y}function bQ(W){if(W._queueTotalSize===0&&W._closeRequested)OX(W),R6(W._controlledReadableByteStream);else G4(W)}function t1(W){if(W._byobRequest===null)return;W._byobRequest._associatedReadableByteStreamController=void 0,W._byobRequest._view=null,W._byobRequest=null}function s1(W){while(W._pendingPullIntos.length>0){if(W._queueTotalSize===0)return;let Y=W._pendingPullIntos.peek();if(kQ(W,Y))C4(W),r1(W._controlledReadableByteStream,Y)}}function L5(W){let Y=W._controlledReadableByteStream._reader;while(Y._readRequests.length>0){if(W._queueTotalSize===0)return;let w=Y._readRequests.shift();TQ(W,w)}}function R5(W,Y,w,V){let A=W._controlledReadableByteStream,j=Y.constructor,K=_5(j),{byteOffset:C,byteLength:g}=Y,c=w*K,n;try{n=U0(Y.buffer)}catch(W$){V._errorSteps(W$);return}let t={buffer:n,bufferByteLength:n.byteLength,byteOffset:C,byteLength:g,bytesFilled:0,minimumFill:c,elementSize:K,viewConstructor:j,readerType:"byob"};if(W._pendingPullIntos.length>0){W._pendingPullIntos.push(t),ZQ(A,V);return}if(A._state==="closed"){let W$=new j(t.buffer,t.byteOffset,0);V._closeSteps(W$);return}if(W._queueTotalSize>0){if(kQ(W,t)){let W$=vQ(t);bQ(W),V._chunkSteps(W$);return}if(W._closeRequested){let W$=new TypeError("Insufficient bytes to fill elements in the given buffer");g$(W,W$),V._errorSteps(W$);return}}W._pendingPullIntos.push(t),ZQ(A,V),G4(W)}function v5(W,Y){if(Y.readerType==="none")C4(W);let w=W._controlledReadableByteStream;if(X8(w))while(yQ(w)>0){let V=C4(W);r1(w,V)}}function C5(W,Y,w){if(PQ(W,Y,w),w.readerType==="none"){IQ(W,w),s1(W);return}if(w.bytesFilled<w.minimumFill)return;C4(W);let V=w.bytesFilled%w.elementSize;if(V>0){let A=w.byteOffset+w.bytesFilled;CQ(W,w.buffer,A-V,V)}w.bytesFilled-=V,r1(W._controlledReadableByteStream,w),s1(W)}function fQ(W,Y){let w=W._pendingPullIntos.peek();if(t1(W),W._controlledReadableByteStream._state==="closed")v5(W,w);else C5(W,Y,w);G4(W)}function C4(W){return W._pendingPullIntos.shift()}function I5(W){let Y=W._controlledReadableByteStream;if(Y._state!=="readable")return!1;if(W._closeRequested)return!1;if(!W._started)return!1;if(qQ(Y)&&zX(Y)>0)return!0;if(X8(Y)&&yQ(Y)>0)return!0;if(gQ(W)>0)return!0;return!1}function OX(W){W._pullAlgorithm=void 0,W._cancelAlgorithm=void 0}function U6(W){let Y=W._controlledReadableByteStream;if(W._closeRequested||Y._state!=="readable")return;if(W._queueTotalSize>0){W._closeRequested=!0;return}if(W._pendingPullIntos.length>0){let w=W._pendingPullIntos.peek();if(w.bytesFilled%w.elementSize!==0){let V=new TypeError("Insufficient bytes to fill elements in the given buffer");throw g$(W,V),V}}OX(W),R6(Y)}function qX(W,Y){let w=W._controlledReadableByteStream;if(W._closeRequested||w._state!=="readable")return;let{buffer:V,byteOffset:A,byteLength:j}=Y;if(x0(V))throw new TypeError("chunk's buffer is detached and so cannot be enqueued");let K=U0(V);if(W._pendingPullIntos.length>0){let C=W._pendingPullIntos.peek();if(x0(C.buffer))throw new TypeError("The BYOB request's buffer has been detached and so cannot be filled with an enqueued chunk");if(t1(W),C.buffer=U0(C.buffer),C.readerType==="none")IQ(W,C)}if(qQ(w))if(L5(W),zX(w)===0)VX(W,K,A,j);else{if(W._pendingPullIntos.length>0)C4(W);let C=new Uint8Array(K,A,j);l1(w,C,!1)}else if(X8(w))VX(W,K,A,j),s1(W);else VX(W,K,A,j);G4(W)}function g$(W,Y){let w=W._controlledReadableByteStream;if(w._state!=="readable")return;RQ(W),h0(W),OX(W),w7(w,Y)}function TQ(W,Y){let w=W._queue.shift();W._queueTotalSize-=w.byteLength,bQ(W);let V=new Uint8Array(w.buffer,w.byteOffset,w.byteLength);Y._chunkSteps(V)}function e1(W){if(W._byobRequest===null&&W._pendingPullIntos.length>0){let Y=W._pendingPullIntos.peek(),w=new Uint8Array(Y.buffer,Y.byteOffset+Y.bytesFilled,Y.byteLength-Y.bytesFilled),V=Object.create(Z0.prototype);P5(V,W,w),W._byobRequest=V}return W._byobRequest}function gQ(W){let Y=W._controlledReadableByteStream._state;if(Y==="errored")return null;if(Y==="closed")return 0;return W._strategyHWM-W._queueTotalSize}function AX(W,Y){let w=W._pendingPullIntos.peek();if(W._controlledReadableByteStream._state==="closed"){if(Y!==0)throw new TypeError("bytesWritten must be 0 when calling respond() on a closed stream")}else{if(Y===0)throw new TypeError("bytesWritten must be greater than 0 when calling respond() on a readable stream");if(w.bytesFilled+Y>w.byteLength)throw new RangeError("bytesWritten out of range")}w.buffer=U0(w.buffer),fQ(W,Y)}function jX(W,Y){let w=W._pendingPullIntos.peek();if(W._controlledReadableByteStream._state==="closed"){if(Y.byteLength!==0)throw new TypeError("The view's length must be 0 when calling respondWithNewView() on a closed stream")}else if(Y.byteLength===0)throw new TypeError("The view's length must be greater than 0 when calling respondWithNewView() on a readable stream");if(w.byteOffset+w.bytesFilled!==Y.byteOffset)throw new RangeError("The region specified by view does not match byobRequest");if(w.bufferByteLength!==Y.buffer.byteLength)throw new RangeError("The buffer of view has different capacity than byobRequest");if(w.bytesFilled+Y.byteLength>w.byteLength)throw new RangeError("The region specified by view is larger than byobRequest");let A=Y.byteLength;w.buffer=U0(Y.buffer),fQ(W,A)}function xQ(W,Y,w,V,A,j,K){Y._controlledReadableByteStream=W,Y._pullAgain=!1,Y._pulling=!1,Y._byobRequest=null,Y._queue=Y._queueTotalSize=void 0,h0(Y),Y._closeRequested=!1,Y._started=!1,Y._strategyHWM=j,Y._pullAlgorithm=V,Y._cancelAlgorithm=A,Y._autoAllocateChunkSize=K,Y._pendingPullIntos=new u,W._readableStreamController=Y;let C=w();T(O(C),()=>{return Y._started=!0,G4(Y),null},(g)=>{return g$(Y,g),null})}function k5(W,Y,w){let V=Object.create(G0.prototype),A,j,K;if(Y.start!==void 0)A=()=>Y.start(V);else A=()=>{return};if(Y.pull!==void 0)j=()=>Y.pull(V);else j=()=>O(void 0);if(Y.cancel!==void 0)K=(g)=>Y.cancel(g);else K=()=>O(void 0);let C=Y.autoAllocateChunkSize;if(C===0)throw new TypeError("autoAllocateChunkSize must be greater than 0");xQ(W,V,A,j,K,w,C)}function P5(W,Y,w){W._associatedReadableByteStreamController=Y,W._view=w}function $8(W){return new TypeError(`ReadableStreamBYOBRequest.prototype.${W} can only be used on a ReadableStreamBYOBRequest`)}function N6(W){return new TypeError(`ReadableByteStreamController.prototype.${W} can only be used on a ReadableByteStreamController`)}function b5(W,Y){J0(W,Y);let w=W===null||W===void 0?void 0:W.mode;return{mode:w===void 0?void 0:f5(w,`${Y} has member 'mode' that`)}}function f5(W,Y){if(W=`${W}`,W!=="byob")throw new TypeError(`${Y} '${W}' is not a valid enumeration value for ReadableStreamReaderMode`);return W}function T5(W,Y){var w;J0(W,Y);let V=(w=W===null||W===void 0?void 0:W.min)!==null&&w!==void 0?w:1;return{min:y1(V,`${Y} has member 'min' that`)}}function hQ(W){return new N0(W)}function ZQ(W,Y){W._reader._readIntoRequests.push(Y)}function g5(W,Y,w){let A=W._reader._readIntoRequests.shift();if(w)A._closeSteps(Y);else A._chunkSteps(Y)}function yQ(W){return W._reader._readIntoRequests.length}function X8(W){let Y=W._reader;if(Y===void 0)return!1;if(!Y4(Y))return!1;return!0}class N0{constructor(W){if(j0(W,1,"ReadableStreamBYOBReader"),m1(W,"First parameter"),m0(W))throw new TypeError("This stream has already been locked for exclusive reading by another reader");if(!J4(W._readableStreamController))throw new TypeError("Cannot construct a ReadableStreamBYOBReader for a stream not constructed with a byte source");MQ(this,W),this._readIntoRequests=new u}get closed(){if(!Y4(this))return q(KX("closed"));return this._closedPromise}cancel(W=void 0){if(!Y4(this))return q(KX("cancel"));if(this._ownerReadableStream===void 0)return q(wX("cancel"));return T1(this,W)}read(W,Y={}){if(!Y4(this))return q(KX("read"));if(!ArrayBuffer.isView(W))return q(new TypeError("view must be an array buffer view"));if(W.byteLength===0)return q(new TypeError("view must have non-zero byteLength"));if(W.buffer.byteLength===0)return q(new TypeError("view's buffer must have non-zero byteLength"));if(x0(W.buffer))return q(new TypeError("view's buffer has been detached"));let w;try{w=T5(Y,"options")}catch(g){return q(g)}let V=w.min;if(V===0)return q(new TypeError("options.min must be greater than 0"));if(!E5(W)){if(V>W.length)return q(new RangeError("options.min must be less than or equal to view's length"))}else if(V>W.byteLength)return q(new RangeError("options.min must be less than or equal to view's byteLength"));if(this._ownerReadableStream===void 0)return q(wX("read from"));let A,j,K=B((g,c)=>{A=g,j=c});return mQ(this,W,V,{_chunkSteps:(g)=>A({value:g,done:!1}),_closeSteps:(g)=>A({value:g,done:!0}),_errorSteps:(g)=>j(g)}),K}releaseLock(){if(!Y4(this))throw KX("releaseLock");if(this._ownerReadableStream===void 0)return;x5(this)}}if(Object.defineProperties(N0.prototype,{cancel:{enumerable:!0},read:{enumerable:!0},releaseLock:{enumerable:!0},closed:{enumerable:!0}}),G(N0.prototype.cancel,"cancel"),G(N0.prototype.read,"read"),G(N0.prototype.releaseLock,"releaseLock"),typeof Symbol.toStringTag==="symbol")Object.defineProperty(N0.prototype,Symbol.toStringTag,{value:"ReadableStreamBYOBReader",configurable:!0});function Y4(W){if(!Q(W))return!1;if(!Object.prototype.hasOwnProperty.call(W,"_readIntoRequests"))return!1;return W instanceof N0}function mQ(W,Y,w,V){let A=W._ownerReadableStream;if(A._disturbed=!0,A._state==="errored")V._errorSteps(A._storedError);else R5(A._readableStreamController,Y,w,V)}function x5(W){A0(W);let Y=new TypeError("Reader was released");lQ(W,Y)}function lQ(W,Y){let w=W._readIntoRequests;W._readIntoRequests=new u,w.forEach((V)=>{V._errorSteps(Y)})}function KX(W){return new TypeError(`ReadableStreamBYOBReader.prototype.${W} can only be used on a ReadableStreamBYOBReader`)}function S6(W,Y){let{highWaterMark:w}=W;if(w===void 0)return Y;if(NQ(w)||w<0)throw new RangeError("Invalid highWaterMark");return w}function UX(W){let{size:Y}=W;if(!Y)return()=>1;return Y}function NX(W,Y){J0(W,Y);let w=W===null||W===void 0?void 0:W.highWaterMark,V=W===null||W===void 0?void 0:W.size;return{highWaterMark:w===void 0?void 0:Z1(w),size:V===void 0?void 0:h5(V,`${Y} has member 'size' that`)}}function h5(W,Y){return T$(W,Y),(w)=>Z1(W(w))}function Z5(W,Y){J0(W,Y);let w=W===null||W===void 0?void 0:W.abort,V=W===null||W===void 0?void 0:W.close,A=W===null||W===void 0?void 0:W.start,j=W===null||W===void 0?void 0:W.type,K=W===null||W===void 0?void 0:W.write;return{abort:w===void 0?void 0:y5(w,W,`${Y} has member 'abort' that`),close:V===void 0?void 0:m5(V,W,`${Y} has member 'close' that`),start:A===void 0?void 0:l5(A,W,`${Y} has member 'start' that`),write:K===void 0?void 0:c5(K,W,`${Y} has member 'write' that`),type:j}}function y5(W,Y,w){return T$(W,w),(V)=>o(W,Y,[V])}function m5(W,Y,w){return T$(W,w),()=>o(W,Y,[])}function l5(W,Y,w){return T$(W,w),(V)=>Q$(W,Y,[V])}function c5(W,Y,w){return T$(W,w),(V,A)=>o(W,Y,[V,A])}function cQ(W,Y){if(!I4(W))throw new TypeError(`${Y} is not a WritableStream.`)}function u5(W){if(typeof W!=="object"||W===null)return!1;try{return typeof W.aborted==="boolean"}catch(Y){return!1}}let n5=typeof AbortController==="function";function p5(){if(n5)return new AbortController;return}class S0{constructor(W={},Y={}){if(W===void 0)W=null;else DQ(W,"First parameter");let w=NX(Y,"Second parameter"),V=Z5(W,"First parameter");if(nQ(this),V.type!==void 0)throw new RangeError("Invalid type is specified");let j=UX(w),K=S6(w,1);G9(this,V,K,j)}get locked(){if(!I4(this))throw LX("locked");return k4(this)}abort(W=void 0){if(!I4(this))return q(LX("abort"));if(k4(this))return q(new TypeError("Cannot abort a stream that already has a writer"));return SX(this,W)}close(){if(!I4(this))return q(LX("close"));if(k4(this))return q(new TypeError("Cannot close a stream that already has a writer"));if(Y0(this))return q(new TypeError("Cannot close an already-closing stream"));return pQ(this)}getWriter(){if(!I4(this))throw LX("getWriter");return uQ(this)}}if(Object.defineProperties(S0.prototype,{abort:{enumerable:!0},close:{enumerable:!0},getWriter:{enumerable:!0},locked:{enumerable:!0}}),G(S0.prototype.abort,"abort"),G(S0.prototype.close,"close"),G(S0.prototype.getWriter,"getWriter"),typeof Symbol.toStringTag==="symbol")Object.defineProperty(S0.prototype,Symbol.toStringTag,{value:"WritableStream",configurable:!0});function uQ(W){return new H0(W)}function i5(W,Y,w,V,A=1,j=()=>1){let K=Object.create(S0.prototype);nQ(K);let C=Object.create(M4.prototype);return tQ(K,C,W,Y,w,V,A,j),K}function nQ(W){W._state="writable",W._storedError=void 0,W._writer=void 0,W._writableStreamController=void 0,W._writeRequests=new u,W._inFlightWriteRequest=void 0,W._closeRequest=void 0,W._inFlightCloseRequest=void 0,W._pendingAbortRequest=void 0,W._backpressure=!1}function I4(W){if(!Q(W))return!1;if(!Object.prototype.hasOwnProperty.call(W,"_writableStreamController"))return!1;return W instanceof S0}function k4(W){if(W._writer===void 0)return!1;return!0}function SX(W,Y){var w;if(W._state==="closed"||W._state==="errored")return O(void 0);W._writableStreamController._abortReason=Y,(w=W._writableStreamController._abortController)===null||w===void 0||w.abort(Y);let V=W._state;if(V==="closed"||V==="errored")return O(void 0);if(W._pendingAbortRequest!==void 0)return W._pendingAbortRequest._promise;let A=!1;if(V==="erroring")A=!0,Y=void 0;let j=B((K,C)=>{W._pendingAbortRequest={_promise:void 0,_resolve:K,_reject:C,_reason:Y,_wasAlreadyErroring:A}});if(W._pendingAbortRequest._promise=j,!A)W8(W,Y);return j}function pQ(W){let Y=W._state;if(Y==="closed"||Y==="errored")return q(new TypeError(`The stream (in ${Y} state) is not in the writable state and cannot be closed`));let w=B((A,j)=>{let K={_resolve:A,_reject:j};W._closeRequest=K}),V=W._writer;if(V!==void 0&&W._backpressure&&Y==="writable")B8(V);return Y9(W._writableStreamController),w}function d5(W){return B((w,V)=>{let A={_resolve:w,_reject:V};W._writeRequests.push(A)})}function Q8(W,Y){if(W._state==="writable"){W8(W,Y);return}J8(W)}function W8(W,Y){let w=W._writableStreamController;W._state="erroring",W._storedError=Y;let V=W._writer;if(V!==void 0)dQ(V,Y);if(!s5(W)&&w._started)J8(W)}function J8(W){W._state="errored",W._writableStreamController[T0]();let Y=W._storedError;if(W._writeRequests.forEach((A)=>{A._reject(Y)}),W._writeRequests=new u,W._pendingAbortRequest===void 0){FX(W);return}let w=W._pendingAbortRequest;if(W._pendingAbortRequest=void 0,w._wasAlreadyErroring){w._reject(Y),FX(W);return}let V=W._writableStreamController[z$](w._reason);T(V,()=>{return w._resolve(),FX(W),null},(A)=>{return w._reject(A),FX(W),null})}function o5(W){W._inFlightWriteRequest._resolve(void 0),W._inFlightWriteRequest=void 0}function a5(W,Y){W._inFlightWriteRequest._reject(Y),W._inFlightWriteRequest=void 0,Q8(W,Y)}function r5(W){if(W._inFlightCloseRequest._resolve(void 0),W._inFlightCloseRequest=void 0,W._state==="erroring"){if(W._storedError=void 0,W._pendingAbortRequest!==void 0)W._pendingAbortRequest._resolve(),W._pendingAbortRequest=void 0}W._state="closed";let w=W._writer;if(w!==void 0)X7(w)}function t5(W,Y){if(W._inFlightCloseRequest._reject(Y),W._inFlightCloseRequest=void 0,W._pendingAbortRequest!==void 0)W._pendingAbortRequest._reject(Y),W._pendingAbortRequest=void 0;Q8(W,Y)}function Y0(W){if(W._closeRequest===void 0&&W._inFlightCloseRequest===void 0)return!1;return!0}function s5(W){if(W._inFlightWriteRequest===void 0&&W._inFlightCloseRequest===void 0)return!1;return!0}function e5(W){W._inFlightCloseRequest=W._closeRequest,W._closeRequest=void 0}function $9(W){W._inFlightWriteRequest=W._writeRequests.shift()}function FX(W){if(W._closeRequest!==void 0)W._closeRequest._reject(W._storedError),W._closeRequest=void 0;let Y=W._writer;if(Y!==void 0)w8(Y,W._storedError)}function G8(W,Y){let w=W._writer;if(w!==void 0&&Y!==W._backpressure)if(Y)V9(w);else B8(w);W._backpressure=Y}class H0{constructor(W){if(j0(W,1,"WritableStreamDefaultWriter"),cQ(W,"First parameter"),k4(W))throw new TypeError("This stream has already been locked for exclusive writing by another writer");this._ownerWritableStream=W,W._writer=this;let Y=W._state;if(Y==="writable"){if(!Y0(W)&&W._backpressure)vX(this);else Q7(this);RX(this)}else if(Y==="erroring")z8(this,W._storedError),RX(this);else if(Y==="closed")Q7(this),B9(this);else{let w=W._storedError;z8(this,w),$7(this,w)}}get closed(){if(!H4(this))return q(w4("closed"));return this._closedPromise}get desiredSize(){if(!H4(this))throw w4("desiredSize");if(this._ownerWritableStream===void 0)throw E6("desiredSize");return J9(this)}get ready(){if(!H4(this))return q(w4("ready"));return this._readyPromise}abort(W=void 0){if(!H4(this))return q(w4("abort"));if(this._ownerWritableStream===void 0)return q(E6("abort"));return X9(this,W)}close(){if(!H4(this))return q(w4("close"));let W=this._ownerWritableStream;if(W===void 0)return q(E6("close"));if(Y0(W))return q(new TypeError("Cannot close an already-closing stream"));return iQ(this)}releaseLock(){if(!H4(this))throw w4("releaseLock");if(this._ownerWritableStream===void 0)return;oQ(this)}write(W=void 0){if(!H4(this))return q(w4("write"));if(this._ownerWritableStream===void 0)return q(E6("write to"));return aQ(this,W)}}if(Object.defineProperties(H0.prototype,{abort:{enumerable:!0},close:{enumerable:!0},releaseLock:{enumerable:!0},write:{enumerable:!0},closed:{enumerable:!0},desiredSize:{enumerable:!0},ready:{enumerable:!0}}),G(H0.prototype.abort,"abort"),G(H0.prototype.close,"close"),G(H0.prototype.releaseLock,"releaseLock"),G(H0.prototype.write,"write"),typeof Symbol.toStringTag==="symbol")Object.defineProperty(H0.prototype,Symbol.toStringTag,{value:"WritableStreamDefaultWriter",configurable:!0});function H4(W){if(!Q(W))return!1;if(!Object.prototype.hasOwnProperty.call(W,"_ownerWritableStream"))return!1;return W instanceof H0}function X9(W,Y){let w=W._ownerWritableStream;return SX(w,Y)}function iQ(W){let Y=W._ownerWritableStream;return pQ(Y)}function Q9(W){let Y=W._ownerWritableStream,w=Y._state;if(Y0(Y)||w==="closed")return O(void 0);if(w==="errored")return q(Y._storedError);return iQ(W)}function W9(W,Y){if(W._closedPromiseState==="pending")w8(W,Y);else D9(W,Y)}function dQ(W,Y){if(W._readyPromiseState==="pending")W7(W,Y);else O9(W,Y)}function J9(W){let Y=W._ownerWritableStream,w=Y._state;if(w==="errored"||w==="erroring")return null;if(w==="closed")return 0;return sQ(Y._writableStreamController)}function oQ(W){let Y=W._ownerWritableStream,w=new TypeError("Writer was released and can no longer be used to monitor the stream's closedness");dQ(W,w),W9(W,w),Y._writer=void 0,W._ownerWritableStream=void 0}function aQ(W,Y){let w=W._ownerWritableStream,V=w._writableStreamController,A=H9(V,Y);if(w!==W._ownerWritableStream)return q(E6("write to"));let j=w._state;if(j==="errored")return q(w._storedError);if(Y0(w)||j==="closed")return q(new TypeError("The stream is closing or closed and cannot be written to"));if(j==="erroring")return q(w._storedError);let K=d5(w);return M9(V,Y,A),K}let rQ={};class M4{constructor(){throw new TypeError("Illegal constructor")}get abortReason(){if(!Y8(this))throw M8("abortReason");return this._abortReason}get signal(){if(!Y8(this))throw M8("signal");if(this._abortController===void 0)throw new TypeError("WritableStreamDefaultController.prototype.signal is not supported");return this._abortController.signal}error(W=void 0){if(!Y8(this))throw M8("error");if(this._controlledWritableStream._state!=="writable")return;eQ(this,W)}[z$](W){let Y=this._abortAlgorithm(W);return EX(this),Y}[T0](){h0(this)}}if(Object.defineProperties(M4.prototype,{abortReason:{enumerable:!0},signal:{enumerable:!0},error:{enumerable:!0}}),typeof Symbol.toStringTag==="symbol")Object.defineProperty(M4.prototype,Symbol.toStringTag,{value:"WritableStreamDefaultController",configurable:!0});function Y8(W){if(!Q(W))return!1;if(!Object.prototype.hasOwnProperty.call(W,"_controlledWritableStream"))return!1;return W instanceof M4}function tQ(W,Y,w,V,A,j,K,C){Y._controlledWritableStream=W,W._writableStreamController=Y,Y._queue=void 0,Y._queueTotalSize=void 0,h0(Y),Y._abortReason=void 0,Y._abortController=p5(),Y._started=!1,Y._strategySizeAlgorithm=C,Y._strategyHWM=K,Y._writeAlgorithm=V,Y._closeAlgorithm=A,Y._abortAlgorithm=j;let g=H8(Y);G8(W,g);let c=w(),n=O(c);T(n,()=>{return Y._started=!0,_X(Y),null},(t)=>{return Y._started=!0,Q8(W,t),null})}function G9(W,Y,w,V){let A=Object.create(M4.prototype),j,K,C,g;if(Y.start!==void 0)j=()=>Y.start(A);else j=()=>{return};if(Y.write!==void 0)K=(c)=>Y.write(c,A);else K=()=>O(void 0);if(Y.close!==void 0)C=()=>Y.close();else C=()=>O(void 0);if(Y.abort!==void 0)g=(c)=>Y.abort(c);else g=()=>O(void 0);tQ(W,A,j,K,C,g,w,V)}function EX(W){W._writeAlgorithm=void 0,W._closeAlgorithm=void 0,W._abortAlgorithm=void 0,W._strategySizeAlgorithm=void 0}function Y9(W){o1(W,rQ,0),_X(W)}function H9(W,Y){try{return W._strategySizeAlgorithm(Y)}catch(w){return F6(W,w),1}}function sQ(W){return W._strategyHWM-W._queueTotalSize}function M9(W,Y,w){try{o1(W,Y,w)}catch(A){F6(W,A);return}let V=W._controlledWritableStream;if(!Y0(V)&&V._state==="writable"){let A=H8(W);G8(V,A)}_X(W)}function _X(W){let Y=W._controlledWritableStream;if(!W._started)return;if(Y._inFlightWriteRequest!==void 0)return;if(Y._state==="erroring"){J8(Y);return}if(W._queue.length===0)return;let V=F5(W);if(V===rQ)w9(W);else z9(W,V)}function F6(W,Y){if(W._controlledWritableStream._state==="writable")eQ(W,Y)}function w9(W){let Y=W._controlledWritableStream;e5(Y),d1(W);let w=W._closeAlgorithm();EX(W),T(w,()=>{return r5(Y),null},(V)=>{return t5(Y,V),null})}function z9(W,Y){let w=W._controlledWritableStream;$9(w);let V=W._writeAlgorithm(Y);T(V,()=>{o5(w);let A=w._state;if(d1(W),!Y0(w)&&A==="writable"){let j=H8(W);G8(w,j)}return _X(W),null},(A)=>{if(w._state==="writable")EX(W);return a5(w,A),null})}function H8(W){return sQ(W)<=0}function eQ(W,Y){let w=W._controlledWritableStream;EX(W),W8(w,Y)}function LX(W){return new TypeError(`WritableStream.prototype.${W} can only be used on a WritableStream`)}function M8(W){return new TypeError(`WritableStreamDefaultController.prototype.${W} can only be used on a WritableStreamDefaultController`)}function w4(W){return new TypeError(`WritableStreamDefaultWriter.prototype.${W} can only be used on a WritableStreamDefaultWriter`)}function E6(W){return new TypeError("Cannot "+W+" a stream using a released writer")}function RX(W){W._closedPromise=B((Y,w)=>{W._closedPromise_resolve=Y,W._closedPromise_reject=w,W._closedPromiseState="pending"})}function $7(W,Y){RX(W),w8(W,Y)}function B9(W){RX(W),X7(W)}function w8(W,Y){if(W._closedPromise_reject===void 0)return;P(W._closedPromise),W._closedPromise_reject(Y),W._closedPromise_resolve=void 0,W._closedPromise_reject=void 0,W._closedPromiseState="rejected"}function D9(W,Y){$7(W,Y)}function X7(W){if(W._closedPromise_resolve===void 0)return;W._closedPromise_resolve(void 0),W._closedPromise_resolve=void 0,W._closedPromise_reject=void 0,W._closedPromiseState="resolved"}function vX(W){W._readyPromise=B((Y,w)=>{W._readyPromise_resolve=Y,W._readyPromise_reject=w}),W._readyPromiseState="pending"}function z8(W,Y){vX(W),W7(W,Y)}function Q7(W){vX(W),B8(W)}function W7(W,Y){if(W._readyPromise_reject===void 0)return;P(W._readyPromise),W._readyPromise_reject(Y),W._readyPromise_resolve=void 0,W._readyPromise_reject=void 0,W._readyPromiseState="rejected"}function V9(W){vX(W)}function O9(W,Y){z8(W,Y)}function B8(W){if(W._readyPromise_resolve===void 0)return;W._readyPromise_resolve(void 0),W._readyPromise_resolve=void 0,W._readyPromise_reject=void 0,W._readyPromiseState="fulfilled"}function q9(){if(typeof globalThis!=="undefined")return globalThis;else if(typeof self!=="undefined")return self;else if(typeof global!=="undefined")return global;return}let D8=q9();function A9(W){if(!(typeof W==="function"||typeof W==="object"))return!1;if(W.name!=="DOMException")return!1;try{return new W,!0}catch(Y){return!1}}function j9(){let W=D8===null||D8===void 0?void 0:D8.DOMException;return A9(W)?W:void 0}function K9(){let W=function Y(w,V){if(this.message=w||"",this.name=V||"Error",Error.captureStackTrace)Error.captureStackTrace(this,this.constructor)};return G(W,"DOMException"),W.prototype=Object.create(Error.prototype),Object.defineProperty(W.prototype,"constructor",{value:W,writable:!0,configurable:!0}),W}let U9=j9()||K9();function J7(W,Y,w,V,A,j){let K=v4(W),C=uQ(Y);W._disturbed=!0;let g=!1,c=O(void 0);return B((n,t)=>{let W$;if(j!==void 0){if(W$=()=>{let h=j.reason!==void 0?j.reason:new U9("Aborted","AbortError"),e=[];if(!V)e.push(()=>{if(Y._state==="writable")return SX(Y,h);return O(void 0)});if(!A)e.push(()=>{if(W._state==="readable")return l$(W,h);return O(void 0)});F$(()=>Promise.all(e.map((J$)=>J$())),!0,h)},j.aborted){W$();return}j.addEventListener("abort",W$)}function E0(){return B((h,e)=>{function J$(v$){if(v$)h();else x(T4(),J$,e)}J$(!1)})}function T4(){if(g)return O(!0);return x(C._readyPromise,()=>{return B((h,e)=>{j6(K,{_chunkSteps:(J$)=>{c=x(aQ(C,J$),void 0,X),h(!1)},_closeSteps:()=>h(!0),_errorSteps:e})})})}if(_0(W,K._closedPromise,(h)=>{if(!V)F$(()=>SX(Y,h),!0,h);else x$(!0,h);return null}),_0(Y,C._closedPromise,(h)=>{if(!A)F$(()=>l$(W,h),!0,h);else x$(!0,h);return null}),U$(W,K._closedPromise,()=>{if(!w)F$(()=>Q9(C));else x$();return null}),Y0(Y)||Y._state==="closed"){let h=new TypeError("the destination writable stream closed before all data could be piped to it");if(!A)F$(()=>l$(W,h),!0,h);else x$(!0,h)}P(E0());function l0(){let h=c;return x(c,()=>h!==c?l0():void 0)}function _0(h,e,J$){if(h._state==="errored")J$(h._storedError);else F(e,J$)}function U$(h,e,J$){if(h._state==="closed")J$();else _(e,J$)}function F$(h,e,J$){if(g)return;if(g=!0,Y._state==="writable"&&!Y0(Y))_(l0(),v$);else v$();function v$(){return T(h(),()=>L0(e,J$),(g4)=>L0(!0,g4)),null}}function x$(h,e){if(g)return;if(g=!0,Y._state==="writable"&&!Y0(Y))_(l0(),()=>L0(h,e));else L0(h,e)}function L0(h,e){if(oQ(C),A0(K),j!==void 0)j.removeEventListener("abort",W$);if(h)t(e);else n(void 0);return null}})}class M0{constructor(){throw new TypeError("Illegal constructor")}get desiredSize(){if(!CX(this))throw kX("desiredSize");return V8(this)}close(){if(!CX(this))throw kX("close");if(!b4(this))throw new TypeError("The stream is not in a state that permits close");z4(this)}enqueue(W=void 0){if(!CX(this))throw kX("enqueue");if(!b4(this))throw new TypeError("The stream is not in a state that permits enqueue");return P4(this,W)}error(W=void 0){if(!CX(this))throw kX("error");m$(this,W)}[W0](W){h0(this);let Y=this._cancelAlgorithm(W);return IX(this),Y}[b1](W){let Y=this._controlledReadableStream;if(this._queue.length>0){let w=d1(this);if(this._closeRequested&&this._queue.length===0)IX(this),R6(Y);else _6(this);W._chunkSteps(w)}else OQ(Y,W),_6(this)}[f1](){}}if(Object.defineProperties(M0.prototype,{close:{enumerable:!0},enqueue:{enumerable:!0},error:{enumerable:!0},desiredSize:{enumerable:!0}}),G(M0.prototype.close,"close"),G(M0.prototype.enqueue,"enqueue"),G(M0.prototype.error,"error"),typeof Symbol.toStringTag==="symbol")Object.defineProperty(M0.prototype,Symbol.toStringTag,{value:"ReadableStreamDefaultController",configurable:!0});function CX(W){if(!Q(W))return!1;if(!Object.prototype.hasOwnProperty.call(W,"_controlledReadableStream"))return!1;return W instanceof M0}function _6(W){if(!G7(W))return;if(W._pulling){W._pullAgain=!0;return}W._pulling=!0;let w=W._pullAlgorithm();T(w,()=>{if(W._pulling=!1,W._pullAgain)W._pullAgain=!1,_6(W);return null},(V)=>{return m$(W,V),null})}function G7(W){let Y=W._controlledReadableStream;if(!b4(W))return!1;if(!W._started)return!1;if(m0(Y)&&zX(Y)>0)return!0;if(V8(W)>0)return!0;return!1}function IX(W){W._pullAlgorithm=void 0,W._cancelAlgorithm=void 0,W._strategySizeAlgorithm=void 0}function z4(W){if(!b4(W))return;let Y=W._controlledReadableStream;if(W._closeRequested=!0,W._queue.length===0)IX(W),R6(Y)}function P4(W,Y){if(!b4(W))return;let w=W._controlledReadableStream;if(m0(w)&&zX(w)>0)l1(w,Y,!1);else{let V;try{V=W._strategySizeAlgorithm(Y)}catch(A){throw m$(W,A),A}try{o1(W,Y,V)}catch(A){throw m$(W,A),A}}_6(W)}function m$(W,Y){let w=W._controlledReadableStream;if(w._state!=="readable")return;h0(W),IX(W),w7(w,Y)}function V8(W){let Y=W._controlledReadableStream._state;if(Y==="errored")return null;if(Y==="closed")return 0;return W._strategyHWM-W._queueTotalSize}function N9(W){if(G7(W))return!1;return!0}function b4(W){let Y=W._controlledReadableStream._state;if(!W._closeRequested&&Y==="readable")return!0;return!1}function Y7(W,Y,w,V,A,j,K){Y._controlledReadableStream=W,Y._queue=void 0,Y._queueTotalSize=void 0,h0(Y),Y._started=!1,Y._closeRequested=!1,Y._pullAgain=!1,Y._pulling=!1,Y._strategySizeAlgorithm=K,Y._strategyHWM=j,Y._pullAlgorithm=V,Y._cancelAlgorithm=A,W._readableStreamController=Y;let C=w();T(O(C),()=>{return Y._started=!0,_6(Y),null},(g)=>{return m$(Y,g),null})}function S9(W,Y,w,V){let A=Object.create(M0.prototype),j,K,C;if(Y.start!==void 0)j=()=>Y.start(A);else j=()=>{return};if(Y.pull!==void 0)K=()=>Y.pull(A);else K=()=>O(void 0);if(Y.cancel!==void 0)C=(g)=>Y.cancel(g);else C=()=>O(void 0);Y7(W,A,j,K,C,w,V)}function kX(W){return new TypeError(`ReadableStreamDefaultController.prototype.${W} can only be used on a ReadableStreamDefaultController`)}function F9(W,Y){if(J4(W._readableStreamController))return _9(W);return E9(W)}function E9(W,Y){let w=v4(W),V=!1,A=!1,j=!1,K=!1,C,g,c,n,t,W$=B((U$)=>{t=U$});function E0(){if(V)return A=!0,O(void 0);return V=!0,j6(w,{_chunkSteps:(F$)=>{I(()=>{A=!1;let x$=F$,L0=F$;if(!j)P4(c._readableStreamController,x$);if(!K)P4(n._readableStreamController,L0);if(V=!1,A)E0()})},_closeSteps:()=>{if(V=!1,!j)z4(c._readableStreamController);if(!K)z4(n._readableStreamController);if(!j||!K)t(void 0)},_errorSteps:()=>{V=!1}}),O(void 0)}function T4(U$){if(j=!0,C=U$,K){let F$=K6([C,g]),x$=l$(W,F$);t(x$)}return W$}function l0(U$){if(K=!0,g=U$,j){let F$=K6([C,g]),x$=l$(W,F$);t(x$)}return W$}function _0(){}return c=L6(_0,E0,T4),n=L6(_0,E0,l0),F(w._closedPromise,(U$)=>{if(m$(c._readableStreamController,U$),m$(n._readableStreamController,U$),!j||!K)t(void 0);return null}),[c,n]}function _9(W){let Y=v4(W),w=!1,V=!1,A=!1,j=!1,K=!1,C,g,c,n,t,W$=B((h)=>{t=h});function E0(h){F(h._closedPromise,(e)=>{if(h!==Y)return null;if(g$(c._readableStreamController,e),g$(n._readableStreamController,e),!j||!K)t(void 0);return null})}function T4(){if(Y4(Y))A0(Y),Y=v4(W),E0(Y);j6(Y,{_chunkSteps:(e)=>{I(()=>{V=!1,A=!1;let J$=e,v$=e;if(!j&&!K)try{v$=_Q(e)}catch(g4){g$(c._readableStreamController,g4),g$(n._readableStreamController,g4),t(l$(W,g4));return}if(!j)qX(c._readableStreamController,J$);if(!K)qX(n._readableStreamController,v$);if(w=!1,V)_0();else if(A)U$()})},_closeSteps:()=>{if(w=!1,!j)U6(c._readableStreamController);if(!K)U6(n._readableStreamController);if(c._readableStreamController._pendingPullIntos.length>0)AX(c._readableStreamController,0);if(n._readableStreamController._pendingPullIntos.length>0)AX(n._readableStreamController,0);if(!j||!K)t(void 0)},_errorSteps:()=>{w=!1}})}function l0(h,e){if(g0(Y))A0(Y),Y=hQ(W),E0(Y);let J$=e?n:c,v$=e?c:n;mQ(Y,h,1,{_chunkSteps:(x4)=>{I(()=>{V=!1,A=!1;let h4=e?K:j;if(!(e?j:K)){let F7;try{F7=_Q(x4)}catch(K8){g$(J$._readableStreamController,K8),g$(v$._readableStreamController,K8),t(l$(W,K8));return}if(!h4)jX(J$._readableStreamController,x4);qX(v$._readableStreamController,F7)}else if(!h4)jX(J$._readableStreamController,x4);if(w=!1,V)_0();else if(A)U$()})},_closeSteps:(x4)=>{w=!1;let h4=e?K:j,gX=e?j:K;if(!h4)U6(J$._readableStreamController);if(!gX)U6(v$._readableStreamController);if(x4!==void 0){if(!h4)jX(J$._readableStreamController,x4);if(!gX&&v$._readableStreamController._pendingPullIntos.length>0)AX(v$._readableStreamController,0)}if(!h4||!gX)t(void 0)},_errorSteps:()=>{w=!1}})}function _0(){if(w)return V=!0,O(void 0);w=!0;let h=e1(c._readableStreamController);if(h===null)T4();else l0(h._view,!1);return O(void 0)}function U$(){if(w)return A=!0,O(void 0);w=!0;let h=e1(n._readableStreamController);if(h===null)T4();else l0(h._view,!0);return O(void 0)}function F$(h){if(j=!0,C=h,K){let e=K6([C,g]),J$=l$(W,e);t(J$)}return W$}function x$(h){if(K=!0,g=h,j){let e=K6([C,g]),J$=l$(W,e);t(J$)}return W$}function L0(){return}return c=M7(L0,_0,F$),n=M7(L0,U$,x$),E0(Y),[c,n]}function L9(W){return Q(W)&&typeof W.getReader!=="undefined"}function R9(W){if(L9(W))return C9(W.getReader());return v9(W)}function v9(W){let Y,w=EQ(W,"async"),V=X;function A(){let K;try{K=K5(w)}catch(g){return q(g)}let C=O(K);return f(C,(g)=>{if(!Q(g))throw new TypeError("The promise returned by the iterator.next() method must fulfill with an object");if(U5(g))z4(Y._readableStreamController);else{let n=N5(g);P4(Y._readableStreamController,n)}})}function j(K){let C=w.iterator,g;try{g=DX(C,"return")}catch(t){return q(t)}if(g===void 0)return O(void 0);let c;try{c=Q$(g,C,[K])}catch(t){return q(t)}let n=O(c);return f(n,(t)=>{if(!Q(t))throw new TypeError("The promise returned by the iterator.return() method must fulfill with an object");return})}return Y=L6(V,A,j,0),Y}function C9(W){let Y,w=X;function V(){let j;try{j=W.read()}catch(K){return q(K)}return f(j,(K)=>{if(!Q(K))throw new TypeError("The promise returned by the reader.read() method must fulfill with an object");if(K.done)z4(Y._readableStreamController);else{let C=K.value;P4(Y._readableStreamController,C)}})}function A(j){try{return O(W.cancel(j))}catch(K){return q(K)}}return Y=L6(w,V,A,0),Y}function I9(W,Y){J0(W,Y);let w=W,V=w===null||w===void 0?void 0:w.autoAllocateChunkSize,A=w===null||w===void 0?void 0:w.cancel,j=w===null||w===void 0?void 0:w.pull,K=w===null||w===void 0?void 0:w.start,C=w===null||w===void 0?void 0:w.type;return{autoAllocateChunkSize:V===void 0?void 0:y1(V,`${Y} has member 'autoAllocateChunkSize' that`),cancel:A===void 0?void 0:k9(A,w,`${Y} has member 'cancel' that`),pull:j===void 0?void 0:P9(j,w,`${Y} has member 'pull' that`),start:K===void 0?void 0:b9(K,w,`${Y} has member 'start' that`),type:C===void 0?void 0:f9(C,`${Y} has member 'type' that`)}}function k9(W,Y,w){return T$(W,w),(V)=>o(W,Y,[V])}function P9(W,Y,w){return T$(W,w),(V)=>o(W,Y,[V])}function b9(W,Y,w){return T$(W,w),(V)=>Q$(W,Y,[V])}function f9(W,Y){if(W=`${W}`,W!=="bytes")throw new TypeError(`${Y} '${W}' is not a valid enumeration value for ReadableStreamType`);return W}function T9(W,Y){J0(W,Y);let w=W===null||W===void 0?void 0:W.preventCancel;return{preventCancel:Boolean(w)}}function H7(W,Y){J0(W,Y);let w=W===null||W===void 0?void 0:W.preventAbort,V=W===null||W===void 0?void 0:W.preventCancel,A=W===null||W===void 0?void 0:W.preventClose,j=W===null||W===void 0?void 0:W.signal;if(j!==void 0)g9(j,`${Y} has member 'signal' that`);return{preventAbort:Boolean(w),preventCancel:Boolean(V),preventClose:Boolean(A),signal:j}}function g9(W,Y){if(!u5(W))throw new TypeError(`${Y} is not an AbortSignal.`)}function x9(W,Y){J0(W,Y);let w=W===null||W===void 0?void 0:W.readable;h1(w,"readable","ReadableWritablePair"),m1(w,`${Y} has member 'readable' that`);let V=W===null||W===void 0?void 0:W.writable;return h1(V,"writable","ReadableWritablePair"),cQ(V,`${Y} has member 'writable' that`),{readable:w,writable:V}}class O${constructor(W={},Y={}){if(W===void 0)W=null;else DQ(W,"First parameter");let w=NX(Y,"Second parameter"),V=I9(W,"First parameter");if(O8(this),V.type==="bytes"){if(w.size!==void 0)throw new RangeError("The strategy for a byte stream cannot have a size function");let A=S6(w,0);k5(this,V,A)}else{let A=UX(w),j=S6(w,1);S9(this,V,j,A)}}get locked(){if(!y0(this))throw B4("locked");return m0(this)}cancel(W=void 0){if(!y0(this))return q(B4("cancel"));if(m0(this))return q(new TypeError("Cannot cancel a stream that already has a reader"));return l$(this,W)}getReader(W=void 0){if(!y0(this))throw B4("getReader");if(b5(W,"First parameter").mode===void 0)return v4(this);return hQ(this)}pipeThrough(W,Y={}){if(!y0(this))throw B4("pipeThrough");j0(W,1,"pipeThrough");let w=x9(W,"First parameter"),V=H7(Y,"Second parameter");if(m0(this))throw new TypeError("ReadableStream.prototype.pipeThrough cannot be used on a locked ReadableStream");if(k4(w.writable))throw new TypeError("ReadableStream.prototype.pipeThrough cannot be used on a locked WritableStream");let A=J7(this,w.writable,V.preventClose,V.preventAbort,V.preventCancel,V.signal);return P(A),w.readable}pipeTo(W,Y={}){if(!y0(this))return q(B4("pipeTo"));if(W===void 0)return q("Parameter 1 is required in 'pipeTo'.");if(!I4(W))return q(new TypeError("ReadableStream.prototype.pipeTo's first argument must be a WritableStream"));let w;try{w=H7(Y,"Second parameter")}catch(V){return q(V)}if(m0(this))return q(new TypeError("ReadableStream.prototype.pipeTo cannot be used on a locked ReadableStream"));if(k4(W))return q(new TypeError("ReadableStream.prototype.pipeTo cannot be used on a locked WritableStream"));return J7(this,W,w.preventClose,w.preventAbort,w.preventCancel,w.signal)}tee(){if(!y0(this))throw B4("tee");let W=F9(this);return K6(W)}values(W=void 0){if(!y0(this))throw B4("values");let Y=T9(W,"First parameter");return A5(this,Y.preventCancel)}[i1](W){return this.values(W)}static from(W){return R9(W)}}if(Object.defineProperties(O$,{from:{enumerable:!0}}),Object.defineProperties(O$.prototype,{cancel:{enumerable:!0},getReader:{enumerable:!0},pipeThrough:{enumerable:!0},pipeTo:{enumerable:!0},tee:{enumerable:!0},values:{enumerable:!0},locked:{enumerable:!0}}),G(O$.from,"from"),G(O$.prototype.cancel,"cancel"),G(O$.prototype.getReader,"getReader"),G(O$.prototype.pipeThrough,"pipeThrough"),G(O$.prototype.pipeTo,"pipeTo"),G(O$.prototype.tee,"tee"),G(O$.prototype.values,"values"),typeof Symbol.toStringTag==="symbol")Object.defineProperty(O$.prototype,Symbol.toStringTag,{value:"ReadableStream",configurable:!0});Object.defineProperty(O$.prototype,i1,{value:O$.prototype.values,writable:!0,configurable:!0});function L6(W,Y,w,V=1,A=()=>1){let j=Object.create(O$.prototype);O8(j);let K=Object.create(M0.prototype);return Y7(j,K,W,Y,w,V,A),j}function M7(W,Y,w){let V=Object.create(O$.prototype);O8(V);let A=Object.create(G0.prototype);return xQ(V,A,W,Y,w,0,void 0),V}function O8(W){W._state="readable",W._reader=void 0,W._storedError=void 0,W._disturbed=!1}function y0(W){if(!Q(W))return!1;if(!Object.prototype.hasOwnProperty.call(W,"_readableStreamController"))return!1;return W instanceof O$}function m0(W){if(W._reader===void 0)return!1;return!0}function l$(W,Y){if(W._disturbed=!0,W._state==="closed")return O(void 0);if(W._state==="errored")return q(W._storedError);R6(W);let w=W._reader;if(w!==void 0&&Y4(w)){let A=w._readIntoRequests;w._readIntoRequests=new u,A.forEach((j)=>{j._closeSteps(void 0)})}let V=W._readableStreamController[W0](Y);return f(V,X)}function R6(W){W._state="closed";let Y=W._reader;if(Y===void 0)return;if(zQ(Y),g0(Y)){let w=Y._readRequests;Y._readRequests=new u,w.forEach((V)=>{V._closeSteps()})}}function w7(W,Y){W._state="errored",W._storedError=Y;let w=W._reader;if(w===void 0)return;if(x1(w,Y),g0(w))AQ(w,Y);else lQ(w,Y)}function B4(W){return new TypeError(`ReadableStream.prototype.${W} can only be used on a ReadableStream`)}function z7(W,Y){J0(W,Y);let w=W===null||W===void 0?void 0:W.highWaterMark;return h1(w,"highWaterMark","QueuingStrategyInit"),{highWaterMark:Z1(w)}}let B7=(W)=>{return W.byteLength};G(B7,"size");class v6{constructor(W){j0(W,1,"ByteLengthQueuingStrategy"),W=z7(W,"First parameter"),this._byteLengthQueuingStrategyHighWaterMark=W.highWaterMark}get highWaterMark(){if(!V7(this))throw D7("highWaterMark");return this._byteLengthQueuingStrategyHighWaterMark}get size(){if(!V7(this))throw D7("size");return B7}}if(Object.defineProperties(v6.prototype,{highWaterMark:{enumerable:!0},size:{enumerable:!0}}),typeof Symbol.toStringTag==="symbol")Object.defineProperty(v6.prototype,Symbol.toStringTag,{value:"ByteLengthQueuingStrategy",configurable:!0});function D7(W){return new TypeError(`ByteLengthQueuingStrategy.prototype.${W} can only be used on a ByteLengthQueuingStrategy`)}function V7(W){if(!Q(W))return!1;if(!Object.prototype.hasOwnProperty.call(W,"_byteLengthQueuingStrategyHighWaterMark"))return!1;return W instanceof v6}let O7=()=>{return 1};G(O7,"size");class C6{constructor(W){j0(W,1,"CountQueuingStrategy"),W=z7(W,"First parameter"),this._countQueuingStrategyHighWaterMark=W.highWaterMark}get highWaterMark(){if(!A7(this))throw q7("highWaterMark");return this._countQueuingStrategyHighWaterMark}get size(){if(!A7(this))throw q7("size");return O7}}if(Object.defineProperties(C6.prototype,{highWaterMark:{enumerable:!0},size:{enumerable:!0}}),typeof Symbol.toStringTag==="symbol")Object.defineProperty(C6.prototype,Symbol.toStringTag,{value:"CountQueuingStrategy",configurable:!0});function q7(W){return new TypeError(`CountQueuingStrategy.prototype.${W} can only be used on a CountQueuingStrategy`)}function A7(W){if(!Q(W))return!1;if(!Object.prototype.hasOwnProperty.call(W,"_countQueuingStrategyHighWaterMark"))return!1;return W instanceof C6}function h9(W,Y){J0(W,Y);let w=W===null||W===void 0?void 0:W.cancel,V=W===null||W===void 0?void 0:W.flush,A=W===null||W===void 0?void 0:W.readableType,j=W===null||W===void 0?void 0:W.start,K=W===null||W===void 0?void 0:W.transform,C=W===null||W===void 0?void 0:W.writableType;return{cancel:w===void 0?void 0:l9(w,W,`${Y} has member 'cancel' that`),flush:V===void 0?void 0:Z9(V,W,`${Y} has member 'flush' that`),readableType:A,start:j===void 0?void 0:y9(j,W,`${Y} has member 'start' that`),transform:K===void 0?void 0:m9(K,W,`${Y} has member 'transform' that`),writableType:C}}function Z9(W,Y,w){return T$(W,w),(V)=>o(W,Y,[V])}function y9(W,Y,w){return T$(W,w),(V)=>Q$(W,Y,[V])}function m9(W,Y,w){return T$(W,w),(V,A)=>o(W,Y,[V,A])}function l9(W,Y,w){return T$(W,w),(V)=>o(W,Y,[V])}class I6{constructor(W={},Y={},w={}){if(W===void 0)W=null;let V=NX(Y,"Second parameter"),A=NX(w,"Third parameter"),j=h9(W,"First parameter");if(j.readableType!==void 0)throw new RangeError("Invalid readableType specified");if(j.writableType!==void 0)throw new RangeError("Invalid writableType specified");let K=S6(A,0),C=UX(A),g=S6(V,1),c=UX(V),n,t=B((W$)=>{n=W$});if(c9(this,t,g,c,K,C),n9(this,j),j.start!==void 0)n(j.start(this._transformStreamController));else n(void 0)}get readable(){if(!j7(this))throw S7("readable");return this._readable}get writable(){if(!j7(this))throw S7("writable");return this._writable}}if(Object.defineProperties(I6.prototype,{readable:{enumerable:!0},writable:{enumerable:!0}}),typeof Symbol.toStringTag==="symbol")Object.defineProperty(I6.prototype,Symbol.toStringTag,{value:"TransformStream",configurable:!0});function c9(W,Y,w,V,A,j){function K(){return Y}function C(W$){return d9(W,W$)}function g(W$){return o9(W,W$)}function c(){return a9(W)}W._writable=i5(K,C,c,g,w,V);function n(){return r9(W)}function t(W$){return t9(W,W$)}W._readable=L6(K,n,t,A,j),W._backpressure=void 0,W._backpressureChangePromise=void 0,W._backpressureChangePromise_resolve=void 0,PX(W,!0),W._transformStreamController=void 0}function j7(W){if(!Q(W))return!1;if(!Object.prototype.hasOwnProperty.call(W,"_transformStreamController"))return!1;return W instanceof I6}function K7(W,Y){m$(W._readable._readableStreamController,Y),q8(W,Y)}function q8(W,Y){fX(W._transformStreamController),F6(W._writable._writableStreamController,Y),A8(W)}function A8(W){if(W._backpressure)PX(W,!1)}function PX(W,Y){if(W._backpressureChangePromise!==void 0)W._backpressureChangePromise_resolve();W._backpressureChangePromise=B((w)=>{W._backpressureChangePromise_resolve=w}),W._backpressure=Y}class F0{constructor(){throw new TypeError("Illegal constructor")}get desiredSize(){if(!bX(this))throw TX("desiredSize");let W=this._controlledTransformStream._readable._readableStreamController;return V8(W)}enqueue(W=void 0){if(!bX(this))throw TX("enqueue");U7(this,W)}error(W=void 0){if(!bX(this))throw TX("error");p9(this,W)}terminate(){if(!bX(this))throw TX("terminate");i9(this)}}if(Object.defineProperties(F0.prototype,{enqueue:{enumerable:!0},error:{enumerable:!0},terminate:{enumerable:!0},desiredSize:{enumerable:!0}}),G(F0.prototype.enqueue,"enqueue"),G(F0.prototype.error,"error"),G(F0.prototype.terminate,"terminate"),typeof Symbol.toStringTag==="symbol")Object.defineProperty(F0.prototype,Symbol.toStringTag,{value:"TransformStreamDefaultController",configurable:!0});function bX(W){if(!Q(W))return!1;if(!Object.prototype.hasOwnProperty.call(W,"_controlledTransformStream"))return!1;return W instanceof F0}function u9(W,Y,w,V,A){Y._controlledTransformStream=W,W._transformStreamController=Y,Y._transformAlgorithm=w,Y._flushAlgorithm=V,Y._cancelAlgorithm=A,Y._finishPromise=void 0,Y._finishPromise_resolve=void 0,Y._finishPromise_reject=void 0}function n9(W,Y){let w=Object.create(F0.prototype),V,A,j;if(Y.transform!==void 0)V=(K)=>Y.transform(K,w);else V=(K)=>{try{return U7(w,K),O(void 0)}catch(C){return q(C)}};if(Y.flush!==void 0)A=()=>Y.flush(w);else A=()=>O(void 0);if(Y.cancel!==void 0)j=(K)=>Y.cancel(K);else j=()=>O(void 0);u9(W,w,V,A,j)}function fX(W){W._transformAlgorithm=void 0,W._flushAlgorithm=void 0,W._cancelAlgorithm=void 0}function U7(W,Y){let w=W._controlledTransformStream,V=w._readable._readableStreamController;if(!b4(V))throw new TypeError("Readable side is not in a state that permits enqueue");try{P4(V,Y)}catch(j){throw q8(w,j),w._readable._storedError}if(N9(V)!==w._backpressure)PX(w,!0)}function p9(W,Y){K7(W._controlledTransformStream,Y)}function N7(W,Y){let w=W._transformAlgorithm(Y);return f(w,void 0,(V)=>{throw K7(W._controlledTransformStream,V),V})}function i9(W){let Y=W._controlledTransformStream,w=Y._readable._readableStreamController;z4(w);let V=new TypeError("TransformStream terminated");q8(Y,V)}function d9(W,Y){let w=W._transformStreamController;if(W._backpressure){let V=W._backpressureChangePromise;return f(V,()=>{let A=W._writable;if(A._state==="erroring")throw A._storedError;return N7(w,Y)})}return N7(w,Y)}function o9(W,Y){let w=W._transformStreamController;if(w._finishPromise!==void 0)return w._finishPromise;let V=W._readable;w._finishPromise=B((j,K)=>{w._finishPromise_resolve=j,w._finishPromise_reject=K});let A=w._cancelAlgorithm(Y);return fX(w),T(A,()=>{if(V._state==="errored")f4(w,V._storedError);else m$(V._readableStreamController,Y),j8(w);return null},(j)=>{return m$(V._readableStreamController,j),f4(w,j),null}),w._finishPromise}function a9(W){let Y=W._transformStreamController;if(Y._finishPromise!==void 0)return Y._finishPromise;let w=W._readable;Y._finishPromise=B((A,j)=>{Y._finishPromise_resolve=A,Y._finishPromise_reject=j});let V=Y._flushAlgorithm();return fX(Y),T(V,()=>{if(w._state==="errored")f4(Y,w._storedError);else z4(w._readableStreamController),j8(Y);return null},(A)=>{return m$(w._readableStreamController,A),f4(Y,A),null}),Y._finishPromise}function r9(W){return PX(W,!1),W._backpressureChangePromise}function t9(W,Y){let w=W._transformStreamController;if(w._finishPromise!==void 0)return w._finishPromise;let V=W._writable;w._finishPromise=B((j,K)=>{w._finishPromise_resolve=j,w._finishPromise_reject=K});let A=w._cancelAlgorithm(Y);return fX(w),T(A,()=>{if(V._state==="errored")f4(w,V._storedError);else F6(V._writableStreamController,Y),A8(W),j8(w);return null},(j)=>{return F6(V._writableStreamController,j),A8(W),f4(w,j),null}),w._finishPromise}function TX(W){return new TypeError(`TransformStreamDefaultController.prototype.${W} can only be used on a TransformStreamDefaultController`)}function j8(W){if(W._finishPromise_resolve===void 0)return;W._finishPromise_resolve(),W._finishPromise_resolve=void 0,W._finishPromise_reject=void 0}function f4(W,Y){if(W._finishPromise_reject===void 0)return;P(W._finishPromise),W._finishPromise_reject(Y),W._finishPromise_resolve=void 0,W._finishPromise_reject=void 0}function S7(W){return new TypeError(`TransformStream.prototype.${W} can only be used on a TransformStream`)}$.ByteLengthQueuingStrategy=v6,$.CountQueuingStrategy=C6,$.ReadableByteStreamController=G0,$.ReadableStream=O$,$.ReadableStreamBYOBReader=N0,$.ReadableStreamBYOBRequest=Z0,$.ReadableStreamDefaultController=M0,$.ReadableStreamDefaultReader=K0,$.TransformStream=I6,$.TransformStreamDefaultController=F0,$.WritableStream=S0,$.WritableStreamDefaultController=M4,$.WritableStreamDefaultWriter=H0})});var rW=xX(()=>{if(!globalThis.ReadableStream)try{let $=require("node:process"),{emitWarning:X}=$;try{$.emitWarning=()=>{},Object.assign(globalThis,require("node:stream/web")),$.emitWarning=X}catch(Q){throw $.emitWarning=X,Q}}catch($){Object.assign(globalThis,aW())}try{let{Blob:$}=require("buffer");if($&&!$.prototype.stream)$.prototype.stream=function X(Q){let J=0,G=this;return new ReadableStream({type:"bytes",async pull(H){let z=await G.slice(J,Math.min(G.size,J+65536)).arrayBuffer();if(J+=z.byteLength,H.enqueue(new Uint8Array(z)),J===G.size)H.close()}})}}catch($){}});async function*Z8($,X=!0){for(let Q of $)if("stream"in Q)yield*Q.stream();else if(ArrayBuffer.isView(Q))if(X){let J=Q.byteOffset,G=Q.byteOffset+Q.byteLength;while(J!==G){let H=Math.min(G-J,tW),M=Q.buffer.slice(J,J+H);J+=M.byteLength,yield new Uint8Array(M)}}else yield Q;else{let J=0,G=Q;while(J!==G.size){let M=await G.slice(J,Math.min(G.size,J+tW)).arrayBuffer();J+=M.byteLength,yield new Uint8Array(M)}}}var Bz,tW=65536,sW,zG,a$;var p6=B$(()=>{Bz=C$(rW());/*! fetch-blob. MIT License. Jimmy Wärting <https://jimmy.warting.se/opensource> */sW=class ${#$=[];#X="";#Q=0;#W="transparent";constructor(X=[],Q={}){if(typeof X!=="object"||X===null)throw new TypeError("Failed to construct 'Blob': The provided value cannot be converted to a sequence.");if(typeof X[Symbol.iterator]!=="function")throw new TypeError("Failed to construct 'Blob': The object must have a callable @@iterator property.");if(typeof Q!=="object"&&typeof Q!=="function")throw new TypeError("Failed to construct 'Blob': parameter 2 cannot convert to dictionary.");if(Q===null)Q={};let J=new TextEncoder;for(let H of X){let M;if(ArrayBuffer.isView(H))M=new Uint8Array(H.buffer.slice(H.byteOffset,H.byteOffset+H.byteLength));else if(H instanceof ArrayBuffer)M=new Uint8Array(H.slice(0));else if(H instanceof $)M=H;else M=J.encode(`${H}`);this.#Q+=ArrayBuffer.isView(M)?M.byteLength:M.size,this.#$.push(M)}this.#W=`${Q.endings===void 0?"transparent":Q.endings}`;let G=Q.type===void 0?"":String(Q.type);this.#X=/^[\x20-\x7E]*$/.test(G)?G:""}get size(){return this.#Q}get type(){return this.#X}async text(){let X=new TextDecoder,Q="";for await(let J of Z8(this.#$,!1))Q+=X.decode(J,{stream:!0});return Q+=X.decode(),Q}async arrayBuffer(){let X=new Uint8Array(this.size),Q=0;for await(let J of Z8(this.#$,!1))X.set(J,Q),Q+=J.length;return X.buffer}stream(){let X=Z8(this.#$,!0);return new globalThis.ReadableStream({type:"bytes",async pull(Q){let J=await X.next();J.done?Q.close():Q.enqueue(J.value)},async cancel(){await X.return()}})}slice(X=0,Q=this.size,J=""){let{size:G}=this,H=X<0?Math.max(G+X,0):Math.min(X,G),M=Q<0?Math.max(G+Q,0):Math.min(Q,G),z=Math.max(M-H,0),B=this.#$,O=[],q=0;for(let T of B){if(q>=z)break;let _=ArrayBuffer.isView(T)?T.byteLength:T.size;if(H&&_<=H)H-=_,M-=_;else{let F;if(ArrayBuffer.isView(T))F=T.subarray(H,Math.min(_,M)),q+=F.byteLength;else F=T.slice(H,Math.min(_,M)),q+=F.size;M-=_,O.push(F),H=0}}let x=new $([],{type:String(J).toLowerCase()});return x.#Q=z,x.#$=O,x}get[Symbol.toStringTag](){return"Blob"}static[Symbol.hasInstance](X){return X&&typeof X==="object"&&typeof X.constructor==="function"&&(typeof X.stream==="function"||typeof X.arrayBuffer==="function")&&/^(Blob|File)$/.test(X[Symbol.toStringTag])}};Object.defineProperties(sW.prototype,{size:{enumerable:!0},type:{enumerable:!0},slice:{enumerable:!0}});zG=sW,a$=zG});var BG,DG,d0;var y8=B$(()=>{p6();BG=class $ extends a${#$=0;#X="";constructor(X,Q,J={}){if(arguments.length<2)throw new TypeError(`Failed to construct 'File': 2 arguments required, but only ${arguments.length} present.`);super(X,J);if(J===null)J={};let G=J.lastModified===void 0?Date.now():Number(J.lastModified);if(!Number.isNaN(G))this.#$=G;this.#X=String(Q)}get name(){return this.#X}get lastModified(){return this.#$}get[Symbol.toStringTag](){return"File"}static[Symbol.hasInstance](X){return!!X&&X instanceof a$&&/^(File)$/.test(X[Symbol.toStringTag])}},DG=BG,d0=DG});function XJ($,X=a$){var Q=`${eW()}${eW()}`.replace(/\./g,"").slice(-28).padStart(32,"-"),J=[],G=`--${Q}\r
3
+ Content-Disposition: form-data; name="`;return $.forEach((H,M)=>typeof H=="string"?J.push(G+m8(M)+`"\r
4
4
  \r
5
5
  ${H.replace(/\r(?!\n)|(?<!\r)\n/g,`\r
6
6
  `)}\r
7
- `):J.push(G+m2(M)+`"; filename="${m2(H.name,1)}"\r
7
+ `):J.push(G+m8(M)+`"; filename="${m8(H.name,1)}"\r
8
8
  Content-Type: ${H.type||"application/octet-stream"}\r
9
9
  \r
10
10
  `,H,`\r
11
- `)),J.push(`--${Q}--`),new X(J,{type:"multipart/form-data; boundary="+Q})}var n6,HG,MG,oQ,wG,rQ=($,X,Q)=>($+="",/^(Blob|File)$/.test(X&&X[n6])?[(Q=Q!==void 0?Q+"":X[n6]=="File"?X.name:"blob",$),X.name!==Q||X[n6]=="blob"?new n0([X],Q,X):X]:[$,X+""]),m2=($,X)=>(X?$:$.replace(/\r?\n|\r/g,`\r
12
- `)).replace(/\n/g,"%0A").replace(/\r/g,"%0D").replace(/"/g,"%22"),_4=($,X,Q)=>{if(X.length<Q)throw new TypeError(`Failed to execute '${$}' on 'FormData': ${Q} arguments required, but only ${X.length} present.`)},i0;var D1=z$(()=>{p6();Z2();/*! formdata-polyfill. MIT License. Jimmy Wärting <https://jimmy.warting.se/opensource> */({toStringTag:n6,iterator:HG,hasInstance:MG}=Symbol),oQ=Math.random,wG="append,set,get,getAll,delete,keys,values,entries,forEach,constructor".split(","),i0=class ${#$=[];constructor(...X){if(X.length)throw new TypeError("Failed to construct 'FormData': parameter 1 is not of type 'HTMLFormElement'.")}get[n6](){return"FormData"}[HG](){return this.entries()}static[MG](X){return X&&typeof X==="object"&&X[n6]==="FormData"&&!wG.some((Q)=>typeof X[Q]!="function")}append(...X){_4("append",arguments,2),this.#$.push(rQ(...X))}delete(X){_4("delete",arguments,1),X+="",this.#$=this.#$.filter(([Q])=>Q!==X)}get(X){_4("get",arguments,1),X+="";for(var Q=this.#$,J=Q.length,G=0;G<J;G++)if(Q[G][0]===X)return Q[G][1];return null}getAll(X,Q){return _4("getAll",arguments,1),Q=[],X+="",this.#$.forEach((J)=>J[0]===X&&Q.push(J[1])),Q}has(X){return _4("has",arguments,1),X+="",this.#$.some((Q)=>Q[0]===X)}forEach(X,Q){_4("forEach",arguments,1);for(var[J,G]of this)X.call(Q,G,J,this)}set(...X){_4("set",arguments,2);var Q=[],J=!0;X=rQ(...X),this.#$.forEach((G)=>{G[0]===X[0]?J&&(J=!Q.push(X)):Q.push(G)}),J&&Q.push(X),this.#$=Q}*entries(){yield*this.#$}*keys(){for(var[X]of this)yield X}*values(){for(var[,X]of this)yield X}}});var d0;var V1=z$(()=>{d0=class d0 extends Error{constructor($,X){super($);Error.captureStackTrace(this,this.constructor),this.type=X}get name(){return this.constructor.name}get[Symbol.toStringTag](){return this.constructor.name}}});var S$;var l2=z$(()=>{V1();S$=class S$ extends d0{constructor($,X,Q){super($,X);if(Q)this.code=this.errno=Q.code,this.erroredSysCall=Q.syscall}}});var O1,c2=($)=>{return typeof $==="object"&&typeof $.append==="function"&&typeof $.delete==="function"&&typeof $.get==="function"&&typeof $.getAll==="function"&&typeof $.has==="function"&&typeof $.set==="function"&&typeof $.sort==="function"&&$[O1]==="URLSearchParams"},i6=($)=>{return $&&typeof $==="object"&&typeof $.arrayBuffer==="function"&&typeof $.type==="string"&&typeof $.stream==="function"&&typeof $.constructor==="function"&&/^(Blob|File)$/.test($[O1])},tQ=($)=>{return typeof $==="object"&&($[O1]==="AbortSignal"||$[O1]==="EventTarget")},sQ=($,X)=>{let Q=new URL(X).hostname,J=new URL($).hostname;return Q===J||Q.endsWith(`.${J}`)},eQ=($,X)=>{let Q=new URL(X).protocol,J=new URL($).protocol;return Q===J};var q1=z$(()=>{O1=Symbol.toStringTag});var X7=j2((_z,$7)=>{/*! node-domexception. MIT License. Jimmy Wärting <https://jimmy.warting.se/opensource> */if(!globalThis.DOMException)try{let{MessageChannel:$}=require("worker_threads"),X=new $().port1,Q=new ArrayBuffer;X.postMessage(Q,[Q,Q])}catch($){$.constructor.name==="DOMException"&&(globalThis.DOMException=$.constructor)}$7.exports=globalThis.DOMException});var A4,Q7,W7,u2,J7=($,X)=>M7(A4.statSync($),$,X),G7=($,X)=>u2($).then((Q)=>M7(Q,$,X)),Y7=($,X)=>u2($).then((Q)=>w7(Q,$,X)),H7=($,X)=>w7(A4.statSync($),$,X),M7=($,X,Q="")=>new r$([new _1({path:X,size:$.size,lastModified:$.mtimeMs,start:0})],{type:Q}),w7=($,X,Q="")=>new n0([new _1({path:X,size:$.size,lastModified:$.mtimeMs,start:0})],Q7.basename(X),{type:Q,lastModified:$.mtimeMs}),_1;var p2=z$(()=>{A4=require("node:fs"),Q7=require("node:path"),W7=x$(X7());Z2();p6();({stat:u2}=A4.promises);_1=class _1{#$;#X;constructor($){this.#$=$.path,this.#X=$.start,this.size=$.size,this.lastModified=$.lastModified}slice($,X){return new _1({path:this.#$,lastModified:this.lastModified,size:X-$,start:this.#X+$})}async*stream(){let{mtimeMs:$}=await u2(this.#$);if($>this.lastModified)throw new W7.default("The requested file could not be read, typically due to permission problems that have occurred after a reference to a file was acquired.","NotReadableError");yield*A4.createReadStream(this.#$,{start:this.#X,end:this.#X+this.size-1})}get[Symbol.toStringTag](){return"Blob"}}});var D7={};K2(D7,{toFormData:()=>_G});class B7{constructor($){this.index=0,this.flags=0,this.onHeaderEnd=j4,this.onHeaderField=j4,this.onHeadersEnd=j4,this.onHeaderValue=j4,this.onPartBegin=j4,this.onPartData=j4,this.onPartEnd=j4,this.boundaryChars={},$=`\r
13
- --`+$;let X=new Uint8Array($.length);for(let Q=0;Q<$.length;Q++)X[Q]=$.charCodeAt(Q),this.boundaryChars[X[Q]]=!0;this.boundary=X,this.lookbehind=new Uint8Array(this.boundary.length+8),this.state=J$.START_BOUNDARY}write($){let X=0,Q=$.length,J=this.index,{lookbehind:G,boundary:H,boundaryChars:M,index:z,state:D,flags:O}=this,_=this.boundary.length,m=_-1,x=$.length,h,k,X$=(a)=>{this[a+"Mark"]=X},s=(a)=>{delete this[a+"Mark"]},Z=(a,$$,n,B$)=>{if($$===void 0||$$!==n)this[a](B$&&B$.subarray($$,n))},G$=(a,$$)=>{let n=a+"Mark";if(!(n in this))return;if($$)Z(a,this[n],X,$),delete this[n];else Z(a,this[n],$.length,$),this[n]=0};for(X=0;X<Q;X++)switch(h=$[X],D){case J$.START_BOUNDARY:if(z===H.length-2){if(h===d6)O|=o0.LAST_BOUNDARY;else if(h!==j1)return;z++;break}else if(z-1===H.length-2){if(O&o0.LAST_BOUNDARY&&h===d6)D=J$.END,O=0;else if(!(O&o0.LAST_BOUNDARY)&&h===A1)z=0,Z("onPartBegin"),D=J$.HEADER_FIELD_START;else return;break}if(h!==H[z+2])z=-2;if(h===H[z+2])z++;break;case J$.HEADER_FIELD_START:D=J$.HEADER_FIELD,X$("onHeaderField"),z=0;case J$.HEADER_FIELD:if(h===j1){s("onHeaderField"),D=J$.HEADERS_ALMOST_DONE;break}if(z++,h===d6)break;if(h===BG){if(z===1)return;G$("onHeaderField",!0),D=J$.HEADER_VALUE_START;break}if(k=OG(h),k<DG||k>VG)return;break;case J$.HEADER_VALUE_START:if(h===zG)break;X$("onHeaderValue"),D=J$.HEADER_VALUE;case J$.HEADER_VALUE:if(h===j1)G$("onHeaderValue",!0),Z("onHeaderEnd"),D=J$.HEADER_VALUE_ALMOST_DONE;break;case J$.HEADER_VALUE_ALMOST_DONE:if(h!==A1)return;D=J$.HEADER_FIELD_START;break;case J$.HEADERS_ALMOST_DONE:if(h!==A1)return;Z("onHeadersEnd"),D=J$.PART_DATA_START;break;case J$.PART_DATA_START:D=J$.PART_DATA,X$("onPartData");case J$.PART_DATA:if(J=z,z===0){X+=m;while(X<x&&!($[X]in M))X+=_;X-=m,h=$[X]}if(z<H.length)if(H[z]===h){if(z===0)G$("onPartData",!0);z++}else z=0;else if(z===H.length)if(z++,h===j1)O|=o0.PART_BOUNDARY;else if(h===d6)O|=o0.LAST_BOUNDARY;else z=0;else if(z-1===H.length)if(O&o0.PART_BOUNDARY){if(z=0,h===A1){O&=~o0.PART_BOUNDARY,Z("onPartEnd"),Z("onPartBegin"),D=J$.HEADER_FIELD_START;break}}else if(O&o0.LAST_BOUNDARY)if(h===d6)Z("onPartEnd"),D=J$.END,O=0;else z=0;else z=0;if(z>0)G[z-1]=h;else if(J>0){let a=new Uint8Array(G.buffer,G.byteOffset,G.byteLength);Z("onPartData",0,J,a),J=0,X$("onPartData"),X--}break;case J$.END:break;default:throw new Error(`Unexpected state entered: ${D}`)}G$("onHeaderField"),G$("onHeaderValue"),G$("onPartData"),this.index=z,this.state=D,this.flags=O}end(){if(this.state===J$.HEADER_FIELD_START&&this.index===0||this.state===J$.PART_DATA&&this.index===this.boundary.length)this.onPartEnd();else if(this.state!==J$.END)throw new Error("MultipartParser.end(): stream ended unexpectedly")}}function qG($){let X=$.match(/\bfilename=("(.*?)"|([^()<>@,;:\\"/[\]?={}\s\t]+))($|;\s)/i);if(!X)return;let Q=X[2]||X[3]||"",J=Q.slice(Q.lastIndexOf("\\")+1);return J=J.replace(/%22/g,'"'),J=J.replace(/&#(\d{4});/g,(G,H)=>{return String.fromCharCode(H)}),J}async function _G($,X){if(!/multipart/i.test(X))throw new TypeError("Failed to fetch");let Q=X.match(/boundary=(?:"([^"]+)"|([^;]+))/i);if(!Q)throw new TypeError("no or bad content-type header, no multipart boundary");let J=new B7(Q[1]||Q[2]),G,H,M,z,D,O,_=[],m=new i0,x=(Z)=>{M+=s.decode(Z,{stream:!0})},h=(Z)=>{_.push(Z)},k=()=>{let Z=new n0(_,O,{type:D});m.append(z,Z)},X$=()=>{m.append(z,M)},s=new TextDecoder("utf-8");s.decode(),J.onPartBegin=function(){J.onPartData=x,J.onPartEnd=X$,G="",H="",M="",z="",D="",O=null,_.length=0},J.onHeaderField=function(Z){G+=s.decode(Z,{stream:!0})},J.onHeaderValue=function(Z){H+=s.decode(Z,{stream:!0})},J.onHeaderEnd=function(){if(H+=s.decode(),G=G.toLowerCase(),G==="content-disposition"){let Z=H.match(/\bname=("([^"]*)"|([^()<>@,;:\\"/[\]?={}\s\t]+))/i);if(Z)z=Z[2]||Z[3]||"";if(O=qG(H),O)J.onPartData=h,J.onPartEnd=k}else if(G==="content-type")D=H;H="",G=""};for await(let Z of $)J.write(Z);return J.end(),m}var B0=0,J$,z7=1,o0,A1=10,j1=13,zG=32,d6=45,BG=58,DG=97,VG=122,OG=($)=>$|32,j4=()=>{};var V7=z$(()=>{p2();D1();J$={START_BOUNDARY:B0++,HEADER_FIELD_START:B0++,HEADER_FIELD:B0++,HEADER_VALUE_START:B0++,HEADER_VALUE:B0++,HEADER_VALUE_ALMOST_DONE:B0++,HEADERS_ALMOST_DONE:B0++,PART_DATA_START:B0++,PART_DATA:B0++,END:B0++},o0={PART_BOUNDARY:z7,LAST_BOUNDARY:z7*=2}});class C0{constructor($,{size:X=0}={}){let Q=null;if($===null)$=null;else if(c2($))$=b$.Buffer.from($.toString());else if(i6($));else if(b$.Buffer.isBuffer($));else if(k0.types.isAnyArrayBuffer($))$=b$.Buffer.from($);else if(ArrayBuffer.isView($))$=b$.Buffer.from($.buffer,$.byteOffset,$.byteLength);else if($ instanceof Z$.default);else if($ instanceof i0)$=aQ($),Q=$.type.split("=")[1];else $=b$.Buffer.from(String($));let J=$;if(b$.Buffer.isBuffer($))J=Z$.default.Readable.from($);else if(i6($))J=Z$.default.Readable.from($.stream());if(this[F$]={body:$,stream:J,boundary:Q,disturbed:!1,error:null},this.size=X,$ instanceof Z$.default)$.on("error",(G)=>{let H=G instanceof d0?G:new S$(`Invalid response body while trying to fetch ${this.url}: ${G.message}`,"system",G);this[F$].error=H})}get body(){return this[F$].stream}get bodyUsed(){return this[F$].disturbed}async arrayBuffer(){let{buffer:$,byteOffset:X,byteLength:Q}=await n2(this);return $.slice(X,X+Q)}async formData(){let $=this.headers.get("content-type");if($.startsWith("application/x-www-form-urlencoded")){let Q=new i0,J=new URLSearchParams(await this.text());for(let[G,H]of J)Q.append(G,H);return Q}let{toFormData:X}=await Promise.resolve().then(() => (V7(),D7));return X(this.body,$)}async blob(){let $=this.headers&&this.headers.get("content-type")||this[F$].body&&this[F$].body.type||"",X=await this.arrayBuffer();return new r$([X],{type:$})}async json(){let $=await this.text();return JSON.parse($)}async text(){let $=await n2(this);return new TextDecoder().decode($)}buffer(){return n2(this)}}async function n2($){if($[F$].disturbed)throw new TypeError(`body used already for: ${$.url}`);if($[F$].disturbed=!0,$[F$].error)throw $[F$].error;let{body:X}=$;if(X===null)return b$.Buffer.alloc(0);if(!(X instanceof Z$.default))return b$.Buffer.alloc(0);let Q=[],J=0;try{for await(let G of X){if($.size>0&&J+G.length>$.size){let H=new S$(`content size at ${$.url} over limit: ${$.size}`,"max-size");throw X.destroy(H),H}J+=G.length,Q.push(G)}}catch(G){throw G instanceof d0?G:new S$(`Invalid response body while trying to fetch ${$.url}: ${G.message}`,"system",G)}if(X.readableEnded===!0||X._readableState.ended===!0)try{if(Q.every((G)=>typeof G==="string"))return b$.Buffer.from(Q.join(""));return b$.Buffer.concat(Q,J)}catch(G){throw new S$(`Could not create Buffer from response body for ${$.url}: ${G.message}`,"system",G)}else throw new S$(`Premature close of server response while trying to fetch ${$.url}`)}var Z$,k0,b$,AG,F$,t4=($,X)=>{let Q,J,{body:G}=$[F$];if($.bodyUsed)throw new Error("cannot clone body after it is used");if(G instanceof Z$.default&&typeof G.getBoundary!=="function")Q=new Z$.PassThrough({highWaterMark:X}),J=new Z$.PassThrough({highWaterMark:X}),G.pipe(Q),G.pipe(J),$[F$].stream=Q,G=J;return G},jG,K1=($,X)=>{if($===null)return null;if(typeof $==="string")return"text/plain;charset=UTF-8";if(c2($))return"application/x-www-form-urlencoded;charset=UTF-8";if(i6($))return $.type||null;if(b$.Buffer.isBuffer($)||k0.types.isAnyArrayBuffer($)||ArrayBuffer.isView($))return null;if($ instanceof i0)return`multipart/form-data; boundary=${X[F$].boundary}`;if($&&typeof $.getBoundary==="function")return`multipart/form-data;boundary=${jG($)}`;if($ instanceof Z$.default)return null;return"text/plain;charset=UTF-8"},O7=($)=>{let{body:X}=$[F$];if(X===null)return 0;if(i6(X))return X.size;if(b$.Buffer.isBuffer(X))return X.length;if(X&&typeof X.getLengthSync==="function")return X.hasKnownLength&&X.hasKnownLength()?X.getLengthSync():null;return null},q7=async($,{body:X})=>{if(X===null)$.end();else await AG(X,$)};var U1=z$(()=>{Z$=x$(require("node:stream")),k0=require("node:util"),b$=require("node:buffer");p6();D1();l2();V1();q1();AG=k0.promisify(Z$.default.pipeline),F$=Symbol("Body internals");C0.prototype.buffer=k0.deprecate(C0.prototype.buffer,"Please use 'response.arrayBuffer()' instead of 'response.buffer()'","node-fetch#buffer");Object.defineProperties(C0.prototype,{body:{enumerable:!0},bodyUsed:{enumerable:!0},arrayBuffer:{enumerable:!0},blob:{enumerable:!0},json:{enumerable:!0},text:{enumerable:!0},data:{get:k0.deprecate(()=>{},"data doesn't exist, use json(), text(), arrayBuffer(), or body instead","https://github.com/node-fetch/node-fetch/issues/1000 (response)")}});jG=k0.deprecate(($)=>$.getBoundary(),"form-data doesn't follow the spec and requires special treatment. Use alternative package","https://github.com/node-fetch/node-fetch/issues/1167")});function _7($=[]){return new E$($.reduce((X,Q,J,G)=>{if(J%2===0)X.push(G.slice(J,J+2));return X},[]).filter(([X,Q])=>{try{return N1(X),d2(X,String(Q)),!0}catch{return!1}}))}var i2,o6,N1,d2,E$;var L1=z$(()=>{i2=require("node:util"),o6=x$(require("node:http")),N1=typeof o6.default.validateHeaderName==="function"?o6.default.validateHeaderName:($)=>{if(!/^[\^`\-\w!#$%&'*+.|~]+$/.test($)){let X=new TypeError(`Header name must be a valid HTTP token [${$}]`);throw Object.defineProperty(X,"code",{value:"ERR_INVALID_HTTP_TOKEN"}),X}},d2=typeof o6.default.validateHeaderValue==="function"?o6.default.validateHeaderValue:($,X)=>{if(/[^\t\u0020-\u007E\u0080-\u00FF]/.test(X)){let Q=new TypeError(`Invalid character in header content ["${$}"]`);throw Object.defineProperty(Q,"code",{value:"ERR_INVALID_CHAR"}),Q}};E$=class E$ extends URLSearchParams{constructor($){let X=[];if($ instanceof E$){let Q=$.raw();for(let[J,G]of Object.entries(Q))X.push(...G.map((H)=>[J,H]))}else if($==null);else if(typeof $==="object"&&!i2.types.isBoxedPrimitive($)){let Q=$[Symbol.iterator];if(Q==null)X.push(...Object.entries($));else{if(typeof Q!=="function")throw new TypeError("Header pairs must be iterable");X=[...$].map((J)=>{if(typeof J!=="object"||i2.types.isBoxedPrimitive(J))throw new TypeError("Each header pair must be an iterable object");return[...J]}).map((J)=>{if(J.length!==2)throw new TypeError("Each header pair must be a name/value tuple");return[...J]})}}else throw new TypeError("Failed to construct 'Headers': The provided value is not of type '(sequence<sequence<ByteString>> or record<ByteString, ByteString>)");X=X.length>0?X.map(([Q,J])=>{return N1(Q),d2(Q,String(J)),[String(Q).toLowerCase(),String(J)]}):void 0;super(X);return new Proxy(this,{get(Q,J,G){switch(J){case"append":case"set":return(H,M)=>{return N1(H),d2(H,String(M)),URLSearchParams.prototype[J].call(Q,String(H).toLowerCase(),String(M))};case"delete":case"has":case"getAll":return(H)=>{return N1(H),URLSearchParams.prototype[J].call(Q,String(H).toLowerCase())};case"keys":return()=>{return Q.sort(),new Set(URLSearchParams.prototype.keys.call(Q)).keys()};default:return Reflect.get(Q,J,G)}}})}get[Symbol.toStringTag](){return this.constructor.name}toString(){return Object.prototype.toString.call(this)}get($){let X=this.getAll($);if(X.length===0)return null;let Q=X.join(", ");if(/^content-encoding$/i.test($))Q=Q.toLowerCase();return Q}forEach($,X=void 0){for(let Q of this.keys())Reflect.apply($,X,[this.get(Q),Q,this])}*values(){for(let $ of this.keys())yield this.get($)}*entries(){for(let $ of this.keys())yield[$,this.get($)]}[Symbol.iterator](){return this.entries()}raw(){return[...this.keys()].reduce(($,X)=>{return $[X]=this.getAll(X),$},{})}[Symbol.for("nodejs.util.inspect.custom")](){return[...this.keys()].reduce(($,X)=>{let Q=this.getAll(X);if(X==="host")$[X]=Q[0];else $[X]=Q.length>1?Q:Q[0];return $},{})}};Object.defineProperties(E$.prototype,["get","entries","forEach","values"].reduce(($,X)=>{return $[X]={enumerable:!0},$},{}))});var KG,r6=($)=>{return KG.has($)};var o2=z$(()=>{KG=new Set([301,302,303,307,308])});var a$,A$;var A7=z$(()=>{L1();U1();o2();a$=Symbol("Response internals");A$=class A$ extends C0{constructor($=null,X={}){super($,X);let Q=X.status!=null?X.status:200,J=new E$(X.headers);if($!==null&&!J.has("Content-Type")){let G=K1($,this);if(G)J.append("Content-Type",G)}this[a$]={type:"default",url:X.url,status:Q,statusText:X.statusText||"",headers:J,counter:X.counter,highWaterMark:X.highWaterMark}}get type(){return this[a$].type}get url(){return this[a$].url||""}get status(){return this[a$].status}get ok(){return this[a$].status>=200&&this[a$].status<300}get redirected(){return this[a$].counter>0}get statusText(){return this[a$].statusText}get headers(){return this[a$].headers}get highWaterMark(){return this[a$].highWaterMark}clone(){return new A$(t4(this,this.highWaterMark),{type:this.type,url:this.url,status:this.status,statusText:this.statusText,headers:this.headers,ok:this.ok,redirected:this.redirected,size:this.size,highWaterMark:this.highWaterMark})}static redirect($,X=302){if(!r6(X))throw new RangeError('Failed to execute "redirect" on "response": Invalid status code');return new A$(null,{headers:{location:new URL($).toString()},status:X})}static error(){let $=new A$(null,{status:0,statusText:""});return $[a$].type="error",$}static json($=void 0,X={}){let Q=JSON.stringify($);if(Q===void 0)throw new TypeError("data is not JSON serializable");let J=new E$(X&&X.headers);if(!J.has("content-type"))J.set("content-type","application/json");return new A$(Q,{...X,headers:J})}get[Symbol.toStringTag](){return"Response"}};Object.defineProperties(A$.prototype,{type:{enumerable:!0},url:{enumerable:!0},status:{enumerable:!0},ok:{enumerable:!0},redirected:{enumerable:!0},statusText:{enumerable:!0},headers:{enumerable:!0},clone:{enumerable:!0}})});var j7=($)=>{if($.search)return $.search;let X=$.href.length-1,Q=$.hash||($.href[X]==="#"?"#":"");return $.href[X-Q.length]==="?"?"?":""};function K7($,X=!1){if($==null)return"no-referrer";if($=new URL($),/^(about|blob|data):$/.test($.protocol))return"no-referrer";if($.username="",$.password="",$.hash="",X)$.pathname="",$.search="";return $}function S7($){if(!N7.has($))throw new TypeError(`Invalid referrerPolicy: ${$}`);return $}function NG($){if(/^(http|ws)s:$/.test($.protocol))return!0;let X=$.host.replace(/(^\[)|(]$)/g,""),Q=U7.isIP(X);if(Q===4&&/^127\./.test(X))return!0;if(Q===6&&/^(((0+:){7})|(::(0+:){0,6}))0*1$/.test(X))return!0;if($.host==="localhost"||$.host.endsWith(".localhost"))return!1;if($.protocol==="file:")return!0;return!1}function s4($){if(/^about:(blank|srcdoc)$/.test($))return!0;if($.protocol==="data:")return!0;if(/^(blob|filesystem):$/.test($.protocol))return!0;return NG($)}function F7($,{referrerURLCallback:X,referrerOriginCallback:Q}={}){if($.referrer==="no-referrer"||$.referrerPolicy==="")return null;let J=$.referrerPolicy;if($.referrer==="about:client")return"no-referrer";let G=$.referrer,H=K7(G),M=K7(G,!0);if(H.toString().length>4096)H=M;if(X)H=X(H);if(Q)M=Q(M);let z=new URL($.url);switch(J){case"no-referrer":return"no-referrer";case"origin":return M;case"unsafe-url":return H;case"strict-origin":if(s4(H)&&!s4(z))return"no-referrer";return M.toString();case"strict-origin-when-cross-origin":if(H.origin===z.origin)return H;if(s4(H)&&!s4(z))return"no-referrer";return M;case"same-origin":if(H.origin===z.origin)return H;return"no-referrer";case"origin-when-cross-origin":if(H.origin===z.origin)return H;return M;case"no-referrer-when-downgrade":if(s4(H)&&!s4(z))return"no-referrer";return H;default:throw new TypeError(`Invalid referrerPolicy: ${J}`)}}function E7($){let X=($.get("referrer-policy")||"").split(/[,\s]+/),Q="";for(let J of X)if(J&&N7.has(J))Q=J;return Q}var U7,N7,L7="strict-origin-when-cross-origin";var r2=z$(()=>{U7=require("node:net");N7=new Set(["","no-referrer","no-referrer-when-downgrade","same-origin","origin","strict-origin","origin-when-cross-origin","strict-origin-when-cross-origin","unsafe-url"])});var R7,v7,D$,a6=($)=>{return typeof $==="object"&&typeof $[D$]==="object"},LG,r0,C7=($)=>{let{parsedURL:X}=$[D$],Q=new E$($[D$].headers);if(!Q.has("Accept"))Q.set("Accept","*/*");let J=null;if($.body===null&&/^(post|put)$/i.test($.method))J="0";if($.body!==null){let z=O7($);if(typeof z==="number"&&!Number.isNaN(z))J=String(z)}if(J)Q.set("Content-Length",J);if($.referrerPolicy==="")$.referrerPolicy=L7;if($.referrer&&$.referrer!=="no-referrer")$[D$].referrer=F7($);else $[D$].referrer="no-referrer";if($[D$].referrer instanceof URL)Q.set("Referer",$.referrer);if(!Q.has("User-Agent"))Q.set("User-Agent","node-fetch");if($.compress&&!Q.has("Accept-Encoding"))Q.set("Accept-Encoding","gzip, deflate, br");let{agent:G}=$;if(typeof G==="function")G=G(X);let H=j7(X),M={path:X.pathname+H,method:$.method,headers:Q[Symbol.for("nodejs.util.inspect.custom")](),insecureHTTPParser:$.insecureHTTPParser,agent:G};return{parsedURL:X,options:M}};var k7=z$(()=>{R7=require("node:url"),v7=require("node:util");L1();U1();q1();r2();D$=Symbol("Request internals"),LG=v7.deprecate(()=>{},".data is not a valid RequestInit property, use .body instead","https://github.com/node-fetch/node-fetch/issues/1000 (request)");r0=class r0 extends C0{constructor($,X={}){let Q;if(a6($))Q=new URL($.url);else Q=new URL($),$={};if(Q.username!==""||Q.password!=="")throw new TypeError(`${Q} is an url with embedded credentials.`);let J=X.method||$.method||"GET";if(/^(delete|get|head|options|post|put)$/i.test(J))J=J.toUpperCase();if(!a6(X)&&"data"in X)LG();if((X.body!=null||a6($)&&$.body!==null)&&(J==="GET"||J==="HEAD"))throw new TypeError("Request with GET/HEAD method cannot have body");let G=X.body?X.body:a6($)&&$.body!==null?t4($):null;super(G,{size:X.size||$.size||0});let H=new E$(X.headers||$.headers||{});if(G!==null&&!H.has("Content-Type")){let D=K1(G,this);if(D)H.set("Content-Type",D)}let M=a6($)?$.signal:null;if("signal"in X)M=X.signal;if(M!=null&&!tQ(M))throw new TypeError("Expected signal to be an instanceof AbortSignal or EventTarget");let z=X.referrer==null?$.referrer:X.referrer;if(z==="")z="no-referrer";else if(z){let D=new URL(z);z=/^about:(\/\/)?client$/.test(D)?"client":D}else z=void 0;this[D$]={method:J,redirect:X.redirect||$.redirect||"follow",headers:H,parsedURL:Q,signal:M,referrer:z},this.follow=X.follow===void 0?$.follow===void 0?20:$.follow:X.follow,this.compress=X.compress===void 0?$.compress===void 0?!0:$.compress:X.compress,this.counter=X.counter||$.counter||0,this.agent=X.agent||$.agent,this.highWaterMark=X.highWaterMark||$.highWaterMark||16384,this.insecureHTTPParser=X.insecureHTTPParser||$.insecureHTTPParser||!1,this.referrerPolicy=X.referrerPolicy||$.referrerPolicy||""}get method(){return this[D$].method}get url(){return R7.format(this[D$].parsedURL)}get headers(){return this[D$].headers}get redirect(){return this[D$].redirect}get signal(){return this[D$].signal}get referrer(){if(this[D$].referrer==="no-referrer")return"";if(this[D$].referrer==="client")return"about:client";if(this[D$].referrer)return this[D$].referrer.toString();return}get referrerPolicy(){return this[D$].referrerPolicy}set referrerPolicy($){this[D$].referrerPolicy=S7($)}clone(){return new r0(this)}get[Symbol.toStringTag](){return"Request"}};Object.defineProperties(r0.prototype,{method:{enumerable:!0},url:{enumerable:!0},headers:{enumerable:!0},redirect:{enumerable:!0},clone:{enumerable:!0},signal:{enumerable:!0},referrer:{enumerable:!0},referrerPolicy:{enumerable:!0}})});var S1;var I7=z$(()=>{V1();S1=class S1 extends d0{constructor($,X="aborted"){super($,X)}}});var f7={};K2(f7,{isRedirect:()=>r6,fileFromSync:()=>H7,fileFrom:()=>Y7,default:()=>a2,blobFromSync:()=>J7,blobFrom:()=>G7,Response:()=>A$,Request:()=>r0,Headers:()=>E$,FormData:()=>i0,File:()=>n0,FetchError:()=>S$,Blob:()=>r$,AbortError:()=>S1});async function a2($,X){return new Promise((Q,J)=>{let G=new r0($,X),{parsedURL:H,options:M}=C7(G);if(!SG.has(H.protocol))throw new TypeError(`node-fetch cannot load ${$}. URL scheme "${H.protocol.replace(/:$/,"")}" is not supported.`);if(H.protocol==="data:"){let k=lQ(G.url),X$=new A$(k,{headers:{"Content-Type":k.typeFull}});Q(X$);return}let z=(H.protocol==="https:"?P7.default:b7.default).request,{signal:D}=G,O=null,_=()=>{let k=new S1("The operation was aborted.");if(J(k),G.body&&G.body instanceof P$.default.Readable)G.body.destroy(k);if(!O||!O.body)return;O.body.emit("error",k)};if(D&&D.aborted){_();return}let m=()=>{_(),h()},x=z(H.toString(),M);if(D)D.addEventListener("abort",m);let h=()=>{if(x.abort(),D)D.removeEventListener("abort",m)};if(x.on("error",(k)=>{J(new S$(`request to ${G.url} failed, reason: ${k.message}`,"system",k)),h()}),FG(x,(k)=>{if(O&&O.body)O.body.destroy(k)}),process.version<"v14")x.on("socket",(k)=>{let X$;k.prependListener("end",()=>{X$=k._eventsCount}),k.prependListener("close",(s)=>{if(O&&X$<k._eventsCount&&!s){let Z=new Error("Premature close");Z.code="ERR_STREAM_PREMATURE_CLOSE",O.body.emit("error",Z)}})});x.on("response",(k)=>{x.setTimeout(0);let X$=_7(k.rawHeaders);if(r6(k.statusCode)){let $$=X$.get("Location"),n=null;try{n=$$===null?null:new URL($$,G.url)}catch{if(G.redirect!=="manual"){J(new S$(`uri requested responds with an invalid redirect URL: ${$$}`,"invalid-redirect")),h();return}}switch(G.redirect){case"error":J(new S$(`uri requested responds with a redirect, redirect mode is set to error: ${G.url}`,"no-redirect")),h();return;case"manual":break;case"follow":{if(n===null)break;if(G.counter>=G.follow){J(new S$(`maximum redirect reached at: ${G.url}`,"max-redirect")),h();return}let B$={headers:new E$(G.headers),follow:G.follow,counter:G.counter+1,agent:G.agent,compress:G.compress,method:G.method,body:t4(G),signal:G.signal,size:G.size,referrer:G.referrer,referrerPolicy:G.referrerPolicy};if(!sQ(G.url,n)||!eQ(G.url,n))for(let _6 of["authorization","www-authenticate","cookie","cookie2"])B$.headers.delete(_6);if(k.statusCode!==303&&G.body&&X.body instanceof P$.default.Readable){J(new S$("Cannot follow redirect with body being a readable stream","unsupported-redirect")),h();return}if(k.statusCode===303||(k.statusCode===301||k.statusCode===302)&&G.method==="POST")B$.method="GET",B$.body=void 0,B$.headers.delete("content-length");let q6=E7(X$);if(q6)B$.referrerPolicy=q6;Q(a2(new r0(n,B$))),h();return}default:return J(new TypeError(`Redirect option '${G.redirect}' is not a valid value of RequestRedirect`))}}if(D)k.once("end",()=>{D.removeEventListener("abort",m)});let s=P$.pipeline(k,new P$.PassThrough,($$)=>{if($$)J($$)});if(process.version<"v12.10")k.on("aborted",m);let Z={url:G.url,status:k.statusCode,statusText:k.statusMessage,headers:X$,size:G.size,counter:G.counter,highWaterMark:G.highWaterMark},G$=X$.get("Content-Encoding");if(!G.compress||G.method==="HEAD"||G$===null||k.statusCode===204||k.statusCode===304){O=new A$(s,Z),Q(O);return}let a={flush:K4.default.Z_SYNC_FLUSH,finishFlush:K4.default.Z_SYNC_FLUSH};if(G$==="gzip"||G$==="x-gzip"){s=P$.pipeline(s,K4.default.createGunzip(a),($$)=>{if($$)J($$)}),O=new A$(s,Z),Q(O);return}if(G$==="deflate"||G$==="x-deflate"){let $$=P$.pipeline(k,new P$.PassThrough,(n)=>{if(n)J(n)});$$.once("data",(n)=>{if((n[0]&15)===8)s=P$.pipeline(s,K4.default.createInflate(),(B$)=>{if(B$)J(B$)});else s=P$.pipeline(s,K4.default.createInflateRaw(),(B$)=>{if(B$)J(B$)});O=new A$(s,Z),Q(O)}),$$.once("end",()=>{if(!O)O=new A$(s,Z),Q(O)});return}if(G$==="br"){s=P$.pipeline(s,K4.default.createBrotliDecompress(),($$)=>{if($$)J($$)}),O=new A$(s,Z),Q(O);return}O=new A$(s,Z),Q(O)}),q7(x,G).catch(J)})}function FG($,X){let Q=t6.Buffer.from(`0\r
11
+ `)),J.push(`--${Q}--`),new X(J,{type:"multipart/form-data; boundary="+Q})}var i6,VG,OG,eW,qG,$J=($,X,Q)=>($+="",/^(Blob|File)$/.test(X&&X[i6])?[(Q=Q!==void 0?Q+"":X[i6]=="File"?X.name:"blob",$),X.name!==Q||X[i6]=="blob"?new d0([X],Q,X):X]:[$,X+""]),m8=($,X)=>(X?$:$.replace(/\r?\n|\r/g,`\r
12
+ `)).replace(/\n/g,"%0A").replace(/\r/g,"%0D").replace(/"/g,"%22"),K4=($,X,Q)=>{if(X.length<Q)throw new TypeError(`Failed to execute '${$}' on 'FormData': ${Q} arguments required, but only ${X.length} present.`)},o0;var O1=B$(()=>{p6();y8();/*! formdata-polyfill. MIT License. Jimmy Wärting <https://jimmy.warting.se/opensource> */({toStringTag:i6,iterator:VG,hasInstance:OG}=Symbol),eW=Math.random,qG="append,set,get,getAll,delete,keys,values,entries,forEach,constructor".split(","),o0=class ${#$=[];constructor(...X){if(X.length)throw new TypeError("Failed to construct 'FormData': parameter 1 is not of type 'HTMLFormElement'.")}get[i6](){return"FormData"}[VG](){return this.entries()}static[OG](X){return X&&typeof X==="object"&&X[i6]==="FormData"&&!qG.some((Q)=>typeof X[Q]!="function")}append(...X){K4("append",arguments,2),this.#$.push($J(...X))}delete(X){K4("delete",arguments,1),X+="",this.#$=this.#$.filter(([Q])=>Q!==X)}get(X){K4("get",arguments,1),X+="";for(var Q=this.#$,J=Q.length,G=0;G<J;G++)if(Q[G][0]===X)return Q[G][1];return null}getAll(X,Q){return K4("getAll",arguments,1),Q=[],X+="",this.#$.forEach((J)=>J[0]===X&&Q.push(J[1])),Q}has(X){return K4("has",arguments,1),X+="",this.#$.some((Q)=>Q[0]===X)}forEach(X,Q){K4("forEach",arguments,1);for(var[J,G]of this)X.call(Q,G,J,this)}set(...X){K4("set",arguments,2);var Q=[],J=!0;X=$J(...X),this.#$.forEach((G)=>{G[0]===X[0]?J&&(J=!Q.push(X)):Q.push(G)}),J&&Q.push(X),this.#$=Q}*entries(){yield*this.#$}*keys(){for(var[X]of this)yield X}*values(){for(var[,X]of this)yield X}}});var a0;var q1=B$(()=>{a0=class a0 extends Error{constructor($,X){super($);Error.captureStackTrace(this,this.constructor),this.type=X}get name(){return this.constructor.name}get[Symbol.toStringTag](){return this.constructor.name}}});var E$;var l8=B$(()=>{q1();E$=class E$ extends a0{constructor($,X,Q){super($,X);if(Q)this.code=this.errno=Q.code,this.erroredSysCall=Q.syscall}}});var A1,c8=($)=>{return typeof $==="object"&&typeof $.append==="function"&&typeof $.delete==="function"&&typeof $.get==="function"&&typeof $.getAll==="function"&&typeof $.has==="function"&&typeof $.set==="function"&&typeof $.sort==="function"&&$[A1]==="URLSearchParams"},d6=($)=>{return $&&typeof $==="object"&&typeof $.arrayBuffer==="function"&&typeof $.type==="string"&&typeof $.stream==="function"&&typeof $.constructor==="function"&&/^(Blob|File)$/.test($[A1])},QJ=($)=>{return typeof $==="object"&&($[A1]==="AbortSignal"||$[A1]==="EventTarget")},WJ=($,X)=>{let Q=new URL(X).hostname,J=new URL($).hostname;return Q===J||Q.endsWith(`.${J}`)},JJ=($,X)=>{let Q=new URL(X).protocol,J=new URL($).protocol;return Q===J};var j1=B$(()=>{A1=Symbol.toStringTag});var YJ=xX((Fz,GJ)=>{/*! node-domexception. MIT License. Jimmy Wärting <https://jimmy.warting.se/opensource> */if(!globalThis.DOMException)try{let{MessageChannel:$}=require("worker_threads"),X=new $().port1,Q=new ArrayBuffer;X.postMessage(Q,[Q,Q])}catch($){$.constructor.name==="DOMException"&&(globalThis.DOMException=$.constructor)}GJ.exports=globalThis.DOMException});var U4,HJ,MJ,u8,wJ=($,X)=>VJ(U4.statSync($),$,X),zJ=($,X)=>u8($).then((Q)=>VJ(Q,$,X)),BJ=($,X)=>u8($).then((Q)=>OJ(Q,$,X)),DJ=($,X)=>OJ(U4.statSync($),$,X),VJ=($,X,Q="")=>new a$([new K1({path:X,size:$.size,lastModified:$.mtimeMs,start:0})],{type:Q}),OJ=($,X,Q="")=>new d0([new K1({path:X,size:$.size,lastModified:$.mtimeMs,start:0})],HJ.basename(X),{type:Q,lastModified:$.mtimeMs}),K1;var n8=B$(()=>{U4=require("node:fs"),HJ=require("node:path"),MJ=C$(YJ());y8();p6();({stat:u8}=U4.promises);K1=class K1{#$;#X;constructor($){this.#$=$.path,this.#X=$.start,this.size=$.size,this.lastModified=$.lastModified}slice($,X){return new K1({path:this.#$,lastModified:this.lastModified,size:X-$,start:this.#X+$})}async*stream(){let{mtimeMs:$}=await u8(this.#$);if($>this.lastModified)throw new MJ.default("The requested file could not be read, typically due to permission problems that have occurred after a reference to a file was acquired.","NotReadableError");yield*U4.createReadStream(this.#$,{start:this.#X,end:this.#X+this.size-1})}get[Symbol.toStringTag](){return"Blob"}}});var jJ={};U8(jJ,{toFormData:()=>FG});class AJ{constructor($){this.index=0,this.flags=0,this.onHeaderEnd=N4,this.onHeaderField=N4,this.onHeadersEnd=N4,this.onHeaderValue=N4,this.onPartBegin=N4,this.onPartData=N4,this.onPartEnd=N4,this.boundaryChars={},$=`\r
13
+ --`+$;let X=new Uint8Array($.length);for(let Q=0;Q<$.length;Q++)X[Q]=$.charCodeAt(Q),this.boundaryChars[X[Q]]=!0;this.boundary=X,this.lookbehind=new Uint8Array(this.boundary.length+8),this.state=G$.START_BOUNDARY}write($){let X=0,Q=$.length,J=this.index,{lookbehind:G,boundary:H,boundaryChars:M,index:z,state:B,flags:O}=this,q=this.boundary.length,x=q-1,T=$.length,_,F,f=(o)=>{this[o+"Mark"]=X},P=(o)=>{delete this[o+"Mark"]},I=(o,r,u,z$)=>{if(r===void 0||r!==u)this[o](z$&&z$.subarray(r,u))},Q$=(o,r)=>{let u=o+"Mark";if(!(u in this))return;if(r)I(o,this[u],X,$),delete this[u];else I(o,this[u],$.length,$),this[u]=0};for(X=0;X<Q;X++)switch(_=$[X],B){case G$.START_BOUNDARY:if(z===H.length-2){if(_===o6)O|=r0.LAST_BOUNDARY;else if(_!==N1)return;z++;break}else if(z-1===H.length-2){if(O&r0.LAST_BOUNDARY&&_===o6)B=G$.END,O=0;else if(!(O&r0.LAST_BOUNDARY)&&_===U1)z=0,I("onPartBegin"),B=G$.HEADER_FIELD_START;else return;break}if(_!==H[z+2])z=-2;if(_===H[z+2])z++;break;case G$.HEADER_FIELD_START:B=G$.HEADER_FIELD,f("onHeaderField"),z=0;case G$.HEADER_FIELD:if(_===N1){P("onHeaderField"),B=G$.HEADERS_ALMOST_DONE;break}if(z++,_===o6)break;if(_===jG){if(z===1)return;Q$("onHeaderField",!0),B=G$.HEADER_VALUE_START;break}if(F=NG(_),F<KG||F>UG)return;break;case G$.HEADER_VALUE_START:if(_===AG)break;f("onHeaderValue"),B=G$.HEADER_VALUE;case G$.HEADER_VALUE:if(_===N1)Q$("onHeaderValue",!0),I("onHeaderEnd"),B=G$.HEADER_VALUE_ALMOST_DONE;break;case G$.HEADER_VALUE_ALMOST_DONE:if(_!==U1)return;B=G$.HEADER_FIELD_START;break;case G$.HEADERS_ALMOST_DONE:if(_!==U1)return;I("onHeadersEnd"),B=G$.PART_DATA_START;break;case G$.PART_DATA_START:B=G$.PART_DATA,f("onPartData");case G$.PART_DATA:if(J=z,z===0){X+=x;while(X<T&&!($[X]in M))X+=q;X-=x,_=$[X]}if(z<H.length)if(H[z]===_){if(z===0)Q$("onPartData",!0);z++}else z=0;else if(z===H.length)if(z++,_===N1)O|=r0.PART_BOUNDARY;else if(_===o6)O|=r0.LAST_BOUNDARY;else z=0;else if(z-1===H.length)if(O&r0.PART_BOUNDARY){if(z=0,_===U1){O&=~r0.PART_BOUNDARY,I("onPartEnd"),I("onPartBegin"),B=G$.HEADER_FIELD_START;break}}else if(O&r0.LAST_BOUNDARY)if(_===o6)I("onPartEnd"),B=G$.END,O=0;else z=0;else z=0;if(z>0)G[z-1]=_;else if(J>0){let o=new Uint8Array(G.buffer,G.byteOffset,G.byteLength);I("onPartData",0,J,o),J=0,f("onPartData"),X--}break;case G$.END:break;default:throw new Error(`Unexpected state entered: ${B}`)}Q$("onHeaderField"),Q$("onHeaderValue"),Q$("onPartData"),this.index=z,this.state=B,this.flags=O}end(){if(this.state===G$.HEADER_FIELD_START&&this.index===0||this.state===G$.PART_DATA&&this.index===this.boundary.length)this.onPartEnd();else if(this.state!==G$.END)throw new Error("MultipartParser.end(): stream ended unexpectedly")}}function SG($){let X=$.match(/\bfilename=("(.*?)"|([^()<>@,;:\\"/[\]?={}\s\t]+))($|;\s)/i);if(!X)return;let Q=X[2]||X[3]||"",J=Q.slice(Q.lastIndexOf("\\")+1);return J=J.replace(/%22/g,'"'),J=J.replace(/&#(\d{4});/g,(G,H)=>{return String.fromCharCode(H)}),J}async function FG($,X){if(!/multipart/i.test(X))throw new TypeError("Failed to fetch");let Q=X.match(/boundary=(?:"([^"]+)"|([^;]+))/i);if(!Q)throw new TypeError("no or bad content-type header, no multipart boundary");let J=new AJ(Q[1]||Q[2]),G,H,M,z,B,O,q=[],x=new o0,T=(I)=>{M+=P.decode(I,{stream:!0})},_=(I)=>{q.push(I)},F=()=>{let I=new d0(q,O,{type:B});x.append(z,I)},f=()=>{x.append(z,M)},P=new TextDecoder("utf-8");P.decode(),J.onPartBegin=function(){J.onPartData=T,J.onPartEnd=f,G="",H="",M="",z="",B="",O=null,q.length=0},J.onHeaderField=function(I){G+=P.decode(I,{stream:!0})},J.onHeaderValue=function(I){H+=P.decode(I,{stream:!0})},J.onHeaderEnd=function(){if(H+=P.decode(),G=G.toLowerCase(),G==="content-disposition"){let I=H.match(/\bname=("([^"]*)"|([^()<>@,;:\\"/[\]?={}\s\t]+))/i);if(I)z=I[2]||I[3]||"";if(O=SG(H),O)J.onPartData=_,J.onPartEnd=F}else if(G==="content-type")B=H;H="",G=""};for await(let I of $)J.write(I);return J.end(),x}var D0=0,G$,qJ=1,r0,U1=10,N1=13,AG=32,o6=45,jG=58,KG=97,UG=122,NG=($)=>$|32,N4=()=>{};var KJ=B$(()=>{n8();O1();G$={START_BOUNDARY:D0++,HEADER_FIELD_START:D0++,HEADER_FIELD:D0++,HEADER_VALUE_START:D0++,HEADER_VALUE:D0++,HEADER_VALUE_ALMOST_DONE:D0++,HEADERS_ALMOST_DONE:D0++,PART_DATA_START:D0++,PART_DATA:D0++,END:D0++},r0={PART_BOUNDARY:qJ,LAST_BOUNDARY:qJ*=2}});class I0{constructor($,{size:X=0}={}){let Q=null;if($===null)$=null;else if(c8($))$=b$.Buffer.from($.toString());else if(d6($));else if(b$.Buffer.isBuffer($));else if(k0.types.isAnyArrayBuffer($))$=b$.Buffer.from($);else if(ArrayBuffer.isView($))$=b$.Buffer.from($.buffer,$.byteOffset,$.byteLength);else if($ instanceof y$.default);else if($ instanceof o0)$=XJ($),Q=$.type.split("=")[1];else $=b$.Buffer.from(String($));let J=$;if(b$.Buffer.isBuffer($))J=y$.default.Readable.from($);else if(d6($))J=y$.default.Readable.from($.stream());if(this[_$]={body:$,stream:J,boundary:Q,disturbed:!1,error:null},this.size=X,$ instanceof y$.default)$.on("error",(G)=>{let H=G instanceof a0?G:new E$(`Invalid response body while trying to fetch ${this.url}: ${G.message}`,"system",G);this[_$].error=H})}get body(){return this[_$].stream}get bodyUsed(){return this[_$].disturbed}async arrayBuffer(){let{buffer:$,byteOffset:X,byteLength:Q}=await p8(this);return $.slice(X,X+Q)}async formData(){let $=this.headers.get("content-type");if($.startsWith("application/x-www-form-urlencoded")){let Q=new o0,J=new URLSearchParams(await this.text());for(let[G,H]of J)Q.append(G,H);return Q}let{toFormData:X}=await Promise.resolve().then(() => (KJ(),jJ));return X(this.body,$)}async blob(){let $=this.headers&&this.headers.get("content-type")||this[_$].body&&this[_$].body.type||"",X=await this.arrayBuffer();return new a$([X],{type:$})}async json(){let $=await this.text();return JSON.parse($)}async text(){let $=await p8(this);return new TextDecoder().decode($)}buffer(){return p8(this)}}async function p8($){if($[_$].disturbed)throw new TypeError(`body used already for: ${$.url}`);if($[_$].disturbed=!0,$[_$].error)throw $[_$].error;let{body:X}=$;if(X===null)return b$.Buffer.alloc(0);if(!(X instanceof y$.default))return b$.Buffer.alloc(0);let Q=[],J=0;try{for await(let G of X){if($.size>0&&J+G.length>$.size){let H=new E$(`content size at ${$.url} over limit: ${$.size}`,"max-size");throw X.destroy(H),H}J+=G.length,Q.push(G)}}catch(G){throw G instanceof a0?G:new E$(`Invalid response body while trying to fetch ${$.url}: ${G.message}`,"system",G)}if(X.readableEnded===!0||X._readableState.ended===!0)try{if(Q.every((G)=>typeof G==="string"))return b$.Buffer.from(Q.join(""));return b$.Buffer.concat(Q,J)}catch(G){throw new E$(`Could not create Buffer from response body for ${$.url}: ${G.message}`,"system",G)}else throw new E$(`Premature close of server response while trying to fetch ${$.url}`)}var y$,k0,b$,EG,_$,e4=($,X)=>{let Q,J,{body:G}=$[_$];if($.bodyUsed)throw new Error("cannot clone body after it is used");if(G instanceof y$.default&&typeof G.getBoundary!=="function")Q=new y$.PassThrough({highWaterMark:X}),J=new y$.PassThrough({highWaterMark:X}),G.pipe(Q),G.pipe(J),$[_$].stream=Q,G=J;return G},_G,S1=($,X)=>{if($===null)return null;if(typeof $==="string")return"text/plain;charset=UTF-8";if(c8($))return"application/x-www-form-urlencoded;charset=UTF-8";if(d6($))return $.type||null;if(b$.Buffer.isBuffer($)||k0.types.isAnyArrayBuffer($)||ArrayBuffer.isView($))return null;if($ instanceof o0)return`multipart/form-data; boundary=${X[_$].boundary}`;if($&&typeof $.getBoundary==="function")return`multipart/form-data;boundary=${_G($)}`;if($ instanceof y$.default)return null;return"text/plain;charset=UTF-8"},UJ=($)=>{let{body:X}=$[_$];if(X===null)return 0;if(d6(X))return X.size;if(b$.Buffer.isBuffer(X))return X.length;if(X&&typeof X.getLengthSync==="function")return X.hasKnownLength&&X.hasKnownLength()?X.getLengthSync():null;return null},NJ=async($,{body:X})=>{if(X===null)$.end();else await EG(X,$)};var F1=B$(()=>{y$=C$(require("node:stream")),k0=require("node:util"),b$=require("node:buffer");p6();O1();l8();q1();j1();EG=k0.promisify(y$.default.pipeline),_$=Symbol("Body internals");I0.prototype.buffer=k0.deprecate(I0.prototype.buffer,"Please use 'response.arrayBuffer()' instead of 'response.buffer()'","node-fetch#buffer");Object.defineProperties(I0.prototype,{body:{enumerable:!0},bodyUsed:{enumerable:!0},arrayBuffer:{enumerable:!0},blob:{enumerable:!0},json:{enumerable:!0},text:{enumerable:!0},data:{get:k0.deprecate(()=>{},"data doesn't exist, use json(), text(), arrayBuffer(), or body instead","https://github.com/node-fetch/node-fetch/issues/1000 (response)")}});_G=k0.deprecate(($)=>$.getBoundary(),"form-data doesn't follow the spec and requires special treatment. Use alternative package","https://github.com/node-fetch/node-fetch/issues/1167")});function SJ($=[]){return new L$($.reduce((X,Q,J,G)=>{if(J%2===0)X.push(G.slice(J,J+2));return X},[]).filter(([X,Q])=>{try{return E1(X),d8(X,String(Q)),!0}catch{return!1}}))}var i8,a6,E1,d8,L$;var _1=B$(()=>{i8=require("node:util"),a6=C$(require("node:http")),E1=typeof a6.default.validateHeaderName==="function"?a6.default.validateHeaderName:($)=>{if(!/^[\^`\-\w!#$%&'*+.|~]+$/.test($)){let X=new TypeError(`Header name must be a valid HTTP token [${$}]`);throw Object.defineProperty(X,"code",{value:"ERR_INVALID_HTTP_TOKEN"}),X}},d8=typeof a6.default.validateHeaderValue==="function"?a6.default.validateHeaderValue:($,X)=>{if(/[^\t\u0020-\u007E\u0080-\u00FF]/.test(X)){let Q=new TypeError(`Invalid character in header content ["${$}"]`);throw Object.defineProperty(Q,"code",{value:"ERR_INVALID_CHAR"}),Q}};L$=class L$ extends URLSearchParams{constructor($){let X=[];if($ instanceof L$){let Q=$.raw();for(let[J,G]of Object.entries(Q))X.push(...G.map((H)=>[J,H]))}else if($==null);else if(typeof $==="object"&&!i8.types.isBoxedPrimitive($)){let Q=$[Symbol.iterator];if(Q==null)X.push(...Object.entries($));else{if(typeof Q!=="function")throw new TypeError("Header pairs must be iterable");X=[...$].map((J)=>{if(typeof J!=="object"||i8.types.isBoxedPrimitive(J))throw new TypeError("Each header pair must be an iterable object");return[...J]}).map((J)=>{if(J.length!==2)throw new TypeError("Each header pair must be a name/value tuple");return[...J]})}}else throw new TypeError("Failed to construct 'Headers': The provided value is not of type '(sequence<sequence<ByteString>> or record<ByteString, ByteString>)");X=X.length>0?X.map(([Q,J])=>{return E1(Q),d8(Q,String(J)),[String(Q).toLowerCase(),String(J)]}):void 0;super(X);return new Proxy(this,{get(Q,J,G){switch(J){case"append":case"set":return(H,M)=>{return E1(H),d8(H,String(M)),URLSearchParams.prototype[J].call(Q,String(H).toLowerCase(),String(M))};case"delete":case"has":case"getAll":return(H)=>{return E1(H),URLSearchParams.prototype[J].call(Q,String(H).toLowerCase())};case"keys":return()=>{return Q.sort(),new Set(URLSearchParams.prototype.keys.call(Q)).keys()};default:return Reflect.get(Q,J,G)}}})}get[Symbol.toStringTag](){return this.constructor.name}toString(){return Object.prototype.toString.call(this)}get($){let X=this.getAll($);if(X.length===0)return null;let Q=X.join(", ");if(/^content-encoding$/i.test($))Q=Q.toLowerCase();return Q}forEach($,X=void 0){for(let Q of this.keys())Reflect.apply($,X,[this.get(Q),Q,this])}*values(){for(let $ of this.keys())yield this.get($)}*entries(){for(let $ of this.keys())yield[$,this.get($)]}[Symbol.iterator](){return this.entries()}raw(){return[...this.keys()].reduce(($,X)=>{return $[X]=this.getAll(X),$},{})}[Symbol.for("nodejs.util.inspect.custom")](){return[...this.keys()].reduce(($,X)=>{let Q=this.getAll(X);if(X==="host")$[X]=Q[0];else $[X]=Q.length>1?Q:Q[0];return $},{})}};Object.defineProperties(L$.prototype,["get","entries","forEach","values"].reduce(($,X)=>{return $[X]={enumerable:!0},$},{}))});var LG,r6=($)=>{return LG.has($)};var o8=B$(()=>{LG=new Set([301,302,303,307,308])});var r$,j$;var FJ=B$(()=>{_1();F1();o8();r$=Symbol("Response internals");j$=class j$ extends I0{constructor($=null,X={}){super($,X);let Q=X.status!=null?X.status:200,J=new L$(X.headers);if($!==null&&!J.has("Content-Type")){let G=S1($,this);if(G)J.append("Content-Type",G)}this[r$]={type:"default",url:X.url,status:Q,statusText:X.statusText||"",headers:J,counter:X.counter,highWaterMark:X.highWaterMark}}get type(){return this[r$].type}get url(){return this[r$].url||""}get status(){return this[r$].status}get ok(){return this[r$].status>=200&&this[r$].status<300}get redirected(){return this[r$].counter>0}get statusText(){return this[r$].statusText}get headers(){return this[r$].headers}get highWaterMark(){return this[r$].highWaterMark}clone(){return new j$(e4(this,this.highWaterMark),{type:this.type,url:this.url,status:this.status,statusText:this.statusText,headers:this.headers,ok:this.ok,redirected:this.redirected,size:this.size,highWaterMark:this.highWaterMark})}static redirect($,X=302){if(!r6(X))throw new RangeError('Failed to execute "redirect" on "response": Invalid status code');return new j$(null,{headers:{location:new URL($).toString()},status:X})}static error(){let $=new j$(null,{status:0,statusText:""});return $[r$].type="error",$}static json($=void 0,X={}){let Q=JSON.stringify($);if(Q===void 0)throw new TypeError("data is not JSON serializable");let J=new L$(X&&X.headers);if(!J.has("content-type"))J.set("content-type","application/json");return new j$(Q,{...X,headers:J})}get[Symbol.toStringTag](){return"Response"}};Object.defineProperties(j$.prototype,{type:{enumerable:!0},url:{enumerable:!0},status:{enumerable:!0},ok:{enumerable:!0},redirected:{enumerable:!0},statusText:{enumerable:!0},headers:{enumerable:!0},clone:{enumerable:!0}})});var EJ=($)=>{if($.search)return $.search;let X=$.href.length-1,Q=$.hash||($.href[X]==="#"?"#":"");return $.href[X-Q.length]==="?"?"?":""};function _J($,X=!1){if($==null)return"no-referrer";if($=new URL($),/^(about|blob|data):$/.test($.protocol))return"no-referrer";if($.username="",$.password="",$.hash="",X)$.pathname="",$.search="";return $}function CJ($){if(!RJ.has($))throw new TypeError(`Invalid referrerPolicy: ${$}`);return $}function vG($){if(/^(http|ws)s:$/.test($.protocol))return!0;let X=$.host.replace(/(^\[)|(]$)/g,""),Q=LJ.isIP(X);if(Q===4&&/^127\./.test(X))return!0;if(Q===6&&/^(((0+:){7})|(::(0+:){0,6}))0*1$/.test(X))return!0;if($.host==="localhost"||$.host.endsWith(".localhost"))return!1;if($.protocol==="file:")return!0;return!1}function $6($){if(/^about:(blank|srcdoc)$/.test($))return!0;if($.protocol==="data:")return!0;if(/^(blob|filesystem):$/.test($.protocol))return!0;return vG($)}function IJ($,{referrerURLCallback:X,referrerOriginCallback:Q}={}){if($.referrer==="no-referrer"||$.referrerPolicy==="")return null;let J=$.referrerPolicy;if($.referrer==="about:client")return"no-referrer";let G=$.referrer,H=_J(G),M=_J(G,!0);if(H.toString().length>4096)H=M;if(X)H=X(H);if(Q)M=Q(M);let z=new URL($.url);switch(J){case"no-referrer":return"no-referrer";case"origin":return M;case"unsafe-url":return H;case"strict-origin":if($6(H)&&!$6(z))return"no-referrer";return M.toString();case"strict-origin-when-cross-origin":if(H.origin===z.origin)return H;if($6(H)&&!$6(z))return"no-referrer";return M;case"same-origin":if(H.origin===z.origin)return H;return"no-referrer";case"origin-when-cross-origin":if(H.origin===z.origin)return H;return M;case"no-referrer-when-downgrade":if($6(H)&&!$6(z))return"no-referrer";return H;default:throw new TypeError(`Invalid referrerPolicy: ${J}`)}}function kJ($){let X=($.get("referrer-policy")||"").split(/[,\s]+/),Q="";for(let J of X)if(J&&RJ.has(J))Q=J;return Q}var LJ,RJ,vJ="strict-origin-when-cross-origin";var a8=B$(()=>{LJ=require("node:net");RJ=new Set(["","no-referrer","no-referrer-when-downgrade","same-origin","origin","strict-origin","origin-when-cross-origin","strict-origin-when-cross-origin","unsafe-url"])});var PJ,bJ,D$,t6=($)=>{return typeof $==="object"&&typeof $[D$]==="object"},CG,t0,fJ=($)=>{let{parsedURL:X}=$[D$],Q=new L$($[D$].headers);if(!Q.has("Accept"))Q.set("Accept","*/*");let J=null;if($.body===null&&/^(post|put)$/i.test($.method))J="0";if($.body!==null){let z=UJ($);if(typeof z==="number"&&!Number.isNaN(z))J=String(z)}if(J)Q.set("Content-Length",J);if($.referrerPolicy==="")$.referrerPolicy=vJ;if($.referrer&&$.referrer!=="no-referrer")$[D$].referrer=IJ($);else $[D$].referrer="no-referrer";if($[D$].referrer instanceof URL)Q.set("Referer",$.referrer);if(!Q.has("User-Agent"))Q.set("User-Agent","node-fetch");if($.compress&&!Q.has("Accept-Encoding"))Q.set("Accept-Encoding","gzip, deflate, br");let{agent:G}=$;if(typeof G==="function")G=G(X);let H=EJ(X),M={path:X.pathname+H,method:$.method,headers:Q[Symbol.for("nodejs.util.inspect.custom")](),insecureHTTPParser:$.insecureHTTPParser,agent:G};return{parsedURL:X,options:M}};var TJ=B$(()=>{PJ=require("node:url"),bJ=require("node:util");_1();F1();j1();a8();D$=Symbol("Request internals"),CG=bJ.deprecate(()=>{},".data is not a valid RequestInit property, use .body instead","https://github.com/node-fetch/node-fetch/issues/1000 (request)");t0=class t0 extends I0{constructor($,X={}){let Q;if(t6($))Q=new URL($.url);else Q=new URL($),$={};if(Q.username!==""||Q.password!=="")throw new TypeError(`${Q} is an url with embedded credentials.`);let J=X.method||$.method||"GET";if(/^(delete|get|head|options|post|put)$/i.test(J))J=J.toUpperCase();if(!t6(X)&&"data"in X)CG();if((X.body!=null||t6($)&&$.body!==null)&&(J==="GET"||J==="HEAD"))throw new TypeError("Request with GET/HEAD method cannot have body");let G=X.body?X.body:t6($)&&$.body!==null?e4($):null;super(G,{size:X.size||$.size||0});let H=new L$(X.headers||$.headers||{});if(G!==null&&!H.has("Content-Type")){let B=S1(G,this);if(B)H.set("Content-Type",B)}let M=t6($)?$.signal:null;if("signal"in X)M=X.signal;if(M!=null&&!QJ(M))throw new TypeError("Expected signal to be an instanceof AbortSignal or EventTarget");let z=X.referrer==null?$.referrer:X.referrer;if(z==="")z="no-referrer";else if(z){let B=new URL(z);z=/^about:(\/\/)?client$/.test(B)?"client":B}else z=void 0;this[D$]={method:J,redirect:X.redirect||$.redirect||"follow",headers:H,parsedURL:Q,signal:M,referrer:z},this.follow=X.follow===void 0?$.follow===void 0?20:$.follow:X.follow,this.compress=X.compress===void 0?$.compress===void 0?!0:$.compress:X.compress,this.counter=X.counter||$.counter||0,this.agent=X.agent||$.agent,this.highWaterMark=X.highWaterMark||$.highWaterMark||16384,this.insecureHTTPParser=X.insecureHTTPParser||$.insecureHTTPParser||!1,this.referrerPolicy=X.referrerPolicy||$.referrerPolicy||""}get method(){return this[D$].method}get url(){return PJ.format(this[D$].parsedURL)}get headers(){return this[D$].headers}get redirect(){return this[D$].redirect}get signal(){return this[D$].signal}get referrer(){if(this[D$].referrer==="no-referrer")return"";if(this[D$].referrer==="client")return"about:client";if(this[D$].referrer)return this[D$].referrer.toString();return}get referrerPolicy(){return this[D$].referrerPolicy}set referrerPolicy($){this[D$].referrerPolicy=CJ($)}clone(){return new t0(this)}get[Symbol.toStringTag](){return"Request"}};Object.defineProperties(t0.prototype,{method:{enumerable:!0},url:{enumerable:!0},headers:{enumerable:!0},redirect:{enumerable:!0},clone:{enumerable:!0},signal:{enumerable:!0},referrer:{enumerable:!0},referrerPolicy:{enumerable:!0}})});var L1;var gJ=B$(()=>{q1();L1=class L1 extends a0{constructor($,X="aborted"){super($,X)}}});var t8={};U8(t8,{isRedirect:()=>r6,fileFromSync:()=>DJ,fileFrom:()=>BJ,default:()=>r8,blobFromSync:()=>wJ,blobFrom:()=>zJ,Response:()=>j$,Request:()=>t0,Headers:()=>L$,FormData:()=>o0,File:()=>d0,FetchError:()=>E$,Blob:()=>a$,AbortError:()=>L1});async function r8($,X){return new Promise((Q,J)=>{let G=new t0($,X),{parsedURL:H,options:M}=fJ(G);if(!IG.has(H.protocol))throw new TypeError(`node-fetch cannot load ${$}. URL scheme "${H.protocol.replace(/:$/,"")}" is not supported.`);if(H.protocol==="data:"){let F=iW(G.url),f=new j$(F,{headers:{"Content-Type":F.typeFull}});Q(f);return}let z=(H.protocol==="https:"?hJ.default:xJ.default).request,{signal:B}=G,O=null,q=()=>{let F=new L1("The operation was aborted.");if(J(F),G.body&&G.body instanceof f$.default.Readable)G.body.destroy(F);if(!O||!O.body)return;O.body.emit("error",F)};if(B&&B.aborted){q();return}let x=()=>{q(),_()},T=z(H.toString(),M);if(B)B.addEventListener("abort",x);let _=()=>{if(T.abort(),B)B.removeEventListener("abort",x)};if(T.on("error",(F)=>{J(new E$(`request to ${G.url} failed, reason: ${F.message}`,"system",F)),_()}),kG(T,(F)=>{if(O&&O.body)O.body.destroy(F)}),process.version<"v14")T.on("socket",(F)=>{let f;F.prependListener("end",()=>{f=F._eventsCount}),F.prependListener("close",(P)=>{if(O&&f<F._eventsCount&&!P){let I=new Error("Premature close");I.code="ERR_STREAM_PREMATURE_CLOSE",O.body.emit("error",I)}})});T.on("response",(F)=>{T.setTimeout(0);let f=SJ(F.rawHeaders);if(r6(F.statusCode)){let r=f.get("Location"),u=null;try{u=r===null?null:new URL(r,G.url)}catch{if(G.redirect!=="manual"){J(new E$(`uri requested responds with an invalid redirect URL: ${r}`,"invalid-redirect")),_();return}}switch(G.redirect){case"error":J(new E$(`uri requested responds with a redirect, redirect mode is set to error: ${G.url}`,"no-redirect")),_();return;case"manual":break;case"follow":{if(u===null)break;if(G.counter>=G.follow){J(new E$(`maximum redirect reached at: ${G.url}`,"max-redirect")),_();return}let z$={headers:new L$(G.headers),follow:G.follow,counter:G.counter+1,agent:G.agent,compress:G.compress,method:G.method,body:e4(G),signal:G.signal,size:G.size,referrer:G.referrer,referrerPolicy:G.referrerPolicy};if(!WJ(G.url,u)||!JJ(G.url,u))for(let W0 of["authorization","www-authenticate","cookie","cookie2"])z$.headers.delete(W0);if(F.statusCode!==303&&G.body&&X.body instanceof f$.default.Readable){J(new E$("Cannot follow redirect with body being a readable stream","unsupported-redirect")),_();return}if(F.statusCode===303||(F.statusCode===301||F.statusCode===302)&&G.method==="POST")z$.method="GET",z$.body=void 0,z$.headers.delete("content-length");let T0=kJ(f);if(T0)z$.referrerPolicy=T0;Q(r8(new t0(u,z$))),_();return}default:return J(new TypeError(`Redirect option '${G.redirect}' is not a valid value of RequestRedirect`))}}if(B)F.once("end",()=>{B.removeEventListener("abort",x)});let P=f$.pipeline(F,new f$.PassThrough,(r)=>{if(r)J(r)});if(process.version<"v12.10")F.on("aborted",x);let I={url:G.url,status:F.statusCode,statusText:F.statusMessage,headers:f,size:G.size,counter:G.counter,highWaterMark:G.highWaterMark},Q$=f.get("Content-Encoding");if(!G.compress||G.method==="HEAD"||Q$===null||F.statusCode===204||F.statusCode===304){O=new j$(P,I),Q(O);return}let o={flush:S4.default.Z_SYNC_FLUSH,finishFlush:S4.default.Z_SYNC_FLUSH};if(Q$==="gzip"||Q$==="x-gzip"){P=f$.pipeline(P,S4.default.createGunzip(o),(r)=>{if(r)J(r)}),O=new j$(P,I),Q(O);return}if(Q$==="deflate"||Q$==="x-deflate"){let r=f$.pipeline(F,new f$.PassThrough,(u)=>{if(u)J(u)});r.once("data",(u)=>{if((u[0]&15)===8)P=f$.pipeline(P,S4.default.createInflate(),(z$)=>{if(z$)J(z$)});else P=f$.pipeline(P,S4.default.createInflateRaw(),(z$)=>{if(z$)J(z$)});O=new j$(P,I),Q(O)}),r.once("end",()=>{if(!O)O=new j$(P,I),Q(O)});return}if(Q$==="br"){P=f$.pipeline(P,S4.default.createBrotliDecompress(),(r)=>{if(r)J(r)}),O=new j$(P,I),Q(O);return}O=new j$(P,I),Q(O)}),NJ(T,G).catch(J)})}function kG($,X){let Q=s6.Buffer.from(`0\r
14
14
  \r
15
- `),J=!1,G=!1,H;$.on("response",(M)=>{let{headers:z}=M;J=z["transfer-encoding"]==="chunked"&&!z["content-length"]}),$.on("socket",(M)=>{let z=()=>{if(J&&!G){let O=new Error("Premature close");O.code="ERR_STREAM_PREMATURE_CLOSE",X(O)}},D=(O)=>{if(G=t6.Buffer.compare(O.slice(-5),Q)===0,!G&&H)G=t6.Buffer.compare(H.slice(-3),Q.slice(0,3))===0&&t6.Buffer.compare(O.slice(-2),Q.slice(3))===0;H=O};M.prependListener("close",z),M.on("data",D),$.on("close",()=>{M.removeListener("close",z),M.removeListener("data",D)})})}var b7,P7,K4,P$,t6,SG;var g7=z$(()=>{b7=x$(require("node:http")),P7=x$(require("node:https")),K4=x$(require("node:zlib")),P$=x$(require("node:stream")),t6=require("node:buffer");cQ();U1();A7();L1();k7();l2();I7();o2();D1();q1();r2();p2();SG=new Set(["data:","http:","https:"])});m6();var m9=60000;class I2{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(uX,(X)=>{let Q=this._requestHandlerAbortControllers.get(X.params.requestId);Q===null||Q===void 0||Q.abort(X.params.reason)}),this.setNotificationHandler(iX,(X)=>{this._onprogress(X)}),this.setRequestHandler(nX,(X)=>({}))}_setupTimeout($,X,Q,J,G=!1){this._timeoutInfo.set($,{timeoutId:setTimeout(J,X),startTime:Date.now(),timeout:X,maxTotalTimeout:Q,resetTimeoutOnProgress:G,onTimeout:J})}_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 w$(H$.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(R2(X)||u3(X))this._onresponse(X);else if(y3(X))this._onrequest(X,Q);else if(m3(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 w$(H$.ConnectionClosed,"Connection closed");for(let J of X.values())J(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((J)=>this._onerror(new Error(`Uncaught error in notification handler: ${J}`)))}_onrequest($,X){var Q,J,G,H;let M=(Q=this._requestHandlers.get($.method))!==null&&Q!==void 0?Q:this.fallbackRequestHandler;if(M===void 0){(J=this._transport)===null||J===void 0||J.send({jsonrpc:"2.0",id:$.id,error:{code:H$.MethodNotFound,message:"Method not found"}}).catch((O)=>this._onerror(new Error(`Failed to send an error response: ${O}`)));return}let z=new AbortController;this._requestHandlerAbortControllers.set($.id,z);let D={signal:z.signal,sessionId:(G=this._transport)===null||G===void 0?void 0:G.sessionId,_meta:(H=$.params)===null||H===void 0?void 0:H._meta,sendNotification:(O)=>this.notification(O,{relatedRequestId:$.id}),sendRequest:(O,_,m)=>this.request(O,_,{...m,relatedRequestId:$.id}),authInfo:X===null||X===void 0?void 0:X.authInfo,requestId:$.id};Promise.resolve().then(()=>M($,D)).then((O)=>{var _;if(z.signal.aborted)return;return(_=this._transport)===null||_===void 0?void 0:_.send({result:O,jsonrpc:"2.0",id:$.id})},(O)=>{var _,m;if(z.signal.aborted)return;return(_=this._transport)===null||_===void 0?void 0:_.send({jsonrpc:"2.0",id:$.id,error:{code:Number.isSafeInteger(O.code)?O.code:H$.InternalError,message:(m=O.message)!==null&&m!==void 0?m:"Internal error"}})}).catch((O)=>this._onerror(new Error(`Failed to send response: ${O}`))).finally(()=>{this._requestHandlerAbortControllers.delete($.id)})}_onprogress($){let{progressToken:X,...Q}=$.params,J=Number(X),G=this._progressHandlers.get(J);if(!G){this._onerror(new Error(`Received a progress notification for an unknown token: ${JSON.stringify($)}`));return}let H=this._responseHandlers.get(J),M=this._timeoutInfo.get(J);if(M&&H&&M.resetTimeoutOnProgress)try{this._resetTimeout(J)}catch(z){H(z);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),R2($))Q($);else{let J=new w$($.error.code,$.error.message,$.error.data);Q(J)}}get transport(){return this._transport}async close(){var $;await(($=this._transport)===null||$===void 0?void 0:$.close())}request($,X,Q){let{relatedRequestId:J,resumptionToken:G,onresumptiontoken:H}=Q!==null&&Q!==void 0?Q:{};return new Promise((M,z)=>{var D,O,_,m,x,h;if(!this._transport){z(new Error("Not connected"));return}if(((D=this._options)===null||D===void 0?void 0:D.enforceStrictCapabilities)===!0)this.assertCapabilityForMethod($.method);(O=Q===null||Q===void 0?void 0:Q.signal)===null||O===void 0||O.throwIfAborted();let k=this._requestMessageId++,X$={...$,jsonrpc:"2.0",id:k};if(Q===null||Q===void 0?void 0:Q.onprogress)this._progressHandlers.set(k,Q.onprogress),X$.params={...$.params,_meta:{...((_=$.params)===null||_===void 0?void 0:_._meta)||{},progressToken:k}};let s=(a)=>{var $$;this._responseHandlers.delete(k),this._progressHandlers.delete(k),this._cleanupTimeout(k),($$=this._transport)===null||$$===void 0||$$.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:k,reason:String(a)}},{relatedRequestId:J,resumptionToken:G,onresumptiontoken:H}).catch((n)=>this._onerror(new Error(`Failed to send cancellation: ${n}`))),z(a)};this._responseHandlers.set(k,(a)=>{var $$;if(($$=Q===null||Q===void 0?void 0:Q.signal)===null||$$===void 0?void 0:$$.aborted)return;if(a instanceof Error)return z(a);try{let n=X.parse(a.result);M(n)}catch(n){z(n)}}),(m=Q===null||Q===void 0?void 0:Q.signal)===null||m===void 0||m.addEventListener("abort",()=>{var a;s((a=Q===null||Q===void 0?void 0:Q.signal)===null||a===void 0?void 0:a.reason)});let Z=(x=Q===null||Q===void 0?void 0:Q.timeout)!==null&&x!==void 0?x:m9,G$=()=>s(new w$(H$.RequestTimeout,"Request timed out",{timeout:Z}));this._setupTimeout(k,Z,Q===null||Q===void 0?void 0:Q.maxTotalTimeout,G$,(h=Q===null||Q===void 0?void 0:Q.resetTimeoutOnProgress)!==null&&h!==void 0?h:!1),this._transport.send(X$,{relatedRequestId:J,resumptionToken:G,onresumptiontoken:H}).catch((a)=>{this._cleanupTimeout(k),z(a)})})}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,(J,G)=>{return Promise.resolve(X($.parse(J),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 s3($,X){return Object.entries(X).reduce((Q,[J,G])=>{if(G&&typeof G==="object")Q[J]=Q[J]?{...Q[J],...G}:G;else Q[J]=G;return Q},{...$})}m6();class b2 extends I2{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(pX,(J)=>this._oninitialize(J)),this.setNotificationHandler(v2,()=>{var J;return(J=this.oninitialized)===null||J===void 0?void 0:J.call(this)})}registerCapabilities($){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=s3(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:g3.includes(X)?X:E2,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"},cX)}async createMessage($,X){return this.request({method:"sampling/createMessage",params:$},C2,X)}async listRoots($,X){return this.request({method:"roots/list",params:$},k2,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 $Q=Symbol("Let zodToJsonSchema decide on which parser to use");var e3={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"},XQ=($)=>typeof $==="string"?{...e3,name:$}:{...e3,...$};var QQ=($)=>{let X=XQ($),Q=X.name!==void 0?[...X.basePath,X.definitionPath,X.name]:X.basePath;return{...X,currentPath:Q,propertyPath:void 0,seen:new Map(Object.entries(X.definitions).map(([J,G])=>[G._def,{def:G._def,path:[...X.basePath,X.definitionPath,J],jsonSchema:void 0}]))}};function P2($,X,Q,J){if(!J?.errorMessages)return;if(Q)$.errorMessage={...$.errorMessage,[X]:Q}}function t($,X,Q,J,G){$[X]=Q,P2($,X,J,G)}p0();function WQ(){return{}}p0();function JQ($,X){let Q={type:"array"};if($.type?._def&&$.type?._def?.typeName!==N.ZodAny)Q.items=P($.type._def,{...X,currentPath:[...X.currentPath,"items"]});if($.minLength)t(Q,"minItems",$.minLength.value,$.minLength.message,X);if($.maxLength)t(Q,"maxItems",$.maxLength.value,$.maxLength.message,X);if($.exactLength)t(Q,"minItems",$.exactLength.value,$.exactLength.message,X),t(Q,"maxItems",$.exactLength.value,$.exactLength.message,X);return Q}function GQ($,X){let Q={type:"integer",format:"int64"};if(!$.checks)return Q;for(let J of $.checks)switch(J.kind){case"min":if(X.target==="jsonSchema7")if(J.inclusive)t(Q,"minimum",J.value,J.message,X);else t(Q,"exclusiveMinimum",J.value,J.message,X);else{if(!J.inclusive)Q.exclusiveMinimum=!0;t(Q,"minimum",J.value,J.message,X)}break;case"max":if(X.target==="jsonSchema7")if(J.inclusive)t(Q,"maximum",J.value,J.message,X);else t(Q,"exclusiveMaximum",J.value,J.message,X);else{if(!J.inclusive)Q.exclusiveMaximum=!0;t(Q,"maximum",J.value,J.message,X)}break;case"multipleOf":t(Q,"multipleOf",J.value,J.message,X);break}return Q}function YQ(){return{type:"boolean"}}function Y1($,X){return P($.type._def,X)}var HQ=($,X)=>{return P($.innerType._def,X)};function f2($,X,Q){let J=Q??X.dateStrategy;if(Array.isArray(J))return{anyOf:J.map((G,H)=>f2($,X,G))};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 l9($,X)}}var l9=($,X)=>{let Q={type:"integer",format:"unix-time"};if(X.target==="openApi3")return Q;for(let J of $.checks)switch(J.kind){case"min":t(Q,"minimum",J.value,J.message,X);break;case"max":t(Q,"maximum",J.value,J.message,X);break}return Q};function MQ($,X){return{...P($.innerType._def,X),default:$.defaultValue()}}function wQ($,X){return X.effectStrategy==="input"?P($.schema._def,X):{}}function zQ($){return{type:"string",enum:Array.from($.values)}}var c9=($)=>{if("type"in $&&$.type==="string")return!1;return"allOf"in $};function BQ($,X){let Q=[P($.left._def,{...X,currentPath:[...X.currentPath,"allOf","0"]}),P($.right._def,{...X,currentPath:[...X.currentPath,"allOf","1"]})].filter((H)=>!!H),J=X.target==="jsonSchema2019-09"?{unevaluatedProperties:!1}:void 0,G=[];return Q.forEach((H)=>{if(c9(H)){if(G.push(...H.allOf),H.unevaluatedProperties===void 0)J=void 0}else{let M=H;if("additionalProperties"in H&&H.additionalProperties===!1){let{additionalProperties:z,...D}=H;M=D}else J=void 0;G.push(M)}}),G.length?{allOf:G,...J}:void 0}function DQ($,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}}p0();var g2=void 0,d$={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(g2===void 0)g2=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u");return g2},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 H1($,X){let Q={type:"string"};if($.checks)for(let J of $.checks)switch(J.kind){case"min":t(Q,"minLength",typeof Q.minLength==="number"?Math.max(Q.minLength,J.value):J.value,J.message,X);break;case"max":t(Q,"maxLength",typeof Q.maxLength==="number"?Math.min(Q.maxLength,J.value):J.value,J.message,X);break;case"email":switch(X.emailStrategy){case"format:email":o$(Q,"email",J.message,X);break;case"format:idn-email":o$(Q,"idn-email",J.message,X);break;case"pattern:zod":N$(Q,d$.email,J.message,X);break}break;case"url":o$(Q,"uri",J.message,X);break;case"uuid":o$(Q,"uuid",J.message,X);break;case"regex":N$(Q,J.regex,J.message,X);break;case"cuid":N$(Q,d$.cuid,J.message,X);break;case"cuid2":N$(Q,d$.cuid2,J.message,X);break;case"startsWith":N$(Q,RegExp(`^${T2(J.value,X)}`),J.message,X);break;case"endsWith":N$(Q,RegExp(`${T2(J.value,X)}$`),J.message,X);break;case"datetime":o$(Q,"date-time",J.message,X);break;case"date":o$(Q,"date",J.message,X);break;case"time":o$(Q,"time",J.message,X);break;case"duration":o$(Q,"duration",J.message,X);break;case"length":t(Q,"minLength",typeof Q.minLength==="number"?Math.max(Q.minLength,J.value):J.value,J.message,X),t(Q,"maxLength",typeof Q.maxLength==="number"?Math.min(Q.maxLength,J.value):J.value,J.message,X);break;case"includes":{N$(Q,RegExp(T2(J.value,X)),J.message,X);break}case"ip":{if(J.version!=="v6")o$(Q,"ipv4",J.message,X);if(J.version!=="v4")o$(Q,"ipv6",J.message,X);break}case"base64url":N$(Q,d$.base64url,J.message,X);break;case"jwt":N$(Q,d$.jwt,J.message,X);break;case"cidr":{if(J.version!=="v6")N$(Q,d$.ipv4Cidr,J.message,X);if(J.version!=="v4")N$(Q,d$.ipv6Cidr,J.message,X);break}case"emoji":N$(Q,d$.emoji(),J.message,X);break;case"ulid":{N$(Q,d$.ulid,J.message,X);break}case"base64":{switch(X.base64Strategy){case"format:binary":{o$(Q,"binary",J.message,X);break}case"contentEncoding:base64":{t(Q,"contentEncoding","base64",J.message,X);break}case"pattern:zod":{N$(Q,d$.base64,J.message,X);break}}break}case"nanoid":N$(Q,d$.nanoid,J.message,X);case"toLowerCase":case"toUpperCase":case"trim":break;default:((G)=>{})(J)}return Q}function T2($,X){return X.patternStrategy==="escape"?p9($):$}var u9=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function p9($){let X="";for(let Q=0;Q<$.length;Q++){if(!u9.has($[Q]))X+="\\";X+=$[Q]}return X}function o$($,X,Q,J){if($.format||$.anyOf?.some((G)=>G.format)){if(!$.anyOf)$.anyOf=[];if($.format){if($.anyOf.push({format:$.format,...$.errorMessage&&J.errorMessages&&{errorMessage:{format:$.errorMessage.format}}}),delete $.format,$.errorMessage){if(delete $.errorMessage.format,Object.keys($.errorMessage).length===0)delete $.errorMessage}}$.anyOf.push({format:X,...Q&&J.errorMessages&&{errorMessage:{format:Q}}})}else t($,"format",X,Q,J)}function N$($,X,Q,J){if($.pattern||$.allOf?.some((G)=>G.pattern)){if(!$.allOf)$.allOf=[];if($.pattern){if($.allOf.push({pattern:$.pattern,...$.errorMessage&&J.errorMessages&&{errorMessage:{pattern:$.errorMessage.pattern}}}),delete $.pattern,$.errorMessage){if(delete $.errorMessage.pattern,Object.keys($.errorMessage).length===0)delete $.errorMessage}}$.allOf.push({pattern:VQ(X,J),...Q&&J.errorMessages&&{errorMessage:{pattern:Q}}})}else t($,"pattern",VQ(X,J),Q,J)}function VQ($,X){if(!X.applyRegexFlags||!$.flags)return $.source;let Q={i:$.flags.includes("i"),m:$.flags.includes("m"),s:$.flags.includes("s")},J=Q.i?$.source.toLowerCase():$.source,G="",H=!1,M=!1,z=!1;for(let D=0;D<J.length;D++){if(H){G+=J[D],H=!1;continue}if(Q.i){if(M){if(J[D].match(/[a-z]/)){if(z)G+=J[D],G+=`${J[D-2]}-${J[D]}`.toUpperCase(),z=!1;else if(J[D+1]==="-"&&J[D+2]?.match(/[a-z]/))G+=J[D],z=!0;else G+=`${J[D]}${J[D].toUpperCase()}`;continue}}else if(J[D].match(/[a-z]/)){G+=`[${J[D]}${J[D].toUpperCase()}]`;continue}}if(Q.m){if(J[D]==="^"){G+=`(^|(?<=[\r
16
- ]))`;continue}else if(J[D]==="$"){G+=`($|(?=[\r
17
- ]))`;continue}}if(Q.s&&J[D]==="."){G+=M?`${J[D]}\r
18
- `:`[${J[D]}\r
19
- ]`;continue}if(G+=J[D],J[D]==="\\")H=!0;else if(M&&J[D]==="]")M=!1;else if(!M&&J[D]==="[")M=!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 M1($,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===N.ZodEnum)return{type:"object",required:$.keyType._def.values,properties:$.keyType._def.values.reduce((J,G)=>({...J,[G]:P($.valueType._def,{...X,currentPath:[...X.currentPath,"properties",G]})??{}}),{}),additionalProperties:X.rejectedAdditionalProperties};let Q={type:"object",additionalProperties:P($.valueType._def,{...X,currentPath:[...X.currentPath,"additionalProperties"]})??X.allowedAdditionalProperties};if(X.target==="openApi3")return Q;if($.keyType?._def.typeName===N.ZodString&&$.keyType._def.checks?.length){let{type:J,...G}=H1($.keyType._def,X);return{...Q,propertyNames:G}}else if($.keyType?._def.typeName===N.ZodEnum)return{...Q,propertyNames:{enum:$.keyType._def.values}};else if($.keyType?._def.typeName===N.ZodBranded&&$.keyType._def.type._def.typeName===N.ZodString&&$.keyType._def.type._def.checks?.length){let{type:J,...G}=Y1($.keyType._def,X);return{...Q,propertyNames:G}}return Q}function OQ($,X){if(X.mapStrategy==="record")return M1($,X);let Q=P($.keyType._def,{...X,currentPath:[...X.currentPath,"items","items","0"]})||{},J=P($.valueType._def,{...X,currentPath:[...X.currentPath,"items","items","1"]})||{};return{type:"array",maxItems:125,items:{type:"array",items:[Q,J],minItems:2,maxItems:2}}}function qQ($){let X=$.values,J=Object.keys($.values).filter((H)=>{return typeof X[X[H]]!=="number"}).map((H)=>X[H]),G=Array.from(new Set(J.map((H)=>typeof H)));return{type:G.length===1?G[0]==="string"?"string":"number":["string","number"],enum:J}}function _Q(){return{not:{}}}function AQ($){return $.target==="openApi3"?{enum:["null"],nullable:!0}:{type:"null"}}var l6={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};function KQ($,X){if(X.target==="openApi3")return jQ($,X);let Q=$.options instanceof Map?Array.from($.options.values()):$.options;if(Q.every((J)=>(J._def.typeName in l6)&&(!J._def.checks||!J._def.checks.length))){let J=Q.reduce((G,H)=>{let M=l6[H._def.typeName];return M&&!G.includes(M)?[...G,M]:G},[]);return{type:J.length>1?J:J[0]}}else if(Q.every((J)=>J._def.typeName==="ZodLiteral"&&!J.description)){let J=Q.reduce((G,H)=>{let M=typeof H._def.value;switch(M){case"string":case"number":case"boolean":return[...G,M];case"bigint":return[...G,"integer"];case"object":if(H._def.value===null)return[...G,"null"];case"symbol":case"undefined":case"function":default:return G}},[]);if(J.length===Q.length){let G=J.filter((H,M,z)=>z.indexOf(H)===M);return{type:G.length>1?G:G[0],enum:Q.reduce((H,M)=>{return H.includes(M._def.value)?H:[...H,M._def.value]},[])}}}else if(Q.every((J)=>J._def.typeName==="ZodEnum"))return{type:"string",enum:Q.reduce((J,G)=>[...J,...G._def.values.filter((H)=>!J.includes(H))],[])};return jQ($,X)}var jQ=($,X)=>{let Q=($.options instanceof Map?Array.from($.options.values()):$.options).map((J,G)=>P(J._def,{...X,currentPath:[...X.currentPath,"anyOf",`${G}`]})).filter((J)=>!!J&&(!X.strictUnions||typeof J==="object"&&Object.keys(J).length>0));return Q.length?{anyOf:Q}:void 0};function UQ($,X){if(["ZodString","ZodNumber","ZodBigInt","ZodBoolean","ZodNull"].includes($.innerType._def.typeName)&&(!$.innerType._def.checks||!$.innerType._def.checks.length)){if(X.target==="openApi3")return{type:l6[$.innerType._def.typeName],nullable:!0};return{type:[l6[$.innerType._def.typeName],"null"]}}if(X.target==="openApi3"){let J=P($.innerType._def,{...X,currentPath:[...X.currentPath]});if(J&&"$ref"in J)return{allOf:[J],nullable:!0};return J&&{...J,nullable:!0}}let Q=P($.innerType._def,{...X,currentPath:[...X.currentPath,"anyOf","0"]});return Q&&{anyOf:[Q,{type:"null"}]}}function NQ($,X){let Q={type:"number"};if(!$.checks)return Q;for(let J of $.checks)switch(J.kind){case"int":Q.type="integer",P2(Q,"type",J.message,X);break;case"min":if(X.target==="jsonSchema7")if(J.inclusive)t(Q,"minimum",J.value,J.message,X);else t(Q,"exclusiveMinimum",J.value,J.message,X);else{if(!J.inclusive)Q.exclusiveMinimum=!0;t(Q,"minimum",J.value,J.message,X)}break;case"max":if(X.target==="jsonSchema7")if(J.inclusive)t(Q,"maximum",J.value,J.message,X);else t(Q,"exclusiveMaximum",J.value,J.message,X);else{if(!J.inclusive)Q.exclusiveMaximum=!0;t(Q,"maximum",J.value,J.message,X)}break;case"multipleOf":t(Q,"multipleOf",J.value,J.message,X);break}return Q}p0();function LQ($,X){let Q=X.target==="openAi",J={type:"object",properties:{}},G=[],H=$.shape();for(let z in H){let D=H[z];if(D===void 0||D._def===void 0)continue;let O=i9(D);if(O&&Q){if(D instanceof k$)D=D._def.innerType;if(!D.isNullable())D=D.nullable();O=!1}let _=P(D._def,{...X,currentPath:[...X.currentPath,"properties",z],propertyPath:[...X.currentPath,"properties",z]});if(_===void 0)continue;if(J.properties[z]=_,!O)G.push(z)}if(G.length)J.required=G;let M=n9($,X);if(M!==void 0)J.additionalProperties=M;return J}function n9($,X){if($.catchall._def.typeName!=="ZodNever")return P($.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 i9($){try{return $.isOptional()}catch{return!0}}var SQ=($,X)=>{if(X.currentPath.toString()===X.propertyPath?.toString())return P($.innerType._def,X);let Q=P($.innerType._def,{...X,currentPath:[...X.currentPath,"anyOf","1"]});return Q?{anyOf:[{not:{}},Q]}:{}};var FQ=($,X)=>{if(X.pipeStrategy==="input")return P($.in._def,X);else if(X.pipeStrategy==="output")return P($.out._def,X);let Q=P($.in._def,{...X,currentPath:[...X.currentPath,"allOf","0"]}),J=P($.out._def,{...X,currentPath:[...X.currentPath,"allOf",Q?"1":"0"]});return{allOf:[Q,J].filter((G)=>G!==void 0)}};function EQ($,X){return P($.type._def,X)}function RQ($,X){let J={type:"array",uniqueItems:!0,items:P($.valueType._def,{...X,currentPath:[...X.currentPath,"items"]})};if($.minSize)t(J,"minItems",$.minSize.value,$.minSize.message,X);if($.maxSize)t(J,"maxItems",$.maxSize.value,$.maxSize.message,X);return J}function vQ($,X){if($.rest)return{type:"array",minItems:$.items.length,items:$.items.map((Q,J)=>P(Q._def,{...X,currentPath:[...X.currentPath,"items",`${J}`]})).reduce((Q,J)=>J===void 0?Q:[...Q,J],[]),additionalItems:P($.rest._def,{...X,currentPath:[...X.currentPath,"additionalItems"]})};else return{type:"array",minItems:$.items.length,maxItems:$.items.length,items:$.items.map((Q,J)=>P(Q._def,{...X,currentPath:[...X.currentPath,"items",`${J}`]})).reduce((Q,J)=>J===void 0?Q:[...Q,J],[])}}function CQ(){return{not:{}}}function kQ(){return{}}var IQ=($,X)=>{return P($.innerType._def,X)};var bQ=($,X,Q)=>{switch(X){case N.ZodString:return H1($,Q);case N.ZodNumber:return NQ($,Q);case N.ZodObject:return LQ($,Q);case N.ZodBigInt:return GQ($,Q);case N.ZodBoolean:return YQ();case N.ZodDate:return f2($,Q);case N.ZodUndefined:return CQ();case N.ZodNull:return AQ(Q);case N.ZodArray:return JQ($,Q);case N.ZodUnion:case N.ZodDiscriminatedUnion:return KQ($,Q);case N.ZodIntersection:return BQ($,Q);case N.ZodTuple:return vQ($,Q);case N.ZodRecord:return M1($,Q);case N.ZodLiteral:return DQ($,Q);case N.ZodEnum:return zQ($);case N.ZodNativeEnum:return qQ($);case N.ZodNullable:return UQ($,Q);case N.ZodOptional:return SQ($,Q);case N.ZodMap:return OQ($,Q);case N.ZodSet:return RQ($,Q);case N.ZodLazy:return()=>$.getter()._def;case N.ZodPromise:return EQ($,Q);case N.ZodNaN:case N.ZodNever:return _Q();case N.ZodEffects:return wQ($,Q);case N.ZodAny:return WQ();case N.ZodUnknown:return kQ();case N.ZodDefault:return MQ($,Q);case N.ZodBranded:return Y1($,Q);case N.ZodReadonly:return IQ($,Q);case N.ZodCatch:return HQ($,Q);case N.ZodPipeline:return FQ($,Q);case N.ZodFunction:case N.ZodVoid:case N.ZodSymbol:return;default:return((J)=>{return})(X)}};function P($,X,Q=!1){let J=X.seen.get($);if(X.override){let z=X.override?.($,X,J,Q);if(z!==$Q)return z}if(J&&!Q){let z=d9(J,X);if(z!==void 0)return z}let G={def:$,path:X.currentPath,jsonSchema:void 0};X.seen.set($,G);let H=bQ($,$.typeName,X),M=typeof H==="function"?P(H(),X):H;if(M)r9($,X,M);if(X.postProcess){let z=X.postProcess(M,$,X);return G.jsonSchema=M,z}return G.jsonSchema=M,M}var d9=($,X)=>{switch(X.$refStrategy){case"root":return{$ref:$.path.join("/")};case"relative":return{$ref:o9(X.currentPath,$.path)};case"none":case"seen":{if($.path.length<X.currentPath.length&&$.path.every((Q,J)=>X.currentPath[J]===Q))return console.warn(`Recursive reference detected at ${X.currentPath.join("/")}! Defaulting to any`),{};return X.$refStrategy==="seen"?{}:void 0}}},o9=($,X)=>{let Q=0;for(;Q<$.length&&Q<X.length;Q++)if($[Q]!==X[Q])break;return[($.length-Q).toString(),...X.slice(Q)].join("/")},r9=($,X,Q)=>{if($.description){if(Q.description=$.description,X.markdownDescription)Q.markdownDescription=$.description}return Q};var w1=($,X)=>{let Q=QQ(X),J=typeof X==="object"&&X.definitions?Object.entries(X.definitions).reduce((D,[O,_])=>({...D,[O]:P(_._def,{...Q,currentPath:[...Q.basePath,Q.definitionPath,O]},!0)??{}}),{}):void 0,G=typeof X==="string"?X:X?.nameStrategy==="title"?void 0:X?.name,H=P($._def,G===void 0?Q:{...Q,currentPath:[...Q.basePath,Q.definitionPath,G]},!1)??{},M=typeof X==="object"&&X.name!==void 0&&X.nameStrategy==="title"?X.name:void 0;if(M!==void 0)H.title=M;let z=G===void 0?J?{...H,[Q.definitionPath]:J}:H:{$ref:[...Q.$refStrategy==="relative"?[]:Q.basePath,Q.definitionPath,G].join("/"),[Q.definitionPath]:{...J,[G]:H}};if(Q.target==="jsonSchema7")z.$schema="http://json-schema.org/draft-07/schema#";else if(Q.target==="jsonSchema2019-09"||Q.target==="openAi")z.$schema="https://json-schema.org/draft/2019-09/schema#";if(Q.target==="openAi"&&(("anyOf"in z)||("oneOf"in z)||("allOf"in z)||("type"in z)&&Array.isArray(z.type)))console.warn("Warning: OpenAI may not support schemas with unions as roots! Try wrapping it in an object property.");return z};p0();m6();p0();var x2;(function($){$.Completable="McpCompletable"})(x2||(x2={}));class c6 extends c{_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}}c6.create=($,X)=>{return new c6({type:$,typeName:x2.Completable,complete:X.complete,...a9(X)})};function a9($){if(!$)return{};let{errorMap:X,invalid_type_error:Q,required_error:J,description:G}=$;if(X&&(Q||J))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:(M,z)=>{var D,O;let{message:_}=$;if(M.code==="invalid_enum_value")return{message:_!==null&&_!==void 0?_:z.defaultError};if(typeof z.data==="undefined")return{message:(D=_!==null&&_!==void 0?_:J)!==null&&D!==void 0?D:z.defaultError};if(M.code!=="invalid_type")return{message:z.defaultError};return{message:(O=_!==null&&_!==void 0?_:Q)!==null&&O!==void 0?O:z.defaultError}},description:G}}class h2{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 b2($,X)}async connect($){return await this.server.connect($)}async close(){await this.server.close()}setToolRequestHandlers(){if(this._toolHandlersInitialized)return;this.server.assertCanSetRequestHandler(W1.shape.method.value),this.server.assertCanSetRequestHandler(J1.shape.method.value),this.server.registerCapabilities({tools:{listChanged:!0}}),this.server.setRequestHandler(W1,()=>({tools:Object.entries(this._registeredTools).filter(([,$])=>$.enabled).map(([$,X])=>{let Q={name:$,description:X.description,inputSchema:X.inputSchema?w1(X.inputSchema,{strictUnions:!0}):t9,annotations:X.annotations};if(X.outputSchema)Q.outputSchema=w1(X.outputSchema,{strictUnions:!0});return Q})})),this.server.setRequestHandler(J1,async($,X)=>{let Q=this._registeredTools[$.params.name];if(!Q)throw new w$(H$.InvalidParams,`Tool ${$.params.name} not found`);if(!Q.enabled)throw new w$(H$.InvalidParams,`Tool ${$.params.name} disabled`);let J;if(Q.inputSchema){let G=await Q.inputSchema.safeParseAsync($.params.arguments);if(!G.success)throw new w$(H$.InvalidParams,`Invalid arguments for tool ${$.params.name}: ${G.error.message}`);let H=G.data,M=Q.callback;try{J=await Promise.resolve(M(H,X))}catch(z){J={content:[{type:"text",text:z instanceof Error?z.message:String(z)}],isError:!0}}}else{let G=Q.callback;try{J=await Promise.resolve(G(X))}catch(H){J={content:[{type:"text",text:H instanceof Error?H.message:String(H)}],isError:!0}}}if(Q.outputSchema){if(!J.structuredContent)throw new w$(H$.InvalidParams,`Tool ${$.params.name} has an output schema but no structured content was provided`);let G=await Q.outputSchema.safeParseAsync(J.structuredContent);if(!G.success)throw new w$(H$.InvalidParams,`Invalid structured content for tool ${$.params.name}: ${G.error.message}`)}return J}),this._toolHandlersInitialized=!0}setCompletionRequestHandler(){if(this._completionHandlerInitialized)return;this.server.assertCanSetRequestHandler(G1.shape.method.value),this.server.setRequestHandler(G1,async($)=>{switch($.params.ref.type){case"ref/prompt":return this.handlePromptCompletion($,$.params.ref);case"ref/resource":return this.handleResourceCompletion($,$.params.ref);default:throw new w$(H$.InvalidParams,`Invalid completion reference: ${$.params.ref}`)}}),this._completionHandlerInitialized=!0}async handlePromptCompletion($,X){let Q=this._registeredPrompts[X.name];if(!Q)throw new w$(H$.InvalidParams,`Prompt ${X.name} not found`);if(!Q.enabled)throw new w$(H$.InvalidParams,`Prompt ${X.name} disabled`);if(!Q.argsSchema)return z1;let J=Q.argsSchema.shape[$.params.argument.name];if(!(J instanceof c6))return z1;let H=await J._def.complete($.params.argument.value);return fQ(H)}async handleResourceCompletion($,X){let Q=Object.values(this._registeredResourceTemplates).find((H)=>H.resourceTemplate.uriTemplate.toString()===X.uri);if(!Q){if(this._registeredResources[X.uri])return z1;throw new w$(H$.InvalidParams,`Resource template ${$.params.ref.uri} not found`)}let J=Q.resourceTemplate.completeCallback($.params.argument.name);if(!J)return z1;let G=await J($.params.argument.value);return fQ(G)}setResourceRequestHandlers(){if(this._resourceHandlersInitialized)return;this.server.assertCanSetRequestHandler(rX.shape.method.value),this.server.assertCanSetRequestHandler(aX.shape.method.value),this.server.assertCanSetRequestHandler(tX.shape.method.value),this.server.registerCapabilities({resources:{listChanged:!0}}),this.server.setRequestHandler(rX,async($,X)=>{let Q=Object.entries(this._registeredResources).filter(([G,H])=>H.enabled).map(([G,H])=>({uri:G,name:H.name,...H.metadata})),J=[];for(let G of Object.values(this._registeredResourceTemplates)){if(!G.resourceTemplate.listCallback)continue;let H=await G.resourceTemplate.listCallback(X);for(let M of H.resources)J.push({...M,...G.metadata})}return{resources:[...Q,...J]}}),this.server.setRequestHandler(aX,async()=>{return{resourceTemplates:Object.entries(this._registeredResourceTemplates).map(([X,Q])=>({name:X,uriTemplate:Q.resourceTemplate.uriTemplate.toString(),...Q.metadata}))}}),this.server.setRequestHandler(tX,async($,X)=>{let Q=new URL($.params.uri),J=this._registeredResources[Q.toString()];if(J){if(!J.enabled)throw new w$(H$.InvalidParams,`Resource ${Q} disabled`);return J.readCallback(Q,X)}for(let G of Object.values(this._registeredResourceTemplates)){let H=G.resourceTemplate.uriTemplate.match(Q.toString());if(H)return G.readCallback(Q,H,X)}throw new w$(H$.InvalidParams,`Resource ${Q} not found`)}),this.setCompletionRequestHandler(),this._resourceHandlersInitialized=!0}setPromptRequestHandlers(){if(this._promptHandlersInitialized)return;this.server.assertCanSetRequestHandler(sX.shape.method.value),this.server.assertCanSetRequestHandler(eX.shape.method.value),this.server.registerCapabilities({prompts:{listChanged:!0}}),this.server.setRequestHandler(sX,()=>({prompts:Object.entries(this._registeredPrompts).filter(([,$])=>$.enabled).map(([$,X])=>{return{name:$,description:X.description,arguments:X.argsSchema?e9(X.argsSchema):void 0}})})),this.server.setRequestHandler(eX,async($,X)=>{let Q=this._registeredPrompts[$.params.name];if(!Q)throw new w$(H$.InvalidParams,`Prompt ${$.params.name} not found`);if(!Q.enabled)throw new w$(H$.InvalidParams,`Prompt ${$.params.name} disabled`);if(Q.argsSchema){let J=await Q.argsSchema.safeParseAsync($.params.arguments);if(!J.success)throw new w$(H$.InvalidParams,`Invalid arguments for prompt ${$.params.name}: ${J.error.message}`);let G=J.data,H=Q.callback;return await Promise.resolve(H(G,X))}else{let J=Q.callback;return await Promise.resolve(J(X))}}),this.setCompletionRequestHandler(),this._promptHandlersInitialized=!0}resource($,X,...Q){let J;if(typeof Q[0]==="object")J=Q.shift();let G=Q[0];if(typeof X==="string"){if(this._registeredResources[X])throw new Error(`Resource ${X} is already registered`);let H={name:$,metadata:J,readCallback:G,enabled:!0,disable:()=>H.update({enabled:!1}),enable:()=>H.update({enabled:!0}),remove:()=>H.update({uri:null}),update:(M)=>{if(typeof M.uri!=="undefined"&&M.uri!==X){if(delete this._registeredResources[X],M.uri)this._registeredResources[M.uri]=H}if(typeof M.name!=="undefined")H.name=M.name;if(typeof M.metadata!=="undefined")H.metadata=M.metadata;if(typeof M.callback!=="undefined")H.readCallback=M.callback;if(typeof M.enabled!=="undefined")H.enabled=M.enabled;this.sendResourceListChanged()}};return this._registeredResources[X]=H,this.setResourceRequestHandlers(),this.sendResourceListChanged(),H}else{if(this._registeredResourceTemplates[$])throw new Error(`Resource template ${$} is already registered`);let H={resourceTemplate:X,metadata:J,readCallback:G,enabled:!0,disable:()=>H.update({enabled:!1}),enable:()=>H.update({enabled:!0}),remove:()=>H.update({name:null}),update:(M)=>{if(typeof M.name!=="undefined"&&M.name!==$){if(delete this._registeredResourceTemplates[$],M.name)this._registeredResourceTemplates[M.name]=H}if(typeof M.template!=="undefined")H.resourceTemplate=M.template;if(typeof M.metadata!=="undefined")H.metadata=M.metadata;if(typeof M.callback!=="undefined")H.readCallback=M.callback;if(typeof M.enabled!=="undefined")H.enabled=M.enabled;this.sendResourceListChanged()}};return this._registeredResourceTemplates[$]=H,this.setResourceRequestHandlers(),this.sendResourceListChanged(),H}}_createRegisteredTool($,X,Q,J,G,H){let M={description:X,inputSchema:Q===void 0?void 0:B.object(Q),outputSchema:J===void 0?void 0:B.object(J),annotations:G,callback:H,enabled:!0,disable:()=>M.update({enabled:!1}),enable:()=>M.update({enabled:!0}),remove:()=>M.update({name:null}),update:(z)=>{if(typeof z.name!=="undefined"&&z.name!==$){if(delete this._registeredTools[$],z.name)this._registeredTools[z.name]=M}if(typeof z.description!=="undefined")M.description=z.description;if(typeof z.paramsSchema!=="undefined")M.inputSchema=B.object(z.paramsSchema);if(typeof z.callback!=="undefined")M.callback=z.callback;if(typeof z.annotations!=="undefined")M.annotations=z.annotations;if(typeof z.enabled!=="undefined")M.enabled=z.enabled;this.sendToolListChanged()}};return this._registeredTools[$]=M,this.setToolRequestHandlers(),this.sendToolListChanged(),M}tool($,...X){if(this._registeredTools[$])throw new Error(`Tool ${$} is already registered`);let Q,J,G,H;if(typeof X[0]==="string")Q=X.shift();if(X.length>1){let z=X[0];if(PQ(z)){if(J=X.shift(),X.length>1&&typeof X[0]==="object"&&X[0]!==null&&!PQ(X[0]))H=X.shift()}else if(typeof z==="object"&&z!==null)H=X.shift()}let M=X[0];return this._createRegisteredTool($,Q,J,G,H,M)}registerTool($,X,Q){if(this._registeredTools[$])throw new Error(`Tool ${$} is already registered`);let{description:J,inputSchema:G,outputSchema:H,annotations:M}=X;return this._createRegisteredTool($,J,G,H,M,Q)}prompt($,...X){if(this._registeredPrompts[$])throw new Error(`Prompt ${$} is already registered`);let Q;if(typeof X[0]==="string")Q=X.shift();let J;if(X.length>1)J=X.shift();let G=X[0],H={description:Q,argsSchema:J===void 0?void 0:B.object(J),callback:G,enabled:!0,disable:()=>H.update({enabled:!1}),enable:()=>H.update({enabled:!0}),remove:()=>H.update({name:null}),update:(M)=>{if(typeof M.name!=="undefined"&&M.name!==$){if(delete this._registeredPrompts[$],M.name)this._registeredPrompts[M.name]=H}if(typeof M.description!=="undefined")H.description=M.description;if(typeof M.argsSchema!=="undefined")H.argsSchema=B.object(M.argsSchema);if(typeof M.callback!=="undefined")H.callback=M.callback;if(typeof M.enabled!=="undefined")H.enabled=M.enabled;this.sendPromptListChanged()}};return this._registeredPrompts[$]=H,this.setPromptRequestHandlers(),this.sendPromptListChanged(),H}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 t9={type:"object"};function PQ($){if(typeof $!=="object"||$===null)return!1;return Object.keys($).length===0||Object.values($).some(s9)}function s9($){return $!==null&&typeof $==="object"&&"parse"in $&&typeof $.parse==="function"&&"safeParse"in $&&typeof $.safeParse==="function"}function e9($){return Object.entries($.shape).map(([X,Q])=>({name:X,description:Q.description,required:!Q.isOptional()}))}function fQ($){return{completion:{values:$.slice(0,100),total:$.length,hasMore:$.length>100}}}var z1={completion:{values:[],hasMore:!1}};function gQ($,X){let Q=process.argv,J=`--${$}=`;for(let G of Q)if(G.startsWith(J))return G.substring(J.length);return X}q4();var QG=y$("FigmaConfig",1),u6=gQ("figma-api-key")||process.env.FIGMA_API_KEY||"",hQ="F2C MCP",yQ=process.env.FIGMA_VERSION||"0.0.1";QG.debug("DEFAULT_PERSONAL_TOKEN",u6);var ZQ=($)=>{};var mQ=($)=>{ZQ($)};var t2=null;async function EG(){if(typeof global!=="undefined"&&global.fetch)return global.fetch;if(typeof globalThis.fetch!=="undefined")return globalThis.fetch;if(!t2)try{t2=await Promise.resolve().then(() => (g7(),f7))}catch($){throw new Error("Neither native fetch nor node-fetch is available. Please install node-fetch or upgrade to Node.js 18+")}return t2.default}async function RG($,X){return(await EG())($,X)}var e4=RG;q4();var T7=y$("F2cApi",1);class x7{f2cHost="https://f2c-figma-api.yy.com/api";personalToken=u6;async nodeToCode($){let X={fileKey:$.fileKey,nodeIds:$.ids,personal_token:$.personalToken||this.personalToken,option:{cssFramework:"inlinecss",imgFormat:$.imgFormat||"png",scaleSize:$.scaleSize||2},format:"files"};if($.format==="react-cssmodules")X.option.cssFramework="cssmodules";else if($.format==="react-tailwind")X.option.cssFramework="tailwindcss";let Q=this.opToUrl(`${this.f2cHost}/nodes`,X);return this.fetch(Q,"json")}async fetch($,X="json"){try{let Q={method:"GET",headers:{"F2c-Api-Platform":"mcp"}};T7.debug("fetch",$);let J=await e4($,Q);if(!J.ok)throw new Error(`HTTP error! status: ${J.status}`);return X==="text"?await J.text():await J.json()}catch(Q){throw T7.error("HTTP error",Q),Q}}opToUrl($,X={}){if(Object.keys(X).length===0)return $;let Q=new URL($);for(let[J,G]of Object.entries(X))if(typeof G==="object"&&G!==null)for(let[H,M]of Object.entries(G))Q.searchParams.append(`${J}[${H}]`,M);else Q.searchParams.append(J,G);return Q.toString()}}var h7=new x7;q4();var vG=y$("FigmaRestApi");class y7{figmaHost="https://api.figma.com/v1";personalToken=u6;async files($){let X;if($.ids)X=this.opToUrl(`${this.figmaHost}/files/${$.fileKey}/nodes`,$);else X=this.opToUrl(`${this.figmaHost}/files/${$.fileKey}`,$);return this.fetch(X)}async images($){let X=this.opToUrl(`${this.figmaHost}/images/${$.fileKey}`,$);return this.fetch(X)}async imageFills($){let X=this.opToUrl(`${this.figmaHost}/files/${$.fileKey}/images`,$);return this.fetch(X)}async meta($){let X=this.opToUrl(`${this.figmaHost}/files/${$.fileKey}/meta`,$);return this.fetch(X)}async fetch($,X="json"){try{let Q={method:"GET",headers:{"X-FIGMA-TOKEN":this.personalToken}},J=await e4($,Q);if(!J.ok)throw new Error(`HTTP error! status: ${J.status}`);return X==="text"?await J.text():await J.json()}catch(Q){throw vG.error("HTTP error",Q),Q}}opToUrl($,X={},Q=["fileKey","personalToken"]){if(Object.keys(X).length===0)return $;if(X.personalToken)this.personalToken=X.personalToken;let J=new URL($);for(let[G,H]of Object.entries(X))if(!Q.includes(G))J.searchParams.append(G,H);return J.toString()}}var Z7=new y7;q4();var V$={};K2(V$,{void:()=>BY,util:()=>o,unknown:()=>wY,union:()=>qY,undefined:()=>YY,tuple:()=>jY,transformer:()=>CY,symbol:()=>GY,string:()=>r7,strictObject:()=>OY,setErrorMap:()=>IG,set:()=>NY,record:()=>KY,quotelessJson:()=>CG,promise:()=>vY,preprocess:()=>bY,pipeline:()=>PY,ostring:()=>fY,optional:()=>kY,onumber:()=>gY,oboolean:()=>TY,objectUtil:()=>s2,object:()=>VY,number:()=>a7,nullable:()=>IY,null:()=>HY,never:()=>zY,nativeEnum:()=>RY,nan:()=>QY,map:()=>UY,makeIssue:()=>s6,literal:()=>FY,lazy:()=>SY,late:()=>$Y,isValid:()=>a0,isDirty:()=>E1,isAsync:()=>X6,isAborted:()=>F1,intersection:()=>AY,instanceof:()=>XY,getParsedType:()=>D0,getErrorMap:()=>$6,function:()=>LY,enum:()=>EY,effect:()=>CY,discriminatedUnion:()=>_Y,defaultErrorMap:()=>I0,datetimeRegex:()=>i7,date:()=>JY,custom:()=>o7,coerce:()=>xY,boolean:()=>t7,bigint:()=>WY,array:()=>DY,any:()=>MY,addIssueToContext:()=>S,ZodVoid:()=>QX,ZodUnknown:()=>t0,ZodUnion:()=>H6,ZodUndefined:()=>G6,ZodType:()=>i,ZodTuple:()=>O0,ZodTransformer:()=>X0,ZodSymbol:()=>XX,ZodString:()=>t$,ZodSet:()=>S4,ZodSchema:()=>i,ZodRecord:()=>WX,ZodReadonly:()=>O6,ZodPromise:()=>F4,ZodPipeline:()=>YX,ZodParsedType:()=>L,ZodOptional:()=>e$,ZodObject:()=>M$,ZodNumber:()=>s0,ZodNullable:()=>P0,ZodNull:()=>Y6,ZodNever:()=>V0,ZodNativeEnum:()=>B6,ZodNaN:()=>GX,ZodMap:()=>JX,ZodLiteral:()=>z6,ZodLazy:()=>w6,ZodIssueCode:()=>K,ZodIntersection:()=>M6,ZodFunction:()=>W6,ZodFirstPartyTypeKind:()=>g,ZodError:()=>R$,ZodEnum:()=>$4,ZodEffects:()=>X0,ZodDiscriminatedUnion:()=>v1,ZodDefault:()=>D6,ZodDate:()=>N4,ZodCatch:()=>V6,ZodBranded:()=>C1,ZodBoolean:()=>J6,ZodBigInt:()=>e0,ZodArray:()=>s$,ZodAny:()=>L4,Schema:()=>i,ParseStatus:()=>q$,OK:()=>j$,NEVER:()=>hY,INVALID:()=>f,EMPTY_PATH:()=>bG,DIRTY:()=>U4,BRAND:()=>eG});var o;(function($){$.assertEqual=(G)=>{};function X(G){}$.assertIs=X;function Q(G){throw new Error}$.assertNever=Q,$.arrayToEnum=(G)=>{let H={};for(let M of G)H[M]=M;return H},$.getValidEnumValues=(G)=>{let H=$.objectKeys(G).filter((z)=>typeof G[G[z]]!=="number"),M={};for(let z of H)M[z]=G[z];return $.objectValues(M)},$.objectValues=(G)=>{return $.objectKeys(G).map(function(H){return G[H]})},$.objectKeys=typeof Object.keys==="function"?(G)=>Object.keys(G):(G)=>{let H=[];for(let M in G)if(Object.prototype.hasOwnProperty.call(G,M))H.push(M);return H},$.find=(G,H)=>{for(let M of G)if(H(M))return M;return},$.isInteger=typeof Number.isInteger==="function"?(G)=>Number.isInteger(G):(G)=>typeof G==="number"&&Number.isFinite(G)&&Math.floor(G)===G;function J(G,H=" | "){return G.map((M)=>typeof M==="string"?`'${M}'`:M).join(H)}$.joinValues=J,$.jsonStringifyReplacer=(G,H)=>{if(typeof H==="bigint")return H.toString();return H}})(o||(o={}));var s2;(function($){$.mergeShapes=(X,Q)=>{return{...X,...Q}}})(s2||(s2={}));var L=o.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),D0=($)=>{switch(typeof $){case"undefined":return L.undefined;case"string":return L.string;case"number":return Number.isNaN($)?L.nan:L.number;case"boolean":return L.boolean;case"function":return L.function;case"bigint":return L.bigint;case"symbol":return L.symbol;case"object":if(Array.isArray($))return L.array;if($===null)return L.null;if($.then&&typeof $.then==="function"&&$.catch&&typeof $.catch==="function")return L.promise;if(typeof Map!=="undefined"&&$ instanceof Map)return L.map;if(typeof Set!=="undefined"&&$ instanceof Set)return L.set;if(typeof Date!=="undefined"&&$ instanceof Date)return L.date;return L.object;default:return L.unknown}};var K=o.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"]),CG=($)=>{return JSON.stringify($,null,2).replace(/"([^"]+)":/g,"$1:")};class R$ 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:[]},J=(G)=>{for(let H of G.issues)if(H.code==="invalid_union")H.unionErrors.map(J);else if(H.code==="invalid_return_type")J(H.returnTypeError);else if(H.code==="invalid_arguments")J(H.argumentsError);else if(H.path.length===0)Q._errors.push(X(H));else{let M=Q,z=0;while(z<H.path.length){let D=H.path[z];if(z!==H.path.length-1)M[D]=M[D]||{_errors:[]};else M[D]=M[D]||{_errors:[]},M[D]._errors.push(X(H));M=M[D],z++}}};return J(this),Q}static assert($){if(!($ instanceof R$))throw new Error(`Not a ZodError: ${$}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,o.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten($=(X)=>X.message){let X={},Q=[];for(let J of this.issues)if(J.path.length>0)X[J.path[0]]=X[J.path[0]]||[],X[J.path[0]].push($(J));else Q.push($(J));return{formErrors:Q,fieldErrors:X}}get formErrors(){return this.flatten()}}R$.create=($)=>{return new R$($)};var kG=($,X)=>{let Q;switch($.code){case K.invalid_type:if($.received===L.undefined)Q="Required";else Q=`Expected ${$.expected}, received ${$.received}`;break;case K.invalid_literal:Q=`Invalid literal value, expected ${JSON.stringify($.expected,o.jsonStringifyReplacer)}`;break;case K.unrecognized_keys:Q=`Unrecognized key(s) in object: ${o.joinValues($.keys,", ")}`;break;case K.invalid_union:Q="Invalid input";break;case K.invalid_union_discriminator:Q=`Invalid discriminator value. Expected ${o.joinValues($.options)}`;break;case K.invalid_enum_value:Q=`Invalid enum value. Expected ${o.joinValues($.options)}, received '${$.received}'`;break;case K.invalid_arguments:Q="Invalid function arguments";break;case K.invalid_return_type:Q="Invalid function return type";break;case K.invalid_date:Q="Invalid date";break;case K.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 o.assertNever($.validation);else if($.validation!=="regex")Q=`Invalid ${$.validation}`;else Q="Invalid";break;case K.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==="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 K.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 K.custom:Q="Invalid input";break;case K.invalid_intersection_types:Q="Intersection results could not be merged";break;case K.not_multiple_of:Q=`Number must be a multiple of ${$.multipleOf}`;break;case K.not_finite:Q="Number must be finite";break;default:Q=X.defaultError,o.assertNever($)}return{message:Q}},I0=kG;var m7=I0;function IG($){m7=$}function $6(){return m7}var s6=($)=>{let{data:X,path:Q,errorMaps:J,issueData:G}=$,H=[...Q,...G.path||[]],M={...G,path:H};if(G.message!==void 0)return{...G,path:H,message:G.message};let z="",D=J.filter((O)=>!!O).slice().reverse();for(let O of D)z=O(M,{data:X,defaultError:z}).message;return{...G,path:H,message:z}},bG=[];function S($,X){let Q=$6(),J=s6({issueData:X,data:$.data,path:$.path,errorMaps:[$.common.contextualErrorMap,$.schemaErrorMap,Q,Q===I0?void 0:I0].filter((G)=>!!G)});$.common.issues.push(J)}class q${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 J of X){if(J.status==="aborted")return f;if(J.status==="dirty")$.dirty();Q.push(J.value)}return{status:$.value,value:Q}}static async mergeObjectAsync($,X){let Q=[];for(let J of X){let G=await J.key,H=await J.value;Q.push({key:G,value:H})}return q$.mergeObjectSync($,Q)}static mergeObjectSync($,X){let Q={};for(let J of X){let{key:G,value:H}=J;if(G.status==="aborted")return f;if(H.status==="aborted")return f;if(G.status==="dirty")$.dirty();if(H.status==="dirty")$.dirty();if(G.value!=="__proto__"&&(typeof H.value!=="undefined"||J.alwaysSet))Q[G.value]=H.value}return{status:$.value,value:Q}}}var f=Object.freeze({status:"aborted"}),U4=($)=>({status:"dirty",value:$}),j$=($)=>({status:"valid",value:$}),F1=($)=>$.status==="aborted",E1=($)=>$.status==="dirty",a0=($)=>$.status==="valid",X6=($)=>typeof Promise!=="undefined"&&$ instanceof Promise;var v;(function($){$.errToObj=(X)=>typeof X==="string"?{message:X}:X||{},$.toString=(X)=>typeof X==="string"?X:X?.message})(v||(v={}));var R1=function($,X,Q,J){if(Q==="a"&&!J)throw new TypeError("Private accessor was defined without a getter");if(typeof X==="function"?$!==X||!J:!X.has($))throw new TypeError("Cannot read private member from an object whose class did not declare it");return Q==="m"?J:Q==="a"?J.call($):J?J.value:X.get($)},u7=function($,X,Q,J,G){if(J==="m")throw new TypeError("Private method is not writable");if(J==="a"&&!G)throw new TypeError("Private accessor was defined without a setter");if(typeof X==="function"?$!==X||!G:!X.has($))throw new TypeError("Cannot write private member to an object whose class did not declare it");return J==="a"?G.call($,Q):G?G.value=Q:X.set($,Q),Q},e6,$X;class $0{constructor($,X,Q,J){this._cachedPath=[],this.parent=$,this.data=X,this._path=Q,this._key=J}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}}var l7=($,X)=>{if(a0(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 R$($.common.issues);return this._error=Q,this._error}}}};function p($){if(!$)return{};let{errorMap:X,invalid_type_error:Q,required_error:J,description:G}=$;if(X&&(Q||J))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:(M,z)=>{let{message:D}=$;if(M.code==="invalid_enum_value")return{message:D??z.defaultError};if(typeof z.data==="undefined")return{message:D??J??z.defaultError};if(M.code!=="invalid_type")return{message:z.defaultError};return{message:D??Q??z.defaultError}},description:G}}class i{get description(){return this._def.description}_getType($){return D0($.data)}_getOrReturnCtx($,X){return X||{common:$.parent.common,data:$.data,parsedType:D0($.data),schemaErrorMap:this._def.errorMap,path:$.path,parent:$.parent}}_processInputParams($){return{status:new q$,ctx:{common:$.parent.common,data:$.data,parsedType:D0($.data),schemaErrorMap:this._def.errorMap,path:$.path,parent:$.parent}}}_parseSync($){let X=this._parse($);if(X6(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:D0($)},J=this._parseSync({data:$,path:Q.path,parent:Q});return l7(Q,J)}"~validate"($){let X={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:$,parsedType:D0($)};if(!this["~standard"].async)try{let Q=this._parseSync({data:$,path:[],parent:X});return a0(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)=>a0(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:D0($)},J=this._parse({data:$,path:Q.path,parent:Q}),G=await(X6(J)?J:Promise.resolve(J));return l7(Q,G)}refine($,X){let Q=(J)=>{if(typeof X==="string"||typeof X==="undefined")return{message:X};else if(typeof X==="function")return X(J);else return X};return this._refinement((J,G)=>{let H=$(J),M=()=>G.addIssue({code:K.custom,...Q(J)});if(typeof Promise!=="undefined"&&H instanceof Promise)return H.then((z)=>{if(!z)return M(),!1;else return!0});if(!H)return M(),!1;else return!0})}refinement($,X){return this._refinement((Q,J)=>{if(!$(Q))return J.addIssue(typeof X==="function"?X(Q,J):X),!1;else return!0})}_refinement($){return new X0({schema:this,typeName:g.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 e$.create(this,this._def)}nullable(){return P0.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return s$.create(this)}promise(){return F4.create(this,this._def)}or($){return H6.create([this,$],this._def)}and($){return M6.create(this,$,this._def)}transform($){return new X0({...p(this._def),schema:this,typeName:g.ZodEffects,effect:{type:"transform",transform:$}})}default($){let X=typeof $==="function"?$:()=>$;return new D6({...p(this._def),innerType:this,defaultValue:X,typeName:g.ZodDefault})}brand(){return new C1({typeName:g.ZodBranded,type:this,...p(this._def)})}catch($){let X=typeof $==="function"?$:()=>$;return new V6({...p(this._def),innerType:this,catchValue:X,typeName:g.ZodCatch})}describe($){return new this.constructor({...this._def,description:$})}pipe($){return YX.create(this,$)}readonly(){return O6.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}var PG=/^c[^\s-]{8,}$/i,fG=/^[0-9a-z]+$/,gG=/^[0-9A-HJKMNP-TV-Z]{26}$/i,TG=/^[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,xG=/^[a-z0-9_-]{21}$/i,hG=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,yG=/^[-+]?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)?)??$/,ZG=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,mG="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",e2,lG=/^(?:(?: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])$/,cG=/^(?:(?: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])$/,uG=/^(([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]))$/,pG=/^(([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])$/,nG=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,iG=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,p7="((\\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])))",dG=new RegExp(`^${p7}$`);function n7($){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 oG($){return new RegExp(`^${n7($)}$`)}function i7($){let X=`${p7}T${n7($)}`,Q=[];if(Q.push($.local?"Z?":"Z"),$.offset)Q.push("([+-]\\d{2}:?\\d{2})");return X=`${X}(${Q.join("|")})`,new RegExp(`^${X}$`)}function rG($,X){if((X==="v4"||!X)&&lG.test($))return!0;if((X==="v6"||!X)&&uG.test($))return!0;return!1}function aG($,X){if(!hG.test($))return!1;try{let[Q]=$.split("."),J=Q.replace(/-/g,"+").replace(/_/g,"/").padEnd(Q.length+(4-Q.length%4)%4,"="),G=JSON.parse(atob(J));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 tG($,X){if((X==="v4"||!X)&&cG.test($))return!0;if((X==="v6"||!X)&&pG.test($))return!0;return!1}class t$ extends i{_parse($){if(this._def.coerce)$.data=String($.data);if(this._getType($)!==L.string){let G=this._getOrReturnCtx($);return S(G,{code:K.invalid_type,expected:L.string,received:G.parsedType}),f}let Q=new q$,J=void 0;for(let G of this._def.checks)if(G.kind==="min"){if($.data.length<G.value)J=this._getOrReturnCtx($,J),S(J,{code:K.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)J=this._getOrReturnCtx($,J),S(J,{code:K.too_big,maximum:G.value,type:"string",inclusive:!0,exact:!1,message:G.message}),Q.dirty()}else if(G.kind==="length"){let H=$.data.length>G.value,M=$.data.length<G.value;if(H||M){if(J=this._getOrReturnCtx($,J),H)S(J,{code:K.too_big,maximum:G.value,type:"string",inclusive:!0,exact:!0,message:G.message});else if(M)S(J,{code:K.too_small,minimum:G.value,type:"string",inclusive:!0,exact:!0,message:G.message});Q.dirty()}}else if(G.kind==="email"){if(!ZG.test($.data))J=this._getOrReturnCtx($,J),S(J,{validation:"email",code:K.invalid_string,message:G.message}),Q.dirty()}else if(G.kind==="emoji"){if(!e2)e2=new RegExp(mG,"u");if(!e2.test($.data))J=this._getOrReturnCtx($,J),S(J,{validation:"emoji",code:K.invalid_string,message:G.message}),Q.dirty()}else if(G.kind==="uuid"){if(!TG.test($.data))J=this._getOrReturnCtx($,J),S(J,{validation:"uuid",code:K.invalid_string,message:G.message}),Q.dirty()}else if(G.kind==="nanoid"){if(!xG.test($.data))J=this._getOrReturnCtx($,J),S(J,{validation:"nanoid",code:K.invalid_string,message:G.message}),Q.dirty()}else if(G.kind==="cuid"){if(!PG.test($.data))J=this._getOrReturnCtx($,J),S(J,{validation:"cuid",code:K.invalid_string,message:G.message}),Q.dirty()}else if(G.kind==="cuid2"){if(!fG.test($.data))J=this._getOrReturnCtx($,J),S(J,{validation:"cuid2",code:K.invalid_string,message:G.message}),Q.dirty()}else if(G.kind==="ulid"){if(!gG.test($.data))J=this._getOrReturnCtx($,J),S(J,{validation:"ulid",code:K.invalid_string,message:G.message}),Q.dirty()}else if(G.kind==="url")try{new URL($.data)}catch{J=this._getOrReturnCtx($,J),S(J,{validation:"url",code:K.invalid_string,message:G.message}),Q.dirty()}else if(G.kind==="regex"){if(G.regex.lastIndex=0,!G.regex.test($.data))J=this._getOrReturnCtx($,J),S(J,{validation:"regex",code:K.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))J=this._getOrReturnCtx($,J),S(J,{code:K.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))J=this._getOrReturnCtx($,J),S(J,{code:K.invalid_string,validation:{startsWith:G.value},message:G.message}),Q.dirty()}else if(G.kind==="endsWith"){if(!$.data.endsWith(G.value))J=this._getOrReturnCtx($,J),S(J,{code:K.invalid_string,validation:{endsWith:G.value},message:G.message}),Q.dirty()}else if(G.kind==="datetime"){if(!i7(G).test($.data))J=this._getOrReturnCtx($,J),S(J,{code:K.invalid_string,validation:"datetime",message:G.message}),Q.dirty()}else if(G.kind==="date"){if(!dG.test($.data))J=this._getOrReturnCtx($,J),S(J,{code:K.invalid_string,validation:"date",message:G.message}),Q.dirty()}else if(G.kind==="time"){if(!oG(G).test($.data))J=this._getOrReturnCtx($,J),S(J,{code:K.invalid_string,validation:"time",message:G.message}),Q.dirty()}else if(G.kind==="duration"){if(!yG.test($.data))J=this._getOrReturnCtx($,J),S(J,{validation:"duration",code:K.invalid_string,message:G.message}),Q.dirty()}else if(G.kind==="ip"){if(!rG($.data,G.version))J=this._getOrReturnCtx($,J),S(J,{validation:"ip",code:K.invalid_string,message:G.message}),Q.dirty()}else if(G.kind==="jwt"){if(!aG($.data,G.alg))J=this._getOrReturnCtx($,J),S(J,{validation:"jwt",code:K.invalid_string,message:G.message}),Q.dirty()}else if(G.kind==="cidr"){if(!tG($.data,G.version))J=this._getOrReturnCtx($,J),S(J,{validation:"cidr",code:K.invalid_string,message:G.message}),Q.dirty()}else if(G.kind==="base64"){if(!nG.test($.data))J=this._getOrReturnCtx($,J),S(J,{validation:"base64",code:K.invalid_string,message:G.message}),Q.dirty()}else if(G.kind==="base64url"){if(!iG.test($.data))J=this._getOrReturnCtx($,J),S(J,{validation:"base64url",code:K.invalid_string,message:G.message}),Q.dirty()}else o.assertNever(G);return{status:Q.value,value:$.data}}_regex($,X,Q){return this.refinement((J)=>$.test(J),{validation:X,code:K.invalid_string,...v.errToObj(Q)})}_addCheck($){return new t$({...this._def,checks:[...this._def.checks,$]})}email($){return this._addCheck({kind:"email",...v.errToObj($)})}url($){return this._addCheck({kind:"url",...v.errToObj($)})}emoji($){return this._addCheck({kind:"emoji",...v.errToObj($)})}uuid($){return this._addCheck({kind:"uuid",...v.errToObj($)})}nanoid($){return this._addCheck({kind:"nanoid",...v.errToObj($)})}cuid($){return this._addCheck({kind:"cuid",...v.errToObj($)})}cuid2($){return this._addCheck({kind:"cuid2",...v.errToObj($)})}ulid($){return this._addCheck({kind:"ulid",...v.errToObj($)})}base64($){return this._addCheck({kind:"base64",...v.errToObj($)})}base64url($){return this._addCheck({kind:"base64url",...v.errToObj($)})}jwt($){return this._addCheck({kind:"jwt",...v.errToObj($)})}ip($){return this._addCheck({kind:"ip",...v.errToObj($)})}cidr($){return this._addCheck({kind:"cidr",...v.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,...v.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,...v.errToObj($?.message)})}duration($){return this._addCheck({kind:"duration",...v.errToObj($)})}regex($,X){return this._addCheck({kind:"regex",regex:$,...v.errToObj(X)})}includes($,X){return this._addCheck({kind:"includes",value:$,position:X?.position,...v.errToObj(X?.message)})}startsWith($,X){return this._addCheck({kind:"startsWith",value:$,...v.errToObj(X)})}endsWith($,X){return this._addCheck({kind:"endsWith",value:$,...v.errToObj(X)})}min($,X){return this._addCheck({kind:"min",value:$,...v.errToObj(X)})}max($,X){return this._addCheck({kind:"max",value:$,...v.errToObj(X)})}length($,X){return this._addCheck({kind:"length",value:$,...v.errToObj(X)})}nonempty($){return this.min(1,v.errToObj($))}trim(){return new t$({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new t$({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new t$({...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 $}}t$.create=($)=>{return new t$({checks:[],typeName:g.ZodString,coerce:$?.coerce??!1,...p($)})};function sG($,X){let Q=($.toString().split(".")[1]||"").length,J=(X.toString().split(".")[1]||"").length,G=Q>J?Q:J,H=Number.parseInt($.toFixed(G).replace(".","")),M=Number.parseInt(X.toFixed(G).replace(".",""));return H%M/10**G}class s0 extends i{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($)!==L.number){let G=this._getOrReturnCtx($);return S(G,{code:K.invalid_type,expected:L.number,received:G.parsedType}),f}let Q=void 0,J=new q$;for(let G of this._def.checks)if(G.kind==="int"){if(!o.isInteger($.data))Q=this._getOrReturnCtx($,Q),S(Q,{code:K.invalid_type,expected:"integer",received:"float",message:G.message}),J.dirty()}else if(G.kind==="min"){if(G.inclusive?$.data<G.value:$.data<=G.value)Q=this._getOrReturnCtx($,Q),S(Q,{code:K.too_small,minimum:G.value,type:"number",inclusive:G.inclusive,exact:!1,message:G.message}),J.dirty()}else if(G.kind==="max"){if(G.inclusive?$.data>G.value:$.data>=G.value)Q=this._getOrReturnCtx($,Q),S(Q,{code:K.too_big,maximum:G.value,type:"number",inclusive:G.inclusive,exact:!1,message:G.message}),J.dirty()}else if(G.kind==="multipleOf"){if(sG($.data,G.value)!==0)Q=this._getOrReturnCtx($,Q),S(Q,{code:K.not_multiple_of,multipleOf:G.value,message:G.message}),J.dirty()}else if(G.kind==="finite"){if(!Number.isFinite($.data))Q=this._getOrReturnCtx($,Q),S(Q,{code:K.not_finite,message:G.message}),J.dirty()}else o.assertNever(G);return{status:J.value,value:$.data}}gte($,X){return this.setLimit("min",$,!0,v.toString(X))}gt($,X){return this.setLimit("min",$,!1,v.toString(X))}lte($,X){return this.setLimit("max",$,!0,v.toString(X))}lt($,X){return this.setLimit("max",$,!1,v.toString(X))}setLimit($,X,Q,J){return new s0({...this._def,checks:[...this._def.checks,{kind:$,value:X,inclusive:Q,message:v.toString(J)}]})}_addCheck($){return new s0({...this._def,checks:[...this._def.checks,$]})}int($){return this._addCheck({kind:"int",message:v.toString($)})}positive($){return this._addCheck({kind:"min",value:0,inclusive:!1,message:v.toString($)})}negative($){return this._addCheck({kind:"max",value:0,inclusive:!1,message:v.toString($)})}nonpositive($){return this._addCheck({kind:"max",value:0,inclusive:!0,message:v.toString($)})}nonnegative($){return this._addCheck({kind:"min",value:0,inclusive:!0,message:v.toString($)})}multipleOf($,X){return this._addCheck({kind:"multipleOf",value:$,message:v.toString(X)})}finite($){return this._addCheck({kind:"finite",message:v.toString($)})}safe($){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:v.toString($)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:v.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"&&o.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($)}}s0.create=($)=>{return new s0({checks:[],typeName:g.ZodNumber,coerce:$?.coerce||!1,...p($)})};class e0 extends i{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($)!==L.bigint)return this._getInvalidInput($);let Q=void 0,J=new q$;for(let G of this._def.checks)if(G.kind==="min"){if(G.inclusive?$.data<G.value:$.data<=G.value)Q=this._getOrReturnCtx($,Q),S(Q,{code:K.too_small,type:"bigint",minimum:G.value,inclusive:G.inclusive,message:G.message}),J.dirty()}else if(G.kind==="max"){if(G.inclusive?$.data>G.value:$.data>=G.value)Q=this._getOrReturnCtx($,Q),S(Q,{code:K.too_big,type:"bigint",maximum:G.value,inclusive:G.inclusive,message:G.message}),J.dirty()}else if(G.kind==="multipleOf"){if($.data%G.value!==BigInt(0))Q=this._getOrReturnCtx($,Q),S(Q,{code:K.not_multiple_of,multipleOf:G.value,message:G.message}),J.dirty()}else o.assertNever(G);return{status:J.value,value:$.data}}_getInvalidInput($){let X=this._getOrReturnCtx($);return S(X,{code:K.invalid_type,expected:L.bigint,received:X.parsedType}),f}gte($,X){return this.setLimit("min",$,!0,v.toString(X))}gt($,X){return this.setLimit("min",$,!1,v.toString(X))}lte($,X){return this.setLimit("max",$,!0,v.toString(X))}lt($,X){return this.setLimit("max",$,!1,v.toString(X))}setLimit($,X,Q,J){return new e0({...this._def,checks:[...this._def.checks,{kind:$,value:X,inclusive:Q,message:v.toString(J)}]})}_addCheck($){return new e0({...this._def,checks:[...this._def.checks,$]})}positive($){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:v.toString($)})}negative($){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:v.toString($)})}nonpositive($){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:v.toString($)})}nonnegative($){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:v.toString($)})}multipleOf($,X){return this._addCheck({kind:"multipleOf",value:$,message:v.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 $}}e0.create=($)=>{return new e0({checks:[],typeName:g.ZodBigInt,coerce:$?.coerce??!1,...p($)})};class J6 extends i{_parse($){if(this._def.coerce)$.data=Boolean($.data);if(this._getType($)!==L.boolean){let Q=this._getOrReturnCtx($);return S(Q,{code:K.invalid_type,expected:L.boolean,received:Q.parsedType}),f}return j$($.data)}}J6.create=($)=>{return new J6({typeName:g.ZodBoolean,coerce:$?.coerce||!1,...p($)})};class N4 extends i{_parse($){if(this._def.coerce)$.data=new Date($.data);if(this._getType($)!==L.date){let G=this._getOrReturnCtx($);return S(G,{code:K.invalid_type,expected:L.date,received:G.parsedType}),f}if(Number.isNaN($.data.getTime())){let G=this._getOrReturnCtx($);return S(G,{code:K.invalid_date}),f}let Q=new q$,J=void 0;for(let G of this._def.checks)if(G.kind==="min"){if($.data.getTime()<G.value)J=this._getOrReturnCtx($,J),S(J,{code:K.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)J=this._getOrReturnCtx($,J),S(J,{code:K.too_big,message:G.message,inclusive:!0,exact:!1,maximum:G.value,type:"date"}),Q.dirty()}else o.assertNever(G);return{status:Q.value,value:new Date($.data.getTime())}}_addCheck($){return new N4({...this._def,checks:[...this._def.checks,$]})}min($,X){return this._addCheck({kind:"min",value:$.getTime(),message:v.toString(X)})}max($,X){return this._addCheck({kind:"max",value:$.getTime(),message:v.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}}N4.create=($)=>{return new N4({checks:[],coerce:$?.coerce||!1,typeName:g.ZodDate,...p($)})};class XX extends i{_parse($){if(this._getType($)!==L.symbol){let Q=this._getOrReturnCtx($);return S(Q,{code:K.invalid_type,expected:L.symbol,received:Q.parsedType}),f}return j$($.data)}}XX.create=($)=>{return new XX({typeName:g.ZodSymbol,...p($)})};class G6 extends i{_parse($){if(this._getType($)!==L.undefined){let Q=this._getOrReturnCtx($);return S(Q,{code:K.invalid_type,expected:L.undefined,received:Q.parsedType}),f}return j$($.data)}}G6.create=($)=>{return new G6({typeName:g.ZodUndefined,...p($)})};class Y6 extends i{_parse($){if(this._getType($)!==L.null){let Q=this._getOrReturnCtx($);return S(Q,{code:K.invalid_type,expected:L.null,received:Q.parsedType}),f}return j$($.data)}}Y6.create=($)=>{return new Y6({typeName:g.ZodNull,...p($)})};class L4 extends i{constructor(){super(...arguments);this._any=!0}_parse($){return j$($.data)}}L4.create=($)=>{return new L4({typeName:g.ZodAny,...p($)})};class t0 extends i{constructor(){super(...arguments);this._unknown=!0}_parse($){return j$($.data)}}t0.create=($)=>{return new t0({typeName:g.ZodUnknown,...p($)})};class V0 extends i{_parse($){let X=this._getOrReturnCtx($);return S(X,{code:K.invalid_type,expected:L.never,received:X.parsedType}),f}}V0.create=($)=>{return new V0({typeName:g.ZodNever,...p($)})};class QX extends i{_parse($){if(this._getType($)!==L.undefined){let Q=this._getOrReturnCtx($);return S(Q,{code:K.invalid_type,expected:L.void,received:Q.parsedType}),f}return j$($.data)}}QX.create=($)=>{return new QX({typeName:g.ZodVoid,...p($)})};class s$ extends i{_parse($){let{ctx:X,status:Q}=this._processInputParams($),J=this._def;if(X.parsedType!==L.array)return S(X,{code:K.invalid_type,expected:L.array,received:X.parsedType}),f;if(J.exactLength!==null){let H=X.data.length>J.exactLength.value,M=X.data.length<J.exactLength.value;if(H||M)S(X,{code:H?K.too_big:K.too_small,minimum:M?J.exactLength.value:void 0,maximum:H?J.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:J.exactLength.message}),Q.dirty()}if(J.minLength!==null){if(X.data.length<J.minLength.value)S(X,{code:K.too_small,minimum:J.minLength.value,type:"array",inclusive:!0,exact:!1,message:J.minLength.message}),Q.dirty()}if(J.maxLength!==null){if(X.data.length>J.maxLength.value)S(X,{code:K.too_big,maximum:J.maxLength.value,type:"array",inclusive:!0,exact:!1,message:J.maxLength.message}),Q.dirty()}if(X.common.async)return Promise.all([...X.data].map((H,M)=>{return J.type._parseAsync(new $0(X,H,X.path,M))})).then((H)=>{return q$.mergeArray(Q,H)});let G=[...X.data].map((H,M)=>{return J.type._parseSync(new $0(X,H,X.path,M))});return q$.mergeArray(Q,G)}get element(){return this._def.type}min($,X){return new s$({...this._def,minLength:{value:$,message:v.toString(X)}})}max($,X){return new s$({...this._def,maxLength:{value:$,message:v.toString(X)}})}length($,X){return new s$({...this._def,exactLength:{value:$,message:v.toString(X)}})}nonempty($){return this.min(1,$)}}s$.create=($,X)=>{return new s$({type:$,minLength:null,maxLength:null,exactLength:null,typeName:g.ZodArray,...p(X)})};function Q6($){if($ instanceof M$){let X={};for(let Q in $.shape){let J=$.shape[Q];X[Q]=e$.create(Q6(J))}return new M$({...$._def,shape:()=>X})}else if($ instanceof s$)return new s$({...$._def,type:Q6($.element)});else if($ instanceof e$)return e$.create(Q6($.unwrap()));else if($ instanceof P0)return P0.create(Q6($.unwrap()));else if($ instanceof O0)return O0.create($.items.map((X)=>Q6(X)));else return $}class M$ 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 $=this._def.shape(),X=o.objectKeys($);return this._cached={shape:$,keys:X},this._cached}_parse($){if(this._getType($)!==L.object){let D=this._getOrReturnCtx($);return S(D,{code:K.invalid_type,expected:L.object,received:D.parsedType}),f}let{status:Q,ctx:J}=this._processInputParams($),{shape:G,keys:H}=this._getCached(),M=[];if(!(this._def.catchall instanceof V0&&this._def.unknownKeys==="strip")){for(let D in J.data)if(!H.includes(D))M.push(D)}let z=[];for(let D of H){let O=G[D],_=J.data[D];z.push({key:{status:"valid",value:D},value:O._parse(new $0(J,_,J.path,D)),alwaysSet:D in J.data})}if(this._def.catchall instanceof V0){let D=this._def.unknownKeys;if(D==="passthrough")for(let O of M)z.push({key:{status:"valid",value:O},value:{status:"valid",value:J.data[O]}});else if(D==="strict"){if(M.length>0)S(J,{code:K.unrecognized_keys,keys:M}),Q.dirty()}else if(D==="strip");else throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let D=this._def.catchall;for(let O of M){let _=J.data[O];z.push({key:{status:"valid",value:O},value:D._parse(new $0(J,_,J.path,O)),alwaysSet:O in J.data})}}if(J.common.async)return Promise.resolve().then(async()=>{let D=[];for(let O of z){let _=await O.key,m=await O.value;D.push({key:_,value:m,alwaysSet:O.alwaysSet})}return D}).then((D)=>{return q$.mergeObjectSync(Q,D)});else return q$.mergeObjectSync(Q,z)}get shape(){return this._def.shape()}strict($){return v.errToObj,new M$({...this._def,unknownKeys:"strict",...$!==void 0?{errorMap:(X,Q)=>{let J=this._def.errorMap?.(X,Q).message??Q.defaultError;if(X.code==="unrecognized_keys")return{message:v.errToObj($).message??J};return{message:J}}}:{}})}strip(){return new M$({...this._def,unknownKeys:"strip"})}passthrough(){return new M$({...this._def,unknownKeys:"passthrough"})}extend($){return new M$({...this._def,shape:()=>({...this._def.shape(),...$})})}merge($){return new M$({unknownKeys:$._def.unknownKeys,catchall:$._def.catchall,shape:()=>({...this._def.shape(),...$._def.shape()}),typeName:g.ZodObject})}setKey($,X){return this.augment({[$]:X})}catchall($){return new M$({...this._def,catchall:$})}pick($){let X={};for(let Q of o.objectKeys($))if($[Q]&&this.shape[Q])X[Q]=this.shape[Q];return new M$({...this._def,shape:()=>X})}omit($){let X={};for(let Q of o.objectKeys(this.shape))if(!$[Q])X[Q]=this.shape[Q];return new M$({...this._def,shape:()=>X})}deepPartial(){return Q6(this)}partial($){let X={};for(let Q of o.objectKeys(this.shape)){let J=this.shape[Q];if($&&!$[Q])X[Q]=J;else X[Q]=J.optional()}return new M$({...this._def,shape:()=>X})}required($){let X={};for(let Q of o.objectKeys(this.shape))if($&&!$[Q])X[Q]=this.shape[Q];else{let G=this.shape[Q];while(G instanceof e$)G=G._def.innerType;X[Q]=G}return new M$({...this._def,shape:()=>X})}keyof(){return d7(o.objectKeys(this.shape))}}M$.create=($,X)=>{return new M$({shape:()=>$,unknownKeys:"strip",catchall:V0.create(),typeName:g.ZodObject,...p(X)})};M$.strictCreate=($,X)=>{return new M$({shape:()=>$,unknownKeys:"strict",catchall:V0.create(),typeName:g.ZodObject,...p(X)})};M$.lazycreate=($,X)=>{return new M$({shape:$,unknownKeys:"strip",catchall:V0.create(),typeName:g.ZodObject,...p(X)})};class H6 extends i{_parse($){let{ctx:X}=this._processInputParams($),Q=this._def.options;function J(G){for(let M of G)if(M.result.status==="valid")return M.result;for(let M of G)if(M.result.status==="dirty")return X.common.issues.push(...M.ctx.common.issues),M.result;let H=G.map((M)=>new R$(M.ctx.common.issues));return S(X,{code:K.invalid_union,unionErrors:H}),f}if(X.common.async)return Promise.all(Q.map(async(G)=>{let H={...X,common:{...X.common,issues:[]},parent:null};return{result:await G._parseAsync({data:X.data,path:X.path,parent:H}),ctx:H}})).then(J);else{let G=void 0,H=[];for(let z of Q){let D={...X,common:{...X.common,issues:[]},parent:null},O=z._parseSync({data:X.data,path:X.path,parent:D});if(O.status==="valid")return O;else if(O.status==="dirty"&&!G)G={result:O,ctx:D};if(D.common.issues.length)H.push(D.common.issues)}if(G)return X.common.issues.push(...G.ctx.common.issues),G.result;let M=H.map((z)=>new R$(z));return S(X,{code:K.invalid_union,unionErrors:M}),f}}get options(){return this._def.options}}H6.create=($,X)=>{return new H6({options:$,typeName:g.ZodUnion,...p(X)})};var b0=($)=>{if($ instanceof w6)return b0($.schema);else if($ instanceof X0)return b0($.innerType());else if($ instanceof z6)return[$.value];else if($ instanceof $4)return $.options;else if($ instanceof B6)return o.objectValues($.enum);else if($ instanceof D6)return b0($._def.innerType);else if($ instanceof G6)return[void 0];else if($ instanceof Y6)return[null];else if($ instanceof e$)return[void 0,...b0($.unwrap())];else if($ instanceof P0)return[null,...b0($.unwrap())];else if($ instanceof C1)return b0($.unwrap());else if($ instanceof O6)return b0($.unwrap());else if($ instanceof V6)return b0($._def.innerType);else return[]};class v1 extends i{_parse($){let{ctx:X}=this._processInputParams($);if(X.parsedType!==L.object)return S(X,{code:K.invalid_type,expected:L.object,received:X.parsedType}),f;let Q=this.discriminator,J=X.data[Q],G=this.optionsMap.get(J);if(!G)return S(X,{code:K.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[Q]}),f;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 J=new Map;for(let G of X){let H=b0(G.shape[$]);if(!H.length)throw new Error(`A discriminator value for key \`${$}\` could not be extracted from all schema options`);for(let M of H){if(J.has(M))throw new Error(`Discriminator property ${String($)} has duplicate value ${String(M)}`);J.set(M,G)}}return new v1({typeName:g.ZodDiscriminatedUnion,discriminator:$,options:X,optionsMap:J,...p(Q)})}}function $8($,X){let Q=D0($),J=D0(X);if($===X)return{valid:!0,data:$};else if(Q===L.object&&J===L.object){let G=o.objectKeys(X),H=o.objectKeys($).filter((z)=>G.indexOf(z)!==-1),M={...$,...X};for(let z of H){let D=$8($[z],X[z]);if(!D.valid)return{valid:!1};M[z]=D.data}return{valid:!0,data:M}}else if(Q===L.array&&J===L.array){if($.length!==X.length)return{valid:!1};let G=[];for(let H=0;H<$.length;H++){let M=$[H],z=X[H],D=$8(M,z);if(!D.valid)return{valid:!1};G.push(D.data)}return{valid:!0,data:G}}else if(Q===L.date&&J===L.date&&+$===+X)return{valid:!0,data:$};else return{valid:!1}}class M6 extends i{_parse($){let{status:X,ctx:Q}=this._processInputParams($),J=(G,H)=>{if(F1(G)||F1(H))return f;let M=$8(G.value,H.value);if(!M.valid)return S(Q,{code:K.invalid_intersection_types}),f;if(E1(G)||E1(H))X.dirty();return{status:X.value,value:M.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,H])=>J(G,H));else return J(this._def.left._parseSync({data:Q.data,path:Q.path,parent:Q}),this._def.right._parseSync({data:Q.data,path:Q.path,parent:Q}))}}M6.create=($,X,Q)=>{return new M6({left:$,right:X,typeName:g.ZodIntersection,...p(Q)})};class O0 extends i{_parse($){let{status:X,ctx:Q}=this._processInputParams($);if(Q.parsedType!==L.array)return S(Q,{code:K.invalid_type,expected:L.array,received:Q.parsedType}),f;if(Q.data.length<this._def.items.length)return S(Q,{code:K.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),f;if(!this._def.rest&&Q.data.length>this._def.items.length)S(Q,{code:K.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),X.dirty();let G=[...Q.data].map((H,M)=>{let z=this._def.items[M]||this._def.rest;if(!z)return null;return z._parse(new $0(Q,H,Q.path,M))}).filter((H)=>!!H);if(Q.common.async)return Promise.all(G).then((H)=>{return q$.mergeArray(X,H)});else return q$.mergeArray(X,G)}get items(){return this._def.items}rest($){return new O0({...this._def,rest:$})}}O0.create=($,X)=>{if(!Array.isArray($))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new O0({items:$,typeName:g.ZodTuple,rest:null,...p(X)})};class WX extends i{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse($){let{status:X,ctx:Q}=this._processInputParams($);if(Q.parsedType!==L.object)return S(Q,{code:K.invalid_type,expected:L.object,received:Q.parsedType}),f;let J=[],G=this._def.keyType,H=this._def.valueType;for(let M in Q.data)J.push({key:G._parse(new $0(Q,M,Q.path,M)),value:H._parse(new $0(Q,Q.data[M],Q.path,M)),alwaysSet:M in Q.data});if(Q.common.async)return q$.mergeObjectAsync(X,J);else return q$.mergeObjectSync(X,J)}get element(){return this._def.valueType}static create($,X,Q){if(X instanceof i)return new WX({keyType:$,valueType:X,typeName:g.ZodRecord,...p(Q)});return new WX({keyType:t$.create(),valueType:$,typeName:g.ZodRecord,...p(X)})}}class JX extends i{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse($){let{status:X,ctx:Q}=this._processInputParams($);if(Q.parsedType!==L.map)return S(Q,{code:K.invalid_type,expected:L.map,received:Q.parsedType}),f;let J=this._def.keyType,G=this._def.valueType,H=[...Q.data.entries()].map(([M,z],D)=>{return{key:J._parse(new $0(Q,M,Q.path,[D,"key"])),value:G._parse(new $0(Q,z,Q.path,[D,"value"]))}});if(Q.common.async){let M=new Map;return Promise.resolve().then(async()=>{for(let z of H){let D=await z.key,O=await z.value;if(D.status==="aborted"||O.status==="aborted")return f;if(D.status==="dirty"||O.status==="dirty")X.dirty();M.set(D.value,O.value)}return{status:X.value,value:M}})}else{let M=new Map;for(let z of H){let{key:D,value:O}=z;if(D.status==="aborted"||O.status==="aborted")return f;if(D.status==="dirty"||O.status==="dirty")X.dirty();M.set(D.value,O.value)}return{status:X.value,value:M}}}}JX.create=($,X,Q)=>{return new JX({valueType:X,keyType:$,typeName:g.ZodMap,...p(Q)})};class S4 extends i{_parse($){let{status:X,ctx:Q}=this._processInputParams($);if(Q.parsedType!==L.set)return S(Q,{code:K.invalid_type,expected:L.set,received:Q.parsedType}),f;let J=this._def;if(J.minSize!==null){if(Q.data.size<J.minSize.value)S(Q,{code:K.too_small,minimum:J.minSize.value,type:"set",inclusive:!0,exact:!1,message:J.minSize.message}),X.dirty()}if(J.maxSize!==null){if(Q.data.size>J.maxSize.value)S(Q,{code:K.too_big,maximum:J.maxSize.value,type:"set",inclusive:!0,exact:!1,message:J.maxSize.message}),X.dirty()}let G=this._def.valueType;function H(z){let D=new Set;for(let O of z){if(O.status==="aborted")return f;if(O.status==="dirty")X.dirty();D.add(O.value)}return{status:X.value,value:D}}let M=[...Q.data.values()].map((z,D)=>G._parse(new $0(Q,z,Q.path,D)));if(Q.common.async)return Promise.all(M).then((z)=>H(z));else return H(M)}min($,X){return new S4({...this._def,minSize:{value:$,message:v.toString(X)}})}max($,X){return new S4({...this._def,maxSize:{value:$,message:v.toString(X)}})}size($,X){return this.min($,X).max($,X)}nonempty($){return this.min(1,$)}}S4.create=($,X)=>{return new S4({valueType:$,minSize:null,maxSize:null,typeName:g.ZodSet,...p(X)})};class W6 extends i{constructor(){super(...arguments);this.validate=this.implement}_parse($){let{ctx:X}=this._processInputParams($);if(X.parsedType!==L.function)return S(X,{code:K.invalid_type,expected:L.function,received:X.parsedType}),f;function Q(M,z){return s6({data:M,path:X.path,errorMaps:[X.common.contextualErrorMap,X.schemaErrorMap,$6(),I0].filter((D)=>!!D),issueData:{code:K.invalid_arguments,argumentsError:z}})}function J(M,z){return s6({data:M,path:X.path,errorMaps:[X.common.contextualErrorMap,X.schemaErrorMap,$6(),I0].filter((D)=>!!D),issueData:{code:K.invalid_return_type,returnTypeError:z}})}let G={errorMap:X.common.contextualErrorMap},H=X.data;if(this._def.returns instanceof F4){let M=this;return j$(async function(...z){let D=new R$([]),O=await M._def.args.parseAsync(z,G).catch((x)=>{throw D.addIssue(Q(z,x)),D}),_=await Reflect.apply(H,this,O);return await M._def.returns._def.type.parseAsync(_,G).catch((x)=>{throw D.addIssue(J(_,x)),D})})}else{let M=this;return j$(function(...z){let D=M._def.args.safeParse(z,G);if(!D.success)throw new R$([Q(z,D.error)]);let O=Reflect.apply(H,this,D.data),_=M._def.returns.safeParse(O,G);if(!_.success)throw new R$([J(O,_.error)]);return _.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...$){return new W6({...this._def,args:O0.create($).rest(t0.create())})}returns($){return new W6({...this._def,returns:$})}implement($){return this.parse($)}strictImplement($){return this.parse($)}static create($,X,Q){return new W6({args:$?$:O0.create([]).rest(t0.create()),returns:X||t0.create(),typeName:g.ZodFunction,...p(Q)})}}class w6 extends i{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})}}w6.create=($,X)=>{return new w6({getter:$,typeName:g.ZodLazy,...p(X)})};class z6 extends i{_parse($){if($.data!==this._def.value){let X=this._getOrReturnCtx($);return S(X,{received:X.data,code:K.invalid_literal,expected:this._def.value}),f}return{status:"valid",value:$.data}}get value(){return this._def.value}}z6.create=($,X)=>{return new z6({value:$,typeName:g.ZodLiteral,...p(X)})};function d7($,X){return new $4({values:$,typeName:g.ZodEnum,...p(X)})}class $4 extends i{constructor(){super(...arguments);e6.set(this,void 0)}_parse($){if(typeof $.data!=="string"){let X=this._getOrReturnCtx($),Q=this._def.values;return S(X,{expected:o.joinValues(Q),received:X.parsedType,code:K.invalid_type}),f}if(!R1(this,e6,"f"))u7(this,e6,new Set(this._def.values),"f");if(!R1(this,e6,"f").has($.data)){let X=this._getOrReturnCtx($),Q=this._def.values;return S(X,{received:X.data,code:K.invalid_enum_value,options:Q}),f}return j$($.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 $4.create($,{...this._def,...X})}exclude($,X=this._def){return $4.create(this.options.filter((Q)=>!$.includes(Q)),{...this._def,...X})}}e6=new WeakMap;$4.create=d7;class B6 extends i{constructor(){super(...arguments);$X.set(this,void 0)}_parse($){let X=o.getValidEnumValues(this._def.values),Q=this._getOrReturnCtx($);if(Q.parsedType!==L.string&&Q.parsedType!==L.number){let J=o.objectValues(X);return S(Q,{expected:o.joinValues(J),received:Q.parsedType,code:K.invalid_type}),f}if(!R1(this,$X,"f"))u7(this,$X,new Set(o.getValidEnumValues(this._def.values)),"f");if(!R1(this,$X,"f").has($.data)){let J=o.objectValues(X);return S(Q,{received:Q.data,code:K.invalid_enum_value,options:J}),f}return j$($.data)}get enum(){return this._def.values}}$X=new WeakMap;B6.create=($,X)=>{return new B6({values:$,typeName:g.ZodNativeEnum,...p(X)})};class F4 extends i{unwrap(){return this._def.type}_parse($){let{ctx:X}=this._processInputParams($);if(X.parsedType!==L.promise&&X.common.async===!1)return S(X,{code:K.invalid_type,expected:L.promise,received:X.parsedType}),f;let Q=X.parsedType===L.promise?X.data:Promise.resolve(X.data);return j$(Q.then((J)=>{return this._def.type.parseAsync(J,{path:X.path,errorMap:X.common.contextualErrorMap})}))}}F4.create=($,X)=>{return new F4({type:$,typeName:g.ZodPromise,...p(X)})};class X0 extends i{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===g.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse($){let{status:X,ctx:Q}=this._processInputParams($),J=this._def.effect||null,G={addIssue:(H)=>{if(S(Q,H),H.fatal)X.abort();else X.dirty()},get path(){return Q.path}};if(G.addIssue=G.addIssue.bind(G),J.type==="preprocess"){let H=J.transform(Q.data,G);if(Q.common.async)return Promise.resolve(H).then(async(M)=>{if(X.value==="aborted")return f;let z=await this._def.schema._parseAsync({data:M,path:Q.path,parent:Q});if(z.status==="aborted")return f;if(z.status==="dirty")return U4(z.value);if(X.value==="dirty")return U4(z.value);return z});else{if(X.value==="aborted")return f;let M=this._def.schema._parseSync({data:H,path:Q.path,parent:Q});if(M.status==="aborted")return f;if(M.status==="dirty")return U4(M.value);if(X.value==="dirty")return U4(M.value);return M}}if(J.type==="refinement"){let H=(M)=>{let z=J.refinement(M,G);if(Q.common.async)return Promise.resolve(z);if(z instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return M};if(Q.common.async===!1){let M=this._def.schema._parseSync({data:Q.data,path:Q.path,parent:Q});if(M.status==="aborted")return f;if(M.status==="dirty")X.dirty();return H(M.value),{status:X.value,value:M.value}}else return this._def.schema._parseAsync({data:Q.data,path:Q.path,parent:Q}).then((M)=>{if(M.status==="aborted")return f;if(M.status==="dirty")X.dirty();return H(M.value).then(()=>{return{status:X.value,value:M.value}})})}if(J.type==="transform")if(Q.common.async===!1){let H=this._def.schema._parseSync({data:Q.data,path:Q.path,parent:Q});if(!a0(H))return H;let M=J.transform(H.value,G);if(M instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:X.value,value:M}}else return this._def.schema._parseAsync({data:Q.data,path:Q.path,parent:Q}).then((H)=>{if(!a0(H))return H;return Promise.resolve(J.transform(H.value,G)).then((M)=>({status:X.value,value:M}))});o.assertNever(J)}}X0.create=($,X,Q)=>{return new X0({schema:$,typeName:g.ZodEffects,effect:X,...p(Q)})};X0.createWithPreprocess=($,X,Q)=>{return new X0({schema:X,effect:{type:"preprocess",transform:$},typeName:g.ZodEffects,...p(Q)})};class e$ extends i{_parse($){if(this._getType($)===L.undefined)return j$(void 0);return this._def.innerType._parse($)}unwrap(){return this._def.innerType}}e$.create=($,X)=>{return new e$({innerType:$,typeName:g.ZodOptional,...p(X)})};class P0 extends i{_parse($){if(this._getType($)===L.null)return j$(null);return this._def.innerType._parse($)}unwrap(){return this._def.innerType}}P0.create=($,X)=>{return new P0({innerType:$,typeName:g.ZodNullable,...p(X)})};class D6 extends i{_parse($){let{ctx:X}=this._processInputParams($),Q=X.data;if(X.parsedType===L.undefined)Q=this._def.defaultValue();return this._def.innerType._parse({data:Q,path:X.path,parent:X})}removeDefault(){return this._def.innerType}}D6.create=($,X)=>{return new D6({innerType:$,typeName:g.ZodDefault,defaultValue:typeof X.default==="function"?X.default:()=>X.default,...p(X)})};class V6 extends i{_parse($){let{ctx:X}=this._processInputParams($),Q={...X,common:{...X.common,issues:[]}},J=this._def.innerType._parse({data:Q.data,path:Q.path,parent:{...Q}});if(X6(J))return J.then((G)=>{return{status:"valid",value:G.status==="valid"?G.value:this._def.catchValue({get error(){return new R$(Q.common.issues)},input:Q.data})}});else return{status:"valid",value:J.status==="valid"?J.value:this._def.catchValue({get error(){return new R$(Q.common.issues)},input:Q.data})}}removeCatch(){return this._def.innerType}}V6.create=($,X)=>{return new V6({innerType:$,typeName:g.ZodCatch,catchValue:typeof X.catch==="function"?X.catch:()=>X.catch,...p(X)})};class GX extends i{_parse($){if(this._getType($)!==L.nan){let Q=this._getOrReturnCtx($);return S(Q,{code:K.invalid_type,expected:L.nan,received:Q.parsedType}),f}return{status:"valid",value:$.data}}}GX.create=($)=>{return new GX({typeName:g.ZodNaN,...p($)})};var eG=Symbol("zod_brand");class C1 extends i{_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}}class YX extends i{_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 f;if(G.status==="dirty")return X.dirty(),U4(G.value);else return this._def.out._parseAsync({data:G.value,path:Q.path,parent:Q})})();else{let J=this._def.in._parseSync({data:Q.data,path:Q.path,parent:Q});if(J.status==="aborted")return f;if(J.status==="dirty")return X.dirty(),{status:"dirty",value:J.value};else return this._def.out._parseSync({data:J.value,path:Q.path,parent:Q})}}static create($,X){return new YX({in:$,out:X,typeName:g.ZodPipeline})}}class O6 extends i{_parse($){let X=this._def.innerType._parse($),Q=(J)=>{if(a0(J))J.value=Object.freeze(J.value);return J};return X6(X)?X.then((J)=>Q(J)):Q(X)}unwrap(){return this._def.innerType}}O6.create=($,X)=>{return new O6({innerType:$,typeName:g.ZodReadonly,...p(X)})};function c7($,X){let Q=typeof $==="function"?$(X):typeof $==="string"?{message:$}:$;return typeof Q==="string"?{message:Q}:Q}function o7($,X={},Q){if($)return L4.create().superRefine((J,G)=>{let H=$(J);if(H instanceof Promise)return H.then((M)=>{if(!M){let z=c7(X,J),D=z.fatal??Q??!0;G.addIssue({code:"custom",...z,fatal:D})}});if(!H){let M=c7(X,J),z=M.fatal??Q??!0;G.addIssue({code:"custom",...M,fatal:z})}return});return L4.create()}var $Y={object:M$.lazycreate},g;(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"})(g||(g={}));var XY=($,X={message:`Input not instance of ${$.name}`})=>o7((Q)=>Q instanceof $,X),r7=t$.create,a7=s0.create,QY=GX.create,WY=e0.create,t7=J6.create,JY=N4.create,GY=XX.create,YY=G6.create,HY=Y6.create,MY=L4.create,wY=t0.create,zY=V0.create,BY=QX.create,DY=s$.create,VY=M$.create,OY=M$.strictCreate,qY=H6.create,_Y=v1.create,AY=M6.create,jY=O0.create,KY=WX.create,UY=JX.create,NY=S4.create,LY=W6.create,SY=w6.create,FY=z6.create,EY=$4.create,RY=B6.create,vY=F4.create,CY=X0.create,kY=e$.create,IY=P0.create,bY=X0.createWithPreprocess,PY=YX.create,fY=()=>r7().optional(),gY=()=>a7().optional(),TY=()=>t7().optional(),xY={string:($)=>t$.create({...$,coerce:!0}),number:($)=>s0.create({...$,coerce:!0}),boolean:($)=>J6.create({...$,coerce:!0}),bigint:($)=>e0.create({...$,coerce:!0}),date:($)=>N4.create({...$,coerce:!0})};var hY=f;var HX=x$(require("fs")),X4=x$(require("path")),X8=x$(require("fs/promises"));q4();var Q0=y$("Downloader");class s7{op;assetsPath="";savePath="";setup($){if(this.op=$,this.op.localPath)this.assetsPath=X4.default.join(this.op.localPath,"assets"),this.savePath=this.op.localPath}async downloadImage($,X){let{imgFormat:Q}=this.op,J=this.assetsPath;try{if(!HX.default.existsSync(J))HX.default.mkdirSync(J,{recursive:!0});let G=`${X}.${Q}`,H=X4.default.join(J,G),M=await e4($);if(!M.ok)throw new Error(`下载失败: ${M.status} ${M.statusText}`);let z=await M.arrayBuffer();return HX.default.writeFileSync(H,new Uint8Array(z)),X4.default.join(X4.default.basename(J),G).replace(/\\/g,"/")}catch(G){throw Q0.error("图片下载错误:",G),G}}async downLoadImageAndReplaceContent($){try{let X=/https:\/\/figma-alpha-api\.s3\.us-west-2\.amazonaws\.com\/images\/[a-f0-9-]+/g,Q=$.match(X);if(!Q)return $;let J=[...new Set(Q)],G=new Map;await Promise.all(J.map(async(M)=>{let z=X4.default.basename(M),D=await this.downloadImage(M,z);G.set(M,D)}));let H=$;for(let[M,z]of G.entries()){let D=new RegExp(M.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),"g");H=H.replace(D,z)}return H}catch(X){throw Q0.error("内容处理错误:",X),X}}async checkLocalAndDownload($){if(!this.op.localPath)return;await Promise.all($.map(async(X)=>{X.content=await this.downLoadImageAndReplaceContent(X.content)}));for(let X of $)try{let Q=await this.saveContentToFile(X.content,X.path);Q0.debug(`Successfully saved: ${Q}`)}catch(Q){Q0.error(`Failed to save file ${X.path}:`,Q)}}async ensureDirectoryExists($){if(!HX.default.existsSync($))Q0.debug(`Creating directory: ${$}`),await X8.default.mkdir($,{recursive:!0})}async saveContentToFile($,X){try{let Q=X4.default.join(this.savePath,X),J=X4.default.dirname(Q);if(Q0.debug(`Full path: ${Q}, directory: ${J}`),await this.ensureDirectoryExists(J),X.endsWith(".html"))Q0.debug("Wrapping content with HTML template"),$=this.wrapHtmlContent($);return Q0.debug(`Writing ${$.length} bytes to file`),await X8.default.writeFile(Q,$),Q0.info(`File saved: ${Q}`),Q}catch(Q){throw Q0.error("File save error:",X,Q),Q}}wrapHtmlContent($){return Q0.debug("Wrapping content with HTML template"),`<!DOCTYPE html>
15
+ `),J=!1,G=!1,H;$.on("response",(M)=>{let{headers:z}=M;J=z["transfer-encoding"]==="chunked"&&!z["content-length"]}),$.on("socket",(M)=>{let z=()=>{if(J&&!G){let O=new Error("Premature close");O.code="ERR_STREAM_PREMATURE_CLOSE",X(O)}},B=(O)=>{if(G=s6.Buffer.compare(O.slice(-5),Q)===0,!G&&H)G=s6.Buffer.compare(H.slice(-3),Q.slice(0,3))===0&&s6.Buffer.compare(O.slice(-2),Q.slice(3))===0;H=O};M.prependListener("close",z),M.on("data",B),$.on("close",()=>{M.removeListener("close",z),M.removeListener("data",B)})})}var xJ,hJ,S4,f$,s6,IG;var s8=B$(()=>{xJ=C$(require("node:http")),hJ=C$(require("node:https")),S4=C$(require("node:zlib")),f$=C$(require("node:stream")),s6=require("node:buffer");dW();F1();FJ();_1();TJ();l8();gJ();o8();O1();j1();a8();n8();IG=new Set(["data:","http:","https:"])});var nJ=xX((jB,uJ)=>{(()=>{var $={52:(G,H)=>{Object.defineProperty(H,"__esModule",{value:!0}),H.ReportType=H.ReportUrl=void 0,H.ReportUrl="https://statistcs-hdpt.yy.com/reportGeneralStatistics";var M;(function(z){z.pluginOpenCount="f2c_plugin_open_count"})(M||(H.ReportType=M={}))},248:(G)=>{G.exports=(s8(),X2(t8))},428:(G,H,M)=>{Object.defineProperty(H,"__esModule",{value:!0}),H.getGitUserInfo=B,H.getIsGitRepository=O,H.getUserInfoWithFallback=q;let z=M(646);function B(){let _={};try{let F=z.execSync("git config user.name",{encoding:"utf8"}).trim();if(F)_.name=F;let f=z.execSync("git config user.email",{encoding:"utf8"}).trim();if(f)_.email=f}catch(F){return _}return _}function O(){try{return z.execSync("git rev-parse --git-dir",{encoding:"utf8",stdio:"ignore"}),!0}catch(_){return!1}}function q(){if(O())try{let f=B(),P=f.email||f.name;if(P)return P}catch(f){}let _=x();if(_)return _;let F=T();if(F)return F;return"f2c_匿名"}function x(){let _=["GIT_AUTHOR_EMAIL","GIT_COMMITTER_EMAIL","EMAIL","GIT_AUTHOR_NAME","GIT_COMMITTER_NAME","USER","USERNAME","LOGNAME"];for(let F of _){let f=process.env[F];if(f&&f.trim())return f.trim()}return""}function T(){try{let _=z.execSync("whoami",{encoding:"utf8",timeout:5000}).trim();if(process.platform==="win32"&&_.includes("\\"))return _.split("\\").pop()||"";return _}catch(_){return""}}},646:(G)=>{G.exports=require("child_process")},680:function(G,H,M){var z=this&&this.__createBinding||(Object.create?function(_,F,f,P){if(P===void 0)P=f;var I=Object.getOwnPropertyDescriptor(F,f);if(!I||("get"in I?!F.__esModule:I.writable||I.configurable))I={enumerable:!0,get:function(){return F[f]}};Object.defineProperty(_,P,I)}:function(_,F,f,P){if(P===void 0)P=f;_[P]=F[f]}),B=this&&this.__setModuleDefault||(Object.create?function(_,F){Object.defineProperty(_,"default",{enumerable:!0,value:F})}:function(_,F){_.default=F}),O=this&&this.__importStar||function(){var _=function(F){return _=Object.getOwnPropertyNames||function(f){var P=[];for(var I in f)if(Object.prototype.hasOwnProperty.call(f,I))P[P.length]=I;return P},_(F)};return function(F){if(F&&F.__esModule)return F;var f={};if(F!=null){for(var P=_(F),I=0;I<P.length;I++)if(P[I]!=="default")z(f,F,P[I])}return B(f,F),f}}();Object.defineProperty(H,"__esModule",{value:!0}),H.compatFetch=T;let q=null;async function x(){if(typeof global!=="undefined"&&global.fetch)return global.fetch;if(typeof globalThis.fetch!=="undefined")return globalThis.fetch;if(!q)try{q=await Promise.resolve().then(()=>O(M(248)))}catch(_){throw new Error("Neither native fetch nor node-fetch is available. Please install node-fetch or upgrade to Node.js 18+")}return q.default}async function T(_,F){return(await x())(_,F)}H.default=T},782:(G,H)=>{Object.defineProperty(H,"__esModule",{value:!0}),H.createLogger=H.Logger=H.isHttp=H.LogLevel=void 0;var M;(function(q){q[q.DEBUG=0]="DEBUG",q[q.INFO=1]="INFO",q[q.WARN=2]="WARN",q[q.ERROR=3]="ERROR"})(M||(H.LogLevel=M={}));function z(){let q=process.argv.join(" ");return q.includes("streamable-http.js")||q.includes("streamable-http.ts")}H.isHttp=z();class B{constructor(q,x=M.INFO){this.context=q,this.level=x}setLevel(q){this.level=q}log(...q){if(H.isHttp)console.log(...q);else console.error(...q)}logWarn(...q){if(H.isHttp)console.warn(...q);else console.error(...q)}debug(...q){if(this.level<=M.DEBUG)this.log(`[DEBUG] [${this.context}]`,...q)}info(...q){if(this.level<=M.INFO)this.log(`[INFO] [${this.context}]`,...q)}warn(...q){if(this.level<=M.WARN)this.logWarn(`[WARN] [${this.context}]`,...q)}error(...q){if(this.level<=M.ERROR)console.error(`[ERROR] [${this.context}]`,...q)}}H.Logger=B;let O=(q,x=M.INFO)=>new B(q,x);H.createLogger=O},799:(G,H)=>{Object.defineProperty(H,"__esModule",{value:!0}),H.detectIDE=M;function M(z){try{let B=process.env;if(B?.VSCODE_CWD?.toLowerCase().includes("trae"))return"Trae";if(B?.IDE?.toLocaleLowerCase().includes("comate")||B?.VSCODE_CWD?.toLowerCase().includes("comate"))return"Comate";if(B?.VSCODE_CWD?.toLowerCase().includes("cursor"))return"Cursor";return"Other"}catch(B){return"Other"}}},867:(G,H,M)=>{Object.defineProperty(H,"__esModule",{value:!0}),H.f2cDataReport=F,H.reportMcpLoader=f;let z=M(680),B=M(428),O=M(782),q=M(52),x=M(799),T=O.createLogger("F2c-Report");function _(P){return(I,Q$)=>{let o=new AbortController;Q$=Q$||{},Q$.signal=o.signal;let r=setTimeout(()=>{clearTimeout(r),o.abort()},P);return z.compatFetch(q.ReportUrl,Q$)}}async function F(P,I,Q$,o){let r="",u=B.getGitUserInfo();r=u.name?u.name+"-"+u.email:u.email?u.email:"f2c_匿名";let z$={...o,account:r,appid:1,dataType:P,dim1:r,dim3:I,value1:Q$};try{let W0=await(await _(3000)(q.ReportUrl,{method:"POST",mode:"cors",credentials:"include",headers:{"Content-Type":"application/json;charset=utf-8"},body:JSON.stringify(z$)})).json();if(W0&&W0.result!=200)T.log("上报失败",W0.reason,W0.result)}catch(T0){T.error(T0)}}async function f(){try{let P=x.detectIDE(T);F(q.ReportType.pluginOpenCount,"",1,{dim4:"f2cRestApi-mcp-loadedIn-"+P})}catch(P){}}}},X={};function Q(G){var H=X[G];if(H!==void 0)return H.exports;var M=X[G]={exports:{}};return $[G].call(M.exports,M,M.exports,Q),M.exports}var J={};(()=>{var G=J;Object.defineProperty(G,"__esModule",{value:!0}),G.ReportType=G.reportMcpLoader=G.f2cDataReport=void 0;var H=Q(867);Object.defineProperty(G,"f2cDataReport",{enumerable:!0,get:function(){return H.f2cDataReport}}),Object.defineProperty(G,"reportMcpLoader",{enumerable:!0,get:function(){return H.reportMcpLoader}});var M=Q(52);Object.defineProperty(G,"ReportType",{enumerable:!0,get:function(){return M.ReportType}})})(),uJ.exports=J})()});l6();var i3=60000;class k8{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(pX,(X)=>{let Q=this._requestHandlerAbortControllers.get(X.params.requestId);Q===null||Q===void 0||Q.abort(X.params.reason)}),this.setNotificationHandler(oX,(X)=>{this._onprogress(X)}),this.setRequestHandler(dX,(X)=>({}))}_setupTimeout($,X,Q,J,G=!1){this._timeoutInfo.set($,{timeoutId:setTimeout(J,X),startTime:Date.now(),timeout:X,maxTotalTimeout:Q,resetTimeoutOnProgress:G,onTimeout:J})}_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 w$(H$.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(R8(X)||o7(X))this._onresponse(X);else if(u7(X))this._onrequest(X,Q);else if(p7(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 w$(H$.ConnectionClosed,"Connection closed");for(let J of X.values())J(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((J)=>this._onerror(new Error(`Uncaught error in notification handler: ${J}`)))}_onrequest($,X){var Q,J,G,H;let M=(Q=this._requestHandlers.get($.method))!==null&&Q!==void 0?Q:this.fallbackRequestHandler;if(M===void 0){(J=this._transport)===null||J===void 0||J.send({jsonrpc:"2.0",id:$.id,error:{code:H$.MethodNotFound,message:"Method not found"}}).catch((O)=>this._onerror(new Error(`Failed to send an error response: ${O}`)));return}let z=new AbortController;this._requestHandlerAbortControllers.set($.id,z);let B={signal:z.signal,sessionId:(G=this._transport)===null||G===void 0?void 0:G.sessionId,_meta:(H=$.params)===null||H===void 0?void 0:H._meta,sendNotification:(O)=>this.notification(O,{relatedRequestId:$.id}),sendRequest:(O,q,x)=>this.request(O,q,{...x,relatedRequestId:$.id}),authInfo:X===null||X===void 0?void 0:X.authInfo,requestId:$.id};Promise.resolve().then(()=>M($,B)).then((O)=>{var q;if(z.signal.aborted)return;return(q=this._transport)===null||q===void 0?void 0:q.send({result:O,jsonrpc:"2.0",id:$.id})},(O)=>{var q,x;if(z.signal.aborted)return;return(q=this._transport)===null||q===void 0?void 0:q.send({jsonrpc:"2.0",id:$.id,error:{code:Number.isSafeInteger(O.code)?O.code:H$.InternalError,message:(x=O.message)!==null&&x!==void 0?x:"Internal error"}})}).catch((O)=>this._onerror(new Error(`Failed to send response: ${O}`))).finally(()=>{this._requestHandlerAbortControllers.delete($.id)})}_onprogress($){let{progressToken:X,...Q}=$.params,J=Number(X),G=this._progressHandlers.get(J);if(!G){this._onerror(new Error(`Received a progress notification for an unknown token: ${JSON.stringify($)}`));return}let H=this._responseHandlers.get(J),M=this._timeoutInfo.get(J);if(M&&H&&M.resetTimeoutOnProgress)try{this._resetTimeout(J)}catch(z){H(z);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),R8($))Q($);else{let J=new w$($.error.code,$.error.message,$.error.data);Q(J)}}get transport(){return this._transport}async close(){var $;await(($=this._transport)===null||$===void 0?void 0:$.close())}request($,X,Q){let{relatedRequestId:J,resumptionToken:G,onresumptiontoken:H}=Q!==null&&Q!==void 0?Q:{};return new Promise((M,z)=>{var B,O,q,x,T,_;if(!this._transport){z(new Error("Not connected"));return}if(((B=this._options)===null||B===void 0?void 0:B.enforceStrictCapabilities)===!0)this.assertCapabilityForMethod($.method);(O=Q===null||Q===void 0?void 0:Q.signal)===null||O===void 0||O.throwIfAborted();let F=this._requestMessageId++,f={...$,jsonrpc:"2.0",id:F};if(Q===null||Q===void 0?void 0:Q.onprogress)this._progressHandlers.set(F,Q.onprogress),f.params={...$.params,_meta:{...((q=$.params)===null||q===void 0?void 0:q._meta)||{},progressToken:F}};let P=(o)=>{var r;this._responseHandlers.delete(F),this._progressHandlers.delete(F),this._cleanupTimeout(F),(r=this._transport)===null||r===void 0||r.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:F,reason:String(o)}},{relatedRequestId:J,resumptionToken:G,onresumptiontoken:H}).catch((u)=>this._onerror(new Error(`Failed to send cancellation: ${u}`))),z(o)};this._responseHandlers.set(F,(o)=>{var r;if((r=Q===null||Q===void 0?void 0:Q.signal)===null||r===void 0?void 0:r.aborted)return;if(o instanceof Error)return z(o);try{let u=X.parse(o.result);M(u)}catch(u){z(u)}}),(x=Q===null||Q===void 0?void 0:Q.signal)===null||x===void 0||x.addEventListener("abort",()=>{var o;P((o=Q===null||Q===void 0?void 0:Q.signal)===null||o===void 0?void 0:o.reason)});let I=(T=Q===null||Q===void 0?void 0:Q.timeout)!==null&&T!==void 0?T:i3,Q$=()=>P(new w$(H$.RequestTimeout,"Request timed out",{timeout:I}));this._setupTimeout(F,I,Q===null||Q===void 0?void 0:Q.maxTotalTimeout,Q$,(_=Q===null||Q===void 0?void 0:Q.resetTimeoutOnProgress)!==null&&_!==void 0?_:!1),this._transport.send(f,{relatedRequestId:J,resumptionToken:G,onresumptiontoken:H}).catch((o)=>{this._cleanupTimeout(F),z(o)})})}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,(J,G)=>{return Promise.resolve(X($.parse(J),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 WW($,X){return Object.entries(X).reduce((Q,[J,G])=>{if(G&&typeof G==="object")Q[J]=Q[J]?{...Q[J],...G}:G;else Q[J]=G;return Q},{...$})}l6();class P8 extends k8{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(iX,(J)=>this._oninitialize(J)),this.setNotificationHandler(v8,()=>{var J;return(J=this.oninitialized)===null||J===void 0?void 0:J.call(this)})}registerCapabilities($){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=WW(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:y7.includes(X)?X:L8,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"},nX)}async createMessage($,X){return this.request({method:"sampling/createMessage",params:$},C8,X)}async listRoots($,X){return this.request({method:"roots/list",params:$},I8,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 GW=Symbol("Let zodToJsonSchema decide on which parser to use");var JW={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"},YW=($)=>typeof $==="string"?{...JW,name:$}:{...JW,...$};var HW=($)=>{let X=YW($),Q=X.name!==void 0?[...X.basePath,X.definitionPath,X.name]:X.basePath;return{...X,currentPath:Q,propertyPath:void 0,seen:new Map(Object.entries(X.definitions).map(([J,G])=>[G._def,{def:G._def,path:[...X.basePath,X.definitionPath,J],jsonSchema:void 0}]))}};function b8($,X,Q,J){if(!J?.errorMessages)return;if(Q)$.errorMessage={...$.errorMessage,[X]:Q}}function $$($,X,Q,J,G){$[X]=Q,b8($,X,J,G)}i0();function MW(){return{}}i0();function wW($,X){let Q={type:"array"};if($.type?._def&&$.type?._def?.typeName!==S.ZodAny)Q.items=Z($.type._def,{...X,currentPath:[...X.currentPath,"items"]});if($.minLength)$$(Q,"minItems",$.minLength.value,$.minLength.message,X);if($.maxLength)$$(Q,"maxItems",$.maxLength.value,$.maxLength.message,X);if($.exactLength)$$(Q,"minItems",$.exactLength.value,$.exactLength.message,X),$$(Q,"maxItems",$.exactLength.value,$.exactLength.message,X);return Q}function zW($,X){let Q={type:"integer",format:"int64"};if(!$.checks)return Q;for(let J of $.checks)switch(J.kind){case"min":if(X.target==="jsonSchema7")if(J.inclusive)$$(Q,"minimum",J.value,J.message,X);else $$(Q,"exclusiveMinimum",J.value,J.message,X);else{if(!J.inclusive)Q.exclusiveMinimum=!0;$$(Q,"minimum",J.value,J.message,X)}break;case"max":if(X.target==="jsonSchema7")if(J.inclusive)$$(Q,"maximum",J.value,J.message,X);else $$(Q,"exclusiveMaximum",J.value,J.message,X);else{if(!J.inclusive)Q.exclusiveMaximum=!0;$$(Q,"maximum",J.value,J.message,X)}break;case"multipleOf":$$(Q,"multipleOf",J.value,J.message,X);break}return Q}function BW(){return{type:"boolean"}}function M1($,X){return Z($.type._def,X)}var DW=($,X)=>{return Z($.innerType._def,X)};function f8($,X,Q){let J=Q??X.dateStrategy;if(Array.isArray(J))return{anyOf:J.map((G,H)=>f8($,X,G))};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 d3($,X)}}var d3=($,X)=>{let Q={type:"integer",format:"unix-time"};if(X.target==="openApi3")return Q;for(let J of $.checks)switch(J.kind){case"min":$$(Q,"minimum",J.value,J.message,X);break;case"max":$$(Q,"maximum",J.value,J.message,X);break}return Q};function VW($,X){return{...Z($.innerType._def,X),default:$.defaultValue()}}function OW($,X){return X.effectStrategy==="input"?Z($.schema._def,X):{}}function qW($){return{type:"string",enum:Array.from($.values)}}var o3=($)=>{if("type"in $&&$.type==="string")return!1;return"allOf"in $};function AW($,X){let Q=[Z($.left._def,{...X,currentPath:[...X.currentPath,"allOf","0"]}),Z($.right._def,{...X,currentPath:[...X.currentPath,"allOf","1"]})].filter((H)=>!!H),J=X.target==="jsonSchema2019-09"?{unevaluatedProperties:!1}:void 0,G=[];return Q.forEach((H)=>{if(o3(H)){if(G.push(...H.allOf),H.unevaluatedProperties===void 0)J=void 0}else{let M=H;if("additionalProperties"in H&&H.additionalProperties===!1){let{additionalProperties:z,...B}=H;M=B}else J=void 0;G.push(M)}}),G.length?{allOf:G,...J}:void 0}function jW($,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}}i0();var T8=void 0,d$={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(T8===void 0)T8=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u");return T8},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 w1($,X){let Q={type:"string"};if($.checks)for(let J of $.checks)switch(J.kind){case"min":$$(Q,"minLength",typeof Q.minLength==="number"?Math.max(Q.minLength,J.value):J.value,J.message,X);break;case"max":$$(Q,"maxLength",typeof Q.maxLength==="number"?Math.min(Q.maxLength,J.value):J.value,J.message,X);break;case"email":switch(X.emailStrategy){case"format:email":o$(Q,"email",J.message,X);break;case"format:idn-email":o$(Q,"idn-email",J.message,X);break;case"pattern:zod":S$(Q,d$.email,J.message,X);break}break;case"url":o$(Q,"uri",J.message,X);break;case"uuid":o$(Q,"uuid",J.message,X);break;case"regex":S$(Q,J.regex,J.message,X);break;case"cuid":S$(Q,d$.cuid,J.message,X);break;case"cuid2":S$(Q,d$.cuid2,J.message,X);break;case"startsWith":S$(Q,RegExp(`^${g8(J.value,X)}`),J.message,X);break;case"endsWith":S$(Q,RegExp(`${g8(J.value,X)}$`),J.message,X);break;case"datetime":o$(Q,"date-time",J.message,X);break;case"date":o$(Q,"date",J.message,X);break;case"time":o$(Q,"time",J.message,X);break;case"duration":o$(Q,"duration",J.message,X);break;case"length":$$(Q,"minLength",typeof Q.minLength==="number"?Math.max(Q.minLength,J.value):J.value,J.message,X),$$(Q,"maxLength",typeof Q.maxLength==="number"?Math.min(Q.maxLength,J.value):J.value,J.message,X);break;case"includes":{S$(Q,RegExp(g8(J.value,X)),J.message,X);break}case"ip":{if(J.version!=="v6")o$(Q,"ipv4",J.message,X);if(J.version!=="v4")o$(Q,"ipv6",J.message,X);break}case"base64url":S$(Q,d$.base64url,J.message,X);break;case"jwt":S$(Q,d$.jwt,J.message,X);break;case"cidr":{if(J.version!=="v6")S$(Q,d$.ipv4Cidr,J.message,X);if(J.version!=="v4")S$(Q,d$.ipv6Cidr,J.message,X);break}case"emoji":S$(Q,d$.emoji(),J.message,X);break;case"ulid":{S$(Q,d$.ulid,J.message,X);break}case"base64":{switch(X.base64Strategy){case"format:binary":{o$(Q,"binary",J.message,X);break}case"contentEncoding:base64":{$$(Q,"contentEncoding","base64",J.message,X);break}case"pattern:zod":{S$(Q,d$.base64,J.message,X);break}}break}case"nanoid":S$(Q,d$.nanoid,J.message,X);case"toLowerCase":case"toUpperCase":case"trim":break;default:((G)=>{})(J)}return Q}function g8($,X){return X.patternStrategy==="escape"?r3($):$}var a3=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function r3($){let X="";for(let Q=0;Q<$.length;Q++){if(!a3.has($[Q]))X+="\\";X+=$[Q]}return X}function o$($,X,Q,J){if($.format||$.anyOf?.some((G)=>G.format)){if(!$.anyOf)$.anyOf=[];if($.format){if($.anyOf.push({format:$.format,...$.errorMessage&&J.errorMessages&&{errorMessage:{format:$.errorMessage.format}}}),delete $.format,$.errorMessage){if(delete $.errorMessage.format,Object.keys($.errorMessage).length===0)delete $.errorMessage}}$.anyOf.push({format:X,...Q&&J.errorMessages&&{errorMessage:{format:Q}}})}else $$($,"format",X,Q,J)}function S$($,X,Q,J){if($.pattern||$.allOf?.some((G)=>G.pattern)){if(!$.allOf)$.allOf=[];if($.pattern){if($.allOf.push({pattern:$.pattern,...$.errorMessage&&J.errorMessages&&{errorMessage:{pattern:$.errorMessage.pattern}}}),delete $.pattern,$.errorMessage){if(delete $.errorMessage.pattern,Object.keys($.errorMessage).length===0)delete $.errorMessage}}$.allOf.push({pattern:KW(X,J),...Q&&J.errorMessages&&{errorMessage:{pattern:Q}}})}else $$($,"pattern",KW(X,J),Q,J)}function KW($,X){if(!X.applyRegexFlags||!$.flags)return $.source;let Q={i:$.flags.includes("i"),m:$.flags.includes("m"),s:$.flags.includes("s")},J=Q.i?$.source.toLowerCase():$.source,G="",H=!1,M=!1,z=!1;for(let B=0;B<J.length;B++){if(H){G+=J[B],H=!1;continue}if(Q.i){if(M){if(J[B].match(/[a-z]/)){if(z)G+=J[B],G+=`${J[B-2]}-${J[B]}`.toUpperCase(),z=!1;else if(J[B+1]==="-"&&J[B+2]?.match(/[a-z]/))G+=J[B],z=!0;else G+=`${J[B]}${J[B].toUpperCase()}`;continue}}else if(J[B].match(/[a-z]/)){G+=`[${J[B]}${J[B].toUpperCase()}]`;continue}}if(Q.m){if(J[B]==="^"){G+=`(^|(?<=[\r
16
+ ]))`;continue}else if(J[B]==="$"){G+=`($|(?=[\r
17
+ ]))`;continue}}if(Q.s&&J[B]==="."){G+=M?`${J[B]}\r
18
+ `:`[${J[B]}\r
19
+ ]`;continue}if(G+=J[B],J[B]==="\\")H=!0;else if(M&&J[B]==="]")M=!1;else if(!M&&J[B]==="[")M=!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 z1($,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===S.ZodEnum)return{type:"object",required:$.keyType._def.values,properties:$.keyType._def.values.reduce((J,G)=>({...J,[G]:Z($.valueType._def,{...X,currentPath:[...X.currentPath,"properties",G]})??{}}),{}),additionalProperties:X.rejectedAdditionalProperties};let Q={type:"object",additionalProperties:Z($.valueType._def,{...X,currentPath:[...X.currentPath,"additionalProperties"]})??X.allowedAdditionalProperties};if(X.target==="openApi3")return Q;if($.keyType?._def.typeName===S.ZodString&&$.keyType._def.checks?.length){let{type:J,...G}=w1($.keyType._def,X);return{...Q,propertyNames:G}}else if($.keyType?._def.typeName===S.ZodEnum)return{...Q,propertyNames:{enum:$.keyType._def.values}};else if($.keyType?._def.typeName===S.ZodBranded&&$.keyType._def.type._def.typeName===S.ZodString&&$.keyType._def.type._def.checks?.length){let{type:J,...G}=M1($.keyType._def,X);return{...Q,propertyNames:G}}return Q}function UW($,X){if(X.mapStrategy==="record")return z1($,X);let Q=Z($.keyType._def,{...X,currentPath:[...X.currentPath,"items","items","0"]})||{},J=Z($.valueType._def,{...X,currentPath:[...X.currentPath,"items","items","1"]})||{};return{type:"array",maxItems:125,items:{type:"array",items:[Q,J],minItems:2,maxItems:2}}}function NW($){let X=$.values,J=Object.keys($.values).filter((H)=>{return typeof X[X[H]]!=="number"}).map((H)=>X[H]),G=Array.from(new Set(J.map((H)=>typeof H)));return{type:G.length===1?G[0]==="string"?"string":"number":["string","number"],enum:J}}function SW(){return{not:{}}}function FW($){return $.target==="openApi3"?{enum:["null"],nullable:!0}:{type:"null"}}var c6={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};function _W($,X){if(X.target==="openApi3")return EW($,X);let Q=$.options instanceof Map?Array.from($.options.values()):$.options;if(Q.every((J)=>(J._def.typeName in c6)&&(!J._def.checks||!J._def.checks.length))){let J=Q.reduce((G,H)=>{let M=c6[H._def.typeName];return M&&!G.includes(M)?[...G,M]:G},[]);return{type:J.length>1?J:J[0]}}else if(Q.every((J)=>J._def.typeName==="ZodLiteral"&&!J.description)){let J=Q.reduce((G,H)=>{let M=typeof H._def.value;switch(M){case"string":case"number":case"boolean":return[...G,M];case"bigint":return[...G,"integer"];case"object":if(H._def.value===null)return[...G,"null"];case"symbol":case"undefined":case"function":default:return G}},[]);if(J.length===Q.length){let G=J.filter((H,M,z)=>z.indexOf(H)===M);return{type:G.length>1?G:G[0],enum:Q.reduce((H,M)=>{return H.includes(M._def.value)?H:[...H,M._def.value]},[])}}}else if(Q.every((J)=>J._def.typeName==="ZodEnum"))return{type:"string",enum:Q.reduce((J,G)=>[...J,...G._def.values.filter((H)=>!J.includes(H))],[])};return EW($,X)}var EW=($,X)=>{let Q=($.options instanceof Map?Array.from($.options.values()):$.options).map((J,G)=>Z(J._def,{...X,currentPath:[...X.currentPath,"anyOf",`${G}`]})).filter((J)=>!!J&&(!X.strictUnions||typeof J==="object"&&Object.keys(J).length>0));return Q.length?{anyOf:Q}:void 0};function LW($,X){if(["ZodString","ZodNumber","ZodBigInt","ZodBoolean","ZodNull"].includes($.innerType._def.typeName)&&(!$.innerType._def.checks||!$.innerType._def.checks.length)){if(X.target==="openApi3")return{type:c6[$.innerType._def.typeName],nullable:!0};return{type:[c6[$.innerType._def.typeName],"null"]}}if(X.target==="openApi3"){let J=Z($.innerType._def,{...X,currentPath:[...X.currentPath]});if(J&&"$ref"in J)return{allOf:[J],nullable:!0};return J&&{...J,nullable:!0}}let Q=Z($.innerType._def,{...X,currentPath:[...X.currentPath,"anyOf","0"]});return Q&&{anyOf:[Q,{type:"null"}]}}function RW($,X){let Q={type:"number"};if(!$.checks)return Q;for(let J of $.checks)switch(J.kind){case"int":Q.type="integer",b8(Q,"type",J.message,X);break;case"min":if(X.target==="jsonSchema7")if(J.inclusive)$$(Q,"minimum",J.value,J.message,X);else $$(Q,"exclusiveMinimum",J.value,J.message,X);else{if(!J.inclusive)Q.exclusiveMinimum=!0;$$(Q,"minimum",J.value,J.message,X)}break;case"max":if(X.target==="jsonSchema7")if(J.inclusive)$$(Q,"maximum",J.value,J.message,X);else $$(Q,"exclusiveMaximum",J.value,J.message,X);else{if(!J.inclusive)Q.exclusiveMaximum=!0;$$(Q,"maximum",J.value,J.message,X)}break;case"multipleOf":$$(Q,"multipleOf",J.value,J.message,X);break}return Q}i0();function vW($,X){let Q=X.target==="openAi",J={type:"object",properties:{}},G=[],H=$.shape();for(let z in H){let B=H[z];if(B===void 0||B._def===void 0)continue;let O=s3(B);if(O&&Q){if(B instanceof k$)B=B._def.innerType;if(!B.isNullable())B=B.nullable();O=!1}let q=Z(B._def,{...X,currentPath:[...X.currentPath,"properties",z],propertyPath:[...X.currentPath,"properties",z]});if(q===void 0)continue;if(J.properties[z]=q,!O)G.push(z)}if(G.length)J.required=G;let M=t3($,X);if(M!==void 0)J.additionalProperties=M;return J}function t3($,X){if($.catchall._def.typeName!=="ZodNever")return Z($.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 s3($){try{return $.isOptional()}catch{return!0}}var CW=($,X)=>{if(X.currentPath.toString()===X.propertyPath?.toString())return Z($.innerType._def,X);let Q=Z($.innerType._def,{...X,currentPath:[...X.currentPath,"anyOf","1"]});return Q?{anyOf:[{not:{}},Q]}:{}};var IW=($,X)=>{if(X.pipeStrategy==="input")return Z($.in._def,X);else if(X.pipeStrategy==="output")return Z($.out._def,X);let Q=Z($.in._def,{...X,currentPath:[...X.currentPath,"allOf","0"]}),J=Z($.out._def,{...X,currentPath:[...X.currentPath,"allOf",Q?"1":"0"]});return{allOf:[Q,J].filter((G)=>G!==void 0)}};function kW($,X){return Z($.type._def,X)}function PW($,X){let J={type:"array",uniqueItems:!0,items:Z($.valueType._def,{...X,currentPath:[...X.currentPath,"items"]})};if($.minSize)$$(J,"minItems",$.minSize.value,$.minSize.message,X);if($.maxSize)$$(J,"maxItems",$.maxSize.value,$.maxSize.message,X);return J}function bW($,X){if($.rest)return{type:"array",minItems:$.items.length,items:$.items.map((Q,J)=>Z(Q._def,{...X,currentPath:[...X.currentPath,"items",`${J}`]})).reduce((Q,J)=>J===void 0?Q:[...Q,J],[]),additionalItems:Z($.rest._def,{...X,currentPath:[...X.currentPath,"additionalItems"]})};else return{type:"array",minItems:$.items.length,maxItems:$.items.length,items:$.items.map((Q,J)=>Z(Q._def,{...X,currentPath:[...X.currentPath,"items",`${J}`]})).reduce((Q,J)=>J===void 0?Q:[...Q,J],[])}}function fW(){return{not:{}}}function TW(){return{}}var gW=($,X)=>{return Z($.innerType._def,X)};var xW=($,X,Q)=>{switch(X){case S.ZodString:return w1($,Q);case S.ZodNumber:return RW($,Q);case S.ZodObject:return vW($,Q);case S.ZodBigInt:return zW($,Q);case S.ZodBoolean:return BW();case S.ZodDate:return f8($,Q);case S.ZodUndefined:return fW();case S.ZodNull:return FW(Q);case S.ZodArray:return wW($,Q);case S.ZodUnion:case S.ZodDiscriminatedUnion:return _W($,Q);case S.ZodIntersection:return AW($,Q);case S.ZodTuple:return bW($,Q);case S.ZodRecord:return z1($,Q);case S.ZodLiteral:return jW($,Q);case S.ZodEnum:return qW($);case S.ZodNativeEnum:return NW($);case S.ZodNullable:return LW($,Q);case S.ZodOptional:return CW($,Q);case S.ZodMap:return UW($,Q);case S.ZodSet:return PW($,Q);case S.ZodLazy:return()=>$.getter()._def;case S.ZodPromise:return kW($,Q);case S.ZodNaN:case S.ZodNever:return SW();case S.ZodEffects:return OW($,Q);case S.ZodAny:return MW();case S.ZodUnknown:return TW();case S.ZodDefault:return VW($,Q);case S.ZodBranded:return M1($,Q);case S.ZodReadonly:return gW($,Q);case S.ZodCatch:return DW($,Q);case S.ZodPipeline:return IW($,Q);case S.ZodFunction:case S.ZodVoid:case S.ZodSymbol:return;default:return((J)=>{return})(X)}};function Z($,X,Q=!1){let J=X.seen.get($);if(X.override){let z=X.override?.($,X,J,Q);if(z!==GW)return z}if(J&&!Q){let z=e3(J,X);if(z!==void 0)return z}let G={def:$,path:X.currentPath,jsonSchema:void 0};X.seen.set($,G);let H=xW($,$.typeName,X),M=typeof H==="function"?Z(H(),X):H;if(M)XG($,X,M);if(X.postProcess){let z=X.postProcess(M,$,X);return G.jsonSchema=M,z}return G.jsonSchema=M,M}var e3=($,X)=>{switch(X.$refStrategy){case"root":return{$ref:$.path.join("/")};case"relative":return{$ref:$G(X.currentPath,$.path)};case"none":case"seen":{if($.path.length<X.currentPath.length&&$.path.every((Q,J)=>X.currentPath[J]===Q))return console.warn(`Recursive reference detected at ${X.currentPath.join("/")}! Defaulting to any`),{};return X.$refStrategy==="seen"?{}:void 0}}},$G=($,X)=>{let Q=0;for(;Q<$.length&&Q<X.length;Q++)if($[Q]!==X[Q])break;return[($.length-Q).toString(),...X.slice(Q)].join("/")},XG=($,X,Q)=>{if($.description){if(Q.description=$.description,X.markdownDescription)Q.markdownDescription=$.description}return Q};var B1=($,X)=>{let Q=HW(X),J=typeof X==="object"&&X.definitions?Object.entries(X.definitions).reduce((B,[O,q])=>({...B,[O]:Z(q._def,{...Q,currentPath:[...Q.basePath,Q.definitionPath,O]},!0)??{}}),{}):void 0,G=typeof X==="string"?X:X?.nameStrategy==="title"?void 0:X?.name,H=Z($._def,G===void 0?Q:{...Q,currentPath:[...Q.basePath,Q.definitionPath,G]},!1)??{},M=typeof X==="object"&&X.name!==void 0&&X.nameStrategy==="title"?X.name:void 0;if(M!==void 0)H.title=M;let z=G===void 0?J?{...H,[Q.definitionPath]:J}:H:{$ref:[...Q.$refStrategy==="relative"?[]:Q.basePath,Q.definitionPath,G].join("/"),[Q.definitionPath]:{...J,[G]:H}};if(Q.target==="jsonSchema7")z.$schema="http://json-schema.org/draft-07/schema#";else if(Q.target==="jsonSchema2019-09"||Q.target==="openAi")z.$schema="https://json-schema.org/draft/2019-09/schema#";if(Q.target==="openAi"&&(("anyOf"in z)||("oneOf"in z)||("allOf"in z)||("type"in z)&&Array.isArray(z.type)))console.warn("Warning: OpenAI may not support schemas with unions as roots! Try wrapping it in an object property.");return z};i0();l6();i0();var x8;(function($){$.Completable="McpCompletable"})(x8||(x8={}));class u6 extends p{_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}}u6.create=($,X)=>{return new u6({type:$,typeName:x8.Completable,complete:X.complete,...QG(X)})};function QG($){if(!$)return{};let{errorMap:X,invalid_type_error:Q,required_error:J,description:G}=$;if(X&&(Q||J))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:(M,z)=>{var B,O;let{message:q}=$;if(M.code==="invalid_enum_value")return{message:q!==null&&q!==void 0?q:z.defaultError};if(typeof z.data==="undefined")return{message:(B=q!==null&&q!==void 0?q:J)!==null&&B!==void 0?B:z.defaultError};if(M.code!=="invalid_type")return{message:z.defaultError};return{message:(O=q!==null&&q!==void 0?q:Q)!==null&&O!==void 0?O:z.defaultError}},description:G}}class h8{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 P8($,X)}async connect($){return await this.server.connect($)}async close(){await this.server.close()}setToolRequestHandlers(){if(this._toolHandlersInitialized)return;this.server.assertCanSetRequestHandler(G1.shape.method.value),this.server.assertCanSetRequestHandler(Y1.shape.method.value),this.server.registerCapabilities({tools:{listChanged:!0}}),this.server.setRequestHandler(G1,()=>({tools:Object.entries(this._registeredTools).filter(([,$])=>$.enabled).map(([$,X])=>{let Q={name:$,description:X.description,inputSchema:X.inputSchema?B1(X.inputSchema,{strictUnions:!0}):WG,annotations:X.annotations};if(X.outputSchema)Q.outputSchema=B1(X.outputSchema,{strictUnions:!0});return Q})})),this.server.setRequestHandler(Y1,async($,X)=>{let Q=this._registeredTools[$.params.name];if(!Q)throw new w$(H$.InvalidParams,`Tool ${$.params.name} not found`);if(!Q.enabled)throw new w$(H$.InvalidParams,`Tool ${$.params.name} disabled`);let J;if(Q.inputSchema){let G=await Q.inputSchema.safeParseAsync($.params.arguments);if(!G.success)throw new w$(H$.InvalidParams,`Invalid arguments for tool ${$.params.name}: ${G.error.message}`);let H=G.data,M=Q.callback;try{J=await Promise.resolve(M(H,X))}catch(z){J={content:[{type:"text",text:z instanceof Error?z.message:String(z)}],isError:!0}}}else{let G=Q.callback;try{J=await Promise.resolve(G(X))}catch(H){J={content:[{type:"text",text:H instanceof Error?H.message:String(H)}],isError:!0}}}if(Q.outputSchema){if(!J.structuredContent)throw new w$(H$.InvalidParams,`Tool ${$.params.name} has an output schema but no structured content was provided`);let G=await Q.outputSchema.safeParseAsync(J.structuredContent);if(!G.success)throw new w$(H$.InvalidParams,`Invalid structured content for tool ${$.params.name}: ${G.error.message}`)}return J}),this._toolHandlersInitialized=!0}setCompletionRequestHandler(){if(this._completionHandlerInitialized)return;this.server.assertCanSetRequestHandler(H1.shape.method.value),this.server.setRequestHandler(H1,async($)=>{switch($.params.ref.type){case"ref/prompt":return this.handlePromptCompletion($,$.params.ref);case"ref/resource":return this.handleResourceCompletion($,$.params.ref);default:throw new w$(H$.InvalidParams,`Invalid completion reference: ${$.params.ref}`)}}),this._completionHandlerInitialized=!0}async handlePromptCompletion($,X){let Q=this._registeredPrompts[X.name];if(!Q)throw new w$(H$.InvalidParams,`Prompt ${X.name} not found`);if(!Q.enabled)throw new w$(H$.InvalidParams,`Prompt ${X.name} disabled`);if(!Q.argsSchema)return D1;let J=Q.argsSchema.shape[$.params.argument.name];if(!(J instanceof u6))return D1;let H=await J._def.complete($.params.argument.value);return ZW(H)}async handleResourceCompletion($,X){let Q=Object.values(this._registeredResourceTemplates).find((H)=>H.resourceTemplate.uriTemplate.toString()===X.uri);if(!Q){if(this._registeredResources[X.uri])return D1;throw new w$(H$.InvalidParams,`Resource template ${$.params.ref.uri} not found`)}let J=Q.resourceTemplate.completeCallback($.params.argument.name);if(!J)return D1;let G=await J($.params.argument.value);return ZW(G)}setResourceRequestHandlers(){if(this._resourceHandlersInitialized)return;this.server.assertCanSetRequestHandler(tX.shape.method.value),this.server.assertCanSetRequestHandler(sX.shape.method.value),this.server.assertCanSetRequestHandler(eX.shape.method.value),this.server.registerCapabilities({resources:{listChanged:!0}}),this.server.setRequestHandler(tX,async($,X)=>{let Q=Object.entries(this._registeredResources).filter(([G,H])=>H.enabled).map(([G,H])=>({uri:G,name:H.name,...H.metadata})),J=[];for(let G of Object.values(this._registeredResourceTemplates)){if(!G.resourceTemplate.listCallback)continue;let H=await G.resourceTemplate.listCallback(X);for(let M of H.resources)J.push({...M,...G.metadata})}return{resources:[...Q,...J]}}),this.server.setRequestHandler(sX,async()=>{return{resourceTemplates:Object.entries(this._registeredResourceTemplates).map(([X,Q])=>({name:X,uriTemplate:Q.resourceTemplate.uriTemplate.toString(),...Q.metadata}))}}),this.server.setRequestHandler(eX,async($,X)=>{let Q=new URL($.params.uri),J=this._registeredResources[Q.toString()];if(J){if(!J.enabled)throw new w$(H$.InvalidParams,`Resource ${Q} disabled`);return J.readCallback(Q,X)}for(let G of Object.values(this._registeredResourceTemplates)){let H=G.resourceTemplate.uriTemplate.match(Q.toString());if(H)return G.readCallback(Q,H,X)}throw new w$(H$.InvalidParams,`Resource ${Q} not found`)}),this.setCompletionRequestHandler(),this._resourceHandlersInitialized=!0}setPromptRequestHandlers(){if(this._promptHandlersInitialized)return;this.server.assertCanSetRequestHandler($1.shape.method.value),this.server.assertCanSetRequestHandler(X1.shape.method.value),this.server.registerCapabilities({prompts:{listChanged:!0}}),this.server.setRequestHandler($1,()=>({prompts:Object.entries(this._registeredPrompts).filter(([,$])=>$.enabled).map(([$,X])=>{return{name:$,description:X.description,arguments:X.argsSchema?GG(X.argsSchema):void 0}})})),this.server.setRequestHandler(X1,async($,X)=>{let Q=this._registeredPrompts[$.params.name];if(!Q)throw new w$(H$.InvalidParams,`Prompt ${$.params.name} not found`);if(!Q.enabled)throw new w$(H$.InvalidParams,`Prompt ${$.params.name} disabled`);if(Q.argsSchema){let J=await Q.argsSchema.safeParseAsync($.params.arguments);if(!J.success)throw new w$(H$.InvalidParams,`Invalid arguments for prompt ${$.params.name}: ${J.error.message}`);let G=J.data,H=Q.callback;return await Promise.resolve(H(G,X))}else{let J=Q.callback;return await Promise.resolve(J(X))}}),this.setCompletionRequestHandler(),this._promptHandlersInitialized=!0}resource($,X,...Q){let J;if(typeof Q[0]==="object")J=Q.shift();let G=Q[0];if(typeof X==="string"){if(this._registeredResources[X])throw new Error(`Resource ${X} is already registered`);let H={name:$,metadata:J,readCallback:G,enabled:!0,disable:()=>H.update({enabled:!1}),enable:()=>H.update({enabled:!0}),remove:()=>H.update({uri:null}),update:(M)=>{if(typeof M.uri!=="undefined"&&M.uri!==X){if(delete this._registeredResources[X],M.uri)this._registeredResources[M.uri]=H}if(typeof M.name!=="undefined")H.name=M.name;if(typeof M.metadata!=="undefined")H.metadata=M.metadata;if(typeof M.callback!=="undefined")H.readCallback=M.callback;if(typeof M.enabled!=="undefined")H.enabled=M.enabled;this.sendResourceListChanged()}};return this._registeredResources[X]=H,this.setResourceRequestHandlers(),this.sendResourceListChanged(),H}else{if(this._registeredResourceTemplates[$])throw new Error(`Resource template ${$} is already registered`);let H={resourceTemplate:X,metadata:J,readCallback:G,enabled:!0,disable:()=>H.update({enabled:!1}),enable:()=>H.update({enabled:!0}),remove:()=>H.update({name:null}),update:(M)=>{if(typeof M.name!=="undefined"&&M.name!==$){if(delete this._registeredResourceTemplates[$],M.name)this._registeredResourceTemplates[M.name]=H}if(typeof M.template!=="undefined")H.resourceTemplate=M.template;if(typeof M.metadata!=="undefined")H.metadata=M.metadata;if(typeof M.callback!=="undefined")H.readCallback=M.callback;if(typeof M.enabled!=="undefined")H.enabled=M.enabled;this.sendResourceListChanged()}};return this._registeredResourceTemplates[$]=H,this.setResourceRequestHandlers(),this.sendResourceListChanged(),H}}_createRegisteredTool($,X,Q,J,G,H){let M={description:X,inputSchema:Q===void 0?void 0:D.object(Q),outputSchema:J===void 0?void 0:D.object(J),annotations:G,callback:H,enabled:!0,disable:()=>M.update({enabled:!1}),enable:()=>M.update({enabled:!0}),remove:()=>M.update({name:null}),update:(z)=>{if(typeof z.name!=="undefined"&&z.name!==$){if(delete this._registeredTools[$],z.name)this._registeredTools[z.name]=M}if(typeof z.description!=="undefined")M.description=z.description;if(typeof z.paramsSchema!=="undefined")M.inputSchema=D.object(z.paramsSchema);if(typeof z.callback!=="undefined")M.callback=z.callback;if(typeof z.annotations!=="undefined")M.annotations=z.annotations;if(typeof z.enabled!=="undefined")M.enabled=z.enabled;this.sendToolListChanged()}};return this._registeredTools[$]=M,this.setToolRequestHandlers(),this.sendToolListChanged(),M}tool($,...X){if(this._registeredTools[$])throw new Error(`Tool ${$} is already registered`);let Q,J,G,H;if(typeof X[0]==="string")Q=X.shift();if(X.length>1){let z=X[0];if(hW(z)){if(J=X.shift(),X.length>1&&typeof X[0]==="object"&&X[0]!==null&&!hW(X[0]))H=X.shift()}else if(typeof z==="object"&&z!==null)H=X.shift()}let M=X[0];return this._createRegisteredTool($,Q,J,G,H,M)}registerTool($,X,Q){if(this._registeredTools[$])throw new Error(`Tool ${$} is already registered`);let{description:J,inputSchema:G,outputSchema:H,annotations:M}=X;return this._createRegisteredTool($,J,G,H,M,Q)}prompt($,...X){if(this._registeredPrompts[$])throw new Error(`Prompt ${$} is already registered`);let Q;if(typeof X[0]==="string")Q=X.shift();let J;if(X.length>1)J=X.shift();let G=X[0],H={description:Q,argsSchema:J===void 0?void 0:D.object(J),callback:G,enabled:!0,disable:()=>H.update({enabled:!1}),enable:()=>H.update({enabled:!0}),remove:()=>H.update({name:null}),update:(M)=>{if(typeof M.name!=="undefined"&&M.name!==$){if(delete this._registeredPrompts[$],M.name)this._registeredPrompts[M.name]=H}if(typeof M.description!=="undefined")H.description=M.description;if(typeof M.argsSchema!=="undefined")H.argsSchema=D.object(M.argsSchema);if(typeof M.callback!=="undefined")H.callback=M.callback;if(typeof M.enabled!=="undefined")H.enabled=M.enabled;this.sendPromptListChanged()}};return this._registeredPrompts[$]=H,this.setPromptRequestHandlers(),this.sendPromptListChanged(),H}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 WG={type:"object"};function hW($){if(typeof $!=="object"||$===null)return!1;return Object.keys($).length===0||Object.values($).some(JG)}function JG($){return $!==null&&typeof $==="object"&&"parse"in $&&typeof $.parse==="function"&&"safeParse"in $&&typeof $.safeParse==="function"}function GG($){return Object.entries($.shape).map(([X,Q])=>({name:X,description:Q.description,required:!Q.isOptional()}))}function ZW($){return{completion:{values:$.slice(0,100),total:$.length,hasMore:$.length>100}}}var D1={completion:{values:[],hasMore:!1}};function yW($,X){let Q=process.argv,J=`--${$}=`;for(let G of Q)if(G.startsWith(J))return G.substring(J.length);return X}j4();var MG=Z$("FigmaConfig",1),n6=yW("figma-api-key")||process.env.FIGMA_API_KEY||process.env.personalToken||"",cW="F2C MCP",uW=process.env.FIGMA_VERSION||"0.0.1";MG.debug("DEFAULT_PERSONAL_TOKEN",n6);var nW=($)=>{};var pW=($)=>{nW($)};var e8=null;async function PG(){if(typeof global!=="undefined"&&global.fetch)return global.fetch;if(typeof globalThis.fetch!=="undefined")return globalThis.fetch;if(!e8)try{e8=await Promise.resolve().then(() => (s8(),t8))}catch($){throw new Error("Neither native fetch nor node-fetch is available. Please install node-fetch or upgrade to Node.js 18+")}return e8.default}async function bG($,X){return(await PG())($,X)}var X6=bG;j4();var ZJ=Z$("F2cApi",1);class yJ{f2cHost="https://f2c-figma-api.yy.com/api";personalToken=n6;async nodeToCode($){let X={fileKey:$.fileKey,nodeIds:$.ids,personal_token:$.personalToken||this.personalToken,option:{cssFramework:"inlinecss",imgFormat:$.imgFormat||"png",scaleSize:$.scaleSize||2},format:"files"};if($.format==="react-cssmodules")X.option.cssFramework="cssmodules";else if($.format==="react-tailwind")X.option.cssFramework="tailwindcss";let Q=this.opToUrl(`${this.f2cHost}/nodes`,X);return this.fetch(Q,"json")}async fetch($,X="json"){try{let Q={method:"GET",headers:{"F2c-Api-Platform":"mcp"}};ZJ.debug("fetch",$);let J=await X6($,Q);if(!J.ok)throw new Error(`HTTP error! status: ${J.status}`);return X==="text"?await J.text():await J.json()}catch(Q){throw ZJ.error("HTTP error",Q),Q}}opToUrl($,X={}){if(Object.keys(X).length===0)return $;let Q=new URL($);for(let[J,G]of Object.entries(X))if(typeof G==="object"&&G!==null)for(let[H,M]of Object.entries(G))Q.searchParams.append(`${J}[${H}]`,M);else Q.searchParams.append(J,G);return Q.toString()}}var mJ=new yJ;j4();var fG=Z$("FigmaRestApi");class lJ{figmaHost="https://api.figma.com/v1";personalToken=n6;async files($){let X;if($.ids)X=this.opToUrl(`${this.figmaHost}/files/${$.fileKey}/nodes`,$);else X=this.opToUrl(`${this.figmaHost}/files/${$.fileKey}`,$);return this.fetch(X)}async images($){let X=this.opToUrl(`${this.figmaHost}/images/${$.fileKey}`,$);return this.fetch(X)}async imageFills($){let X=this.opToUrl(`${this.figmaHost}/files/${$.fileKey}/images`,$);return this.fetch(X)}async meta($){let X=this.opToUrl(`${this.figmaHost}/files/${$.fileKey}/meta`,$);return this.fetch(X)}async fetch($,X="json"){try{let Q={method:"GET",headers:{"X-FIGMA-TOKEN":this.personalToken}},J=await X6($,Q);if(!J.ok)throw new Error(`HTTP error! status: ${J.status}`);return X==="text"?await J.text():await J.json()}catch(Q){throw fG.error("HTTP error",Q),Q}}opToUrl($,X={},Q=["fileKey","personalToken"]){if(Object.keys(X).length===0)return $;if(X.personalToken)this.personalToken=X.personalToken;let J=new URL($);for(let[G,H]of Object.entries(X))if(!Q.includes(G))J.searchParams.append(G,H);return J.toString()}}var cJ=new lJ;j4();var J5=C$(nJ());var V$={};U8(V$,{void:()=>jY,util:()=>s,unknown:()=>qY,union:()=>SY,undefined:()=>DY,tuple:()=>_Y,transformer:()=>TY,symbol:()=>BY,string:()=>$5,strictObject:()=>NY,setErrorMap:()=>xG,set:()=>vY,record:()=>LY,quotelessJson:()=>TG,promise:()=>fY,preprocess:()=>hY,pipeline:()=>ZY,ostring:()=>yY,optional:()=>gY,onumber:()=>mY,oboolean:()=>lY,objectUtil:()=>$Q,object:()=>UY,number:()=>X5,nullable:()=>xY,null:()=>VY,never:()=>AY,nativeEnum:()=>bY,nan:()=>MY,map:()=>RY,makeIssue:()=>e6,literal:()=>kY,lazy:()=>IY,late:()=>YY,isValid:()=>s0,isDirty:()=>v1,isAsync:()=>W6,isAborted:()=>R1,intersection:()=>EY,instanceof:()=>HY,getParsedType:()=>V0,getErrorMap:()=>Q6,function:()=>CY,enum:()=>PY,effect:()=>TY,discriminatedUnion:()=>FY,defaultErrorMap:()=>P0,datetimeRegex:()=>tJ,date:()=>zY,custom:()=>eJ,coerce:()=>cY,boolean:()=>Q5,bigint:()=>wY,array:()=>KY,any:()=>OY,addIssueToContext:()=>L,ZodVoid:()=>WX,ZodUnknown:()=>e0,ZodUnion:()=>w6,ZodUndefined:()=>H6,ZodType:()=>a,ZodTuple:()=>q0,ZodTransformer:()=>X0,ZodSymbol:()=>QX,ZodString:()=>t$,ZodSet:()=>L4,ZodSchema:()=>a,ZodRecord:()=>JX,ZodReadonly:()=>A6,ZodPromise:()=>R4,ZodPipeline:()=>HX,ZodParsedType:()=>E,ZodOptional:()=>e$,ZodObject:()=>M$,ZodNumber:()=>$4,ZodNullable:()=>f0,ZodNull:()=>M6,ZodNever:()=>O0,ZodNativeEnum:()=>V6,ZodNaN:()=>YX,ZodMap:()=>GX,ZodLiteral:()=>D6,ZodLazy:()=>B6,ZodIssueCode:()=>U,ZodIntersection:()=>z6,ZodFunction:()=>G6,ZodFirstPartyTypeKind:()=>m,ZodError:()=>R$,ZodEnum:()=>Q4,ZodEffects:()=>X0,ZodDiscriminatedUnion:()=>I1,ZodDefault:()=>O6,ZodDate:()=>E4,ZodCatch:()=>q6,ZodBranded:()=>k1,ZodBoolean:()=>Y6,ZodBigInt:()=>X4,ZodArray:()=>s$,ZodAny:()=>_4,Schema:()=>a,ParseStatus:()=>q$,OK:()=>K$,NEVER:()=>uY,INVALID:()=>y,EMPTY_PATH:()=>hG,DIRTY:()=>F4,BRAND:()=>GY});var s;(function($){$.assertEqual=(G)=>{};function X(G){}$.assertIs=X;function Q(G){throw new Error}$.assertNever=Q,$.arrayToEnum=(G)=>{let H={};for(let M of G)H[M]=M;return H},$.getValidEnumValues=(G)=>{let H=$.objectKeys(G).filter((z)=>typeof G[G[z]]!=="number"),M={};for(let z of H)M[z]=G[z];return $.objectValues(M)},$.objectValues=(G)=>{return $.objectKeys(G).map(function(H){return G[H]})},$.objectKeys=typeof Object.keys==="function"?(G)=>Object.keys(G):(G)=>{let H=[];for(let M in G)if(Object.prototype.hasOwnProperty.call(G,M))H.push(M);return H},$.find=(G,H)=>{for(let M of G)if(H(M))return M;return},$.isInteger=typeof Number.isInteger==="function"?(G)=>Number.isInteger(G):(G)=>typeof G==="number"&&Number.isFinite(G)&&Math.floor(G)===G;function J(G,H=" | "){return G.map((M)=>typeof M==="string"?`'${M}'`:M).join(H)}$.joinValues=J,$.jsonStringifyReplacer=(G,H)=>{if(typeof H==="bigint")return H.toString();return H}})(s||(s={}));var $Q;(function($){$.mergeShapes=(X,Q)=>{return{...X,...Q}}})($Q||($Q={}));var E=s.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),V0=($)=>{switch(typeof $){case"undefined":return E.undefined;case"string":return E.string;case"number":return Number.isNaN($)?E.nan:E.number;case"boolean":return E.boolean;case"function":return E.function;case"bigint":return E.bigint;case"symbol":return E.symbol;case"object":if(Array.isArray($))return E.array;if($===null)return E.null;if($.then&&typeof $.then==="function"&&$.catch&&typeof $.catch==="function")return E.promise;if(typeof Map!=="undefined"&&$ instanceof Map)return E.map;if(typeof Set!=="undefined"&&$ instanceof Set)return E.set;if(typeof Date!=="undefined"&&$ instanceof Date)return E.date;return E.object;default:return E.unknown}};var U=s.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"]),TG=($)=>{return JSON.stringify($,null,2).replace(/"([^"]+)":/g,"$1:")};class R$ 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:[]},J=(G)=>{for(let H of G.issues)if(H.code==="invalid_union")H.unionErrors.map(J);else if(H.code==="invalid_return_type")J(H.returnTypeError);else if(H.code==="invalid_arguments")J(H.argumentsError);else if(H.path.length===0)Q._errors.push(X(H));else{let M=Q,z=0;while(z<H.path.length){let B=H.path[z];if(z!==H.path.length-1)M[B]=M[B]||{_errors:[]};else M[B]=M[B]||{_errors:[]},M[B]._errors.push(X(H));M=M[B],z++}}};return J(this),Q}static assert($){if(!($ instanceof R$))throw new Error(`Not a ZodError: ${$}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,s.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten($=(X)=>X.message){let X={},Q=[];for(let J of this.issues)if(J.path.length>0)X[J.path[0]]=X[J.path[0]]||[],X[J.path[0]].push($(J));else Q.push($(J));return{formErrors:Q,fieldErrors:X}}get formErrors(){return this.flatten()}}R$.create=($)=>{return new R$($)};var gG=($,X)=>{let Q;switch($.code){case U.invalid_type:if($.received===E.undefined)Q="Required";else Q=`Expected ${$.expected}, received ${$.received}`;break;case U.invalid_literal:Q=`Invalid literal value, expected ${JSON.stringify($.expected,s.jsonStringifyReplacer)}`;break;case U.unrecognized_keys:Q=`Unrecognized key(s) in object: ${s.joinValues($.keys,", ")}`;break;case U.invalid_union:Q="Invalid input";break;case U.invalid_union_discriminator:Q=`Invalid discriminator value. Expected ${s.joinValues($.options)}`;break;case U.invalid_enum_value:Q=`Invalid enum value. Expected ${s.joinValues($.options)}, received '${$.received}'`;break;case U.invalid_arguments:Q="Invalid function arguments";break;case U.invalid_return_type:Q="Invalid function return type";break;case U.invalid_date:Q="Invalid date";break;case U.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 s.assertNever($.validation);else if($.validation!=="regex")Q=`Invalid ${$.validation}`;else Q="Invalid";break;case U.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==="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 U.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 U.custom:Q="Invalid input";break;case U.invalid_intersection_types:Q="Intersection results could not be merged";break;case U.not_multiple_of:Q=`Number must be a multiple of ${$.multipleOf}`;break;case U.not_finite:Q="Number must be finite";break;default:Q=X.defaultError,s.assertNever($)}return{message:Q}},P0=gG;var pJ=P0;function xG($){pJ=$}function Q6(){return pJ}var e6=($)=>{let{data:X,path:Q,errorMaps:J,issueData:G}=$,H=[...Q,...G.path||[]],M={...G,path:H};if(G.message!==void 0)return{...G,path:H,message:G.message};let z="",B=J.filter((O)=>!!O).slice().reverse();for(let O of B)z=O(M,{data:X,defaultError:z}).message;return{...G,path:H,message:z}},hG=[];function L($,X){let Q=Q6(),J=e6({issueData:X,data:$.data,path:$.path,errorMaps:[$.common.contextualErrorMap,$.schemaErrorMap,Q,Q===P0?void 0:P0].filter((G)=>!!G)});$.common.issues.push(J)}class q${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 J of X){if(J.status==="aborted")return y;if(J.status==="dirty")$.dirty();Q.push(J.value)}return{status:$.value,value:Q}}static async mergeObjectAsync($,X){let Q=[];for(let J of X){let G=await J.key,H=await J.value;Q.push({key:G,value:H})}return q$.mergeObjectSync($,Q)}static mergeObjectSync($,X){let Q={};for(let J of X){let{key:G,value:H}=J;if(G.status==="aborted")return y;if(H.status==="aborted")return y;if(G.status==="dirty")$.dirty();if(H.status==="dirty")$.dirty();if(G.value!=="__proto__"&&(typeof H.value!=="undefined"||J.alwaysSet))Q[G.value]=H.value}return{status:$.value,value:Q}}}var y=Object.freeze({status:"aborted"}),F4=($)=>({status:"dirty",value:$}),K$=($)=>({status:"valid",value:$}),R1=($)=>$.status==="aborted",v1=($)=>$.status==="dirty",s0=($)=>$.status==="valid",W6=($)=>typeof Promise!=="undefined"&&$ instanceof Promise;var k;(function($){$.errToObj=(X)=>typeof X==="string"?{message:X}:X||{},$.toString=(X)=>typeof X==="string"?X:X?.message})(k||(k={}));var C1=function($,X,Q,J){if(Q==="a"&&!J)throw new TypeError("Private accessor was defined without a getter");if(typeof X==="function"?$!==X||!J:!X.has($))throw new TypeError("Cannot read private member from an object whose class did not declare it");return Q==="m"?J:Q==="a"?J.call($):J?J.value:X.get($)},oJ=function($,X,Q,J,G){if(J==="m")throw new TypeError("Private method is not writable");if(J==="a"&&!G)throw new TypeError("Private accessor was defined without a setter");if(typeof X==="function"?$!==X||!G:!X.has($))throw new TypeError("Cannot write private member to an object whose class did not declare it");return J==="a"?G.call($,Q):G?G.value=Q:X.set($,Q),Q},$X,XX;class $0{constructor($,X,Q,J){this._cachedPath=[],this.parent=$,this.data=X,this._path=Q,this._key=J}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}}var iJ=($,X)=>{if(s0(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 R$($.common.issues);return this._error=Q,this._error}}}};function d($){if(!$)return{};let{errorMap:X,invalid_type_error:Q,required_error:J,description:G}=$;if(X&&(Q||J))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:(M,z)=>{let{message:B}=$;if(M.code==="invalid_enum_value")return{message:B??z.defaultError};if(typeof z.data==="undefined")return{message:B??J??z.defaultError};if(M.code!=="invalid_type")return{message:z.defaultError};return{message:B??Q??z.defaultError}},description:G}}class a{get description(){return this._def.description}_getType($){return V0($.data)}_getOrReturnCtx($,X){return X||{common:$.parent.common,data:$.data,parsedType:V0($.data),schemaErrorMap:this._def.errorMap,path:$.path,parent:$.parent}}_processInputParams($){return{status:new q$,ctx:{common:$.parent.common,data:$.data,parsedType:V0($.data),schemaErrorMap:this._def.errorMap,path:$.path,parent:$.parent}}}_parseSync($){let X=this._parse($);if(W6(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:V0($)},J=this._parseSync({data:$,path:Q.path,parent:Q});return iJ(Q,J)}"~validate"($){let X={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:$,parsedType:V0($)};if(!this["~standard"].async)try{let Q=this._parseSync({data:$,path:[],parent:X});return s0(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)=>s0(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:V0($)},J=this._parse({data:$,path:Q.path,parent:Q}),G=await(W6(J)?J:Promise.resolve(J));return iJ(Q,G)}refine($,X){let Q=(J)=>{if(typeof X==="string"||typeof X==="undefined")return{message:X};else if(typeof X==="function")return X(J);else return X};return this._refinement((J,G)=>{let H=$(J),M=()=>G.addIssue({code:U.custom,...Q(J)});if(typeof Promise!=="undefined"&&H instanceof Promise)return H.then((z)=>{if(!z)return M(),!1;else return!0});if(!H)return M(),!1;else return!0})}refinement($,X){return this._refinement((Q,J)=>{if(!$(Q))return J.addIssue(typeof X==="function"?X(Q,J):X),!1;else return!0})}_refinement($){return new X0({schema:this,typeName:m.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 e$.create(this,this._def)}nullable(){return f0.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return s$.create(this)}promise(){return R4.create(this,this._def)}or($){return w6.create([this,$],this._def)}and($){return z6.create(this,$,this._def)}transform($){return new X0({...d(this._def),schema:this,typeName:m.ZodEffects,effect:{type:"transform",transform:$}})}default($){let X=typeof $==="function"?$:()=>$;return new O6({...d(this._def),innerType:this,defaultValue:X,typeName:m.ZodDefault})}brand(){return new k1({typeName:m.ZodBranded,type:this,...d(this._def)})}catch($){let X=typeof $==="function"?$:()=>$;return new q6({...d(this._def),innerType:this,catchValue:X,typeName:m.ZodCatch})}describe($){return new this.constructor({...this._def,description:$})}pipe($){return HX.create(this,$)}readonly(){return A6.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}var ZG=/^c[^\s-]{8,}$/i,yG=/^[0-9a-z]+$/,mG=/^[0-9A-HJKMNP-TV-Z]{26}$/i,lG=/^[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,cG=/^[a-z0-9_-]{21}$/i,uG=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,nG=/^[-+]?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)?)??$/,pG=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,iG="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",XQ,dG=/^(?:(?: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])$/,oG=/^(?:(?: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])$/,aG=/^(([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]))$/,rG=/^(([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])$/,tG=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,sG=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,aJ="((\\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])))",eG=new RegExp(`^${aJ}$`);function rJ($){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 $Y($){return new RegExp(`^${rJ($)}$`)}function tJ($){let X=`${aJ}T${rJ($)}`,Q=[];if(Q.push($.local?"Z?":"Z"),$.offset)Q.push("([+-]\\d{2}:?\\d{2})");return X=`${X}(${Q.join("|")})`,new RegExp(`^${X}$`)}function XY($,X){if((X==="v4"||!X)&&dG.test($))return!0;if((X==="v6"||!X)&&aG.test($))return!0;return!1}function QY($,X){if(!uG.test($))return!1;try{let[Q]=$.split("."),J=Q.replace(/-/g,"+").replace(/_/g,"/").padEnd(Q.length+(4-Q.length%4)%4,"="),G=JSON.parse(atob(J));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 WY($,X){if((X==="v4"||!X)&&oG.test($))return!0;if((X==="v6"||!X)&&rG.test($))return!0;return!1}class t$ extends a{_parse($){if(this._def.coerce)$.data=String($.data);if(this._getType($)!==E.string){let G=this._getOrReturnCtx($);return L(G,{code:U.invalid_type,expected:E.string,received:G.parsedType}),y}let Q=new q$,J=void 0;for(let G of this._def.checks)if(G.kind==="min"){if($.data.length<G.value)J=this._getOrReturnCtx($,J),L(J,{code:U.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)J=this._getOrReturnCtx($,J),L(J,{code:U.too_big,maximum:G.value,type:"string",inclusive:!0,exact:!1,message:G.message}),Q.dirty()}else if(G.kind==="length"){let H=$.data.length>G.value,M=$.data.length<G.value;if(H||M){if(J=this._getOrReturnCtx($,J),H)L(J,{code:U.too_big,maximum:G.value,type:"string",inclusive:!0,exact:!0,message:G.message});else if(M)L(J,{code:U.too_small,minimum:G.value,type:"string",inclusive:!0,exact:!0,message:G.message});Q.dirty()}}else if(G.kind==="email"){if(!pG.test($.data))J=this._getOrReturnCtx($,J),L(J,{validation:"email",code:U.invalid_string,message:G.message}),Q.dirty()}else if(G.kind==="emoji"){if(!XQ)XQ=new RegExp(iG,"u");if(!XQ.test($.data))J=this._getOrReturnCtx($,J),L(J,{validation:"emoji",code:U.invalid_string,message:G.message}),Q.dirty()}else if(G.kind==="uuid"){if(!lG.test($.data))J=this._getOrReturnCtx($,J),L(J,{validation:"uuid",code:U.invalid_string,message:G.message}),Q.dirty()}else if(G.kind==="nanoid"){if(!cG.test($.data))J=this._getOrReturnCtx($,J),L(J,{validation:"nanoid",code:U.invalid_string,message:G.message}),Q.dirty()}else if(G.kind==="cuid"){if(!ZG.test($.data))J=this._getOrReturnCtx($,J),L(J,{validation:"cuid",code:U.invalid_string,message:G.message}),Q.dirty()}else if(G.kind==="cuid2"){if(!yG.test($.data))J=this._getOrReturnCtx($,J),L(J,{validation:"cuid2",code:U.invalid_string,message:G.message}),Q.dirty()}else if(G.kind==="ulid"){if(!mG.test($.data))J=this._getOrReturnCtx($,J),L(J,{validation:"ulid",code:U.invalid_string,message:G.message}),Q.dirty()}else if(G.kind==="url")try{new URL($.data)}catch{J=this._getOrReturnCtx($,J),L(J,{validation:"url",code:U.invalid_string,message:G.message}),Q.dirty()}else if(G.kind==="regex"){if(G.regex.lastIndex=0,!G.regex.test($.data))J=this._getOrReturnCtx($,J),L(J,{validation:"regex",code:U.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))J=this._getOrReturnCtx($,J),L(J,{code:U.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))J=this._getOrReturnCtx($,J),L(J,{code:U.invalid_string,validation:{startsWith:G.value},message:G.message}),Q.dirty()}else if(G.kind==="endsWith"){if(!$.data.endsWith(G.value))J=this._getOrReturnCtx($,J),L(J,{code:U.invalid_string,validation:{endsWith:G.value},message:G.message}),Q.dirty()}else if(G.kind==="datetime"){if(!tJ(G).test($.data))J=this._getOrReturnCtx($,J),L(J,{code:U.invalid_string,validation:"datetime",message:G.message}),Q.dirty()}else if(G.kind==="date"){if(!eG.test($.data))J=this._getOrReturnCtx($,J),L(J,{code:U.invalid_string,validation:"date",message:G.message}),Q.dirty()}else if(G.kind==="time"){if(!$Y(G).test($.data))J=this._getOrReturnCtx($,J),L(J,{code:U.invalid_string,validation:"time",message:G.message}),Q.dirty()}else if(G.kind==="duration"){if(!nG.test($.data))J=this._getOrReturnCtx($,J),L(J,{validation:"duration",code:U.invalid_string,message:G.message}),Q.dirty()}else if(G.kind==="ip"){if(!XY($.data,G.version))J=this._getOrReturnCtx($,J),L(J,{validation:"ip",code:U.invalid_string,message:G.message}),Q.dirty()}else if(G.kind==="jwt"){if(!QY($.data,G.alg))J=this._getOrReturnCtx($,J),L(J,{validation:"jwt",code:U.invalid_string,message:G.message}),Q.dirty()}else if(G.kind==="cidr"){if(!WY($.data,G.version))J=this._getOrReturnCtx($,J),L(J,{validation:"cidr",code:U.invalid_string,message:G.message}),Q.dirty()}else if(G.kind==="base64"){if(!tG.test($.data))J=this._getOrReturnCtx($,J),L(J,{validation:"base64",code:U.invalid_string,message:G.message}),Q.dirty()}else if(G.kind==="base64url"){if(!sG.test($.data))J=this._getOrReturnCtx($,J),L(J,{validation:"base64url",code:U.invalid_string,message:G.message}),Q.dirty()}else s.assertNever(G);return{status:Q.value,value:$.data}}_regex($,X,Q){return this.refinement((J)=>$.test(J),{validation:X,code:U.invalid_string,...k.errToObj(Q)})}_addCheck($){return new t$({...this._def,checks:[...this._def.checks,$]})}email($){return this._addCheck({kind:"email",...k.errToObj($)})}url($){return this._addCheck({kind:"url",...k.errToObj($)})}emoji($){return this._addCheck({kind:"emoji",...k.errToObj($)})}uuid($){return this._addCheck({kind:"uuid",...k.errToObj($)})}nanoid($){return this._addCheck({kind:"nanoid",...k.errToObj($)})}cuid($){return this._addCheck({kind:"cuid",...k.errToObj($)})}cuid2($){return this._addCheck({kind:"cuid2",...k.errToObj($)})}ulid($){return this._addCheck({kind:"ulid",...k.errToObj($)})}base64($){return this._addCheck({kind:"base64",...k.errToObj($)})}base64url($){return this._addCheck({kind:"base64url",...k.errToObj($)})}jwt($){return this._addCheck({kind:"jwt",...k.errToObj($)})}ip($){return this._addCheck({kind:"ip",...k.errToObj($)})}cidr($){return this._addCheck({kind:"cidr",...k.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,...k.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,...k.errToObj($?.message)})}duration($){return this._addCheck({kind:"duration",...k.errToObj($)})}regex($,X){return this._addCheck({kind:"regex",regex:$,...k.errToObj(X)})}includes($,X){return this._addCheck({kind:"includes",value:$,position:X?.position,...k.errToObj(X?.message)})}startsWith($,X){return this._addCheck({kind:"startsWith",value:$,...k.errToObj(X)})}endsWith($,X){return this._addCheck({kind:"endsWith",value:$,...k.errToObj(X)})}min($,X){return this._addCheck({kind:"min",value:$,...k.errToObj(X)})}max($,X){return this._addCheck({kind:"max",value:$,...k.errToObj(X)})}length($,X){return this._addCheck({kind:"length",value:$,...k.errToObj(X)})}nonempty($){return this.min(1,k.errToObj($))}trim(){return new t$({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new t$({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new t$({...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 $}}t$.create=($)=>{return new t$({checks:[],typeName:m.ZodString,coerce:$?.coerce??!1,...d($)})};function JY($,X){let Q=($.toString().split(".")[1]||"").length,J=(X.toString().split(".")[1]||"").length,G=Q>J?Q:J,H=Number.parseInt($.toFixed(G).replace(".","")),M=Number.parseInt(X.toFixed(G).replace(".",""));return H%M/10**G}class $4 extends a{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($)!==E.number){let G=this._getOrReturnCtx($);return L(G,{code:U.invalid_type,expected:E.number,received:G.parsedType}),y}let Q=void 0,J=new q$;for(let G of this._def.checks)if(G.kind==="int"){if(!s.isInteger($.data))Q=this._getOrReturnCtx($,Q),L(Q,{code:U.invalid_type,expected:"integer",received:"float",message:G.message}),J.dirty()}else if(G.kind==="min"){if(G.inclusive?$.data<G.value:$.data<=G.value)Q=this._getOrReturnCtx($,Q),L(Q,{code:U.too_small,minimum:G.value,type:"number",inclusive:G.inclusive,exact:!1,message:G.message}),J.dirty()}else if(G.kind==="max"){if(G.inclusive?$.data>G.value:$.data>=G.value)Q=this._getOrReturnCtx($,Q),L(Q,{code:U.too_big,maximum:G.value,type:"number",inclusive:G.inclusive,exact:!1,message:G.message}),J.dirty()}else if(G.kind==="multipleOf"){if(JY($.data,G.value)!==0)Q=this._getOrReturnCtx($,Q),L(Q,{code:U.not_multiple_of,multipleOf:G.value,message:G.message}),J.dirty()}else if(G.kind==="finite"){if(!Number.isFinite($.data))Q=this._getOrReturnCtx($,Q),L(Q,{code:U.not_finite,message:G.message}),J.dirty()}else s.assertNever(G);return{status:J.value,value:$.data}}gte($,X){return this.setLimit("min",$,!0,k.toString(X))}gt($,X){return this.setLimit("min",$,!1,k.toString(X))}lte($,X){return this.setLimit("max",$,!0,k.toString(X))}lt($,X){return this.setLimit("max",$,!1,k.toString(X))}setLimit($,X,Q,J){return new $4({...this._def,checks:[...this._def.checks,{kind:$,value:X,inclusive:Q,message:k.toString(J)}]})}_addCheck($){return new $4({...this._def,checks:[...this._def.checks,$]})}int($){return this._addCheck({kind:"int",message:k.toString($)})}positive($){return this._addCheck({kind:"min",value:0,inclusive:!1,message:k.toString($)})}negative($){return this._addCheck({kind:"max",value:0,inclusive:!1,message:k.toString($)})}nonpositive($){return this._addCheck({kind:"max",value:0,inclusive:!0,message:k.toString($)})}nonnegative($){return this._addCheck({kind:"min",value:0,inclusive:!0,message:k.toString($)})}multipleOf($,X){return this._addCheck({kind:"multipleOf",value:$,message:k.toString(X)})}finite($){return this._addCheck({kind:"finite",message:k.toString($)})}safe($){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:k.toString($)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:k.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"&&s.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($)}}$4.create=($)=>{return new $4({checks:[],typeName:m.ZodNumber,coerce:$?.coerce||!1,...d($)})};class X4 extends a{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($)!==E.bigint)return this._getInvalidInput($);let Q=void 0,J=new q$;for(let G of this._def.checks)if(G.kind==="min"){if(G.inclusive?$.data<G.value:$.data<=G.value)Q=this._getOrReturnCtx($,Q),L(Q,{code:U.too_small,type:"bigint",minimum:G.value,inclusive:G.inclusive,message:G.message}),J.dirty()}else if(G.kind==="max"){if(G.inclusive?$.data>G.value:$.data>=G.value)Q=this._getOrReturnCtx($,Q),L(Q,{code:U.too_big,type:"bigint",maximum:G.value,inclusive:G.inclusive,message:G.message}),J.dirty()}else if(G.kind==="multipleOf"){if($.data%G.value!==BigInt(0))Q=this._getOrReturnCtx($,Q),L(Q,{code:U.not_multiple_of,multipleOf:G.value,message:G.message}),J.dirty()}else s.assertNever(G);return{status:J.value,value:$.data}}_getInvalidInput($){let X=this._getOrReturnCtx($);return L(X,{code:U.invalid_type,expected:E.bigint,received:X.parsedType}),y}gte($,X){return this.setLimit("min",$,!0,k.toString(X))}gt($,X){return this.setLimit("min",$,!1,k.toString(X))}lte($,X){return this.setLimit("max",$,!0,k.toString(X))}lt($,X){return this.setLimit("max",$,!1,k.toString(X))}setLimit($,X,Q,J){return new X4({...this._def,checks:[...this._def.checks,{kind:$,value:X,inclusive:Q,message:k.toString(J)}]})}_addCheck($){return new X4({...this._def,checks:[...this._def.checks,$]})}positive($){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:k.toString($)})}negative($){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:k.toString($)})}nonpositive($){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:k.toString($)})}nonnegative($){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:k.toString($)})}multipleOf($,X){return this._addCheck({kind:"multipleOf",value:$,message:k.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 $}}X4.create=($)=>{return new X4({checks:[],typeName:m.ZodBigInt,coerce:$?.coerce??!1,...d($)})};class Y6 extends a{_parse($){if(this._def.coerce)$.data=Boolean($.data);if(this._getType($)!==E.boolean){let Q=this._getOrReturnCtx($);return L(Q,{code:U.invalid_type,expected:E.boolean,received:Q.parsedType}),y}return K$($.data)}}Y6.create=($)=>{return new Y6({typeName:m.ZodBoolean,coerce:$?.coerce||!1,...d($)})};class E4 extends a{_parse($){if(this._def.coerce)$.data=new Date($.data);if(this._getType($)!==E.date){let G=this._getOrReturnCtx($);return L(G,{code:U.invalid_type,expected:E.date,received:G.parsedType}),y}if(Number.isNaN($.data.getTime())){let G=this._getOrReturnCtx($);return L(G,{code:U.invalid_date}),y}let Q=new q$,J=void 0;for(let G of this._def.checks)if(G.kind==="min"){if($.data.getTime()<G.value)J=this._getOrReturnCtx($,J),L(J,{code:U.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)J=this._getOrReturnCtx($,J),L(J,{code:U.too_big,message:G.message,inclusive:!0,exact:!1,maximum:G.value,type:"date"}),Q.dirty()}else s.assertNever(G);return{status:Q.value,value:new Date($.data.getTime())}}_addCheck($){return new E4({...this._def,checks:[...this._def.checks,$]})}min($,X){return this._addCheck({kind:"min",value:$.getTime(),message:k.toString(X)})}max($,X){return this._addCheck({kind:"max",value:$.getTime(),message:k.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}}E4.create=($)=>{return new E4({checks:[],coerce:$?.coerce||!1,typeName:m.ZodDate,...d($)})};class QX extends a{_parse($){if(this._getType($)!==E.symbol){let Q=this._getOrReturnCtx($);return L(Q,{code:U.invalid_type,expected:E.symbol,received:Q.parsedType}),y}return K$($.data)}}QX.create=($)=>{return new QX({typeName:m.ZodSymbol,...d($)})};class H6 extends a{_parse($){if(this._getType($)!==E.undefined){let Q=this._getOrReturnCtx($);return L(Q,{code:U.invalid_type,expected:E.undefined,received:Q.parsedType}),y}return K$($.data)}}H6.create=($)=>{return new H6({typeName:m.ZodUndefined,...d($)})};class M6 extends a{_parse($){if(this._getType($)!==E.null){let Q=this._getOrReturnCtx($);return L(Q,{code:U.invalid_type,expected:E.null,received:Q.parsedType}),y}return K$($.data)}}M6.create=($)=>{return new M6({typeName:m.ZodNull,...d($)})};class _4 extends a{constructor(){super(...arguments);this._any=!0}_parse($){return K$($.data)}}_4.create=($)=>{return new _4({typeName:m.ZodAny,...d($)})};class e0 extends a{constructor(){super(...arguments);this._unknown=!0}_parse($){return K$($.data)}}e0.create=($)=>{return new e0({typeName:m.ZodUnknown,...d($)})};class O0 extends a{_parse($){let X=this._getOrReturnCtx($);return L(X,{code:U.invalid_type,expected:E.never,received:X.parsedType}),y}}O0.create=($)=>{return new O0({typeName:m.ZodNever,...d($)})};class WX extends a{_parse($){if(this._getType($)!==E.undefined){let Q=this._getOrReturnCtx($);return L(Q,{code:U.invalid_type,expected:E.void,received:Q.parsedType}),y}return K$($.data)}}WX.create=($)=>{return new WX({typeName:m.ZodVoid,...d($)})};class s$ extends a{_parse($){let{ctx:X,status:Q}=this._processInputParams($),J=this._def;if(X.parsedType!==E.array)return L(X,{code:U.invalid_type,expected:E.array,received:X.parsedType}),y;if(J.exactLength!==null){let H=X.data.length>J.exactLength.value,M=X.data.length<J.exactLength.value;if(H||M)L(X,{code:H?U.too_big:U.too_small,minimum:M?J.exactLength.value:void 0,maximum:H?J.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:J.exactLength.message}),Q.dirty()}if(J.minLength!==null){if(X.data.length<J.minLength.value)L(X,{code:U.too_small,minimum:J.minLength.value,type:"array",inclusive:!0,exact:!1,message:J.minLength.message}),Q.dirty()}if(J.maxLength!==null){if(X.data.length>J.maxLength.value)L(X,{code:U.too_big,maximum:J.maxLength.value,type:"array",inclusive:!0,exact:!1,message:J.maxLength.message}),Q.dirty()}if(X.common.async)return Promise.all([...X.data].map((H,M)=>{return J.type._parseAsync(new $0(X,H,X.path,M))})).then((H)=>{return q$.mergeArray(Q,H)});let G=[...X.data].map((H,M)=>{return J.type._parseSync(new $0(X,H,X.path,M))});return q$.mergeArray(Q,G)}get element(){return this._def.type}min($,X){return new s$({...this._def,minLength:{value:$,message:k.toString(X)}})}max($,X){return new s$({...this._def,maxLength:{value:$,message:k.toString(X)}})}length($,X){return new s$({...this._def,exactLength:{value:$,message:k.toString(X)}})}nonempty($){return this.min(1,$)}}s$.create=($,X)=>{return new s$({type:$,minLength:null,maxLength:null,exactLength:null,typeName:m.ZodArray,...d(X)})};function J6($){if($ instanceof M$){let X={};for(let Q in $.shape){let J=$.shape[Q];X[Q]=e$.create(J6(J))}return new M$({...$._def,shape:()=>X})}else if($ instanceof s$)return new s$({...$._def,type:J6($.element)});else if($ instanceof e$)return e$.create(J6($.unwrap()));else if($ instanceof f0)return f0.create(J6($.unwrap()));else if($ instanceof q0)return q0.create($.items.map((X)=>J6(X)));else return $}class M$ extends a{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=s.objectKeys($);return this._cached={shape:$,keys:X},this._cached}_parse($){if(this._getType($)!==E.object){let B=this._getOrReturnCtx($);return L(B,{code:U.invalid_type,expected:E.object,received:B.parsedType}),y}let{status:Q,ctx:J}=this._processInputParams($),{shape:G,keys:H}=this._getCached(),M=[];if(!(this._def.catchall instanceof O0&&this._def.unknownKeys==="strip")){for(let B in J.data)if(!H.includes(B))M.push(B)}let z=[];for(let B of H){let O=G[B],q=J.data[B];z.push({key:{status:"valid",value:B},value:O._parse(new $0(J,q,J.path,B)),alwaysSet:B in J.data})}if(this._def.catchall instanceof O0){let B=this._def.unknownKeys;if(B==="passthrough")for(let O of M)z.push({key:{status:"valid",value:O},value:{status:"valid",value:J.data[O]}});else if(B==="strict"){if(M.length>0)L(J,{code:U.unrecognized_keys,keys:M}),Q.dirty()}else if(B==="strip");else throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let B=this._def.catchall;for(let O of M){let q=J.data[O];z.push({key:{status:"valid",value:O},value:B._parse(new $0(J,q,J.path,O)),alwaysSet:O in J.data})}}if(J.common.async)return Promise.resolve().then(async()=>{let B=[];for(let O of z){let q=await O.key,x=await O.value;B.push({key:q,value:x,alwaysSet:O.alwaysSet})}return B}).then((B)=>{return q$.mergeObjectSync(Q,B)});else return q$.mergeObjectSync(Q,z)}get shape(){return this._def.shape()}strict($){return k.errToObj,new M$({...this._def,unknownKeys:"strict",...$!==void 0?{errorMap:(X,Q)=>{let J=this._def.errorMap?.(X,Q).message??Q.defaultError;if(X.code==="unrecognized_keys")return{message:k.errToObj($).message??J};return{message:J}}}:{}})}strip(){return new M$({...this._def,unknownKeys:"strip"})}passthrough(){return new M$({...this._def,unknownKeys:"passthrough"})}extend($){return new M$({...this._def,shape:()=>({...this._def.shape(),...$})})}merge($){return new M$({unknownKeys:$._def.unknownKeys,catchall:$._def.catchall,shape:()=>({...this._def.shape(),...$._def.shape()}),typeName:m.ZodObject})}setKey($,X){return this.augment({[$]:X})}catchall($){return new M$({...this._def,catchall:$})}pick($){let X={};for(let Q of s.objectKeys($))if($[Q]&&this.shape[Q])X[Q]=this.shape[Q];return new M$({...this._def,shape:()=>X})}omit($){let X={};for(let Q of s.objectKeys(this.shape))if(!$[Q])X[Q]=this.shape[Q];return new M$({...this._def,shape:()=>X})}deepPartial(){return J6(this)}partial($){let X={};for(let Q of s.objectKeys(this.shape)){let J=this.shape[Q];if($&&!$[Q])X[Q]=J;else X[Q]=J.optional()}return new M$({...this._def,shape:()=>X})}required($){let X={};for(let Q of s.objectKeys(this.shape))if($&&!$[Q])X[Q]=this.shape[Q];else{let G=this.shape[Q];while(G instanceof e$)G=G._def.innerType;X[Q]=G}return new M$({...this._def,shape:()=>X})}keyof(){return sJ(s.objectKeys(this.shape))}}M$.create=($,X)=>{return new M$({shape:()=>$,unknownKeys:"strip",catchall:O0.create(),typeName:m.ZodObject,...d(X)})};M$.strictCreate=($,X)=>{return new M$({shape:()=>$,unknownKeys:"strict",catchall:O0.create(),typeName:m.ZodObject,...d(X)})};M$.lazycreate=($,X)=>{return new M$({shape:$,unknownKeys:"strip",catchall:O0.create(),typeName:m.ZodObject,...d(X)})};class w6 extends a{_parse($){let{ctx:X}=this._processInputParams($),Q=this._def.options;function J(G){for(let M of G)if(M.result.status==="valid")return M.result;for(let M of G)if(M.result.status==="dirty")return X.common.issues.push(...M.ctx.common.issues),M.result;let H=G.map((M)=>new R$(M.ctx.common.issues));return L(X,{code:U.invalid_union,unionErrors:H}),y}if(X.common.async)return Promise.all(Q.map(async(G)=>{let H={...X,common:{...X.common,issues:[]},parent:null};return{result:await G._parseAsync({data:X.data,path:X.path,parent:H}),ctx:H}})).then(J);else{let G=void 0,H=[];for(let z of Q){let B={...X,common:{...X.common,issues:[]},parent:null},O=z._parseSync({data:X.data,path:X.path,parent:B});if(O.status==="valid")return O;else if(O.status==="dirty"&&!G)G={result:O,ctx:B};if(B.common.issues.length)H.push(B.common.issues)}if(G)return X.common.issues.push(...G.ctx.common.issues),G.result;let M=H.map((z)=>new R$(z));return L(X,{code:U.invalid_union,unionErrors:M}),y}}get options(){return this._def.options}}w6.create=($,X)=>{return new w6({options:$,typeName:m.ZodUnion,...d(X)})};var b0=($)=>{if($ instanceof B6)return b0($.schema);else if($ instanceof X0)return b0($.innerType());else if($ instanceof D6)return[$.value];else if($ instanceof Q4)return $.options;else if($ instanceof V6)return s.objectValues($.enum);else if($ instanceof O6)return b0($._def.innerType);else if($ instanceof H6)return[void 0];else if($ instanceof M6)return[null];else if($ instanceof e$)return[void 0,...b0($.unwrap())];else if($ instanceof f0)return[null,...b0($.unwrap())];else if($ instanceof k1)return b0($.unwrap());else if($ instanceof A6)return b0($.unwrap());else if($ instanceof q6)return b0($._def.innerType);else return[]};class I1 extends a{_parse($){let{ctx:X}=this._processInputParams($);if(X.parsedType!==E.object)return L(X,{code:U.invalid_type,expected:E.object,received:X.parsedType}),y;let Q=this.discriminator,J=X.data[Q],G=this.optionsMap.get(J);if(!G)return L(X,{code:U.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[Q]}),y;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 J=new Map;for(let G of X){let H=b0(G.shape[$]);if(!H.length)throw new Error(`A discriminator value for key \`${$}\` could not be extracted from all schema options`);for(let M of H){if(J.has(M))throw new Error(`Discriminator property ${String($)} has duplicate value ${String(M)}`);J.set(M,G)}}return new I1({typeName:m.ZodDiscriminatedUnion,discriminator:$,options:X,optionsMap:J,...d(Q)})}}function QQ($,X){let Q=V0($),J=V0(X);if($===X)return{valid:!0,data:$};else if(Q===E.object&&J===E.object){let G=s.objectKeys(X),H=s.objectKeys($).filter((z)=>G.indexOf(z)!==-1),M={...$,...X};for(let z of H){let B=QQ($[z],X[z]);if(!B.valid)return{valid:!1};M[z]=B.data}return{valid:!0,data:M}}else if(Q===E.array&&J===E.array){if($.length!==X.length)return{valid:!1};let G=[];for(let H=0;H<$.length;H++){let M=$[H],z=X[H],B=QQ(M,z);if(!B.valid)return{valid:!1};G.push(B.data)}return{valid:!0,data:G}}else if(Q===E.date&&J===E.date&&+$===+X)return{valid:!0,data:$};else return{valid:!1}}class z6 extends a{_parse($){let{status:X,ctx:Q}=this._processInputParams($),J=(G,H)=>{if(R1(G)||R1(H))return y;let M=QQ(G.value,H.value);if(!M.valid)return L(Q,{code:U.invalid_intersection_types}),y;if(v1(G)||v1(H))X.dirty();return{status:X.value,value:M.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,H])=>J(G,H));else return J(this._def.left._parseSync({data:Q.data,path:Q.path,parent:Q}),this._def.right._parseSync({data:Q.data,path:Q.path,parent:Q}))}}z6.create=($,X,Q)=>{return new z6({left:$,right:X,typeName:m.ZodIntersection,...d(Q)})};class q0 extends a{_parse($){let{status:X,ctx:Q}=this._processInputParams($);if(Q.parsedType!==E.array)return L(Q,{code:U.invalid_type,expected:E.array,received:Q.parsedType}),y;if(Q.data.length<this._def.items.length)return L(Q,{code:U.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),y;if(!this._def.rest&&Q.data.length>this._def.items.length)L(Q,{code:U.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),X.dirty();let G=[...Q.data].map((H,M)=>{let z=this._def.items[M]||this._def.rest;if(!z)return null;return z._parse(new $0(Q,H,Q.path,M))}).filter((H)=>!!H);if(Q.common.async)return Promise.all(G).then((H)=>{return q$.mergeArray(X,H)});else return q$.mergeArray(X,G)}get items(){return this._def.items}rest($){return new q0({...this._def,rest:$})}}q0.create=($,X)=>{if(!Array.isArray($))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new q0({items:$,typeName:m.ZodTuple,rest:null,...d(X)})};class JX extends a{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse($){let{status:X,ctx:Q}=this._processInputParams($);if(Q.parsedType!==E.object)return L(Q,{code:U.invalid_type,expected:E.object,received:Q.parsedType}),y;let J=[],G=this._def.keyType,H=this._def.valueType;for(let M in Q.data)J.push({key:G._parse(new $0(Q,M,Q.path,M)),value:H._parse(new $0(Q,Q.data[M],Q.path,M)),alwaysSet:M in Q.data});if(Q.common.async)return q$.mergeObjectAsync(X,J);else return q$.mergeObjectSync(X,J)}get element(){return this._def.valueType}static create($,X,Q){if(X instanceof a)return new JX({keyType:$,valueType:X,typeName:m.ZodRecord,...d(Q)});return new JX({keyType:t$.create(),valueType:$,typeName:m.ZodRecord,...d(X)})}}class GX extends a{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse($){let{status:X,ctx:Q}=this._processInputParams($);if(Q.parsedType!==E.map)return L(Q,{code:U.invalid_type,expected:E.map,received:Q.parsedType}),y;let J=this._def.keyType,G=this._def.valueType,H=[...Q.data.entries()].map(([M,z],B)=>{return{key:J._parse(new $0(Q,M,Q.path,[B,"key"])),value:G._parse(new $0(Q,z,Q.path,[B,"value"]))}});if(Q.common.async){let M=new Map;return Promise.resolve().then(async()=>{for(let z of H){let B=await z.key,O=await z.value;if(B.status==="aborted"||O.status==="aborted")return y;if(B.status==="dirty"||O.status==="dirty")X.dirty();M.set(B.value,O.value)}return{status:X.value,value:M}})}else{let M=new Map;for(let z of H){let{key:B,value:O}=z;if(B.status==="aborted"||O.status==="aborted")return y;if(B.status==="dirty"||O.status==="dirty")X.dirty();M.set(B.value,O.value)}return{status:X.value,value:M}}}}GX.create=($,X,Q)=>{return new GX({valueType:X,keyType:$,typeName:m.ZodMap,...d(Q)})};class L4 extends a{_parse($){let{status:X,ctx:Q}=this._processInputParams($);if(Q.parsedType!==E.set)return L(Q,{code:U.invalid_type,expected:E.set,received:Q.parsedType}),y;let J=this._def;if(J.minSize!==null){if(Q.data.size<J.minSize.value)L(Q,{code:U.too_small,minimum:J.minSize.value,type:"set",inclusive:!0,exact:!1,message:J.minSize.message}),X.dirty()}if(J.maxSize!==null){if(Q.data.size>J.maxSize.value)L(Q,{code:U.too_big,maximum:J.maxSize.value,type:"set",inclusive:!0,exact:!1,message:J.maxSize.message}),X.dirty()}let G=this._def.valueType;function H(z){let B=new Set;for(let O of z){if(O.status==="aborted")return y;if(O.status==="dirty")X.dirty();B.add(O.value)}return{status:X.value,value:B}}let M=[...Q.data.values()].map((z,B)=>G._parse(new $0(Q,z,Q.path,B)));if(Q.common.async)return Promise.all(M).then((z)=>H(z));else return H(M)}min($,X){return new L4({...this._def,minSize:{value:$,message:k.toString(X)}})}max($,X){return new L4({...this._def,maxSize:{value:$,message:k.toString(X)}})}size($,X){return this.min($,X).max($,X)}nonempty($){return this.min(1,$)}}L4.create=($,X)=>{return new L4({valueType:$,minSize:null,maxSize:null,typeName:m.ZodSet,...d(X)})};class G6 extends a{constructor(){super(...arguments);this.validate=this.implement}_parse($){let{ctx:X}=this._processInputParams($);if(X.parsedType!==E.function)return L(X,{code:U.invalid_type,expected:E.function,received:X.parsedType}),y;function Q(M,z){return e6({data:M,path:X.path,errorMaps:[X.common.contextualErrorMap,X.schemaErrorMap,Q6(),P0].filter((B)=>!!B),issueData:{code:U.invalid_arguments,argumentsError:z}})}function J(M,z){return e6({data:M,path:X.path,errorMaps:[X.common.contextualErrorMap,X.schemaErrorMap,Q6(),P0].filter((B)=>!!B),issueData:{code:U.invalid_return_type,returnTypeError:z}})}let G={errorMap:X.common.contextualErrorMap},H=X.data;if(this._def.returns instanceof R4){let M=this;return K$(async function(...z){let B=new R$([]),O=await M._def.args.parseAsync(z,G).catch((T)=>{throw B.addIssue(Q(z,T)),B}),q=await Reflect.apply(H,this,O);return await M._def.returns._def.type.parseAsync(q,G).catch((T)=>{throw B.addIssue(J(q,T)),B})})}else{let M=this;return K$(function(...z){let B=M._def.args.safeParse(z,G);if(!B.success)throw new R$([Q(z,B.error)]);let O=Reflect.apply(H,this,B.data),q=M._def.returns.safeParse(O,G);if(!q.success)throw new R$([J(O,q.error)]);return q.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...$){return new G6({...this._def,args:q0.create($).rest(e0.create())})}returns($){return new G6({...this._def,returns:$})}implement($){return this.parse($)}strictImplement($){return this.parse($)}static create($,X,Q){return new G6({args:$?$:q0.create([]).rest(e0.create()),returns:X||e0.create(),typeName:m.ZodFunction,...d(Q)})}}class B6 extends a{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})}}B6.create=($,X)=>{return new B6({getter:$,typeName:m.ZodLazy,...d(X)})};class D6 extends a{_parse($){if($.data!==this._def.value){let X=this._getOrReturnCtx($);return L(X,{received:X.data,code:U.invalid_literal,expected:this._def.value}),y}return{status:"valid",value:$.data}}get value(){return this._def.value}}D6.create=($,X)=>{return new D6({value:$,typeName:m.ZodLiteral,...d(X)})};function sJ($,X){return new Q4({values:$,typeName:m.ZodEnum,...d(X)})}class Q4 extends a{constructor(){super(...arguments);$X.set(this,void 0)}_parse($){if(typeof $.data!=="string"){let X=this._getOrReturnCtx($),Q=this._def.values;return L(X,{expected:s.joinValues(Q),received:X.parsedType,code:U.invalid_type}),y}if(!C1(this,$X,"f"))oJ(this,$X,new Set(this._def.values),"f");if(!C1(this,$X,"f").has($.data)){let X=this._getOrReturnCtx($),Q=this._def.values;return L(X,{received:X.data,code:U.invalid_enum_value,options:Q}),y}return K$($.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 Q4.create($,{...this._def,...X})}exclude($,X=this._def){return Q4.create(this.options.filter((Q)=>!$.includes(Q)),{...this._def,...X})}}$X=new WeakMap;Q4.create=sJ;class V6 extends a{constructor(){super(...arguments);XX.set(this,void 0)}_parse($){let X=s.getValidEnumValues(this._def.values),Q=this._getOrReturnCtx($);if(Q.parsedType!==E.string&&Q.parsedType!==E.number){let J=s.objectValues(X);return L(Q,{expected:s.joinValues(J),received:Q.parsedType,code:U.invalid_type}),y}if(!C1(this,XX,"f"))oJ(this,XX,new Set(s.getValidEnumValues(this._def.values)),"f");if(!C1(this,XX,"f").has($.data)){let J=s.objectValues(X);return L(Q,{received:Q.data,code:U.invalid_enum_value,options:J}),y}return K$($.data)}get enum(){return this._def.values}}XX=new WeakMap;V6.create=($,X)=>{return new V6({values:$,typeName:m.ZodNativeEnum,...d(X)})};class R4 extends a{unwrap(){return this._def.type}_parse($){let{ctx:X}=this._processInputParams($);if(X.parsedType!==E.promise&&X.common.async===!1)return L(X,{code:U.invalid_type,expected:E.promise,received:X.parsedType}),y;let Q=X.parsedType===E.promise?X.data:Promise.resolve(X.data);return K$(Q.then((J)=>{return this._def.type.parseAsync(J,{path:X.path,errorMap:X.common.contextualErrorMap})}))}}R4.create=($,X)=>{return new R4({type:$,typeName:m.ZodPromise,...d(X)})};class X0 extends a{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===m.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse($){let{status:X,ctx:Q}=this._processInputParams($),J=this._def.effect||null,G={addIssue:(H)=>{if(L(Q,H),H.fatal)X.abort();else X.dirty()},get path(){return Q.path}};if(G.addIssue=G.addIssue.bind(G),J.type==="preprocess"){let H=J.transform(Q.data,G);if(Q.common.async)return Promise.resolve(H).then(async(M)=>{if(X.value==="aborted")return y;let z=await this._def.schema._parseAsync({data:M,path:Q.path,parent:Q});if(z.status==="aborted")return y;if(z.status==="dirty")return F4(z.value);if(X.value==="dirty")return F4(z.value);return z});else{if(X.value==="aborted")return y;let M=this._def.schema._parseSync({data:H,path:Q.path,parent:Q});if(M.status==="aborted")return y;if(M.status==="dirty")return F4(M.value);if(X.value==="dirty")return F4(M.value);return M}}if(J.type==="refinement"){let H=(M)=>{let z=J.refinement(M,G);if(Q.common.async)return Promise.resolve(z);if(z instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return M};if(Q.common.async===!1){let M=this._def.schema._parseSync({data:Q.data,path:Q.path,parent:Q});if(M.status==="aborted")return y;if(M.status==="dirty")X.dirty();return H(M.value),{status:X.value,value:M.value}}else return this._def.schema._parseAsync({data:Q.data,path:Q.path,parent:Q}).then((M)=>{if(M.status==="aborted")return y;if(M.status==="dirty")X.dirty();return H(M.value).then(()=>{return{status:X.value,value:M.value}})})}if(J.type==="transform")if(Q.common.async===!1){let H=this._def.schema._parseSync({data:Q.data,path:Q.path,parent:Q});if(!s0(H))return H;let M=J.transform(H.value,G);if(M instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:X.value,value:M}}else return this._def.schema._parseAsync({data:Q.data,path:Q.path,parent:Q}).then((H)=>{if(!s0(H))return H;return Promise.resolve(J.transform(H.value,G)).then((M)=>({status:X.value,value:M}))});s.assertNever(J)}}X0.create=($,X,Q)=>{return new X0({schema:$,typeName:m.ZodEffects,effect:X,...d(Q)})};X0.createWithPreprocess=($,X,Q)=>{return new X0({schema:X,effect:{type:"preprocess",transform:$},typeName:m.ZodEffects,...d(Q)})};class e$ extends a{_parse($){if(this._getType($)===E.undefined)return K$(void 0);return this._def.innerType._parse($)}unwrap(){return this._def.innerType}}e$.create=($,X)=>{return new e$({innerType:$,typeName:m.ZodOptional,...d(X)})};class f0 extends a{_parse($){if(this._getType($)===E.null)return K$(null);return this._def.innerType._parse($)}unwrap(){return this._def.innerType}}f0.create=($,X)=>{return new f0({innerType:$,typeName:m.ZodNullable,...d(X)})};class O6 extends a{_parse($){let{ctx:X}=this._processInputParams($),Q=X.data;if(X.parsedType===E.undefined)Q=this._def.defaultValue();return this._def.innerType._parse({data:Q,path:X.path,parent:X})}removeDefault(){return this._def.innerType}}O6.create=($,X)=>{return new O6({innerType:$,typeName:m.ZodDefault,defaultValue:typeof X.default==="function"?X.default:()=>X.default,...d(X)})};class q6 extends a{_parse($){let{ctx:X}=this._processInputParams($),Q={...X,common:{...X.common,issues:[]}},J=this._def.innerType._parse({data:Q.data,path:Q.path,parent:{...Q}});if(W6(J))return J.then((G)=>{return{status:"valid",value:G.status==="valid"?G.value:this._def.catchValue({get error(){return new R$(Q.common.issues)},input:Q.data})}});else return{status:"valid",value:J.status==="valid"?J.value:this._def.catchValue({get error(){return new R$(Q.common.issues)},input:Q.data})}}removeCatch(){return this._def.innerType}}q6.create=($,X)=>{return new q6({innerType:$,typeName:m.ZodCatch,catchValue:typeof X.catch==="function"?X.catch:()=>X.catch,...d(X)})};class YX extends a{_parse($){if(this._getType($)!==E.nan){let Q=this._getOrReturnCtx($);return L(Q,{code:U.invalid_type,expected:E.nan,received:Q.parsedType}),y}return{status:"valid",value:$.data}}}YX.create=($)=>{return new YX({typeName:m.ZodNaN,...d($)})};var GY=Symbol("zod_brand");class k1 extends a{_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}}class HX extends a{_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 y;if(G.status==="dirty")return X.dirty(),F4(G.value);else return this._def.out._parseAsync({data:G.value,path:Q.path,parent:Q})})();else{let J=this._def.in._parseSync({data:Q.data,path:Q.path,parent:Q});if(J.status==="aborted")return y;if(J.status==="dirty")return X.dirty(),{status:"dirty",value:J.value};else return this._def.out._parseSync({data:J.value,path:Q.path,parent:Q})}}static create($,X){return new HX({in:$,out:X,typeName:m.ZodPipeline})}}class A6 extends a{_parse($){let X=this._def.innerType._parse($),Q=(J)=>{if(s0(J))J.value=Object.freeze(J.value);return J};return W6(X)?X.then((J)=>Q(J)):Q(X)}unwrap(){return this._def.innerType}}A6.create=($,X)=>{return new A6({innerType:$,typeName:m.ZodReadonly,...d(X)})};function dJ($,X){let Q=typeof $==="function"?$(X):typeof $==="string"?{message:$}:$;return typeof Q==="string"?{message:Q}:Q}function eJ($,X={},Q){if($)return _4.create().superRefine((J,G)=>{let H=$(J);if(H instanceof Promise)return H.then((M)=>{if(!M){let z=dJ(X,J),B=z.fatal??Q??!0;G.addIssue({code:"custom",...z,fatal:B})}});if(!H){let M=dJ(X,J),z=M.fatal??Q??!0;G.addIssue({code:"custom",...M,fatal:z})}return});return _4.create()}var YY={object:M$.lazycreate},m;(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"})(m||(m={}));var HY=($,X={message:`Input not instance of ${$.name}`})=>eJ((Q)=>Q instanceof $,X),$5=t$.create,X5=$4.create,MY=YX.create,wY=X4.create,Q5=Y6.create,zY=E4.create,BY=QX.create,DY=H6.create,VY=M6.create,OY=_4.create,qY=e0.create,AY=O0.create,jY=WX.create,KY=s$.create,UY=M$.create,NY=M$.strictCreate,SY=w6.create,FY=I1.create,EY=z6.create,_Y=q0.create,LY=JX.create,RY=GX.create,vY=L4.create,CY=G6.create,IY=B6.create,kY=D6.create,PY=Q4.create,bY=V6.create,fY=R4.create,TY=X0.create,gY=e$.create,xY=f0.create,hY=X0.createWithPreprocess,ZY=HX.create,yY=()=>$5().optional(),mY=()=>X5().optional(),lY=()=>Q5().optional(),cY={string:($)=>t$.create({...$,coerce:!0}),number:($)=>$4.create({...$,coerce:!0}),boolean:($)=>Y6.create({...$,coerce:!0}),bigint:($)=>X4.create({...$,coerce:!0}),date:($)=>E4.create({...$,coerce:!0})};var uY=y;var MX=C$(require("fs")),W4=C$(require("path")),WQ=C$(require("fs/promises"));j4();var Q0=Z$("Downloader");class W5{op;assetsPath="";savePath="";setup($){if(this.op=$,this.op.localPath)this.assetsPath=W4.default.join(this.op.localPath,"assets"),this.savePath=this.op.localPath}async downloadImage($,X){let{imgFormat:Q}=this.op,J=this.assetsPath;try{if(!MX.default.existsSync(J))MX.default.mkdirSync(J,{recursive:!0});let G=`${X}.${Q}`,H=W4.default.join(J,G),M=await X6($);if(!M.ok)throw new Error(`下载失败: ${M.status} ${M.statusText}`);let z=await M.arrayBuffer();return MX.default.writeFileSync(H,new Uint8Array(z)),W4.default.join(W4.default.basename(J),G).replace(/\\/g,"/")}catch(G){throw Q0.error("图片下载错误:",G),G}}async downLoadImageAndReplaceContent($){try{let X=/https:\/\/figma-alpha-api\.s3\.us-west-2\.amazonaws\.com\/images\/[a-f0-9-]+/g,Q=$.match(X);if(!Q)return $;let J=[...new Set(Q)],G=new Map;await Promise.all(J.map(async(M)=>{let z=W4.default.basename(M),B=await this.downloadImage(M,z);G.set(M,B)}));let H=$;for(let[M,z]of G.entries()){let B=new RegExp(M.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),"g");H=H.replace(B,z)}return H}catch(X){throw Q0.error("内容处理错误:",X),X}}async checkLocalAndDownload($){if(!this.op.localPath)return;await Promise.all($.map(async(X)=>{X.content=await this.downLoadImageAndReplaceContent(X.content)}));for(let X of $)try{let Q=await this.saveContentToFile(X.content,X.path);Q0.debug(`Successfully saved: ${Q}`)}catch(Q){Q0.error(`Failed to save file ${X.path}:`,Q)}}async ensureDirectoryExists($){if(!MX.default.existsSync($))Q0.debug(`Creating directory: ${$}`),await WQ.default.mkdir($,{recursive:!0})}async saveContentToFile($,X){try{let Q=W4.default.join(this.savePath,X),J=W4.default.dirname(Q);if(Q0.debug(`Full path: ${Q}, directory: ${J}`),await this.ensureDirectoryExists(J),X.endsWith(".html"))Q0.debug("Wrapping content with HTML template"),$=this.wrapHtmlContent($);return Q0.debug(`Writing ${$.length} bytes to file`),await WQ.default.writeFile(Q,$),Q0.info(`File saved: ${Q}`),Q}catch(Q){throw Q0.error("File save error:",X,Q),Q}}wrapHtmlContent($){return Q0.debug("Wrapping content with HTML template"),`<!DOCTYPE html>
20
20
  <html>
21
21
  <head>
22
22
  <meta charset="UTF-8">
@@ -26,7 +26,7 @@ Content-Type: ${H.type||"application/octet-stream"}\r
26
26
  <body>
27
27
  ${$}
28
28
  </body>
29
- </html>`}}var Q8=new s7;var yY=y$("V3Tool"),e7=($)=>{$.tool("get_code","Generate UI code for a given node or the currently selected node in the Figma desktop app. Use the nodeId parameter to specify a node id. If no node id is provided, the currently selected node will be used. If a URL is provided, extract the node id from the URL, for example, if given the URL https://figma.com/design/:fileKey/:fileName?node-id=1-2, the extracted nodeId would be 1:2. IMPORTANT: After you call this tool, you should call get_image to get an image of the node for context.",{fileKey:V$.string().describe("The Figma file identifier found in the file URL (e.g., https://www.figma.com/file/XXXXXXXXXXXX/). Extract the XXXXXXXXXXXX portion as the fileKey."),ids:V$.string().describe('Comma-separated list of Figma node IDs for conversion. To obtain node IDs, select elements in Figma, right-click and select "Copy/Paste as" → "Copy ID".'),personalToken:V$.string().optional().describe("Figma personal access token for API authentication.The parameters are not required when the tool is called."),localPath:V$.string().optional().describe("Absolute path for asset(e.g., images) and code storage. Directory will be created if non-existent. Path must follow OS-specific format without special character escaping. When this path is set, all code-related static resources are stored in this directory, while other assets (e.g., images) will be saved into the subdirectory named assets under this path."),imgFormat:V$.enum(["png","jpg","svg"]).default("png").describe('Export format for image assets: "png" for lossless quality, "jpg" for compressed files, or "svg" for vector graphics.'),scaleSize:V$.number().min(1).max(4).default(2).describe("Image export scale factor (1-4). Higher values yield better quality at the cost of larger file sizes.")},async(X)=>{Q8.setup(X);try{let Q=await h7.nodeToCode({...X,format:"react-tailwind"})||[];if(await Q8.checkLocalAndDownload(Q),!Q)return{content:[{type:"text",text:"Failed to generate any code. Please check if the provided Figma node IDs are correct or if the nodes can be converted to code."}]};let J=Array.isArray(Q)?Q:[Q];if(J.length===0)return{content:[{type:"text",text:"Conversion succeeded but no files were generated. Please check if the selected Figma nodes contain convertible content."}]};let G=J.filter((M)=>!M.path.endsWith("/index.scss")).map((M,z)=>`${z+1}. ${M.path}`).join(`
29
+ </html>`}}var JQ=new W5;var nY=Z$("V3Tool"),G5=($)=>{J5.reportMcpLoader(),$.tool("get_code","Generate UI code for a given node or the currently selected node in the Figma desktop app. Use the nodeId parameter to specify a node id. If no node id is provided, the currently selected node will be used. If a URL is provided, extract the node id from the URL, for example, if given the URL https://figma.com/design/:fileKey/:fileName?node-id=1-2, the extracted nodeId would be 1:2. IMPORTANT: After you call this tool, you should call get_image to get an image of the node for context.",{fileKey:V$.string().describe("The Figma file identifier found in the file URL (e.g., https://www.figma.com/file/XXXXXXXXXXXX/). Extract the XXXXXXXXXXXX portion as the fileKey."),ids:V$.string().describe('Comma-separated list of Figma node IDs for conversion. To obtain node IDs, select elements in Figma, right-click and select "Copy/Paste as" → "Copy ID".'),personalToken:V$.string().optional().describe("Figma personal access token for API authentication.The parameters are not required when the tool is called."),localPath:V$.string().optional().describe("Absolute path for asset(e.g., images) and code storage. Directory will be created if non-existent. Path must follow OS-specific format without special character escaping. When this path is set, all code-related static resources are stored in this directory, while other assets (e.g., images) will be saved into the subdirectory named assets under this path."),imgFormat:V$.enum(["png","jpg","svg"]).default("png").describe('Export format for image assets: "png" for lossless quality, "jpg" for compressed files, or "svg" for vector graphics.'),scaleSize:V$.number().min(1).max(4).default(2).describe("Image export scale factor (1-4). Higher values yield better quality at the cost of larger file sizes.")},async(X)=>{JQ.setup(X);try{let Q=await mJ.nodeToCode({...X,format:"react-tailwind"})||[];if(await JQ.checkLocalAndDownload(Q),!Q)return{content:[{type:"text",text:"Failed to generate any code. Please check if the provided Figma node IDs are correct or if the nodes can be converted to code."}]};let J=Array.isArray(Q)?Q:[Q];if(J.length===0)return{content:[{type:"text",text:"Conversion succeeded but no files were generated. Please check if the selected Figma nodes contain convertible content."}]};let G=J.filter((M)=>!M.path.endsWith("/index.scss")).map((M,z)=>`${z+1}. ${M.path}`).join(`
30
30
  `);if(X.localPath)return{content:[{type:"text",text:`# Files Saved Locally
31
31
 
32
32
  ## Save Location
@@ -35,9 +35,9 @@ ${X.localPath}
35
35
  ## Generated Files
36
36
  ${G}. Convert the Tailwind to vanilla CSS if not already used in the codebase. Do not install any dependencies.`}]};return{content:[{type:"text",text:`${J.filter((M)=>M.path.endsWith(".tsx")).map((M)=>M.content).join(`
37
37
 
38
- `)} Convert the Tailwind to vanilla CSS if not already used in the codebase. Do not install any dependencies.`}]}}catch(Q){return yY.error("Tool execution error:",Q),{content:[{type:"text",text:`Error: ${Q.message}`}]}}}),$.tool("get_image","Generate an image for a given node or the currently selected node in the Figma desktop app. Use the nodeId parameter to specify a node id. If no node id is provided, the currently selected node will be used. If a URL is provided, extract the node id from the URL, for example, if given the URL https://figma.com/design/:fileKey/:fileName?node-id=1-2, the extracted nodeId would be 1:2. Also export Figma design images for visual verification and design fidelity validation. Essential for comparing generated code output against original designs, ensuring pixel-perfect implementation and catching visual discrepancies during the design-to-code process.",{fileKey:V$.string().describe("Figma file identifier from the URL for accessing the design source"),ids:V$.string().describe('Comma-separated node IDs to export. Use "Copy ID" from Figma context menu to get precise element references for comparison'),format:V$.enum(["jpg","png","svg","pdf"]).optional().describe('Export format for verification: "png" for pixel-perfect comparison with transparency, "jpg" for quick previews, "svg" for scalable reference, "pdf" for print validation'),scale:V$.number().optional().describe("Scale factor (1-4x) for high-resolution comparison. Use 2x+ for detailed fidelity checks on retina displays"),svg_include_id:V$.boolean().optional().describe("Include element IDs in SVG for precise element mapping during code validation"),svg_simplify_stroke:V$.boolean().optional().describe("Simplify stroke paths for cleaner reference images during visual comparison"),use_absolute_bounds:V$.boolean().optional().describe("Use absolute positioning for accurate layout verification against implemented code"),version:V$.string().optional().describe("Specific design version for consistent comparison baseline"),personalToken:V$.string().optional().describe("Figma personal access token for authenticated access to design files")},async(X)=>{try{let Q=await Z7.images(X);return{content:[{type:"text",text:JSON.stringify(Q)}]}}catch(Q){return{content:[{type:"text",text:`Error: ${Q.message}`}]}}})};var k1=new h2({name:hQ,version:yQ},{capabilities:{logging:{}}});mQ(k1);e7(k1);var J8=x$(require("node:process"));m6();class W8{append($){this._buffer=this._buffer?Buffer.concat([this._buffer,$]):$}readMessage(){if(!this._buffer)return null;let $=this._buffer.indexOf(`
39
- `);if($===-1)return null;let X=this._buffer.toString("utf8",0,$).replace(/\r$/,"");return this._buffer=this._buffer.subarray($+1),ZY(X)}clear(){this._buffer=void 0}}function ZY($){return p3.parse(JSON.parse($))}function $W($){return JSON.stringify($)+`
40
- `}class G8{constructor($=J8.default.stdin,X=J8.default.stdout){this._stdin=$,this._stdout=X,this._readBuffer=new W8,this._started=!1,this._ondata=(Q)=>{this._readBuffer.append(Q),this.processReadBuffer()},this._onerror=(Q)=>{var J;(J=this.onerror)===null||J===void 0||J.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=$W($);if(this._stdout.write(Q))X();else this._stdout.once("drain",X)})}}q4();var mY=y$("StdioTransport");async function XW($){try{let X=new G8;await $.connect(X)}catch(X){mY.info(JSON.stringify({jsonrpc:"2.0",id:null,error:{code:-32000,message:`Server startup failed: ${X.message}`}})),process.exit(1)}}XW(k1);
38
+ `)} Convert the Tailwind to vanilla CSS if not already used in the codebase. Do not install any dependencies.`}]}}catch(Q){return nY.error("Tool execution error:",Q),{content:[{type:"text",text:`Error: ${Q.message}`}]}}}),$.tool("get_image","Generate an image for a given node or the currently selected node in the Figma desktop app. Use the nodeId parameter to specify a node id. If no node id is provided, the currently selected node will be used. If a URL is provided, extract the node id from the URL, for example, if given the URL https://figma.com/design/:fileKey/:fileName?node-id=1-2, the extracted nodeId would be 1:2. Also export Figma design images for visual verification and design fidelity validation. Essential for comparing generated code output against original designs, ensuring pixel-perfect implementation and catching visual discrepancies during the design-to-code process.",{fileKey:V$.string().describe("Figma file identifier from the URL for accessing the design source"),ids:V$.string().describe('Comma-separated node IDs to export. Use "Copy ID" from Figma context menu to get precise element references for comparison'),format:V$.enum(["jpg","png","svg","pdf"]).optional().describe('Export format for verification: "png" for pixel-perfect comparison with transparency, "jpg" for quick previews, "svg" for scalable reference, "pdf" for print validation'),scale:V$.number().optional().describe("Scale factor (1-4x) for high-resolution comparison. Use 2x+ for detailed fidelity checks on retina displays"),svg_include_id:V$.boolean().optional().describe("Include element IDs in SVG for precise element mapping during code validation"),svg_simplify_stroke:V$.boolean().optional().describe("Simplify stroke paths for cleaner reference images during visual comparison"),use_absolute_bounds:V$.boolean().optional().describe("Use absolute positioning for accurate layout verification against implemented code"),version:V$.string().optional().describe("Specific design version for consistent comparison baseline"),personalToken:V$.string().optional().describe("Figma personal access token for authenticated access to design files")},async(X)=>{try{let Q=await cJ.images(X);return{content:[{type:"text",text:JSON.stringify(Q)}]}}catch(Q){return{content:[{type:"text",text:`Error: ${Q.message}`}]}}})};var P1=new h8({name:cW,version:uW},{capabilities:{logging:{}}});pW(P1);G5(P1);var YQ=C$(require("node:process"));l6();class GQ{append($){this._buffer=this._buffer?Buffer.concat([this._buffer,$]):$}readMessage(){if(!this._buffer)return null;let $=this._buffer.indexOf(`
39
+ `);if($===-1)return null;let X=this._buffer.toString("utf8",0,$).replace(/\r$/,"");return this._buffer=this._buffer.subarray($+1),pY(X)}clear(){this._buffer=void 0}}function pY($){return a7.parse(JSON.parse($))}function Y5($){return JSON.stringify($)+`
40
+ `}class HQ{constructor($=YQ.default.stdin,X=YQ.default.stdout){this._stdin=$,this._stdout=X,this._readBuffer=new GQ,this._started=!1,this._ondata=(Q)=>{this._readBuffer.append(Q),this.processReadBuffer()},this._onerror=(Q)=>{var J;(J=this.onerror)===null||J===void 0||J.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=Y5($);if(this._stdout.write(Q))X();else this._stdout.once("drain",X)})}}j4();var iY=Z$("StdioTransport");async function H5($){try{let X=new HQ;await $.connect(X)}catch(X){iY.info(JSON.stringify({jsonrpc:"2.0",id:null,error:{code:-32000,message:`Server startup failed: ${X.message}`}})),process.exit(1)}}H5(P1);
41
41
 
42
- //# debugId=A644BBB9B2A1590564756E2164756E21
42
+ //# debugId=85371DDC0C96A3D464756E2164756E21
43
43
  //# sourceMappingURL=cli.js.map