@tencent-ai/codebuddy-code 0.0.1-beta.9 → 1.0.0
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/CHANGELOG.md +380 -0
- package/README.md +6 -6
- package/bin/codebuddy +1 -0
- package/dist/422.codebuddy.js +1 -0
- package/dist/444.codebuddy.js +1 -0
- package/dist/566.codebuddy.js +1 -0
- package/dist/597.codebuddy.js +1 -0
- package/dist/632.codebuddy.js +1 -0
- package/dist/814.codebuddy.js +1 -0
- package/dist/889.codebuddy.js +1 -0
- package/dist/952.codebuddy.js +1 -0
- package/dist/codebuddy.js +1 -1
- package/lib/node/index.js +5 -0
- package/package.json +9 -2
- package/product.internal.json +228 -0
- package/product.ioa.json +305 -0
- package/product.json +294 -46
- package/bin/rg +0 -0
- package/dist/291.codebuddy.js +0 -1
- package/dist/298.codebuddy.js +0 -1
- package/dist/368.codebuddy.js +0 -1
- package/dist/393.codebuddy.js +0 -1
package/dist/298.codebuddy.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";exports.id=298,exports.ids=[298],exports.modules={13298:(e,t,a)=>{a.r(t),a.d(t,{AudioContentSchema:()=>ne,BaseMetadataSchema:()=>k,BlobResourceContentsSchema:()=>$,BooleanSchemaSchema:()=>we,CallToolRequestSchema:()=>_e,CallToolResultSchema:()=>ge,CancelledNotificationSchema:()=>T,ClientCapabilitiesSchema:()=>S,ClientNotificationSchema:()=>Be,ClientRequestSchema:()=>qe,ClientResultSchema:()=>Ke,CompatibilityCallToolResultSchema:()=>ye,CompleteRequestSchema:()=>Me,CompleteResultSchema:()=>$e,ContentBlockSchema:()=>de,CreateMessageRequestSchema:()=>Ce,CreateMessageResultSchema:()=>Se,CursorSchema:()=>c,DEFAULT_NEGOTIATED_PROTOCOL_VERSION:()=>n,ElicitRequestSchema:()=>Re,ElicitResultSchema:()=>Oe,EmbeddedResourceSchema:()=>ie,EmptyResultSchema:()=>z,EnumSchemaSchema:()=>je,ErrorCode:()=>Z,GetPromptRequestSchema:()=>ae,GetPromptResultSchema:()=>ue,ImageContentSchema:()=>re,ImplementationSchema:()=>C,InitializeRequestSchema:()=>w,InitializeResultSchema:()=>I,InitializedNotificationSchema:()=>j,JSONRPCErrorSchema:()=>b,JSONRPCMessageSchema:()=>x,JSONRPCNotificationSchema:()=>_,JSONRPCRequestSchema:()=>y,JSONRPCResponseSchema:()=>v,JSONRPC_VERSION:()=>o,LATEST_PROTOCOL_VERSION:()=>r,ListPromptsRequestSchema:()=>ee,ListPromptsResultSchema:()=>te,ListResourceTemplatesRequestSchema:()=>q,ListResourceTemplatesResultSchema:()=>B,ListResourcesRequestSchema:()=>U,ListResourcesResultSchema:()=>V,ListRootsRequestSchema:()=>De,ListRootsResultSchema:()=>Ue,ListToolsRequestSchema:()=>me,ListToolsResultSchema:()=>fe,LoggingLevelSchema:()=>Ze,LoggingMessageNotificationSchema:()=>xe,McpError:()=>McpError,ModelHintSchema:()=>ze,ModelPreferencesSchema:()=>Te,NotificationSchema:()=>m,NumberSchemaSchema:()=>Ie,PaginatedRequestSchema:()=>E,PaginatedResultSchema:()=>A,PingRequestSchema:()=>N,PrimitiveSchemaDefinitionSchema:()=>Ne,ProgressNotificationSchema:()=>O,ProgressSchema:()=>R,ProgressTokenSchema:()=>d,PromptArgumentSchema:()=>X,PromptListChangedNotificationSchema:()=>le,PromptMessageSchema:()=>ce,PromptReferenceSchema:()=>Le,PromptSchema:()=>Q,ReadResourceRequestSchema:()=>K,ReadResourceResultSchema:()=>W,RequestIdSchema:()=>g,RequestSchema:()=>p,ResourceContentsSchema:()=>L,ResourceLinkSchema:()=>oe,ResourceListChangedNotificationSchema:()=>J,ResourceReferenceSchema:()=>Ae,ResourceSchema:()=>F,ResourceTemplateReferenceSchema:()=>Ee,ResourceTemplateSchema:()=>D,ResourceUpdatedNotificationSchema:()=>Y,ResultSchema:()=>f,RootSchema:()=>Fe,RootsListChangedNotificationSchema:()=>Ve,SUPPORTED_PROTOCOL_VERSIONS:()=>i,SamplingMessageSchema:()=>ke,ServerCapabilitiesSchema:()=>P,ServerNotificationSchema:()=>Je,ServerRequestSchema:()=>We,ServerResultSchema:()=>Ge,SetLevelRequestSchema:()=>be,StringSchemaSchema:()=>Pe,SubscribeRequestSchema:()=>G,TextContentSchema:()=>se,TextResourceContentsSchema:()=>M,ToolAnnotationsSchema:()=>pe,ToolListChangedNotificationSchema:()=>ve,ToolSchema:()=>he,UnsubscribeRequestSchema:()=>H,isInitializeRequest:()=>isInitializeRequest,isInitializedNotification:()=>isInitializedNotification,isJSONRPCError:()=>isJSONRPCError,isJSONRPCNotification:()=>isJSONRPCNotification,isJSONRPCRequest:()=>isJSONRPCRequest,isJSONRPCResponse:()=>isJSONRPCResponse});var s=a(46195);const r="2025-06-18",n="2025-03-26",i=[r,"2025-03-26","2024-11-05","2024-10-07"],o="2.0",d=s.z.union([s.z.string(),s.z.number().int()]),c=s.z.string(),u=s.z.object({progressToken:s.z.optional(d)}).passthrough(),l=s.z.object({_meta:s.z.optional(u)}).passthrough(),p=s.z.object({method:s.z.string(),params:s.z.optional(l)}),h=s.z.object({_meta:s.z.optional(s.z.object({}).passthrough())}).passthrough(),m=s.z.object({method:s.z.string(),params:s.z.optional(h)}),f=s.z.object({_meta:s.z.optional(s.z.object({}).passthrough())}).passthrough(),g=s.z.union([s.z.string(),s.z.number().int()]),y=s.z.object({jsonrpc:s.z.literal(o),id:g}).merge(p).strict(),isJSONRPCRequest=e=>y.safeParse(e).success,_=s.z.object({jsonrpc:s.z.literal(o)}).merge(m).strict(),isJSONRPCNotification=e=>_.safeParse(e).success,v=s.z.object({jsonrpc:s.z.literal(o),id:g,result:f}).strict(),isJSONRPCResponse=e=>v.safeParse(e).success;var Z;!function(e){e[e.ConnectionClosed=-32e3]="ConnectionClosed",e[e.RequestTimeout=-32001]="RequestTimeout",e[e.ParseError=-32700]="ParseError",e[e.InvalidRequest=-32600]="InvalidRequest",e[e.MethodNotFound=-32601]="MethodNotFound",e[e.InvalidParams=-32602]="InvalidParams",e[e.InternalError=-32603]="InternalError"}(Z||(Z={}));const b=s.z.object({jsonrpc:s.z.literal(o),id:g,error:s.z.object({code:s.z.number().int(),message:s.z.string(),data:s.z.optional(s.z.unknown())})}).strict(),isJSONRPCError=e=>b.safeParse(e).success,x=s.z.union([y,_,v,b]),z=f.strict(),T=m.extend({method:s.z.literal("notifications/cancelled"),params:h.extend({requestId:g,reason:s.z.string().optional()})}),k=s.z.object({name:s.z.string(),title:s.z.optional(s.z.string())}).passthrough(),C=k.extend({version:s.z.string()}),S=s.z.object({experimental:s.z.optional(s.z.object({}).passthrough()),sampling:s.z.optional(s.z.object({}).passthrough()),elicitation:s.z.optional(s.z.object({}).passthrough()),roots:s.z.optional(s.z.object({listChanged:s.z.optional(s.z.boolean())}).passthrough())}).passthrough(),w=p.extend({method:s.z.literal("initialize"),params:l.extend({protocolVersion:s.z.string(),capabilities:S,clientInfo:C})}),isInitializeRequest=e=>w.safeParse(e).success,P=s.z.object({experimental:s.z.optional(s.z.object({}).passthrough()),logging:s.z.optional(s.z.object({}).passthrough()),completions:s.z.optional(s.z.object({}).passthrough()),prompts:s.z.optional(s.z.object({listChanged:s.z.optional(s.z.boolean())}).passthrough()),resources:s.z.optional(s.z.object({subscribe:s.z.optional(s.z.boolean()),listChanged:s.z.optional(s.z.boolean())}).passthrough()),tools:s.z.optional(s.z.object({listChanged:s.z.optional(s.z.boolean())}).passthrough())}).passthrough(),I=f.extend({protocolVersion:s.z.string(),capabilities:P,serverInfo:C,instructions:s.z.optional(s.z.string())}),j=m.extend({method:s.z.literal("notifications/initialized")}),isInitializedNotification=e=>j.safeParse(e).success,N=p.extend({method:s.z.literal("ping")}),R=s.z.object({progress:s.z.number(),total:s.z.optional(s.z.number()),message:s.z.optional(s.z.string())}).passthrough(),O=m.extend({method:s.z.literal("notifications/progress"),params:h.merge(R).extend({progressToken:d})}),E=p.extend({params:l.extend({cursor:s.z.optional(c)}).optional()}),A=f.extend({nextCursor:s.z.optional(c)}),L=s.z.object({uri:s.z.string(),mimeType:s.z.optional(s.z.string()),_meta:s.z.optional(s.z.object({}).passthrough())}).passthrough(),M=L.extend({text:s.z.string()}),$=L.extend({blob:s.z.string().base64()}),F=k.extend({uri:s.z.string(),description:s.z.optional(s.z.string()),mimeType:s.z.optional(s.z.string()),_meta:s.z.optional(s.z.object({}).passthrough())}),D=k.extend({uriTemplate:s.z.string(),description:s.z.optional(s.z.string()),mimeType:s.z.optional(s.z.string()),_meta:s.z.optional(s.z.object({}).passthrough())}),U=E.extend({method:s.z.literal("resources/list")}),V=A.extend({resources:s.z.array(F)}),q=E.extend({method:s.z.literal("resources/templates/list")}),B=A.extend({resourceTemplates:s.z.array(D)}),K=p.extend({method:s.z.literal("resources/read"),params:l.extend({uri:s.z.string()})}),W=f.extend({contents:s.z.array(s.z.union([M,$]))}),J=m.extend({method:s.z.literal("notifications/resources/list_changed")}),G=p.extend({method:s.z.literal("resources/subscribe"),params:l.extend({uri:s.z.string()})}),H=p.extend({method:s.z.literal("resources/unsubscribe"),params:l.extend({uri:s.z.string()})}),Y=m.extend({method:s.z.literal("notifications/resources/updated"),params:h.extend({uri:s.z.string()})}),X=s.z.object({name:s.z.string(),description:s.z.optional(s.z.string()),required:s.z.optional(s.z.boolean())}).passthrough(),Q=k.extend({description:s.z.optional(s.z.string()),arguments:s.z.optional(s.z.array(X)),_meta:s.z.optional(s.z.object({}).passthrough())}),ee=E.extend({method:s.z.literal("prompts/list")}),te=A.extend({prompts:s.z.array(Q)}),ae=p.extend({method:s.z.literal("prompts/get"),params:l.extend({name:s.z.string(),arguments:s.z.optional(s.z.record(s.z.string()))})}),se=s.z.object({type:s.z.literal("text"),text:s.z.string(),_meta:s.z.optional(s.z.object({}).passthrough())}).passthrough(),re=s.z.object({type:s.z.literal("image"),data:s.z.string().base64(),mimeType:s.z.string(),_meta:s.z.optional(s.z.object({}).passthrough())}).passthrough(),ne=s.z.object({type:s.z.literal("audio"),data:s.z.string().base64(),mimeType:s.z.string(),_meta:s.z.optional(s.z.object({}).passthrough())}).passthrough(),ie=s.z.object({type:s.z.literal("resource"),resource:s.z.union([M,$]),_meta:s.z.optional(s.z.object({}).passthrough())}).passthrough(),oe=F.extend({type:s.z.literal("resource_link")}),de=s.z.union([se,re,ne,oe,ie]),ce=s.z.object({role:s.z.enum(["user","assistant"]),content:de}).passthrough(),ue=f.extend({description:s.z.optional(s.z.string()),messages:s.z.array(ce)}),le=m.extend({method:s.z.literal("notifications/prompts/list_changed")}),pe=s.z.object({title:s.z.optional(s.z.string()),readOnlyHint:s.z.optional(s.z.boolean()),destructiveHint:s.z.optional(s.z.boolean()),idempotentHint:s.z.optional(s.z.boolean()),openWorldHint:s.z.optional(s.z.boolean())}).passthrough(),he=k.extend({description:s.z.optional(s.z.string()),inputSchema:s.z.object({type:s.z.literal("object"),properties:s.z.optional(s.z.object({}).passthrough()),required:s.z.optional(s.z.array(s.z.string()))}).passthrough(),outputSchema:s.z.optional(s.z.object({type:s.z.literal("object"),properties:s.z.optional(s.z.object({}).passthrough()),required:s.z.optional(s.z.array(s.z.string()))}).passthrough()),annotations:s.z.optional(pe),_meta:s.z.optional(s.z.object({}).passthrough())}),me=E.extend({method:s.z.literal("tools/list")}),fe=A.extend({tools:s.z.array(he)}),ge=f.extend({content:s.z.array(de).default([]),structuredContent:s.z.object({}).passthrough().optional(),isError:s.z.optional(s.z.boolean())}),ye=ge.or(f.extend({toolResult:s.z.unknown()})),_e=p.extend({method:s.z.literal("tools/call"),params:l.extend({name:s.z.string(),arguments:s.z.optional(s.z.record(s.z.unknown()))})}),ve=m.extend({method:s.z.literal("notifications/tools/list_changed")}),Ze=s.z.enum(["debug","info","notice","warning","error","critical","alert","emergency"]),be=p.extend({method:s.z.literal("logging/setLevel"),params:l.extend({level:Ze})}),xe=m.extend({method:s.z.literal("notifications/message"),params:h.extend({level:Ze,logger:s.z.optional(s.z.string()),data:s.z.unknown()})}),ze=s.z.object({name:s.z.string().optional()}).passthrough(),Te=s.z.object({hints:s.z.optional(s.z.array(ze)),costPriority:s.z.optional(s.z.number().min(0).max(1)),speedPriority:s.z.optional(s.z.number().min(0).max(1)),intelligencePriority:s.z.optional(s.z.number().min(0).max(1))}).passthrough(),ke=s.z.object({role:s.z.enum(["user","assistant"]),content:s.z.union([se,re,ne])}).passthrough(),Ce=p.extend({method:s.z.literal("sampling/createMessage"),params:l.extend({messages:s.z.array(ke),systemPrompt:s.z.optional(s.z.string()),includeContext:s.z.optional(s.z.enum(["none","thisServer","allServers"])),temperature:s.z.optional(s.z.number()),maxTokens:s.z.number().int(),stopSequences:s.z.optional(s.z.array(s.z.string())),metadata:s.z.optional(s.z.object({}).passthrough()),modelPreferences:s.z.optional(Te)})}),Se=f.extend({model:s.z.string(),stopReason:s.z.optional(s.z.enum(["endTurn","stopSequence","maxTokens"]).or(s.z.string())),role:s.z.enum(["user","assistant"]),content:s.z.discriminatedUnion("type",[se,re,ne])}),we=s.z.object({type:s.z.literal("boolean"),title:s.z.optional(s.z.string()),description:s.z.optional(s.z.string()),default:s.z.optional(s.z.boolean())}).passthrough(),Pe=s.z.object({type:s.z.literal("string"),title:s.z.optional(s.z.string()),description:s.z.optional(s.z.string()),minLength:s.z.optional(s.z.number()),maxLength:s.z.optional(s.z.number()),format:s.z.optional(s.z.enum(["email","uri","date","date-time"]))}).passthrough(),Ie=s.z.object({type:s.z.enum(["number","integer"]),title:s.z.optional(s.z.string()),description:s.z.optional(s.z.string()),minimum:s.z.optional(s.z.number()),maximum:s.z.optional(s.z.number())}).passthrough(),je=s.z.object({type:s.z.literal("string"),title:s.z.optional(s.z.string()),description:s.z.optional(s.z.string()),enum:s.z.array(s.z.string()),enumNames:s.z.optional(s.z.array(s.z.string()))}).passthrough(),Ne=s.z.union([we,Pe,Ie,je]),Re=p.extend({method:s.z.literal("elicitation/create"),params:l.extend({message:s.z.string(),requestedSchema:s.z.object({type:s.z.literal("object"),properties:s.z.record(s.z.string(),Ne),required:s.z.optional(s.z.array(s.z.string()))}).passthrough()})}),Oe=f.extend({action:s.z.enum(["accept","decline","cancel"]),content:s.z.optional(s.z.record(s.z.string(),s.z.unknown()))}),Ee=s.z.object({type:s.z.literal("ref/resource"),uri:s.z.string()}).passthrough(),Ae=Ee,Le=s.z.object({type:s.z.literal("ref/prompt"),name:s.z.string()}).passthrough(),Me=p.extend({method:s.z.literal("completion/complete"),params:l.extend({ref:s.z.union([Le,Ee]),argument:s.z.object({name:s.z.string(),value:s.z.string()}).passthrough(),context:s.z.optional(s.z.object({arguments:s.z.optional(s.z.record(s.z.string(),s.z.string()))}))})}),$e=f.extend({completion:s.z.object({values:s.z.array(s.z.string()).max(100),total:s.z.optional(s.z.number().int()),hasMore:s.z.optional(s.z.boolean())}).passthrough()}),Fe=s.z.object({uri:s.z.string().startsWith("file://"),name:s.z.optional(s.z.string()),_meta:s.z.optional(s.z.object({}).passthrough())}).passthrough(),De=p.extend({method:s.z.literal("roots/list")}),Ue=f.extend({roots:s.z.array(Fe)}),Ve=m.extend({method:s.z.literal("notifications/roots/list_changed")}),qe=s.z.union([N,w,Me,be,ae,ee,U,q,K,G,H,_e,me]),Be=s.z.union([T,O,j,Ve]),Ke=s.z.union([z,Se,Oe,Ue]),We=s.z.union([N,Ce,Re,De]),Je=s.z.union([T,O,xe,Y,J,ve,le]),Ge=s.z.union([z,I,$e,ue,te,V,B,W,ge,fe]);class McpError extends Error{constructor(e,t,a){super(`MCP error ${e}: ${t}`),this.code=e,this.data=a,this.name="McpError"}}},46195:(e,t,a)=>{var s,r;a.d(t,{z:()=>me}),function(e){e.assertEqual=e=>e,e.assertIs=function assertIs(e){},e.assertNever=function assertNever(e){throw new Error},e.arrayToEnum=e=>{const t={};for(const a of e)t[a]=a;return t},e.getValidEnumValues=t=>{const a=e.objectKeys(t).filter((e=>"number"!=typeof t[t[e]])),s={};for(const e of a)s[e]=t[e];return e.objectValues(s)},e.objectValues=t=>e.objectKeys(t).map((function(e){return t[e]})),e.objectKeys="function"==typeof Object.keys?e=>Object.keys(e):e=>{const t=[];for(const a in e)Object.prototype.hasOwnProperty.call(e,a)&&t.push(a);return t},e.find=(e,t)=>{for(const a of e)if(t(a))return a},e.isInteger="function"==typeof Number.isInteger?e=>Number.isInteger(e):e=>"number"==typeof e&&isFinite(e)&&Math.floor(e)===e,e.joinValues=function joinValues(e,t=" | "){return e.map((e=>"string"==typeof e?`'${e}'`:e)).join(t)},e.jsonStringifyReplacer=(e,t)=>"bigint"==typeof t?t.toString():t}(s||(s={})),function(e){e.mergeShapes=(e,t)=>({...e,...t})}(r||(r={}));const n=s.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),getParsedType=e=>{switch(typeof e){case"undefined":return n.undefined;case"string":return n.string;case"number":return isNaN(e)?n.nan:n.number;case"boolean":return n.boolean;case"function":return n.function;case"bigint":return n.bigint;case"symbol":return n.symbol;case"object":return Array.isArray(e)?n.array:null===e?n.null:e.then&&"function"==typeof e.then&&e.catch&&"function"==typeof e.catch?n.promise:"undefined"!=typeof Map&&e instanceof Map?n.map:"undefined"!=typeof Set&&e instanceof Set?n.set:"undefined"!=typeof Date&&e instanceof Date?n.date:n.object;default:return n.unknown}},i=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"]);class ZodError extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=e=>{this.issues=[...this.issues,e]},this.addIssues=(e=[])=>{this.issues=[...this.issues,...e]};const t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}format(e){const t=e||function(e){return e.message},a={_errors:[]},processError=e=>{for(const s of e.issues)if("invalid_union"===s.code)s.unionErrors.map(processError);else if("invalid_return_type"===s.code)processError(s.returnTypeError);else if("invalid_arguments"===s.code)processError(s.argumentsError);else if(0===s.path.length)a._errors.push(t(s));else{let e=a,r=0;for(;r<s.path.length;){const a=s.path[r];r===s.path.length-1?(e[a]=e[a]||{_errors:[]},e[a]._errors.push(t(s))):e[a]=e[a]||{_errors:[]},e=e[a],r++}}};return processError(this),a}static assert(e){if(!(e instanceof ZodError))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,s.jsonStringifyReplacer,2)}get isEmpty(){return 0===this.issues.length}flatten(e=e=>e.message){const t={},a=[];for(const s of this.issues)s.path.length>0?(t[s.path[0]]=t[s.path[0]]||[],t[s.path[0]].push(e(s))):a.push(e(s));return{formErrors:a,fieldErrors:t}}get formErrors(){return this.flatten()}}ZodError.create=e=>new ZodError(e);const errorMap=(e,t)=>{let a;switch(e.code){case i.invalid_type:a=e.received===n.undefined?"Required":`Expected ${e.expected}, received ${e.received}`;break;case i.invalid_literal:a=`Invalid literal value, expected ${JSON.stringify(e.expected,s.jsonStringifyReplacer)}`;break;case i.unrecognized_keys:a=`Unrecognized key(s) in object: ${s.joinValues(e.keys,", ")}`;break;case i.invalid_union:a="Invalid input";break;case i.invalid_union_discriminator:a=`Invalid discriminator value. Expected ${s.joinValues(e.options)}`;break;case i.invalid_enum_value:a=`Invalid enum value. Expected ${s.joinValues(e.options)}, received '${e.received}'`;break;case i.invalid_arguments:a="Invalid function arguments";break;case i.invalid_return_type:a="Invalid function return type";break;case i.invalid_date:a="Invalid date";break;case i.invalid_string:"object"==typeof e.validation?"includes"in e.validation?(a=`Invalid input: must include "${e.validation.includes}"`,"number"==typeof e.validation.position&&(a=`${a} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?a=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?a=`Invalid input: must end with "${e.validation.endsWith}"`:s.assertNever(e.validation):a="regex"!==e.validation?`Invalid ${e.validation}`:"Invalid";break;case i.too_small:a="array"===e.type?`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:"string"===e.type?`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:"number"===e.type?`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:"date"===e.type?`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:"Invalid input";break;case i.too_big:a="array"===e.type?`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:"string"===e.type?`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:"number"===e.type?`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:"bigint"===e.type?`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:"date"===e.type?`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:"Invalid input";break;case i.custom:a="Invalid input";break;case i.invalid_intersection_types:a="Intersection results could not be merged";break;case i.not_multiple_of:a=`Number must be a multiple of ${e.multipleOf}`;break;case i.not_finite:a="Number must be finite";break;default:a=t.defaultError,s.assertNever(e)}return{message:a}};let o=errorMap;function getErrorMap(){return o}const makeIssue=e=>{const{data:t,path:a,errorMaps:s,issueData:r}=e,n=[...a,...r.path||[]],i={...r,path:n};if(void 0!==r.message)return{...r,path:n,message:r.message};let o="";const d=s.filter((e=>!!e)).slice().reverse();for(const e of d)o=e(i,{data:t,defaultError:o}).message;return{...r,path:n,message:o}};function addIssueToContext(e,t){const a=getErrorMap(),s=makeIssue({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,a,a===errorMap?void 0:errorMap].filter((e=>!!e))});e.common.issues.push(s)}class ParseStatus{constructor(){this.value="valid"}dirty(){"valid"===this.value&&(this.value="dirty")}abort(){"aborted"!==this.value&&(this.value="aborted")}static mergeArray(e,t){const a=[];for(const s of t){if("aborted"===s.status)return d;"dirty"===s.status&&e.dirty(),a.push(s.value)}return{status:e.value,value:a}}static async mergeObjectAsync(e,t){const a=[];for(const e of t){const t=await e.key,s=await e.value;a.push({key:t,value:s})}return ParseStatus.mergeObjectSync(e,a)}static mergeObjectSync(e,t){const a={};for(const s of t){const{key:t,value:r}=s;if("aborted"===t.status)return d;if("aborted"===r.status)return d;"dirty"===t.status&&e.dirty(),"dirty"===r.status&&e.dirty(),"__proto__"===t.value||void 0===r.value&&!s.alwaysSet||(a[t.value]=r.value)}return{status:e.value,value:a}}}const d=Object.freeze({status:"aborted"}),DIRTY=e=>({status:"dirty",value:e}),OK=e=>({status:"valid",value:e}),isAborted=e=>"aborted"===e.status,isDirty=e=>"dirty"===e.status,isValid=e=>"valid"===e.status,isAsync=e=>"undefined"!=typeof Promise&&e instanceof Promise;function __classPrivateFieldGet(e,t,a,s){if("a"===a&&!s)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!s:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===a?s:"a"===a?s.call(e):s?s.value:t.get(e)}function __classPrivateFieldSet(e,t,a,s,r){if("m"===s)throw new TypeError("Private method is not writable");if("a"===s&&!r)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===s?r.call(e,a):r?r.value=a:t.set(e,a),a}var c,u,l;"function"==typeof SuppressedError&&SuppressedError,function(e){e.errToObj=e=>"string"==typeof e?{message:e}:e||{},e.toString=e=>"string"==typeof e?e:null==e?void 0:e.message}(c||(c={}));class ParseInputLazyPath{constructor(e,t,a,s){this._cachedPath=[],this.parent=e,this.data=t,this._path=a,this._key=s}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const handleResult=(e,t)=>{if(isValid(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const t=new ZodError(e.common.issues);return this._error=t,this._error}}};function processCreateParams(e){if(!e)return{};const{errorMap:t,invalid_type_error:a,required_error:s,description:r}=e;if(t&&(a||s))throw new Error('Can\'t use "invalid_type_error" or "required_error" in conjunction with custom error map.');if(t)return{errorMap:t,description:r};return{errorMap:(t,r)=>{var n,i;const{message:o}=e;return"invalid_enum_value"===t.code?{message:null!=o?o:r.defaultError}:void 0===r.data?{message:null!==(n=null!=o?o:s)&&void 0!==n?n:r.defaultError}:"invalid_type"!==t.code?{message:r.defaultError}:{message:null!==(i=null!=o?o:a)&&void 0!==i?i:r.defaultError}},description:r}}class ZodType{get description(){return this._def.description}_getType(e){return getParsedType(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:getParsedType(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new ParseStatus,ctx:{common:e.parent.common,data:e.data,parsedType:getParsedType(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(isAsync(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){const t=this._parse(e);return Promise.resolve(t)}parse(e,t){const a=this.safeParse(e,t);if(a.success)return a.data;throw a.error}safeParse(e,t){var a;const s={common:{issues:[],async:null!==(a=null==t?void 0:t.async)&&void 0!==a&&a,contextualErrorMap:null==t?void 0:t.errorMap},path:(null==t?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:getParsedType(e)},r=this._parseSync({data:e,path:s.path,parent:s});return handleResult(s,r)}"~validate"(e){var t,a;const s={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:getParsedType(e)};if(!this["~standard"].async)try{const t=this._parseSync({data:e,path:[],parent:s});return isValid(t)?{value:t.value}:{issues:s.common.issues}}catch(e){(null===(a=null===(t=null==e?void 0:e.message)||void 0===t?void 0:t.toLowerCase())||void 0===a?void 0:a.includes("encountered"))&&(this["~standard"].async=!0),s.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:s}).then((e=>isValid(e)?{value:e.value}:{issues:s.common.issues}))}async parseAsync(e,t){const a=await this.safeParseAsync(e,t);if(a.success)return a.data;throw a.error}async safeParseAsync(e,t){const a={common:{issues:[],contextualErrorMap:null==t?void 0:t.errorMap,async:!0},path:(null==t?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:getParsedType(e)},s=this._parse({data:e,path:a.path,parent:a}),r=await(isAsync(s)?s:Promise.resolve(s));return handleResult(a,r)}refine(e,t){const getIssueProperties=e=>"string"==typeof t||void 0===t?{message:t}:"function"==typeof t?t(e):t;return this._refinement(((t,a)=>{const s=e(t),setError=()=>a.addIssue({code:i.custom,...getIssueProperties(t)});return"undefined"!=typeof Promise&&s instanceof Promise?s.then((e=>!!e||(setError(),!1))):!!s||(setError(),!1)}))}refinement(e,t){return this._refinement(((a,s)=>!!e(a)||(s.addIssue("function"==typeof t?t(a,s):t),!1)))}_refinement(e){return new ZodEffects({schema:this,typeName:j.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:e=>this["~validate"](e)}}optional(){return ZodOptional.create(this,this._def)}nullable(){return ZodNullable.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return ZodArray.create(this)}promise(){return ZodPromise.create(this,this._def)}or(e){return ZodUnion.create([this,e],this._def)}and(e){return ZodIntersection.create(this,e,this._def)}transform(e){return new ZodEffects({...processCreateParams(this._def),schema:this,typeName:j.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t="function"==typeof e?e:()=>e;return new ZodDefault({...processCreateParams(this._def),innerType:this,defaultValue:t,typeName:j.ZodDefault})}brand(){return new ZodBranded({typeName:j.ZodBranded,type:this,...processCreateParams(this._def)})}catch(e){const t="function"==typeof e?e:()=>e;return new ZodCatch({...processCreateParams(this._def),innerType:this,catchValue:t,typeName:j.ZodCatch})}describe(e){return new(0,this.constructor)({...this._def,description:e})}pipe(e){return ZodPipeline.create(this,e)}readonly(){return ZodReadonly.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const p=/^c[^\s-]{8,}$/i,h=/^[0-9a-z]+$/,m=/^[0-9A-HJKMNP-TV-Z]{26}$/i,f=/^[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,g=/^[a-z0-9_-]{21}$/i,y=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,_=/^[-+]?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)?)??$/,v=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i;let Z;const b=/^(?:(?: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])$/,x=/^(?:(?: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])$/,z=/^(([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]))$/,T=/^(([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])$/,k=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,C=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,S="((\\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])))",w=new RegExp(`^${S}$`);function timeRegexSource(e){let t="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return e.precision?t=`${t}\\.\\d{${e.precision}}`:null==e.precision&&(t=`${t}(\\.\\d+)?`),t}function datetimeRegex(e){let t=`${S}T${timeRegexSource(e)}`;const a=[];return a.push(e.local?"Z?":"Z"),e.offset&&a.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${a.join("|")})`,new RegExp(`^${t}$`)}function isValidJWT(e,t){if(!y.test(e))return!1;try{const[a]=e.split("."),s=a.replace(/-/g,"+").replace(/_/g,"/").padEnd(a.length+(4-a.length%4)%4,"="),r=JSON.parse(atob(s));return"object"==typeof r&&null!==r&&(!(!r.typ||!r.alg)&&(!t||r.alg===t))}catch(e){return!1}}function isValidCidr(e,t){return!("v4"!==t&&t||!x.test(e))||!("v6"!==t&&t||!T.test(e))}class ZodString extends ZodType{_parse(e){this._def.coerce&&(e.data=String(e.data));if(this._getType(e)!==n.string){const t=this._getOrReturnCtx(e);return addIssueToContext(t,{code:i.invalid_type,expected:n.string,received:t.parsedType}),d}const t=new ParseStatus;let a;for(const n of this._def.checks)if("min"===n.kind)e.data.length<n.value&&(a=this._getOrReturnCtx(e,a),addIssueToContext(a,{code:i.too_small,minimum:n.value,type:"string",inclusive:!0,exact:!1,message:n.message}),t.dirty());else if("max"===n.kind)e.data.length>n.value&&(a=this._getOrReturnCtx(e,a),addIssueToContext(a,{code:i.too_big,maximum:n.value,type:"string",inclusive:!0,exact:!1,message:n.message}),t.dirty());else if("length"===n.kind){const s=e.data.length>n.value,r=e.data.length<n.value;(s||r)&&(a=this._getOrReturnCtx(e,a),s?addIssueToContext(a,{code:i.too_big,maximum:n.value,type:"string",inclusive:!0,exact:!0,message:n.message}):r&&addIssueToContext(a,{code:i.too_small,minimum:n.value,type:"string",inclusive:!0,exact:!0,message:n.message}),t.dirty())}else if("email"===n.kind)v.test(e.data)||(a=this._getOrReturnCtx(e,a),addIssueToContext(a,{validation:"email",code:i.invalid_string,message:n.message}),t.dirty());else if("emoji"===n.kind)Z||(Z=new RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),Z.test(e.data)||(a=this._getOrReturnCtx(e,a),addIssueToContext(a,{validation:"emoji",code:i.invalid_string,message:n.message}),t.dirty());else if("uuid"===n.kind)f.test(e.data)||(a=this._getOrReturnCtx(e,a),addIssueToContext(a,{validation:"uuid",code:i.invalid_string,message:n.message}),t.dirty());else if("nanoid"===n.kind)g.test(e.data)||(a=this._getOrReturnCtx(e,a),addIssueToContext(a,{validation:"nanoid",code:i.invalid_string,message:n.message}),t.dirty());else if("cuid"===n.kind)p.test(e.data)||(a=this._getOrReturnCtx(e,a),addIssueToContext(a,{validation:"cuid",code:i.invalid_string,message:n.message}),t.dirty());else if("cuid2"===n.kind)h.test(e.data)||(a=this._getOrReturnCtx(e,a),addIssueToContext(a,{validation:"cuid2",code:i.invalid_string,message:n.message}),t.dirty());else if("ulid"===n.kind)m.test(e.data)||(a=this._getOrReturnCtx(e,a),addIssueToContext(a,{validation:"ulid",code:i.invalid_string,message:n.message}),t.dirty());else if("url"===n.kind)try{new URL(e.data)}catch(s){a=this._getOrReturnCtx(e,a),addIssueToContext(a,{validation:"url",code:i.invalid_string,message:n.message}),t.dirty()}else if("regex"===n.kind){n.regex.lastIndex=0;n.regex.test(e.data)||(a=this._getOrReturnCtx(e,a),addIssueToContext(a,{validation:"regex",code:i.invalid_string,message:n.message}),t.dirty())}else if("trim"===n.kind)e.data=e.data.trim();else if("includes"===n.kind)e.data.includes(n.value,n.position)||(a=this._getOrReturnCtx(e,a),addIssueToContext(a,{code:i.invalid_string,validation:{includes:n.value,position:n.position},message:n.message}),t.dirty());else if("toLowerCase"===n.kind)e.data=e.data.toLowerCase();else if("toUpperCase"===n.kind)e.data=e.data.toUpperCase();else if("startsWith"===n.kind)e.data.startsWith(n.value)||(a=this._getOrReturnCtx(e,a),addIssueToContext(a,{code:i.invalid_string,validation:{startsWith:n.value},message:n.message}),t.dirty());else if("endsWith"===n.kind)e.data.endsWith(n.value)||(a=this._getOrReturnCtx(e,a),addIssueToContext(a,{code:i.invalid_string,validation:{endsWith:n.value},message:n.message}),t.dirty());else if("datetime"===n.kind){datetimeRegex(n).test(e.data)||(a=this._getOrReturnCtx(e,a),addIssueToContext(a,{code:i.invalid_string,validation:"datetime",message:n.message}),t.dirty())}else if("date"===n.kind){w.test(e.data)||(a=this._getOrReturnCtx(e,a),addIssueToContext(a,{code:i.invalid_string,validation:"date",message:n.message}),t.dirty())}else if("time"===n.kind){new RegExp(`^${timeRegexSource(n)}$`).test(e.data)||(a=this._getOrReturnCtx(e,a),addIssueToContext(a,{code:i.invalid_string,validation:"time",message:n.message}),t.dirty())}else"duration"===n.kind?_.test(e.data)||(a=this._getOrReturnCtx(e,a),addIssueToContext(a,{validation:"duration",code:i.invalid_string,message:n.message}),t.dirty()):"ip"===n.kind?(r=e.data,("v4"!==(o=n.version)&&o||!b.test(r))&&("v6"!==o&&o||!z.test(r))&&(a=this._getOrReturnCtx(e,a),addIssueToContext(a,{validation:"ip",code:i.invalid_string,message:n.message}),t.dirty())):"jwt"===n.kind?isValidJWT(e.data,n.alg)||(a=this._getOrReturnCtx(e,a),addIssueToContext(a,{validation:"jwt",code:i.invalid_string,message:n.message}),t.dirty()):"cidr"===n.kind?isValidCidr(e.data,n.version)||(a=this._getOrReturnCtx(e,a),addIssueToContext(a,{validation:"cidr",code:i.invalid_string,message:n.message}),t.dirty()):"base64"===n.kind?k.test(e.data)||(a=this._getOrReturnCtx(e,a),addIssueToContext(a,{validation:"base64",code:i.invalid_string,message:n.message}),t.dirty()):"base64url"===n.kind?C.test(e.data)||(a=this._getOrReturnCtx(e,a),addIssueToContext(a,{validation:"base64url",code:i.invalid_string,message:n.message}),t.dirty()):s.assertNever(n);var r,o;return{status:t.value,value:e.data}}_regex(e,t,a){return this.refinement((t=>e.test(t)),{validation:t,code:i.invalid_string,...c.errToObj(a)})}_addCheck(e){return new ZodString({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...c.errToObj(e)})}url(e){return this._addCheck({kind:"url",...c.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...c.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...c.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...c.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...c.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...c.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...c.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...c.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...c.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...c.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...c.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...c.errToObj(e)})}datetime(e){var t,a;return"string"==typeof e?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:void 0===(null==e?void 0:e.precision)?null:null==e?void 0:e.precision,offset:null!==(t=null==e?void 0:e.offset)&&void 0!==t&&t,local:null!==(a=null==e?void 0:e.local)&&void 0!==a&&a,...c.errToObj(null==e?void 0:e.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return"string"==typeof e?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:void 0===(null==e?void 0:e.precision)?null:null==e?void 0:e.precision,...c.errToObj(null==e?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...c.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...c.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:null==t?void 0:t.position,...c.errToObj(null==t?void 0:t.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...c.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...c.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...c.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...c.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...c.errToObj(t)})}nonempty(e){return this.min(1,c.errToObj(e))}trim(){return new ZodString({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new ZodString({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new ZodString({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find((e=>"datetime"===e.kind))}get isDate(){return!!this._def.checks.find((e=>"date"===e.kind))}get isTime(){return!!this._def.checks.find((e=>"time"===e.kind))}get isDuration(){return!!this._def.checks.find((e=>"duration"===e.kind))}get isEmail(){return!!this._def.checks.find((e=>"email"===e.kind))}get isURL(){return!!this._def.checks.find((e=>"url"===e.kind))}get isEmoji(){return!!this._def.checks.find((e=>"emoji"===e.kind))}get isUUID(){return!!this._def.checks.find((e=>"uuid"===e.kind))}get isNANOID(){return!!this._def.checks.find((e=>"nanoid"===e.kind))}get isCUID(){return!!this._def.checks.find((e=>"cuid"===e.kind))}get isCUID2(){return!!this._def.checks.find((e=>"cuid2"===e.kind))}get isULID(){return!!this._def.checks.find((e=>"ulid"===e.kind))}get isIP(){return!!this._def.checks.find((e=>"ip"===e.kind))}get isCIDR(){return!!this._def.checks.find((e=>"cidr"===e.kind))}get isBase64(){return!!this._def.checks.find((e=>"base64"===e.kind))}get isBase64url(){return!!this._def.checks.find((e=>"base64url"===e.kind))}get minLength(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}}function floatSafeRemainder(e,t){const a=(e.toString().split(".")[1]||"").length,s=(t.toString().split(".")[1]||"").length,r=a>s?a:s;return parseInt(e.toFixed(r).replace(".",""))%parseInt(t.toFixed(r).replace(".",""))/Math.pow(10,r)}ZodString.create=e=>{var t;return new ZodString({checks:[],typeName:j.ZodString,coerce:null!==(t=null==e?void 0:e.coerce)&&void 0!==t&&t,...processCreateParams(e)})};class ZodNumber extends ZodType{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){this._def.coerce&&(e.data=Number(e.data));if(this._getType(e)!==n.number){const t=this._getOrReturnCtx(e);return addIssueToContext(t,{code:i.invalid_type,expected:n.number,received:t.parsedType}),d}let t;const a=new ParseStatus;for(const r of this._def.checks)if("int"===r.kind)s.isInteger(e.data)||(t=this._getOrReturnCtx(e,t),addIssueToContext(t,{code:i.invalid_type,expected:"integer",received:"float",message:r.message}),a.dirty());else if("min"===r.kind){(r.inclusive?e.data<r.value:e.data<=r.value)&&(t=this._getOrReturnCtx(e,t),addIssueToContext(t,{code:i.too_small,minimum:r.value,type:"number",inclusive:r.inclusive,exact:!1,message:r.message}),a.dirty())}else if("max"===r.kind){(r.inclusive?e.data>r.value:e.data>=r.value)&&(t=this._getOrReturnCtx(e,t),addIssueToContext(t,{code:i.too_big,maximum:r.value,type:"number",inclusive:r.inclusive,exact:!1,message:r.message}),a.dirty())}else"multipleOf"===r.kind?0!==floatSafeRemainder(e.data,r.value)&&(t=this._getOrReturnCtx(e,t),addIssueToContext(t,{code:i.not_multiple_of,multipleOf:r.value,message:r.message}),a.dirty()):"finite"===r.kind?Number.isFinite(e.data)||(t=this._getOrReturnCtx(e,t),addIssueToContext(t,{code:i.not_finite,message:r.message}),a.dirty()):s.assertNever(r);return{status:a.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,c.toString(t))}gt(e,t){return this.setLimit("min",e,!1,c.toString(t))}lte(e,t){return this.setLimit("max",e,!0,c.toString(t))}lt(e,t){return this.setLimit("max",e,!1,c.toString(t))}setLimit(e,t,a,s){return new ZodNumber({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:a,message:c.toString(s)}]})}_addCheck(e){return new ZodNumber({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:c.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:c.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:c.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:c.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:c.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:c.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:c.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:c.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:c.toString(e)})}get minValue(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find((e=>"int"===e.kind||"multipleOf"===e.kind&&s.isInteger(e.value)))}get isFinite(){let e=null,t=null;for(const a of this._def.checks){if("finite"===a.kind||"int"===a.kind||"multipleOf"===a.kind)return!0;"min"===a.kind?(null===t||a.value>t)&&(t=a.value):"max"===a.kind&&(null===e||a.value<e)&&(e=a.value)}return Number.isFinite(t)&&Number.isFinite(e)}}ZodNumber.create=e=>new ZodNumber({checks:[],typeName:j.ZodNumber,coerce:(null==e?void 0:e.coerce)||!1,...processCreateParams(e)});class ZodBigInt extends ZodType{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch(t){return this._getInvalidInput(e)}if(this._getType(e)!==n.bigint)return this._getInvalidInput(e);let t;const a=new ParseStatus;for(const r of this._def.checks)if("min"===r.kind){(r.inclusive?e.data<r.value:e.data<=r.value)&&(t=this._getOrReturnCtx(e,t),addIssueToContext(t,{code:i.too_small,type:"bigint",minimum:r.value,inclusive:r.inclusive,message:r.message}),a.dirty())}else if("max"===r.kind){(r.inclusive?e.data>r.value:e.data>=r.value)&&(t=this._getOrReturnCtx(e,t),addIssueToContext(t,{code:i.too_big,type:"bigint",maximum:r.value,inclusive:r.inclusive,message:r.message}),a.dirty())}else"multipleOf"===r.kind?e.data%r.value!==BigInt(0)&&(t=this._getOrReturnCtx(e,t),addIssueToContext(t,{code:i.not_multiple_of,multipleOf:r.value,message:r.message}),a.dirty()):s.assertNever(r);return{status:a.value,value:e.data}}_getInvalidInput(e){const t=this._getOrReturnCtx(e);return addIssueToContext(t,{code:i.invalid_type,expected:n.bigint,received:t.parsedType}),d}gte(e,t){return this.setLimit("min",e,!0,c.toString(t))}gt(e,t){return this.setLimit("min",e,!1,c.toString(t))}lte(e,t){return this.setLimit("max",e,!0,c.toString(t))}lt(e,t){return this.setLimit("max",e,!1,c.toString(t))}setLimit(e,t,a,s){return new ZodBigInt({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:a,message:c.toString(s)}]})}_addCheck(e){return new ZodBigInt({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:c.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:c.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:c.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:c.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:c.toString(t)})}get minValue(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}}ZodBigInt.create=e=>{var t;return new ZodBigInt({checks:[],typeName:j.ZodBigInt,coerce:null!==(t=null==e?void 0:e.coerce)&&void 0!==t&&t,...processCreateParams(e)})};class ZodBoolean extends ZodType{_parse(e){this._def.coerce&&(e.data=Boolean(e.data));if(this._getType(e)!==n.boolean){const t=this._getOrReturnCtx(e);return addIssueToContext(t,{code:i.invalid_type,expected:n.boolean,received:t.parsedType}),d}return OK(e.data)}}ZodBoolean.create=e=>new ZodBoolean({typeName:j.ZodBoolean,coerce:(null==e?void 0:e.coerce)||!1,...processCreateParams(e)});class ZodDate extends ZodType{_parse(e){this._def.coerce&&(e.data=new Date(e.data));if(this._getType(e)!==n.date){const t=this._getOrReturnCtx(e);return addIssueToContext(t,{code:i.invalid_type,expected:n.date,received:t.parsedType}),d}if(isNaN(e.data.getTime())){return addIssueToContext(this._getOrReturnCtx(e),{code:i.invalid_date}),d}const t=new ParseStatus;let a;for(const r of this._def.checks)"min"===r.kind?e.data.getTime()<r.value&&(a=this._getOrReturnCtx(e,a),addIssueToContext(a,{code:i.too_small,message:r.message,inclusive:!0,exact:!1,minimum:r.value,type:"date"}),t.dirty()):"max"===r.kind?e.data.getTime()>r.value&&(a=this._getOrReturnCtx(e,a),addIssueToContext(a,{code:i.too_big,message:r.message,inclusive:!0,exact:!1,maximum:r.value,type:"date"}),t.dirty()):s.assertNever(r);return{status:t.value,value:new Date(e.data.getTime())}}_addCheck(e){return new ZodDate({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:c.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:c.toString(t)})}get minDate(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return null!=e?new Date(e):null}get maxDate(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return null!=e?new Date(e):null}}ZodDate.create=e=>new ZodDate({checks:[],coerce:(null==e?void 0:e.coerce)||!1,typeName:j.ZodDate,...processCreateParams(e)});class ZodSymbol extends ZodType{_parse(e){if(this._getType(e)!==n.symbol){const t=this._getOrReturnCtx(e);return addIssueToContext(t,{code:i.invalid_type,expected:n.symbol,received:t.parsedType}),d}return OK(e.data)}}ZodSymbol.create=e=>new ZodSymbol({typeName:j.ZodSymbol,...processCreateParams(e)});class ZodUndefined extends ZodType{_parse(e){if(this._getType(e)!==n.undefined){const t=this._getOrReturnCtx(e);return addIssueToContext(t,{code:i.invalid_type,expected:n.undefined,received:t.parsedType}),d}return OK(e.data)}}ZodUndefined.create=e=>new ZodUndefined({typeName:j.ZodUndefined,...processCreateParams(e)});class ZodNull extends ZodType{_parse(e){if(this._getType(e)!==n.null){const t=this._getOrReturnCtx(e);return addIssueToContext(t,{code:i.invalid_type,expected:n.null,received:t.parsedType}),d}return OK(e.data)}}ZodNull.create=e=>new ZodNull({typeName:j.ZodNull,...processCreateParams(e)});class ZodAny extends ZodType{constructor(){super(...arguments),this._any=!0}_parse(e){return OK(e.data)}}ZodAny.create=e=>new ZodAny({typeName:j.ZodAny,...processCreateParams(e)});class ZodUnknown extends ZodType{constructor(){super(...arguments),this._unknown=!0}_parse(e){return OK(e.data)}}ZodUnknown.create=e=>new ZodUnknown({typeName:j.ZodUnknown,...processCreateParams(e)});class ZodNever extends ZodType{_parse(e){const t=this._getOrReturnCtx(e);return addIssueToContext(t,{code:i.invalid_type,expected:n.never,received:t.parsedType}),d}}ZodNever.create=e=>new ZodNever({typeName:j.ZodNever,...processCreateParams(e)});class ZodVoid extends ZodType{_parse(e){if(this._getType(e)!==n.undefined){const t=this._getOrReturnCtx(e);return addIssueToContext(t,{code:i.invalid_type,expected:n.void,received:t.parsedType}),d}return OK(e.data)}}ZodVoid.create=e=>new ZodVoid({typeName:j.ZodVoid,...processCreateParams(e)});class ZodArray extends ZodType{_parse(e){const{ctx:t,status:a}=this._processInputParams(e),s=this._def;if(t.parsedType!==n.array)return addIssueToContext(t,{code:i.invalid_type,expected:n.array,received:t.parsedType}),d;if(null!==s.exactLength){const e=t.data.length>s.exactLength.value,r=t.data.length<s.exactLength.value;(e||r)&&(addIssueToContext(t,{code:e?i.too_big:i.too_small,minimum:r?s.exactLength.value:void 0,maximum:e?s.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:s.exactLength.message}),a.dirty())}if(null!==s.minLength&&t.data.length<s.minLength.value&&(addIssueToContext(t,{code:i.too_small,minimum:s.minLength.value,type:"array",inclusive:!0,exact:!1,message:s.minLength.message}),a.dirty()),null!==s.maxLength&&t.data.length>s.maxLength.value&&(addIssueToContext(t,{code:i.too_big,maximum:s.maxLength.value,type:"array",inclusive:!0,exact:!1,message:s.maxLength.message}),a.dirty()),t.common.async)return Promise.all([...t.data].map(((e,a)=>s.type._parseAsync(new ParseInputLazyPath(t,e,t.path,a))))).then((e=>ParseStatus.mergeArray(a,e)));const r=[...t.data].map(((e,a)=>s.type._parseSync(new ParseInputLazyPath(t,e,t.path,a))));return ParseStatus.mergeArray(a,r)}get element(){return this._def.type}min(e,t){return new ZodArray({...this._def,minLength:{value:e,message:c.toString(t)}})}max(e,t){return new ZodArray({...this._def,maxLength:{value:e,message:c.toString(t)}})}length(e,t){return new ZodArray({...this._def,exactLength:{value:e,message:c.toString(t)}})}nonempty(e){return this.min(1,e)}}function deepPartialify(e){if(e instanceof ZodObject){const t={};for(const a in e.shape){const s=e.shape[a];t[a]=ZodOptional.create(deepPartialify(s))}return new ZodObject({...e._def,shape:()=>t})}return e instanceof ZodArray?new ZodArray({...e._def,type:deepPartialify(e.element)}):e instanceof ZodOptional?ZodOptional.create(deepPartialify(e.unwrap())):e instanceof ZodNullable?ZodNullable.create(deepPartialify(e.unwrap())):e instanceof ZodTuple?ZodTuple.create(e.items.map((e=>deepPartialify(e)))):e}ZodArray.create=(e,t)=>new ZodArray({type:e,minLength:null,maxLength:null,exactLength:null,typeName:j.ZodArray,...processCreateParams(t)});class ZodObject extends ZodType{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(null!==this._cached)return this._cached;const e=this._def.shape(),t=s.objectKeys(e);return this._cached={shape:e,keys:t}}_parse(e){if(this._getType(e)!==n.object){const t=this._getOrReturnCtx(e);return addIssueToContext(t,{code:i.invalid_type,expected:n.object,received:t.parsedType}),d}const{status:t,ctx:a}=this._processInputParams(e),{shape:s,keys:r}=this._getCached(),o=[];if(!(this._def.catchall instanceof ZodNever&&"strip"===this._def.unknownKeys))for(const e in a.data)r.includes(e)||o.push(e);const c=[];for(const e of r){const t=s[e],r=a.data[e];c.push({key:{status:"valid",value:e},value:t._parse(new ParseInputLazyPath(a,r,a.path,e)),alwaysSet:e in a.data})}if(this._def.catchall instanceof ZodNever){const e=this._def.unknownKeys;if("passthrough"===e)for(const e of o)c.push({key:{status:"valid",value:e},value:{status:"valid",value:a.data[e]}});else if("strict"===e)o.length>0&&(addIssueToContext(a,{code:i.unrecognized_keys,keys:o}),t.dirty());else if("strip"!==e)throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const e=this._def.catchall;for(const t of o){const s=a.data[t];c.push({key:{status:"valid",value:t},value:e._parse(new ParseInputLazyPath(a,s,a.path,t)),alwaysSet:t in a.data})}}return a.common.async?Promise.resolve().then((async()=>{const e=[];for(const t of c){const a=await t.key,s=await t.value;e.push({key:a,value:s,alwaysSet:t.alwaysSet})}return e})).then((e=>ParseStatus.mergeObjectSync(t,e))):ParseStatus.mergeObjectSync(t,c)}get shape(){return this._def.shape()}strict(e){return c.errToObj,new ZodObject({...this._def,unknownKeys:"strict",...void 0!==e?{errorMap:(t,a)=>{var s,r,n,i;const o=null!==(n=null===(r=(s=this._def).errorMap)||void 0===r?void 0:r.call(s,t,a).message)&&void 0!==n?n:a.defaultError;return"unrecognized_keys"===t.code?{message:null!==(i=c.errToObj(e).message)&&void 0!==i?i:o}:{message:o}}}:{}})}strip(){return new ZodObject({...this._def,unknownKeys:"strip"})}passthrough(){return new ZodObject({...this._def,unknownKeys:"passthrough"})}extend(e){return new ZodObject({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new ZodObject({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:j.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new ZodObject({...this._def,catchall:e})}pick(e){const t={};return s.objectKeys(e).forEach((a=>{e[a]&&this.shape[a]&&(t[a]=this.shape[a])})),new ZodObject({...this._def,shape:()=>t})}omit(e){const t={};return s.objectKeys(this.shape).forEach((a=>{e[a]||(t[a]=this.shape[a])})),new ZodObject({...this._def,shape:()=>t})}deepPartial(){return deepPartialify(this)}partial(e){const t={};return s.objectKeys(this.shape).forEach((a=>{const s=this.shape[a];e&&!e[a]?t[a]=s:t[a]=s.optional()})),new ZodObject({...this._def,shape:()=>t})}required(e){const t={};return s.objectKeys(this.shape).forEach((a=>{if(e&&!e[a])t[a]=this.shape[a];else{let e=this.shape[a];for(;e instanceof ZodOptional;)e=e._def.innerType;t[a]=e}})),new ZodObject({...this._def,shape:()=>t})}keyof(){return createZodEnum(s.objectKeys(this.shape))}}ZodObject.create=(e,t)=>new ZodObject({shape:()=>e,unknownKeys:"strip",catchall:ZodNever.create(),typeName:j.ZodObject,...processCreateParams(t)}),ZodObject.strictCreate=(e,t)=>new ZodObject({shape:()=>e,unknownKeys:"strict",catchall:ZodNever.create(),typeName:j.ZodObject,...processCreateParams(t)}),ZodObject.lazycreate=(e,t)=>new ZodObject({shape:e,unknownKeys:"strip",catchall:ZodNever.create(),typeName:j.ZodObject,...processCreateParams(t)});class ZodUnion extends ZodType{_parse(e){const{ctx:t}=this._processInputParams(e),a=this._def.options;if(t.common.async)return Promise.all(a.map((async e=>{const a={...t,common:{...t.common,issues:[]},parent:null};return{result:await e._parseAsync({data:t.data,path:t.path,parent:a}),ctx:a}}))).then((function handleResults(e){for(const t of e)if("valid"===t.result.status)return t.result;for(const a of e)if("dirty"===a.result.status)return t.common.issues.push(...a.ctx.common.issues),a.result;const a=e.map((e=>new ZodError(e.ctx.common.issues)));return addIssueToContext(t,{code:i.invalid_union,unionErrors:a}),d}));{let e;const s=[];for(const r of a){const a={...t,common:{...t.common,issues:[]},parent:null},n=r._parseSync({data:t.data,path:t.path,parent:a});if("valid"===n.status)return n;"dirty"!==n.status||e||(e={result:n,ctx:a}),a.common.issues.length&&s.push(a.common.issues)}if(e)return t.common.issues.push(...e.ctx.common.issues),e.result;const r=s.map((e=>new ZodError(e)));return addIssueToContext(t,{code:i.invalid_union,unionErrors:r}),d}}get options(){return this._def.options}}ZodUnion.create=(e,t)=>new ZodUnion({options:e,typeName:j.ZodUnion,...processCreateParams(t)});const getDiscriminator=e=>e instanceof ZodLazy?getDiscriminator(e.schema):e instanceof ZodEffects?getDiscriminator(e.innerType()):e instanceof ZodLiteral?[e.value]:e instanceof ZodEnum?e.options:e instanceof ZodNativeEnum?s.objectValues(e.enum):e instanceof ZodDefault?getDiscriminator(e._def.innerType):e instanceof ZodUndefined?[void 0]:e instanceof ZodNull?[null]:e instanceof ZodOptional?[void 0,...getDiscriminator(e.unwrap())]:e instanceof ZodNullable?[null,...getDiscriminator(e.unwrap())]:e instanceof ZodBranded||e instanceof ZodReadonly?getDiscriminator(e.unwrap()):e instanceof ZodCatch?getDiscriminator(e._def.innerType):[];class ZodDiscriminatedUnion extends ZodType{_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==n.object)return addIssueToContext(t,{code:i.invalid_type,expected:n.object,received:t.parsedType}),d;const a=this.discriminator,s=t.data[a],r=this.optionsMap.get(s);return r?t.common.async?r._parseAsync({data:t.data,path:t.path,parent:t}):r._parseSync({data:t.data,path:t.path,parent:t}):(addIssueToContext(t,{code:i.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[a]}),d)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,a){const s=new Map;for(const a of t){const t=getDiscriminator(a.shape[e]);if(!t.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const r of t){if(s.has(r))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(r)}`);s.set(r,a)}}return new ZodDiscriminatedUnion({typeName:j.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:s,...processCreateParams(a)})}}function mergeValues(e,t){const a=getParsedType(e),r=getParsedType(t);if(e===t)return{valid:!0,data:e};if(a===n.object&&r===n.object){const a=s.objectKeys(t),r=s.objectKeys(e).filter((e=>-1!==a.indexOf(e))),n={...e,...t};for(const a of r){const s=mergeValues(e[a],t[a]);if(!s.valid)return{valid:!1};n[a]=s.data}return{valid:!0,data:n}}if(a===n.array&&r===n.array){if(e.length!==t.length)return{valid:!1};const a=[];for(let s=0;s<e.length;s++){const r=mergeValues(e[s],t[s]);if(!r.valid)return{valid:!1};a.push(r.data)}return{valid:!0,data:a}}return a===n.date&&r===n.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}class ZodIntersection extends ZodType{_parse(e){const{status:t,ctx:a}=this._processInputParams(e),handleParsed=(e,s)=>{if(isAborted(e)||isAborted(s))return d;const r=mergeValues(e.value,s.value);return r.valid?((isDirty(e)||isDirty(s))&&t.dirty(),{status:t.value,value:r.data}):(addIssueToContext(a,{code:i.invalid_intersection_types}),d)};return a.common.async?Promise.all([this._def.left._parseAsync({data:a.data,path:a.path,parent:a}),this._def.right._parseAsync({data:a.data,path:a.path,parent:a})]).then((([e,t])=>handleParsed(e,t))):handleParsed(this._def.left._parseSync({data:a.data,path:a.path,parent:a}),this._def.right._parseSync({data:a.data,path:a.path,parent:a}))}}ZodIntersection.create=(e,t,a)=>new ZodIntersection({left:e,right:t,typeName:j.ZodIntersection,...processCreateParams(a)});class ZodTuple extends ZodType{_parse(e){const{status:t,ctx:a}=this._processInputParams(e);if(a.parsedType!==n.array)return addIssueToContext(a,{code:i.invalid_type,expected:n.array,received:a.parsedType}),d;if(a.data.length<this._def.items.length)return addIssueToContext(a,{code:i.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),d;!this._def.rest&&a.data.length>this._def.items.length&&(addIssueToContext(a,{code:i.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());const s=[...a.data].map(((e,t)=>{const s=this._def.items[t]||this._def.rest;return s?s._parse(new ParseInputLazyPath(a,e,a.path,t)):null})).filter((e=>!!e));return a.common.async?Promise.all(s).then((e=>ParseStatus.mergeArray(t,e))):ParseStatus.mergeArray(t,s)}get items(){return this._def.items}rest(e){return new ZodTuple({...this._def,rest:e})}}ZodTuple.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new ZodTuple({items:e,typeName:j.ZodTuple,rest:null,...processCreateParams(t)})};class ZodRecord extends ZodType{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:a}=this._processInputParams(e);if(a.parsedType!==n.object)return addIssueToContext(a,{code:i.invalid_type,expected:n.object,received:a.parsedType}),d;const s=[],r=this._def.keyType,o=this._def.valueType;for(const e in a.data)s.push({key:r._parse(new ParseInputLazyPath(a,e,a.path,e)),value:o._parse(new ParseInputLazyPath(a,a.data[e],a.path,e)),alwaysSet:e in a.data});return a.common.async?ParseStatus.mergeObjectAsync(t,s):ParseStatus.mergeObjectSync(t,s)}get element(){return this._def.valueType}static create(e,t,a){return new ZodRecord(t instanceof ZodType?{keyType:e,valueType:t,typeName:j.ZodRecord,...processCreateParams(a)}:{keyType:ZodString.create(),valueType:e,typeName:j.ZodRecord,...processCreateParams(t)})}}class ZodMap extends ZodType{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:a}=this._processInputParams(e);if(a.parsedType!==n.map)return addIssueToContext(a,{code:i.invalid_type,expected:n.map,received:a.parsedType}),d;const s=this._def.keyType,r=this._def.valueType,o=[...a.data.entries()].map((([e,t],n)=>({key:s._parse(new ParseInputLazyPath(a,e,a.path,[n,"key"])),value:r._parse(new ParseInputLazyPath(a,t,a.path,[n,"value"]))})));if(a.common.async){const e=new Map;return Promise.resolve().then((async()=>{for(const a of o){const s=await a.key,r=await a.value;if("aborted"===s.status||"aborted"===r.status)return d;"dirty"!==s.status&&"dirty"!==r.status||t.dirty(),e.set(s.value,r.value)}return{status:t.value,value:e}}))}{const e=new Map;for(const a of o){const s=a.key,r=a.value;if("aborted"===s.status||"aborted"===r.status)return d;"dirty"!==s.status&&"dirty"!==r.status||t.dirty(),e.set(s.value,r.value)}return{status:t.value,value:e}}}}ZodMap.create=(e,t,a)=>new ZodMap({valueType:t,keyType:e,typeName:j.ZodMap,...processCreateParams(a)});class ZodSet extends ZodType{_parse(e){const{status:t,ctx:a}=this._processInputParams(e);if(a.parsedType!==n.set)return addIssueToContext(a,{code:i.invalid_type,expected:n.set,received:a.parsedType}),d;const s=this._def;null!==s.minSize&&a.data.size<s.minSize.value&&(addIssueToContext(a,{code:i.too_small,minimum:s.minSize.value,type:"set",inclusive:!0,exact:!1,message:s.minSize.message}),t.dirty()),null!==s.maxSize&&a.data.size>s.maxSize.value&&(addIssueToContext(a,{code:i.too_big,maximum:s.maxSize.value,type:"set",inclusive:!0,exact:!1,message:s.maxSize.message}),t.dirty());const r=this._def.valueType;function finalizeSet(e){const a=new Set;for(const s of e){if("aborted"===s.status)return d;"dirty"===s.status&&t.dirty(),a.add(s.value)}return{status:t.value,value:a}}const o=[...a.data.values()].map(((e,t)=>r._parse(new ParseInputLazyPath(a,e,a.path,t))));return a.common.async?Promise.all(o).then((e=>finalizeSet(e))):finalizeSet(o)}min(e,t){return new ZodSet({...this._def,minSize:{value:e,message:c.toString(t)}})}max(e,t){return new ZodSet({...this._def,maxSize:{value:e,message:c.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}ZodSet.create=(e,t)=>new ZodSet({valueType:e,minSize:null,maxSize:null,typeName:j.ZodSet,...processCreateParams(t)});class ZodFunction extends ZodType{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==n.function)return addIssueToContext(t,{code:i.invalid_type,expected:n.function,received:t.parsedType}),d;function makeArgsIssue(e,a){return makeIssue({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,getErrorMap(),errorMap].filter((e=>!!e)),issueData:{code:i.invalid_arguments,argumentsError:a}})}function makeReturnsIssue(e,a){return makeIssue({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,getErrorMap(),errorMap].filter((e=>!!e)),issueData:{code:i.invalid_return_type,returnTypeError:a}})}const a={errorMap:t.common.contextualErrorMap},s=t.data;if(this._def.returns instanceof ZodPromise){const e=this;return OK((async function(...t){const r=new ZodError([]),n=await e._def.args.parseAsync(t,a).catch((e=>{throw r.addIssue(makeArgsIssue(t,e)),r})),i=await Reflect.apply(s,this,n);return await e._def.returns._def.type.parseAsync(i,a).catch((e=>{throw r.addIssue(makeReturnsIssue(i,e)),r}))}))}{const e=this;return OK((function(...t){const r=e._def.args.safeParse(t,a);if(!r.success)throw new ZodError([makeArgsIssue(t,r.error)]);const n=Reflect.apply(s,this,r.data),i=e._def.returns.safeParse(n,a);if(!i.success)throw new ZodError([makeReturnsIssue(n,i.error)]);return i.data}))}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new ZodFunction({...this._def,args:ZodTuple.create(e).rest(ZodUnknown.create())})}returns(e){return new ZodFunction({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,a){return new ZodFunction({args:e||ZodTuple.create([]).rest(ZodUnknown.create()),returns:t||ZodUnknown.create(),typeName:j.ZodFunction,...processCreateParams(a)})}}class ZodLazy extends ZodType{get schema(){return this._def.getter()}_parse(e){const{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}}ZodLazy.create=(e,t)=>new ZodLazy({getter:e,typeName:j.ZodLazy,...processCreateParams(t)});class ZodLiteral extends ZodType{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return addIssueToContext(t,{received:t.data,code:i.invalid_literal,expected:this._def.value}),d}return{status:"valid",value:e.data}}get value(){return this._def.value}}function createZodEnum(e,t){return new ZodEnum({values:e,typeName:j.ZodEnum,...processCreateParams(t)})}ZodLiteral.create=(e,t)=>new ZodLiteral({value:e,typeName:j.ZodLiteral,...processCreateParams(t)});class ZodEnum extends ZodType{constructor(){super(...arguments),u.set(this,void 0)}_parse(e){if("string"!=typeof e.data){const t=this._getOrReturnCtx(e),a=this._def.values;return addIssueToContext(t,{expected:s.joinValues(a),received:t.parsedType,code:i.invalid_type}),d}if(__classPrivateFieldGet(this,u,"f")||__classPrivateFieldSet(this,u,new Set(this._def.values),"f"),!__classPrivateFieldGet(this,u,"f").has(e.data)){const t=this._getOrReturnCtx(e),a=this._def.values;return addIssueToContext(t,{received:t.data,code:i.invalid_enum_value,options:a}),d}return OK(e.data)}get options(){return this._def.values}get enum(){const e={};for(const t of this._def.values)e[t]=t;return e}get Values(){const e={};for(const t of this._def.values)e[t]=t;return e}get Enum(){const e={};for(const t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return ZodEnum.create(e,{...this._def,...t})}exclude(e,t=this._def){return ZodEnum.create(this.options.filter((t=>!e.includes(t))),{...this._def,...t})}}u=new WeakMap,ZodEnum.create=createZodEnum;class ZodNativeEnum extends ZodType{constructor(){super(...arguments),l.set(this,void 0)}_parse(e){const t=s.getValidEnumValues(this._def.values),a=this._getOrReturnCtx(e);if(a.parsedType!==n.string&&a.parsedType!==n.number){const e=s.objectValues(t);return addIssueToContext(a,{expected:s.joinValues(e),received:a.parsedType,code:i.invalid_type}),d}if(__classPrivateFieldGet(this,l,"f")||__classPrivateFieldSet(this,l,new Set(s.getValidEnumValues(this._def.values)),"f"),!__classPrivateFieldGet(this,l,"f").has(e.data)){const e=s.objectValues(t);return addIssueToContext(a,{received:a.data,code:i.invalid_enum_value,options:e}),d}return OK(e.data)}get enum(){return this._def.values}}l=new WeakMap,ZodNativeEnum.create=(e,t)=>new ZodNativeEnum({values:e,typeName:j.ZodNativeEnum,...processCreateParams(t)});class ZodPromise extends ZodType{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==n.promise&&!1===t.common.async)return addIssueToContext(t,{code:i.invalid_type,expected:n.promise,received:t.parsedType}),d;const a=t.parsedType===n.promise?t.data:Promise.resolve(t.data);return OK(a.then((e=>this._def.type.parseAsync(e,{path:t.path,errorMap:t.common.contextualErrorMap}))))}}ZodPromise.create=(e,t)=>new ZodPromise({type:e,typeName:j.ZodPromise,...processCreateParams(t)});class ZodEffects extends ZodType{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===j.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:t,ctx:a}=this._processInputParams(e),r=this._def.effect||null,n={addIssue:e=>{addIssueToContext(a,e),e.fatal?t.abort():t.dirty()},get path(){return a.path}};if(n.addIssue=n.addIssue.bind(n),"preprocess"===r.type){const e=r.transform(a.data,n);if(a.common.async)return Promise.resolve(e).then((async e=>{if("aborted"===t.value)return d;const s=await this._def.schema._parseAsync({data:e,path:a.path,parent:a});return"aborted"===s.status?d:"dirty"===s.status||"dirty"===t.value?DIRTY(s.value):s}));{if("aborted"===t.value)return d;const s=this._def.schema._parseSync({data:e,path:a.path,parent:a});return"aborted"===s.status?d:"dirty"===s.status||"dirty"===t.value?DIRTY(s.value):s}}if("refinement"===r.type){const executeRefinement=e=>{const t=r.refinement(e,n);if(a.common.async)return Promise.resolve(t);if(t instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return e};if(!1===a.common.async){const e=this._def.schema._parseSync({data:a.data,path:a.path,parent:a});return"aborted"===e.status?d:("dirty"===e.status&&t.dirty(),executeRefinement(e.value),{status:t.value,value:e.value})}return this._def.schema._parseAsync({data:a.data,path:a.path,parent:a}).then((e=>"aborted"===e.status?d:("dirty"===e.status&&t.dirty(),executeRefinement(e.value).then((()=>({status:t.value,value:e.value}))))))}if("transform"===r.type){if(!1===a.common.async){const e=this._def.schema._parseSync({data:a.data,path:a.path,parent:a});if(!isValid(e))return e;const s=r.transform(e.value,n);if(s instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:s}}return this._def.schema._parseAsync({data:a.data,path:a.path,parent:a}).then((e=>isValid(e)?Promise.resolve(r.transform(e.value,n)).then((e=>({status:t.value,value:e}))):e))}s.assertNever(r)}}ZodEffects.create=(e,t,a)=>new ZodEffects({schema:e,typeName:j.ZodEffects,effect:t,...processCreateParams(a)}),ZodEffects.createWithPreprocess=(e,t,a)=>new ZodEffects({schema:t,effect:{type:"preprocess",transform:e},typeName:j.ZodEffects,...processCreateParams(a)});class ZodOptional extends ZodType{_parse(e){return this._getType(e)===n.undefined?OK(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}ZodOptional.create=(e,t)=>new ZodOptional({innerType:e,typeName:j.ZodOptional,...processCreateParams(t)});class ZodNullable extends ZodType{_parse(e){return this._getType(e)===n.null?OK(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}ZodNullable.create=(e,t)=>new ZodNullable({innerType:e,typeName:j.ZodNullable,...processCreateParams(t)});class ZodDefault extends ZodType{_parse(e){const{ctx:t}=this._processInputParams(e);let a=t.data;return t.parsedType===n.undefined&&(a=this._def.defaultValue()),this._def.innerType._parse({data:a,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}ZodDefault.create=(e,t)=>new ZodDefault({innerType:e,typeName:j.ZodDefault,defaultValue:"function"==typeof t.default?t.default:()=>t.default,...processCreateParams(t)});class ZodCatch extends ZodType{_parse(e){const{ctx:t}=this._processInputParams(e),a={...t,common:{...t.common,issues:[]}},s=this._def.innerType._parse({data:a.data,path:a.path,parent:{...a}});return isAsync(s)?s.then((e=>({status:"valid",value:"valid"===e.status?e.value:this._def.catchValue({get error(){return new ZodError(a.common.issues)},input:a.data})}))):{status:"valid",value:"valid"===s.status?s.value:this._def.catchValue({get error(){return new ZodError(a.common.issues)},input:a.data})}}removeCatch(){return this._def.innerType}}ZodCatch.create=(e,t)=>new ZodCatch({innerType:e,typeName:j.ZodCatch,catchValue:"function"==typeof t.catch?t.catch:()=>t.catch,...processCreateParams(t)});class ZodNaN extends ZodType{_parse(e){if(this._getType(e)!==n.nan){const t=this._getOrReturnCtx(e);return addIssueToContext(t,{code:i.invalid_type,expected:n.nan,received:t.parsedType}),d}return{status:"valid",value:e.data}}}ZodNaN.create=e=>new ZodNaN({typeName:j.ZodNaN,...processCreateParams(e)});const P=Symbol("zod_brand");class ZodBranded extends ZodType{_parse(e){const{ctx:t}=this._processInputParams(e),a=t.data;return this._def.type._parse({data:a,path:t.path,parent:t})}unwrap(){return this._def.type}}class ZodPipeline extends ZodType{_parse(e){const{status:t,ctx:a}=this._processInputParams(e);if(a.common.async){return(async()=>{const e=await this._def.in._parseAsync({data:a.data,path:a.path,parent:a});return"aborted"===e.status?d:"dirty"===e.status?(t.dirty(),DIRTY(e.value)):this._def.out._parseAsync({data:e.value,path:a.path,parent:a})})()}{const e=this._def.in._parseSync({data:a.data,path:a.path,parent:a});return"aborted"===e.status?d:"dirty"===e.status?(t.dirty(),{status:"dirty",value:e.value}):this._def.out._parseSync({data:e.value,path:a.path,parent:a})}}static create(e,t){return new ZodPipeline({in:e,out:t,typeName:j.ZodPipeline})}}class ZodReadonly extends ZodType{_parse(e){const t=this._def.innerType._parse(e),freeze=e=>(isValid(e)&&(e.value=Object.freeze(e.value)),e);return isAsync(t)?t.then((e=>freeze(e))):freeze(t)}unwrap(){return this._def.innerType}}function cleanParams(e,t){const a="function"==typeof e?e(t):"string"==typeof e?{message:e}:e;return"string"==typeof a?{message:a}:a}function custom(e,t={},a){return e?ZodAny.create().superRefine(((s,r)=>{var n,i;const o=e(s);if(o instanceof Promise)return o.then((e=>{var n,i;if(!e){const e=cleanParams(t,s),o=null===(i=null!==(n=e.fatal)&&void 0!==n?n:a)||void 0===i||i;r.addIssue({code:"custom",...e,fatal:o})}}));if(!o){const e=cleanParams(t,s),o=null===(i=null!==(n=e.fatal)&&void 0!==n?n:a)||void 0===i||i;r.addIssue({code:"custom",...e,fatal:o})}})):ZodAny.create()}ZodReadonly.create=(e,t)=>new ZodReadonly({innerType:e,typeName:j.ZodReadonly,...processCreateParams(t)});const I={object:ZodObject.lazycreate};var j;!function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"}(j||(j={}));const N=ZodString.create,R=ZodNumber.create,O=ZodNaN.create,E=ZodBigInt.create,A=ZodBoolean.create,L=ZodDate.create,M=ZodSymbol.create,$=ZodUndefined.create,F=ZodNull.create,D=ZodAny.create,U=ZodUnknown.create,V=ZodNever.create,q=ZodVoid.create,B=ZodArray.create,K=ZodObject.create,W=ZodObject.strictCreate,J=ZodUnion.create,G=ZodDiscriminatedUnion.create,H=ZodIntersection.create,Y=ZodTuple.create,X=ZodRecord.create,Q=ZodMap.create,ee=ZodSet.create,te=ZodFunction.create,ae=ZodLazy.create,se=ZodLiteral.create,re=ZodEnum.create,ne=ZodNativeEnum.create,ie=ZodPromise.create,oe=ZodEffects.create,de=ZodOptional.create,ce=ZodNullable.create,ue=ZodEffects.createWithPreprocess,le=ZodPipeline.create,pe={string:e=>ZodString.create({...e,coerce:!0}),number:e=>ZodNumber.create({...e,coerce:!0}),boolean:e=>ZodBoolean.create({...e,coerce:!0}),bigint:e=>ZodBigInt.create({...e,coerce:!0}),date:e=>ZodDate.create({...e,coerce:!0})},he=d;var me=Object.freeze({__proto__:null,defaultErrorMap:errorMap,setErrorMap:function setErrorMap(e){o=e},getErrorMap,makeIssue,EMPTY_PATH:[],addIssueToContext,ParseStatus,INVALID:d,DIRTY,OK,isAborted,isDirty,isValid,isAsync,get util(){return s},get objectUtil(){return r},ZodParsedType:n,getParsedType,ZodType,datetimeRegex,ZodString,ZodNumber,ZodBigInt,ZodBoolean,ZodDate,ZodSymbol,ZodUndefined,ZodNull,ZodAny,ZodUnknown,ZodNever,ZodVoid,ZodArray,ZodObject,ZodUnion,ZodDiscriminatedUnion,ZodIntersection,ZodTuple,ZodRecord,ZodMap,ZodSet,ZodFunction,ZodLazy,ZodLiteral,ZodEnum,ZodNativeEnum,ZodPromise,ZodEffects,ZodTransformer:ZodEffects,ZodOptional,ZodNullable,ZodDefault,ZodCatch,ZodNaN,BRAND:P,ZodBranded,ZodPipeline,ZodReadonly,custom,Schema:ZodType,ZodSchema:ZodType,late:I,get ZodFirstPartyTypeKind(){return j},coerce:pe,any:D,array:B,bigint:E,boolean:A,date:L,discriminatedUnion:G,effect:oe,enum:re,function:te,instanceof:(e,t={message:`Input not instance of ${e.name}`})=>custom((t=>t instanceof e),t),intersection:H,lazy:ae,literal:se,map:Q,nan:O,nativeEnum:ne,never:V,null:F,nullable:ce,number:R,object:K,oboolean:()=>A().optional(),onumber:()=>R().optional(),optional:de,ostring:()=>N().optional(),pipeline:le,preprocess:ue,promise:ie,record:X,set:ee,strictObject:W,string:N,symbol:M,transformer:oe,tuple:Y,undefined:$,union:J,unknown:U,void:q,NEVER:he,ZodIssueCode:i,quotelessJson:e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:"),ZodError})}};
|
package/dist/368.codebuddy.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";exports.id=368,exports.ids=[368],exports.modules={87368:(e,r,t)=>{t.r(r),t.d(r,{StreamableHTTPClientTransport:()=>StreamableHTTPClientTransport,StreamableHTTPError:()=>StreamableHTTPError});var o=t(13298);let n;async function random(e){const r="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-._~";let t="";const o=await async function getRandomValues(e){return(await n).getRandomValues(new Uint8Array(e))}(e);for(let n=0;n<e;n++){t+=r[o[n]%66]}return t}async function generateChallenge(e){const r=await(await n).subtle.digest("SHA-256",(new TextEncoder).encode(e));return btoa(String.fromCharCode(...new Uint8Array(r))).replace(/\//g,"_").replace(/\+/g,"-").replace(/=/g,"")}async function pkceChallenge(e){if(e||(e=43),e<43||e>128)throw`Expected a length between 43 and 128. Received ${e}.`;const r=await async function generateVerifier(e){return await random(e)}(e);return{code_verifier:r,code_challenge:await generateChallenge(r)}}n=globalThis.crypto?.webcrypto??globalThis.crypto??Promise.resolve().then(t.t.bind(t,77598,19)).then((e=>e.webcrypto));var i=t(46195);const a=i.z.object({resource:i.z.string().url(),authorization_servers:i.z.array(i.z.string().url()).optional(),jwks_uri:i.z.string().url().optional(),scopes_supported:i.z.array(i.z.string()).optional(),bearer_methods_supported:i.z.array(i.z.string()).optional(),resource_signing_alg_values_supported:i.z.array(i.z.string()).optional(),resource_name:i.z.string().optional(),resource_documentation:i.z.string().optional(),resource_policy_uri:i.z.string().url().optional(),resource_tos_uri:i.z.string().url().optional(),tls_client_certificate_bound_access_tokens:i.z.boolean().optional(),authorization_details_types_supported:i.z.array(i.z.string()).optional(),dpop_signing_alg_values_supported:i.z.array(i.z.string()).optional(),dpop_bound_access_tokens_required:i.z.boolean().optional()}).passthrough(),s=i.z.object({issuer:i.z.string(),authorization_endpoint:i.z.string(),token_endpoint:i.z.string(),registration_endpoint:i.z.string().optional(),scopes_supported:i.z.array(i.z.string()).optional(),response_types_supported:i.z.array(i.z.string()),response_modes_supported:i.z.array(i.z.string()).optional(),grant_types_supported:i.z.array(i.z.string()).optional(),token_endpoint_auth_methods_supported:i.z.array(i.z.string()).optional(),token_endpoint_auth_signing_alg_values_supported:i.z.array(i.z.string()).optional(),service_documentation:i.z.string().optional(),revocation_endpoint:i.z.string().optional(),revocation_endpoint_auth_methods_supported:i.z.array(i.z.string()).optional(),revocation_endpoint_auth_signing_alg_values_supported:i.z.array(i.z.string()).optional(),introspection_endpoint:i.z.string().optional(),introspection_endpoint_auth_methods_supported:i.z.array(i.z.string()).optional(),introspection_endpoint_auth_signing_alg_values_supported:i.z.array(i.z.string()).optional(),code_challenge_methods_supported:i.z.array(i.z.string()).optional()}).passthrough(),c=i.z.object({access_token:i.z.string(),id_token:i.z.string().optional(),token_type:i.z.string(),expires_in:i.z.number().optional(),scope:i.z.string().optional(),refresh_token:i.z.string().optional()}).strip(),l=i.z.object({error:i.z.string(),error_description:i.z.string().optional(),error_uri:i.z.string().optional()}),d=i.z.object({redirect_uris:i.z.array(i.z.string()).refine((e=>e.every((e=>URL.canParse(e)))),{message:"redirect_uris must contain valid URLs"}),token_endpoint_auth_method:i.z.string().optional(),grant_types:i.z.array(i.z.string()).optional(),response_types:i.z.array(i.z.string()).optional(),client_name:i.z.string().optional(),client_uri:i.z.string().optional(),logo_uri:i.z.string().optional(),scope:i.z.string().optional(),contacts:i.z.array(i.z.string()).optional(),tos_uri:i.z.string().optional(),policy_uri:i.z.string().optional(),jwks_uri:i.z.string().optional(),jwks:i.z.any().optional(),software_id:i.z.string().optional(),software_version:i.z.string().optional(),software_statement:i.z.string().optional()}).strip(),u=i.z.object({client_id:i.z.string(),client_secret:i.z.string().optional(),client_id_issued_at:i.z.number().optional(),client_secret_expires_at:i.z.number().optional()}).strip(),h=d.merge(u);i.z.object({error:i.z.string(),error_description:i.z.string().optional()}).strip(),i.z.object({token:i.z.string(),token_type_hint:i.z.string().optional()}).strip();class OAuthError extends Error{constructor(e,r){super(e),this.errorUri=r,this.name=this.constructor.name}toResponseObject(){const e={error:this.errorCode,error_description:this.message};return this.errorUri&&(e.error_uri=this.errorUri),e}get errorCode(){return this.constructor.errorCode}}class InvalidRequestError extends OAuthError{}InvalidRequestError.errorCode="invalid_request";class InvalidClientError extends OAuthError{}InvalidClientError.errorCode="invalid_client";class InvalidGrantError extends OAuthError{}InvalidGrantError.errorCode="invalid_grant";class UnauthorizedClientError extends OAuthError{}UnauthorizedClientError.errorCode="unauthorized_client";class UnsupportedGrantTypeError extends OAuthError{}UnsupportedGrantTypeError.errorCode="unsupported_grant_type";class InvalidScopeError extends OAuthError{}InvalidScopeError.errorCode="invalid_scope";class AccessDeniedError extends OAuthError{}AccessDeniedError.errorCode="access_denied";class ServerError extends OAuthError{}ServerError.errorCode="server_error";class TemporarilyUnavailableError extends OAuthError{}TemporarilyUnavailableError.errorCode="temporarily_unavailable";class UnsupportedResponseTypeError extends OAuthError{}UnsupportedResponseTypeError.errorCode="unsupported_response_type";class UnsupportedTokenTypeError extends OAuthError{}UnsupportedTokenTypeError.errorCode="unsupported_token_type";class InvalidTokenError extends OAuthError{}InvalidTokenError.errorCode="invalid_token";class MethodNotAllowedError extends OAuthError{}MethodNotAllowedError.errorCode="method_not_allowed";class TooManyRequestsError extends OAuthError{}TooManyRequestsError.errorCode="too_many_requests";class InvalidClientMetadataError extends OAuthError{}InvalidClientMetadataError.errorCode="invalid_client_metadata";class InsufficientScopeError extends OAuthError{}InsufficientScopeError.errorCode="insufficient_scope";const p={[InvalidRequestError.errorCode]:InvalidRequestError,[InvalidClientError.errorCode]:InvalidClientError,[InvalidGrantError.errorCode]:InvalidGrantError,[UnauthorizedClientError.errorCode]:UnauthorizedClientError,[UnsupportedGrantTypeError.errorCode]:UnsupportedGrantTypeError,[InvalidScopeError.errorCode]:InvalidScopeError,[AccessDeniedError.errorCode]:AccessDeniedError,[ServerError.errorCode]:ServerError,[TemporarilyUnavailableError.errorCode]:TemporarilyUnavailableError,[UnsupportedResponseTypeError.errorCode]:UnsupportedResponseTypeError,[UnsupportedTokenTypeError.errorCode]:UnsupportedTokenTypeError,[InvalidTokenError.errorCode]:InvalidTokenError,[MethodNotAllowedError.errorCode]:MethodNotAllowedError,[TooManyRequestsError.errorCode]:TooManyRequestsError,[InvalidClientMetadataError.errorCode]:InvalidClientMetadataError,[InsufficientScopeError.errorCode]:InsufficientScopeError};class UnauthorizedError extends Error{constructor(e){super(null!=e?e:"Unauthorized")}}function selectClientAuthMethod(e,r){const t=void 0!==e.client_secret;return 0===r.length?t?"client_secret_post":"none":t&&r.includes("client_secret_basic")?"client_secret_basic":t&&r.includes("client_secret_post")?"client_secret_post":r.includes("none")?"none":t?"client_secret_post":"none"}function applyClientAuthentication(e,r,t,o){const{client_id:n,client_secret:i}=r;switch(e){case"client_secret_basic":return void function applyBasicAuth(e,r,t){if(!r)throw new Error("client_secret_basic authentication requires a client_secret");const o=btoa(`${e}:${r}`);t.set("Authorization",`Basic ${o}`)}(n,i,t);case"client_secret_post":return void function applyPostAuth(e,r,t){t.set("client_id",e),r&&t.set("client_secret",r)}(n,i,o);case"none":return void function applyPublicAuth(e,r){r.set("client_id",e)}(n,o);default:throw new Error(`Unsupported client authentication method: ${e}`)}}async function parseErrorResponse(e){const r=e instanceof Response?e.status:void 0,t=e instanceof Response?await e.text():e;try{const e=l.parse(JSON.parse(t)),{error:r,error_description:o,error_uri:n}=e;return new(p[r]||ServerError)(o||"",n)}catch(e){return new ServerError(`${r?`HTTP ${r}: `:""}Invalid OAuth error response: ${e}. Raw body: ${t}`)}}async function auth(e,r){var t,o;try{return await authInternal(e,r)}catch(n){if(n instanceof InvalidClientError||n instanceof UnauthorizedClientError)return await(null===(t=e.invalidateCredentials)||void 0===t?void 0:t.call(e,"all")),await authInternal(e,r);if(n instanceof InvalidGrantError)return await(null===(o=e.invalidateCredentials)||void 0===o?void 0:o.call(e,"tokens")),await authInternal(e,r);throw n}}async function authInternal(e,{serverUrl:r,authorizationCode:t,scope:n,resourceMetadataUrl:i,fetchFn:l}){let d,u=r;try{d=await async function discoverOAuthProtectedResourceMetadata(e,r,t=fetch){const o=await discoverMetadataWithFallback(e,"oauth-protected-resource",t,{protocolVersion:null==r?void 0:r.protocolVersion,metadataUrl:null==r?void 0:r.resourceMetadataUrl});if(!o||404===o.status)throw new Error("Resource server does not implement OAuth 2.0 Protected Resource Metadata.");if(!o.ok)throw new Error(`HTTP ${o.status} trying to load well-known OAuth protected resource metadata.`);return a.parse(await o.json())}(r,{resourceMetadataUrl:i},l),d.authorization_servers&&d.authorization_servers.length>0&&(u=d.authorization_servers[0])}catch(e){}const p=await async function selectResourceURL(e,r,t){const o=function resourceUrlFromServerUrl(e){const r="string"==typeof e?new URL(e):new URL(e.href);return r.hash="",r}(e);if(r.validateResourceURL)return await r.validateResourceURL(o,null==t?void 0:t.resource);if(!t)return;if(!function checkResourceAllowed({requestedResource:e,configuredResource:r}){const t="string"==typeof e?new URL(e):new URL(e.href),o="string"==typeof r?new URL(r):new URL(r.href);if(t.origin!==o.origin)return!1;if(t.pathname.length<o.pathname.length)return!1;const n=t.pathname.endsWith("/")?t.pathname:t.pathname+"/",i=o.pathname.endsWith("/")?o.pathname:o.pathname+"/";return n.startsWith(i)}({requestedResource:o,configuredResource:t.resource}))throw new Error(`Protected resource ${t.resource} does not match expected ${o} (or origin)`);return new URL(t.resource)}(r,e,d),_=await async function discoverOAuthMetadata(e,{authorizationServerUrl:r,protocolVersion:t}={},n=fetch){"string"==typeof e&&(e=new URL(e));r||(r=e);"string"==typeof r&&(r=new URL(r));null!=t||(t=o.LATEST_PROTOCOL_VERSION);const i=await discoverMetadataWithFallback(r,"oauth-authorization-server",n,{protocolVersion:t,metadataServerUrl:r});if(!i||404===i.status)return;if(!i.ok)throw new Error(`HTTP ${i.status} trying to load well-known OAuth metadata`);return s.parse(await i.json())}(r,{authorizationServerUrl:u},l);let f=await Promise.resolve(e.clientInformation());if(!f){if(void 0!==t)throw new Error("Existing OAuth client information is required when exchanging an authorization code");if(!e.saveClientInformation)throw new Error("OAuth client information must be saveable for dynamic registration");const r=await async function registerClient(e,{metadata:r,clientMetadata:t,fetchFn:o}){let n;if(r){if(!r.registration_endpoint)throw new Error("Incompatible auth server: does not support dynamic client registration");n=new URL(r.registration_endpoint)}else n=new URL("/register",e);const i=await(null!=o?o:fetch)(n,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});if(!i.ok)throw await parseErrorResponse(i);return h.parse(await i.json())}(u,{metadata:_,clientMetadata:e.clientMetadata});await e.saveClientInformation(r),f=r}if(void 0!==t){const r=await e.codeVerifier(),o=await async function exchangeAuthorization(e,{metadata:r,clientInformation:t,authorizationCode:o,codeVerifier:n,redirectUri:i,resource:a,addClientAuthentication:s,fetchFn:l}){var d;const u="authorization_code",h=(null==r?void 0:r.token_endpoint)?new URL(r.token_endpoint):new URL("/token",e);if((null==r?void 0:r.grant_types_supported)&&!r.grant_types_supported.includes(u))throw new Error(`Incompatible auth server: does not support grant type ${u}`);const p=new Headers({"Content-Type":"application/x-www-form-urlencoded"}),_=new URLSearchParams({grant_type:u,code:o,code_verifier:n,redirect_uri:String(i)});if(s)s(p,_,e,r);else{applyClientAuthentication(selectClientAuthMethod(t,null!==(d=null==r?void 0:r.token_endpoint_auth_methods_supported)&&void 0!==d?d:[]),t,p,_)}a&&_.set("resource",a.href);const f=await(null!=l?l:fetch)(h,{method:"POST",headers:p,body:_});if(!f.ok)throw await parseErrorResponse(f);return c.parse(await f.json())}(u,{metadata:_,clientInformation:f,authorizationCode:t,codeVerifier:r,redirectUri:e.redirectUrl,resource:p,addClientAuthentication:e.addClientAuthentication,fetchFn:l});return await e.saveTokens(o),"AUTHORIZED"}const v=await e.tokens();if(null==v?void 0:v.refresh_token)try{const r=await async function refreshAuthorization(e,{metadata:r,clientInformation:t,refreshToken:o,resource:n,addClientAuthentication:i,fetchFn:a}){var s;const l="refresh_token";let d;if(r){if(d=new URL(r.token_endpoint),r.grant_types_supported&&!r.grant_types_supported.includes(l))throw new Error(`Incompatible auth server: does not support grant type ${l}`)}else d=new URL("/token",e);const u=new Headers({"Content-Type":"application/x-www-form-urlencoded"}),h=new URLSearchParams({grant_type:l,refresh_token:o});if(i)i(u,h,e,r);else{applyClientAuthentication(selectClientAuthMethod(t,null!==(s=null==r?void 0:r.token_endpoint_auth_methods_supported)&&void 0!==s?s:[]),t,u,h)}n&&h.set("resource",n.href);const p=await(null!=a?a:fetch)(d,{method:"POST",headers:u,body:h});if(!p.ok)throw await parseErrorResponse(p);return c.parse({refresh_token:o,...await p.json()})}(u,{metadata:_,clientInformation:f,refreshToken:v.refresh_token,resource:p,addClientAuthentication:e.addClientAuthentication});return await e.saveTokens(r),"AUTHORIZED"}catch(e){if(e instanceof OAuthError&&!(e instanceof ServerError))throw e}const w=e.state?await e.state():void 0,{authorizationUrl:m,codeVerifier:y}=await async function startAuthorization(e,{metadata:r,clientInformation:t,redirectUrl:o,scope:n,state:i,resource:a}){const s="code",c="S256";let l;if(r){if(l=new URL(r.authorization_endpoint),!r.response_types_supported.includes(s))throw new Error(`Incompatible auth server: does not support response type ${s}`);if(!r.code_challenge_methods_supported||!r.code_challenge_methods_supported.includes(c))throw new Error(`Incompatible auth server: does not support code challenge method ${c}`)}else l=new URL("/authorize",e);const d=await pkceChallenge(),u=d.code_verifier,h=d.code_challenge;l.searchParams.set("response_type",s),l.searchParams.set("client_id",t.client_id),l.searchParams.set("code_challenge",h),l.searchParams.set("code_challenge_method",c),l.searchParams.set("redirect_uri",String(o)),i&&l.searchParams.set("state",i);n&&l.searchParams.set("scope",n);(null==n?void 0:n.includes("offline_access"))&&l.searchParams.append("prompt","consent");a&&l.searchParams.set("resource",a.href);return{authorizationUrl:l,codeVerifier:u}}(u,{metadata:_,clientInformation:f,state:w,redirectUrl:e.redirectUrl,scope:n||e.clientMetadata.scope,resource:p});return await e.saveCodeVerifier(y),await e.redirectToAuthorization(m),"REDIRECT"}async function fetchWithCorsRetry(e,r,t=fetch){try{return await t(e,{headers:r})}catch(o){if(o instanceof TypeError)return r?fetchWithCorsRetry(e,void 0,t):void 0;throw o}}async function tryMetadataDiscovery(e,r,t=fetch){const o={"MCP-Protocol-Version":r};return await fetchWithCorsRetry(e,o,t)}async function discoverMetadataWithFallback(e,r,t,n){var i,a;const s=new URL(e),c=null!==(i=null==n?void 0:n.protocolVersion)&&void 0!==i?i:o.LATEST_PROTOCOL_VERSION;let l;if(null==n?void 0:n.metadataUrl)l=new URL(n.metadataUrl);else{const e=function buildWellKnownPath(e,r){let t=`/.well-known/${e}${r}`;return r.endsWith("/")&&(t=t.slice(0,-1)),t}(r,s.pathname);l=new URL(e,null!==(a=null==n?void 0:n.metadataServerUrl)&&void 0!==a?a:s),l.search=s.search}let d=await tryMetadataDiscovery(l,c,t);if(!(null==n?void 0:n.metadataUrl)&&function shouldAttemptFallback(e,r){return!e||404===e.status&&"/"!==r}(d,s.pathname)){const e=new URL(`/.well-known/${r}`,s);d=await tryMetadataDiscovery(e,c,t)}return d}class ParseError extends Error{constructor(e,r){super(e),this.name="ParseError",this.type=r.type,this.field=r.field,this.value=r.value,this.line=r.line}}function noop(e){}function createParser(e){if("function"==typeof e)throw new TypeError("`callbacks` must be an object, got a function instead. Did you mean `{onEvent: fn}`?");const{onEvent:r=noop,onError:t=noop,onRetry:o=noop,onComment:n}=e;let i,a="",s=!0,c="",l="";function parseLine(e){if(""===e)return void function dispatchEvent(){c.length>0&&r({id:i,event:l||void 0,data:c.endsWith("\n")?c.slice(0,-1):c}),i=void 0,c="",l=""}();if(e.startsWith(":"))return void(n&&n(e.slice(e.startsWith(": ")?2:1)));const t=e.indexOf(":");if(-1===t)processField(e,"",e);else{const r=e.slice(0,t),o=" "===e[t+1]?2:1;processField(r,e.slice(t+o),e)}}function processField(e,r,n){switch(e){case"event":l=r;break;case"data":c=`${c}${r}\n`;break;case"id":i=r.includes("\0")?void 0:r;break;case"retry":/^\d+$/.test(r)?o(parseInt(r,10)):t(new ParseError(`Invalid \`retry\` value: "${r}"`,{type:"invalid-retry",value:r,line:n}));break;default:t(new ParseError(`Unknown field "${e.length>20?`${e.slice(0,20)}…`:e}"`,{type:"unknown-field",field:e,value:r,line:n}))}}return{feed:function feed(e){const r=s?e.replace(/^\xEF\xBB\xBF/,""):e,[t,o]=function splitLines(e){const r=[];let t="",o=0;for(;o<e.length;){const n=e.indexOf("\r",o),i=e.indexOf("\n",o);let a=-1;if(-1!==n&&-1!==i?a=Math.min(n,i):-1!==n?a=n:-1!==i&&(a=i),-1===a){t=e.slice(o);break}{const t=e.slice(o,a);r.push(t),o=a+1,"\r"===e[o-1]&&"\n"===e[o]&&o++}}return[r,t]}(`${a}${r}`);for(const e of t)parseLine(e);a=o,s=!1},reset:function reset(e={}){a&&e.consume&&parseLine(a),s=!0,i=void 0,c="",l="",a=""}}}class EventSourceParserStream extends TransformStream{constructor({onError:e,onRetry:r,onComment:t}={}){let o;super({start(n){o=createParser({onEvent:e=>{n.enqueue(e)},onError(r){"terminate"===e?n.error(r):"function"==typeof e&&e(r)},onRetry:r,onComment:t})},transform(e){o.feed(e)}})}}const _={initialReconnectionDelay:1e3,maxReconnectionDelay:3e4,reconnectionDelayGrowFactor:1.5,maxRetries:2};class StreamableHTTPError extends Error{constructor(e,r){super(`Streamable HTTP error: ${r}`),this.code=e}}class StreamableHTTPClientTransport{constructor(e,r){var t;this._url=e,this._resourceMetadataUrl=void 0,this._requestInit=null==r?void 0:r.requestInit,this._authProvider=null==r?void 0:r.authProvider,this._fetch=null==r?void 0:r.fetch,this._sessionId=null==r?void 0:r.sessionId,this._reconnectionOptions=null!==(t=null==r?void 0:r.reconnectionOptions)&&void 0!==t?t:_}async _authThenStart(){var e;if(!this._authProvider)throw new UnauthorizedError("No auth provider");let r;try{r=await auth(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,fetchFn:this._fetch})}catch(r){throw null===(e=this.onerror)||void 0===e||e.call(this,r),r}if("AUTHORIZED"!==r)throw new UnauthorizedError;return await this._startOrAuthSse({resumptionToken:void 0})}async _commonHeaders(){var e;const r={};if(this._authProvider){const e=await this._authProvider.tokens();e&&(r.Authorization=`Bearer ${e.access_token}`)}this._sessionId&&(r["mcp-session-id"]=this._sessionId),this._protocolVersion&&(r["mcp-protocol-version"]=this._protocolVersion);const t=this._normalizeHeaders(null===(e=this._requestInit)||void 0===e?void 0:e.headers);return new Headers({...r,...t})}async _startOrAuthSse(e){var r,t,o;const{resumptionToken:n}=e;try{const o=await this._commonHeaders();o.set("Accept","text/event-stream"),n&&o.set("last-event-id",n);const i=await(null!==(r=this._fetch)&&void 0!==r?r:fetch)(this._url,{method:"GET",headers:o,signal:null===(t=this._abortController)||void 0===t?void 0:t.signal});if(!i.ok){if(401===i.status&&this._authProvider)return await this._authThenStart();if(405===i.status)return;throw new StreamableHTTPError(i.status,`Failed to open SSE stream: ${i.statusText}`)}this._handleSseStream(i.body,e,!0)}catch(e){throw null===(o=this.onerror)||void 0===o||o.call(this,e),e}}_getNextReconnectionDelay(e){const r=this._reconnectionOptions.initialReconnectionDelay,t=this._reconnectionOptions.reconnectionDelayGrowFactor,o=this._reconnectionOptions.maxReconnectionDelay;return Math.min(r*Math.pow(t,e),o)}_normalizeHeaders(e){return e?e instanceof Headers?Object.fromEntries(e.entries()):Array.isArray(e)?Object.fromEntries(e):{...e}:{}}_scheduleReconnection(e,r=0){var t;const o=this._reconnectionOptions.maxRetries;if(o>0&&r>=o)return void(null===(t=this.onerror)||void 0===t||t.call(this,new Error(`Maximum reconnection attempts (${o}) exceeded.`)));const n=this._getNextReconnectionDelay(r);setTimeout((()=>{this._startOrAuthSse(e).catch((t=>{var o;null===(o=this.onerror)||void 0===o||o.call(this,new Error(`Failed to reconnect SSE stream: ${t instanceof Error?t.message:String(t)}`)),this._scheduleReconnection(e,r+1)}))}),n)}_handleSseStream(e,r,t){if(!e)return;const{onresumptiontoken:n,replayMessageId:i}=r;let a;(async()=>{var r,s,c,l;try{const t=e.pipeThrough(new TextDecoderStream).pipeThrough(new EventSourceParserStream).getReader();for(;;){const{value:e,done:c}=await t.read();if(c)break;if(e.id&&(a=e.id,null==n||n(e.id)),!e.event||"message"===e.event)try{const t=o.JSONRPCMessageSchema.parse(JSON.parse(e.data));void 0!==i&&(0,o.isJSONRPCResponse)(t)&&(t.id=i),null===(r=this.onmessage)||void 0===r||r.call(this,t)}catch(e){null===(s=this.onerror)||void 0===s||s.call(this,e)}}}catch(e){if(null===(c=this.onerror)||void 0===c||c.call(this,new Error(`SSE stream disconnected: ${e}`)),t&&this._abortController&&!this._abortController.signal.aborted)try{this._scheduleReconnection({resumptionToken:a,onresumptiontoken:n,replayMessageId:i},0)}catch(e){null===(l=this.onerror)||void 0===l||l.call(this,new Error(`Failed to reconnect: ${e instanceof Error?e.message:String(e)}`))}}})()}async start(){if(this._abortController)throw new Error("StreamableHTTPClientTransport already started! If using Client class, note that connect() calls start() automatically.");this._abortController=new AbortController}async finishAuth(e){if(!this._authProvider)throw new UnauthorizedError("No auth provider");if("AUTHORIZED"!==await auth(this._authProvider,{serverUrl:this._url,authorizationCode:e,resourceMetadataUrl:this._resourceMetadataUrl,fetchFn:this._fetch}))throw new UnauthorizedError("Failed to authorize")}async close(){var e,r;null===(e=this._abortController)||void 0===e||e.abort(),null===(r=this.onclose)||void 0===r||r.call(this)}async send(e,r){var t,n,i,a;try{const{resumptionToken:a,onresumptiontoken:s}=r||{};if(a)return void this._startOrAuthSse({resumptionToken:a,replayMessageId:(0,o.isJSONRPCRequest)(e)?e.id:void 0}).catch((e=>{var r;return null===(r=this.onerror)||void 0===r?void 0:r.call(this,e)}));const c=await this._commonHeaders();c.set("content-type","application/json"),c.set("accept","application/json, text/event-stream");const l={...this._requestInit,method:"POST",headers:c,body:JSON.stringify(e),signal:null===(t=this._abortController)||void 0===t?void 0:t.signal},d=await(null!==(n=this._fetch)&&void 0!==n?n:fetch)(this._url,l),u=d.headers.get("mcp-session-id");if(u&&(this._sessionId=u),!d.ok){if(401===d.status&&this._authProvider){this._resourceMetadataUrl=function extractResourceMetadataUrl(e){const r=e.headers.get("WWW-Authenticate");if(!r)return;const[t,o]=r.split(" ");if("bearer"!==t.toLowerCase()||!o)return;const n=/resource_metadata="([^"]*)"/.exec(r);if(n)try{return new URL(n[1])}catch(e){return}}(d);if("AUTHORIZED"!==await auth(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,fetchFn:this._fetch}))throw new UnauthorizedError;return this.send(e)}const r=await d.text().catch((()=>null));throw new Error(`Error POSTing to endpoint (HTTP ${d.status}): ${r}`)}if(202===d.status)return void((0,o.isInitializedNotification)(e)&&this._startOrAuthSse({resumptionToken:void 0}).catch((e=>{var r;return null===(r=this.onerror)||void 0===r?void 0:r.call(this,e)})));const h=(Array.isArray(e)?e:[e]).filter((e=>"method"in e&&"id"in e&&void 0!==e.id)).length>0,p=d.headers.get("content-type");if(h)if(null==p?void 0:p.includes("text/event-stream"))this._handleSseStream(d.body,{onresumptiontoken:s},!1);else{if(!(null==p?void 0:p.includes("application/json")))throw new StreamableHTTPError(-1,`Unexpected content type: ${p}`);{const e=await d.json(),r=Array.isArray(e)?e.map((e=>o.JSONRPCMessageSchema.parse(e))):[o.JSONRPCMessageSchema.parse(e)];for(const e of r)null===(i=this.onmessage)||void 0===i||i.call(this,e)}}}catch(e){throw null===(a=this.onerror)||void 0===a||a.call(this,e),e}}get sessionId(){return this._sessionId}async terminateSession(){var e,r,t;if(this._sessionId)try{const t=await this._commonHeaders(),o={...this._requestInit,method:"DELETE",headers:t,signal:null===(e=this._abortController)||void 0===e?void 0:e.signal},n=await(null!==(r=this._fetch)&&void 0!==r?r:fetch)(this._url,o);if(!n.ok&&405!==n.status)throw new StreamableHTTPError(n.status,`Failed to terminate session: ${n.statusText}`);this._sessionId=void 0}catch(e){throw null===(t=this.onerror)||void 0===t||t.call(this,e),e}}setProtocolVersion(e){this._protocolVersion=e}get protocolVersion(){return this._protocolVersion}}}};
|
package/dist/393.codebuddy.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
exports.id=393,exports.ids=[393],exports.modules={8147:(t,r,e)=>{"use strict";const s=e(16928),n=e(54080),o=e(50078),i=e(34489),c="win32"===process.platform,a=/\.(?:com|exe)$/i,l=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function parseNonShell(t){if(!c)return t;const r=function detectShebang(t){t.file=n(t);const r=t.file&&i(t.file);return r?(t.args.unshift(t.file),t.command=r,n(t)):t.file}(t),e=!a.test(r);if(t.options.forceShell||e){const e=l.test(r);t.command=s.normalize(t.command),t.command=o.command(t.command),t.args=t.args.map((t=>o.argument(t,e)));const n=[t.command].concat(t.args).join(" ");t.args=["/d","/s","/c",`"${n}"`],t.command=process.env.comspec||"cmd.exe",t.options.windowsVerbatimArguments=!0}return t}t.exports=function parse(t,r,e){r&&!Array.isArray(r)&&(e=r,r=null);const s={command:t,args:r=r?r.slice(0):[],options:e=Object.assign({},e),file:void 0,original:{command:t,args:r}};return e.shell?s:parseNonShell(s)}},14155:(t,r,e)=>{t.exports=isexe,isexe.sync=function sync(t,r){return checkStat(s.statSync(t),r)};var s=e(79896);function isexe(t,r,e){s.stat(t,(function(t,s){e(t,!t&&checkStat(s,r))}))}function checkStat(t,r){return t.isFile()&&function checkMode(t,r){var e=t.mode,s=t.uid,n=t.gid,o=void 0!==r.uid?r.uid:process.getuid&&process.getuid(),i=void 0!==r.gid?r.gid:process.getgid&&process.getgid(),c=parseInt("100",8),a=parseInt("010",8),l=parseInt("001",8),u=c|a;return e&l||e&a&&n===i||e&c&&s===o||e&u&&0===o}(t,r)}},24326:(t,r,e)=>{const s="win32"===process.platform||"cygwin"===process.env.OSTYPE||"msys"===process.env.OSTYPE,n=e(16928),o=s?";":":",i=e(79882),getNotFoundError=t=>Object.assign(new Error(`not found: ${t}`),{code:"ENOENT"}),getPathInfo=(t,r)=>{const e=r.colon||o,n=t.match(/\//)||s&&t.match(/\\/)?[""]:[...s?[process.cwd()]:[],...(r.path||process.env.PATH||"").split(e)],i=s?r.pathExt||process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",c=s?i.split(e):[""];return s&&-1!==t.indexOf(".")&&""!==c[0]&&c.unshift(""),{pathEnv:n,pathExt:c,pathExtExe:i}},which=(t,r,e)=>{"function"==typeof r&&(e=r,r={}),r||(r={});const{pathEnv:s,pathExt:o,pathExtExe:c}=getPathInfo(t,r),a=[],step=e=>new Promise(((o,i)=>{if(e===s.length)return r.all&&a.length?o(a):i(getNotFoundError(t));const c=s[e],l=/^".*"$/.test(c)?c.slice(1,-1):c,u=n.join(l,t),p=!l&&/^\.[\\\/]/.test(t)?t.slice(0,2)+u:u;o(subStep(p,e,0))})),subStep=(t,e,s)=>new Promise(((n,l)=>{if(s===o.length)return n(step(e+1));const u=o[s];i(t+u,{pathExt:c},((o,i)=>{if(!o&&i){if(!r.all)return n(t+u);a.push(t+u)}return n(subStep(t,e,s+1))}))}));return e?step(0).then((t=>e(null,t)),e):step(0)};t.exports=which,which.sync=(t,r)=>{r=r||{};const{pathEnv:e,pathExt:s,pathExtExe:o}=getPathInfo(t,r),c=[];for(let a=0;a<e.length;a++){const l=e[a],u=/^".*"$/.test(l)?l.slice(1,-1):l,p=n.join(u,t),d=!u&&/^\.[\\\/]/.test(t)?t.slice(0,2)+p:p;for(let t=0;t<s.length;t++){const e=d+s[t];try{if(i.sync(e,{pathExt:o})){if(!r.all)return e;c.push(e)}}catch(t){}}}if(r.all&&c.length)return c;if(r.nothrow)return null;throw getNotFoundError(t)}},30393:(t,r,e)=>{"use strict";e.r(r),e.d(r,{DEFAULT_INHERITED_ENV_VARS:()=>c,StdioClientTransport:()=>StdioClientTransport,getDefaultEnvironment:()=>getDefaultEnvironment});var s=e(91092),n=e(1708),o=e(57075),i=e(13298);class ReadBuffer{append(t){this._buffer=this._buffer?Buffer.concat([this._buffer,t]):t}readMessage(){if(!this._buffer)return null;const t=this._buffer.indexOf("\n");if(-1===t)return null;const r=this._buffer.toString("utf8",0,t).replace(/\r$/,"");return this._buffer=this._buffer.subarray(t+1),function deserializeMessage(t){return i.JSONRPCMessageSchema.parse(JSON.parse(t))}(r)}clear(){this._buffer=void 0}}const c="win32"===n.platform?["APPDATA","HOMEDRIVE","HOMEPATH","LOCALAPPDATA","PATH","PROCESSOR_ARCHITECTURE","SYSTEMDRIVE","SYSTEMROOT","TEMP","USERNAME","USERPROFILE","PROGRAMFILES"]:["HOME","LOGNAME","PATH","SHELL","TERM","USER"];function getDefaultEnvironment(){const t={};for(const r of c){const e=n.env[r];void 0!==e&&(e.startsWith("()")||(t[r]=e))}return t}class StdioClientTransport{constructor(t){this._abortController=new AbortController,this._readBuffer=new ReadBuffer,this._stderrStream=null,this._serverParams=t,"pipe"!==t.stderr&&"overlapped"!==t.stderr||(this._stderrStream=new o.PassThrough)}async start(){if(this._process)throw new Error("StdioClientTransport already started! If using Client class, note that connect() calls start() automatically.");return new Promise(((t,r)=>{var e,o,i,c,a;this._process=s(this._serverParams.command,null!==(e=this._serverParams.args)&&void 0!==e?e:[],{env:{...getDefaultEnvironment(),...this._serverParams.env},stdio:["pipe","pipe",null!==(o=this._serverParams.stderr)&&void 0!==o?o:"inherit"],shell:!1,signal:this._abortController.signal,windowsHide:"win32"===n.platform&&"type"in n,cwd:this._serverParams.cwd}),this._process.on("error",(t=>{var e,s;"AbortError"!==t.name?(r(t),null===(s=this.onerror)||void 0===s||s.call(this,t)):null===(e=this.onclose)||void 0===e||e.call(this)})),this._process.on("spawn",(()=>{t()})),this._process.on("close",(t=>{var r;this._process=void 0,null===(r=this.onclose)||void 0===r||r.call(this)})),null===(i=this._process.stdin)||void 0===i||i.on("error",(t=>{var r;null===(r=this.onerror)||void 0===r||r.call(this,t)})),null===(c=this._process.stdout)||void 0===c||c.on("data",(t=>{this._readBuffer.append(t),this.processReadBuffer()})),null===(a=this._process.stdout)||void 0===a||a.on("error",(t=>{var r;null===(r=this.onerror)||void 0===r||r.call(this,t)})),this._stderrStream&&this._process.stderr&&this._process.stderr.pipe(this._stderrStream)}))}get stderr(){var t,r;return this._stderrStream?this._stderrStream:null!==(r=null===(t=this._process)||void 0===t?void 0:t.stderr)&&void 0!==r?r:null}get pid(){var t,r;return null!==(r=null===(t=this._process)||void 0===t?void 0:t.pid)&&void 0!==r?r:null}processReadBuffer(){for(var t,r;;)try{const r=this._readBuffer.readMessage();if(null===r)break;null===(t=this.onmessage)||void 0===t||t.call(this,r)}catch(t){null===(r=this.onerror)||void 0===r||r.call(this,t)}}async close(){this._abortController.abort(),this._process=void 0,this._readBuffer.clear()}send(t){return new Promise((r=>{var e;if(!(null===(e=this._process)||void 0===e?void 0:e.stdin))throw new Error("Not connected");const s=function serializeMessage(t){return JSON.stringify(t)+"\n"}(t);this._process.stdin.write(s)?r():this._process.stdin.once("drain",r)}))}}},34489:(t,r,e)=>{"use strict";const s=e(79896),n=e(50230);t.exports=function readShebang(t){const r=Buffer.alloc(150);let e;try{e=s.openSync(t,"r"),s.readSync(e,r,0,150,0),s.closeSync(e)}catch(t){}return n(r.toString())}},50078:t=>{"use strict";const r=/([()\][%!^"`<>&|;, *?])/g;t.exports.command=function escapeCommand(t){return t=t.replace(r,"^$1")},t.exports.argument=function escapeArgument(t,e){return t=(t=`"${t=(t=(t=`${t}`).replace(/(?=(\\+?)?)\1"/g,'$1$1\\"')).replace(/(?=(\\+?)?)\1$/,"$1$1")}"`).replace(r,"^$1"),e&&(t=t.replace(r,"^$1")),t}},50230:(t,r,e)=>{"use strict";const s=e(85672);t.exports=(t="")=>{const r=t.match(s);if(!r)return null;const[e,n]=r[0].replace(/#! ?/,"").split(" "),o=e.split("/").pop();return"env"===o?n:n?`${o} ${n}`:o}},54080:(t,r,e)=>{"use strict";const s=e(16928),n=e(24326),o=e(58139);function resolveCommandAttempt(t,r){const e=t.options.env||process.env,i=process.cwd(),c=null!=t.options.cwd,a=c&&void 0!==process.chdir&&!process.chdir.disabled;if(a)try{process.chdir(t.options.cwd)}catch(t){}let l;try{l=n.sync(t.command,{path:e[o({env:e})],pathExt:r?s.delimiter:void 0})}catch(t){}finally{a&&process.chdir(i)}return l&&(l=s.resolve(c?t.options.cwd:"",l)),l}t.exports=function resolveCommand(t){return resolveCommandAttempt(t)||resolveCommandAttempt(t,!0)}},58139:t=>{"use strict";const pathKey=(t={})=>{const r=t.env||process.env;return"win32"!==(t.platform||process.platform)?"PATH":Object.keys(r).reverse().find((t=>"PATH"===t.toUpperCase()))||"Path"};t.exports=pathKey,t.exports.default=pathKey},66095:(t,r,e)=>{t.exports=isexe,isexe.sync=function sync(t,r){return checkStat(s.statSync(t),t,r)};var s=e(79896);function checkStat(t,r,e){return!(!t.isSymbolicLink()&&!t.isFile())&&function checkPathExt(t,r){var e=void 0!==r.pathExt?r.pathExt:process.env.PATHEXT;if(!e)return!0;if(-1!==(e=e.split(";")).indexOf(""))return!0;for(var s=0;s<e.length;s++){var n=e[s].toLowerCase();if(n&&t.substr(-n.length).toLowerCase()===n)return!0}return!1}(r,e)}function isexe(t,r,e){s.stat(t,(function(s,n){e(s,!s&&checkStat(n,t,r))}))}},79882:(t,r,e)=>{var s;e(79896);function isexe(t,r,e){if("function"==typeof r&&(e=r,r={}),!e){if("function"!=typeof Promise)throw new TypeError("callback not provided");return new Promise((function(e,s){isexe(t,r||{},(function(t,r){t?s(t):e(r)}))}))}s(t,r||{},(function(t,s){t&&("EACCES"===t.code||r&&r.ignoreErrors)&&(t=null,s=!1),e(t,s)}))}s="win32"===process.platform||global.TESTING_WINDOWS?e(66095):e(14155),t.exports=isexe,isexe.sync=function sync(t,r){try{return s.sync(t,r||{})}catch(t){if(r&&r.ignoreErrors||"EACCES"===t.code)return!1;throw t}}},85672:t=>{"use strict";t.exports=/^#!(.*)/},90995:t=>{"use strict";const r="win32"===process.platform;function notFoundError(t,r){return Object.assign(new Error(`${r} ${t.command} ENOENT`),{code:"ENOENT",errno:"ENOENT",syscall:`${r} ${t.command}`,path:t.command,spawnargs:t.args})}function verifyENOENT(t,e){return r&&1===t&&!e.file?notFoundError(e.original,"spawn"):null}t.exports={hookChildProcess:function hookChildProcess(t,e){if(!r)return;const s=t.emit;t.emit=function(r,n){if("exit"===r){const r=verifyENOENT(n,e);if(r)return s.call(t,"error",r)}return s.apply(t,arguments)}},verifyENOENT,verifyENOENTSync:function verifyENOENTSync(t,e){return r&&1===t&&!e.file?notFoundError(e.original,"spawnSync"):null},notFoundError}},91092:(t,r,e)=>{"use strict";const s=e(35317),n=e(8147),o=e(90995);function spawn(t,r,e){const i=n(t,r,e),c=s.spawn(i.command,i.args,i.options);return o.hookChildProcess(c,i),c}t.exports=spawn,t.exports.spawn=spawn,t.exports.sync=function spawnSync(t,r,e){const i=n(t,r,e),c=s.spawnSync(i.command,i.args,i.options);return c.error=c.error||o.verifyENOENTSync(c.status,i),c},t.exports._parse=n,t.exports._enoent=o}};
|