@reqvire-org/ads 0.3.52 → 0.3.53
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/assets.mjs +15 -1
- package/dist/browser-audit/first-render.mjs +22 -0
- package/dist/browser-audit/image-shape.mjs +36 -0
- package/dist/browser-audit/render-states.mjs +61 -35
- package/dist/browser-audit/worker.mjs +47 -12
- package/dist/browser-audit.mjs +69 -11
- package/dist/check.mjs +4 -1
- package/dist/cli.mjs +1 -1
- package/dist/config.mjs +3 -1
- package/dist/finding-rules.mjs +8 -1
- package/dist/font-rules.mjs +103 -0
- package/dist/fonts-generated.mjs +30 -12
- package/dist/mcp/preview-widget.bundle.js +50 -47
- package/dist/mcp/project-widget.bundle.js +45 -42
- package/dist/mcp/server.mjs +2 -2
- package/dist/mcp/widget.bundle.js +49 -46
- package/dist/showcase/client.bundle.js +27 -27
- package/dist/skills/ads-designer/SKILL.md +5 -3
- package/dist/skills/ads-designer/references/branding.md +2 -2
- package/dist/skills/ads-designer/references/performance.md +54 -4
- package/dist/starters/react/design-system/brand/Icons/AppIcon/AppIcon.ads.fixture.ts +1 -1
- package/dist/starters/react/design-system/brand/Identity/Logo/Logo.ads.fixture.ts +2 -2
- package/dist/starters/react/design-system/components/Content/Logo/Logo.tsx +2 -2
- package/docs/ARCHITECTURE.md +26 -2
- package/docs/CHANGELOG.md +58 -12
- package/docs/GUIDE.md +35 -3
- package/package.json +7 -7
|
@@ -1,77 +1,80 @@
|
|
|
1
|
-
var{create:pm,defineProperty:ii,getOwnPropertyDescriptor:hm,getOwnPropertyNames:mm,getPrototypeOf:fm}=Object,gm=Object.prototype.hasOwnProperty,Gc=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),Kc=(e,t)=>{let o={};for(var r in e)ii(o,r,{get:e[r],enumerable:!0});if(t)ii(o,Symbol.toStringTag,{value:"Module"});return o},Sm=(e,t,o,r)=>{if(t&&typeof t==="object"||typeof t==="function"){for(var n=mm(t),i=0,a=n.length,c;i<a;i++)if(c=n[i],!gm.call(e,c)&&c!==o)ii(e,c,{get:((p)=>t[p]).bind(null,c),enumerable:!(r=hm(t,c))||r.enumerable})}return e},Yc=(e,t,o)=>(o=e!=null?pm(fm(e)):{},Sm(t||!e||!e.__esModule?ii(o,"default",{value:e,enumerable:!0}):o,e));var _m=new Set(["https://json-schema.org/draft/2019-09/schema","http://json-schema.org/draft/2019-09/schema"]);function Qc(e){return typeof e==="string"&&_m.has(e.replace(/#$/,""))}var Xc,pa=Object.freeze({status:"aborted"});function m(e,t,o){function r(c,p){if(!c._zod)Object.defineProperty(c,"_zod",{value:{def:p,constr:a,traits:new Set},enumerable:!1});if(c._zod.traits.has(e))return;c._zod.traits.add(e),t(c,p);let d=a.prototype,f=Object.keys(d);for(let S=0;S<f.length;S++){let _=f[S];if(!(_ in c))c[_]=d[_].bind(c)}}let n=o?.Parent??Object;class i extends n{}Object.defineProperty(i,"name",{value:e});function a(c){var p;let d=o?.Parent?new i:this;r(d,c),(p=d._zod).deferred??(p.deferred=[]);for(let f of d._zod.deferred)f();return d}return Object.defineProperty(a,"init",{value:r}),Object.defineProperty(a,Symbol.hasInstance,{value:(c)=>{if(o?.Parent&&c instanceof o.Parent)return!0;return c?._zod?.traits?.has(e)}}),Object.defineProperty(a,"name",{value:e}),a}var bm=Symbol("zod_brand");class Oe extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class Nr extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`);this.name="ZodEncodeError"}}(Xc=globalThis).__zod_globalConfig??(Xc.__zod_globalConfig={});var so=globalThis.__zod_globalConfig;function ce(e){if(e)Object.assign(so,e);return so}function ci(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 ma(e,t="|"){return e.map((o)=>_a(o)).join(t)}function Mr(e,t){if(typeof t==="bigint")return t.toString();return t}function qr(e){return{get value(){{let o=e();return Object.defineProperty(this,"value",{value:o}),o}throw Error("cached value already set")}}}function li(e){return e===null||e===void 0}function ui(e){let t=e.startsWith("^")?1:0,o=e.endsWith("$")?e.length-1:e.length;return e.slice(t,o)}function tl(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 el=Symbol("evaluating");function N(e,t,o){let r=void 0;Object.defineProperty(e,t,{get(){if(r===el)return;if(r===void 0)r=el,r=o();return r},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function yt(e,t,o){Object.defineProperty(e,t,{value:o,writable:!0,enumerable:!0,configurable:!0})}function We(...e){let t={};for(let o of e){let r=Object.getOwnPropertyDescriptors(o);Object.assign(t,r)}return Object.defineProperties({},t)}function fa(e){return JSON.stringify(e)}function ol(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var ga="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function io(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}var rl=qr(()=>{if(so.jitless)return!1;if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return new Function(""),!0}catch(e){return!1}});function zt(e){if(io(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(io(o)===!1)return!1;if(Object.prototype.hasOwnProperty.call(o,"isPrototypeOf")===!1)return!1;return!0}function Sa(e){if(zt(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 nl=new Set(["string","number","symbol"]);function Ge(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function _e(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 _a(e){if(typeof e==="bigint")return e.toString()+"n";if(typeof e==="string")return`"${e}"`;return`${e}`}function sl(e){return Object.keys(e).filter((t)=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}var il={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 ym(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=We(e._zod.def,{get shape(){let a={};for(let c in t){if(!(c in o.shape))throw Error(`Unrecognized key: "${c}"`);if(!t[c])continue;a[c]=o.shape[c]}return yt(this,"shape",a),a},checks:[]});return _e(e,i)}function zm(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=We(e._zod.def,{get shape(){let a={...e._zod.def.shape};for(let c in t){if(!(c in o.shape))throw Error(`Unrecognized key: "${c}"`);if(!t[c])continue;delete a[c]}return yt(this,"shape",a),a},checks:[]});return _e(e,i)}function vm(e,t){if(!zt(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=We(e._zod.def,{get shape(){let i={...e._zod.def.shape,...t};return yt(this,"shape",i),i}});return _e(e,n)}function Rm(e,t){if(!zt(t))throw Error("Invalid input to safeExtend: expected a plain object");let o=We(e._zod.def,{get shape(){let r={...e._zod.def.shape,...t};return yt(this,"shape",r),r}});return _e(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=We(e._zod.def,{get shape(){let r={...e._zod.def.shape,...t._zod.def.shape};return yt(this,"shape",r),r},get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]});return _e(e,o)}function xm(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=We(t._zod.def,{get shape(){let c=t._zod.def.shape,p={...c};if(o)for(let d in o){if(!(d in c))throw Error(`Unrecognized key: "${d}"`);if(!o[d])continue;p[d]=e?new e({type:"optional",innerType:c[d]}):c[d]}else for(let d in c)p[d]=e?new e({type:"optional",innerType:c[d]}):c[d];return yt(this,"shape",p),p},checks:[]});return _e(t,a)}function Pm(e,t,o){let r=We(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 yt(this,"shape",i),i}});return _e(t,r)}function vt(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 al(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 Ke(e,t){return t.map((o)=>{var r;return(r=o).path??(r.path=[]),o.path.unshift(e),o})}function ai(e){return typeof e==="string"?e:e?.message}function be(e,t,o){let r=e.message?e.message:ai(e.inst?._zod.def?.error?.(e))??ai(t?.error?.(e))??ai(o.customError?.(e))??ai(o.localeError?.(e))??"Invalid input",{inst:n,continue:i,input:a,...c}=e;if(c.path??(c.path=[]),c.message=r,t?.reportInput)c.input=a;return c}function di(e){if(Array.isArray(e))return"array";if(typeof e==="string")return"string";return"unknown"}function cl(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 Rt(...e){let[t,o,r]=e;if(typeof t==="string")return{message:t,code:"custom",input:o,inst:r};return{...t}}var ll=(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,Mr,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},pi=m("$ZodError",ll),ba=m("$ZodError",ll,{Parent:Error});function ya(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 za(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((c)=>r({issues:c},[...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 c=[...i,...a.path];if(c.length===0)o._errors.push(t(a));else{let p=o,d=0;while(d<c.length){let f=c[d];if(d!==c.length-1)p[f]=p[f]||{_errors:[]};else p[f]=p[f]||{_errors:[]},p[f]._errors.push(t(a));p=p[f],d++}}}};return r(e),o}var hi=(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 Oe;if(a.issues.length){let c=new(n?.Err??e)(a.issues.map((p)=>be(p,i,ce())));throw ga(c,n?.callee),c}return a.value};var mi=(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 c=new(n?.Err??e)(a.issues.map((p)=>be(p,i,ce())));throw ga(c,n?.callee),c}return a.value};var Ar=(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 Oe;return i.issues.length?{success:!1,error:new(e??pi)(i.issues.map((a)=>be(a,n,ce())))}:{success:!0,data:i.value}},ul=Ar(ba),jr=(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)=>be(a,n,ce())))}:{success:!0,data:i.value}},dl=jr(ba),pl=(e)=>(t,o,r)=>{let n=r?{...r,direction:"backward"}:{direction:"backward"};return hi(e)(t,o,n)};var hl=(e)=>(t,o,r)=>hi(e)(t,o,r);var ml=(e)=>async(t,o,r)=>{let n=r?{...r,direction:"backward"}:{direction:"backward"};return mi(e)(t,o,n)};var fl=(e)=>async(t,o,r)=>mi(e)(t,o,r);var gl=(e)=>(t,o,r)=>{let n=r?{...r,direction:"backward"}:{direction:"backward"};return Ar(e)(t,o,n)};var Sl=(e)=>(t,o,r)=>Ar(e)(t,o,r);var _l=(e)=>async(t,o,r)=>{let n=r?{...r,direction:"backward"}:{direction:"backward"};return jr(e)(t,o,n)};var bl=(e)=>async(t,o,r)=>jr(e)(t,o,r);var yl=/^[cC][0-9a-z]{6,}$/,zl=/^[0-9a-z]+$/,vl=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Rl=/^[0-9a-vA-V]{20}$/,wl=/^[A-Za-z0-9]{27}$/,xl=/^[a-zA-Z0-9_-]{21}$/,Pl=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/;var Tl=/^([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})$/,va=(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 kl=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;var km="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function El(){return new RegExp(km,"u")}var $l=/^(?:(?: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])$/,Cl=/^(([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 Il=/^((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])$/,Ol=/^(([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])$/,Nl=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Ra=/^[A-Za-z0-9_-]*$/;var Ml=/^https?$/,ql=/^\+[1-9]\d{6,14}$/,Al="(?:(?:\\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])))",jl=new RegExp(`^${Al}$`);function Ll(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 Ul(e){return new RegExp(`^${Ll(e)}$`)}function Zl(e){let t=Ll({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(`^${Al}T(?:${r})$`)}var Dl=(e)=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)};var Hl=/^-?\d+$/,wa=/^-?\d+(?:\.\d+)?$/,Vl=/^(?:true|false)$/i,Fl=/^null$/i;var Jl=/^undefined$/i;var Bl=/^[^A-Z]*$/,Wl=/^[^a-z]*$/;var X=m("$ZodCheck",(e,t)=>{var o;e._zod??(e._zod={}),e._zod.def=t,(o=e._zod).onattach??(o.onattach=[])}),Gl={number:"number",bigint:"bigint",object:"date"},xa=m("$ZodCheckLessThan",(e,t)=>{X.init(e,t);let o=Gl[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})}}),Pa=m("$ZodCheckGreaterThan",(e,t)=>{X.init(e,t);let o=Gl[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})}}),Kl=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):tl(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})}}),Yl=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]=il[t.format];e._zod.onattach.push((a)=>{let c=a._zod.bag;if(c.format=t.format,c.minimum=n,c.maximum=i,o)c.pattern=Hl}),e._zod.check=(a)=>{let c=a.value;if(o){if(!Number.isInteger(c)){a.issues.push({expected:r,format:t.format,code:"invalid_type",continue:!1,input:c,inst:e});return}if(!Number.isSafeInteger(c)){if(c>0)a.issues.push({input:c,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:c,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(c<n)a.issues.push({origin:"number",input:c,code:"too_small",minimum:n,inclusive:!0,inst:e,continue:!t.abort});if(c>i)a.issues.push({origin:"number",input:c,code:"too_big",maximum:i,inclusive:!0,inst:e,continue:!t.abort})}});var Ql=m("$ZodCheckMaxLength",(e,t)=>{var o;X.init(e,t),(o=e._zod.def).when??(o.when=(r)=>{let n=r.value;return!li(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=di(n);r.issues.push({origin:a,code:"too_big",maximum:t.maximum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),Xl=m("$ZodCheckMinLength",(e,t)=>{var o;X.init(e,t),(o=e._zod.def).when??(o.when=(r)=>{let n=r.value;return!li(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=di(n);r.issues.push({origin:a,code:"too_small",minimum:t.minimum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),eu=m("$ZodCheckLengthEquals",(e,t)=>{var o;X.init(e,t),(o=e._zod.def).when??(o.when=(r)=>{let n=r.value;return!li(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=di(n),c=i>t.length;r.issues.push({origin:a,...c?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:r.value,inst:e,continue:!t.abort})}}),Ur=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=()=>{})}),tu=m("$ZodCheckRegex",(e,t)=>{Ur.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})}}),ou=m("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=Bl),Ur.init(e,t)}),ru=m("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=Wl),Ur.init(e,t)}),nu=m("$ZodCheckIncludes",(e,t)=>{X.init(e,t);let o=Ge(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})}}),su=m("$ZodCheckStartsWith",(e,t)=>{X.init(e,t);let o=new RegExp(`^${Ge(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})}}),iu=m("$ZodCheckEndsWith",(e,t)=>{X.init(e,t);let o=new RegExp(`.*${Ge(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 au=m("$ZodCheckOverwrite",(e,t)=>{X.init(e,t),e._zod.check=(o)=>{o.value=t.tx(o.value)}});class Ta{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(`
|
|
1
|
+
var{create:af,defineProperty:vi,getOwnPropertyDescriptor:cf,getOwnPropertyNames:lf,getPrototypeOf:uf}=Object,df=Object.prototype.hasOwnProperty,zl=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),vl=(e,t)=>{let o={};for(var r in e)vi(o,r,{get:e[r],enumerable:!0});if(t)vi(o,Symbol.toStringTag,{value:"Module"});return o},pf=(e,t,o,r)=>{if(t&&typeof t==="object"||typeof t==="function"){for(var n=lf(t),i=0,s=n.length,c;i<s;i++)if(c=n[i],!df.call(e,c)&&c!==o)vi(e,c,{get:((l)=>t[l]).bind(null,c),enumerable:!(r=cf(t,c))||r.enumerable})}return e},Rl=(e,t,o)=>(o=e!=null?af(uf(e)):{},pf(t||!e||!e.__esModule?vi(o,"default",{value:e,enumerable:!0}):o,e));var hf=new Set(["https://json-schema.org/draft/2020-12/schema","http://json-schema.org/draft/2020-12/schema"]),wl=new Set(["https://json-schema.org/draft/2019-09/schema","http://json-schema.org/draft/2019-09/schema"]),mf=new Set(["https://json-schema.org/draft-07/schema","http://json-schema.org/draft-07/schema"]),ff=new Set(["https://json-schema.org/draft-06/schema","http://json-schema.org/draft-06/schema"]);function xl(e){return typeof e==="string"&&wl.has(e.replace(/#$/,""))}function Pl(e,t){if(!("$schema"in e)||typeof e.$schema!=="string")return"2020-12";let o=e.$schema.replace(/#$/,"");if(hf.has(o))return"2020-12";if(wl.has(o))return"2019-09";if(mf.has(o)||ff.has(o))return"draft-7";throw Error(`JSON Schema declares an unsupported dialect ("$schema": "${e.$schema.slice(0,200)}"). The default validator supports JSON Schema 2020-12, 2019-09, draft-07, and draft-06; ${t}`)}var Tl,Oa=Object.freeze({status:"aborted"});function g(e,t,o){function r(c,l){if(!c._zod)Object.defineProperty(c,"_zod",{value:{def:l,constr:s,traits:new Set},enumerable:!1});if(c._zod.traits.has(e))return;c._zod.traits.add(e),t(c,l);let u=s.prototype,h=Object.keys(u);for(let f=0;f<h.length;f++){let S=h[f];if(!(S in c))c[S]=u[S].bind(c)}}let n=o?.Parent??Object;class i extends n{}Object.defineProperty(i,"name",{value:e});function s(c){var l;let u=o?.Parent?new i:this;r(u,c),(l=u._zod).deferred??(l.deferred=[]);for(let h of u._zod.deferred)h();return u}return Object.defineProperty(s,"init",{value:r}),Object.defineProperty(s,Symbol.hasInstance,{value:(c)=>{if(o?.Parent&&c instanceof o.Parent)return!0;return c?._zod?.traits?.has(e)}}),Object.defineProperty(s,"name",{value:e}),s}var gf=Symbol("zod_brand");class ht extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class Fr extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`);this.name="ZodEncodeError"}}(Tl=globalThis).__zod_globalConfig??(Tl.__zod_globalConfig={});var Oo=globalThis.__zod_globalConfig;function ve(e){if(e)Object.assign(Oo,e);return Oo}function wi(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 Ma(e,t="|"){return e.map((o)=>La(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 xi(e){return e===null||e===void 0}function Pi(e){let t=e.startsWith("^")?1:0,o=e.endsWith("$")?e.length-1:e.length;return e.slice(t,o)}function kl(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 El=Symbol("evaluating");function J(e,t,o){let r=void 0;Object.defineProperty(e,t,{get(){if(r===El)return;if(r===void 0)r=El,r=o();return r},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function Xt(e,t,o){Object.defineProperty(e,t,{value:o,writable:!0,enumerable:!0,configurable:!0})}function kt(...e){let t={};for(let o of e){let r=Object.getOwnPropertyDescriptors(o);Object.assign(t,r)}return Object.defineProperties({},t)}function qa(e){return JSON.stringify(e)}function $l(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var Aa="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function No(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}var Cl=Br(()=>{if(Oo.jitless)return!1;if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return new Function(""),!0}catch(e){return!1}});function eo(e){if(No(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(No(o)===!1)return!1;if(Object.prototype.hasOwnProperty.call(o,"isPrototypeOf")===!1)return!1;return!0}function ja(e){if(eo(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 Il=new Set(["string","number","symbol"]);function $t(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function He(e,t,o){let r=new e._zod.constr(t??e._zod.def);if(!t||o?.parent)r._zod.parent=e;return r}function O(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 La(e){if(typeof e==="bigint")return e.toString()+"n";if(typeof e==="string")return`"${e}"`;return`${e}`}function Ol(e){return Object.keys(e).filter((t)=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}var Nl={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 Sf(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=kt(e._zod.def,{get shape(){let s={};for(let c in t){if(!(c in o.shape))throw Error(`Unrecognized key: "${c}"`);if(!t[c])continue;s[c]=o.shape[c]}return Xt(this,"shape",s),s},checks:[]});return He(e,i)}function _f(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=kt(e._zod.def,{get shape(){let s={...e._zod.def.shape};for(let c in t){if(!(c in o.shape))throw Error(`Unrecognized key: "${c}"`);if(!t[c])continue;delete s[c]}return Xt(this,"shape",s),s},checks:[]});return He(e,i)}function bf(e,t){if(!eo(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 s in t)if(Object.getOwnPropertyDescriptor(i,s)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}let n=kt(e._zod.def,{get shape(){let i={...e._zod.def.shape,...t};return Xt(this,"shape",i),i}});return He(e,n)}function yf(e,t){if(!eo(t))throw Error("Invalid input to safeExtend: expected a plain object");let o=kt(e._zod.def,{get shape(){let r={...e._zod.def.shape,...t};return Xt(this,"shape",r),r}});return He(e,o)}function zf(e,t){if(e._zod.def.checks?.length)throw Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");let o=kt(e._zod.def,{get shape(){let r={...e._zod.def.shape,...t._zod.def.shape};return Xt(this,"shape",r),r},get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]});return He(e,o)}function vf(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 s=kt(t._zod.def,{get shape(){let c=t._zod.def.shape,l={...c};if(o)for(let u in o){if(!(u in c))throw Error(`Unrecognized key: "${u}"`);if(!o[u])continue;l[u]=e?new e({type:"optional",innerType:c[u]}):c[u]}else for(let u in c)l[u]=e?new e({type:"optional",innerType:c[u]}):c[u];return Xt(this,"shape",l),l},checks:[]});return He(t,s)}function Rf(e,t,o){let r=kt(t._zod.def,{get shape(){let n=t._zod.def.shape,i={...n};if(o)for(let s in o){if(!(s in i))throw Error(`Unrecognized key: "${s}"`);if(!o[s])continue;i[s]=new e({type:"nonoptional",innerType:n[s]})}else for(let s in n)i[s]=new e({type:"nonoptional",innerType:n[s]});return Xt(this,"shape",i),i}});return He(t,r)}function to(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 Ml(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 Ct(e,t){return t.map((o)=>{var r;return(r=o).path??(r.path=[]),o.path.unshift(e),o})}function Ri(e){return typeof e==="string"?e:e?.message}function Fe(e,t,o){let r=e.message?e.message:Ri(e.inst?._zod.def?.error?.(e))??Ri(t?.error?.(e))??Ri(o.customError?.(e))??Ri(o.localeError?.(e))??"Invalid input",{inst:n,continue:i,input:s,...c}=e;if(c.path??(c.path=[]),c.message=r,t?.reportInput)c.input=s;return c}function Ti(e){if(Array.isArray(e))return"array";if(typeof e==="string")return"string";return"unknown"}function ql(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 oo(...e){let[t,o,r]=e;if(typeof t==="string")return{message:t,code:"custom",input:o,inst:r};return{...t}}var Al=(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})},Ei=g("$ZodError",Al),Ua=g("$ZodError",Al,{Parent:Error});function Za(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 Da(e,t=(o)=>o.message){let o={_errors:[]},r=(n,i=[])=>{for(let s of n.issues)if(s.code==="invalid_union"&&s.errors.length)s.errors.map((c)=>r({issues:c},[...i,...s.path]));else if(s.code==="invalid_key")r({issues:s.issues},[...i,...s.path]);else if(s.code==="invalid_element")r({issues:s.issues},[...i,...s.path]);else{let c=[...i,...s.path];if(c.length===0)o._errors.push(t(s));else{let l=o,u=0;while(u<c.length){let h=c[u];if(u!==c.length-1)l[h]=l[h]||{_errors:[]};else l[h]=l[h]||{_errors:[]},l[h]._errors.push(t(s));l=l[h],u++}}}};return r(e),o}var ki=(e)=>(t,o,r,n)=>{let i=r?{...r,async:!1}:{async:!1},s=t._zod.run({value:o,issues:[]},i);if(s instanceof Promise)throw new ht;if(s.issues.length){let c=new(n?.Err??e)(s.issues.map((l)=>Fe(l,i,ve())));throw Aa(c,n?.callee),c}return s.value};var $i=(e)=>async(t,o,r,n)=>{let i=r?{...r,async:!0}:{async:!0},s=t._zod.run({value:o,issues:[]},i);if(s instanceof Promise)s=await s;if(s.issues.length){let c=new(n?.Err??e)(s.issues.map((l)=>Fe(l,i,ve())));throw Aa(c,n?.callee),c}return s.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 ht;return i.issues.length?{success:!1,error:new(e??Ei)(i.issues.map((s)=>Fe(s,n,ve())))}:{success:!0,data:i.value}},jl=Wr(Ua),Gr=(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((s)=>Fe(s,n,ve())))}:{success:!0,data:i.value}},Ll=Gr(Ua),Ul=(e)=>(t,o,r)=>{let n=r?{...r,direction:"backward"}:{direction:"backward"};return ki(e)(t,o,n)};var Zl=(e)=>(t,o,r)=>ki(e)(t,o,r);var Dl=(e)=>async(t,o,r)=>{let n=r?{...r,direction:"backward"}:{direction:"backward"};return $i(e)(t,o,n)};var Vl=(e)=>async(t,o,r)=>$i(e)(t,o,r);var Hl=(e)=>(t,o,r)=>{let n=r?{...r,direction:"backward"}:{direction:"backward"};return Wr(e)(t,o,n)};var Fl=(e)=>(t,o,r)=>Wr(e)(t,o,r);var Jl=(e)=>async(t,o,r)=>{let n=r?{...r,direction:"backward"}:{direction:"backward"};return Gr(e)(t,o,n)};var Bl=(e)=>async(t,o,r)=>Gr(e)(t,o,r);var Wl=/^[cC][0-9a-z]{6,}$/,Gl=/^[0-9a-z]+$/,Kl=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Yl=/^[0-9a-vA-V]{20}$/,Ql=/^[A-Za-z0-9]{27}$/,Xl=/^[a-zA-Z0-9_-]{21}$/,eu=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/;var tu=/^([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})$/,Va=(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 ou=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;var xf="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function ru(){return new RegExp(xf,"u")}var nu=/^(?:(?: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])$/,su=/^(([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 iu=/^((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])$/,au=/^(([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])$/,cu=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Ha=/^[A-Za-z0-9_-]*$/;var lu=/^https?$/,uu=/^\+[1-9]\d{6,14}$/,du="(?:(?:\\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])))",pu=new RegExp(`^${du}$`);function hu(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 mu(e){return new RegExp(`^${hu(e)}$`)}function fu(e){let t=hu({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(`^${du}T(?:${r})$`)}var gu=(e)=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)};var Su=/^-?\d+$/,Fa=/^-?\d+(?:\.\d+)?$/,_u=/^(?:true|false)$/i,bu=/^null$/i;var yu=/^undefined$/i;var zu=/^[^A-Z]*$/,vu=/^[^a-z]*$/;var pe=g("$ZodCheck",(e,t)=>{var o;e._zod??(e._zod={}),e._zod.def=t,(o=e._zod).onattach??(o.onattach=[])}),Ru={number:"number",bigint:"bigint",object:"date"},Ja=g("$ZodCheckLessThan",(e,t)=>{pe.init(e,t);let o=Ru[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})}}),Ba=g("$ZodCheckGreaterThan",(e,t)=>{pe.init(e,t);let o=Ru[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})}}),wu=g("$ZodCheckMultipleOf",(e,t)=>{pe.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):kl(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})}}),xu=g("$ZodCheckNumberFormat",(e,t)=>{pe.init(e,t),t.format=t.format||"float64";let o=t.format?.includes("int"),r=o?"int":"number",[n,i]=Nl[t.format];e._zod.onattach.push((s)=>{let c=s._zod.bag;if(c.format=t.format,c.minimum=n,c.maximum=i,o)c.pattern=Su}),e._zod.check=(s)=>{let c=s.value;if(o){if(!Number.isInteger(c)){s.issues.push({expected:r,format:t.format,code:"invalid_type",continue:!1,input:c,inst:e});return}if(!Number.isSafeInteger(c)){if(c>0)s.issues.push({input:c,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 s.issues.push({input:c,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(c<n)s.issues.push({origin:"number",input:c,code:"too_small",minimum:n,inclusive:!0,inst:e,continue:!t.abort});if(c>i)s.issues.push({origin:"number",input:c,code:"too_big",maximum:i,inclusive:!0,inst:e,continue:!t.abort})}});var Pu=g("$ZodCheckMaxLength",(e,t)=>{var o;pe.init(e,t),(o=e._zod.def).when??(o.when=(r)=>{let n=r.value;return!xi(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 s=Ti(n);r.issues.push({origin:s,code:"too_big",maximum:t.maximum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),Tu=g("$ZodCheckMinLength",(e,t)=>{var o;pe.init(e,t),(o=e._zod.def).when??(o.when=(r)=>{let n=r.value;return!xi(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 s=Ti(n);r.issues.push({origin:s,code:"too_small",minimum:t.minimum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),Eu=g("$ZodCheckLengthEquals",(e,t)=>{var o;pe.init(e,t),(o=e._zod.def).when??(o.when=(r)=>{let n=r.value;return!xi(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 s=Ti(n),c=i>t.length;r.issues.push({origin:s,...c?{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=g("$ZodCheckStringFormat",(e,t)=>{var o,r;if(pe.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=()=>{})}),ku=g("$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})}}),$u=g("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=zu),Yr.init(e,t)}),Cu=g("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=vu),Yr.init(e,t)}),Iu=g("$ZodCheckIncludes",(e,t)=>{pe.init(e,t);let o=$t(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})}}),Ou=g("$ZodCheckStartsWith",(e,t)=>{pe.init(e,t);let o=new RegExp(`^${$t(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})}}),Nu=g("$ZodCheckEndsWith",(e,t)=>{pe.init(e,t);let o=new RegExp(`.*${$t(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 Mu=g("$ZodCheckOverwrite",(e,t)=>{pe.init(e,t),e._zod.check=(o)=>{o.value=t.tx(o.value)}});class Wa{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
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 lu={major:4,minor:4,patch:3};var A=m("$ZodType",(e,t)=>{var o;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=lu;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,c,p)=>{let d=vt(a),f;for(let S of c){if(S._zod.def.when){if(al(a))continue;if(!S._zod.def.when(a))continue}else if(d)continue;let _=a.issues.length,b=S._zod.check(a);if(b instanceof Promise&&p?.async===!1)throw new Oe;if(f||b instanceof Promise)f=(f??Promise.resolve()).then(async()=>{if(await b,a.issues.length===_)return;if(!d)d=vt(a,_)});else{if(a.issues.length===_)continue;if(!d)d=vt(a,_)}}if(f)return f.then(()=>a);return a},i=(a,c,p)=>{if(vt(a))return a.aborted=!0,a;let d=n(c,r,p);if(d instanceof Promise){if(p.async===!1)throw new Oe;return d.then((f)=>e._zod.parse(f,p))}return e._zod.parse(d,p)};e._zod.run=(a,c)=>{if(c.skipChecks)return e._zod.parse(a,c);if(c.direction==="backward"){let d=e._zod.parse({value:a.value,issues:[]},{...c,skipChecks:!0});if(d instanceof Promise)return d.then((f)=>i(f,a,c));return i(d,a,c)}let p=e._zod.parse(a,c);if(p instanceof Promise){if(c.async===!1)throw new Oe;return p.then((d)=>n(d,r,c))}return n(p,r,c)}}N(e,"~standard",()=>({validate:(n)=>{try{let i=ul(e,n);return i.success?{value:i.data}:{issues:i.error?.issues}}catch(i){return dl(e,n).then((a)=>a.success?{value:a.data}:{issues:a.error?.issues})}},vendor:"zod",version:1}))}),Si=m("$ZodString",(e,t)=>{A.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??Dl(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)=>{Ur.init(e,t),Si.init(e,t)}),_u=m("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=Tl),Z.init(e,t)}),bu=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=va(r))}else t.pattern??(t.pattern=va());Z.init(e,t)}),yu=m("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=kl),Z.init(e,t)}),zu=m("$ZodURL",(e,t)=>{Z.init(e,t),e._zod.check=(o)=>{try{let r=o.value.trim();if(!t.normalize&&t.protocol?.source===Ml.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})}}}),vu=m("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=El()),Z.init(e,t)}),Ru=m("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=xl),Z.init(e,t)}),wu=m("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=yl),Z.init(e,t)}),xu=m("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=zl),Z.init(e,t)}),Pu=m("$ZodULID",(e,t)=>{t.pattern??(t.pattern=vl),Z.init(e,t)}),Tu=m("$ZodXID",(e,t)=>{t.pattern??(t.pattern=Rl),Z.init(e,t)}),ku=m("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=wl),Z.init(e,t)}),Eu=m("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=Zl(t)),Z.init(e,t)}),$u=m("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=jl),Z.init(e,t)}),Cu=m("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=Ul(t)),Z.init(e,t)}),Iu=m("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=Pl),Z.init(e,t)}),Ou=m("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=$l),Z.init(e,t),e._zod.bag.format="ipv4"}),Nu=m("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=Cl),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 Mu=m("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=Il),Z.init(e,t)}),qu=m("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=Ol),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 Au(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 ju=m("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=Nl),Z.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=(o)=>{if(Au(o.value))return;o.issues.push({code:"invalid_format",format:"base64",input:o.value,inst:e,continue:!t.abort})}});function Em(e){if(!Ra.test(e))return!1;let t=e.replace(/[-_]/g,(r)=>r==="-"?"+":"/"),o=t.padEnd(Math.ceil(t.length/4)*4,"=");return Au(o)}var Lu=m("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=Ra),Z.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=(o)=>{if(Em(o.value))return;o.issues.push({code:"invalid_format",format:"base64url",input:o.value,inst:e,continue:!t.abort})}}),Uu=m("$ZodE164",(e,t)=>{t.pattern??(t.pattern=ql),Z.init(e,t)});function $m(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 Zu=m("$ZodJWT",(e,t)=>{Z.init(e,t),e._zod.check=(o)=>{if($m(o.value,t.alg))return;o.issues.push({code:"invalid_format",format:"jwt",input:o.value,inst:e,continue:!t.abort})}});var Ea=m("$ZodNumber",(e,t)=>{A.init(e,t),e._zod.pattern=e._zod.bag.pattern??wa,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}}),Du=m("$ZodNumberFormat",(e,t)=>{Yl.init(e,t),Ea.init(e,t)}),Hu=m("$ZodBoolean",(e,t)=>{A.init(e,t),e._zod.pattern=Vl,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 Vu=m("$ZodUndefined",(e,t)=>{A.init(e,t),e._zod.pattern=Jl,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}}),Fu=m("$ZodNull",(e,t)=>{A.init(e,t),e._zod.pattern=Fl,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}}),Ju=m("$ZodAny",(e,t)=>{A.init(e,t),e._zod.parse=(o)=>o}),Bu=m("$ZodUnknown",(e,t)=>{A.init(e,t),e._zod.parse=(o)=>o}),Wu=m("$ZodNever",(e,t)=>{A.init(e,t),e._zod.parse=(o,r)=>(o.issues.push({expected:"never",code:"invalid_type",input:o.value,inst:e}),o)});function uu(e,t,o){if(e.issues.length)t.issues.push(...Ke(o,e.issues));t.value[o]=e.value}var Gu=m("$ZodArray",(e,t)=>{A.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 c=n[a],p=t.element._zod.run({value:c,issues:[]},r);if(p instanceof Promise)i.push(p.then((d)=>uu(d,o,a)));else uu(p,o,a)}if(i.length)return Promise.all(i).then(()=>o);return o}});function gi(e,t,o,r,n,i){let a=o in r;if(e.issues.length){if(n&&i&&!a)return;t.issues.push(...Ke(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 Ku(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=sl(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(o)}}function Yu(e,t,o,r,n,i){let a=[],c=n.keySet,p=n.catchall._zod,d=p.def.type,f=p.optin==="optional",S=p.optout==="optional";for(let _ in t){if(_==="__proto__")continue;if(c.has(_))continue;if(d==="never"){a.push(_);continue}let b=p.run({value:t[_],issues:[]},r);if(b instanceof Promise)e.push(b.then((P)=>gi(P,o,_,t,f,S)));else gi(b,o,_,t,f,S)}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 Cm=m("$ZodObject",(e,t)=>{if(A.init(e,t),!Object.getOwnPropertyDescriptor(t,"shape")?.get){let c=t.shape;Object.defineProperty(t,"shape",{get:()=>{let p={...c};return Object.defineProperty(t,"shape",{value:p}),p}})}let r=qr(()=>Ku(t));N(e._zod,"propValues",()=>{let c=t.shape,p={};for(let d in c){let f=c[d]._zod;if(f.values){p[d]??(p[d]=new Set);for(let S of f.values)p[d].add(S)}}return p});let n=io,i=t.catchall,a;e._zod.parse=(c,p)=>{a??(a=r.value);let d=c.value;if(!n(d))return c.issues.push({expected:"object",code:"invalid_type",input:d,inst:e}),c;c.value={};let f=[],S=a.shape;for(let _ of a.keys){let b=S[_],P=b._zod.optin==="optional",k=b._zod.optout==="optional",E=b._zod.run({value:d[_],issues:[]},p);if(E instanceof Promise)f.push(E.then((I)=>gi(I,c,_,d,P,k)));else gi(E,c,_,d,P,k)}if(!i)return f.length?Promise.all(f).then(()=>c):c;return Yu(f,d,c,p,r.value,e)}}),Qu=m("$ZodObjectJIT",(e,t)=>{Cm.init(e,t);let o=e._zod.parse,r=qr(()=>Ku(t)),n=(_)=>{let b=new Ta(["shape","payload","ctx"]),P=r.value,k=(M)=>{let q=fa(M);return`shape[${q}]._zod.run({ value: input[${q}], issues: [] }, ctx)`};b.write("const input = payload.value;");let E=Object.create(null),I=0;for(let M of P.keys)E[M]=`key_${I++}`;b.write("const newResult = {};");for(let M of P.keys){let q=E[M],H=fa(M),U=_[M],K=U?._zod?.optin==="optional",$e=U?._zod?.optout==="optional";if(b.write(`const ${q} = ${k(M)};`),K&&$e)b.write(`
|
|
4
|
-
if (${
|
|
5
|
-
if (${
|
|
6
|
-
payload.issues = payload.issues.concat(${
|
|
3
|
+
`))}}var Au={major:4,minor:4,patch:3};var K=g("$ZodType",(e,t)=>{var o;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Au;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=(s,c,l)=>{let u=to(s),h;for(let f of c){if(f._zod.def.when){if(Ml(s))continue;if(!f._zod.def.when(s))continue}else if(u)continue;let S=s.issues.length,_=f._zod.check(s);if(_ instanceof Promise&&l?.async===!1)throw new ht;if(h||_ instanceof Promise)h=(h??Promise.resolve()).then(async()=>{if(await _,s.issues.length===S)return;if(!u)u=to(s,S)});else{if(s.issues.length===S)continue;if(!u)u=to(s,S)}}if(h)return h.then(()=>s);return s},i=(s,c,l)=>{if(to(s))return s.aborted=!0,s;let u=n(c,r,l);if(u instanceof Promise){if(l.async===!1)throw new ht;return u.then((h)=>e._zod.parse(h,l))}return e._zod.parse(u,l)};e._zod.run=(s,c)=>{if(c.skipChecks)return e._zod.parse(s,c);if(c.direction==="backward"){let u=e._zod.parse({value:s.value,issues:[]},{...c,skipChecks:!0});if(u instanceof Promise)return u.then((h)=>i(h,s,c));return i(u,s,c)}let l=e._zod.parse(s,c);if(l instanceof Promise){if(c.async===!1)throw new ht;return l.then((u)=>n(u,r,c))}return n(l,r,c)}}J(e,"~standard",()=>({validate:(n)=>{try{let i=jl(e,n);return i.success?{value:i.data}:{issues:i.error?.issues}}catch(i){return Ll(e,n).then((s)=>s.success?{value:s.data}:{issues:s.error?.issues})}},vendor:"zod",version:1}))}),Oi=g("$ZodString",(e,t)=>{K.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??gu(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}}),ee=g("$ZodStringFormat",(e,t)=>{Yr.init(e,t),Oi.init(e,t)}),Ju=g("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=tu),ee.init(e,t)}),Bu=g("$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=Va(r))}else t.pattern??(t.pattern=Va());ee.init(e,t)}),Wu=g("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=ou),ee.init(e,t)}),Gu=g("$ZodURL",(e,t)=>{ee.init(e,t),e._zod.check=(o)=>{try{let r=o.value.trim();if(!t.normalize&&t.protocol?.source===lu.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})}}}),Ku=g("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=ru()),ee.init(e,t)}),Yu=g("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=Xl),ee.init(e,t)}),Qu=g("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=Wl),ee.init(e,t)}),Xu=g("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=Gl),ee.init(e,t)}),ed=g("$ZodULID",(e,t)=>{t.pattern??(t.pattern=Kl),ee.init(e,t)}),td=g("$ZodXID",(e,t)=>{t.pattern??(t.pattern=Yl),ee.init(e,t)}),od=g("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=Ql),ee.init(e,t)}),rd=g("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=fu(t)),ee.init(e,t)}),nd=g("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=pu),ee.init(e,t)}),sd=g("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=mu(t)),ee.init(e,t)}),id=g("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=eu),ee.init(e,t)}),ad=g("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=nu),ee.init(e,t),e._zod.bag.format="ipv4"}),cd=g("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=su),ee.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 ld=g("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=iu),ee.init(e,t)}),ud=g("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=au),ee.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 s=Number(i);if(`${s}`!==i)throw Error();if(s<0||s>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 dd(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 pd=g("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=cu),ee.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=(o)=>{if(dd(o.value))return;o.issues.push({code:"invalid_format",format:"base64",input:o.value,inst:e,continue:!t.abort})}});function Pf(e){if(!Ha.test(e))return!1;let t=e.replace(/[-_]/g,(r)=>r==="-"?"+":"/"),o=t.padEnd(Math.ceil(t.length/4)*4,"=");return dd(o)}var hd=g("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=Ha),ee.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=(o)=>{if(Pf(o.value))return;o.issues.push({code:"invalid_format",format:"base64url",input:o.value,inst:e,continue:!t.abort})}}),md=g("$ZodE164",(e,t)=>{t.pattern??(t.pattern=uu),ee.init(e,t)});function Tf(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 fd=g("$ZodJWT",(e,t)=>{ee.init(e,t),e._zod.check=(o)=>{if(Tf(o.value,t.alg))return;o.issues.push({code:"invalid_format",format:"jwt",input:o.value,inst:e,continue:!t.abort})}});var Ka=g("$ZodNumber",(e,t)=>{K.init(e,t),e._zod.pattern=e._zod.bag.pattern??Fa,e._zod.parse=(o,r)=>{if(t.coerce)try{o.value=Number(o.value)}catch(s){}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}}),gd=g("$ZodNumberFormat",(e,t)=>{xu.init(e,t),Ka.init(e,t)}),Sd=g("$ZodBoolean",(e,t)=>{K.init(e,t),e._zod.pattern=_u,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 _d=g("$ZodUndefined",(e,t)=>{K.init(e,t),e._zod.pattern=yu,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}}),bd=g("$ZodNull",(e,t)=>{K.init(e,t),e._zod.pattern=bu,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}}),yd=g("$ZodAny",(e,t)=>{K.init(e,t),e._zod.parse=(o)=>o}),zd=g("$ZodUnknown",(e,t)=>{K.init(e,t),e._zod.parse=(o)=>o}),vd=g("$ZodNever",(e,t)=>{K.init(e,t),e._zod.parse=(o,r)=>(o.issues.push({expected:"never",code:"invalid_type",input:o.value,inst:e}),o)});function ju(e,t,o){if(e.issues.length)t.issues.push(...Ct(o,e.issues));t.value[o]=e.value}var Rd=g("$ZodArray",(e,t)=>{K.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 s=0;s<n.length;s++){let c=n[s],l=t.element._zod.run({value:c,issues:[]},r);if(l instanceof Promise)i.push(l.then((u)=>ju(u,o,s)));else ju(l,o,s)}if(i.length)return Promise.all(i).then(()=>o);return o}});function Ii(e,t,o,r,n,i){let s=o in r;if(e.issues.length){if(n&&i&&!s)return;t.issues.push(...Ct(o,e.issues))}if(!s&&!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(s)t.value[o]=void 0}else t.value[o]=e.value}function wd(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=Ol(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(o)}}function xd(e,t,o,r,n,i){let s=[],c=n.keySet,l=n.catchall._zod,u=l.def.type,h=l.optin==="optional",f=l.optout==="optional";for(let S in t){if(S==="__proto__")continue;if(c.has(S))continue;if(u==="never"){s.push(S);continue}let _=l.run({value:t[S],issues:[]},r);if(_ instanceof Promise)e.push(_.then((y)=>Ii(y,o,S,t,h,f)));else Ii(_,o,S,t,h,f)}if(s.length)o.issues.push({code:"unrecognized_keys",keys:s,input:t,inst:i});if(!e.length)return o;return Promise.all(e).then(()=>o)}var Ef=g("$ZodObject",(e,t)=>{if(K.init(e,t),!Object.getOwnPropertyDescriptor(t,"shape")?.get){let c=t.shape;Object.defineProperty(t,"shape",{get:()=>{let l={...c};return Object.defineProperty(t,"shape",{value:l}),l}})}let r=Br(()=>wd(t));J(e._zod,"propValues",()=>{let c=t.shape,l={};for(let u in c){let h=c[u]._zod;if(h.values){l[u]??(l[u]=new Set);for(let f of h.values)l[u].add(f)}}return l});let n=No,i=t.catchall,s;e._zod.parse=(c,l)=>{s??(s=r.value);let u=c.value;if(!n(u))return c.issues.push({expected:"object",code:"invalid_type",input:u,inst:e}),c;c.value={};let h=[],f=s.shape;for(let S of s.keys){let _=f[S],y=_._zod.optin==="optional",w=_._zod.optout==="optional",k=_._zod.run({value:u[S],issues:[]},l);if(k instanceof Promise)h.push(k.then((V)=>Ii(V,c,S,u,y,w)));else Ii(k,c,S,u,y,w)}if(!i)return h.length?Promise.all(h).then(()=>c):c;return xd(h,u,c,l,r.value,e)}}),Pd=g("$ZodObjectJIT",(e,t)=>{Ef.init(e,t);let o=e._zod.parse,r=Br(()=>wd(t)),n=(S)=>{let _=new Wa(["shape","payload","ctx"]),y=r.value,w=(q)=>{let F=qa(q);return`shape[${F}]._zod.run({ value: input[${F}], issues: [] }, ctx)`};_.write("const input = payload.value;");let k=Object.create(null),V=0;for(let q of y.keys)k[q]=`key_${V++}`;_.write("const newResult = {};");for(let q of y.keys){let F=k[q],Y=qa(q),G=S[q],ie=G?._zod?.optin==="optional",Ne=G?._zod?.optout==="optional";if(_.write(`const ${F} = ${w(q)};`),ie&&Ne)_.write(`
|
|
4
|
+
if (${F}.issues.length) {
|
|
5
|
+
if (${Y} in input) {
|
|
6
|
+
payload.issues = payload.issues.concat(${F}.issues.map(iss => ({
|
|
7
7
|
...iss,
|
|
8
|
-
path: iss.path ? [${
|
|
8
|
+
path: iss.path ? [${Y}, ...iss.path] : [${Y}]
|
|
9
9
|
})));
|
|
10
10
|
}
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
-
if (${
|
|
14
|
-
if (${
|
|
15
|
-
newResult[${
|
|
13
|
+
if (${F}.value === undefined) {
|
|
14
|
+
if (${Y} in input) {
|
|
15
|
+
newResult[${Y}] = undefined;
|
|
16
16
|
}
|
|
17
17
|
} else {
|
|
18
|
-
newResult[${
|
|
18
|
+
newResult[${Y}] = ${F}.value;
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
-
`);else if(!
|
|
22
|
-
const ${
|
|
23
|
-
if (${
|
|
24
|
-
payload.issues = payload.issues.concat(${
|
|
21
|
+
`);else if(!ie)_.write(`
|
|
22
|
+
const ${F}_present = ${Y} in input;
|
|
23
|
+
if (${F}.issues.length) {
|
|
24
|
+
payload.issues = payload.issues.concat(${F}.issues.map(iss => ({
|
|
25
25
|
...iss,
|
|
26
|
-
path: iss.path ? [${
|
|
26
|
+
path: iss.path ? [${Y}, ...iss.path] : [${Y}]
|
|
27
27
|
})));
|
|
28
28
|
}
|
|
29
|
-
if (!${
|
|
29
|
+
if (!${F}_present && !${F}.issues.length) {
|
|
30
30
|
payload.issues.push({
|
|
31
31
|
code: "invalid_type",
|
|
32
32
|
expected: "nonoptional",
|
|
33
33
|
input: undefined,
|
|
34
|
-
path: [${
|
|
34
|
+
path: [${Y}]
|
|
35
35
|
});
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
-
if (${
|
|
39
|
-
if (${
|
|
40
|
-
newResult[${
|
|
38
|
+
if (${F}_present) {
|
|
39
|
+
if (${F}.value === undefined) {
|
|
40
|
+
newResult[${Y}] = undefined;
|
|
41
41
|
} else {
|
|
42
|
-
newResult[${
|
|
42
|
+
newResult[${Y}] = ${F}.value;
|
|
43
43
|
}
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
-
`);else
|
|
47
|
-
if (${
|
|
48
|
-
payload.issues = payload.issues.concat(${
|
|
46
|
+
`);else _.write(`
|
|
47
|
+
if (${F}.issues.length) {
|
|
48
|
+
payload.issues = payload.issues.concat(${F}.issues.map(iss => ({
|
|
49
49
|
...iss,
|
|
50
|
-
path: iss.path ? [${
|
|
50
|
+
path: iss.path ? [${Y}, ...iss.path] : [${Y}]
|
|
51
51
|
})));
|
|
52
52
|
}
|
|
53
53
|
|
|
54
|
-
if (${
|
|
55
|
-
if (${
|
|
56
|
-
newResult[${
|
|
54
|
+
if (${F}.value === undefined) {
|
|
55
|
+
if (${Y} in input) {
|
|
56
|
+
newResult[${Y}] = undefined;
|
|
57
57
|
}
|
|
58
58
|
} else {
|
|
59
|
-
newResult[${
|
|
59
|
+
newResult[${Y}] = ${F}.value;
|
|
60
60
|
}
|
|
61
61
|
|
|
62
|
-
`)}b.write("payload.value = newResult;"),b.write("return payload;");let D=b.compile();return(M,q)=>D(_,M,q)},i,a=io,c=!so.jitless,d=c&&rl.value,f=t.catchall,S;e._zod.parse=(_,b)=>{S??(S=r.value);let P=_.value;if(!a(P))return _.issues.push({expected:"object",code:"invalid_type",input:P,inst:e}),_;if(c&&d&&b?.async===!1&&b.jitless!==!0){if(!i)i=n(t.shape);if(_=i(_,b),!f)return _;return Yu([],P,_,b,S,e)}return o(_,b)}});function du(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)=>!vt(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)=>be(a,r,ce())))}),t}var $a=m("$ZodUnion",(e,t)=>{A.init(e,t),N(e._zod,"optin",()=>t.options.some((r)=>r._zod.optin==="optional")?"optional":void 0),N(e._zod,"optout",()=>t.options.some((r)=>r._zod.optout==="optional")?"optional":void 0),N(e._zod,"values",()=>{if(t.options.every((r)=>r._zod.values))return new Set(t.options.flatMap((r)=>Array.from(r._zod.values)));return}),N(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)=>ui(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 c of t.options){let p=c._zod.run({value:r.value,issues:[]},n);if(p instanceof Promise)a.push(p),i=!0;else{if(p.issues.length===0)return p;a.push(p)}}if(!i)return du(a,r,e,n);return Promise.all(a).then((c)=>du(c,r,e,n))}});var Xu=m("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,$a.init(e,t);let o=e._zod.parse;N(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[c,p]of Object.entries(a)){if(!n[c])n[c]=new Set;for(let d of p)n[c].add(d)}}return n});let r=qr(()=>{let n=t.options,i=new Map;for(let a of n){let c=a._zod.propValues?.[t.discriminator];if(!c||c.size===0)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(a)}"`);for(let p of c){if(i.has(p))throw Error(`Duplicate discriminator value "${String(p)}"`);i.set(p,a)}}return i});e._zod.parse=(n,i)=>{let a=n.value;if(!io(a))return n.issues.push({code:"invalid_type",expected:"object",input:a,inst:e}),n;let c=r.value.get(a?.[t.discriminator]);if(c)return c._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}}),ed=m("$ZodIntersection",(e,t)=>{A.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(([p,d])=>pu(o,p,d));return pu(o,i,a)}});function ka(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(zt(e)&&zt(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=ka(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=ka(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 pu(e,t,o){let r=new Map,n;for(let c of t.issues)if(c.code==="unrecognized_keys"){n??(n=c);for(let p of c.keys){if(!r.has(p))r.set(p,{});r.get(p).l=!0}}else e.issues.push(c);for(let c of o.issues)if(c.code==="unrecognized_keys")for(let p of c.keys){if(!r.has(p))r.set(p,{});r.get(p).r=!0}else e.issues.push(c);let i=[...r].filter(([,c])=>c.l&&c.r).map(([c])=>c);if(i.length&&n)e.issues.push({...n,keys:i});if(vt(e))return e;let a=ka(t.value,o.value);if(!a.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(a.mergeErrorPath)}`);return e.value=a.data,e}var td=m("$ZodRecord",(e,t)=>{A.init(e,t),e._zod.parse=(o,r)=>{let n=o.value;if(!zt(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 c=new Set;for(let d of a)if(typeof d==="string"||typeof d==="number"||typeof d==="symbol"){c.add(typeof d==="number"?d.toString():d);let f=t.keyType._zod.run({value:d,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((b)=>be(b,r,ce())),input:d,path:[d],inst:e});continue}let S=f.value,_=t.valueType._zod.run({value:n[d],issues:[]},r);if(_ instanceof Promise)i.push(_.then((b)=>{if(b.issues.length)o.issues.push(...Ke(d,b.issues));o.value[S]=b.value}));else{if(_.issues.length)o.issues.push(...Ke(d,_.issues));o.value[S]=_.value}}let p;for(let d in n)if(!c.has(d))p=p??[],p.push(d);if(p&&p.length>0)o.issues.push({code:"unrecognized_keys",input:n,inst:e,keys:p})}else{o.value={};for(let c of Reflect.ownKeys(n)){if(c==="__proto__")continue;if(!Object.prototype.propertyIsEnumerable.call(n,c))continue;let p=t.keyType._zod.run({value:c,issues:[]},r);if(p instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(typeof c==="string"&&wa.test(c)&&p.issues.length){let S=t.keyType._zod.run({value:Number(c),issues:[]},r);if(S instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(S.issues.length===0)p=S}if(p.issues.length){if(t.mode==="loose")o.value[c]=n[c];else o.issues.push({code:"invalid_key",origin:"record",issues:p.issues.map((S)=>be(S,r,ce())),input:c,path:[c],inst:e});continue}let f=t.valueType._zod.run({value:n[c],issues:[]},r);if(f instanceof Promise)i.push(f.then((S)=>{if(S.issues.length)o.issues.push(...Ke(c,S.issues));o.value[p.value]=S.value}));else{if(f.issues.length)o.issues.push(...Ke(c,f.issues));o.value[p.value]=f.value}}}if(i.length)return Promise.all(i).then(()=>o);return o}});var od=m("$ZodEnum",(e,t)=>{A.init(e,t);let o=ci(t.entries),r=new Set(o);e._zod.values=r,e._zod.pattern=new RegExp(`^(${o.filter((n)=>nl.has(typeof n)).map((n)=>typeof n==="string"?Ge(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}}),rd=m("$ZodLiteral",(e,t)=>{if(A.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"?Ge(r):r?Ge(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 nd=m("$ZodTransform",(e,t)=>{A.init(e,t),e._zod.optin="optional",e._zod.parse=(o,r)=>{if(r.direction==="backward")throw new Nr(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 Oe;return o.value=n,o.fallback=!0,o}});function hu(e,t){if(t===void 0&&(e.issues.length||e.fallback))return{issues:[],value:void 0};return e}var Ca=m("$ZodOptional",(e,t)=>{A.init(e,t),e._zod.optin="optional",e._zod.optout="optional",N(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),N(e._zod,"pattern",()=>{let o=t.innerType._zod.pattern;return o?new RegExp(`^(${ui(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)=>hu(a,n));return hu(i,n)}if(o.value===void 0)return o;return t.innerType._zod.run(o,r)}}),sd=m("$ZodExactOptional",(e,t)=>{Ca.init(e,t),N(e._zod,"values",()=>t.innerType._zod.values),N(e._zod,"pattern",()=>t.innerType._zod.pattern),e._zod.parse=(o,r)=>t.innerType._zod.run(o,r)}),id=m("$ZodNullable",(e,t)=>{A.init(e,t),N(e._zod,"optin",()=>t.innerType._zod.optin),N(e._zod,"optout",()=>t.innerType._zod.optout),N(e._zod,"pattern",()=>{let o=t.innerType._zod.pattern;return o?new RegExp(`^(${ui(o.source)}|null)$`):void 0}),N(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)}}),ad=m("$ZodDefault",(e,t)=>{A.init(e,t),e._zod.optin="optional",N(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)=>mu(i,t));return mu(n,t)}});function mu(e,t){if(e.value===void 0)e.value=t.defaultValue;return e}var cd=m("$ZodPrefault",(e,t)=>{A.init(e,t),e._zod.optin="optional",N(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)}}),ld=m("$ZodNonOptional",(e,t)=>{A.init(e,t),N(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)=>fu(i,e));return fu(n,e)}});function fu(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 ud=m("$ZodCatch",(e,t)=>{A.init(e,t),e._zod.optin="optional",N(e._zod,"optout",()=>t.innerType._zod.optout),N(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)=>be(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)=>be(i,r,ce()))},input:o.value}),o.issues=[],o.fallback=!0;return o}});var Ia=m("$ZodPipe",(e,t)=>{A.init(e,t),N(e._zod,"values",()=>t.in._zod.values),N(e._zod,"optin",()=>t.in._zod.optin),N(e._zod,"optout",()=>t.out._zod.optout),N(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)=>fi(a,t.in,r));return fi(i,t.in,r)}let n=t.in._zod.run(o,r);if(n instanceof Promise)return n.then((i)=>fi(i,t.out,r));return fi(n,t.out,r)}});function fi(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 dd=m("$ZodPreprocess",(e,t)=>{Ia.init(e,t)}),pd=m("$ZodReadonly",(e,t)=>{A.init(e,t),N(e._zod,"propValues",()=>t.innerType._zod.propValues),N(e._zod,"values",()=>t.innerType._zod.values),N(e._zod,"optin",()=>t.innerType?._zod?.optin),N(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(gu);return gu(n)}});function gu(e){return e.value=Object.freeze(e.value),e}var hd=m("$ZodLazy",(e,t)=>{A.init(e,t),N(e._zod,"innerType",()=>{let o=t;if(!o._cachedInner)o._cachedInner=t.getter();return o._cachedInner}),N(e._zod,"pattern",()=>e._zod.innerType?._zod?.pattern),N(e._zod,"propValues",()=>e._zod.innerType?._zod?.propValues),N(e._zod,"optin",()=>e._zod.innerType?._zod?.optin??void 0),N(e._zod,"optout",()=>e._zod.innerType?._zod?.optout??void 0),e._zod.parse=(o,r)=>e._zod.innerType._zod.run(o,r)}),md=m("$ZodCustom",(e,t)=>{X.init(e,t),A.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)=>Su(i,o,r,e));Su(n,o,r,e);return}});function Su(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(Rt(n))}}var Im=()=>{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=cl(n.input),c=r[a]??a;return`Invalid input: expected ${i}, received ${c}`}case"invalid_value":if(n.values.length===1)return`Invalid input: expected ${_a(n.values[0])}`;return`Invalid option: expected one of ${ma(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":""}: ${ma(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 Oa(){return{localeError:Im()}}var fd,Om=Symbol("ZodOutput"),Nm=Symbol("ZodInput");class gd{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 Sd(){return new gd}(fd=globalThis).__zod_globalRegistry??(fd.__zod_globalRegistry=Sd());var Ye=globalThis.__zod_globalRegistry;function _d(e,t){return new e({type:"string",...w(t)})}function Na(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...w(t)})}function Ma(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...w(t)})}function bd(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...w(t)})}function yd(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...w(t)})}function zd(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...w(t)})}function vd(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...w(t)})}function qa(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...w(t)})}function Rd(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...w(t)})}function wd(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...w(t)})}function xd(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...w(t)})}function Pd(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...w(t)})}function Td(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...w(t)})}function kd(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...w(t)})}function Ed(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...w(t)})}function $d(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...w(t)})}function Cd(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...w(t)})}function Id(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...w(t)})}function Od(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...w(t)})}function Nd(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...w(t)})}function Md(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...w(t)})}function qd(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...w(t)})}function Ad(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...w(t)})}function jd(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...w(t)})}function Ld(e,t){return new e({type:"string",format:"date",check:"string_format",...w(t)})}function Ud(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...w(t)})}function Zd(e,t){return new e({type:"string",format:"duration",check:"string_format",...w(t)})}function Dd(e,t){return new e({type:"number",checks:[],...w(t)})}function Hd(e,t){return new e({type:"number",coerce:!0,checks:[],...w(t)})}function Vd(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...w(t)})}function Fd(e,t){return new e({type:"boolean",...w(t)})}function Jd(e,t){return new e({type:"undefined",...w(t)})}function Bd(e,t){return new e({type:"null",...w(t)})}function Wd(e){return new e({type:"any"})}function Gd(e){return new e({type:"unknown"})}function Kd(e,t){return new e({type:"never",...w(t)})}function _i(e,t){return new xa({check:"less_than",...w(t),value:e,inclusive:!1})}function Zr(e,t){return new xa({check:"less_than",...w(t),value:e,inclusive:!0})}function bi(e,t){return new Pa({check:"greater_than",...w(t),value:e,inclusive:!1})}function Dr(e,t){return new Pa({check:"greater_than",...w(t),value:e,inclusive:!0})}function yi(e,t){return new Kl({check:"multiple_of",...w(t),value:e})}function zi(e,t){return new Ql({check:"max_length",...w(t),maximum:e})}function ao(e,t){return new Xl({check:"min_length",...w(t),minimum:e})}function vi(e,t){return new eu({check:"length_equals",...w(t),length:e})}function Aa(e,t){return new tu({check:"string_format",format:"regex",...w(t),pattern:e})}function ja(e){return new ou({check:"string_format",format:"lowercase",...w(e)})}function La(e){return new ru({check:"string_format",format:"uppercase",...w(e)})}function Ua(e,t){return new nu({check:"string_format",format:"includes",...w(t),includes:e})}function Za(e,t){return new su({check:"string_format",format:"starts_with",...w(t),prefix:e})}function Da(e,t){return new iu({check:"string_format",format:"ends_with",...w(t),suffix:e})}function Qe(e){return new au({check:"overwrite",tx:e})}function Ha(e){return Qe((t)=>t.normalize(e))}function Va(){return Qe((e)=>e.trim())}function Fa(){return Qe((e)=>e.toLowerCase())}function Ja(){return Qe((e)=>e.toUpperCase())}function Ba(){return Qe((e)=>ol(e))}function Yd(e,t,o){return new e({type:"array",element:t,...w(o)})}function Qd(e,t,o){return new e({type:"custom",check:"custom",fn:t,...w(o)})}function Xd(e,t){let o=Mm((r)=>(r.addIssue=(n)=>{if(typeof n==="string")r.issues.push(Rt(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(Rt(i))}},e(r.value,r)),t);return o}function Mm(e,t){let o=new X({check:"custom",...w(t)});return o._zod.check=e,o}function Vr(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??Ye,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 c=e._zod.toJSONSchema?.();if(c)a.schema=c;else{let f={...o,schemaPath:[...o.schemaPath,e],path:o.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,a.schema,f);else{let _=a.schema,b=t.processors[n.type];if(!b)throw Error(`[toJSONSchema]: Non-representable type encountered: ${n.type}`);b(e,t,_,f)}let S=e._zod.parent;if(S){if(!a.ref)a.ref=S;j(S,t,f),t.seen.get(S).isParent=!0}}let p=t.metadataRegistry.get(e);if(p)Object.assign(a.schema,p);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 Fr(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 c=e.metadataRegistry.get(a[0])?.id;if(c){let p=r.get(c);if(p&&p!==a[0])throw Error(`Duplicate schema id "${c}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(c,a[0])}}let n=(a)=>{let c=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){let S=e.external.registry.get(a[0])?.id,_=e.external.uri??((P)=>P);if(S)return{ref:_(S)};let b=a[1].defId??a[1].schema.id??`schema${e.counter++}`;return a[1].defId=b,{defId:b,ref:`${_("__shared")}#/${c}/${b}`}}if(a[1]===o)return{ref:"#"};let d=`${"#"}/${c}/`,f=a[1].schema.id??`__schema${e.counter++}`;return{defId:f,ref:d+f}},i=(a)=>{if(a[1].schema.$ref)return;let c=a[1],{ref:p,defId:d}=n(a);if(c.def={...c.schema},d)c.defId=d;let f=c.schema;for(let S in f)delete f[S];f.$ref=p};if(e.cycles==="throw")for(let a of e.seen.entries()){let c=a[1];if(c.cycle)throw Error(`Cycle detected: #/${c.cycle?.join("/")}/<root>
|
|
62
|
+
`)}_.write("payload.value = newResult;"),_.write("return payload;");let B=_.compile();return(q,F)=>B(S,q,F)},i,s=No,c=!Oo.jitless,u=c&&Cl.value,h=t.catchall,f;e._zod.parse=(S,_)=>{f??(f=r.value);let y=S.value;if(!s(y))return S.issues.push({expected:"object",code:"invalid_type",input:y,inst:e}),S;if(c&&u&&_?.async===!1&&_.jitless!==!0){if(!i)i=n(t.shape);if(S=i(S,_),!h)return S;return xd([],y,S,_,f,e)}return o(S,_)}});function Lu(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)=>!to(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((s)=>Fe(s,r,ve())))}),t}var Ya=g("$ZodUnion",(e,t)=>{K.init(e,t),J(e._zod,"optin",()=>t.options.some((r)=>r._zod.optin==="optional")?"optional":void 0),J(e._zod,"optout",()=>t.options.some((r)=>r._zod.optout==="optional")?"optional":void 0),J(e._zod,"values",()=>{if(t.options.every((r)=>r._zod.values))return new Set(t.options.flatMap((r)=>Array.from(r._zod.values)));return}),J(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)=>Pi(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,s=[];for(let c of t.options){let l=c._zod.run({value:r.value,issues:[]},n);if(l instanceof Promise)s.push(l),i=!0;else{if(l.issues.length===0)return l;s.push(l)}}if(!i)return Lu(s,r,e,n);return Promise.all(s).then((c)=>Lu(c,r,e,n))}});var Td=g("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,Ya.init(e,t);let o=e._zod.parse;J(e._zod,"propValues",()=>{let n={};for(let i of t.options){let s=i._zod.propValues;if(!s||Object.keys(s).length===0)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(i)}"`);for(let[c,l]of Object.entries(s)){if(!n[c])n[c]=new Set;for(let u of l)n[c].add(u)}}return n});let r=Br(()=>{let n=t.options,i=new Map;for(let s of n){let c=s._zod.propValues?.[t.discriminator];if(!c||c.size===0)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(s)}"`);for(let l of c){if(i.has(l))throw Error(`Duplicate discriminator value "${String(l)}"`);i.set(l,s)}}return i});e._zod.parse=(n,i)=>{let s=n.value;if(!No(s))return n.issues.push({code:"invalid_type",expected:"object",input:s,inst:e}),n;let c=r.value.get(s?.[t.discriminator]);if(c)return c._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:s,path:[t.discriminator],inst:e}),n}}),Ed=g("$ZodIntersection",(e,t)=>{K.init(e,t),e._zod.parse=(o,r)=>{let n=o.value,i=t.left._zod.run({value:n,issues:[]},r),s=t.right._zod.run({value:n,issues:[]},r);if(i instanceof Promise||s instanceof Promise)return Promise.all([i,s]).then(([l,u])=>Uu(o,l,u));return Uu(o,i,s)}});function Ga(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(eo(e)&&eo(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 s=Ga(e[i],t[i]);if(!s.valid)return{valid:!1,mergeErrorPath:[i,...s.mergeErrorPath]};n[i]=s.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],s=Ga(n,i);if(!s.valid)return{valid:!1,mergeErrorPath:[r,...s.mergeErrorPath]};o.push(s.data)}return{valid:!0,data:o}}return{valid:!1,mergeErrorPath:[]}}function Uu(e,t,o){let r=new Map,n;for(let c of t.issues)if(c.code==="unrecognized_keys"){n??(n=c);for(let l of c.keys){if(!r.has(l))r.set(l,{});r.get(l).l=!0}}else e.issues.push(c);for(let c of o.issues)if(c.code==="unrecognized_keys")for(let l of c.keys){if(!r.has(l))r.set(l,{});r.get(l).r=!0}else e.issues.push(c);let i=[...r].filter(([,c])=>c.l&&c.r).map(([c])=>c);if(i.length&&n)e.issues.push({...n,keys:i});if(to(e))return e;let s=Ga(t.value,o.value);if(!s.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(s.mergeErrorPath)}`);return e.value=s.data,e}var kd=g("$ZodRecord",(e,t)=>{K.init(e,t),e._zod.parse=(o,r)=>{let n=o.value;if(!eo(n))return o.issues.push({expected:"record",code:"invalid_type",input:n,inst:e}),o;let i=[],s=t.keyType._zod.values;if(s){o.value={};let c=new Set;for(let u of s)if(typeof u==="string"||typeof u==="number"||typeof u==="symbol"){c.add(typeof u==="number"?u.toString():u);let h=t.keyType._zod.run({value:u,issues:[]},r);if(h instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(h.issues.length){o.issues.push({code:"invalid_key",origin:"record",issues:h.issues.map((_)=>Fe(_,r,ve())),input:u,path:[u],inst:e});continue}let f=h.value,S=t.valueType._zod.run({value:n[u],issues:[]},r);if(S instanceof Promise)i.push(S.then((_)=>{if(_.issues.length)o.issues.push(...Ct(u,_.issues));o.value[f]=_.value}));else{if(S.issues.length)o.issues.push(...Ct(u,S.issues));o.value[f]=S.value}}let l;for(let u in n)if(!c.has(u))l=l??[],l.push(u);if(l&&l.length>0)o.issues.push({code:"unrecognized_keys",input:n,inst:e,keys:l})}else{o.value={};for(let c of Reflect.ownKeys(n)){if(c==="__proto__")continue;if(!Object.prototype.propertyIsEnumerable.call(n,c))continue;let l=t.keyType._zod.run({value:c,issues:[]},r);if(l instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(typeof c==="string"&&Fa.test(c)&&l.issues.length){let f=t.keyType._zod.run({value:Number(c),issues:[]},r);if(f instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(f.issues.length===0)l=f}if(l.issues.length){if(t.mode==="loose")o.value[c]=n[c];else o.issues.push({code:"invalid_key",origin:"record",issues:l.issues.map((f)=>Fe(f,r,ve())),input:c,path:[c],inst:e});continue}let h=t.valueType._zod.run({value:n[c],issues:[]},r);if(h instanceof Promise)i.push(h.then((f)=>{if(f.issues.length)o.issues.push(...Ct(c,f.issues));o.value[l.value]=f.value}));else{if(h.issues.length)o.issues.push(...Ct(c,h.issues));o.value[l.value]=h.value}}}if(i.length)return Promise.all(i).then(()=>o);return o}});var $d=g("$ZodEnum",(e,t)=>{K.init(e,t);let o=wi(t.entries),r=new Set(o);e._zod.values=r,e._zod.pattern=new RegExp(`^(${o.filter((n)=>Il.has(typeof n)).map((n)=>typeof n==="string"?$t(n):n.toString()).join("|")})$`),e._zod.parse=(n,i)=>{let s=n.value;if(r.has(s))return n;return n.issues.push({code:"invalid_value",values:o,input:s,inst:e}),n}}),Cd=g("$ZodLiteral",(e,t)=>{if(K.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"?$t(r):r?$t(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 Id=g("$ZodTransform",(e,t)=>{K.init(e,t),e._zod.optin="optional",e._zod.parse=(o,r)=>{if(r.direction==="backward")throw new Fr(e.constructor.name);let n=t.transform(o.value,o);if(r.async)return(n instanceof Promise?n:Promise.resolve(n)).then((s)=>(o.value=s,o.fallback=!0,o));if(n instanceof Promise)throw new ht;return o.value=n,o.fallback=!0,o}});function Zu(e,t){if(t===void 0&&(e.issues.length||e.fallback))return{issues:[],value:void 0};return e}var Qa=g("$ZodOptional",(e,t)=>{K.init(e,t),e._zod.optin="optional",e._zod.optout="optional",J(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),J(e._zod,"pattern",()=>{let o=t.innerType._zod.pattern;return o?new RegExp(`^(${Pi(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((s)=>Zu(s,n));return Zu(i,n)}if(o.value===void 0)return o;return t.innerType._zod.run(o,r)}}),Od=g("$ZodExactOptional",(e,t)=>{Qa.init(e,t),J(e._zod,"values",()=>t.innerType._zod.values),J(e._zod,"pattern",()=>t.innerType._zod.pattern),e._zod.parse=(o,r)=>t.innerType._zod.run(o,r)}),Nd=g("$ZodNullable",(e,t)=>{K.init(e,t),J(e._zod,"optin",()=>t.innerType._zod.optin),J(e._zod,"optout",()=>t.innerType._zod.optout),J(e._zod,"pattern",()=>{let o=t.innerType._zod.pattern;return o?new RegExp(`^(${Pi(o.source)}|null)$`):void 0}),J(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)}}),Md=g("$ZodDefault",(e,t)=>{K.init(e,t),e._zod.optin="optional",J(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)=>Du(i,t));return Du(n,t)}});function Du(e,t){if(e.value===void 0)e.value=t.defaultValue;return e}var qd=g("$ZodPrefault",(e,t)=>{K.init(e,t),e._zod.optin="optional",J(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)}}),Ad=g("$ZodNonOptional",(e,t)=>{K.init(e,t),J(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)=>Vu(i,e));return Vu(n,e)}});function Vu(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 jd=g("$ZodCatch",(e,t)=>{K.init(e,t),e._zod.optin="optional",J(e._zod,"optout",()=>t.innerType._zod.optout),J(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((s)=>Fe(s,r,ve()))},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)=>Fe(i,r,ve()))},input:o.value}),o.issues=[],o.fallback=!0;return o}});var Xa=g("$ZodPipe",(e,t)=>{K.init(e,t),J(e._zod,"values",()=>t.in._zod.values),J(e._zod,"optin",()=>t.in._zod.optin),J(e._zod,"optout",()=>t.out._zod.optout),J(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((s)=>Ci(s,t.in,r));return Ci(i,t.in,r)}let n=t.in._zod.run(o,r);if(n instanceof Promise)return n.then((i)=>Ci(i,t.out,r));return Ci(n,t.out,r)}});function Ci(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 Ld=g("$ZodPreprocess",(e,t)=>{Xa.init(e,t)}),Ud=g("$ZodReadonly",(e,t)=>{K.init(e,t),J(e._zod,"propValues",()=>t.innerType._zod.propValues),J(e._zod,"values",()=>t.innerType._zod.values),J(e._zod,"optin",()=>t.innerType?._zod?.optin),J(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(Hu);return Hu(n)}});function Hu(e){return e.value=Object.freeze(e.value),e}var Zd=g("$ZodLazy",(e,t)=>{K.init(e,t),J(e._zod,"innerType",()=>{let o=t;if(!o._cachedInner)o._cachedInner=t.getter();return o._cachedInner}),J(e._zod,"pattern",()=>e._zod.innerType?._zod?.pattern),J(e._zod,"propValues",()=>e._zod.innerType?._zod?.propValues),J(e._zod,"optin",()=>e._zod.innerType?._zod?.optin??void 0),J(e._zod,"optout",()=>e._zod.innerType?._zod?.optout??void 0),e._zod.parse=(o,r)=>e._zod.innerType._zod.run(o,r)}),Dd=g("$ZodCustom",(e,t)=>{pe.init(e,t),K.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)=>Fu(i,o,r,e));Fu(n,o,r,e);return}});function Fu(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(oo(n))}}var kf=()=>{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,s=ql(n.input),c=r[s]??s;return`Invalid input: expected ${i}, received ${c}`}case"invalid_value":if(n.values.length===1)return`Invalid input: expected ${La(n.values[0])}`;return`Invalid option: expected one of ${Ma(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);if(s)return`Too big: expected ${n.origin??"value"} to have ${i}${n.maximum.toString()} ${s.unit??"elements"}`;return`Too big: expected ${n.origin??"value"} to be ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);if(s)return`Too small: expected ${n.origin} to have ${i}${n.minimum.toString()} ${s.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":""}: ${Ma(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((s)=>`'${s}'`).join(" | ")}`;return"Invalid input";case"invalid_element":return`Invalid value in ${n.origin}`;default:return"Invalid input"}}};function ec(){return{localeError:kf()}}var Vd,$f=Symbol("ZodOutput"),Cf=Symbol("ZodInput");class Hd{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 Fd(){return new Hd}(Vd=globalThis).__zod_globalRegistry??(Vd.__zod_globalRegistry=Fd());var It=globalThis.__zod_globalRegistry;function Jd(e,t){return new e({type:"string",...O(t)})}function tc(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...O(t)})}function oc(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...O(t)})}function Bd(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...O(t)})}function Wd(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...O(t)})}function Gd(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...O(t)})}function Kd(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...O(t)})}function rc(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...O(t)})}function Yd(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...O(t)})}function Qd(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...O(t)})}function Xd(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...O(t)})}function ep(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...O(t)})}function tp(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...O(t)})}function op(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...O(t)})}function rp(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...O(t)})}function np(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...O(t)})}function sp(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...O(t)})}function ip(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...O(t)})}function ap(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...O(t)})}function cp(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...O(t)})}function lp(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...O(t)})}function up(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...O(t)})}function dp(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...O(t)})}function pp(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...O(t)})}function hp(e,t){return new e({type:"string",format:"date",check:"string_format",...O(t)})}function mp(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...O(t)})}function fp(e,t){return new e({type:"string",format:"duration",check:"string_format",...O(t)})}function gp(e,t){return new e({type:"number",checks:[],...O(t)})}function Sp(e,t){return new e({type:"number",coerce:!0,checks:[],...O(t)})}function _p(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...O(t)})}function bp(e,t){return new e({type:"boolean",...O(t)})}function yp(e,t){return new e({type:"undefined",...O(t)})}function zp(e,t){return new e({type:"null",...O(t)})}function vp(e){return new e({type:"any"})}function Rp(e){return new e({type:"unknown"})}function wp(e,t){return new e({type:"never",...O(t)})}function Ni(e,t){return new Ja({check:"less_than",...O(t),value:e,inclusive:!1})}function Qr(e,t){return new Ja({check:"less_than",...O(t),value:e,inclusive:!0})}function Mi(e,t){return new Ba({check:"greater_than",...O(t),value:e,inclusive:!1})}function Xr(e,t){return new Ba({check:"greater_than",...O(t),value:e,inclusive:!0})}function qi(e,t){return new wu({check:"multiple_of",...O(t),value:e})}function Ai(e,t){return new Pu({check:"max_length",...O(t),maximum:e})}function Mo(e,t){return new Tu({check:"min_length",...O(t),minimum:e})}function ji(e,t){return new Eu({check:"length_equals",...O(t),length:e})}function nc(e,t){return new ku({check:"string_format",format:"regex",...O(t),pattern:e})}function sc(e){return new $u({check:"string_format",format:"lowercase",...O(e)})}function ic(e){return new Cu({check:"string_format",format:"uppercase",...O(e)})}function ac(e,t){return new Iu({check:"string_format",format:"includes",...O(t),includes:e})}function cc(e,t){return new Ou({check:"string_format",format:"starts_with",...O(t),prefix:e})}function lc(e,t){return new Nu({check:"string_format",format:"ends_with",...O(t),suffix:e})}function Ot(e){return new Mu({check:"overwrite",tx:e})}function uc(e){return Ot((t)=>t.normalize(e))}function dc(){return Ot((e)=>e.trim())}function pc(){return Ot((e)=>e.toLowerCase())}function hc(){return Ot((e)=>e.toUpperCase())}function mc(){return Ot((e)=>$l(e))}function xp(e,t,o){return new e({type:"array",element:t,...O(o)})}function Pp(e,t,o){return new e({type:"custom",check:"custom",fn:t,...O(o)})}function Tp(e,t){let o=If((r)=>(r.addIssue=(n)=>{if(typeof n==="string")r.issues.push(oo(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(oo(i))}},e(r.value,r)),t);return o}function If(e,t){let o=new pe({check:"custom",...O(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??It,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 Q(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 s={schema:{},count:1,cycle:void 0,path:o.path};t.seen.set(e,s);let c=e._zod.toJSONSchema?.();if(c)s.schema=c;else{let h={...o,schemaPath:[...o.schemaPath,e],path:o.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,s.schema,h);else{let S=s.schema,_=t.processors[n.type];if(!_)throw Error(`[toJSONSchema]: Non-representable type encountered: ${n.type}`);_(e,t,S,h)}let f=e._zod.parent;if(f){if(!s.ref)s.ref=f;Q(f,t,h),t.seen.get(f).isParent=!0}}let l=t.metadataRegistry.get(e);if(l)Object.assign(s.schema,l);if(t.io==="input"&&Re(e))delete s.schema.examples,delete s.schema.default;if(t.io==="input"&&"_prefault"in s.schema)(r=s.schema).default??(r.default=s.schema._prefault);return delete s.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 s of e.seen.entries()){let c=e.metadataRegistry.get(s[0])?.id;if(c){let l=r.get(c);if(l&&l!==s[0])throw Error(`Duplicate schema id "${c}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(c,s[0])}}let n=(s)=>{let c=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){let f=e.external.registry.get(s[0])?.id,S=e.external.uri??((y)=>y);if(f)return{ref:S(f)};let _=s[1].defId??s[1].schema.id??`schema${e.counter++}`;return s[1].defId=_,{defId:_,ref:`${S("__shared")}#/${c}/${_}`}}if(s[1]===o)return{ref:"#"};let u=`${"#"}/${c}/`,h=s[1].schema.id??`__schema${e.counter++}`;return{defId:h,ref:u+h}},i=(s)=>{if(s[1].schema.$ref)return;let c=s[1],{ref:l,defId:u}=n(s);if(c.def={...c.schema},u)c.defId=u;let h=c.schema;for(let f in h)delete h[f];h.$ref=l};if(e.cycles==="throw")for(let s of e.seen.entries()){let c=s[1];if(c.cycle)throw Error(`Cycle detected: #/${c.cycle?.join("/")}/<root>
|
|
63
63
|
|
|
64
|
-
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let a of e.seen.entries()){let c=a[1];if(t===a[0]){i(a);continue}if(e.external){let d=e.external.registry.get(a[0])?.id;if(t!==a[0]&&d){i(a);continue}}if(e.metadataRegistry.get(a[0])?.id){i(a);continue}if(c.cycle){i(a);continue}if(c.count>1){if(e.reused==="ref"){i(a);continue}}}}function Jr(e,t){let o=e.seen.get(t);if(!o)throw Error("Unprocessed schema. This is a bug in Zod.");let r=(c)=>{let p=e.seen.get(c);if(p.ref===null)return;let d=p.def??p.schema,f={...d},S=p.ref;if(p.ref=null,S){r(S);let b=e.seen.get(S),P=b.schema;if(P.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0"))d.allOf=d.allOf??[],d.allOf.push(P);else Object.assign(d,P);if(Object.assign(d,f),c._zod.parent===S)for(let E in d){if(E==="$ref"||E==="allOf")continue;if(!(E in f))delete d[E]}if(P.$ref&&b.def)for(let E in d){if(E==="$ref"||E==="allOf")continue;if(E in b.def&&JSON.stringify(d[E])===JSON.stringify(b.def[E]))delete d[E]}}let _=c._zod.parent;if(_&&_!==S){r(_);let b=e.seen.get(_);if(b?.schema.$ref){if(d.$ref=b.schema.$ref,b.def)for(let P in d){if(P==="$ref"||P==="allOf")continue;if(P in b.def&&JSON.stringify(d[P])===JSON.stringify(b.def[P]))delete d[P]}}}e.override({zodSchema:c,jsonSchema:d,path:p.path??[]})};for(let c of[...e.seen.entries()].reverse())r(c[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 c=e.external.registry.get(t)?.id;if(!c)throw Error("Schema is missing an `id` property");n.$id=e.external.uri(c)}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 c of e.seen.entries()){let p=c[1];if(p.def&&p.defId){if(p.def.id===p.defId)delete p.def.id;a[p.defId]=p.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 c=JSON.parse(JSON.stringify(n));return Object.defineProperty(c,"~standard",{value:{...t["~standard"],jsonSchema:{input:Hr(t,"input",e.processors),output:Hr(t,"output",e.processors)}},enumerable:!1,writable:!1}),c}catch(c){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 ep=(e,t={})=>(o)=>{let r=Vr({...o,processors:t});return j(e,r),Fr(r,e),Jr(r,e)},Hr=(e,t,o={})=>(r)=>{let{libraryOptions:n,target:i}=r??{},a=Vr({...n??{},target:i,io:t,processors:o});return j(e,a),Fr(a,e),Jr(a,e)};var qm={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},Wa=(e,t,o,r)=>{let n=o;n.type="string";let{minimum:i,maximum:a,format:c,patterns:p,contentEncoding:d}=e._zod.bag;if(typeof i==="number")n.minLength=i;if(typeof a==="number")n.maxLength=a;if(c){if(n.format=qm[c]??c,n.format==="")delete n.format;if(c==="time")delete n.format}if(d)n.contentEncoding=d;if(p&&p.size>0){let f=[...p];if(f.length===1)n.pattern=f[0].source;else if(f.length>1)n.allOf=[...f.map((S)=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:S.source}))]}},Ga=(e,t,o,r)=>{let n=o,{minimum:i,maximum:a,format:c,multipleOf:p,exclusiveMaximum:d,exclusiveMinimum:f}=e._zod.bag;if(typeof c==="string"&&c.includes("int"))n.type="integer";else n.type="number";let S=typeof f==="number"&&f>=(i??Number.NEGATIVE_INFINITY),_=typeof d==="number"&&d<=(a??Number.POSITIVE_INFINITY),b=t.target==="draft-04"||t.target==="openapi-3.0";if(S)if(b)n.minimum=f,n.exclusiveMinimum=!0;else n.exclusiveMinimum=f;else if(typeof i==="number")n.minimum=i;if(_)if(b)n.maximum=d,n.exclusiveMaximum=!0;else n.exclusiveMaximum=d;else if(typeof a==="number")n.maximum=a;if(typeof p==="number")n.multipleOf=p},Ka=(e,t,o,r)=>{o.type="boolean"},op=(e,t,o,r)=>{if(t.unrepresentable==="throw")throw Error("BigInt cannot be represented in JSON Schema")},rp=(e,t,o,r)=>{if(t.unrepresentable==="throw")throw Error("Symbols cannot be represented in JSON Schema")},Ya=(e,t,o,r)=>{if(t.target==="openapi-3.0")o.type="string",o.nullable=!0,o.enum=[null];else o.type="null"},Qa=(e,t,o,r)=>{if(t.unrepresentable==="throw")throw Error("Undefined cannot be represented in JSON Schema")},np=(e,t,o,r)=>{if(t.unrepresentable==="throw")throw Error("Void cannot be represented in JSON Schema")},Xa=(e,t,o,r)=>{o.not={}},ec=(e,t,o,r)=>{},tc=(e,t,o,r)=>{},sp=(e,t,o,r)=>{if(t.unrepresentable==="throw")throw Error("Date cannot be represented in JSON Schema")},oc=(e,t,o,r)=>{let n=e._zod.def,i=ci(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},rc=(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}},ip=(e,t,o,r)=>{if(t.unrepresentable==="throw")throw Error("NaN cannot be represented in JSON Schema")},ap=(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},cp=(e,t,o,r)=>{let n=o,i={type:"string",format:"binary",contentEncoding:"binary"},{minimum:a,maximum:c,mime:p}=e._zod.bag;if(a!==void 0)i.minLength=a;if(c!==void 0)i.maxLength=c;if(p)if(p.length===1)i.contentMediaType=p[0],Object.assign(n,i);else Object.assign(n,i),n.anyOf=p.map((d)=>({contentMediaType:d}));else Object.assign(n,i)},lp=(e,t,o,r)=>{o.type="boolean"},nc=(e,t,o,r)=>{if(t.unrepresentable==="throw")throw Error("Custom types cannot be represented in JSON Schema")},up=(e,t,o,r)=>{if(t.unrepresentable==="throw")throw Error("Function types cannot be represented in JSON Schema")},sc=(e,t,o,r)=>{if(t.unrepresentable==="throw")throw Error("Transforms cannot be represented in JSON Schema")},dp=(e,t,o,r)=>{if(t.unrepresentable==="throw")throw Error("Map cannot be represented in JSON Schema")},pp=(e,t,o,r)=>{if(t.unrepresentable==="throw")throw Error("Set cannot be represented in JSON Schema")},ic=(e,t,o,r)=>{let n=o,i=e._zod.def,{minimum:a,maximum:c}=e._zod.bag;if(typeof a==="number")n.minItems=a;if(typeof c==="number")n.maxItems=c;n.type="array",n.items=j(i.element,t,{...r,path:[...r.path,"items"]})},ac=(e,t,o,r)=>{let n=o,i=e._zod.def;n.type="object",n.properties={};let a=i.shape;for(let d in a)n.properties[d]=j(a[d],t,{...r,path:[...r.path,"properties",d]});let c=new Set(Object.keys(a)),p=new Set([...c].filter((d)=>{let f=i.shape[d]._zod;if(t.io==="input")return f.optin===void 0;else return f.optout===void 0}));if(p.size>0)n.required=Array.from(p);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"]})},cc=(e,t,o,r)=>{let n=e._zod.def,i=n.inclusive===!1,a=n.options.map((c,p)=>j(c,t,{...r,path:[...r.path,i?"oneOf":"anyOf",p]}));if(i)o.oneOf=a;else o.anyOf=a},lc=(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]}),c=(d)=>("allOf"in d)&&Object.keys(d).length===1,p=[...c(i)?i.allOf:[i],...c(a)?a.allOf:[a]];o.allOf=p},hp=(e,t,o,r)=>{let n=o,i=e._zod.def;n.type="array";let a=t.target==="draft-2020-12"?"prefixItems":"items",c=t.target==="draft-2020-12"?"items":t.target==="openapi-3.0"?"items":"additionalItems",p=i.items.map((_,b)=>j(_,t,{...r,path:[...r.path,a,b]})),d=i.rest?j(i.rest,t,{...r,path:[...r.path,c,...t.target==="openapi-3.0"?[i.items.length]:[]]}):null;if(t.target==="draft-2020-12"){if(n.prefixItems=p,d)n.items=d}else if(t.target==="openapi-3.0"){if(n.items={anyOf:p},d)n.items.anyOf.push(d);if(n.minItems=p.length,!d)n.maxItems=p.length}else if(n.items=p,d)n.additionalItems=d;let{minimum:f,maximum:S}=e._zod.bag;if(typeof f==="number")n.minItems=f;if(typeof S==="number")n.maxItems=S},uc=(e,t,o,r)=>{let n=o,i=e._zod.def;n.type="object";let a=i.keyType,p=a._zod.bag?.patterns;if(i.mode==="loose"&&p&&p.size>0){let f=j(i.valueType,t,{...r,path:[...r.path,"patternProperties","*"]});n.patternProperties={};for(let S of p)n.patternProperties[S.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 d=a._zod.values;if(d){let f=[...d].filter((S)=>typeof S==="string"||typeof S==="number");if(f.length>0)n.required=f}},dc=(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"}]},pc=(e,t,o,r)=>{let n=e._zod.def;j(n.innerType,t,r);let i=t.seen.get(e);i.ref=n.innerType},hc=(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))},mc=(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))},fc=(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},gc=(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 c=t.seen.get(e);c.ref=a},Sc=(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},mp=(e,t,o,r)=>{let n=e._zod.def;j(n.innerType,t,r);let i=t.seen.get(e);i.ref=n.innerType},Ri=(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.innerType;j(n,t,r);let i=t.seen.get(e);i.ref=n},tp={string:Wa,number:Ga,boolean:Ka,bigint:op,symbol:rp,null:Ya,undefined:Qa,void:np,never:Xa,any:ec,unknown:tc,date:sp,enum:oc,literal:rc,nan:ip,template_literal:ap,file:cp,success:lp,custom:nc,function:up,transform:sc,map:dp,set:pp,array:ic,object:ac,union:cc,intersection:lc,tuple:hp,record:uc,nullable:dc,nonoptional:pc,default:hc,prefault:mc,catch:fc,pipe:gc,readonly:Sc,promise:mp,optional:Ri,lazy:_c};function wi(e,t){if("_idmap"in e){let r=e,n=Vr({...t,processors:tp}),i={};for(let p of r._idmap.entries()){let[d,f]=p;j(f,n)}let a={},c={registry:r,uri:t?.uri,defs:i};n.external=c;for(let p of r._idmap.entries()){let[d,f]=p;Fr(n,f),a[d]=Jr(n,f)}if(Object.keys(i).length>0){let p=n.target==="draft-2020-12"?"$defs":"definitions";a.__shared={[p]:i}}return{schemas:a}}let o=Vr({...t,processors:tp});return j(e,o),Fr(o,e),Jr(o,e)}var Vm=m("ZodISODateTime",(e,t)=>{Eu.init(e,t),V.init(e,t)});function lo(e){return jd(Vm,e)}var Fm=m("ZodISODate",(e,t)=>{$u.init(e,t),V.init(e,t)});function bc(e){return Ld(Fm,e)}var Jm=m("ZodISOTime",(e,t)=>{Cu.init(e,t),V.init(e,t)});function fp(e){return Ud(Jm,e)}var Bm=m("ZodISODuration",(e,t)=>{Iu.init(e,t),V.init(e,t)});function gp(e){return Zd(Bm,e)}var Wm=(e,t)=>{pi.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:(o)=>za(e,o)},flatten:{value:(o)=>ya(e,o)},addIssue:{value:(o)=>{e.issues.push(o),e.message=JSON.stringify(e.issues,Mr,2)}},addIssues:{value:(o)=>{e.issues.push(...o),e.message=JSON.stringify(e.issues,Mr,2)}},isEmpty:{get(){return e.issues.length===0}}})};var he=m("ZodError",Wm,{Parent:Error});var _p=hi(he),bp=mi(he),Pi=Ar(he),yp=jr(he),zp=pl(he),vp=hl(he),Rp=ml(he),wp=fl(he),xp=gl(he),Pp=Sl(he),Tp=_l(he),kp=bl(he);var Ep=new WeakMap;function Br(e,t,o){let r=Object.getPrototypeOf(e),n=Ep.get(r);if(!n)n=new Set,Ep.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 c=a.bind(this);return Object.defineProperty(this,i,{configurable:!0,writable:!0,enumerable:!0,value:c}),c},set(c){Object.defineProperty(this,i,{configurable:!0,writable:!0,enumerable:!0,value:c})}})}}var L=m("ZodType",(e,t)=>(A.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:Hr(e,"input"),output:Hr(e,"output")}}),e.toJSONSchema=ep(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.parse=(o,r)=>_p(e,o,r,{callee:e.parse}),e.safeParse=(o,r)=>Pi(e,o,r),e.parseAsync=async(o,r)=>bp(e,o,r,{callee:e.parseAsync}),e.safeParseAsync=async(o,r)=>yp(e,o,r),e.spa=e.safeParseAsync,e.encode=(o,r)=>zp(e,o,r),e.decode=(o,r)=>vp(e,o,r),e.encodeAsync=async(o,r)=>Rp(e,o,r),e.decodeAsync=async(o,r)=>wp(e,o,r),e.safeEncode=(o,r)=>xp(e,o,r),e.safeDecode=(o,r)=>Pp(e,o,r),e.safeEncodeAsync=async(o,r)=>Tp(e,o,r),e.safeDecodeAsync=async(o,r)=>kp(e,o,r),Br(e,"ZodType",{check(...o){let r=this.def;return this.clone(We(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 _e(this,o,r)},brand(){return this},register(o,r){return o.add(this,r),this},refine(o,r){return this.check(jf(o,r))},superRefine(o,r){return this.check(Lf(o,r))},overwrite(o){return this.check(Qe(o))},optional(){return x(this)},exactOptional(){return wf(this)},nullable(){return Op(this)},nullish(){return x(Op(this))},nonoptional(o){return $f(this,o)},array(){return h(this)},or(o){return z([this,o])},and(o){return Ne(this,o)},transform(o){return Np(this,Hp(o))},default(o){return Tf(this,o)},prefault(o){return Ef(this,o)},catch(o){return If(this,o)},pipe(o){return Np(this,o)},readonly(){return Mf(this)},describe(o){let r=this.clone();return Ye.add(r,{description:o}),r},meta(...o){if(o.length===0)return Ye.get(this);let r=this.clone();return Ye.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 Ye.get(e)?.description},configurable:!0}),e)),Mp=m("_ZodString",(e,t)=>{Si.init(e,t),L.init(e,t),e._zod.processJSONSchema=(r,n,i)=>Wa(e,r,n,i);let o=e._zod.bag;e.format=o.format??null,e.minLength=o.minimum??null,e.maxLength=o.maximum??null,Br(e,"_ZodString",{regex(...r){return this.check(Aa(...r))},includes(...r){return this.check(Ua(...r))},startsWith(...r){return this.check(Za(...r))},endsWith(...r){return this.check(Da(...r))},min(...r){return this.check(ao(...r))},max(...r){return this.check(zi(...r))},length(...r){return this.check(vi(...r))},nonempty(...r){return this.check(ao(1,...r))},lowercase(r){return this.check(ja(r))},uppercase(r){return this.check(La(r))},trim(){return this.check(Va())},normalize(...r){return this.check(Ha(...r))},toLowerCase(){return this.check(Fa())},toUpperCase(){return this.check(Ja())},slugify(){return this.check(Ba())}})}),qp=m("ZodString",(e,t)=>{Si.init(e,t),Mp.init(e,t),e.email=(o)=>e.check(Na(Ap,o)),e.url=(o)=>e.check(qa(Lp,o)),e.jwt=(o)=>e.check(Ad(df,o)),e.emoji=(o)=>e.check(Rd(Km,o)),e.guid=(o)=>e.check(Ma($p,o)),e.uuid=(o)=>e.check(bd(Ti,o)),e.uuidv4=(o)=>e.check(yd(Ti,o)),e.uuidv6=(o)=>e.check(zd(Ti,o)),e.uuidv7=(o)=>e.check(vd(Ti,o)),e.nanoid=(o)=>e.check(wd(Ym,o)),e.guid=(o)=>e.check(Ma($p,o)),e.cuid=(o)=>e.check(xd(Qm,o)),e.cuid2=(o)=>e.check(Pd(Xm,o)),e.ulid=(o)=>e.check(Td(ef,o)),e.base64=(o)=>e.check(Nd(cf,o)),e.base64url=(o)=>e.check(Md(lf,o)),e.xid=(o)=>e.check(kd(tf,o)),e.ksuid=(o)=>e.check(Ed(of,o)),e.ipv4=(o)=>e.check($d(rf,o)),e.ipv6=(o)=>e.check(Cd(nf,o)),e.cidrv4=(o)=>e.check(Id(sf,o)),e.cidrv6=(o)=>e.check(Od(af,o)),e.e164=(o)=>e.check(qd(uf,o)),e.datetime=(o)=>e.check(lo(o)),e.date=(o)=>e.check(bc(o)),e.time=(o)=>e.check(fp(o)),e.duration=(o)=>e.check(gp(o))});function s(e){return _d(qp,e)}var V=m("ZodStringFormat",(e,t)=>{Z.init(e,t),Mp.init(e,t)}),Ap=m("ZodEmail",(e,t)=>{yu.init(e,t),V.init(e,t)});function jp(e){return Na(Ap,e)}var $p=m("ZodGUID",(e,t)=>{_u.init(e,t),V.init(e,t)});var Ti=m("ZodUUID",(e,t)=>{bu.init(e,t),V.init(e,t)});var Lp=m("ZodURL",(e,t)=>{zu.init(e,t),V.init(e,t)});function ki(e){return qa(Lp,e)}var Km=m("ZodEmoji",(e,t)=>{vu.init(e,t),V.init(e,t)});var Ym=m("ZodNanoID",(e,t)=>{Ru.init(e,t),V.init(e,t)});var Qm=m("ZodCUID",(e,t)=>{wu.init(e,t),V.init(e,t)});var Xm=m("ZodCUID2",(e,t)=>{xu.init(e,t),V.init(e,t)});var ef=m("ZodULID",(e,t)=>{Pu.init(e,t),V.init(e,t)});var tf=m("ZodXID",(e,t)=>{Tu.init(e,t),V.init(e,t)});var of=m("ZodKSUID",(e,t)=>{ku.init(e,t),V.init(e,t)});var rf=m("ZodIPv4",(e,t)=>{Ou.init(e,t),V.init(e,t)});var nf=m("ZodIPv6",(e,t)=>{Nu.init(e,t),V.init(e,t)});var sf=m("ZodCIDRv4",(e,t)=>{Mu.init(e,t),V.init(e,t)});var af=m("ZodCIDRv6",(e,t)=>{qu.init(e,t),V.init(e,t)});var cf=m("ZodBase64",(e,t)=>{ju.init(e,t),V.init(e,t)});var lf=m("ZodBase64URL",(e,t)=>{Lu.init(e,t),V.init(e,t)});var uf=m("ZodE164",(e,t)=>{Uu.init(e,t),V.init(e,t)});var df=m("ZodJWT",(e,t)=>{Zu.init(e,t),V.init(e,t)});var Ei=m("ZodNumber",(e,t)=>{Ea.init(e,t),L.init(e,t),e._zod.processJSONSchema=(r,n,i)=>Ga(e,r,n,i),Br(e,"ZodNumber",{gt(r,n){return this.check(bi(r,n))},gte(r,n){return this.check(Dr(r,n))},min(r,n){return this.check(Dr(r,n))},lt(r,n){return this.check(_i(r,n))},lte(r,n){return this.check(Zr(r,n))},max(r,n){return this.check(Zr(r,n))},int(r){return this.check(Cp(r))},safe(r){return this.check(Cp(r))},positive(r){return this.check(bi(0,r))},nonnegative(r){return this.check(Dr(0,r))},negative(r){return this.check(_i(0,r))},nonpositive(r){return this.check(Zr(0,r))},multipleOf(r,n){return this.check(yi(r,n))},step(r,n){return this.check(yi(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 Dd(Ei,e)}var pf=m("ZodNumberFormat",(e,t)=>{Du.init(e,t),Ei.init(e,t)});function Cp(e){return Vd(pf,e)}var Up=m("ZodBoolean",(e,t)=>{Hu.init(e,t),L.init(e,t),e._zod.processJSONSchema=(o,r,n)=>Ka(e,o,r,n)});function v(e){return Fd(Up,e)}var hf=m("ZodUndefined",(e,t)=>{Vu.init(e,t),L.init(e,t),e._zod.processJSONSchema=(o,r,n)=>Qa(e,o,r,n)});function zc(e){return Jd(hf,e)}var mf=m("ZodNull",(e,t)=>{Fu.init(e,t),L.init(e,t),e._zod.processJSONSchema=(o,r,n)=>Ya(e,o,r,n)});function wt(e){return Bd(mf,e)}var ff=m("ZodAny",(e,t)=>{Ju.init(e,t),L.init(e,t),e._zod.processJSONSchema=(o,r,n)=>ec(e,o,r,n)});function $i(){return Wd(ff)}var gf=m("ZodUnknown",(e,t)=>{Bu.init(e,t),L.init(e,t),e._zod.processJSONSchema=(o,r,n)=>tc(e,o,r,n)});function R(){return Gd(gf)}var Sf=m("ZodNever",(e,t)=>{Wu.init(e,t),L.init(e,t),e._zod.processJSONSchema=(o,r,n)=>Xa(e,o,r,n)});function vc(e){return Kd(Sf,e)}var _f=m("ZodArray",(e,t)=>{Gu.init(e,t),L.init(e,t),e._zod.processJSONSchema=(o,r,n)=>ic(e,o,r,n),e.element=t.element,Br(e,"ZodArray",{min(o,r){return this.check(ao(o,r))},nonempty(o){return this.check(ao(1,o))},max(o,r){return this.check(zi(o,r))},length(o,r){return this.check(vi(o,r))},unwrap(){return this.element}})});function h(e,t){return Yd(_f,e,t)}var Zp=m("ZodObject",(e,t)=>{Qu.init(e,t),L.init(e,t),e._zod.processJSONSchema=(o,r,n)=>ac(e,o,r,n),N(e,"shape",()=>t.shape),Br(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:vc()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(o){return vm(this,o)},safeExtend(o){return Rm(this,o)},merge(o){return wm(this,o)},pick(o){return ym(this,o)},omit(o){return zm(this,o)},partial(...o){return xm(Vp,this,o[0])},required(...o){return Pm(Fp,this,o[0])}})});function l(e,t){let o={type:"object",shape:e??{},...w(t)};return new Zp(o)}function T(e,t){return new Zp({type:"object",shape:e,catchall:R(),...w(t)})}var Dp=m("ZodUnion",(e,t)=>{$a.init(e,t),L.init(e,t),e._zod.processJSONSchema=(o,r,n)=>cc(e,o,r,n),e.options=t.options});function z(e,t){return new Dp({type:"union",options:e,...w(t)})}var bf=m("ZodDiscriminatedUnion",(e,t)=>{Dp.init(e,t),Xu.init(e,t)});function uo(e,t,o){return new bf({type:"union",options:t,discriminator:e,...w(o)})}var yf=m("ZodIntersection",(e,t)=>{ed.init(e,t),L.init(e,t),e._zod.processJSONSchema=(o,r,n)=>lc(e,o,r,n)});function Ne(e,t){return new yf({type:"intersection",left:e,right:t})}var Ip=m("ZodRecord",(e,t)=>{td.init(e,t),L.init(e,t),e._zod.processJSONSchema=(o,r,n)=>uc(e,o,r,n),e.keyType=t.keyType,e.valueType=t.valueType});function y(e,t,o){if(!t||!t._zod)return new Ip({type:"record",keyType:s(),valueType:e,...w(t)});return new Ip({type:"record",keyType:e,valueType:t,...w(o)})}var yc=m("ZodEnum",(e,t)=>{od.init(e,t),L.init(e,t),e._zod.processJSONSchema=(r,n,i)=>oc(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 yc({...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 yc({...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 yc({type:"enum",entries:o,...w(t)})}var zf=m("ZodLiteral",(e,t)=>{rd.init(e,t),L.init(e,t),e._zod.processJSONSchema=(o,r,n)=>rc(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 u(e,t){return new zf({type:"literal",values:Array.isArray(e)?e:[e],...w(t)})}var vf=m("ZodTransform",(e,t)=>{nd.init(e,t),L.init(e,t),e._zod.processJSONSchema=(o,r,n)=>sc(e,o,r,n),e._zod.parse=(o,r)=>{if(r.direction==="backward")throw new Nr(e.constructor.name);o.addIssue=(i)=>{if(typeof i==="string")o.issues.push(Rt(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(Rt(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 Hp(e){return new vf({type:"transform",transform:e})}var Vp=m("ZodOptional",(e,t)=>{Ca.init(e,t),L.init(e,t),e._zod.processJSONSchema=(o,r,n)=>Ri(e,o,r,n),e.unwrap=()=>e._zod.def.innerType});function x(e){return new Vp({type:"optional",innerType:e})}var Rf=m("ZodExactOptional",(e,t)=>{sd.init(e,t),L.init(e,t),e._zod.processJSONSchema=(o,r,n)=>Ri(e,o,r,n),e.unwrap=()=>e._zod.def.innerType});function wf(e){return new Rf({type:"optional",innerType:e})}var xf=m("ZodNullable",(e,t)=>{id.init(e,t),L.init(e,t),e._zod.processJSONSchema=(o,r,n)=>dc(e,o,r,n),e.unwrap=()=>e._zod.def.innerType});function Op(e){return new xf({type:"nullable",innerType:e})}var Pf=m("ZodDefault",(e,t)=>{ad.init(e,t),L.init(e,t),e._zod.processJSONSchema=(o,r,n)=>hc(e,o,r,n),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Tf(e,t){return new Pf({type:"default",innerType:e,get defaultValue(){return typeof t==="function"?t():Sa(t)}})}var kf=m("ZodPrefault",(e,t)=>{cd.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 Ef(e,t){return new kf({type:"prefault",innerType:e,get defaultValue(){return typeof t==="function"?t():Sa(t)}})}var Fp=m("ZodNonOptional",(e,t)=>{ld.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 $f(e,t){return new Fp({type:"nonoptional",innerType:e,...w(t)})}var Cf=m("ZodCatch",(e,t)=>{ud.init(e,t),L.init(e,t),e._zod.processJSONSchema=(o,r,n)=>fc(e,o,r,n),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function If(e,t){return new Cf({type:"catch",innerType:e,catchValue:typeof t==="function"?t:()=>t})}var Jp=m("ZodPipe",(e,t)=>{Ia.init(e,t),L.init(e,t),e._zod.processJSONSchema=(o,r,n)=>gc(e,o,r,n),e.in=t.in,e.out=t.out});function Np(e,t){return new Jp({type:"pipe",in:e,out:t})}var Of=m("ZodPreprocess",(e,t)=>{Jp.init(e,t),dd.init(e,t)}),Nf=m("ZodReadonly",(e,t)=>{pd.init(e,t),L.init(e,t),e._zod.processJSONSchema=(o,r,n)=>Sc(e,o,r,n),e.unwrap=()=>e._zod.def.innerType});function Mf(e){return new Nf({type:"readonly",innerType:e})}var qf=m("ZodLazy",(e,t)=>{hd.init(e,t),L.init(e,t),e._zod.processJSONSchema=(o,r,n)=>_c(e,o,r,n),e.unwrap=()=>e._zod.def.getter()});function Wr(e){return new qf({type:"lazy",getter:e})}var Af=m("ZodCustom",(e,t)=>{md.init(e,t),L.init(e,t),e._zod.processJSONSchema=(o,r,n)=>nc(e,o,r,n)});function jf(e,t={}){return Qd(Af,e,t)}function Lf(e,t){return Xd(e,t)}function xt(e,t){return new Of({type:"pipe",in:Hp(e),out:t})}var Wp={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 Bp;(function(e){})(Bp||(Bp={}));function Uf(e){return Hd(Ei,e)}ce(Oa());var Ci="2025-11-25";var Ii=[Ci,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],Oi="io.modelcontextprotocol/related-task",Pt="io.modelcontextprotocol/protocolVersion",po="io.modelcontextprotocol/clientInfo",et="io.modelcontextprotocol/serverInfo",Tt="io.modelcontextprotocol/clientCapabilities",Ni="io.modelcontextprotocol/subscriptionId",ho="io.modelcontextprotocol/logLevel";var kt="2.0";var Me=Wr(()=>z([s(),g(),v(),wt(),y(s(),Me),h(Me)])),F=y(s(),Me),Mi=h(Me),mo=z([s(),g().int()]),fo=s(),Gr=l({ttl:g().optional()}),Kr=l({taskId:s()}),go=T({progressToken:mo.optional(),[Oi]:Kr.optional()}),Q=l({_meta:go.optional()}),tt=Q.extend({task:Gr.optional()}),J=l({method:s(),params:Q.loose().optional()}),se=l({_meta:go.optional()}),ee=l({method:s(),params:se.loose().optional()}),So=T({get[et](){return xe.optional().catch(void 0)}}),B=T({_meta:So.optional()}),ye=z([s(),g().int()]),_o=l({jsonrpc:u(kt),id:ye,...J.shape}).strict(),bo=l({jsonrpc:u(kt),...ee.shape}).strict(),Et=l({jsonrpc:u(kt),id:ye,result:B}).strict(),$t=l({jsonrpc:u(kt),id:ye.optional(),error:l({code:g().int(),message:s(),data:R().optional()})}).strict(),Ct=z([_o,bo,Et,$t]),qi=z([Et,$t]),ot=B.strict(),Yr=se.extend({requestId:ye.optional(),reason:s().optional()}),yo=ee.extend({method:u("notifications/cancelled"),params:Yr}),Qr=l({src:s(),mimeType:s().optional(),sizes:h(s()).optional(),theme:C(["light","dark"]).optional()}),qe=l({icons:h(Qr).optional()}),we=l({name:s(),title:s().optional()}),xe=we.extend({...we.shape,...qe.shape,version:s(),websiteUrl:s().optional(),description:s().optional()}),Df=Ne(l({applyDefaults:v().optional()}),F),Hf=xt((e)=>{if(e&&typeof e==="object"&&!Array.isArray(e)&&Object.keys(e).length===0)return{form:{}};return e},Ne(l({form:Df.optional(),url:F.optional()}),F.optional())),Ai=T({list:F.optional(),cancel:F.optional(),requests:T({sampling:T({createMessage:F.optional()}).optional(),elicitation:T({create:F.optional()}).optional()}).optional()}),ji=T({list:F.optional(),cancel:F.optional(),requests:T({tools:T({call:F.optional()}).optional()}).optional()}),Xr=l({experimental:y(s(),F).optional(),sampling:l({context:F.optional(),tools:F.optional()}).optional(),elicitation:Hf.optional(),roots:l({listChanged:v().optional()}).optional(),tasks:Ai.optional(),extensions:y(s(),F).optional()}),en=Q.extend({protocolVersion:s(),capabilities:Xr,clientInfo:xe}),tn=J.extend({method:u("initialize"),params:en}),zo=l({experimental:y(s(),F).optional(),logging:F.optional(),completions:F.optional(),prompts:l({listChanged:v().optional()}).optional(),resources:l({subscribe:v().optional(),listChanged:v().optional()}).optional(),tools:l({listChanged:v().optional()}).optional(),tasks:ji.optional(),extensions:y(s(),F).optional()}),on=B.extend({protocolVersion:s(),capabilities:zo,serverInfo:xe,instructions:s().optional()}),rn=ee.extend({method:u("notifications/initialized"),params:se.optional()}),nn=J.extend({method:u("server/discover"),params:Q.optional()}),vo=B.extend({supportedVersions:h(s()),capabilities:zo,instructions:s().optional()}),Ro=J.extend({method:u("ping"),params:Q.optional()}),sn=l({progress:g(),total:x(g()),message:x(s())}),an=l({...se.shape,...sn.shape,progressToken:mo}),wo=ee.extend({method:u("notifications/progress"),params:an}),cn=Q.extend({cursor:fo.optional()}),Ae=J.extend({params:cn.optional()}),je=B.extend({nextCursor:fo.optional()}),xo=l({uri:s(),mimeType:x(s()),_meta:y(s(),R()).optional()}),Po=xo.extend({text:s()}),xc=s().refine((e)=>{try{return atob(e),!0}catch{return!1}},{message:"Invalid Base64 string"}),To=xo.extend({blob:xc}),Le=C(["user","assistant"]),Pe=l({audience:h(Le).optional(),priority:g().min(0).max(1).optional(),lastModified:lo({offset:!0}).optional()}),ko=l({...we.shape,...qe.shape,uri:s(),description:x(s()),mimeType:x(s()),size:x(g()),annotations:Pe.optional(),_meta:x(T({}))}),ln=l({...we.shape,...qe.shape,uriTemplate:s(),description:x(s()),mimeType:x(s()),annotations:Pe.optional(),_meta:x(T({}))}),un=Ae.extend({method:u("resources/list")}),dn=je.extend({resources:h(ko)}),pn=Ae.extend({method:u("resources/templates/list")}),hn=je.extend({resourceTemplates:h(ln)}),It=Q.extend({uri:s()}),mn=It,fn=J.extend({method:u("resources/read"),params:mn}),gn=B.extend({contents:h(z([Po,To]))}),Sn=ee.extend({method:u("notifications/resources/list_changed"),params:se.optional()}),_n=It,bn=J.extend({method:u("resources/subscribe"),params:_n}),yn=It,zn=J.extend({method:u("resources/unsubscribe"),params:yn}),Eo=l({toolsListChanged:v().optional(),promptsListChanged:v().optional(),resourcesListChanged:v().optional(),resourceSubscriptions:h(s()).optional()}),vn=Q.extend({notifications:Eo}),Rn=J.extend({method:u("subscriptions/listen"),params:vn}),wn=se.extend({notifications:Eo}),xn=ee.extend({method:u("notifications/subscriptions/acknowledged"),params:wn}),Pn=So.extend({[Ni]:ye}),Tn=B.extend({_meta:Pn}),kn=se.extend({uri:s()}),En=ee.extend({method:u("notifications/resources/updated"),params:kn}),$n=l({name:s(),description:x(s()),required:x(v())}),Cn=l({...we.shape,...qe.shape,description:x(s()),arguments:x(h($n)),_meta:x(T({}))}),In=Ae.extend({method:u("prompts/list")}),On=je.extend({prompts:h(Cn)}),Nn=Q.extend({name:s(),arguments:y(s(),s()).optional()}),Mn=J.extend({method:u("prompts/get"),params:Nn}),Ot=l({type:u("text"),text:s(),annotations:Pe.optional(),_meta:y(s(),R()).optional()}),Nt=l({type:u("image"),data:xc,mimeType:s(),annotations:Pe.optional(),_meta:y(s(),R()).optional()}),Mt=l({type:u("audio"),data:xc,mimeType:s(),annotations:Pe.optional(),_meta:y(s(),R()).optional()}),qn=l({type:u("tool_use"),name:s(),id:s(),input:y(s(),R()),_meta:y(s(),R()).optional()}),qt=l({type:u("resource"),resource:z([Po,To]),annotations:Pe.optional(),_meta:y(s(),R()).optional()}),At=ko.extend({type:u("resource_link")}),Te=z([Ot,Nt,Mt,At,qt]),An=l({role:Le,content:Te}),jn=B.extend({description:s().optional(),messages:h(An)}),Ln=ee.extend({method:u("notifications/prompts/list_changed"),params:se.optional()}),Un=l({title:s().optional(),readOnlyHint:v().optional(),destructiveHint:v().optional(),idempotentHint:v().optional(),openWorldHint:v().optional()}),Zn=l({taskSupport:C(["required","optional","forbidden"]).optional()}),rt=l({...we.shape,...qe.shape,description:s().optional(),inputSchema:l({type:u("object"),properties:y(s(),Me).optional(),required:h(s()).optional()}).catchall(R()),outputSchema:T({$schema:s().optional()}).optional(),annotations:Un.optional(),execution:Zn.optional(),_meta:y(s(),R()).optional()}),Dn=Ae.extend({method:u("tools/list")}),Hn=je.extend({tools:h(rt)}),nt=B.extend({content:h(Te).default([]),structuredContent:R().optional(),isError:v().optional()}),Li=nt.or(B.extend({toolResult:R()})),Vn=tt.extend({name:s(),arguments:y(s(),R()).optional()}),Fn=J.extend({method:u("tools/call"),params:Vn}),Jn=ee.extend({method:u("notifications/tools/list_changed"),params:se.optional()}),Ui=l({autoRefresh:v().default(!0),debounceMs:g().int().nonnegative().default(300)}),$o=C(["debug","info","notice","warning","error","critical","alert","emergency"]),Bn=Q.extend({level:$o}),Wn=J.extend({method:u("logging/setLevel"),params:Bn}),Gn=se.extend({level:$o,logger:s().optional(),data:R()}),Kn=ee.extend({method:u("notifications/message"),params:Gn}),Yn=l({name:s().optional()}),Qn=l({hints:h(Yn).optional(),costPriority:g().min(0).max(1).optional(),speedPriority:g().min(0).max(1).optional(),intelligencePriority:g().min(0).max(1).optional()}),Xn=l({mode:C(["auto","required","none"]).optional()}),es=l({type:u("tool_result"),toolUseId:s().describe("The unique identifier for the corresponding tool call."),content:h(Te),structuredContent:R().optional(),isError:v().optional(),_meta:y(s(),R()).optional()}),ts=uo("type",[Ot,Nt,Mt]),Xe=uo("type",[Ot,Nt,Mt,qn,es]),os=l({role:Le,content:z([Xe,h(Xe)]),_meta:y(s(),R()).optional()}),rs=tt.extend({messages:h(os),modelPreferences:Qn.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(rt).optional(),toolChoice:Xn.optional()}),ns=J.extend({method:u("sampling/createMessage"),params:rs}),ss=B.extend({model:s(),stopReason:x(C(["endTurn","stopSequence","maxTokens"]).or(s())),role:Le,content:ts}),is=B.extend({model:s(),stopReason:x(C(["endTurn","stopSequence","maxTokens","toolUse"]).or(s())),role:Le,content:z([Xe,h(Xe)])}),Co=l({type:u("boolean"),title:s().optional(),description:s().optional(),default:v().optional()}),jt=l({type:u("string"),title:s().optional(),description:s().optional(),minLength:g().optional(),maxLength:g().optional(),format:C(["email","uri","date","date-time"]).optional(),default:s().optional()}),Lt=l({type:C(["number","integer"]),title:s().optional(),description:s().optional(),minimum:g().optional(),maximum:g().optional(),default:g().optional()}),Io=l({type:u("string"),title:s().optional(),description:s().optional(),enum:h(s()),default:s().optional()}),Oo=l({type:u("string"),title:s().optional(),description:s().optional(),oneOf:h(l({const:s(),title:s()})),default:s().optional()}),No=l({type:u("string"),title:s().optional(),description:s().optional(),enum:h(s()),enumNames:h(s()).optional(),default:s().optional()}),as=z([Io,Oo]),Mo=l({type:u("array"),title:s().optional(),description:s().optional(),minItems:g().optional(),maxItems:g().optional(),items:l({type:u("string"),enum:h(s())}),default:h(s()).optional()}),qo=l({type:u("array"),title:s().optional(),description:s().optional(),minItems:g().optional(),maxItems:g().optional(),items:l({anyOf:h(l({const:s(),title:s()}))}),default:h(s()).optional()}),cs=z([Mo,qo]),ls=z([No,as,cs]),Ao=z([ls,Co,jt,Lt]),Ut=tt.extend({mode:u("form").optional(),message:s(),requestedSchema:l({type:u("object"),properties:y(s(),Ao),required:h(s()).optional()}).catchall(R())}),us=tt.extend({mode:u("url"),message:s(),elicitationId:s(),url:s().url()}),ds=z([Ut,us]),ps=J.extend({method:u("elicitation/create"),params:ds}),hs=se.extend({elicitationId:s()}),ms=ee.extend({method:u("notifications/elicitation/complete"),params:hs}),fs=B.extend({action:C(["accept","decline","cancel"]),content:xt((e)=>e===null?void 0:e,y(s(),z([s(),g(),v(),h(s())])).optional())}),gs=l({type:u("ref/resource"),uri:s()}),Ss=l({type:u("ref/prompt"),name:s()}),_s=Q.extend({ref:z([Ss,gs]),argument:l({name:s(),value:s()}),context:l({arguments:y(s(),s()).optional()}).optional()}),bs=J.extend({method:u("completion/complete"),params:_s}),ys=B.extend({completion:T({values:h(s()).max(100),total:x(g().int()),hasMore:x(v())})}),zs=l({uri:s().startsWith("file://"),name:s().optional(),_meta:y(s(),R()).optional()}),vs=J.extend({method:u("roots/list"),params:Q.optional()}),Rs=B.extend({roots:h(zs)}),ws=ee.extend({method:u("notifications/roots/list_changed"),params:se.optional()}),Zi=T({ttl:g().optional(),pollInterval:g().optional()}),xs=C(["working","input_required","completed","failed","cancelled"]),Ue=l({taskId:s(),status:xs,ttl:z([g(),wt()]),createdAt:s(),lastUpdatedAt:s(),pollInterval:x(g()),statusMessage:x(s())}),Di=B.extend({task:Ue}),Ps=se.merge(Ue),Hi=ee.extend({method:u("notifications/tasks/status"),params:Ps}),Vi=J.extend({method:u("tasks/get"),params:Q.extend({taskId:s()})}),Fi=B.merge(Ue),Ji=J.extend({method:u("tasks/result"),params:Q.extend({taskId:s()})}),Bi=B.loose(),Wi=Ae.extend({method:u("tasks/list")}),Gi=je.extend({tasks:h(Ue)}),Ki=J.extend({method:u("tasks/cancel"),params:Q.extend({taskId:s()})}),Yi=B.merge(Ue),Qi=z([Ro,tn,nn,bs,Wn,Mn,In,un,pn,fn,bn,zn,Rn,Fn,Dn]),Xi=z([yo,wo,rn,ws]),ea=z([ot,ss,is,fs,Rs]),ta=z([Ro,ns,ps,vs]),oa=z([yo,wo,Kn,En,Sn,Jn,Ln,xn,ms]),ra=z([ot,on,vo,ys,jn,On,dn,hn,gn,nt,Hn,Tn]),Y=ki().superRefine((e,t)=>{if(!URL.canParse(e))return t.addIssue({code:Wp.custom,message:"URL must be parseable",fatal:!0}),pa}).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"}),Ts=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()}),jo=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()}),ks=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)}),Es=l({...ks.shape,...jo.pick({code_challenge_methods_supported:!0}).shape}),$s=l({access_token:s(),id_token:s().optional(),token_type:s(),expires_in:Uf().optional(),scope:s().optional(),refresh_token:s().optional(),issuer:s().optional().catch(void 0)}).strip(),Cs=l({issued_token_type:u("urn:ietf:params:oauth:token-type:id-jag"),access_token:s(),token_type:s().optional(),expires_in:g().optional(),scope:s().optional()}).strip(),Is=l({error:s(),error_description:s().optional(),error_uri:s().optional()}),wc=Y.optional().or(u("").transform(()=>{return})),Os=l({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:wc,scope:s().optional(),contacts:h(s()).optional(),tos_uri:wc,policy_uri:s().optional(),jwks_uri:Y.optional(),jwks:$i().optional(),software_id:s().optional(),software_version:s().optional(),software_statement:s().optional()}).strip(),Ns=l({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(),Ms=Os.merge(Ns),na=l({error:s(),error_description:s().optional()}).strip(),sa=l({token:s(),token_type_hint:s().optional()}).strip();var Cc=Symbol.for("mcp.sdk.errorBrands");function Zt(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,Cc,{value:o,enumerable:!1,configurable:!0})}function me(e,t){try{if(typeof t==="object"&&t!==null&&Object.prototype.hasOwnProperty.call(e,"mcpBrand")&&typeof e.mcpBrand==="string"&&Object.prototype.hasOwnProperty.call(t,Cc)){let o=t[Cc];if(o&&typeof o.has==="function"&&o.has(e.mcpBrand))return!0}}catch{}return Function.prototype[Symbol.hasInstance].call(e,t)}var Vf=class e extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.OAuthError"})}static[Symbol.hasInstance](t){return me(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 me(this,t)}constructor(t,o,r){super(o);this.code=t,this.errorUri=r,this.name="OAuthError",Zt(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}({}),G=class extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.SdkError"})}static[Symbol.hasInstance](e){return me(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 me(this,e)}constructor(e,t,o,r){super(t,r);this.code=e,this.data=o,this.name="SdkError",Zt(this,new.target)}},Ff=class extends G{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 Jf="2026-07-28";function gh(e){return e>=Jf}function Sh(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 _h=["task","inputRequests","requestState"];function Bf(e){if(e===null||typeof e!=="object"||Array.isArray(e)||e.content!==void 0||_h.some((t)=>(t in e)))return e;return{...e,content:[]}}function Wf(){let e=Wr(()=>z([s(),g(),v(),wt(),y(s(),e),h(e)])),t=y(s(),e),o=z([s(),g().int()]),r=s(),n=l({ttl:g().optional()}),i=l({taskId:s()}),a=T({progressToken:o.optional(),"io.modelcontextprotocol/related-task":i.optional()}),c=l({_meta:a.optional()}),p=c.extend({task:n.optional()}),d=l({method:s(),params:c.loose().optional()}),f=l({_meta:a.optional()}),S=l({method:s(),params:f.loose().optional()}),_=T({_meta:a.optional()}),b=z([s(),g().int()]),P=_.strict(),k=f.extend({requestId:b.optional(),reason:s().optional()}),E=S.extend({method:u("notifications/cancelled"),params:k}),I=l({src:s(),mimeType:s().optional(),sizes:h(s()).optional(),theme:C(["light","dark"]).optional()}),D=l({icons:h(I).optional()}),M=l({name:s(),title:s().optional()}),q=M.extend({...M.shape,...D.shape,version:s(),websiteUrl:s().optional(),description:s().optional()}),H=Ne(l({applyDefaults:v().optional()}),t),U=xt((ne)=>{if(ne&&typeof ne==="object"&&!Array.isArray(ne)&&Object.keys(ne).length===0)return{form:{}};return ne},Ne(l({form:H.optional(),url:t.optional()}),t.optional())),K=T({list:t.optional(),cancel:t.optional(),requests:T({sampling:T({createMessage:t.optional()}).optional(),elicitation:T({create:t.optional()}).optional()}).optional()}),$e=T({list:t.optional(),cancel:t.optional(),requests:T({tools:T({call:t.optional()}).optional()}).optional()}),ie=l({experimental:y(s(),t).optional(),sampling:l({context:t.optional(),tools:t.optional()}).optional(),elicitation:U.optional(),roots:l({listChanged:v().optional()}).optional(),tasks:K.optional(),extensions:y(s(),t).optional()}),Ze=c.extend({protocolVersion:s(),capabilities:ie,clientInfo:q}),it=d.extend({method:u("initialize"),params:Ze}),Lo=l({experimental:y(s(),t).optional(),logging:t.optional(),completions:t.optional(),prompts:l({listChanged:v().optional()}).optional(),resources:l({subscribe:v().optional(),listChanged:v().optional()}).optional(),tools:l({listChanged:v().optional()}).optional(),tasks:$e.optional(),extensions:y(s(),t).optional()}),Uo=_.extend({protocolVersion:s(),capabilities:Lo,serverInfo:q,instructions:s().optional()}),Dt=S.extend({method:u("notifications/initialized"),params:f.optional()}),De=d.extend({method:u("ping"),params:c.optional()}),at=l({progress:g(),total:x(g()),message:x(s())}),ze=l({...f.shape,...at.shape,progressToken:o}),He=S.extend({method:u("notifications/progress"),params:ze}),Ht=c.extend({cursor:r.optional()}),Ce=d.extend({params:Ht.optional()}),Ie=_.extend({nextCursor:r.optional()}),Vt=l({uri:s(),mimeType:x(s()),_meta:y(s(),R()).optional()}),Ft=Vt.extend({text:s()}),ct=s().refine((ne)=>{try{return atob(ne),!0}catch{return!1}},{message:"Invalid Base64 string"}),Jt=Vt.extend({blob:ct}),ve=C(["user","assistant"]),ge=l({audience:h(ve).optional(),priority:g().min(0).max(1).optional(),lastModified:lo({offset:!0}).optional()}),lt=l({...M.shape,...D.shape,uri:s(),description:x(s()),mimeType:x(s()),size:x(g()),annotations:ge.optional(),_meta:x(T({}))}),Zo=l({...M.shape,...D.shape,uriTemplate:s(),description:x(s()),mimeType:x(s()),annotations:ge.optional(),_meta:x(T({}))}),Do=Ce.extend({method:u("resources/list")}),Ho=Ie.extend({resources:h(lt)}),Ve=Ce.extend({method:u("resources/templates/list")}),Bt=Ie.extend({resourceTemplates:h(Zo)}),ut=c.extend({uri:s()}),Vo=ut,Fo=d.extend({method:u("resources/read"),params:Vo}),Jo=_.extend({contents:h(z([Ft,Jt]))}),Bo=S.extend({method:u("notifications/resources/list_changed"),params:f.optional()}),Wo=ut,Go=d.extend({method:u("resources/subscribe"),params:Wo}),Ko=ut,Yo=d.extend({method:u("resources/unsubscribe"),params:Ko}),Qo=f.extend({uri:s()}),Xo=S.extend({method:u("notifications/resources/updated"),params:Qo}),er=l({name:s(),description:x(s()),required:x(v())}),tr=l({...M.shape,...D.shape,description:x(s()),arguments:x(h(er)),_meta:x(T({}))}),or=Ce.extend({method:u("prompts/list")}),rr=Ie.extend({prompts:h(tr)}),nr=c.extend({name:s(),arguments:y(s(),s()).optional()}),sr=d.extend({method:u("prompts/get"),params:nr}),dt=l({type:u("text"),text:s(),annotations:ge.optional(),_meta:y(s(),R()).optional()}),pt=l({type:u("image"),data:ct,mimeType:s(),annotations:ge.optional(),_meta:y(s(),R()).optional()}),ht=l({type:u("audio"),data:ct,mimeType:s(),annotations:ge.optional(),_meta:y(s(),R()).optional()}),ir=l({type:u("tool_use"),name:s(),id:s(),input:y(s(),R()),_meta:y(s(),R()).optional()}),Fe=l({type:u("resource"),resource:z([Ft,Jt]),annotations:ge.optional(),_meta:y(s(),R()).optional()}),ar=lt.extend({type:u("resource_link")}),fe=z([dt,pt,ht,ar,Fe]),Wt=l({role:ve,content:fe}),Gt=_.extend({description:s().optional(),messages:h(Wt)}),mt=S.extend({method:u("notifications/prompts/list_changed"),params:f.optional()}),cr=l({title:s().optional(),readOnlyHint:v().optional(),destructiveHint:v().optional(),idempotentHint:v().optional(),openWorldHint:v().optional()}),Kt=l({taskSupport:C(["required","optional","forbidden"]).optional()}),ft=l({...M.shape,...D.shape,description:s().optional(),inputSchema:l({type:u("object"),properties:y(s(),e).optional(),required:h(s()).optional()}).catchall(R()),outputSchema:l({type:u("object"),properties:y(s(),e).optional(),required:h(s()).optional()}).catchall(R()).optional(),annotations:cr.optional(),execution:Kt.optional(),_meta:y(s(),R()).optional()}),Yt=Ce.extend({method:u("tools/list")}),Qt=Ie.extend({tools:h(ft)}),Xt=_.extend({content:h(fe),structuredContent:y(s(),R()).optional(),isError:v().optional()}),re=p.extend({name:s(),arguments:y(s(),R()).optional()}),lr=d.extend({method:u("tools/call"),params:re}),Vs=S.extend({method:u("notifications/tools/list_changed"),params:f.optional()}),eo=C(["debug","info","notice","warning","error","critical","alert","emergency"]),ur=c.extend({level:eo}),dr=d.extend({method:u("logging/setLevel"),params:ur}),pr=f.extend({level:eo,logger:s().optional(),data:R()}),hr=S.extend({method:u("notifications/message"),params:pr}),mr=l({name:s().optional()}),fr=l({hints:h(mr).optional(),costPriority:g().min(0).max(1).optional(),speedPriority:g().min(0).max(1).optional(),intelligencePriority:g().min(0).max(1).optional()}),gr=l({mode:C(["auto","required","none"]).optional()}),Fs=l({type:u("tool_result"),toolUseId:s().describe("The unique identifier for the corresponding tool call."),content:h(fe),structuredContent:l({}).loose().optional(),isError:v().optional(),_meta:y(s(),R()).optional()}),Sr=uo("type",[dt,pt,ht]),Je=uo("type",[dt,pt,ht,ir,Fs]),_r=l({role:ve,content:z([Je,h(Je)]),_meta:y(s(),R()).optional()}),br=p.extend({messages:h(_r),modelPreferences:fr.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(ft).optional(),toolChoice:gr.optional()}),yr=d.extend({method:u("sampling/createMessage"),params:br}),zr=_.extend({model:s(),stopReason:x(C(["endTurn","stopSequence","maxTokens"]).or(s())),role:ve,content:Sr}),vr=_.extend({model:s(),stopReason:x(C(["endTurn","stopSequence","maxTokens","toolUse"]).or(s())),role:ve,content:z([Je,h(Je)])}),Rr=l({type:u("boolean"),title:s().optional(),description:s().optional(),default:v().optional()}),wr=l({type:u("string"),title:s().optional(),description:s().optional(),minLength:g().optional(),maxLength:g().optional(),format:C(["email","uri","date","date-time"]).optional(),default:s().optional()}),xr=l({type:C(["number","integer"]),title:s().optional(),description:s().optional(),minimum:g().optional(),maximum:g().optional(),default:g().optional()}),Pr=l({type:u("string"),title:s().optional(),description:s().optional(),enum:h(s()),default:s().optional()}),Tr=l({type:u("string"),title:s().optional(),description:s().optional(),oneOf:h(l({const:s(),title:s()})),default:s().optional()}),kr=l({type:u("string"),title:s().optional(),description:s().optional(),enum:h(s()),enumNames:h(s()).optional(),default:s().optional()}),Er=z([Pr,Tr]),gt=l({type:u("array"),title:s().optional(),description:s().optional(),minItems:g().optional(),maxItems:g().optional(),items:l({type:u("string"),enum:h(s())}),default:h(s()).optional()}),St=l({type:u("array"),title:s().optional(),description:s().optional(),minItems:g().optional(),maxItems:g().optional(),items:l({anyOf:h(l({const:s(),title:s()}))}),default:h(s()).optional()}),Js=z([gt,St]),Bs=z([kr,Er,Js]),de=z([Bs,Rr,wr,xr]),pe=p.extend({mode:u("form").optional(),message:s(),requestedSchema:l({type:u("object"),properties:y(s(),de),required:h(s()).optional()}).catchall(R())}),$r=p.extend({mode:u("url"),message:s(),elicitationId:s(),url:s().url()}),Se=z([pe,$r]),Ws=d.extend({method:u("elicitation/create"),params:Se}),Gs=f.extend({elicitationId:s()}),Ks=S.extend({method:u("notifications/elicitation/complete"),params:Gs}),Ys=_.extend({action:C(["accept","decline","cancel"]),content:xt((ne)=>ne===null?void 0:ne,y(s(),z([s(),g(),v(),h(s())])).optional())}),Qs=l({type:u("ref/resource"),uri:s()}),Xs=l({type:u("ref/prompt"),name:s()}),ei=c.extend({ref:z([Xs,Qs]),argument:l({name:s(),value:s()}),context:l({arguments:y(s(),s()).optional()}).optional()}),Cr=d.extend({method:u("completion/complete"),params:ei}),ti=_.extend({completion:T({values:h(s()).max(100),total:x(g().int()),hasMore:x(v())})}),oi=l({uri:s().startsWith("file://"),name:s().optional(),_meta:y(s(),R()).optional()}),to=d.extend({method:u("roots/list"),params:c.optional()}),Ir=_.extend({roots:h(oi)}),ri=S.extend({method:u("notifications/roots/list_changed"),params:f.optional()}),ni=T({ttl:g().optional(),pollInterval:g().optional()}),Or=C(["working","input_required","completed","failed","cancelled"]),Be=l({taskId:s(),status:Or,ttl:z([g(),wt()]),createdAt:s(),lastUpdatedAt:s(),pollInterval:x(g()),statusMessage:x(s())}),ue=_.extend({task:Be}),si=f.merge(Be),_t=S.extend({method:u("notifications/tasks/status"),params:si}),oo=d.extend({method:u("tasks/get"),params:c.extend({taskId:s()})}),ro=_.merge(Be),no=d.extend({method:u("tasks/result"),params:c.extend({taskId:s()})}),da=_.loose(),ae=Ce.extend({method:u("tasks/list")}),W=Ie.extend({tasks:h(Be)}),bt=d.extend({method:u("tasks/cancel"),params:c.extend({taskId:s()})});return{JSONValueSchema:e,JSONObjectSchema:t,ProgressTokenSchema:o,CursorSchema:r,TaskMetadataSchema:n,RelatedTaskMetadataSchema:i,RequestMetaSchema:a,BaseRequestParamsSchema:c,TaskAugmentedRequestParamsSchema:p,RequestSchema:d,NotificationsParamsSchema:f,NotificationSchema:S,ResultSchema:_,RequestIdSchema:b,EmptyResultSchema:P,CancelledNotificationParamsSchema:k,CancelledNotificationSchema:E,IconSchema:I,IconsSchema:D,BaseMetadataSchema:M,ImplementationSchema:q,ClientTasksCapabilitySchema:K,ServerTasksCapabilitySchema:$e,ClientCapabilitiesSchema:ie,InitializeRequestParamsSchema:Ze,InitializeRequestSchema:it,ServerCapabilitiesSchema:Lo,InitializeResultSchema:Uo,InitializedNotificationSchema:Dt,PingRequestSchema:De,ProgressSchema:at,ProgressNotificationParamsSchema:ze,ProgressNotificationSchema:He,PaginatedRequestParamsSchema:Ht,PaginatedRequestSchema:Ce,PaginatedResultSchema:Ie,ResourceContentsSchema:Vt,TextResourceContentsSchema:Ft,BlobResourceContentsSchema:Jt,RoleSchema:ve,AnnotationsSchema:ge,ResourceSchema:lt,ResourceTemplateSchema:Zo,ListResourcesRequestSchema:Do,ListResourcesResultSchema:Ho,ListResourceTemplatesRequestSchema:Ve,ListResourceTemplatesResultSchema:Bt,ResourceRequestParamsSchema:ut,ReadResourceRequestParamsSchema:Vo,ReadResourceRequestSchema:Fo,ReadResourceResultSchema:Jo,ResourceListChangedNotificationSchema:Bo,SubscribeRequestParamsSchema:Wo,SubscribeRequestSchema:Go,UnsubscribeRequestParamsSchema:Ko,UnsubscribeRequestSchema:Yo,ResourceUpdatedNotificationParamsSchema:Qo,ResourceUpdatedNotificationSchema:Xo,PromptArgumentSchema:er,PromptSchema:tr,ListPromptsRequestSchema:or,ListPromptsResultSchema:rr,GetPromptRequestParamsSchema:nr,GetPromptRequestSchema:sr,TextContentSchema:dt,ImageContentSchema:pt,AudioContentSchema:ht,ToolUseContentSchema:ir,EmbeddedResourceSchema:Fe,ResourceLinkSchema:ar,ContentBlockSchema:fe,PromptMessageSchema:Wt,GetPromptResultSchema:Gt,PromptListChangedNotificationSchema:mt,ToolAnnotationsSchema:cr,ToolExecutionSchema:Kt,ToolSchema:ft,ListToolsRequestSchema:Yt,ListToolsResultSchema:Qt,CallToolResultSchema:Xt,CallToolRequestParamsSchema:re,CallToolRequestSchema:lr,ToolListChangedNotificationSchema:Vs,LoggingLevelSchema:eo,SetLevelRequestParamsSchema:ur,SetLevelRequestSchema:dr,LoggingMessageNotificationParamsSchema:pr,LoggingMessageNotificationSchema:hr,ModelHintSchema:mr,ModelPreferencesSchema:fr,ToolChoiceSchema:gr,ToolResultContentSchema:Fs,SamplingContentSchema:Sr,SamplingMessageContentBlockSchema:Je,SamplingMessageSchema:_r,CreateMessageRequestParamsSchema:br,CreateMessageRequestSchema:yr,CreateMessageResultSchema:zr,CreateMessageResultWithToolsSchema:vr,BooleanSchemaSchema:Rr,StringSchemaSchema:wr,NumberSchemaSchema:xr,UntitledSingleSelectEnumSchemaSchema:Pr,TitledSingleSelectEnumSchemaSchema:Tr,LegacyTitledEnumSchemaSchema:kr,SingleSelectEnumSchemaSchema:Er,UntitledMultiSelectEnumSchemaSchema:gt,TitledMultiSelectEnumSchemaSchema:St,MultiSelectEnumSchemaSchema:Js,EnumSchemaSchema:Bs,PrimitiveSchemaDefinitionSchema:de,ElicitRequestFormParamsSchema:pe,ElicitRequestURLParamsSchema:$r,ElicitRequestParamsSchema:Se,ElicitRequestSchema:Ws,ElicitationCompleteNotificationParamsSchema:Gs,ElicitationCompleteNotificationSchema:Ks,ElicitResultSchema:Ys,ResourceTemplateReferenceSchema:Qs,PromptReferenceSchema:Xs,CompleteRequestParamsSchema:ei,CompleteRequestSchema:Cr,CompleteResultSchema:ti,RootSchema:oi,ListRootsRequestSchema:to,ListRootsResultSchema:Ir,RootsListChangedNotificationSchema:ri,TaskCreationParamsSchema:ni,TaskStatusSchema:Or,TaskSchema:Be,CreateTaskResultSchema:ue,TaskStatusNotificationParamsSchema:si,TaskStatusNotificationSchema:_t,GetTaskRequestSchema:oo,GetTaskResultSchema:ro,GetTaskPayloadRequestSchema:no,GetTaskPayloadResultSchema:da,ListTasksRequestSchema:ae,ListTasksResultSchema:W,CancelTaskRequestSchema:bt,CancelTaskResultSchema:_.merge(Be),ClientRequestSchema:z([De,it,Cr,dr,sr,or,Do,Ve,Fo,Go,Yo,lr,Yt,oo,no,ae,bt]),ClientNotificationSchema:z([E,He,Dt,ri,_t]),ClientResultSchema:z([P,zr,vr,Ys,Ir,ro,W,ue]),ServerRequestSchema:z([De,yr,Ws,to,oo,no,ae,bt]),ServerNotificationSchema:z([E,He,hr,Xo,Bo,Vs,mt,_t,Ks]),ServerResultSchema:z([P,Uo,ti,Gt,rr,Ho,Bt,Jo,Xt,Qt,ro,W,ue]),CallToolResultWireSchema:R().superRefine((ne,dm)=>{if(typeof ne!=="object"||ne===null||Array.isArray(ne)||ne.content!==void 0)return;for(let Wc of _h)if(Wc in ne){dm.addIssue({code:"custom",message:`content is required when the body carries '${Wc}' — another result family cannot default into an empty tools/call success`});return}}).transform(Bf).pipe(Xt)}}var Gf;function bh(){return Gf??=Wf()}function yh(e){return e.type!=="object"}var Kf=new Set(["const","enum","default","examples"]),Yf=new Set(["properties","patternProperties","$defs","definitions","dependentSchemas","dependencies"]);function sh(e){return e!==void 0&&!(typeof e==="string"&&e.startsWith("#"))}function Qf(e){let t=typeof e.$schema==="string"?e.$schema:void 0;if(sh(e.$id))return{...t!==void 0&&{$schema:t},type:"object",properties:{result:e},required:["result"]};let o=Qc(e.$schema)&&e.$recursiveAnchor!==!0,r=(n,i)=>{if(Array.isArray(n))return n.map((p)=>r(p,!1));if(n===null||typeof n!=="object")return n;if(!i&&sh(n.$id))return n;let a={},c=!1;for(let[p,d]of Object.entries(n))if(i)a[p]=r(d,!1);else if((p==="$ref"||p==="$dynamicRef")&&typeof d==="string")a[p]=d==="#"?"#/properties/result":d.startsWith("#/")?`#/properties/result${d.slice(1)}`:d;else if(p==="$recursiveRef"&&d==="#"&&o)c=!0;else if(Kf.has(p))a[p]=d;else if(Yf.has(p))a[p]=r(d,!0);else a[p]=r(d,!1);if(c)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 zh={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},vh={"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},Xf={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},ia;function Ac(){if(ia)return ia;let e=bh();return ia={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}},ia}function Rh(e){return Object.prototype.hasOwnProperty.call(zh,e)}function wh(e){return Object.prototype.hasOwnProperty.call(vh,e)}function eg(e){return Object.prototype.hasOwnProperty.call(Xf,e)}function tg(e){return eg(e)?Ac().resultSchemas[e]:void 0}function og(e){return Rh(e)?Ac().requestSchemas[e]:void 0}function rg(e){return wh(e)?Ac().notificationSchemas[e]:void 0}var ly=Object.keys(zh),uy=Object.keys(vh);function Ic(e){return e!==null&&typeof e==="object"&&!Array.isArray(e)}function aa(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 ih={ok:!1,reason:"not-in-era"};function ah(e){return Ic(e)&&Ic(e.outputSchema)&&yh(e.outputSchema)}function ch(e){return e}var jc={era:"2025-11-25",hasRequestMethod:Rh,hasNotificationMethod:wh,validateRequest:(e,t)=>aa(og(e),t),validateResult:(e,t)=>aa(tg(e),t),validateNotification:(e,t)=>aa(rg(e),t),hasInputRequestMethod:()=>!1,validateInputRequest:()=>ih,validateInputResponse:()=>ih,samplingResultVariant:(e,t)=>{let o=bh();return aa(e?o.CreateMessageResultWithToolsSchema:o.CreateMessageResultSchema,t)},outboundEnvelope:(e)=>{return},validateEnvelopeMeta:(e)=>[],projectCallToolResult(e,t){let o=Sh(e),r=o.structuredContent;if(r===void 0)return o;let n=typeof r!=="object"||r===null||Array.isArray(r),i=t!==void 0&&yh(t);if(!n&&!i)return o;return{...o,structuredContent:{result:r}}},decodeResult(e,t){if(Ic(t)&&"resultType"in t){let o={...t};return delete o.resultType,{kind:"complete",result:ch(o)}}return{kind:"complete",result:ch(t)}},encodeResult(e,t){if(e!=="tools/list")return t;let o=t.tools;if(!Array.isArray(o)||!o.some((r)=>ah(r)))return t;return{...t,tools:o.map((r)=>ah(r)?{...r,outputSchema:Qf(r.outputSchema)}:r)}},encodeErrorCode:(e)=>e===-32002?-32602:e,checkInboundEnvelope:(e)=>{return}};function ng(){let e=Wr(()=>z([s(),g(),v(),wt(),y(s(),e),h(e)])),t=y(s(),e),o=z([s(),g().int()]),r=s(),n=z([s(),g().int()]),i=C(["user","assistant"]),a=C(["debug","info","notice","warning","error","critical","alert","emergency"]),c=s().refine((W)=>{try{return atob(W),!0}catch{return!1}},{message:"Invalid Base64 string"}),p=l({ttl:g().optional()}),d=l({taskId:s()}),f=T({progressToken:o.optional(),"io.modelcontextprotocol/related-task":d.optional()}),S=l({_meta:f.optional()}),_=S.extend({task:p.optional()}),b=l({_meta:f.optional()}),P=l({method:s(),params:b.loose().optional()}),k=l({src:s(),mimeType:s().optional(),sizes:h(s()).optional(),theme:C(["light","dark"]).optional()}),E=l({icons:h(k).optional()}),I=l({name:s(),title:s().optional()}),D=I.extend({...I.shape,...E.shape,version:s(),websiteUrl:s().optional(),description:s().optional()}),M=Ne(l({applyDefaults:v().optional()}),t),q=xt((W)=>{if(W&&typeof W==="object"&&!Array.isArray(W)&&Object.keys(W).length===0)return{form:{}};return W},Ne(l({form:M.optional(),url:t.optional()}),t.optional())),H=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()}),K=l({experimental:y(s(),t).optional(),sampling:l({context:t.optional(),tools:t.optional()}).optional(),elicitation:q.optional(),roots:l({listChanged:v().optional()}).optional(),tasks:H.optional(),extensions:y(s(),t).optional()}),$e=l({experimental:y(s(),t).optional(),logging:t.optional(),completions:t.optional(),prompts:l({listChanged:v().optional()}).optional(),resources:l({subscribe:v().optional(),listChanged:v().optional()}).optional(),tools:l({listChanged:v().optional()}).optional(),tasks:U.optional(),extensions:y(s(),t).optional()}),ie=l({progress:g(),total:x(g()),message:x(s())}),Ze=l({...b.shape,...ie.shape,progressToken:o}),it=P.extend({method:u("notifications/progress"),params:Ze}),Lo=b.extend({level:a,logger:s().optional(),data:R()}),Uo=P.extend({method:u("notifications/message"),params:Lo}),Dt=l({uri:s(),mimeType:x(s()),_meta:y(s(),R()).optional()}),De=Dt.extend({text:s()}),at=Dt.extend({blob:c}),ze=l({audience:h(i).optional(),priority:g().min(0).max(1).optional(),lastModified:lo({offset:!0}).optional()}),He=l({...I.shape,...E.shape,uri:s(),description:x(s()),mimeType:x(s()),size:x(g()),annotations:ze.optional(),_meta:x(T({}))}),Ht=l({...I.shape,...E.shape,uriTemplate:s(),description:x(s()),mimeType:x(s()),annotations:ze.optional(),_meta:x(T({}))}),Ce=P.extend({method:u("notifications/resources/list_changed"),params:b.optional()}),Ie=b.extend({uri:s()}),Vt=P.extend({method:u("notifications/resources/updated"),params:Ie}),Ft=l({name:s(),description:x(s()),required:x(v())}),ct=l({...I.shape,...E.shape,description:x(s()),arguments:x(h(Ft)),_meta:x(T({}))}),Jt=P.extend({method:u("notifications/prompts/list_changed"),params:b.optional()}),ve=l({type:u("text"),text:s(),annotations:ze.optional(),_meta:y(s(),R()).optional()}),ge=l({type:u("image"),data:c,mimeType:s(),annotations:ze.optional(),_meta:y(s(),R()).optional()}),lt=l({type:u("audio"),data:c,mimeType:s(),annotations:ze.optional(),_meta:y(s(),R()).optional()}),Zo=l({type:u("tool_use"),name:s(),id:s(),input:y(s(),R()),_meta:y(s(),R()).optional()}),Do=l({type:u("resource"),resource:z([De,at]),annotations:ze.optional(),_meta:y(s(),R()).optional()}),Ho=He.extend({type:u("resource_link")}),Ve=z([ve,ge,lt,Ho,Do]),Bt=l({role:i,content:Ve}),ut=l({title:s().optional(),readOnlyHint:v().optional(),destructiveHint:v().optional(),idempotentHint:v().optional(),openWorldHint:v().optional()}),Vo=P.extend({method:u("notifications/tools/list_changed"),params:b.optional()}),Fo=l({name:s().optional()}),Jo=l({hints:h(Fo).optional(),costPriority:g().min(0).max(1).optional(),speedPriority:g().min(0).max(1).optional(),intelligencePriority:g().min(0).max(1).optional()}),Bo=l({mode:C(["auto","required","none"]).optional()}),Wo=l({type:u("boolean"),title:s().optional(),description:s().optional(),default:v().optional()}),Go=l({type:u("string"),title:s().optional(),description:s().optional(),minLength:g().optional(),maxLength:g().optional(),format:C(["email","uri","date","date-time"]).optional(),default:s().optional()}),Ko=l({type:C(["number","integer"]),title:s().optional(),description:s().optional(),minimum:g().optional(),maximum:g().optional(),default:g().optional()}),Yo=l({type:u("string"),title:s().optional(),description:s().optional(),enum:h(s()),default:s().optional()}),Qo=l({type:u("string"),title:s().optional(),description:s().optional(),oneOf:h(l({const:s(),title:s()})),default:s().optional()}),Xo=l({type:u("string"),title:s().optional(),description:s().optional(),enum:h(s()),enumNames:h(s()).optional(),default:s().optional()}),er=z([Yo,Qo]),tr=l({type:u("array"),title:s().optional(),description:s().optional(),minItems:g().optional(),maxItems:g().optional(),items:l({type:u("string"),enum:h(s())}),default:h(s()).optional()}),or=l({type:u("array"),title:s().optional(),description:s().optional(),minItems:g().optional(),maxItems:g().optional(),items:l({anyOf:h(l({const:s(),title:s()}))}),default:h(s()).optional()}),rr=z([tr,or]),nr=z([Xo,er,rr]),sr=z([nr,Wo,Go,Ko]),dt=_.extend({mode:u("form").optional(),message:s(),requestedSchema:l({type:u("object"),properties:y(s(),sr),required:h(s()).optional()}).catchall(R())}),pt=l({type:u("ref/resource"),uri:s()}),ht=l({type:u("ref/prompt"),name:s()}),ir=l({uri:s().startsWith("file://"),name:s().optional(),_meta:y(s(),R()).optional()}),Fe=K.shape,ar=l({experimental:Fe.experimental,sampling:Fe.sampling,elicitation:Fe.elicitation,roots:Fe.roots,extensions:Fe.extensions}),fe=$e.shape,Wt=l({experimental:fe.experimental,logging:fe.logging,completions:fe.completions,prompts:fe.prompts,resources:fe.resources,tools:fe.tools,extensions:fe.extensions}),Gt=T({progressToken:o.optional(),[Pt]:s(),[po]:D.optional(),[Tt]:ar,[ho]:a.optional()}),mt=l({...I.shape,...E.shape,description:s().optional(),inputSchema:T({$schema:s().optional(),type:u("object")}),outputSchema:T({$schema:s().optional()}).optional(),annotations:ut.optional(),_meta:y(s(),R()).optional()}),cr=l({type:u("tool_result"),toolUseId:s(),content:h(Ve),structuredContent:R().optional(),isError:v().optional(),_meta:y(s(),R()).optional()}),Kt=z([ve,ge,lt,Zo,cr]),ft=l({role:i,content:z([Kt,h(Kt)]),_meta:y(s(),R()).optional()}),Yt=s(),Qt=T({[et]:D.optional().catch(void 0)}),Xt=Qt.optional();function re(W){return T({_meta:Xt,resultType:Yt.default("complete"),...W})}let lr=re({}),Vs=re({nextCursor:r.optional()}),eo=re({content:h(Ve),structuredContent:R().optional(),isError:v().optional()}),ur=re({ttlMs:g().int().min(0),cacheScope:C(["public","private"]),tools:h(mt),nextCursor:r.optional()}),dr=re({ttlMs:g().int().min(0),cacheScope:C(["public","private"]),prompts:h(ct),nextCursor:r.optional()}),pr=re({description:s().optional(),messages:h(Bt)}),hr=re({ttlMs:g().int().min(0),cacheScope:C(["public","private"]),resources:h(He),nextCursor:r.optional()}),mr=re({ttlMs:g().int().min(0),cacheScope:C(["public","private"]),resourceTemplates:h(Ht),nextCursor:r.optional()}),fr=re({ttlMs:g().int().min(0),cacheScope:C(["public","private"]),contents:h(z([De,at]))}),gr=re({completion:l({values:h(s()).max(100),total:g().int().optional(),hasMore:v().optional()}).loose()}),Fs=re({ttlMs:g().int().min(0),cacheScope:C(["public","private"])}),Sr=re({ttlMs:g().int().min(0).catch(0),cacheScope:C(["public","private"]).catch("private"),supportedVersions:h(s()),capabilities:Wt,instructions:s().optional()}),Je=l({messages:h(ft),modelPreferences:Jo.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(mt).optional(),toolChoice:Bo.optional()}),_r=l({method:u("sampling/createMessage"),params:Je}),br=l({method:u("roots/list"),params:l({_meta:y(s(),R()).optional()}).optional()}),yr=l({...ft.shape,model:s(),stopReason:s().optional()}),zr=l({roots:h(ir)}),vr=l({action:C(["accept","decline","cancel"]),content:y(s(),z([s(),g(),v(),h(s())])).optional()}),Rr=l({mode:u("url"),message:s(),url:s().url()}),wr=z([dt,Rr]),xr=l({method:u("elicitation/create"),params:wr}),Pr=z([_r,br,xr]),Tr=z([yr,zr,vr]),kr=y(s(),Pr),Er=y(s(),Tr),gt=re({inputRequests:kr.optional(),requestState:s().optional()}),St={inputResponses:Er.optional(),requestState:s().optional()},Js=l({_meta:Gt,...St}),Bs=T({progressToken:o.optional()});function de(W,bt){return l({method:u(W),params:l({_meta:Gt,...bt})})}function pe(W,bt){return l({method:u(W),params:l({_meta:Bs.optional(),...bt}).optional()})}let $r={name:s(),arguments:y(s(),R()).optional(),...St},Se={cursor:r.optional()},Ws=de("tools/call",$r),Gs=de("tools/list",Se),Ks=de("prompts/list",Se),Ys=de("prompts/get",{name:s(),arguments:y(s(),s()).optional(),...St}),Qs=de("resources/list",Se),Xs=de("resources/templates/list",Se),ei=de("resources/read",{uri:s(),...St}),Cr={ref:z([ht,pt]),argument:l({name:s(),value:s()}),context:l({arguments:y(s(),s()).optional()}).optional()},ti=de("completion/complete",Cr),oi=de("server/discover",{}),to=l({toolsListChanged:v().optional(),promptsListChanged:v().optional(),resourcesListChanged:v().optional(),resourceSubscriptions:h(s()).optional()}),Ir={notifications:to},ri=de("subscriptions/listen",Ir),ni=Qt.extend({"io.modelcontextprotocol/subscriptionId":n}),Or=T({_meta:ni,resultType:Yt.default("complete")}),Be={"tools/call":pe("tools/call",$r),"tools/list":pe("tools/list",Se),"prompts/get":pe("prompts/get",{name:s(),arguments:y(s(),s()).optional()}),"prompts/list":pe("prompts/list",Se),"resources/list":pe("resources/list",Se),"resources/templates/list":pe("resources/templates/list",Se),"resources/read":pe("resources/read",{uri:s()}),"completion/complete":pe("completion/complete",Cr),"server/discover":pe("server/discover",{}),"subscriptions/listen":pe("subscriptions/listen",Ir)};function ue(W){return T({_meta:Xt,...W})}let si={"tools/call":ue({content:h(Ve),structuredContent:R().optional(),isError:v().optional()}),"tools/list":ue({ttlMs:g().int().min(0),cacheScope:C(["public","private"]),tools:h(mt),nextCursor:r.optional()}),"prompts/get":ue({description:s().optional(),messages:h(Bt)}),"prompts/list":ue({ttlMs:g().int().min(0),cacheScope:C(["public","private"]),prompts:h(ct),nextCursor:r.optional()}),"resources/list":ue({ttlMs:g().int().min(0),cacheScope:C(["public","private"]),resources:h(He),nextCursor:r.optional()}),"resources/templates/list":ue({ttlMs:g().int().min(0),cacheScope:C(["public","private"]),resourceTemplates:h(Ht),nextCursor:r.optional()}),"resources/read":ue({ttlMs:g().int().min(0),cacheScope:C(["public","private"]),contents:h(z([De,at]))}),"completion/complete":ue({completion:l({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:Wt,instructions:s().optional()}),"subscriptions/listen":ue({})},_t=T({"io.modelcontextprotocol/subscriptionId":n.optional()}),oo=l({method:u("notifications/subscriptions/acknowledged"),params:l({_meta:_t.optional(),notifications:to})}),ro=l({_meta:_t.optional(),requestId:n,reason:s().optional()}),no=l({method:u("notifications/cancelled"),params:ro}),da={"notifications/cancelled":no,"notifications/progress":it,"notifications/message":Uo,"notifications/resources/updated":Vt,"notifications/resources/list_changed":Ce,"notifications/tools/list_changed":Vo,"notifications/prompts/list_changed":Jt,"notifications/subscriptions/acknowledged":oo},ae=(W)=>l({jsonrpc:u("2.0"),id:z([s(),g().int()]),result:W}).strict();return{JSONValueSchema:e,JSONObjectSchema:t,ProgressTokenSchema:o,CursorSchema:r,RequestIdSchema:n,RoleSchema:i,LoggingLevelSchema:a,TaskMetadataSchema:p,RelatedTaskMetadataSchema:d,RequestMetaSchema:f,BaseRequestParamsSchema:S,TaskAugmentedRequestParamsSchema:_,NotificationsParamsSchema:b,NotificationSchema:P,IconSchema:k,IconsSchema:E,BaseMetadataSchema:I,ImplementationSchema:D,ClientTasksCapabilitySchema:H,ServerTasksCapabilitySchema:U,ClientCapabilitiesSchema:K,ServerCapabilitiesSchema:$e,ProgressSchema:ie,ProgressNotificationParamsSchema:Ze,ProgressNotificationSchema:it,LoggingMessageNotificationParamsSchema:Lo,LoggingMessageNotificationSchema:Uo,ResourceContentsSchema:Dt,TextResourceContentsSchema:De,BlobResourceContentsSchema:at,AnnotationsSchema:ze,ResourceSchema:He,ResourceTemplateSchema:Ht,ResourceListChangedNotificationSchema:Ce,ResourceUpdatedNotificationParamsSchema:Ie,ResourceUpdatedNotificationSchema:Vt,PromptArgumentSchema:Ft,PromptSchema:ct,PromptListChangedNotificationSchema:Jt,TextContentSchema:ve,ImageContentSchema:ge,AudioContentSchema:lt,ToolUseContentSchema:Zo,EmbeddedResourceSchema:Do,ResourceLinkSchema:Ho,ContentBlockSchema:Ve,PromptMessageSchema:Bt,ToolAnnotationsSchema:ut,ToolListChangedNotificationSchema:Vo,ModelHintSchema:Fo,ModelPreferencesSchema:Jo,ToolChoiceSchema:Bo,BooleanSchemaSchema:Wo,StringSchemaSchema:Go,NumberSchemaSchema:Ko,UntitledSingleSelectEnumSchemaSchema:Yo,TitledSingleSelectEnumSchemaSchema:Qo,LegacyTitledEnumSchemaSchema:Xo,SingleSelectEnumSchemaSchema:er,UntitledMultiSelectEnumSchemaSchema:tr,TitledMultiSelectEnumSchemaSchema:or,MultiSelectEnumSchemaSchema:rr,EnumSchemaSchema:nr,PrimitiveSchemaDefinitionSchema:sr,ElicitRequestFormParamsSchema:dt,ResourceTemplateReferenceSchema:pt,PromptReferenceSchema:ht,RootSchema:ir,ClientCapabilities2026Schema:ar,ServerCapabilities2026Schema:Wt,RequestMetaEnvelopeSchema:Gt,ToolSchema:mt,ToolResultContentSchema:cr,SamplingMessageContentBlockSchema:Kt,SamplingMessageSchema:ft,ResultTypeSchema:Yt,ResultMetaSchema:Qt,ResultSchema:lr,PaginatedResultSchema:Vs,CallToolResultSchema:eo,ListToolsResultSchema:ur,ListPromptsResultSchema:dr,GetPromptResultSchema:pr,ListResourcesResultSchema:hr,ListResourceTemplatesResultSchema:mr,ReadResourceResultSchema:fr,CompleteResultSchema:gr,CacheableResultSchema:Fs,DiscoverResultSchema:Sr,CreateMessageRequestParamsSchema:Je,CreateMessageRequestSchema:_r,ListRootsRequestSchema:br,CreateMessageResultSchema:yr,ListRootsResultSchema:zr,ElicitResultSchema:vr,ElicitRequestURLParamsSchema:Rr,ElicitRequestParamsSchema:wr,ElicitRequestSchema:xr,InputRequestSchema:Pr,InputResponseSchema:Tr,InputRequestsSchema:kr,InputResponsesSchema:Er,InputRequiredResultSchema:gt,InputResponseRequestParamsSchema:Js,CallToolRequestSchema:Ws,ListToolsRequestSchema:Gs,ListPromptsRequestSchema:Ks,GetPromptRequestSchema:Ys,ListResourcesRequestSchema:Qs,ListResourceTemplatesRequestSchema:Xs,ReadResourceRequestSchema:ei,CompleteRequestSchema:ti,DiscoverRequestSchema:oi,SubscriptionFilterSchema:to,SubscriptionsListenRequestSchema:ri,SubscriptionsListenResultMetaSchema:ni,SubscriptionsListenResultSchema:Or,dispatchRequestSchemas:Be,dispatchResultSchemas:si,NotificationMetaSchema:_t,SubscriptionsAcknowledgedNotificationSchema:oo,CancelledNotificationParamsSchema:ro,CancelledNotificationSchema:no,notificationSchemas2026:da,JSONRPCResultResponseSchema:ae(lr),CallToolResultResponseSchema:ae(z([eo,gt])),ListToolsResultResponseSchema:ae(ur),ListPromptsResultResponseSchema:ae(dr),GetPromptResultResponseSchema:ae(z([pr,gt])),ListResourcesResultResponseSchema:ae(hr),ListResourceTemplatesResultResponseSchema:ae(mr),ReadResourceResultResponseSchema:ae(z([fr,gt])),CompleteResultResponseSchema:ae(gr),DiscoverResultResponseSchema:ae(Sr),SubscriptionsListenResultResponseSchema:ae(Or)}}var sg;function st(){return sg??=ng()}var ig=["tools/list","prompts/list","resources/list","resources/templates/list","resources/read","server/discover"];function ag(e){return ig.includes(e)}var Lc=Symbol("modelcontextprotocol.resultCacheHintFallback");function cg(e){return e[Lc]}function xh(e){return typeof e==="number"&&Number.isSafeInteger(e)&&e>=0}function Ph(e){return e==="public"||e==="private"}var O=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 me(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 me(this,t)}constructor(t,o,r){super(o);this.code=t,this.data=r,this.name="ProtocolError",Zt(this,new.target)}static fromError(t,o,r){if(t===O.UrlElicitationRequired&&r){let n=r;if(n.elicitations)return new kh(n.elicitations,o)}if(t===O.UnsupportedProtocolVersion&&r){let n=r;if(Array.isArray(n.supported)&&typeof n.requested==="string")return new Eh({supported:n.supported,requested:n.requested},o)}if(t===O.InvalidParams||t===O.ResourceNotFound){let n=r;if(typeof n?.uri==="string"&&(t===O.ResourceNotFound||Object.keys(n).length===1))return new Th(n.uri,o)}if(t===O.MissingRequiredClientCapability&&r){let n=r;if(n.requiredCapabilities!==null&&typeof n.requiredCapabilities==="object"&&!Array.isArray(n.requiredCapabilities))return new $h({requiredCapabilities:n.requiredCapabilities},o)}return new e(t,o,r)}},Th=class extends oe{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.ResourceNotFoundError"})}constructor(e,t=`Resource not found: ${e}`){super(O.InvalidParams,t,{uri:e})}get uri(){return this.data.uri}},kh=class extends oe{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.UrlElicitationRequiredError"})}constructor(e,t=`URL elicitation${e.length>1?"s":""} required`){super(O.UrlElicitationRequired,t,{elicitations:e})}get elicitations(){return this.data?.elicitations??[]}},Eh=class extends oe{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.UnsupportedProtocolVersionError"})}constructor(e,t=`Unsupported protocol version: ${e.requested}`){super(O.UnsupportedProtocolVersion,t,e)}get supported(){return this.data.supported}get requested(){return this.data.requested}},$h=class extends oe{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.MissingRequiredClientCapabilityError"})}constructor(e,t=`Missing required client capabilities: ${Object.keys(e.requiredCapabilities).join(", ")}`){super(O.MissingRequiredClientCapability,t,e)}get requiredCapabilities(){return this.data.requiredCapabilities}},lg=0,ug="private",dg=["tools/call","prompts/get","resources/read"];function pg(e,t){let o=t.resultType;if(o===void 0)return{...t,resultType:"complete"};if(o==="complete")return t;if(dg.includes(e))return t;throw new oe(O.InternalError,`Handler for ${e} returned resultType '${String(o)}', but results of ${e} only support 'complete' on protocol revision 2026-07-28`)}function hg(e,t){let o=cg(t);if(t.resultType!=="complete"||!ag(e))return o===void 0?t:_g(t);let r=t,n=xh(r.ttlMs)?r.ttlMs:gg(o),i=Ph(r.cacheScope)?r.cacheScope:Sg(o),a={...r,ttlMs:n,cacheScope:i};return delete a[Lc],a}function mg(e){return e!==null&&typeof e==="object"&&!Array.isArray(e)}function fg(e,t){if(t===void 0)return e;let o=e._meta;if(o===void 0)return{...e,_meta:{[et]:t}};if(!mg(o))return e;if(o[et]!==void 0)return e;return{...e,_meta:{...o,[et]:t}}}function gg(e){return e!==void 0&&xh(e.ttlMs)?e.ttlMs:lg}function Sg(e){return e!==void 0&&Ph(e.cacheScope)?e.cacheScope:ug}function _g(e){let t={...e};return delete t[Lc],t}var bg=["elicitation/create","sampling/createMessage","roots/list"],ca;function Ch(){if(ca)return ca;let e=st();return ca={request:{"elicitation/create":l({method:u("elicitation/create"),params:e.ElicitRequestParamsSchema}),"sampling/createMessage":l({method:u("sampling/createMessage"),params:e.CreateMessageRequestParamsSchema}),"roots/list":l({method:u("roots/list"),params:T({}).optional()})},response:{"elicitation/create":e.ElicitResultSchema,"sampling/createMessage":e.CreateMessageResultSchema,"roots/list":e.ListRootsResultSchema}},ca}function Ih(e){return bg.includes(e)}function Pc(e){return Ih(e)?Ch().request[e]:void 0}function yg(e){return Ih(e)?Ch().response[e]:void 0}var Uc={"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},Oh={"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 Nh(e){return Object.prototype.hasOwnProperty.call(Uc,e)}function Mh(e){return Object.prototype.hasOwnProperty.call(Oh,e)}function zg(e){return Object.prototype.hasOwnProperty.call(Uc,e)}function vg(e){return Nh(e)?st().dispatchRequestSchemas[e]:void 0}function Rg(e){return zg(e)?st().dispatchResultSchemas[e]:void 0}function wg(e){return Mh(e)?st().notificationSchemas2026[e]:void 0}var dy=Object.keys(Uc),py=Object.keys(Oh);function js(e){return e!==null&&typeof e==="object"&&!Array.isArray(e)}function qs(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 xg={ok:!1,reason:"not-in-era"},Pg=[Pt,Tt];function Tg(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((c)=>js(c)&&("execution"in c)))n().tools=i.map((c)=>{if(!js(c)||!("execution"in c))return c;let p={...c};return delete p.execution,p});let a=t.capabilities;if(js(a)&&"tasks"in a){let c={...a};delete c.tasks,n().capabilities=c}return o}var Zc={era:"2026-07-28",hasRequestMethod:Nh,hasNotificationMethod:Mh,hasInputRequestMethod:(e)=>Pc(e)!==void 0,validateRequest:(e,t)=>qs(vg(e),t),validateResult:(e,t)=>qs(Rg(e),t),validateNotification:(e,t)=>qs(wg(e),t),validateInputRequest:(e,t)=>qs(Pc(e),t),validateInputResponse:(e,t)=>qs(yg(e),t),samplingResultVariant:()=>xg,outboundEnvelope(e){return{[Pt]:e.protocolVersion,[po]:e.clientInfo,[Tt]:e.clientCapabilities,...e.logLevel!==void 0&&{[ho]:e.logLevel}}},validateEnvelopeMeta(e){let t=[];for(let r of Pg)if(!(r in e))t.push({key:r,problem:"missing"});let o=st().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)=>Sh(e),inputRequestSchema:Pc,decodeResult(e,t){if(!js(t))return{kind:"invalid",error:new G(te.InvalidResult,`Invalid result for ${e}: not an object`,{method:e})};let o=t.resultType;if(o===void 0)return{kind:"invalid",error:new G(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 G(te.InvalidResult,`Invalid result for ${e}: non-string resultType`,{method:e,resultType:o})};if(o==="input_required"){let a=t.inputRequests,c=js(a)?a:{},p=t.requestState,d=t._meta===void 0?void 0:st().ResultMetaSchema.safeParse(t._meta),f=d?.success?d.data:void 0;if(Object.keys(c).length===0&&typeof p!=="string")return{kind:"invalid",error:new G(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:c,...typeof p==="string"&&{requestState:p},...f!==void 0&&{_meta:f}}}if(o!=="complete")return{kind:"invalid",error:new G(te.UnsupportedResultType,`Unsupported result type '${o}' for ${e}`,{resultType:o,method:e})};let r=kg(),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 G(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 fg(hg(e,pg(e,Tg(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=st().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("; ")}`}},la;function kg(){if(la)return la;let e=st();return la={"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},la}var Dc="2026-07-28";function Us(e){return e!==void 0&&gh(e)?Zc:jc}function lh(e){if(e.revision!==void 0)return Us(e.revision).era;return e.era==="modern"?Zc.era:jc.era}function Tc(e){return qh.some((t)=>t.hasRequestMethod(e))}function kc(e){return qh.some((t)=>t.hasNotificationMethod(e))}function uh(e){return e==="tasks/get"||e==="tasks/cancel"}var qh=[jc,Zc],Eg=Kc({AnnotationsSchema:()=>Pe,AudioContentSchema:()=>Mt,BaseMetadataSchema:()=>we,BaseRequestParamsSchema:()=>Q,BlobResourceContentsSchema:()=>To,BooleanSchemaSchema:()=>Co,CallToolRequestParamsSchema:()=>Vn,CallToolRequestSchema:()=>Fn,CallToolResultSchema:()=>nt,CancelTaskRequestSchema:()=>Ki,CancelTaskResultSchema:()=>Yi,CancelledNotificationParamsSchema:()=>Yr,CancelledNotificationSchema:()=>yo,ClientCapabilitiesSchema:()=>Xr,ClientNotificationSchema:()=>Xi,ClientRequestSchema:()=>Qi,ClientResultSchema:()=>ea,ClientTasksCapabilitySchema:()=>Ai,CompatibilityCallToolResultSchema:()=>Li,CompleteRequestParamsSchema:()=>_s,CompleteRequestSchema:()=>bs,CompleteResultSchema:()=>ys,ContentBlockSchema:()=>Te,CreateMessageRequestParamsSchema:()=>rs,CreateMessageRequestSchema:()=>ns,CreateMessageResultSchema:()=>ss,CreateMessageResultWithToolsSchema:()=>is,CreateTaskResultSchema:()=>Di,CursorSchema:()=>fo,DiscoverRequestSchema:()=>nn,DiscoverResultSchema:()=>vo,ElicitRequestFormParamsSchema:()=>Ut,ElicitRequestParamsSchema:()=>ds,ElicitRequestSchema:()=>ps,ElicitRequestURLParamsSchema:()=>us,ElicitResultSchema:()=>fs,ElicitationCompleteNotificationParamsSchema:()=>hs,ElicitationCompleteNotificationSchema:()=>ms,EmbeddedResourceSchema:()=>qt,EmptyResultSchema:()=>ot,EnumSchemaSchema:()=>ls,GetPromptRequestParamsSchema:()=>Nn,GetPromptRequestSchema:()=>Mn,GetPromptResultSchema:()=>jn,GetTaskPayloadRequestSchema:()=>Ji,GetTaskPayloadResultSchema:()=>Bi,GetTaskRequestSchema:()=>Vi,GetTaskResultSchema:()=>Fi,IconSchema:()=>Qr,IconsSchema:()=>qe,ImageContentSchema:()=>Nt,ImplementationSchema:()=>xe,InitializeRequestParamsSchema:()=>en,InitializeRequestSchema:()=>tn,InitializeResultSchema:()=>on,InitializedNotificationSchema:()=>rn,JSONArraySchema:()=>Mi,JSONObjectSchema:()=>F,JSONRPCErrorResponseSchema:()=>$t,JSONRPCMessageSchema:()=>Ct,JSONRPCNotificationSchema:()=>bo,JSONRPCRequestSchema:()=>_o,JSONRPCResponseSchema:()=>qi,JSONRPCResultResponseSchema:()=>Et,JSONValueSchema:()=>Me,LegacyTitledEnumSchemaSchema:()=>No,ListChangedOptionsBaseSchema:()=>Ui,ListPromptsRequestSchema:()=>In,ListPromptsResultSchema:()=>On,ListResourceTemplatesRequestSchema:()=>pn,ListResourceTemplatesResultSchema:()=>hn,ListResourcesRequestSchema:()=>un,ListResourcesResultSchema:()=>dn,ListRootsRequestSchema:()=>vs,ListRootsResultSchema:()=>Rs,ListTasksRequestSchema:()=>Wi,ListTasksResultSchema:()=>Gi,ListToolsRequestSchema:()=>Dn,ListToolsResultSchema:()=>Hn,LoggingLevelSchema:()=>$o,LoggingMessageNotificationParamsSchema:()=>Gn,LoggingMessageNotificationSchema:()=>Kn,ModelHintSchema:()=>Yn,ModelPreferencesSchema:()=>Qn,MultiSelectEnumSchemaSchema:()=>cs,NotificationSchema:()=>ee,NotificationsParamsSchema:()=>se,NumberSchemaSchema:()=>Lt,PaginatedRequestParamsSchema:()=>cn,PaginatedRequestSchema:()=>Ae,PaginatedResultSchema:()=>je,PingRequestSchema:()=>Ro,PrimitiveSchemaDefinitionSchema:()=>Ao,ProgressNotificationParamsSchema:()=>an,ProgressNotificationSchema:()=>wo,ProgressSchema:()=>sn,ProgressTokenSchema:()=>mo,PromptArgumentSchema:()=>$n,PromptListChangedNotificationSchema:()=>Ln,PromptMessageSchema:()=>An,PromptReferenceSchema:()=>Ss,PromptSchema:()=>Cn,ReadResourceRequestParamsSchema:()=>mn,ReadResourceRequestSchema:()=>fn,ReadResourceResultSchema:()=>gn,RelatedTaskMetadataSchema:()=>Kr,RequestIdSchema:()=>ye,RequestMetaSchema:()=>go,RequestSchema:()=>J,ResourceContentsSchema:()=>xo,ResourceLinkSchema:()=>At,ResourceListChangedNotificationSchema:()=>Sn,ResourceRequestParamsSchema:()=>It,ResourceSchema:()=>ko,ResourceTemplateReferenceSchema:()=>gs,ResourceTemplateSchema:()=>ln,ResourceUpdatedNotificationParamsSchema:()=>kn,ResourceUpdatedNotificationSchema:()=>En,ResultMetaObjectSchema:()=>So,ResultSchema:()=>B,RoleSchema:()=>Le,RootSchema:()=>zs,RootsListChangedNotificationSchema:()=>ws,SamplingContentSchema:()=>ts,SamplingMessageContentBlockSchema:()=>Xe,SamplingMessageSchema:()=>os,ServerCapabilitiesSchema:()=>zo,ServerNotificationSchema:()=>oa,ServerRequestSchema:()=>ta,ServerResultSchema:()=>ra,ServerTasksCapabilitySchema:()=>ji,SetLevelRequestParamsSchema:()=>Bn,SetLevelRequestSchema:()=>Wn,SingleSelectEnumSchemaSchema:()=>as,StringSchemaSchema:()=>jt,SubscribeRequestParamsSchema:()=>_n,SubscribeRequestSchema:()=>bn,SubscriptionFilterSchema:()=>Eo,SubscriptionsAcknowledgedNotificationParamsSchema:()=>wn,SubscriptionsAcknowledgedNotificationSchema:()=>xn,SubscriptionsListenRequestParamsSchema:()=>vn,SubscriptionsListenRequestSchema:()=>Rn,SubscriptionsListenResultMetaSchema:()=>Pn,SubscriptionsListenResultSchema:()=>Tn,TaskAugmentedRequestParamsSchema:()=>tt,TaskCreationParamsSchema:()=>Zi,TaskMetadataSchema:()=>Gr,TaskSchema:()=>Ue,TaskStatusNotificationParamsSchema:()=>Ps,TaskStatusNotificationSchema:()=>Hi,TaskStatusSchema:()=>xs,TextContentSchema:()=>Ot,TextResourceContentsSchema:()=>Po,TitledMultiSelectEnumSchemaSchema:()=>qo,TitledSingleSelectEnumSchemaSchema:()=>Oo,ToolAnnotationsSchema:()=>Un,ToolChoiceSchema:()=>Xn,ToolExecutionSchema:()=>Zn,ToolListChangedNotificationSchema:()=>Jn,ToolResultContentSchema:()=>es,ToolSchema:()=>rt,ToolUseContentSchema:()=>qn,UnsubscribeRequestParamsSchema:()=>yn,UnsubscribeRequestSchema:()=>zn,UntitledMultiSelectEnumSchemaSchema:()=>Mo,UntitledSingleSelectEnumSchemaSchema:()=>Io});var Ah=(e)=>_o.safeParse(e).success,jh=(e)=>bo.safeParse(e).success,Oc=(e)=>Et.safeParse(e).success,Lh=(e)=>$t.safeParse(e).success;var Ls=-32020,hy=[{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:[O.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:[Ls,O.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:[O.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:[O.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:[O.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:[Ls],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:[O.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:[Ls],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."}],my={[O.ParseError]:400,[O.InvalidRequest]:400,[O.MethodNotFound]:404,[O.UnsupportedProtocolVersion]:400,[O.MissingRequiredClientCapability]:400,[Ls]:400};function Hc(e,t){return Pi(e,t)}function As(e){return new Set(e.flatMap((t)=>Object.keys(t.shape)))}function Nc(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 dh=!1,Mc="draft-2020-12";function $g(e,t="input"){let o=e["~standard"],r;if(o.jsonSchema)r=o.jsonSchema[t]({target:Mc});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(!dh)dh=!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=wi(e,{target:Mc,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 Uh(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 Uh(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"||Uh(r)))}return!1}function Cg(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 Ec(e,t){let o=await e["~standard"].validate(t);if(o.issues&&o.issues.length>0)return{success:!1,error:o.issues.map((r)=>Cg(r)).join(", ")};return{success:!0,data:o.value}}function Ig(e){let t=wi(e,{target:Mc,io:"input"});return typeof t.pattern==="string"?t.pattern:void 0}var Og=/\\\.\\d\{(\d+)\}/;function Ng(e){let t=Og.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)=>lo({local:r,offset:n,precision:i}))))}function Mg(e,t){let o;switch(e){case"email":o=[jp()];break;case"uri":o=[ki()];break;case"date":o=[bc()];break;case"date-time":o=Ng(t);break}return new Set(o.map((r)=>Ig(r)).filter((r)=>r!==void 0))}function qg(e,t,o){if(o!=="zod")return!0;return Mg(e,t).has(t)}function Zs(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}function Ag(e){try{return $g(e,"input")}catch(t){let o=t instanceof Error?t.message:String(t);throw new oe(O.InvalidParams,`Elicitation requestedSchema must describe an object with flat primitive properties: ${o}`)}}var jg=new Set(["$comment","deprecated","description","examples","readOnly","title","writeOnly"]);function Vc(e){return jg.has(e)||e.startsWith("x-")}var Lg=new Set(["$schema",...Object.keys(Ut.shape.requestedSchema.shape)]),ph={string:As([jt,Io,Oo,No]),number:As([Lt]),integer:As([Lt]),boolean:As([Co]),array:As([Mo,qo])},Ug=new Set(jt.shape.format.unwrap().options);function Zg(e,t,o,r){if(!Zs(e))return e;let n=typeof e.type==="string"&&Object.hasOwn(ph,e.type)?ph[e.type]:void 0;if(n===void 0)return e;let i={};for(let[a,c]of Object.entries(e))if(n.has(a)||Vc(a))i[a]=c;else if(a==="pattern"&&e.type==="string"&&typeof e.format==="string"){if(!Ug.has(e.format))i[a]=c;else if(typeof c!=="string"||!qg(e.format,c,o))r.push(`${t}.${a}`)}else r.push(`${t}.${a}`);return i}function Dg(e,t){let o={},r=[];for(let[n,i]of Object.entries(e))if(n==="properties"&&Zs(i))o[n]=Object.fromEntries(Object.entries(i).map(([a,c])=>[a,Zg(c,`properties.${a}`,t,r)]));else if(Lg.has(n))o[n]=i;else if(!Vc(n))r.push(n);if(r.length>0)throw new oe(O.InvalidParams,`Elicitation requestedSchema contains unsupported JSON Schema constraint(s) after Standard Schema conversion: ${r.join(", ")}`);return o}function Hg(e,t){if(!Zs(e.properties))return t;let o=Object.entries(e.properties).filter(([,r])=>!Hc(Ao,r).success).map(([r])=>`properties.${r}`);return o.length>0?o.join(", "):t}function qc(e,t,o=""){if(Array.isArray(e)&&Array.isArray(t))return e.flatMap((r,n)=>qc(r,t[n],`${o}[${n}]`));if(!Zs(e)||!Zs(t))return[];return Object.entries(e).flatMap(([r,n])=>{let i=o?`${o}.${r}`:r;if(!Object.prototype.hasOwnProperty.call(t,r))return Vc(r)?[]:[i];return qc(n,t[r],i)})}function Vg(e){if(!Nc(e.requestedSchema))return{...e,mode:"form",requestedSchema:e.requestedSchema};let t=e.requestedSchema["~standard"].vendor,o=Dg(Ag(e.requestedSchema),t),r=Hc(Ut.shape.requestedSchema,o);if(!r.success)throw new oe(O.InvalidParams,`Elicitation requestedSchema only supports flat primitive properties (string, number, integer, boolean, and string enums): ${Hg(o,r.error.message)}`);let n=qc(o,r.data);if(n.length>0)throw new oe(O.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(O.InvalidParams,`Elicitation requestedSchema lists required properties that are not defined in properties: ${i.join(", ")}`);return{...e,mode:"form",requestedSchema:r.data}}function Fg(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 fy=Object.assign(Fg,{elicit(e){try{return{method:"elicitation/create",params:Vg(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 Jg=["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"],Bg={IdJagTokenExchangeResponseSchema:Cs,OAuthClientInformationFullSchema:Ms,OAuthClientInformationSchema:Ns,OAuthClientMetadataSchema:Os,OAuthClientRegistrationErrorSchema:na,OAuthErrorResponseSchema:Is,OAuthMetadataSchema:jo,OAuthProtectedResourceMetadataSchema:Ts,OAuthTokenRevocationRequestSchema:sa,OAuthTokensSchema:$s,OpenIdProviderDiscoveryMetadataSchema:Es,OpenIdProviderMetadataSchema:ks},Zh={},Dh={};function Hh(e,t){let o=e.slice(0,-6);Zh[o]=t,Dh[o]=(r)=>t.safeParse(r).success}for(let e of Jg)Hh(e,Eg[e]);for(let[e,t]of Object.entries(Bg))Hh(e,t);var Wg=Object.freeze(Zh),Gg=Object.freeze(Dh);function Kg(e){switch(e){case"initialize":case"notifications/initialized":return Us(void 0);case"server/discover":return Us(Dc);default:return}}var Vh=60000,Yg=[Pt,po,Tt,ho],Qg=["inputResponses","requestState"];function hh(e,t){let o=e.params;if(!$c(o))return{message:e,lifted:{}};let r=o._meta,n=$c(r)?Yg.filter((p)=>(p in r)):[],i=t==="request"?Qg.filter((p)=>(p in o)):[];if(n.length===0&&i.length===0)return{message:e,lifted:{}};let a={},c={...o};if(n.length>0&&$c(r)){let p={},d={...r};for(let f of n)p[f]=r[f],delete d[f];if(a.envelope=p,Object.keys(d).length>0)c._meta=d;else delete c._meta}for(let p of i){if(p==="inputResponses")a.inputResponses=c[p];if(p==="requestState")a.requestState=c[p];delete c[p]}return{message:{...e,params:c},lifted:a}}function mh(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 Fh(e){return()=>e}var Xg=Fh(void 0),eS,Fc=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{eS=(e,t)=>{e._negotiatedProtocolVersion=t}}_supportedProtocolVersions;onclose;onerror;fallbackRequestHandler;fallbackNotificationHandler;constructor(e){this._options=e,this._supportedProtocolVersions=e?.supportedProtocolVersions??Ii,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 G(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 G(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),Oc(n)||Lh(n))this._onresponse(n);else if(Ah(n))this._onrequest(n,i);else if(jh(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 G(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}=hh(e,"notification"),r=this._negotiatedWireCodec();if(t?.classification===void 0&&this._shouldDropInbound(e)==="drop")return;if(t?.classification!==void 0){let a=lh(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(kc(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}=hh(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=(k,E,I)=>{let D={jsonrpc:"2.0",id:o.id,error:{code:k,message:E,...I!==void 0&&{data:I}}};i?.send(D).catch((M)=>this._onerror(Error(`Failed to send an error response: ${M}`)))};if(t?.classification!==void 0){let k=lh(t.classification);if(k!==n.era){this._onerror(Error(`Era mismatch on inbound request '${o.method}': classified as ${k} but this instance serves ${n.era}`));let E=t.classification.revision??k;a(O.UnsupportedProtocolVersion,`Unsupported protocol version: ${E}`,{supported:this._supportedProtocolVersions,requested:E});return}}if(Tc(o.method)&&!n.hasRequestMethod(o.method)&&!(uh(o.method)&&this._customSchemaRequestMethods.has(o.method))){a(O.MethodNotFound,"Method not found");return}let c=this._requestHandlers.get(o.method)??this.fallbackRequestHandler;if(c===void 0){a(O.MethodNotFound,"Method not found");return}let p=n.checkInboundEnvelope(r);if(p!==void 0){a(O.InvalidParams,p);return}let d=(k,E)=>this._notificationViaCodec(this._resolveOutboundCodec(k.method),k,{...E,relatedRequestId:o.id}),f=(k,E,I)=>this._requestWithSchemaViaCodec(this._resolveOutboundCodec(k.method),k,E,{...I,relatedRequestId:o.id}),S=new AbortController;this._requestHandlerAbortControllers.set(o.id,S);let _=r.inputResponses===void 0?void 0:tS(r.inputResponses),b={sessionId:i?.sessionId,mcpReq:{id:o.id,method:o.method,_meta:o.params?._meta,...r.envelope!==void 0&&{envelope:r.envelope},..._!==void 0&&{inputResponses:_.accepted},..._!==void 0&&_.droppedKeys.length>0&&{droppedInputResponseKeys:_.droppedKeys},requestState:r.requestState===void 0?Xg:Fh(r.requestState),signal:S.signal,send:(k,E,I)=>{let D=this._resolveOutboundCodec(k.method);if(this._assertOutboundRequestInEra(D,k.method),Nc(E))return f(k,E,I);let M=mh(D,k.method);if(M===void 0)throw TypeError(`'${k.method}' is not a spec method; pass a result schema as the second argument to ctx.mcpReq.send().`);return f(k,M,E)},notify:d},http:t?.authInfo?{authInfo:t.authInfo}:void 0},P=this.buildContext(b,t);Promise.resolve().then(()=>c(o,P)).then(async(k)=>{if(S.signal.aborted)return;let E;try{E=n.encodeResult(o.method,k,this._outboundServerInfo())}catch(D){this._onerror(Error(`Failed to encode result for ${o.method}: ${D}`)),a(O.InternalError,"Internal error");return}let I={result:E,jsonrpc:"2.0",id:o.id};await i?.send(I)},async(k)=>{if(S.signal.aborted)return;let E=Number.isSafeInteger(k.code)?k.code:O.InternalError,I={jsonrpc:"2.0",id:o.id,error:{code:n.encodeErrorCode(E),message:k.message??"Internal error",...k.data!==void 0&&{data:k.data}}};await i?.send(I)}).catch((k)=>this._onerror(Error(`Failed to send response: ${k}`))).finally(()=>{if(this._requestHandlerAbortControllers.get(o.id)===S)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(c){this._responseHandlers.delete(r),this._progressHandlers.delete(r),this._cleanupTimeout(r),i(c);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),Oc(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(Nc(t)){if(!uh(e.method))this._assertOutboundRequestInEra(r,e.method);return this._requestWithSchemaViaCodec(r,e,t,o)}this._assertOutboundRequestInEra(r,e.method);let n=mh(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 Us(this._negotiatedProtocolVersion)}_wireCodec(){return this._negotiatedWireCodec()}_resolveOutboundCodec(e){if(this._negotiatedProtocolVersion===void 0){let t=Kg(e);if(t)return t}return this._negotiatedWireCodec()}_assertOutboundRequestInEra(e,t){if(Tc(t)&&!e.hasRequestMethod(t))throw new G(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:c}=r??{},p=Date.now(),d,f;return new Promise((S,_)=>{let b=(U)=>{_(U)};if(!this._transport){b(Error("Not connected"));return}if(this._options?.enforceStrictCapabilities===!0)try{this.assertCapabilityForMethod(t.method)}catch(U){b(U);return}if(r?.signal?.aborted){let U=r.signal.reason;throw U instanceof G?U:new G(te.RequestTimeout,String(U))}let P=e.era===Dc&&this._transport.hasPerRequestStream===!0?new AbortController:void 0,k=this._requestMessageId++;f=k;let E={...t,jsonrpc:"2.0",id:k};if(r?.onprogress)this._progressHandlers.set(k,r.onprogress),E.params={...t.params,_meta:{...t.params?._meta,progressToken:k}};let I=this._envelopeOutbound(E),D=!1,M=(U)=>{if(D)return;if(this._progressHandlers.delete(k),P===void 0){if(t.method!=="initialize")this._transport?.send(this._envelopeOutbound({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:k,reason:String(U)}}),{relatedRequestId:n,resumptionToken:i,onresumptiontoken:a}).catch((K)=>this._onerror(Error(`Failed to send cancellation: ${K}`)))}else P.abort();_(U instanceof G?U:new G(te.RequestTimeout,String(U)))};this._responseHandlers.set(k,(U)=>{if(r?.signal?.aborted)return;if(D=!0,U instanceof Error)return _(U);let K;try{K=e.decodeResult(t.method,U.result)}catch(ie){return _(ie instanceof Error?ie:Error(String(ie)))}if(K.kind==="invalid")return _(K.error);if(K.kind==="input_required"){if(r?.allowInputRequired===!0)return S(oS(K));let ie={codec:e,request:t,resultSchema:o,options:r,flowStartedAt:p,retry:(Ze,it)=>this._requestWithSchemaViaCodec(e,Ze===void 0?{method:t.method}:{method:t.method,params:Ze},o,it)};return S(this._resolveNonCompleteResult(K,ie))}let $e=K.result;Ec(o,$e).then((ie)=>{if(ie.success)S(ie.data);else _(new G(te.InvalidResult,`Invalid result for ${t.method}: ${ie.error}`))},_)}),d=()=>M(r?.signal?.reason),r?.signal?.addEventListener("abort",d,{once:!0});let q=r?.timeout??Vh,H=()=>M(new G(te.RequestTimeout,"Request timed out",{timeout:q}));this._setupTimeout(k,q,r?.maxTotalTimeout,H,r?.resetTimeoutOnProgress??!1),this._transport.send(I,{relatedRequestId:n,resumptionToken:i,onresumptiontoken:a,headers:c,requestSignal:P?.signal}).catch((U)=>{this._progressHandlers.delete(k),_(U)})}).finally(()=>{if(d)r?.signal?.removeEventListener("abort",d);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 G(te.NotConnected,"Not connected");if(kc(t.method)&&!e.hasNotificationMethod(t.method))throw new G(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(!Tc(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(),c=a.validateRequest(e,n);if(!c.ok&&c.reason==="not-in-era")c=a.validateInputRequest(e,n);if(!c.ok){if(c.reason==="not-in-era")throw new oe(O.InternalError,`No wire schema for ${e} in the resolved era`);throw Error(c.message)}return Promise.resolve(t(c.value,i))}}else if(o)r=async(n,i)=>{let a=await Ec(t.params,{...n.params});if(!a.success)throw new oe(O.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(!kc(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(O.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 Ec(t.params,{...r.params});if(!n.success)throw new oe(O.InvalidParams,`Invalid params for notification ${e}: ${n.error}`);await o(n.data,r)})}removeNotificationHandler(e){this._notificationHandlers.delete(e)}};function $c(e){return e!==null&&typeof e==="object"&&!Array.isArray(e)}function fh(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}function tS(e){let t={},o=[];if(!fh(e))return{accepted:t,droppedKeys:o};for(let[r,n]of Object.entries(e)){if(!fh(n)||"method"in n||"result"in n){o.push(r);continue}t[r]=n}return{accepted:t,droppedKeys:o}}function oS(e){return{resultType:"input_required",inputRequests:e.inputRequests,...e.requestState!==void 0&&{requestState:e.requestState},...e._meta!==void 0&&{_meta:e._meta}}}/*!
|
|
64
|
+
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let s of e.seen.entries()){let c=s[1];if(t===s[0]){i(s);continue}if(e.external){let u=e.external.registry.get(s[0])?.id;if(t!==s[0]&&u){i(s);continue}}if(e.metadataRegistry.get(s[0])?.id){i(s);continue}if(c.cycle){i(s);continue}if(c.count>1){if(e.reused==="ref"){i(s);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=(c)=>{let l=e.seen.get(c);if(l.ref===null)return;let u=l.def??l.schema,h={...u},f=l.ref;if(l.ref=null,f){r(f);let _=e.seen.get(f),y=_.schema;if(y.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0"))u.allOf=u.allOf??[],u.allOf.push(y);else Object.assign(u,y);if(Object.assign(u,h),c._zod.parent===f)for(let k in u){if(k==="$ref"||k==="allOf")continue;if(!(k in h))delete u[k]}if(y.$ref&&_.def)for(let k in u){if(k==="$ref"||k==="allOf")continue;if(k in _.def&&JSON.stringify(u[k])===JSON.stringify(_.def[k]))delete u[k]}}let S=c._zod.parent;if(S&&S!==f){r(S);let _=e.seen.get(S);if(_?.schema.$ref){if(u.$ref=_.schema.$ref,_.def)for(let y in u){if(y==="$ref"||y==="allOf")continue;if(y in _.def&&JSON.stringify(u[y])===JSON.stringify(_.def[y]))delete u[y]}}}e.override({zodSchema:c,jsonSchema:u,path:l.path??[]})};for(let c of[...e.seen.entries()].reverse())r(c[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 c=e.external.registry.get(t)?.id;if(!c)throw Error("Schema is missing an `id` property");n.$id=e.external.uri(c)}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 s=e.external?.defs??{};for(let c of e.seen.entries()){let l=c[1];if(l.def&&l.defId){if(l.def.id===l.defId)delete l.def.id;s[l.defId]=l.def}}if(e.external);else if(Object.keys(s).length>0)if(e.target==="draft-2020-12")n.$defs=s;else n.definitions=s;try{let c=JSON.parse(JSON.stringify(n));return Object.defineProperty(c,"~standard",{value:{...t["~standard"],jsonSchema:{input:en(t,"input",e.processors),output:en(t,"output",e.processors)}},enumerable:!1,writable:!1}),c}catch(c){throw Error("Error converting schema to JSON.")}}function Re(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 Re(r.element,o);if(r.type==="set")return Re(r.valueType,o);if(r.type==="lazy")return Re(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 Re(r.innerType,o);if(r.type==="intersection")return Re(r.left,o)||Re(r.right,o);if(r.type==="record"||r.type==="map")return Re(r.keyType,o)||Re(r.valueType,o);if(r.type==="pipe"){if(e._zod.traits.has("$ZodCodec"))return!0;return Re(r.in,o)||Re(r.out,o)}if(r.type==="object"){for(let n in r.shape)if(Re(r.shape[n],o))return!0;return!1}if(r.type==="union"){for(let n of r.options)if(Re(n,o))return!0;return!1}if(r.type==="tuple"){for(let n of r.items)if(Re(n,o))return!0;if(r.rest&&Re(r.rest,o))return!0;return!1}return!1}var Ep=(e,t={})=>(o)=>{let r=tn({...o,processors:t});return Q(e,r),on(r,e),rn(r,e)},en=(e,t,o={})=>(r)=>{let{libraryOptions:n,target:i}=r??{},s=tn({...n??{},target:i,io:t,processors:o});return Q(e,s),on(s,e),rn(s,e)};var Of={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},fc=(e,t,o,r)=>{let n=o;n.type="string";let{minimum:i,maximum:s,format:c,patterns:l,contentEncoding:u}=e._zod.bag;if(typeof i==="number")n.minLength=i;if(typeof s==="number")n.maxLength=s;if(c){if(n.format=Of[c]??c,n.format==="")delete n.format;if(c==="time")delete n.format}if(u)n.contentEncoding=u;if(l&&l.size>0){let h=[...l];if(h.length===1)n.pattern=h[0].source;else if(h.length>1)n.allOf=[...h.map((f)=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:f.source}))]}},gc=(e,t,o,r)=>{let n=o,{minimum:i,maximum:s,format:c,multipleOf:l,exclusiveMaximum:u,exclusiveMinimum:h}=e._zod.bag;if(typeof c==="string"&&c.includes("int"))n.type="integer";else n.type="number";let f=typeof h==="number"&&h>=(i??Number.NEGATIVE_INFINITY),S=typeof u==="number"&&u<=(s??Number.POSITIVE_INFINITY),_=t.target==="draft-04"||t.target==="openapi-3.0";if(f)if(_)n.minimum=h,n.exclusiveMinimum=!0;else n.exclusiveMinimum=h;else if(typeof i==="number")n.minimum=i;if(S)if(_)n.maximum=u,n.exclusiveMaximum=!0;else n.exclusiveMaximum=u;else if(typeof s==="number")n.maximum=s;if(typeof l==="number")n.multipleOf=l},Sc=(e,t,o,r)=>{o.type="boolean"},$p=(e,t,o,r)=>{if(t.unrepresentable==="throw")throw Error("BigInt cannot be represented in JSON Schema")},Cp=(e,t,o,r)=>{if(t.unrepresentable==="throw")throw Error("Symbols cannot be represented in JSON Schema")},_c=(e,t,o,r)=>{if(t.target==="openapi-3.0")o.type="string",o.nullable=!0,o.enum=[null];else o.type="null"},bc=(e,t,o,r)=>{if(t.unrepresentable==="throw")throw Error("Undefined cannot be represented in JSON Schema")},Ip=(e,t,o,r)=>{if(t.unrepresentable==="throw")throw Error("Void cannot be represented in JSON Schema")},yc=(e,t,o,r)=>{o.not={}},zc=(e,t,o,r)=>{},vc=(e,t,o,r)=>{},Op=(e,t,o,r)=>{if(t.unrepresentable==="throw")throw Error("Date cannot be represented in JSON Schema")},Rc=(e,t,o,r)=>{let n=e._zod.def,i=wi(n.entries);if(i.every((s)=>typeof s==="number"))o.type="number";if(i.every((s)=>typeof s==="string"))o.type="string";o.enum=i},wc=(e,t,o,r)=>{let n=e._zod.def,i=[];for(let s of n.values)if(s===void 0){if(t.unrepresentable==="throw")throw Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof s==="bigint")if(t.unrepresentable==="throw")throw Error("BigInt literals cannot be represented in JSON Schema");else i.push(Number(s));else i.push(s);if(i.length===0);else if(i.length===1){let s=i[0];if(o.type=s===null?"null":typeof s,t.target==="draft-04"||t.target==="openapi-3.0")o.enum=[s];else o.const=s}else{if(i.every((s)=>typeof s==="number"))o.type="number";if(i.every((s)=>typeof s==="string"))o.type="string";if(i.every((s)=>typeof s==="boolean"))o.type="boolean";if(i.every((s)=>s===null))o.type="null";o.enum=i}},Np=(e,t,o,r)=>{if(t.unrepresentable==="throw")throw Error("NaN cannot be represented in JSON Schema")},Mp=(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},qp=(e,t,o,r)=>{let n=o,i={type:"string",format:"binary",contentEncoding:"binary"},{minimum:s,maximum:c,mime:l}=e._zod.bag;if(s!==void 0)i.minLength=s;if(c!==void 0)i.maxLength=c;if(l)if(l.length===1)i.contentMediaType=l[0],Object.assign(n,i);else Object.assign(n,i),n.anyOf=l.map((u)=>({contentMediaType:u}));else Object.assign(n,i)},Ap=(e,t,o,r)=>{o.type="boolean"},xc=(e,t,o,r)=>{if(t.unrepresentable==="throw")throw Error("Custom types cannot be represented in JSON Schema")},jp=(e,t,o,r)=>{if(t.unrepresentable==="throw")throw Error("Function types cannot be represented in JSON Schema")},Pc=(e,t,o,r)=>{if(t.unrepresentable==="throw")throw Error("Transforms cannot be represented in JSON Schema")},Lp=(e,t,o,r)=>{if(t.unrepresentable==="throw")throw Error("Map cannot be represented in JSON Schema")},Up=(e,t,o,r)=>{if(t.unrepresentable==="throw")throw Error("Set cannot be represented in JSON Schema")},Tc=(e,t,o,r)=>{let n=o,i=e._zod.def,{minimum:s,maximum:c}=e._zod.bag;if(typeof s==="number")n.minItems=s;if(typeof c==="number")n.maxItems=c;n.type="array",n.items=Q(i.element,t,{...r,path:[...r.path,"items"]})},Ec=(e,t,o,r)=>{let n=o,i=e._zod.def;n.type="object",n.properties={};let s=i.shape;for(let u in s)n.properties[u]=Q(s[u],t,{...r,path:[...r.path,"properties",u]});let c=new Set(Object.keys(s)),l=new Set([...c].filter((u)=>{let h=i.shape[u]._zod;if(t.io==="input")return h.optin===void 0;else return h.optout===void 0}));if(l.size>0)n.required=Array.from(l);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=Q(i.catchall,t,{...r,path:[...r.path,"additionalProperties"]})},kc=(e,t,o,r)=>{let n=e._zod.def,i=n.inclusive===!1,s=n.options.map((c,l)=>Q(c,t,{...r,path:[...r.path,i?"oneOf":"anyOf",l]}));if(i)o.oneOf=s;else o.anyOf=s},$c=(e,t,o,r)=>{let n=e._zod.def,i=Q(n.left,t,{...r,path:[...r.path,"allOf",0]}),s=Q(n.right,t,{...r,path:[...r.path,"allOf",1]}),c=(u)=>("allOf"in u)&&Object.keys(u).length===1,l=[...c(i)?i.allOf:[i],...c(s)?s.allOf:[s]];o.allOf=l},Zp=(e,t,o,r)=>{let n=o,i=e._zod.def;n.type="array";let s=t.target==="draft-2020-12"?"prefixItems":"items",c=t.target==="draft-2020-12"?"items":t.target==="openapi-3.0"?"items":"additionalItems",l=i.items.map((S,_)=>Q(S,t,{...r,path:[...r.path,s,_]})),u=i.rest?Q(i.rest,t,{...r,path:[...r.path,c,...t.target==="openapi-3.0"?[i.items.length]:[]]}):null;if(t.target==="draft-2020-12"){if(n.prefixItems=l,u)n.items=u}else if(t.target==="openapi-3.0"){if(n.items={anyOf:l},u)n.items.anyOf.push(u);if(n.minItems=l.length,!u)n.maxItems=l.length}else if(n.items=l,u)n.additionalItems=u;let{minimum:h,maximum:f}=e._zod.bag;if(typeof h==="number")n.minItems=h;if(typeof f==="number")n.maxItems=f},Cc=(e,t,o,r)=>{let n=o,i=e._zod.def;n.type="object";let s=i.keyType,l=s._zod.bag?.patterns;if(i.mode==="loose"&&l&&l.size>0){let h=Q(i.valueType,t,{...r,path:[...r.path,"patternProperties","*"]});n.patternProperties={};for(let f of l)n.patternProperties[f.source]=h}else{if(t.target==="draft-07"||t.target==="draft-2020-12")n.propertyNames=Q(i.keyType,t,{...r,path:[...r.path,"propertyNames"]});n.additionalProperties=Q(i.valueType,t,{...r,path:[...r.path,"additionalProperties"]})}let u=s._zod.values;if(u){let h=[...u].filter((f)=>typeof f==="string"||typeof f==="number");if(h.length>0)n.required=h}},Ic=(e,t,o,r)=>{let n=e._zod.def,i=Q(n.innerType,t,r),s=t.seen.get(e);if(t.target==="openapi-3.0")s.ref=n.innerType,o.nullable=!0;else o.anyOf=[i,{type:"null"}]},Oc=(e,t,o,r)=>{let n=e._zod.def;Q(n.innerType,t,r);let i=t.seen.get(e);i.ref=n.innerType},Nc=(e,t,o,r)=>{let n=e._zod.def;Q(n.innerType,t,r);let i=t.seen.get(e);i.ref=n.innerType,o.default=JSON.parse(JSON.stringify(n.defaultValue))},Mc=(e,t,o,r)=>{let n=e._zod.def;Q(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))},qc=(e,t,o,r)=>{let n=e._zod.def;Q(n.innerType,t,r);let i=t.seen.get(e);i.ref=n.innerType;let s;try{s=n.catchValue(void 0)}catch{throw Error("Dynamic catch values are not supported in JSON Schema")}o.default=s},Ac=(e,t,o,r)=>{let n=e._zod.def,i=n.in._zod.traits.has("$ZodTransform"),s=t.io==="input"?i?n.out:n.in:n.out;Q(s,t,r);let c=t.seen.get(e);c.ref=s},jc=(e,t,o,r)=>{let n=e._zod.def;Q(n.innerType,t,r);let i=t.seen.get(e);i.ref=n.innerType,o.readOnly=!0},Dp=(e,t,o,r)=>{let n=e._zod.def;Q(n.innerType,t,r);let i=t.seen.get(e);i.ref=n.innerType},Li=(e,t,o,r)=>{let n=e._zod.def;Q(n.innerType,t,r);let i=t.seen.get(e);i.ref=n.innerType},Lc=(e,t,o,r)=>{let n=e._zod.innerType;Q(n,t,r);let i=t.seen.get(e);i.ref=n},kp={string:fc,number:gc,boolean:Sc,bigint:$p,symbol:Cp,null:_c,undefined:bc,void:Ip,never:yc,any:zc,unknown:vc,date:Op,enum:Rc,literal:wc,nan:Np,template_literal:Mp,file:qp,success:Ap,custom:xc,function:jp,transform:Pc,map:Lp,set:Up,array:Tc,object:Ec,union:kc,intersection:$c,tuple:Zp,record:Cc,nullable:Ic,nonoptional:Oc,default:Nc,prefault:Mc,catch:qc,pipe:Ac,readonly:jc,promise:Dp,optional:Li,lazy:Lc};function Ui(e,t){if("_idmap"in e){let r=e,n=tn({...t,processors:kp}),i={};for(let l of r._idmap.entries()){let[u,h]=l;Q(h,n)}let s={},c={registry:r,uri:t?.uri,defs:i};n.external=c;for(let l of r._idmap.entries()){let[u,h]=l;on(n,h),s[u]=rn(n,h)}if(Object.keys(i).length>0){let l=n.target==="draft-2020-12"?"$defs":"definitions";s.__shared={[l]:i}}return{schemas:s}}let o=tn({...t,processors:kp});return Q(e,o),on(o,e),rn(o,e)}var Zf=g("ZodISODateTime",(e,t)=>{rd.init(e,t),te.init(e,t)});function Ao(e){return pp(Zf,e)}var Df=g("ZodISODate",(e,t)=>{nd.init(e,t),te.init(e,t)});function Uc(e){return hp(Df,e)}var Vf=g("ZodISOTime",(e,t)=>{sd.init(e,t),te.init(e,t)});function Vp(e){return mp(Vf,e)}var Hf=g("ZodISODuration",(e,t)=>{id.init(e,t),te.init(e,t)});function Hp(e){return fp(Hf,e)}var Ff=(e,t)=>{Ei.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:(o)=>Da(e,o)},flatten:{value:(o)=>Za(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 Oe=g("ZodError",Ff,{Parent:Error});var Jp=ki(Oe),Bp=$i(Oe),Di=Wr(Oe),Wp=Gr(Oe),Gp=Ul(Oe),Kp=Zl(Oe),Yp=Dl(Oe),Qp=Vl(Oe),Xp=Hl(Oe),eh=Fl(Oe),th=Jl(Oe),oh=Bl(Oe);var rh=new WeakMap;function nn(e,t,o){let r=Object.getPrototypeOf(e),n=rh.get(r);if(!n)n=new Set,rh.set(r,n);if(n.has(t))return;n.add(t);for(let i in o){let s=o[i];Object.defineProperty(r,i,{configurable:!0,enumerable:!1,get(){let c=s.bind(this);return Object.defineProperty(this,i,{configurable:!0,writable:!0,enumerable:!0,value:c}),c},set(c){Object.defineProperty(this,i,{configurable:!0,writable:!0,enumerable:!0,value:c})}})}}var X=g("ZodType",(e,t)=>(K.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:en(e,"input"),output:en(e,"output")}}),e.toJSONSchema=Ep(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.parse=(o,r)=>Jp(e,o,r,{callee:e.parse}),e.safeParse=(o,r)=>Di(e,o,r),e.parseAsync=async(o,r)=>Bp(e,o,r,{callee:e.parseAsync}),e.safeParseAsync=async(o,r)=>Wp(e,o,r),e.spa=e.safeParseAsync,e.encode=(o,r)=>Gp(e,o,r),e.decode=(o,r)=>Kp(e,o,r),e.encodeAsync=async(o,r)=>Yp(e,o,r),e.decodeAsync=async(o,r)=>Qp(e,o,r),e.safeEncode=(o,r)=>Xp(e,o,r),e.safeDecode=(o,r)=>eh(e,o,r),e.safeEncodeAsync=async(o,r)=>th(e,o,r),e.safeDecodeAsync=async(o,r)=>oh(e,o,r),nn(e,"ZodType",{check(...o){let r=this.def;return this.clone(kt(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 He(this,o,r)},brand(){return this},register(o,r){return o.add(this,r),this},refine(o,r){return this.check(Ng(o,r))},superRefine(o,r){return this.check(Mg(o,r))},overwrite(o){return this.check(Ot(o))},optional(){return M(this)},exactOptional(){return yg(this)},nullable(){return ah(this)},nullish(){return M(ah(this))},nonoptional(o){return Pg(this,o)},array(){return m(this)},or(o){return R([this,o])},and(o){return mt(this,o)},transform(o){return ch(this,Sh(o))},default(o){return Rg(this,o)},prefault(o){return xg(this,o)},catch(o){return Eg(this,o)},pipe(o){return ch(this,o)},readonly(){return Cg(this)},describe(o){let r=this.clone();return It.add(r,{description:o}),r},meta(...o){if(o.length===0)return It.get(this);let r=this.clone();return It.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 It.get(e)?.description},configurable:!0}),e)),lh=g("_ZodString",(e,t)=>{Oi.init(e,t),X.init(e,t),e._zod.processJSONSchema=(r,n,i)=>fc(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(nc(...r))},includes(...r){return this.check(ac(...r))},startsWith(...r){return this.check(cc(...r))},endsWith(...r){return this.check(lc(...r))},min(...r){return this.check(Mo(...r))},max(...r){return this.check(Ai(...r))},length(...r){return this.check(ji(...r))},nonempty(...r){return this.check(Mo(1,...r))},lowercase(r){return this.check(sc(r))},uppercase(r){return this.check(ic(r))},trim(){return this.check(dc())},normalize(...r){return this.check(uc(...r))},toLowerCase(){return this.check(pc())},toUpperCase(){return this.check(hc())},slugify(){return this.check(mc())}})}),uh=g("ZodString",(e,t)=>{Oi.init(e,t),lh.init(e,t),e.email=(o)=>e.check(tc(dh,o)),e.url=(o)=>e.check(rc(hh,o)),e.jwt=(o)=>e.check(dp(ag,o)),e.emoji=(o)=>e.check(Yd(Bf,o)),e.guid=(o)=>e.check(oc(nh,o)),e.uuid=(o)=>e.check(Bd(Vi,o)),e.uuidv4=(o)=>e.check(Wd(Vi,o)),e.uuidv6=(o)=>e.check(Gd(Vi,o)),e.uuidv7=(o)=>e.check(Kd(Vi,o)),e.nanoid=(o)=>e.check(Qd(Wf,o)),e.guid=(o)=>e.check(oc(nh,o)),e.cuid=(o)=>e.check(Xd(Gf,o)),e.cuid2=(o)=>e.check(ep(Kf,o)),e.ulid=(o)=>e.check(tp(Yf,o)),e.base64=(o)=>e.check(cp(ng,o)),e.base64url=(o)=>e.check(lp(sg,o)),e.xid=(o)=>e.check(op(Qf,o)),e.ksuid=(o)=>e.check(rp(Xf,o)),e.ipv4=(o)=>e.check(np(eg,o)),e.ipv6=(o)=>e.check(sp(tg,o)),e.cidrv4=(o)=>e.check(ip(og,o)),e.cidrv6=(o)=>e.check(ap(rg,o)),e.e164=(o)=>e.check(up(ig,o)),e.datetime=(o)=>e.check(Ao(o)),e.date=(o)=>e.check(Uc(o)),e.time=(o)=>e.check(Vp(o)),e.duration=(o)=>e.check(Hp(o))});function a(e){return Jd(uh,e)}var te=g("ZodStringFormat",(e,t)=>{ee.init(e,t),lh.init(e,t)}),dh=g("ZodEmail",(e,t)=>{Wu.init(e,t),te.init(e,t)});function ph(e){return tc(dh,e)}var nh=g("ZodGUID",(e,t)=>{Ju.init(e,t),te.init(e,t)});var Vi=g("ZodUUID",(e,t)=>{Bu.init(e,t),te.init(e,t)});var hh=g("ZodURL",(e,t)=>{Gu.init(e,t),te.init(e,t)});function Hi(e){return rc(hh,e)}var Bf=g("ZodEmoji",(e,t)=>{Ku.init(e,t),te.init(e,t)});var Wf=g("ZodNanoID",(e,t)=>{Yu.init(e,t),te.init(e,t)});var Gf=g("ZodCUID",(e,t)=>{Qu.init(e,t),te.init(e,t)});var Kf=g("ZodCUID2",(e,t)=>{Xu.init(e,t),te.init(e,t)});var Yf=g("ZodULID",(e,t)=>{ed.init(e,t),te.init(e,t)});var Qf=g("ZodXID",(e,t)=>{td.init(e,t),te.init(e,t)});var Xf=g("ZodKSUID",(e,t)=>{od.init(e,t),te.init(e,t)});var eg=g("ZodIPv4",(e,t)=>{ad.init(e,t),te.init(e,t)});var tg=g("ZodIPv6",(e,t)=>{cd.init(e,t),te.init(e,t)});var og=g("ZodCIDRv4",(e,t)=>{ld.init(e,t),te.init(e,t)});var rg=g("ZodCIDRv6",(e,t)=>{ud.init(e,t),te.init(e,t)});var ng=g("ZodBase64",(e,t)=>{pd.init(e,t),te.init(e,t)});var sg=g("ZodBase64URL",(e,t)=>{hd.init(e,t),te.init(e,t)});var ig=g("ZodE164",(e,t)=>{md.init(e,t),te.init(e,t)});var ag=g("ZodJWT",(e,t)=>{fd.init(e,t),te.init(e,t)});var Fi=g("ZodNumber",(e,t)=>{Ka.init(e,t),X.init(e,t),e._zod.processJSONSchema=(r,n,i)=>gc(e,r,n,i),nn(e,"ZodNumber",{gt(r,n){return this.check(Mi(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(Ni(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(sh(r))},safe(r){return this.check(sh(r))},positive(r){return this.check(Mi(0,r))},nonnegative(r){return this.check(Xr(0,r))},negative(r){return this.check(Ni(0,r))},nonpositive(r){return this.check(Qr(0,r))},multipleOf(r,n){return this.check(qi(r,n))},step(r,n){return this.check(qi(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 b(e){return gp(Fi,e)}var cg=g("ZodNumberFormat",(e,t)=>{gd.init(e,t),Fi.init(e,t)});function sh(e){return _p(cg,e)}var mh=g("ZodBoolean",(e,t)=>{Sd.init(e,t),X.init(e,t),e._zod.processJSONSchema=(o,r,n)=>Sc(e,o,r,n)});function v(e){return bp(mh,e)}var lg=g("ZodUndefined",(e,t)=>{_d.init(e,t),X.init(e,t),e._zod.processJSONSchema=(o,r,n)=>bc(e,o,r,n)});function Dc(e){return yp(lg,e)}var ug=g("ZodNull",(e,t)=>{bd.init(e,t),X.init(e,t),e._zod.processJSONSchema=(o,r,n)=>_c(e,o,r,n)});function ro(e){return zp(ug,e)}var dg=g("ZodAny",(e,t)=>{yd.init(e,t),X.init(e,t),e._zod.processJSONSchema=(o,r,n)=>zc(e,o,r,n)});function Ji(){return vp(dg)}var pg=g("ZodUnknown",(e,t)=>{zd.init(e,t),X.init(e,t),e._zod.processJSONSchema=(o,r,n)=>vc(e,o,r,n)});function I(){return Rp(pg)}var hg=g("ZodNever",(e,t)=>{vd.init(e,t),X.init(e,t),e._zod.processJSONSchema=(o,r,n)=>yc(e,o,r,n)});function Vc(e){return wp(hg,e)}var mg=g("ZodArray",(e,t)=>{Rd.init(e,t),X.init(e,t),e._zod.processJSONSchema=(o,r,n)=>Tc(e,o,r,n),e.element=t.element,nn(e,"ZodArray",{min(o,r){return this.check(Mo(o,r))},nonempty(o){return this.check(Mo(1,o))},max(o,r){return this.check(Ai(o,r))},length(o,r){return this.check(ji(o,r))},unwrap(){return this.element}})});function m(e,t){return xp(mg,e,t)}var fh=g("ZodObject",(e,t)=>{Pd.init(e,t),X.init(e,t),e._zod.processJSONSchema=(o,r,n)=>Ec(e,o,r,n),J(e,"shape",()=>t.shape),nn(e,"ZodObject",{keyof(){return D(Object.keys(this._zod.def.shape))},catchall(o){return this.clone({...this._zod.def,catchall:o})},passthrough(){return this.clone({...this._zod.def,catchall:I()})},loose(){return this.clone({...this._zod.def,catchall:I()})},strict(){return this.clone({...this._zod.def,catchall:Vc()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(o){return bf(this,o)},safeExtend(o){return yf(this,o)},merge(o){return zf(this,o)},pick(o){return Sf(this,o)},omit(o){return _f(this,o)},partial(...o){return vf(_h,this,o[0])},required(...o){return Rf(bh,this,o[0])}})});function d(e,t){let o={type:"object",shape:e??{},...O(t)};return new fh(o)}function A(e,t){return new fh({type:"object",shape:e,catchall:I(),...O(t)})}var gh=g("ZodUnion",(e,t)=>{Ya.init(e,t),X.init(e,t),e._zod.processJSONSchema=(o,r,n)=>kc(e,o,r,n),e.options=t.options});function R(e,t){return new gh({type:"union",options:e,...O(t)})}var fg=g("ZodDiscriminatedUnion",(e,t)=>{gh.init(e,t),Td.init(e,t)});function jo(e,t,o){return new fg({type:"union",options:t,discriminator:e,...O(o)})}var gg=g("ZodIntersection",(e,t)=>{Ed.init(e,t),X.init(e,t),e._zod.processJSONSchema=(o,r,n)=>$c(e,o,r,n)});function mt(e,t){return new gg({type:"intersection",left:e,right:t})}var ih=g("ZodRecord",(e,t)=>{kd.init(e,t),X.init(e,t),e._zod.processJSONSchema=(o,r,n)=>Cc(e,o,r,n),e.keyType=t.keyType,e.valueType=t.valueType});function z(e,t,o){if(!t||!t._zod)return new ih({type:"record",keyType:a(),valueType:e,...O(t)});return new ih({type:"record",keyType:e,valueType:t,...O(o)})}var Zc=g("ZodEnum",(e,t)=>{$d.init(e,t),X.init(e,t),e._zod.processJSONSchema=(r,n,i)=>Rc(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 s of r)if(o.has(s))i[s]=t.entries[s];else throw Error(`Key ${s} not found in enum`);return new Zc({...t,checks:[],...O(n),entries:i})},e.exclude=(r,n)=>{let i={...t.entries};for(let s of r)if(o.has(s))delete i[s];else throw Error(`Key ${s} not found in enum`);return new Zc({...t,checks:[],...O(n),entries:i})}});function D(e,t){let o=Array.isArray(e)?Object.fromEntries(e.map((r)=>[r,r])):e;return new Zc({type:"enum",entries:o,...O(t)})}var Sg=g("ZodLiteral",(e,t)=>{Cd.init(e,t),X.init(e,t),e._zod.processJSONSchema=(o,r,n)=>wc(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 p(e,t){return new Sg({type:"literal",values:Array.isArray(e)?e:[e],...O(t)})}var _g=g("ZodTransform",(e,t)=>{Id.init(e,t),X.init(e,t),e._zod.processJSONSchema=(o,r,n)=>Pc(e,o,r,n),e._zod.parse=(o,r)=>{if(r.direction==="backward")throw new Fr(e.constructor.name);o.addIssue=(i)=>{if(typeof i==="string")o.issues.push(oo(i,o.value,t));else{let s=i;if(s.fatal)s.continue=!1;s.code??(s.code="custom"),s.input??(s.input=o.value),s.inst??(s.inst=e),o.issues.push(oo(s))}};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 Sh(e){return new _g({type:"transform",transform:e})}var _h=g("ZodOptional",(e,t)=>{Qa.init(e,t),X.init(e,t),e._zod.processJSONSchema=(o,r,n)=>Li(e,o,r,n),e.unwrap=()=>e._zod.def.innerType});function M(e){return new _h({type:"optional",innerType:e})}var bg=g("ZodExactOptional",(e,t)=>{Od.init(e,t),X.init(e,t),e._zod.processJSONSchema=(o,r,n)=>Li(e,o,r,n),e.unwrap=()=>e._zod.def.innerType});function yg(e){return new bg({type:"optional",innerType:e})}var zg=g("ZodNullable",(e,t)=>{Nd.init(e,t),X.init(e,t),e._zod.processJSONSchema=(o,r,n)=>Ic(e,o,r,n),e.unwrap=()=>e._zod.def.innerType});function ah(e){return new zg({type:"nullable",innerType:e})}var vg=g("ZodDefault",(e,t)=>{Md.init(e,t),X.init(e,t),e._zod.processJSONSchema=(o,r,n)=>Nc(e,o,r,n),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Rg(e,t){return new vg({type:"default",innerType:e,get defaultValue(){return typeof t==="function"?t():ja(t)}})}var wg=g("ZodPrefault",(e,t)=>{qd.init(e,t),X.init(e,t),e._zod.processJSONSchema=(o,r,n)=>Mc(e,o,r,n),e.unwrap=()=>e._zod.def.innerType});function xg(e,t){return new wg({type:"prefault",innerType:e,get defaultValue(){return typeof t==="function"?t():ja(t)}})}var bh=g("ZodNonOptional",(e,t)=>{Ad.init(e,t),X.init(e,t),e._zod.processJSONSchema=(o,r,n)=>Oc(e,o,r,n),e.unwrap=()=>e._zod.def.innerType});function Pg(e,t){return new bh({type:"nonoptional",innerType:e,...O(t)})}var Tg=g("ZodCatch",(e,t)=>{jd.init(e,t),X.init(e,t),e._zod.processJSONSchema=(o,r,n)=>qc(e,o,r,n),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Eg(e,t){return new Tg({type:"catch",innerType:e,catchValue:typeof t==="function"?t:()=>t})}var yh=g("ZodPipe",(e,t)=>{Xa.init(e,t),X.init(e,t),e._zod.processJSONSchema=(o,r,n)=>Ac(e,o,r,n),e.in=t.in,e.out=t.out});function ch(e,t){return new yh({type:"pipe",in:e,out:t})}var kg=g("ZodPreprocess",(e,t)=>{yh.init(e,t),Ld.init(e,t)}),$g=g("ZodReadonly",(e,t)=>{Ud.init(e,t),X.init(e,t),e._zod.processJSONSchema=(o,r,n)=>jc(e,o,r,n),e.unwrap=()=>e._zod.def.innerType});function Cg(e){return new $g({type:"readonly",innerType:e})}var Ig=g("ZodLazy",(e,t)=>{Zd.init(e,t),X.init(e,t),e._zod.processJSONSchema=(o,r,n)=>Lc(e,o,r,n),e.unwrap=()=>e._zod.def.getter()});function sn(e){return new Ig({type:"lazy",getter:e})}var Og=g("ZodCustom",(e,t)=>{Dd.init(e,t),X.init(e,t),e._zod.processJSONSchema=(o,r,n)=>xc(e,o,r,n)});function Ng(e,t={}){return Pp(Og,e,t)}function Mg(e,t){return Tp(e,t)}function no(e,t){return new kg({type:"pipe",in:Sh(e),out:t})}var vh={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 zh;(function(e){})(zh||(zh={}));function qg(e){return Sp(Fi,e)}ve(ec());var an="2025-11-25";var Bi=[an,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],Wi="io.modelcontextprotocol/related-task",so="io.modelcontextprotocol/protocolVersion",Lo="io.modelcontextprotocol/clientInfo",st="io.modelcontextprotocol/serverInfo",io="io.modelcontextprotocol/clientCapabilities",Uo="io.modelcontextprotocol/subscriptionId",Zo="io.modelcontextprotocol/logLevel";var ao="2.0";var ft=sn(()=>R([a(),b(),v(),ro(),z(a(),ft),m(ft)])),oe=z(a(),ft),Gi=m(ft),Do=R([a(),b().int()]),Vo=a(),cn=d({ttl:b().optional()}),ln=d({taskId:a()}),Ho=A({progressToken:Do.optional(),[Wi]:ln.optional()}),ue=d({_meta:Ho.optional()}),Mt=ue.extend({task:cn.optional()}),re=d({method:a(),params:ue.loose().optional()}),Se=d({_meta:Ho.optional()}),he=d({method:a(),params:Se.loose().optional()}),Fo=A({get[st](){return it.optional().catch(void 0)}}),ne=A({_meta:Fo.optional()}),Je=R([a(),b().int()]),Jo=d({jsonrpc:p(ao),id:Je,...re.shape}).strict(),Bo=d({jsonrpc:p(ao),...he.shape}).strict(),co=d({jsonrpc:p(ao),id:Je,result:ne}).strict(),lo=d({jsonrpc:p(ao),id:Je.optional(),error:d({code:b().int(),message:a(),data:I().optional()})}).strict(),uo=R([Jo,Bo,co,lo]),Ki=R([co,lo]),qt=ne.strict(),un=Se.extend({requestId:Je.optional(),reason:a().optional()}),Wo=he.extend({method:p("notifications/cancelled"),params:un}),dn=d({src:a(),mimeType:a().optional(),sizes:m(a()).optional(),theme:D(["light","dark"]).optional()}),gt=d({icons:m(dn).optional()}),nt=d({name:a(),title:a().optional()}),it=nt.extend({...nt.shape,...gt.shape,version:a(),websiteUrl:a().optional(),description:a().optional()}),Ag=mt(d({applyDefaults:v().optional()}),oe),jg=no((e)=>{if(e&&typeof e==="object"&&!Array.isArray(e)&&Object.keys(e).length===0)return{form:{}};return e},mt(d({form:Ag.optional(),url:oe.optional()}),oe.optional())),Yi=A({list:oe.optional(),cancel:oe.optional(),requests:A({sampling:A({createMessage:oe.optional()}).optional(),elicitation:A({create:oe.optional()}).optional()}).optional()}),Qi=A({list:oe.optional(),cancel:oe.optional(),requests:A({tools:A({call:oe.optional()}).optional()}).optional()}),pn=d({experimental:z(a(),oe).optional(),sampling:d({context:oe.optional(),tools:oe.optional()}).optional(),elicitation:jg.optional(),roots:d({listChanged:v().optional()}).optional(),tasks:Yi.optional(),extensions:z(a(),oe).optional()}),hn=ue.extend({protocolVersion:a(),capabilities:pn,clientInfo:it}),mn=re.extend({method:p("initialize"),params:hn}),Go=d({experimental:z(a(),oe).optional(),logging:oe.optional(),completions:oe.optional(),prompts:d({listChanged:v().optional()}).optional(),resources:d({subscribe:v().optional(),listChanged:v().optional()}).optional(),tools:d({listChanged:v().optional()}).optional(),tasks:Qi.optional(),extensions:z(a(),oe).optional()}),fn=ne.extend({protocolVersion:a(),capabilities:Go,serverInfo:it,instructions:a().optional()}),gn=he.extend({method:p("notifications/initialized"),params:Se.optional()}),Sn=re.extend({method:p("server/discover"),params:ue.optional()}),At=ne.extend({supportedVersions:m(a()),capabilities:Go,instructions:a().optional()}),Ko=re.extend({method:p("ping"),params:ue.optional()}),_n=d({progress:b(),total:M(b()),message:M(a())}),bn=d({...Se.shape,..._n.shape,progressToken:Do}),Yo=he.extend({method:p("notifications/progress"),params:bn}),yn=ue.extend({cursor:Vo.optional()}),St=re.extend({params:yn.optional()}),_t=ne.extend({nextCursor:Vo.optional()}),Qo=d({uri:a(),mimeType:M(a()),_meta:z(a(),I()).optional()}),Xo=Qo.extend({text:a()}),Fc=a().refine((e)=>{try{return atob(e),!0}catch{return!1}},{message:"Invalid Base64 string"}),er=Qo.extend({blob:Fc}),bt=D(["user","assistant"]),at=d({audience:m(bt).optional(),priority:b().min(0).max(1).optional(),lastModified:Ao({offset:!0}).optional()}),tr=d({...nt.shape,...gt.shape,uri:a(),description:M(a()),mimeType:M(a()),size:M(b()),annotations:at.optional(),_meta:M(A({}))}),zn=d({...nt.shape,...gt.shape,uriTemplate:a(),description:M(a()),mimeType:M(a()),annotations:at.optional(),_meta:M(A({}))}),vn=St.extend({method:p("resources/list")}),Rn=_t.extend({resources:m(tr)}),wn=St.extend({method:p("resources/templates/list")}),xn=_t.extend({resourceTemplates:m(zn)}),po=ue.extend({uri:a()}),Pn=po,Tn=re.extend({method:p("resources/read"),params:Pn}),En=ne.extend({contents:m(R([Xo,er]))}),kn=he.extend({method:p("notifications/resources/list_changed"),params:Se.optional()}),$n=po,Cn=re.extend({method:p("resources/subscribe"),params:$n}),In=po,On=re.extend({method:p("resources/unsubscribe"),params:In}),or=d({toolsListChanged:v().optional(),promptsListChanged:v().optional(),resourcesListChanged:v().optional(),resourceSubscriptions:m(a()).optional()}),Nn=ue.extend({notifications:or}),Mn=re.extend({method:p("subscriptions/listen"),params:Nn}),qn=Se.extend({notifications:or}),An=he.extend({method:p("notifications/subscriptions/acknowledged"),params:qn}),jn=Fo.extend({[Uo]:Je}),Ln=ne.extend({_meta:jn}),Un=Se.extend({uri:a()}),Zn=he.extend({method:p("notifications/resources/updated"),params:Un}),Dn=d({name:a(),description:M(a()),required:M(v())}),Vn=d({...nt.shape,...gt.shape,description:M(a()),arguments:M(m(Dn)),_meta:M(A({}))}),Hn=St.extend({method:p("prompts/list")}),Fn=_t.extend({prompts:m(Vn)}),Jn=ue.extend({name:a(),arguments:z(a(),a()).optional()}),Bn=re.extend({method:p("prompts/get"),params:Jn}),ho=d({type:p("text"),text:a(),annotations:at.optional(),_meta:z(a(),I()).optional()}),mo=d({type:p("image"),data:Fc,mimeType:a(),annotations:at.optional(),_meta:z(a(),I()).optional()}),fo=d({type:p("audio"),data:Fc,mimeType:a(),annotations:at.optional(),_meta:z(a(),I()).optional()}),Wn=d({type:p("tool_use"),name:a(),id:a(),input:z(a(),I()),_meta:z(a(),I()).optional()}),go=d({type:p("resource"),resource:R([Xo,er]),annotations:at.optional(),_meta:z(a(),I()).optional()}),So=tr.extend({type:p("resource_link")}),ct=R([ho,mo,fo,So,go]),Gn=d({role:bt,content:ct}),Kn=ne.extend({description:a().optional(),messages:m(Gn)}),Yn=he.extend({method:p("notifications/prompts/list_changed"),params:Se.optional()}),Qn=d({title:a().optional(),readOnlyHint:v().optional(),destructiveHint:v().optional(),idempotentHint:v().optional(),openWorldHint:v().optional()}),Xn=d({taskSupport:D(["required","optional","forbidden"]).optional()}),jt=d({...nt.shape,...gt.shape,description:a().optional(),inputSchema:d({type:p("object"),properties:z(a(),ft).optional(),required:m(a()).optional()}).catchall(I()),outputSchema:A({$schema:a().optional()}).optional(),annotations:Qn.optional(),execution:Xn.optional(),_meta:z(a(),I()).optional()}),es=St.extend({method:p("tools/list")}),ts=_t.extend({tools:m(jt)}),Lt=ne.extend({content:m(ct).default([]),structuredContent:I().optional(),isError:v().optional()}),Xi=Lt.or(ne.extend({toolResult:I()})),os=Mt.extend({name:a(),arguments:z(a(),I()).optional()}),rs=re.extend({method:p("tools/call"),params:os}),ns=he.extend({method:p("notifications/tools/list_changed"),params:Se.optional()}),ss=d({autoRefresh:v().default(!0),debounceMs:b().int().nonnegative().default(300)}),rr=D(["debug","info","notice","warning","error","critical","alert","emergency"]),is=ue.extend({level:rr}),as=re.extend({method:p("logging/setLevel"),params:is}),cs=Se.extend({level:rr,logger:a().optional(),data:I()}),ls=he.extend({method:p("notifications/message"),params:cs}),us=d({name:a().optional()}),ds=d({hints:m(us).optional(),costPriority:b().min(0).max(1).optional(),speedPriority:b().min(0).max(1).optional(),intelligencePriority:b().min(0).max(1).optional()}),ps=d({mode:D(["auto","required","none"]).optional()}),hs=d({type:p("tool_result"),toolUseId:a().describe("The unique identifier for the corresponding tool call."),content:m(ct),structuredContent:I().optional(),isError:v().optional(),_meta:z(a(),I()).optional()}),ms=jo("type",[ho,mo,fo]),Nt=jo("type",[ho,mo,fo,Wn,hs]),fs=d({role:bt,content:R([Nt,m(Nt)]),_meta:z(a(),I()).optional()}),gs=Mt.extend({messages:m(fs),modelPreferences:ds.optional(),systemPrompt:a().optional(),includeContext:D(["none","thisServer","allServers"]).optional(),temperature:b().optional(),maxTokens:b().int(),stopSequences:m(a()).optional(),metadata:oe.optional(),tools:m(jt).optional(),toolChoice:ps.optional()}),Ss=re.extend({method:p("sampling/createMessage"),params:gs}),_s=ne.extend({model:a(),stopReason:M(D(["endTurn","stopSequence","maxTokens"]).or(a())),role:bt,content:ms}),bs=ne.extend({model:a(),stopReason:M(D(["endTurn","stopSequence","maxTokens","toolUse"]).or(a())),role:bt,content:R([Nt,m(Nt)])}),nr=d({type:p("boolean"),title:a().optional(),description:a().optional(),default:v().optional()}),_o=d({type:p("string"),title:a().optional(),description:a().optional(),minLength:b().optional(),maxLength:b().optional(),format:D(["email","uri","date","date-time"]).optional(),default:a().optional()}),bo=d({type:D(["number","integer"]),title:a().optional(),description:a().optional(),minimum:b().optional(),maximum:b().optional(),default:b().optional()}),sr=d({type:p("string"),title:a().optional(),description:a().optional(),enum:m(a()),default:a().optional()}),ir=d({type:p("string"),title:a().optional(),description:a().optional(),oneOf:m(d({const:a(),title:a()})),default:a().optional()}),ar=d({type:p("string"),title:a().optional(),description:a().optional(),enum:m(a()),enumNames:m(a()).optional(),default:a().optional()}),ys=R([sr,ir]),cr=d({type:p("array"),title:a().optional(),description:a().optional(),minItems:b().optional(),maxItems:b().optional(),items:d({type:p("string"),enum:m(a())}),default:m(a()).optional()}),lr=d({type:p("array"),title:a().optional(),description:a().optional(),minItems:b().optional(),maxItems:b().optional(),items:d({anyOf:m(d({const:a(),title:a()}))}),default:m(a()).optional()}),zs=R([cr,lr]),vs=R([ar,ys,zs]),ur=R([vs,nr,_o,bo]),yo=Mt.extend({mode:p("form").optional(),message:a(),requestedSchema:d({type:p("object"),properties:z(a(),ur),required:m(a()).optional()}).catchall(I())}),Rs=Mt.extend({mode:p("url"),message:a(),elicitationId:a(),url:a().url()}),ws=R([yo,Rs]),xs=re.extend({method:p("elicitation/create"),params:ws}),Ps=Se.extend({elicitationId:a()}),Ts=he.extend({method:p("notifications/elicitation/complete"),params:Ps}),Es=ne.extend({action:D(["accept","decline","cancel"]),content:no((e)=>e===null?void 0:e,z(a(),R([a(),b(),v(),m(a())])).optional())}),ks=d({type:p("ref/resource"),uri:a()}),$s=d({type:p("ref/prompt"),name:a()}),Cs=ue.extend({ref:R([$s,ks]),argument:d({name:a(),value:a()}),context:d({arguments:z(a(),a()).optional()}).optional()}),Is=re.extend({method:p("completion/complete"),params:Cs}),Os=ne.extend({completion:A({values:m(a()).max(100),total:M(b().int()),hasMore:M(v())})}),Ns=d({uri:a().startsWith("file://"),name:a().optional(),_meta:z(a(),I()).optional()}),Ms=re.extend({method:p("roots/list"),params:ue.optional()}),qs=ne.extend({roots:m(Ns)}),As=he.extend({method:p("notifications/roots/list_changed"),params:Se.optional()}),ea=A({ttl:b().optional(),pollInterval:b().optional()}),js=D(["working","input_required","completed","failed","cancelled"]),yt=d({taskId:a(),status:js,ttl:R([b(),ro()]),createdAt:a(),lastUpdatedAt:a(),pollInterval:M(b()),statusMessage:M(a())}),ta=ne.extend({task:yt}),Ls=Se.merge(yt),oa=he.extend({method:p("notifications/tasks/status"),params:Ls}),ra=re.extend({method:p("tasks/get"),params:ue.extend({taskId:a()})}),na=ne.merge(yt),sa=re.extend({method:p("tasks/result"),params:ue.extend({taskId:a()})}),ia=ne.loose(),aa=St.extend({method:p("tasks/list")}),ca=_t.extend({tasks:m(yt)}),la=re.extend({method:p("tasks/cancel"),params:ue.extend({taskId:a()})}),ua=ne.merge(yt),da=R([Ko,mn,Sn,Is,as,Bn,Hn,vn,wn,Tn,Cn,On,Mn,rs,es]),pa=R([Wo,Yo,gn,As]),ha=R([qt,_s,bs,Es,qs]),ma=R([Ko,Ss,xs,Ms]),fa=R([Wo,Yo,ls,Zn,kn,ns,Yn,An,Ts]),ga=R([qt,fn,At,Os,Kn,Fn,Rn,xn,En,Lt,ts,Ln]);var de=Hi().superRefine((e,t)=>{if(!URL.canParse(e))return t.addIssue({code:vh.custom,message:"URL must be parseable",fatal:!0}),Oa}).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"}),Us=A({resource:a().url(),authorization_servers:m(de).optional(),jwks_uri:a().url().optional(),scopes_supported:m(a()).optional(),bearer_methods_supported:m(a()).optional(),resource_signing_alg_values_supported:m(a()).optional(),resource_name:a().optional(),resource_documentation:a().optional(),resource_policy_uri:a().url().optional(),resource_tos_uri:a().url().optional(),tls_client_certificate_bound_access_tokens:v().optional(),authorization_details_types_supported:m(a()).optional(),dpop_signing_alg_values_supported:m(a()).optional(),dpop_bound_access_tokens_required:v().optional()}),dr=A({issuer:a(),authorization_endpoint:de,token_endpoint:de,registration_endpoint:de.optional(),scopes_supported:m(a()).optional(),response_types_supported:m(a()),response_modes_supported:m(a()).optional(),grant_types_supported:m(a()).optional(),token_endpoint_auth_methods_supported:m(a()).optional(),token_endpoint_auth_signing_alg_values_supported:m(a()).optional(),service_documentation:de.optional(),revocation_endpoint:de.optional(),revocation_endpoint_auth_methods_supported:m(a()).optional(),revocation_endpoint_auth_signing_alg_values_supported:m(a()).optional(),introspection_endpoint:a().optional(),introspection_endpoint_auth_methods_supported:m(a()).optional(),introspection_endpoint_auth_signing_alg_values_supported:m(a()).optional(),code_challenge_methods_supported:m(a()).optional(),client_id_metadata_document_supported:v().optional(),authorization_response_iss_parameter_supported:v().optional().catch(void 0),dpop_signing_alg_values_supported:m(a()).optional()}),Zs=A({issuer:a(),authorization_endpoint:de,token_endpoint:de,userinfo_endpoint:de.optional(),jwks_uri:de,registration_endpoint:de.optional(),scopes_supported:m(a()).optional(),response_types_supported:m(a()),response_modes_supported:m(a()).optional(),grant_types_supported:m(a()).optional(),acr_values_supported:m(a()).optional(),subject_types_supported:m(a()),id_token_signing_alg_values_supported:m(a()),id_token_encryption_alg_values_supported:m(a()).optional(),id_token_encryption_enc_values_supported:m(a()).optional(),userinfo_signing_alg_values_supported:m(a()).optional(),userinfo_encryption_alg_values_supported:m(a()).optional(),userinfo_encryption_enc_values_supported:m(a()).optional(),request_object_signing_alg_values_supported:m(a()).optional(),request_object_encryption_alg_values_supported:m(a()).optional(),request_object_encryption_enc_values_supported:m(a()).optional(),token_endpoint_auth_methods_supported:m(a()).optional(),token_endpoint_auth_signing_alg_values_supported:m(a()).optional(),display_values_supported:m(a()).optional(),claim_types_supported:m(a()).optional(),claims_supported:m(a()).optional(),service_documentation:a().optional(),claims_locales_supported:m(a()).optional(),ui_locales_supported:m(a()).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:de.optional(),op_tos_uri:de.optional(),client_id_metadata_document_supported:v().optional(),authorization_response_iss_parameter_supported:v().optional().catch(void 0)}),Ds=d({...Zs.shape,...dr.pick({code_challenge_methods_supported:!0}).shape}),pr=d({access_token:a(),id_token:a().optional(),token_type:a(),expires_in:qg().optional(),scope:a().optional(),refresh_token:a().optional(),issuer:a().optional().catch(void 0)}).strip(),Vs=d({issued_token_type:p("urn:ietf:params:oauth:token-type:id-jag"),access_token:a(),token_type:a().optional(),expires_in:b().optional(),scope:a().optional()}).strip(),hr=d({error:a(),error_description:a().optional(),error_uri:a().optional()}),Jc=de.optional().or(p("").transform(()=>{return})),Hs=d({redirect_uris:m(de),token_endpoint_auth_method:a().optional(),grant_types:m(a()).optional(),response_types:m(a()).optional(),application_type:a().optional(),client_name:a().optional(),client_uri:de.optional(),logo_uri:Jc,scope:a().optional(),contacts:m(a()).optional(),tos_uri:Jc,policy_uri:a().optional(),jwks_uri:de.optional(),jwks:Ji().optional(),software_id:a().optional(),software_version:a().optional(),software_statement:a().optional()}).strip(),Fs=d({client_id:a(),client_secret:a().optional(),client_id_issued_at:b().optional(),client_secret_expires_at:b().optional(),issuer:a().optional().catch(void 0)}).strip(),Js=Hs.merge(Fs),Sa=d({error:a(),error_description:a().optional()}).strip(),_a=d({token:a(),token_type_hint:a().optional()}).strip();var Yc=Symbol.for("mcp.sdk.errorBrands");function Zt(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,Yc,{value:o,enumerable:!1,configurable:!0})}function Te(e,t){try{if(typeof t==="object"&&t!==null&&Object.prototype.hasOwnProperty.call(e,"mcpBrand")&&typeof e.mcpBrand==="string"&&Object.prototype.hasOwnProperty.call(t,Yc)){let o=t[Yc];if(o&&typeof o.has==="function"&&o.has(e.mcpBrand))return!0}}catch{}return Function.prototype[Symbol.hasInstance].call(e,t)}var Jh=class e extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.OAuthError"})}static[Symbol.hasInstance](t){return Te(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 Te(this,t)}constructor(t,o,r){super(o);this.code=t,this.errorUri=r,this.name="OAuthError",Zt(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)}},N=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}({}),E=class extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.SdkError"})}static[Symbol.hasInstance](e){return Te(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 Te(this,e)}constructor(e,t,o,r){super(t,r);this.code=e,this.data=o,this.name="SdkError",Zt(this,new.target)}},Qs=class extends E{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 Bh="2026-07-28",ol=[Bh];function vt(e){return e>=Bh}function rl(e){return e.filter((t)=>!vt(t))}function Xs(e){return e.filter((t)=>vt(t))}function Wh(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 Gh=["task","inputRequests","requestState"];function Lg(e){if(e===null||typeof e!=="object"||Array.isArray(e)||e.content!==void 0||Gh.some((t)=>(t in e)))return e;return{...e,content:[]}}function Ug(){let e=sn(()=>R([a(),b(),v(),ro(),z(a(),e),m(e)])),t=z(a(),e),o=R([a(),b().int()]),r=a(),n=d({ttl:b().optional()}),i=d({taskId:a()}),s=A({progressToken:o.optional(),"io.modelcontextprotocol/related-task":i.optional()}),c=d({_meta:s.optional()}),l=c.extend({task:n.optional()}),u=d({method:a(),params:c.loose().optional()}),h=d({_meta:s.optional()}),f=d({method:a(),params:h.loose().optional()}),S=A({_meta:s.optional()}),_=R([a(),b().int()]),y=S.strict(),w=h.extend({requestId:_.optional(),reason:a().optional()}),k=f.extend({method:p("notifications/cancelled"),params:w}),V=d({src:a(),mimeType:a().optional(),sizes:m(a()).optional(),theme:D(["light","dark"]).optional()}),B=d({icons:m(V).optional()}),q=d({name:a(),title:a().optional()}),F=q.extend({...q.shape,...B.shape,version:a(),websiteUrl:a().optional(),description:a().optional()}),Y=mt(d({applyDefaults:v().optional()}),t),G=no((ge)=>{if(ge&&typeof ge==="object"&&!Array.isArray(ge)&&Object.keys(ge).length===0)return{form:{}};return ge},mt(d({form:Y.optional(),url:t.optional()}),t.optional())),ie=A({list:t.optional(),cancel:t.optional(),requests:A({sampling:A({createMessage:t.optional()}).optional(),elicitation:A({create:t.optional()}).optional()}).optional()}),Ne=A({list:t.optional(),cancel:t.optional(),requests:A({tools:A({call:t.optional()}).optional()}).optional()}),ce=d({experimental:z(a(),t).optional(),sampling:d({context:t.optional(),tools:t.optional()}).optional(),elicitation:G.optional(),roots:d({listChanged:v().optional()}).optional(),tasks:ie.optional(),extensions:z(a(),t).optional()}),Me=c.extend({protocolVersion:a(),capabilities:ce,clientInfo:F}),Ze=u.extend({method:p("initialize"),params:Me}),Rt=d({experimental:z(a(),t).optional(),logging:t.optional(),completions:t.optional(),prompts:d({listChanged:v().optional()}).optional(),resources:d({subscribe:v().optional(),listChanged:v().optional()}).optional(),tools:d({listChanged:v().optional()}).optional(),tasks:Ne.optional(),extensions:z(a(),t).optional()}),wt=S.extend({protocolVersion:a(),capabilities:Rt,serverInfo:F,instructions:a().optional()}),We=f.extend({method:p("notifications/initialized"),params:h.optional()}),qe=u.extend({method:p("ping"),params:c.optional()}),Ge=d({progress:b(),total:M(b()),message:M(a())}),we=d({...h.shape,...Ge.shape,progressToken:o}),Ae=f.extend({method:p("notifications/progress"),params:we}),Ke=c.extend({cursor:r.optional()}),Ee=u.extend({params:Ke.optional()}),_e=S.extend({nextCursor:r.optional()}),dt=d({uri:a(),mimeType:M(a()),_meta:z(a(),I()).optional()}),pt=dt.extend({text:a()}),Ye=a().refine((ge)=>{try{return atob(ge),!0}catch{return!1}},{message:"Invalid Base64 string"}),me=dt.extend({blob:Ye}),be=D(["user","assistant"]),ye=d({audience:m(be).optional(),priority:b().min(0).max(1).optional(),lastModified:Ao({offset:!0}).optional()}),De=d({...q.shape,...B.shape,uri:a(),description:M(a()),mimeType:M(a()),size:M(b()),annotations:ye.optional(),_meta:M(A({}))}),Dt=d({...q.shape,...B.shape,uriTemplate:a(),description:M(a()),mimeType:M(a()),annotations:ye.optional(),_meta:M(A({}))}),ke=Ee.extend({method:p("resources/list")}),$e=_e.extend({resources:m(De)}),xe=Ee.extend({method:p("resources/templates/list")}),je=_e.extend({resourceTemplates:m(Dt)}),Le=c.extend({uri:a()}),Qe=Le,Xe=u.extend({method:p("resources/read"),params:Qe}),xt=S.extend({contents:m(R([pt,me]))}),et=f.extend({method:p("notifications/resources/list_changed"),params:h.optional()}),Vt=Le,P=u.extend({method:p("resources/subscribe"),params:Vt}),tt=Le,j=u.extend({method:p("resources/unsubscribe"),params:tt}),C=h.extend({uri:a()}),H=f.extend({method:p("notifications/resources/updated"),params:C}),T=d({name:a(),description:M(a()),required:M(v())}),x=d({...q.shape,...B.shape,description:M(a()),arguments:M(m(T)),_meta:M(A({}))}),Z=Ee.extend({method:p("prompts/list")}),L=_e.extend({prompts:m(x)}),le=c.extend({name:a(),arguments:z(a(),a()).optional()}),Ht=u.extend({method:p("prompts/get"),params:le}),ot=d({type:p("text"),text:a(),annotations:ye.optional(),_meta:z(a(),I()).optional()}),Ft=d({type:p("image"),data:Ye,mimeType:a(),annotations:ye.optional(),_meta:z(a(),I()).optional()}),Jt=d({type:p("audio"),data:Ye,mimeType:a(),annotations:ye.optional(),_meta:z(a(),I()).optional()}),Sr=d({type:p("tool_use"),name:a(),id:a(),input:z(a(),I()),_meta:z(a(),I()).optional()}),Pt=d({type:p("resource"),resource:R([pt,me]),annotations:ye.optional(),_meta:z(a(),I()).optional()}),_r=De.extend({type:p("resource_link")}),Ue=R([ot,Ft,Jt,_r,Pt]),vo=d({role:be,content:Ue}),Ro=S.extend({description:a().optional(),messages:m(vo)}),Bt=f.extend({method:p("notifications/prompts/list_changed"),params:h.optional()}),br=d({title:a().optional(),readOnlyHint:v().optional(),destructiveHint:v().optional(),idempotentHint:v().optional(),openWorldHint:v().optional()}),wo=d({taskSupport:D(["required","optional","forbidden"]).optional()}),Wt=d({...q.shape,...B.shape,description:a().optional(),inputSchema:d({type:p("object"),properties:z(a(),e).optional(),required:m(a()).optional()}).catchall(I()),outputSchema:d({type:p("object"),properties:z(a(),e).optional(),required:m(a()).optional()}).catchall(I()).optional(),annotations:br.optional(),execution:wo.optional(),_meta:z(a(),I()).optional()}),xo=Ee.extend({method:p("tools/list")}),Po=_e.extend({tools:m(Wt)}),To=S.extend({content:m(Ue),structuredContent:z(a(),I()).optional(),isError:v().optional()}),fe=l.extend({name:a(),arguments:z(a(),I()).optional()}),yr=u.extend({method:p("tools/call"),params:fe}),ii=f.extend({method:p("notifications/tools/list_changed"),params:h.optional()}),Eo=D(["debug","info","notice","warning","error","critical","alert","emergency"]),zr=c.extend({level:Eo}),vr=u.extend({method:p("logging/setLevel"),params:zr}),Rr=h.extend({level:Eo,logger:a().optional(),data:I()}),wr=f.extend({method:p("notifications/message"),params:Rr}),xr=d({name:a().optional()}),Pr=d({hints:m(xr).optional(),costPriority:b().min(0).max(1).optional(),speedPriority:b().min(0).max(1).optional(),intelligencePriority:b().min(0).max(1).optional()}),Tr=d({mode:D(["auto","required","none"]).optional()}),ai=d({type:p("tool_result"),toolUseId:a().describe("The unique identifier for the corresponding tool call."),content:m(Ue),structuredContent:d({}).loose().optional(),isError:v().optional(),_meta:z(a(),I()).optional()}),Er=jo("type",[ot,Ft,Jt]),Tt=jo("type",[ot,Ft,Jt,Sr,ai]),kr=d({role:be,content:R([Tt,m(Tt)]),_meta:z(a(),I()).optional()}),$r=l.extend({messages:m(kr),modelPreferences:Pr.optional(),systemPrompt:a().optional(),includeContext:D(["none","thisServer","allServers"]).optional(),temperature:b().optional(),maxTokens:b().int(),stopSequences:m(a()).optional(),metadata:t.optional(),tools:m(Wt).optional(),toolChoice:Tr.optional()}),Cr=u.extend({method:p("sampling/createMessage"),params:$r}),Ir=S.extend({model:a(),stopReason:M(D(["endTurn","stopSequence","maxTokens"]).or(a())),role:be,content:Er}),Or=S.extend({model:a(),stopReason:M(D(["endTurn","stopSequence","maxTokens","toolUse"]).or(a())),role:be,content:R([Tt,m(Tt)])}),Nr=d({type:p("boolean"),title:a().optional(),description:a().optional(),default:v().optional()}),Mr=d({type:p("string"),title:a().optional(),description:a().optional(),minLength:b().optional(),maxLength:b().optional(),format:D(["email","uri","date","date-time"]).optional(),default:a().optional()}),qr=d({type:D(["number","integer"]),title:a().optional(),description:a().optional(),minimum:b().optional(),maximum:b().optional(),default:b().optional()}),Ar=d({type:p("string"),title:a().optional(),description:a().optional(),enum:m(a()),default:a().optional()}),jr=d({type:p("string"),title:a().optional(),description:a().optional(),oneOf:m(d({const:a(),title:a()})),default:a().optional()}),Lr=d({type:p("string"),title:a().optional(),description:a().optional(),enum:m(a()),enumNames:m(a()).optional(),default:a().optional()}),Ur=R([Ar,jr]),Gt=d({type:p("array"),title:a().optional(),description:a().optional(),minItems:b().optional(),maxItems:b().optional(),items:d({type:p("string"),enum:m(a())}),default:m(a()).optional()}),Kt=d({type:p("array"),title:a().optional(),description:a().optional(),minItems:b().optional(),maxItems:b().optional(),items:d({anyOf:m(d({const:a(),title:a()}))}),default:m(a()).optional()}),ci=R([Gt,Kt]),li=R([Lr,Ur,ci]),Ce=R([li,Nr,Mr,qr]),Ie=l.extend({mode:p("form").optional(),message:a(),requestedSchema:d({type:p("object"),properties:z(a(),Ce),required:m(a()).optional()}).catchall(I())}),Zr=l.extend({mode:p("url"),message:a(),elicitationId:a(),url:a().url()}),Ve=R([Ie,Zr]),ui=u.extend({method:p("elicitation/create"),params:Ve}),di=h.extend({elicitationId:a()}),pi=f.extend({method:p("notifications/elicitation/complete"),params:di}),hi=S.extend({action:D(["accept","decline","cancel"]),content:no((ge)=>ge===null?void 0:ge,z(a(),R([a(),b(),v(),m(a())])).optional())}),mi=d({type:p("ref/resource"),uri:a()}),fi=d({type:p("ref/prompt"),name:a()}),gi=c.extend({ref:R([fi,mi]),argument:d({name:a(),value:a()}),context:d({arguments:z(a(),a()).optional()}).optional()}),Dr=u.extend({method:p("completion/complete"),params:gi}),Si=S.extend({completion:A({values:m(a()).max(100),total:M(b().int()),hasMore:M(v())})}),_i=d({uri:a().startsWith("file://"),name:a().optional(),_meta:z(a(),I()).optional()}),ko=u.extend({method:p("roots/list"),params:c.optional()}),Vr=S.extend({roots:m(_i)}),bi=f.extend({method:p("notifications/roots/list_changed"),params:h.optional()}),yi=A({ttl:b().optional(),pollInterval:b().optional()}),Hr=D(["working","input_required","completed","failed","cancelled"]),Et=d({taskId:a(),status:Hr,ttl:R([b(),ro()]),createdAt:a(),lastUpdatedAt:a(),pollInterval:M(b()),statusMessage:M(a())}),Pe=S.extend({task:Et}),zi=h.merge(Et),Yt=f.extend({method:p("notifications/tasks/status"),params:zi}),$o=u.extend({method:p("tasks/get"),params:c.extend({taskId:a()})}),Co=S.merge(Et),Io=u.extend({method:p("tasks/result"),params:c.extend({taskId:a()})}),Ia=S.loose(),ze=Ee.extend({method:p("tasks/list")}),ae=_e.extend({tasks:m(Et)}),Qt=u.extend({method:p("tasks/cancel"),params:c.extend({taskId:a()})});return{JSONValueSchema:e,JSONObjectSchema:t,ProgressTokenSchema:o,CursorSchema:r,TaskMetadataSchema:n,RelatedTaskMetadataSchema:i,RequestMetaSchema:s,BaseRequestParamsSchema:c,TaskAugmentedRequestParamsSchema:l,RequestSchema:u,NotificationsParamsSchema:h,NotificationSchema:f,ResultSchema:S,RequestIdSchema:_,EmptyResultSchema:y,CancelledNotificationParamsSchema:w,CancelledNotificationSchema:k,IconSchema:V,IconsSchema:B,BaseMetadataSchema:q,ImplementationSchema:F,ClientTasksCapabilitySchema:ie,ServerTasksCapabilitySchema:Ne,ClientCapabilitiesSchema:ce,InitializeRequestParamsSchema:Me,InitializeRequestSchema:Ze,ServerCapabilitiesSchema:Rt,InitializeResultSchema:wt,InitializedNotificationSchema:We,PingRequestSchema:qe,ProgressSchema:Ge,ProgressNotificationParamsSchema:we,ProgressNotificationSchema:Ae,PaginatedRequestParamsSchema:Ke,PaginatedRequestSchema:Ee,PaginatedResultSchema:_e,ResourceContentsSchema:dt,TextResourceContentsSchema:pt,BlobResourceContentsSchema:me,RoleSchema:be,AnnotationsSchema:ye,ResourceSchema:De,ResourceTemplateSchema:Dt,ListResourcesRequestSchema:ke,ListResourcesResultSchema:$e,ListResourceTemplatesRequestSchema:xe,ListResourceTemplatesResultSchema:je,ResourceRequestParamsSchema:Le,ReadResourceRequestParamsSchema:Qe,ReadResourceRequestSchema:Xe,ReadResourceResultSchema:xt,ResourceListChangedNotificationSchema:et,SubscribeRequestParamsSchema:Vt,SubscribeRequestSchema:P,UnsubscribeRequestParamsSchema:tt,UnsubscribeRequestSchema:j,ResourceUpdatedNotificationParamsSchema:C,ResourceUpdatedNotificationSchema:H,PromptArgumentSchema:T,PromptSchema:x,ListPromptsRequestSchema:Z,ListPromptsResultSchema:L,GetPromptRequestParamsSchema:le,GetPromptRequestSchema:Ht,TextContentSchema:ot,ImageContentSchema:Ft,AudioContentSchema:Jt,ToolUseContentSchema:Sr,EmbeddedResourceSchema:Pt,ResourceLinkSchema:_r,ContentBlockSchema:Ue,PromptMessageSchema:vo,GetPromptResultSchema:Ro,PromptListChangedNotificationSchema:Bt,ToolAnnotationsSchema:br,ToolExecutionSchema:wo,ToolSchema:Wt,ListToolsRequestSchema:xo,ListToolsResultSchema:Po,CallToolResultSchema:To,CallToolRequestParamsSchema:fe,CallToolRequestSchema:yr,ToolListChangedNotificationSchema:ii,LoggingLevelSchema:Eo,SetLevelRequestParamsSchema:zr,SetLevelRequestSchema:vr,LoggingMessageNotificationParamsSchema:Rr,LoggingMessageNotificationSchema:wr,ModelHintSchema:xr,ModelPreferencesSchema:Pr,ToolChoiceSchema:Tr,ToolResultContentSchema:ai,SamplingContentSchema:Er,SamplingMessageContentBlockSchema:Tt,SamplingMessageSchema:kr,CreateMessageRequestParamsSchema:$r,CreateMessageRequestSchema:Cr,CreateMessageResultSchema:Ir,CreateMessageResultWithToolsSchema:Or,BooleanSchemaSchema:Nr,StringSchemaSchema:Mr,NumberSchemaSchema:qr,UntitledSingleSelectEnumSchemaSchema:Ar,TitledSingleSelectEnumSchemaSchema:jr,LegacyTitledEnumSchemaSchema:Lr,SingleSelectEnumSchemaSchema:Ur,UntitledMultiSelectEnumSchemaSchema:Gt,TitledMultiSelectEnumSchemaSchema:Kt,MultiSelectEnumSchemaSchema:ci,EnumSchemaSchema:li,PrimitiveSchemaDefinitionSchema:Ce,ElicitRequestFormParamsSchema:Ie,ElicitRequestURLParamsSchema:Zr,ElicitRequestParamsSchema:Ve,ElicitRequestSchema:ui,ElicitationCompleteNotificationParamsSchema:di,ElicitationCompleteNotificationSchema:pi,ElicitResultSchema:hi,ResourceTemplateReferenceSchema:mi,PromptReferenceSchema:fi,CompleteRequestParamsSchema:gi,CompleteRequestSchema:Dr,CompleteResultSchema:Si,RootSchema:_i,ListRootsRequestSchema:ko,ListRootsResultSchema:Vr,RootsListChangedNotificationSchema:bi,TaskCreationParamsSchema:yi,TaskStatusSchema:Hr,TaskSchema:Et,CreateTaskResultSchema:Pe,TaskStatusNotificationParamsSchema:zi,TaskStatusNotificationSchema:Yt,GetTaskRequestSchema:$o,GetTaskResultSchema:Co,GetTaskPayloadRequestSchema:Io,GetTaskPayloadResultSchema:Ia,ListTasksRequestSchema:ze,ListTasksResultSchema:ae,CancelTaskRequestSchema:Qt,CancelTaskResultSchema:S.merge(Et),ClientRequestSchema:R([qe,Ze,Dr,vr,Ht,Z,ke,xe,Xe,P,j,yr,xo,$o,Io,ze,Qt]),ClientNotificationSchema:R([k,Ae,We,bi,Yt]),ClientResultSchema:R([y,Ir,Or,hi,Vr,Co,ae,Pe]),ServerRequestSchema:R([qe,Cr,ui,ko,$o,Io,ze,Qt]),ServerNotificationSchema:R([k,Ae,wr,H,et,ii,Bt,Yt,pi]),ServerResultSchema:R([y,wt,Si,Ro,L,$e,je,xt,To,Po,Co,ae,Pe]),CallToolResultWireSchema:I().superRefine((ge,sf)=>{if(typeof ge!=="object"||ge===null||Array.isArray(ge)||ge.content!==void 0)return;for(let yl of Gh)if(yl in ge){sf.addIssue({code:"custom",message:`content is required when the body carries '${yl}' — another result family cannot default into an empty tools/call success`});return}}).transform(Lg).pipe(To)}}var Zg;function Kh(){return Zg??=Ug()}function Yh(e){return e.type!=="object"}var Dg=new Set(["const","enum","default","examples"]),Vg=new Set(["properties","patternProperties","$defs","definitions","dependentSchemas","dependencies"]);function Nh(e){return e!==void 0&&!(typeof e==="string"&&e.startsWith("#"))}function Hg(e){let t=typeof e.$schema==="string"?e.$schema:void 0;if(Nh(e.$id))return{...t!==void 0&&{$schema:t},type:"object",properties:{result:e},required:["result"]};let o=xl(e.$schema)&&e.$recursiveAnchor!==!0,r=(n,i)=>{if(Array.isArray(n))return n.map((l)=>r(l,!1));if(n===null||typeof n!=="object")return n;if(!i&&Nh(n.$id))return n;let s={},c=!1;for(let[l,u]of Object.entries(n))if(i)s[l]=r(u,!1);else if((l==="$ref"||l==="$dynamicRef")&&typeof u==="string")s[l]=u==="#"?"#/properties/result":u.startsWith("#/")?`#/properties/result${u.slice(1)}`:u;else if(l==="$recursiveRef"&&u==="#"&&o)c=!0;else if(Dg.has(l))s[l]=u;else if(Vg.has(l))s[l]=r(u,!0);else s[l]=r(u,!1);if(c)if("$ref"in s)s.allOf=[...Array.isArray(s.allOf)?s.allOf:[],{$ref:"#/properties/result"}];else s.$ref="#/properties/result";return s};return{...t!==void 0&&{$schema:t},type:"object",properties:{result:r(e,!1)},required:["result"]}}var Qh={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},Xh={"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},Fg={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},ba;function nl(){if(ba)return ba;let e=Kh();return ba={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}},ba}function em(e){return Object.prototype.hasOwnProperty.call(Qh,e)}function tm(e){return Object.prototype.hasOwnProperty.call(Xh,e)}function Jg(e){return Object.prototype.hasOwnProperty.call(Fg,e)}function Bg(e){return Jg(e)?nl().resultSchemas[e]:void 0}function Wg(e){return em(e)?nl().requestSchemas[e]:void 0}function Gg(e){return tm(e)?nl().notificationSchemas[e]:void 0}var uv=Object.keys(Qh),dv=Object.keys(Xh);function Qc(e){return e!==null&&typeof e==="object"&&!Array.isArray(e)}function ya(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 Mh={ok:!1,reason:"not-in-era"};function qh(e){return Qc(e)&&Qc(e.outputSchema)&&Yh(e.outputSchema)}function Ah(e){return e}var sl={era:"2025-11-25",hasRequestMethod:em,hasNotificationMethod:tm,validateRequest:(e,t)=>ya(Wg(e),t),validateResult:(e,t)=>ya(Bg(e),t),validateNotification:(e,t)=>ya(Gg(e),t),hasInputRequestMethod:()=>!1,validateInputRequest:()=>Mh,validateInputResponse:()=>Mh,samplingResultVariant:(e,t)=>{let o=Kh();return ya(e?o.CreateMessageResultWithToolsSchema:o.CreateMessageResultSchema,t)},outboundEnvelope:(e)=>{return},validateEnvelopeMeta:(e)=>[],projectCallToolResult(e,t){let o=Wh(e),r=o.structuredContent;if(r===void 0)return o;let n=typeof r!=="object"||r===null||Array.isArray(r),i=t!==void 0&&Yh(t);if(!n&&!i)return o;return{...o,structuredContent:{result:r}}},decodeResult(e,t){if(Qc(t)&&"resultType"in t){let o={...t};return delete o.resultType,{kind:"complete",result:Ah(o)}}return{kind:"complete",result:Ah(t)}},encodeResult(e,t){if(e!=="tools/list")return t;let o=t.tools;if(!Array.isArray(o)||!o.some((r)=>qh(r)))return t;return{...t,tools:o.map((r)=>qh(r)?{...r,outputSchema:Hg(r.outputSchema)}:r)}},encodeErrorCode:(e)=>e===-32002?-32602:e,checkInboundEnvelope:(e)=>{return}};function Kg(){let e=sn(()=>R([a(),b(),v(),ro(),z(a(),e),m(e)])),t=z(a(),e),o=R([a(),b().int()]),r=a(),n=R([a(),b().int()]),i=D(["user","assistant"]),s=D(["debug","info","notice","warning","error","critical","alert","emergency"]),c=a().refine((ae)=>{try{return atob(ae),!0}catch{return!1}},{message:"Invalid Base64 string"}),l=d({ttl:b().optional()}),u=d({taskId:a()}),h=A({progressToken:o.optional(),"io.modelcontextprotocol/related-task":u.optional()}),f=d({_meta:h.optional()}),S=f.extend({task:l.optional()}),_=d({_meta:h.optional()}),y=d({method:a(),params:_.loose().optional()}),w=d({src:a(),mimeType:a().optional(),sizes:m(a()).optional(),theme:D(["light","dark"]).optional()}),k=d({icons:m(w).optional()}),V=d({name:a(),title:a().optional()}),B=V.extend({...V.shape,...k.shape,version:a(),websiteUrl:a().optional(),description:a().optional()}),q=mt(d({applyDefaults:v().optional()}),t),F=no((ae)=>{if(ae&&typeof ae==="object"&&!Array.isArray(ae)&&Object.keys(ae).length===0)return{form:{}};return ae},mt(d({form:q.optional(),url:t.optional()}),t.optional())),Y=A({list:t.optional(),cancel:t.optional(),requests:A({sampling:A({createMessage:t.optional()}).optional(),elicitation:A({create:t.optional()}).optional()}).optional()}),G=A({list:t.optional(),cancel:t.optional(),requests:A({tools:A({call:t.optional()}).optional()}).optional()}),ie=d({experimental:z(a(),t).optional(),sampling:d({context:t.optional(),tools:t.optional()}).optional(),elicitation:F.optional(),roots:d({listChanged:v().optional()}).optional(),tasks:Y.optional(),extensions:z(a(),t).optional()}),Ne=d({experimental:z(a(),t).optional(),logging:t.optional(),completions:t.optional(),prompts:d({listChanged:v().optional()}).optional(),resources:d({subscribe:v().optional(),listChanged:v().optional()}).optional(),tools:d({listChanged:v().optional()}).optional(),tasks:G.optional(),extensions:z(a(),t).optional()}),ce=d({progress:b(),total:M(b()),message:M(a())}),Me=d({..._.shape,...ce.shape,progressToken:o}),Ze=y.extend({method:p("notifications/progress"),params:Me}),Rt=_.extend({level:s,logger:a().optional(),data:I()}),wt=y.extend({method:p("notifications/message"),params:Rt}),We=d({uri:a(),mimeType:M(a()),_meta:z(a(),I()).optional()}),qe=We.extend({text:a()}),Ge=We.extend({blob:c}),we=d({audience:m(i).optional(),priority:b().min(0).max(1).optional(),lastModified:Ao({offset:!0}).optional()}),Ae=d({...V.shape,...k.shape,uri:a(),description:M(a()),mimeType:M(a()),size:M(b()),annotations:we.optional(),_meta:M(A({}))}),Ke=d({...V.shape,...k.shape,uriTemplate:a(),description:M(a()),mimeType:M(a()),annotations:we.optional(),_meta:M(A({}))}),Ee=y.extend({method:p("notifications/resources/list_changed"),params:_.optional()}),_e=_.extend({uri:a()}),dt=y.extend({method:p("notifications/resources/updated"),params:_e}),pt=d({name:a(),description:M(a()),required:M(v())}),Ye=d({...V.shape,...k.shape,description:M(a()),arguments:M(m(pt)),_meta:M(A({}))}),me=y.extend({method:p("notifications/prompts/list_changed"),params:_.optional()}),be=d({type:p("text"),text:a(),annotations:we.optional(),_meta:z(a(),I()).optional()}),ye=d({type:p("image"),data:c,mimeType:a(),annotations:we.optional(),_meta:z(a(),I()).optional()}),De=d({type:p("audio"),data:c,mimeType:a(),annotations:we.optional(),_meta:z(a(),I()).optional()}),Dt=d({type:p("tool_use"),name:a(),id:a(),input:z(a(),I()),_meta:z(a(),I()).optional()}),ke=d({type:p("resource"),resource:R([qe,Ge]),annotations:we.optional(),_meta:z(a(),I()).optional()}),$e=Ae.extend({type:p("resource_link")}),xe=R([be,ye,De,$e,ke]),je=d({role:i,content:xe}),Le=d({title:a().optional(),readOnlyHint:v().optional(),destructiveHint:v().optional(),idempotentHint:v().optional(),openWorldHint:v().optional()}),Qe=y.extend({method:p("notifications/tools/list_changed"),params:_.optional()}),Xe=d({name:a().optional()}),xt=d({hints:m(Xe).optional(),costPriority:b().min(0).max(1).optional(),speedPriority:b().min(0).max(1).optional(),intelligencePriority:b().min(0).max(1).optional()}),et=d({mode:D(["auto","required","none"]).optional()}),Vt=d({type:p("boolean"),title:a().optional(),description:a().optional(),default:v().optional()}),P=d({type:p("string"),title:a().optional(),description:a().optional(),minLength:b().optional(),maxLength:b().optional(),format:D(["email","uri","date","date-time"]).optional(),default:a().optional()}),tt=d({type:D(["number","integer"]),title:a().optional(),description:a().optional(),minimum:b().optional(),maximum:b().optional(),default:b().optional()}),j=d({type:p("string"),title:a().optional(),description:a().optional(),enum:m(a()),default:a().optional()}),C=d({type:p("string"),title:a().optional(),description:a().optional(),oneOf:m(d({const:a(),title:a()})),default:a().optional()}),H=d({type:p("string"),title:a().optional(),description:a().optional(),enum:m(a()),enumNames:m(a()).optional(),default:a().optional()}),T=R([j,C]),x=d({type:p("array"),title:a().optional(),description:a().optional(),minItems:b().optional(),maxItems:b().optional(),items:d({type:p("string"),enum:m(a())}),default:m(a()).optional()}),Z=d({type:p("array"),title:a().optional(),description:a().optional(),minItems:b().optional(),maxItems:b().optional(),items:d({anyOf:m(d({const:a(),title:a()}))}),default:m(a()).optional()}),L=R([x,Z]),le=R([H,T,L]),Ht=R([le,Vt,P,tt]),ot=S.extend({mode:p("form").optional(),message:a(),requestedSchema:d({type:p("object"),properties:z(a(),Ht),required:m(a()).optional()}).catchall(I())}),Ft=d({type:p("ref/resource"),uri:a()}),Jt=d({type:p("ref/prompt"),name:a()}),Sr=d({uri:a().startsWith("file://"),name:a().optional(),_meta:z(a(),I()).optional()}),Pt=ie.shape,_r=d({experimental:Pt.experimental,sampling:Pt.sampling,elicitation:Pt.elicitation,roots:Pt.roots,extensions:Pt.extensions}),Ue=Ne.shape,vo=d({experimental:Ue.experimental,logging:Ue.logging,completions:Ue.completions,prompts:Ue.prompts,resources:Ue.resources,tools:Ue.tools,extensions:Ue.extensions}),Ro=A({progressToken:o.optional(),[so]:a(),[Lo]:B.optional(),[io]:_r,[Zo]:s.optional()}),Bt=d({...V.shape,...k.shape,description:a().optional(),inputSchema:A({$schema:a().optional(),type:p("object")}),outputSchema:A({$schema:a().optional()}).optional(),annotations:Le.optional(),_meta:z(a(),I()).optional()}),br=d({type:p("tool_result"),toolUseId:a(),content:m(xe),structuredContent:I().optional(),isError:v().optional(),_meta:z(a(),I()).optional()}),wo=R([be,ye,De,Dt,br]),Wt=d({role:i,content:R([wo,m(wo)]),_meta:z(a(),I()).optional()}),xo=a(),Po=A({[st]:B.optional().catch(void 0)}),To=Po.optional();function fe(ae){return A({_meta:To,resultType:xo.default("complete"),...ae})}let yr=fe({}),ii=fe({nextCursor:r.optional()}),Eo=fe({content:m(xe),structuredContent:I().optional(),isError:v().optional()}),zr=fe({ttlMs:b().int().min(0),cacheScope:D(["public","private"]),tools:m(Bt),nextCursor:r.optional()}),vr=fe({ttlMs:b().int().min(0),cacheScope:D(["public","private"]),prompts:m(Ye),nextCursor:r.optional()}),Rr=fe({description:a().optional(),messages:m(je)}),wr=fe({ttlMs:b().int().min(0),cacheScope:D(["public","private"]),resources:m(Ae),nextCursor:r.optional()}),xr=fe({ttlMs:b().int().min(0),cacheScope:D(["public","private"]),resourceTemplates:m(Ke),nextCursor:r.optional()}),Pr=fe({ttlMs:b().int().min(0),cacheScope:D(["public","private"]),contents:m(R([qe,Ge]))}),Tr=fe({completion:d({values:m(a()).max(100),total:b().int().optional(),hasMore:v().optional()}).loose()}),ai=fe({ttlMs:b().int().min(0),cacheScope:D(["public","private"])}),Er=fe({ttlMs:b().int().min(0).catch(0),cacheScope:D(["public","private"]).catch("private"),supportedVersions:m(a()),capabilities:vo,instructions:a().optional()}),Tt=d({messages:m(Wt),modelPreferences:xt.optional(),systemPrompt:a().optional(),includeContext:D(["none","thisServer","allServers"]).optional(),temperature:b().optional(),maxTokens:b().int(),stopSequences:m(a()).optional(),metadata:t.optional(),tools:m(Bt).optional(),toolChoice:et.optional()}),kr=d({method:p("sampling/createMessage"),params:Tt}),$r=d({method:p("roots/list"),params:d({_meta:z(a(),I()).optional()}).optional()}),Cr=d({...Wt.shape,model:a(),stopReason:a().optional()}),Ir=d({roots:m(Sr)}),Or=d({action:D(["accept","decline","cancel"]),content:z(a(),R([a(),b(),v(),m(a())])).optional()}),Nr=d({mode:p("url"),message:a(),url:a().url()}),Mr=R([ot,Nr]),qr=d({method:p("elicitation/create"),params:Mr}),Ar=R([kr,$r,qr]),jr=R([Cr,Ir,Or]),Lr=z(a(),Ar),Ur=z(a(),jr),Gt=fe({inputRequests:Lr.optional(),requestState:a().optional()}),Kt={inputResponses:Ur.optional(),requestState:a().optional()},ci=d({_meta:Ro,...Kt}),li=A({progressToken:o.optional()});function Ce(ae,Qt){return d({method:p(ae),params:d({_meta:Ro,...Qt})})}function Ie(ae,Qt){return d({method:p(ae),params:d({_meta:li.optional(),...Qt}).optional()})}let Zr={name:a(),arguments:z(a(),I()).optional(),...Kt},Ve={cursor:r.optional()},ui=Ce("tools/call",Zr),di=Ce("tools/list",Ve),pi=Ce("prompts/list",Ve),hi=Ce("prompts/get",{name:a(),arguments:z(a(),a()).optional(),...Kt}),mi=Ce("resources/list",Ve),fi=Ce("resources/templates/list",Ve),gi=Ce("resources/read",{uri:a(),...Kt}),Dr={ref:R([Jt,Ft]),argument:d({name:a(),value:a()}),context:d({arguments:z(a(),a()).optional()}).optional()},Si=Ce("completion/complete",Dr),_i=Ce("server/discover",{}),ko=d({toolsListChanged:v().optional(),promptsListChanged:v().optional(),resourcesListChanged:v().optional(),resourceSubscriptions:m(a()).optional()}),Vr={notifications:ko},bi=Ce("subscriptions/listen",Vr),yi=Po.extend({"io.modelcontextprotocol/subscriptionId":n}),Hr=A({_meta:yi,resultType:xo.default("complete")}),Et={"tools/call":Ie("tools/call",Zr),"tools/list":Ie("tools/list",Ve),"prompts/get":Ie("prompts/get",{name:a(),arguments:z(a(),a()).optional()}),"prompts/list":Ie("prompts/list",Ve),"resources/list":Ie("resources/list",Ve),"resources/templates/list":Ie("resources/templates/list",Ve),"resources/read":Ie("resources/read",{uri:a()}),"completion/complete":Ie("completion/complete",Dr),"server/discover":Ie("server/discover",{}),"subscriptions/listen":Ie("subscriptions/listen",Vr)};function Pe(ae){return A({_meta:To,...ae})}let zi={"tools/call":Pe({content:m(xe),structuredContent:I().optional(),isError:v().optional()}),"tools/list":Pe({ttlMs:b().int().min(0),cacheScope:D(["public","private"]),tools:m(Bt),nextCursor:r.optional()}),"prompts/get":Pe({description:a().optional(),messages:m(je)}),"prompts/list":Pe({ttlMs:b().int().min(0),cacheScope:D(["public","private"]),prompts:m(Ye),nextCursor:r.optional()}),"resources/list":Pe({ttlMs:b().int().min(0),cacheScope:D(["public","private"]),resources:m(Ae),nextCursor:r.optional()}),"resources/templates/list":Pe({ttlMs:b().int().min(0),cacheScope:D(["public","private"]),resourceTemplates:m(Ke),nextCursor:r.optional()}),"resources/read":Pe({ttlMs:b().int().min(0),cacheScope:D(["public","private"]),contents:m(R([qe,Ge]))}),"completion/complete":Pe({completion:d({values:m(a()).max(100),total:b().int().optional(),hasMore:v().optional()}).loose()}),"server/discover":Pe({ttlMs:b().int().min(0).catch(0),cacheScope:D(["public","private"]).catch("private"),supportedVersions:m(a()),capabilities:vo,instructions:a().optional()}),"subscriptions/listen":Pe({})},Yt=A({"io.modelcontextprotocol/subscriptionId":n.optional()}),$o=d({method:p("notifications/subscriptions/acknowledged"),params:d({_meta:Yt.optional(),notifications:ko})}),Co=d({_meta:Yt.optional(),requestId:n,reason:a().optional()}),Io=d({method:p("notifications/cancelled"),params:Co}),Ia={"notifications/cancelled":Io,"notifications/progress":Ze,"notifications/message":wt,"notifications/resources/updated":dt,"notifications/resources/list_changed":Ee,"notifications/tools/list_changed":Qe,"notifications/prompts/list_changed":me,"notifications/subscriptions/acknowledged":$o},ze=(ae)=>d({jsonrpc:p("2.0"),id:R([a(),b().int()]),result:ae}).strict();return{JSONValueSchema:e,JSONObjectSchema:t,ProgressTokenSchema:o,CursorSchema:r,RequestIdSchema:n,RoleSchema:i,LoggingLevelSchema:s,TaskMetadataSchema:l,RelatedTaskMetadataSchema:u,RequestMetaSchema:h,BaseRequestParamsSchema:f,TaskAugmentedRequestParamsSchema:S,NotificationsParamsSchema:_,NotificationSchema:y,IconSchema:w,IconsSchema:k,BaseMetadataSchema:V,ImplementationSchema:B,ClientTasksCapabilitySchema:Y,ServerTasksCapabilitySchema:G,ClientCapabilitiesSchema:ie,ServerCapabilitiesSchema:Ne,ProgressSchema:ce,ProgressNotificationParamsSchema:Me,ProgressNotificationSchema:Ze,LoggingMessageNotificationParamsSchema:Rt,LoggingMessageNotificationSchema:wt,ResourceContentsSchema:We,TextResourceContentsSchema:qe,BlobResourceContentsSchema:Ge,AnnotationsSchema:we,ResourceSchema:Ae,ResourceTemplateSchema:Ke,ResourceListChangedNotificationSchema:Ee,ResourceUpdatedNotificationParamsSchema:_e,ResourceUpdatedNotificationSchema:dt,PromptArgumentSchema:pt,PromptSchema:Ye,PromptListChangedNotificationSchema:me,TextContentSchema:be,ImageContentSchema:ye,AudioContentSchema:De,ToolUseContentSchema:Dt,EmbeddedResourceSchema:ke,ResourceLinkSchema:$e,ContentBlockSchema:xe,PromptMessageSchema:je,ToolAnnotationsSchema:Le,ToolListChangedNotificationSchema:Qe,ModelHintSchema:Xe,ModelPreferencesSchema:xt,ToolChoiceSchema:et,BooleanSchemaSchema:Vt,StringSchemaSchema:P,NumberSchemaSchema:tt,UntitledSingleSelectEnumSchemaSchema:j,TitledSingleSelectEnumSchemaSchema:C,LegacyTitledEnumSchemaSchema:H,SingleSelectEnumSchemaSchema:T,UntitledMultiSelectEnumSchemaSchema:x,TitledMultiSelectEnumSchemaSchema:Z,MultiSelectEnumSchemaSchema:L,EnumSchemaSchema:le,PrimitiveSchemaDefinitionSchema:Ht,ElicitRequestFormParamsSchema:ot,ResourceTemplateReferenceSchema:Ft,PromptReferenceSchema:Jt,RootSchema:Sr,ClientCapabilities2026Schema:_r,ServerCapabilities2026Schema:vo,RequestMetaEnvelopeSchema:Ro,ToolSchema:Bt,ToolResultContentSchema:br,SamplingMessageContentBlockSchema:wo,SamplingMessageSchema:Wt,ResultTypeSchema:xo,ResultMetaSchema:Po,ResultSchema:yr,PaginatedResultSchema:ii,CallToolResultSchema:Eo,ListToolsResultSchema:zr,ListPromptsResultSchema:vr,GetPromptResultSchema:Rr,ListResourcesResultSchema:wr,ListResourceTemplatesResultSchema:xr,ReadResourceResultSchema:Pr,CompleteResultSchema:Tr,CacheableResultSchema:ai,DiscoverResultSchema:Er,CreateMessageRequestParamsSchema:Tt,CreateMessageRequestSchema:kr,ListRootsRequestSchema:$r,CreateMessageResultSchema:Cr,ListRootsResultSchema:Ir,ElicitResultSchema:Or,ElicitRequestURLParamsSchema:Nr,ElicitRequestParamsSchema:Mr,ElicitRequestSchema:qr,InputRequestSchema:Ar,InputResponseSchema:jr,InputRequestsSchema:Lr,InputResponsesSchema:Ur,InputRequiredResultSchema:Gt,InputResponseRequestParamsSchema:ci,CallToolRequestSchema:ui,ListToolsRequestSchema:di,ListPromptsRequestSchema:pi,GetPromptRequestSchema:hi,ListResourcesRequestSchema:mi,ListResourceTemplatesRequestSchema:fi,ReadResourceRequestSchema:gi,CompleteRequestSchema:Si,DiscoverRequestSchema:_i,SubscriptionFilterSchema:ko,SubscriptionsListenRequestSchema:bi,SubscriptionsListenResultMetaSchema:yi,SubscriptionsListenResultSchema:Hr,dispatchRequestSchemas:Et,dispatchResultSchemas:zi,NotificationMetaSchema:Yt,SubscriptionsAcknowledgedNotificationSchema:$o,CancelledNotificationParamsSchema:Co,CancelledNotificationSchema:Io,notificationSchemas2026:Ia,JSONRPCResultResponseSchema:ze(yr),CallToolResultResponseSchema:ze(R([Eo,Gt])),ListToolsResultResponseSchema:ze(zr),ListPromptsResultResponseSchema:ze(vr),GetPromptResultResponseSchema:ze(R([Rr,Gt])),ListResourcesResultResponseSchema:ze(wr),ListResourceTemplatesResultResponseSchema:ze(xr),ReadResourceResultResponseSchema:ze(R([Pr,Gt])),CompleteResultResponseSchema:ze(Tr),DiscoverResultResponseSchema:ze(Er),SubscriptionsListenResultResponseSchema:ze(Hr)}}var Yg;function Ut(){return Yg??=Kg()}var Qg=["tools/list","prompts/list","resources/list","resources/templates/list","resources/read","server/discover"];function Xg(e){return Qg.includes(e)}var il=Symbol("modelcontextprotocol.resultCacheHintFallback");function eS(e){return e[il]}function om(e){return typeof e==="number"&&Number.isSafeInteger(e)&&e>=0}function rm(e){return e==="public"||e==="private"}var U=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}({}),W=class e extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.ProtocolError"})}static[Symbol.hasInstance](t){return Te(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 Te(this,t)}constructor(t,o,r){super(o);this.code=t,this.data=r,this.name="ProtocolError",Zt(this,new.target)}static fromError(t,o,r){if(t===U.UrlElicitationRequired&&r){let n=r;if(n.elicitations)return new sm(n.elicitations,o)}if(t===U.UnsupportedProtocolVersion&&r){let n=r;if(Array.isArray(n.supported)&&typeof n.requested==="string")return new ei({supported:n.supported,requested:n.requested},o)}if(t===U.InvalidParams||t===U.ResourceNotFound){let n=r;if(typeof n?.uri==="string"&&(t===U.ResourceNotFound||Object.keys(n).length===1))return new nm(n.uri,o)}if(t===U.MissingRequiredClientCapability&&r){let n=r;if(n.requiredCapabilities!==null&&typeof n.requiredCapabilities==="object"&&!Array.isArray(n.requiredCapabilities))return new im({requiredCapabilities:n.requiredCapabilities},o)}return new e(t,o,r)}},nm=class extends W{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.ResourceNotFoundError"})}constructor(e,t=`Resource not found: ${e}`){super(U.InvalidParams,t,{uri:e})}get uri(){return this.data.uri}},sm=class extends W{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.UrlElicitationRequiredError"})}constructor(e,t=`URL elicitation${e.length>1?"s":""} required`){super(U.UrlElicitationRequired,t,{elicitations:e})}get elicitations(){return this.data?.elicitations??[]}},ei=class extends W{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.UnsupportedProtocolVersionError"})}constructor(e,t=`Unsupported protocol version: ${e.requested}`){super(U.UnsupportedProtocolVersion,t,e)}get supported(){return this.data.supported}get requested(){return this.data.requested}},im=class extends W{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.MissingRequiredClientCapabilityError"})}constructor(e,t=`Missing required client capabilities: ${Object.keys(e.requiredCapabilities).join(", ")}`){super(U.MissingRequiredClientCapability,t,e)}get requiredCapabilities(){return this.data.requiredCapabilities}},tS=0,oS="private",rS=["tools/call","prompts/get","resources/read"];function nS(e,t){let o=t.resultType;if(o===void 0)return{...t,resultType:"complete"};if(o==="complete")return t;if(rS.includes(e))return t;throw new W(U.InternalError,`Handler for ${e} returned resultType '${String(o)}', but results of ${e} only support 'complete' on protocol revision 2026-07-28`)}function sS(e,t){let o=eS(t);if(t.resultType!=="complete"||!Xg(e))return o===void 0?t:uS(t);let r=t,n=om(r.ttlMs)?r.ttlMs:cS(o),i=rm(r.cacheScope)?r.cacheScope:lS(o),s={...r,ttlMs:n,cacheScope:i};return delete s[il],s}function iS(e){return e!==null&&typeof e==="object"&&!Array.isArray(e)}function aS(e,t){if(t===void 0)return e;let o=e._meta;if(o===void 0)return{...e,_meta:{[st]:t}};if(!iS(o))return e;if(o[st]!==void 0)return e;return{...e,_meta:{...o,[st]:t}}}function cS(e){return e!==void 0&&om(e.ttlMs)?e.ttlMs:tS}function lS(e){return e!==void 0&&rm(e.cacheScope)?e.cacheScope:oS}function uS(e){let t={...e};return delete t[il],t}var dS=["elicitation/create","sampling/createMessage","roots/list"],za;function am(){if(za)return za;let e=Ut();return za={request:{"elicitation/create":d({method:p("elicitation/create"),params:e.ElicitRequestParamsSchema}),"sampling/createMessage":d({method:p("sampling/createMessage"),params:e.CreateMessageRequestParamsSchema}),"roots/list":d({method:p("roots/list"),params:A({}).optional()})},response:{"elicitation/create":e.ElicitResultSchema,"sampling/createMessage":e.CreateMessageResultSchema,"roots/list":e.ListRootsResultSchema}},za}function cm(e){return dS.includes(e)}function Bc(e){return cm(e)?am().request[e]:void 0}function pS(e){return cm(e)?am().response[e]:void 0}var al={"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},lm={"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 um(e){return Object.prototype.hasOwnProperty.call(al,e)}function dm(e){return Object.prototype.hasOwnProperty.call(lm,e)}function hS(e){return Object.prototype.hasOwnProperty.call(al,e)}function mS(e){return um(e)?Ut().dispatchRequestSchemas[e]:void 0}function fS(e){return hS(e)?Ut().dispatchResultSchemas[e]:void 0}function gS(e){return dm(e)?Ut().notificationSchemas2026[e]:void 0}var pv=Object.keys(al),hv=Object.keys(lm);function Gs(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 SS={ok:!1,reason:"not-in-era"},_S=[so,io];function bS(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((c)=>Gs(c)&&("execution"in c)))n().tools=i.map((c)=>{if(!Gs(c)||!("execution"in c))return c;let l={...c};return delete l.execution,l});let s=t.capabilities;if(Gs(s)&&"tasks"in s){let c={...s};delete c.tasks,n().capabilities=c}return o}var cl={era:"2026-07-28",hasRequestMethod:um,hasNotificationMethod:dm,hasInputRequestMethod:(e)=>Bc(e)!==void 0,validateRequest:(e,t)=>Bs(mS(e),t),validateResult:(e,t)=>Bs(fS(e),t),validateNotification:(e,t)=>Bs(gS(e),t),validateInputRequest:(e,t)=>Bs(Bc(e),t),validateInputResponse:(e,t)=>Bs(pS(e),t),samplingResultVariant:()=>SS,outboundEnvelope(e){return{[so]:e.protocolVersion,[Lo]:e.clientInfo,[io]:e.clientCapabilities,...e.logLevel!==void 0&&{[Zo]:e.logLevel}}},validateEnvelopeMeta(e){let t=[];for(let r of _S)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((s)=>s.key===i&&s.problem==="missing"))continue;t.push({key:i,problem:r.message})}return t},projectCallToolResult:(e)=>Wh(e),inputRequestSchema:Bc,decodeResult(e,t){if(!Gs(t))return{kind:"invalid",error:new E(N.InvalidResult,`Invalid result for ${e}: not an object`,{method:e})};let o=t.resultType;if(o===void 0)return{kind:"invalid",error:new E(N.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 E(N.InvalidResult,`Invalid result for ${e}: non-string resultType`,{method:e,resultType:o})};if(o==="input_required"){let s=t.inputRequests,c=Gs(s)?s:{},l=t.requestState,u=t._meta===void 0?void 0:Ut().ResultMetaSchema.safeParse(t._meta),h=u?.success?u.data:void 0;if(Object.keys(c).length===0&&typeof l!=="string")return{kind:"invalid",error:new E(N.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:c,...typeof l==="string"&&{requestState:l},...h!==void 0&&{_meta:h}}}if(o!=="complete")return{kind:"invalid",error:new E(N.UnsupportedResultType,`Unsupported result type '${o}' for ${e}`,{resultType:o,method:e})};let r=yS(),n=Object.hasOwn(r,e)?r[e]:void 0;if(n!==void 0){let s=n.safeParse(t);if(!s.success)return{kind:"invalid",error:new E(N.InvalidResult,`Invalid result for ${e}: ${s.error}`,{method:e})}}let i={...t};return delete i.resultType,{kind:"complete",result:i}},encodeResult(e,t,o){return aS(sS(e,nS(e,bS(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("; ")}`}},va;function yS(){if(va)return va;let e=Ut();return va={"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},va}var xa="2026-07-28";function zt(e){return e!==void 0&&vt(e)?cl:sl}function jh(e){if(e.revision!==void 0)return zt(e.revision).era;return e.era==="modern"?cl.era:sl.era}function Wc(e){return pm.some((t)=>t.hasRequestMethod(e))}function Gc(e){return pm.some((t)=>t.hasNotificationMethod(e))}function Lh(e){return e==="tasks/get"||e==="tasks/cancel"}var pm=[sl,cl],zS=vl({AnnotationsSchema:()=>at,AudioContentSchema:()=>fo,BaseMetadataSchema:()=>nt,BaseRequestParamsSchema:()=>ue,BlobResourceContentsSchema:()=>er,BooleanSchemaSchema:()=>nr,CallToolRequestParamsSchema:()=>os,CallToolRequestSchema:()=>rs,CallToolResultSchema:()=>Lt,CancelTaskRequestSchema:()=>la,CancelTaskResultSchema:()=>ua,CancelledNotificationParamsSchema:()=>un,CancelledNotificationSchema:()=>Wo,ClientCapabilitiesSchema:()=>pn,ClientNotificationSchema:()=>pa,ClientRequestSchema:()=>da,ClientResultSchema:()=>ha,ClientTasksCapabilitySchema:()=>Yi,CompatibilityCallToolResultSchema:()=>Xi,CompleteRequestParamsSchema:()=>Cs,CompleteRequestSchema:()=>Is,CompleteResultSchema:()=>Os,ContentBlockSchema:()=>ct,CreateMessageRequestParamsSchema:()=>gs,CreateMessageRequestSchema:()=>Ss,CreateMessageResultSchema:()=>_s,CreateMessageResultWithToolsSchema:()=>bs,CreateTaskResultSchema:()=>ta,CursorSchema:()=>Vo,DiscoverRequestSchema:()=>Sn,DiscoverResultSchema:()=>At,ElicitRequestFormParamsSchema:()=>yo,ElicitRequestParamsSchema:()=>ws,ElicitRequestSchema:()=>xs,ElicitRequestURLParamsSchema:()=>Rs,ElicitResultSchema:()=>Es,ElicitationCompleteNotificationParamsSchema:()=>Ps,ElicitationCompleteNotificationSchema:()=>Ts,EmbeddedResourceSchema:()=>go,EmptyResultSchema:()=>qt,EnumSchemaSchema:()=>vs,GetPromptRequestParamsSchema:()=>Jn,GetPromptRequestSchema:()=>Bn,GetPromptResultSchema:()=>Kn,GetTaskPayloadRequestSchema:()=>sa,GetTaskPayloadResultSchema:()=>ia,GetTaskRequestSchema:()=>ra,GetTaskResultSchema:()=>na,IconSchema:()=>dn,IconsSchema:()=>gt,ImageContentSchema:()=>mo,ImplementationSchema:()=>it,InitializeRequestParamsSchema:()=>hn,InitializeRequestSchema:()=>mn,InitializeResultSchema:()=>fn,InitializedNotificationSchema:()=>gn,JSONArraySchema:()=>Gi,JSONObjectSchema:()=>oe,JSONRPCErrorResponseSchema:()=>lo,JSONRPCMessageSchema:()=>uo,JSONRPCNotificationSchema:()=>Bo,JSONRPCRequestSchema:()=>Jo,JSONRPCResponseSchema:()=>Ki,JSONRPCResultResponseSchema:()=>co,JSONValueSchema:()=>ft,LegacyTitledEnumSchemaSchema:()=>ar,ListChangedOptionsBaseSchema:()=>ss,ListPromptsRequestSchema:()=>Hn,ListPromptsResultSchema:()=>Fn,ListResourceTemplatesRequestSchema:()=>wn,ListResourceTemplatesResultSchema:()=>xn,ListResourcesRequestSchema:()=>vn,ListResourcesResultSchema:()=>Rn,ListRootsRequestSchema:()=>Ms,ListRootsResultSchema:()=>qs,ListTasksRequestSchema:()=>aa,ListTasksResultSchema:()=>ca,ListToolsRequestSchema:()=>es,ListToolsResultSchema:()=>ts,LoggingLevelSchema:()=>rr,LoggingMessageNotificationParamsSchema:()=>cs,LoggingMessageNotificationSchema:()=>ls,ModelHintSchema:()=>us,ModelPreferencesSchema:()=>ds,MultiSelectEnumSchemaSchema:()=>zs,NotificationSchema:()=>he,NotificationsParamsSchema:()=>Se,NumberSchemaSchema:()=>bo,PaginatedRequestParamsSchema:()=>yn,PaginatedRequestSchema:()=>St,PaginatedResultSchema:()=>_t,PingRequestSchema:()=>Ko,PrimitiveSchemaDefinitionSchema:()=>ur,ProgressNotificationParamsSchema:()=>bn,ProgressNotificationSchema:()=>Yo,ProgressSchema:()=>_n,ProgressTokenSchema:()=>Do,PromptArgumentSchema:()=>Dn,PromptListChangedNotificationSchema:()=>Yn,PromptMessageSchema:()=>Gn,PromptReferenceSchema:()=>$s,PromptSchema:()=>Vn,ReadResourceRequestParamsSchema:()=>Pn,ReadResourceRequestSchema:()=>Tn,ReadResourceResultSchema:()=>En,RelatedTaskMetadataSchema:()=>ln,RequestIdSchema:()=>Je,RequestMetaSchema:()=>Ho,RequestSchema:()=>re,ResourceContentsSchema:()=>Qo,ResourceLinkSchema:()=>So,ResourceListChangedNotificationSchema:()=>kn,ResourceRequestParamsSchema:()=>po,ResourceSchema:()=>tr,ResourceTemplateReferenceSchema:()=>ks,ResourceTemplateSchema:()=>zn,ResourceUpdatedNotificationParamsSchema:()=>Un,ResourceUpdatedNotificationSchema:()=>Zn,ResultMetaObjectSchema:()=>Fo,ResultSchema:()=>ne,RoleSchema:()=>bt,RootSchema:()=>Ns,RootsListChangedNotificationSchema:()=>As,SamplingContentSchema:()=>ms,SamplingMessageContentBlockSchema:()=>Nt,SamplingMessageSchema:()=>fs,ServerCapabilitiesSchema:()=>Go,ServerNotificationSchema:()=>fa,ServerRequestSchema:()=>ma,ServerResultSchema:()=>ga,ServerTasksCapabilitySchema:()=>Qi,SetLevelRequestParamsSchema:()=>is,SetLevelRequestSchema:()=>as,SingleSelectEnumSchemaSchema:()=>ys,StringSchemaSchema:()=>_o,SubscribeRequestParamsSchema:()=>$n,SubscribeRequestSchema:()=>Cn,SubscriptionFilterSchema:()=>or,SubscriptionsAcknowledgedNotificationParamsSchema:()=>qn,SubscriptionsAcknowledgedNotificationSchema:()=>An,SubscriptionsListenRequestParamsSchema:()=>Nn,SubscriptionsListenRequestSchema:()=>Mn,SubscriptionsListenResultMetaSchema:()=>jn,SubscriptionsListenResultSchema:()=>Ln,TaskAugmentedRequestParamsSchema:()=>Mt,TaskCreationParamsSchema:()=>ea,TaskMetadataSchema:()=>cn,TaskSchema:()=>yt,TaskStatusNotificationParamsSchema:()=>Ls,TaskStatusNotificationSchema:()=>oa,TaskStatusSchema:()=>js,TextContentSchema:()=>ho,TextResourceContentsSchema:()=>Xo,TitledMultiSelectEnumSchemaSchema:()=>lr,TitledSingleSelectEnumSchemaSchema:()=>ir,ToolAnnotationsSchema:()=>Qn,ToolChoiceSchema:()=>ps,ToolExecutionSchema:()=>Xn,ToolListChangedNotificationSchema:()=>ns,ToolResultContentSchema:()=>hs,ToolSchema:()=>jt,ToolUseContentSchema:()=>Wn,UnsubscribeRequestParamsSchema:()=>In,UnsubscribeRequestSchema:()=>On,UntitledMultiSelectEnumSchemaSchema:()=>cr,UntitledSingleSelectEnumSchemaSchema:()=>sr});var Pa=(e)=>Jo.safeParse(e).success,hm=(e)=>Bo.safeParse(e).success,fr=(e)=>co.safeParse(e).success,ti=(e)=>lo.safeParse(e).success;var mm=(e)=>typeof e==="object"&&e!==null&&!Array.isArray(e)&&e.resultType==="input_required";var vS="Mcp-Param-",Uh="x-mcp-header",RS=/^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/,wS=new Set(["string","integer","boolean"]);function ll(e){let t=[],o=new Map,r,n=(s,c,l)=>{if(s===null||typeof s!=="object")return;let u=s;if(Uh in u){if(!l||c.length===0)return`${Ra(c)}: x-mcp-header is only permitted on properties statically reachable via a chain of 'properties' keys (not under items, additionalProperties, oneOf/anyOf/allOf/not, if/then/else, or $ref)`;let f=u[Uh];if(typeof f!=="string"||f.length===0)return`${Ra(c)}: x-mcp-header MUST be a non-empty string`;if(!RS.test(f))return`${Ra(c)}: x-mcp-header '${f}' is not a valid RFC 9110 token (no spaces, control characters or HTTP delimiters)`;let S=typeof u.type==="string"?u.type:void 0;if(S===void 0||!wS.has(S)){let w=`${Ra(c)}: x-mcp-header is only permitted on primitive-typed properties (string, integer, boolean); got ${S??"<none>"}`;if(S!=="number")return w;r??=w}let _=f.toLowerCase(),y=o.get(_);if(y!==void 0)return`x-mcp-header '${f}' is not case-insensitively unique (also declared as '${y}')`;o.set(_,f),t.push({path:c,headerName:f,type:S})}let h=u.properties;if(h!==null&&typeof h==="object")for(let[f,S]of Object.entries(h)){let _=n(S,[...c,f],l);if(_!==void 0)return _}for(let f of xS){let S=u[f];if(S===void 0)continue;let _=Array.isArray(S)?S:S!==null&&typeof S==="object"&&PS.has(f)?Object.values(S):[S];for(let y of _){let w=n(y,[...c,`<${f}>`],!1);if(w!==void 0)return w}}},i=n(e,[],!0);if(i!==void 0)return{valid:!1,reason:r??i};return r===void 0?{valid:!0,declarations:t}:{valid:!1,reason:r,declarations:t}}var xS=["items","prefixItems","contains","additionalProperties","unevaluatedProperties","unevaluatedItems","propertyNames","patternProperties","dependentSchemas","oneOf","anyOf","allOf","not","if","then","else","$defs","definitions"],PS=new Set(["patternProperties","dependentSchemas","$defs","definitions"]);function Ra(e){return e.length===0?"<root>":e.join(".")}var fm="=?base64?",gm="?=";function TS(e){if(typeof e==="string")return e;if(typeof e==="boolean")return e?"true":"false";if(typeof e==="number"){if(!Number.isFinite(e))return;if(Number.isInteger(e)&&!Number.isSafeInteger(e))return;return String(e)}}function ES(e){if(e.length===0)return!0;if(e.startsWith(fm)&&e.endsWith(gm))return!0;if(e!==e.trim())return!0;for(let t=0;t<e.length;t++){let o=e.codePointAt(t);if(o===9||o>=32&&o<=126)continue;return!0}return!1}function kS(e){let t=new TextEncoder().encode(e),o="";for(let r of t)o+=String.fromCodePoint(r);return btoa(o)}function Sm(e){return ES(e)?`${fm}${kS(e)}${gm}`:e}function $S(e,t){let o=e;for(let r of t){if(o===null||typeof o!=="object")return;o=o[r]}return o}function _m(e,t){let o={};for(let r of e){let n=$S(t,r.path);if(n===void 0||n===null)continue;let i=TS(n);if(i===void 0)continue;o[`${vS}${r.headerName}`]=Sm(i)}return o}var mr=-32020,mv=[{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:[U.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:[mr,U.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:[U.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:[U.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:[U.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:[mr],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:[U.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:[mr],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."}],fv={[U.ParseError]:400,[U.InvalidRequest]:400,[U.MethodNotFound]:404,[U.UnsupportedProtocolVersion]:400,[U.MissingRequiredClientCapability]:400,[mr]:400};function Ta(e,t){return Di(e,t)}function Ws(e){return new Set(e.flatMap((t)=>Object.keys(t.shape)))}function Xc(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 Zh=!1,el="draft-2020-12";function CS(e,t="input"){let o=e["~standard"],r;if(o.jsonSchema)r=o.jsonSchema[t]({target:el});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(!Zh)Zh=!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=Ui(e,{target:el,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 bm(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}}var IS=/^#\/(\$defs|definitions)\/([^/~%]+)$/;function bm(e,t=e){if("properties"in e||"patternProperties"in e||"additionalProperties"in e||"required"in e)return!0;let o=typeof e.$ref==="string"&&IS.exec(e.$ref);if(o&&t[o[1]]?.[o[2]]?.type==="object")return!0;for(let r of["oneOf","anyOf","allOf"]){let n=e[r];if(Array.isArray(n)&&n.length>0)return n.every((i)=>i!==null&&typeof i==="object"&&(i.type==="object"||bm(i,"$id"in i?{}:t)))}return!1}function OS(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 Kc(e,t){let o=await e["~standard"].validate(t);if(o.issues&&o.issues.length>0)return{success:!1,error:o.issues.map((r)=>OS(r)).join(", ")};return{success:!0,data:o.value}}function NS(e){let t=Ui(e,{target:el,io:"input"});return typeof t.pattern==="string"?t.pattern:void 0}var MS=/\\\.\\d\{(\d+)\}/;function qS(e){let t=MS.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)=>Ao({local:r,offset:n,precision:i}))))}function AS(e,t){let o;switch(e){case"email":o=[ph()];break;case"uri":o=[Hi()];break;case"date":o=[Uc()];break;case"date-time":o=qS(t);break}return new Set(o.map((r)=>NS(r)).filter((r)=>r!==void 0))}function jS(e,t,o){if(o!=="zod")return!0;return AS(e,t).has(t)}function Ys(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}function LS(e){try{return CS(e,"input")}catch(t){let o=t instanceof Error?t.message:String(t);throw new W(U.InvalidParams,`Elicitation requestedSchema must describe an object with flat primitive properties: ${o}`)}}var US=new Set(["$comment","deprecated","description","examples","readOnly","title","writeOnly"]);function ul(e){return US.has(e)||e.startsWith("x-")}var ZS=new Set(["$schema",...Object.keys(yo.shape.requestedSchema.shape)]),Dh={string:Ws([_o,sr,ir,ar]),number:Ws([bo]),integer:Ws([bo]),boolean:Ws([nr]),array:Ws([cr,lr])},DS=new Set(_o.shape.format.unwrap().options);function VS(e,t,o,r){if(!Ys(e))return e;let n=typeof e.type==="string"&&Object.hasOwn(Dh,e.type)?Dh[e.type]:void 0;if(n===void 0)return e;let i={};for(let[s,c]of Object.entries(e))if(n.has(s)||ul(s))i[s]=c;else if(s==="pattern"&&e.type==="string"&&typeof e.format==="string"){if(!DS.has(e.format))i[s]=c;else if(typeof c!=="string"||!jS(e.format,c,o))r.push(`${t}.${s}`)}else r.push(`${t}.${s}`);return i}function HS(e,t){let o={},r=[];for(let[n,i]of Object.entries(e))if(n==="properties"&&Ys(i))o[n]=Object.fromEntries(Object.entries(i).map(([s,c])=>[s,VS(c,`properties.${s}`,t,r)]));else if(ZS.has(n))o[n]=i;else if(!ul(n))r.push(n);if(r.length>0)throw new W(U.InvalidParams,`Elicitation requestedSchema contains unsupported JSON Schema constraint(s) after Standard Schema conversion: ${r.join(", ")}`);return o}function FS(e,t){if(!Ys(e.properties))return t;let o=Object.entries(e.properties).filter(([,r])=>!Ta(ur,r).success).map(([r])=>`properties.${r}`);return o.length>0?o.join(", "):t}function tl(e,t,o=""){if(Array.isArray(e)&&Array.isArray(t))return e.flatMap((r,n)=>tl(r,t[n],`${o}[${n}]`));if(!Ys(e)||!Ys(t))return[];return Object.entries(e).flatMap(([r,n])=>{let i=o?`${o}.${r}`:r;if(!Object.prototype.hasOwnProperty.call(t,r))return ul(r)?[]:[i];return tl(n,t[r],i)})}function JS(e){if(!Xc(e.requestedSchema))return{...e,mode:"form",requestedSchema:e.requestedSchema};let t=e.requestedSchema["~standard"].vendor,o=HS(LS(e.requestedSchema),t),r=Ta(yo.shape.requestedSchema,o);if(!r.success)throw new W(U.InvalidParams,`Elicitation requestedSchema only supports flat primitive properties (string, number, integer, boolean, and string enums): ${FS(o,r.error.message)}`);let n=tl(o,r.data);if(n.length>0)throw new W(U.InvalidParams,`Elicitation requestedSchema contains unsupported JSON Schema constraint(s) after Standard Schema conversion: ${n.join(", ")}`);let i=(r.data.required??[]).filter((s)=>!Object.prototype.hasOwnProperty.call(r.data.properties,s));if(i.length>0)throw new W(U.InvalidParams,`Elicitation requestedSchema lists required properties that are not defined in properties: ${i.join(", ")}`);return{...e,mode:"form",requestedSchema:r.data}}function BS(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 gv=Object.assign(BS,{elicit(e){try{return{method:"elicitation/create",params:JS(e)}}catch(t){throw t instanceof W?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 WS=!0,GS=10,KS=250;function ym(e){return{autoFulfill:e?.autoFulfill??WS,maxRounds:e?.maxRounds??GS}}function YS(e,t,o){let r=t!==void 0&&Object.keys(t).length>0;if(!r&&o===void 0)return e;return{...e,...r&&{inputResponses:t},...o!==void 0&&{requestState:o}}}function QS(e,t){return`Multi-round-trip request '${e}' still required input after ${t} rounds (inputRequired.maxRounds)`}function XS(e,t){return new Promise((o,r)=>{if(t?.aborted){r(t.reason instanceof E?t.reason:new E(N.RequestTimeout,String(t.reason)));return}let n=setTimeout(()=>{t?.removeEventListener("abort",i),o()},e),i=()=>{clearTimeout(n),r(t?.reason instanceof E?t.reason:new E(N.RequestTimeout,String(t?.reason)))};t?.addEventListener("abort",i,{once:!0})})}function e_(e){let t=new AbortController,o=()=>t.abort(e?.reason);if(e?.addEventListener("abort",o,{once:!0}),e?.aborted)t.abort(e.reason);return{signal:t.signal,abort:(r)=>t.abort(r),dispose:()=>e?.removeEventListener("abort",o)}}async function t_(e){let{config:t,method:o,originalParams:r,requestOptions:n,hooks:i,signal:s}=e,c=e.flowStartedAt??Date.now(),l=e.firstPayload,u=0;while(!0){if(u+=1,u>t.maxRounds)throw new E(N.InputRequiredRoundsExceeded,QS(o,t.maxRounds),{rounds:t.maxRounds,lastResult:{inputRequests:l.inputRequests,...l.requestState!==void 0&&{requestState:l.requestState}}});n.onprogress?.({progress:u,message:`Fulfilling input required by '${o}' (round ${u})`});let h=Object.entries(l.inputRequests??{}),f;if(h.length>0){let y=e_(s);try{let w=await Promise.all(h.map(async([k,V])=>{try{return[k,await i.dispatchInputRequest(k,V,y.signal)]}catch(B){throw y.abort(B),B}}));f=Object.fromEntries(w)}finally{y.dispose()}}else await XS(KS,s);let S={...n.timeout!==void 0&&{timeout:n.timeout}};if(n.maxTotalTimeout!==void 0){let y=Date.now()-c,w=n.maxTotalTimeout-y;if(w<=0)throw new E(N.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:n.maxTotalTimeout,totalElapsed:y});S.maxTotalTimeout=w}let _=await i.retry(YS(r,f,l.requestState),S);if(mm(_)){l={inputRequests:_.inputRequests??{},..._.requestState!==void 0&&{requestState:_.requestState}};continue}return _}}var o_=["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"],r_={IdJagTokenExchangeResponseSchema:Vs,OAuthClientInformationFullSchema:Js,OAuthClientInformationSchema:Fs,OAuthClientMetadataSchema:Hs,OAuthClientRegistrationErrorSchema:Sa,OAuthErrorResponseSchema:hr,OAuthMetadataSchema:dr,OAuthProtectedResourceMetadataSchema:Us,OAuthTokenRevocationRequestSchema:_a,OAuthTokensSchema:pr,OpenIdProviderDiscoveryMetadataSchema:Ds,OpenIdProviderMetadataSchema:Zs},zm={},vm={};function Rm(e,t){let o=e.slice(0,-6);zm[o]=t,vm[o]=(r)=>t.safeParse(r).success}for(let e of o_)Rm(e,zS[e]);for(let[e,t]of Object.entries(r_))Rm(e,t);var n_=Object.freeze(zm),dl=Object.freeze(vm);function s_(e){switch(e){case"initialize":case"notifications/initialized":return zt(void 0);case"server/discover":return zt(xa);default:return}}var oi=60000,i_=[so,Lo,io,Zo],a_=["inputResponses","requestState"];function Vh(e,t){let o=e.params;if(!Ks(o))return{message:e,lifted:{}};let r=o._meta,n=Ks(r)?i_.filter((l)=>(l in r)):[],i=t==="request"?a_.filter((l)=>(l in o)):[];if(n.length===0&&i.length===0)return{message:e,lifted:{}};let s={},c={...o};if(n.length>0&&Ks(r)){let l={},u={...r};for(let h of n)l[h]=r[h],delete u[h];if(s.envelope=l,Object.keys(u).length>0)c._meta=u;else delete c._meta}for(let l of i){if(l==="inputResponses")s.inputResponses=c[l];if(l==="requestState")s.requestState=c[l];delete c[l]}return{message:{...e,params:c},lifted:s}}function Hh(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 pl(e){return()=>e}var c_=pl(void 0),l_,ri=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{l_=(e,t)=>{e._negotiatedProtocolVersion=t}}_supportedProtocolVersions;onclose;onerror;fallbackRequestHandler;fallbackNotificationHandler;constructor(e){this._options=e,this._supportedProtocolVersions=e?.supportedProtocolVersions??Bi,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 E(N.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 E(N.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),fr(n)||ti(n))this._onresponse(n);else if(Pa(n))this._onrequest(n,i);else if(hm(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 E(N.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}=Vh(e,"notification"),r=this._negotiatedWireCodec();if(t?.classification===void 0&&this._shouldDropInbound(e)==="drop")return;if(t?.classification!==void 0){let s=jh(t.classification);if(s!==r.era){this._onerror(Error(`Era mismatch on inbound notification '${o.method}': classified as ${s} but this instance serves ${r.era}`));return}}if(Gc(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((s)=>this._onerror(Error(`Uncaught error in notification handler: ${s}`)))}_onrequest(e,t){let{message:o,lifted:r}=Vh(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,s=(w,k,V)=>{let B={jsonrpc:"2.0",id:o.id,error:{code:w,message:k,...V!==void 0&&{data:V}}};i?.send(B).catch((q)=>this._onerror(Error(`Failed to send an error response: ${q}`)))};if(t?.classification!==void 0){let w=jh(t.classification);if(w!==n.era){this._onerror(Error(`Era mismatch on inbound request '${o.method}': classified as ${w} but this instance serves ${n.era}`));let k=t.classification.revision??w;s(U.UnsupportedProtocolVersion,`Unsupported protocol version: ${k}`,{supported:this._supportedProtocolVersions,requested:k});return}}if(Wc(o.method)&&!n.hasRequestMethod(o.method)&&!(Lh(o.method)&&this._customSchemaRequestMethods.has(o.method))){s(U.MethodNotFound,"Method not found");return}let c=this._requestHandlers.get(o.method)??this.fallbackRequestHandler;if(c===void 0){s(U.MethodNotFound,"Method not found");return}let l=n.checkInboundEnvelope(r);if(l!==void 0){s(U.InvalidParams,l);return}let u=(w,k)=>this._notificationViaCodec(this._resolveOutboundCodec(w.method),w,{...k,relatedRequestId:o.id}),h=(w,k,V)=>this._requestWithSchemaViaCodec(this._resolveOutboundCodec(w.method),w,k,{...V,relatedRequestId:o.id}),f=new AbortController;this._requestHandlerAbortControllers.set(o.id,f);let S=r.inputResponses===void 0?void 0:u_(r.inputResponses),_={sessionId:i?.sessionId,mcpReq:{id:o.id,method:o.method,_meta:o.params?._meta,...r.envelope!==void 0&&{envelope:r.envelope},...S!==void 0&&{inputResponses:S.accepted},...S!==void 0&&S.droppedKeys.length>0&&{droppedInputResponseKeys:S.droppedKeys},requestState:r.requestState===void 0?c_:pl(r.requestState),signal:f.signal,send:(w,k,V)=>{let B=this._resolveOutboundCodec(w.method);if(this._assertOutboundRequestInEra(B,w.method),Xc(k))return h(w,k,V);let q=Hh(B,w.method);if(q===void 0)throw TypeError(`'${w.method}' is not a spec method; pass a result schema as the second argument to ctx.mcpReq.send().`);return h(w,q,k)},notify:u},http:t?.authInfo?{authInfo:t.authInfo}:void 0},y=this.buildContext(_,t);Promise.resolve().then(()=>c(o,y)).then(async(w)=>{if(f.signal.aborted)return;let k;try{k=n.encodeResult(o.method,w,this._outboundServerInfo())}catch(B){this._onerror(Error(`Failed to encode result for ${o.method}: ${B}`)),s(U.InternalError,"Internal error");return}let V={result:k,jsonrpc:"2.0",id:o.id};await i?.send(V)},async(w)=>{if(f.signal.aborted)return;let k=Number.isSafeInteger(w.code)?w.code:U.InternalError,V={jsonrpc:"2.0",id:o.id,error:{code:n.encodeErrorCode(k),message:w.message??"Internal error",...w.data!==void 0&&{data:w.data}}};await i?.send(V)}).catch((w)=>this._onerror(Error(`Failed to send response: ${w}`))).finally(()=>{if(this._requestHandlerAbortControllers.get(o.id)===f)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),s=this._timeoutInfo.get(r);if(s&&i&&s.resetTimeoutOnProgress)try{this._resetTimeout(r)}catch(c){this._responseHandlers.delete(r),this._progressHandlers.delete(r),this._cleanupTimeout(r),i(c);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),fr(e))o(e);else o(W.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(Xc(t)){if(!Lh(e.method))this._assertOutboundRequestInEra(r,e.method);return this._requestWithSchemaViaCodec(r,e,t,o)}this._assertOutboundRequestInEra(r,e.method);let n=Hh(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 zt(this._negotiatedProtocolVersion)}_wireCodec(){return this._negotiatedWireCodec()}_resolveOutboundCodec(e){if(this._negotiatedProtocolVersion===void 0){let t=s_(e);if(t)return t}return this._negotiatedWireCodec()}_assertOutboundRequestInEra(e,t){if(Wc(t)&&!e.hasRequestMethod(t))throw new E(N.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:s,headers:c}=r??{},l=Date.now(),u,h;return new Promise((f,S)=>{let _=(G)=>{S(G)};if(!this._transport){_(Error("Not connected"));return}if(this._options?.enforceStrictCapabilities===!0)try{this.assertCapabilityForMethod(t.method)}catch(G){_(G);return}if(r?.signal?.aborted){let G=r.signal.reason;throw G instanceof E?G:new E(N.RequestTimeout,String(G))}let y=e.era===xa&&this._transport.hasPerRequestStream===!0?new AbortController:void 0,w=this._requestMessageId++;h=w;let k={...t,jsonrpc:"2.0",id:w};if(r?.onprogress)this._progressHandlers.set(w,r.onprogress),k.params={...t.params,_meta:{...t.params?._meta,progressToken:w}};let V=this._envelopeOutbound(k),B=!1,q=(G)=>{if(B)return;if(this._progressHandlers.delete(w),y===void 0){if(t.method!=="initialize")this._transport?.send(this._envelopeOutbound({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:w,reason:String(G)}}),{relatedRequestId:n,resumptionToken:i,onresumptiontoken:s}).catch((ie)=>this._onerror(Error(`Failed to send cancellation: ${ie}`)))}else y.abort();S(G instanceof E?G:new E(N.RequestTimeout,String(G)))};this._responseHandlers.set(w,(G)=>{if(r?.signal?.aborted)return;if(B=!0,G instanceof Error)return S(G);let ie;try{ie=e.decodeResult(t.method,G.result)}catch(ce){return S(ce instanceof Error?ce:Error(String(ce)))}if(ie.kind==="invalid")return S(ie.error);if(ie.kind==="input_required"){if(r?.allowInputRequired===!0)return f(m_(ie));let ce={codec:e,request:t,resultSchema:o,options:r,flowStartedAt:l,retry:(Me,Ze)=>this._requestWithSchemaViaCodec(e,Me===void 0?{method:t.method}:{method:t.method,params:Me},o,Ze)};return f(this._resolveNonCompleteResult(ie,ce))}let Ne=ie.result;Kc(o,Ne).then((ce)=>{if(ce.success)f(ce.data);else S(new E(N.InvalidResult,`Invalid result for ${t.method}: ${ce.error}`))},S)}),u=()=>q(r?.signal?.reason),r?.signal?.addEventListener("abort",u,{once:!0});let F=r?.timeout??oi,Y=()=>q(new E(N.RequestTimeout,"Request timed out",{timeout:F}));this._setupTimeout(w,F,r?.maxTotalTimeout,Y,r?.resetTimeoutOnProgress??!1),this._transport.send(V,{relatedRequestId:n,resumptionToken:i,onresumptiontoken:s,headers:c,requestSignal:y?.signal}).catch((G)=>{this._progressHandlers.delete(w),S(G)})}).finally(()=>{if(u)r?.signal?.removeEventListener("abort",u);if(h!==void 0)this._responseHandlers.delete(h),this._cleanupTimeout(h)})}async notification(e,t){return await this._notificationViaCodec(this._resolveOutboundCodec(e.method),e,t)}async _notificationViaCodec(e,t,o){if(!this._transport)throw new E(N.NotConnected,"Not connected");if(Gc(t.method)&&!e.hasNotificationMethod(t.method))throw new E(N.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(!Wc(e))throw TypeError(`'${e}' is not a spec request method; pass schemas as the second argument to setRequestHandler().`);r=(n,i)=>{let s=this._negotiatedWireCodec(),c=s.validateRequest(e,n);if(!c.ok&&c.reason==="not-in-era")c=s.validateInputRequest(e,n);if(!c.ok){if(c.reason==="not-in-era")throw new W(U.InternalError,`No wire schema for ${e} in the resolved era`);throw Error(c.message)}return Promise.resolve(t(c.value,i))}}else if(o)r=async(n,i)=>{let s=await Kc(t.params,{...n.params});if(!s.success)throw new W(U.InvalidParams,`Invalid params for ${e}: ${s.error}`);return o(s.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(!Gc(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 W(U.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 Kc(t.params,{...r.params});if(!n.success)throw new W(U.InvalidParams,`Invalid params for notification ${e}: ${n.error}`);await o(n.data,r)})}removeNotificationHandler(e){this._notificationHandlers.delete(e)}};function Ks(e){return e!==null&&typeof e==="object"&&!Array.isArray(e)}function hl(e,t){let o={...e};for(let r in t){let n=r,i=t[n];if(i===void 0)continue;let s=o[n];o[n]=Ks(s)&&Ks(i)?{...s,...i}:i}return o}function wa(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}function u_(e){let t={},o=[];if(!wa(e))return{accepted:t,droppedKeys:o};for(let[r,n]of Object.entries(e)){if(!wa(n)||"method"in n||"result"in n){o.push(r);continue}t[r]=n}return{accepted:t,droppedKeys:o}}function Fh(e){throw new E(N.SendFailed,`ctx.mcpReq.${e} is not available while fulfilling an embedded input request: the request is fulfilled locally and has no related peer request`)}function d_(e,t,o,r,n){return{sessionId:n,mcpReq:{id:e,method:t,_meta:o?._meta,requestState:pl(void 0),signal:r,send:()=>Fh("send"),notify:()=>Fh("notify")}}}async function p_(e,t,o,r,n){if(!wa(r)||typeof r.method!=="string")throw new E(N.InvalidResult,`Invalid input request '${o}': each inputRequests entry must be an embedded request object with a method`,{key:o});let i=r.method;if(!t.hasInputRequestMethod(i))throw new E(N.InvalidResult,`Invalid input request '${o}': '${i}' is not an embedded request the ${t.era} revision defines (expected elicitation/create, sampling/createMessage, or roots/list)`,{key:o,method:i});let s=e.getRequestHandler(i);if(s===void 0)throw new E(N.CapabilityNotSupported,`Cannot fulfil input request '${o}': no handler is registered for '${i}' on this client. Declare the corresponding capability and register a handler, or handle input_required results manually.`,{key:o,method:i});let c=wa(r.params)?r.params:void 0;return await s({jsonrpc:"2.0",id:o,method:i,...c!==void 0&&{params:c}},e.buildContext(d_(o,i,c,n,e.sessionId)))}function h_(e,t){return{...e?.signal!==void 0&&{signal:e.signal},...e?.onprogress!==void 0&&{onprogress:e.onprogress},...e?.resetTimeoutOnProgress!==void 0&&{resetTimeoutOnProgress:e.resetTimeoutOnProgress},...e?.headers!==void 0&&{headers:e.headers},...t.timeout!==void 0&&{timeout:t.timeout},...t.maxTotalTimeout!==void 0&&{maxTotalTimeout:t.maxTotalTimeout},allowInputRequired:!0}}function wm(e,t,o,r){let{codec:n,request:i,options:s,flowStartedAt:c}=r,l={inputRequests:o.inputRequests,...o.requestState!==void 0&&{requestState:o.requestState}},u={dispatchInputRequest:(h,f,S)=>p_(e,n,h,f,S),retry:(h,f)=>r.retry(h,h_(s,f))};return t_({config:t,method:i.method,originalParams:i.params,firstPayload:l,flowStartedAt:c,signal:s?.signal,requestOptions:{...s?.timeout!==void 0&&{timeout:s.timeout},...s?.maxTotalTimeout!==void 0&&{maxTotalTimeout:s.maxTotalTimeout},...s?.onprogress!==void 0&&{onprogress:s.onprogress}},hooks:u})}function m_(e){return{resultType:"input_required",inputRequests:e.inputRequests,...e.requestState!==void 0&&{requestState:e.requestState},...e._meta!==void 0&&{_meta:e._meta}}}/*!
|
|
65
65
|
* content-type
|
|
66
66
|
* Copyright(c) 2015 Douglas Christopher Wilson
|
|
67
67
|
* MIT Licensed
|
|
68
|
-
*/var rS=Gc((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(c){if(!c)throw TypeError("argument string is required");var p=typeof c==="object"?i(c):c;if(typeof p!=="string")throw TypeError("argument string is required to be a string");var d=p.indexOf(";"),f=d!==-1?p.slice(0,d).trim():p.trim();if(!r.test(f))throw TypeError("invalid media type");var S=new a(f.toLowerCase());if(d!==-1){var _,b,P;t.lastIndex=d;while(b=t.exec(p)){if(b.index!==d)throw TypeError("invalid parameter format");if(d+=b[0].length,_=b[1].toLowerCase(),P=b[2],P.charCodeAt(0)===34){if(P=P.slice(1,-1),P.indexOf("\\")!==-1)P=P.replace(o,"$1")}S.parameters[_]=P}if(d!==p.length)throw TypeError("invalid parameter format")}return S}function i(c){var p;if(typeof c.getHeader==="function")p=c.getHeader("content-type");else if(typeof c.headers==="object")p=c.headers&&c.headers["content-type"];if(typeof p!=="string")throw TypeError("content-type header is missing from object");return p}function a(c){this.parameters=Object.create(null),this.type=c}}),gy=Yc(rS(),1);var Ty=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 nS=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,sS=[0,31,28,31,30,31,30,31,31,30,31,30,31],iS=/^(\d\d):(\d\d):(\d\d)(\.\d+)?(z|[+-]\d\d(?::?\d\d)?)?$/i,aS=/^(?=.{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,cS=/^(?:[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,lS=/^(?:(?:[^\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,uS=/^(?:(?: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,dS=/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,pS=/^(?:\/(?:[^~/]|~0|~1)*)*$/,hS=/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,mS=/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,fS=(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))},gS=/^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/,SS=/^((([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,_S=(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 ke(e){return e.test.bind(e)}var ky={date:Jh,time:Bh.bind(void 0,!1),"date-time":zS,duration:_S,uri:wS,"uri-reference":ke(cS),"uri-template":ke(lS),url:ke(uS),email:fS,hostname:ke(aS),ipv4:ke(gS),ipv6:ke(SS),regex:PS,uuid:ke(dS),"json-pointer":ke(pS),"json-pointer-uri-fragment":ke(hS),"relative-json-pointer":ke(mS)};function bS(e){return e%4===0&&(e%100!==0||e%400===0)}function Jh(e){let t=e.match(nS);if(!t)return!1;let o=+t[1],r=+t[2],n=+t[3];return r>=1&&r<=12&&n>=1&&n<=(r==2&&bS(o)?29:sS[r])}function Bh(e,t){let o=t.match(iS);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 yS=/t|\s/i;function zS(e){let t=e.split(yS);return t.length==2&&Jh(t[0])&&Bh(!0,t[1])}var vS=/\/|:/,RS=/^(?:[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 vS.test(e)&&RS.test(e)}var xS=/[^\\]\\Z/;function PS(e){if(xS.test(e))return!1;try{return new RegExp(e,"u"),!0}catch(t){return!1}}var kS;kS=globalThis.crypto;var Ds=class extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.OAuthClientFlowError"})}static[Symbol.hasInstance](e){return me(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 me(this,e)}constructor(e){super(e);this.name=new.target.name,Zt(this,new.target)}},Rz=class extends Ds{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}},wz=class extends Ds{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}},xz=class extends Ds{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}},Pz=class extends Ds{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}},Tz=class extends Ds{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 kz=class extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.UnauthorizedError"})}static[Symbol.hasInstance](e){return me(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 me(this,e)}constructor(e){super(e??"Unauthorized");this.name="UnauthorizedError",Zt(this,new.target)}};var Ez=class extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.SseError"})}static[Symbol.hasInstance](e){return me(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 me(this,e)}constructor(e,t,o){super(`SSE error: ${t}`);this.code=e,this.event=o,Zt(this,new.target)}};class Xh{_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 Wh=new Set;function Gh(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(!Wh.has(a))Wh.add(a),console.warn(`[ext-apps] ${a}(Schema, handler) is deprecated; use ${a}("${i}", { params: Schema.shape.params }, handler).`);let c=r;return[i,{params:n.params},e==="request"?(p,d)=>c({method:i,params:p},ES(d)):(p)=>c({method:i,params:p})]}function ES(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 $S="2026-01-26";var CS="ui/notifications/tool-input-partial";class tm{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=Ct.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!==CS)console.debug("Sending message",e);this.eventTarget.postMessage(e,"*")}async close(){window.removeEventListener("message",this.messageListener),this.onclose?.()}onclose;onerror;onmessage;sessionId;setProtocolVersion}var IS=z([u("light"),u("dark")]).describe("Color theme preference for the host environment."),Hs=z([u("inline"),u("fullscreen"),u("pip")]).describe("Display mode for UI presentation."),OS=z([u("--color-background-primary"),u("--color-background-secondary"),u("--color-background-tertiary"),u("--color-background-inverse"),u("--color-background-ghost"),u("--color-background-info"),u("--color-background-danger"),u("--color-background-success"),u("--color-background-warning"),u("--color-background-disabled"),u("--color-text-primary"),u("--color-text-secondary"),u("--color-text-tertiary"),u("--color-text-inverse"),u("--color-text-ghost"),u("--color-text-info"),u("--color-text-danger"),u("--color-text-success"),u("--color-text-warning"),u("--color-text-disabled"),u("--color-border-primary"),u("--color-border-secondary"),u("--color-border-tertiary"),u("--color-border-inverse"),u("--color-border-ghost"),u("--color-border-info"),u("--color-border-danger"),u("--color-border-success"),u("--color-border-warning"),u("--color-border-disabled"),u("--color-ring-primary"),u("--color-ring-secondary"),u("--color-ring-inverse"),u("--color-ring-info"),u("--color-ring-danger"),u("--color-ring-success"),u("--color-ring-warning"),u("--font-sans"),u("--font-mono"),u("--font-weight-normal"),u("--font-weight-medium"),u("--font-weight-semibold"),u("--font-weight-bold"),u("--font-text-xs-size"),u("--font-text-sm-size"),u("--font-text-md-size"),u("--font-text-lg-size"),u("--font-heading-xs-size"),u("--font-heading-sm-size"),u("--font-heading-md-size"),u("--font-heading-lg-size"),u("--font-heading-xl-size"),u("--font-heading-2xl-size"),u("--font-heading-3xl-size"),u("--font-text-xs-line-height"),u("--font-text-sm-line-height"),u("--font-text-md-line-height"),u("--font-text-lg-line-height"),u("--font-heading-xs-line-height"),u("--font-heading-sm-line-height"),u("--font-heading-md-line-height"),u("--font-heading-lg-line-height"),u("--font-heading-xl-line-height"),u("--font-heading-2xl-line-height"),u("--font-heading-3xl-line-height"),u("--border-radius-xs"),u("--border-radius-sm"),u("--border-radius-md"),u("--border-radius-lg"),u("--border-radius-xl"),u("--border-radius-full"),u("--border-width-regular"),u("--shadow-hairline"),u("--shadow-sm"),u("--shadow-md"),u("--shadow-lg")]).describe("CSS variable keys available to MCP apps for theming."),NS=y(OS.describe(`Style variables for theming MCP apps.
|
|
68
|
+
*/var f_=zl((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(c){if(!c)throw TypeError("argument string is required");var l=typeof c==="object"?i(c):c;if(typeof l!=="string")throw TypeError("argument string is required to be a string");var u=l.indexOf(";"),h=u!==-1?l.slice(0,u).trim():l.trim();if(!r.test(h))throw TypeError("invalid media type");var f=new s(h.toLowerCase());if(u!==-1){var S,_,y;t.lastIndex=u;while(_=t.exec(l)){if(_.index!==u)throw TypeError("invalid parameter format");if(u+=_[0].length,S=_[1].toLowerCase(),y=_[2],y.charCodeAt(0)===34){if(y=y.slice(1,-1),y.indexOf("\\")!==-1)y=y.replace(o,"$1")}f.parameters[S]=y}if(u!==l.length)throw TypeError("invalid parameter format")}return f}function i(c){var l;if(typeof c.getHeader==="function")l=c.getHeader("content-type");else if(typeof c.headers==="object")l=c.headers&&c.headers["content-type"];if(typeof l!=="string")throw TypeError("content-type header is missing from object");return l}function s(c){this.parameters=Object.create(null),this.type=c}}),Sv=Rl(f_(),1);function ni(e,t){let o=typeof e;if(o!==typeof t)return!1;if(Array.isArray(e)){if(!Array.isArray(t))return!1;let r=e.length;if(r!==t.length)return!1;for(let n=0;n<r;n++)if(!ni(e[n],t[n]))return!1;return!0}if(o==="object"){if(!e||!t)return e===t;let r=Object.keys(e),n=Object.keys(t);if(r.length!==n.length)return!1;for(let i of r)if(!ni(e[i],t[i]))return!1;return!0}return e===t}function Be(e){return encodeURI(g_(e))}function g_(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}var S_={prefixItems:!0,items:!0,allOf:!0,anyOf:!0,oneOf:!0},__={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependentSchemas:!0},b_={id:!0,$id:!0,$ref:!0,$schema:!0,$anchor:!0,$vocabulary:!0,$comment:!0,default:!0,enum:!0,const:!0,required:!0,type:!0,maximum:!0,minimum:!0,exclusiveMaximum:!0,exclusiveMinimum:!0,multipleOf:!0,maxLength:!0,minLength:!0,pattern:!0,format:!0,maxItems:!0,minItems:!0,uniqueItems:!0,maxProperties:!0,minProperties:!0},y_=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");function zo(e,t=Object.create(null),o=y_,r=""){if(e&&typeof e==="object"&&!Array.isArray(e)){let i=e.$id||e.id;if(i){let s=new URL(i,o.href);if(s.hash.length>1)t[s.href]=e;else if(s.hash="",r==="")o=s;else zo(e,t,o)}}else if(e!==!0&&e!==!1)return t;let n=o.href+(r?"#"+r:"");if(t[n]!==void 0)throw Error(`Duplicate schema URI "${n}".`);if(t[n]=e,e===!0||e===!1)return t;if(e.__absolute_uri__===void 0)Object.defineProperty(e,"__absolute_uri__",{enumerable:!1,value:n});if(e.$ref&&e.__absolute_ref__===void 0){let i=new URL(e.$ref,o.href);i.hash=i.hash,Object.defineProperty(e,"__absolute_ref__",{enumerable:!1,value:i.href})}if(e.$recursiveRef&&e.__absolute_recursive_ref__===void 0){let i=new URL(e.$recursiveRef,o.href);i.hash=i.hash,Object.defineProperty(e,"__absolute_recursive_ref__",{enumerable:!1,value:i.href})}if(e.$anchor){let i=new URL("#"+e.$anchor,o.href);t[i.href]=e}for(let i in e){if(b_[i])continue;let s=`${r}/${Be(i)}`,c=e[i];if(Array.isArray(c)){if(S_[i]){let l=c.length;for(let u=0;u<l;u++)zo(c[u],t,o,`${s}/${u}`)}}else if(__[i])for(let l in c)zo(c[l],t,o,`${s}/${Be(l)}`);else zo(c,t,o,s)}return t}var z_=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,v_=[0,31,28,31,30,31,30,31,31,30,31,30,31],R_=/^(\d\d):(\d\d):(\d\d)(\.\d+)?(z|[+-]\d\d(?::?\d\d)?)?$/i,w_=/^(?=.{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,x_=/^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,P_=/^(?:(?:[^\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,T_=/^(?:(?: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,E_=/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,k_=/^(?:\/(?:[^~/]|~0|~1)*)*$/,$_=/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,C_=/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,I_=(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))},O_=/^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/,N_=/^((([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,M_=(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 lt(e){return e.test.bind(e)}var xm={date:Pm,time:Tm.bind(void 0,!1),"date-time":j_,duration:M_,uri:Z_,"uri-reference":lt(x_),"uri-template":lt(P_),url:lt(T_),email:I_,hostname:lt(w_),ipv4:lt(O_),ipv6:lt(N_),regex:V_,uuid:lt(E_),"json-pointer":lt(k_),"json-pointer-uri-fragment":lt($_),"relative-json-pointer":lt(C_)};function q_(e){return e%4===0&&(e%100!==0||e%400===0)}function Pm(e){let t=e.match(z_);if(!t)return!1;let o=+t[1],r=+t[2],n=+t[3];return r>=1&&r<=12&&n>=1&&n<=(r==2&&q_(o)?29:v_[r])}function Tm(e,t){let o=t.match(R_);if(!o)return!1;let r=+o[1],n=+o[2],i=+o[3],s=!!o[5];return(r<=23&&n<=59&&i<=59||r==23&&n==59&&i==60)&&(!e||s)}var A_=/t|\s/i;function j_(e){let t=e.split(A_);return t.length==2&&Pm(t[0])&&Tm(!0,t[1])}var L_=/\/|:/,U_=/^(?:[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 Z_(e){return L_.test(e)&&U_.test(e)}var D_=/[^\\]\\Z/;function V_(e){if(D_.test(e))return!1;try{return new RegExp(e,"u"),!0}catch(t){return!1}}function H_(e){let t=0,o=e.length,r=0,n;while(r<o)if(t++,n=e.charCodeAt(r++),n>=55296&&n<=56319&&r<o){if(n=e.charCodeAt(r),(n&64512)==56320)r++}return t}function se(e,t,o="2019-09",r=zo(t),n=!0,i=null,s="#",c="#",l=Object.create(null)){if(t===!0)return{valid:!0,errors:[]};if(t===!1)return{valid:!1,errors:[{instanceLocation:s,keyword:"false",keywordLocation:s,error:"False boolean schema."}]};let u=typeof e,h;switch(u){case"boolean":case"number":case"string":h=u;break;case"object":if(e===null)h="null";else if(Array.isArray(e))h="array";else h="object";break;default:throw Error(`Instances of "${u}" type are not supported.`)}let{$ref:f,$recursiveRef:S,$recursiveAnchor:_,type:y,const:w,enum:k,required:V,not:B,anyOf:q,allOf:F,oneOf:Y,if:G,then:ie,else:Ne,format:ce,properties:Me,patternProperties:Ze,additionalProperties:Rt,unevaluatedProperties:wt,minProperties:We,maxProperties:qe,propertyNames:Ge,dependentRequired:we,dependentSchemas:Ae,dependencies:Ke,prefixItems:Ee,items:_e,additionalItems:dt,unevaluatedItems:pt,contains:Ye,minContains:me,maxContains:be,minItems:ye,maxItems:De,uniqueItems:Dt,minimum:ke,maximum:$e,exclusiveMinimum:xe,exclusiveMaximum:je,multipleOf:Le,minLength:Qe,maxLength:Xe,pattern:xt,__absolute_ref__:et,__absolute_recursive_ref__:Vt}=t,P=[];if(_===!0&&i===null)i=t;if(S==="#"){let j=i===null?r[Vt]:i,C=`${c}/$recursiveRef`,H=se(e,i===null?t:i,o,r,n,j,s,C,l);if(!H.valid)P.push({instanceLocation:s,keyword:"$recursiveRef",keywordLocation:C,error:"A subschema had errors."},...H.errors)}if(f!==void 0){let j=r[et||f];if(j===void 0){let T=`Unresolved $ref "${f}".`;if(et&&et!==f)T+=` Absolute URI "${et}".`;throw T+=`
|
|
69
|
+
Known schemas:
|
|
70
|
+
- ${Object.keys(r).join(`
|
|
71
|
+
- `)}`,Error(T)}let C=`${c}/$ref`,H=se(e,j,o,r,n,i,s,C,l);if(!H.valid)P.push({instanceLocation:s,keyword:"$ref",keywordLocation:C,error:"A subschema had errors."},...H.errors);if(o==="4"||o==="7")return{valid:P.length===0,errors:P}}if(Array.isArray(y)){let j=y.length,C=!1;for(let H=0;H<j;H++)if(h===y[H]||y[H]==="integer"&&h==="number"&&e%1===0&&e===e){C=!0;break}if(!C)P.push({instanceLocation:s,keyword:"type",keywordLocation:`${c}/type`,error:`Instance type "${h}" is invalid. Expected "${y.join('", "')}".`})}else if(y==="integer"){if(h!=="number"||e%1||e!==e)P.push({instanceLocation:s,keyword:"type",keywordLocation:`${c}/type`,error:`Instance type "${h}" is invalid. Expected "${y}".`})}else if(y!==void 0&&h!==y)P.push({instanceLocation:s,keyword:"type",keywordLocation:`${c}/type`,error:`Instance type "${h}" is invalid. Expected "${y}".`});if(w!==void 0){if(h==="object"||h==="array"){if(!ni(e,w))P.push({instanceLocation:s,keyword:"const",keywordLocation:`${c}/const`,error:`Instance does not match ${JSON.stringify(w)}.`})}else if(e!==w)P.push({instanceLocation:s,keyword:"const",keywordLocation:`${c}/const`,error:`Instance does not match ${JSON.stringify(w)}.`})}if(k!==void 0){if(h==="object"||h==="array"){if(!k.some((j)=>ni(e,j)))P.push({instanceLocation:s,keyword:"enum",keywordLocation:`${c}/enum`,error:`Instance does not match any of ${JSON.stringify(k)}.`})}else if(!k.some((j)=>e===j))P.push({instanceLocation:s,keyword:"enum",keywordLocation:`${c}/enum`,error:`Instance does not match any of ${JSON.stringify(k)}.`})}if(B!==void 0){let j=`${c}/not`;if(se(e,B,o,r,n,i,s,j).valid)P.push({instanceLocation:s,keyword:"not",keywordLocation:j,error:'Instance matched "not" schema.'})}let tt=[];if(q!==void 0){let j=`${c}/anyOf`,C=P.length,H=!1;for(let T=0;T<q.length;T++){let x=q[T],Z=Object.create(l),L=se(e,x,o,r,n,_===!0?i:null,s,`${j}/${T}`,Z);if(P.push(...L.errors),H=H||L.valid,L.valid)tt.push(Z)}if(H)P.length=C;else P.splice(C,0,{instanceLocation:s,keyword:"anyOf",keywordLocation:j,error:"Instance does not match any subschemas."})}if(F!==void 0){let j=`${c}/allOf`,C=P.length,H=!0;for(let T=0;T<F.length;T++){let x=F[T],Z=Object.create(l),L=se(e,x,o,r,n,_===!0?i:null,s,`${j}/${T}`,Z);if(P.push(...L.errors),H=H&&L.valid,L.valid)tt.push(Z)}if(H)P.length=C;else P.splice(C,0,{instanceLocation:s,keyword:"allOf",keywordLocation:j,error:"Instance does not match every subschema."})}if(Y!==void 0){let j=`${c}/oneOf`,C=P.length,H=Y.filter((T,x)=>{let Z=Object.create(l),L=se(e,T,o,r,n,_===!0?i:null,s,`${j}/${x}`,Z);if(P.push(...L.errors),L.valid)tt.push(Z);return L.valid}).length;if(H===1)P.length=C;else P.splice(C,0,{instanceLocation:s,keyword:"oneOf",keywordLocation:j,error:`Instance does not match exactly one subschema (${H} matches).`})}if(h==="object"||h==="array")Object.assign(l,...tt);if(G!==void 0){let j=`${c}/if`;if(se(e,G,o,r,n,i,s,j,l).valid){if(ie!==void 0){let C=se(e,ie,o,r,n,i,s,`${c}/then`,l);if(!C.valid)P.push({instanceLocation:s,keyword:"if",keywordLocation:j,error:'Instance does not match "then" schema.'},...C.errors)}}else if(Ne!==void 0){let C=se(e,Ne,o,r,n,i,s,`${c}/else`,l);if(!C.valid)P.push({instanceLocation:s,keyword:"if",keywordLocation:j,error:'Instance does not match "else" schema.'},...C.errors)}}if(h==="object"){if(V!==void 0){for(let T of V)if(!(T in e))P.push({instanceLocation:s,keyword:"required",keywordLocation:`${c}/required`,error:`Instance does not have required property "${T}".`})}let j=Object.keys(e);if(We!==void 0&&j.length<We)P.push({instanceLocation:s,keyword:"minProperties",keywordLocation:`${c}/minProperties`,error:`Instance does not have at least ${We} properties.`});if(qe!==void 0&&j.length>qe)P.push({instanceLocation:s,keyword:"maxProperties",keywordLocation:`${c}/maxProperties`,error:`Instance does not have at least ${qe} properties.`});if(Ge!==void 0){let T=`${c}/propertyNames`;for(let x in e){let Z=`${s}/${Be(x)}`,L=se(x,Ge,o,r,n,i,Z,T);if(!L.valid)P.push({instanceLocation:s,keyword:"propertyNames",keywordLocation:T,error:`Property name "${x}" does not match schema.`},...L.errors)}}if(we!==void 0){let T=`${c}/dependantRequired`;for(let x in we)if(x in e){let Z=we[x];for(let L of Z)if(!(L in e))P.push({instanceLocation:s,keyword:"dependentRequired",keywordLocation:T,error:`Instance has "${x}" but does not have "${L}".`})}}if(Ae!==void 0)for(let T in Ae){let x=`${c}/dependentSchemas`;if(T in e){let Z=se(e,Ae[T],o,r,n,i,s,`${x}/${Be(T)}`,l);if(!Z.valid)P.push({instanceLocation:s,keyword:"dependentSchemas",keywordLocation:x,error:`Instance has "${T}" but does not match dependant schema.`},...Z.errors)}}if(Ke!==void 0){let T=`${c}/dependencies`;for(let x in Ke)if(x in e){let Z=Ke[x];if(Array.isArray(Z)){for(let L of Z)if(!(L in e))P.push({instanceLocation:s,keyword:"dependencies",keywordLocation:T,error:`Instance has "${x}" but does not have "${L}".`})}else{let L=se(e,Z,o,r,n,i,s,`${T}/${Be(x)}`);if(!L.valid)P.push({instanceLocation:s,keyword:"dependencies",keywordLocation:T,error:`Instance has "${x}" but does not match dependant schema.`},...L.errors)}}}let C=Object.create(null),H=!1;if(Me!==void 0){let T=`${c}/properties`;for(let x in Me){if(!(x in e))continue;let Z=`${s}/${Be(x)}`,L=se(e[x],Me[x],o,r,n,i,Z,`${T}/${Be(x)}`);if(L.valid)l[x]=C[x]=!0;else if(H=n,P.push({instanceLocation:s,keyword:"properties",keywordLocation:T,error:`Property "${x}" does not match schema.`},...L.errors),H)break}}if(!H&&Ze!==void 0){let T=`${c}/patternProperties`;for(let x in Ze){let Z=new RegExp(x,"u"),L=Ze[x];for(let le in e){if(!Z.test(le))continue;let Ht=`${s}/${Be(le)}`,ot=se(e[le],L,o,r,n,i,Ht,`${T}/${Be(x)}`);if(ot.valid)l[le]=C[le]=!0;else H=n,P.push({instanceLocation:s,keyword:"patternProperties",keywordLocation:T,error:`Property "${le}" matches pattern "${x}" but does not match associated schema.`},...ot.errors)}}}if(!H&&Rt!==void 0){let T=`${c}/additionalProperties`;for(let x in e){if(C[x])continue;let Z=`${s}/${Be(x)}`,L=se(e[x],Rt,o,r,n,i,Z,T);if(L.valid)l[x]=!0;else H=n,P.push({instanceLocation:s,keyword:"additionalProperties",keywordLocation:T,error:`Property "${x}" does not match additional properties schema.`},...L.errors)}}else if(!H&&wt!==void 0){let T=`${c}/unevaluatedProperties`;for(let x in e)if(!l[x]){let Z=`${s}/${Be(x)}`,L=se(e[x],wt,o,r,n,i,Z,T);if(L.valid)l[x]=!0;else P.push({instanceLocation:s,keyword:"unevaluatedProperties",keywordLocation:T,error:`Property "${x}" does not match unevaluated properties schema.`},...L.errors)}}}else if(h==="array"){if(De!==void 0&&e.length>De)P.push({instanceLocation:s,keyword:"maxItems",keywordLocation:`${c}/maxItems`,error:`Array has too many items (${e.length} > ${De}).`});if(ye!==void 0&&e.length<ye)P.push({instanceLocation:s,keyword:"minItems",keywordLocation:`${c}/minItems`,error:`Array has too few items (${e.length} < ${ye}).`});let j=e.length,C=0,H=!1;if(Ee!==void 0){let T=`${c}/prefixItems`,x=Math.min(Ee.length,j);for(;C<x;C++){let Z=se(e[C],Ee[C],o,r,n,i,`${s}/${C}`,`${T}/${C}`);if(l[C]=!0,!Z.valid){if(H=n,P.push({instanceLocation:s,keyword:"prefixItems",keywordLocation:T,error:"Items did not match schema."},...Z.errors),H)break}}}if(_e!==void 0){let T=`${c}/items`;if(Array.isArray(_e)){let x=Math.min(_e.length,j);for(;C<x;C++){let Z=se(e[C],_e[C],o,r,n,i,`${s}/${C}`,`${T}/${C}`);if(l[C]=!0,!Z.valid){if(H=n,P.push({instanceLocation:s,keyword:"items",keywordLocation:T,error:"Items did not match schema."},...Z.errors),H)break}}}else for(;C<j;C++){let x=se(e[C],_e,o,r,n,i,`${s}/${C}`,T);if(l[C]=!0,!x.valid){if(H=n,P.push({instanceLocation:s,keyword:"items",keywordLocation:T,error:"Items did not match schema."},...x.errors),H)break}}if(!H&&dt!==void 0){let x=`${c}/additionalItems`;for(;C<j;C++){let Z=se(e[C],dt,o,r,n,i,`${s}/${C}`,x);if(l[C]=!0,!Z.valid)H=n,P.push({instanceLocation:s,keyword:"additionalItems",keywordLocation:x,error:"Items did not match additional items schema."},...Z.errors)}}}if(Ye!==void 0)if(j===0&&me===void 0)P.push({instanceLocation:s,keyword:"contains",keywordLocation:`${c}/contains`,error:"Array is empty. It must contain at least one item matching the schema."});else if(me!==void 0&&j<me)P.push({instanceLocation:s,keyword:"minContains",keywordLocation:`${c}/minContains`,error:`Array has less items (${j}) than minContains (${me}).`});else{let T=`${c}/contains`,x=P.length,Z=0;for(let L=0;L<j;L++){let le=se(e[L],Ye,o,r,n,i,`${s}/${L}`,T);if(le.valid)l[L]=!0,Z++;else P.push(...le.errors)}if(Z>=(me||0))P.length=x;if(me===void 0&&be===void 0&&Z===0)P.splice(x,0,{instanceLocation:s,keyword:"contains",keywordLocation:T,error:"Array does not contain item matching schema."});else if(me!==void 0&&Z<me)P.push({instanceLocation:s,keyword:"minContains",keywordLocation:`${c}/minContains`,error:`Array must contain at least ${me} items matching schema. Only ${Z} items were found.`});else if(be!==void 0&&Z>be)P.push({instanceLocation:s,keyword:"maxContains",keywordLocation:`${c}/maxContains`,error:`Array may contain at most ${be} items matching schema. ${Z} items were found.`})}if(!H&&pt!==void 0){let T=`${c}/unevaluatedItems`;for(;C<j;C++){if(l[C])continue;let x=se(e[C],pt,o,r,n,i,`${s}/${C}`,T);if(l[C]=!0,!x.valid)P.push({instanceLocation:s,keyword:"unevaluatedItems",keywordLocation:T,error:"Items did not match unevaluated items schema."},...x.errors)}}if(Dt)for(let T=0;T<j;T++){let x=e[T],Z=typeof x==="object"&&x!==null;for(let L=0;L<j;L++){if(T===L)continue;let le=e[L];if(x===le||Z&&typeof le==="object"&&le!==null&&ni(x,le))P.push({instanceLocation:s,keyword:"uniqueItems",keywordLocation:`${c}/uniqueItems`,error:`Duplicate items at indexes ${T} and ${L}.`}),T=Number.MAX_SAFE_INTEGER,L=Number.MAX_SAFE_INTEGER}}}else if(h==="number"){if(o==="4"){if(ke!==void 0&&(xe===!0&&e<=ke||e<ke))P.push({instanceLocation:s,keyword:"minimum",keywordLocation:`${c}/minimum`,error:`${e} is less than ${xe?"or equal to ":""} ${ke}.`});if($e!==void 0&&(je===!0&&e>=$e||e>$e))P.push({instanceLocation:s,keyword:"maximum",keywordLocation:`${c}/maximum`,error:`${e} is greater than ${je?"or equal to ":""} ${$e}.`})}else{if(ke!==void 0&&e<ke)P.push({instanceLocation:s,keyword:"minimum",keywordLocation:`${c}/minimum`,error:`${e} is less than ${ke}.`});if($e!==void 0&&e>$e)P.push({instanceLocation:s,keyword:"maximum",keywordLocation:`${c}/maximum`,error:`${e} is greater than ${$e}.`});if(xe!==void 0&&e<=xe)P.push({instanceLocation:s,keyword:"exclusiveMinimum",keywordLocation:`${c}/exclusiveMinimum`,error:`${e} is less than ${xe}.`});if(je!==void 0&&e>=je)P.push({instanceLocation:s,keyword:"exclusiveMaximum",keywordLocation:`${c}/exclusiveMaximum`,error:`${e} is greater than or equal to ${je}.`})}if(Le!==void 0){let j=e%Le;if(Math.abs(0-j)>=0.00000011920929&&Math.abs(Le-j)>=0.00000011920929)P.push({instanceLocation:s,keyword:"multipleOf",keywordLocation:`${c}/multipleOf`,error:`${e} is not a multiple of ${Le}.`})}}else if(h==="string"){let j=Qe===void 0&&Xe===void 0?0:H_(e);if(Qe!==void 0&&j<Qe)P.push({instanceLocation:s,keyword:"minLength",keywordLocation:`${c}/minLength`,error:`String is too short (${j} < ${Qe}).`});if(Xe!==void 0&&j>Xe)P.push({instanceLocation:s,keyword:"maxLength",keywordLocation:`${c}/maxLength`,error:`String is too long (${j} > ${Xe}).`});if(xt!==void 0&&!new RegExp(xt,"u").test(e))P.push({instanceLocation:s,keyword:"pattern",keywordLocation:`${c}/pattern`,error:"String does not match pattern."});if(ce!==void 0&&xm[ce]&&!xm[ce](e))P.push({instanceLocation:s,keyword:"format",keywordLocation:`${c}/format`,error:`String does not match format "${ce}".`})}return{valid:P.length===0,errors:P}}var F_=class{schema;draft;shortCircuit;lookup;constructor(e,t="2019-09",o=!0){this.schema=e,this.draft=t,this.shortCircuit=o,this.lookup=zo(e)}validate(e){return se(e,this.schema,this.draft,this.lookup,this.shortCircuit)}addSchema(e,t){if(t)e={...e,$id:t};zo(e,this.lookup)}},Ea=class{shortcircuit;draft;constructor(e){this.shortcircuit=e?.shortcircuit??!0,this.draft=e?.draft}_draftFor(e){let t=Pl(e,"pass an explicit { draft } to CfWorkerJsonSchemaValidator to validate other dialects.");return t==="draft-7"?"7":t}getValidator(e){let t=new F_(e,this.draft??this._draftFor(e),this.shortcircuit);return(o)=>{let r=t.validate(o);return r.valid?{valid:!0,data:o,errorMessage:void 0}:{valid:!1,data:void 0,errorMessage:r.errors.map((n)=>`${n.instanceLocation}: ${n.error}`).join("; ")}}}};var J_;J_=globalThis.crypto;var gr=class extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.OAuthClientFlowError"})}static[Symbol.hasInstance](e){return Te(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 Te(this,e)}constructor(e){super(e);this.name=new.target.name,Zt(this,new.target)}},Q_=class extends gr{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}},X_=class extends gr{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}},eb=class extends gr{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}},tb=class extends gr{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}},ob=class extends gr{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 Mm=class extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.UnauthorizedError"})}static[Symbol.hasInstance](e){return Te(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 Te(this,e)}constructor(e){super(e??"Unauthorized");this.name="UnauthorizedError",Zt(this,new.target)}};var ka=new Set(["tools/list","prompts/list","resources/list","resources/templates/list","server/discover"]),qm=class{_entries=new Map;_maxEntries;_stamp=0;_cappedSize=0;constructor(e){this._maxEntries=e?.maxEntries??512}get size(){return this._entries.size}get(e){return this._entries.get(ml(e))}set(e,t){let o=ml(e),r=ka.has(e.method),n=!this._entries.has(o);if(!r&&n&&this._maxEntries>0&&this._cappedSize>=this._maxEntries){for(let s of this._entries.keys())if(!ka.has(s.slice(0,s.indexOf("\x00")))){this._entries.delete(s),this._cappedSize--;break}}let i=++this._stamp;if(this._entries.set(o,{...t,stamp:i}),n&&!r)this._cappedSize++;return i}delete(e){if(this._entries.delete(ml(e))&&!ka.has(e.method))this._cappedSize--}evict(e){let t=`${e}\x00`,o=ka.has(e);for(let r of this._entries.keys())if(r.startsWith(t)){if(this._entries.delete(r),!o)this._cappedSize--}}clear(){this._entries.clear(),this._cappedSize=0}};function ml(e){return`${e.method}\x00${JSON.stringify([e.partition??"",e.params??""])}`}function fl(e,t){return t===void 0?e:`${e}\x00${t}`}var Am=86400000,rb=class{_evictionGeneration=new Map;_toolIndex;_toolOutputValidatorIndex;_serverIdentity="";constructor(e,t,o=()=>{},r="",n=Date.now){this._store=e,this._isUserSupplied=t,this._reportError=o,this._cachePartition=r,this._now=n}now(){return this._now()}setServerIdentity(e){this._serverIdentity=e}_partitionFor(e){return JSON.stringify([this._serverIdentity,e==="public"?"":this._cachePartition])}async _probe(e,t){let o={method:e,params:t??""},r=this._partitionFor("private"),n=await this._store.get({...o,partition:r});if(n!==void 0)return n;let i=this._partitionFor("public");if(i===r)return;let s=await this._store.get({...o,partition:i});return s?.scope==="public"?s:void 0}async evict(e){this._evictionGeneration.set(e,(this._evictionGeneration.get(e)??0)+1),await this._deleteBoth(e,"")}async _deleteBoth(e,t){let o=this._partitionFor("private"),r=this._partitionFor("public");try{await this._store.delete({method:e,params:t,partition:o})}catch(n){this._reportError(n)}if(r!==o)try{await this._store.delete({method:e,params:t,partition:r})}catch(n){this._reportError(n)}}async evictKey(e,t){let o=fl(e,t),r=this._evictionGeneration.get(o);if(r!==void 0)this._evictionGeneration.set(o,r+1);await this._deleteBoth(e,t)}captureGeneration(e,t){let o=fl(e,t),r=this._evictionGeneration.get(o)??0;return this._evictionGeneration.set(o,r),r}async write(e,t,o,r){if((this._evictionGeneration.get(fl(e,r?.params))??0)!==o)return;let n=r?.params??"",i=this._partitionFor("private"),s=this._partitionFor("public"),c=(r?.scope??"private")==="public"?s:i;try{await this._store.set({method:e,params:n,partition:c},{value:nb(t),expiresAt:r?.expiresAt,scope:r?.scope})}catch(l){this._reportError(l)}if(s!==i)try{await this._store.delete({method:e,params:n,partition:c===i?s:i})}catch(l){this._reportError(l)}}async read(e,t){let o=await this._probe(e,t);if(o?.expiresAt===void 0||!(o.expiresAt>this.now()))return;try{let r=JSON.parse(o.value);if(typeof r!=="object"||r===null||Array.isArray(r))throw TypeError("cached document is not an object");return{value:r}}catch(r){this._reportError(r),await this._deleteBoth(e,t??"");return}}resetForReconnect(){if(!this._isUserSupplied)this._store.clear();this._evictionGeneration.clear(),this._toolIndex=void 0,this._toolOutputValidatorIndex=void 0,this._serverIdentity=""}async toolDefinition(e){let t=await this._probe("tools/list");if(t===void 0){this._toolIndex=void 0;return}if(this._toolIndex?.stamp!==t.stamp){let o=this._decodeListTools(t),r=new Map;if(o!==void 0)for(let n of o.tools)r.set(n.name,n);this._toolIndex={stamp:t.stamp,byName:r}}return this._toolIndex.byName.get(e)}async outputValidator(e,t){let o=await this._probe("tools/list");if(o===void 0){this._toolOutputValidatorIndex=void 0;return}if(this._toolOutputValidatorIndex?.stamp!==o.stamp){let r=this._decodeListTools(o)??{tools:[]},n=new Map;for(let i of r.tools){let s=t(i);if(s!==void 0)n.set(i.name,s)}this._toolOutputValidatorIndex={stamp:o.stamp,byName:n}}return this._toolOutputValidatorIndex.byName.get(e)}_decodeListTools(e){try{let t=JSON.parse(e.value);if(!Array.isArray(t?.tools)||!t.tools.every((o)=>o!==null&&typeof o==="object"))throw TypeError("cached tools/list document has a malformed tools array");return t}catch(t){this._reportError(t);return}}};function nb(e){let t;try{t=JSON.stringify(e)}catch(o){throw TypeError(`cache value is not JSON-serializable: ${o instanceof Error?o.message:String(o)}`)}if(typeof t!=="string")throw TypeError("cache value is not JSON-serializable: it has no JSON representation");return t}var sb=Symbol.for("mcp.authSeamEscape");function ib(e){return(typeof e==="object"&&e!==null||typeof e==="function")&&e[sb]===!0}var ab=-32022,cb=new Set([-32001,-32020,-32021]);function lb(e,t){switch(e.kind){case"result":return ub(e.result,t);case"rpc-error":return jm(e,t);case"http-error":return db(e,t);case"network-error":return Em(e.error,t);case"unusable-reply":return{kind:"error",error:new E(N.EraNegotiationFailed,`Version negotiation probe failed: the server answered with an unusable reply (${Lm(e.error)})`,{cause:e.error},{cause:e.error})};case"auth-required":return{kind:"error",error:e.error};case"closed":if(t.transportKind==="stdio")return{kind:"legacy"};return Em(Error("Connection closed during the version negotiation probe"),t);case"timeout":if(t.transportKind==="stdio")return{kind:"legacy"};return{kind:"error",error:new E(N.RequestTimeout,`Version negotiation probe timed out after ${e.timeoutMs}ms`,{timeout:e.timeoutMs})}}}function ub(e,t){let o=zt(xa).validateResult("server/discover",e);if(!o.ok)return{kind:"legacy"};let r=o.value.supportedVersions,n=t.clientModernVersions.find((i)=>r.includes(i));if(n!==void 0)return{kind:"modern",version:n,discover:o.value};if(t.fallbackAvailable)return{kind:"legacy"};return{kind:"error",error:new ei({supported:[...r],requested:t.requestedVersion})}}function jm(e,t){let{code:o,message:r,data:n}=e;if(o===ab){let i=hb(n);if(i===void 0)return{kind:"legacy"};let s=new ei({supported:i,requested:mb(n)??t.requestedVersion},r),c=Xs(i),l=t.clientModernVersions.find((u)=>c.includes(u));if(l!==void 0)return{kind:"corrective",version:l,error:s};if(c.length>0)return{kind:"error",error:s};return t.fallbackAvailable?{kind:"legacy"}:{kind:"error",error:s}}if(cb.has(o))return{kind:"legacy"};return{kind:"legacy"}}function db(e,t){if(e.status===401||e.status===403){let r=e.status===403;return{kind:"error",error:new Qs(r?N.ClientHttpForbidden:N.ClientHttpAuthentication,`Version negotiation failed: ${r?"the server denied access (HTTP 403)":"the server requires authorization (HTTP 401)"}`,{status:e.status,statusText:e.statusText,text:e.body})}}if(e.status>=500)return{kind:"error",error:new Qs(N.EraNegotiationFailed,`Version negotiation failed: the server answered the probe with HTTP ${e.status}`,{status:e.status,statusText:e.statusText,text:e.body})};let o=fb(e.body);if(o!==void 0)return jm(o,t);return{kind:"legacy"}}function Em(e,t){if(t.environment==="browser"&&pb(e))return{kind:"legacy"};return{kind:"error",error:new E(N.EraNegotiationFailed,`Version negotiation probe failed: ${Lm(e)}`,{cause:e},{cause:e})}}function pb(e){return e instanceof TypeError||e instanceof Error&&e.name==="TypeError"}function Lm(e){return e instanceof Error?e.message:String(e)}function hb(e){if(typeof e!=="object"||e===null)return;let t=e.supported;if(!Array.isArray(t)||t.length===0||!t.every((o)=>typeof o==="string"))return;return t}function mb(e){if(typeof e!=="object"||e===null)return;let t=e.requested;return typeof t==="string"?t:void 0}function fb(e){if(e===void 0||e==="")return;let t;try{t=JSON.parse(e)}catch{return}if(typeof t!=="object"||t===null)return;let o=t.error;if(typeof o!=="object"||o===null)return;let{code:r,message:n,data:i}=o;if(typeof r!=="number")return;return{code:r,message:typeof n==="string"?n:"",data:i}}var gb="legacy";function Sb(e,t){let o=e?.mode??gb;if(o==="legacy")return{kind:"legacy"};let r=e?.probe??{};if(typeof o==="object"){if(!vt(o.pin))throw TypeError(`versionNegotiation: { pin: '${o.pin}' } is not a modern protocol revision — pinning is for 2026-07-28 and later; omit versionNegotiation (or use mode: 'legacy') for 2025-era servers.`);return{kind:"pin",version:o.pin,probe:r}}let n=t?Xs(t):[];return{kind:"auto",modernVersions:n.length>0?n:[...ol],fallbackAvailable:t?rl(t).length>0:!0,probe:r}}function km(){let e=globalThis;return e.window!==void 0&&e.document!==void 0?"browser":"node"}function $m(e){return"stderr"in e&&"pid"in e?"stdio":"http"}var _b=class e{_pending;_probeCounter=0;_savedOnMessage;_savedOnError;_savedOnClose;_closeDelivered=!1;constructor(t){this._transport=t,this._savedOnMessage=t.onmessage,this._savedOnError=t.onerror,this._savedOnClose=t.onclose}static async open(t){let o=new e(t);t.onmessage=(r)=>{let n=o._pending;if(n!==void 0&&(fr(r)||ti(r))&&r.id===n.id){if(o._pending=void 0,fr(r))n.resolve({kind:"response",result:r.result});else n.resolve({kind:"response",error:r.error});return}},t.onerror=(r)=>{o._savedOnError?.(r)},t.onclose=()=>{let r=o._pending;if(r!==void 0)o._pending=void 0,r.resolve({kind:"closed"});o._closeDelivered=!0,o._savedOnClose?.()};try{await t.start()}catch(r){throw o.detach(),r}return o}async exchange(t,o){let r=`server-discover-probe-${++this._probeCounter}`;return new Promise((n)=>{let i=!1,s=(l)=>{if(i)return;if(i=!0,clearTimeout(c),this._pending?.id===r)this._pending=void 0;n(l)},c=setTimeout(()=>s({kind:"timeout"}),o);this._pending={id:r,resolve:s},this._transport.send(t(r)).catch((l)=>s({kind:"send-error",error:l}))})}detach(){if(this._pending=void 0,this._transport.onmessage=this._savedOnMessage,this._transport.onerror=this._savedOnError,this._closeDelivered&&this._savedOnClose!==void 0){let t=this._savedOnClose,o=this._transport,r=!1,n=()=>{if(!r){r=!0;return}t()};o.onclose=n,Sl.set(o,()=>{if(o.onclose===n)o.onclose=t})}else this._transport.onclose=this._savedOnClose}release(){this.detach();let t=this._transport,o=t.start,r=!0;t.start=async function(){if(r){r=!1,t.start=o;return}return o.call(t)}}},Sl=new WeakMap;function Cm(e){let t=Sl.get(e);Sl.delete(e),t?.()}function bb(e,t,o,r){return{jsonrpc:"2.0",id:e,method:"server/discover",params:{_meta:zt(t).outboundEnvelope({protocolVersion:t,clientInfo:o,clientCapabilities:r})}}}function yb(e){if(e instanceof E&&e.code===N.ClientHttpUnexpectedContent)return!0;return e instanceof Error&&e.name==="SyntaxError"}function zb(e,t){switch(e.kind){case"response":return e.error===void 0?{kind:"result",result:e.result}:{kind:"rpc-error",...e.error};case"send-error":{let o=e.error;if(ib(o)||o instanceof Mm||o instanceof Error&&o.name==="UnauthorizedError")return{kind:"auth-required",error:o};if(o instanceof Qs){let r=o.data?.text;return{kind:"http-error",status:o.data.status,body:typeof r==="string"?r:void 0,statusText:o.data.statusText}}if(yb(o))return{kind:"unusable-reply",error:o};return{kind:"network-error",error:o}}case"closed":return{kind:"closed"};case"timeout":return{kind:"timeout",timeoutMs:t}}}async function Um(e,t){let o=e.probe.timeoutMs??t.defaultTimeoutMs,r=Math.max(0,e.probe.maxRetries??0),n=e.kind==="pin"?[e.version]:e.modernVersions,i=e.kind==="auto"&&e.fallbackAvailable,s=await _b.open(t.transport),c=async()=>{let u=n[0],h=!1,f=r;for(;;){let S=await s.exchange((w)=>bb(w,u,t.clientInfo,t.capabilities),o);if(S.kind==="timeout"&&f>0){f--;continue}let _=zb(S,o),y=lb(_,{clientModernVersions:n,requestedVersion:u,fallbackAvailable:i,environment:t.environment,transportKind:t.transportKind});switch(y.kind){case"modern":return{era:"modern",version:y.version,discover:y.discover};case"corrective":if(h)throw y.error;h=!0,u=y.version;continue;case"legacy":{let w=_.kind==="closed"?"the connection closed during the server/discover probe":void 0;if(e.kind==="pin")throw new E(N.EraNegotiationFailed,w===void 0?`Version negotiation failed: the server did not offer pinned protocol version ${e.version} via server/discover (no fallback in pin mode)`:`Version negotiation failed: ${w} before the server offered pinned protocol version ${e.version} (no fallback in pin mode)`);if(!e.fallbackAvailable)throw new E(N.EraNegotiationFailed,w===void 0?"Version negotiation failed: the server gave no modern evidence and this client supports no pre-2026-07-28 protocol version to fall back to":`Version negotiation failed: ${w} and this client supports no pre-2026-07-28 protocol version to fall back to`);if(w!==void 0&&t.disposableProbe!==!0)throw new E(N.EraNegotiationFailed,`Version negotiation failed: ${w} (this transport probed in place — the disposable sibling probe requires the SDK's base StdioClientTransport)`);return{era:"legacy"}}case"error":throw y.error}}},l;try{l=await c()}catch(u){throw s.detach(),u}return s.release(),l}function vb(e){let t=Object.getPrototypeOf(e);if(t===null||!Object.prototype.hasOwnProperty.call(t,"_dispose"))return;let o=e._serverParams;return typeof o==="object"&&o!==null&&typeof o.command==="string"?o:void 0}async function Rb(e,t,o,r){let i=new t.constructor({...o,stderr:"ignore"}),s=t.close,c=!1,l,u=new Promise((f,S)=>{l=()=>S(Im())});t.close=async function(){return c=!0,l?.(),s.call(t)};let h;try{let f=Um(e,{...r,transport:i,transportKind:"stdio",disposableProbe:!0});f.catch(()=>{}),h=await Promise.race([f,u])}finally{await wb(i),t.close=s}if(c)throw Im();return h}function Im(){return new E(N.EraNegotiationFailed,"Version negotiation failed: the transport was closed during the server/discover probe")}async function wb(e){try{let t=e._dispose;await(typeof t==="function"?t.call(e):e.close())}catch{}}function Om(e){let t=e._meta?.[st];return dl.Implementation(t)?t:void 0}function $a(e,t){if(!e||t===null||typeof t!=="object")return;if(e.type==="object"&&e.properties&&typeof e.properties==="object"){let o=t,r=e.properties;for(let n of Object.keys(r)){let i=r[n];if(o[n]===void 0&&Object.prototype.hasOwnProperty.call(i,"default"))o[n]=i.default;if(o[n]!==void 0)$a(i,o[n])}}if(Array.isArray(e.anyOf)){for(let o of e.anyOf)if(typeof o!=="boolean")$a(o,t)}if(Array.isArray(e.oneOf)){for(let o of e.oneOf)if(typeof o!=="boolean")$a(o,t)}}function Zm(e){if(!e)return{supportsFormMode:!1,supportsUrlMode:!1};let t=e.form!==void 0,o=e.url!==void 0;return{supportsFormMode:t||!t&&!o,supportsUrlMode:o}}function xb(e){if(typeof e==="object"&&e!==null){if(e.kind==="legacy"&&!("supportedVersions"in e)&&!("discover"in e))return e;if(e.kind==="modern"&&At.safeParse(e.discover).success)return e}throw new E(N.EraNegotiationFailed,"connect({ prior }): unrecognized prior — expected { kind: 'modern', discover } or { kind: 'legacy' }")}var Nm={"notifications/tools/list_changed":["tools/list"],"notifications/prompts/list_changed":["prompts/list"],"notifications/resources/list_changed":["resources/list","resources/templates/list"]},Pb=64,gl={},Tb=class extends ri{_serverCapabilities;_serverVersion;_capabilities;_instructions;_jsonSchemaValidator;_cache;_defaultCacheTtlMs;_listMaxPages;_listChangedDebounceTimers=new Map;_listChangedConfig;_enforceStrictCapabilities;_versionNegotiation;_supportedProtocolVersionsOption;_inputRequiredDriverConfig;_listenState=new Map;_nextListenId=0;_autoOpenedSubscription;_discoverResult;static{gl.enforceStrictCapabilities=(e)=>e._enforceStrictCapabilities,gl.walkPages=(e,t,o,r)=>e._walkPages(t,o,r),gl.readResource=(e,t,o)=>e._readResource(t,o)}_resetConnectionState(){if(this._negotiatedProtocolVersion=void 0,this._serverCapabilities=void 0,this._serverVersion=void 0,this._instructions=void 0,this._discoverResult=void 0,this._autoOpenedSubscription=void 0,this._listenState.size>0){let e=new E(N.ConnectionClosed,"subscriptions/listen: client reconnected or closed; subscription state from the previous connection was reset");for(let t of this._listenState.values())t.settle({cause:"remote",error:e})}this._listenState.clear();for(let e of this._listChangedDebounceTimers.values())clearTimeout(e);this._listChangedDebounceTimers.clear(),this._cache.resetForReconnect()}async close(){try{await super.close()}finally{this._resetConnectionState()}}constructor(e,t){super(t);if(this._clientInfo=e,this._capabilities=t?.capabilities?{...t.capabilities}:{},this._jsonSchemaValidator=t?.jsonSchemaValidator??new Ea,this._enforceStrictCapabilities=t?.enforceStrictCapabilities??!1,this._versionNegotiation=t?.versionNegotiation,this._supportedProtocolVersionsOption=t?.supportedProtocolVersions,this._inputRequiredDriverConfig=ym(t?.inputRequired),this._cache=new rb(t?.responseCacheStore??new qm,t?.responseCacheStore!==void 0,(o)=>this._reportStoreError(o),t?.cachePartition??""),this._defaultCacheTtlMs=t?.defaultCacheTtlMs??0,this._listMaxPages=t?.listMaxPages??Pb,t?.listChanged)this._listChangedConfig=t.listChanged}buildContext(e,t){return e}_shouldDropInbound(e){if(this._negotiatedProtocolVersion!==void 0&&vt(this._negotiatedProtocolVersion)&&Pa(e))return"drop"}_outboundMetaEnvelope(){let e=this._negotiatedProtocolVersion;if(e===void 0)return;return this._wireCodec().outboundEnvelope({protocolVersion:e,clientInfo:this._clientInfo,clientCapabilities:this._capabilities})}_resolveNonCompleteResult(e,t){if(!this._inputRequiredDriverConfig.autoFulfill)return Promise.reject(new E(N.UnsupportedResultType,`Unsupported result type 'input_required' for ${t.request.method}: multi-round-trip auto-fulfilment is not enabled on this instance — pass allowInputRequired: true to handle it manually, or enable inputRequired.autoFulfill`,{resultType:"input_required",method:t.request.method}));return wm({getRequestHandler:(o)=>this._getRequestHandler(o),buildContext:(o)=>this.buildContext(o,void 0),sessionId:this.transport?.sessionId},this._inputRequiredDriverConfig,e,t)}_setupListChangedHandlers(e){if(e.tools&&this._serverCapabilities?.tools?.listChanged)this._setupListChangedHandler("tools","notifications/tools/list_changed",e.tools,async()=>(await this.listTools(void 0,{cacheMode:"refresh"})).tools);if(e.prompts&&this._serverCapabilities?.prompts?.listChanged)this._setupListChangedHandler("prompts","notifications/prompts/list_changed",e.prompts,async()=>(await this.listPrompts(void 0,{cacheMode:"refresh"})).prompts);if(e.resources&&this._serverCapabilities?.resources?.listChanged)this._setupListChangedHandler("resources","notifications/resources/list_changed",e.resources,async()=>(await this.listResources(void 0,{cacheMode:"refresh"})).resources)}registerCapabilities(e){if(this.transport)throw Error("Cannot register capabilities after connecting to transport");this._capabilities=hl(this._capabilities,e)}setVersionNegotiation(e){if(this.transport)throw Error("Cannot configure version negotiation after connecting to transport");this._versionNegotiation=e}_wrapHandler(e,t){if(e==="elicitation/create")return async(o,r)=>{let n=zt(this._negotiatedProtocolVersion),i=n.validateRequest("elicitation/create",o);if(!i.ok&&i.reason==="not-in-era")i=n.validateInputRequest("elicitation/create",o);if(!i.ok)throw new W(i.reason==="not-in-era"?U.InternalError:U.InvalidParams,i.reason==="not-in-era"?"No wire schema for elicitation/create in the resolved era":`Invalid elicitation request: ${i.message}`);let{params:s}=i.value;s.mode=s.mode??"form";let{supportsFormMode:c,supportsUrlMode:l}=Zm(this._capabilities.elicitation);if(s.mode==="form"&&!c)throw new W(U.InvalidParams,"Client does not support form-mode elicitation requests");if(s.mode==="url"&&!l)throw new W(U.InvalidParams,"Client does not support URL-mode elicitation requests");let u=await t(o,r),h=n.validateResult("elicitation/create",u);if(!h.ok&&h.reason==="not-in-era")h=n.validateInputResponse("elicitation/create",u);if(!h.ok)throw new W(h.reason==="not-in-era"?U.InternalError:U.InvalidParams,h.reason==="not-in-era"?"No wire schema for elicitation/create in the resolved era":`Invalid elicitation result: ${h.message}`);let f=h.value,S=s.mode==="form"?s.requestedSchema:void 0;if(s.mode==="form"&&f.action==="accept"&&f.content&&S&&this._capabilities.elicitation?.form?.applyDefaults)try{$a(S,f.content)}catch{}return f};if(e==="sampling/createMessage")return async(o,r)=>{let n=zt(this._negotiatedProtocolVersion),i=n.validateRequest("sampling/createMessage",o);if(!i.ok&&i.reason==="not-in-era")i=n.validateInputRequest("sampling/createMessage",o);if(!i.ok)throw new W(i.reason==="not-in-era"?U.InternalError:U.InvalidParams,i.reason==="not-in-era"?"No wire schema for sampling/createMessage in the resolved era":`Invalid sampling request: ${i.message}`);let{params:s}=i.value,c=await t(o,r),l=Boolean(s.tools||s.toolChoice),u=n.samplingResultVariant(l,c);if(!u.ok&&u.reason==="not-in-era")u=n.validateInputResponse("sampling/createMessage",c);if(!u.ok)throw new W(u.reason==="not-in-era"?U.InternalError:U.InvalidParams,u.reason==="not-in-era"?"No result schema for sampling/createMessage in the resolved era":`Invalid sampling result: ${u.message}`);return u.value};return t}assertCapability(e,t){if(!this._serverCapabilities?.[e])throw new E(N.CapabilityNotSupported,`Server does not support ${e} (required for ${t})`)}async connect(e,t){if(t?.prior!=null)return this._connectFromPrior(e,xb(t.prior),t);let o=Sb(this._versionNegotiation,this._supportedProtocolVersionsOption);if(o.kind!=="legacy")return this._connectNegotiated(e,o,t);return this._connectPlainLegacy(e,t)}async _connectPlainLegacy(e,t){if(await super.connect(e),e.sessionId!==void 0){let o=this._negotiatedProtocolVersion;if(o!==void 0)e.setProtocolVersion?.(o);return}this._resetConnectionState(),await this._legacyHandshake(e,t)}async _legacyHandshake(e,t){let o=rl(this._supportedProtocolVersions);try{let r=o[0];if(r===void 0)throw new E(N.EraNegotiationFailed,"Cannot run the initialize handshake: supportedProtocolVersions contains no pre-2026-07-28 protocol version");let n=await this.request({method:"initialize",params:{protocolVersion:r,capabilities:this._capabilities,clientInfo:this._clientInfo}},t);if(n===void 0)throw Error(`Server sent invalid initialize result: ${n}`);if(!o.includes(n.protocolVersion))throw Error(`Server's protocol version is not supported: ${n.protocolVersion}`);if(this._serverCapabilities=n.capabilities,this._serverVersion=n.serverInfo,this._cache.setServerIdentity(this._deriveServerIdentity(e)),e.setProtocolVersion)e.setProtocolVersion(n.protocolVersion);if(this._instructions=n.instructions,await this.notification({method:"notifications/initialized"}),this._negotiatedProtocolVersion=n.protocolVersion,this._listChangedConfig)this._setupListChangedHandlers(this._listChangedConfig)}catch(r){throw this.close(),r}}async _connectNegotiated(e,t,o){if(e.sessionId!==void 0){await super.connect(e);let n=this._negotiatedProtocolVersion;if(n!==void 0&&e.setProtocolVersion)e.setProtocolVersion(n);return}this._resetConnectionState();let r;try{let n=$m(e),i={clientInfo:this._clientInfo,capabilities:this._capabilities,environment:km(),defaultTimeoutMs:o?.timeout??oi},s=n==="stdio"?vb(e):void 0;r=s===void 0?await Um(t,{...i,transport:e,transportKind:n}):await Rb(t,e,s,i)}catch(n){throw await e.close().catch(()=>{}),Cm(e),n}if(Cm(e),await super.connect(e),r.era==="legacy"){await this._legacyHandshake(e,o);return}if(this._serverCapabilities=r.discover.capabilities,this._serverVersion=Om(r.discover),this._cache.setServerIdentity(this._deriveServerIdentity(e)),this._instructions=r.discover.instructions,this._discoverResult=r.discover,this._negotiatedProtocolVersion=r.version,e.setProtocolVersion)e.setProtocolVersion(r.version);if(this._listChangedConfig){let n=this._listChangedConfig,i=this._serverCapabilities,s={...n.tools&&i?.tools?.listChanged&&{tools:n.tools},...n.prompts&&i?.prompts?.listChanged&&{prompts:n.prompts},...n.resources&&i?.resources?.listChanged&&{resources:n.resources}},c=!0;try{this._setupListChangedHandlers(s)}catch(u){c=!1,this.onerror?.(u instanceof Error?u:Error(String(u)))}let l=c?{...s.tools&&{toolsListChanged:!0},...s.prompts&&{promptsListChanged:!0},...s.resources&&{resourcesListChanged:!0}}:{};if(Object.keys(l).length>0){let u=new AbortController,h=()=>u.abort(o?.signal?.reason);if(o?.signal?.aborted)h();o?.signal?.addEventListener("abort",h);try{this._autoOpenedSubscription=await this.listen(l,{timeout:o?.timeout,signal:u.signal})}catch(f){if(o?.signal?.aborted)throw await this.close().catch(()=>{}),f;this.onerror?.(f instanceof Error?f:Error(String(f)))}finally{o?.signal?.removeEventListener("abort",h)}}}}async _connectFromPrior(e,t,o){if(t.kind==="legacy")return this._connectPlainLegacy(e,o);let r=t.discover;this._resetConnectionState();let n=this._supportedProtocolVersionsOption,i=(n&&Xs(n).length>0?Xs(n):ol).find((s)=>r.supportedVersions.includes(s));if(i===void 0)throw new E(N.EraNegotiationFailed,"connect({ prior }) with a modern verdict requires a 2026-07-28+ mutual protocol version; the supplied DiscoverResult and this client's supportedProtocolVersions have no modern overlap. For a server known to be legacy, pass prior: { kind: 'legacy' } to skip the probe and initialize directly, or use versionNegotiation: { mode: 'auto' } to re-probe with legacy fallback.");if(await super.connect(e),this._discoverResult=r,this._serverCapabilities=r.capabilities,this._serverVersion=Om(r),this._cache.setServerIdentity(this._deriveServerIdentity(e)),this._instructions=r.instructions,this._negotiatedProtocolVersion=i,e.setProtocolVersion?.(i),this._listChangedConfig)try{this._setupListChangedHandlers(this._listChangedConfig)}catch(s){this.onerror?.(s instanceof Error?s:Error(String(s)))}}getServerCapabilities(){return this._serverCapabilities}getServerVersion(){return this._serverVersion}_deriveServerIdentity(e){let t=this._serverVersion;if(t!==void 0)return`${t.name}@${t.version}`;return e.sessionId??`anonymous:${Date.now()}-${Math.random().toString(36).slice(2)}`}getNegotiatedProtocolVersion(){return this._negotiatedProtocolVersion}getProtocolEra(){let e=this._negotiatedProtocolVersion;if(e===void 0)return;return vt(e)?"modern":"legacy"}getInstructions(){return this._instructions}getDiscoverResult(){return this._discoverResult}assertCapabilityForMethod(e){switch(e){case"logging/setLevel":if(!this._serverCapabilities?.logging)throw new E(N.CapabilityNotSupported,`Server does not support logging (required for ${e})`);break;case"prompts/get":case"prompts/list":if(!this._serverCapabilities?.prompts)throw new E(N.CapabilityNotSupported,`Server does not support prompts (required for ${e})`);break;case"resources/list":case"resources/templates/list":case"resources/read":case"resources/subscribe":case"resources/unsubscribe":if(!this._serverCapabilities?.resources)throw new E(N.CapabilityNotSupported,`Server does not support resources (required for ${e})`);if(e==="resources/subscribe"&&!this._serverCapabilities.resources.subscribe)throw new E(N.CapabilityNotSupported,`Server does not support resource subscriptions (required for ${e})`);break;case"tools/call":case"tools/list":if(!this._serverCapabilities?.tools)throw new E(N.CapabilityNotSupported,`Server does not support tools (required for ${e})`);break;case"completion/complete":if(!this._serverCapabilities?.completions)throw new E(N.CapabilityNotSupported,`Server does not support completions (required for ${e})`);break;case"initialize":break;case"server/discover":break;case"ping":break}}assertNotificationCapability(e){switch(e){case"notifications/roots/list_changed":if(!this._capabilities.roots?.listChanged)throw new E(N.CapabilityNotSupported,`Client does not support roots list changed notifications (required for ${e})`);break;case"notifications/initialized":break;case"notifications/cancelled":break;case"notifications/progress":break}}assertRequestHandlerCapability(e){switch(e){case"sampling/createMessage":if(!this._capabilities.sampling)throw new E(N.CapabilityNotSupported,`Client does not support sampling capability (required for ${e})`);break;case"elicitation/create":if(!this._capabilities.elicitation)throw new E(N.CapabilityNotSupported,`Client does not support elicitation capability (required for ${e})`);break;case"roots/list":if(!this._capabilities.roots)throw new E(N.CapabilityNotSupported,`Client does not support roots capability (required for ${e})`);break;case"ping":break}}async ping(e){return this.request({method:"ping"},e)}async discover(e){let t=await this._requestWithSchema({method:"server/discover"},At,e);return this._discoverResult=t,t}async complete(e,t){return this.request({method:"completion/complete",params:e},t)}async setLoggingLevel(e,t){return this.request({method:"logging/setLevel",params:{level:e}},t)}async getPrompt(e,t){return this.request({method:"prompts/get",params:e},t)}async listPrompts(e,t){if(!this._serverCapabilities?.prompts&&!this._enforceStrictCapabilities)return console.debug("Client.listPrompts() called but server does not advertise prompts capability - returning empty list"),{prompts:[]};if(e?.cursor!==void 0)return this.request({method:"prompts/list",params:e},t);let o=await this._serveFromCache("prompts/list",void 0,t);if(o!==void 0)return o;return this._listAllPages("prompts/list",e,t,(r)=>r.prompts)}async listResources(e,t){if(!this._serverCapabilities?.resources&&!this._enforceStrictCapabilities)return console.debug("Client.listResources() called but server does not advertise resources capability - returning empty list"),{resources:[]};if(e?.cursor!==void 0)return this.request({method:"resources/list",params:e},t);let o=await this._serveFromCache("resources/list",void 0,t);if(o!==void 0)return o;return this._listAllPages("resources/list",e,t,(r)=>r.resources)}async listResourceTemplates(e,t){if(!this._serverCapabilities?.resources&&!this._enforceStrictCapabilities)return console.debug("Client.listResourceTemplates() called but server does not advertise resources capability - returning empty list"),{resourceTemplates:[]};if(e?.cursor!==void 0)return this.request({method:"resources/templates/list",params:e},t);let o=await this._serveFromCache("resources/templates/list",void 0,t);if(o!==void 0)return o;return this._listAllPages("resources/templates/list",e,t,(r)=>r.resourceTemplates)}async _listAllPages(e,t,o,r,n){let i=o?.cacheMode==="bypass",s=this._cache.captureGeneration(e),c=(u)=>{let h=u===void 0?t&&{...t}:{...t,cursor:u};return this.request({method:e,...h&&{params:h}},o)},l=await this._walkPages(e,c,r);if(delete l.nextCursor,n?.(l),i)return l;return await this._cache.write(e,l,s,this._freshness(l)),l}async _walkPages(e,t,o){let r=await t(void 0),n=r.nextCursor,i=r,s=1;while(n!==void 0){if(this._listMaxPages!==0&&s>=this._listMaxPages)throw new E(N.ListPaginationExceeded,`${e}: exceeded listMaxPages (${this._listMaxPages}); server pagination did not terminate`,{method:e,listMaxPages:this._listMaxPages});let c=await t(n);if(c.nextCursor===n&&JSON.stringify(o(c))===JSON.stringify(o(i)))break;o(r).push(...o(c)),i=c,n=c.nextCursor,s++}return r}_freshness(e,t){let o=e,r=typeof o.ttlMs==="number"?o.ttlMs:this._defaultCacheTtlMs,n=o.cacheScope==="public"?"public":"private";return{expiresAt:this._cache.now()+Math.min(Math.max(0,r),Am),scope:n,params:t}}async _serveFromCache(e,t,o){if(o?.cacheMode==="bypass"||o?.cacheMode==="refresh")return;let r=await this._cache.read(e,t).catch((n)=>void this._reportStoreError(n));if(r!==void 0){if(o?.signal?.aborted){let n=o.signal.reason;throw n instanceof E?n:new E(N.RequestTimeout,String(n))}return r.value}}_reportStoreError(e){this.onerror?.(e instanceof Error?e:Error(String(e)))}_compileOutputValidator(e){if(!e.outputSchema)return;try{return{ok:!0,validator:this._jsonSchemaValidator.getValidator(e.outputSchema)}}catch(t){return{ok:!1,compileError:t}}}async _resolveXMcpHeaderScan(e,t){let o=t??await this._cache.toolDefinition(e);return o===void 0?void 0:ll(o.inputSchema)}async readResource(e,t){let{result:o}=await this._readResource(e,t);return o}async _readResource(e,t){let o=await this._serveFromCache("resources/read",e.uri,t);if(o!==void 0)return{result:o,cached:!0};let r=this._cache.captureGeneration("resources/read",e.uri),n=await this.request({method:"resources/read",params:e},t);if(t?.cacheMode!=="bypass"){let i=this._freshness(n,e.uri);if(i.expiresAt>this._cache.now())await this._cache.write("resources/read",n,r,i);else if(t?.cacheMode==="refresh")await this._cache.evictKey("resources/read",e.uri)}return{result:n,cached:!1}}async subscribeResource(e,t){return this.request({method:"resources/subscribe",params:e},t)}async unsubscribeResource(e,t){return this.request({method:"resources/unsubscribe",params:e},t)}async listen(e,t){if(this.transport===void 0)throw new E(N.NotConnected,"Not connected");let o=this._negotiatedProtocolVersion;if(o===void 0||!vt(o))throw new E(N.MethodNotSupportedByProtocolVersion,`subscriptions/listen requires a 2026-07-28-era connection (negotiated: ${o??"none"}). On a 2025-era connection, change notifications are delivered unsolicited: use ClientOptions.listChanged and resources/subscribe instead.`,{method:"subscriptions/listen",protocolVersion:o});if(t?.signal?.aborted){let q=t.signal.reason;throw q instanceof E?q:new E(N.RequestTimeout,String(q))}let r=new AbortController,n=`listen:${this._nextListenId++}`,i="opening",s,c,l,u,h=new Promise((q,F)=>{l=q,u=F}),f,S=new Promise((q)=>{f=q}),_=(q)=>{if(i==="closed")return;let F=i==="opening";if(s!==void 0)clearTimeout(s),s=void 0;if("ack"in q){i="open",l(q.ack);return}if(i="closed",c!==void 0)t?.signal?.removeEventListener("abort",c);if(this._listenState.delete(n),r.abort(),f(q.cause),F)u(q.error??new E(N.ConnectionClosed,"subscriptions/listen closed before the server acknowledged"))},y=async()=>{r.abort(),await this.notification({method:"notifications/cancelled",params:{requestId:n}}).catch(()=>{})},w=async()=>{if(i==="closed")return;_({cause:"local"}),await y()};this._listenState.set(n,{settle:_});let k=t?.timeout??oi;if(s=setTimeout(()=>{_({cause:"remote",error:new E(N.RequestTimeout,"subscriptions/listen ack timed out",{timeout:k})}),y().catch(()=>{})},k),t?.signal){let q=t.signal;c=()=>{if(i==="closed")return;let F=q.reason;_({cause:"local",error:F instanceof Error?F:Error(String(F??"Aborted"))}),y().catch(()=>{})},q.addEventListener("abort",c,{once:!0})}let V={jsonrpc:"2.0",id:n,method:"subscriptions/listen",params:{_meta:{...this._outboundMetaEnvelope()},notifications:e}},B=(q)=>{_({cause:"remote",error:q instanceof Error?q:Error(String(q))})};try{this.transport.send(V,{requestSignal:r.signal,onRequestStreamEnd:()=>_({cause:"remote",error:Error("subscriptions/listen: stream ended")})}).catch(B)}catch(q){B(q)}return{honoredFilter:await h,close:w,closed:S}}get autoOpenedSubscription(){return this._autoOpenedSubscription}_onnotification(e,t){let o=Object.hasOwn(Nm,e.method)?Nm[e.method]:void 0;if(e.method==="notifications/resources/updated"){let r=e.params?.uri;if(typeof r==="string")this._cache.evictKey("resources/read",r)}else if(o!==void 0)for(let r of o)this._cache.evict(r);if(e.method==="notifications/subscriptions/acknowledged"){let r=e.params?._meta?.[Uo],n=typeof r==="string"?this._listenState.get(r):void 0;if(n!==void 0){let i=this._wireCodec().validateNotification("notifications/subscriptions/acknowledged",e);n.settle({ack:i.ok?i.value.params.notifications:{}});return}}if(e.method==="notifications/cancelled"){let r=e.params?.requestId,n=typeof r==="string"?this._listenState.get(r):void 0;if(n!==void 0){n.settle({cause:"remote",error:Error("subscriptions/listen: server cancelled the subscription")});return}}super._onnotification(e,t)}_onresponse(e){let t=e.id,o=typeof t==="string"?this._listenState.get(t):void 0;if(o!==void 0){if(ti(e))o.settle({cause:"remote",error:W.fromError(e.error.code,e.error.message,e.error.data)});else o.settle({cause:"graceful",error:new E(N.ConnectionClosed,"subscriptions/listen: server closed the subscription gracefully before acknowledging")});return}super._onresponse(e)}_onclose(){if(this._listenState.size>0){let e=new E(N.ConnectionClosed,"Connection closed");for(let t of this._listenState.values())t.settle({cause:"remote",error:e});this._listenState.clear()}super._onclose()}async callTool(e,t){let o=this.getProtocolEra()==="modern"&&km()!=="browser",r=async()=>{if(!o)return t;let l;try{l=await this._resolveXMcpHeaderScan(e.name,t?.toolDefinition)}catch(h){this._reportStoreError(h)}if(!l?.valid||l.declarations.length===0)return t;let u=_m(l.declarations,e.arguments);return Object.keys(u).length===0?t:{...t,headers:{...t?.headers,...u}}},n=t?.toolDefinition===void 0?await this._cache.outputValidator(e.name,(l)=>this._compileOutputValidator(l)).catch((l)=>void this._reportStoreError(l)):this._compileOutputValidator(t.toolDefinition),i=()=>{if(n===void 0||n.ok)return;let l=n.compileError,u=(l instanceof Error?l.message:String(l)).slice(0,200);throw new W(U.InvalidParams,`Tool '${e.name}' has an invalid outputSchema: ${u}`)};i();let s;try{s=await this.request({method:"tools/call",params:e},await r())}catch(l){let u=l instanceof W&&l.code===mr;if(!o||!u||t?.toolDefinition!==void 0)throw l;let h={signal:t?.signal,timeout:t?.timeout,cacheMode:"refresh"};await this._cache.evict("tools/list"),await this.listTools(void 0,h).catch((f)=>this._reportStoreError(f)),n=await this._cache.outputValidator(e.name,(f)=>this._compileOutputValidator(f)).catch((f)=>void this._reportStoreError(f)),i(),s=await this.request({method:"tools/call",params:e},await r())}let c=n!==void 0&&n.ok?n.validator:void 0;if(c){if(s.structuredContent===void 0&&!s.isError)throw new W(U.InvalidRequest,`Tool ${e.name} has an output schema but did not return structured content`);if(s.structuredContent!==void 0&&!s.isError)try{let l=c(s.structuredContent);if(!l.valid)throw new W(U.InvalidParams,`Structured content does not match the tool's output schema: ${l.errorMessage}`)}catch(l){if(l instanceof W)throw l;throw new W(U.InvalidParams,`Failed to validate structured content: ${l instanceof Error?l.message:String(l)}`)}}return s}async listTools(e,t){if(!this._serverCapabilities?.tools&&!this._enforceStrictCapabilities)return console.debug("Client.listTools() called but server does not advertise tools capability - returning empty list"),{tools:[]};if(e?.cursor!==void 0){let r=await this.request({method:"tools/list",params:e},t);return this._excludeInvalidXMcpHeaderTools(r),r}let o=await this._serveFromCache("tools/list",void 0,t);if(o!==void 0)return o;return this._listAllPages("tools/list",e,t,(r)=>r.tools,(r)=>this._excludeInvalidXMcpHeaderTools(r))}_excludeInvalidXMcpHeaderTools(e){if(this.getProtocolEra()!=="modern"||!this.transport||$m(this.transport)==="stdio")return;let t=e.tools.filter((o)=>{let r=ll(o.inputSchema);if(!r.valid)return console.warn(`[mcp-sdk] excluding tool '${o.name}' from tools/list: invalid x-mcp-header declaration — ${r.reason}`),!1;return!0});if(t.length!==e.tools.length)e.tools=t}_setupListChangedHandler(e,t,o,r){let n=Ta(ss,o);if(!n.success)throw Error(`Invalid ${e} listChanged options: ${n.error.message}`);if(typeof o.onChanged!=="function")throw TypeError(`Invalid ${e} listChanged options: onChanged must be a function`);let{autoRefresh:i,debounceMs:s}=n.data,{onChanged:c}=o,l=async()=>{if(!i){c(null,null);return}try{c(null,await r())}catch(h){c(h instanceof Error?h:Error(String(h)),null)}},u=()=>{if(s){let h=this._listChangedDebounceTimers.get(e);if(h)clearTimeout(h);let f=setTimeout(l,s);this._listChangedDebounceTimers.set(e,f)}else l()};this.setNotificationHandler(t,u)}async sendRootsListChanged(){return this.notification({method:"notifications/roots/list_changed"})}};var YR=class extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.SseError"})}static[Symbol.hasInstance](e){return Te(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 Te(this,e)}constructor(e,t,o){super(`SSE error: ${t}`);this.code=e,this.event=o,Zt(this,new.target)}};class Bm{_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 Wm{_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 Dm=new Set;function Vm(e,t){let[o,r]=t,n=o?.shape;if(typeof n?.method?.value!=="string")return;let i=n.method.value,s=e==="request"?"setRequestHandler":"setNotificationHandler";if(!Dm.has(s))Dm.add(s),console.warn(`[ext-apps] ${s}(Schema, handler) is deprecated; use ${s}("${i}", { params: Schema.shape.params }, handler).`);let c=r;return[i,{params:n.params},e==="request"?(l,u)=>c({method:i,params:l},Eb(u)):(l)=>c({method:i,params:l})]}function Eb(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 kb="2026-01-26";var $b="ui/notifications/tool-input-partial";class Gm{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=uo.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!==$b)console.debug("Sending message",e);this.eventTarget.postMessage(e,"*")}async close(){window.removeEventListener("message",this.messageListener),this.onclose?.()}onclose;onerror;onmessage;sessionId;setProtocolVersion}var Cb=R([p("light"),p("dark")]).describe("Color theme preference for the host environment."),si=R([p("inline"),p("fullscreen"),p("pip")]).describe("Display mode for UI presentation."),Ib=R([p("--color-background-primary"),p("--color-background-secondary"),p("--color-background-tertiary"),p("--color-background-inverse"),p("--color-background-ghost"),p("--color-background-info"),p("--color-background-danger"),p("--color-background-success"),p("--color-background-warning"),p("--color-background-disabled"),p("--color-text-primary"),p("--color-text-secondary"),p("--color-text-tertiary"),p("--color-text-inverse"),p("--color-text-ghost"),p("--color-text-info"),p("--color-text-danger"),p("--color-text-success"),p("--color-text-warning"),p("--color-text-disabled"),p("--color-border-primary"),p("--color-border-secondary"),p("--color-border-tertiary"),p("--color-border-inverse"),p("--color-border-ghost"),p("--color-border-info"),p("--color-border-danger"),p("--color-border-success"),p("--color-border-warning"),p("--color-border-disabled"),p("--color-ring-primary"),p("--color-ring-secondary"),p("--color-ring-inverse"),p("--color-ring-info"),p("--color-ring-danger"),p("--color-ring-success"),p("--color-ring-warning"),p("--font-sans"),p("--font-mono"),p("--font-weight-normal"),p("--font-weight-medium"),p("--font-weight-semibold"),p("--font-weight-bold"),p("--font-text-xs-size"),p("--font-text-sm-size"),p("--font-text-md-size"),p("--font-text-lg-size"),p("--font-heading-xs-size"),p("--font-heading-sm-size"),p("--font-heading-md-size"),p("--font-heading-lg-size"),p("--font-heading-xl-size"),p("--font-heading-2xl-size"),p("--font-heading-3xl-size"),p("--font-text-xs-line-height"),p("--font-text-sm-line-height"),p("--font-text-md-line-height"),p("--font-text-lg-line-height"),p("--font-heading-xs-line-height"),p("--font-heading-sm-line-height"),p("--font-heading-md-line-height"),p("--font-heading-lg-line-height"),p("--font-heading-xl-line-height"),p("--font-heading-2xl-line-height"),p("--font-heading-3xl-line-height"),p("--border-radius-xs"),p("--border-radius-sm"),p("--border-radius-md"),p("--border-radius-lg"),p("--border-radius-xl"),p("--border-radius-full"),p("--border-width-regular"),p("--shadow-hairline"),p("--shadow-sm"),p("--shadow-md"),p("--shadow-lg")]).describe("CSS variable keys available to MCP apps for theming."),Ob=z(Ib.describe(`Style variables for theming MCP apps.
|
|
69
72
|
|
|
70
73
|
Individual style keys are optional - hosts may provide any subset of these values.
|
|
71
74
|
Values are strings containing CSS values (colors, sizes, font stacks, etc.).
|
|
72
75
|
|
|
73
76
|
Note: This type uses \`Record<K, string | undefined>\` rather than \`Partial<Record<K, string>>\`
|
|
74
|
-
for compatibility with Zod schema generation. Both are functionally equivalent for validation.`),
|
|
77
|
+
for compatibility with Zod schema generation. Both are functionally equivalent for validation.`),R([a(),Dc()]).describe(`Style variables for theming MCP apps.
|
|
75
78
|
|
|
76
79
|
Individual style keys are optional - hosts may provide any subset of these values.
|
|
77
80
|
Values are strings containing CSS values (colors, sizes, font stacks, etc.).
|
|
@@ -83,10 +86,10 @@ Individual style keys are optional - hosts may provide any subset of these value
|
|
|
83
86
|
Values are strings containing CSS values (colors, sizes, font stacks, etc.).
|
|
84
87
|
|
|
85
88
|
Note: This type uses \`Record<K, string | undefined>\` rather than \`Partial<Record<K, string>>\`
|
|
86
|
-
for compatibility with Zod schema generation. Both are functionally equivalent for validation.`),
|
|
89
|
+
for compatibility with Zod schema generation. Both are functionally equivalent for validation.`),cw=d({method:p("ui/open-link"),params:d({url:a().describe("URL to open in the host's browser")})}),Nb=d({isError:v().optional().describe("True if the host failed to open the URL (e.g., due to security policy).")}).passthrough(),Mb=d({isError:v().optional().describe("True if the download failed (e.g., user cancelled or host denied).")}).passthrough(),qb=d({isError:v().optional().describe("True if the host rejected or failed to deliver the message.")}).passthrough(),lw=d({method:p("ui/notifications/sandbox-proxy-ready"),params:d({})}),_l=d({connectDomains:m(a()).optional().describe(`Origins for network requests (fetch/XHR/WebSocket).
|
|
87
90
|
|
|
88
91
|
- Maps to CSP \`connect-src\` directive
|
|
89
|
-
- Empty or omitted → no network connections (secure default)`),resourceDomains:
|
|
92
|
+
- Empty or omitted → no network connections (secure default)`),resourceDomains:m(a()).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:m(a()).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:m(a()).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'`)")}),bl=d({camera:d({}).optional().describe("Request camera access.\n\nMaps to Permission Policy `camera` feature."),microphone:d({}).optional().describe("Request microphone access.\n\nMaps to Permission Policy `microphone` feature."),geolocation:d({}).optional().describe("Request geolocation access.\n\nMaps to Permission Policy `geolocation` feature."),clipboardWrite:d({}).optional().describe("Request clipboard write access.\n\nMaps to Permission Policy `clipboard-write` feature.")}),uw=d({method:p("ui/notifications/size-changed"),params:d({width:b().optional().describe("New width in pixels."),height:b().optional().describe("New height in pixels.")})}),Ab=d({method:p("ui/notifications/tool-input"),params:d({arguments:z(a(),I().describe("Complete tool call arguments as key-value pairs.")).optional().describe("Complete tool call arguments as key-value pairs.")})}),jb=d({method:p("ui/notifications/tool-input-partial"),params:d({arguments:z(a(),I().describe("Partial tool call arguments (incomplete, may change).")).optional().describe("Partial tool call arguments (incomplete, may change).")})}),Lb=d({method:p("ui/notifications/tool-cancelled"),params:d({reason:a().optional().describe('Optional reason for the cancellation (e.g., "user action", "timeout").')})}),Ub=d({fonts:a().optional()}),Zb=d({variables:Ob.optional().describe("CSS variables for theming the app."),css:Ub.optional().describe("CSS blocks that apps can inject.")}),Db=d({method:p("ui/resource-teardown"),params:d({})}),Vb=z(a(),I()),Hm=d({text:d({}).optional().describe("Host supports text content blocks."),image:d({}).optional().describe("Host supports image content blocks."),audio:d({}).optional().describe("Host supports audio content blocks."),resource:d({}).optional().describe("Host supports resource content blocks."),resourceLink:d({}).optional().describe("Host supports resource link content blocks."),structuredContent:d({}).optional().describe("Host supports structured content.")}),dw=d({method:p("ui/notifications/request-teardown"),params:d({}).optional()}),Hb=d({experimental:z(a(),z(a(),Ji()).describe("Experimental features keyed by identifier.")).optional().describe("Experimental features keyed by identifier."),openLinks:d({}).optional().describe("Host supports opening external URLs."),downloadFile:d({}).optional().describe("Host supports file downloads via ui/download-file."),serverTools:d({listChanged:v().optional().describe("Host supports tools/list_changed notifications.")}).optional().describe("Host can proxy tool calls to the MCP server."),serverResources:d({listChanged:v().optional().describe("Host supports resources/list_changed notifications.")}).optional().describe("Host can proxy resource reads to the MCP server."),logging:d({}).optional().describe("Host accepts log messages."),sandbox:d({permissions:bl.optional().describe("Permissions granted by the host (camera, microphone, geolocation)."),csp:_l.optional().describe("CSP domains approved by the host.")}).optional().describe("Sandbox configuration applied by the host."),updateModelContext:Hm.optional().describe("Host accepts context updates (ui/update-model-context) to be included in the model's context for future turns."),message:Hm.optional().describe("Host supports receiving content messages (ui/message) from the view."),sampling:d({tools:d({}).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.")}),Fb=d({experimental:z(a(),z(a(),Ji()).describe("Experimental features keyed by identifier.")).optional().describe("Experimental features keyed by identifier."),tools:d({listChanged:v().optional().describe("App supports tools/list_changed notifications.")}).optional().describe("App exposes MCP-style tools that the host can call."),availableDisplayModes:m(si).optional().describe("Display modes the app supports.")}),pw=d({method:p("ui/notifications/initialized"),params:d({}).optional()}),hw=d({csp:_l.optional().describe("Content Security Policy configuration for UI resources."),permissions:bl.optional().describe("Sandbox permissions requested by the UI resource."),domain:a().optional().describe(`Dedicated origin for view sandbox.
|
|
90
93
|
|
|
91
94
|
Useful when views need stable, dedicated origins for OAuth callbacks, CORS policies, or API key allowlists.
|
|
92
95
|
|
|
@@ -100,12 +103,12 @@ Boolean requesting whether a visible border and background is provided by the ho
|
|
|
100
103
|
|
|
101
104
|
- \`true\`: request visible border + background
|
|
102
105
|
- \`false\`: request no visible border + background
|
|
103
|
-
- omitted: host decides border`)}),
|
|
106
|
+
- omitted: host decides border`)}),mw=d({method:p("ui/request-display-mode"),params:d({mode:si.describe("The display mode being requested.")})}),Jb=d({mode:si.describe("The display mode that was actually set. May differ from requested if not supported.")}).passthrough(),Bb=R([p("model"),p("app")]).describe("Tool visibility scope - who can access the tool."),fw=d({resourceUri:a().optional(),visibility:m(Bb).optional().describe(`Who can access this tool. Default: ["model", "app"]
|
|
104
107
|
- "model": Tool visible to and callable by the agent
|
|
105
|
-
- "app": Tool callable by the app from this server only`),csp:
|
|
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:z([u("web"),u("desktop"),u("mobile")]).optional().describe("Platform type for responsive design decisions."),deviceCapabilities:l({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:l({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(),KS=l({method:u("ui/notifications/host-context-changed"),params:om.describe("Partial context update containing only changed fields.")}),nv=l({method:u("ui/update-model-context"),params:l({content:h(Te).optional().describe("Context content blocks (text, image, etc.)."),structuredContent:y(s(),R().describe("Structured content for machine-readable context data.")).optional().describe("Structured content for machine-readable context data.")})}),sv=l({method:u("ui/initialize"),params:l({appInfo:xe.describe("App identification (name and version)."),appCapabilities:JS.describe("Features and capabilities this app provides."),protocolVersion:s().describe("Protocol version this app supports.")})}),YS=l({protocolVersion:s().describe('Negotiated protocol version string (e.g., "2025-11-21").'),hostInfo:xe.describe("Host application identification and version."),hostCapabilities:FS.describe("Features and capabilities provided by the host."),hostContext:om.describe("Rich context about the host environment.")}).passthrough(),QS={target:"draft-2020-12"};async function Yh(e,t){let o=e["~standard"];if(o.jsonSchema)return o.jsonSchema[t](QS);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 Qh(e,t,o=""){let r=await e["~standard"].validate(t);if(r.issues){let n=r.issues.map((i)=>{let a=i.path?.map((c)=>typeof c==="object"?c.key:c).join(".");return a?`${a}: ${i.message}`:i.message}).join("; ");throw Error(o+n)}return r.value}function XS(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 ua extends Fc{_appInfo;_appCapabilities;options;_hostCapabilities;_hostInfo;_hostContext;_registeredTools={};_initializedSent=!1;_registeredEvents=new Set;_events=new Xh;_methods=new em;setRequestHandler=(...e)=>{let[t,...o]=Gh("request",e)??e;this._methods.claim(t,"setRequestHandler"),super.setRequestHandler.call(this,t,...o)};setNotificationHandler=(...e)=>{let[t,...o]=Gh("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:jS,toolinputpartial:LS,toolresult:GS,toolcancelled:US,hostcontextchanged:KS};static ONE_SHOT_EVENTS=new Set(["toolinput","toolinputpartial","toolresult","toolcancelled"]);_everHadListener=new Set;_assertHandlerTiming(e){if(!ua.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=XS(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(c){Object.assign(this,c),n()},remove(){if(r._registeredTools[e]!==a)return;delete r._registeredTools[e],n()},handler:async(c,p)=>{if(!a.enabled)throw Error(`Tool ${e} is disabled`);let d;if(i){let f=a.inputSchema,S=f?await Qh(f,c??{},`Invalid input for tool ${e}: `):c??{};d=await o(S,p)}else d=await o(p);if(a.outputSchema&&!d.isError)d.structuredContent=await Qh(a.outputSchema,d.structuredContent,`Invalid output for tool ${e}: `);return d}};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 Yh(r.inputSchema,"input"):{type:"object",properties:{}}};if(r.outputSchema)n.outputSchema=await Yh(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:HS.shape.params,result:VS},(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},AS,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},ot,t)}openLink(e,t){return this._assertInitialized("openLink"),this.request({method:"ui/open-link",params:e},MS,t)}sendOpenLink=this.openLink;downloadFile(e,t){return this._assertInitialized("downloadFile"),this.request({method:"ui/download-file",params:e},qS,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},BS,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 c=Math.ceil(i.getBoundingClientRect().height);i.style.height=a;let p=Math.ceil(window.innerWidth);if(p!==t||c!==o)t=p,o=c,this.sendSizeChanged({width:p,height:c})})};r();let n=new ResizeObserver(r);return n.observe(document.documentElement),n.observe(document.body),()=>n.disconnect()}async connect(e=new tm(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:$S}},YS,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}}}function rm(e){return Array.isArray(e)&&e.length>0&&e.every((t)=>t&&typeof t==="object"&&typeof t.token==="string"&&/^--[\w-]+$/.test(t.token)&&typeof t.property==="string"&&/^-?[a-z][a-z0-9-]*$/.test(t.property)&&typeof t.probe==="string"&&t.probe.trim().length>0)&&new Set(e.map((t)=>`${t.token}:${t.property}`)).size===e.length}function nm(e,t){let o=t.getComputedStyle(e),r=e.getBoundingClientRect();if(o.display==="none"||o.visibility!=="visible"||!e.getClientRects().length||!(r.width||r.height))return!1;for(let n=e;n;n=n.parentElement)if(Number(t.getComputedStyle(n).opacity)===0)return!1;return!0}function sm(e,t){if(!rm(t))return{ok:!1,diagnostics:["Token preview needs explicit { token, property, probe } samples from the project fixture. Rebuild with the current compiler."]};let o=e.ownerDocument,{defaultView:r,documentElement:n}=o,i=[],a=[],c=[...e.querySelectorAll("[data-ads-token], [data-ads-property]")],p=new Set(t.map((d)=>`${d.token}:${d.property}`));for(let d of c)if(!p.has(`${d.dataset.adsToken}:${d.dataset.adsProperty}`))i.push(`Undeclared rendered token sample ${d.dataset.adsToken}:${d.dataset.adsProperty}.`);for(let d of t){if(!r.CSS.supports(d.property,d.probe)){i.push(`${d.token}: the fixture probe is invalid for ${d.property}.`);continue}let f=r.getComputedStyle(n).getPropertyValue(d.token).trim();if(!f||!r.CSS.supports(d.property,f)){i.push(`${d.token}: its current value is invalid for the fixture's ${d.property} binding.`);continue}let S=c.filter((b)=>b.dataset.adsToken===d.token&&b.dataset.adsProperty===d.property);if(!S.length){i.push(`${d.token} needs a rendered ${d.property} sample, not only a name/value label.`);continue}let _=!1;for(let b of S){let P=[];for(let I=b.parentElement;I&&I!==e;I=I.parentElement)if(I.tagName==="DETAILS"&&!I.open)I.open=!0,P.push(I);let k=n.getAttribute("style"),E=b.getAttribute("style");try{if(!/^(?:-[a-z]+-)?transition(?:-|$)/.test(d.property))b.style.setProperty("transition","none","important");let I=r.getComputedStyle(b).getPropertyValue(d.property),D=nm(b,r);n.style.setProperty(d.token,d.probe,"important");let M=r.getComputedStyle(b).getPropertyValue(d.property);_=Boolean(M&&M!==I&&(D||nm(b,r)))}finally{if(k===null)n.removeAttribute("style");else n.setAttribute("style",k);if(E===null)b.removeAttribute("style");else b.setAttribute("style",E);for(let I of P)I.open=!1}if(_)break}if(_)a.push(d);else i.push(`${d.token} has no visible ${d.property} sample that responds to its value. Hardcoded copies do not satisfy coverage.`)}return{ok:!i.length,verified:a,diagnostics:i}}var Ee=new ua({name:"ADS preview",version:"1.0.0"},{},{autoResize:!0}),im=document.getElementById("ads-preview-seed"),cm;function am(e,t){let o=document.createElement(e);return o.textContent=t,o}function lm(e){if(typeof e==="string"&&/^[a-z][a-z0-9-]*$/.test(e))document.documentElement.dataset.theme=e}function um(e){if(typeof e==="string"&&/^[a-z][a-z0-9-]*$/.test(e))document.documentElement.dataset.brand=e}Ee.onhostcontextchanged=(e)=>{lm(e.adsTheme??e.theme),um(e.adsBrand)};if(im){let n=function(c){let p="";if(!c||c.state==="unreported")p="Preview freshness is unverified. Check the build status before reviewing.";else if(c.state==="error"){let d=c.diagnostics?.[0];if(p=`Build failed. Showing ${e.revision===null?"an earlier preview":`build ${e.revision}`}.`,d)p+=`
|
|
107
|
-
${
|
|
108
|
-
`),t.hidden=!t.textContent},e=JSON.parse(
|
|
108
|
+
- "app": Tool callable by the app from this server only`),csp:Vc().optional(),permissions:Vc().optional()}),gw=d({mimeTypes:m(a()).optional().describe('Array of supported MIME types for UI resources.\nMust include `"text/html;profile=mcp-app"` for MCP Apps support.')}),Sw=d({method:p("ui/download-file"),params:d({contents:m(R([go,So])).describe("Resource contents to download — embedded (inline data) or linked (host fetches). Uses standard MCP resource types.")})}),_w=d({method:p("ui/message"),params:d({role:p("user").describe('Message role, currently only "user" is supported.'),content:m(ct).describe("Message content blocks (text, image, etc.).")})}),bw=d({method:p("ui/notifications/sandbox-resource-ready"),params:d({html:a().describe("HTML content to load into the inner iframe."),sandbox:a().optional().describe("Optional override for the inner iframe's sandbox attribute."),csp:_l.optional().describe("CSP configuration from resource metadata."),permissions:bl.optional().describe("Sandbox permissions from resource metadata.")})}),Wb=d({method:p("ui/notifications/tool-result"),params:Lt.describe("Standard MCP tool execution result.")}),Km=d({toolInfo:d({id:Je.optional().describe("JSON-RPC id of the tools/call request."),tool:jt.describe("Tool definition including name, inputSchema, etc.")}).optional().describe("Metadata of the tool call that instantiated this App."),theme:Cb.optional().describe("Current color theme preference."),styles:Zb.optional().describe("Style configuration for theming the app."),displayMode:si.optional().describe("How the UI is currently displayed."),availableDisplayModes:m(si).optional().describe("Display modes the host supports."),containerDimensions:R([d({height:b().describe("Fixed container height in pixels.")}),d({maxHeight:R([b(),Dc()]).optional().describe("Maximum container height in pixels.")})]).and(R([d({width:b().describe("Fixed container width in pixels.")}),d({maxWidth:R([b(),Dc()]).optional().describe("Maximum container width in pixels.")})])).optional().describe(`Container dimensions. Represents the dimensions of the iframe or other
|
|
109
|
+
container holding the app. Specify either width or maxWidth, and either height or maxHeight.`),locale:a().optional().describe("User's language and region preference in BCP 47 format."),timeZone:a().optional().describe("User's timezone in IANA format."),userAgent:a().optional().describe("Host application identifier."),platform:R([p("web"),p("desktop"),p("mobile")]).optional().describe("Platform type for responsive design decisions."),deviceCapabilities:d({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:d({top:b().describe("Top safe area inset in pixels."),right:b().describe("Right safe area inset in pixels."),bottom:b().describe("Bottom safe area inset in pixels."),left:b().describe("Left safe area inset in pixels.")}).optional().describe("Mobile safe area boundaries in pixels.")}).passthrough(),Gb=d({method:p("ui/notifications/host-context-changed"),params:Km.describe("Partial context update containing only changed fields.")}),yw=d({method:p("ui/update-model-context"),params:d({content:m(ct).optional().describe("Context content blocks (text, image, etc.)."),structuredContent:z(a(),I().describe("Structured content for machine-readable context data.")).optional().describe("Structured content for machine-readable context data.")})}),zw=d({method:p("ui/initialize"),params:d({appInfo:it.describe("App identification (name and version)."),appCapabilities:Fb.describe("Features and capabilities this app provides."),protocolVersion:a().describe("Protocol version this app supports.")})}),Kb=d({protocolVersion:a().describe('Negotiated protocol version string (e.g., "2025-11-21").'),hostInfo:it.describe("Host application identification and version."),hostCapabilities:Hb.describe("Features and capabilities provided by the host."),hostContext:Km.describe("Rich context about the host environment.")}).passthrough(),Yb={target:"draft-2020-12"};async function Fm(e,t){let o=e["~standard"];if(o.jsonSchema)return o.jsonSchema[t](Yb);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 Jm(e,t,o=""){let r=await e["~standard"].validate(t);if(r.issues){let n=r.issues.map((i)=>{let s=i.path?.map((c)=>typeof c==="object"?c.key:c).join(".");return s?`${s}: ${i.message}`:i.message}).join("; ");throw Error(o+n)}return r.value}function Qb(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 Ca extends ri{_appInfo;_appCapabilities;options;_hostCapabilities;_hostInfo;_hostContext;_registeredTools={};_initializedSent=!1;_registeredEvents=new Set;_events=new Bm;_methods=new Wm;setRequestHandler=(...e)=>{let[t,...o]=Vm("request",e)??e;this._methods.claim(t,"setRequestHandler"),super.setRequestHandler.call(this,t,...o)};setNotificationHandler=(...e)=>{let[t,...o]=Vm("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:Ab,toolinputpartial:jb,toolresult:Wb,toolcancelled:Lb,hostcontextchanged:Gb};static ONE_SHOT_EVENTS=new Set(["toolinput","toolinputpartial","toolresult","toolcancelled"]);_everHadListener=new Set;_assertHandlerTiming(e){if(!Ca.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)ve({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=Qb(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,s={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(c){Object.assign(this,c),n()},remove(){if(r._registeredTools[e]!==s)return;delete r._registeredTools[e],n()},handler:async(c,l)=>{if(!s.enabled)throw Error(`Tool ${e} is disabled`);let u;if(i){let h=s.inputSchema,f=h?await Jm(h,c??{},`Invalid input for tool ${e}: `):c??{};u=await o(f,l)}else u=await o(l);if(s.outputSchema&&!u.isError)u.structuredContent=await Jm(s.outputSchema,u.structuredContent,`Invalid output for tool ${e}: `);return u}};if(this._registeredTools[e]=s,!this._appCapabilities.tools&&!this.transport)this.registerAppCapabilities({tools:{listChanged:!0}});return this.ensureToolHandlersInitialized(),n(),s}_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:Db.shape.params,result:Vb},(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},qb,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},qt,t)}openLink(e,t){return this._assertInitialized("openLink"),this.request({method:"ui/open-link",params:e},Nb,t)}sendOpenLink=this.openLink;downloadFile(e,t){return this._assertInitialized("downloadFile"),this.request({method:"ui/download-file",params:e},Mb,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},Jb,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,s=i.style.height;i.style.height="max-content";let c=Math.ceil(i.getBoundingClientRect().height);i.style.height=s;let l=Math.ceil(window.innerWidth);if(l!==t||c!==o)t=l,o=c,this.sendSizeChanged({width:l,height:c})})};r();let n=new ResizeObserver(r);return n.observe(document.documentElement),n.observe(document.body),()=>n.disconnect()}async connect(e=new Gm(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:kb}},Kb,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}}}function Ym(e){return Array.isArray(e)&&e.length>0&&e.every((t)=>t&&typeof t==="object"&&typeof t.token==="string"&&/^--[\w-]+$/.test(t.token)&&typeof t.property==="string"&&/^-?[a-z][a-z0-9-]*$/.test(t.property)&&typeof t.probe==="string"&&t.probe.trim().length>0)&&new Set(e.map((t)=>`${t.token}:${t.property}`)).size===e.length}function Qm(e,t){let o=t.getComputedStyle(e),r=e.getBoundingClientRect();if(o.display==="none"||o.visibility!=="visible"||!e.getClientRects().length||!(r.width||r.height))return!1;for(let n=e;n;n=n.parentElement)if(Number(t.getComputedStyle(n).opacity)===0)return!1;return!0}function Xm(e,t){if(!Ym(t))return{ok:!1,diagnostics:["Token preview needs explicit { token, property, probe } samples from the project fixture. Rebuild with the current compiler."]};let o=e.ownerDocument,{defaultView:r,documentElement:n}=o,i=[],s=[],c=[...e.querySelectorAll("[data-ads-token], [data-ads-property]")],l=new Set(t.map((u)=>`${u.token}:${u.property}`));for(let u of c)if(!l.has(`${u.dataset.adsToken}:${u.dataset.adsProperty}`))i.push(`Undeclared rendered token sample ${u.dataset.adsToken}:${u.dataset.adsProperty}.`);for(let u of t){if(!r.CSS.supports(u.property,u.probe)){i.push(`${u.token}: the fixture probe is invalid for ${u.property}.`);continue}let h=r.getComputedStyle(n).getPropertyValue(u.token).trim();if(!h||!r.CSS.supports(u.property,h)){i.push(`${u.token}: its current value is invalid for the fixture's ${u.property} binding.`);continue}let f=c.filter((_)=>_.dataset.adsToken===u.token&&_.dataset.adsProperty===u.property);if(!f.length){i.push(`${u.token} needs a rendered ${u.property} sample, not only a name/value label.`);continue}let S=!1;for(let _ of f){let y=[];for(let V=_.parentElement;V&&V!==e;V=V.parentElement)if(V.tagName==="DETAILS"&&!V.open)V.open=!0,y.push(V);let w=n.getAttribute("style"),k=_.getAttribute("style");try{if(!/^(?:-[a-z]+-)?transition(?:-|$)/.test(u.property))_.style.setProperty("transition","none","important");let V=r.getComputedStyle(_).getPropertyValue(u.property),B=Qm(_,r);n.style.setProperty(u.token,u.probe,"important");let q=r.getComputedStyle(_).getPropertyValue(u.property);S=Boolean(q&&q!==V&&(B||Qm(_,r)))}finally{if(w===null)n.removeAttribute("style");else n.setAttribute("style",w);if(k===null)_.removeAttribute("style");else _.setAttribute("style",k);for(let V of y)V.open=!1}if(S)break}if(S)s.push(u);else i.push(`${u.token} has no visible ${u.property} sample that responds to its value. Hardcoded copies do not satisfy coverage.`)}return{ok:!i.length,verified:s,diagnostics:i}}var ut=new Ca({name:"ADS preview",version:"1.0.0"},{},{autoResize:!0}),ef=document.getElementById("ads-preview-seed"),of;function tf(e,t){let o=document.createElement(e);return o.textContent=t,o}function rf(e){if(typeof e==="string"&&/^[a-z][a-z0-9-]*$/.test(e))document.documentElement.dataset.theme=e}function nf(e){if(typeof e==="string"&&/^[a-z][a-z0-9-]*$/.test(e))document.documentElement.dataset.brand=e}ut.onhostcontextchanged=(e)=>{rf(e.adsTheme??e.theme),nf(e.adsBrand)};if(ef){let n=function(c){let l="";if(!c||c.state==="unreported")l="Preview freshness is unverified. Check the build status before reviewing.";else if(c.state==="error"){let u=c.diagnostics?.[0];if(l=`Build failed. Showing ${e.revision===null?"an earlier preview":`build ${e.revision}`}.`,u)l+=`
|
|
110
|
+
${u.file??""}${u.line?`:${u.line}`:""}${u.file?": ":""}${u.message}`}else if(["building","idle"].includes(c.state))l="Rebuilding. This view is the previous preview.";else if(c.revision!==e.revision||c.session!==e.session)l=`Build ${c.revision} is ready. Reopen this preview to load it.`;t.textContent=[l,r].filter(Boolean).join(`
|
|
111
|
+
`),t.hidden=!t.textContent},e=JSON.parse(ef.textContent),t=tf("aside","");t.id="ads-preview-build",t.setAttribute("role","status"),t.setAttribute("aria-live","polite");let o=tf("style","#ads-preview-build{position:fixed;inset:12px 12px auto;z-index:2147483647;padding:10px 14px;border:1px solid GrayText;border-radius:6px;background:Canvas;color:CanvasText;font:13px system-ui;white-space:pre-wrap;overflow-wrap:anywhere;max-height:30vh;overflow:auto}#ads-preview-build[hidden]{display:none}");document.head.append(o),document.body.append(t);let r="";if(n(e),e.kind==="tokens")(async()=>{await new Promise((l)=>requestAnimationFrame(()=>requestAnimationFrame(l))),await document.fonts.ready;let c=Xm(document.body,e.samples);if(!c.ok){r=`Token preview verification failed:
|
|
109
112
|
${c.diagnostics.slice(0,20).join(`
|
|
110
|
-
`)}`,t.setAttribute("role","alert"),n(e);try{if(
|
|
111
|
-
`),t.hidden=!1}finally{i=!1}}c(),
|
|
113
|
+
`)}`,t.setAttribute("role","alert"),n(e);try{if(ut.getHostCapabilities()?.logging)await ut.sendLog({level:"error",logger:"ads-preview",data:{state:"error",id:e.id,message:r}})}catch{}}})();let i=!1,s;ut.onteardown=async()=>(clearInterval(s),{}),window.addEventListener("pagehide",()=>clearInterval(s),{once:!0}),of=()=>{if(!ut.getHostCapabilities()?.serverResources)return;async function c(){if(i||document.visibilityState==="hidden")return;i=!0;try{let l=await ut.readServerResource({uri:"ads://project/build"},{timeout:5000}),u=JSON.parse(l.contents.find((h)=>("text"in h)).text);n(u.previews.find((h)=>h.id===e.id))}catch{t.textContent=["Build status unavailable. Reopen the preview to verify it.",r].filter(Boolean).join(`
|
|
114
|
+
`),t.hidden=!1}finally{i=!1}}c(),s=setInterval(()=>{c()},2000)}}try{await ut.connect(),of?.(),rf(ut.getHostContext()?.adsTheme??ut.getHostContext()?.theme),nf(ut.getHostContext()?.adsBrand)}catch{}
|