broods 0.53.0 → 0.53.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunk-14wmsrrt.js +21 -0
- package/dist/{chunk-ghba1t00.js → chunk-5ks36kqn.js} +2 -2
- package/dist/{chunk-ybkav7qd.js → chunk-b0pdqkyk.js} +4 -4
- package/dist/{chunk-r94w8493.js → chunk-bbvew31z.js} +1 -1
- package/dist/cli/index.js +40 -40
- package/dist/index.js +1 -1
- package/package.json +6 -6
- package/dist/chunk-9ft10pkr.js +0 -14
- /package/dist/{chunk-hkbecyy0.js → chunk-qsx1j9kf.js} +0 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import{N,_}from"./chunk-1fn0c0fe.js";import{ce,G,W,le,ne,J,e,re,oe,ue,Y,X,o,i,P,de,c,n,t,u,a,w,R,s,d,r,l,j,I}from"./chunk-8zcgnjs8.js";var{create:Gl,defineProperty:co,getOwnPropertyDescriptor:Wl,getOwnPropertyNames:Yl,getPrototypeOf:Zl}=Object,Xl=Object.prototype.hasOwnProperty,ye=(m,h)=>()=>(h||m((h={exports:{}}).exports,h),h.exports),Gi=(m,h)=>{let p={};for(var f in m)co(p,f,{get:m[f],enumerable:!0});if(h)co(p,Symbol.toStringTag,{value:"Module"});return p},Ql=(m,h,p,f)=>{if(h&&typeof h==="object"||typeof h==="function"){for(var g=Yl(h),S=0,y=g.length,z;S<y;S++)if(z=g[S],!Xl.call(m,z)&&z!==p)co(m,z,{get:((v)=>h[v]).bind(null,z),enumerable:!(f=Wl(h,z))||f.enumerable})}return m},lo=(m,h,p)=>(p=m!=null?Gl(Zl(m)):{},Ql(h||!m||!m.__esModule?co(p,"default",{value:m,enumerable:!0}):p,m));var eu=new Set(["https://json-schema.org/draft/2020-12/schema","http://json-schema.org/draft/2020-12/schema"]),Wi=new Set(["https://json-schema.org/draft/2019-09/schema","http://json-schema.org/draft/2019-09/schema"]),tu=new Set(["https://json-schema.org/draft-07/schema","http://json-schema.org/draft-07/schema"]),ru=new Set(["https://json-schema.org/draft-06/schema","http://json-schema.org/draft-06/schema"]);function Yi(m){return typeof m==="string"&&Wi.has(m.replace(/#$/,""))}function Zi(m,h){if(!("$schema"in m)||typeof m.$schema!=="string")return"2020-12";let p=m.$schema.replace(/#$/,"");if(eu.has(p))return"2020-12";if(Wi.has(p))return"2019-09";if(tu.has(p)||ru.has(p))return"draft-7";throw Error(`JSON Schema declares an unsupported dialect ("$schema": "${m.$schema.slice(0,200)}"). The default validator supports JSON Schema 2020-12, 2019-09, draft-07, and draft-06; ${h}`)}var Qi={invalid_type:"invalid_type",too_big:"too_big",too_small:"too_small",invalid_format:"invalid_format",not_multiple_of:"not_multiple_of",unrecognized_keys:"unrecognized_keys",invalid_union:"invalid_union",invalid_key:"invalid_key",invalid_element:"invalid_element",invalid_value:"invalid_value",custom:"custom"};var Xi;(function(m){})(Xi||(Xi={}));function uo(m){return G(re,m)}function ou(m){return W(oe,m)}function au(m){return le(X,m)}var Zt="2025-11-25";var mo=[Zt,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],ho="io.modelcontextprotocol/related-task",vt="io.modelcontextprotocol/protocolVersion",Sr="io.modelcontextprotocol/clientInfo",pt="io.modelcontextprotocol/serverInfo",_t="io.modelcontextprotocol/clientCapabilities",Xt="io.modelcontextprotocol/subscriptionId",It="io.modelcontextprotocol/logLevel";var Qt="2.0";var Ct=j(()=>a([e(),o(),i(),P(),s(e(),Ct),n(Ct)])),Be=s(e(),Ct),Pn=n(Ct),us=a([e(),o().int()]),ds=e(),po=t({ttl:o().optional()}),fo=t({taskId:e()}),ms=u({progressToken:us.optional(),[ho]:fo.optional()}),Ye=t({_meta:ms.optional()}),er=Ye.extend({task:po.optional()}),Je=t({method:e(),params:Ye.loose().optional()}),et=t({_meta:ms.optional()}),tt=t({method:e(),params:et.loose().optional()}),hs=u({get[pt](){return _r.optional().catch(void 0)}}),Ke=u({_meta:hs.optional()}),qt=a([e(),o().int()]),ps=t({jsonrpc:r(Qt),id:qt,...Je.shape}).strict(),fs=t({jsonrpc:r(Qt),...tt.shape}).strict(),yr=t({jsonrpc:r(Qt),id:qt,result:Ke}).strict(),vr=t({jsonrpc:r(Qt),id:qt.optional(),error:t({code:o().int(),message:e(),data:c().optional()})}).strict(),gs=a([ps,fs,yr,vr]),Cn=a([yr,vr]),Ss=Ke.strict(),go=et.extend({requestId:qt.optional(),reason:e().optional()}),ys=tt.extend({method:r("notifications/cancelled"),params:go}),So=t({src:e(),mimeType:e().optional(),sizes:n(e()).optional(),theme:d(["light","dark"]).optional()}),Ot=t({icons:n(So).optional()}),yt=t({name:e(),title:e().optional()}),_r=yt.extend({...yt.shape,...Ot.shape,version:e(),websiteUrl:e().optional(),description:e().optional()}),iu=R(t({applyDefaults:i().optional()}),Be),cu=I((m)=>{if(m&&typeof m==="object"&&!Array.isArray(m)&&Object.keys(m).length===0)return{form:{}};return m},R(t({form:iu.optional(),url:Be.optional()}),Be.optional())),yo=u({list:Be.optional(),cancel:Be.optional(),requests:u({sampling:u({createMessage:Be.optional()}).optional(),elicitation:u({create:Be.optional()}).optional()}).optional()}),vo=u({list:Be.optional(),cancel:Be.optional(),requests:u({tools:u({call:Be.optional()}).optional()}).optional()}),_o=t({experimental:s(e(),Be).optional(),sampling:t({context:Be.optional(),tools:Be.optional()}).optional(),elicitation:cu.optional(),roots:t({listChanged:i().optional()}).optional(),tasks:yo.optional(),extensions:s(e(),Be).optional()}),bo=Ye.extend({protocolVersion:e(),capabilities:_o,clientInfo:_r}),Ro=Je.extend({method:r("initialize"),params:bo}),vs=t({experimental:s(e(),Be).optional(),logging:Be.optional(),completions:Be.optional(),prompts:t({listChanged:i().optional()}).optional(),resources:t({subscribe:i().optional(),listChanged:i().optional()}).optional(),tools:t({listChanged:i().optional()}).optional(),tasks:vo.optional(),extensions:s(e(),Be).optional()}),zo=Ke.extend({protocolVersion:e(),capabilities:vs,serverInfo:_r,instructions:e().optional()}),wo=tt.extend({method:r("notifications/initialized"),params:et.optional()}),$o=Je.extend({method:r("server/discover"),params:Ye.optional()}),Eo=Ke.extend({supportedVersions:n(e()),capabilities:vs,instructions:e().optional()}),_s=Je.extend({method:r("ping"),params:Ye.optional()}),To=t({progress:o(),total:l(o()),message:l(e())}),Po=t({...et.shape,...To.shape,progressToken:us}),bs=tt.extend({method:r("notifications/progress"),params:Po}),Co=Ye.extend({cursor:ds.optional()}),jt=Je.extend({params:Co.optional()}),Nt=Ke.extend({nextCursor:ds.optional()}),Rs=t({uri:e(),mimeType:l(e()),_meta:s(e(),c()).optional()}),zs=Rs.extend({text:e()}),In=e().refine((m)=>{try{return atob(m),!0}catch{return!1}},{message:"Invalid Base64 string"}),ws=Rs.extend({blob:In}),kt=d(["user","assistant"]),bt=t({audience:n(kt).optional(),priority:o().min(0).max(1).optional(),lastModified:uo({offset:!0}).optional()}),$s=t({...yt.shape,...Ot.shape,uri:e(),description:l(e()),mimeType:l(e()),size:l(o()),annotations:bt.optional(),_meta:l(u({}))}),Io=t({...yt.shape,...Ot.shape,uriTemplate:e(),description:l(e()),mimeType:l(e()),annotations:bt.optional(),_meta:l(u({}))}),qo=jt.extend({method:r("resources/list")}),Oo=Nt.extend({resources:n($s)}),jo=jt.extend({method:r("resources/templates/list")}),No=Nt.extend({resourceTemplates:n(Io)}),br=Ye.extend({uri:e()}),ko=br,Mo=Je.extend({method:r("resources/read"),params:ko}),Ao=Ke.extend({contents:n(a([zs,ws]))}),Lo=tt.extend({method:r("notifications/resources/list_changed"),params:et.optional()}),Do=br,Uo=Je.extend({method:r("resources/subscribe"),params:Do}),Vo=br,Ho=Je.extend({method:r("resources/unsubscribe"),params:Vo}),Es=t({toolsListChanged:i().optional(),promptsListChanged:i().optional(),resourcesListChanged:i().optional(),resourceSubscriptions:n(e()).optional()}),xo=Ye.extend({notifications:Es}),Fo=Je.extend({method:r("subscriptions/listen"),params:xo}),Bo=et.extend({notifications:Es}),Jo=tt.extend({method:r("notifications/subscriptions/acknowledged"),params:Bo}),Ko=hs.extend({[Xt]:qt}),Go=Ke.extend({_meta:Ko}),Wo=et.extend({uri:e()}),Yo=tt.extend({method:r("notifications/resources/updated"),params:Wo}),Zo=t({name:e(),description:l(e()),required:l(i())}),Xo=t({...yt.shape,...Ot.shape,description:l(e()),arguments:l(n(Zo)),_meta:l(u({}))}),Qo=jt.extend({method:r("prompts/list")}),ea=Nt.extend({prompts:n(Xo)}),ta=Ye.extend({name:e(),arguments:s(e(),e()).optional()}),ra=Je.extend({method:r("prompts/get"),params:ta}),Rr=t({type:r("text"),text:e(),annotations:bt.optional(),_meta:s(e(),c()).optional()}),zr=t({type:r("image"),data:In,mimeType:e(),annotations:bt.optional(),_meta:s(e(),c()).optional()}),wr=t({type:r("audio"),data:In,mimeType:e(),annotations:bt.optional(),_meta:s(e(),c()).optional()}),sa=t({type:r("tool_use"),name:e(),id:e(),input:s(e(),c()),_meta:s(e(),c()).optional()}),oa=t({type:r("resource"),resource:a([zs,ws]),annotations:bt.optional(),_meta:s(e(),c()).optional()}),aa=$s.extend({type:r("resource_link")}),$r=a([Rr,zr,wr,aa,oa]),na=t({role:kt,content:$r}),ia=Ke.extend({description:e().optional(),messages:n(na)}),ca=tt.extend({method:r("notifications/prompts/list_changed"),params:et.optional()}),la=t({title:e().optional(),readOnlyHint:i().optional(),destructiveHint:i().optional(),idempotentHint:i().optional(),openWorldHint:i().optional()}),ua=t({taskSupport:d(["required","optional","forbidden"]).optional()}),Ts=t({...yt.shape,...Ot.shape,description:e().optional(),inputSchema:t({type:r("object"),properties:s(e(),Ct).optional(),required:n(e()).optional()}).catchall(c()),outputSchema:u({$schema:e().optional()}).optional(),annotations:la.optional(),execution:ua.optional(),_meta:s(e(),c()).optional()}),da=jt.extend({method:r("tools/list")}),ma=Nt.extend({tools:n(Ts)}),Ps=Ke.extend({content:n($r).default([]),structuredContent:c().optional(),isError:i().optional()}),qn=Ps.or(Ke.extend({toolResult:c()})),ha=er.extend({name:e(),arguments:s(e(),c()).optional()}),pa=Je.extend({method:r("tools/call"),params:ha}),fa=tt.extend({method:r("notifications/tools/list_changed"),params:et.optional()}),On=t({autoRefresh:i().default(!0),debounceMs:o().int().nonnegative().default(300)}),Mt=d(["debug","info","notice","warning","error","critical","alert","emergency"]),ga=Ye.extend({level:Mt}),Sa=Je.extend({method:r("logging/setLevel"),params:ga}),ya=et.extend({level:Mt,logger:e().optional(),data:c()}),va=tt.extend({method:r("notifications/message"),params:ya}),_a=t({name:e().optional()}),ba=t({hints:n(_a).optional(),costPriority:o().min(0).max(1).optional(),speedPriority:o().min(0).max(1).optional(),intelligencePriority:o().min(0).max(1).optional()}),Ra=t({mode:d(["auto","required","none"]).optional()}),za=t({type:r("tool_result"),toolUseId:e().describe("The unique identifier for the corresponding tool call."),content:n($r),structuredContent:c().optional(),isError:i().optional(),_meta:s(e(),c()).optional()}),wa=w("type",[Rr,zr,wr]),Yt=w("type",[Rr,zr,wr,sa,za]),$a=t({role:kt,content:a([Yt,n(Yt)]),_meta:s(e(),c()).optional()}),Ea=er.extend({messages:n($a),modelPreferences:ba.optional(),systemPrompt:e().optional(),includeContext:d(["none","thisServer","allServers"]).optional(),temperature:o().optional(),maxTokens:o().int(),stopSequences:n(e()).optional(),metadata:Be.optional(),tools:n(Ts).optional(),toolChoice:Ra.optional()}),Ta=Je.extend({method:r("sampling/createMessage"),params:Ea}),Pa=Ke.extend({model:e(),stopReason:l(d(["endTurn","stopSequence","maxTokens"]).or(e())),role:kt,content:wa}),Ca=Ke.extend({model:e(),stopReason:l(d(["endTurn","stopSequence","maxTokens","toolUse"]).or(e())),role:kt,content:a([Yt,n(Yt)])}),Cs=t({type:r("boolean"),title:e().optional(),description:e().optional(),default:i().optional()}),Er=t({type:r("string"),title:e().optional(),description:e().optional(),minLength:o().optional(),maxLength:o().optional(),format:d(["email","uri","date","date-time"]).optional(),default:e().optional()}),Tr=t({type:d(["number","integer"]),title:e().optional(),description:e().optional(),minimum:o().optional(),maximum:o().optional(),default:o().optional()}),Is=t({type:r("string"),title:e().optional(),description:e().optional(),enum:n(e()),default:e().optional()}),qs=t({type:r("string"),title:e().optional(),description:e().optional(),oneOf:n(t({const:e(),title:e()})),default:e().optional()}),Os=t({type:r("string"),title:e().optional(),description:e().optional(),enum:n(e()),enumNames:n(e()).optional(),default:e().optional()}),Ia=a([Is,qs]),js=t({type:r("array"),title:e().optional(),description:e().optional(),minItems:o().optional(),maxItems:o().optional(),items:t({type:r("string"),enum:n(e())}),default:n(e()).optional()}),Ns=t({type:r("array"),title:e().optional(),description:e().optional(),minItems:o().optional(),maxItems:o().optional(),items:t({anyOf:n(t({const:e(),title:e()}))}),default:n(e()).optional()}),qa=a([js,Ns]),Oa=a([Os,Ia,qa]),ks=a([Oa,Cs,Er,Tr]),Pr=er.extend({mode:r("form").optional(),message:e(),requestedSchema:t({type:r("object"),properties:s(e(),ks),required:n(e()).optional()}).catchall(c())}),ja=er.extend({mode:r("url"),message:e(),elicitationId:e(),url:e().url()}),Na=a([Pr,ja]),ka=Je.extend({method:r("elicitation/create"),params:Na}),Ma=et.extend({elicitationId:e()}),Aa=tt.extend({method:r("notifications/elicitation/complete"),params:Ma}),La=Ke.extend({action:d(["accept","decline","cancel"]),content:I((m)=>m===null?void 0:m,s(e(),a([e(),o(),i(),n(e())])).optional())}),Da=t({type:r("ref/resource"),uri:e()}),Ua=t({type:r("ref/prompt"),name:e()}),Va=Ye.extend({ref:a([Ua,Da]),argument:t({name:e(),value:e()}),context:t({arguments:s(e(),e()).optional()}).optional()}),Ha=Je.extend({method:r("completion/complete"),params:Va}),xa=Ke.extend({completion:u({values:n(e()).max(100),total:l(o().int()),hasMore:l(i())})}),Fa=t({uri:e().startsWith("file://"),name:e().optional(),_meta:s(e(),c()).optional()}),Ba=Je.extend({method:r("roots/list"),params:Ye.optional()}),Ja=Ke.extend({roots:n(Fa)}),Ka=tt.extend({method:r("notifications/roots/list_changed"),params:et.optional()}),jn=u({ttl:o().optional(),pollInterval:o().optional()}),Ga=d(["working","input_required","completed","failed","cancelled"]),At=t({taskId:e(),status:Ga,ttl:a([o(),P()]),createdAt:e(),lastUpdatedAt:e(),pollInterval:l(o()),statusMessage:l(e())}),Nn=Ke.extend({task:At}),Wa=et.merge(At),kn=tt.extend({method:r("notifications/tasks/status"),params:Wa}),Mn=Je.extend({method:r("tasks/get"),params:Ye.extend({taskId:e()})}),An=Ke.merge(At),Ln=Je.extend({method:r("tasks/result"),params:Ye.extend({taskId:e()})}),Dn=Ke.loose(),Un=jt.extend({method:r("tasks/list")}),Vn=Nt.extend({tasks:n(At)}),Hn=Je.extend({method:r("tasks/cancel"),params:Ye.extend({taskId:e()})}),xn=Ke.merge(At),Fn=a([_s,Ro,$o,Ha,Sa,ra,Qo,qo,jo,Mo,Uo,Ho,Fo,pa,da]),Bn=a([ys,bs,wo,Ka]),Jn=a([Ss,Pa,Ca,La,Ja]),Kn=a([_s,Ta,ka,Ba]),Gn=a([ys,bs,va,Yo,Lo,fa,ca,Jo,Aa]),Wn=a([Ss,zo,Eo,xa,ia,ea,Oo,No,Ao,Ps,ma,Go]);var Ze=Y().superRefine((m,h)=>{if(!URL.canParse(m))return h.addIssue({code:Qi.custom,message:"URL must be parseable",fatal:!0}),ce}).refine((m)=>{let h=new URL(m);return h.protocol!=="javascript:"&&h.protocol!=="data:"&&h.protocol!=="vbscript:"},{message:"URL cannot use javascript:, data:, or vbscript: scheme"}),Zn=u({resource:e().url(),authorization_servers:n(Ze).optional(),jwks_uri:e().url().optional(),scopes_supported:n(e()).optional(),bearer_methods_supported:n(e()).optional(),resource_signing_alg_values_supported:n(e()).optional(),resource_name:e().optional(),resource_documentation:e().optional(),resource_policy_uri:e().url().optional(),resource_tos_uri:e().url().optional(),tls_client_certificate_bound_access_tokens:i().optional(),authorization_details_types_supported:n(e()).optional(),dpop_signing_alg_values_supported:n(e()).optional(),dpop_bound_access_tokens_required:i().optional()}),Ya=u({issuer:e(),authorization_endpoint:Ze,token_endpoint:Ze,registration_endpoint:Ze.optional(),scopes_supported:n(e()).optional(),response_types_supported:n(e()),response_modes_supported:n(e()).optional(),grant_types_supported:n(e()).optional(),token_endpoint_auth_methods_supported:n(e()).optional(),token_endpoint_auth_signing_alg_values_supported:n(e()).optional(),service_documentation:Ze.optional(),revocation_endpoint:Ze.optional(),revocation_endpoint_auth_methods_supported:n(e()).optional(),revocation_endpoint_auth_signing_alg_values_supported:n(e()).optional(),introspection_endpoint:e().optional(),introspection_endpoint_auth_methods_supported:n(e()).optional(),introspection_endpoint_auth_signing_alg_values_supported:n(e()).optional(),code_challenge_methods_supported:n(e()).optional(),client_id_metadata_document_supported:i().optional(),authorization_response_iss_parameter_supported:i().optional().catch(void 0),dpop_signing_alg_values_supported:n(e()).optional()}),Za=u({issuer:e(),authorization_endpoint:Ze,token_endpoint:Ze,userinfo_endpoint:Ze.optional(),jwks_uri:Ze,registration_endpoint:Ze.optional(),scopes_supported:n(e()).optional(),response_types_supported:n(e()),response_modes_supported:n(e()).optional(),grant_types_supported:n(e()).optional(),acr_values_supported:n(e()).optional(),subject_types_supported:n(e()),id_token_signing_alg_values_supported:n(e()),id_token_encryption_alg_values_supported:n(e()).optional(),id_token_encryption_enc_values_supported:n(e()).optional(),userinfo_signing_alg_values_supported:n(e()).optional(),userinfo_encryption_alg_values_supported:n(e()).optional(),userinfo_encryption_enc_values_supported:n(e()).optional(),request_object_signing_alg_values_supported:n(e()).optional(),request_object_encryption_alg_values_supported:n(e()).optional(),request_object_encryption_enc_values_supported:n(e()).optional(),token_endpoint_auth_methods_supported:n(e()).optional(),token_endpoint_auth_signing_alg_values_supported:n(e()).optional(),display_values_supported:n(e()).optional(),claim_types_supported:n(e()).optional(),claims_supported:n(e()).optional(),service_documentation:e().optional(),claims_locales_supported:n(e()).optional(),ui_locales_supported:n(e()).optional(),claims_parameter_supported:i().optional(),request_parameter_supported:i().optional(),request_uri_parameter_supported:i().optional(),require_request_uri_registration:i().optional(),op_policy_uri:Ze.optional(),op_tos_uri:Ze.optional(),client_id_metadata_document_supported:i().optional(),authorization_response_iss_parameter_supported:i().optional().catch(void 0)}),Xn=t({...Za.shape,...Ya.pick({code_challenge_methods_supported:!0}).shape}),Qn=t({access_token:e(),id_token:e().optional(),token_type:e(),expires_in:au().optional(),scope:e().optional(),refresh_token:e().optional(),issuer:e().optional().catch(void 0)}).strip(),ei=t({issued_token_type:r("urn:ietf:params:oauth:token-type:id-jag"),access_token:e(),token_type:e().optional(),expires_in:o().optional(),scope:e().optional()}).strip(),ti=t({error:e(),error_description:e().optional(),error_uri:e().optional()}),Yn=Ze.optional().or(r("").transform(()=>{return})),Xa=t({redirect_uris:n(Ze),token_endpoint_auth_method:e().optional(),grant_types:n(e()).optional(),response_types:n(e()).optional(),application_type:e().optional(),client_name:e().optional(),client_uri:Ze.optional(),logo_uri:Yn,scope:e().optional(),contacts:n(e()).optional(),tos_uri:Yn,policy_uri:e().optional(),jwks_uri:Ze.optional(),jwks:de().optional(),software_id:e().optional(),software_version:e().optional(),software_statement:e().optional()}).strip(),Qa=t({client_id:e(),client_secret:e().optional(),client_id_issued_at:o().optional(),client_secret_expires_at:o().optional(),issuer:e().optional().catch(void 0)}).strip(),ri=Xa.merge(Qa),si=t({error:e(),error_description:e().optional()}).strip(),oi=t({token:e(),token_type_hint:e().optional()}).strip();var ci=Symbol.for("mcp.sdk.errorBrands");function mi(m,h){let p=new Set,f=h;while(typeof f==="function"){let g=f.mcpBrand;if(Object.prototype.hasOwnProperty.call(f,"mcpBrand")&&typeof g==="string")p.add(g);f=Object.getPrototypeOf(f)}if(p.size===0)return;Object.defineProperty(m,ci,{value:p,enumerable:!1,configurable:!0})}function Ir(m,h){try{if(typeof h==="object"&&h!==null&&Object.prototype.hasOwnProperty.call(m,"mcpBrand")&&typeof m.mcpBrand==="string"&&Object.prototype.hasOwnProperty.call(h,ci)){let p=h[ci];if(p&&typeof p.has==="function"&&p.has(m.mcpBrand))return!0}}catch{}return Function.prototype[Symbol.hasInstance].call(m,h)}var $c=class m extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.OAuthError"})}static[Symbol.hasInstance](h){return Ir(this,h)}static isInstance(h){if(typeof this!=="function")throw TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return Ir(this,h)}constructor(h,p,f){super(p);this.code=h,this.errorUri=f,this.name="OAuthError",mi(this,new.target)}toResponseObject(){let h={error:this.code,error_description:this.message};if(this.errorUri)h.error_uri=this.errorUri;return h}static fromResponse(h){return new m(h.error,h.error_description??h.error,h.error_uri)}},Oe=function(m){return m.NotConnected="NOT_CONNECTED",m.AlreadyConnected="ALREADY_CONNECTED",m.NotInitialized="NOT_INITIALIZED",m.CapabilityNotSupported="CAPABILITY_NOT_SUPPORTED",m.RequestTimeout="REQUEST_TIMEOUT",m.ConnectionClosed="CONNECTION_CLOSED",m.SendFailed="SEND_FAILED",m.InvalidResult="INVALID_RESULT",m.UnsupportedResultType="UNSUPPORTED_RESULT_TYPE",m.InputRequiredRoundsExceeded="INPUT_REQUIRED_ROUNDS_EXCEEDED",m.ListPaginationExceeded="LIST_PAGINATION_EXCEEDED",m.MethodNotSupportedByProtocolVersion="METHOD_NOT_SUPPORTED_BY_PROTOCOL_VERSION",m.EraNegotiationFailed="ERA_NEGOTIATION_FAILED",m.ClientHttpNotImplemented="CLIENT_HTTP_NOT_IMPLEMENTED",m.ClientHttpAuthentication="CLIENT_HTTP_AUTHENTICATION",m.ClientHttpForbidden="CLIENT_HTTP_FORBIDDEN",m.ClientHttpUnexpectedContent="CLIENT_HTTP_UNEXPECTED_CONTENT",m.ClientHttpFailedToOpenStream="CLIENT_HTTP_FAILED_TO_OPEN_STREAM",m.ClientHttpFailedToTerminateSession="CLIENT_HTTP_FAILED_TO_TERMINATE_SESSION",m}({}),Pe=class extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.SdkError"})}static[Symbol.hasInstance](m){return Ir(this,m)}static isInstance(m){if(typeof this!=="function")throw TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return Ir(this,m)}constructor(m,h,p,f){super(h,f);this.code=m,this.data=p,this.name="SdkError",mi(this,new.target)}},lu=class extends Pe{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.SdkHttpError"})}constructor(m,h,p,f){super(m,h,p,f);this.name="SdkHttpError"}get status(){return this.data.status}get statusText(){return this.data.statusText}};function dc(m){return m!==null&&typeof m==="object"&&!Array.isArray(m)}function uu(m,h,p){return m==="elicitation"&&h==="form"&&p.form===void 0&&p.url===void 0}function Ec(m){switch(m.method){case"elicitation/create":if(m.params?.mode==="url")return{elicitation:{url:{}}};return{elicitation:{form:{}}};case"sampling/createMessage":{let h=m.params;if(h!==void 0&&(h.tools!==void 0||h.toolChoice!==void 0))return{sampling:{tools:{}}};return{sampling:{}}}case"roots/list":return{roots:{}};default:return}}function cn(m,h){let p={};for(let[f,g]of Object.entries(m)){if(g===void 0)continue;let S=h===void 0?void 0:h[f];if(S===void 0){p[f]=g;continue}if(dc(g)&&dc(S)){let y={};for(let[z,v]of Object.entries(g))if(v!==void 0&&S[z]===void 0&&!uu(f,z,S))y[z]=v;if(Object.keys(y).length>0)p[f]=y}}return Object.keys(p).length>0?p:void 0}var Tc="2026-07-28",ft=[Tc];function Or(m){return m>=Tc}function Pc(m){return m.filter((h)=>!Or(h))}function ln(m){return m.filter((h)=>Or(h))}function Cc(m){let h=m.structuredContent;if(h===void 0)return m;if(!(typeof h!=="object"||h===null||Array.isArray(h)))return m;if(m.content?.some((p)=>p.type==="text")??!1)return m;return{...m,content:[...m.content??[],{type:"text",text:JSON.stringify(h)}]}}var Ic=["task","inputRequests","requestState"];function hi(m){if(m===null||typeof m!=="object"||Array.isArray(m)||m.content!==void 0||Ic.some((h)=>(h in m)))return m;return{...m,content:[]}}function du(){let m=j(()=>a([e(),o(),i(),P(),s(e(),m),n(m)])),h=s(e(),m),p=a([e(),o().int()]),f=e(),g=t({ttl:o().optional()}),S=t({taskId:e()}),y=u({progressToken:p.optional(),"io.modelcontextprotocol/related-task":S.optional()}),z=t({_meta:y.optional()}),v=z.extend({task:g.optional()}),T=t({method:e(),params:z.loose().optional()}),O=t({_meta:y.optional()}),C=t({method:e(),params:O.loose().optional()}),U=u({_meta:y.optional()}),F=a([e(),o().int()]),V=U.strict(),B=O.extend({requestId:F.optional(),reason:e().optional()}),x=C.extend({method:r("notifications/cancelled"),params:B}),q=t({src:e(),mimeType:e().optional(),sizes:n(e()).optional(),theme:d(["light","dark"]).optional()}),Z=t({icons:n(q).optional()}),L=t({name:e(),title:e().optional()}),K=L.extend({...L.shape,...Z.shape,version:e(),websiteUrl:e().optional(),description:e().optional()}),ae=R(t({applyDefaults:i().optional()}),h),H=I((Qe)=>{if(Qe&&typeof Qe==="object"&&!Array.isArray(Qe)&&Object.keys(Qe).length===0)return{form:{}};return Qe},R(t({form:ae.optional(),url:h.optional()}),h.optional())),k=u({list:h.optional(),cancel:h.optional(),requests:u({sampling:u({createMessage:h.optional()}).optional(),elicitation:u({create:h.optional()}).optional()}).optional()}),D=u({list:h.optional(),cancel:h.optional(),requests:u({tools:u({call:h.optional()}).optional()}).optional()}),se=t({experimental:s(e(),h).optional(),sampling:t({context:h.optional(),tools:h.optional()}).optional(),elicitation:H.optional(),roots:t({listChanged:i().optional()}).optional(),tasks:k.optional(),extensions:s(e(),h).optional()}),pe=z.extend({protocolVersion:e(),capabilities:se,clientInfo:K}),ie=T.extend({method:r("initialize"),params:pe}),fe=t({experimental:s(e(),h).optional(),logging:h.optional(),completions:h.optional(),prompts:t({listChanged:i().optional()}).optional(),resources:t({subscribe:i().optional(),listChanged:i().optional()}).optional(),tools:t({listChanged:i().optional()}).optional(),tasks:D.optional(),extensions:s(e(),h).optional()}),Re=U.extend({protocolVersion:e(),capabilities:fe,serverInfo:K,instructions:e().optional()}),ze=C.extend({method:r("notifications/initialized"),params:O.optional()}),Ce=T.extend({method:r("ping"),params:z.optional()}),Ae=t({progress:o(),total:l(o()),message:l(e())}),Me=t({...O.shape,...Ae.shape,progressToken:p}),Ue=C.extend({method:r("notifications/progress"),params:Me}),je=z.extend({cursor:f.optional()}),te=T.extend({params:je.optional()}),me=U.extend({nextCursor:f.optional()}),M=t({uri:e(),mimeType:l(e()),_meta:s(e(),c()).optional()}),b=M.extend({text:e()}),E=e().refine((Qe)=>{try{return atob(Qe),!0}catch{return!1}},{message:"Invalid Base64 string"}),A=M.extend({blob:E}),ee=d(["user","assistant"]),ge=t({audience:n(ee).optional(),priority:o().min(0).max(1).optional(),lastModified:uo({offset:!0}).optional()}),_e=t({...L.shape,...Z.shape,uri:e(),description:l(e()),mimeType:l(e()),size:l(o()),annotations:ge.optional(),_meta:l(u({}))}),ve=t({...L.shape,...Z.shape,uriTemplate:e(),description:l(e()),mimeType:l(e()),annotations:ge.optional(),_meta:l(u({}))}),Ie=te.extend({method:r("resources/list")}),Le=me.extend({resources:n(_e)}),Q=te.extend({method:r("resources/templates/list")}),he=me.extend({resourceTemplates:n(ve)}),Se=z.extend({uri:e()}),we=Se,$e=T.extend({method:r("resources/read"),params:we}),Te=U.extend({contents:n(a([b,A]))}),Ne=C.extend({method:r("notifications/resources/list_changed"),params:O.optional()}),xe=Se,De=T.extend({method:r("resources/subscribe"),params:xe}),Fe=Se,Ve=T.extend({method:r("resources/unsubscribe"),params:Fe}),it=O.extend({uri:e()}),We=C.extend({method:r("notifications/resources/updated"),params:it}),gt=t({name:e(),description:l(e()),required:l(i())}),lt=t({...L.shape,...Z.shape,description:l(e()),arguments:l(n(gt)),_meta:l(u({}))}),St=te.extend({method:r("prompts/list")}),wt=me.extend({prompts:n(lt)}),$t=z.extend({name:e(),arguments:s(e(),e()).optional()}),Ut=T.extend({method:r("prompts/get"),params:$t}),Vt=t({type:r("text"),text:e(),annotations:ge.optional(),_meta:s(e(),c()).optional()}),Ht=t({type:r("image"),data:E,mimeType:e(),annotations:ge.optional(),_meta:s(e(),c()).optional()}),xt=t({type:r("audio"),data:E,mimeType:e(),annotations:ge.optional(),_meta:s(e(),c()).optional()}),Mr=t({type:r("tool_use"),name:e(),id:e(),input:s(e(),c()),_meta:s(e(),c()).optional()}),Et=t({type:r("resource"),resource:a([b,A]),annotations:ge.optional(),_meta:s(e(),c()).optional()}),Ar=_e.extend({type:r("resource_link")}),ct=a([Vt,Ht,xt,Ar,Et]),nr=t({role:ee,content:ct}),ir=U.extend({description:e().optional(),messages:n(nr)}),Ft=C.extend({method:r("notifications/prompts/list_changed"),params:O.optional()}),Lr=t({title:e().optional(),readOnlyHint:i().optional(),destructiveHint:i().optional(),idempotentHint:i().optional(),openWorldHint:i().optional()}),cr=t({taskSupport:d(["required","optional","forbidden"]).optional()}),Bt=t({...L.shape,...Z.shape,description:e().optional(),inputSchema:t({type:r("object"),properties:s(e(),m).optional(),required:n(e()).optional()}).catchall(c()),outputSchema:t({type:r("object"),properties:s(e(),m).optional(),required:n(e()).optional()}).catchall(c()).optional(),annotations:Lr.optional(),execution:cr.optional(),_meta:s(e(),c()).optional()}),lr=te.extend({method:r("tools/list")}),ur=me.extend({tools:n(Bt)}),dr=U.extend({content:n(ct),structuredContent:s(e(),c()).optional(),isError:i().optional()}),Xe=v.extend({name:e(),arguments:s(e(),c()).optional()}),Dr=T.extend({method:r("tools/call"),params:Xe}),Js=C.extend({method:r("notifications/tools/list_changed"),params:O.optional()}),mr=d(["debug","info","notice","warning","error","critical","alert","emergency"]),Ur=z.extend({level:mr}),Vr=T.extend({method:r("logging/setLevel"),params:Ur}),Hr=O.extend({level:mr,logger:e().optional(),data:c()}),xr=C.extend({method:r("notifications/message"),params:Hr}),Fr=t({name:e().optional()}),Br=t({hints:n(Fr).optional(),costPriority:o().min(0).max(1).optional(),speedPriority:o().min(0).max(1).optional(),intelligencePriority:o().min(0).max(1).optional()}),Jr=t({mode:d(["auto","required","none"]).optional()}),Ks=t({type:r("tool_result"),toolUseId:e().describe("The unique identifier for the corresponding tool call."),content:n(ct),structuredContent:t({}).loose().optional(),isError:i().optional(),_meta:s(e(),c()).optional()}),Kr=w("type",[Vt,Ht,xt]),Tt=w("type",[Vt,Ht,xt,Mr,Ks]),Gr=t({role:ee,content:a([Tt,n(Tt)]),_meta:s(e(),c()).optional()}),Wr=v.extend({messages:n(Gr),modelPreferences:Br.optional(),systemPrompt:e().optional(),includeContext:d(["none","thisServer","allServers"]).optional(),temperature:o().optional(),maxTokens:o().int(),stopSequences:n(e()).optional(),metadata:h.optional(),tools:n(Bt).optional(),toolChoice:Jr.optional()}),Yr=T.extend({method:r("sampling/createMessage"),params:Wr}),Zr=U.extend({model:e(),stopReason:l(d(["endTurn","stopSequence","maxTokens"]).or(e())),role:ee,content:Kr}),Xr=U.extend({model:e(),stopReason:l(d(["endTurn","stopSequence","maxTokens","toolUse"]).or(e())),role:ee,content:a([Tt,n(Tt)])}),Qr=t({type:r("boolean"),title:e().optional(),description:e().optional(),default:i().optional()}),es=t({type:r("string"),title:e().optional(),description:e().optional(),minLength:o().optional(),maxLength:o().optional(),format:d(["email","uri","date","date-time"]).optional(),default:e().optional()}),ts=t({type:d(["number","integer"]),title:e().optional(),description:e().optional(),minimum:o().optional(),maximum:o().optional(),default:o().optional()}),rs=t({type:r("string"),title:e().optional(),description:e().optional(),enum:n(e()),default:e().optional()}),ss=t({type:r("string"),title:e().optional(),description:e().optional(),oneOf:n(t({const:e(),title:e()})),default:e().optional()}),os=t({type:r("string"),title:e().optional(),description:e().optional(),enum:n(e()),enumNames:n(e()).optional(),default:e().optional()}),as=a([rs,ss]),Jt=t({type:r("array"),title:e().optional(),description:e().optional(),minItems:o().optional(),maxItems:o().optional(),items:t({type:r("string"),enum:n(e())}),default:n(e()).optional()}),Kt=t({type:r("array"),title:e().optional(),description:e().optional(),minItems:o().optional(),maxItems:o().optional(),items:t({anyOf:n(t({const:e(),title:e()}))}),default:n(e()).optional()}),Gs=a([Jt,Kt]),Ws=a([os,as,Gs]),at=a([Ws,Qr,es,ts]),nt=v.extend({mode:r("form").optional(),message:e(),requestedSchema:t({type:r("object"),properties:s(e(),at),required:n(e()).optional()}).catchall(c())}),ns=v.extend({mode:r("url"),message:e(),elicitationId:e(),url:e().url()}),ut=a([nt,ns]),Ys=T.extend({method:r("elicitation/create"),params:ut}),Zs=O.extend({elicitationId:e()}),Xs=C.extend({method:r("notifications/elicitation/complete"),params:Zs}),Qs=U.extend({action:d(["accept","decline","cancel"]),content:I((Qe)=>Qe===null?void 0:Qe,s(e(),a([e(),o(),i(),n(e())])).optional())}),eo=t({type:r("ref/resource"),uri:e()}),to=t({type:r("ref/prompt"),name:e()}),ro=z.extend({ref:a([to,eo]),argument:t({name:e(),value:e()}),context:t({arguments:s(e(),e()).optional()}).optional()}),is=T.extend({method:r("completion/complete"),params:ro}),so=U.extend({completion:u({values:n(e()).max(100),total:l(o().int()),hasMore:l(i())})}),oo=t({uri:e().startsWith("file://"),name:e().optional(),_meta:s(e(),c()).optional()}),hr=T.extend({method:r("roots/list"),params:z.optional()}),cs=U.extend({roots:n(oo)}),ao=C.extend({method:r("notifications/roots/list_changed"),params:O.optional()}),no=u({ttl:o().optional(),pollInterval:o().optional()}),ls=d(["working","input_required","completed","failed","cancelled"]),Pt=t({taskId:e(),status:ls,ttl:a([o(),P()]),createdAt:e(),lastUpdatedAt:e(),pollInterval:l(o()),statusMessage:l(e())}),st=U.extend({task:Pt}),io=O.merge(Pt),Gt=C.extend({method:r("notifications/tasks/status"),params:io}),pr=T.extend({method:r("tasks/get"),params:z.extend({taskId:e()})}),fr=U.merge(Pt),gr=T.extend({method:r("tasks/result"),params:z.extend({taskId:e()})}),Tn=U.loose(),rt=te.extend({method:r("tasks/list")}),Ge=me.extend({tasks:n(Pt)}),Wt=T.extend({method:r("tasks/cancel"),params:z.extend({taskId:e()})});return{JSONValueSchema:m,JSONObjectSchema:h,ProgressTokenSchema:p,CursorSchema:f,TaskMetadataSchema:g,RelatedTaskMetadataSchema:S,RequestMetaSchema:y,BaseRequestParamsSchema:z,TaskAugmentedRequestParamsSchema:v,RequestSchema:T,NotificationsParamsSchema:O,NotificationSchema:C,ResultSchema:U,RequestIdSchema:F,EmptyResultSchema:V,CancelledNotificationParamsSchema:B,CancelledNotificationSchema:x,IconSchema:q,IconsSchema:Z,BaseMetadataSchema:L,ImplementationSchema:K,ClientTasksCapabilitySchema:k,ServerTasksCapabilitySchema:D,ClientCapabilitiesSchema:se,InitializeRequestParamsSchema:pe,InitializeRequestSchema:ie,ServerCapabilitiesSchema:fe,InitializeResultSchema:Re,InitializedNotificationSchema:ze,PingRequestSchema:Ce,ProgressSchema:Ae,ProgressNotificationParamsSchema:Me,ProgressNotificationSchema:Ue,PaginatedRequestParamsSchema:je,PaginatedRequestSchema:te,PaginatedResultSchema:me,ResourceContentsSchema:M,TextResourceContentsSchema:b,BlobResourceContentsSchema:A,RoleSchema:ee,AnnotationsSchema:ge,ResourceSchema:_e,ResourceTemplateSchema:ve,ListResourcesRequestSchema:Ie,ListResourcesResultSchema:Le,ListResourceTemplatesRequestSchema:Q,ListResourceTemplatesResultSchema:he,ResourceRequestParamsSchema:Se,ReadResourceRequestParamsSchema:we,ReadResourceRequestSchema:$e,ReadResourceResultSchema:Te,ResourceListChangedNotificationSchema:Ne,SubscribeRequestParamsSchema:xe,SubscribeRequestSchema:De,UnsubscribeRequestParamsSchema:Fe,UnsubscribeRequestSchema:Ve,ResourceUpdatedNotificationParamsSchema:it,ResourceUpdatedNotificationSchema:We,PromptArgumentSchema:gt,PromptSchema:lt,ListPromptsRequestSchema:St,ListPromptsResultSchema:wt,GetPromptRequestParamsSchema:$t,GetPromptRequestSchema:Ut,TextContentSchema:Vt,ImageContentSchema:Ht,AudioContentSchema:xt,ToolUseContentSchema:Mr,EmbeddedResourceSchema:Et,ResourceLinkSchema:Ar,ContentBlockSchema:ct,PromptMessageSchema:nr,GetPromptResultSchema:ir,PromptListChangedNotificationSchema:Ft,ToolAnnotationsSchema:Lr,ToolExecutionSchema:cr,ToolSchema:Bt,ListToolsRequestSchema:lr,ListToolsResultSchema:ur,CallToolResultSchema:dr,CallToolRequestParamsSchema:Xe,CallToolRequestSchema:Dr,ToolListChangedNotificationSchema:Js,LoggingLevelSchema:mr,SetLevelRequestParamsSchema:Ur,SetLevelRequestSchema:Vr,LoggingMessageNotificationParamsSchema:Hr,LoggingMessageNotificationSchema:xr,ModelHintSchema:Fr,ModelPreferencesSchema:Br,ToolChoiceSchema:Jr,ToolResultContentSchema:Ks,SamplingContentSchema:Kr,SamplingMessageContentBlockSchema:Tt,SamplingMessageSchema:Gr,CreateMessageRequestParamsSchema:Wr,CreateMessageRequestSchema:Yr,CreateMessageResultSchema:Zr,CreateMessageResultWithToolsSchema:Xr,BooleanSchemaSchema:Qr,StringSchemaSchema:es,NumberSchemaSchema:ts,UntitledSingleSelectEnumSchemaSchema:rs,TitledSingleSelectEnumSchemaSchema:ss,LegacyTitledEnumSchemaSchema:os,SingleSelectEnumSchemaSchema:as,UntitledMultiSelectEnumSchemaSchema:Jt,TitledMultiSelectEnumSchemaSchema:Kt,MultiSelectEnumSchemaSchema:Gs,EnumSchemaSchema:Ws,PrimitiveSchemaDefinitionSchema:at,ElicitRequestFormParamsSchema:nt,ElicitRequestURLParamsSchema:ns,ElicitRequestParamsSchema:ut,ElicitRequestSchema:Ys,ElicitationCompleteNotificationParamsSchema:Zs,ElicitationCompleteNotificationSchema:Xs,ElicitResultSchema:Qs,ResourceTemplateReferenceSchema:eo,PromptReferenceSchema:to,CompleteRequestParamsSchema:ro,CompleteRequestSchema:is,CompleteResultSchema:so,RootSchema:oo,ListRootsRequestSchema:hr,ListRootsResultSchema:cs,RootsListChangedNotificationSchema:ao,TaskCreationParamsSchema:no,TaskStatusSchema:ls,TaskSchema:Pt,CreateTaskResultSchema:st,TaskStatusNotificationParamsSchema:io,TaskStatusNotificationSchema:Gt,GetTaskRequestSchema:pr,GetTaskResultSchema:fr,GetTaskPayloadRequestSchema:gr,GetTaskPayloadResultSchema:Tn,ListTasksRequestSchema:rt,ListTasksResultSchema:Ge,CancelTaskRequestSchema:Wt,CancelTaskResultSchema:U.merge(Pt),ClientRequestSchema:a([Ce,ie,is,Vr,Ut,St,Ie,Q,$e,De,Ve,Dr,lr,pr,gr,rt,Wt]),ClientNotificationSchema:a([x,Ue,ze,ao,Gt]),ClientResultSchema:a([V,Zr,Xr,Qs,cs,fr,Ge,st]),ServerRequestSchema:a([Ce,Yr,Ys,hr,pr,gr,rt,Wt]),ServerNotificationSchema:a([x,Ue,xr,We,Ne,Js,Ft,Gt,Xs]),ServerResultSchema:a([V,Re,so,ir,wt,Le,he,Te,dr,ur,fr,Ge,st]),CallToolResultWireSchema:c().superRefine((Qe,Kl)=>{if(typeof Qe!=="object"||Qe===null||Array.isArray(Qe)||Qe.content!==void 0)return;for(let Ki of Ic)if(Ki in Qe){Kl.addIssue({code:"custom",message:`content is required when the body carries '${Ki}' — another result family cannot default into an empty tools/call success`});return}}).transform(hi).pipe(dr)}}var mu;function qc(){return mu??=du()}function Oc(m){return m.type!=="object"}var hu=new Set(["const","enum","default","examples"]),pu=new Set(["properties","patternProperties","$defs","definitions","dependentSchemas","dependencies"]);function mc(m){return m!==void 0&&!(typeof m==="string"&&m.startsWith("#"))}function fu(m){let h=typeof m.$schema==="string"?m.$schema:void 0;if(mc(m.$id))return{...h!==void 0&&{$schema:h},type:"object",properties:{result:m},required:["result"]};let p=Yi(m.$schema)&&m.$recursiveAnchor!==!0,f=(g,S)=>{if(Array.isArray(g))return g.map((v)=>f(v,!1));if(g===null||typeof g!=="object")return g;if(!S&&mc(g.$id))return g;let y={},z=!1;for(let[v,T]of Object.entries(g))if(S)y[v]=f(T,!1);else if((v==="$ref"||v==="$dynamicRef")&&typeof T==="string")y[v]=T==="#"?"#/properties/result":T.startsWith("#/")?`#/properties/result${T.slice(1)}`:T;else if(v==="$recursiveRef"&&T==="#"&&p)z=!0;else if(hu.has(v))y[v]=T;else if(pu.has(v))y[v]=f(T,!0);else y[v]=f(T,!1);if(z)if("$ref"in y)y.allOf=[...Array.isArray(y.allOf)?y.allOf:[],{$ref:"#/properties/result"}];else y.$ref="#/properties/result";return y};return{...h!==void 0&&{$schema:h},type:"object",properties:{result:f(m,!1)},required:["result"]}}var jc={ping:null,initialize:null,"completion/complete":null,"logging/setLevel":null,"prompts/get":null,"prompts/list":null,"resources/list":null,"resources/templates/list":null,"resources/read":null,"resources/subscribe":null,"resources/unsubscribe":null,"tools/call":null,"tools/list":null,"tasks/get":null,"tasks/result":null,"tasks/list":null,"tasks/cancel":null,"sampling/createMessage":null,"elicitation/create":null,"roots/list":null},Nc={"notifications/cancelled":null,"notifications/progress":null,"notifications/initialized":null,"notifications/roots/list_changed":null,"notifications/tasks/status":null,"notifications/message":null,"notifications/resources/updated":null,"notifications/resources/list_changed":null,"notifications/tools/list_changed":null,"notifications/prompts/list_changed":null,"notifications/elicitation/complete":null},gu={ping:null,initialize:null,"completion/complete":null,"logging/setLevel":null,"prompts/get":null,"prompts/list":null,"resources/list":null,"resources/templates/list":null,"resources/read":null,"resources/subscribe":null,"resources/unsubscribe":null,"tools/call":null,"tools/list":null,"sampling/createMessage":null,"elicitation/create":null,"roots/list":null},en;function pi(){if(en)return en;let m=qc();return en={requestSchemas:{ping:m.PingRequestSchema,initialize:m.InitializeRequestSchema,"completion/complete":m.CompleteRequestSchema,"logging/setLevel":m.SetLevelRequestSchema,"prompts/get":m.GetPromptRequestSchema,"prompts/list":m.ListPromptsRequestSchema,"resources/list":m.ListResourcesRequestSchema,"resources/templates/list":m.ListResourceTemplatesRequestSchema,"resources/read":m.ReadResourceRequestSchema,"resources/subscribe":m.SubscribeRequestSchema,"resources/unsubscribe":m.UnsubscribeRequestSchema,"tools/call":m.CallToolRequestSchema,"tools/list":m.ListToolsRequestSchema,"tasks/get":m.GetTaskRequestSchema,"tasks/result":m.GetTaskPayloadRequestSchema,"tasks/list":m.ListTasksRequestSchema,"tasks/cancel":m.CancelTaskRequestSchema,"sampling/createMessage":m.CreateMessageRequestSchema,"elicitation/create":m.ElicitRequestSchema,"roots/list":m.ListRootsRequestSchema},notificationSchemas:{"notifications/cancelled":m.CancelledNotificationSchema,"notifications/progress":m.ProgressNotificationSchema,"notifications/initialized":m.InitializedNotificationSchema,"notifications/roots/list_changed":m.RootsListChangedNotificationSchema,"notifications/tasks/status":m.TaskStatusNotificationSchema,"notifications/message":m.LoggingMessageNotificationSchema,"notifications/resources/updated":m.ResourceUpdatedNotificationSchema,"notifications/resources/list_changed":m.ResourceListChangedNotificationSchema,"notifications/tools/list_changed":m.ToolListChangedNotificationSchema,"notifications/prompts/list_changed":m.PromptListChangedNotificationSchema,"notifications/elicitation/complete":m.ElicitationCompleteNotificationSchema},resultSchemas:{ping:m.EmptyResultSchema,initialize:m.InitializeResultSchema,"completion/complete":m.CompleteResultSchema,"logging/setLevel":m.EmptyResultSchema,"prompts/get":m.GetPromptResultSchema,"prompts/list":m.ListPromptsResultSchema,"resources/list":m.ListResourcesResultSchema,"resources/templates/list":m.ListResourceTemplatesResultSchema,"resources/read":m.ReadResourceResultSchema,"resources/subscribe":m.EmptyResultSchema,"resources/unsubscribe":m.EmptyResultSchema,"tools/call":m.CallToolResultWireSchema,"tools/list":m.ListToolsResultSchema,"sampling/createMessage":m.CreateMessageResultWithToolsSchema,"elicitation/create":m.ElicitResultSchema,"roots/list":m.ListRootsResultSchema}},en}function kc(m){return Object.prototype.hasOwnProperty.call(jc,m)}function Mc(m){return Object.prototype.hasOwnProperty.call(Nc,m)}function Su(m){return Object.prototype.hasOwnProperty.call(gu,m)}function yu(m){return Su(m)?pi().resultSchemas[m]:void 0}function vu(m){return kc(m)?pi().requestSchemas[m]:void 0}function _u(m){return Mc(m)?pi().notificationSchemas[m]:void 0}var Xh=Object.keys(jc),Qh=Object.keys(Nc);function li(m){return m!==null&&typeof m==="object"&&!Array.isArray(m)}function tn(m,h){if(m===void 0)return{ok:!1,reason:"not-in-era"};let p=m.safeParse(h);return p.success?{ok:!0,value:p.data}:{ok:!1,reason:"invalid",message:String(p.error)}}var hc={ok:!1,reason:"not-in-era"};function pc(m){return li(m)&&li(m.outputSchema)&&Oc(m.outputSchema)}function fc(m){return m}var fi={era:"2025-11-25",hasRequestMethod:kc,hasNotificationMethod:Mc,validateRequest:(m,h)=>tn(vu(m),h),validateResult:(m,h)=>tn(yu(m),h),validateNotification:(m,h)=>tn(_u(m),h),hasInputRequestMethod:()=>!1,validateInputRequest:()=>hc,validateInputResponse:()=>hc,samplingResultVariant:(m,h)=>{let p=qc();return tn(m?p.CreateMessageResultWithToolsSchema:p.CreateMessageResultSchema,h)},outboundEnvelope:(m)=>{return},validateEnvelopeMeta:(m)=>[],projectCallToolResult(m,h){let p=Cc(m),f=p.structuredContent;if(f===void 0)return p;let g=typeof f!=="object"||f===null||Array.isArray(f),S=h!==void 0&&Oc(h);if(!g&&!S)return p;return{...p,structuredContent:{result:f}}},decodeResult(m,h){if(li(h)&&"resultType"in h){let p={...h};return delete p.resultType,{kind:"complete",result:fc(p)}}return{kind:"complete",result:fc(h)}},encodeResult(m,h){if(m!=="tools/list")return h;let p=h.tools;if(!Array.isArray(p)||!p.some((f)=>pc(f)))return h;return{...h,tools:p.map((f)=>pc(f)?{...f,outputSchema:fu(f.outputSchema)}:f)}},encodeErrorCode:(m)=>m===-32002?-32602:m,checkInboundEnvelope:(m)=>{return}};function bu(){let m=j(()=>a([e(),o(),i(),P(),s(e(),m),n(m)])),h=s(e(),m),p=a([e(),o().int()]),f=e(),g=a([e(),o().int()]),S=d(["user","assistant"]),y=d(["debug","info","notice","warning","error","critical","alert","emergency"]),z=e().refine((Ge)=>{try{return atob(Ge),!0}catch{return!1}},{message:"Invalid Base64 string"}),v=t({ttl:o().optional()}),T=t({taskId:e()}),O=u({progressToken:p.optional(),"io.modelcontextprotocol/related-task":T.optional()}),C=t({_meta:O.optional()}),U=C.extend({task:v.optional()}),F=t({_meta:O.optional()}),V=t({method:e(),params:F.loose().optional()}),B=t({src:e(),mimeType:e().optional(),sizes:n(e()).optional(),theme:d(["light","dark"]).optional()}),x=t({icons:n(B).optional()}),q=t({name:e(),title:e().optional()}),Z=q.extend({...q.shape,...x.shape,version:e(),websiteUrl:e().optional(),description:e().optional()}),L=R(t({applyDefaults:i().optional()}),h),K=I((Ge)=>{if(Ge&&typeof Ge==="object"&&!Array.isArray(Ge)&&Object.keys(Ge).length===0)return{form:{}};return Ge},R(t({form:L.optional(),url:h.optional()}),h.optional())),ae=u({list:h.optional(),cancel:h.optional(),requests:u({sampling:u({createMessage:h.optional()}).optional(),elicitation:u({create:h.optional()}).optional()}).optional()}),H=u({list:h.optional(),cancel:h.optional(),requests:u({tools:u({call:h.optional()}).optional()}).optional()}),k=t({experimental:s(e(),h).optional(),sampling:t({context:h.optional(),tools:h.optional()}).optional(),elicitation:K.optional(),roots:t({listChanged:i().optional()}).optional(),tasks:ae.optional(),extensions:s(e(),h).optional()}),D=t({experimental:s(e(),h).optional(),logging:h.optional(),completions:h.optional(),prompts:t({listChanged:i().optional()}).optional(),resources:t({subscribe:i().optional(),listChanged:i().optional()}).optional(),tools:t({listChanged:i().optional()}).optional(),tasks:H.optional(),extensions:s(e(),h).optional()}),se=t({progress:o(),total:l(o()),message:l(e())}),pe=t({...F.shape,...se.shape,progressToken:p}),ie=V.extend({method:r("notifications/progress"),params:pe}),fe=F.extend({level:y,logger:e().optional(),data:c()}),Re=V.extend({method:r("notifications/message"),params:fe}),ze=t({uri:e(),mimeType:l(e()),_meta:s(e(),c()).optional()}),Ce=ze.extend({text:e()}),Ae=ze.extend({blob:z}),Me=t({audience:n(S).optional(),priority:o().min(0).max(1).optional(),lastModified:uo({offset:!0}).optional()}),Ue=t({...q.shape,...x.shape,uri:e(),description:l(e()),mimeType:l(e()),size:l(o()),annotations:Me.optional(),_meta:l(u({}))}),je=t({...q.shape,...x.shape,uriTemplate:e(),description:l(e()),mimeType:l(e()),annotations:Me.optional(),_meta:l(u({}))}),te=V.extend({method:r("notifications/resources/list_changed"),params:F.optional()}),me=F.extend({uri:e()}),M=V.extend({method:r("notifications/resources/updated"),params:me}),b=t({name:e(),description:l(e()),required:l(i())}),E=t({...q.shape,...x.shape,description:l(e()),arguments:l(n(b)),_meta:l(u({}))}),A=V.extend({method:r("notifications/prompts/list_changed"),params:F.optional()}),ee=t({type:r("text"),text:e(),annotations:Me.optional(),_meta:s(e(),c()).optional()}),ge=t({type:r("image"),data:z,mimeType:e(),annotations:Me.optional(),_meta:s(e(),c()).optional()}),_e=t({type:r("audio"),data:z,mimeType:e(),annotations:Me.optional(),_meta:s(e(),c()).optional()}),ve=t({type:r("tool_use"),name:e(),id:e(),input:s(e(),c()),_meta:s(e(),c()).optional()}),Ie=t({type:r("resource"),resource:a([Ce,Ae]),annotations:Me.optional(),_meta:s(e(),c()).optional()}),Le=Ue.extend({type:r("resource_link")}),Q=a([ee,ge,_e,Le,Ie]),he=t({role:S,content:Q}),Se=t({title:e().optional(),readOnlyHint:i().optional(),destructiveHint:i().optional(),idempotentHint:i().optional(),openWorldHint:i().optional()}),we=V.extend({method:r("notifications/tools/list_changed"),params:F.optional()}),$e=t({name:e().optional()}),Te=t({hints:n($e).optional(),costPriority:o().min(0).max(1).optional(),speedPriority:o().min(0).max(1).optional(),intelligencePriority:o().min(0).max(1).optional()}),Ne=t({mode:d(["auto","required","none"]).optional()}),xe=t({type:r("boolean"),title:e().optional(),description:e().optional(),default:i().optional()}),De=t({type:r("string"),title:e().optional(),description:e().optional(),minLength:o().optional(),maxLength:o().optional(),format:d(["email","uri","date","date-time"]).optional(),default:e().optional()}),Fe=t({type:d(["number","integer"]),title:e().optional(),description:e().optional(),minimum:o().optional(),maximum:o().optional(),default:o().optional()}),Ve=t({type:r("string"),title:e().optional(),description:e().optional(),enum:n(e()),default:e().optional()}),it=t({type:r("string"),title:e().optional(),description:e().optional(),oneOf:n(t({const:e(),title:e()})),default:e().optional()}),We=t({type:r("string"),title:e().optional(),description:e().optional(),enum:n(e()),enumNames:n(e()).optional(),default:e().optional()}),gt=a([Ve,it]),lt=t({type:r("array"),title:e().optional(),description:e().optional(),minItems:o().optional(),maxItems:o().optional(),items:t({type:r("string"),enum:n(e())}),default:n(e()).optional()}),St=t({type:r("array"),title:e().optional(),description:e().optional(),minItems:o().optional(),maxItems:o().optional(),items:t({anyOf:n(t({const:e(),title:e()}))}),default:n(e()).optional()}),wt=a([lt,St]),$t=a([We,gt,wt]),Ut=a([$t,xe,De,Fe]),Vt=U.extend({mode:r("form").optional(),message:e(),requestedSchema:t({type:r("object"),properties:s(e(),Ut),required:n(e()).optional()}).catchall(c())}),Ht=t({type:r("ref/resource"),uri:e()}),xt=t({type:r("ref/prompt"),name:e()}),Mr=t({uri:e().startsWith("file://"),name:e().optional(),_meta:s(e(),c()).optional()}),Et=k.shape,Ar=t({experimental:Et.experimental,sampling:Et.sampling,elicitation:Et.elicitation,roots:Et.roots,extensions:Et.extensions}),ct=D.shape,nr=t({experimental:ct.experimental,logging:ct.logging,completions:ct.completions,prompts:ct.prompts,resources:ct.resources,tools:ct.tools,extensions:ct.extensions}),ir=u({progressToken:p.optional(),[vt]:e(),[Sr]:Z.optional(),[_t]:Ar,[It]:y.optional()}),Ft=t({...q.shape,...x.shape,description:e().optional(),inputSchema:u({$schema:e().optional(),type:r("object")}),outputSchema:u({$schema:e().optional()}).optional(),annotations:Se.optional(),_meta:s(e(),c()).optional()}),Lr=t({type:r("tool_result"),toolUseId:e(),content:n(Q),structuredContent:c().optional(),isError:i().optional(),_meta:s(e(),c()).optional()}),cr=a([ee,ge,_e,ve,Lr]),Bt=t({role:S,content:a([cr,n(cr)]),_meta:s(e(),c()).optional()}),lr=e(),ur=u({[pt]:Z.optional().catch(void 0)}),dr=ur.optional();function Xe(Ge){return u({_meta:dr,resultType:lr.default("complete"),...Ge})}let Dr=Xe({}),Js=Xe({nextCursor:f.optional()}),mr=Xe({content:n(Q),structuredContent:c().optional(),isError:i().optional()}),Ur=Xe({ttlMs:o().int().min(0),cacheScope:d(["public","private"]),tools:n(Ft),nextCursor:f.optional()}),Vr=Xe({ttlMs:o().int().min(0),cacheScope:d(["public","private"]),prompts:n(E),nextCursor:f.optional()}),Hr=Xe({description:e().optional(),messages:n(he)}),xr=Xe({ttlMs:o().int().min(0),cacheScope:d(["public","private"]),resources:n(Ue),nextCursor:f.optional()}),Fr=Xe({ttlMs:o().int().min(0),cacheScope:d(["public","private"]),resourceTemplates:n(je),nextCursor:f.optional()}),Br=Xe({ttlMs:o().int().min(0),cacheScope:d(["public","private"]),contents:n(a([Ce,Ae]))}),Jr=Xe({completion:t({values:n(e()).max(100),total:o().int().optional(),hasMore:i().optional()}).loose()}),Ks=Xe({ttlMs:o().int().min(0),cacheScope:d(["public","private"])}),Kr=Xe({ttlMs:o().int().min(0).catch(0),cacheScope:d(["public","private"]).catch("private"),supportedVersions:n(e()),capabilities:nr,instructions:e().optional()}),Tt=t({messages:n(Bt),modelPreferences:Te.optional(),systemPrompt:e().optional(),includeContext:d(["none","thisServer","allServers"]).optional(),temperature:o().optional(),maxTokens:o().int(),stopSequences:n(e()).optional(),metadata:h.optional(),tools:n(Ft).optional(),toolChoice:Ne.optional()}),Gr=t({method:r("sampling/createMessage"),params:Tt}),Wr=t({method:r("roots/list"),params:t({_meta:s(e(),c()).optional()}).optional()}),Yr=t({...Bt.shape,model:e(),stopReason:e().optional()}),Zr=t({roots:n(Mr)}),Xr=t({action:d(["accept","decline","cancel"]),content:s(e(),a([e(),o(),i(),n(e())])).optional()}),Qr=t({mode:r("url"),message:e(),url:e().url()}),es=a([Vt,Qr]),ts=t({method:r("elicitation/create"),params:es}),rs=a([Gr,Wr,ts]),ss=a([Yr,Zr,Xr]),os=s(e(),rs),as=s(e(),ss),Jt=Xe({inputRequests:os.optional(),requestState:e().optional()}),Kt={inputResponses:as.optional(),requestState:e().optional()},Gs=t({_meta:ir,...Kt}),Ws=u({progressToken:p.optional()});function at(Ge,Wt){return t({method:r(Ge),params:t({_meta:ir,...Wt})})}function nt(Ge,Wt){return t({method:r(Ge),params:t({_meta:Ws.optional(),...Wt}).optional()})}let ns={name:e(),arguments:s(e(),c()).optional(),...Kt},ut={cursor:f.optional()},Ys=at("tools/call",ns),Zs=at("tools/list",ut),Xs=at("prompts/list",ut),Qs=at("prompts/get",{name:e(),arguments:s(e(),e()).optional(),...Kt}),eo=at("resources/list",ut),to=at("resources/templates/list",ut),ro=at("resources/read",{uri:e(),...Kt}),is={ref:a([xt,Ht]),argument:t({name:e(),value:e()}),context:t({arguments:s(e(),e()).optional()}).optional()},so=at("completion/complete",is),oo=at("server/discover",{}),hr=t({toolsListChanged:i().optional(),promptsListChanged:i().optional(),resourcesListChanged:i().optional(),resourceSubscriptions:n(e()).optional()}),cs={notifications:hr},ao=at("subscriptions/listen",cs),no=ur.extend({"io.modelcontextprotocol/subscriptionId":g}),ls=u({_meta:no,resultType:lr.default("complete")}),Pt={"tools/call":nt("tools/call",ns),"tools/list":nt("tools/list",ut),"prompts/get":nt("prompts/get",{name:e(),arguments:s(e(),e()).optional()}),"prompts/list":nt("prompts/list",ut),"resources/list":nt("resources/list",ut),"resources/templates/list":nt("resources/templates/list",ut),"resources/read":nt("resources/read",{uri:e()}),"completion/complete":nt("completion/complete",is),"server/discover":nt("server/discover",{}),"subscriptions/listen":nt("subscriptions/listen",cs)};function st(Ge){return u({_meta:dr,...Ge})}let io={"tools/call":st({content:n(Q),structuredContent:c().optional(),isError:i().optional()}),"tools/list":st({ttlMs:o().int().min(0),cacheScope:d(["public","private"]),tools:n(Ft),nextCursor:f.optional()}),"prompts/get":st({description:e().optional(),messages:n(he)}),"prompts/list":st({ttlMs:o().int().min(0),cacheScope:d(["public","private"]),prompts:n(E),nextCursor:f.optional()}),"resources/list":st({ttlMs:o().int().min(0),cacheScope:d(["public","private"]),resources:n(Ue),nextCursor:f.optional()}),"resources/templates/list":st({ttlMs:o().int().min(0),cacheScope:d(["public","private"]),resourceTemplates:n(je),nextCursor:f.optional()}),"resources/read":st({ttlMs:o().int().min(0),cacheScope:d(["public","private"]),contents:n(a([Ce,Ae]))}),"completion/complete":st({completion:t({values:n(e()).max(100),total:o().int().optional(),hasMore:i().optional()}).loose()}),"server/discover":st({ttlMs:o().int().min(0).catch(0),cacheScope:d(["public","private"]).catch("private"),supportedVersions:n(e()),capabilities:nr,instructions:e().optional()}),"subscriptions/listen":st({})},Gt=u({"io.modelcontextprotocol/subscriptionId":g.optional()}),pr=t({method:r("notifications/subscriptions/acknowledged"),params:t({_meta:Gt.optional(),notifications:hr})}),fr=t({_meta:Gt.optional(),requestId:g,reason:e().optional()}),gr=t({method:r("notifications/cancelled"),params:fr}),Tn={"notifications/cancelled":gr,"notifications/progress":ie,"notifications/message":Re,"notifications/resources/updated":M,"notifications/resources/list_changed":te,"notifications/tools/list_changed":we,"notifications/prompts/list_changed":A,"notifications/subscriptions/acknowledged":pr},rt=(Ge)=>t({jsonrpc:r("2.0"),id:a([e(),o().int()]),result:Ge}).strict();return{JSONValueSchema:m,JSONObjectSchema:h,ProgressTokenSchema:p,CursorSchema:f,RequestIdSchema:g,RoleSchema:S,LoggingLevelSchema:y,TaskMetadataSchema:v,RelatedTaskMetadataSchema:T,RequestMetaSchema:O,BaseRequestParamsSchema:C,TaskAugmentedRequestParamsSchema:U,NotificationsParamsSchema:F,NotificationSchema:V,IconSchema:B,IconsSchema:x,BaseMetadataSchema:q,ImplementationSchema:Z,ClientTasksCapabilitySchema:ae,ServerTasksCapabilitySchema:H,ClientCapabilitiesSchema:k,ServerCapabilitiesSchema:D,ProgressSchema:se,ProgressNotificationParamsSchema:pe,ProgressNotificationSchema:ie,LoggingMessageNotificationParamsSchema:fe,LoggingMessageNotificationSchema:Re,ResourceContentsSchema:ze,TextResourceContentsSchema:Ce,BlobResourceContentsSchema:Ae,AnnotationsSchema:Me,ResourceSchema:Ue,ResourceTemplateSchema:je,ResourceListChangedNotificationSchema:te,ResourceUpdatedNotificationParamsSchema:me,ResourceUpdatedNotificationSchema:M,PromptArgumentSchema:b,PromptSchema:E,PromptListChangedNotificationSchema:A,TextContentSchema:ee,ImageContentSchema:ge,AudioContentSchema:_e,ToolUseContentSchema:ve,EmbeddedResourceSchema:Ie,ResourceLinkSchema:Le,ContentBlockSchema:Q,PromptMessageSchema:he,ToolAnnotationsSchema:Se,ToolListChangedNotificationSchema:we,ModelHintSchema:$e,ModelPreferencesSchema:Te,ToolChoiceSchema:Ne,BooleanSchemaSchema:xe,StringSchemaSchema:De,NumberSchemaSchema:Fe,UntitledSingleSelectEnumSchemaSchema:Ve,TitledSingleSelectEnumSchemaSchema:it,LegacyTitledEnumSchemaSchema:We,SingleSelectEnumSchemaSchema:gt,UntitledMultiSelectEnumSchemaSchema:lt,TitledMultiSelectEnumSchemaSchema:St,MultiSelectEnumSchemaSchema:wt,EnumSchemaSchema:$t,PrimitiveSchemaDefinitionSchema:Ut,ElicitRequestFormParamsSchema:Vt,ResourceTemplateReferenceSchema:Ht,PromptReferenceSchema:xt,RootSchema:Mr,ClientCapabilities2026Schema:Ar,ServerCapabilities2026Schema:nr,RequestMetaEnvelopeSchema:ir,ToolSchema:Ft,ToolResultContentSchema:Lr,SamplingMessageContentBlockSchema:cr,SamplingMessageSchema:Bt,ResultTypeSchema:lr,ResultMetaSchema:ur,ResultSchema:Dr,PaginatedResultSchema:Js,CallToolResultSchema:mr,ListToolsResultSchema:Ur,ListPromptsResultSchema:Vr,GetPromptResultSchema:Hr,ListResourcesResultSchema:xr,ListResourceTemplatesResultSchema:Fr,ReadResourceResultSchema:Br,CompleteResultSchema:Jr,CacheableResultSchema:Ks,DiscoverResultSchema:Kr,CreateMessageRequestParamsSchema:Tt,CreateMessageRequestSchema:Gr,ListRootsRequestSchema:Wr,CreateMessageResultSchema:Yr,ListRootsResultSchema:Zr,ElicitResultSchema:Xr,ElicitRequestURLParamsSchema:Qr,ElicitRequestParamsSchema:es,ElicitRequestSchema:ts,InputRequestSchema:rs,InputResponseSchema:ss,InputRequestsSchema:os,InputResponsesSchema:as,InputRequiredResultSchema:Jt,InputResponseRequestParamsSchema:Gs,CallToolRequestSchema:Ys,ListToolsRequestSchema:Zs,ListPromptsRequestSchema:Xs,GetPromptRequestSchema:Qs,ListResourcesRequestSchema:eo,ListResourceTemplatesRequestSchema:to,ReadResourceRequestSchema:ro,CompleteRequestSchema:so,DiscoverRequestSchema:oo,SubscriptionFilterSchema:hr,SubscriptionsListenRequestSchema:ao,SubscriptionsListenResultMetaSchema:no,SubscriptionsListenResultSchema:ls,dispatchRequestSchemas:Pt,dispatchResultSchemas:io,NotificationMetaSchema:Gt,SubscriptionsAcknowledgedNotificationSchema:pr,CancelledNotificationParamsSchema:fr,CancelledNotificationSchema:gr,notificationSchemas2026:Tn,JSONRPCResultResponseSchema:rt(Dr),CallToolResultResponseSchema:rt(a([mr,Jt])),ListToolsResultResponseSchema:rt(Ur),ListPromptsResultResponseSchema:rt(Vr),GetPromptResultResponseSchema:rt(a([Hr,Jt])),ListResourcesResultResponseSchema:rt(xr),ListResourceTemplatesResultResponseSchema:rt(Fr),ReadResourceResultResponseSchema:rt(a([Br,Jt])),CompleteResultResponseSchema:rt(Jr),DiscoverResultResponseSchema:rt(Kr),SubscriptionsListenResultResponseSchema:rt(ls)}}var Ru;function Lt(){return Ru??=bu()}var zu=["tools/list","prompts/list","resources/list","resources/templates/list","resources/read","server/discover"];function wu(m){return zu.includes(m)}var Cr=Symbol("modelcontextprotocol.resultCacheHintFallback");function un(m,h){if(h===void 0)return m;let p=m[Cr];if(p===void 0)return{...m,[Cr]:h};let f={},g=p.ttlMs??h.ttlMs;if(g!==void 0)f.ttlMs=g;let S=p.cacheScope??h.cacheScope;if(S!==void 0)f.cacheScope=S;return{...m,[Cr]:f}}function $u(m){return m[Cr]}function gi(m){return typeof m==="number"&&Number.isSafeInteger(m)&&m>=0}function Si(m){return m==="public"||m==="private"}function yi(m,h){if(m.ttlMs!==void 0&&!gi(m.ttlMs))throw RangeError(`Invalid cache hint for ${h}: ttlMs must be a non-negative safe integer (got ${String(m.ttlMs)})`);if(m.cacheScope!==void 0&&!Si(m.cacheScope))throw RangeError(`Invalid cache hint for ${h}: cacheScope must be 'public' or 'private' (got ${String(m.cacheScope)})`)}var be=function(m){return m[m.ParseError=-32700]="ParseError",m[m.InvalidRequest=-32600]="InvalidRequest",m[m.MethodNotFound=-32601]="MethodNotFound",m[m.InvalidParams=-32602]="InvalidParams",m[m.InternalError=-32603]="InternalError",m[m.ResourceNotFound=-32002]="ResourceNotFound",m[m.MissingRequiredClientCapability=-32021]="MissingRequiredClientCapability",m[m.UnsupportedProtocolVersion=-32022]="UnsupportedProtocolVersion",m[m.UrlElicitationRequired=-32042]="UrlElicitationRequired",m}({}),Ee=class m extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.ProtocolError"})}static[Symbol.hasInstance](h){return Ir(this,h)}static isInstance(h){if(typeof this!=="function")throw TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return Ir(this,h)}constructor(h,p,f){super(p);this.code=h,this.data=f,this.name="ProtocolError",mi(this,new.target)}static fromError(h,p,f){if(h===be.UrlElicitationRequired&&f){let g=f;if(g.elicitations)return new Ac(g.elicitations,p)}if(h===be.UnsupportedProtocolVersion&&f){let g=f;if(Array.isArray(g.supported)&&typeof g.requested==="string")return new jr({supported:g.supported,requested:g.requested},p)}if(h===be.InvalidParams||h===be.ResourceNotFound){let g=f;if(typeof g?.uri==="string"&&(h===be.ResourceNotFound||Object.keys(g).length===1))return new dn(g.uri,p)}if(h===be.MissingRequiredClientCapability&&f){let g=f;if(g.requiredCapabilities!==null&&typeof g.requiredCapabilities==="object"&&!Array.isArray(g.requiredCapabilities))return new mn({requiredCapabilities:g.requiredCapabilities},p)}return new m(h,p,f)}},dn=class extends Ee{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.ResourceNotFoundError"})}constructor(m,h=`Resource not found: ${m}`){super(be.InvalidParams,h,{uri:m})}get uri(){return this.data.uri}},Ac=class extends Ee{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.UrlElicitationRequiredError"})}constructor(m,h=`URL elicitation${m.length>1?"s":""} required`){super(be.UrlElicitationRequired,h,{elicitations:m})}get elicitations(){return this.data?.elicitations??[]}},jr=class extends Ee{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.UnsupportedProtocolVersionError"})}constructor(m,h=`Unsupported protocol version: ${m.requested}`){super(be.UnsupportedProtocolVersion,h,m)}get supported(){return this.data.supported}get requested(){return this.data.requested}},mn=class extends Ee{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.MissingRequiredClientCapabilityError"})}constructor(m,h=`Missing required client capabilities: ${Object.keys(m.requiredCapabilities).join(", ")}`){super(be.MissingRequiredClientCapability,h,m)}get requiredCapabilities(){return this.data.requiredCapabilities}},Eu=0,Tu="private",Pu=["tools/call","prompts/get","resources/read"];function Cu(m,h){let p=h.resultType;if(p===void 0)return{...h,resultType:"complete"};if(p==="complete")return h;if(Pu.includes(m))return h;throw new Ee(be.InternalError,`Handler for ${m} returned resultType '${String(p)}', but results of ${m} only support 'complete' on protocol revision 2026-07-28`)}function Iu(m,h){let p=$u(h);if(h.resultType!=="complete"||!wu(m))return p===void 0?h:ku(h);let f=h,g=gi(f.ttlMs)?f.ttlMs:ju(p),S=Si(f.cacheScope)?f.cacheScope:Nu(p),y={...f,ttlMs:g,cacheScope:S};return delete y[Cr],y}function qu(m){return m!==null&&typeof m==="object"&&!Array.isArray(m)}function Ou(m,h){if(h===void 0)return m;let p=m._meta;if(p===void 0)return{...m,_meta:{[pt]:h}};if(!qu(p))return m;if(p[pt]!==void 0)return m;return{...m,_meta:{...p,[pt]:h}}}function ju(m){return m!==void 0&&gi(m.ttlMs)?m.ttlMs:Eu}function Nu(m){return m!==void 0&&Si(m.cacheScope)?m.cacheScope:Tu}function ku(m){let h={...m};return delete h[Cr],h}var Mu=["elicitation/create","sampling/createMessage","roots/list"],rn;function Lc(){if(rn)return rn;let m=Lt();return rn={request:{"elicitation/create":t({method:r("elicitation/create"),params:m.ElicitRequestParamsSchema}),"sampling/createMessage":t({method:r("sampling/createMessage"),params:m.CreateMessageRequestParamsSchema}),"roots/list":t({method:r("roots/list"),params:u({}).optional()})},response:{"elicitation/create":m.ElicitResultSchema,"sampling/createMessage":m.CreateMessageResultSchema,"roots/list":m.ListRootsResultSchema}},rn}function Dc(m){return Mu.includes(m)}function ai(m){return Dc(m)?Lc().request[m]:void 0}function Au(m){return Dc(m)?Lc().response[m]:void 0}var vi={"tools/call":null,"tools/list":null,"prompts/get":null,"prompts/list":null,"resources/list":null,"resources/templates/list":null,"resources/read":null,"completion/complete":null,"server/discover":null,"subscriptions/listen":null},Uc={"notifications/cancelled":null,"notifications/progress":null,"notifications/message":null,"notifications/resources/updated":null,"notifications/resources/list_changed":null,"notifications/tools/list_changed":null,"notifications/prompts/list_changed":null,"notifications/subscriptions/acknowledged":null};function Vc(m){return Object.prototype.hasOwnProperty.call(vi,m)}function Hc(m){return Object.prototype.hasOwnProperty.call(Uc,m)}function Lu(m){return Object.prototype.hasOwnProperty.call(vi,m)}function Du(m){return Vc(m)?Lt().dispatchRequestSchemas[m]:void 0}function Uu(m){return Lu(m)?Lt().dispatchResultSchemas[m]:void 0}function Vu(m){return Hc(m)?Lt().notificationSchemas2026[m]:void 0}var ep=Object.keys(vi),tp=Object.keys(Uc);function Ls(m){return m!==null&&typeof m==="object"&&!Array.isArray(m)}function Ms(m,h){if(m===void 0)return{ok:!1,reason:"not-in-era"};let p=m.safeParse(h);return p.success?{ok:!0,value:p.data}:{ok:!1,reason:"invalid",message:String(p.error)}}var Hu={ok:!1,reason:"not-in-era"},xu=[vt,_t];function Fu(m,h){let p=h,f=!1,g=()=>{if(!f)p={...p},f=!0;return p},S=h.tools;if(m==="tools/list"&&Array.isArray(S)&&S.some((z)=>Ls(z)&&("execution"in z)))g().tools=S.map((z)=>{if(!Ls(z)||!("execution"in z))return z;let v={...z};return delete v.execution,v});let y=h.capabilities;if(Ls(y)&&"tasks"in y){let z={...y};delete z.tasks,g().capabilities=z}return p}var _i={era:"2026-07-28",hasRequestMethod:Vc,hasNotificationMethod:Hc,hasInputRequestMethod:(m)=>ai(m)!==void 0,validateRequest:(m,h)=>Ms(Du(m),h),validateResult:(m,h)=>Ms(Uu(m),h),validateNotification:(m,h)=>Ms(Vu(m),h),validateInputRequest:(m,h)=>Ms(ai(m),h),validateInputResponse:(m,h)=>Ms(Au(m),h),samplingResultVariant:()=>Hu,outboundEnvelope(m){return{[vt]:m.protocolVersion,[Sr]:m.clientInfo,[_t]:m.clientCapabilities,...m.logLevel!==void 0&&{[It]:m.logLevel}}},validateEnvelopeMeta(m){let h=[];for(let f of xu)if(!(f in m))h.push({key:f,problem:"missing"});let p=Lt().RequestMetaEnvelopeSchema.safeParse(m);if(!p.success)for(let f of p.error.issues){let g=f.path.map(String),S=g.length>0?g.join("."):"_meta";if(g.length===1&&h.some((y)=>y.key===S&&y.problem==="missing"))continue;h.push({key:S,problem:f.message})}return h},projectCallToolResult:(m)=>Cc(m),inputRequestSchema:ai,decodeResult(m,h){if(!Ls(h))return{kind:"invalid",error:new Pe(Oe.InvalidResult,`Invalid result for ${m}: not an object`,{method:m})};let p=h.resultType;if(p===void 0)return{kind:"invalid",error:new Pe(Oe.InvalidResult,`Invalid result for ${m}: missing required resultType — servers implementing protocol revision 2026-07-28 MUST include it (the absent-means-complete bridge applies only to earlier-revision servers)`,{method:m,violation:"missing-resultType"})};if(typeof p!=="string")return{kind:"invalid",error:new Pe(Oe.InvalidResult,`Invalid result for ${m}: non-string resultType`,{method:m,resultType:p})};if(p==="input_required"){let y=h.inputRequests,z=Ls(y)?y:{},v=h.requestState,T=h._meta===void 0?void 0:Lt().ResultMetaSchema.safeParse(h._meta),O=T?.success?T.data:void 0;if(Object.keys(z).length===0&&typeof v!=="string")return{kind:"invalid",error:new Pe(Oe.InvalidResult,`Invalid result for ${m}: input_required carries neither inputRequests nor requestState (every input_required result must include at least one of the two)`,{method:m,violation:"input-required-missing-both"})};return{kind:"input_required",inputRequests:z,...typeof v==="string"&&{requestState:v},...O!==void 0&&{_meta:O}}}if(p!=="complete")return{kind:"invalid",error:new Pe(Oe.UnsupportedResultType,`Unsupported result type '${p}' for ${m}`,{resultType:p,method:m})};let f=Bu(),g=Object.hasOwn(f,m)?f[m]:void 0;if(g!==void 0){let y=g.safeParse(h);if(!y.success)return{kind:"invalid",error:new Pe(Oe.InvalidResult,`Invalid result for ${m}: ${y.error}`,{method:m})}}let S={...h};return delete S.resultType,{kind:"complete",result:S}},encodeResult(m,h,p){return Ou(Iu(m,Cu(m,Fu(m,h))),p)},encodeErrorCode:(m)=>m===-32002?-32602:m,checkInboundEnvelope(m){if(m.envelope===void 0)return"Request is missing the required _meta envelope for protocol revision 2026-07-28 (io.modelcontextprotocol/protocolVersion, io.modelcontextprotocol/clientCapabilities)";let h=Lt().RequestMetaEnvelopeSchema.safeParse(m.envelope);if(!h.success)return`Invalid _meta envelope for protocol revision 2026-07-28: ${h.error.issues.map((p)=>p.message).join("; ")}`}},sn;function Bu(){if(sn)return sn;let m=Lt();return sn={"tools/call":m.CallToolResultSchema,"tools/list":m.ListToolsResultSchema,"prompts/get":m.GetPromptResultSchema,"prompts/list":m.ListPromptsResultSchema,"resources/list":m.ListResourcesResultSchema,"resources/templates/list":m.ListResourceTemplatesResultSchema,"resources/read":m.ReadResourceResultSchema,"completion/complete":m.CompleteResultSchema,"server/discover":m.DiscoverResultSchema},sn}var Vs="2026-07-28";function Rt(m){return m!==void 0&&Or(m)?_i:fi}function gc(m){if(m.revision!==void 0)return Rt(m.revision).era;return m.era==="modern"?_i.era:fi.era}function ni(m){return xc.some((h)=>h.hasRequestMethod(m))}function ii(m){return xc.some((h)=>h.hasNotificationMethod(m))}function Sc(m){return m==="tasks/get"||m==="tasks/cancel"}var xc=[fi,_i];function yc(m){return m!==null&&typeof m==="object"&&!Array.isArray(m)}function sr(m){if(!yc(m))return;let h=m._meta;return yc(h)?h:void 0}function hn(m){let h=sr(m);return h!==void 0&&vt in h}function pn(m){let h=sr(m)?.[vt];return typeof h==="string"?h:void 0}function fn(m){return Rt(Vs).validateEnvelopeMeta(m)}var Ju=Gi({AnnotationsSchema:()=>bt,AudioContentSchema:()=>wr,BaseMetadataSchema:()=>yt,BaseRequestParamsSchema:()=>Ye,BlobResourceContentsSchema:()=>ws,BooleanSchemaSchema:()=>Cs,CallToolRequestParamsSchema:()=>ha,CallToolRequestSchema:()=>pa,CallToolResultSchema:()=>Ps,CancelTaskRequestSchema:()=>Hn,CancelTaskResultSchema:()=>xn,CancelledNotificationParamsSchema:()=>go,CancelledNotificationSchema:()=>ys,ClientCapabilitiesSchema:()=>_o,ClientNotificationSchema:()=>Bn,ClientRequestSchema:()=>Fn,ClientResultSchema:()=>Jn,ClientTasksCapabilitySchema:()=>yo,CompatibilityCallToolResultSchema:()=>qn,CompleteRequestParamsSchema:()=>Va,CompleteRequestSchema:()=>Ha,CompleteResultSchema:()=>xa,ContentBlockSchema:()=>$r,CreateMessageRequestParamsSchema:()=>Ea,CreateMessageRequestSchema:()=>Ta,CreateMessageResultSchema:()=>Pa,CreateMessageResultWithToolsSchema:()=>Ca,CreateTaskResultSchema:()=>Nn,CursorSchema:()=>ds,DiscoverRequestSchema:()=>$o,DiscoverResultSchema:()=>Eo,ElicitRequestFormParamsSchema:()=>Pr,ElicitRequestParamsSchema:()=>Na,ElicitRequestSchema:()=>ka,ElicitRequestURLParamsSchema:()=>ja,ElicitResultSchema:()=>La,ElicitationCompleteNotificationParamsSchema:()=>Ma,ElicitationCompleteNotificationSchema:()=>Aa,EmbeddedResourceSchema:()=>oa,EmptyResultSchema:()=>Ss,EnumSchemaSchema:()=>Oa,GetPromptRequestParamsSchema:()=>ta,GetPromptRequestSchema:()=>ra,GetPromptResultSchema:()=>ia,GetTaskPayloadRequestSchema:()=>Ln,GetTaskPayloadResultSchema:()=>Dn,GetTaskRequestSchema:()=>Mn,GetTaskResultSchema:()=>An,IconSchema:()=>So,IconsSchema:()=>Ot,ImageContentSchema:()=>zr,ImplementationSchema:()=>_r,InitializeRequestParamsSchema:()=>bo,InitializeRequestSchema:()=>Ro,InitializeResultSchema:()=>zo,InitializedNotificationSchema:()=>wo,JSONArraySchema:()=>Pn,JSONObjectSchema:()=>Be,JSONRPCErrorResponseSchema:()=>vr,JSONRPCMessageSchema:()=>gs,JSONRPCNotificationSchema:()=>fs,JSONRPCRequestSchema:()=>ps,JSONRPCResponseSchema:()=>Cn,JSONRPCResultResponseSchema:()=>yr,JSONValueSchema:()=>Ct,LegacyTitledEnumSchemaSchema:()=>Os,ListChangedOptionsBaseSchema:()=>On,ListPromptsRequestSchema:()=>Qo,ListPromptsResultSchema:()=>ea,ListResourceTemplatesRequestSchema:()=>jo,ListResourceTemplatesResultSchema:()=>No,ListResourcesRequestSchema:()=>qo,ListResourcesResultSchema:()=>Oo,ListRootsRequestSchema:()=>Ba,ListRootsResultSchema:()=>Ja,ListTasksRequestSchema:()=>Un,ListTasksResultSchema:()=>Vn,ListToolsRequestSchema:()=>da,ListToolsResultSchema:()=>ma,LoggingLevelSchema:()=>Mt,LoggingMessageNotificationParamsSchema:()=>ya,LoggingMessageNotificationSchema:()=>va,ModelHintSchema:()=>_a,ModelPreferencesSchema:()=>ba,MultiSelectEnumSchemaSchema:()=>qa,NotificationSchema:()=>tt,NotificationsParamsSchema:()=>et,NumberSchemaSchema:()=>Tr,PaginatedRequestParamsSchema:()=>Co,PaginatedRequestSchema:()=>jt,PaginatedResultSchema:()=>Nt,PingRequestSchema:()=>_s,PrimitiveSchemaDefinitionSchema:()=>ks,ProgressNotificationParamsSchema:()=>Po,ProgressNotificationSchema:()=>bs,ProgressSchema:()=>To,ProgressTokenSchema:()=>us,PromptArgumentSchema:()=>Zo,PromptListChangedNotificationSchema:()=>ca,PromptMessageSchema:()=>na,PromptReferenceSchema:()=>Ua,PromptSchema:()=>Xo,ReadResourceRequestParamsSchema:()=>ko,ReadResourceRequestSchema:()=>Mo,ReadResourceResultSchema:()=>Ao,RelatedTaskMetadataSchema:()=>fo,RequestIdSchema:()=>qt,RequestMetaSchema:()=>ms,RequestSchema:()=>Je,ResourceContentsSchema:()=>Rs,ResourceLinkSchema:()=>aa,ResourceListChangedNotificationSchema:()=>Lo,ResourceRequestParamsSchema:()=>br,ResourceSchema:()=>$s,ResourceTemplateReferenceSchema:()=>Da,ResourceTemplateSchema:()=>Io,ResourceUpdatedNotificationParamsSchema:()=>Wo,ResourceUpdatedNotificationSchema:()=>Yo,ResultMetaObjectSchema:()=>hs,ResultSchema:()=>Ke,RoleSchema:()=>kt,RootSchema:()=>Fa,RootsListChangedNotificationSchema:()=>Ka,SamplingContentSchema:()=>wa,SamplingMessageContentBlockSchema:()=>Yt,SamplingMessageSchema:()=>$a,ServerCapabilitiesSchema:()=>vs,ServerNotificationSchema:()=>Gn,ServerRequestSchema:()=>Kn,ServerResultSchema:()=>Wn,ServerTasksCapabilitySchema:()=>vo,SetLevelRequestParamsSchema:()=>ga,SetLevelRequestSchema:()=>Sa,SingleSelectEnumSchemaSchema:()=>Ia,StringSchemaSchema:()=>Er,SubscribeRequestParamsSchema:()=>Do,SubscribeRequestSchema:()=>Uo,SubscriptionFilterSchema:()=>Es,SubscriptionsAcknowledgedNotificationParamsSchema:()=>Bo,SubscriptionsAcknowledgedNotificationSchema:()=>Jo,SubscriptionsListenRequestParamsSchema:()=>xo,SubscriptionsListenRequestSchema:()=>Fo,SubscriptionsListenResultMetaSchema:()=>Ko,SubscriptionsListenResultSchema:()=>Go,TaskAugmentedRequestParamsSchema:()=>er,TaskCreationParamsSchema:()=>jn,TaskMetadataSchema:()=>po,TaskSchema:()=>At,TaskStatusNotificationParamsSchema:()=>Wa,TaskStatusNotificationSchema:()=>kn,TaskStatusSchema:()=>Ga,TextContentSchema:()=>Rr,TextResourceContentsSchema:()=>zs,TitledMultiSelectEnumSchemaSchema:()=>Ns,TitledSingleSelectEnumSchemaSchema:()=>qs,ToolAnnotationsSchema:()=>la,ToolChoiceSchema:()=>Ra,ToolExecutionSchema:()=>ua,ToolListChangedNotificationSchema:()=>fa,ToolResultContentSchema:()=>za,ToolSchema:()=>Ts,ToolUseContentSchema:()=>sa,UnsubscribeRequestParamsSchema:()=>Vo,UnsubscribeRequestSchema:()=>Ho,UntitledMultiSelectEnumSchemaSchema:()=>js,UntitledSingleSelectEnumSchemaSchema:()=>Is});var ot=(m)=>ps.safeParse(m).success,Dt=(m)=>fs.safeParse(m).success,rr=(m)=>yr.safeParse(m).success,or=(m)=>vr.safeParse(m).success;var zt=(m)=>typeof m==="object"&&m!==null&&!Array.isArray(m)&&m.resultType==="input_required";function bi(m){if(m.params.ref.type!=="ref/prompt")throw TypeError(`Expected CompleteRequestPrompt, but got ${m.params.ref.type}`)}function Ri(m){if(m.params.ref.type!=="ref/resource")throw TypeError(`Expected CompleteRequestResourceTemplate, but got ${m.params.ref.type}`)}var vc="x-mcp-header",Ku=/^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/,Gu=new Set(["string","integer","boolean"]);function zi(m){let h=[],p=new Map,f,g=(y,z,v)=>{if(y===null||typeof y!=="object")return;let T=y;if(vc in T){if(!v||z.length===0)return`${on(z)}: x-mcp-header is only permitted on properties statically reachable via a chain of 'properties' keys (not under items, additionalProperties, oneOf/anyOf/allOf/not, if/then/else, or $ref)`;let C=T[vc];if(typeof C!=="string"||C.length===0)return`${on(z)}: x-mcp-header MUST be a non-empty string`;if(!Ku.test(C))return`${on(z)}: x-mcp-header '${C}' is not a valid RFC 9110 token (no spaces, control characters or HTTP delimiters)`;let U=typeof T.type==="string"?T.type:void 0;if(U===void 0||!Gu.has(U)){let B=`${on(z)}: x-mcp-header is only permitted on primitive-typed properties (string, integer, boolean); got ${U??"<none>"}`;if(U!=="number")return B;f??=B}let F=C.toLowerCase(),V=p.get(F);if(V!==void 0)return`x-mcp-header '${C}' is not case-insensitively unique (also declared as '${V}')`;p.set(F,C),h.push({path:z,headerName:C,type:U})}let O=T.properties;if(O!==null&&typeof O==="object")for(let[C,U]of Object.entries(O)){let F=g(U,[...z,C],v);if(F!==void 0)return F}for(let C of Wu){let U=T[C];if(U===void 0)continue;let F=Array.isArray(U)?U:U!==null&&typeof U==="object"&&Yu.has(C)?Object.values(U):[U];for(let V of F){let B=g(V,[...z,`<${C}>`],!1);if(B!==void 0)return B}}},S=g(m,[],!0);if(S!==void 0)return{valid:!1,reason:f??S};return f===void 0?{valid:!0,declarations:h}:{valid:!1,reason:f,declarations:h}}var Wu=["items","prefixItems","contains","additionalProperties","unevaluatedProperties","unevaluatedItems","propertyNames","patternProperties","dependentSchemas","oneOf","anyOf","allOf","not","if","then","else","$defs","definitions"],Yu=new Set(["patternProperties","dependentSchemas","$defs","definitions"]);function on(m){return m.length===0?"<root>":m.join(".")}var nn=-32020,rp=[{rung:"http-method",order:1,evaluatedAt:"edge",codes:[-32000],conformance:[],rationale:"The modern era is POST-only; GET/DELETE are body-less 2025-era session operations and are method-routed to legacy serving (405 when legacy serving is not configured), before any body is read."},{rung:"jsonrpc-shape",order:2,evaluatedAt:"edge",codes:[be.InvalidRequest],conformance:["server-stateless"],rationale:"The body must be a JSON-RPC request or notification: posted responses and batch arrays containing a modern or invalid element are rejected before classification (element-wise batch rule); all-legacy arrays stay legacy traffic."},{rung:"era-classification",order:3,evaluatedAt:"edge",codes:[nn,be.UnsupportedProtocolVersion],conformance:["server-stateless","http-header-validation","http-custom-header-server-validation"],rationale:"Body-primary era classification with the protocol-version header as a cross-check; a header/body disagreement is rejected with -32020 (HeaderMismatch), and an envelope-less request on a modern-only endpoint is answered with the unsupported-protocol-version error naming the supported revisions."},{rung:"envelope",order:4,evaluatedAt:"edge",codes:[be.InvalidParams],conformance:["server-stateless"],rationale:"A present envelope claim with a malformed envelope — and a missing envelope on a request whose protocol-version header names a modern revision — is an invalid-params rejection naming the offending or missing key(s); never a silent fall back to legacy handling. This is the only place an invalid-params rejection maps to HTTP 400."},{rung:"method-registry",order:5,evaluatedAt:"dispatch",codes:[be.MethodNotFound],conformance:["server-stateless"],rationale:"Method existence outranks parameter validity: a method absent from the negotiated revision’s registry (or with no handler installed) answers method-not-found before params or capabilities are looked at."},{rung:"request-params",order:6,evaluatedAt:"dispatch",codes:[be.InvalidParams],conformance:[],rationale:"Per-method params validation; emitted in-band by the dispatch layer (HTTP 200), never via the ladder status table."},{rung:"standard-header-validation",order:7,evaluatedAt:"pre-dispatch",codes:[nn],conformance:["http-header-validation"],rationale:"SEP-2243 standard `MCP-Protocol-Version` / `Mcp-Method` / `Mcp-Name` headers — presence, sentinel decoding, and `Mcp-Name` ↔ body cross-check — are validated by the HTTP entry on a modern-classified request after the supported-revision gate and before dispatch. The spec requires `MCP-Protocol-Version` and `Mcp-Method` on every modern *request* POST (`Mcp-Name` only for the methods that mirror `params.name` / `params.uri` / `params.taskId`, see `MCP_NAME_HEADER_SOURCE`) and names them in that order, so a request missing several is answered by the earliest. Notification POSTs are exempt: the presence half runs on requests only, so a modern-enveloped notification is dispatched even with no standard headers at all. The classifier’s own header-mismatch cells (protocol-version, `Mcp-Method` mismatch) stay on the edge `era-classification` rung; this rung carries the entry-layer presence/`Mcp-Name` half — including the missing `MCP-Protocol-Version` cell, which cannot live on the edge rung without breaking body-primary classification. Evaluated before the capability gate, the factory call, and the `Mcp-Param-*` rung so a request that fails several rungs is answered by the standard-header rung first. The documented order (after method-registry 5 and request-params 6) is NOT the observed precedence: serveModern evaluates this rung immediately after the supported-revision gate, so a request that also fails a dispatch rung is answered here before the dispatch rungs (5–6) are consulted."},{rung:"client-capabilities",order:8,evaluatedAt:"pre-dispatch",codes:[be.MissingRequiredClientCapability],conformance:["server-stateless"],rationale:"The capability requirement is checked by the HTTP entry, pre-dispatch, against the validated envelope the classifier produced — pinning the spec-mandated HTTP 400 independently of how dispatch- and handler-produced errors are mapped. The documented order (after method resolution and params validation) is preserved observably only while the requirement table is empty: once a served method gains a requirement entry, a request that is missing the capability and would also fail a dispatch rung is answered by this gate first, so the entry must consult the method registry before the gate if the documented precedence is to stay observable."},{rung:"param-header-validation",order:9,evaluatedAt:"pre-dispatch",codes:[nn],conformance:["http-custom-header-server-validation"],rationale:"SEP-2243 `Mcp-Param-*` headers are validated against the named tool’s `x-mcp-header` declarations and the body `arguments` after the tool registry is known and before dispatch reaches the handler; a missing/disagreeing/malformed header is rejected 400 / -32020 with the same shape as the standard-header cross-checks. The documented order (after method resolution and params validation) is preserved observably only when the body `arguments` would otherwise validate: the check runs pre-dispatch, so a `tools/call` that fails BOTH this rung and a dispatch-time rung (e.g. order-6 `request-params`, -32602) is answered by this gate first with 400 / -32020, not by the earlier-ordered rung."}],Fc={[be.ParseError]:400,[be.InvalidRequest]:400,[be.MethodNotFound]:404,[be.UnsupportedProtocolVersion]:400,[be.MissingRequiredClientCapability]:400,[nn]:400};function an(m,h,p,f,g){return{kind:"reject",rung:m,cell:h,httpStatus:p,code:f.code,message:f.message,...f.data!==void 0&&{data:f.data},settled:g}}function wi(m){if(!hn(m))return!1;let h=pn(m);if(h===void 0||!Or(h))return!1;let p=sr(m);return p!==void 0&&fn(p).length===0}function $i(m,h){switch(m.reason){case"http-method":return an("http-method","modern-only-method-not-allowed",405,new Ee(-32000,"Method not allowed."),!0);case"batch":return an("jsonrpc-shape","modern-only-batch-not-supported",400,new Ee(be.InvalidRequest,"Bad Request: JSON-RPC batches are not supported by this endpoint"),!0);case"response":return an("jsonrpc-shape","modern-only-response-post",400,new Ee(be.InvalidRequest,"Bad Request: JSON-RPC responses cannot be posted to this endpoint"),!0);case"notification":return;case"initialize":case"no-claim":{let p=m.requestedVersion;return an("era-classification","modern-only-missing-envelope",400,p===void 0?new Ee(be.UnsupportedProtocolVersion,"Unsupported protocol version: the request did not name a protocol version",{supported:[...h]}):new jr({supported:[...h],requested:p}),!0)}}}function gn(m,h){return J(m,h)}function As(m){return new Set(m.flatMap((h)=>Object.keys(h.shape)))}function qr(m){if(m==null)return!1;let h=typeof m;if(h!=="object"&&h!=="function")return!1;if(!("~standard"in m))return!1;return typeof m["~standard"]?.validate==="function"}var _c=!1,ui="draft-2020-12";function ar(m,h="input"){let p=m["~standard"],f;if(p.jsonSchema)f=p.jsonSchema[h]({target:ui});else if(p.vendor==="zod"){if(!("_zod"in m))throw Error("Schema appears to be from zod 3, which the SDK cannot convert to JSON Schema. Upgrade to zod >=4.2.0, or wrap your JSON Schema with fromJsonSchema().");if(!_c)_c=!0,console.warn("[mcp-sdk] Your zod version does not implement `~standard.jsonSchema` (added in zod 4.2.0). Falling back to z.toJSONSchema(). Upgrade to zod >=4.2.0 to silence this warning.");f=ne(m,{target:ui,io:h})}else throw Error(`Schema library "${p.vendor}" does not implement StandardJSONSchemaV1 (\`~standard.jsonSchema\`). Upgrade to a version that does, or wrap your JSON Schema with fromJsonSchema().`);if(h==="output"){if(f.type!==void 0)return f;return Bc(f)?{type:"object",...f}:f}if(f.type!==void 0&&f.type!=="object")throw Error(`MCP tool and prompt schemas must describe objects (got type: ${JSON.stringify(f.type)}). Wrap your schema in z.object({...}) or equivalent.`);return{type:"object",...f}}var Zu=/^#\/(\$defs|definitions)\/([^/~%]+)$/;function Bc(m,h=m){if("properties"in m||"patternProperties"in m||"additionalProperties"in m||"required"in m)return!0;let p=typeof m.$ref==="string"&&Zu.exec(m.$ref);if(p&&h[p[1]]?.[p[2]]?.type==="object")return!0;for(let f of["oneOf","anyOf","allOf"]){let g=m[f];if(Array.isArray(g)&&g.length>0)return g.every((S)=>S!==null&&typeof S==="object"&&(S.type==="object"||Bc(S,"$id"in S?{}:h)))}return!1}function Xu(m){if(!m.path?.length)return m.message;return`${m.path.map((h)=>String(typeof h==="object"?h.key:h)).join(".")}: ${m.message}`}async function tr(m,h){let p=await m["~standard"].validate(h);if(p.issues&&p.issues.length>0)return{success:!1,error:p.issues.map((f)=>Xu(f)).join(", ")};return{success:!0,data:p.value}}function Qu(m){let h=ne(m,{target:ui,io:"input"});return typeof h.pattern==="string"?h.pattern:void 0}var ed=/\\\.\\d\{(\d+)\}/;function td(m){let h=ed.exec(m),p=[void 0,-1,0];if(h)p.push(Number(h[1]));return[!1,!0].flatMap((f)=>[!1,!0].flatMap((g)=>p.map((S)=>uo({local:f,offset:g,precision:S}))))}function rd(m,h){let p;switch(m){case"email":p=[ue()];break;case"uri":p=[Y()];break;case"date":p=[ou()];break;case"date-time":p=td(h);break}return new Set(p.map((f)=>Qu(f)).filter((f)=>f!==void 0))}function sd(m,h,p){if(p!=="zod")return!0;return rd(m,h).has(h)}function Jc(m){let h=ar(m,"input"),p=h.properties||{},f=h.required||[];return Object.entries(p).map(([g,S])=>({name:g,description:S?.description,required:f.includes(g)}))}function Us(m){return typeof m==="object"&&m!==null&&!Array.isArray(m)}function od(m){try{return ar(m,"input")}catch(h){let p=h instanceof Error?h.message:String(h);throw new Ee(be.InvalidParams,`Elicitation requestedSchema must describe an object with flat primitive properties: ${p}`)}}var ad=new Set(["$comment","deprecated","description","examples","readOnly","title","writeOnly"]);function Ei(m){return ad.has(m)||m.startsWith("x-")}var nd=new Set(["$schema",...Object.keys(Pr.shape.requestedSchema.shape)]),bc={string:As([Er,Is,qs,Os]),number:As([Tr]),integer:As([Tr]),boolean:As([Cs]),array:As([js,Ns])},id=new Set(Er.shape.format.unwrap().options);function cd(m,h,p,f){if(!Us(m))return m;let g=typeof m.type==="string"&&Object.hasOwn(bc,m.type)?bc[m.type]:void 0;if(g===void 0)return m;let S={};for(let[y,z]of Object.entries(m))if(g.has(y)||Ei(y))S[y]=z;else if(y==="pattern"&&m.type==="string"&&typeof m.format==="string"){if(!id.has(m.format))S[y]=z;else if(typeof z!=="string"||!sd(m.format,z,p))f.push(`${h}.${y}`)}else f.push(`${h}.${y}`);return S}function ld(m,h){let p={},f=[];for(let[g,S]of Object.entries(m))if(g==="properties"&&Us(S))p[g]=Object.fromEntries(Object.entries(S).map(([y,z])=>[y,cd(z,`properties.${y}`,h,f)]));else if(nd.has(g))p[g]=S;else if(!Ei(g))f.push(g);if(f.length>0)throw new Ee(be.InvalidParams,`Elicitation requestedSchema contains unsupported JSON Schema constraint(s) after Standard Schema conversion: ${f.join(", ")}`);return p}function ud(m,h){if(!Us(m.properties))return h;let p=Object.entries(m.properties).filter(([,f])=>!gn(ks,f).success).map(([f])=>`properties.${f}`);return p.length>0?p.join(", "):h}function di(m,h,p=""){if(Array.isArray(m)&&Array.isArray(h))return m.flatMap((f,g)=>di(f,h[g],`${p}[${g}]`));if(!Us(m)||!Us(h))return[];return Object.entries(m).flatMap(([f,g])=>{let S=p?`${p}.${f}`:f;if(!Object.prototype.hasOwnProperty.call(h,f))return Ei(f)?[]:[S];return di(g,h[f],S)})}function dd(m){if(!qr(m.requestedSchema))return{...m,mode:"form",requestedSchema:m.requestedSchema};let h=m.requestedSchema["~standard"].vendor,p=ld(od(m.requestedSchema),h),f=gn(Pr.shape.requestedSchema,p);if(!f.success)throw new Ee(be.InvalidParams,`Elicitation requestedSchema only supports flat primitive properties (string, number, integer, boolean, and string enums): ${ud(p,f.error.message)}`);let g=di(p,f.data);if(g.length>0)throw new Ee(be.InvalidParams,`Elicitation requestedSchema contains unsupported JSON Schema constraint(s) after Standard Schema conversion: ${g.join(", ")}`);let S=(f.data.required??[]).filter((y)=>!Object.prototype.hasOwnProperty.call(f.data.properties,y));if(S.length>0)throw new Ee(be.InvalidParams,`Elicitation requestedSchema lists required properties that are not defined in properties: ${S.join(", ")}`);return{...m,mode:"form",requestedSchema:f.data}}function md(m){let h=m.inputRequests!==void 0&&Object.keys(m.inputRequests).length>0,p=typeof m.requestState==="string";if(!h&&!p)throw TypeError("inputRequired() requires at least one of inputRequests (with at least one entry) or requestState (spec: every InputRequiredResult MUST include at least one of the two)");return{resultType:"input_required",...m.inputRequests!==void 0&&{inputRequests:m.inputRequests},...m.requestState!==void 0&&{requestState:m.requestState}}}var hd=Object.assign(md,{elicit(m){try{return{method:"elicitation/create",params:dd(m)}}catch(h){throw h instanceof Ee?TypeError(h.message,{cause:h}):h}},elicitUrl(m){return{method:"elicitation/create",params:{...m,mode:"url"}}},createMessage(m){return{method:"sampling/createMessage",params:m}},listRoots(){return{method:"roots/list"}}});var Kc=250;function Gc(m,h){return`Multi-round-trip request '${m}' still required input after ${h} rounds (inputRequired.maxRounds)`}function Wc(m,h){return new Promise((p,f)=>{if(h?.aborted){f(h.reason instanceof Pe?h.reason:new Pe(Oe.RequestTimeout,String(h.reason)));return}let g=setTimeout(()=>{h?.removeEventListener("abort",S),p()},m),S=()=>{clearTimeout(g),f(h?.reason instanceof Pe?h.reason:new Pe(Oe.RequestTimeout,String(h?.reason)))};h?.addEventListener("abort",S,{once:!0})})}function Yc(m){let h=new AbortController,p=()=>h.abort(m?.reason);if(m?.addEventListener("abort",p,{once:!0}),m?.aborted)h.abort(m.reason);return{signal:h.signal,abort:(f)=>h.abort(f),dispose:()=>m?.removeEventListener("abort",p)}}var pd=["AnnotationsSchema","AudioContentSchema","BaseMetadataSchema","BlobResourceContentsSchema","BooleanSchemaSchema","CallToolRequestSchema","CallToolRequestParamsSchema","CallToolResultSchema","CancelledNotificationSchema","CancelledNotificationParamsSchema","CancelTaskRequestSchema","CancelTaskResultSchema","ClientCapabilitiesSchema","ClientNotificationSchema","ClientRequestSchema","ClientResultSchema","CompatibilityCallToolResultSchema","CompleteRequestSchema","CompleteRequestParamsSchema","CompleteResultSchema","ContentBlockSchema","CreateMessageRequestSchema","CreateMessageRequestParamsSchema","CreateMessageResultSchema","CreateMessageResultWithToolsSchema","CreateTaskResultSchema","CursorSchema","DiscoverRequestSchema","DiscoverResultSchema","ElicitationCompleteNotificationSchema","ElicitationCompleteNotificationParamsSchema","ElicitRequestSchema","ElicitRequestFormParamsSchema","ElicitRequestParamsSchema","ElicitRequestURLParamsSchema","ElicitResultSchema","EmbeddedResourceSchema","EmptyResultSchema","EnumSchemaSchema","GetPromptRequestSchema","GetPromptRequestParamsSchema","GetPromptResultSchema","GetTaskPayloadRequestSchema","GetTaskPayloadResultSchema","GetTaskRequestSchema","GetTaskResultSchema","IconSchema","IconsSchema","ImageContentSchema","ImplementationSchema","InitializedNotificationSchema","InitializeRequestSchema","InitializeRequestParamsSchema","InitializeResultSchema","JSONArraySchema","JSONObjectSchema","JSONRPCErrorResponseSchema","JSONRPCMessageSchema","JSONRPCNotificationSchema","JSONRPCRequestSchema","JSONRPCResponseSchema","JSONRPCResultResponseSchema","JSONValueSchema","LegacyTitledEnumSchemaSchema","ListPromptsRequestSchema","ListPromptsResultSchema","ListResourcesRequestSchema","ListResourcesResultSchema","ListResourceTemplatesRequestSchema","ListResourceTemplatesResultSchema","ListRootsRequestSchema","ListRootsResultSchema","ListTasksRequestSchema","ListTasksResultSchema","ListToolsRequestSchema","ListToolsResultSchema","LoggingLevelSchema","LoggingMessageNotificationSchema","LoggingMessageNotificationParamsSchema","ModelHintSchema","ModelPreferencesSchema","MultiSelectEnumSchemaSchema","NotificationSchema","NumberSchemaSchema","PaginatedRequestSchema","PaginatedRequestParamsSchema","PaginatedResultSchema","PingRequestSchema","PrimitiveSchemaDefinitionSchema","ProgressSchema","ProgressNotificationSchema","ProgressNotificationParamsSchema","ProgressTokenSchema","PromptSchema","PromptArgumentSchema","PromptListChangedNotificationSchema","PromptMessageSchema","PromptReferenceSchema","ReadResourceRequestSchema","ReadResourceRequestParamsSchema","ReadResourceResultSchema","RelatedTaskMetadataSchema","RequestSchema","RequestIdSchema","RequestMetaSchema","ResourceSchema","ResourceContentsSchema","ResourceLinkSchema","ResourceListChangedNotificationSchema","ResourceRequestParamsSchema","ResourceTemplateSchema","ResourceTemplateReferenceSchema","ResourceUpdatedNotificationSchema","ResourceUpdatedNotificationParamsSchema","ResultMetaObjectSchema","ResultSchema","RoleSchema","RootSchema","RootsListChangedNotificationSchema","SamplingContentSchema","SamplingMessageSchema","SamplingMessageContentBlockSchema","ServerCapabilitiesSchema","ServerNotificationSchema","ServerRequestSchema","ServerResultSchema","SetLevelRequestSchema","SetLevelRequestParamsSchema","SingleSelectEnumSchemaSchema","StringSchemaSchema","SubscribeRequestSchema","SubscribeRequestParamsSchema","SubscriptionFilterSchema","SubscriptionsAcknowledgedNotificationSchema","SubscriptionsAcknowledgedNotificationParamsSchema","SubscriptionsListenRequestSchema","SubscriptionsListenRequestParamsSchema","SubscriptionsListenResultSchema","SubscriptionsListenResultMetaSchema","TaskAugmentedRequestParamsSchema","TaskCreationParamsSchema","TaskMetadataSchema","TaskSchema","TaskStatusSchema","TaskStatusNotificationSchema","TaskStatusNotificationParamsSchema","TextContentSchema","TextResourceContentsSchema","TitledMultiSelectEnumSchemaSchema","TitledSingleSelectEnumSchemaSchema","ToolSchema","ToolAnnotationsSchema","ToolChoiceSchema","ToolExecutionSchema","ToolListChangedNotificationSchema","ToolResultContentSchema","ToolUseContentSchema","UnsubscribeRequestSchema","UnsubscribeRequestParamsSchema","UntitledMultiSelectEnumSchemaSchema","UntitledSingleSelectEnumSchemaSchema"],fd={IdJagTokenExchangeResponseSchema:ei,OAuthClientInformationFullSchema:ri,OAuthClientInformationSchema:Qa,OAuthClientMetadataSchema:Xa,OAuthClientRegistrationErrorSchema:si,OAuthErrorResponseSchema:ti,OAuthMetadataSchema:Ya,OAuthProtectedResourceMetadataSchema:Zn,OAuthTokenRevocationRequestSchema:oi,OAuthTokensSchema:Qn,OpenIdProviderDiscoveryMetadataSchema:Xn,OpenIdProviderMetadataSchema:Za},Zc={},Xc={};function Qc(m,h){let p=m.slice(0,-6);Zc[p]=h,Xc[p]=(f)=>h.safeParse(f).success}for(let m of pd)Qc(m,Ju[m]);for(let[m,h]of Object.entries(fd))Qc(m,h);var gd=Object.freeze(Zc),Sd=Object.freeze(Xc);function yd(m){switch(m){case"initialize":case"notifications/initialized":return Rt(void 0);case"server/discover":return Rt(Vs);default:return}}var el=60000,vd=[vt,Sr,_t,It],_d=["inputResponses","requestState"];function Rc(m,h){let p=m.params;if(!Ds(p))return{message:m,lifted:{}};let f=p._meta,g=Ds(f)?vd.filter((v)=>(v in f)):[],S=h==="request"?_d.filter((v)=>(v in p)):[];if(g.length===0&&S.length===0)return{message:m,lifted:{}};let y={},z={...p};if(g.length>0&&Ds(f)){let v={},T={...f};for(let O of g)v[O]=f[O],delete T[O];if(y.envelope=v,Object.keys(T).length>0)z._meta=T;else delete z._meta}for(let v of S){if(v==="inputResponses")y.inputResponses=z[v];if(v==="requestState")y.requestState=z[v];delete z[v]}return{message:{...m,params:z},lifted:y}}function zc(m,h){let p=m.validateResult(h,void 0);if(!p.ok&&p.reason==="not-in-era")return;return{"~standard":{version:1,vendor:"mcp-wire-codec",validate(f){let g=m.validateResult(h,f);if(g.ok)return{value:g.value};return{issues:[{message:g.reason==="invalid"?g.message:`not-in-era: ${h}`}]}}}}}function Hs(m){return()=>m}var bd=Hs(void 0);function Ti(m,h){return{...m,mcpReq:{...m.mcpReq,requestState:Hs(h)}}}var tl;function Pi(m,h){tl(m,h)}var Ci=class{_transport;_requestMessageId=0;_requestHandlers=new Map;_customSchemaRequestMethods=new Set;_requestHandlerAbortControllers=new Map;_notificationHandlers=new Map;_responseHandlers=new Map;_progressHandlers=new Map;_timeoutInfo=new Map;_pendingDebouncedNotifications=new Set;_negotiatedProtocolVersion;static{tl=(m,h)=>{m._negotiatedProtocolVersion=h}}_supportedProtocolVersions;onclose;onerror;fallbackRequestHandler;fallbackNotificationHandler;constructor(m){this._options=m,this._supportedProtocolVersions=m?.supportedProtocolVersions??mo,this.setNotificationHandler("notifications/cancelled",(h)=>{this._oncancel(h)}),this.setNotificationHandler("notifications/progress",(h)=>{this._onprogress(h)}),this.setRequestHandler("ping",(h)=>({}))}_shouldDropInbound(m){}_outboundMetaEnvelope(){}_envelopeOutbound(m){let h=this._outboundMetaEnvelope();if(h===void 0)return m;let p=m.params??{};return{...m,params:{...p,_meta:{...h,...p._meta}}}}_resolveNonCompleteResult(m,h){return Promise.reject(new Pe(Oe.UnsupportedResultType,`Unsupported result type '${m.kind}' for ${h.request.method}`,{resultType:m.kind,method:h.request.method}))}_getRequestHandler(m){return this._requestHandlers.get(m)}async _oncancel(m){if(m.params.requestId===void 0)return;this._requestHandlerAbortControllers.get(m.params.requestId)?.abort(m.params.reason)}_setupTimeout(m,h,p,f,g=!1){this._timeoutInfo.set(m,{timeoutId:setTimeout(f,h),startTime:Date.now(),timeout:h,maxTotalTimeout:p,resetTimeoutOnProgress:g,onTimeout:f})}_resetTimeout(m){let h=this._timeoutInfo.get(m);if(!h)return!1;let p=Date.now()-h.startTime;if(h.maxTotalTimeout&&p>=h.maxTotalTimeout)throw this._timeoutInfo.delete(m),new Pe(Oe.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:h.maxTotalTimeout,totalElapsed:p});return clearTimeout(h.timeoutId),h.timeoutId=setTimeout(h.onTimeout,h.timeout),!0}_cleanupTimeout(m){let h=this._timeoutInfo.get(m);if(h)clearTimeout(h.timeoutId),this._timeoutInfo.delete(m)}async connect(m){this._transport=m;let h=this.transport?.onclose;this._transport.onclose=()=>{try{h?.()}finally{this._onclose()}};let p=this.transport?.onerror;this._transport.onerror=(g)=>{p?.(g),this._onerror(g)};let f=this._transport?.onmessage;this._transport.onmessage=(g,S)=>{if(f?.(g,S),rr(g)||or(g))this._onresponse(g);else if(ot(g))this._onrequest(g,S);else if(Dt(g))this._onnotification(g,S);else this._onerror(Error(`Unknown message type: ${JSON.stringify(g)}`))},m.setSupportedProtocolVersions?.(this._supportedProtocolVersions),await this._transport.start()}_onclose(){let m=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._pendingDebouncedNotifications.clear();for(let f of this._timeoutInfo.values())clearTimeout(f.timeoutId);this._timeoutInfo.clear();let h=this._requestHandlerAbortControllers;this._requestHandlerAbortControllers=new Map;let p=new Pe(Oe.ConnectionClosed,"Connection closed");this._transport=void 0;try{this.onclose?.()}finally{for(let f of m.values())f(p);for(let f of h.values())f.abort(p)}}_onerror(m){this.onerror?.(m)}_onnotification(m,h){let{message:p}=Rc(m,"notification"),f=this._negotiatedWireCodec();if(h?.classification===void 0&&this._shouldDropInbound(m)==="drop")return;if(h?.classification!==void 0){let y=gc(h.classification);if(y!==f.era){this._onerror(Error(`Era mismatch on inbound notification '${p.method}': classified as ${y} but this instance serves ${f.era}`));return}}if(ii(p.method)&&!f.hasNotificationMethod(p.method))return;let g=this._notificationHandlers.get(p.method),S=this.fallbackNotificationHandler;if(g===void 0&&S===void 0)return;Promise.resolve().then(()=>g===void 0?S(p):g(p,f)).catch((y)=>this._onerror(Error(`Uncaught error in notification handler: ${y}`)))}_onrequest(m,h){let{message:p,lifted:f}=Rc(m,"request"),g=this._negotiatedWireCodec();if(h?.classification===void 0&&this._shouldDropInbound(m)==="drop"){this._onerror(Error(`Dropped inbound request '${m.method}': not servable on this connection's protocol era`));return}let S=this._transport,y=(B,x,q)=>{let Z={jsonrpc:"2.0",id:p.id,error:{code:B,message:x,...q!==void 0&&{data:q}}};S?.send(Z).catch((L)=>this._onerror(Error(`Failed to send an error response: ${L}`)))};if(h?.classification!==void 0){let B=gc(h.classification);if(B!==g.era){this._onerror(Error(`Era mismatch on inbound request '${p.method}': classified as ${B} but this instance serves ${g.era}`));let x=h.classification.revision??B;y(be.UnsupportedProtocolVersion,`Unsupported protocol version: ${x}`,{supported:this._supportedProtocolVersions,requested:x});return}}if(ni(p.method)&&!g.hasRequestMethod(p.method)&&!(Sc(p.method)&&this._customSchemaRequestMethods.has(p.method))){y(be.MethodNotFound,"Method not found");return}let z=this._requestHandlers.get(p.method)??this.fallbackRequestHandler;if(z===void 0){y(be.MethodNotFound,"Method not found");return}let v=g.checkInboundEnvelope(f);if(v!==void 0){y(be.InvalidParams,v);return}let T=(B,x)=>this._notificationViaCodec(this._resolveOutboundCodec(B.method),B,{...x,relatedRequestId:p.id}),O=(B,x,q)=>this._requestWithSchemaViaCodec(this._resolveOutboundCodec(B.method),B,x,{...q,relatedRequestId:p.id}),C=new AbortController;this._requestHandlerAbortControllers.set(p.id,C);let U=f.inputResponses===void 0?void 0:Rd(f.inputResponses),F={sessionId:S?.sessionId,mcpReq:{id:p.id,method:p.method,_meta:p.params?._meta,...f.envelope!==void 0&&{envelope:f.envelope},...U!==void 0&&{inputResponses:U.accepted},...U!==void 0&&U.droppedKeys.length>0&&{droppedInputResponseKeys:U.droppedKeys},requestState:f.requestState===void 0?bd:Hs(f.requestState),signal:C.signal,send:(B,x,q)=>{let Z=this._resolveOutboundCodec(B.method);if(this._assertOutboundRequestInEra(Z,B.method),qr(x))return O(B,x,q);let L=zc(Z,B.method);if(L===void 0)throw TypeError(`'${B.method}' is not a spec method; pass a result schema as the second argument to ctx.mcpReq.send().`);return O(B,L,x)},notify:T},http:h?.authInfo?{authInfo:h.authInfo}:void 0},V=this.buildContext(F,h);Promise.resolve().then(()=>z(p,V)).then(async(B)=>{if(C.signal.aborted)return;let x;try{x=g.encodeResult(p.method,B,this._outboundServerInfo())}catch(Z){this._onerror(Error(`Failed to encode result for ${p.method}: ${Z}`)),y(be.InternalError,"Internal error");return}let q={result:x,jsonrpc:"2.0",id:p.id};await S?.send(q)},async(B)=>{if(C.signal.aborted)return;let x=Number.isSafeInteger(B.code)?B.code:be.InternalError,q={jsonrpc:"2.0",id:p.id,error:{code:g.encodeErrorCode(x),message:B.message??"Internal error",...B.data!==void 0&&{data:B.data}}};await S?.send(q)}).catch((B)=>this._onerror(Error(`Failed to send response: ${B}`))).finally(()=>{if(this._requestHandlerAbortControllers.get(p.id)===C)this._requestHandlerAbortControllers.delete(p.id)})}_onprogress(m){let{progressToken:h,...p}=m.params,f=Number(h),g=this._progressHandlers.get(f);if(!g){this._onerror(Error(`Received a progress notification for an unknown token: ${JSON.stringify(m)}`));return}let S=this._responseHandlers.get(f),y=this._timeoutInfo.get(f);if(y&&S&&y.resetTimeoutOnProgress)try{this._resetTimeout(f)}catch(z){this._responseHandlers.delete(f),this._progressHandlers.delete(f),this._cleanupTimeout(f),S(z);return}g(p)}_onresponse(m){let h=Number(m.id),p=this._responseHandlers.get(h);if(p===void 0){this._onerror(Error(`Received a response for an unknown message ID: ${JSON.stringify(m)}`));return}if(this._responseHandlers.delete(h),this._cleanupTimeout(h),this._progressHandlers.delete(h),rr(m))p(m);else p(Ee.fromError(m.error.code,m.error.message,m.error.data))}get transport(){return this._transport}async close(){await this._transport?.close()}request(m,h,p){let f=this._resolveOutboundCodec(m.method);if(qr(h)){if(!Sc(m.method))this._assertOutboundRequestInEra(f,m.method);return this._requestWithSchemaViaCodec(f,m,h,p)}this._assertOutboundRequestInEra(f,m.method);let g=zc(f,m.method);if(g===void 0)throw TypeError(`'${m.method}' is not a spec method; pass a result schema as the second argument to request().`);return this._requestWithSchemaViaCodec(f,m,g,h)}_negotiatedWireCodec(){return Rt(this._negotiatedProtocolVersion)}_wireCodec(){return this._negotiatedWireCodec()}_resolveOutboundCodec(m){if(this._negotiatedProtocolVersion===void 0){let h=yd(m);if(h)return h}return this._negotiatedWireCodec()}_assertOutboundRequestInEra(m,h){if(ni(h)&&!m.hasRequestMethod(h))throw new Pe(Oe.MethodNotSupportedByProtocolVersion,`Method '${h}' is not supported by the negotiated protocol version (wire era ${m.era})`,{method:h,era:m.era})}_requestWithSchema(m,h,p){let f=this._resolveOutboundCodec(m.method);return this._assertOutboundRequestInEra(f,m.method),this._requestWithSchemaViaCodec(f,m,h,p)}_requestWithSchemaViaCodec(m,h,p,f){let{relatedRequestId:g,resumptionToken:S,onresumptiontoken:y,headers:z}=f??{},v=Date.now(),T,O;return new Promise((C,U)=>{let F=(H)=>{U(H)};if(!this._transport){F(Error("Not connected"));return}if(this._options?.enforceStrictCapabilities===!0)try{this.assertCapabilityForMethod(h.method)}catch(H){F(H);return}if(f?.signal?.aborted){let H=f.signal.reason;throw H instanceof Pe?H:new Pe(Oe.RequestTimeout,String(H))}let V=m.era===Vs&&this._transport.hasPerRequestStream===!0?new AbortController:void 0,B=this._requestMessageId++;O=B;let x={...h,jsonrpc:"2.0",id:B};if(f?.onprogress)this._progressHandlers.set(B,f.onprogress),x.params={...h.params,_meta:{...h.params?._meta,progressToken:B}};let q=this._envelopeOutbound(x),Z=!1,L=(H)=>{if(Z)return;if(this._progressHandlers.delete(B),V===void 0){if(h.method!=="initialize")this._transport?.send(this._envelopeOutbound({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:B,reason:String(H)}}),{relatedRequestId:g,resumptionToken:S,onresumptiontoken:y}).catch((k)=>this._onerror(Error(`Failed to send cancellation: ${k}`)))}else V.abort();U(H instanceof Pe?H:new Pe(Oe.RequestTimeout,String(H)))};this._responseHandlers.set(B,(H)=>{if(f?.signal?.aborted)return;if(Z=!0,H instanceof Error)return U(H);let k;try{k=m.decodeResult(h.method,H.result)}catch(se){return U(se instanceof Error?se:Error(String(se)))}if(k.kind==="invalid")return U(k.error);if(k.kind==="input_required"){if(f?.allowInputRequired===!0)return C(zd(k));let se={codec:m,request:h,resultSchema:p,options:f,flowStartedAt:v,retry:(pe,ie)=>this._requestWithSchemaViaCodec(m,pe===void 0?{method:h.method}:{method:h.method,params:pe},p,ie)};return C(this._resolveNonCompleteResult(k,se))}let D=k.result;tr(p,D).then((se)=>{if(se.success)C(se.data);else U(new Pe(Oe.InvalidResult,`Invalid result for ${h.method}: ${se.error}`))},U)}),T=()=>L(f?.signal?.reason),f?.signal?.addEventListener("abort",T,{once:!0});let K=f?.timeout??el,ae=()=>L(new Pe(Oe.RequestTimeout,"Request timed out",{timeout:K}));this._setupTimeout(B,K,f?.maxTotalTimeout,ae,f?.resetTimeoutOnProgress??!1),this._transport.send(q,{relatedRequestId:g,resumptionToken:S,onresumptiontoken:y,headers:z,requestSignal:V?.signal}).catch((H)=>{this._progressHandlers.delete(B),U(H)})}).finally(()=>{if(T)f?.signal?.removeEventListener("abort",T);if(O!==void 0)this._responseHandlers.delete(O),this._cleanupTimeout(O)})}async notification(m,h){return await this._notificationViaCodec(this._resolveOutboundCodec(m.method),m,h)}async _notificationViaCodec(m,h,p){if(!this._transport)throw new Pe(Oe.NotConnected,"Not connected");if(ii(h.method)&&!m.hasNotificationMethod(h.method))throw new Pe(Oe.MethodNotSupportedByProtocolVersion,`Notification '${h.method}' is not supported by the negotiated protocol version (wire era ${m.era})`,{method:h.method,era:m.era});this.assertNotificationCapability(h.method);let f=this._envelopeOutbound({jsonrpc:"2.0",...h});if((this._options?.debouncedNotificationMethods??[]).includes(h.method)&&!h.params&&p?.relatedRequestId===void 0){if(this._pendingDebouncedNotifications.has(h.method))return;this._pendingDebouncedNotifications.add(h.method),Promise.resolve().then(()=>{if(this._pendingDebouncedNotifications.delete(h.method),!this._transport)return;this._transport?.send(f,p).catch((g)=>this._onerror(g))});return}await this._transport.send(f,p)}setRequestHandler(m,h,p){this.assertRequestHandlerCapability(m);let f;if(typeof h==="function"){if(!ni(m))throw TypeError(`'${m}' is not a spec request method; pass schemas as the second argument to setRequestHandler().`);f=(g,S)=>{let y=this._negotiatedWireCodec(),z=y.validateRequest(m,g);if(!z.ok&&z.reason==="not-in-era")z=y.validateInputRequest(m,g);if(!z.ok){if(z.reason==="not-in-era")throw new Ee(be.InternalError,`No wire schema for ${m} in the resolved era`);throw Error(z.message)}return Promise.resolve(h(z.value,S))}}else if(p)f=async(g,S)=>{let y=await tr(h.params,{...g.params});if(!y.success)throw new Ee(be.InvalidParams,`Invalid params for ${m}: ${y.error}`);return p(y.data,S)};else throw TypeError("setRequestHandler: handler is required");if(typeof h==="function")this._customSchemaRequestMethods.delete(m);else this._customSchemaRequestMethods.add(m);this._requestHandlers.set(m,this._wrapHandler(m,f))}_wrapHandler(m,h){return h}_outboundServerInfo(){}removeRequestHandler(m){this._requestHandlers.delete(m),this._customSchemaRequestMethods.delete(m)}assertCanSetRequestHandler(m){if(this._requestHandlers.has(m))throw Error(`A request handler for ${m} already exists, which would be overridden`)}setNotificationHandler(m,h,p){if(typeof h==="function"){if(!ii(m))throw TypeError(`'${m}' is not a spec notification method; pass schemas as the second argument to setNotificationHandler().`);this._notificationHandlers.set(m,(f,g)=>{let S=g.validateNotification(m,f);if(!S.ok){if(S.reason==="not-in-era")throw new Ee(be.InternalError,`No wire schema for ${m} in the resolved era`);throw Error(S.message)}return Promise.resolve(h(S.value))});return}if(!p)throw TypeError("setNotificationHandler: handler is required");this._notificationHandlers.set(m,async(f)=>{let g=await tr(h.params,{...f.params});if(!g.success)throw new Ee(be.InvalidParams,`Invalid params for notification ${m}: ${g.error}`);await p(g.data,f)})}removeNotificationHandler(m){this._notificationHandlers.delete(m)}};function Ds(m){return m!==null&&typeof m==="object"&&!Array.isArray(m)}function Ii(m,h){let p={...m};for(let f in h){let g=f,S=h[g];if(S===void 0)continue;let y=p[g];p[g]=Ds(y)&&Ds(S)?{...y,...S}:S}return p}function wc(m){return typeof m==="object"&&m!==null&&!Array.isArray(m)}function Rd(m){let h={},p=[];if(!wc(m))return{accepted:h,droppedKeys:p};for(let[f,g]of Object.entries(m)){if(!wc(g)||"method"in g||"result"in g){p.push(f);continue}h[f]=g}return{accepted:h,droppedKeys:p}}function zd(m){return{resultType:"input_required",inputRequests:m.inputRequests,...m.requestState!==void 0&&{requestState:m.requestState},...m._meta!==void 0&&{_meta:m._meta}}}/*!
|
|
2
|
+
* content-type
|
|
3
|
+
* Copyright(c) 2015 Douglas Christopher Wilson
|
|
4
|
+
* MIT Licensed
|
|
5
|
+
*/var wd=ye((m)=>{var h=/; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g,p=/\\([\u000b\u0020-\u00ff])/g,f=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;m.parse=g;function g(z){if(!z)throw TypeError("argument string is required");var v=typeof z==="object"?S(z):z;if(typeof v!=="string")throw TypeError("argument string is required to be a string");var T=v.indexOf(";"),O=T!==-1?v.slice(0,T).trim():v.trim();if(!f.test(O))throw TypeError("invalid media type");var C=new y(O.toLowerCase());if(T!==-1){var U,F,V;h.lastIndex=T;while(F=h.exec(v)){if(F.index!==T)throw TypeError("invalid parameter format");if(T+=F[0].length,U=F[1].toLowerCase(),V=F[2],V.charCodeAt(0)===34){if(V=V.slice(1,-1),V.indexOf("\\")!==-1)V=V.replace(p,"$1")}C.parameters[U]=V}if(T!==v.length)throw TypeError("invalid parameter format")}return C}function S(z){var v;if(typeof z.getHeader==="function")v=z.getHeader("content-type");else if(typeof z.headers==="object")v=z.headers&&z.headers["content-type"];if(typeof v!=="string")throw TypeError("content-type header is missing from object");return v}function y(z){this.parameters=Object.create(null),this.type=z}}),sp=lo(wd(),1);var rl=10485760,qi=class{_buffer;_maxBufferSize;constructor(m){this._maxBufferSize=m?.maxBufferSize??rl}append(m){if((this._buffer?.length??0)+m.length>this._maxBufferSize)throw this.clear(),Error(`ReadBuffer exceeded maximum size of ${this._maxBufferSize} bytes`);this._buffer=this._buffer?Buffer.concat([this._buffer,m]):m}readMessage(){while(this._buffer){let m=this._buffer.indexOf(`
|
|
6
|
+
`);if(m===-1)return null;let h=this._buffer.toString("utf8",0,m).replace(/\r$/,"");this._buffer=this._buffer.subarray(m+1);try{return sl(h)}catch(p){if(p instanceof SyntaxError)continue;throw p}}return null}clear(){this._buffer=void 0}};function sl(m){return gs.parse(JSON.parse(m))}function Oi(m){return JSON.stringify(m)+`
|
|
7
|
+
`}var $d=/^[A-Za-z0-9._-]{1,128}$/;function Ed(m){let h=[];if(m.length===0)return{isValid:!1,warnings:["Tool name cannot be empty"]};if(m.length>128)return{isValid:!1,warnings:[`Tool name exceeds maximum length of 128 characters (current: ${m.length})`]};if(m.includes(" "))h.push("Tool name contains spaces, which may cause parsing issues");if(m.includes(","))h.push("Tool name contains commas, which may cause parsing issues");if(m.startsWith("-")||m.endsWith("-"))h.push("Tool name starts or ends with a dash, which may cause parsing issues in some contexts");if(m.startsWith(".")||m.endsWith("."))h.push("Tool name starts or ends with a dot, which may cause parsing issues in some contexts");if(!$d.test(m)){let p=[...m].filter((f)=>!/[A-Za-z0-9._-]/.test(f)).filter((f,g,S)=>S.indexOf(f)===g);return h.push(`Tool name contains invalid characters: ${p.map((f)=>`"${f}"`).join(", ")}`,"Allowed characters are: A-Z, a-z, 0-9, underscore (_), dash (-), and dot (.)"),{isValid:!1,warnings:h}}return{isValid:!0,warnings:h}}function Td(m,h){if(h.length>0){console.warn(`Tool name validation warning for "${m}":`);for(let p of h)console.warn(` - ${p}`);console.warn("Tool registration will proceed, but this may cause compatibility issues."),console.warn("Consider updating the tool name to conform to the MCP tool naming standard."),console.warn("See SEP: Specify Format for Tool Names (https://github.com/modelcontextprotocol/modelcontextprotocol/issues/986) for more details.")}}function ji(m){let h=Ed(m);return Td(m,h.warnings),h.isValid}function Pd(m){return typeof m==="object"&&m!==null&&"_zod"in m}function Cd(m){return typeof m==="object"&&m!==null&&!("_zod"in m)&&"_def"in m&&typeof m._def?.typeName==="string"}function Id(m){if(typeof m!=="object"||m===null)return!1;if(qr(m))return!1;let h=Object.getPrototypeOf(m);if(h!==Object.prototype&&h!==null)return!1;return Object.values(m).every((p)=>Pd(p))}function Sn(m){if(m===void 0)return;if(Id(m))return t(m);if(typeof m==="object"&&m!==null&&!qr(m)&&Object.values(m).some((h)=>Cd(h)))throw TypeError("Raw-shape inputSchema/outputSchema/argsSchema fields must be Zod v4 schemas. Got a Zod v3 field schema. Import from `zod/v4` (or upgrade your zod import), or wrap with `z.object({...})` yourself.");if(!qr(m))throw TypeError("inputSchema/outputSchema/argsSchema must be a Standard Schema (e.g. z.object({...})) or a raw Zod shape ({ field: z.string() }).");return m}var yn=ye((m)=>{Object.defineProperty(m,"__esModule",{value:!0}),m.regexpCode=m.getEsmExportName=m.getProperty=m.safeStringify=m.stringify=m.strConcat=m.addCodeArg=m.str=m._=m.nil=m._Code=m.Name=m.IDENTIFIER=m._CodeOrName=void 0;var h=class{};m._CodeOrName=h,m.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;var p=class extends h{constructor(q){super();if(!m.IDENTIFIER.test(q))throw Error("CodeGen: name must be a valid identifier");this.str=q}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}};m.Name=p;var f=class extends h{constructor(q){super();this._items=typeof q==="string"?[q]:q}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let q=this._items[0];return q===""||q==='""'}get str(){var q;return(q=this._str)!==null&&q!==void 0?q:this._str=this._items.reduce((Z,L)=>`${Z}${L}`,"")}get names(){var q;return(q=this._names)!==null&&q!==void 0?q:this._names=this._items.reduce((Z,L)=>{if(L instanceof p)Z[L.str]=(Z[L.str]||0)+1;return Z},{})}};m._Code=f,m.nil=new f("");function g(q,...Z){let L=[q[0]],K=0;while(K<Z.length)z(L,Z[K]),L.push(q[++K]);return new f(L)}m._=g;let S=new f("+");function y(q,...Z){let L=[F(q[0])],K=0;while(K<Z.length)L.push(S),z(L,Z[K]),L.push(S,F(q[++K]));return v(L),new f(L)}m.str=y;function z(q,Z){if(Z instanceof f)q.push(...Z._items);else if(Z instanceof p)q.push(Z);else q.push(C(Z))}m.addCodeArg=z;function v(q){let Z=1;while(Z<q.length-1){if(q[Z]===S){let L=T(q[Z-1],q[Z+1]);if(L!==void 0){q.splice(Z-1,3,L);continue}q[Z++]="+"}Z++}}function T(q,Z){if(Z==='""')return q;if(q==='""')return Z;if(typeof q=="string"){if(Z instanceof p||q[q.length-1]!=='"')return;if(typeof Z!="string")return`${q.slice(0,-1)}${Z}"`;if(Z[0]==='"')return q.slice(0,-1)+Z.slice(1);return}if(typeof Z=="string"&&Z[0]==='"'&&!(q instanceof p))return`"${q}${Z.slice(1)}`}function O(q,Z){return Z.emptyStr()?q:q.emptyStr()?Z:y`${q}${Z}`}m.strConcat=O;function C(q){return typeof q=="number"||typeof q=="boolean"||q===null?q:F(Array.isArray(q)?q.join(","):q)}function U(q){return new f(F(q))}m.stringify=U;function F(q){return JSON.stringify(q).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}m.safeStringify=F;function V(q){return typeof q=="string"&&m.IDENTIFIER.test(q)?new f(`.${q}`):g`[${q}]`}m.getProperty=V;function B(q){if(typeof q=="string"&&m.IDENTIFIER.test(q))return new f(`${q}`);throw Error(`CodeGen: invalid export name: ${q}, use explicit $id name mapping`)}m.getEsmExportName=B;function x(q){return new f(q.toString())}m.regexpCode=x}),ol=ye((m)=>{Object.defineProperty(m,"__esModule",{value:!0}),m.ValueScope=m.ValueScopeName=m.Scope=m.varKinds=m.UsedValueState=void 0;let h=yn();var p=class extends Error{constructor(v){super(`CodeGen: "code" for ${v} not defined`);this.value=v.value}},f;(function(v){v[v.Started=0]="Started",v[v.Completed=1]="Completed"})(f||(m.UsedValueState=f={})),m.varKinds={const:new h.Name("const"),let:new h.Name("let"),var:new h.Name("var")};var g=class{constructor({prefixes:v,parent:T}={}){this._names={},this._prefixes=v,this._parent=T}toName(v){return v instanceof h.Name?v:this.name(v)}name(v){return new h.Name(this._newName(v))}_newName(v){let T=this._names[v]||this._nameGroup(v);return`${v}${T.index++}`}_nameGroup(v){var T,O;if(((O=(T=this._parent)===null||T===void 0?void 0:T._prefixes)===null||O===void 0?void 0:O.has(v))||this._prefixes&&!this._prefixes.has(v))throw Error(`CodeGen: prefix "${v}" is not allowed in this scope`);return this._names[v]={prefix:v,index:0}}};m.Scope=g;var S=class extends h.Name{constructor(v,T){super(T);this.prefix=v}setValue(v,{property:T,itemIndex:O}){this.value=v,this.scopePath=h._`.${new h.Name(T)}[${O}]`}};m.ValueScopeName=S;let y=h._`\n`;var z=class extends g{constructor(v){super(v);this._values={},this._scope=v.scope,this.opts={...v,_n:v.lines?y:h.nil}}get(){return this._scope}name(v){return new S(v,this._newName(v))}value(v,T){var O;if(T.ref===void 0)throw Error("CodeGen: ref must be passed in value");let C=this.toName(v),{prefix:U}=C,F=(O=T.key)!==null&&O!==void 0?O:T.ref,V=this._values[U];if(V){let q=V.get(F);if(q)return q}else V=this._values[U]=new Map;V.set(F,C);let B=this._scope[U]||(this._scope[U]=[]),x=B.length;return B[x]=T.ref,C.setValue(T,{property:U,itemIndex:x}),C}getValue(v,T){let O=this._values[v];if(!O)return;return O.get(T)}scopeRefs(v,T=this._values){return this._reduceValues(T,(O)=>{if(O.scopePath===void 0)throw Error(`CodeGen: name "${O}" has no value`);return h._`${v}${O.scopePath}`})}scopeCode(v=this._values,T,O){return this._reduceValues(v,(C)=>{if(C.value===void 0)throw Error(`CodeGen: name "${C}" has no value`);return C.value.code},T,O)}_reduceValues(v,T,O={},C){let U=h.nil;for(let F in v){let V=v[F];if(!V)continue;let B=O[F]=O[F]||new Map;V.forEach((x)=>{if(B.has(x))return;B.set(x,f.Started);let q=T(x);if(q){let Z=this.opts.es5?m.varKinds.var:m.varKinds.const;U=h._`${U}${Z} ${x} = ${q};${this.opts._n}`}else if(q=C===null||C===void 0?void 0:C(x))U=h._`${U}${q}${this.opts._n}`;else throw new p(x);B.set(x,f.Completed)})}return U}};m.ValueScope=z}),qe=ye((m)=>{Object.defineProperty(m,"__esModule",{value:!0}),m.or=m.and=m.not=m.CodeGen=m.operators=m.varKinds=m.ValueScopeName=m.ValueScope=m.Scope=m.Name=m.regexpCode=m.stringify=m.getProperty=m.nil=m.strConcat=m.str=m._=void 0;let h=yn(),p=ol();var f=yn();Object.defineProperty(m,"_",{enumerable:!0,get:function(){return f._}}),Object.defineProperty(m,"str",{enumerable:!0,get:function(){return f.str}}),Object.defineProperty(m,"strConcat",{enumerable:!0,get:function(){return f.strConcat}}),Object.defineProperty(m,"nil",{enumerable:!0,get:function(){return f.nil}}),Object.defineProperty(m,"getProperty",{enumerable:!0,get:function(){return f.getProperty}}),Object.defineProperty(m,"stringify",{enumerable:!0,get:function(){return f.stringify}}),Object.defineProperty(m,"regexpCode",{enumerable:!0,get:function(){return f.regexpCode}}),Object.defineProperty(m,"Name",{enumerable:!0,get:function(){return f.Name}});var g=ol();Object.defineProperty(m,"Scope",{enumerable:!0,get:function(){return g.Scope}}),Object.defineProperty(m,"ValueScope",{enumerable:!0,get:function(){return g.ValueScope}}),Object.defineProperty(m,"ValueScopeName",{enumerable:!0,get:function(){return g.ValueScopeName}}),Object.defineProperty(m,"varKinds",{enumerable:!0,get:function(){return g.varKinds}}),m.operators={GT:new h._Code(">"),GTE:new h._Code(">="),LT:new h._Code("<"),LTE:new h._Code("<="),EQ:new h._Code("==="),NEQ:new h._Code("!=="),NOT:new h._Code("!"),OR:new h._Code("||"),AND:new h._Code("&&"),ADD:new h._Code("+")};var S=class{optimizeNodes(){return this}optimizeNames(b,E){return this}},y=class extends S{constructor(b,E,A){super();this.varKind=b,this.name=E,this.rhs=A}render({es5:b,_n:E}){let A=b?p.varKinds.var:this.varKind,ee=this.rhs===void 0?"":` = ${this.rhs}`;return`${A} ${this.name}${ee};`+E}optimizeNames(b,E){if(!b[this.name.str])return;if(this.rhs)this.rhs=ze(this.rhs,b,E);return this}get names(){return this.rhs instanceof h._CodeOrName?this.rhs.names:{}}},z=class extends S{constructor(b,E,A){super();this.lhs=b,this.rhs=E,this.sideEffects=A}render({_n:b}){return`${this.lhs} = ${this.rhs};`+b}optimizeNames(b,E){if(this.lhs instanceof h.Name&&!b[this.lhs.str]&&!this.sideEffects)return;return this.rhs=ze(this.rhs,b,E),this}get names(){return Re(this.lhs instanceof h.Name?{}:{...this.lhs.names},this.rhs)}},v=class extends z{constructor(b,E,A,ee){super(b,A,ee);this.op=E}render({_n:b}){return`${this.lhs} ${this.op}= ${this.rhs};`+b}},T=class extends S{constructor(b){super();this.label=b,this.names={}}render({_n:b}){return`${this.label}:`+b}},O=class extends S{constructor(b){super();this.label=b,this.names={}}render({_n:b}){return`break${this.label?` ${this.label}`:""};`+b}},C=class extends S{constructor(b){super();this.error=b}render({_n:b}){return`throw ${this.error};`+b}get names(){return this.error.names}},U=class extends S{constructor(b){super();this.code=b}render({_n:b}){return`${this.code};`+b}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(b,E){return this.code=ze(this.code,b,E),this}get names(){return this.code instanceof h._CodeOrName?this.code.names:{}}},F=class extends S{constructor(b=[]){super();this.nodes=b}render(b){return this.nodes.reduce((E,A)=>E+A.render(b),"")}optimizeNodes(){let{nodes:b}=this,E=b.length;while(E--){let A=b[E].optimizeNodes();if(Array.isArray(A))b.splice(E,1,...A);else if(A)b[E]=A;else b.splice(E,1)}return b.length>0?this:void 0}optimizeNames(b,E){let{nodes:A}=this,ee=A.length;while(ee--){let ge=A[ee];if(ge.optimizeNames(b,E))continue;Ce(b,ge.names),A.splice(ee,1)}return A.length>0?this:void 0}get names(){return this.nodes.reduce((b,E)=>fe(b,E.names),{})}},V=class extends F{render(b){return"{"+b._n+super.render(b)+"}"+b._n}},B=class extends F{},x=class extends V{};x.kind="else";var q=class b extends V{constructor(E,A){super(A);this.condition=E}render(E){let A=`if(${this.condition})`+super.render(E);if(this.else)A+="else "+this.else.render(E);return A}optimizeNodes(){super.optimizeNodes();let E=this.condition;if(E===!0)return this.nodes;let A=this.else;if(A){let ee=A.optimizeNodes();A=this.else=Array.isArray(ee)?new x(ee):ee}if(A){if(E===!1)return A instanceof b?A:A.nodes;if(this.nodes.length)return this;return new b(Ae(E),A instanceof b?[A]:A.nodes)}if(E===!1||!this.nodes.length)return;return this}optimizeNames(E,A){var ee;if(this.else=(ee=this.else)===null||ee===void 0?void 0:ee.optimizeNames(E,A),!(super.optimizeNames(E,A)||this.else))return;return this.condition=ze(this.condition,E,A),this}get names(){let E=super.names;if(Re(E,this.condition),this.else)fe(E,this.else.names);return E}};q.kind="if";var Z=class extends V{};Z.kind="for";var L=class extends Z{constructor(b){super();this.iteration=b}render(b){return`for(${this.iteration})`+super.render(b)}optimizeNames(b,E){if(!super.optimizeNames(b,E))return;return this.iteration=ze(this.iteration,b,E),this}get names(){return fe(super.names,this.iteration.names)}},K=class extends Z{constructor(b,E,A,ee){super();this.varKind=b,this.name=E,this.from=A,this.to=ee}render(b){let E=b.es5?p.varKinds.var:this.varKind,{name:A,from:ee,to:ge}=this;return`for(${E} ${A}=${ee}; ${A}<${ge}; ${A}++)`+super.render(b)}get names(){return Re(Re(super.names,this.from),this.to)}},ae=class extends Z{constructor(b,E,A,ee){super();this.loop=b,this.varKind=E,this.name=A,this.iterable=ee}render(b){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(b)}optimizeNames(b,E){if(!super.optimizeNames(b,E))return;return this.iterable=ze(this.iterable,b,E),this}get names(){return fe(super.names,this.iterable.names)}},H=class extends V{constructor(b,E,A){super();this.name=b,this.args=E,this.async=A}render(b){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(b)}};H.kind="func";var k=class extends F{render(b){return"return "+super.render(b)}};k.kind="return";var D=class extends V{render(b){let E="try"+super.render(b);if(this.catch)E+=this.catch.render(b);if(this.finally)E+=this.finally.render(b);return E}optimizeNodes(){var b,E;return super.optimizeNodes(),(b=this.catch)===null||b===void 0||b.optimizeNodes(),(E=this.finally)===null||E===void 0||E.optimizeNodes(),this}optimizeNames(b,E){var A,ee;return super.optimizeNames(b,E),(A=this.catch)===null||A===void 0||A.optimizeNames(b,E),(ee=this.finally)===null||ee===void 0||ee.optimizeNames(b,E),this}get names(){let b=super.names;if(this.catch)fe(b,this.catch.names);if(this.finally)fe(b,this.finally.names);return b}},se=class extends V{constructor(b){super();this.error=b}render(b){return`catch(${this.error})`+super.render(b)}};se.kind="catch";var pe=class extends V{render(b){return"finally"+super.render(b)}};pe.kind="finally";var ie=class{constructor(b,E={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...E,_n:E.lines?`
|
|
8
|
+
`:""},this._extScope=b,this._scope=new p.Scope({parent:b}),this._nodes=[new B]}toString(){return this._root.render(this.opts)}name(b){return this._scope.name(b)}scopeName(b){return this._extScope.name(b)}scopeValue(b,E){let A=this._extScope.value(b,E);return(this._values[A.prefix]||(this._values[A.prefix]=new Set)).add(A),A}getScopeValue(b,E){return this._extScope.getValue(b,E)}scopeRefs(b){return this._extScope.scopeRefs(b,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(b,E,A,ee){let ge=this._scope.toName(E);if(A!==void 0&&ee)this._constants[ge.str]=A;return this._leafNode(new y(b,ge,A)),ge}const(b,E,A){return this._def(p.varKinds.const,b,E,A)}let(b,E,A){return this._def(p.varKinds.let,b,E,A)}var(b,E,A){return this._def(p.varKinds.var,b,E,A)}assign(b,E,A){return this._leafNode(new z(b,E,A))}add(b,E){return this._leafNode(new v(b,m.operators.ADD,E))}code(b){if(typeof b=="function")b();else if(b!==h.nil)this._leafNode(new U(b));return this}object(...b){let E=["{"];for(let[A,ee]of b){if(E.length>1)E.push(",");if(E.push(A),A!==ee||this.opts.es5)E.push(":"),(0,h.addCodeArg)(E,ee)}return E.push("}"),new h._Code(E)}if(b,E,A){if(this._blockNode(new q(b)),E&&A)this.code(E).else().code(A).endIf();else if(E)this.code(E).endIf();else if(A)throw Error('CodeGen: "else" body without "then" body');return this}elseIf(b){return this._elseNode(new q(b))}else(){return this._elseNode(new x)}endIf(){return this._endBlockNode(q,x)}_for(b,E){if(this._blockNode(b),E)this.code(E).endFor();return this}for(b,E){return this._for(new L(b),E)}forRange(b,E,A,ee,ge=this.opts.es5?p.varKinds.var:p.varKinds.let){let _e=this._scope.toName(b);return this._for(new K(ge,_e,E,A),()=>ee(_e))}forOf(b,E,A,ee=p.varKinds.const){let ge=this._scope.toName(b);if(this.opts.es5){let _e=E instanceof h.Name?E:this.var("_arr",E);return this.forRange("_i",0,h._`${_e}.length`,(ve)=>{this.var(ge,h._`${_e}[${ve}]`),A(ge)})}return this._for(new ae("of",ee,ge,E),()=>A(ge))}forIn(b,E,A,ee=this.opts.es5?p.varKinds.var:p.varKinds.const){if(this.opts.ownProperties)return this.forOf(b,h._`Object.keys(${E})`,A);let ge=this._scope.toName(b);return this._for(new ae("in",ee,ge,E),()=>A(ge))}endFor(){return this._endBlockNode(Z)}label(b){return this._leafNode(new T(b))}break(b){return this._leafNode(new O(b))}return(b){let E=new k;if(this._blockNode(E),this.code(b),E.nodes.length!==1)throw Error('CodeGen: "return" should have one node');return this._endBlockNode(k)}try(b,E,A){if(!E&&!A)throw Error('CodeGen: "try" without "catch" and "finally"');let ee=new D;if(this._blockNode(ee),this.code(b),E){let ge=this.name("e");this._currNode=ee.catch=new se(ge),E(ge)}if(A)this._currNode=ee.finally=new pe,this.code(A);return this._endBlockNode(se,pe)}throw(b){return this._leafNode(new C(b))}block(b,E){if(this._blockStarts.push(this._nodes.length),b)this.code(b).endBlock(E);return this}endBlock(b){let E=this._blockStarts.pop();if(E===void 0)throw Error("CodeGen: not in self-balancing block");let A=this._nodes.length-E;if(A<0||b!==void 0&&A!==b)throw Error(`CodeGen: wrong number of nodes: ${A} vs ${b} expected`);return this._nodes.length=E,this}func(b,E=h.nil,A,ee){if(this._blockNode(new H(b,E,A)),ee)this.code(ee).endFunc();return this}endFunc(){return this._endBlockNode(H)}optimize(b=1){while(b-- >0)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(b){return this._currNode.nodes.push(b),this}_blockNode(b){this._currNode.nodes.push(b),this._nodes.push(b)}_endBlockNode(b,E){let A=this._currNode;if(A instanceof b||E&&A instanceof E)return this._nodes.pop(),this;throw Error(`CodeGen: not in block "${E?`${b.kind}/${E.kind}`:b.kind}"`)}_elseNode(b){let E=this._currNode;if(!(E instanceof q))throw Error('CodeGen: "else" without "if"');return this._currNode=E.else=b,this}get _root(){return this._nodes[0]}get _currNode(){let b=this._nodes;return b[b.length-1]}set _currNode(b){let E=this._nodes;E[E.length-1]=b}};m.CodeGen=ie;function fe(b,E){for(let A in E)b[A]=(b[A]||0)+(E[A]||0);return b}function Re(b,E){return E instanceof h._CodeOrName?fe(b,E.names):b}function ze(b,E,A){if(b instanceof h.Name)return ee(b);if(!ge(b))return b;return new h._Code(b._items.reduce((_e,ve)=>{if(ve instanceof h.Name)ve=ee(ve);if(ve instanceof h._Code)_e.push(...ve._items);else _e.push(ve);return _e},[]));function ee(_e){let ve=A[_e.str];if(ve===void 0||E[_e.str]!==1)return _e;return delete E[_e.str],ve}function ge(_e){return _e instanceof h._Code&&_e._items.some((ve)=>ve instanceof h.Name&&E[ve.str]===1&&A[ve.str]!==void 0)}}function Ce(b,E){for(let A in E)b[A]=(b[A]||0)-(E[A]||0)}function Ae(b){return typeof b=="boolean"||typeof b=="number"||b===null?!b:h._`!${M(b)}`}m.not=Ae;let Me=me(m.operators.AND);function Ue(...b){return b.reduce(Me)}m.and=Ue;let je=me(m.operators.OR);function te(...b){return b.reduce(je)}m.or=te;function me(b){return(E,A)=>E===h.nil?A:A===h.nil?E:h._`${M(E)} ${b} ${M(A)}`}function M(b){return b instanceof h.Name?b:h._`(${b})`}}),ke=ye((m)=>{Object.defineProperty(m,"__esModule",{value:!0}),m.checkStrictMode=m.getErrorPath=m.Type=m.useFunc=m.setEvaluated=m.evaluatedPropsToName=m.mergeEvaluated=m.eachItem=m.unescapeJsonPointer=m.escapeJsonPointer=m.escapeFragment=m.unescapeFragment=m.schemaRefOrVal=m.schemaHasRulesButRef=m.schemaHasRules=m.checkUnknownRules=m.alwaysValidSchema=m.toHash=void 0;let h=qe(),p=yn();function f(H){let k={};for(let D of H)k[D]=!0;return k}m.toHash=f;function g(H,k){if(typeof k=="boolean")return k;if(Object.keys(k).length===0)return!0;return S(H,k),!y(k,H.self.RULES.all)}m.alwaysValidSchema=g;function S(H,k=H.schema){let{opts:D,self:se}=H;if(!D.strictSchema)return;if(typeof k==="boolean")return;let pe=se.RULES.keywords;for(let ie in k)if(!pe[ie])ae(H,`unknown keyword: "${ie}"`)}m.checkUnknownRules=S;function y(H,k){if(typeof H=="boolean")return!H;for(let D in H)if(k[D])return!0;return!1}m.schemaHasRules=y;function z(H,k){if(typeof H=="boolean")return!H;for(let D in H)if(D!=="$ref"&&k.all[D])return!0;return!1}m.schemaHasRulesButRef=z;function v({topSchemaRef:H,schemaPath:k},D,se,pe){if(!pe){if(typeof D=="number"||typeof D=="boolean")return D;if(typeof D=="string")return h._`${D}`}return h._`${H}${k}${(0,h.getProperty)(se)}`}m.schemaRefOrVal=v;function T(H){return U(decodeURIComponent(H))}m.unescapeFragment=T;function O(H){return encodeURIComponent(C(H))}m.escapeFragment=O;function C(H){if(typeof H=="number")return`${H}`;return H.replace(/~/g,"~0").replace(/\//g,"~1")}m.escapeJsonPointer=C;function U(H){return H.replace(/~1/g,"/").replace(/~0/g,"~")}m.unescapeJsonPointer=U;function F(H,k){if(Array.isArray(H))for(let D of H)k(D);else k(H)}m.eachItem=F;function V({mergeNames:H,mergeToName:k,mergeValues:D,resultToName:se}){return(pe,ie,fe,Re)=>{let ze=fe===void 0?ie:fe instanceof h.Name?(ie instanceof h.Name?H(pe,ie,fe):k(pe,ie,fe),fe):ie instanceof h.Name?(k(pe,fe,ie),ie):D(ie,fe);return Re===h.Name&&!(ze instanceof h.Name)?se(pe,ze):ze}}m.mergeEvaluated={props:V({mergeNames:(H,k,D)=>H.if(h._`${D} !== true && ${k} !== undefined`,()=>{H.if(h._`${k} === true`,()=>H.assign(D,!0),()=>H.assign(D,h._`${D} || {}`).code(h._`Object.assign(${D}, ${k})`))}),mergeToName:(H,k,D)=>H.if(h._`${D} !== true`,()=>{if(k===!0)H.assign(D,!0);else H.assign(D,h._`${D} || {}`),x(H,D,k)}),mergeValues:(H,k)=>H===!0?!0:{...H,...k},resultToName:B}),items:V({mergeNames:(H,k,D)=>H.if(h._`${D} !== true && ${k} !== undefined`,()=>H.assign(D,h._`${k} === true ? true : ${D} > ${k} ? ${D} : ${k}`)),mergeToName:(H,k,D)=>H.if(h._`${D} !== true`,()=>H.assign(D,k===!0?!0:h._`${D} > ${k} ? ${D} : ${k}`)),mergeValues:(H,k)=>H===!0?!0:Math.max(H,k),resultToName:(H,k)=>H.var("items",k)})};function B(H,k){if(k===!0)return H.var("props",!0);let D=H.var("props",h._`{}`);if(k!==void 0)x(H,D,k);return D}m.evaluatedPropsToName=B;function x(H,k,D){Object.keys(D).forEach((se)=>H.assign(h._`${k}${(0,h.getProperty)(se)}`,!0))}m.setEvaluated=x;let q={};function Z(H,k){return H.scopeValue("func",{ref:k,code:q[k.code]||(q[k.code]=new p._Code(k.code))})}m.useFunc=Z;var L;(function(H){H[H.Num=0]="Num",H[H.Str=1]="Str"})(L||(m.Type=L={}));function K(H,k,D){if(H instanceof h.Name){let se=k===L.Num;return D?se?h._`"[" + ${H} + "]"`:h._`"['" + ${H} + "']"`:se?h._`"/" + ${H}`:h._`"/" + ${H}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return D?(0,h.getProperty)(H).toString():"/"+C(H)}m.getErrorPath=K;function ae(H,k,D=H.opts.strictSchema){if(!D)return;if(k=`strict mode: ${k}`,D===!0)throw Error(k);H.self.logger.warn(k)}m.checkStrictMode=ae}),dt=ye((m)=>{Object.defineProperty(m,"__esModule",{value:!0});let h=qe(),p={data:new h.Name("data"),valCxt:new h.Name("valCxt"),instancePath:new h.Name("instancePath"),parentData:new h.Name("parentData"),parentDataProperty:new h.Name("parentDataProperty"),rootData:new h.Name("rootData"),dynamicAnchors:new h.Name("dynamicAnchors"),vErrors:new h.Name("vErrors"),errors:new h.Name("errors"),this:new h.Name("this"),self:new h.Name("self"),scope:new h.Name("scope"),json:new h.Name("json"),jsonPos:new h.Name("jsonPos"),jsonLen:new h.Name("jsonLen"),jsonPart:new h.Name("jsonPart")};m.default=p}),_n=ye((m)=>{Object.defineProperty(m,"__esModule",{value:!0}),m.extendErrors=m.resetErrorsCount=m.reportExtraError=m.reportError=m.keyword$DataError=m.keywordError=void 0;let h=qe(),p=ke(),f=dt();m.keywordError={message:({keyword:x})=>h.str`must pass "${x}" keyword validation`},m.keyword$DataError={message:({keyword:x,schemaType:q})=>q?h.str`"${x}" keyword must be ${q} ($data)`:h.str`"${x}" keyword is invalid ($data)`};function g(x,q=m.keywordError,Z,L){let{it:K}=x,{gen:ae,compositeRule:H,allErrors:k}=K,D=C(x,q,Z);if(L!==null&&L!==void 0?L:H||k)v(ae,D);else T(K,h._`[${D}]`)}m.reportError=g;function S(x,q=m.keywordError,Z){let{it:L}=x,{gen:K,compositeRule:ae,allErrors:H}=L;if(v(K,C(x,q,Z)),!(ae||H))T(L,f.default.vErrors)}m.reportExtraError=S;function y(x,q){x.assign(f.default.errors,q),x.if(h._`${f.default.vErrors} !== null`,()=>x.if(q,()=>x.assign(h._`${f.default.vErrors}.length`,q),()=>x.assign(f.default.vErrors,null)))}m.resetErrorsCount=y;function z({gen:x,keyword:q,schemaValue:Z,data:L,errsCount:K,it:ae}){if(K===void 0)throw Error("ajv implementation error");let H=x.name("err");x.forRange("i",K,f.default.errors,(k)=>{if(x.const(H,h._`${f.default.vErrors}[${k}]`),x.if(h._`${H}.instancePath === undefined`,()=>x.assign(h._`${H}.instancePath`,(0,h.strConcat)(f.default.instancePath,ae.errorPath))),x.assign(h._`${H}.schemaPath`,h.str`${ae.errSchemaPath}/${q}`),ae.opts.verbose)x.assign(h._`${H}.schema`,Z),x.assign(h._`${H}.data`,L)})}m.extendErrors=z;function v(x,q){let Z=x.const("err",q);x.if(h._`${f.default.vErrors} === null`,()=>x.assign(f.default.vErrors,h._`[${Z}]`),h._`${f.default.vErrors}.push(${Z})`),x.code(h._`${f.default.errors}++`)}function T(x,q){let{gen:Z,validateName:L,schemaEnv:K}=x;if(K.$async)Z.throw(h._`new ${x.ValidationError}(${q})`);else Z.assign(h._`${L}.errors`,q),Z.return(!1)}let O={keyword:new h.Name("keyword"),schemaPath:new h.Name("schemaPath"),params:new h.Name("params"),propertyName:new h.Name("propertyName"),message:new h.Name("message"),schema:new h.Name("schema"),parentSchema:new h.Name("parentSchema")};function C(x,q,Z){let{createErrors:L}=x.it;if(L===!1)return h._`{}`;return U(x,q,Z)}function U(x,q,Z={}){let{gen:L,it:K}=x,ae=[F(K,Z),V(x,Z)];return B(x,q,ae),L.object(...ae)}function F({errorPath:x},{instancePath:q}){let Z=q?h.str`${x}${(0,p.getErrorPath)(q,p.Type.Str)}`:x;return[f.default.instancePath,(0,h.strConcat)(f.default.instancePath,Z)]}function V({keyword:x,it:{errSchemaPath:q}},{schemaPath:Z,parentSchema:L}){let K=L?q:h.str`${q}/${x}`;if(Z)K=h.str`${K}${(0,p.getErrorPath)(Z,p.Type.Str)}`;return[O.schemaPath,K]}function B(x,{params:q,message:Z},L){let{keyword:K,data:ae,schemaValue:H,it:k}=x,{opts:D,propertyName:se,topSchemaRef:pe,schemaPath:ie}=k;if(L.push([O.keyword,K],[O.params,typeof q=="function"?q(x):q||h._`{}`]),D.messages)L.push([O.message,typeof Z=="function"?Z(x):Z]);if(D.verbose)L.push([O.schema,H],[O.parentSchema,h._`${pe}${ie}`],[f.default.data,ae]);if(se)L.push([O.propertyName,se])}}),qd=ye((m)=>{Object.defineProperty(m,"__esModule",{value:!0}),m.boolOrEmptySchema=m.topBoolOrEmptySchema=void 0;let h=_n(),p=qe(),f=dt(),g={message:"boolean schema is false"};function S(v){let{gen:T,schema:O,validateName:C}=v;if(O===!1)z(v,!1);else if(typeof O=="object"&&O.$async===!0)T.return(f.default.data);else T.assign(p._`${C}.errors`,null),T.return(!0)}m.topBoolOrEmptySchema=S;function y(v,T){let{gen:O,schema:C}=v;if(C===!1)O.var(T,!1),z(v);else O.var(T,!0)}m.boolOrEmptySchema=y;function z(v,T){let{gen:O,data:C}=v,U={gen:O,keyword:"false schema",data:C,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:v};(0,h.reportError)(U,g,void 0,T)}}),al=ye((m)=>{Object.defineProperty(m,"__esModule",{value:!0}),m.getRules=m.isJSONType=void 0;let h=new Set(["string","number","integer","boolean","null","object","array"]);function p(g){return typeof g=="string"&&h.has(g)}m.isJSONType=p;function f(){let g={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...g,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},g.number,g.string,g.array,g.object],post:{rules:[]},all:{},keywords:{}}}m.getRules=f}),nl=ye((m)=>{Object.defineProperty(m,"__esModule",{value:!0}),m.shouldUseRule=m.shouldUseGroup=m.schemaHasRulesForType=void 0;function h({schema:g,self:S},y){let z=S.RULES.types[y];return z&&z!==!0&&p(g,z)}m.schemaHasRulesForType=h;function p(g,S){return S.rules.some((y)=>f(g,y))}m.shouldUseGroup=p;function f(g,S){var y;return g[S.keyword]!==void 0||((y=S.definition.implements)===null||y===void 0?void 0:y.some((z)=>g[z]!==void 0))}m.shouldUseRule=f}),vn=ye((m)=>{Object.defineProperty(m,"__esModule",{value:!0}),m.reportTypeError=m.checkDataTypes=m.checkDataType=m.coerceAndCheckDataType=m.getJSONTypes=m.getSchemaTypes=m.DataType=void 0;let h=al(),p=nl(),f=_n(),g=qe(),S=ke();var y;(function(L){L[L.Correct=0]="Correct",L[L.Wrong=1]="Wrong"})(y||(m.DataType=y={}));function z(L){let K=v(L.type);if(K.includes("null")){if(L.nullable===!1)throw Error("type: null contradicts nullable: false")}else{if(!K.length&&L.nullable!==void 0)throw Error('"nullable" cannot be used without "type"');if(L.nullable===!0)K.push("null")}return K}m.getSchemaTypes=z;function v(L){let K=Array.isArray(L)?L:L?[L]:[];if(K.every(h.isJSONType))return K;throw Error("type must be JSONType or JSONType[]: "+K.join(","))}m.getJSONTypes=v;function T(L,K){let{gen:ae,data:H,opts:k}=L,D=C(K,k.coerceTypes),se=K.length>0&&!(D.length===0&&K.length===1&&(0,p.schemaHasRulesForType)(L,K[0]));if(se){let pe=B(K,H,k.strictNumbers,y.Wrong);ae.if(pe,()=>{if(D.length)U(L,K,D);else q(L)})}return se}m.coerceAndCheckDataType=T;let O=new Set(["string","number","integer","boolean","null"]);function C(L,K){return K?L.filter((ae)=>O.has(ae)||K==="array"&&ae==="array"):[]}function U(L,K,ae){let{gen:H,data:k,opts:D}=L,se=H.let("dataType",g._`typeof ${k}`),pe=H.let("coerced",g._`undefined`);if(D.coerceTypes==="array")H.if(g._`${se} == 'object' && Array.isArray(${k}) && ${k}.length == 1`,()=>H.assign(k,g._`${k}[0]`).assign(se,g._`typeof ${k}`).if(B(K,k,D.strictNumbers),()=>H.assign(pe,k)));H.if(g._`${pe} !== undefined`);for(let fe of ae)if(O.has(fe)||fe==="array"&&D.coerceTypes==="array")ie(fe);H.else(),q(L),H.endIf(),H.if(g._`${pe} !== undefined`,()=>{H.assign(k,pe),F(L,pe)});function ie(fe){switch(fe){case"string":H.elseIf(g._`${se} == "number" || ${se} == "boolean"`).assign(pe,g._`"" + ${k}`).elseIf(g._`${k} === null`).assign(pe,g._`""`);return;case"number":H.elseIf(g._`${se} == "boolean" || ${k} === null
|
|
9
|
+
|| (${se} == "string" && ${k} && ${k} == +${k})`).assign(pe,g._`+${k}`);return;case"integer":H.elseIf(g._`${se} === "boolean" || ${k} === null
|
|
10
|
+
|| (${se} === "string" && ${k} && ${k} == +${k} && !(${k} % 1))`).assign(pe,g._`+${k}`);return;case"boolean":H.elseIf(g._`${k} === "false" || ${k} === 0 || ${k} === null`).assign(pe,!1).elseIf(g._`${k} === "true" || ${k} === 1`).assign(pe,!0);return;case"null":H.elseIf(g._`${k} === "" || ${k} === 0 || ${k} === false`),H.assign(pe,null);return;case"array":H.elseIf(g._`${se} === "string" || ${se} === "number"
|
|
11
|
+
|| ${se} === "boolean" || ${k} === null`).assign(pe,g._`[${k}]`)}}}function F({gen:L,parentData:K,parentDataProperty:ae},H){L.if(g._`${K} !== undefined`,()=>L.assign(g._`${K}[${ae}]`,H))}function V(L,K,ae,H=y.Correct){let k=H===y.Correct?g.operators.EQ:g.operators.NEQ,D;switch(L){case"null":return g._`${K} ${k} null`;case"array":D=g._`Array.isArray(${K})`;break;case"object":D=g._`${K} && typeof ${K} == "object" && !Array.isArray(${K})`;break;case"integer":D=se(g._`!(${K} % 1) && !isNaN(${K})`);break;case"number":D=se();break;default:return g._`typeof ${K} ${k} ${L}`}return H===y.Correct?D:(0,g.not)(D);function se(pe=g.nil){return(0,g.and)(g._`typeof ${K} == "number"`,pe,ae?g._`isFinite(${K})`:g.nil)}}m.checkDataType=V;function B(L,K,ae,H){if(L.length===1)return V(L[0],K,ae,H);let k,D=(0,S.toHash)(L);if(D.array&&D.object){let se=g._`typeof ${K} != "object"`;k=D.null?se:g._`!${K} || ${se}`,delete D.null,delete D.array,delete D.object}else k=g.nil;if(D.number)delete D.integer;for(let se in D)k=(0,g.and)(k,V(se,K,ae,H));return k}m.checkDataTypes=B;let x={message:({schema:L})=>`must be ${L}`,params:({schema:L,schemaValue:K})=>typeof L=="string"?g._`{type: ${L}}`:g._`{type: ${K}}`};function q(L){let K=Z(L);(0,f.reportError)(K,x)}m.reportTypeError=q;function Z(L){let{gen:K,data:ae,schema:H}=L,k=(0,S.schemaRefOrVal)(L,H,"type");return{gen:K,keyword:"type",data:ae,schema:H.type,schemaCode:k,schemaValue:k,parentSchema:H,params:{},it:L}}}),Od=ye((m)=>{Object.defineProperty(m,"__esModule",{value:!0}),m.assignDefaults=void 0;let h=qe(),p=ke();function f(S,y){let{properties:z,items:v}=S.schema;if(y==="object"&&z)for(let T in z)g(S,T,z[T].default);else if(y==="array"&&Array.isArray(v))v.forEach((T,O)=>g(S,O,T.default))}m.assignDefaults=f;function g(S,y,z){let{gen:v,compositeRule:T,data:O,opts:C}=S;if(z===void 0)return;let U=h._`${O}${(0,h.getProperty)(y)}`;if(T){(0,p.checkStrictMode)(S,`default is ignored for: ${U}`);return}let F=h._`${U} === undefined`;if(C.useDefaults==="empty")F=h._`${F} || ${U} === null || ${U} === ""`;v.if(F,h._`${U} = ${(0,h.stringify)(z)}`)}}),mt=ye((m)=>{Object.defineProperty(m,"__esModule",{value:!0}),m.validateUnion=m.validateArray=m.usePattern=m.callValidateCode=m.schemaProperties=m.allSchemaProperties=m.noPropertyInData=m.propertyInData=m.isOwnProperty=m.hasPropFunc=m.reportMissingProp=m.checkMissingProp=m.checkReportMissingProp=void 0;let h=qe(),p=ke(),f=dt(),g=ke();function S(L,K){let{gen:ae,data:H,it:k}=L;ae.if(C(ae,H,K,k.opts.ownProperties),()=>{L.setParams({missingProperty:h._`${K}`},!0),L.error()})}m.checkReportMissingProp=S;function y({gen:L,data:K,it:{opts:ae}},H,k){return(0,h.or)(...H.map((D)=>(0,h.and)(C(L,K,D,ae.ownProperties),h._`${k} = ${D}`)))}m.checkMissingProp=y;function z(L,K){L.setParams({missingProperty:K},!0),L.error()}m.reportMissingProp=z;function v(L){return L.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:h._`Object.prototype.hasOwnProperty`})}m.hasPropFunc=v;function T(L,K,ae){return h._`${v(L)}.call(${K}, ${ae})`}m.isOwnProperty=T;function O(L,K,ae,H){let k=h._`${K}${(0,h.getProperty)(ae)} !== undefined`;return H?h._`${k} && ${T(L,K,ae)}`:k}m.propertyInData=O;function C(L,K,ae,H){let k=h._`${K}${(0,h.getProperty)(ae)} === undefined`;return H?(0,h.or)(k,(0,h.not)(T(L,K,ae))):k}m.noPropertyInData=C;function U(L){return L?Object.keys(L).filter((K)=>K!=="__proto__"):[]}m.allSchemaProperties=U;function F(L,K){return U(K).filter((ae)=>!(0,p.alwaysValidSchema)(L,K[ae]))}m.schemaProperties=F;function V({schemaCode:L,data:K,it:{gen:ae,topSchemaRef:H,schemaPath:k,errorPath:D},it:se},pe,ie,fe){let Re=fe?h._`${L}, ${K}, ${H}${k}`:K,ze=[[f.default.instancePath,(0,h.strConcat)(f.default.instancePath,D)],[f.default.parentData,se.parentData],[f.default.parentDataProperty,se.parentDataProperty],[f.default.rootData,f.default.rootData]];if(se.opts.dynamicRef)ze.push([f.default.dynamicAnchors,f.default.dynamicAnchors]);let Ce=h._`${Re}, ${ae.object(...ze)}`;return ie!==h.nil?h._`${pe}.call(${ie}, ${Ce})`:h._`${pe}(${Ce})`}m.callValidateCode=V;let B=h._`new RegExp`;function x({gen:L,it:{opts:K}},ae){let H=K.unicodeRegExp?"u":"",{regExp:k}=K.code,D=k(ae,H);return L.scopeValue("pattern",{key:D.toString(),ref:D,code:h._`${k.code==="new RegExp"?B:(0,g.useFunc)(L,k)}(${ae}, ${H})`})}m.usePattern=x;function q(L){let{gen:K,data:ae,keyword:H,it:k}=L,D=K.name("valid");if(k.allErrors){let pe=K.let("valid",!0);return se(()=>K.assign(pe,!1)),pe}return K.var(D,!0),se(()=>K.break()),D;function se(pe){let ie=K.const("len",h._`${ae}.length`);K.forRange("i",0,ie,(fe)=>{L.subschema({keyword:H,dataProp:fe,dataPropType:p.Type.Num},D),K.if((0,h.not)(D),pe)})}}m.validateArray=q;function Z(L){let{gen:K,schema:ae,keyword:H,it:k}=L;if(!Array.isArray(ae))throw Error("ajv implementation error");if(ae.some((pe)=>(0,p.alwaysValidSchema)(k,pe))&&!k.opts.unevaluated)return;let D=K.let("valid",!1),se=K.name("_valid");K.block(()=>ae.forEach((pe,ie)=>{let fe=L.subschema({keyword:H,schemaProp:ie,compositeRule:!0},se);if(K.assign(D,h._`${D} || ${se}`),!L.mergeValidEvaluated(fe,se))K.if((0,h.not)(D))})),L.result(D,()=>L.reset(),()=>L.error(!0))}m.validateUnion=Z}),jd=ye((m)=>{Object.defineProperty(m,"__esModule",{value:!0}),m.validateKeywordUsage=m.validSchemaType=m.funcKeywordCode=m.macroKeywordCode=void 0;let h=qe(),p=dt(),f=mt(),g=_n();function S(F,V){let{gen:B,keyword:x,schema:q,parentSchema:Z,it:L}=F,K=V.macro.call(L.self,q,Z,L),ae=O(B,x,K);if(L.opts.validateSchema!==!1)L.self.validateSchema(K,!0);let H=B.name("valid");F.subschema({schema:K,schemaPath:h.nil,errSchemaPath:`${L.errSchemaPath}/${x}`,topSchemaRef:ae,compositeRule:!0},H),F.pass(H,()=>F.error(!0))}m.macroKeywordCode=S;function y(F,V){var B;let{gen:x,keyword:q,schema:Z,parentSchema:L,$data:K,it:ae}=F;T(ae,V);let H=O(x,q,!K&&V.compile?V.compile.call(ae.self,Z,L,ae):V.validate),k=x.let("valid");F.block$data(k,D),F.ok((B=V.valid)!==null&&B!==void 0?B:k);function D(){if(V.errors===!1){if(ie(),V.modifying)z(F);fe(()=>F.error())}else{let Re=V.async?se():pe();if(V.modifying)z(F);fe(()=>v(F,Re))}}function se(){let Re=x.let("ruleErrs",null);return x.try(()=>ie(h._`await `),(ze)=>x.assign(k,!1).if(h._`${ze} instanceof ${ae.ValidationError}`,()=>x.assign(Re,h._`${ze}.errors`),()=>x.throw(ze))),Re}function pe(){let Re=h._`${H}.errors`;return x.assign(Re,null),ie(h.nil),Re}function ie(Re=V.async?h._`await `:h.nil){let ze=ae.opts.passContext?p.default.this:p.default.self,Ce=!(("compile"in V)&&!K||V.schema===!1);x.assign(k,h._`${Re}${(0,f.callValidateCode)(F,H,ze,Ce)}`,V.modifying)}function fe(Re){var ze;x.if((0,h.not)((ze=V.valid)!==null&&ze!==void 0?ze:k),Re)}}m.funcKeywordCode=y;function z(F){let{gen:V,data:B,it:x}=F;V.if(x.parentData,()=>V.assign(B,h._`${x.parentData}[${x.parentDataProperty}]`))}function v(F,V){let{gen:B}=F;B.if(h._`Array.isArray(${V})`,()=>{B.assign(p.default.vErrors,h._`${p.default.vErrors} === null ? ${V} : ${p.default.vErrors}.concat(${V})`).assign(p.default.errors,h._`${p.default.vErrors}.length`),(0,g.extendErrors)(F)},()=>F.error())}function T({schemaEnv:F},V){if(V.async&&!F.$async)throw Error("async keyword in sync schema")}function O(F,V,B){if(B===void 0)throw Error(`keyword "${V}" failed to compile`);return F.scopeValue("keyword",typeof B=="function"?{ref:B}:{ref:B,code:(0,h.stringify)(B)})}function C(F,V,B=!1){return!V.length||V.some((x)=>x==="array"?Array.isArray(F):x==="object"?F&&typeof F=="object"&&!Array.isArray(F):typeof F==x||B&&typeof F>"u")}m.validSchemaType=C;function U({schema:F,opts:V,self:B,errSchemaPath:x},q,Z){if(Array.isArray(q.keyword)?!q.keyword.includes(Z):q.keyword!==Z)throw Error("ajv implementation error");let L=q.dependencies;if(L===null||L===void 0?void 0:L.some((K)=>!Object.prototype.hasOwnProperty.call(F,K)))throw Error(`parent schema must have dependencies of ${Z}: ${L.join(",")}`);if(q.validateSchema){if(!q.validateSchema(F[Z])){let K=`keyword "${Z}" value is invalid at path "${x}": `+B.errorsText(q.validateSchema.errors);if(V.validateSchema==="log")B.logger.error(K);else throw Error(K)}}}m.validateKeywordUsage=U}),Nd=ye((m)=>{Object.defineProperty(m,"__esModule",{value:!0}),m.extendSubschemaMode=m.extendSubschemaData=m.getSubschema=void 0;let h=qe(),p=ke();function f(y,{keyword:z,schemaProp:v,schema:T,schemaPath:O,errSchemaPath:C,topSchemaRef:U}){if(z!==void 0&&T!==void 0)throw Error('both "keyword" and "schema" passed, only one allowed');if(z!==void 0){let F=y.schema[z];return v===void 0?{schema:F,schemaPath:h._`${y.schemaPath}${(0,h.getProperty)(z)}`,errSchemaPath:`${y.errSchemaPath}/${z}`}:{schema:F[v],schemaPath:h._`${y.schemaPath}${(0,h.getProperty)(z)}${(0,h.getProperty)(v)}`,errSchemaPath:`${y.errSchemaPath}/${z}/${(0,p.escapeFragment)(v)}`}}if(T!==void 0){if(O===void 0||C===void 0||U===void 0)throw Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:T,schemaPath:O,topSchemaRef:U,errSchemaPath:C}}throw Error('either "keyword" or "schema" must be passed')}m.getSubschema=f;function g(y,z,{dataProp:v,dataPropType:T,data:O,dataTypes:C,propertyName:U}){if(O!==void 0&&v!==void 0)throw Error('both "data" and "dataProp" passed, only one allowed');let{gen:F}=z;if(v!==void 0){let{errorPath:B,dataPathArr:x,opts:q}=z;V(F.let("data",h._`${z.data}${(0,h.getProperty)(v)}`,!0)),y.errorPath=h.str`${B}${(0,p.getErrorPath)(v,T,q.jsPropertySyntax)}`,y.parentDataProperty=h._`${v}`,y.dataPathArr=[...x,y.parentDataProperty]}if(O!==void 0){if(V(O instanceof h.Name?O:F.let("data",O,!0)),U!==void 0)y.propertyName=U}if(C)y.dataTypes=C;function V(B){y.data=B,y.dataLevel=z.dataLevel+1,y.dataTypes=[],z.definedProperties=new Set,y.parentData=z.data,y.dataNames=[...z.dataNames,B]}}m.extendSubschemaData=g;function S(y,{jtdDiscriminator:z,jtdMetadata:v,compositeRule:T,createErrors:O,allErrors:C}){if(T!==void 0)y.compositeRule=T;if(O!==void 0)y.createErrors=O;if(C!==void 0)y.allErrors=C;y.jtdDiscriminator=z,y.jtdMetadata=v}m.extendSubschemaMode=S}),il=ye((m,h)=>{h.exports=function p(f,g){if(f===g)return!0;if(f&&g&&typeof f=="object"&&typeof g=="object"){if(f.constructor!==g.constructor)return!1;var S,y,z;if(Array.isArray(f)){if(S=f.length,S!=g.length)return!1;for(y=S;y--!==0;)if(!p(f[y],g[y]))return!1;return!0}if(f.constructor===RegExp)return f.source===g.source&&f.flags===g.flags;if(f.valueOf!==Object.prototype.valueOf)return f.valueOf()===g.valueOf();if(f.toString!==Object.prototype.toString)return f.toString()===g.toString();if(z=Object.keys(f),S=z.length,S!==Object.keys(g).length)return!1;for(y=S;y--!==0;)if(!Object.prototype.hasOwnProperty.call(g,z[y]))return!1;for(y=S;y--!==0;){var v=z[y];if(!p(f[v],g[v]))return!1}return!0}return f!==f&&g!==g}}),kd=ye((m,h)=>{var p=h.exports=function(S,y,z){if(typeof y=="function")z=y,y={};z=y.cb||z;var v=typeof z=="function"?z:z.pre||function(){},T=z.post||function(){};f(y,v,T,S,"",S)};p.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0},p.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0},p.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0},p.skipKeywords={default:!0,enum:!0,const:!0,required:!0,maximum:!0,minimum:!0,exclusiveMaximum:!0,exclusiveMinimum:!0,multipleOf:!0,maxLength:!0,minLength:!0,pattern:!0,format:!0,maxItems:!0,minItems:!0,uniqueItems:!0,maxProperties:!0,minProperties:!0};function f(S,y,z,v,T,O,C,U,F,V){if(v&&typeof v=="object"&&!Array.isArray(v)){y(v,T,O,C,U,F,V);for(var B in v){var x=v[B];if(Array.isArray(x)){if(B in p.arrayKeywords)for(var q=0;q<x.length;q++)f(S,y,z,x[q],T+"/"+B+"/"+q,O,T,B,v,q)}else if(B in p.propsKeywords){if(x&&typeof x=="object")for(var Z in x)f(S,y,z,x[Z],T+"/"+B+"/"+g(Z),O,T,B,v,Z)}else if(B in p.keywords||S.allKeys&&!(B in p.skipKeywords))f(S,y,z,x,T+"/"+B,O,T,B,v)}z(v,T,O,C,U,F,V)}}function g(S){return S.replace(/~/g,"~0").replace(/\//g,"~1")}}),bn=ye((m)=>{Object.defineProperty(m,"__esModule",{value:!0}),m.getSchemaRefs=m.resolveUrl=m.normalizeId=m._getFullPath=m.getFullPath=m.inlineRef=void 0;let h=ke(),p=il(),f=kd(),g=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function S(x,q=!0){if(typeof x=="boolean")return!0;if(q===!0)return!z(x);if(!q)return!1;return v(x)<=q}m.inlineRef=S;let y=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function z(x){for(let q in x){if(y.has(q))return!0;let Z=x[q];if(Array.isArray(Z)&&Z.some(z))return!0;if(typeof Z=="object"&&z(Z))return!0}return!1}function v(x){let q=0;for(let Z in x){if(Z==="$ref")return 1/0;if(q++,g.has(Z))continue;if(typeof x[Z]=="object")(0,h.eachItem)(x[Z],(L)=>q+=v(L));if(q===1/0)return 1/0}return q}function T(x,q="",Z){if(Z!==!1)q=U(q);return O(x,x.parse(q))}m.getFullPath=T;function O(x,q){return x.serialize(q).split("#")[0]+"#"}m._getFullPath=O;let C=/#\/?$/;function U(x){return x?x.replace(C,""):""}m.normalizeId=U;function F(x,q,Z){return Z=U(Z),x.resolve(q,Z)}m.resolveUrl=F;let V=/^[a-z_][-a-z0-9._]*$/i;function B(x,q){if(typeof x=="boolean")return{};let{schemaId:Z,uriResolver:L}=this.opts,K=U(x[Z]||q),ae={"":K},H=T(L,K,!1),k={},D=new Set;return f(x,{allKeys:!0},(ie,fe,Re,ze)=>{if(ze===void 0)return;let Ce=H+fe,Ae=ae[ze];if(typeof ie[Z]=="string")Ae=Me.call(this,ie[Z]);Ue.call(this,ie.$anchor),Ue.call(this,ie.$dynamicAnchor),ae[fe]=Ae;function Me(je){let te=this.opts.uriResolver.resolve;if(je=U(Ae?te(Ae,je):je),D.has(je))throw pe(je);D.add(je);let me=this.refs[je];if(typeof me=="string")me=this.refs[me];if(typeof me=="object")se(ie,me.schema,je);else if(je!==U(Ce))if(je[0]==="#")se(ie,k[je],je),k[je]=ie;else this.refs[je]=Ce;return je}function Ue(je){if(typeof je=="string"){if(!V.test(je))throw Error(`invalid anchor "${je}"`);Me.call(this,`#${je}`)}}}),k;function se(ie,fe,Re){if(fe!==void 0&&!p(ie,fe))throw pe(Re)}function pe(ie){return Error(`reference "${ie}" resolves to more than one schema`)}}m.getSchemaRefs=B}),Nr=ye((m)=>{Object.defineProperty(m,"__esModule",{value:!0}),m.getData=m.KeywordCxt=m.validateFunctionCode=void 0;let h=qd(),p=vn(),f=nl(),g=vn(),S=Od(),y=jd(),z=Nd(),v=qe(),T=dt(),O=bn(),C=ke(),U=_n();function F(Q){if(H(Q)){if(D(Q),ae(Q)){q(Q);return}}V(Q,()=>(0,h.topBoolOrEmptySchema)(Q))}m.validateFunctionCode=F;function V({gen:Q,validateName:he,schema:Se,schemaEnv:we,opts:$e},Te){if($e.code.es5)Q.func(he,v._`${T.default.data}, ${T.default.valCxt}`,we.$async,()=>{Q.code(v._`"use strict"; ${L(Se,$e)}`),x(Q,$e),Q.code(Te)});else Q.func(he,v._`${T.default.data}, ${B($e)}`,we.$async,()=>Q.code(L(Se,$e)).code(Te))}function B(Q){return v._`{${T.default.instancePath}="", ${T.default.parentData}, ${T.default.parentDataProperty}, ${T.default.rootData}=${T.default.data}${Q.dynamicRef?v._`, ${T.default.dynamicAnchors}={}`:v.nil}}={}`}function x(Q,he){Q.if(T.default.valCxt,()=>{if(Q.var(T.default.instancePath,v._`${T.default.valCxt}.${T.default.instancePath}`),Q.var(T.default.parentData,v._`${T.default.valCxt}.${T.default.parentData}`),Q.var(T.default.parentDataProperty,v._`${T.default.valCxt}.${T.default.parentDataProperty}`),Q.var(T.default.rootData,v._`${T.default.valCxt}.${T.default.rootData}`),he.dynamicRef)Q.var(T.default.dynamicAnchors,v._`${T.default.valCxt}.${T.default.dynamicAnchors}`)},()=>{if(Q.var(T.default.instancePath,v._`""`),Q.var(T.default.parentData,v._`undefined`),Q.var(T.default.parentDataProperty,v._`undefined`),Q.var(T.default.rootData,T.default.data),he.dynamicRef)Q.var(T.default.dynamicAnchors,v._`{}`)})}function q(Q){let{schema:he,opts:Se,gen:we}=Q;V(Q,()=>{if(Se.$comment&&he.$comment)ze(Q);if(ie(Q),we.let(T.default.vErrors,null),we.let(T.default.errors,0),Se.unevaluated)Z(Q);se(Q),Ce(Q)})}function Z(Q){let{gen:he,validateName:Se}=Q;Q.evaluated=he.const("evaluated",v._`${Se}.evaluated`),he.if(v._`${Q.evaluated}.dynamicProps`,()=>he.assign(v._`${Q.evaluated}.props`,v._`undefined`)),he.if(v._`${Q.evaluated}.dynamicItems`,()=>he.assign(v._`${Q.evaluated}.items`,v._`undefined`))}function L(Q,he){let Se=typeof Q=="object"&&Q[he.schemaId];return Se&&(he.code.source||he.code.process)?v._`/*# sourceURL=${Se} */`:v.nil}function K(Q,he){if(H(Q)){if(D(Q),ae(Q)){k(Q,he);return}}(0,h.boolOrEmptySchema)(Q,he)}function ae({schema:Q,self:he}){if(typeof Q=="boolean")return!Q;for(let Se in Q)if(he.RULES.all[Se])return!0;return!1}function H(Q){return typeof Q.schema!="boolean"}function k(Q,he){let{schema:Se,gen:we,opts:$e}=Q;if($e.$comment&&Se.$comment)ze(Q);fe(Q),Re(Q);let Te=we.const("_errs",T.default.errors);se(Q,Te),we.var(he,v._`${Te} === ${T.default.errors}`)}function D(Q){(0,C.checkUnknownRules)(Q),pe(Q)}function se(Q,he){if(Q.opts.jtd)return Me(Q,[],!1,he);let Se=(0,p.getSchemaTypes)(Q.schema);Me(Q,Se,!(0,p.coerceAndCheckDataType)(Q,Se),he)}function pe(Q){let{schema:he,errSchemaPath:Se,opts:we,self:$e}=Q;if(he.$ref&&we.ignoreKeywordsWithRef&&(0,C.schemaHasRulesButRef)(he,$e.RULES))$e.logger.warn(`$ref: keywords ignored in schema at path "${Se}"`)}function ie(Q){let{schema:he,opts:Se}=Q;if(he.default!==void 0&&Se.useDefaults&&Se.strictSchema)(0,C.checkStrictMode)(Q,"default is ignored in the schema root")}function fe(Q){let he=Q.schema[Q.opts.schemaId];if(he)Q.baseId=(0,O.resolveUrl)(Q.opts.uriResolver,Q.baseId,he)}function Re(Q){if(Q.schema.$async&&!Q.schemaEnv.$async)throw Error("async schema in sync schema")}function ze({gen:Q,schemaEnv:he,schema:Se,errSchemaPath:we,opts:$e}){let Te=Se.$comment;if($e.$comment===!0)Q.code(v._`${T.default.self}.logger.log(${Te})`);else if(typeof $e.$comment=="function"){let Ne=v.str`${we}/$comment`,xe=Q.scopeValue("root",{ref:he.root});Q.code(v._`${T.default.self}.opts.$comment(${Te}, ${Ne}, ${xe}.schema)`)}}function Ce(Q){let{gen:he,schemaEnv:Se,validateName:we,ValidationError:$e,opts:Te}=Q;if(Se.$async)he.if(v._`${T.default.errors} === 0`,()=>he.return(T.default.data),()=>he.throw(v._`new ${$e}(${T.default.vErrors})`));else{if(he.assign(v._`${we}.errors`,T.default.vErrors),Te.unevaluated)Ae(Q);he.return(v._`${T.default.errors} === 0`)}}function Ae({gen:Q,evaluated:he,props:Se,items:we}){if(Se instanceof v.Name)Q.assign(v._`${he}.props`,Se);if(we instanceof v.Name)Q.assign(v._`${he}.items`,we)}function Me(Q,he,Se,we){let{gen:$e,schema:Te,data:Ne,allErrors:xe,opts:De,self:Fe}=Q,{RULES:Ve}=Fe;if(Te.$ref&&(De.ignoreKeywordsWithRef||!(0,C.schemaHasRulesButRef)(Te,Ve))){$e.block(()=>_e(Q,"$ref",Ve.all.$ref.definition));return}if(!De.jtd)je(Q,he);$e.block(()=>{for(let We of Ve.rules)it(We);it(Ve.post)});function it(We){if(!(0,f.shouldUseGroup)(Te,We))return;if(We.type){if($e.if((0,g.checkDataType)(We.type,Ne,De.strictNumbers)),Ue(Q,We),he.length===1&&he[0]===We.type&&Se)$e.else(),(0,g.reportTypeError)(Q);$e.endIf()}else Ue(Q,We);if(!xe)$e.if(v._`${T.default.errors} === ${we||0}`)}}function Ue(Q,he){let{gen:Se,schema:we,opts:{useDefaults:$e}}=Q;if($e)(0,S.assignDefaults)(Q,he.type);Se.block(()=>{for(let Te of he.rules)if((0,f.shouldUseRule)(we,Te))_e(Q,Te.keyword,Te.definition,he.type)})}function je(Q,he){if(Q.schemaEnv.meta||!Q.opts.strictTypes)return;if(te(Q,he),!Q.opts.allowUnionTypes)me(Q,he);M(Q,Q.dataTypes)}function te(Q,he){if(!he.length)return;if(!Q.dataTypes.length){Q.dataTypes=he;return}he.forEach((Se)=>{if(!E(Q.dataTypes,Se))ee(Q,`type "${Se}" not allowed by context "${Q.dataTypes.join(",")}"`)}),A(Q,he)}function me(Q,he){if(he.length>1&&!(he.length===2&&he.includes("null")))ee(Q,"use allowUnionTypes to allow union type keyword")}function M(Q,he){let Se=Q.self.RULES.all;for(let we in Se){let $e=Se[we];if(typeof $e=="object"&&(0,f.shouldUseRule)(Q.schema,$e)){let{type:Te}=$e.definition;if(Te.length&&!Te.some((Ne)=>b(he,Ne)))ee(Q,`missing type "${Te.join(",")}" for keyword "${we}"`)}}}function b(Q,he){return Q.includes(he)||he==="number"&&Q.includes("integer")}function E(Q,he){return Q.includes(he)||he==="integer"&&Q.includes("number")}function A(Q,he){let Se=[];for(let we of Q.dataTypes)if(E(he,we))Se.push(we);else if(he.includes("integer")&&we==="number")Se.push("integer");Q.dataTypes=Se}function ee(Q,he){let Se=Q.schemaEnv.baseId+Q.errSchemaPath;he+=` at "${Se}" (strictTypes)`,(0,C.checkStrictMode)(Q,he,Q.opts.strictTypes)}var ge=class{constructor(Q,he,Se){if((0,y.validateKeywordUsage)(Q,he,Se),this.gen=Q.gen,this.allErrors=Q.allErrors,this.keyword=Se,this.data=Q.data,this.schema=Q.schema[Se],this.$data=he.$data&&Q.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,C.schemaRefOrVal)(Q,this.schema,Se,this.$data),this.schemaType=he.schemaType,this.parentSchema=Q.schema,this.params={},this.it=Q,this.def=he,this.$data)this.schemaCode=Q.gen.const("vSchema",Le(this.$data,Q));else if(this.schemaCode=this.schemaValue,!(0,y.validSchemaType)(this.schema,he.schemaType,he.allowUndefined))throw Error(`${Se} value must be ${JSON.stringify(he.schemaType)}`);if("code"in he?he.trackErrors:he.errors!==!1)this.errsCount=Q.gen.const("_errs",T.default.errors)}result(Q,he,Se){this.failResult((0,v.not)(Q),he,Se)}failResult(Q,he,Se){if(this.gen.if(Q),Se)Se();else this.error();if(he){if(this.gen.else(),he(),this.allErrors)this.gen.endIf()}else if(this.allErrors)this.gen.endIf();else this.gen.else()}pass(Q,he){this.failResult((0,v.not)(Q),void 0,he)}fail(Q){if(Q===void 0){if(this.error(),!this.allErrors)this.gen.if(!1);return}if(this.gen.if(Q),this.error(),this.allErrors)this.gen.endIf();else this.gen.else()}fail$data(Q){if(!this.$data)return this.fail(Q);let{schemaCode:he}=this;this.fail(v._`${he} !== undefined && (${(0,v.or)(this.invalid$data(),Q)})`)}error(Q,he,Se){if(he){this.setParams(he),this._error(Q,Se),this.setParams({});return}this._error(Q,Se)}_error(Q,he){(Q?U.reportExtraError:U.reportError)(this,this.def.error,he)}$dataError(){(0,U.reportError)(this,this.def.$dataError||U.keyword$DataError)}reset(){if(this.errsCount===void 0)throw Error('add "trackErrors" to keyword definition');(0,U.resetErrorsCount)(this.gen,this.errsCount)}ok(Q){if(!this.allErrors)this.gen.if(Q)}setParams(Q,he){if(he)Object.assign(this.params,Q);else this.params=Q}block$data(Q,he,Se=v.nil){this.gen.block(()=>{this.check$data(Q,Se),he()})}check$data(Q=v.nil,he=v.nil){if(!this.$data)return;let{gen:Se,schemaCode:we,schemaType:$e,def:Te}=this;if(Se.if((0,v.or)(v._`${we} === undefined`,he)),Q!==v.nil)Se.assign(Q,!0);if($e.length||Te.validateSchema){if(Se.elseIf(this.invalid$data()),this.$dataError(),Q!==v.nil)Se.assign(Q,!1)}Se.else()}invalid$data(){let{gen:Q,schemaCode:he,schemaType:Se,def:we,it:$e}=this;return(0,v.or)(Te(),Ne());function Te(){if(Se.length){if(!(he instanceof v.Name))throw Error("ajv implementation error");let xe=Array.isArray(Se)?Se:[Se];return v._`${(0,g.checkDataTypes)(xe,he,$e.opts.strictNumbers,g.DataType.Wrong)}`}return v.nil}function Ne(){if(we.validateSchema){let xe=Q.scopeValue("validate$data",{ref:we.validateSchema});return v._`!${xe}(${he})`}return v.nil}}subschema(Q,he){let Se=(0,z.getSubschema)(this.it,Q);(0,z.extendSubschemaData)(Se,this.it,Q),(0,z.extendSubschemaMode)(Se,Q);let we={...this.it,...Se,items:void 0,props:void 0};return K(we,he),we}mergeEvaluated(Q,he){let{it:Se,gen:we}=this;if(!Se.opts.unevaluated)return;if(Se.props!==!0&&Q.props!==void 0)Se.props=C.mergeEvaluated.props(we,Q.props,Se.props,he);if(Se.items!==!0&&Q.items!==void 0)Se.items=C.mergeEvaluated.items(we,Q.items,Se.items,he)}mergeValidEvaluated(Q,he){let{it:Se,gen:we}=this;if(Se.opts.unevaluated&&(Se.props!==!0||Se.items!==!0))return we.if(he,()=>this.mergeEvaluated(Q,v.Name)),!0}};m.KeywordCxt=ge;function _e(Q,he,Se,we){let $e=new ge(Q,Se,he);if("code"in Se)Se.code($e,we);else if($e.$data&&Se.validate)(0,y.funcKeywordCode)($e,Se);else if("macro"in Se)(0,y.macroKeywordCode)($e,Se);else if(Se.compile||Se.validate)(0,y.funcKeywordCode)($e,Se)}let ve=/^\/(?:[^~]|~0|~1)*$/,Ie=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function Le(Q,{dataLevel:he,dataNames:Se,dataPathArr:we}){let $e,Te;if(Q==="")return T.default.rootData;if(Q[0]==="/"){if(!ve.test(Q))throw Error(`Invalid JSON-pointer: ${Q}`);$e=Q,Te=T.default.rootData}else{let Fe=Ie.exec(Q);if(!Fe)throw Error(`Invalid JSON-pointer: ${Q}`);let Ve=+Fe[1];if($e=Fe[2],$e==="#"){if(Ve>=he)throw Error(De("property/index",Ve));return we[he-Ve]}if(Ve>he)throw Error(De("data",Ve));if(Te=Se[he-Ve],!$e)return Te}let Ne=Te,xe=$e.split("/");for(let Fe of xe)if(Fe)Te=v._`${Te}${(0,v.getProperty)((0,C.unescapeJsonPointer)(Fe))}`,Ne=v._`${Ne} && ${Te}`;return Ne;function De(Fe,Ve){return`Cannot access ${Fe} ${Ve} levels up, current level is ${he}`}}m.getData=Le}),xs=ye((m)=>{Object.defineProperty(m,"__esModule",{value:!0});var h=class extends Error{constructor(p){super("validation failed");this.errors=p,this.ajv=this.validation=!0}};m.default=h}),kr=ye((m)=>{Object.defineProperty(m,"__esModule",{value:!0});let h=bn();var p=class extends Error{constructor(f,g,S,y){super(y||`can't resolve reference ${S} from id ${g}`);this.missingRef=(0,h.resolveUrl)(f,g,S),this.missingSchema=(0,h.normalizeId)((0,h.getFullPath)(f,this.missingRef))}};m.default=p}),Rn=ye((m)=>{Object.defineProperty(m,"__esModule",{value:!0}),m.resolveSchema=m.getCompilingSchema=m.resolveRef=m.compileSchema=m.SchemaEnv=void 0;let h=qe(),p=xs(),f=dt(),g=bn(),S=ke(),y=Nr();var z=class{constructor(q){var Z;this.refs={},this.dynamicAnchors={};let L;if(typeof q.schema=="object")L=q.schema;this.schema=q.schema,this.schemaId=q.schemaId,this.root=q.root||this,this.baseId=(Z=q.baseId)!==null&&Z!==void 0?Z:(0,g.normalizeId)(L===null||L===void 0?void 0:L[q.schemaId||"$id"]),this.schemaPath=q.schemaPath,this.localRefs=q.localRefs,this.meta=q.meta,this.$async=L===null||L===void 0?void 0:L.$async,this.refs={}}};m.SchemaEnv=z;function v(q){let Z=C.call(this,q);if(Z)return Z;let L=(0,g.getFullPath)(this.opts.uriResolver,q.root.baseId),{es5:K,lines:ae}=this.opts.code,{ownProperties:H}=this.opts,k=new h.CodeGen(this.scope,{es5:K,lines:ae,ownProperties:H}),D;if(q.$async)D=k.scopeValue("Error",{ref:p.default,code:h._`require("ajv/dist/runtime/validation_error").default`});let se=k.scopeName("validate");q.validateName=se;let pe={gen:k,allErrors:this.opts.allErrors,data:f.default.data,parentData:f.default.parentData,parentDataProperty:f.default.parentDataProperty,dataNames:[f.default.data],dataPathArr:[h.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:k.scopeValue("schema",this.opts.code.source===!0?{ref:q.schema,code:(0,h.stringify)(q.schema)}:{ref:q.schema}),validateName:se,ValidationError:D,schema:q.schema,schemaEnv:q,rootId:L,baseId:q.baseId||L,schemaPath:h.nil,errSchemaPath:q.schemaPath||(this.opts.jtd?"":"#"),errorPath:h._`""`,opts:this.opts,self:this},ie;try{this._compilations.add(q),(0,y.validateFunctionCode)(pe),k.optimize(this.opts.code.optimize);let fe=k.toString();if(ie=`${k.scopeRefs(f.default.scope)}return ${fe}`,this.opts.code.process)ie=this.opts.code.process(ie,q);let Re=Function(`${f.default.self}`,`${f.default.scope}`,ie)(this,this.scope.get());if(this.scope.value(se,{ref:Re}),Re.errors=null,Re.schema=q.schema,Re.schemaEnv=q,q.$async)Re.$async=!0;if(this.opts.code.source===!0)Re.source={validateName:se,validateCode:fe,scopeValues:k._values};if(this.opts.unevaluated){let{props:ze,items:Ce}=pe;if(Re.evaluated={props:ze instanceof h.Name?void 0:ze,items:Ce instanceof h.Name?void 0:Ce,dynamicProps:ze instanceof h.Name,dynamicItems:Ce instanceof h.Name},Re.source)Re.source.evaluated=(0,h.stringify)(Re.evaluated)}return q.validate=Re,q}catch(fe){if(delete q.validate,delete q.validateName,ie)this.logger.error("Error compiling schema, function code:",ie);throw fe}finally{this._compilations.delete(q)}}m.compileSchema=v;function T(q,Z,L){var K;L=(0,g.resolveUrl)(this.opts.uriResolver,Z,L);let ae=q.refs[L];if(ae)return ae;let H=F.call(this,q,L);if(H===void 0){let k=(K=q.localRefs)===null||K===void 0?void 0:K[L],{schemaId:D}=this.opts;if(k)H=new z({schema:k,schemaId:D,root:q,baseId:Z})}if(H===void 0)return;return q.refs[L]=O.call(this,H)}m.resolveRef=T;function O(q){if((0,g.inlineRef)(q.schema,this.opts.inlineRefs))return q.schema;return q.validate?q:v.call(this,q)}function C(q){for(let Z of this._compilations)if(U(Z,q))return Z}m.getCompilingSchema=C;function U(q,Z){return q.schema===Z.schema&&q.root===Z.root&&q.baseId===Z.baseId}function F(q,Z){let L;while(typeof(L=this.refs[Z])=="string")Z=L;return L||this.schemas[Z]||V.call(this,q,Z)}function V(q,Z){let L=this.opts.uriResolver.parse(Z),K=(0,g._getFullPath)(this.opts.uriResolver,L),ae=(0,g.getFullPath)(this.opts.uriResolver,q.baseId,void 0);if(Object.keys(q.schema).length>0&&K===ae)return x.call(this,L,q);let H=(0,g.normalizeId)(K),k=this.refs[H]||this.schemas[H];if(typeof k=="string"){let D=V.call(this,q,k);if(typeof(D===null||D===void 0?void 0:D.schema)!=="object")return;return x.call(this,L,D)}if(typeof(k===null||k===void 0?void 0:k.schema)!=="object")return;if(!k.validate)v.call(this,k);if(H===(0,g.normalizeId)(Z)){let{schema:D}=k,{schemaId:se}=this.opts,pe=D[se];if(pe)ae=(0,g.resolveUrl)(this.opts.uriResolver,ae,pe);return new z({schema:D,schemaId:se,root:q,baseId:ae})}return x.call(this,L,k)}m.resolveSchema=V;let B=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function x(q,{baseId:Z,schema:L,root:K}){var ae;if(((ae=q.fragment)===null||ae===void 0?void 0:ae[0])!=="/")return;for(let D of q.fragment.slice(1).split("/")){if(typeof L==="boolean")return;let se=L[(0,S.unescapeFragment)(D)];if(se===void 0)return;L=se;let pe=typeof L==="object"&&L[this.opts.schemaId];if(!B.has(D)&&pe)Z=(0,g.resolveUrl)(this.opts.uriResolver,Z,pe)}let H;if(typeof L!="boolean"&&L.$ref&&!(0,S.schemaHasRulesButRef)(L,this.RULES)){let D=(0,g.resolveUrl)(this.opts.uriResolver,Z,L.$ref);H=V.call(this,K,D)}let{schemaId:k}=this.opts;if(H=H||new z({schema:L,schemaId:k,root:K,baseId:Z}),H.schema!==H.root.schema)return H}}),Md=ye((m,h)=>{h.exports={$id:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#",description:"Meta-schema for $data reference (JSON AnySchema extension proposal)",type:"object",required:["$data"],properties:{$data:{type:"string",anyOf:[{format:"relative-json-pointer"},{format:"json-pointer"}]}},additionalProperties:!1}}),cl=ye((m,h)=>{let p=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),f=RegExp.prototype.test.bind(/^(?:(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)$/u),g=RegExp.prototype.test.bind(/^\d*$/u),S=RegExp.prototype.test.bind(/^[\da-f]{2}$/iu),y=RegExp.prototype.test.bind(/^[\da-z\-._~]$/iu),z=RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:@/]$/u),v=RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:@/?]$/u),T=RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:]$/u),O=Array(256);for(let b=0;b<256;b++)O[b]="%"+"0123456789ABCDEF"[b>>4]+"0123456789ABCDEF"[b&15];function C(M){if(M<2048)return O[192|M>>6]+O[128|M&63];if(M<65536)return O[224|M>>12]+O[128|M>>6&63]+O[128|M&63];return O[240|M>>18]+O[128|M>>12&63]+O[128|M>>6&63]+O[128|M&63]}function U(M){let b="",E=0,A=0;for(A=0;A<M.length;A++){if(E=M[A].charCodeAt(0),E===48)continue;if(!(E>=48&&E<=57||E>=65&&E<=70||E>=97&&E<=102))return"";b+=M[A];break}for(A+=1;A<M.length;A++){if(E=M[A].charCodeAt(0),!(E>=48&&E<=57||E>=65&&E<=70||E>=97&&E<=102))return"";b+=M[A]}return b}let F=RegExp.prototype.test.bind(/^[\dA-Fa-f]{1,4}$/),V=RegExp.prototype.test.bind(/^[vV][\dA-Fa-f]+\.[A-Za-z\d\-._~!$&'()*+,;=:]+$/),B=RegExp.prototype.test.bind(/^[A-Za-z\d\-._~]$/),x=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function q(M){if(M.length===0)return!1;for(let b=0;b<M.length;b++){if(B(M[b]))continue;if(M[b]==="%"&&b+2<M.length&&S(M.slice(b+1,b+3))){b+=2;continue}return!1}return!0}function Z(M){let b=-1,E=0,A=-1,ee=0;for(let ve=0;ve<M.length;ve++)if(M[ve]==="0"){if(A===-1)A=ve;if(ee++,ee>E)E=ee,b=A}else A=-1,ee=0;if(E<2)return M.join(":");let ge=M.slice(0,b).join(":"),_e=M.slice(b+E).join(":");return ge+"::"+_e}function L(M){let b=M.indexOf("::");if(b!==-1&&M.indexOf("::",b+1)!==-1)return;let E=b===-1?M.split(":"):M.slice(0,b).split(":"),A=b===-1?[]:M.slice(b+2).split(":");if(b!==-1){if(E.length===1&&E[0]==="")E.length=0;if(A.length===1&&A[0]==="")A.length=0}let ee=E.concat(A),ge=0;for(let ve=0;ve<ee.length;ve++){let Ie=ee[ve];if(Ie==="")return;if(Ie.indexOf(".")!==-1){if(ve!==ee.length-1||b!==-1&&A.length===0||!f(Ie))return;ge+=2;continue}if(!F(Ie))return;ee[ve]=parseInt(Ie,16).toString(16),ge++}if(b===-1){if(ge!==8)return;return Z(ee)}if(ge>=8)return;let _e=ee.slice(0,E.length);for(let ve=ge;ve<8;ve++)_e.push("0");for(let ve=E.length;ve<ee.length;ve++)_e.push(ee[ve]);return Z(_e)}function K(M){let b=M[0]==="["&&M[M.length-1]==="]";if((M[0]==="["||M[M.length-1]==="]")&&!b)return{host:M,isIPV6:!1,error:!0};let E=b?M.slice(1,-1):M;if(b&&V(E))return E=E.toLowerCase(),{host:`[${E}]`,escapedHost:E,isIPV6:!1,isIPVFuture:!0};if(ae(E,":")<2)return{host:M,isIPV6:!1,error:b};let A="",ee=E.indexOf("%");if(ee!==-1){let _e=E.slice(ee,ee+3).toLowerCase()==="%25"?3:1;if(A=E.slice(ee+_e),!q(A))return{host:M,isIPV6:!1,error:!0};E=E.slice(0,ee)}let ge=L(E);if(ge===void 0)return{host:M,isIPV6:!1,error:!0};return{host:ge+(A?"%"+A:""),escapedHost:ge+(A?"%25"+A:""),isIPV6:!0}}function ae(M,b){let E=0;for(let A=0;A<M.length;A++)if(M[A]===b)E++;return E}function H(M){let b=M,E=[],A=-1,ee=0;while(ee=b.length){if(ee===1)if(b===".")break;else if(b==="/"){E.push("/");break}else{E.push(b);break}else if(ee===2){if(b[0]==="."){if(b[1]===".")break;else if(b[1]==="/"){b=b.slice(2);continue}}else if(b[0]==="/"){if(b[1]==="."||b[1]==="/"){E.push("/");break}}}else if(ee===3){if(b==="/.."){if(E.length!==0)E.pop();E.push("/");break}}if(b[0]==="."){if(b[1]==="."){if(b[2]==="/"){b=b.slice(3);continue}}else if(b[1]==="/"){b=b.slice(2);continue}}else if(b[0]==="/"){if(b[1]==="."){if(b[2]==="/"){b=b.slice(2);continue}else if(b[2]==="."){if(b[3]==="/"){if(b=b.slice(3),E.length!==0)E.pop();continue}}}}if((A=b.indexOf("/",1))===-1){E.push(b);break}else E.push(b.slice(0,A)),b=b.slice(A)}return E.join("")}let k={"@":"%40","/":"%2F","?":"%3F","#":"%23",":":"%3A"},D=/[@/?#:]/g,se=/[@/?#]/g;function pe(M,b){let E=b?se:D;return E.lastIndex=0,M.replace(E,(A)=>k[A])}function ie(M,b=!1){if(M.indexOf("%")===-1)return M;let E="";for(let A=0;A<M.length;A++){if(M[A]==="%"&&A+2<M.length){let ee=M.slice(A+1,A+3);if(S(ee)){let ge=ee.toUpperCase(),_e=String.fromCharCode(parseInt(ge,16));if(b&&y(_e))E+=_e;else E+="%"+ge;A+=2;continue}}E+=M[A]}return E}function fe(M){let b="";for(let E=0;E<M.length;E++){let A=M[E];if(A==="%"&&E+2<M.length){let ee=M.slice(E+1,E+3);if(S(ee)){let ge=ee.toUpperCase(),_e=String.fromCharCode(parseInt(ge,16));if(_e!=="."&&y(_e))b+=_e;else b+="%"+ge;E+=2;continue}}if(z(A))b+=A;else{let ee=M.charCodeAt(E);if(ee<128)b+=Ue(ee)?A:O[ee];else if(ee<55296||ee>57343)b+=C(ee);else if(ee<=56319&&E+1<M.length){let ge=M.charCodeAt(E+1);if(ge>=56320&&ge<=57343)b+=C(65536+(ee-55296<<10)+(ge-56320)),E++;else b+=C(65533)}else b+=C(65533)}}return b}function Re(M,b=!1){let E="",A=b&&M[0]!=="/";for(let ee=0;ee<M.length;ee++){let ge=M[ee];if(ge==="%"&&ee+2<M.length){let _e=M.slice(ee+1,ee+3);if(S(_e)){E+="%"+_e.toUpperCase(),ee+=2;continue}}if(ge==="/")A=!1;if(z(ge)&&(ge!==":"||!A))E+=ge;else{let _e=M.charCodeAt(ee);if(_e<128)E+=O[_e];else if(_e<55296||_e>57343)E+=C(_e);else if(_e<=56319&&ee+1<M.length){let ve=M.charCodeAt(ee+1);if(ve>=56320&&ve<=57343)E+=C(65536+(_e-55296<<10)+(ve-56320)),ee++;else E+=C(65533)}else E+=C(65533)}}return E}function ze(M,b){let E="";for(let A=0;A<M.length;A++){let ee=M[A];if(ee==="%"&&A+2<M.length){let ge=M.slice(A+1,A+3);if(S(ge)){E+="%"+ge.toUpperCase(),A+=2;continue}}if(b(ee))E+=ee;else{let ge=M.charCodeAt(A);if(ge<128)E+=O[ge];else if(ge<55296||ge>57343)E+=C(ge);else if(ge<=56319&&A+1<M.length){let _e=M.charCodeAt(A+1);if(_e>=56320&&_e<=57343)E+=C(65536+(ge-55296<<10)+(_e-56320)),A++;else E+=C(65533)}else E+=C(65533)}}return E}function Ce(M){return ze(M,T)}function Ae(M){return ze(M,v)}function Me(M){return ze(M,v)}function Ue(M){return M>=48&&M<=57||M>=65&&M<=90||M>=97&&M<=122||M===42||M===43||M===45||M===46||M===47||M===64||M===95}function je(M){let b="";for(let E=0;E<M.length;E++){let A=M[E];if(A==="%"&&E+2<M.length){let ee=M.slice(E+1,E+3);if(S(ee)){let ge=ee.toUpperCase(),_e=String.fromCharCode(parseInt(ge,16));if(y(_e))b+=_e;else b+="%"+ge;E+=2;continue}}if(v(A))b+=A;else{let ee=M.charCodeAt(E);if(ee<128)b+=Ue(ee)?A:O[ee];else if(ee<55296||ee>57343)b+=C(ee);else if(ee<=56319&&E+1<M.length){let ge=M.charCodeAt(E+1);if(ge>=56320&&ge<=57343)b+=C(65536+(ee-55296<<10)+(ge-56320)),E++;else b+=C(65533)}else b+=C(65533)}}return b}function te(M){let b="";for(let E=0;E<M.length;E++){if(M[E]==="%"&&E+2<M.length){let A=M.slice(E+1,E+3);if(S(A)){b+="%"+A.toUpperCase(),E+=2;continue}}b+=escape(M[E])}return b}function me(M){let b=[];if(M.userinfo!==void 0)b.push(Ce(M.userinfo)),b.push("@");if(M.host!==void 0){let E=M.host;if(!f(E)){let A=K(E);if(A.isIPV6!==!0&&A.isIPVFuture!==!0)E=ie(E,!0),A=K(E);if(A.isIPV6===!0||A.isIPVFuture===!0)E=`[${A.escapedHost}]`;else E=pe(E,!1)}b.push(E)}if(typeof M.port==="number"||typeof M.port==="string"){let E=String(M.port);if(!g(E))throw TypeError("URI port is malformed.");b.push(":"),b.push(E)}return b.length?b.join(""):void 0}h.exports={nonSimpleDomain:x,recomposeAuthority:me,reescapeHostDelimiters:pe,normalizePercentEncoding:ie,normalizePathEncoding:fe,serializePathEncoding:Re,normalizeQueryFragmentEncoding:je,encodeUserinfo:Ce,encodeQuery:Ae,encodeFragment:Me,escapePreservingEscapes:te,removeDotSegments:H,isIPv4:f,isUUID:p,normalizeIPv6:K,stringArrayToHexStripped:U}}),Ad=ye((m,h)=>{let{isUUID:p}=cl(),f=/^([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-./:;=@]|%[\da-f]{2})+)$/iu,g=["http","https","ws","wss","urn","urn:uuid"];function S(k){return g.indexOf(k)!==-1}function y(k){if(k.secure===!0)return!0;else if(k.secure===!1)return!1;else if(k.scheme)return k.scheme.length===3&&(k.scheme[0]==="w"||k.scheme[0]==="W")&&(k.scheme[1]==="s"||k.scheme[1]==="S")&&(k.scheme[2]==="s"||k.scheme[2]==="S");else return!1}function z(k){if(!k.host)k.error=k.error||"HTTP URIs must have a host.";return k}function v(k){let D=String(k.scheme).toLowerCase()==="https";if(k.port===(D?443:80)||k.port==="")k.port=void 0;if(!k.path)k.path="/";return k}function T(k){return k.secure=y(k),k.resourceName=(k.path||"/")+(k.query?"?"+k.query:""),k.path=void 0,k.query=void 0,k}function O(k){if(k.port===(y(k)?443:80)||k.port==="")k.port=void 0;if(typeof k.secure==="boolean")k.scheme=k.secure?"wss":"ws",k.secure=void 0;if(k.resourceName){let D=k.resourceName.indexOf("?"),se=D===-1?k.resourceName:k.resourceName.slice(0,D);k.path=se&&se!=="/"?se:void 0,k.query=D===-1?void 0:k.resourceName.slice(D+1),k.resourceName=void 0}return k.fragment=void 0,k}function C(k,D){if(!k.path)return k.error="URN can not be parsed",k;let se=k.path.match(f);if(se&&se[0]===k.path){let pe=D.scheme||k.scheme||"urn";k.nid=se[1].toLowerCase(),k.nss=se[2];let ie=H(`${pe}:${D.nid||k.nid}`);if(k.path=void 0,ie)k=ie.parse(k,D)}else k.error=k.error||"URN can not be parsed.";return k}function U(k,D){if(k.nid===void 0)throw Error("URN without nid cannot be serialized");let se=D.scheme||k.scheme||"urn",pe=k.nid.toLowerCase(),ie=H(`${se}:${D.nid||pe}`);if(ie)k=ie.serialize(k,D);let fe=k,Re=k.nss;return fe.path=`${pe||D.nid}:${Re}`,D.skipEscape=!0,fe}function F(k,D){let se=k;if(se.uuid=se.nss,se.nss=void 0,!D.tolerant&&(!se.uuid||!p(se.uuid)))se.error=se.error||"UUID is not valid.";return se}function V(k){let D=k;return D.nss=(k.uuid||"").toLowerCase(),D}let B={scheme:"http",domainHost:!0,parse:z,serialize:v},x={scheme:"https",domainHost:B.domainHost,parse:z,serialize:v},q={scheme:"ws",domainHost:!0,parse:T,serialize:O},Z={scheme:"wss",domainHost:q.domainHost,parse:q.parse,serialize:q.serialize},ae={http:B,https:x,ws:q,wss:Z,urn:{scheme:"urn",parse:C,serialize:U,skipNormalize:!0},"urn:uuid":{scheme:"urn:uuid",parse:F,serialize:V,skipNormalize:!0}};Object.setPrototypeOf(ae,null);function H(k){return k&&(ae[k]||ae[k.toLowerCase()])||void 0}h.exports={wsIsSecure:y,SCHEMES:ae,isValidSchemeName:S,getSchemeHandler:H}}),Ld=ye((m,h)=>{let{normalizeIPv6:p,removeDotSegments:f,recomposeAuthority:g,normalizePercentEncoding:S,normalizePathEncoding:y,serializePathEncoding:z,normalizeQueryFragmentEncoding:v,encodeQuery:T,encodeFragment:O,reescapeHostDelimiters:C,isIPv4:U,nonSimpleDomain:F}=cl(),{SCHEMES:V,getSchemeHandler:B}=Ad(),x=/^[A-Za-z][A-Za-z0-9+.-]*$/u,q="URI scheme is malformed.";function Z(M){let b=unescape(String(M));if(!x.test(b))throw TypeError("URI scheme is malformed.");return b}function L(M,b){if(typeof M==="string")M=Ue(M,b);else if(typeof M==="object")M=Me(k(M,b),b);return M}function K(M,b,E){let A=E?Object.assign({scheme:"null"},E):{scheme:"null"},{parsed:ee,malformedAuthorityOrPort:ge,malformedPercentEncoding:_e,malformedSchemeSpecific:ve,malformedHost:Ie,malformedScheme:Le}=Ae(M,A),{parsed:Q,malformedAuthorityOrPort:he,malformedPercentEncoding:Se,malformedSchemeSpecific:we,malformedHost:$e,malformedScheme:Te}=Ae(b,A);if(ge||he||_e||Se||ve||we||Ie||$e||Le||Te)throw Error(ee.error||Q.error||"URI is malformed.");let Ne=ae(ee,Q,A,!0),xe=B(E&&E.scheme||Ne.scheme),De=Ne.host,Fe=De!==void 0&&De!==""&&(U(De)||p(De).isIPV6);Ce(Ne,E||{},xe,Fe);let Ve=De&&De.indexOf("%")!==-1&&!/\P{ASCII}/u.test(De);if(Ne.error&&!Ve)throw Error(Ne.error);return A.skipEscape=!0,k(Ne,A)}function ae(M,b,E,A){let ee={};if(!A)M=Me(k(M,E),E),b=Me(k(b,E),E);if(E=E||{},!E.tolerant&&b.scheme)ee.scheme=b.scheme,ee.userinfo=b.userinfo,ee.host=b.host,ee.port=b.port,ee.path=f(b.path||""),ee.query=b.query;else{if(b.userinfo!==void 0||b.host!==void 0||b.port!==void 0)ee.userinfo=b.userinfo,ee.host=b.host,ee.port=b.port,ee.path=f(b.path||""),ee.query=b.query;else{if(!b.path)if(ee.path=M.path,b.query!==void 0)ee.query=b.query;else ee.query=M.query;else{if(b.path[0]==="/")ee.path=f(b.path);else{if((M.userinfo!==void 0||M.host!==void 0||M.port!==void 0)&&!M.path)ee.path="/"+b.path;else if(!M.path)ee.path=b.path;else ee.path=M.path.slice(0,M.path.lastIndexOf("/")+1)+b.path;ee.path=f(ee.path)}ee.query=b.query}ee.userinfo=M.userinfo,ee.host=M.host,ee.port=M.port}ee.scheme=M.scheme}return ee.fragment=b.fragment,ee}function H(M,b,E){let A=te(M,E),ee=te(b,E);return A!==void 0&&ee!==void 0&&A===ee}function k(M,b){let E={host:M.host,scheme:M.scheme,userinfo:M.userinfo,port:M.port,path:M.path,query:M.query,nid:M.nid,nss:M.nss,uuid:M.uuid,fragment:M.fragment,reference:M.reference,resourceName:M.resourceName,secure:M.secure,error:""},A=Object.assign({},b),ee=[];if(E.scheme)E.scheme=Z(E.scheme);let ge=B(A.scheme||E.scheme);if(ge&&ge.serialize)ge.serialize(E,A);let _e=E.userinfo!==void 0||E.host!==void 0||E.port!==void 0,ve=!A.skipEscape&&E.scheme===void 0&&!_e;if(E.path!==void 0)if(!A.skipEscape)E.path=z(E.path,ve);else E.path=S(E.path);if(A.reference!=="suffix"&&E.scheme)E.scheme=Z(E.scheme),ee.push(E.scheme,":");let Ie=g(E);if(Ie!==void 0){if(A.reference!=="suffix")ee.push("//");if(ee.push(Ie),E.path&&E.path[0]!=="/")ee.push("/")}if(E.path!==void 0){let Le=E.path;if(!A.absolutePath&&(!ge||!ge.absolutePath))Le=f(Le);if(ve)Le=z(Le,!0);if(Ie===void 0&&Le[0]==="/"&&Le[1]==="/")Le="/%2F"+Le.slice(2);ee.push(Le)}if(E.query!==void 0)ee.push("?",T(E.query));if(E.fragment!==void 0)ee.push("#",O(E.fragment));return ee.join("")}let D=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u,se=/^(?:[^#/:?]+:)?\/\/([^/?#]*)/,pe=/^(?:[^#/:?]+:)?([/\\\t\n\r]*)/;function ie(M,b){if(b[2]!==void 0&&M.path&&M.path[0]!=="/")return'URI path must start with "/" when authority is present.';if(typeof M.port==="number"&&(M.port<0||M.port>65535))return"URI port is malformed."}function fe(M){if(M===void 0)return!1;let b=M.indexOf("%");while(b!==-1){if(b+2>=M.length||!/^[\da-f]{2}$/iu.test(M.slice(b+1,b+3)))return!0;b=M.indexOf("%",b+3)}return!1}function Re(M){return M[0]==="["&&M[M.length-1]==="]"}function ze(M){let b=M[4];return fe(M[3])||b!==void 0&&!Re(b)&&fe(b)||fe(M[6])||fe(M[7])||fe(M[8])}function Ce(M,b,E,A){if(!b.unicodeSupport&&(!E||!E.unicodeSupport)&&M.host&&!Re(M.host)&&(b.domainHost||E&&E.domainHost)&&A===!1&&F(M.host))try{M.host=new URL("http://"+M.host).hostname}catch(ee){return M.error=M.error||"Host's domain name can not be converted to ASCII: "+ee,!0}return!1}function Ae(M,b){let E=Object.assign({},b),A={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0},ee=!1,ge=!1,_e=!1,ve=!1,Ie=!1,Le=!1,Q=!1;if(E.reference==="suffix")if(E.scheme)M=E.scheme+":"+M;else M="//"+M;let he=M.match(se);if(he!==null&&he[1].indexOf("\\")!==-1)A.error="URI authority must not contain a literal backslash.",ee=!0;let Se=M.match(pe);if(Se!==null){let $e=Se[1],Te=$e.replace(/[\t\n\r]/g,"");if(Te.length>=2){if(Te.slice(0,2)!=="//")A.error=A.error||"URI authority must not contain a literal backslash.",ee=!0;else if($e.length!==Te.length)A.error=A.error||"URI authority introducer must not contain whitespace.",ee=!0}}let we=M.match(D);if(we){if(A.scheme=we[1],A.userinfo=we[3],A.host=we[4],A.port=parseInt(we[5],10),A.path=we[6]||"",A.query=we[7],A.fragment=we[8],A.scheme!==void 0){let Ne=unescape(A.scheme);if(x.test(Ne))A.scheme=Ne.toLowerCase();else A.error=A.error||"URI scheme is malformed.",Le=!0}if(ge=ze(we),ge)A.error=A.error||"URI contains malformed percent-encoding.";if(isNaN(A.port))A.port=we[5];let $e=ie(A,we);if($e!==void 0)A.error=A.error||$e,ee=!0;if(A.host)if(U(A.host)===!1){let Ne=Re(A.host),xe=A.host.indexOf("[")!==-1||A.host.indexOf("]")!==-1,De=p(A.host);if(Q=De.isIPV6||De.isIPVFuture===!0,Ie=xe&&(!Ne||De.error===!0),A.host=Q?De.host:De.host.toLowerCase(),Ie)A.error=A.error||"URI host is malformed.",ee=!0}else Q=!0;if(A.scheme===void 0&&A.userinfo===void 0&&A.host===void 0&&A.port===void 0&&A.query===void 0&&!A.path)A.reference="same-document";else if(A.scheme===void 0)A.reference="relative";else if(A.fragment===void 0)A.reference="absolute";else A.reference="uri";if(E.reference&&E.reference!=="suffix"&&E.reference!==A.reference)A.error=A.error||"URI is not a "+E.reference+" reference.";let Te=B(E.scheme||A.scheme);if(!Ie)ve=Ce(A,E,Te,Q);if(M.indexOf("%")!==-1&&A.host!==void 0&&!Ie){let Ne=Q?A.host:S(A.host,!0);if(!Q)Ne=S(Ne.toLowerCase());A.host=C(Ne,Q)}if(!Te||Te&&!Te.skipNormalize){if(A.path)A.path=y(A.path);if(A.query)A.query=v(A.query);if(A.fragment)A.fragment=v(A.fragment)}if(Te&&Te.parse){if(Te.parse(A,E),Te===V.urn&&A.nid===void 0)_e=!0}}else A.error=A.error||"URI can not be parsed.";return{parsed:A,malformedAuthorityOrPort:ee,malformedPercentEncoding:ge,malformedSchemeSpecific:_e,malformedHost:ve,malformedScheme:Le}}function Me(M,b){return Ae(M,b).parsed}function Ue(M,b){return je(M,b).normalized}function je(M,b){let{parsed:E,malformedAuthorityOrPort:A,malformedPercentEncoding:ee,malformedSchemeSpecific:ge,malformedHost:_e,malformedScheme:ve}=Ae(M,b);return{normalized:A||ee||ge||_e||ve?M:k(E,b),malformedAuthorityOrPort:A,malformedPercentEncoding:ee,malformedSchemeSpecific:ge,malformedHost:_e,malformedScheme:ve}}function te(M,b){if(typeof M!=="string"&&typeof M!=="object")return;let E;try{E=typeof M==="string"?M:k(M,b)}catch{return}let{normalized:A,malformedAuthorityOrPort:ee,malformedPercentEncoding:ge,malformedSchemeSpecific:_e,malformedHost:ve,malformedScheme:Ie}=je(E,b);return ee||ge||_e||ve||Ie?void 0:A}let me={SCHEMES:V,normalize:L,resolve:K,resolveComponent:ae,equal:H,serialize:k,parse:Me};h.exports=me,h.exports.default=me,h.exports.fastUri=me});var Dd=ye((m)=>{Object.defineProperty(m,"__esModule",{value:!0});let h=Ld();h.code='require("ajv/dist/runtime/uri").default',m.default=h}),ki=ye((m)=>{Object.defineProperty(m,"__esModule",{value:!0}),m.CodeGen=m.Name=m.nil=m.stringify=m.str=m._=m.KeywordCxt=void 0;var h=Nr();Object.defineProperty(m,"KeywordCxt",{enumerable:!0,get:function(){return h.KeywordCxt}});var p=qe();Object.defineProperty(m,"_",{enumerable:!0,get:function(){return p._}}),Object.defineProperty(m,"str",{enumerable:!0,get:function(){return p.str}}),Object.defineProperty(m,"stringify",{enumerable:!0,get:function(){return p.stringify}}),Object.defineProperty(m,"nil",{enumerable:!0,get:function(){return p.nil}}),Object.defineProperty(m,"Name",{enumerable:!0,get:function(){return p.Name}}),Object.defineProperty(m,"CodeGen",{enumerable:!0,get:function(){return p.CodeGen}});let f=xs(),g=kr(),S=al(),y=Rn(),z=qe(),v=bn(),T=vn(),O=ke(),C=Md(),U=Dd(),F=(te,me)=>new RegExp(te,me);F.code="new RegExp";let V=["removeAdditional","useDefaults","coerceTypes"],B=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),x={errorDataPath:"",format:"`validateFormats: false` can be used instead.",nullable:'"nullable" keyword is supported by default.',jsonPointers:"Deprecated jsPropertySyntax can be used instead.",extendRefs:"Deprecated ignoreKeywordsWithRef can be used instead.",missingRefs:"Pass empty schema with $id that should be ignored to ajv.addSchema.",processCode:"Use option `code: {process: (code, schemaEnv: object) => string}`",sourceCode:"Use option `code: {source: true}`",strictDefaults:"It is default now, see option `strict`.",strictKeywords:"It is default now, see option `strict`.",uniqueItems:'"uniqueItems" keyword is always validated.',unknownFormats:"Disable strict mode or pass `true` to `ajv.addFormat` (or `formats` option).",cache:"Map is used as cache, schema object as key.",serialize:"Map is used as cache, schema object as key.",ajvErrors:"It is default now."},q={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},Z=200;function L(te){var me,M,b,E,A,ee,ge,_e,ve,Ie,Le,Q,he,Se,we,$e,Te,Ne,xe,De,Fe,Ve,it,We,gt;let lt=te.strict,St=(me=te.code)===null||me===void 0?void 0:me.optimize,wt=St===!0||St===void 0?1:St||0,$t=(b=(M=te.code)===null||M===void 0?void 0:M.regExp)!==null&&b!==void 0?b:F,Ut=(E=te.uriResolver)!==null&&E!==void 0?E:U.default;return{strictSchema:(ee=(A=te.strictSchema)!==null&&A!==void 0?A:lt)!==null&&ee!==void 0?ee:!0,strictNumbers:(_e=(ge=te.strictNumbers)!==null&&ge!==void 0?ge:lt)!==null&&_e!==void 0?_e:!0,strictTypes:(Ie=(ve=te.strictTypes)!==null&&ve!==void 0?ve:lt)!==null&&Ie!==void 0?Ie:"log",strictTuples:(Q=(Le=te.strictTuples)!==null&&Le!==void 0?Le:lt)!==null&&Q!==void 0?Q:"log",strictRequired:(Se=(he=te.strictRequired)!==null&&he!==void 0?he:lt)!==null&&Se!==void 0?Se:!1,code:te.code?{...te.code,optimize:wt,regExp:$t}:{optimize:wt,regExp:$t},loopRequired:(we=te.loopRequired)!==null&&we!==void 0?we:Z,loopEnum:($e=te.loopEnum)!==null&&$e!==void 0?$e:Z,meta:(Te=te.meta)!==null&&Te!==void 0?Te:!0,messages:(Ne=te.messages)!==null&&Ne!==void 0?Ne:!0,inlineRefs:(xe=te.inlineRefs)!==null&&xe!==void 0?xe:!0,schemaId:(De=te.schemaId)!==null&&De!==void 0?De:"$id",addUsedSchema:(Fe=te.addUsedSchema)!==null&&Fe!==void 0?Fe:!0,validateSchema:(Ve=te.validateSchema)!==null&&Ve!==void 0?Ve:!0,validateFormats:(it=te.validateFormats)!==null&&it!==void 0?it:!0,unicodeRegExp:(We=te.unicodeRegExp)!==null&&We!==void 0?We:!0,int32range:(gt=te.int32range)!==null&>!==void 0?gt:!0,uriResolver:Ut}}var K=class{constructor(te={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,te=this.opts={...te,...L(te)};let{es5:me,lines:M}=this.opts.code;this.scope=new z.ValueScope({scope:{},prefixes:B,es5:me,lines:M}),this.logger=fe(te.logger);let b=te.validateFormats;if(te.validateFormats=!1,this.RULES=(0,S.getRules)(),ae.call(this,x,te,"NOT SUPPORTED"),ae.call(this,q,te,"DEPRECATED","warn"),this._metaOpts=pe.call(this),te.formats)D.call(this);if(this._addVocabularies(),this._addDefaultMetaSchema(),te.keywords)se.call(this,te.keywords);if(typeof te.meta=="object")this.addMetaSchema(te.meta);k.call(this),te.validateFormats=b}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:te,meta:me,schemaId:M}=this.opts,b=C;if(M==="id")b={...C},b.id=b.$id,delete b.$id;if(me&&te)this.addMetaSchema(b,b[M],!1)}defaultMeta(){let{meta:te,schemaId:me}=this.opts;return this.opts.defaultMeta=typeof te=="object"?te[me]||te:void 0}validate(te,me){let M;if(typeof te=="string"){if(M=this.getSchema(te),!M)throw Error(`no schema with key or ref "${te}"`)}else M=this.compile(te);let b=M(me);if(!("$async"in M))this.errors=M.errors;return b}compile(te,me){let M=this._addSchema(te,me);return M.validate||this._compileSchemaEnv(M)}compileAsync(te,me){if(typeof this.opts.loadSchema!="function")throw Error("options.loadSchema should be a function");let{loadSchema:M}=this.opts;return b.call(this,te,me);async function b(ve,Ie){await E.call(this,ve.$schema);let Le=this._addSchema(ve,Ie);return Le.validate||A.call(this,Le)}async function E(ve){if(ve&&!this.getSchema(ve))await b.call(this,{$ref:ve},!0)}async function A(ve){try{return this._compileSchemaEnv(ve)}catch(Ie){if(!(Ie instanceof g.default))throw Ie;return ee.call(this,Ie),await ge.call(this,Ie.missingSchema),A.call(this,ve)}}function ee({missingSchema:ve,missingRef:Ie}){if(this.refs[ve])throw Error(`AnySchema ${ve} is loaded but ${Ie} cannot be resolved`)}async function ge(ve){let Ie=await _e.call(this,ve);if(!this.refs[ve])await E.call(this,Ie.$schema);if(!this.refs[ve])this.addSchema(Ie,ve,me)}async function _e(ve){let Ie=this._loading[ve];if(Ie)return Ie;try{return await(this._loading[ve]=M(ve))}finally{delete this._loading[ve]}}}addSchema(te,me,M,b=this.opts.validateSchema){if(Array.isArray(te)){for(let A of te)this.addSchema(A,void 0,M,b);return this}let E;if(typeof te==="object"){let{schemaId:A}=this.opts;if(E=te[A],E!==void 0&&typeof E!="string")throw Error(`schema ${A} must be string`)}return me=(0,v.normalizeId)(me||E),this._checkUnique(me),this.schemas[me]=this._addSchema(te,M,me,b,!0),this}addMetaSchema(te,me,M=this.opts.validateSchema){return this.addSchema(te,me,!0,M),this}validateSchema(te,me){if(typeof te=="boolean")return!0;let M;if(M=te.$schema,M!==void 0&&typeof M!="string")throw Error("$schema must be a string");if(M=M||this.opts.defaultMeta||this.defaultMeta(),!M)return this.logger.warn("meta-schema not available"),this.errors=null,!0;let b=this.validate(M,te);if(!b&&me){let E="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(E);else throw Error(E)}return b}getSchema(te){let me;while(typeof(me=H.call(this,te))=="string")te=me;if(me===void 0){let{schemaId:M}=this.opts,b=new y.SchemaEnv({schema:{},schemaId:M});if(me=y.resolveSchema.call(this,b,te),!me)return;this.refs[te]=me}return me.validate||this._compileSchemaEnv(me)}removeSchema(te){if(te instanceof RegExp)return this._removeAllSchemas(this.schemas,te),this._removeAllSchemas(this.refs,te),this;switch(typeof te){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{let me=H.call(this,te);if(typeof me=="object")this._cache.delete(me.schema);return delete this.schemas[te],delete this.refs[te],this}case"object":{let me=te;this._cache.delete(me);let M=te[this.opts.schemaId];if(M)M=(0,v.normalizeId)(M),delete this.schemas[M],delete this.refs[M];return this}default:throw Error("ajv.removeSchema: invalid parameter")}}addVocabulary(te){for(let me of te)this.addKeyword(me);return this}addKeyword(te,me){let M;if(typeof te=="string"){if(M=te,typeof me=="object")this.logger.warn("these parameters are deprecated, see docs for addKeyword"),me.keyword=M}else if(typeof te=="object"&&me===void 0){if(me=te,M=me.keyword,Array.isArray(M)&&!M.length)throw Error("addKeywords: keyword must be string or non-empty array")}else throw Error("invalid addKeywords parameters");if(ze.call(this,M,me),!me)return(0,O.eachItem)(M,(E)=>Ce.call(this,E)),this;Me.call(this,me);let b={...me,type:(0,T.getJSONTypes)(me.type),schemaType:(0,T.getJSONTypes)(me.schemaType)};return(0,O.eachItem)(M,b.type.length===0?(E)=>Ce.call(this,E,b):(E)=>b.type.forEach((A)=>Ce.call(this,E,b,A))),this}getKeyword(te){let me=this.RULES.all[te];return typeof me=="object"?me.definition:!!me}removeKeyword(te){let{RULES:me}=this;delete me.keywords[te],delete me.all[te];for(let M of me.rules){let b=M.rules.findIndex((E)=>E.keyword===te);if(b>=0)M.rules.splice(b,1)}return this}addFormat(te,me){if(typeof me=="string")me=new RegExp(me);return this.formats[te]=me,this}errorsText(te=this.errors,{separator:me=", ",dataVar:M="data"}={}){if(!te||te.length===0)return"No errors";return te.map((b)=>`${M}${b.instancePath} ${b.message}`).reduce((b,E)=>b+me+E)}$dataMetaSchema(te,me){let M=this.RULES.all;te=JSON.parse(JSON.stringify(te));for(let b of me){let E=b.split("/").slice(1),A=te;for(let ee of E)A=A[ee];for(let ee in M){let ge=M[ee];if(typeof ge!="object")continue;let{$data:_e}=ge.definition,ve=A[ee];if(_e&&ve)A[ee]=je(ve)}}return te}_removeAllSchemas(te,me){for(let M in te){let b=te[M];if(!me||me.test(M)){if(typeof b=="string")delete te[M];else if(b&&!b.meta)this._cache.delete(b.schema),delete te[M]}}}_addSchema(te,me,M,b=this.opts.validateSchema,E=this.opts.addUsedSchema){let A,{schemaId:ee}=this.opts;if(typeof te=="object")A=te[ee];else if(this.opts.jtd)throw Error("schema must be object");else if(typeof te!="boolean")throw Error("schema must be object or boolean");let ge=this._cache.get(te);if(ge!==void 0)return ge;M=(0,v.normalizeId)(A||M);let _e=v.getSchemaRefs.call(this,te,M);if(ge=new y.SchemaEnv({schema:te,schemaId:ee,meta:me,baseId:M,localRefs:_e}),this._cache.set(ge.schema,ge),E&&!M.startsWith("#")){if(M)this._checkUnique(M);this.refs[M]=ge}if(b)this.validateSchema(te,!0);return ge}_checkUnique(te){if(this.schemas[te]||this.refs[te])throw Error(`schema with key or id "${te}" already exists`)}_compileSchemaEnv(te){if(te.meta)this._compileMetaSchema(te);else y.compileSchema.call(this,te);if(!te.validate)throw Error("ajv implementation error");return te.validate}_compileMetaSchema(te){let me=this.opts;this.opts=this._metaOpts;try{y.compileSchema.call(this,te)}finally{this.opts=me}}};K.ValidationError=f.default,K.MissingRefError=g.default,m.default=K;function ae(te,me,M,b="error"){for(let E in te){let A=E;if(A in me)this.logger[b](`${M}: option ${E}. ${te[A]}`)}}function H(te){return te=(0,v.normalizeId)(te),this.schemas[te]||this.refs[te]}function k(){let te=this.opts.schemas;if(!te)return;if(Array.isArray(te))this.addSchema(te);else for(let me in te)this.addSchema(te[me],me)}function D(){for(let te in this.opts.formats){let me=this.opts.formats[te];if(me)this.addFormat(te,me)}}function se(te){if(Array.isArray(te)){this.addVocabulary(te);return}this.logger.warn("keywords option as map is deprecated, pass array");for(let me in te){let M=te[me];if(!M.keyword)M.keyword=me;this.addKeyword(M)}}function pe(){let te={...this.opts};for(let me of V)delete te[me];return te}let ie={log(){},warn(){},error(){}};function fe(te){if(te===!1)return ie;if(te===void 0)return console;if(te.log&&te.warn&&te.error)return te;throw Error("logger must implement log, warn and error methods")}let Re=/^[a-z_$][a-z0-9_$:-]*$/i;function ze(te,me){let{RULES:M}=this;if((0,O.eachItem)(te,(b)=>{if(M.keywords[b])throw Error(`Keyword ${b} is already defined`);if(!Re.test(b))throw Error(`Keyword ${b} has invalid name`)}),!me)return;if(me.$data&&!(("code"in me)||("validate"in me)))throw Error('$data keyword must have "code" or "validate" function')}function Ce(te,me,M){var b;let E=me===null||me===void 0?void 0:me.post;if(M&&E)throw Error('keyword with "post" flag cannot have "type"');let{RULES:A}=this,ee=E?A.post:A.rules.find(({type:_e})=>_e===M);if(!ee)ee={type:M,rules:[]},A.rules.push(ee);if(A.keywords[te]=!0,!me)return;let ge={keyword:te,definition:{...me,type:(0,T.getJSONTypes)(me.type),schemaType:(0,T.getJSONTypes)(me.schemaType)}};if(me.before)Ae.call(this,ee,ge,me.before);else ee.rules.push(ge);A.all[te]=ge,(b=me.implements)===null||b===void 0||b.forEach((_e)=>this.addKeyword(_e))}function Ae(te,me,M){let b=te.rules.findIndex((E)=>E.keyword===M);if(b>=0)te.rules.splice(b,0,me);else te.rules.push(me),this.logger.warn(`rule ${M} is not defined`)}function Me(te){let{metaSchema:me}=te;if(me===void 0)return;if(te.$data&&this.opts.$data)me=je(me);te.validateSchema=this.compile(me,!0)}let Ue={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function je(te){return{anyOf:[te,Ue]}}}),Ud=ye((m)=>{Object.defineProperty(m,"__esModule",{value:!0});let h={keyword:"id",code(){throw Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};m.default=h}),Mi=ye((m)=>{Object.defineProperty(m,"__esModule",{value:!0}),m.callRef=m.getValidate=void 0;let h=kr(),p=mt(),f=qe(),g=dt(),S=Rn(),y=ke(),z={keyword:"$ref",schemaType:"string",code(O){let{gen:C,schema:U,it:F}=O,{baseId:V,schemaEnv:B,validateName:x,opts:q,self:Z}=F,{root:L}=B;if((U==="#"||U==="#/")&&V===L.baseId)return ae();let K=S.resolveRef.call(Z,L,V,U);if(K===void 0)throw new h.default(F.opts.uriResolver,V,U);if(K instanceof S.SchemaEnv)return H(K);return k(K);function ae(){if(B===L)return T(O,x,B,B.$async);let D=C.scopeValue("root",{ref:L});return T(O,f._`${D}.validate`,L,L.$async)}function H(D){T(O,v(O,D),D,D.$async)}function k(D){let se=C.scopeValue("schema",q.code.source===!0?{ref:D,code:(0,f.stringify)(D)}:{ref:D}),pe=C.name("valid"),ie=O.subschema({schema:D,dataTypes:[],schemaPath:f.nil,topSchemaRef:se,errSchemaPath:U},pe);O.mergeEvaluated(ie),O.ok(pe)}}};function v(O,C){let{gen:U}=O;return C.validate?U.scopeValue("validate",{ref:C.validate}):f._`${U.scopeValue("wrapper",{ref:C})}.validate`}m.getValidate=v;function T(O,C,U,F){let{gen:V,it:B}=O,{allErrors:x,schemaEnv:q,opts:Z}=B,L=Z.passContext?g.default.this:f.nil;if(F)K();else ae();function K(){if(!q.$async)throw Error("async schema referenced by sync schema");let D=V.let("valid");V.try(()=>{if(V.code(f._`await ${(0,p.callValidateCode)(O,C,L)}`),k(C),!x)V.assign(D,!0)},(se)=>{if(V.if(f._`!(${se} instanceof ${B.ValidationError})`,()=>V.throw(se)),H(se),!x)V.assign(D,!1)}),O.ok(D)}function ae(){O.result((0,p.callValidateCode)(O,C,L),()=>k(C),()=>H(C))}function H(D){let se=f._`${D}.errors`;V.assign(g.default.vErrors,f._`${g.default.vErrors} === null ? ${se} : ${g.default.vErrors}.concat(${se})`),V.assign(g.default.errors,f._`${g.default.vErrors}.length`)}function k(D){var se;if(!B.opts.unevaluated)return;let pe=(se=U===null||U===void 0?void 0:U.validate)===null||se===void 0?void 0:se.evaluated;if(B.props!==!0)if(pe&&!pe.dynamicProps){if(pe.props!==void 0)B.props=y.mergeEvaluated.props(V,pe.props,B.props)}else{let ie=V.var("props",f._`${D}.evaluated.props`);B.props=y.mergeEvaluated.props(V,ie,B.props,f.Name)}if(B.items!==!0)if(pe&&!pe.dynamicItems){if(pe.items!==void 0)B.items=y.mergeEvaluated.items(V,pe.items,B.items)}else{let ie=V.var("items",f._`${D}.evaluated.items`);B.items=y.mergeEvaluated.items(V,ie,B.items,f.Name)}}}m.callRef=T,m.default=z}),ll=ye((m)=>{Object.defineProperty(m,"__esModule",{value:!0});let h=Ud(),p=Mi(),f=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",h.default,p.default];m.default=f}),Vd=ye((m)=>{Object.defineProperty(m,"__esModule",{value:!0});let h=qe(),p=h.operators,f={maximum:{okStr:"<=",ok:p.LTE,fail:p.GT},minimum:{okStr:">=",ok:p.GTE,fail:p.LT},exclusiveMaximum:{okStr:"<",ok:p.LT,fail:p.GTE},exclusiveMinimum:{okStr:">",ok:p.GT,fail:p.LTE}},g={keyword:Object.keys(f),type:"number",schemaType:"number",$data:!0,error:{message:({keyword:S,schemaCode:y})=>h.str`must be ${f[S].okStr} ${y}`,params:({keyword:S,schemaCode:y})=>h._`{comparison: ${f[S].okStr}, limit: ${y}}`},code(S){let{keyword:y,data:z,schemaCode:v}=S;S.fail$data(h._`${z} ${f[y].fail} ${v} || isNaN(${z})`)}};m.default=g}),Hd=ye((m)=>{Object.defineProperty(m,"__esModule",{value:!0});let h=qe(),p={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:{message:({schemaCode:f})=>h.str`must be multiple of ${f}`,params:({schemaCode:f})=>h._`{multipleOf: ${f}}`},code(f){let{gen:g,data:S,schemaCode:y,it:z}=f,v=z.opts.multipleOfPrecision,T=g.let("res"),O=v?h._`Math.abs(Math.round(${T}) - ${T}) > 1e-${v}`:h._`${T} !== parseInt(${T})`;f.fail$data(h._`(${y} === 0 || (${T} = ${S}/${y}, ${O}))`)}};m.default=p}),xd=ye((m)=>{Object.defineProperty(m,"__esModule",{value:!0});function h(p){let f=p.length,g=0,S=0,y;while(S<f)if(g++,y=p.charCodeAt(S++),y>=55296&&y<=56319&&S<f){if(y=p.charCodeAt(S),(y&64512)===56320)S++}return g}m.default=h,h.code='require("ajv/dist/runtime/ucs2length").default'}),Fd=ye((m)=>{Object.defineProperty(m,"__esModule",{value:!0});let h=qe(),p=ke(),f=xd(),g={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:{message({keyword:S,schemaCode:y}){let z=S==="maxLength"?"more":"fewer";return h.str`must NOT have ${z} than ${y} characters`},params:({schemaCode:S})=>h._`{limit: ${S}}`},code(S){let{keyword:y,data:z,schemaCode:v,it:T}=S,O=y==="maxLength"?h.operators.GT:h.operators.LT,C=T.opts.unicode===!1?h._`${z}.length`:h._`${(0,p.useFunc)(S.gen,f.default)}(${z})`;S.fail$data(h._`${C} ${O} ${v}`)}};m.default=g}),Bd=ye((m)=>{Object.defineProperty(m,"__esModule",{value:!0});let h=mt(),p=ke(),f=qe(),g={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:{message:({schemaCode:S})=>f.str`must match pattern "${S}"`,params:({schemaCode:S})=>f._`{pattern: ${S}}`},code(S){let{gen:y,data:z,$data:v,schema:T,schemaCode:O,it:C}=S,U=C.opts.unicodeRegExp?"u":"";if(v){let{regExp:F}=C.opts.code,V=F.code==="new RegExp"?f._`new RegExp`:(0,p.useFunc)(y,F),B=y.let("valid");y.try(()=>y.assign(B,f._`${V}(${O}, ${U}).test(${z})`),()=>y.assign(B,!1)),S.fail$data(f._`!${B}`)}else{let F=(0,h.usePattern)(S,T);S.fail$data(f._`!${F}.test(${z})`)}}};m.default=g}),Jd=ye((m)=>{Object.defineProperty(m,"__esModule",{value:!0});let h=qe(),p={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:{message({keyword:f,schemaCode:g}){let S=f==="maxProperties"?"more":"fewer";return h.str`must NOT have ${S} than ${g} properties`},params:({schemaCode:f})=>h._`{limit: ${f}}`},code(f){let{keyword:g,data:S,schemaCode:y}=f,z=g==="maxProperties"?h.operators.GT:h.operators.LT;f.fail$data(h._`Object.keys(${S}).length ${z} ${y}`)}};m.default=p}),Kd=ye((m)=>{Object.defineProperty(m,"__esModule",{value:!0});let h=mt(),p=qe(),f=ke(),g={keyword:"required",type:"object",schemaType:"array",$data:!0,error:{message:({params:{missingProperty:S}})=>p.str`must have required property '${S}'`,params:({params:{missingProperty:S}})=>p._`{missingProperty: ${S}}`},code(S){let{gen:y,schema:z,schemaCode:v,data:T,$data:O,it:C}=S,{opts:U}=C;if(!O&&z.length===0)return;let F=z.length>=U.loopRequired;if(C.allErrors)V();else B();if(U.strictRequired){let Z=S.parentSchema.properties,{definedProperties:L}=S.it;for(let K of z)if((Z===null||Z===void 0?void 0:Z[K])===void 0&&!L.has(K)){let ae=`required property "${K}" is not defined at "${C.schemaEnv.baseId+C.errSchemaPath}" (strictRequired)`;(0,f.checkStrictMode)(C,ae,C.opts.strictRequired)}}function V(){if(F||O)S.block$data(p.nil,x);else for(let Z of z)(0,h.checkReportMissingProp)(S,Z)}function B(){let Z=y.let("missing");if(F||O){let L=y.let("valid",!0);S.block$data(L,()=>q(Z,L)),S.ok(L)}else y.if((0,h.checkMissingProp)(S,z,Z)),(0,h.reportMissingProp)(S,Z),y.else()}function x(){y.forOf("prop",v,(Z)=>{S.setParams({missingProperty:Z}),y.if((0,h.noPropertyInData)(y,T,Z,U.ownProperties),()=>S.error())})}function q(Z,L){S.setParams({missingProperty:Z}),y.forOf(Z,v,()=>{y.assign(L,(0,h.propertyInData)(y,T,Z,U.ownProperties)),y.if((0,p.not)(L),()=>{S.error(),y.break()})},p.nil)}}};m.default=g}),Gd=ye((m)=>{Object.defineProperty(m,"__esModule",{value:!0});let h=qe(),p={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:{message({keyword:f,schemaCode:g}){let S=f==="maxItems"?"more":"fewer";return h.str`must NOT have ${S} than ${g} items`},params:({schemaCode:f})=>h._`{limit: ${f}}`},code(f){let{keyword:g,data:S,schemaCode:y}=f,z=g==="maxItems"?h.operators.GT:h.operators.LT;f.fail$data(h._`${S}.length ${z} ${y}`)}};m.default=p}),Ai=ye((m)=>{Object.defineProperty(m,"__esModule",{value:!0});let h=il();h.code='require("ajv/dist/runtime/equal").default',m.default=h}),Wd=ye((m)=>{Object.defineProperty(m,"__esModule",{value:!0});let h=vn(),p=qe(),f=ke(),g=Ai(),S={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:{message:({params:{i:y,j:z}})=>p.str`must NOT have duplicate items (items ## ${z} and ${y} are identical)`,params:({params:{i:y,j:z}})=>p._`{i: ${y}, j: ${z}}`},code(y){let{gen:z,data:v,$data:T,schema:O,parentSchema:C,schemaCode:U,it:F}=y;if(!T&&!O)return;let V=z.let("valid"),B=C.items?(0,h.getSchemaTypes)(C.items):[];y.block$data(V,x,p._`${U} === false`),y.ok(V);function x(){let K=z.let("i",p._`${v}.length`),ae=z.let("j");y.setParams({i:K,j:ae}),z.assign(V,!0),z.if(p._`${K} > 1`,()=>(q()?Z:L)(K,ae))}function q(){return B.length>0&&!B.some((K)=>K==="object"||K==="array")}function Z(K,ae){let H=z.name("item"),k=(0,h.checkDataTypes)(B,H,F.opts.strictNumbers,h.DataType.Wrong),D=z.const("indices",p._`{}`);z.for(p._`;${K}--;`,()=>{if(z.let(H,p._`${v}[${K}]`),z.if(k,p._`continue`),B.length>1)z.if(p._`typeof ${H} == "string"`,p._`${H} += "_"`);z.if(p._`typeof ${D}[${H}] == "number"`,()=>{z.assign(ae,p._`${D}[${H}]`),y.error(),z.assign(V,!1).break()}).code(p._`${D}[${H}] = ${K}`)})}function L(K,ae){let H=(0,f.useFunc)(z,g.default),k=z.name("outer");z.label(k).for(p._`;${K}--;`,()=>z.for(p._`${ae} = ${K}; ${ae}--;`,()=>z.if(p._`${H}(${v}[${K}], ${v}[${ae}])`,()=>{y.error(),z.assign(V,!1).break(k)})))}}};m.default=S}),Yd=ye((m)=>{Object.defineProperty(m,"__esModule",{value:!0});let h=qe(),p=ke(),f=Ai(),g={keyword:"const",$data:!0,error:{message:"must be equal to constant",params:({schemaCode:S})=>h._`{allowedValue: ${S}}`},code(S){let{gen:y,data:z,$data:v,schemaCode:T,schema:O}=S;if(v||O&&typeof O=="object")S.fail$data(h._`!${(0,p.useFunc)(y,f.default)}(${z}, ${T})`);else S.fail(h._`${O} !== ${z}`)}};m.default=g}),Zd=ye((m)=>{Object.defineProperty(m,"__esModule",{value:!0});let h=qe(),p=ke(),f=Ai(),g={keyword:"enum",schemaType:"array",$data:!0,error:{message:"must be equal to one of the allowed values",params:({schemaCode:S})=>h._`{allowedValues: ${S}}`},code(S){let{gen:y,data:z,$data:v,schema:T,schemaCode:O,it:C}=S;if(!v&&T.length===0)throw Error("enum must have non-empty array");let U=T.length>=C.opts.loopEnum,F,V=()=>F!==null&&F!==void 0?F:F=(0,p.useFunc)(y,f.default),B;if(U||v)B=y.let("valid"),S.block$data(B,x);else{if(!Array.isArray(T))throw Error("ajv implementation error");let Z=y.const("vSchema",O);B=(0,h.or)(...T.map((L,K)=>q(Z,K)))}S.pass(B);function x(){y.assign(B,!1),y.forOf("v",O,(Z)=>y.if(h._`${V()}(${z}, ${Z})`,()=>y.assign(B,!0).break()))}function q(Z,L){let K=T[L];return typeof K==="object"&&K!==null?h._`${V()}(${z}, ${Z}[${L}])`:h._`${z} === ${K}`}}};m.default=g}),ul=ye((m)=>{Object.defineProperty(m,"__esModule",{value:!0});let h=Vd(),p=Hd(),f=Fd(),g=Bd(),S=Jd(),y=Kd(),z=Gd(),v=Wd(),T=Yd(),O=Zd(),C=[h.default,p.default,f.default,g.default,S.default,y.default,z.default,v.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},T.default,O.default];m.default=C}),dl=ye((m)=>{Object.defineProperty(m,"__esModule",{value:!0}),m.validateAdditionalItems=void 0;let h=qe(),p=ke(),f={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:{message:({params:{len:S}})=>h.str`must NOT have more than ${S} items`,params:({params:{len:S}})=>h._`{limit: ${S}}`},code(S){let{parentSchema:y,it:z}=S,{items:v}=y;if(!Array.isArray(v)){(0,p.checkStrictMode)(z,'"additionalItems" is ignored when "items" is not an array of schemas');return}g(S,v)}};function g(S,y){let{gen:z,schema:v,data:T,keyword:O,it:C}=S;C.items=!0;let U=z.const("len",h._`${T}.length`);if(v===!1)S.setParams({len:y.length}),S.pass(h._`${U} <= ${y.length}`);else if(typeof v=="object"&&!(0,p.alwaysValidSchema)(C,v)){let V=z.var("valid",h._`${U} <= ${y.length}`);z.if((0,h.not)(V),()=>F(V)),S.ok(V)}function F(V){z.forRange("i",y.length,U,(B)=>{if(S.subschema({keyword:O,dataProp:B,dataPropType:p.Type.Num},V),!C.allErrors)z.if((0,h.not)(V),()=>z.break())})}}m.validateAdditionalItems=g,m.default=f}),ml=ye((m)=>{Object.defineProperty(m,"__esModule",{value:!0}),m.validateTuple=void 0;let h=qe(),p=ke(),f=mt(),g={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(y){let{schema:z,it:v}=y;if(Array.isArray(z))return S(y,"additionalItems",z);if(v.items=!0,(0,p.alwaysValidSchema)(v,z))return;y.ok((0,f.validateArray)(y))}};function S(y,z,v=y.schema){let{gen:T,parentSchema:O,data:C,keyword:U,it:F}=y;if(x(O),F.opts.unevaluated&&v.length&&F.items!==!0)F.items=p.mergeEvaluated.items(T,v.length,F.items);let V=T.name("valid"),B=T.const("len",h._`${C}.length`);v.forEach((q,Z)=>{if((0,p.alwaysValidSchema)(F,q))return;T.if(h._`${B} > ${Z}`,()=>y.subschema({keyword:U,schemaProp:Z,dataProp:Z},V)),y.ok(V)});function x(q){let{opts:Z,errSchemaPath:L}=F,K=v.length,ae=K===q.minItems&&(K===q.maxItems||q[z]===!1);if(Z.strictTuples&&!ae){let H=`"${U}" is ${K}-tuple, but minItems or maxItems/${z} are not specified or different at path "${L}"`;(0,p.checkStrictMode)(F,H,Z.strictTuples)}}}m.validateTuple=S,m.default=g}),Xd=ye((m)=>{Object.defineProperty(m,"__esModule",{value:!0});let h=ml(),p={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:(f)=>(0,h.validateTuple)(f,"items")};m.default=p}),Qd=ye((m)=>{Object.defineProperty(m,"__esModule",{value:!0});let h=qe(),p=ke(),f=mt(),g=dl(),S={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:{message:({params:{len:y}})=>h.str`must NOT have more than ${y} items`,params:({params:{len:y}})=>h._`{limit: ${y}}`},code(y){let{schema:z,parentSchema:v,it:T}=y,{prefixItems:O}=v;if(T.items=!0,(0,p.alwaysValidSchema)(T,z))return;if(O)(0,g.validateAdditionalItems)(y,O);else y.ok((0,f.validateArray)(y))}};m.default=S}),em=ye((m)=>{Object.defineProperty(m,"__esModule",{value:!0});let h=qe(),p=ke(),f={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:{message:({params:{min:g,max:S}})=>S===void 0?h.str`must contain at least ${g} valid item(s)`:h.str`must contain at least ${g} and no more than ${S} valid item(s)`,params:({params:{min:g,max:S}})=>S===void 0?h._`{minContains: ${g}}`:h._`{minContains: ${g}, maxContains: ${S}}`},code(g){let{gen:S,schema:y,parentSchema:z,data:v,it:T}=g,O,C,{minContains:U,maxContains:F}=z;if(T.opts.next)O=U===void 0?1:U,C=F;else O=1;let V=S.const("len",h._`${v}.length`);if(g.setParams({min:O,max:C}),C===void 0&&O===0){(0,p.checkStrictMode)(T,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(C!==void 0&&O>C){(0,p.checkStrictMode)(T,'"minContains" > "maxContains" is always invalid'),g.fail();return}if((0,p.alwaysValidSchema)(T,y)){let L=h._`${V} >= ${O}`;if(C!==void 0)L=h._`${L} && ${V} <= ${C}`;g.pass(L);return}T.items=!0;let B=S.name("valid");if(C===void 0&&O===1)q(B,()=>S.if(B,()=>S.break()));else if(O===0){if(S.let(B,!0),C!==void 0)S.if(h._`${v}.length > 0`,x)}else S.let(B,!1),x();g.result(B,()=>g.reset());function x(){let L=S.name("_valid"),K=S.let("count",0);q(L,()=>S.if(L,()=>Z(K)))}function q(L,K){S.forRange("i",0,V,(ae)=>{g.subschema({keyword:"contains",dataProp:ae,dataPropType:p.Type.Num,compositeRule:!0},L),K()})}function Z(L){if(S.code(h._`${L}++`),C===void 0)S.if(h._`${L} >= ${O}`,()=>S.assign(B,!0).break());else if(S.if(h._`${L} > ${C}`,()=>S.assign(B,!1).break()),O===1)S.assign(B,!0);else S.if(h._`${L} >= ${O}`,()=>S.assign(B,!0))}}};m.default=f}),Li=ye((m)=>{Object.defineProperty(m,"__esModule",{value:!0}),m.validateSchemaDeps=m.validatePropertyDeps=m.error=void 0;let h=qe(),p=ke(),f=mt();m.error={message:({params:{property:v,depsCount:T,deps:O}})=>{let C=T===1?"property":"properties";return h.str`must have ${C} ${O} when property ${v} is present`},params:({params:{property:v,depsCount:T,deps:O,missingProperty:C}})=>h._`{property: ${v},
|
|
12
|
+
missingProperty: ${C},
|
|
13
|
+
depsCount: ${T},
|
|
14
|
+
deps: ${O}}`};let g={keyword:"dependencies",type:"object",schemaType:"object",error:m.error,code(v){let[T,O]=S(v);y(v,T),z(v,O)}};function S({schema:v}){let T={},O={};for(let C in v){if(C==="__proto__")continue;let U=Array.isArray(v[C])?T:O;U[C]=v[C]}return[T,O]}function y(v,T=v.schema){let{gen:O,data:C,it:U}=v;if(Object.keys(T).length===0)return;let F=O.let("missing");for(let V in T){let B=T[V];if(B.length===0)continue;let x=(0,f.propertyInData)(O,C,V,U.opts.ownProperties);if(v.setParams({property:V,depsCount:B.length,deps:B.join(", ")}),U.allErrors)O.if(x,()=>{for(let q of B)(0,f.checkReportMissingProp)(v,q)});else O.if(h._`${x} && (${(0,f.checkMissingProp)(v,B,F)})`),(0,f.reportMissingProp)(v,F),O.else()}}m.validatePropertyDeps=y;function z(v,T=v.schema){let{gen:O,data:C,keyword:U,it:F}=v,V=O.name("valid");for(let B in T){if((0,p.alwaysValidSchema)(F,T[B]))continue;O.if((0,f.propertyInData)(O,C,B,F.opts.ownProperties),()=>{let x=v.subschema({keyword:U,schemaProp:B},V);v.mergeValidEvaluated(x,V)},()=>O.var(V,!0)),v.ok(V)}}m.validateSchemaDeps=z,m.default=g}),tm=ye((m)=>{Object.defineProperty(m,"__esModule",{value:!0});let h=qe(),p=ke(),f={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:{message:"property name must be valid",params:({params:g})=>h._`{propertyName: ${g.propertyName}}`},code(g){let{gen:S,schema:y,data:z,it:v}=g;if((0,p.alwaysValidSchema)(v,y))return;let T=S.name("valid");S.forIn("key",z,(O)=>{g.setParams({propertyName:O}),g.subschema({keyword:"propertyNames",data:O,dataTypes:["string"],propertyName:O,compositeRule:!0},T),S.if((0,h.not)(T),()=>{if(g.error(!0),!v.allErrors)S.break()})}),g.ok(T)}};m.default=f}),hl=ye((m)=>{Object.defineProperty(m,"__esModule",{value:!0});let h=mt(),p=qe(),f=dt(),g=ke(),S={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:{message:"must NOT have additional properties",params:({params:y})=>p._`{additionalProperty: ${y.additionalProperty}}`},code(y){let{gen:z,schema:v,parentSchema:T,data:O,errsCount:C,it:U}=y;if(!C)throw Error("ajv implementation error");let{allErrors:F,opts:V}=U;if(U.props=!0,V.removeAdditional!=="all"&&(0,g.alwaysValidSchema)(U,v))return;let B=(0,h.allSchemaProperties)(T.properties),x=(0,h.allSchemaProperties)(T.patternProperties);q(),y.ok(p._`${C} === ${f.default.errors}`);function q(){z.forIn("key",O,(H)=>{if(!B.length&&!x.length)K(H);else z.if(Z(H),()=>K(H))})}function Z(H){let k;if(B.length>8){let D=(0,g.schemaRefOrVal)(U,T.properties,"properties");k=(0,h.isOwnProperty)(z,D,H)}else if(B.length)k=(0,p.or)(...B.map((D)=>p._`${H} === ${D}`));else k=p.nil;if(x.length)k=(0,p.or)(k,...x.map((D)=>p._`${(0,h.usePattern)(y,D)}.test(${H})`));return(0,p.not)(k)}function L(H){z.code(p._`delete ${O}[${H}]`)}function K(H){if(V.removeAdditional==="all"||V.removeAdditional&&v===!1){L(H);return}if(v===!1){if(y.setParams({additionalProperty:H}),y.error(),!F)z.break();return}if(typeof v=="object"&&!(0,g.alwaysValidSchema)(U,v)){let k=z.name("valid");if(V.removeAdditional==="failing")ae(H,k,!1),z.if((0,p.not)(k),()=>{y.reset(),L(H)});else if(ae(H,k),!F)z.if((0,p.not)(k),()=>z.break())}}function ae(H,k,D){let se={keyword:"additionalProperties",dataProp:H,dataPropType:g.Type.Str};if(D===!1)Object.assign(se,{compositeRule:!0,createErrors:!1,allErrors:!1});y.subschema(se,k)}}};m.default=S}),rm=ye((m)=>{Object.defineProperty(m,"__esModule",{value:!0});let h=Nr(),p=mt(),f=ke(),g=hl(),S={keyword:"properties",type:"object",schemaType:"object",code(y){let{gen:z,schema:v,parentSchema:T,data:O,it:C}=y;if(C.opts.removeAdditional==="all"&&T.additionalProperties===void 0)g.default.code(new h.KeywordCxt(C,g.default,"additionalProperties"));let U=(0,p.allSchemaProperties)(v);for(let q of U)C.definedProperties.add(q);if(C.opts.unevaluated&&U.length&&C.props!==!0)C.props=f.mergeEvaluated.props(z,(0,f.toHash)(U),C.props);let F=U.filter((q)=>!(0,f.alwaysValidSchema)(C,v[q]));if(F.length===0)return;let V=z.name("valid");for(let q of F){if(B(q))x(q);else{if(z.if((0,p.propertyInData)(z,O,q,C.opts.ownProperties)),x(q),!C.allErrors)z.else().var(V,!0);z.endIf()}y.it.definedProperties.add(q),y.ok(V)}function B(q){return C.opts.useDefaults&&!C.compositeRule&&v[q].default!==void 0}function x(q){y.subschema({keyword:"properties",schemaProp:q,dataProp:q},V)}}};m.default=S}),sm=ye((m)=>{Object.defineProperty(m,"__esModule",{value:!0});let h=mt(),p=qe(),f=ke(),g=ke(),S={keyword:"patternProperties",type:"object",schemaType:"object",code(y){let{gen:z,schema:v,data:T,parentSchema:O,it:C}=y,{opts:U}=C,F=(0,h.allSchemaProperties)(v),V=F.filter((ae)=>(0,f.alwaysValidSchema)(C,v[ae]));if(F.length===0||V.length===F.length&&(!C.opts.unevaluated||C.props===!0))return;let B=U.strictSchema&&!U.allowMatchingProperties&&O.properties,x=z.name("valid");if(C.props!==!0&&!(C.props instanceof p.Name))C.props=(0,g.evaluatedPropsToName)(z,C.props);let{props:q}=C;Z();function Z(){for(let ae of F){if(B)L(ae);if(C.allErrors)K(ae);else z.var(x,!0),K(ae),z.if(x)}}function L(ae){for(let H in B)if(new RegExp(ae).test(H))(0,f.checkStrictMode)(C,`property ${H} matches pattern ${ae} (use allowMatchingProperties)`)}function K(ae){z.forIn("key",T,(H)=>{z.if(p._`${(0,h.usePattern)(y,ae)}.test(${H})`,()=>{let k=V.includes(ae);if(!k)y.subschema({keyword:"patternProperties",schemaProp:ae,dataProp:H,dataPropType:g.Type.Str},x);if(C.opts.unevaluated&&q!==!0)z.assign(p._`${q}[${H}]`,!0);else if(!k&&!C.allErrors)z.if((0,p.not)(x),()=>z.break())})})}}};m.default=S}),om=ye((m)=>{Object.defineProperty(m,"__esModule",{value:!0});let h=ke(),p={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(f){let{gen:g,schema:S,it:y}=f;if((0,h.alwaysValidSchema)(y,S)){f.fail();return}let z=g.name("valid");f.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},z),f.failResult(z,()=>f.reset(),()=>f.error())},error:{message:"must NOT be valid"}};m.default=p}),am=ye((m)=>{Object.defineProperty(m,"__esModule",{value:!0});let h={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:mt().validateUnion,error:{message:"must match a schema in anyOf"}};m.default=h}),nm=ye((m)=>{Object.defineProperty(m,"__esModule",{value:!0});let h=qe(),p=ke(),f={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:{message:"must match exactly one schema in oneOf",params:({params:g})=>h._`{passingSchemas: ${g.passing}}`},code(g){let{gen:S,schema:y,parentSchema:z,it:v}=g;if(!Array.isArray(y))throw Error("ajv implementation error");if(v.opts.discriminator&&z.discriminator)return;let T=y,O=S.let("valid",!1),C=S.let("passing",null),U=S.name("_valid");g.setParams({passing:C}),S.block(F),g.result(O,()=>g.reset(),()=>g.error(!0));function F(){T.forEach((V,B)=>{let x;if((0,p.alwaysValidSchema)(v,V))S.var(U,!0);else x=g.subschema({keyword:"oneOf",schemaProp:B,compositeRule:!0},U);if(B>0)S.if(h._`${U} && ${O}`).assign(O,!1).assign(C,h._`[${C}, ${B}]`).else();S.if(U,()=>{if(S.assign(O,!0),S.assign(C,B),x)g.mergeEvaluated(x,h.Name)})})}}};m.default=f}),im=ye((m)=>{Object.defineProperty(m,"__esModule",{value:!0});let h=ke(),p={keyword:"allOf",schemaType:"array",code(f){let{gen:g,schema:S,it:y}=f;if(!Array.isArray(S))throw Error("ajv implementation error");let z=g.name("valid");S.forEach((v,T)=>{if((0,h.alwaysValidSchema)(y,v))return;let O=f.subschema({keyword:"allOf",schemaProp:T},z);f.ok(z),f.mergeEvaluated(O)})}};m.default=p}),cm=ye((m)=>{Object.defineProperty(m,"__esModule",{value:!0});let h=qe(),p=ke(),f={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:{message:({params:S})=>h.str`must match "${S.ifClause}" schema`,params:({params:S})=>h._`{failingKeyword: ${S.ifClause}}`},code(S){let{gen:y,parentSchema:z,it:v}=S;if(z.then===void 0&&z.else===void 0)(0,p.checkStrictMode)(v,'"if" without "then" and "else" is ignored');let T=g(v,"then"),O=g(v,"else");if(!T&&!O)return;let C=y.let("valid",!0),U=y.name("_valid");if(F(),S.reset(),T&&O){let B=y.let("ifClause");S.setParams({ifClause:B}),y.if(U,V("then",B),V("else",B))}else if(T)y.if(U,V("then"));else y.if((0,h.not)(U),V("else"));S.pass(C,()=>S.error(!0));function F(){let B=S.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},U);S.mergeEvaluated(B)}function V(B,x){return()=>{let q=S.subschema({keyword:B},U);if(y.assign(C,U),S.mergeValidEvaluated(q,C),x)y.assign(x,h._`${B}`);else S.setParams({ifClause:B})}}}};function g(S,y){let z=S.schema[y];return z!==void 0&&!(0,p.alwaysValidSchema)(S,z)}m.default=f}),lm=ye((m)=>{Object.defineProperty(m,"__esModule",{value:!0});let h=ke(),p={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:f,parentSchema:g,it:S}){if(g.if===void 0)(0,h.checkStrictMode)(S,`"${f}" without "if" is ignored`)}};m.default=p}),pl=ye((m)=>{Object.defineProperty(m,"__esModule",{value:!0});let h=dl(),p=Xd(),f=ml(),g=Qd(),S=em(),y=Li(),z=tm(),v=hl(),T=rm(),O=sm(),C=om(),U=am(),F=nm(),V=im(),B=cm(),x=lm();function q(Z=!1){let L=[C.default,U.default,F.default,V.default,B.default,x.default,z.default,v.default,y.default,T.default,O.default];if(Z)L.push(p.default,g.default);else L.push(h.default,f.default);return L.push(S.default),L}m.default=q}),um=ye((m)=>{Object.defineProperty(m,"__esModule",{value:!0});let h=qe(),p={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:{message:({schemaCode:f})=>h.str`must match format "${f}"`,params:({schemaCode:f})=>h._`{format: ${f}}`},code(f,g){let{gen:S,data:y,$data:z,schema:v,schemaCode:T,it:O}=f,{opts:C,errSchemaPath:U,schemaEnv:F,self:V}=O;if(!C.validateFormats)return;if(z)B();else x();function B(){let q=S.scopeValue("formats",{ref:V.formats,code:C.code.formats}),Z=S.const("fDef",h._`${q}[${T}]`),L=S.let("fType"),K=S.let("format");S.if(h._`typeof ${Z} == "object" && !(${Z} instanceof RegExp)`,()=>S.assign(L,h._`${Z}.type || "string"`).assign(K,h._`${Z}.validate`),()=>S.assign(L,h._`"string"`).assign(K,Z)),f.fail$data((0,h.or)(ae(),H()));function ae(){if(C.strictSchema===!1)return h.nil;return h._`${T} && !${K}`}function H(){let k=F.$async?h._`(${Z}.async ? await ${K}(${y}) : ${K}(${y}))`:h._`${K}(${y})`,D=h._`(typeof ${K} == "function" ? ${k} : ${K}.test(${y}))`;return h._`${K} && ${K} !== true && ${L} === ${g} && !${D}`}}function x(){let q=V.formats[v];if(!q){ae();return}if(q===!0)return;let[Z,L,K]=H(q);if(Z===g)f.pass(k());function ae(){if(C.strictSchema===!1){V.logger.warn(D());return}throw Error(D());function D(){return`unknown format "${v}" ignored in schema at path "${U}"`}}function H(D){let se=D instanceof RegExp?(0,h.regexpCode)(D):C.code.formats?h._`${C.code.formats}${(0,h.getProperty)(v)}`:void 0,pe=S.scopeValue("formats",{key:v,ref:D,code:se});if(typeof D=="object"&&!(D instanceof RegExp))return[D.type||"string",D.validate,h._`${pe}.validate`];return["string",D,pe]}function k(){if(typeof q=="object"&&!(q instanceof RegExp)&&q.async){if(!F.$async)throw Error("async format in sync schema");return h._`await ${K}(${y})`}return typeof L=="function"?h._`${K}(${y})`:h._`${K}.test(${y})`}}}};m.default=p}),fl=ye((m)=>{Object.defineProperty(m,"__esModule",{value:!0});let h=[um().default];m.default=h}),gl=ye((m)=>{Object.defineProperty(m,"__esModule",{value:!0}),m.contentVocabulary=m.metadataVocabulary=void 0,m.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"],m.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]}),Sl=ye((m)=>{Object.defineProperty(m,"__esModule",{value:!0});let h=ll(),p=ul(),f=pl(),g=fl(),S=gl(),y=[h.default,p.default,(0,f.default)(),g.default,S.metadataVocabulary,S.contentVocabulary];m.default=y}),dm=ye((m)=>{Object.defineProperty(m,"__esModule",{value:!0}),m.DiscrError=void 0;var h;(function(p){p.Tag="tag",p.Mapping="mapping"})(h||(m.DiscrError=h={}))}),Di=ye((m)=>{Object.defineProperty(m,"__esModule",{value:!0});let h=qe(),p=dm(),f=Rn(),g=kr(),S=ke(),y={keyword:"discriminator",type:"object",schemaType:"object",error:{message:({params:{discrError:z,tagName:v}})=>z===p.DiscrError.Tag?`tag "${v}" must be string`:`value of tag "${v}" must be in oneOf`,params:({params:{discrError:z,tag:v,tagName:T}})=>h._`{error: ${z}, tag: ${T}, tagValue: ${v}}`},code(z){let{gen:v,data:T,schema:O,parentSchema:C,it:U}=z,{oneOf:F}=C;if(!U.opts.discriminator)throw Error("discriminator: requires discriminator option");let V=O.propertyName;if(typeof V!="string")throw Error("discriminator: requires propertyName");if(O.mapping)throw Error("discriminator: mapping is not supported");if(!F)throw Error("discriminator: requires oneOf keyword");let B=v.let("valid",!1),x=v.const("tag",h._`${T}${(0,h.getProperty)(V)}`);v.if(h._`typeof ${x} == "string"`,()=>q(),()=>z.error(!1,{discrError:p.DiscrError.Tag,tag:x,tagName:V})),z.ok(B);function q(){let K=L();v.if(!1);for(let ae in K)v.elseIf(h._`${x} === ${ae}`),v.assign(B,Z(K[ae]));v.else(),z.error(!1,{discrError:p.DiscrError.Mapping,tag:x,tagName:V}),v.endIf()}function Z(K){let ae=v.name("valid"),H=z.subschema({keyword:"oneOf",schemaProp:K},ae);return z.mergeEvaluated(H,h.Name),ae}function L(){var K;let ae={},H=D(C),k=!0;for(let ie=0;ie<F.length;ie++){let fe=F[ie];if((fe===null||fe===void 0?void 0:fe.$ref)&&!(0,S.schemaHasRulesButRef)(fe,U.self.RULES)){let ze=fe.$ref;if(fe=f.resolveRef.call(U.self,U.schemaEnv.root,U.baseId,ze),fe instanceof f.SchemaEnv)fe=fe.schema;if(fe===void 0)throw new g.default(U.opts.uriResolver,U.baseId,ze)}let Re=(K=fe===null||fe===void 0?void 0:fe.properties)===null||K===void 0?void 0:K[V];if(typeof Re!="object")throw Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${V}"`);k=k&&(H||D(fe)),se(Re,ie)}if(!k)throw Error(`discriminator: "${V}" must be required`);return ae;function D({required:ie}){return Array.isArray(ie)&&ie.includes(V)}function se(ie,fe){if(ie.const)pe(ie.const,fe);else if(ie.enum)for(let Re of ie.enum)pe(Re,fe);else throw Error(`discriminator: "properties/${V}" must have "const" or "enum"`)}function pe(ie,fe){if(typeof ie!="string"||ie in ae)throw Error(`discriminator: "${V}" values must be unique strings`);ae[ie]=fe}}}};m.default=y}),mm=ye((m,h)=>{h.exports={$schema:"http://json-schema.org/draft-07/schema#",$id:"http://json-schema.org/draft-07/schema#",title:"Core schema meta-schema",definitions:{schemaArray:{type:"array",minItems:1,items:{$ref:"#"}},nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{allOf:[{$ref:"#/definitions/nonNegativeInteger"},{default:0}]},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}},type:["object","boolean"],properties:{$id:{type:"string",format:"uri-reference"},$schema:{type:"string",format:"uri"},$ref:{type:"string",format:"uri-reference"},$comment:{type:"string"},title:{type:"string"},description:{type:"string"},default:!0,readOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0},multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/definitions/nonNegativeInteger"},minLength:{$ref:"#/definitions/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},additionalItems:{$ref:"#"},items:{anyOf:[{$ref:"#"},{$ref:"#/definitions/schemaArray"}],default:!0},maxItems:{$ref:"#/definitions/nonNegativeInteger"},minItems:{$ref:"#/definitions/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},contains:{$ref:"#"},maxProperties:{$ref:"#/definitions/nonNegativeInteger"},minProperties:{$ref:"#/definitions/nonNegativeIntegerDefault0"},required:{$ref:"#/definitions/stringArray"},additionalProperties:{$ref:"#"},definitions:{type:"object",additionalProperties:{$ref:"#"},default:{}},properties:{type:"object",additionalProperties:{$ref:"#"},default:{}},patternProperties:{type:"object",additionalProperties:{$ref:"#"},propertyNames:{format:"regex"},default:{}},dependencies:{type:"object",additionalProperties:{anyOf:[{$ref:"#"},{$ref:"#/definitions/stringArray"}]}},propertyNames:{$ref:"#"},const:!0,enum:{type:"array",items:!0,minItems:1,uniqueItems:!0},type:{anyOf:[{$ref:"#/definitions/simpleTypes"},{type:"array",items:{$ref:"#/definitions/simpleTypes"},minItems:1,uniqueItems:!0}]},format:{type:"string"},contentMediaType:{type:"string"},contentEncoding:{type:"string"},if:{$ref:"#"},then:{$ref:"#"},else:{$ref:"#"},allOf:{$ref:"#/definitions/schemaArray"},anyOf:{$ref:"#/definitions/schemaArray"},oneOf:{$ref:"#/definitions/schemaArray"},not:{$ref:"#"}},default:!0}}),yl=ye((m,h)=>{Object.defineProperty(m,"__esModule",{value:!0}),m.MissingRefError=m.ValidationError=m.CodeGen=m.Name=m.nil=m.stringify=m.str=m._=m.KeywordCxt=m.Ajv=void 0;let p=ki(),f=Sl(),g=Di(),S=mm(),y=["/properties"],z="http://json-schema.org/draft-07/schema";var v=class extends p.default{_addVocabularies(){if(super._addVocabularies(),f.default.forEach((F)=>this.addVocabulary(F)),this.opts.discriminator)this.addKeyword(g.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let F=this.opts.$data?this.$dataMetaSchema(S,y):S;this.addMetaSchema(F,z,!1),this.refs["http://json-schema.org/schema"]=z}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(z)?z:void 0)}};m.Ajv=v,h.exports=m=v,h.exports.Ajv=v,Object.defineProperty(m,"__esModule",{value:!0}),m.default=v;var T=Nr();Object.defineProperty(m,"KeywordCxt",{enumerable:!0,get:function(){return T.KeywordCxt}});var O=qe();Object.defineProperty(m,"_",{enumerable:!0,get:function(){return O._}}),Object.defineProperty(m,"str",{enumerable:!0,get:function(){return O.str}}),Object.defineProperty(m,"stringify",{enumerable:!0,get:function(){return O.stringify}}),Object.defineProperty(m,"nil",{enumerable:!0,get:function(){return O.nil}}),Object.defineProperty(m,"Name",{enumerable:!0,get:function(){return O.Name}}),Object.defineProperty(m,"CodeGen",{enumerable:!0,get:function(){return O.CodeGen}});var C=xs();Object.defineProperty(m,"ValidationError",{enumerable:!0,get:function(){return C.default}});var U=kr();Object.defineProperty(m,"MissingRefError",{enumerable:!0,get:function(){return U.default}})}),vl=ye((m)=>{Object.defineProperty(m,"__esModule",{value:!0}),m.dynamicAnchor=void 0;let h=qe(),p=dt(),f=Rn(),g=Mi(),S={keyword:"$dynamicAnchor",schemaType:"string",code:(v)=>y(v,v.schema)};function y(v,T){let{gen:O,it:C}=v;C.schemaEnv.root.dynamicAnchors[T]=!0;let U=h._`${p.default.dynamicAnchors}${(0,h.getProperty)(T)}`,F=C.errSchemaPath==="#"?C.validateName:z(v);O.if(h._`!${U}`,()=>O.assign(U,F))}m.dynamicAnchor=y;function z(v){let{schemaEnv:T,schema:O,self:C}=v.it,{root:U,baseId:F,localRefs:V,meta:B}=T.root,{schemaId:x}=C.opts,q=new f.SchemaEnv({schema:O,schemaId:x,root:U,baseId:F,localRefs:V,meta:B});return f.compileSchema.call(C,q),(0,g.getValidate)(v,q)}m.default=S}),_l=ye((m)=>{Object.defineProperty(m,"__esModule",{value:!0}),m.dynamicRef=void 0;let h=qe(),p=dt(),f=Mi(),g={keyword:"$dynamicRef",schemaType:"string",code:(y)=>S(y,y.schema)};function S(y,z){let{gen:v,keyword:T,it:O}=y;if(z[0]!=="#")throw Error(`"${T}" only supports hash fragment reference`);let C=z.slice(1);if(O.allErrors)U();else{let V=v.let("valid",!1);U(V),y.ok(V)}function U(V){if(O.schemaEnv.root.dynamicAnchors[C]){let B=v.let("_v",h._`${p.default.dynamicAnchors}${(0,h.getProperty)(C)}`);v.if(B,F(B,V),F(O.validateName,V))}else F(O.validateName,V)()}function F(V,B){return B?()=>v.block(()=>{(0,f.callRef)(y,V),v.let(B,!0)}):()=>(0,f.callRef)(y,V)}}m.dynamicRef=S,m.default=g}),hm=ye((m)=>{Object.defineProperty(m,"__esModule",{value:!0});let h=vl(),p=ke(),f={keyword:"$recursiveAnchor",schemaType:"boolean",code(g){if(g.schema)(0,h.dynamicAnchor)(g,"");else(0,p.checkStrictMode)(g.it,"$recursiveAnchor: false is ignored")}};m.default=f}),pm=ye((m)=>{Object.defineProperty(m,"__esModule",{value:!0});let h=_l(),p={keyword:"$recursiveRef",schemaType:"string",code:(f)=>(0,h.dynamicRef)(f,f.schema)};m.default=p}),bl=ye((m)=>{Object.defineProperty(m,"__esModule",{value:!0});let h=vl(),p=_l(),f=hm(),g=pm(),S=[h.default,p.default,f.default,g.default];m.default=S}),fm=ye((m)=>{Object.defineProperty(m,"__esModule",{value:!0});let h=Li(),p={keyword:"dependentRequired",type:"object",schemaType:"object",error:h.error,code:(f)=>(0,h.validatePropertyDeps)(f)};m.default=p}),gm=ye((m)=>{Object.defineProperty(m,"__esModule",{value:!0});let h=Li(),p={keyword:"dependentSchemas",type:"object",schemaType:"object",code:(f)=>(0,h.validateSchemaDeps)(f)};m.default=p}),Sm=ye((m)=>{Object.defineProperty(m,"__esModule",{value:!0});let h=ke(),p={keyword:["maxContains","minContains"],type:"array",schemaType:"number",code({keyword:f,parentSchema:g,it:S}){if(g.contains===void 0)(0,h.checkStrictMode)(S,`"${f}" without "contains" is ignored`)}};m.default=p}),Rl=ye((m)=>{Object.defineProperty(m,"__esModule",{value:!0});let h=fm(),p=gm(),f=Sm(),g=[h.default,p.default,f.default];m.default=g}),ym=ye((m)=>{Object.defineProperty(m,"__esModule",{value:!0});let h=qe(),p=ke(),f=dt(),g={keyword:"unevaluatedProperties",type:"object",schemaType:["boolean","object"],trackErrors:!0,error:{message:"must NOT have unevaluated properties",params:({params:S})=>h._`{unevaluatedProperty: ${S.unevaluatedProperty}}`},code(S){let{gen:y,schema:z,data:v,errsCount:T,it:O}=S;if(!T)throw Error("ajv implementation error");let{allErrors:C,props:U}=O;if(U instanceof h.Name)y.if(h._`${U} !== true`,()=>y.forIn("key",v,(x)=>y.if(V(U,x),()=>F(x))));else if(U!==!0)y.forIn("key",v,(x)=>U===void 0?F(x):y.if(B(U,x),()=>F(x)));O.props=!0,S.ok(h._`${T} === ${f.default.errors}`);function F(x){if(z===!1){if(S.setParams({unevaluatedProperty:x}),S.error(),!C)y.break();return}if(!(0,p.alwaysValidSchema)(O,z)){let q=y.name("valid");if(S.subschema({keyword:"unevaluatedProperties",dataProp:x,dataPropType:p.Type.Str},q),!C)y.if((0,h.not)(q),()=>y.break())}}function V(x,q){return h._`!${x} || !${x}[${q}]`}function B(x,q){let Z=[];for(let L in x)if(x[L]===!0)Z.push(h._`${q} !== ${L}`);return(0,h.and)(...Z)}}};m.default=g}),vm=ye((m)=>{Object.defineProperty(m,"__esModule",{value:!0});let h=qe(),p=ke(),f={keyword:"unevaluatedItems",type:"array",schemaType:["boolean","object"],error:{message:({params:{len:g}})=>h.str`must NOT have more than ${g} items`,params:({params:{len:g}})=>h._`{limit: ${g}}`},code(g){let{gen:S,schema:y,data:z,it:v}=g,T=v.items||0;if(T===!0)return;let O=S.const("len",h._`${z}.length`);if(y===!1)g.setParams({len:T}),g.fail(h._`${O} > ${T}`);else if(typeof y=="object"&&!(0,p.alwaysValidSchema)(v,y)){let U=S.var("valid",h._`${O} <= ${T}`);S.if((0,h.not)(U),()=>C(U,T)),g.ok(U)}v.items=!0;function C(U,F){S.forRange("i",F,O,(V)=>{if(g.subschema({keyword:"unevaluatedItems",dataProp:V,dataPropType:p.Type.Num},U),!v.allErrors)S.if((0,h.not)(U),()=>S.break())})}}};m.default=f}),zl=ye((m)=>{Object.defineProperty(m,"__esModule",{value:!0});let h=ym(),p=vm(),f=[h.default,p.default];m.default=f}),_m=ye((m,h)=>{h.exports={$schema:"https://json-schema.org/draft/2019-09/schema",$id:"https://json-schema.org/draft/2019-09/schema",$vocabulary:{"https://json-schema.org/draft/2019-09/vocab/core":!0,"https://json-schema.org/draft/2019-09/vocab/applicator":!0,"https://json-schema.org/draft/2019-09/vocab/validation":!0,"https://json-schema.org/draft/2019-09/vocab/meta-data":!0,"https://json-schema.org/draft/2019-09/vocab/format":!1,"https://json-schema.org/draft/2019-09/vocab/content":!0},$recursiveAnchor:!0,title:"Core and Validation specifications meta-schema",allOf:[{$ref:"meta/core"},{$ref:"meta/applicator"},{$ref:"meta/validation"},{$ref:"meta/meta-data"},{$ref:"meta/format"},{$ref:"meta/content"}],type:["object","boolean"],properties:{definitions:{$comment:"While no longer an official keyword as it is replaced by $defs, this keyword is retained in the meta-schema to prevent incompatible extensions as it remains in common use.",type:"object",additionalProperties:{$recursiveRef:"#"},default:{}},dependencies:{$comment:'"dependencies" is no longer a keyword, but schema authors should avoid redefining it to facilitate a smooth transition to "dependentSchemas" and "dependentRequired"',type:"object",additionalProperties:{anyOf:[{$recursiveRef:"#"},{$ref:"meta/validation#/$defs/stringArray"}]}}}}}),bm=ye((m,h)=>{h.exports={$schema:"https://json-schema.org/draft/2019-09/schema",$id:"https://json-schema.org/draft/2019-09/meta/applicator",$vocabulary:{"https://json-schema.org/draft/2019-09/vocab/applicator":!0},$recursiveAnchor:!0,title:"Applicator vocabulary meta-schema",type:["object","boolean"],properties:{additionalItems:{$recursiveRef:"#"},unevaluatedItems:{$recursiveRef:"#"},items:{anyOf:[{$recursiveRef:"#"},{$ref:"#/$defs/schemaArray"}]},contains:{$recursiveRef:"#"},additionalProperties:{$recursiveRef:"#"},unevaluatedProperties:{$recursiveRef:"#"},properties:{type:"object",additionalProperties:{$recursiveRef:"#"},default:{}},patternProperties:{type:"object",additionalProperties:{$recursiveRef:"#"},propertyNames:{format:"regex"},default:{}},dependentSchemas:{type:"object",additionalProperties:{$recursiveRef:"#"}},propertyNames:{$recursiveRef:"#"},if:{$recursiveRef:"#"},then:{$recursiveRef:"#"},else:{$recursiveRef:"#"},allOf:{$ref:"#/$defs/schemaArray"},anyOf:{$ref:"#/$defs/schemaArray"},oneOf:{$ref:"#/$defs/schemaArray"},not:{$recursiveRef:"#"}},$defs:{schemaArray:{type:"array",minItems:1,items:{$recursiveRef:"#"}}}}}),Rm=ye((m,h)=>{h.exports={$schema:"https://json-schema.org/draft/2019-09/schema",$id:"https://json-schema.org/draft/2019-09/meta/content",$vocabulary:{"https://json-schema.org/draft/2019-09/vocab/content":!0},$recursiveAnchor:!0,title:"Content vocabulary meta-schema",type:["object","boolean"],properties:{contentMediaType:{type:"string"},contentEncoding:{type:"string"},contentSchema:{$recursiveRef:"#"}}}}),zm=ye((m,h)=>{h.exports={$schema:"https://json-schema.org/draft/2019-09/schema",$id:"https://json-schema.org/draft/2019-09/meta/core",$vocabulary:{"https://json-schema.org/draft/2019-09/vocab/core":!0},$recursiveAnchor:!0,title:"Core vocabulary meta-schema",type:["object","boolean"],properties:{$id:{type:"string",format:"uri-reference",$comment:"Non-empty fragments not allowed.",pattern:"^[^#]*#?$"},$schema:{type:"string",format:"uri"},$anchor:{type:"string",pattern:"^[A-Za-z][-A-Za-z0-9.:_]*$"},$ref:{type:"string",format:"uri-reference"},$recursiveRef:{type:"string",format:"uri-reference"},$recursiveAnchor:{type:"boolean",default:!1},$vocabulary:{type:"object",propertyNames:{type:"string",format:"uri"},additionalProperties:{type:"boolean"}},$comment:{type:"string"},$defs:{type:"object",additionalProperties:{$recursiveRef:"#"},default:{}}}}}),wm=ye((m,h)=>{h.exports={$schema:"https://json-schema.org/draft/2019-09/schema",$id:"https://json-schema.org/draft/2019-09/meta/format",$vocabulary:{"https://json-schema.org/draft/2019-09/vocab/format":!0},$recursiveAnchor:!0,title:"Format vocabulary meta-schema",type:["object","boolean"],properties:{format:{type:"string"}}}}),$m=ye((m,h)=>{h.exports={$schema:"https://json-schema.org/draft/2019-09/schema",$id:"https://json-schema.org/draft/2019-09/meta/meta-data",$vocabulary:{"https://json-schema.org/draft/2019-09/vocab/meta-data":!0},$recursiveAnchor:!0,title:"Meta-data vocabulary meta-schema",type:["object","boolean"],properties:{title:{type:"string"},description:{type:"string"},default:!0,deprecated:{type:"boolean",default:!1},readOnly:{type:"boolean",default:!1},writeOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0}}}}),Em=ye((m,h)=>{h.exports={$schema:"https://json-schema.org/draft/2019-09/schema",$id:"https://json-schema.org/draft/2019-09/meta/validation",$vocabulary:{"https://json-schema.org/draft/2019-09/vocab/validation":!0},$recursiveAnchor:!0,title:"Validation vocabulary meta-schema",type:["object","boolean"],properties:{multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/$defs/nonNegativeInteger"},minLength:{$ref:"#/$defs/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},maxItems:{$ref:"#/$defs/nonNegativeInteger"},minItems:{$ref:"#/$defs/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},maxContains:{$ref:"#/$defs/nonNegativeInteger"},minContains:{$ref:"#/$defs/nonNegativeInteger",default:1},maxProperties:{$ref:"#/$defs/nonNegativeInteger"},minProperties:{$ref:"#/$defs/nonNegativeIntegerDefault0"},required:{$ref:"#/$defs/stringArray"},dependentRequired:{type:"object",additionalProperties:{$ref:"#/$defs/stringArray"}},const:!0,enum:{type:"array",items:!0},type:{anyOf:[{$ref:"#/$defs/simpleTypes"},{type:"array",items:{$ref:"#/$defs/simpleTypes"},minItems:1,uniqueItems:!0}]}},$defs:{nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{$ref:"#/$defs/nonNegativeInteger",default:0},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}}}}),Tm=ye((m)=>{Object.defineProperty(m,"__esModule",{value:!0});let h=_m(),p=bm(),f=Rm(),g=zm(),S=wm(),y=$m(),z=Em(),v=["/properties"];function T(O){return[h,p,f,g,C(this,S),y,C(this,z)].forEach((U)=>this.addMetaSchema(U,void 0,!1)),this;function C(U,F){return O?U.$dataMetaSchema(F,v):F}}m.default=T}),Pm=ye((m,h)=>{Object.defineProperty(m,"__esModule",{value:!0}),m.MissingRefError=m.ValidationError=m.CodeGen=m.Name=m.nil=m.stringify=m.str=m._=m.KeywordCxt=m.Ajv2019=void 0;let p=ki(),f=Sl(),g=bl(),S=Rl(),y=zl(),z=Di(),v=Tm(),T="https://json-schema.org/draft/2019-09/schema";var O=class extends p.default{constructor(B={}){super({...B,dynamicRef:!0,next:!0,unevaluated:!0})}_addVocabularies(){if(super._addVocabularies(),this.addVocabulary(g.default),f.default.forEach((B)=>this.addVocabulary(B)),this.addVocabulary(S.default),this.addVocabulary(y.default),this.opts.discriminator)this.addKeyword(z.default)}_addDefaultMetaSchema(){super._addDefaultMetaSchema();let{$data:B,meta:x}=this.opts;if(!x)return;v.default.call(this,B),this.refs["http://json-schema.org/schema"]=T}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(T)?T:void 0)}};m.Ajv2019=O,h.exports=m=O,h.exports.Ajv2019=O,Object.defineProperty(m,"__esModule",{value:!0}),m.default=O;var C=Nr();Object.defineProperty(m,"KeywordCxt",{enumerable:!0,get:function(){return C.KeywordCxt}});var U=qe();Object.defineProperty(m,"_",{enumerable:!0,get:function(){return U._}}),Object.defineProperty(m,"str",{enumerable:!0,get:function(){return U.str}}),Object.defineProperty(m,"stringify",{enumerable:!0,get:function(){return U.stringify}}),Object.defineProperty(m,"nil",{enumerable:!0,get:function(){return U.nil}}),Object.defineProperty(m,"Name",{enumerable:!0,get:function(){return U.Name}}),Object.defineProperty(m,"CodeGen",{enumerable:!0,get:function(){return U.CodeGen}});var F=xs();Object.defineProperty(m,"ValidationError",{enumerable:!0,get:function(){return F.default}});var V=kr();Object.defineProperty(m,"MissingRefError",{enumerable:!0,get:function(){return V.default}})}),Cm=ye((m)=>{Object.defineProperty(m,"__esModule",{value:!0});let h=ll(),p=ul(),f=pl(),g=bl(),S=Rl(),y=zl(),z=fl(),v=gl(),T=[g.default,h.default,p.default,(0,f.default)(!0),z.default,v.metadataVocabulary,v.contentVocabulary,S.default,y.default];m.default=T}),Im=ye((m,h)=>{h.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/schema",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/core":!0,"https://json-schema.org/draft/2020-12/vocab/applicator":!0,"https://json-schema.org/draft/2020-12/vocab/unevaluated":!0,"https://json-schema.org/draft/2020-12/vocab/validation":!0,"https://json-schema.org/draft/2020-12/vocab/meta-data":!0,"https://json-schema.org/draft/2020-12/vocab/format-annotation":!0,"https://json-schema.org/draft/2020-12/vocab/content":!0},$dynamicAnchor:"meta",title:"Core and Validation specifications meta-schema",allOf:[{$ref:"meta/core"},{$ref:"meta/applicator"},{$ref:"meta/unevaluated"},{$ref:"meta/validation"},{$ref:"meta/meta-data"},{$ref:"meta/format-annotation"},{$ref:"meta/content"}],type:["object","boolean"],$comment:"This meta-schema also defines keywords that have appeared in previous drafts in order to prevent incompatible extensions as they remain in common use.",properties:{definitions:{$comment:'"definitions" has been replaced by "$defs".',type:"object",additionalProperties:{$dynamicRef:"#meta"},deprecated:!0,default:{}},dependencies:{$comment:'"dependencies" has been split and replaced by "dependentSchemas" and "dependentRequired" in order to serve their differing semantics.',type:"object",additionalProperties:{anyOf:[{$dynamicRef:"#meta"},{$ref:"meta/validation#/$defs/stringArray"}]},deprecated:!0,default:{}},$recursiveAnchor:{$comment:'"$recursiveAnchor" has been replaced by "$dynamicAnchor".',$ref:"meta/core#/$defs/anchorString",deprecated:!0},$recursiveRef:{$comment:'"$recursiveRef" has been replaced by "$dynamicRef".',$ref:"meta/core#/$defs/uriReferenceString",deprecated:!0}}}}),qm=ye((m,h)=>{h.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/applicator",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/applicator":!0},$dynamicAnchor:"meta",title:"Applicator vocabulary meta-schema",type:["object","boolean"],properties:{prefixItems:{$ref:"#/$defs/schemaArray"},items:{$dynamicRef:"#meta"},contains:{$dynamicRef:"#meta"},additionalProperties:{$dynamicRef:"#meta"},properties:{type:"object",additionalProperties:{$dynamicRef:"#meta"},default:{}},patternProperties:{type:"object",additionalProperties:{$dynamicRef:"#meta"},propertyNames:{format:"regex"},default:{}},dependentSchemas:{type:"object",additionalProperties:{$dynamicRef:"#meta"},default:{}},propertyNames:{$dynamicRef:"#meta"},if:{$dynamicRef:"#meta"},then:{$dynamicRef:"#meta"},else:{$dynamicRef:"#meta"},allOf:{$ref:"#/$defs/schemaArray"},anyOf:{$ref:"#/$defs/schemaArray"},oneOf:{$ref:"#/$defs/schemaArray"},not:{$dynamicRef:"#meta"}},$defs:{schemaArray:{type:"array",minItems:1,items:{$dynamicRef:"#meta"}}}}}),Om=ye((m,h)=>{h.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/unevaluated",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/unevaluated":!0},$dynamicAnchor:"meta",title:"Unevaluated applicator vocabulary meta-schema",type:["object","boolean"],properties:{unevaluatedItems:{$dynamicRef:"#meta"},unevaluatedProperties:{$dynamicRef:"#meta"}}}}),jm=ye((m,h)=>{h.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/content",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/content":!0},$dynamicAnchor:"meta",title:"Content vocabulary meta-schema",type:["object","boolean"],properties:{contentEncoding:{type:"string"},contentMediaType:{type:"string"},contentSchema:{$dynamicRef:"#meta"}}}}),Nm=ye((m,h)=>{h.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/core",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/core":!0},$dynamicAnchor:"meta",title:"Core vocabulary meta-schema",type:["object","boolean"],properties:{$id:{$ref:"#/$defs/uriReferenceString",$comment:"Non-empty fragments not allowed.",pattern:"^[^#]*#?$"},$schema:{$ref:"#/$defs/uriString"},$ref:{$ref:"#/$defs/uriReferenceString"},$anchor:{$ref:"#/$defs/anchorString"},$dynamicRef:{$ref:"#/$defs/uriReferenceString"},$dynamicAnchor:{$ref:"#/$defs/anchorString"},$vocabulary:{type:"object",propertyNames:{$ref:"#/$defs/uriString"},additionalProperties:{type:"boolean"}},$comment:{type:"string"},$defs:{type:"object",additionalProperties:{$dynamicRef:"#meta"}}},$defs:{anchorString:{type:"string",pattern:"^[A-Za-z_][-A-Za-z0-9._]*$"},uriString:{type:"string",format:"uri"},uriReferenceString:{type:"string",format:"uri-reference"}}}}),km=ye((m,h)=>{h.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/format-annotation",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/format-annotation":!0},$dynamicAnchor:"meta",title:"Format vocabulary meta-schema for annotation results",type:["object","boolean"],properties:{format:{type:"string"}}}}),Mm=ye((m,h)=>{h.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/meta-data",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/meta-data":!0},$dynamicAnchor:"meta",title:"Meta-data vocabulary meta-schema",type:["object","boolean"],properties:{title:{type:"string"},description:{type:"string"},default:!0,deprecated:{type:"boolean",default:!1},readOnly:{type:"boolean",default:!1},writeOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0}}}}),Am=ye((m,h)=>{h.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/validation",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/validation":!0},$dynamicAnchor:"meta",title:"Validation vocabulary meta-schema",type:["object","boolean"],properties:{type:{anyOf:[{$ref:"#/$defs/simpleTypes"},{type:"array",items:{$ref:"#/$defs/simpleTypes"},minItems:1,uniqueItems:!0}]},const:!0,enum:{type:"array",items:!0},multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/$defs/nonNegativeInteger"},minLength:{$ref:"#/$defs/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},maxItems:{$ref:"#/$defs/nonNegativeInteger"},minItems:{$ref:"#/$defs/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},maxContains:{$ref:"#/$defs/nonNegativeInteger"},minContains:{$ref:"#/$defs/nonNegativeInteger",default:1},maxProperties:{$ref:"#/$defs/nonNegativeInteger"},minProperties:{$ref:"#/$defs/nonNegativeIntegerDefault0"},required:{$ref:"#/$defs/stringArray"},dependentRequired:{type:"object",additionalProperties:{$ref:"#/$defs/stringArray"}}},$defs:{nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{$ref:"#/$defs/nonNegativeInteger",default:0},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}}}}),Lm=ye((m)=>{Object.defineProperty(m,"__esModule",{value:!0});let h=Im(),p=qm(),f=Om(),g=jm(),S=Nm(),y=km(),z=Mm(),v=Am(),T=["/properties"];function O(C){return[h,p,f,g,S,U(this,y),z,U(this,v)].forEach((F)=>this.addMetaSchema(F,void 0,!1)),this;function U(F,V){return C?F.$dataMetaSchema(V,T):V}}m.default=O}),Dm=ye((m,h)=>{Object.defineProperty(m,"__esModule",{value:!0}),m.MissingRefError=m.ValidationError=m.CodeGen=m.Name=m.nil=m.stringify=m.str=m._=m.KeywordCxt=m.Ajv2020=void 0;let p=ki(),f=Cm(),g=Di(),S=Lm(),y="https://json-schema.org/draft/2020-12/schema";var z=class extends p.default{constructor(U={}){super({...U,dynamicRef:!0,next:!0,unevaluated:!0})}_addVocabularies(){if(super._addVocabularies(),f.default.forEach((U)=>this.addVocabulary(U)),this.opts.discriminator)this.addKeyword(g.default)}_addDefaultMetaSchema(){super._addDefaultMetaSchema();let{$data:U,meta:F}=this.opts;if(!F)return;S.default.call(this,U),this.refs["http://json-schema.org/schema"]=y}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(y)?y:void 0)}};m.Ajv2020=z,h.exports=m=z,h.exports.Ajv2020=z,Object.defineProperty(m,"__esModule",{value:!0}),m.default=z;var v=Nr();Object.defineProperty(m,"KeywordCxt",{enumerable:!0,get:function(){return v.KeywordCxt}});var T=qe();Object.defineProperty(m,"_",{enumerable:!0,get:function(){return T._}}),Object.defineProperty(m,"str",{enumerable:!0,get:function(){return T.str}}),Object.defineProperty(m,"stringify",{enumerable:!0,get:function(){return T.stringify}}),Object.defineProperty(m,"nil",{enumerable:!0,get:function(){return T.nil}}),Object.defineProperty(m,"Name",{enumerable:!0,get:function(){return T.Name}}),Object.defineProperty(m,"CodeGen",{enumerable:!0,get:function(){return T.CodeGen}});var O=xs();Object.defineProperty(m,"ValidationError",{enumerable:!0,get:function(){return O.default}});var C=kr();Object.defineProperty(m,"MissingRefError",{enumerable:!0,get:function(){return C.default}})}),Um=ye((m)=>{Object.defineProperty(m,"__esModule",{value:!0}),m.formatNames=m.fastFormats=m.fullFormats=void 0;function h(ie,fe){return{validate:ie,compare:fe}}m.fullFormats={date:h(S,y),time:h(v(!0),T),"date-time":h(U(!0),F),"iso-time":h(v(),O),"iso-date-time":h(U(),V),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:q,"uri-reference":/^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,"uri-template":/^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i,url:/^(?:https?|ftp):\/\/(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)(?:\.(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu,email:/^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i,hostname:/^(?=.{1,253}\.?$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*\.?$/i,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)$/,ipv6:/^((([0-9a-f]{1,4}:){7}([0-9a-f]{1,4}|:))|(([0-9a-f]{1,4}:){6}(:[0-9a-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){5}(((:[0-9a-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){4}(((:[0-9a-f]{1,4}){1,3})|((:[0-9a-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){3}(((:[0-9a-f]{1,4}){1,4})|((:[0-9a-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){2}(((:[0-9a-f]{1,4}){1,5})|((:[0-9a-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){1}(((:[0-9a-f]{1,4}){1,6})|((:[0-9a-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9a-f]{1,4}){1,7})|((:[0-9a-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))$/i,regex:pe,uuid:/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,"json-pointer":/^(?:\/(?:[^~/]|~0|~1)*)*$/,"json-pointer-uri-fragment":/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,"relative-json-pointer":/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,byte:L,int32:{type:"number",validate:H},int64:{type:"number",validate:k},float:{type:"number",validate:D},double:{type:"number",validate:D},password:!0,binary:!0},m.fastFormats={...m.fullFormats,date:h(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,y),time:h(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,T),"date-time":h(/^\d\d\d\d-[0-1]\d-[0-3]\dt(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,F),"iso-time":h(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,O),"iso-date-time":h(/^\d\d\d\d-[0-1]\d-[0-3]\d[t\s](?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,V),uri:/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i,"uri-reference":/^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,email:/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i},m.formatNames=Object.keys(m.fullFormats);function p(ie){return ie%4===0&&(ie%100!==0||ie%400===0)}let f=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,g=[0,31,28,31,30,31,30,31,31,30,31,30,31];function S(ie){let fe=f.exec(ie);if(!fe)return!1;let Re=+fe[1],ze=+fe[2],Ce=+fe[3];return ze>=1&&ze<=12&&Ce>=1&&Ce<=(ze===2&&p(Re)?29:g[ze])}function y(ie,fe){if(!(ie&&fe))return;if(ie>fe)return 1;if(ie<fe)return-1;return 0}let z=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function v(ie){return function(Re){let ze=z.exec(Re);if(!ze)return!1;let Ce=+ze[1],Ae=+ze[2],Me=+ze[3],Ue=ze[4],je=ze[5]==="-"?-1:1,te=+(ze[6]||0),me=+(ze[7]||0);if(te>23||me>59||ie&&!Ue)return!1;if(Ce<=23&&Ae<=59&&Me<60)return!0;let M=Ae-me*je,b=Ce-te*je-(M<0?1:0);return(b===23||b===-1)&&(M===59||M===-1)&&Me<61}}function T(ie,fe){if(!(ie&&fe))return;let Re=new Date("2020-01-01T"+ie).valueOf(),ze=new Date("2020-01-01T"+fe).valueOf();if(!(Re&&ze))return;return Re-ze}function O(ie,fe){if(!(ie&&fe))return;let Re=z.exec(ie),ze=z.exec(fe);if(!(Re&&ze))return;if(ie=Re[1]+Re[2]+Re[3],fe=ze[1]+ze[2]+ze[3],ie>fe)return 1;if(ie<fe)return-1;return 0}let C=/t|\s/i;function U(ie){let fe=v(ie);return function(ze){let Ce=ze.split(C);return Ce.length===2&&S(Ce[0])&&fe(Ce[1])}}function F(ie,fe){if(!(ie&&fe))return;let Re=new Date(ie).valueOf(),ze=new Date(fe).valueOf();if(!(Re&&ze))return;return Re-ze}function V(ie,fe){if(!(ie&&fe))return;let[Re,ze]=ie.split(C),[Ce,Ae]=fe.split(C),Me=y(Re,Ce);if(Me===void 0)return;return Me||T(ze,Ae)}let B=/\/|:/,x=/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)(?:\?(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i;function q(ie){return B.test(ie)&&x.test(ie)}let Z=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function L(ie){return Z.lastIndex=0,Z.test(ie)}let K=-2147483648,ae=2147483647;function H(ie){return Number.isInteger(ie)&&ie<=ae&&ie>=K}function k(ie){return Number.isInteger(ie)}function D(){return!0}let se=/[^\\]\\Z/;function pe(ie){if(se.test(ie))return!1;try{return new RegExp(ie),!0}catch(fe){return!1}}});var Vm=ye((m)=>{Object.defineProperty(m,"__esModule",{value:!0}),m.formatLimitDefinition=void 0;let h=yl(),p=qe(),f=p.operators,g={formatMaximum:{okStr:"<=",ok:f.LTE,fail:f.GT},formatMinimum:{okStr:">=",ok:f.GTE,fail:f.LT},formatExclusiveMaximum:{okStr:"<",ok:f.LT,fail:f.GTE},formatExclusiveMinimum:{okStr:">",ok:f.GT,fail:f.LTE}},S={message:({keyword:z,schemaCode:v})=>p.str`should be ${g[z].okStr} ${v}`,params:({keyword:z,schemaCode:v})=>p._`{comparison: ${g[z].okStr}, limit: ${v}}`};m.formatLimitDefinition={keyword:Object.keys(g),type:"string",schemaType:"string",$data:!0,error:S,code(z){let{gen:v,data:T,schemaCode:O,keyword:C,it:U}=z,{opts:F,self:V}=U;if(!F.validateFormats)return;let B=new h.KeywordCxt(U,V.RULES.all.format.definition,"format");if(B.$data)x();else q();function x(){let L=v.scopeValue("formats",{ref:V.formats,code:F.code.formats}),K=v.const("fmt",p._`${L}[${B.schemaCode}]`);z.fail$data((0,p.or)(p._`typeof ${K} != "object"`,p._`${K} instanceof RegExp`,p._`typeof ${K}.compare != "function"`,Z(K)))}function q(){let L=B.schema,K=V.formats[L];if(!K||K===!0)return;if(typeof K!="object"||K instanceof RegExp||typeof K.compare!="function")throw Error(`"${C}": format "${L}" does not define "compare" function`);let ae=v.scopeValue("formats",{key:L,ref:K,code:F.code.formats?p._`${F.code.formats}${(0,p.getProperty)(L)}`:void 0});z.fail$data(Z(ae))}function Z(L){return p._`${L}.compare(${T}, ${O}) ${g[C].fail} 0`}},dependencies:["format"]};let y=(z)=>(z.addKeyword(m.formatLimitDefinition),z);m.default=y}),Hm=ye((m,h)=>{Object.defineProperty(m,"__esModule",{value:!0});let p=Um(),f=Vm(),g=qe(),S=new g.Name("fullFormats"),y=new g.Name("fastFormats"),z=(T,O={keywords:!0})=>{if(Array.isArray(O))return v(T,O,p.fullFormats,S),T;let[C,U]=O.mode==="fast"?[p.fastFormats,y]:[p.fullFormats,S];if(v(T,O.formats||p.formatNames,C,U),O.keywords)(0,f.default)(T);return T};z.get=(T,O="full")=>{let C=(O==="fast"?p.fastFormats:p.fullFormats)[T];if(!C)throw Error(`Unknown format "${T}"`);return C};function v(T,O,C,U){var F,V;(F=(V=T.opts.code).formats)!==null&&F!==void 0||(V.formats=g._`require("ajv-formats/dist/formats").${U}`);for(let B of O)T.addFormat(B,C[B])}h.exports=m=z,Object.defineProperty(m,"__esModule",{value:!0}),m.default=z}),wl=yl(),xm=Pm(),Fm=Dm(),Bm=lo(Hm(),1),Jm=Bm.default;function Ni(m){let h=new m({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return Jm(h),h}var zn=class{_ajv;_ajvDraft7;_ajv2019;_userAjv;constructor(m){this._userAjv=m!==void 0,this._ajv=m}get ajv(){return this._ajv??=Ni(Fm.Ajv2020)}_engineFor(m){if(this._userAjv)return this.ajv;let h=Zi(m,"pass a pre-configured Ajv instance to AjvJsonSchemaValidator(ajv) to validate other dialects.");if(h==="2020-12")return this.ajv;if(h==="2019-09")return this._ajv2019??=Ni(xm.Ajv2019);return this._ajvDraft7??=Ni(wl.Ajv)}getValidator(m){let h=this._engineFor(m),p="$id"in m&&typeof m.$id==="string"?h.getSchema(m.$id)??h.compile(m):h.compile(m);return(f)=>p(f)?{valid:!0,data:f,errorMessage:void 0}:{valid:!1,data:void 0,errorMessage:h.errorsText(p.errors)}}},fp=wl.Ajv;import Ui from"node:process";var Ol=Symbol.for("mcp.completable");function Hi(m){return!!m&&typeof m==="object"&&Ol in m}function Wm(m){return m[Ol]?.complete}var xi=15000,Ym=2147483647;function Fi(m,h){if(!Number.isFinite(m)||m<1)return;let p=setInterval(h,Math.min(m,Ym));return p.unref?.(),p}var jl,Nl=class{static{jl=(m)=>m._classification}onclose;onerror;onmessage;_classification;_responseMode;_started=!1;_used=!1;_closed=!1;_terminalDelivered=!1;_dispatchWindowOpen=!1;_requestId;_deferredResponse;_sse;_abortCleanup;_keepAliveMs;constructor(m){this._classification=m.classification,this._responseMode=m.responseMode??"auto",this._keepAliveMs=m.keepAliveMs??xi}async start(){if(this._started)throw Error("PerRequestHTTPServerTransport is already started");this._started=!0}async handleMessage(m,h){if(this._used)throw Error("PerRequestHTTPServerTransport serves exactly one exchange; construct a new transport per request");if(!this._started||this.onmessage===void 0)throw Error("PerRequestHTTPServerTransport is not connected: connect a server to this transport before handling a message");if(this._closed)throw Error("PerRequestHTTPServerTransport is closed");this._used=!0;let p=h?.request?.signal;if(p?.aborted)throw await this.close(),new Pe(Oe.ConnectionClosed,"The request was aborted before it could be handled");let f={classification:this._classification,...h?.request!==void 0&&{request:h.request},...h?.authInfo!==void 0&&{authInfo:h.authInfo}};if(ot(m)){this._requestId=m.id;let g,S,y=new Promise((z,v)=>{g=z,S=v});if(this._deferredResponse={promise:y,resolve:g,reject:S,settled:!1},p!==void 0){let z=()=>void this.close();p.addEventListener("abort",z,{once:!0}),this._abortCleanup=()=>p.removeEventListener("abort",z)}this._dispatchWindowOpen=!0;try{this.onmessage(m,f)}finally{this._dispatchWindowOpen=!1}if(this._responseMode==="sse"&&!this._closed&&!this._deferredResponse.settled)this.upgradeToSse();return y}return this.onmessage(m,f),new Response(null,{status:202})}async send(m,h){if(this._closed)return;let p=rr(m)||or(m),f=p?m.id:h?.relatedRequestId;if(this._requestId===void 0||f===void 0||f!==this._requestId){if(p)this.onerror?.(Error(`Received a response for an unknown request id: ${String(m.id)}`));return}if(p){if(this._terminalDelivered)return;this._terminalDelivered=!0;let g=or(m)?m.error.code:void 0,S=g!==void 0&&(this._dispatchWindowOpen||g===be.MissingRequiredClientCapability)?Fc[g]:void 0;if(S!==void 0&&this._sse===void 0){this.settleResponse(Response.json(m,{status:S,headers:{"Content-Type":"application/json"}})),queueMicrotask(()=>void this.close());return}if(this._sse!==void 0||this._responseMode==="sse"){if(this._sse===void 0)this.upgradeToSse();this.writeMessageFrame(m),this.finalizeStream();return}this.settleResponse(Response.json(m,{status:200,headers:{"Content-Type":"application/json"}})),queueMicrotask(()=>void this.close());return}if(this._responseMode==="json")return;if(this._sse===void 0)this.upgradeToSse();this.writeMessageFrame(m)}writeCommentFrame(m){if(this._closed||this._sse===void 0||this._sse.closed)return;let h=m.split(`
|
|
15
|
+
`).map((p)=>`: ${p}`).join(`
|
|
16
|
+
`);this.writeFrame(`${h}
|
|
17
|
+
|
|
18
|
+
`)}async close(){if(this._closed)return;if(this._closed=!0,this._abortCleanup?.(),this._abortCleanup=void 0,this._sse?.keepAliveTimer!==void 0)clearInterval(this._sse.keepAliveTimer);if(this._sse!==void 0&&!this._sse.closed){this._sse.closed=!0;try{this._sse.controller.close()}catch{}}if(this._deferredResponse!==void 0&&!this._deferredResponse.settled)this._deferredResponse.settled=!0,this._deferredResponse.reject(new Pe(Oe.ConnectionClosed,"Connection closed before a response was produced"));this.onclose?.()}settleResponse(m){if(this._deferredResponse===void 0||this._deferredResponse.settled)return;this._deferredResponse.settled=!0,this._deferredResponse.resolve(m)}upgradeToSse(){let m,h=new ReadableStream({start:(p)=>{m=p},cancel:()=>{this.close()}});this._sse={controller:m,encoder:new TextEncoder,closed:!1},this._sse.keepAliveTimer=Fi(this._keepAliveMs,()=>this.writeCommentFrame("keepalive")),this.settleResponse(new Response(h,{status:200,headers:{"Content-Type":"text/event-stream","Cache-Control":"no-cache, no-transform",Connection:"keep-alive","X-Accel-Buffering":"no"}}))}finalizeStream(){if(this._sse?.keepAliveTimer!==void 0)clearInterval(this._sse.keepAliveTimer);if(this._sse!==void 0&&!this._sse.closed){this._sse.closed=!0;try{this._sse.controller.close()}catch{}}queueMicrotask(()=>void this.close())}writeMessageFrame(m){this.writeFrame(`event: message
|
|
19
|
+
data: ${JSON.stringify(m)}
|
|
20
|
+
|
|
21
|
+
`)}writeFrame(m){if(this._sse===void 0||this._sse.closed)return;try{this._sse.controller.enqueue(this._sse.encoder.encode(m))}catch(h){this.onerror?.(Error(`Failed to write to the response stream: ${h}`))}}};function Zm(m){return m instanceof Nl?jl(m):void 0}function Xm(m){return typeof m==="object"&&m!==null&&"setScopeChallengeResolver"in m&&typeof m.setScopeChallengeResolver==="function"}var Qm=8,eh=600000;function th(m){if(m?.maxRounds!==void 0&&(!Number.isInteger(m.maxRounds)||m.maxRounds<1))throw RangeError(`inputRequired.maxRounds must be a positive integer (got ${m.maxRounds})`);if(m?.roundTimeoutMs!==void 0&&(!Number.isFinite(m.roundTimeoutMs)||m.roundTimeoutMs<=0))throw RangeError(`inputRequired.roundTimeoutMs must be a positive number (got ${m.roundTimeoutMs})`);return{maxRounds:m?.maxRounds??Qm,roundTimeoutMs:m?.roundTimeoutMs??eh,legacyShim:m?.legacyShim??!0}}function kl(m,h,p){if(p===null||typeof p!=="object"||typeof p.method!=="string")throw new Ee(be.InternalError,`Handler for ${m} returned an invalid input request '${h}': each inputRequests entry must be an embedded elicitation/create, sampling/createMessage, or roots/list request`);let f=p,g=Ec(f);if(g===void 0)throw new Ee(be.InternalError,`Handler for ${m} returned an input request '${h}' of kind '${f.method}', which is not an embedded request the 2026-07-28 revision defines`);return{embedded:f,required:g}}function rh(){let m=globalThis.crypto;if(m?.randomUUID!==void 0)return m.randomUUID();let h=new Uint8Array(16);m.getRandomValues(h),h[6]=h[6]&15|64,h[8]=h[8]&63|128;let p=[...h].map((f)=>f.toString(16).padStart(2,"0")).join("");return`${p.slice(0,8)}-${p.slice(8,12)}-${p.slice(12,16)}-${p.slice(16,20)}-${p.slice(20)}`}function Vi(m,h){if(m==="tools/call")return{content:[{type:"text",text:h}],isError:!0};throw new Ee(be.InternalError,h)}var sh=class{constructor(m){this._host=m}async fulfill(m,h,p,f,g){let{maxRounds:S,roundTimeoutMs:y}=this._host,z=f.mcpReq.signal,v=g,T=0;while(!0){if(T+=1,T>S)return Vi(m,Gc(m,S));let O=v.inputRequests,C=O!=null&&Object.keys(O).length>0,U=typeof v.requestState==="string"?v.requestState:void 0;if(!C&&U===void 0)throw new Ee(be.InternalError,`Handler for ${m} returned an input-required result with neither inputRequests nor requestState (every InputRequiredResult must include at least one of the two)`);let F;if(C){let x=this._host.resolvedClientCapabilities(f),q=[];for(let[L,K]of Object.entries(O)){let{embedded:ae,required:H}=kl(m,L,K);if(ae.method!=="roots/list"&&ae.params===void 0)throw new Ee(be.InternalError,`Handler for ${m} returned an input request '${L}' of kind '${ae.method}' without params`);if(cn(H,x)!==void 0)return Vi(m,`Cannot request input '${L}' (${ae.method}): the client on this 2025-era connection did not declare the required capability${x===void 0?" (no client capabilities are available on this connection — per-request legacy serving cannot receive server-to-client requests)":""}`);q.push([L,ae])}let Z=Yc(z);try{let L={relatedRequestId:f.mcpReq.id,timeout:y,resetTimeoutOnProgress:!0,onprogress:()=>{},signal:Z.signal},K=await Promise.all(q.map(async([ae,H])=>{try{return[ae,await this._dispatchLeg(H,L)]}catch(k){throw Z.abort(k),k}}));F=Object.fromEntries(K)}catch(L){if(z.aborted)throw L;return Vi(m,`Fulfilling input required by '${m}' failed: ${L instanceof Error?L.message:String(L)}`)}finally{Z.dispose()}}else await Wc(Kc,z);let V={...f,mcpReq:{...f.mcpReq,inputResponses:F,droppedInputResponseKeys:void 0,requestState:Hs(U)}};if(U!==void 0){let x=await this._host.verifyRequestState(U,V,m);if(x!==void 0)V=Ti(V,x)}let B=await h(p,V);if(!zt(B))return B;v=B}}async _dispatchLeg(m,h){switch(m.method){case"elicitation/create":{let p=m.params;if(p.mode==="url"&&p.elicitationId===void 0)p={...p,elicitationId:rh()};return await this._host.sendElicitation(p,h)}case"sampling/createMessage":return await this._host.sendSampling(m.params,h);case"roots/list":return await this._host.listRoots(m.params,h)}}},oh=new Set(["tools/call","prompts/get","resources/read"]),ah,Ml,Al;function Bi(m,h){Ml(m,h)}function Ji(m){return Al(m)}var Ll=class extends Ci{_clientCapabilities;_clientVersion;static{ah=(m,h)=>{if(h.clientCapabilities!==void 0)m._clientCapabilities=h.clientCapabilities;if(h.clientInfo!==void 0)m._clientVersion=h.clientInfo},Ml=(m,h)=>{let p=h.filter((f)=>!m._supportedProtocolVersions.includes(f));if(p.length>0)m._supportedProtocolVersions=[...m._supportedProtocolVersions,...p];m.setRequestHandler("server/discover",()=>m._ondiscover())},Al=(m)=>m._serverInfo}_capabilities;_instructions;_jsonSchemaValidator;_cacheHints;_requestStateVerify;_inputRequiredServing;_legacyShim;_boundFromTransport=!1;_legacyInputRequiredShim(){return this._legacyShim??=new sh({maxRounds:this._inputRequiredServing.maxRounds,roundTimeoutMs:this._inputRequiredServing.roundTimeoutMs,resolvedClientCapabilities:(m)=>this._inputRequestCapabilityView(m),verifyRequestState:(m,h,p)=>this._verifyRequestState(m,h,p),sendElicitation:(m,h)=>this._sendElicitationLeg(m,h,{validateAcceptedContent:!1}),sendSampling:(m,h)=>this.createMessage(m,h),listRoots:(m,h)=>this.listRoots(m,h)})}oninitialized;constructor(m,h){super(h);if(this._serverInfo=m,this._capabilities=h?.capabilities?{...h.capabilities}:{},this._instructions=h?.instructions,this._jsonSchemaValidator=h?.jsonSchemaValidator??new zn,this._requestStateVerify=h?.requestState?.verify,this._inputRequiredServing=th(h?.inputRequired),h?.cacheHints!==void 0){for(let[p,f]of Object.entries(h.cacheHints))if(f!==void 0)yi(f,`cacheHints['${p}']`);this._cacheHints=h.cacheHints}if(this.setRequestHandler("initialize",(p)=>this._oninitialize(p)),this.setNotificationHandler("notifications/initialized",()=>this.oninitialized?.()),ln(this._supportedProtocolVersions).length>0)this.setRequestHandler("server/discover",()=>this._ondiscover());if(this._capabilities.logging)this._registerLoggingHandler()}async connect(m){if(this.transport!==void 0)throw new Pe(Oe.AlreadyConnected,"Use a separate Server instance per connection: this instance is already connected to a transport. To connect it to a new transport, call close() first.");if(this._boundFromTransport)this._boundFromTransport=!1,this._negotiatedProtocolVersion=void 0;let h=Zm(m)?.revision;if(h!==void 0&&!this._servedModernEra()&&ft.includes(h)&&ln(this._supportedProtocolVersions).includes(h))this._negotiatedProtocolVersion=h,this._boundFromTransport=!0;await super.connect(m)}_registerLoggingHandler(){this.setRequestHandler("logging/setLevel",async(m,h)=>{let p=h.sessionId||h.http?.req?.headers.get("mcp-session-id")||void 0,{level:f}=m.params,g=gn(Mt,f);if(g.success)this._loggingLevels.set(p,g.data);return{}})}buildContext(m,h){let p=m.http||h?.request||h?.closeSSEStream||h?.closeStandaloneSSEStream;return{...m,mcpReq:{...m.mcpReq,log:(f,g,S)=>{if(!this._capabilities.logging)return Promise.resolve();let y;if(this._servedModernEra()){if(y=m.mcpReq.envelope?.[It],y===void 0)return Promise.resolve()}else y=this._loggingLevels.get(m.sessionId)??this._loggingLevels.get(void 0);if(y!==void 0&&this.LOG_LEVEL_SEVERITY.get(f)<this.LOG_LEVEL_SEVERITY.get(y))return Promise.resolve();return m.mcpReq.notify({method:"notifications/message",params:{level:f,data:g,logger:S}})},elicitInput:(f,g)=>this.elicitInput(f,g),requestSampling:(f,g)=>this.createMessage(f,g)},http:p?{...m.http,req:h?.request,closeSSE:h?.closeSSEStream,closeStandaloneSSE:h?.closeStandaloneSSEStream}:void 0}}_loggingLevels=new Map;LOG_LEVEL_SEVERITY=new Map(Mt.options.map((m,h)=>[m,h]));isMessageIgnored=(m,h)=>{let p=this._loggingLevels.get(h);return p?this.LOG_LEVEL_SEVERITY.get(m)<this.LOG_LEVEL_SEVERITY.get(p):!1};registerCapabilities(m){if(this.transport)throw new Pe(Oe.AlreadyConnected,"Cannot register capabilities after connecting to transport");let h=!!this._capabilities.logging;if(this._capabilities=Ii(this._capabilities,m),!h&&this._capabilities.logging)this._registerLoggingHandler()}_wrapHandler(m,h){if(m!=="tools/call"){let p=this._cacheHints?.[m],f=oh.has(m);if(p===void 0&&!f)return async(g,S)=>{let y=await h(g,S);if(zt(y))throw new Ee(be.InternalError,`Handler for ${m} returned an input-required result, but only tools/call, prompts/get and resources/read support input_required (protocol revision 2026-07-28)`);return y};return async(g,S)=>{let y=f?await this._invokeInputRequiredCapableHandler(m,h,g,S):await h(g,S);if(zt(y)){if(!f)throw new Ee(be.InternalError,`Handler for ${m} returned an input-required result, but only tools/call, prompts/get and resources/read support input_required (protocol revision 2026-07-28)`);return y}return p===void 0?y:un(y,p)}}return async(p,f)=>{let g=Rt(this._negotiatedProtocolVersion),S=g.validateRequest("tools/call",p);if(!S.ok)throw new Ee(S.reason==="not-in-era"?be.InternalError:be.InvalidParams,S.reason==="not-in-era"?"No wire schema for tools/call in the resolved era":`Invalid tools/call request: ${S.message}`);let y=await this._invokeInputRequiredCapableHandler("tools/call",h,p,f);if(zt(y))return y;let z=hi(y),v=g.validateResult("tools/call",z);if(!v.ok)throw new Ee(v.reason==="not-in-era"?be.InternalError:be.InvalidParams,v.reason==="not-in-era"?"No wire schema for tools/call in the resolved era":`Invalid tools/call result: ${v.message}`);return v.value}}_servedModernEra(){return this._negotiatedProtocolVersion!==void 0&&Or(this._negotiatedProtocolVersion)}async _invokeInputRequiredCapableHandler(m,h,p,f){let g=this._servedModernEra(),S=f.mcpReq.requestState();if(S!==void 0&&typeof S!=="string")throw new Ee(be.InvalidParams,"Invalid or expired requestState",{reason:"invalid_request_state"});let y=f;if(typeof S==="string"){let C=await this._verifyRequestState(S,f,m);if(C!==void 0)y=Ti(f,C)}let z;try{z=await h(p,y)}catch(C){if(C instanceof Ee&&C.code===be.UrlElicitationRequired){if(!g)throw C;throw new Ee(be.InternalError,`URL elicitation cannot be signalled by throwing UrlElicitationRequiredError on protocol revision ${this._negotiatedProtocolVersion}: return inputRequired({ inputRequests: { …: inputRequired.elicitUrl(...) } }) from the handler instead. The urlElicitationRequired error (-32042) of earlier revisions is not available on this revision.`)}throw C}if(!zt(z))return z;if(!g){if(!this._inputRequiredServing.legacyShim)throw new Ee(be.InternalError,`Handler for ${m} returned an input-required result, but this request is served on protocol revision ${this._negotiatedProtocolVersion??Zt}, which has no input_required vocabulary`);return await this._legacyInputRequiredShim().fulfill(m,h,p,y,z)}let v=z.inputRequests,T=v!=null&&Object.keys(v).length>0,O=typeof z.requestState==="string";if(!T&&!O)throw new Ee(be.InternalError,`Handler for ${m} returned an input-required result with neither inputRequests nor requestState (every InputRequiredResult must include at least one of the two)`);if(T){let C=this._inputRequestCapabilityView(f);for(let[U,F]of Object.entries(v)){let{embedded:V,required:B}=kl(m,U,F),x=cn(B,C);if(x!==void 0)throw new mn({requiredCapabilities:x},`Cannot request input '${U}' (${V.method}): the request's client capabilities do not declare the required capability`)}}return z}async _verifyRequestState(m,h,p){if(this._requestStateVerify===void 0)return;try{return await this._requestStateVerify(m,h)}catch(f){throw this.onerror?.(Error(`requestState verification rejected ${p}: ${f instanceof Error?f.message:String(f)}`)),new Ee(be.InvalidParams,"Invalid or expired requestState",{reason:"invalid_request_state"})}}_inputRequestCapabilityView(m){return this._servedModernEra()?m.mcpReq.envelope?.[_t]:this._clientCapabilities}_assertPushApiInServedEra(m){if(this._servedModernEra())throw new Pe(Oe.MethodNotSupportedByProtocolVersion,`Server-to-client requests are not available on protocol revision ${this._negotiatedProtocolVersion}: '${m}' cannot be sent while serving a request on that revision. Return inputRequired({ ... }) from the handler instead — the client fulfils the embedded requests and retries the original request (multi round-trip requests).`,{method:m,era:"2026-07-28"})}assertCapabilityForMethod(m){switch(m){case"sampling/createMessage":if(!this._clientCapabilities?.sampling)throw new Pe(Oe.CapabilityNotSupported,`Client does not support sampling (required for ${m})`);break;case"elicitation/create":if(!this._clientCapabilities?.elicitation)throw new Pe(Oe.CapabilityNotSupported,`Client does not support elicitation (required for ${m})`);break;case"roots/list":if(!this._clientCapabilities?.roots)throw new Pe(Oe.CapabilityNotSupported,`Client does not support listing roots (required for ${m})`);break;case"ping":break}}assertNotificationCapability(m){switch(m){case"notifications/message":if(!this._capabilities.logging)throw new Pe(Oe.CapabilityNotSupported,`Server does not support logging (required for ${m})`);break;case"notifications/resources/updated":case"notifications/resources/list_changed":if(!this._capabilities.resources)throw new Pe(Oe.CapabilityNotSupported,`Server does not support notifying about resources (required for ${m})`);break;case"notifications/tools/list_changed":if(!this._capabilities.tools)throw new Pe(Oe.CapabilityNotSupported,`Server does not support notifying of tool list changes (required for ${m})`);break;case"notifications/prompts/list_changed":if(!this._capabilities.prompts)throw new Pe(Oe.CapabilityNotSupported,`Server does not support notifying of prompt list changes (required for ${m})`);break;case"notifications/elicitation/complete":if(!this._clientCapabilities?.elicitation?.url)throw new Pe(Oe.CapabilityNotSupported,`Client does not support URL elicitation (required for ${m})`);break;case"notifications/cancelled":break;case"notifications/progress":break}}assertRequestHandlerCapability(m){switch(m){case"completion/complete":if(!this._capabilities.completions)throw new Pe(Oe.CapabilityNotSupported,`Server does not support completions (required for ${m})`);break;case"logging/setLevel":if(!this._capabilities.logging)throw new Pe(Oe.CapabilityNotSupported,`Server does not support logging (required for ${m})`);break;case"prompts/get":case"prompts/list":if(!this._capabilities.prompts)throw new Pe(Oe.CapabilityNotSupported,`Server does not support prompts (required for ${m})`);break;case"resources/list":case"resources/templates/list":case"resources/read":if(!this._capabilities.resources)throw new Pe(Oe.CapabilityNotSupported,`Server does not support resources (required for ${m})`);break;case"tools/call":case"tools/list":if(!this._capabilities.tools)throw new Pe(Oe.CapabilityNotSupported,`Server does not support tools (required for ${m})`);break;case"ping":case"initialize":break}}async _oninitialize(m){let h=m.params.protocolVersion;this._clientCapabilities=m.params.capabilities,this._clientVersion=m.params.clientInfo;let p=Pc(this._supportedProtocolVersions),f=p.includes(h)?h:p[0]??Zt;return this._negotiatedProtocolVersion=f,this.transport?.setProtocolVersion?.(f),{protocolVersion:f,capabilities:this.getCapabilities(),serverInfo:this._serverInfo,...this._instructions&&{instructions:this._instructions}}}_ondiscover(){return{supportedVersions:ln(this._supportedProtocolVersions),capabilities:nh(this.getCapabilities()),...this._instructions&&{instructions:this._instructions}}}_outboundServerInfo(){return this._serverInfo}getClientCapabilities(){return this._clientCapabilities}getClientVersion(){return this._clientVersion}getNegotiatedProtocolVersion(){return this._negotiatedProtocolVersion}projectCallToolResult(m,h){return this._wireCodec().projectCallToolResult(m,h)}getCapabilities(){return this._capabilities}async ping(){return this._assertPushApiInServedEra("ping"),this.request({method:"ping"})}async createMessage(m,h){if(this._assertPushApiInServedEra("sampling/createMessage"),(m.tools||m.toolChoice)&&!this._clientCapabilities?.sampling?.tools)throw new Pe(Oe.CapabilityNotSupported,"Client does not support sampling tools capability.");if(m.messages.length>0){let S=m.messages.at(-1),y=Array.isArray(S.content)?S.content:[S.content],z=y.some((C)=>C.type==="tool_result"),v=m.messages.length>1?m.messages.at(-2):void 0,T=v?Array.isArray(v.content)?v.content:[v.content]:[],O=T.some((C)=>C.type==="tool_use");if(z){if(y.some((C)=>C.type!=="tool_result"))throw new Ee(be.InvalidParams,"The last message must contain only tool_result content if any is present");if(!O)throw new Ee(be.InvalidParams,"tool_result blocks are not matching any tool_use from the previous message")}if(O){let C=new Set(T.filter((F)=>F.type==="tool_use").map((F)=>F.id)),U=new Set(y.filter((F)=>F.type==="tool_result").map((F)=>F.toolUseId));if(C.size!==U.size||![...C].every((F)=>U.has(F)))throw new Ee(be.InvalidParams,"ids of tool_result blocks and tool_use blocks from previous message do not match")}}let p=Boolean(m.tools||m.toolChoice),f=await this.request({method:"sampling/createMessage",params:m},h),g=this._wireCodec().samplingResultVariant(p,f);if(!g.ok)throw new Pe(Oe.InvalidResult,`Invalid sampling/createMessage result: ${g.reason==="invalid"?g.message:g.reason}`);return g.value}async elicitInput(m,h){switch(this._assertPushApiInServedEra("elicitation/create"),m.mode??"form"){case"url":if(!this._clientCapabilities?.elicitation?.url)throw new Pe(Oe.CapabilityNotSupported,"Client does not support url elicitation.");break;case"form":if(!this._clientCapabilities?.elicitation?.form)throw new Pe(Oe.CapabilityNotSupported,"Client does not support form elicitation.");break}return this._sendElicitationLeg(m,h)}async _sendElicitationLeg(m,h,p){let f=m.mode??"form",g=p?.validateAcceptedContent??!0;switch(f){case"url":{let S=m;return this.request({method:"elicitation/create",params:S},h)}case"form":{let S=m.mode==="form"?m:{...m,mode:"form"},y=await this.request({method:"elicitation/create",params:S},h);if(g&&y.action==="accept"&&y.content&&S.requestedSchema)try{let z=this._jsonSchemaValidator.getValidator(S.requestedSchema)(y.content);if(!z.valid)throw new Ee(be.InvalidParams,`Elicitation response content does not match requested schema: ${z.errorMessage}`)}catch(z){if(z instanceof Ee)throw z;throw new Ee(be.InternalError,`Error validating elicitation response: ${z instanceof Error?z.message:String(z)}`)}return y}}}createElicitationCompletionNotifier(m,h){if(!this._clientCapabilities?.elicitation?.url)throw new Pe(Oe.CapabilityNotSupported,"Client does not support URL elicitation (required for notifications/elicitation/complete)");return()=>this.notification({method:"notifications/elicitation/complete",params:{elicitationId:m}},h)}async listRoots(m,h){return this._assertPushApiInServedEra("roots/list"),this.request({method:"roots/list",params:m},h)}async sendLoggingMessage(m,h){if(this._capabilities.logging&&!this.isMessageIgnored(m.level,h))return this.notification({method:"notifications/message",params:m})}async sendResourceUpdated(m){return this.notification({method:"notifications/resources/updated",params:m})}async sendResourceListChanged(){return this.notification({method:"notifications/resources/list_changed"})}async sendToolListChanged(){return this.notification({method:"notifications/tools/list_changed"})}async sendPromptListChanged(){return this.notification({method:"notifications/prompts/list_changed"})}};function nh(m){return{...m}}function ih(m,h){let p=0,f=[m];while(f.length>0){let g=f.pop();if(g===null||typeof g!=="object")continue;if(Array.isArray(g))for(let S of g){if(++p>h)return p;if(S!==null&&typeof S==="object")f.push(S)}else for(let S in g){if(!Object.prototype.hasOwnProperty.call(g,S))continue;if(++p>h)return p;let y=g[S];if(y!==null&&typeof y==="object")f.push(y)}}return p}function ch(m){if(m===void 0||m===1/0)return;if(typeof m!=="number"||Number.isNaN(m)||m<1)throw RangeError(`maxToolInputElements must be a number of at least 1, or Infinity, got ${String(m)}`);return m}var Bs=class{server;_maxToolInputElements;_registeredResources={};_registeredResourceTemplates={};_registeredTools={};_registeredPrompts={};_toolInputSchemaJson={};toolInputSchemaJson(m){let h=this._registeredTools[m];if(h===void 0||!h.enabled)return;if(Object.hasOwn(this._toolInputSchemaJson,m))return this._toolInputSchemaJson[m];if(h.inputSchema===void 0)return El;try{let p=ar(h.inputSchema,"input");return this._toolInputSchemaJson[m]=p,p}catch{return}}constructor(m,h){if(this.server=new Ll(m,h),this._maxToolInputElements=ch(h?.maxToolInputElements),h?.capabilities?.tools)this.setToolRequestHandlers();if(h?.capabilities?.resources)this.setResourceRequestHandlers();if(h?.capabilities?.prompts)this.setPromptRequestHandlers()}async connect(m){if(Xm(m))m.setScopeChallengeResolver((h)=>this.resolveScopeChallenge(h));return await this.server.connect(m)}async close(){await this.server.close()}resolveScopeChallenge=(m)=>{switch(m.request.method){case"tools/call":{let h=m.request.params?.name;if(typeof h!=="string")return;let p=this._registeredTools[h];if(p===void 0||!p.enabled)return;return p.scopeChallenge?.(m)}case"resources/read":{let h=m.request.params?.uri;if(typeof h!=="string")return;let p;try{p=new URL(h)}catch{return}let f=this._registeredResources[p.toString()];if(f!==void 0)return f.enabled?f.scopeChallenge?.(m):void 0;for(let g of Object.values(this._registeredResourceTemplates))if(g.resourceTemplate.uriTemplate.match(p.toString()))return g.enabled?g.scopeChallenge?.(m):void 0;return}case"prompts/get":{let h=m.request.params?.name;if(typeof h!=="string")return;let p=this._registeredPrompts[h];if(p===void 0||!p.enabled)return;return p.scopeChallenge?.(m)}default:return}};_toolHandlersInitialized=!1;setToolRequestHandlers(){if(this._toolHandlersInitialized)return;this.server.assertCanSetRequestHandler("tools/list"),this.server.assertCanSetRequestHandler("tools/call"),this.server.registerCapabilities({tools:{listChanged:this.server.getCapabilities().tools?.listChanged??!0}}),this.server.setRequestHandler("tools/list",()=>({tools:Object.entries(this._registeredTools).filter(([,m])=>m.enabled).map(([m,h])=>{let p={name:m,title:h.title,description:h.description,inputSchema:h.inputSchema?lh(m,h.inputSchema):El,annotations:h.annotations,icons:h.icons,execution:h.execution,_meta:h._meta};if(h.outputSchema)p.outputSchema=ar(h.outputSchema,"output");return p})})),this.server.setRequestHandler("tools/call",async(m,h)=>{let p=this._registeredTools[m.params.name];if(!p)throw new Ee(be.InvalidParams,`Tool ${m.params.name} not found`);if(!p.enabled)throw new Ee(be.InvalidParams,`Tool ${m.params.name} disabled`);try{let f=await this.validateToolInput(p,m.params.arguments,m.params.name),g=await this.executeToolHandler(p,f,h);if(await this.validateToolOutput(p,g,m.params.name),zt(g))return g;return this.server.projectCallToolResult(g,p.outputSchemaJson)}catch(f){if(f instanceof Ee&&f.code===be.UrlElicitationRequired)throw f;return this.createToolError(f instanceof Error?f.message:String(f))}}),this._toolHandlersInitialized=!0}createToolError(m){return{content:[{type:"text",text:m}],isError:!0}}async validateToolInput(m,h,p){if(this._maxToolInputElements!==void 0&&ih(h,this._maxToolInputElements)>this._maxToolInputElements)throw new Ee(be.InvalidParams,`Invalid arguments for tool ${p}: arguments contain more than the maximum of ${this._maxToolInputElements} elements`);if(!m.inputSchema)return;let f=await tr(m.inputSchema,h??{});if(!f.success)throw new Ee(be.InvalidParams,`Input validation error: Invalid arguments for tool ${p}: ${f.error}`);return f.data}async validateToolOutput(m,h,p){if(!m.outputSchema)return;if(zt(h))return;if(h.isError)return;if(h.structuredContent===void 0)throw new Ee(be.InvalidParams,`Output validation error: Tool ${p} has an output schema but no structured content was provided`);let f=await tr(m.outputSchema,h.structuredContent);if(!f.success)throw new Ee(be.InvalidParams,`Output validation error: Invalid structured content for tool ${p}: ${f.error}`)}async executeToolHandler(m,h,p){return m.executor(h,p)}_completionHandlerInitialized=!1;setCompletionRequestHandler(){if(this._completionHandlerInitialized)return;this.server.assertCanSetRequestHandler("completion/complete"),this.server.registerCapabilities({completions:{}}),this.server.setRequestHandler("completion/complete",async(m)=>{switch(m.params.ref.type){case"ref/prompt":return bi(m),this.handlePromptCompletion(m,m.params.ref);case"ref/resource":return Ri(m),this.handleResourceCompletion(m,m.params.ref);default:throw new Ee(be.InvalidParams,`Invalid completion reference: ${m.params.ref}`)}}),this._completionHandlerInitialized=!0}async handlePromptCompletion(m,h){let p=this._registeredPrompts[h.name];if(!p)throw new Ee(be.InvalidParams,`Prompt ${h.name} not found`);if(!p.enabled)throw new Ee(be.InvalidParams,`Prompt ${h.name} disabled`);if(!p.argsSchema)return Fs;let f=ql(Il(p.argsSchema)?.[m.params.argument.name]);if(!Hi(f))return Fs;let g=Wm(f);if(!g)return Fs;return Cl(await g(m.params.argument.value,m.params.context))}async handleResourceCompletion(m,h){let p=Object.values(this._registeredResourceTemplates).find((g)=>g.resourceTemplate.uriTemplate.toString()===h.uri);if(!p){if(this._registeredResources[h.uri])return Fs;throw new Ee(be.InvalidParams,`Resource template ${m.params.ref.uri} not found`)}let f=p.resourceTemplate.completeCallback(m.params.argument.name);if(!f)return Fs;return Cl(await f(m.params.argument.value,m.params.context))}_resourceHandlersInitialized=!1;setResourceRequestHandlers(){if(this._resourceHandlersInitialized)return;this.server.assertCanSetRequestHandler("resources/list"),this.server.assertCanSetRequestHandler("resources/templates/list"),this.server.assertCanSetRequestHandler("resources/read"),this.server.registerCapabilities({resources:{listChanged:this.server.getCapabilities().resources?.listChanged??!0}}),this.server.setRequestHandler("resources/list",async(m,h)=>{let p=Object.entries(this._registeredResources).filter(([g,S])=>S.enabled).map(([g,S])=>({uri:g,name:S.name,...S.metadata})),f=[];for(let g of Object.values(this._registeredResourceTemplates)){if(!g.resourceTemplate.listCallback)continue;let S=await g.resourceTemplate.listCallback(h);for(let y of S.resources)f.push({...g.metadata,...y})}return{resources:[...p,...f]}}),this.server.setRequestHandler("resources/templates/list",async()=>({resourceTemplates:Object.entries(this._registeredResourceTemplates).map(([m,h])=>({name:m,uriTemplate:h.resourceTemplate.uriTemplate.toString(),...h.metadata}))})),this.server.setRequestHandler("resources/read",async(m,h)=>{let p;try{p=new URL(m.params.uri)}catch{throw new Ee(be.InvalidParams,`Resource URI ${m.params.uri} is invalid`,{uri:m.params.uri,reason:"invalid_uri"})}let f=this._registeredResources[p.toString()];if(f){if(!f.enabled)throw new Ee(be.InvalidParams,`Resource ${p} disabled`);return un(await f.readCallback(p,h),f.cacheHint)}for(let g of Object.values(this._registeredResourceTemplates)){let S=g.resourceTemplate.uriTemplate.match(p.toString());if(S){if(!g.enabled)throw new Ee(be.InvalidParams,`Resource template ${g.resourceTemplate.uriTemplate} disabled`);return un(await g.readCallback(p,S,h),g.cacheHint)}}throw new dn(m.params.uri)}),this._resourceHandlersInitialized=!0}_promptHandlersInitialized=!1;setPromptRequestHandlers(){if(this._promptHandlersInitialized)return;this.server.assertCanSetRequestHandler("prompts/list"),this.server.assertCanSetRequestHandler("prompts/get"),this.server.registerCapabilities({prompts:{listChanged:this.server.getCapabilities().prompts?.listChanged??!0}}),this.server.setRequestHandler("prompts/list",()=>({prompts:Object.entries(this._registeredPrompts).filter(([,m])=>m.enabled).map(([m,h])=>({name:m,title:h.title,description:h.description,arguments:h.argsSchema?Jc(h.argsSchema):void 0,icons:h.icons,_meta:h._meta}))})),this.server.setRequestHandler("prompts/get",async(m,h)=>{let p=this._registeredPrompts[m.params.name];if(!p)throw new Ee(be.InvalidParams,`Prompt ${m.params.name} not found`);if(!p.enabled)throw new Ee(be.InvalidParams,`Prompt ${m.params.name} disabled`);return p.handler(m.params.arguments,h)}),this._promptHandlersInitialized=!0}registerResource(m,h,p,f){let{cacheHint:g,scopeChallenge:S,...y}=p,z=y;if(g!==void 0)yi(g,`resource ${m}`);if(typeof h==="string"){if(this._registeredResources[h])throw Error(`Resource ${h} is already registered`);let v=this._createRegisteredResource(m,p.title,h,z,S,f);if(g!==void 0)v.cacheHint=g;return this.setResourceRequestHandlers(),this.sendResourceListChanged(),v}else{if(this._registeredResourceTemplates[m])throw Error(`Resource template ${m} is already registered`);let v=this._createRegisteredResourceTemplate(m,p.title,h,z,S,f);if(g!==void 0)v.cacheHint=g;return this.setResourceRequestHandlers(),this.sendResourceListChanged(),v}}_createRegisteredResource(m,h,p,f,g,S){let y={name:m,title:h,metadata:f,readCallback:S,scopeChallenge:g,enabled:!0,disable:()=>y.update({enabled:!1}),enable:()=>y.update({enabled:!0}),remove:()=>y.update({uri:null}),update:(z)=>{if(z.uri!==void 0&&z.uri!==p){if(delete this._registeredResources[p],z.uri)this._registeredResources[z.uri]=y}if(z.name!==void 0)y.name=z.name;if(z.metadata!==void 0)y.metadata=z.metadata;if(z.title!==void 0)y.title=z.title,y.metadata={...y.metadata,title:z.title};if(z.callback!==void 0)y.readCallback=z.callback;if(z.scopeChallenge!==void 0)y.scopeChallenge=z.scopeChallenge===null?void 0:z.scopeChallenge;if(z.enabled!==void 0)y.enabled=z.enabled;this.sendResourceListChanged()}};return this._registeredResources[p]=y,y}_createRegisteredResourceTemplate(m,h,p,f,g,S){let y={resourceTemplate:p,title:h,metadata:f,readCallback:S,scopeChallenge:g,enabled:!0,disable:()=>y.update({enabled:!1}),enable:()=>y.update({enabled:!0}),remove:()=>y.update({name:null}),update:(v)=>{if(v.name!==void 0&&v.name!==m){if(delete this._registeredResourceTemplates[m],v.name)this._registeredResourceTemplates[v.name]=y}if(v.template!==void 0)y.resourceTemplate=v.template;if(v.metadata!==void 0)y.metadata=v.metadata;if(v.title!==void 0)y.title=v.title,y.metadata={...y.metadata,title:v.title};if(v.callback!==void 0)y.readCallback=v.callback;if(v.scopeChallenge!==void 0)y.scopeChallenge=v.scopeChallenge===null?void 0:v.scopeChallenge;if(v.enabled!==void 0)y.enabled=v.enabled;this.sendResourceListChanged()}};this._registeredResourceTemplates[m]=y;let z=p.uriTemplate.variableNames;if(Array.isArray(z)&&z.some((v)=>!!p.completeCallback(v)))this.setCompletionRequestHandler();return y}_createRegisteredPrompt(m,h,p,f,g,S,y,z){let v=f,T=g,O={title:h,description:p,argsSchema:f,icons:S,scopeChallenge:y,_meta:z,handler:Pl(m,f,g),enabled:!0,disable:()=>O.update({enabled:!1}),enable:()=>O.update({enabled:!0}),remove:()=>O.update({name:null}),update:(C)=>{if(C.name!==void 0&&C.name!==m){if(delete this._registeredPrompts[m],C.name)this._registeredPrompts[C.name]=O}if(C.title!==void 0)O.title=C.title;if(C.description!==void 0)O.description=C.description;if(C.icons!==void 0)O.icons=C.icons;if(C.scopeChallenge!==void 0)O.scopeChallenge=C.scopeChallenge===null?void 0:C.scopeChallenge;if(C._meta!==void 0)O._meta=C._meta;let U=!1;if(C.argsSchema!==void 0)O.argsSchema=C.argsSchema,v=C.argsSchema,U=!0;if(C.callback!==void 0)T=C.callback,U=!0;if(U)O.handler=Pl(m,v,T);if(C.enabled!==void 0)O.enabled=C.enabled;this.sendPromptListChanged()}};if(this._registeredPrompts[m]=O,f){let C=Il(f);if(C){if(Object.values(C).some((U)=>Hi(ql(U))))this.setCompletionRequestHandler()}}return O}_createRegisteredTool(m,h,p,f,g,S,y,z,v,T,O){ji(m);let C=O,U,F={title:h,description:p,inputSchema:f,outputSchema:g,get outputSchemaJson(){return U??=Tl(F.outputSchema)},set outputSchemaJson(V){U=V},annotations:S,icons:y,execution:z,scopeChallenge:v,_meta:T,handler:O,executor:$l(f,O),enabled:!0,disable:()=>F.update({enabled:!1}),enable:()=>F.update({enabled:!0}),remove:()=>F.update({name:null}),update:(V)=>{if(V.name!==void 0&&V.name!==m){if(typeof V.name==="string")ji(V.name);if(delete this._registeredTools[m],delete this._toolInputSchemaJson[m],V.name)delete this._toolInputSchemaJson[V.name],this._registeredTools[V.name]=F,m=V.name}if(V.title!==void 0)F.title=V.title;if(V.description!==void 0)F.description=V.description;let B=!1;if(V.paramsSchema!==void 0)F.inputSchema=V.paramsSchema,delete this._toolInputSchemaJson[m],B=!0;if(V.callback!==void 0)F.handler=V.callback,C=V.callback,B=!0;if(B)F.executor=$l(F.inputSchema,C);if(V.outputSchema!==void 0)F.outputSchema=V.outputSchema,F.outputSchemaJson=Tl(V.outputSchema);if(V.annotations!==void 0)F.annotations=V.annotations;if(V.icons!==void 0)F.icons=V.icons;if(V.scopeChallenge!==void 0)F.scopeChallenge=V.scopeChallenge===null?void 0:V.scopeChallenge;if(V._meta!==void 0)F._meta=V._meta;if(V.enabled!==void 0)F.enabled=V.enabled;this.sendToolListChanged()}};return this._registeredTools[m]=F,this.setToolRequestHandlers(),this.sendToolListChanged(),F}registerTool(m,h,p){if(this._registeredTools[m])throw Error(`Tool ${m} is already registered`);let{title:f,description:g,inputSchema:S,outputSchema:y,annotations:z,icons:v,scopeChallenge:T,_meta:O}=h;return this._createRegisteredTool(m,f,g,Sn(S),Sn(y),z,v,void 0,T,O,p)}registerPrompt(m,h,p){if(this._registeredPrompts[m])throw Error(`Prompt ${m} is already registered`);let{title:f,description:g,argsSchema:S,icons:y,scopeChallenge:z,_meta:v}=h,T=this._createRegisteredPrompt(m,f,g,Sn(S),p,y,z,v);return this.setPromptRequestHandlers(),this.sendPromptListChanged(),T}isConnected(){return this.server.transport!==void 0}async sendLoggingMessage(m,h){return this.server.sendLoggingMessage(m,h)}sendResourceListChanged(){if(this.isConnected())this.server.sendResourceListChanged()}sendToolListChanged(){if(this.isConnected())this.server.sendToolListChanged()}sendPromptListChanged(){if(this.isConnected())this.server.sendPromptListChanged()}};function $l(m,h){if(m){let f=h;return async(g,S)=>f(g,S)}let p=h;return async(f,g)=>p(g)}var El={type:"object",properties:{}};function lh(m,h){let p=ar(h,"input"),f=zi(p);if(!f.valid)console.warn(`[mcp-sdk] tool '${m}' carries an invalid x-mcp-header declaration and will be excluded by conforming Streamable HTTP clients: ${f.reason}`);return p}function Tl(m){if(m===void 0)return;try{return ar(m,"output")}catch{return}}function Pl(m,h,p){if(h){let f=p;return async(g,S)=>{let y=await tr(h,g??{});if(!y.success)throw new Ee(be.InvalidParams,`Invalid arguments for prompt ${m}: ${y.error}`);return f(y.data,S)}}else{let f=p;return async(g,S)=>f(S)}}function Cl(m){return{completion:{values:m.map(String).slice(0,100),total:m.length,hasMore:m.length>100}}}var Fs={completion:{values:[],hasMore:!1}};function Il(m){let h=m;if(h.shape&&typeof h.shape==="object")return h.shape}function uh(m){return m?.type==="optional"}function ql(m){if(!uh(m))return m;return m.def?.innerType??m}function dh(m,h){switch(h.kind){case"tools_list_changed":return m.toolsListChanged===!0;case"prompts_list_changed":return m.promptsListChanged===!0;case"resources_list_changed":return m.resourcesListChanged===!0;case"resource_updated":return m.resourceSubscriptions!==void 0&&m.resourceSubscriptions.includes(h.uri)}}function mh(m,h){let p={},f=(g)=>h===void 0||g===!0;if(m.toolsListChanged===!0&&f(h?.tools?.listChanged))p.toolsListChanged=!0;if(m.promptsListChanged===!0&&f(h?.prompts?.listChanged))p.promptsListChanged=!0;if(m.resourcesListChanged===!0&&f(h?.resources?.listChanged))p.resourcesListChanged=!0;if(m.resourceSubscriptions!==void 0&&m.resourceSubscriptions.length>0&&f(h?.resources?.subscribe))p.resourceSubscriptions=[...m.resourceSubscriptions];return p}var wn=1024;function Dl(m,h){return{method:m.method,params:{...m.params,_meta:{...m.params?._meta,[Xt]:h}}}}function hh(m){let h=Rt(Vs).validateRequest("subscriptions/listen",m);return h.ok?h.value.params?.notifications:void 0}var ph=new Set(["notifications/tools/list_changed","notifications/prompts/list_changed","notifications/resources/list_changed","notifications/resources/updated"]),Ul=class{_subs=new Map;_serverCapabilities;_serverInfo;constructor(m=wn,h,p){this._maxSubscriptions=m,this._serverCapabilities=h,this._serverInfo=p}setServerCapabilities(m,h){if(this._serverCapabilities=m,h!==void 0)this._serverInfo=h}has(m){return this._subs.has(m)}serve(m){if(this._serverCapabilities===void 0)throw Error("StdioListenRouter.serve() called before setServerCapabilities(); refusing to honor a filter without capabilities");if(this._subs.size>=this._maxSubscriptions)return{jsonrpc:"2.0",id:m.id,error:{code:-32603,message:"Subscription limit reached"}};let h=hh(m);if(h===void 0)return{jsonrpc:"2.0",id:m.id,error:{code:-32602,message:"Invalid params: 'notifications' is required and must be a valid SubscriptionFilter"}};let p=mh(h,this._serverCapabilities);return this._subs.set(m.id,p),Dl({method:"notifications/subscriptions/acknowledged",params:{notifications:p}},m.id)}cancel(m){return this._subs.delete(m)}routeOutbound(m){if(!ph.has(m.method))return"passthrough";let h=m.params?.uri,p=typeof h==="string"?h:void 0,f=fh(m.method,p),g=[];for(let[S,y]of this._subs)if(dh(y,f))g.push(Dl({method:m.method,params:m.params??{}},S));return g}teardownAll(){let m=[];for(let h of this._subs.keys())m.push({jsonrpc:"2.0",id:h,result:{resultType:"complete",_meta:{[Xt]:h,...this._serverInfo!==void 0&&{[pt]:this._serverInfo}}}});return this._subs.clear(),m}};function fh(m,h){switch(m){case"notifications/tools/list_changed":return{kind:"tools_list_changed"};case"notifications/prompts/list_changed":return{kind:"prompts_list_changed"};case"notifications/resources/list_changed":return{kind:"resources_list_changed"};default:return{kind:"resource_updated",uri:h??""}}}var Vl=Symbol("swallowsErrorsAfterClose"),gh=class{_readBuffer;_started=!1;_closed=!1;constructor(m=Ui.stdin,h=Ui.stdout,p){this._stdin=m,this._stdout=h,this._readBuffer=new qi({maxBufferSize:p?.maxBufferSize})}onclose;onerror;onmessage;_ondata=(m)=>{try{this._readBuffer.append(m),this.processReadBuffer()}catch(h){this.onerror?.(h),this.close().catch(()=>{})}};_onerror=(m)=>{this.onerror?.(m)};_onstdouterror=(m)=>{if(this._closed)return;this.onerror?.(m),this.close().catch(()=>{})};_onstdinclose=()=>{this.close().catch(()=>{})};async start(){if(this._started)throw Error("StdioServerTransport already started! If using Server class, note that connect() calls start() automatically.");this._started=!0;for(let m of this._stdout.listeners("error"))if(m[Vl])this._stdout.off("error",m);if(this._stdin.readableEnded||this._stdin.destroyed)setImmediate(this._onstdinclose);this._stdin.on("data",this._ondata),this._stdin.on("error",this._onerror),this._stdin.on("end",this._onstdinclose),this._stdin.on("close",this._onstdinclose),this._stdout.on("error",this._onstdouterror)}processReadBuffer(){while(!0)try{let m=this._readBuffer.readMessage();if(m===null)break;this.onmessage?.(m)}catch(m){this.onerror?.(m)}}async close(){if(this._closed)return;if(this._closed=!0,this._stdin.off("data",this._ondata),this._stdin.off("error",this._onerror),this._stdin.off("end",this._onstdinclose),this._stdin.off("close",this._onstdinclose),this._onstdouterror[Vl]=!0,this._stdin.listenerCount("data")===0)this._stdin.pause();this._readBuffer.clear(),this.onclose?.()}send(m){if(this._closed)return Promise.reject(Error("StdioServerTransport is closed"));return new Promise((h,p)=>{let f=Oi(m),g=!1,S=(z)=>{if(g)return;g=!0,this._stdout.off("error",S),this._stdout.off("drain",y),p(z)},y=()=>{if(g)return;g=!0,this._stdout.off("error",S),this._stdout.off("drain",y),h()};if(this._stdout.once("error",S),this._stdout.write(f)){if(g)return;g=!0,this._stdout.off("error",S),h()}else if(!g)this._stdout.once("drain",y)})}},Hl=3000,Sh=class{onclose;onerror;onmessage;_closed=!1;_pendingRequests=new Set;_drainWaiters=[];constructor(m,h,p){this._wire=m,this._onInstanceClose=h,this._outboundIntercept=p}async start(){}async send(m,h){if(rr(m)||or(m)){let{id:p}=m;if(p!==void 0)this._settle(p)}if(this._closed)return;if(this._outboundIntercept?.(m)==="handled")return;return this._wire.send(m,h)}setProtocolVersion=(m)=>{this._wire.setProtocolVersion?.(m)};deliver(m,h){if(this._closed)return;if(ot(m))this._pendingRequests.add(m.id);else if(Dt(m)&&m.method==="notifications/cancelled"){let p=m.params?.requestId;if(p!==void 0)this._settle(p)}this.onmessage?.(m,h)}async whenRequestsAnswered(m){if(this._closed||this._pendingRequests.size===0)return!0;return await new Promise((h)=>{let p=()=>{clearTimeout(f),h(!0)},f=setTimeout(()=>{this._drainWaiters=this._drainWaiters.filter((g)=>g!==p),h(!1)},m);this._drainWaiters.push(p)})}async close(){if(this._closed)return;this._closed=!0,this._pendingRequests.clear(),this._releaseDrainWaiters();try{this._onInstanceClose()}finally{this.onclose?.()}}_settle(m){if(this._pendingRequests.delete(m),this._pendingRequests.size===0)this._releaseDrainWaiters()}_releaseDrainWaiters(){let m=this._drainWaiters;this._drainWaiters=[];for(let h of m)h()}};function yh(m){let h=m.params;if(m.method==="initialize"&&!wi(h)){let S=h!==null&&typeof h==="object"&&typeof h.protocolVersion==="string"?h.protocolVersion:void 0;return{kind:"legacy",reason:"initialize",...S!==void 0&&{requestedVersion:S}}}if(!hn(h))return{kind:"legacy",reason:"no-claim"};let p=sr(h),f=(p===void 0?[]:fn(p))[0];if(f!==void 0)return{kind:"invalid-envelope",issue:f};let g=pn(h);if(g===void 0||!ft.includes(g))return{kind:"unsupported-revision",requested:g??"unknown"};return{kind:"modern",revision:g,classification:{era:"modern",revision:g}}}function xl(m,h={}){let p=h.legacy??"serve",f=h.transport??new gh,g={phase:"opening"},S,y=!1,z=()=>y||g.phase==="closed",v=(D)=>{try{h.onerror?.(D)}catch{}},T=(D,se,pe,ie)=>f.send({jsonrpc:"2.0",id:D,error:{code:se,message:pe,...ie!==void 0&&{data:ie}}}).catch((fe)=>v(ht(fe))),O=new Ul(h.maxSubscriptions??wn),C=(D)=>{if(!Dt(D))return;let se=O.routeOutbound(D);if(se==="passthrough")return;for(let pe of se)f.send({jsonrpc:"2.0",...pe}).catch((ie)=>v(ht(ie)));return"handled"},U=async(D)=>{if(ot(D)&&D.method==="subscriptions/listen"){let se=sr(D.params),pe=hn(D.params)?(se===void 0?[]:fn(se))[0]:{key:"_meta",problem:"the per-request envelope is required on protocol revision 2026-07-28"},ie=pn(D.params),fe;if(pe!==void 0)fe={jsonrpc:"2.0",id:D.id,error:{code:-32602,message:`Invalid _meta envelope: ${pe.key}: ${pe.problem}`}};else if(ie===void 0||!ft.includes(ie)){let Re=new jr({supported:[...ft],requested:ie??"unknown"});fe={jsonrpc:"2.0",id:D.id,error:{code:Re.code,message:Re.message,data:Re.data}}}else fe=O.serve(D);return await f.send("error"in fe?fe:{jsonrpc:"2.0",method:fe.method,params:fe.params}).catch((Re)=>v(ht(Re))),!0}if(Dt(D)&&D.method==="notifications/cancelled"){let se=D.params?.requestId;if(se!==void 0&&O.cancel(se))return!0}return!1},F=(D,se,pe)=>{let ie=$i({kind:"legacy",reason:se,...pe!==void 0&&{requestedVersion:pe}},ft);if(ie===void 0)return Promise.resolve();return v(Error(`Rejected 2025-era request on a modern-only stdio connection (${ie.cell}): ${ie.message}`)),T(D.id,ie.code,ie.message,ie.data)},V=(D)=>{if(y||D===S)return;H()},B=async(D,se)=>{let pe=await m({era:D}),ie=pe instanceof Bs?pe.server:pe;if(D==="modern")Pi(ie,se),Bi(ie,ft),O.setServerCapabilities(ie.getCapabilities(),Ji(ie));let fe=new Sh(f,()=>V(fe),D==="modern"?C:void 0);return await pe.connect(fe),{product:pe,channel:fe}},x=(D)=>D.product.close().catch((se)=>v(ht(se))),q=async(D)=>{S=D.channel;try{if(!await D.channel.whenRequestsAnswered(Hl))v(Error(`Discarded the probe instance with requests still unanswered after ${Hl}ms; continuing with the fallback`));await D.product.close()}catch(se){v(ht(se))}finally{S=void 0}},Z=async(D)=>{if(g.phase==="closed")return;if(g.phase==="pinned"){if(g.era==="modern"&&ot(D)&&D.method==="initialize"&&!wi(D.params)){await F(D,"initialize",D.params!==null&&typeof D.params==="object"&&typeof D.params.protocolVersion==="string"?D.params.protocolVersion:void 0);return}if(g.era==="modern"&&await U(D))return;if(z())return;g.instance.channel.deliver(D);return}if(!ot(D)&&!Dt(D)){v(Error("Discarded a JSON-RPC response received before the connection negotiated an era"));return}let se=yh(D);switch(se.kind){case"invalid-envelope":{let pe=`Invalid _meta envelope for protocol revision 2026-07-28: ${se.issue.key}: ${se.issue.problem}`;if(ot(D))await T(D.id,be.InvalidParams,pe,{envelope:se.issue});else v(Error(`Discarded a notification with a malformed envelope: ${pe}`));return}case"unsupported-revision":if(ot(D)){let pe=new jr({supported:[...ft],requested:se.requested});v(pe),await T(D.id,pe.code,pe.message,pe.data)}else v(Error(`Discarded a notification claiming unsupported protocol revision ${se.requested}`));return;case"modern":if(ot(D)&&D.method==="server/discover"){if(g.phase==="probe"){g.instance.channel.deliver(D,{classification:se.classification});return}let pe=await B("modern",se.revision);if(z()){await x(pe);return}g={phase:"probe",instance:pe},pe.channel.deliver(D,{classification:se.classification});return}if(g.phase==="probe"){if(Dt(D)){g.instance.channel.deliver(D,{classification:se.classification});return}g={phase:"pinned",era:"modern",instance:g.instance}}else{let pe=await B("modern",se.revision);if(z()){await x(pe);return}g={phase:"pinned",era:"modern",instance:pe}}if(await U(D))return;if(z())return;g.instance.channel.deliver(D,{classification:se.classification});return;case"legacy":{if(p==="reject"){if(ot(D))await F(D,se.reason,se.requestedVersion);return}if(g.phase==="probe"){if(await q(g.instance),z())return;g={phase:"opening"}}let pe=await B("legacy");if(z()){await x(pe);return}g={phase:"pinned",era:"legacy",instance:pe},g.instance.channel.deliver(D);return}}},L=[],K=!1,ae=async()=>{if(K)return;K=!0;try{while(L.length>0){let D=L.shift();try{await Z(D)}catch(se){if(ot(D))await T(D.id,be.InternalError,"Internal server error");v(ht(se))}}}finally{K=!1}},H=async()=>{if(y||g.phase==="closed")return;y=!0;let D=g;g={phase:"closed"};for(let se of O.teardownAll())await f.send(se).catch((pe)=>v(ht(pe)));if(D.phase==="probe"||D.phase==="pinned")await D.instance.product.close().catch((se)=>v(ht(se)));await f.close().catch((se)=>v(ht(se)))};f.onmessage=(D)=>{L.push(D),ae()},f.onerror=(D)=>{if(v(D),g.phase==="probe"||g.phase==="pinned")g.instance.channel.onerror?.(D)},f.onclose=()=>{if(y||g.phase==="closed")return;y=!0;let D=g;if(g={phase:"closed"},D.phase==="probe"||D.phase==="pinned")D.instance.product.close().catch((se)=>v(ht(se)))};let k=f.start().catch((D)=>{throw v(ht(D)),D});return k.catch(()=>{}),{close:async()=>{await k.catch(()=>{}),await H()}}}function ht(m){return m instanceof Error?m:Error(String(m))}var Fl={project:e().optional(),stage:e().optional()},vh={sandboxId:e().min(1),reservationKey:e().min(1)},$n=i().describe("Must be true, after the owner has agreed to this delete."),Bl="'********' keeps a stored secret and null deletes a field: never send a placeholder you did not read from a get.",_h=[{singular:"agent",plural:"agents",key:"agentId",createHint:"Needs name and config; a 409 returns the existing agentId.",deleteHint:"Deleting an agent also drops its runtime rows.",updateHint:Bl,list:(m)=>m.listAgents(),get:(m,h)=>m.getAgent(h),create:(m,h)=>m.createAgent(h),update:(m,h,p)=>m.updateAgent(h,p),remove:(m,h)=>m.deleteAgent(h)},{singular:"cron",plural:"crons",key:"cronId",createHint:"Needs name, agentId, scheduleExpression (rate/cron/at) and input or events.",list:(m)=>m.listCrons(),get:(m,h)=>m.getCron(h),create:(m,h)=>m.createCron(h),update:(m,h,p)=>m.updateCron(h,p),remove:(m,h)=>m.deleteCron(h)},{singular:"sandbox",plural:"sandboxes",key:"sandboxId",updateHint:Bl,list:(m)=>m.listSandboxes(),get:(m,h)=>m.getSandbox(h),create:(m,h)=>m.createSandbox(h),update:(m,h,p)=>m.updateSandbox(h,p),remove:(m,h)=>m.deleteSandbox(h)},{singular:"workspace",plural:"workspaces",key:"workspaceId",list:(m)=>m.listWorkspaces(),get:(m,h)=>m.getWorkspace(h),create:(m,h)=>m.createWorkspace(h),update:(m,h,p)=>m.updateWorkspace(h,p),remove:(m,h)=>m.deleteWorkspace(h)},{singular:"policy",plural:"policies",key:"policyId",createHint:"Agent-runtime policy document (tool.call, skill.load), not API credential scoping.",list:(m)=>m.listPolicies(),get:(m,h)=>m.getPolicy(h),create:(m,h)=>m.createPolicy(h),update:(m,h,p)=>m.updatePolicy(h,p),remove:(m,h)=>m.deletePolicy(h)},{singular:"role",plural:"roles",key:"roleId",createHint:"Needs name and a version-1 policy over the API namespace, e.g. agents:read. Account key only.",list:(m)=>m.listRoles(),get:(m,h)=>m.getRole(h),create:(m,h)=>m.createRole(h),update:(m,h,p)=>m.updateRole(h,p),remove:(m,h)=>m.deleteRole(h)},{singular:"channel",plural:"channels",key:"channelId",list:(m)=>m.listChannels(),get:(m,h)=>m.getChannel(h),create:(m,h)=>m.createChannel(h),update:(m,h,p)=>m.updateChannel(h,p),remove:(m,h)=>m.deleteChannel(h)},{singular:"skill",plural:"skills",key:"skillName",createHint:'source is "files" (base64), "json" or "github". The stored name comes from the SKILL.md frontmatter.',list:(m)=>m.listSkills(),get:(m,h)=>m.getSkill(h),create:(m,h)=>m.createSkill(h),remove:(m,h)=>m.deleteSkill(h)},{singular:"mcp",plural:"mcp",key:"serverId",scoped:!0,list:(m,h)=>m.listMcp(h),get:(m,h)=>m.getMcp(h),create:(m,h,p)=>m.createMcp(p,h),update:(m,h,p)=>m.updateMcp(h,p),remove:(m,h)=>m.deleteMcp(h)}];function Sg(m={}){let h=N()?new _({}):null;if(!h&&!m.cli)throw Error("broods mcp needs a credential: set BROODS_SESSION_TOKEN or BROODS_ACCOUNT_SECRET, or run `broods login`.");let p=new Bs({name:"broods",version:"1"},{capabilities:{tools:{}}});if(h){for(let f of _h)Eh(p,h,f,m.scope??{});$h(p,h)}if(m.cli)zh(p,m.cli);if(m.allowDestructive)wh(p,h,m.cli??null);return p}function yg(m,h){return xl(()=>m,{legacy:"reject",...h?{transport:h}:{}})}function En(m,h){if(!m)throw Error(`Refusing without confirm:true. ${h}`)}async function He(m){try{return Rh(await m())}catch(h){return bh(h)}}function bh(m){return{content:[{type:"text",text:m instanceof Error?m.message:String(m)}],isError:!0}}function Rh(m){return{content:[{type:"text",text:JSON.stringify(m??null,null,2)}]}}function Jl(m,h,p,f){if(!m.scoped)return;let g=p??h.project,S=f??h.stage;if(!g||!S)throw Error(`${m.plural} live in one stage, so this call needs both 'project' and 'stage'`);return{project:g,stage:S}}function zh(m,h){m.registerTool("list-orgs",{description:"Every organization this login can reach, with the current one marked.",inputSchema:{}},async()=>await He(async()=>{let p=await h.getOnboarding();return{currentOrgId:p.currentOrgId,orgs:p.orgs}})),m.registerTool("create-org",{description:"Create an organization and switch this login to it. Later calls act in the new org.",inputSchema:{name:e().min(1)}},async({name:p})=>await He(async()=>await h.createOnboardingOrg(p))),m.registerTool("select-org",{description:"Switch this login to another organization, by an orgId from list-orgs.",inputSchema:{orgId:e().min(1)}},async({orgId:p})=>await He(async()=>await h.selectOnboardingOrg(p))),m.registerTool("list-projects",{description:"Every project in the current org, empty ones last. Project names are not unique, so take the id from here.",inputSchema:{}},async()=>await He(async()=>await h.listProjects())),m.registerTool("list-stages",{description:"Every stage of one project, by project name.",inputSchema:{project:e().min(1)}},async({project:p})=>await He(async()=>await h.listStages(p))),m.registerTool("create-stage",{description:"Create a stage in a project, optionally cloning another stage's architecture and env vars. A project name that does not exist yet is created with it, which is the only way to make a project without deploying a manifest.",inputSchema:{project:e().min(1),name:e().min(1),from:e().optional().describe("Stage to clone architecture and env vars from.")}},async({project:p,name:f,from:g})=>await He(async()=>await h.createStage(p,f,g)))}function wh(m,h,p){if(h)m.registerTool("rotate-secret",{description:"Rotate the account key. The current key stops working immediately and the new one is shown once, so this breaks every deployment and CI job still holding the old one. Requires confirm:true.",inputSchema:{confirm:$n}},async({confirm:f})=>await He(async()=>(En(f,"Everything holding the current secret breaks the moment this runs."),await h.rotateSecret())));if(p)m.registerTool("delete-project",{description:"Delete a project and everything under it: stages, agents, canvas, env vars, crons and workspace files. Takes a projectId from list-projects and requires confirm:true.",inputSchema:{projectId:e().min(1),confirm:$n}},async({projectId:f,confirm:g})=>await He(async()=>(En(g,`Project '${f}' and everything under it goes away: name it, get the owner's agreement, then retry.`),await p.deleteProject(f))))}function $h(m,h){m.registerTool("list-cron-runs",{description:"Run history for one cron, newest first. Check this before telling anyone a cron fired.",inputSchema:{cronId:e().min(1),limit:o().int().positive().max(100).optional()}},async({cronId:f,limit:g})=>await He(async()=>await h.listCronRuns(f,g===void 0?{}:{limit:g})));let p=[["suspend-sandbox","Suspend a persistent sandbox reservation.",(f,g)=>h.suspendSandbox(f,g)],["resume-sandbox","Resume a suspended sandbox reservation.",(f,g)=>h.resumeSandbox(f,g)],["terminate-sandbox","Terminate a sandbox reservation and drop its live-instance row. Terminate only a sandbox you created, and never one holding state you did not put there.",(f,g)=>h.terminateSandbox(f,g)],["open-sandbox-terminal","Mint a short-lived sealed ticket for an interactive PTY session on a persistent sandbox.",(f,g)=>h.openSandboxTerminal(f,g)]];for(let[f,g,S]of p)m.registerTool(f,{description:g,inputSchema:vh},async({sandboxId:y,reservationKey:z})=>await He(async()=>await S(y,z)));m.registerTool("snapshot-sandbox",{description:"Snapshot a sandbox reservation into an image its provider's sandboxes can pin with `snapshot` (sandbox, lambda, daytona, e2b or vercel; lambda builds for a few minutes).",inputSchema:{sandboxId:e().min(1),reservationKey:e().min(1),name:e().min(1)}},async({sandboxId:f,reservationKey:g,name:S})=>await He(async()=>await h.snapshotSandbox(f,g,S))),m.registerTool("upload-skill",{description:"Replace one skill's bundle wholesale (PUT, not a merge) by skillName. 'body' is the same source shape create-skill takes.",inputSchema:{id:e().min(1).describe("The skillName."),body:s(e(),c())}},async({id:f,body:g})=>await He(async()=>await h.uploadSkill(f,g))),m.registerTool("list-env-vars",{description:"List environment variable names. Values are write-only: the plane never returns them, so there is no read.",inputSchema:{}},async()=>await He(async()=>await h.listEnvVars())),m.registerTool("set-env-var",{description:"Create or replace one write-only environment variable. Reference it from a config as ${NAME} rather than inlining the value.",inputSchema:{name:e().min(1),value:e()}},async({name:f,value:g})=>await He(async()=>(await h.setEnvVar(f,g),{name:f,stored:!0}))),m.registerTool("delete-env-var",{description:"Delete one environment variable.",inputSchema:{name:e().min(1),confirm:$n}},async({name:f,confirm:g})=>await He(async()=>(En(g,`Anything referencing \${${f}} breaks the moment this env var goes.`),{deleted:await h.deleteEnvVar(f),name:f}))),m.registerTool("assume-role",{description:"Exchange a role for a short-lived session token (default 1h, max 12h). Hand the returned token to whatever tool needs narrow access, as BROODS_SESSION_TOKEN. It is shown once and is not stored here.",inputSchema:{roleId:e().min(1),ttlSeconds:o().int().positive().max(43200).optional()}},async({roleId:f,ttlSeconds:g})=>await He(async()=>await h.assumeRole(f,g===void 0?{}:{ttlSeconds:g}))),m.registerTool("update-account",{description:"Rename this account or change its description. Everything else about an account is derived, not settable.",inputSchema:{username:e().optional(),description:e().nullable().optional()}},async({username:f,description:g})=>await He(async()=>await h.updateAccount({...f===void 0?{}:{username:f},...g===void 0?{}:{description:g}}))),m.registerTool("get-account",{description:"The account this server's credential resolves to. Run it first to confirm which tenant you are about to change.",inputSchema:{}},async()=>await He(async()=>await h.getAccount()))}function Eh(m,h,p,f){let g=e().min(1).describe(`The ${p.key}.`),S=p.scoped?` ${p.plural} live in one stage, so this also takes 'project' and 'stage'.`:"",{list:y,get:z,create:v,update:T,remove:O}=p;if(y){let C=`List every ${p.singular} on the account.${S}`;if(p.scoped)m.registerTool(`list-${p.plural}`,{description:C,inputSchema:Fl},async({project:U,stage:F})=>await He(async()=>await y(h,Jl(p,f,U,F))));else m.registerTool(`list-${p.plural}`,{description:C,inputSchema:{}},async()=>await He(async()=>await y(h)))}if(z)m.registerTool(`get-${p.singular}`,{description:`Read one ${p.singular} by ${p.key}.`,inputSchema:{id:g}},async({id:C})=>await He(async()=>await z(h,C)));if(v){let C=`Create one ${p.singular}. 'body' is the request body the config plane documents.`+(p.createHint?` ${p.createHint}`:"")+S+" Prefer changing the broods/ manifest and deploying for anything the project already declares.",U=s(e(),c());if(p.scoped)m.registerTool(`create-${p.singular}`,{description:C,inputSchema:{body:U,...Fl}},async({body:F,project:V,stage:B})=>await He(async()=>await v(h,F,Jl(p,f,V,B))));else m.registerTool(`create-${p.singular}`,{description:C,inputSchema:{body:U}},async({body:F})=>await He(async()=>await v(h,F)))}if(T)m.registerTool(`update-${p.singular}`,{description:`Deep-merge a patch into one ${p.singular} and return the updated record, so there is no need to read it back.`+(p.updateHint?` ${p.updateHint}`:""),inputSchema:{id:g,body:s(e(),c())}},async({id:C,body:U})=>await He(async()=>await T(h,C,U)));if(O)m.registerTool(`delete-${p.singular}`,{description:`Delete one ${p.singular}. Requires confirm:true, and takes one ${p.key} per call: never loop this over a list.`+(p.deleteHint?` ${p.deleteHint}`:""),inputSchema:{id:g,confirm:$n}},async({id:C,confirm:U})=>await He(async()=>(En(U,`Deleting ${p.singular} '${C}' goes away for good: name it, get the owner's agreement, then retry.`),{deleted:await O(h,C),id:C})))}export{Sg as createBroodsMcpServer,yg as serveBroodsMcp};
|