@reqvire-org/ads 0.3.37 → 0.3.38

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.
Files changed (36) hide show
  1. package/README.md +3 -1
  2. package/dist/bootstrap-ds/README.md +2 -2
  3. package/dist/bootstrap-ds/package.json +1 -1
  4. package/dist/cli.mjs +9 -1
  5. package/dist/config.mjs +4 -2
  6. package/dist/mcp/preview-owner-guard.mjs +7 -4
  7. package/dist/mcp/preview-widget.bundle.js +46 -47
  8. package/dist/mcp/project-widget.bundle.js +45 -46
  9. package/dist/mcp/server.mjs +5 -0
  10. package/dist/mcp/widget.bundle.js +47 -48
  11. package/dist/preview-bun.mjs +5 -2
  12. package/dist/resource-limits.mjs +146 -0
  13. package/dist/runtime-requirements.mjs +21 -0
  14. package/dist/scenarios-compiler.mjs +4 -3
  15. package/dist/showcase/client.bundle.js +56 -57
  16. package/dist/showcase/sandbox.bundle.js +1 -1
  17. package/dist/skills/ads-break-ui/SKILL.md +3 -2
  18. package/dist/skills/ads-break-ui/references/runtimes.md +85 -1
  19. package/dist/skills/ads-designer/SKILL.md +3 -2
  20. package/dist/skills/ads-designer/assets/bootstrap-ds/README.md +2 -2
  21. package/dist/skills/ads-designer/assets/bootstrap-ds/package.json +1 -1
  22. package/dist/skills/ads-designer/references/cli.md +2 -2
  23. package/dist/skills/ads-designer/references/runtimes.md +85 -1
  24. package/dist/skills/ads-import/SKILL.md +3 -2
  25. package/dist/skills/ads-import/references/cli.md +2 -2
  26. package/dist/skills/ads-import/references/runtimes.md +85 -1
  27. package/dist/skills/ads-motion/SKILL.md +3 -2
  28. package/dist/skills/ads-motion/references/runtimes.md +85 -1
  29. package/dist/skills/ads-port/SKILL.md +3 -2
  30. package/dist/skills/ads-port/references/cli.md +2 -2
  31. package/dist/skills/ads-port/references/runtimes.md +85 -1
  32. package/dist/verification/browser.mjs +8 -8
  33. package/docs/CHANGELOG.md +33 -13
  34. package/docs/GUIDE.md +1 -1
  35. package/docs/MCP.md +22 -2
  36. package/package.json +2 -2
@@ -1,78 +1,77 @@
1
- var u3=Object.defineProperty;var c3=(b)=>b;function m3(b,H){this[b]=c3.bind(null,H)}var QH=(b,H)=>{for(var Q in H)u3(b,Q,{get:H[Q],enumerable:!0,configurable:!0,set:m3.bind(H,Q)})};var{create:i3,defineProperty:kW,getOwnPropertyDescriptor:p3,getOwnPropertyNames:d3,getPrototypeOf:o3}=Object,n3=Object.prototype.hasOwnProperty,z9=(b,H)=>()=>(H||b((H={exports:{}}).exports,H),H.exports),I9=(b,H)=>{let Q={};for(var N in b)kW(Q,N,{get:b[N],enumerable:!0});if(H)kW(Q,Symbol.toStringTag,{value:"Module"});return Q},r3=(b,H,Q,N)=>{if(H&&typeof H==="object"||typeof H==="function"){for(var E=d3(H),M=0,_=E.length,Y;M<_;M++)if(Y=E[M],!n3.call(b,Y)&&Y!==Q)kW(b,Y,{get:((D)=>H[D]).bind(null,Y),enumerable:!(N=p3(H,Y))||N.enumerable})}return b},R9=(b,H,Q)=>(Q=b!=null?i3(o3(b)):{},r3(H||!b||!b.__esModule?kW(Q,"default",{value:b,enumerable:!0}):Q,b));var t3=new Set(["https://json-schema.org/draft/2019-09/schema","http://json-schema.org/draft/2019-09/schema"]);function T9(b){return typeof b==="string"&&t3.has(b.replace(/#$/,""))}var W={};QH(W,{xor:()=>r8,xid:()=>U8,void:()=>p8,uuidv7:()=>q8,uuidv6:()=>X8,uuidv4:()=>B8,uuid:()=>J8,util:()=>g,url:()=>qN,uppercase:()=>eQ,unknown:()=>T,union:()=>R,undefined:()=>i8,ulid:()=>V8,uint64:()=>c8,uint32:()=>f8,tuple:()=>FD,trim:()=>MN,treeifyError:()=>D1,transform:()=>Jw,toUpperCase:()=>_N,toLowerCase:()=>WN,toJSONSchema:()=>_Q,templateLiteral:()=>_J,symbol:()=>m8,superRefine:()=>pD,success:()=>NJ,stringbool:()=>KJ,stringFormat:()=>S8,string:()=>w,strictObject:()=>n8,startsWith:()=>HN,slugify:()=>wN,size:()=>EQ,setErrorMap:()=>k7,set:()=>e8,safeParseAsync:()=>s6,safeParse:()=>DM,safeEncodeAsync:()=>ED,safeEncode:()=>QD,safeDecodeAsync:()=>MD,safeDecode:()=>ND,registry:()=>w_,regexes:()=>zb,regex:()=>sQ,refine:()=>iD,record:()=>P,readonly:()=>fD,property:()=>g_,promise:()=>wJ,prettifyError:()=>J1,preprocess:()=>WH,prefault:()=>CD,positive:()=>L_,pipe:()=>m_,partialRecord:()=>t8,parseAsync:()=>t6,parse:()=>r6,overwrite:()=>hb,optional:()=>Z,object:()=>B,number:()=>F,nullish:()=>QJ,nullable:()=>BM,null:()=>db,normalize:()=>EN,nonpositive:()=>C_,nonoptional:()=>SD,nonnegative:()=>S_,never:()=>Dw,negative:()=>$_,nativeEnum:()=>bJ,nanoid:()=>O8,nan:()=>EJ,multipleOf:()=>ZH,minSize:()=>ib,minLength:()=>EH,mime:()=>NN,meta:()=>XJ,maxSize:()=>jH,maxLength:()=>MQ,map:()=>a8,mac:()=>I8,lte:()=>Ib,lt:()=>cb,lowercase:()=>aQ,looseRecord:()=>s8,looseObject:()=>L,locales:()=>WM,literal:()=>G,length:()=>WQ,lazy:()=>gH,ksuid:()=>P8,keyof:()=>o8,jwt:()=>C8,json:()=>GJ,iso:()=>Rb,ipv6:()=>R8,ipv4:()=>z8,invertCodec:()=>WJ,intersection:()=>yb,int64:()=>u8,int32:()=>y8,int:()=>c_,instanceof:()=>qJ,includes:()=>bN,httpUrl:()=>K8,hostname:()=>g8,hex:()=>k8,hash:()=>x8,guid:()=>D8,gte:()=>Kb,gt:()=>mb,globalRegistry:()=>Nb,getErrorMap:()=>x7,function:()=>YJ,fromJSONSchema:()=>AJ,formatError:()=>aE,float64:()=>h8,float32:()=>v8,flattenError:()=>sE,file:()=>HJ,exactOptional:()=>TD,enum:()=>C,endsWith:()=>QN,encodeAsync:()=>bD,encode:()=>a6,emoji:()=>G8,email:()=>d_,e164:()=>$8,discriminatedUnion:()=>SH,describe:()=>BJ,decodeAsync:()=>HD,decode:()=>e6,date:()=>d8,custom:()=>JJ,cuid2:()=>F8,cuid:()=>A8,core:()=>MH,config:()=>s,coerce:()=>UM,codec:()=>MJ,clone:()=>Xb,cidrv6:()=>Z8,cidrv4:()=>T8,check:()=>DJ,catch:()=>xD,boolean:()=>z,bigint:()=>l8,base64url:()=>L8,base64:()=>j8,array:()=>q,any:()=>Yw,_function:()=>YJ,_default:()=>LD,_ZodString:()=>i_,ZodXor:()=>KD,ZodXID:()=>a_,ZodVoid:()=>XD,ZodUnknown:()=>JD,ZodUnion:()=>OM,ZodUndefined:()=>wD,ZodUUID:()=>pb,ZodURL:()=>qM,ZodULID:()=>s_,ZodType:()=>x,ZodTuple:()=>AD,ZodTransform:()=>ID,ZodTemplateLiteral:()=>lD,ZodSymbol:()=>_D,ZodSuccess:()=>gD,ZodStringFormat:()=>c,ZodString:()=>XN,ZodSet:()=>UD,ZodRecord:()=>JN,ZodRealError:()=>Vb,ZodReadonly:()=>yD,ZodPromise:()=>cD,ZodPreprocess:()=>hD,ZodPrefault:()=>$D,ZodPipe:()=>AM,ZodOptional:()=>Bw,ZodObject:()=>GM,ZodNumberFormat:()=>wQ,ZodNumber:()=>GN,ZodNullable:()=>ZD,ZodNull:()=>YD,ZodNonOptional:()=>Xw,ZodNever:()=>BD,ZodNanoID:()=>n_,ZodNaN:()=>vD,ZodMap:()=>VD,ZodMAC:()=>WD,ZodLiteral:()=>PD,ZodLazy:()=>uD,ZodKSUID:()=>e_,ZodJWT:()=>_w,ZodIssueCode:()=>oD,ZodIntersection:()=>OD,ZodISOTime:()=>l_,ZodISODuration:()=>u_,ZodISODateTime:()=>y_,ZodISODate:()=>f_,ZodIPv6:()=>Hw,ZodIPv4:()=>bw,ZodGUID:()=>JM,ZodFunction:()=>mD,ZodFirstPartyTypeKind:()=>dD,ZodFile:()=>zD,ZodExactOptional:()=>RD,ZodError:()=>S7,ZodEnum:()=>BN,ZodEmoji:()=>o_,ZodEmail:()=>p_,ZodE164:()=>Ww,ZodDiscriminatedUnion:()=>GD,ZodDefault:()=>jD,ZodDate:()=>KM,ZodCustomStringFormat:()=>KN,ZodCustom:()=>VM,ZodCodec:()=>FM,ZodCatch:()=>kD,ZodCUID2:()=>t_,ZodCUID:()=>r_,ZodCIDRv6:()=>Nw,ZodCIDRv4:()=>Qw,ZodBoolean:()=>ON,ZodBigIntFormat:()=>ww,ZodBigInt:()=>AN,ZodBase64URL:()=>Mw,ZodBase64:()=>Ew,ZodArray:()=>qD,ZodAny:()=>DD,TimePrecision:()=>I4,NEVER:()=>mE,$output:()=>A4,$input:()=>F4,$brand:()=>aw});var MH={};QH(MH,{version:()=>_Y,util:()=>g,treeifyError:()=>D1,toJSONSchema:()=>_Q,toDotPath:()=>g9,safeParseAsync:()=>X1,safeParse:()=>B1,safeEncodeAsync:()=>LB,safeEncode:()=>ZB,safeDecodeAsync:()=>$B,safeDecode:()=>jB,registry:()=>w_,regexes:()=>zb,process:()=>f,prettifyError:()=>J1,parseAsync:()=>lW,parse:()=>fW,meta:()=>E6,locales:()=>WM,isValidJWT:()=>H8,isValidBase64URL:()=>b8,isValidBase64:()=>LY,initializeContext:()=>LH,globalRegistry:()=>Nb,globalConfig:()=>eH,formatError:()=>aE,flattenError:()=>sE,finalize:()=>CH,extractDefs:()=>$H,encodeAsync:()=>RB,encode:()=>zB,describe:()=>N6,decodeAsync:()=>TB,decode:()=>IB,createToJSONSchemaMethod:()=>W6,createStandardJSONSchemaMethod:()=>DN,config:()=>s,clone:()=>Xb,_xor:()=>w7,_xid:()=>F_,_void:()=>n4,_uuidv7:()=>X_,_uuidv6:()=>B_,_uuidv4:()=>J_,_uuid:()=>D_,_url:()=>wM,_uppercase:()=>eQ,_unknown:()=>d4,_union:()=>_7,_undefined:()=>m4,_ulid:()=>A_,_uint64:()=>u4,_uint32:()=>x4,_tuple:()=>J7,_trim:()=>MN,_transform:()=>A7,_toUpperCase:()=>_N,_toLowerCase:()=>WN,_templateLiteral:()=>Z7,_symbol:()=>c4,_superRefine:()=>Q6,_success:()=>z7,_stringbool:()=>M6,_stringFormat:()=>YN,_string:()=>U4,_startsWith:()=>HN,_slugify:()=>wN,_size:()=>EQ,_set:()=>q7,_safeParseAsync:()=>rQ,_safeParse:()=>nQ,_safeEncodeAsync:()=>oW,_safeEncode:()=>pW,_safeDecodeAsync:()=>nW,_safeDecode:()=>dW,_regex:()=>sQ,_refine:()=>H6,_record:()=>B7,_readonly:()=>T7,_property:()=>g_,_promise:()=>L7,_positive:()=>L_,_pipe:()=>R7,_parseAsync:()=>oQ,_parse:()=>dQ,_overwrite:()=>hb,_optional:()=>F7,_number:()=>L4,_nullable:()=>V7,_null:()=>i4,_normalize:()=>EN,_nonpositive:()=>C_,_nonoptional:()=>P7,_nonnegative:()=>S_,_never:()=>o4,_negative:()=>$_,_nativeEnum:()=>G7,_nanoid:()=>K_,_nan:()=>s4,_multipleOf:()=>ZH,_minSize:()=>ib,_minLength:()=>EH,_min:()=>Kb,_mime:()=>NN,_maxSize:()=>jH,_maxLength:()=>MQ,_max:()=>Ib,_map:()=>X7,_mac:()=>z4,_lte:()=>Ib,_lt:()=>cb,_lowercase:()=>aQ,_literal:()=>O7,_length:()=>WQ,_lazy:()=>j7,_ksuid:()=>V_,_jwt:()=>j_,_isoTime:()=>Z4,_isoDuration:()=>j4,_isoDateTime:()=>R4,_isoDate:()=>T4,_ipv6:()=>P_,_ipv4:()=>U_,_intersection:()=>D7,_int64:()=>l4,_int32:()=>k4,_int:()=>C4,_includes:()=>bN,_guid:()=>_M,_gte:()=>Kb,_gt:()=>mb,_float64:()=>g4,_float32:()=>S4,_file:()=>e4,_enum:()=>K7,_endsWith:()=>QN,_encodeAsync:()=>mW,_encode:()=>uW,_emoji:()=>q_,_email:()=>Y_,_e164:()=>Z_,_discriminatedUnion:()=>Y7,_default:()=>U7,_decodeAsync:()=>iW,_decode:()=>cW,_date:()=>r4,_custom:()=>b6,_cuid2:()=>O_,_cuid:()=>G_,_coercedString:()=>P4,_coercedNumber:()=>$4,_coercedDate:()=>t4,_coercedBoolean:()=>h4,_coercedBigint:()=>f4,_cidrv6:()=>I_,_cidrv4:()=>z_,_check:()=>W8,_catch:()=>I7,_boolean:()=>v4,_bigint:()=>y4,_base64url:()=>T_,_base64:()=>R_,_array:()=>a4,_any:()=>p4,TimePrecision:()=>I4,NEVER:()=>mE,JSONSchemaGenerator:()=>i6,JSONSchema:()=>_8,Doc:()=>aW,$output:()=>A4,$input:()=>F4,$constructor:()=>X,$brand:()=>aw,$ZodXor:()=>oY,$ZodXID:()=>AY,$ZodVoid:()=>mY,$ZodUnknown:()=>uY,$ZodUnion:()=>NM,$ZodUndefined:()=>yY,$ZodUUID:()=>DY,$ZodURL:()=>BY,$ZodULID:()=>OY,$ZodType:()=>k,$ZodTuple:()=>M_,$ZodTransform:()=>Q4,$ZodTemplateLiteral:()=>X4,$ZodSymbol:()=>hY,$ZodSuccess:()=>w4,$ZodStringFormat:()=>u,$ZodString:()=>NQ,$ZodSet:()=>aY,$ZodRegistry:()=>V4,$ZodRecord:()=>tY,$ZodRealError:()=>Fb,$ZodReadonly:()=>B4,$ZodPromise:()=>K4,$ZodPreprocess:()=>J4,$ZodPrefault:()=>W4,$ZodPipe:()=>__,$ZodOptional:()=>W_,$ZodObjectJIT:()=>dY,$ZodObject:()=>E8,$ZodNumberFormat:()=>xY,$ZodNumber:()=>N_,$ZodNullable:()=>E4,$ZodNull:()=>fY,$ZodNonOptional:()=>_4,$ZodNever:()=>cY,$ZodNanoID:()=>qY,$ZodNaN:()=>D4,$ZodMap:()=>sY,$ZodMAC:()=>TY,$ZodLiteral:()=>b4,$ZodLazy:()=>G4,$ZodKSUID:()=>FY,$ZodJWT:()=>gY,$ZodIntersection:()=>rY,$ZodISOTime:()=>PY,$ZodISODuration:()=>zY,$ZodISODateTime:()=>VY,$ZodISODate:()=>UY,$ZodIPv6:()=>RY,$ZodIPv4:()=>IY,$ZodGUID:()=>YY,$ZodFunction:()=>q4,$ZodFile:()=>H4,$ZodExactOptional:()=>N4,$ZodError:()=>tE,$ZodEnum:()=>eY,$ZodEncodeError:()=>bQ,$ZodEmoji:()=>XY,$ZodEmail:()=>JY,$ZodE164:()=>SY,$ZodDiscriminatedUnion:()=>nY,$ZodDefault:()=>M4,$ZodDate:()=>iY,$ZodCustomStringFormat:()=>kY,$ZodCustom:()=>O4,$ZodCodec:()=>EM,$ZodCheckUpperCase:()=>bY,$ZodCheckStringFormat:()=>tQ,$ZodCheckStartsWith:()=>QY,$ZodCheckSizeEquals:()=>n1,$ZodCheckRegex:()=>a1,$ZodCheckProperty:()=>EY,$ZodCheckOverwrite:()=>WY,$ZodCheckNumberFormat:()=>i1,$ZodCheckMultipleOf:()=>m1,$ZodCheckMinSize:()=>o1,$ZodCheckMinLength:()=>t1,$ZodCheckMimeType:()=>MY,$ZodCheckMaxSize:()=>d1,$ZodCheckMaxLength:()=>r1,$ZodCheckLowerCase:()=>e1,$ZodCheckLessThan:()=>tW,$ZodCheckLengthEquals:()=>s1,$ZodCheckIncludes:()=>HY,$ZodCheckGreaterThan:()=>sW,$ZodCheckEndsWith:()=>NY,$ZodCheckBigIntFormat:()=>p1,$ZodCheck:()=>i,$ZodCatch:()=>Y4,$ZodCUID2:()=>GY,$ZodCUID:()=>KY,$ZodCIDRv6:()=>jY,$ZodCIDRv4:()=>ZY,$ZodBoolean:()=>QM,$ZodBigIntFormat:()=>vY,$ZodBigInt:()=>E_,$ZodBase64URL:()=>CY,$ZodBase64:()=>$Y,$ZodAsyncError:()=>ub,$ZodArray:()=>pY,$ZodAny:()=>lY});var Z9,mE=Object.freeze({status:"aborted"});function X(b,H,Q){function N(Y,D){if(!Y._zod)Object.defineProperty(Y,"_zod",{value:{def:D,constr:_,traits:new Set},enumerable:!1});if(Y._zod.traits.has(b))return;Y._zod.traits.add(b),H(Y,D);let J=_.prototype,K=Object.keys(J);for(let O=0;O<K.length;O++){let A=K[O];if(!(A in Y))Y[A]=J[A].bind(Y)}}let E=Q?.Parent??Object;class M extends E{}Object.defineProperty(M,"name",{value:b});function _(Y){var D;let J=Q?.Parent?new M:this;N(J,Y),(D=J._zod).deferred??(D.deferred=[]);for(let K of J._zod.deferred)K();return J}return Object.defineProperty(_,"init",{value:N}),Object.defineProperty(_,Symbol.hasInstance,{value:(Y)=>{if(Q?.Parent&&Y instanceof Q.Parent)return!0;return Y?._zod?.traits?.has(b)}}),Object.defineProperty(_,"name",{value:b}),_}var aw=Symbol("zod_brand");class ub extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class bQ extends Error{constructor(b){super(`Encountered unidirectional transform during encode: ${b}`);this.name="ZodEncodeError"}}(Z9=globalThis).__zod_globalConfig??(Z9.__zod_globalConfig={});var eH=globalThis.__zod_globalConfig;function s(b){if(b)Object.assign(eH,b);return eH}var g={};QH(g,{unwrapMessage:()=>iE,uint8ArrayToHex:()=>UB,uint8ArrayToBase64url:()=>FB,uint8ArrayToBase64:()=>$9,stringifyPrimitive:()=>yW,slugify:()=>H1,shallowClone:()=>N1,safeExtend:()=>XB,required:()=>GB,randomString:()=>WB,propertyKeyTypes:()=>oE,promiseAllObject:()=>MB,primitiveTypes:()=>E1,prefixIssues:()=>Ab,pick:()=>DB,partial:()=>KB,parsedType:()=>Y1,optionalKeys:()=>M1,omit:()=>JB,objectClone:()=>QB,numKeys:()=>_B,nullish:()=>zH,normalizeParams:()=>U,mergeDefs:()=>NH,merge:()=>qB,jsonStringifyReplacer:()=>mQ,joinValues:()=>xW,issue:()=>pQ,isPlainObject:()=>RH,isObject:()=>HQ,hexToUint8Array:()=>VB,getSizableOrigin:()=>nE,getParsedType:()=>wB,getLengthableOrigin:()=>rE,getEnumValues:()=>pE,getElementAtPath:()=>EB,floatSafeRemainder:()=>b1,finalizeIssue:()=>qb,extend:()=>BB,explicitlyAborted:()=>w1,escapeRegex:()=>Sb,esc:()=>vW,defineLazy:()=>v,createTransparentProxy:()=>YB,cloneDef:()=>NB,clone:()=>Xb,cleanRegex:()=>dE,cleanEnum:()=>OB,captureStackTrace:()=>hW,cached:()=>iQ,base64urlToUint8Array:()=>AB,base64ToUint8Array:()=>L9,assignProp:()=>IH,assertNotEqual:()=>a3,assertNever:()=>bB,assertIs:()=>e3,assertEqual:()=>s3,assert:()=>HB,allowsEval:()=>Q1,aborted:()=>TH,NUMBER_FORMAT_RANGES:()=>W1,Class:()=>C9,BIGINT_FORMAT_RANGES:()=>_1});function s3(b){return b}function a3(b){return b}function e3(b){}function bB(b){throw Error("Unexpected value in exhaustive check")}function HB(b){}function pE(b){let H=Object.values(b).filter((N)=>typeof N==="number");return Object.entries(b).filter(([N,E])=>H.indexOf(+N)===-1).map(([N,E])=>E)}function xW(b,H="|"){return b.map((Q)=>yW(Q)).join(H)}function mQ(b,H){if(typeof H==="bigint")return H.toString();return H}function iQ(b){return{get value(){{let Q=b();return Object.defineProperty(this,"value",{value:Q}),Q}throw Error("cached value already set")}}}function zH(b){return b===null||b===void 0}function dE(b){let H=b.startsWith("^")?1:0,Q=b.endsWith("$")?b.length-1:b.length;return b.slice(H,Q)}function b1(b,H){let Q=b/H,N=Math.round(Q),E=Number.EPSILON*Math.max(Math.abs(Q),1);if(Math.abs(Q-N)<E)return 0;return Q-N}var j9=Symbol("evaluating");function v(b,H,Q){let N=void 0;Object.defineProperty(b,H,{get(){if(N===j9)return;if(N===void 0)N=j9,N=Q();return N},set(E){Object.defineProperty(b,H,{value:E})},configurable:!0})}function QB(b){return Object.create(Object.getPrototypeOf(b),Object.getOwnPropertyDescriptors(b))}function IH(b,H,Q){Object.defineProperty(b,H,{value:Q,writable:!0,enumerable:!0,configurable:!0})}function NH(...b){let H={};for(let Q of b){let N=Object.getOwnPropertyDescriptors(Q);Object.assign(H,N)}return Object.defineProperties({},H)}function NB(b){return NH(b._zod.def)}function EB(b,H){if(!H)return b;return H.reduce((Q,N)=>Q?.[N],b)}function MB(b){let H=Object.keys(b),Q=H.map((N)=>b[N]);return Promise.all(Q).then((N)=>{let E={};for(let M=0;M<H.length;M++)E[H[M]]=N[M];return E})}function WB(b=10){let Q="";for(let N=0;N<b;N++)Q+="abcdefghijklmnopqrstuvwxyz"[Math.floor(Math.random()*26)];return Q}function vW(b){return JSON.stringify(b)}function H1(b){return b.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var hW="captureStackTrace"in Error?Error.captureStackTrace:(...b)=>{};function HQ(b){return typeof b==="object"&&b!==null&&!Array.isArray(b)}var Q1=iQ(()=>{if(eH.jitless)return!1;if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return new Function(""),!0}catch(b){return!1}});function RH(b){if(HQ(b)===!1)return!1;let H=b.constructor;if(H===void 0)return!0;if(typeof H!=="function")return!0;let Q=H.prototype;if(HQ(Q)===!1)return!1;if(Object.prototype.hasOwnProperty.call(Q,"isPrototypeOf")===!1)return!1;return!0}function N1(b){if(RH(b))return{...b};if(Array.isArray(b))return[...b];if(b instanceof Map)return new Map(b);if(b instanceof Set)return new Set(b);return b}function _B(b){let H=0;for(let Q in b)if(Object.prototype.hasOwnProperty.call(b,Q))H++;return H}var wB=(b)=>{let H=typeof b;switch(H){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN(b)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":if(Array.isArray(b))return"array";if(b===null)return"null";if(b.then&&typeof b.then==="function"&&b.catch&&typeof b.catch==="function")return"promise";if(typeof Map<"u"&&b instanceof Map)return"map";if(typeof Set<"u"&&b instanceof Set)return"set";if(typeof Date<"u"&&b instanceof Date)return"date";if(typeof File<"u"&&b instanceof File)return"file";return"object";default:throw Error(`Unknown data type: ${H}`)}},oE=new Set(["string","number","symbol"]),E1=new Set(["string","number","bigint","boolean","symbol","undefined"]);function Sb(b){return b.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Xb(b,H,Q){let N=new b._zod.constr(H??b._zod.def);if(!H||Q?.parent)N._zod.parent=b;return N}function U(b){let H=b;if(!H)return{};if(typeof H==="string")return{error:()=>H};if(H?.message!==void 0){if(H?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");H.error=H.message}if(delete H.message,typeof H.error==="string")return{...H,error:()=>H.error};return H}function YB(b){let H;return new Proxy({},{get(Q,N,E){return H??(H=b()),Reflect.get(H,N,E)},set(Q,N,E,M){return H??(H=b()),Reflect.set(H,N,E,M)},has(Q,N){return H??(H=b()),Reflect.has(H,N)},deleteProperty(Q,N){return H??(H=b()),Reflect.deleteProperty(H,N)},ownKeys(Q){return H??(H=b()),Reflect.ownKeys(H)},getOwnPropertyDescriptor(Q,N){return H??(H=b()),Reflect.getOwnPropertyDescriptor(H,N)},defineProperty(Q,N,E){return H??(H=b()),Reflect.defineProperty(H,N,E)}})}function yW(b){if(typeof b==="bigint")return b.toString()+"n";if(typeof b==="string")return`"${b}"`;return`${b}`}function M1(b){return Object.keys(b).filter((H)=>{return b[H]._zod.optin==="optional"&&b[H]._zod.optout==="optional"})}var W1={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-340282346638528860000000000000000000000,340282346638528860000000000000000000000],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},_1={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function DB(b,H){let Q=b._zod.def,N=Q.checks;if(N&&N.length>0)throw Error(".pick() cannot be used on object schemas containing refinements");let M=NH(b._zod.def,{get shape(){let _={};for(let Y in H){if(!(Y in Q.shape))throw Error(`Unrecognized key: "${Y}"`);if(!H[Y])continue;_[Y]=Q.shape[Y]}return IH(this,"shape",_),_},checks:[]});return Xb(b,M)}function JB(b,H){let Q=b._zod.def,N=Q.checks;if(N&&N.length>0)throw Error(".omit() cannot be used on object schemas containing refinements");let M=NH(b._zod.def,{get shape(){let _={...b._zod.def.shape};for(let Y in H){if(!(Y in Q.shape))throw Error(`Unrecognized key: "${Y}"`);if(!H[Y])continue;delete _[Y]}return IH(this,"shape",_),_},checks:[]});return Xb(b,M)}function BB(b,H){if(!RH(H))throw Error("Invalid input to extend: expected a plain object");let Q=b._zod.def.checks;if(Q&&Q.length>0){let M=b._zod.def.shape;for(let _ in H)if(Object.getOwnPropertyDescriptor(M,_)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}let E=NH(b._zod.def,{get shape(){let M={...b._zod.def.shape,...H};return IH(this,"shape",M),M}});return Xb(b,E)}function XB(b,H){if(!RH(H))throw Error("Invalid input to safeExtend: expected a plain object");let Q=NH(b._zod.def,{get shape(){let N={...b._zod.def.shape,...H};return IH(this,"shape",N),N}});return Xb(b,Q)}function qB(b,H){if(b._zod.def.checks?.length)throw Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");let Q=NH(b._zod.def,{get shape(){let N={...b._zod.def.shape,...H._zod.def.shape};return IH(this,"shape",N),N},get catchall(){return H._zod.def.catchall},checks:H._zod.def.checks??[]});return Xb(b,Q)}function KB(b,H,Q){let E=H._zod.def.checks;if(E&&E.length>0)throw Error(".partial() cannot be used on object schemas containing refinements");let _=NH(H._zod.def,{get shape(){let Y=H._zod.def.shape,D={...Y};if(Q)for(let J in Q){if(!(J in Y))throw Error(`Unrecognized key: "${J}"`);if(!Q[J])continue;D[J]=b?new b({type:"optional",innerType:Y[J]}):Y[J]}else for(let J in Y)D[J]=b?new b({type:"optional",innerType:Y[J]}):Y[J];return IH(this,"shape",D),D},checks:[]});return Xb(H,_)}function GB(b,H,Q){let N=NH(H._zod.def,{get shape(){let E=H._zod.def.shape,M={...E};if(Q)for(let _ in Q){if(!(_ in M))throw Error(`Unrecognized key: "${_}"`);if(!Q[_])continue;M[_]=new b({type:"nonoptional",innerType:E[_]})}else for(let _ in E)M[_]=new b({type:"nonoptional",innerType:E[_]});return IH(this,"shape",M),M}});return Xb(H,N)}function TH(b,H=0){if(b.aborted===!0)return!0;for(let Q=H;Q<b.issues.length;Q++)if(b.issues[Q]?.continue!==!0)return!0;return!1}function w1(b,H=0){if(b.aborted===!0)return!0;for(let Q=H;Q<b.issues.length;Q++)if(b.issues[Q]?.continue===!1)return!0;return!1}function Ab(b,H){return H.map((Q)=>{var N;return(N=Q).path??(N.path=[]),Q.path.unshift(b),Q})}function iE(b){return typeof b==="string"?b:b?.message}function qb(b,H,Q){let N=b.message?b.message:iE(b.inst?._zod.def?.error?.(b))??iE(H?.error?.(b))??iE(Q.customError?.(b))??iE(Q.localeError?.(b))??"Invalid input",{inst:E,continue:M,input:_,...Y}=b;if(Y.path??(Y.path=[]),Y.message=N,H?.reportInput)Y.input=_;return Y}function nE(b){if(b instanceof Set)return"set";if(b instanceof Map)return"map";if(b instanceof File)return"file";return"unknown"}function rE(b){if(Array.isArray(b))return"array";if(typeof b==="string")return"string";return"unknown"}function Y1(b){let H=typeof b;switch(H){case"number":return Number.isNaN(b)?"nan":"number";case"object":{if(b===null)return"null";if(Array.isArray(b))return"array";let Q=b;if(Q&&Object.getPrototypeOf(Q)!==Object.prototype&&"constructor"in Q&&Q.constructor)return Q.constructor.name}}return H}function pQ(...b){let[H,Q,N]=b;if(typeof H==="string")return{message:H,code:"custom",input:Q,inst:N};return{...H}}function OB(b){return Object.entries(b).filter(([H,Q])=>{return Number.isNaN(Number.parseInt(H,10))}).map((H)=>H[1])}function L9(b){let H=atob(b),Q=new Uint8Array(H.length);for(let N=0;N<H.length;N++)Q[N]=H.charCodeAt(N);return Q}function $9(b){let H="";for(let Q=0;Q<b.length;Q++)H+=String.fromCharCode(b[Q]);return btoa(H)}function AB(b){let H=b.replace(/-/g,"+").replace(/_/g,"/"),Q="=".repeat((4-H.length%4)%4);return L9(H+Q)}function FB(b){return $9(b).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function VB(b){let H=b.replace(/^0x/,"");if(H.length%2!==0)throw Error("Invalid hex string length");let Q=new Uint8Array(H.length/2);for(let N=0;N<H.length;N+=2)Q[N/2]=Number.parseInt(H.slice(N,N+2),16);return Q}function UB(b){return Array.from(b).map((H)=>H.toString(16).padStart(2,"0")).join("")}class C9{constructor(...b){}}var S9=(b,H)=>{b.name="$ZodError",Object.defineProperty(b,"_zod",{value:b._zod,enumerable:!1}),Object.defineProperty(b,"issues",{value:H,enumerable:!1}),b.message=JSON.stringify(H,mQ,2),Object.defineProperty(b,"toString",{value:()=>b.message,enumerable:!1})},tE=X("$ZodError",S9),Fb=X("$ZodError",S9,{Parent:Error});function sE(b,H=(Q)=>Q.message){let Q={},N=[];for(let E of b.issues)if(E.path.length>0)Q[E.path[0]]=Q[E.path[0]]||[],Q[E.path[0]].push(H(E));else N.push(H(E));return{formErrors:N,fieldErrors:Q}}function aE(b,H=(Q)=>Q.message){let Q={_errors:[]},N=(E,M=[])=>{for(let _ of E.issues)if(_.code==="invalid_union"&&_.errors.length)_.errors.map((Y)=>N({issues:Y},[...M,..._.path]));else if(_.code==="invalid_key")N({issues:_.issues},[...M,..._.path]);else if(_.code==="invalid_element")N({issues:_.issues},[...M,..._.path]);else{let Y=[...M,..._.path];if(Y.length===0)Q._errors.push(H(_));else{let D=Q,J=0;while(J<Y.length){let K=Y[J];if(J!==Y.length-1)D[K]=D[K]||{_errors:[]};else D[K]=D[K]||{_errors:[]},D[K]._errors.push(H(_));D=D[K],J++}}}};return N(b),Q}function D1(b,H=(Q)=>Q.message){let Q={errors:[]},N=(E,M=[])=>{var _,Y;for(let D of E.issues)if(D.code==="invalid_union"&&D.errors.length)D.errors.map((J)=>N({issues:J},[...M,...D.path]));else if(D.code==="invalid_key")N({issues:D.issues},[...M,...D.path]);else if(D.code==="invalid_element")N({issues:D.issues},[...M,...D.path]);else{let J=[...M,...D.path];if(J.length===0){Q.errors.push(H(D));continue}let K=Q,O=0;while(O<J.length){let A=J[O],V=O===J.length-1;if(typeof A==="string")K.properties??(K.properties={}),(_=K.properties)[A]??(_[A]={errors:[]}),K=K.properties[A];else K.items??(K.items=[]),(Y=K.items)[A]??(Y[A]={errors:[]}),K=K.items[A];if(V)K.errors.push(H(D));O++}}};return N(b),Q}function g9(b){let H=[],Q=b.map((N)=>typeof N==="object"?N.key:N);for(let N of Q)if(typeof N==="number")H.push(`[${N}]`);else if(typeof N==="symbol")H.push(`[${JSON.stringify(String(N))}]`);else if(/[^\w$]/.test(N))H.push(`[${JSON.stringify(N)}]`);else{if(H.length)H.push(".");H.push(N)}return H.join("")}function J1(b){let H=[],Q=[...b.issues].sort((N,E)=>(N.path??[]).length-(E.path??[]).length);for(let N of Q)if(H.push(`✖ ${N.message}`),N.path?.length)H.push(` → at ${g9(N.path)}`);return H.join(`
2
- `)}var dQ=(b)=>(H,Q,N,E)=>{let M=N?{...N,async:!1}:{async:!1},_=H._zod.run({value:Q,issues:[]},M);if(_ instanceof Promise)throw new ub;if(_.issues.length){let Y=new(E?.Err??b)(_.issues.map((D)=>qb(D,M,s())));throw hW(Y,E?.callee),Y}return _.value},fW=dQ(Fb),oQ=(b)=>async(H,Q,N,E)=>{let M=N?{...N,async:!0}:{async:!0},_=H._zod.run({value:Q,issues:[]},M);if(_ instanceof Promise)_=await _;if(_.issues.length){let Y=new(E?.Err??b)(_.issues.map((D)=>qb(D,M,s())));throw hW(Y,E?.callee),Y}return _.value},lW=oQ(Fb),nQ=(b)=>(H,Q,N)=>{let E=N?{...N,async:!1}:{async:!1},M=H._zod.run({value:Q,issues:[]},E);if(M instanceof Promise)throw new ub;return M.issues.length?{success:!1,error:new(b??tE)(M.issues.map((_)=>qb(_,E,s())))}:{success:!0,data:M.value}},B1=nQ(Fb),rQ=(b)=>async(H,Q,N)=>{let E=N?{...N,async:!0}:{async:!0},M=H._zod.run({value:Q,issues:[]},E);if(M instanceof Promise)M=await M;return M.issues.length?{success:!1,error:new b(M.issues.map((_)=>qb(_,E,s())))}:{success:!0,data:M.value}},X1=rQ(Fb),uW=(b)=>(H,Q,N)=>{let E=N?{...N,direction:"backward"}:{direction:"backward"};return dQ(b)(H,Q,E)},zB=uW(Fb),cW=(b)=>(H,Q,N)=>{return dQ(b)(H,Q,N)},IB=cW(Fb),mW=(b)=>async(H,Q,N)=>{let E=N?{...N,direction:"backward"}:{direction:"backward"};return oQ(b)(H,Q,E)},RB=mW(Fb),iW=(b)=>async(H,Q,N)=>{return oQ(b)(H,Q,N)},TB=iW(Fb),pW=(b)=>(H,Q,N)=>{let E=N?{...N,direction:"backward"}:{direction:"backward"};return nQ(b)(H,Q,E)},ZB=pW(Fb),dW=(b)=>(H,Q,N)=>{return nQ(b)(H,Q,N)},jB=dW(Fb),oW=(b)=>async(H,Q,N)=>{let E=N?{...N,direction:"backward"}:{direction:"backward"};return rQ(b)(H,Q,E)},LB=oW(Fb),nW=(b)=>async(H,Q,N)=>{return rQ(b)(H,Q,N)},$B=nW(Fb);var zb={};QH(zb,{xid:()=>O1,uuid7:()=>kB,uuid6:()=>gB,uuid4:()=>SB,uuid:()=>QQ,uppercase:()=>c1,unicodeEmail:()=>k9,undefined:()=>l1,ulid:()=>G1,time:()=>g1,string:()=>x1,sha512_hex:()=>H7,sha512_base64url:()=>N7,sha512_base64:()=>Q7,sha384_hex:()=>aB,sha384_base64url:()=>b7,sha384_base64:()=>eB,sha256_hex:()=>rB,sha256_base64url:()=>sB,sha256_base64:()=>tB,sha1_hex:()=>dB,sha1_base64url:()=>nB,sha1_base64:()=>oB,rfc5322Email:()=>vB,number:()=>eE,null:()=>f1,nanoid:()=>F1,md5_hex:()=>mB,md5_base64url:()=>pB,md5_base64:()=>iB,mac:()=>T1,lowercase:()=>u1,ksuid:()=>A1,ipv6:()=>R1,ipv4:()=>I1,integer:()=>h1,idnEmail:()=>hB,httpProtocol:()=>$1,html5Email:()=>xB,hostname:()=>lB,hex:()=>cB,guid:()=>U1,extendedDuration:()=>CB,emoji:()=>z1,email:()=>P1,e164:()=>C1,duration:()=>V1,domain:()=>uB,datetime:()=>k1,date:()=>S1,cuid2:()=>K1,cuid:()=>q1,cidrv6:()=>j1,cidrv4:()=>Z1,browserEmail:()=>yB,boolean:()=>y1,bigint:()=>v1,base64url:()=>rW,base64:()=>L1});var q1=/^[cC][0-9a-z]{6,}$/,K1=/^[0-9a-z]+$/,G1=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,O1=/^[0-9a-vA-V]{20}$/,A1=/^[A-Za-z0-9]{27}$/,F1=/^[a-zA-Z0-9_-]{21}$/,V1=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,CB=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,U1=/^([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})$/,QQ=(b)=>{if(!b)return/^([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)$/;return new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${b}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`)},SB=QQ(4),gB=QQ(6),kB=QQ(7),P1=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,xB=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,vB=/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,k9=/^[^\s@"]{1,64}@[^\s@]{1,255}$/u,hB=k9,yB=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,fB="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function z1(){return new RegExp(fB,"u")}var I1=/^(?:(?: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])$/,R1=/^(([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}|:))$/,T1=(b)=>{let H=Sb(b??":");return new RegExp(`^(?:[0-9A-F]{2}${H}){5}[0-9A-F]{2}$|^(?:[0-9a-f]{2}${H}){5}[0-9a-f]{2}$`)},Z1=/^((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])$/,j1=/^(([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])$/,L1=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,rW=/^[A-Za-z0-9_-]*$/,lB=/^(?=.{1,253}\.?$)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[-0-9a-zA-Z]{0,61}[0-9a-zA-Z])?)*\.?$/,uB=/^([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}$/,$1=/^https?$/,C1=/^\+[1-9]\d{6,14}$/,x9="(?:(?:\\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])))",S1=new RegExp(`^${x9}$`);function v9(b){return typeof b.precision==="number"?b.precision===-1?"(?:[01]\\d|2[0-3]):[0-5]\\d":b.precision===0?"(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d":`(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d\\.\\d{${b.precision}}`:"(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?"}function g1(b){return new RegExp(`^${v9(b)}$`)}function k1(b){let H=v9({precision:b.precision}),Q=["Z"];if(b.local)Q.push("");if(b.offset)Q.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let N=`${H}(?:${Q.join("|")})`;return new RegExp(`^${x9}T(?:${N})$`)}var x1=(b)=>{let H=b?`[\\s\\S]{${b?.minimum??0},${b?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${H}$`)},v1=/^-?\d+n?$/,h1=/^-?\d+$/,eE=/^-?\d+(?:\.\d+)?$/,y1=/^(?:true|false)$/i,f1=/^null$/i;var l1=/^undefined$/i;var u1=/^[^A-Z]*$/,c1=/^[^a-z]*$/,cB=/^[0-9a-fA-F]*$/;function bM(b,H){return new RegExp(`^[A-Za-z0-9+/]{${b}}${H}$`)}function HM(b){return new RegExp(`^[A-Za-z0-9_-]{${b}}$`)}var mB=/^[0-9a-fA-F]{32}$/,iB=bM(22,"=="),pB=HM(22),dB=/^[0-9a-fA-F]{40}$/,oB=bM(27,"="),nB=HM(27),rB=/^[0-9a-fA-F]{64}$/,tB=bM(43,"="),sB=HM(43),aB=/^[0-9a-fA-F]{96}$/,eB=bM(64,""),b7=HM(64),H7=/^[0-9a-fA-F]{128}$/,Q7=bM(86,"=="),N7=HM(86);var i=X("$ZodCheck",(b,H)=>{var Q;b._zod??(b._zod={}),b._zod.def=H,(Q=b._zod).onattach??(Q.onattach=[])}),y9={number:"number",bigint:"bigint",object:"date"},tW=X("$ZodCheckLessThan",(b,H)=>{i.init(b,H);let Q=y9[typeof H.value];b._zod.onattach.push((N)=>{let E=N._zod.bag,M=(H.inclusive?E.maximum:E.exclusiveMaximum)??Number.POSITIVE_INFINITY;if(H.value<M)if(H.inclusive)E.maximum=H.value;else E.exclusiveMaximum=H.value}),b._zod.check=(N)=>{if(H.inclusive?N.value<=H.value:N.value<H.value)return;N.issues.push({origin:Q,code:"too_big",maximum:typeof H.value==="object"?H.value.getTime():H.value,input:N.value,inclusive:H.inclusive,inst:b,continue:!H.abort})}}),sW=X("$ZodCheckGreaterThan",(b,H)=>{i.init(b,H);let Q=y9[typeof H.value];b._zod.onattach.push((N)=>{let E=N._zod.bag,M=(H.inclusive?E.minimum:E.exclusiveMinimum)??Number.NEGATIVE_INFINITY;if(H.value>M)if(H.inclusive)E.minimum=H.value;else E.exclusiveMinimum=H.value}),b._zod.check=(N)=>{if(H.inclusive?N.value>=H.value:N.value>H.value)return;N.issues.push({origin:Q,code:"too_small",minimum:typeof H.value==="object"?H.value.getTime():H.value,input:N.value,inclusive:H.inclusive,inst:b,continue:!H.abort})}}),m1=X("$ZodCheckMultipleOf",(b,H)=>{i.init(b,H),b._zod.onattach.push((Q)=>{var N;(N=Q._zod.bag).multipleOf??(N.multipleOf=H.value)}),b._zod.check=(Q)=>{if(typeof Q.value!==typeof H.value)throw Error("Cannot mix number and bigint in multiple_of check.");if(typeof Q.value==="bigint"?Q.value%H.value===BigInt(0):b1(Q.value,H.value)===0)return;Q.issues.push({origin:typeof Q.value,code:"not_multiple_of",divisor:H.value,input:Q.value,inst:b,continue:!H.abort})}}),i1=X("$ZodCheckNumberFormat",(b,H)=>{i.init(b,H),H.format=H.format||"float64";let Q=H.format?.includes("int"),N=Q?"int":"number",[E,M]=W1[H.format];b._zod.onattach.push((_)=>{let Y=_._zod.bag;if(Y.format=H.format,Y.minimum=E,Y.maximum=M,Q)Y.pattern=h1}),b._zod.check=(_)=>{let Y=_.value;if(Q){if(!Number.isInteger(Y)){_.issues.push({expected:N,format:H.format,code:"invalid_type",continue:!1,input:Y,inst:b});return}if(!Number.isSafeInteger(Y)){if(Y>0)_.issues.push({input:Y,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:b,origin:N,inclusive:!0,continue:!H.abort});else _.issues.push({input:Y,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:b,origin:N,inclusive:!0,continue:!H.abort});return}}if(Y<E)_.issues.push({origin:"number",input:Y,code:"too_small",minimum:E,inclusive:!0,inst:b,continue:!H.abort});if(Y>M)_.issues.push({origin:"number",input:Y,code:"too_big",maximum:M,inclusive:!0,inst:b,continue:!H.abort})}}),p1=X("$ZodCheckBigIntFormat",(b,H)=>{i.init(b,H);let[Q,N]=_1[H.format];b._zod.onattach.push((E)=>{let M=E._zod.bag;M.format=H.format,M.minimum=Q,M.maximum=N}),b._zod.check=(E)=>{let M=E.value;if(M<Q)E.issues.push({origin:"bigint",input:M,code:"too_small",minimum:Q,inclusive:!0,inst:b,continue:!H.abort});if(M>N)E.issues.push({origin:"bigint",input:M,code:"too_big",maximum:N,inclusive:!0,inst:b,continue:!H.abort})}}),d1=X("$ZodCheckMaxSize",(b,H)=>{var Q;i.init(b,H),(Q=b._zod.def).when??(Q.when=(N)=>{let E=N.value;return!zH(E)&&E.size!==void 0}),b._zod.onattach.push((N)=>{let E=N._zod.bag.maximum??Number.POSITIVE_INFINITY;if(H.maximum<E)N._zod.bag.maximum=H.maximum}),b._zod.check=(N)=>{let E=N.value;if(E.size<=H.maximum)return;N.issues.push({origin:nE(E),code:"too_big",maximum:H.maximum,inclusive:!0,input:E,inst:b,continue:!H.abort})}}),o1=X("$ZodCheckMinSize",(b,H)=>{var Q;i.init(b,H),(Q=b._zod.def).when??(Q.when=(N)=>{let E=N.value;return!zH(E)&&E.size!==void 0}),b._zod.onattach.push((N)=>{let E=N._zod.bag.minimum??Number.NEGATIVE_INFINITY;if(H.minimum>E)N._zod.bag.minimum=H.minimum}),b._zod.check=(N)=>{let E=N.value;if(E.size>=H.minimum)return;N.issues.push({origin:nE(E),code:"too_small",minimum:H.minimum,inclusive:!0,input:E,inst:b,continue:!H.abort})}}),n1=X("$ZodCheckSizeEquals",(b,H)=>{var Q;i.init(b,H),(Q=b._zod.def).when??(Q.when=(N)=>{let E=N.value;return!zH(E)&&E.size!==void 0}),b._zod.onattach.push((N)=>{let E=N._zod.bag;E.minimum=H.size,E.maximum=H.size,E.size=H.size}),b._zod.check=(N)=>{let E=N.value,M=E.size;if(M===H.size)return;let _=M>H.size;N.issues.push({origin:nE(E),..._?{code:"too_big",maximum:H.size}:{code:"too_small",minimum:H.size},inclusive:!0,exact:!0,input:N.value,inst:b,continue:!H.abort})}}),r1=X("$ZodCheckMaxLength",(b,H)=>{var Q;i.init(b,H),(Q=b._zod.def).when??(Q.when=(N)=>{let E=N.value;return!zH(E)&&E.length!==void 0}),b._zod.onattach.push((N)=>{let E=N._zod.bag.maximum??Number.POSITIVE_INFINITY;if(H.maximum<E)N._zod.bag.maximum=H.maximum}),b._zod.check=(N)=>{let E=N.value;if(E.length<=H.maximum)return;let _=rE(E);N.issues.push({origin:_,code:"too_big",maximum:H.maximum,inclusive:!0,input:E,inst:b,continue:!H.abort})}}),t1=X("$ZodCheckMinLength",(b,H)=>{var Q;i.init(b,H),(Q=b._zod.def).when??(Q.when=(N)=>{let E=N.value;return!zH(E)&&E.length!==void 0}),b._zod.onattach.push((N)=>{let E=N._zod.bag.minimum??Number.NEGATIVE_INFINITY;if(H.minimum>E)N._zod.bag.minimum=H.minimum}),b._zod.check=(N)=>{let E=N.value;if(E.length>=H.minimum)return;let _=rE(E);N.issues.push({origin:_,code:"too_small",minimum:H.minimum,inclusive:!0,input:E,inst:b,continue:!H.abort})}}),s1=X("$ZodCheckLengthEquals",(b,H)=>{var Q;i.init(b,H),(Q=b._zod.def).when??(Q.when=(N)=>{let E=N.value;return!zH(E)&&E.length!==void 0}),b._zod.onattach.push((N)=>{let E=N._zod.bag;E.minimum=H.length,E.maximum=H.length,E.length=H.length}),b._zod.check=(N)=>{let E=N.value,M=E.length;if(M===H.length)return;let _=rE(E),Y=M>H.length;N.issues.push({origin:_,...Y?{code:"too_big",maximum:H.length}:{code:"too_small",minimum:H.length},inclusive:!0,exact:!0,input:N.value,inst:b,continue:!H.abort})}}),tQ=X("$ZodCheckStringFormat",(b,H)=>{var Q,N;if(i.init(b,H),b._zod.onattach.push((E)=>{let M=E._zod.bag;if(M.format=H.format,H.pattern)M.patterns??(M.patterns=new Set),M.patterns.add(H.pattern)}),H.pattern)(Q=b._zod).check??(Q.check=(E)=>{if(H.pattern.lastIndex=0,H.pattern.test(E.value))return;E.issues.push({origin:"string",code:"invalid_format",format:H.format,input:E.value,...H.pattern?{pattern:H.pattern.toString()}:{},inst:b,continue:!H.abort})});else(N=b._zod).check??(N.check=()=>{})}),a1=X("$ZodCheckRegex",(b,H)=>{tQ.init(b,H),b._zod.check=(Q)=>{if(H.pattern.lastIndex=0,H.pattern.test(Q.value))return;Q.issues.push({origin:"string",code:"invalid_format",format:"regex",input:Q.value,pattern:H.pattern.toString(),inst:b,continue:!H.abort})}}),e1=X("$ZodCheckLowerCase",(b,H)=>{H.pattern??(H.pattern=u1),tQ.init(b,H)}),bY=X("$ZodCheckUpperCase",(b,H)=>{H.pattern??(H.pattern=c1),tQ.init(b,H)}),HY=X("$ZodCheckIncludes",(b,H)=>{i.init(b,H);let Q=Sb(H.includes),N=new RegExp(typeof H.position==="number"?`^.{${H.position}}${Q}`:Q);H.pattern=N,b._zod.onattach.push((E)=>{let M=E._zod.bag;M.patterns??(M.patterns=new Set),M.patterns.add(N)}),b._zod.check=(E)=>{if(E.value.includes(H.includes,H.position))return;E.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:H.includes,input:E.value,inst:b,continue:!H.abort})}}),QY=X("$ZodCheckStartsWith",(b,H)=>{i.init(b,H);let Q=new RegExp(`^${Sb(H.prefix)}.*`);H.pattern??(H.pattern=Q),b._zod.onattach.push((N)=>{let E=N._zod.bag;E.patterns??(E.patterns=new Set),E.patterns.add(Q)}),b._zod.check=(N)=>{if(N.value.startsWith(H.prefix))return;N.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:H.prefix,input:N.value,inst:b,continue:!H.abort})}}),NY=X("$ZodCheckEndsWith",(b,H)=>{i.init(b,H);let Q=new RegExp(`.*${Sb(H.suffix)}$`);H.pattern??(H.pattern=Q),b._zod.onattach.push((N)=>{let E=N._zod.bag;E.patterns??(E.patterns=new Set),E.patterns.add(Q)}),b._zod.check=(N)=>{if(N.value.endsWith(H.suffix))return;N.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:H.suffix,input:N.value,inst:b,continue:!H.abort})}});function h9(b,H,Q){if(b.issues.length)H.issues.push(...Ab(Q,b.issues))}var EY=X("$ZodCheckProperty",(b,H)=>{i.init(b,H),b._zod.check=(Q)=>{let N=H.schema._zod.run({value:Q.value[H.property],issues:[]},{});if(N instanceof Promise)return N.then((E)=>h9(E,Q,H.property));h9(N,Q,H.property);return}}),MY=X("$ZodCheckMimeType",(b,H)=>{i.init(b,H);let Q=new Set(H.mime);b._zod.onattach.push((N)=>{N._zod.bag.mime=H.mime}),b._zod.check=(N)=>{if(Q.has(N.value.type))return;N.issues.push({code:"invalid_value",values:H.mime,input:N.value.type,inst:b,continue:!H.abort})}}),WY=X("$ZodCheckOverwrite",(b,H)=>{i.init(b,H),b._zod.check=(Q)=>{Q.value=H.tx(Q.value)}});class aW{constructor(b=[]){if(this.content=[],this.indent=0,this)this.args=b}indented(b){this.indent+=1,b(this),this.indent-=1}write(b){if(typeof b==="function"){b(this,{execution:"sync"}),b(this,{execution:"async"});return}let Q=b.split(`
3
- `).filter((M)=>M),N=Math.min(...Q.map((M)=>M.length-M.trimStart().length)),E=Q.map((M)=>M.slice(N)).map((M)=>" ".repeat(this.indent*2)+M);for(let M of E)this.content.push(M)}compile(){let b=Function,H=this?.args,N=[...(this?.content??[""]).map((E)=>` ${E}`)];return new b(...H,N.join(`
4
- `))}}var _Y={major:4,minor:4,patch:3};var k=X("$ZodType",(b,H)=>{var Q;b??(b={}),b._zod.def=H,b._zod.bag=b._zod.bag||{},b._zod.version=_Y;let N=[...b._zod.def.checks??[]];if(b._zod.traits.has("$ZodCheck"))N.unshift(b);for(let E of N)for(let M of E._zod.onattach)M(b);if(N.length===0)(Q=b._zod).deferred??(Q.deferred=[]),b._zod.deferred?.push(()=>{b._zod.run=b._zod.parse});else{let E=(_,Y,D)=>{let J=TH(_),K;for(let O of Y){if(O._zod.def.when){if(w1(_))continue;if(!O._zod.def.when(_))continue}else if(J)continue;let A=_.issues.length,V=O._zod.check(_);if(V instanceof Promise&&D?.async===!1)throw new ub;if(K||V instanceof Promise)K=(K??Promise.resolve()).then(async()=>{if(await V,_.issues.length===A)return;if(!J)J=TH(_,A)});else{if(_.issues.length===A)continue;if(!J)J=TH(_,A)}}if(K)return K.then(()=>{return _});return _},M=(_,Y,D)=>{if(TH(_))return _.aborted=!0,_;let J=E(Y,N,D);if(J instanceof Promise){if(D.async===!1)throw new ub;return J.then((K)=>b._zod.parse(K,D))}return b._zod.parse(J,D)};b._zod.run=(_,Y)=>{if(Y.skipChecks)return b._zod.parse(_,Y);if(Y.direction==="backward"){let J=b._zod.parse({value:_.value,issues:[]},{...Y,skipChecks:!0});if(J instanceof Promise)return J.then((K)=>{return M(K,_,Y)});return M(J,_,Y)}let D=b._zod.parse(_,Y);if(D instanceof Promise){if(Y.async===!1)throw new ub;return D.then((J)=>E(J,N,Y))}return E(D,N,Y)}}v(b,"~standard",()=>({validate:(E)=>{try{let M=B1(b,E);return M.success?{value:M.data}:{issues:M.error?.issues}}catch(M){return X1(b,E).then((_)=>_.success?{value:_.data}:{issues:_.error?.issues})}},vendor:"zod",version:1}))}),NQ=X("$ZodString",(b,H)=>{k.init(b,H),b._zod.pattern=[...b?._zod.bag?.patterns??[]].pop()??x1(b._zod.bag),b._zod.parse=(Q,N)=>{if(H.coerce)try{Q.value=String(Q.value)}catch(E){}if(typeof Q.value==="string")return Q;return Q.issues.push({expected:"string",code:"invalid_type",input:Q.value,inst:b}),Q}}),u=X("$ZodStringFormat",(b,H)=>{tQ.init(b,H),NQ.init(b,H)}),YY=X("$ZodGUID",(b,H)=>{H.pattern??(H.pattern=U1),u.init(b,H)}),DY=X("$ZodUUID",(b,H)=>{if(H.version){let N={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[H.version];if(N===void 0)throw Error(`Invalid UUID version: "${H.version}"`);H.pattern??(H.pattern=QQ(N))}else H.pattern??(H.pattern=QQ());u.init(b,H)}),JY=X("$ZodEmail",(b,H)=>{H.pattern??(H.pattern=P1),u.init(b,H)}),BY=X("$ZodURL",(b,H)=>{u.init(b,H),b._zod.check=(Q)=>{try{let N=Q.value.trim();if(!H.normalize&&H.protocol?.source===$1.source){if(!/^https?:\/\//i.test(N)){Q.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:Q.value,inst:b,continue:!H.abort});return}}let E=new URL(N);if(H.hostname){if(H.hostname.lastIndex=0,!H.hostname.test(E.hostname))Q.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:H.hostname.source,input:Q.value,inst:b,continue:!H.abort})}if(H.protocol){if(H.protocol.lastIndex=0,!H.protocol.test(E.protocol.endsWith(":")?E.protocol.slice(0,-1):E.protocol))Q.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:H.protocol.source,input:Q.value,inst:b,continue:!H.abort})}if(H.normalize)Q.value=E.href;else Q.value=N;return}catch(N){Q.issues.push({code:"invalid_format",format:"url",input:Q.value,inst:b,continue:!H.abort})}}}),XY=X("$ZodEmoji",(b,H)=>{H.pattern??(H.pattern=z1()),u.init(b,H)}),qY=X("$ZodNanoID",(b,H)=>{H.pattern??(H.pattern=F1),u.init(b,H)}),KY=X("$ZodCUID",(b,H)=>{H.pattern??(H.pattern=q1),u.init(b,H)}),GY=X("$ZodCUID2",(b,H)=>{H.pattern??(H.pattern=K1),u.init(b,H)}),OY=X("$ZodULID",(b,H)=>{H.pattern??(H.pattern=G1),u.init(b,H)}),AY=X("$ZodXID",(b,H)=>{H.pattern??(H.pattern=O1),u.init(b,H)}),FY=X("$ZodKSUID",(b,H)=>{H.pattern??(H.pattern=A1),u.init(b,H)}),VY=X("$ZodISODateTime",(b,H)=>{H.pattern??(H.pattern=k1(H)),u.init(b,H)}),UY=X("$ZodISODate",(b,H)=>{H.pattern??(H.pattern=S1),u.init(b,H)}),PY=X("$ZodISOTime",(b,H)=>{H.pattern??(H.pattern=g1(H)),u.init(b,H)}),zY=X("$ZodISODuration",(b,H)=>{H.pattern??(H.pattern=V1),u.init(b,H)}),IY=X("$ZodIPv4",(b,H)=>{H.pattern??(H.pattern=I1),u.init(b,H),b._zod.bag.format="ipv4"}),RY=X("$ZodIPv6",(b,H)=>{H.pattern??(H.pattern=R1),u.init(b,H),b._zod.bag.format="ipv6",b._zod.check=(Q)=>{try{new URL(`http://[${Q.value}]`)}catch{Q.issues.push({code:"invalid_format",format:"ipv6",input:Q.value,inst:b,continue:!H.abort})}}}),TY=X("$ZodMAC",(b,H)=>{H.pattern??(H.pattern=T1(H.delimiter)),u.init(b,H),b._zod.bag.format="mac"}),ZY=X("$ZodCIDRv4",(b,H)=>{H.pattern??(H.pattern=Z1),u.init(b,H)}),jY=X("$ZodCIDRv6",(b,H)=>{H.pattern??(H.pattern=j1),u.init(b,H),b._zod.check=(Q)=>{let N=Q.value.split("/");try{if(N.length!==2)throw Error();let[E,M]=N;if(!M)throw Error();let _=Number(M);if(`${_}`!==M)throw Error();if(_<0||_>128)throw Error();new URL(`http://[${E}]`)}catch{Q.issues.push({code:"invalid_format",format:"cidrv6",input:Q.value,inst:b,continue:!H.abort})}}});function LY(b){if(b==="")return!0;if(/\s/.test(b))return!1;if(b.length%4!==0)return!1;try{return atob(b),!0}catch{return!1}}var $Y=X("$ZodBase64",(b,H)=>{H.pattern??(H.pattern=L1),u.init(b,H),b._zod.bag.contentEncoding="base64",b._zod.check=(Q)=>{if(LY(Q.value))return;Q.issues.push({code:"invalid_format",format:"base64",input:Q.value,inst:b,continue:!H.abort})}});function b8(b){if(!rW.test(b))return!1;let H=b.replace(/[-_]/g,(N)=>N==="-"?"+":"/"),Q=H.padEnd(Math.ceil(H.length/4)*4,"=");return LY(Q)}var CY=X("$ZodBase64URL",(b,H)=>{H.pattern??(H.pattern=rW),u.init(b,H),b._zod.bag.contentEncoding="base64url",b._zod.check=(Q)=>{if(b8(Q.value))return;Q.issues.push({code:"invalid_format",format:"base64url",input:Q.value,inst:b,continue:!H.abort})}}),SY=X("$ZodE164",(b,H)=>{H.pattern??(H.pattern=C1),u.init(b,H)});function H8(b,H=null){try{let Q=b.split(".");if(Q.length!==3)return!1;let[N]=Q;if(!N)return!1;let E=JSON.parse(atob(N));if("typ"in E&&E?.typ!=="JWT")return!1;if(!E.alg)return!1;if(H&&(!("alg"in E)||E.alg!==H))return!1;return!0}catch{return!1}}var gY=X("$ZodJWT",(b,H)=>{u.init(b,H),b._zod.check=(Q)=>{if(H8(Q.value,H.alg))return;Q.issues.push({code:"invalid_format",format:"jwt",input:Q.value,inst:b,continue:!H.abort})}}),kY=X("$ZodCustomStringFormat",(b,H)=>{u.init(b,H),b._zod.check=(Q)=>{if(H.fn(Q.value))return;Q.issues.push({code:"invalid_format",format:H.format,input:Q.value,inst:b,continue:!H.abort})}}),N_=X("$ZodNumber",(b,H)=>{k.init(b,H),b._zod.pattern=b._zod.bag.pattern??eE,b._zod.parse=(Q,N)=>{if(H.coerce)try{Q.value=Number(Q.value)}catch(_){}let E=Q.value;if(typeof E==="number"&&!Number.isNaN(E)&&Number.isFinite(E))return Q;let M=typeof E==="number"?Number.isNaN(E)?"NaN":!Number.isFinite(E)?"Infinity":void 0:void 0;return Q.issues.push({expected:"number",code:"invalid_type",input:E,inst:b,...M?{received:M}:{}}),Q}}),xY=X("$ZodNumberFormat",(b,H)=>{i1.init(b,H),N_.init(b,H)}),QM=X("$ZodBoolean",(b,H)=>{k.init(b,H),b._zod.pattern=y1,b._zod.parse=(Q,N)=>{if(H.coerce)try{Q.value=Boolean(Q.value)}catch(M){}let E=Q.value;if(typeof E==="boolean")return Q;return Q.issues.push({expected:"boolean",code:"invalid_type",input:E,inst:b}),Q}}),E_=X("$ZodBigInt",(b,H)=>{k.init(b,H),b._zod.pattern=v1,b._zod.parse=(Q,N)=>{if(H.coerce)try{Q.value=BigInt(Q.value)}catch(E){}if(typeof Q.value==="bigint")return Q;return Q.issues.push({expected:"bigint",code:"invalid_type",input:Q.value,inst:b}),Q}}),vY=X("$ZodBigIntFormat",(b,H)=>{p1.init(b,H),E_.init(b,H)}),hY=X("$ZodSymbol",(b,H)=>{k.init(b,H),b._zod.parse=(Q,N)=>{let E=Q.value;if(typeof E==="symbol")return Q;return Q.issues.push({expected:"symbol",code:"invalid_type",input:E,inst:b}),Q}}),yY=X("$ZodUndefined",(b,H)=>{k.init(b,H),b._zod.pattern=l1,b._zod.values=new Set([void 0]),b._zod.parse=(Q,N)=>{let E=Q.value;if(typeof E>"u")return Q;return Q.issues.push({expected:"undefined",code:"invalid_type",input:E,inst:b}),Q}}),fY=X("$ZodNull",(b,H)=>{k.init(b,H),b._zod.pattern=f1,b._zod.values=new Set([null]),b._zod.parse=(Q,N)=>{let E=Q.value;if(E===null)return Q;return Q.issues.push({expected:"null",code:"invalid_type",input:E,inst:b}),Q}}),lY=X("$ZodAny",(b,H)=>{k.init(b,H),b._zod.parse=(Q)=>Q}),uY=X("$ZodUnknown",(b,H)=>{k.init(b,H),b._zod.parse=(Q)=>Q}),cY=X("$ZodNever",(b,H)=>{k.init(b,H),b._zod.parse=(Q,N)=>{return Q.issues.push({expected:"never",code:"invalid_type",input:Q.value,inst:b}),Q}}),mY=X("$ZodVoid",(b,H)=>{k.init(b,H),b._zod.parse=(Q,N)=>{let E=Q.value;if(typeof E>"u")return Q;return Q.issues.push({expected:"void",code:"invalid_type",input:E,inst:b}),Q}}),iY=X("$ZodDate",(b,H)=>{k.init(b,H),b._zod.parse=(Q,N)=>{if(H.coerce)try{Q.value=new Date(Q.value)}catch(Y){}let E=Q.value,M=E instanceof Date;if(M&&!Number.isNaN(E.getTime()))return Q;return Q.issues.push({expected:"date",code:"invalid_type",input:E,...M?{received:"Invalid Date"}:{},inst:b}),Q}});function l9(b,H,Q){if(b.issues.length)H.issues.push(...Ab(Q,b.issues));H.value[Q]=b.value}var pY=X("$ZodArray",(b,H)=>{k.init(b,H),b._zod.parse=(Q,N)=>{let E=Q.value;if(!Array.isArray(E))return Q.issues.push({expected:"array",code:"invalid_type",input:E,inst:b}),Q;Q.value=Array(E.length);let M=[];for(let _=0;_<E.length;_++){let Y=E[_],D=H.element._zod.run({value:Y,issues:[]},N);if(D instanceof Promise)M.push(D.then((J)=>l9(J,Q,_)));else l9(D,Q,_)}if(M.length)return Promise.all(M).then(()=>Q);return Q}});function Q_(b,H,Q,N,E,M){let _=Q in N;if(b.issues.length){if(E&&M&&!_)return;H.issues.push(...Ab(Q,b.issues))}if(!_&&!E){if(!b.issues.length)H.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[Q]});return}if(b.value===void 0){if(_)H.value[Q]=void 0}else H.value[Q]=b.value}function Q8(b){let H=Object.keys(b.shape);for(let N of H)if(!b.shape?.[N]?._zod?.traits?.has("$ZodType"))throw Error(`Invalid element at key "${N}": expected a Zod schema`);let Q=M1(b.shape);return{...b,keys:H,keySet:new Set(H),numKeys:H.length,optionalKeys:new Set(Q)}}function N8(b,H,Q,N,E,M){let _=[],Y=E.keySet,D=E.catchall._zod,J=D.def.type,K=D.optin==="optional",O=D.optout==="optional";for(let A in H){if(A==="__proto__")continue;if(Y.has(A))continue;if(J==="never"){_.push(A);continue}let V=D.run({value:H[A],issues:[]},N);if(V instanceof Promise)b.push(V.then((j)=>Q_(j,Q,A,H,K,O)));else Q_(V,Q,A,H,K,O)}if(_.length)Q.issues.push({code:"unrecognized_keys",keys:_,input:H,inst:M});if(!b.length)return Q;return Promise.all(b).then(()=>{return Q})}var E8=X("$ZodObject",(b,H)=>{if(k.init(b,H),!Object.getOwnPropertyDescriptor(H,"shape")?.get){let Y=H.shape;Object.defineProperty(H,"shape",{get:()=>{let D={...Y};return Object.defineProperty(H,"shape",{value:D}),D}})}let N=iQ(()=>Q8(H));v(b._zod,"propValues",()=>{let Y=H.shape,D={};for(let J in Y){let K=Y[J]._zod;if(K.values){D[J]??(D[J]=new Set);for(let O of K.values)D[J].add(O)}}return D});let E=HQ,M=H.catchall,_;b._zod.parse=(Y,D)=>{_??(_=N.value);let J=Y.value;if(!E(J))return Y.issues.push({expected:"object",code:"invalid_type",input:J,inst:b}),Y;Y.value={};let K=[],O=_.shape;for(let A of _.keys){let V=O[A],j=V._zod.optin==="optional",$=V._zod.optout==="optional",S=V._zod.run({value:J[A],issues:[]},D);if(S instanceof Promise)K.push(S.then((m)=>Q_(m,Y,A,J,j,$)));else Q_(S,Y,A,J,j,$)}if(!M)return K.length?Promise.all(K).then(()=>Y):Y;return N8(K,J,Y,D,N.value,b)}}),dY=X("$ZodObjectJIT",(b,H)=>{E8.init(b,H);let Q=b._zod.parse,N=iQ(()=>Q8(H)),E=(A)=>{let V=new aW(["shape","payload","ctx"]),j=N.value,$=(l)=>{let y=vW(l);return`shape[${y}]._zod.run({ value: input[${y}], issues: [] }, ctx)`};V.write("const input = payload.value;");let S=Object.create(null),m=0;for(let l of j.keys)S[l]=`key_${m++}`;V.write("const newResult = {};");for(let l of j.keys){let y=S[l],d=vW(l),p=A[l],bb=p?._zod?.optin==="optional",eb=p?._zod?.optout==="optional";if(V.write(`const ${y} = ${$(l)};`),bb&&eb)V.write(`
5
- if (${y}.issues.length) {
6
- if (${d} in input) {
7
- payload.issues = payload.issues.concat(${y}.issues.map(iss => ({
1
+ var{create:Nm,defineProperty:yi,getOwnPropertyDescriptor:Am,getOwnPropertyNames:jm,getPrototypeOf:Lm}=Object,Um=Object.prototype.hasOwnProperty,hl=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),ml=(e,t)=>{let o={};for(var r in e)yi(o,r,{get:e[r],enumerable:!0});if(t)yi(o,Symbol.toStringTag,{value:"Module"});return o},Zm=(e,t,o,r)=>{if(t&&typeof t==="object"||typeof t==="function"){for(var n=jm(t),i=0,a=n.length,u;i<a;i++)if(u=n[i],!Um.call(e,u)&&u!==o)yi(e,u,{get:((d)=>t[d]).bind(null,u),enumerable:!(r=Am(t,u))||r.enumerable})}return e},fl=(e,t,o)=>(o=e!=null?Nm(Lm(e)):{},Zm(t||!e||!e.__esModule?yi(o,"default",{value:e,enumerable:!0}):o,e));var Dm=new Set(["https://json-schema.org/draft/2019-09/schema","http://json-schema.org/draft/2019-09/schema"]);function gl(e){return typeof e==="string"&&Dm.has(e.replace(/#$/,""))}var Sl,ka=Object.freeze({status:"aborted"});function m(e,t,o){function r(u,d){if(!u._zod)Object.defineProperty(u,"_zod",{value:{def:d,constr:a,traits:new Set},enumerable:!1});if(u._zod.traits.has(e))return;u._zod.traits.add(e),t(u,d);let p=a.prototype,f=Object.keys(p);for(let b=0;b<f.length;b++){let y=f[b];if(!(y in u))u[y]=p[y].bind(u)}}let n=o?.Parent??Object;class i extends n{}Object.defineProperty(i,"name",{value:e});function a(u){var d;let p=o?.Parent?new i:this;r(p,u),(d=p._zod).deferred??(d.deferred=[]);for(let f of p._zod.deferred)f();return p}return Object.defineProperty(a,"init",{value:r}),Object.defineProperty(a,Symbol.hasInstance,{value:(u)=>{if(o?.Parent&&u instanceof o.Parent)return!0;return u?._zod?.traits?.has(e)}}),Object.defineProperty(a,"name",{value:e}),a}var Hm=Symbol("zod_brand");class je extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class Vr extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`);this.name="ZodEncodeError"}}(Sl=globalThis).__zod_globalConfig??(Sl.__zod_globalConfig={});var ho=globalThis.__zod_globalConfig;function ce(e){if(e)Object.assign(ho,e);return ho}function zi(e){let t=Object.values(e).filter((r)=>typeof r==="number");return Object.entries(e).filter(([r,n])=>t.indexOf(+r)===-1).map(([r,n])=>n)}function Ca(e,t="|"){return e.map((o)=>qa(o)).join(t)}function Jr(e,t){if(typeof t==="bigint")return t.toString();return t}function Br(e){return{get value(){{let o=e();return Object.defineProperty(this,"value",{value:o}),o}throw Error("cached value already set")}}}function Ri(e){return e===null||e===void 0}function wi(e){let t=e.startsWith("^")?1:0,o=e.endsWith("$")?e.length-1:e.length;return e.slice(t,o)}function bl(e,t){let o=e/t,r=Math.round(o),n=Number.EPSILON*Math.max(Math.abs(o),1);if(Math.abs(o-r)<n)return 0;return o-r}var _l=Symbol("evaluating");function O(e,t,o){let r=void 0;Object.defineProperty(e,t,{get(){if(r===_l)return;if(r===void 0)r=_l,r=o();return r},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function Tt(e,t,o){Object.defineProperty(e,t,{value:o,writable:!0,enumerable:!0,configurable:!0})}function ot(...e){let t={};for(let o of e){let r=Object.getOwnPropertyDescriptors(o);Object.assign(t,r)}return Object.defineProperties({},t)}function Ia(e){return JSON.stringify(e)}function yl(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var Oa="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function mo(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}var vl=Br(()=>{if(ho.jitless)return!1;if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return new Function(""),!0}catch(e){return!1}});function Et(e){if(mo(e)===!1)return!1;let t=e.constructor;if(t===void 0)return!0;if(typeof t!=="function")return!0;let o=t.prototype;if(mo(o)===!1)return!1;if(Object.prototype.hasOwnProperty.call(o,"isPrototypeOf")===!1)return!1;return!0}function Ma(e){if(Et(e))return{...e};if(Array.isArray(e))return[...e];if(e instanceof Map)return new Map(e);if(e instanceof Set)return new Set(e);return e}var zl=new Set(["string","number","symbol"]);function rt(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function we(e,t,o){let r=new e._zod.constr(t??e._zod.def);if(!t||o?.parent)r._zod.parent=e;return r}function w(e){let t=e;if(!t)return{};if(typeof t==="string")return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}if(delete t.message,typeof t.error==="string")return{...t,error:()=>t.error};return t}function qa(e){if(typeof e==="bigint")return e.toString()+"n";if(typeof e==="string")return`"${e}"`;return`${e}`}function Rl(e){return Object.keys(e).filter((t)=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}var wl={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-340282346638528860000000000000000000000,340282346638528860000000000000000000000],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function Fm(e,t){let o=e._zod.def,r=o.checks;if(r&&r.length>0)throw Error(".pick() cannot be used on object schemas containing refinements");let i=ot(e._zod.def,{get shape(){let a={};for(let u in t){if(!(u in o.shape))throw Error(`Unrecognized key: "${u}"`);if(!t[u])continue;a[u]=o.shape[u]}return Tt(this,"shape",a),a},checks:[]});return we(e,i)}function Vm(e,t){let o=e._zod.def,r=o.checks;if(r&&r.length>0)throw Error(".omit() cannot be used on object schemas containing refinements");let i=ot(e._zod.def,{get shape(){let a={...e._zod.def.shape};for(let u in t){if(!(u in o.shape))throw Error(`Unrecognized key: "${u}"`);if(!t[u])continue;delete a[u]}return Tt(this,"shape",a),a},checks:[]});return we(e,i)}function Jm(e,t){if(!Et(t))throw Error("Invalid input to extend: expected a plain object");let o=e._zod.def.checks;if(o&&o.length>0){let i=e._zod.def.shape;for(let a in t)if(Object.getOwnPropertyDescriptor(i,a)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}let n=ot(e._zod.def,{get shape(){let i={...e._zod.def.shape,...t};return Tt(this,"shape",i),i}});return we(e,n)}function Bm(e,t){if(!Et(t))throw Error("Invalid input to safeExtend: expected a plain object");let o=ot(e._zod.def,{get shape(){let r={...e._zod.def.shape,...t};return Tt(this,"shape",r),r}});return we(e,o)}function Wm(e,t){if(e._zod.def.checks?.length)throw Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");let o=ot(e._zod.def,{get shape(){let r={...e._zod.def.shape,...t._zod.def.shape};return Tt(this,"shape",r),r},get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]});return we(e,o)}function Km(e,t,o){let n=t._zod.def.checks;if(n&&n.length>0)throw Error(".partial() cannot be used on object schemas containing refinements");let a=ot(t._zod.def,{get shape(){let u=t._zod.def.shape,d={...u};if(o)for(let p in o){if(!(p in u))throw Error(`Unrecognized key: "${p}"`);if(!o[p])continue;d[p]=e?new e({type:"optional",innerType:u[p]}):u[p]}else for(let p in u)d[p]=e?new e({type:"optional",innerType:u[p]}):u[p];return Tt(this,"shape",d),d},checks:[]});return we(t,a)}function Gm(e,t,o){let r=ot(t._zod.def,{get shape(){let n=t._zod.def.shape,i={...n};if(o)for(let a in o){if(!(a in i))throw Error(`Unrecognized key: "${a}"`);if(!o[a])continue;i[a]=new e({type:"nonoptional",innerType:n[a]})}else for(let a in n)i[a]=new e({type:"nonoptional",innerType:n[a]});return Tt(this,"shape",i),i}});return we(t,r)}function Pt(e,t=0){if(e.aborted===!0)return!0;for(let o=t;o<e.issues.length;o++)if(e.issues[o]?.continue!==!0)return!0;return!1}function xl(e,t=0){if(e.aborted===!0)return!0;for(let o=t;o<e.issues.length;o++)if(e.issues[o]?.continue===!1)return!0;return!1}function nt(e,t){return t.map((o)=>{var r;return(r=o).path??(r.path=[]),o.path.unshift(e),o})}function vi(e){return typeof e==="string"?e:e?.message}function xe(e,t,o){let r=e.message?e.message:vi(e.inst?._zod.def?.error?.(e))??vi(t?.error?.(e))??vi(o.customError?.(e))??vi(o.localeError?.(e))??"Invalid input",{inst:n,continue:i,input:a,...u}=e;if(u.path??(u.path=[]),u.message=r,t?.reportInput)u.input=a;return u}function xi(e){if(Array.isArray(e))return"array";if(typeof e==="string")return"string";return"unknown"}function Tl(e){let t=typeof e;switch(t){case"number":return Number.isNaN(e)?"nan":"number";case"object":{if(e===null)return"null";if(Array.isArray(e))return"array";let o=e;if(o&&Object.getPrototypeOf(o)!==Object.prototype&&"constructor"in o&&o.constructor)return o.constructor.name}}return t}function kt(...e){let[t,o,r]=e;if(typeof t==="string")return{message:t,code:"custom",input:o,inst:r};return{...t}}var El=(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,Jr,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},Ti=m("$ZodError",El),Na=m("$ZodError",El,{Parent:Error});function Aa(e,t=(o)=>o.message){let o={},r=[];for(let n of e.issues)if(n.path.length>0)o[n.path[0]]=o[n.path[0]]||[],o[n.path[0]].push(t(n));else r.push(t(n));return{formErrors:r,fieldErrors:o}}function ja(e,t=(o)=>o.message){let o={_errors:[]},r=(n,i=[])=>{for(let a of n.issues)if(a.code==="invalid_union"&&a.errors.length)a.errors.map((u)=>r({issues:u},[...i,...a.path]));else if(a.code==="invalid_key")r({issues:a.issues},[...i,...a.path]);else if(a.code==="invalid_element")r({issues:a.issues},[...i,...a.path]);else{let u=[...i,...a.path];if(u.length===0)o._errors.push(t(a));else{let d=o,p=0;while(p<u.length){let f=u[p];if(p!==u.length-1)d[f]=d[f]||{_errors:[]};else d[f]=d[f]||{_errors:[]},d[f]._errors.push(t(a));d=d[f],p++}}}};return r(e),o}var Ei=(e)=>(t,o,r,n)=>{let i=r?{...r,async:!1}:{async:!1},a=t._zod.run({value:o,issues:[]},i);if(a instanceof Promise)throw new je;if(a.issues.length){let u=new(n?.Err??e)(a.issues.map((d)=>xe(d,i,ce())));throw Oa(u,n?.callee),u}return a.value};var Pi=(e)=>async(t,o,r,n)=>{let i=r?{...r,async:!0}:{async:!0},a=t._zod.run({value:o,issues:[]},i);if(a instanceof Promise)a=await a;if(a.issues.length){let u=new(n?.Err??e)(a.issues.map((d)=>xe(d,i,ce())));throw Oa(u,n?.callee),u}return a.value};var Wr=(e)=>(t,o,r)=>{let n=r?{...r,async:!1}:{async:!1},i=t._zod.run({value:o,issues:[]},n);if(i instanceof Promise)throw new je;return i.issues.length?{success:!1,error:new(e??Ti)(i.issues.map((a)=>xe(a,n,ce())))}:{success:!0,data:i.value}},Pl=Wr(Na),Kr=(e)=>async(t,o,r)=>{let n=r?{...r,async:!0}:{async:!0},i=t._zod.run({value:o,issues:[]},n);if(i instanceof Promise)i=await i;return i.issues.length?{success:!1,error:new e(i.issues.map((a)=>xe(a,n,ce())))}:{success:!0,data:i.value}},kl=Kr(Na),$l=(e)=>(t,o,r)=>{let n=r?{...r,direction:"backward"}:{direction:"backward"};return Ei(e)(t,o,n)};var Cl=(e)=>(t,o,r)=>Ei(e)(t,o,r);var Il=(e)=>async(t,o,r)=>{let n=r?{...r,direction:"backward"}:{direction:"backward"};return Pi(e)(t,o,n)};var Ol=(e)=>async(t,o,r)=>Pi(e)(t,o,r);var Ml=(e)=>(t,o,r)=>{let n=r?{...r,direction:"backward"}:{direction:"backward"};return Wr(e)(t,o,n)};var ql=(e)=>(t,o,r)=>Wr(e)(t,o,r);var Nl=(e)=>async(t,o,r)=>{let n=r?{...r,direction:"backward"}:{direction:"backward"};return Kr(e)(t,o,n)};var Al=(e)=>async(t,o,r)=>Kr(e)(t,o,r);var jl=/^[cC][0-9a-z]{6,}$/,Ll=/^[0-9a-z]+$/,Ul=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Zl=/^[0-9a-vA-V]{20}$/,Dl=/^[A-Za-z0-9]{27}$/,Hl=/^[a-zA-Z0-9_-]{21}$/,Fl=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/;var Vl=/^([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})$/,La=(e)=>{if(!e)return/^([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)$/;return new 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})$`)};var Jl=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;var Qm="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function Bl(){return new RegExp(Qm,"u")}var Wl=/^(?:(?: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])$/,Kl=/^(([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}|:))$/;var Gl=/^((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])$/,Yl=/^(([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])$/,Ql=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Ua=/^[A-Za-z0-9_-]*$/;var Xl=/^https?$/,eu=/^\+[1-9]\d{6,14}$/,tu="(?:(?:\\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])))",ou=new RegExp(`^${tu}$`);function ru(e){return typeof e.precision==="number"?e.precision===-1?"(?:[01]\\d|2[0-3]):[0-5]\\d":e.precision===0?"(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d":`(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d\\.\\d{${e.precision}}`:"(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?"}function nu(e){return new RegExp(`^${ru(e)}$`)}function su(e){let t=ru({precision:e.precision}),o=["Z"];if(e.local)o.push("");if(e.offset)o.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let r=`${t}(?:${o.join("|")})`;return new RegExp(`^${tu}T(?:${r})$`)}var iu=(e)=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)};var au=/^-?\d+$/,Za=/^-?\d+(?:\.\d+)?$/,cu=/^(?:true|false)$/i,lu=/^null$/i;var uu=/^undefined$/i;var du=/^[^A-Z]*$/,pu=/^[^a-z]*$/;var X=m("$ZodCheck",(e,t)=>{var o;e._zod??(e._zod={}),e._zod.def=t,(o=e._zod).onattach??(o.onattach=[])}),hu={number:"number",bigint:"bigint",object:"date"},Da=m("$ZodCheckLessThan",(e,t)=>{X.init(e,t);let o=hu[typeof t.value];e._zod.onattach.push((r)=>{let n=r._zod.bag,i=(t.inclusive?n.maximum:n.exclusiveMaximum)??Number.POSITIVE_INFINITY;if(t.value<i)if(t.inclusive)n.maximum=t.value;else n.exclusiveMaximum=t.value}),e._zod.check=(r)=>{if(t.inclusive?r.value<=t.value:r.value<t.value)return;r.issues.push({origin:o,code:"too_big",maximum:typeof t.value==="object"?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Ha=m("$ZodCheckGreaterThan",(e,t)=>{X.init(e,t);let o=hu[typeof t.value];e._zod.onattach.push((r)=>{let n=r._zod.bag,i=(t.inclusive?n.minimum:n.exclusiveMinimum)??Number.NEGATIVE_INFINITY;if(t.value>i)if(t.inclusive)n.minimum=t.value;else n.exclusiveMinimum=t.value}),e._zod.check=(r)=>{if(t.inclusive?r.value>=t.value:r.value>t.value)return;r.issues.push({origin:o,code:"too_small",minimum:typeof t.value==="object"?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),mu=m("$ZodCheckMultipleOf",(e,t)=>{X.init(e,t),e._zod.onattach.push((o)=>{var r;(r=o._zod.bag).multipleOf??(r.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.");if(typeof o.value==="bigint"?o.value%t.value===BigInt(0):bl(o.value,t.value)===0)return;o.issues.push({origin:typeof o.value,code:"not_multiple_of",divisor:t.value,input:o.value,inst:e,continue:!t.abort})}}),fu=m("$ZodCheckNumberFormat",(e,t)=>{X.init(e,t),t.format=t.format||"float64";let o=t.format?.includes("int"),r=o?"int":"number",[n,i]=wl[t.format];e._zod.onattach.push((a)=>{let u=a._zod.bag;if(u.format=t.format,u.minimum=n,u.maximum=i,o)u.pattern=au}),e._zod.check=(a)=>{let u=a.value;if(o){if(!Number.isInteger(u)){a.issues.push({expected:r,format:t.format,code:"invalid_type",continue:!1,input:u,inst:e});return}if(!Number.isSafeInteger(u)){if(u>0)a.issues.push({input:u,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:r,inclusive:!0,continue:!t.abort});else a.issues.push({input:u,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:r,inclusive:!0,continue:!t.abort});return}}if(u<n)a.issues.push({origin:"number",input:u,code:"too_small",minimum:n,inclusive:!0,inst:e,continue:!t.abort});if(u>i)a.issues.push({origin:"number",input:u,code:"too_big",maximum:i,inclusive:!0,inst:e,continue:!t.abort})}});var gu=m("$ZodCheckMaxLength",(e,t)=>{var o;X.init(e,t),(o=e._zod.def).when??(o.when=(r)=>{let n=r.value;return!Ri(n)&&n.length!==void 0}),e._zod.onattach.push((r)=>{let n=r._zod.bag.maximum??Number.POSITIVE_INFINITY;if(t.maximum<n)r._zod.bag.maximum=t.maximum}),e._zod.check=(r)=>{let n=r.value;if(n.length<=t.maximum)return;let a=xi(n);r.issues.push({origin:a,code:"too_big",maximum:t.maximum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),Su=m("$ZodCheckMinLength",(e,t)=>{var o;X.init(e,t),(o=e._zod.def).when??(o.when=(r)=>{let n=r.value;return!Ri(n)&&n.length!==void 0}),e._zod.onattach.push((r)=>{let n=r._zod.bag.minimum??Number.NEGATIVE_INFINITY;if(t.minimum>n)r._zod.bag.minimum=t.minimum}),e._zod.check=(r)=>{let n=r.value;if(n.length>=t.minimum)return;let a=xi(n);r.issues.push({origin:a,code:"too_small",minimum:t.minimum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),_u=m("$ZodCheckLengthEquals",(e,t)=>{var o;X.init(e,t),(o=e._zod.def).when??(o.when=(r)=>{let n=r.value;return!Ri(n)&&n.length!==void 0}),e._zod.onattach.push((r)=>{let n=r._zod.bag;n.minimum=t.length,n.maximum=t.length,n.length=t.length}),e._zod.check=(r)=>{let n=r.value,i=n.length;if(i===t.length)return;let a=xi(n),u=i>t.length;r.issues.push({origin:a,...u?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:r.value,inst:e,continue:!t.abort})}}),Yr=m("$ZodCheckStringFormat",(e,t)=>{var o,r;if(X.init(e,t),e._zod.onattach.push((n)=>{let i=n._zod.bag;if(i.format=t.format,t.pattern)i.patterns??(i.patterns=new Set),i.patterns.add(t.pattern)}),t.pattern)(o=e._zod).check??(o.check=(n)=>{if(t.pattern.lastIndex=0,t.pattern.test(n.value))return;n.issues.push({origin:"string",code:"invalid_format",format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})});else(r=e._zod).check??(r.check=()=>{})}),bu=m("$ZodCheckRegex",(e,t)=>{Yr.init(e,t),e._zod.check=(o)=>{if(t.pattern.lastIndex=0,t.pattern.test(o.value))return;o.issues.push({origin:"string",code:"invalid_format",format:"regex",input:o.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),yu=m("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=du),Yr.init(e,t)}),vu=m("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=pu),Yr.init(e,t)}),zu=m("$ZodCheckIncludes",(e,t)=>{X.init(e,t);let o=rt(t.includes),r=new RegExp(typeof t.position==="number"?`^.{${t.position}}${o}`:o);t.pattern=r,e._zod.onattach.push((n)=>{let i=n._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(r)}),e._zod.check=(n)=>{if(n.value.includes(t.includes,t.position))return;n.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),Ru=m("$ZodCheckStartsWith",(e,t)=>{X.init(e,t);let o=new RegExp(`^${rt(t.prefix)}.*`);t.pattern??(t.pattern=o),e._zod.onattach.push((r)=>{let n=r._zod.bag;n.patterns??(n.patterns=new Set),n.patterns.add(o)}),e._zod.check=(r)=>{if(r.value.startsWith(t.prefix))return;r.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:r.value,inst:e,continue:!t.abort})}}),wu=m("$ZodCheckEndsWith",(e,t)=>{X.init(e,t);let o=new RegExp(`.*${rt(t.suffix)}$`);t.pattern??(t.pattern=o),e._zod.onattach.push((r)=>{let n=r._zod.bag;n.patterns??(n.patterns=new Set),n.patterns.add(o)}),e._zod.check=(r)=>{if(r.value.endsWith(t.suffix))return;r.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:r.value,inst:e,continue:!t.abort})}});var xu=m("$ZodCheckOverwrite",(e,t)=>{X.init(e,t),e._zod.check=(o)=>{o.value=t.tx(o.value)}});class Fa{constructor(e=[]){if(this.content=[],this.indent=0,this)this.args=e}indented(e){this.indent+=1,e(this),this.indent-=1}write(e){if(typeof e==="function"){e(this,{execution:"sync"}),e(this,{execution:"async"});return}let o=e.split(`
2
+ `).filter((i)=>i),r=Math.min(...o.map((i)=>i.length-i.trimStart().length)),n=o.map((i)=>i.slice(r)).map((i)=>" ".repeat(this.indent*2)+i);for(let i of n)this.content.push(i)}compile(){let e=Function,t=this?.args,r=[...(this?.content??[""]).map((n)=>` ${n}`)];return new e(...t,r.join(`
3
+ `))}}var Eu={major:4,minor:4,patch:3};var N=m("$ZodType",(e,t)=>{var o;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Eu;let r=[...e._zod.def.checks??[]];if(e._zod.traits.has("$ZodCheck"))r.unshift(e);for(let n of r)for(let i of n._zod.onattach)i(e);if(r.length===0)(o=e._zod).deferred??(o.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let n=(a,u,d)=>{let p=Pt(a),f;for(let b of u){if(b._zod.def.when){if(xl(a))continue;if(!b._zod.def.when(a))continue}else if(p)continue;let y=a.issues.length,z=b._zod.check(a);if(z instanceof Promise&&d?.async===!1)throw new je;if(f||z instanceof Promise)f=(f??Promise.resolve()).then(async()=>{if(await z,a.issues.length===y)return;if(!p)p=Pt(a,y)});else{if(a.issues.length===y)continue;if(!p)p=Pt(a,y)}}if(f)return f.then(()=>a);return a},i=(a,u,d)=>{if(Pt(a))return a.aborted=!0,a;let p=n(u,r,d);if(p instanceof Promise){if(d.async===!1)throw new je;return p.then((f)=>e._zod.parse(f,d))}return e._zod.parse(p,d)};e._zod.run=(a,u)=>{if(u.skipChecks)return e._zod.parse(a,u);if(u.direction==="backward"){let p=e._zod.parse({value:a.value,issues:[]},{...u,skipChecks:!0});if(p instanceof Promise)return p.then((f)=>i(f,a,u));return i(p,a,u)}let d=e._zod.parse(a,u);if(d instanceof Promise){if(u.async===!1)throw new je;return d.then((p)=>n(p,r,u))}return n(d,r,u)}}O(e,"~standard",()=>({validate:(n)=>{try{let i=Pl(e,n);return i.success?{value:i.data}:{issues:i.error?.issues}}catch(i){return kl(e,n).then((a)=>a.success?{value:a.data}:{issues:a.error?.issues})}},vendor:"zod",version:1}))}),Ci=m("$ZodString",(e,t)=>{N.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??iu(e._zod.bag),e._zod.parse=(o,r)=>{if(t.coerce)try{o.value=String(o.value)}catch(n){}if(typeof o.value==="string")return o;return o.issues.push({expected:"string",code:"invalid_type",input:o.value,inst:e}),o}}),Z=m("$ZodStringFormat",(e,t)=>{Yr.init(e,t),Ci.init(e,t)}),Nu=m("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=Vl),Z.init(e,t)}),Au=m("$ZodUUID",(e,t)=>{if(t.version){let r={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(r===void 0)throw Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=La(r))}else t.pattern??(t.pattern=La());Z.init(e,t)}),ju=m("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=Jl),Z.init(e,t)}),Lu=m("$ZodURL",(e,t)=>{Z.init(e,t),e._zod.check=(o)=>{try{let r=o.value.trim();if(!t.normalize&&t.protocol?.source===Xl.source){if(!/^https?:\/\//i.test(r)){o.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:o.value,inst:e,continue:!t.abort});return}}let n=new URL(r);if(t.hostname){if(t.hostname.lastIndex=0,!t.hostname.test(n.hostname))o.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:o.value,inst:e,continue:!t.abort})}if(t.protocol){if(t.protocol.lastIndex=0,!t.protocol.test(n.protocol.endsWith(":")?n.protocol.slice(0,-1):n.protocol))o.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:o.value,inst:e,continue:!t.abort})}if(t.normalize)o.value=n.href;else o.value=r;return}catch(r){o.issues.push({code:"invalid_format",format:"url",input:o.value,inst:e,continue:!t.abort})}}}),Uu=m("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=Bl()),Z.init(e,t)}),Zu=m("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=Hl),Z.init(e,t)}),Du=m("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=jl),Z.init(e,t)}),Hu=m("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=Ll),Z.init(e,t)}),Fu=m("$ZodULID",(e,t)=>{t.pattern??(t.pattern=Ul),Z.init(e,t)}),Vu=m("$ZodXID",(e,t)=>{t.pattern??(t.pattern=Zl),Z.init(e,t)}),Ju=m("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=Dl),Z.init(e,t)}),Bu=m("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=su(t)),Z.init(e,t)}),Wu=m("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=ou),Z.init(e,t)}),Ku=m("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=nu(t)),Z.init(e,t)}),Gu=m("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=Fl),Z.init(e,t)}),Yu=m("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=Wl),Z.init(e,t),e._zod.bag.format="ipv4"}),Qu=m("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=Kl),Z.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})}}});var Xu=m("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=Gl),Z.init(e,t)}),ed=m("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=Yl),Z.init(e,t),e._zod.check=(o)=>{let r=o.value.split("/");try{if(r.length!==2)throw Error();let[n,i]=r;if(!i)throw Error();let a=Number(i);if(`${a}`!==i)throw Error();if(a<0||a>128)throw Error();new URL(`http://[${n}]`)}catch{o.issues.push({code:"invalid_format",format:"cidrv6",input:o.value,inst:e,continue:!t.abort})}}});function td(e){if(e==="")return!0;if(/\s/.test(e))return!1;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}var od=m("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=Ql),Z.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=(o)=>{if(td(o.value))return;o.issues.push({code:"invalid_format",format:"base64",input:o.value,inst:e,continue:!t.abort})}});function Xm(e){if(!Ua.test(e))return!1;let t=e.replace(/[-_]/g,(r)=>r==="-"?"+":"/"),o=t.padEnd(Math.ceil(t.length/4)*4,"=");return td(o)}var rd=m("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=Ua),Z.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=(o)=>{if(Xm(o.value))return;o.issues.push({code:"invalid_format",format:"base64url",input:o.value,inst:e,continue:!t.abort})}}),nd=m("$ZodE164",(e,t)=>{t.pattern??(t.pattern=eu),Z.init(e,t)});function ef(e,t=null){try{let o=e.split(".");if(o.length!==3)return!1;let[r]=o;if(!r)return!1;let n=JSON.parse(atob(r));if("typ"in n&&n?.typ!=="JWT")return!1;if(!n.alg)return!1;if(t&&(!("alg"in n)||n.alg!==t))return!1;return!0}catch{return!1}}var sd=m("$ZodJWT",(e,t)=>{Z.init(e,t),e._zod.check=(o)=>{if(ef(o.value,t.alg))return;o.issues.push({code:"invalid_format",format:"jwt",input:o.value,inst:e,continue:!t.abort})}});var Ja=m("$ZodNumber",(e,t)=>{N.init(e,t),e._zod.pattern=e._zod.bag.pattern??Za,e._zod.parse=(o,r)=>{if(t.coerce)try{o.value=Number(o.value)}catch(a){}let n=o.value;if(typeof n==="number"&&!Number.isNaN(n)&&Number.isFinite(n))return o;let i=typeof n==="number"?Number.isNaN(n)?"NaN":!Number.isFinite(n)?"Infinity":void 0:void 0;return o.issues.push({expected:"number",code:"invalid_type",input:n,inst:e,...i?{received:i}:{}}),o}}),id=m("$ZodNumberFormat",(e,t)=>{fu.init(e,t),Ja.init(e,t)}),ad=m("$ZodBoolean",(e,t)=>{N.init(e,t),e._zod.pattern=cu,e._zod.parse=(o,r)=>{if(t.coerce)try{o.value=Boolean(o.value)}catch(i){}let n=o.value;if(typeof n==="boolean")return o;return o.issues.push({expected:"boolean",code:"invalid_type",input:n,inst:e}),o}});var cd=m("$ZodUndefined",(e,t)=>{N.init(e,t),e._zod.pattern=uu,e._zod.values=new Set([void 0]),e._zod.parse=(o,r)=>{let n=o.value;if(typeof n>"u")return o;return o.issues.push({expected:"undefined",code:"invalid_type",input:n,inst:e}),o}}),ld=m("$ZodNull",(e,t)=>{N.init(e,t),e._zod.pattern=lu,e._zod.values=new Set([null]),e._zod.parse=(o,r)=>{let n=o.value;if(n===null)return o;return o.issues.push({expected:"null",code:"invalid_type",input:n,inst:e}),o}}),ud=m("$ZodAny",(e,t)=>{N.init(e,t),e._zod.parse=(o)=>o}),dd=m("$ZodUnknown",(e,t)=>{N.init(e,t),e._zod.parse=(o)=>o}),pd=m("$ZodNever",(e,t)=>{N.init(e,t),e._zod.parse=(o,r)=>(o.issues.push({expected:"never",code:"invalid_type",input:o.value,inst:e}),o)});function Pu(e,t,o){if(e.issues.length)t.issues.push(...nt(o,e.issues));t.value[o]=e.value}var hd=m("$ZodArray",(e,t)=>{N.init(e,t),e._zod.parse=(o,r)=>{let n=o.value;if(!Array.isArray(n))return o.issues.push({expected:"array",code:"invalid_type",input:n,inst:e}),o;o.value=Array(n.length);let i=[];for(let a=0;a<n.length;a++){let u=n[a],d=t.element._zod.run({value:u,issues:[]},r);if(d instanceof Promise)i.push(d.then((p)=>Pu(p,o,a)));else Pu(d,o,a)}if(i.length)return Promise.all(i).then(()=>o);return o}});function $i(e,t,o,r,n,i){let a=o in r;if(e.issues.length){if(n&&i&&!a)return;t.issues.push(...nt(o,e.issues))}if(!a&&!n){if(!e.issues.length)t.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[o]});return}if(e.value===void 0){if(a)t.value[o]=void 0}else t.value[o]=e.value}function md(e){let t=Object.keys(e.shape);for(let r of t)if(!e.shape?.[r]?._zod?.traits?.has("$ZodType"))throw Error(`Invalid element at key "${r}": expected a Zod schema`);let o=Rl(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(o)}}function fd(e,t,o,r,n,i){let a=[],u=n.keySet,d=n.catchall._zod,p=d.def.type,f=d.optin==="optional",b=d.optout==="optional";for(let y in t){if(y==="__proto__")continue;if(u.has(y))continue;if(p==="never"){a.push(y);continue}let z=d.run({value:t[y],issues:[]},r);if(z instanceof Promise)e.push(z.then((E)=>$i(E,o,y,t,f,b)));else $i(z,o,y,t,f,b)}if(a.length)o.issues.push({code:"unrecognized_keys",keys:a,input:t,inst:i});if(!e.length)return o;return Promise.all(e).then(()=>o)}var tf=m("$ZodObject",(e,t)=>{if(N.init(e,t),!Object.getOwnPropertyDescriptor(t,"shape")?.get){let u=t.shape;Object.defineProperty(t,"shape",{get:()=>{let d={...u};return Object.defineProperty(t,"shape",{value:d}),d}})}let r=Br(()=>md(t));O(e._zod,"propValues",()=>{let u=t.shape,d={};for(let p in u){let f=u[p]._zod;if(f.values){d[p]??(d[p]=new Set);for(let b of f.values)d[p].add(b)}}return d});let n=mo,i=t.catchall,a;e._zod.parse=(u,d)=>{a??(a=r.value);let p=u.value;if(!n(p))return u.issues.push({expected:"object",code:"invalid_type",input:p,inst:e}),u;u.value={};let f=[],b=a.shape;for(let y of a.keys){let z=b[y],E=z._zod.optin==="optional",P=z._zod.optout==="optional",k=z._zod.run({value:p[y],issues:[]},d);if(k instanceof Promise)f.push(k.then((A)=>$i(A,u,y,p,E,P)));else $i(k,u,y,p,E,P)}if(!i)return f.length?Promise.all(f).then(()=>u):u;return fd(f,p,u,d,r.value,e)}}),gd=m("$ZodObjectJIT",(e,t)=>{tf.init(e,t);let o=e._zod.parse,r=Br(()=>md(t)),n=(y)=>{let z=new Fa(["shape","payload","ctx"]),E=r.value,P=(q)=>{let M=Ia(q);return`shape[${M}]._zod.run({ value: input[${M}], issues: [] }, ctx)`};z.write("const input = payload.value;");let k=Object.create(null),A=0;for(let q of E.keys)k[q]=`key_${A++}`;z.write("const newResult = {};");for(let q of E.keys){let M=k[q],D=Ia(q),U=y[q],G=U?._zod?.optin==="optional",qe=U?._zod?.optout==="optional";if(z.write(`const ${M} = ${P(q)};`),G&&qe)z.write(`
4
+ if (${M}.issues.length) {
5
+ if (${D} in input) {
6
+ payload.issues = payload.issues.concat(${M}.issues.map(iss => ({
8
7
  ...iss,
9
- path: iss.path ? [${d}, ...iss.path] : [${d}]
8
+ path: iss.path ? [${D}, ...iss.path] : [${D}]
10
9
  })));
11
10
  }
12
11
  }
13
12
 
14
- if (${y}.value === undefined) {
15
- if (${d} in input) {
16
- newResult[${d}] = undefined;
13
+ if (${M}.value === undefined) {
14
+ if (${D} in input) {
15
+ newResult[${D}] = undefined;
17
16
  }
18
17
  } else {
19
- newResult[${d}] = ${y}.value;
18
+ newResult[${D}] = ${M}.value;
20
19
  }
21
20
 
22
- `);else if(!bb)V.write(`
23
- const ${y}_present = ${d} in input;
24
- if (${y}.issues.length) {
25
- payload.issues = payload.issues.concat(${y}.issues.map(iss => ({
21
+ `);else if(!G)z.write(`
22
+ const ${M}_present = ${D} in input;
23
+ if (${M}.issues.length) {
24
+ payload.issues = payload.issues.concat(${M}.issues.map(iss => ({
26
25
  ...iss,
27
- path: iss.path ? [${d}, ...iss.path] : [${d}]
26
+ path: iss.path ? [${D}, ...iss.path] : [${D}]
28
27
  })));
29
28
  }
30
- if (!${y}_present && !${y}.issues.length) {
29
+ if (!${M}_present && !${M}.issues.length) {
31
30
  payload.issues.push({
32
31
  code: "invalid_type",
33
32
  expected: "nonoptional",
34
33
  input: undefined,
35
- path: [${d}]
34
+ path: [${D}]
36
35
  });
37
36
  }
38
37
 
39
- if (${y}_present) {
40
- if (${y}.value === undefined) {
41
- newResult[${d}] = undefined;
38
+ if (${M}_present) {
39
+ if (${M}.value === undefined) {
40
+ newResult[${D}] = undefined;
42
41
  } else {
43
- newResult[${d}] = ${y}.value;
42
+ newResult[${D}] = ${M}.value;
44
43
  }
45
44
  }
46
45
 
47
- `);else V.write(`
48
- if (${y}.issues.length) {
49
- payload.issues = payload.issues.concat(${y}.issues.map(iss => ({
46
+ `);else z.write(`
47
+ if (${M}.issues.length) {
48
+ payload.issues = payload.issues.concat(${M}.issues.map(iss => ({
50
49
  ...iss,
51
- path: iss.path ? [${d}, ...iss.path] : [${d}]
50
+ path: iss.path ? [${D}, ...iss.path] : [${D}]
52
51
  })));
53
52
  }
54
53
 
55
- if (${y}.value === undefined) {
56
- if (${d} in input) {
57
- newResult[${d}] = undefined;
54
+ if (${M}.value === undefined) {
55
+ if (${D} in input) {
56
+ newResult[${D}] = undefined;
58
57
  }
59
58
  } else {
60
- newResult[${d}] = ${y}.value;
59
+ newResult[${D}] = ${M}.value;
61
60
  }
62
61
 
63
- `)}V.write("payload.value = newResult;"),V.write("return payload;");let t=V.compile();return(l,y)=>t(A,l,y)},M,_=HQ,Y=!eH.jitless,J=Y&&Q1.value,K=H.catchall,O;b._zod.parse=(A,V)=>{O??(O=N.value);let j=A.value;if(!_(j))return A.issues.push({expected:"object",code:"invalid_type",input:j,inst:b}),A;if(Y&&J&&V?.async===!1&&V.jitless!==!0){if(!M)M=E(H.shape);if(A=M(A,V),!K)return A;return N8([],j,A,V,O,b)}return Q(A,V)}});function u9(b,H,Q,N){for(let M of b)if(M.issues.length===0)return H.value=M.value,H;let E=b.filter((M)=>!TH(M));if(E.length===1)return H.value=E[0].value,E[0];return H.issues.push({code:"invalid_union",input:H.value,inst:Q,errors:b.map((M)=>M.issues.map((_)=>qb(_,N,s())))}),H}var NM=X("$ZodUnion",(b,H)=>{k.init(b,H),v(b._zod,"optin",()=>H.options.some((N)=>N._zod.optin==="optional")?"optional":void 0),v(b._zod,"optout",()=>H.options.some((N)=>N._zod.optout==="optional")?"optional":void 0),v(b._zod,"values",()=>{if(H.options.every((N)=>N._zod.values))return new Set(H.options.flatMap((N)=>Array.from(N._zod.values)));return}),v(b._zod,"pattern",()=>{if(H.options.every((N)=>N._zod.pattern)){let N=H.options.map((E)=>E._zod.pattern);return new RegExp(`^(${N.map((E)=>dE(E.source)).join("|")})$`)}return});let Q=H.options.length===1?H.options[0]._zod.run:null;b._zod.parse=(N,E)=>{if(Q)return Q(N,E);let M=!1,_=[];for(let Y of H.options){let D=Y._zod.run({value:N.value,issues:[]},E);if(D instanceof Promise)_.push(D),M=!0;else{if(D.issues.length===0)return D;_.push(D)}}if(!M)return u9(_,N,b,E);return Promise.all(_).then((Y)=>{return u9(Y,N,b,E)})}});function c9(b,H,Q,N){let E=b.filter((M)=>M.issues.length===0);if(E.length===1)return H.value=E[0].value,H;if(E.length===0)H.issues.push({code:"invalid_union",input:H.value,inst:Q,errors:b.map((M)=>M.issues.map((_)=>qb(_,N,s())))});else H.issues.push({code:"invalid_union",input:H.value,inst:Q,errors:[],inclusive:!1});return H}var oY=X("$ZodXor",(b,H)=>{NM.init(b,H),H.inclusive=!1;let Q=H.options.length===1?H.options[0]._zod.run:null;b._zod.parse=(N,E)=>{if(Q)return Q(N,E);let M=!1,_=[];for(let Y of H.options){let D=Y._zod.run({value:N.value,issues:[]},E);if(D instanceof Promise)_.push(D),M=!0;else _.push(D)}if(!M)return c9(_,N,b,E);return Promise.all(_).then((Y)=>{return c9(Y,N,b,E)})}}),nY=X("$ZodDiscriminatedUnion",(b,H)=>{H.inclusive=!1,NM.init(b,H);let Q=b._zod.parse;v(b._zod,"propValues",()=>{let E={};for(let M of H.options){let _=M._zod.propValues;if(!_||Object.keys(_).length===0)throw Error(`Invalid discriminated union option at index "${H.options.indexOf(M)}"`);for(let[Y,D]of Object.entries(_)){if(!E[Y])E[Y]=new Set;for(let J of D)E[Y].add(J)}}return E});let N=iQ(()=>{let E=H.options,M=new Map;for(let _ of E){let Y=_._zod.propValues?.[H.discriminator];if(!Y||Y.size===0)throw Error(`Invalid discriminated union option at index "${H.options.indexOf(_)}"`);for(let D of Y){if(M.has(D))throw Error(`Duplicate discriminator value "${String(D)}"`);M.set(D,_)}}return M});b._zod.parse=(E,M)=>{let _=E.value;if(!HQ(_))return E.issues.push({code:"invalid_type",expected:"object",input:_,inst:b}),E;let Y=N.value.get(_?.[H.discriminator]);if(Y)return Y._zod.run(E,M);if(H.unionFallback||M.direction==="backward")return Q(E,M);return E.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:H.discriminator,options:Array.from(N.value.keys()),input:_,path:[H.discriminator],inst:b}),E}}),rY=X("$ZodIntersection",(b,H)=>{k.init(b,H),b._zod.parse=(Q,N)=>{let E=Q.value,M=H.left._zod.run({value:E,issues:[]},N),_=H.right._zod.run({value:E,issues:[]},N);if(M instanceof Promise||_ instanceof Promise)return Promise.all([M,_]).then(([D,J])=>{return m9(Q,D,J)});return m9(Q,M,_)}});function wY(b,H){if(b===H)return{valid:!0,data:b};if(b instanceof Date&&H instanceof Date&&+b===+H)return{valid:!0,data:b};if(RH(b)&&RH(H)){let Q=Object.keys(H),N=Object.keys(b).filter((M)=>Q.indexOf(M)!==-1),E={...b,...H};for(let M of N){let _=wY(b[M],H[M]);if(!_.valid)return{valid:!1,mergeErrorPath:[M,..._.mergeErrorPath]};E[M]=_.data}return{valid:!0,data:E}}if(Array.isArray(b)&&Array.isArray(H)){if(b.length!==H.length)return{valid:!1,mergeErrorPath:[]};let Q=[];for(let N=0;N<b.length;N++){let E=b[N],M=H[N],_=wY(E,M);if(!_.valid)return{valid:!1,mergeErrorPath:[N,..._.mergeErrorPath]};Q.push(_.data)}return{valid:!0,data:Q}}return{valid:!1,mergeErrorPath:[]}}function m9(b,H,Q){let N=new Map,E;for(let Y of H.issues)if(Y.code==="unrecognized_keys"){E??(E=Y);for(let D of Y.keys){if(!N.has(D))N.set(D,{});N.get(D).l=!0}}else b.issues.push(Y);for(let Y of Q.issues)if(Y.code==="unrecognized_keys")for(let D of Y.keys){if(!N.has(D))N.set(D,{});N.get(D).r=!0}else b.issues.push(Y);let M=[...N].filter(([,Y])=>Y.l&&Y.r).map(([Y])=>Y);if(M.length&&E)b.issues.push({...E,keys:M});if(TH(b))return b;let _=wY(H.value,Q.value);if(!_.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(_.mergeErrorPath)}`);return b.value=_.data,b}var M_=X("$ZodTuple",(b,H)=>{k.init(b,H);let Q=H.items;b._zod.parse=(N,E)=>{let M=N.value;if(!Array.isArray(M))return N.issues.push({input:M,inst:b,expected:"tuple",code:"invalid_type"}),N;N.value=[];let _=[],Y=i9(Q,"optin"),D=i9(Q,"optout");if(!H.rest){if(M.length<Y)return N.issues.push({code:"too_small",minimum:Y,inclusive:!0,input:M,inst:b,origin:"array"}),N;if(M.length>Q.length)N.issues.push({code:"too_big",maximum:Q.length,inclusive:!0,input:M,inst:b,origin:"array"})}let J=Array(Q.length);for(let K=0;K<Q.length;K++){let O=Q[K]._zod.run({value:M[K],issues:[]},E);if(O instanceof Promise)_.push(O.then((A)=>{J[K]=A}));else J[K]=O}if(H.rest){let K=Q.length-1,O=M.slice(Q.length);for(let A of O){K++;let V=H.rest._zod.run({value:A,issues:[]},E);if(V instanceof Promise)_.push(V.then((j)=>p9(j,N,K)));else p9(V,N,K)}}if(_.length)return Promise.all(_).then(()=>d9(J,N,Q,M,D));return d9(J,N,Q,M,D)}});function i9(b,H){for(let Q=b.length-1;Q>=0;Q--)if(b[Q]._zod[H]!=="optional")return Q+1;return 0}function p9(b,H,Q){if(b.issues.length)H.issues.push(...Ab(Q,b.issues));H.value[Q]=b.value}function d9(b,H,Q,N,E){for(let M=0;M<Q.length;M++){let _=b[M],Y=M<N.length;if(_.issues.length){if(!Y&&M>=E){H.value.length=M;break}H.issues.push(...Ab(M,_.issues))}H.value[M]=_.value}for(let M=H.value.length-1;M>=N.length;M--)if(Q[M]._zod.optout==="optional"&&H.value[M]===void 0)H.value.length=M;else break;return H}var tY=X("$ZodRecord",(b,H)=>{k.init(b,H),b._zod.parse=(Q,N)=>{let E=Q.value;if(!RH(E))return Q.issues.push({expected:"record",code:"invalid_type",input:E,inst:b}),Q;let M=[],_=H.keyType._zod.values;if(_){Q.value={};let Y=new Set;for(let J of _)if(typeof J==="string"||typeof J==="number"||typeof J==="symbol"){Y.add(typeof J==="number"?J.toString():J);let K=H.keyType._zod.run({value:J,issues:[]},N);if(K instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(K.issues.length){Q.issues.push({code:"invalid_key",origin:"record",issues:K.issues.map((V)=>qb(V,N,s())),input:J,path:[J],inst:b});continue}let O=K.value,A=H.valueType._zod.run({value:E[J],issues:[]},N);if(A instanceof Promise)M.push(A.then((V)=>{if(V.issues.length)Q.issues.push(...Ab(J,V.issues));Q.value[O]=V.value}));else{if(A.issues.length)Q.issues.push(...Ab(J,A.issues));Q.value[O]=A.value}}let D;for(let J in E)if(!Y.has(J))D=D??[],D.push(J);if(D&&D.length>0)Q.issues.push({code:"unrecognized_keys",input:E,inst:b,keys:D})}else{Q.value={};for(let Y of Reflect.ownKeys(E)){if(Y==="__proto__")continue;if(!Object.prototype.propertyIsEnumerable.call(E,Y))continue;let D=H.keyType._zod.run({value:Y,issues:[]},N);if(D instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(typeof Y==="string"&&eE.test(Y)&&D.issues.length){let O=H.keyType._zod.run({value:Number(Y),issues:[]},N);if(O instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(O.issues.length===0)D=O}if(D.issues.length){if(H.mode==="loose")Q.value[Y]=E[Y];else Q.issues.push({code:"invalid_key",origin:"record",issues:D.issues.map((O)=>qb(O,N,s())),input:Y,path:[Y],inst:b});continue}let K=H.valueType._zod.run({value:E[Y],issues:[]},N);if(K instanceof Promise)M.push(K.then((O)=>{if(O.issues.length)Q.issues.push(...Ab(Y,O.issues));Q.value[D.value]=O.value}));else{if(K.issues.length)Q.issues.push(...Ab(Y,K.issues));Q.value[D.value]=K.value}}}if(M.length)return Promise.all(M).then(()=>Q);return Q}}),sY=X("$ZodMap",(b,H)=>{k.init(b,H),b._zod.parse=(Q,N)=>{let E=Q.value;if(!(E instanceof Map))return Q.issues.push({expected:"map",code:"invalid_type",input:E,inst:b}),Q;let M=[];Q.value=new Map;for(let[_,Y]of E){let D=H.keyType._zod.run({value:_,issues:[]},N),J=H.valueType._zod.run({value:Y,issues:[]},N);if(D instanceof Promise||J instanceof Promise)M.push(Promise.all([D,J]).then(([K,O])=>{o9(K,O,Q,_,E,b,N)}));else o9(D,J,Q,_,E,b,N)}if(M.length)return Promise.all(M).then(()=>Q);return Q}});function o9(b,H,Q,N,E,M,_){if(b.issues.length)if(oE.has(typeof N))Q.issues.push(...Ab(N,b.issues));else Q.issues.push({code:"invalid_key",origin:"map",input:E,inst:M,issues:b.issues.map((Y)=>qb(Y,_,s()))});if(H.issues.length)if(oE.has(typeof N))Q.issues.push(...Ab(N,H.issues));else Q.issues.push({origin:"map",code:"invalid_element",input:E,inst:M,key:N,issues:H.issues.map((Y)=>qb(Y,_,s()))});Q.value.set(b.value,H.value)}var aY=X("$ZodSet",(b,H)=>{k.init(b,H),b._zod.parse=(Q,N)=>{let E=Q.value;if(!(E instanceof Set))return Q.issues.push({input:E,inst:b,expected:"set",code:"invalid_type"}),Q;let M=[];Q.value=new Set;for(let _ of E){let Y=H.valueType._zod.run({value:_,issues:[]},N);if(Y instanceof Promise)M.push(Y.then((D)=>n9(D,Q)));else n9(Y,Q)}if(M.length)return Promise.all(M).then(()=>Q);return Q}});function n9(b,H){if(b.issues.length)H.issues.push(...b.issues);H.value.add(b.value)}var eY=X("$ZodEnum",(b,H)=>{k.init(b,H);let Q=pE(H.entries),N=new Set(Q);b._zod.values=N,b._zod.pattern=new RegExp(`^(${Q.filter((E)=>oE.has(typeof E)).map((E)=>typeof E==="string"?Sb(E):E.toString()).join("|")})$`),b._zod.parse=(E,M)=>{let _=E.value;if(N.has(_))return E;return E.issues.push({code:"invalid_value",values:Q,input:_,inst:b}),E}}),b4=X("$ZodLiteral",(b,H)=>{if(k.init(b,H),H.values.length===0)throw Error("Cannot create literal schema with no valid values");let Q=new Set(H.values);b._zod.values=Q,b._zod.pattern=new RegExp(`^(${H.values.map((N)=>typeof N==="string"?Sb(N):N?Sb(N.toString()):String(N)).join("|")})$`),b._zod.parse=(N,E)=>{let M=N.value;if(Q.has(M))return N;return N.issues.push({code:"invalid_value",values:H.values,input:M,inst:b}),N}}),H4=X("$ZodFile",(b,H)=>{k.init(b,H),b._zod.parse=(Q,N)=>{let E=Q.value;if(E instanceof File)return Q;return Q.issues.push({expected:"file",code:"invalid_type",input:E,inst:b}),Q}}),Q4=X("$ZodTransform",(b,H)=>{k.init(b,H),b._zod.optin="optional",b._zod.parse=(Q,N)=>{if(N.direction==="backward")throw new bQ(b.constructor.name);let E=H.transform(Q.value,Q);if(N.async)return(E instanceof Promise?E:Promise.resolve(E)).then((_)=>{return Q.value=_,Q.fallback=!0,Q});if(E instanceof Promise)throw new ub;return Q.value=E,Q.fallback=!0,Q}});function r9(b,H){if(H===void 0&&(b.issues.length||b.fallback))return{issues:[],value:void 0};return b}var W_=X("$ZodOptional",(b,H)=>{k.init(b,H),b._zod.optin="optional",b._zod.optout="optional",v(b._zod,"values",()=>{return H.innerType._zod.values?new Set([...H.innerType._zod.values,void 0]):void 0}),v(b._zod,"pattern",()=>{let Q=H.innerType._zod.pattern;return Q?new RegExp(`^(${dE(Q.source)})?$`):void 0}),b._zod.parse=(Q,N)=>{if(H.innerType._zod.optin==="optional"){let E=Q.value,M=H.innerType._zod.run(Q,N);if(M instanceof Promise)return M.then((_)=>r9(_,E));return r9(M,E)}if(Q.value===void 0)return Q;return H.innerType._zod.run(Q,N)}}),N4=X("$ZodExactOptional",(b,H)=>{W_.init(b,H),v(b._zod,"values",()=>H.innerType._zod.values),v(b._zod,"pattern",()=>H.innerType._zod.pattern),b._zod.parse=(Q,N)=>{return H.innerType._zod.run(Q,N)}}),E4=X("$ZodNullable",(b,H)=>{k.init(b,H),v(b._zod,"optin",()=>H.innerType._zod.optin),v(b._zod,"optout",()=>H.innerType._zod.optout),v(b._zod,"pattern",()=>{let Q=H.innerType._zod.pattern;return Q?new RegExp(`^(${dE(Q.source)}|null)$`):void 0}),v(b._zod,"values",()=>{return H.innerType._zod.values?new Set([...H.innerType._zod.values,null]):void 0}),b._zod.parse=(Q,N)=>{if(Q.value===null)return Q;return H.innerType._zod.run(Q,N)}}),M4=X("$ZodDefault",(b,H)=>{k.init(b,H),b._zod.optin="optional",v(b._zod,"values",()=>H.innerType._zod.values),b._zod.parse=(Q,N)=>{if(N.direction==="backward")return H.innerType._zod.run(Q,N);if(Q.value===void 0)return Q.value=H.defaultValue,Q;let E=H.innerType._zod.run(Q,N);if(E instanceof Promise)return E.then((M)=>t9(M,H));return t9(E,H)}});function t9(b,H){if(b.value===void 0)b.value=H.defaultValue;return b}var W4=X("$ZodPrefault",(b,H)=>{k.init(b,H),b._zod.optin="optional",v(b._zod,"values",()=>H.innerType._zod.values),b._zod.parse=(Q,N)=>{if(N.direction==="backward")return H.innerType._zod.run(Q,N);if(Q.value===void 0)Q.value=H.defaultValue;return H.innerType._zod.run(Q,N)}}),_4=X("$ZodNonOptional",(b,H)=>{k.init(b,H),v(b._zod,"values",()=>{let Q=H.innerType._zod.values;return Q?new Set([...Q].filter((N)=>N!==void 0)):void 0}),b._zod.parse=(Q,N)=>{let E=H.innerType._zod.run(Q,N);if(E instanceof Promise)return E.then((M)=>s9(M,b));return s9(E,b)}});function s9(b,H){if(!b.issues.length&&b.value===void 0)b.issues.push({code:"invalid_type",expected:"nonoptional",input:b.value,inst:H});return b}var w4=X("$ZodSuccess",(b,H)=>{k.init(b,H),b._zod.parse=(Q,N)=>{if(N.direction==="backward")throw new bQ("ZodSuccess");let E=H.innerType._zod.run(Q,N);if(E instanceof Promise)return E.then((M)=>{return Q.value=M.issues.length===0,Q});return Q.value=E.issues.length===0,Q}}),Y4=X("$ZodCatch",(b,H)=>{k.init(b,H),b._zod.optin="optional",v(b._zod,"optout",()=>H.innerType._zod.optout),v(b._zod,"values",()=>H.innerType._zod.values),b._zod.parse=(Q,N)=>{if(N.direction==="backward")return H.innerType._zod.run(Q,N);let E=H.innerType._zod.run(Q,N);if(E instanceof Promise)return E.then((M)=>{if(Q.value=M.value,M.issues.length)Q.value=H.catchValue({...Q,error:{issues:M.issues.map((_)=>qb(_,N,s()))},input:Q.value}),Q.issues=[],Q.fallback=!0;return Q});if(Q.value=E.value,E.issues.length)Q.value=H.catchValue({...Q,error:{issues:E.issues.map((M)=>qb(M,N,s()))},input:Q.value}),Q.issues=[],Q.fallback=!0;return Q}}),D4=X("$ZodNaN",(b,H)=>{k.init(b,H),b._zod.parse=(Q,N)=>{if(typeof Q.value!=="number"||!Number.isNaN(Q.value))return Q.issues.push({input:Q.value,inst:b,expected:"nan",code:"invalid_type"}),Q;return Q}}),__=X("$ZodPipe",(b,H)=>{k.init(b,H),v(b._zod,"values",()=>H.in._zod.values),v(b._zod,"optin",()=>H.in._zod.optin),v(b._zod,"optout",()=>H.out._zod.optout),v(b._zod,"propValues",()=>H.in._zod.propValues),b._zod.parse=(Q,N)=>{if(N.direction==="backward"){let M=H.out._zod.run(Q,N);if(M instanceof Promise)return M.then((_)=>eW(_,H.in,N));return eW(M,H.in,N)}let E=H.in._zod.run(Q,N);if(E instanceof Promise)return E.then((M)=>eW(M,H.out,N));return eW(E,H.out,N)}});function eW(b,H,Q){if(b.issues.length)return b.aborted=!0,b;return H._zod.run({value:b.value,issues:b.issues,fallback:b.fallback},Q)}var EM=X("$ZodCodec",(b,H)=>{k.init(b,H),v(b._zod,"values",()=>H.in._zod.values),v(b._zod,"optin",()=>H.in._zod.optin),v(b._zod,"optout",()=>H.out._zod.optout),v(b._zod,"propValues",()=>H.in._zod.propValues),b._zod.parse=(Q,N)=>{if((N.direction||"forward")==="forward"){let M=H.in._zod.run(Q,N);if(M instanceof Promise)return M.then((_)=>b_(_,H,N));return b_(M,H,N)}else{let M=H.out._zod.run(Q,N);if(M instanceof Promise)return M.then((_)=>b_(_,H,N));return b_(M,H,N)}}});function b_(b,H,Q){if(b.issues.length)return b.aborted=!0,b;if((Q.direction||"forward")==="forward"){let E=H.transform(b.value,b);if(E instanceof Promise)return E.then((M)=>H_(b,M,H.out,Q));return H_(b,E,H.out,Q)}else{let E=H.reverseTransform(b.value,b);if(E instanceof Promise)return E.then((M)=>H_(b,M,H.in,Q));return H_(b,E,H.in,Q)}}function H_(b,H,Q,N){if(b.issues.length)return b.aborted=!0,b;return Q._zod.run({value:H,issues:b.issues},N)}var J4=X("$ZodPreprocess",(b,H)=>{__.init(b,H)}),B4=X("$ZodReadonly",(b,H)=>{k.init(b,H),v(b._zod,"propValues",()=>H.innerType._zod.propValues),v(b._zod,"values",()=>H.innerType._zod.values),v(b._zod,"optin",()=>H.innerType?._zod?.optin),v(b._zod,"optout",()=>H.innerType?._zod?.optout),b._zod.parse=(Q,N)=>{if(N.direction==="backward")return H.innerType._zod.run(Q,N);let E=H.innerType._zod.run(Q,N);if(E instanceof Promise)return E.then(a9);return a9(E)}});function a9(b){return b.value=Object.freeze(b.value),b}var X4=X("$ZodTemplateLiteral",(b,H)=>{k.init(b,H);let Q=[];for(let N of H.parts)if(typeof N==="object"&&N!==null){if(!N._zod.pattern)throw Error(`Invalid template literal part, no pattern found: ${[...N._zod.traits].shift()}`);let E=N._zod.pattern instanceof RegExp?N._zod.pattern.source:N._zod.pattern;if(!E)throw Error(`Invalid template literal part: ${N._zod.traits}`);let M=E.startsWith("^")?1:0,_=E.endsWith("$")?E.length-1:E.length;Q.push(E.slice(M,_))}else if(N===null||E1.has(typeof N))Q.push(Sb(`${N}`));else throw Error(`Invalid template literal part: ${N}`);b._zod.pattern=new RegExp(`^${Q.join("")}$`),b._zod.parse=(N,E)=>{if(typeof N.value!=="string")return N.issues.push({input:N.value,inst:b,expected:"string",code:"invalid_type"}),N;if(b._zod.pattern.lastIndex=0,!b._zod.pattern.test(N.value))return N.issues.push({input:N.value,inst:b,code:"invalid_format",format:H.format??"template_literal",pattern:b._zod.pattern.source}),N;return N}}),q4=X("$ZodFunction",(b,H)=>{return k.init(b,H),b._def=H,b._zod.def=H,b.implement=(Q)=>{if(typeof Q!=="function")throw Error("implement() must be called with a function");return function(...N){let E=b._def.input?fW(b._def.input,N):N,M=Reflect.apply(Q,this,E);if(b._def.output)return fW(b._def.output,M);return M}},b.implementAsync=(Q)=>{if(typeof Q!=="function")throw Error("implementAsync() must be called with a function");return async function(...N){let E=b._def.input?await lW(b._def.input,N):N,M=await Reflect.apply(Q,this,E);if(b._def.output)return await lW(b._def.output,M);return M}},b._zod.parse=(Q,N)=>{if(typeof Q.value!=="function")return Q.issues.push({code:"invalid_type",expected:"function",input:Q.value,inst:b}),Q;if(b._def.output&&b._def.output._zod.def.type==="promise")Q.value=b.implementAsync(Q.value);else Q.value=b.implement(Q.value);return Q},b.input=(...Q)=>{let N=b.constructor;if(Array.isArray(Q[0]))return new N({type:"function",input:new M_({type:"tuple",items:Q[0],rest:Q[1]}),output:b._def.output});return new N({type:"function",input:Q[0],output:b._def.output})},b.output=(Q)=>{return new b.constructor({type:"function",input:b._def.input,output:Q})},b}),K4=X("$ZodPromise",(b,H)=>{k.init(b,H),b._zod.parse=(Q,N)=>{return Promise.resolve(Q.value).then((E)=>H.innerType._zod.run({value:E,issues:[]},N))}}),G4=X("$ZodLazy",(b,H)=>{k.init(b,H),v(b._zod,"innerType",()=>{let Q=H;if(!Q._cachedInner)Q._cachedInner=H.getter();return Q._cachedInner}),v(b._zod,"pattern",()=>b._zod.innerType?._zod?.pattern),v(b._zod,"propValues",()=>b._zod.innerType?._zod?.propValues),v(b._zod,"optin",()=>b._zod.innerType?._zod?.optin??void 0),v(b._zod,"optout",()=>b._zod.innerType?._zod?.optout??void 0),b._zod.parse=(Q,N)=>{return b._zod.innerType._zod.run(Q,N)}}),O4=X("$ZodCustom",(b,H)=>{i.init(b,H),k.init(b,H),b._zod.parse=(Q,N)=>{return Q},b._zod.check=(Q)=>{let N=Q.value,E=H.fn(N);if(E instanceof Promise)return E.then((M)=>e9(M,Q,N,b));e9(E,Q,N,b);return}});function e9(b,H,Q,N){if(!b){let E={code:"custom",input:Q,inst:N,path:[...N._zod.def.path??[]],continue:!N._zod.def.abort};if(N._zod.def.params)E.params=N._zod.def.params;H.issues.push(pQ(E))}}var WM={};QH(WM,{en:()=>MM});var M7=()=>{let b={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"},map:{unit:"entries",verb:"to have"}};function H(E){return b[E]??null}let Q={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"},N={nan:"NaN"};return(E)=>{switch(E.code){case"invalid_type":{let M=N[E.expected]??E.expected,_=Y1(E.input),Y=N[_]??_;return`Invalid input: expected ${M}, received ${Y}`}case"invalid_value":if(E.values.length===1)return`Invalid input: expected ${yW(E.values[0])}`;return`Invalid option: expected one of ${xW(E.values,"|")}`;case"too_big":{let M=E.inclusive?"<=":"<",_=H(E.origin);if(_)return`Too big: expected ${E.origin??"value"} to have ${M}${E.maximum.toString()} ${_.unit??"elements"}`;return`Too big: expected ${E.origin??"value"} to be ${M}${E.maximum.toString()}`}case"too_small":{let M=E.inclusive?">=":">",_=H(E.origin);if(_)return`Too small: expected ${E.origin} to have ${M}${E.minimum.toString()} ${_.unit}`;return`Too small: expected ${E.origin} to be ${M}${E.minimum.toString()}`}case"invalid_format":{let M=E;if(M.format==="starts_with")return`Invalid string: must start with "${M.prefix}"`;if(M.format==="ends_with")return`Invalid string: must end with "${M.suffix}"`;if(M.format==="includes")return`Invalid string: must include "${M.includes}"`;if(M.format==="regex")return`Invalid string: must match pattern ${M.pattern}`;return`Invalid ${Q[M.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":""}: ${xW(E.keys,", ")}`;case"invalid_key":return`Invalid key in ${E.origin}`;case"invalid_union":if(E.options&&Array.isArray(E.options)&&E.options.length>0)return`Invalid discriminator value. Expected ${E.options.map((_)=>`'${_}'`).join(" | ")}`;return"Invalid input";case"invalid_element":return`Invalid value in ${E.origin}`;default:return"Invalid input"}}};function MM(){return{localeError:M7()}}var M8,A4=Symbol("ZodOutput"),F4=Symbol("ZodInput");class V4{constructor(){this._map=new WeakMap,this._idmap=new Map}add(b,...H){let Q=H[0];if(this._map.set(b,Q),Q&&typeof Q==="object"&&"id"in Q)this._idmap.set(Q.id,b);return this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(b){let H=this._map.get(b);if(H&&typeof H==="object"&&"id"in H)this._idmap.delete(H.id);return this._map.delete(b),this}get(b){let H=b._zod.parent;if(H){let Q={...this.get(H)??{}};delete Q.id;let N={...Q,...this._map.get(b)};return Object.keys(N).length?N:void 0}return this._map.get(b)}has(b){return this._map.has(b)}}function w_(){return new V4}(M8=globalThis).__zod_globalRegistry??(M8.__zod_globalRegistry=w_());var Nb=globalThis.__zod_globalRegistry;function U4(b,H){return new b({type:"string",...U(H)})}function P4(b,H){return new b({type:"string",coerce:!0,...U(H)})}function Y_(b,H){return new b({type:"string",format:"email",check:"string_format",abort:!1,...U(H)})}function _M(b,H){return new b({type:"string",format:"guid",check:"string_format",abort:!1,...U(H)})}function D_(b,H){return new b({type:"string",format:"uuid",check:"string_format",abort:!1,...U(H)})}function J_(b,H){return new b({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...U(H)})}function B_(b,H){return new b({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...U(H)})}function X_(b,H){return new b({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...U(H)})}function wM(b,H){return new b({type:"string",format:"url",check:"string_format",abort:!1,...U(H)})}function q_(b,H){return new b({type:"string",format:"emoji",check:"string_format",abort:!1,...U(H)})}function K_(b,H){return new b({type:"string",format:"nanoid",check:"string_format",abort:!1,...U(H)})}function G_(b,H){return new b({type:"string",format:"cuid",check:"string_format",abort:!1,...U(H)})}function O_(b,H){return new b({type:"string",format:"cuid2",check:"string_format",abort:!1,...U(H)})}function A_(b,H){return new b({type:"string",format:"ulid",check:"string_format",abort:!1,...U(H)})}function F_(b,H){return new b({type:"string",format:"xid",check:"string_format",abort:!1,...U(H)})}function V_(b,H){return new b({type:"string",format:"ksuid",check:"string_format",abort:!1,...U(H)})}function U_(b,H){return new b({type:"string",format:"ipv4",check:"string_format",abort:!1,...U(H)})}function P_(b,H){return new b({type:"string",format:"ipv6",check:"string_format",abort:!1,...U(H)})}function z4(b,H){return new b({type:"string",format:"mac",check:"string_format",abort:!1,...U(H)})}function z_(b,H){return new b({type:"string",format:"cidrv4",check:"string_format",abort:!1,...U(H)})}function I_(b,H){return new b({type:"string",format:"cidrv6",check:"string_format",abort:!1,...U(H)})}function R_(b,H){return new b({type:"string",format:"base64",check:"string_format",abort:!1,...U(H)})}function T_(b,H){return new b({type:"string",format:"base64url",check:"string_format",abort:!1,...U(H)})}function Z_(b,H){return new b({type:"string",format:"e164",check:"string_format",abort:!1,...U(H)})}function j_(b,H){return new b({type:"string",format:"jwt",check:"string_format",abort:!1,...U(H)})}var I4={Any:null,Minute:-1,Second:0,Millisecond:3,Microsecond:6};function R4(b,H){return new b({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...U(H)})}function T4(b,H){return new b({type:"string",format:"date",check:"string_format",...U(H)})}function Z4(b,H){return new b({type:"string",format:"time",check:"string_format",precision:null,...U(H)})}function j4(b,H){return new b({type:"string",format:"duration",check:"string_format",...U(H)})}function L4(b,H){return new b({type:"number",checks:[],...U(H)})}function $4(b,H){return new b({type:"number",coerce:!0,checks:[],...U(H)})}function C4(b,H){return new b({type:"number",check:"number_format",abort:!1,format:"safeint",...U(H)})}function S4(b,H){return new b({type:"number",check:"number_format",abort:!1,format:"float32",...U(H)})}function g4(b,H){return new b({type:"number",check:"number_format",abort:!1,format:"float64",...U(H)})}function k4(b,H){return new b({type:"number",check:"number_format",abort:!1,format:"int32",...U(H)})}function x4(b,H){return new b({type:"number",check:"number_format",abort:!1,format:"uint32",...U(H)})}function v4(b,H){return new b({type:"boolean",...U(H)})}function h4(b,H){return new b({type:"boolean",coerce:!0,...U(H)})}function y4(b,H){return new b({type:"bigint",...U(H)})}function f4(b,H){return new b({type:"bigint",coerce:!0,...U(H)})}function l4(b,H){return new b({type:"bigint",check:"bigint_format",abort:!1,format:"int64",...U(H)})}function u4(b,H){return new b({type:"bigint",check:"bigint_format",abort:!1,format:"uint64",...U(H)})}function c4(b,H){return new b({type:"symbol",...U(H)})}function m4(b,H){return new b({type:"undefined",...U(H)})}function i4(b,H){return new b({type:"null",...U(H)})}function p4(b){return new b({type:"any"})}function d4(b){return new b({type:"unknown"})}function o4(b,H){return new b({type:"never",...U(H)})}function n4(b,H){return new b({type:"void",...U(H)})}function r4(b,H){return new b({type:"date",...U(H)})}function t4(b,H){return new b({type:"date",coerce:!0,...U(H)})}function s4(b,H){return new b({type:"nan",...U(H)})}function cb(b,H){return new tW({check:"less_than",...U(H),value:b,inclusive:!1})}function Ib(b,H){return new tW({check:"less_than",...U(H),value:b,inclusive:!0})}function mb(b,H){return new sW({check:"greater_than",...U(H),value:b,inclusive:!1})}function Kb(b,H){return new sW({check:"greater_than",...U(H),value:b,inclusive:!0})}function L_(b){return mb(0,b)}function $_(b){return cb(0,b)}function C_(b){return Ib(0,b)}function S_(b){return Kb(0,b)}function ZH(b,H){return new m1({check:"multiple_of",...U(H),value:b})}function jH(b,H){return new d1({check:"max_size",...U(H),maximum:b})}function ib(b,H){return new o1({check:"min_size",...U(H),minimum:b})}function EQ(b,H){return new n1({check:"size_equals",...U(H),size:b})}function MQ(b,H){return new r1({check:"max_length",...U(H),maximum:b})}function EH(b,H){return new t1({check:"min_length",...U(H),minimum:b})}function WQ(b,H){return new s1({check:"length_equals",...U(H),length:b})}function sQ(b,H){return new a1({check:"string_format",format:"regex",...U(H),pattern:b})}function aQ(b){return new e1({check:"string_format",format:"lowercase",...U(b)})}function eQ(b){return new bY({check:"string_format",format:"uppercase",...U(b)})}function bN(b,H){return new HY({check:"string_format",format:"includes",...U(H),includes:b})}function HN(b,H){return new QY({check:"string_format",format:"starts_with",...U(H),prefix:b})}function QN(b,H){return new NY({check:"string_format",format:"ends_with",...U(H),suffix:b})}function g_(b,H,Q){return new EY({check:"property",property:b,schema:H,...U(Q)})}function NN(b,H){return new MY({check:"mime_type",mime:b,...U(H)})}function hb(b){return new WY({check:"overwrite",tx:b})}function EN(b){return hb((H)=>H.normalize(b))}function MN(){return hb((b)=>b.trim())}function WN(){return hb((b)=>b.toLowerCase())}function _N(){return hb((b)=>b.toUpperCase())}function wN(){return hb((b)=>H1(b))}function a4(b,H,Q){return new b({type:"array",element:H,...U(Q)})}function _7(b,H,Q){return new b({type:"union",options:H,...U(Q)})}function w7(b,H,Q){return new b({type:"union",options:H,inclusive:!1,...U(Q)})}function Y7(b,H,Q,N){return new b({type:"union",options:Q,discriminator:H,...U(N)})}function D7(b,H,Q){return new b({type:"intersection",left:H,right:Q})}function J7(b,H,Q,N){let E=Q instanceof k;return new b({type:"tuple",items:H,rest:E?Q:null,...U(E?N:Q)})}function B7(b,H,Q,N){return new b({type:"record",keyType:H,valueType:Q,...U(N)})}function X7(b,H,Q,N){return new b({type:"map",keyType:H,valueType:Q,...U(N)})}function q7(b,H,Q){return new b({type:"set",valueType:H,...U(Q)})}function K7(b,H,Q){let N=Array.isArray(H)?Object.fromEntries(H.map((E)=>[E,E])):H;return new b({type:"enum",entries:N,...U(Q)})}function G7(b,H,Q){return new b({type:"enum",entries:H,...U(Q)})}function O7(b,H,Q){return new b({type:"literal",values:Array.isArray(H)?H:[H],...U(Q)})}function e4(b,H){return new b({type:"file",...U(H)})}function A7(b,H){return new b({type:"transform",transform:H})}function F7(b,H){return new b({type:"optional",innerType:H})}function V7(b,H){return new b({type:"nullable",innerType:H})}function U7(b,H,Q){return new b({type:"default",innerType:H,get defaultValue(){return typeof Q==="function"?Q():N1(Q)}})}function P7(b,H,Q){return new b({type:"nonoptional",innerType:H,...U(Q)})}function z7(b,H){return new b({type:"success",innerType:H})}function I7(b,H,Q){return new b({type:"catch",innerType:H,catchValue:typeof Q==="function"?Q:()=>Q})}function R7(b,H,Q){return new b({type:"pipe",in:H,out:Q})}function T7(b,H){return new b({type:"readonly",innerType:H})}function Z7(b,H,Q){return new b({type:"template_literal",parts:H,...U(Q)})}function j7(b,H){return new b({type:"lazy",getter:H})}function L7(b,H){return new b({type:"promise",innerType:H})}function b6(b,H,Q){let N=U(Q);return N.abort??(N.abort=!0),new b({type:"custom",check:"custom",fn:H,...N})}function H6(b,H,Q){return new b({type:"custom",check:"custom",fn:H,...U(Q)})}function Q6(b,H){let Q=W8((N)=>{return N.addIssue=(E)=>{if(typeof E==="string")N.issues.push(pQ(E,N.value,Q._zod.def));else{let M=E;if(M.fatal)M.continue=!1;M.code??(M.code="custom"),M.input??(M.input=N.value),M.inst??(M.inst=Q),M.continue??(M.continue=!Q._zod.def.abort),N.issues.push(pQ(M))}},b(N.value,N)},H);return Q}function W8(b,H){let Q=new i({check:"custom",...U(H)});return Q._zod.check=b,Q}function N6(b){let H=new i({check:"describe"});return H._zod.onattach=[(Q)=>{let N=Nb.get(Q)??{};Nb.add(Q,{...N,description:b})}],H._zod.check=()=>{},H}function E6(b){let H=new i({check:"meta"});return H._zod.onattach=[(Q)=>{let N=Nb.get(Q)??{};Nb.add(Q,{...N,...b})}],H._zod.check=()=>{},H}function M6(b,H){let Q=U(H),N=Q.truthy??["true","1","yes","on","y","enabled"],E=Q.falsy??["false","0","no","off","n","disabled"];if(Q.case!=="sensitive")N=N.map((V)=>typeof V==="string"?V.toLowerCase():V),E=E.map((V)=>typeof V==="string"?V.toLowerCase():V);let M=new Set(N),_=new Set(E),Y=b.Codec??EM,D=b.Boolean??QM,K=new(b.String??NQ)({type:"string",error:Q.error}),O=new D({type:"boolean",error:Q.error}),A=new Y({type:"pipe",in:K,out:O,transform:(V,j)=>{let $=V;if(Q.case!=="sensitive")$=$.toLowerCase();if(M.has($))return!0;else if(_.has($))return!1;else return j.issues.push({code:"invalid_value",expected:"stringbool",values:[...M,..._],input:j.value,inst:A,continue:!1}),{}},reverseTransform:(V,j)=>{if(V===!0)return N[0]||"true";else return E[0]||"false"},error:Q.error});return A}function YN(b,H,Q,N={}){let E=U(N),M={...U(N),check:"string_format",type:"string",format:H,fn:typeof Q==="function"?Q:(Y)=>Q.test(Y),...E};if(Q instanceof RegExp)M.pattern=Q;return new b(M)}function LH(b){let H=b?.target??"draft-2020-12";if(H==="draft-4")H="draft-04";if(H==="draft-7")H="draft-07";return{processors:b.processors??{},metadataRegistry:b?.metadata??Nb,target:H,unrepresentable:b?.unrepresentable??"throw",override:b?.override??(()=>{}),io:b?.io??"output",counter:0,seen:new Map,cycles:b?.cycles??"ref",reused:b?.reused??"inline",external:b?.external??void 0}}function f(b,H,Q={path:[],schemaPath:[]}){var N;let E=b._zod.def,M=H.seen.get(b);if(M){if(M.count++,Q.schemaPath.includes(b))M.cycle=Q.path;return M.schema}let _={schema:{},count:1,cycle:void 0,path:Q.path};H.seen.set(b,_);let Y=b._zod.toJSONSchema?.();if(Y)_.schema=Y;else{let K={...Q,schemaPath:[...Q.schemaPath,b],path:Q.path};if(b._zod.processJSONSchema)b._zod.processJSONSchema(H,_.schema,K);else{let A=_.schema,V=H.processors[E.type];if(!V)throw Error(`[toJSONSchema]: Non-representable type encountered: ${E.type}`);V(b,H,A,K)}let O=b._zod.parent;if(O){if(!_.ref)_.ref=O;f(O,H,K),H.seen.get(O).isParent=!0}}let D=H.metadataRegistry.get(b);if(D)Object.assign(_.schema,D);if(H.io==="input"&&Gb(b))delete _.schema.examples,delete _.schema.default;if(H.io==="input"&&"_prefault"in _.schema)(N=_.schema).default??(N.default=_.schema._prefault);return delete _.schema._prefault,H.seen.get(b).schema}function $H(b,H){let Q=b.seen.get(H);if(!Q)throw Error("Unprocessed schema. This is a bug in Zod.");let N=new Map;for(let _ of b.seen.entries()){let Y=b.metadataRegistry.get(_[0])?.id;if(Y){let D=N.get(Y);if(D&&D!==_[0])throw Error(`Duplicate schema id "${Y}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);N.set(Y,_[0])}}let E=(_)=>{let Y=b.target==="draft-2020-12"?"$defs":"definitions";if(b.external){let O=b.external.registry.get(_[0])?.id,A=b.external.uri??((j)=>j);if(O)return{ref:A(O)};let V=_[1].defId??_[1].schema.id??`schema${b.counter++}`;return _[1].defId=V,{defId:V,ref:`${A("__shared")}#/${Y}/${V}`}}if(_[1]===Q)return{ref:"#"};let J=`${"#"}/${Y}/`,K=_[1].schema.id??`__schema${b.counter++}`;return{defId:K,ref:J+K}},M=(_)=>{if(_[1].schema.$ref)return;let Y=_[1],{ref:D,defId:J}=E(_);if(Y.def={...Y.schema},J)Y.defId=J;let K=Y.schema;for(let O in K)delete K[O];K.$ref=D};if(b.cycles==="throw")for(let _ of b.seen.entries()){let Y=_[1];if(Y.cycle)throw Error(`Cycle detected: #/${Y.cycle?.join("/")}/<root>
62
+ `)}z.write("payload.value = newResult;"),z.write("return payload;");let B=z.compile();return(q,M)=>B(y,q,M)},i,a=mo,u=!ho.jitless,p=u&&vl.value,f=t.catchall,b;e._zod.parse=(y,z)=>{b??(b=r.value);let E=y.value;if(!a(E))return y.issues.push({expected:"object",code:"invalid_type",input:E,inst:e}),y;if(u&&p&&z?.async===!1&&z.jitless!==!0){if(!i)i=n(t.shape);if(y=i(y,z),!f)return y;return fd([],E,y,z,b,e)}return o(y,z)}});function ku(e,t,o,r){for(let i of e)if(i.issues.length===0)return t.value=i.value,t;let n=e.filter((i)=>!Pt(i));if(n.length===1)return t.value=n[0].value,n[0];return t.issues.push({code:"invalid_union",input:t.value,inst:o,errors:e.map((i)=>i.issues.map((a)=>xe(a,r,ce())))}),t}var Ba=m("$ZodUnion",(e,t)=>{N.init(e,t),O(e._zod,"optin",()=>t.options.some((r)=>r._zod.optin==="optional")?"optional":void 0),O(e._zod,"optout",()=>t.options.some((r)=>r._zod.optout==="optional")?"optional":void 0),O(e._zod,"values",()=>{if(t.options.every((r)=>r._zod.values))return new Set(t.options.flatMap((r)=>Array.from(r._zod.values)));return}),O(e._zod,"pattern",()=>{if(t.options.every((r)=>r._zod.pattern)){let r=t.options.map((n)=>n._zod.pattern);return new RegExp(`^(${r.map((n)=>wi(n.source)).join("|")})$`)}return});let o=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(r,n)=>{if(o)return o(r,n);let i=!1,a=[];for(let u of t.options){let d=u._zod.run({value:r.value,issues:[]},n);if(d instanceof Promise)a.push(d),i=!0;else{if(d.issues.length===0)return d;a.push(d)}}if(!i)return ku(a,r,e,n);return Promise.all(a).then((u)=>ku(u,r,e,n))}});var Sd=m("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,Ba.init(e,t);let o=e._zod.parse;O(e._zod,"propValues",()=>{let n={};for(let i of t.options){let a=i._zod.propValues;if(!a||Object.keys(a).length===0)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(i)}"`);for(let[u,d]of Object.entries(a)){if(!n[u])n[u]=new Set;for(let p of d)n[u].add(p)}}return n});let r=Br(()=>{let n=t.options,i=new Map;for(let a of n){let u=a._zod.propValues?.[t.discriminator];if(!u||u.size===0)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(a)}"`);for(let d of u){if(i.has(d))throw Error(`Duplicate discriminator value "${String(d)}"`);i.set(d,a)}}return i});e._zod.parse=(n,i)=>{let a=n.value;if(!mo(a))return n.issues.push({code:"invalid_type",expected:"object",input:a,inst:e}),n;let u=r.value.get(a?.[t.discriminator]);if(u)return u._zod.run(n,i);if(t.unionFallback||i.direction==="backward")return o(n,i);return n.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,options:Array.from(r.value.keys()),input:a,path:[t.discriminator],inst:e}),n}}),_d=m("$ZodIntersection",(e,t)=>{N.init(e,t),e._zod.parse=(o,r)=>{let n=o.value,i=t.left._zod.run({value:n,issues:[]},r),a=t.right._zod.run({value:n,issues:[]},r);if(i instanceof Promise||a instanceof Promise)return Promise.all([i,a]).then(([d,p])=>$u(o,d,p));return $u(o,i,a)}});function Va(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e===+t)return{valid:!0,data:e};if(Et(e)&&Et(t)){let o=Object.keys(t),r=Object.keys(e).filter((i)=>o.indexOf(i)!==-1),n={...e,...t};for(let i of r){let a=Va(e[i],t[i]);if(!a.valid)return{valid:!1,mergeErrorPath:[i,...a.mergeErrorPath]};n[i]=a.data}return{valid:!0,data:n}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let o=[];for(let r=0;r<e.length;r++){let n=e[r],i=t[r],a=Va(n,i);if(!a.valid)return{valid:!1,mergeErrorPath:[r,...a.mergeErrorPath]};o.push(a.data)}return{valid:!0,data:o}}return{valid:!1,mergeErrorPath:[]}}function $u(e,t,o){let r=new Map,n;for(let u of t.issues)if(u.code==="unrecognized_keys"){n??(n=u);for(let d of u.keys){if(!r.has(d))r.set(d,{});r.get(d).l=!0}}else e.issues.push(u);for(let u of o.issues)if(u.code==="unrecognized_keys")for(let d of u.keys){if(!r.has(d))r.set(d,{});r.get(d).r=!0}else e.issues.push(u);let i=[...r].filter(([,u])=>u.l&&u.r).map(([u])=>u);if(i.length&&n)e.issues.push({...n,keys:i});if(Pt(e))return e;let a=Va(t.value,o.value);if(!a.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(a.mergeErrorPath)}`);return e.value=a.data,e}var bd=m("$ZodRecord",(e,t)=>{N.init(e,t),e._zod.parse=(o,r)=>{let n=o.value;if(!Et(n))return o.issues.push({expected:"record",code:"invalid_type",input:n,inst:e}),o;let i=[],a=t.keyType._zod.values;if(a){o.value={};let u=new Set;for(let p of a)if(typeof p==="string"||typeof p==="number"||typeof p==="symbol"){u.add(typeof p==="number"?p.toString():p);let f=t.keyType._zod.run({value:p,issues:[]},r);if(f instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(f.issues.length){o.issues.push({code:"invalid_key",origin:"record",issues:f.issues.map((z)=>xe(z,r,ce())),input:p,path:[p],inst:e});continue}let b=f.value,y=t.valueType._zod.run({value:n[p],issues:[]},r);if(y instanceof Promise)i.push(y.then((z)=>{if(z.issues.length)o.issues.push(...nt(p,z.issues));o.value[b]=z.value}));else{if(y.issues.length)o.issues.push(...nt(p,y.issues));o.value[b]=y.value}}let d;for(let p in n)if(!u.has(p))d=d??[],d.push(p);if(d&&d.length>0)o.issues.push({code:"unrecognized_keys",input:n,inst:e,keys:d})}else{o.value={};for(let u of Reflect.ownKeys(n)){if(u==="__proto__")continue;if(!Object.prototype.propertyIsEnumerable.call(n,u))continue;let d=t.keyType._zod.run({value:u,issues:[]},r);if(d instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(typeof u==="string"&&Za.test(u)&&d.issues.length){let b=t.keyType._zod.run({value:Number(u),issues:[]},r);if(b instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(b.issues.length===0)d=b}if(d.issues.length){if(t.mode==="loose")o.value[u]=n[u];else o.issues.push({code:"invalid_key",origin:"record",issues:d.issues.map((b)=>xe(b,r,ce())),input:u,path:[u],inst:e});continue}let f=t.valueType._zod.run({value:n[u],issues:[]},r);if(f instanceof Promise)i.push(f.then((b)=>{if(b.issues.length)o.issues.push(...nt(u,b.issues));o.value[d.value]=b.value}));else{if(f.issues.length)o.issues.push(...nt(u,f.issues));o.value[d.value]=f.value}}}if(i.length)return Promise.all(i).then(()=>o);return o}});var yd=m("$ZodEnum",(e,t)=>{N.init(e,t);let o=zi(t.entries),r=new Set(o);e._zod.values=r,e._zod.pattern=new RegExp(`^(${o.filter((n)=>zl.has(typeof n)).map((n)=>typeof n==="string"?rt(n):n.toString()).join("|")})$`),e._zod.parse=(n,i)=>{let a=n.value;if(r.has(a))return n;return n.issues.push({code:"invalid_value",values:o,input:a,inst:e}),n}}),vd=m("$ZodLiteral",(e,t)=>{if(N.init(e,t),t.values.length===0)throw Error("Cannot create literal schema with no valid values");let o=new Set(t.values);e._zod.values=o,e._zod.pattern=new RegExp(`^(${t.values.map((r)=>typeof r==="string"?rt(r):r?rt(r.toString()):String(r)).join("|")})$`),e._zod.parse=(r,n)=>{let i=r.value;if(o.has(i))return r;return r.issues.push({code:"invalid_value",values:t.values,input:i,inst:e}),r}});var zd=m("$ZodTransform",(e,t)=>{N.init(e,t),e._zod.optin="optional",e._zod.parse=(o,r)=>{if(r.direction==="backward")throw new Vr(e.constructor.name);let n=t.transform(o.value,o);if(r.async)return(n instanceof Promise?n:Promise.resolve(n)).then((a)=>(o.value=a,o.fallback=!0,o));if(n instanceof Promise)throw new je;return o.value=n,o.fallback=!0,o}});function Cu(e,t){if(t===void 0&&(e.issues.length||e.fallback))return{issues:[],value:void 0};return e}var Wa=m("$ZodOptional",(e,t)=>{N.init(e,t),e._zod.optin="optional",e._zod.optout="optional",O(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),O(e._zod,"pattern",()=>{let o=t.innerType._zod.pattern;return o?new RegExp(`^(${wi(o.source)})?$`):void 0}),e._zod.parse=(o,r)=>{if(t.innerType._zod.optin==="optional"){let n=o.value,i=t.innerType._zod.run(o,r);if(i instanceof Promise)return i.then((a)=>Cu(a,n));return Cu(i,n)}if(o.value===void 0)return o;return t.innerType._zod.run(o,r)}}),Rd=m("$ZodExactOptional",(e,t)=>{Wa.init(e,t),O(e._zod,"values",()=>t.innerType._zod.values),O(e._zod,"pattern",()=>t.innerType._zod.pattern),e._zod.parse=(o,r)=>t.innerType._zod.run(o,r)}),wd=m("$ZodNullable",(e,t)=>{N.init(e,t),O(e._zod,"optin",()=>t.innerType._zod.optin),O(e._zod,"optout",()=>t.innerType._zod.optout),O(e._zod,"pattern",()=>{let o=t.innerType._zod.pattern;return o?new RegExp(`^(${wi(o.source)}|null)$`):void 0}),O(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(o,r)=>{if(o.value===null)return o;return t.innerType._zod.run(o,r)}}),xd=m("$ZodDefault",(e,t)=>{N.init(e,t),e._zod.optin="optional",O(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(o,r)=>{if(r.direction==="backward")return t.innerType._zod.run(o,r);if(o.value===void 0)return o.value=t.defaultValue,o;let n=t.innerType._zod.run(o,r);if(n instanceof Promise)return n.then((i)=>Iu(i,t));return Iu(n,t)}});function Iu(e,t){if(e.value===void 0)e.value=t.defaultValue;return e}var Td=m("$ZodPrefault",(e,t)=>{N.init(e,t),e._zod.optin="optional",O(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(o,r)=>{if(r.direction==="backward")return t.innerType._zod.run(o,r);if(o.value===void 0)o.value=t.defaultValue;return t.innerType._zod.run(o,r)}}),Ed=m("$ZodNonOptional",(e,t)=>{N.init(e,t),O(e._zod,"values",()=>{let o=t.innerType._zod.values;return o?new Set([...o].filter((r)=>r!==void 0)):void 0}),e._zod.parse=(o,r)=>{let n=t.innerType._zod.run(o,r);if(n instanceof Promise)return n.then((i)=>Ou(i,e));return Ou(n,e)}});function Ou(e,t){if(!e.issues.length&&e.value===void 0)e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t});return e}var Pd=m("$ZodCatch",(e,t)=>{N.init(e,t),e._zod.optin="optional",O(e._zod,"optout",()=>t.innerType._zod.optout),O(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(o,r)=>{if(r.direction==="backward")return t.innerType._zod.run(o,r);let n=t.innerType._zod.run(o,r);if(n instanceof Promise)return n.then((i)=>{if(o.value=i.value,i.issues.length)o.value=t.catchValue({...o,error:{issues:i.issues.map((a)=>xe(a,r,ce()))},input:o.value}),o.issues=[],o.fallback=!0;return o});if(o.value=n.value,n.issues.length)o.value=t.catchValue({...o,error:{issues:n.issues.map((i)=>xe(i,r,ce()))},input:o.value}),o.issues=[],o.fallback=!0;return o}});var Ka=m("$ZodPipe",(e,t)=>{N.init(e,t),O(e._zod,"values",()=>t.in._zod.values),O(e._zod,"optin",()=>t.in._zod.optin),O(e._zod,"optout",()=>t.out._zod.optout),O(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(o,r)=>{if(r.direction==="backward"){let i=t.out._zod.run(o,r);if(i instanceof Promise)return i.then((a)=>ki(a,t.in,r));return ki(i,t.in,r)}let n=t.in._zod.run(o,r);if(n instanceof Promise)return n.then((i)=>ki(i,t.out,r));return ki(n,t.out,r)}});function ki(e,t,o){if(e.issues.length)return e.aborted=!0,e;return t._zod.run({value:e.value,issues:e.issues,fallback:e.fallback},o)}var kd=m("$ZodPreprocess",(e,t)=>{Ka.init(e,t)}),$d=m("$ZodReadonly",(e,t)=>{N.init(e,t),O(e._zod,"propValues",()=>t.innerType._zod.propValues),O(e._zod,"values",()=>t.innerType._zod.values),O(e._zod,"optin",()=>t.innerType?._zod?.optin),O(e._zod,"optout",()=>t.innerType?._zod?.optout),e._zod.parse=(o,r)=>{if(r.direction==="backward")return t.innerType._zod.run(o,r);let n=t.innerType._zod.run(o,r);if(n instanceof Promise)return n.then(Mu);return Mu(n)}});function Mu(e){return e.value=Object.freeze(e.value),e}var Cd=m("$ZodLazy",(e,t)=>{N.init(e,t),O(e._zod,"innerType",()=>{let o=t;if(!o._cachedInner)o._cachedInner=t.getter();return o._cachedInner}),O(e._zod,"pattern",()=>e._zod.innerType?._zod?.pattern),O(e._zod,"propValues",()=>e._zod.innerType?._zod?.propValues),O(e._zod,"optin",()=>e._zod.innerType?._zod?.optin??void 0),O(e._zod,"optout",()=>e._zod.innerType?._zod?.optout??void 0),e._zod.parse=(o,r)=>e._zod.innerType._zod.run(o,r)}),Id=m("$ZodCustom",(e,t)=>{X.init(e,t),N.init(e,t),e._zod.parse=(o,r)=>o,e._zod.check=(o)=>{let r=o.value,n=t.fn(r);if(n instanceof Promise)return n.then((i)=>qu(i,o,r,e));qu(n,o,r,e);return}});function qu(e,t,o,r){if(!e){let n={code:"custom",input:o,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};if(r._zod.def.params)n.params=r._zod.def.params;t.issues.push(kt(n))}}var of=()=>{let e={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"},map:{unit:"entries",verb:"to have"}};function t(n){return e[n]??null}let o={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"},r={nan:"NaN"};return(n)=>{switch(n.code){case"invalid_type":{let i=r[n.expected]??n.expected,a=Tl(n.input),u=r[a]??a;return`Invalid input: expected ${i}, received ${u}`}case"invalid_value":if(n.values.length===1)return`Invalid input: expected ${qa(n.values[0])}`;return`Invalid option: expected one of ${Ca(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",a=t(n.origin);if(a)return`Too big: expected ${n.origin??"value"} to have ${i}${n.maximum.toString()} ${a.unit??"elements"}`;return`Too big: expected ${n.origin??"value"} to be ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",a=t(n.origin);if(a)return`Too small: expected ${n.origin} to have ${i}${n.minimum.toString()} ${a.unit}`;return`Too small: expected ${n.origin} to be ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`Invalid string: must start with "${i.prefix}"`;if(i.format==="ends_with")return`Invalid string: must end with "${i.suffix}"`;if(i.format==="includes")return`Invalid string: must include "${i.includes}"`;if(i.format==="regex")return`Invalid string: must match pattern ${i.pattern}`;return`Invalid ${o[i.format]??n.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${n.divisor}`;case"unrecognized_keys":return`Unrecognized key${n.keys.length>1?"s":""}: ${Ca(n.keys,", ")}`;case"invalid_key":return`Invalid key in ${n.origin}`;case"invalid_union":if(n.options&&Array.isArray(n.options)&&n.options.length>0)return`Invalid discriminator value. Expected ${n.options.map((a)=>`'${a}'`).join(" | ")}`;return"Invalid input";case"invalid_element":return`Invalid value in ${n.origin}`;default:return"Invalid input"}}};function Ga(){return{localeError:of()}}var Od,rf=Symbol("ZodOutput"),nf=Symbol("ZodInput");class Md{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){let o=t[0];if(this._map.set(e,o),o&&typeof o==="object"&&"id"in o)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);if(t&&typeof t==="object"&&"id"in t)this._idmap.delete(t.id);return this._map.delete(e),this}get(e){let t=e._zod.parent;if(t){let o={...this.get(t)??{}};delete o.id;let r={...o,...this._map.get(e)};return Object.keys(r).length?r:void 0}return this._map.get(e)}has(e){return this._map.has(e)}}function qd(){return new Md}(Od=globalThis).__zod_globalRegistry??(Od.__zod_globalRegistry=qd());var st=globalThis.__zod_globalRegistry;function Nd(e,t){return new e({type:"string",...w(t)})}function Ya(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...w(t)})}function Qa(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...w(t)})}function Ad(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...w(t)})}function jd(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...w(t)})}function Ld(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...w(t)})}function Ud(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...w(t)})}function Xa(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...w(t)})}function Zd(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...w(t)})}function Dd(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...w(t)})}function Hd(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...w(t)})}function Fd(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...w(t)})}function Vd(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...w(t)})}function Jd(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...w(t)})}function Bd(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...w(t)})}function Wd(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...w(t)})}function Kd(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...w(t)})}function Gd(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...w(t)})}function Yd(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...w(t)})}function Qd(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...w(t)})}function Xd(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...w(t)})}function ep(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...w(t)})}function tp(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...w(t)})}function op(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...w(t)})}function rp(e,t){return new e({type:"string",format:"date",check:"string_format",...w(t)})}function np(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...w(t)})}function sp(e,t){return new e({type:"string",format:"duration",check:"string_format",...w(t)})}function ip(e,t){return new e({type:"number",checks:[],...w(t)})}function ap(e,t){return new e({type:"number",coerce:!0,checks:[],...w(t)})}function cp(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...w(t)})}function lp(e,t){return new e({type:"boolean",...w(t)})}function up(e,t){return new e({type:"undefined",...w(t)})}function dp(e,t){return new e({type:"null",...w(t)})}function pp(e){return new e({type:"any"})}function hp(e){return new e({type:"unknown"})}function mp(e,t){return new e({type:"never",...w(t)})}function Ii(e,t){return new Da({check:"less_than",...w(t),value:e,inclusive:!1})}function Qr(e,t){return new Da({check:"less_than",...w(t),value:e,inclusive:!0})}function Oi(e,t){return new Ha({check:"greater_than",...w(t),value:e,inclusive:!1})}function Xr(e,t){return new Ha({check:"greater_than",...w(t),value:e,inclusive:!0})}function Mi(e,t){return new mu({check:"multiple_of",...w(t),value:e})}function qi(e,t){return new gu({check:"max_length",...w(t),maximum:e})}function fo(e,t){return new Su({check:"min_length",...w(t),minimum:e})}function Ni(e,t){return new _u({check:"length_equals",...w(t),length:e})}function ec(e,t){return new bu({check:"string_format",format:"regex",...w(t),pattern:e})}function tc(e){return new yu({check:"string_format",format:"lowercase",...w(e)})}function oc(e){return new vu({check:"string_format",format:"uppercase",...w(e)})}function rc(e,t){return new zu({check:"string_format",format:"includes",...w(t),includes:e})}function nc(e,t){return new Ru({check:"string_format",format:"starts_with",...w(t),prefix:e})}function sc(e,t){return new wu({check:"string_format",format:"ends_with",...w(t),suffix:e})}function it(e){return new xu({check:"overwrite",tx:e})}function ic(e){return it((t)=>t.normalize(e))}function ac(){return it((e)=>e.trim())}function cc(){return it((e)=>e.toLowerCase())}function lc(){return it((e)=>e.toUpperCase())}function uc(){return it((e)=>yl(e))}function fp(e,t,o){return new e({type:"array",element:t,...w(o)})}function gp(e,t,o){return new e({type:"custom",check:"custom",fn:t,...w(o)})}function Sp(e,t){let o=sf((r)=>(r.addIssue=(n)=>{if(typeof n==="string")r.issues.push(kt(n,r.value,o._zod.def));else{let i=n;if(i.fatal)i.continue=!1;i.code??(i.code="custom"),i.input??(i.input=r.value),i.inst??(i.inst=o),i.continue??(i.continue=!o._zod.def.abort),r.issues.push(kt(i))}},e(r.value,r)),t);return o}function sf(e,t){let o=new X({check:"custom",...w(t)});return o._zod.check=e,o}function tn(e){let t=e?.target??"draft-2020-12";if(t==="draft-4")t="draft-04";if(t==="draft-7")t="draft-07";return{processors:e.processors??{},metadataRegistry:e?.metadata??st,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 j(e,t,o={path:[],schemaPath:[]}){var r;let n=e._zod.def,i=t.seen.get(e);if(i){if(i.count++,o.schemaPath.includes(e))i.cycle=o.path;return i.schema}let a={schema:{},count:1,cycle:void 0,path:o.path};t.seen.set(e,a);let u=e._zod.toJSONSchema?.();if(u)a.schema=u;else{let f={...o,schemaPath:[...o.schemaPath,e],path:o.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,a.schema,f);else{let y=a.schema,z=t.processors[n.type];if(!z)throw Error(`[toJSONSchema]: Non-representable type encountered: ${n.type}`);z(e,t,y,f)}let b=e._zod.parent;if(b){if(!a.ref)a.ref=b;j(b,t,f),t.seen.get(b).isParent=!0}}let d=t.metadataRegistry.get(e);if(d)Object.assign(a.schema,d);if(t.io==="input"&&le(e))delete a.schema.examples,delete a.schema.default;if(t.io==="input"&&"_prefault"in a.schema)(r=a.schema).default??(r.default=a.schema._prefault);return delete a.schema._prefault,t.seen.get(e).schema}function on(e,t){let o=e.seen.get(t);if(!o)throw Error("Unprocessed schema. This is a bug in Zod.");let r=new Map;for(let a of e.seen.entries()){let u=e.metadataRegistry.get(a[0])?.id;if(u){let d=r.get(u);if(d&&d!==a[0])throw Error(`Duplicate schema id "${u}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(u,a[0])}}let n=(a)=>{let u=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){let b=e.external.registry.get(a[0])?.id,y=e.external.uri??((E)=>E);if(b)return{ref:y(b)};let z=a[1].defId??a[1].schema.id??`schema${e.counter++}`;return a[1].defId=z,{defId:z,ref:`${y("__shared")}#/${u}/${z}`}}if(a[1]===o)return{ref:"#"};let p=`${"#"}/${u}/`,f=a[1].schema.id??`__schema${e.counter++}`;return{defId:f,ref:p+f}},i=(a)=>{if(a[1].schema.$ref)return;let u=a[1],{ref:d,defId:p}=n(a);if(u.def={...u.schema},p)u.defId=p;let f=u.schema;for(let b in f)delete f[b];f.$ref=d};if(e.cycles==="throw")for(let a of e.seen.entries()){let u=a[1];if(u.cycle)throw Error(`Cycle detected: #/${u.cycle?.join("/")}/<root>
64
63
 
65
- Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let _ of b.seen.entries()){let Y=_[1];if(H===_[0]){M(_);continue}if(b.external){let J=b.external.registry.get(_[0])?.id;if(H!==_[0]&&J){M(_);continue}}if(b.metadataRegistry.get(_[0])?.id){M(_);continue}if(Y.cycle){M(_);continue}if(Y.count>1){if(b.reused==="ref"){M(_);continue}}}}function CH(b,H){let Q=b.seen.get(H);if(!Q)throw Error("Unprocessed schema. This is a bug in Zod.");let N=(Y)=>{let D=b.seen.get(Y);if(D.ref===null)return;let J=D.def??D.schema,K={...J},O=D.ref;if(D.ref=null,O){N(O);let V=b.seen.get(O),j=V.schema;if(j.$ref&&(b.target==="draft-07"||b.target==="draft-04"||b.target==="openapi-3.0"))J.allOf=J.allOf??[],J.allOf.push(j);else Object.assign(J,j);if(Object.assign(J,K),Y._zod.parent===O)for(let S in J){if(S==="$ref"||S==="allOf")continue;if(!(S in K))delete J[S]}if(j.$ref&&V.def)for(let S in J){if(S==="$ref"||S==="allOf")continue;if(S in V.def&&JSON.stringify(J[S])===JSON.stringify(V.def[S]))delete J[S]}}let A=Y._zod.parent;if(A&&A!==O){N(A);let V=b.seen.get(A);if(V?.schema.$ref){if(J.$ref=V.schema.$ref,V.def)for(let j in J){if(j==="$ref"||j==="allOf")continue;if(j in V.def&&JSON.stringify(J[j])===JSON.stringify(V.def[j]))delete J[j]}}}b.override({zodSchema:Y,jsonSchema:J,path:D.path??[]})};for(let Y of[...b.seen.entries()].reverse())N(Y[0]);let E={};if(b.target==="draft-2020-12")E.$schema="https://json-schema.org/draft/2020-12/schema";else if(b.target==="draft-07")E.$schema="http://json-schema.org/draft-07/schema#";else if(b.target==="draft-04")E.$schema="http://json-schema.org/draft-04/schema#";else if(b.target==="openapi-3.0");if(b.external?.uri){let Y=b.external.registry.get(H)?.id;if(!Y)throw Error("Schema is missing an `id` property");E.$id=b.external.uri(Y)}Object.assign(E,Q.def??Q.schema);let M=b.metadataRegistry.get(H)?.id;if(M!==void 0&&E.id===M)delete E.id;let _=b.external?.defs??{};for(let Y of b.seen.entries()){let D=Y[1];if(D.def&&D.defId){if(D.def.id===D.defId)delete D.def.id;_[D.defId]=D.def}}if(b.external);else if(Object.keys(_).length>0)if(b.target==="draft-2020-12")E.$defs=_;else E.definitions=_;try{let Y=JSON.parse(JSON.stringify(E));return Object.defineProperty(Y,"~standard",{value:{...H["~standard"],jsonSchema:{input:DN(H,"input",b.processors),output:DN(H,"output",b.processors)}},enumerable:!1,writable:!1}),Y}catch(Y){throw Error("Error converting schema to JSON.")}}function Gb(b,H){let Q=H??{seen:new Set};if(Q.seen.has(b))return!1;Q.seen.add(b);let N=b._zod.def;if(N.type==="transform")return!0;if(N.type==="array")return Gb(N.element,Q);if(N.type==="set")return Gb(N.valueType,Q);if(N.type==="lazy")return Gb(N.getter(),Q);if(N.type==="promise"||N.type==="optional"||N.type==="nonoptional"||N.type==="nullable"||N.type==="readonly"||N.type==="default"||N.type==="prefault")return Gb(N.innerType,Q);if(N.type==="intersection")return Gb(N.left,Q)||Gb(N.right,Q);if(N.type==="record"||N.type==="map")return Gb(N.keyType,Q)||Gb(N.valueType,Q);if(N.type==="pipe"){if(b._zod.traits.has("$ZodCodec"))return!0;return Gb(N.in,Q)||Gb(N.out,Q)}if(N.type==="object"){for(let E in N.shape)if(Gb(N.shape[E],Q))return!0;return!1}if(N.type==="union"){for(let E of N.options)if(Gb(E,Q))return!0;return!1}if(N.type==="tuple"){for(let E of N.items)if(Gb(E,Q))return!0;if(N.rest&&Gb(N.rest,Q))return!0;return!1}return!1}var W6=(b,H={})=>(Q)=>{let N=LH({...Q,processors:H});return f(b,N),$H(N,b),CH(N,b)},DN=(b,H,Q={})=>(N)=>{let{libraryOptions:E,target:M}=N??{},_=LH({...E??{},target:M,io:H,processors:Q});return f(b,_),$H(_,b),CH(_,b)};var $7={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},_6=(b,H,Q,N)=>{let E=Q;E.type="string";let{minimum:M,maximum:_,format:Y,patterns:D,contentEncoding:J}=b._zod.bag;if(typeof M==="number")E.minLength=M;if(typeof _==="number")E.maxLength=_;if(Y){if(E.format=$7[Y]??Y,E.format==="")delete E.format;if(Y==="time")delete E.format}if(J)E.contentEncoding=J;if(D&&D.size>0){let K=[...D];if(K.length===1)E.pattern=K[0].source;else if(K.length>1)E.allOf=[...K.map((O)=>({...H.target==="draft-07"||H.target==="draft-04"||H.target==="openapi-3.0"?{type:"string"}:{},pattern:O.source}))]}},w6=(b,H,Q,N)=>{let E=Q,{minimum:M,maximum:_,format:Y,multipleOf:D,exclusiveMaximum:J,exclusiveMinimum:K}=b._zod.bag;if(typeof Y==="string"&&Y.includes("int"))E.type="integer";else E.type="number";let O=typeof K==="number"&&K>=(M??Number.NEGATIVE_INFINITY),A=typeof J==="number"&&J<=(_??Number.POSITIVE_INFINITY),V=H.target==="draft-04"||H.target==="openapi-3.0";if(O)if(V)E.minimum=K,E.exclusiveMinimum=!0;else E.exclusiveMinimum=K;else if(typeof M==="number")E.minimum=M;if(A)if(V)E.maximum=J,E.exclusiveMaximum=!0;else E.exclusiveMaximum=J;else if(typeof _==="number")E.maximum=_;if(typeof D==="number")E.multipleOf=D},Y6=(b,H,Q,N)=>{Q.type="boolean"},D6=(b,H,Q,N)=>{if(H.unrepresentable==="throw")throw Error("BigInt cannot be represented in JSON Schema")},J6=(b,H,Q,N)=>{if(H.unrepresentable==="throw")throw Error("Symbols cannot be represented in JSON Schema")},B6=(b,H,Q,N)=>{if(H.target==="openapi-3.0")Q.type="string",Q.nullable=!0,Q.enum=[null];else Q.type="null"},X6=(b,H,Q,N)=>{if(H.unrepresentable==="throw")throw Error("Undefined cannot be represented in JSON Schema")},q6=(b,H,Q,N)=>{if(H.unrepresentable==="throw")throw Error("Void cannot be represented in JSON Schema")},K6=(b,H,Q,N)=>{Q.not={}},G6=(b,H,Q,N)=>{},O6=(b,H,Q,N)=>{},A6=(b,H,Q,N)=>{if(H.unrepresentable==="throw")throw Error("Date cannot be represented in JSON Schema")},F6=(b,H,Q,N)=>{let E=b._zod.def,M=pE(E.entries);if(M.every((_)=>typeof _==="number"))Q.type="number";if(M.every((_)=>typeof _==="string"))Q.type="string";Q.enum=M},V6=(b,H,Q,N)=>{let E=b._zod.def,M=[];for(let _ of E.values)if(_===void 0){if(H.unrepresentable==="throw")throw Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof _==="bigint")if(H.unrepresentable==="throw")throw Error("BigInt literals cannot be represented in JSON Schema");else M.push(Number(_));else M.push(_);if(M.length===0);else if(M.length===1){let _=M[0];if(Q.type=_===null?"null":typeof _,H.target==="draft-04"||H.target==="openapi-3.0")Q.enum=[_];else Q.const=_}else{if(M.every((_)=>typeof _==="number"))Q.type="number";if(M.every((_)=>typeof _==="string"))Q.type="string";if(M.every((_)=>typeof _==="boolean"))Q.type="boolean";if(M.every((_)=>_===null))Q.type="null";Q.enum=M}},U6=(b,H,Q,N)=>{if(H.unrepresentable==="throw")throw Error("NaN cannot be represented in JSON Schema")},P6=(b,H,Q,N)=>{let E=Q,M=b._zod.pattern;if(!M)throw Error("Pattern not found in template literal");E.type="string",E.pattern=M.source},z6=(b,H,Q,N)=>{let E=Q,M={type:"string",format:"binary",contentEncoding:"binary"},{minimum:_,maximum:Y,mime:D}=b._zod.bag;if(_!==void 0)M.minLength=_;if(Y!==void 0)M.maxLength=Y;if(D)if(D.length===1)M.contentMediaType=D[0],Object.assign(E,M);else Object.assign(E,M),E.anyOf=D.map((J)=>({contentMediaType:J}));else Object.assign(E,M)},I6=(b,H,Q,N)=>{Q.type="boolean"},R6=(b,H,Q,N)=>{if(H.unrepresentable==="throw")throw Error("Custom types cannot be represented in JSON Schema")},T6=(b,H,Q,N)=>{if(H.unrepresentable==="throw")throw Error("Function types cannot be represented in JSON Schema")},Z6=(b,H,Q,N)=>{if(H.unrepresentable==="throw")throw Error("Transforms cannot be represented in JSON Schema")},j6=(b,H,Q,N)=>{if(H.unrepresentable==="throw")throw Error("Map cannot be represented in JSON Schema")},L6=(b,H,Q,N)=>{if(H.unrepresentable==="throw")throw Error("Set cannot be represented in JSON Schema")},$6=(b,H,Q,N)=>{let E=Q,M=b._zod.def,{minimum:_,maximum:Y}=b._zod.bag;if(typeof _==="number")E.minItems=_;if(typeof Y==="number")E.maxItems=Y;E.type="array",E.items=f(M.element,H,{...N,path:[...N.path,"items"]})},C6=(b,H,Q,N)=>{let E=Q,M=b._zod.def;E.type="object",E.properties={};let _=M.shape;for(let J in _)E.properties[J]=f(_[J],H,{...N,path:[...N.path,"properties",J]});let Y=new Set(Object.keys(_)),D=new Set([...Y].filter((J)=>{let K=M.shape[J]._zod;if(H.io==="input")return K.optin===void 0;else return K.optout===void 0}));if(D.size>0)E.required=Array.from(D);if(M.catchall?._zod.def.type==="never")E.additionalProperties=!1;else if(!M.catchall){if(H.io==="output")E.additionalProperties=!1}else if(M.catchall)E.additionalProperties=f(M.catchall,H,{...N,path:[...N.path,"additionalProperties"]})},x_=(b,H,Q,N)=>{let E=b._zod.def,M=E.inclusive===!1,_=E.options.map((Y,D)=>f(Y,H,{...N,path:[...N.path,M?"oneOf":"anyOf",D]}));if(M)Q.oneOf=_;else Q.anyOf=_},S6=(b,H,Q,N)=>{let E=b._zod.def,M=f(E.left,H,{...N,path:[...N.path,"allOf",0]}),_=f(E.right,H,{...N,path:[...N.path,"allOf",1]}),Y=(J)=>("allOf"in J)&&Object.keys(J).length===1,D=[...Y(M)?M.allOf:[M],...Y(_)?_.allOf:[_]];Q.allOf=D},g6=(b,H,Q,N)=>{let E=Q,M=b._zod.def;E.type="array";let _=H.target==="draft-2020-12"?"prefixItems":"items",Y=H.target==="draft-2020-12"?"items":H.target==="openapi-3.0"?"items":"additionalItems",D=M.items.map((A,V)=>f(A,H,{...N,path:[...N.path,_,V]})),J=M.rest?f(M.rest,H,{...N,path:[...N.path,Y,...H.target==="openapi-3.0"?[M.items.length]:[]]}):null;if(H.target==="draft-2020-12"){if(E.prefixItems=D,J)E.items=J}else if(H.target==="openapi-3.0"){if(E.items={anyOf:D},J)E.items.anyOf.push(J);if(E.minItems=D.length,!J)E.maxItems=D.length}else if(E.items=D,J)E.additionalItems=J;let{minimum:K,maximum:O}=b._zod.bag;if(typeof K==="number")E.minItems=K;if(typeof O==="number")E.maxItems=O},k6=(b,H,Q,N)=>{let E=Q,M=b._zod.def;E.type="object";let _=M.keyType,D=_._zod.bag?.patterns;if(M.mode==="loose"&&D&&D.size>0){let K=f(M.valueType,H,{...N,path:[...N.path,"patternProperties","*"]});E.patternProperties={};for(let O of D)E.patternProperties[O.source]=K}else{if(H.target==="draft-07"||H.target==="draft-2020-12")E.propertyNames=f(M.keyType,H,{...N,path:[...N.path,"propertyNames"]});E.additionalProperties=f(M.valueType,H,{...N,path:[...N.path,"additionalProperties"]})}let J=_._zod.values;if(J){let K=[...J].filter((O)=>typeof O==="string"||typeof O==="number");if(K.length>0)E.required=K}},x6=(b,H,Q,N)=>{let E=b._zod.def,M=f(E.innerType,H,N),_=H.seen.get(b);if(H.target==="openapi-3.0")_.ref=E.innerType,Q.nullable=!0;else Q.anyOf=[M,{type:"null"}]},v6=(b,H,Q,N)=>{let E=b._zod.def;f(E.innerType,H,N);let M=H.seen.get(b);M.ref=E.innerType},h6=(b,H,Q,N)=>{let E=b._zod.def;f(E.innerType,H,N);let M=H.seen.get(b);M.ref=E.innerType,Q.default=JSON.parse(JSON.stringify(E.defaultValue))},y6=(b,H,Q,N)=>{let E=b._zod.def;f(E.innerType,H,N);let M=H.seen.get(b);if(M.ref=E.innerType,H.io==="input")Q._prefault=JSON.parse(JSON.stringify(E.defaultValue))},f6=(b,H,Q,N)=>{let E=b._zod.def;f(E.innerType,H,N);let M=H.seen.get(b);M.ref=E.innerType;let _;try{_=E.catchValue(void 0)}catch{throw Error("Dynamic catch values are not supported in JSON Schema")}Q.default=_},l6=(b,H,Q,N)=>{let E=b._zod.def,M=E.in._zod.traits.has("$ZodTransform"),_=H.io==="input"?M?E.out:E.in:E.out;f(_,H,N);let Y=H.seen.get(b);Y.ref=_},u6=(b,H,Q,N)=>{let E=b._zod.def;f(E.innerType,H,N);let M=H.seen.get(b);M.ref=E.innerType,Q.readOnly=!0},c6=(b,H,Q,N)=>{let E=b._zod.def;f(E.innerType,H,N);let M=H.seen.get(b);M.ref=E.innerType},v_=(b,H,Q,N)=>{let E=b._zod.def;f(E.innerType,H,N);let M=H.seen.get(b);M.ref=E.innerType},m6=(b,H,Q,N)=>{let E=b._zod.innerType;f(E,H,N);let M=H.seen.get(b);M.ref=E},k_={string:_6,number:w6,boolean:Y6,bigint:D6,symbol:J6,null:B6,undefined:X6,void:q6,never:K6,any:G6,unknown:O6,date:A6,enum:F6,literal:V6,nan:U6,template_literal:P6,file:z6,success:I6,custom:R6,function:T6,transform:Z6,map:j6,set:L6,array:$6,object:C6,union:x_,intersection:S6,tuple:g6,record:k6,nullable:x6,nonoptional:v6,default:h6,prefault:y6,catch:f6,pipe:l6,readonly:u6,promise:c6,optional:v_,lazy:m6};function _Q(b,H){if("_idmap"in b){let N=b,E=LH({...H,processors:k_}),M={};for(let D of N._idmap.entries()){let[J,K]=D;f(K,E)}let _={},Y={registry:N,uri:H?.uri,defs:M};E.external=Y;for(let D of N._idmap.entries()){let[J,K]=D;$H(E,K),_[J]=CH(E,K)}if(Object.keys(M).length>0){let D=E.target==="draft-2020-12"?"$defs":"definitions";_.__shared={[D]:M}}return{schemas:_}}let Q=LH({...H,processors:k_});return f(b,Q),$H(Q,b),CH(Q,b)}class i6{get metadataRegistry(){return this.ctx.metadataRegistry}get target(){return this.ctx.target}get unrepresentable(){return this.ctx.unrepresentable}get override(){return this.ctx.override}get io(){return this.ctx.io}get counter(){return this.ctx.counter}set counter(b){this.ctx.counter=b}get seen(){return this.ctx.seen}constructor(b){let H=b?.target??"draft-2020-12";if(H==="draft-4")H="draft-04";if(H==="draft-7")H="draft-07";this.ctx=LH({processors:k_,target:H,...b?.metadata&&{metadata:b.metadata},...b?.unrepresentable&&{unrepresentable:b.unrepresentable},...b?.override&&{override:b.override},...b?.io&&{io:b.io}})}process(b,H={path:[],schemaPath:[]}){return f(b,this.ctx,H)}emit(b,H){if(H){if(H.cycles)this.ctx.cycles=H.cycles;if(H.reused)this.ctx.reused=H.reused;if(H.external)this.ctx.external=H.external}$H(this.ctx,b);let Q=CH(this.ctx,b),{"~standard":N,...E}=Q;return E}}var _8={};var YM={};QH(YM,{xor:()=>r8,xid:()=>U8,void:()=>p8,uuidv7:()=>q8,uuidv6:()=>X8,uuidv4:()=>B8,uuid:()=>J8,url:()=>qN,unknown:()=>T,union:()=>R,undefined:()=>i8,ulid:()=>V8,uint64:()=>c8,uint32:()=>f8,tuple:()=>FD,transform:()=>Jw,templateLiteral:()=>_J,symbol:()=>m8,superRefine:()=>pD,success:()=>NJ,stringbool:()=>KJ,stringFormat:()=>S8,string:()=>w,strictObject:()=>n8,set:()=>e8,refine:()=>iD,record:()=>P,readonly:()=>fD,promise:()=>wJ,preprocess:()=>WH,prefault:()=>CD,pipe:()=>m_,partialRecord:()=>t8,optional:()=>Z,object:()=>B,number:()=>F,nullish:()=>QJ,nullable:()=>BM,null:()=>db,nonoptional:()=>SD,never:()=>Dw,nativeEnum:()=>bJ,nanoid:()=>O8,nan:()=>EJ,meta:()=>XJ,map:()=>a8,mac:()=>I8,looseRecord:()=>s8,looseObject:()=>L,literal:()=>G,lazy:()=>gH,ksuid:()=>P8,keyof:()=>o8,jwt:()=>C8,json:()=>GJ,ipv6:()=>R8,ipv4:()=>z8,invertCodec:()=>WJ,intersection:()=>yb,int64:()=>u8,int32:()=>y8,int:()=>c_,instanceof:()=>qJ,httpUrl:()=>K8,hostname:()=>g8,hex:()=>k8,hash:()=>x8,guid:()=>D8,function:()=>YJ,float64:()=>h8,float32:()=>v8,file:()=>HJ,exactOptional:()=>TD,enum:()=>C,emoji:()=>G8,email:()=>d_,e164:()=>$8,discriminatedUnion:()=>SH,describe:()=>BJ,date:()=>d8,custom:()=>JJ,cuid2:()=>F8,cuid:()=>A8,codec:()=>MJ,cidrv6:()=>Z8,cidrv4:()=>T8,check:()=>DJ,catch:()=>xD,boolean:()=>z,bigint:()=>l8,base64url:()=>L8,base64:()=>j8,array:()=>q,any:()=>Yw,_function:()=>YJ,_default:()=>LD,_ZodString:()=>i_,ZodXor:()=>KD,ZodXID:()=>a_,ZodVoid:()=>XD,ZodUnknown:()=>JD,ZodUnion:()=>OM,ZodUndefined:()=>wD,ZodUUID:()=>pb,ZodURL:()=>qM,ZodULID:()=>s_,ZodType:()=>x,ZodTuple:()=>AD,ZodTransform:()=>ID,ZodTemplateLiteral:()=>lD,ZodSymbol:()=>_D,ZodSuccess:()=>gD,ZodStringFormat:()=>c,ZodString:()=>XN,ZodSet:()=>UD,ZodRecord:()=>JN,ZodReadonly:()=>yD,ZodPromise:()=>cD,ZodPreprocess:()=>hD,ZodPrefault:()=>$D,ZodPipe:()=>AM,ZodOptional:()=>Bw,ZodObject:()=>GM,ZodNumberFormat:()=>wQ,ZodNumber:()=>GN,ZodNullable:()=>ZD,ZodNull:()=>YD,ZodNonOptional:()=>Xw,ZodNever:()=>BD,ZodNanoID:()=>n_,ZodNaN:()=>vD,ZodMap:()=>VD,ZodMAC:()=>WD,ZodLiteral:()=>PD,ZodLazy:()=>uD,ZodKSUID:()=>e_,ZodJWT:()=>_w,ZodIntersection:()=>OD,ZodIPv6:()=>Hw,ZodIPv4:()=>bw,ZodGUID:()=>JM,ZodFunction:()=>mD,ZodFile:()=>zD,ZodExactOptional:()=>RD,ZodEnum:()=>BN,ZodEmoji:()=>o_,ZodEmail:()=>p_,ZodE164:()=>Ww,ZodDiscriminatedUnion:()=>GD,ZodDefault:()=>jD,ZodDate:()=>KM,ZodCustomStringFormat:()=>KN,ZodCustom:()=>VM,ZodCodec:()=>FM,ZodCatch:()=>kD,ZodCUID2:()=>t_,ZodCUID:()=>r_,ZodCIDRv6:()=>Nw,ZodCIDRv4:()=>Qw,ZodBoolean:()=>ON,ZodBigIntFormat:()=>ww,ZodBigInt:()=>AN,ZodBase64URL:()=>Mw,ZodBase64:()=>Ew,ZodArray:()=>qD,ZodAny:()=>DD});var h_={};QH(h_,{uppercase:()=>eQ,trim:()=>MN,toUpperCase:()=>_N,toLowerCase:()=>WN,startsWith:()=>HN,slugify:()=>wN,size:()=>EQ,regex:()=>sQ,property:()=>g_,positive:()=>L_,overwrite:()=>hb,normalize:()=>EN,nonpositive:()=>C_,nonnegative:()=>S_,negative:()=>$_,multipleOf:()=>ZH,minSize:()=>ib,minLength:()=>EH,mime:()=>NN,maxSize:()=>jH,maxLength:()=>MQ,lte:()=>Ib,lt:()=>cb,lowercase:()=>aQ,length:()=>WQ,includes:()=>bN,gte:()=>Kb,gt:()=>mb,endsWith:()=>QN});var Rb={};QH(Rb,{time:()=>o6,duration:()=>n6,datetime:()=>p6,date:()=>d6,ZodISOTime:()=>l_,ZodISODuration:()=>u_,ZodISODateTime:()=>y_,ZodISODate:()=>f_});var y_=X("ZodISODateTime",(b,H)=>{VY.init(b,H),c.init(b,H)});function p6(b){return R4(y_,b)}var f_=X("ZodISODate",(b,H)=>{UY.init(b,H),c.init(b,H)});function d6(b){return T4(f_,b)}var l_=X("ZodISOTime",(b,H)=>{PY.init(b,H),c.init(b,H)});function o6(b){return Z4(l_,b)}var u_=X("ZodISODuration",(b,H)=>{zY.init(b,H),c.init(b,H)});function n6(b){return j4(u_,b)}var w8=(b,H)=>{tE.init(b,H),b.name="ZodError",Object.defineProperties(b,{format:{value:(Q)=>aE(b,Q)},flatten:{value:(Q)=>sE(b,Q)},addIssue:{value:(Q)=>{b.issues.push(Q),b.message=JSON.stringify(b.issues,mQ,2)}},addIssues:{value:(Q)=>{b.issues.push(...Q),b.message=JSON.stringify(b.issues,mQ,2)}},isEmpty:{get(){return b.issues.length===0}}})},S7=X("ZodError",w8),Vb=X("ZodError",w8,{Parent:Error});var r6=dQ(Vb),t6=oQ(Vb),DM=nQ(Vb),s6=rQ(Vb),a6=uW(Vb),e6=cW(Vb),bD=mW(Vb),HD=iW(Vb),QD=pW(Vb),ND=dW(Vb),ED=oW(Vb),MD=nW(Vb);var Y8=new WeakMap;function XM(b,H,Q){let N=Object.getPrototypeOf(b),E=Y8.get(N);if(!E)E=new Set,Y8.set(N,E);if(E.has(H))return;E.add(H);for(let M in Q){let _=Q[M];Object.defineProperty(N,M,{configurable:!0,enumerable:!1,get(){let Y=_.bind(this);return Object.defineProperty(this,M,{configurable:!0,writable:!0,enumerable:!0,value:Y}),Y},set(Y){Object.defineProperty(this,M,{configurable:!0,writable:!0,enumerable:!0,value:Y})}})}}var x=X("ZodType",(b,H)=>{return k.init(b,H),Object.assign(b["~standard"],{jsonSchema:{input:DN(b,"input"),output:DN(b,"output")}}),b.toJSONSchema=W6(b,{}),b.def=H,b.type=H.type,Object.defineProperty(b,"_def",{value:H}),b.parse=(Q,N)=>r6(b,Q,N,{callee:b.parse}),b.safeParse=(Q,N)=>DM(b,Q,N),b.parseAsync=async(Q,N)=>t6(b,Q,N,{callee:b.parseAsync}),b.safeParseAsync=async(Q,N)=>s6(b,Q,N),b.spa=b.safeParseAsync,b.encode=(Q,N)=>a6(b,Q,N),b.decode=(Q,N)=>e6(b,Q,N),b.encodeAsync=async(Q,N)=>bD(b,Q,N),b.decodeAsync=async(Q,N)=>HD(b,Q,N),b.safeEncode=(Q,N)=>QD(b,Q,N),b.safeDecode=(Q,N)=>ND(b,Q,N),b.safeEncodeAsync=async(Q,N)=>ED(b,Q,N),b.safeDecodeAsync=async(Q,N)=>MD(b,Q,N),XM(b,"ZodType",{check(...Q){let N=this.def;return this.clone(g.mergeDefs(N,{checks:[...N.checks??[],...Q.map((E)=>typeof E==="function"?{_zod:{check:E,def:{check:"custom"},onattach:[]}}:E)]}),{parent:!0})},with(...Q){return this.check(...Q)},clone(Q,N){return Xb(this,Q,N)},brand(){return this},register(Q,N){return Q.add(this,N),this},refine(Q,N){return this.check(iD(Q,N))},superRefine(Q,N){return this.check(pD(Q,N))},overwrite(Q){return this.check(hb(Q))},optional(){return Z(this)},exactOptional(){return TD(this)},nullable(){return BM(this)},nullish(){return Z(BM(this))},nonoptional(Q){return SD(this,Q)},array(){return q(this)},or(Q){return R([this,Q])},and(Q){return yb(this,Q)},transform(Q){return m_(this,Jw(Q))},default(Q){return LD(this,Q)},prefault(Q){return CD(this,Q)},catch(Q){return xD(this,Q)},pipe(Q){return m_(this,Q)},readonly(){return fD(this)},describe(Q){let N=this.clone();return Nb.add(N,{description:Q}),N},meta(...Q){if(Q.length===0)return Nb.get(this);let N=this.clone();return Nb.add(N,Q[0]),N},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(Q){return Q(this)}}),Object.defineProperty(b,"description",{get(){return Nb.get(b)?.description},configurable:!0}),b}),i_=X("_ZodString",(b,H)=>{NQ.init(b,H),x.init(b,H),b._zod.processJSONSchema=(N,E,M)=>_6(b,N,E,M);let Q=b._zod.bag;b.format=Q.format??null,b.minLength=Q.minimum??null,b.maxLength=Q.maximum??null,XM(b,"_ZodString",{regex(...N){return this.check(sQ(...N))},includes(...N){return this.check(bN(...N))},startsWith(...N){return this.check(HN(...N))},endsWith(...N){return this.check(QN(...N))},min(...N){return this.check(EH(...N))},max(...N){return this.check(MQ(...N))},length(...N){return this.check(WQ(...N))},nonempty(...N){return this.check(EH(1,...N))},lowercase(N){return this.check(aQ(N))},uppercase(N){return this.check(eQ(N))},trim(){return this.check(MN())},normalize(...N){return this.check(EN(...N))},toLowerCase(){return this.check(WN())},toUpperCase(){return this.check(_N())},slugify(){return this.check(wN())}})}),XN=X("ZodString",(b,H)=>{NQ.init(b,H),i_.init(b,H),b.email=(Q)=>b.check(Y_(p_,Q)),b.url=(Q)=>b.check(wM(qM,Q)),b.jwt=(Q)=>b.check(j_(_w,Q)),b.emoji=(Q)=>b.check(q_(o_,Q)),b.guid=(Q)=>b.check(_M(JM,Q)),b.uuid=(Q)=>b.check(D_(pb,Q)),b.uuidv4=(Q)=>b.check(J_(pb,Q)),b.uuidv6=(Q)=>b.check(B_(pb,Q)),b.uuidv7=(Q)=>b.check(X_(pb,Q)),b.nanoid=(Q)=>b.check(K_(n_,Q)),b.guid=(Q)=>b.check(_M(JM,Q)),b.cuid=(Q)=>b.check(G_(r_,Q)),b.cuid2=(Q)=>b.check(O_(t_,Q)),b.ulid=(Q)=>b.check(A_(s_,Q)),b.base64=(Q)=>b.check(R_(Ew,Q)),b.base64url=(Q)=>b.check(T_(Mw,Q)),b.xid=(Q)=>b.check(F_(a_,Q)),b.ksuid=(Q)=>b.check(V_(e_,Q)),b.ipv4=(Q)=>b.check(U_(bw,Q)),b.ipv6=(Q)=>b.check(P_(Hw,Q)),b.cidrv4=(Q)=>b.check(z_(Qw,Q)),b.cidrv6=(Q)=>b.check(I_(Nw,Q)),b.e164=(Q)=>b.check(Z_(Ww,Q)),b.datetime=(Q)=>b.check(p6(Q)),b.date=(Q)=>b.check(d6(Q)),b.time=(Q)=>b.check(o6(Q)),b.duration=(Q)=>b.check(n6(Q))});function w(b){return U4(XN,b)}var c=X("ZodStringFormat",(b,H)=>{u.init(b,H),i_.init(b,H)}),p_=X("ZodEmail",(b,H)=>{JY.init(b,H),c.init(b,H)});function d_(b){return Y_(p_,b)}var JM=X("ZodGUID",(b,H)=>{YY.init(b,H),c.init(b,H)});function D8(b){return _M(JM,b)}var pb=X("ZodUUID",(b,H)=>{DY.init(b,H),c.init(b,H)});function J8(b){return D_(pb,b)}function B8(b){return J_(pb,b)}function X8(b){return B_(pb,b)}function q8(b){return X_(pb,b)}var qM=X("ZodURL",(b,H)=>{BY.init(b,H),c.init(b,H)});function qN(b){return wM(qM,b)}function K8(b){return wM(qM,{protocol:zb.httpProtocol,hostname:zb.domain,...g.normalizeParams(b)})}var o_=X("ZodEmoji",(b,H)=>{XY.init(b,H),c.init(b,H)});function G8(b){return q_(o_,b)}var n_=X("ZodNanoID",(b,H)=>{qY.init(b,H),c.init(b,H)});function O8(b){return K_(n_,b)}var r_=X("ZodCUID",(b,H)=>{KY.init(b,H),c.init(b,H)});function A8(b){return G_(r_,b)}var t_=X("ZodCUID2",(b,H)=>{GY.init(b,H),c.init(b,H)});function F8(b){return O_(t_,b)}var s_=X("ZodULID",(b,H)=>{OY.init(b,H),c.init(b,H)});function V8(b){return A_(s_,b)}var a_=X("ZodXID",(b,H)=>{AY.init(b,H),c.init(b,H)});function U8(b){return F_(a_,b)}var e_=X("ZodKSUID",(b,H)=>{FY.init(b,H),c.init(b,H)});function P8(b){return V_(e_,b)}var bw=X("ZodIPv4",(b,H)=>{IY.init(b,H),c.init(b,H)});function z8(b){return U_(bw,b)}var WD=X("ZodMAC",(b,H)=>{TY.init(b,H),c.init(b,H)});function I8(b){return z4(WD,b)}var Hw=X("ZodIPv6",(b,H)=>{RY.init(b,H),c.init(b,H)});function R8(b){return P_(Hw,b)}var Qw=X("ZodCIDRv4",(b,H)=>{ZY.init(b,H),c.init(b,H)});function T8(b){return z_(Qw,b)}var Nw=X("ZodCIDRv6",(b,H)=>{jY.init(b,H),c.init(b,H)});function Z8(b){return I_(Nw,b)}var Ew=X("ZodBase64",(b,H)=>{$Y.init(b,H),c.init(b,H)});function j8(b){return R_(Ew,b)}var Mw=X("ZodBase64URL",(b,H)=>{CY.init(b,H),c.init(b,H)});function L8(b){return T_(Mw,b)}var Ww=X("ZodE164",(b,H)=>{SY.init(b,H),c.init(b,H)});function $8(b){return Z_(Ww,b)}var _w=X("ZodJWT",(b,H)=>{gY.init(b,H),c.init(b,H)});function C8(b){return j_(_w,b)}var KN=X("ZodCustomStringFormat",(b,H)=>{kY.init(b,H),c.init(b,H)});function S8(b,H,Q={}){return YN(KN,b,H,Q)}function g8(b){return YN(KN,"hostname",zb.hostname,b)}function k8(b){return YN(KN,"hex",zb.hex,b)}function x8(b,H){let Q=H?.enc??"hex",N=`${b}_${Q}`,E=zb[N];if(!E)throw Error(`Unrecognized hash format: ${N}`);return YN(KN,N,E,H)}var GN=X("ZodNumber",(b,H)=>{N_.init(b,H),x.init(b,H),b._zod.processJSONSchema=(N,E,M)=>w6(b,N,E,M),XM(b,"ZodNumber",{gt(N,E){return this.check(mb(N,E))},gte(N,E){return this.check(Kb(N,E))},min(N,E){return this.check(Kb(N,E))},lt(N,E){return this.check(cb(N,E))},lte(N,E){return this.check(Ib(N,E))},max(N,E){return this.check(Ib(N,E))},int(N){return this.check(c_(N))},safe(N){return this.check(c_(N))},positive(N){return this.check(mb(0,N))},nonnegative(N){return this.check(Kb(0,N))},negative(N){return this.check(cb(0,N))},nonpositive(N){return this.check(Ib(0,N))},multipleOf(N,E){return this.check(ZH(N,E))},step(N,E){return this.check(ZH(N,E))},finite(){return this}});let Q=b._zod.bag;b.minValue=Math.max(Q.minimum??Number.NEGATIVE_INFINITY,Q.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,b.maxValue=Math.min(Q.maximum??Number.POSITIVE_INFINITY,Q.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,b.isInt=(Q.format??"").includes("int")||Number.isSafeInteger(Q.multipleOf??0.5),b.isFinite=!0,b.format=Q.format??null});function F(b){return L4(GN,b)}var wQ=X("ZodNumberFormat",(b,H)=>{xY.init(b,H),GN.init(b,H)});function c_(b){return C4(wQ,b)}function v8(b){return S4(wQ,b)}function h8(b){return g4(wQ,b)}function y8(b){return k4(wQ,b)}function f8(b){return x4(wQ,b)}var ON=X("ZodBoolean",(b,H)=>{QM.init(b,H),x.init(b,H),b._zod.processJSONSchema=(Q,N,E)=>Y6(b,Q,N,E)});function z(b){return v4(ON,b)}var AN=X("ZodBigInt",(b,H)=>{E_.init(b,H),x.init(b,H),b._zod.processJSONSchema=(N,E,M)=>D6(b,N,E,M),b.gte=(N,E)=>b.check(Kb(N,E)),b.min=(N,E)=>b.check(Kb(N,E)),b.gt=(N,E)=>b.check(mb(N,E)),b.gte=(N,E)=>b.check(Kb(N,E)),b.min=(N,E)=>b.check(Kb(N,E)),b.lt=(N,E)=>b.check(cb(N,E)),b.lte=(N,E)=>b.check(Ib(N,E)),b.max=(N,E)=>b.check(Ib(N,E)),b.positive=(N)=>b.check(mb(BigInt(0),N)),b.negative=(N)=>b.check(cb(BigInt(0),N)),b.nonpositive=(N)=>b.check(Ib(BigInt(0),N)),b.nonnegative=(N)=>b.check(Kb(BigInt(0),N)),b.multipleOf=(N,E)=>b.check(ZH(N,E));let Q=b._zod.bag;b.minValue=Q.minimum??null,b.maxValue=Q.maximum??null,b.format=Q.format??null});function l8(b){return y4(AN,b)}var ww=X("ZodBigIntFormat",(b,H)=>{vY.init(b,H),AN.init(b,H)});function u8(b){return l4(ww,b)}function c8(b){return u4(ww,b)}var _D=X("ZodSymbol",(b,H)=>{hY.init(b,H),x.init(b,H),b._zod.processJSONSchema=(Q,N,E)=>J6(b,Q,N,E)});function m8(b){return c4(_D,b)}var wD=X("ZodUndefined",(b,H)=>{yY.init(b,H),x.init(b,H),b._zod.processJSONSchema=(Q,N,E)=>X6(b,Q,N,E)});function i8(b){return m4(wD,b)}var YD=X("ZodNull",(b,H)=>{fY.init(b,H),x.init(b,H),b._zod.processJSONSchema=(Q,N,E)=>B6(b,Q,N,E)});function db(b){return i4(YD,b)}var DD=X("ZodAny",(b,H)=>{lY.init(b,H),x.init(b,H),b._zod.processJSONSchema=(Q,N,E)=>G6(b,Q,N,E)});function Yw(){return p4(DD)}var JD=X("ZodUnknown",(b,H)=>{uY.init(b,H),x.init(b,H),b._zod.processJSONSchema=(Q,N,E)=>O6(b,Q,N,E)});function T(){return d4(JD)}var BD=X("ZodNever",(b,H)=>{cY.init(b,H),x.init(b,H),b._zod.processJSONSchema=(Q,N,E)=>K6(b,Q,N,E)});function Dw(b){return o4(BD,b)}var XD=X("ZodVoid",(b,H)=>{mY.init(b,H),x.init(b,H),b._zod.processJSONSchema=(Q,N,E)=>q6(b,Q,N,E)});function p8(b){return n4(XD,b)}var KM=X("ZodDate",(b,H)=>{iY.init(b,H),x.init(b,H),b._zod.processJSONSchema=(N,E,M)=>A6(b,N,E,M),b.min=(N,E)=>b.check(Kb(N,E)),b.max=(N,E)=>b.check(Ib(N,E));let Q=b._zod.bag;b.minDate=Q.minimum?new Date(Q.minimum):null,b.maxDate=Q.maximum?new Date(Q.maximum):null});function d8(b){return r4(KM,b)}var qD=X("ZodArray",(b,H)=>{pY.init(b,H),x.init(b,H),b._zod.processJSONSchema=(Q,N,E)=>$6(b,Q,N,E),b.element=H.element,XM(b,"ZodArray",{min(Q,N){return this.check(EH(Q,N))},nonempty(Q){return this.check(EH(1,Q))},max(Q,N){return this.check(MQ(Q,N))},length(Q,N){return this.check(WQ(Q,N))},unwrap(){return this.element}})});function q(b,H){return a4(qD,b,H)}function o8(b){let H=b._zod.def.shape;return C(Object.keys(H))}var GM=X("ZodObject",(b,H)=>{dY.init(b,H),x.init(b,H),b._zod.processJSONSchema=(Q,N,E)=>C6(b,Q,N,E),g.defineLazy(b,"shape",()=>{return H.shape}),XM(b,"ZodObject",{keyof(){return C(Object.keys(this._zod.def.shape))},catchall(Q){return this.clone({...this._zod.def,catchall:Q})},passthrough(){return this.clone({...this._zod.def,catchall:T()})},loose(){return this.clone({...this._zod.def,catchall:T()})},strict(){return this.clone({...this._zod.def,catchall:Dw()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(Q){return g.extend(this,Q)},safeExtend(Q){return g.safeExtend(this,Q)},merge(Q){return g.merge(this,Q)},pick(Q){return g.pick(this,Q)},omit(Q){return g.omit(this,Q)},partial(...Q){return g.partial(Bw,this,Q[0])},required(...Q){return g.required(Xw,this,Q[0])}})});function B(b,H){let Q={type:"object",shape:b??{},...g.normalizeParams(H)};return new GM(Q)}function n8(b,H){return new GM({type:"object",shape:b,catchall:Dw(),...g.normalizeParams(H)})}function L(b,H){return new GM({type:"object",shape:b,catchall:T(),...g.normalizeParams(H)})}var OM=X("ZodUnion",(b,H)=>{NM.init(b,H),x.init(b,H),b._zod.processJSONSchema=(Q,N,E)=>x_(b,Q,N,E),b.options=H.options});function R(b,H){return new OM({type:"union",options:b,...g.normalizeParams(H)})}var KD=X("ZodXor",(b,H)=>{OM.init(b,H),oY.init(b,H),b._zod.processJSONSchema=(Q,N,E)=>x_(b,Q,N,E),b.options=H.options});function r8(b,H){return new KD({type:"union",options:b,inclusive:!1,...g.normalizeParams(H)})}var GD=X("ZodDiscriminatedUnion",(b,H)=>{OM.init(b,H),nY.init(b,H)});function SH(b,H,Q){return new GD({type:"union",options:H,discriminator:b,...g.normalizeParams(Q)})}var OD=X("ZodIntersection",(b,H)=>{rY.init(b,H),x.init(b,H),b._zod.processJSONSchema=(Q,N,E)=>S6(b,Q,N,E)});function yb(b,H){return new OD({type:"intersection",left:b,right:H})}var AD=X("ZodTuple",(b,H)=>{M_.init(b,H),x.init(b,H),b._zod.processJSONSchema=(Q,N,E)=>g6(b,Q,N,E),b.rest=(Q)=>b.clone({...b._zod.def,rest:Q})});function FD(b,H,Q){let N=H instanceof k,E=N?Q:H;return new AD({type:"tuple",items:b,rest:N?H:null,...g.normalizeParams(E)})}var JN=X("ZodRecord",(b,H)=>{tY.init(b,H),x.init(b,H),b._zod.processJSONSchema=(Q,N,E)=>k6(b,Q,N,E),b.keyType=H.keyType,b.valueType=H.valueType});function P(b,H,Q){if(!H||!H._zod)return new JN({type:"record",keyType:w(),valueType:b,...g.normalizeParams(H)});return new JN({type:"record",keyType:b,valueType:H,...g.normalizeParams(Q)})}function t8(b,H,Q){let N=Xb(b);return N._zod.values=void 0,new JN({type:"record",keyType:N,valueType:H,...g.normalizeParams(Q)})}function s8(b,H,Q){return new JN({type:"record",keyType:b,valueType:H,mode:"loose",...g.normalizeParams(Q)})}var VD=X("ZodMap",(b,H)=>{sY.init(b,H),x.init(b,H),b._zod.processJSONSchema=(Q,N,E)=>j6(b,Q,N,E),b.keyType=H.keyType,b.valueType=H.valueType,b.min=(...Q)=>b.check(ib(...Q)),b.nonempty=(Q)=>b.check(ib(1,Q)),b.max=(...Q)=>b.check(jH(...Q)),b.size=(...Q)=>b.check(EQ(...Q))});function a8(b,H,Q){return new VD({type:"map",keyType:b,valueType:H,...g.normalizeParams(Q)})}var UD=X("ZodSet",(b,H)=>{aY.init(b,H),x.init(b,H),b._zod.processJSONSchema=(Q,N,E)=>L6(b,Q,N,E),b.min=(...Q)=>b.check(ib(...Q)),b.nonempty=(Q)=>b.check(ib(1,Q)),b.max=(...Q)=>b.check(jH(...Q)),b.size=(...Q)=>b.check(EQ(...Q))});function e8(b,H){return new UD({type:"set",valueType:b,...g.normalizeParams(H)})}var BN=X("ZodEnum",(b,H)=>{eY.init(b,H),x.init(b,H),b._zod.processJSONSchema=(N,E,M)=>F6(b,N,E,M),b.enum=H.entries,b.options=Object.values(H.entries);let Q=new Set(Object.keys(H.entries));b.extract=(N,E)=>{let M={};for(let _ of N)if(Q.has(_))M[_]=H.entries[_];else throw Error(`Key ${_} not found in enum`);return new BN({...H,checks:[],...g.normalizeParams(E),entries:M})},b.exclude=(N,E)=>{let M={...H.entries};for(let _ of N)if(Q.has(_))delete M[_];else throw Error(`Key ${_} not found in enum`);return new BN({...H,checks:[],...g.normalizeParams(E),entries:M})}});function C(b,H){let Q=Array.isArray(b)?Object.fromEntries(b.map((N)=>[N,N])):b;return new BN({type:"enum",entries:Q,...g.normalizeParams(H)})}function bJ(b,H){return new BN({type:"enum",entries:b,...g.normalizeParams(H)})}var PD=X("ZodLiteral",(b,H)=>{b4.init(b,H),x.init(b,H),b._zod.processJSONSchema=(Q,N,E)=>V6(b,Q,N,E),b.values=new Set(H.values),Object.defineProperty(b,"value",{get(){if(H.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return H.values[0]}})});function G(b,H){return new PD({type:"literal",values:Array.isArray(b)?b:[b],...g.normalizeParams(H)})}var zD=X("ZodFile",(b,H)=>{H4.init(b,H),x.init(b,H),b._zod.processJSONSchema=(Q,N,E)=>z6(b,Q,N,E),b.min=(Q,N)=>b.check(ib(Q,N)),b.max=(Q,N)=>b.check(jH(Q,N)),b.mime=(Q,N)=>b.check(NN(Array.isArray(Q)?Q:[Q],N))});function HJ(b){return e4(zD,b)}var ID=X("ZodTransform",(b,H)=>{Q4.init(b,H),x.init(b,H),b._zod.processJSONSchema=(Q,N,E)=>Z6(b,Q,N,E),b._zod.parse=(Q,N)=>{if(N.direction==="backward")throw new bQ(b.constructor.name);Q.addIssue=(M)=>{if(typeof M==="string")Q.issues.push(g.issue(M,Q.value,H));else{let _=M;if(_.fatal)_.continue=!1;_.code??(_.code="custom"),_.input??(_.input=Q.value),_.inst??(_.inst=b),Q.issues.push(g.issue(_))}};let E=H.transform(Q.value,Q);if(E instanceof Promise)return E.then((M)=>{return Q.value=M,Q.fallback=!0,Q});return Q.value=E,Q.fallback=!0,Q}});function Jw(b){return new ID({type:"transform",transform:b})}var Bw=X("ZodOptional",(b,H)=>{W_.init(b,H),x.init(b,H),b._zod.processJSONSchema=(Q,N,E)=>v_(b,Q,N,E),b.unwrap=()=>b._zod.def.innerType});function Z(b){return new Bw({type:"optional",innerType:b})}var RD=X("ZodExactOptional",(b,H)=>{N4.init(b,H),x.init(b,H),b._zod.processJSONSchema=(Q,N,E)=>v_(b,Q,N,E),b.unwrap=()=>b._zod.def.innerType});function TD(b){return new RD({type:"optional",innerType:b})}var ZD=X("ZodNullable",(b,H)=>{E4.init(b,H),x.init(b,H),b._zod.processJSONSchema=(Q,N,E)=>x6(b,Q,N,E),b.unwrap=()=>b._zod.def.innerType});function BM(b){return new ZD({type:"nullable",innerType:b})}function QJ(b){return Z(BM(b))}var jD=X("ZodDefault",(b,H)=>{M4.init(b,H),x.init(b,H),b._zod.processJSONSchema=(Q,N,E)=>h6(b,Q,N,E),b.unwrap=()=>b._zod.def.innerType,b.removeDefault=b.unwrap});function LD(b,H){return new jD({type:"default",innerType:b,get defaultValue(){return typeof H==="function"?H():g.shallowClone(H)}})}var $D=X("ZodPrefault",(b,H)=>{W4.init(b,H),x.init(b,H),b._zod.processJSONSchema=(Q,N,E)=>y6(b,Q,N,E),b.unwrap=()=>b._zod.def.innerType});function CD(b,H){return new $D({type:"prefault",innerType:b,get defaultValue(){return typeof H==="function"?H():g.shallowClone(H)}})}var Xw=X("ZodNonOptional",(b,H)=>{_4.init(b,H),x.init(b,H),b._zod.processJSONSchema=(Q,N,E)=>v6(b,Q,N,E),b.unwrap=()=>b._zod.def.innerType});function SD(b,H){return new Xw({type:"nonoptional",innerType:b,...g.normalizeParams(H)})}var gD=X("ZodSuccess",(b,H)=>{w4.init(b,H),x.init(b,H),b._zod.processJSONSchema=(Q,N,E)=>I6(b,Q,N,E),b.unwrap=()=>b._zod.def.innerType});function NJ(b){return new gD({type:"success",innerType:b})}var kD=X("ZodCatch",(b,H)=>{Y4.init(b,H),x.init(b,H),b._zod.processJSONSchema=(Q,N,E)=>f6(b,Q,N,E),b.unwrap=()=>b._zod.def.innerType,b.removeCatch=b.unwrap});function xD(b,H){return new kD({type:"catch",innerType:b,catchValue:typeof H==="function"?H:()=>H})}var vD=X("ZodNaN",(b,H)=>{D4.init(b,H),x.init(b,H),b._zod.processJSONSchema=(Q,N,E)=>U6(b,Q,N,E)});function EJ(b){return s4(vD,b)}var AM=X("ZodPipe",(b,H)=>{__.init(b,H),x.init(b,H),b._zod.processJSONSchema=(Q,N,E)=>l6(b,Q,N,E),b.in=H.in,b.out=H.out});function m_(b,H){return new AM({type:"pipe",in:b,out:H})}var FM=X("ZodCodec",(b,H)=>{AM.init(b,H),EM.init(b,H)});function MJ(b,H,Q){return new FM({type:"pipe",in:b,out:H,transform:Q.decode,reverseTransform:Q.encode})}function WJ(b){let H=b._zod.def;return new FM({type:"pipe",in:H.out,out:H.in,transform:H.reverseTransform,reverseTransform:H.transform})}var hD=X("ZodPreprocess",(b,H)=>{AM.init(b,H),J4.init(b,H)}),yD=X("ZodReadonly",(b,H)=>{B4.init(b,H),x.init(b,H),b._zod.processJSONSchema=(Q,N,E)=>u6(b,Q,N,E),b.unwrap=()=>b._zod.def.innerType});function fD(b){return new yD({type:"readonly",innerType:b})}var lD=X("ZodTemplateLiteral",(b,H)=>{X4.init(b,H),x.init(b,H),b._zod.processJSONSchema=(Q,N,E)=>P6(b,Q,N,E)});function _J(b,H){return new lD({type:"template_literal",parts:b,...g.normalizeParams(H)})}var uD=X("ZodLazy",(b,H)=>{G4.init(b,H),x.init(b,H),b._zod.processJSONSchema=(Q,N,E)=>m6(b,Q,N,E),b.unwrap=()=>b._zod.def.getter()});function gH(b){return new uD({type:"lazy",getter:b})}var cD=X("ZodPromise",(b,H)=>{K4.init(b,H),x.init(b,H),b._zod.processJSONSchema=(Q,N,E)=>c6(b,Q,N,E),b.unwrap=()=>b._zod.def.innerType});function wJ(b){return new cD({type:"promise",innerType:b})}var mD=X("ZodFunction",(b,H)=>{q4.init(b,H),x.init(b,H),b._zod.processJSONSchema=(Q,N,E)=>T6(b,Q,N,E)});function YJ(b){return new mD({type:"function",input:Array.isArray(b?.input)?FD(b?.input):b?.input??q(T()),output:b?.output??T()})}var VM=X("ZodCustom",(b,H)=>{O4.init(b,H),x.init(b,H),b._zod.processJSONSchema=(Q,N,E)=>R6(b,Q,N,E)});function DJ(b){let H=new i({check:"custom"});return H._zod.check=b,H}function JJ(b,H){return b6(VM,b??(()=>!0),H)}function iD(b,H={}){return H6(VM,b,H)}function pD(b,H){return Q6(b,H)}var BJ=N6,XJ=E6;function qJ(b,H={}){let Q=new VM({type:"custom",check:"custom",fn:(N)=>N instanceof b,abort:!0,...g.normalizeParams(H)});return Q._zod.bag.Class=b,Q._zod.check=(N)=>{if(!(N.value instanceof b))N.issues.push({code:"invalid_type",expected:b.name,input:N.value,inst:Q,path:[...Q._zod.def.path??[]]})},Q}var KJ=(...b)=>M6({Codec:FM,Boolean:ON,String:XN},...b);function GJ(b){let H=gH(()=>{return R([w(b),F(),z(),db(),q(H),P(w(),H)])});return H}function WH(b,H){return new hD({type:"pipe",in:Jw(b),out:H})}var oD={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 k7(b){s({customError:b})}function x7(){return s().customError}var dD;(function(b){})(dD||(dD={}));var I={...YM,...h_,iso:Rb},v7=new Set(["$schema","$ref","$defs","definitions","$id","id","$comment","$anchor","$vocabulary","$dynamicRef","$dynamicAnchor","type","enum","const","anyOf","oneOf","allOf","not","properties","required","additionalProperties","patternProperties","propertyNames","minProperties","maxProperties","items","prefixItems","additionalItems","minItems","maxItems","uniqueItems","contains","minContains","maxContains","minLength","maxLength","pattern","format","minimum","maximum","exclusiveMinimum","exclusiveMaximum","multipleOf","description","default","contentEncoding","contentMediaType","contentSchema","unevaluatedItems","unevaluatedProperties","if","then","else","dependentSchemas","dependentRequired","nullable","readOnly"]);function h7(b,H){let Q=b.$schema;if(Q==="https://json-schema.org/draft/2020-12/schema")return"draft-2020-12";if(Q==="http://json-schema.org/draft-07/schema#")return"draft-7";if(Q==="http://json-schema.org/draft-04/schema#")return"draft-4";return H??"draft-2020-12"}function y7(b,H){if(!b.startsWith("#"))throw Error("External $ref is not supported, only local refs (#/...) are allowed");let Q=b.slice(1).split("/").filter(Boolean);if(Q.length===0)return H.rootSchema;let N=H.version==="draft-2020-12"?"$defs":"definitions";if(Q[0]===N){let E=Q[1];if(!E||!H.defs[E])throw Error(`Reference not found: ${b}`);return H.defs[E]}throw Error(`Reference not found: ${b}`)}function OJ(b,H){if(b.not!==void 0){if(typeof b.not==="object"&&Object.keys(b.not).length===0)return I.never();throw Error("not is not supported in Zod (except { not: {} } for never)")}if(b.unevaluatedItems!==void 0)throw Error("unevaluatedItems is not supported");if(b.unevaluatedProperties!==void 0)throw Error("unevaluatedProperties is not supported");if(b.if!==void 0||b.then!==void 0||b.else!==void 0)throw Error("Conditional schemas (if/then/else) are not supported");if(b.dependentSchemas!==void 0||b.dependentRequired!==void 0)throw Error("dependentSchemas and dependentRequired are not supported");if(b.$ref){let E=b.$ref;if(H.refs.has(E))return H.refs.get(E);if(H.processing.has(E))return I.lazy(()=>{if(!H.refs.has(E))throw Error(`Circular reference not resolved: ${E}`);return H.refs.get(E)});H.processing.add(E);let M=y7(E,H),_=Yb(M,H);return H.refs.set(E,_),H.processing.delete(E),_}if(b.enum!==void 0){let E=b.enum;if(H.version==="openapi-3.0"&&b.nullable===!0&&E.length===1&&E[0]===null)return I.null();if(E.length===0)return I.never();if(E.length===1)return I.literal(E[0]);if(E.every((_)=>typeof _==="string"))return I.enum(E);let M=E.map((_)=>I.literal(_));if(M.length<2)return M[0];return I.union([M[0],M[1],...M.slice(2)])}if(b.const!==void 0)return I.literal(b.const);let Q=b.type;if(Array.isArray(Q)){let E=Q.map((M)=>{let _={...b,type:M};return OJ(_,H)});if(E.length===0)return I.never();if(E.length===1)return E[0];return I.union(E)}if(!Q)return I.any();let N;switch(Q){case"string":{let E=I.string();if(b.format){let M=b.format;if(M==="email")E=E.check(I.email());else if(M==="uri"||M==="uri-reference")E=E.check(I.url());else if(M==="uuid"||M==="guid")E=E.check(I.uuid());else if(M==="date-time")E=E.check(I.iso.datetime());else if(M==="date")E=E.check(I.iso.date());else if(M==="time")E=E.check(I.iso.time());else if(M==="duration")E=E.check(I.iso.duration());else if(M==="ipv4")E=E.check(I.ipv4());else if(M==="ipv6")E=E.check(I.ipv6());else if(M==="mac")E=E.check(I.mac());else if(M==="cidr")E=E.check(I.cidrv4());else if(M==="cidr-v6")E=E.check(I.cidrv6());else if(M==="base64")E=E.check(I.base64());else if(M==="base64url")E=E.check(I.base64url());else if(M==="e164")E=E.check(I.e164());else if(M==="jwt")E=E.check(I.jwt());else if(M==="emoji")E=E.check(I.emoji());else if(M==="nanoid")E=E.check(I.nanoid());else if(M==="cuid")E=E.check(I.cuid());else if(M==="cuid2")E=E.check(I.cuid2());else if(M==="ulid")E=E.check(I.ulid());else if(M==="xid")E=E.check(I.xid());else if(M==="ksuid")E=E.check(I.ksuid())}if(typeof b.minLength==="number")E=E.min(b.minLength);if(typeof b.maxLength==="number")E=E.max(b.maxLength);if(b.pattern)E=E.regex(new RegExp(b.pattern));N=E;break}case"number":case"integer":{let E=Q==="integer"?I.number().int():I.number();if(typeof b.minimum==="number")E=E.min(b.minimum);if(typeof b.maximum==="number")E=E.max(b.maximum);if(typeof b.exclusiveMinimum==="number")E=E.gt(b.exclusiveMinimum);else if(b.exclusiveMinimum===!0&&typeof b.minimum==="number")E=E.gt(b.minimum);if(typeof b.exclusiveMaximum==="number")E=E.lt(b.exclusiveMaximum);else if(b.exclusiveMaximum===!0&&typeof b.maximum==="number")E=E.lt(b.maximum);if(typeof b.multipleOf==="number")E=E.multipleOf(b.multipleOf);N=E;break}case"boolean":{N=I.boolean();break}case"null":{N=I.null();break}case"object":{let E={},M=b.properties||{},_=new Set(b.required||[]);for(let[D,J]of Object.entries(M)){let K=Yb(J,H);E[D]=_.has(D)?K:K.optional()}if(b.propertyNames){let D=Yb(b.propertyNames,H),J=b.additionalProperties&&typeof b.additionalProperties==="object"?Yb(b.additionalProperties,H):I.any();if(Object.keys(E).length===0){N=I.record(D,J);break}let K=I.object(E).passthrough(),O=I.looseRecord(D,J);N=I.intersection(K,O);break}if(b.patternProperties){let D=b.patternProperties,J=Object.keys(D),K=[];for(let A of J){let V=Yb(D[A],H),j=I.string().regex(new RegExp(A));K.push(I.looseRecord(j,V))}let O=[];if(Object.keys(E).length>0)O.push(I.object(E).passthrough());if(O.push(...K),O.length===0)N=I.object({}).passthrough();else if(O.length===1)N=O[0];else{let A=I.intersection(O[0],O[1]);for(let V=2;V<O.length;V++)A=I.intersection(A,O[V]);N=A}break}let Y=I.object(E);if(b.additionalProperties===!1)N=Y.strict();else if(typeof b.additionalProperties==="object")N=Y.catchall(Yb(b.additionalProperties,H));else N=Y.passthrough();break}case"array":{let{prefixItems:E,items:M}=b;if(E&&Array.isArray(E)){let _=E.map((D)=>Yb(D,H)),Y=M&&typeof M==="object"&&!Array.isArray(M)?Yb(M,H):void 0;if(Y)N=I.tuple(_).rest(Y);else N=I.tuple(_);if(typeof b.minItems==="number")N=N.check(I.minLength(b.minItems));if(typeof b.maxItems==="number")N=N.check(I.maxLength(b.maxItems))}else if(Array.isArray(M)){let _=M.map((D)=>Yb(D,H)),Y=b.additionalItems&&typeof b.additionalItems==="object"?Yb(b.additionalItems,H):void 0;if(Y)N=I.tuple(_).rest(Y);else N=I.tuple(_);if(typeof b.minItems==="number")N=N.check(I.minLength(b.minItems));if(typeof b.maxItems==="number")N=N.check(I.maxLength(b.maxItems))}else if(M!==void 0){let _=Yb(M,H),Y=I.array(_);if(typeof b.minItems==="number")Y=Y.min(b.minItems);if(typeof b.maxItems==="number")Y=Y.max(b.maxItems);N=Y}else N=I.array(I.any());break}default:throw Error(`Unsupported type: ${Q}`)}return N}function Yb(b,H){if(typeof b==="boolean")return b?I.any():I.never();let Q=OJ(b,H),N=b.type||b.enum!==void 0||b.const!==void 0;if(b.anyOf&&Array.isArray(b.anyOf)){let Y=b.anyOf.map((J)=>Yb(J,H)),D=I.union(Y);Q=N?I.intersection(Q,D):D}if(b.oneOf&&Array.isArray(b.oneOf)){let Y=b.oneOf.map((J)=>Yb(J,H)),D=I.xor(Y);Q=N?I.intersection(Q,D):D}if(b.allOf&&Array.isArray(b.allOf))if(b.allOf.length===0)Q=N?Q:I.any();else{let Y=N?Q:Yb(b.allOf[0],H),D=N?0:1;for(let J=D;J<b.allOf.length;J++)Y=I.intersection(Y,Yb(b.allOf[J],H));Q=Y}if(b.nullable===!0&&H.version==="openapi-3.0")Q=I.nullable(Q);if(b.readOnly===!0)Q=I.readonly(Q);if(b.default!==void 0)Q=Q.default(b.default);let E={},M=["$id","id","$comment","$anchor","$vocabulary","$dynamicRef","$dynamicAnchor"];for(let Y of M)if(Y in b)E[Y]=b[Y];let _=["contentEncoding","contentMediaType","contentSchema"];for(let Y of _)if(Y in b)E[Y]=b[Y];for(let Y of Object.keys(b))if(!v7.has(Y))E[Y]=b[Y];if(Object.keys(E).length>0)H.registry.add(Q,E);if(b.description)Q=Q.describe(b.description);return Q}function AJ(b,H){if(typeof b==="boolean")return b?I.any():I.never();let Q;try{Q=JSON.parse(JSON.stringify(b))}catch{throw Error("fromJSONSchema input is not valid JSON (possibly cyclic); use $defs/$ref for recursive schemas")}let N=h7(Q,H?.defaultTarget),E=Q.$defs||Q.definitions||{},M={version:N,defs:E,refs:new Map,processing:new Set,rootSchema:Q,registry:H?.registry??Nb};return Yb(Q,M)}var UM={};QH(UM,{string:()=>f7,number:()=>l7,date:()=>m7,boolean:()=>u7,bigint:()=>c7});function f7(b){return P4(XN,b)}function l7(b){return $4(GN,b)}function u7(b){return h4(ON,b)}function c7(b){return f4(AN,b)}function m7(b){return t4(KM,b)}s(MM());var qw="2025-11-25";var Kw=[qw,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],Gw="io.modelcontextprotocol/related-task",YQ="io.modelcontextprotocol/protocolVersion",FN="io.modelcontextprotocol/clientInfo",xH="io.modelcontextprotocol/serverInfo",DQ="io.modelcontextprotocol/clientCapabilities",Ow="io.modelcontextprotocol/subscriptionId",VN="io.modelcontextprotocol/logLevel";var JQ="2.0";var _H=gH(()=>R([w(),F(),z(),db(),P(w(),_H),q(_H)])),o=P(w(),_H),Aw=q(_H),UN=R([w(),F().int()]),PN=w(),PM=B({ttl:F().optional()}),zM=B({taskId:w()}),zN=L({progressToken:UN.optional(),[Gw]:zM.optional()}),Qb=B({_meta:zN.optional()}),vH=Qb.extend({task:PM.optional()}),n=B({method:w(),params:Qb.loose().optional()}),Db=B({_meta:zN.optional()}),Eb=B({method:w(),params:Db.loose().optional()}),IN=L({get[xH](){return Zb.optional().catch(void 0)}}),r=L({_meta:IN.optional()}),Tb=R([w(),F().int()]),RN=B({jsonrpc:G(JQ),id:Tb,...n.shape}).strict(),TN=B({jsonrpc:G(JQ),...Eb.shape}).strict(),BQ=B({jsonrpc:G(JQ),id:Tb,result:r}).strict(),XQ=B({jsonrpc:G(JQ),id:Tb.optional(),error:B({code:F().int(),message:w(),data:T().optional()})}).strict(),wH=R([RN,TN,BQ,XQ]),Fw=R([BQ,XQ]),nb=r.strict(),IM=Db.extend({requestId:Tb.optional(),reason:w().optional()}),ZN=Eb.extend({method:G("notifications/cancelled"),params:IM}),RM=B({src:w(),mimeType:w().optional(),sizes:q(w()).optional(),theme:C(["light","dark"]).optional()}),YH=B({icons:q(RM).optional()}),ob=B({name:w(),title:w().optional()}),Zb=ob.extend({...ob.shape,...YH.shape,version:w(),websiteUrl:w().optional(),description:w().optional()}),p7=yb(B({applyDefaults:z().optional()}),o),d7=WH((b)=>{if(b&&typeof b==="object"&&!Array.isArray(b)&&Object.keys(b).length===0)return{form:{}};return b},yb(B({form:p7.optional(),url:o.optional()}),o.optional())),Vw=L({list:o.optional(),cancel:o.optional(),requests:L({sampling:L({createMessage:o.optional()}).optional(),elicitation:L({create:o.optional()}).optional()}).optional()}),Uw=L({list:o.optional(),cancel:o.optional(),requests:L({tools:L({call:o.optional()}).optional()}).optional()}),TM=B({experimental:P(w(),o).optional(),sampling:B({context:o.optional(),tools:o.optional()}).optional(),elicitation:d7.optional(),roots:B({listChanged:z().optional()}).optional(),tasks:Vw.optional(),extensions:P(w(),o).optional()}),ZM=Qb.extend({protocolVersion:w(),capabilities:TM,clientInfo:Zb}),jM=n.extend({method:G("initialize"),params:ZM}),jN=B({experimental:P(w(),o).optional(),logging:o.optional(),completions:o.optional(),prompts:B({listChanged:z().optional()}).optional(),resources:B({subscribe:z().optional(),listChanged:z().optional()}).optional(),tools:B({listChanged:z().optional()}).optional(),tasks:Uw.optional(),extensions:P(w(),o).optional()}),LM=r.extend({protocolVersion:w(),capabilities:jN,serverInfo:Zb,instructions:w().optional()}),$M=Eb.extend({method:G("notifications/initialized"),params:Db.optional()}),CM=n.extend({method:G("server/discover"),params:Qb.optional()}),LN=r.extend({supportedVersions:q(w()),capabilities:jN,instructions:w().optional()}),$N=n.extend({method:G("ping"),params:Qb.optional()}),SM=B({progress:F(),total:Z(F()),message:Z(w())}),gM=B({...Db.shape,...SM.shape,progressToken:UN}),CN=Eb.extend({method:G("notifications/progress"),params:gM}),kM=Qb.extend({cursor:PN.optional()}),DH=n.extend({params:kM.optional()}),JH=r.extend({nextCursor:PN.optional()}),SN=B({uri:w(),mimeType:Z(w()),_meta:P(w(),T()).optional()}),gN=SN.extend({text:w()}),rD=w().refine((b)=>{try{return atob(b),!0}catch{return!1}},{message:"Invalid Base64 string"}),kN=SN.extend({blob:rD}),BH=C(["user","assistant"]),rb=B({audience:q(BH).optional(),priority:F().min(0).max(1).optional(),lastModified:Rb.datetime({offset:!0}).optional()}),xN=B({...ob.shape,...YH.shape,uri:w(),description:Z(w()),mimeType:Z(w()),size:Z(F()),annotations:rb.optional(),_meta:Z(L({}))}),xM=B({...ob.shape,...YH.shape,uriTemplate:w(),description:Z(w()),mimeType:Z(w()),annotations:rb.optional(),_meta:Z(L({}))}),vM=DH.extend({method:G("resources/list")}),hM=JH.extend({resources:q(xN)}),yM=DH.extend({method:G("resources/templates/list")}),fM=JH.extend({resourceTemplates:q(xM)}),qQ=Qb.extend({uri:w()}),lM=qQ,uM=n.extend({method:G("resources/read"),params:lM}),cM=r.extend({contents:q(R([gN,kN]))}),mM=Eb.extend({method:G("notifications/resources/list_changed"),params:Db.optional()}),iM=qQ,pM=n.extend({method:G("resources/subscribe"),params:iM}),dM=qQ,oM=n.extend({method:G("resources/unsubscribe"),params:dM}),vN=B({toolsListChanged:z().optional(),promptsListChanged:z().optional(),resourcesListChanged:z().optional(),resourceSubscriptions:q(w()).optional()}),nM=Qb.extend({notifications:vN}),rM=n.extend({method:G("subscriptions/listen"),params:nM}),tM=Db.extend({notifications:vN}),sM=Eb.extend({method:G("notifications/subscriptions/acknowledged"),params:tM}),aM=IN.extend({[Ow]:Tb}),eM=r.extend({_meta:aM}),b0=Db.extend({uri:w()}),H0=Eb.extend({method:G("notifications/resources/updated"),params:b0}),Q0=B({name:w(),description:Z(w()),required:Z(z())}),N0=B({...ob.shape,...YH.shape,description:Z(w()),arguments:Z(q(Q0)),_meta:Z(L({}))}),E0=DH.extend({method:G("prompts/list")}),M0=JH.extend({prompts:q(N0)}),W0=Qb.extend({name:w(),arguments:P(w(),w()).optional()}),_0=n.extend({method:G("prompts/get"),params:W0}),KQ=B({type:G("text"),text:w(),annotations:rb.optional(),_meta:P(w(),T()).optional()}),GQ=B({type:G("image"),data:rD,mimeType:w(),annotations:rb.optional(),_meta:P(w(),T()).optional()}),OQ=B({type:G("audio"),data:rD,mimeType:w(),annotations:rb.optional(),_meta:P(w(),T()).optional()}),w0=B({type:G("tool_use"),name:w(),id:w(),input:P(w(),T()),_meta:P(w(),T()).optional()}),XH=B({type:G("resource"),resource:R([gN,kN]),annotations:rb.optional(),_meta:P(w(),T()).optional()}),qH=xN.extend({type:G("resource_link")}),jb=R([KQ,GQ,OQ,qH,XH]),Y0=B({role:BH,content:jb}),D0=r.extend({description:w().optional(),messages:q(Y0)}),J0=Eb.extend({method:G("notifications/prompts/list_changed"),params:Db.optional()}),B0=B({title:w().optional(),readOnlyHint:z().optional(),destructiveHint:z().optional(),idempotentHint:z().optional(),openWorldHint:z().optional()}),X0=B({taskSupport:C(["required","optional","forbidden"]).optional()}),tb=B({...ob.shape,...YH.shape,description:w().optional(),inputSchema:B({type:G("object"),properties:P(w(),_H).optional(),required:q(w()).optional()}).catchall(T()),outputSchema:L({$schema:w().optional()}).optional(),annotations:B0.optional(),execution:X0.optional(),_meta:P(w(),T()).optional()}),q0=DH.extend({method:G("tools/list")}),K0=JH.extend({tools:q(tb)}),sb=r.extend({content:q(jb).default([]),structuredContent:T().optional(),isError:z().optional()}),Pw=sb.or(r.extend({toolResult:T()})),G0=vH.extend({name:w(),arguments:P(w(),T()).optional()}),O0=n.extend({method:G("tools/call"),params:G0}),A0=Eb.extend({method:G("notifications/tools/list_changed"),params:Db.optional()}),zw=B({autoRefresh:z().default(!0),debounceMs:F().int().nonnegative().default(300)}),hN=C(["debug","info","notice","warning","error","critical","alert","emergency"]),F0=Qb.extend({level:hN}),V0=n.extend({method:G("logging/setLevel"),params:F0}),U0=Db.extend({level:hN,logger:w().optional(),data:T()}),AQ=Eb.extend({method:G("notifications/message"),params:U0}),P0=B({name:w().optional()}),z0=B({hints:q(P0).optional(),costPriority:F().min(0).max(1).optional(),speedPriority:F().min(0).max(1).optional(),intelligencePriority:F().min(0).max(1).optional()}),I0=B({mode:C(["auto","required","none"]).optional()}),R0=B({type:G("tool_result"),toolUseId:w().describe("The unique identifier for the corresponding tool call."),content:q(jb),structuredContent:T().optional(),isError:z().optional(),_meta:P(w(),T()).optional()}),T0=SH("type",[KQ,GQ,OQ]),kH=SH("type",[KQ,GQ,OQ,w0,R0]),Z0=B({role:BH,content:R([kH,q(kH)]),_meta:P(w(),T()).optional()}),j0=vH.extend({messages:q(Z0),modelPreferences:z0.optional(),systemPrompt:w().optional(),includeContext:C(["none","thisServer","allServers"]).optional(),temperature:F().optional(),maxTokens:F().int(),stopSequences:q(w()).optional(),metadata:o.optional(),tools:q(tb).optional(),toolChoice:I0.optional()}),L0=n.extend({method:G("sampling/createMessage"),params:j0}),$0=r.extend({model:w(),stopReason:Z(C(["endTurn","stopSequence","maxTokens"]).or(w())),role:BH,content:T0}),C0=r.extend({model:w(),stopReason:Z(C(["endTurn","stopSequence","maxTokens","toolUse"]).or(w())),role:BH,content:R([kH,q(kH)])}),yN=B({type:G("boolean"),title:w().optional(),description:w().optional(),default:z().optional()}),FQ=B({type:G("string"),title:w().optional(),description:w().optional(),minLength:F().optional(),maxLength:F().optional(),format:C(["email","uri","date","date-time"]).optional(),default:w().optional()}),VQ=B({type:C(["number","integer"]),title:w().optional(),description:w().optional(),minimum:F().optional(),maximum:F().optional(),default:F().optional()}),fN=B({type:G("string"),title:w().optional(),description:w().optional(),enum:q(w()),default:w().optional()}),lN=B({type:G("string"),title:w().optional(),description:w().optional(),oneOf:q(B({const:w(),title:w()})),default:w().optional()}),uN=B({type:G("string"),title:w().optional(),description:w().optional(),enum:q(w()),enumNames:q(w()).optional(),default:w().optional()}),S0=R([fN,lN]),cN=B({type:G("array"),title:w().optional(),description:w().optional(),minItems:F().optional(),maxItems:F().optional(),items:B({type:G("string"),enum:q(w())}),default:q(w()).optional()}),mN=B({type:G("array"),title:w().optional(),description:w().optional(),minItems:F().optional(),maxItems:F().optional(),items:B({anyOf:q(B({const:w(),title:w()}))}),default:q(w()).optional()}),g0=R([cN,mN]),k0=R([uN,S0,g0]),iN=R([k0,yN,FQ,VQ]),UQ=vH.extend({mode:G("form").optional(),message:w(),requestedSchema:B({type:G("object"),properties:P(w(),iN),required:q(w()).optional()}).catchall(T())}),x0=vH.extend({mode:G("url"),message:w(),elicitationId:w(),url:w().url()}),v0=R([UQ,x0]),h0=n.extend({method:G("elicitation/create"),params:v0}),y0=Db.extend({elicitationId:w()}),f0=Eb.extend({method:G("notifications/elicitation/complete"),params:y0}),l0=r.extend({action:C(["accept","decline","cancel"]),content:WH((b)=>b===null?void 0:b,P(w(),R([w(),F(),z(),q(w())])).optional())}),u0=B({type:G("ref/resource"),uri:w()}),c0=B({type:G("ref/prompt"),name:w()}),m0=Qb.extend({ref:R([c0,u0]),argument:B({name:w(),value:w()}),context:B({arguments:P(w(),w()).optional()}).optional()}),i0=n.extend({method:G("completion/complete"),params:m0}),p0=r.extend({completion:L({values:q(w()).max(100),total:Z(F().int()),hasMore:Z(z())})}),d0=B({uri:w().startsWith("file://"),name:w().optional(),_meta:P(w(),T()).optional()}),o0=n.extend({method:G("roots/list"),params:Qb.optional()}),n0=r.extend({roots:q(d0)}),r0=Eb.extend({method:G("notifications/roots/list_changed"),params:Db.optional()}),Iw=L({ttl:F().optional(),pollInterval:F().optional()}),t0=C(["working","input_required","completed","failed","cancelled"]),KH=B({taskId:w(),status:t0,ttl:R([F(),db()]),createdAt:w(),lastUpdatedAt:w(),pollInterval:Z(F()),statusMessage:Z(w())}),Rw=r.extend({task:KH}),s0=Db.merge(KH),Tw=Eb.extend({method:G("notifications/tasks/status"),params:s0}),Zw=n.extend({method:G("tasks/get"),params:Qb.extend({taskId:w()})}),jw=r.merge(KH),Lw=n.extend({method:G("tasks/result"),params:Qb.extend({taskId:w()})}),$w=r.loose(),Cw=DH.extend({method:G("tasks/list")}),Sw=JH.extend({tasks:q(KH)}),gw=n.extend({method:G("tasks/cancel"),params:Qb.extend({taskId:w()})}),kw=r.merge(KH),xw=R([$N,jM,CM,i0,V0,_0,E0,vM,yM,uM,pM,oM,rM,O0,q0]),vw=R([ZN,CN,$M,r0]),hw=R([nb,$0,C0,l0,n0]),yw=R([$N,L0,h0,o0]),fw=R([ZN,CN,AQ,H0,mM,A0,J0,sM,f0]),lw=R([nb,LM,LN,p0,D0,M0,hM,fM,cM,sb,K0,eM]),Hb=qN().superRefine((b,H)=>{if(!URL.canParse(b))return H.addIssue({code:oD.custom,message:"URL must be parseable",fatal:!0}),mE}).refine((b)=>{let H=new URL(b);return H.protocol!=="javascript:"&&H.protocol!=="data:"&&H.protocol!=="vbscript:"},{message:"URL cannot use javascript:, data:, or vbscript: scheme"}),a0=L({resource:w().url(),authorization_servers:q(Hb).optional(),jwks_uri:w().url().optional(),scopes_supported:q(w()).optional(),bearer_methods_supported:q(w()).optional(),resource_signing_alg_values_supported:q(w()).optional(),resource_name:w().optional(),resource_documentation:w().optional(),resource_policy_uri:w().url().optional(),resource_tos_uri:w().url().optional(),tls_client_certificate_bound_access_tokens:z().optional(),authorization_details_types_supported:q(w()).optional(),dpop_signing_alg_values_supported:q(w()).optional(),dpop_bound_access_tokens_required:z().optional()}),pN=L({issuer:w(),authorization_endpoint:Hb,token_endpoint:Hb,registration_endpoint:Hb.optional(),scopes_supported:q(w()).optional(),response_types_supported:q(w()),response_modes_supported:q(w()).optional(),grant_types_supported:q(w()).optional(),token_endpoint_auth_methods_supported:q(w()).optional(),token_endpoint_auth_signing_alg_values_supported:q(w()).optional(),service_documentation:Hb.optional(),revocation_endpoint:Hb.optional(),revocation_endpoint_auth_methods_supported:q(w()).optional(),revocation_endpoint_auth_signing_alg_values_supported:q(w()).optional(),introspection_endpoint:w().optional(),introspection_endpoint_auth_methods_supported:q(w()).optional(),introspection_endpoint_auth_signing_alg_values_supported:q(w()).optional(),code_challenge_methods_supported:q(w()).optional(),client_id_metadata_document_supported:z().optional(),authorization_response_iss_parameter_supported:z().optional().catch(void 0),dpop_signing_alg_values_supported:q(w()).optional()}),e0=L({issuer:w(),authorization_endpoint:Hb,token_endpoint:Hb,userinfo_endpoint:Hb.optional(),jwks_uri:Hb,registration_endpoint:Hb.optional(),scopes_supported:q(w()).optional(),response_types_supported:q(w()),response_modes_supported:q(w()).optional(),grant_types_supported:q(w()).optional(),acr_values_supported:q(w()).optional(),subject_types_supported:q(w()),id_token_signing_alg_values_supported:q(w()),id_token_encryption_alg_values_supported:q(w()).optional(),id_token_encryption_enc_values_supported:q(w()).optional(),userinfo_signing_alg_values_supported:q(w()).optional(),userinfo_encryption_alg_values_supported:q(w()).optional(),userinfo_encryption_enc_values_supported:q(w()).optional(),request_object_signing_alg_values_supported:q(w()).optional(),request_object_encryption_alg_values_supported:q(w()).optional(),request_object_encryption_enc_values_supported:q(w()).optional(),token_endpoint_auth_methods_supported:q(w()).optional(),token_endpoint_auth_signing_alg_values_supported:q(w()).optional(),display_values_supported:q(w()).optional(),claim_types_supported:q(w()).optional(),claims_supported:q(w()).optional(),service_documentation:w().optional(),claims_locales_supported:q(w()).optional(),ui_locales_supported:q(w()).optional(),claims_parameter_supported:z().optional(),request_parameter_supported:z().optional(),request_uri_parameter_supported:z().optional(),require_request_uri_registration:z().optional(),op_policy_uri:Hb.optional(),op_tos_uri:Hb.optional(),client_id_metadata_document_supported:z().optional(),authorization_response_iss_parameter_supported:z().optional().catch(void 0)}),bW=B({...e0.shape,...pN.pick({code_challenge_methods_supported:!0}).shape}),HW=B({access_token:w(),id_token:w().optional(),token_type:w(),expires_in:UM.number().optional(),scope:w().optional(),refresh_token:w().optional(),issuer:w().optional().catch(void 0)}).strip(),QW=B({issued_token_type:G("urn:ietf:params:oauth:token-type:id-jag"),access_token:w(),token_type:w().optional(),expires_in:F().optional(),scope:w().optional()}).strip(),NW=B({error:w(),error_description:w().optional(),error_uri:w().optional()}),nD=Hb.optional().or(G("").transform(()=>{return})),EW=B({redirect_uris:q(Hb),token_endpoint_auth_method:w().optional(),grant_types:q(w()).optional(),response_types:q(w()).optional(),application_type:w().optional(),client_name:w().optional(),client_uri:Hb.optional(),logo_uri:nD,scope:w().optional(),contacts:q(w()).optional(),tos_uri:nD,policy_uri:w().optional(),jwks_uri:Hb.optional(),jwks:Yw().optional(),software_id:w().optional(),software_version:w().optional(),software_statement:w().optional()}).strip(),MW=B({client_id:w(),client_secret:w().optional(),client_id_issued_at:F().optional(),client_secret_expires_at:F().optional(),issuer:w().optional().catch(void 0)}).strip(),WW=EW.merge(MW),uw=B({error:w(),error_description:w().optional()}).strip(),cw=B({token:w(),token_type_hint:w().optional()}).strip();var H9=Symbol.for("mcp.sdk.errorBrands");function PQ(b,H){let Q=new Set,N=H;while(typeof N==="function"){let E=N.mcpBrand;if(Object.prototype.hasOwnProperty.call(N,"mcpBrand")&&typeof E==="string")Q.add(E);N=Object.getPrototypeOf(N)}if(Q.size===0)return;Object.defineProperty(b,H9,{value:Q,enumerable:!1,configurable:!0})}function Lb(b,H){try{if(typeof H==="object"&&H!==null&&Object.prototype.hasOwnProperty.call(b,"mcpBrand")&&typeof b.mcpBrand==="string"&&Object.prototype.hasOwnProperty.call(H,H9)){let Q=H[H9];if(Q&&typeof Q.has==="function"&&Q.has(b.mcpBrand))return!0}}catch{}return Function.prototype[Symbol.hasInstance].call(b,H)}var o7=class b extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.OAuthError"})}static[Symbol.hasInstance](H){return Lb(this,H)}static isInstance(H){if(typeof this!=="function")throw TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return Lb(this,H)}constructor(H,Q,N){super(Q);this.code=H,this.errorUri=N,this.name="OAuthError",PQ(this,new.target)}toResponseObject(){let H={error:this.code,error_description:this.message};if(this.errorUri)H.error_uri=this.errorUri;return H}static fromResponse(H){return new b(H.error,H.error_description??H.error,H.error_uri)}},Mb=function(b){return b.NotConnected="NOT_CONNECTED",b.AlreadyConnected="ALREADY_CONNECTED",b.NotInitialized="NOT_INITIALIZED",b.CapabilityNotSupported="CAPABILITY_NOT_SUPPORTED",b.RequestTimeout="REQUEST_TIMEOUT",b.ConnectionClosed="CONNECTION_CLOSED",b.SendFailed="SEND_FAILED",b.InvalidResult="INVALID_RESULT",b.UnsupportedResultType="UNSUPPORTED_RESULT_TYPE",b.InputRequiredRoundsExceeded="INPUT_REQUIRED_ROUNDS_EXCEEDED",b.ListPaginationExceeded="LIST_PAGINATION_EXCEEDED",b.MethodNotSupportedByProtocolVersion="METHOD_NOT_SUPPORTED_BY_PROTOCOL_VERSION",b.EraNegotiationFailed="ERA_NEGOTIATION_FAILED",b.ClientHttpNotImplemented="CLIENT_HTTP_NOT_IMPLEMENTED",b.ClientHttpAuthentication="CLIENT_HTTP_AUTHENTICATION",b.ClientHttpForbidden="CLIENT_HTTP_FORBIDDEN",b.ClientHttpUnexpectedContent="CLIENT_HTTP_UNEXPECTED_CONTENT",b.ClientHttpFailedToOpenStream="CLIENT_HTTP_FAILED_TO_OPEN_STREAM",b.ClientHttpFailedToTerminateSession="CLIENT_HTTP_FAILED_TO_TERMINATE_SESSION",b}({}),e=class extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.SdkError"})}static[Symbol.hasInstance](b){return Lb(this,b)}static isInstance(b){if(typeof this!=="function")throw TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return Lb(this,b)}constructor(b,H,Q,N){super(H,N);this.code=b,this.data=Q,this.name="SdkError",PQ(this,new.target)}},n7=class extends e{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.SdkHttpError"})}constructor(b,H,Q,N){super(b,H,Q,N);this.name="SdkHttpError"}get status(){return this.data.status}get statusText(){return this.data.statusText}};var r7="2026-07-28";function fJ(b){return b>=r7}function lJ(b){let H=b.structuredContent;if(H===void 0)return b;if(!(typeof H!=="object"||H===null||Array.isArray(H)))return b;if(b.content?.some((Q)=>Q.type==="text")??!1)return b;return{...b,content:[...b.content??[],{type:"text",text:JSON.stringify(H)}]}}var uJ=["task","inputRequests","requestState"];function t7(b){if(b===null||typeof b!=="object"||Array.isArray(b)||b.content!==void 0||uJ.some((H)=>(H in b)))return b;return{...b,content:[]}}function s7(){let b=gH(()=>R([w(),F(),z(),db(),P(w(),b),q(b)])),H=P(w(),b),Q=R([w(),F().int()]),N=w(),E=B({ttl:F().optional()}),M=B({taskId:w()}),_=L({progressToken:Q.optional(),"io.modelcontextprotocol/related-task":M.optional()}),Y=B({_meta:_.optional()}),D=Y.extend({task:E.optional()}),J=B({method:w(),params:Y.loose().optional()}),K=B({_meta:_.optional()}),O=B({method:w(),params:K.loose().optional()}),A=L({_meta:_.optional()}),V=R([w(),F().int()]),j=A.strict(),$=K.extend({requestId:V.optional(),reason:w().optional()}),S=O.extend({method:G("notifications/cancelled"),params:$}),m=B({src:w(),mimeType:w().optional(),sizes:q(w()).optional(),theme:C(["light","dark"]).optional()}),t=B({icons:q(m).optional()}),l=B({name:w(),title:w().optional()}),y=l.extend({...l.shape,...t.shape,version:w(),websiteUrl:w().optional(),description:w().optional()}),d=yb(B({applyDefaults:z().optional()}),H),p=WH((wb)=>{if(wb&&typeof wb==="object"&&!Array.isArray(wb)&&Object.keys(wb).length===0)return{form:{}};return wb},yb(B({form:d.optional(),url:H.optional()}),H.optional())),bb=L({list:H.optional(),cancel:H.optional(),requests:L({sampling:L({createMessage:H.optional()}).optional(),elicitation:L({create:H.optional()}).optional()}).optional()}),eb=L({list:H.optional(),cancel:H.optional(),requests:L({tools:L({call:H.optional()}).optional()}).optional()}),Jb=B({experimental:P(w(),H).optional(),sampling:B({context:H.optional(),tools:H.optional()}).optional(),elicitation:p.optional(),roots:B({listChanged:z().optional()}).optional(),tasks:bb.optional(),extensions:P(w(),H).optional()}),GH=Y.extend({protocolVersion:w(),capabilities:Jb,clientInfo:y}),fH=J.extend({method:G("initialize"),params:GH}),nN=B({experimental:P(w(),H).optional(),logging:H.optional(),completions:H.optional(),prompts:B({listChanged:z().optional()}).optional(),resources:B({subscribe:z().optional(),listChanged:z().optional()}).optional(),tools:B({listChanged:z().optional()}).optional(),tasks:eb.optional(),extensions:P(w(),H).optional()}),rN=A.extend({protocolVersion:w(),capabilities:nN,serverInfo:y,instructions:w().optional()}),TQ=O.extend({method:G("notifications/initialized"),params:K.optional()}),OH=J.extend({method:G("ping"),params:Y.optional()}),lH=B({progress:F(),total:Z(F()),message:Z(w())}),fb=B({...K.shape,...lH.shape,progressToken:Q}),AH=O.extend({method:G("notifications/progress"),params:fb}),ZQ=Y.extend({cursor:N.optional()}),bH=J.extend({params:ZQ.optional()}),HH=A.extend({nextCursor:N.optional()}),jQ=B({uri:w(),mimeType:Z(w()),_meta:P(w(),T()).optional()}),LQ=jQ.extend({text:w()}),uH=w().refine((wb)=>{try{return atob(wb),!0}catch{return!1}},{message:"Invalid Base64 string"}),$Q=jQ.extend({blob:uH}),lb=C(["user","assistant"]),xb=B({audience:q(lb).optional(),priority:F().min(0).max(1).optional(),lastModified:Rb.datetime({offset:!0}).optional()}),cH=B({...l.shape,...t.shape,uri:w(),description:Z(w()),mimeType:Z(w()),size:Z(F()),annotations:xb.optional(),_meta:Z(L({}))}),tN=B({...l.shape,...t.shape,uriTemplate:w(),description:Z(w()),mimeType:Z(w()),annotations:xb.optional(),_meta:Z(L({}))}),sN=bH.extend({method:G("resources/list")}),aN=HH.extend({resources:q(cH)}),FH=bH.extend({method:G("resources/templates/list")}),CQ=HH.extend({resourceTemplates:q(tN)}),mH=Y.extend({uri:w()}),eN=mH,bE=J.extend({method:G("resources/read"),params:eN}),HE=A.extend({contents:q(R([LQ,$Q]))}),QE=O.extend({method:G("notifications/resources/list_changed"),params:K.optional()}),NE=mH,EE=J.extend({method:G("resources/subscribe"),params:NE}),ME=mH,WE=J.extend({method:G("resources/unsubscribe"),params:ME}),_E=K.extend({uri:w()}),wE=O.extend({method:G("notifications/resources/updated"),params:_E}),YE=B({name:w(),description:Z(w()),required:Z(z())}),DE=B({...l.shape,...t.shape,description:Z(w()),arguments:Z(q(YE)),_meta:Z(L({}))}),JE=bH.extend({method:G("prompts/list")}),BE=HH.extend({prompts:q(DE)}),XE=Y.extend({name:w(),arguments:P(w(),w()).optional()}),qE=J.extend({method:G("prompts/get"),params:XE}),iH=B({type:G("text"),text:w(),annotations:xb.optional(),_meta:P(w(),T()).optional()}),pH=B({type:G("image"),data:uH,mimeType:w(),annotations:xb.optional(),_meta:P(w(),T()).optional()}),dH=B({type:G("audio"),data:uH,mimeType:w(),annotations:xb.optional(),_meta:P(w(),T()).optional()}),KE=B({type:G("tool_use"),name:w(),id:w(),input:P(w(),T()),_meta:P(w(),T()).optional()}),VH=B({type:G("resource"),resource:R([LQ,$Q]),annotations:xb.optional(),_meta:P(w(),T()).optional()}),GE=cH.extend({type:G("resource_link")}),Cb=R([iH,pH,dH,GE,VH]),SQ=B({role:lb,content:Cb}),gQ=A.extend({description:w().optional(),messages:q(SQ)}),oH=O.extend({method:G("notifications/prompts/list_changed"),params:K.optional()}),OE=B({title:w().optional(),readOnlyHint:z().optional(),destructiveHint:z().optional(),idempotentHint:z().optional(),openWorldHint:z().optional()}),kQ=B({taskSupport:C(["required","optional","forbidden"]).optional()}),nH=B({...l.shape,...t.shape,description:w().optional(),inputSchema:B({type:G("object"),properties:P(w(),b).optional(),required:q(w()).optional()}).catchall(T()),outputSchema:B({type:G("object"),properties:P(w(),b).optional(),required:q(w()).optional()}).catchall(T()).optional(),annotations:OE.optional(),execution:kQ.optional(),_meta:P(w(),T()).optional()}),xQ=bH.extend({method:G("tools/list")}),vQ=HH.extend({tools:q(nH)}),hQ=A.extend({content:q(Cb),structuredContent:P(w(),T()).optional(),isError:z().optional()}),_b=D.extend({name:w(),arguments:P(w(),T()).optional()}),AE=J.extend({method:G("tools/call"),params:_b}),AW=O.extend({method:G("notifications/tools/list_changed"),params:K.optional()}),yQ=C(["debug","info","notice","warning","error","critical","alert","emergency"]),FE=Y.extend({level:yQ}),VE=J.extend({method:G("logging/setLevel"),params:FE}),UE=K.extend({level:yQ,logger:w().optional(),data:T()}),PE=O.extend({method:G("notifications/message"),params:UE}),zE=B({name:w().optional()}),IE=B({hints:q(zE).optional(),costPriority:F().min(0).max(1).optional(),speedPriority:F().min(0).max(1).optional(),intelligencePriority:F().min(0).max(1).optional()}),RE=B({mode:C(["auto","required","none"]).optional()}),FW=B({type:G("tool_result"),toolUseId:w().describe("The unique identifier for the corresponding tool call."),content:q(Cb),structuredContent:B({}).loose().optional(),isError:z().optional(),_meta:P(w(),T()).optional()}),TE=SH("type",[iH,pH,dH]),UH=SH("type",[iH,pH,dH,KE,FW]),ZE=B({role:lb,content:R([UH,q(UH)]),_meta:P(w(),T()).optional()}),jE=D.extend({messages:q(ZE),modelPreferences:IE.optional(),systemPrompt:w().optional(),includeContext:C(["none","thisServer","allServers"]).optional(),temperature:F().optional(),maxTokens:F().int(),stopSequences:q(w()).optional(),metadata:H.optional(),tools:q(nH).optional(),toolChoice:RE.optional()}),LE=J.extend({method:G("sampling/createMessage"),params:jE}),$E=A.extend({model:w(),stopReason:Z(C(["endTurn","stopSequence","maxTokens"]).or(w())),role:lb,content:TE}),CE=A.extend({model:w(),stopReason:Z(C(["endTurn","stopSequence","maxTokens","toolUse"]).or(w())),role:lb,content:R([UH,q(UH)])}),SE=B({type:G("boolean"),title:w().optional(),description:w().optional(),default:z().optional()}),gE=B({type:G("string"),title:w().optional(),description:w().optional(),minLength:F().optional(),maxLength:F().optional(),format:C(["email","uri","date","date-time"]).optional(),default:w().optional()}),kE=B({type:C(["number","integer"]),title:w().optional(),description:w().optional(),minimum:F().optional(),maximum:F().optional(),default:F().optional()}),xE=B({type:G("string"),title:w().optional(),description:w().optional(),enum:q(w()),default:w().optional()}),vE=B({type:G("string"),title:w().optional(),description:w().optional(),oneOf:q(B({const:w(),title:w()})),default:w().optional()}),hE=B({type:G("string"),title:w().optional(),description:w().optional(),enum:q(w()),enumNames:q(w()).optional(),default:w().optional()}),yE=R([xE,vE]),rH=B({type:G("array"),title:w().optional(),description:w().optional(),minItems:F().optional(),maxItems:F().optional(),items:B({type:G("string"),enum:q(w())}),default:q(w()).optional()}),tH=B({type:G("array"),title:w().optional(),description:w().optional(),minItems:F().optional(),maxItems:F().optional(),items:B({anyOf:q(B({const:w(),title:w()}))}),default:q(w()).optional()}),VW=R([rH,tH]),UW=R([hE,yE,VW]),Ub=R([UW,SE,gE,kE]),Pb=D.extend({mode:G("form").optional(),message:w(),requestedSchema:B({type:G("object"),properties:P(w(),Ub),required:q(w()).optional()}).catchall(T())}),fE=D.extend({mode:G("url"),message:w(),elicitationId:w(),url:w().url()}),vb=R([Pb,fE]),PW=J.extend({method:G("elicitation/create"),params:vb}),zW=K.extend({elicitationId:w()}),IW=O.extend({method:G("notifications/elicitation/complete"),params:zW}),RW=A.extend({action:C(["accept","decline","cancel"]),content:WH((wb)=>wb===null?void 0:wb,P(w(),R([w(),F(),z(),q(w())])).optional())}),TW=B({type:G("ref/resource"),uri:w()}),ZW=B({type:G("ref/prompt"),name:w()}),jW=Y.extend({ref:R([ZW,TW]),argument:B({name:w(),value:w()}),context:B({arguments:P(w(),w()).optional()}).optional()}),lE=J.extend({method:G("completion/complete"),params:jW}),LW=A.extend({completion:L({values:q(w()).max(100),total:Z(F().int()),hasMore:Z(z())})}),$W=B({uri:w().startsWith("file://"),name:w().optional(),_meta:P(w(),T()).optional()}),fQ=J.extend({method:G("roots/list"),params:Y.optional()}),uE=A.extend({roots:q($W)}),CW=O.extend({method:G("notifications/roots/list_changed"),params:K.optional()}),SW=L({ttl:F().optional(),pollInterval:F().optional()}),cE=C(["working","input_required","completed","failed","cancelled"]),PH=B({taskId:w(),status:cE,ttl:R([F(),db()]),createdAt:w(),lastUpdatedAt:w(),pollInterval:Z(F()),statusMessage:Z(w())}),Ob=A.extend({task:PH}),gW=K.merge(PH),sH=O.extend({method:G("notifications/tasks/status"),params:gW}),lQ=J.extend({method:G("tasks/get"),params:Y.extend({taskId:w()})}),uQ=A.merge(PH),cQ=J.extend({method:G("tasks/result"),params:Y.extend({taskId:w()})}),sw=A.loose(),Bb=bH.extend({method:G("tasks/list")}),a=HH.extend({tasks:q(PH)}),aH=J.extend({method:G("tasks/cancel"),params:Y.extend({taskId:w()})});return{JSONValueSchema:b,JSONObjectSchema:H,ProgressTokenSchema:Q,CursorSchema:N,TaskMetadataSchema:E,RelatedTaskMetadataSchema:M,RequestMetaSchema:_,BaseRequestParamsSchema:Y,TaskAugmentedRequestParamsSchema:D,RequestSchema:J,NotificationsParamsSchema:K,NotificationSchema:O,ResultSchema:A,RequestIdSchema:V,EmptyResultSchema:j,CancelledNotificationParamsSchema:$,CancelledNotificationSchema:S,IconSchema:m,IconsSchema:t,BaseMetadataSchema:l,ImplementationSchema:y,ClientTasksCapabilitySchema:bb,ServerTasksCapabilitySchema:eb,ClientCapabilitiesSchema:Jb,InitializeRequestParamsSchema:GH,InitializeRequestSchema:fH,ServerCapabilitiesSchema:nN,InitializeResultSchema:rN,InitializedNotificationSchema:TQ,PingRequestSchema:OH,ProgressSchema:lH,ProgressNotificationParamsSchema:fb,ProgressNotificationSchema:AH,PaginatedRequestParamsSchema:ZQ,PaginatedRequestSchema:bH,PaginatedResultSchema:HH,ResourceContentsSchema:jQ,TextResourceContentsSchema:LQ,BlobResourceContentsSchema:$Q,RoleSchema:lb,AnnotationsSchema:xb,ResourceSchema:cH,ResourceTemplateSchema:tN,ListResourcesRequestSchema:sN,ListResourcesResultSchema:aN,ListResourceTemplatesRequestSchema:FH,ListResourceTemplatesResultSchema:CQ,ResourceRequestParamsSchema:mH,ReadResourceRequestParamsSchema:eN,ReadResourceRequestSchema:bE,ReadResourceResultSchema:HE,ResourceListChangedNotificationSchema:QE,SubscribeRequestParamsSchema:NE,SubscribeRequestSchema:EE,UnsubscribeRequestParamsSchema:ME,UnsubscribeRequestSchema:WE,ResourceUpdatedNotificationParamsSchema:_E,ResourceUpdatedNotificationSchema:wE,PromptArgumentSchema:YE,PromptSchema:DE,ListPromptsRequestSchema:JE,ListPromptsResultSchema:BE,GetPromptRequestParamsSchema:XE,GetPromptRequestSchema:qE,TextContentSchema:iH,ImageContentSchema:pH,AudioContentSchema:dH,ToolUseContentSchema:KE,EmbeddedResourceSchema:VH,ResourceLinkSchema:GE,ContentBlockSchema:Cb,PromptMessageSchema:SQ,GetPromptResultSchema:gQ,PromptListChangedNotificationSchema:oH,ToolAnnotationsSchema:OE,ToolExecutionSchema:kQ,ToolSchema:nH,ListToolsRequestSchema:xQ,ListToolsResultSchema:vQ,CallToolResultSchema:hQ,CallToolRequestParamsSchema:_b,CallToolRequestSchema:AE,ToolListChangedNotificationSchema:AW,LoggingLevelSchema:yQ,SetLevelRequestParamsSchema:FE,SetLevelRequestSchema:VE,LoggingMessageNotificationParamsSchema:UE,LoggingMessageNotificationSchema:PE,ModelHintSchema:zE,ModelPreferencesSchema:IE,ToolChoiceSchema:RE,ToolResultContentSchema:FW,SamplingContentSchema:TE,SamplingMessageContentBlockSchema:UH,SamplingMessageSchema:ZE,CreateMessageRequestParamsSchema:jE,CreateMessageRequestSchema:LE,CreateMessageResultSchema:$E,CreateMessageResultWithToolsSchema:CE,BooleanSchemaSchema:SE,StringSchemaSchema:gE,NumberSchemaSchema:kE,UntitledSingleSelectEnumSchemaSchema:xE,TitledSingleSelectEnumSchemaSchema:vE,LegacyTitledEnumSchemaSchema:hE,SingleSelectEnumSchemaSchema:yE,UntitledMultiSelectEnumSchemaSchema:rH,TitledMultiSelectEnumSchemaSchema:tH,MultiSelectEnumSchemaSchema:VW,EnumSchemaSchema:UW,PrimitiveSchemaDefinitionSchema:Ub,ElicitRequestFormParamsSchema:Pb,ElicitRequestURLParamsSchema:fE,ElicitRequestParamsSchema:vb,ElicitRequestSchema:PW,ElicitationCompleteNotificationParamsSchema:zW,ElicitationCompleteNotificationSchema:IW,ElicitResultSchema:RW,ResourceTemplateReferenceSchema:TW,PromptReferenceSchema:ZW,CompleteRequestParamsSchema:jW,CompleteRequestSchema:lE,CompleteResultSchema:LW,RootSchema:$W,ListRootsRequestSchema:fQ,ListRootsResultSchema:uE,RootsListChangedNotificationSchema:CW,TaskCreationParamsSchema:SW,TaskStatusSchema:cE,TaskSchema:PH,CreateTaskResultSchema:Ob,TaskStatusNotificationParamsSchema:gW,TaskStatusNotificationSchema:sH,GetTaskRequestSchema:lQ,GetTaskResultSchema:uQ,GetTaskPayloadRequestSchema:cQ,GetTaskPayloadResultSchema:sw,ListTasksRequestSchema:Bb,ListTasksResultSchema:a,CancelTaskRequestSchema:aH,CancelTaskResultSchema:A.merge(PH),ClientRequestSchema:R([OH,fH,lE,VE,qE,JE,sN,FH,bE,EE,WE,AE,xQ,lQ,cQ,Bb,aH]),ClientNotificationSchema:R([S,AH,TQ,CW,sH]),ClientResultSchema:R([j,$E,CE,RW,uE,uQ,a,Ob]),ServerRequestSchema:R([OH,LE,PW,fQ,lQ,cQ,Bb,aH]),ServerNotificationSchema:R([S,AH,PE,wE,QE,AW,oH,sH,IW]),ServerResultSchema:R([j,rN,LW,gQ,BE,aN,CQ,HE,hQ,vQ,uQ,a,Ob]),CallToolResultWireSchema:T().superRefine((wb,l3)=>{if(typeof wb!=="object"||wb===null||Array.isArray(wb)||wb.content!==void 0)return;for(let P9 of uJ)if(P9 in wb){l3.addIssue({code:"custom",message:`content is required when the body carries '${P9}' — another result family cannot default into an empty tools/call success`});return}}).transform(t7).pipe(hQ)}}var a7;function cJ(){return a7??=s7()}function mJ(b){return b.type!=="object"}var e7=new Set(["const","enum","default","examples"]),b5=new Set(["properties","patternProperties","$defs","definitions","dependentSchemas","dependencies"]);function jJ(b){return b!==void 0&&!(typeof b==="string"&&b.startsWith("#"))}function H5(b){let H=typeof b.$schema==="string"?b.$schema:void 0;if(jJ(b.$id))return{...H!==void 0&&{$schema:H},type:"object",properties:{result:b},required:["result"]};let Q=T9(b.$schema)&&b.$recursiveAnchor!==!0,N=(E,M)=>{if(Array.isArray(E))return E.map((D)=>N(D,!1));if(E===null||typeof E!=="object")return E;if(!M&&jJ(E.$id))return E;let _={},Y=!1;for(let[D,J]of Object.entries(E))if(M)_[D]=N(J,!1);else if((D==="$ref"||D==="$dynamicRef")&&typeof J==="string")_[D]=J==="#"?"#/properties/result":J.startsWith("#/")?`#/properties/result${J.slice(1)}`:J;else if(D==="$recursiveRef"&&J==="#"&&Q)Y=!0;else if(e7.has(D))_[D]=J;else if(b5.has(D))_[D]=N(J,!0);else _[D]=N(J,!1);if(Y)if("$ref"in _)_.allOf=[...Array.isArray(_.allOf)?_.allOf:[],{$ref:"#/properties/result"}];else _.$ref="#/properties/result";return _};return{...H!==void 0&&{$schema:H},type:"object",properties:{result:N(b,!1)},required:["result"]}}var iJ={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},pJ={"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},Q5={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},mw;function _9(){if(mw)return mw;let b=cJ();return mw={requestSchemas:{ping:b.PingRequestSchema,initialize:b.InitializeRequestSchema,"completion/complete":b.CompleteRequestSchema,"logging/setLevel":b.SetLevelRequestSchema,"prompts/get":b.GetPromptRequestSchema,"prompts/list":b.ListPromptsRequestSchema,"resources/list":b.ListResourcesRequestSchema,"resources/templates/list":b.ListResourceTemplatesRequestSchema,"resources/read":b.ReadResourceRequestSchema,"resources/subscribe":b.SubscribeRequestSchema,"resources/unsubscribe":b.UnsubscribeRequestSchema,"tools/call":b.CallToolRequestSchema,"tools/list":b.ListToolsRequestSchema,"tasks/get":b.GetTaskRequestSchema,"tasks/result":b.GetTaskPayloadRequestSchema,"tasks/list":b.ListTasksRequestSchema,"tasks/cancel":b.CancelTaskRequestSchema,"sampling/createMessage":b.CreateMessageRequestSchema,"elicitation/create":b.ElicitRequestSchema,"roots/list":b.ListRootsRequestSchema},notificationSchemas:{"notifications/cancelled":b.CancelledNotificationSchema,"notifications/progress":b.ProgressNotificationSchema,"notifications/initialized":b.InitializedNotificationSchema,"notifications/roots/list_changed":b.RootsListChangedNotificationSchema,"notifications/tasks/status":b.TaskStatusNotificationSchema,"notifications/message":b.LoggingMessageNotificationSchema,"notifications/resources/updated":b.ResourceUpdatedNotificationSchema,"notifications/resources/list_changed":b.ResourceListChangedNotificationSchema,"notifications/tools/list_changed":b.ToolListChangedNotificationSchema,"notifications/prompts/list_changed":b.PromptListChangedNotificationSchema,"notifications/elicitation/complete":b.ElicitationCompleteNotificationSchema},resultSchemas:{ping:b.EmptyResultSchema,initialize:b.InitializeResultSchema,"completion/complete":b.CompleteResultSchema,"logging/setLevel":b.EmptyResultSchema,"prompts/get":b.GetPromptResultSchema,"prompts/list":b.ListPromptsResultSchema,"resources/list":b.ListResourcesResultSchema,"resources/templates/list":b.ListResourceTemplatesResultSchema,"resources/read":b.ReadResourceResultSchema,"resources/subscribe":b.EmptyResultSchema,"resources/unsubscribe":b.EmptyResultSchema,"tools/call":b.CallToolResultWireSchema,"tools/list":b.ListToolsResultSchema,"sampling/createMessage":b.CreateMessageResultWithToolsSchema,"elicitation/create":b.ElicitResultSchema,"roots/list":b.ListRootsResultSchema}},mw}function dJ(b){return Object.prototype.hasOwnProperty.call(iJ,b)}function oJ(b){return Object.prototype.hasOwnProperty.call(pJ,b)}function N5(b){return Object.prototype.hasOwnProperty.call(Q5,b)}function E5(b){return N5(b)?_9().resultSchemas[b]:void 0}function M5(b){return dJ(b)?_9().requestSchemas[b]:void 0}function W5(b){return oJ(b)?_9().notificationSchemas[b]:void 0}var yK=Object.keys(iJ),fK=Object.keys(pJ);function Q9(b){return b!==null&&typeof b==="object"&&!Array.isArray(b)}function iw(b,H){if(b===void 0)return{ok:!1,reason:"not-in-era"};let Q=b.safeParse(H);return Q.success?{ok:!0,value:Q.data}:{ok:!1,reason:"invalid",message:String(Q.error)}}var LJ={ok:!1,reason:"not-in-era"};function $J(b){return Q9(b)&&Q9(b.outputSchema)&&mJ(b.outputSchema)}function CJ(b){return b}var w9={era:"2025-11-25",hasRequestMethod:dJ,hasNotificationMethod:oJ,validateRequest:(b,H)=>iw(M5(b),H),validateResult:(b,H)=>iw(E5(b),H),validateNotification:(b,H)=>iw(W5(b),H),hasInputRequestMethod:()=>!1,validateInputRequest:()=>LJ,validateInputResponse:()=>LJ,samplingResultVariant:(b,H)=>{let Q=cJ();return iw(b?Q.CreateMessageResultWithToolsSchema:Q.CreateMessageResultSchema,H)},outboundEnvelope:(b)=>{return},validateEnvelopeMeta:(b)=>[],projectCallToolResult(b,H){let Q=lJ(b),N=Q.structuredContent;if(N===void 0)return Q;let E=typeof N!=="object"||N===null||Array.isArray(N),M=H!==void 0&&mJ(H);if(!E&&!M)return Q;return{...Q,structuredContent:{result:N}}},decodeResult(b,H){if(Q9(H)&&"resultType"in H){let Q={...H};return delete Q.resultType,{kind:"complete",result:CJ(Q)}}return{kind:"complete",result:CJ(H)}},encodeResult(b,H){if(b!=="tools/list")return H;let Q=H.tools;if(!Array.isArray(Q)||!Q.some((N)=>$J(N)))return H;return{...H,tools:Q.map((N)=>$J(N)?{...N,outputSchema:H5(N.outputSchema)}:N)}},encodeErrorCode:(b)=>b===-32002?-32602:b,checkInboundEnvelope:(b)=>{return}};function _5(){let b=gH(()=>R([w(),F(),z(),db(),P(w(),b),q(b)])),H=P(w(),b),Q=R([w(),F().int()]),N=w(),E=R([w(),F().int()]),M=C(["user","assistant"]),_=C(["debug","info","notice","warning","error","critical","alert","emergency"]),Y=w().refine((a)=>{try{return atob(a),!0}catch{return!1}},{message:"Invalid Base64 string"}),D=B({ttl:F().optional()}),J=B({taskId:w()}),K=L({progressToken:Q.optional(),"io.modelcontextprotocol/related-task":J.optional()}),O=B({_meta:K.optional()}),A=O.extend({task:D.optional()}),V=B({_meta:K.optional()}),j=B({method:w(),params:V.loose().optional()}),$=B({src:w(),mimeType:w().optional(),sizes:q(w()).optional(),theme:C(["light","dark"]).optional()}),S=B({icons:q($).optional()}),m=B({name:w(),title:w().optional()}),t=m.extend({...m.shape,...S.shape,version:w(),websiteUrl:w().optional(),description:w().optional()}),l=yb(B({applyDefaults:z().optional()}),H),y=WH((a)=>{if(a&&typeof a==="object"&&!Array.isArray(a)&&Object.keys(a).length===0)return{form:{}};return a},yb(B({form:l.optional(),url:H.optional()}),H.optional())),d=L({list:H.optional(),cancel:H.optional(),requests:L({sampling:L({createMessage:H.optional()}).optional(),elicitation:L({create:H.optional()}).optional()}).optional()}),p=L({list:H.optional(),cancel:H.optional(),requests:L({tools:L({call:H.optional()}).optional()}).optional()}),bb=B({experimental:P(w(),H).optional(),sampling:B({context:H.optional(),tools:H.optional()}).optional(),elicitation:y.optional(),roots:B({listChanged:z().optional()}).optional(),tasks:d.optional(),extensions:P(w(),H).optional()}),eb=B({experimental:P(w(),H).optional(),logging:H.optional(),completions:H.optional(),prompts:B({listChanged:z().optional()}).optional(),resources:B({subscribe:z().optional(),listChanged:z().optional()}).optional(),tools:B({listChanged:z().optional()}).optional(),tasks:p.optional(),extensions:P(w(),H).optional()}),Jb=B({progress:F(),total:Z(F()),message:Z(w())}),GH=B({...V.shape,...Jb.shape,progressToken:Q}),fH=j.extend({method:G("notifications/progress"),params:GH}),nN=V.extend({level:_,logger:w().optional(),data:T()}),rN=j.extend({method:G("notifications/message"),params:nN}),TQ=B({uri:w(),mimeType:Z(w()),_meta:P(w(),T()).optional()}),OH=TQ.extend({text:w()}),lH=TQ.extend({blob:Y}),fb=B({audience:q(M).optional(),priority:F().min(0).max(1).optional(),lastModified:Rb.datetime({offset:!0}).optional()}),AH=B({...m.shape,...S.shape,uri:w(),description:Z(w()),mimeType:Z(w()),size:Z(F()),annotations:fb.optional(),_meta:Z(L({}))}),ZQ=B({...m.shape,...S.shape,uriTemplate:w(),description:Z(w()),mimeType:Z(w()),annotations:fb.optional(),_meta:Z(L({}))}),bH=j.extend({method:G("notifications/resources/list_changed"),params:V.optional()}),HH=V.extend({uri:w()}),jQ=j.extend({method:G("notifications/resources/updated"),params:HH}),LQ=B({name:w(),description:Z(w()),required:Z(z())}),uH=B({...m.shape,...S.shape,description:Z(w()),arguments:Z(q(LQ)),_meta:Z(L({}))}),$Q=j.extend({method:G("notifications/prompts/list_changed"),params:V.optional()}),lb=B({type:G("text"),text:w(),annotations:fb.optional(),_meta:P(w(),T()).optional()}),xb=B({type:G("image"),data:Y,mimeType:w(),annotations:fb.optional(),_meta:P(w(),T()).optional()}),cH=B({type:G("audio"),data:Y,mimeType:w(),annotations:fb.optional(),_meta:P(w(),T()).optional()}),tN=B({type:G("tool_use"),name:w(),id:w(),input:P(w(),T()),_meta:P(w(),T()).optional()}),sN=B({type:G("resource"),resource:R([OH,lH]),annotations:fb.optional(),_meta:P(w(),T()).optional()}),aN=AH.extend({type:G("resource_link")}),FH=R([lb,xb,cH,aN,sN]),CQ=B({role:M,content:FH}),mH=B({title:w().optional(),readOnlyHint:z().optional(),destructiveHint:z().optional(),idempotentHint:z().optional(),openWorldHint:z().optional()}),eN=j.extend({method:G("notifications/tools/list_changed"),params:V.optional()}),bE=B({name:w().optional()}),HE=B({hints:q(bE).optional(),costPriority:F().min(0).max(1).optional(),speedPriority:F().min(0).max(1).optional(),intelligencePriority:F().min(0).max(1).optional()}),QE=B({mode:C(["auto","required","none"]).optional()}),NE=B({type:G("boolean"),title:w().optional(),description:w().optional(),default:z().optional()}),EE=B({type:G("string"),title:w().optional(),description:w().optional(),minLength:F().optional(),maxLength:F().optional(),format:C(["email","uri","date","date-time"]).optional(),default:w().optional()}),ME=B({type:C(["number","integer"]),title:w().optional(),description:w().optional(),minimum:F().optional(),maximum:F().optional(),default:F().optional()}),WE=B({type:G("string"),title:w().optional(),description:w().optional(),enum:q(w()),default:w().optional()}),_E=B({type:G("string"),title:w().optional(),description:w().optional(),oneOf:q(B({const:w(),title:w()})),default:w().optional()}),wE=B({type:G("string"),title:w().optional(),description:w().optional(),enum:q(w()),enumNames:q(w()).optional(),default:w().optional()}),YE=R([WE,_E]),DE=B({type:G("array"),title:w().optional(),description:w().optional(),minItems:F().optional(),maxItems:F().optional(),items:B({type:G("string"),enum:q(w())}),default:q(w()).optional()}),JE=B({type:G("array"),title:w().optional(),description:w().optional(),minItems:F().optional(),maxItems:F().optional(),items:B({anyOf:q(B({const:w(),title:w()}))}),default:q(w()).optional()}),BE=R([DE,JE]),XE=R([wE,YE,BE]),qE=R([XE,NE,EE,ME]),iH=A.extend({mode:G("form").optional(),message:w(),requestedSchema:B({type:G("object"),properties:P(w(),qE),required:q(w()).optional()}).catchall(T())}),pH=B({type:G("ref/resource"),uri:w()}),dH=B({type:G("ref/prompt"),name:w()}),KE=B({uri:w().startsWith("file://"),name:w().optional(),_meta:P(w(),T()).optional()}),VH=bb.shape,GE=B({experimental:VH.experimental,sampling:VH.sampling,elicitation:VH.elicitation,roots:VH.roots,extensions:VH.extensions}),Cb=eb.shape,SQ=B({experimental:Cb.experimental,logging:Cb.logging,completions:Cb.completions,prompts:Cb.prompts,resources:Cb.resources,tools:Cb.tools,extensions:Cb.extensions}),gQ=L({progressToken:Q.optional(),[YQ]:w(),[FN]:t.optional(),[DQ]:GE,[VN]:_.optional()}),oH=B({...m.shape,...S.shape,description:w().optional(),inputSchema:L({$schema:w().optional(),type:G("object")}),outputSchema:L({$schema:w().optional()}).optional(),annotations:mH.optional(),_meta:P(w(),T()).optional()}),OE=B({type:G("tool_result"),toolUseId:w(),content:q(FH),structuredContent:T().optional(),isError:z().optional(),_meta:P(w(),T()).optional()}),kQ=R([lb,xb,cH,tN,OE]),nH=B({role:M,content:R([kQ,q(kQ)]),_meta:P(w(),T()).optional()}),xQ=w(),vQ=L({[xH]:t.optional().catch(void 0)}),hQ=vQ.optional();function _b(a){return L({_meta:hQ,resultType:xQ.default("complete"),...a})}let AE=_b({}),AW=_b({nextCursor:N.optional()}),yQ=_b({content:q(FH),structuredContent:T().optional(),isError:z().optional()}),FE=_b({ttlMs:F().int().min(0),cacheScope:C(["public","private"]),tools:q(oH),nextCursor:N.optional()}),VE=_b({ttlMs:F().int().min(0),cacheScope:C(["public","private"]),prompts:q(uH),nextCursor:N.optional()}),UE=_b({description:w().optional(),messages:q(CQ)}),PE=_b({ttlMs:F().int().min(0),cacheScope:C(["public","private"]),resources:q(AH),nextCursor:N.optional()}),zE=_b({ttlMs:F().int().min(0),cacheScope:C(["public","private"]),resourceTemplates:q(ZQ),nextCursor:N.optional()}),IE=_b({ttlMs:F().int().min(0),cacheScope:C(["public","private"]),contents:q(R([OH,lH]))}),RE=_b({completion:B({values:q(w()).max(100),total:F().int().optional(),hasMore:z().optional()}).loose()}),FW=_b({ttlMs:F().int().min(0),cacheScope:C(["public","private"])}),TE=_b({ttlMs:F().int().min(0).catch(0),cacheScope:C(["public","private"]).catch("private"),supportedVersions:q(w()),capabilities:SQ,instructions:w().optional()}),UH=B({messages:q(nH),modelPreferences:HE.optional(),systemPrompt:w().optional(),includeContext:C(["none","thisServer","allServers"]).optional(),temperature:F().optional(),maxTokens:F().int(),stopSequences:q(w()).optional(),metadata:H.optional(),tools:q(oH).optional(),toolChoice:QE.optional()}),ZE=B({method:G("sampling/createMessage"),params:UH}),jE=B({method:G("roots/list"),params:B({_meta:P(w(),T()).optional()}).optional()}),LE=B({...nH.shape,model:w(),stopReason:w().optional()}),$E=B({roots:q(KE)}),CE=B({action:C(["accept","decline","cancel"]),content:P(w(),R([w(),F(),z(),q(w())])).optional()}),SE=B({mode:G("url"),message:w(),url:w().url()}),gE=R([iH,SE]),kE=B({method:G("elicitation/create"),params:gE}),xE=R([ZE,jE,kE]),vE=R([LE,$E,CE]),hE=P(w(),xE),yE=P(w(),vE),rH=_b({inputRequests:hE.optional(),requestState:w().optional()}),tH={inputResponses:yE.optional(),requestState:w().optional()},VW=B({_meta:gQ,...tH}),UW=L({progressToken:Q.optional()});function Ub(a,aH){return B({method:G(a),params:B({_meta:gQ,...aH})})}function Pb(a,aH){return B({method:G(a),params:B({_meta:UW.optional(),...aH}).optional()})}let fE={name:w(),arguments:P(w(),T()).optional(),...tH},vb={cursor:N.optional()},PW=Ub("tools/call",fE),zW=Ub("tools/list",vb),IW=Ub("prompts/list",vb),RW=Ub("prompts/get",{name:w(),arguments:P(w(),w()).optional(),...tH}),TW=Ub("resources/list",vb),ZW=Ub("resources/templates/list",vb),jW=Ub("resources/read",{uri:w(),...tH}),lE={ref:R([dH,pH]),argument:B({name:w(),value:w()}),context:B({arguments:P(w(),w()).optional()}).optional()},LW=Ub("completion/complete",lE),$W=Ub("server/discover",{}),fQ=B({toolsListChanged:z().optional(),promptsListChanged:z().optional(),resourcesListChanged:z().optional(),resourceSubscriptions:q(w()).optional()}),uE={notifications:fQ},CW=Ub("subscriptions/listen",uE),SW=vQ.extend({"io.modelcontextprotocol/subscriptionId":E}),cE=L({_meta:SW,resultType:xQ.default("complete")}),PH={"tools/call":Pb("tools/call",fE),"tools/list":Pb("tools/list",vb),"prompts/get":Pb("prompts/get",{name:w(),arguments:P(w(),w()).optional()}),"prompts/list":Pb("prompts/list",vb),"resources/list":Pb("resources/list",vb),"resources/templates/list":Pb("resources/templates/list",vb),"resources/read":Pb("resources/read",{uri:w()}),"completion/complete":Pb("completion/complete",lE),"server/discover":Pb("server/discover",{}),"subscriptions/listen":Pb("subscriptions/listen",uE)};function Ob(a){return L({_meta:hQ,...a})}let gW={"tools/call":Ob({content:q(FH),structuredContent:T().optional(),isError:z().optional()}),"tools/list":Ob({ttlMs:F().int().min(0),cacheScope:C(["public","private"]),tools:q(oH),nextCursor:N.optional()}),"prompts/get":Ob({description:w().optional(),messages:q(CQ)}),"prompts/list":Ob({ttlMs:F().int().min(0),cacheScope:C(["public","private"]),prompts:q(uH),nextCursor:N.optional()}),"resources/list":Ob({ttlMs:F().int().min(0),cacheScope:C(["public","private"]),resources:q(AH),nextCursor:N.optional()}),"resources/templates/list":Ob({ttlMs:F().int().min(0),cacheScope:C(["public","private"]),resourceTemplates:q(ZQ),nextCursor:N.optional()}),"resources/read":Ob({ttlMs:F().int().min(0),cacheScope:C(["public","private"]),contents:q(R([OH,lH]))}),"completion/complete":Ob({completion:B({values:q(w()).max(100),total:F().int().optional(),hasMore:z().optional()}).loose()}),"server/discover":Ob({ttlMs:F().int().min(0).catch(0),cacheScope:C(["public","private"]).catch("private"),supportedVersions:q(w()),capabilities:SQ,instructions:w().optional()}),"subscriptions/listen":Ob({})},sH=L({"io.modelcontextprotocol/subscriptionId":E.optional()}),lQ=B({method:G("notifications/subscriptions/acknowledged"),params:B({_meta:sH.optional(),notifications:fQ})}),uQ=B({_meta:sH.optional(),requestId:E,reason:w().optional()}),cQ=B({method:G("notifications/cancelled"),params:uQ}),sw={"notifications/cancelled":cQ,"notifications/progress":fH,"notifications/message":rN,"notifications/resources/updated":jQ,"notifications/resources/list_changed":bH,"notifications/tools/list_changed":eN,"notifications/prompts/list_changed":$Q,"notifications/subscriptions/acknowledged":lQ},Bb=(a)=>B({jsonrpc:G("2.0"),id:R([w(),F().int()]),result:a}).strict();return{JSONValueSchema:b,JSONObjectSchema:H,ProgressTokenSchema:Q,CursorSchema:N,RequestIdSchema:E,RoleSchema:M,LoggingLevelSchema:_,TaskMetadataSchema:D,RelatedTaskMetadataSchema:J,RequestMetaSchema:K,BaseRequestParamsSchema:O,TaskAugmentedRequestParamsSchema:A,NotificationsParamsSchema:V,NotificationSchema:j,IconSchema:$,IconsSchema:S,BaseMetadataSchema:m,ImplementationSchema:t,ClientTasksCapabilitySchema:d,ServerTasksCapabilitySchema:p,ClientCapabilitiesSchema:bb,ServerCapabilitiesSchema:eb,ProgressSchema:Jb,ProgressNotificationParamsSchema:GH,ProgressNotificationSchema:fH,LoggingMessageNotificationParamsSchema:nN,LoggingMessageNotificationSchema:rN,ResourceContentsSchema:TQ,TextResourceContentsSchema:OH,BlobResourceContentsSchema:lH,AnnotationsSchema:fb,ResourceSchema:AH,ResourceTemplateSchema:ZQ,ResourceListChangedNotificationSchema:bH,ResourceUpdatedNotificationParamsSchema:HH,ResourceUpdatedNotificationSchema:jQ,PromptArgumentSchema:LQ,PromptSchema:uH,PromptListChangedNotificationSchema:$Q,TextContentSchema:lb,ImageContentSchema:xb,AudioContentSchema:cH,ToolUseContentSchema:tN,EmbeddedResourceSchema:sN,ResourceLinkSchema:aN,ContentBlockSchema:FH,PromptMessageSchema:CQ,ToolAnnotationsSchema:mH,ToolListChangedNotificationSchema:eN,ModelHintSchema:bE,ModelPreferencesSchema:HE,ToolChoiceSchema:QE,BooleanSchemaSchema:NE,StringSchemaSchema:EE,NumberSchemaSchema:ME,UntitledSingleSelectEnumSchemaSchema:WE,TitledSingleSelectEnumSchemaSchema:_E,LegacyTitledEnumSchemaSchema:wE,SingleSelectEnumSchemaSchema:YE,UntitledMultiSelectEnumSchemaSchema:DE,TitledMultiSelectEnumSchemaSchema:JE,MultiSelectEnumSchemaSchema:BE,EnumSchemaSchema:XE,PrimitiveSchemaDefinitionSchema:qE,ElicitRequestFormParamsSchema:iH,ResourceTemplateReferenceSchema:pH,PromptReferenceSchema:dH,RootSchema:KE,ClientCapabilities2026Schema:GE,ServerCapabilities2026Schema:SQ,RequestMetaEnvelopeSchema:gQ,ToolSchema:oH,ToolResultContentSchema:OE,SamplingMessageContentBlockSchema:kQ,SamplingMessageSchema:nH,ResultTypeSchema:xQ,ResultMetaSchema:vQ,ResultSchema:AE,PaginatedResultSchema:AW,CallToolResultSchema:yQ,ListToolsResultSchema:FE,ListPromptsResultSchema:VE,GetPromptResultSchema:UE,ListResourcesResultSchema:PE,ListResourceTemplatesResultSchema:zE,ReadResourceResultSchema:IE,CompleteResultSchema:RE,CacheableResultSchema:FW,DiscoverResultSchema:TE,CreateMessageRequestParamsSchema:UH,CreateMessageRequestSchema:ZE,ListRootsRequestSchema:jE,CreateMessageResultSchema:LE,ListRootsResultSchema:$E,ElicitResultSchema:CE,ElicitRequestURLParamsSchema:SE,ElicitRequestParamsSchema:gE,ElicitRequestSchema:kE,InputRequestSchema:xE,InputResponseSchema:vE,InputRequestsSchema:hE,InputResponsesSchema:yE,InputRequiredResultSchema:rH,InputResponseRequestParamsSchema:VW,CallToolRequestSchema:PW,ListToolsRequestSchema:zW,ListPromptsRequestSchema:IW,GetPromptRequestSchema:RW,ListResourcesRequestSchema:TW,ListResourceTemplatesRequestSchema:ZW,ReadResourceRequestSchema:jW,CompleteRequestSchema:LW,DiscoverRequestSchema:$W,SubscriptionFilterSchema:fQ,SubscriptionsListenRequestSchema:CW,SubscriptionsListenResultMetaSchema:SW,SubscriptionsListenResultSchema:cE,dispatchRequestSchemas:PH,dispatchResultSchemas:gW,NotificationMetaSchema:sH,SubscriptionsAcknowledgedNotificationSchema:lQ,CancelledNotificationParamsSchema:uQ,CancelledNotificationSchema:cQ,notificationSchemas2026:sw,JSONRPCResultResponseSchema:Bb(AE),CallToolResultResponseSchema:Bb(R([yQ,rH])),ListToolsResultResponseSchema:Bb(FE),ListPromptsResultResponseSchema:Bb(VE),GetPromptResultResponseSchema:Bb(R([UE,rH])),ListResourcesResultResponseSchema:Bb(PE),ListResourceTemplatesResultResponseSchema:Bb(zE),ReadResourceResultResponseSchema:Bb(R([IE,rH])),CompleteResultResponseSchema:Bb(RE),DiscoverResultResponseSchema:Bb(TE),SubscriptionsListenResultResponseSchema:Bb(cE)}}var w5;function hH(){return w5??=_5()}var Y5=["tools/list","prompts/list","resources/list","resources/templates/list","resources/read","server/discover"];function D5(b){return Y5.includes(b)}var Y9=Symbol("modelcontextprotocol.resultCacheHintFallback");function J5(b){return b[Y9]}function nJ(b){return typeof b==="number"&&Number.isSafeInteger(b)&&b>=0}function rJ(b){return b==="public"||b==="private"}var h=function(b){return b[b.ParseError=-32700]="ParseError",b[b.InvalidRequest=-32600]="InvalidRequest",b[b.MethodNotFound=-32601]="MethodNotFound",b[b.InvalidParams=-32602]="InvalidParams",b[b.InternalError=-32603]="InternalError",b[b.ResourceNotFound=-32002]="ResourceNotFound",b[b.MissingRequiredClientCapability=-32021]="MissingRequiredClientCapability",b[b.UnsupportedProtocolVersion=-32022]="UnsupportedProtocolVersion",b[b.UrlElicitationRequired=-32042]="UrlElicitationRequired",b}({}),Wb=class b extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.ProtocolError"})}static[Symbol.hasInstance](H){return Lb(this,H)}static isInstance(H){if(typeof this!=="function")throw TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return Lb(this,H)}constructor(H,Q,N){super(Q);this.code=H,this.data=N,this.name="ProtocolError",PQ(this,new.target)}static fromError(H,Q,N){if(H===h.UrlElicitationRequired&&N){let E=N;if(E.elicitations)return new sJ(E.elicitations,Q)}if(H===h.UnsupportedProtocolVersion&&N){let E=N;if(Array.isArray(E.supported)&&typeof E.requested==="string")return new aJ({supported:E.supported,requested:E.requested},Q)}if(H===h.InvalidParams||H===h.ResourceNotFound){let E=N;if(typeof E?.uri==="string"&&(H===h.ResourceNotFound||Object.keys(E).length===1))return new tJ(E.uri,Q)}if(H===h.MissingRequiredClientCapability&&N){let E=N;if(E.requiredCapabilities!==null&&typeof E.requiredCapabilities==="object"&&!Array.isArray(E.requiredCapabilities))return new eJ({requiredCapabilities:E.requiredCapabilities},Q)}return new b(H,Q,N)}},tJ=class extends Wb{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.ResourceNotFoundError"})}constructor(b,H=`Resource not found: ${b}`){super(h.InvalidParams,H,{uri:b})}get uri(){return this.data.uri}},sJ=class extends Wb{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.UrlElicitationRequiredError"})}constructor(b,H=`URL elicitation${b.length>1?"s":""} required`){super(h.UrlElicitationRequired,H,{elicitations:b})}get elicitations(){return this.data?.elicitations??[]}},aJ=class extends Wb{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.UnsupportedProtocolVersionError"})}constructor(b,H=`Unsupported protocol version: ${b.requested}`){super(h.UnsupportedProtocolVersion,H,b)}get supported(){return this.data.supported}get requested(){return this.data.requested}},eJ=class extends Wb{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.MissingRequiredClientCapabilityError"})}constructor(b,H=`Missing required client capabilities: ${Object.keys(b.requiredCapabilities).join(", ")}`){super(h.MissingRequiredClientCapability,H,b)}get requiredCapabilities(){return this.data.requiredCapabilities}},B5=0,X5="private",q5=["tools/call","prompts/get","resources/read"];function K5(b,H){let Q=H.resultType;if(Q===void 0)return{...H,resultType:"complete"};if(Q==="complete")return H;if(q5.includes(b))return H;throw new Wb(h.InternalError,`Handler for ${b} returned resultType '${String(Q)}', but results of ${b} only support 'complete' on protocol revision 2026-07-28`)}function G5(b,H){let Q=J5(H);if(H.resultType!=="complete"||!D5(b))return Q===void 0?H:U5(H);let N=H,E=nJ(N.ttlMs)?N.ttlMs:F5(Q),M=rJ(N.cacheScope)?N.cacheScope:V5(Q),_={...N,ttlMs:E,cacheScope:M};return delete _[Y9],_}function O5(b){return b!==null&&typeof b==="object"&&!Array.isArray(b)}function A5(b,H){if(H===void 0)return b;let Q=b._meta;if(Q===void 0)return{...b,_meta:{[xH]:H}};if(!O5(Q))return b;if(Q[xH]!==void 0)return b;return{...b,_meta:{...Q,[xH]:H}}}function F5(b){return b!==void 0&&nJ(b.ttlMs)?b.ttlMs:B5}function V5(b){return b!==void 0&&rJ(b.cacheScope)?b.cacheScope:X5}function U5(b){let H={...b};return delete H[Y9],H}var P5=["elicitation/create","sampling/createMessage","roots/list"],pw;function b3(){if(pw)return pw;let b=hH();return pw={request:{"elicitation/create":B({method:G("elicitation/create"),params:b.ElicitRequestParamsSchema}),"sampling/createMessage":B({method:G("sampling/createMessage"),params:b.CreateMessageRequestParamsSchema}),"roots/list":B({method:G("roots/list"),params:L({}).optional()})},response:{"elicitation/create":b.ElicitResultSchema,"sampling/createMessage":b.CreateMessageResultSchema,"roots/list":b.ListRootsResultSchema}},pw}function H3(b){return P5.includes(b)}function tD(b){return H3(b)?b3().request[b]:void 0}function z5(b){return H3(b)?b3().response[b]:void 0}var D9={"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},Q3={"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 N3(b){return Object.prototype.hasOwnProperty.call(D9,b)}function E3(b){return Object.prototype.hasOwnProperty.call(Q3,b)}function I5(b){return Object.prototype.hasOwnProperty.call(D9,b)}function R5(b){return N3(b)?hH().dispatchRequestSchemas[b]:void 0}function T5(b){return I5(b)?hH().dispatchResultSchemas[b]:void 0}function Z5(b){return E3(b)?hH().notificationSchemas2026[b]:void 0}var lK=Object.keys(D9),uK=Object.keys(Q3);function YW(b){return b!==null&&typeof b==="object"&&!Array.isArray(b)}function _W(b,H){if(b===void 0)return{ok:!1,reason:"not-in-era"};let Q=b.safeParse(H);return Q.success?{ok:!0,value:Q.data}:{ok:!1,reason:"invalid",message:String(Q.error)}}var j5={ok:!1,reason:"not-in-era"},L5=[YQ,DQ];function $5(b,H){let Q=H,N=!1,E=()=>{if(!N)Q={...Q},N=!0;return Q},M=H.tools;if(b==="tools/list"&&Array.isArray(M)&&M.some((Y)=>YW(Y)&&("execution"in Y)))E().tools=M.map((Y)=>{if(!YW(Y)||!("execution"in Y))return Y;let D={...Y};return delete D.execution,D});let _=H.capabilities;if(YW(_)&&"tasks"in _){let Y={..._};delete Y.tasks,E().capabilities=Y}return Q}var J9={era:"2026-07-28",hasRequestMethod:N3,hasNotificationMethod:E3,hasInputRequestMethod:(b)=>tD(b)!==void 0,validateRequest:(b,H)=>_W(R5(b),H),validateResult:(b,H)=>_W(T5(b),H),validateNotification:(b,H)=>_W(Z5(b),H),validateInputRequest:(b,H)=>_W(tD(b),H),validateInputResponse:(b,H)=>_W(z5(b),H),samplingResultVariant:()=>j5,outboundEnvelope(b){return{[YQ]:b.protocolVersion,[FN]:b.clientInfo,[DQ]:b.clientCapabilities,...b.logLevel!==void 0&&{[VN]:b.logLevel}}},validateEnvelopeMeta(b){let H=[];for(let N of L5)if(!(N in b))H.push({key:N,problem:"missing"});let Q=hH().RequestMetaEnvelopeSchema.safeParse(b);if(!Q.success)for(let N of Q.error.issues){let E=N.path.map(String),M=E.length>0?E.join("."):"_meta";if(E.length===1&&H.some((_)=>_.key===M&&_.problem==="missing"))continue;H.push({key:M,problem:N.message})}return H},projectCallToolResult:(b)=>lJ(b),inputRequestSchema:tD,decodeResult(b,H){if(!YW(H))return{kind:"invalid",error:new e(Mb.InvalidResult,`Invalid result for ${b}: not an object`,{method:b})};let Q=H.resultType;if(Q===void 0)return{kind:"invalid",error:new e(Mb.InvalidResult,`Invalid result for ${b}: 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:b,violation:"missing-resultType"})};if(typeof Q!=="string")return{kind:"invalid",error:new e(Mb.InvalidResult,`Invalid result for ${b}: non-string resultType`,{method:b,resultType:Q})};if(Q==="input_required"){let _=H.inputRequests,Y=YW(_)?_:{},D=H.requestState,J=H._meta===void 0?void 0:hH().ResultMetaSchema.safeParse(H._meta),K=J?.success?J.data:void 0;if(Object.keys(Y).length===0&&typeof D!=="string")return{kind:"invalid",error:new e(Mb.InvalidResult,`Invalid result for ${b}: input_required carries neither inputRequests nor requestState (every input_required result must include at least one of the two)`,{method:b,violation:"input-required-missing-both"})};return{kind:"input_required",inputRequests:Y,...typeof D==="string"&&{requestState:D},...K!==void 0&&{_meta:K}}}if(Q!=="complete")return{kind:"invalid",error:new e(Mb.UnsupportedResultType,`Unsupported result type '${Q}' for ${b}`,{resultType:Q,method:b})};let N=C5(),E=Object.hasOwn(N,b)?N[b]:void 0;if(E!==void 0){let _=E.safeParse(H);if(!_.success)return{kind:"invalid",error:new e(Mb.InvalidResult,`Invalid result for ${b}: ${_.error}`,{method:b})}}let M={...H};return delete M.resultType,{kind:"complete",result:M}},encodeResult(b,H,Q){return A5(G5(b,K5(b,$5(b,H))),Q)},encodeErrorCode:(b)=>b===-32002?-32602:b,checkInboundEnvelope(b){if(b.envelope===void 0)return"Request is missing the required _meta envelope for protocol revision 2026-07-28 (io.modelcontextprotocol/protocolVersion, io.modelcontextprotocol/clientCapabilities)";let H=hH().RequestMetaEnvelopeSchema.safeParse(b.envelope);if(!H.success)return`Invalid _meta envelope for protocol revision 2026-07-28: ${H.error.issues.map((Q)=>Q.message).join("; ")}`}},dw;function C5(){if(dw)return dw;let b=hH();return dw={"tools/call":b.CallToolResultSchema,"tools/list":b.ListToolsResultSchema,"prompts/get":b.GetPromptResultSchema,"prompts/list":b.ListPromptsResultSchema,"resources/list":b.ListResourcesResultSchema,"resources/templates/list":b.ListResourceTemplatesResultSchema,"resources/read":b.ReadResourceResultSchema,"completion/complete":b.CompleteResultSchema,"server/discover":b.DiscoverResultSchema},dw}var B9="2026-07-28";function JW(b){return b!==void 0&&fJ(b)?J9:w9}function SJ(b){if(b.revision!==void 0)return JW(b.revision).era;return b.era==="modern"?J9.era:w9.era}function sD(b){return M3.some((H)=>H.hasRequestMethod(b))}function aD(b){return M3.some((H)=>H.hasNotificationMethod(b))}function gJ(b){return b==="tasks/get"||b==="tasks/cancel"}var M3=[w9,J9],S5=I9({AnnotationsSchema:()=>rb,AudioContentSchema:()=>OQ,BaseMetadataSchema:()=>ob,BaseRequestParamsSchema:()=>Qb,BlobResourceContentsSchema:()=>kN,BooleanSchemaSchema:()=>yN,CallToolRequestParamsSchema:()=>G0,CallToolRequestSchema:()=>O0,CallToolResultSchema:()=>sb,CancelTaskRequestSchema:()=>gw,CancelTaskResultSchema:()=>kw,CancelledNotificationParamsSchema:()=>IM,CancelledNotificationSchema:()=>ZN,ClientCapabilitiesSchema:()=>TM,ClientNotificationSchema:()=>vw,ClientRequestSchema:()=>xw,ClientResultSchema:()=>hw,ClientTasksCapabilitySchema:()=>Vw,CompatibilityCallToolResultSchema:()=>Pw,CompleteRequestParamsSchema:()=>m0,CompleteRequestSchema:()=>i0,CompleteResultSchema:()=>p0,ContentBlockSchema:()=>jb,CreateMessageRequestParamsSchema:()=>j0,CreateMessageRequestSchema:()=>L0,CreateMessageResultSchema:()=>$0,CreateMessageResultWithToolsSchema:()=>C0,CreateTaskResultSchema:()=>Rw,CursorSchema:()=>PN,DiscoverRequestSchema:()=>CM,DiscoverResultSchema:()=>LN,ElicitRequestFormParamsSchema:()=>UQ,ElicitRequestParamsSchema:()=>v0,ElicitRequestSchema:()=>h0,ElicitRequestURLParamsSchema:()=>x0,ElicitResultSchema:()=>l0,ElicitationCompleteNotificationParamsSchema:()=>y0,ElicitationCompleteNotificationSchema:()=>f0,EmbeddedResourceSchema:()=>XH,EmptyResultSchema:()=>nb,EnumSchemaSchema:()=>k0,GetPromptRequestParamsSchema:()=>W0,GetPromptRequestSchema:()=>_0,GetPromptResultSchema:()=>D0,GetTaskPayloadRequestSchema:()=>Lw,GetTaskPayloadResultSchema:()=>$w,GetTaskRequestSchema:()=>Zw,GetTaskResultSchema:()=>jw,IconSchema:()=>RM,IconsSchema:()=>YH,ImageContentSchema:()=>GQ,ImplementationSchema:()=>Zb,InitializeRequestParamsSchema:()=>ZM,InitializeRequestSchema:()=>jM,InitializeResultSchema:()=>LM,InitializedNotificationSchema:()=>$M,JSONArraySchema:()=>Aw,JSONObjectSchema:()=>o,JSONRPCErrorResponseSchema:()=>XQ,JSONRPCMessageSchema:()=>wH,JSONRPCNotificationSchema:()=>TN,JSONRPCRequestSchema:()=>RN,JSONRPCResponseSchema:()=>Fw,JSONRPCResultResponseSchema:()=>BQ,JSONValueSchema:()=>_H,LegacyTitledEnumSchemaSchema:()=>uN,ListChangedOptionsBaseSchema:()=>zw,ListPromptsRequestSchema:()=>E0,ListPromptsResultSchema:()=>M0,ListResourceTemplatesRequestSchema:()=>yM,ListResourceTemplatesResultSchema:()=>fM,ListResourcesRequestSchema:()=>vM,ListResourcesResultSchema:()=>hM,ListRootsRequestSchema:()=>o0,ListRootsResultSchema:()=>n0,ListTasksRequestSchema:()=>Cw,ListTasksResultSchema:()=>Sw,ListToolsRequestSchema:()=>q0,ListToolsResultSchema:()=>K0,LoggingLevelSchema:()=>hN,LoggingMessageNotificationParamsSchema:()=>U0,LoggingMessageNotificationSchema:()=>AQ,ModelHintSchema:()=>P0,ModelPreferencesSchema:()=>z0,MultiSelectEnumSchemaSchema:()=>g0,NotificationSchema:()=>Eb,NotificationsParamsSchema:()=>Db,NumberSchemaSchema:()=>VQ,PaginatedRequestParamsSchema:()=>kM,PaginatedRequestSchema:()=>DH,PaginatedResultSchema:()=>JH,PingRequestSchema:()=>$N,PrimitiveSchemaDefinitionSchema:()=>iN,ProgressNotificationParamsSchema:()=>gM,ProgressNotificationSchema:()=>CN,ProgressSchema:()=>SM,ProgressTokenSchema:()=>UN,PromptArgumentSchema:()=>Q0,PromptListChangedNotificationSchema:()=>J0,PromptMessageSchema:()=>Y0,PromptReferenceSchema:()=>c0,PromptSchema:()=>N0,ReadResourceRequestParamsSchema:()=>lM,ReadResourceRequestSchema:()=>uM,ReadResourceResultSchema:()=>cM,RelatedTaskMetadataSchema:()=>zM,RequestIdSchema:()=>Tb,RequestMetaSchema:()=>zN,RequestSchema:()=>n,ResourceContentsSchema:()=>SN,ResourceLinkSchema:()=>qH,ResourceListChangedNotificationSchema:()=>mM,ResourceRequestParamsSchema:()=>qQ,ResourceSchema:()=>xN,ResourceTemplateReferenceSchema:()=>u0,ResourceTemplateSchema:()=>xM,ResourceUpdatedNotificationParamsSchema:()=>b0,ResourceUpdatedNotificationSchema:()=>H0,ResultMetaObjectSchema:()=>IN,ResultSchema:()=>r,RoleSchema:()=>BH,RootSchema:()=>d0,RootsListChangedNotificationSchema:()=>r0,SamplingContentSchema:()=>T0,SamplingMessageContentBlockSchema:()=>kH,SamplingMessageSchema:()=>Z0,ServerCapabilitiesSchema:()=>jN,ServerNotificationSchema:()=>fw,ServerRequestSchema:()=>yw,ServerResultSchema:()=>lw,ServerTasksCapabilitySchema:()=>Uw,SetLevelRequestParamsSchema:()=>F0,SetLevelRequestSchema:()=>V0,SingleSelectEnumSchemaSchema:()=>S0,StringSchemaSchema:()=>FQ,SubscribeRequestParamsSchema:()=>iM,SubscribeRequestSchema:()=>pM,SubscriptionFilterSchema:()=>vN,SubscriptionsAcknowledgedNotificationParamsSchema:()=>tM,SubscriptionsAcknowledgedNotificationSchema:()=>sM,SubscriptionsListenRequestParamsSchema:()=>nM,SubscriptionsListenRequestSchema:()=>rM,SubscriptionsListenResultMetaSchema:()=>aM,SubscriptionsListenResultSchema:()=>eM,TaskAugmentedRequestParamsSchema:()=>vH,TaskCreationParamsSchema:()=>Iw,TaskMetadataSchema:()=>PM,TaskSchema:()=>KH,TaskStatusNotificationParamsSchema:()=>s0,TaskStatusNotificationSchema:()=>Tw,TaskStatusSchema:()=>t0,TextContentSchema:()=>KQ,TextResourceContentsSchema:()=>gN,TitledMultiSelectEnumSchemaSchema:()=>mN,TitledSingleSelectEnumSchemaSchema:()=>lN,ToolAnnotationsSchema:()=>B0,ToolChoiceSchema:()=>I0,ToolExecutionSchema:()=>X0,ToolListChangedNotificationSchema:()=>A0,ToolResultContentSchema:()=>R0,ToolSchema:()=>tb,ToolUseContentSchema:()=>w0,UnsubscribeRequestParamsSchema:()=>dM,UnsubscribeRequestSchema:()=>oM,UntitledMultiSelectEnumSchemaSchema:()=>cN,UntitledSingleSelectEnumSchemaSchema:()=>fN});var W3=(b)=>RN.safeParse(b).success,_3=(b)=>TN.safeParse(b).success,N9=(b)=>BQ.safeParse(b).success,w3=(b)=>XQ.safeParse(b).success;var DW=-32020,cK=[{rung:"http-method",order:1,evaluatedAt:"edge",codes:[-32000],conformance:[],rationale:"The modern era is POST-only; GET/DELETE are body-less 2025-era session operations and are method-routed to legacy serving (405 when legacy serving is not configured), before any body is read."},{rung:"jsonrpc-shape",order:2,evaluatedAt:"edge",codes:[h.InvalidRequest],conformance:["server-stateless"],rationale:"The body must be a JSON-RPC request or notification: posted responses and batch arrays containing a modern or invalid element are rejected before classification (element-wise batch rule); all-legacy arrays stay legacy traffic."},{rung:"era-classification",order:3,evaluatedAt:"edge",codes:[DW,h.UnsupportedProtocolVersion],conformance:["server-stateless","http-header-validation","http-custom-header-server-validation"],rationale:"Body-primary era classification with the protocol-version header as a cross-check; a header/body disagreement is rejected with -32020 (HeaderMismatch), and an envelope-less request on a modern-only endpoint is answered with the unsupported-protocol-version error naming the supported revisions."},{rung:"envelope",order:4,evaluatedAt:"edge",codes:[h.InvalidParams],conformance:["server-stateless"],rationale:"A present envelope claim with a malformed envelope — and a missing envelope on a request whose protocol-version header names a modern revision — is an invalid-params rejection naming the offending or missing key(s); never a silent fall back to legacy handling. This is the only place an invalid-params rejection maps to HTTP 400."},{rung:"method-registry",order:5,evaluatedAt:"dispatch",codes:[h.MethodNotFound],conformance:["server-stateless"],rationale:"Method existence outranks parameter validity: a method absent from the negotiated revision’s registry (or with no handler installed) answers method-not-found before params or capabilities are looked at."},{rung:"request-params",order:6,evaluatedAt:"dispatch",codes:[h.InvalidParams],conformance:[],rationale:"Per-method params validation; emitted in-band by the dispatch layer (HTTP 200), never via the ladder status table."},{rung:"standard-header-validation",order:7,evaluatedAt:"pre-dispatch",codes:[DW],conformance:["http-header-validation"],rationale:"SEP-2243 standard `MCP-Protocol-Version` / `Mcp-Method` / `Mcp-Name` headers — presence, sentinel decoding, and `Mcp-Name` ↔ body cross-check — are validated by the HTTP entry on a modern-classified request after the supported-revision gate and before dispatch. The spec requires `MCP-Protocol-Version` and `Mcp-Method` on every modern *request* POST (`Mcp-Name` only for the methods that mirror `params.name` / `params.uri` / `params.taskId`, see `MCP_NAME_HEADER_SOURCE`) and names them in that order, so a request missing several is answered by the earliest. Notification POSTs are exempt: the presence half runs on requests only, so a modern-enveloped notification is dispatched even with no standard headers at all. The classifier’s own header-mismatch cells (protocol-version, `Mcp-Method` mismatch) stay on the edge `era-classification` rung; this rung carries the entry-layer presence/`Mcp-Name` half — including the missing `MCP-Protocol-Version` cell, which cannot live on the edge rung without breaking body-primary classification. Evaluated before the capability gate, the factory call, and the `Mcp-Param-*` rung so a request that fails several rungs is answered by the standard-header rung first. The documented order (after method-registry 5 and request-params 6) is NOT the observed precedence: serveModern evaluates this rung immediately after the supported-revision gate, so a request that also fails a dispatch rung is answered here before the dispatch rungs (5–6) are consulted."},{rung:"client-capabilities",order:8,evaluatedAt:"pre-dispatch",codes:[h.MissingRequiredClientCapability],conformance:["server-stateless"],rationale:"The capability requirement is checked by the HTTP entry, pre-dispatch, against the validated envelope the classifier produced — pinning the spec-mandated HTTP 400 independently of how dispatch- and handler-produced errors are mapped. The documented order (after method resolution and params validation) is preserved observably only while the requirement table is empty: once a served method gains a requirement entry, a request that is missing the capability and would also fail a dispatch rung is answered by this gate first, so the entry must consult the method registry before the gate if the documented precedence is to stay observable."},{rung:"param-header-validation",order:9,evaluatedAt:"pre-dispatch",codes:[DW],conformance:["http-custom-header-server-validation"],rationale:"SEP-2243 `Mcp-Param-*` headers are validated against the named tool’s `x-mcp-header` declarations and the body `arguments` after the tool registry is known and before dispatch reaches the handler; a missing/disagreeing/malformed header is rejected 400 / -32020 with the same shape as the standard-header cross-checks. The documented order (after method resolution and params validation) is preserved observably only when the body `arguments` would otherwise validate: the check runs pre-dispatch, so a `tools/call` that fails BOTH this rung and a dispatch-time rung (e.g. order-6 `request-params`, -32602) is answered by this gate first with 400 / -32020, not by the earlier-ordered rung."}],mK={[h.ParseError]:400,[h.InvalidRequest]:400,[h.MethodNotFound]:404,[h.UnsupportedProtocolVersion]:400,[h.MissingRequiredClientCapability]:400,[DW]:400};function X9(b,H){return DM(b,H)}function wW(b){return new Set(b.flatMap((H)=>Object.keys(H.shape)))}function E9(b){if(b==null)return!1;let H=typeof b;if(H!=="object"&&H!=="function")return!1;if(!("~standard"in b))return!1;return typeof b["~standard"]?.validate==="function"}var kJ=!1,M9="draft-2020-12";function g5(b,H="input"){let Q=b["~standard"],N;if(Q.jsonSchema)N=Q.jsonSchema[H]({target:M9});else if(Q.vendor==="zod"){if(!("_zod"in b))throw Error("Schema appears to be from zod 3, which the SDK cannot convert to JSON Schema. Upgrade to zod >=4.2.0, or wrap your JSON Schema with fromJsonSchema().");if(!kJ)kJ=!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.");N=_Q(b,{target:M9,io:H})}else throw Error(`Schema library "${Q.vendor}" does not implement StandardJSONSchemaV1 (\`~standard.jsonSchema\`). Upgrade to a version that does, or wrap your JSON Schema with fromJsonSchema().`);if(H==="output"){if(N.type!==void 0)return N;return Y3(N)?{type:"object",...N}:N}if(N.type!==void 0&&N.type!=="object")throw Error(`MCP tool and prompt schemas must describe objects (got type: ${JSON.stringify(N.type)}). Wrap your schema in z.object({...}) or equivalent.`);return{type:"object",...N}}function Y3(b){if("properties"in b||"patternProperties"in b||"additionalProperties"in b||"required"in b)return!0;for(let H of["oneOf","anyOf","allOf"]){let Q=b[H];if(Array.isArray(Q)&&Q.length>0)return Q.every((N)=>N!==null&&typeof N==="object"&&(N.type==="object"||Y3(N)))}return!1}function k5(b){if(!b.path?.length)return b.message;return`${b.path.map((H)=>String(typeof H==="object"?H.key:H)).join(".")}: ${b.message}`}async function eD(b,H){let Q=await b["~standard"].validate(H);if(Q.issues&&Q.issues.length>0)return{success:!1,error:Q.issues.map((N)=>k5(N)).join(", ")};return{success:!0,data:Q.value}}function x5(b){let H=_Q(b,{target:M9,io:"input"});return typeof H.pattern==="string"?H.pattern:void 0}var v5=/\\\.\\d\{(\d+)\}/;function h5(b){let H=v5.exec(b),Q=[void 0,-1,0];if(H)Q.push(Number(H[1]));return[!1,!0].flatMap((N)=>[!1,!0].flatMap((E)=>Q.map((M)=>Rb.datetime({local:N,offset:E,precision:M}))))}function y5(b,H){let Q;switch(b){case"email":Q=[d_()];break;case"uri":Q=[qN()];break;case"date":Q=[Rb.date()];break;case"date-time":Q=h5(H);break}return new Set(Q.map((N)=>x5(N)).filter((N)=>N!==void 0))}function f5(b,H,Q){if(Q!=="zod")return!0;return y5(b,H).has(H)}function BW(b){return typeof b==="object"&&b!==null&&!Array.isArray(b)}function l5(b){try{return g5(b,"input")}catch(H){let Q=H instanceof Error?H.message:String(H);throw new Wb(h.InvalidParams,`Elicitation requestedSchema must describe an object with flat primitive properties: ${Q}`)}}var u5=new Set(["$comment","deprecated","description","examples","readOnly","title","writeOnly"]);function q9(b){return u5.has(b)||b.startsWith("x-")}var c5=new Set(["$schema",...Object.keys(UQ.shape.requestedSchema.shape)]),xJ={string:wW([FQ,fN,lN,uN]),number:wW([VQ]),integer:wW([VQ]),boolean:wW([yN]),array:wW([cN,mN])},m5=new Set(FQ.shape.format.unwrap().options);function i5(b,H,Q,N){if(!BW(b))return b;let E=typeof b.type==="string"&&Object.hasOwn(xJ,b.type)?xJ[b.type]:void 0;if(E===void 0)return b;let M={};for(let[_,Y]of Object.entries(b))if(E.has(_)||q9(_))M[_]=Y;else if(_==="pattern"&&b.type==="string"&&typeof b.format==="string"){if(!m5.has(b.format))M[_]=Y;else if(typeof Y!=="string"||!f5(b.format,Y,Q))N.push(`${H}.${_}`)}else N.push(`${H}.${_}`);return M}function p5(b,H){let Q={},N=[];for(let[E,M]of Object.entries(b))if(E==="properties"&&BW(M))Q[E]=Object.fromEntries(Object.entries(M).map(([_,Y])=>[_,i5(Y,`properties.${_}`,H,N)]));else if(c5.has(E))Q[E]=M;else if(!q9(E))N.push(E);if(N.length>0)throw new Wb(h.InvalidParams,`Elicitation requestedSchema contains unsupported JSON Schema constraint(s) after Standard Schema conversion: ${N.join(", ")}`);return Q}function d5(b,H){if(!BW(b.properties))return H;let Q=Object.entries(b.properties).filter(([,N])=>!X9(iN,N).success).map(([N])=>`properties.${N}`);return Q.length>0?Q.join(", "):H}function W9(b,H,Q=""){if(Array.isArray(b)&&Array.isArray(H))return b.flatMap((N,E)=>W9(N,H[E],`${Q}[${E}]`));if(!BW(b)||!BW(H))return[];return Object.entries(b).flatMap(([N,E])=>{let M=Q?`${Q}.${N}`:N;if(!Object.prototype.hasOwnProperty.call(H,N))return q9(N)?[]:[M];return W9(E,H[N],M)})}function o5(b){if(!E9(b.requestedSchema))return{...b,mode:"form",requestedSchema:b.requestedSchema};let H=b.requestedSchema["~standard"].vendor,Q=p5(l5(b.requestedSchema),H),N=X9(UQ.shape.requestedSchema,Q);if(!N.success)throw new Wb(h.InvalidParams,`Elicitation requestedSchema only supports flat primitive properties (string, number, integer, boolean, and string enums): ${d5(Q,N.error.message)}`);let E=W9(Q,N.data);if(E.length>0)throw new Wb(h.InvalidParams,`Elicitation requestedSchema contains unsupported JSON Schema constraint(s) after Standard Schema conversion: ${E.join(", ")}`);let M=(N.data.required??[]).filter((_)=>!Object.prototype.hasOwnProperty.call(N.data.properties,_));if(M.length>0)throw new Wb(h.InvalidParams,`Elicitation requestedSchema lists required properties that are not defined in properties: ${M.join(", ")}`);return{...b,mode:"form",requestedSchema:N.data}}function n5(b){let H=b.inputRequests!==void 0&&Object.keys(b.inputRequests).length>0,Q=typeof b.requestState==="string";if(!H&&!Q)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",...b.inputRequests!==void 0&&{inputRequests:b.inputRequests},...b.requestState!==void 0&&{requestState:b.requestState}}}var iK=Object.assign(n5,{elicit(b){try{return{method:"elicitation/create",params:o5(b)}}catch(H){throw H instanceof Wb?TypeError(H.message,{cause:H}):H}},elicitUrl(b){return{method:"elicitation/create",params:{...b,mode:"url"}}},createMessage(b){return{method:"sampling/createMessage",params:b}},listRoots(){return{method:"roots/list"}}});var r5=["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"],t5={IdJagTokenExchangeResponseSchema:QW,OAuthClientInformationFullSchema:WW,OAuthClientInformationSchema:MW,OAuthClientMetadataSchema:EW,OAuthClientRegistrationErrorSchema:uw,OAuthErrorResponseSchema:NW,OAuthMetadataSchema:pN,OAuthProtectedResourceMetadataSchema:a0,OAuthTokenRevocationRequestSchema:cw,OAuthTokensSchema:HW,OpenIdProviderDiscoveryMetadataSchema:bW,OpenIdProviderMetadataSchema:e0},D3={},J3={};function B3(b,H){let Q=b.slice(0,-6);D3[Q]=H,J3[Q]=(N)=>H.safeParse(N).success}for(let b of r5)B3(b,S5[b]);for(let[b,H]of Object.entries(t5))B3(b,H);var s5=Object.freeze(D3),a5=Object.freeze(J3);function e5(b){switch(b){case"initialize":case"notifications/initialized":return JW(void 0);case"server/discover":return JW(B9);default:return}}var X3=60000,bX=[YQ,FN,DQ,VN],HX=["inputResponses","requestState"];function vJ(b,H){let Q=b.params;if(!b9(Q))return{message:b,lifted:{}};let N=Q._meta,E=b9(N)?bX.filter((D)=>(D in N)):[],M=H==="request"?HX.filter((D)=>(D in Q)):[];if(E.length===0&&M.length===0)return{message:b,lifted:{}};let _={},Y={...Q};if(E.length>0&&b9(N)){let D={},J={...N};for(let K of E)D[K]=N[K],delete J[K];if(_.envelope=D,Object.keys(J).length>0)Y._meta=J;else delete Y._meta}for(let D of M){if(D==="inputResponses")_.inputResponses=Y[D];if(D==="requestState")_.requestState=Y[D];delete Y[D]}return{message:{...b,params:Y},lifted:_}}function hJ(b,H){let Q=b.validateResult(H,void 0);if(!Q.ok&&Q.reason==="not-in-era")return;return{"~standard":{version:1,vendor:"mcp-wire-codec",validate(N){let E=b.validateResult(H,N);if(E.ok)return{value:E.value};return{issues:[{message:E.reason==="invalid"?E.message:`not-in-era: ${H}`}]}}}}}function q3(b){return()=>b}var QX=q3(void 0),NX,XW=class{_transport;_requestMessageId=0;_requestHandlers=new Map;_customSchemaRequestMethods=new Set;_requestHandlerAbortControllers=new Map;_notificationHandlers=new Map;_responseHandlers=new Map;_progressHandlers=new Map;_timeoutInfo=new Map;_pendingDebouncedNotifications=new Set;_negotiatedProtocolVersion;static{NX=(b,H)=>{b._negotiatedProtocolVersion=H}}_supportedProtocolVersions;onclose;onerror;fallbackRequestHandler;fallbackNotificationHandler;constructor(b){this._options=b,this._supportedProtocolVersions=b?.supportedProtocolVersions??Kw,this.setNotificationHandler("notifications/cancelled",(H)=>{this._oncancel(H)}),this.setNotificationHandler("notifications/progress",(H)=>{this._onprogress(H)}),this.setRequestHandler("ping",(H)=>({}))}_shouldDropInbound(b){}_outboundMetaEnvelope(){}_envelopeOutbound(b){let H=this._outboundMetaEnvelope();if(H===void 0)return b;let Q=b.params??{};return{...b,params:{...Q,_meta:{...H,...Q._meta}}}}_resolveNonCompleteResult(b,H){return Promise.reject(new e(Mb.UnsupportedResultType,`Unsupported result type '${b.kind}' for ${H.request.method}`,{resultType:b.kind,method:H.request.method}))}_getRequestHandler(b){return this._requestHandlers.get(b)}async _oncancel(b){if(b.params.requestId===void 0)return;this._requestHandlerAbortControllers.get(b.params.requestId)?.abort(b.params.reason)}_setupTimeout(b,H,Q,N,E=!1){this._timeoutInfo.set(b,{timeoutId:setTimeout(N,H),startTime:Date.now(),timeout:H,maxTotalTimeout:Q,resetTimeoutOnProgress:E,onTimeout:N})}_resetTimeout(b){let H=this._timeoutInfo.get(b);if(!H)return!1;let Q=Date.now()-H.startTime;if(H.maxTotalTimeout&&Q>=H.maxTotalTimeout)throw this._timeoutInfo.delete(b),new e(Mb.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:H.maxTotalTimeout,totalElapsed:Q});return clearTimeout(H.timeoutId),H.timeoutId=setTimeout(H.onTimeout,H.timeout),!0}_cleanupTimeout(b){let H=this._timeoutInfo.get(b);if(H)clearTimeout(H.timeoutId),this._timeoutInfo.delete(b)}async connect(b){this._transport=b;let H=this.transport?.onclose;this._transport.onclose=()=>{try{H?.()}finally{this._onclose()}};let Q=this.transport?.onerror;this._transport.onerror=(E)=>{Q?.(E),this._onerror(E)};let N=this._transport?.onmessage;this._transport.onmessage=(E,M)=>{if(N?.(E,M),N9(E)||w3(E))this._onresponse(E);else if(W3(E))this._onrequest(E,M);else if(_3(E))this._onnotification(E,M);else this._onerror(Error(`Unknown message type: ${JSON.stringify(E)}`))},b.setSupportedProtocolVersions?.(this._supportedProtocolVersions),await this._transport.start()}_onclose(){let b=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._pendingDebouncedNotifications.clear();for(let N of this._timeoutInfo.values())clearTimeout(N.timeoutId);this._timeoutInfo.clear();let H=this._requestHandlerAbortControllers;this._requestHandlerAbortControllers=new Map;let Q=new e(Mb.ConnectionClosed,"Connection closed");this._transport=void 0;try{this.onclose?.()}finally{for(let N of b.values())N(Q);for(let N of H.values())N.abort(Q)}}_onerror(b){this.onerror?.(b)}_onnotification(b,H){let{message:Q}=vJ(b,"notification"),N=this._negotiatedWireCodec();if(H?.classification===void 0&&this._shouldDropInbound(b)==="drop")return;if(H?.classification!==void 0){let _=SJ(H.classification);if(_!==N.era){this._onerror(Error(`Era mismatch on inbound notification '${Q.method}': classified as ${_} but this instance serves ${N.era}`));return}}if(aD(Q.method)&&!N.hasNotificationMethod(Q.method))return;let E=this._notificationHandlers.get(Q.method),M=this.fallbackNotificationHandler;if(E===void 0&&M===void 0)return;Promise.resolve().then(()=>E===void 0?M(Q):E(Q,N)).catch((_)=>this._onerror(Error(`Uncaught error in notification handler: ${_}`)))}_onrequest(b,H){let{message:Q,lifted:N}=vJ(b,"request"),E=this._negotiatedWireCodec();if(H?.classification===void 0&&this._shouldDropInbound(b)==="drop"){this._onerror(Error(`Dropped inbound request '${b.method}': not servable on this connection's protocol era`));return}let M=this._transport,_=($,S,m)=>{let t={jsonrpc:"2.0",id:Q.id,error:{code:$,message:S,...m!==void 0&&{data:m}}};M?.send(t).catch((l)=>this._onerror(Error(`Failed to send an error response: ${l}`)))};if(H?.classification!==void 0){let $=SJ(H.classification);if($!==E.era){this._onerror(Error(`Era mismatch on inbound request '${Q.method}': classified as ${$} but this instance serves ${E.era}`));let S=H.classification.revision??$;_(h.UnsupportedProtocolVersion,`Unsupported protocol version: ${S}`,{supported:this._supportedProtocolVersions,requested:S});return}}if(sD(Q.method)&&!E.hasRequestMethod(Q.method)&&!(gJ(Q.method)&&this._customSchemaRequestMethods.has(Q.method))){_(h.MethodNotFound,"Method not found");return}let Y=this._requestHandlers.get(Q.method)??this.fallbackRequestHandler;if(Y===void 0){_(h.MethodNotFound,"Method not found");return}let D=E.checkInboundEnvelope(N);if(D!==void 0){_(h.InvalidParams,D);return}let J=($,S)=>this._notificationViaCodec(this._resolveOutboundCodec($.method),$,{...S,relatedRequestId:Q.id}),K=($,S,m)=>this._requestWithSchemaViaCodec(this._resolveOutboundCodec($.method),$,S,{...m,relatedRequestId:Q.id}),O=new AbortController;this._requestHandlerAbortControllers.set(Q.id,O);let A=N.inputResponses===void 0?void 0:EX(N.inputResponses),V={sessionId:M?.sessionId,mcpReq:{id:Q.id,method:Q.method,_meta:Q.params?._meta,...N.envelope!==void 0&&{envelope:N.envelope},...A!==void 0&&{inputResponses:A.accepted},...A!==void 0&&A.droppedKeys.length>0&&{droppedInputResponseKeys:A.droppedKeys},requestState:N.requestState===void 0?QX:q3(N.requestState),signal:O.signal,send:($,S,m)=>{let t=this._resolveOutboundCodec($.method);if(this._assertOutboundRequestInEra(t,$.method),E9(S))return K($,S,m);let l=hJ(t,$.method);if(l===void 0)throw TypeError(`'${$.method}' is not a spec method; pass a result schema as the second argument to ctx.mcpReq.send().`);return K($,l,S)},notify:J},http:H?.authInfo?{authInfo:H.authInfo}:void 0},j=this.buildContext(V,H);Promise.resolve().then(()=>Y(Q,j)).then(async($)=>{if(O.signal.aborted)return;let S;try{S=E.encodeResult(Q.method,$,this._outboundServerInfo())}catch(t){this._onerror(Error(`Failed to encode result for ${Q.method}: ${t}`)),_(h.InternalError,"Internal error");return}let m={result:S,jsonrpc:"2.0",id:Q.id};await M?.send(m)},async($)=>{if(O.signal.aborted)return;let S=Number.isSafeInteger($.code)?$.code:h.InternalError,m={jsonrpc:"2.0",id:Q.id,error:{code:E.encodeErrorCode(S),message:$.message??"Internal error",...$.data!==void 0&&{data:$.data}}};await M?.send(m)}).catch(($)=>this._onerror(Error(`Failed to send response: ${$}`))).finally(()=>{if(this._requestHandlerAbortControllers.get(Q.id)===O)this._requestHandlerAbortControllers.delete(Q.id)})}_onprogress(b){let{progressToken:H,...Q}=b.params,N=Number(H),E=this._progressHandlers.get(N);if(!E){this._onerror(Error(`Received a progress notification for an unknown token: ${JSON.stringify(b)}`));return}let M=this._responseHandlers.get(N),_=this._timeoutInfo.get(N);if(_&&M&&_.resetTimeoutOnProgress)try{this._resetTimeout(N)}catch(Y){this._responseHandlers.delete(N),this._progressHandlers.delete(N),this._cleanupTimeout(N),M(Y);return}E(Q)}_onresponse(b){let H=Number(b.id),Q=this._responseHandlers.get(H);if(Q===void 0){this._onerror(Error(`Received a response for an unknown message ID: ${JSON.stringify(b)}`));return}if(this._responseHandlers.delete(H),this._cleanupTimeout(H),this._progressHandlers.delete(H),N9(b))Q(b);else Q(Wb.fromError(b.error.code,b.error.message,b.error.data))}get transport(){return this._transport}async close(){await this._transport?.close()}request(b,H,Q){let N=this._resolveOutboundCodec(b.method);if(E9(H)){if(!gJ(b.method))this._assertOutboundRequestInEra(N,b.method);return this._requestWithSchemaViaCodec(N,b,H,Q)}this._assertOutboundRequestInEra(N,b.method);let E=hJ(N,b.method);if(E===void 0)throw TypeError(`'${b.method}' is not a spec method; pass a result schema as the second argument to request().`);return this._requestWithSchemaViaCodec(N,b,E,H)}_negotiatedWireCodec(){return JW(this._negotiatedProtocolVersion)}_wireCodec(){return this._negotiatedWireCodec()}_resolveOutboundCodec(b){if(this._negotiatedProtocolVersion===void 0){let H=e5(b);if(H)return H}return this._negotiatedWireCodec()}_assertOutboundRequestInEra(b,H){if(sD(H)&&!b.hasRequestMethod(H))throw new e(Mb.MethodNotSupportedByProtocolVersion,`Method '${H}' is not supported by the negotiated protocol version (wire era ${b.era})`,{method:H,era:b.era})}_requestWithSchema(b,H,Q){let N=this._resolveOutboundCodec(b.method);return this._assertOutboundRequestInEra(N,b.method),this._requestWithSchemaViaCodec(N,b,H,Q)}_requestWithSchemaViaCodec(b,H,Q,N){let{relatedRequestId:E,resumptionToken:M,onresumptiontoken:_,headers:Y}=N??{},D=Date.now(),J,K;return new Promise((O,A)=>{let V=(p)=>{A(p)};if(!this._transport){V(Error("Not connected"));return}if(this._options?.enforceStrictCapabilities===!0)try{this.assertCapabilityForMethod(H.method)}catch(p){V(p);return}if(N?.signal?.aborted){let p=N.signal.reason;throw p instanceof e?p:new e(Mb.RequestTimeout,String(p))}let j=b.era===B9&&this._transport.hasPerRequestStream===!0?new AbortController:void 0,$=this._requestMessageId++;K=$;let S={...H,jsonrpc:"2.0",id:$};if(N?.onprogress)this._progressHandlers.set($,N.onprogress),S.params={...H.params,_meta:{...H.params?._meta,progressToken:$}};let m=this._envelopeOutbound(S),t=!1,l=(p)=>{if(t)return;if(this._progressHandlers.delete($),j===void 0){if(H.method!=="initialize")this._transport?.send(this._envelopeOutbound({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:$,reason:String(p)}}),{relatedRequestId:E,resumptionToken:M,onresumptiontoken:_}).catch((bb)=>this._onerror(Error(`Failed to send cancellation: ${bb}`)))}else j.abort();A(p instanceof e?p:new e(Mb.RequestTimeout,String(p)))};this._responseHandlers.set($,(p)=>{if(N?.signal?.aborted)return;if(t=!0,p instanceof Error)return A(p);let bb;try{bb=b.decodeResult(H.method,p.result)}catch(Jb){return A(Jb instanceof Error?Jb:Error(String(Jb)))}if(bb.kind==="invalid")return A(bb.error);if(bb.kind==="input_required"){if(N?.allowInputRequired===!0)return O(MX(bb));let Jb={codec:b,request:H,resultSchema:Q,options:N,flowStartedAt:D,retry:(GH,fH)=>this._requestWithSchemaViaCodec(b,GH===void 0?{method:H.method}:{method:H.method,params:GH},Q,fH)};return O(this._resolveNonCompleteResult(bb,Jb))}let eb=bb.result;eD(Q,eb).then((Jb)=>{if(Jb.success)O(Jb.data);else A(new e(Mb.InvalidResult,`Invalid result for ${H.method}: ${Jb.error}`))},A)}),J=()=>l(N?.signal?.reason),N?.signal?.addEventListener("abort",J,{once:!0});let y=N?.timeout??X3,d=()=>l(new e(Mb.RequestTimeout,"Request timed out",{timeout:y}));this._setupTimeout($,y,N?.maxTotalTimeout,d,N?.resetTimeoutOnProgress??!1),this._transport.send(m,{relatedRequestId:E,resumptionToken:M,onresumptiontoken:_,headers:Y,requestSignal:j?.signal}).catch((p)=>{this._progressHandlers.delete($),A(p)})}).finally(()=>{if(J)N?.signal?.removeEventListener("abort",J);if(K!==void 0)this._responseHandlers.delete(K),this._cleanupTimeout(K)})}async notification(b,H){return await this._notificationViaCodec(this._resolveOutboundCodec(b.method),b,H)}async _notificationViaCodec(b,H,Q){if(!this._transport)throw new e(Mb.NotConnected,"Not connected");if(aD(H.method)&&!b.hasNotificationMethod(H.method))throw new e(Mb.MethodNotSupportedByProtocolVersion,`Notification '${H.method}' is not supported by the negotiated protocol version (wire era ${b.era})`,{method:H.method,era:b.era});this.assertNotificationCapability(H.method);let N=this._envelopeOutbound({jsonrpc:"2.0",...H});if((this._options?.debouncedNotificationMethods??[]).includes(H.method)&&!H.params&&Q?.relatedRequestId===void 0){if(this._pendingDebouncedNotifications.has(H.method))return;this._pendingDebouncedNotifications.add(H.method),Promise.resolve().then(()=>{if(this._pendingDebouncedNotifications.delete(H.method),!this._transport)return;this._transport?.send(N,Q).catch((E)=>this._onerror(E))});return}await this._transport.send(N,Q)}setRequestHandler(b,H,Q){this.assertRequestHandlerCapability(b);let N;if(typeof H==="function"){if(!sD(b))throw TypeError(`'${b}' is not a spec request method; pass schemas as the second argument to setRequestHandler().`);N=(E,M)=>{let _=this._negotiatedWireCodec(),Y=_.validateRequest(b,E);if(!Y.ok&&Y.reason==="not-in-era")Y=_.validateInputRequest(b,E);if(!Y.ok){if(Y.reason==="not-in-era")throw new Wb(h.InternalError,`No wire schema for ${b} in the resolved era`);throw Error(Y.message)}return Promise.resolve(H(Y.value,M))}}else if(Q)N=async(E,M)=>{let _=await eD(H.params,{...E.params});if(!_.success)throw new Wb(h.InvalidParams,`Invalid params for ${b}: ${_.error}`);return Q(_.data,M)};else throw TypeError("setRequestHandler: handler is required");if(typeof H==="function")this._customSchemaRequestMethods.delete(b);else this._customSchemaRequestMethods.add(b);this._requestHandlers.set(b,this._wrapHandler(b,N))}_wrapHandler(b,H){return H}_outboundServerInfo(){}removeRequestHandler(b){this._requestHandlers.delete(b),this._customSchemaRequestMethods.delete(b)}assertCanSetRequestHandler(b){if(this._requestHandlers.has(b))throw Error(`A request handler for ${b} already exists, which would be overridden`)}setNotificationHandler(b,H,Q){if(typeof H==="function"){if(!aD(b))throw TypeError(`'${b}' is not a spec notification method; pass schemas as the second argument to setNotificationHandler().`);this._notificationHandlers.set(b,(N,E)=>{let M=E.validateNotification(b,N);if(!M.ok){if(M.reason==="not-in-era")throw new Wb(h.InternalError,`No wire schema for ${b} in the resolved era`);throw Error(M.message)}return Promise.resolve(H(M.value))});return}if(!Q)throw TypeError("setNotificationHandler: handler is required");this._notificationHandlers.set(b,async(N)=>{let E=await eD(H.params,{...N.params});if(!E.success)throw new Wb(h.InvalidParams,`Invalid params for notification ${b}: ${E.error}`);await Q(E.data,N)})}removeNotificationHandler(b){this._notificationHandlers.delete(b)}};function b9(b){return b!==null&&typeof b==="object"&&!Array.isArray(b)}function yJ(b){return typeof b==="object"&&b!==null&&!Array.isArray(b)}function EX(b){let H={},Q=[];if(!yJ(b))return{accepted:H,droppedKeys:Q};for(let[N,E]of Object.entries(b)){if(!yJ(E)||"method"in E||"result"in E){Q.push(N);continue}H[N]=E}return{accepted:H,droppedKeys:Q}}function MX(b){return{resultType:"input_required",inputRequests:b.inputRequests,...b.requestState!==void 0&&{requestState:b.requestState},...b._meta!==void 0&&{_meta:b._meta}}}/*!
64
+ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let a of e.seen.entries()){let u=a[1];if(t===a[0]){i(a);continue}if(e.external){let p=e.external.registry.get(a[0])?.id;if(t!==a[0]&&p){i(a);continue}}if(e.metadataRegistry.get(a[0])?.id){i(a);continue}if(u.cycle){i(a);continue}if(u.count>1){if(e.reused==="ref"){i(a);continue}}}}function rn(e,t){let o=e.seen.get(t);if(!o)throw Error("Unprocessed schema. This is a bug in Zod.");let r=(u)=>{let d=e.seen.get(u);if(d.ref===null)return;let p=d.def??d.schema,f={...p},b=d.ref;if(d.ref=null,b){r(b);let z=e.seen.get(b),E=z.schema;if(E.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0"))p.allOf=p.allOf??[],p.allOf.push(E);else Object.assign(p,E);if(Object.assign(p,f),u._zod.parent===b)for(let k in p){if(k==="$ref"||k==="allOf")continue;if(!(k in f))delete p[k]}if(E.$ref&&z.def)for(let k in p){if(k==="$ref"||k==="allOf")continue;if(k in z.def&&JSON.stringify(p[k])===JSON.stringify(z.def[k]))delete p[k]}}let y=u._zod.parent;if(y&&y!==b){r(y);let z=e.seen.get(y);if(z?.schema.$ref){if(p.$ref=z.schema.$ref,z.def)for(let E in p){if(E==="$ref"||E==="allOf")continue;if(E in z.def&&JSON.stringify(p[E])===JSON.stringify(z.def[E]))delete p[E]}}}e.override({zodSchema:u,jsonSchema:p,path:d.path??[]})};for(let u of[...e.seen.entries()].reverse())r(u[0]);let n={};if(e.target==="draft-2020-12")n.$schema="https://json-schema.org/draft/2020-12/schema";else if(e.target==="draft-07")n.$schema="http://json-schema.org/draft-07/schema#";else if(e.target==="draft-04")n.$schema="http://json-schema.org/draft-04/schema#";else if(e.target==="openapi-3.0");if(e.external?.uri){let u=e.external.registry.get(t)?.id;if(!u)throw Error("Schema is missing an `id` property");n.$id=e.external.uri(u)}Object.assign(n,o.def??o.schema);let i=e.metadataRegistry.get(t)?.id;if(i!==void 0&&n.id===i)delete n.id;let a=e.external?.defs??{};for(let u of e.seen.entries()){let d=u[1];if(d.def&&d.defId){if(d.def.id===d.defId)delete d.def.id;a[d.defId]=d.def}}if(e.external);else if(Object.keys(a).length>0)if(e.target==="draft-2020-12")n.$defs=a;else n.definitions=a;try{let u=JSON.parse(JSON.stringify(n));return Object.defineProperty(u,"~standard",{value:{...t["~standard"],jsonSchema:{input:en(t,"input",e.processors),output:en(t,"output",e.processors)}},enumerable:!1,writable:!1}),u}catch(u){throw Error("Error converting schema to JSON.")}}function le(e,t){let o=t??{seen:new Set};if(o.seen.has(e))return!1;o.seen.add(e);let r=e._zod.def;if(r.type==="transform")return!0;if(r.type==="array")return le(r.element,o);if(r.type==="set")return le(r.valueType,o);if(r.type==="lazy")return le(r.getter(),o);if(r.type==="promise"||r.type==="optional"||r.type==="nonoptional"||r.type==="nullable"||r.type==="readonly"||r.type==="default"||r.type==="prefault")return le(r.innerType,o);if(r.type==="intersection")return le(r.left,o)||le(r.right,o);if(r.type==="record"||r.type==="map")return le(r.keyType,o)||le(r.valueType,o);if(r.type==="pipe"){if(e._zod.traits.has("$ZodCodec"))return!0;return le(r.in,o)||le(r.out,o)}if(r.type==="object"){for(let n in r.shape)if(le(r.shape[n],o))return!0;return!1}if(r.type==="union"){for(let n of r.options)if(le(n,o))return!0;return!1}if(r.type==="tuple"){for(let n of r.items)if(le(n,o))return!0;if(r.rest&&le(r.rest,o))return!0;return!1}return!1}var _p=(e,t={})=>(o)=>{let r=tn({...o,processors:t});return j(e,r),on(r,e),rn(r,e)},en=(e,t,o={})=>(r)=>{let{libraryOptions:n,target:i}=r??{},a=tn({...n??{},target:i,io:t,processors:o});return j(e,a),on(a,e),rn(a,e)};var af={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},dc=(e,t,o,r)=>{let n=o;n.type="string";let{minimum:i,maximum:a,format:u,patterns:d,contentEncoding:p}=e._zod.bag;if(typeof i==="number")n.minLength=i;if(typeof a==="number")n.maxLength=a;if(u){if(n.format=af[u]??u,n.format==="")delete n.format;if(u==="time")delete n.format}if(p)n.contentEncoding=p;if(d&&d.size>0){let f=[...d];if(f.length===1)n.pattern=f[0].source;else if(f.length>1)n.allOf=[...f.map((b)=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:b.source}))]}},pc=(e,t,o,r)=>{let n=o,{minimum:i,maximum:a,format:u,multipleOf:d,exclusiveMaximum:p,exclusiveMinimum:f}=e._zod.bag;if(typeof u==="string"&&u.includes("int"))n.type="integer";else n.type="number";let b=typeof f==="number"&&f>=(i??Number.NEGATIVE_INFINITY),y=typeof p==="number"&&p<=(a??Number.POSITIVE_INFINITY),z=t.target==="draft-04"||t.target==="openapi-3.0";if(b)if(z)n.minimum=f,n.exclusiveMinimum=!0;else n.exclusiveMinimum=f;else if(typeof i==="number")n.minimum=i;if(y)if(z)n.maximum=p,n.exclusiveMaximum=!0;else n.exclusiveMaximum=p;else if(typeof a==="number")n.maximum=a;if(typeof d==="number")n.multipleOf=d},hc=(e,t,o,r)=>{o.type="boolean"},yp=(e,t,o,r)=>{if(t.unrepresentable==="throw")throw Error("BigInt cannot be represented in JSON Schema")},vp=(e,t,o,r)=>{if(t.unrepresentable==="throw")throw Error("Symbols cannot be represented in JSON Schema")},mc=(e,t,o,r)=>{if(t.target==="openapi-3.0")o.type="string",o.nullable=!0,o.enum=[null];else o.type="null"},fc=(e,t,o,r)=>{if(t.unrepresentable==="throw")throw Error("Undefined cannot be represented in JSON Schema")},zp=(e,t,o,r)=>{if(t.unrepresentable==="throw")throw Error("Void cannot be represented in JSON Schema")},gc=(e,t,o,r)=>{o.not={}},Sc=(e,t,o,r)=>{},_c=(e,t,o,r)=>{},Rp=(e,t,o,r)=>{if(t.unrepresentable==="throw")throw Error("Date cannot be represented in JSON Schema")},bc=(e,t,o,r)=>{let n=e._zod.def,i=zi(n.entries);if(i.every((a)=>typeof a==="number"))o.type="number";if(i.every((a)=>typeof a==="string"))o.type="string";o.enum=i},yc=(e,t,o,r)=>{let n=e._zod.def,i=[];for(let a of n.values)if(a===void 0){if(t.unrepresentable==="throw")throw Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof a==="bigint")if(t.unrepresentable==="throw")throw Error("BigInt literals cannot be represented in JSON Schema");else i.push(Number(a));else i.push(a);if(i.length===0);else if(i.length===1){let a=i[0];if(o.type=a===null?"null":typeof a,t.target==="draft-04"||t.target==="openapi-3.0")o.enum=[a];else o.const=a}else{if(i.every((a)=>typeof a==="number"))o.type="number";if(i.every((a)=>typeof a==="string"))o.type="string";if(i.every((a)=>typeof a==="boolean"))o.type="boolean";if(i.every((a)=>a===null))o.type="null";o.enum=i}},wp=(e,t,o,r)=>{if(t.unrepresentable==="throw")throw Error("NaN cannot be represented in JSON Schema")},xp=(e,t,o,r)=>{let n=o,i=e._zod.pattern;if(!i)throw Error("Pattern not found in template literal");n.type="string",n.pattern=i.source},Tp=(e,t,o,r)=>{let n=o,i={type:"string",format:"binary",contentEncoding:"binary"},{minimum:a,maximum:u,mime:d}=e._zod.bag;if(a!==void 0)i.minLength=a;if(u!==void 0)i.maxLength=u;if(d)if(d.length===1)i.contentMediaType=d[0],Object.assign(n,i);else Object.assign(n,i),n.anyOf=d.map((p)=>({contentMediaType:p}));else Object.assign(n,i)},Ep=(e,t,o,r)=>{o.type="boolean"},vc=(e,t,o,r)=>{if(t.unrepresentable==="throw")throw Error("Custom types cannot be represented in JSON Schema")},Pp=(e,t,o,r)=>{if(t.unrepresentable==="throw")throw Error("Function types cannot be represented in JSON Schema")},zc=(e,t,o,r)=>{if(t.unrepresentable==="throw")throw Error("Transforms cannot be represented in JSON Schema")},kp=(e,t,o,r)=>{if(t.unrepresentable==="throw")throw Error("Map cannot be represented in JSON Schema")},$p=(e,t,o,r)=>{if(t.unrepresentable==="throw")throw Error("Set cannot be represented in JSON Schema")},Rc=(e,t,o,r)=>{let n=o,i=e._zod.def,{minimum:a,maximum:u}=e._zod.bag;if(typeof a==="number")n.minItems=a;if(typeof u==="number")n.maxItems=u;n.type="array",n.items=j(i.element,t,{...r,path:[...r.path,"items"]})},wc=(e,t,o,r)=>{let n=o,i=e._zod.def;n.type="object",n.properties={};let a=i.shape;for(let p in a)n.properties[p]=j(a[p],t,{...r,path:[...r.path,"properties",p]});let u=new Set(Object.keys(a)),d=new Set([...u].filter((p)=>{let f=i.shape[p]._zod;if(t.io==="input")return f.optin===void 0;else return f.optout===void 0}));if(d.size>0)n.required=Array.from(d);if(i.catchall?._zod.def.type==="never")n.additionalProperties=!1;else if(!i.catchall){if(t.io==="output")n.additionalProperties=!1}else if(i.catchall)n.additionalProperties=j(i.catchall,t,{...r,path:[...r.path,"additionalProperties"]})},xc=(e,t,o,r)=>{let n=e._zod.def,i=n.inclusive===!1,a=n.options.map((u,d)=>j(u,t,{...r,path:[...r.path,i?"oneOf":"anyOf",d]}));if(i)o.oneOf=a;else o.anyOf=a},Tc=(e,t,o,r)=>{let n=e._zod.def,i=j(n.left,t,{...r,path:[...r.path,"allOf",0]}),a=j(n.right,t,{...r,path:[...r.path,"allOf",1]}),u=(p)=>("allOf"in p)&&Object.keys(p).length===1,d=[...u(i)?i.allOf:[i],...u(a)?a.allOf:[a]];o.allOf=d},Cp=(e,t,o,r)=>{let n=o,i=e._zod.def;n.type="array";let a=t.target==="draft-2020-12"?"prefixItems":"items",u=t.target==="draft-2020-12"?"items":t.target==="openapi-3.0"?"items":"additionalItems",d=i.items.map((y,z)=>j(y,t,{...r,path:[...r.path,a,z]})),p=i.rest?j(i.rest,t,{...r,path:[...r.path,u,...t.target==="openapi-3.0"?[i.items.length]:[]]}):null;if(t.target==="draft-2020-12"){if(n.prefixItems=d,p)n.items=p}else if(t.target==="openapi-3.0"){if(n.items={anyOf:d},p)n.items.anyOf.push(p);if(n.minItems=d.length,!p)n.maxItems=d.length}else if(n.items=d,p)n.additionalItems=p;let{minimum:f,maximum:b}=e._zod.bag;if(typeof f==="number")n.minItems=f;if(typeof b==="number")n.maxItems=b},Ec=(e,t,o,r)=>{let n=o,i=e._zod.def;n.type="object";let a=i.keyType,d=a._zod.bag?.patterns;if(i.mode==="loose"&&d&&d.size>0){let f=j(i.valueType,t,{...r,path:[...r.path,"patternProperties","*"]});n.patternProperties={};for(let b of d)n.patternProperties[b.source]=f}else{if(t.target==="draft-07"||t.target==="draft-2020-12")n.propertyNames=j(i.keyType,t,{...r,path:[...r.path,"propertyNames"]});n.additionalProperties=j(i.valueType,t,{...r,path:[...r.path,"additionalProperties"]})}let p=a._zod.values;if(p){let f=[...p].filter((b)=>typeof b==="string"||typeof b==="number");if(f.length>0)n.required=f}},Pc=(e,t,o,r)=>{let n=e._zod.def,i=j(n.innerType,t,r),a=t.seen.get(e);if(t.target==="openapi-3.0")a.ref=n.innerType,o.nullable=!0;else o.anyOf=[i,{type:"null"}]},kc=(e,t,o,r)=>{let n=e._zod.def;j(n.innerType,t,r);let i=t.seen.get(e);i.ref=n.innerType},$c=(e,t,o,r)=>{let n=e._zod.def;j(n.innerType,t,r);let i=t.seen.get(e);i.ref=n.innerType,o.default=JSON.parse(JSON.stringify(n.defaultValue))},Cc=(e,t,o,r)=>{let n=e._zod.def;j(n.innerType,t,r);let i=t.seen.get(e);if(i.ref=n.innerType,t.io==="input")o._prefault=JSON.parse(JSON.stringify(n.defaultValue))},Ic=(e,t,o,r)=>{let n=e._zod.def;j(n.innerType,t,r);let i=t.seen.get(e);i.ref=n.innerType;let a;try{a=n.catchValue(void 0)}catch{throw Error("Dynamic catch values are not supported in JSON Schema")}o.default=a},Oc=(e,t,o,r)=>{let n=e._zod.def,i=n.in._zod.traits.has("$ZodTransform"),a=t.io==="input"?i?n.out:n.in:n.out;j(a,t,r);let u=t.seen.get(e);u.ref=a},Mc=(e,t,o,r)=>{let n=e._zod.def;j(n.innerType,t,r);let i=t.seen.get(e);i.ref=n.innerType,o.readOnly=!0},Ip=(e,t,o,r)=>{let n=e._zod.def;j(n.innerType,t,r);let i=t.seen.get(e);i.ref=n.innerType},Ai=(e,t,o,r)=>{let n=e._zod.def;j(n.innerType,t,r);let i=t.seen.get(e);i.ref=n.innerType},qc=(e,t,o,r)=>{let n=e._zod.innerType;j(n,t,r);let i=t.seen.get(e);i.ref=n},bp={string:dc,number:pc,boolean:hc,bigint:yp,symbol:vp,null:mc,undefined:fc,void:zp,never:gc,any:Sc,unknown:_c,date:Rp,enum:bc,literal:yc,nan:wp,template_literal:xp,file:Tp,success:Ep,custom:vc,function:Pp,transform:zc,map:kp,set:$p,array:Rc,object:wc,union:xc,intersection:Tc,tuple:Cp,record:Ec,nullable:Pc,nonoptional:kc,default:$c,prefault:Cc,catch:Ic,pipe:Oc,readonly:Mc,promise:Ip,optional:Ai,lazy:qc};function ji(e,t){if("_idmap"in e){let r=e,n=tn({...t,processors:bp}),i={};for(let d of r._idmap.entries()){let[p,f]=d;j(f,n)}let a={},u={registry:r,uri:t?.uri,defs:i};n.external=u;for(let d of r._idmap.entries()){let[p,f]=d;on(n,f),a[p]=rn(n,f)}if(Object.keys(i).length>0){let d=n.target==="draft-2020-12"?"$defs":"definitions";a.__shared={[d]:i}}return{schemas:a}}let o=tn({...t,processors:bp});return j(e,o),on(o,e),rn(o,e)}var ff=m("ZodISODateTime",(e,t)=>{Bu.init(e,t),H.init(e,t)});function So(e){return op(ff,e)}var gf=m("ZodISODate",(e,t)=>{Wu.init(e,t),H.init(e,t)});function Nc(e){return rp(gf,e)}var Sf=m("ZodISOTime",(e,t)=>{Ku.init(e,t),H.init(e,t)});function Op(e){return np(Sf,e)}var _f=m("ZodISODuration",(e,t)=>{Gu.init(e,t),H.init(e,t)});function Mp(e){return sp(_f,e)}var bf=(e,t)=>{Ti.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:(o)=>ja(e,o)},flatten:{value:(o)=>Aa(e,o)},addIssue:{value:(o)=>{e.issues.push(o),e.message=JSON.stringify(e.issues,Jr,2)}},addIssues:{value:(o)=>{e.issues.push(...o),e.message=JSON.stringify(e.issues,Jr,2)}},isEmpty:{get(){return e.issues.length===0}}})};var he=m("ZodError",bf,{Parent:Error});var Np=Ei(he),Ap=Pi(he),Ui=Wr(he),jp=Kr(he),Lp=$l(he),Up=Cl(he),Zp=Il(he),Dp=Ol(he),Hp=Ml(he),Fp=ql(he),Vp=Nl(he),Jp=Al(he);var Bp=new WeakMap;function nn(e,t,o){let r=Object.getPrototypeOf(e),n=Bp.get(r);if(!n)n=new Set,Bp.set(r,n);if(n.has(t))return;n.add(t);for(let i in o){let a=o[i];Object.defineProperty(r,i,{configurable:!0,enumerable:!1,get(){let u=a.bind(this);return Object.defineProperty(this,i,{configurable:!0,writable:!0,enumerable:!0,value:u}),u},set(u){Object.defineProperty(this,i,{configurable:!0,writable:!0,enumerable:!0,value:u})}})}}var L=m("ZodType",(e,t)=>(N.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:en(e,"input"),output:en(e,"output")}}),e.toJSONSchema=_p(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.parse=(o,r)=>Np(e,o,r,{callee:e.parse}),e.safeParse=(o,r)=>Ui(e,o,r),e.parseAsync=async(o,r)=>Ap(e,o,r,{callee:e.parseAsync}),e.safeParseAsync=async(o,r)=>jp(e,o,r),e.spa=e.safeParseAsync,e.encode=(o,r)=>Lp(e,o,r),e.decode=(o,r)=>Up(e,o,r),e.encodeAsync=async(o,r)=>Zp(e,o,r),e.decodeAsync=async(o,r)=>Dp(e,o,r),e.safeEncode=(o,r)=>Hp(e,o,r),e.safeDecode=(o,r)=>Fp(e,o,r),e.safeEncodeAsync=async(o,r)=>Vp(e,o,r),e.safeDecodeAsync=async(o,r)=>Jp(e,o,r),nn(e,"ZodType",{check(...o){let r=this.def;return this.clone(ot(r,{checks:[...r.checks??[],...o.map((n)=>typeof n==="function"?{_zod:{check:n,def:{check:"custom"},onattach:[]}}:n)]}),{parent:!0})},with(...o){return this.check(...o)},clone(o,r){return we(this,o,r)},brand(){return this},register(o,r){return o.add(this,r),this},refine(o,r){return this.check(cg(o,r))},superRefine(o,r){return this.check(lg(o,r))},overwrite(o){return this.check(it(o))},optional(){return x(this)},exactOptional(){return Wf(this)},nullable(){return Yp(this)},nullish(){return x(Yp(this))},nonoptional(o){return eg(this,o)},array(){return h(this)},or(o){return _([this,o])},and(o){return Le(this,o)},transform(o){return Qp(this,ah(o))},default(o){return Yf(this,o)},prefault(o){return Xf(this,o)},catch(o){return og(this,o)},pipe(o){return Qp(this,o)},readonly(){return sg(this)},describe(o){let r=this.clone();return st.add(r,{description:o}),r},meta(...o){if(o.length===0)return st.get(this);let r=this.clone();return st.add(r,o[0]),r},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(o){return o(this)}}),Object.defineProperty(e,"description",{get(){return st.get(e)?.description},configurable:!0}),e)),Xp=m("_ZodString",(e,t)=>{Ci.init(e,t),L.init(e,t),e._zod.processJSONSchema=(r,n,i)=>dc(e,r,n,i);let o=e._zod.bag;e.format=o.format??null,e.minLength=o.minimum??null,e.maxLength=o.maximum??null,nn(e,"_ZodString",{regex(...r){return this.check(ec(...r))},includes(...r){return this.check(rc(...r))},startsWith(...r){return this.check(nc(...r))},endsWith(...r){return this.check(sc(...r))},min(...r){return this.check(fo(...r))},max(...r){return this.check(qi(...r))},length(...r){return this.check(Ni(...r))},nonempty(...r){return this.check(fo(1,...r))},lowercase(r){return this.check(tc(r))},uppercase(r){return this.check(oc(r))},trim(){return this.check(ac())},normalize(...r){return this.check(ic(...r))},toLowerCase(){return this.check(cc())},toUpperCase(){return this.check(lc())},slugify(){return this.check(uc())}})}),eh=m("ZodString",(e,t)=>{Ci.init(e,t),Xp.init(e,t),e.email=(o)=>e.check(Ya(th,o)),e.url=(o)=>e.check(Xa(rh,o)),e.jwt=(o)=>e.check(tp(qf,o)),e.emoji=(o)=>e.check(Zd(vf,o)),e.guid=(o)=>e.check(Qa(Wp,o)),e.uuid=(o)=>e.check(Ad(Zi,o)),e.uuidv4=(o)=>e.check(jd(Zi,o)),e.uuidv6=(o)=>e.check(Ld(Zi,o)),e.uuidv7=(o)=>e.check(Ud(Zi,o)),e.nanoid=(o)=>e.check(Dd(zf,o)),e.guid=(o)=>e.check(Qa(Wp,o)),e.cuid=(o)=>e.check(Hd(Rf,o)),e.cuid2=(o)=>e.check(Fd(wf,o)),e.ulid=(o)=>e.check(Vd(xf,o)),e.base64=(o)=>e.check(Qd(If,o)),e.base64url=(o)=>e.check(Xd(Of,o)),e.xid=(o)=>e.check(Jd(Tf,o)),e.ksuid=(o)=>e.check(Bd(Ef,o)),e.ipv4=(o)=>e.check(Wd(Pf,o)),e.ipv6=(o)=>e.check(Kd(kf,o)),e.cidrv4=(o)=>e.check(Gd($f,o)),e.cidrv6=(o)=>e.check(Yd(Cf,o)),e.e164=(o)=>e.check(ep(Mf,o)),e.datetime=(o)=>e.check(So(o)),e.date=(o)=>e.check(Nc(o)),e.time=(o)=>e.check(Op(o)),e.duration=(o)=>e.check(Mp(o))});function s(e){return Nd(eh,e)}var H=m("ZodStringFormat",(e,t)=>{Z.init(e,t),Xp.init(e,t)}),th=m("ZodEmail",(e,t)=>{ju.init(e,t),H.init(e,t)});function oh(e){return Ya(th,e)}var Wp=m("ZodGUID",(e,t)=>{Nu.init(e,t),H.init(e,t)});var Zi=m("ZodUUID",(e,t)=>{Au.init(e,t),H.init(e,t)});var rh=m("ZodURL",(e,t)=>{Lu.init(e,t),H.init(e,t)});function Di(e){return Xa(rh,e)}var vf=m("ZodEmoji",(e,t)=>{Uu.init(e,t),H.init(e,t)});var zf=m("ZodNanoID",(e,t)=>{Zu.init(e,t),H.init(e,t)});var Rf=m("ZodCUID",(e,t)=>{Du.init(e,t),H.init(e,t)});var wf=m("ZodCUID2",(e,t)=>{Hu.init(e,t),H.init(e,t)});var xf=m("ZodULID",(e,t)=>{Fu.init(e,t),H.init(e,t)});var Tf=m("ZodXID",(e,t)=>{Vu.init(e,t),H.init(e,t)});var Ef=m("ZodKSUID",(e,t)=>{Ju.init(e,t),H.init(e,t)});var Pf=m("ZodIPv4",(e,t)=>{Yu.init(e,t),H.init(e,t)});var kf=m("ZodIPv6",(e,t)=>{Qu.init(e,t),H.init(e,t)});var $f=m("ZodCIDRv4",(e,t)=>{Xu.init(e,t),H.init(e,t)});var Cf=m("ZodCIDRv6",(e,t)=>{ed.init(e,t),H.init(e,t)});var If=m("ZodBase64",(e,t)=>{od.init(e,t),H.init(e,t)});var Of=m("ZodBase64URL",(e,t)=>{rd.init(e,t),H.init(e,t)});var Mf=m("ZodE164",(e,t)=>{nd.init(e,t),H.init(e,t)});var qf=m("ZodJWT",(e,t)=>{sd.init(e,t),H.init(e,t)});var Hi=m("ZodNumber",(e,t)=>{Ja.init(e,t),L.init(e,t),e._zod.processJSONSchema=(r,n,i)=>pc(e,r,n,i),nn(e,"ZodNumber",{gt(r,n){return this.check(Oi(r,n))},gte(r,n){return this.check(Xr(r,n))},min(r,n){return this.check(Xr(r,n))},lt(r,n){return this.check(Ii(r,n))},lte(r,n){return this.check(Qr(r,n))},max(r,n){return this.check(Qr(r,n))},int(r){return this.check(Kp(r))},safe(r){return this.check(Kp(r))},positive(r){return this.check(Oi(0,r))},nonnegative(r){return this.check(Xr(0,r))},negative(r){return this.check(Ii(0,r))},nonpositive(r){return this.check(Qr(0,r))},multipleOf(r,n){return this.check(Mi(r,n))},step(r,n){return this.check(Mi(r,n))},finite(){return this}});let o=e._zod.bag;e.minValue=Math.max(o.minimum??Number.NEGATIVE_INFINITY,o.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(o.maximum??Number.POSITIVE_INFINITY,o.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(o.format??"").includes("int")||Number.isSafeInteger(o.multipleOf??0.5),e.isFinite=!0,e.format=o.format??null});function g(e){return ip(Hi,e)}var Nf=m("ZodNumberFormat",(e,t)=>{id.init(e,t),Hi.init(e,t)});function Kp(e){return cp(Nf,e)}var nh=m("ZodBoolean",(e,t)=>{ad.init(e,t),L.init(e,t),e._zod.processJSONSchema=(o,r,n)=>hc(e,o,r,n)});function v(e){return lp(nh,e)}var Af=m("ZodUndefined",(e,t)=>{cd.init(e,t),L.init(e,t),e._zod.processJSONSchema=(o,r,n)=>fc(e,o,r,n)});function _o(e){return up(Af,e)}var jf=m("ZodNull",(e,t)=>{ld.init(e,t),L.init(e,t),e._zod.processJSONSchema=(o,r,n)=>mc(e,o,r,n)});function $t(e){return dp(jf,e)}var Lf=m("ZodAny",(e,t)=>{ud.init(e,t),L.init(e,t),e._zod.processJSONSchema=(o,r,n)=>Sc(e,o,r,n)});function bo(){return pp(Lf)}var Uf=m("ZodUnknown",(e,t)=>{dd.init(e,t),L.init(e,t),e._zod.processJSONSchema=(o,r,n)=>_c(e,o,r,n)});function R(){return hp(Uf)}var Zf=m("ZodNever",(e,t)=>{pd.init(e,t),L.init(e,t),e._zod.processJSONSchema=(o,r,n)=>gc(e,o,r,n)});function sn(e){return mp(Zf,e)}var Df=m("ZodArray",(e,t)=>{hd.init(e,t),L.init(e,t),e._zod.processJSONSchema=(o,r,n)=>Rc(e,o,r,n),e.element=t.element,nn(e,"ZodArray",{min(o,r){return this.check(fo(o,r))},nonempty(o){return this.check(fo(1,o))},max(o,r){return this.check(qi(o,r))},length(o,r){return this.check(Ni(o,r))},unwrap(){return this.element}})});function h(e,t){return fp(Df,e,t)}var sh=m("ZodObject",(e,t)=>{gd.init(e,t),L.init(e,t),e._zod.processJSONSchema=(o,r,n)=>wc(e,o,r,n),O(e,"shape",()=>t.shape),nn(e,"ZodObject",{keyof(){return C(Object.keys(this._zod.def.shape))},catchall(o){return this.clone({...this._zod.def,catchall:o})},passthrough(){return this.clone({...this._zod.def,catchall:R()})},loose(){return this.clone({...this._zod.def,catchall:R()})},strict(){return this.clone({...this._zod.def,catchall:sn()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(o){return Jm(this,o)},safeExtend(o){return Bm(this,o)},merge(o){return Wm(this,o)},pick(o){return Fm(this,o)},omit(o){return Vm(this,o)},partial(...o){return Km(ch,this,o[0])},required(...o){return Gm(lh,this,o[0])}})});function c(e,t){let o={type:"object",shape:e??{},...w(t)};return new sh(o)}function T(e,t){return new sh({type:"object",shape:e,catchall:R(),...w(t)})}var ih=m("ZodUnion",(e,t)=>{Ba.init(e,t),L.init(e,t),e._zod.processJSONSchema=(o,r,n)=>xc(e,o,r,n),e.options=t.options});function _(e,t){return new ih({type:"union",options:e,...w(t)})}var Hf=m("ZodDiscriminatedUnion",(e,t)=>{ih.init(e,t),Sd.init(e,t)});function yo(e,t,o){return new Hf({type:"union",options:t,discriminator:e,...w(o)})}var Ff=m("ZodIntersection",(e,t)=>{_d.init(e,t),L.init(e,t),e._zod.processJSONSchema=(o,r,n)=>Tc(e,o,r,n)});function Le(e,t){return new Ff({type:"intersection",left:e,right:t})}var Gp=m("ZodRecord",(e,t)=>{bd.init(e,t),L.init(e,t),e._zod.processJSONSchema=(o,r,n)=>Ec(e,o,r,n),e.keyType=t.keyType,e.valueType=t.valueType});function S(e,t,o){if(!t||!t._zod)return new Gp({type:"record",keyType:s(),valueType:e,...w(t)});return new Gp({type:"record",keyType:e,valueType:t,...w(o)})}var Ac=m("ZodEnum",(e,t)=>{yd.init(e,t),L.init(e,t),e._zod.processJSONSchema=(r,n,i)=>bc(e,r,n,i),e.enum=t.entries,e.options=Object.values(t.entries);let o=new Set(Object.keys(t.entries));e.extract=(r,n)=>{let i={};for(let a of r)if(o.has(a))i[a]=t.entries[a];else throw Error(`Key ${a} not found in enum`);return new Ac({...t,checks:[],...w(n),entries:i})},e.exclude=(r,n)=>{let i={...t.entries};for(let a of r)if(o.has(a))delete i[a];else throw Error(`Key ${a} not found in enum`);return new Ac({...t,checks:[],...w(n),entries:i})}});function C(e,t){let o=Array.isArray(e)?Object.fromEntries(e.map((r)=>[r,r])):e;return new Ac({type:"enum",entries:o,...w(t)})}var Vf=m("ZodLiteral",(e,t)=>{vd.init(e,t),L.init(e,t),e._zod.processJSONSchema=(o,r,n)=>yc(e,o,r,n),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 l(e,t){return new Vf({type:"literal",values:Array.isArray(e)?e:[e],...w(t)})}var Jf=m("ZodTransform",(e,t)=>{zd.init(e,t),L.init(e,t),e._zod.processJSONSchema=(o,r,n)=>zc(e,o,r,n),e._zod.parse=(o,r)=>{if(r.direction==="backward")throw new Vr(e.constructor.name);o.addIssue=(i)=>{if(typeof i==="string")o.issues.push(kt(i,o.value,t));else{let a=i;if(a.fatal)a.continue=!1;a.code??(a.code="custom"),a.input??(a.input=o.value),a.inst??(a.inst=e),o.issues.push(kt(a))}};let n=t.transform(o.value,o);if(n instanceof Promise)return n.then((i)=>(o.value=i,o.fallback=!0,o));return o.value=n,o.fallback=!0,o}});function ah(e){return new Jf({type:"transform",transform:e})}var ch=m("ZodOptional",(e,t)=>{Wa.init(e,t),L.init(e,t),e._zod.processJSONSchema=(o,r,n)=>Ai(e,o,r,n),e.unwrap=()=>e._zod.def.innerType});function x(e){return new ch({type:"optional",innerType:e})}var Bf=m("ZodExactOptional",(e,t)=>{Rd.init(e,t),L.init(e,t),e._zod.processJSONSchema=(o,r,n)=>Ai(e,o,r,n),e.unwrap=()=>e._zod.def.innerType});function Wf(e){return new Bf({type:"optional",innerType:e})}var Kf=m("ZodNullable",(e,t)=>{wd.init(e,t),L.init(e,t),e._zod.processJSONSchema=(o,r,n)=>Pc(e,o,r,n),e.unwrap=()=>e._zod.def.innerType});function Yp(e){return new Kf({type:"nullable",innerType:e})}var Gf=m("ZodDefault",(e,t)=>{xd.init(e,t),L.init(e,t),e._zod.processJSONSchema=(o,r,n)=>$c(e,o,r,n),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Yf(e,t){return new Gf({type:"default",innerType:e,get defaultValue(){return typeof t==="function"?t():Ma(t)}})}var Qf=m("ZodPrefault",(e,t)=>{Td.init(e,t),L.init(e,t),e._zod.processJSONSchema=(o,r,n)=>Cc(e,o,r,n),e.unwrap=()=>e._zod.def.innerType});function Xf(e,t){return new Qf({type:"prefault",innerType:e,get defaultValue(){return typeof t==="function"?t():Ma(t)}})}var lh=m("ZodNonOptional",(e,t)=>{Ed.init(e,t),L.init(e,t),e._zod.processJSONSchema=(o,r,n)=>kc(e,o,r,n),e.unwrap=()=>e._zod.def.innerType});function eg(e,t){return new lh({type:"nonoptional",innerType:e,...w(t)})}var tg=m("ZodCatch",(e,t)=>{Pd.init(e,t),L.init(e,t),e._zod.processJSONSchema=(o,r,n)=>Ic(e,o,r,n),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function og(e,t){return new tg({type:"catch",innerType:e,catchValue:typeof t==="function"?t:()=>t})}var uh=m("ZodPipe",(e,t)=>{Ka.init(e,t),L.init(e,t),e._zod.processJSONSchema=(o,r,n)=>Oc(e,o,r,n),e.in=t.in,e.out=t.out});function Qp(e,t){return new uh({type:"pipe",in:e,out:t})}var rg=m("ZodPreprocess",(e,t)=>{uh.init(e,t),kd.init(e,t)}),ng=m("ZodReadonly",(e,t)=>{$d.init(e,t),L.init(e,t),e._zod.processJSONSchema=(o,r,n)=>Mc(e,o,r,n),e.unwrap=()=>e._zod.def.innerType});function sg(e){return new ng({type:"readonly",innerType:e})}var ig=m("ZodLazy",(e,t)=>{Cd.init(e,t),L.init(e,t),e._zod.processJSONSchema=(o,r,n)=>qc(e,o,r,n),e.unwrap=()=>e._zod.def.getter()});function an(e){return new ig({type:"lazy",getter:e})}var ag=m("ZodCustom",(e,t)=>{Id.init(e,t),L.init(e,t),e._zod.processJSONSchema=(o,r,n)=>vc(e,o,r,n)});function cg(e,t={}){return gp(ag,e,t)}function lg(e,t){return Sp(e,t)}function Ct(e,t){return new rg({type:"pipe",in:ah(e),out:t})}var ph={invalid_type:"invalid_type",too_big:"too_big",too_small:"too_small",invalid_format:"invalid_format",not_multiple_of:"not_multiple_of",unrecognized_keys:"unrecognized_keys",invalid_union:"invalid_union",invalid_key:"invalid_key",invalid_element:"invalid_element",invalid_value:"invalid_value",custom:"custom"};var dh;(function(e){})(dh||(dh={}));function ug(e){return ap(Hi,e)}ce(Ga());var Vi="2025-11-25";var Ji=[Vi,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],Bi="io.modelcontextprotocol/related-task",It="io.modelcontextprotocol/protocolVersion",vo="io.modelcontextprotocol/clientInfo",ct="io.modelcontextprotocol/serverInfo",Ot="io.modelcontextprotocol/clientCapabilities",Wi="io.modelcontextprotocol/subscriptionId",zo="io.modelcontextprotocol/logLevel";var Mt="2.0";var Ue=an(()=>_([s(),g(),v(),$t(),S(s(),Ue),h(Ue)])),F=S(s(),Ue),Ki=h(Ue),Ro=_([s(),g().int()]),wo=s(),cn=c({ttl:g().optional()}),ln=c({taskId:s()}),xo=T({progressToken:Ro.optional(),[Bi]:ln.optional()}),Q=c({_meta:xo.optional()}),lt=Q.extend({task:cn.optional()}),V=c({method:s(),params:Q.loose().optional()}),se=c({_meta:xo.optional()}),ee=c({method:s(),params:se.loose().optional()}),To=T({get[ct](){return fe.optional().catch(void 0)}}),J=T({_meta:To.optional()}),me=_([s(),g().int()]),Eo=c({jsonrpc:l(Mt),id:me,...V.shape}).strict(),Po=c({jsonrpc:l(Mt),...ee.shape}).strict(),qt=c({jsonrpc:l(Mt),id:me,result:J}).strict(),Nt=c({jsonrpc:l(Mt),id:me.optional(),error:c({code:g().int(),message:s(),data:R().optional()})}).strict(),Ze=_([Eo,Po,qt,Nt]),Gi=_([qt,Nt]),$e=J.strict(),un=se.extend({requestId:me.optional(),reason:s().optional()}),ko=ee.extend({method:l("notifications/cancelled"),params:un}),dn=c({src:s(),mimeType:s().optional(),sizes:h(s()).optional(),theme:C(["light","dark"]).optional()}),De=c({icons:h(dn).optional()}),ke=c({name:s(),title:s().optional()}),fe=ke.extend({...ke.shape,...De.shape,version:s(),websiteUrl:s().optional(),description:s().optional()}),pg=Le(c({applyDefaults:v().optional()}),F),hg=Ct((e)=>{if(e&&typeof e==="object"&&!Array.isArray(e)&&Object.keys(e).length===0)return{form:{}};return e},Le(c({form:pg.optional(),url:F.optional()}),F.optional())),Yi=T({list:F.optional(),cancel:F.optional(),requests:T({sampling:T({createMessage:F.optional()}).optional(),elicitation:T({create:F.optional()}).optional()}).optional()}),Qi=T({list:F.optional(),cancel:F.optional(),requests:T({tools:T({call:F.optional()}).optional()}).optional()}),pn=c({experimental:S(s(),F).optional(),sampling:c({context:F.optional(),tools:F.optional()}).optional(),elicitation:hg.optional(),roots:c({listChanged:v().optional()}).optional(),tasks:Yi.optional(),extensions:S(s(),F).optional()}),hn=Q.extend({protocolVersion:s(),capabilities:pn,clientInfo:fe}),mn=V.extend({method:l("initialize"),params:hn}),$o=c({experimental:S(s(),F).optional(),logging:F.optional(),completions:F.optional(),prompts:c({listChanged:v().optional()}).optional(),resources:c({subscribe:v().optional(),listChanged:v().optional()}).optional(),tools:c({listChanged:v().optional()}).optional(),tasks:Qi.optional(),extensions:S(s(),F).optional()}),fn=J.extend({protocolVersion:s(),capabilities:$o,serverInfo:fe,instructions:s().optional()}),gn=ee.extend({method:l("notifications/initialized"),params:se.optional()}),Sn=V.extend({method:l("server/discover"),params:Q.optional()}),Co=J.extend({supportedVersions:h(s()),capabilities:$o,instructions:s().optional()}),Io=V.extend({method:l("ping"),params:Q.optional()}),_n=c({progress:g(),total:x(g()),message:x(s())}),bn=c({...se.shape,..._n.shape,progressToken:Ro}),Oo=ee.extend({method:l("notifications/progress"),params:bn}),yn=Q.extend({cursor:wo.optional()}),He=V.extend({params:yn.optional()}),Fe=J.extend({nextCursor:wo.optional()}),Mo=c({uri:s(),mimeType:x(s()),_meta:S(s(),R()).optional()}),qo=Mo.extend({text:s()}),Lc=s().refine((e)=>{try{return atob(e),!0}catch{return!1}},{message:"Invalid Base64 string"}),No=Mo.extend({blob:Lc}),Ve=C(["user","assistant"]),Ce=c({audience:h(Ve).optional(),priority:g().min(0).max(1).optional(),lastModified:So({offset:!0}).optional()}),Ao=c({...ke.shape,...De.shape,uri:s(),description:x(s()),mimeType:x(s()),size:x(g()),annotations:Ce.optional(),_meta:x(T({}))}),vn=c({...ke.shape,...De.shape,uriTemplate:s(),description:x(s()),mimeType:x(s()),annotations:Ce.optional(),_meta:x(T({}))}),zn=He.extend({method:l("resources/list")}),Rn=Fe.extend({resources:h(Ao)}),wn=He.extend({method:l("resources/templates/list")}),xn=Fe.extend({resourceTemplates:h(vn)}),At=Q.extend({uri:s()}),Tn=At,En=V.extend({method:l("resources/read"),params:Tn}),Pn=J.extend({contents:h(_([qo,No]))}),kn=ee.extend({method:l("notifications/resources/list_changed"),params:se.optional()}),$n=At,Cn=V.extend({method:l("resources/subscribe"),params:$n}),In=At,On=V.extend({method:l("resources/unsubscribe"),params:In}),jo=c({toolsListChanged:v().optional(),promptsListChanged:v().optional(),resourcesListChanged:v().optional(),resourceSubscriptions:h(s()).optional()}),Mn=Q.extend({notifications:jo}),qn=V.extend({method:l("subscriptions/listen"),params:Mn}),Nn=se.extend({notifications:jo}),An=ee.extend({method:l("notifications/subscriptions/acknowledged"),params:Nn}),jn=To.extend({[Wi]:me}),Ln=J.extend({_meta:jn}),Un=se.extend({uri:s()}),Zn=ee.extend({method:l("notifications/resources/updated"),params:Un}),Dn=c({name:s(),description:x(s()),required:x(v())}),Hn=c({...ke.shape,...De.shape,description:x(s()),arguments:x(h(Dn)),_meta:x(T({}))}),Fn=He.extend({method:l("prompts/list")}),Vn=Fe.extend({prompts:h(Hn)}),Jn=Q.extend({name:s(),arguments:S(s(),s()).optional()}),Bn=V.extend({method:l("prompts/get"),params:Jn}),jt=c({type:l("text"),text:s(),annotations:Ce.optional(),_meta:S(s(),R()).optional()}),Lt=c({type:l("image"),data:Lc,mimeType:s(),annotations:Ce.optional(),_meta:S(s(),R()).optional()}),Ut=c({type:l("audio"),data:Lc,mimeType:s(),annotations:Ce.optional(),_meta:S(s(),R()).optional()}),Wn=c({type:l("tool_use"),name:s(),id:s(),input:S(s(),R()),_meta:S(s(),R()).optional()}),Je=c({type:l("resource"),resource:_([qo,No]),annotations:Ce.optional(),_meta:S(s(),R()).optional()}),Be=Ao.extend({type:l("resource_link")}),ge=_([jt,Lt,Ut,Be,Je]),Kn=c({role:Ve,content:ge}),Gn=J.extend({description:s().optional(),messages:h(Kn)}),Yn=ee.extend({method:l("notifications/prompts/list_changed"),params:se.optional()}),Qn=c({title:s().optional(),readOnlyHint:v().optional(),destructiveHint:v().optional(),idempotentHint:v().optional(),openWorldHint:v().optional()}),Xn=c({taskSupport:C(["required","optional","forbidden"]).optional()}),Ie=c({...ke.shape,...De.shape,description:s().optional(),inputSchema:c({type:l("object"),properties:S(s(),Ue).optional(),required:h(s()).optional()}).catchall(R()),outputSchema:T({$schema:s().optional()}).optional(),annotations:Qn.optional(),execution:Xn.optional(),_meta:S(s(),R()).optional()}),es=He.extend({method:l("tools/list")}),ts=Fe.extend({tools:h(Ie)}),Oe=J.extend({content:h(ge).default([]),structuredContent:R().optional(),isError:v().optional()}),Xi=Oe.or(J.extend({toolResult:R()})),os=lt.extend({name:s(),arguments:S(s(),R()).optional()}),rs=V.extend({method:l("tools/call"),params:os}),ns=ee.extend({method:l("notifications/tools/list_changed"),params:se.optional()}),ea=c({autoRefresh:v().default(!0),debounceMs:g().int().nonnegative().default(300)}),Lo=C(["debug","info","notice","warning","error","critical","alert","emergency"]),ss=Q.extend({level:Lo}),is=V.extend({method:l("logging/setLevel"),params:ss}),as=se.extend({level:Lo,logger:s().optional(),data:R()}),Zt=ee.extend({method:l("notifications/message"),params:as}),cs=c({name:s().optional()}),ls=c({hints:h(cs).optional(),costPriority:g().min(0).max(1).optional(),speedPriority:g().min(0).max(1).optional(),intelligencePriority:g().min(0).max(1).optional()}),us=c({mode:C(["auto","required","none"]).optional()}),ds=c({type:l("tool_result"),toolUseId:s().describe("The unique identifier for the corresponding tool call."),content:h(ge),structuredContent:R().optional(),isError:v().optional(),_meta:S(s(),R()).optional()}),ps=yo("type",[jt,Lt,Ut]),at=yo("type",[jt,Lt,Ut,Wn,ds]),hs=c({role:Ve,content:_([at,h(at)]),_meta:S(s(),R()).optional()}),ms=lt.extend({messages:h(hs),modelPreferences:ls.optional(),systemPrompt:s().optional(),includeContext:C(["none","thisServer","allServers"]).optional(),temperature:g().optional(),maxTokens:g().int(),stopSequences:h(s()).optional(),metadata:F.optional(),tools:h(Ie).optional(),toolChoice:us.optional()}),fs=V.extend({method:l("sampling/createMessage"),params:ms}),gs=J.extend({model:s(),stopReason:x(C(["endTurn","stopSequence","maxTokens"]).or(s())),role:Ve,content:ps}),Ss=J.extend({model:s(),stopReason:x(C(["endTurn","stopSequence","maxTokens","toolUse"]).or(s())),role:Ve,content:_([at,h(at)])}),Uo=c({type:l("boolean"),title:s().optional(),description:s().optional(),default:v().optional()}),Dt=c({type:l("string"),title:s().optional(),description:s().optional(),minLength:g().optional(),maxLength:g().optional(),format:C(["email","uri","date","date-time"]).optional(),default:s().optional()}),Ht=c({type:C(["number","integer"]),title:s().optional(),description:s().optional(),minimum:g().optional(),maximum:g().optional(),default:g().optional()}),Zo=c({type:l("string"),title:s().optional(),description:s().optional(),enum:h(s()),default:s().optional()}),Do=c({type:l("string"),title:s().optional(),description:s().optional(),oneOf:h(c({const:s(),title:s()})),default:s().optional()}),Ho=c({type:l("string"),title:s().optional(),description:s().optional(),enum:h(s()),enumNames:h(s()).optional(),default:s().optional()}),_s=_([Zo,Do]),Fo=c({type:l("array"),title:s().optional(),description:s().optional(),minItems:g().optional(),maxItems:g().optional(),items:c({type:l("string"),enum:h(s())}),default:h(s()).optional()}),Vo=c({type:l("array"),title:s().optional(),description:s().optional(),minItems:g().optional(),maxItems:g().optional(),items:c({anyOf:h(c({const:s(),title:s()}))}),default:h(s()).optional()}),bs=_([Fo,Vo]),ys=_([Ho,_s,bs]),Jo=_([ys,Uo,Dt,Ht]),Ft=lt.extend({mode:l("form").optional(),message:s(),requestedSchema:c({type:l("object"),properties:S(s(),Jo),required:h(s()).optional()}).catchall(R())}),vs=lt.extend({mode:l("url"),message:s(),elicitationId:s(),url:s().url()}),zs=_([Ft,vs]),Rs=V.extend({method:l("elicitation/create"),params:zs}),ws=se.extend({elicitationId:s()}),xs=ee.extend({method:l("notifications/elicitation/complete"),params:ws}),Ts=J.extend({action:C(["accept","decline","cancel"]),content:Ct((e)=>e===null?void 0:e,S(s(),_([s(),g(),v(),h(s())])).optional())}),Es=c({type:l("ref/resource"),uri:s()}),Ps=c({type:l("ref/prompt"),name:s()}),ks=Q.extend({ref:_([Ps,Es]),argument:c({name:s(),value:s()}),context:c({arguments:S(s(),s()).optional()}).optional()}),$s=V.extend({method:l("completion/complete"),params:ks}),Cs=J.extend({completion:T({values:h(s()).max(100),total:x(g().int()),hasMore:x(v())})}),Is=c({uri:s().startsWith("file://"),name:s().optional(),_meta:S(s(),R()).optional()}),Os=V.extend({method:l("roots/list"),params:Q.optional()}),Ms=J.extend({roots:h(Is)}),qs=ee.extend({method:l("notifications/roots/list_changed"),params:se.optional()}),ta=T({ttl:g().optional(),pollInterval:g().optional()}),Ns=C(["working","input_required","completed","failed","cancelled"]),We=c({taskId:s(),status:Ns,ttl:_([g(),$t()]),createdAt:s(),lastUpdatedAt:s(),pollInterval:x(g()),statusMessage:x(s())}),oa=J.extend({task:We}),As=se.merge(We),ra=ee.extend({method:l("notifications/tasks/status"),params:As}),na=V.extend({method:l("tasks/get"),params:Q.extend({taskId:s()})}),sa=J.merge(We),ia=V.extend({method:l("tasks/result"),params:Q.extend({taskId:s()})}),aa=J.loose(),ca=He.extend({method:l("tasks/list")}),la=Fe.extend({tasks:h(We)}),ua=V.extend({method:l("tasks/cancel"),params:Q.extend({taskId:s()})}),da=J.merge(We),pa=_([Io,mn,Sn,$s,is,Bn,Fn,zn,wn,En,Cn,On,qn,rs,es]),ha=_([ko,Oo,gn,qs]),ma=_([$e,gs,Ss,Ts,Ms]),fa=_([Io,fs,Rs,Os]),ga=_([ko,Oo,Zt,Zn,kn,ns,Yn,An,xs]),Sa=_([$e,fn,Co,Cs,Gn,Vn,Rn,xn,Pn,Oe,ts,Ln]),Y=Di().superRefine((e,t)=>{if(!URL.canParse(e))return t.addIssue({code:ph.custom,message:"URL must be parseable",fatal:!0}),ka}).refine((e)=>{let t=new URL(e);return t.protocol!=="javascript:"&&t.protocol!=="data:"&&t.protocol!=="vbscript:"},{message:"URL cannot use javascript:, data:, or vbscript: scheme"}),js=T({resource:s().url(),authorization_servers:h(Y).optional(),jwks_uri:s().url().optional(),scopes_supported:h(s()).optional(),bearer_methods_supported:h(s()).optional(),resource_signing_alg_values_supported:h(s()).optional(),resource_name:s().optional(),resource_documentation:s().optional(),resource_policy_uri:s().url().optional(),resource_tos_uri:s().url().optional(),tls_client_certificate_bound_access_tokens:v().optional(),authorization_details_types_supported:h(s()).optional(),dpop_signing_alg_values_supported:h(s()).optional(),dpop_bound_access_tokens_required:v().optional()}),Bo=T({issuer:s(),authorization_endpoint:Y,token_endpoint:Y,registration_endpoint:Y.optional(),scopes_supported:h(s()).optional(),response_types_supported:h(s()),response_modes_supported:h(s()).optional(),grant_types_supported:h(s()).optional(),token_endpoint_auth_methods_supported:h(s()).optional(),token_endpoint_auth_signing_alg_values_supported:h(s()).optional(),service_documentation:Y.optional(),revocation_endpoint:Y.optional(),revocation_endpoint_auth_methods_supported:h(s()).optional(),revocation_endpoint_auth_signing_alg_values_supported:h(s()).optional(),introspection_endpoint:s().optional(),introspection_endpoint_auth_methods_supported:h(s()).optional(),introspection_endpoint_auth_signing_alg_values_supported:h(s()).optional(),code_challenge_methods_supported:h(s()).optional(),client_id_metadata_document_supported:v().optional(),authorization_response_iss_parameter_supported:v().optional().catch(void 0),dpop_signing_alg_values_supported:h(s()).optional()}),Ls=T({issuer:s(),authorization_endpoint:Y,token_endpoint:Y,userinfo_endpoint:Y.optional(),jwks_uri:Y,registration_endpoint:Y.optional(),scopes_supported:h(s()).optional(),response_types_supported:h(s()),response_modes_supported:h(s()).optional(),grant_types_supported:h(s()).optional(),acr_values_supported:h(s()).optional(),subject_types_supported:h(s()),id_token_signing_alg_values_supported:h(s()),id_token_encryption_alg_values_supported:h(s()).optional(),id_token_encryption_enc_values_supported:h(s()).optional(),userinfo_signing_alg_values_supported:h(s()).optional(),userinfo_encryption_alg_values_supported:h(s()).optional(),userinfo_encryption_enc_values_supported:h(s()).optional(),request_object_signing_alg_values_supported:h(s()).optional(),request_object_encryption_alg_values_supported:h(s()).optional(),request_object_encryption_enc_values_supported:h(s()).optional(),token_endpoint_auth_methods_supported:h(s()).optional(),token_endpoint_auth_signing_alg_values_supported:h(s()).optional(),display_values_supported:h(s()).optional(),claim_types_supported:h(s()).optional(),claims_supported:h(s()).optional(),service_documentation:s().optional(),claims_locales_supported:h(s()).optional(),ui_locales_supported:h(s()).optional(),claims_parameter_supported:v().optional(),request_parameter_supported:v().optional(),request_uri_parameter_supported:v().optional(),require_request_uri_registration:v().optional(),op_policy_uri:Y.optional(),op_tos_uri:Y.optional(),client_id_metadata_document_supported:v().optional(),authorization_response_iss_parameter_supported:v().optional().catch(void 0)}),Us=c({...Ls.shape,...Bo.pick({code_challenge_methods_supported:!0}).shape}),Zs=c({access_token:s(),id_token:s().optional(),token_type:s(),expires_in:ug().optional(),scope:s().optional(),refresh_token:s().optional(),issuer:s().optional().catch(void 0)}).strip(),Ds=c({issued_token_type:l("urn:ietf:params:oauth:token-type:id-jag"),access_token:s(),token_type:s().optional(),expires_in:g().optional(),scope:s().optional()}).strip(),Hs=c({error:s(),error_description:s().optional(),error_uri:s().optional()}),jc=Y.optional().or(l("").transform(()=>{return})),Fs=c({redirect_uris:h(Y),token_endpoint_auth_method:s().optional(),grant_types:h(s()).optional(),response_types:h(s()).optional(),application_type:s().optional(),client_name:s().optional(),client_uri:Y.optional(),logo_uri:jc,scope:s().optional(),contacts:h(s()).optional(),tos_uri:jc,policy_uri:s().optional(),jwks_uri:Y.optional(),jwks:bo().optional(),software_id:s().optional(),software_version:s().optional(),software_statement:s().optional()}).strip(),Vs=c({client_id:s(),client_secret:s().optional(),client_id_issued_at:g().optional(),client_secret_expires_at:g().optional(),issuer:s().optional().catch(void 0)}).strip(),Js=Fs.merge(Vs),_a=c({error:s(),error_description:s().optional()}).strip(),ba=c({token:s(),token_type_hint:s().optional()}).strip();var Vc=Symbol.for("mcp.sdk.errorBrands");function Vt(e,t){let o=new Set,r=t;while(typeof r==="function"){let n=r.mcpBrand;if(Object.prototype.hasOwnProperty.call(r,"mcpBrand")&&typeof n==="string")o.add(n);r=Object.getPrototypeOf(r)}if(o.size===0)return;Object.defineProperty(e,Vc,{value:o,enumerable:!1,configurable:!0})}function Se(e,t){try{if(typeof t==="object"&&t!==null&&Object.prototype.hasOwnProperty.call(e,"mcpBrand")&&typeof e.mcpBrand==="string"&&Object.prototype.hasOwnProperty.call(t,Vc)){let o=t[Vc];if(o&&typeof o.has==="function"&&o.has(e.mcpBrand))return!0}}catch{}return Function.prototype[Symbol.hasInstance].call(e,t)}var mg=class e extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.OAuthError"})}static[Symbol.hasInstance](t){return Se(this,t)}static isInstance(t){if(typeof this!=="function")throw TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return Se(this,t)}constructor(t,o,r){super(o);this.code=t,this.errorUri=r,this.name="OAuthError",Vt(this,new.target)}toResponseObject(){let t={error:this.code,error_description:this.message};if(this.errorUri)t.error_uri=this.errorUri;return t}static fromResponse(t){return new e(t.error,t.error_description??t.error,t.error_uri)}},te=function(e){return e.NotConnected="NOT_CONNECTED",e.AlreadyConnected="ALREADY_CONNECTED",e.NotInitialized="NOT_INITIALIZED",e.CapabilityNotSupported="CAPABILITY_NOT_SUPPORTED",e.RequestTimeout="REQUEST_TIMEOUT",e.ConnectionClosed="CONNECTION_CLOSED",e.SendFailed="SEND_FAILED",e.InvalidResult="INVALID_RESULT",e.UnsupportedResultType="UNSUPPORTED_RESULT_TYPE",e.InputRequiredRoundsExceeded="INPUT_REQUIRED_ROUNDS_EXCEEDED",e.ListPaginationExceeded="LIST_PAGINATION_EXCEEDED",e.MethodNotSupportedByProtocolVersion="METHOD_NOT_SUPPORTED_BY_PROTOCOL_VERSION",e.EraNegotiationFailed="ERA_NEGOTIATION_FAILED",e.ClientHttpNotImplemented="CLIENT_HTTP_NOT_IMPLEMENTED",e.ClientHttpAuthentication="CLIENT_HTTP_AUTHENTICATION",e.ClientHttpForbidden="CLIENT_HTTP_FORBIDDEN",e.ClientHttpUnexpectedContent="CLIENT_HTTP_UNEXPECTED_CONTENT",e.ClientHttpFailedToOpenStream="CLIENT_HTTP_FAILED_TO_OPEN_STREAM",e.ClientHttpFailedToTerminateSession="CLIENT_HTTP_FAILED_TO_TERMINATE_SESSION",e}({}),K=class extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.SdkError"})}static[Symbol.hasInstance](e){return Se(this,e)}static isInstance(e){if(typeof this!=="function")throw TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return Se(this,e)}constructor(e,t,o,r){super(t,r);this.code=e,this.data=o,this.name="SdkError",Vt(this,new.target)}},fg=class extends K{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.SdkHttpError"})}constructor(e,t,o,r){super(e,t,o,r);this.name="SdkHttpError"}get status(){return this.data.status}get statusText(){return this.data.statusText}};var gg="2026-07-28";function Mh(e){return e>=gg}function qh(e){let t=e.structuredContent;if(t===void 0)return e;if(!(typeof t!=="object"||t===null||Array.isArray(t)))return e;if(e.content?.some((o)=>o.type==="text")??!1)return e;return{...e,content:[...e.content??[],{type:"text",text:JSON.stringify(t)}]}}var Nh=["task","inputRequests","requestState"];function Sg(e){if(e===null||typeof e!=="object"||Array.isArray(e)||e.content!==void 0||Nh.some((t)=>(t in e)))return e;return{...e,content:[]}}function _g(){let e=an(()=>_([s(),g(),v(),$t(),S(s(),e),h(e)])),t=S(s(),e),o=_([s(),g().int()]),r=s(),n=c({ttl:g().optional()}),i=c({taskId:s()}),a=T({progressToken:o.optional(),"io.modelcontextprotocol/related-task":i.optional()}),u=c({_meta:a.optional()}),d=u.extend({task:n.optional()}),p=c({method:s(),params:u.loose().optional()}),f=c({_meta:a.optional()}),b=c({method:s(),params:f.loose().optional()}),y=T({_meta:a.optional()}),z=_([s(),g().int()]),E=y.strict(),P=f.extend({requestId:z.optional(),reason:s().optional()}),k=b.extend({method:l("notifications/cancelled"),params:P}),A=c({src:s(),mimeType:s().optional(),sizes:h(s()).optional(),theme:C(["light","dark"]).optional()}),B=c({icons:h(A).optional()}),q=c({name:s(),title:s().optional()}),M=q.extend({...q.shape,...B.shape,version:s(),websiteUrl:s().optional(),description:s().optional()}),D=Le(c({applyDefaults:v().optional()}),t),U=Ct((ne)=>{if(ne&&typeof ne==="object"&&!Array.isArray(ne)&&Object.keys(ne).length===0)return{form:{}};return ne},Le(c({form:D.optional(),url:t.optional()}),t.optional())),G=T({list:t.optional(),cancel:t.optional(),requests:T({sampling:T({createMessage:t.optional()}).optional(),elicitation:T({create:t.optional()}).optional()}).optional()}),qe=T({list:t.optional(),cancel:t.optional(),requests:T({tools:T({call:t.optional()}).optional()}).optional()}),ie=c({experimental:S(s(),t).optional(),sampling:c({context:t.optional(),tools:t.optional()}).optional(),elicitation:U.optional(),roots:c({listChanged:v().optional()}).optional(),tasks:G.optional(),extensions:S(s(),t).optional()}),Ke=u.extend({protocolVersion:s(),capabilities:ie,clientInfo:M}),pt=p.extend({method:l("initialize"),params:Ke}),Go=c({experimental:S(s(),t).optional(),logging:t.optional(),completions:t.optional(),prompts:c({listChanged:v().optional()}).optional(),resources:c({subscribe:v().optional(),listChanged:v().optional()}).optional(),tools:c({listChanged:v().optional()}).optional(),tasks:qe.optional(),extensions:S(s(),t).optional()}),Yo=y.extend({protocolVersion:s(),capabilities:Go,serverInfo:M,instructions:s().optional()}),Kt=b.extend({method:l("notifications/initialized"),params:f.optional()}),Ge=p.extend({method:l("ping"),params:u.optional()}),ht=c({progress:g(),total:x(g()),message:x(s())}),Te=c({...f.shape,...ht.shape,progressToken:o}),Ye=b.extend({method:l("notifications/progress"),params:Te}),Gt=u.extend({cursor:r.optional()}),Ne=p.extend({params:Gt.optional()}),Ae=y.extend({nextCursor:r.optional()}),Yt=c({uri:s(),mimeType:x(s()),_meta:S(s(),R()).optional()}),Qt=Yt.extend({text:s()}),mt=s().refine((ne)=>{try{return atob(ne),!0}catch{return!1}},{message:"Invalid Base64 string"}),Xt=Yt.extend({blob:mt}),Ee=C(["user","assistant"]),ze=c({audience:h(Ee).optional(),priority:g().min(0).max(1).optional(),lastModified:So({offset:!0}).optional()}),ft=c({...q.shape,...B.shape,uri:s(),description:x(s()),mimeType:x(s()),size:x(g()),annotations:ze.optional(),_meta:x(T({}))}),Qo=c({...q.shape,...B.shape,uriTemplate:s(),description:x(s()),mimeType:x(s()),annotations:ze.optional(),_meta:x(T({}))}),Xo=Ne.extend({method:l("resources/list")}),er=Ae.extend({resources:h(ft)}),Qe=Ne.extend({method:l("resources/templates/list")}),eo=Ae.extend({resourceTemplates:h(Qo)}),gt=u.extend({uri:s()}),tr=gt,or=p.extend({method:l("resources/read"),params:tr}),rr=y.extend({contents:h(_([Qt,Xt]))}),nr=b.extend({method:l("notifications/resources/list_changed"),params:f.optional()}),sr=gt,ir=p.extend({method:l("resources/subscribe"),params:sr}),ar=gt,cr=p.extend({method:l("resources/unsubscribe"),params:ar}),lr=f.extend({uri:s()}),ur=b.extend({method:l("notifications/resources/updated"),params:lr}),dr=c({name:s(),description:x(s()),required:x(v())}),pr=c({...q.shape,...B.shape,description:x(s()),arguments:x(h(dr)),_meta:x(T({}))}),hr=Ne.extend({method:l("prompts/list")}),mr=Ae.extend({prompts:h(pr)}),fr=u.extend({name:s(),arguments:S(s(),s()).optional()}),gr=p.extend({method:l("prompts/get"),params:fr}),St=c({type:l("text"),text:s(),annotations:ze.optional(),_meta:S(s(),R()).optional()}),_t=c({type:l("image"),data:mt,mimeType:s(),annotations:ze.optional(),_meta:S(s(),R()).optional()}),bt=c({type:l("audio"),data:mt,mimeType:s(),annotations:ze.optional(),_meta:S(s(),R()).optional()}),Sr=c({type:l("tool_use"),name:s(),id:s(),input:S(s(),R()),_meta:S(s(),R()).optional()}),Xe=c({type:l("resource"),resource:_([Qt,Xt]),annotations:ze.optional(),_meta:S(s(),R()).optional()}),_r=ft.extend({type:l("resource_link")}),be=_([St,_t,bt,_r,Xe]),to=c({role:Ee,content:be}),oo=y.extend({description:s().optional(),messages:h(to)}),yt=b.extend({method:l("notifications/prompts/list_changed"),params:f.optional()}),br=c({title:s().optional(),readOnlyHint:v().optional(),destructiveHint:v().optional(),idempotentHint:v().optional(),openWorldHint:v().optional()}),ro=c({taskSupport:C(["required","optional","forbidden"]).optional()}),vt=c({...q.shape,...B.shape,description:s().optional(),inputSchema:c({type:l("object"),properties:S(s(),e).optional(),required:h(s()).optional()}).catchall(R()),outputSchema:c({type:l("object"),properties:S(s(),e).optional(),required:h(s()).optional()}).catchall(R()).optional(),annotations:br.optional(),execution:ro.optional(),_meta:S(s(),R()).optional()}),no=Ne.extend({method:l("tools/list")}),so=Ae.extend({tools:h(vt)}),io=y.extend({content:h(be),structuredContent:S(s(),R()).optional(),isError:v().optional()}),re=d.extend({name:s(),arguments:S(s(),R()).optional()}),yr=p.extend({method:l("tools/call"),params:re}),ni=b.extend({method:l("notifications/tools/list_changed"),params:f.optional()}),ao=C(["debug","info","notice","warning","error","critical","alert","emergency"]),vr=u.extend({level:ao}),zr=p.extend({method:l("logging/setLevel"),params:vr}),Rr=f.extend({level:ao,logger:s().optional(),data:R()}),wr=b.extend({method:l("notifications/message"),params:Rr}),xr=c({name:s().optional()}),Tr=c({hints:h(xr).optional(),costPriority:g().min(0).max(1).optional(),speedPriority:g().min(0).max(1).optional(),intelligencePriority:g().min(0).max(1).optional()}),Er=c({mode:C(["auto","required","none"]).optional()}),si=c({type:l("tool_result"),toolUseId:s().describe("The unique identifier for the corresponding tool call."),content:h(be),structuredContent:c({}).loose().optional(),isError:v().optional(),_meta:S(s(),R()).optional()}),Pr=yo("type",[St,_t,bt]),et=yo("type",[St,_t,bt,Sr,si]),kr=c({role:Ee,content:_([et,h(et)]),_meta:S(s(),R()).optional()}),$r=d.extend({messages:h(kr),modelPreferences:Tr.optional(),systemPrompt:s().optional(),includeContext:C(["none","thisServer","allServers"]).optional(),temperature:g().optional(),maxTokens:g().int(),stopSequences:h(s()).optional(),metadata:t.optional(),tools:h(vt).optional(),toolChoice:Er.optional()}),Cr=p.extend({method:l("sampling/createMessage"),params:$r}),Ir=y.extend({model:s(),stopReason:x(C(["endTurn","stopSequence","maxTokens"]).or(s())),role:Ee,content:Pr}),Or=y.extend({model:s(),stopReason:x(C(["endTurn","stopSequence","maxTokens","toolUse"]).or(s())),role:Ee,content:_([et,h(et)])}),Mr=c({type:l("boolean"),title:s().optional(),description:s().optional(),default:v().optional()}),qr=c({type:l("string"),title:s().optional(),description:s().optional(),minLength:g().optional(),maxLength:g().optional(),format:C(["email","uri","date","date-time"]).optional(),default:s().optional()}),Nr=c({type:C(["number","integer"]),title:s().optional(),description:s().optional(),minimum:g().optional(),maximum:g().optional(),default:g().optional()}),Ar=c({type:l("string"),title:s().optional(),description:s().optional(),enum:h(s()),default:s().optional()}),jr=c({type:l("string"),title:s().optional(),description:s().optional(),oneOf:h(c({const:s(),title:s()})),default:s().optional()}),Lr=c({type:l("string"),title:s().optional(),description:s().optional(),enum:h(s()),enumNames:h(s()).optional(),default:s().optional()}),Ur=_([Ar,jr]),zt=c({type:l("array"),title:s().optional(),description:s().optional(),minItems:g().optional(),maxItems:g().optional(),items:c({type:l("string"),enum:h(s())}),default:h(s()).optional()}),Rt=c({type:l("array"),title:s().optional(),description:s().optional(),minItems:g().optional(),maxItems:g().optional(),items:c({anyOf:h(c({const:s(),title:s()}))}),default:h(s()).optional()}),ii=_([zt,Rt]),ai=_([Lr,Ur,ii]),de=_([ai,Mr,qr,Nr]),pe=d.extend({mode:l("form").optional(),message:s(),requestedSchema:c({type:l("object"),properties:S(s(),de),required:h(s()).optional()}).catchall(R())}),Zr=d.extend({mode:l("url"),message:s(),elicitationId:s(),url:s().url()}),Re=_([pe,Zr]),ci=p.extend({method:l("elicitation/create"),params:Re}),li=f.extend({elicitationId:s()}),ui=b.extend({method:l("notifications/elicitation/complete"),params:li}),di=y.extend({action:C(["accept","decline","cancel"]),content:Ct((ne)=>ne===null?void 0:ne,S(s(),_([s(),g(),v(),h(s())])).optional())}),pi=c({type:l("ref/resource"),uri:s()}),hi=c({type:l("ref/prompt"),name:s()}),mi=u.extend({ref:_([hi,pi]),argument:c({name:s(),value:s()}),context:c({arguments:S(s(),s()).optional()}).optional()}),Dr=p.extend({method:l("completion/complete"),params:mi}),fi=y.extend({completion:T({values:h(s()).max(100),total:x(g().int()),hasMore:x(v())})}),gi=c({uri:s().startsWith("file://"),name:s().optional(),_meta:S(s(),R()).optional()}),co=p.extend({method:l("roots/list"),params:u.optional()}),Hr=y.extend({roots:h(gi)}),Si=b.extend({method:l("notifications/roots/list_changed"),params:f.optional()}),_i=T({ttl:g().optional(),pollInterval:g().optional()}),Fr=C(["working","input_required","completed","failed","cancelled"]),tt=c({taskId:s(),status:Fr,ttl:_([g(),$t()]),createdAt:s(),lastUpdatedAt:s(),pollInterval:x(g()),statusMessage:x(s())}),ue=y.extend({task:tt}),bi=f.merge(tt),wt=b.extend({method:l("notifications/tasks/status"),params:bi}),lo=p.extend({method:l("tasks/get"),params:u.extend({taskId:s()})}),uo=y.merge(tt),po=p.extend({method:l("tasks/result"),params:u.extend({taskId:s()})}),Pa=y.loose(),ae=Ne.extend({method:l("tasks/list")}),W=Ae.extend({tasks:h(tt)}),xt=p.extend({method:l("tasks/cancel"),params:u.extend({taskId:s()})});return{JSONValueSchema:e,JSONObjectSchema:t,ProgressTokenSchema:o,CursorSchema:r,TaskMetadataSchema:n,RelatedTaskMetadataSchema:i,RequestMetaSchema:a,BaseRequestParamsSchema:u,TaskAugmentedRequestParamsSchema:d,RequestSchema:p,NotificationsParamsSchema:f,NotificationSchema:b,ResultSchema:y,RequestIdSchema:z,EmptyResultSchema:E,CancelledNotificationParamsSchema:P,CancelledNotificationSchema:k,IconSchema:A,IconsSchema:B,BaseMetadataSchema:q,ImplementationSchema:M,ClientTasksCapabilitySchema:G,ServerTasksCapabilitySchema:qe,ClientCapabilitiesSchema:ie,InitializeRequestParamsSchema:Ke,InitializeRequestSchema:pt,ServerCapabilitiesSchema:Go,InitializeResultSchema:Yo,InitializedNotificationSchema:Kt,PingRequestSchema:Ge,ProgressSchema:ht,ProgressNotificationParamsSchema:Te,ProgressNotificationSchema:Ye,PaginatedRequestParamsSchema:Gt,PaginatedRequestSchema:Ne,PaginatedResultSchema:Ae,ResourceContentsSchema:Yt,TextResourceContentsSchema:Qt,BlobResourceContentsSchema:Xt,RoleSchema:Ee,AnnotationsSchema:ze,ResourceSchema:ft,ResourceTemplateSchema:Qo,ListResourcesRequestSchema:Xo,ListResourcesResultSchema:er,ListResourceTemplatesRequestSchema:Qe,ListResourceTemplatesResultSchema:eo,ResourceRequestParamsSchema:gt,ReadResourceRequestParamsSchema:tr,ReadResourceRequestSchema:or,ReadResourceResultSchema:rr,ResourceListChangedNotificationSchema:nr,SubscribeRequestParamsSchema:sr,SubscribeRequestSchema:ir,UnsubscribeRequestParamsSchema:ar,UnsubscribeRequestSchema:cr,ResourceUpdatedNotificationParamsSchema:lr,ResourceUpdatedNotificationSchema:ur,PromptArgumentSchema:dr,PromptSchema:pr,ListPromptsRequestSchema:hr,ListPromptsResultSchema:mr,GetPromptRequestParamsSchema:fr,GetPromptRequestSchema:gr,TextContentSchema:St,ImageContentSchema:_t,AudioContentSchema:bt,ToolUseContentSchema:Sr,EmbeddedResourceSchema:Xe,ResourceLinkSchema:_r,ContentBlockSchema:be,PromptMessageSchema:to,GetPromptResultSchema:oo,PromptListChangedNotificationSchema:yt,ToolAnnotationsSchema:br,ToolExecutionSchema:ro,ToolSchema:vt,ListToolsRequestSchema:no,ListToolsResultSchema:so,CallToolResultSchema:io,CallToolRequestParamsSchema:re,CallToolRequestSchema:yr,ToolListChangedNotificationSchema:ni,LoggingLevelSchema:ao,SetLevelRequestParamsSchema:vr,SetLevelRequestSchema:zr,LoggingMessageNotificationParamsSchema:Rr,LoggingMessageNotificationSchema:wr,ModelHintSchema:xr,ModelPreferencesSchema:Tr,ToolChoiceSchema:Er,ToolResultContentSchema:si,SamplingContentSchema:Pr,SamplingMessageContentBlockSchema:et,SamplingMessageSchema:kr,CreateMessageRequestParamsSchema:$r,CreateMessageRequestSchema:Cr,CreateMessageResultSchema:Ir,CreateMessageResultWithToolsSchema:Or,BooleanSchemaSchema:Mr,StringSchemaSchema:qr,NumberSchemaSchema:Nr,UntitledSingleSelectEnumSchemaSchema:Ar,TitledSingleSelectEnumSchemaSchema:jr,LegacyTitledEnumSchemaSchema:Lr,SingleSelectEnumSchemaSchema:Ur,UntitledMultiSelectEnumSchemaSchema:zt,TitledMultiSelectEnumSchemaSchema:Rt,MultiSelectEnumSchemaSchema:ii,EnumSchemaSchema:ai,PrimitiveSchemaDefinitionSchema:de,ElicitRequestFormParamsSchema:pe,ElicitRequestURLParamsSchema:Zr,ElicitRequestParamsSchema:Re,ElicitRequestSchema:ci,ElicitationCompleteNotificationParamsSchema:li,ElicitationCompleteNotificationSchema:ui,ElicitResultSchema:di,ResourceTemplateReferenceSchema:pi,PromptReferenceSchema:hi,CompleteRequestParamsSchema:mi,CompleteRequestSchema:Dr,CompleteResultSchema:fi,RootSchema:gi,ListRootsRequestSchema:co,ListRootsResultSchema:Hr,RootsListChangedNotificationSchema:Si,TaskCreationParamsSchema:_i,TaskStatusSchema:Fr,TaskSchema:tt,CreateTaskResultSchema:ue,TaskStatusNotificationParamsSchema:bi,TaskStatusNotificationSchema:wt,GetTaskRequestSchema:lo,GetTaskResultSchema:uo,GetTaskPayloadRequestSchema:po,GetTaskPayloadResultSchema:Pa,ListTasksRequestSchema:ae,ListTasksResultSchema:W,CancelTaskRequestSchema:xt,CancelTaskResultSchema:y.merge(tt),ClientRequestSchema:_([Ge,pt,Dr,zr,gr,hr,Xo,Qe,or,ir,cr,yr,no,lo,po,ae,xt]),ClientNotificationSchema:_([k,Ye,Kt,Si,wt]),ClientResultSchema:_([E,Ir,Or,di,Hr,uo,W,ue]),ServerRequestSchema:_([Ge,Cr,ci,co,lo,po,ae,xt]),ServerNotificationSchema:_([k,Ye,wr,ur,nr,ni,yt,wt,ui]),ServerResultSchema:_([E,Yo,fi,oo,mr,er,eo,rr,io,so,uo,W,ue]),CallToolResultWireSchema:R().superRefine((ne,qm)=>{if(typeof ne!=="object"||ne===null||Array.isArray(ne)||ne.content!==void 0)return;for(let pl of Nh)if(pl in ne){qm.addIssue({code:"custom",message:`content is required when the body carries '${pl}' — another result family cannot default into an empty tools/call success`});return}}).transform(Sg).pipe(io)}}var bg;function Ah(){return bg??=_g()}function jh(e){return e.type!=="object"}var yg=new Set(["const","enum","default","examples"]),vg=new Set(["properties","patternProperties","$defs","definitions","dependentSchemas","dependencies"]);function Rh(e){return e!==void 0&&!(typeof e==="string"&&e.startsWith("#"))}function zg(e){let t=typeof e.$schema==="string"?e.$schema:void 0;if(Rh(e.$id))return{...t!==void 0&&{$schema:t},type:"object",properties:{result:e},required:["result"]};let o=gl(e.$schema)&&e.$recursiveAnchor!==!0,r=(n,i)=>{if(Array.isArray(n))return n.map((d)=>r(d,!1));if(n===null||typeof n!=="object")return n;if(!i&&Rh(n.$id))return n;let a={},u=!1;for(let[d,p]of Object.entries(n))if(i)a[d]=r(p,!1);else if((d==="$ref"||d==="$dynamicRef")&&typeof p==="string")a[d]=p==="#"?"#/properties/result":p.startsWith("#/")?`#/properties/result${p.slice(1)}`:p;else if(d==="$recursiveRef"&&p==="#"&&o)u=!0;else if(yg.has(d))a[d]=p;else if(vg.has(d))a[d]=r(p,!0);else a[d]=r(p,!1);if(u)if("$ref"in a)a.allOf=[...Array.isArray(a.allOf)?a.allOf:[],{$ref:"#/properties/result"}];else a.$ref="#/properties/result";return a};return{...t!==void 0&&{$schema:t},type:"object",properties:{result:r(e,!1)},required:["result"]}}var Lh={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},Uh={"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},Rg={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},ya;function Yc(){if(ya)return ya;let e=Ah();return ya={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}},ya}function Zh(e){return Object.prototype.hasOwnProperty.call(Lh,e)}function Dh(e){return Object.prototype.hasOwnProperty.call(Uh,e)}function wg(e){return Object.prototype.hasOwnProperty.call(Rg,e)}function xg(e){return wg(e)?Yc().resultSchemas[e]:void 0}function Tg(e){return Zh(e)?Yc().requestSchemas[e]:void 0}function Eg(e){return Dh(e)?Yc().notificationSchemas[e]:void 0}var iv=Object.keys(Lh),av=Object.keys(Uh);function Jc(e){return e!==null&&typeof e==="object"&&!Array.isArray(e)}function va(e,t){if(e===void 0)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)}}var wh={ok:!1,reason:"not-in-era"};function xh(e){return Jc(e)&&Jc(e.outputSchema)&&jh(e.outputSchema)}function Th(e){return e}var Qc={era:"2025-11-25",hasRequestMethod:Zh,hasNotificationMethod:Dh,validateRequest:(e,t)=>va(Tg(e),t),validateResult:(e,t)=>va(xg(e),t),validateNotification:(e,t)=>va(Eg(e),t),hasInputRequestMethod:()=>!1,validateInputRequest:()=>wh,validateInputResponse:()=>wh,samplingResultVariant:(e,t)=>{let o=Ah();return va(e?o.CreateMessageResultWithToolsSchema:o.CreateMessageResultSchema,t)},outboundEnvelope:(e)=>{return},validateEnvelopeMeta:(e)=>[],projectCallToolResult(e,t){let o=qh(e),r=o.structuredContent;if(r===void 0)return o;let n=typeof r!=="object"||r===null||Array.isArray(r),i=t!==void 0&&jh(t);if(!n&&!i)return o;return{...o,structuredContent:{result:r}}},decodeResult(e,t){if(Jc(t)&&"resultType"in t){let o={...t};return delete o.resultType,{kind:"complete",result:Th(o)}}return{kind:"complete",result:Th(t)}},encodeResult(e,t){if(e!=="tools/list")return t;let o=t.tools;if(!Array.isArray(o)||!o.some((r)=>xh(r)))return t;return{...t,tools:o.map((r)=>xh(r)?{...r,outputSchema:zg(r.outputSchema)}:r)}},encodeErrorCode:(e)=>e===-32002?-32602:e,checkInboundEnvelope:(e)=>{return}};function Pg(){let e=an(()=>_([s(),g(),v(),$t(),S(s(),e),h(e)])),t=S(s(),e),o=_([s(),g().int()]),r=s(),n=_([s(),g().int()]),i=C(["user","assistant"]),a=C(["debug","info","notice","warning","error","critical","alert","emergency"]),u=s().refine((W)=>{try{return atob(W),!0}catch{return!1}},{message:"Invalid Base64 string"}),d=c({ttl:g().optional()}),p=c({taskId:s()}),f=T({progressToken:o.optional(),"io.modelcontextprotocol/related-task":p.optional()}),b=c({_meta:f.optional()}),y=b.extend({task:d.optional()}),z=c({_meta:f.optional()}),E=c({method:s(),params:z.loose().optional()}),P=c({src:s(),mimeType:s().optional(),sizes:h(s()).optional(),theme:C(["light","dark"]).optional()}),k=c({icons:h(P).optional()}),A=c({name:s(),title:s().optional()}),B=A.extend({...A.shape,...k.shape,version:s(),websiteUrl:s().optional(),description:s().optional()}),q=Le(c({applyDefaults:v().optional()}),t),M=Ct((W)=>{if(W&&typeof W==="object"&&!Array.isArray(W)&&Object.keys(W).length===0)return{form:{}};return W},Le(c({form:q.optional(),url:t.optional()}),t.optional())),D=T({list:t.optional(),cancel:t.optional(),requests:T({sampling:T({createMessage:t.optional()}).optional(),elicitation:T({create:t.optional()}).optional()}).optional()}),U=T({list:t.optional(),cancel:t.optional(),requests:T({tools:T({call:t.optional()}).optional()}).optional()}),G=c({experimental:S(s(),t).optional(),sampling:c({context:t.optional(),tools:t.optional()}).optional(),elicitation:M.optional(),roots:c({listChanged:v().optional()}).optional(),tasks:D.optional(),extensions:S(s(),t).optional()}),qe=c({experimental:S(s(),t).optional(),logging:t.optional(),completions:t.optional(),prompts:c({listChanged:v().optional()}).optional(),resources:c({subscribe:v().optional(),listChanged:v().optional()}).optional(),tools:c({listChanged:v().optional()}).optional(),tasks:U.optional(),extensions:S(s(),t).optional()}),ie=c({progress:g(),total:x(g()),message:x(s())}),Ke=c({...z.shape,...ie.shape,progressToken:o}),pt=E.extend({method:l("notifications/progress"),params:Ke}),Go=z.extend({level:a,logger:s().optional(),data:R()}),Yo=E.extend({method:l("notifications/message"),params:Go}),Kt=c({uri:s(),mimeType:x(s()),_meta:S(s(),R()).optional()}),Ge=Kt.extend({text:s()}),ht=Kt.extend({blob:u}),Te=c({audience:h(i).optional(),priority:g().min(0).max(1).optional(),lastModified:So({offset:!0}).optional()}),Ye=c({...A.shape,...k.shape,uri:s(),description:x(s()),mimeType:x(s()),size:x(g()),annotations:Te.optional(),_meta:x(T({}))}),Gt=c({...A.shape,...k.shape,uriTemplate:s(),description:x(s()),mimeType:x(s()),annotations:Te.optional(),_meta:x(T({}))}),Ne=E.extend({method:l("notifications/resources/list_changed"),params:z.optional()}),Ae=z.extend({uri:s()}),Yt=E.extend({method:l("notifications/resources/updated"),params:Ae}),Qt=c({name:s(),description:x(s()),required:x(v())}),mt=c({...A.shape,...k.shape,description:x(s()),arguments:x(h(Qt)),_meta:x(T({}))}),Xt=E.extend({method:l("notifications/prompts/list_changed"),params:z.optional()}),Ee=c({type:l("text"),text:s(),annotations:Te.optional(),_meta:S(s(),R()).optional()}),ze=c({type:l("image"),data:u,mimeType:s(),annotations:Te.optional(),_meta:S(s(),R()).optional()}),ft=c({type:l("audio"),data:u,mimeType:s(),annotations:Te.optional(),_meta:S(s(),R()).optional()}),Qo=c({type:l("tool_use"),name:s(),id:s(),input:S(s(),R()),_meta:S(s(),R()).optional()}),Xo=c({type:l("resource"),resource:_([Ge,ht]),annotations:Te.optional(),_meta:S(s(),R()).optional()}),er=Ye.extend({type:l("resource_link")}),Qe=_([Ee,ze,ft,er,Xo]),eo=c({role:i,content:Qe}),gt=c({title:s().optional(),readOnlyHint:v().optional(),destructiveHint:v().optional(),idempotentHint:v().optional(),openWorldHint:v().optional()}),tr=E.extend({method:l("notifications/tools/list_changed"),params:z.optional()}),or=c({name:s().optional()}),rr=c({hints:h(or).optional(),costPriority:g().min(0).max(1).optional(),speedPriority:g().min(0).max(1).optional(),intelligencePriority:g().min(0).max(1).optional()}),nr=c({mode:C(["auto","required","none"]).optional()}),sr=c({type:l("boolean"),title:s().optional(),description:s().optional(),default:v().optional()}),ir=c({type:l("string"),title:s().optional(),description:s().optional(),minLength:g().optional(),maxLength:g().optional(),format:C(["email","uri","date","date-time"]).optional(),default:s().optional()}),ar=c({type:C(["number","integer"]),title:s().optional(),description:s().optional(),minimum:g().optional(),maximum:g().optional(),default:g().optional()}),cr=c({type:l("string"),title:s().optional(),description:s().optional(),enum:h(s()),default:s().optional()}),lr=c({type:l("string"),title:s().optional(),description:s().optional(),oneOf:h(c({const:s(),title:s()})),default:s().optional()}),ur=c({type:l("string"),title:s().optional(),description:s().optional(),enum:h(s()),enumNames:h(s()).optional(),default:s().optional()}),dr=_([cr,lr]),pr=c({type:l("array"),title:s().optional(),description:s().optional(),minItems:g().optional(),maxItems:g().optional(),items:c({type:l("string"),enum:h(s())}),default:h(s()).optional()}),hr=c({type:l("array"),title:s().optional(),description:s().optional(),minItems:g().optional(),maxItems:g().optional(),items:c({anyOf:h(c({const:s(),title:s()}))}),default:h(s()).optional()}),mr=_([pr,hr]),fr=_([ur,dr,mr]),gr=_([fr,sr,ir,ar]),St=y.extend({mode:l("form").optional(),message:s(),requestedSchema:c({type:l("object"),properties:S(s(),gr),required:h(s()).optional()}).catchall(R())}),_t=c({type:l("ref/resource"),uri:s()}),bt=c({type:l("ref/prompt"),name:s()}),Sr=c({uri:s().startsWith("file://"),name:s().optional(),_meta:S(s(),R()).optional()}),Xe=G.shape,_r=c({experimental:Xe.experimental,sampling:Xe.sampling,elicitation:Xe.elicitation,roots:Xe.roots,extensions:Xe.extensions}),be=qe.shape,to=c({experimental:be.experimental,logging:be.logging,completions:be.completions,prompts:be.prompts,resources:be.resources,tools:be.tools,extensions:be.extensions}),oo=T({progressToken:o.optional(),[It]:s(),[vo]:B.optional(),[Ot]:_r,[zo]:a.optional()}),yt=c({...A.shape,...k.shape,description:s().optional(),inputSchema:T({$schema:s().optional(),type:l("object")}),outputSchema:T({$schema:s().optional()}).optional(),annotations:gt.optional(),_meta:S(s(),R()).optional()}),br=c({type:l("tool_result"),toolUseId:s(),content:h(Qe),structuredContent:R().optional(),isError:v().optional(),_meta:S(s(),R()).optional()}),ro=_([Ee,ze,ft,Qo,br]),vt=c({role:i,content:_([ro,h(ro)]),_meta:S(s(),R()).optional()}),no=s(),so=T({[ct]:B.optional().catch(void 0)}),io=so.optional();function re(W){return T({_meta:io,resultType:no.default("complete"),...W})}let yr=re({}),ni=re({nextCursor:r.optional()}),ao=re({content:h(Qe),structuredContent:R().optional(),isError:v().optional()}),vr=re({ttlMs:g().int().min(0),cacheScope:C(["public","private"]),tools:h(yt),nextCursor:r.optional()}),zr=re({ttlMs:g().int().min(0),cacheScope:C(["public","private"]),prompts:h(mt),nextCursor:r.optional()}),Rr=re({description:s().optional(),messages:h(eo)}),wr=re({ttlMs:g().int().min(0),cacheScope:C(["public","private"]),resources:h(Ye),nextCursor:r.optional()}),xr=re({ttlMs:g().int().min(0),cacheScope:C(["public","private"]),resourceTemplates:h(Gt),nextCursor:r.optional()}),Tr=re({ttlMs:g().int().min(0),cacheScope:C(["public","private"]),contents:h(_([Ge,ht]))}),Er=re({completion:c({values:h(s()).max(100),total:g().int().optional(),hasMore:v().optional()}).loose()}),si=re({ttlMs:g().int().min(0),cacheScope:C(["public","private"])}),Pr=re({ttlMs:g().int().min(0).catch(0),cacheScope:C(["public","private"]).catch("private"),supportedVersions:h(s()),capabilities:to,instructions:s().optional()}),et=c({messages:h(vt),modelPreferences:rr.optional(),systemPrompt:s().optional(),includeContext:C(["none","thisServer","allServers"]).optional(),temperature:g().optional(),maxTokens:g().int(),stopSequences:h(s()).optional(),metadata:t.optional(),tools:h(yt).optional(),toolChoice:nr.optional()}),kr=c({method:l("sampling/createMessage"),params:et}),$r=c({method:l("roots/list"),params:c({_meta:S(s(),R()).optional()}).optional()}),Cr=c({...vt.shape,model:s(),stopReason:s().optional()}),Ir=c({roots:h(Sr)}),Or=c({action:C(["accept","decline","cancel"]),content:S(s(),_([s(),g(),v(),h(s())])).optional()}),Mr=c({mode:l("url"),message:s(),url:s().url()}),qr=_([St,Mr]),Nr=c({method:l("elicitation/create"),params:qr}),Ar=_([kr,$r,Nr]),jr=_([Cr,Ir,Or]),Lr=S(s(),Ar),Ur=S(s(),jr),zt=re({inputRequests:Lr.optional(),requestState:s().optional()}),Rt={inputResponses:Ur.optional(),requestState:s().optional()},ii=c({_meta:oo,...Rt}),ai=T({progressToken:o.optional()});function de(W,xt){return c({method:l(W),params:c({_meta:oo,...xt})})}function pe(W,xt){return c({method:l(W),params:c({_meta:ai.optional(),...xt}).optional()})}let Zr={name:s(),arguments:S(s(),R()).optional(),...Rt},Re={cursor:r.optional()},ci=de("tools/call",Zr),li=de("tools/list",Re),ui=de("prompts/list",Re),di=de("prompts/get",{name:s(),arguments:S(s(),s()).optional(),...Rt}),pi=de("resources/list",Re),hi=de("resources/templates/list",Re),mi=de("resources/read",{uri:s(),...Rt}),Dr={ref:_([bt,_t]),argument:c({name:s(),value:s()}),context:c({arguments:S(s(),s()).optional()}).optional()},fi=de("completion/complete",Dr),gi=de("server/discover",{}),co=c({toolsListChanged:v().optional(),promptsListChanged:v().optional(),resourcesListChanged:v().optional(),resourceSubscriptions:h(s()).optional()}),Hr={notifications:co},Si=de("subscriptions/listen",Hr),_i=so.extend({"io.modelcontextprotocol/subscriptionId":n}),Fr=T({_meta:_i,resultType:no.default("complete")}),tt={"tools/call":pe("tools/call",Zr),"tools/list":pe("tools/list",Re),"prompts/get":pe("prompts/get",{name:s(),arguments:S(s(),s()).optional()}),"prompts/list":pe("prompts/list",Re),"resources/list":pe("resources/list",Re),"resources/templates/list":pe("resources/templates/list",Re),"resources/read":pe("resources/read",{uri:s()}),"completion/complete":pe("completion/complete",Dr),"server/discover":pe("server/discover",{}),"subscriptions/listen":pe("subscriptions/listen",Hr)};function ue(W){return T({_meta:io,...W})}let bi={"tools/call":ue({content:h(Qe),structuredContent:R().optional(),isError:v().optional()}),"tools/list":ue({ttlMs:g().int().min(0),cacheScope:C(["public","private"]),tools:h(yt),nextCursor:r.optional()}),"prompts/get":ue({description:s().optional(),messages:h(eo)}),"prompts/list":ue({ttlMs:g().int().min(0),cacheScope:C(["public","private"]),prompts:h(mt),nextCursor:r.optional()}),"resources/list":ue({ttlMs:g().int().min(0),cacheScope:C(["public","private"]),resources:h(Ye),nextCursor:r.optional()}),"resources/templates/list":ue({ttlMs:g().int().min(0),cacheScope:C(["public","private"]),resourceTemplates:h(Gt),nextCursor:r.optional()}),"resources/read":ue({ttlMs:g().int().min(0),cacheScope:C(["public","private"]),contents:h(_([Ge,ht]))}),"completion/complete":ue({completion:c({values:h(s()).max(100),total:g().int().optional(),hasMore:v().optional()}).loose()}),"server/discover":ue({ttlMs:g().int().min(0).catch(0),cacheScope:C(["public","private"]).catch("private"),supportedVersions:h(s()),capabilities:to,instructions:s().optional()}),"subscriptions/listen":ue({})},wt=T({"io.modelcontextprotocol/subscriptionId":n.optional()}),lo=c({method:l("notifications/subscriptions/acknowledged"),params:c({_meta:wt.optional(),notifications:co})}),uo=c({_meta:wt.optional(),requestId:n,reason:s().optional()}),po=c({method:l("notifications/cancelled"),params:uo}),Pa={"notifications/cancelled":po,"notifications/progress":pt,"notifications/message":Yo,"notifications/resources/updated":Yt,"notifications/resources/list_changed":Ne,"notifications/tools/list_changed":tr,"notifications/prompts/list_changed":Xt,"notifications/subscriptions/acknowledged":lo},ae=(W)=>c({jsonrpc:l("2.0"),id:_([s(),g().int()]),result:W}).strict();return{JSONValueSchema:e,JSONObjectSchema:t,ProgressTokenSchema:o,CursorSchema:r,RequestIdSchema:n,RoleSchema:i,LoggingLevelSchema:a,TaskMetadataSchema:d,RelatedTaskMetadataSchema:p,RequestMetaSchema:f,BaseRequestParamsSchema:b,TaskAugmentedRequestParamsSchema:y,NotificationsParamsSchema:z,NotificationSchema:E,IconSchema:P,IconsSchema:k,BaseMetadataSchema:A,ImplementationSchema:B,ClientTasksCapabilitySchema:D,ServerTasksCapabilitySchema:U,ClientCapabilitiesSchema:G,ServerCapabilitiesSchema:qe,ProgressSchema:ie,ProgressNotificationParamsSchema:Ke,ProgressNotificationSchema:pt,LoggingMessageNotificationParamsSchema:Go,LoggingMessageNotificationSchema:Yo,ResourceContentsSchema:Kt,TextResourceContentsSchema:Ge,BlobResourceContentsSchema:ht,AnnotationsSchema:Te,ResourceSchema:Ye,ResourceTemplateSchema:Gt,ResourceListChangedNotificationSchema:Ne,ResourceUpdatedNotificationParamsSchema:Ae,ResourceUpdatedNotificationSchema:Yt,PromptArgumentSchema:Qt,PromptSchema:mt,PromptListChangedNotificationSchema:Xt,TextContentSchema:Ee,ImageContentSchema:ze,AudioContentSchema:ft,ToolUseContentSchema:Qo,EmbeddedResourceSchema:Xo,ResourceLinkSchema:er,ContentBlockSchema:Qe,PromptMessageSchema:eo,ToolAnnotationsSchema:gt,ToolListChangedNotificationSchema:tr,ModelHintSchema:or,ModelPreferencesSchema:rr,ToolChoiceSchema:nr,BooleanSchemaSchema:sr,StringSchemaSchema:ir,NumberSchemaSchema:ar,UntitledSingleSelectEnumSchemaSchema:cr,TitledSingleSelectEnumSchemaSchema:lr,LegacyTitledEnumSchemaSchema:ur,SingleSelectEnumSchemaSchema:dr,UntitledMultiSelectEnumSchemaSchema:pr,TitledMultiSelectEnumSchemaSchema:hr,MultiSelectEnumSchemaSchema:mr,EnumSchemaSchema:fr,PrimitiveSchemaDefinitionSchema:gr,ElicitRequestFormParamsSchema:St,ResourceTemplateReferenceSchema:_t,PromptReferenceSchema:bt,RootSchema:Sr,ClientCapabilities2026Schema:_r,ServerCapabilities2026Schema:to,RequestMetaEnvelopeSchema:oo,ToolSchema:yt,ToolResultContentSchema:br,SamplingMessageContentBlockSchema:ro,SamplingMessageSchema:vt,ResultTypeSchema:no,ResultMetaSchema:so,ResultSchema:yr,PaginatedResultSchema:ni,CallToolResultSchema:ao,ListToolsResultSchema:vr,ListPromptsResultSchema:zr,GetPromptResultSchema:Rr,ListResourcesResultSchema:wr,ListResourceTemplatesResultSchema:xr,ReadResourceResultSchema:Tr,CompleteResultSchema:Er,CacheableResultSchema:si,DiscoverResultSchema:Pr,CreateMessageRequestParamsSchema:et,CreateMessageRequestSchema:kr,ListRootsRequestSchema:$r,CreateMessageResultSchema:Cr,ListRootsResultSchema:Ir,ElicitResultSchema:Or,ElicitRequestURLParamsSchema:Mr,ElicitRequestParamsSchema:qr,ElicitRequestSchema:Nr,InputRequestSchema:Ar,InputResponseSchema:jr,InputRequestsSchema:Lr,InputResponsesSchema:Ur,InputRequiredResultSchema:zt,InputResponseRequestParamsSchema:ii,CallToolRequestSchema:ci,ListToolsRequestSchema:li,ListPromptsRequestSchema:ui,GetPromptRequestSchema:di,ListResourcesRequestSchema:pi,ListResourceTemplatesRequestSchema:hi,ReadResourceRequestSchema:mi,CompleteRequestSchema:fi,DiscoverRequestSchema:gi,SubscriptionFilterSchema:co,SubscriptionsListenRequestSchema:Si,SubscriptionsListenResultMetaSchema:_i,SubscriptionsListenResultSchema:Fr,dispatchRequestSchemas:tt,dispatchResultSchemas:bi,NotificationMetaSchema:wt,SubscriptionsAcknowledgedNotificationSchema:lo,CancelledNotificationParamsSchema:uo,CancelledNotificationSchema:po,notificationSchemas2026:Pa,JSONRPCResultResponseSchema:ae(yr),CallToolResultResponseSchema:ae(_([ao,zt])),ListToolsResultResponseSchema:ae(vr),ListPromptsResultResponseSchema:ae(zr),GetPromptResultResponseSchema:ae(_([Rr,zt])),ListResourcesResultResponseSchema:ae(wr),ListResourceTemplatesResultResponseSchema:ae(xr),ReadResourceResultResponseSchema:ae(_([Tr,zt])),CompleteResultResponseSchema:ae(Er),DiscoverResultResponseSchema:ae(Pr),SubscriptionsListenResultResponseSchema:ae(Fr)}}var kg;function ut(){return kg??=Pg()}var $g=["tools/list","prompts/list","resources/list","resources/templates/list","resources/read","server/discover"];function Cg(e){return $g.includes(e)}var Xc=Symbol("modelcontextprotocol.resultCacheHintFallback");function Ig(e){return e[Xc]}function Hh(e){return typeof e==="number"&&Number.isSafeInteger(e)&&e>=0}function Fh(e){return e==="public"||e==="private"}var I=function(e){return e[e.ParseError=-32700]="ParseError",e[e.InvalidRequest=-32600]="InvalidRequest",e[e.MethodNotFound=-32601]="MethodNotFound",e[e.InvalidParams=-32602]="InvalidParams",e[e.InternalError=-32603]="InternalError",e[e.ResourceNotFound=-32002]="ResourceNotFound",e[e.MissingRequiredClientCapability=-32021]="MissingRequiredClientCapability",e[e.UnsupportedProtocolVersion=-32022]="UnsupportedProtocolVersion",e[e.UrlElicitationRequired=-32042]="UrlElicitationRequired",e}({}),oe=class e extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.ProtocolError"})}static[Symbol.hasInstance](t){return Se(this,t)}static isInstance(t){if(typeof this!=="function")throw TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return Se(this,t)}constructor(t,o,r){super(o);this.code=t,this.data=r,this.name="ProtocolError",Vt(this,new.target)}static fromError(t,o,r){if(t===I.UrlElicitationRequired&&r){let n=r;if(n.elicitations)return new Jh(n.elicitations,o)}if(t===I.UnsupportedProtocolVersion&&r){let n=r;if(Array.isArray(n.supported)&&typeof n.requested==="string")return new Bh({supported:n.supported,requested:n.requested},o)}if(t===I.InvalidParams||t===I.ResourceNotFound){let n=r;if(typeof n?.uri==="string"&&(t===I.ResourceNotFound||Object.keys(n).length===1))return new Vh(n.uri,o)}if(t===I.MissingRequiredClientCapability&&r){let n=r;if(n.requiredCapabilities!==null&&typeof n.requiredCapabilities==="object"&&!Array.isArray(n.requiredCapabilities))return new Wh({requiredCapabilities:n.requiredCapabilities},o)}return new e(t,o,r)}},Vh=class extends oe{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.ResourceNotFoundError"})}constructor(e,t=`Resource not found: ${e}`){super(I.InvalidParams,t,{uri:e})}get uri(){return this.data.uri}},Jh=class extends oe{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.UrlElicitationRequiredError"})}constructor(e,t=`URL elicitation${e.length>1?"s":""} required`){super(I.UrlElicitationRequired,t,{elicitations:e})}get elicitations(){return this.data?.elicitations??[]}},Bh=class extends oe{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.UnsupportedProtocolVersionError"})}constructor(e,t=`Unsupported protocol version: ${e.requested}`){super(I.UnsupportedProtocolVersion,t,e)}get supported(){return this.data.supported}get requested(){return this.data.requested}},Wh=class extends oe{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.MissingRequiredClientCapabilityError"})}constructor(e,t=`Missing required client capabilities: ${Object.keys(e.requiredCapabilities).join(", ")}`){super(I.MissingRequiredClientCapability,t,e)}get requiredCapabilities(){return this.data.requiredCapabilities}},Og=0,Mg="private",qg=["tools/call","prompts/get","resources/read"];function Ng(e,t){let o=t.resultType;if(o===void 0)return{...t,resultType:"complete"};if(o==="complete")return t;if(qg.includes(e))return t;throw new oe(I.InternalError,`Handler for ${e} returned resultType '${String(o)}', but results of ${e} only support 'complete' on protocol revision 2026-07-28`)}function Ag(e,t){let o=Ig(t);if(t.resultType!=="complete"||!Cg(e))return o===void 0?t:Dg(t);let r=t,n=Hh(r.ttlMs)?r.ttlMs:Ug(o),i=Fh(r.cacheScope)?r.cacheScope:Zg(o),a={...r,ttlMs:n,cacheScope:i};return delete a[Xc],a}function jg(e){return e!==null&&typeof e==="object"&&!Array.isArray(e)}function Lg(e,t){if(t===void 0)return e;let o=e._meta;if(o===void 0)return{...e,_meta:{[ct]:t}};if(!jg(o))return e;if(o[ct]!==void 0)return e;return{...e,_meta:{...o,[ct]:t}}}function Ug(e){return e!==void 0&&Hh(e.ttlMs)?e.ttlMs:Og}function Zg(e){return e!==void 0&&Fh(e.cacheScope)?e.cacheScope:Mg}function Dg(e){let t={...e};return delete t[Xc],t}var Hg=["elicitation/create","sampling/createMessage","roots/list"],za;function Kh(){if(za)return za;let e=ut();return za={request:{"elicitation/create":c({method:l("elicitation/create"),params:e.ElicitRequestParamsSchema}),"sampling/createMessage":c({method:l("sampling/createMessage"),params:e.CreateMessageRequestParamsSchema}),"roots/list":c({method:l("roots/list"),params:T({}).optional()})},response:{"elicitation/create":e.ElicitResultSchema,"sampling/createMessage":e.CreateMessageResultSchema,"roots/list":e.ListRootsResultSchema}},za}function Gh(e){return Hg.includes(e)}function Uc(e){return Gh(e)?Kh().request[e]:void 0}function Fg(e){return Gh(e)?Kh().response[e]:void 0}var el={"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},Yh={"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 Qh(e){return Object.prototype.hasOwnProperty.call(el,e)}function Xh(e){return Object.prototype.hasOwnProperty.call(Yh,e)}function Vg(e){return Object.prototype.hasOwnProperty.call(el,e)}function Jg(e){return Qh(e)?ut().dispatchRequestSchemas[e]:void 0}function Bg(e){return Vg(e)?ut().dispatchResultSchemas[e]:void 0}function Wg(e){return Xh(e)?ut().notificationSchemas2026[e]:void 0}var cv=Object.keys(el),lv=Object.keys(Yh);function Ks(e){return e!==null&&typeof e==="object"&&!Array.isArray(e)}function Bs(e,t){if(e===void 0)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)}}var Kg={ok:!1,reason:"not-in-era"},Gg=[It,Ot];function Yg(e,t){let o=t,r=!1,n=()=>{if(!r)o={...o},r=!0;return o},i=t.tools;if(e==="tools/list"&&Array.isArray(i)&&i.some((u)=>Ks(u)&&("execution"in u)))n().tools=i.map((u)=>{if(!Ks(u)||!("execution"in u))return u;let d={...u};return delete d.execution,d});let a=t.capabilities;if(Ks(a)&&"tasks"in a){let u={...a};delete u.tasks,n().capabilities=u}return o}var tl={era:"2026-07-28",hasRequestMethod:Qh,hasNotificationMethod:Xh,hasInputRequestMethod:(e)=>Uc(e)!==void 0,validateRequest:(e,t)=>Bs(Jg(e),t),validateResult:(e,t)=>Bs(Bg(e),t),validateNotification:(e,t)=>Bs(Wg(e),t),validateInputRequest:(e,t)=>Bs(Uc(e),t),validateInputResponse:(e,t)=>Bs(Fg(e),t),samplingResultVariant:()=>Kg,outboundEnvelope(e){return{[It]:e.protocolVersion,[vo]:e.clientInfo,[Ot]:e.clientCapabilities,...e.logLevel!==void 0&&{[zo]:e.logLevel}}},validateEnvelopeMeta(e){let t=[];for(let r of Gg)if(!(r in e))t.push({key:r,problem:"missing"});let o=ut().RequestMetaEnvelopeSchema.safeParse(e);if(!o.success)for(let r of o.error.issues){let n=r.path.map(String),i=n.length>0?n.join("."):"_meta";if(n.length===1&&t.some((a)=>a.key===i&&a.problem==="missing"))continue;t.push({key:i,problem:r.message})}return t},projectCallToolResult:(e)=>qh(e),inputRequestSchema:Uc,decodeResult(e,t){if(!Ks(t))return{kind:"invalid",error:new K(te.InvalidResult,`Invalid result for ${e}: not an object`,{method:e})};let o=t.resultType;if(o===void 0)return{kind:"invalid",error:new K(te.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(typeof o!=="string")return{kind:"invalid",error:new K(te.InvalidResult,`Invalid result for ${e}: non-string resultType`,{method:e,resultType:o})};if(o==="input_required"){let a=t.inputRequests,u=Ks(a)?a:{},d=t.requestState,p=t._meta===void 0?void 0:ut().ResultMetaSchema.safeParse(t._meta),f=p?.success?p.data:void 0;if(Object.keys(u).length===0&&typeof d!=="string")return{kind:"invalid",error:new K(te.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"})};return{kind:"input_required",inputRequests:u,...typeof d==="string"&&{requestState:d},...f!==void 0&&{_meta:f}}}if(o!=="complete")return{kind:"invalid",error:new K(te.UnsupportedResultType,`Unsupported result type '${o}' for ${e}`,{resultType:o,method:e})};let r=Qg(),n=Object.hasOwn(r,e)?r[e]:void 0;if(n!==void 0){let a=n.safeParse(t);if(!a.success)return{kind:"invalid",error:new K(te.InvalidResult,`Invalid result for ${e}: ${a.error}`,{method:e})}}let i={...t};return delete i.resultType,{kind:"complete",result:i}},encodeResult(e,t,o){return Lg(Ag(e,Ng(e,Yg(e,t))),o)},encodeErrorCode:(e)=>e===-32002?-32602:e,checkInboundEnvelope(e){if(e.envelope===void 0)return"Request is missing the required _meta envelope for protocol revision 2026-07-28 (io.modelcontextprotocol/protocolVersion, io.modelcontextprotocol/clientCapabilities)";let t=ut().RequestMetaEnvelopeSchema.safeParse(e.envelope);if(!t.success)return`Invalid _meta envelope for protocol revision 2026-07-28: ${t.error.issues.map((o)=>o.message).join("; ")}`}},Ra;function Qg(){if(Ra)return Ra;let e=ut();return Ra={"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},Ra}var ol="2026-07-28";function Ys(e){return e!==void 0&&Mh(e)?tl:Qc}function Eh(e){if(e.revision!==void 0)return Ys(e.revision).era;return e.era==="modern"?tl.era:Qc.era}function Zc(e){return em.some((t)=>t.hasRequestMethod(e))}function Dc(e){return em.some((t)=>t.hasNotificationMethod(e))}function Ph(e){return e==="tasks/get"||e==="tasks/cancel"}var em=[Qc,tl],Xg=ml({AnnotationsSchema:()=>Ce,AudioContentSchema:()=>Ut,BaseMetadataSchema:()=>ke,BaseRequestParamsSchema:()=>Q,BlobResourceContentsSchema:()=>No,BooleanSchemaSchema:()=>Uo,CallToolRequestParamsSchema:()=>os,CallToolRequestSchema:()=>rs,CallToolResultSchema:()=>Oe,CancelTaskRequestSchema:()=>ua,CancelTaskResultSchema:()=>da,CancelledNotificationParamsSchema:()=>un,CancelledNotificationSchema:()=>ko,ClientCapabilitiesSchema:()=>pn,ClientNotificationSchema:()=>ha,ClientRequestSchema:()=>pa,ClientResultSchema:()=>ma,ClientTasksCapabilitySchema:()=>Yi,CompatibilityCallToolResultSchema:()=>Xi,CompleteRequestParamsSchema:()=>ks,CompleteRequestSchema:()=>$s,CompleteResultSchema:()=>Cs,ContentBlockSchema:()=>ge,CreateMessageRequestParamsSchema:()=>ms,CreateMessageRequestSchema:()=>fs,CreateMessageResultSchema:()=>gs,CreateMessageResultWithToolsSchema:()=>Ss,CreateTaskResultSchema:()=>oa,CursorSchema:()=>wo,DiscoverRequestSchema:()=>Sn,DiscoverResultSchema:()=>Co,ElicitRequestFormParamsSchema:()=>Ft,ElicitRequestParamsSchema:()=>zs,ElicitRequestSchema:()=>Rs,ElicitRequestURLParamsSchema:()=>vs,ElicitResultSchema:()=>Ts,ElicitationCompleteNotificationParamsSchema:()=>ws,ElicitationCompleteNotificationSchema:()=>xs,EmbeddedResourceSchema:()=>Je,EmptyResultSchema:()=>$e,EnumSchemaSchema:()=>ys,GetPromptRequestParamsSchema:()=>Jn,GetPromptRequestSchema:()=>Bn,GetPromptResultSchema:()=>Gn,GetTaskPayloadRequestSchema:()=>ia,GetTaskPayloadResultSchema:()=>aa,GetTaskRequestSchema:()=>na,GetTaskResultSchema:()=>sa,IconSchema:()=>dn,IconsSchema:()=>De,ImageContentSchema:()=>Lt,ImplementationSchema:()=>fe,InitializeRequestParamsSchema:()=>hn,InitializeRequestSchema:()=>mn,InitializeResultSchema:()=>fn,InitializedNotificationSchema:()=>gn,JSONArraySchema:()=>Ki,JSONObjectSchema:()=>F,JSONRPCErrorResponseSchema:()=>Nt,JSONRPCMessageSchema:()=>Ze,JSONRPCNotificationSchema:()=>Po,JSONRPCRequestSchema:()=>Eo,JSONRPCResponseSchema:()=>Gi,JSONRPCResultResponseSchema:()=>qt,JSONValueSchema:()=>Ue,LegacyTitledEnumSchemaSchema:()=>Ho,ListChangedOptionsBaseSchema:()=>ea,ListPromptsRequestSchema:()=>Fn,ListPromptsResultSchema:()=>Vn,ListResourceTemplatesRequestSchema:()=>wn,ListResourceTemplatesResultSchema:()=>xn,ListResourcesRequestSchema:()=>zn,ListResourcesResultSchema:()=>Rn,ListRootsRequestSchema:()=>Os,ListRootsResultSchema:()=>Ms,ListTasksRequestSchema:()=>ca,ListTasksResultSchema:()=>la,ListToolsRequestSchema:()=>es,ListToolsResultSchema:()=>ts,LoggingLevelSchema:()=>Lo,LoggingMessageNotificationParamsSchema:()=>as,LoggingMessageNotificationSchema:()=>Zt,ModelHintSchema:()=>cs,ModelPreferencesSchema:()=>ls,MultiSelectEnumSchemaSchema:()=>bs,NotificationSchema:()=>ee,NotificationsParamsSchema:()=>se,NumberSchemaSchema:()=>Ht,PaginatedRequestParamsSchema:()=>yn,PaginatedRequestSchema:()=>He,PaginatedResultSchema:()=>Fe,PingRequestSchema:()=>Io,PrimitiveSchemaDefinitionSchema:()=>Jo,ProgressNotificationParamsSchema:()=>bn,ProgressNotificationSchema:()=>Oo,ProgressSchema:()=>_n,ProgressTokenSchema:()=>Ro,PromptArgumentSchema:()=>Dn,PromptListChangedNotificationSchema:()=>Yn,PromptMessageSchema:()=>Kn,PromptReferenceSchema:()=>Ps,PromptSchema:()=>Hn,ReadResourceRequestParamsSchema:()=>Tn,ReadResourceRequestSchema:()=>En,ReadResourceResultSchema:()=>Pn,RelatedTaskMetadataSchema:()=>ln,RequestIdSchema:()=>me,RequestMetaSchema:()=>xo,RequestSchema:()=>V,ResourceContentsSchema:()=>Mo,ResourceLinkSchema:()=>Be,ResourceListChangedNotificationSchema:()=>kn,ResourceRequestParamsSchema:()=>At,ResourceSchema:()=>Ao,ResourceTemplateReferenceSchema:()=>Es,ResourceTemplateSchema:()=>vn,ResourceUpdatedNotificationParamsSchema:()=>Un,ResourceUpdatedNotificationSchema:()=>Zn,ResultMetaObjectSchema:()=>To,ResultSchema:()=>J,RoleSchema:()=>Ve,RootSchema:()=>Is,RootsListChangedNotificationSchema:()=>qs,SamplingContentSchema:()=>ps,SamplingMessageContentBlockSchema:()=>at,SamplingMessageSchema:()=>hs,ServerCapabilitiesSchema:()=>$o,ServerNotificationSchema:()=>ga,ServerRequestSchema:()=>fa,ServerResultSchema:()=>Sa,ServerTasksCapabilitySchema:()=>Qi,SetLevelRequestParamsSchema:()=>ss,SetLevelRequestSchema:()=>is,SingleSelectEnumSchemaSchema:()=>_s,StringSchemaSchema:()=>Dt,SubscribeRequestParamsSchema:()=>$n,SubscribeRequestSchema:()=>Cn,SubscriptionFilterSchema:()=>jo,SubscriptionsAcknowledgedNotificationParamsSchema:()=>Nn,SubscriptionsAcknowledgedNotificationSchema:()=>An,SubscriptionsListenRequestParamsSchema:()=>Mn,SubscriptionsListenRequestSchema:()=>qn,SubscriptionsListenResultMetaSchema:()=>jn,SubscriptionsListenResultSchema:()=>Ln,TaskAugmentedRequestParamsSchema:()=>lt,TaskCreationParamsSchema:()=>ta,TaskMetadataSchema:()=>cn,TaskSchema:()=>We,TaskStatusNotificationParamsSchema:()=>As,TaskStatusNotificationSchema:()=>ra,TaskStatusSchema:()=>Ns,TextContentSchema:()=>jt,TextResourceContentsSchema:()=>qo,TitledMultiSelectEnumSchemaSchema:()=>Vo,TitledSingleSelectEnumSchemaSchema:()=>Do,ToolAnnotationsSchema:()=>Qn,ToolChoiceSchema:()=>us,ToolExecutionSchema:()=>Xn,ToolListChangedNotificationSchema:()=>ns,ToolResultContentSchema:()=>ds,ToolSchema:()=>Ie,ToolUseContentSchema:()=>Wn,UnsubscribeRequestParamsSchema:()=>In,UnsubscribeRequestSchema:()=>On,UntitledMultiSelectEnumSchemaSchema:()=>Fo,UntitledSingleSelectEnumSchemaSchema:()=>Zo});var tm=(e)=>Eo.safeParse(e).success,om=(e)=>Po.safeParse(e).success,Bc=(e)=>qt.safeParse(e).success,rm=(e)=>Nt.safeParse(e).success;var Gs=-32020,uv=[{rung:"http-method",order:1,evaluatedAt:"edge",codes:[-32000],conformance:[],rationale:"The modern era is POST-only; GET/DELETE are body-less 2025-era session operations and are method-routed to legacy serving (405 when legacy serving is not configured), before any body is read."},{rung:"jsonrpc-shape",order:2,evaluatedAt:"edge",codes:[I.InvalidRequest],conformance:["server-stateless"],rationale:"The body must be a JSON-RPC request or notification: posted responses and batch arrays containing a modern or invalid element are rejected before classification (element-wise batch rule); all-legacy arrays stay legacy traffic."},{rung:"era-classification",order:3,evaluatedAt:"edge",codes:[Gs,I.UnsupportedProtocolVersion],conformance:["server-stateless","http-header-validation","http-custom-header-server-validation"],rationale:"Body-primary era classification with the protocol-version header as a cross-check; a header/body disagreement is rejected with -32020 (HeaderMismatch), and an envelope-less request on a modern-only endpoint is answered with the unsupported-protocol-version error naming the supported revisions."},{rung:"envelope",order:4,evaluatedAt:"edge",codes:[I.InvalidParams],conformance:["server-stateless"],rationale:"A present envelope claim with a malformed envelope — and a missing envelope on a request whose protocol-version header names a modern revision — is an invalid-params rejection naming the offending or missing key(s); never a silent fall back to legacy handling. This is the only place an invalid-params rejection maps to HTTP 400."},{rung:"method-registry",order:5,evaluatedAt:"dispatch",codes:[I.MethodNotFound],conformance:["server-stateless"],rationale:"Method existence outranks parameter validity: a method absent from the negotiated revision’s registry (or with no handler installed) answers method-not-found before params or capabilities are looked at."},{rung:"request-params",order:6,evaluatedAt:"dispatch",codes:[I.InvalidParams],conformance:[],rationale:"Per-method params validation; emitted in-band by the dispatch layer (HTTP 200), never via the ladder status table."},{rung:"standard-header-validation",order:7,evaluatedAt:"pre-dispatch",codes:[Gs],conformance:["http-header-validation"],rationale:"SEP-2243 standard `MCP-Protocol-Version` / `Mcp-Method` / `Mcp-Name` headers — presence, sentinel decoding, and `Mcp-Name` ↔ body cross-check — are validated by the HTTP entry on a modern-classified request after the supported-revision gate and before dispatch. The spec requires `MCP-Protocol-Version` and `Mcp-Method` on every modern *request* POST (`Mcp-Name` only for the methods that mirror `params.name` / `params.uri` / `params.taskId`, see `MCP_NAME_HEADER_SOURCE`) and names them in that order, so a request missing several is answered by the earliest. Notification POSTs are exempt: the presence half runs on requests only, so a modern-enveloped notification is dispatched even with no standard headers at all. The classifier’s own header-mismatch cells (protocol-version, `Mcp-Method` mismatch) stay on the edge `era-classification` rung; this rung carries the entry-layer presence/`Mcp-Name` half — including the missing `MCP-Protocol-Version` cell, which cannot live on the edge rung without breaking body-primary classification. Evaluated before the capability gate, the factory call, and the `Mcp-Param-*` rung so a request that fails several rungs is answered by the standard-header rung first. The documented order (after method-registry 5 and request-params 6) is NOT the observed precedence: serveModern evaluates this rung immediately after the supported-revision gate, so a request that also fails a dispatch rung is answered here before the dispatch rungs (5–6) are consulted."},{rung:"client-capabilities",order:8,evaluatedAt:"pre-dispatch",codes:[I.MissingRequiredClientCapability],conformance:["server-stateless"],rationale:"The capability requirement is checked by the HTTP entry, pre-dispatch, against the validated envelope the classifier produced — pinning the spec-mandated HTTP 400 independently of how dispatch- and handler-produced errors are mapped. The documented order (after method resolution and params validation) is preserved observably only while the requirement table is empty: once a served method gains a requirement entry, a request that is missing the capability and would also fail a dispatch rung is answered by this gate first, so the entry must consult the method registry before the gate if the documented precedence is to stay observable."},{rung:"param-header-validation",order:9,evaluatedAt:"pre-dispatch",codes:[Gs],conformance:["http-custom-header-server-validation"],rationale:"SEP-2243 `Mcp-Param-*` headers are validated against the named tool’s `x-mcp-header` declarations and the body `arguments` after the tool registry is known and before dispatch reaches the handler; a missing/disagreeing/malformed header is rejected 400 / -32020 with the same shape as the standard-header cross-checks. The documented order (after method resolution and params validation) is preserved observably only when the body `arguments` would otherwise validate: the check runs pre-dispatch, so a `tools/call` that fails BOTH this rung and a dispatch-time rung (e.g. order-6 `request-params`, -32602) is answered by this gate first with 400 / -32020, not by the earlier-ordered rung."}],dv={[I.ParseError]:400,[I.InvalidRequest]:400,[I.MethodNotFound]:404,[I.UnsupportedProtocolVersion]:400,[I.MissingRequiredClientCapability]:400,[Gs]:400};function rl(e,t){return Ui(e,t)}function Ws(e){return new Set(e.flatMap((t)=>Object.keys(t.shape)))}function Wc(e){if(e==null)return!1;let t=typeof e;if(t!=="object"&&t!=="function")return!1;if(!("~standard"in e))return!1;return typeof e["~standard"]?.validate==="function"}var kh=!1,Kc="draft-2020-12";function eS(e,t="input"){let o=e["~standard"],r;if(o.jsonSchema)r=o.jsonSchema[t]({target:Kc});else if(o.vendor==="zod"){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().");if(!kh)kh=!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.");r=ji(e,{target:Kc,io:t})}else throw Error(`Schema library "${o.vendor}" does not implement StandardJSONSchemaV1 (\`~standard.jsonSchema\`). Upgrade to a version that does, or wrap your JSON Schema with fromJsonSchema().`);if(t==="output"){if(r.type!==void 0)return r;return nm(r)?{type:"object",...r}:r}if(r.type!==void 0&&r.type!=="object")throw Error(`MCP tool and prompt schemas must describe objects (got type: ${JSON.stringify(r.type)}). Wrap your schema in z.object({...}) or equivalent.`);return{type:"object",...r}}function nm(e){if("properties"in e||"patternProperties"in e||"additionalProperties"in e||"required"in e)return!0;for(let t of["oneOf","anyOf","allOf"]){let o=e[t];if(Array.isArray(o)&&o.length>0)return o.every((r)=>r!==null&&typeof r==="object"&&(r.type==="object"||nm(r)))}return!1}function tS(e){if(!e.path?.length)return e.message;return`${e.path.map((t)=>String(typeof t==="object"?t.key:t)).join(".")}: ${e.message}`}async function Hc(e,t){let o=await e["~standard"].validate(t);if(o.issues&&o.issues.length>0)return{success:!1,error:o.issues.map((r)=>tS(r)).join(", ")};return{success:!0,data:o.value}}function oS(e){let t=ji(e,{target:Kc,io:"input"});return typeof t.pattern==="string"?t.pattern:void 0}var rS=/\\\.\\d\{(\d+)\}/;function nS(e){let t=rS.exec(e),o=[void 0,-1,0];if(t)o.push(Number(t[1]));return[!1,!0].flatMap((r)=>[!1,!0].flatMap((n)=>o.map((i)=>So({local:r,offset:n,precision:i}))))}function sS(e,t){let o;switch(e){case"email":o=[oh()];break;case"uri":o=[Di()];break;case"date":o=[Nc()];break;case"date-time":o=nS(t);break}return new Set(o.map((r)=>oS(r)).filter((r)=>r!==void 0))}function iS(e,t,o){if(o!=="zod")return!0;return sS(e,t).has(t)}function Qs(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}function aS(e){try{return eS(e,"input")}catch(t){let o=t instanceof Error?t.message:String(t);throw new oe(I.InvalidParams,`Elicitation requestedSchema must describe an object with flat primitive properties: ${o}`)}}var cS=new Set(["$comment","deprecated","description","examples","readOnly","title","writeOnly"]);function nl(e){return cS.has(e)||e.startsWith("x-")}var lS=new Set(["$schema",...Object.keys(Ft.shape.requestedSchema.shape)]),$h={string:Ws([Dt,Zo,Do,Ho]),number:Ws([Ht]),integer:Ws([Ht]),boolean:Ws([Uo]),array:Ws([Fo,Vo])},uS=new Set(Dt.shape.format.unwrap().options);function dS(e,t,o,r){if(!Qs(e))return e;let n=typeof e.type==="string"&&Object.hasOwn($h,e.type)?$h[e.type]:void 0;if(n===void 0)return e;let i={};for(let[a,u]of Object.entries(e))if(n.has(a)||nl(a))i[a]=u;else if(a==="pattern"&&e.type==="string"&&typeof e.format==="string"){if(!uS.has(e.format))i[a]=u;else if(typeof u!=="string"||!iS(e.format,u,o))r.push(`${t}.${a}`)}else r.push(`${t}.${a}`);return i}function pS(e,t){let o={},r=[];for(let[n,i]of Object.entries(e))if(n==="properties"&&Qs(i))o[n]=Object.fromEntries(Object.entries(i).map(([a,u])=>[a,dS(u,`properties.${a}`,t,r)]));else if(lS.has(n))o[n]=i;else if(!nl(n))r.push(n);if(r.length>0)throw new oe(I.InvalidParams,`Elicitation requestedSchema contains unsupported JSON Schema constraint(s) after Standard Schema conversion: ${r.join(", ")}`);return o}function hS(e,t){if(!Qs(e.properties))return t;let o=Object.entries(e.properties).filter(([,r])=>!rl(Jo,r).success).map(([r])=>`properties.${r}`);return o.length>0?o.join(", "):t}function Gc(e,t,o=""){if(Array.isArray(e)&&Array.isArray(t))return e.flatMap((r,n)=>Gc(r,t[n],`${o}[${n}]`));if(!Qs(e)||!Qs(t))return[];return Object.entries(e).flatMap(([r,n])=>{let i=o?`${o}.${r}`:r;if(!Object.prototype.hasOwnProperty.call(t,r))return nl(r)?[]:[i];return Gc(n,t[r],i)})}function mS(e){if(!Wc(e.requestedSchema))return{...e,mode:"form",requestedSchema:e.requestedSchema};let t=e.requestedSchema["~standard"].vendor,o=pS(aS(e.requestedSchema),t),r=rl(Ft.shape.requestedSchema,o);if(!r.success)throw new oe(I.InvalidParams,`Elicitation requestedSchema only supports flat primitive properties (string, number, integer, boolean, and string enums): ${hS(o,r.error.message)}`);let n=Gc(o,r.data);if(n.length>0)throw new oe(I.InvalidParams,`Elicitation requestedSchema contains unsupported JSON Schema constraint(s) after Standard Schema conversion: ${n.join(", ")}`);let i=(r.data.required??[]).filter((a)=>!Object.prototype.hasOwnProperty.call(r.data.properties,a));if(i.length>0)throw new oe(I.InvalidParams,`Elicitation requestedSchema lists required properties that are not defined in properties: ${i.join(", ")}`);return{...e,mode:"form",requestedSchema:r.data}}function fS(e){let t=e.inputRequests!==void 0&&Object.keys(e.inputRequests).length>0,o=typeof e.requestState==="string";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",...e.inputRequests!==void 0&&{inputRequests:e.inputRequests},...e.requestState!==void 0&&{requestState:e.requestState}}}var pv=Object.assign(fS,{elicit(e){try{return{method:"elicitation/create",params:mS(e)}}catch(t){throw t instanceof oe?TypeError(t.message,{cause:t}):t}},elicitUrl(e){return{method:"elicitation/create",params:{...e,mode:"url"}}},createMessage(e){return{method:"sampling/createMessage",params:e}},listRoots(){return{method:"roots/list"}}});var gS=["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"],SS={IdJagTokenExchangeResponseSchema:Ds,OAuthClientInformationFullSchema:Js,OAuthClientInformationSchema:Vs,OAuthClientMetadataSchema:Fs,OAuthClientRegistrationErrorSchema:_a,OAuthErrorResponseSchema:Hs,OAuthMetadataSchema:Bo,OAuthProtectedResourceMetadataSchema:js,OAuthTokenRevocationRequestSchema:ba,OAuthTokensSchema:Zs,OpenIdProviderDiscoveryMetadataSchema:Us,OpenIdProviderMetadataSchema:Ls},sm={},im={};function am(e,t){let o=e.slice(0,-6);sm[o]=t,im[o]=(r)=>t.safeParse(r).success}for(let e of gS)am(e,Xg[e]);for(let[e,t]of Object.entries(SS))am(e,t);var _S=Object.freeze(sm),bS=Object.freeze(im);function yS(e){switch(e){case"initialize":case"notifications/initialized":return Ys(void 0);case"server/discover":return Ys(ol);default:return}}var cm=60000,vS=[It,vo,Ot,zo],zS=["inputResponses","requestState"];function Ch(e,t){let o=e.params;if(!Fc(o))return{message:e,lifted:{}};let r=o._meta,n=Fc(r)?vS.filter((d)=>(d in r)):[],i=t==="request"?zS.filter((d)=>(d in o)):[];if(n.length===0&&i.length===0)return{message:e,lifted:{}};let a={},u={...o};if(n.length>0&&Fc(r)){let d={},p={...r};for(let f of n)d[f]=r[f],delete p[f];if(a.envelope=d,Object.keys(p).length>0)u._meta=p;else delete u._meta}for(let d of i){if(d==="inputResponses")a.inputResponses=u[d];if(d==="requestState")a.requestState=u[d];delete u[d]}return{message:{...e,params:u},lifted:a}}function Ih(e,t){let o=e.validateResult(t,void 0);if(!o.ok&&o.reason==="not-in-era")return;return{"~standard":{version:1,vendor:"mcp-wire-codec",validate(r){let n=e.validateResult(t,r);if(n.ok)return{value:n.value};return{issues:[{message:n.reason==="invalid"?n.message:`not-in-era: ${t}`}]}}}}}function lm(e){return()=>e}var RS=lm(void 0),wS,Xs=class{_transport;_requestMessageId=0;_requestHandlers=new Map;_customSchemaRequestMethods=new Set;_requestHandlerAbortControllers=new Map;_notificationHandlers=new Map;_responseHandlers=new Map;_progressHandlers=new Map;_timeoutInfo=new Map;_pendingDebouncedNotifications=new Set;_negotiatedProtocolVersion;static{wS=(e,t)=>{e._negotiatedProtocolVersion=t}}_supportedProtocolVersions;onclose;onerror;fallbackRequestHandler;fallbackNotificationHandler;constructor(e){this._options=e,this._supportedProtocolVersions=e?.supportedProtocolVersions??Ji,this.setNotificationHandler("notifications/cancelled",(t)=>{this._oncancel(t)}),this.setNotificationHandler("notifications/progress",(t)=>{this._onprogress(t)}),this.setRequestHandler("ping",(t)=>({}))}_shouldDropInbound(e){}_outboundMetaEnvelope(){}_envelopeOutbound(e){let t=this._outboundMetaEnvelope();if(t===void 0)return e;let o=e.params??{};return{...e,params:{...o,_meta:{...t,...o._meta}}}}_resolveNonCompleteResult(e,t){return Promise.reject(new K(te.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){if(e.params.requestId===void 0)return;this._requestHandlerAbortControllers.get(e.params.requestId)?.abort(e.params.reason)}_setupTimeout(e,t,o,r,n=!1){this._timeoutInfo.set(e,{timeoutId:setTimeout(r,t),startTime:Date.now(),timeout:t,maxTotalTimeout:o,resetTimeoutOnProgress:n,onTimeout:r})}_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 K(te.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);if(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=(n)=>{o?.(n),this._onerror(n)};let r=this._transport?.onmessage;this._transport.onmessage=(n,i)=>{if(r?.(n,i),Bc(n)||rm(n))this._onresponse(n);else if(tm(n))this._onrequest(n,i);else if(om(n))this._onnotification(n,i);else this._onerror(Error(`Unknown message type: ${JSON.stringify(n)}`))},e.setSupportedProtocolVersions?.(this._supportedProtocolVersions),await this._transport.start()}_onclose(){let e=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._pendingDebouncedNotifications.clear();for(let r of this._timeoutInfo.values())clearTimeout(r.timeoutId);this._timeoutInfo.clear();let t=this._requestHandlerAbortControllers;this._requestHandlerAbortControllers=new Map;let o=new K(te.ConnectionClosed,"Connection closed");this._transport=void 0;try{this.onclose?.()}finally{for(let r of e.values())r(o);for(let r of t.values())r.abort(o)}}_onerror(e){this.onerror?.(e)}_onnotification(e,t){let{message:o}=Ch(e,"notification"),r=this._negotiatedWireCodec();if(t?.classification===void 0&&this._shouldDropInbound(e)==="drop")return;if(t?.classification!==void 0){let a=Eh(t.classification);if(a!==r.era){this._onerror(Error(`Era mismatch on inbound notification '${o.method}': classified as ${a} but this instance serves ${r.era}`));return}}if(Dc(o.method)&&!r.hasNotificationMethod(o.method))return;let n=this._notificationHandlers.get(o.method),i=this.fallbackNotificationHandler;if(n===void 0&&i===void 0)return;Promise.resolve().then(()=>n===void 0?i(o):n(o,r)).catch((a)=>this._onerror(Error(`Uncaught error in notification handler: ${a}`)))}_onrequest(e,t){let{message:o,lifted:r}=Ch(e,"request"),n=this._negotiatedWireCodec();if(t?.classification===void 0&&this._shouldDropInbound(e)==="drop"){this._onerror(Error(`Dropped inbound request '${e.method}': not servable on this connection's protocol era`));return}let i=this._transport,a=(P,k,A)=>{let B={jsonrpc:"2.0",id:o.id,error:{code:P,message:k,...A!==void 0&&{data:A}}};i?.send(B).catch((q)=>this._onerror(Error(`Failed to send an error response: ${q}`)))};if(t?.classification!==void 0){let P=Eh(t.classification);if(P!==n.era){this._onerror(Error(`Era mismatch on inbound request '${o.method}': classified as ${P} but this instance serves ${n.era}`));let k=t.classification.revision??P;a(I.UnsupportedProtocolVersion,`Unsupported protocol version: ${k}`,{supported:this._supportedProtocolVersions,requested:k});return}}if(Zc(o.method)&&!n.hasRequestMethod(o.method)&&!(Ph(o.method)&&this._customSchemaRequestMethods.has(o.method))){a(I.MethodNotFound,"Method not found");return}let u=this._requestHandlers.get(o.method)??this.fallbackRequestHandler;if(u===void 0){a(I.MethodNotFound,"Method not found");return}let d=n.checkInboundEnvelope(r);if(d!==void 0){a(I.InvalidParams,d);return}let p=(P,k)=>this._notificationViaCodec(this._resolveOutboundCodec(P.method),P,{...k,relatedRequestId:o.id}),f=(P,k,A)=>this._requestWithSchemaViaCodec(this._resolveOutboundCodec(P.method),P,k,{...A,relatedRequestId:o.id}),b=new AbortController;this._requestHandlerAbortControllers.set(o.id,b);let y=r.inputResponses===void 0?void 0:xS(r.inputResponses),z={sessionId:i?.sessionId,mcpReq:{id:o.id,method:o.method,_meta:o.params?._meta,...r.envelope!==void 0&&{envelope:r.envelope},...y!==void 0&&{inputResponses:y.accepted},...y!==void 0&&y.droppedKeys.length>0&&{droppedInputResponseKeys:y.droppedKeys},requestState:r.requestState===void 0?RS:lm(r.requestState),signal:b.signal,send:(P,k,A)=>{let B=this._resolveOutboundCodec(P.method);if(this._assertOutboundRequestInEra(B,P.method),Wc(k))return f(P,k,A);let q=Ih(B,P.method);if(q===void 0)throw TypeError(`'${P.method}' is not a spec method; pass a result schema as the second argument to ctx.mcpReq.send().`);return f(P,q,k)},notify:p},http:t?.authInfo?{authInfo:t.authInfo}:void 0},E=this.buildContext(z,t);Promise.resolve().then(()=>u(o,E)).then(async(P)=>{if(b.signal.aborted)return;let k;try{k=n.encodeResult(o.method,P,this._outboundServerInfo())}catch(B){this._onerror(Error(`Failed to encode result for ${o.method}: ${B}`)),a(I.InternalError,"Internal error");return}let A={result:k,jsonrpc:"2.0",id:o.id};await i?.send(A)},async(P)=>{if(b.signal.aborted)return;let k=Number.isSafeInteger(P.code)?P.code:I.InternalError,A={jsonrpc:"2.0",id:o.id,error:{code:n.encodeErrorCode(k),message:P.message??"Internal error",...P.data!==void 0&&{data:P.data}}};await i?.send(A)}).catch((P)=>this._onerror(Error(`Failed to send response: ${P}`))).finally(()=>{if(this._requestHandlerAbortControllers.get(o.id)===b)this._requestHandlerAbortControllers.delete(o.id)})}_onprogress(e){let{progressToken:t,...o}=e.params,r=Number(t),n=this._progressHandlers.get(r);if(!n){this._onerror(Error(`Received a progress notification for an unknown token: ${JSON.stringify(e)}`));return}let i=this._responseHandlers.get(r),a=this._timeoutInfo.get(r);if(a&&i&&a.resetTimeoutOnProgress)try{this._resetTimeout(r)}catch(u){this._responseHandlers.delete(r),this._progressHandlers.delete(r),this._cleanupTimeout(r),i(u);return}n(o)}_onresponse(e){let t=Number(e.id),o=this._responseHandlers.get(t);if(o===void 0){this._onerror(Error(`Received a response for an unknown message ID: ${JSON.stringify(e)}`));return}if(this._responseHandlers.delete(t),this._cleanupTimeout(t),this._progressHandlers.delete(t),Bc(e))o(e);else o(oe.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 r=this._resolveOutboundCodec(e.method);if(Wc(t)){if(!Ph(e.method))this._assertOutboundRequestInEra(r,e.method);return this._requestWithSchemaViaCodec(r,e,t,o)}this._assertOutboundRequestInEra(r,e.method);let n=Ih(r,e.method);if(n===void 0)throw TypeError(`'${e.method}' is not a spec method; pass a result schema as the second argument to request().`);return this._requestWithSchemaViaCodec(r,e,n,t)}_negotiatedWireCodec(){return Ys(this._negotiatedProtocolVersion)}_wireCodec(){return this._negotiatedWireCodec()}_resolveOutboundCodec(e){if(this._negotiatedProtocolVersion===void 0){let t=yS(e);if(t)return t}return this._negotiatedWireCodec()}_assertOutboundRequestInEra(e,t){if(Zc(t)&&!e.hasRequestMethod(t))throw new K(te.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 r=this._resolveOutboundCodec(e.method);return this._assertOutboundRequestInEra(r,e.method),this._requestWithSchemaViaCodec(r,e,t,o)}_requestWithSchemaViaCodec(e,t,o,r){let{relatedRequestId:n,resumptionToken:i,onresumptiontoken:a,headers:u}=r??{},d=Date.now(),p,f;return new Promise((b,y)=>{let z=(U)=>{y(U)};if(!this._transport){z(Error("Not connected"));return}if(this._options?.enforceStrictCapabilities===!0)try{this.assertCapabilityForMethod(t.method)}catch(U){z(U);return}if(r?.signal?.aborted){let U=r.signal.reason;throw U instanceof K?U:new K(te.RequestTimeout,String(U))}let E=e.era===ol&&this._transport.hasPerRequestStream===!0?new AbortController:void 0,P=this._requestMessageId++;f=P;let k={...t,jsonrpc:"2.0",id:P};if(r?.onprogress)this._progressHandlers.set(P,r.onprogress),k.params={...t.params,_meta:{...t.params?._meta,progressToken:P}};let A=this._envelopeOutbound(k),B=!1,q=(U)=>{if(B)return;if(this._progressHandlers.delete(P),E===void 0){if(t.method!=="initialize")this._transport?.send(this._envelopeOutbound({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:P,reason:String(U)}}),{relatedRequestId:n,resumptionToken:i,onresumptiontoken:a}).catch((G)=>this._onerror(Error(`Failed to send cancellation: ${G}`)))}else E.abort();y(U instanceof K?U:new K(te.RequestTimeout,String(U)))};this._responseHandlers.set(P,(U)=>{if(r?.signal?.aborted)return;if(B=!0,U instanceof Error)return y(U);let G;try{G=e.decodeResult(t.method,U.result)}catch(ie){return y(ie instanceof Error?ie:Error(String(ie)))}if(G.kind==="invalid")return y(G.error);if(G.kind==="input_required"){if(r?.allowInputRequired===!0)return b(TS(G));let ie={codec:e,request:t,resultSchema:o,options:r,flowStartedAt:d,retry:(Ke,pt)=>this._requestWithSchemaViaCodec(e,Ke===void 0?{method:t.method}:{method:t.method,params:Ke},o,pt)};return b(this._resolveNonCompleteResult(G,ie))}let qe=G.result;Hc(o,qe).then((ie)=>{if(ie.success)b(ie.data);else y(new K(te.InvalidResult,`Invalid result for ${t.method}: ${ie.error}`))},y)}),p=()=>q(r?.signal?.reason),r?.signal?.addEventListener("abort",p,{once:!0});let M=r?.timeout??cm,D=()=>q(new K(te.RequestTimeout,"Request timed out",{timeout:M}));this._setupTimeout(P,M,r?.maxTotalTimeout,D,r?.resetTimeoutOnProgress??!1),this._transport.send(A,{relatedRequestId:n,resumptionToken:i,onresumptiontoken:a,headers:u,requestSignal:E?.signal}).catch((U)=>{this._progressHandlers.delete(P),y(U)})}).finally(()=>{if(p)r?.signal?.removeEventListener("abort",p);if(f!==void 0)this._responseHandlers.delete(f),this._cleanupTimeout(f)})}async notification(e,t){return await this._notificationViaCodec(this._resolveOutboundCodec(e.method),e,t)}async _notificationViaCodec(e,t,o){if(!this._transport)throw new K(te.NotConnected,"Not connected");if(Dc(t.method)&&!e.hasNotificationMethod(t.method))throw new K(te.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 r=this._envelopeOutbound({jsonrpc:"2.0",...t});if((this._options?.debouncedNotificationMethods??[]).includes(t.method)&&!t.params&&o?.relatedRequestId===void 0){if(this._pendingDebouncedNotifications.has(t.method))return;this._pendingDebouncedNotifications.add(t.method),Promise.resolve().then(()=>{if(this._pendingDebouncedNotifications.delete(t.method),!this._transport)return;this._transport?.send(r,o).catch((n)=>this._onerror(n))});return}await this._transport.send(r,o)}setRequestHandler(e,t,o){this.assertRequestHandlerCapability(e);let r;if(typeof t==="function"){if(!Zc(e))throw TypeError(`'${e}' is not a spec request method; pass schemas as the second argument to setRequestHandler().`);r=(n,i)=>{let a=this._negotiatedWireCodec(),u=a.validateRequest(e,n);if(!u.ok&&u.reason==="not-in-era")u=a.validateInputRequest(e,n);if(!u.ok){if(u.reason==="not-in-era")throw new oe(I.InternalError,`No wire schema for ${e} in the resolved era`);throw Error(u.message)}return Promise.resolve(t(u.value,i))}}else if(o)r=async(n,i)=>{let a=await Hc(t.params,{...n.params});if(!a.success)throw new oe(I.InvalidParams,`Invalid params for ${e}: ${a.error}`);return o(a.data,i)};else throw TypeError("setRequestHandler: handler is required");if(typeof t==="function")this._customSchemaRequestMethods.delete(e);else this._customSchemaRequestMethods.add(e);this._requestHandlers.set(e,this._wrapHandler(e,r))}_wrapHandler(e,t){return t}_outboundServerInfo(){}removeRequestHandler(e){this._requestHandlers.delete(e),this._customSchemaRequestMethods.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(typeof t==="function"){if(!Dc(e))throw TypeError(`'${e}' is not a spec notification method; pass schemas as the second argument to setNotificationHandler().`);this._notificationHandlers.set(e,(r,n)=>{let i=n.validateNotification(e,r);if(!i.ok){if(i.reason==="not-in-era")throw new oe(I.InternalError,`No wire schema for ${e} in the resolved era`);throw Error(i.message)}return Promise.resolve(t(i.value))});return}if(!o)throw TypeError("setNotificationHandler: handler is required");this._notificationHandlers.set(e,async(r)=>{let n=await Hc(t.params,{...r.params});if(!n.success)throw new oe(I.InvalidParams,`Invalid params for notification ${e}: ${n.error}`);await o(n.data,r)})}removeNotificationHandler(e){this._notificationHandlers.delete(e)}};function Fc(e){return e!==null&&typeof e==="object"&&!Array.isArray(e)}function Oh(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}function xS(e){let t={},o=[];if(!Oh(e))return{accepted:t,droppedKeys:o};for(let[r,n]of Object.entries(e)){if(!Oh(n)||"method"in n||"result"in n){o.push(r);continue}t[r]=n}return{accepted:t,droppedKeys:o}}function TS(e){return{resultType:"input_required",inputRequests:e.inputRequests,...e.requestState!==void 0&&{requestState:e.requestState},...e._meta!==void 0&&{_meta:e._meta}}}/*!
66
65
  * content-type
67
66
  * Copyright(c) 2015 Douglas Christopher Wilson
68
67
  * MIT Licensed
69
- */var WX=z9((b)=>{var H=/; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g,Q=/\\([\u000b\u0020-\u00ff])/g,N=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;b.parse=E;function E(Y){if(!Y)throw TypeError("argument string is required");var D=typeof Y==="object"?M(Y):Y;if(typeof D!=="string")throw TypeError("argument string is required to be a string");var J=D.indexOf(";"),K=J!==-1?D.slice(0,J).trim():D.trim();if(!N.test(K))throw TypeError("invalid media type");var O=new _(K.toLowerCase());if(J!==-1){var A,V,j;H.lastIndex=J;while(V=H.exec(D)){if(V.index!==J)throw TypeError("invalid parameter format");if(J+=V[0].length,A=V[1].toLowerCase(),j=V[2],j.charCodeAt(0)===34){if(j=j.slice(1,-1),j.indexOf("\\")!==-1)j=j.replace(Q,"$1")}O.parameters[A]=j}if(J!==D.length)throw TypeError("invalid parameter format")}return O}function M(Y){var D;if(typeof Y.getHeader==="function")D=Y.getHeader("content-type");else if(typeof Y.headers==="object")D=Y.headers&&Y.headers["content-type"];if(typeof D!=="string")throw TypeError("content-type header is missing from object");return D}function _(Y){this.parameters=Object.create(null),this.type=Y}}),pK=R9(WX(),1);var Q2=typeof self<"u"&&self.location&&self.location.origin!=="null"?new URL(self.location.origin+self.location.pathname+location.search):new URL("https://github.com/cfworker");var _X=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,wX=[0,31,28,31,30,31,30,31,31,30,31,30,31],YX=/^(\d\d):(\d\d):(\d\d)(\.\d+)?(z|[+-]\d\d(?::?\d\d)?)?$/i,DX=/^(?=.{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,JX=/^(?:[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,BX=/^(?:(?:[^\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,XX=/^(?:(?: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,qX=/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,KX=/^(?:\/(?:[^~/]|~0|~1)*)*$/,GX=/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,OX=/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,AX=(b)=>{if(b[0]==='"')return!1;let[H,Q,...N]=b.split("@");if(!H||!Q||N.length!==0||H.length>64||Q.length>253)return!1;if(H[0]==="."||H.endsWith(".")||H.includes(".."))return!1;if(!/^[a-z0-9.-]+$/i.test(Q)||!/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+$/i.test(H))return!1;return Q.split(".").every((E)=>/^[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?$/i.test(E))},FX=/^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/,VX=/^((([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,UX=(b)=>b.length>1&&b.length<80&&(/^P\d+([.,]\d+)?W$/.test(b)||/^P[\dYMDTHS]*(\d[.,]\d+)?[YMDHS]$/.test(b)&&/^P([.,\d]+Y)?([.,\d]+M)?([.,\d]+D)?(T([.,\d]+H)?([.,\d]+M)?([.,\d]+S)?)?$/.test(b));function ab(b){return b.test.bind(b)}var N2={date:K3,time:G3.bind(void 0,!1),"date-time":IX,duration:UX,uri:ZX,"uri-reference":ab(JX),"uri-template":ab(BX),url:ab(XX),email:AX,hostname:ab(DX),ipv4:ab(FX),ipv6:ab(VX),regex:LX,uuid:ab(qX),"json-pointer":ab(KX),"json-pointer-uri-fragment":ab(GX),"relative-json-pointer":ab(OX)};function PX(b){return b%4===0&&(b%100!==0||b%400===0)}function K3(b){let H=b.match(_X);if(!H)return!1;let Q=+H[1],N=+H[2],E=+H[3];return N>=1&&N<=12&&E>=1&&E<=(N==2&&PX(Q)?29:wX[N])}function G3(b,H){let Q=H.match(YX);if(!Q)return!1;let N=+Q[1],E=+Q[2],M=+Q[3],_=!!Q[5];return(N<=23&&E<=59&&M<=59||N==23&&E==59&&M==60)&&(!b||_)}var zX=/t|\s/i;function IX(b){let H=b.split(zX);return H.length==2&&K3(H[0])&&G3(!0,H[1])}var RX=/\/|:/,TX=/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)(?:\?(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i;function ZX(b){return RX.test(b)&&TX.test(b)}var jX=/[^\\]\\Z/;function LX(b){if(jX.test(b))return!1;try{return new RegExp(b,"u"),!0}catch(H){return!1}}var CX;CX=globalThis.crypto;var qW=class extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.OAuthClientFlowError"})}static[Symbol.hasInstance](b){return Lb(this,b)}static isInstance(b){if(typeof this!=="function")throw TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return Lb(this,b)}constructor(b){super(b);this.name=new.target.name,PQ(this,new.target)}},a2=class extends qW{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.IssuerMismatchError"})}kind;expected;received;constructor(b,H,Q){super(`Issuer mismatch in ${b==="metadata"?"authorization server metadata (RFC 8414 §3.3)":"authorization response (RFC 9207)"}: expected ${JSON.stringify(H)}, received ${JSON.stringify(Q)}`);this.kind=b,this.expected=H,this.received=Q}},e2=class extends qW{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.RegistrationRejectedError"})}status;body;submittedMetadata;constructor(b){super(`Dynamic Client Registration rejected (HTTP ${b.status}): ${b.body}`);this.status=b.status,this.body=b.body,this.submittedMetadata=b.submittedMetadata}},bG=class extends qW{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.InsecureTokenEndpointError"})}tokenEndpoint;constructor(b){super(`Refusing to send credentials to non-https token endpoint '${b}'. OAuth token requests MUST use TLS (localhost / *.localhost / 127.0.0.1 / ::1 are exempt).`);this.tokenEndpoint=b}},HG=class extends qW{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.AuthorizationServerMismatchError"})}constructor(b,H){super(`Authorization server mismatch: credentials are bound to ${JSON.stringify(b)} but this call resolved ${JSON.stringify(H)}; refusing to present them to a different authorization server`);this.recordedIssuer=b,this.currentIssuer=H}},QG=class extends qW{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.InsufficientScopeError"})}requiredScope;resourceMetadataUrl;errorDescription;constructor(b){super(`Insufficient scope${b.requiredScope?`: required "${b.requiredScope}"`:""}`);this.requiredScope=b.requiredScope,this.resourceMetadataUrl=b.resourceMetadataUrl,this.errorDescription=b.errorDescription}};var NG=class extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.UnauthorizedError"})}static[Symbol.hasInstance](b){return Lb(this,b)}static isInstance(b){if(typeof this!=="function")throw TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return Lb(this,b)}constructor(b){super(b??"Unauthorized");this.name="UnauthorizedError",PQ(this,new.target)}};var EG=class extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.SseError"})}static[Symbol.hasInstance](b){return Lb(this,b)}static isInstance(b){if(typeof this!=="function")throw TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return Lb(this,b)}constructor(b,H,Q){super(`SSE error: ${H}`);this.code=b,this.event=Q,PQ(this,new.target)}};class P3{_eventSlots=new Map;setHandler(b,H){let Q=this._ensureEventSlot(b);if(Q.onHandler&&H)console.warn(`[MCP Apps] on${String(b)} handler replaced. Use addEventListener("${String(b)}", …) to add multiple listeners without replacing.`);Q.onHandler=H}getHandler(b){return this._eventSlots.get(b)?.onHandler}addEventListener(b,H){this._ensureEventSlot(b).listeners.push(H)}removeEventListener(b,H){let Q=this._eventSlots.get(b);if(!Q)return;let N=Q.listeners.indexOf(H);if(N!==-1)Q.listeners.splice(N,1)}dispatch(b,H){let Q=this._eventSlots.get(b);if(!Q)return;Q.onHandler?.(H);for(let N of[...Q.listeners])N(H)}_ensureEventSlot(b){let H=this._eventSlots.get(b);if(!H)H={listeners:[]},this._eventSlots.set(b,H);return H}}class z3{_methods=new Set;claim(b,H){if(this._methods.has(b))throw Error(`Handler for "${b}" already registered (via ${H}). Use addEventListener() to attach multiple listeners, or the on* setter for replace semantics.`);this._methods.add(b)}replace(b){this._methods.add(b)}release(b){this._methods.delete(b)}has(b){return this._methods.has(b)}}var O3=new Set;function A3(b,H){let[Q,N]=H,E=Q?.shape;if(typeof E?.method?.value!=="string")return;let M=E.method.value,_=b==="request"?"setRequestHandler":"setNotificationHandler";if(!O3.has(_))O3.add(_),console.warn(`[ext-apps] ${_}(Schema, handler) is deprecated; use ${_}("${M}", { params: Schema.shape.params }, handler).`);let Y=N;return[M,{params:E.params},b==="request"?(D,J)=>Y({method:M,params:D},SX(J)):(D)=>Y({method:M,params:D})]}function SX(b){return{signal:b.mcpReq.signal,requestId:b.mcpReq.id,sessionId:b.sessionId,_meta:b.mcpReq._meta,sendRequest:b.mcpReq.send,sendNotification:b.mcpReq.notify,authInfo:b.http?.authInfo}}var gX="2026-01-26";var kX="ui/notifications/tool-input-partial";class I3{eventTarget;eventSource;messageListener;constructor(b=window.parent,H){this.eventTarget=b,this.eventSource=H,this.messageListener=(Q)=>{if(H&&Q.source!==this.eventSource){console.debug("Ignoring message from unknown source",Q);return}let N=wH.safeParse(Q.data);if(N.success)console.debug("Parsed message",N.data),this.onmessage?.(N.data);else if(Q.data?.jsonrpc!=="2.0")console.debug("Ignoring non-JSON-RPC message",N.error.message,Q);else console.error("Failed to parse message",N.error.message,Q),this.onerror?.(Error("Invalid JSON-RPC message received: "+N.error.message))}}async start(){window.addEventListener("message",this.messageListener)}async send(b,H){if(b.method!==kX)console.debug("Sending message",b);this.eventTarget.postMessage(b,"*")}async close(){window.removeEventListener("message",this.messageListener),this.onclose?.()}onclose;onerror;onmessage;sessionId;setProtocolVersion}var xX=W.union([W.literal("light"),W.literal("dark")]).describe("Color theme preference for the host environment."),KW=W.union([W.literal("inline"),W.literal("fullscreen"),W.literal("pip")]).describe("Display mode for UI presentation."),vX=W.union([W.literal("--color-background-primary"),W.literal("--color-background-secondary"),W.literal("--color-background-tertiary"),W.literal("--color-background-inverse"),W.literal("--color-background-ghost"),W.literal("--color-background-info"),W.literal("--color-background-danger"),W.literal("--color-background-success"),W.literal("--color-background-warning"),W.literal("--color-background-disabled"),W.literal("--color-text-primary"),W.literal("--color-text-secondary"),W.literal("--color-text-tertiary"),W.literal("--color-text-inverse"),W.literal("--color-text-ghost"),W.literal("--color-text-info"),W.literal("--color-text-danger"),W.literal("--color-text-success"),W.literal("--color-text-warning"),W.literal("--color-text-disabled"),W.literal("--color-border-primary"),W.literal("--color-border-secondary"),W.literal("--color-border-tertiary"),W.literal("--color-border-inverse"),W.literal("--color-border-ghost"),W.literal("--color-border-info"),W.literal("--color-border-danger"),W.literal("--color-border-success"),W.literal("--color-border-warning"),W.literal("--color-border-disabled"),W.literal("--color-ring-primary"),W.literal("--color-ring-secondary"),W.literal("--color-ring-inverse"),W.literal("--color-ring-info"),W.literal("--color-ring-danger"),W.literal("--color-ring-success"),W.literal("--color-ring-warning"),W.literal("--font-sans"),W.literal("--font-mono"),W.literal("--font-weight-normal"),W.literal("--font-weight-medium"),W.literal("--font-weight-semibold"),W.literal("--font-weight-bold"),W.literal("--font-text-xs-size"),W.literal("--font-text-sm-size"),W.literal("--font-text-md-size"),W.literal("--font-text-lg-size"),W.literal("--font-heading-xs-size"),W.literal("--font-heading-sm-size"),W.literal("--font-heading-md-size"),W.literal("--font-heading-lg-size"),W.literal("--font-heading-xl-size"),W.literal("--font-heading-2xl-size"),W.literal("--font-heading-3xl-size"),W.literal("--font-text-xs-line-height"),W.literal("--font-text-sm-line-height"),W.literal("--font-text-md-line-height"),W.literal("--font-text-lg-line-height"),W.literal("--font-heading-xs-line-height"),W.literal("--font-heading-sm-line-height"),W.literal("--font-heading-md-line-height"),W.literal("--font-heading-lg-line-height"),W.literal("--font-heading-xl-line-height"),W.literal("--font-heading-2xl-line-height"),W.literal("--font-heading-3xl-line-height"),W.literal("--border-radius-xs"),W.literal("--border-radius-sm"),W.literal("--border-radius-md"),W.literal("--border-radius-lg"),W.literal("--border-radius-xl"),W.literal("--border-radius-full"),W.literal("--border-width-regular"),W.literal("--shadow-hairline"),W.literal("--shadow-sm"),W.literal("--shadow-md"),W.literal("--shadow-lg")]).describe("CSS variable keys available to MCP apps for theming."),hX=W.record(vX.describe(`Style variables for theming MCP apps.
68
+ */var ES=hl((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,r=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;e.parse=n;function n(u){if(!u)throw TypeError("argument string is required");var d=typeof u==="object"?i(u):u;if(typeof d!=="string")throw TypeError("argument string is required to be a string");var p=d.indexOf(";"),f=p!==-1?d.slice(0,p).trim():d.trim();if(!r.test(f))throw TypeError("invalid media type");var b=new a(f.toLowerCase());if(p!==-1){var y,z,E;t.lastIndex=p;while(z=t.exec(d)){if(z.index!==p)throw TypeError("invalid parameter format");if(p+=z[0].length,y=z[1].toLowerCase(),E=z[2],E.charCodeAt(0)===34){if(E=E.slice(1,-1),E.indexOf("\\")!==-1)E=E.replace(o,"$1")}b.parameters[y]=E}if(p!==d.length)throw TypeError("invalid parameter format")}return b}function i(u){var d;if(typeof u.getHeader==="function")d=u.getHeader("content-type");else if(typeof u.headers==="object")d=u.headers&&u.headers["content-type"];if(typeof d!=="string")throw TypeError("content-type header is missing from object");return d}function a(u){this.parameters=Object.create(null),this.type=u}}),hv=fl(ES(),1);var wv=typeof self<"u"&&self.location&&self.location.origin!=="null"?new URL(self.location.origin+self.location.pathname+location.search):new URL("https://github.com/cfworker");var PS=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,kS=[0,31,28,31,30,31,30,31,31,30,31,30,31],$S=/^(\d\d):(\d\d):(\d\d)(\.\d+)?(z|[+-]\d\d(?::?\d\d)?)?$/i,CS=/^(?=.{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,IS=/^(?:[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,OS=/^(?:(?:[^\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,MS=/^(?:(?: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,qS=/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,NS=/^(?:\/(?:[^~/]|~0|~1)*)*$/,AS=/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,jS=/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,LS=(e)=>{if(e[0]==='"')return!1;let[t,o,...r]=e.split("@");if(!t||!o||r.length!==0||t.length>64||o.length>253)return!1;if(t[0]==="."||t.endsWith(".")||t.includes(".."))return!1;if(!/^[a-z0-9.-]+$/i.test(o)||!/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+$/i.test(t))return!1;return o.split(".").every((n)=>/^[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?$/i.test(n))},US=/^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/,ZS=/^((([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,DS=(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));function Me(e){return e.test.bind(e)}var xv={date:um,time:dm.bind(void 0,!1),"date-time":VS,duration:DS,uri:WS,"uri-reference":Me(IS),"uri-template":Me(OS),url:Me(MS),email:LS,hostname:Me(CS),ipv4:Me(US),ipv6:Me(ZS),regex:GS,uuid:Me(qS),"json-pointer":Me(NS),"json-pointer-uri-fragment":Me(AS),"relative-json-pointer":Me(jS)};function HS(e){return e%4===0&&(e%100!==0||e%400===0)}function um(e){let t=e.match(PS);if(!t)return!1;let o=+t[1],r=+t[2],n=+t[3];return r>=1&&r<=12&&n>=1&&n<=(r==2&&HS(o)?29:kS[r])}function dm(e,t){let o=t.match($S);if(!o)return!1;let r=+o[1],n=+o[2],i=+o[3],a=!!o[5];return(r<=23&&n<=59&&i<=59||r==23&&n==59&&i==60)&&(!e||a)}var FS=/t|\s/i;function VS(e){let t=e.split(FS);return t.length==2&&um(t[0])&&dm(!0,t[1])}var JS=/\/|:/,BS=/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)(?:\?(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i;function WS(e){return JS.test(e)&&BS.test(e)}var KS=/[^\\]\\Z/;function GS(e){if(KS.test(e))return!1;try{return new RegExp(e,"u"),!0}catch(t){return!1}}var QS;QS=globalThis.crypto;var ei=class extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.OAuthClientFlowError"})}static[Symbol.hasInstance](e){return Se(this,e)}static isInstance(e){if(typeof this!=="function")throw TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return Se(this,e)}constructor(e){super(e);this.name=new.target.name,Vt(this,new.target)}},yz=class extends ei{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.IssuerMismatchError"})}kind;expected;received;constructor(e,t,o){super(`Issuer mismatch in ${e==="metadata"?"authorization server metadata (RFC 8414 §3.3)":"authorization response (RFC 9207)"}: expected ${JSON.stringify(t)}, received ${JSON.stringify(o)}`);this.kind=e,this.expected=t,this.received=o}},vz=class extends ei{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}},zz=class extends ei{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 / *.localhost / 127.0.0.1 / ::1 are exempt).`);this.tokenEndpoint=e}},Rz=class extends ei{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.AuthorizationServerMismatchError"})}constructor(e,t){super(`Authorization server mismatch: credentials are bound to ${JSON.stringify(e)} but this call resolved ${JSON.stringify(t)}; refusing to present them to a different authorization server`);this.recordedIssuer=e,this.currentIssuer=t}},wz=class extends ei{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}};var xz=class extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.UnauthorizedError"})}static[Symbol.hasInstance](e){return Se(this,e)}static isInstance(e){if(typeof this!=="function")throw TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return Se(this,e)}constructor(e){super(e??"Unauthorized");this.name="UnauthorizedError",Vt(this,new.target)}};var Tz=class extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.SseError"})}static[Symbol.hasInstance](e){return Se(this,e)}static isInstance(e){if(typeof this!=="function")throw TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return Se(this,e)}constructor(e,t,o){super(`SSE error: ${t}`);this.code=e,this.event=o,Vt(this,new.target)}};class Sm{_eventSlots=new Map;setHandler(e,t){let o=this._ensureEventSlot(e);if(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 r=o.listeners.indexOf(t);if(r!==-1)o.listeners.splice(r,1)}dispatch(e,t){let o=this._eventSlots.get(e);if(!o)return;o.onHandler?.(t);for(let r of[...o.listeners])r(t)}_ensureEventSlot(e){let t=this._eventSlots.get(e);if(!t)t={listeners:[]},this._eventSlots.set(e,t);return t}}class _m{_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 pm=new Set;function hm(e,t){let[o,r]=t,n=o?.shape;if(typeof n?.method?.value!=="string")return;let i=n.method.value,a=e==="request"?"setRequestHandler":"setNotificationHandler";if(!pm.has(a))pm.add(a),console.warn(`[ext-apps] ${a}(Schema, handler) is deprecated; use ${a}("${i}", { params: Schema.shape.params }, handler).`);let u=r;return[i,{params:n.params},e==="request"?(d,p)=>u({method:i,params:d},XS(p)):(d)=>u({method:i,params:d})]}function XS(e){return{signal:e.mcpReq.signal,requestId:e.mcpReq.id,sessionId:e.sessionId,_meta:e.mcpReq._meta,sendRequest:e.mcpReq.send,sendNotification:e.mcpReq.notify,authInfo:e.http?.authInfo}}var e_="2026-01-26";var t_="ui/notifications/tool-input-partial";class bm{eventTarget;eventSource;messageListener;constructor(e=window.parent,t){this.eventTarget=e,this.eventSource=t,this.messageListener=(o)=>{if(t&&o.source!==this.eventSource){console.debug("Ignoring message from unknown source",o);return}let r=Ze.safeParse(o.data);if(r.success)console.debug("Parsed message",r.data),this.onmessage?.(r.data);else if(o.data?.jsonrpc!=="2.0")console.debug("Ignoring non-JSON-RPC message",r.error.message,o);else console.error("Failed to parse message",r.error.message,o),this.onerror?.(Error("Invalid JSON-RPC message received: "+r.error.message))}}async start(){window.addEventListener("message",this.messageListener)}async send(e,t){if(e.method!==t_)console.debug("Sending message",e);this.eventTarget.postMessage(e,"*")}async close(){window.removeEventListener("message",this.messageListener),this.onclose?.()}onclose;onerror;onmessage;sessionId;setProtocolVersion}var o_=_([l("light"),l("dark")]).describe("Color theme preference for the host environment."),ti=_([l("inline"),l("fullscreen"),l("pip")]).describe("Display mode for UI presentation."),r_=_([l("--color-background-primary"),l("--color-background-secondary"),l("--color-background-tertiary"),l("--color-background-inverse"),l("--color-background-ghost"),l("--color-background-info"),l("--color-background-danger"),l("--color-background-success"),l("--color-background-warning"),l("--color-background-disabled"),l("--color-text-primary"),l("--color-text-secondary"),l("--color-text-tertiary"),l("--color-text-inverse"),l("--color-text-ghost"),l("--color-text-info"),l("--color-text-danger"),l("--color-text-success"),l("--color-text-warning"),l("--color-text-disabled"),l("--color-border-primary"),l("--color-border-secondary"),l("--color-border-tertiary"),l("--color-border-inverse"),l("--color-border-ghost"),l("--color-border-info"),l("--color-border-danger"),l("--color-border-success"),l("--color-border-warning"),l("--color-border-disabled"),l("--color-ring-primary"),l("--color-ring-secondary"),l("--color-ring-inverse"),l("--color-ring-info"),l("--color-ring-danger"),l("--color-ring-success"),l("--color-ring-warning"),l("--font-sans"),l("--font-mono"),l("--font-weight-normal"),l("--font-weight-medium"),l("--font-weight-semibold"),l("--font-weight-bold"),l("--font-text-xs-size"),l("--font-text-sm-size"),l("--font-text-md-size"),l("--font-text-lg-size"),l("--font-heading-xs-size"),l("--font-heading-sm-size"),l("--font-heading-md-size"),l("--font-heading-lg-size"),l("--font-heading-xl-size"),l("--font-heading-2xl-size"),l("--font-heading-3xl-size"),l("--font-text-xs-line-height"),l("--font-text-sm-line-height"),l("--font-text-md-line-height"),l("--font-text-lg-line-height"),l("--font-heading-xs-line-height"),l("--font-heading-sm-line-height"),l("--font-heading-md-line-height"),l("--font-heading-lg-line-height"),l("--font-heading-xl-line-height"),l("--font-heading-2xl-line-height"),l("--font-heading-3xl-line-height"),l("--border-radius-xs"),l("--border-radius-sm"),l("--border-radius-md"),l("--border-radius-lg"),l("--border-radius-xl"),l("--border-radius-full"),l("--border-width-regular"),l("--shadow-hairline"),l("--shadow-sm"),l("--shadow-md"),l("--shadow-lg")]).describe("CSS variable keys available to MCP apps for theming."),n_=S(r_.describe(`Style variables for theming MCP apps.
70
69
 
71
70
  Individual style keys are optional - hosts may provide any subset of these values.
72
71
  Values are strings containing CSS values (colors, sizes, font stacks, etc.).
73
72
 
74
73
  Note: This type uses \`Record<K, string | undefined>\` rather than \`Partial<Record<K, string>>\`
75
- for compatibility with Zod schema generation. Both are functionally equivalent for validation.`),W.union([W.string(),W.undefined()]).describe(`Style variables for theming MCP apps.
74
+ for compatibility with Zod schema generation. Both are functionally equivalent for validation.`),_([s(),_o()]).describe(`Style variables for theming MCP apps.
76
75
 
77
76
  Individual style keys are optional - hosts may provide any subset of these values.
78
77
  Values are strings containing CSS values (colors, sizes, font stacks, etc.).
@@ -84,10 +83,10 @@ Individual style keys are optional - hosts may provide any subset of these value
84
83
  Values are strings containing CSS values (colors, sizes, font stacks, etc.).
85
84
 
86
85
  Note: This type uses \`Record<K, string | undefined>\` rather than \`Partial<Record<K, string>>\`
87
- for compatibility with Zod schema generation. Both are functionally equivalent for validation.`),UG=W.object({method:W.literal("ui/open-link"),params:W.object({url:W.string().describe("URL to open in the host's browser")})}),yX=W.object({isError:W.boolean().optional().describe("True if the host failed to open the URL (e.g., due to security policy).")}).passthrough(),fX=W.object({isError:W.boolean().optional().describe("True if the download failed (e.g., user cancelled or host denied).")}).passthrough(),lX=W.object({isError:W.boolean().optional().describe("True if the host rejected or failed to deliver the message.")}).passthrough(),PG=W.object({method:W.literal("ui/notifications/sandbox-proxy-ready"),params:W.object({})}),K9=W.object({connectDomains:W.array(W.string()).optional().describe(`Origins for network requests (fetch/XHR/WebSocket).
86
+ for compatibility with Zod schema generation. Both are functionally equivalent for validation.`),Hz=c({method:l("ui/open-link"),params:c({url:s().describe("URL to open in the host's browser")})}),s_=c({isError:v().optional().describe("True if the host failed to open the URL (e.g., due to security policy).")}).passthrough(),i_=c({isError:v().optional().describe("True if the download failed (e.g., user cancelled or host denied).")}).passthrough(),a_=c({isError:v().optional().describe("True if the host rejected or failed to deliver the message.")}).passthrough(),Fz=c({method:l("ui/notifications/sandbox-proxy-ready"),params:c({})}),sl=c({connectDomains:h(s()).optional().describe(`Origins for network requests (fetch/XHR/WebSocket).
88
87
 
89
88
  - Maps to CSP \`connect-src\` directive
90
- - Empty or omitted → no network connections (secure default)`),resourceDomains:W.array(W.string()).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:W.array(W.string()).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:W.array(W.string()).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'`)")}),G9=W.object({camera:W.object({}).optional().describe("Request camera access.\n\nMaps to Permission Policy `camera` feature."),microphone:W.object({}).optional().describe("Request microphone access.\n\nMaps to Permission Policy `microphone` feature."),geolocation:W.object({}).optional().describe("Request geolocation access.\n\nMaps to Permission Policy `geolocation` feature."),clipboardWrite:W.object({}).optional().describe("Request clipboard write access.\n\nMaps to Permission Policy `clipboard-write` feature.")}),zG=W.object({method:W.literal("ui/notifications/size-changed"),params:W.object({width:W.number().optional().describe("New width in pixels."),height:W.number().optional().describe("New height in pixels.")})}),uX=W.object({method:W.literal("ui/notifications/tool-input"),params:W.object({arguments:W.record(W.string(),W.unknown().describe("Complete tool call arguments as key-value pairs.")).optional().describe("Complete tool call arguments as key-value pairs.")})}),cX=W.object({method:W.literal("ui/notifications/tool-input-partial"),params:W.object({arguments:W.record(W.string(),W.unknown().describe("Partial tool call arguments (incomplete, may change).")).optional().describe("Partial tool call arguments (incomplete, may change).")})}),mX=W.object({method:W.literal("ui/notifications/tool-cancelled"),params:W.object({reason:W.string().optional().describe('Optional reason for the cancellation (e.g., "user action", "timeout").')})}),iX=W.object({fonts:W.string().optional()}),pX=W.object({variables:hX.optional().describe("CSS variables for theming the app."),css:iX.optional().describe("CSS blocks that apps can inject.")}),dX=W.object({method:W.literal("ui/resource-teardown"),params:W.object({})}),oX=W.record(W.string(),W.unknown()),F3=W.object({text:W.object({}).optional().describe("Host supports text content blocks."),image:W.object({}).optional().describe("Host supports image content blocks."),audio:W.object({}).optional().describe("Host supports audio content blocks."),resource:W.object({}).optional().describe("Host supports resource content blocks."),resourceLink:W.object({}).optional().describe("Host supports resource link content blocks."),structuredContent:W.object({}).optional().describe("Host supports structured content.")}),IG=W.object({method:W.literal("ui/notifications/request-teardown"),params:W.object({}).optional()}),nX=W.object({experimental:W.record(W.string(),W.record(W.string(),W.any()).describe("Experimental features keyed by identifier.")).optional().describe("Experimental features keyed by identifier."),openLinks:W.object({}).optional().describe("Host supports opening external URLs."),downloadFile:W.object({}).optional().describe("Host supports file downloads via ui/download-file."),serverTools:W.object({listChanged:W.boolean().optional().describe("Host supports tools/list_changed notifications.")}).optional().describe("Host can proxy tool calls to the MCP server."),serverResources:W.object({listChanged:W.boolean().optional().describe("Host supports resources/list_changed notifications.")}).optional().describe("Host can proxy resource reads to the MCP server."),logging:W.object({}).optional().describe("Host accepts log messages."),sandbox:W.object({permissions:G9.optional().describe("Permissions granted by the host (camera, microphone, geolocation)."),csp:K9.optional().describe("CSP domains approved by the host.")}).optional().describe("Sandbox configuration applied by the host."),updateModelContext:F3.optional().describe("Host accepts context updates (ui/update-model-context) to be included in the model's context for future turns."),message:F3.optional().describe("Host supports receiving content messages (ui/message) from the view."),sampling:W.object({tools:W.object({}).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.")}),rX=W.object({experimental:W.record(W.string(),W.record(W.string(),W.any()).describe("Experimental features keyed by identifier.")).optional().describe("Experimental features keyed by identifier."),tools:W.object({listChanged:W.boolean().optional().describe("App supports tools/list_changed notifications.")}).optional().describe("App exposes MCP-style tools that the host can call."),availableDisplayModes:W.array(KW).optional().describe("Display modes the app supports.")}),RG=W.object({method:W.literal("ui/notifications/initialized"),params:W.object({}).optional()}),TG=W.object({csp:K9.optional().describe("Content Security Policy configuration for UI resources."),permissions:G9.optional().describe("Sandbox permissions requested by the UI resource."),domain:W.string().optional().describe(`Dedicated origin for view sandbox.
89
+ - Empty or omitted → no network connections (secure default)`),resourceDomains:h(s()).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:h(s()).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:h(s()).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'`)")}),il=c({camera:c({}).optional().describe("Request camera access.\n\nMaps to Permission Policy `camera` feature."),microphone:c({}).optional().describe("Request microphone access.\n\nMaps to Permission Policy `microphone` feature."),geolocation:c({}).optional().describe("Request geolocation access.\n\nMaps to Permission Policy `geolocation` feature."),clipboardWrite:c({}).optional().describe("Request clipboard write access.\n\nMaps to Permission Policy `clipboard-write` feature.")}),Vz=c({method:l("ui/notifications/size-changed"),params:c({width:g().optional().describe("New width in pixels."),height:g().optional().describe("New height in pixels.")})}),c_=c({method:l("ui/notifications/tool-input"),params:c({arguments:S(s(),R().describe("Complete tool call arguments as key-value pairs.")).optional().describe("Complete tool call arguments as key-value pairs.")})}),l_=c({method:l("ui/notifications/tool-input-partial"),params:c({arguments:S(s(),R().describe("Partial tool call arguments (incomplete, may change).")).optional().describe("Partial tool call arguments (incomplete, may change).")})}),u_=c({method:l("ui/notifications/tool-cancelled"),params:c({reason:s().optional().describe('Optional reason for the cancellation (e.g., "user action", "timeout").')})}),d_=c({fonts:s().optional()}),p_=c({variables:n_.optional().describe("CSS variables for theming the app."),css:d_.optional().describe("CSS blocks that apps can inject.")}),h_=c({method:l("ui/resource-teardown"),params:c({})}),m_=S(s(),R()),mm=c({text:c({}).optional().describe("Host supports text content blocks."),image:c({}).optional().describe("Host supports image content blocks."),audio:c({}).optional().describe("Host supports audio content blocks."),resource:c({}).optional().describe("Host supports resource content blocks."),resourceLink:c({}).optional().describe("Host supports resource link content blocks."),structuredContent:c({}).optional().describe("Host supports structured content.")}),Jz=c({method:l("ui/notifications/request-teardown"),params:c({}).optional()}),f_=c({experimental:S(s(),S(s(),bo()).describe("Experimental features keyed by identifier.")).optional().describe("Experimental features keyed by identifier."),openLinks:c({}).optional().describe("Host supports opening external URLs."),downloadFile:c({}).optional().describe("Host supports file downloads via ui/download-file."),serverTools:c({listChanged:v().optional().describe("Host supports tools/list_changed notifications.")}).optional().describe("Host can proxy tool calls to the MCP server."),serverResources:c({listChanged:v().optional().describe("Host supports resources/list_changed notifications.")}).optional().describe("Host can proxy resource reads to the MCP server."),logging:c({}).optional().describe("Host accepts log messages."),sandbox:c({permissions:il.optional().describe("Permissions granted by the host (camera, microphone, geolocation)."),csp:sl.optional().describe("CSP domains approved by the host.")}).optional().describe("Sandbox configuration applied by the host."),updateModelContext:mm.optional().describe("Host accepts context updates (ui/update-model-context) to be included in the model's context for future turns."),message:mm.optional().describe("Host supports receiving content messages (ui/message) from the view."),sampling:c({tools:c({}).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.")}),g_=c({experimental:S(s(),S(s(),bo()).describe("Experimental features keyed by identifier.")).optional().describe("Experimental features keyed by identifier."),tools:c({listChanged:v().optional().describe("App supports tools/list_changed notifications.")}).optional().describe("App exposes MCP-style tools that the host can call."),availableDisplayModes:h(ti).optional().describe("Display modes the app supports.")}),Bz=c({method:l("ui/notifications/initialized"),params:c({}).optional()}),Wz=c({csp:sl.optional().describe("Content Security Policy configuration for UI resources."),permissions:il.optional().describe("Sandbox permissions requested by the UI resource."),domain:s().optional().describe(`Dedicated origin for view sandbox.
91
90
 
92
91
  Useful when views need stable, dedicated origins for OAuth callbacks, CORS policies, or API key allowlists.
93
92
 
@@ -95,22 +94,22 @@ Useful when views need stable, dedicated origins for OAuth callbacks, CORS polic
95
94
  - Hash-based subdomains (e.g., \`{hash}.claudemcpcontent.com\`)
96
95
  - URL-derived subdomains (e.g., \`www-example-com.oaiusercontent.com\`)
97
96
 
98
- If omitted, host uses default sandbox origin (typically per-conversation).`),prefersBorder:W.boolean().optional().describe(`Visual boundary preference - true if view prefers a visible border.
97
+ If omitted, host uses default sandbox origin (typically per-conversation).`),prefersBorder:v().optional().describe(`Visual boundary preference - true if view prefers a visible border.
99
98
 
100
99
  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.
101
100
 
102
101
  - \`true\`: request visible border + background
103
102
  - \`false\`: request no visible border + background
104
- - omitted: host decides border`)}),ZG=W.object({method:W.literal("ui/request-display-mode"),params:W.object({mode:KW.describe("The display mode being requested.")})}),tX=W.object({mode:KW.describe("The display mode that was actually set. May differ from requested if not supported.")}).passthrough(),sX=W.union([W.literal("model"),W.literal("app")]).describe("Tool visibility scope - who can access the tool."),jG=W.object({resourceUri:W.string().optional(),visibility:W.array(sX).optional().describe(`Who can access this tool. Default: ["model", "app"]
103
+ - omitted: host decides border`)}),Kz=c({method:l("ui/request-display-mode"),params:c({mode:ti.describe("The display mode being requested.")})}),S_=c({mode:ti.describe("The display mode that was actually set. May differ from requested if not supported.")}).passthrough(),__=_([l("model"),l("app")]).describe("Tool visibility scope - who can access the tool."),Gz=c({resourceUri:s().optional(),visibility:h(__).optional().describe(`Who can access this tool. Default: ["model", "app"]
105
104
  - "model": Tool visible to and callable by the agent
106
- - "app": Tool callable by the app from this server only`),csp:W.never().optional(),permissions:W.never().optional()}),LG=W.object({mimeTypes:W.array(W.string()).optional().describe('Array of supported MIME types for UI resources.\nMust include `"text/html;profile=mcp-app"` for MCP Apps support.')}),$G=W.object({method:W.literal("ui/download-file"),params:W.object({contents:W.array(W.union([XH,qH])).describe("Resource contents to download — embedded (inline data) or linked (host fetches). Uses standard MCP resource types.")})}),CG=W.object({method:W.literal("ui/message"),params:W.object({role:W.literal("user").describe('Message role, currently only "user" is supported.'),content:W.array(jb).describe("Message content blocks (text, image, etc.).")})}),SG=W.object({method:W.literal("ui/notifications/sandbox-resource-ready"),params:W.object({html:W.string().describe("HTML content to load into the inner iframe."),sandbox:W.string().optional().describe("Optional override for the inner iframe's sandbox attribute."),csp:K9.optional().describe("CSP configuration from resource metadata."),permissions:G9.optional().describe("Sandbox permissions from resource metadata.")})}),aX=W.object({method:W.literal("ui/notifications/tool-result"),params:sb.describe("Standard MCP tool execution result.")}),R3=W.object({toolInfo:W.object({id:Tb.optional().describe("JSON-RPC id of the tools/call request."),tool:tb.describe("Tool definition including name, inputSchema, etc.")}).optional().describe("Metadata of the tool call that instantiated this App."),theme:xX.optional().describe("Current color theme preference."),styles:pX.optional().describe("Style configuration for theming the app."),displayMode:KW.optional().describe("How the UI is currently displayed."),availableDisplayModes:W.array(KW).optional().describe("Display modes the host supports."),containerDimensions:W.union([W.object({height:W.number().describe("Fixed container height in pixels.")}),W.object({maxHeight:W.union([W.number(),W.undefined()]).optional().describe("Maximum container height in pixels.")})]).and(W.union([W.object({width:W.number().describe("Fixed container width in pixels.")}),W.object({maxWidth:W.union([W.number(),W.undefined()]).optional().describe("Maximum container width in pixels.")})])).optional().describe(`Container dimensions. Represents the dimensions of the iframe or other
107
- container holding the app. Specify either width or maxWidth, and either height or maxHeight.`),locale:W.string().optional().describe("User's language and region preference in BCP 47 format."),timeZone:W.string().optional().describe("User's timezone in IANA format."),userAgent:W.string().optional().describe("Host application identifier."),platform:W.union([W.literal("web"),W.literal("desktop"),W.literal("mobile")]).optional().describe("Platform type for responsive design decisions."),deviceCapabilities:W.object({touch:W.boolean().optional().describe("Whether the device supports touch input."),hover:W.boolean().optional().describe("Whether the device supports hover interactions.")}).optional().describe("Device input capabilities."),safeAreaInsets:W.object({top:W.number().describe("Top safe area inset in pixels."),right:W.number().describe("Right safe area inset in pixels."),bottom:W.number().describe("Bottom safe area inset in pixels."),left:W.number().describe("Left safe area inset in pixels.")}).optional().describe("Mobile safe area boundaries in pixels.")}).passthrough(),eX=W.object({method:W.literal("ui/notifications/host-context-changed"),params:R3.describe("Partial context update containing only changed fields.")}),gG=W.object({method:W.literal("ui/update-model-context"),params:W.object({content:W.array(jb).optional().describe("Context content blocks (text, image, etc.)."),structuredContent:W.record(W.string(),W.unknown().describe("Structured content for machine-readable context data.")).optional().describe("Structured content for machine-readable context data.")})}),kG=W.object({method:W.literal("ui/initialize"),params:W.object({appInfo:Zb.describe("App identification (name and version)."),appCapabilities:rX.describe("Features and capabilities this app provides."),protocolVersion:W.string().describe("Protocol version this app supports.")})}),bq=W.object({protocolVersion:W.string().describe('Negotiated protocol version string (e.g., "2025-11-21").'),hostInfo:Zb.describe("Host application identification and version."),hostCapabilities:nX.describe("Features and capabilities provided by the host."),hostContext:R3.describe("Rich context about the host environment.")}).passthrough(),Hq={target:"draft-2020-12"};async function V3(b,H){let Q=b["~standard"];if(Q.jsonSchema)return Q.jsonSchema[H](Hq);throw Error(`Schema (vendor: ${Q.vendor}) does not implement Standard JSON Schema (~standard.jsonSchema). Use a library that does (zod v4, ArkType, Valibot) or wrap your schema accordingly.`)}async function U3(b,H,Q=""){let N=await b["~standard"].validate(H);if(N.issues){let E=N.issues.map((M)=>{let _=M.path?.map((Y)=>typeof Y==="object"?Y.key:Y).join(".");return _?`${_}: ${M.message}`:M.message}).join("; ");throw Error(Q+E)}return N.value}function Qq(b,H){let Q={...b,...H};if(H.experimental!==void 0)Q.experimental={...b.experimental,...H.experimental};if(H.tools!==void 0)Q.tools={...b.tools,...H.tools};return Q}class ow extends XW{_appInfo;_appCapabilities;options;_hostCapabilities;_hostInfo;_hostContext;_registeredTools={};_initializedSent=!1;_registeredEvents=new Set;_events=new P3;_methods=new z3;setRequestHandler=(...b)=>{let[H,...Q]=A3("request",b)??b;this._methods.claim(H,"setRequestHandler"),super.setRequestHandler.call(this,H,...Q)};setNotificationHandler=(...b)=>{let[H,...Q]=A3("notification",b)??b;this._methods.claim(H,"setNotificationHandler"),super.setNotificationHandler.call(this,H,...Q)};removeRequestHandler=(b)=>{this._methods.release(b),super.removeRequestHandler(b)};removeNotificationHandler=(b)=>{this._methods.release(b),super.removeNotificationHandler(b)};replaceRequestHandler=(b,...H)=>{this._methods.replace(b),super.setRequestHandler.call(this,b,...H)};_assertInitialized(b){if(this._initializedSent)return;let H=`[ext-apps] App.${b}() called before connect() completed the ui/initialize handshake. Await app.connect() before calling this method, or move data loading to an ontoolresult handler.`;if(this.options?.strict)throw Error(H);console.warn(`${H}. This will throw in a future release.`)}eventSchemas={toolinput:uX,toolinputpartial:cX,toolresult:aX,toolcancelled:mX,hostcontextchanged:eX};static ONE_SHOT_EVENTS=new Set(["toolinput","toolinputpartial","toolresult","toolcancelled"]);_everHadListener=new Set;_assertHandlerTiming(b){if(!ow.ONE_SHOT_EVENTS.has(b)||this._everHadListener.has(b))return;if(this._everHadListener.add(b),!this._initializedSent)return;let H=`[ext-apps] "${String(b)}" handler registered after connect() completed the ui/initialize handshake. The host may have already sent this notification. Register handlers before calling app.connect().`;if(this.options?.strict)throw Error(H);console.warn(H)}setEventHandler(b,H){if(H)this._assertHandlerTiming(b);this._ensureEventSlot(b),this._events.setHandler(b,H)}addEventListener(b,H){this._assertHandlerTiming(b),this._ensureEventSlot(b),this._events.addEventListener(b,H)}removeEventListener(b,H){this._events.removeEventListener(b,H)}_ensureEventSlot(b){if(this._registeredEvents.has(b))return;let H=this.eventSchemas[b];if(!H)throw Error(`Unknown event: ${String(b)}`);this.setNotificationHandler(H.shape.method.value,{params:H.shape.params},(Q)=>{let N=Q;if(b==="hostcontextchanged")this._hostContext={...this._hostContext,...N};this._events.dispatch(b,N)}),this._registeredEvents.add(b)}getEventHandler(b){return this._events.getHandler(b)}warnIfRequestHandlerReplaced(b,H,Q){if(H&&Q)console.warn(`[MCP Apps] ${b} handler replaced. Previous handler will no longer be called.`)}constructor(b,H={},Q={autoResize:!0}){super(Q);if(this._appInfo=b,this._appCapabilities=H,this.options=Q,this._methods.replace("notifications/cancelled"),this._methods.replace("notifications/progress"),!Q.allowUnsafeEval)W.config({jitless:!0});this.replaceRequestHandler("ping",(N)=>{return console.log("Received ping:",N.params),{}}),this.setEventHandler("hostcontextchanged",void 0)}buildContext(b){return b}registerAppCapabilities(b){if(this.transport)throw Error("Cannot register capabilities after transport is established");this._appCapabilities=Qq(this._appCapabilities,b)}registerTool(b,H,Q){if(this._registeredTools[b])throw Error(`Tool ${b} is already registered`);let N=this,E=()=>{if(N._initializedSent&&N._appCapabilities.tools?.listChanged)N.sendToolListChanged()},M=H.inputSchema!==void 0,_={title:H.title,description:H.description,inputSchema:H.inputSchema,outputSchema:H.outputSchema,annotations:H.annotations,_meta:H._meta,enabled:!0,enable(){this.enabled=!0,E()},disable(){this.enabled=!1,E()},update(Y){Object.assign(this,Y),E()},remove(){if(N._registeredTools[b]!==_)return;delete N._registeredTools[b],E()},handler:async(Y,D)=>{if(!_.enabled)throw Error(`Tool ${b} is disabled`);let J;if(M){let K=_.inputSchema,O=K?await U3(K,Y??{},`Invalid input for tool ${b}: `):Y??{};J=await Q(O,D)}else J=await Q(D);if(_.outputSchema&&!J.isError)J.structuredContent=await U3(_.outputSchema,J.structuredContent,`Invalid output for tool ${b}: `);return J}};if(this._registeredTools[b]=_,!this._appCapabilities.tools&&!this.transport)this.registerAppCapabilities({tools:{listChanged:!0}});return this.ensureToolHandlersInitialized(),E(),_}_toolHandlersInitialized=!1;ensureToolHandlersInitialized(){if(this._toolHandlersInitialized)return;this._toolHandlersInitialized=!0,this.oncalltool=async(b,H)=>{let Q=this._registeredTools[b.name];if(!Q)throw Error(`Tool ${b.name} not found`);return Q.handler(b.arguments,H)},this.onlisttools=async(b,H)=>{return{tools:await Promise.all(Object.entries(this._registeredTools).filter(([Q,N])=>N.enabled).map(async([Q,N])=>{let E={name:Q,title:N.title,description:N.description,inputSchema:N.inputSchema?await V3(N.inputSchema,"input"):{type:"object",properties:{}}};if(N.outputSchema)E.outputSchema=await V3(N.outputSchema,"output");if(N.annotations)E.annotations=N.annotations;if(N._meta)E._meta=N._meta;return E}))}}}async sendToolListChanged(b={}){this._assertInitialized("sendToolListChanged"),await this.notification({method:"notifications/tools/list_changed",params:b})}getHostCapabilities(){return this._hostCapabilities}getHostVersion(){return this._hostInfo}getHostContext(){return this._hostContext}get ontoolinput(){return this.getEventHandler("toolinput")}set ontoolinput(b){this.setEventHandler("toolinput",b)}get ontoolinputpartial(){return this.getEventHandler("toolinputpartial")}set ontoolinputpartial(b){this.setEventHandler("toolinputpartial",b)}get ontoolresult(){return this.getEventHandler("toolresult")}set ontoolresult(b){this.setEventHandler("toolresult",b)}get ontoolcancelled(){return this.getEventHandler("toolcancelled")}set ontoolcancelled(b){this.setEventHandler("toolcancelled",b)}get onhostcontextchanged(){return this.getEventHandler("hostcontextchanged")}set onhostcontextchanged(b){this.setEventHandler("hostcontextchanged",b)}_onteardown;get onteardown(){return this._onteardown}set onteardown(b){this.warnIfRequestHandlerReplaced("onteardown",this._onteardown,b),this._onteardown=b,this.replaceRequestHandler("ui/resource-teardown",{params:dX.shape.params,result:oX},(H,Q)=>{if(!this._onteardown)throw Error("No onteardown handler set");return this._onteardown(H,Q)})}_oncalltool;get oncalltool(){return this._oncalltool}set oncalltool(b){this.warnIfRequestHandlerReplaced("oncalltool",this._oncalltool,b),this._oncalltool=b,this.replaceRequestHandler("tools/call",(H,Q)=>{if(!this._oncalltool)throw Error("No oncalltool handler set");return this._oncalltool(H.params,Q)})}_onlisttools;get onlisttools(){return this._onlisttools}set onlisttools(b){this.warnIfRequestHandlerReplaced("onlisttools",this._onlisttools,b),this._onlisttools=b,this.replaceRequestHandler("tools/list",(H,Q)=>{if(!this._onlisttools)throw Error("No onlisttools handler set");return this._onlisttools(H.params,Q)})}assertCapabilityForMethod(b){switch(b){case"sampling/createMessage":if(!this._hostCapabilities?.sampling)throw Error(`Host does not support sampling (required for ${b})`);break}}assertRequestHandlerCapability(b){switch(b){case"tools/call":case"tools/list":if(!this._appCapabilities.tools)throw Error(`Client does not support tool capability (required for ${b})`);return;default:return}}assertNotificationCapability(b){}async callServerTool(b,H){if(this._assertInitialized("callServerTool"),typeof b==="string")throw Error(`callServerTool() expects an object as its first argument, but received a string ("${b}"). Did you mean: callServerTool({ name: "${b}", arguments: { ... } })?`);return await this.request({method:"tools/call",params:b},{onprogress:()=>{},resetTimeoutOnProgress:!0,...H})}async readServerResource(b,H){return this._assertInitialized("readServerResource"),await this.request({method:"resources/read",params:b},H)}async listServerResources(b,H){return this._assertInitialized("listServerResources"),await this.request({method:"resources/list",params:b},H)}async createSamplingMessage(b,H){return this._assertInitialized("createSamplingMessage"),await this.request({method:"sampling/createMessage",params:b},H)}sendMessage(b,H){return this._assertInitialized("sendMessage"),this.request({method:"ui/message",params:b},lX,H)}sendLog(b){return this.notification({method:"notifications/message",params:b})}updateModelContext(b,H){return this._assertInitialized("updateModelContext"),this.request({method:"ui/update-model-context",params:b},nb,H)}openLink(b,H){return this._assertInitialized("openLink"),this.request({method:"ui/open-link",params:b},yX,H)}sendOpenLink=this.openLink;downloadFile(b,H){return this._assertInitialized("downloadFile"),this.request({method:"ui/download-file",params:b},fX,H)}requestTeardown(b={}){return this.notification({method:"ui/notifications/request-teardown",params:b})}requestDisplayMode(b,H){return this._assertInitialized("requestDisplayMode"),this.request({method:"ui/request-display-mode",params:b},tX,H)}sendSizeChanged(b){return this.notification({method:"ui/notifications/size-changed",params:b})}setupSizeChangedNotifications(){let b=!1,H=0,Q=0,N=()=>{if(b)return;b=!0,requestAnimationFrame(()=>{b=!1;let M=document.documentElement,_=M.style.height;M.style.height="max-content";let Y=Math.ceil(M.getBoundingClientRect().height);M.style.height=_;let D=Math.ceil(window.innerWidth);if(D!==H||Y!==Q)H=D,Q=Y,this.sendSizeChanged({width:D,height:Y})})};N();let E=new ResizeObserver(N);return E.observe(document.documentElement),E.observe(document.body),()=>E.disconnect()}async connect(b=new I3(window.parent,window.parent),H){if(this.transport)throw Error("App is already connected. Call close() before connecting again.");this._initializedSent=!1;try{await super.connect(b);let Q=await this.request({method:"ui/initialize",params:{appCapabilities:this._appCapabilities,appInfo:this._appInfo,protocolVersion:gX}},bq,H);if(Q===void 0)throw Error(`Server sent invalid initialize result: ${Q}`);if(this._hostCapabilities=Q.hostCapabilities,this._hostInfo=Q.hostInfo,this._hostContext=Q.hostContext,await this.notification({method:"ui/notifications/initialized"}),this._initializedSent=!0,this.options?.autoResize)this.setupSizeChangedNotifications()}catch(Q){throw this.close(),Q}}}class C3{_eventSlots=new Map;setHandler(b,H){let Q=this._ensureEventSlot(b);if(Q.onHandler&&H)console.warn(`[MCP Apps] on${String(b)} handler replaced. Use addEventListener("${String(b)}", …) to add multiple listeners without replacing.`);Q.onHandler=H}getHandler(b){return this._eventSlots.get(b)?.onHandler}addEventListener(b,H){this._ensureEventSlot(b).listeners.push(H)}removeEventListener(b,H){let Q=this._eventSlots.get(b);if(!Q)return;let N=Q.listeners.indexOf(H);if(N!==-1)Q.listeners.splice(N,1)}dispatch(b,H){let Q=this._eventSlots.get(b);if(!Q)return;Q.onHandler?.(H);for(let N of[...Q.listeners])N(H)}_ensureEventSlot(b){let H=this._eventSlots.get(b);if(!H)H={listeners:[]},this._eventSlots.set(b,H);return H}}class S3{_methods=new Set;claim(b,H){if(this._methods.has(b))throw Error(`Handler for "${b}" already registered (via ${H}). Use addEventListener() to attach multiple listeners, or the on* setter for replace semantics.`);this._methods.add(b)}replace(b){this._methods.add(b)}release(b){this._methods.delete(b)}has(b){return this._methods.has(b)}}var T3=new Set;function Z3(b,H){let[Q,N]=H,E=Q?.shape;if(typeof E?.method?.value!=="string")return;let M=E.method.value,_=b==="request"?"setRequestHandler":"setNotificationHandler";if(!T3.has(_))T3.add(_),console.warn(`[ext-apps] ${_}(Schema, handler) is deprecated; use ${_}("${M}", { params: Schema.shape.params }, handler).`);let Y=N;return[M,{params:E.params},b==="request"?(D,J)=>Y({method:M,params:D},Nq(J)):(D)=>Y({method:M,params:D})]}function Nq(b){return{signal:b.mcpReq.signal,requestId:b.mcpReq.id,sessionId:b.sessionId,_meta:b.mcpReq._meta,sendRequest:b.mcpReq.send,sendNotification:b.mcpReq.notify,authInfo:b.http?.authInfo}}var g3="2026-01-26";var Eq="ui/notifications/tool-input-partial";var Mq=W.union([W.literal("light"),W.literal("dark")]).describe("Color theme preference for the host environment."),GW=W.union([W.literal("inline"),W.literal("fullscreen"),W.literal("pip")]).describe("Display mode for UI presentation."),Wq=W.union([W.literal("--color-background-primary"),W.literal("--color-background-secondary"),W.literal("--color-background-tertiary"),W.literal("--color-background-inverse"),W.literal("--color-background-ghost"),W.literal("--color-background-info"),W.literal("--color-background-danger"),W.literal("--color-background-success"),W.literal("--color-background-warning"),W.literal("--color-background-disabled"),W.literal("--color-text-primary"),W.literal("--color-text-secondary"),W.literal("--color-text-tertiary"),W.literal("--color-text-inverse"),W.literal("--color-text-ghost"),W.literal("--color-text-info"),W.literal("--color-text-danger"),W.literal("--color-text-success"),W.literal("--color-text-warning"),W.literal("--color-text-disabled"),W.literal("--color-border-primary"),W.literal("--color-border-secondary"),W.literal("--color-border-tertiary"),W.literal("--color-border-inverse"),W.literal("--color-border-ghost"),W.literal("--color-border-info"),W.literal("--color-border-danger"),W.literal("--color-border-success"),W.literal("--color-border-warning"),W.literal("--color-border-disabled"),W.literal("--color-ring-primary"),W.literal("--color-ring-secondary"),W.literal("--color-ring-inverse"),W.literal("--color-ring-info"),W.literal("--color-ring-danger"),W.literal("--color-ring-success"),W.literal("--color-ring-warning"),W.literal("--font-sans"),W.literal("--font-mono"),W.literal("--font-weight-normal"),W.literal("--font-weight-medium"),W.literal("--font-weight-semibold"),W.literal("--font-weight-bold"),W.literal("--font-text-xs-size"),W.literal("--font-text-sm-size"),W.literal("--font-text-md-size"),W.literal("--font-text-lg-size"),W.literal("--font-heading-xs-size"),W.literal("--font-heading-sm-size"),W.literal("--font-heading-md-size"),W.literal("--font-heading-lg-size"),W.literal("--font-heading-xl-size"),W.literal("--font-heading-2xl-size"),W.literal("--font-heading-3xl-size"),W.literal("--font-text-xs-line-height"),W.literal("--font-text-sm-line-height"),W.literal("--font-text-md-line-height"),W.literal("--font-text-lg-line-height"),W.literal("--font-heading-xs-line-height"),W.literal("--font-heading-sm-line-height"),W.literal("--font-heading-md-line-height"),W.literal("--font-heading-lg-line-height"),W.literal("--font-heading-xl-line-height"),W.literal("--font-heading-2xl-line-height"),W.literal("--font-heading-3xl-line-height"),W.literal("--border-radius-xs"),W.literal("--border-radius-sm"),W.literal("--border-radius-md"),W.literal("--border-radius-lg"),W.literal("--border-radius-xl"),W.literal("--border-radius-full"),W.literal("--border-width-regular"),W.literal("--shadow-hairline"),W.literal("--shadow-sm"),W.literal("--shadow-md"),W.literal("--shadow-lg")]).describe("CSS variable keys available to MCP apps for theming."),_q=W.record(Wq.describe(`Style variables for theming MCP apps.
105
+ - "app": Tool callable by the app from this server only`),csp:sn().optional(),permissions:sn().optional()}),Yz=c({mimeTypes:h(s()).optional().describe('Array of supported MIME types for UI resources.\nMust include `"text/html;profile=mcp-app"` for MCP Apps support.')}),Qz=c({method:l("ui/download-file"),params:c({contents:h(_([Je,Be])).describe("Resource contents to download — embedded (inline data) or linked (host fetches). Uses standard MCP resource types.")})}),Xz=c({method:l("ui/message"),params:c({role:l("user").describe('Message role, currently only "user" is supported.'),content:h(ge).describe("Message content blocks (text, image, etc.).")})}),eR=c({method:l("ui/notifications/sandbox-resource-ready"),params:c({html:s().describe("HTML content to load into the inner iframe."),sandbox:s().optional().describe("Optional override for the inner iframe's sandbox attribute."),csp:sl.optional().describe("CSP configuration from resource metadata."),permissions:il.optional().describe("Sandbox permissions from resource metadata.")})}),b_=c({method:l("ui/notifications/tool-result"),params:Oe.describe("Standard MCP tool execution result.")}),ym=c({toolInfo:c({id:me.optional().describe("JSON-RPC id of the tools/call request."),tool:Ie.describe("Tool definition including name, inputSchema, etc.")}).optional().describe("Metadata of the tool call that instantiated this App."),theme:o_.optional().describe("Current color theme preference."),styles:p_.optional().describe("Style configuration for theming the app."),displayMode:ti.optional().describe("How the UI is currently displayed."),availableDisplayModes:h(ti).optional().describe("Display modes the host supports."),containerDimensions:_([c({height:g().describe("Fixed container height in pixels.")}),c({maxHeight:_([g(),_o()]).optional().describe("Maximum container height in pixels.")})]).and(_([c({width:g().describe("Fixed container width in pixels.")}),c({maxWidth:_([g(),_o()]).optional().describe("Maximum container width in pixels.")})])).optional().describe(`Container dimensions. Represents the dimensions of the iframe or other
106
+ container holding the app. Specify either width or maxWidth, and either height or maxHeight.`),locale:s().optional().describe("User's language and region preference in BCP 47 format."),timeZone:s().optional().describe("User's timezone in IANA format."),userAgent:s().optional().describe("Host application identifier."),platform:_([l("web"),l("desktop"),l("mobile")]).optional().describe("Platform type for responsive design decisions."),deviceCapabilities:c({touch:v().optional().describe("Whether the device supports touch input."),hover:v().optional().describe("Whether the device supports hover interactions.")}).optional().describe("Device input capabilities."),safeAreaInsets:c({top:g().describe("Top safe area inset in pixels."),right:g().describe("Right safe area inset in pixels."),bottom:g().describe("Bottom safe area inset in pixels."),left:g().describe("Left safe area inset in pixels.")}).optional().describe("Mobile safe area boundaries in pixels.")}).passthrough(),y_=c({method:l("ui/notifications/host-context-changed"),params:ym.describe("Partial context update containing only changed fields.")}),tR=c({method:l("ui/update-model-context"),params:c({content:h(ge).optional().describe("Context content blocks (text, image, etc.)."),structuredContent:S(s(),R().describe("Structured content for machine-readable context data.")).optional().describe("Structured content for machine-readable context data.")})}),oR=c({method:l("ui/initialize"),params:c({appInfo:fe.describe("App identification (name and version)."),appCapabilities:g_.describe("Features and capabilities this app provides."),protocolVersion:s().describe("Protocol version this app supports.")})}),v_=c({protocolVersion:s().describe('Negotiated protocol version string (e.g., "2025-11-21").'),hostInfo:fe.describe("Host application identification and version."),hostCapabilities:f_.describe("Features and capabilities provided by the host."),hostContext:ym.describe("Rich context about the host environment.")}).passthrough(),z_={target:"draft-2020-12"};async function fm(e,t){let o=e["~standard"];if(o.jsonSchema)return o.jsonSchema[t](z_);throw Error(`Schema (vendor: ${o.vendor}) does not implement Standard JSON Schema (~standard.jsonSchema). Use a library that does (zod v4, ArkType, Valibot) or wrap your schema accordingly.`)}async function gm(e,t,o=""){let r=await e["~standard"].validate(t);if(r.issues){let n=r.issues.map((i)=>{let a=i.path?.map((u)=>typeof u==="object"?u.key:u).join(".");return a?`${a}: ${i.message}`:i.message}).join("; ");throw Error(o+n)}return r.value}function R_(e,t){let o={...e,...t};if(t.experimental!==void 0)o.experimental={...e.experimental,...t.experimental};if(t.tools!==void 0)o.tools={...e.tools,...t.tools};return o}class wa extends Xs{_appInfo;_appCapabilities;options;_hostCapabilities;_hostInfo;_hostContext;_registeredTools={};_initializedSent=!1;_registeredEvents=new Set;_events=new Sm;_methods=new _m;setRequestHandler=(...e)=>{let[t,...o]=hm("request",e)??e;this._methods.claim(t,"setRequestHandler"),super.setRequestHandler.call(this,t,...o)};setNotificationHandler=(...e)=>{let[t,...o]=hm("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)};_assertInitialized(e){if(this._initializedSent)return;let t=`[ext-apps] App.${e}() called before connect() completed the ui/initialize handshake. Await app.connect() before calling this method, or move data loading to an ontoolresult handler.`;if(this.options?.strict)throw Error(t);console.warn(`${t}. This will throw in a future release.`)}eventSchemas={toolinput:c_,toolinputpartial:l_,toolresult:b_,toolcancelled:u_,hostcontextchanged:y_};static ONE_SHOT_EVENTS=new Set(["toolinput","toolinputpartial","toolresult","toolcancelled"]);_everHadListener=new Set;_assertHandlerTiming(e){if(!wa.ONE_SHOT_EVENTS.has(e)||this._everHadListener.has(e))return;if(this._everHadListener.add(e),!this._initializedSent)return;let t=`[ext-apps] "${String(e)}" handler registered after connect() completed the ui/initialize handshake. The host may have already sent this notification. Register handlers before calling app.connect().`;if(this.options?.strict)throw Error(t);console.warn(t)}setEventHandler(e,t){if(t)this._assertHandlerTiming(e);this._ensureEventSlot(e),this._events.setHandler(e,t)}addEventListener(e,t){this._assertHandlerTiming(e),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)}`);this.setNotificationHandler(t.shape.method.value,{params:t.shape.params},(o)=>{let r=o;if(e==="hostcontextchanged")this._hostContext={...this._hostContext,...r};this._events.dispatch(e,r)}),this._registeredEvents.add(e)}getEventHandler(e){return this._events.getHandler(e)}warnIfRequestHandlerReplaced(e,t,o){if(t&&o)console.warn(`[MCP Apps] ${e} handler replaced. Previous handler will no longer be called.`)}constructor(e,t={},o={autoResize:!0}){super(o);if(this._appInfo=e,this._appCapabilities=t,this.options=o,this._methods.replace("notifications/cancelled"),this._methods.replace("notifications/progress"),!o.allowUnsafeEval)ce({jitless:!0});this.replaceRequestHandler("ping",(r)=>(console.log("Received ping:",r.params),{})),this.setEventHandler("hostcontextchanged",void 0)}buildContext(e){return e}registerAppCapabilities(e){if(this.transport)throw Error("Cannot register capabilities after transport is established");this._appCapabilities=R_(this._appCapabilities,e)}registerTool(e,t,o){if(this._registeredTools[e])throw Error(`Tool ${e} is already registered`);let r=this,n=()=>{if(r._initializedSent&&r._appCapabilities.tools?.listChanged)r.sendToolListChanged()},i=t.inputSchema!==void 0,a={title:t.title,description:t.description,inputSchema:t.inputSchema,outputSchema:t.outputSchema,annotations:t.annotations,_meta:t._meta,enabled:!0,enable(){this.enabled=!0,n()},disable(){this.enabled=!1,n()},update(u){Object.assign(this,u),n()},remove(){if(r._registeredTools[e]!==a)return;delete r._registeredTools[e],n()},handler:async(u,d)=>{if(!a.enabled)throw Error(`Tool ${e} is disabled`);let p;if(i){let f=a.inputSchema,b=f?await gm(f,u??{},`Invalid input for tool ${e}: `):u??{};p=await o(b,d)}else p=await o(d);if(a.outputSchema&&!p.isError)p.structuredContent=await gm(a.outputSchema,p.structuredContent,`Invalid output for tool ${e}: `);return p}};if(this._registeredTools[e]=a,!this._appCapabilities.tools&&!this.transport)this.registerAppCapabilities({tools:{listChanged:!0}});return this.ensureToolHandlersInitialized(),n(),a}_toolHandlersInitialized=!1;ensureToolHandlersInitialized(){if(this._toolHandlersInitialized)return;this._toolHandlersInitialized=!0,this.oncalltool=async(e,t)=>{let o=this._registeredTools[e.name];if(!o)throw Error(`Tool ${e.name} not found`);return o.handler(e.arguments,t)},this.onlisttools=async(e,t)=>({tools:await Promise.all(Object.entries(this._registeredTools).filter(([o,r])=>r.enabled).map(async([o,r])=>{let n={name:o,title:r.title,description:r.description,inputSchema:r.inputSchema?await fm(r.inputSchema,"input"):{type:"object",properties:{}}};if(r.outputSchema)n.outputSchema=await fm(r.outputSchema,"output");if(r.annotations)n.annotations=r.annotations;if(r._meta)n._meta=r._meta;return n}))})}async sendToolListChanged(e={}){this._assertInitialized("sendToolListChanged"),await this.notification({method:"notifications/tools/list_changed",params:e})}getHostCapabilities(){return this._hostCapabilities}getHostVersion(){return this._hostInfo}getHostContext(){return this._hostContext}get ontoolinput(){return this.getEventHandler("toolinput")}set ontoolinput(e){this.setEventHandler("toolinput",e)}get ontoolinputpartial(){return this.getEventHandler("toolinputpartial")}set ontoolinputpartial(e){this.setEventHandler("toolinputpartial",e)}get ontoolresult(){return this.getEventHandler("toolresult")}set ontoolresult(e){this.setEventHandler("toolresult",e)}get ontoolcancelled(){return this.getEventHandler("toolcancelled")}set ontoolcancelled(e){this.setEventHandler("toolcancelled",e)}get onhostcontextchanged(){return this.getEventHandler("hostcontextchanged")}set onhostcontextchanged(e){this.setEventHandler("hostcontextchanged",e)}_onteardown;get onteardown(){return this._onteardown}set onteardown(e){this.warnIfRequestHandlerReplaced("onteardown",this._onteardown,e),this._onteardown=e,this.replaceRequestHandler("ui/resource-teardown",{params:h_.shape.params,result:m_},(t,o)=>{if(!this._onteardown)throw Error("No onteardown handler set");return this._onteardown(t,o)})}_oncalltool;get oncalltool(){return this._oncalltool}set oncalltool(e){this.warnIfRequestHandlerReplaced("oncalltool",this._oncalltool,e),this._oncalltool=e,this.replaceRequestHandler("tools/call",(t,o)=>{if(!this._oncalltool)throw Error("No oncalltool handler set");return this._oncalltool(t.params,o)})}_onlisttools;get onlisttools(){return this._onlisttools}set onlisttools(e){this.warnIfRequestHandlerReplaced("onlisttools",this._onlisttools,e),this._onlisttools=e,this.replaceRequestHandler("tools/list",(t,o)=>{if(!this._onlisttools)throw Error("No onlisttools handler set");return this._onlisttools(t.params,o)})}assertCapabilityForMethod(e){switch(e){case"sampling/createMessage":if(!this._hostCapabilities?.sampling)throw Error(`Host does not support sampling (required for ${e})`);break}}assertRequestHandlerCapability(e){switch(e){case"tools/call":case"tools/list":if(!this._appCapabilities.tools)throw Error(`Client does not support tool capability (required for ${e})`);return;default:return}}assertNotificationCapability(e){}async callServerTool(e,t){if(this._assertInitialized("callServerTool"),typeof e==="string")throw Error(`callServerTool() expects an object as its first argument, but received a string ("${e}"). Did you mean: callServerTool({ name: "${e}", arguments: { ... } })?`);return await this.request({method:"tools/call",params:e},{onprogress:()=>{},resetTimeoutOnProgress:!0,...t})}async readServerResource(e,t){return this._assertInitialized("readServerResource"),await this.request({method:"resources/read",params:e},t)}async listServerResources(e,t){return this._assertInitialized("listServerResources"),await this.request({method:"resources/list",params:e},t)}async createSamplingMessage(e,t){return this._assertInitialized("createSamplingMessage"),await this.request({method:"sampling/createMessage",params:e},t)}sendMessage(e,t){return this._assertInitialized("sendMessage"),this.request({method:"ui/message",params:e},a_,t)}sendLog(e){return this.notification({method:"notifications/message",params:e})}updateModelContext(e,t){return this._assertInitialized("updateModelContext"),this.request({method:"ui/update-model-context",params:e},$e,t)}openLink(e,t){return this._assertInitialized("openLink"),this.request({method:"ui/open-link",params:e},s_,t)}sendOpenLink=this.openLink;downloadFile(e,t){return this._assertInitialized("downloadFile"),this.request({method:"ui/download-file",params:e},i_,t)}requestTeardown(e={}){return this.notification({method:"ui/notifications/request-teardown",params:e})}requestDisplayMode(e,t){return this._assertInitialized("requestDisplayMode"),this.request({method:"ui/request-display-mode",params:e},S_,t)}sendSizeChanged(e){return this.notification({method:"ui/notifications/size-changed",params:e})}setupSizeChangedNotifications(){let e=!1,t=0,o=0,r=()=>{if(e)return;e=!0,requestAnimationFrame(()=>{e=!1;let i=document.documentElement,a=i.style.height;i.style.height="max-content";let u=Math.ceil(i.getBoundingClientRect().height);i.style.height=a;let d=Math.ceil(window.innerWidth);if(d!==t||u!==o)t=d,o=u,this.sendSizeChanged({width:d,height:u})})};r();let n=new ResizeObserver(r);return n.observe(document.documentElement),n.observe(document.body),()=>n.disconnect()}async connect(e=new bm(window.parent,window.parent),t){if(this.transport)throw Error("App is already connected. Call close() before connecting again.");this._initializedSent=!1;try{await super.connect(e);let o=await this.request({method:"ui/initialize",params:{appCapabilities:this._appCapabilities,appInfo:this._appInfo,protocolVersion:e_}},v_,t);if(o===void 0)throw Error(`Server sent invalid initialize result: ${o}`);if(this._hostCapabilities=o.hostCapabilities,this._hostInfo=o.hostInfo,this._hostContext=o.hostContext,await this.notification({method:"ui/notifications/initialized"}),this._initializedSent=!0,this.options?.autoResize)this.setupSizeChangedNotifications()}catch(o){throw this.close(),o}}}class Tm{_eventSlots=new Map;setHandler(e,t){let o=this._ensureEventSlot(e);if(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 r=o.listeners.indexOf(t);if(r!==-1)o.listeners.splice(r,1)}dispatch(e,t){let o=this._eventSlots.get(e);if(!o)return;o.onHandler?.(t);for(let r of[...o.listeners])r(t)}_ensureEventSlot(e){let t=this._eventSlots.get(e);if(!t)t={listeners:[]},this._eventSlots.set(e,t);return t}}class Em{_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 vm=new Set;function zm(e,t){let[o,r]=t,n=o?.shape;if(typeof n?.method?.value!=="string")return;let i=n.method.value,a=e==="request"?"setRequestHandler":"setNotificationHandler";if(!vm.has(a))vm.add(a),console.warn(`[ext-apps] ${a}(Schema, handler) is deprecated; use ${a}("${i}", { params: Schema.shape.params }, handler).`);let u=r;return[i,{params:n.params},e==="request"?(d,p)=>u({method:i,params:d},w_(p)):(d)=>u({method:i,params:d})]}function w_(e){return{signal:e.mcpReq.signal,requestId:e.mcpReq.id,sessionId:e.sessionId,_meta:e.mcpReq._meta,sendRequest:e.mcpReq.send,sendNotification:e.mcpReq.notify,authInfo:e.http?.authInfo}}var Pm="2026-01-26";var x_="ui/notifications/tool-input-partial";var T_=_([l("light"),l("dark")]).describe("Color theme preference for the host environment."),oi=_([l("inline"),l("fullscreen"),l("pip")]).describe("Display mode for UI presentation."),E_=_([l("--color-background-primary"),l("--color-background-secondary"),l("--color-background-tertiary"),l("--color-background-inverse"),l("--color-background-ghost"),l("--color-background-info"),l("--color-background-danger"),l("--color-background-success"),l("--color-background-warning"),l("--color-background-disabled"),l("--color-text-primary"),l("--color-text-secondary"),l("--color-text-tertiary"),l("--color-text-inverse"),l("--color-text-ghost"),l("--color-text-info"),l("--color-text-danger"),l("--color-text-success"),l("--color-text-warning"),l("--color-text-disabled"),l("--color-border-primary"),l("--color-border-secondary"),l("--color-border-tertiary"),l("--color-border-inverse"),l("--color-border-ghost"),l("--color-border-info"),l("--color-border-danger"),l("--color-border-success"),l("--color-border-warning"),l("--color-border-disabled"),l("--color-ring-primary"),l("--color-ring-secondary"),l("--color-ring-inverse"),l("--color-ring-info"),l("--color-ring-danger"),l("--color-ring-success"),l("--color-ring-warning"),l("--font-sans"),l("--font-mono"),l("--font-weight-normal"),l("--font-weight-medium"),l("--font-weight-semibold"),l("--font-weight-bold"),l("--font-text-xs-size"),l("--font-text-sm-size"),l("--font-text-md-size"),l("--font-text-lg-size"),l("--font-heading-xs-size"),l("--font-heading-sm-size"),l("--font-heading-md-size"),l("--font-heading-lg-size"),l("--font-heading-xl-size"),l("--font-heading-2xl-size"),l("--font-heading-3xl-size"),l("--font-text-xs-line-height"),l("--font-text-sm-line-height"),l("--font-text-md-line-height"),l("--font-text-lg-line-height"),l("--font-heading-xs-line-height"),l("--font-heading-sm-line-height"),l("--font-heading-md-line-height"),l("--font-heading-lg-line-height"),l("--font-heading-xl-line-height"),l("--font-heading-2xl-line-height"),l("--font-heading-3xl-line-height"),l("--border-radius-xs"),l("--border-radius-sm"),l("--border-radius-md"),l("--border-radius-lg"),l("--border-radius-xl"),l("--border-radius-full"),l("--border-width-regular"),l("--shadow-hairline"),l("--shadow-sm"),l("--shadow-md"),l("--shadow-lg")]).describe("CSS variable keys available to MCP apps for theming."),P_=S(E_.describe(`Style variables for theming MCP apps.
108
107
 
109
108
  Individual style keys are optional - hosts may provide any subset of these values.
110
109
  Values are strings containing CSS values (colors, sizes, font stacks, etc.).
111
110
 
112
111
  Note: This type uses \`Record<K, string | undefined>\` rather than \`Partial<Record<K, string>>\`
113
- for compatibility with Zod schema generation. Both are functionally equivalent for validation.`),W.union([W.string(),W.undefined()]).describe(`Style variables for theming MCP apps.
112
+ for compatibility with Zod schema generation. Both are functionally equivalent for validation.`),_([s(),_o()]).describe(`Style variables for theming MCP apps.
114
113
 
115
114
  Individual style keys are optional - hosts may provide any subset of these values.
116
115
  Values are strings containing CSS values (colors, sizes, font stacks, etc.).
@@ -122,10 +121,10 @@ Individual style keys are optional - hosts may provide any subset of these value
122
121
  Values are strings containing CSS values (colors, sizes, font stacks, etc.).
123
122
 
124
123
  Note: This type uses \`Record<K, string | undefined>\` rather than \`Partial<Record<K, string>>\`
125
- for compatibility with Zod schema generation. Both are functionally equivalent for validation.`),wq=W.object({method:W.literal("ui/open-link"),params:W.object({url:W.string().describe("URL to open in the host's browser")})}),Yq=W.object({isError:W.boolean().optional().describe("True if the host failed to open the URL (e.g., due to security policy).")}).passthrough(),Dq=W.object({isError:W.boolean().optional().describe("True if the download failed (e.g., user cancelled or host denied).")}).passthrough(),Jq=W.object({isError:W.boolean().optional().describe("True if the host rejected or failed to deliver the message.")}).passthrough(),Bq=W.object({method:W.literal("ui/notifications/sandbox-proxy-ready"),params:W.object({})}),O9=W.object({connectDomains:W.array(W.string()).optional().describe(`Origins for network requests (fetch/XHR/WebSocket).
124
+ for compatibility with Zod schema generation. Both are functionally equivalent for validation.`),k_=c({method:l("ui/open-link"),params:c({url:s().describe("URL to open in the host's browser")})}),$_=c({isError:v().optional().describe("True if the host failed to open the URL (e.g., due to security policy).")}).passthrough(),C_=c({isError:v().optional().describe("True if the download failed (e.g., user cancelled or host denied).")}).passthrough(),I_=c({isError:v().optional().describe("True if the host rejected or failed to deliver the message.")}).passthrough(),O_=c({method:l("ui/notifications/sandbox-proxy-ready"),params:c({})}),al=c({connectDomains:h(s()).optional().describe(`Origins for network requests (fetch/XHR/WebSocket).
126
125
 
127
126
  - Maps to CSP \`connect-src\` directive
128
- - Empty or omitted → no network connections (secure default)`),resourceDomains:W.array(W.string()).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:W.array(W.string()).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:W.array(W.string()).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'`)")}),A9=W.object({camera:W.object({}).optional().describe("Request camera access.\n\nMaps to Permission Policy `camera` feature."),microphone:W.object({}).optional().describe("Request microphone access.\n\nMaps to Permission Policy `microphone` feature."),geolocation:W.object({}).optional().describe("Request geolocation access.\n\nMaps to Permission Policy `geolocation` feature."),clipboardWrite:W.object({}).optional().describe("Request clipboard write access.\n\nMaps to Permission Policy `clipboard-write` feature.")}),Xq=W.object({method:W.literal("ui/notifications/size-changed"),params:W.object({width:W.number().optional().describe("New width in pixels."),height:W.number().optional().describe("New height in pixels.")})}),uG=W.object({method:W.literal("ui/notifications/tool-input"),params:W.object({arguments:W.record(W.string(),W.unknown().describe("Complete tool call arguments as key-value pairs.")).optional().describe("Complete tool call arguments as key-value pairs.")})}),cG=W.object({method:W.literal("ui/notifications/tool-input-partial"),params:W.object({arguments:W.record(W.string(),W.unknown().describe("Partial tool call arguments (incomplete, may change).")).optional().describe("Partial tool call arguments (incomplete, may change).")})}),mG=W.object({method:W.literal("ui/notifications/tool-cancelled"),params:W.object({reason:W.string().optional().describe('Optional reason for the cancellation (e.g., "user action", "timeout").')})}),qq=W.object({fonts:W.string().optional()}),Kq=W.object({variables:_q.optional().describe("CSS variables for theming the app."),css:qq.optional().describe("CSS blocks that apps can inject.")}),iG=W.object({method:W.literal("ui/resource-teardown"),params:W.object({})}),Gq=W.record(W.string(),W.unknown()),j3=W.object({text:W.object({}).optional().describe("Host supports text content blocks."),image:W.object({}).optional().describe("Host supports image content blocks."),audio:W.object({}).optional().describe("Host supports audio content blocks."),resource:W.object({}).optional().describe("Host supports resource content blocks."),resourceLink:W.object({}).optional().describe("Host supports resource link content blocks."),structuredContent:W.object({}).optional().describe("Host supports structured content.")}),Oq=W.object({method:W.literal("ui/notifications/request-teardown"),params:W.object({}).optional()}),Aq=W.object({experimental:W.record(W.string(),W.record(W.string(),W.any()).describe("Experimental features keyed by identifier.")).optional().describe("Experimental features keyed by identifier."),openLinks:W.object({}).optional().describe("Host supports opening external URLs."),downloadFile:W.object({}).optional().describe("Host supports file downloads via ui/download-file."),serverTools:W.object({listChanged:W.boolean().optional().describe("Host supports tools/list_changed notifications.")}).optional().describe("Host can proxy tool calls to the MCP server."),serverResources:W.object({listChanged:W.boolean().optional().describe("Host supports resources/list_changed notifications.")}).optional().describe("Host can proxy resource reads to the MCP server."),logging:W.object({}).optional().describe("Host accepts log messages."),sandbox:W.object({permissions:A9.optional().describe("Permissions granted by the host (camera, microphone, geolocation)."),csp:O9.optional().describe("CSP domains approved by the host.")}).optional().describe("Sandbox configuration applied by the host."),updateModelContext:j3.optional().describe("Host accepts context updates (ui/update-model-context) to be included in the model's context for future turns."),message:j3.optional().describe("Host supports receiving content messages (ui/message) from the view."),sampling:W.object({tools:W.object({}).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.")}),Fq=W.object({experimental:W.record(W.string(),W.record(W.string(),W.any()).describe("Experimental features keyed by identifier.")).optional().describe("Experimental features keyed by identifier."),tools:W.object({listChanged:W.boolean().optional().describe("App supports tools/list_changed notifications.")}).optional().describe("App exposes MCP-style tools that the host can call."),availableDisplayModes:W.array(GW).optional().describe("Display modes the app supports.")}),Vq=W.object({method:W.literal("ui/notifications/initialized"),params:W.object({}).optional()}),pG=W.object({csp:O9.optional().describe("Content Security Policy configuration for UI resources."),permissions:A9.optional().describe("Sandbox permissions requested by the UI resource."),domain:W.string().optional().describe(`Dedicated origin for view sandbox.
127
+ - Empty or omitted → no network connections (secure default)`),resourceDomains:h(s()).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:h(s()).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:h(s()).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'`)")}),cl=c({camera:c({}).optional().describe("Request camera access.\n\nMaps to Permission Policy `camera` feature."),microphone:c({}).optional().describe("Request microphone access.\n\nMaps to Permission Policy `microphone` feature."),geolocation:c({}).optional().describe("Request geolocation access.\n\nMaps to Permission Policy `geolocation` feature."),clipboardWrite:c({}).optional().describe("Request clipboard write access.\n\nMaps to Permission Policy `clipboard-write` feature.")}),M_=c({method:l("ui/notifications/size-changed"),params:c({width:g().optional().describe("New width in pixels."),height:g().optional().describe("New height in pixels.")})}),lR=c({method:l("ui/notifications/tool-input"),params:c({arguments:S(s(),R().describe("Complete tool call arguments as key-value pairs.")).optional().describe("Complete tool call arguments as key-value pairs.")})}),uR=c({method:l("ui/notifications/tool-input-partial"),params:c({arguments:S(s(),R().describe("Partial tool call arguments (incomplete, may change).")).optional().describe("Partial tool call arguments (incomplete, may change).")})}),dR=c({method:l("ui/notifications/tool-cancelled"),params:c({reason:s().optional().describe('Optional reason for the cancellation (e.g., "user action", "timeout").')})}),q_=c({fonts:s().optional()}),N_=c({variables:P_.optional().describe("CSS variables for theming the app."),css:q_.optional().describe("CSS blocks that apps can inject.")}),pR=c({method:l("ui/resource-teardown"),params:c({})}),A_=S(s(),R()),Rm=c({text:c({}).optional().describe("Host supports text content blocks."),image:c({}).optional().describe("Host supports image content blocks."),audio:c({}).optional().describe("Host supports audio content blocks."),resource:c({}).optional().describe("Host supports resource content blocks."),resourceLink:c({}).optional().describe("Host supports resource link content blocks."),structuredContent:c({}).optional().describe("Host supports structured content.")}),j_=c({method:l("ui/notifications/request-teardown"),params:c({}).optional()}),L_=c({experimental:S(s(),S(s(),bo()).describe("Experimental features keyed by identifier.")).optional().describe("Experimental features keyed by identifier."),openLinks:c({}).optional().describe("Host supports opening external URLs."),downloadFile:c({}).optional().describe("Host supports file downloads via ui/download-file."),serverTools:c({listChanged:v().optional().describe("Host supports tools/list_changed notifications.")}).optional().describe("Host can proxy tool calls to the MCP server."),serverResources:c({listChanged:v().optional().describe("Host supports resources/list_changed notifications.")}).optional().describe("Host can proxy resource reads to the MCP server."),logging:c({}).optional().describe("Host accepts log messages."),sandbox:c({permissions:cl.optional().describe("Permissions granted by the host (camera, microphone, geolocation)."),csp:al.optional().describe("CSP domains approved by the host.")}).optional().describe("Sandbox configuration applied by the host."),updateModelContext:Rm.optional().describe("Host accepts context updates (ui/update-model-context) to be included in the model's context for future turns."),message:Rm.optional().describe("Host supports receiving content messages (ui/message) from the view."),sampling:c({tools:c({}).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.")}),U_=c({experimental:S(s(),S(s(),bo()).describe("Experimental features keyed by identifier.")).optional().describe("Experimental features keyed by identifier."),tools:c({listChanged:v().optional().describe("App supports tools/list_changed notifications.")}).optional().describe("App exposes MCP-style tools that the host can call."),availableDisplayModes:h(oi).optional().describe("Display modes the app supports.")}),Z_=c({method:l("ui/notifications/initialized"),params:c({}).optional()}),hR=c({csp:al.optional().describe("Content Security Policy configuration for UI resources."),permissions:cl.optional().describe("Sandbox permissions requested by the UI resource."),domain:s().optional().describe(`Dedicated origin for view sandbox.
129
128
 
130
129
  Useful when views need stable, dedicated origins for OAuth callbacks, CORS policies, or API key allowlists.
131
130
 
@@ -133,13 +132,13 @@ Useful when views need stable, dedicated origins for OAuth callbacks, CORS polic
133
132
  - Hash-based subdomains (e.g., \`{hash}.claudemcpcontent.com\`)
134
133
  - URL-derived subdomains (e.g., \`www-example-com.oaiusercontent.com\`)
135
134
 
136
- If omitted, host uses default sandbox origin (typically per-conversation).`),prefersBorder:W.boolean().optional().describe(`Visual boundary preference - true if view prefers a visible border.
135
+ If omitted, host uses default sandbox origin (typically per-conversation).`),prefersBorder:v().optional().describe(`Visual boundary preference - true if view prefers a visible border.
137
136
 
138
137
  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.
139
138
 
140
139
  - \`true\`: request visible border + background
141
140
  - \`false\`: request no visible border + background
142
- - omitted: host decides border`)}),L3=W.object({method:W.literal("ui/request-display-mode"),params:W.object({mode:GW.describe("The display mode being requested.")})}),$3=W.object({mode:GW.describe("The display mode that was actually set. May differ from requested if not supported.")}).passthrough(),Uq=W.union([W.literal("model"),W.literal("app")]).describe("Tool visibility scope - who can access the tool."),dG=W.object({resourceUri:W.string().optional(),visibility:W.array(Uq).optional().describe(`Who can access this tool. Default: ["model", "app"]
141
+ - omitted: host decides border`)}),wm=c({method:l("ui/request-display-mode"),params:c({mode:oi.describe("The display mode being requested.")})}),xm=c({mode:oi.describe("The display mode that was actually set. May differ from requested if not supported.")}).passthrough(),D_=_([l("model"),l("app")]).describe("Tool visibility scope - who can access the tool."),mR=c({resourceUri:s().optional(),visibility:h(D_).optional().describe(`Who can access this tool. Default: ["model", "app"]
143
142
  - "model": Tool visible to and callable by the agent
144
- - "app": Tool callable by the app from this server only`),csp:W.never().optional(),permissions:W.never().optional()}),oG=W.object({mimeTypes:W.array(W.string()).optional().describe('Array of supported MIME types for UI resources.\nMust include `"text/html;profile=mcp-app"` for MCP Apps support.')}),Pq=W.object({method:W.literal("ui/download-file"),params:W.object({contents:W.array(W.union([XH,qH])).describe("Resource contents to download — embedded (inline data) or linked (host fetches). Uses standard MCP resource types.")})}),zq=W.object({method:W.literal("ui/message"),params:W.object({role:W.literal("user").describe('Message role, currently only "user" is supported.'),content:W.array(jb).describe("Message content blocks (text, image, etc.).")})}),nG=W.object({method:W.literal("ui/notifications/sandbox-resource-ready"),params:W.object({html:W.string().describe("HTML content to load into the inner iframe."),sandbox:W.string().optional().describe("Optional override for the inner iframe's sandbox attribute."),csp:O9.optional().describe("CSP configuration from resource metadata."),permissions:A9.optional().describe("Sandbox permissions from resource metadata.")})}),rG=W.object({method:W.literal("ui/notifications/tool-result"),params:sb.describe("Standard MCP tool execution result.")}),k3=W.object({toolInfo:W.object({id:Tb.optional().describe("JSON-RPC id of the tools/call request."),tool:tb.describe("Tool definition including name, inputSchema, etc.")}).optional().describe("Metadata of the tool call that instantiated this App."),theme:Mq.optional().describe("Current color theme preference."),styles:Kq.optional().describe("Style configuration for theming the app."),displayMode:GW.optional().describe("How the UI is currently displayed."),availableDisplayModes:W.array(GW).optional().describe("Display modes the host supports."),containerDimensions:W.union([W.object({height:W.number().describe("Fixed container height in pixels.")}),W.object({maxHeight:W.union([W.number(),W.undefined()]).optional().describe("Maximum container height in pixels.")})]).and(W.union([W.object({width:W.number().describe("Fixed container width in pixels.")}),W.object({maxWidth:W.union([W.number(),W.undefined()]).optional().describe("Maximum container width in pixels.")})])).optional().describe(`Container dimensions. Represents the dimensions of the iframe or other
145
- container holding the app. Specify either width or maxWidth, and either height or maxHeight.`),locale:W.string().optional().describe("User's language and region preference in BCP 47 format."),timeZone:W.string().optional().describe("User's timezone in IANA format."),userAgent:W.string().optional().describe("Host application identifier."),platform:W.union([W.literal("web"),W.literal("desktop"),W.literal("mobile")]).optional().describe("Platform type for responsive design decisions."),deviceCapabilities:W.object({touch:W.boolean().optional().describe("Whether the device supports touch input."),hover:W.boolean().optional().describe("Whether the device supports hover interactions.")}).optional().describe("Device input capabilities."),safeAreaInsets:W.object({top:W.number().describe("Top safe area inset in pixels."),right:W.number().describe("Right safe area inset in pixels."),bottom:W.number().describe("Bottom safe area inset in pixels."),left:W.number().describe("Left safe area inset in pixels.")}).optional().describe("Mobile safe area boundaries in pixels.")}).passthrough(),tG=W.object({method:W.literal("ui/notifications/host-context-changed"),params:k3.describe("Partial context update containing only changed fields.")}),Iq=W.object({method:W.literal("ui/update-model-context"),params:W.object({content:W.array(jb).optional().describe("Context content blocks (text, image, etc.)."),structuredContent:W.record(W.string(),W.unknown().describe("Structured content for machine-readable context data.")).optional().describe("Structured content for machine-readable context data.")})}),Rq=W.object({method:W.literal("ui/initialize"),params:W.object({appInfo:Zb.describe("App identification (name and version)."),appCapabilities:Fq.describe("Features and capabilities this app provides."),protocolVersion:W.string().describe("Protocol version this app supports.")})}),Tq=W.object({protocolVersion:W.string().describe('Negotiated protocol version string (e.g., "2025-11-21").'),hostInfo:Zb.describe("Host application identification and version."),hostCapabilities:Aq.describe("Features and capabilities provided by the host."),hostContext:k3.describe("Rich context about the host environment.")}).passthrough();class F9{eventTarget;eventSource;messageListener;constructor(b=window.parent,H){this.eventTarget=b,this.eventSource=H,this.messageListener=(Q)=>{if(H&&Q.source!==this.eventSource){console.debug("Ignoring message from unknown source",Q);return}let N=wH.safeParse(Q.data);if(N.success)console.debug("Parsed message",N.data),this.onmessage?.(N.data);else if(Q.data?.jsonrpc!=="2.0")console.debug("Ignoring non-JSON-RPC message",N.error.message,Q);else console.error("Failed to parse message",N.error.message,Q),this.onerror?.(Error("Invalid JSON-RPC message received: "+N.error.message))}}async start(){window.addEventListener("message",this.messageListener)}async send(b,H){if(b.method!==Eq)console.debug("Sending message",b);this.eventTarget.postMessage(b,"*")}async close(){window.removeEventListener("message",this.messageListener),this.onclose?.()}onclose;onerror;onmessage;sessionId;setProtocolVersion}var Zq=[g3];class V9 extends XW{_client;_hostInfo;_hostCapabilities;_appCapabilities;_hostContext={};_appInfo;_initializedReceived=!1;_registeredEvents=new Set;_events=new C3;_methods=new S3;setRequestHandler=(...b)=>{let[H,...Q]=Z3("request",b)??b;this._methods.claim(H,"setRequestHandler"),super.setRequestHandler.call(this,H,...Q)};setNotificationHandler=(...b)=>{let[H,...Q]=Z3("notification",b)??b;this._methods.claim(H,"setNotificationHandler"),super.setNotificationHandler.call(this,H,...Q)};removeRequestHandler=(b)=>{this._methods.release(b),super.removeRequestHandler(b)};removeNotificationHandler=(b)=>{this._methods.release(b),super.removeNotificationHandler(b)};replaceRequestHandler=(b,...H)=>{this._methods.replace(b),super.setRequestHandler.call(this,b,...H)};_wrapHandler(b,H){let Q=super._wrapHandler(b,H);if(b==="ui/initialize"||b==="ping")return Q;return async(N,E)=>{if(!this._initializedReceived)console.warn(`[ext-apps] AppBridge received '${b}' before ui/notifications/initialized. The View is calling host methods before completing the handshake; it should await app.connect() first.`);return Q(N,E)}}eventSchemas={sizechange:Xq,sandboxready:Bq,initialized:Vq,requestteardown:Oq,loggingmessage:AQ};setEventHandler(b,H){this._ensureEventSlot(b),this._events.setHandler(b,H)}getEventHandler(b){return this._events.getHandler(b)}addEventListener(b,H){this._ensureEventSlot(b),this._events.addEventListener(b,H)}removeEventListener(b,H){this._events.removeEventListener(b,H)}_ensureEventSlot(b){if(this._registeredEvents.has(b))return;let H=this.eventSchemas[b];if(!H)throw Error(`Unknown event: ${String(b)}`);let Q=(N)=>{if(b==="initialized")this._initializedReceived=!0;this._events.dispatch(b,N)};if(b==="loggingmessage")this.setNotificationHandler("notifications/message",(N)=>{Q(N.params)});else this.setNotificationHandler(H.shape.method.value,{params:H.shape.params},(N)=>Q(N));this._registeredEvents.add(b)}warnIfRequestHandlerReplaced(b,H,Q){if(H&&Q)console.warn(`[MCP Apps] ${b} handler replaced. Previous handler will no longer be called.`)}constructor(b,H,Q,N){super(N);this._client=b,this._hostInfo=H,this._hostCapabilities=Q,this._methods.replace("notifications/cancelled"),this._methods.replace("notifications/progress"),this._ensureEventSlot("initialized"),this._hostContext=N?.hostContext||{},this.replaceRequestHandler("ui/initialize",{params:Rq.shape.params,result:Tq},(E)=>this._onAppsInitialize(E)),this.replaceRequestHandler("ping",(E,M)=>{return this.onping?.(E.params,M),{}}),this.replaceRequestHandler("ui/request-display-mode",{params:L3.shape.params,result:$3},()=>{return{mode:this._hostContext.displayMode??"inline"}})}buildContext(b){return b}assertCapabilityForMethod(b){}assertRequestHandlerCapability(b){}assertNotificationCapability(b){}getAppCapabilities(){return this._appCapabilities}getAppVersion(){return this._appInfo}onping;get onsizechange(){return this.getEventHandler("sizechange")}set onsizechange(b){this.setEventHandler("sizechange",b)}get onsandboxready(){return this.getEventHandler("sandboxready")}set onsandboxready(b){this.setEventHandler("sandboxready",b)}get oninitialized(){return this.getEventHandler("initialized")}set oninitialized(b){this.setEventHandler("initialized",b)}_onmessage;get onmessage(){return this._onmessage}set onmessage(b){this.warnIfRequestHandlerReplaced("onmessage",this._onmessage,b),this._onmessage=b,this.replaceRequestHandler("ui/message",{params:zq.shape.params,result:Jq},async(H,Q)=>{if(!this._onmessage)throw Error("No onmessage handler set");return this._onmessage(H,Q)})}_onopenlink;get onopenlink(){return this._onopenlink}set onopenlink(b){this.warnIfRequestHandlerReplaced("onopenlink",this._onopenlink,b),this._onopenlink=b,this.replaceRequestHandler("ui/open-link",{params:wq.shape.params,result:Yq},async(H,Q)=>{if(!this._onopenlink)throw Error("No onopenlink handler set");return this._onopenlink(H,Q)})}_ondownloadfile;get ondownloadfile(){return this._ondownloadfile}set ondownloadfile(b){this.warnIfRequestHandlerReplaced("ondownloadfile",this._ondownloadfile,b),this._ondownloadfile=b,this.replaceRequestHandler("ui/download-file",{params:Pq.shape.params,result:Dq},async(H,Q)=>{if(!this._ondownloadfile)throw Error("No ondownloadfile handler set");return this._ondownloadfile(H,Q)})}get onrequestteardown(){return this.getEventHandler("requestteardown")}set onrequestteardown(b){this.setEventHandler("requestteardown",b)}_onrequestdisplaymode;get onrequestdisplaymode(){return this._onrequestdisplaymode}set onrequestdisplaymode(b){this.warnIfRequestHandlerReplaced("onrequestdisplaymode",this._onrequestdisplaymode,b),this._onrequestdisplaymode=b,this.replaceRequestHandler("ui/request-display-mode",{params:L3.shape.params,result:$3},async(H,Q)=>{if(!this._onrequestdisplaymode)throw Error("No onrequestdisplaymode handler set");return this._onrequestdisplaymode(H,Q)})}get onloggingmessage(){return this.getEventHandler("loggingmessage")}set onloggingmessage(b){this.setEventHandler("loggingmessage",b)}_onupdatemodelcontext;get onupdatemodelcontext(){return this._onupdatemodelcontext}set onupdatemodelcontext(b){this.warnIfRequestHandlerReplaced("onupdatemodelcontext",this._onupdatemodelcontext,b),this._onupdatemodelcontext=b,this.replaceRequestHandler("ui/update-model-context",{params:Iq.shape.params,result:nb},async(H,Q)=>{if(!this._onupdatemodelcontext)throw Error("No onupdatemodelcontext handler set");return this._onupdatemodelcontext(H,Q)})}_oncalltool;get oncalltool(){return this._oncalltool}set oncalltool(b){this.warnIfRequestHandlerReplaced("oncalltool",this._oncalltool,b),this._oncalltool=b,this.replaceRequestHandler("tools/call",async(H,Q)=>{if(!this._oncalltool)throw Error("No oncalltool handler set");return this._oncalltool(H.params,Q)})}_oncreatesamplingmessage;get oncreatesamplingmessage(){return this._oncreatesamplingmessage}set oncreatesamplingmessage(b){this.warnIfRequestHandlerReplaced("oncreatesamplingmessage",this._oncreatesamplingmessage,b),this._oncreatesamplingmessage=b,this.replaceRequestHandler("sampling/createMessage",async(H,Q)=>{if(!this._oncreatesamplingmessage)throw Error("No oncreatesamplingmessage handler set");return this._oncreatesamplingmessage(H.params,Q)})}sendToolListChanged(b={}){return this.notification({method:"notifications/tools/list_changed",params:b})}_onlistresources;get onlistresources(){return this._onlistresources}set onlistresources(b){this.warnIfRequestHandlerReplaced("onlistresources",this._onlistresources,b),this._onlistresources=b,this.replaceRequestHandler("resources/list",async(H,Q)=>{if(!this._onlistresources)throw Error("No onlistresources handler set");return this._onlistresources(H.params,Q)})}_onlistresourcetemplates;get onlistresourcetemplates(){return this._onlistresourcetemplates}set onlistresourcetemplates(b){this.warnIfRequestHandlerReplaced("onlistresourcetemplates",this._onlistresourcetemplates,b),this._onlistresourcetemplates=b,this.replaceRequestHandler("resources/templates/list",async(H,Q)=>{if(!this._onlistresourcetemplates)throw Error("No onlistresourcetemplates handler set");return this._onlistresourcetemplates(H.params,Q)})}_onreadresource;get onreadresource(){return this._onreadresource}set onreadresource(b){this.warnIfRequestHandlerReplaced("onreadresource",this._onreadresource,b),this._onreadresource=b,this.replaceRequestHandler("resources/read",async(H,Q)=>{if(!this._onreadresource)throw Error("No onreadresource handler set");return this._onreadresource(H.params,Q)})}sendResourceListChanged(b={}){return this.notification({method:"notifications/resources/list_changed",params:b})}_onlistprompts;get onlistprompts(){return this._onlistprompts}set onlistprompts(b){this.warnIfRequestHandlerReplaced("onlistprompts",this._onlistprompts,b),this._onlistprompts=b,this.replaceRequestHandler("prompts/list",async(H,Q)=>{if(!this._onlistprompts)throw Error("No onlistprompts handler set");return this._onlistprompts(H.params,Q)})}sendPromptListChanged(b={}){return this.notification({method:"notifications/prompts/list_changed",params:b})}getCapabilities(){return this._hostCapabilities}async _onAppsInitialize(b){let H=b.protocolVersion;if(this._appInfo!==void 0)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.");return this._appCapabilities=b.appCapabilities,this._appInfo=b.appInfo,{protocolVersion:Zq.includes(H)?H:g3,hostCapabilities:this.getCapabilities(),hostInfo:this._hostInfo,hostContext:this._hostContext}}setHostContext(b){let H={},Q=!1;for(let N of Object.keys(b)){let E=this._hostContext[N],M=b[N];if(jq(E,M))continue;H[N]=M,Q=!0}if(Q)this._hostContext=b,this.sendHostContextChange(H)}sendHostContextChange(b){return this.notification({method:"ui/notifications/host-context-changed",params:b})}sendToolInput(b){return this.notification({method:"ui/notifications/tool-input",params:b})}sendToolInputPartial(b){return this.notification({method:"ui/notifications/tool-input-partial",params:b})}sendToolResult(b){return this.notification({method:"ui/notifications/tool-result",params:b})}sendToolCancelled(b){return this.notification({method:"ui/notifications/tool-cancelled",params:b})}sendSandboxResourceReady(b){return this.notification({method:"ui/notifications/sandbox-resource-ready",params:b})}teardownResource(b,H){return this.request({method:"ui/resource-teardown",params:b},Gq,H)}sendResourceTeardown=this.teardownResource;callTool(b,H){return this.request({method:"tools/call",params:b},H)}listTools(b,H){return this.request({method:"tools/list",params:b},H)}async connect(b){if(this.transport)throw Error("AppBridge is already connected. Call close() before connecting again.");if(this._initializedReceived=!1,this._client){let H=this._client.getServerCapabilities();if(!H)throw Error("Client server capabilities not available");if(H.tools){if(this.oncalltool=async(Q,N)=>{return this._client.request({method:"tools/call",params:Q},{signal:N.mcpReq.signal})},H.tools.listChanged)this._client.setNotificationHandler("notifications/tools/list_changed",(Q)=>this.sendToolListChanged(Q.params))}if(H.resources){if(this.onlistresources=async(Q,N)=>{return this._client.request({method:"resources/list",params:Q},{signal:N.mcpReq.signal})},this.onlistresourcetemplates=async(Q,N)=>{return this._client.request({method:"resources/templates/list",params:Q},{signal:N.mcpReq.signal})},this.onreadresource=async(Q,N)=>{return this._client.request({method:"resources/read",params:Q},{signal:N.mcpReq.signal})},H.resources.listChanged)this._client.setNotificationHandler("notifications/resources/list_changed",(Q)=>this.sendResourceListChanged(Q.params))}if(H.prompts){if(this.onlistprompts=async(Q,N)=>{return this._client.request({method:"prompts/list",params:Q},{signal:N.mcpReq.signal})},H.prompts.listChanged)this._client.setNotificationHandler("notifications/prompts/list_changed",(Q)=>this.sendPromptListChanged(Q.params))}}return super.connect(b)}}function jq(b,H){return JSON.stringify(b)===JSON.stringify(H)}function x3(b,H){let Q=new DOMParser().parseFromString(b,"text/html"),N=Q.createElement("meta");if(N.httpEquiv="Content-Security-Policy",N.content=H,Q.head.prepend(N),!Q.querySelector("base[href]")){let E=Q.querySelector("base")??Q.createElement("base");E.setAttribute("href","about:srcdoc"),N.after(E)}return"<!doctype html>"+Q.documentElement.outerHTML}var $b=new ow({name:"ADS preview",version:"1.0.0"},{},{autoResize:!0}),oN=document.getElementById("ads-token-root"),yH=document.getElementById("ads-widget-status"),rw=document.getElementById("ads-token-theme"),nw=document.getElementById("ads-scenario-root"),RQ,kb=0,v3="",dN=30,h3=document.createElement("style");if(oN)document.head.append(h3);function tw(b){if(b!=="light"&&b!=="dark")return;if(document.documentElement.dataset.theme=b,rw)rw.value=b;if(oN&&RQ)zQ()}function gb(b,H){let Q=document.createElement(b);return Q.textContent=H,Q}function Lq(b){let H=gb("li","");H.dataset.token=b.name;let Q=getComputedStyle(document.documentElement).getPropertyValue(b.name).trim(),N=gb("details","");N.className="token-source";let E=gb("summary","");E.title=`${b.name}: ${Q||"Conditional or unset"}. Click to inspect source definitions.`;let M=gb("code",b.name);M.className="token-name";let _=gb("span",Q||"Conditional or unset");E.append(M,_);let Y=gb("dl","");if(Y.append(gb("dt","Computed in preview"),gb("dd",Q||"Conditional or unset")),b.meaning)Y.append(gb("dt","Meaning"),gb("dd",b.meaning));for(let D of b.definitions)Y.append(gb("dt",D.scope),gb("dd",`${D.value} · ${D.file}:${D.line}`));return N.append(E,Y),H.append(N),H}function zQ(){h3.textContent=RQ.css;let b=RQ.tokens.filter((H)=>`${H.name} ${H.type??""}`.toLowerCase().includes(v3.toLowerCase()));document.getElementById("ads-token-list").replaceChildren(...b.slice(kb,kb+dN).map(Lq)),document.querySelector("footer").hidden=b.length<=dN,document.getElementById("ads-token-count").textContent=b.length?`${kb+1}–${Math.min(kb+dN,b.length)} of ${b.length}`:"No matching tokens",document.getElementById("ads-token-prev").disabled=kb===0,document.getElementById("ads-token-next").disabled=kb+dN>=b.length,yH.textContent=`${b.length} matching definitions · ${RQ.diagnostics.length} diagnostics`}if(oN)$b.ontoolinput=()=>{if(kb=0,RQ)zQ()},RQ=JSON.parse(document.getElementById("ads-token-seed").textContent),tw("light"),document.getElementById("ads-token-search").addEventListener("input",(b)=>{v3=b.target.value,kb=0,zQ()}),rw.addEventListener("change",()=>tw(rw.value)),document.getElementById("ads-token-prev").addEventListener("click",()=>{kb=Math.max(0,kb-dN),zQ()}),document.getElementById("ads-token-next").addEventListener("click",()=>{kb+=dN,zQ()}),document.getElementById("ads-token-refresh").addEventListener("click",async()=>{try{let b=await $b.readServerResource({uri:"ads://project/tokens"});RQ=JSON.parse(b.contents.find((H)=>("text"in H)).text),kb=0,zQ()}catch(b){yH.textContent=`Refresh failed: ${b.message}`}});var IQ,U9,y3=!1,OW=0;async function f3(b){if(U9=b,!y3||!nw)return;let H=b?.structuredContent?.draftScope;b=b?.structuredContent?.previewResult??b;let Q=b?.structuredContent?.scenario?.resourceUri;if(!Q||!Q.startsWith("ui://ads/previews/"))return;let N=++OW;if(oN)oN.hidden=!0,yH=document.getElementById("ads-scenario-status");nw.hidden=!1;try{if(!$b.getHostCapabilities()?.serverResources)throw Error("This Apps host does not forward server resources. Use the project showcase URL from the tool result.");let M=(await $b.readServerResource({uri:H?H+encodeURIComponent(Q):Q})).contents.find((J)=>J.mimeType==="text/html;profile=mcp-app"&&typeof J.text==="string");if(!M)throw Error("Scenario HTML is unavailable.");if(N!==OW)return;if(IQ)await IQ.close(),IQ=void 0;let _=document.createElement("iframe");_.title=b.structuredContent.scenario.title,_.setAttribute("sandbox","allow-scripts allow-forms"),nw.replaceChildren(_);let Y=new V9(null,{name:"ADS scenario host",version:"1.0.0"},{serverResources:{},serverTools:{}},{hostContext:$b.getHostContext()});IQ=Y,Y.onreadresource=(J)=>$b.readServerResource({...J,uri:H?H+encodeURIComponent(J.uri):J.uri}),Y.oncalltool=(J)=>$b.callServerTool(J),Y.onsizechange=({height:J})=>{if(J)_.height=String(Math.min(1e4,Math.max(120,J)))},Y.oninitialized=async()=>{if(await Y.sendToolInput({arguments:{}}),await Y.sendToolResult(b),N===OW)window.parent.postMessage({type:"ads-preview-ready"},"*")},await Y.connect(new F9(_.contentWindow,_.contentWindow));let D="default-src 'none'; script-src 'unsafe-inline' 'wasm-unsafe-eval' blob:; style-src 'unsafe-inline'; img-src data: blob:; font-src data:; worker-src blob: data:; connect-src blob:; base-uri about:; object-src 'none'; form-action 'none'";_.srcdoc=x3(M.text,D),yH.hidden=!0}catch(E){if(N===OW)yH.hidden=!1,yH.textContent=E.message,window.parent.postMessage({type:"ads-preview-ready"},"*")}}if(nw)$b.ontoolresult=(b)=>{f3(b)},$b.onteardown=async()=>{++OW;let b=IQ;IQ=void 0;try{await b?.teardownResource({},{timeout:500})}catch{}return await b?.close(),{}};$b.onhostcontextchanged=(b)=>{tw(b.theme),IQ?.setHostContext(b)};try{if(await $b.connect(),y3=!0,U9)f3(U9);if(tw($b.getHostContext()?.theme),oN)document.getElementById("ads-token-refresh").disabled=!$b.getHostCapabilities()?.serverResources,zQ()}catch{if(yH)yH.textContent="Apps bridge unavailable. Samples remain usable; inspect project data through ADS tools/resources."}
143
+ - "app": Tool callable by the app from this server only`),csp:sn().optional(),permissions:sn().optional()}),fR=c({mimeTypes:h(s()).optional().describe('Array of supported MIME types for UI resources.\nMust include `"text/html;profile=mcp-app"` for MCP Apps support.')}),H_=c({method:l("ui/download-file"),params:c({contents:h(_([Je,Be])).describe("Resource contents to download — embedded (inline data) or linked (host fetches). Uses standard MCP resource types.")})}),F_=c({method:l("ui/message"),params:c({role:l("user").describe('Message role, currently only "user" is supported.'),content:h(ge).describe("Message content blocks (text, image, etc.).")})}),gR=c({method:l("ui/notifications/sandbox-resource-ready"),params:c({html:s().describe("HTML content to load into the inner iframe."),sandbox:s().optional().describe("Optional override for the inner iframe's sandbox attribute."),csp:al.optional().describe("CSP configuration from resource metadata."),permissions:cl.optional().describe("Sandbox permissions from resource metadata.")})}),SR=c({method:l("ui/notifications/tool-result"),params:Oe.describe("Standard MCP tool execution result.")}),km=c({toolInfo:c({id:me.optional().describe("JSON-RPC id of the tools/call request."),tool:Ie.describe("Tool definition including name, inputSchema, etc.")}).optional().describe("Metadata of the tool call that instantiated this App."),theme:T_.optional().describe("Current color theme preference."),styles:N_.optional().describe("Style configuration for theming the app."),displayMode:oi.optional().describe("How the UI is currently displayed."),availableDisplayModes:h(oi).optional().describe("Display modes the host supports."),containerDimensions:_([c({height:g().describe("Fixed container height in pixels.")}),c({maxHeight:_([g(),_o()]).optional().describe("Maximum container height in pixels.")})]).and(_([c({width:g().describe("Fixed container width in pixels.")}),c({maxWidth:_([g(),_o()]).optional().describe("Maximum container width in pixels.")})])).optional().describe(`Container dimensions. Represents the dimensions of the iframe or other
144
+ container holding the app. Specify either width or maxWidth, and either height or maxHeight.`),locale:s().optional().describe("User's language and region preference in BCP 47 format."),timeZone:s().optional().describe("User's timezone in IANA format."),userAgent:s().optional().describe("Host application identifier."),platform:_([l("web"),l("desktop"),l("mobile")]).optional().describe("Platform type for responsive design decisions."),deviceCapabilities:c({touch:v().optional().describe("Whether the device supports touch input."),hover:v().optional().describe("Whether the device supports hover interactions.")}).optional().describe("Device input capabilities."),safeAreaInsets:c({top:g().describe("Top safe area inset in pixels."),right:g().describe("Right safe area inset in pixels."),bottom:g().describe("Bottom safe area inset in pixels."),left:g().describe("Left safe area inset in pixels.")}).optional().describe("Mobile safe area boundaries in pixels.")}).passthrough(),_R=c({method:l("ui/notifications/host-context-changed"),params:km.describe("Partial context update containing only changed fields.")}),V_=c({method:l("ui/update-model-context"),params:c({content:h(ge).optional().describe("Context content blocks (text, image, etc.)."),structuredContent:S(s(),R().describe("Structured content for machine-readable context data.")).optional().describe("Structured content for machine-readable context data.")})}),J_=c({method:l("ui/initialize"),params:c({appInfo:fe.describe("App identification (name and version)."),appCapabilities:U_.describe("Features and capabilities this app provides."),protocolVersion:s().describe("Protocol version this app supports.")})}),B_=c({protocolVersion:s().describe('Negotiated protocol version string (e.g., "2025-11-21").'),hostInfo:fe.describe("Host application identification and version."),hostCapabilities:L_.describe("Features and capabilities provided by the host."),hostContext:km.describe("Rich context about the host environment.")}).passthrough();class ll{eventTarget;eventSource;messageListener;constructor(e=window.parent,t){this.eventTarget=e,this.eventSource=t,this.messageListener=(o)=>{if(t&&o.source!==this.eventSource){console.debug("Ignoring message from unknown source",o);return}let r=Ze.safeParse(o.data);if(r.success)console.debug("Parsed message",r.data),this.onmessage?.(r.data);else if(o.data?.jsonrpc!=="2.0")console.debug("Ignoring non-JSON-RPC message",r.error.message,o);else console.error("Failed to parse message",r.error.message,o),this.onerror?.(Error("Invalid JSON-RPC message received: "+r.error.message))}}async start(){window.addEventListener("message",this.messageListener)}async send(e,t){if(e.method!==x_)console.debug("Sending message",e);this.eventTarget.postMessage(e,"*")}async close(){window.removeEventListener("message",this.messageListener),this.onclose?.()}onclose;onerror;onmessage;sessionId;setProtocolVersion}var W_=[Pm];class ul extends Xs{_client;_hostInfo;_hostCapabilities;_appCapabilities;_hostContext={};_appInfo;_initializedReceived=!1;_registeredEvents=new Set;_events=new Tm;_methods=new Em;setRequestHandler=(...e)=>{let[t,...o]=zm("request",e)??e;this._methods.claim(t,"setRequestHandler"),super.setRequestHandler.call(this,t,...o)};setNotificationHandler=(...e)=>{let[t,...o]=zm("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);if(e==="ui/initialize"||e==="ping")return o;return async(r,n)=>{if(!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.`);return o(r,n)}}eventSchemas={sizechange:M_,sandboxready:O_,initialized:Z_,requestteardown:j_,loggingmessage:Zt};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=(r)=>{if(e==="initialized")this._initializedReceived=!0;this._events.dispatch(e,r)};if(e==="loggingmessage")this.setNotificationHandler("notifications/message",(r)=>{o(r.params)});else this.setNotificationHandler(t.shape.method.value,{params:t.shape.params},(r)=>o(r));this._registeredEvents.add(e)}warnIfRequestHandlerReplaced(e,t,o){if(t&&o)console.warn(`[MCP Apps] ${e} handler replaced. Previous handler will no longer be called.`)}constructor(e,t,o,r){super(r);this._client=e,this._hostInfo=t,this._hostCapabilities=o,this._methods.replace("notifications/cancelled"),this._methods.replace("notifications/progress"),this._ensureEventSlot("initialized"),this._hostContext=r?.hostContext||{},this.replaceRequestHandler("ui/initialize",{params:J_.shape.params,result:B_},(n)=>this._onAppsInitialize(n)),this.replaceRequestHandler("ping",(n,i)=>(this.onping?.(n.params,i),{})),this.replaceRequestHandler("ui/request-display-mode",{params:wm.shape.params,result:xm},()=>({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:F_.shape.params,result:I_},async(t,o)=>{if(!this._onmessage)throw Error("No onmessage handler set");return this._onmessage(t,o)})}_onopenlink;get onopenlink(){return this._onopenlink}set onopenlink(e){this.warnIfRequestHandlerReplaced("onopenlink",this._onopenlink,e),this._onopenlink=e,this.replaceRequestHandler("ui/open-link",{params:k_.shape.params,result:$_},async(t,o)=>{if(!this._onopenlink)throw Error("No onopenlink handler set");return this._onopenlink(t,o)})}_ondownloadfile;get ondownloadfile(){return this._ondownloadfile}set ondownloadfile(e){this.warnIfRequestHandlerReplaced("ondownloadfile",this._ondownloadfile,e),this._ondownloadfile=e,this.replaceRequestHandler("ui/download-file",{params:H_.shape.params,result:C_},async(t,o)=>{if(!this._ondownloadfile)throw Error("No ondownloadfile handler set");return this._ondownloadfile(t,o)})}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:wm.shape.params,result:xm},async(t,o)=>{if(!this._onrequestdisplaymode)throw Error("No onrequestdisplaymode handler set");return this._onrequestdisplaymode(t,o)})}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:V_.shape.params,result:$e},async(t,o)=>{if(!this._onupdatemodelcontext)throw Error("No onupdatemodelcontext handler set");return this._onupdatemodelcontext(t,o)})}_oncalltool;get oncalltool(){return this._oncalltool}set oncalltool(e){this.warnIfRequestHandlerReplaced("oncalltool",this._oncalltool,e),this._oncalltool=e,this.replaceRequestHandler("tools/call",async(t,o)=>{if(!this._oncalltool)throw Error("No oncalltool handler set");return this._oncalltool(t.params,o)})}_oncreatesamplingmessage;get oncreatesamplingmessage(){return this._oncreatesamplingmessage}set oncreatesamplingmessage(e){this.warnIfRequestHandlerReplaced("oncreatesamplingmessage",this._oncreatesamplingmessage,e),this._oncreatesamplingmessage=e,this.replaceRequestHandler("sampling/createMessage",async(t,o)=>{if(!this._oncreatesamplingmessage)throw Error("No oncreatesamplingmessage handler set");return this._oncreatesamplingmessage(t.params,o)})}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(t,o)=>{if(!this._onlistresources)throw Error("No onlistresources handler set");return this._onlistresources(t.params,o)})}_onlistresourcetemplates;get onlistresourcetemplates(){return this._onlistresourcetemplates}set onlistresourcetemplates(e){this.warnIfRequestHandlerReplaced("onlistresourcetemplates",this._onlistresourcetemplates,e),this._onlistresourcetemplates=e,this.replaceRequestHandler("resources/templates/list",async(t,o)=>{if(!this._onlistresourcetemplates)throw Error("No onlistresourcetemplates handler set");return this._onlistresourcetemplates(t.params,o)})}_onreadresource;get onreadresource(){return this._onreadresource}set onreadresource(e){this.warnIfRequestHandlerReplaced("onreadresource",this._onreadresource,e),this._onreadresource=e,this.replaceRequestHandler("resources/read",async(t,o)=>{if(!this._onreadresource)throw Error("No onreadresource handler set");return this._onreadresource(t.params,o)})}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(t,o)=>{if(!this._onlistprompts)throw Error("No onlistprompts handler set");return this._onlistprompts(t.params,o)})}sendPromptListChanged(e={}){return this.notification({method:"notifications/prompts/list_changed",params:e})}getCapabilities(){return this._hostCapabilities}async _onAppsInitialize(e){let t=e.protocolVersion;if(this._appInfo!==void 0)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.");return this._appCapabilities=e.appCapabilities,this._appInfo=e.appInfo,{protocolVersion:W_.includes(t)?t:Pm,hostCapabilities:this.getCapabilities(),hostInfo:this._hostInfo,hostContext:this._hostContext}}setHostContext(e){let t={},o=!1;for(let r of Object.keys(e)){let n=this._hostContext[r],i=e[r];if(K_(n,i))continue;t[r]=i,o=!0}if(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},A_,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 t=this._client.getServerCapabilities();if(!t)throw Error("Client server capabilities not available");if(t.tools){if(this.oncalltool=async(o,r)=>this._client.request({method:"tools/call",params:o},{signal:r.mcpReq.signal}),t.tools.listChanged)this._client.setNotificationHandler("notifications/tools/list_changed",(o)=>this.sendToolListChanged(o.params))}if(t.resources){if(this.onlistresources=async(o,r)=>this._client.request({method:"resources/list",params:o},{signal:r.mcpReq.signal}),this.onlistresourcetemplates=async(o,r)=>this._client.request({method:"resources/templates/list",params:o},{signal:r.mcpReq.signal}),this.onreadresource=async(o,r)=>this._client.request({method:"resources/read",params:o},{signal:r.mcpReq.signal}),t.resources.listChanged)this._client.setNotificationHandler("notifications/resources/list_changed",(o)=>this.sendResourceListChanged(o.params))}if(t.prompts){if(this.onlistprompts=async(o,r)=>this._client.request({method:"prompts/list",params:o},{signal:r.mcpReq.signal}),t.prompts.listChanged)this._client.setNotificationHandler("notifications/prompts/list_changed",(o)=>this.sendPromptListChanged(o.params))}}return super.connect(e)}}function K_(e,t){return JSON.stringify(e)===JSON.stringify(t)}function $m(e,t){let o=new DOMParser().parseFromString(e,"text/html"),r=o.createElement("meta");if(r.httpEquiv="Content-Security-Policy",r.content=t,o.head.prepend(r),!o.querySelector("base[href]")){let n=o.querySelector("base")??o.createElement("base");n.setAttribute("href","about:srcdoc"),r.after(n)}return"<!doctype html>"+o.documentElement.outerHTML}var _e=new wa({name:"ADS preview",version:"1.0.0"},{},{autoResize:!0}),Ko=document.getElementById("ads-token-root"),dt=document.getElementById("ads-widget-status"),Ta=document.getElementById("ads-token-theme"),xa=document.getElementById("ads-scenario-root"),Wt,ve=0,Cm="",Wo=30,Im=document.createElement("style");if(Ko)document.head.append(Im);function Ea(e){if(e!=="light"&&e!=="dark")return;if(document.documentElement.dataset.theme=e,Ta)Ta.value=e;if(Ko&&Wt)Jt()}function ye(e,t){let o=document.createElement(e);return o.textContent=t,o}function G_(e){let t=ye("li","");t.dataset.token=e.name;let o=getComputedStyle(document.documentElement).getPropertyValue(e.name).trim(),r=ye("details","");r.className="token-source";let n=ye("summary","");n.title=`${e.name}: ${o||"Conditional or unset"}. Click to inspect source definitions.`;let i=ye("code",e.name);i.className="token-name";let a=ye("span",o||"Conditional or unset");n.append(i,a);let u=ye("dl","");if(u.append(ye("dt","Computed in preview"),ye("dd",o||"Conditional or unset")),e.meaning)u.append(ye("dt","Meaning"),ye("dd",e.meaning));for(let d of e.definitions)u.append(ye("dt",d.scope),ye("dd",`${d.value} · ${d.file}:${d.line}`));return r.append(n,u),t.append(r),t}function Jt(){Im.textContent=Wt.css;let e=Wt.tokens.filter((t)=>`${t.name} ${t.type??""}`.toLowerCase().includes(Cm.toLowerCase()));document.getElementById("ads-token-list").replaceChildren(...e.slice(ve,ve+Wo).map(G_)),document.querySelector("footer").hidden=e.length<=Wo,document.getElementById("ads-token-count").textContent=e.length?`${ve+1}–${Math.min(ve+Wo,e.length)} of ${e.length}`:"No matching tokens",document.getElementById("ads-token-prev").disabled=ve===0,document.getElementById("ads-token-next").disabled=ve+Wo>=e.length,dt.textContent=`${e.length} matching definitions · ${Wt.diagnostics.length} diagnostics`}if(Ko)_e.ontoolinput=()=>{if(ve=0,Wt)Jt()},Wt=JSON.parse(document.getElementById("ads-token-seed").textContent),Ea("light"),document.getElementById("ads-token-search").addEventListener("input",(e)=>{Cm=e.target.value,ve=0,Jt()}),Ta.addEventListener("change",()=>Ea(Ta.value)),document.getElementById("ads-token-prev").addEventListener("click",()=>{ve=Math.max(0,ve-Wo),Jt()}),document.getElementById("ads-token-next").addEventListener("click",()=>{ve+=Wo,Jt()}),document.getElementById("ads-token-refresh").addEventListener("click",async()=>{try{let e=await _e.readServerResource({uri:"ads://project/tokens"});Wt=JSON.parse(e.contents.find((t)=>("text"in t)).text),ve=0,Jt()}catch(e){dt.textContent=`Refresh failed: ${e.message}`}});var Bt,dl,Om=!1,ri=0;async function Mm(e){if(dl=e,!Om||!xa)return;let t=e?.structuredContent?.draftScope;e=e?.structuredContent?.previewResult??e;let o=e?.structuredContent?.scenario?.resourceUri;if(!o||!o.startsWith("ui://ads/previews/"))return;let r=++ri;if(Ko)Ko.hidden=!0,dt=document.getElementById("ads-scenario-status");xa.hidden=!1;try{if(!_e.getHostCapabilities()?.serverResources)throw Error("This Apps host does not forward server resources. Use the project showcase URL from the tool result.");let i=(await _e.readServerResource({uri:t?t+encodeURIComponent(o):o})).contents.find((p)=>p.mimeType==="text/html;profile=mcp-app"&&typeof p.text==="string");if(!i)throw Error("Scenario HTML is unavailable.");if(r!==ri)return;if(Bt)await Bt.close(),Bt=void 0;let a=document.createElement("iframe");a.title=e.structuredContent.scenario.title,a.setAttribute("sandbox","allow-scripts allow-forms"),xa.replaceChildren(a);let u=new ul(null,{name:"ADS scenario host",version:"1.0.0"},{serverResources:{},serverTools:{}},{hostContext:_e.getHostContext()});Bt=u,u.onreadresource=(p)=>_e.readServerResource({...p,uri:t?t+encodeURIComponent(p.uri):p.uri}),u.oncalltool=(p)=>_e.callServerTool(p),u.onsizechange=({height:p})=>{if(p)a.height=String(Math.min(1e4,Math.max(120,p)))},u.oninitialized=async()=>{if(await u.sendToolInput({arguments:{}}),await u.sendToolResult(e),r===ri)window.parent.postMessage({type:"ads-preview-ready"},"*")},await u.connect(new ll(a.contentWindow,a.contentWindow));let d="default-src 'none'; script-src 'unsafe-inline' 'wasm-unsafe-eval' blob:; style-src 'unsafe-inline'; img-src data: blob:; font-src data:; worker-src blob: data:; connect-src blob:; base-uri about:; object-src 'none'; form-action 'none'";a.srcdoc=$m(i.text,d),dt.hidden=!0}catch(n){if(r===ri)dt.hidden=!1,dt.textContent=n.message,window.parent.postMessage({type:"ads-preview-ready"},"*")}}if(xa)_e.ontoolresult=(e)=>{Mm(e)},_e.onteardown=async()=>{++ri;let e=Bt;Bt=void 0;try{await e?.teardownResource({},{timeout:500})}catch{}return await e?.close(),{}};_e.onhostcontextchanged=(e)=>{Ea(e.theme),Bt?.setHostContext(e)};try{if(await _e.connect(),Om=!0,dl)Mm(dl);if(Ea(_e.getHostContext()?.theme),Ko)document.getElementById("ads-token-refresh").disabled=!_e.getHostCapabilities()?.serverResources,Jt()}catch{if(dt)dt.textContent="Apps bridge unavailable. Samples remain usable; inspect project data through ADS tools/resources."}