@doubao-dev/cli 1.0.0-rc.1 → 1.0.0-rc.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -2
- package/dist/691.js +88 -0
- package/dist/categories.js +1 -1
- package/dist/command.js +9 -3
- package/dist/command~1.js +4 -4
- package/dist/command~2.js +1 -1
- package/dist/command~3.js +1 -1
- package/dist/command~4.js +1 -1
- package/dist/command~5.js +5 -5
- package/dist/dist.js +1 -1
- package/dist/draft.js +2 -2
- package/dist/index.d.ts +12 -3
- package/dist/index.js +1 -1
- package/dist/main.d.ts +12 -3
- package/dist/main.js +1 -1
- package/dist/mcp-apps-inspector.js +1 -0
- package/dist/multipart-parser.js +1 -1
- package/dist/open.js +2 -0
- package/dist/plugin.js +2 -2
- package/dist/preview.js +5 -5
- package/dist/progress.js +1 -1
- package/dist/ratatui-ui.js +1 -1
- package/dist/session.js +1 -1
- package/dist/skills/doubao-plugin-cli/SKILL.md +6 -4
- package/dist/skills/doubao-plugin-cli/references/development.md +4 -4
- package/dist/skills/doubao-plugin-cli/references/project-config.md +6 -3
- package/dist/skills/doubao-plugin-cli/references/upload.md +30 -1
- package/dist/uninstall.js +1 -1
- package/dist/versions~1.js +1 -1
- package/dist/web/index.html +1 -0
- package/dist/web/sandbox-proxy.html +101 -0
- package/dist/web/static/css/index.b3102f16b9.css +1 -0
- package/dist/web/static/js/155.747f5232dc.js +69 -0
- package/dist/web/static/js/async/970.86106314b5.js +1 -0
- package/dist/web/static/js/index.c1186260b9.js +4 -0
- package/dist/web/static/js/lib-react.00514652bf.js +2 -0
- package/dist/web/static/js/lib-react.00514652bf.js.LICENSE.txt +39 -0
- package/dist/xdg-open +1267 -0
- package/package.json +14 -15
- package/dist/21.js +0 -101
- package/dist/schema.js +0 -1
- /package/dist/{21.js.LICENSE.txt → 691.js.LICENSE.txt} +0 -0
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
"use strict";(self.rspackChunkmcp_apps_inspector=self.rspackChunkmcp_apps_inspector||[]).push([[155],{306(e,t,o){let i,r,n,a,s,l,c,u,d;o.d(t,{Kj:()=>oL,Zs:()=>tu,jS:()=>oH});var p,h,m,f,g=Object.create,v=Object.defineProperty,_=Object.getOwnPropertyDescriptor,y=Object.getOwnPropertyNames,S=Object.getPrototypeOf,b=Object.prototype.hasOwnProperty;let k=new Set(["https://json-schema.org/draft/2020-12/schema","http://json-schema.org/draft/2020-12/schema"]),P=new Set(["https://json-schema.org/draft/2019-09/schema","http://json-schema.org/draft/2019-09/schema"]),w=new Set(["https://json-schema.org/draft-07/schema","http://json-schema.org/draft-07/schema"]),z=new Set(["https://json-schema.org/draft-06/schema","http://json-schema.org/draft-06/schema"]);var R=o(308),I=o(476);let j=Symbol.for("mcp.sdk.errorBrands");function x(e,t){let o=new Set,i=t;for(;"function"==typeof i;){let e=i.mcpBrand;Object.prototype.hasOwnProperty.call(i,"mcpBrand")&&"string"==typeof e&&o.add(e),i=Object.getPrototypeOf(i)}0!==o.size&&Object.defineProperty(e,j,{value:o,enumerable:!1,configurable:!0})}function C(e,t){try{if("object"==typeof t&&null!==t&&Object.prototype.hasOwnProperty.call(e,"mcpBrand")&&"string"==typeof e.mcpBrand&&Object.prototype.hasOwnProperty.call(t,j)){let o=t[j];if(o&&"function"==typeof o.has&&o.has(e.mcpBrand))return!0}}catch{}return Function.prototype[Symbol.hasInstance].call(e,t)}let q=((p={}).InvalidRequest="invalid_request",p.InvalidClient="invalid_client",p.InvalidGrant="invalid_grant",p.UnauthorizedClient="unauthorized_client",p.UnsupportedGrantType="unsupported_grant_type",p.InvalidScope="invalid_scope",p.AccessDenied="access_denied",p.ServerError="server_error",p.TemporarilyUnavailable="temporarily_unavailable",p.UnsupportedResponseType="unsupported_response_type",p.UnsupportedTokenType="unsupported_token_type",p.InvalidToken="invalid_token",p.MethodNotAllowed="method_not_allowed",p.TooManyRequests="too_many_requests",p.InvalidClientMetadata="invalid_client_metadata",p.InvalidRedirectUri="invalid_redirect_uri",p.InsufficientScope="insufficient_scope",p.InvalidTarget="invalid_target",p);var Y=class e extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.OAuthError"})}static[Symbol.hasInstance](e){return C(this,e)}static isInstance(e){if("function"!=typeof this)throw TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return C(this,e)}constructor(e,t,o){super(t),this.code=e,this.errorUri=o,this.name="OAuthError",x(this,new.target)}toResponseObject(){let e={error:this.code,error_description:this.message};return this.errorUri&&(e.error_uri=this.errorUri),e}static fromResponse(t){return new e(t.error,t.error_description??t.error,t.error_uri)}};let O=((h={}).NotConnected="NOT_CONNECTED",h.AlreadyConnected="ALREADY_CONNECTED",h.NotInitialized="NOT_INITIALIZED",h.CapabilityNotSupported="CAPABILITY_NOT_SUPPORTED",h.RequestTimeout="REQUEST_TIMEOUT",h.ConnectionClosed="CONNECTION_CLOSED",h.SendFailed="SEND_FAILED",h.InvalidResult="INVALID_RESULT",h.UnsupportedResultType="UNSUPPORTED_RESULT_TYPE",h.InputRequiredRoundsExceeded="INPUT_REQUIRED_ROUNDS_EXCEEDED",h.ListPaginationExceeded="LIST_PAGINATION_EXCEEDED",h.MethodNotSupportedByProtocolVersion="METHOD_NOT_SUPPORTED_BY_PROTOCOL_VERSION",h.EraNegotiationFailed="ERA_NEGOTIATION_FAILED",h.ClientHttpNotImplemented="CLIENT_HTTP_NOT_IMPLEMENTED",h.ClientHttpAuthentication="CLIENT_HTTP_AUTHENTICATION",h.ClientHttpForbidden="CLIENT_HTTP_FORBIDDEN",h.ClientHttpUnexpectedContent="CLIENT_HTTP_UNEXPECTED_CONTENT",h.ClientHttpFailedToOpenStream="CLIENT_HTTP_FAILED_TO_OPEN_STREAM",h.ClientHttpFailedToTerminateSession="CLIENT_HTTP_FAILED_TO_TERMINATE_SESSION",h);var T=class extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.SdkError"})}static[Symbol.hasInstance](e){return C(this,e)}static isInstance(e){if("function"!=typeof this)throw TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return C(this,e)}constructor(e,t,o){super(t),this.code=e,this.data=o,this.name="SdkError",x(this,new.target)}},$=class extends T{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.SdkHttpError"})}constructor(e,t,o){super(e,t,o),this.name="SdkHttpError"}get status(){return this.data.status}get statusText(){return this.data.statusText}};let E="2026-07-28",M=[E];function L(e){return e.filter(e=>!(e>=E))}function N(e){return e.filter(e=>e>=E)}function A(e){let t=e.structuredContent;return void 0===t||!("object"!=typeof t||null===t||Array.isArray(t))||e.content?.some(e=>"text"===e.type)?e:{...e,content:[...e.content??[],{type:"text",text:JSON.stringify(t)}]}}let U=["task","inputRequests","requestState"];function H(e){return null===e||"object"!=typeof e||Array.isArray(e)||void 0!==e.content||U.some(t=>t in e)?e:{...e,content:[]}}function Z(){let e,t,o,r,n,a,s,l,c,u,d,p,h,m,f,g,v,_,y,S,b,k,P,w,z,R,j,x,C,q,Y,O,T,$,E,M,L,N,A,Z,V,J,D,F,K,B,W,G,X,Q,ee,et,eo,ei,er,en,ea,es,el,ec,eu,ed,ep,eh,em,ef,eg,ev,e_,ey,eS,eb,ek,eP,ew,ez,eR,eI,ej,ex,eC,eq,eY,eO,eT,e$,eE,eM,eL,eN,eA,eU,eH,eZ,eV,eJ,eD,eF,eK,eB,eW,eG,eX,eQ,e0,e1,e2,e9,e4,e5,e3,e6,e8,e7,te,tt,to,ti,tr,tn,ta,ts,tl,tc,tu,td,tp,th,tm,tf,tg,tv,t_,ty,tS,tb,tk,tP,tw,tz;return i??=(e=I.RZV(()=>I.KCZ([I.YjP(),I.aig(),I.zMY(),I.chJ(),I.g1P(I.YjP(),e),I.YOg(e)])),t=I.g1P(I.YjP(),e),o=I.KCZ([I.YjP(),I.aig().int()]),r=I.YjP(),n=I.Ikc({ttl:I.aig().optional()}),a=I.Ikc({taskId:I.YjP()}),s=I._H3({progressToken:o.optional(),"io.modelcontextprotocol/related-task":a.optional()}),c=(l=I.Ikc({_meta:s.optional()})).extend({task:n.optional()}),u=I.Ikc({method:I.YjP(),params:l.loose().optional()}),d=I.Ikc({_meta:s.optional()}),p=I.Ikc({method:I.YjP(),params:d.loose().optional()}),h=I._H3({_meta:s.optional()}),m=I.KCZ([I.YjP(),I.aig().int()]),f=h.strict(),g=d.extend({requestId:m.optional(),reason:I.YjP().optional()}),v=p.extend({method:I.euz("notifications/cancelled"),params:g}),_=I.Ikc({src:I.YjP(),mimeType:I.YjP().optional(),sizes:I.YOg(I.YjP()).optional(),theme:I.k5n(["light","dark"]).optional()}),y=I.Ikc({icons:I.YOg(_).optional()}),b=(S=I.Ikc({name:I.YjP(),title:I.YjP().optional()})).extend({...S.shape,...y.shape,version:I.YjP(),websiteUrl:I.YjP().optional(),description:I.YjP().optional()}),k=I.E$q(I.Ikc({applyDefaults:I.zMY().optional()}),t),P=I.vkY(e=>e&&"object"==typeof e&&!Array.isArray(e)&&0===Object.keys(e).length?{form:{}}:e,I.E$q(I.Ikc({form:k.optional(),url:t.optional()}),t.optional())),w=I._H3({list:t.optional(),cancel:t.optional(),requests:I._H3({sampling:I._H3({createMessage:t.optional()}).optional(),elicitation:I._H3({create:t.optional()}).optional()}).optional()}),z=I._H3({list:t.optional(),cancel:t.optional(),requests:I._H3({tools:I._H3({call:t.optional()}).optional()}).optional()}),R=I.Ikc({experimental:I.g1P(I.YjP(),t).optional(),sampling:I.Ikc({context:t.optional(),tools:t.optional()}).optional(),elicitation:P.optional(),roots:I.Ikc({listChanged:I.zMY().optional()}).optional(),tasks:w.optional(),extensions:I.g1P(I.YjP(),t).optional()}),j=l.extend({protocolVersion:I.YjP(),capabilities:R,clientInfo:b}),x=u.extend({method:I.euz("initialize"),params:j}),C=I.Ikc({experimental:I.g1P(I.YjP(),t).optional(),logging:t.optional(),completions:t.optional(),prompts:I.Ikc({listChanged:I.zMY().optional()}).optional(),resources:I.Ikc({subscribe:I.zMY().optional(),listChanged:I.zMY().optional()}).optional(),tools:I.Ikc({listChanged:I.zMY().optional()}).optional(),tasks:z.optional(),extensions:I.g1P(I.YjP(),t).optional()}),q=h.extend({protocolVersion:I.YjP(),capabilities:C,serverInfo:b,instructions:I.YjP().optional()}),Y=p.extend({method:I.euz("notifications/initialized"),params:d.optional()}),O=u.extend({method:I.euz("ping"),params:l.optional()}),T=I.Ikc({progress:I.aig(),total:I.lqM(I.aig()),message:I.lqM(I.YjP())}),$=I.Ikc({...d.shape,...T.shape,progressToken:o}),E=p.extend({method:I.euz("notifications/progress"),params:$}),M=l.extend({cursor:r.optional()}),L=u.extend({params:M.optional()}),N=h.extend({nextCursor:r.optional()}),Z=(A=I.Ikc({uri:I.YjP(),mimeType:I.lqM(I.YjP()),_meta:I.g1P(I.YjP(),I.L5J()).optional()})).extend({text:I.YjP()}),V=I.YjP().refine(e=>{try{return atob(e),!0}catch{return!1}},{message:"Invalid Base64 string"}),J=A.extend({blob:V}),D=I.k5n(["user","assistant"]),F=I.Ikc({audience:I.YOg(D).optional(),priority:I.aig().min(0).max(1).optional(),lastModified:I.KH5.w$({offset:!0}).optional()}),K=I.Ikc({...S.shape,...y.shape,uri:I.YjP(),description:I.lqM(I.YjP()),mimeType:I.lqM(I.YjP()),size:I.lqM(I.aig()),annotations:F.optional(),_meta:I.lqM(I._H3({}))}),B=I.Ikc({...S.shape,...y.shape,uriTemplate:I.YjP(),description:I.lqM(I.YjP()),mimeType:I.lqM(I.YjP()),annotations:F.optional(),_meta:I.lqM(I._H3({}))}),W=L.extend({method:I.euz("resources/list")}),G=N.extend({resources:I.YOg(K)}),X=L.extend({method:I.euz("resources/templates/list")}),Q=N.extend({resourceTemplates:I.YOg(B)}),ee=l.extend({uri:I.YjP()}),et=u.extend({method:I.euz("resources/read"),params:ee}),eo=h.extend({contents:I.YOg(I.KCZ([Z,J]))}),ei=p.extend({method:I.euz("notifications/resources/list_changed"),params:d.optional()}),er=u.extend({method:I.euz("resources/subscribe"),params:ee}),en=u.extend({method:I.euz("resources/unsubscribe"),params:ee}),ea=d.extend({uri:I.YjP()}),es=p.extend({method:I.euz("notifications/resources/updated"),params:ea}),el=I.Ikc({name:I.YjP(),description:I.lqM(I.YjP()),required:I.lqM(I.zMY())}),ec=I.Ikc({...S.shape,...y.shape,description:I.lqM(I.YjP()),arguments:I.lqM(I.YOg(el)),_meta:I.lqM(I._H3({}))}),eu=L.extend({method:I.euz("prompts/list")}),ed=N.extend({prompts:I.YOg(ec)}),ep=l.extend({name:I.YjP(),arguments:I.g1P(I.YjP(),I.YjP()).optional()}),eh=u.extend({method:I.euz("prompts/get"),params:ep}),em=I.Ikc({type:I.euz("text"),text:I.YjP(),annotations:F.optional(),_meta:I.g1P(I.YjP(),I.L5J()).optional()}),ef=I.Ikc({type:I.euz("image"),data:V,mimeType:I.YjP(),annotations:F.optional(),_meta:I.g1P(I.YjP(),I.L5J()).optional()}),eg=I.Ikc({type:I.euz("audio"),data:V,mimeType:I.YjP(),annotations:F.optional(),_meta:I.g1P(I.YjP(),I.L5J()).optional()}),ev=I.Ikc({type:I.euz("tool_use"),name:I.YjP(),id:I.YjP(),input:I.g1P(I.YjP(),I.L5J()),_meta:I.g1P(I.YjP(),I.L5J()).optional()}),e_=I.Ikc({type:I.euz("resource"),resource:I.KCZ([Z,J]),annotations:F.optional(),_meta:I.g1P(I.YjP(),I.L5J()).optional()}),ey=K.extend({type:I.euz("resource_link")}),eS=I.KCZ([em,ef,eg,ey,e_]),eb=I.Ikc({role:D,content:eS}),ek=h.extend({description:I.YjP().optional(),messages:I.YOg(eb)}),eP=p.extend({method:I.euz("notifications/prompts/list_changed"),params:d.optional()}),ew=I.Ikc({title:I.YjP().optional(),readOnlyHint:I.zMY().optional(),destructiveHint:I.zMY().optional(),idempotentHint:I.zMY().optional(),openWorldHint:I.zMY().optional()}),ez=I.Ikc({taskSupport:I.k5n(["required","optional","forbidden"]).optional()}),eR=I.Ikc({...S.shape,...y.shape,description:I.YjP().optional(),inputSchema:I.Ikc({type:I.euz("object"),properties:I.g1P(I.YjP(),e).optional(),required:I.YOg(I.YjP()).optional()}).catchall(I.L5J()),outputSchema:I.Ikc({type:I.euz("object"),properties:I.g1P(I.YjP(),e).optional(),required:I.YOg(I.YjP()).optional()}).catchall(I.L5J()).optional(),annotations:ew.optional(),execution:ez.optional(),_meta:I.g1P(I.YjP(),I.L5J()).optional()}),eI=L.extend({method:I.euz("tools/list")}),ej=N.extend({tools:I.YOg(eR)}),ex=h.extend({content:I.YOg(eS),structuredContent:I.g1P(I.YjP(),I.L5J()).optional(),isError:I.zMY().optional()}),eC=c.extend({name:I.YjP(),arguments:I.g1P(I.YjP(),I.L5J()).optional()}),eq=u.extend({method:I.euz("tools/call"),params:eC}),eY=p.extend({method:I.euz("notifications/tools/list_changed"),params:d.optional()}),eO=I.k5n(["debug","info","notice","warning","error","critical","alert","emergency"]),eT=l.extend({level:eO}),e$=u.extend({method:I.euz("logging/setLevel"),params:eT}),eE=d.extend({level:eO,logger:I.YjP().optional(),data:I.L5J()}),eM=p.extend({method:I.euz("notifications/message"),params:eE}),eL=I.Ikc({name:I.YjP().optional()}),eN=I.Ikc({hints:I.YOg(eL).optional(),costPriority:I.aig().min(0).max(1).optional(),speedPriority:I.aig().min(0).max(1).optional(),intelligencePriority:I.aig().min(0).max(1).optional()}),eA=I.Ikc({mode:I.k5n(["auto","required","none"]).optional()}),eU=I.Ikc({type:I.euz("tool_result"),toolUseId:I.YjP().describe("The unique identifier for the corresponding tool call."),content:I.YOg(eS),structuredContent:I.Ikc({}).loose().optional(),isError:I.zMY().optional(),_meta:I.g1P(I.YjP(),I.L5J()).optional()}),eH=I.gMt("type",[em,ef,eg]),eZ=I.gMt("type",[em,ef,eg,ev,eU]),eV=I.Ikc({role:D,content:I.KCZ([eZ,I.YOg(eZ)]),_meta:I.g1P(I.YjP(),I.L5J()).optional()}),eJ=c.extend({messages:I.YOg(eV),modelPreferences:eN.optional(),systemPrompt:I.YjP().optional(),includeContext:I.k5n(["none","thisServer","allServers"]).optional(),temperature:I.aig().optional(),maxTokens:I.aig().int(),stopSequences:I.YOg(I.YjP()).optional(),metadata:t.optional(),tools:I.YOg(eR).optional(),toolChoice:eA.optional()}),eD=u.extend({method:I.euz("sampling/createMessage"),params:eJ}),eF=h.extend({model:I.YjP(),stopReason:I.lqM(I.k5n(["endTurn","stopSequence","maxTokens"]).or(I.YjP())),role:D,content:eH}),eK=h.extend({model:I.YjP(),stopReason:I.lqM(I.k5n(["endTurn","stopSequence","maxTokens","toolUse"]).or(I.YjP())),role:D,content:I.KCZ([eZ,I.YOg(eZ)])}),eB=I.Ikc({type:I.euz("boolean"),title:I.YjP().optional(),description:I.YjP().optional(),default:I.zMY().optional()}),eW=I.Ikc({type:I.euz("string"),title:I.YjP().optional(),description:I.YjP().optional(),minLength:I.aig().optional(),maxLength:I.aig().optional(),format:I.k5n(["email","uri","date","date-time"]).optional(),default:I.YjP().optional()}),eG=I.Ikc({type:I.k5n(["number","integer"]),title:I.YjP().optional(),description:I.YjP().optional(),minimum:I.aig().optional(),maximum:I.aig().optional(),default:I.aig().optional()}),eX=I.Ikc({type:I.euz("string"),title:I.YjP().optional(),description:I.YjP().optional(),enum:I.YOg(I.YjP()),default:I.YjP().optional()}),eQ=I.Ikc({type:I.euz("string"),title:I.YjP().optional(),description:I.YjP().optional(),oneOf:I.YOg(I.Ikc({const:I.YjP(),title:I.YjP()})),default:I.YjP().optional()}),e0=I.Ikc({type:I.euz("string"),title:I.YjP().optional(),description:I.YjP().optional(),enum:I.YOg(I.YjP()),enumNames:I.YOg(I.YjP()).optional(),default:I.YjP().optional()}),e1=I.KCZ([eX,eQ]),e2=I.Ikc({type:I.euz("array"),title:I.YjP().optional(),description:I.YjP().optional(),minItems:I.aig().optional(),maxItems:I.aig().optional(),items:I.Ikc({type:I.euz("string"),enum:I.YOg(I.YjP())}),default:I.YOg(I.YjP()).optional()}),e9=I.Ikc({type:I.euz("array"),title:I.YjP().optional(),description:I.YjP().optional(),minItems:I.aig().optional(),maxItems:I.aig().optional(),items:I.Ikc({anyOf:I.YOg(I.Ikc({const:I.YjP(),title:I.YjP()}))}),default:I.YOg(I.YjP()).optional()}),e4=I.KCZ([e2,e9]),e5=I.KCZ([e0,e1,e4]),e3=I.KCZ([e5,eB,eW,eG]),e6=c.extend({mode:I.euz("form").optional(),message:I.YjP(),requestedSchema:I.Ikc({type:I.euz("object"),properties:I.g1P(I.YjP(),e3),required:I.YOg(I.YjP()).optional()}).catchall(I.L5J())}),e8=c.extend({mode:I.euz("url"),message:I.YjP(),elicitationId:I.YjP(),url:I.YjP().url()}),e7=I.KCZ([e6,e8]),te=u.extend({method:I.euz("elicitation/create"),params:e7}),tt=d.extend({elicitationId:I.YjP()}),to=p.extend({method:I.euz("notifications/elicitation/complete"),params:tt}),ti=h.extend({action:I.k5n(["accept","decline","cancel"]),content:I.vkY(e=>null===e?void 0:e,I.g1P(I.YjP(),I.KCZ([I.YjP(),I.aig(),I.zMY(),I.YOg(I.YjP())])).optional())}),tr=I.Ikc({type:I.euz("ref/resource"),uri:I.YjP()}),tn=I.Ikc({type:I.euz("ref/prompt"),name:I.YjP()}),ta=l.extend({ref:I.KCZ([tn,tr]),argument:I.Ikc({name:I.YjP(),value:I.YjP()}),context:I.Ikc({arguments:I.g1P(I.YjP(),I.YjP()).optional()}).optional()}),ts=u.extend({method:I.euz("completion/complete"),params:ta}),tl=h.extend({completion:I._H3({values:I.YOg(I.YjP()).max(100),total:I.lqM(I.aig().int()),hasMore:I.lqM(I.zMY())})}),tc=I.Ikc({uri:I.YjP().startsWith("file://"),name:I.YjP().optional(),_meta:I.g1P(I.YjP(),I.L5J()).optional()}),tu=u.extend({method:I.euz("roots/list"),params:l.optional()}),td=h.extend({roots:I.YOg(tc)}),tp=p.extend({method:I.euz("notifications/roots/list_changed"),params:d.optional()}),th=I._H3({ttl:I.aig().optional(),pollInterval:I.aig().optional()}),tm=I.k5n(["working","input_required","completed","failed","cancelled"]),tf=I.Ikc({taskId:I.YjP(),status:tm,ttl:I.KCZ([I.aig(),I.chJ()]),createdAt:I.YjP(),lastUpdatedAt:I.YjP(),pollInterval:I.lqM(I.aig()),statusMessage:I.lqM(I.YjP())}),tg=h.extend({task:tf}),tv=d.merge(tf),t_=p.extend({method:I.euz("notifications/tasks/status"),params:tv}),ty=u.extend({method:I.euz("tasks/get"),params:l.extend({taskId:I.YjP()})}),tS=h.merge(tf),tb=u.extend({method:I.euz("tasks/result"),params:l.extend({taskId:I.YjP()})}),tk=h.loose(),tP=L.extend({method:I.euz("tasks/list")}),tw=N.extend({tasks:I.YOg(tf)}),tz=u.extend({method:I.euz("tasks/cancel"),params:l.extend({taskId:I.YjP()})}),{JSONValueSchema:e,JSONObjectSchema:t,ProgressTokenSchema:o,CursorSchema:r,TaskMetadataSchema:n,RelatedTaskMetadataSchema:a,RequestMetaSchema:s,BaseRequestParamsSchema:l,TaskAugmentedRequestParamsSchema:c,RequestSchema:u,NotificationsParamsSchema:d,NotificationSchema:p,ResultSchema:h,RequestIdSchema:m,EmptyResultSchema:f,CancelledNotificationParamsSchema:g,CancelledNotificationSchema:v,IconSchema:_,IconsSchema:y,BaseMetadataSchema:S,ImplementationSchema:b,ClientTasksCapabilitySchema:w,ServerTasksCapabilitySchema:z,ClientCapabilitiesSchema:R,InitializeRequestParamsSchema:j,InitializeRequestSchema:x,ServerCapabilitiesSchema:C,InitializeResultSchema:q,InitializedNotificationSchema:Y,PingRequestSchema:O,ProgressSchema:T,ProgressNotificationParamsSchema:$,ProgressNotificationSchema:E,PaginatedRequestParamsSchema:M,PaginatedRequestSchema:L,PaginatedResultSchema:N,ResourceContentsSchema:A,TextResourceContentsSchema:Z,BlobResourceContentsSchema:J,RoleSchema:D,AnnotationsSchema:F,ResourceSchema:K,ResourceTemplateSchema:B,ListResourcesRequestSchema:W,ListResourcesResultSchema:G,ListResourceTemplatesRequestSchema:X,ListResourceTemplatesResultSchema:Q,ResourceRequestParamsSchema:ee,ReadResourceRequestParamsSchema:ee,ReadResourceRequestSchema:et,ReadResourceResultSchema:eo,ResourceListChangedNotificationSchema:ei,SubscribeRequestParamsSchema:ee,SubscribeRequestSchema:er,UnsubscribeRequestParamsSchema:ee,UnsubscribeRequestSchema:en,ResourceUpdatedNotificationParamsSchema:ea,ResourceUpdatedNotificationSchema:es,PromptArgumentSchema:el,PromptSchema:ec,ListPromptsRequestSchema:eu,ListPromptsResultSchema:ed,GetPromptRequestParamsSchema:ep,GetPromptRequestSchema:eh,TextContentSchema:em,ImageContentSchema:ef,AudioContentSchema:eg,ToolUseContentSchema:ev,EmbeddedResourceSchema:e_,ResourceLinkSchema:ey,ContentBlockSchema:eS,PromptMessageSchema:eb,GetPromptResultSchema:ek,PromptListChangedNotificationSchema:eP,ToolAnnotationsSchema:ew,ToolExecutionSchema:ez,ToolSchema:eR,ListToolsRequestSchema:eI,ListToolsResultSchema:ej,CallToolResultSchema:ex,CallToolRequestParamsSchema:eC,CallToolRequestSchema:eq,ToolListChangedNotificationSchema:eY,LoggingLevelSchema:eO,SetLevelRequestParamsSchema:eT,SetLevelRequestSchema:e$,LoggingMessageNotificationParamsSchema:eE,LoggingMessageNotificationSchema:eM,ModelHintSchema:eL,ModelPreferencesSchema:eN,ToolChoiceSchema:eA,ToolResultContentSchema:eU,SamplingContentSchema:eH,SamplingMessageContentBlockSchema:eZ,SamplingMessageSchema:eV,CreateMessageRequestParamsSchema:eJ,CreateMessageRequestSchema:eD,CreateMessageResultSchema:eF,CreateMessageResultWithToolsSchema:eK,BooleanSchemaSchema:eB,StringSchemaSchema:eW,NumberSchemaSchema:eG,UntitledSingleSelectEnumSchemaSchema:eX,TitledSingleSelectEnumSchemaSchema:eQ,LegacyTitledEnumSchemaSchema:e0,SingleSelectEnumSchemaSchema:e1,UntitledMultiSelectEnumSchemaSchema:e2,TitledMultiSelectEnumSchemaSchema:e9,MultiSelectEnumSchemaSchema:e4,EnumSchemaSchema:e5,PrimitiveSchemaDefinitionSchema:e3,ElicitRequestFormParamsSchema:e6,ElicitRequestURLParamsSchema:e8,ElicitRequestParamsSchema:e7,ElicitRequestSchema:te,ElicitationCompleteNotificationParamsSchema:tt,ElicitationCompleteNotificationSchema:to,ElicitResultSchema:ti,ResourceTemplateReferenceSchema:tr,PromptReferenceSchema:tn,CompleteRequestParamsSchema:ta,CompleteRequestSchema:ts,CompleteResultSchema:tl,RootSchema:tc,ListRootsRequestSchema:tu,ListRootsResultSchema:td,RootsListChangedNotificationSchema:tp,TaskCreationParamsSchema:th,TaskStatusSchema:tm,TaskSchema:tf,CreateTaskResultSchema:tg,TaskStatusNotificationParamsSchema:tv,TaskStatusNotificationSchema:t_,GetTaskRequestSchema:ty,GetTaskResultSchema:tS,GetTaskPayloadRequestSchema:tb,GetTaskPayloadResultSchema:tk,ListTasksRequestSchema:tP,ListTasksResultSchema:tw,CancelTaskRequestSchema:tz,CancelTaskResultSchema:h.merge(tf),ClientRequestSchema:I.KCZ([O,x,ts,e$,eh,eu,W,X,et,er,en,eq,eI,ty,tb,tP,tz]),ClientNotificationSchema:I.KCZ([v,E,Y,tp,t_]),ClientResultSchema:I.KCZ([f,eF,eK,ti,td,tS,tw,tg]),ServerRequestSchema:I.KCZ([O,eD,te,tu,ty,tb,tP,tz]),ServerNotificationSchema:I.KCZ([v,E,eM,es,ei,eY,eP,t_,to]),ServerResultSchema:I.KCZ([f,q,tl,ek,ed,G,Q,eo,ex,ej,tS,tw,tg]),CallToolResultWireSchema:I.L5J().superRefine((e,t)=>{if(!("object"!=typeof e||null===e||Array.isArray(e))&&void 0===e.content){for(let o of U)if(o in e)return void t.addIssue({code:"custom",message:`content is required when the body carries '${o}' — another result family cannot default into an empty tools/call success`})}}).transform(H).pipe(ex)})}function V(e){return"object"!==e.type}let J=new Set(["const","enum","default","examples"]),D=new Set(["properties","patternProperties","$defs","definitions","dependentSchemas","dependencies"]);function F(e){return void 0!==e&&!("string"==typeof e&&e.startsWith("#"))}let K={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},B={"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},W={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};function G(){if(r)return r;let e=Z();return r={requestSchemas:{ping:e.PingRequestSchema,initialize:e.InitializeRequestSchema,"completion/complete":e.CompleteRequestSchema,"logging/setLevel":e.SetLevelRequestSchema,"prompts/get":e.GetPromptRequestSchema,"prompts/list":e.ListPromptsRequestSchema,"resources/list":e.ListResourcesRequestSchema,"resources/templates/list":e.ListResourceTemplatesRequestSchema,"resources/read":e.ReadResourceRequestSchema,"resources/subscribe":e.SubscribeRequestSchema,"resources/unsubscribe":e.UnsubscribeRequestSchema,"tools/call":e.CallToolRequestSchema,"tools/list":e.ListToolsRequestSchema,"tasks/get":e.GetTaskRequestSchema,"tasks/result":e.GetTaskPayloadRequestSchema,"tasks/list":e.ListTasksRequestSchema,"tasks/cancel":e.CancelTaskRequestSchema,"sampling/createMessage":e.CreateMessageRequestSchema,"elicitation/create":e.ElicitRequestSchema,"roots/list":e.ListRootsRequestSchema},notificationSchemas:{"notifications/cancelled":e.CancelledNotificationSchema,"notifications/progress":e.ProgressNotificationSchema,"notifications/initialized":e.InitializedNotificationSchema,"notifications/roots/list_changed":e.RootsListChangedNotificationSchema,"notifications/tasks/status":e.TaskStatusNotificationSchema,"notifications/message":e.LoggingMessageNotificationSchema,"notifications/resources/updated":e.ResourceUpdatedNotificationSchema,"notifications/resources/list_changed":e.ResourceListChangedNotificationSchema,"notifications/tools/list_changed":e.ToolListChangedNotificationSchema,"notifications/prompts/list_changed":e.PromptListChangedNotificationSchema,"notifications/elicitation/complete":e.ElicitationCompleteNotificationSchema},resultSchemas:{ping:e.EmptyResultSchema,initialize:e.InitializeResultSchema,"completion/complete":e.CompleteResultSchema,"logging/setLevel":e.EmptyResultSchema,"prompts/get":e.GetPromptResultSchema,"prompts/list":e.ListPromptsResultSchema,"resources/list":e.ListResourcesResultSchema,"resources/templates/list":e.ListResourceTemplatesResultSchema,"resources/read":e.ReadResourceResultSchema,"resources/subscribe":e.EmptyResultSchema,"resources/unsubscribe":e.EmptyResultSchema,"tools/call":e.CallToolResultWireSchema,"tools/list":e.ListToolsResultSchema,"sampling/createMessage":e.CreateMessageResultWithToolsSchema,"elicitation/create":e.ElicitResultSchema,"roots/list":e.ListRootsResultSchema}}}function X(e){return Object.prototype.hasOwnProperty.call(K,e)}function Q(e){return Object.prototype.hasOwnProperty.call(B,e)}function ee(e){return null!==e&&"object"==typeof e&&!Array.isArray(e)}function et(e,t){if(void 0===e)return{ok:!1,reason:"not-in-era"};let o=e.safeParse(t);return o.success?{ok:!0,value:o.data}:{ok:!1,reason:"invalid",message:String(o.error)}}Object.keys(K),Object.keys(B);let eo={ok:!1,reason:"not-in-era"};function ei(e){return ee(e)&&ee(e.outputSchema)&&V(e.outputSchema)}let er={era:"2025-11-25",hasRequestMethod:X,hasNotificationMethod:Q,validateRequest:(e,t)=>et(X(e)?G().requestSchemas[e]:void 0,t),validateResult:(e,t)=>et(Object.prototype.hasOwnProperty.call(W,e)?G().resultSchemas[e]:void 0,t),validateNotification:(e,t)=>et(Q(e)?G().notificationSchemas[e]:void 0,t),hasInputRequestMethod:()=>!1,validateInputRequest:()=>eo,validateInputResponse:()=>eo,samplingResultVariant:(e,t)=>{let o=Z();return et(e?o.CreateMessageResultWithToolsSchema:o.CreateMessageResultSchema,t)},outboundEnvelope:e=>void 0,validateEnvelopeMeta:e=>[],projectCallToolResult(e,t){let o=A(e),i=o.structuredContent;if(void 0===i)return o;let r="object"!=typeof i||null===i||Array.isArray(i),n=void 0!==t&&V(t);return r||n?{...o,structuredContent:{result:i}}:o},decodeResult(e,t){if(ee(t)&&"resultType"in t){let e={...t};return delete e.resultType,{kind:"complete",result:e}}return{kind:"complete",result:t}},encodeResult(e,t){if("tools/list"!==e)return t;let o=t.tools;return Array.isArray(o)&&o.some(e=>ei(e))?{...t,tools:o.map(e=>ei(e)?{...e,outputSchema:function(e){var t;let o="string"==typeof e.$schema?e.$schema:void 0;if(F(e.$id))return{...void 0!==o&&{$schema:o},type:"object",properties:{result:e},required:["result"]};let i="string"==typeof(t=e.$schema)&&P.has(t.replace(/#$/,""))&&!0!==e.$recursiveAnchor,r=(e,t)=>{if(Array.isArray(e))return e.map(e=>r(e,!1));if(null===e||"object"!=typeof e||!t&&F(e.$id))return e;let o={},n=!1;for(let[a,s]of Object.entries(e))t?o[a]=r(s,!1):("$ref"===a||"$dynamicRef"===a)&&"string"==typeof s?o[a]="#"===s?"#/properties/result":s.startsWith("#/")?`#/properties/result${s.slice(1)}`:s:"$recursiveRef"===a&&"#"===s&&i?n=!0:J.has(a)?o[a]=s:D.has(a)?o[a]=r(s,!0):o[a]=r(s,!1);return n&&("$ref"in o?o.allOf=[...Array.isArray(o.allOf)?o.allOf:[],{$ref:"#/properties/result"}]:o.$ref="#/properties/result"),o};return{...void 0!==o&&{$schema:o},type:"object",properties:{result:r(e,!1)},required:["result"]}}(e.outputSchema)}:e)}:t},encodeErrorCode:e=>-32002===e?-32602:e,checkInboundEnvelope:e=>void 0};function en(){return n??=function(){let e=I.RZV(()=>I.KCZ([I.YjP(),I.aig(),I.zMY(),I.chJ(),I.g1P(I.YjP(),e),I.YOg(e)])),t=I.g1P(I.YjP(),e),o=I.KCZ([I.YjP(),I.aig().int()]),i=I.YjP(),r=I.KCZ([I.YjP(),I.aig().int()]),n=I.k5n(["user","assistant"]),a=I.k5n(["debug","info","notice","warning","error","critical","alert","emergency"]),s=I.YjP().refine(e=>{try{return atob(e),!0}catch{return!1}},{message:"Invalid Base64 string"}),l=I.Ikc({ttl:I.aig().optional()}),c=I.Ikc({taskId:I.YjP()}),u=I._H3({progressToken:o.optional(),"io.modelcontextprotocol/related-task":c.optional()}),d=I.Ikc({_meta:u.optional()}),p=d.extend({task:l.optional()}),h=I.Ikc({_meta:u.optional()}),m=I.Ikc({method:I.YjP(),params:h.loose().optional()}),f=I.Ikc({src:I.YjP(),mimeType:I.YjP().optional(),sizes:I.YOg(I.YjP()).optional(),theme:I.k5n(["light","dark"]).optional()}),g=I.Ikc({icons:I.YOg(f).optional()}),v=I.Ikc({name:I.YjP(),title:I.YjP().optional()}),_=v.extend({...v.shape,...g.shape,version:I.YjP(),websiteUrl:I.YjP().optional(),description:I.YjP().optional()}),y=I.E$q(I.Ikc({applyDefaults:I.zMY().optional()}),t),S=I.vkY(e=>e&&"object"==typeof e&&!Array.isArray(e)&&0===Object.keys(e).length?{form:{}}:e,I.E$q(I.Ikc({form:y.optional(),url:t.optional()}),t.optional())),b=I._H3({list:t.optional(),cancel:t.optional(),requests:I._H3({sampling:I._H3({createMessage:t.optional()}).optional(),elicitation:I._H3({create:t.optional()}).optional()}).optional()}),k=I._H3({list:t.optional(),cancel:t.optional(),requests:I._H3({tools:I._H3({call:t.optional()}).optional()}).optional()}),P=I.Ikc({experimental:I.g1P(I.YjP(),t).optional(),sampling:I.Ikc({context:t.optional(),tools:t.optional()}).optional(),elicitation:S.optional(),roots:I.Ikc({listChanged:I.zMY().optional()}).optional(),tasks:b.optional(),extensions:I.g1P(I.YjP(),t).optional()}),w=I.Ikc({experimental:I.g1P(I.YjP(),t).optional(),logging:t.optional(),completions:t.optional(),prompts:I.Ikc({listChanged:I.zMY().optional()}).optional(),resources:I.Ikc({subscribe:I.zMY().optional(),listChanged:I.zMY().optional()}).optional(),tools:I.Ikc({listChanged:I.zMY().optional()}).optional(),tasks:k.optional(),extensions:I.g1P(I.YjP(),t).optional()}),z=I.Ikc({progress:I.aig(),total:I.lqM(I.aig()),message:I.lqM(I.YjP())}),j=I.Ikc({...h.shape,...z.shape,progressToken:o}),x=m.extend({method:I.euz("notifications/progress"),params:j}),C=h.extend({level:a,logger:I.YjP().optional(),data:I.L5J()}),q=m.extend({method:I.euz("notifications/message"),params:C}),Y=I.Ikc({uri:I.YjP(),mimeType:I.lqM(I.YjP()),_meta:I.g1P(I.YjP(),I.L5J()).optional()}),O=Y.extend({text:I.YjP()}),T=Y.extend({blob:s}),$=I.Ikc({audience:I.YOg(n).optional(),priority:I.aig().min(0).max(1).optional(),lastModified:I.KH5.w$({offset:!0}).optional()}),E=I.Ikc({...v.shape,...g.shape,uri:I.YjP(),description:I.lqM(I.YjP()),mimeType:I.lqM(I.YjP()),size:I.lqM(I.aig()),annotations:$.optional(),_meta:I.lqM(I._H3({}))}),M=I.Ikc({...v.shape,...g.shape,uriTemplate:I.YjP(),description:I.lqM(I.YjP()),mimeType:I.lqM(I.YjP()),annotations:$.optional(),_meta:I.lqM(I._H3({}))}),L=m.extend({method:I.euz("notifications/resources/list_changed"),params:h.optional()}),N=h.extend({uri:I.YjP()}),A=m.extend({method:I.euz("notifications/resources/updated"),params:N}),U=I.Ikc({name:I.YjP(),description:I.lqM(I.YjP()),required:I.lqM(I.zMY())}),H=I.Ikc({...v.shape,...g.shape,description:I.lqM(I.YjP()),arguments:I.lqM(I.YOg(U)),_meta:I.lqM(I._H3({}))}),Z=m.extend({method:I.euz("notifications/prompts/list_changed"),params:h.optional()}),V=I.Ikc({type:I.euz("text"),text:I.YjP(),annotations:$.optional(),_meta:I.g1P(I.YjP(),I.L5J()).optional()}),J=I.Ikc({type:I.euz("image"),data:s,mimeType:I.YjP(),annotations:$.optional(),_meta:I.g1P(I.YjP(),I.L5J()).optional()}),D=I.Ikc({type:I.euz("audio"),data:s,mimeType:I.YjP(),annotations:$.optional(),_meta:I.g1P(I.YjP(),I.L5J()).optional()}),F=I.Ikc({type:I.euz("tool_use"),name:I.YjP(),id:I.YjP(),input:I.g1P(I.YjP(),I.L5J()),_meta:I.g1P(I.YjP(),I.L5J()).optional()}),K=I.Ikc({type:I.euz("resource"),resource:I.KCZ([O,T]),annotations:$.optional(),_meta:I.g1P(I.YjP(),I.L5J()).optional()}),B=E.extend({type:I.euz("resource_link")}),W=I.KCZ([V,J,D,B,K]),G=I.Ikc({role:n,content:W}),X=I.Ikc({title:I.YjP().optional(),readOnlyHint:I.zMY().optional(),destructiveHint:I.zMY().optional(),idempotentHint:I.zMY().optional(),openWorldHint:I.zMY().optional()}),Q=m.extend({method:I.euz("notifications/tools/list_changed"),params:h.optional()}),ee=I.Ikc({name:I.YjP().optional()}),et=I.Ikc({hints:I.YOg(ee).optional(),costPriority:I.aig().min(0).max(1).optional(),speedPriority:I.aig().min(0).max(1).optional(),intelligencePriority:I.aig().min(0).max(1).optional()}),eo=I.Ikc({mode:I.k5n(["auto","required","none"]).optional()}),ei=I.Ikc({type:I.euz("boolean"),title:I.YjP().optional(),description:I.YjP().optional(),default:I.zMY().optional()}),er=I.Ikc({type:I.euz("string"),title:I.YjP().optional(),description:I.YjP().optional(),minLength:I.aig().optional(),maxLength:I.aig().optional(),format:I.k5n(["email","uri","date","date-time"]).optional(),default:I.YjP().optional()}),en=I.Ikc({type:I.k5n(["number","integer"]),title:I.YjP().optional(),description:I.YjP().optional(),minimum:I.aig().optional(),maximum:I.aig().optional(),default:I.aig().optional()}),ea=I.Ikc({type:I.euz("string"),title:I.YjP().optional(),description:I.YjP().optional(),enum:I.YOg(I.YjP()),default:I.YjP().optional()}),es=I.Ikc({type:I.euz("string"),title:I.YjP().optional(),description:I.YjP().optional(),oneOf:I.YOg(I.Ikc({const:I.YjP(),title:I.YjP()})),default:I.YjP().optional()}),el=I.Ikc({type:I.euz("string"),title:I.YjP().optional(),description:I.YjP().optional(),enum:I.YOg(I.YjP()),enumNames:I.YOg(I.YjP()).optional(),default:I.YjP().optional()}),ec=I.KCZ([ea,es]),eu=I.Ikc({type:I.euz("array"),title:I.YjP().optional(),description:I.YjP().optional(),minItems:I.aig().optional(),maxItems:I.aig().optional(),items:I.Ikc({type:I.euz("string"),enum:I.YOg(I.YjP())}),default:I.YOg(I.YjP()).optional()}),ed=I.Ikc({type:I.euz("array"),title:I.YjP().optional(),description:I.YjP().optional(),minItems:I.aig().optional(),maxItems:I.aig().optional(),items:I.Ikc({anyOf:I.YOg(I.Ikc({const:I.YjP(),title:I.YjP()}))}),default:I.YOg(I.YjP()).optional()}),ep=I.KCZ([eu,ed]),eh=I.KCZ([el,ec,ep]),em=I.KCZ([eh,ei,er,en]),ef=p.extend({mode:I.euz("form").optional(),message:I.YjP(),requestedSchema:I.Ikc({type:I.euz("object"),properties:I.g1P(I.YjP(),em),required:I.YOg(I.YjP()).optional()}).catchall(I.L5J())}),eg=I.Ikc({type:I.euz("ref/resource"),uri:I.YjP()}),ev=I.Ikc({type:I.euz("ref/prompt"),name:I.YjP()}),e_=I.Ikc({uri:I.YjP().startsWith("file://"),name:I.YjP().optional(),_meta:I.g1P(I.YjP(),I.L5J()).optional()}),ey=P.shape,eS=I.Ikc({experimental:ey.experimental,sampling:ey.sampling,elicitation:ey.elicitation,roots:ey.roots,extensions:ey.extensions}),eb=w.shape,ek=I.Ikc({experimental:eb.experimental,logging:eb.logging,completions:eb.completions,prompts:eb.prompts,resources:eb.resources,tools:eb.tools,extensions:eb.extensions}),eP=I._H3({progressToken:o.optional(),[R.jr]:I.YjP(),[R.xr]:_.optional(),[R.br]:eS,[R.Or]:a.optional()}),ew=I.Ikc({...v.shape,...g.shape,description:I.YjP().optional(),inputSchema:I._H3({$schema:I.YjP().optional(),type:I.euz("object")}),outputSchema:I._H3({$schema:I.YjP().optional()}).optional(),annotations:X.optional(),_meta:I.g1P(I.YjP(),I.L5J()).optional()}),ez=I.Ikc({type:I.euz("tool_result"),toolUseId:I.YjP(),content:I.YOg(W),structuredContent:I.L5J().optional(),isError:I.zMY().optional(),_meta:I.g1P(I.YjP(),I.L5J()).optional()}),eR=I.KCZ([V,J,D,F,ez]),eI=I.Ikc({role:n,content:I.KCZ([eR,I.YOg(eR)]),_meta:I.g1P(I.YjP(),I.L5J()).optional()}),ej=I.YjP(),ex=I._H3({[R.Nr]:_.optional().catch(void 0)}),eC=ex.optional();function eq(e){return I._H3({_meta:eC,resultType:ej.default("complete"),...e})}let eY=eq({}),eO=eq({nextCursor:i.optional()}),eT=eq({content:I.YOg(W),structuredContent:I.L5J().optional(),isError:I.zMY().optional()}),e$=eq({ttlMs:I.aig().int().min(0),cacheScope:I.k5n(["public","private"]),tools:I.YOg(ew),nextCursor:i.optional()}),eE=eq({ttlMs:I.aig().int().min(0),cacheScope:I.k5n(["public","private"]),prompts:I.YOg(H),nextCursor:i.optional()}),eM=eq({description:I.YjP().optional(),messages:I.YOg(G)}),eL=eq({ttlMs:I.aig().int().min(0),cacheScope:I.k5n(["public","private"]),resources:I.YOg(E),nextCursor:i.optional()}),eN=eq({ttlMs:I.aig().int().min(0),cacheScope:I.k5n(["public","private"]),resourceTemplates:I.YOg(M),nextCursor:i.optional()}),eA=eq({ttlMs:I.aig().int().min(0),cacheScope:I.k5n(["public","private"]),contents:I.YOg(I.KCZ([O,T]))}),eU=eq({completion:I.Ikc({values:I.YOg(I.YjP()).max(100),total:I.aig().int().optional(),hasMore:I.zMY().optional()}).loose()}),eH=eq({ttlMs:I.aig().int().min(0),cacheScope:I.k5n(["public","private"])}),eZ=eq({ttlMs:I.aig().int().min(0).catch(0),cacheScope:I.k5n(["public","private"]).catch("private"),supportedVersions:I.YOg(I.YjP()),capabilities:ek,instructions:I.YjP().optional()}),eV=I.Ikc({messages:I.YOg(eI),modelPreferences:et.optional(),systemPrompt:I.YjP().optional(),includeContext:I.k5n(["none","thisServer","allServers"]).optional(),temperature:I.aig().optional(),maxTokens:I.aig().int(),stopSequences:I.YOg(I.YjP()).optional(),metadata:t.optional(),tools:I.YOg(ew).optional(),toolChoice:eo.optional()}),eJ=I.Ikc({method:I.euz("sampling/createMessage"),params:eV}),eD=I.Ikc({method:I.euz("roots/list"),params:I.Ikc({_meta:I.g1P(I.YjP(),I.L5J()).optional()}).optional()}),eF=I.Ikc({...eI.shape,model:I.YjP(),stopReason:I.YjP().optional()}),eK=I.Ikc({roots:I.YOg(e_)}),eB=I.Ikc({action:I.k5n(["accept","decline","cancel"]),content:I.g1P(I.YjP(),I.KCZ([I.YjP(),I.aig(),I.zMY(),I.YOg(I.YjP())])).optional()}),eW=I.Ikc({mode:I.euz("url"),message:I.YjP(),url:I.YjP().url()}),eG=I.KCZ([ef,eW]),eX=I.Ikc({method:I.euz("elicitation/create"),params:eG}),eQ=I.KCZ([eJ,eD,eX]),e0=I.KCZ([eF,eK,eB]),e1=I.g1P(I.YjP(),eQ),e2=I.g1P(I.YjP(),e0),e9=eq({inputRequests:e1.optional(),requestState:I.YjP().optional()}),e4={inputResponses:e2.optional(),requestState:I.YjP().optional()},e5=I.Ikc({_meta:eP,...e4}),e3=I._H3({progressToken:o.optional()});function e6(e,t){return I.Ikc({method:I.euz(e),params:I.Ikc({_meta:eP,...t})})}function e8(e,t){return I.Ikc({method:I.euz(e),params:I.Ikc({_meta:e3.optional(),...t}).optional()})}let e7={name:I.YjP(),arguments:I.g1P(I.YjP(),I.L5J()).optional(),...e4},te={cursor:i.optional()},tt=e6("tools/call",e7),to=e6("tools/list",te),ti=e6("prompts/list",te),tr=e6("prompts/get",{name:I.YjP(),arguments:I.g1P(I.YjP(),I.YjP()).optional(),...e4}),tn=e6("resources/list",te),ta=e6("resources/templates/list",te),ts=e6("resources/read",{uri:I.YjP(),...e4}),tl={ref:I.KCZ([ev,eg]),argument:I.Ikc({name:I.YjP(),value:I.YjP()}),context:I.Ikc({arguments:I.g1P(I.YjP(),I.YjP()).optional()}).optional()},tc=e6("completion/complete",tl),tu=e6("server/discover",{}),td=I.Ikc({toolsListChanged:I.zMY().optional(),promptsListChanged:I.zMY().optional(),resourcesListChanged:I.zMY().optional(),resourceSubscriptions:I.YOg(I.YjP()).optional()}),tp={notifications:td},th=e6("subscriptions/listen",tp),tm=ex.extend({"io.modelcontextprotocol/subscriptionId":r}),tf=I._H3({_meta:tm,resultType:ej.default("complete")}),tg={"tools/call":e8("tools/call",e7),"tools/list":e8("tools/list",te),"prompts/get":e8("prompts/get",{name:I.YjP(),arguments:I.g1P(I.YjP(),I.YjP()).optional()}),"prompts/list":e8("prompts/list",te),"resources/list":e8("resources/list",te),"resources/templates/list":e8("resources/templates/list",te),"resources/read":e8("resources/read",{uri:I.YjP()}),"completion/complete":e8("completion/complete",tl),"server/discover":e8("server/discover",{}),"subscriptions/listen":e8("subscriptions/listen",tp)};function tv(e){return I._H3({_meta:eC,...e})}let t_={"tools/call":tv({content:I.YOg(W),structuredContent:I.L5J().optional(),isError:I.zMY().optional()}),"tools/list":tv({ttlMs:I.aig().int().min(0),cacheScope:I.k5n(["public","private"]),tools:I.YOg(ew),nextCursor:i.optional()}),"prompts/get":tv({description:I.YjP().optional(),messages:I.YOg(G)}),"prompts/list":tv({ttlMs:I.aig().int().min(0),cacheScope:I.k5n(["public","private"]),prompts:I.YOg(H),nextCursor:i.optional()}),"resources/list":tv({ttlMs:I.aig().int().min(0),cacheScope:I.k5n(["public","private"]),resources:I.YOg(E),nextCursor:i.optional()}),"resources/templates/list":tv({ttlMs:I.aig().int().min(0),cacheScope:I.k5n(["public","private"]),resourceTemplates:I.YOg(M),nextCursor:i.optional()}),"resources/read":tv({ttlMs:I.aig().int().min(0),cacheScope:I.k5n(["public","private"]),contents:I.YOg(I.KCZ([O,T]))}),"completion/complete":tv({completion:I.Ikc({values:I.YOg(I.YjP()).max(100),total:I.aig().int().optional(),hasMore:I.zMY().optional()}).loose()}),"server/discover":tv({ttlMs:I.aig().int().min(0).catch(0),cacheScope:I.k5n(["public","private"]).catch("private"),supportedVersions:I.YOg(I.YjP()),capabilities:ek,instructions:I.YjP().optional()}),"subscriptions/listen":tv({})},ty=I._H3({"io.modelcontextprotocol/subscriptionId":r.optional()}),tS=I.Ikc({method:I.euz("notifications/subscriptions/acknowledged"),params:I.Ikc({_meta:ty.optional(),notifications:td})}),tb=I.Ikc({_meta:ty.optional(),requestId:r,reason:I.YjP().optional()}),tk=I.Ikc({method:I.euz("notifications/cancelled"),params:tb}),tP=e=>I.Ikc({jsonrpc:I.euz("2.0"),id:I.KCZ([I.YjP(),I.aig().int()]),result:e}).strict();return{JSONValueSchema:e,JSONObjectSchema:t,ProgressTokenSchema:o,CursorSchema:i,RequestIdSchema:r,RoleSchema:n,LoggingLevelSchema:a,TaskMetadataSchema:l,RelatedTaskMetadataSchema:c,RequestMetaSchema:u,BaseRequestParamsSchema:d,TaskAugmentedRequestParamsSchema:p,NotificationsParamsSchema:h,NotificationSchema:m,IconSchema:f,IconsSchema:g,BaseMetadataSchema:v,ImplementationSchema:_,ClientTasksCapabilitySchema:b,ServerTasksCapabilitySchema:k,ClientCapabilitiesSchema:P,ServerCapabilitiesSchema:w,ProgressSchema:z,ProgressNotificationParamsSchema:j,ProgressNotificationSchema:x,LoggingMessageNotificationParamsSchema:C,LoggingMessageNotificationSchema:q,ResourceContentsSchema:Y,TextResourceContentsSchema:O,BlobResourceContentsSchema:T,AnnotationsSchema:$,ResourceSchema:E,ResourceTemplateSchema:M,ResourceListChangedNotificationSchema:L,ResourceUpdatedNotificationParamsSchema:N,ResourceUpdatedNotificationSchema:A,PromptArgumentSchema:U,PromptSchema:H,PromptListChangedNotificationSchema:Z,TextContentSchema:V,ImageContentSchema:J,AudioContentSchema:D,ToolUseContentSchema:F,EmbeddedResourceSchema:K,ResourceLinkSchema:B,ContentBlockSchema:W,PromptMessageSchema:G,ToolAnnotationsSchema:X,ToolListChangedNotificationSchema:Q,ModelHintSchema:ee,ModelPreferencesSchema:et,ToolChoiceSchema:eo,BooleanSchemaSchema:ei,StringSchemaSchema:er,NumberSchemaSchema:en,UntitledSingleSelectEnumSchemaSchema:ea,TitledSingleSelectEnumSchemaSchema:es,LegacyTitledEnumSchemaSchema:el,SingleSelectEnumSchemaSchema:ec,UntitledMultiSelectEnumSchemaSchema:eu,TitledMultiSelectEnumSchemaSchema:ed,MultiSelectEnumSchemaSchema:ep,EnumSchemaSchema:eh,PrimitiveSchemaDefinitionSchema:em,ElicitRequestFormParamsSchema:ef,ResourceTemplateReferenceSchema:eg,PromptReferenceSchema:ev,RootSchema:e_,ClientCapabilities2026Schema:eS,ServerCapabilities2026Schema:ek,RequestMetaEnvelopeSchema:eP,ToolSchema:ew,ToolResultContentSchema:ez,SamplingMessageContentBlockSchema:eR,SamplingMessageSchema:eI,ResultTypeSchema:ej,ResultMetaSchema:ex,ResultSchema:eY,PaginatedResultSchema:eO,CallToolResultSchema:eT,ListToolsResultSchema:e$,ListPromptsResultSchema:eE,GetPromptResultSchema:eM,ListResourcesResultSchema:eL,ListResourceTemplatesResultSchema:eN,ReadResourceResultSchema:eA,CompleteResultSchema:eU,CacheableResultSchema:eH,DiscoverResultSchema:eZ,CreateMessageRequestParamsSchema:eV,CreateMessageRequestSchema:eJ,ListRootsRequestSchema:eD,CreateMessageResultSchema:eF,ListRootsResultSchema:eK,ElicitResultSchema:eB,ElicitRequestURLParamsSchema:eW,ElicitRequestParamsSchema:eG,ElicitRequestSchema:eX,InputRequestSchema:eQ,InputResponseSchema:e0,InputRequestsSchema:e1,InputResponsesSchema:e2,InputRequiredResultSchema:e9,InputResponseRequestParamsSchema:e5,CallToolRequestSchema:tt,ListToolsRequestSchema:to,ListPromptsRequestSchema:ti,GetPromptRequestSchema:tr,ListResourcesRequestSchema:tn,ListResourceTemplatesRequestSchema:ta,ReadResourceRequestSchema:ts,CompleteRequestSchema:tc,DiscoverRequestSchema:tu,SubscriptionFilterSchema:td,SubscriptionsListenRequestSchema:th,SubscriptionsListenResultMetaSchema:tm,SubscriptionsListenResultSchema:tf,dispatchRequestSchemas:tg,dispatchResultSchemas:t_,NotificationMetaSchema:ty,SubscriptionsAcknowledgedNotificationSchema:tS,CancelledNotificationParamsSchema:tb,CancelledNotificationSchema:tk,notificationSchemas2026:{"notifications/cancelled":tk,"notifications/progress":x,"notifications/message":q,"notifications/resources/updated":A,"notifications/resources/list_changed":L,"notifications/tools/list_changed":Q,"notifications/prompts/list_changed":Z,"notifications/subscriptions/acknowledged":tS},JSONRPCResultResponseSchema:tP(eY),CallToolResultResponseSchema:tP(I.KCZ([eT,e9])),ListToolsResultResponseSchema:tP(e$),ListPromptsResultResponseSchema:tP(eE),GetPromptResultResponseSchema:tP(I.KCZ([eM,e9])),ListResourcesResultResponseSchema:tP(eL),ListResourceTemplatesResultResponseSchema:tP(eN),ReadResourceResultResponseSchema:tP(I.KCZ([eA,e9])),CompleteResultResponseSchema:tP(eU),DiscoverResultResponseSchema:tP(eZ)}}()}let ea=["tools/list","prompts/list","resources/list","resources/templates/list","resources/read","server/discover"],es=Symbol("modelcontextprotocol.resultCacheHintFallback");function el(e){return"number"==typeof e&&Number.isSafeInteger(e)&&e>=0}function ec(e){return"public"===e||"private"===e}let eu=((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);var ed=class e extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.ProtocolError"})}static[Symbol.hasInstance](e){return C(this,e)}static isInstance(e){if("function"!=typeof this)throw TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return C(this,e)}constructor(e,t,o){super(t),this.code=e,this.data=o,this.name="ProtocolError",x(this,new.target)}static fromError(t,o,i){return t===eu.UrlElicitationRequired&&i&&i.elicitations?new eh(i.elicitations,o):t===eu.UnsupportedProtocolVersion&&i&&Array.isArray(i.supported)&&"string"==typeof i.requested?new em({supported:i.supported,requested:i.requested},o):(t===eu.InvalidParams||t===eu.ResourceNotFound)&&"string"==typeof i?.uri&&(t===eu.ResourceNotFound||1===Object.keys(i).length)?new ep(i.uri,o):t===eu.MissingRequiredClientCapability&&i&&null!==i.requiredCapabilities&&"object"==typeof i.requiredCapabilities&&!Array.isArray(i.requiredCapabilities)?new ef({requiredCapabilities:i.requiredCapabilities},o):new e(t,o,i)}},ep=class extends ed{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.ResourceNotFoundError"})}constructor(e,t=`Resource not found: ${e}`){super(eu.InvalidParams,t,{uri:e})}get uri(){return this.data.uri}},eh=class extends ed{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.UrlElicitationRequiredError"})}constructor(e,t=`URL elicitation${e.length>1?"s":""} required`){super(eu.UrlElicitationRequired,t,{elicitations:e})}get elicitations(){return this.data?.elicitations??[]}},em=class extends ed{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.UnsupportedProtocolVersionError"})}constructor(e,t=`Unsupported protocol version: ${e.requested}`){super(eu.UnsupportedProtocolVersion,t,e)}get supported(){return this.data.supported}get requested(){return this.data.requested}},ef=class extends ed{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.MissingRequiredClientCapabilityError"})}constructor(e,t=`Missing required client capabilities: ${Object.keys(e.requiredCapabilities).join(", ")}`){super(eu.MissingRequiredClientCapability,t,e)}get requiredCapabilities(){return this.data.requiredCapabilities}};let eg=["tools/call","prompts/get","resources/read"],ev=["elicitation/create","sampling/createMessage","roots/list"];function e_(){if(a)return a;let e=en();return a={request:{"elicitation/create":I.Ikc({method:I.euz("elicitation/create"),params:e.ElicitRequestParamsSchema}),"sampling/createMessage":I.Ikc({method:I.euz("sampling/createMessage"),params:e.CreateMessageRequestParamsSchema}),"roots/list":I.Ikc({method:I.euz("roots/list"),params:I._H3({}).optional()})},response:{"elicitation/create":e.ElicitResultSchema,"sampling/createMessage":e.CreateMessageResultSchema,"roots/list":e.ListRootsResultSchema}}}function ey(e){return ev.includes(e)}function eS(e){return ey(e)?e_().request[e]:void 0}let eb={"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},ek={"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 eP(e){return Object.prototype.hasOwnProperty.call(eb,e)}function ew(e){return Object.prototype.hasOwnProperty.call(ek,e)}function ez(e){return null!==e&&"object"==typeof e&&!Array.isArray(e)}function eR(e,t){if(void 0===e)return{ok:!1,reason:"not-in-era"};let o=e.safeParse(t);return o.success?{ok:!0,value:o.data}:{ok:!1,reason:"invalid",message:String(o.error)}}Object.keys(eb),Object.keys(ek);let eI={ok:!1,reason:"not-in-era"},ej=[R.jr,R.br],ex={era:"2026-07-28",hasRequestMethod:eP,hasNotificationMethod:ew,hasInputRequestMethod:e=>void 0!==eS(e),validateRequest:(e,t)=>eR(eP(e)?en().dispatchRequestSchemas[e]:void 0,t),validateResult:(e,t)=>eR(Object.prototype.hasOwnProperty.call(eb,e)?en().dispatchResultSchemas[e]:void 0,t),validateNotification:(e,t)=>eR(ew(e)?en().notificationSchemas2026[e]:void 0,t),validateInputRequest:(e,t)=>eR(eS(e),t),validateInputResponse:(e,t)=>eR(ey(e)?e_().response[e]:void 0,t),samplingResultVariant:()=>eI,outboundEnvelope:e=>({[R.jr]:e.protocolVersion,[R.xr]:e.clientInfo,[R.br]:e.clientCapabilities,...void 0!==e.logLevel&&{[R.Or]:e.logLevel}}),validateEnvelopeMeta(e){let t=[];for(let o of ej)o in e||t.push({key:o,problem:"missing"});let o=en().RequestMetaEnvelopeSchema.safeParse(e);if(!o.success)for(let e of o.error.issues){let o=e.path.map(String),i=o.length>0?o.join("."):"_meta";1===o.length&&t.some(e=>e.key===i&&"missing"===e.problem)||t.push({key:i,problem:e.message})}return t},projectCallToolResult:e=>A(e),inputRequestSchema:eS,decodeResult(e,t){if(!ez(t))return{kind:"invalid",error:new T(O.InvalidResult,`Invalid result for ${e}: not an object`,{method:e})};let o=t.resultType;if(void 0===o)return{kind:"invalid",error:new T(O.InvalidResult,`Invalid result for ${e}: 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:e,violation:"missing-resultType"})};if("string"!=typeof o)return{kind:"invalid",error:new T(O.InvalidResult,`Invalid result for ${e}: non-string resultType`,{method:e,resultType:o})};if("input_required"===o){let o=t.inputRequests,i=ez(o)?o:{},r=t.requestState;return 0===Object.keys(i).length&&"string"!=typeof r?{kind:"invalid",error:new T(O.InvalidResult,`Invalid result for ${e}: input_required carries neither inputRequests nor requestState (every input_required result must include at least one of the two)`,{method:e,violation:"input-required-missing-both"})}:{kind:"input_required",inputRequests:i,..."string"==typeof r&&{requestState:r}}}if("complete"!==o)return{kind:"invalid",error:new T(O.UnsupportedResultType,`Unsupported result type '${o}' for ${e}`,{resultType:o,method:e})};let i=function(){if(s)return s;let e=en();return s={"tools/call":e.CallToolResultSchema,"tools/list":e.ListToolsResultSchema,"prompts/get":e.GetPromptResultSchema,"prompts/list":e.ListPromptsResultSchema,"resources/list":e.ListResourcesResultSchema,"resources/templates/list":e.ListResourceTemplatesResultSchema,"resources/read":e.ReadResourceResultSchema,"completion/complete":e.CompleteResultSchema,"server/discover":e.DiscoverResultSchema}}(),r=Object.hasOwn(i,e)?i[e]:void 0;if(void 0!==r){let o=r.safeParse(t);if(!o.success)return{kind:"invalid",error:new T(O.InvalidResult,`Invalid result for ${e}: ${o.error}`,{method:e})}}let n={...t};return delete n.resultType,{kind:"complete",result:n}},encodeResult:(e,t,o)=>(function(e,t){if(void 0===t)return e;let o=e._meta;return void 0===o?{...e,_meta:{[R.Nr]:t}}:null===o||"object"!=typeof o||Array.isArray(o)||void 0!==o[R.Nr]?e:{...e,_meta:{...o,[R.Nr]:t}}})(function(e,t){let o=t[es];if("complete"!==t.resultType||!ea.includes(e)){let e;return void 0===o?t:(e={...t},delete e[es],e)}let i=el(t.ttlMs)?t.ttlMs:void 0!==o&&el(o.ttlMs)?o.ttlMs:0,r=ec(t.cacheScope)?t.cacheScope:void 0!==o&&ec(o.cacheScope)?o.cacheScope:"private",n={...t,ttlMs:i,cacheScope:r};return delete n[es],n}(e,function(e,t){let o=t.resultType;if(void 0===o)return{...t,resultType:"complete"};if("complete"===o||eg.includes(e))return t;throw new ed(eu.InternalError,`Handler for ${e} returned resultType '${String(o)}', but results of ${e} only support 'complete' on protocol revision 2026-07-28`)}(e,function(e,t){let o=t,i=!1,r=()=>(i||(o={...o},i=!0),o),n=t.tools;"tools/list"===e&&Array.isArray(n)&&n.some(e=>ez(e)&&"execution"in e)&&(r().tools=n.map(e=>{if(!ez(e)||!("execution"in e))return e;let t={...e};return delete t.execution,t}));let a=t.capabilities;if(ez(a)&&"tasks"in a){let e={...a};delete e.tasks,r().capabilities=e}return o}(e,t))),o),encodeErrorCode:e=>-32002===e?-32602:e,checkInboundEnvelope(e){if(void 0===e.envelope)return"Request is missing the required _meta envelope for protocol revision 2026-07-28 (io.modelcontextprotocol/protocolVersion, io.modelcontextprotocol/clientCapabilities)";let t=en().RequestMetaEnvelopeSchema.safeParse(e.envelope);if(!t.success)return`Invalid _meta envelope for protocol revision 2026-07-28: ${t.error.issues.map(e=>e.message).join("; ")}`}},eC="2026-07-28";function eq(e){return void 0!==e&&e>=E?ex:er}function eY(e){return void 0!==e.revision?eq(e.revision).era:"modern"===e.era?ex.era:er.era}function eO(e){return e$.some(t=>t.hasRequestMethod(e))}function eT(e){return e$.some(t=>t.hasNotificationMethod(e))}let e$=[er,ex];var eE=(e=>{let t={};for(var o in e)v(t,o,{get:e[o],enumerable:!0});return t})({AnnotationsSchema:()=>R.h,AudioContentSchema:()=>R.g,BaseMetadataSchema:()=>R._,BaseRequestParamsSchema:()=>R.v,BlobResourceContentsSchema:()=>R.y,BooleanSchemaSchema:()=>R.b,CallToolRequestParamsSchema:()=>R.x,CallToolRequestSchema:()=>R.S,CallToolResultSchema:()=>R.C,CancelTaskRequestSchema:()=>R.w,CancelTaskResultSchema:()=>R.T,CancelledNotificationParamsSchema:()=>R.E,CancelledNotificationSchema:()=>R.D,ClientCapabilitiesSchema:()=>R.O,ClientNotificationSchema:()=>R.k,ClientRequestSchema:()=>R.A,ClientResultSchema:()=>R.j,ClientTasksCapabilitySchema:()=>R.M,CompatibilityCallToolResultSchema:()=>R.N,CompleteRequestParamsSchema:()=>R.P,CompleteRequestSchema:()=>R.F,CompleteResultSchema:()=>R.I,ContentBlockSchema:()=>R.L,CreateMessageRequestParamsSchema:()=>R.R,CreateMessageRequestSchema:()=>R.z,CreateMessageResultSchema:()=>R.B,CreateMessageResultWithToolsSchema:()=>R.V,CreateTaskResultSchema:()=>R.H,CursorSchema:()=>R.U,DiscoverRequestSchema:()=>R.W,DiscoverResultSchema:()=>R.G,ElicitRequestFormParamsSchema:()=>R.K,ElicitRequestParamsSchema:()=>R.q,ElicitRequestSchema:()=>R.J,ElicitRequestURLParamsSchema:()=>R.Y,ElicitResultSchema:()=>R.X,ElicitationCompleteNotificationParamsSchema:()=>R.Z,ElicitationCompleteNotificationSchema:()=>R.Q,EmbeddedResourceSchema:()=>R.$,EmptyResultSchema:()=>R.et,EnumSchemaSchema:()=>R.tt,GetPromptRequestParamsSchema:()=>R.nt,GetPromptRequestSchema:()=>R.rt,GetPromptResultSchema:()=>R.it,GetTaskPayloadRequestSchema:()=>R.at,GetTaskPayloadResultSchema:()=>R.ot,GetTaskRequestSchema:()=>R.st,GetTaskResultSchema:()=>R.ct,IconSchema:()=>R.lt,IconsSchema:()=>R.ut,ImageContentSchema:()=>R.dt,ImplementationSchema:()=>R.ft,InitializeRequestParamsSchema:()=>R.pt,InitializeRequestSchema:()=>R.mt,InitializeResultSchema:()=>R.ht,InitializedNotificationSchema:()=>R.gt,JSONArraySchema:()=>R._t,JSONObjectSchema:()=>R.vt,JSONRPCErrorResponseSchema:()=>R.yt,JSONRPCMessageSchema:()=>R.bt,JSONRPCNotificationSchema:()=>R.xt,JSONRPCRequestSchema:()=>R.St,JSONRPCResponseSchema:()=>R.Ct,JSONRPCResultResponseSchema:()=>R.wt,JSONValueSchema:()=>R.Tt,LegacyTitledEnumSchemaSchema:()=>R.Et,ListChangedOptionsBaseSchema:()=>R.Dt,ListPromptsRequestSchema:()=>R.Ot,ListPromptsResultSchema:()=>R.kt,ListResourceTemplatesRequestSchema:()=>R.At,ListResourceTemplatesResultSchema:()=>R.jt,ListResourcesRequestSchema:()=>R.Mt,ListResourcesResultSchema:()=>R.Nt,ListRootsRequestSchema:()=>R.Pt,ListRootsResultSchema:()=>R.Ft,ListTasksRequestSchema:()=>R.It,ListTasksResultSchema:()=>R.Lt,ListToolsRequestSchema:()=>R.Rt,ListToolsResultSchema:()=>R.zt,LoggingLevelSchema:()=>R.Bt,LoggingMessageNotificationParamsSchema:()=>R.Vt,LoggingMessageNotificationSchema:()=>R.Ht,ModelHintSchema:()=>R.Ut,ModelPreferencesSchema:()=>R.Wt,MultiSelectEnumSchemaSchema:()=>R.Gt,NotificationSchema:()=>R.Kt,NotificationsParamsSchema:()=>R.qt,NumberSchemaSchema:()=>R.Jt,PaginatedRequestParamsSchema:()=>R.Yt,PaginatedRequestSchema:()=>R.Xt,PaginatedResultSchema:()=>R.Zt,PingRequestSchema:()=>R.Qt,PrimitiveSchemaDefinitionSchema:()=>R.$t,ProgressNotificationParamsSchema:()=>R.en,ProgressNotificationSchema:()=>R.tn,ProgressSchema:()=>R.nn,ProgressTokenSchema:()=>R.rn,PromptArgumentSchema:()=>R.in,PromptListChangedNotificationSchema:()=>R.an,PromptMessageSchema:()=>R.on,PromptReferenceSchema:()=>R.sn,PromptSchema:()=>R.cn,ReadResourceRequestParamsSchema:()=>R.ln,ReadResourceRequestSchema:()=>R.un,ReadResourceResultSchema:()=>R.dn,RelatedTaskMetadataSchema:()=>R.fn,RequestIdSchema:()=>R.pn,RequestMetaSchema:()=>R.mn,RequestSchema:()=>R.hn,ResourceContentsSchema:()=>R.gn,ResourceLinkSchema:()=>R._n,ResourceListChangedNotificationSchema:()=>R.vn,ResourceRequestParamsSchema:()=>R.yn,ResourceSchema:()=>R.bn,ResourceTemplateReferenceSchema:()=>R.xn,ResourceTemplateSchema:()=>R.Sn,ResourceUpdatedNotificationParamsSchema:()=>R.Cn,ResourceUpdatedNotificationSchema:()=>R.wn,ResultMetaObjectSchema:()=>R.Tn,ResultSchema:()=>R.En,RoleSchema:()=>R.Dn,RootSchema:()=>R.On,RootsListChangedNotificationSchema:()=>R.kn,SamplingContentSchema:()=>R.An,SamplingMessageContentBlockSchema:()=>R.jn,SamplingMessageSchema:()=>R.Mn,ServerCapabilitiesSchema:()=>R.Nn,ServerNotificationSchema:()=>R.Pn,ServerRequestSchema:()=>R.Fn,ServerResultSchema:()=>R.In,ServerTasksCapabilitySchema:()=>R.Ln,SetLevelRequestParamsSchema:()=>R.Rn,SetLevelRequestSchema:()=>R.zn,SingleSelectEnumSchemaSchema:()=>R.Bn,StringSchemaSchema:()=>R.Vn,SubscribeRequestParamsSchema:()=>R.Hn,SubscribeRequestSchema:()=>R.Un,SubscriptionFilterSchema:()=>R.Wn,SubscriptionsAcknowledgedNotificationParamsSchema:()=>R.Gn,SubscriptionsAcknowledgedNotificationSchema:()=>R.Kn,SubscriptionsListenRequestParamsSchema:()=>R.qn,SubscriptionsListenRequestSchema:()=>R.Jn,SubscriptionsListenResultMetaSchema:()=>R.Yn,SubscriptionsListenResultSchema:()=>R.Xn,TaskAugmentedRequestParamsSchema:()=>R.Zn,TaskCreationParamsSchema:()=>R.Qn,TaskMetadataSchema:()=>R.$n,TaskSchema:()=>R.er,TaskStatusNotificationParamsSchema:()=>R.tr,TaskStatusNotificationSchema:()=>R.nr,TaskStatusSchema:()=>R.rr,TextContentSchema:()=>R.ir,TextResourceContentsSchema:()=>R.ar,TitledMultiSelectEnumSchemaSchema:()=>R.or,TitledSingleSelectEnumSchemaSchema:()=>R.sr,ToolAnnotationsSchema:()=>R.cr,ToolChoiceSchema:()=>R.lr,ToolExecutionSchema:()=>R.ur,ToolListChangedNotificationSchema:()=>R.dr,ToolResultContentSchema:()=>R.fr,ToolSchema:()=>R.pr,ToolUseContentSchema:()=>R.mr,UnsubscribeRequestParamsSchema:()=>R.hr,UnsubscribeRequestSchema:()=>R.gr,UntitledMultiSelectEnumSchemaSchema:()=>R._r,UntitledSingleSelectEnumSchemaSchema:()=>R.vr});let eM=e=>R.St.safeParse(e).success,eL=e=>R.wt.safeParse(e).success,eN=e=>R.yt.safeParse(e).success,eA=e=>"object"==typeof e&&null!==e&&!Array.isArray(e)&&"input_required"===e.resultType,eU=e=>R.mt.safeParse(e).success,eH="x-mcp-header",eZ=/^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/,eV=new Set(["string","integer","boolean","number"]);function eJ(e){let t=[],o=new Map,i=(e,r,n)=>{if(null===e||"object"!=typeof e)return;if(eH in e){if(!n||0===r.length)return`${eK(r)}: 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 i=e[eH];if("string"!=typeof i||0===i.length)return`${eK(r)}: x-mcp-header MUST be a non-empty string`;if(!eZ.test(i))return`${eK(r)}: x-mcp-header '${i}' is not a valid RFC 9110 token (no spaces, control characters or HTTP delimiters)`;let a="string"==typeof e.type?e.type:void 0;if(void 0===a||!eV.has(a))return`${eK(r)}: x-mcp-header is only permitted on primitive-typed properties (string, integer, boolean); got ${a??"<none>"}`;let s=i.toLowerCase(),l=o.get(s);if(void 0!==l)return`x-mcp-header '${i}' is not case-insensitively unique (also declared as '${l}')`;o.set(s,i),t.push({path:r,headerName:i,type:a})}let a=e.properties;if(null!==a&&"object"==typeof a)for(let[e,t]of Object.entries(a)){let o=i(t,[...r,e],n);if(void 0!==o)return o}for(let t of eD){let o=e[t];if(void 0!==o)for(let e of Array.isArray(o)?o:null!==o&&"object"==typeof o&&eF.has(t)?Object.values(o):[o]){let o=i(e,[...r,`<${t}>`],!1);if(void 0!==o)return o}}},r=i(e,[],!0);return void 0===r?{valid:!0,declarations:t}:{valid:!1,reason:r}}let eD=["items","prefixItems","contains","additionalProperties","unevaluatedProperties","unevaluatedItems","propertyNames","patternProperties","dependentSchemas","oneOf","anyOf","allOf","not","if","then","else","$defs","definitions"],eF=new Set(["patternProperties","dependentSchemas","$defs","definitions"]);function eK(e){return 0===e.length?"<root>":e.join(".")}let eB="=?base64?";function eW(e){return!function(e){if(0===e.length||e.startsWith(eB)&&e.endsWith("?=")||e!==e.trim())return!0;for(let t=0;t<e.length;t++){let o=e.codePointAt(t);if(9!==o&&(!(o>=32)||!(o<=126)))return!0}return!1}(e)?e:`${eB}${function(e){let t=new TextEncoder().encode(e),o="";for(let e of t)o+=String.fromCodePoint(e);return btoa(o)}(e)}?=`}function eG(e){return new Set(e.flatMap(e=>Object.keys(e.shape)))}function eX(e){if(null==e)return!1;let t=typeof e;return("object"===t||"function"===t)&&"~standard"in e&&"function"==typeof e["~standard"]?.validate}eu.InvalidRequest,eu.UnsupportedProtocolVersion,eu.InvalidParams,eu.MethodNotFound,eu.InvalidParams,eu.MissingRequiredClientCapability,eu.ParseError,eu.InvalidRequest,eu.MethodNotFound,eu.UnsupportedProtocolVersion,eu.MissingRequiredClientCapability;let eQ=!1,e0="draft-2020-12";async function e1(e,t){let o=await e["~standard"].validate(t);return o.issues&&o.issues.length>0?{success:!1,error:o.issues.map(e=>e.path?.length?`${e.path.map(e=>String("object"==typeof e?e.key:e)).join(".")}: ${e.message}`:e.message).join(", ")}:{success:!0,data:o.value}}let e2=/\\\.\\d\{(\d+)\}/;function e9(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}let e4=new Set(["$comment","deprecated","description","examples","readOnly","title","writeOnly"]);function e5(e){return e4.has(e)||e.startsWith("x-")}let e3=new Set(["$schema",...Object.keys(R.K.shape.requestedSchema.shape)]),e6={string:eG([R.Vn,R.vr,R.sr,R.Et]),number:eG([R.Jt]),integer:eG([R.Jt]),boolean:eG([R.b]),array:eG([R._r,R.or])},e8=new Set(R.Vn.shape.format.unwrap().options);async function e7(e){let{config:t,method:o,originalParams:i,requestOptions:r,hooks:n,signal:a}=e,s=e.flowStartedAt??Date.now(),l=e.firstPayload,c=0;for(;;){let e;if((c+=1)>t.maxRounds){var u;throw new T(O.InputRequiredRoundsExceeded,(u=t.maxRounds,`Multi-round-trip request '${o}' still required input after ${u} rounds (inputRequired.maxRounds)`),{rounds:t.maxRounds,lastResult:{inputRequests:l.inputRequests,...void 0!==l.requestState&&{requestState:l.requestState}}})}r.onprogress?.({progress:c,message:`Fulfilling input required by '${o}' (round ${c})`});let d=Object.entries(l.inputRequests??{});if(d.length>0){let t=function(e){let t=new AbortController,o=()=>t.abort(e?.reason);return e?.addEventListener("abort",o,{once:!0}),e?.aborted&&t.abort(e.reason),{signal:t.signal,abort:e=>t.abort(e),dispose:()=>e?.removeEventListener("abort",o)}}(a);try{let o=await Promise.all(d.map(async([e,o])=>{try{return[e,await n.dispatchInputRequest(e,o,t.signal)]}catch(e){throw t.abort(e),e}}));e=Object.fromEntries(o)}finally{t.dispose()}}else await function(e){return new Promise((t,o)=>{if(e?.aborted)return void o(e.reason instanceof T?e.reason:new T(O.RequestTimeout,String(e.reason)));let i=setTimeout(()=>{e?.removeEventListener("abort",r),t()},250),r=()=>{clearTimeout(i),o(e?.reason instanceof T?e.reason:new T(O.RequestTimeout,String(e?.reason)))};e?.addEventListener("abort",r,{once:!0})})}(a);let p={...void 0!==r.timeout&&{timeout:r.timeout}};if(void 0!==r.maxTotalTimeout){let e=Date.now()-s,t=r.maxTotalTimeout-e;if(t<=0)throw new T(O.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:r.maxTotalTimeout,totalElapsed:e});p.maxTotalTimeout=t}let h=await n.retry(function(e,t,o){let i=void 0!==t&&Object.keys(t).length>0;return i||void 0!==o?{...e,...i&&{inputResponses:t},...void 0!==o&&{requestState:o}}:e}(i,e,l.requestState),p);if(eA(h)){l={inputRequests:h.inputRequests??{},...void 0!==h.requestState&&{requestState:h.requestState}};continue}return h}}Object.assign(function(e){let t=void 0!==e.inputRequests&&Object.keys(e.inputRequests).length>0,o="string"==typeof e.requestState;if(!t&&!o)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",...void 0!==e.inputRequests&&{inputRequests:e.inputRequests},...void 0!==e.requestState&&{requestState:e.requestState}}},{elicit(e){try{return{method:"elicitation/create",params:function(e){var t;if(!eX(e.requestedSchema))return{...e,mode:"form",requestedSchema:e.requestedSchema};let o=e.requestedSchema["~standard"].vendor,i=function(e,t){let o={},i=[];for(let[r,n]of Object.entries(e))"properties"===r&&e9(n)?o[r]=Object.fromEntries(Object.entries(n).map(([e,o])=>[e,function(e,t,o,i){if(!e9(e))return e;let r="string"==typeof e.type&&Object.hasOwn(e6,e.type)?e6[e.type]:void 0;if(void 0===r)return e;let n={};for(let[s,l]of Object.entries(e))if(r.has(s)||e5(s))n[s]=l;else if("pattern"===s&&"string"===e.type&&"string"==typeof e.format)if(e8.has(e.format)){var a;"string"==typeof l&&(a=e.format,"zod"!==o||(function(e,t){let o;switch(e){case"email":o=[I.Rpp()];break;case"uri":o=[I.OZ5()];break;case"date":o=[I.KH5.p6()];break;case"date-time":let i,r;i=e2.exec(t),r=[void 0,-1,0],i&&r.push(Number(i[1])),o=[!1,!0].flatMap(e=>[!1,!0].flatMap(t=>r.map(o=>I.KH5.w$({local:e,offset:t,precision:o}))))}return new Set(o.map(e=>{let t;return t=I.blZ(e,{target:e0,io:"input"}),"string"==typeof t.pattern?t.pattern:void 0}).filter(e=>void 0!==e))})(a,l).has(l))||i.push(`${t}.${s}`)}else n[s]=l;else i.push(`${t}.${s}`);return n}(o,`properties.${e}`,t,i)])):e3.has(r)?o[r]=n:e5(r)||i.push(r);if(i.length>0)throw new ed(eu.InvalidParams,`Elicitation requestedSchema contains unsupported JSON Schema constraint(s) after Standard Schema conversion: ${i.join(", ")}`);return o}(function(e){try{return function(e,t="input"){let o,i=e["~standard"];if(i.jsonSchema)o=i.jsonSchema[t]({target:e0});else if("zod"===i.vendor){if(!("_zod"in e))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().");eQ||(eQ=!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.")),o=I.blZ(e,{target:e0,io:t})}else throw Error(`Schema library "${i.vendor}" does not implement StandardJSONSchemaV1 (\`~standard.jsonSchema\`). Upgrade to a version that does, or wrap your JSON Schema with fromJsonSchema().`);if("output"===t)return void 0!==o.type||!function e(t){if("properties"in t||"patternProperties"in t||"additionalProperties"in t||"required"in t)return!0;for(let o of["oneOf","anyOf","allOf"]){let i=t[o];if(Array.isArray(i)&&i.length>0)return i.every(t=>null!==t&&"object"==typeof t&&("object"===t.type||e(t)))}return!1}(o)?o:{type:"object",...o};if(void 0!==o.type&&"object"!==o.type)throw Error(`MCP tool and prompt schemas must describe objects (got type: ${JSON.stringify(o.type)}). Wrap your schema in z.object({...}) or equivalent.`);return{type:"object",...o}}(e,"input")}catch(t){let e=t instanceof Error?t.message:String(t);throw new ed(eu.InvalidParams,`Elicitation requestedSchema must describe an object with flat primitive properties: ${e}`)}}(e.requestedSchema),o),r=(t=R.K.shape.requestedSchema,I.xLC(t,i));if(!r.success)throw new ed(eu.InvalidParams,`Elicitation requestedSchema only supports flat primitive properties (string, number, integer, boolean, and string enums): ${function(e,t){if(!e9(e.properties))return t;let o=Object.entries(e.properties).filter(([,e])=>{var t;return!(t=R.$t,I.xLC(t,e)).success}).map(([e])=>`properties.${e}`);return o.length>0?o.join(", "):t}(i,r.error.message)}`);let n=function e(t,o,i=""){return Array.isArray(t)&&Array.isArray(o)?t.flatMap((t,r)=>e(t,o[r],`${i}[${r}]`)):e9(t)&&e9(o)?Object.entries(t).flatMap(([t,r])=>{let n=i?`${i}.${t}`:t;return Object.prototype.hasOwnProperty.call(o,t)?e(r,o[t],n):e5(t)?[]:[n]}):[]}(i,r.data);if(n.length>0)throw new ed(eu.InvalidParams,`Elicitation requestedSchema contains unsupported JSON Schema constraint(s) after Standard Schema conversion: ${n.join(", ")}`);let a=(r.data.required??[]).filter(e=>!Object.prototype.hasOwnProperty.call(r.data.properties,e));if(a.length>0)throw new ed(eu.InvalidParams,`Elicitation requestedSchema lists required properties that are not defined in properties: ${a.join(", ")}`);return{...e,mode:"form",requestedSchema:r.data}}(e)}}catch(e){throw e instanceof ed?TypeError(e.message,{cause:e}):e}},elicitUrl:e=>({method:"elicitation/create",params:{...e,mode:"url"}}),createMessage:e=>({method:"sampling/createMessage",params:e}),listRoots:()=>({method:"roots/list"})});let te={IdJagTokenExchangeResponseSchema:R.t,OAuthClientInformationFullSchema:R.n,OAuthClientInformationSchema:R.r,OAuthClientMetadataSchema:R.i,OAuthClientRegistrationErrorSchema:R.a,OAuthErrorResponseSchema:R.o,OAuthMetadataSchema:R.s,OAuthProtectedResourceMetadataSchema:R.c,OAuthTokenRevocationRequestSchema:R.l,OAuthTokensSchema:R.u,OpenIdProviderDiscoveryMetadataSchema:R.d,OpenIdProviderMetadataSchema:R.f},tt={},to={};function ti(e,t){let o=e.slice(0,-6);tt[o]=t,to[o]=e=>t.safeParse(e).success}for(let e of["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"])ti(e,eE[e]);for(let[e,t]of Object.entries(te))ti(e,t);Object.freeze(tt);let tr=Object.freeze(to),tn=[R.jr,R.xr,R.br,R.Or],ta=["inputResponses","requestState"];function ts(e,t){let o=e.params;if(!td(o))return{message:e,lifted:{}};let i=o._meta,r=td(i)?tn.filter(e=>e in i):[],n="request"===t?ta.filter(e=>e in o):[];if(0===r.length&&0===n.length)return{message:e,lifted:{}};let a={},s={...o};if(r.length>0&&td(i)){let e={},t={...i};for(let o of r)e[o]=i[o],delete t[o];a.envelope=e,Object.keys(t).length>0?s._meta=t:delete s._meta}for(let e of n)"inputResponses"===e&&(a.inputResponses=s[e]),"requestState"===e&&(a.requestState=s[e]),delete s[e];return{message:{...e,params:s},lifted:a}}function tl(e,t){let o=e.validateResult(t,void 0);if(o.ok||"not-in-era"!==o.reason)return{"~standard":{version:1,vendor:"mcp-wire-codec",validate(o){let i=e.validateResult(t,o);return i.ok?{value:i.value}:{issues:[{message:"invalid"===i.reason?i.message:`not-in-era: ${t}`}]}}}}}let tc=(f=void 0,()=>f);var tu=class{_transport;_requestMessageId=0;_requestHandlers=new Map;_requestHandlerAbortControllers=new Map;_notificationHandlers=new Map;_responseHandlers=new Map;_progressHandlers=new Map;_timeoutInfo=new Map;_pendingDebouncedNotifications=new Set;_negotiatedProtocolVersion;_supportedProtocolVersions;onclose;onerror;fallbackRequestHandler;fallbackNotificationHandler;constructor(e){this._options=e,this._supportedProtocolVersions=e?.supportedProtocolVersions??R.Fr,this.setNotificationHandler("notifications/cancelled",e=>{this._oncancel(e)}),this.setNotificationHandler("notifications/progress",e=>{this._onprogress(e)}),this.setRequestHandler("ping",e=>({}))}_shouldDropInbound(e){}_outboundMetaEnvelope(){}_envelopeOutbound(e){let t=this._outboundMetaEnvelope();if(void 0===t)return e;let o=e.params??{};return{...e,params:{...o,_meta:{...t,...o._meta}}}}_resolveNonCompleteResult(e,t){return Promise.reject(new T(O.UnsupportedResultType,`Unsupported result type '${e.kind}' for ${t.request.method}`,{resultType:e.kind,method:t.request.method}))}_getRequestHandler(e){return this._requestHandlers.get(e)}async _oncancel(e){e.params.requestId&&this._requestHandlerAbortControllers.get(e.params.requestId)?.abort(e.params.reason)}_setupTimeout(e,t,o,i,r=!1){this._timeoutInfo.set(e,{timeoutId:setTimeout(i,t),startTime:Date.now(),timeout:t,maxTotalTimeout:o,resetTimeoutOnProgress:r,onTimeout:i})}_resetTimeout(e){let t=this._timeoutInfo.get(e);if(!t)return!1;let o=Date.now()-t.startTime;if(t.maxTotalTimeout&&o>=t.maxTotalTimeout)throw this._timeoutInfo.delete(e),new T(O.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:t.maxTotalTimeout,totalElapsed:o});return clearTimeout(t.timeoutId),t.timeoutId=setTimeout(t.onTimeout,t.timeout),!0}_cleanupTimeout(e){let t=this._timeoutInfo.get(e);t&&(clearTimeout(t.timeoutId),this._timeoutInfo.delete(e))}async connect(e){this._transport=e;let t=this.transport?.onclose;this._transport.onclose=()=>{try{t?.()}finally{this._onclose()}};let o=this.transport?.onerror;this._transport.onerror=e=>{o?.(e),this._onerror(e)};let i=this._transport?.onmessage;this._transport.onmessage=(e,t)=>{(i?.(e,t),eL(e)||eN(e))?this._onresponse(e):eM(e)?this._onrequest(e,t):R.xt.safeParse(e).success?this._onnotification(e,t):this._onerror(Error(`Unknown message type: ${JSON.stringify(e)}`))},e.setSupportedProtocolVersions?.(this._supportedProtocolVersions),await this._transport.start()}_onclose(){let e=this._responseHandlers;for(let e of(this._responseHandlers=new Map,this._progressHandlers.clear(),this._pendingDebouncedNotifications.clear(),this._timeoutInfo.values()))clearTimeout(e.timeoutId);this._timeoutInfo.clear();let t=this._requestHandlerAbortControllers;this._requestHandlerAbortControllers=new Map;let o=new T(O.ConnectionClosed,"Connection closed");this._transport=void 0;try{this.onclose?.()}finally{for(let t of e.values())t(o);for(let e of t.values())e.abort(o)}}_onerror(e){this.onerror?.(e)}_onnotification(e,t){let{message:o}=ts(e,"notification"),i=this._negotiatedWireCodec();if(t?.classification===void 0&&"drop"===this._shouldDropInbound(e))return;if(t?.classification!==void 0){let e=eY(t.classification);if(e!==i.era)return void this._onerror(Error(`Era mismatch on inbound notification '${o.method}': classified as ${e} but this instance serves ${i.era}`))}if(eT(o.method)&&!i.hasNotificationMethod(o.method))return;let r=this._notificationHandlers.get(o.method),n=this.fallbackNotificationHandler;(void 0!==r||void 0!==n)&&Promise.resolve().then(()=>void 0===r?n(o):r(o,i)).catch(e=>this._onerror(Error(`Uncaught error in notification handler: ${e}`)))}_onrequest(e,t){var o;let{message:i,lifted:r}=ts(e,"request"),n=this._negotiatedWireCodec();if(t?.classification===void 0&&"drop"===this._shouldDropInbound(e))return void this._onerror(Error(`Dropped inbound request '${e.method}': not servable on this connection's protocol era`));let a=this._transport,s=(e,t,o)=>{let r={jsonrpc:"2.0",id:i.id,error:{code:e,message:t,...void 0!==o&&{data:o}}};a?.send(r).catch(e=>this._onerror(Error(`Failed to send an error response: ${e}`)))};if(t?.classification!==void 0){let e=eY(t.classification);if(e!==n.era){this._onerror(Error(`Era mismatch on inbound request '${i.method}': classified as ${e} but this instance serves ${n.era}`));let o=t.classification.revision??e;s(eu.UnsupportedProtocolVersion,`Unsupported protocol version: ${o}`,{supported:this._supportedProtocolVersions,requested:o});return}}if(eO(i.method)&&!n.hasRequestMethod(i.method))return void s(eu.MethodNotFound,"Method not found");let l=this._requestHandlers.get(i.method)??this.fallbackRequestHandler;if(void 0===l)return void s(eu.MethodNotFound,"Method not found");let c=n.checkInboundEnvelope(r);if(void 0!==c)return void s(eu.InvalidParams,c);let u=(e,t)=>this._notificationViaCodec(this._resolveOutboundCodec(e.method),e,{...t,relatedRequestId:i.id}),d=(e,t,o)=>this._requestWithSchemaViaCodec(this._resolveOutboundCodec(e.method),e,t,{...o,relatedRequestId:i.id}),p=new AbortController;this._requestHandlerAbortControllers.set(i.id,p);let h=void 0===r.inputResponses?void 0:function(e){let t={},o=[];if(!tp(e))return{accepted:t,droppedKeys:o};for(let[i,r]of Object.entries(e)){if(!tp(r)||"method"in r||"result"in r){o.push(i);continue}t[i]=r}return{accepted:t,droppedKeys:o}}(r.inputResponses),m={sessionId:a?.sessionId,mcpReq:{id:i.id,method:i.method,_meta:i.params?._meta,...void 0!==r.envelope&&{envelope:r.envelope},...void 0!==h&&{inputResponses:h.accepted},...void 0!==h&&h.droppedKeys.length>0&&{droppedInputResponseKeys:h.droppedKeys},requestState:void 0===r.requestState?tc:(o=r.requestState,()=>o),signal:p.signal,send:(e,t,o)=>{let i=this._resolveOutboundCodec(e.method);if(this._assertOutboundRequestInEra(i,e.method),eX(t))return d(e,t,o);let r=tl(i,e.method);if(void 0===r)throw TypeError(`'${e.method}' is not a spec method; pass a result schema as the second argument to ctx.mcpReq.send().`);return d(e,r,t)},notify:u},http:t?.authInfo?{authInfo:t.authInfo}:void 0},f=this.buildContext(m,t);Promise.resolve().then(()=>l(i,f)).then(async e=>{let t;if(p.signal.aborted)return;try{t=n.encodeResult(i.method,e,this._outboundServerInfo())}catch(e){this._onerror(Error(`Failed to encode result for ${i.method}: ${e}`)),s(eu.InternalError,"Internal error");return}let o={result:t,jsonrpc:"2.0",id:i.id};await a?.send(o)},async e=>{if(p.signal.aborted)return;let t=Number.isSafeInteger(e.code)?e.code:eu.InternalError,o={jsonrpc:"2.0",id:i.id,error:{code:n.encodeErrorCode(t),message:e.message??"Internal error",...void 0!==e.data&&{data:e.data}}};await a?.send(o)}).catch(e=>this._onerror(Error(`Failed to send response: ${e}`))).finally(()=>{this._requestHandlerAbortControllers.get(i.id)===p&&this._requestHandlerAbortControllers.delete(i.id)})}_onprogress(e){let{progressToken:t,...o}=e.params,i=Number(t),r=this._progressHandlers.get(i);if(!r)return void this._onerror(Error(`Received a progress notification for an unknown token: ${JSON.stringify(e)}`));let n=this._responseHandlers.get(i),a=this._timeoutInfo.get(i);if(a&&n&&a.resetTimeoutOnProgress)try{this._resetTimeout(i)}catch(e){this._responseHandlers.delete(i),this._progressHandlers.delete(i),this._cleanupTimeout(i),n(e);return}r(o)}_onresponse(e){let t=Number(e.id),o=this._responseHandlers.get(t);void 0===o?this._onerror(Error(`Received a response for an unknown message ID: ${JSON.stringify(e)}`)):(this._responseHandlers.delete(t),this._cleanupTimeout(t),this._progressHandlers.delete(t),o(eL(e)?e:ed.fromError(e.error.code,e.error.message,e.error.data)))}get transport(){return this._transport}async close(){await this._transport?.close()}request(e,t,o){let i=this._resolveOutboundCodec(e.method);if(this._assertOutboundRequestInEra(i,e.method),eX(t))return this._requestWithSchemaViaCodec(i,e,t,o);let r=tl(i,e.method);if(void 0===r)throw TypeError(`'${e.method}' is not a spec method; pass a result schema as the second argument to request().`);return this._requestWithSchemaViaCodec(i,e,r,t)}_negotiatedWireCodec(){return eq(this._negotiatedProtocolVersion)}_wireCodec(){return this._negotiatedWireCodec()}_resolveOutboundCodec(e){if(void 0===this._negotiatedProtocolVersion){let t=function(e){switch(e){case"initialize":case"notifications/initialized":return eq(void 0);case"server/discover":return eq(eC);default:return}}(e);if(t)return t}return this._negotiatedWireCodec()}_assertOutboundRequestInEra(e,t){if(eO(t)&&!e.hasRequestMethod(t))throw new T(O.MethodNotSupportedByProtocolVersion,`Method '${t}' is not supported by the negotiated protocol version (wire era ${e.era})`,{method:t,era:e.era})}_requestWithSchema(e,t,o){let i=this._resolveOutboundCodec(e.method);return this._assertOutboundRequestInEra(i,e.method),this._requestWithSchemaViaCodec(i,e,t,o)}_requestWithSchemaViaCodec(e,t,o,i){let r,n,{relatedRequestId:a,resumptionToken:s,onresumptiontoken:l,headers:c}=i??{},u=Date.now();return new Promise((d,p)=>{let h=e=>{p(e)};if(!this._transport)return void h(Error("Not connected"));if(this._options?.enforceStrictCapabilities===!0)try{this.assertCapabilityForMethod(t.method)}catch(e){h(e);return}if(i?.signal?.aborted){let e=i.signal.reason;throw e instanceof T?e:new T(O.RequestTimeout,String(e))}let m=e.era===eC&&!0===this._transport.hasPerRequestStream?new AbortController:void 0,f=this._requestMessageId++;n=f;let g={...t,jsonrpc:"2.0",id:f};i?.onprogress&&(this._progressHandlers.set(f,i.onprogress),g.params={...t.params,_meta:{...t.params?._meta,progressToken:f}});let v=this._envelopeOutbound(g),_=!1,y=e=>{_||(this._progressHandlers.delete(f),void 0===m?this._transport?.send(this._envelopeOutbound({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:f,reason:String(e)}}),{relatedRequestId:a,resumptionToken:s,onresumptiontoken:l}).catch(e=>this._onerror(Error(`Failed to send cancellation: ${e}`))):m.abort(),p(e instanceof T?e:new T(O.RequestTimeout,String(e))))};this._responseHandlers.set(f,r=>{let n;if(!i?.signal?.aborted){if(_=!0,r instanceof Error)return p(r);try{n=e.decodeResult(t.method,r.result)}catch(e){return p(e instanceof Error?e:Error(String(e)))}if("invalid"===n.kind)return p(n.error);if("input_required"===n.kind){var a;return i?.allowInputRequired===!0?d({resultType:"input_required",inputRequests:(a=n).inputRequests,...void 0!==a.requestState&&{requestState:a.requestState}}):d(this._resolveNonCompleteResult(n,{codec:e,request:t,resultSchema:o,options:i,flowStartedAt:u,retry:(i,r)=>this._requestWithSchemaViaCodec(e,void 0===i?{method:t.method}:{method:t.method,params:i},o,r)}))}e1(o,n.result).then(e=>{e.success?d(e.data):p(new T(O.InvalidResult,`Invalid result for ${t.method}: ${e.error}`))},p)}}),r=()=>y(i?.signal?.reason),i?.signal?.addEventListener("abort",r,{once:!0});let S=i?.timeout??6e4;this._setupTimeout(f,S,i?.maxTotalTimeout,()=>y(new T(O.RequestTimeout,"Request timed out",{timeout:S})),i?.resetTimeoutOnProgress??!1),this._transport.send(v,{relatedRequestId:a,resumptionToken:s,onresumptiontoken:l,headers:c,requestSignal:m?.signal}).catch(e=>{this._progressHandlers.delete(f),p(e)})}).finally(()=>{r&&i?.signal?.removeEventListener("abort",r),void 0!==n&&(this._responseHandlers.delete(n),this._cleanupTimeout(n))})}async notification(e,t){return this._notificationViaCodec(this._resolveOutboundCodec(e.method),e,t)}async _notificationViaCodec(e,t,o){if(!this._transport)throw new T(O.NotConnected,"Not connected");if(eT(t.method)&&!e.hasNotificationMethod(t.method))throw new T(O.MethodNotSupportedByProtocolVersion,`Notification '${t.method}' is not supported by the negotiated protocol version (wire era ${e.era})`,{method:t.method,era:e.era});this.assertNotificationCapability(t.method);let i=this._envelopeOutbound({jsonrpc:"2.0",...t});if((this._options?.debouncedNotificationMethods??[]).includes(t.method)&&!t.params&&!o?.relatedRequestId){if(this._pendingDebouncedNotifications.has(t.method))return;this._pendingDebouncedNotifications.add(t.method),Promise.resolve().then(()=>{this._pendingDebouncedNotifications.delete(t.method),this._transport&&this._transport?.send(i,o).catch(e=>this._onerror(e))});return}await this._transport.send(i,o)}setRequestHandler(e,t,o){let i;if(this.assertRequestHandlerCapability(e),"function"==typeof t){if(!eO(e))throw TypeError(`'${e}' is not a spec request method; pass schemas as the second argument to setRequestHandler().`);i=(o,i)=>{let r=this._negotiatedWireCodec(),n=r.validateRequest(e,o);if(n.ok||"not-in-era"!==n.reason||(n=r.validateInputRequest(e,o)),!n.ok){if("not-in-era"===n.reason)throw new ed(eu.InternalError,`No wire schema for ${e} in the resolved era`);throw Error(n.message)}return Promise.resolve(t(n.value,i))}}else if(o)i=async(i,r)=>{let n=await e1(t.params,{...i.params});if(!n.success)throw new ed(eu.InvalidParams,`Invalid params for ${e}: ${n.error}`);return o(n.data,r)};else throw TypeError("setRequestHandler: handler is required");this._requestHandlers.set(e,this._wrapHandler(e,i))}_wrapHandler(e,t){return t}_outboundServerInfo(){}removeRequestHandler(e){this._requestHandlers.delete(e)}assertCanSetRequestHandler(e){if(this._requestHandlers.has(e))throw Error(`A request handler for ${e} already exists, which would be overridden`)}setNotificationHandler(e,t,o){if("function"==typeof t){if(!eT(e))throw TypeError(`'${e}' is not a spec notification method; pass schemas as the second argument to setNotificationHandler().`);this._notificationHandlers.set(e,(o,i)=>{let r=i.validateNotification(e,o);if(!r.ok){if("not-in-era"===r.reason)throw new ed(eu.InternalError,`No wire schema for ${e} in the resolved era`);throw Error(r.message)}return Promise.resolve(t(r.value))});return}if(!o)throw TypeError("setNotificationHandler: handler is required");this._notificationHandlers.set(e,async i=>{let r=await e1(t.params,{...i.params});if(!r.success)throw new ed(eu.InvalidParams,`Invalid params for notification ${e}: ${r.error}`);await o(r.data,i)})}removeNotificationHandler(e){this._notificationHandlers.delete(e)}};function td(e){return null!==e&&"object"==typeof e&&!Array.isArray(e)}function tp(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}function th(e){throw new T(O.SendFailed,`ctx.mcpReq.${e} is not available while fulfilling an embedded input request: the request is fulfilled locally and has no related peer request`)}async function tm(e,t,o,i,r){var n;if(!tp(i)||"string"!=typeof i.method)throw new T(O.InvalidResult,`Invalid input request '${o}': each inputRequests entry must be an embedded request object with a method`,{key:o});let a=i.method;if(!t.hasInputRequestMethod(a))throw new T(O.InvalidResult,`Invalid input request '${o}': '${a}' is not an embedded request the ${t.era} revision defines (expected elicitation/create, sampling/createMessage, or roots/list)`,{key:o,method:a});let s=e.getRequestHandler(a);if(void 0===s)throw new T(O.CapabilityNotSupported,`Cannot fulfil input request '${o}': no handler is registered for '${a}' on this client. Declare the corresponding capability and register a handler, or handle input_required results manually.`,{key:o,method:a});let l=tp(i.params)?i.params:void 0;return await s({jsonrpc:"2.0",id:o,method:a,...void 0!==l&&{params:l}},e.buildContext({sessionId:e.sessionId,mcpReq:{id:o,method:a,_meta:l?._meta,requestState:(n=void 0,()=>n),signal:r,send:()=>th("send"),notify:()=>th("notify")}}))}var tf=((e,t,o)=>{if(t&&"object"==typeof t||"function"==typeof t)for(var i,r=y(t),n=0,a=r.length;n<a;n++)i=r[n],b.call(e,i)||void 0===i||v(e,i,{get:(e=>t[e]).bind(null,i),enumerable:!(o=_(t,i))||o.enumerable});return e})(v(null!=(d=(c=e=>{var t=/; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g,o=/\\([\u000b\u0020-\u00ff])/g,i=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;function r(e){this.parameters=Object.create(null),this.type=e}e.parse=function(e){if(!e)throw TypeError("argument string is required");var n,a,s,l="object"==typeof e?function(e){var t;if("function"==typeof e.getHeader?t=e.getHeader("content-type"):"object"==typeof e.headers&&(t=e.headers&&e.headers["content-type"]),"string"!=typeof t)throw TypeError("content-type header is missing from object");return t}(e):e;if("string"!=typeof l)throw TypeError("argument string is required to be a string");var c=l.indexOf(";"),u=-1!==c?l.slice(0,c).trim():l.trim();if(!i.test(u))throw TypeError("invalid media type");var d=new r(u.toLowerCase());if(-1!==c){for(t.lastIndex=c;a=t.exec(l);){if(a.index!==c)throw TypeError("invalid parameter format");c+=a[0].length,n=a[1].toLowerCase(),34===(s=a[2]).charCodeAt(0)&&-1!==(s=s.slice(1,-1)).indexOf("\\")&&(s=s.replace(o,"$1")),d.parameters[n]=s}if(c!==l.length)throw TypeError("invalid parameter format")}return d}},()=>(u||c((u={exports:{}}).exports),u.exports))())?g(S(d)):{},"default",{value:d,enumerable:!0}),d);function tg(e){return e?e instanceof Headers?Object.fromEntries(e.entries()):Array.isArray(e)?Object.fromEntries(e):{...e}:{}}function tv(e,t){let o=typeof e;if(o!==typeof t)return!1;if(Array.isArray(e)){if(!Array.isArray(t))return!1;let o=e.length;if(o!==t.length)return!1;for(let i=0;i<o;i++)if(!tv(e[i],t[i]))return!1;return!0}if("object"===o){if(!e||!t)return e===t;let o=Object.keys(e),i=Object.keys(t);if(o.length!==i.length)return!1;for(let i of o)if(!tv(e[i],t[i]))return!1;return!0}return e===t}function t_(e){return encodeURI(e.replace(/~/g,"~0").replace(/\//g,"~1"))}let ty={prefixItems:!0,items:!0,allOf:!0,anyOf:!0,oneOf:!0},tS={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependentSchemas:!0},tb={id:!0,$id:!0,$ref:!0,$schema:!0,$anchor:!0,$vocabulary:!0,$comment:!0,default:!0,enum:!0,const:!0,required:!0,type:!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},tk="u">typeof self&&self.location&&"null"!==self.location.origin?new URL(self.location.origin+self.location.pathname+location.search):new URL("https://github.com/cfworker");function tP(e,t=Object.create(null),o=tk,i=""){if(e&&"object"==typeof e&&!Array.isArray(e)){let r=e.$id||e.id;if(r){let n=new URL(r,o.href);n.hash.length>1?t[n.href]=e:(n.hash="",""===i?o=n:tP(e,t,o))}}else if(!0!==e&&!1!==e)return t;let r=o.href+(i?"#"+i:"");if(void 0!==t[r])throw Error(`Duplicate schema URI "${r}".`);if(t[r]=e,!0===e||!1===e)return t;if(void 0===e.__absolute_uri__&&Object.defineProperty(e,"__absolute_uri__",{enumerable:!1,value:r}),e.$ref&&void 0===e.__absolute_ref__){let t=new URL(e.$ref,o.href);t.hash=t.hash,Object.defineProperty(e,"__absolute_ref__",{enumerable:!1,value:t.href})}if(e.$recursiveRef&&void 0===e.__absolute_recursive_ref__){let t=new URL(e.$recursiveRef,o.href);t.hash=t.hash,Object.defineProperty(e,"__absolute_recursive_ref__",{enumerable:!1,value:t.href})}for(let r in e.$anchor&&(t[new URL("#"+e.$anchor,o.href).href]=e),e){if(tb[r])continue;let n=`${i}/${t_(r)}`,a=e[r];if(Array.isArray(a)){if(ty[r]){let e=a.length;for(let i=0;i<e;i++)tP(a[i],t,o,`${n}/${i}`)}}else if(tS[r])for(let e in a)tP(a[e],t,o,`${n}/${t_(e)}`);else tP(a,t,o,n)}return t}let tw=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,tz=[0,31,28,31,30,31,30,31,31,30,31,30,31],tR=/^(\d\d):(\d\d):(\d\d)(\.\d+)?(z|[+-]\d\d(?::?\d\d)?)?$/i;function tI(e){return e.test.bind(e)}let tj={date:tx,time:tC.bind(void 0,!1),"date-time":function(e){let t=e.split(tq);return 2==t.length&&tx(t[0])&&tC(!0,t[1])},duration:e=>e.length>1&&e.length<80&&(/^P\d+([.,]\d+)?W$/.test(e)||/^P[\dYMDTHS]*(\d[.,]\d+)?[YMDHS]$/.test(e)&&/^P([.,\d]+Y)?([.,\d]+M)?([.,\d]+D)?(T([.,\d]+H)?([.,\d]+M)?([.,\d]+S)?)?$/.test(e)),uri:function(e){return tY.test(e)&&tO.test(e)},"uri-reference":tI(/^(?:[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":tI(/^(?:(?:[^\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:tI(/^(?:(?:https?|ftp):\/\/)(?:\S+(?::\S*)?@)?(?:(?!10(?:\.\d{1,3}){3})(?!127(?:\.\d{1,3}){3})(?!169\.254(?:\.\d{1,3}){2})(?!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-z\u{00a1}-\u{ffff}0-9]+-?)*[a-z\u{00a1}-\u{ffff}0-9]+)(?:\.(?:[a-z\u{00a1}-\u{ffff}0-9]+-?)*[a-z\u{00a1}-\u{ffff}0-9]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu),email:e=>{if('"'===e[0])return!1;let[t,o,...i]=e.split("@");return!(!t||!o||0!==i.length||t.length>64||o.length>253||"."===t[0]||t.endsWith(".")||t.includes(".."))&&!!/^[a-z0-9.-]+$/i.test(o)&&!!/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+$/i.test(t)&&o.split(".").every(e=>/^[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?$/i.test(e))},hostname:tI(/^(?=.{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:tI(/^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/),ipv6:tI(/^((([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:function(e){if(tT.test(e))return!1;try{return RegExp(e,"u"),!0}catch(e){return!1}},uuid:tI(/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i),"json-pointer":tI(/^(?:\/(?:[^~/]|~0|~1)*)*$/),"json-pointer-uri-fragment":tI(/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i),"relative-json-pointer":tI(/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/)};function tx(e){var t;let o=e.match(tw);if(!o)return!1;let i=+o[1],r=+o[2],n=+o[3];return r>=1&&r<=12&&n>=1&&n<=(2==r&&(t=i)%4==0&&(t%100!=0||t%400==0)?29:tz[r])}function tC(e,t){let o=t.match(tR);if(!o)return!1;let i=+o[1],r=+o[2],n=+o[3],a=!!o[5];return(i<=23&&r<=59&&n<=59||23==i&&59==r&&60==n)&&(!e||a)}let tq=/t|\s/i,tY=/\/|:/,tO=/^(?:[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,tT=/[^\\]\\Z/;var t$=class{schema;draft;shortCircuit;lookup;constructor(e,t="2019-09",o=!0){this.schema=e,this.draft=t,this.shortCircuit=o,this.lookup=tP(e)}validate(e){return function e(t,o,i="2019-09",r=tP(o),n=!0,a=null,s="#",l="#",c=Object.create(null)){let u;if(!0===o)return{valid:!0,errors:[]};if(!1===o)return{valid:!1,errors:[{instanceLocation:s,keyword:"false",keywordLocation:s,error:"False boolean schema."}]};let d=typeof t;switch(d){case"boolean":case"number":case"string":u=d;break;case"object":u=null===t?"null":Array.isArray(t)?"array":"object";break;default:throw Error(`Instances of "${d}" type are not supported.`)}let{$ref:p,$recursiveRef:h,$recursiveAnchor:m,type:f,const:g,enum:v,required:_,not:y,anyOf:S,allOf:b,oneOf:k,if:P,then:w,else:z,format:R,properties:I,patternProperties:j,additionalProperties:x,unevaluatedProperties:C,minProperties:q,maxProperties:Y,propertyNames:O,dependentRequired:T,dependentSchemas:$,dependencies:E,prefixItems:M,items:L,additionalItems:N,unevaluatedItems:A,contains:U,minContains:H,maxContains:Z,minItems:V,maxItems:J,uniqueItems:D,minimum:F,maximum:K,exclusiveMinimum:B,exclusiveMaximum:W,multipleOf:G,minLength:X,maxLength:Q,pattern:ee,__absolute_ref__:et,__absolute_recursive_ref__:eo}=o,ei=[];if(!0===m&&null===a&&(a=o),"#"===h){let u=null===a?r[eo]:a,d=`${l}/$recursiveRef`,p=e(t,null===a?o:a,i,r,n,u,s,d,c);p.valid||ei.push({instanceLocation:s,keyword:"$recursiveRef",keywordLocation:d,error:"A subschema had errors."},...p.errors)}if(void 0!==p){let o=r[et||p];if(void 0===o){let e=`Unresolved $ref "${p}".`;throw et&&et!==p&&(e+=` Absolute URI "${et}".`),Error(e+=`
|
|
2
|
+
Known schemas:
|
|
3
|
+
- ${Object.keys(r).join("\n- ")}`)}let u=`${l}/$ref`,d=e(t,o,i,r,n,a,s,u,c);if(d.valid||ei.push({instanceLocation:s,keyword:"$ref",keywordLocation:u,error:"A subschema had errors."},...d.errors),"4"===i||"7"===i)return{valid:0===ei.length,errors:ei}}if(Array.isArray(f)){let e=f.length,o=!1;for(let i=0;i<e;i++)if(u===f[i]||"integer"===f[i]&&"number"===u&&t%1==0&&t==t){o=!0;break}o||ei.push({instanceLocation:s,keyword:"type",keywordLocation:`${l}/type`,error:`Instance type "${u}" is invalid. Expected "${f.join('", "')}".`})}else"integer"===f?("number"!==u||t%1||t!=t)&&ei.push({instanceLocation:s,keyword:"type",keywordLocation:`${l}/type`,error:`Instance type "${u}" is invalid. Expected "${f}".`}):void 0!==f&&u!==f&&ei.push({instanceLocation:s,keyword:"type",keywordLocation:`${l}/type`,error:`Instance type "${u}" is invalid. Expected "${f}".`});if(void 0!==g&&("object"===u||"array"===u?tv(t,g)||ei.push({instanceLocation:s,keyword:"const",keywordLocation:`${l}/const`,error:`Instance does not match ${JSON.stringify(g)}.`}):t!==g&&ei.push({instanceLocation:s,keyword:"const",keywordLocation:`${l}/const`,error:`Instance does not match ${JSON.stringify(g)}.`})),void 0!==v&&("object"===u||"array"===u?v.some(e=>tv(t,e))||ei.push({instanceLocation:s,keyword:"enum",keywordLocation:`${l}/enum`,error:`Instance does not match any of ${JSON.stringify(v)}.`}):v.some(e=>t===e)||ei.push({instanceLocation:s,keyword:"enum",keywordLocation:`${l}/enum`,error:`Instance does not match any of ${JSON.stringify(v)}.`})),void 0!==y){let o=`${l}/not`;e(t,y,i,r,n,a,s,o).valid&&ei.push({instanceLocation:s,keyword:"not",keywordLocation:o,error:'Instance matched "not" schema.'})}let er=[];if(void 0!==S){let o=`${l}/anyOf`,u=ei.length,d=!1;for(let l=0;l<S.length;l++){let u=S[l],p=Object.create(c),h=e(t,u,i,r,n,!0===m?a:null,s,`${o}/${l}`,p);ei.push(...h.errors),d=d||h.valid,h.valid&&er.push(p)}d?ei.length=u:ei.splice(u,0,{instanceLocation:s,keyword:"anyOf",keywordLocation:o,error:"Instance does not match any subschemas."})}if(void 0!==b){let o=`${l}/allOf`,u=ei.length,d=!0;for(let l=0;l<b.length;l++){let u=b[l],p=Object.create(c),h=e(t,u,i,r,n,!0===m?a:null,s,`${o}/${l}`,p);ei.push(...h.errors),d=d&&h.valid,h.valid&&er.push(p)}d?ei.length=u:ei.splice(u,0,{instanceLocation:s,keyword:"allOf",keywordLocation:o,error:"Instance does not match every subschema."})}if(void 0!==k){let o=`${l}/oneOf`,u=ei.length,d=k.filter((l,u)=>{let d=Object.create(c),p=e(t,l,i,r,n,!0===m?a:null,s,`${o}/${u}`,d);return ei.push(...p.errors),p.valid&&er.push(d),p.valid}).length;1===d?ei.length=u:ei.splice(u,0,{instanceLocation:s,keyword:"oneOf",keywordLocation:o,error:`Instance does not match exactly one subschema (${d} matches).`})}if(("object"===u||"array"===u)&&Object.assign(c,...er),void 0!==P){let o=`${l}/if`;if(e(t,P,i,r,n,a,s,o,c).valid){if(void 0!==w){let u=e(t,w,i,r,n,a,s,`${l}/then`,c);u.valid||ei.push({instanceLocation:s,keyword:"if",keywordLocation:o,error:'Instance does not match "then" schema.'},...u.errors)}}else if(void 0!==z){let u=e(t,z,i,r,n,a,s,`${l}/else`,c);u.valid||ei.push({instanceLocation:s,keyword:"if",keywordLocation:o,error:'Instance does not match "else" schema.'},...u.errors)}}if("object"===u){if(void 0!==_)for(let e of _)e in t||ei.push({instanceLocation:s,keyword:"required",keywordLocation:`${l}/required`,error:`Instance does not have required property "${e}".`});let o=Object.keys(t);if(void 0!==q&&o.length<q&&ei.push({instanceLocation:s,keyword:"minProperties",keywordLocation:`${l}/minProperties`,error:`Instance does not have at least ${q} properties.`}),void 0!==Y&&o.length>Y&&ei.push({instanceLocation:s,keyword:"maxProperties",keywordLocation:`${l}/maxProperties`,error:`Instance does not have at least ${Y} properties.`}),void 0!==O){let o=`${l}/propertyNames`;for(let l in t){let t=`${s}/${t_(l)}`,c=e(l,O,i,r,n,a,t,o);c.valid||ei.push({instanceLocation:s,keyword:"propertyNames",keywordLocation:o,error:`Property name "${l}" does not match schema.`},...c.errors)}}if(void 0!==T){let e=`${l}/dependantRequired`;for(let o in T)if(o in t)for(let i of T[o])i in t||ei.push({instanceLocation:s,keyword:"dependentRequired",keywordLocation:e,error:`Instance has "${o}" but does not have "${i}".`})}if(void 0!==$)for(let o in $){let u=`${l}/dependentSchemas`;if(o in t){let l=e(t,$[o],i,r,n,a,s,`${u}/${t_(o)}`,c);l.valid||ei.push({instanceLocation:s,keyword:"dependentSchemas",keywordLocation:u,error:`Instance has "${o}" but does not match dependant schema.`},...l.errors)}}if(void 0!==E){let o=`${l}/dependencies`;for(let l in E)if(l in t){let c=E[l];if(Array.isArray(c))for(let e of c)e in t||ei.push({instanceLocation:s,keyword:"dependencies",keywordLocation:o,error:`Instance has "${l}" but does not have "${e}".`});else{let u=e(t,c,i,r,n,a,s,`${o}/${t_(l)}`);u.valid||ei.push({instanceLocation:s,keyword:"dependencies",keywordLocation:o,error:`Instance has "${l}" but does not match dependant schema.`},...u.errors)}}}let u=Object.create(null),d=!1;if(void 0!==I){let o=`${l}/properties`;for(let l in I){if(!(l in t))continue;let p=`${s}/${t_(l)}`,h=e(t[l],I[l],i,r,n,a,p,`${o}/${t_(l)}`);if(h.valid)c[l]=u[l]=!0;else if(d=n,ei.push({instanceLocation:s,keyword:"properties",keywordLocation:o,error:`Property "${l}" does not match schema.`},...h.errors),d)break}}if(!d&&void 0!==j){let o=`${l}/patternProperties`;for(let l in j){let p=RegExp(l,"u"),h=j[l];for(let m in t){if(!p.test(m))continue;let f=`${s}/${t_(m)}`,g=e(t[m],h,i,r,n,a,f,`${o}/${t_(l)}`);g.valid?c[m]=u[m]=!0:(d=n,ei.push({instanceLocation:s,keyword:"patternProperties",keywordLocation:o,error:`Property "${m}" matches pattern "${l}" but does not match associated schema.`},...g.errors))}}}if(d||void 0===x){if(!d&&void 0!==C){let o=`${l}/unevaluatedProperties`;for(let l in t)if(!c[l]){let u=`${s}/${t_(l)}`,d=e(t[l],C,i,r,n,a,u,o);d.valid?c[l]=!0:ei.push({instanceLocation:s,keyword:"unevaluatedProperties",keywordLocation:o,error:`Property "${l}" does not match unevaluated properties schema.`},...d.errors)}}}else{let o=`${l}/additionalProperties`;for(let l in t){if(u[l])continue;let p=`${s}/${t_(l)}`,h=e(t[l],x,i,r,n,a,p,o);h.valid?c[l]=!0:(d=n,ei.push({instanceLocation:s,keyword:"additionalProperties",keywordLocation:o,error:`Property "${l}" does not match additional properties schema.`},...h.errors))}}}else if("array"===u){void 0!==J&&t.length>J&&ei.push({instanceLocation:s,keyword:"maxItems",keywordLocation:`${l}/maxItems`,error:`Array has too many items (${t.length} > ${J}).`}),void 0!==V&&t.length<V&&ei.push({instanceLocation:s,keyword:"minItems",keywordLocation:`${l}/minItems`,error:`Array has too few items (${t.length} < ${V}).`});let o=t.length,u=0,d=!1;if(void 0!==M){let p=`${l}/prefixItems`,h=Math.min(M.length,o);for(;u<h;u++){let o=e(t[u],M[u],i,r,n,a,`${s}/${u}`,`${p}/${u}`);if(c[u]=!0,!o.valid&&(d=n,ei.push({instanceLocation:s,keyword:"prefixItems",keywordLocation:p,error:"Items did not match schema."},...o.errors),d))break}}if(void 0!==L){let p=`${l}/items`;if(Array.isArray(L)){let l=Math.min(L.length,o);for(;u<l;u++){let o=e(t[u],L[u],i,r,n,a,`${s}/${u}`,`${p}/${u}`);if(c[u]=!0,!o.valid&&(d=n,ei.push({instanceLocation:s,keyword:"items",keywordLocation:p,error:"Items did not match schema."},...o.errors),d))break}}else for(;u<o;u++){let o=e(t[u],L,i,r,n,a,`${s}/${u}`,p);if(c[u]=!0,!o.valid&&(d=n,ei.push({instanceLocation:s,keyword:"items",keywordLocation:p,error:"Items did not match schema."},...o.errors),d))break}if(!d&&void 0!==N){let p=`${l}/additionalItems`;for(;u<o;u++){let o=e(t[u],N,i,r,n,a,`${s}/${u}`,p);c[u]=!0,o.valid||(d=n,ei.push({instanceLocation:s,keyword:"additionalItems",keywordLocation:p,error:"Items did not match additional items schema."},...o.errors))}}}if(void 0!==U)if(0===o&&void 0===H)ei.push({instanceLocation:s,keyword:"contains",keywordLocation:`${l}/contains`,error:"Array is empty. It must contain at least one item matching the schema."});else if(void 0!==H&&o<H)ei.push({instanceLocation:s,keyword:"minContains",keywordLocation:`${l}/minContains`,error:`Array has less items (${o}) than minContains (${H}).`});else{let u=`${l}/contains`,d=ei.length,p=0;for(let l=0;l<o;l++){let o=e(t[l],U,i,r,n,a,`${s}/${l}`,u);o.valid?(c[l]=!0,p++):ei.push(...o.errors)}p>=(H||0)&&(ei.length=d),void 0===H&&void 0===Z&&0===p?ei.splice(d,0,{instanceLocation:s,keyword:"contains",keywordLocation:u,error:"Array does not contain item matching schema."}):void 0!==H&&p<H?ei.push({instanceLocation:s,keyword:"minContains",keywordLocation:`${l}/minContains`,error:`Array must contain at least ${H} items matching schema. Only ${p} items were found.`}):void 0!==Z&&p>Z&&ei.push({instanceLocation:s,keyword:"maxContains",keywordLocation:`${l}/maxContains`,error:`Array may contain at most ${Z} items matching schema. ${p} items were found.`})}if(!d&&void 0!==A){let d=`${l}/unevaluatedItems`;for(;u<o;u++){if(c[u])continue;let o=e(t[u],A,i,r,n,a,`${s}/${u}`,d);c[u]=!0,o.valid||ei.push({instanceLocation:s,keyword:"unevaluatedItems",keywordLocation:d,error:"Items did not match unevaluated items schema."},...o.errors)}}if(D)for(let e=0;e<o;e++){let i=t[e],r="object"==typeof i&&null!==i;for(let n=0;n<o;n++){if(e===n)continue;let o=t[n];(i===o||r&&"object"==typeof o&&null!==o&&tv(i,o))&&(ei.push({instanceLocation:s,keyword:"uniqueItems",keywordLocation:`${l}/uniqueItems`,error:`Duplicate items at indexes ${e} and ${n}.`}),e=Number.MAX_SAFE_INTEGER,n=Number.MAX_SAFE_INTEGER)}}}else if("number"===u){if("4"===i?(void 0!==F&&(!0===B&&t<=F||t<F)&&ei.push({instanceLocation:s,keyword:"minimum",keywordLocation:`${l}/minimum`,error:`${t} is less than ${B?"or equal to ":""} ${F}.`}),void 0!==K&&(!0===W&&t>=K||t>K)&&ei.push({instanceLocation:s,keyword:"maximum",keywordLocation:`${l}/maximum`,error:`${t} is greater than ${W?"or equal to ":""} ${K}.`})):(void 0!==F&&t<F&&ei.push({instanceLocation:s,keyword:"minimum",keywordLocation:`${l}/minimum`,error:`${t} is less than ${F}.`}),void 0!==K&&t>K&&ei.push({instanceLocation:s,keyword:"maximum",keywordLocation:`${l}/maximum`,error:`${t} is greater than ${K}.`}),void 0!==B&&t<=B&&ei.push({instanceLocation:s,keyword:"exclusiveMinimum",keywordLocation:`${l}/exclusiveMinimum`,error:`${t} is less than ${B}.`}),void 0!==W&&t>=W&&ei.push({instanceLocation:s,keyword:"exclusiveMaximum",keywordLocation:`${l}/exclusiveMaximum`,error:`${t} is greater than or equal to ${W}.`})),void 0!==G){let e=t%G;Math.abs(0-e)>=11920929e-14&&Math.abs(G-e)>=11920929e-14&&ei.push({instanceLocation:s,keyword:"multipleOf",keywordLocation:`${l}/multipleOf`,error:`${t} is not a multiple of ${G}.`})}}else if("string"===u){let e=void 0===X&&void 0===Q?0:function(e){let t,o=0,i=e.length,r=0;for(;r<i;)o++,(t=e.charCodeAt(r++))>=55296&&t<=56319&&r<i&&(64512&(t=e.charCodeAt(r)))==56320&&r++;return o}(t);void 0!==X&&e<X&&ei.push({instanceLocation:s,keyword:"minLength",keywordLocation:`${l}/minLength`,error:`String is too short (${e} < ${X}).`}),void 0!==Q&&e>Q&&ei.push({instanceLocation:s,keyword:"maxLength",keywordLocation:`${l}/maxLength`,error:`String is too long (${e} > ${Q}).`}),void 0===ee||RegExp(ee,"u").test(t)||ei.push({instanceLocation:s,keyword:"pattern",keywordLocation:`${l}/pattern`,error:"String does not match pattern."}),void 0!==R&&tj[R]&&!tj[R](t)&&ei.push({instanceLocation:s,keyword:"format",keywordLocation:`${l}/format`,error:`String does not match format "${R}".`})}return{valid:0===ei.length,errors:ei}}(e,this.schema,this.draft,this.lookup,this.shortCircuit)}addSchema(e,t){t&&(e={...e,$id:t}),tP(e,this.lookup)}},tE=class{shortcircuit;draft;constructor(e){this.shortcircuit=e?.shortcircuit??!0,this.draft=e?.draft}_draftFor(e){let t=function(e,t){if(!("$schema"in e)||"string"!=typeof e.$schema)return"2020-12";let o=e.$schema.replace(/#$/,"");if(k.has(o))return"2020-12";if(P.has(o))return"2019-09";if(w.has(o)||z.has(o))return"draft-7";throw Error(`JSON Schema declares an unsupported dialect ("$schema": "${e.$schema.slice(0,200)}"). The default validator supports JSON Schema 2020-12, 2019-09, draft-07, and draft-06; ${t}`)}(e,"pass an explicit { draft } to CfWorkerJsonSchemaValidator to validate other dialects.");return"draft-7"===t?"7":t}getValidator(e){let t=new t$(e,this.draft??this._draftFor(e),this.shortcircuit);return e=>{let o=t.validate(e);return o.valid?{valid:!0,data:e,errorMessage:void 0}:{valid:!1,data:void 0,errorMessage:o.errors.map(e=>`${e.instanceLocation}: ${e.error}`).join("; ")}}}};async function tM(e){return(await l).getRandomValues(new Uint8Array(e))}async function tL(e){let t="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-._~",o=256-256%t.length,i="";for(;i.length<e;)for(let r of(await tM(e-i.length)))r<o&&(i+=t[r%t.length]);return i}async function tN(e){return await tL(e)}async function tA(e){return btoa(String.fromCharCode(...new Uint8Array(await (await l).subtle.digest("SHA-256",new TextEncoder().encode(e))))).replace(/\//g,"_").replace(/\+/g,"-").replace(/=/g,"")}async function tU(e){if(e||(e=43),e<43||e>128)throw`Expected a length between 43 and 128. Received ${e}.`;let t=await tN(e),o=await tA(t);return{code_verifier:t,code_challenge:o}}l=globalThis.crypto;class tH extends Error{constructor(e,t){super(e),this.name="ParseError",this.type=t.type,this.field=t.field,this.value=t.value,this.line=t.line}}function tZ(e){}function tV(e,t,o){return 100===o&&97===e.charCodeAt(t+1)&&116===e.charCodeAt(t+2)&&97===e.charCodeAt(t+3)&&58===e.charCodeAt(t+4)}function tJ(e,t,o){return 101===o&&118===e.charCodeAt(t+1)&&101===e.charCodeAt(t+2)&&110===e.charCodeAt(t+3)&&116===e.charCodeAt(t+4)&&58===e.charCodeAt(t+5)}class tD extends TransformStream{constructor({onError:e,onRetry:t,onComment:o,maxBufferSize:i}={}){let r;super({start(n){r=function(e){if("function"==typeof e)throw TypeError("`config` must be an object, got a function instead. Did you mean `createParser({onEvent: fn})`?");let{onEvent:t=tZ,onError:o=tZ,onRetry:i=tZ,onComment:r,maxBufferSize:n}=e,a=[],s=0,l=!0,c,u="",d=0,p,h=!1;function m(){void 0!==n&&(s+u.length<=n||(h=!0,a.length=0,s=0,c=void 0,u="",d=0,p=void 0,o(new tH(`Buffered data exceeded max buffer size of ${n} characters`,{type:"max-buffer-size-exceeded"}))))}function f(e){let o=0;if(-1===e.indexOf("\r")){let i=e.indexOf(`
|
|
4
|
+
`,o);for(;-1!==i;){if(o===i){d>0&&t({id:c,event:p,data:u}),c=void 0,u="",d=0,p=void 0,o=i+1,i=e.indexOf(`
|
|
5
|
+
`,o);continue}let r=e.charCodeAt(o);if(tV(e,o,r)){let r=32===e.charCodeAt(o+5)?o+6:o+5,n=e.slice(r,i);if(0===d&&10===e.charCodeAt(i+1)){t({id:c,event:p,data:n}),c=void 0,u="",p=void 0,o=i+2,i=e.indexOf(`
|
|
6
|
+
`,o);continue}u=0===d?n:`${u}
|
|
7
|
+
${n}`,d++}else tJ(e,o,r)?p=e.slice(32===e.charCodeAt(o+6)?o+7:o+6,i)||void 0:g(e,o,i);o=i+1,i=e.indexOf(`
|
|
8
|
+
`,o)}return e.slice(o)}for(;o<e.length;){let t=e.indexOf("\r",o),i=e.indexOf(`
|
|
9
|
+
`,o),r=-1;if(-1!==t&&-1!==i?r=t<i?t:i:-1!==t?r=t===e.length-1?-1:t:-1!==i&&(r=i),-1===r)break;g(e,o,r),o=r+1,13===e.charCodeAt(o-1)&&10===e.charCodeAt(o)&&o++}return e.slice(o)}function g(e,o,i){if(o===i)return void(d>0&&t({id:c,event:p,data:u}),c=void 0,u="",d=0,p=void 0);let n=e.charCodeAt(o);if(tV(e,o,n)){let t=32===e.charCodeAt(o+5)?o+6:o+5,r=e.slice(t,i);u=0===d?r:`${u}
|
|
10
|
+
${r}`,d++;return}if(tJ(e,o,n)){p=e.slice(32===e.charCodeAt(o+6)?o+7:o+6,i)||void 0;return}if(105===n&&100===e.charCodeAt(o+1)&&58===e.charCodeAt(o+2)){let t=e.slice(32===e.charCodeAt(o+3)?o+4:o+3,i);t.includes("\0")||(c=t);return}if(58===n){r&&r(e.slice(o,i).slice(32===e.charCodeAt(o+1)?2:1));return}let a=e.slice(o,i),s=a.indexOf(":");if(-1===s)return void v(a,"",a);let l=a.slice(0,s),h=32===a.charCodeAt(s+1)?2:1;v(l,a.slice(s+h),a)}function v(e,t,r){switch(e){case"event":p=t||void 0;break;case"data":u=0===d?t:`${u}
|
|
11
|
+
${t}`,d++;break;case"id":t.includes("\0")||(c=t);break;case"retry":/^\d+$/.test(t)?i(parseInt(t,10)):o(new tH(`Invalid \`retry\` value: "${t}"`,{type:"invalid-retry",value:t,line:r}));break;default:o(new tH(`Unknown field "${e.length>20?`${e.slice(0,20)}…`:e}"`,{type:"unknown-field",field:e,value:t,line:r}))}}return{feed:function(e){if(h)throw Error("Cannot feed parser: it was terminated after exceeding the configured max buffer size. Call `reset()` to resume parsing.");if(l&&(l=!1,239===e.charCodeAt(0)&&187===e.charCodeAt(1)&&191===e.charCodeAt(2)&&(e=e.slice(3))),0===a.length){let t=f(e);""!==t&&(a.push(t),s=t.length),m();return}if(-1===e.indexOf(`
|
|
12
|
+
`)&&-1===e.indexOf("\r")){a.push(e),s+=e.length,m();return}a.push(e);let t=a.join("");a.length=0,s=0;let o=f(t);""!==o&&(a.push(o),s=o.length),m()},reset:function(e={}){if(e.consume&&a.length>0){let e=a.join("");g(e,0,e.length)}l=!0,c=void 0,u="",d=0,p=void 0,a.length=0,s=0,h=!1}}}({onEvent:e=>{n.enqueue(e)},onError(t){"function"==typeof e&&e(t),("terminate"===e||"max-buffer-size-exceeded"===t.type)&&n.error(t)},onRetry:t,onComment:o,maxBufferSize:i})},transform(e){r.feed(e)}})}}var tF=class extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.OAuthClientFlowError"})}static[Symbol.hasInstance](e){return C(this,e)}static isInstance(e){if("function"!=typeof this)throw TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return C(this,e)}constructor(e){super(e),this.name=new.target.name,x(this,new.target)}},tK=class extends tF{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.IssuerMismatchError"})}kind;expected;received;constructor(e,t,o){super(`Issuer mismatch in ${"metadata"===e?"authorization server metadata (RFC 8414 \xa73.3)":"authorization response (RFC 9207)"}: expected ${JSON.stringify(t)}, received ${JSON.stringify(o)}`),this.kind=e,this.expected=t,this.received=o}},tB=class extends tF{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.RegistrationRejectedError"})}status;body;submittedMetadata;constructor(e){super(`Dynamic Client Registration rejected (HTTP ${e.status}): ${e.body}`),this.status=e.status,this.body=e.body,this.submittedMetadata=e.submittedMetadata}},tW=class extends tF{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.InsecureTokenEndpointError"})}tokenEndpoint;constructor(e){super(`Refusing to send credentials to non-https token endpoint '${e}'. OAuth token requests MUST use TLS (localhost / 127.0.0.1 / ::1 are exempt).`),this.tokenEndpoint=e}},tG=class extends tF{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.AuthorizationServerMismatchError"})}constructor(e,t){super(`Authorization server changed between redirect and callback (redirected to ${JSON.stringify(e)}, callback resolved ${JSON.stringify(t)}); refusing to send authorization_code/code_verifier to a different token endpoint`),this.recordedIssuer=e,this.currentIssuer=t}},tX=class extends tF{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.InsufficientScopeError"})}requiredScope;resourceMetadataUrl;errorDescription;constructor(e){super(`Insufficient scope${e.requiredScope?`: required "${e.requiredScope}"`:""}`),this.requiredScope=e.requiredScope,this.resourceMetadataUrl=e.resourceMetadataUrl,this.errorDescription=e.errorDescription}};function tQ(e,t,o){if(void 0!==e)return void 0===e.issuer?(o?.canPersistStamp!==!1&&console.warn("[mcp-sdk] SEP-2352: stored OAuth credential has no 'issuer' stamp (pre-upgrade storage or provider not round-tripping the value). SEP-2352 isolation is inactive for this read; ensure your provider round-trips the issuer field."),e):t0(e.issuer,t)?e:void 0}function t0(e,t){return e===t||e.endsWith("/")&&e.slice(0,-1)===t||t.endsWith("/")&&t.slice(0,-1)===e}async function t1(e,t,o){let{resourceMetadataUrl:i,scope:r}=or(t.response);if(await ot(e,{serverUrl:t.serverUrl,resourceMetadataUrl:i,scope:r,fetchFn:t.fetchFn,...o})!=="AUTHORIZED")throw new t2}var t2=class extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.UnauthorizedError"})}static[Symbol.hasInstance](e){return C(this,e)}static isInstance(e){if("function"!=typeof this)throw TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return C(this,e)}constructor(e){super(e??"Unauthorized"),this.name="UnauthorizedError",x(this,new.target)}};function t9(e){return e?.authorization_response_iss_parameter_supported===!0}function t4({iss:e,expectedIssuer:t,issParameterSupported:o}){if(void 0!==t){if(void 0===e){if(o)throw new tK("authorization_response",t,void 0);return}if(e!==t)throw new tK("authorization_response",t,e)}}function t5(...e){let t=new Set;for(let o of e)if(o)for(let e of o.split(/\s+/))e&&t.add(e);return t.size>0?[...t].join(" "):void 0}async function t3(e,t,o,i,r){if("string"==typeof e)return{authorizationCode:e,iss:t};let n=e.get("iss")??void 0,a=e.get("code");if(a)return{authorizationCode:a,iss:n};let s=(await o.discoveryState?.())?.authorizationServerMetadata;if(!s)try{s=(await od(i,r)).authorizationServerMetadata}catch{s=void 0}if(!s)throw new t2("Authorization callback failed and the issuer could not be verified");t4({iss:n,expectedIssuer:s.issuer,issParameterSupported:t9(s)});let l=e.get("error");if(l)throw new Y(l,e.get("error_description")??l,e.get("error_uri")??void 0);throw new t2("Authorization callback contained neither `code` nor `error`")}let t6="code",t8="S256";function t7(e){return"localhost"===e||"127.0.0.1"===e||"[::1]"===e||"::1"===e}async function oe(e){let t=e instanceof Response?e.status:void 0,o=e instanceof Response?await e.text():e;try{let e=R.o.parse(JSON.parse(o));return Y.fromResponse(e)}catch(i){let e=`${t?`HTTP ${t}: `:""}Invalid OAuth error response: ${i}. Raw body: ${o}`;return new Y(q.ServerError,e)}}async function ot(e,t){try{return await oo(e,t)}catch(o){if(o instanceof Y){if(o.code===q.InvalidClient||o.code===q.UnauthorizedClient)return await e.invalidateCredentials?.("client"),await e.invalidateCredentials?.("tokens"),await oo(e,t);else if(o.code===q.InvalidGrant)return await e.invalidateCredentials?.("tokens"),await oo(e,t)}throw o}}async function oo(e,{serverUrl:t,authorizationCode:o,iss:i,scope:r,resourceMetadataUrl:n,fetchFn:a,skipIssuerMetadataValidation:s,forceReauthorization:l}){let c,u,d,p,h,m={...h=e.clientMetadata,grant_types:h.grant_types??(void 0===e.redirectUrl?void 0:["authorization_code","refresh_token"]),application_type:h.application_type??function(e){for(let t of e??[]){let e;try{e=new URL(t)}catch{continue}if("http:"!==e.protocol&&"https:"!==e.protocol||t7(e.hostname))return"native"}return"web"}(h.redirect_uris)},f=await e.discoveryState?.(),g=n;if(!g&&f?.resourceMetadataUrl&&(g=new URL(f.resourceMetadataUrl)),f?.authorizationServerUrl){if(u=f.authorizationServerUrl,c=f.resourceMetadata,d=f.authorizationServerMetadata??await ou(u,{fetchFn:a,skipIssuerValidation:s}),!c)try{c=await oa(t,{resourceMetadataUrl:g},a)}catch(e){if(e instanceof TypeError)throw e}(d!==f.authorizationServerMetadata||c!==f.resourceMetadata)&&await e.saveDiscoveryState?.({authorizationServerUrl:String(u),resourceMetadataUrl:g?.toString(),resourceMetadata:c,authorizationServerMetadata:d})}else{let e=await od(t,{resourceMetadataUrl:g,fetchFn:a,skipIssuerMetadataValidation:s});u=e.authorizationServerUrl,d=e.authorizationServerMetadata,c=e.resourceMetadata,p={authorizationServerUrl:String(u),resourceMetadataUrl:g?.toString(),resourceMetadata:c,authorizationServerMetadata:d}}let v=d?.issuer??String(u),_={issuer:v};if(await e.saveAuthorizationServerUrl?.(v),void 0!==o){let t=f?.authorizationServerMetadata?.issuer??f?.authorizationServerUrl;if(void 0===t){if(void 0!==e.saveDiscoveryState)throw new tG("discoveryState was not available on the callback leg; ensure your provider persists discoveryState alongside codeVerifier",v);console.warn("[mcp-sdk] OAuthClientProvider does not implement saveDiscoveryState()/discoveryState(); the SEP-2352 callback-leg authorization-server binding cannot be checked. Implement discoveryState (persist alongside codeVerifier) — see docs/migration/upgrade-to-v2.md \xa7SEP-2352.")}else if(!t0(t,v))throw new tG(t,v)}p&&await e.saveDiscoveryState?.(p);let y=await oi(t,e,c);y&&await e.saveResourceUrl?.(String(y));let S=function(e){let{requestedScope:t,resourceMetadata:o,authServerMetadata:i,clientMetadata:r}=e,n=t||o?.scopes_supported?.join(" ")||r.scope;return n&&i?.scopes_supported?.includes("offline_access")&&!n.split(" ").includes("offline_access")&&r.grant_types?.includes("refresh_token")&&(n=`${n} offline_access`),n}({requestedScope:r,resourceMetadata:c,authServerMetadata:d,clientMetadata:e.clientMetadata}),b=await Promise.resolve(e.clientInformation(_)),k=tQ(b,v,{canPersistStamp:void 0!==e.saveClientInformation});if(void 0===k&&b?.issuer&&void 0===e.saveClientInformation)throw new tG(b.issuer,v);if(k&&void 0===k.issuer&&(k={...k,issuer:v},await e.saveClientInformation?.(k,_)),!k){if(void 0!==o)throw Error("Existing OAuth client information is required when exchanging an authorization code");let t=d?.client_id_metadata_document_supported===!0,i=e.clientMetadataUrl;if(i&&!function(e){if(!e)return!1;try{let t=new URL(e);return"https:"===t.protocol&&"/"!==t.pathname}catch{return!1}}(i))throw new Y(q.InvalidClientMetadata,`clientMetadataUrl must be a valid HTTPS URL with a non-root pathname, got: ${i}`);if(t&&i)k={client_id:i,issuer:v},await e.saveClientInformation?.(k,_);else{if(!e.saveClientInformation)throw Error("OAuth client information must be saveable for dynamic registration");k={...await og(u,{metadata:d,clientMetadata:m,scope:S,fetchFn:a}),issuer:v},await e.saveClientInformation(k,_)}}let P=!e.redirectUrl;if(void 0!==o||P){void 0!==o&&t4({iss:i,expectedIssuer:d?.issuer,issParameterSupported:t9(d)});let t=await of(e,u,{metadata:d,resource:y,authorizationCode:o,iss:i,scope:S,fetchFn:a});return await e.saveTokens({...t,issuer:v},_),"AUTHORIZED"}let w=tQ(await e.tokens(_),v);if(w&&void 0===w.issuer&&(w={...w,issuer:v},await e.saveTokens(w,_)),w?.refresh_token&&!l)try{let t=await om(u,{metadata:d,clientInformation:k,refreshToken:w.refresh_token,resource:y,addClientAuthentication:e.addClientAuthentication,fetchFn:a});return await e.saveTokens({...t,issuer:v},_),"AUTHORIZED"}catch(e){if(e instanceof tW||e instanceof Y&&e.code!==q.ServerError)throw e}let z=e.state?await e.state():void 0,{authorizationUrl:R,codeVerifier:I}=await op(u,{metadata:d,clientInformation:k,state:z,redirectUrl:e.redirectUrl,scope:S,resource:y});return await e.saveCodeVerifier(I),await e.redirectToAuthorization(R),"REDIRECT"}async function oi(e,t,o){let i,r=((i=new URL("string"==typeof e?e:e.href)).hash="",i);if(t.validateResourceURL)return await t.validateResourceURL(r,o?.resource);if(o){if(!function({requestedResource:e,configuredResource:t}){let o=new URL("string"==typeof e?e:e.href),i=new URL("string"==typeof t?t:t.href);if(o.origin!==i.origin||o.pathname.length<i.pathname.length)return!1;let r=o.pathname.endsWith("/")?o.pathname:o.pathname+"/",n=i.pathname.endsWith("/")?i.pathname:i.pathname+"/";return r.startsWith(n)}({requestedResource:r,configuredResource:o.resource}))throw Error(`Protected resource ${o.resource} does not match expected ${r} (or origin)`);return new URL(o.resource)}}function or(e){let t,o=e.headers.get("WWW-Authenticate");if(!o)return{};let[i,r]=o.split(" ");if(i?.toLowerCase()!=="bearer"||!r)return{};let n=on(e,"resource_metadata")||void 0;if(n)try{t=new URL(n)}catch{}return{resourceMetadataUrl:t,scope:on(e,"scope")||void 0,error:on(e,"error")||void 0,errorDescription:on(e,"error_description")||void 0}}function on(e,t){let o=e.headers.get("WWW-Authenticate");if(!o)return null;let i=new RegExp(String.raw`${t}=(?:"([^"]+)"|([^\s,]+))`),r=o.match(i);if(r){let e=r[1]||r[2];if(e)return e}return null}async function oa(e,t,o=fetch){let i=await oc(e,"oauth-protected-resource",o,{protocolVersion:t?.protocolVersion,metadataUrl:t?.resourceMetadataUrl});if(!i||404===i.status)throw await i?.text?.().catch(()=>{}),Error("Resource server does not implement OAuth 2.0 Protected Resource Metadata.");if(!i.ok)throw await i.text?.().catch(()=>{}),Error(`HTTP ${i.status} trying to load well-known OAuth protected resource metadata.`);return R.c.parse(await i.json())}async function os(e,t,o=fetch){try{return await o(e,{headers:t})}catch(i){if(!(i instanceof TypeError))throw i;if(t)try{return await o(e,{})}catch(e){if(!(e instanceof TypeError))throw e}return}}async function ol(e,t,o=fetch){return await os(e,{"MCP-Protocol-Version":t},o)}async function oc(e,t,o,i){var r,n;let a,s=new URL(e),l=i?.protocolVersion??R.Dr;i?.metadataUrl?a=new URL(i.metadataUrl):(a=new URL(function(e,t="",o={}){return t.endsWith("/")&&(t=t.slice(0,-1)),o.prependPathname?`${t}/.well-known/${e}`:`/.well-known/${e}${t}`}(t,s.pathname),i?.metadataServerUrl??s)).search=s.search;let c=await ol(a,l,o);return!i?.metadataUrl&&(r=c,n=s.pathname,!r||"/"!==n&&(r.status>=400&&r.status<500||502===r.status))&&(c=await ol(new URL(`/.well-known/${t}`,s),l,o)),c}async function ou(e,{fetchFn:t=fetch,protocolVersion:o=R.Dr,skipIssuerValidation:i=!1}={}){let r={"MCP-Protocol-Version":o,Accept:"application/json"};for(let{url:o,type:n}of function(e){let t="string"==typeof e?new URL(e):e,o="/"!==t.pathname,i=[];if(!o)return i.push({url:new URL("/.well-known/oauth-authorization-server",t.origin),type:"oauth"},{url:new URL("/.well-known/openid-configuration",t.origin),type:"oidc"}),i;let r=t.pathname;return r.endsWith("/")&&(r=r.slice(0,-1)),i.push({url:new URL(`/.well-known/oauth-authorization-server${r}`,t.origin),type:"oauth"},{url:new URL(`/.well-known/openid-configuration${r}`,t.origin),type:"oidc"},{url:new URL(`${r}/.well-known/openid-configuration`,t.origin),type:"oidc"}),i}(e)){let a=await os(o,r,t);if(!a)continue;if(!a.ok){if(await a.text?.().catch(()=>{}),a.status>=400&&a.status<500||502===a.status)continue;throw Error(`HTTP ${a.status} trying to load ${"oauth"===n?"OAuth":"OpenID provider"} metadata from ${o}`)}let s="oauth"===n?R.s.parse(await a.json()):R.d.parse(await a.json());if(!i){let t="string"==typeof e?e:e.href;if(!(s.issuer===t||t.endsWith("/")&&s.issuer===t.slice(0,-1)))throw new tK("metadata",t,s.issuer)}return s}}async function od(e,t){let o,i;try{(o=await oa(e,{resourceMetadataUrl:t?.resourceMetadataUrl},t?.fetchFn)).authorization_servers&&o.authorization_servers.length>0&&(i=o.authorization_servers[0])}catch(e){if(e instanceof TypeError)throw e}i||(i=String(new URL("/",e)));let r=await ou(i,{fetchFn:t?.fetchFn,skipIssuerValidation:t?.skipIssuerMetadataValidation});return{authorizationServerUrl:i,authorizationServerMetadata:r,resourceMetadata:o}}async function op(e,{metadata:t,clientInformation:o,redirectUrl:i,scope:r,state:n,resource:a}){let s;if(t){if(s=new URL(t.authorization_endpoint),!t.response_types_supported.includes(t6))throw Error(`Incompatible auth server: does not support response type ${t6}`);if(t.code_challenge_methods_supported&&!t.code_challenge_methods_supported.includes(t8))throw Error(`Incompatible auth server: does not support code challenge method ${t8}`)}else s=new URL("/authorize",e);let l=await tU(),c=l.code_verifier,u=l.code_challenge;return s.searchParams.set("response_type",t6),s.searchParams.set("client_id",o.client_id),s.searchParams.set("code_challenge",u),s.searchParams.set("code_challenge_method",t8),s.searchParams.set("redirect_uri",String(i)),n&&s.searchParams.set("state",n),r&&s.searchParams.set("scope",r),r?.split(" ").includes("offline_access")&&s.searchParams.append("prompt","consent"),a&&s.searchParams.set("resource",a.href),{authorizationUrl:s,codeVerifier:c}}async function oh(e,{metadata:t,tokenRequestParams:o,clientInformation:i,addClientAuthentication:r,resource:n,fetchFn:a}){var s;let l,c=function(e){let t=new URL(String(e));if("https:"!==t.protocol&&!t7(t.hostname))throw new tW(t.href);return t}(t?.token_endpoint??new URL("/token",e)),u=new Headers({"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"});n&&o.set("resource",n.href),r?await r(u,o,c,t):i&&function(e,t,o,i){let{client_id:r,client_secret:n}=t;switch(e){case"client_secret_basic":if(!n)throw Error("client_secret_basic authentication requires a client_secret");let a=btoa(`${r}:${n}`);o.set("Authorization",`Basic ${a}`);return;case"client_secret_post":i.set("client_id",r),n&&i.set("client_secret",n);return;case"none":i.set("client_id",r);return;default:throw Error(`Unsupported client authentication method: ${e}`)}}((s=t?.token_endpoint_auth_methods_supported??[],l=void 0!==i.client_secret,"token_endpoint_auth_method"in i&&i.token_endpoint_auth_method&&["client_secret_basic","client_secret_post","none"].includes(i.token_endpoint_auth_method)&&(0===s.length||s.includes(i.token_endpoint_auth_method))?i.token_endpoint_auth_method:0===s.length?l?"client_secret_basic":"none":l&&s.includes("client_secret_basic")?"client_secret_basic":l&&s.includes("client_secret_post")?"client_secret_post":s.includes("none")?"none":l?"client_secret_post":"none"),i,u,o);let d=await (a??fetch)(c,{method:"POST",headers:u,body:o});if(!d.ok)throw await oe(d);let p=await d.json();try{return R.u.parse(p)}catch(e){if("object"==typeof p&&null!==p&&"error"in p)throw await oe(JSON.stringify(p));throw e}}async function om(e,{metadata:t,clientInformation:o,refreshToken:i,resource:r,addClientAuthentication:n,fetchFn:a}){return{refresh_token:i,...await oh(e,{metadata:t,tokenRequestParams:new URLSearchParams({grant_type:"refresh_token",refresh_token:i}),clientInformation:o,addClientAuthentication:n,resource:r,fetchFn:a})}}async function of(e,t,{metadata:o,resource:i,authorizationCode:r,iss:n,scope:a,fetchFn:s}={}){let l;void 0!==r&&t4({iss:n,expectedIssuer:o?.issuer,issParameterSupported:t9(o)});let c=a??e.clientMetadata.scope;if(e.prepareTokenRequest&&(l=await e.prepareTokenRequest(c)),!l){if(!r)throw Error("Either provider.prepareTokenRequest() or authorizationCode is required");if(!e.redirectUrl)throw Error("redirectUrl is required for authorization_code flow");l=new URLSearchParams({grant_type:"authorization_code",code:r,code_verifier:await e.codeVerifier(),redirect_uri:String(e.redirectUrl)})}let u=await e.clientInformation({issuer:o?.issuer??String(t)});return oh(t,{metadata:o,tokenRequestParams:l,clientInformation:u??void 0,addClientAuthentication:e.addClientAuthentication,resource:i,fetchFn:s})}async function og(e,{metadata:t,clientMetadata:o,scope:i,fetchFn:r}){let n;if(t){if(!t.registration_endpoint)throw Error("Incompatible auth server: does not support dynamic client registration");n=new URL(t.registration_endpoint)}else n=new URL("/register",e);let a={...o,...void 0===i?{}:{scope:i}},s=await (r??fetch)(n,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)});if(!s.ok)throw new tB({status:s.status,body:await s.text(),submittedMetadata:a});return R.n.parse(await s.json())}let ov=new Set(["tools/list","prompts/list","resources/list","resources/templates/list","server/discover"]);var o_=class{_entries=new Map;_maxEntries;_stamp=0;_cappedSize=0;constructor(e){this._maxEntries=e?.maxEntries??512}get size(){return this._entries.size}get(e){return this._entries.get(oy(e))}set(e,t){let o=oy(e),i=ov.has(e.method),r=!this._entries.has(o);if(!i&&r&&this._maxEntries>0&&this._cappedSize>=this._maxEntries){for(let e of this._entries.keys())if(!ov.has(e.slice(0,e.indexOf("\0")))){this._entries.delete(e),this._cappedSize--;break}}let n=++this._stamp;return this._entries.set(o,{...t,stamp:n}),r&&!i&&this._cappedSize++,n}delete(e){this._entries.delete(oy(e))&&!ov.has(e.method)&&this._cappedSize--}evict(e){let t=`${e}\0`,o=ov.has(e);for(let e of this._entries.keys())e.startsWith(t)&&(this._entries.delete(e),!o&&this._cappedSize--)}clear(){this._entries.clear(),this._cappedSize=0}};function oy(e){return`${e.method}\0${JSON.stringify([e.partition??"",e.params??""])}`}function oS(e,t){return void 0===t?e:`${e}\0${t}`}var ob=class{_evictionGeneration=new Map;_toolIndex;_toolOutputValidatorIndex;_serverIdentity="";constructor(e,t,o=()=>{},i="",r=Date.now){this._store=e,this._isUserSupplied=t,this._reportError=o,this._cachePartition=i,this._now=r}now(){return this._now()}setServerIdentity(e){this._serverIdentity=e}_partitionFor(e){return JSON.stringify([this._serverIdentity,"public"===e?"":this._cachePartition])}async _probe(e,t){let o={method:e,params:t??""},i=this._partitionFor("private"),r=await this._store.get({...o,partition:i});if(void 0!==r)return r;let n=this._partitionFor("public");if(n===i)return;let a=await this._store.get({...o,partition:n});return a?.scope==="public"?a:void 0}async evict(e){this._evictionGeneration.set(e,(this._evictionGeneration.get(e)??0)+1),await this._deleteBoth(e,"")}async _deleteBoth(e,t){let o=this._partitionFor("private"),i=this._partitionFor("public");try{await this._store.delete({method:e,params:t,partition:o})}catch(e){this._reportError(e)}if(i!==o)try{await this._store.delete({method:e,params:t,partition:i})}catch(e){this._reportError(e)}}async evictKey(e,t){let o=oS(e,t),i=this._evictionGeneration.get(o);void 0!==i&&this._evictionGeneration.set(o,i+1),await this._deleteBoth(e,t)}captureGeneration(e,t){let o=oS(e,t),i=this._evictionGeneration.get(o)??0;return this._evictionGeneration.set(o,i),i}async write(e,t,o,i){if((this._evictionGeneration.get(oS(e,i?.params))??0)!==o)return;let r=i?.params??"",n=this._partitionFor("private"),a=this._partitionFor("public"),s=(i?.scope??"private")==="public"?a:n;try{await this._store.set({method:e,params:r,partition:s},{value:function(e){let t;try{t=JSON.stringify(e)}catch(e){throw TypeError(`cache value is not JSON-serializable: ${e instanceof Error?e.message:String(e)}`)}if("string"!=typeof t)throw TypeError("cache value is not JSON-serializable: it has no JSON representation");return t}(t),expiresAt:i?.expiresAt,scope:i?.scope})}catch(e){this._reportError(e)}if(a!==n)try{await this._store.delete({method:e,params:r,partition:s===n?a:n})}catch(e){this._reportError(e)}}async read(e,t){let o=await this._probe(e,t);if(o?.expiresAt!==void 0&&o.expiresAt>this.now())try{let e=JSON.parse(o.value);if("object"!=typeof e||null===e||Array.isArray(e))throw TypeError("cached document is not an object");return{value:e}}catch(o){this._reportError(o),await this._deleteBoth(e,t??"");return}}resetForReconnect(){this._isUserSupplied||this._store.clear(),this._evictionGeneration.clear(),this._toolIndex=void 0,this._toolOutputValidatorIndex=void 0,this._serverIdentity=""}async toolDefinition(e){let t=await this._probe("tools/list");if(void 0===t){this._toolIndex=void 0;return}if(this._toolIndex?.stamp!==t.stamp){let e=this._decodeListTools(t),o=new Map;if(void 0!==e)for(let t of e.tools)o.set(t.name,t);this._toolIndex={stamp:t.stamp,byName:o}}return this._toolIndex.byName.get(e)}async outputValidator(e,t){let o=await this._probe("tools/list");if(void 0===o){this._toolOutputValidatorIndex=void 0;return}if(this._toolOutputValidatorIndex?.stamp!==o.stamp){let e=this._decodeListTools(o)??{tools:[]},i=new Map;for(let o of e.tools){let e=t(o);void 0!==e&&i.set(o.name,e)}this._toolOutputValidatorIndex={stamp:o.stamp,byName:i}}return this._toolOutputValidatorIndex.byName.get(e)}_decodeListTools(e){try{let t=JSON.parse(e.value);if(!Array.isArray(t?.tools)||!t.tools.every(e=>null!==e&&"object"==typeof e))throw TypeError("cached tools/list document has a malformed tools array");return t}catch(e){this._reportError(e);return}}};let ok=Symbol.for("mcp.authSeamEscape");function oP(e){if("object"==typeof e&&null!==e||"function"==typeof e)try{Object.defineProperty(e,ok,{value:!0,configurable:!0})}catch{}return e}let ow=new Set([-32001,-32020,-32021]);function oz(e,t){let{code:o,message:i,data:r}=e;if(-32022===o){let e=function(e){if("object"!=typeof e||null===e)return;let t=e.supported;if(Array.isArray(t)&&0!==t.length&&t.every(e=>"string"==typeof e))return t}(r);if(void 0===e)return{kind:"legacy"};let o=new em({supported:e,requested:function(e){if("object"!=typeof e||null===e)return;let t=e.requested;return"string"==typeof t?t:void 0}(r)??t.requestedVersion},i),n=N(e),a=t.clientModernVersions.find(e=>n.includes(e));return void 0!==a?{kind:"corrective",version:a,error:o}:n.length>0?{kind:"error",error:o}:t.fallbackAvailable?{kind:"legacy"}:{kind:"error",error:o}}return ow.has(o),{kind:"legacy"}}function oR(e,t){return"browser"===t.environment&&(e instanceof TypeError||e instanceof Error&&"TypeError"===e.name)?{kind:"legacy"}:{kind:"error",error:new T(O.EraNegotiationFailed,`Version negotiation probe failed: ${e instanceof Error?e.message:String(e)}`,{cause:e})}}function oI(){let e=globalThis;return void 0!==e.window&&void 0!==e.document?"browser":"node"}function oj(e){return"stderr"in e&&"pid"in e?"stdio":"http"}var ox=class e{_pending;_probeCounter=0;_savedOnMessage;_savedOnError;_savedOnClose;_closeDelivered=!1;constructor(e){this._transport=e,this._savedOnMessage=e.onmessage,this._savedOnError=e.onerror,this._savedOnClose=e.onclose}static async open(t){let o=new e(t);t.onmessage=e=>{let t=o._pending;if(void 0!==t&&(eL(e)||eN(e))&&e.id===t.id){o._pending=void 0,eL(e)?t.resolve({kind:"response",result:e.result}):t.resolve({kind:"response",error:e.error});return}},t.onerror=e=>{o._savedOnError?.(e)},t.onclose=()=>{let e=o._pending;void 0!==e&&(o._pending=void 0,e.resolve({kind:"closed"})),o._closeDelivered=!0,o._savedOnClose?.()};try{await t.start()}catch(e){throw o.detach(),e}return o}async exchange(e,t){let o=`server-discover-probe-${++this._probeCounter}`;return new Promise(i=>{let r=!1,n=e=>{r||(r=!0,clearTimeout(a),this._pending?.id===o&&(this._pending=void 0),i(e))},a=setTimeout(()=>n({kind:"timeout"}),t);this._pending={id:o,resolve:n},this._transport.send(e(o)).catch(e=>n({kind:"send-error",error:e}))})}detach(){if(this._pending=void 0,this._transport.onmessage=this._savedOnMessage,this._transport.onerror=this._savedOnError,this._closeDelivered&&void 0!==this._savedOnClose){let e=this._savedOnClose,t=this._transport,o=!1,i=()=>{if(!o){o=!0;return}e()};t.onclose=i,oC.set(t,()=>{t.onclose===i&&(t.onclose=e)})}else this._transport.onclose=this._savedOnClose}release(){this.detach();let e=this._transport,t=e.start,o=!0;e.start=async function(){if(o){o=!1,e.start=t;return}return t.call(e)}}};let oC=new WeakMap;function oq(e){let t=oC.get(e);oC.delete(e),t?.()}async function oY(e,t){let o,i=e.probe.timeoutMs??t.defaultTimeoutMs,r=Math.max(0,e.probe.maxRetries??0),n="pin"===e.kind?[e.version]:e.modernVersions,a="auto"===e.kind&&e.fallbackAvailable,s=await ox.open(t.transport),l=async()=>{let o=n[0],l=!1,c=r;for(;;){let r=await s.exchange(e=>{var i,r,n;return i=o,r=t.clientInfo,n=t.capabilities,{jsonrpc:"2.0",id:e,method:"server/discover",params:{_meta:eq(i).outboundEnvelope({protocolVersion:i,clientInfo:r,clientCapabilities:n})}}},i);if("timeout"===r.kind&&c>0){c--;continue}let u=function(e,t){switch(e.kind){case"response":return void 0===e.error?{kind:"result",result:e.result}:{kind:"rpc-error",...e.error};case"send-error":{let t=e.error;if(("object"==typeof t&&null!==t||"function"==typeof t)&&!0===t[ok]||t instanceof t2||t instanceof Error&&"UnauthorizedError"===t.name)return{kind:"auth-required",error:t};if(t instanceof $){let e=t.data?.text;return{kind:"http-error",status:t.data.status,body:"string"==typeof e?e:void 0,statusText:t.data.statusText}}return{kind:"network-error",error:t}}case"closed":return{kind:"closed"};case"timeout":return{kind:"timeout",timeoutMs:t}}}(r,i),d=function(e,t){switch(e.kind){case"result":return function(e,t){let o=eq(eC).validateResult("server/discover",e);if(!o.ok)return{kind:"legacy"};let i=o.value.supportedVersions,r=t.clientModernVersions.find(e=>i.includes(e));return void 0!==r?{kind:"modern",version:r,discover:o.value}:t.fallbackAvailable?{kind:"legacy"}:{kind:"error",error:new em({supported:[...i],requested:t.requestedVersion})}}(e.result,t);case"rpc-error":return oz(e,t);case"http-error":return function(e,t){if(401===e.status||403===e.status){let t=403===e.status;return{kind:"error",error:new $(t?O.ClientHttpForbidden:O.ClientHttpAuthentication,`Version negotiation failed: ${t?"the server denied access (HTTP 403)":"the server requires authorization (HTTP 401)"}`,{status:e.status,statusText:e.statusText,text:e.body})}}if(e.status>=500)return{kind:"error",error:new $(O.EraNegotiationFailed,`Version negotiation failed: the server answered the probe with HTTP ${e.status}`,{status:e.status,statusText:e.statusText,text:e.body})};let o=function(e){let t;if(void 0===e||""===e)return;try{t=JSON.parse(e)}catch{return}if("object"!=typeof t||null===t)return;let o=t.error;if("object"!=typeof o||null===o)return;let{code:i,message:r,data:n}=o;if("number"==typeof i)return{code:i,message:"string"==typeof r?r:"",data:n}}(e.body);return void 0!==o?oz(o,t):{kind:"legacy"}}(e,t);case"network-error":return oR(e.error,t);case"auth-required":return{kind:"error",error:e.error};case"closed":if("stdio"===t.transportKind)return{kind:"legacy"};return oR(Error("Connection closed during the version negotiation probe"),t);case"timeout":if("stdio"===t.transportKind)return{kind:"legacy"};return{kind:"error",error:new T(O.RequestTimeout,`Version negotiation probe timed out after ${e.timeoutMs}ms`,{timeout:e.timeoutMs})}}}(u,{clientModernVersions:n,requestedVersion:o,fallbackAvailable:a,environment:t.environment,transportKind:t.transportKind});switch(d.kind){case"modern":return{era:"modern",version:d.version,discover:d.discover};case"corrective":if(l)throw d.error;l=!0,o=d.version;continue;case"legacy":{let o="closed"===u.kind?"the connection closed during the server/discover probe":void 0;if("pin"===e.kind)throw new T(O.EraNegotiationFailed,void 0===o?`Version negotiation failed: the server did not offer pinned protocol version ${e.version} via server/discover (no fallback in pin mode)`:`Version negotiation failed: ${o} before the server offered pinned protocol version ${e.version} (no fallback in pin mode)`);if(!e.fallbackAvailable)throw new T(O.EraNegotiationFailed,void 0===o?"Version negotiation failed: the server gave no modern evidence and this client supports no pre-2026-07-28 protocol version to fall back to":`Version negotiation failed: ${o} and this client supports no pre-2026-07-28 protocol version to fall back to`);if(void 0!==o&&!0!==t.disposableProbe)throw new T(O.EraNegotiationFailed,`Version negotiation failed: ${o} (this transport probed in place — the disposable sibling probe requires the SDK's base StdioClientTransport)`);return{era:"legacy"}}case"error":throw d.error}}};try{o=await l()}catch(e){throw s.detach(),e}return s.release(),o}async function oO(e,t,o,i){let r,n,a=new t.constructor({...o,stderr:"ignore"}),s=t.close,l=!1,c=new Promise((e,t)=>{r=()=>t(oT())});t.close=async function(){return l=!0,r?.(),s.call(t)};try{let t=oY(e,{...i,transport:a,transportKind:"stdio",disposableProbe:!0});t.catch(()=>{}),n=await Promise.race([t,c])}finally{await o$(a),t.close=s}if(l)throw oT();return n}function oT(){return new T(O.EraNegotiationFailed,"Version negotiation failed: the transport was closed during the server/discover probe")}async function o$(e){try{let t=e._dispose;await ("function"==typeof t?t.call(e):e.close())}catch{}}function oE(e){let t=e._meta?.[R.Nr];return tr.Implementation(t)?t:void 0}let oM={"notifications/tools/list_changed":["tools/list"],"notifications/prompts/list_changed":["prompts/list"],"notifications/resources/list_changed":["resources/list","resources/templates/list"]};var oL=class extends tu{_serverCapabilities;_serverVersion;_capabilities;_instructions;_jsonSchemaValidator;_cache;_defaultCacheTtlMs;_listMaxPages;_listChangedDebounceTimers=new Map;_listChangedConfig;_enforceStrictCapabilities;_versionNegotiation;_supportedProtocolVersionsOption;_inputRequiredDriverConfig;_listenState=new Map;_nextListenId=0;_autoOpenedSubscription;_discoverResult;_resetConnectionState(){if(this._negotiatedProtocolVersion=void 0,this._serverCapabilities=void 0,this._serverVersion=void 0,this._instructions=void 0,this._discoverResult=void 0,this._autoOpenedSubscription=void 0,this._listenState.size>0){let e=new T(O.ConnectionClosed,"subscriptions/listen: client reconnected or closed; subscription state from the previous connection was reset");for(let t of this._listenState.values())t.settle({cause:"remote",error:e})}for(let e of(this._listenState.clear(),this._listChangedDebounceTimers.values()))clearTimeout(e);this._listChangedDebounceTimers.clear(),this._cache.resetForReconnect()}async close(){try{await super.close()}finally{this._resetConnectionState()}}constructor(e,t){var o;super(t),this._clientInfo=e,this._capabilities=t?.capabilities?{...t.capabilities}:{},this._jsonSchemaValidator=t?.jsonSchemaValidator??new tE,this._enforceStrictCapabilities=t?.enforceStrictCapabilities??!1,this._versionNegotiation=t?.versionNegotiation,this._supportedProtocolVersionsOption=t?.supportedProtocolVersions,this._inputRequiredDriverConfig=(o=t?.inputRequired,{autoFulfill:o?.autoFulfill??!0,maxRounds:o?.maxRounds??10}),this._cache=new ob(t?.responseCacheStore??new o_,t?.responseCacheStore!==void 0,e=>this._reportStoreError(e),t?.cachePartition??""),this._defaultCacheTtlMs=t?.defaultCacheTtlMs??0,this._listMaxPages=t?.listMaxPages??64,t?.listChanged&&(this._listChangedConfig=t.listChanged)}buildContext(e,t){return e}_shouldDropInbound(e){if(void 0!==this._negotiatedProtocolVersion&&this._negotiatedProtocolVersion>=E&&eM(e))return"drop"}_outboundMetaEnvelope(){let e=this._negotiatedProtocolVersion;if(void 0!==e)return this._wireCodec().outboundEnvelope({protocolVersion:e,clientInfo:this._clientInfo,clientCapabilities:this._capabilities})}_resolveNonCompleteResult(e,t){return this._inputRequiredDriverConfig.autoFulfill?function(e,t,o,i){let{codec:r,request:n,options:a,flowStartedAt:s}=i,l={inputRequests:o.inputRequests,...void 0!==o.requestState&&{requestState:o.requestState}};return e7({config:t,method:n.method,originalParams:n.params,firstPayload:l,flowStartedAt:s,signal:a?.signal,requestOptions:{...a?.timeout!==void 0&&{timeout:a.timeout},...a?.maxTotalTimeout!==void 0&&{maxTotalTimeout:a.maxTotalTimeout},...a?.onprogress!==void 0&&{onprogress:a.onprogress}},hooks:{dispatchInputRequest:(t,o,i)=>tm(e,r,t,o,i),retry:(e,t)=>i.retry(e,{...a?.signal!==void 0&&{signal:a.signal},...a?.onprogress!==void 0&&{onprogress:a.onprogress},...a?.resetTimeoutOnProgress!==void 0&&{resetTimeoutOnProgress:a.resetTimeoutOnProgress},...a?.headers!==void 0&&{headers:a.headers},...void 0!==t.timeout&&{timeout:t.timeout},...void 0!==t.maxTotalTimeout&&{maxTotalTimeout:t.maxTotalTimeout},allowInputRequired:!0})}})}({getRequestHandler:e=>this._getRequestHandler(e),buildContext:e=>this.buildContext(e,void 0),sessionId:this.transport?.sessionId},this._inputRequiredDriverConfig,e,t):Promise.reject(new T(O.UnsupportedResultType,`Unsupported result type 'input_required' for ${t.request.method}: multi-round-trip auto-fulfilment is not enabled on this instance — pass allowInputRequired: true to handle it manually, or enable inputRequired.autoFulfill`,{resultType:"input_required",method:t.request.method}))}_setupListChangedHandlers(e){e.tools&&this._serverCapabilities?.tools?.listChanged&&this._setupListChangedHandler("tools","notifications/tools/list_changed",e.tools,async()=>(await this.listTools(void 0,{cacheMode:"refresh"})).tools),e.prompts&&this._serverCapabilities?.prompts?.listChanged&&this._setupListChangedHandler("prompts","notifications/prompts/list_changed",e.prompts,async()=>(await this.listPrompts(void 0,{cacheMode:"refresh"})).prompts),e.resources&&this._serverCapabilities?.resources?.listChanged&&this._setupListChangedHandler("resources","notifications/resources/list_changed",e.resources,async()=>(await this.listResources(void 0,{cacheMode:"refresh"})).resources)}registerCapabilities(e){if(this.transport)throw Error("Cannot register capabilities after connecting to transport");this._capabilities=function(e,t){let o={...e};for(let e in t){let i=t[e];if(void 0===i)continue;let r=o[e];o[e]=td(r)&&td(i)?{...r,...i}:i}return o}(this._capabilities,e)}setVersionNegotiation(e){if(this.transport)throw Error("Cannot configure version negotiation after connecting to transport");this._versionNegotiation=e}_wrapHandler(e,t){return"elicitation/create"===e?async(e,o)=>{let i=eq(this._negotiatedProtocolVersion),r=i.validateRequest("elicitation/create",e);if(r.ok||"not-in-era"!==r.reason||(r=i.validateInputRequest("elicitation/create",e)),!r.ok)throw new ed("not-in-era"===r.reason?eu.InternalError:eu.InvalidParams,"not-in-era"===r.reason?"No wire schema for elicitation/create in the resolved era":`Invalid elicitation request: ${r.message}`);let{params:n}=r.value;n.mode=n.mode??"form";let{supportsFormMode:a,supportsUrlMode:s}=function(e){if(!e)return{supportsFormMode:!1,supportsUrlMode:!1};let t=void 0!==e.form,o=void 0!==e.url;return{supportsFormMode:t||!t&&!o,supportsUrlMode:o}}(this._capabilities.elicitation);if("form"===n.mode&&!a)throw new ed(eu.InvalidParams,"Client does not support form-mode elicitation requests");if("url"===n.mode&&!s)throw new ed(eu.InvalidParams,"Client does not support URL-mode elicitation requests");let l=await t(e,o),c=i.validateResult("elicitation/create",l);if(c.ok||"not-in-era"!==c.reason||(c=i.validateInputResponse("elicitation/create",l)),!c.ok)throw new ed("not-in-era"===c.reason?eu.InternalError:eu.InvalidParams,"not-in-era"===c.reason?"No wire schema for elicitation/create in the resolved era":`Invalid elicitation result: ${c.message}`);let u=c.value,d="form"===n.mode?n.requestedSchema:void 0;if("form"===n.mode&&"accept"===u.action&&u.content&&d&&this._capabilities.elicitation?.form?.applyDefaults)try{!function e(t,o){if(t&&null!==o&&"object"==typeof o){if("object"===t.type&&t.properties&&"object"==typeof t.properties){let i=t.properties;for(let t of Object.keys(i)){let r=i[t];void 0===o[t]&&Object.prototype.hasOwnProperty.call(r,"default")&&(o[t]=r.default),void 0!==o[t]&&e(r,o[t])}}if(Array.isArray(t.anyOf))for(let i of t.anyOf)"boolean"!=typeof i&&e(i,o);if(Array.isArray(t.oneOf))for(let i of t.oneOf)"boolean"!=typeof i&&e(i,o)}}(d,u.content)}catch{}return u}:"sampling/createMessage"===e?async(e,o)=>{let i=eq(this._negotiatedProtocolVersion),r=i.validateRequest("sampling/createMessage",e);if(r.ok||"not-in-era"!==r.reason||(r=i.validateInputRequest("sampling/createMessage",e)),!r.ok)throw new ed("not-in-era"===r.reason?eu.InternalError:eu.InvalidParams,"not-in-era"===r.reason?"No wire schema for sampling/createMessage in the resolved era":`Invalid sampling request: ${r.message}`);let{params:n}=r.value,a=await t(e,o),s=!!(n.tools||n.toolChoice),l=i.samplingResultVariant(s,a);if(l.ok||"not-in-era"!==l.reason||(l=i.validateInputResponse("sampling/createMessage",a)),!l.ok)throw new ed("not-in-era"===l.reason?eu.InternalError:eu.InvalidParams,"not-in-era"===l.reason?"No result schema for sampling/createMessage in the resolved era":`Invalid sampling result: ${l.message}`);return l.value}:t}assertCapability(e,t){if(!this._serverCapabilities?.[e])throw new T(O.CapabilityNotSupported,`Server does not support ${e} (required for ${t})`)}async connect(e,t){if(t?.prior!=null)return this._connectFromPrior(e,function(e){if("object"==typeof e&&null!==e&&("legacy"===e.kind&&!("supportedVersions"in e)&&!("discover"in e)||"modern"===e.kind&&R.G.safeParse(e.discover).success))return e;throw new T(O.EraNegotiationFailed,"connect({ prior }): unrecognized prior — expected { kind: 'modern', discover } or { kind: 'legacy' }")}(t.prior),t);let o=function(e,t){let o=e?.mode??"legacy";if("legacy"===o)return{kind:"legacy"};let i=e?.probe??{};if("object"==typeof o){if(!(o.pin>=E))throw TypeError(`versionNegotiation: { pin: '${o.pin}' } is not a modern protocol revision — pinning is for 2026-07-28 and later; omit versionNegotiation (or use mode: 'legacy') for 2025-era servers.`);return{kind:"pin",version:o.pin,probe:i}}let r=t?N(t):[];return{kind:"auto",modernVersions:r.length>0?r:[...M],fallbackAvailable:!t||L(t).length>0,probe:i}}(this._versionNegotiation,this._supportedProtocolVersionsOption);return"legacy"!==o.kind?this._connectNegotiated(e,o,t):this._connectPlainLegacy(e,t)}async _connectPlainLegacy(e,t){if(await super.connect(e),void 0!==e.sessionId){let t=this._negotiatedProtocolVersion;void 0!==t&&e.setProtocolVersion?.(t);return}this._resetConnectionState(),await this._legacyHandshake(e,t)}async _legacyHandshake(e,t){let o=L(this._supportedProtocolVersions);try{let i=o[0];if(void 0===i)throw new T(O.EraNegotiationFailed,"Cannot run the initialize handshake: supportedProtocolVersions contains no pre-2026-07-28 protocol version");let r=await this.request({method:"initialize",params:{protocolVersion:i,capabilities:this._capabilities,clientInfo:this._clientInfo}},t);if(void 0===r)throw Error(`Server sent invalid initialize result: ${r}`);if(!o.includes(r.protocolVersion))throw Error(`Server's protocol version is not supported: ${r.protocolVersion}`);this._serverCapabilities=r.capabilities,this._serverVersion=r.serverInfo,this._cache.setServerIdentity(this._deriveServerIdentity(e)),e.setProtocolVersion&&e.setProtocolVersion(r.protocolVersion),this._instructions=r.instructions,await this.notification({method:"notifications/initialized"}),this._negotiatedProtocolVersion=r.protocolVersion,this._listChangedConfig&&this._setupListChangedHandlers(this._listChangedConfig)}catch(e){throw this.close(),e}}async _connectNegotiated(e,t,o){let i;if(void 0!==e.sessionId){await super.connect(e);let t=this._negotiatedProtocolVersion;void 0!==t&&e.setProtocolVersion&&e.setProtocolVersion(t);return}this._resetConnectionState();try{let r=oj(e),n={clientInfo:this._clientInfo,capabilities:this._capabilities,environment:oI(),defaultTimeoutMs:o?.timeout??6e4},a="stdio"===r?function(e){let t=Object.getPrototypeOf(e);if(null===t||!Object.prototype.hasOwnProperty.call(t,"_dispose"))return;let o=e._serverParams;return"object"==typeof o&&null!==o&&"string"==typeof o.command?o:void 0}(e):void 0;i=void 0===a?await oY(t,{...n,transport:e,transportKind:r}):await oO(t,e,a,n)}catch(t){throw await e.close().catch(()=>{}),oq(e),t}if(oq(e),await super.connect(e),"legacy"===i.era)return void await this._legacyHandshake(e,o);if(this._serverCapabilities=i.discover.capabilities,this._serverVersion=oE(i.discover),this._cache.setServerIdentity(this._deriveServerIdentity(e)),this._instructions=i.discover.instructions,this._discoverResult=i.discover,this._negotiatedProtocolVersion=i.version,e.setProtocolVersion&&e.setProtocolVersion(i.version),this._listChangedConfig){let e=this._listChangedConfig,t=this._serverCapabilities,i={...e.tools&&t?.tools?.listChanged&&{tools:e.tools},...e.prompts&&t?.prompts?.listChanged&&{prompts:e.prompts},...e.resources&&t?.resources?.listChanged&&{resources:e.resources}},r=!0;try{this._setupListChangedHandlers(i)}catch(e){r=!1,this.onerror?.(e instanceof Error?e:Error(String(e)))}let n=r?{...i.tools&&{toolsListChanged:!0},...i.prompts&&{promptsListChanged:!0},...i.resources&&{resourcesListChanged:!0}}:{};if(Object.keys(n).length>0){let e=new AbortController,t=()=>e.abort(o?.signal?.reason);o?.signal?.aborted&&t(),o?.signal?.addEventListener("abort",t);try{this._autoOpenedSubscription=await this.listen(n,{timeout:o?.timeout,signal:e.signal})}catch(e){if(o?.signal?.aborted)throw await this.close().catch(()=>{}),e;this.onerror?.(e instanceof Error?e:Error(String(e)))}finally{o?.signal?.removeEventListener("abort",t)}}}}async _connectFromPrior(e,t,o){if("legacy"===t.kind)return this._connectPlainLegacy(e,o);let i=t.discover;this._resetConnectionState();let r=this._supportedProtocolVersionsOption,n=(r&&N(r).length>0?N(r):M).find(e=>i.supportedVersions.includes(e));if(void 0===n)throw new T(O.EraNegotiationFailed,"connect({ prior }) with a modern verdict requires a 2026-07-28+ mutual protocol version; the supplied DiscoverResult and this client's supportedProtocolVersions have no modern overlap. For a server known to be legacy, pass prior: { kind: 'legacy' } to skip the probe and initialize directly, or use versionNegotiation: { mode: 'auto' } to re-probe with legacy fallback.");if(await super.connect(e),this._discoverResult=i,this._serverCapabilities=i.capabilities,this._serverVersion=oE(i),this._cache.setServerIdentity(this._deriveServerIdentity(e)),this._instructions=i.instructions,this._negotiatedProtocolVersion=n,e.setProtocolVersion?.(n),this._listChangedConfig)try{this._setupListChangedHandlers(this._listChangedConfig)}catch(e){this.onerror?.(e instanceof Error?e:Error(String(e)))}}getServerCapabilities(){return this._serverCapabilities}getServerVersion(){return this._serverVersion}_deriveServerIdentity(e){let t=this._serverVersion;return void 0!==t?`${t.name}@${t.version}`:e.sessionId??`anonymous:${Date.now()}-${Math.random().toString(36).slice(2)}`}getNegotiatedProtocolVersion(){return this._negotiatedProtocolVersion}getProtocolEra(){let e=this._negotiatedProtocolVersion;if(void 0!==e)return e>=E?"modern":"legacy"}getInstructions(){return this._instructions}getDiscoverResult(){return this._discoverResult}assertCapabilityForMethod(e){switch(e){case"logging/setLevel":if(!this._serverCapabilities?.logging)throw new T(O.CapabilityNotSupported,`Server does not support logging (required for ${e})`);break;case"prompts/get":case"prompts/list":if(!this._serverCapabilities?.prompts)throw new T(O.CapabilityNotSupported,`Server does not support prompts (required for ${e})`);break;case"resources/list":case"resources/templates/list":case"resources/read":case"resources/subscribe":case"resources/unsubscribe":if(!this._serverCapabilities?.resources)throw new T(O.CapabilityNotSupported,`Server does not support resources (required for ${e})`);if("resources/subscribe"===e&&!this._serverCapabilities.resources.subscribe)throw new T(O.CapabilityNotSupported,`Server does not support resource subscriptions (required for ${e})`);break;case"tools/call":case"tools/list":if(!this._serverCapabilities?.tools)throw new T(O.CapabilityNotSupported,`Server does not support tools (required for ${e})`);break;case"completion/complete":if(!this._serverCapabilities?.completions)throw new T(O.CapabilityNotSupported,`Server does not support completions (required for ${e})`)}}assertNotificationCapability(e){if("notifications/roots/list_changed"===e&&!this._capabilities.roots?.listChanged)throw new T(O.CapabilityNotSupported,`Client does not support roots list changed notifications (required for ${e})`)}assertRequestHandlerCapability(e){switch(e){case"sampling/createMessage":if(!this._capabilities.sampling)throw new T(O.CapabilityNotSupported,`Client does not support sampling capability (required for ${e})`);break;case"elicitation/create":if(!this._capabilities.elicitation)throw new T(O.CapabilityNotSupported,`Client does not support elicitation capability (required for ${e})`);break;case"roots/list":if(!this._capabilities.roots)throw new T(O.CapabilityNotSupported,`Client does not support roots capability (required for ${e})`)}}async ping(e){return this.request({method:"ping"},e)}async discover(e){let t=await this._requestWithSchema({method:"server/discover"},R.G,e);return this._discoverResult=t,t}async complete(e,t){return this.request({method:"completion/complete",params:e},t)}async setLoggingLevel(e,t){return this.request({method:"logging/setLevel",params:{level:e}},t)}async getPrompt(e,t){return this.request({method:"prompts/get",params:e},t)}async listPrompts(e,t){if(!this._serverCapabilities?.prompts&&!this._enforceStrictCapabilities)return console.debug("Client.listPrompts() called but server does not advertise prompts capability - returning empty list"),{prompts:[]};if(e?.cursor!==void 0)return this.request({method:"prompts/list",params:e},t);let o=await this._serveFromCache("prompts/list",void 0,t);return void 0!==o?o:this._listAllPages("prompts/list",e,t,(e,t)=>e.prompts.push(...t.prompts))}async listResources(e,t){if(!this._serverCapabilities?.resources&&!this._enforceStrictCapabilities)return console.debug("Client.listResources() called but server does not advertise resources capability - returning empty list"),{resources:[]};if(e?.cursor!==void 0)return this.request({method:"resources/list",params:e},t);let o=await this._serveFromCache("resources/list",void 0,t);return void 0!==o?o:this._listAllPages("resources/list",e,t,(e,t)=>e.resources.push(...t.resources))}async listResourceTemplates(e,t){if(!this._serverCapabilities?.resources&&!this._enforceStrictCapabilities)return console.debug("Client.listResourceTemplates() called but server does not advertise resources capability - returning empty list"),{resourceTemplates:[]};if(e?.cursor!==void 0)return this.request({method:"resources/templates/list",params:e},t);let o=await this._serveFromCache("resources/templates/list",void 0,t);return void 0!==o?o:this._listAllPages("resources/templates/list",e,t,(e,t)=>e.resourceTemplates.push(...t.resourceTemplates))}async _listAllPages(e,t,o,i,r){let n=o?.cacheMode==="bypass",a=this._cache.captureGeneration(e),s=await this.request({method:e,...t&&{params:{...t}}},o),l=s.nextCursor,c=new Set,u=1;for(;void 0!==l&&!c.has(l);){if(0!==this._listMaxPages&&u>=this._listMaxPages)throw new T(O.ListPaginationExceeded,`${e}: exceeded listMaxPages (${this._listMaxPages}); server pagination did not terminate`,{method:e,listMaxPages:this._listMaxPages});c.add(l);let r=await this.request({method:e,params:{...t,cursor:l}},o);i(s,r),l=r.nextCursor,u++}return delete s.nextCursor,r?.(s),n||await this._cache.write(e,s,a,this._freshness(s)),s}_freshness(e,t){let o="number"==typeof e.ttlMs?e.ttlMs:this._defaultCacheTtlMs,i="public"===e.cacheScope?"public":"private";return{expiresAt:this._cache.now()+Math.min(Math.max(0,o),864e5),scope:i,params:t}}async _serveFromCache(e,t,o){if(o?.cacheMode==="bypass"||o?.cacheMode==="refresh")return;let i=await this._cache.read(e,t).catch(e=>void this._reportStoreError(e));if(void 0!==i){if(o?.signal?.aborted){let e=o.signal.reason;throw e instanceof T?e:new T(O.RequestTimeout,String(e))}return i.value}}_reportStoreError(e){this.onerror?.(e instanceof Error?e:Error(String(e)))}_compileOutputValidator(e){if(e.outputSchema)try{return{ok:!0,validator:this._jsonSchemaValidator.getValidator(e.outputSchema)}}catch(e){return{ok:!1,compileError:e}}}async _resolveXMcpHeaderScan(e,t){let o=t??await this._cache.toolDefinition(e);return void 0===o?void 0:eJ(o.inputSchema)}async readResource(e,t){let o=await this._serveFromCache("resources/read",e.uri,t);if(void 0!==o)return o;let i=this._cache.captureGeneration("resources/read",e.uri),r=await this.request({method:"resources/read",params:e},t);if(t?.cacheMode!=="bypass"){let o=this._freshness(r,e.uri);o.expiresAt>this._cache.now()?await this._cache.write("resources/read",r,i,o):t?.cacheMode==="refresh"&&await this._cache.evictKey("resources/read",e.uri)}return r}async subscribeResource(e,t){return this.request({method:"resources/subscribe",params:e},t)}async unsubscribeResource(e,t){return this.request({method:"resources/unsubscribe",params:e},t)}async listen(e,t){let o,i,r,n,a;if(void 0===this.transport)throw new T(O.NotConnected,"Not connected");let s=this._negotiatedProtocolVersion;if(void 0===s||!(s>=E))throw new T(O.MethodNotSupportedByProtocolVersion,`subscriptions/listen requires a 2026-07-28-era connection (negotiated: ${s??"none"}). On a 2025-era connection, change notifications are delivered unsolicited: use ClientOptions.listChanged and resources/subscribe instead.`,{method:"subscriptions/listen",protocolVersion:s});if(t?.signal?.aborted){let e=t.signal.reason;throw e instanceof T?e:new T(O.RequestTimeout,String(e))}let l=new AbortController,c=`listen:${this._nextListenId++}`,u="opening",d=new Promise((e,t)=>{r=e,n=t}),p=new Promise(e=>{a=e}),h=e=>{if("closed"===u)return;let s="opening"===u;if(void 0!==o&&(clearTimeout(o),o=void 0),"ack"in e){u="open",r(e.ack);return}u="closed",void 0!==i&&t?.signal?.removeEventListener("abort",i),this._listenState.delete(c),l.abort(),a(e.cause),s&&n(e.error??new T(O.ConnectionClosed,"subscriptions/listen closed before the server acknowledged"))},m=async()=>{l.abort(),await this.notification({method:"notifications/cancelled",params:{requestId:c}}).catch(()=>{})},f=async()=>{"closed"!==u&&(h({cause:"local"}),await m())};this._listenState.set(c,{settle:h});let g=t?.timeout??6e4;if(o=setTimeout(()=>{h({cause:"remote",error:new T(O.RequestTimeout,"subscriptions/listen ack timed out",{timeout:g})}),m().catch(()=>{})},g),t?.signal){let e=t.signal;i=()=>{if("closed"===u)return;let t=e.reason;h({cause:"local",error:t instanceof Error?t:Error(String(t??"Aborted"))}),m().catch(()=>{})},e.addEventListener("abort",i,{once:!0})}let v={jsonrpc:"2.0",id:c,method:"subscriptions/listen",params:{_meta:{...this._outboundMetaEnvelope()},notifications:e}};try{await this.transport.send(v,{requestSignal:l.signal,onRequestStreamEnd:()=>h({cause:"remote",error:Error("subscriptions/listen: stream ended")})})}catch(e){h({cause:"remote",error:e instanceof Error?e:Error(String(e))})}return{honoredFilter:await d,close:f,closed:p}}get autoOpenedSubscription(){return this._autoOpenedSubscription}_onnotification(e,t){let o=Object.hasOwn(oM,e.method)?oM[e.method]:void 0;if("notifications/resources/updated"===e.method){let t=e.params?.uri;"string"==typeof t&&this._cache.evictKey("resources/read",t)}else if(void 0!==o)for(let e of o)this._cache.evict(e);if("notifications/subscriptions/acknowledged"===e.method){let t=e.params?._meta?.[R.Pr],o="string"==typeof t?this._listenState.get(t):void 0;if(void 0!==o){let t=this._wireCodec().validateNotification("notifications/subscriptions/acknowledged",e);o.settle({ack:t.ok?t.value.params.notifications:{}});return}}if("notifications/cancelled"===e.method){let t=e.params?.requestId,o="string"==typeof t?this._listenState.get(t):void 0;if(void 0!==o)return void o.settle({cause:"remote",error:Error("subscriptions/listen: server cancelled the subscription")})}super._onnotification(e,t)}_onresponse(e){let t=e.id,o="string"==typeof t?this._listenState.get(t):void 0;void 0!==o?eN(e)?o.settle({cause:"remote",error:ed.fromError(e.error.code,e.error.message,e.error.data)}):o.settle({cause:"graceful",error:new T(O.ConnectionClosed,"subscriptions/listen: server closed the subscription gracefully before acknowledging")}):super._onresponse(e)}_onclose(){if(this._listenState.size>0){let e=new T(O.ConnectionClosed,"Connection closed");for(let t of this._listenState.values())t.settle({cause:"remote",error:e});this._listenState.clear()}super._onclose()}async callTool(e,t){let o,i="modern"===this.getProtocolEra()&&"browser"!==oI(),r=async()=>{let o;if(!i)return t;try{o=await this._resolveXMcpHeaderScan(e.name,t?.toolDefinition)}catch(e){this._reportStoreError(e)}if(!o?.valid||0===o.declarations.length)return t;let r=function(e,t){let o={};for(let i of e){let e=function(e,t){let o=e;for(let e of t){if(null===o||"object"!=typeof o)return;o=o[e]}return o}(t,i.path);if(null==e)continue;let r=function(e){if("string"==typeof e)return e;if("boolean"==typeof e)return e?"true":"false";if("number"==typeof e){if(!Number.isFinite(e)||Number.isInteger(e)&&!Number.isSafeInteger(e))return;return String(e)}}(e);void 0!==r&&(o[`Mcp-Param-${i.headerName}`]=eW(r))}return o}(o.declarations,e.arguments);return 0===Object.keys(r).length?t:{...t,headers:{...t?.headers,...r}}},n=t?.toolDefinition===void 0?await this._cache.outputValidator(e.name,e=>this._compileOutputValidator(e)).catch(e=>void this._reportStoreError(e)):this._compileOutputValidator(t.toolDefinition),a=()=>{if(void 0===n||n.ok)return;let t=n.compileError,o=(t instanceof Error?t.message:String(t)).slice(0,200);throw new ed(eu.InvalidParams,`Tool '${e.name}' has an invalid outputSchema: ${o}`)};a();try{o=await this.request({method:"tools/call",params:e},await r())}catch(c){let s=c instanceof ed&&-32020===c.code;if(!i||!s||t?.toolDefinition!==void 0)throw c;let l={signal:t?.signal,timeout:t?.timeout,cacheMode:"refresh"};await this._cache.evict("tools/list"),await this.listTools(void 0,l).catch(e=>this._reportStoreError(e)),n=await this._cache.outputValidator(e.name,e=>this._compileOutputValidator(e)).catch(e=>void this._reportStoreError(e)),a(),o=await this.request({method:"tools/call",params:e},await r())}let s=void 0!==n&&n.ok?n.validator:void 0;if(s){if(void 0===o.structuredContent&&!o.isError)throw new ed(eu.InvalidRequest,`Tool ${e.name} has an output schema but did not return structured content`);if(void 0!==o.structuredContent&&!o.isError)try{let e=s(o.structuredContent);if(!e.valid)throw new ed(eu.InvalidParams,`Structured content does not match the tool's output schema: ${e.errorMessage}`)}catch(e){if(e instanceof ed)throw e;throw new ed(eu.InvalidParams,`Failed to validate structured content: ${e instanceof Error?e.message:String(e)}`)}}return o}async listTools(e,t){if(!this._serverCapabilities?.tools&&!this._enforceStrictCapabilities)return console.debug("Client.listTools() called but server does not advertise tools capability - returning empty list"),{tools:[]};if(e?.cursor!==void 0){let o=await this.request({method:"tools/list",params:e},t);return this._excludeInvalidXMcpHeaderTools(o),o}let o=await this._serveFromCache("tools/list",void 0,t);return void 0!==o?o:this._listAllPages("tools/list",e,t,(e,t)=>e.tools.push(...t.tools),e=>this._excludeInvalidXMcpHeaderTools(e))}_excludeInvalidXMcpHeaderTools(e){if("modern"!==this.getProtocolEra()||!this.transport||"stdio"===oj(this.transport))return;let t=e.tools.filter(e=>{let t=eJ(e.inputSchema);return!!t.valid||(console.warn(`[mcp-sdk] excluding tool '${e.name}' from tools/list: invalid x-mcp-header declaration — ${t.reason}`),!1)});t.length!==e.tools.length&&(e.tools=t)}_setupListChangedHandler(e,t,o,i){var r;let n=(r=R.Dt,I.xLC(r,o));if(!n.success)throw Error(`Invalid ${e} listChanged options: ${n.error.message}`);if("function"!=typeof o.onChanged)throw TypeError(`Invalid ${e} listChanged options: onChanged must be a function`);let{autoRefresh:a,debounceMs:s}=n.data,{onChanged:l}=o,c=async()=>{if(!a)return void l(null,null);try{l(null,await i())}catch(e){l(e instanceof Error?e:Error(String(e)),null)}},u=()=>{if(s){let t=this._listChangedDebounceTimers.get(e);t&&clearTimeout(t);let o=setTimeout(c,s);this._listChangedDebounceTimers.set(e,o)}else c()};this.setNotificationHandler(t,u)}async sendRootsListChanged(){return this.notification({method:"notifications/roots/list_changed"})}};(class extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.SseError"})}static[Symbol.hasInstance](e){return C(this,e)}static isInstance(e){if("function"!=typeof this)throw TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return C(this,e)}constructor(e,t,o){super(`SSE error: ${t}`),this.code=e,this.event=o,x(this,new.target)}});let oN={initialReconnectionDelay:1e3,maxReconnectionDelay:3e4,reconnectionDelayGrowFactor:1.5,maxRetries:2},oA=new Set(["authorization","content-type","mcp-protocol-version","mcp-method","mcp-name","mcp-session-id"]);function oU(e,t){if("function"==typeof AbortSignal.any)return AbortSignal.any([e,t]);let o=new AbortController;if(e.aborted)return o.abort(e.reason),o.signal;if(t.aborted)return o.abort(t.reason),o.signal;let i=()=>{e.removeEventListener("abort",r),t.removeEventListener("abort",n)};function r(){i(),o.abort(e.reason)}function n(){i(),o.abort(t.reason)}return e.addEventListener("abort",r,{once:!0}),t.addEventListener("abort",n,{once:!0}),o.signal}var oH=class{_abortController;_url;_resourceMetadataUrl;_scope;_requestInit;_authProvider;_oauthProvider;_skipIssuerMetadataValidation;_fetch;_fetchWithInit;_sessionId;_reconnectionOptions;_protocolVersion;_onInsufficientScope;_maxStepUpRetries;_serverRetryMs;_reconnectionScheduler;_cancelReconnection;onclose;onerror;onmessage;hasPerRequestStream=!0;constructor(e,t){var o,i,r;(this._url=e,this._resourceMetadataUrl=void 0,this._scope=void 0,this._requestInit=t?.requestInit,this._skipIssuerMetadataValidation=t?.skipIssuerMetadataValidation,null==(o=t?.authProvider)?1:"function"!=typeof o.tokens||"function"!=typeof o.clientInformation)?this._authProvider=t?.authProvider:(this._oauthProvider=t.authProvider,this._authProvider=(i=t.authProvider,r={skipIssuerMetadataValidation:t.skipIssuerMetadataValidation},{token:async()=>(await i.tokens())?.access_token,onUnauthorized:async e=>t1(i,e,r)})),this._fetch=t?.fetch,this._fetchWithInit=function(e=fetch,t){return t?async(o,i)=>e(o,{...t,...i,headers:i?.headers?{...tg(t.headers),...tg(i.headers)}:t.headers}):e}(t?.fetch,t?.requestInit),this._sessionId=t?.sessionId,this._protocolVersion=t?.protocolVersion,this._reconnectionOptions=t?.reconnectionOptions??oN,this._reconnectionScheduler=t?.reconnectionScheduler,this._onInsufficientScope=t?.onInsufficientScope??"reauthorize",this._maxStepUpRetries=Math.max(0,t?.maxStepUpRetries??1)}async _stepUpAuthorize(e,t){try{return await this._stepUpAuthorizeInner(e,t)}catch(e){throw oP(e)}}async _stepUpAuthorizeInner(e,t){if("throw"===this._onInsufficientScope||!this._oauthProvider)throw new tX({requiredScope:e.scope,resourceMetadataUrl:e.resourceMetadataUrl,errorDescription:e.errorDescription});if(t>=this._maxStepUpRetries)throw new $(O.ClientHttpForbidden,`Server returned 403 insufficient_scope after step-up re-authorization (retry limit ${this._maxStepUpRetries} reached)`,{status:403,statusText:e.statusText??"Forbidden",text:e.text});e.resourceMetadataUrl&&(this._resourceMetadataUrl=e.resourceMetadataUrl);let o=await this._oauthProvider.tokens(),i=t5(this._scope,o?.scope,e.scope);this._scope=i;let r=function(e,t){if(!e)return!1;let o=new Set((t??"").split(/\s+/).filter(Boolean));for(let t of e.split(/\s+/))if(t&&!o.has(t))return!0;return!1}(i,o?.scope);return ot(this._oauthProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:i,forceReauthorization:r,fetchFn:this._fetchWithInit,skipIssuerMetadataValidation:this._skipIssuerMetadataValidation})}async _commonHeaders(){let e,t={};try{e=await this._authProvider?.token()}catch(e){throw oP(e)}e&&(t.Authorization=`Bearer ${e}`),this._sessionId&&(t["mcp-session-id"]=this._sessionId),this._protocolVersion&&(t["mcp-protocol-version"]=this._protocolVersion);let o=tg(this._requestInit?.headers);return new Headers({...t,...o})}_applyBodyDerivedHeaders(e,t){if(Array.isArray(t)||!eM(t))return;let o=t.params?._meta?.[R.jr];if("string"!=typeof o)return;e.set("mcp-protocol-version",o),e.set("mcp-method",t.method);let i=t.params,r="resources/read"===t.method?"string"==typeof i?.uri?i.uri:void 0:"string"==typeof i?.name?i.name:void 0;void 0!==r&&e.set("mcp-name",eW(r))}_isModernEnvelopedRequest(e){if(Array.isArray(e)||!eM(e))return!1;let t=e.params?._meta?.[R.jr];return"string"==typeof t&&t>=E}async _startOrAuthSse(e,t=!1,o=0){let{resumptionToken:i,requestSignal:r}=e,n=()=>this._abortController?.signal.aborted===!0||r?.aborted===!0;try{let n=await this._commonHeaders(),a=[...n.get("accept")?.split(",").map(e=>e.trim().toLowerCase())??[],"text/event-stream"];n.set("accept",[...new Set(a)].join(", ")),i&&n.set("last-event-id",i);let s=this._abortController?.signal,l=void 0!==r&&void 0!==s?oU(s,r):r??s,c=await (this._fetch??fetch)(this._url,{...this._requestInit,method:"GET",headers:n,signal:l});if(!c.ok){if(401===c.status&&this._authProvider){if(c.headers.has("www-authenticate")){let{resourceMetadataUrl:e,scope:t}=or(c);this._resourceMetadataUrl=e,this._scope=t5(this._scope,t)}if(this._authProvider.onUnauthorized&&!t){try{await this._authProvider.onUnauthorized({response:c,serverUrl:this._url,fetchFn:this._fetchWithInit})}catch(e){throw oP(e)}return await c.text?.().catch(()=>{}),this._startOrAuthSse(e,!0,o)}if(await c.text?.().catch(()=>{}),t)throw oP(new $(O.ClientHttpAuthentication,"Server returned 401 after re-authentication",{status:401,statusText:c.statusText}));throw oP(new t2)}if(403===c.status){let{resourceMetadataUrl:i,scope:r,error:n,errorDescription:a}=or(c);if("insufficient_scope"===n){let n=await c.text?.().catch(()=>null);if(await this._stepUpAuthorize({scope:r,resourceMetadataUrl:i,errorDescription:a,statusText:c.statusText,text:n},o)!=="AUTHORIZED")throw oP(new t2);return this._startOrAuthSse(e,t,o+1)}}if(await c.text?.().catch(()=>{}),405===c.status)return void e.onRequestStreamEnd?.();throw new $(O.ClientHttpFailedToOpenStream,`Failed to open SSE stream: ${c.statusText}`,{status:c.status,statusText:c.statusText})}this._handleSseStream(c.body,e,!0)}catch(e){throw n()||this.onerror?.(e),e}}_getNextReconnectionDelay(e){return void 0!==this._serverRetryMs?this._serverRetryMs:Math.min(this._reconnectionOptions.initialReconnectionDelay*Math.pow(this._reconnectionOptions.reconnectionDelayGrowFactor,e),this._reconnectionOptions.maxReconnectionDelay)}_scheduleReconnection(e,t=0){let o=this._reconnectionOptions.maxRetries;if(t>=o){this.onerror?.(Error(`Maximum reconnection attempts (${o}) exceeded.`)),e.onRequestStreamEnd?.();return}let i=this._getNextReconnectionDelay(t),r=()=>{this._cancelReconnection=void 0,this._abortController?.signal.aborted||e.requestSignal?.aborted||this._startOrAuthSse(e).catch(o=>{if(!(this._abortController?.signal.aborted||e.requestSignal?.aborted)){this.onerror?.(Error(`Failed to reconnect SSE stream: ${o instanceof Error?o.message:String(o)}`));try{this._scheduleReconnection(e,t+1)}catch(e){this.onerror?.(e instanceof Error?e:Error(String(e)))}}})};if(this._reconnectionScheduler){let e=this._reconnectionScheduler(r,i,t);this._cancelReconnection="function"==typeof e?e:void 0}else{let e=setTimeout(r,i);this._cancelReconnection=()=>clearTimeout(e)}}_handleSseStream(e,t,o){let i;if(!e)return void t.onRequestStreamEnd?.();let{onresumptiontoken:r,replayMessageId:n,requestSignal:a,onRequestStreamEnd:s}=t,l=()=>this._abortController?.signal.aborted===!0||a?.aborted===!0,c=!1,u=!1;(async()=>{try{let t=e.pipeThrough(new TextDecoderStream).pipeThrough(new tD({onRetry:e=>{this._serverRetryMs=e}})).getReader();for(;;){let{value:e,done:o}=await t.read();if(o)break;if(e.id&&(i=e.id,c=!0,r?.(e.id)),e.data&&(!e.event||"message"===e.event))try{let t=R.bt.parse(JSON.parse(e.data));(eL(t)||eN(t))&&(u=!0,void 0!==n&&(t.id=n)),this.onmessage?.(t)}catch(e){this.onerror?.(e)}}(o||c)&&!u&&this._abortController&&!l()?this._scheduleReconnection({resumptionToken:i,onresumptiontoken:r,replayMessageId:n,requestSignal:a,onRequestStreamEnd:s},0):l()||s?.()}catch(e){if(l())return;if(this.onerror?.(Error(`SSE stream disconnected: ${e}`)),(o||c)&&!u&&this._abortController&&!l())try{this._scheduleReconnection({resumptionToken:i,onresumptiontoken:r,replayMessageId:n,requestSignal:a,onRequestStreamEnd:s},0)}catch(e){this.onerror?.(Error(`Failed to reconnect: ${e instanceof Error?e.message:String(e)}`)),s?.()}else s?.()}})()}async start(){if(this._abortController)throw Error("StreamableHTTPClientTransport already started! If using Client class, note that connect() calls start() automatically.");this._abortController=new AbortController}async finishAuth(e,t){if(!this._oauthProvider)throw new t2("finishAuth requires an OAuthClientProvider");let{authorizationCode:o,iss:i}=await t3(e,t,this._oauthProvider,this._url,{fetchFn:this._fetchWithInit,resourceMetadataUrl:this._resourceMetadataUrl});if(await ot(this._oauthProvider,{serverUrl:this._url,authorizationCode:o,iss:i,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit,skipIssuerMetadataValidation:this._skipIssuerMetadataValidation})!=="AUTHORIZED")throw new t2("Failed to authorize")}async close(){try{this._cancelReconnection?.()}finally{this._cancelReconnection=void 0,this._abortController?.abort(),this.onclose?.()}}async send(e,t){return this._send(e,t,!1)}async _send(e,t,o,i=0){try{let{resumptionToken:r,onresumptiontoken:n}=t||{};if(r)return void this._startOrAuthSse({resumptionToken:r,replayMessageId:eM(e)?e.id:void 0,requestSignal:t?.requestSignal}).catch(e=>this.onerror?.(e));let a=await this._commonHeaders();this._applyBodyDerivedHeaders(a,e);let s=Array.isArray(e)?e.some(e=>eU(e)):eU(e);if(s&&a.delete("mcp-session-id"),t?.headers!==void 0)for(let[e,o]of Object.entries(t.headers))oA.has(e.toLowerCase())||a.set(e,o);a.set("content-type","application/json");let l=[...a.get("accept")?.split(",").map(e=>e.trim().toLowerCase())??[],"application/json","text/event-stream"];a.set("accept",[...new Set(l)].join(", "));let c=this._abortController?.signal,u=t?.requestSignal!==void 0&&void 0!==c?oU(c,t.requestSignal):t?.requestSignal??c,d={...this._requestInit,method:"POST",headers:a,body:JSON.stringify(e),signal:u},p=await (this._fetch??fetch)(this._url,d);if(s&&p.ok&&(this._sessionId=p.headers.get("mcp-session-id")||void 0),!p.ok){if(401===p.status&&this._authProvider){if(p.headers.has("www-authenticate")){let{resourceMetadataUrl:e,scope:t}=or(p);this._resourceMetadataUrl=e,this._scope=t5(this._scope,t)}if(this._authProvider.onUnauthorized&&!o){try{await this._authProvider.onUnauthorized({response:p,serverUrl:this._url,fetchFn:this._fetchWithInit})}catch(e){throw oP(e)}return await p.text?.().catch(()=>{}),this._send(e,t,!0,i)}if(await p.text?.().catch(()=>{}),o)throw oP(new $(O.ClientHttpAuthentication,"Server returned 401 after re-authentication",{status:401,statusText:p.statusText}));throw oP(new t2)}let r=await p.text?.().catch(()=>null);if(403===p.status){let{resourceMetadataUrl:n,scope:a,error:s,errorDescription:l}=or(p);if("insufficient_scope"===s){if(await this._stepUpAuthorize({scope:a,resourceMetadataUrl:n,errorDescription:l,statusText:p.statusText,text:r},i)!=="AUTHORIZED")throw oP(new t2);return this._send(e,t,o,i+1)}}if(400===p.status&&"string"==typeof r&&this._isModernEnvelopedRequest(e))try{let t=R.bt.parse(JSON.parse(r)),o=(Array.isArray(e)?e:[e]).filter(e=>eM(e));if(eN(t)&&o.some(e=>e.id===t.id))return void this.onmessage?.(t)}catch{}throw new $(O.ClientHttpNotImplemented,`Error POSTing to endpoint: ${r}`,{status:p.status,statusText:p.statusText,text:r})}if(202===p.status){await p.text?.().catch(()=>{}),R.gt.safeParse(e).success&&this._startOrAuthSse({resumptionToken:void 0}).catch(e=>this.onerror?.(e));return}let h=(Array.isArray(e)?e:[e]).some(e=>"method"in e&&"id"in e&&void 0!==e.id),m=p.headers.get("content-type"),f=function(e){if(e)try{return tf.parse(e).type}catch{let t=(e.split(";",1)[0]??"").trim().toLowerCase();if(""===t||e.slice(t.length).includes(","))return;return t}}(m);if(h)if("text/event-stream"===f)this._handleSseStream(p.body,{onresumptiontoken:n,requestSignal:t?.requestSignal,onRequestStreamEnd:t?.onRequestStreamEnd},!1);else if("application/json"===f){let e=await p.json();for(let t of Array.isArray(e)?e.map(e=>R.bt.parse(e)):[R.bt.parse(e)])this.onmessage?.(t)}else throw await p.text?.().catch(()=>{}),new T(O.ClientHttpUnexpectedContent,`Unexpected content type: ${m}`,{contentType:m});else await p.text?.().catch(()=>{})}catch(e){throw t?.requestSignal?.aborted!==!0&&this.onerror?.(e),e}}get sessionId(){return this._sessionId}async terminateSession(){if(this._sessionId)try{let e=await this._commonHeaders(),t={...this._requestInit,method:"DELETE",headers:e,signal:this._abortController?.signal},o=await (this._fetch??fetch)(this._url,t);if(await o.text?.().catch(()=>{}),!o.ok&&405!==o.status)throw new $(O.ClientHttpFailedToTerminateSession,`Failed to terminate session: ${o.statusText}`,{status:o.status,statusText:o.statusText});this._sessionId=void 0}catch(e){throw this.onerror?.(e),e}}setProtocolVersion(e){this._protocolVersion=e}get protocolVersion(){return this._protocolVersion}async resumeStream(e,t){await this._startOrAuthSse({resumptionToken:e,onresumptiontoken:t?.onresumptiontoken})}}},308(e,t,o){var i=o(476);let r="2025-11-25",n=[r,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],a="io.modelcontextprotocol/serverInfo",s="io.modelcontextprotocol/subscriptionId",l=i.RZV(()=>i.KCZ([i.YjP(),i.aig(),i.zMY(),i.chJ(),i.g1P(i.YjP(),l),i.YOg(l)])),c=i.g1P(i.YjP(),l),u=i.YOg(l),d=i.KCZ([i.YjP(),i.aig().int()]),p=i.YjP(),h=i.Ikc({ttl:i.aig().optional()}),m=i.Ikc({taskId:i.YjP()}),f=i._H3({progressToken:d.optional(),"io.modelcontextprotocol/related-task":m.optional()}),g=i.Ikc({_meta:f.optional()}),v=g.extend({task:h.optional()}),_=i.Ikc({method:i.YjP(),params:g.loose().optional()}),y=i.Ikc({_meta:f.optional()}),S=i.Ikc({method:i.YjP(),params:y.loose().optional()}),b=i._H3({get[a](){return E.optional().catch(void 0)}}),k=i._H3({_meta:b.optional()}),P=i.KCZ([i.YjP(),i.aig().int()]),w=i.Ikc({jsonrpc:i.euz("2.0"),id:P,..._.shape}).strict(),z=i.Ikc({jsonrpc:i.euz("2.0"),...S.shape}).strict(),R=i.Ikc({jsonrpc:i.euz("2.0"),id:P,result:k}).strict(),I=i.Ikc({jsonrpc:i.euz("2.0"),id:P.optional(),error:i.Ikc({code:i.aig().int(),message:i.YjP(),data:i.L5J().optional()})}).strict(),j=i.KCZ([w,z,R,I]),x=i.KCZ([R,I]),C=k.strict(),q=y.extend({requestId:P.optional(),reason:i.YjP().optional()}),Y=S.extend({method:i.euz("notifications/cancelled"),params:q}),O=i.Ikc({src:i.YjP(),mimeType:i.YjP().optional(),sizes:i.YOg(i.YjP()).optional(),theme:i.k5n(["light","dark"]).optional()}),T=i.Ikc({icons:i.YOg(O).optional()}),$=i.Ikc({name:i.YjP(),title:i.YjP().optional()}),E=$.extend({...$.shape,...T.shape,version:i.YjP(),websiteUrl:i.YjP().optional(),description:i.YjP().optional()}),M=i.E$q(i.Ikc({applyDefaults:i.zMY().optional()}),c),L=i.vkY(e=>e&&"object"==typeof e&&!Array.isArray(e)&&0===Object.keys(e).length?{form:{}}:e,i.E$q(i.Ikc({form:M.optional(),url:c.optional()}),c.optional())),N=i._H3({list:c.optional(),cancel:c.optional(),requests:i._H3({sampling:i._H3({createMessage:c.optional()}).optional(),elicitation:i._H3({create:c.optional()}).optional()}).optional()}),A=i._H3({list:c.optional(),cancel:c.optional(),requests:i._H3({tools:i._H3({call:c.optional()}).optional()}).optional()}),U=i.Ikc({experimental:i.g1P(i.YjP(),c).optional(),sampling:i.Ikc({context:c.optional(),tools:c.optional()}).optional(),elicitation:L.optional(),roots:i.Ikc({listChanged:i.zMY().optional()}).optional(),tasks:N.optional(),extensions:i.g1P(i.YjP(),c).optional()}),H=g.extend({protocolVersion:i.YjP(),capabilities:U,clientInfo:E}),Z=_.extend({method:i.euz("initialize"),params:H}),V=i.Ikc({experimental:i.g1P(i.YjP(),c).optional(),logging:c.optional(),completions:c.optional(),prompts:i.Ikc({listChanged:i.zMY().optional()}).optional(),resources:i.Ikc({subscribe:i.zMY().optional(),listChanged:i.zMY().optional()}).optional(),tools:i.Ikc({listChanged:i.zMY().optional()}).optional(),tasks:A.optional(),extensions:i.g1P(i.YjP(),c).optional()}),J=k.extend({protocolVersion:i.YjP(),capabilities:V,serverInfo:E,instructions:i.YjP().optional()}),D=S.extend({method:i.euz("notifications/initialized"),params:y.optional()}),F=_.extend({method:i.euz("server/discover"),params:g.optional()}),K=k.extend({supportedVersions:i.YOg(i.YjP()),capabilities:V,instructions:i.YjP().optional()}),B=_.extend({method:i.euz("ping"),params:g.optional()}),W=i.Ikc({progress:i.aig(),total:i.lqM(i.aig()),message:i.lqM(i.YjP())}),G=i.Ikc({...y.shape,...W.shape,progressToken:d}),X=S.extend({method:i.euz("notifications/progress"),params:G}),Q=g.extend({cursor:p.optional()}),ee=_.extend({params:Q.optional()}),et=k.extend({nextCursor:p.optional()}),eo=i.Ikc({uri:i.YjP(),mimeType:i.lqM(i.YjP()),_meta:i.g1P(i.YjP(),i.L5J()).optional()}),ei=eo.extend({text:i.YjP()}),er=i.YjP().refine(e=>{try{return atob(e),!0}catch{return!1}},{message:"Invalid Base64 string"}),en=eo.extend({blob:er}),ea=i.k5n(["user","assistant"]),es=i.Ikc({audience:i.YOg(ea).optional(),priority:i.aig().min(0).max(1).optional(),lastModified:i.KH5.w$({offset:!0}).optional()}),el=i.Ikc({...$.shape,...T.shape,uri:i.YjP(),description:i.lqM(i.YjP()),mimeType:i.lqM(i.YjP()),size:i.lqM(i.aig()),annotations:es.optional(),_meta:i.lqM(i._H3({}))}),ec=i.Ikc({...$.shape,...T.shape,uriTemplate:i.YjP(),description:i.lqM(i.YjP()),mimeType:i.lqM(i.YjP()),annotations:es.optional(),_meta:i.lqM(i._H3({}))}),eu=ee.extend({method:i.euz("resources/list")}),ed=et.extend({resources:i.YOg(el)}),ep=ee.extend({method:i.euz("resources/templates/list")}),eh=et.extend({resourceTemplates:i.YOg(ec)}),em=g.extend({uri:i.YjP()}),ef=_.extend({method:i.euz("resources/read"),params:em}),eg=k.extend({contents:i.YOg(i.KCZ([ei,en]))}),ev=S.extend({method:i.euz("notifications/resources/list_changed"),params:y.optional()}),e_=_.extend({method:i.euz("resources/subscribe"),params:em}),ey=_.extend({method:i.euz("resources/unsubscribe"),params:em}),eS=i.Ikc({toolsListChanged:i.zMY().optional(),promptsListChanged:i.zMY().optional(),resourcesListChanged:i.zMY().optional(),resourceSubscriptions:i.YOg(i.YjP()).optional()}),eb=g.extend({notifications:eS}),ek=_.extend({method:i.euz("subscriptions/listen"),params:eb}),eP=y.extend({notifications:eS}),ew=S.extend({method:i.euz("notifications/subscriptions/acknowledged"),params:eP}),ez=b.extend({[s]:P}),eR=k.extend({_meta:ez}),eI=y.extend({uri:i.YjP()}),ej=S.extend({method:i.euz("notifications/resources/updated"),params:eI}),ex=i.Ikc({name:i.YjP(),description:i.lqM(i.YjP()),required:i.lqM(i.zMY())}),eC=i.Ikc({...$.shape,...T.shape,description:i.lqM(i.YjP()),arguments:i.lqM(i.YOg(ex)),_meta:i.lqM(i._H3({}))}),eq=ee.extend({method:i.euz("prompts/list")}),eY=et.extend({prompts:i.YOg(eC)}),eO=g.extend({name:i.YjP(),arguments:i.g1P(i.YjP(),i.YjP()).optional()}),eT=_.extend({method:i.euz("prompts/get"),params:eO}),e$=i.Ikc({type:i.euz("text"),text:i.YjP(),annotations:es.optional(),_meta:i.g1P(i.YjP(),i.L5J()).optional()}),eE=i.Ikc({type:i.euz("image"),data:er,mimeType:i.YjP(),annotations:es.optional(),_meta:i.g1P(i.YjP(),i.L5J()).optional()}),eM=i.Ikc({type:i.euz("audio"),data:er,mimeType:i.YjP(),annotations:es.optional(),_meta:i.g1P(i.YjP(),i.L5J()).optional()}),eL=i.Ikc({type:i.euz("tool_use"),name:i.YjP(),id:i.YjP(),input:i.g1P(i.YjP(),i.L5J()),_meta:i.g1P(i.YjP(),i.L5J()).optional()}),eN=i.Ikc({type:i.euz("resource"),resource:i.KCZ([ei,en]),annotations:es.optional(),_meta:i.g1P(i.YjP(),i.L5J()).optional()}),eA=el.extend({type:i.euz("resource_link")}),eU=i.KCZ([e$,eE,eM,eA,eN]),eH=i.Ikc({role:ea,content:eU}),eZ=k.extend({description:i.YjP().optional(),messages:i.YOg(eH)}),eV=S.extend({method:i.euz("notifications/prompts/list_changed"),params:y.optional()}),eJ=i.Ikc({title:i.YjP().optional(),readOnlyHint:i.zMY().optional(),destructiveHint:i.zMY().optional(),idempotentHint:i.zMY().optional(),openWorldHint:i.zMY().optional()}),eD=i.Ikc({taskSupport:i.k5n(["required","optional","forbidden"]).optional()}),eF=i.Ikc({...$.shape,...T.shape,description:i.YjP().optional(),inputSchema:i.Ikc({type:i.euz("object"),properties:i.g1P(i.YjP(),l).optional(),required:i.YOg(i.YjP()).optional()}).catchall(i.L5J()),outputSchema:i._H3({$schema:i.YjP().optional()}).optional(),annotations:eJ.optional(),execution:eD.optional(),_meta:i.g1P(i.YjP(),i.L5J()).optional()}),eK=ee.extend({method:i.euz("tools/list")}),eB=et.extend({tools:i.YOg(eF)}),eW=k.extend({content:i.YOg(eU).default([]),structuredContent:i.L5J().optional(),isError:i.zMY().optional()}),eG=eW.or(k.extend({toolResult:i.L5J()})),eX=v.extend({name:i.YjP(),arguments:i.g1P(i.YjP(),i.L5J()).optional()}),eQ=_.extend({method:i.euz("tools/call"),params:eX}),e0=S.extend({method:i.euz("notifications/tools/list_changed"),params:y.optional()}),e1=i.Ikc({autoRefresh:i.zMY().default(!0),debounceMs:i.aig().int().nonnegative().default(300)}),e2=i.k5n(["debug","info","notice","warning","error","critical","alert","emergency"]),e9=g.extend({level:e2}),e4=_.extend({method:i.euz("logging/setLevel"),params:e9}),e5=y.extend({level:e2,logger:i.YjP().optional(),data:i.L5J()}),e3=S.extend({method:i.euz("notifications/message"),params:e5}),e6=i.Ikc({name:i.YjP().optional()}),e8=i.Ikc({hints:i.YOg(e6).optional(),costPriority:i.aig().min(0).max(1).optional(),speedPriority:i.aig().min(0).max(1).optional(),intelligencePriority:i.aig().min(0).max(1).optional()}),e7=i.Ikc({mode:i.k5n(["auto","required","none"]).optional()}),te=i.Ikc({type:i.euz("tool_result"),toolUseId:i.YjP().describe("The unique identifier for the corresponding tool call."),content:i.YOg(eU),structuredContent:i.L5J().optional(),isError:i.zMY().optional(),_meta:i.g1P(i.YjP(),i.L5J()).optional()}),tt=i.gMt("type",[e$,eE,eM]),to=i.gMt("type",[e$,eE,eM,eL,te]),ti=i.Ikc({role:ea,content:i.KCZ([to,i.YOg(to)]),_meta:i.g1P(i.YjP(),i.L5J()).optional()}),tr=v.extend({messages:i.YOg(ti),modelPreferences:e8.optional(),systemPrompt:i.YjP().optional(),includeContext:i.k5n(["none","thisServer","allServers"]).optional(),temperature:i.aig().optional(),maxTokens:i.aig().int(),stopSequences:i.YOg(i.YjP()).optional(),metadata:c.optional(),tools:i.YOg(eF).optional(),toolChoice:e7.optional()}),tn=_.extend({method:i.euz("sampling/createMessage"),params:tr}),ta=k.extend({model:i.YjP(),stopReason:i.lqM(i.k5n(["endTurn","stopSequence","maxTokens"]).or(i.YjP())),role:ea,content:tt}),ts=k.extend({model:i.YjP(),stopReason:i.lqM(i.k5n(["endTurn","stopSequence","maxTokens","toolUse"]).or(i.YjP())),role:ea,content:i.KCZ([to,i.YOg(to)])}),tl=i.Ikc({type:i.euz("boolean"),title:i.YjP().optional(),description:i.YjP().optional(),default:i.zMY().optional()}),tc=i.Ikc({type:i.euz("string"),title:i.YjP().optional(),description:i.YjP().optional(),minLength:i.aig().optional(),maxLength:i.aig().optional(),format:i.k5n(["email","uri","date","date-time"]).optional(),default:i.YjP().optional()}),tu=i.Ikc({type:i.k5n(["number","integer"]),title:i.YjP().optional(),description:i.YjP().optional(),minimum:i.aig().optional(),maximum:i.aig().optional(),default:i.aig().optional()}),td=i.Ikc({type:i.euz("string"),title:i.YjP().optional(),description:i.YjP().optional(),enum:i.YOg(i.YjP()),default:i.YjP().optional()}),tp=i.Ikc({type:i.euz("string"),title:i.YjP().optional(),description:i.YjP().optional(),oneOf:i.YOg(i.Ikc({const:i.YjP(),title:i.YjP()})),default:i.YjP().optional()}),th=i.Ikc({type:i.euz("string"),title:i.YjP().optional(),description:i.YjP().optional(),enum:i.YOg(i.YjP()),enumNames:i.YOg(i.YjP()).optional(),default:i.YjP().optional()}),tm=i.KCZ([td,tp]),tf=i.Ikc({type:i.euz("array"),title:i.YjP().optional(),description:i.YjP().optional(),minItems:i.aig().optional(),maxItems:i.aig().optional(),items:i.Ikc({type:i.euz("string"),enum:i.YOg(i.YjP())}),default:i.YOg(i.YjP()).optional()}),tg=i.Ikc({type:i.euz("array"),title:i.YjP().optional(),description:i.YjP().optional(),minItems:i.aig().optional(),maxItems:i.aig().optional(),items:i.Ikc({anyOf:i.YOg(i.Ikc({const:i.YjP(),title:i.YjP()}))}),default:i.YOg(i.YjP()).optional()}),tv=i.KCZ([tf,tg]),t_=i.KCZ([th,tm,tv]),ty=i.KCZ([t_,tl,tc,tu]),tS=v.extend({mode:i.euz("form").optional(),message:i.YjP(),requestedSchema:i.Ikc({type:i.euz("object"),properties:i.g1P(i.YjP(),ty),required:i.YOg(i.YjP()).optional()}).catchall(i.L5J())}),tb=v.extend({mode:i.euz("url"),message:i.YjP(),elicitationId:i.YjP(),url:i.YjP().url()}),tk=i.KCZ([tS,tb]),tP=_.extend({method:i.euz("elicitation/create"),params:tk}),tw=y.extend({elicitationId:i.YjP()}),tz=S.extend({method:i.euz("notifications/elicitation/complete"),params:tw}),tR=k.extend({action:i.k5n(["accept","decline","cancel"]),content:i.vkY(e=>null===e?void 0:e,i.g1P(i.YjP(),i.KCZ([i.YjP(),i.aig(),i.zMY(),i.YOg(i.YjP())])).optional())}),tI=i.Ikc({type:i.euz("ref/resource"),uri:i.YjP()}),tj=i.Ikc({type:i.euz("ref/prompt"),name:i.YjP()}),tx=g.extend({ref:i.KCZ([tj,tI]),argument:i.Ikc({name:i.YjP(),value:i.YjP()}),context:i.Ikc({arguments:i.g1P(i.YjP(),i.YjP()).optional()}).optional()}),tC=_.extend({method:i.euz("completion/complete"),params:tx}),tq=k.extend({completion:i._H3({values:i.YOg(i.YjP()).max(100),total:i.lqM(i.aig().int()),hasMore:i.lqM(i.zMY())})}),tY=i.Ikc({uri:i.YjP().startsWith("file://"),name:i.YjP().optional(),_meta:i.g1P(i.YjP(),i.L5J()).optional()}),tO=_.extend({method:i.euz("roots/list"),params:g.optional()}),tT=k.extend({roots:i.YOg(tY)}),t$=S.extend({method:i.euz("notifications/roots/list_changed"),params:y.optional()}),tE=i._H3({ttl:i.aig().optional(),pollInterval:i.aig().optional()}),tM=i.k5n(["working","input_required","completed","failed","cancelled"]),tL=i.Ikc({taskId:i.YjP(),status:tM,ttl:i.KCZ([i.aig(),i.chJ()]),createdAt:i.YjP(),lastUpdatedAt:i.YjP(),pollInterval:i.lqM(i.aig()),statusMessage:i.lqM(i.YjP())}),tN=k.extend({task:tL}),tA=y.merge(tL),tU=S.extend({method:i.euz("notifications/tasks/status"),params:tA}),tH=_.extend({method:i.euz("tasks/get"),params:g.extend({taskId:i.YjP()})}),tZ=k.merge(tL),tV=_.extend({method:i.euz("tasks/result"),params:g.extend({taskId:i.YjP()})}),tJ=k.loose(),tD=ee.extend({method:i.euz("tasks/list")}),tF=et.extend({tasks:i.YOg(tL)}),tK=_.extend({method:i.euz("tasks/cancel"),params:g.extend({taskId:i.YjP()})}),tB=k.merge(tL),tW=i.KCZ([B,Z,F,tC,e4,eT,eq,eu,ep,ef,e_,ey,ek,eQ,eK]),tG=i.KCZ([Y,X,D,t$]),tX=i.KCZ([C,ta,ts,tR,tT]),tQ=i.KCZ([B,tn,tP,tO]),t0=i.KCZ([Y,X,e3,ej,ev,e0,eV,ew,tz]),t1=i.KCZ([C,J,K,tq,eZ,eY,ed,eh,eg,eW,eB,eR]),t2=i.OZ5().superRefine((e,t)=>{if(!URL.canParse(e))return t.addIssue({code:i.eqx.custom,message:"URL must be parseable",fatal:!0}),i.tmp}).refine(e=>{let t=new URL(e);return"javascript:"!==t.protocol&&"data:"!==t.protocol&&"vbscript:"!==t.protocol},{message:"URL cannot use javascript:, data:, or vbscript: scheme"}),t9=i._H3({resource:i.YjP().url(),authorization_servers:i.YOg(t2).optional(),jwks_uri:i.YjP().url().optional(),scopes_supported:i.YOg(i.YjP()).optional(),bearer_methods_supported:i.YOg(i.YjP()).optional(),resource_signing_alg_values_supported:i.YOg(i.YjP()).optional(),resource_name:i.YjP().optional(),resource_documentation:i.YjP().optional(),resource_policy_uri:i.YjP().url().optional(),resource_tos_uri:i.YjP().url().optional(),tls_client_certificate_bound_access_tokens:i.zMY().optional(),authorization_details_types_supported:i.YOg(i.YjP()).optional(),dpop_signing_alg_values_supported:i.YOg(i.YjP()).optional(),dpop_bound_access_tokens_required:i.zMY().optional()}),t4=i._H3({issuer:i.YjP(),authorization_endpoint:t2,token_endpoint:t2,registration_endpoint:t2.optional(),scopes_supported:i.YOg(i.YjP()).optional(),response_types_supported:i.YOg(i.YjP()),response_modes_supported:i.YOg(i.YjP()).optional(),grant_types_supported:i.YOg(i.YjP()).optional(),token_endpoint_auth_methods_supported:i.YOg(i.YjP()).optional(),token_endpoint_auth_signing_alg_values_supported:i.YOg(i.YjP()).optional(),service_documentation:t2.optional(),revocation_endpoint:t2.optional(),revocation_endpoint_auth_methods_supported:i.YOg(i.YjP()).optional(),revocation_endpoint_auth_signing_alg_values_supported:i.YOg(i.YjP()).optional(),introspection_endpoint:i.YjP().optional(),introspection_endpoint_auth_methods_supported:i.YOg(i.YjP()).optional(),introspection_endpoint_auth_signing_alg_values_supported:i.YOg(i.YjP()).optional(),code_challenge_methods_supported:i.YOg(i.YjP()).optional(),client_id_metadata_document_supported:i.zMY().optional(),authorization_response_iss_parameter_supported:i.zMY().optional().catch(void 0)}),t5=i._H3({issuer:i.YjP(),authorization_endpoint:t2,token_endpoint:t2,userinfo_endpoint:t2.optional(),jwks_uri:t2,registration_endpoint:t2.optional(),scopes_supported:i.YOg(i.YjP()).optional(),response_types_supported:i.YOg(i.YjP()),response_modes_supported:i.YOg(i.YjP()).optional(),grant_types_supported:i.YOg(i.YjP()).optional(),acr_values_supported:i.YOg(i.YjP()).optional(),subject_types_supported:i.YOg(i.YjP()),id_token_signing_alg_values_supported:i.YOg(i.YjP()),id_token_encryption_alg_values_supported:i.YOg(i.YjP()).optional(),id_token_encryption_enc_values_supported:i.YOg(i.YjP()).optional(),userinfo_signing_alg_values_supported:i.YOg(i.YjP()).optional(),userinfo_encryption_alg_values_supported:i.YOg(i.YjP()).optional(),userinfo_encryption_enc_values_supported:i.YOg(i.YjP()).optional(),request_object_signing_alg_values_supported:i.YOg(i.YjP()).optional(),request_object_encryption_alg_values_supported:i.YOg(i.YjP()).optional(),request_object_encryption_enc_values_supported:i.YOg(i.YjP()).optional(),token_endpoint_auth_methods_supported:i.YOg(i.YjP()).optional(),token_endpoint_auth_signing_alg_values_supported:i.YOg(i.YjP()).optional(),display_values_supported:i.YOg(i.YjP()).optional(),claim_types_supported:i.YOg(i.YjP()).optional(),claims_supported:i.YOg(i.YjP()).optional(),service_documentation:i.YjP().optional(),claims_locales_supported:i.YOg(i.YjP()).optional(),ui_locales_supported:i.YOg(i.YjP()).optional(),claims_parameter_supported:i.zMY().optional(),request_parameter_supported:i.zMY().optional(),request_uri_parameter_supported:i.zMY().optional(),require_request_uri_registration:i.zMY().optional(),op_policy_uri:t2.optional(),op_tos_uri:t2.optional(),client_id_metadata_document_supported:i.zMY().optional(),authorization_response_iss_parameter_supported:i.zMY().optional().catch(void 0)}),t3=i.Ikc({...t5.shape,...t4.pick({code_challenge_methods_supported:!0}).shape}),t6=i.Ikc({access_token:i.YjP(),id_token:i.YjP().optional(),token_type:i.YjP(),expires_in:i.auy.ai().optional(),scope:i.YjP().optional(),refresh_token:i.YjP().optional()}).strip(),t8=i.Ikc({issued_token_type:i.euz("urn:ietf:params:oauth:token-type:id-jag"),access_token:i.YjP(),token_type:i.YjP().optional(),expires_in:i.aig().optional(),scope:i.YjP().optional()}).strip(),t7=i.Ikc({error:i.YjP(),error_description:i.YjP().optional(),error_uri:i.YjP().optional()}),oe=t2.optional().or(i.euz("").transform(()=>void 0)),ot=i.Ikc({redirect_uris:i.YOg(t2),token_endpoint_auth_method:i.YjP().optional(),grant_types:i.YOg(i.YjP()).optional(),response_types:i.YOg(i.YjP()).optional(),application_type:i.YjP().optional(),client_name:i.YjP().optional(),client_uri:t2.optional(),logo_uri:oe,scope:i.YjP().optional(),contacts:i.YOg(i.YjP()).optional(),tos_uri:oe,policy_uri:i.YjP().optional(),jwks_uri:t2.optional(),jwks:i.bzn().optional(),software_id:i.YjP().optional(),software_version:i.YjP().optional(),software_statement:i.YjP().optional()}).strip(),oo=i.Ikc({client_id:i.YjP(),client_secret:i.YjP().optional(),client_id_issued_at:i.aig().optional(),client_secret_expires_at:i.aig().optional()}).strip(),oi=ot.merge(oo),or=i.Ikc({error:i.YjP(),error_description:i.YjP().optional()}).strip(),on=i.Ikc({token:i.YjP(),token_type_hint:i.YjP().optional()}).strip();o.d(t,{},{$:eN,$n:h,$t:ty,A:tW,An:tt,At:ep,B:ta,Bn:tm,Bt:e2,C:eW,Cn:eI,Ct:x,D:Y,Dn:ea,Dr:r,Dt:e1,E:q,En:k,Et:th,F:tC,Fn:tQ,Fr:n,Ft:tT,G:K,Gn:eP,Gt:tv,H:tN,Hn:em,Ht:e3,I:tq,In:t1,It:tD,J:tP,Jn:ek,Jt:tu,K:tS,Kn:ew,Kt:S,L:eU,Ln:A,Lt:tF,M:N,Mn:ti,Mt:eu,N:eG,Nn:V,Nr:a,Nt:ed,O:U,On:tY,Or:"io.modelcontextprotocol/logLevel",Ot:eq,P:tx,Pn:t0,Pr:s,Pt:tO,Q:tz,Qn:tE,Qt:B,R:tr,Rn:e9,Rt:eK,S:eQ,Sn:ec,St:w,T:tB,Tn:b,Tt:l,U:p,Un:e_,Ut:e6,V:ts,Vn:tc,Vt:e5,W:F,Wn:eS,Wt:e8,X:tR,Xn:eR,Xt:ee,Y:tb,Yn:ez,Yt:Q,Z:tw,Zn:v,Zt:et,_:$,_n:eA,_r:tf,_t:u,a:or,an:eV,ar:ei,at:tV,b:tl,bn:el,br:"io.modelcontextprotocol/clientCapabilities",bt:j,c:t9,cn:eC,cr:eJ,ct:tZ,d:t3,dn:eg,dr:e0,dt:eE,en:G,er:tL,et:C,f:t5,fn:m,fr:te,ft:E,g:eM,gn:eo,gr:ey,gt:D,h:es,hn:_,hr:em,ht:J,i:ot,in:ex,ir:e$,it:eZ,j:tX,jn:to,jr:"io.modelcontextprotocol/protocolVersion",jt:eh,k:tG,kn:t$,kt:eY,l:on,ln:em,lr:e7,lt:O,mn:f,mr:eL,mt:Z,n:oi,nn:W,nr:tU,nt:eO,o:t7,on:eH,or:tg,ot:tJ,pn:P,pr:eF,pt:H,q:tk,qn:eb,qt:y,r:oo,rn:d,rr:tM,rt:eT,s:t4,sn:tj,sr:tp,st:tH,t:t8,tn:X,tr:tA,tt:t_,u:t6,un:ef,ur:eD,ut:T,v:g,vn:ev,vr:td,vt:c,w:tK,wn:ej,wt:R,x:eX,xn:tI,xr:"io.modelcontextprotocol/clientInfo",xt:z,y:en,yn:em,yt:I,z:tn,zn:e4,zt:eB})},566(e,t,o){o.d(t,{T1:()=>V,hJ:()=>U,fU:()=>A,Bv:()=>H});var i=o(306),r=o(308),n=o(476);class a{_eventSlots=new Map;setHandler(e,t){let o=this._ensureEventSlot(e);o.onHandler&&t&&console.warn(`[MCP Apps] on${String(e)} handler replaced. Use addEventListener("${String(e)}", …) to add multiple listeners without replacing.`),o.onHandler=t}getHandler(e){return this._eventSlots.get(e)?.onHandler}addEventListener(e,t){this._ensureEventSlot(e).listeners.push(t)}removeEventListener(e,t){let o=this._eventSlots.get(e);if(!o)return;let i=o.listeners.indexOf(t);-1!==i&&o.listeners.splice(i,1)}dispatch(e,t){let o=this._eventSlots.get(e);if(o)for(let e of(o.onHandler?.(t),[...o.listeners]))e(t)}_ensureEventSlot(e){let t=this._eventSlots.get(e);return t||(t={listeners:[]},this._eventSlots.set(e,t)),t}}class s{_methods=new Set;claim(e,t){if(this._methods.has(e))throw Error(`Handler for "${e}" already registered (via ${t}). Use addEventListener() to attach multiple listeners, or the on* setter for replace semantics.`);this._methods.add(e)}replace(e){this._methods.add(e)}release(e){this._methods.delete(e)}has(e){return this._methods.has(e)}}var l=new Set;function c(e,t){let[o,i]=t,r=o?.shape;if("string"!=typeof r?.method?.value)return;let n=r.method.value,a="request"===e?"setRequestHandler":"setNotificationHandler";return l.has(a)||(l.add(a),console.warn(`[ext-apps] ${a}(Schema, handler) is deprecated; use ${a}("${n}", { params: Schema.shape.params }, handler).`)),[n,{params:r.params},"request"===e?(e,t)=>i({method:n,params:e},{signal:t.mcpReq.signal,requestId:t.mcpReq.id,sessionId:t.sessionId,_meta:t.mcpReq._meta,sendRequest:t.mcpReq.send,sendNotification:t.mcpReq.notify,authInfo:t.http?.authInfo}):e=>i({method:n,params:e})]}var u="2026-01-26",d=n.z.KCZ([n.z.euz("light"),n.z.euz("dark")]).describe("Color theme preference for the host environment."),p=n.z.KCZ([n.z.euz("inline"),n.z.euz("fullscreen"),n.z.euz("pip")]).describe("Display mode for UI presentation."),h=n.z.KCZ([n.z.euz("--color-background-primary"),n.z.euz("--color-background-secondary"),n.z.euz("--color-background-tertiary"),n.z.euz("--color-background-inverse"),n.z.euz("--color-background-ghost"),n.z.euz("--color-background-info"),n.z.euz("--color-background-danger"),n.z.euz("--color-background-success"),n.z.euz("--color-background-warning"),n.z.euz("--color-background-disabled"),n.z.euz("--color-text-primary"),n.z.euz("--color-text-secondary"),n.z.euz("--color-text-tertiary"),n.z.euz("--color-text-inverse"),n.z.euz("--color-text-ghost"),n.z.euz("--color-text-info"),n.z.euz("--color-text-danger"),n.z.euz("--color-text-success"),n.z.euz("--color-text-warning"),n.z.euz("--color-text-disabled"),n.z.euz("--color-border-primary"),n.z.euz("--color-border-secondary"),n.z.euz("--color-border-tertiary"),n.z.euz("--color-border-inverse"),n.z.euz("--color-border-ghost"),n.z.euz("--color-border-info"),n.z.euz("--color-border-danger"),n.z.euz("--color-border-success"),n.z.euz("--color-border-warning"),n.z.euz("--color-border-disabled"),n.z.euz("--color-ring-primary"),n.z.euz("--color-ring-secondary"),n.z.euz("--color-ring-inverse"),n.z.euz("--color-ring-info"),n.z.euz("--color-ring-danger"),n.z.euz("--color-ring-success"),n.z.euz("--color-ring-warning"),n.z.euz("--font-sans"),n.z.euz("--font-mono"),n.z.euz("--font-weight-normal"),n.z.euz("--font-weight-medium"),n.z.euz("--font-weight-semibold"),n.z.euz("--font-weight-bold"),n.z.euz("--font-text-xs-size"),n.z.euz("--font-text-sm-size"),n.z.euz("--font-text-md-size"),n.z.euz("--font-text-lg-size"),n.z.euz("--font-heading-xs-size"),n.z.euz("--font-heading-sm-size"),n.z.euz("--font-heading-md-size"),n.z.euz("--font-heading-lg-size"),n.z.euz("--font-heading-xl-size"),n.z.euz("--font-heading-2xl-size"),n.z.euz("--font-heading-3xl-size"),n.z.euz("--font-text-xs-line-height"),n.z.euz("--font-text-sm-line-height"),n.z.euz("--font-text-md-line-height"),n.z.euz("--font-text-lg-line-height"),n.z.euz("--font-heading-xs-line-height"),n.z.euz("--font-heading-sm-line-height"),n.z.euz("--font-heading-md-line-height"),n.z.euz("--font-heading-lg-line-height"),n.z.euz("--font-heading-xl-line-height"),n.z.euz("--font-heading-2xl-line-height"),n.z.euz("--font-heading-3xl-line-height"),n.z.euz("--border-radius-xs"),n.z.euz("--border-radius-sm"),n.z.euz("--border-radius-md"),n.z.euz("--border-radius-lg"),n.z.euz("--border-radius-xl"),n.z.euz("--border-radius-full"),n.z.euz("--border-width-regular"),n.z.euz("--shadow-hairline"),n.z.euz("--shadow-sm"),n.z.euz("--shadow-md"),n.z.euz("--shadow-lg")]).describe("CSS variable keys available to MCP apps for theming."),m=n.z.g1P(h.describe(`Style variables for theming MCP apps.
|
|
13
|
+
|
|
14
|
+
Individual style keys are optional - hosts may provide any subset of these values.
|
|
15
|
+
Values are strings containing CSS values (colors, sizes, font stacks, etc.).
|
|
16
|
+
|
|
17
|
+
Note: This type uses \`Record<K, string | undefined>\` rather than \`Partial<Record<K, string>>\`
|
|
18
|
+
for compatibility with Zod schema generation. Both are functionally equivalent for validation.`),n.z.KCZ([n.z.YjP(),n.z.Vxk()]).describe(`Style variables for theming MCP apps.
|
|
19
|
+
|
|
20
|
+
Individual style keys are optional - hosts may provide any subset of these values.
|
|
21
|
+
Values are strings containing CSS values (colors, sizes, font stacks, etc.).
|
|
22
|
+
|
|
23
|
+
Note: This type uses \`Record<K, string | undefined>\` rather than \`Partial<Record<K, string>>\`
|
|
24
|
+
for compatibility with Zod schema generation. Both are functionally equivalent for validation.`)).describe(`Style variables for theming MCP apps.
|
|
25
|
+
|
|
26
|
+
Individual style keys are optional - hosts may provide any subset of these values.
|
|
27
|
+
Values are strings containing CSS values (colors, sizes, font stacks, etc.).
|
|
28
|
+
|
|
29
|
+
Note: This type uses \`Record<K, string | undefined>\` rather than \`Partial<Record<K, string>>\`
|
|
30
|
+
for compatibility with Zod schema generation. Both are functionally equivalent for validation.`),f=n.z.Ikc({method:n.z.euz("ui/open-link"),params:n.z.Ikc({url:n.z.YjP().describe("URL to open in the host's browser")})}),g=n.z.Ikc({isError:n.z.zMY().optional().describe("True if the host failed to open the URL (e.g., due to security policy).")}).passthrough(),v=n.z.Ikc({isError:n.z.zMY().optional().describe("True if the download failed (e.g., user cancelled or host denied).")}).passthrough(),_=n.z.Ikc({isError:n.z.zMY().optional().describe("True if the host rejected or failed to deliver the message.")}).passthrough(),y=n.z.Ikc({method:n.z.euz("ui/notifications/sandbox-proxy-ready"),params:n.z.Ikc({})}),S=n.z.Ikc({connectDomains:n.z.YOg(n.z.YjP()).optional().describe(`Origins for network requests (fetch/XHR/WebSocket).
|
|
31
|
+
|
|
32
|
+
- Maps to CSP \`connect-src\` directive
|
|
33
|
+
- Empty or omitted → no network connections (secure default)`),resourceDomains:n.z.YOg(n.z.YjP()).optional().describe("Origins for static resources (images, scripts, stylesheets, fonts, media).\n\n- Maps to CSP `img-src`, `script-src`, `style-src`, `font-src`, `media-src` directives\n- Wildcard subdomains supported: `https://*.example.com`\n- Empty or omitted → no network resources (secure default)"),frameDomains:n.z.YOg(n.z.YjP()).optional().describe("Origins for nested iframes.\n\n- Maps to CSP `frame-src` directive\n- Empty or omitted → no nested iframes allowed (`frame-src 'none'`)"),baseUriDomains:n.z.YOg(n.z.YjP()).optional().describe("Allowed base URIs for the document.\n\n- Maps to CSP `base-uri` directive\n- Empty or omitted → only same origin allowed (`base-uri 'self'`)")}),b=n.z.Ikc({camera:n.z.Ikc({}).optional().describe("Request camera access.\n\nMaps to Permission Policy `camera` feature."),microphone:n.z.Ikc({}).optional().describe("Request microphone access.\n\nMaps to Permission Policy `microphone` feature."),geolocation:n.z.Ikc({}).optional().describe("Request geolocation access.\n\nMaps to Permission Policy `geolocation` feature."),clipboardWrite:n.z.Ikc({}).optional().describe("Request clipboard write access.\n\nMaps to Permission Policy `clipboard-write` feature.")}),k=n.z.Ikc({method:n.z.euz("ui/notifications/size-changed"),params:n.z.Ikc({width:n.z.aig().optional().describe("New width in pixels."),height:n.z.aig().optional().describe("New height in pixels.")})}),P=(n.z.Ikc({method:n.z.euz("ui/notifications/tool-input"),params:n.z.Ikc({arguments:n.z.g1P(n.z.YjP(),n.z.L5J().describe("Complete tool call arguments as key-value pairs.")).optional().describe("Complete tool call arguments as key-value pairs.")})}),n.z.Ikc({method:n.z.euz("ui/notifications/tool-input-partial"),params:n.z.Ikc({arguments:n.z.g1P(n.z.YjP(),n.z.L5J().describe("Partial tool call arguments (incomplete, may change).")).optional().describe("Partial tool call arguments (incomplete, may change).")})}),n.z.Ikc({method:n.z.euz("ui/notifications/tool-cancelled"),params:n.z.Ikc({reason:n.z.YjP().optional().describe('Optional reason for the cancellation (e.g., "user action", "timeout").')})}),n.z.Ikc({fonts:n.z.YjP().optional()})),w=n.z.Ikc({variables:m.optional().describe("CSS variables for theming the app."),css:P.optional().describe("CSS blocks that apps can inject.")}),z=(n.z.Ikc({method:n.z.euz("ui/resource-teardown"),params:n.z.Ikc({})}),n.z.g1P(n.z.YjP(),n.z.L5J())),R=n.z.Ikc({text:n.z.Ikc({}).optional().describe("Host supports text content blocks."),image:n.z.Ikc({}).optional().describe("Host supports image content blocks."),audio:n.z.Ikc({}).optional().describe("Host supports audio content blocks."),resource:n.z.Ikc({}).optional().describe("Host supports resource content blocks."),resourceLink:n.z.Ikc({}).optional().describe("Host supports resource link content blocks."),structuredContent:n.z.Ikc({}).optional().describe("Host supports structured content.")}),I=n.z.Ikc({method:n.z.euz("ui/notifications/request-teardown"),params:n.z.Ikc({}).optional()}),j=n.z.Ikc({experimental:n.z.g1P(n.z.YjP(),n.z.g1P(n.z.YjP(),n.z.bzn()).describe("Experimental features keyed by identifier.")).optional().describe("Experimental features keyed by identifier."),openLinks:n.z.Ikc({}).optional().describe("Host supports opening external URLs."),downloadFile:n.z.Ikc({}).optional().describe("Host supports file downloads via ui/download-file."),serverTools:n.z.Ikc({listChanged:n.z.zMY().optional().describe("Host supports tools/list_changed notifications.")}).optional().describe("Host can proxy tool calls to the MCP server."),serverResources:n.z.Ikc({listChanged:n.z.zMY().optional().describe("Host supports resources/list_changed notifications.")}).optional().describe("Host can proxy resource reads to the MCP server."),logging:n.z.Ikc({}).optional().describe("Host accepts log messages."),sandbox:n.z.Ikc({permissions:b.optional().describe("Permissions granted by the host (camera, microphone, geolocation)."),csp:S.optional().describe("CSP domains approved by the host.")}).optional().describe("Sandbox configuration applied by the host."),updateModelContext:R.optional().describe("Host accepts context updates (ui/update-model-context) to be included in the model's context for future turns."),message:R.optional().describe("Host supports receiving content messages (ui/message) from the view."),sampling:n.z.Ikc({tools:n.z.Ikc({}).optional().describe("Host supports tool use via `tools` and `toolChoice` parameters.")}).optional().describe("Host supports LLM sampling (sampling/createMessage) from the view.\nMirrors the MCP `ClientCapabilities.sampling` shape so hosts can pass it through.")}),x=n.z.Ikc({experimental:n.z.g1P(n.z.YjP(),n.z.g1P(n.z.YjP(),n.z.bzn()).describe("Experimental features keyed by identifier.")).optional().describe("Experimental features keyed by identifier."),tools:n.z.Ikc({listChanged:n.z.zMY().optional().describe("App supports tools/list_changed notifications.")}).optional().describe("App exposes MCP-style tools that the host can call."),availableDisplayModes:n.z.YOg(p).optional().describe("Display modes the app supports.")}),C=n.z.Ikc({method:n.z.euz("ui/notifications/initialized"),params:n.z.Ikc({}).optional()}),q=(n.z.Ikc({csp:S.optional().describe("Content Security Policy configuration for UI resources."),permissions:b.optional().describe("Sandbox permissions requested by the UI resource."),domain:n.z.YjP().optional().describe(`Dedicated origin for view sandbox.
|
|
34
|
+
|
|
35
|
+
Useful when views need stable, dedicated origins for OAuth callbacks, CORS policies, or API key allowlists.
|
|
36
|
+
|
|
37
|
+
**Host-dependent:** The format and validation rules for this field are determined by each host. Servers MUST consult host-specific documentation for the expected domain format. Common patterns include:
|
|
38
|
+
- Hash-based subdomains (e.g., \`{hash}.claudemcpcontent.com\`)
|
|
39
|
+
- URL-derived subdomains (e.g., \`www-example-com.oaiusercontent.com\`)
|
|
40
|
+
|
|
41
|
+
If omitted, host uses default sandbox origin (typically per-conversation).`),prefersBorder:n.z.zMY().optional().describe(`Visual boundary preference - true if view prefers a visible border.
|
|
42
|
+
|
|
43
|
+
Boolean requesting whether a visible border and background is provided by the host. Specifying an explicit value for this is recommended because hosts' defaults may vary.
|
|
44
|
+
|
|
45
|
+
- \`true\`: request visible border + background
|
|
46
|
+
- \`false\`: request no visible border + background
|
|
47
|
+
- omitted: host decides border`)}),n.z.Ikc({method:n.z.euz("ui/request-display-mode"),params:n.z.Ikc({mode:p.describe("The display mode being requested.")})})),Y=n.z.Ikc({mode:p.describe("The display mode that was actually set. May differ from requested if not supported.")}).passthrough(),O=n.z.KCZ([n.z.euz("model"),n.z.euz("app")]).describe("Tool visibility scope - who can access the tool."),T=(n.z.Ikc({resourceUri:n.z.YjP().optional(),visibility:n.z.YOg(O).optional().describe(`Who can access this tool. Default: ["model", "app"]
|
|
48
|
+
- "model": Tool visible to and callable by the agent
|
|
49
|
+
- "app": Tool callable by the app from this server only`),csp:n.z.ZmZ().optional(),permissions:n.z.ZmZ().optional()}),n.z.Ikc({mimeTypes:n.z.YOg(n.z.YjP()).optional().describe('Array of supported MIME types for UI resources.\nMust include `"text/html;profile=mcp-app"` for MCP Apps support.')}),n.z.Ikc({method:n.z.euz("ui/download-file"),params:n.z.Ikc({contents:n.z.YOg(n.z.KCZ([r.$,r._n])).describe("Resource contents to download — embedded (inline data) or linked (host fetches). Uses standard MCP resource types.")})})),$=n.z.Ikc({method:n.z.euz("ui/message"),params:n.z.Ikc({role:n.z.euz("user").describe('Message role, currently only "user" is supported.'),content:n.z.YOg(r.L).describe("Message content blocks (text, image, etc.).")})}),E=(n.z.Ikc({method:n.z.euz("ui/notifications/sandbox-resource-ready"),params:n.z.Ikc({html:n.z.YjP().describe("HTML content to load into the inner iframe."),sandbox:n.z.YjP().optional().describe("Optional override for the inner iframe's sandbox attribute."),csp:S.optional().describe("CSP configuration from resource metadata."),permissions:b.optional().describe("Sandbox permissions from resource metadata.")})}),n.z.Ikc({method:n.z.euz("ui/notifications/tool-result"),params:r.C.describe("Standard MCP tool execution result.")}),n.z.Ikc({toolInfo:n.z.Ikc({id:r.pn.optional().describe("JSON-RPC id of the tools/call request."),tool:r.pr.describe("Tool definition including name, inputSchema, etc.")}).optional().describe("Metadata of the tool call that instantiated this App."),theme:d.optional().describe("Current color theme preference."),styles:w.optional().describe("Style configuration for theming the app."),displayMode:p.optional().describe("How the UI is currently displayed."),availableDisplayModes:n.z.YOg(p).optional().describe("Display modes the host supports."),containerDimensions:n.z.KCZ([n.z.Ikc({height:n.z.aig().describe("Fixed container height in pixels.")}),n.z.Ikc({maxHeight:n.z.KCZ([n.z.aig(),n.z.Vxk()]).optional().describe("Maximum container height in pixels.")})]).and(n.z.KCZ([n.z.Ikc({width:n.z.aig().describe("Fixed container width in pixels.")}),n.z.Ikc({maxWidth:n.z.KCZ([n.z.aig(),n.z.Vxk()]).optional().describe("Maximum container width in pixels.")})])).optional().describe(`Container dimensions. Represents the dimensions of the iframe or other
|
|
50
|
+
container holding the app. Specify either width or maxWidth, and either height or maxHeight.`),locale:n.z.YjP().optional().describe("User's language and region preference in BCP 47 format."),timeZone:n.z.YjP().optional().describe("User's timezone in IANA format."),userAgent:n.z.YjP().optional().describe("Host application identifier."),platform:n.z.KCZ([n.z.euz("web"),n.z.euz("desktop"),n.z.euz("mobile")]).optional().describe("Platform type for responsive design decisions."),deviceCapabilities:n.z.Ikc({touch:n.z.zMY().optional().describe("Whether the device supports touch input."),hover:n.z.zMY().optional().describe("Whether the device supports hover interactions.")}).optional().describe("Device input capabilities."),safeAreaInsets:n.z.Ikc({top:n.z.aig().describe("Top safe area inset in pixels."),right:n.z.aig().describe("Right safe area inset in pixels."),bottom:n.z.aig().describe("Bottom safe area inset in pixels."),left:n.z.aig().describe("Left safe area inset in pixels.")}).optional().describe("Mobile safe area boundaries in pixels.")}).passthrough()),M=(n.z.Ikc({method:n.z.euz("ui/notifications/host-context-changed"),params:E.describe("Partial context update containing only changed fields.")}),n.z.Ikc({method:n.z.euz("ui/update-model-context"),params:n.z.Ikc({content:n.z.YOg(r.L).optional().describe("Context content blocks (text, image, etc.)."),structuredContent:n.z.g1P(n.z.YjP(),n.z.L5J().describe("Structured content for machine-readable context data.")).optional().describe("Structured content for machine-readable context data.")})})),L=n.z.Ikc({method:n.z.euz("ui/initialize"),params:n.z.Ikc({appInfo:r.ft.describe("App identification (name and version)."),appCapabilities:x.describe("Features and capabilities this app provides."),protocolVersion:n.z.YjP().describe("Protocol version this app supports.")})}),N=n.z.Ikc({protocolVersion:n.z.YjP().describe('Negotiated protocol version string (e.g., "2025-11-21").'),hostInfo:r.ft.describe("Host application identification and version."),hostCapabilities:j.describe("Features and capabilities provided by the host."),hostContext:E.describe("Rich context about the host environment.")}).passthrough(),A="text/html;profile=mcp-app";class U{eventTarget;eventSource;messageListener;constructor(e=window.parent,t){this.eventTarget=e,this.eventSource=t,this.messageListener=e=>{if(t&&e.source!==this.eventSource)return void console.debug("Ignoring message from unknown source",e);let o=r.bt.safeParse(e.data);o.success?(console.debug("Parsed message",o.data),this.onmessage?.(o.data)):e.data?.jsonrpc!=="2.0"?console.debug("Ignoring non-JSON-RPC message",o.error.message,e):(console.error("Failed to parse message",o.error.message,e),this.onerror?.(Error("Invalid JSON-RPC message received: "+o.error.message)))}}async start(){window.addEventListener("message",this.messageListener)}async send(e,t){"ui/notifications/tool-input-partial"!==e.method&&console.debug("Sending message",e),this.eventTarget.postMessage(e,"*")}async close(){window.removeEventListener("message",this.messageListener),this.onclose?.()}onclose;onerror;onmessage;sessionId;setProtocolVersion}function H(e){let t=e._meta?.ui?.resourceUri;if(void 0===t&&(t=e._meta?.["ui/resourceUri"]),"string"==typeof t&&t.startsWith("ui://"))return t;if(void 0!==t)throw Error(`Invalid UI resource URI: ${JSON.stringify(t)}`)}var Z=[u];class V extends i.Zs{_client;_hostInfo;_hostCapabilities;_appCapabilities;_hostContext={};_appInfo;_initializedReceived=!1;_registeredEvents=new Set;_events=new a;_methods=new s;setRequestHandler=(...e)=>{let[t,...o]=c("request",e)??e;this._methods.claim(t,"setRequestHandler"),super.setRequestHandler.call(this,t,...o)};setNotificationHandler=(...e)=>{let[t,...o]=c("notification",e)??e;this._methods.claim(t,"setNotificationHandler"),super.setNotificationHandler.call(this,t,...o)};removeRequestHandler=e=>{this._methods.release(e),super.removeRequestHandler(e)};removeNotificationHandler=e=>{this._methods.release(e),super.removeNotificationHandler(e)};replaceRequestHandler=(e,...t)=>{this._methods.replace(e),super.setRequestHandler.call(this,e,...t)};_wrapHandler(e,t){let o=super._wrapHandler(e,t);return"ui/initialize"===e||"ping"===e?o:async(t,i)=>(this._initializedReceived||console.warn(`[ext-apps] AppBridge received '${e}' before ui/notifications/initialized. The View is calling host methods before completing the handshake; it should await app.connect() first.`),o(t,i))}eventSchemas={sizechange:k,sandboxready:y,initialized:C,requestteardown:I,loggingmessage:r.Ht};setEventHandler(e,t){this._ensureEventSlot(e),this._events.setHandler(e,t)}getEventHandler(e){return this._events.getHandler(e)}addEventListener(e,t){this._ensureEventSlot(e),this._events.addEventListener(e,t)}removeEventListener(e,t){this._events.removeEventListener(e,t)}_ensureEventSlot(e){if(this._registeredEvents.has(e))return;let t=this.eventSchemas[e];if(!t)throw Error(`Unknown event: ${String(e)}`);let o=t=>{"initialized"===e&&(this._initializedReceived=!0),this._events.dispatch(e,t)};"loggingmessage"===e?this.setNotificationHandler("notifications/message",e=>{o(e.params)}):this.setNotificationHandler(t.shape.method.value,{params:t.shape.params},e=>o(e)),this._registeredEvents.add(e)}warnIfRequestHandlerReplaced(e,t,o){t&&o&&console.warn(`[MCP Apps] ${e} handler replaced. Previous handler will no longer be called.`)}constructor(e,t,o,i){super(i),this._client=e,this._hostInfo=t,this._hostCapabilities=o,this._methods.replace("notifications/cancelled"),this._methods.replace("notifications/progress"),this._ensureEventSlot("initialized"),this._hostContext=i?.hostContext||{},this.replaceRequestHandler("ui/initialize",{params:L.shape.params,result:N},e=>this._onAppsInitialize(e)),this.replaceRequestHandler("ping",(e,t)=>(this.onping?.(e.params,t),{})),this.replaceRequestHandler("ui/request-display-mode",{params:q.shape.params,result:Y},()=>({mode:this._hostContext.displayMode??"inline"}))}buildContext(e){return e}assertCapabilityForMethod(e){}assertRequestHandlerCapability(e){}assertNotificationCapability(e){}getAppCapabilities(){return this._appCapabilities}getAppVersion(){return this._appInfo}onping;get onsizechange(){return this.getEventHandler("sizechange")}set onsizechange(e){this.setEventHandler("sizechange",e)}get onsandboxready(){return this.getEventHandler("sandboxready")}set onsandboxready(e){this.setEventHandler("sandboxready",e)}get oninitialized(){return this.getEventHandler("initialized")}set oninitialized(e){this.setEventHandler("initialized",e)}_onmessage;get onmessage(){return this._onmessage}set onmessage(e){this.warnIfRequestHandlerReplaced("onmessage",this._onmessage,e),this._onmessage=e,this.replaceRequestHandler("ui/message",{params:$.shape.params,result:_},async(e,t)=>{if(!this._onmessage)throw Error("No onmessage handler set");return this._onmessage(e,t)})}_onopenlink;get onopenlink(){return this._onopenlink}set onopenlink(e){this.warnIfRequestHandlerReplaced("onopenlink",this._onopenlink,e),this._onopenlink=e,this.replaceRequestHandler("ui/open-link",{params:f.shape.params,result:g},async(e,t)=>{if(!this._onopenlink)throw Error("No onopenlink handler set");return this._onopenlink(e,t)})}_ondownloadfile;get ondownloadfile(){return this._ondownloadfile}set ondownloadfile(e){this.warnIfRequestHandlerReplaced("ondownloadfile",this._ondownloadfile,e),this._ondownloadfile=e,this.replaceRequestHandler("ui/download-file",{params:T.shape.params,result:v},async(e,t)=>{if(!this._ondownloadfile)throw Error("No ondownloadfile handler set");return this._ondownloadfile(e,t)})}get onrequestteardown(){return this.getEventHandler("requestteardown")}set onrequestteardown(e){this.setEventHandler("requestteardown",e)}_onrequestdisplaymode;get onrequestdisplaymode(){return this._onrequestdisplaymode}set onrequestdisplaymode(e){this.warnIfRequestHandlerReplaced("onrequestdisplaymode",this._onrequestdisplaymode,e),this._onrequestdisplaymode=e,this.replaceRequestHandler("ui/request-display-mode",{params:q.shape.params,result:Y},async(e,t)=>{if(!this._onrequestdisplaymode)throw Error("No onrequestdisplaymode handler set");return this._onrequestdisplaymode(e,t)})}get onloggingmessage(){return this.getEventHandler("loggingmessage")}set onloggingmessage(e){this.setEventHandler("loggingmessage",e)}_onupdatemodelcontext;get onupdatemodelcontext(){return this._onupdatemodelcontext}set onupdatemodelcontext(e){this.warnIfRequestHandlerReplaced("onupdatemodelcontext",this._onupdatemodelcontext,e),this._onupdatemodelcontext=e,this.replaceRequestHandler("ui/update-model-context",{params:M.shape.params,result:r.et},async(e,t)=>{if(!this._onupdatemodelcontext)throw Error("No onupdatemodelcontext handler set");return this._onupdatemodelcontext(e,t)})}_oncalltool;get oncalltool(){return this._oncalltool}set oncalltool(e){this.warnIfRequestHandlerReplaced("oncalltool",this._oncalltool,e),this._oncalltool=e,this.replaceRequestHandler("tools/call",async(e,t)=>{if(!this._oncalltool)throw Error("No oncalltool handler set");return this._oncalltool(e.params,t)})}_oncreatesamplingmessage;get oncreatesamplingmessage(){return this._oncreatesamplingmessage}set oncreatesamplingmessage(e){this.warnIfRequestHandlerReplaced("oncreatesamplingmessage",this._oncreatesamplingmessage,e),this._oncreatesamplingmessage=e,this.replaceRequestHandler("sampling/createMessage",async(e,t)=>{if(!this._oncreatesamplingmessage)throw Error("No oncreatesamplingmessage handler set");return this._oncreatesamplingmessage(e.params,t)})}sendToolListChanged(e={}){return this.notification({method:"notifications/tools/list_changed",params:e})}_onlistresources;get onlistresources(){return this._onlistresources}set onlistresources(e){this.warnIfRequestHandlerReplaced("onlistresources",this._onlistresources,e),this._onlistresources=e,this.replaceRequestHandler("resources/list",async(e,t)=>{if(!this._onlistresources)throw Error("No onlistresources handler set");return this._onlistresources(e.params,t)})}_onlistresourcetemplates;get onlistresourcetemplates(){return this._onlistresourcetemplates}set onlistresourcetemplates(e){this.warnIfRequestHandlerReplaced("onlistresourcetemplates",this._onlistresourcetemplates,e),this._onlistresourcetemplates=e,this.replaceRequestHandler("resources/templates/list",async(e,t)=>{if(!this._onlistresourcetemplates)throw Error("No onlistresourcetemplates handler set");return this._onlistresourcetemplates(e.params,t)})}_onreadresource;get onreadresource(){return this._onreadresource}set onreadresource(e){this.warnIfRequestHandlerReplaced("onreadresource",this._onreadresource,e),this._onreadresource=e,this.replaceRequestHandler("resources/read",async(e,t)=>{if(!this._onreadresource)throw Error("No onreadresource handler set");return this._onreadresource(e.params,t)})}sendResourceListChanged(e={}){return this.notification({method:"notifications/resources/list_changed",params:e})}_onlistprompts;get onlistprompts(){return this._onlistprompts}set onlistprompts(e){this.warnIfRequestHandlerReplaced("onlistprompts",this._onlistprompts,e),this._onlistprompts=e,this.replaceRequestHandler("prompts/list",async(e,t)=>{if(!this._onlistprompts)throw Error("No onlistprompts handler set");return this._onlistprompts(e.params,t)})}sendPromptListChanged(e={}){return this.notification({method:"notifications/prompts/list_changed",params:e})}getCapabilities(){return this._hostCapabilities}async _onAppsInitialize(e){let t=e.protocolVersion;return void 0!==this._appInfo&&console.warn("[ext-apps] AppBridge received a second ui/initialize. The View may be double-mounting (e.g. React StrictMode in dev) without closing the previous App instance. Responding normally; the latest appInfo/appCapabilities replace the previous values."),this._appCapabilities=e.appCapabilities,this._appInfo=e.appInfo,{protocolVersion:Z.includes(t)?t:u,hostCapabilities:this.getCapabilities(),hostInfo:this._hostInfo,hostContext:this._hostContext}}setHostContext(e){let t={},o=!1;for(let i of Object.keys(e)){let r=this._hostContext[i],n=e[i];JSON.stringify(r)!==JSON.stringify(n)&&(t[i]=n,o=!0)}o&&(this._hostContext=e,this.sendHostContextChange(t))}sendHostContextChange(e){return this.notification({method:"ui/notifications/host-context-changed",params:e})}sendToolInput(e){return this.notification({method:"ui/notifications/tool-input",params:e})}sendToolInputPartial(e){return this.notification({method:"ui/notifications/tool-input-partial",params:e})}sendToolResult(e){return this.notification({method:"ui/notifications/tool-result",params:e})}sendToolCancelled(e){return this.notification({method:"ui/notifications/tool-cancelled",params:e})}sendSandboxResourceReady(e){return this.notification({method:"ui/notifications/sandbox-resource-ready",params:e})}teardownResource(e,t){return this.request({method:"ui/resource-teardown",params:e},z,t)}sendResourceTeardown=this.teardownResource;callTool(e,t){return this.request({method:"tools/call",params:e},t)}listTools(e,t){return this.request({method:"tools/list",params:e},t)}async connect(e){if(this.transport)throw Error("AppBridge is already connected. Call close() before connecting again.");if(this._initializedReceived=!1,this._client){let e=this._client.getServerCapabilities();if(!e)throw Error("Client server capabilities not available");e.tools&&(this.oncalltool=async(e,t)=>this._client.request({method:"tools/call",params:e},{signal:t.mcpReq.signal}),e.tools.listChanged)&&this._client.setNotificationHandler("notifications/tools/list_changed",e=>this.sendToolListChanged(e.params)),e.resources&&(this.onlistresources=async(e,t)=>this._client.request({method:"resources/list",params:e},{signal:t.mcpReq.signal}),this.onlistresourcetemplates=async(e,t)=>this._client.request({method:"resources/templates/list",params:e},{signal:t.mcpReq.signal}),this.onreadresource=async(e,t)=>this._client.request({method:"resources/read",params:e},{signal:t.mcpReq.signal}),e.resources.listChanged)&&this._client.setNotificationHandler("notifications/resources/list_changed",e=>this.sendResourceListChanged(e.params)),e.prompts&&(this.onlistprompts=async(e,t)=>this._client.request({method:"prompts/list",params:e},{signal:t.mcpReq.signal}),e.prompts.listChanged)&&this._client.setNotificationHandler("notifications/prompts/list_changed",e=>this.sendPromptListChanged(e.params))}return super.connect(e)}}},476(e,t,o){let i,r;o.d(t,{tmp:()=>u,eqx:()=>i8,bzn:()=>iP,YOg:()=>ix,zMY:()=>iv,auy:()=>l,gMt:()=>iE,Rpp:()=>o0,k5n:()=>iH,E$q:()=>iL,KH5:()=>s,RZV:()=>i5,euz:()=>iV,_H3:()=>iY,chJ:()=>ib,aig:()=>ip,Ikc:()=>iq,lqM:()=>iK,vkY:()=>i6,g1P:()=>iA,xLC:()=>oH,YjP:()=>oG,blZ:()=>ox,KCZ:()=>iT,L5J:()=>iz,OZ5:()=>o4,z:()=>c});var n,a,s={};o.r(s),o.d(s,{p6:()=>oO,w$:()=>oq,p0:()=>oM,kB:()=>o$});var l={};o.r(l),o.d(l,{ai:()=>i7});var c={};o.r(c),o.d(c,{tmp:()=>u,eqx:()=>i8,bzn:()=>iP,YOg:()=>ix,zMY:()=>iv,auy:()=>l,gMt:()=>iE,Rpp:()=>o0,k5n:()=>iH,E$q:()=>iL,KH5:()=>s,RZV:()=>i5,euz:()=>iV,_H3:()=>iY,ZmZ:()=>iI,chJ:()=>ib,aig:()=>ip,Ikc:()=>iq,lqM:()=>iK,vkY:()=>i6,g1P:()=>iA,xLC:()=>oH,YjP:()=>oG,blZ:()=>ox,Vxk:()=>iy,KCZ:()=>iT,L5J:()=>iz,OZ5:()=>o4});let u=Object.freeze({status:"aborted"});function d(e,t,o){function i(o,i){if(o._zod||Object.defineProperty(o,"_zod",{value:{def:i,constr:a,traits:new Set},enumerable:!1}),o._zod.traits.has(e))return;o._zod.traits.add(e),t(o,i);let r=a.prototype,n=Object.keys(r);for(let e=0;e<n.length;e++){let t=n[e];t in o||(o[t]=r[t].bind(o))}}let r=o?.Parent??Object;class n extends r{}function a(e){var t;let r=o?.Parent?new n:this;for(let o of(i(r,e),(t=r._zod).deferred??(t.deferred=[]),r._zod.deferred))o();return r}return Object.defineProperty(n,"name",{value:e}),Object.defineProperty(a,"init",{value:i}),Object.defineProperty(a,Symbol.hasInstance,{value:t=>!!o?.Parent&&t instanceof o.Parent||t?._zod?.traits?.has(e)}),Object.defineProperty(a,"name",{value:e}),a}Symbol("zod_brand");class p extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class h extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name="ZodEncodeError"}}let m={};function f(e){return e&&Object.assign(m,e),m}function g(e){let t=Object.values(e).filter(e=>"number"==typeof e);return Object.entries(e).filter(([e,o])=>-1===t.indexOf(+e)).map(([e,t])=>t)}function v(e,t="|"){return e.map(e=>$(e)).join(t)}function _(e,t){return"bigint"==typeof t?t.toString():t}function y(e){return{get value(){{let t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function S(e){let t=+!!e.startsWith("^"),o=e.endsWith("$")?e.length-1:e.length;return e.slice(t,o)}let b=Symbol("evaluating");function k(e,t,o){let i;Object.defineProperty(e,t,{get(){if(i!==b)return void 0===i&&(i=b,i=o()),i},set(o){Object.defineProperty(e,t,{value:o})},configurable:!0})}function P(e,t,o){Object.defineProperty(e,t,{value:o,writable:!0,enumerable:!0,configurable:!0})}function w(...e){let t={};for(let o of e)Object.assign(t,Object.getOwnPropertyDescriptors(o));return Object.defineProperties({},t)}function z(e){return JSON.stringify(e)}let R="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function I(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}let j=y(()=>{if("u">typeof navigator&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return Function(""),!0}catch(e){return!1}});function x(e){if(!1===I(e))return!1;let t=e.constructor;if(void 0===t||"function"!=typeof t)return!0;let o=t.prototype;return!1!==I(o)&&!1!==Object.prototype.hasOwnProperty.call(o,"isPrototypeOf")}function C(e){return x(e)?{...e}:Array.isArray(e)?[...e]:e}let q=new Set(["string","number","symbol"]);function Y(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function O(e,t,o){let i=new e._zod.constr(t??e._zod.def);return(!t||o?.parent)&&(i._zod.parent=e),i}function T(e){if(!e)return{};if("string"==typeof e)return{error:()=>e};if(e?.message!==void 0){if(e?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");e.error=e.message}return(delete e.message,"string"==typeof e.error)?{...e,error:()=>e.error}:e}function $(e){return"bigint"==typeof e?e.toString()+"n":"string"==typeof e?`"${e}"`:`${e}`}let E={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-0x80000000,0x7fffffff],uint32:[0,0xffffffff],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function M(e,t=0){if(!0===e.aborted)return!0;for(let o=t;o<e.issues.length;o++)if(e.issues[o]?.continue!==!0)return!0;return!1}function L(e,t){return t.map(t=>(t.path??(t.path=[]),t.path.unshift(e),t))}function N(e){return"string"==typeof e?e:e?.message}function A(e,t,o){let i={...e,path:e.path??[]};return e.message||(i.message=N(e.inst?._zod.def?.error?.(e))??N(t?.error?.(e))??N(o.customError?.(e))??N(o.localeError?.(e))??"Invalid input"),delete i.inst,delete i.continue,t?.reportInput||delete i.input,i}function U(e){return Array.isArray(e)?"array":"string"==typeof e?"string":"unknown"}function H(...e){let[t,o,i]=e;return"string"==typeof t?{message:t,code:"custom",input:o,inst:i}:{...t}}let Z=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,_,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},V=d("$ZodError",Z),J=d("$ZodError",Z,{Parent:Error}),D=e=>(t,o,i,r)=>{let n=i?Object.assign(i,{async:!1}):{async:!1},a=t._zod.run({value:o,issues:[]},n);if(a instanceof Promise)throw new p;if(a.issues.length){let t=new(r?.Err??e)(a.issues.map(e=>A(e,n,f())));throw R(t,r?.callee),t}return a.value},F=e=>async(t,o,i,r)=>{let n=i?Object.assign(i,{async:!0}):{async:!0},a=t._zod.run({value:o,issues:[]},n);if(a instanceof Promise&&(a=await a),a.issues.length){let t=new(r?.Err??e)(a.issues.map(e=>A(e,n,f())));throw R(t,r?.callee),t}return a.value},K=e=>(t,o,i)=>{let r=i?{...i,async:!1}:{async:!1},n=t._zod.run({value:o,issues:[]},r);if(n instanceof Promise)throw new p;return n.issues.length?{success:!1,error:new(e??V)(n.issues.map(e=>A(e,r,f())))}:{success:!0,data:n.value}},B=K(J),W=e=>async(t,o,i)=>{let r=i?Object.assign(i,{async:!0}):{async:!0},n=t._zod.run({value:o,issues:[]},r);return n instanceof Promise&&(n=await n),n.issues.length?{success:!1,error:new e(n.issues.map(e=>A(e,r,f())))}:{success:!0,data:n.value}},G=W(J),X=/^[cC][^\s-]{8,}$/,Q=/^[0-9a-z]+$/,ee=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,et=/^[0-9a-vA-V]{20}$/,eo=/^[A-Za-z0-9]{27}$/,ei=/^[a-zA-Z0-9_-]{21}$/,er=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,en=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,ea=e=>e?RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,es=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,el=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,ec=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,eu=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,ed=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,ep=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,eh=/^[A-Za-z0-9_-]*$/,em=/^\+(?:[0-9]){6,14}[0-9]$/,ef="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",eg=RegExp(`^${ef}$`);function ev(e){let t="(?:[01]\\d|2[0-3]):[0-5]\\d";return"number"==typeof e.precision?-1===e.precision?`${t}`:0===e.precision?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}let e_=/^-?\d+$/,ey=/^-?\d+(?:\.\d+)?/,eS=/^(?:true|false)$/i,eb=/^null$/i,ek=/^undefined$/i,eP=/^[^A-Z]*$/,ew=/^[^a-z]*$/,ez=d("$ZodCheck",(e,t)=>{var o;e._zod??(e._zod={}),e._zod.def=t,(o=e._zod).onattach??(o.onattach=[])}),eR={number:"number",bigint:"bigint",object:"date"},eI=d("$ZodCheckLessThan",(e,t)=>{ez.init(e,t);let o=eR[typeof t.value];e._zod.onattach.push(e=>{let o=e._zod.bag,i=(t.inclusive?o.maximum:o.exclusiveMaximum)??1/0;t.value<i&&(t.inclusive?o.maximum=t.value:o.exclusiveMaximum=t.value)}),e._zod.check=i=>{(t.inclusive?i.value<=t.value:i.value<t.value)||i.issues.push({origin:o,code:"too_big",maximum:t.value,input:i.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),ej=d("$ZodCheckGreaterThan",(e,t)=>{ez.init(e,t);let o=eR[typeof t.value];e._zod.onattach.push(e=>{let o=e._zod.bag,i=(t.inclusive?o.minimum:o.exclusiveMinimum)??-1/0;t.value>i&&(t.inclusive?o.minimum=t.value:o.exclusiveMinimum=t.value)}),e._zod.check=i=>{(t.inclusive?i.value>=t.value:i.value>t.value)||i.issues.push({origin:o,code:"too_small",minimum:t.value,input:i.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),ex=d("$ZodCheckMultipleOf",(e,t)=>{ez.init(e,t),e._zod.onattach.push(e=>{var o;(o=e._zod.bag).multipleOf??(o.multipleOf=t.value)}),e._zod.check=o=>{if(typeof o.value!=typeof t.value)throw Error("Cannot mix number and bigint in multiple_of check.");("bigint"==typeof o.value?o.value%t.value===BigInt(0):0===function(e,t){let o=(e.toString().split(".")[1]||"").length,i=t.toString(),r=(i.split(".")[1]||"").length;if(0===r&&/\d?e-\d?/.test(i)){let e=i.match(/\d?e-(\d?)/);e?.[1]&&(r=Number.parseInt(e[1]))}let n=o>r?o:r;return Number.parseInt(e.toFixed(n).replace(".",""))%Number.parseInt(t.toFixed(n).replace(".",""))/10**n}(o.value,t.value))||o.issues.push({origin:typeof o.value,code:"not_multiple_of",divisor:t.value,input:o.value,inst:e,continue:!t.abort})}}),eC=d("$ZodCheckNumberFormat",(e,t)=>{ez.init(e,t),t.format=t.format||"float64";let o=t.format?.includes("int"),i=o?"int":"number",[r,n]=E[t.format];e._zod.onattach.push(e=>{let i=e._zod.bag;i.format=t.format,i.minimum=r,i.maximum=n,o&&(i.pattern=e_)}),e._zod.check=a=>{let s=a.value;if(o){if(!Number.isInteger(s))return void a.issues.push({expected:i,format:t.format,code:"invalid_type",continue:!1,input:s,inst:e});if(!Number.isSafeInteger(s))return void(s>0?a.issues.push({input:s,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:i,continue:!t.abort}):a.issues.push({input:s,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:i,continue:!t.abort}))}s<r&&a.issues.push({origin:"number",input:s,code:"too_small",minimum:r,inclusive:!0,inst:e,continue:!t.abort}),s>n&&a.issues.push({origin:"number",input:s,code:"too_big",maximum:n,inst:e})}}),eq=d("$ZodCheckMaxLength",(e,t)=>{var o;ez.init(e,t),(o=e._zod.def).when??(o.when=e=>{let t=e.value;return null!=t&&void 0!==t.length}),e._zod.onattach.push(e=>{let o=e._zod.bag.maximum??1/0;t.maximum<o&&(e._zod.bag.maximum=t.maximum)}),e._zod.check=o=>{let i=o.value;if(i.length<=t.maximum)return;let r=U(i);o.issues.push({origin:r,code:"too_big",maximum:t.maximum,inclusive:!0,input:i,inst:e,continue:!t.abort})}}),eY=d("$ZodCheckMinLength",(e,t)=>{var o;ez.init(e,t),(o=e._zod.def).when??(o.when=e=>{let t=e.value;return null!=t&&void 0!==t.length}),e._zod.onattach.push(e=>{let o=e._zod.bag.minimum??-1/0;t.minimum>o&&(e._zod.bag.minimum=t.minimum)}),e._zod.check=o=>{let i=o.value;if(i.length>=t.minimum)return;let r=U(i);o.issues.push({origin:r,code:"too_small",minimum:t.minimum,inclusive:!0,input:i,inst:e,continue:!t.abort})}}),eO=d("$ZodCheckLengthEquals",(e,t)=>{var o;ez.init(e,t),(o=e._zod.def).when??(o.when=e=>{let t=e.value;return null!=t&&void 0!==t.length}),e._zod.onattach.push(e=>{let o=e._zod.bag;o.minimum=t.length,o.maximum=t.length,o.length=t.length}),e._zod.check=o=>{let i=o.value,r=i.length;if(r===t.length)return;let n=U(i),a=r>t.length;o.issues.push({origin:n,...a?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:o.value,inst:e,continue:!t.abort})}}),eT=d("$ZodCheckStringFormat",(e,t)=>{var o,i;ez.init(e,t),e._zod.onattach.push(e=>{let o=e._zod.bag;o.format=t.format,t.pattern&&(o.patterns??(o.patterns=new Set),o.patterns.add(t.pattern))}),t.pattern?(o=e._zod).check??(o.check=o=>{t.pattern.lastIndex=0,t.pattern.test(o.value)||o.issues.push({origin:"string",code:"invalid_format",format:t.format,input:o.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(i=e._zod).check??(i.check=()=>{})}),e$=d("$ZodCheckRegex",(e,t)=>{eT.init(e,t),e._zod.check=o=>{t.pattern.lastIndex=0,t.pattern.test(o.value)||o.issues.push({origin:"string",code:"invalid_format",format:"regex",input:o.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),eE=d("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=eP),eT.init(e,t)}),eM=d("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=ew),eT.init(e,t)}),eL=d("$ZodCheckIncludes",(e,t)=>{ez.init(e,t);let o=Y(t.includes),i=new RegExp("number"==typeof t.position?`^.{${t.position}}${o}`:o);t.pattern=i,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??(t.patterns=new Set),t.patterns.add(i)}),e._zod.check=o=>{o.value.includes(t.includes,t.position)||o.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:o.value,inst:e,continue:!t.abort})}}),eN=d("$ZodCheckStartsWith",(e,t)=>{ez.init(e,t);let o=RegExp(`^${Y(t.prefix)}.*`);t.pattern??(t.pattern=o),e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??(t.patterns=new Set),t.patterns.add(o)}),e._zod.check=o=>{o.value.startsWith(t.prefix)||o.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:o.value,inst:e,continue:!t.abort})}}),eA=d("$ZodCheckEndsWith",(e,t)=>{ez.init(e,t);let o=RegExp(`.*${Y(t.suffix)}$`);t.pattern??(t.pattern=o),e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??(t.patterns=new Set),t.patterns.add(o)}),e._zod.check=o=>{o.value.endsWith(t.suffix)||o.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:o.value,inst:e,continue:!t.abort})}}),eU=d("$ZodCheckOverwrite",(e,t)=>{ez.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}});class eH{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),this.indent-=1}write(e){if("function"==typeof e){e(this,{execution:"sync"}),e(this,{execution:"async"});return}let t=e.split("\n").filter(e=>e),o=Math.min(...t.map(e=>e.length-e.trimStart().length));for(let e of t.map(e=>e.slice(o)).map(e=>" ".repeat(2*this.indent)+e))this.content.push(e)}compile(){return Function(...this?.args,[...(this?.content??[""]).map(e=>` ${e}`)].join("\n"))}}let eZ={major:4,minor:2,patch:0},eV=d("$ZodType",(e,t)=>{var o;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=eZ;let i=[...e._zod.def.checks??[]];for(let t of(e._zod.traits.has("$ZodCheck")&&i.unshift(e),i))for(let o of t._zod.onattach)o(e);if(0===i.length)(o=e._zod).deferred??(o.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let t=(e,t,o)=>{let i,r=M(e);for(let n of t){if(n._zod.def.when){if(!n._zod.def.when(e))continue}else if(r)continue;let t=e.issues.length,a=n._zod.check(e);if(a instanceof Promise&&o?.async===!1)throw new p;if(i||a instanceof Promise)i=(i??Promise.resolve()).then(async()=>{await a,e.issues.length!==t&&(r||(r=M(e,t)))});else{if(e.issues.length===t)continue;r||(r=M(e,t))}}return i?i.then(()=>e):e},o=(o,r,n)=>{if(M(o))return o.aborted=!0,o;let a=t(r,i,n);if(a instanceof Promise){if(!1===n.async)throw new p;return a.then(t=>e._zod.parse(t,n))}return e._zod.parse(a,n)};e._zod.run=(r,n)=>{if(n.skipChecks)return e._zod.parse(r,n);if("backward"===n.direction){let t=e._zod.parse({value:r.value,issues:[]},{...n,skipChecks:!0});return t instanceof Promise?t.then(e=>o(e,r,n)):o(t,r,n)}let a=e._zod.parse(r,n);if(a instanceof Promise){if(!1===n.async)throw new p;return a.then(e=>t(e,i,n))}return t(a,i,n)}}e["~standard"]={validate:t=>{try{let o=B(e,t);return o.success?{value:o.data}:{issues:o.error?.issues}}catch(o){return G(e,t).then(e=>e.success?{value:e.data}:{issues:e.error?.issues})}},vendor:"zod",version:1}}),eJ=d("$ZodString",(e,t)=>{var o;let i;eV.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??(i=(o=e._zod.bag)?`[\\s\\S]{${o?.minimum??0},${o?.maximum??""}}`:"[\\s\\S]*",RegExp(`^${i}$`)),e._zod.parse=(o,i)=>{if(t.coerce)try{o.value=String(o.value)}catch(e){}return"string"==typeof o.value||o.issues.push({expected:"string",code:"invalid_type",input:o.value,inst:e}),o}}),eD=d("$ZodStringFormat",(e,t)=>{eT.init(e,t),eJ.init(e,t)}),eF=d("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=en),eD.init(e,t)}),eK=d("$ZodUUID",(e,t)=>{if(t.version){let e={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(void 0===e)throw Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=ea(e))}else t.pattern??(t.pattern=ea());eD.init(e,t)}),eB=d("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=es),eD.init(e,t)}),eW=d("$ZodURL",(e,t)=>{eD.init(e,t),e._zod.check=o=>{try{let i=o.value.trim(),r=new URL(i);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(r.hostname)||o.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:o.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(r.protocol.endsWith(":")?r.protocol.slice(0,-1):r.protocol)||o.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:o.value,inst:e,continue:!t.abort})),t.normalize?o.value=r.href:o.value=i;return}catch(i){o.issues.push({code:"invalid_format",format:"url",input:o.value,inst:e,continue:!t.abort})}}}),eG=d("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),eD.init(e,t)}),eX=d("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=ei),eD.init(e,t)}),eQ=d("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=X),eD.init(e,t)}),e0=d("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=Q),eD.init(e,t)}),e1=d("$ZodULID",(e,t)=>{t.pattern??(t.pattern=ee),eD.init(e,t)}),e2=d("$ZodXID",(e,t)=>{t.pattern??(t.pattern=et),eD.init(e,t)}),e9=d("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=eo),eD.init(e,t)}),e4=d("$ZodISODateTime",(e,t)=>{let o,i,r;t.pattern??(o=ev({precision:t.precision}),i=["Z"],t.local&&i.push(""),t.offset&&i.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)"),r=`${o}(?:${i.join("|")})`,t.pattern=RegExp(`^${ef}T(?:${r})$`)),eD.init(e,t)}),e5=d("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=eg),eD.init(e,t)}),e3=d("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=RegExp(`^${ev(t)}$`)),eD.init(e,t)}),e6=d("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=er),eD.init(e,t)}),e8=d("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=el),eD.init(e,t),e._zod.bag.format="ipv4"}),e7=d("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=ec),eD.init(e,t),e._zod.bag.format="ipv6",e._zod.check=o=>{try{new URL(`http://[${o.value}]`)}catch{o.issues.push({code:"invalid_format",format:"ipv6",input:o.value,inst:e,continue:!t.abort})}}}),te=d("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=eu),eD.init(e,t)}),tt=d("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=ed),eD.init(e,t),e._zod.check=o=>{let i=o.value.split("/");try{if(2!==i.length)throw Error();let[e,t]=i;if(!t)throw Error();let o=Number(t);if(`${o}`!==t||o<0||o>128)throw Error();new URL(`http://[${e}]`)}catch{o.issues.push({code:"invalid_format",format:"cidrv6",input:o.value,inst:e,continue:!t.abort})}}});function to(e){if(""===e)return!0;if(e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}let ti=d("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=ep),eD.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=o=>{to(o.value)||o.issues.push({code:"invalid_format",format:"base64",input:o.value,inst:e,continue:!t.abort})}}),tr=d("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=eh),eD.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=o=>{!function(e){if(!eh.test(e))return!1;let t=e.replace(/[-_]/g,e=>"-"===e?"+":"/");return to(t.padEnd(4*Math.ceil(t.length/4),"="))}(o.value)&&o.issues.push({code:"invalid_format",format:"base64url",input:o.value,inst:e,continue:!t.abort})}}),tn=d("$ZodE164",(e,t)=>{t.pattern??(t.pattern=em),eD.init(e,t)}),ta=d("$ZodJWT",(e,t)=>{eD.init(e,t),e._zod.check=o=>{!function(e,t=null){try{let o=e.split(".");if(3!==o.length)return!1;let[i]=o;if(!i)return!1;let r=JSON.parse(atob(i));if("typ"in r&&r?.typ!=="JWT"||!r.alg||t&&(!("alg"in r)||r.alg!==t))return!1;return!0}catch{return!1}}(o.value,t.alg)&&o.issues.push({code:"invalid_format",format:"jwt",input:o.value,inst:e,continue:!t.abort})}}),ts=d("$ZodNumber",(e,t)=>{eV.init(e,t),e._zod.pattern=e._zod.bag.pattern??ey,e._zod.parse=(o,i)=>{if(t.coerce)try{o.value=Number(o.value)}catch(e){}let r=o.value;if("number"==typeof r&&!Number.isNaN(r)&&Number.isFinite(r))return o;let n="number"==typeof r?Number.isNaN(r)?"NaN":Number.isFinite(r)?void 0:"Infinity":void 0;return o.issues.push({expected:"number",code:"invalid_type",input:r,inst:e,...n?{received:n}:{}}),o}}),tl=d("$ZodNumberFormat",(e,t)=>{eC.init(e,t),ts.init(e,t)}),tc=d("$ZodBoolean",(e,t)=>{eV.init(e,t),e._zod.pattern=eS,e._zod.parse=(o,i)=>{if(t.coerce)try{o.value=!!o.value}catch(e){}let r=o.value;return"boolean"==typeof r||o.issues.push({expected:"boolean",code:"invalid_type",input:r,inst:e}),o}}),tu=d("$ZodUndefined",(e,t)=>{eV.init(e,t),e._zod.pattern=ek,e._zod.values=new Set([void 0]),e._zod.optin="optional",e._zod.optout="optional",e._zod.parse=(t,o)=>{let i=t.value;return void 0===i||t.issues.push({expected:"undefined",code:"invalid_type",input:i,inst:e}),t}}),td=d("$ZodNull",(e,t)=>{eV.init(e,t),e._zod.pattern=eb,e._zod.values=new Set([null]),e._zod.parse=(t,o)=>{let i=t.value;return null===i||t.issues.push({expected:"null",code:"invalid_type",input:i,inst:e}),t}}),tp=d("$ZodAny",(e,t)=>{eV.init(e,t),e._zod.parse=e=>e}),th=d("$ZodUnknown",(e,t)=>{eV.init(e,t),e._zod.parse=e=>e}),tm=d("$ZodNever",(e,t)=>{eV.init(e,t),e._zod.parse=(t,o)=>(t.issues.push({expected:"never",code:"invalid_type",input:t.value,inst:e}),t)});function tf(e,t,o){e.issues.length&&t.issues.push(...L(o,e.issues)),t.value[o]=e.value}let tg=d("$ZodArray",(e,t)=>{eV.init(e,t),e._zod.parse=(o,i)=>{let r=o.value;if(!Array.isArray(r))return o.issues.push({expected:"array",code:"invalid_type",input:r,inst:e}),o;o.value=Array(r.length);let n=[];for(let e=0;e<r.length;e++){let a=r[e],s=t.element._zod.run({value:a,issues:[]},i);s instanceof Promise?n.push(s.then(t=>tf(t,o,e))):tf(s,o,e)}return n.length?Promise.all(n).then(()=>o):o}});function tv(e,t,o,i){e.issues.length&&t.issues.push(...L(o,e.issues)),void 0===e.value?o in i&&(t.value[o]=void 0):t.value[o]=e.value}function t_(e){var t;let o=Object.keys(e.shape);for(let t of o)if(!e.shape?.[t]?._zod?.traits?.has("$ZodType"))throw Error(`Invalid element at key "${t}": expected a Zod schema`);let i=Object.keys(t=e.shape).filter(e=>"optional"===t[e]._zod.optin&&"optional"===t[e]._zod.optout);return{...e,keys:o,keySet:new Set(o),numKeys:o.length,optionalKeys:new Set(i)}}function ty(e,t,o,i,r,n){let a=[],s=r.keySet,l=r.catchall._zod,c=l.def.type;for(let r in t){if(s.has(r))continue;if("never"===c){a.push(r);continue}let n=l.run({value:t[r],issues:[]},i);n instanceof Promise?e.push(n.then(e=>tv(e,o,r,t))):tv(n,o,r,t)}return(a.length&&o.issues.push({code:"unrecognized_keys",keys:a,input:t,inst:n}),e.length)?Promise.all(e).then(()=>o):o}let tS=d("$ZodObject",(e,t)=>{let o;eV.init(e,t);let i=Object.getOwnPropertyDescriptor(t,"shape");if(!i?.get){let e=t.shape;Object.defineProperty(t,"shape",{get:()=>{let o={...e};return Object.defineProperty(t,"shape",{value:o}),o}})}let r=y(()=>t_(t));k(e._zod,"propValues",()=>{let e=t.shape,o={};for(let t in e){let i=e[t]._zod;if(i.values)for(let e of(o[t]??(o[t]=new Set),i.values))o[t].add(e)}return o});let n=t.catchall;e._zod.parse=(t,i)=>{o??(o=r.value);let a=t.value;if(!I(a))return t.issues.push({expected:"object",code:"invalid_type",input:a,inst:e}),t;t.value={};let s=[],l=o.shape;for(let e of o.keys){let o=l[e]._zod.run({value:a[e],issues:[]},i);o instanceof Promise?s.push(o.then(o=>tv(o,t,e,a))):tv(o,t,e,a)}return n?ty(s,a,t,i,r.value,e):s.length?Promise.all(s).then(()=>t):t}}),tb=d("$ZodObjectJIT",(e,t)=>{let o,i;tS.init(e,t);let r=e._zod.parse,n=y(()=>t_(t)),a=!m.jitless,s=a&&j.value,l=t.catchall;e._zod.parse=(c,u)=>{i??(i=n.value);let d=c.value;return I(d)?a&&s&&u?.async===!1&&!0!==u.jitless?(o||(o=(e=>{let t=new eH(["shape","payload","ctx"]),o=n.value,i=e=>{let t=z(e);return`shape[${t}]._zod.run({ value: input[${t}], issues: [] }, ctx)`};t.write("const input = payload.value;");let r=Object.create(null),a=0;for(let e of o.keys)r[e]=`key_${a++}`;for(let e of(t.write("const newResult = {};"),o.keys)){let o=r[e],n=z(e);t.write(`const ${o} = ${i(e)};`),t.write(`
|
|
51
|
+
if (${o}.issues.length) {
|
|
52
|
+
payload.issues = payload.issues.concat(${o}.issues.map(iss => ({
|
|
53
|
+
...iss,
|
|
54
|
+
path: iss.path ? [${n}, ...iss.path] : [${n}]
|
|
55
|
+
})));
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
if (${o}.value === undefined) {
|
|
60
|
+
if (${n} in input) {
|
|
61
|
+
newResult[${n}] = undefined;
|
|
62
|
+
}
|
|
63
|
+
} else {
|
|
64
|
+
newResult[${n}] = ${o}.value;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
`)}t.write("payload.value = newResult;"),t.write("return payload;");let s=t.compile();return(t,o)=>s(e,t,o)})(t.shape)),c=o(c,u),l)?ty([],d,c,u,i,e):c:r(c,u):(c.issues.push({expected:"object",code:"invalid_type",input:d,inst:e}),c)}});function tk(e,t,o,i){for(let o of e)if(0===o.issues.length)return t.value=o.value,t;let r=e.filter(e=>!M(e));return 1===r.length?(t.value=r[0].value,r[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:o,errors:e.map(e=>e.issues.map(e=>A(e,i,f())))}),t)}let tP=d("$ZodUnion",(e,t)=>{eV.init(e,t),k(e._zod,"optin",()=>t.options.some(e=>"optional"===e._zod.optin)?"optional":void 0),k(e._zod,"optout",()=>t.options.some(e=>"optional"===e._zod.optout)?"optional":void 0),k(e._zod,"values",()=>{if(t.options.every(e=>e._zod.values))return new Set(t.options.flatMap(e=>Array.from(e._zod.values)))}),k(e._zod,"pattern",()=>{if(t.options.every(e=>e._zod.pattern)){let e=t.options.map(e=>e._zod.pattern);return RegExp(`^(${e.map(e=>S(e.source)).join("|")})$`)}});let o=1===t.options.length,i=t.options[0]._zod.run;e._zod.parse=(r,n)=>{if(o)return i(r,n);let a=!1,s=[];for(let e of t.options){let t=e._zod.run({value:r.value,issues:[]},n);if(t instanceof Promise)s.push(t),a=!0;else{if(0===t.issues.length)return t;s.push(t)}}return a?Promise.all(s).then(t=>tk(t,r,e,n)):tk(s,r,e,n)}}),tw=d("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,tP.init(e,t);let o=e._zod.parse;k(e._zod,"propValues",()=>{let e={};for(let o of t.options){let i=o._zod.propValues;if(!i||0===Object.keys(i).length)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(o)}"`);for(let[t,o]of Object.entries(i))for(let i of(e[t]||(e[t]=new Set),o))e[t].add(i)}return e});let i=y(()=>{let e=t.options,o=new Map;for(let i of e){let e=i._zod.propValues?.[t.discriminator];if(!e||0===e.size)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(i)}"`);for(let t of e){if(o.has(t))throw Error(`Duplicate discriminator value "${String(t)}"`);o.set(t,i)}}return o});e._zod.parse=(r,n)=>{let a=r.value;if(!I(a))return r.issues.push({code:"invalid_type",expected:"object",input:a,inst:e}),r;let s=i.value.get(a?.[t.discriminator]);return s?s._zod.run(r,n):t.unionFallback?o(r,n):(r.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,input:a,path:[t.discriminator],inst:e}),r)}}),tz=d("$ZodIntersection",(e,t)=>{eV.init(e,t),e._zod.parse=(e,o)=>{let i=e.value,r=t.left._zod.run({value:i,issues:[]},o),n=t.right._zod.run({value:i,issues:[]},o);return r instanceof Promise||n instanceof Promise?Promise.all([r,n]).then(([t,o])=>tR(e,t,o)):tR(e,r,n)}});function tR(e,t,o){if(t.issues.length&&e.issues.push(...t.issues),o.issues.length&&e.issues.push(...o.issues),M(e))return e;let i=function e(t,o){if(t===o||t instanceof Date&&o instanceof Date&&+t==+o)return{valid:!0,data:t};if(x(t)&&x(o)){let i=Object.keys(o),r=Object.keys(t).filter(e=>-1!==i.indexOf(e)),n={...t,...o};for(let i of r){let r=e(t[i],o[i]);if(!r.valid)return{valid:!1,mergeErrorPath:[i,...r.mergeErrorPath]};n[i]=r.data}return{valid:!0,data:n}}if(Array.isArray(t)&&Array.isArray(o)){if(t.length!==o.length)return{valid:!1,mergeErrorPath:[]};let i=[];for(let r=0;r<t.length;r++){let n=e(t[r],o[r]);if(!n.valid)return{valid:!1,mergeErrorPath:[r,...n.mergeErrorPath]};i.push(n.data)}return{valid:!0,data:i}}return{valid:!1,mergeErrorPath:[]}}(t.value,o.value);if(!i.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(i.mergeErrorPath)}`);return e.value=i.data,e}let tI=d("$ZodRecord",(e,t)=>{eV.init(e,t),e._zod.parse=(o,i)=>{let r=o.value;if(!x(r))return o.issues.push({expected:"record",code:"invalid_type",input:r,inst:e}),o;let n=[],a=t.keyType._zod.values;if(a){let s;o.value={};let l=new Set;for(let e of a)if("string"==typeof e||"number"==typeof e||"symbol"==typeof e){l.add("number"==typeof e?e.toString():e);let a=t.valueType._zod.run({value:r[e],issues:[]},i);a instanceof Promise?n.push(a.then(t=>{t.issues.length&&o.issues.push(...L(e,t.issues)),o.value[e]=t.value})):(a.issues.length&&o.issues.push(...L(e,a.issues)),o.value[e]=a.value)}for(let e in r)l.has(e)||(s=s??[]).push(e);s&&s.length>0&&o.issues.push({code:"unrecognized_keys",input:r,inst:e,keys:s})}else for(let a of(o.value={},Reflect.ownKeys(r))){if("__proto__"===a)continue;let s=t.keyType._zod.run({value:a,issues:[]},i);if(s instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(s.issues.length){"loose"===t.mode?o.value[a]=r[a]:o.issues.push({code:"invalid_key",origin:"record",issues:s.issues.map(e=>A(e,i,f())),input:a,path:[a],inst:e});continue}let l=t.valueType._zod.run({value:r[a],issues:[]},i);l instanceof Promise?n.push(l.then(e=>{e.issues.length&&o.issues.push(...L(a,e.issues)),o.value[s.value]=e.value})):(l.issues.length&&o.issues.push(...L(a,l.issues)),o.value[s.value]=l.value)}return n.length?Promise.all(n).then(()=>o):o}}),tj=d("$ZodEnum",(e,t)=>{eV.init(e,t);let o=g(t.entries),i=new Set(o);e._zod.values=i,e._zod.pattern=RegExp(`^(${o.filter(e=>q.has(typeof e)).map(e=>"string"==typeof e?Y(e):e.toString()).join("|")})$`),e._zod.parse=(t,r)=>{let n=t.value;return i.has(n)||t.issues.push({code:"invalid_value",values:o,input:n,inst:e}),t}}),tx=d("$ZodLiteral",(e,t)=>{if(eV.init(e,t),0===t.values.length)throw Error("Cannot create literal schema with no valid values");let o=new Set(t.values);e._zod.values=o,e._zod.pattern=RegExp(`^(${t.values.map(e=>"string"==typeof e?Y(e):e?Y(e.toString()):String(e)).join("|")})$`),e._zod.parse=(i,r)=>{let n=i.value;return o.has(n)||i.issues.push({code:"invalid_value",values:t.values,input:n,inst:e}),i}}),tC=d("$ZodTransform",(e,t)=>{eV.init(e,t),e._zod.parse=(o,i)=>{if("backward"===i.direction)throw new h(e.constructor.name);let r=t.transform(o.value,o);if(i.async)return(r instanceof Promise?r:Promise.resolve(r)).then(e=>(o.value=e,o));if(r instanceof Promise)throw new p;return o.value=r,o}});function tq(e,t){return e.issues.length&&void 0===t?{issues:[],value:void 0}:e}let tY=d("$ZodOptional",(e,t)=>{eV.init(e,t),e._zod.optin="optional",e._zod.optout="optional",k(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),k(e._zod,"pattern",()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${S(e.source)})?$`):void 0}),e._zod.parse=(e,o)=>{if("optional"===t.innerType._zod.optin){let i=t.innerType._zod.run(e,o);return i instanceof Promise?i.then(t=>tq(t,e.value)):tq(i,e.value)}return void 0===e.value?e:t.innerType._zod.run(e,o)}}),tO=d("$ZodNullable",(e,t)=>{eV.init(e,t),k(e._zod,"optin",()=>t.innerType._zod.optin),k(e._zod,"optout",()=>t.innerType._zod.optout),k(e._zod,"pattern",()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${S(e.source)}|null)$`):void 0}),k(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(e,o)=>null===e.value?e:t.innerType._zod.run(e,o)}),tT=d("$ZodDefault",(e,t)=>{eV.init(e,t),e._zod.optin="optional",k(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(e,o)=>{if("backward"===o.direction)return t.innerType._zod.run(e,o);if(void 0===e.value)return e.value=t.defaultValue,e;let i=t.innerType._zod.run(e,o);return i instanceof Promise?i.then(e=>t$(e,t)):t$(i,t)}});function t$(e,t){return void 0===e.value&&(e.value=t.defaultValue),e}let tE=d("$ZodPrefault",(e,t)=>{eV.init(e,t),e._zod.optin="optional",k(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(e,o)=>("backward"===o.direction||void 0===e.value&&(e.value=t.defaultValue),t.innerType._zod.run(e,o))}),tM=d("$ZodNonOptional",(e,t)=>{eV.init(e,t),k(e._zod,"values",()=>{let e=t.innerType._zod.values;return e?new Set([...e].filter(e=>void 0!==e)):void 0}),e._zod.parse=(o,i)=>{let r=t.innerType._zod.run(o,i);return r instanceof Promise?r.then(t=>tL(t,e)):tL(r,e)}});function tL(e,t){return e.issues.length||void 0!==e.value||e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}let tN=d("$ZodCatch",(e,t)=>{eV.init(e,t),k(e._zod,"optin",()=>t.innerType._zod.optin),k(e._zod,"optout",()=>t.innerType._zod.optout),k(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(e,o)=>{if("backward"===o.direction)return t.innerType._zod.run(e,o);let i=t.innerType._zod.run(e,o);return i instanceof Promise?i.then(i=>(e.value=i.value,i.issues.length&&(e.value=t.catchValue({...e,error:{issues:i.issues.map(e=>A(e,o,f()))},input:e.value}),e.issues=[]),e)):(e.value=i.value,i.issues.length&&(e.value=t.catchValue({...e,error:{issues:i.issues.map(e=>A(e,o,f()))},input:e.value}),e.issues=[]),e)}}),tA=d("$ZodPipe",(e,t)=>{eV.init(e,t),k(e._zod,"values",()=>t.in._zod.values),k(e._zod,"optin",()=>t.in._zod.optin),k(e._zod,"optout",()=>t.out._zod.optout),k(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(e,o)=>{if("backward"===o.direction){let i=t.out._zod.run(e,o);return i instanceof Promise?i.then(e=>tU(e,t.in,o)):tU(i,t.in,o)}let i=t.in._zod.run(e,o);return i instanceof Promise?i.then(e=>tU(e,t.out,o)):tU(i,t.out,o)}});function tU(e,t,o){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},o)}let tH=d("$ZodReadonly",(e,t)=>{eV.init(e,t),k(e._zod,"propValues",()=>t.innerType._zod.propValues),k(e._zod,"values",()=>t.innerType._zod.values),k(e._zod,"optin",()=>t.innerType?._zod?.optin),k(e._zod,"optout",()=>t.innerType?._zod?.optout),e._zod.parse=(e,o)=>{if("backward"===o.direction)return t.innerType._zod.run(e,o);let i=t.innerType._zod.run(e,o);return i instanceof Promise?i.then(tZ):tZ(i)}});function tZ(e){return e.value=Object.freeze(e.value),e}let tV=d("$ZodLazy",(e,t)=>{eV.init(e,t),k(e._zod,"innerType",()=>t.getter()),k(e._zod,"pattern",()=>e._zod.innerType?._zod?.pattern),k(e._zod,"propValues",()=>e._zod.innerType?._zod?.propValues),k(e._zod,"optin",()=>e._zod.innerType?._zod?.optin??void 0),k(e._zod,"optout",()=>e._zod.innerType?._zod?.optout??void 0),e._zod.parse=(t,o)=>e._zod.innerType._zod.run(t,o)}),tJ=d("$ZodCustom",(e,t)=>{ez.init(e,t),eV.init(e,t),e._zod.parse=(e,t)=>e,e._zod.check=o=>{let i=o.value,r=t.fn(i);if(r instanceof Promise)return r.then(t=>tD(t,o,i,e));tD(r,o,i,e)}});function tD(e,t,o,i){if(!e){let e={code:"custom",input:o,inst:i,path:[...i._zod.def.path??[]],continue:!i._zod.def.abort};i._zod.def.params&&(e.params=i._zod.def.params),t.issues.push(H(e))}}Symbol("ZodOutput"),Symbol("ZodInput"),(n=globalThis).__zod_globalRegistry??(n.__zod_globalRegistry=new class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){let o=t[0];if(this._map.set(e,o),o&&"object"==typeof o&&"id"in o){if(this._idmap.has(o.id))throw Error(`ID ${o.id} already exists in the registry`);this._idmap.set(o.id,e)}return this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let t=this._map.get(e);return t&&"object"==typeof t&&"id"in t&&this._idmap.delete(t.id),this._map.delete(e),this}get(e){let t=e._zod.parent;if(t){let o={...this.get(t)??{}};delete o.id;let i={...o,...this._map.get(e)};return Object.keys(i).length?i:void 0}return this._map.get(e)}has(e){return this._map.has(e)}});let tF=globalThis.__zod_globalRegistry;function tK(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...T(t)})}function tB(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...T(t)})}function tW(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...T(t)})}function tG(e,t){return new eI({check:"less_than",...T(t),value:e,inclusive:!1})}function tX(e,t){return new eI({check:"less_than",...T(t),value:e,inclusive:!0})}function tQ(e,t){return new ej({check:"greater_than",...T(t),value:e,inclusive:!1})}function t0(e,t){return new ej({check:"greater_than",...T(t),value:e,inclusive:!0})}function t1(e,t){return new ex({check:"multiple_of",...T(t),value:e})}function t2(e,t){return new eq({check:"max_length",...T(t),maximum:e})}function t9(e,t){return new eY({check:"min_length",...T(t),minimum:e})}function t4(e,t){return new eO({check:"length_equals",...T(t),length:e})}function t5(e){return new eU({check:"overwrite",tx:e})}function t3(e){let t=e?.target??"draft-2020-12";return"draft-4"===t&&(t="draft-04"),"draft-7"===t&&(t="draft-07"),{processors:e.processors??{},metadataRegistry:e?.metadata??tF,target:t,unrepresentable:e?.unrepresentable??"throw",override:e?.override??(()=>{}),io:e?.io??"output",counter:0,seen:new Map,cycles:e?.cycles??"ref",reused:e?.reused??"inline",external:e?.external??void 0}}function t6(e,t,o={path:[],schemaPath:[]}){var i;let r=e._zod.def,n=t.seen.get(e);if(n)return n.count++,o.schemaPath.includes(e)&&(n.cycle=o.path),n.schema;let a={schema:{},count:1,cycle:void 0,path:o.path};t.seen.set(e,a);let s=e._zod.toJSONSchema?.();if(s)a.schema=s;else{let i={...o,schemaPath:[...o.schemaPath,e],path:o.path},n=e._zod.parent;if(n)a.ref=n,t6(n,t,i),t.seen.get(n).isParent=!0;else if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,a.schema,i);else{let o=a.schema,n=t.processors[r.type];if(!n)throw Error(`[toJSONSchema]: Non-representable type encountered: ${r.type}`);n(e,t,o,i)}}let l=t.metadataRegistry.get(e);return l&&Object.assign(a.schema,l),"input"===t.io&&function e(t,o){let i=o??{seen:new Set};if(i.seen.has(t))return!1;i.seen.add(t);let r=t._zod.def;if("transform"===r.type)return!0;if("array"===r.type)return e(r.element,i);if("set"===r.type)return e(r.valueType,i);if("lazy"===r.type)return e(r.getter(),i);if("promise"===r.type||"optional"===r.type||"nonoptional"===r.type||"nullable"===r.type||"readonly"===r.type||"default"===r.type||"prefault"===r.type)return e(r.innerType,i);if("intersection"===r.type)return e(r.left,i)||e(r.right,i);if("record"===r.type||"map"===r.type)return e(r.keyType,i)||e(r.valueType,i);if("pipe"===r.type)return e(r.in,i)||e(r.out,i);if("object"===r.type){for(let t in r.shape)if(e(r.shape[t],i))return!0;return!1}if("union"===r.type){for(let t of r.options)if(e(t,i))return!0;return!1}if("tuple"===r.type){for(let t of r.items)if(e(t,i))return!0;if(r.rest&&e(r.rest,i))return!0}return!1}(e)&&(delete a.schema.examples,delete a.schema.default),"input"===t.io&&a.schema._prefault&&((i=a.schema).default??(i.default=a.schema._prefault)),delete a.schema._prefault,t.seen.get(e).schema}function t8(e,t){let o=e.seen.get(t);if(!o)throw Error("Unprocessed schema. This is a bug in Zod.");let i=t=>{if(t[1].schema.$ref)return;let i=t[1],{ref:r,defId:n}=(t=>{let i="draft-2020-12"===e.target?"$defs":"definitions";if(e.external){let o=e.external.registry.get(t[0])?.id,r=e.external.uri??(e=>e);if(o)return{ref:r(o)};let n=t[1].defId??t[1].schema.id??`schema${e.counter++}`;return t[1].defId=n,{defId:n,ref:`${r("__shared")}#/${i}/${n}`}}if(t[1]===o)return{ref:"#"};let r=`#/${i}/`,n=t[1].schema.id??`__schema${e.counter++}`;return{defId:n,ref:r+n}})(t);i.def={...i.schema},n&&(i.defId=n);let a=i.schema;for(let e in a)delete a[e];a.$ref=r};if("throw"===e.cycles)for(let t of e.seen.entries()){let e=t[1];if(e.cycle)throw Error(`Cycle detected: #/${e.cycle?.join("/")}/<root>
|
|
68
|
+
|
|
69
|
+
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let o of e.seen.entries()){let r=o[1];if(t===o[0]){i(o);continue}if(e.external){let r=e.external.registry.get(o[0])?.id;if(t!==o[0]&&r){i(o);continue}}if(e.metadataRegistry.get(o[0])?.id||r.cycle||r.count>1&&"ref"===e.reused){i(o);continue}}}function t7(e,t){let o=e.seen.get(t);if(!o)throw Error("Unprocessed schema. This is a bug in Zod.");let i=t=>{let o=e.seen.get(t),r=o.def??o.schema,n={...r};if(null===o.ref)return;let a=o.ref;if(o.ref=null,a){i(a);let t=e.seen.get(a).schema;t.$ref&&("draft-07"===e.target||"draft-04"===e.target||"openapi-3.0"===e.target)?(r.allOf=r.allOf??[],r.allOf.push(t)):(Object.assign(r,t),Object.assign(r,n))}o.isParent||e.override({zodSchema:t,jsonSchema:r,path:o.path??[]})};for(let t of[...e.seen.entries()].reverse())i(t[0]);let r={};if("draft-2020-12"===e.target?r.$schema="https://json-schema.org/draft/2020-12/schema":"draft-07"===e.target?r.$schema="http://json-schema.org/draft-07/schema#":"draft-04"===e.target?r.$schema="http://json-schema.org/draft-04/schema#":e.target,e.external?.uri){let o=e.external.registry.get(t)?.id;if(!o)throw Error("Schema is missing an `id` property");r.$id=e.external.uri(o)}Object.assign(r,o.def??o.schema);let n=e.external?.defs??{};for(let t of e.seen.entries()){let e=t[1];e.def&&e.defId&&(n[e.defId]=e.def)}e.external||Object.keys(n).length>0&&("draft-2020-12"===e.target?r.$defs=n:r.definitions=n);try{let e=JSON.parse(JSON.stringify(r));return Object.defineProperty(e,"~standard",{value:{...t["~standard"],jsonSchema:{input:oe(t,"input"),output:oe(t,"output")}},enumerable:!1,writable:!1}),e}catch(e){throw Error("Error converting schema to JSON.")}}let oe=(e,t)=>o=>{let{libraryOptions:i,target:r}=o??{},n=t3({...i??{},target:r,io:t,processors:{}});return t6(e,n),t8(n,e),t7(n,e)},ot={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},oo=(e,t,o,i)=>{o.type="string";let{minimum:r,maximum:n,format:a,patterns:s,contentEncoding:l}=e._zod.bag;if("number"==typeof r&&(o.minLength=r),"number"==typeof n&&(o.maxLength=n),a&&(o.format=ot[a]??a,""===o.format&&delete o.format),l&&(o.contentEncoding=l),s&&s.size>0){let e=[...s];1===e.length?o.pattern=e[0].source:e.length>1&&(o.allOf=[...e.map(e=>({..."draft-07"===t.target||"draft-04"===t.target||"openapi-3.0"===t.target?{type:"string"}:{},pattern:e.source}))])}},oi=(e,t,o,i)=>{let{minimum:r,maximum:n,format:a,multipleOf:s,exclusiveMaximum:l,exclusiveMinimum:c}=e._zod.bag;"string"==typeof a&&a.includes("int")?o.type="integer":o.type="number","number"==typeof c&&("draft-04"===t.target||"openapi-3.0"===t.target?(o.minimum=c,o.exclusiveMinimum=!0):o.exclusiveMinimum=c),"number"==typeof r&&(o.minimum=r,"number"==typeof c&&"draft-04"!==t.target&&(c>=r?delete o.minimum:delete o.exclusiveMinimum)),"number"==typeof l&&("draft-04"===t.target||"openapi-3.0"===t.target?(o.maximum=l,o.exclusiveMaximum=!0):o.exclusiveMaximum=l),"number"==typeof n&&(o.maximum=n,"number"==typeof l&&"draft-04"!==t.target&&(l<=n?delete o.maximum:delete o.exclusiveMaximum)),"number"==typeof s&&(o.multipleOf=s)},or=(e,t,o,i)=>{o.type="boolean"},on=(e,t,o,i)=>{"openapi-3.0"===t.target?(o.type="string",o.nullable=!0,o.enum=[null]):o.type="null"},oa=(e,t,o,i)=>{if("throw"===t.unrepresentable)throw Error("Undefined cannot be represented in JSON Schema")},os=(e,t,o,i)=>{o.not={}},ol=(e,t,o,i)=>{},oc=(e,t,o,i)=>{},ou=(e,t,o,i)=>{let r=g(e._zod.def.entries);r.every(e=>"number"==typeof e)&&(o.type="number"),r.every(e=>"string"==typeof e)&&(o.type="string"),o.enum=r},od=(e,t,o,i)=>{let r=e._zod.def,n=[];for(let e of r.values)if(void 0===e){if("throw"===t.unrepresentable)throw Error("Literal `undefined` cannot be represented in JSON Schema")}else if("bigint"==typeof e)if("throw"===t.unrepresentable)throw Error("BigInt literals cannot be represented in JSON Schema");else n.push(Number(e));else n.push(e);if(0===n.length);else if(1===n.length){let e=n[0];o.type=null===e?"null":typeof e,"draft-04"===t.target||"openapi-3.0"===t.target?o.enum=[e]:o.const=e}else n.every(e=>"number"==typeof e)&&(o.type="number"),n.every(e=>"string"==typeof e)&&(o.type="string"),n.every(e=>"boolean"==typeof e)&&(o.type="boolean"),n.every(e=>null===e)&&(o.type="null"),o.enum=n},op=(e,t,o,i)=>{if("throw"===t.unrepresentable)throw Error("Custom types cannot be represented in JSON Schema")},oh=(e,t,o,i)=>{if("throw"===t.unrepresentable)throw Error("Transforms cannot be represented in JSON Schema")},om=(e,t,o,i)=>{let r=e._zod.def,{minimum:n,maximum:a}=e._zod.bag;"number"==typeof n&&(o.minItems=n),"number"==typeof a&&(o.maxItems=a),o.type="array",o.items=t6(r.element,t,{...i,path:[...i.path,"items"]})},of=(e,t,o,i)=>{let r=e._zod.def;o.type="object",o.properties={};let n=r.shape;for(let e in n)o.properties[e]=t6(n[e],t,{...i,path:[...i.path,"properties",e]});let a=new Set([...new Set(Object.keys(n))].filter(e=>{let o=r.shape[e]._zod;return"input"===t.io?void 0===o.optin:void 0===o.optout}));a.size>0&&(o.required=Array.from(a)),r.catchall?._zod.def.type==="never"?o.additionalProperties=!1:r.catchall?r.catchall&&(o.additionalProperties=t6(r.catchall,t,{...i,path:[...i.path,"additionalProperties"]})):"output"===t.io&&(o.additionalProperties=!1)},og=(e,t,o,i)=>{let r=e._zod.def,n=!1===r.inclusive,a=r.options.map((e,o)=>t6(e,t,{...i,path:[...i.path,n?"oneOf":"anyOf",o]}));n?o.oneOf=a:o.anyOf=a},ov=(e,t,o,i)=>{let r=e._zod.def,n=t6(r.left,t,{...i,path:[...i.path,"allOf",0]}),a=t6(r.right,t,{...i,path:[...i.path,"allOf",1]}),s=e=>"allOf"in e&&1===Object.keys(e).length;o.allOf=[...s(n)?n.allOf:[n],...s(a)?a.allOf:[a]]},o_=(e,t,o,i)=>{let r=e._zod.def;o.type="object",("draft-07"===t.target||"draft-2020-12"===t.target)&&(o.propertyNames=t6(r.keyType,t,{...i,path:[...i.path,"propertyNames"]})),o.additionalProperties=t6(r.valueType,t,{...i,path:[...i.path,"additionalProperties"]})},oy=(e,t,o,i)=>{let r=e._zod.def,n=t6(r.innerType,t,i),a=t.seen.get(e);"openapi-3.0"===t.target?(a.ref=r.innerType,o.nullable=!0):o.anyOf=[n,{type:"null"}]},oS=(e,t,o,i)=>{let r=e._zod.def;t6(r.innerType,t,i),t.seen.get(e).ref=r.innerType},ob=(e,t,o,i)=>{let r=e._zod.def;t6(r.innerType,t,i),t.seen.get(e).ref=r.innerType,o.default=JSON.parse(JSON.stringify(r.defaultValue))},ok=(e,t,o,i)=>{let r=e._zod.def;t6(r.innerType,t,i),t.seen.get(e).ref=r.innerType,"input"===t.io&&(o._prefault=JSON.parse(JSON.stringify(r.defaultValue)))},oP=(e,t,o,i)=>{let r,n=e._zod.def;t6(n.innerType,t,i),t.seen.get(e).ref=n.innerType;try{r=n.catchValue(void 0)}catch{throw Error("Dynamic catch values are not supported in JSON Schema")}o.default=r},ow=(e,t,o,i)=>{let r=e._zod.def,n="input"===t.io?"transform"===r.in._zod.def.type?r.out:r.in:r.out;t6(n,t,i),t.seen.get(e).ref=n},oz=(e,t,o,i)=>{let r=e._zod.def;t6(r.innerType,t,i),t.seen.get(e).ref=r.innerType,o.readOnly=!0},oR=(e,t,o,i)=>{let r=e._zod.def;t6(r.innerType,t,i),t.seen.get(e).ref=r.innerType},oI=(e,t,o,i)=>{let r=e._zod.innerType;t6(r,t,i),t.seen.get(e).ref=r},oj={string:oo,number:oi,boolean:or,bigint:(e,t,o,i)=>{if("throw"===t.unrepresentable)throw Error("BigInt cannot be represented in JSON Schema")},symbol:(e,t,o,i)=>{if("throw"===t.unrepresentable)throw Error("Symbols cannot be represented in JSON Schema")},null:on,undefined:oa,void:(e,t,o,i)=>{if("throw"===t.unrepresentable)throw Error("Void cannot be represented in JSON Schema")},never:os,any:ol,unknown:oc,date:(e,t,o,i)=>{if("throw"===t.unrepresentable)throw Error("Date cannot be represented in JSON Schema")},enum:ou,literal:od,nan:(e,t,o,i)=>{if("throw"===t.unrepresentable)throw Error("NaN cannot be represented in JSON Schema")},template_literal:(e,t,o,i)=>{let r=e._zod.pattern;if(!r)throw Error("Pattern not found in template literal");o.type="string",o.pattern=r.source},file:(e,t,o,i)=>{let r={type:"string",format:"binary",contentEncoding:"binary"},{minimum:n,maximum:a,mime:s}=e._zod.bag;void 0!==n&&(r.minLength=n),void 0!==a&&(r.maxLength=a),s?1===s.length?(r.contentMediaType=s[0],Object.assign(o,r)):o.anyOf=s.map(e=>({...r,contentMediaType:e})):Object.assign(o,r)},success:(e,t,o,i)=>{o.type="boolean"},custom:op,function:(e,t,o,i)=>{if("throw"===t.unrepresentable)throw Error("Function types cannot be represented in JSON Schema")},transform:oh,map:(e,t,o,i)=>{if("throw"===t.unrepresentable)throw Error("Map cannot be represented in JSON Schema")},set:(e,t,o,i)=>{if("throw"===t.unrepresentable)throw Error("Set cannot be represented in JSON Schema")},array:om,object:of,union:og,intersection:ov,tuple:(e,t,o,i)=>{let r=e._zod.def;o.type="array";let n="draft-2020-12"===t.target?"prefixItems":"items",a="draft-2020-12"===t.target||"openapi-3.0"===t.target?"items":"additionalItems",s=r.items.map((e,o)=>t6(e,t,{...i,path:[...i.path,n,o]})),l=r.rest?t6(r.rest,t,{...i,path:[...i.path,a,..."openapi-3.0"===t.target?[r.items.length]:[]]}):null;"draft-2020-12"===t.target?(o.prefixItems=s,l&&(o.items=l)):"openapi-3.0"===t.target?(o.items={anyOf:s},l&&o.items.anyOf.push(l),o.minItems=s.length,l||(o.maxItems=s.length)):(o.items=s,l&&(o.additionalItems=l));let{minimum:c,maximum:u}=e._zod.bag;"number"==typeof c&&(o.minItems=c),"number"==typeof u&&(o.maxItems=u)},record:o_,nullable:oy,nonoptional:oS,default:ob,prefault:ok,catch:oP,pipe:ow,readonly:oz,promise:(e,t,o,i)=>{let r=e._zod.def;t6(r.innerType,t,i),t.seen.get(e).ref=r.innerType},optional:oR,lazy:oI};function ox(e,t){if("_idmap"in e){let o=t3({...t,processors:oj}),i={};for(let t of e._idmap.entries()){let[e,i]=t;t6(i,o)}let r={};for(let n of(o.external={registry:e,uri:t?.uri,defs:i},e._idmap.entries())){let[e,t]=n;t8(o,t),r[e]=t7(o,t)}return Object.keys(i).length>0&&(r.__shared={["draft-2020-12"===o.target?"$defs":"definitions"]:i}),{schemas:r}}let o=t3({...t,processors:oj});return t6(e,o),t8(o,e),t7(o,e)}let oC=d("ZodISODateTime",(e,t)=>{e4.init(e,t),oX.init(e,t)});function oq(e){return new oC({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...T(e)})}let oY=d("ZodISODate",(e,t)=>{e5.init(e,t),oX.init(e,t)});function oO(e){return new oY({type:"string",format:"date",check:"string_format",...T(e)})}let oT=d("ZodISOTime",(e,t)=>{e3.init(e,t),oX.init(e,t)});function o$(e){return new oT({type:"string",format:"time",check:"string_format",precision:null,...T(e)})}let oE=d("ZodISODuration",(e,t)=>{e6.init(e,t),oX.init(e,t)});function oM(e){return new oE({type:"string",format:"duration",check:"string_format",...T(e)})}let oL=(e,t)=>{V.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:t=>(function(e,t=e=>e.message){let o={_errors:[]},i=e=>{for(let r of e.issues)if("invalid_union"===r.code&&r.errors.length)r.errors.map(e=>i({issues:e}));else if("invalid_key"===r.code)i({issues:r.issues});else if("invalid_element"===r.code)i({issues:r.issues});else if(0===r.path.length)o._errors.push(t(r));else{let e=o,i=0;for(;i<r.path.length;){let o=r.path[i];i===r.path.length-1?(e[o]=e[o]||{_errors:[]},e[o]._errors.push(t(r))):e[o]=e[o]||{_errors:[]},e=e[o],i++}}};return i(e),o})(e,t)},flatten:{value:t=>(function(e,t=e=>e.message){let o={},i=[];for(let r of e.issues)r.path.length>0?(o[r.path[0]]=o[r.path[0]]||[],o[r.path[0]].push(t(r))):i.push(t(r));return{formErrors:i,fieldErrors:o}})(e,t)},addIssue:{value:t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,_,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,_,2)}},isEmpty:{get:()=>0===e.issues.length}})};d("ZodError",oL);let oN=d("ZodError",oL,{Parent:Error}),oA=D(oN),oU=F(oN),oH=K(oN),oZ=W(oN),oV=async(e,t,o)=>{let i=o?Object.assign(o,{direction:"backward"}):{direction:"backward"};return F(oN)(e,t,i)},oJ=async(e,t,o)=>F(oN)(e,t,o),oD=async(e,t,o)=>{let i=o?Object.assign(o,{direction:"backward"}):{direction:"backward"};return W(oN)(e,t,i)},oF=async(e,t,o)=>W(oN)(e,t,o),oK=d("ZodType",(e,t)=>(eV.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:oe(e,"input"),output:oe(e,"output")}}),e.toJSONSchema=((e,t={})=>o=>{let i=t3({...o,processors:t});return t6(e,i),t8(i,e),t7(i,e)})(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.check=(...o)=>e.clone(w(t,{checks:[...t.checks??[],...o.map(e=>"function"==typeof e?{_zod:{check:e,def:{check:"custom"},onattach:[]}}:e)]})),e.clone=(t,o)=>O(e,t,o),e.brand=()=>e,e.register=(t,o)=>(t.add(e,o),e),e.parse=(t,o)=>oA(e,t,o,{callee:e.parse}),e.safeParse=(t,o)=>oH(e,t,o),e.parseAsync=async(t,o)=>oU(e,t,o,{callee:e.parseAsync}),e.safeParseAsync=async(t,o)=>oZ(e,t,o),e.spa=e.safeParseAsync,e.encode=(t,o)=>{let i;return i=o?Object.assign(o,{direction:"backward"}):{direction:"backward"},D(oN)(e,t,i)},e.decode=(t,o)=>D(oN)(e,t,o),e.encodeAsync=async(t,o)=>oV(e,t,o),e.decodeAsync=async(t,o)=>oJ(e,t,o),e.safeEncode=(t,o)=>{let i;return i=o?Object.assign(o,{direction:"backward"}):{direction:"backward"},K(oN)(e,t,i)},e.safeDecode=(t,o)=>K(oN)(e,t,o),e.safeEncodeAsync=async(t,o)=>oD(e,t,o),e.safeDecodeAsync=async(t,o)=>oF(e,t,o),e.refine=(t,o)=>e.check(function(e,t={}){return new i3({type:"custom",check:"custom",fn:e,...T(t)})}(t,o)),e.superRefine=t=>{var o;let i,r;return e.check((o=e=>(e.addIssue=t=>{"string"==typeof t?e.issues.push(H(t,e.value,i._zod.def)):(t.fatal&&(t.continue=!1),t.code??(t.code="custom"),t.input??(t.input=e.value),t.inst??(t.inst=i),t.continue??(t.continue=!i._zod.def.abort),e.issues.push(H(t)))},t(e.value,e)),(r=new ez({check:"custom",...T(void 0)}))._zod.check=o,i=r))},e.overwrite=t=>e.check(t5(t)),e.optional=()=>iK(e),e.nullable=()=>iW(e),e.nullish=()=>iK(iW(e)),e.nonoptional=t=>new iQ({type:"nonoptional",innerType:e,...T(t)}),e.array=()=>ix(e),e.or=t=>iT([e,t]),e.and=t=>iL(e,t),e.transform=t=>i2(e,iD(t)),e.default=t=>new iG({type:"default",innerType:e,get defaultValue(){return"function"==typeof t?t():C(t)}}),e.prefault=t=>new iX({type:"prefault",innerType:e,get defaultValue(){return"function"==typeof t?t():C(t)}}),e.catch=t=>new i0({type:"catch",innerType:e,catchValue:"function"==typeof t?t:()=>t}),e.pipe=t=>i2(e,t),e.readonly=()=>new i9({type:"readonly",innerType:e}),e.describe=t=>{let o=e.clone();return tF.add(o,{description:t}),o},Object.defineProperty(e,"description",{get:()=>tF.get(e)?.description,configurable:!0}),e.meta=(...t)=>{if(0===t.length)return tF.get(e);let o=e.clone();return tF.add(o,t[0]),o},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e)),oB=d("_ZodString",(e,t)=>{eJ.init(e,t),oK.init(e,t),e._zod.processJSONSchema=(t,o,i)=>oo(e,t,o,i);let o=e._zod.bag;e.format=o.format??null,e.minLength=o.minimum??null,e.maxLength=o.maximum??null,e.regex=(...t)=>e.check(function(e,t){return new e$({check:"string_format",format:"regex",...T(t),pattern:e})}(...t)),e.includes=(...t)=>e.check(function(e,t){return new eL({check:"string_format",format:"includes",...T(t),includes:e})}(...t)),e.startsWith=(...t)=>e.check(function(e,t){return new eN({check:"string_format",format:"starts_with",...T(t),prefix:e})}(...t)),e.endsWith=(...t)=>e.check(function(e,t){return new eA({check:"string_format",format:"ends_with",...T(t),suffix:e})}(...t)),e.min=(...t)=>e.check(t9(...t)),e.max=(...t)=>e.check(t2(...t)),e.length=(...t)=>e.check(t4(...t)),e.nonempty=(...t)=>e.check(t9(1,...t)),e.lowercase=t=>e.check(new eE({check:"string_format",format:"lowercase",...T(t)})),e.uppercase=t=>e.check(new eM({check:"string_format",format:"uppercase",...T(t)})),e.trim=()=>e.check(t5(e=>e.trim())),e.normalize=(...t)=>e.check(function(e){return t5(t=>t.normalize(e))}(...t)),e.toLowerCase=()=>e.check(t5(e=>e.toLowerCase())),e.toUpperCase=()=>e.check(t5(e=>e.toUpperCase())),e.slugify=()=>e.check(t5(e=>e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")))}),oW=d("ZodString",(e,t)=>{eJ.init(e,t),oB.init(e,t),e.email=t=>e.check(tK(oQ,t)),e.url=t=>e.check(tW(o9,t)),e.jwt=t=>e.check(new iu({type:"string",format:"jwt",check:"string_format",abort:!1,...T(t)})),e.emoji=t=>e.check(new o5({type:"string",format:"emoji",check:"string_format",abort:!1,...T(t)})),e.guid=t=>e.check(tB(o1,t)),e.uuid=t=>e.check(new o2({type:"string",format:"uuid",check:"string_format",abort:!1,...T(t)})),e.uuidv4=t=>e.check(new o2({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...T(t)})),e.uuidv6=t=>e.check(new o2({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...T(t)})),e.uuidv7=t=>e.check(new o2({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...T(t)})),e.nanoid=t=>e.check(new o3({type:"string",format:"nanoid",check:"string_format",abort:!1,...T(t)})),e.guid=t=>e.check(tB(o1,t)),e.cuid=t=>e.check(new o6({type:"string",format:"cuid",check:"string_format",abort:!1,...T(t)})),e.cuid2=t=>e.check(new o8({type:"string",format:"cuid2",check:"string_format",abort:!1,...T(t)})),e.ulid=t=>e.check(new o7({type:"string",format:"ulid",check:"string_format",abort:!1,...T(t)})),e.base64=t=>e.check(new is({type:"string",format:"base64",check:"string_format",abort:!1,...T(t)})),e.base64url=t=>e.check(new il({type:"string",format:"base64url",check:"string_format",abort:!1,...T(t)})),e.xid=t=>e.check(new ie({type:"string",format:"xid",check:"string_format",abort:!1,...T(t)})),e.ksuid=t=>e.check(new it({type:"string",format:"ksuid",check:"string_format",abort:!1,...T(t)})),e.ipv4=t=>e.check(new io({type:"string",format:"ipv4",check:"string_format",abort:!1,...T(t)})),e.ipv6=t=>e.check(new ii({type:"string",format:"ipv6",check:"string_format",abort:!1,...T(t)})),e.cidrv4=t=>e.check(new ir({type:"string",format:"cidrv4",check:"string_format",abort:!1,...T(t)})),e.cidrv6=t=>e.check(new ia({type:"string",format:"cidrv6",check:"string_format",abort:!1,...T(t)})),e.e164=t=>e.check(new ic({type:"string",format:"e164",check:"string_format",abort:!1,...T(t)})),e.datetime=t=>e.check(oq(t)),e.date=t=>e.check(oO(t)),e.time=t=>e.check(o$(t)),e.duration=t=>e.check(oM(t))});function oG(e){return new oW({type:"string",...T(e)})}let oX=d("ZodStringFormat",(e,t)=>{eD.init(e,t),oB.init(e,t)}),oQ=d("ZodEmail",(e,t)=>{eB.init(e,t),oX.init(e,t)});function o0(e){return tK(oQ,e)}let o1=d("ZodGUID",(e,t)=>{eF.init(e,t),oX.init(e,t)}),o2=d("ZodUUID",(e,t)=>{eK.init(e,t),oX.init(e,t)}),o9=d("ZodURL",(e,t)=>{eW.init(e,t),oX.init(e,t)});function o4(e){return tW(o9,e)}let o5=d("ZodEmoji",(e,t)=>{eG.init(e,t),oX.init(e,t)}),o3=d("ZodNanoID",(e,t)=>{eX.init(e,t),oX.init(e,t)}),o6=d("ZodCUID",(e,t)=>{eQ.init(e,t),oX.init(e,t)}),o8=d("ZodCUID2",(e,t)=>{e0.init(e,t),oX.init(e,t)}),o7=d("ZodULID",(e,t)=>{e1.init(e,t),oX.init(e,t)}),ie=d("ZodXID",(e,t)=>{e2.init(e,t),oX.init(e,t)}),it=d("ZodKSUID",(e,t)=>{e9.init(e,t),oX.init(e,t)}),io=d("ZodIPv4",(e,t)=>{e8.init(e,t),oX.init(e,t)}),ii=d("ZodIPv6",(e,t)=>{e7.init(e,t),oX.init(e,t)}),ir=d("ZodCIDRv4",(e,t)=>{te.init(e,t),oX.init(e,t)}),ia=d("ZodCIDRv6",(e,t)=>{tt.init(e,t),oX.init(e,t)}),is=d("ZodBase64",(e,t)=>{ti.init(e,t),oX.init(e,t)}),il=d("ZodBase64URL",(e,t)=>{tr.init(e,t),oX.init(e,t)}),ic=d("ZodE164",(e,t)=>{tn.init(e,t),oX.init(e,t)}),iu=d("ZodJWT",(e,t)=>{ta.init(e,t),oX.init(e,t)}),id=d("ZodNumber",(e,t)=>{ts.init(e,t),oK.init(e,t),e._zod.processJSONSchema=(t,o,i)=>oi(e,t,o,i),e.gt=(t,o)=>e.check(tQ(t,o)),e.gte=(t,o)=>e.check(t0(t,o)),e.min=(t,o)=>e.check(t0(t,o)),e.lt=(t,o)=>e.check(tG(t,o)),e.lte=(t,o)=>e.check(tX(t,o)),e.max=(t,o)=>e.check(tX(t,o)),e.int=t=>e.check(im(t)),e.safe=t=>e.check(im(t)),e.positive=t=>e.check(tQ(0,t)),e.nonnegative=t=>e.check(t0(0,t)),e.negative=t=>e.check(tG(0,t)),e.nonpositive=t=>e.check(tX(0,t)),e.multipleOf=(t,o)=>e.check(t1(t,o)),e.step=(t,o)=>e.check(t1(t,o)),e.finite=()=>e;let o=e._zod.bag;e.minValue=Math.max(o.minimum??-1/0,o.exclusiveMinimum??-1/0)??null,e.maxValue=Math.min(o.maximum??1/0,o.exclusiveMaximum??1/0)??null,e.isInt=(o.format??"").includes("int")||Number.isSafeInteger(o.multipleOf??.5),e.isFinite=!0,e.format=o.format??null});function ip(e){return new id({type:"number",checks:[],...T(e)})}let ih=d("ZodNumberFormat",(e,t)=>{tl.init(e,t),id.init(e,t)});function im(e){return new ih({type:"number",check:"number_format",abort:!1,format:"safeint",...T(e)})}let ig=d("ZodBoolean",(e,t)=>{tc.init(e,t),oK.init(e,t),e._zod.processJSONSchema=(t,o,i)=>or(e,t,o,i)});function iv(e){return new ig({type:"boolean",...T(e)})}let i_=d("ZodUndefined",(e,t)=>{tu.init(e,t),oK.init(e,t),e._zod.processJSONSchema=(t,o,i)=>oa(e,t,o,i)});function iy(e){return new i_({type:"undefined",...T(e)})}let iS=d("ZodNull",(e,t)=>{td.init(e,t),oK.init(e,t),e._zod.processJSONSchema=(t,o,i)=>on(e,t,o,i)});function ib(e){return new iS({type:"null",...T(e)})}let ik=d("ZodAny",(e,t)=>{tp.init(e,t),oK.init(e,t),e._zod.processJSONSchema=(t,o,i)=>ol(e,t,o,i)});function iP(){return new ik({type:"any"})}let iw=d("ZodUnknown",(e,t)=>{th.init(e,t),oK.init(e,t),e._zod.processJSONSchema=(t,o,i)=>oc(e,t,o,i)});function iz(){return new iw({type:"unknown"})}let iR=d("ZodNever",(e,t)=>{tm.init(e,t),oK.init(e,t),e._zod.processJSONSchema=(t,o,i)=>os(e,t,o,i)});function iI(e){return new iR({type:"never",...T(e)})}let ij=d("ZodArray",(e,t)=>{tg.init(e,t),oK.init(e,t),e._zod.processJSONSchema=(t,o,i)=>om(e,t,o,i),e.element=t.element,e.min=(t,o)=>e.check(t9(t,o)),e.nonempty=t=>e.check(t9(1,t)),e.max=(t,o)=>e.check(t2(t,o)),e.length=(t,o)=>e.check(t4(t,o)),e.unwrap=()=>e.element});function ix(e,t){return new ij({type:"array",element:e,...T(t)})}let iC=d("ZodObject",(e,t)=>{tb.init(e,t),oK.init(e,t),e._zod.processJSONSchema=(t,o,i)=>of(e,t,o,i),k(e,"shape",()=>t.shape),e.keyof=()=>iH(Object.keys(e._zod.def.shape)),e.catchall=t=>e.clone({...e._zod.def,catchall:t}),e.passthrough=()=>e.clone({...e._zod.def,catchall:iz()}),e.loose=()=>e.clone({...e._zod.def,catchall:iz()}),e.strict=()=>e.clone({...e._zod.def,catchall:iI()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=t=>(function(e,t){if(!x(t))throw Error("Invalid input to extend: expected a plain object");let o=e._zod.def.checks;if(o&&o.length>0)throw Error("Object schemas containing refinements cannot be extended. Use `.safeExtend()` instead.");let i=w(e._zod.def,{get shape(){let o={...e._zod.def.shape,...t};return P(this,"shape",o),o},checks:[]});return O(e,i)})(e,t),e.safeExtend=t=>(function(e,t){if(!x(t))throw Error("Invalid input to safeExtend: expected a plain object");let o={...e._zod.def,get shape(){let o={...e._zod.def.shape,...t};return P(this,"shape",o),o},checks:e._zod.def.checks};return O(e,o)})(e,t),e.merge=t=>{let o;return o=w(e._zod.def,{get shape(){let o={...e._zod.def.shape,...t._zod.def.shape};return P(this,"shape",o),o},get catchall(){return t._zod.def.catchall},checks:[]}),O(e,o)},e.pick=t=>{let o,i;return o=e._zod.def,i=w(e._zod.def,{get shape(){let e={};for(let i in t){if(!(i in o.shape))throw Error(`Unrecognized key: "${i}"`);t[i]&&(e[i]=o.shape[i])}return P(this,"shape",e),e},checks:[]}),O(e,i)},e.omit=t=>{let o,i;return o=e._zod.def,i=w(e._zod.def,{get shape(){let i={...e._zod.def.shape};for(let e in t){if(!(e in o.shape))throw Error(`Unrecognized key: "${e}"`);t[e]&&delete i[e]}return P(this,"shape",i),i},checks:[]}),O(e,i)},e.partial=(...t)=>{var o;let i;return o=t[0],i=w(e._zod.def,{get shape(){let t=e._zod.def.shape,i={...t};if(o)for(let e in o){if(!(e in t))throw Error(`Unrecognized key: "${e}"`);o[e]&&(i[e]=iF?new iF({type:"optional",innerType:t[e]}):t[e])}else for(let e in t)i[e]=iF?new iF({type:"optional",innerType:t[e]}):t[e];return P(this,"shape",i),i},checks:[]}),O(e,i)},e.required=(...t)=>{var o;let i;return o=t[0],i=w(e._zod.def,{get shape(){let t=e._zod.def.shape,i={...t};if(o)for(let e in o){if(!(e in i))throw Error(`Unrecognized key: "${e}"`);o[e]&&(i[e]=new iQ({type:"nonoptional",innerType:t[e]}))}else for(let e in t)i[e]=new iQ({type:"nonoptional",innerType:t[e]});return P(this,"shape",i),i},checks:[]}),O(e,i)}});function iq(e,t){return new iC({type:"object",shape:e??{},...T(t)})}function iY(e,t){return new iC({type:"object",shape:e,catchall:iz(),...T(t)})}let iO=d("ZodUnion",(e,t)=>{tP.init(e,t),oK.init(e,t),e._zod.processJSONSchema=(t,o,i)=>og(e,t,o,i),e.options=t.options});function iT(e,t){return new iO({type:"union",options:e,...T(t)})}let i$=d("ZodDiscriminatedUnion",(e,t)=>{iO.init(e,t),tw.init(e,t)});function iE(e,t,o){return new i$({type:"union",options:t,discriminator:e,...T(o)})}let iM=d("ZodIntersection",(e,t)=>{tz.init(e,t),oK.init(e,t),e._zod.processJSONSchema=(t,o,i)=>ov(e,t,o,i)});function iL(e,t){return new iM({type:"intersection",left:e,right:t})}let iN=d("ZodRecord",(e,t)=>{tI.init(e,t),oK.init(e,t),e._zod.processJSONSchema=(t,o,i)=>o_(e,t,o,i),e.keyType=t.keyType,e.valueType=t.valueType});function iA(e,t,o){return new iN({type:"record",keyType:e,valueType:t,...T(o)})}let iU=d("ZodEnum",(e,t)=>{tj.init(e,t),oK.init(e,t),e._zod.processJSONSchema=(t,o,i)=>ou(e,t,o,i),e.enum=t.entries,e.options=Object.values(t.entries);let o=new Set(Object.keys(t.entries));e.extract=(e,i)=>{let r={};for(let i of e)if(o.has(i))r[i]=t.entries[i];else throw Error(`Key ${i} not found in enum`);return new iU({...t,checks:[],...T(i),entries:r})},e.exclude=(e,i)=>{let r={...t.entries};for(let t of e)if(o.has(t))delete r[t];else throw Error(`Key ${t} not found in enum`);return new iU({...t,checks:[],...T(i),entries:r})}});function iH(e,t){return new iU({type:"enum",entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...T(t)})}let iZ=d("ZodLiteral",(e,t)=>{tx.init(e,t),oK.init(e,t),e._zod.processJSONSchema=(t,o,i)=>od(e,t,o,i),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function iV(e,t){return new iZ({type:"literal",values:Array.isArray(e)?e:[e],...T(t)})}let iJ=d("ZodTransform",(e,t)=>{tC.init(e,t),oK.init(e,t),e._zod.processJSONSchema=(t,o,i)=>oh(e,t,o,i),e._zod.parse=(o,i)=>{if("backward"===i.direction)throw new h(e.constructor.name);o.addIssue=i=>{"string"==typeof i?o.issues.push(H(i,o.value,t)):(i.fatal&&(i.continue=!1),i.code??(i.code="custom"),i.input??(i.input=o.value),i.inst??(i.inst=e),o.issues.push(H(i)))};let r=t.transform(o.value,o);return r instanceof Promise?r.then(e=>(o.value=e,o)):(o.value=r,o)}});function iD(e){return new iJ({type:"transform",transform:e})}let iF=d("ZodOptional",(e,t)=>{tY.init(e,t),oK.init(e,t),e._zod.processJSONSchema=(t,o,i)=>oR(e,t,o,i),e.unwrap=()=>e._zod.def.innerType});function iK(e){return new iF({type:"optional",innerType:e})}let iB=d("ZodNullable",(e,t)=>{tO.init(e,t),oK.init(e,t),e._zod.processJSONSchema=(t,o,i)=>oy(e,t,o,i),e.unwrap=()=>e._zod.def.innerType});function iW(e){return new iB({type:"nullable",innerType:e})}let iG=d("ZodDefault",(e,t)=>{tT.init(e,t),oK.init(e,t),e._zod.processJSONSchema=(t,o,i)=>ob(e,t,o,i),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap}),iX=d("ZodPrefault",(e,t)=>{tE.init(e,t),oK.init(e,t),e._zod.processJSONSchema=(t,o,i)=>ok(e,t,o,i),e.unwrap=()=>e._zod.def.innerType}),iQ=d("ZodNonOptional",(e,t)=>{tM.init(e,t),oK.init(e,t),e._zod.processJSONSchema=(t,o,i)=>oS(e,t,o,i),e.unwrap=()=>e._zod.def.innerType}),i0=d("ZodCatch",(e,t)=>{tN.init(e,t),oK.init(e,t),e._zod.processJSONSchema=(t,o,i)=>oP(e,t,o,i),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap}),i1=d("ZodPipe",(e,t)=>{tA.init(e,t),oK.init(e,t),e._zod.processJSONSchema=(t,o,i)=>ow(e,t,o,i),e.in=t.in,e.out=t.out});function i2(e,t){return new i1({type:"pipe",in:e,out:t})}let i9=d("ZodReadonly",(e,t)=>{tH.init(e,t),oK.init(e,t),e._zod.processJSONSchema=(t,o,i)=>oz(e,t,o,i),e.unwrap=()=>e._zod.def.innerType}),i4=d("ZodLazy",(e,t)=>{tV.init(e,t),oK.init(e,t),e._zod.processJSONSchema=(t,o,i)=>oI(e,t,o,i),e.unwrap=()=>e._zod.def.getter()});function i5(e){return new i4({type:"lazy",getter:e})}let i3=d("ZodCustom",(e,t)=>{tJ.init(e,t),oK.init(e,t),e._zod.processJSONSchema=(t,o,i)=>op(e,t,o,i)});function i6(e,t){return i2(iD(e),t)}let i8={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"};function i7(e){return new id({type:"number",coerce:!0,checks:[],...T(e)})}a||(a={}),f({localeError:(i={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"}},r={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",mac:"MAC address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",jwt:"JWT",template_literal:"input"},e=>{switch(e.code){case"invalid_type":return`Invalid input: expected ${e.expected}, received ${(e=>{let t=typeof e;switch(t){case"number":return Number.isNaN(e)?"NaN":"number";case"object":if(Array.isArray(e))return"array";if(null===e)return"null";if(Object.getPrototypeOf(e)!==Object.prototype&&e.constructor)return e.constructor.name}return t})(e.input)}`;case"invalid_value":if(1===e.values.length)return`Invalid input: expected ${$(e.values[0])}`;return`Invalid option: expected one of ${v(e.values,"|")}`;case"too_big":{let t=e.inclusive?"<=":"<",o=i[e.origin]??null;if(o)return`Too big: expected ${e.origin??"value"} to have ${t}${e.maximum.toString()} ${o.unit??"elements"}`;return`Too big: expected ${e.origin??"value"} to be ${t}${e.maximum.toString()}`}case"too_small":{let t=e.inclusive?">=":">",o=i[e.origin]??null;if(o)return`Too small: expected ${e.origin} to have ${t}${e.minimum.toString()} ${o.unit}`;return`Too small: expected ${e.origin} to be ${t}${e.minimum.toString()}`}case"invalid_format":if("starts_with"===e.format)return`Invalid string: must start with "${e.prefix}"`;if("ends_with"===e.format)return`Invalid string: must end with "${e.suffix}"`;if("includes"===e.format)return`Invalid string: must include "${e.includes}"`;if("regex"===e.format)return`Invalid string: must match pattern ${e.pattern}`;return`Invalid ${r[e.format]??e.format}`;case"not_multiple_of":return`Invalid number: must be a multiple of ${e.divisor}`;case"unrecognized_keys":return`Unrecognized key${e.keys.length>1?"s":""}: ${v(e.keys,", ")}`;case"invalid_key":return`Invalid key in ${e.origin}`;case"invalid_union":default:return"Invalid input";case"invalid_element":return`Invalid value in ${e.origin}`}})})}}]);
|