@usex/mikrotik-mcp 5.7.0 → 5.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -6,14 +6,20 @@
6
6
  <meta name="color-scheme" content="light dark" />
7
7
  <title>MikroTik Interfaces</title>
8
8
  <script type="module">
9
- var e=Object.defineProperty,t=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),n=(t,n)=>{let r={};for(var i in t)e(r,i,{get:t[i],enumerable:!0});return n&&e(r,Symbol.toStringTag,{value:`Module`}),r},r=new Set([`https://json-schema.org/draft/2019-09/schema`,`http://json-schema.org/draft/2019-09/schema`]);function i(e){return typeof e==`string`&&r.has(e.replace(/#$/,``))}function a(e){let t=Object.values(e).filter(e=>typeof e==`number`);return Object.entries(e).filter(([e,n])=>t.indexOf(+e)===-1).map(([e,t])=>t)}function o(e,t=`|`){return e.map(e=>le(e)).join(t)}function s(e,t){return typeof t==`bigint`?t.toString():t}function c(e){return{get value(){{let t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function l(e){return e==null}function u(e){let t=+!!e.startsWith(`^`),n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}function d(e,t){let n=e/t,r=Math.round(n),i=4*2**-52*Math.max(Math.abs(n),1);return Math.abs(n-r)<i?0:n-r}var f=Symbol(`evaluating`);function p(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==f)return r===void 0&&(r=f,r=n()),r},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function m(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function h(...e){let t={};for(let n of e){let e=Object.getOwnPropertyDescriptors(n);Object.assign(t,e)}return Object.defineProperties({},t)}function ee(e){return JSON.stringify(e)}function te(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,``).replace(/[\s_-]+/g,`-`).replace(/^-+|-+$/g,``)}var ne=`captureStackTrace`in Error?Error.captureStackTrace:(...e)=>{};function g(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var re=c(()=>{if(x.jitless||typeof navigator<`u`&&navigator?.userAgent?.includes(`Cloudflare`))return!1;try{return Function(``),!0}catch{return!1}});function ie(e){if(g(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!=`function`)return!0;let n=t.prototype;return g(n)!==!1&&Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)!==!1}function ae(e){return ie(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}var oe=new Set([`string`,`number`,`symbol`]);function se(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function ce(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function _(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}return delete t.message,typeof t.error==`string`?{...t,error:()=>t.error}:t}function le(e){return typeof e==`bigint`?e.toString()+`n`:typeof e==`string`?`"${e}"`:`${e}`}function ue(e){return Object.keys(e).filter(t=>e[t]._zod.optin!==void 0&&e[t]._zod.optout===`optional`)}var de={safeint:[-(2**53-1),2**53-1],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function fe(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.pick() cannot be used on object schemas containing refinements`);return ce(e,h(e._zod.def,{get shape(){let e={};for(let r of Reflect.ownKeys(t)){if(!Object.prototype.hasOwnProperty.call(n.shape,r))throw Error(`Unrecognized key: "${String(r)}"`);t[r]&&m(e,r,n.shape[r])}return m(this,`shape`,e),e},checks:[]}))}function pe(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.omit() cannot be used on object schemas containing refinements`);return ce(e,h(e._zod.def,{get shape(){let r={...e._zod.def.shape};for(let e of Reflect.ownKeys(t)){if(!Object.prototype.hasOwnProperty.call(n.shape,e))throw Error(`Unrecognized key: "${String(e)}"`);t[e]&&delete r[e]}return m(this,`shape`,r),r},checks:[]}))}function me(e,t){if(!ie(t))throw Error(`Invalid input to extend: expected a plain object`);let n=e._zod.def.checks;if(n&&n.length>0){let n=e._zod.def.shape;for(let e of Reflect.ownKeys(t))if(Object.getOwnPropertyDescriptor(n,e)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return ce(e,h(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return m(this,`shape`,n),n}}))}function he(e,t){if(!ie(t))throw Error(`Invalid input to safeExtend: expected a plain object`);return ce(e,h(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return m(this,`shape`,n),n}}))}function ge(e,t){if(!t?._zod?.def)throw Error("Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.");if(e._zod.def.checks?.length)throw Error(`.merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.`);return ce(e,h(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t._zod.def.shape};return m(this,`shape`,n),n},get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]}))}function _e(e,t,n,r=`partial`){let i=t._zod.def.checks;if(i&&i.length>0)throw Error(`.${r}() cannot be used on object schemas containing refinements`);return ce(t,h(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let t of Reflect.ownKeys(n)){if(!Object.prototype.hasOwnProperty.call(r,t))throw Error(`Unrecognized key: "${String(t)}"`);n[t]&&(i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t])}else for(let t of Reflect.ownKeys(r))i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t];return m(this,`shape`,i),i},checks:[]}))}function ve(e,t,n){return ce(t,h(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let t of Reflect.ownKeys(n)){if(!Object.prototype.hasOwnProperty.call(i,t))throw Error(`Unrecognized key: "${String(t)}"`);n[t]&&(i[t]=new e({type:`nonoptional`,innerType:r[t]}))}else for(let t of Reflect.ownKeys(r))i[t]=new e({type:`nonoptional`,innerType:r[t]});return m(this,`shape`,i),i}}))}function ye(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function be(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue===!1)return!0;return!1}function xe(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function Se(e){return typeof e==`string`?e:e?.message}function Ce(e,t,n){var r;for(let i=t;i<e.length;i++)(r=e[i]).schema??(r.schema=n)}function v(e,t,n){var r;let i=e.inst?._zod?.traits;i?.has(`$ZodType`)&&(i.has(`$ZodCheck`)?(r=e).schema??(r.schema=e.inst):e.schema=e.inst);let a=e.schema===e.inst?void 0:e.schema?._zod.def?.error,o=e.message?e.message:Se(e.inst?._zod.def?.error?.(e))??Se(a?.(e))??Se(t?.error?.(e))??Se(n.customError?.(e))??Se(n.localeError?.(e))??`Invalid input`,{inst:s,schema:c,continue:l,input:u,...d}=e;return d.path??=[],d.message=o,t?.reportInput&&(d.input=u),d}var we=/[\uD800-\uDBFF]/;function Te(e){let t=e.length;if(!we.test(e))return t;let n=t;for(let r=0;r<t-1;r++)(e.charCodeAt(r)&64512)==55296&&(e.charCodeAt(r+1)&64512)==56320&&(n--,r++);return n}function Ee(e){return Array.isArray(e)?`array`:typeof e==`string`?`string`:`unknown`}function De(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 t=e;if(t&&Object.getPrototypeOf(t)!==Object.prototype&&`constructor`in t&&t.constructor)return t.constructor.name}}return t}function Oe(...e){let[t,n,r]=e;return typeof t==`string`?{message:t,code:`custom`,input:n,inst:r}:{...t}}function ke(e,t){for(let n in t){let r=Object.getOwnPropertyDescriptor(t,n);r.get?Object.defineProperty(e,n,{...r,enumerable:!1}):Me(e,n,r.value)}}function Ae(e,t,n,r=!0){return Object.defineProperty(e,t,{configurable:!0,writable:!0,enumerable:r,value:n}),n}function je(e,t,n){return Ae(e,t,n,!1)}function Me(e,t,n){Object.defineProperty(e,t,{configurable:!0,get(){return this==null?n:Ae(this,t,n.bind(this))},set(e){Ae(this,t,e)}})}function Ne(e,t){let n=Object.getPrototypeOf(e);return t in n?void 0:n}var Pe,Fe=!1,Ie={configurable:!0,get(){Fe=!0}};function y(e,t,n){let r=Object.getPrototypeOf(e._zod);if(t in r&&Pe!==e._zod){Pe=void 0;return}Pe=e._zod,Object.defineProperty(r,t,{configurable:!0,get(){Object.defineProperty(this,t,Ie);let e=Fe;Fe=!1;try{let r=n(this);return Fe?delete this[t]:Object.defineProperty(this,t,{configurable:!0,writable:!0,value:r}),Fe||=e,r}catch(n){throw delete this[t],Fe||=e,n}},set(e){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:e})}})}function Le(e,t,n,r){let i=Ne(e,t);i&&Object.defineProperty(i,t,{configurable:!0,get(){let e={configurable:!0,writable:!0,enumerable:r,value:void 0};return Object.defineProperty(this,t,e),e.value=n(this),Object.defineProperty(this,t,e),e.value},set(e){Object.defineProperty(this,t,{configurable:!0,writable:!0,enumerable:r,value:e})}})}var Re=`~constantCatch`;function ze(e){let t=()=>e;return t[Re]=!0,t}var Be,Ve=Object.freeze({status:`aborted`}),He={value:void 0,enumerable:!1},Ue=`captureStackTrace`in Error?Error:null;function We(e){let t=Ue;if(t){let n=t.stackTraceLimit;if(typeof n==`number`){try{t.stackTraceLimit=0}catch{return Ue=null,new e}try{return new e}finally{t.stackTraceLimit=n}}}return new e}function b(e,t,n,r){let i={};function a(e){this.def=e,this.constr=d,this.traits=new Set}a.prototype=i;let o=n,s=o&&new WeakSet;function c(n,r){if(!n._zod){He.value=new a(r);try{Object.defineProperty(n,"_zod",He)}finally{He.value=void 0}}if(n._zod.traits.has(e))return;if(n._zod.traits.add(e),t(n,r),s){let e=Object.getPrototypeOf(n),t=n._zod.constr.prototype,r=e;for(;r&&r!==t;)r=Object.getPrototypeOf(r);let i=r??e;s.has(i)||(s.add(i),ke(i,o))}let i=d.prototype;for(let e in i)Object.prototype.hasOwnProperty.call(i,e)&&(e in n||(n[e]=i[e].bind(n)))}let l=r?.Parent??Object;class u extends l{}Object.defineProperty(u,"name",{value:e});function d(e){let t=r?.Parent?We(u):this;c(t,e);let n=t._zod.deferred;if(n){for(let e of n)e();t._zod.deferred=void 0}let i=globalThis.__zod_globalConfig?.postProcessor;return i&&i(t),t}return Object.defineProperty(d,"init",{value:c}),Object.defineProperty(d,Symbol.hasInstance,{value:t=>r?.Parent&&t instanceof r.Parent?!0:t?._zod?.traits?.has(e)}),Object.defineProperty(d,"name",{value:e}),d}var Ge=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}},Ke=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name=`ZodEncodeError`}};(Be=globalThis).__zod_globalConfig??(Be.__zod_globalConfig={});var x=globalThis.__zod_globalConfig;function S(e){return e&&Object.assign(x,e),x}function qe(){let e=this._zod;return e.message??=JSON.stringify(e.def,s,2),e.message}function Je(e){this._zod.message=e}var Ye={get:qe,set:Je,enumerable:!0,configurable:!0},Xe={value:void 0,enumerable:!1},Ze={value:void 0,enumerable:!1},Qe=new WeakSet([Object.prototype,Error.prototype]),$e=(e,t)=>{e.name=`$ZodError`,Xe.value=e._zod,Object.defineProperty(e,"_zod",Xe),Ze.value=t,Object.defineProperty(e,"issues",Ze),Xe.value=void 0,Ze.value=void 0,Object.defineProperty(e,"message",Ye);let n=Object.getPrototypeOf(e);Qe.has(n)||(Qe.add(n),Object.defineProperty(n,"toString",{configurable:!0,enumerable:!1,get(){let e=()=>this.message;return Object.defineProperty(this,"toString",{value:e,configurable:!0,writable:!0}),e},set(e){Object.defineProperty(this,"toString",{value:e,configurable:!0,writable:!0})}}))},et=b(`$ZodError`,$e),tt=b(`$ZodError`,$e,void 0,{Parent:Error});function nt(e,t,n){return Object.prototype.hasOwnProperty.call(e,t)||(t===`__proto__`?Object.defineProperty(e,t,{value:n(),writable:!0,enumerable:!0,configurable:!0}):e[t]=n()),e[t]}function rt(e,t=e=>e.message){let n={},r=[];for(let i of e.issues)i.path.length>0?nt(n,i.path[0],()=>[]).push(t(i)):r.push(t(i));return{formErrors:r,fieldErrors:n}}function it(e,t=e=>e.message){let n={_errors:[]},r=(e,i=[])=>{for(let a of e.issues)if(a.code===`invalid_union`&&a.errors.length)a.errors.map(e=>r({issues:e},[...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 e=[...i,...a.path];if(e.length===0)n._errors.push(t(a));else{let r=n,i=0;for(;i<e.length;){let n=e[i],o=i===e.length-1;if(n===`_errors`){o&&r._errors.push(t(a)),i++;continue}Object.prototype.hasOwnProperty.call(r,n)||Object.defineProperty(r,n,{value:{_errors:[]},enumerable:!0,writable:!0,configurable:!0});let s=r[n];o&&s._errors.push(t(a)),r=s,i++}}}};return r(e),n}function C(e,t){return{callee:t?.callee??e,Err:t?.Err}}var at=e=>{let t=(n,r,i,a)=>{let o=i?{...i,async:!1}:{async:!1},s=n._zod.run({value:r,issues:[]},o);if(s instanceof Promise)throw new Ge;if(s.issues.length){let n=new((a?.Err)??e)(s.issues.map(e=>v(e,o,S())));throw ne(n,a?.callee??t),n}return s.value};return t},ot=e=>{let t=async(n,r,i,a)=>{let o=i?{...i,async:!0}:{async:!0},s=n._zod.run({value:r,issues:[]},o);if(s instanceof Promise&&(s=await s),s.issues.length){let n=new((a?.Err)??e)(s.issues.map(e=>v(e,o,S())));throw ne(n,a?.callee??t),n}return s.value};return t},st=e=>(t,n,r)=>{let i=r?{...r,async:!1}:{async:!1},a=t._zod.run({value:n,issues:[]},i);if(a instanceof Promise)throw new Ge;return a.issues.length?{success:!1,error:new(e??et)(a.issues.map(e=>v(e,i,S())))}:{success:!0,data:a.value}},ct=st(tt),lt=e=>async(t,n,r)=>{let i=r?{...r,async:!0}:{async:!0},a=t._zod.run({value:n,issues:[]},i);return a instanceof Promise&&(a=await a),a.issues.length?{success:!1,error:new e(a.issues.map(e=>v(e,i,S())))}:{success:!0,data:a.value}},ut=lt(tt),dt=e=>{let t=at(e),n=(e,r,i,a)=>{let o=i?{...i,direction:`backward`}:{direction:`backward`};return t(e,r,o,C(n,a))};return n},ft=e=>{let t=at(e),n=(e,r,i,a)=>t(e,r,i,C(n,a));return n},pt=e=>{let t=ot(e),n=async(e,r,i,a)=>{let o=i?{...i,direction:`backward`}:{direction:`backward`};return await t(e,r,o,C(n,a))};return n},mt=e=>{let t=ot(e),n=async(e,r,i,a)=>await t(e,r,i,C(n,a));return n},ht=e=>(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return st(e)(t,n,i)},gt=e=>(t,n,r)=>st(e)(t,n,r),_t=e=>async(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return lt(e)(t,n,i)},vt=e=>async(t,n,r)=>lt(e)(t,n,r),yt=/^[cC][0-9a-z]{6,}$/,bt=/^[0-9a-z]+$/,xt=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/,St=/^[0-9a-vA-V]{20}$/,Ct=/^[A-Za-z0-9]{27}$/,wt=/^[a-zA-Z0-9_-]{21}$/;function Tt(e){return RegExp(`^[a-zA-Z0-9_-]{${e}}$`)}var Et=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Dt=/^([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})$/,Ot=e=>e?RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,kt=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,At=`^[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$`;function jt(){return new RegExp(At,`u`)}var Mt=/^(?:(?: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])$/,Nt=/^(([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}|:))$/,Pt=/^((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])$/,Ft=/^(([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}|:))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,It=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Lt=/^[A-Za-z0-9_-]*$/,Rt=/^https?$/,zt=/^\+[1-9]\d{6,14}$/,Bt=`(?:(?:\\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])))`;function Vt(e){return RegExp(`^${e}$`)}var Ht=Vt(Bt);function Ut(e){let t=`(?:[01]\\d|2[0-3]):[0-5]\\d`;return typeof e.precision==`number`?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:e.seconds?`${t}:[0-5]\\d(?:\\.\\d+)?`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function Wt(e){return RegExp(`^${Ut(e)}$`)}function Gt(e){let t=[`Z`];e.offset&&t.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);let n=`${Ut({precision:e.precision,seconds:!0})}(?:${t.join(`|`)})`,r=e.local?`${n}|${Ut({precision:e.precision})}`:n;return RegExp(`^${Bt}T(?:${r})$`)}var Kt=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??``}}`:`[\\s\\S]*`;return RegExp(`^${t}$`)},qt=/^-?\d+$/,Jt=/^-?\d+(?:\.\d+)?$/,Yt=/^(?:true|false)$/i,Xt=/^null$/i,Zt=/^undefined$/i,Qt=/^[^A-Z]*$/,$t=/^[^a-z]*$/,w=b(`$ZodCheck`,(e,t)=>{var n;e._zod??={},e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),en=e=>{let t=e.value;return!l(t)&&t.length!==void 0},tn={number:`number`,bigint:`bigint`,object:`date`},nn=b(`$ZodCheckLessThan`,(e,t)=>{w.init(e,t);let n=tn[typeof t.value];e._zod.onattach.push(e=>{let n=e._zod.bag,r=(t.inclusive?n.maximum:n.exclusiveMaximum)??1/0;t.value<r&&(t.inclusive?n.maximum=t.value:n.exclusiveMaximum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:tn[typeof r.value]??n,code:`too_big`,maximum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),rn=b(`$ZodCheckGreaterThan`,(e,t)=>{w.init(e,t);let n=tn[typeof t.value];e._zod.onattach.push(e=>{let n=e._zod.bag,r=(t.inclusive?n.minimum:n.exclusiveMinimum)??-1/0;t.value>r&&(t.inclusive?n.minimum=t.value:n.exclusiveMinimum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:tn[typeof r.value]??n,code:`too_small`,minimum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),an=b(`$ZodCheckMultipleOf`,(e,t)=>{w.init(e,t),e._zod.onattach.push(e=>{var n;(n=e._zod.bag).multipleOf??(n.multipleOf=t.value)}),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw Error(`Cannot mix number and bigint in multiple_of check.`);(typeof n.value==`bigint`?t.value!==BigInt(0)&&n.value%t.value===BigInt(0):d(n.value,t.value)===0)||n.issues.push({origin:typeof n.value,code:`not_multiple_of`,divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),on=b(`$ZodCheckNumberFormat`,(e,t)=>{w.init(e,t),t.format=t.format||`float64`;let n=t.format?.includes(`int`),r=n?`int`:`number`,[i,a]=de[t.format];e._zod.onattach.push(e=>{let r=e._zod.bag;r.format=t.format,r.minimum=i,r.maximum=a,n&&(r.pattern=qt)}),e._zod.check=o=>{let s=o.value;if(n){if(!Number.isInteger(s)){o.issues.push({expected:r,format:t.format,code:`invalid_type`,continue:!1,input:s,inst:e});return}if(!Number.isSafeInteger(s)){s>0?o.issues.push({input:s,code:`too_big`,maximum:2**53-1,note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort}):o.issues.push({input:s,code:`too_small`,minimum:-(2**53-1),note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort});return}}s<i&&o.issues.push({origin:`number`,input:s,code:`too_small`,minimum:i,inclusive:!0,inst:e,continue:!t.abort}),s>a&&o.issues.push({origin:`number`,input:s,code:`too_big`,maximum:a,inclusive:!0,inst:e,continue:!t.abort})}}),sn=b(`$ZodCheckMaxLength`,(e,t)=>{var n;w.init(e,t),(n=e._zod.def).when??(n.when=en),e._zod.onattach.push(e=>{let n=e._zod.bag.maximum??1/0;t.maximum<n&&(e._zod.bag.maximum=t.maximum)}),e._zod.check=n=>{let r=n.value,i=r.length;if((typeof r==`string`&&i>t.maximum?Te(r):i)<=t.maximum)return;let a=Ee(r);n.issues.push({origin:a,code:`too_big`,maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),cn=b(`$ZodCheckMinLength`,(e,t)=>{var n;w.init(e,t),(n=e._zod.def).when??(n.when=en),e._zod.onattach.push(e=>{let n=e._zod.bag.minimum??-1/0;t.minimum>n&&(e._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{let r=n.value,i=r.length;if((typeof r==`string`&&i>=t.minimum&&i<t.minimum*2?Te(r):i)>=t.minimum)return;let a=Ee(r);n.issues.push({origin:a,code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),ln=b(`$ZodCheckLengthEquals`,(e,t)=>{var n;w.init(e,t),(n=e._zod.def).when??(n.when=en),e._zod.onattach.push(e=>{let n=e._zod.bag;n.minimum=t.length,n.maximum=t.length,n.length=t.length}),e._zod.check=n=>{let r=n.value,i=r.length,a=typeof r==`string`&&i>=t.length&&i<=t.length*2?Te(r):i;if(a===t.length)return;let o=Ee(r),s=a>t.length;n.issues.push({origin:o,...s?{code:`too_big`,maximum:t.length}:{code:`too_small`,minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),un=b(`$ZodCheckStringFormat`,(e,t)=>{var n,r;w.init(e,t),e._zod.onattach.push(e=>{let n=e._zod.bag;n.format=t.format,t.pattern&&(n.patterns??=new Set,n.patterns.add(t.pattern))}),t.pattern?(n=e._zod).check??(n.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&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})}):(r=e._zod).check??(r.check=()=>{})}),dn=b(`$ZodCheckRegex`,(e,t)=>{un.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:`regex`,input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),fn=b(`$ZodCheckLowerCase`,(e,t)=>{t.pattern??=Qt,un.init(e,t)}),pn=b(`$ZodCheckUpperCase`,(e,t)=>{t.pattern??=$t,un.init(e,t)}),mn=b(`$ZodCheckIncludes`,(e,t)=>{w.init(e,t);let n=se(t.includes),r=new RegExp(typeof t.position==`number`?`^.{${t.position},}${n}`:n);t.pattern=r,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(r)}),e._zod.check=n=>{n.value.includes(t.includes,t.position)||n.issues.push({origin:`string`,code:`invalid_format`,format:`includes`,includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),hn=b(`$ZodCheckStartsWith`,(e,t)=>{w.init(e,t);let n=RegExp(`^${se(t.prefix)}.*`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(n)}),e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`starts_with`,prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),gn=b(`$ZodCheckEndsWith`,(e,t)=>{w.init(e,t);let n=RegExp(`.*${se(t.suffix)}$`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(n)}),e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`ends_with`,suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}}),_n=b(`$ZodCheckOverwrite`,(e,t)=>{w.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}}),vn=class{constructor(e=[],t={}){this.content=[],this.indent=0,this.args=e,this.closed=t}indented(e){this.indent+=1,e(this),--this.indent}write(e){if(typeof e==`function`){e(this,{execution:`sync`}),e(this,{execution:`async`});return}let t=e.split(`
9
+ var e=Object.defineProperty,t=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),n=(t,n)=>{let r={};for(var i in t)e(r,i,{get:t[i],enumerable:!0});return n&&e(r,Symbol.toStringTag,{value:`Module`}),r},r=new Set([`https://json-schema.org/draft/2019-09/schema`,`http://json-schema.org/draft/2019-09/schema`]);function i(e){return typeof e==`string`&&r.has(e.replace(/#$/,``))}function a(e){let t=Object.values(e).filter(e=>typeof e==`number`);return Object.entries(e).filter(([e,n])=>t.indexOf(+e)===-1).map(([e,t])=>t)}function o(e,t=`|`){return e.map(e=>me(e)).join(t)}function s(e,t){return typeof t==`bigint`?t.toString():t}var c=class{constructor(e){this._getter=e,this._value=void 0}get value(){let e=this._getter;return e!==void 0&&(this._value=e(),this._getter=void 0),this._value}};function l(e){return new c(e)}function u(e){return e==null}function d(e){let t=+!!e.startsWith(`^`),n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}function f(e,t){let n=e/t,r=Math.round(n),i=4*2**-52*Math.max(Math.abs(n),1);return Math.abs(n-r)<i?0:n-r}var p=Symbol(`evaluating`);function m(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==p)return r===void 0&&(r=p,r=n()),r},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function h(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function ee(e){let t=Object.getOwnPropertyDescriptor(e,`shape`);return t?.get?t.get.raw:t?.value}function g(e){return ee(e._zod.def)??e._zod.def.shape}function te(e,t,n){Object.defineProperty(e,t,{get(){let e=n();return h(this,t,e),e},enumerable:!0,configurable:!0})}function ne(e,t,n){t in e?h(e,t,n):e[t]=n}function re(e,t,n,r){let i=g(t);for(let a of n){let n=Object.getOwnPropertyDescriptor(i,a);n.enumerable&&(n.get?te(e,a,()=>{let e=t._zod.def.shape[a];return r?r(e,a):e}):ne(e,a,r?r(n.value,a):n.value))}}function ie(e,t){for(let n of Reflect.ownKeys(t)){let r=Object.getOwnPropertyDescriptor(t,n);r.enumerable&&(r.get?te(e,n,()=>t[n]):ne(e,n,r.value))}}function _(...e){let t={};for(let n of e){let e=Object.getOwnPropertyDescriptors(n);Object.assign(t,e)}return Object.defineProperties({},t)}function ae(e){return JSON.stringify(e)}function oe(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,``).replace(/[\s_-]+/g,`-`).replace(/^-+|-+$/g,``)}var se=`captureStackTrace`in Error?Error.captureStackTrace:(...e)=>{};function ce(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var le=l(()=>{if(C.jitless||typeof navigator<`u`&&navigator?.userAgent?.includes(`Cloudflare`))return!1;try{return Function(``),!0}catch{return!1}});function ue(e){if(ce(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!=`function`)return!0;let n=t.prototype;return ce(n)!==!1&&Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)!==!1}function de(e){return ue(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}var fe=new Set([`string`,`number`,`symbol`]);function pe(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function v(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function y(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}return delete t.message,typeof t.error==`string`?{...t,error:()=>t.error}:t}function me(e){return typeof e==`bigint`?e.toString()+`n`:typeof e==`string`?`"${e}"`:`${e}`}function he(e){return Object.keys(e).filter(t=>e[t]._zod.optin!==void 0&&e[t]._zod.optout===`optional`)}var ge={safeint:[-(2**53-1),2**53-1],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},_e={int64:[BigInt(`-9223372036854775808`),BigInt(`9223372036854775807`)],uint64:[BigInt(0),BigInt(`18446744073709551615`)]};function ve(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.pick() cannot be used on object schemas containing refinements`);let i={};return re(i,e,ye(e,t)),v(e,_(n,{shape:i,checks:[]}))}function ye(e,t){let n=g(e),r=[];for(let e of Reflect.ownKeys(t)){if(!Object.getOwnPropertyDescriptor(n,e)?.enumerable)throw Error(`Unrecognized key: "${String(e)}"`);t[e]&&r.push(e)}return r}function be(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.omit() cannot be used on object schemas containing refinements`);let i=new Set(ye(e,t)),a={};return re(a,e,Reflect.ownKeys(g(e)).filter(e=>!i.has(e))),v(e,_(n,{shape:a,checks:[]}))}function xe(e,t){if(!ue(t))throw Error(`Invalid input to extend: expected a plain object`);let n=e._zod.def.checks;if(n&&n.length>0){let n=g(e);for(let e of Reflect.ownKeys(t))if(Object.getOwnPropertyDescriptor(n,e)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return v(e,_(e._zod.def,{shape:Se(e,t)}))}function Se(e,t){let n={};return re(n,e,Reflect.ownKeys(g(e))),ie(n,t),n}function Ce(e,t){if(!ue(t))throw Error(`Invalid input to safeExtend: expected a plain object`);return v(e,_(e._zod.def,{shape:Se(e,t)}))}function we(e,t){if(!t?._zod?.def)throw Error("Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.");if(e._zod.def.checks?.length)throw Error(`.merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.`);let n={};return re(n,e,Reflect.ownKeys(g(e))),re(n,t,Reflect.ownKeys(g(t))),v(e,_(e._zod.def,{shape:n,get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]}))}function Te(e,t,n,r=`partial`){let i=t._zod.def.checks;if(i&&i.length>0)throw Error(`.${r}() cannot be used on object schemas containing refinements`);let a=n?new Set(ye(t,n)):void 0,o={};return re(o,t,Reflect.ownKeys(g(t)),e&&((t,n)=>a&&!a.has(n)?t:new e({type:`optional`,innerType:t}))),v(t,_(t._zod.def,{shape:o,checks:[]}))}function Ee(e,t,n){let r=n?new Set(ye(t,n)):void 0,i={};return re(i,t,Reflect.ownKeys(g(t)),(t,n)=>r&&!r.has(n)?t:new e({type:`nonoptional`,innerType:t})),v(t,_(t._zod.def,{shape:i}))}function b(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function De(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue===!1)return!0;return!1}function Oe(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function ke(e){return typeof e==`string`?e:e?.message}function Ae(e,t,n){var r;for(let i=t;i<e.length;i++)(r=e[i]).schema??(r.schema=n)}function je(e,t,n){var r;let i=e.inst?._zod?.traits;i?.has(`$ZodType`)&&(i.has(`$ZodCheck`)?(r=e).schema??(r.schema=e.inst):e.schema=e.inst);let a=e.schema===e.inst?void 0:e.schema?._zod.def?.error,o=e.message?e.message:ke(e.inst?._zod.def?.error?.(e))??ke(a?.(e))??ke(t?.error?.(e))??ke(n.customError?.(e))??ke(n.localeError?.(e))??`Invalid input`,s={};for(let t of Object.keys(e))t!==`inst`&&t!==`schema`&&t!==`continue`&&t!==`input`&&t!==`__proto__`&&(s[t]=e[t]);return s.path??=[],s.message=o,t?.reportInput&&(s.input=e.input),s}var Me=/[\uD800-\uDBFF]/;function Ne(e){let t=e.length;if(!Me.test(e))return t;let n=t;for(let r=0;r<t-1;r++)(e.charCodeAt(r)&64512)==55296&&(e.charCodeAt(r+1)&64512)==56320&&(n--,r++);return n}function Pe(e){return Array.isArray(e)?`array`:typeof e==`string`?`string`:`unknown`}function Fe(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 t=e;if(t&&Object.getPrototypeOf(t)!==Object.prototype&&`constructor`in t&&t.constructor)return t.constructor.name}}return t}function Ie(...e){let[t,n,r]=e;return typeof t==`string`?{message:t,code:`custom`,input:n,inst:r}:{...t}}function Le(e,t){for(let n in t){let r=Object.getOwnPropertyDescriptor(t,n);r.get?Object.defineProperty(e,n,{...r,enumerable:!1}):Ve(e,n,r.value)}}function Re(e,t,n,r=!0){return Object.defineProperty(e,t,{configurable:!0,writable:!0,enumerable:r,value:n}),n}function ze(e,t,n){return Re(e,t,n,!1)}function Be(e,t){for(let n in e){let r=e[n];Object.defineProperty(t,n,{configurable:!0,enumerable:!0,get(){return Re(this,n,r(this))},set(e){Re(this,n,e)}})}return t}function Ve(e,t,n){Object.defineProperty(e,t,{configurable:!0,get(){return this==null?n:Re(this,t,n.bind(this))},set(e){Re(this,t,e)}})}function He(e,t){let n=Object.getPrototypeOf(e);return t in n?void 0:n}var Ue,We=!1,Ge={configurable:!0,get(){We=!0}};function x(e,t,n){let r=Object.getPrototypeOf(e._zod);if(t in r&&Ue!==e._zod){Ue=void 0;return}Ue=e._zod,Object.defineProperty(r,t,{configurable:!0,get(){Object.defineProperty(this,t,Ge);let e=We;We=!1;try{let r=n(this);return We?delete this[t]:Object.defineProperty(this,t,{configurable:!0,writable:!0,value:r}),We||=e,r}catch(n){throw delete this[t],We||=e,n}},set(e){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:e})}})}function Ke(e,t,n,r){let i=He(e,t);i&&Object.defineProperty(i,t,{configurable:!0,get(){let e={configurable:!0,writable:!0,enumerable:r,value:void 0};return Object.defineProperty(this,t,e),e.value=n(this),Object.defineProperty(this,t,e),e.value},set(e){Object.defineProperty(this,t,{configurable:!0,writable:!0,enumerable:r,value:e})}})}var qe=`~constantCatch`;function Je(e){let t=()=>e;return t[qe]=!0,t}var Ye,Xe=Object.freeze({status:`aborted`}),Ze={value:void 0,enumerable:!1},Qe=`captureStackTrace`in Error?Error:null;function $e(e){let t=Qe;if(t){let n=t.stackTraceLimit;if(typeof n==`number`){try{t.stackTraceLimit=0}catch{return Qe=null,new e}try{return new e}finally{t.stackTraceLimit=n}}}return new e}function S(e,t,n,r){let i={};function a(e){this.def=e,this.constr=d,this.traits=new Set}a.prototype=i;let o=n,s=o&&new WeakSet;function c(n,r){if(!n._zod){Ze.value=new a(r);try{Object.defineProperty(n,"_zod",Ze)}finally{Ze.value=void 0}}else if(n._zod.traits.has(e))return;if(n._zod.traits.add(e),t(n,r),s){let e=Object.getPrototypeOf(n),t=n._zod.constr.prototype,r=e;for(;r&&r!==t;)r=Object.getPrototypeOf(r);let i=r??e;s.has(i)||(s.add(i),Le(i,o))}let i=d.prototype;for(let e in i)Object.prototype.hasOwnProperty.call(i,e)&&(e in n||(n[e]=i[e].bind(n)))}let l=r?.Parent??Object;class u extends l{}Object.defineProperty(u,"name",{value:e});function d(e){let t=r?.Parent?$e(u):this;c(t,e);let n=t._zod.deferred;if(n){for(let e of n)e();t._zod.deferred=void 0}let i=globalThis.__zod_globalConfig?.postProcessor;return i&&i(t),t}return Object.defineProperty(d,"init",{value:c}),Object.defineProperty(d,Symbol.hasInstance,{value:t=>r?.Parent&&t instanceof r.Parent?!0:t?._zod?.traits?.has(e)}),Object.defineProperty(d,"name",{value:e}),d}var et=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}},tt=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name=`ZodEncodeError`}};(Ye=globalThis).__zod_globalConfig??(Ye.__zod_globalConfig={});var C=globalThis.__zod_globalConfig;function w(e){return e&&Object.assign(C,e),C}function nt(){let e=this._zod;return e.message??=JSON.stringify(e.def,s,2),e.message}function T(e){this._zod.message=e}var rt={get:nt,set:T,enumerable:!0,configurable:!0},it={value:void 0,enumerable:!1},at=new WeakSet([Object.prototype,Error.prototype]),ot=(e,t)=>{e.name=`$ZodError`,it.value=t,Object.defineProperty(e,"issues",it),it.value=void 0,Object.defineProperty(e,"message",rt);let n=Object.getPrototypeOf(e);at.has(n)||(at.add(n),Object.defineProperty(n,"toString",{configurable:!0,enumerable:!1,get(){let e=()=>this.message;return Object.defineProperty(this,"toString",{value:e,configurable:!0,writable:!0}),e},set(e){Object.defineProperty(this,"toString",{value:e,configurable:!0,writable:!0})}}))},st=S(`$ZodError`,ot);S(`$ZodError`,ot,void 0,{Parent:Error});function ct(e,t,n){return Object.prototype.hasOwnProperty.call(e,t)||(t===`__proto__`?Object.defineProperty(e,t,{value:n(),writable:!0,enumerable:!0,configurable:!0}):e[t]=n()),e[t]}function lt(e,t=e=>e.message){let n={},r=[];for(let i of e.issues)i.path.length>0?ct(n,i.path[0],()=>[]).push(t(i)):r.push(t(i));return{formErrors:r,fieldErrors:n}}function ut(e,t=e=>e.message){let n={_errors:[]},r=(e,i=[])=>{for(let a of e.issues)if(a.code===`invalid_union`&&a.errors.length)a.errors.map(e=>r({issues:e},[...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 e=[...i,...a.path];if(e.length===0)n._errors.push(t(a));else{let r=n,i=0;for(;i<e.length;){let n=e[i],o=i===e.length-1;if(n===`_errors`){o&&r._errors.push(t(a)),i++;continue}Object.prototype.hasOwnProperty.call(r,n)||Object.defineProperty(r,n,{value:{_errors:[]},enumerable:!0,writable:!0,configurable:!0});let s=r[n];o&&s._errors.push(t(a)),r=s,i++}}}};return r(e),n}function dt(e,t){return{callee:t?.callee??e,Err:t?.Err}}var ft=e=>{let t=(n,r,i,a)=>{let o=i?{...i,async:!1}:{async:!1},s=n._zod.run({value:r,issues:[]},o);if(s instanceof Promise)throw new et;if(s.issues.length){let n=new((a?.Err)??e)(s.issues.map(e=>je(e,o,w())));throw se(n,a?.callee??t),n}return s.value};return t},pt=e=>{let t=async(n,r,i,a)=>{let o=i?{...i,async:!0}:{async:!0},s=n._zod.run({value:r,issues:[]},o);if(s instanceof Promise&&(s=await s),s.issues.length){let n=new((a?.Err)??e)(s.issues.map(e=>je(e,o,w())));throw se(n,a?.callee??t),n}return s.value};return t},mt=e=>(t,n,r)=>{let i=r?{...r,async:!1}:{async:!1},a=t._zod.run({value:n,issues:[]},i);if(a instanceof Promise)throw new et;return a.issues.length?ht(e,a.issues,i):{success:!0,data:a.value}};function ht(e,t,n){let r;return{success:!1,get error(){return r||(r=new e(t.map(e=>je(e,n,w()))),t=void 0,n=void 0),r},set error(e){r=e,t=void 0,n=void 0}}}var gt=e=>async(t,n,r)=>{let i=r?{...r,async:!0}:{async:!0},a=t._zod.run({value:n,issues:[]},i);return a instanceof Promise&&(a=await a),a.issues.length?ht(e,a.issues,i):{success:!0,data:a.value}},_t=Symbol.for(`zod.compile.invalid`),vt=Symbol.for(`zod.compile.fallback`),yt=((e,t,n)=>{let r=e._zod.bag.validator;if(r!==void 0){if(r(t)!==_t)return!0;if(r.definite===!0&&n===void 0)return!1}return bt(e,t,n)});function bt(e,t,n){let r=n?{...n,async:!1,abortEarly:!0}:{async:!1,abortEarly:!0},i=e._zod.bag.fallbackRun,a;if(i?(r[vt]=!0,a=i({value:t,issues:[]},r)):a=e._zod.run({value:t,issues:[]},r),a instanceof Promise)throw new et;return a.issues.length===0}var xt=async(e,t,n)=>{let r=n?{...n,async:!0,abortEarly:!0}:{async:!0,abortEarly:!0},i=e._zod.run({value:t,issues:[]},r);return i instanceof Promise&&(i=await i),i.issues.length===0},St=e=>{let t=ft(e),n=(e,r,i,a)=>{let o=i?{...i,direction:`backward`}:{direction:`backward`};return t(e,r,o,dt(n,a))};return n},Ct=e=>{let t=ft(e),n=(e,r,i,a)=>t(e,r,i,dt(n,a));return n},wt=e=>{let t=pt(e),n=async(e,r,i,a)=>{let o=i?{...i,direction:`backward`}:{direction:`backward`};return await t(e,r,o,dt(n,a))};return n},Tt=e=>{let t=pt(e),n=async(e,r,i,a)=>await t(e,r,i,dt(n,a));return n},Et=e=>(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return mt(e)(t,n,i)},Dt=e=>(t,n,r)=>mt(e)(t,n,r),Ot=e=>async(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return gt(e)(t,n,i)},kt=e=>async(t,n,r)=>gt(e)(t,n,r),At=/^[cC][0-9a-z]{6,}$/,jt=/^[0-9a-z]+$/,Mt=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/,Nt=/^[0-9a-vA-V]{20}$/,Pt=/^[A-Za-z0-9]{27}$/,Ft=/^[a-zA-Z0-9_-]{21}$/;function It(e){return RegExp(`^[a-zA-Z0-9_-]{${e}}$`)}var Lt=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Rt=/^([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})$/,zt=e=>e?RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,Bt=/^(?:[A-Za-z0-9_'+\-]+\.)*[A-Za-z0-9_'+\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,Vt=`^(?=[\\s\\S]*[\\p{Extended_Pictographic}\\p{Regional_Indicator}\\u20E3])[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$`;function Ht(){return new RegExp(Vt,`u`)}var Ut=/^(?:(?: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])$/,Wt=/^(([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}|:))$/,Gt=/^((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])$/,Kt=/^(([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}|:))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,qt=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Jt=/^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$/,Yt=/^https?$/,Xt=/^\+[1-9]\d{6,14}$/,Zt=`(?:(?:\\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])))`;function Qt(e){return RegExp(`^${e}$`)}var $t=Qt(Zt);function en(e){let t=`(?:[01]\\d|2[0-3]):[0-5]\\d`;return typeof e.precision==`number`?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:e.seconds?`${t}:[0-5]\\d(?:\\.\\d+)?`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function tn(e){return RegExp(`^${en(e)}$`)}function nn(e){let t=[`Z`];e.offset&&t.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);let n=`${en({precision:e.precision,seconds:!0})}(?:${t.join(`|`)})`,r=e.local?`${n}|${en({precision:e.precision})}`:n;return RegExp(`^${Zt}T(?:${r})$`)}var rn=/^[\s\S]{0,}$/,an=/^-?\d+$/,E=/^-?\d+(?:\.\d+)?$/,on=/^(?:true|false)$/i,sn=/^null$/i,cn=/^undefined$/i,ln=/^[^A-Z]*$/,un=/^[^a-z]*$/,dn=S(`$ZodCheck`,(e,t)=>{var n;e._zod??={},e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),fn=e=>{let t=e.value;return!u(t)&&t.length!==void 0},pn={number:`number`,bigint:`bigint`,object:`date`},mn=S(`$ZodCheckLessThan`,(e,t)=>{dn.init(e,t);let n=pn[typeof t.value];e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:pn[typeof r.value]??n,code:`too_big`,maximum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),hn=S(`$ZodCheckGreaterThan`,(e,t)=>{dn.init(e,t);let n=pn[typeof t.value];e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:pn[typeof r.value]??n,code:`too_small`,minimum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),gn=S(`$ZodCheckMultipleOf`,(e,t)=>{dn.init(e,t),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw Error(`Cannot mix number and bigint in multiple_of check.`);(typeof n.value==`bigint`?t.value!==BigInt(0)&&n.value%t.value===BigInt(0):f(n.value,t.value)===0)||n.issues.push({origin:typeof n.value,code:`not_multiple_of`,divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),_n=S(`$ZodCheckNumberFormat`,(e,t)=>{dn.init(e,t),t.format=t.format||`float64`;let n=t.format?.includes(`int`),r=n?`int`:`number`,[i,a]=ge[t.format];e._zod.check=o=>{let s=o.value;if(n){if(!Number.isInteger(s)){o.issues.push({expected:r,format:t.format,code:`invalid_type`,continue:!1,input:s,inst:e});return}if(!Number.isSafeInteger(s)){s>0?o.issues.push({input:s,code:`too_big`,maximum:2**53-1,note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort}):o.issues.push({input:s,code:`too_small`,minimum:-(2**53-1),note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort});return}}s<i&&o.issues.push({origin:`number`,input:s,code:`too_small`,minimum:i,inclusive:!0,inst:e,continue:!t.abort}),s>a&&o.issues.push({origin:`number`,input:s,code:`too_big`,maximum:a,inclusive:!0,inst:e,continue:!t.abort})}}),vn=S(`$ZodCheckMaxLength`,(e,t)=>{var n;dn.init(e,t),(n=e._zod.def).when??(n.when=fn),e._zod.check=n=>{let r=n.value,i=r.length;if((typeof r==`string`&&i>t.maximum?Ne(r):i)<=t.maximum)return;let a=Pe(r);n.issues.push({origin:a,code:`too_big`,maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),yn=S(`$ZodCheckMinLength`,(e,t)=>{var n;dn.init(e,t),(n=e._zod.def).when??(n.when=fn),e._zod.check=n=>{let r=n.value,i=r.length;if((typeof r==`string`&&i>=t.minimum&&i<t.minimum*2?Ne(r):i)>=t.minimum)return;let a=Pe(r);n.issues.push({origin:a,code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),bn=S(`$ZodCheckLengthEquals`,(e,t)=>{var n;dn.init(e,t),(n=e._zod.def).when??(n.when=fn),e._zod.check=n=>{let r=n.value,i=r.length,a=typeof r==`string`&&i>=t.length&&i<=t.length*2?Ne(r):i;if(a===t.length)return;let o=Pe(r),s=a>t.length;n.issues.push({origin:o,...s?{code:`too_big`,maximum:t.length}:{code:`too_small`,minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),xn=S(`$ZodCheckStringFormat`,(e,t)=>{var n,r;dn.init(e,t),t.pattern?(n=e._zod).check??(n.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&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})}):(r=e._zod).check??(r.check=()=>{})}),Sn=S(`$ZodCheckRegex`,(e,t)=>{xn.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:`regex`,input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),Cn=S(`$ZodCheckLowerCase`,(e,t)=>{t.pattern??=ln,xn.init(e,t)}),wn=S(`$ZodCheckUpperCase`,(e,t)=>{t.pattern??=un,xn.init(e,t)}),Tn=S(`$ZodCheckIncludes`,(e,t)=>{dn.init(e,t);let n=pe(t.includes);t.pattern=new RegExp(typeof t.position==`number`?`^.{${t.position},}${n}`:n),e._zod.check=n=>{n.value.includes(t.includes,t.position)||n.issues.push({origin:`string`,code:`invalid_format`,format:`includes`,includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),En=S(`$ZodCheckStartsWith`,(e,t)=>{dn.init(e,t);let n=RegExp(`^${pe(t.prefix)}.*`);t.pattern??=n,e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`starts_with`,prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),Dn=S(`$ZodCheckEndsWith`,(e,t)=>{dn.init(e,t);let n=RegExp(`.*${pe(t.suffix)}$`);t.pattern??=n,e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`ends_with`,suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}}),On=S(`$ZodCheckOverwrite`,(e,t)=>{dn.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}}),kn=class{constructor(e=[],t={}){this.content=[],this.indent=0,this.args=e,this.closed=t}indented(e){this.indent+=1;try{e(this)}finally{--this.indent}}write(e){if(typeof e==`function`){e(this,{execution:`sync`}),e(this,{execution:`async`});return}let t=e.split(`
10
10
  `).filter(e=>e),n=Math.min(...t.map(e=>e.length-e.trimStart().length)),r=t.map(e=>e.slice(n)).map(e=>` `.repeat(this.indent*2)+e);for(let e of r)this.content.push(e)}compile(){let e=Function,t=this?.content??[``];return new e(...Object.keys(this.closed),`return function (${this.args.join(`, `)}) {\n${t.join(`
11
- `)}\n};`)(...Object.values(this.closed))}},yn={major:4,minor:5,patch:4},T=b(`$ZodType`,(e,t)=>{var n;e??={},e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=yn;let r=e._zod.def.checks,i=e._zod.traits.has(`$ZodCheck`)?[e,...r??[]]:r?.length?[...r]:[];for(let t of i)for(let n of t._zod.onattach)n(e);if(i.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let t=(t,n,r)=>{if(t.memo)return t;let i=ye(t),a;for(let o of n){if(o._zod.def.when){if(be(t)||!o._zod.def.when(t))continue}else if(i)continue;let n=t.issues.length,s=o._zod.check(t);if(s instanceof Promise&&r?.async===!1)throw new Ge;if(a||s instanceof Promise)a=(a??Promise.resolve()).then(async()=>{await s,t.issues.length!==n&&(Ce(t.issues,n,e),i||=ye(t,n))});else{if(t.issues.length===n)continue;Ce(t.issues,n,e),i||=ye(t,n)}}return a?a.then(()=>t):t},n=(n,r,a)=>{if(ye(n))return n.aborted=!0,n;let o=t(r,i,a);if(o instanceof Promise){if(a.async===!1)throw new Ge;return o.then(t=>e._zod.parse(t,a))}return e._zod.parse(o,a)};e._zod.run=(r,a)=>{if(a.skipChecks)return e._zod.parse(r,a);if(a.direction===`backward`){let t=e._zod.parse({value:r.value,issues:[]},{...a,skipChecks:!0});return t instanceof Promise?t.then(e=>n(e,r,a)):n(t,r,a)}let o=e._zod.parse(r,a);if(o instanceof Promise){if(a.async===!1)throw new Ge;return o.then(e=>t(e,i,a))}return t(o,i,a)}}},{get"~standard"(){return je(this,`~standard`,xn(this))},set"~standard"(e){Ae(this,`~standard`,e)}}),bn=e=>e.success?{value:e.data}:{issues:e.error?.issues};function xn(e){return{validate:t=>{try{return bn(ct(e,t))}catch{return ut(e,t).then(bn)}},vendor:`zod`,version:1}}var Sn=b(`$ZodString`,(e,t)=>{T.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??Kt(e._zod.bag),e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=String(n.value)}catch{}return typeof n.value==`string`||n.issues.push({expected:`string`,code:`invalid_type`,input:n.value,inst:e}),n}}),E=b(`$ZodStringFormat`,(e,t)=>{un.init(e,t),Sn.init(e,t)}),Cn=b(`$ZodGUID`,(e,t)=>{t.pattern??=Dt,E.init(e,t)}),wn=b(`$ZodUUID`,(e,t)=>{if(t.version){let e={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(e===void 0)throw Error(`Invalid UUID version: "${t.version}"`);t.pattern??=Ot(e)}else t.pattern??=Ot();E.init(e,t)}),Tn=b(`$ZodEmail`,(e,t)=>{t.pattern??=kt,E.init(e,t)});function En(e,t){if(!t.normalize&&t.protocol?.source===Rt.source&&!/^https?:\/\//i.test(e))return 1;try{return new URL(e)}catch{return 2}}var Dn=/[\t\n\r]/g;function On(e){return e.replace(Dn,``)}function kn(e,t){return t.lastIndex=0,t.test(e.hostname)}function An(e,t){return t.lastIndex=0,t.test(e.protocol.endsWith(`:`)?e.protocol.slice(0,-1):e.protocol)}var jn=b(`$ZodURL`,(e,t)=>{E.init(e,t),e._zod.check=n=>{try{let r=n.value.trim(),i=En(r,t);if(i===1){n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid URL format`,input:n.value,inst:e,continue:!t.abort});return}if(i===2){n.issues.push({code:`invalid_format`,format:`url`,input:n.value,inst:e,continue:!t.abort});return}t.hostname&&!kn(i,t.hostname)&&n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid hostname`,pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort}),t.protocol&&!An(i,t.protocol)&&n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid protocol`,pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort}),n.value=t.normalize?i.href:On(r);return}catch{n.issues.push({code:`invalid_format`,format:`url`,input:n.value,inst:e,continue:!t.abort})}}}),Mn=b(`$ZodEmoji`,(e,t)=>{t.pattern??=jt(),E.init(e,t)}),Nn=b(`$ZodNanoID`,(e,t)=>{if(t.length!==void 0&&(!Number.isInteger(t.length)||t.length<1))throw Error(`Invalid nanoid length: ${t.length}`);t.pattern??=t.length===void 0?wt:Tt(t.length),E.init(e,t)}),Pn=b(`$ZodCUID`,(e,t)=>{t.pattern??=yt,E.init(e,t)}),Fn=b(`$ZodCUID2`,(e,t)=>{t.pattern??=bt,E.init(e,t)}),In=b(`$ZodULID`,(e,t)=>{t.pattern??=xt,E.init(e,t)}),Ln=b(`$ZodXID`,(e,t)=>{t.pattern??=St,E.init(e,t)}),Rn=b(`$ZodKSUID`,(e,t)=>{t.pattern??=Ct,E.init(e,t)}),zn=b(`$ZodISODateTime`,(e,t)=>{t.pattern??=Gt(t),E.init(e,t),(t.local||t.precision===-1)&&(e._zod.bag.laxFormat=!0,e._zod.onattach.push(e=>{e._zod.bag.laxFormat=!0}))}),Bn=b(`$ZodISODate`,(e,t)=>{t.pattern??=Ht,E.init(e,t)}),Vn=b(`$ZodISOTime`,(e,t)=>{t.pattern??=Wt(t),E.init(e,t)}),Hn=b(`$ZodISODuration`,(e,t)=>{t.pattern??=Et,E.init(e,t)}),Un=b(`$ZodIPv4`,(e,t)=>{t.pattern??=Mt,E.init(e,t),e._zod.bag.format=`ipv4`}),Wn=/^[0-9a-fA-F:.]+$/;function Gn(e){if(!Wn.test(e))return!1;try{return new URL(`http://[${e}]`),!0}catch{return!1}}var Kn=b(`$ZodIPv6`,(e,t)=>{t.pattern??=Nt,E.init(e,t),e._zod.bag.format=`ipv6`,e._zod.check=n=>{Gn(n.value)||n.issues.push({code:`invalid_format`,format:`ipv6`,input:n.value,inst:e,continue:!t.abort})}}),qn=b(`$ZodCIDRv4`,(e,t)=>{t.pattern??=Pt,E.init(e,t)});function Jn(e){let t=e.split(`/`);if(t.length!==2)return!1;let[n,r]=t;if(!r)return!1;let i=Number(r);return`${i}`!==r||i<0||i>128?!1:Gn(n)}var Yn=b(`$ZodCIDRv6`,(e,t)=>{t.pattern??=Ft,E.init(e,t),e._zod.check=n=>{Jn(n.value)||n.issues.push({code:`invalid_format`,format:`cidrv6`,input:n.value,inst:e,continue:!t.abort})}});function Xn(e){if(e===``)return!0;if(/\s/.test(e)||e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}var Zn=b(`$ZodBase64`,(e,t)=>{t.pattern??=It,E.init(e,t),e._zod.bag.contentEncoding=`base64`,e._zod.check=n=>{Xn(n.value)||n.issues.push({code:`invalid_format`,format:`base64`,input:n.value,inst:e,continue:!t.abort})}});function Qn(e){if(!Lt.test(e))return!1;let t=e.replace(/[-_]/g,e=>e===`-`?`+`:`/`);return Xn(t.padEnd(Math.ceil(t.length/4)*4,`=`))}var $n=b(`$ZodBase64URL`,(e,t)=>{t.pattern??=Lt,E.init(e,t),e._zod.bag.contentEncoding=`base64url`,e._zod.check=n=>{Qn(n.value)||n.issues.push({code:`invalid_format`,format:`base64url`,input:n.value,inst:e,continue:!t.abort})}}),er=b(`$ZodE164`,(e,t)=>{t.pattern??=zt,E.init(e,t)});function tr(e,t=null){try{let n=e.split(`.`);if(n.length!==3)return!1;let[r]=n;if(!r)return!1;let i=JSON.parse(atob(r));return!(`typ`in i&&i?.typ!==`JWT`||!i.alg||t&&(!(`alg`in i)||i.alg!==t))}catch{return!1}}var nr=b(`$ZodJWT`,(e,t)=>{E.init(e,t),e._zod.check=n=>{tr(n.value,t.alg)||n.issues.push({code:`invalid_format`,format:`jwt`,input:n.value,inst:e,continue:!t.abort})}}),rr=b(`$ZodNumber`,(e,t)=>{T.init(e,t),e._zod.pattern=e._zod.bag.pattern??Jt,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Number(n.value)}catch{}let i=n.value;if(typeof i==`number`&&!Number.isNaN(i)&&Number.isFinite(i))return n;let a=typeof i==`number`?Number.isNaN(i)?`NaN`:Number.isFinite(i)?void 0:String(i):void 0;return n.issues.push({expected:`number`,code:`invalid_type`,input:i,inst:e,...a?{received:a}:{}}),n}}),ir=b(`$ZodNumberFormat`,(e,t)=>{on.init(e,t),rr.init(e,t)}),ar=b(`$ZodBoolean`,(e,t)=>{T.init(e,t),e._zod.pattern=Yt,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=!!n.value}catch{}let i=n.value;return typeof i==`boolean`||n.issues.push({expected:`boolean`,code:`invalid_type`,input:i,inst:e}),n}}),or=b(`$ZodUndefined`,(e,t)=>{T.init(e,t),e._zod.pattern=Zt,e._zod.values=new Set([void 0]),e._zod.parse=(t,n)=>{let r=t.value;return r===void 0||t.issues.push({expected:`undefined`,code:`invalid_type`,input:r,inst:e}),t}}),sr=b(`$ZodNull`,(e,t)=>{T.init(e,t),e._zod.pattern=Xt,e._zod.values=new Set([null]),e._zod.parse=(t,n)=>{let r=t.value;return r===null||t.issues.push({expected:`null`,code:`invalid_type`,input:r,inst:e}),t}}),cr=b(`$ZodAny`,(e,t)=>{T.init(e,t),e._zod.parse=e=>e}),lr=b(`$ZodUnknown`,(e,t)=>{T.init(e,t),e._zod.parse=e=>e}),ur=b(`$ZodNever`,(e,t)=>{T.init(e,t),e._zod.parse=(t,n)=>(t.issues.push({expected:`never`,code:`invalid_type`,input:t.value,inst:e}),t)});function dr(e,t,n){e.issues.length&&t.issues.push(...xe(n,e.issues)),t.value[n]=e.value}var fr=b(`$ZodArray`,(e,t)=>{T.init(e,t);let n=x.memoizer;n?.attach(e),e._zod.parse=(r,i)=>{let a=r.value;if(!Array.isArray(a))return r.issues.push({expected:`array`,code:`invalid_type`,input:a,inst:e}),r;r.value=n?n.alloc(e,r,Array(a.length),i):Array(a.length);let o=[];for(let e=0;e<a.length;e++){let n=a[e],s=t.element._zod.run({value:n,issues:[]},i);s instanceof Promise?o.push(s.then(t=>dr(t,r,e))):dr(s,r,e)}return o.length?Promise.all(o).then(()=>r):r}});function pr(e,t,n,r,i,a){let o=n in r,s=a===`optional`;if(o||!s||i!==`optional`){if(e.issues.length){if(i!==void 0&&s&&!o)return;t.issues.push(...xe(n,e.issues))}if(!o&&i===void 0){e.issues.length||t.issues.push({code:`invalid_type`,expected:`nonoptional`,input:void 0,path:[n]});return}e.value===void 0?o&&(t.value[n]=void 0):t.value[n]=e.value}}var mr=[];function hr(e){let t=Object.keys(e.shape),n=Object.getOwnPropertySymbols(e.shape),r=n.length?n:mr,i=r.length?[...t,...r]:t;for(let t of i)if(!e.shape?.[t]?._zod?.traits?.has(`$ZodType`))throw Error(`Invalid element at key "${String(t)}": expected a Zod schema`);let a=ue(e.shape);return{...e,allKeys:i,symbolKeys:r,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(a)}}function gr(e,t,n,r,i,a){let o=[],s=i.keySet,c=i.catchall._zod,l=c.def.type,u=c.optin,d=c.optout;for(let i in t){if(s.has(i))continue;if(i===`__proto__`){l===`never`&&o.push(i);continue}if(l===`never`){o.push(i);continue}let a=c.run({value:t[i],issues:[]},r);a instanceof Promise?e.push(a.then(e=>pr(e,n,i,t,u,d))):pr(a,n,i,t,u,d)}return o.length&&n.issues.push({code:`unrecognized_keys`,keys:o,input:t,inst:a,continue:!0}),e.length?Promise.all(e).then(()=>n):n}var _r=new WeakMap,vr=b(`$ZodObject`,(e,t)=>{if(T.init(e,t),!Object.getOwnPropertyDescriptor(t,`shape`)?.get){let e=t.shape;_r.set(t,e),Object.defineProperty(t,"shape",{get:()=>{let n={...e};return Object.defineProperty(t,"shape",{value:n}),_r.set(t,n),n}})}let n=c(()=>hr(t));y(e,`propValues`,e=>{let t=e.def.shape,n={};for(let e in t){let r=t[e]._zod;if(r.values){Object.prototype.hasOwnProperty.call(n,e)||m(n,e,new Set);for(let t of r.values)n[e].add(t);r.optin!==void 0&&n[e].add(void 0)}}return n});let r=g,i=t.catchall,a,o=x.memoizer;o?.attach(e),e._zod.parse=(t,s)=>{a??=n.value;let c=t.value;if(!r(c))return t.issues.push({expected:`object`,code:`invalid_type`,input:c,inst:e}),t;t.value=o?o.alloc(e,t,{},s):{};let l=[],u=a.shape;for(let e of a.allKeys){if(e===`__proto__`)continue;let n=u[e],r=n._zod.optin,i=n._zod.optout,a=n._zod.run({value:c[e],issues:[]},s);a instanceof Promise?l.push(a.then(n=>pr(n,t,e,c,r,i))):pr(a,t,e,c,r,i)}return i?gr(l,c,t,s,n.value,e):l.length?Promise.all(l).then(()=>t):t}}),yr=b(`$ZodObjectJIT`,(e,t)=>{vr.init(e,t);let n=e._zod.parse,r=c(()=>hr(t)),i=x.memoizer,a=t=>{let n=r.value,a=n.symbolKeys,o=new vn([`payload`,`ctx`],{shape:t,inst:e,memo:i,syms:a}),s=e=>`shape[${e}]._zod.run({ value: input[${e}], issues: [] }, ctx)`,c=(e,t)=>`
11
+ `)}\n};`)(...Object.values(this.closed))}},An={major:4,minor:6,patch:5},D=S(`$ZodType`,(e,t)=>{var n;e??={},e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=An;let r=e._zod.def.checks,i=e._zod.traits.has(`$ZodCheck`)?[e,...r??[]]:r?.length?[...r]:[];for(let t of i)for(let n of t._zod.onattach)n(e);if(i.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let t=(t,n,r)=>{if(t.memo)return t;let i=b(t),a;for(let o of n){if(o._zod.def.when){if(De(t)||!o._zod.def.when(t))continue}else if(i)continue;let n=t.issues.length,s=o._zod.check(t);if(s instanceof Promise&&r?.async===!1)throw new et;if(a||s instanceof Promise)a=(a??Promise.resolve()).then(async()=>{await s,t.issues.length!==n&&(Ae(t.issues,n,e),i||=b(t,n))});else{if(t.issues.length===n)continue;Ae(t.issues,n,e),i||=b(t,n)}}return a?a.then(()=>t):t},n=(n,r,a)=>{if(b(n))return n.aborted=!0,n;let o=t(r,i,a);if(o instanceof Promise){if(a.async===!1)throw new et;return o.then(t=>e._zod.parse(t,a))}return e._zod.parse(o,a)};e._zod.run=(r,a)=>{if(a.skipChecks)return e._zod.parse(r,a);if(a.direction===`backward`){let t=e._zod.parse({value:r.value,issues:[]},{...a,skipChecks:!0});return t instanceof Promise?t.then(e=>n(e,r,a)):n(t,r,a)}let o=e._zod.parse(r,a);if(o instanceof Promise){if(a.async===!1)throw new et;return o.then(e=>t(e,i,a))}return t(o,i,a)}}},{get"~standard"(){return ze(this,`~standard`,Nn(this))},set"~standard"(e){Re(this,`~standard`,e)}}),jn=(e,t)=>e.issues.length?{issues:e.issues.map(e=>je(e,t,w()))}:{value:e.value};async function Mn(e,t){let n={async:!0};return jn(await e._zod.run({value:t,issues:[]},n),n)}function Nn(e){return{validate:t=>{let n={async:!1};try{let r=e._zod.run({value:t,issues:[]},n);if(!(r instanceof Promise))return jn(r,n)}catch{}return Mn(e,t)},vendor:`zod`,version:1}}var Pn=S(`$ZodString`,(e,t)=>{D.init(e,t),e._zod.pattern=t.pattern??rn,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=String(n.value)}catch{}return typeof n.value==`string`||n.issues.push({expected:`string`,code:`invalid_type`,input:n.value,inst:e}),n}}),O=S(`$ZodStringFormat`,(e,t)=>{xn.init(e,t),Pn.init(e,t)}),Fn=S(`$ZodGUID`,(e,t)=>{t.pattern??=Rt,O.init(e,t)}),In=S(`$ZodUUID`,(e,t)=>{if(t.version){let e={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(e===void 0)throw Error(`Invalid UUID version: "${t.version}"`);t.pattern??=zt(e)}else t.pattern??=zt();O.init(e,t)}),Ln=S(`$ZodEmail`,(e,t)=>{t.pattern??=Bt,O.init(e,t)});function Rn(e){try{return typeof URL<`u`&&typeof URL.canParse==`function`?URL.canParse(e):(new URL(e),!0)}catch{return!1}}function zn(e,t){return!(`normalize`in t)&&!(`hostname`in t)&&!(`protocol`in t)?Rn(e)||2:Bn(e,t)}function Bn(e,t){if(!t.normalize&&t.protocol?.source===Yt.source&&!/^https?:\/\//i.test(e))return 1;try{if(typeof URL<`u`){let t=URL;if(typeof t.parse==`function`)return t.parse(e)??2}return new URL(e)}catch{return 2}}var Vn=/[\t\n\r]/g;function Hn(e){return e.replace(Vn,``)}function Un(e,t){return t.lastIndex=0,t.test(e.hostname)}function Wn(e,t){return t.lastIndex=0,t.test(e.protocol.endsWith(`:`)?e.protocol.slice(0,-1):e.protocol)}var Gn=S(`$ZodURL`,(e,t)=>{O.init(e,t),e._zod.check=n=>{try{let r=n.value.trim(),i=zn(r,t);if(i===1){n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid URL format`,input:n.value,inst:e,continue:!t.abort});return}if(i===2){n.issues.push({code:`invalid_format`,format:`url`,input:n.value,inst:e,continue:!t.abort});return}if(i===!0){n.value=Hn(r);return}t.hostname&&!Un(i,t.hostname)&&n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid hostname`,pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort}),t.protocol&&!Wn(i,t.protocol)&&n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid protocol`,pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort}),n.value=t.normalize?i.href:Hn(r);return}catch{n.issues.push({code:`invalid_format`,format:`url`,input:n.value,inst:e,continue:!t.abort})}}}),Kn=S(`$ZodEmoji`,(e,t)=>{t.pattern??=Ht(),O.init(e,t)}),qn=S(`$ZodNanoID`,(e,t)=>{if(t.length!==void 0&&(!Number.isInteger(t.length)||t.length<1))throw Error(`Invalid nanoid length: ${t.length}`);t.pattern??=t.length===void 0?Ft:It(t.length),O.init(e,t)}),Jn=S(`$ZodCUID`,(e,t)=>{t.pattern??=At,O.init(e,t)}),Yn=S(`$ZodCUID2`,(e,t)=>{t.pattern??=jt,O.init(e,t)}),Xn=S(`$ZodULID`,(e,t)=>{t.pattern??=Mt,O.init(e,t)}),Zn=S(`$ZodXID`,(e,t)=>{t.pattern??=Nt,O.init(e,t)}),Qn=S(`$ZodKSUID`,(e,t)=>{t.pattern??=Pt,O.init(e,t)}),$n=S(`$ZodISODateTime`,(e,t)=>{t.pattern??=nn(t),O.init(e,t)}),er=S(`$ZodISODate`,(e,t)=>{t.pattern??=$t,O.init(e,t)}),tr=S(`$ZodISOTime`,(e,t)=>{t.pattern??=tn(t),O.init(e,t)}),nr=S(`$ZodISODuration`,(e,t)=>{t.pattern??=Lt,O.init(e,t)}),rr=S(`$ZodIPv4`,(e,t)=>{t.pattern??=Ut,O.init(e,t)}),ir=/^[0-9a-fA-F:.]+$/;function ar(e){return ir.test(e)?Rn(`http://[${e}]`):!1}var or=S(`$ZodIPv6`,(e,t)=>{t.pattern??=Wt,O.init(e,t),e._zod.check=n=>{ar(n.value)||n.issues.push({code:`invalid_format`,format:`ipv6`,input:n.value,inst:e,continue:!t.abort})}}),sr=S(`$ZodCIDRv4`,(e,t)=>{t.pattern??=Gt,O.init(e,t)});function cr(e){let t=e.split(`/`);if(t.length!==2)return!1;let[n,r]=t;if(!r)return!1;let i=Number(r);return`${i}`!==r||i<0||i>128?!1:ar(n)}var lr=S(`$ZodCIDRv6`,(e,t)=>{t.pattern??=Kt,O.init(e,t),e._zod.check=n=>{cr(n.value)||n.issues.push({code:`invalid_format`,format:`cidrv6`,input:n.value,inst:e,continue:!t.abort})}});function ur(e){if(e===``)return!0;if(/\s/.test(e)||e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}var dr=/^[0-9a-zA-Z+/]*={0,2}$/,fr=S(`$ZodBase64`,(e,t)=>{t.pattern??=dr,O.init(e,t),e._zod.check=n=>{ur(n.value)||n.issues.push({code:`invalid_format`,format:`base64`,input:n.value,inst:e,continue:!t.abort})}}),pr=/^[A-Za-z0-9_-]*$/;function mr(e){if(!pr.test(e))return!1;let t=e.replace(/[-_]/g,e=>e===`-`?`+`:`/`);return ur(t.padEnd(Math.ceil(t.length/4)*4,`=`))}var hr=S(`$ZodBase64URL`,(e,t)=>{t.pattern??=pr,O.init(e,t),e._zod.check=n=>{mr(n.value)||n.issues.push({code:`invalid_format`,format:`base64url`,input:n.value,inst:e,continue:!t.abort})}}),gr=S(`$ZodE164`,(e,t)=>{t.pattern??=Xt,O.init(e,t)});function _r(e,t=null){try{let n=e.split(`.`);if(n.length!==3)return!1;let[r]=n;if(!r)return!1;let i=JSON.parse(atob(r));return!(`typ`in i&&i?.typ!==`JWT`||!i.alg||t&&(!(`alg`in i)||i.alg!==t))}catch{return!1}}var vr=S(`$ZodJWT`,(e,t)=>{O.init(e,t),e._zod.check=n=>{_r(n.value,t.alg)||n.issues.push({code:`invalid_format`,format:`jwt`,input:n.value,inst:e,continue:!t.abort})}}),yr=S(`$ZodNumber`,(e,t)=>{D.init(e,t),e._zod.pattern=E,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Number(n.value)}catch{}let i=n.value;if(typeof i==`number`&&!Number.isNaN(i)&&Number.isFinite(i))return n;let a=typeof i==`number`?Number.isNaN(i)?`NaN`:Number.isFinite(i)?void 0:String(i):void 0;return n.issues.push({expected:`number`,code:`invalid_type`,input:i,inst:e,...a?{received:a}:{}}),n}}),br=S(`$ZodNumberFormat`,(e,t)=>{_n.init(e,t),yr.init(e,t)}),xr=S(`$ZodBoolean`,(e,t)=>{D.init(e,t),e._zod.pattern=on,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=!!n.value}catch{}let i=n.value;return typeof i==`boolean`||n.issues.push({expected:`boolean`,code:`invalid_type`,input:i,inst:e}),n}}),Sr=S(`$ZodUndefined`,(e,t)=>{D.init(e,t),e._zod.pattern=cn,e._zod.values=new Set([void 0]),e._zod.parse=(t,n)=>{let r=t.value;return r===void 0||t.issues.push({expected:`undefined`,code:`invalid_type`,input:r,inst:e}),t}}),Cr=S(`$ZodNull`,(e,t)=>{D.init(e,t),e._zod.pattern=sn,e._zod.values=new Set([null]),e._zod.parse=(t,n)=>{let r=t.value;return r===null||t.issues.push({expected:`null`,code:`invalid_type`,input:r,inst:e}),t}}),wr=S(`$ZodAny`,(e,t)=>{D.init(e,t),e._zod.parse=e=>e}),Tr=S(`$ZodUnknown`,(e,t)=>{D.init(e,t),e._zod.parse=e=>e}),Er=S(`$ZodNever`,(e,t)=>{D.init(e,t),e._zod.parse=(t,n)=>(t.issues.push({expected:`never`,code:`invalid_type`,input:t.value,inst:e}),t)});function Dr(e,t,n){e.issues.length&&t.issues.push(...Oe(n,e.issues)),t.value[n]=e.value}var Or=S(`$ZodArray`,(e,t)=>{D.init(e,t);let n=C.memoizer;n?.attach(e),e._zod.parse=(r,i)=>{let a=r.value;if(!Array.isArray(a))return r.issues.push({expected:`array`,code:`invalid_type`,input:a,inst:e}),r;r.value=n?n.alloc(e,r,Array(a.length),i):Array(a.length);let o=[],s=i?.abortEarly;for(let e=0;e<a.length;e++){let n=a[e],c=t.element._zod.run({value:n,issues:[]},i);if(c instanceof Promise)o.push(c.then(t=>Dr(t,r,e)));else if(Dr(c,r,e),s&&c.issues.length!==0&&b(c))break}return o.length?Promise.all(o).then(()=>r):r}});function kr(e,t,n,r,i,a){let o=n in r,s=a===`optional`;if(o||!s||i!==`optional`){if(e.issues.length){if(i!==void 0&&s&&!o)return;t.issues.push(...Oe(n,e.issues))}if(!o&&i===void 0){e.issues.length||t.issues.push({code:`invalid_type`,expected:`nonoptional`,input:void 0,path:[n]});return}e.value===void 0?(o||i===`defaulted`&&!s)&&(t.value[n]=void 0):t.value[n]=e.value}}var Ar=[];function jr(e){let t=Object.keys(e.shape),n=Object.getOwnPropertySymbols(e.shape),r=n.length?n:Ar,i=r.length?[...t,...r]:t;for(let t of i)if(!e.shape?.[t]?._zod?.traits?.has(`$ZodType`))throw Error(`Invalid element at key "${String(t)}": expected a Zod schema`);let a=he(e.shape);return{...e,allKeys:i,symbolKeys:r,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(a)}}function Mr(e,t,n,r,i,a,o){let s=[],c=i.keySet,l=i.catchall._zod,u=l.def.type,d=l.optin,f=l.optout,p=0;for(let i in t){if(o&&n.issues.length!==p){if(b(n,p))break;p=n.issues.length}if(c.has(i))continue;if(i===`__proto__`){u===`never`&&s.push(i);continue}if(u===`never`){s.push(i);continue}let a=l.run({value:t[i],issues:[]},r);a instanceof Promise?e.push(a.then(e=>kr(e,n,i,t,d,f))):kr(a,n,i,t,d,f)}return s.length&&n.issues.push({code:`unrecognized_keys`,keys:s,input:t,inst:a,continue:!0}),e.length?Promise.all(e).then(()=>n):n}var Nr=S(`$ZodObject`,(e,t)=>{D.init(e,t);let n=Object.getOwnPropertyDescriptor(t,`shape`),r=n?.get?n.get.raw:t.shape??{};if(r){let e=()=>{let n={...r};return Object.defineProperty(t,"shape",{value:n}),e.raw=n,n};e.raw=r,Object.defineProperty(t,"shape",{get:e})}let i=l(()=>jr(t));x(e,`propValues`,e=>{let t=e.def.shape,n={};for(let e in t){let r=t[e]._zod;if(r.values){Object.prototype.hasOwnProperty.call(n,e)||h(n,e,new Set);for(let t of r.values)n[e].add(t);r.optin!==void 0&&n[e].add(void 0)}}return n});let a=ce,o=t.catchall,s,c=C.memoizer;c?.attach(e),e._zod.parse=(t,n)=>{s??=i.value;let r=t.value;if(!a(r))return t.issues.push({expected:`object`,code:`invalid_type`,input:r,inst:e}),t;t.value=c?c.alloc(e,t,{},n):{};let l=[],u=s.shape,d=n?.abortEarly,f=t.issues.length;for(let e of s.allKeys){if(d&&t.issues.length!==f){if(b(t,f))break;f=t.issues.length}if(e===`__proto__`)continue;let i=u[e],a=i._zod.optin,o=i._zod.optout,s=i._zod.run({value:r[e],issues:[]},n);s instanceof Promise?l.push(s.then(n=>kr(n,t,e,r,a,o))):kr(s,t,e,r,a,o)}return o?Mr(l,r,t,n,i.value,e,d===!0):l.length?Promise.all(l).then(()=>t):t}}),Pr=S(`$ZodObjectJIT`,(e,t)=>{Nr.init(e,t);let n=e._zod.parse,r=l(()=>jr(t)),i=C.memoizer,a=t=>{let n=r.value,a=n.symbolKeys,o=new kn([`payload`,`ctx`],{shape:t,inst:e,memo:i,syms:a}),s=e=>`shape[${e}]._zod.run({ value: input[${e}], issues: [] }, ctx)`,c=(e,t)=>`
12
+ let ${e}_ab = false;
12
13
  for (let i = 0; i < ${e}.issues.length; i++) {
13
14
  const iss = ${e}.issues[i];
14
15
  iss.path = iss.path ? [${t}, ...iss.path] : [${t}];
15
16
  payload.issues.push(iss);
16
- }`;o.write(`const input = payload.value;`);let l=Object.create(null),u=0;for(let e of n.allKeys)l[e]=`key_${u++}`;o.write(i?`const newResult = memo.alloc(inst, payload, {}, ctx);`:`const newResult = {};`);for(let e of n.allKeys){if(e===`__proto__`)continue;let n=l[e],r=typeof e==`symbol`?`syms[${a.indexOf(e)}]`:ee(e),i=`${r} in input`,u=t[e],d=u?._zod?.optin,f=d!==void 0,p=u?._zod?.optout===`optional`;if(o.write(`const ${n} = ${s(r)};`),f&&p){let e=d===`optional`?`${n}_present`:`${n}.value !== undefined || ${n}_present`;o.write(`
17
+ if (iss.continue !== true) ${e}_ab = true;
18
+ }
19
+ if (${e}_ab && ctx && ctx.abortEarly) {
20
+ payload.value = newResult;
21
+ return payload;
22
+ }`;o.write(`const input = payload.value;`);let l=Object.create(null),u=0;for(let e of n.allKeys)l[e]=`key_${u++}`;o.write(i?`const newResult = memo.alloc(inst, payload, {}, ctx);`:`const newResult = {};`);for(let e of n.allKeys){if(e===`__proto__`)continue;let n=l[e],r=typeof e==`symbol`?`syms[${a.indexOf(e)}]`:ae(e),i=`${r} in input`,u=t[e],d=u?._zod?.optin,f=d!==void 0,p=u?._zod?.optout===`optional`;if(o.write(`const ${n} = ${s(r)};`),f&&p){let e=d===`optional`?`${n}_present`:`${n}.value !== undefined || ${n}_present`;o.write(`
17
23
  const ${n}_present = ${i};
18
24
  if (!${n}.issues.length || ${n}_present) {
19
25
  if (${n}.issues.length) {${c(n,r)}
@@ -24,19 +30,14 @@ var e=Object.defineProperty,t=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exp
24
30
  }
25
31
  }
26
32
 
27
- `)}else f?o.write(`
33
+ `)}else f?(o.write(`
28
34
  if (${n}.issues.length) {${c(n,r)}
29
35
  }
30
-
31
- if (${n}.value === undefined) {
32
- if (${i}) {
33
- newResult[${r}] = undefined;
34
- }
35
- } else {
36
+ `),d===`defaulted`?o.write(`newResult[${r}] = ${n}.value;`):o.write(`
37
+ if (${n}.value !== undefined || ${i}) {
36
38
  newResult[${r}] = ${n}.value;
37
39
  }
38
-
39
- `):o.write(`
40
+ `)):o.write(`
40
41
  const ${n}_present = ${i};
41
42
  if (${n}.issues.length) {${c(n,r)}
42
43
  }
@@ -47,21 +48,25 @@ var e=Object.defineProperty,t=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exp
47
48
  input: undefined,
48
49
  path: [${r}]
49
50
  });
51
+ if (ctx && ctx.abortEarly) {
52
+ payload.value = newResult;
53
+ return payload;
54
+ }
50
55
  }
51
56
 
52
57
  if (${n}_present) {
53
58
  newResult[${r}] = ${n}.value;
54
59
  }
55
60
 
56
- `)}return o.write(`payload.value = newResult;`),o.write(`return payload;`),o.compile()},o,s=g,l=!x.jitless,u=l&&re.value,d=t.catchall,f;e._zod.parse=(i,c)=>{f??=r.value;let p=i.value;return s(p)?l&&u&&c?.async===!1&&c.jitless!==!0?(o||=a(t.shape),i=o(i,c),d?gr([],p,i,c,f,e):i):n(i,c):(i.issues.push({expected:`object`,code:`invalid_type`,input:p,inst:e}),i)}});function br(e,t,n,r){for(let n of e)if(n.issues.length===0)return t.value=n.value,t;let i=e.filter(e=>!ye(e));return i.length===1?(t.value=i[0].value,i[0]):(t.issues.push({code:`invalid_union`,input:t.value,inst:n,errors:e.map(e=>e.issues.map(e=>v(e,r,S())))}),t)}var xr=b(`$ZodUnion`,(e,t)=>{T.init(e,t),y(e,`optin`,e=>e.def.options.some(e=>e._zod.optin===`defaulted`)?`defaulted`:e.def.options.some(e=>e._zod.optin!==void 0)?`optional`:void 0),y(e,`optout`,e=>e.def.options.some(e=>e._zod.optout===`optional`)?`optional`:void 0),y(e,`values`,e=>{if(e.def.options.every(e=>e._zod.values))return new Set(e.def.options.flatMap(e=>Array.from(e._zod.values)))}),y(e,`pattern`,e=>{if(e.def.options.every(e=>e._zod.pattern)){let t=e.def.options.map(e=>e._zod.pattern);return RegExp(`^(${t.map(e=>u(e.source)).join(`|`)})$`)}});let n=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(r,i)=>{if(n)return n(r,i);let a=!1,o=[];for(let e of t.options){let t=e._zod.run({value:r.value,issues:[]},i);if(t instanceof Promise)o.push(t),a=!0;else{if(t.issues.length===0)return t;o.push(t)}}return a?Promise.all(o).then(t=>br(t,r,e,i)):br(o,r,e,i)}}),Sr=b(`$ZodDiscriminatedUnion`,(e,t)=>{t.inclusive=!1,xr.init(e,t);let n=e._zod.parse;y(e,`propValues`,e=>{let t={};for(let n of e.def.options){let r=n._zod.propValues;if(!r||Object.keys(r).length===0)throw Error(`Invalid discriminated union option at index "${e.def.options.indexOf(n)}"`);for(let[e,n]of Object.entries(r)){Object.prototype.hasOwnProperty.call(t,e)||m(t,e,new Set);for(let r of n)t[e].add(r)}}return t}),t.options.forEach((e,n)=>{let r=_r.get(e._zod.def);if(r&&!Object.prototype.hasOwnProperty.call(r,t.discriminator))throw Error(`Invalid discriminated union option at index "${n}"`)});let r=c(()=>{let e=t.options,n=new Map;for(let r of e){let e=r._zod.propValues?.[t.discriminator];if(!e||e.size===0)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(r)}"`);for(let t of e){if(n.has(t))throw Error(`Duplicate discriminator value "${String(t)}"`);n.set(t,r)}}return n});e._zod.parse=(i,a)=>{let o=i.value;if(!g(o))return i.issues.push({code:`invalid_type`,expected:`object`,input:o,inst:e}),i;let s=r.value.get(o?.[t.discriminator]);return s?s._zod.run(i,a):t.unionFallback||a.direction===`backward`?n(i,a):(i.issues.push({code:`invalid_union`,errors:[],note:`No matching discriminator`,discriminator:t.discriminator,options:Array.from(r.value.keys()),input:o,path:[t.discriminator],inst:e}),i)}}),Cr=b(`$ZodIntersection`,(e,t)=>{T.init(e,t),e._zod.parse=(e,n)=>{let r=e.value,i=t.left._zod.run({value:r,issues:[]},n),a=t.right._zod.run({value:r,issues:[]},n);return i instanceof Promise||a instanceof Promise?Promise.all([i,a]).then(([t,n])=>Tr(e,t,n)):Tr(e,i,a)}});function wr(e,t){if(e===t||e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(ie(e)&&ie(t)){let n=Object.keys(t),r=Object.keys(e).filter(e=>n.indexOf(e)!==-1),i={...e,...t};Object.prototype.hasOwnProperty.call(i,`__proto__`)&&delete i.__proto__;for(let n of r){if(n===`__proto__`)continue;let r=wr(e[n],t[n]);if(!r.valid)return{valid:!1,mergeErrorPath:[n,...r.mergeErrorPath]};i[n]=r.data}return{valid:!0,data:i}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let n=[];for(let r=0;r<e.length;r++){let i=e[r],a=t[r],o=wr(i,a);if(!o.valid)return{valid:!1,mergeErrorPath:[r,...o.mergeErrorPath]};n.push(o.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function Tr(e,t,n){let r=new Map,i,a=new Map,o=(e,t)=>{let n;if(e.code===`unrecognized_keys`&&!e.path?.length)i??=e,n=e.keys;else if(e.code===`invalid_key`&&e.origin===`record`&&e.path?.length===1){let t=String(e.path[0]);a.has(t)||a.set(t,e),n=[t]}else return!1;for(let e of n)r.has(e)||r.set(e,{}),r.get(e)[t]=!0;return!0};for(let n of t.issues)o(n,`l`)||e.issues.push(n);for(let t of n.issues)o(t,`r`)||e.issues.push(t);let s=[...r].filter(([,e])=>e.l&&e.r).map(([e])=>e);if(s.length){let t=i?s.filter(e=>i.keys.includes(e)):[];t.length&&e.issues.push({...i,keys:t});for(let n of s)!t.includes(n)&&a.has(n)&&e.issues.push(a.get(n))}let c=wr(t.value,n.value);if(!c.valid){if(ye(e))return e;throw Error(`Unmergable intersection. Error path: ${JSON.stringify(c.mergeErrorPath)}`)}return e.value=c.data,e}var Er=b(`$ZodRecord`,(e,t)=>{T.init(e,t);let n=x.memoizer;n?.attach(e),e._zod.parse=(r,i)=>{let a=r.value;if(!ie(a))return r.issues.push({expected:`record`,code:`invalid_type`,input:a,inst:e}),r;let o=[],s=t.keyType._zod.values;if(s&&!t.partial){r.value=n?n.alloc(e,r,{},i):{};let c=new Set;for(let n of s)if(typeof n==`string`||typeof n==`number`||typeof n==`symbol`){if(c.add(typeof n==`number`?n.toString():n),n===`__proto__`)continue;let s=t.keyType._zod.run({value:n,issues:[]},i);if(s instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);if(s.issues.length){r.issues.push({code:`invalid_key`,origin:`record`,issues:s.issues.map(e=>v(e,i,S())),input:n,path:[n],inst:e});continue}let l=s.value;if(l===`__proto__`)continue;let u=t.valueType._zod.run({value:a[n],issues:[]},i);u instanceof Promise?o.push(u.then(e=>{e.issues.length&&r.issues.push(...xe(n,e.issues)),r.value[l]=e.value})):(u.issues.length&&r.issues.push(...xe(n,u.issues)),r.value[l]=u.value)}let l;for(let e in a)if(!c.has(e)){if(t.mode===`loose`){if(e===`__proto__`)continue;r.value[e]=a[e]}else l??=[],l.push(e)}l&&l.length>0&&r.issues.push({code:`unrecognized_keys`,input:a,inst:e,keys:l,continue:!0})}else{r.value=n?n.alloc(e,r,{},i):{};let c;for(let n of Reflect.ownKeys(a)){if(n===`__proto__`||!Object.prototype.propertyIsEnumerable.call(a,n))continue;let l=t.keyType._zod.run({value:n,issues:[]},i);if(l instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);if(typeof n==`string`&&Jt.test(n)&&l.issues.length){let e=t.keyType._zod.run({value:Number(n),issues:[]},i);if(e instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);e.issues.length===0&&(l=e)}if(l.issues.length){t.mode===`loose`?r.value[n]=a[n]:s?(c??=[],c.push(n)):r.issues.push({code:`invalid_key`,origin:`record`,issues:l.issues.map(e=>v(e,i,S())),input:n,path:[n],inst:e});continue}let u=l.value;if(u===`__proto__`)continue;let d=t.valueType._zod.run({value:a[n],issues:[]},i);d instanceof Promise?o.push(d.then(e=>{e.issues.length&&r.issues.push(...xe(n,e.issues)),r.value[u]=e.value})):(d.issues.length&&r.issues.push(...xe(n,d.issues)),r.value[u]=d.value)}c&&c.length>0&&r.issues.push({code:`unrecognized_keys`,input:a,inst:e,keys:c,continue:!0})}return o.length?Promise.all(o).then(()=>r):r}}),Dr=b(`$ZodEnum`,(e,t)=>{T.init(e,t);let n=a(t.entries),r=new Set(n);e._zod.values=r;let i=n.filter(e=>oe.has(typeof e));e._zod.pattern=RegExp(i.length?`^(${i.map(e=>se(e.toString())).join(`|`)})$`:`^[^\\s\\S]$`),e._zod.parse=(t,i)=>{let a=t.value;return r.has(a)||t.issues.push({code:`invalid_value`,values:n,input:a,inst:e}),t}}),Or=b(`$ZodLiteral`,(e,t)=>{T.init(e,t);let n=new Set(t.values);e._zod.values=n,e._zod.pattern=RegExp(t.values.length?`^(${t.values.map(e=>typeof e==`string`?se(e):e?se(e.toString()):String(e)).join(`|`)})$`:`^[^\\s\\S]$`),e._zod.parse=(r,i)=>{let a=r.value;return n.has(a)||r.issues.push({code:`invalid_value`,values:t.values,input:a,inst:e}),r}}),kr=b(`$ZodTransform`,(e,t)=>{T.init(e,t),e._zod.optin=`optional`,x.memoizer?.guard(e),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new Ke(e.constructor.name);let i=t.transform(n.value,n);if(r.async)return(i instanceof Promise?i:Promise.resolve(i)).then(e=>(n.value=e,n));if(i instanceof Promise)throw new Ge;return n.value=i,n}});function Ar(e,t){return e.value=t.issues.length?void 0:t.value,e}var jr=b(`$ZodOptional`,(e,t)=>{T.init(e,t),y(e,`optin`,e=>e.def.innerType._zod.optin===`defaulted`?`defaulted`:`optional`),e._zod.optout=`optional`,y(e,`values`,e=>{let t=e.def.innerType._zod.values;return t?new Set([...t,void 0]):void 0}),y(e,`pattern`,e=>{let t=e.def.innerType._zod.pattern;return t?RegExp(`^(${u(t.source)})?$`):void 0}),e._zod.parse=(e,n)=>{if(e.value===void 0){if(t.innerType._zod.optin!==`defaulted`)return e;let r=t.innerType._zod.run({value:e.value,issues:[]},n);return r instanceof Promise?r.then(t=>Ar(e,t)):Ar(e,r)}return t.innerType._zod.run(e,n)}}),Mr=b(`$ZodExactOptional`,(e,t)=>{jr.init(e,t),y(e,`values`,e=>e.def.innerType._zod.values),y(e,`pattern`,e=>e.def.innerType._zod.pattern),e._zod.parse=(e,n)=>t.innerType._zod.run(e,n)}),Nr=b(`$ZodNullable`,(e,t)=>{T.init(e,t),y(e,`optin`,e=>e.def.innerType._zod.optin),y(e,`optout`,e=>e.def.innerType._zod.optout),y(e,`pattern`,e=>{let t=e.def.innerType._zod.pattern;return t?RegExp(`^(${u(t.source)}|null)$`):void 0}),y(e,`values`,e=>e.def.innerType._zod.values?new Set([...e.def.innerType._zod.values,null]):void 0),e._zod.parse=(e,n)=>e.value===null?e:t.innerType._zod.run(e,n)}),Pr=b(`$ZodDefault`,(e,t)=>{T.init(e,t),e._zod.optin=`defaulted`,y(e,`values`,e=>e.def.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);if(e.value===void 0)return e.value=t.defaultValue,e;let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(e=>Fr(e,t)):Fr(r,t)}});function Fr(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}var Ir=b(`$ZodPrefault`,(e,t)=>{T.init(e,t),e._zod.optin=`defaulted`,y(e,`values`,e=>e.def.innerType._zod.values),e._zod.parse=(e,n)=>(n.direction===`backward`||e.value===void 0&&(e.value=t.defaultValue),t.innerType._zod.run(e,n))}),Lr=b(`$ZodNonOptional`,(e,t)=>{T.init(e,t),y(e,`values`,e=>{let t=e.def.innerType._zod.values;return t?new Set([...t].filter(e=>e!==void 0)):void 0}),e._zod.parse=(n,r)=>{let i=t.innerType._zod.run(n,r);return i instanceof Promise?i.then(t=>Rr(t,e)):Rr(i,e)}});function Rr(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:`invalid_type`,expected:`nonoptional`,input:e.value,inst:t}),e}function zr(e,t,n,r){return t.issues.length?(e.value=n.catchValue({...t,value:e.value,error:{issues:t.issues.map(e=>v(e,r,S()))},input:e.value}),e):(e.value=t.value,t.memo&&(e.memo=!0),e)}var Br=b(`$ZodCatch`,(e,t)=>{T.init(e,t),y(e,`optin`,e=>e.def.innerType._zod.optin===`defaulted`?`defaulted`:`optional`),y(e,`optout`,e=>e.def.innerType._zod.optout),y(e,`values`,e=>e.def.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run({value:e.value,issues:[]},n);return r instanceof Promise?r.then(r=>zr(e,r,t,n)):zr(e,r,t,n)}}),Vr=b(`$ZodPipe`,(e,t)=>{T.init(e,t),y(e,`values`,e=>e.def.in._zod.values),y(e,`optin`,e=>e.def.in._zod.optin),y(e,`optout`,e=>e.def.out._zod.optout),y(e,`propValues`,e=>e.def.in._zod.propValues),e._zod.parse=(e,n)=>{if(n.direction===`backward`){let r=t.out._zod.run(e,n);return r instanceof Promise?r.then(e=>Hr(e,t.in,n)):Hr(r,t.in,n)}let r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>Hr(e,t.out,n)):Hr(r,t.out,n)}});function Hr(e,t,n){return e.issues.some(e=>e.code!==`unrecognized_keys`)?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}var Ur=b(`$ZodPreprocess`,(e,t)=>{Vr.init(e,t)}),Wr=b(`$ZodReadonly`,(e,t)=>{T.init(e,t),y(e,`propValues`,e=>e.def.innerType._zod.propValues),y(e,`values`,e=>e.def.innerType._zod.values),y(e,`optin`,e=>e.def.innerType?._zod?.optin),y(e,`optout`,e=>e.def.innerType?._zod?.optout),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(Gr):Gr(r)}});function Gr(e){return e.memo||(e.value=Object.freeze(e.value)),e}var Kr=b(`$ZodLazy`,(e,t)=>{T.init(e,t),p(e._zod,`innerType`,()=>{let e=t;return e._cachedInner||=t.getter(),e._cachedInner}),y(e,`pattern`,e=>e.innerType?._zod?.pattern),y(e,`propValues`,e=>e.innerType?._zod?.propValues),y(e,`optin`,e=>e.innerType?._zod?.optin??void 0),y(e,`optout`,e=>e.innerType?._zod?.optout??void 0),e._zod.parse=(t,n)=>e._zod.innerType._zod.run(t,n)}),qr=b(`$ZodCustom`,(e,t)=>{w.init(e,t),T.init(e,t),e._zod.parse=(e,t)=>e,e._zod.check=n=>{let r=n.value,i=t.fn(r);if(i instanceof Promise)return i.then(t=>Jr(t,n,r,e));Jr(i,n,r,e)}});function Jr(e,t,n,r){if(!e){let e={code:`custom`,input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(e.params=r._zod.def.params),t.issues.push(Oe(e))}}var Yr=class extends Error{constructor(){super(`Cannot parse a reference cycle that closes through a transform`),this.name=`ZodCyclicError`}},Xr=`~memo`,Zr=[];function Qr(e){return e.map(e=>e.path?{...e,path:e.path.slice()}:{...e})}var $r=new WeakMap;function ei(e,t){let n=$r.get(e);if(n!==void 0)return n;if(t.has(e))return!0;t.add(e);let r=!1,i=e=>{!r&&e?._zod&&ei(e,t)&&(r=!0)},a=e._zod.def;switch(a.type){case`object`:for(let e of Reflect.ownKeys(a.shape))i(a.shape[e]);i(a.catchall);break;case`array`:i(a.element);break;case`tuple`:for(let e of a.items)i(e);i(a.rest);break;case`record`:case`map`:i(a.keyType),i(a.valueType);break;case`set`:i(a.valueType);break;case`union`:for(let e of a.options)i(e);break;case`intersection`:i(a.left),i(a.right);break;case`optional`:case`nullable`:case`default`:case`prefault`:case`catch`:case`readonly`:case`nonoptional`:case`promise`:case`success`:i(a.innerType);break;case`pipe`:i(a.in),i(a.out);break;case`function`:i(a.input),i(a.output);break;case`lazy`:i(e._zod.innerType);break;case`template_literal`:case`string`:case`number`:case`int`:case`boolean`:case`bigint`:case`symbol`:case`undefined`:case`null`:case`void`:case`never`:case`any`:case`unknown`:case`date`:case`nan`:case`enum`:case`literal`:case`file`:case`transform`:case`custom`:break;default:for(let e in a){let t=Object.getOwnPropertyDescriptor(a,e);if(!t||t.get)continue;let n=t.value;if(n&&typeof n==`object`){if(n._zod)i(n);else if(Array.isArray(n))for(let e of n)i(e)}}}return t.delete(e),$r.set(e,r),r}function ti(e,t){let n=e.buckets.get(t);return n||(n=new Map,e.buckets.set(t,n)),n}var ni,ri=[],ii={alloc(e,t,n){let r=ni;if(!r)return n;ni=void 0;let i={value:n,issues:null};return r.set(t.value,i),ri.push(i),n},guard(e){var t;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let t=e._zod.parse,n=(e,n)=>{if(n.direction!==`backward`&&oi(n,e.value))throw new Yr;return t(e,n)};e._zod.parse=n,e._zod.run===t&&(e._zod.run=n)})},attach(e){var t;let n,r,i;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let t=e._zod.parse,a=(o,s)=>{if(n===void 0&&(n=ei(e,new Set),!n))return e._zod.parse=t,e._zod.run===a&&(e._zod.run=t),t(o,s);let c=o.value;if(typeof c!=`object`||!c)return t(o,s);let l=s[Xr];l||(l={buckets:new Map,backEdges:void 0},s[Xr]=l);let u;r===s?u=i:(u=ti(l,e),r=s,i=u);let d=u.get(c);if(d)return o.value=d.value,d.issues?d.issues.length&&o.issues.push(...Qr(d.issues)):(o.memo=!0,l.backEdges??(l.backEdges=new Set),l.backEdges.add(d.value)),o;ni=u;let f=ri.length,p=t(o,s);ni=void 0;let m=ri.length>f?ri.pop():void 0;return p instanceof Promise?p.then(e=>(m&&(m.issues=e.issues.length?Qr(e.issues):Zr),e)):(m&&(m.issues=p.issues.length?Qr(p.issues):Zr),p)};e._zod.parse=a,e._zod.run===t&&(e._zod.run=a)})}};function ai(){return ii}function oi(e,t){let n=e[Xr]?.backEdges;return n!==void 0&&typeof t==`object`&&!!t&&n.has(t)}var si=()=>{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(t){return e[t]??null}let n={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`,credit_card:`credit card number`,jwt:`JWT`,template_literal:`input`},r={nan:`NaN`};function i(e,t){return e===`number`&&typeof t==`number`&&!Number.isFinite(t)?String(t):r[e]??e}return e=>{switch(e.code){case`invalid_type`:return`Invalid input: expected ${i(e.expected)}, received ${i(De(e.input),e.input)}`;case`invalid_value`:return e.values.length===1?`Invalid input: expected ${le(e.values[0])}`:`Invalid option: expected one of ${o(e.values,`|`)}`;case`too_big`:{let n=e.exact?`exactly `:e.inclusive?`<=`:`<`,r=t(e.origin);return r?`Too big: expected ${e.origin??`value`} to have ${n}${e.maximum.toString()} ${r.unit??`elements`}`:`Too big: expected ${e.origin??`value`} to be ${n}${e.maximum.toString()}`}case`too_small`:{let n=e.exact?`exactly `:e.inclusive?`>=`:`>`,r=t(e.origin);return r?`Too small: expected ${e.origin} to have ${n}${e.minimum.toString()} ${r.unit}`:`Too small: expected ${e.origin} to be ${n}${e.minimum.toString()}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`Invalid string: must start with "${t.prefix}"`:t.format===`ends_with`?`Invalid string: must end with "${t.suffix}"`:t.format===`includes`?`Invalid string: must include "${t.includes}"`:t.format===`regex`?`Invalid string: must match pattern ${t.pattern}`:`Invalid ${n[t.format]??e.format}`}case`not_multiple_of`:return`Invalid number: must be a multiple of ${e.divisor}`;case`unrecognized_keys`:return`Unrecognized key${e.keys.length>1?`s`:``}: ${o(e.keys,`, `)}`;case`invalid_key`:return`Invalid key in ${e.origin}`;case`invalid_union`:return e.options&&Array.isArray(e.options)&&e.options.length>0?`Invalid discriminator value. Expected ${e.options.map(e=>`'${e}'`).join(` | `)}`:e.inclusive===!1?`Invalid input: more than one option matched`:`Invalid input`;case`invalid_element`:return`Invalid value in ${e.origin}`;default:return`Invalid input`}}};function ci(){return{localeError:si()}}var li,ui=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){let n=t[0];return this._map.set(e,n),n&&typeof n==`object`&&`id`in n&&this._idmap.set(n.id,e),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let t=this._map.get(e);return t&&typeof t==`object`&&`id`in t&&this._idmap.delete(t.id),this._map.delete(e),this}get(e){let t=e._zod.parent;if(t){let n={...this.get(t)??{}};delete n.id;let r={...n,...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 di(){return new ui}(li=globalThis).__zod_globalRegistry??(li.__zod_globalRegistry=di());var fi=globalThis.__zod_globalRegistry;function pi(e,t){return new e({type:`string`,..._(t)})}function mi(e,t){return new e({type:`string`,format:`email`,check:`string_format`,abort:!1,..._(t)})}function hi(e,t){return new e({type:`string`,format:`guid`,check:`string_format`,abort:!1,..._(t)})}function gi(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,..._(t)})}function _i(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v4`,..._(t)})}function vi(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v6`,..._(t)})}function yi(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v7`,..._(t)})}function bi(e,t){return new e({type:`string`,format:`url`,check:`string_format`,abort:!1,..._(t)})}function xi(e,t){return new e({type:`string`,format:`emoji`,check:`string_format`,abort:!1,..._(t)})}function Si(e,t){return new e({type:`string`,format:`nanoid`,check:`string_format`,abort:!1,..._(t)})}function Ci(e,t){return new e({type:`string`,format:`cuid`,check:`string_format`,abort:!1,..._(t)})}function wi(e,t){return new e({type:`string`,format:`cuid2`,check:`string_format`,abort:!1,..._(t)})}function Ti(e,t){return new e({type:`string`,format:`ulid`,check:`string_format`,abort:!1,..._(t)})}function Ei(e,t){return new e({type:`string`,format:`xid`,check:`string_format`,abort:!1,..._(t)})}function Di(e,t){return new e({type:`string`,format:`ksuid`,check:`string_format`,abort:!1,..._(t)})}function Oi(e,t){return new e({type:`string`,format:`ipv4`,check:`string_format`,abort:!1,..._(t)})}function ki(e,t){return new e({type:`string`,format:`ipv6`,check:`string_format`,abort:!1,..._(t)})}function Ai(e,t){return new e({type:`string`,format:`cidrv4`,check:`string_format`,abort:!1,..._(t)})}function ji(e,t){return new e({type:`string`,format:`cidrv6`,check:`string_format`,abort:!1,..._(t)})}function Mi(e,t){return new e({type:`string`,format:`base64`,check:`string_format`,abort:!1,..._(t)})}function Ni(e,t){return new e({type:`string`,format:`base64url`,check:`string_format`,abort:!1,..._(t)})}function Pi(e,t){return new e({type:`string`,format:`e164`,check:`string_format`,abort:!1,..._(t)})}function Fi(e,t){return new e({type:`string`,format:`jwt`,check:`string_format`,abort:!1,..._(t)})}function Ii(e,t){return new e({type:`string`,format:`datetime`,check:`string_format`,offset:!1,local:!1,precision:null,..._(t)})}function Li(e,t){return new e({type:`string`,format:`date`,check:`string_format`,..._(t)})}function Ri(e,t){return new e({type:`string`,format:`time`,check:`string_format`,precision:null,..._(t)})}function zi(e,t){return new e({type:`string`,format:`duration`,check:`string_format`,..._(t)})}function Bi(e,t){return new e({type:`number`,checks:[],..._(t)})}function Vi(e,t){return new e({type:`number`,coerce:!0,checks:[],..._(t)})}function Hi(e,t){return new e({type:`number`,check:`number_format`,abort:!1,format:`safeint`,..._(t)})}function Ui(e,t){return new e({type:`boolean`,..._(t)})}function Wi(e,t){return new e({type:`undefined`,..._(t)})}function Gi(e,t){return new e({type:`null`,..._(t)})}function Ki(e){return new e({type:`any`})}function qi(e){return new e({type:`unknown`})}function Ji(e,t){return new e({type:`never`,..._(t)})}function Yi(e,t){return new nn({check:`less_than`,..._(t),value:e,inclusive:!1})}function Xi(e,t){return new nn({check:`less_than`,..._(t),value:e,inclusive:!0})}function Zi(e,t){return new rn({check:`greater_than`,..._(t),value:e,inclusive:!1})}function Qi(e,t){return new rn({check:`greater_than`,..._(t),value:e,inclusive:!0})}function $i(e,t){return new an({check:`multiple_of`,..._(t),value:e})}function ea(e,t){return new sn({check:`max_length`,..._(t),maximum:e})}function ta(e,t){return new cn({check:`min_length`,..._(t),minimum:e})}function na(e,t){return new ln({check:`length_equals`,..._(t),length:e})}function ra(e,t){return new dn({check:`string_format`,format:`regex`,..._(t),pattern:e})}function ia(e){return new fn({check:`string_format`,format:`lowercase`,..._(e)})}function aa(e){return new pn({check:`string_format`,format:`uppercase`,..._(e)})}function oa(e,t){return new mn({check:`string_format`,format:`includes`,..._(t),includes:e})}function sa(e,t){return new hn({check:`string_format`,format:`starts_with`,..._(t),prefix:e})}function ca(e,t){return new gn({check:`string_format`,format:`ends_with`,..._(t),suffix:e})}function la(e){return new _n({check:`overwrite`,tx:e})}function ua(e){return la(t=>t.normalize(e))}function da(){return la(e=>e.trim())}function fa(){return la(e=>e.toLowerCase())}function pa(){return la(e=>e.toUpperCase())}function ma(){return la(e=>te(e))}function ha(e,t,n){return new e({type:`array`,element:t,..._(n)})}function ga(e,t,n){return new e({type:`custom`,check:`custom`,fn:t,..._(n)})}function _a(e,t){let n=va(t=>(t.addIssue=e=>{if(typeof e==`string`)t.issues.push(Oe(e,t.value,n._zod.def));else{let r=e;r.fatal&&(r.continue=!1),r.code??=`custom`,`input`in r||(r.input=t.value),r.inst??=n,r.continue??=!n._zod.def.abort,t.issues.push(Oe(r))}},e(t.value,t)),t);return n}function va(e,t){let n=new w({check:`custom`,..._(t)});return n._zod.check=e,n}function ya(e,...t){for(let n of t)for(let t of Reflect.ownKeys(n))Object.prototype.propertyIsEnumerable.call(n,t)&&m(e,t,n[t]);return e}function ba(e){let t=e?.target??`draft-2020-12`;return t===`draft-4`&&(t=`draft-04`),t===`draft-7`&&(t=`draft-07`),{processors:e.processors??{},metadataRegistry:e?.metadata??fi,target:t,unrepresentable:e?.unrepresentable??`throw`,override:e?.override??(()=>{}),io:e?.io??`output`,counter:0,seen:new Map,sharedDefsExtractedFor:void 0,sharedEmitDoneFor:void 0,cycles:e?.cycles??`ref`,reused:e?.reused??`inline`,intersections:[],deferred:[],external:e?.external??void 0}}function D(e,t,n,r,i){let a=typeof t.unrepresentable==`function`?t.unrepresentable({zodSchema:e,path:r.path,message:i}):t.unrepresentable;if(a===`any`)return!1;if(a===void 0||a===`throw`)throw Error(i);return Object.assign(n,a),!0}function O(e,t,n={path:[],schemaPath:[]}){var r;let i=e._zod.def,a=t.seen.get(e);if(a)return a.count++,n.schemaPath.includes(e)&&(a.cycle=n.path),a.schema;let o={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,o),t.sharedDefsExtractedFor=void 0,t.sharedEmitDoneFor=void 0;let s=e._zod.toJSONSchema?.();if(s)o.schema=s;else{let r={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,o.schema,r);else{let n=o.schema,a=t.processors[i.type];if(!a)throw Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);a(e,t,n,r)}let a=e._zod.parent;a&&(o.ref||=a,O(a,t,r),t.seen.get(a).isParent=!0)}let c=t.metadataRegistry.get(e);return c&&ya(o.schema,c),t.io===`input`&&k(e)&&(delete o.schema.examples,delete o.schema.default),t.io===`input`&&`_prefault`in o.schema&&((r=o.schema).default??(r.default=o.schema._prefault)),delete o.schema._prefault,t.seen.get(e).schema}function xa(e){return e.replace(/~/g,`~0`).replace(/\//g,`~1`)}function Sa(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);if(e.external&&e.sharedDefsExtractedFor===e.external)return;let r=new Map;for(let t of e.seen.entries()){let n=e.metadataRegistry.get(t[0])?.id;if(n){let e=r.get(n);if(e&&e!==t[0])throw Error(`Duplicate schema id "${n}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(n,t[0])}}let i=t=>{let r=e.target===`draft-2020-12`?`$defs`:`definitions`;if(e.external){let n=e.external.registry.get(t[0])?.id,i=e.external.uri??(e=>e);if(n)return{ref:i(n)};let a=t[1].defId??t[1].schema.id??`schema${e.counter++}`;return t[1].defId=a,{defId:a,ref:`${i(`__shared`)}#/${r}/${xa(a)}`}}let i=`#/${r}/`;if(t[1]===n&&!t[1].schema.id)return{ref:`#`};let a=t[1].schema.id??`__schema${e.counter++}`;return{defId:a,ref:i+xa(a)}},a=e=>{if(e[1].schema.$ref)return;let t=e[1],{ref:n,defId:r}=i(e);t.def={...t.schema},r&&(t.defId=r);let a=t.schema;for(let e in a)delete a[e];a.$ref=n};if(e.cycles===`throw`)for(let t of e.seen.entries()){let e=t[1];if(e.cycle)throw Error(`Cycle detected: #/${e.cycle?.join(`/`)}/<root>
61
+ `)}return o.write(`payload.value = newResult;`),o.write(`return payload;`),o.compile()},o,s=ce,c=!C.jitless,u=c&&le.value,d=t.catchall,f;e._zod.parse=(i,l)=>{f??=r.value;let p=i.value;return s(p)?c&&u&&l?.async===!1&&l.jitless!==!0?(o||=a(t.shape),i=o(i,l),d?Mr([],p,i,l,f,e,l?.abortEarly===!0):i):n(i,l):(i.issues.push({expected:`object`,code:`invalid_type`,input:p,inst:e}),i)}});function Fr(e,t,n,r){for(let n of e)if(n.issues.length===0)return t.value=n.value,t;let i=e.filter(e=>!b(e));return i.length===1?(t.value=i[0].value,i[0]):(t.issues.push({code:`invalid_union`,input:t.value,inst:n,errors:e.map(e=>e.issues.map(e=>je(e,r,w())))}),t)}var Ir=S(`$ZodUnion`,(e,t)=>{D.init(e,t),x(e,`optin`,e=>e.def.options.some(e=>e._zod.optin===`defaulted`)?`defaulted`:e.def.options.some(e=>e._zod.optin!==void 0)?`optional`:void 0),x(e,`optout`,e=>e.def.options.some(e=>e._zod.optout===`optional`)?`optional`:void 0),x(e,`values`,e=>{if(e.def.options.every(e=>e._zod.values))return new Set(e.def.options.flatMap(e=>Array.from(e._zod.values)))}),x(e,`pattern`,e=>{if(e.def.options.every(e=>e._zod.pattern)){let t=e.def.options.map(e=>e._zod.pattern);return RegExp(`^(${t.map(e=>d(e.source)).join(`|`)})$`)}});let n=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(r,i)=>{if(n)return n(r,i);let a=!1,o=[];for(let e of t.options){let t=e._zod.run({value:r.value,issues:[]},i);if(t instanceof Promise)o.push(t),a=!0;else{if(t.issues.length===0)return t;o.push(t)}}return a?Promise.all(o).then(t=>Fr(t,r,e,i)):Fr(o,r,e,i)}});function Lr(e){let t=new Map;for(let n of e.options){let r=n._zod.propValues?.[e.discriminator];if(!r||r.size===0)throw Error(`Invalid discriminated union option at index "${e.options.indexOf(n)}"`);for(let e of r)if(t.has(e)){if(e!==void 0)throw Error(`Duplicate discriminator value "${String(e)}"`);t.set(e,null)}else t.set(e,n)}return t}var Rr=S(`$ZodDiscriminatedUnion`,(e,t)=>{t.inclusive=!1,Ir.init(e,t);let n=e._zod.parse;x(e,`propValues`,e=>{let t={},n=0;for(let r of e.def.options){let i=r._zod.propValues;if(!i||Object.keys(i).length===0)throw Error(`Invalid discriminated union option at index "${e.def.options.indexOf(r)}"`);i[e.def.discriminator]?.has(void 0)&&n++;for(let[e,n]of Object.entries(i)){Object.prototype.hasOwnProperty.call(t,e)||h(t,e,new Set);for(let r of n)t[e].add(r)}}return!e.def.unionFallback&&n>1&&t[e.def.discriminator]?.delete(void 0),t}),t.options.forEach((e,n)=>{let r=ee(e._zod.def);if(r&&!Object.prototype.hasOwnProperty.call(r,t.discriminator))throw Error(`Invalid discriminated union option at index "${n}"`)});let r=l(()=>Lr(t));e._zod.parse=(i,a)=>{let o=i.value;if(!ce(o))return i.issues.push({code:`invalid_type`,expected:`object`,input:o,inst:e}),i;let s=o?.[t.discriminator],c=r.value.get(s);return c&&(s!==void 0||a.direction!==`backward`)?c._zod.run(i,a):t.unionFallback||a.direction===`backward`?n(i,a):(i.issues.push({code:`invalid_union`,errors:[],note:`No matching discriminator`,discriminator:t.discriminator,options:Array.from(r.value.keys()).filter(e=>r.value.get(e)!==null),input:o,path:[t.discriminator],inst:e}),i)}}),zr=S(`$ZodIntersection`,(e,t)=>{D.init(e,t),e._zod.parse=(e,n)=>{let r=e.value,i=t.left._zod.run({value:r,issues:[]},n),a=t.right._zod.run({value:r,issues:[]},n);return i instanceof Promise||a instanceof Promise?Promise.all([i,a]).then(([t,n])=>Vr(e,t,n)):Vr(e,i,a)}});function Br(e,t){if(e===t||e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(ue(e)&&ue(t)){let n=Object.keys(t),r=Object.keys(e).filter(e=>n.indexOf(e)!==-1),i={...e,...t};Object.prototype.hasOwnProperty.call(i,`__proto__`)&&delete i.__proto__;for(let n of r){if(n===`__proto__`)continue;let r=Br(e[n],t[n]);if(!r.valid)return{valid:!1,mergeErrorPath:[n,...r.mergeErrorPath]};i[n]=r.data}return{valid:!0,data:i}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let n=[];for(let r=0;r<e.length;r++){let i=e[r],a=t[r],o=Br(i,a);if(!o.valid)return{valid:!1,mergeErrorPath:[r,...o.mergeErrorPath]};n.push(o.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function Vr(e,t,n){let r=new Map,i,a=new Map,o=(e,t)=>{let n;if(e.code===`unrecognized_keys`&&!e.path?.length)i??=e,n=e.keys;else if(e.code===`invalid_key`&&e.origin===`record`&&e.path?.length===1){let t=String(e.path[0]);a.has(t)||a.set(t,e),n=[t]}else return!1;for(let e of n)r.has(e)||r.set(e,{}),r.get(e)[t]=!0;return!0};for(let n of t.issues)o(n,`l`)||e.issues.push(n);for(let t of n.issues)o(t,`r`)||e.issues.push(t);let s=[...r].filter(([,e])=>e.l&&e.r).map(([e])=>e);if(s.length){let t=i?s.filter(e=>i.keys.includes(e)):[];t.length&&e.issues.push({...i,keys:t});for(let n of s)!t.includes(n)&&a.has(n)&&e.issues.push(a.get(n))}let c=Br(t.value,n.value);if(!c.valid){if(b(e))return e;throw Error(`Unmergable intersection. Error path: ${JSON.stringify(c.mergeErrorPath)}`)}return e.value=c.data,e}var Hr=S(`$ZodRecord`,(e,t)=>{D.init(e,t);let n=C.memoizer;n?.attach(e),e._zod.parse=(r,i)=>{let a=r.value;if(!ue(a))return r.issues.push({expected:`record`,code:`invalid_type`,input:a,inst:e}),r;let o=[],s=t.keyType._zod.values;if(s&&!t.partial){r.value=n?n.alloc(e,r,{},i):{};let c=new Set;for(let n of s)if(typeof n==`string`||typeof n==`number`||typeof n==`symbol`){if(c.add(typeof n==`number`?n.toString():n),n===`__proto__`)continue;let s=t.keyType._zod.run({value:n,issues:[]},i);if(s instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);if(s.issues.length){r.issues.push({code:`invalid_key`,origin:`record`,issues:s.issues.map(e=>je(e,i,w())),input:n,path:[n],inst:e});continue}let l=s.value;if(l===`__proto__`)continue;let u=t.valueType._zod.run({value:a[n],issues:[]},i);u instanceof Promise?o.push(u.then(e=>{e.issues.length&&r.issues.push(...Oe(n,e.issues)),r.value[l]=e.value})):(u.issues.length&&r.issues.push(...Oe(n,u.issues)),r.value[l]=u.value)}let l;for(let e in a)if(!c.has(e)){if(t.mode===`loose`){if(e===`__proto__`)continue;r.value[e]=a[e]}else l??=[],l.push(e)}l&&l.length>0&&r.issues.push({code:`unrecognized_keys`,input:a,inst:e,keys:l,continue:!0})}else{r.value=n?n.alloc(e,r,{},i):{};let c;for(let n of Reflect.ownKeys(a)){if(n===`__proto__`||!Object.prototype.propertyIsEnumerable.call(a,n))continue;let l=t.keyType._zod.run({value:n,issues:[]},i);if(l instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);if(typeof n==`string`&&E.test(n)&&l.issues.length){let e=t.keyType._zod.run({value:Number(n),issues:[]},i);if(e instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);e.issues.length===0&&(l=e)}if(l.issues.length){t.mode===`loose`?r.value[n]=a[n]:s?(c??=[],c.push(n)):r.issues.push({code:`invalid_key`,origin:`record`,issues:l.issues.map(e=>je(e,i,w())),input:n,path:[n],inst:e});continue}let u=l.value;if(u===`__proto__`)continue;let d=t.valueType._zod.run({value:a[n],issues:[]},i);d instanceof Promise?o.push(d.then(e=>{e.issues.length&&r.issues.push(...Oe(n,e.issues)),r.value[u]=e.value})):(d.issues.length&&r.issues.push(...Oe(n,d.issues)),r.value[u]=d.value)}c&&c.length>0&&r.issues.push({code:`unrecognized_keys`,input:a,inst:e,keys:c,continue:!0})}return o.length?Promise.all(o).then(()=>r):r}}),Ur=S(`$ZodEnum`,(e,t)=>{D.init(e,t);let n=a(t.entries),r=new Set(n);e._zod.values=r,x(e,`pattern`,e=>{let t=a(e.def.entries).filter(e=>fe.has(typeof e));return RegExp(t.length?`^(${t.map(e=>pe(e.toString())).join(`|`)})$`:`^[^\\s\\S]$`)}),e._zod.parse=(t,i)=>{let a=t.value;return r.has(a)||t.issues.push({code:`invalid_value`,values:n,input:a,inst:e}),t}}),Wr=S(`$ZodLiteral`,(e,t)=>{D.init(e,t);let n=new Set(t.values);e._zod.values=n,x(e,`pattern`,e=>{let t=e.def.values;return RegExp(t.length?`^(${t.map(e=>typeof e==`string`?pe(e):e?pe(e.toString()):String(e)).join(`|`)})$`:`^[^\\s\\S]$`)}),e._zod.parse=(r,i)=>{let a=r.value;return n.has(a)||r.issues.push({code:`invalid_value`,values:t.values,input:a,inst:e}),r}}),Gr=S(`$ZodTransform`,(e,t)=>{D.init(e,t),e._zod.optin=`optional`,C.memoizer?.guard(e),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new tt(e.constructor.name);let i=t.transform(n.value,n);if(r.async)return(i instanceof Promise?i:Promise.resolve(i)).then(e=>(n.value=e,n));if(i instanceof Promise)throw new et;return n.value=i,n}});function Kr(e,t){return e.value=t.issues.length?void 0:t.value,e}var qr=S(`$ZodOptional`,(e,t)=>{D.init(e,t),x(e,`optin`,e=>e.def.innerType._zod.optin===`defaulted`?`defaulted`:`optional`),e._zod.optout=`optional`,x(e,`values`,e=>{let t=e.def.innerType._zod.values;return t?new Set([...t,void 0]):void 0}),x(e,`pattern`,e=>{let t=e.def.innerType._zod.pattern;return t?RegExp(`^(${d(t.source)})?$`):void 0}),e._zod.parse=(e,n)=>{if(e.value===void 0){if(t.innerType._zod.optin!==`defaulted`)return e;let r=t.innerType._zod.run({value:e.value,issues:[]},n);return r instanceof Promise?r.then(t=>Kr(e,t)):Kr(e,r)}return t.innerType._zod.run(e,n)}}),Jr=S(`$ZodExactOptional`,(e,t)=>{qr.init(e,t),x(e,`values`,e=>e.def.innerType._zod.values),x(e,`pattern`,e=>e.def.innerType._zod.pattern),e._zod.parse=(e,n)=>t.innerType._zod.run(e,n)}),Yr=S(`$ZodNullable`,(e,t)=>{D.init(e,t),x(e,`optin`,e=>e.def.innerType._zod.optin),x(e,`optout`,e=>e.def.innerType._zod.optout),x(e,`pattern`,e=>{let t=e.def.innerType._zod.pattern;return t?RegExp(`^(${d(t.source)}|null)$`):void 0}),x(e,`values`,e=>e.def.innerType._zod.values?new Set([...e.def.innerType._zod.values,null]):void 0),e._zod.parse=(e,n)=>e.value===null?e:t.innerType._zod.run(e,n)}),Xr=S(`$ZodDefault`,(e,t)=>{D.init(e,t),e._zod.optin=`defaulted`,x(e,`values`,e=>e.def.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);if(e.value===void 0)return e.value=t.defaultValue,e;let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(e=>Zr(e,t)):Zr(r,t)}});function Zr(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}var Qr=S(`$ZodPrefault`,(e,t)=>{D.init(e,t),e._zod.optin=`defaulted`,x(e,`values`,e=>e.def.innerType._zod.values),e._zod.parse=(e,n)=>(n.direction===`backward`||e.value===void 0&&(e.value=t.defaultValue),t.innerType._zod.run(e,n))}),$r=S(`$ZodNonOptional`,(e,t)=>{D.init(e,t),x(e,`values`,e=>{let t=e.def.innerType._zod.values;return t?new Set([...t].filter(e=>e!==void 0)):void 0}),e._zod.parse=(n,r)=>{let i=t.innerType._zod.run(n,r);return i instanceof Promise?i.then(t=>ei(t,e)):ei(i,e)}});function ei(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:`invalid_type`,expected:`nonoptional`,input:e.value,inst:t}),e}function ti(e,t,n,r){return t.issues.length?(e.value=n.catchValue({...t,value:e.value,error:{issues:t.issues.map(e=>je(e,r,w()))},input:e.value}),e):(e.value=t.value,t.memo&&(e.memo=!0),e)}var ni=S(`$ZodCatch`,(e,t)=>{D.init(e,t),x(e,`optin`,e=>e.def.innerType._zod.optin===`defaulted`?`defaulted`:`optional`),x(e,`optout`,e=>e.def.innerType._zod.optout),x(e,`values`,e=>e.def.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run({value:e.value,issues:[]},n);return r instanceof Promise?r.then(r=>ti(e,r,t,n)):ti(e,r,t,n)}}),ri=S(`$ZodPipe`,(e,t)=>{D.init(e,t),x(e,`values`,e=>e.def.in._zod.values),x(e,`optin`,e=>e.def.in._zod.optin),x(e,`optout`,e=>e.def.out._zod.optout),x(e,`propValues`,e=>e.def.in._zod.propValues),e._zod.parse=(e,n)=>{if(n.direction===`backward`){let r=t.out._zod.run(e,n);return r instanceof Promise?r.then(e=>ii(e,t.in,n)):ii(r,t.in,n)}let r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>ii(e,t.out,n)):ii(r,t.out,n)}});function ii(e,t,n){return e.issues.some(e=>e.code!==`unrecognized_keys`)?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}var ai=S(`$ZodPreprocess`,(e,t)=>{ri.init(e,t)}),oi=S(`$ZodReadonly`,(e,t)=>{D.init(e,t),x(e,`propValues`,e=>e.def.innerType._zod.propValues),x(e,`values`,e=>e.def.innerType._zod.values),x(e,`optin`,e=>e.def.innerType?._zod?.optin),x(e,`optout`,e=>e.def.innerType?._zod?.optout),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(si):si(r)}});function si(e){return e.memo||(e.value=Object.freeze(e.value)),e}var ci=S(`$ZodLazy`,(e,t)=>{D.init(e,t),m(e._zod,`innerType`,()=>{let e=t;return e._cachedInner||=t.getter(),e._cachedInner}),x(e,`pattern`,e=>e.innerType?._zod?.pattern),x(e,`propValues`,e=>e.innerType?._zod?.propValues),x(e,`optin`,e=>e.innerType?._zod?.optin??void 0),x(e,`optout`,e=>e.innerType?._zod?.optout??void 0),e._zod.parse=(t,n)=>e._zod.innerType._zod.run(t,n)}),li=S(`$ZodCustom`,(e,t)=>{dn.init(e,t),D.init(e,t),e._zod.parse=(e,t)=>e,e._zod.check=n=>{let r=n.value,i=t.fn(r);if(i instanceof Promise)return i.then(t=>ui(t,n,r,e));ui(i,n,r,e)}});function ui(e,t,n,r){if(!e){let e={code:`custom`,input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(e.params=r._zod.def.params),t.issues.push(Ie(e))}}var di=class extends Error{constructor(){super(`Cannot parse a reference cycle that closes through a transform`),this.name=`ZodCyclicError`}},fi=`~memo`,pi=[];function mi(e){return typeof e==`object`&&!!e}function hi(e){return e.map(e=>e.path?{...e,path:e.path.slice()}:{...e})}var gi=new WeakMap,_i=0,vi=1,yi=2;function bi(e,t,n){let r=gi.get(e);if(r!==void 0)return r?yi:_i;if(t.has(e))return yi;t.add(e);let i=_i,a=e=>{if(i!==yi&&e?._zod){let r=bi(e,t,n);r>i&&(i=r)}},o=(e,r)=>{let i=_i;for(let a of Reflect.ownKeys(e)){let o=Object.getOwnPropertyDescriptor(e,a);if(r&&!o.enumerable)continue;let s=o.get?vi:o.value?._zod?bi(o.value,t,n):_i;s>i&&(i=s)}return i},s=e=>{e>i&&(i=e)},c=e._zod.def;switch(c.type){case`object`:{let e=ee(c);s(e?o(e,!0):vi),a(c.catchall);break}case`array`:a(c.element);break;case`tuple`:for(let e of c.items)a(e);a(c.rest);break;case`record`:case`map`:a(c.keyType),a(c.valueType);break;case`set`:a(c.valueType);break;case`union`:for(let e of c.options)a(e);break;case`intersection`:a(c.left),a(c.right);break;case`optional`:case`nullable`:case`default`:case`prefault`:case`catch`:case`readonly`:case`nonoptional`:case`promise`:case`success`:a(c.innerType);break;case`pipe`:a(c.in),a(c.out);break;case`function`:a(c.input),a(c.output);break;case`lazy`:{let r=c._cachedInner??(n?e._zod.innerType:void 0);s(r?bi(r,t,!1):vi);break}case`template_literal`:case`string`:case`number`:case`int`:case`boolean`:case`bigint`:case`symbol`:case`undefined`:case`null`:case`void`:case`never`:case`any`:case`unknown`:case`date`:case`nan`:case`enum`:case`literal`:case`file`:case`transform`:case`custom`:break;default:for(let e in c){let t=Object.getOwnPropertyDescriptor(c,e);if(!t||t.get)continue;let n=t.value;if(n&&typeof n==`object`){if(n._zod)a(n);else if(Array.isArray(n))for(let e of n)a(e)}}}return t.delete(e),xi(e,i)}function xi(e,t){return t!==vi&&gi.set(e,t===yi),t}function Si(e,t){let n=e.buckets.get(t);return n||(n=new WeakMap,e.buckets.set(t,n)),n}var Ci,wi=[],Ti={alloc(e,t,n){let r=Ci;if(!r)return n;Ci=void 0;let i={value:n,issues:null};return r.set(t.value,i),wi.push(i),n},guard(e){var t;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let t=e._zod.parse,n=(e,n)=>{if(n.direction!==`backward`&&Di(n,e.value))throw new di;return t(e,n)};e._zod.parse=n,e._zod.run===t&&(e._zod.run=n)})},attach(e){var t;let n,r=!1,i,a;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let t=e._zod.parse,o=(s,c)=>{if(n===void 0){let i=bi(e,new Set,!1);if(i===_i)return e._zod.parse=t,e._zod.run===o&&(e._zod.run=t),t(s,c);i===yi||r?n=!0:r=!0}let l=s.value;if(!mi(l))return t(s,c);let u=c[fi];u||(u={buckets:new WeakMap,backEdges:void 0},c[fi]=u);let d;i===c?d=a:(d=Si(u,e),i=c,a=d);let f=d.get(l);if(f)return s.value=f.value,f.issues?f.issues.length&&s.issues.push(...hi(f.issues)):(s.memo=!0,u.backEdges??(u.backEdges=new WeakSet),u.backEdges.add(f.value)),s;Ci=d;let p=wi.length,m=t(s,c);Ci=void 0;let h=wi.length>p?wi.pop():void 0;return m instanceof Promise?m.then(e=>(h&&(h.issues=e.issues.length?hi(e.issues):pi),e)):(h&&(h.issues=m.issues.length?hi(m.issues):pi),m)};e._zod.parse=o,e._zod.run===t&&(e._zod.run=o)})}};function Ei(){return Ti}function Di(e,t){let n=e[fi]?.backEdges;return n!==void 0&&mi(t)&&n.has(t)}var Oi=()=>{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(t){return e[t]??null}let n={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`,currency_code:`currency code`,credit_card:`credit card number`,iban:`IBAN`,jwt:`JWT`,template_literal:`input`},r={nan:`NaN`};function i(e,t){return e===`number`&&typeof t==`number`&&!Number.isFinite(t)?String(t):r[e]??e}return e=>{switch(e.code){case`invalid_type`:return`Invalid input: expected ${i(e.expected)}, received ${i(Fe(e.input),e.input)}`;case`invalid_value`:return e.values.length===1?`Invalid input: expected ${me(e.values[0])}`:`Invalid option: expected one of ${o(e.values,`|`)}`;case`too_big`:{let n=e.exact?`exactly `:e.inclusive?`<=`:`<`,r=t(e.origin);return r?`Too big: expected ${e.origin??`value`} to have ${n}${e.maximum.toString()} ${r.unit??`elements`}`:`Too big: expected ${e.origin??`value`} to be ${n}${e.maximum.toString()}`}case`too_small`:{let n=e.exact?`exactly `:e.inclusive?`>=`:`>`,r=t(e.origin);return r?`Too small: expected ${e.origin} to have ${n}${e.minimum.toString()} ${r.unit}`:`Too small: expected ${e.origin} to be ${n}${e.minimum.toString()}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`Invalid string: must start with "${t.prefix}"`:t.format===`ends_with`?`Invalid string: must end with "${t.suffix}"`:t.format===`includes`?`Invalid string: must include "${t.includes}"`:t.format===`regex`?`Invalid string: must match pattern ${t.pattern}`:`Invalid ${n[t.format]??e.format}`}case`not_multiple_of`:return`Invalid number: must be a multiple of ${e.divisor}`;case`unrecognized_keys`:return`Unrecognized key${e.keys.length>1?`s`:``}: ${o(e.keys,`, `)}`;case`invalid_key`:return`Invalid key in ${e.origin}`;case`invalid_union`:return e.options&&Array.isArray(e.options)&&e.options.length>0?`Invalid discriminator value. Expected ${e.options.map(e=>`'${e}'`).join(` | `)}`:e.inclusive===!1?`Invalid input: more than one option matched`:`Invalid input`;case`invalid_element`:return`Invalid value in ${e.origin}`;default:return`Invalid input`}}};function ki(){return{localeError:Oi()}}var Ai,ji=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){let n=t[0];return this._map.set(e,n),n&&typeof n==`object`&&`id`in n&&this._idmap.set(n.id,e),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let t=this._map.get(e);return t&&typeof t==`object`&&`id`in t&&this._idmap.delete(t.id),this._map.delete(e),this}get(e){let t=e._zod.parent;if(t){let n={...this.get(t)??{}};delete n.id;let r={...n,...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 Mi(){return new ji}(Ai=globalThis).__zod_globalRegistry??(Ai.__zod_globalRegistry=Mi());var Ni=globalThis.__zod_globalRegistry;function Pi(e){return e.checks&&=[...e.checks],e}function Fi(e,t){return new e(Pi({type:`string`,...y(t)}))}function Ii(e,t){return new e({type:`string`,format:`email`,check:`string_format`,abort:!1,...y(t)})}function Li(e,t){return new e({type:`string`,format:`guid`,check:`string_format`,abort:!1,...y(t)})}function Ri(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,...y(t)})}function zi(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v4`,...y(t)})}function Bi(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v6`,...y(t)})}function Vi(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v7`,...y(t)})}function Hi(e,t){return new e({type:`string`,format:`url`,check:`string_format`,abort:!1,...y(t)})}function Ui(e,t){return new e({type:`string`,format:`emoji`,check:`string_format`,abort:!1,...y(t)})}function Wi(e,t){return new e({type:`string`,format:`nanoid`,check:`string_format`,abort:!1,...y(t)})}function Gi(e,t){return new e({type:`string`,format:`cuid`,check:`string_format`,abort:!1,...y(t)})}function Ki(e,t){return new e({type:`string`,format:`cuid2`,check:`string_format`,abort:!1,...y(t)})}function qi(e,t){return new e({type:`string`,format:`ulid`,check:`string_format`,abort:!1,...y(t)})}function Ji(e,t){return new e({type:`string`,format:`xid`,check:`string_format`,abort:!1,...y(t)})}function Yi(e,t){return new e({type:`string`,format:`ksuid`,check:`string_format`,abort:!1,...y(t)})}function Xi(e,t){return new e({type:`string`,format:`ipv4`,check:`string_format`,abort:!1,...y(t)})}function Zi(e,t){return new e({type:`string`,format:`ipv6`,check:`string_format`,abort:!1,...y(t)})}function Qi(e,t){return new e({type:`string`,format:`cidrv4`,check:`string_format`,abort:!1,...y(t)})}function $i(e,t){return new e({type:`string`,format:`cidrv6`,check:`string_format`,abort:!1,...y(t)})}function ea(e,t){return new e({type:`string`,format:`base64`,check:`string_format`,abort:!1,...y(t)})}function ta(e,t){return new e({type:`string`,format:`base64url`,check:`string_format`,abort:!1,...y(t)})}function na(e,t){return new e({type:`string`,format:`e164`,check:`string_format`,abort:!1,...y(t)})}function ra(e,t){return new e({type:`string`,format:`jwt`,check:`string_format`,abort:!1,...y(t)})}function ia(e,t){return new e({type:`string`,format:`datetime`,check:`string_format`,offset:!1,local:!1,precision:null,...y(t)})}function aa(e,t){return new e({type:`string`,format:`date`,check:`string_format`,...y(t)})}function oa(e,t){return new e({type:`string`,format:`time`,check:`string_format`,precision:null,...y(t)})}function sa(e,t){return new e({type:`string`,format:`duration`,check:`string_format`,...y(t)})}function ca(e,t){return new e(Pi({type:`number`,checks:[],...y(t)}))}function la(e,t){return new e(Pi({type:`number`,coerce:!0,checks:[],...y(t)}))}function ua(e,t){return new e({type:`number`,check:`number_format`,abort:!1,format:`safeint`,...y(t)})}function da(e,t){return new e({type:`boolean`,...y(t)})}function fa(e,t){return new e({type:`undefined`,...y(t)})}function pa(e,t){return new e({type:`null`,...y(t)})}function ma(e){return new e({type:`any`})}function ha(e){return new e({type:`unknown`})}function ga(e,t){return new e({type:`never`,...y(t)})}function _a(e,t){return new mn({check:`less_than`,...y(t),value:e,inclusive:!1})}function va(e,t){return new mn({check:`less_than`,...y(t),value:e,inclusive:!0})}function ya(e,t){return new hn({check:`greater_than`,...y(t),value:e,inclusive:!1})}function ba(e,t){return new hn({check:`greater_than`,...y(t),value:e,inclusive:!0})}function xa(e,t){return new gn({check:`multiple_of`,...y(t),value:e})}function Sa(e,t){return new vn({check:`max_length`,...y(t),maximum:e})}function Ca(e,t){return new yn({check:`min_length`,...y(t),minimum:e})}function wa(e,t){return new bn({check:`length_equals`,...y(t),length:e})}function Ta(e,t){return new Sn({check:`string_format`,format:`regex`,...y(t),pattern:e})}function Ea(e){return new Cn({check:`string_format`,format:`lowercase`,...y(e)})}function Da(e){return new wn({check:`string_format`,format:`uppercase`,...y(e)})}function Oa(e,t){return new Tn({check:`string_format`,format:`includes`,...y(t),includes:e})}function ka(e,t){return new En({check:`string_format`,format:`starts_with`,...y(t),prefix:e})}function Aa(e,t){return new Dn({check:`string_format`,format:`ends_with`,...y(t),suffix:e})}function ja(e){return new On({check:`overwrite`,tx:e})}function Ma(e){return ja(t=>t.normalize(e))}function Na(){return ja(e=>e.trim())}function Pa(){return ja(e=>e.toLowerCase())}function Fa(){return ja(e=>e.toUpperCase())}function Ia(){return ja(e=>oe(e))}function La(e,t,n){return new e({type:`array`,element:t,...y(n)})}function Ra(e,t,n){return new e({type:`custom`,check:`custom`,fn:t,...y(n)})}function za(e,t){let n=Ba(t=>(t.addIssue=e=>{if(typeof e==`string`)t.issues.push(Ie(e,t.value,n._zod.def));else{let r=e;r.fatal&&(r.continue=!1),r.code??=`custom`,`input`in r||(r.input=t.value),r.inst??=n,r.continue??=!n._zod.def.abort,t.issues.push(Ie(r))}},e(t.value,t)),t);return n}function Ba(e,t){let n=new dn({check:`custom`,...y(t)});return n._zod.check=e,n}function Va(e,...t){for(let n of t)for(let t of Reflect.ownKeys(n))Object.prototype.propertyIsEnumerable.call(n,t)&&h(e,t,n[t]);return e}function Ha(e){let t=e?.target??`draft-2020-12`;return t===`draft-4`&&(t=`draft-04`),t===`draft-7`&&(t=`draft-07`),{processors:e.processors??{},metadataRegistry:e?.metadata??Ni,target:t,unrepresentable:e?.unrepresentable??`throw`,override:e?.override??(()=>{}),io:e?.io??`output`,counter:0,seen:new Map,sharedDefsExtractedFor:void 0,sharedEmitDoneFor:void 0,cycles:e?.cycles??`ref`,reused:e?.reused??`inline`,intersections:[],deferred:[],external:e?.external??void 0}}function k(e,t,n,r,i){let a=typeof t.unrepresentable==`function`?t.unrepresentable({zodSchema:e,path:r.path,message:i}):t.unrepresentable;if(a===`any`)return!1;if(a===void 0||a===`throw`)throw Error(i);return Object.assign(n,a),!0}function A(e,t,n={path:[],schemaPath:[]}){var r;let i=e._zod.def,a=t.seen.get(e);if(a)return a.count++,n.schemaPath.includes(e)&&(a.cycle=n.path),a.schema;let o={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,o),t.sharedDefsExtractedFor=void 0,t.sharedEmitDoneFor=void 0;let s=e._zod.toJSONSchema?.();if(s)o.schema=s;else{let r={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,o.schema,r);else{let n=o.schema,a=t.processors[i.type];if(!a)throw Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);a(e,t,n,r)}let a=e._zod.parent;a&&(o.ref||=a,A(a,t,r),t.seen.get(a).isParent=!0)}let c=t.metadataRegistry.get(e);return c&&Va(o.schema,c),t.io===`input`&&Qa(e)&&(delete o.schema.examples,delete o.schema.default),t.io===`input`&&`_prefault`in o.schema&&((r=o.schema).default??(r.default=o.schema._prefault)),delete o.schema._prefault,t.seen.get(e).schema}function Ua(e){return e.replace(/~/g,`~0`).replace(/\//g,`~1`)}function Wa(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);if(e.external&&e.sharedDefsExtractedFor===e.external)return;let r=new Map;for(let t of e.seen.entries()){let n=e.metadataRegistry.get(t[0])?.id;if(n){let e=r.get(n);if(e&&e!==t[0])throw Error(`Duplicate schema id "${n}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(n,t[0])}}let i=t=>{let r=e.target===`draft-2020-12`?`$defs`:`definitions`;if(e.external){let n=e.external.registry.get(t[0])?.id,i=e.external.uri??(e=>e);if(n)return{ref:i(n)};let a=t[1].defId??t[1].schema.id??`schema${e.counter++}`;return t[1].defId=a,{defId:a,ref:`${i(`__shared`)}#/${r}/${Ua(a)}`}}let i=`#/${r}/`;if(t[1]===n&&!t[1].schema.id)return{ref:`#`};let a=t[1].schema.id??`__schema${e.counter++}`;return{defId:a,ref:i+Ua(a)}},a=e=>{if(e[1].schema.$ref)return;let t=e[1],{ref:n,defId:r}=i(e);t.def={...t.schema},r&&(t.defId=r);let a=t.schema;for(let e in a)delete a[e];a.$ref=n};if(e.cycles===`throw`)for(let t of e.seen.entries()){let e=t[1];if(e.cycle)throw Error(`Cycle detected: #/${e.cycle?.join(`/`)}/<root>
57
62
 
58
- Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let n of e.seen.entries()){let r=n[1];if(t===n[0]){a(n);continue}if(e.external){let r=e.external.registry.get(n[0])?.id;if(t!==n[0]&&r){a(n);continue}}if(e.metadataRegistry.get(n[0])?.id){a(n);continue}if(r.cycle){a(n);continue}if(r.count>1&&e.reused===`ref`){a(n);continue}}e.external&&(e.sharedDefsExtractedFor=e.external)}function Ca(e){let t=e.anyOf;if(!Array.isArray(t)||t.length===0||e.type!==void 0)return;let n=[];for(let e of t){if(!e||typeof e!=`object`)return;Ca(e);let t=Object.keys(e);if(t.length!==1||t[0]!==`type`)return;let r=e.type;for(let e of Array.isArray(r)?r:[r]){if(typeof e!=`string`)return;n.includes(e)||n.push(e)}}delete e.anyOf,e.type=n.length===1?n[0]:n}var wa=new Set([`type`,`properties`,`required`,`additionalProperties`]),Ta=[`oneOf`,`anyOf`];function Ea(e){let t=e.additionalProperties;return t===void 0||t===!1||typeof t!=`object`||!t?null:Object.keys(t).length?t:null}function Da(e){let t=[];for(let n of e){if(typeof n!=`object`||n.type!==`object`)return null;for(let e in n)if(!wa.has(e))return null;t.push(n)}let n={},r=new Set;for(let e of t){for(let r in e.properties){if(Object.prototype.hasOwnProperty.call(n,r))continue;let e=[];for(let n of t){let t=n.properties?.[r]??Ea(n);t!=null&&(e.some(e=>JSON.stringify(e)===JSON.stringify(t))||e.push(t))}m(n,r,e.length===1?e[0]:Da(e)??{allOf:e})}for(let t of e.required??[])r.add(t)}let i={type:`object`,properties:n};if(r.size&&(i.required=[...r]),t.every(e=>e.additionalProperties===!1))i.additionalProperties=!1;else{let e=[];for(let n of t){let t=Ea(n);t&&!e.some(e=>JSON.stringify(e)===JSON.stringify(t))&&e.push(t)}e.length===1?i.additionalProperties=e[0]:e.length>1&&(i.additionalProperties={allOf:e})}return i}function Oa(e){let t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(let t of wa)if(t in e)return;let n=t.filter(e=>Ta.some(t=>Array.isArray(e[t]))),r=null;if(!n.length)r=Da(t);else{let e=n[0],i=Ta.find(t=>Array.isArray(e[t]));if(Object.keys(e).length!==1)return;let a=t.filter(t=>t!==e),o=e[i].map(e=>Da([...a,e]));if(o.some(e=>!e))return;r={[i]:o}}r&&(delete e.allOf,ya(e,r))}function ka(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=t=>{let n=e.seen.get(t);if(n.ref===null)return;let i=n.def??n.schema,a={...i},o=n.ref;if(n.ref=null,o){r(o);let n=e.seen.get(o),s=n.schema;if(s.$ref&&(e.target===`draft-07`||e.target===`draft-04`||e.target===`openapi-3.0`)?(i.allOf=i.allOf??[],i.allOf.push(s)):ya(i,s),ya(i,a),t._zod.parent===o)for(let e in i)e!==`$ref`&&e!==`allOf`&&(e in a||delete i[e]);if(s.$ref&&n.def)for(let e in i)e!==`$ref`&&e!==`allOf`&&e in n.def&&JSON.stringify(i[e])===JSON.stringify(n.def[e])&&delete i[e]}let s=t._zod.parent;if(s&&s!==o){r(s);let t=e.seen.get(s);if(t?.schema.$ref&&(i.$ref=t.schema.$ref,t.def))for(let e in i)e!==`$ref`&&e!==`allOf`&&e in t.def&&JSON.stringify(i[e])===JSON.stringify(t.def[e])&&delete i[e]}e.override({zodSchema:t,jsonSchema:i,path:n.path??[]})};if(!e.external||e.sharedEmitDoneFor!==e.external){for(let t of[...e.seen.entries()].reverse())r(t[0]);if(e.target!==`openapi-3.0`)for(let t of e.seen.entries())Ca(t[1].def??t[1].schema);for(let t of e.deferred)t();if(e.intersections.length){let t=new Map;for(let n of e.seen.values())for(let e of[n.schema,n.def]){let n=e?.allOf;if(!Array.isArray(n))continue;let r=t.get(n);r?r.push(e):t.set(n,[e])}for(let n of e.intersections)for(let e of t.get(n)??[])Oa(e)}}let i={};if(e.target===`draft-2020-12`?i.$schema=`https://json-schema.org/draft/2020-12/schema`:e.target===`draft-07`?i.$schema=`http://json-schema.org/draft-07/schema#`:e.target===`draft-04`?i.$schema=`http://json-schema.org/draft-04/schema#`:e.target,e.external?.uri){let n=e.external.registry.get(t)?.id;if(!n)throw Error("Schema is missing an `id` property");i.$id=e.external.uri(n)}ya(i,n.defId?n.schema:n.def??n.schema);let a=e.metadataRegistry.get(t)?.id;a!==void 0&&i.id===a&&delete i.id;let o=e.external?.defs??{};if(!e.external||e.sharedEmitDoneFor!==e.external)for(let t of e.seen.entries()){let e=t[1];e.def&&e.defId&&(e.def.id===e.defId&&delete e.def.id,m(o,e.defId,e.def))}e.external&&(e.sharedEmitDoneFor=e.external),e.external||Object.keys(o).length>0&&(e.target===`draft-2020-12`?i.$defs=o:i.definitions=o);try{let n=JSON.parse(JSON.stringify(i));return Object.defineProperty(n,"~standard",{value:{...t[`~standard`],jsonSchema:{input:ja(t,`input`,e.processors),output:ja(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function k(e,t){let n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);let r=e._zod.def;if(r.type===`transform`)return!0;if(r.type===`array`)return k(r.element,n);if(r.type===`set`)return k(r.valueType,n);if(r.type===`lazy`)return k(r.getter(),n);if(r.type===`promise`||r.type===`optional`||r.type===`nonoptional`||r.type===`nullable`||r.type===`readonly`||r.type==="default"||r.type===`prefault`||r.type===`catch`)return k(r.innerType,n);if(r.type===`intersection`)return k(r.left,n)||k(r.right,n);if(r.type===`record`||r.type===`map`)return k(r.keyType,n)||k(r.valueType,n);if(r.type===`pipe`)return e._zod.traits.has(`$ZodCodec`)?!0:k(r.in,n)||k(r.out,n);if(r.type===`object`){for(let e in r.shape)if(k(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(k(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(k(e,n))return!0;return!!(r.rest&&k(r.rest,n))}return!1}var Aa=(e,t={})=>n=>{let r=ba({...n,processors:t});return O(e,r),Sa(r,e),ka(r,e)},ja=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=ba({...i??{},target:a,io:t,processors:n});return O(e,o),Sa(o,e),ka(o,e)},Ma={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},Na=(e,t,n,r)=>{let i=n;i.type=`string`;let{minimum:a,maximum:o,format:s,patterns:c,contentEncoding:l,laxFormat:u}=e._zod.bag;if(typeof a==`number`&&(i.minLength=a),typeof o==`number`&&(i.maxLength=o),s&&(i.format=Ma[s]??s,i.format===``&&delete i.format,(s===`time`||u)&&delete i.format),l&&(i.contentEncoding=l),c&&c.size>0){let e=[...c];e.length===1?i.pattern=e[0].source:e.length>1&&(i.allOf=[...e.map(e=>({...t.target===`draft-07`||t.target===`draft-04`||t.target===`openapi-3.0`?{type:`string`}:{},pattern:e.source}))])}},Pa=(e,t,n,r)=>{let i=n,{minimum:a,maximum:o,format:s,multipleOf:c,exclusiveMaximum:l,exclusiveMinimum:u}=e._zod.bag;i.type=typeof s==`string`&&s.includes(`int`)?`integer`:`number`;let d=typeof u==`number`&&u>=(a??-1/0),f=typeof l==`number`&&l<=(o??1/0),p=t.target===`draft-04`||t.target===`openapi-3.0`;d?p?(i.minimum=u,i.exclusiveMinimum=!0):i.exclusiveMinimum=u:typeof a==`number`&&(i.minimum=a),f?p?(i.maximum=l,i.exclusiveMaximum=!0):i.exclusiveMaximum=l:typeof o==`number`&&(i.maximum=o),typeof c==`number`&&(Number.isFinite(c)&&c!==0?i.multipleOf=Math.abs(c):D(e,t,i,r,`A multipleOf divisor of ${c} cannot be represented in JSON Schema`))},Fa=(e,t,n,r)=>{n.type=`boolean`},Ia=(e,t,n,r)=>{D(e,t,n,r,`BigInt cannot be represented in JSON Schema`)},La=(e,t,n,r)=>{D(e,t,n,r,`Symbols cannot be represented in JSON Schema`)},Ra=(e,t,n,r)=>{t.target===`openapi-3.0`?(n.type=`string`,n.nullable=!0,n.enum=[null]):n.type=`null`},za=(e,t,n,r)=>{D(e,t,n,r,`Undefined cannot be represented in JSON Schema`)},Ba=(e,t,n,r)=>{D(e,t,n,r,`Void cannot be represented in JSON Schema`)},Va=(e,t,n,r)=>{n.not={}},Ha=(e,t,n,r)=>{},Ua=(e,t,n,r)=>{},Wa=(e,t,n,r)=>{D(e,t,n,r,`Date cannot be represented in JSON Schema`)},Ga=(e,t,n,r)=>{let i=e._zod.def,o=a(i.entries);if(o.length===0){n.not={};return}o.every(e=>typeof e==`number`)&&(n.type=`number`),o.every(e=>typeof e==`string`)&&(n.type=`string`),n.enum=o},Ka=(e,t,n,r)=>{let i=e._zod.def;if(i.values.length===0){n.not={};return}let a=[];for(let o of i.values)if(o===void 0){if(D(e,t,n,r,"Literal `undefined` cannot be represented in JSON Schema"))return}else if(typeof o==`bigint`){if(D(e,t,n,r,`BigInt literals cannot be represented in JSON Schema`))return;a.push(Number(o))}else a.push(o);if(a.length!==0){if(a.length===1){let e=a[0];n.type=e===null?`null`:typeof e,t.target===`draft-04`||t.target===`openapi-3.0`?n.enum=[e]:n.const=e}else a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),a.every(e=>typeof e==`boolean`)&&(n.type=`boolean`),a.every(e=>e===null)&&(n.type=`null`),n.enum=a}},qa=(e,t,n,r)=>{D(e,t,n,r,`NaN cannot be represented in JSON Schema`)},Ja=(e,t,n,r)=>{let i=n,a=e._zod.pattern;if(!a)throw Error(`Pattern not found in template literal`);i.type=`string`,i.pattern=a.source},Ya=(e,t,n,r)=>{let i=n,a={type:`string`,format:`binary`,contentEncoding:`binary`},{minimum:o,maximum:s,mime:c}=e._zod.bag;o!==void 0&&(a.minLength=o),s!==void 0&&(a.maxLength=s),c?c.length===1?(a.contentMediaType=c[0],Object.assign(i,a)):(Object.assign(i,a),i.anyOf=c.map(e=>({contentMediaType:e}))):Object.assign(i,a)},Xa=(e,t,n,r)=>{n.type=`boolean`},Za=(e,t,n,r)=>{D(e,t,n,r,`Custom types cannot be represented in JSON Schema`)},Qa=(e,t,n,r)=>{D(e,t,n,r,`Function types cannot be represented in JSON Schema`)},$a=(e,t,n,r)=>{D(e,t,n,r,`Transforms cannot be represented in JSON Schema`)},eo=(e,t,n,r)=>{D(e,t,n,r,`Map cannot be represented in JSON Schema`)},to=(e,t,n,r)=>{D(e,t,n,r,`Set cannot be represented in JSON Schema`)},no=(e,t,n,r)=>{let i=n,a=e._zod.def,{minimum:o,maximum:s}=e._zod.bag;typeof o==`number`&&(i.minItems=o),typeof s==`number`&&(i.maxItems=s),i.type=`array`,i.items=O(a.element,t,{...r,path:[...r.path,`items`]})};function ro(e){let t=e._zod.def;return t.type===`pipe`&&t.in._zod.traits.has(`$ZodTransform`)?ro(t.out):t.type===`catch`?ro(t.innerType):e._zod.optin}var io=(e,t,n,r)=>{let i=n,a=e._zod.def,o=a.shape;if(Object.getOwnPropertySymbols(o).length&&D(e,t,i,r,`Symbol keys cannot be represented in JSON Schema`))return;i.type=`object`,i.properties={};for(let e in o)m(i.properties,e,O(o[e],t,{...r,path:[...r.path,`properties`,e]}));let s=new Set(Object.keys(o)),c=new Set([...s].filter(e=>{let n=a.shape[e];return t.io===`input`?ro(n)===void 0:n._zod.optout===void 0}));c.size>0&&(i.required=Array.from(c)),a.catchall?._zod.def.type===`never`?i.additionalProperties=!1:a.catchall?a.catchall&&(i.additionalProperties=O(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},ao=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>O(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},oo=(e,t,n,r)=>{let i=e._zod.def,a=O(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=O(i.right,t,{...r,path:[...r.path,`allOf`,1]}),s=e=>`allOf`in e&&Object.keys(e).length===1,c=[...s(a)?a.allOf:[a],...s(o)?o.allOf:[o]];n.allOf=c,t.intersections.push(c)},so=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`array`;let o=t.target===`draft-2020-12`?`prefixItems`:`items`,s=t.target===`draft-2020-12`||t.target===`openapi-3.0`?`items`:`additionalItems`,c=a.items.map((e,n)=>O(e,t,{...r,path:[...r.path,o,n]})),l=a.rest?O(a.rest,t,{...r,path:[...r.path,s,...t.target===`openapi-3.0`?[a.items.length]:[]]}):null,u=a.items.length;for(;u>0;){let e=a.items[u-1];if(!(t.io===`input`?ro(e)!==void 0:e._zod.optout===`optional`))break;u--}let d=a.items.length,f=!a.rest;t.target===`draft-2020-12`?(i.prefixItems=c,f?i.items=!1:l&&(i.items=l),u>0&&(i.minItems=u),f&&(i.maxItems=d)):t.target===`openapi-3.0`?(i.items={anyOf:c},l&&i.items.anyOf.push(l),u>0&&(i.minItems=u),f&&(i.maxItems=d)):(i.items=c,f?i.additionalItems=!1:l&&(i.additionalItems=l),u>0&&(i.minItems=u),f&&(i.maxItems=d));let{minimum:p,maximum:m}=e._zod.bag;typeof p==`number`&&(i.minItems=p),typeof m==`number`&&(i.maxItems=m)};function co(e,t,n){if(t.$ref){if(n.has(t))return t;n.add(t);let r=e.get(t)?.def;if(!r)return t;let i=co(e,r,n);return i===r?t:i}for(let r of[`anyOf`,`oneOf`]){let i=t[r];if(!Array.isArray(i))continue;let a=i.map(t=>co(e,t,n));a.some((e,t)=>e!==i[t])&&(t={...t,[r]:a})}let r=Array.isArray(t.type)?t.type:[t.type],i=!r.includes(`string`)&&r.some(e=>e===`number`||e===`integer`),a=t.enum??(t.const===void 0?void 0:[t.const]);if(!i&&!a?.some(e=>typeof e==`number`))return t;let{minimum:o,maximum:s,exclusiveMinimum:c,exclusiveMaximum:l,multipleOf:u,format:d,id:f,...p}=t;return p.enum?p.enum=p.enum.map(e=>typeof e==`number`?String(e):e):typeof p.const==`number`&&(p.const=String(p.const)),i?(p.type=`string`,a||(p.pattern=(r.includes(`number`)?Jt:qt).source),p):p}var lo=new WeakMap;function uo(e){let t=new Map;for(let n of e.seen.values())n.def&&!t.has(n.schema)&&t.set(n.schema,n);let n=new Map;for(let r of lo.get(e)??[]){let i=e.seen.get(r),a=(i?.def??i?.schema)?.propertyNames;if(!a||a===!0||n.has(a))continue;let o=co(t,a,new Set);o!==a&&n.set(a,o)}if(n.size)for(let t of e.seen.values())for(let e of[t.schema,t.def]){let t=e&&n.get(e.propertyNames);t&&(e.propertyNames=t)}}var fo=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`;let o=a.keyType,s=o._zod.bag?.patterns;if(a.mode===`loose`&&s&&s.size>0){let e=O(a.valueType,t,{...r,path:[...r.path,`patternProperties`,`*`]});i.patternProperties={};for(let t of s)m(i.patternProperties,t.source,e)}else{if(t.target===`draft-07`||t.target===`draft-2020-12`){i.propertyNames=O(a.keyType,t,{...r,path:[...r.path,`propertyNames`]});let n=lo.get(t);n||(n=[],lo.set(t,n),t.deferred.push(()=>uo(t))),n.push(e)}i.additionalProperties=O(a.valueType,t,{...r,path:[...r.path,`additionalProperties`]})}let c=o._zod.values,l=t.io===`input`&&ro(a.valueType)!==void 0;if(c&&!a.partial&&!l){let e=[...c].filter(e=>typeof e==`string`||typeof e==`number`);e.length>0&&(i.required=e.map(String))}},po=(e,t,n,r)=>{let i=e._zod.def,a=O(i.innerType,t,r),o=t.seen.get(e);t.target===`openapi-3.0`?(o.ref=i.innerType,n.nullable=!0):n.anyOf=[a,{type:`null`}]},mo=(e,t,n,r)=>{let i=e._zod.def;O(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},ho=Symbol();function go(e,t,n,r,i){let a=!1,o=JSON.stringify(e,(e,t)=>typeof t==`bigint`?(a=!0,null):t);return a?(D(t,n,r,i,`BigInt defaults cannot be represented in JSON Schema`),ho):JSON.parse(o)}var _o=(e,t,n,r)=>{let i=e._zod.def;O(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o=go(i.defaultValue,e,t,n,r);o!==ho&&(n.default=o)},vo=(e,t,n,r)=>{let i=e._zod.def;O(i.innerType,t,r);let a=t.seen.get(e);if(a.ref=i.innerType,t.io!==`input`)return;let o=go(i.defaultValue,e,t,n,r);o!==ho&&(n._prefault=o)},yo=(e,t,n,r)=>{let i=e._zod.def;O(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{D(e,t,n,r,`Dynamic catch values are not supported in JSON Schema`);return}n.default=o},bo=(e,t,n,r)=>{let i=e._zod.def,a=i.in._zod.traits.has(`$ZodTransform`),o=t.io===`input`?a?i.out:i.in:i.out;O(o,t,r);let s=t.seen.get(e);s.ref=o},xo=(e,t,n,r)=>{let i=e._zod.def;O(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},So=(e,t,n,r)=>{let i=e._zod.def;O(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},Co=(e,t,n,r)=>{let i=e._zod.def;O(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},wo=(e,t,n,r)=>{let i=e._zod.innerType;O(i,t,r);let a=t.seen.get(e);a.ref=i},To={string:Na,number:Pa,boolean:Fa,bigint:Ia,symbol:La,null:Ra,undefined:za,void:Ba,never:Va,any:Ha,unknown:Ua,date:Wa,enum:Ga,literal:Ka,nan:qa,template_literal:Ja,file:Ya,success:Xa,custom:Za,function:Qa,transform:$a,map:eo,set:to,array:no,object:io,union:ao,intersection:oo,tuple:so,record:fo,nullable:po,nonoptional:mo,default:_o,prefault:vo,catch:yo,pipe:bo,readonly:xo,promise:So,optional:Co,lazy:wo};function Eo(e,t){if(`_idmap`in e){let n=e,r=ba({...t,processors:To}),i={};for(let e of n._idmap.entries()){let[t,n]=e;O(n,r)}let a={};r.external={registry:n,uri:t?.uri,defs:i};for(let e of n._idmap.entries()){let[t,n]=e;Sa(r,n),m(a,t,ka(r,n))}return Object.keys(i).length>0&&(a.__shared={[r.target===`draft-2020-12`?`$defs`:`definitions`]:i}),{schemas:a}}let n=ba({...t,processors:To});return O(e,n),Sa(n,e),ka(n,e)}var Do=new WeakSet([Object.prototype,Error.prototype]);function Oo(e,t,n){Object.defineProperty(e,t,{configurable:!0,enumerable:!1,get(){let e=n(this);return Object.defineProperty(this,t,{value:e,configurable:!0,writable:!0}),e},set(e){Object.defineProperty(this,t,{value:e,configurable:!0,writable:!0})}})}var ko=b(`ZodError`,(e,t)=>{et.init(e,t),e.name=`ZodError`;let n=Object.getPrototypeOf(e);Do.has(n)||(Do.add(n),Oo(n,`format`,e=>t=>it(e,t)),Oo(n,`flatten`,e=>t=>rt(e,t)),Oo(n,`addIssue`,e=>t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,s,2)}),Oo(n,`addIssues`,e=>t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,s,2)}),Object.defineProperty(n,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}}))},void 0,{Parent:Error}),Ao=at(ko),jo=ot(ko),Mo=st(ko),No=lt(ko),Po=dt(ko),Fo=ft(ko),Io=pt(ko),Lo=mt(ko),Ro=ht(ko),zo=gt(ko),Bo=_t(ko),Vo=vt(ko);function Ho(){x.localeError||S(ci())}function Uo(){x.memoizer||S({memoizer:ai()})}var A=b(`ZodType`,(e,t)=>(Ho(),T.init(e,t),e.def=t,e.type=t.type,e),{check(...e){let t=this.def;return this.clone(h(t,{checks:[...t.checks??[],...e.map(e=>typeof e==`function`?{_zod:{check:e,def:{check:`custom`},onattach:[]}}:e)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return ce(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(lc(e,t))},superRefine(e,t){return this.check(uc(e,t))},overwrite(e){return this.check(la(e))},optional(){return U(this)},exactOptional(){return Ws(this)},nullable(){return Ks(this)},nullish(){return U(Ks(this))},nonoptional(e){return Qs(this,e)},array(){return I(this)},or(e){return z([this,e])},and(e){return Is(this,e)},transform(e){return nc(this,Vs(e))},default(e){return Js(this,e)},prefault(e){return Xs(this,e)},catch(e){return ec(this,e)},pipe(e){return nc(this,e)},readonly(){return ac(this)},describe(e){let t=this.clone();return fi.add(t,{description:e}),t},meta(...e){if(e.length===0)return fi.get(this);let t=this.clone();return fi.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e,...t){return t.length===0?e(this):e(this,...t)},get"~standard"(){return je(this,`~standard`,{...xn(this),jsonSchema:{input:ja(this,`input`),output:ja(this,`output`)}})},set"~standard"(e){Ae(this,`~standard`,e)},parse:function e(t,n){return Ao(this,t,n,{callee:e})},parseAsync:async function e(t,n){return await jo(this,t,n,{callee:e})},safeParse(e,t){return Mo(this,e,t)},async safeParseAsync(e,t){return No(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){Ae(this,`spa`,e)},encode:function e(t,n){return Po(this,t,n,{callee:e})},decode:function e(t,n){return Fo(this,t,n,{callee:e})},encodeAsync:async function e(t,n){return await Io(this,t,n,{callee:e})},decodeAsync:async function e(t,n){return await Lo(this,t,n,{callee:e})},safeEncode(e,t){return Ro(this,e,t)},safeDecode(e,t){return zo(this,e,t)},async safeEncodeAsync(e,t){return Bo(this,e,t)},async safeDecodeAsync(e,t){return Vo(this,e,t)},toJSONSchema(e){return Aa(this,{})(e)},get description(){return fi.get(this)?.description},get _def(){return this._zod.def}}),Wo=b(`_ZodString`,(e,t)=>{Sn.init(e,t),A.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Na(e,t,n,r);let n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null},{regex(...e){return this.check(ra(...e))},includes(...e){return this.check(oa(...e))},startsWith(...e){return this.check(sa(...e))},endsWith(...e){return this.check(ca(...e))},min(...e){return this.check(ta(...e))},max(...e){return this.check(ea(...e))},length(...e){return this.check(na(...e))},nonempty(...e){return this.check(ta(1,...e))},lowercase(e){return this.check(ia(e))},uppercase(e){return this.check(aa(e))},trim(){return this.check(da())},normalize(...e){return this.check(ua(...e))},toLowerCase(){return this.check(fa())},toUpperCase(){return this.check(pa())},slugify(){return this.check(ma())}}),Go=b(`ZodString`,(e,t)=>{Sn.init(e,t),Wo.init(e,t)},{email(e){return this.check(mi(Xo,e))},url(e){return this.check(bi(es,e))},jwt(e){return this.check(Fi(gs,e))},emoji(e){return this.check(xi(ns,e))},guid(e){return this.check(hi(Qo,e))},uuid(e){return this.check(gi($o,e))},uuidv4(e){return this.check(_i($o,e))},uuidv6(e){return this.check(vi($o,e))},uuidv7(e){return this.check(yi($o,e))},nanoid(e){return this.check(Si(rs,e))},cuid(e){return this.check(Ci(is,e))},cuid2(e){return this.check(wi(as,e))},ulid(e){return this.check(Ti(os,e))},base64(e){return this.check(Mi(ps,e))},base64url(e){return this.check(Ni(ms,e))},xid(e){return this.check(Ei(ss,e))},ksuid(e){return this.check(Di(cs,e))},ipv4(e){return this.check(Oi(ls,e))},ipv6(e){return this.check(ki(us,e))},cidrv4(e){return this.check(Ai(ds,e))},cidrv6(e){return this.check(ji(fs,e))},e164(e){return this.check(Pi(hs,e))},datetime(e){return this.check(Ii(Ko,e))},date(e){return this.check(Li(qo,e))},time(e){return this.check(Ri(Jo,e))},duration(e){return this.check(zi(Yo,e))}});function j(e){return pi(Go,e)}var M=b(`ZodStringFormat`,(e,t)=>{E.init(e,t),Wo.init(e,t)}),Ko=b(`ZodISODateTime`,(e,t)=>{zn.init(e,t),M.init(e,t)}),qo=b(`ZodISODate`,(e,t)=>{Bn.init(e,t),M.init(e,t)}),Jo=b(`ZodISOTime`,(e,t)=>{Vn.init(e,t),M.init(e,t)}),Yo=b(`ZodISODuration`,(e,t)=>{Hn.init(e,t),M.init(e,t)}),Xo=b(`ZodEmail`,(e,t)=>{Tn.init(e,t),M.init(e,t)});function Zo(e){return mi(Xo,e)}var Qo=b(`ZodGUID`,(e,t)=>{Cn.init(e,t),M.init(e,t)}),$o=b(`ZodUUID`,(e,t)=>{wn.init(e,t),M.init(e,t)}),es=b(`ZodURL`,(e,t)=>{jn.init(e,t),M.init(e,t)});function ts(e){return bi(es,e)}var ns=b(`ZodEmoji`,(e,t)=>{Mn.init(e,t),M.init(e,t)}),rs=b(`ZodNanoID`,(e,t)=>{Nn.init(e,t),M.init(e,t)}),is=b(`ZodCUID`,(e,t)=>{Pn.init(e,t),M.init(e,t)}),as=b(`ZodCUID2`,(e,t)=>{Fn.init(e,t),M.init(e,t)}),os=b(`ZodULID`,(e,t)=>{In.init(e,t),M.init(e,t)}),ss=b(`ZodXID`,(e,t)=>{Ln.init(e,t),M.init(e,t)}),cs=b(`ZodKSUID`,(e,t)=>{Rn.init(e,t),M.init(e,t)}),ls=b(`ZodIPv4`,(e,t)=>{Un.init(e,t),M.init(e,t)}),us=b(`ZodIPv6`,(e,t)=>{Kn.init(e,t),M.init(e,t)}),ds=b(`ZodCIDRv4`,(e,t)=>{qn.init(e,t),M.init(e,t)}),fs=b(`ZodCIDRv6`,(e,t)=>{Yn.init(e,t),M.init(e,t)}),ps=b(`ZodBase64`,(e,t)=>{Zn.init(e,t),M.init(e,t)}),ms=b(`ZodBase64URL`,(e,t)=>{$n.init(e,t),M.init(e,t)}),hs=b(`ZodE164`,(e,t)=>{er.init(e,t),M.init(e,t)}),gs=b(`ZodJWT`,(e,t)=>{nr.init(e,t),M.init(e,t)}),_s=b(`ZodNumber`,(e,t)=>{rr.init(e,t),A.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Pa(e,t,n,r);let n=e._zod.bag;e.minValue=Math.max(n.minimum??-1/0,n.exclusiveMinimum??-1/0)??null,e.maxValue=Math.min(n.maximum??1/0,n.exclusiveMaximum??1/0)??null,e.isInt=(n.format??``).includes(`int`)||Number.isSafeInteger(n.multipleOf??.5),e.isFinite=!0,e.format=n.format??null},{gt(e,t){return this.check(Zi(e,t))},gte(e,t){return this.check(Qi(e,t))},min(e,t){return this.check(Qi(e,t))},lt(e,t){return this.check(Yi(e,t))},lte(e,t){return this.check(Xi(e,t))},max(e,t){return this.check(Xi(e,t))},int(e){return this.check(ys(e))},safe(e){return this.check(ys(e))},positive(e){return this.check(Zi(0,e))},nonnegative(e){return this.check(Qi(0,e))},negative(e){return this.check(Yi(0,e))},nonpositive(e){return this.check(Xi(0,e))},multipleOf(e,t){return this.check($i(e,t))},step(e,t){return this.check($i(e,t))},finite(){return this}});function N(e){return Bi(_s,e)}var vs=b(`ZodNumberFormat`,(e,t)=>{ir.init(e,t),_s.init(e,t)});function ys(e){return Hi(vs,e)}var bs=b(`ZodBoolean`,(e,t)=>{ar.init(e,t),A.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Fa(e,t,n,r)});function P(e){return Ui(bs,e)}var xs=b(`ZodUndefined`,(e,t)=>{or.init(e,t),A.init(e,t),e._zod.processJSONSchema=(t,n,r)=>za(e,t,n,r)});function Ss(e){return Wi(xs,e)}var Cs=b(`ZodNull`,(e,t)=>{sr.init(e,t),A.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ra(e,t,n,r)});function ws(e){return Gi(Cs,e)}var Ts=b(`ZodAny`,(e,t)=>{cr.init(e,t),A.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function Es(){return Ki(Ts)}var Ds=b(`ZodUnknown`,(e,t)=>{lr.init(e,t),A.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function F(){return qi(Ds)}var Os=b(`ZodNever`,(e,t)=>{ur.init(e,t),A.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Va(e,t,n,r)});function ks(e){return Ji(Os,e)}var As=b(`ZodArray`,(e,t)=>{Uo(),fr.init(e,t),A.init(e,t),e._zod.processJSONSchema=(t,n,r)=>no(e,t,n,r),e.element=t.element},{min(e,t){return this.check(ta(e,t))},nonempty(e){return this.check(ta(1,e))},max(e,t){return this.check(ea(e,t))},length(e,t){return this.check(na(e,t))},unwrap(){return this.element}});function I(e,t){return ha(As,e,t)}var js=b(`ZodObject`,(e,t)=>{Uo(),yr.init(e,t),A.init(e,t),e._zod.processJSONSchema=(t,n,r)=>io(e,t,n,r),Le(e,`shape`,e=>e._zod.def.shape,!1)},{keyof(){return V(Object.keys(this._zod.def.shape))},catchall(e){return this.clone({...this._zod.def,catchall:e})},passthrough(){return this.clone({...this._zod.def,catchall:F()})},loose(){return this.clone({...this._zod.def,catchall:F()})},strict(){return this.clone({...this._zod.def,catchall:ks()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(e){return me(this,e)},safeExtend(e){return he(this,e)},merge(e){return ge(this,e)},pick(e){return fe(this,e)},omit(e){return pe(this,e)},partial(...e){return _e(Hs,this,e[0])},exactPartial(...e){return _e(Us,this,e[0],`exactPartial`)},required(...e){return ve(Zs,this,e[0])}});function L(e,t){return new js({type:`object`,shape:e??{},..._(t)})}function R(e,t){return new js({type:`object`,shape:e,catchall:F(),..._(t)})}var Ms=b(`ZodUnion`,(e,t)=>{xr.init(e,t),A.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ao(e,t,n,r),e.options=t.options});function z(e,t){return new Ms({type:`union`,options:e,..._(t)})}var Ns=b(`ZodDiscriminatedUnion`,(e,t)=>{Ms.init(e,t),Sr.init(e,t)});function Ps(e,t,n){return new Ns({type:`union`,options:t,discriminator:e,..._(n)})}var Fs=b(`ZodIntersection`,(e,t)=>{Cr.init(e,t),A.init(e,t),e._zod.processJSONSchema=(t,n,r)=>oo(e,t,n,r)});function Is(e,t){return new Fs({type:`intersection`,left:e,right:t})}var Ls=b(`ZodRecord`,(e,t)=>{Uo(),Er.init(e,t),A.init(e,t),e._zod.processJSONSchema=(t,n,r)=>fo(e,t,n,r),e.keyType=t.keyType,e.valueType=t.valueType});function B(e,t,n){return!t||!t._zod?new Ls({type:`record`,keyType:j(),valueType:e,..._(t)}):new Ls({type:`record`,keyType:e,valueType:t,..._(n)})}var Rs=b(`ZodEnum`,(e,t)=>{Dr.init(e,t),A.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ga(e,t,n,r),e.enum=t.entries,e.options=Object.values(t.entries);let n=new Set(Object.keys(t.entries));e.extract=(e,r)=>{let i={};for(let r of e)if(n.has(r))i[r]=t.entries[r];else throw Error(`Key ${r} not found in enum`);return new Rs({...t,checks:[],..._(r),entries:i})},e.exclude=(e,r)=>{let i={...t.entries};for(let t of e)if(n.has(t))delete i[t];else throw Error(`Key ${t} not found in enum`);return new Rs({...t,checks:[],..._(r),entries:i})}});function V(e,t){return new Rs({type:`enum`,entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,..._(t)})}var zs=b(`ZodLiteral`,(e,t)=>{Or.init(e,t),A.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ka(e,t,n,r),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 H(e,t){return new zs({type:`literal`,values:Array.isArray(e)?e:[e],..._(t)})}var Bs=b(`ZodTransform`,(e,t)=>{Uo(),kr.init(e,t),A.init(e,t),e._zod.processJSONSchema=(t,n,r)=>$a(e,t,n,r),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new Ke(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(Oe(r,n.value,t));else{let t=r;t.fatal&&(t.continue=!1),t.code??=`custom`,`input`in t||(t.input=n.value),t.inst??=e,n.issues.push(Oe(t))}};let i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n)):(n.value=i,n)}});function Vs(e){return new Bs({type:`transform`,transform:e})}var Hs=b(`ZodOptional`,(e,t)=>{jr.init(e,t),A.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Co(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function U(e){return new Hs({type:`optional`,innerType:e})}var Us=b(`ZodExactOptional`,(e,t)=>{Mr.init(e,t),A.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Co(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Ws(e){return new Us({type:`optional`,innerType:e})}var Gs=b(`ZodNullable`,(e,t)=>{Nr.init(e,t),A.init(e,t),e._zod.processJSONSchema=(t,n,r)=>po(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Ks(e){return new Gs({type:`nullable`,innerType:e})}var qs=b(`ZodDefault`,(e,t)=>{Pr.init(e,t),A.init(e,t),e._zod.processJSONSchema=(t,n,r)=>_o(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Js(e,t){return new qs({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():ae(t)}})}var Ys=b(`ZodPrefault`,(e,t)=>{Ir.init(e,t),A.init(e,t),e._zod.processJSONSchema=(t,n,r)=>vo(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Xs(e,t){return new Ys({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():ae(t)}})}var Zs=b(`ZodNonOptional`,(e,t)=>{Lr.init(e,t),A.init(e,t),e._zod.processJSONSchema=(t,n,r)=>mo(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Qs(e,t){return new Zs({type:`nonoptional`,innerType:e,..._(t)})}var $s=b(`ZodCatch`,(e,t)=>{Br.init(e,t),A.init(e,t),e._zod.processJSONSchema=(t,n,r)=>yo(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function ec(e,t){return new $s({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:ze(t)})}var tc=b(`ZodPipe`,(e,t)=>{Vr.init(e,t),A.init(e,t),e._zod.processJSONSchema=(t,n,r)=>bo(e,t,n,r),e.in=t.in,e.out=t.out});function nc(e,t){return new tc({type:`pipe`,in:e,out:t})}var rc=b(`ZodPreprocess`,(e,t)=>{tc.init(e,t),Ur.init(e,t)}),ic=b(`ZodReadonly`,(e,t)=>{Wr.init(e,t),A.init(e,t),e._zod.processJSONSchema=(t,n,r)=>xo(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function ac(e){return new ic({type:`readonly`,innerType:e})}var oc=b(`ZodLazy`,(e,t)=>{Kr.init(e,t),A.init(e,t),e._zod.processJSONSchema=(t,n,r)=>wo(e,t,n,r),e.unwrap=()=>e._zod.def.getter()});function sc(e){return new oc({type:`lazy`,getter:e})}var cc=b(`ZodCustom`,(e,t)=>{qr.init(e,t),A.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Za(e,t,n,r)});function lc(e,t={}){return ga(cc,e,t)}function uc(e,t){return _a(e,t)}function dc(e,t){return new rc({type:`pipe`,in:Vs(e),out:t})}var fc={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`},pc;pc||={};function mc(e){return Ii(Ko,e)}function hc(e){return Li(qo,e)}function gc(e){return Vi(_s,e)}var _c=[`2025-11-25`,`2025-06-18`,`2025-03-26`,`2024-11-05`,`2024-10-07`],vc=`io.modelcontextprotocol/related-task`,yc=`io.modelcontextprotocol/protocolVersion`,bc=`io.modelcontextprotocol/clientInfo`,xc=`io.modelcontextprotocol/serverInfo`,Sc=`io.modelcontextprotocol/clientCapabilities`,Cc=`io.modelcontextprotocol/subscriptionId`,wc=`io.modelcontextprotocol/logLevel`,Tc=sc(()=>z([j(),N(),P(),ws(),B(j(),Tc),I(Tc)])),W=B(j(),Tc),Ec=I(Tc),Dc=z([j(),N().int()]),Oc=j(),kc=L({ttl:N().optional()}),Ac=L({taskId:j()}),jc=R({progressToken:Dc.optional(),[vc]:Ac.optional()}),G=L({_meta:jc.optional()}),Mc=G.extend({task:kc.optional()}),K=L({method:j(),params:G.loose().optional()}),Nc=L({_meta:jc.optional()}),Pc=L({method:j(),params:Nc.loose().optional()}),Fc=R({get[xc](){return Yc.optional().catch(void 0)}}),q=R({_meta:Fc.optional()}),Ic=z([j(),N().int()]),Lc=L({jsonrpc:H(`2.0`),id:Ic,...K.shape}).strict(),Rc=L({jsonrpc:H(`2.0`),...Pc.shape}).strict(),zc=L({jsonrpc:H(`2.0`),id:Ic,result:q}).strict(),Bc=L({jsonrpc:H(`2.0`),id:Ic.optional(),error:L({code:N().int(),message:j(),data:F().optional()})}).strict(),Vc=z([Lc,Rc,zc,Bc]),Hc=z([zc,Bc]),Uc=q.strict(),Wc=Nc.extend({requestId:Ic.optional(),reason:j().optional()}),Gc=Pc.extend({method:H(`notifications/cancelled`),params:Wc}),Kc=L({src:j(),mimeType:j().optional(),sizes:I(j()).optional(),theme:V([`light`,`dark`]).optional()}),qc=L({icons:I(Kc).optional()}),Jc=L({name:j(),title:j().optional()}),Yc=Jc.extend({...Jc.shape,...qc.shape,version:j(),websiteUrl:j().optional(),description:j().optional()}),Xc=dc(e=>e&&typeof e==`object`&&!Array.isArray(e)&&Object.keys(e).length===0?{form:{}}:e,Is(L({form:Is(L({applyDefaults:P().optional()}),W).optional(),url:W.optional()}),W.optional())),Zc=R({list:W.optional(),cancel:W.optional(),requests:R({sampling:R({createMessage:W.optional()}).optional(),elicitation:R({create:W.optional()}).optional()}).optional()}),Qc=R({list:W.optional(),cancel:W.optional(),requests:R({tools:R({call:W.optional()}).optional()}).optional()}),$c=L({experimental:B(j(),W).optional(),sampling:L({context:W.optional(),tools:W.optional()}).optional(),elicitation:Xc.optional(),roots:L({listChanged:P().optional()}).optional(),tasks:Zc.optional(),extensions:B(j(),W).optional()}),el=G.extend({protocolVersion:j(),capabilities:$c,clientInfo:Yc}),tl=K.extend({method:H(`initialize`),params:el}),nl=L({experimental:B(j(),W).optional(),logging:W.optional(),completions:W.optional(),prompts:L({listChanged:P().optional()}).optional(),resources:L({subscribe:P().optional(),listChanged:P().optional()}).optional(),tools:L({listChanged:P().optional()}).optional(),tasks:Qc.optional(),extensions:B(j(),W).optional()}),rl=q.extend({protocolVersion:j(),capabilities:nl,serverInfo:Yc,instructions:j().optional()}),il=Pc.extend({method:H(`notifications/initialized`),params:Nc.optional()}),al=K.extend({method:H(`server/discover`),params:G.optional()}),ol=q.extend({supportedVersions:I(j()),capabilities:nl,instructions:j().optional()}),sl=K.extend({method:H(`ping`),params:G.optional()}),cl=L({progress:N(),total:U(N()),message:U(j())}),ll=L({...Nc.shape,...cl.shape,progressToken:Dc}),ul=Pc.extend({method:H(`notifications/progress`),params:ll}),dl=G.extend({cursor:Oc.optional()}),fl=K.extend({params:dl.optional()}),pl=q.extend({nextCursor:Oc.optional()}),ml=L({uri:j(),mimeType:U(j()),_meta:B(j(),F()).optional()}),hl=ml.extend({text:j()}),gl=j().refine(e=>{try{return atob(e),!0}catch{return!1}},{message:`Invalid Base64 string`}),_l=ml.extend({blob:gl}),vl=V([`user`,`assistant`]),yl=L({audience:I(vl).optional(),priority:N().min(0).max(1).optional(),lastModified:mc({offset:!0}).optional()}),bl=L({...Jc.shape,...qc.shape,uri:j(),description:U(j()),mimeType:U(j()),size:U(N()),annotations:yl.optional(),_meta:U(R({}))}),xl=L({...Jc.shape,...qc.shape,uriTemplate:j(),description:U(j()),mimeType:U(j()),annotations:yl.optional(),_meta:U(R({}))}),Sl=fl.extend({method:H(`resources/list`)}),Cl=pl.extend({resources:I(bl)}),wl=fl.extend({method:H(`resources/templates/list`)}),Tl=pl.extend({resourceTemplates:I(xl)}),El=G.extend({uri:j()}),Dl=El,Ol=K.extend({method:H(`resources/read`),params:Dl}),kl=q.extend({contents:I(z([hl,_l]))}),Al=Pc.extend({method:H(`notifications/resources/list_changed`),params:Nc.optional()}),jl=El,Ml=K.extend({method:H(`resources/subscribe`),params:jl}),Nl=El,Pl=K.extend({method:H(`resources/unsubscribe`),params:Nl}),Fl=L({toolsListChanged:P().optional(),promptsListChanged:P().optional(),resourcesListChanged:P().optional(),resourceSubscriptions:I(j()).optional()}),Il=G.extend({notifications:Fl}),Ll=K.extend({method:H(`subscriptions/listen`),params:Il}),Rl=Nc.extend({notifications:Fl}),zl=Pc.extend({method:H(`notifications/subscriptions/acknowledged`),params:Rl}),Bl=Fc.extend({[Cc]:Ic}),Vl=q.extend({_meta:Bl}),Hl=Nc.extend({uri:j()}),Ul=Pc.extend({method:H(`notifications/resources/updated`),params:Hl}),Wl=L({name:j(),description:U(j()),required:U(P())}),Gl=L({...Jc.shape,...qc.shape,description:U(j()),arguments:U(I(Wl)),_meta:U(R({}))}),Kl=fl.extend({method:H(`prompts/list`)}),ql=pl.extend({prompts:I(Gl)}),Jl=G.extend({name:j(),arguments:B(j(),j()).optional()}),Yl=K.extend({method:H(`prompts/get`),params:Jl}),Xl=L({type:H(`text`),text:j(),annotations:yl.optional(),_meta:B(j(),F()).optional()}),Zl=L({type:H(`image`),data:gl,mimeType:j(),annotations:yl.optional(),_meta:B(j(),F()).optional()}),Ql=L({type:H(`audio`),data:gl,mimeType:j(),annotations:yl.optional(),_meta:B(j(),F()).optional()}),$l=L({type:H(`tool_use`),name:j(),id:j(),input:B(j(),F()),_meta:B(j(),F()).optional()}),eu=L({type:H(`resource`),resource:z([hl,_l]),annotations:yl.optional(),_meta:B(j(),F()).optional()}),tu=bl.extend({type:H(`resource_link`)}),nu=z([Xl,Zl,Ql,tu,eu]),ru=L({role:vl,content:nu}),iu=q.extend({description:j().optional(),messages:I(ru)}),au=Pc.extend({method:H(`notifications/prompts/list_changed`),params:Nc.optional()}),ou=L({title:j().optional(),readOnlyHint:P().optional(),destructiveHint:P().optional(),idempotentHint:P().optional(),openWorldHint:P().optional()}),su=L({taskSupport:V([`required`,`optional`,`forbidden`]).optional()}),cu=L({...Jc.shape,...qc.shape,description:j().optional(),inputSchema:L({type:H(`object`),properties:B(j(),Tc).optional(),required:I(j()).optional()}).catchall(F()),outputSchema:R({$schema:j().optional()}).optional(),annotations:ou.optional(),execution:su.optional(),_meta:B(j(),F()).optional()}),lu=fl.extend({method:H(`tools/list`)}),uu=pl.extend({tools:I(cu)}),du=q.extend({content:I(nu).default([]),structuredContent:F().optional(),isError:P().optional()}),fu=du.or(q.extend({toolResult:F()})),pu=Mc.extend({name:j(),arguments:B(j(),F()).optional()}),mu=K.extend({method:H(`tools/call`),params:pu}),hu=Pc.extend({method:H(`notifications/tools/list_changed`),params:Nc.optional()}),gu=L({autoRefresh:P().default(!0),debounceMs:N().int().nonnegative().default(300)}),_u=V([`debug`,`info`,`notice`,`warning`,`error`,`critical`,`alert`,`emergency`]),vu=G.extend({level:_u}),yu=K.extend({method:H(`logging/setLevel`),params:vu}),bu=Nc.extend({level:_u,logger:j().optional(),data:F()}),xu=Pc.extend({method:H(`notifications/message`),params:bu}),Su=L({name:j().optional()}),Cu=L({hints:I(Su).optional(),costPriority:N().min(0).max(1).optional(),speedPriority:N().min(0).max(1).optional(),intelligencePriority:N().min(0).max(1).optional()}),wu=L({mode:V([`auto`,`required`,`none`]).optional()}),Tu=L({type:H(`tool_result`),toolUseId:j().describe(`The unique identifier for the corresponding tool call.`),content:I(nu),structuredContent:F().optional(),isError:P().optional(),_meta:B(j(),F()).optional()}),Eu=Ps(`type`,[Xl,Zl,Ql]),Du=Ps(`type`,[Xl,Zl,Ql,$l,Tu]),Ou=L({role:vl,content:z([Du,I(Du)]),_meta:B(j(),F()).optional()}),ku=Mc.extend({messages:I(Ou),modelPreferences:Cu.optional(),systemPrompt:j().optional(),includeContext:V([`none`,`thisServer`,`allServers`]).optional(),temperature:N().optional(),maxTokens:N().int(),stopSequences:I(j()).optional(),metadata:W.optional(),tools:I(cu).optional(),toolChoice:wu.optional()}),Au=K.extend({method:H(`sampling/createMessage`),params:ku}),ju=q.extend({model:j(),stopReason:U(V([`endTurn`,`stopSequence`,`maxTokens`]).or(j())),role:vl,content:Eu}),Mu=q.extend({model:j(),stopReason:U(V([`endTurn`,`stopSequence`,`maxTokens`,`toolUse`]).or(j())),role:vl,content:z([Du,I(Du)])}),Nu=L({type:H(`boolean`),title:j().optional(),description:j().optional(),default:P().optional()}),Pu=L({type:H(`string`),title:j().optional(),description:j().optional(),minLength:N().optional(),maxLength:N().optional(),format:V([`email`,`uri`,`date`,`date-time`]).optional(),default:j().optional()}),Fu=L({type:V([`number`,`integer`]),title:j().optional(),description:j().optional(),minimum:N().optional(),maximum:N().optional(),default:N().optional()}),Iu=L({type:H(`string`),title:j().optional(),description:j().optional(),enum:I(j()),default:j().optional()}),Lu=L({type:H(`string`),title:j().optional(),description:j().optional(),oneOf:I(L({const:j(),title:j()})),default:j().optional()}),Ru=L({type:H(`string`),title:j().optional(),description:j().optional(),enum:I(j()),enumNames:I(j()).optional(),default:j().optional()}),zu=z([Iu,Lu]),Bu=L({type:H(`array`),title:j().optional(),description:j().optional(),minItems:N().optional(),maxItems:N().optional(),items:L({type:H(`string`),enum:I(j())}),default:I(j()).optional()}),Vu=L({type:H(`array`),title:j().optional(),description:j().optional(),minItems:N().optional(),maxItems:N().optional(),items:L({anyOf:I(L({const:j(),title:j()}))}),default:I(j()).optional()}),Hu=z([Bu,Vu]),Uu=z([Ru,zu,Hu]),Wu=z([Uu,Nu,Pu,Fu]),Gu=Mc.extend({mode:H(`form`).optional(),message:j(),requestedSchema:L({type:H(`object`),properties:B(j(),Wu),required:I(j()).optional()}).catchall(F())}),Ku=Mc.extend({mode:H(`url`),message:j(),elicitationId:j(),url:j().url()}),qu=z([Gu,Ku]),Ju=K.extend({method:H(`elicitation/create`),params:qu}),Yu=Nc.extend({elicitationId:j()}),Xu=Pc.extend({method:H(`notifications/elicitation/complete`),params:Yu}),Zu=q.extend({action:V([`accept`,`decline`,`cancel`]),content:dc(e=>e===null?void 0:e,B(j(),z([j(),N(),P(),I(j())])).optional())}),Qu=L({type:H(`ref/resource`),uri:j()}),$u=L({type:H(`ref/prompt`),name:j()}),ed=G.extend({ref:z([$u,Qu]),argument:L({name:j(),value:j()}),context:L({arguments:B(j(),j()).optional()}).optional()}),td=K.extend({method:H(`completion/complete`),params:ed}),nd=q.extend({completion:R({values:I(j()).max(100),total:U(N().int()),hasMore:U(P())})}),rd=L({uri:j().startsWith(`file://`),name:j().optional(),_meta:B(j(),F()).optional()}),id=K.extend({method:H(`roots/list`),params:G.optional()}),ad=q.extend({roots:I(rd)}),od=Pc.extend({method:H(`notifications/roots/list_changed`),params:Nc.optional()}),sd=R({ttl:N().optional(),pollInterval:N().optional()}),cd=V([`working`,`input_required`,`completed`,`failed`,`cancelled`]),ld=L({taskId:j(),status:cd,ttl:z([N(),ws()]),createdAt:j(),lastUpdatedAt:j(),pollInterval:U(N()),statusMessage:U(j())}),ud=q.extend({task:ld}),dd=Nc.merge(ld),fd=Pc.extend({method:H(`notifications/tasks/status`),params:dd}),pd=K.extend({method:H(`tasks/get`),params:G.extend({taskId:j()})}),md=q.merge(ld),hd=K.extend({method:H(`tasks/result`),params:G.extend({taskId:j()})}),gd=q.loose(),_d=fl.extend({method:H(`tasks/list`)}),vd=pl.extend({tasks:I(ld)}),yd=K.extend({method:H(`tasks/cancel`),params:G.extend({taskId:j()})}),bd=q.merge(ld),xd=z([sl,tl,al,td,yu,Yl,Kl,Sl,wl,Ol,Ml,Pl,Ll,mu,lu]),Sd=z([Gc,ul,il,od]),Cd=z([Uc,ju,Mu,Zu,ad]),wd=z([sl,Au,Ju,id]),Td=z([Gc,ul,xu,Ul,Al,hu,au,zl,Xu]),Ed=z([Uc,rl,ol,nd,iu,ql,Cl,Tl,kl,du,uu,Vl]),J=ts().superRefine((e,t)=>{if(!URL.canParse(e))return t.addIssue({code:fc.custom,message:`URL must be parseable`,fatal:!0}),Ve}).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`}),Dd=R({resource:j().url(),authorization_servers:I(J).optional(),jwks_uri:j().url().optional(),scopes_supported:I(j()).optional(),bearer_methods_supported:I(j()).optional(),resource_signing_alg_values_supported:I(j()).optional(),resource_name:j().optional(),resource_documentation:j().optional(),resource_policy_uri:j().url().optional(),resource_tos_uri:j().url().optional(),tls_client_certificate_bound_access_tokens:P().optional(),authorization_details_types_supported:I(j()).optional(),dpop_signing_alg_values_supported:I(j()).optional(),dpop_bound_access_tokens_required:P().optional()}),Od=R({issuer:j(),authorization_endpoint:J,token_endpoint:J,registration_endpoint:J.optional(),scopes_supported:I(j()).optional(),response_types_supported:I(j()),response_modes_supported:I(j()).optional(),grant_types_supported:I(j()).optional(),token_endpoint_auth_methods_supported:I(j()).optional(),token_endpoint_auth_signing_alg_values_supported:I(j()).optional(),service_documentation:J.optional(),revocation_endpoint:J.optional(),revocation_endpoint_auth_methods_supported:I(j()).optional(),revocation_endpoint_auth_signing_alg_values_supported:I(j()).optional(),introspection_endpoint:j().optional(),introspection_endpoint_auth_methods_supported:I(j()).optional(),introspection_endpoint_auth_signing_alg_values_supported:I(j()).optional(),code_challenge_methods_supported:I(j()).optional(),client_id_metadata_document_supported:P().optional(),authorization_response_iss_parameter_supported:P().optional().catch(void 0)}),kd=R({issuer:j(),authorization_endpoint:J,token_endpoint:J,userinfo_endpoint:J.optional(),jwks_uri:J,registration_endpoint:J.optional(),scopes_supported:I(j()).optional(),response_types_supported:I(j()),response_modes_supported:I(j()).optional(),grant_types_supported:I(j()).optional(),acr_values_supported:I(j()).optional(),subject_types_supported:I(j()),id_token_signing_alg_values_supported:I(j()),id_token_encryption_alg_values_supported:I(j()).optional(),id_token_encryption_enc_values_supported:I(j()).optional(),userinfo_signing_alg_values_supported:I(j()).optional(),userinfo_encryption_alg_values_supported:I(j()).optional(),userinfo_encryption_enc_values_supported:I(j()).optional(),request_object_signing_alg_values_supported:I(j()).optional(),request_object_encryption_alg_values_supported:I(j()).optional(),request_object_encryption_enc_values_supported:I(j()).optional(),token_endpoint_auth_methods_supported:I(j()).optional(),token_endpoint_auth_signing_alg_values_supported:I(j()).optional(),display_values_supported:I(j()).optional(),claim_types_supported:I(j()).optional(),claims_supported:I(j()).optional(),service_documentation:j().optional(),claims_locales_supported:I(j()).optional(),ui_locales_supported:I(j()).optional(),claims_parameter_supported:P().optional(),request_parameter_supported:P().optional(),request_uri_parameter_supported:P().optional(),require_request_uri_registration:P().optional(),op_policy_uri:J.optional(),op_tos_uri:J.optional(),client_id_metadata_document_supported:P().optional(),authorization_response_iss_parameter_supported:P().optional().catch(void 0)}),Ad=L({...kd.shape,...Od.pick({code_challenge_methods_supported:!0}).shape}),jd=L({access_token:j(),id_token:j().optional(),token_type:j(),expires_in:gc().optional(),scope:j().optional(),refresh_token:j().optional()}).strip(),Md=L({issued_token_type:H(`urn:ietf:params:oauth:token-type:id-jag`),access_token:j(),token_type:j().optional(),expires_in:N().optional(),scope:j().optional()}).strip(),Nd=L({error:j(),error_description:j().optional(),error_uri:j().optional()}),Pd=J.optional().or(H(``).transform(()=>void 0)),Fd=L({redirect_uris:I(J),token_endpoint_auth_method:j().optional(),grant_types:I(j()).optional(),response_types:I(j()).optional(),application_type:j().optional(),client_name:j().optional(),client_uri:J.optional(),logo_uri:Pd,scope:j().optional(),contacts:I(j()).optional(),tos_uri:Pd,policy_uri:j().optional(),jwks_uri:J.optional(),jwks:Es().optional(),software_id:j().optional(),software_version:j().optional(),software_statement:j().optional()}).strip(),Id=L({client_id:j(),client_secret:j().optional(),client_id_issued_at:N().optional(),client_secret_expires_at:N().optional()}).strip(),Ld=Fd.merge(Id),Rd=L({error:j(),error_description:j().optional()}).strip(),zd=L({token:j(),token_type_hint:j().optional()}).strip(),Bd=Symbol.for(`mcp.sdk.errorBrands`);function Vd(e,t){let n=new Set,r=t;for(;typeof r==`function`;){let e=r.mcpBrand;Object.prototype.hasOwnProperty.call(r,`mcpBrand`)&&typeof e==`string`&&n.add(e),r=Object.getPrototypeOf(r)}n.size!==0&&Object.defineProperty(e,Bd,{value:n,enumerable:!1,configurable:!0})}function Hd(e,t){try{if(typeof t==`object`&&t&&Object.prototype.hasOwnProperty.call(e,`mcpBrand`)&&typeof e.mcpBrand==`string`&&Object.prototype.hasOwnProperty.call(t,Bd)){let n=t[Bd];if(n&&typeof n.has==`function`&&n.has(e.mcpBrand))return!0}}catch{}return Function.prototype[Symbol.hasInstance].call(e,t)}(class e extends Error{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.OAuthError`})}static[Symbol.hasInstance](e){return Hd(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 Hd(this,e)}constructor(e,t,n){super(t),this.code=e,this.errorUri=n,this.name=`OAuthError`,Vd(this,new.target)}toResponseObject(){let e={error:this.code,error_description:this.message};return this.errorUri&&(e.error_uri=this.errorUri),e}static fromResponse(t){return new e(t.error,t.error_description??t.error,t.error_uri)}});var Y=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}({}),X=class extends Error{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.SdkError`})}static[Symbol.hasInstance](e){return Hd(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 Hd(this,e)}constructor(e,t,n){super(t),this.code=e,this.data=n,this.name=`SdkError`,Vd(this,new.target)}};(class extends X{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.SdkHttpError`})}constructor(e,t,n){super(e,t,n),this.name=`SdkHttpError`}get status(){return this.data.status}get statusText(){return this.data.statusText}});var Ud=`2026-07-28`;function Wd(e){return e>=Ud}function Gd(e){let t=e.structuredContent;return t===void 0||typeof t==`object`&&t&&!Array.isArray(t)||(e.content?.some(e=>e.type===`text`)??!1)?e:{...e,content:[...e.content??[],{type:`text`,text:JSON.stringify(t)}]}}var Kd=[`task`,`inputRequests`,`requestState`];function qd(e){return typeof e!=`object`||!e||Array.isArray(e)||e.content!==void 0||Kd.some(t=>t in e)?e:{...e,content:[]}}function Jd(){let e=sc(()=>z([j(),N(),P(),ws(),B(j(),e),I(e)])),t=B(j(),e),n=z([j(),N().int()]),r=j(),i=L({ttl:N().optional()}),a=L({taskId:j()}),o=R({progressToken:n.optional(),"io.modelcontextprotocol/related-task":a.optional()}),s=L({_meta:o.optional()}),c=s.extend({task:i.optional()}),l=L({method:j(),params:s.loose().optional()}),u=L({_meta:o.optional()}),d=L({method:j(),params:u.loose().optional()}),f=R({_meta:o.optional()}),p=z([j(),N().int()]),m=f.strict(),h=u.extend({requestId:p.optional(),reason:j().optional()}),ee=d.extend({method:H(`notifications/cancelled`),params:h}),te=L({src:j(),mimeType:j().optional(),sizes:I(j()).optional(),theme:V([`light`,`dark`]).optional()}),ne=L({icons:I(te).optional()}),g=L({name:j(),title:j().optional()}),re=g.extend({...g.shape,...ne.shape,version:j(),websiteUrl:j().optional(),description:j().optional()}),ie=dc(e=>e&&typeof e==`object`&&!Array.isArray(e)&&Object.keys(e).length===0?{form:{}}:e,Is(L({form:Is(L({applyDefaults:P().optional()}),t).optional(),url:t.optional()}),t.optional())),ae=R({list:t.optional(),cancel:t.optional(),requests:R({sampling:R({createMessage:t.optional()}).optional(),elicitation:R({create:t.optional()}).optional()}).optional()}),oe=R({list:t.optional(),cancel:t.optional(),requests:R({tools:R({call:t.optional()}).optional()}).optional()}),se=L({experimental:B(j(),t).optional(),sampling:L({context:t.optional(),tools:t.optional()}).optional(),elicitation:ie.optional(),roots:L({listChanged:P().optional()}).optional(),tasks:ae.optional(),extensions:B(j(),t).optional()}),ce=s.extend({protocolVersion:j(),capabilities:se,clientInfo:re}),_=l.extend({method:H(`initialize`),params:ce}),le=L({experimental:B(j(),t).optional(),logging:t.optional(),completions:t.optional(),prompts:L({listChanged:P().optional()}).optional(),resources:L({subscribe:P().optional(),listChanged:P().optional()}).optional(),tools:L({listChanged:P().optional()}).optional(),tasks:oe.optional(),extensions:B(j(),t).optional()}),ue=f.extend({protocolVersion:j(),capabilities:le,serverInfo:re,instructions:j().optional()}),de=d.extend({method:H(`notifications/initialized`),params:u.optional()}),fe=l.extend({method:H(`ping`),params:s.optional()}),pe=L({progress:N(),total:U(N()),message:U(j())}),me=L({...u.shape,...pe.shape,progressToken:n}),he=d.extend({method:H(`notifications/progress`),params:me}),ge=s.extend({cursor:r.optional()}),_e=l.extend({params:ge.optional()}),ve=f.extend({nextCursor:r.optional()}),ye=L({uri:j(),mimeType:U(j()),_meta:B(j(),F()).optional()}),be=ye.extend({text:j()}),xe=j().refine(e=>{try{return atob(e),!0}catch{return!1}},{message:`Invalid Base64 string`}),Se=ye.extend({blob:xe}),Ce=V([`user`,`assistant`]),v=L({audience:I(Ce).optional(),priority:N().min(0).max(1).optional(),lastModified:mc({offset:!0}).optional()}),we=L({...g.shape,...ne.shape,uri:j(),description:U(j()),mimeType:U(j()),size:U(N()),annotations:v.optional(),_meta:U(R({}))}),Te=L({...g.shape,...ne.shape,uriTemplate:j(),description:U(j()),mimeType:U(j()),annotations:v.optional(),_meta:U(R({}))}),Ee=_e.extend({method:H(`resources/list`)}),De=ve.extend({resources:I(we)}),Oe=_e.extend({method:H(`resources/templates/list`)}),ke=ve.extend({resourceTemplates:I(Te)}),Ae=s.extend({uri:j()}),je=Ae,Me=l.extend({method:H(`resources/read`),params:je}),Ne=f.extend({contents:I(z([be,Se]))}),Pe=d.extend({method:H(`notifications/resources/list_changed`),params:u.optional()}),Fe=Ae,Ie=l.extend({method:H(`resources/subscribe`),params:Fe}),y=Ae,Le=l.extend({method:H(`resources/unsubscribe`),params:y}),Re=u.extend({uri:j()}),ze=d.extend({method:H(`notifications/resources/updated`),params:Re}),Be=L({name:j(),description:U(j()),required:U(P())}),Ve=L({...g.shape,...ne.shape,description:U(j()),arguments:U(I(Be)),_meta:U(R({}))}),He=_e.extend({method:H(`prompts/list`)}),Ue=ve.extend({prompts:I(Ve)}),We=s.extend({name:j(),arguments:B(j(),j()).optional()}),b=l.extend({method:H(`prompts/get`),params:We}),Ge=L({type:H(`text`),text:j(),annotations:v.optional(),_meta:B(j(),F()).optional()}),Ke=L({type:H(`image`),data:xe,mimeType:j(),annotations:v.optional(),_meta:B(j(),F()).optional()}),x=L({type:H(`audio`),data:xe,mimeType:j(),annotations:v.optional(),_meta:B(j(),F()).optional()}),S=L({type:H(`tool_use`),name:j(),id:j(),input:B(j(),F()),_meta:B(j(),F()).optional()}),qe=L({type:H(`resource`),resource:z([be,Se]),annotations:v.optional(),_meta:B(j(),F()).optional()}),Je=we.extend({type:H(`resource_link`)}),Ye=z([Ge,Ke,x,Je,qe]),Xe=L({role:Ce,content:Ye}),Ze=f.extend({description:j().optional(),messages:I(Xe)}),Qe=d.extend({method:H(`notifications/prompts/list_changed`),params:u.optional()}),$e=L({title:j().optional(),readOnlyHint:P().optional(),destructiveHint:P().optional(),idempotentHint:P().optional(),openWorldHint:P().optional()}),et=L({taskSupport:V([`required`,`optional`,`forbidden`]).optional()}),tt=L({...g.shape,...ne.shape,description:j().optional(),inputSchema:L({type:H(`object`),properties:B(j(),e).optional(),required:I(j()).optional()}).catchall(F()),outputSchema:L({type:H(`object`),properties:B(j(),e).optional(),required:I(j()).optional()}).catchall(F()).optional(),annotations:$e.optional(),execution:et.optional(),_meta:B(j(),F()).optional()}),nt=_e.extend({method:H(`tools/list`)}),rt=ve.extend({tools:I(tt)}),it=f.extend({content:I(Ye),structuredContent:B(j(),F()).optional(),isError:P().optional()}),C=c.extend({name:j(),arguments:B(j(),F()).optional()}),at=l.extend({method:H(`tools/call`),params:C}),ot=d.extend({method:H(`notifications/tools/list_changed`),params:u.optional()}),st=V([`debug`,`info`,`notice`,`warning`,`error`,`critical`,`alert`,`emergency`]),ct=s.extend({level:st}),lt=l.extend({method:H(`logging/setLevel`),params:ct}),ut=u.extend({level:st,logger:j().optional(),data:F()}),dt=d.extend({method:H(`notifications/message`),params:ut}),ft=L({name:j().optional()}),pt=L({hints:I(ft).optional(),costPriority:N().min(0).max(1).optional(),speedPriority:N().min(0).max(1).optional(),intelligencePriority:N().min(0).max(1).optional()}),mt=L({mode:V([`auto`,`required`,`none`]).optional()}),ht=L({type:H(`tool_result`),toolUseId:j().describe(`The unique identifier for the corresponding tool call.`),content:I(Ye),structuredContent:L({}).loose().optional(),isError:P().optional(),_meta:B(j(),F()).optional()}),gt=Ps(`type`,[Ge,Ke,x]),_t=Ps(`type`,[Ge,Ke,x,S,ht]),vt=L({role:Ce,content:z([_t,I(_t)]),_meta:B(j(),F()).optional()}),yt=c.extend({messages:I(vt),modelPreferences:pt.optional(),systemPrompt:j().optional(),includeContext:V([`none`,`thisServer`,`allServers`]).optional(),temperature:N().optional(),maxTokens:N().int(),stopSequences:I(j()).optional(),metadata:t.optional(),tools:I(tt).optional(),toolChoice:mt.optional()}),bt=l.extend({method:H(`sampling/createMessage`),params:yt}),xt=f.extend({model:j(),stopReason:U(V([`endTurn`,`stopSequence`,`maxTokens`]).or(j())),role:Ce,content:gt}),St=f.extend({model:j(),stopReason:U(V([`endTurn`,`stopSequence`,`maxTokens`,`toolUse`]).or(j())),role:Ce,content:z([_t,I(_t)])}),Ct=L({type:H(`boolean`),title:j().optional(),description:j().optional(),default:P().optional()}),wt=L({type:H(`string`),title:j().optional(),description:j().optional(),minLength:N().optional(),maxLength:N().optional(),format:V([`email`,`uri`,`date`,`date-time`]).optional(),default:j().optional()}),Tt=L({type:V([`number`,`integer`]),title:j().optional(),description:j().optional(),minimum:N().optional(),maximum:N().optional(),default:N().optional()}),Et=L({type:H(`string`),title:j().optional(),description:j().optional(),enum:I(j()),default:j().optional()}),Dt=L({type:H(`string`),title:j().optional(),description:j().optional(),oneOf:I(L({const:j(),title:j()})),default:j().optional()}),Ot=L({type:H(`string`),title:j().optional(),description:j().optional(),enum:I(j()),enumNames:I(j()).optional(),default:j().optional()}),kt=z([Et,Dt]),At=L({type:H(`array`),title:j().optional(),description:j().optional(),minItems:N().optional(),maxItems:N().optional(),items:L({type:H(`string`),enum:I(j())}),default:I(j()).optional()}),jt=L({type:H(`array`),title:j().optional(),description:j().optional(),minItems:N().optional(),maxItems:N().optional(),items:L({anyOf:I(L({const:j(),title:j()}))}),default:I(j()).optional()}),Mt=z([At,jt]),Nt=z([Ot,kt,Mt]),Pt=z([Nt,Ct,wt,Tt]),Ft=c.extend({mode:H(`form`).optional(),message:j(),requestedSchema:L({type:H(`object`),properties:B(j(),Pt),required:I(j()).optional()}).catchall(F())}),It=c.extend({mode:H(`url`),message:j(),elicitationId:j(),url:j().url()}),Lt=z([Ft,It]),Rt=l.extend({method:H(`elicitation/create`),params:Lt}),zt=u.extend({elicitationId:j()}),Bt=d.extend({method:H(`notifications/elicitation/complete`),params:zt}),Vt=f.extend({action:V([`accept`,`decline`,`cancel`]),content:dc(e=>e===null?void 0:e,B(j(),z([j(),N(),P(),I(j())])).optional())}),Ht=L({type:H(`ref/resource`),uri:j()}),Ut=L({type:H(`ref/prompt`),name:j()}),Wt=s.extend({ref:z([Ut,Ht]),argument:L({name:j(),value:j()}),context:L({arguments:B(j(),j()).optional()}).optional()}),Gt=l.extend({method:H(`completion/complete`),params:Wt}),Kt=f.extend({completion:R({values:I(j()).max(100),total:U(N().int()),hasMore:U(P())})}),qt=L({uri:j().startsWith(`file://`),name:j().optional(),_meta:B(j(),F()).optional()}),Jt=l.extend({method:H(`roots/list`),params:s.optional()}),Yt=f.extend({roots:I(qt)}),Xt=d.extend({method:H(`notifications/roots/list_changed`),params:u.optional()}),Zt=R({ttl:N().optional(),pollInterval:N().optional()}),Qt=V([`working`,`input_required`,`completed`,`failed`,`cancelled`]),$t=L({taskId:j(),status:Qt,ttl:z([N(),ws()]),createdAt:j(),lastUpdatedAt:j(),pollInterval:U(N()),statusMessage:U(j())}),w=f.extend({task:$t}),en=u.merge($t),tn=d.extend({method:H(`notifications/tasks/status`),params:en}),nn=l.extend({method:H(`tasks/get`),params:s.extend({taskId:j()})}),rn=f.merge($t),an=l.extend({method:H(`tasks/result`),params:s.extend({taskId:j()})}),on=f.loose(),sn=_e.extend({method:H(`tasks/list`)}),cn=ve.extend({tasks:I($t)}),ln=l.extend({method:H(`tasks/cancel`),params:s.extend({taskId:j()})});return{JSONValueSchema:e,JSONObjectSchema:t,ProgressTokenSchema:n,CursorSchema:r,TaskMetadataSchema:i,RelatedTaskMetadataSchema:a,RequestMetaSchema:o,BaseRequestParamsSchema:s,TaskAugmentedRequestParamsSchema:c,RequestSchema:l,NotificationsParamsSchema:u,NotificationSchema:d,ResultSchema:f,RequestIdSchema:p,EmptyResultSchema:m,CancelledNotificationParamsSchema:h,CancelledNotificationSchema:ee,IconSchema:te,IconsSchema:ne,BaseMetadataSchema:g,ImplementationSchema:re,ClientTasksCapabilitySchema:ae,ServerTasksCapabilitySchema:oe,ClientCapabilitiesSchema:se,InitializeRequestParamsSchema:ce,InitializeRequestSchema:_,ServerCapabilitiesSchema:le,InitializeResultSchema:ue,InitializedNotificationSchema:de,PingRequestSchema:fe,ProgressSchema:pe,ProgressNotificationParamsSchema:me,ProgressNotificationSchema:he,PaginatedRequestParamsSchema:ge,PaginatedRequestSchema:_e,PaginatedResultSchema:ve,ResourceContentsSchema:ye,TextResourceContentsSchema:be,BlobResourceContentsSchema:Se,RoleSchema:Ce,AnnotationsSchema:v,ResourceSchema:we,ResourceTemplateSchema:Te,ListResourcesRequestSchema:Ee,ListResourcesResultSchema:De,ListResourceTemplatesRequestSchema:Oe,ListResourceTemplatesResultSchema:ke,ResourceRequestParamsSchema:Ae,ReadResourceRequestParamsSchema:je,ReadResourceRequestSchema:Me,ReadResourceResultSchema:Ne,ResourceListChangedNotificationSchema:Pe,SubscribeRequestParamsSchema:Fe,SubscribeRequestSchema:Ie,UnsubscribeRequestParamsSchema:y,UnsubscribeRequestSchema:Le,ResourceUpdatedNotificationParamsSchema:Re,ResourceUpdatedNotificationSchema:ze,PromptArgumentSchema:Be,PromptSchema:Ve,ListPromptsRequestSchema:He,ListPromptsResultSchema:Ue,GetPromptRequestParamsSchema:We,GetPromptRequestSchema:b,TextContentSchema:Ge,ImageContentSchema:Ke,AudioContentSchema:x,ToolUseContentSchema:S,EmbeddedResourceSchema:qe,ResourceLinkSchema:Je,ContentBlockSchema:Ye,PromptMessageSchema:Xe,GetPromptResultSchema:Ze,PromptListChangedNotificationSchema:Qe,ToolAnnotationsSchema:$e,ToolExecutionSchema:et,ToolSchema:tt,ListToolsRequestSchema:nt,ListToolsResultSchema:rt,CallToolResultSchema:it,CallToolRequestParamsSchema:C,CallToolRequestSchema:at,ToolListChangedNotificationSchema:ot,LoggingLevelSchema:st,SetLevelRequestParamsSchema:ct,SetLevelRequestSchema:lt,LoggingMessageNotificationParamsSchema:ut,LoggingMessageNotificationSchema:dt,ModelHintSchema:ft,ModelPreferencesSchema:pt,ToolChoiceSchema:mt,ToolResultContentSchema:ht,SamplingContentSchema:gt,SamplingMessageContentBlockSchema:_t,SamplingMessageSchema:vt,CreateMessageRequestParamsSchema:yt,CreateMessageRequestSchema:bt,CreateMessageResultSchema:xt,CreateMessageResultWithToolsSchema:St,BooleanSchemaSchema:Ct,StringSchemaSchema:wt,NumberSchemaSchema:Tt,UntitledSingleSelectEnumSchemaSchema:Et,TitledSingleSelectEnumSchemaSchema:Dt,LegacyTitledEnumSchemaSchema:Ot,SingleSelectEnumSchemaSchema:kt,UntitledMultiSelectEnumSchemaSchema:At,TitledMultiSelectEnumSchemaSchema:jt,MultiSelectEnumSchemaSchema:Mt,EnumSchemaSchema:Nt,PrimitiveSchemaDefinitionSchema:Pt,ElicitRequestFormParamsSchema:Ft,ElicitRequestURLParamsSchema:It,ElicitRequestParamsSchema:Lt,ElicitRequestSchema:Rt,ElicitationCompleteNotificationParamsSchema:zt,ElicitationCompleteNotificationSchema:Bt,ElicitResultSchema:Vt,ResourceTemplateReferenceSchema:Ht,PromptReferenceSchema:Ut,CompleteRequestParamsSchema:Wt,CompleteRequestSchema:Gt,CompleteResultSchema:Kt,RootSchema:qt,ListRootsRequestSchema:Jt,ListRootsResultSchema:Yt,RootsListChangedNotificationSchema:Xt,TaskCreationParamsSchema:Zt,TaskStatusSchema:Qt,TaskSchema:$t,CreateTaskResultSchema:w,TaskStatusNotificationParamsSchema:en,TaskStatusNotificationSchema:tn,GetTaskRequestSchema:nn,GetTaskResultSchema:rn,GetTaskPayloadRequestSchema:an,GetTaskPayloadResultSchema:on,ListTasksRequestSchema:sn,ListTasksResultSchema:cn,CancelTaskRequestSchema:ln,CancelTaskResultSchema:f.merge($t),ClientRequestSchema:z([fe,_,Gt,lt,b,He,Ee,Oe,Me,Ie,Le,at,nt,nn,an,sn,ln]),ClientNotificationSchema:z([ee,he,de,Xt,tn]),ClientResultSchema:z([m,xt,St,Vt,Yt,rn,cn,w]),ServerRequestSchema:z([fe,bt,Rt,Jt,nn,an,sn,ln]),ServerNotificationSchema:z([ee,he,dt,ze,Pe,ot,Qe,tn,Bt]),ServerResultSchema:z([m,ue,Kt,Ze,Ue,De,ke,Ne,it,rt,rn,cn,w]),CallToolResultWireSchema:F().superRefine((e,t)=>{if(typeof e==`object`&&e&&!Array.isArray(e)&&e.content===void 0){for(let n of Kd)if(n in e){t.addIssue({code:`custom`,message:`content is required when the body carries '${n}' — another result family cannot default into an empty tools/call success`});return}}}).transform(qd).pipe(it)}}var Yd;function Xd(){return Yd??=Jd()}function Zd(e){return e.type!==`object`}var Qd=new Set([`const`,`enum`,`default`,`examples`]),$d=new Set([`properties`,`patternProperties`,`$defs`,`definitions`,`dependentSchemas`,`dependencies`]);function ef(e){return e!==void 0&&!(typeof e==`string`&&e.startsWith(`#`))}function tf(e){let t=typeof e.$schema==`string`?e.$schema:void 0;if(ef(e.$id))return{...t!==void 0&&{$schema:t},type:`object`,properties:{result:e},required:[`result`]};let n=i(e.$schema)&&e.$recursiveAnchor!==!0,r=(e,t)=>{if(Array.isArray(e))return e.map(e=>r(e,!1));if(typeof e!=`object`||!e||!t&&ef(e.$id))return e;let i={},a=!1;for(let[o,s]of Object.entries(e))t?i[o]=r(s,!1):(o===`$ref`||o===`$dynamicRef`)&&typeof s==`string`?i[o]=s===`#`?`#/properties/result`:s.startsWith(`#/`)?`#/properties/result${s.slice(1)}`:s:o===`$recursiveRef`&&s===`#`&&n?a=!0:i[o]=Qd.has(o)?s:$d.has(o)?r(s,!0):r(s,!1);return a&&(`$ref`in i?i.allOf=[...Array.isArray(i.allOf)?i.allOf:[],{$ref:`#/properties/result`}]:i.$ref=`#/properties/result`),i};return{...t!==void 0&&{$schema:t},type:`object`,properties:{result:r(e,!1)},required:[`result`]}}var nf={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},rf={"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},af={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},of;function sf(){if(of)return of;let e=Xd();return of={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}},of}function cf(e){return Object.prototype.hasOwnProperty.call(nf,e)}function lf(e){return Object.prototype.hasOwnProperty.call(rf,e)}function uf(e){return Object.prototype.hasOwnProperty.call(af,e)}function df(e){return uf(e)?sf().resultSchemas[e]:void 0}function ff(e){return cf(e)?sf().requestSchemas[e]:void 0}function pf(e){return lf(e)?sf().notificationSchemas[e]:void 0}Object.keys(nf),Object.keys(rf);function mf(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function hf(e,t){if(e===void 0)return{ok:!1,reason:`not-in-era`};let n=e.safeParse(t);return n.success?{ok:!0,value:n.data}:{ok:!1,reason:`invalid`,message:String(n.error)}}var gf={ok:!1,reason:`not-in-era`};function _f(e){return mf(e)&&mf(e.outputSchema)&&Zd(e.outputSchema)}function vf(e){return e}var yf={era:`2025-11-25`,hasRequestMethod:cf,hasNotificationMethod:lf,validateRequest:(e,t)=>hf(ff(e),t),validateResult:(e,t)=>hf(df(e),t),validateNotification:(e,t)=>hf(pf(e),t),hasInputRequestMethod:()=>!1,validateInputRequest:()=>gf,validateInputResponse:()=>gf,samplingResultVariant:((e,t)=>{let n=Xd();return hf(e?n.CreateMessageResultWithToolsSchema:n.CreateMessageResultSchema,t)}),outboundEnvelope:e=>void 0,validateEnvelopeMeta:e=>[],projectCallToolResult(e,t){let n=Gd(e),r=n.structuredContent;if(r===void 0)return n;let i=typeof r!=`object`||!r||Array.isArray(r),a=t!==void 0&&Zd(t);return!i&&!a?n:{...n,structuredContent:{result:r}}},decodeResult(e,t){if(mf(t)&&`resultType`in t){let e={...t};return delete e.resultType,{kind:`complete`,result:vf(e)}}return{kind:`complete`,result:vf(t)}},encodeResult(e,t){if(e!==`tools/list`)return t;let n=t.tools;return!Array.isArray(n)||!n.some(e=>_f(e))?t:{...t,tools:n.map(e=>_f(e)?{...e,outputSchema:tf(e.outputSchema)}:e)}},encodeErrorCode:e=>e===-32002?-32602:e,checkInboundEnvelope:e=>void 0};function bf(){let e=sc(()=>z([j(),N(),P(),ws(),B(j(),e),I(e)])),t=B(j(),e),n=z([j(),N().int()]),r=j(),i=z([j(),N().int()]),a=V([`user`,`assistant`]),o=V([`debug`,`info`,`notice`,`warning`,`error`,`critical`,`alert`,`emergency`]),s=j().refine(e=>{try{return atob(e),!0}catch{return!1}},{message:`Invalid Base64 string`}),c=L({ttl:N().optional()}),l=L({taskId:j()}),u=R({progressToken:n.optional(),"io.modelcontextprotocol/related-task":l.optional()}),d=L({_meta:u.optional()}),f=d.extend({task:c.optional()}),p=L({_meta:u.optional()}),m=L({method:j(),params:p.loose().optional()}),h=L({src:j(),mimeType:j().optional(),sizes:I(j()).optional(),theme:V([`light`,`dark`]).optional()}),ee=L({icons:I(h).optional()}),te=L({name:j(),title:j().optional()}),ne=te.extend({...te.shape,...ee.shape,version:j(),websiteUrl:j().optional(),description:j().optional()}),g=dc(e=>e&&typeof e==`object`&&!Array.isArray(e)&&Object.keys(e).length===0?{form:{}}:e,Is(L({form:Is(L({applyDefaults:P().optional()}),t).optional(),url:t.optional()}),t.optional())),re=R({list:t.optional(),cancel:t.optional(),requests:R({sampling:R({createMessage:t.optional()}).optional(),elicitation:R({create:t.optional()}).optional()}).optional()}),ie=R({list:t.optional(),cancel:t.optional(),requests:R({tools:R({call:t.optional()}).optional()}).optional()}),ae=L({experimental:B(j(),t).optional(),sampling:L({context:t.optional(),tools:t.optional()}).optional(),elicitation:g.optional(),roots:L({listChanged:P().optional()}).optional(),tasks:re.optional(),extensions:B(j(),t).optional()}),oe=L({experimental:B(j(),t).optional(),logging:t.optional(),completions:t.optional(),prompts:L({listChanged:P().optional()}).optional(),resources:L({subscribe:P().optional(),listChanged:P().optional()}).optional(),tools:L({listChanged:P().optional()}).optional(),tasks:ie.optional(),extensions:B(j(),t).optional()}),se=L({progress:N(),total:U(N()),message:U(j())}),ce=L({...p.shape,...se.shape,progressToken:n}),_=m.extend({method:H(`notifications/progress`),params:ce}),le=p.extend({level:o,logger:j().optional(),data:F()}),ue=m.extend({method:H(`notifications/message`),params:le}),de=L({uri:j(),mimeType:U(j()),_meta:B(j(),F()).optional()}),fe=de.extend({text:j()}),pe=de.extend({blob:s}),me=L({audience:I(a).optional(),priority:N().min(0).max(1).optional(),lastModified:mc({offset:!0}).optional()}),he=L({...te.shape,...ee.shape,uri:j(),description:U(j()),mimeType:U(j()),size:U(N()),annotations:me.optional(),_meta:U(R({}))}),ge=L({...te.shape,...ee.shape,uriTemplate:j(),description:U(j()),mimeType:U(j()),annotations:me.optional(),_meta:U(R({}))}),_e=m.extend({method:H(`notifications/resources/list_changed`),params:p.optional()}),ve=p.extend({uri:j()}),ye=m.extend({method:H(`notifications/resources/updated`),params:ve}),be=L({name:j(),description:U(j()),required:U(P())}),xe=L({...te.shape,...ee.shape,description:U(j()),arguments:U(I(be)),_meta:U(R({}))}),Se=m.extend({method:H(`notifications/prompts/list_changed`),params:p.optional()}),Ce=L({type:H(`text`),text:j(),annotations:me.optional(),_meta:B(j(),F()).optional()}),v=L({type:H(`image`),data:s,mimeType:j(),annotations:me.optional(),_meta:B(j(),F()).optional()}),we=L({type:H(`audio`),data:s,mimeType:j(),annotations:me.optional(),_meta:B(j(),F()).optional()}),Te=L({type:H(`tool_use`),name:j(),id:j(),input:B(j(),F()),_meta:B(j(),F()).optional()}),Ee=L({type:H(`resource`),resource:z([fe,pe]),annotations:me.optional(),_meta:B(j(),F()).optional()}),De=he.extend({type:H(`resource_link`)}),Oe=z([Ce,v,we,De,Ee]),ke=L({role:a,content:Oe}),Ae=L({title:j().optional(),readOnlyHint:P().optional(),destructiveHint:P().optional(),idempotentHint:P().optional(),openWorldHint:P().optional()}),je=m.extend({method:H(`notifications/tools/list_changed`),params:p.optional()}),Me=L({name:j().optional()}),Ne=L({hints:I(Me).optional(),costPriority:N().min(0).max(1).optional(),speedPriority:N().min(0).max(1).optional(),intelligencePriority:N().min(0).max(1).optional()}),Pe=L({mode:V([`auto`,`required`,`none`]).optional()}),Fe=L({type:H(`boolean`),title:j().optional(),description:j().optional(),default:P().optional()}),Ie=L({type:H(`string`),title:j().optional(),description:j().optional(),minLength:N().optional(),maxLength:N().optional(),format:V([`email`,`uri`,`date`,`date-time`]).optional(),default:j().optional()}),y=L({type:V([`number`,`integer`]),title:j().optional(),description:j().optional(),minimum:N().optional(),maximum:N().optional(),default:N().optional()}),Le=L({type:H(`string`),title:j().optional(),description:j().optional(),enum:I(j()),default:j().optional()}),Re=L({type:H(`string`),title:j().optional(),description:j().optional(),oneOf:I(L({const:j(),title:j()})),default:j().optional()}),ze=L({type:H(`string`),title:j().optional(),description:j().optional(),enum:I(j()),enumNames:I(j()).optional(),default:j().optional()}),Be=z([Le,Re]),Ve=L({type:H(`array`),title:j().optional(),description:j().optional(),minItems:N().optional(),maxItems:N().optional(),items:L({type:H(`string`),enum:I(j())}),default:I(j()).optional()}),He=L({type:H(`array`),title:j().optional(),description:j().optional(),minItems:N().optional(),maxItems:N().optional(),items:L({anyOf:I(L({const:j(),title:j()}))}),default:I(j()).optional()}),Ue=z([Ve,He]),We=z([ze,Be,Ue]),b=z([We,Fe,Ie,y]),Ge=f.extend({mode:H(`form`).optional(),message:j(),requestedSchema:L({type:H(`object`),properties:B(j(),b),required:I(j()).optional()}).catchall(F())}),Ke=L({type:H(`ref/resource`),uri:j()}),x=L({type:H(`ref/prompt`),name:j()}),S=L({uri:j().startsWith(`file://`),name:j().optional(),_meta:B(j(),F()).optional()}),qe=ae.shape,Je=L({experimental:qe.experimental,sampling:qe.sampling,elicitation:qe.elicitation,roots:qe.roots,extensions:qe.extensions}),Ye=oe.shape,Xe=L({experimental:Ye.experimental,logging:Ye.logging,completions:Ye.completions,prompts:Ye.prompts,resources:Ye.resources,tools:Ye.tools,extensions:Ye.extensions}),Ze=R({progressToken:n.optional(),[yc]:j(),[bc]:ne.optional(),[Sc]:Je,[wc]:o.optional()}),Qe=L({...te.shape,...ee.shape,description:j().optional(),inputSchema:R({$schema:j().optional(),type:H(`object`)}),outputSchema:R({$schema:j().optional()}).optional(),annotations:Ae.optional(),_meta:B(j(),F()).optional()}),$e=L({type:H(`tool_result`),toolUseId:j(),content:I(Oe),structuredContent:F().optional(),isError:P().optional(),_meta:B(j(),F()).optional()}),et=z([Ce,v,we,Te,$e]),tt=L({role:a,content:z([et,I(et)]),_meta:B(j(),F()).optional()}),nt=j(),rt=R({[xc]:ne.optional().catch(void 0)}),it=rt.optional();function C(e){return R({_meta:it,resultType:nt.default(`complete`),...e})}let at=C({}),ot=C({nextCursor:r.optional()}),st=C({content:I(Oe),structuredContent:F().optional(),isError:P().optional()}),ct=C({ttlMs:N().int().min(0),cacheScope:V([`public`,`private`]),tools:I(Qe),nextCursor:r.optional()}),lt=C({ttlMs:N().int().min(0),cacheScope:V([`public`,`private`]),prompts:I(xe),nextCursor:r.optional()}),ut=C({description:j().optional(),messages:I(ke)}),dt=C({ttlMs:N().int().min(0),cacheScope:V([`public`,`private`]),resources:I(he),nextCursor:r.optional()}),ft=C({ttlMs:N().int().min(0),cacheScope:V([`public`,`private`]),resourceTemplates:I(ge),nextCursor:r.optional()}),pt=C({ttlMs:N().int().min(0),cacheScope:V([`public`,`private`]),contents:I(z([fe,pe]))}),mt=C({completion:L({values:I(j()).max(100),total:N().int().optional(),hasMore:P().optional()}).loose()}),ht=C({ttlMs:N().int().min(0),cacheScope:V([`public`,`private`])}),gt=C({ttlMs:N().int().min(0).catch(0),cacheScope:V([`public`,`private`]).catch(`private`),supportedVersions:I(j()),capabilities:Xe,instructions:j().optional()}),_t=L({messages:I(tt),modelPreferences:Ne.optional(),systemPrompt:j().optional(),includeContext:V([`none`,`thisServer`,`allServers`]).optional(),temperature:N().optional(),maxTokens:N().int(),stopSequences:I(j()).optional(),metadata:t.optional(),tools:I(Qe).optional(),toolChoice:Pe.optional()}),vt=L({method:H(`sampling/createMessage`),params:_t}),yt=L({method:H(`roots/list`),params:L({_meta:B(j(),F()).optional()}).optional()}),bt=L({...tt.shape,model:j(),stopReason:j().optional()}),xt=L({roots:I(S)}),St=L({action:V([`accept`,`decline`,`cancel`]),content:B(j(),z([j(),N(),P(),I(j())])).optional()}),Ct=L({mode:H(`url`),message:j(),url:j().url()}),wt=z([Ge,Ct]),Tt=L({method:H(`elicitation/create`),params:wt}),Et=z([vt,yt,Tt]),Dt=z([bt,xt,St]),Ot=B(j(),Et),kt=B(j(),Dt),At=C({inputRequests:Ot.optional(),requestState:j().optional()}),jt={inputResponses:kt.optional(),requestState:j().optional()},Mt=L({_meta:Ze,...jt}),Nt=R({progressToken:n.optional()});function Pt(e,t){return L({method:H(e),params:L({_meta:Ze,...t})})}function Ft(e,t){return L({method:H(e),params:L({_meta:Nt.optional(),...t}).optional()})}let It={name:j(),arguments:B(j(),F()).optional(),...jt},Lt={cursor:r.optional()},Rt=Pt(`tools/call`,It),zt=Pt(`tools/list`,Lt),Bt=Pt(`prompts/list`,Lt),Vt=Pt(`prompts/get`,{name:j(),arguments:B(j(),j()).optional(),...jt}),Ht=Pt(`resources/list`,Lt),Ut=Pt(`resources/templates/list`,Lt),Wt=Pt(`resources/read`,{uri:j(),...jt}),Gt={ref:z([x,Ke]),argument:L({name:j(),value:j()}),context:L({arguments:B(j(),j()).optional()}).optional()},Kt=Pt(`completion/complete`,Gt),qt=Pt(`server/discover`,{}),Jt=L({toolsListChanged:P().optional(),promptsListChanged:P().optional(),resourcesListChanged:P().optional(),resourceSubscriptions:I(j()).optional()}),Yt={notifications:Jt},Xt=Pt(`subscriptions/listen`,Yt),Zt=rt.extend({"io.modelcontextprotocol/subscriptionId":i}),Qt=R({_meta:Zt,resultType:nt.default(`complete`)}),$t={"tools/call":Ft(`tools/call`,It),"tools/list":Ft(`tools/list`,Lt),"prompts/get":Ft(`prompts/get`,{name:j(),arguments:B(j(),j()).optional()}),"prompts/list":Ft(`prompts/list`,Lt),"resources/list":Ft(`resources/list`,Lt),"resources/templates/list":Ft(`resources/templates/list`,Lt),"resources/read":Ft(`resources/read`,{uri:j()}),"completion/complete":Ft(`completion/complete`,Gt),"server/discover":Ft(`server/discover`,{}),"subscriptions/listen":Ft(`subscriptions/listen`,Yt)};function w(e){return R({_meta:it,...e})}let en={"tools/call":w({content:I(Oe),structuredContent:F().optional(),isError:P().optional()}),"tools/list":w({ttlMs:N().int().min(0),cacheScope:V([`public`,`private`]),tools:I(Qe),nextCursor:r.optional()}),"prompts/get":w({description:j().optional(),messages:I(ke)}),"prompts/list":w({ttlMs:N().int().min(0),cacheScope:V([`public`,`private`]),prompts:I(xe),nextCursor:r.optional()}),"resources/list":w({ttlMs:N().int().min(0),cacheScope:V([`public`,`private`]),resources:I(he),nextCursor:r.optional()}),"resources/templates/list":w({ttlMs:N().int().min(0),cacheScope:V([`public`,`private`]),resourceTemplates:I(ge),nextCursor:r.optional()}),"resources/read":w({ttlMs:N().int().min(0),cacheScope:V([`public`,`private`]),contents:I(z([fe,pe]))}),"completion/complete":w({completion:L({values:I(j()).max(100),total:N().int().optional(),hasMore:P().optional()}).loose()}),"server/discover":w({ttlMs:N().int().min(0).catch(0),cacheScope:V([`public`,`private`]).catch(`private`),supportedVersions:I(j()),capabilities:Xe,instructions:j().optional()}),"subscriptions/listen":w({})},tn=R({"io.modelcontextprotocol/subscriptionId":i.optional()}),nn=L({method:H(`notifications/subscriptions/acknowledged`),params:L({_meta:tn.optional(),notifications:Jt})}),rn=L({_meta:tn.optional(),requestId:i,reason:j().optional()}),an=L({method:H(`notifications/cancelled`),params:rn}),on={"notifications/cancelled":an,"notifications/progress":_,"notifications/message":ue,"notifications/resources/updated":ye,"notifications/resources/list_changed":_e,"notifications/tools/list_changed":je,"notifications/prompts/list_changed":Se,"notifications/subscriptions/acknowledged":nn},sn=e=>L({jsonrpc:H(`2.0`),id:z([j(),N().int()]),result:e}).strict();return{JSONValueSchema:e,JSONObjectSchema:t,ProgressTokenSchema:n,CursorSchema:r,RequestIdSchema:i,RoleSchema:a,LoggingLevelSchema:o,TaskMetadataSchema:c,RelatedTaskMetadataSchema:l,RequestMetaSchema:u,BaseRequestParamsSchema:d,TaskAugmentedRequestParamsSchema:f,NotificationsParamsSchema:p,NotificationSchema:m,IconSchema:h,IconsSchema:ee,BaseMetadataSchema:te,ImplementationSchema:ne,ClientTasksCapabilitySchema:re,ServerTasksCapabilitySchema:ie,ClientCapabilitiesSchema:ae,ServerCapabilitiesSchema:oe,ProgressSchema:se,ProgressNotificationParamsSchema:ce,ProgressNotificationSchema:_,LoggingMessageNotificationParamsSchema:le,LoggingMessageNotificationSchema:ue,ResourceContentsSchema:de,TextResourceContentsSchema:fe,BlobResourceContentsSchema:pe,AnnotationsSchema:me,ResourceSchema:he,ResourceTemplateSchema:ge,ResourceListChangedNotificationSchema:_e,ResourceUpdatedNotificationParamsSchema:ve,ResourceUpdatedNotificationSchema:ye,PromptArgumentSchema:be,PromptSchema:xe,PromptListChangedNotificationSchema:Se,TextContentSchema:Ce,ImageContentSchema:v,AudioContentSchema:we,ToolUseContentSchema:Te,EmbeddedResourceSchema:Ee,ResourceLinkSchema:De,ContentBlockSchema:Oe,PromptMessageSchema:ke,ToolAnnotationsSchema:Ae,ToolListChangedNotificationSchema:je,ModelHintSchema:Me,ModelPreferencesSchema:Ne,ToolChoiceSchema:Pe,BooleanSchemaSchema:Fe,StringSchemaSchema:Ie,NumberSchemaSchema:y,UntitledSingleSelectEnumSchemaSchema:Le,TitledSingleSelectEnumSchemaSchema:Re,LegacyTitledEnumSchemaSchema:ze,SingleSelectEnumSchemaSchema:Be,UntitledMultiSelectEnumSchemaSchema:Ve,TitledMultiSelectEnumSchemaSchema:He,MultiSelectEnumSchemaSchema:Ue,EnumSchemaSchema:We,PrimitiveSchemaDefinitionSchema:b,ElicitRequestFormParamsSchema:Ge,ResourceTemplateReferenceSchema:Ke,PromptReferenceSchema:x,RootSchema:S,ClientCapabilities2026Schema:Je,ServerCapabilities2026Schema:Xe,RequestMetaEnvelopeSchema:Ze,ToolSchema:Qe,ToolResultContentSchema:$e,SamplingMessageContentBlockSchema:et,SamplingMessageSchema:tt,ResultTypeSchema:nt,ResultMetaSchema:rt,ResultSchema:at,PaginatedResultSchema:ot,CallToolResultSchema:st,ListToolsResultSchema:ct,ListPromptsResultSchema:lt,GetPromptResultSchema:ut,ListResourcesResultSchema:dt,ListResourceTemplatesResultSchema:ft,ReadResourceResultSchema:pt,CompleteResultSchema:mt,CacheableResultSchema:ht,DiscoverResultSchema:gt,CreateMessageRequestParamsSchema:_t,CreateMessageRequestSchema:vt,ListRootsRequestSchema:yt,CreateMessageResultSchema:bt,ListRootsResultSchema:xt,ElicitResultSchema:St,ElicitRequestURLParamsSchema:Ct,ElicitRequestParamsSchema:wt,ElicitRequestSchema:Tt,InputRequestSchema:Et,InputResponseSchema:Dt,InputRequestsSchema:Ot,InputResponsesSchema:kt,InputRequiredResultSchema:At,InputResponseRequestParamsSchema:Mt,CallToolRequestSchema:Rt,ListToolsRequestSchema:zt,ListPromptsRequestSchema:Bt,GetPromptRequestSchema:Vt,ListResourcesRequestSchema:Ht,ListResourceTemplatesRequestSchema:Ut,ReadResourceRequestSchema:Wt,CompleteRequestSchema:Kt,DiscoverRequestSchema:qt,SubscriptionFilterSchema:Jt,SubscriptionsListenRequestSchema:Xt,SubscriptionsListenResultMetaSchema:Zt,SubscriptionsListenResultSchema:Qt,dispatchRequestSchemas:$t,dispatchResultSchemas:en,NotificationMetaSchema:tn,SubscriptionsAcknowledgedNotificationSchema:nn,CancelledNotificationParamsSchema:rn,CancelledNotificationSchema:an,notificationSchemas2026:on,JSONRPCResultResponseSchema:sn(at),CallToolResultResponseSchema:sn(z([st,At])),ListToolsResultResponseSchema:sn(ct),ListPromptsResultResponseSchema:sn(lt),GetPromptResultResponseSchema:sn(z([ut,At])),ListResourcesResultResponseSchema:sn(dt),ListResourceTemplatesResultResponseSchema:sn(ft),ReadResourceResultResponseSchema:sn(z([pt,At])),CompleteResultResponseSchema:sn(mt),DiscoverResultResponseSchema:sn(gt)}}var xf;function Sf(){return xf??=bf()}var Cf=[`tools/list`,`prompts/list`,`resources/list`,`resources/templates/list`,`resources/read`,`server/discover`];function wf(e){return Cf.includes(e)}var Tf=Symbol(`modelcontextprotocol.resultCacheHintFallback`);function Ef(e){return e[Tf]}function Df(e){return typeof e==`number`&&Number.isSafeInteger(e)&&e>=0}function Of(e){return e===`public`||e===`private`}var Z=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}({}),Q=class e extends Error{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.ProtocolError`})}static[Symbol.hasInstance](e){return Hd(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 Hd(this,e)}constructor(e,t,n){super(t),this.code=e,this.data=n,this.name=`ProtocolError`,Vd(this,new.target)}static fromError(t,n,r){if(t===Z.UrlElicitationRequired&&r){let e=r;if(e.elicitations)return new Af(e.elicitations,n)}if(t===Z.UnsupportedProtocolVersion&&r){let e=r;if(Array.isArray(e.supported)&&typeof e.requested==`string`)return new jf({supported:e.supported,requested:e.requested},n)}if(t===Z.InvalidParams||t===Z.ResourceNotFound){let e=r;if(typeof e?.uri==`string`&&(t===Z.ResourceNotFound||Object.keys(e).length===1))return new kf(e.uri,n)}if(t===Z.MissingRequiredClientCapability&&r){let e=r;if(e.requiredCapabilities!==null&&typeof e.requiredCapabilities==`object`&&!Array.isArray(e.requiredCapabilities))return new Mf({requiredCapabilities:e.requiredCapabilities},n)}return new e(t,n,r)}},kf=class extends Q{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.ResourceNotFoundError`})}constructor(e,t=`Resource not found: ${e}`){super(Z.InvalidParams,t,{uri:e})}get uri(){return this.data.uri}},Af=class extends Q{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.UrlElicitationRequiredError`})}constructor(e,t=`URL elicitation${e.length>1?`s`:``} required`){super(Z.UrlElicitationRequired,t,{elicitations:e})}get elicitations(){return this.data?.elicitations??[]}},jf=class extends Q{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.UnsupportedProtocolVersionError`})}constructor(e,t=`Unsupported protocol version: ${e.requested}`){super(Z.UnsupportedProtocolVersion,t,e)}get supported(){return this.data.supported}get requested(){return this.data.requested}},Mf=class extends Q{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.MissingRequiredClientCapabilityError`})}constructor(e,t=`Missing required client capabilities: ${Object.keys(e.requiredCapabilities).join(`, `)}`){super(Z.MissingRequiredClientCapability,t,e)}get requiredCapabilities(){return this.data.requiredCapabilities}},Nf=0,Pf=`private`,Ff=[`tools/call`,`prompts/get`,`resources/read`];function If(e,t){let n=t.resultType;if(n===void 0)return{...t,resultType:`complete`};if(n===`complete`||Ff.includes(e))return t;throw new Q(Z.InternalError,`Handler for ${e} returned resultType '${String(n)}', but results of ${e} only support 'complete' on protocol revision 2026-07-28`)}function Lf(e,t){let n=Ef(t);if(t.resultType!==`complete`||!wf(e))return n===void 0?t:Hf(t);let r=t,i=Df(r.ttlMs)?r.ttlMs:Bf(n),a=Of(r.cacheScope)?r.cacheScope:Vf(n),o={...r,ttlMs:i,cacheScope:a};return delete o[Tf],o}function Rf(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function zf(e,t){if(t===void 0)return e;let n=e._meta;return n===void 0?{...e,_meta:{[xc]:t}}:!Rf(n)||n[`io.modelcontextprotocol/serverInfo`]!==void 0?e:{...e,_meta:{...n,[xc]:t}}}function Bf(e){return e!==void 0&&Df(e.ttlMs)?e.ttlMs:Nf}function Vf(e){return e!==void 0&&Of(e.cacheScope)?e.cacheScope:Pf}function Hf(e){let t={...e};return delete t[Tf],t}var Uf=[`elicitation/create`,`sampling/createMessage`,`roots/list`],Wf;function Gf(){if(Wf)return Wf;let e=Sf();return Wf={request:{"elicitation/create":L({method:H(`elicitation/create`),params:e.ElicitRequestParamsSchema}),"sampling/createMessage":L({method:H(`sampling/createMessage`),params:e.CreateMessageRequestParamsSchema}),"roots/list":L({method:H(`roots/list`),params:R({}).optional()})},response:{"elicitation/create":e.ElicitResultSchema,"sampling/createMessage":e.CreateMessageResultSchema,"roots/list":e.ListRootsResultSchema}},Wf}function Kf(e){return Uf.includes(e)}function qf(e){return Kf(e)?Gf().request[e]:void 0}function Jf(e){return Kf(e)?Gf().response[e]:void 0}var Yf={"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},Xf={"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 Zf(e){return Object.prototype.hasOwnProperty.call(Yf,e)}function Qf(e){return Object.prototype.hasOwnProperty.call(Xf,e)}function $f(e){return Object.prototype.hasOwnProperty.call(Yf,e)}function ep(e){return Zf(e)?Sf().dispatchRequestSchemas[e]:void 0}function tp(e){return $f(e)?Sf().dispatchResultSchemas[e]:void 0}function np(e){return Qf(e)?Sf().notificationSchemas2026[e]:void 0}Object.keys(Yf),Object.keys(Xf);function rp(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function ip(e,t){if(e===void 0)return{ok:!1,reason:`not-in-era`};let n=e.safeParse(t);return n.success?{ok:!0,value:n.data}:{ok:!1,reason:`invalid`,message:String(n.error)}}var ap={ok:!1,reason:`not-in-era`},op=[yc,Sc];function sp(e,t){let n=t,r=!1,i=()=>(r||=(n={...n},!0),n),a=t.tools;e===`tools/list`&&Array.isArray(a)&&a.some(e=>rp(e)&&`execution`in e)&&(i().tools=a.map(e=>{if(!rp(e)||!(`execution`in e))return e;let t={...e};return delete t.execution,t}));let o=t.capabilities;if(rp(o)&&`tasks`in o){let e={...o};delete e.tasks,i().capabilities=e}return n}var cp={era:`2026-07-28`,hasRequestMethod:Zf,hasNotificationMethod:Qf,hasInputRequestMethod:e=>qf(e)!==void 0,validateRequest:(e,t)=>ip(ep(e),t),validateResult:(e,t)=>ip(tp(e),t),validateNotification:(e,t)=>ip(np(e),t),validateInputRequest:(e,t)=>ip(qf(e),t),validateInputResponse:(e,t)=>ip(Jf(e),t),samplingResultVariant:()=>ap,outboundEnvelope(e){return{[yc]:e.protocolVersion,[bc]:e.clientInfo,[Sc]:e.clientCapabilities,...e.logLevel!==void 0&&{"io.modelcontextprotocol/logLevel":e.logLevel}}},validateEnvelopeMeta(e){let t=[];for(let n of op)n in e||t.push({key:n,problem:`missing`});let n=Sf().RequestMetaEnvelopeSchema.safeParse(e);if(!n.success)for(let e of n.error.issues){let n=e.path.map(String),r=n.length>0?n.join(`.`):`_meta`;n.length===1&&t.some(e=>e.key===r&&e.problem===`missing`)||t.push({key:r,problem:e.message})}return t},projectCallToolResult:e=>Gd(e),inputRequestSchema:qf,decodeResult(e,t){if(!rp(t))return{kind:`invalid`,error:new X(Y.InvalidResult,`Invalid result for ${e}: not an object`,{method:e})};let n=t.resultType;if(n===void 0)return{kind:`invalid`,error:new X(Y.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 n!=`string`)return{kind:`invalid`,error:new X(Y.InvalidResult,`Invalid result for ${e}: non-string resultType`,{method:e,resultType:n})};if(n===`input_required`){let n=t.inputRequests,r=rp(n)?n:{},i=t.requestState;return Object.keys(r).length===0&&typeof i!=`string`?{kind:`invalid`,error:new X(Y.InvalidResult,`Invalid result for ${e}: input_required carries neither inputRequests nor requestState (every input_required result must include at least one of the two)`,{method:e,violation:`input-required-missing-both`})}:{kind:`input_required`,inputRequests:r,...typeof i==`string`&&{requestState:i}}}if(n!==`complete`)return{kind:`invalid`,error:new X(Y.UnsupportedResultType,`Unsupported result type '${n}' for ${e}`,{resultType:n,method:e})};let r=up(),i=Object.hasOwn(r,e)?r[e]:void 0;if(i!==void 0){let n=i.safeParse(t);if(!n.success)return{kind:`invalid`,error:new X(Y.InvalidResult,`Invalid result for ${e}: ${n.error}`,{method:e})}}let a={...t};return delete a.resultType,{kind:`complete`,result:a}},encodeResult(e,t,n){return zf(Lf(e,If(e,sp(e,t))),n)},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=Sf().RequestMetaEnvelopeSchema.safeParse(e.envelope);if(!t.success)return`Invalid _meta envelope for protocol revision 2026-07-28: ${t.error.issues.map(e=>e.message).join(`; `)}`}},lp;function up(){if(lp)return lp;let e=Sf();return lp={"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},lp}var dp=`2026-07-28`;function fp(e){return e!==void 0&&Wd(e)?cp:yf}function pp(e){return e.revision===void 0?e.era===`modern`?cp.era:yf.era:fp(e.revision).era}function mp(e){return gp.some(t=>t.hasRequestMethod(e))}function hp(e){return gp.some(t=>t.hasNotificationMethod(e))}var gp=[yf,cp],_p=n({AnnotationsSchema:()=>yl,AudioContentSchema:()=>Ql,BaseMetadataSchema:()=>Jc,BaseRequestParamsSchema:()=>G,BlobResourceContentsSchema:()=>_l,BooleanSchemaSchema:()=>Nu,CallToolRequestParamsSchema:()=>pu,CallToolRequestSchema:()=>mu,CallToolResultSchema:()=>du,CancelTaskRequestSchema:()=>yd,CancelTaskResultSchema:()=>bd,CancelledNotificationParamsSchema:()=>Wc,CancelledNotificationSchema:()=>Gc,ClientCapabilitiesSchema:()=>$c,ClientNotificationSchema:()=>Sd,ClientRequestSchema:()=>xd,ClientResultSchema:()=>Cd,ClientTasksCapabilitySchema:()=>Zc,CompatibilityCallToolResultSchema:()=>fu,CompleteRequestParamsSchema:()=>ed,CompleteRequestSchema:()=>td,CompleteResultSchema:()=>nd,ContentBlockSchema:()=>nu,CreateMessageRequestParamsSchema:()=>ku,CreateMessageRequestSchema:()=>Au,CreateMessageResultSchema:()=>ju,CreateMessageResultWithToolsSchema:()=>Mu,CreateTaskResultSchema:()=>ud,CursorSchema:()=>Oc,DiscoverRequestSchema:()=>al,DiscoverResultSchema:()=>ol,ElicitRequestFormParamsSchema:()=>Gu,ElicitRequestParamsSchema:()=>qu,ElicitRequestSchema:()=>Ju,ElicitRequestURLParamsSchema:()=>Ku,ElicitResultSchema:()=>Zu,ElicitationCompleteNotificationParamsSchema:()=>Yu,ElicitationCompleteNotificationSchema:()=>Xu,EmbeddedResourceSchema:()=>eu,EmptyResultSchema:()=>Uc,EnumSchemaSchema:()=>Uu,GetPromptRequestParamsSchema:()=>Jl,GetPromptRequestSchema:()=>Yl,GetPromptResultSchema:()=>iu,GetTaskPayloadRequestSchema:()=>hd,GetTaskPayloadResultSchema:()=>gd,GetTaskRequestSchema:()=>pd,GetTaskResultSchema:()=>md,IconSchema:()=>Kc,IconsSchema:()=>qc,ImageContentSchema:()=>Zl,ImplementationSchema:()=>Yc,InitializeRequestParamsSchema:()=>el,InitializeRequestSchema:()=>tl,InitializeResultSchema:()=>rl,InitializedNotificationSchema:()=>il,JSONArraySchema:()=>Ec,JSONObjectSchema:()=>W,JSONRPCErrorResponseSchema:()=>Bc,JSONRPCMessageSchema:()=>Vc,JSONRPCNotificationSchema:()=>Rc,JSONRPCRequestSchema:()=>Lc,JSONRPCResponseSchema:()=>Hc,JSONRPCResultResponseSchema:()=>zc,JSONValueSchema:()=>Tc,LegacyTitledEnumSchemaSchema:()=>Ru,ListChangedOptionsBaseSchema:()=>gu,ListPromptsRequestSchema:()=>Kl,ListPromptsResultSchema:()=>ql,ListResourceTemplatesRequestSchema:()=>wl,ListResourceTemplatesResultSchema:()=>Tl,ListResourcesRequestSchema:()=>Sl,ListResourcesResultSchema:()=>Cl,ListRootsRequestSchema:()=>id,ListRootsResultSchema:()=>ad,ListTasksRequestSchema:()=>_d,ListTasksResultSchema:()=>vd,ListToolsRequestSchema:()=>lu,ListToolsResultSchema:()=>uu,LoggingLevelSchema:()=>_u,LoggingMessageNotificationParamsSchema:()=>bu,LoggingMessageNotificationSchema:()=>xu,ModelHintSchema:()=>Su,ModelPreferencesSchema:()=>Cu,MultiSelectEnumSchemaSchema:()=>Hu,NotificationSchema:()=>Pc,NotificationsParamsSchema:()=>Nc,NumberSchemaSchema:()=>Fu,PaginatedRequestParamsSchema:()=>dl,PaginatedRequestSchema:()=>fl,PaginatedResultSchema:()=>pl,PingRequestSchema:()=>sl,PrimitiveSchemaDefinitionSchema:()=>Wu,ProgressNotificationParamsSchema:()=>ll,ProgressNotificationSchema:()=>ul,ProgressSchema:()=>cl,ProgressTokenSchema:()=>Dc,PromptArgumentSchema:()=>Wl,PromptListChangedNotificationSchema:()=>au,PromptMessageSchema:()=>ru,PromptReferenceSchema:()=>$u,PromptSchema:()=>Gl,ReadResourceRequestParamsSchema:()=>Dl,ReadResourceRequestSchema:()=>Ol,ReadResourceResultSchema:()=>kl,RelatedTaskMetadataSchema:()=>Ac,RequestIdSchema:()=>Ic,RequestMetaSchema:()=>jc,RequestSchema:()=>K,ResourceContentsSchema:()=>ml,ResourceLinkSchema:()=>tu,ResourceListChangedNotificationSchema:()=>Al,ResourceRequestParamsSchema:()=>El,ResourceSchema:()=>bl,ResourceTemplateReferenceSchema:()=>Qu,ResourceTemplateSchema:()=>xl,ResourceUpdatedNotificationParamsSchema:()=>Hl,ResourceUpdatedNotificationSchema:()=>Ul,ResultMetaObjectSchema:()=>Fc,ResultSchema:()=>q,RoleSchema:()=>vl,RootSchema:()=>rd,RootsListChangedNotificationSchema:()=>od,SamplingContentSchema:()=>Eu,SamplingMessageContentBlockSchema:()=>Du,SamplingMessageSchema:()=>Ou,ServerCapabilitiesSchema:()=>nl,ServerNotificationSchema:()=>Td,ServerRequestSchema:()=>wd,ServerResultSchema:()=>Ed,ServerTasksCapabilitySchema:()=>Qc,SetLevelRequestParamsSchema:()=>vu,SetLevelRequestSchema:()=>yu,SingleSelectEnumSchemaSchema:()=>zu,StringSchemaSchema:()=>Pu,SubscribeRequestParamsSchema:()=>jl,SubscribeRequestSchema:()=>Ml,SubscriptionFilterSchema:()=>Fl,SubscriptionsAcknowledgedNotificationParamsSchema:()=>Rl,SubscriptionsAcknowledgedNotificationSchema:()=>zl,SubscriptionsListenRequestParamsSchema:()=>Il,SubscriptionsListenRequestSchema:()=>Ll,SubscriptionsListenResultMetaSchema:()=>Bl,SubscriptionsListenResultSchema:()=>Vl,TaskAugmentedRequestParamsSchema:()=>Mc,TaskCreationParamsSchema:()=>sd,TaskMetadataSchema:()=>kc,TaskSchema:()=>ld,TaskStatusNotificationParamsSchema:()=>dd,TaskStatusNotificationSchema:()=>fd,TaskStatusSchema:()=>cd,TextContentSchema:()=>Xl,TextResourceContentsSchema:()=>hl,TitledMultiSelectEnumSchemaSchema:()=>Vu,TitledSingleSelectEnumSchemaSchema:()=>Lu,ToolAnnotationsSchema:()=>ou,ToolChoiceSchema:()=>wu,ToolExecutionSchema:()=>su,ToolListChangedNotificationSchema:()=>hu,ToolResultContentSchema:()=>Tu,ToolSchema:()=>cu,ToolUseContentSchema:()=>$l,UnsubscribeRequestParamsSchema:()=>Nl,UnsubscribeRequestSchema:()=>Pl,UntitledMultiSelectEnumSchemaSchema:()=>Bu,UntitledSingleSelectEnumSchemaSchema:()=>Iu}),vp=e=>Lc.safeParse(e).success,yp=e=>Rc.safeParse(e).success,bp=e=>zc.safeParse(e).success,xp=e=>Bc.safeParse(e).success;Z.InvalidRequest,Z.UnsupportedProtocolVersion,Z.InvalidParams,Z.MethodNotFound,Z.InvalidParams,Z.MissingRequiredClientCapability,Z.ParseError,Z.InvalidRequest,Z.MethodNotFound,Z.UnsupportedProtocolVersion,Z.MissingRequiredClientCapability;function Sp(e,t){return Mo(e,t)}function Cp(e){return new Set(e.flatMap(e=>Object.keys(e.shape)))}function wp(e){if(e==null)return!1;let t=typeof e;return t!==`object`&&t!==`function`||!(`~standard`in e)?!1:typeof e[`~standard`]?.validate==`function`}var Tp=!1,Ep=`draft-2020-12`;function Dp(e,t=`input`){let n=e[`~standard`],r;if(n.jsonSchema)r=n.jsonSchema[t]({target:Ep});else if(n.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().`);Tp||(Tp=!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=Eo(e,{target:Ep,io:t})}else throw Error(`Schema library "${n.vendor}" does not implement StandardJSONSchemaV1 (\`~standard.jsonSchema\`). Upgrade to a version that does, or wrap your JSON Schema with fromJsonSchema().`);if(t===`output`)return r.type===void 0&&Op(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 Op(e){if(`properties`in e||`patternProperties`in e||`additionalProperties`in e||`required`in e)return!0;for(let t of[`oneOf`,`anyOf`,`allOf`]){let n=e[t];if(Array.isArray(n)&&n.length>0)return n.every(e=>typeof e==`object`&&!!e&&(e.type===`object`||Op(e)))}return!1}function kp(e){return e.path?.length?`${e.path.map(e=>String(typeof e==`object`?e.key:e)).join(`.`)}: ${e.message}`:e.message}async function Ap(e,t){let n=await e[`~standard`].validate(t);return n.issues&&n.issues.length>0?{success:!1,error:n.issues.map(e=>kp(e)).join(`, `)}:{success:!0,data:n.value}}function jp(e){let t=Eo(e,{target:Ep,io:`input`});return typeof t.pattern==`string`?t.pattern:void 0}var Mp=/\\\.\\d\{(\d+)\}/;function Np(e){let t=Mp.exec(e),n=[void 0,-1,0];return t&&n.push(Number(t[1])),[!1,!0].flatMap(e=>[!1,!0].flatMap(t=>n.map(n=>mc({local:e,offset:t,precision:n}))))}function Pp(e,t){let n;switch(e){case`email`:n=[Zo()];break;case`uri`:n=[ts()];break;case`date`:n=[hc()];break;case`date-time`:n=Np(t)}return new Set(n.map(e=>jp(e)).filter(e=>e!==void 0))}function Fp(e,t,n){return n!==`zod`||Pp(e,t).has(t)}function Ip(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Lp(e){try{return Dp(e,`input`)}catch(e){let t=e instanceof Error?e.message:String(e);throw new Q(Z.InvalidParams,`Elicitation requestedSchema must describe an object with flat primitive properties: ${t}`)}}var Rp=new Set([`$comment`,`deprecated`,`description`,`examples`,`readOnly`,`title`,`writeOnly`]);function zp(e){return Rp.has(e)||e.startsWith(`x-`)}var Bp=new Set([`$schema`,...Object.keys(Gu.shape.requestedSchema.shape)]),Vp={string:Cp([Pu,Iu,Lu,Ru]),number:Cp([Fu]),integer:Cp([Fu]),boolean:Cp([Nu]),array:Cp([Bu,Vu])},Hp=new Set(Pu.shape.format.unwrap().options);function Up(e,t,n,r){if(!Ip(e))return e;let i=typeof e.type==`string`&&Object.hasOwn(Vp,e.type)?Vp[e.type]:void 0;if(i===void 0)return e;let a={};for(let[o,s]of Object.entries(e))i.has(o)||zp(o)?a[o]=s:o===`pattern`&&e.type===`string`&&typeof e.format==`string`?Hp.has(e.format)?(typeof s!=`string`||!Fp(e.format,s,n))&&r.push(`${t}.${o}`):a[o]=s:r.push(`${t}.${o}`);return a}function Wp(e,t){let n={},r=[];for(let[i,a]of Object.entries(e))i===`properties`&&Ip(a)?n[i]=Object.fromEntries(Object.entries(a).map(([e,n])=>[e,Up(n,`properties.${e}`,t,r)])):Bp.has(i)?n[i]=a:zp(i)||r.push(i);if(r.length>0)throw new Q(Z.InvalidParams,`Elicitation requestedSchema contains unsupported JSON Schema constraint(s) after Standard Schema conversion: ${r.join(`, `)}`);return n}function Gp(e,t){if(!Ip(e.properties))return t;let n=Object.entries(e.properties).filter(([,e])=>!Sp(Wu,e).success).map(([e])=>`properties.${e}`);return n.length>0?n.join(`, `):t}function Kp(e,t,n=``){return Array.isArray(e)&&Array.isArray(t)?e.flatMap((e,r)=>Kp(e,t[r],`${n}[${r}]`)):!Ip(e)||!Ip(t)?[]:Object.entries(e).flatMap(([e,r])=>{let i=n?`${n}.${e}`:e;return Object.prototype.hasOwnProperty.call(t,e)?Kp(r,t[e],i):zp(e)?[]:[i]})}function qp(e){if(!wp(e.requestedSchema))return{...e,mode:`form`,requestedSchema:e.requestedSchema};let t=e.requestedSchema[`~standard`].vendor,n=Wp(Lp(e.requestedSchema),t),r=Sp(Gu.shape.requestedSchema,n);if(!r.success)throw new Q(Z.InvalidParams,`Elicitation requestedSchema only supports flat primitive properties (string, number, integer, boolean, and string enums): ${Gp(n,r.error.message)}`);let i=Kp(n,r.data);if(i.length>0)throw new Q(Z.InvalidParams,`Elicitation requestedSchema contains unsupported JSON Schema constraint(s) after Standard Schema conversion: ${i.join(`, `)}`);let a=(r.data.required??[]).filter(e=>!Object.prototype.hasOwnProperty.call(r.data.properties,e));if(a.length>0)throw new Q(Z.InvalidParams,`Elicitation requestedSchema lists required properties that are not defined in properties: ${a.join(`, `)}`);return{...e,mode:`form`,requestedSchema:r.data}}function Jp(e){let t=e.inputRequests!==void 0&&Object.keys(e.inputRequests).length>0,n=typeof e.requestState==`string`;if(!t&&!n)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}}}Object.assign(Jp,{elicit(e){try{return{method:`elicitation/create`,params:qp(e)}}catch(e){throw e instanceof Q?TypeError(e.message,{cause:e}):e}},elicitUrl(e){return{method:`elicitation/create`,params:{...e,mode:`url`}}},createMessage(e){return{method:`sampling/createMessage`,params:e}},listRoots(){return{method:`roots/list`}}});var Yp=`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`.split(`.`),Xp={IdJagTokenExchangeResponseSchema:Md,OAuthClientInformationFullSchema:Ld,OAuthClientInformationSchema:Id,OAuthClientMetadataSchema:Fd,OAuthClientRegistrationErrorSchema:Rd,OAuthErrorResponseSchema:Nd,OAuthMetadataSchema:Od,OAuthProtectedResourceMetadataSchema:Dd,OAuthTokenRevocationRequestSchema:zd,OAuthTokensSchema:jd,OpenIdProviderDiscoveryMetadataSchema:Ad,OpenIdProviderMetadataSchema:kd},Zp={},Qp={};function $p(e,t){let n=e.slice(0,-6);Zp[n]=t,Qp[n]=e=>t.safeParse(e).success}for(let e of Yp)$p(e,_p[e]);for(let[e,t]of Object.entries(Xp))$p(e,t);Object.freeze(Zp),Object.freeze(Qp);function em(e){switch(e){case`initialize`:case`notifications/initialized`:return fp(void 0);case`server/discover`:return fp(dp);default:return}}var tm=[yc,bc,Sc,wc],nm=[`inputResponses`,`requestState`];function rm(e,t){let n=e.params;if(!cm(n))return{message:e,lifted:{}};let r=n._meta,i=cm(r)?tm.filter(e=>e in r):[],a=t===`request`?nm.filter(e=>e in n):[];if(i.length===0&&a.length===0)return{message:e,lifted:{}};let o={},s={...n};if(i.length>0&&cm(r)){let e={},t={...r};for(let n of i)e[n]=r[n],delete t[n];o.envelope=e,Object.keys(t).length>0?s._meta=t:delete s._meta}for(let e of a)e===`inputResponses`&&(o.inputResponses=s[e]),e===`requestState`&&(o.requestState=s[e]),delete s[e];return{message:{...e,params:s},lifted:o}}function im(e,t){let n=e.validateResult(t,void 0);if(n.ok||n.reason!==`not-in-era`)return{"~standard":{version:1,vendor:`mcp-wire-codec`,validate(n){let r=e.validateResult(t,n);return r.ok?{value:r.value}:{issues:[{message:r.reason===`invalid`?r.message:`not-in-era: ${t}`}]}}}}}function am(e){return()=>e}var om=am(void 0),sm=class{_transport;_requestMessageId=0;_requestHandlers=new Map;_requestHandlerAbortControllers=new Map;_notificationHandlers=new Map;_responseHandlers=new Map;_progressHandlers=new Map;_timeoutInfo=new Map;_pendingDebouncedNotifications=new Set;_negotiatedProtocolVersion;_supportedProtocolVersions;onclose;onerror;fallbackRequestHandler;fallbackNotificationHandler;constructor(e){this._options=e,this._supportedProtocolVersions=e?.supportedProtocolVersions??_c,this.setNotificationHandler(`notifications/cancelled`,e=>{this._oncancel(e)}),this.setNotificationHandler(`notifications/progress`,e=>{this._onprogress(e)}),this.setRequestHandler(`ping`,e=>({}))}_shouldDropInbound(e){}_outboundMetaEnvelope(){}_envelopeOutbound(e){let t=this._outboundMetaEnvelope();if(t===void 0)return e;let n=e.params??{};return{...e,params:{...n,_meta:{...t,...n._meta}}}}_resolveNonCompleteResult(e,t){return Promise.reject(new X(Y.UnsupportedResultType,`Unsupported result type '${e.kind}' for ${t.request.method}`,{resultType:e.kind,method:t.request.method}))}_getRequestHandler(e){return this._requestHandlers.get(e)}async _oncancel(e){e.params.requestId&&this._requestHandlerAbortControllers.get(e.params.requestId)?.abort(e.params.reason)}_setupTimeout(e,t,n,r,i=!1){this._timeoutInfo.set(e,{timeoutId:setTimeout(r,t),startTime:Date.now(),timeout:t,maxTotalTimeout:n,resetTimeoutOnProgress:i,onTimeout:r})}_resetTimeout(e){let t=this._timeoutInfo.get(e);if(!t)return!1;let n=Date.now()-t.startTime;if(t.maxTotalTimeout&&n>=t.maxTotalTimeout)throw this._timeoutInfo.delete(e),new X(Y.RequestTimeout,`Maximum total timeout exceeded`,{maxTotalTimeout:t.maxTotalTimeout,totalElapsed:n});return clearTimeout(t.timeoutId),t.timeoutId=setTimeout(t.onTimeout,t.timeout),!0}_cleanupTimeout(e){let t=this._timeoutInfo.get(e);t&&(clearTimeout(t.timeoutId),this._timeoutInfo.delete(e))}async connect(e){this._transport=e;let t=this.transport?.onclose;this._transport.onclose=()=>{try{t?.()}finally{this._onclose()}};let n=this.transport?.onerror;this._transport.onerror=e=>{n?.(e),this._onerror(e)};let r=this._transport?.onmessage;this._transport.onmessage=(e,t)=>{r?.(e,t),bp(e)||xp(e)?this._onresponse(e):vp(e)?this._onrequest(e,t):yp(e)?this._onnotification(e,t):this._onerror(Error(`Unknown message type: ${JSON.stringify(e)}`))},e.setSupportedProtocolVersions?.(this._supportedProtocolVersions),await this._transport.start()}_onclose(){let e=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._pendingDebouncedNotifications.clear();for(let e of this._timeoutInfo.values())clearTimeout(e.timeoutId);this._timeoutInfo.clear();let t=this._requestHandlerAbortControllers;this._requestHandlerAbortControllers=new Map;let n=new X(Y.ConnectionClosed,`Connection closed`);this._transport=void 0;try{this.onclose?.()}finally{for(let t of e.values())t(n);for(let e of t.values())e.abort(n)}}_onerror(e){this.onerror?.(e)}_onnotification(e,t){let{message:n}=rm(e,`notification`),r=this._negotiatedWireCodec();if(t?.classification===void 0&&this._shouldDropInbound(e)===`drop`)return;if(t?.classification!==void 0){let e=pp(t.classification);if(e!==r.era){this._onerror(Error(`Era mismatch on inbound notification '${n.method}': classified as ${e} but this instance serves ${r.era}`));return}}if(hp(n.method)&&!r.hasNotificationMethod(n.method))return;let i=this._notificationHandlers.get(n.method),a=this.fallbackNotificationHandler;(i!==void 0||a!==void 0)&&Promise.resolve().then(()=>i===void 0?a(n):i(n,r)).catch(e=>this._onerror(Error(`Uncaught error in notification handler: ${e}`)))}_onrequest(e,t){let{message:n,lifted:r}=rm(e,`request`),i=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 a=this._transport,o=(e,t,r)=>{let i={jsonrpc:`2.0`,id:n.id,error:{code:e,message:t,...r!==void 0&&{data:r}}};a?.send(i).catch(e=>this._onerror(Error(`Failed to send an error response: ${e}`)))};if(t?.classification!==void 0){let e=pp(t.classification);if(e!==i.era){this._onerror(Error(`Era mismatch on inbound request '${n.method}': classified as ${e} but this instance serves ${i.era}`));let r=t.classification.revision??e;o(Z.UnsupportedProtocolVersion,`Unsupported protocol version: ${r}`,{supported:this._supportedProtocolVersions,requested:r});return}}if(mp(n.method)&&!i.hasRequestMethod(n.method)){o(Z.MethodNotFound,`Method not found`);return}let s=this._requestHandlers.get(n.method)??this.fallbackRequestHandler;if(s===void 0){o(Z.MethodNotFound,`Method not found`);return}let c=i.checkInboundEnvelope(r);if(c!==void 0){o(Z.InvalidParams,c);return}let l=(e,t)=>this._notificationViaCodec(this._resolveOutboundCodec(e.method),e,{...t,relatedRequestId:n.id}),u=(e,t,r)=>this._requestWithSchemaViaCodec(this._resolveOutboundCodec(e.method),e,t,{...r,relatedRequestId:n.id}),d=new AbortController;this._requestHandlerAbortControllers.set(n.id,d);let f=r.inputResponses===void 0?void 0:um(r.inputResponses),p={sessionId:a?.sessionId,mcpReq:{id:n.id,method:n.method,_meta:n.params?._meta,...r.envelope!==void 0&&{envelope:r.envelope},...f!==void 0&&{inputResponses:f.accepted},...f!==void 0&&f.droppedKeys.length>0&&{droppedInputResponseKeys:f.droppedKeys},requestState:r.requestState===void 0?om:am(r.requestState),signal:d.signal,send:((e,t,n)=>{let r=this._resolveOutboundCodec(e.method);if(this._assertOutboundRequestInEra(r,e.method),wp(t))return u(e,t,n);let i=im(r,e.method);if(i===void 0)throw TypeError(`'${e.method}' is not a spec method; pass a result schema as the second argument to ctx.mcpReq.send().`);return u(e,i,t)}),notify:l},http:t?.authInfo?{authInfo:t.authInfo}:void 0},m=this.buildContext(p,t);Promise.resolve().then(()=>s(n,m)).then(async e=>{if(d.signal.aborted)return;let t;try{t=i.encodeResult(n.method,e,this._outboundServerInfo())}catch(e){this._onerror(Error(`Failed to encode result for ${n.method}: ${e}`)),o(Z.InternalError,`Internal error`);return}let r={result:t,jsonrpc:`2.0`,id:n.id};await a?.send(r)},async e=>{if(d.signal.aborted)return;let t=Number.isSafeInteger(e.code)?e.code:Z.InternalError,r={jsonrpc:`2.0`,id:n.id,error:{code:i.encodeErrorCode(t),message:e.message??`Internal error`,...e.data!==void 0&&{data:e.data}}};await a?.send(r)}).catch(e=>this._onerror(Error(`Failed to send response: ${e}`))).finally(()=>{this._requestHandlerAbortControllers.get(n.id)===d&&this._requestHandlerAbortControllers.delete(n.id)})}_onprogress(e){let{progressToken:t,...n}=e.params,r=Number(t),i=this._progressHandlers.get(r);if(!i){this._onerror(Error(`Received a progress notification for an unknown token: ${JSON.stringify(e)}`));return}let a=this._responseHandlers.get(r),o=this._timeoutInfo.get(r);if(o&&a&&o.resetTimeoutOnProgress)try{this._resetTimeout(r)}catch(e){this._responseHandlers.delete(r),this._progressHandlers.delete(r),this._cleanupTimeout(r),a(e);return}i(n)}_onresponse(e){let t=Number(e.id),n=this._responseHandlers.get(t);if(n===void 0){this._onerror(Error(`Received a response for an unknown message ID: ${JSON.stringify(e)}`));return}this._responseHandlers.delete(t),this._cleanupTimeout(t),this._progressHandlers.delete(t),bp(e)?n(e):n(Q.fromError(e.error.code,e.error.message,e.error.data))}get transport(){return this._transport}async close(){await this._transport?.close()}request(e,t,n){let r=this._resolveOutboundCodec(e.method);if(this._assertOutboundRequestInEra(r,e.method),wp(t))return this._requestWithSchemaViaCodec(r,e,t,n);let i=im(r,e.method);if(i===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,i,t)}_negotiatedWireCodec(){return fp(this._negotiatedProtocolVersion)}_wireCodec(){return this._negotiatedWireCodec()}_resolveOutboundCodec(e){if(this._negotiatedProtocolVersion===void 0){let t=em(e);if(t)return t}return this._negotiatedWireCodec()}_assertOutboundRequestInEra(e,t){if(mp(t)&&!e.hasRequestMethod(t))throw new X(Y.MethodNotSupportedByProtocolVersion,`Method '${t}' is not supported by the negotiated protocol version (wire era ${e.era})`,{method:t,era:e.era})}_requestWithSchema(e,t,n){let r=this._resolveOutboundCodec(e.method);return this._assertOutboundRequestInEra(r,e.method),this._requestWithSchemaViaCodec(r,e,t,n)}_requestWithSchemaViaCodec(e,t,n,r){let{relatedRequestId:i,resumptionToken:a,onresumptiontoken:o,headers:s}=r??{},c=Date.now(),l,u;return new Promise((d,f)=>{let p=e=>{f(e)};if(!this._transport){p(Error(`Not connected`));return}if(this._options?.enforceStrictCapabilities===!0)try{this.assertCapabilityForMethod(t.method)}catch(e){p(e);return}if(r?.signal?.aborted){let e=r.signal.reason;throw e instanceof X?e:new X(Y.RequestTimeout,String(e))}let m=e.era===`2026-07-28`&&this._transport.hasPerRequestStream===!0?new AbortController:void 0,h=this._requestMessageId++;u=h;let ee={...t,jsonrpc:`2.0`,id:h};r?.onprogress&&(this._progressHandlers.set(h,r.onprogress),ee.params={...t.params,_meta:{...t.params?._meta,progressToken:h}});let te=this._envelopeOutbound(ee),ne=!1,g=e=>{ne||(this._progressHandlers.delete(h),m===void 0?this._transport?.send(this._envelopeOutbound({jsonrpc:`2.0`,method:`notifications/cancelled`,params:{requestId:h,reason:String(e)}}),{relatedRequestId:i,resumptionToken:a,onresumptiontoken:o}).catch(e=>this._onerror(Error(`Failed to send cancellation: ${e}`))):m.abort(),f(e instanceof X?e:new X(Y.RequestTimeout,String(e))))};this._responseHandlers.set(h,i=>{if(r?.signal?.aborted)return;if(ne=!0,i instanceof Error)return f(i);let a;try{a=e.decodeResult(t.method,i.result)}catch(e){return f(e instanceof Error?e:Error(String(e)))}if(a.kind===`invalid`)return f(a.error);if(a.kind===`input_required`){if(r?.allowInputRequired===!0)return d(dm(a));let i={codec:e,request:t,resultSchema:n,options:r,flowStartedAt:c,retry:(r,i)=>this._requestWithSchemaViaCodec(e,r===void 0?{method:t.method}:{method:t.method,params:r},n,i)};return d(this._resolveNonCompleteResult(a,i))}let o=a.result;Ap(n,o).then(e=>{e.success?d(e.data):f(new X(Y.InvalidResult,`Invalid result for ${t.method}: ${e.error}`))},f)}),l=()=>g(r?.signal?.reason),r?.signal?.addEventListener(`abort`,l,{once:!0});let re=r?.timeout??6e4;this._setupTimeout(h,re,r?.maxTotalTimeout,()=>g(new X(Y.RequestTimeout,`Request timed out`,{timeout:re})),r?.resetTimeoutOnProgress??!1),this._transport.send(te,{relatedRequestId:i,resumptionToken:a,onresumptiontoken:o,headers:s,requestSignal:m?.signal}).catch(e=>{this._progressHandlers.delete(h),f(e)})}).finally(()=>{l&&r?.signal?.removeEventListener(`abort`,l),u!==void 0&&(this._responseHandlers.delete(u),this._cleanupTimeout(u))})}async notification(e,t){return this._notificationViaCodec(this._resolveOutboundCodec(e.method),e,t)}async _notificationViaCodec(e,t,n){if(!this._transport)throw new X(Y.NotConnected,`Not connected`);if(hp(t.method)&&!e.hasNotificationMethod(t.method))throw new X(Y.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&&!n?.relatedRequestId){if(this._pendingDebouncedNotifications.has(t.method))return;this._pendingDebouncedNotifications.add(t.method),Promise.resolve().then(()=>{this._pendingDebouncedNotifications.delete(t.method),this._transport&&this._transport?.send(r,n).catch(e=>this._onerror(e))});return}await this._transport.send(r,n)}setRequestHandler(e,t,n){this.assertRequestHandlerCapability(e);let r;if(typeof t==`function`){if(!mp(e))throw TypeError(`'${e}' is not a spec request method; pass schemas as the second argument to setRequestHandler().`);r=(n,r)=>{let i=this._negotiatedWireCodec(),a=i.validateRequest(e,n);if(!a.ok&&a.reason===`not-in-era`&&(a=i.validateInputRequest(e,n)),!a.ok)throw a.reason===`not-in-era`?new Q(Z.InternalError,`No wire schema for ${e} in the resolved era`):Error(a.message);return Promise.resolve(t(a.value,r))}}else if(n)r=async(r,i)=>{let a=await Ap(t.params,{...r.params});if(!a.success)throw new Q(Z.InvalidParams,`Invalid params for ${e}: ${a.error}`);return n(a.data,i)};else throw TypeError(`setRequestHandler: handler is required`);this._requestHandlers.set(e,this._wrapHandler(e,r))}_wrapHandler(e,t){return t}_outboundServerInfo(){}removeRequestHandler(e){this._requestHandlers.delete(e)}assertCanSetRequestHandler(e){if(this._requestHandlers.has(e))throw Error(`A request handler for ${e} already exists, which would be overridden`)}setNotificationHandler(e,t,n){if(typeof t==`function`){if(!hp(e))throw TypeError(`'${e}' is not a spec notification method; pass schemas as the second argument to setNotificationHandler().`);this._notificationHandlers.set(e,(n,r)=>{let i=r.validateNotification(e,n);if(!i.ok)throw i.reason===`not-in-era`?new Q(Z.InternalError,`No wire schema for ${e} in the resolved era`):Error(i.message);return Promise.resolve(t(i.value))});return}if(!n)throw TypeError(`setNotificationHandler: handler is required`);this._notificationHandlers.set(e,async r=>{let i=await Ap(t.params,{...r.params});if(!i.success)throw new Q(Z.InvalidParams,`Invalid params for notification ${e}: ${i.error}`);await n(i.data,r)})}removeNotificationHandler(e){this._notificationHandlers.delete(e)}};function cm(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function lm(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function um(e){let t={},n=[];if(!lm(e))return{accepted:t,droppedKeys:n};for(let[r,i]of Object.entries(e)){if(!lm(i)||`method`in i||`result`in i){n.push(r);continue}t[r]=i}return{accepted:t,droppedKeys:n}}function dm(e){return{resultType:`input_required`,inputRequests:e.inputRequests,...e.requestState!==void 0&&{requestState:e.requestState}}}t((e=>{var t=/; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g,n=/\\([\u000b\u0020-\u00ff])/g,r=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;e.parse=i;function i(e){if(!e)throw TypeError(`argument string is required`);var i=typeof e==`object`?a(e):e;if(typeof i!=`string`)throw TypeError(`argument string is required to be a string`);var s=i.indexOf(`;`),c=s===-1?i.trim():i.slice(0,s).trim();if(!r.test(c))throw TypeError(`invalid media type`);var l=new o(c.toLowerCase());if(s!==-1){var u,d,f;for(t.lastIndex=s;d=t.exec(i);){if(d.index!==s)throw TypeError(`invalid parameter format`);s+=d[0].length,u=d[1].toLowerCase(),f=d[2],f.charCodeAt(0)===34&&(f=f.slice(1,-1),f.indexOf(`\\`)!==-1&&(f=f.replace(n,`$1`))),l.parameters[u]=f}if(s!==i.length)throw TypeError(`invalid parameter format`)}return l}function a(e){var t;if(typeof e.getHeader==`function`?t=e.getHeader(`content-type`):typeof e.headers==`object`&&(t=e.headers&&e.headers[`content-type`]),typeof t!=`string`)throw TypeError(`content-type header is missing from object`);return t}function o(e){this.parameters=Object.create(null),this.type=e}}))(),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 fm=/^(\d\d):(\d\d):(\d\d)(\.\d+)?(z|[+-]\d\d(?::?\d\d)?)?$/i,pm=/^(?=.{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,mm=/^(?:[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,hm=/^(?:(?:[^\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,gm=/^(?:(?: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,_m=/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,vm=/^(?:\/(?:[^~/]|~0|~1)*)*$/,ym=/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,bm=/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,xm=/^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/,Sm=/^((([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;function Cm(e){return e.test.bind(e)}wm.bind(void 0,!1),Cm(mm),Cm(hm),Cm(gm),Cm(pm),Cm(xm),Cm(Sm),Cm(_m),Cm(vm),Cm(ym),Cm(bm);function wm(e,t){let n=t.match(fm);if(!n)return!1;let r=+n[1],i=+n[2],a=+n[3],o=!!n[5];return(r<=23&&i<=59&&a<=59||r==23&&i==59&&a==60)&&(!e||o)}globalThis.crypto;var Tm=class extends Error{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.OAuthClientFlowError`})}static[Symbol.hasInstance](e){return Hd(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 Hd(this,e)}constructor(e){super(e),this.name=new.target.name,Vd(this,new.target)}};(class extends Tm{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.IssuerMismatchError`})}kind;expected;received;constructor(e,t,n){super(`Issuer mismatch in ${e===`metadata`?`authorization server metadata (RFC 8414 §3.3)`:`authorization response (RFC 9207)`}: expected ${JSON.stringify(t)}, received ${JSON.stringify(n)}`),this.kind=e,this.expected=t,this.received=n}}),class extends Tm{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}},class extends Tm{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.InsecureTokenEndpointError`})}tokenEndpoint;constructor(e){super(`Refusing to send credentials to non-https token endpoint '${e}'. OAuth token requests MUST use TLS (localhost / 127.0.0.1 / ::1 are exempt).`),this.tokenEndpoint=e}},class extends Tm{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.AuthorizationServerMismatchError`})}constructor(e,t){super(`Authorization server changed between redirect and callback (redirected to ${JSON.stringify(e)}, callback resolved ${JSON.stringify(t)}); refusing to send authorization_code/code_verifier to a different token endpoint`),this.recordedIssuer=e,this.currentIssuer=t}},class extends Tm{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}},class extends Error{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.UnauthorizedError`})}static[Symbol.hasInstance](e){return Hd(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 Hd(this,e)}constructor(e){super(e??`Unauthorized`),this.name=`UnauthorizedError`,Vd(this,new.target)}},class extends Error{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.SseError`})}static[Symbol.hasInstance](e){return Hd(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 Hd(this,e)}constructor(e,t,n){super(`SSE error: ${t}`),this.code=e,this.event=n,Vd(this,new.target)}};var Em=class{_eventSlots=new Map;setHandler(e,t){let n=this._ensureEventSlot(e);n.onHandler&&t&&console.warn(`[MCP Apps] on${String(e)} handler replaced. Use addEventListener("${String(e)}", …) to add multiple listeners without replacing.`),n.onHandler=t}getHandler(e){return this._eventSlots.get(e)?.onHandler}addEventListener(e,t){this._ensureEventSlot(e).listeners.push(t)}removeEventListener(e,t){let n=this._eventSlots.get(e);if(!n)return;let r=n.listeners.indexOf(t);r!==-1&&n.listeners.splice(r,1)}dispatch(e,t){let n=this._eventSlots.get(e);if(n){n.onHandler?.(t);for(let e of[...n.listeners])e(t)}}_ensureEventSlot(e){let t=this._eventSlots.get(e);return t||(t={listeners:[]},this._eventSlots.set(e,t)),t}},Dm=class{_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)}},Om=new Set;function km(e,t){let[n,r]=t,i=n?.shape;if(typeof i?.method?.value!=`string`)return;let a=i.method.value,o=e===`request`?`setRequestHandler`:`setNotificationHandler`;Om.has(o)||(Om.add(o),console.warn(`[ext-apps] ${o}(Schema, handler) is deprecated; use ${o}("${a}", { params: Schema.shape.params }, handler).`));let s=r;return[a,{params:i.params},e===`request`?(e,t)=>s({method:a,params:e},Am(t)):e=>s({method:a,params:e})]}function Am(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 jm=`2026-01-26`,Mm=class{eventTarget;eventSource;messageListener;constructor(e=window.parent,t){this.eventTarget=e,this.eventSource=t,this.messageListener=e=>{if(t&&e.source!==this.eventSource){console.debug(`Ignoring message from unknown source`,e);return}let n=Vc.safeParse(e.data);n.success?(console.debug(`Parsed message`,n.data),this.onmessage?.(n.data)):e.data?.jsonrpc===`2.0`?(console.error(`Failed to parse message`,n.error.message,e),this.onerror?.(Error(`Invalid JSON-RPC message received: `+n.error.message))):console.debug(`Ignoring non-JSON-RPC message`,n.error.message,e)}}async start(){window.addEventListener(`message`,this.messageListener)}async send(e,t){e.method!==`ui/notifications/tool-input-partial`&&console.debug(`Sending message`,e),this.eventTarget.postMessage(e,`*`)}async close(){window.removeEventListener(`message`,this.messageListener),this.onclose?.()}onclose;onerror;onmessage;sessionId;setProtocolVersion},Nm=z([H(`light`),H(`dark`)]).describe(`Color theme preference for the host environment.`),Pm=z([H(`inline`),H(`fullscreen`),H(`pip`)]).describe(`Display mode for UI presentation.`),Fm=B(z([H(`--color-background-primary`),H(`--color-background-secondary`),H(`--color-background-tertiary`),H(`--color-background-inverse`),H(`--color-background-ghost`),H(`--color-background-info`),H(`--color-background-danger`),H(`--color-background-success`),H(`--color-background-warning`),H(`--color-background-disabled`),H(`--color-text-primary`),H(`--color-text-secondary`),H(`--color-text-tertiary`),H(`--color-text-inverse`),H(`--color-text-ghost`),H(`--color-text-info`),H(`--color-text-danger`),H(`--color-text-success`),H(`--color-text-warning`),H(`--color-text-disabled`),H(`--color-border-primary`),H(`--color-border-secondary`),H(`--color-border-tertiary`),H(`--color-border-inverse`),H(`--color-border-ghost`),H(`--color-border-info`),H(`--color-border-danger`),H(`--color-border-success`),H(`--color-border-warning`),H(`--color-border-disabled`),H(`--color-ring-primary`),H(`--color-ring-secondary`),H(`--color-ring-inverse`),H(`--color-ring-info`),H(`--color-ring-danger`),H(`--color-ring-success`),H(`--color-ring-warning`),H(`--font-sans`),H(`--font-mono`),H(`--font-weight-normal`),H(`--font-weight-medium`),H(`--font-weight-semibold`),H(`--font-weight-bold`),H(`--font-text-xs-size`),H(`--font-text-sm-size`),H(`--font-text-md-size`),H(`--font-text-lg-size`),H(`--font-heading-xs-size`),H(`--font-heading-sm-size`),H(`--font-heading-md-size`),H(`--font-heading-lg-size`),H(`--font-heading-xl-size`),H(`--font-heading-2xl-size`),H(`--font-heading-3xl-size`),H(`--font-text-xs-line-height`),H(`--font-text-sm-line-height`),H(`--font-text-md-line-height`),H(`--font-text-lg-line-height`),H(`--font-heading-xs-line-height`),H(`--font-heading-sm-line-height`),H(`--font-heading-md-line-height`),H(`--font-heading-lg-line-height`),H(`--font-heading-xl-line-height`),H(`--font-heading-2xl-line-height`),H(`--font-heading-3xl-line-height`),H(`--border-radius-xs`),H(`--border-radius-sm`),H(`--border-radius-md`),H(`--border-radius-lg`),H(`--border-radius-xl`),H(`--border-radius-full`),H(`--border-width-regular`),H(`--shadow-hairline`),H(`--shadow-sm`),H(`--shadow-md`),H(`--shadow-lg`)]).describe(`CSS variable keys available to MCP apps for theming.`).describe(`Style variables for theming MCP apps.
63
+ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let n of e.seen.entries()){let r=n[1];if(t===n[0]){a(n);continue}if(e.external){let r=e.external.registry.get(n[0])?.id;if(t!==n[0]&&r){a(n);continue}}if(e.metadataRegistry.get(n[0])?.id){a(n);continue}if(r.cycle){a(n);continue}r.count>1&&e.reused===`ref`&&a(n)}e.external&&(e.sharedDefsExtractedFor=e.external)}function Ga(e){let t=e.anyOf;if(!Array.isArray(t)||t.length===0||e.type!==void 0)return;let n=[];for(let e of t){if(!e||typeof e!=`object`)return;Ga(e);let t=Object.keys(e);if(t.length!==1||t[0]!==`type`)return;let r=e.type;for(let e of Array.isArray(r)?r:[r]){if(typeof e!=`string`)return;n.includes(e)||n.push(e)}}delete e.anyOf,e.type=n.length===1?n[0]:n}var Ka=new Set([`type`,`properties`,`required`,`additionalProperties`]),qa=[`oneOf`,`anyOf`];function Ja(e){let t=e.additionalProperties;return t===void 0||t===!1||typeof t!=`object`||!t?null:Object.keys(t).length?t:null}function Ya(e){let t=[];for(let n of e){if(typeof n!=`object`||n.type!==`object`)return null;for(let e in n)if(!Ka.has(e))return null;t.push(n)}let n={},r=new Set;for(let e of t){for(let r in e.properties){if(Object.prototype.hasOwnProperty.call(n,r))continue;let e=[];for(let n of t){let t=n.properties?.[r]??Ja(n);t!=null&&(e.some(e=>JSON.stringify(e)===JSON.stringify(t))||e.push(t))}h(n,r,e.length===1?e[0]:Ya(e)??{allOf:e})}for(let t of e.required??[])r.add(t)}let i={type:`object`,properties:n};if(r.size&&(i.required=[...r]),t.every(e=>e.additionalProperties===!1))i.additionalProperties=!1;else{let e=[];for(let n of t){let t=Ja(n);t&&!e.some(e=>JSON.stringify(e)===JSON.stringify(t))&&e.push(t)}e.length===1?i.additionalProperties=e[0]:e.length>1&&(i.additionalProperties={allOf:e})}return i}function Xa(e){let t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(let t of Ka)if(t in e)return;let n=t.filter(e=>qa.some(t=>Array.isArray(e[t]))),r=null;if(!n.length)r=Ya(t);else{let e=n[0],i=qa.find(t=>Array.isArray(e[t]));if(Object.keys(e).length!==1)return;let a=t.filter(t=>t!==e),o=e[i].map(e=>Ya([...a,e]));if(o.some(e=>!e))return;r={[i]:o}}r&&(delete e.allOf,Va(e,r))}function Za(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=t=>{let n=e.seen.get(t);if(n.ref===null)return;let i=n.def??n.schema,a={...i},o=n.ref;if(n.ref=null,o){r(o);let n=e.seen.get(o),s=n.schema;if(s.$ref&&(e.target===`draft-07`||e.target===`draft-04`||e.target===`openapi-3.0`)?(i.allOf=i.allOf??[],i.allOf.push(s)):Va(i,s),Va(i,a),t._zod.parent===o)for(let e in i)e!==`$ref`&&e!==`allOf`&&(e in a||delete i[e]);if(s.$ref&&n.def)for(let e in i)e!==`$ref`&&e!==`allOf`&&e in n.def&&JSON.stringify(i[e])===JSON.stringify(n.def[e])&&delete i[e]}let s=t._zod.parent;if(s&&s!==o){r(s);let t=e.seen.get(s);if(t?.schema.$ref&&(i.$ref=t.schema.$ref,t.def))for(let e in i)e!==`$ref`&&e!==`allOf`&&e in t.def&&JSON.stringify(i[e])===JSON.stringify(t.def[e])&&delete i[e]}e.override({zodSchema:t,jsonSchema:i,path:n.path??[]})};if(!e.external||e.sharedEmitDoneFor!==e.external){for(let t of[...e.seen.entries()].reverse())r(t[0]);if(e.target!==`openapi-3.0`)for(let t of e.seen.entries())Ga(t[1].def??t[1].schema);for(let t of e.deferred)t();if(e.intersections.length){let t=new Map;for(let n of e.seen.values())for(let e of[n.schema,n.def]){let n=e?.allOf;if(!Array.isArray(n))continue;let r=t.get(n);r?r.push(e):t.set(n,[e])}for(let n of e.intersections)for(let e of t.get(n)??[])Xa(e)}}let i={};if(e.target===`draft-2020-12`?i.$schema=`https://json-schema.org/draft/2020-12/schema`:e.target===`draft-07`?i.$schema=`http://json-schema.org/draft-07/schema#`:e.target===`draft-04`?i.$schema=`http://json-schema.org/draft-04/schema#`:e.target,e.external?.uri){let n=e.external.registry.get(t)?.id;if(!n)throw Error("Schema is missing an `id` property");i.$id=e.external.uri(n)}Va(i,n.defId?n.schema:n.def??n.schema);let a=e.metadataRegistry.get(t)?.id;a!==void 0&&i.id===a&&delete i.id;let o=e.external?.defs??{};if(!e.external||e.sharedEmitDoneFor!==e.external)for(let t of e.seen.entries()){let e=t[1];e.def&&e.defId&&(e.def.id===e.defId&&delete e.def.id,h(o,e.defId,e.def))}e.external&&(e.sharedEmitDoneFor=e.external),e.external||Object.keys(o).length>0&&(e.target===`draft-2020-12`?i.$defs=o:i.definitions=o);try{let n=JSON.parse(JSON.stringify(i));return Object.defineProperty(n,"~standard",{value:{...t[`~standard`],jsonSchema:{input:eo(t,`input`,e.processors),output:eo(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function Qa(e,t){let n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);let r=e._zod.def;if(r.type===`transform`)return!0;if(r.type===`array`)return Qa(r.element,n);if(r.type===`set`)return Qa(r.valueType,n);if(r.type===`lazy`)return Qa(r.getter(),n);if(r.type===`promise`||r.type===`optional`||r.type===`nonoptional`||r.type===`nullable`||r.type===`readonly`||r.type==="default"||r.type===`prefault`||r.type===`catch`)return Qa(r.innerType,n);if(r.type===`intersection`)return Qa(r.left,n)||Qa(r.right,n);if(r.type===`record`||r.type===`map`)return Qa(r.keyType,n)||Qa(r.valueType,n);if(r.type===`pipe`)return e._zod.traits.has(`$ZodCodec`)?!0:Qa(r.in,n)||Qa(r.out,n);if(r.type===`object`){for(let e in r.shape)if(Qa(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(Qa(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(Qa(e,n))return!0;return!!(r.rest&&Qa(r.rest,n))}return!1}var $a=(e,t={})=>n=>{let r=Ha({...n,processors:t});return A(e,r),Wa(r,e),Za(r,e)},eo=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=Ha({...i??{},target:a,io:t,processors:n});return A(e,o),Wa(o,e),Za(o,e)},to=(e,t,n)=>{(e[t]===void 0||n>e[t])&&(e[t]=n)},no=(e,t,n)=>{(e[t]===void 0||n<e[t])&&(e[t]=n)},ro=(e,t)=>{to(e,`minimum`,t),no(e,`maximum`,t)},io=(e,t)=>{e.multipleOf??=[],e.multipleOf.includes(t)||e.multipleOf.push(t)},ao=(e,t)=>{e.patterns??=new Set,e.patterns.add(t)},oo=(e,t)=>{e.mime=e.mime?e.mime.filter(e=>t.includes(e)):[...t]},so=(e,t)=>{e.format=t,t.includes(`int`)&&(e.isInt=!0)},co=(e,t)=>to(e,`minimum`,t.minimum),lo=(e,t)=>no(e,`maximum`,t.maximum),uo=e=>(t,n)=>{so(t,n.format);let[r,i]=e[n.format];to(t,`minimum`,r),no(t,`maximum`,i)},fo={greater_than:(e,t)=>to(e,t.inclusive?`minimum`:`exclusiveMinimum`,t.value),less_than:(e,t)=>no(e,t.inclusive?`maximum`:`exclusiveMaximum`,t.value),multiple_of:(e,t)=>io(e,t.value),number_format:uo(ge),bigint_format:uo(_e),min_length:co,max_length:lo,length_equals:(e,t)=>ro(e,t.length),min_size:co,max_size:lo,size_equals:(e,t)=>ro(e,t.size),string_format:(e,t)=>{so(e,t.format),t.pattern&&ao(e,t.pattern),(t.format===`base64`||t.format===`base64url`)&&(e.contentEncoding=t.format),(t.local||t.precision===-1)&&(e.laxFormat=!0)},mime_type:(e,t)=>oo(e,t.mime)};function po(e){let t={},n=e._zod.def,r=e._zod.traits.has(`$ZodCheck`)?[e,...n.checks??[]]:n.checks??[];for(let e of r)fo[e._zod.def.check]?.(t,e._zod.def);let i=e._zod.bag;i.minimum!==void 0&&to(t,`minimum`,i.minimum),i.exclusiveMinimum!==void 0&&to(t,`exclusiveMinimum`,i.exclusiveMinimum),i.maximum!==void 0&&no(t,`maximum`,i.maximum),i.exclusiveMaximum!==void 0&&no(t,`exclusiveMaximum`,i.exclusiveMaximum),i.multipleOf!==void 0&&io(t,i.multipleOf),i.format!==void 0&&(t.format??=i.format,i.format.includes(`int`)&&(t.isInt=!0)),i.mime&&oo(t,i.mime);for(let e of i.patterns??[])ao(t,e);return t}var mo={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},ho=new Map([[dr,qt],[pr,Jt]]),go=e=>ho.get(e)??e,_o=(e,t,n,r)=>{let i=n;i.type=`string`;let{minimum:a,maximum:o,format:s,patterns:c,contentEncoding:l,laxFormat:u}=po(e);if(typeof a==`number`&&(i.minLength=a),typeof o==`number`&&(i.maxLength=o),s&&(i.format=mo[s]??s,i.format===``&&delete i.format,(s===`time`||u)&&delete i.format),l&&(i.contentEncoding=l),c&&c.size>0){let e=[...c].map(go);e.length===1?i.pattern=e[0].source:e.length>1&&(i.allOf=[...e.map(e=>({...t.target===`draft-07`||t.target===`draft-04`||t.target===`openapi-3.0`?{type:`string`}:{},pattern:e.source}))])}},vo=(e,t,n,r)=>{let i=n,{minimum:a,maximum:o,multipleOf:s,exclusiveMaximum:c,exclusiveMinimum:l,isInt:u}=po(e);i.type=u?`integer`:`number`;let d=typeof l==`number`&&l>=(a??-1/0),f=typeof c==`number`&&c<=(o??1/0),p=t.target===`draft-04`||t.target===`openapi-3.0`;if(d?p?(i.minimum=l,i.exclusiveMinimum=!0):i.exclusiveMinimum=l:typeof a==`number`&&(i.minimum=a),f?p?(i.maximum=c,i.exclusiveMaximum=!0):i.exclusiveMaximum=c:typeof o==`number`&&(i.maximum=o),s){let n=new Set;for(let a of s)Number.isFinite(a)&&a!==0?n.add(Math.abs(a)):k(e,t,i,r,`A multipleOf divisor of ${a} cannot be represented in JSON Schema`);let[a,...o]=n;a!==void 0&&(i.multipleOf=a),o.length&&(i.allOf=[...i.allOf??[],...o.map(e=>({multipleOf:e}))])}},yo=(e,t,n,r)=>{n.type=`boolean`},bo=(e,t,n,r)=>{k(e,t,n,r,`BigInt cannot be represented in JSON Schema`)},xo=(e,t,n,r)=>{k(e,t,n,r,`Symbols cannot be represented in JSON Schema`)},So=(e,t,n,r)=>{t.target===`openapi-3.0`?(n.type=`string`,n.nullable=!0,n.enum=[null]):n.type=`null`},Co=(e,t,n,r)=>{k(e,t,n,r,`Undefined cannot be represented in JSON Schema`)},wo=(e,t,n,r)=>{k(e,t,n,r,`Void cannot be represented in JSON Schema`)},To=(e,t,n,r)=>{n.not={}},Eo=(e,t,n,r)=>{},Do=(e,t,n,r)=>{},Oo=(e,t,n,r)=>{k(e,t,n,r,`Date cannot be represented in JSON Schema`)},ko=(e,t,n,r)=>{let i=e._zod.def,o=a(i.entries);if(o.length===0){n.not={};return}o.every(e=>typeof e==`number`)&&(n.type=`number`),o.every(e=>typeof e==`string`)&&(n.type=`string`),n.enum=o},Ao=(e,t,n,r)=>{let i=e._zod.def;if(i.values.length===0){n.not={};return}let a=[];for(let o of i.values)if(o===void 0){if(k(e,t,n,r,"Literal `undefined` cannot be represented in JSON Schema"))return}else if(typeof o==`bigint`){if(k(e,t,n,r,`BigInt literals cannot be represented in JSON Schema`))return;a.push(Number(o))}else a.push(o);if(a.length!==0){if(a.length===1){let e=a[0];n.type=e===null?`null`:typeof e,t.target===`draft-04`||t.target===`openapi-3.0`?n.enum=[e]:n.const=e}else a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),a.every(e=>typeof e==`boolean`)&&(n.type=`boolean`),a.every(e=>e===null)&&(n.type=`null`),n.enum=a}},jo=(e,t,n,r)=>{k(e,t,n,r,`NaN cannot be represented in JSON Schema`)},Mo=(e,t,n,r)=>{let i=n,a=e._zod.pattern;if(!a)throw Error(`Pattern not found in template literal`);i.type=`string`,i.pattern=a.source},No=(e,t,n,r)=>{let i=n;i.type=`string`,i.format=`binary`,i.contentEncoding=`binary`;let{minimum:a,maximum:o,mime:s}=po(e);a!==void 0&&(i.minLength=a),o!==void 0&&(i.maxLength=o),s&&(s.length===0?i.not={}:s.length===1?i.contentMediaType=s[0]:i.anyOf=s.map(e=>({contentMediaType:e})))},Po=(e,t,n,r)=>{n.type=`boolean`},Fo=(e,t,n,r)=>{k(e,t,n,r,`Custom types cannot be represented in JSON Schema`)},Io=(e,t,n,r)=>{k(e,t,n,r,`Function types cannot be represented in JSON Schema`)},Lo=(e,t,n,r)=>{k(e,t,n,r,`Transforms cannot be represented in JSON Schema`)},Ro=(e,t,n,r)=>{k(e,t,n,r,`Map cannot be represented in JSON Schema`)},zo=(e,t,n,r)=>{k(e,t,n,r,`Set cannot be represented in JSON Schema`)},Bo=(e,t,n,r)=>{let i=n,a=e._zod.def,{minimum:o,maximum:s}=po(e);typeof o==`number`&&(i.minItems=o),typeof s==`number`&&(i.maxItems=s),i.type=`array`,i.items=A(a.element,t,{...r,path:[...r.path,`items`]})};function Vo(e){let t=e._zod.def;return t.type===`pipe`&&t.in._zod.traits.has(`$ZodTransform`)?Vo(t.out):t.type===`catch`?Vo(t.innerType):e._zod.optin}var Ho=(e,t,n,r)=>{let i=n,a=e._zod.def,o=a.shape;if(Object.getOwnPropertySymbols(o).length&&k(e,t,i,r,`Symbol keys cannot be represented in JSON Schema`))return;i.type=`object`,i.properties={};for(let e in o)h(i.properties,e,A(o[e],t,{...r,path:[...r.path,`properties`,e]}));let s=[];for(let e of Object.keys(o)){let n=a.shape[e];(t.io===`input`?Vo(n)===void 0:n._zod.optout===void 0)&&s.push(e)}s.length>0&&(i.required=s),a.catchall?._zod.def.type===`never`?i.additionalProperties=!1:a.catchall?a.catchall&&(i.additionalProperties=A(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},Uo=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>A(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},Wo=(e,t,n,r)=>{let i=e._zod.def,a=A(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=A(i.right,t,{...r,path:[...r.path,`allOf`,1]}),s=e=>`allOf`in e&&Object.keys(e).length===1,c=[...s(a)?a.allOf:[a],...s(o)?o.allOf:[o]];n.allOf=c,t.intersections.push(c)},Go=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`array`;let o=t.target===`draft-2020-12`?`prefixItems`:`items`,s=t.target===`draft-2020-12`||t.target===`openapi-3.0`?`items`:`additionalItems`,c=a.items.map((e,n)=>A(e,t,{...r,path:[...r.path,o,n]})),l=a.rest?A(a.rest,t,{...r,path:[...r.path,s,...t.target===`openapi-3.0`?[a.items.length]:[]]}):null,u=a.items.length;for(;u>0;){let e=a.items[u-1];if(!(t.io===`input`?Vo(e)!==void 0:e._zod.optout===`optional`))break;u--}let d=a.items.length,f=!a.rest;t.target===`draft-2020-12`?(i.prefixItems=c,f?i.items=!1:l&&(i.items=l),u>0&&(i.minItems=u),f&&(i.maxItems=d)):t.target===`openapi-3.0`?(i.items={anyOf:c},l&&i.items.anyOf.push(l),u>0&&(i.minItems=u),f&&(i.maxItems=d)):(i.items=c,f?i.additionalItems=!1:l&&(i.additionalItems=l),u>0&&(i.minItems=u),f&&(i.maxItems=d));let{minimum:p,maximum:m}=po(e);typeof p==`number`&&(i.minItems=p),typeof m==`number`&&(i.maxItems=m)};function Ko(e,t,n){if(t.$ref){if(n.has(t))return t;n.add(t);let r=e.get(t)?.def;if(!r)return t;let i=Ko(e,r,n);return i===r?t:i}for(let r of[`anyOf`,`oneOf`]){let i=t[r];if(!Array.isArray(i))continue;let a=i.map(t=>Ko(e,t,n));a.some((e,t)=>e!==i[t])&&(t={...t,[r]:a})}let r=Array.isArray(t.type)?t.type:[t.type],i=!r.includes(`string`)&&r.some(e=>e===`number`||e===`integer`),a=t.enum??(t.const===void 0?void 0:[t.const]);if(!i&&!a?.some(e=>typeof e==`number`))return t;let{minimum:o,maximum:s,exclusiveMinimum:c,exclusiveMaximum:l,multipleOf:u,format:d,id:f,...p}=t;return p.enum?p.enum=p.enum.map(e=>typeof e==`number`?String(e):e):typeof p.const==`number`&&(p.const=String(p.const)),i?(p.type=`string`,a||(p.pattern=(r.includes(`number`)?E:an).source),p):p}var qo=new WeakMap;function Jo(e){let t=new Map;for(let n of e.seen.values())n.def&&!t.has(n.schema)&&t.set(n.schema,n);let n=new Map;for(let r of qo.get(e)??[]){let i=e.seen.get(r),a=(i?.def??i?.schema)?.propertyNames;if(!a||a===!0||n.has(a))continue;let o=Ko(t,a,new Set);o!==a&&n.set(a,o)}if(n.size)for(let t of e.seen.values())for(let e of[t.schema,t.def]){let t=e&&n.get(e.propertyNames);t&&(e.propertyNames=t)}}var Yo=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`;let o=a.keyType,s=po(o).patterns;if(a.mode===`loose`&&s&&s.size>0){let e=A(a.valueType,t,{...r,path:[...r.path,`patternProperties`,`*`]});i.patternProperties={};for(let t of s)h(i.patternProperties,go(t).source,e)}else{if(t.target===`draft-07`||t.target===`draft-2020-12`){i.propertyNames=A(a.keyType,t,{...r,path:[...r.path,`propertyNames`]});let n=qo.get(t);n||(n=[],qo.set(t,n),t.deferred.push(()=>Jo(t))),n.push(e)}i.additionalProperties=A(a.valueType,t,{...r,path:[...r.path,`additionalProperties`]})}let c=o._zod.values,l=t.io===`input`&&Vo(a.valueType)!==void 0;if(c&&!a.partial&&!l){let e=[...c].filter(e=>typeof e==`string`||typeof e==`number`);e.length>0&&(i.required=e.map(String))}},Xo=(e,t,n,r)=>{let i=e._zod.def,a=A(i.innerType,t,r),o=t.seen.get(e);t.target===`openapi-3.0`?(o.ref=i.innerType,n.nullable=!0):n.anyOf=[a,{type:`null`}]},Zo=(e,t,n,r)=>{let i=e._zod.def;A(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},Qo=Symbol();function $o(e,t,n,r,i){let a=!1,o=JSON.stringify(e,(e,t)=>typeof t==`bigint`?(a=!0,null):t);return a?(k(t,n,r,i,`BigInt defaults cannot be represented in JSON Schema`),Qo):JSON.parse(o)}var es=(e,t,n,r)=>{let i=e._zod.def;A(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o=$o(i.defaultValue,e,t,n,r);o!==Qo&&(n.default=o)},ts=(e,t,n,r)=>{let i=e._zod.def;A(i.innerType,t,r);let a=t.seen.get(e);if(a.ref=i.innerType,t.io!==`input`)return;let o=$o(i.defaultValue,e,t,n,r);o!==Qo&&(n._prefault=o)},ns=(e,t,n,r)=>{let i=e._zod.def;A(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{k(e,t,n,r,`Dynamic catch values are not supported in JSON Schema`);return}n.default=o},rs=(e,t,n,r)=>{let i=e._zod.def,a=i.in._zod.traits.has(`$ZodTransform`),o=t.io===`input`?a?i.out:i.in:i.out;A(o,t,r);let s=t.seen.get(e);s.ref=o},is=(e,t,n,r)=>{let i=e._zod.def;A(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},as=(e,t,n,r)=>{let i=e._zod.def;A(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},os=(e,t,n,r)=>{let i=e._zod.def;A(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},ss=(e,t,n,r)=>{let i=e._zod.innerType;A(i,t,r);let a=t.seen.get(e);a.ref=i},cs={string:_o,number:vo,boolean:yo,bigint:bo,symbol:xo,null:So,undefined:Co,void:wo,never:To,any:Eo,unknown:Do,date:Oo,enum:ko,literal:Ao,nan:jo,template_literal:Mo,file:No,success:Po,custom:Fo,function:Io,transform:Lo,map:Ro,set:zo,array:Bo,object:Ho,union:Uo,intersection:Wo,tuple:Go,record:Yo,nullable:Xo,nonoptional:Zo,default:es,prefault:ts,catch:ns,pipe:rs,readonly:is,promise:as,optional:os,lazy:ss};function ls(e,t){if(`_idmap`in e){let n=e,r=Ha({...t,processors:cs}),i={};for(let e of n._idmap.entries()){let[t,n]=e;A(n,r)}let a={};r.external={registry:n,uri:t?.uri,defs:i};for(let e of n._idmap.entries()){let[t,n]=e;Wa(r,n),h(a,t,Za(r,n))}return Object.keys(i).length>0&&(a.__shared={[r.target===`draft-2020-12`?`$defs`:`definitions`]:i}),{schemas:a}}let n=Ha({...t,processors:cs});return A(e,n),Wa(n,e),Za(n,e)}var us=new WeakSet([Object.prototype,Error.prototype]);function ds(e,t,n){Object.defineProperty(e,t,{configurable:!0,enumerable:!1,get(){let e=n(this);return Object.defineProperty(this,t,{value:e,configurable:!0,writable:!0}),e},set(e){Object.defineProperty(this,t,{value:e,configurable:!0,writable:!0})}})}var fs=S(`ZodError`,(e,t)=>{st.init(e,t),e.name=`ZodError`;let n=Object.getPrototypeOf(e);us.has(n)||(us.add(n),ds(n,`format`,e=>t=>ut(e,t)),ds(n,`flatten`,e=>t=>lt(e,t)),ds(n,`addIssue`,e=>t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,s,2)}),ds(n,`addIssues`,e=>t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,s,2)}),Object.defineProperty(n,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}}))},void 0,{Parent:Error}),ps=ft(fs),ms=pt(fs),hs=mt(fs),gs=gt(fs),_s=St(fs),vs=Ct(fs),ys=wt(fs),bs=Tt(fs),xs=Et(fs),Ss=Dt(fs),Cs=Ot(fs),ws=kt(fs);function Ts(){C.localeError||w(ki())}function Es(){C.memoizer||w({memoizer:Ei()})}var j=S(`ZodType`,(e,t)=>(Ts(),D.init(e,t),e.def=t,e.type=t.type,e),{check(...e){let t=this.def;return this.clone(_(t,{checks:[...t.checks??[],...e.map(e=>typeof e==`function`?{_zod:{check:e,def:{check:`custom`},onattach:[]}}:e)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return v(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(Kc(e,t))},superRefine(e,t){return this.check(qc(e,t))},overwrite(e){return this.check(ja(e))},optional(){return W(this)},exactOptional(){return Dc(this)},nullable(){return kc(this)},nullish(){return W(kc(this))},nonoptional(e){return Fc(this,e)},array(){return L(this)},or(e){return B([this,e])},and(e){return yc(this,e)},transform(e){return zc(this,wc(e))},default(e){return jc(this,e)},prefault(e){return Nc(this,e)},catch(e){return Lc(this,e)},pipe(e){return zc(this,e)},readonly(){return Hc(this)},describe(e){let t=this.clone();return Ni.add(t,{description:e}),t},meta(...e){if(e.length===0)return Ni.get(this);let t=this.clone();return Ni.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e,...t){return t.length===0?e(this):e(this,...t)},get"~standard"(){return ze(this,`~standard`,{...Nn(this),jsonSchema:{input:eo(this,`input`),output:eo(this,`output`)}})},set"~standard"(e){Re(this,`~standard`,e)},parse:function e(t,n){return ps(this,t,n,{callee:e})},parseAsync:async function e(t,n){return await ms(this,t,n,{callee:e})},safeParse(e,t){return hs(this,e,t)},async safeParseAsync(e,t){return gs(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){Re(this,`spa`,e)},validate(e,t){return yt(this,e,t)},validateAsync(e,t){return xt(this,e,t)},encode:function e(t,n){return _s(this,t,n,{callee:e})},decode:function e(t,n){return vs(this,t,n,{callee:e})},encodeAsync:async function e(t,n){return await ys(this,t,n,{callee:e})},decodeAsync:async function e(t,n){return await bs(this,t,n,{callee:e})},safeEncode(e,t){return xs(this,e,t)},safeDecode(e,t){return Ss(this,e,t)},async safeEncodeAsync(e,t){return Cs(this,e,t)},async safeDecodeAsync(e,t){return ws(this,e,t)},toJSONSchema(e){return $a(this,{})(e)},get description(){return Ni.get(this)?.description},get _def(){return this._zod.def}}),Ds=S(`_ZodString`,(e,t)=>{Pn.init(e,t),j.init(e,t),e._zod.processJSONSchema=(t,n,r)=>_o(e,t,n,r)},Be({format:e=>po(e).format??null,minLength:e=>po(e).minimum??null,maxLength:e=>po(e).maximum??null},{regex(...e){return this.check(Ta(...e))},includes(...e){return this.check(Oa(...e))},startsWith(...e){return this.check(ka(...e))},endsWith(...e){return this.check(Aa(...e))},min(...e){return this.check(Ca(...e))},max(...e){return this.check(Sa(...e))},length(...e){return this.check(wa(...e))},nonempty(...e){return this.check(Ca(1,...e))},lowercase(e){return this.check(Ea(e))},uppercase(e){return this.check(Da(e))},trim(){return this.check(Na())},normalize(...e){return this.check(Ma(...e))},toLowerCase(){return this.check(Pa())},toUpperCase(){return this.check(Fa())},slugify(){return this.check(Ia())}})),Os=S(`ZodString`,(e,t)=>{Pn.init(e,t),Ds.init(e,t)},{email(e){return this.check(Ii(Ns,e))},url(e){return this.check(Hi(Ls,e))},jwt(e){return this.check(ra($s,e))},emoji(e){return this.check(Ui(zs,e))},guid(e){return this.check(Li(Fs,e))},uuid(e){return this.check(Ri(Is,e))},uuidv4(e){return this.check(zi(Is,e))},uuidv6(e){return this.check(Bi(Is,e))},uuidv7(e){return this.check(Vi(Is,e))},nanoid(e){return this.check(Wi(Bs,e))},cuid(e){return this.check(Gi(Vs,e))},cuid2(e){return this.check(Ki(Hs,e))},ulid(e){return this.check(qi(Us,e))},base64(e){return this.check(ea(Xs,e))},base64url(e){return this.check(ta(Zs,e))},xid(e){return this.check(Ji(Ws,e))},ksuid(e){return this.check(Yi(Gs,e))},ipv4(e){return this.check(Xi(Ks,e))},ipv6(e){return this.check(Zi(qs,e))},cidrv4(e){return this.check(Qi(Js,e))},cidrv6(e){return this.check($i(Ys,e))},e164(e){return this.check(na(Qs,e))},datetime(e){return this.check(ia(ks,e))},date(e){return this.check(aa(As,e))},time(e){return this.check(oa(js,e))},duration(e){return this.check(sa(Ms,e))}});function M(e){return Fi(Os,e)}var N=S(`ZodStringFormat`,(e,t)=>{O.init(e,t),Ds.init(e,t)}),ks=S(`ZodISODateTime`,(e,t)=>{$n.init(e,t),N.init(e,t)}),As=S(`ZodISODate`,(e,t)=>{er.init(e,t),N.init(e,t)}),js=S(`ZodISOTime`,(e,t)=>{tr.init(e,t),N.init(e,t)}),Ms=S(`ZodISODuration`,(e,t)=>{nr.init(e,t),N.init(e,t)}),Ns=S(`ZodEmail`,(e,t)=>{Ln.init(e,t),N.init(e,t)});function Ps(e){return Ii(Ns,e)}var Fs=S(`ZodGUID`,(e,t)=>{Fn.init(e,t),N.init(e,t)}),Is=S(`ZodUUID`,(e,t)=>{In.init(e,t),N.init(e,t)}),Ls=S(`ZodURL`,(e,t)=>{Gn.init(e,t),N.init(e,t)});function Rs(e){return Hi(Ls,e)}var zs=S(`ZodEmoji`,(e,t)=>{Kn.init(e,t),N.init(e,t)}),Bs=S(`ZodNanoID`,(e,t)=>{qn.init(e,t),N.init(e,t)}),Vs=S(`ZodCUID`,(e,t)=>{Jn.init(e,t),N.init(e,t)}),Hs=S(`ZodCUID2`,(e,t)=>{Yn.init(e,t),N.init(e,t)}),Us=S(`ZodULID`,(e,t)=>{Xn.init(e,t),N.init(e,t)}),Ws=S(`ZodXID`,(e,t)=>{Zn.init(e,t),N.init(e,t)}),Gs=S(`ZodKSUID`,(e,t)=>{Qn.init(e,t),N.init(e,t)}),Ks=S(`ZodIPv4`,(e,t)=>{rr.init(e,t),N.init(e,t)}),qs=S(`ZodIPv6`,(e,t)=>{or.init(e,t),N.init(e,t)}),Js=S(`ZodCIDRv4`,(e,t)=>{sr.init(e,t),N.init(e,t)}),Ys=S(`ZodCIDRv6`,(e,t)=>{lr.init(e,t),N.init(e,t)}),Xs=S(`ZodBase64`,(e,t)=>{fr.init(e,t),N.init(e,t)}),Zs=S(`ZodBase64URL`,(e,t)=>{hr.init(e,t),N.init(e,t)}),Qs=S(`ZodE164`,(e,t)=>{gr.init(e,t),N.init(e,t)}),$s=S(`ZodJWT`,(e,t)=>{vr.init(e,t),N.init(e,t)}),ec=S(`ZodNumber`,(e,t)=>{yr.init(e,t),j.init(e,t),e._zod.processJSONSchema=(t,n,r)=>vo(e,t,n,r),e.isFinite=!0},Be({minValue:e=>{let{minimum:t,exclusiveMinimum:n}=po(e);return Math.max(t??-1/0,n??-1/0)},maxValue:e=>{let{maximum:t,exclusiveMaximum:n}=po(e);return Math.min(t??1/0,n??1/0)},isInt:e=>{let{isInt:t,multipleOf:n}=po(e);return!!t||!!n?.some(Number.isSafeInteger)},format:e=>po(e).format??null},{gt(e,t){return this.check(ya(e,t))},gte(e,t){return this.check(ba(e,t))},min(e,t){return this.check(ba(e,t))},lt(e,t){return this.check(_a(e,t))},lte(e,t){return this.check(va(e,t))},max(e,t){return this.check(va(e,t))},int(e){return this.check(nc(e))},safe(e){return this.check(nc(e))},positive(e){return this.check(ya(0,e))},nonnegative(e){return this.check(ba(0,e))},negative(e){return this.check(_a(0,e))},nonpositive(e){return this.check(va(0,e))},multipleOf(e,t){return this.check(xa(e,t))},step(e,t){return this.check(xa(e,t))},finite(){return this}}));function P(e){return ca(ec,e)}var tc=S(`ZodNumberFormat`,(e,t)=>{br.init(e,t),ec.init(e,t)});function nc(e){return ua(tc,e)}var rc=S(`ZodBoolean`,(e,t)=>{xr.init(e,t),j.init(e,t),e._zod.processJSONSchema=(t,n,r)=>yo(e,t,n,r)});function F(e){return da(rc,e)}var ic=S(`ZodUndefined`,(e,t)=>{Sr.init(e,t),j.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Co(e,t,n,r)});function ac(e){return fa(ic,e)}var oc=S(`ZodNull`,(e,t)=>{Cr.init(e,t),j.init(e,t),e._zod.processJSONSchema=(t,n,r)=>So(e,t,n,r)});function sc(e){return pa(oc,e)}var cc=S(`ZodAny`,(e,t)=>{wr.init(e,t),j.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function lc(){return ma(cc)}var uc=S(`ZodUnknown`,(e,t)=>{Tr.init(e,t),j.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function I(){return ha(uc)}var dc=S(`ZodNever`,(e,t)=>{Er.init(e,t),j.init(e,t),e._zod.processJSONSchema=(t,n,r)=>To(e,t,n,r)});function fc(e){return ga(dc,e)}var pc=S(`ZodArray`,(e,t)=>{Es(),Or.init(e,t),j.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Bo(e,t,n,r),e.element=t.element},{min(e,t){return this.check(Ca(e,t))},nonempty(e){return this.check(Ca(1,e))},max(e,t){return this.check(Sa(e,t))},length(e,t){return this.check(wa(e,t))},unwrap(){return this.element}});function L(e,t){return La(pc,e,t)}var mc=S(`ZodObject`,(e,t)=>{Es(),Pr.init(e,t),j.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ho(e,t,n,r),Ke(e,`shape`,e=>e._zod.def.shape,!1)},{keyof(){return H(Object.keys(this._zod.def.shape))},catchall(e){return this.clone(_(this._zod.def,{catchall:e}))},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:fc()}))},strip(){return this.clone(_(this._zod.def,{catchall:void 0}))},extend(e){return xe(this,e)},safeExtend(e){return Ce(this,e)},merge(e){return we(this,e)},pick(e){return ve(this,e)},omit(e){return be(this,e)},partial(...e){return Te(Tc,this,e[0])},exactPartial(...e){return Te(Ec,this,e[0],`exactPartial`)},required(...e){return Ee(Pc,this,e[0])}});function R(e,t){return new mc({type:`object`,shape:e??{},...y(t)})}function z(e,t){return new mc({type:`object`,shape:e,catchall:I(),...y(t)})}var hc=S(`ZodUnion`,(e,t)=>{Ir.init(e,t),j.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Uo(e,t,n,r),e.options=t.options});function B(e,t){return new hc({type:`union`,options:e,...y(t)})}var gc=S(`ZodDiscriminatedUnion`,(e,t)=>{hc.init(e,t),Rr.init(e,t)});function _c(e,t,n){return new gc({type:`union`,options:t,discriminator:e,...y(n)})}var vc=S(`ZodIntersection`,(e,t)=>{zr.init(e,t),j.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Wo(e,t,n,r)});function yc(e,t){return new vc({type:`intersection`,left:e,right:t})}var bc=S(`ZodRecord`,(e,t)=>{Es(),Hr.init(e,t),j.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Yo(e,t,n,r),e.keyType=t.keyType,e.valueType=t.valueType});function V(e,t,n){return!t||!t._zod?new bc({type:`record`,keyType:M(),valueType:e,...y(t)}):new bc({type:`record`,keyType:e,valueType:t,...y(n)})}var xc=S(`ZodEnum`,(e,t)=>{Ur.init(e,t),j.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ko(e,t,n,r),e.enum=t.entries,e.options=[...e._zod.values];let n=new Set(Object.keys(t.entries));e.extract=(e,r)=>{let i={};for(let r of e)if(n.has(r))i[r]=t.entries[r];else throw Error(`Key ${r} not found in enum`);return new xc({...t,checks:[],...y(r),entries:i})},e.exclude=(e,r)=>{let i={...t.entries};for(let t of e)if(n.has(t))delete i[t];else throw Error(`Key ${t} not found in enum`);return new xc({...t,checks:[],...y(r),entries:i})}});function H(e,t){return new xc({type:`enum`,entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...y(t)})}var Sc=S(`ZodLiteral`,(e,t)=>{Wr.init(e,t),j.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ao(e,t,n,r),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 Sc({type:`literal`,values:Array.isArray(e)?e:[e],...y(t)})}var Cc=S(`ZodTransform`,(e,t)=>{Es(),Gr.init(e,t),j.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Lo(e,t,n,r),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new tt(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(Ie(r,n.value,t));else{let t=r;t.fatal&&(t.continue=!1),t.code??=`custom`,`input`in t||(t.input=n.value),t.inst??=e,n.issues.push(Ie(t))}};let i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n)):(n.value=i,n)}});function wc(e){return new Cc({type:`transform`,transform:e})}var Tc=S(`ZodOptional`,(e,t)=>{qr.init(e,t),j.init(e,t),e._zod.processJSONSchema=(t,n,r)=>os(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function W(e){return new Tc({type:`optional`,innerType:e})}var Ec=S(`ZodExactOptional`,(e,t)=>{Jr.init(e,t),j.init(e,t),e._zod.processJSONSchema=(t,n,r)=>os(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Dc(e){return new Ec({type:`optional`,innerType:e})}var Oc=S(`ZodNullable`,(e,t)=>{Yr.init(e,t),j.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Xo(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function kc(e){return new Oc({type:`nullable`,innerType:e})}var Ac=S(`ZodDefault`,(e,t)=>{Xr.init(e,t),j.init(e,t),e._zod.processJSONSchema=(t,n,r)=>es(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function jc(e,t){return new Ac({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():de(t)}})}var Mc=S(`ZodPrefault`,(e,t)=>{Qr.init(e,t),j.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ts(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Nc(e,t){return new Mc({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():de(t)}})}var Pc=S(`ZodNonOptional`,(e,t)=>{$r.init(e,t),j.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Zo(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Fc(e,t){return new Pc({type:`nonoptional`,innerType:e,...y(t)})}var Ic=S(`ZodCatch`,(e,t)=>{ni.init(e,t),j.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ns(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Lc(e,t){return new Ic({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:Je(t)})}var Rc=S(`ZodPipe`,(e,t)=>{ri.init(e,t),j.init(e,t),e._zod.processJSONSchema=(t,n,r)=>rs(e,t,n,r),e.in=t.in,e.out=t.out});function zc(e,t){return new Rc({type:`pipe`,in:e,out:t})}var Bc=S(`ZodPreprocess`,(e,t)=>{Rc.init(e,t),ai.init(e,t)}),Vc=S(`ZodReadonly`,(e,t)=>{oi.init(e,t),j.init(e,t),e._zod.processJSONSchema=(t,n,r)=>is(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Hc(e){return new Vc({type:`readonly`,innerType:e})}var Uc=S(`ZodLazy`,(e,t)=>{ci.init(e,t),j.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ss(e,t,n,r),e.unwrap=()=>e._zod.def.getter()});function Wc(e){return new Uc({type:`lazy`,getter:e})}var Gc=S(`ZodCustom`,(e,t)=>{li.init(e,t),j.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Fo(e,t,n,r)});function Kc(e,t={}){return Ra(Gc,e,t)}function qc(e,t){return za(e,t)}function Jc(e,t){return new Bc({type:`pipe`,in:wc(e),out:t})}var Yc={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`},Xc;Xc||={};function Zc(e){return ia(ks,e)}function Qc(e){return aa(As,e)}function $c(e){return la(ec,e)}var el=[`2025-11-25`,`2025-06-18`,`2025-03-26`,`2024-11-05`,`2024-10-07`],tl=`io.modelcontextprotocol/related-task`,nl=`io.modelcontextprotocol/protocolVersion`,rl=`io.modelcontextprotocol/clientInfo`,il=`io.modelcontextprotocol/serverInfo`,al=`io.modelcontextprotocol/clientCapabilities`,ol=`io.modelcontextprotocol/subscriptionId`,sl=`io.modelcontextprotocol/logLevel`,cl=Wc(()=>B([M(),P(),F(),sc(),V(M(),cl),L(cl)])),G=V(M(),cl),ll=L(cl),ul=B([M(),P().int()]),dl=M(),fl=R({ttl:P().optional()}),pl=R({taskId:M()}),ml=z({progressToken:ul.optional(),[tl]:pl.optional()}),K=R({_meta:ml.optional()}),hl=K.extend({task:fl.optional()}),q=R({method:M(),params:K.loose().optional()}),gl=R({_meta:ml.optional()}),_l=R({method:M(),params:gl.loose().optional()}),vl=z({get[il](){return Ml.optional().catch(void 0)}}),J=z({_meta:vl.optional()}),yl=B([M(),P().int()]),bl=R({jsonrpc:U(`2.0`),id:yl,...q.shape}).strict(),xl=R({jsonrpc:U(`2.0`),..._l.shape}).strict(),Sl=R({jsonrpc:U(`2.0`),id:yl,result:J}).strict(),Cl=R({jsonrpc:U(`2.0`),id:yl.optional(),error:R({code:P().int(),message:M(),data:I().optional()})}).strict(),wl=B([bl,xl,Sl,Cl]),Tl=B([Sl,Cl]),El=J.strict(),Dl=gl.extend({requestId:yl.optional(),reason:M().optional()}),Ol=_l.extend({method:U(`notifications/cancelled`),params:Dl}),kl=R({src:M(),mimeType:M().optional(),sizes:L(M()).optional(),theme:H([`light`,`dark`]).optional()}),Al=R({icons:L(kl).optional()}),jl=R({name:M(),title:M().optional()}),Ml=jl.extend({...jl.shape,...Al.shape,version:M(),websiteUrl:M().optional(),description:M().optional()}),Nl=Jc(e=>e&&typeof e==`object`&&!Array.isArray(e)&&Object.keys(e).length===0?{form:{}}:e,yc(R({form:yc(R({applyDefaults:F().optional()}),G).optional(),url:G.optional()}),G.optional())),Pl=z({list:G.optional(),cancel:G.optional(),requests:z({sampling:z({createMessage:G.optional()}).optional(),elicitation:z({create:G.optional()}).optional()}).optional()}),Fl=z({list:G.optional(),cancel:G.optional(),requests:z({tools:z({call:G.optional()}).optional()}).optional()}),Il=R({experimental:V(M(),G).optional(),sampling:R({context:G.optional(),tools:G.optional()}).optional(),elicitation:Nl.optional(),roots:R({listChanged:F().optional()}).optional(),tasks:Pl.optional(),extensions:V(M(),G).optional()}),Ll=K.extend({protocolVersion:M(),capabilities:Il,clientInfo:Ml}),Rl=q.extend({method:U(`initialize`),params:Ll}),zl=R({experimental:V(M(),G).optional(),logging:G.optional(),completions:G.optional(),prompts:R({listChanged:F().optional()}).optional(),resources:R({subscribe:F().optional(),listChanged:F().optional()}).optional(),tools:R({listChanged:F().optional()}).optional(),tasks:Fl.optional(),extensions:V(M(),G).optional()}),Bl=J.extend({protocolVersion:M(),capabilities:zl,serverInfo:Ml,instructions:M().optional()}),Vl=_l.extend({method:U(`notifications/initialized`),params:gl.optional()}),Hl=q.extend({method:U(`server/discover`),params:K.optional()}),Ul=J.extend({supportedVersions:L(M()),capabilities:zl,instructions:M().optional()}),Wl=q.extend({method:U(`ping`),params:K.optional()}),Gl=R({progress:P(),total:W(P()),message:W(M())}),Kl=R({...gl.shape,...Gl.shape,progressToken:ul}),ql=_l.extend({method:U(`notifications/progress`),params:Kl}),Jl=K.extend({cursor:dl.optional()}),Yl=q.extend({params:Jl.optional()}),Xl=J.extend({nextCursor:dl.optional()}),Zl=R({uri:M(),mimeType:W(M()),_meta:V(M(),I()).optional()}),Ql=Zl.extend({text:M()}),$l=M().refine(e=>{try{return atob(e),!0}catch{return!1}},{message:`Invalid Base64 string`}),eu=Zl.extend({blob:$l}),tu=H([`user`,`assistant`]),nu=R({audience:L(tu).optional(),priority:P().min(0).max(1).optional(),lastModified:Zc({offset:!0}).optional()}),ru=R({...jl.shape,...Al.shape,uri:M(),description:W(M()),mimeType:W(M()),size:W(P()),annotations:nu.optional(),_meta:W(z({}))}),iu=R({...jl.shape,...Al.shape,uriTemplate:M(),description:W(M()),mimeType:W(M()),annotations:nu.optional(),_meta:W(z({}))}),au=Yl.extend({method:U(`resources/list`)}),ou=Xl.extend({resources:L(ru)}),su=Yl.extend({method:U(`resources/templates/list`)}),cu=Xl.extend({resourceTemplates:L(iu)}),lu=K.extend({uri:M()}),uu=lu,du=q.extend({method:U(`resources/read`),params:uu}),fu=J.extend({contents:L(B([Ql,eu]))}),pu=_l.extend({method:U(`notifications/resources/list_changed`),params:gl.optional()}),mu=lu,hu=q.extend({method:U(`resources/subscribe`),params:mu}),gu=lu,_u=q.extend({method:U(`resources/unsubscribe`),params:gu}),vu=R({toolsListChanged:F().optional(),promptsListChanged:F().optional(),resourcesListChanged:F().optional(),resourceSubscriptions:L(M()).optional()}),yu=K.extend({notifications:vu}),bu=q.extend({method:U(`subscriptions/listen`),params:yu}),xu=gl.extend({notifications:vu}),Su=_l.extend({method:U(`notifications/subscriptions/acknowledged`),params:xu}),Cu=vl.extend({[ol]:yl}),wu=J.extend({_meta:Cu}),Tu=gl.extend({uri:M()}),Eu=_l.extend({method:U(`notifications/resources/updated`),params:Tu}),Du=R({name:M(),description:W(M()),required:W(F())}),Ou=R({...jl.shape,...Al.shape,description:W(M()),arguments:W(L(Du)),_meta:W(z({}))}),ku=Yl.extend({method:U(`prompts/list`)}),Au=Xl.extend({prompts:L(Ou)}),ju=K.extend({name:M(),arguments:V(M(),M()).optional()}),Mu=q.extend({method:U(`prompts/get`),params:ju}),Nu=R({type:U(`text`),text:M(),annotations:nu.optional(),_meta:V(M(),I()).optional()}),Pu=R({type:U(`image`),data:$l,mimeType:M(),annotations:nu.optional(),_meta:V(M(),I()).optional()}),Fu=R({type:U(`audio`),data:$l,mimeType:M(),annotations:nu.optional(),_meta:V(M(),I()).optional()}),Iu=R({type:U(`tool_use`),name:M(),id:M(),input:V(M(),I()),_meta:V(M(),I()).optional()}),Lu=R({type:U(`resource`),resource:B([Ql,eu]),annotations:nu.optional(),_meta:V(M(),I()).optional()}),Ru=ru.extend({type:U(`resource_link`)}),zu=B([Nu,Pu,Fu,Ru,Lu]),Bu=R({role:tu,content:zu}),Vu=J.extend({description:M().optional(),messages:L(Bu)}),Hu=_l.extend({method:U(`notifications/prompts/list_changed`),params:gl.optional()}),Uu=R({title:M().optional(),readOnlyHint:F().optional(),destructiveHint:F().optional(),idempotentHint:F().optional(),openWorldHint:F().optional()}),Wu=R({taskSupport:H([`required`,`optional`,`forbidden`]).optional()}),Gu=R({...jl.shape,...Al.shape,description:M().optional(),inputSchema:R({type:U(`object`),properties:V(M(),cl).optional(),required:L(M()).optional()}).catchall(I()),outputSchema:z({$schema:M().optional()}).optional(),annotations:Uu.optional(),execution:Wu.optional(),_meta:V(M(),I()).optional()}),Ku=Yl.extend({method:U(`tools/list`)}),qu=Xl.extend({tools:L(Gu)}),Ju=J.extend({content:L(zu).default([]),structuredContent:I().optional(),isError:F().optional()}),Yu=Ju.or(J.extend({toolResult:I()})),Xu=hl.extend({name:M(),arguments:V(M(),I()).optional()}),Zu=q.extend({method:U(`tools/call`),params:Xu}),Qu=_l.extend({method:U(`notifications/tools/list_changed`),params:gl.optional()}),$u=R({autoRefresh:F().default(!0),debounceMs:P().int().nonnegative().default(300)}),ed=H([`debug`,`info`,`notice`,`warning`,`error`,`critical`,`alert`,`emergency`]),td=K.extend({level:ed}),nd=q.extend({method:U(`logging/setLevel`),params:td}),rd=gl.extend({level:ed,logger:M().optional(),data:I()}),id=_l.extend({method:U(`notifications/message`),params:rd}),ad=R({name:M().optional()}),od=R({hints:L(ad).optional(),costPriority:P().min(0).max(1).optional(),speedPriority:P().min(0).max(1).optional(),intelligencePriority:P().min(0).max(1).optional()}),sd=R({mode:H([`auto`,`required`,`none`]).optional()}),cd=R({type:U(`tool_result`),toolUseId:M().describe(`The unique identifier for the corresponding tool call.`),content:L(zu),structuredContent:I().optional(),isError:F().optional(),_meta:V(M(),I()).optional()}),ld=_c(`type`,[Nu,Pu,Fu]),ud=_c(`type`,[Nu,Pu,Fu,Iu,cd]),dd=R({role:tu,content:B([ud,L(ud)]),_meta:V(M(),I()).optional()}),fd=hl.extend({messages:L(dd),modelPreferences:od.optional(),systemPrompt:M().optional(),includeContext:H([`none`,`thisServer`,`allServers`]).optional(),temperature:P().optional(),maxTokens:P().int(),stopSequences:L(M()).optional(),metadata:G.optional(),tools:L(Gu).optional(),toolChoice:sd.optional()}),pd=q.extend({method:U(`sampling/createMessage`),params:fd}),md=J.extend({model:M(),stopReason:W(H([`endTurn`,`stopSequence`,`maxTokens`]).or(M())),role:tu,content:ld}),hd=J.extend({model:M(),stopReason:W(H([`endTurn`,`stopSequence`,`maxTokens`,`toolUse`]).or(M())),role:tu,content:B([ud,L(ud)])}),gd=R({type:U(`boolean`),title:M().optional(),description:M().optional(),default:F().optional()}),_d=R({type:U(`string`),title:M().optional(),description:M().optional(),minLength:P().optional(),maxLength:P().optional(),format:H([`email`,`uri`,`date`,`date-time`]).optional(),default:M().optional()}),vd=R({type:H([`number`,`integer`]),title:M().optional(),description:M().optional(),minimum:P().optional(),maximum:P().optional(),default:P().optional()}),yd=R({type:U(`string`),title:M().optional(),description:M().optional(),enum:L(M()),default:M().optional()}),bd=R({type:U(`string`),title:M().optional(),description:M().optional(),oneOf:L(R({const:M(),title:M()})),default:M().optional()}),xd=R({type:U(`string`),title:M().optional(),description:M().optional(),enum:L(M()),enumNames:L(M()).optional(),default:M().optional()}),Sd=B([yd,bd]),Cd=R({type:U(`array`),title:M().optional(),description:M().optional(),minItems:P().optional(),maxItems:P().optional(),items:R({type:U(`string`),enum:L(M())}),default:L(M()).optional()}),wd=R({type:U(`array`),title:M().optional(),description:M().optional(),minItems:P().optional(),maxItems:P().optional(),items:R({anyOf:L(R({const:M(),title:M()}))}),default:L(M()).optional()}),Td=B([Cd,wd]),Ed=B([xd,Sd,Td]),Dd=B([Ed,gd,_d,vd]),Od=hl.extend({mode:U(`form`).optional(),message:M(),requestedSchema:R({type:U(`object`),properties:V(M(),Dd),required:L(M()).optional()}).catchall(I())}),kd=hl.extend({mode:U(`url`),message:M(),elicitationId:M(),url:M().url()}),Ad=B([Od,kd]),jd=q.extend({method:U(`elicitation/create`),params:Ad}),Md=gl.extend({elicitationId:M()}),Nd=_l.extend({method:U(`notifications/elicitation/complete`),params:Md}),Pd=J.extend({action:H([`accept`,`decline`,`cancel`]),content:Jc(e=>e===null?void 0:e,V(M(),B([M(),P(),F(),L(M())])).optional())}),Fd=R({type:U(`ref/resource`),uri:M()}),Id=R({type:U(`ref/prompt`),name:M()}),Ld=K.extend({ref:B([Id,Fd]),argument:R({name:M(),value:M()}),context:R({arguments:V(M(),M()).optional()}).optional()}),Rd=q.extend({method:U(`completion/complete`),params:Ld}),zd=J.extend({completion:z({values:L(M()).max(100),total:W(P().int()),hasMore:W(F())})}),Bd=R({uri:M().startsWith(`file://`),name:M().optional(),_meta:V(M(),I()).optional()}),Vd=q.extend({method:U(`roots/list`),params:K.optional()}),Hd=J.extend({roots:L(Bd)}),Ud=_l.extend({method:U(`notifications/roots/list_changed`),params:gl.optional()}),Wd=z({ttl:P().optional(),pollInterval:P().optional()}),Gd=H([`working`,`input_required`,`completed`,`failed`,`cancelled`]),Kd=R({taskId:M(),status:Gd,ttl:B([P(),sc()]),createdAt:M(),lastUpdatedAt:M(),pollInterval:W(P()),statusMessage:W(M())}),qd=J.extend({task:Kd}),Jd=gl.merge(Kd),Yd=_l.extend({method:U(`notifications/tasks/status`),params:Jd}),Xd=q.extend({method:U(`tasks/get`),params:K.extend({taskId:M()})}),Zd=J.merge(Kd),Qd=q.extend({method:U(`tasks/result`),params:K.extend({taskId:M()})}),$d=J.loose(),ef=Yl.extend({method:U(`tasks/list`)}),tf=Xl.extend({tasks:L(Kd)}),nf=q.extend({method:U(`tasks/cancel`),params:K.extend({taskId:M()})}),rf=J.merge(Kd),af=B([Wl,Rl,Hl,Rd,nd,Mu,ku,au,su,du,hu,_u,bu,Zu,Ku]),of=B([Ol,ql,Vl,Ud]),sf=B([El,md,hd,Pd,Hd]),cf=B([Wl,pd,jd,Vd]),lf=B([Ol,ql,id,Eu,pu,Qu,Hu,Su,Nd]),uf=B([El,Bl,Ul,zd,Vu,Au,ou,cu,fu,Ju,qu,wu]),Y=Rs().superRefine((e,t)=>{if(!URL.canParse(e))return t.addIssue({code:Yc.custom,message:`URL must be parseable`,fatal:!0}),Xe}).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`}),df=z({resource:M().url(),authorization_servers:L(Y).optional(),jwks_uri:M().url().optional(),scopes_supported:L(M()).optional(),bearer_methods_supported:L(M()).optional(),resource_signing_alg_values_supported:L(M()).optional(),resource_name:M().optional(),resource_documentation:M().optional(),resource_policy_uri:M().url().optional(),resource_tos_uri:M().url().optional(),tls_client_certificate_bound_access_tokens:F().optional(),authorization_details_types_supported:L(M()).optional(),dpop_signing_alg_values_supported:L(M()).optional(),dpop_bound_access_tokens_required:F().optional()}),ff=z({issuer:M(),authorization_endpoint:Y,token_endpoint:Y,registration_endpoint:Y.optional(),scopes_supported:L(M()).optional(),response_types_supported:L(M()),response_modes_supported:L(M()).optional(),grant_types_supported:L(M()).optional(),token_endpoint_auth_methods_supported:L(M()).optional(),token_endpoint_auth_signing_alg_values_supported:L(M()).optional(),service_documentation:Y.optional(),revocation_endpoint:Y.optional(),revocation_endpoint_auth_methods_supported:L(M()).optional(),revocation_endpoint_auth_signing_alg_values_supported:L(M()).optional(),introspection_endpoint:M().optional(),introspection_endpoint_auth_methods_supported:L(M()).optional(),introspection_endpoint_auth_signing_alg_values_supported:L(M()).optional(),code_challenge_methods_supported:L(M()).optional(),client_id_metadata_document_supported:F().optional(),authorization_response_iss_parameter_supported:F().optional().catch(void 0)}),pf=z({issuer:M(),authorization_endpoint:Y,token_endpoint:Y,userinfo_endpoint:Y.optional(),jwks_uri:Y,registration_endpoint:Y.optional(),scopes_supported:L(M()).optional(),response_types_supported:L(M()),response_modes_supported:L(M()).optional(),grant_types_supported:L(M()).optional(),acr_values_supported:L(M()).optional(),subject_types_supported:L(M()),id_token_signing_alg_values_supported:L(M()),id_token_encryption_alg_values_supported:L(M()).optional(),id_token_encryption_enc_values_supported:L(M()).optional(),userinfo_signing_alg_values_supported:L(M()).optional(),userinfo_encryption_alg_values_supported:L(M()).optional(),userinfo_encryption_enc_values_supported:L(M()).optional(),request_object_signing_alg_values_supported:L(M()).optional(),request_object_encryption_alg_values_supported:L(M()).optional(),request_object_encryption_enc_values_supported:L(M()).optional(),token_endpoint_auth_methods_supported:L(M()).optional(),token_endpoint_auth_signing_alg_values_supported:L(M()).optional(),display_values_supported:L(M()).optional(),claim_types_supported:L(M()).optional(),claims_supported:L(M()).optional(),service_documentation:M().optional(),claims_locales_supported:L(M()).optional(),ui_locales_supported:L(M()).optional(),claims_parameter_supported:F().optional(),request_parameter_supported:F().optional(),request_uri_parameter_supported:F().optional(),require_request_uri_registration:F().optional(),op_policy_uri:Y.optional(),op_tos_uri:Y.optional(),client_id_metadata_document_supported:F().optional(),authorization_response_iss_parameter_supported:F().optional().catch(void 0)}),mf=R({...pf.shape,...ff.pick({code_challenge_methods_supported:!0}).shape}),hf=R({access_token:M(),id_token:M().optional(),token_type:M(),expires_in:$c().optional(),scope:M().optional(),refresh_token:M().optional()}).strip(),gf=R({issued_token_type:U(`urn:ietf:params:oauth:token-type:id-jag`),access_token:M(),token_type:M().optional(),expires_in:P().optional(),scope:M().optional()}).strip(),_f=R({error:M(),error_description:M().optional(),error_uri:M().optional()}),vf=Y.optional().or(U(``).transform(()=>void 0)),yf=R({redirect_uris:L(Y),token_endpoint_auth_method:M().optional(),grant_types:L(M()).optional(),response_types:L(M()).optional(),application_type:M().optional(),client_name:M().optional(),client_uri:Y.optional(),logo_uri:vf,scope:M().optional(),contacts:L(M()).optional(),tos_uri:vf,policy_uri:M().optional(),jwks_uri:Y.optional(),jwks:lc().optional(),software_id:M().optional(),software_version:M().optional(),software_statement:M().optional()}).strip(),bf=R({client_id:M(),client_secret:M().optional(),client_id_issued_at:P().optional(),client_secret_expires_at:P().optional()}).strip(),xf=yf.merge(bf),Sf=R({error:M(),error_description:M().optional()}).strip(),Cf=R({token:M(),token_type_hint:M().optional()}).strip(),wf=Symbol.for(`mcp.sdk.errorBrands`);function Tf(e,t){let n=new Set,r=t;for(;typeof r==`function`;){let e=r.mcpBrand;Object.prototype.hasOwnProperty.call(r,`mcpBrand`)&&typeof e==`string`&&n.add(e),r=Object.getPrototypeOf(r)}n.size!==0&&Object.defineProperty(e,wf,{value:n,enumerable:!1,configurable:!0})}function Ef(e,t){try{if(typeof t==`object`&&t&&Object.prototype.hasOwnProperty.call(e,`mcpBrand`)&&typeof e.mcpBrand==`string`&&Object.prototype.hasOwnProperty.call(t,wf)){let n=t[wf];if(n&&typeof n.has==`function`&&n.has(e.mcpBrand))return!0}}catch{}return Function.prototype[Symbol.hasInstance].call(e,t)}(class e extends Error{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.OAuthError`})}static[Symbol.hasInstance](e){return Ef(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 Ef(this,e)}constructor(e,t,n){super(t),this.code=e,this.errorUri=n,this.name=`OAuthError`,Tf(this,new.target)}toResponseObject(){let e={error:this.code,error_description:this.message};return this.errorUri&&(e.error_uri=this.errorUri),e}static fromResponse(t){return new e(t.error,t.error_description??t.error,t.error_uri)}});var Df=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}({}),X=class extends Error{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.SdkError`})}static[Symbol.hasInstance](e){return Ef(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 Ef(this,e)}constructor(e,t,n){super(t),this.code=e,this.data=n,this.name=`SdkError`,Tf(this,new.target)}};(class extends X{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.SdkHttpError`})}constructor(e,t,n){super(e,t,n),this.name=`SdkHttpError`}get status(){return this.data.status}get statusText(){return this.data.statusText}});var Of=`2026-07-28`;function kf(e){return e>=Of}function Af(e){let t=e.structuredContent;return t===void 0||typeof t==`object`&&t&&!Array.isArray(t)||(e.content?.some(e=>e.type===`text`)??!1)?e:{...e,content:[...e.content??[],{type:`text`,text:JSON.stringify(t)}]}}var jf=[`task`,`inputRequests`,`requestState`];function Mf(e){return typeof e!=`object`||!e||Array.isArray(e)||e.content!==void 0||jf.some(t=>t in e)?e:{...e,content:[]}}function Nf(){let e=Wc(()=>B([M(),P(),F(),sc(),V(M(),e),L(e)])),t=V(M(),e),n=B([M(),P().int()]),r=M(),i=R({ttl:P().optional()}),a=R({taskId:M()}),o=z({progressToken:n.optional(),"io.modelcontextprotocol/related-task":a.optional()}),s=R({_meta:o.optional()}),c=s.extend({task:i.optional()}),l=R({method:M(),params:s.loose().optional()}),u=R({_meta:o.optional()}),d=R({method:M(),params:u.loose().optional()}),f=z({_meta:o.optional()}),p=B([M(),P().int()]),m=f.strict(),h=u.extend({requestId:p.optional(),reason:M().optional()}),ee=d.extend({method:U(`notifications/cancelled`),params:h}),g=R({src:M(),mimeType:M().optional(),sizes:L(M()).optional(),theme:H([`light`,`dark`]).optional()}),te=R({icons:L(g).optional()}),ne=R({name:M(),title:M().optional()}),re=ne.extend({...ne.shape,...te.shape,version:M(),websiteUrl:M().optional(),description:M().optional()}),ie=Jc(e=>e&&typeof e==`object`&&!Array.isArray(e)&&Object.keys(e).length===0?{form:{}}:e,yc(R({form:yc(R({applyDefaults:F().optional()}),t).optional(),url:t.optional()}),t.optional())),_=z({list:t.optional(),cancel:t.optional(),requests:z({sampling:z({createMessage:t.optional()}).optional(),elicitation:z({create:t.optional()}).optional()}).optional()}),ae=z({list:t.optional(),cancel:t.optional(),requests:z({tools:z({call:t.optional()}).optional()}).optional()}),oe=R({experimental:V(M(),t).optional(),sampling:R({context:t.optional(),tools:t.optional()}).optional(),elicitation:ie.optional(),roots:R({listChanged:F().optional()}).optional(),tasks:_.optional(),extensions:V(M(),t).optional()}),se=s.extend({protocolVersion:M(),capabilities:oe,clientInfo:re}),ce=l.extend({method:U(`initialize`),params:se}),le=R({experimental:V(M(),t).optional(),logging:t.optional(),completions:t.optional(),prompts:R({listChanged:F().optional()}).optional(),resources:R({subscribe:F().optional(),listChanged:F().optional()}).optional(),tools:R({listChanged:F().optional()}).optional(),tasks:ae.optional(),extensions:V(M(),t).optional()}),ue=f.extend({protocolVersion:M(),capabilities:le,serverInfo:re,instructions:M().optional()}),de=d.extend({method:U(`notifications/initialized`),params:u.optional()}),fe=l.extend({method:U(`ping`),params:s.optional()}),pe=R({progress:P(),total:W(P()),message:W(M())}),v=R({...u.shape,...pe.shape,progressToken:n}),y=d.extend({method:U(`notifications/progress`),params:v}),me=s.extend({cursor:r.optional()}),he=l.extend({params:me.optional()}),ge=f.extend({nextCursor:r.optional()}),_e=R({uri:M(),mimeType:W(M()),_meta:V(M(),I()).optional()}),ve=_e.extend({text:M()}),ye=M().refine(e=>{try{return atob(e),!0}catch{return!1}},{message:`Invalid Base64 string`}),be=_e.extend({blob:ye}),xe=H([`user`,`assistant`]),Se=R({audience:L(xe).optional(),priority:P().min(0).max(1).optional(),lastModified:Zc({offset:!0}).optional()}),Ce=R({...ne.shape,...te.shape,uri:M(),description:W(M()),mimeType:W(M()),size:W(P()),annotations:Se.optional(),_meta:W(z({}))}),we=R({...ne.shape,...te.shape,uriTemplate:M(),description:W(M()),mimeType:W(M()),annotations:Se.optional(),_meta:W(z({}))}),Te=he.extend({method:U(`resources/list`)}),Ee=ge.extend({resources:L(Ce)}),b=he.extend({method:U(`resources/templates/list`)}),De=ge.extend({resourceTemplates:L(we)}),Oe=s.extend({uri:M()}),ke=Oe,Ae=l.extend({method:U(`resources/read`),params:ke}),je=f.extend({contents:L(B([ve,be]))}),Me=d.extend({method:U(`notifications/resources/list_changed`),params:u.optional()}),Ne=Oe,Pe=l.extend({method:U(`resources/subscribe`),params:Ne}),Fe=Oe,Ie=l.extend({method:U(`resources/unsubscribe`),params:Fe}),Le=u.extend({uri:M()}),Re=d.extend({method:U(`notifications/resources/updated`),params:Le}),ze=R({name:M(),description:W(M()),required:W(F())}),Be=R({...ne.shape,...te.shape,description:W(M()),arguments:W(L(ze)),_meta:W(z({}))}),Ve=he.extend({method:U(`prompts/list`)}),He=ge.extend({prompts:L(Be)}),Ue=s.extend({name:M(),arguments:V(M(),M()).optional()}),We=l.extend({method:U(`prompts/get`),params:Ue}),Ge=R({type:U(`text`),text:M(),annotations:Se.optional(),_meta:V(M(),I()).optional()}),x=R({type:U(`image`),data:ye,mimeType:M(),annotations:Se.optional(),_meta:V(M(),I()).optional()}),Ke=R({type:U(`audio`),data:ye,mimeType:M(),annotations:Se.optional(),_meta:V(M(),I()).optional()}),qe=R({type:U(`tool_use`),name:M(),id:M(),input:V(M(),I()),_meta:V(M(),I()).optional()}),Je=R({type:U(`resource`),resource:B([ve,be]),annotations:Se.optional(),_meta:V(M(),I()).optional()}),Ye=Ce.extend({type:U(`resource_link`)}),Xe=B([Ge,x,Ke,Ye,Je]),Ze=R({role:xe,content:Xe}),Qe=f.extend({description:M().optional(),messages:L(Ze)}),$e=d.extend({method:U(`notifications/prompts/list_changed`),params:u.optional()}),S=R({title:M().optional(),readOnlyHint:F().optional(),destructiveHint:F().optional(),idempotentHint:F().optional(),openWorldHint:F().optional()}),et=R({taskSupport:H([`required`,`optional`,`forbidden`]).optional()}),tt=R({...ne.shape,...te.shape,description:M().optional(),inputSchema:R({type:U(`object`),properties:V(M(),e).optional(),required:L(M()).optional()}).catchall(I()),outputSchema:R({type:U(`object`),properties:V(M(),e).optional(),required:L(M()).optional()}).catchall(I()).optional(),annotations:S.optional(),execution:et.optional(),_meta:V(M(),I()).optional()}),C=he.extend({method:U(`tools/list`)}),w=ge.extend({tools:L(tt)}),nt=f.extend({content:L(Xe),structuredContent:V(M(),I()).optional(),isError:F().optional()}),T=c.extend({name:M(),arguments:V(M(),I()).optional()}),rt=l.extend({method:U(`tools/call`),params:T}),it=d.extend({method:U(`notifications/tools/list_changed`),params:u.optional()}),at=H([`debug`,`info`,`notice`,`warning`,`error`,`critical`,`alert`,`emergency`]),ot=s.extend({level:at}),st=l.extend({method:U(`logging/setLevel`),params:ot}),ct=u.extend({level:at,logger:M().optional(),data:I()}),lt=d.extend({method:U(`notifications/message`),params:ct}),ut=R({name:M().optional()}),dt=R({hints:L(ut).optional(),costPriority:P().min(0).max(1).optional(),speedPriority:P().min(0).max(1).optional(),intelligencePriority:P().min(0).max(1).optional()}),ft=R({mode:H([`auto`,`required`,`none`]).optional()}),pt=R({type:U(`tool_result`),toolUseId:M().describe(`The unique identifier for the corresponding tool call.`),content:L(Xe),structuredContent:R({}).loose().optional(),isError:F().optional(),_meta:V(M(),I()).optional()}),mt=_c(`type`,[Ge,x,Ke]),ht=_c(`type`,[Ge,x,Ke,qe,pt]),gt=R({role:xe,content:B([ht,L(ht)]),_meta:V(M(),I()).optional()}),_t=c.extend({messages:L(gt),modelPreferences:dt.optional(),systemPrompt:M().optional(),includeContext:H([`none`,`thisServer`,`allServers`]).optional(),temperature:P().optional(),maxTokens:P().int(),stopSequences:L(M()).optional(),metadata:t.optional(),tools:L(tt).optional(),toolChoice:ft.optional()}),vt=l.extend({method:U(`sampling/createMessage`),params:_t}),yt=f.extend({model:M(),stopReason:W(H([`endTurn`,`stopSequence`,`maxTokens`]).or(M())),role:xe,content:mt}),bt=f.extend({model:M(),stopReason:W(H([`endTurn`,`stopSequence`,`maxTokens`,`toolUse`]).or(M())),role:xe,content:B([ht,L(ht)])}),xt=R({type:U(`boolean`),title:M().optional(),description:M().optional(),default:F().optional()}),St=R({type:U(`string`),title:M().optional(),description:M().optional(),minLength:P().optional(),maxLength:P().optional(),format:H([`email`,`uri`,`date`,`date-time`]).optional(),default:M().optional()}),Ct=R({type:H([`number`,`integer`]),title:M().optional(),description:M().optional(),minimum:P().optional(),maximum:P().optional(),default:P().optional()}),wt=R({type:U(`string`),title:M().optional(),description:M().optional(),enum:L(M()),default:M().optional()}),Tt=R({type:U(`string`),title:M().optional(),description:M().optional(),oneOf:L(R({const:M(),title:M()})),default:M().optional()}),Et=R({type:U(`string`),title:M().optional(),description:M().optional(),enum:L(M()),enumNames:L(M()).optional(),default:M().optional()}),Dt=B([wt,Tt]),Ot=R({type:U(`array`),title:M().optional(),description:M().optional(),minItems:P().optional(),maxItems:P().optional(),items:R({type:U(`string`),enum:L(M())}),default:L(M()).optional()}),kt=R({type:U(`array`),title:M().optional(),description:M().optional(),minItems:P().optional(),maxItems:P().optional(),items:R({anyOf:L(R({const:M(),title:M()}))}),default:L(M()).optional()}),At=B([Ot,kt]),jt=B([Et,Dt,At]),Mt=B([jt,xt,St,Ct]),Nt=c.extend({mode:U(`form`).optional(),message:M(),requestedSchema:R({type:U(`object`),properties:V(M(),Mt),required:L(M()).optional()}).catchall(I())}),Pt=c.extend({mode:U(`url`),message:M(),elicitationId:M(),url:M().url()}),Ft=B([Nt,Pt]),It=l.extend({method:U(`elicitation/create`),params:Ft}),Lt=u.extend({elicitationId:M()}),Rt=d.extend({method:U(`notifications/elicitation/complete`),params:Lt}),zt=f.extend({action:H([`accept`,`decline`,`cancel`]),content:Jc(e=>e===null?void 0:e,V(M(),B([M(),P(),F(),L(M())])).optional())}),Bt=R({type:U(`ref/resource`),uri:M()}),Vt=R({type:U(`ref/prompt`),name:M()}),Ht=s.extend({ref:B([Vt,Bt]),argument:R({name:M(),value:M()}),context:R({arguments:V(M(),M()).optional()}).optional()}),Ut=l.extend({method:U(`completion/complete`),params:Ht}),Wt=f.extend({completion:z({values:L(M()).max(100),total:W(P().int()),hasMore:W(F())})}),Gt=R({uri:M().startsWith(`file://`),name:M().optional(),_meta:V(M(),I()).optional()}),Kt=l.extend({method:U(`roots/list`),params:s.optional()}),qt=f.extend({roots:L(Gt)}),Jt=d.extend({method:U(`notifications/roots/list_changed`),params:u.optional()}),Yt=z({ttl:P().optional(),pollInterval:P().optional()}),Xt=H([`working`,`input_required`,`completed`,`failed`,`cancelled`]),Zt=R({taskId:M(),status:Xt,ttl:B([P(),sc()]),createdAt:M(),lastUpdatedAt:M(),pollInterval:W(P()),statusMessage:W(M())}),Qt=f.extend({task:Zt}),$t=u.merge(Zt),en=d.extend({method:U(`notifications/tasks/status`),params:$t}),tn=l.extend({method:U(`tasks/get`),params:s.extend({taskId:M()})}),nn=f.merge(Zt),rn=l.extend({method:U(`tasks/result`),params:s.extend({taskId:M()})}),an=f.loose(),E=he.extend({method:U(`tasks/list`)}),on=ge.extend({tasks:L(Zt)}),sn=l.extend({method:U(`tasks/cancel`),params:s.extend({taskId:M()})});return{JSONValueSchema:e,JSONObjectSchema:t,ProgressTokenSchema:n,CursorSchema:r,TaskMetadataSchema:i,RelatedTaskMetadataSchema:a,RequestMetaSchema:o,BaseRequestParamsSchema:s,TaskAugmentedRequestParamsSchema:c,RequestSchema:l,NotificationsParamsSchema:u,NotificationSchema:d,ResultSchema:f,RequestIdSchema:p,EmptyResultSchema:m,CancelledNotificationParamsSchema:h,CancelledNotificationSchema:ee,IconSchema:g,IconsSchema:te,BaseMetadataSchema:ne,ImplementationSchema:re,ClientTasksCapabilitySchema:_,ServerTasksCapabilitySchema:ae,ClientCapabilitiesSchema:oe,InitializeRequestParamsSchema:se,InitializeRequestSchema:ce,ServerCapabilitiesSchema:le,InitializeResultSchema:ue,InitializedNotificationSchema:de,PingRequestSchema:fe,ProgressSchema:pe,ProgressNotificationParamsSchema:v,ProgressNotificationSchema:y,PaginatedRequestParamsSchema:me,PaginatedRequestSchema:he,PaginatedResultSchema:ge,ResourceContentsSchema:_e,TextResourceContentsSchema:ve,BlobResourceContentsSchema:be,RoleSchema:xe,AnnotationsSchema:Se,ResourceSchema:Ce,ResourceTemplateSchema:we,ListResourcesRequestSchema:Te,ListResourcesResultSchema:Ee,ListResourceTemplatesRequestSchema:b,ListResourceTemplatesResultSchema:De,ResourceRequestParamsSchema:Oe,ReadResourceRequestParamsSchema:ke,ReadResourceRequestSchema:Ae,ReadResourceResultSchema:je,ResourceListChangedNotificationSchema:Me,SubscribeRequestParamsSchema:Ne,SubscribeRequestSchema:Pe,UnsubscribeRequestParamsSchema:Fe,UnsubscribeRequestSchema:Ie,ResourceUpdatedNotificationParamsSchema:Le,ResourceUpdatedNotificationSchema:Re,PromptArgumentSchema:ze,PromptSchema:Be,ListPromptsRequestSchema:Ve,ListPromptsResultSchema:He,GetPromptRequestParamsSchema:Ue,GetPromptRequestSchema:We,TextContentSchema:Ge,ImageContentSchema:x,AudioContentSchema:Ke,ToolUseContentSchema:qe,EmbeddedResourceSchema:Je,ResourceLinkSchema:Ye,ContentBlockSchema:Xe,PromptMessageSchema:Ze,GetPromptResultSchema:Qe,PromptListChangedNotificationSchema:$e,ToolAnnotationsSchema:S,ToolExecutionSchema:et,ToolSchema:tt,ListToolsRequestSchema:C,ListToolsResultSchema:w,CallToolResultSchema:nt,CallToolRequestParamsSchema:T,CallToolRequestSchema:rt,ToolListChangedNotificationSchema:it,LoggingLevelSchema:at,SetLevelRequestParamsSchema:ot,SetLevelRequestSchema:st,LoggingMessageNotificationParamsSchema:ct,LoggingMessageNotificationSchema:lt,ModelHintSchema:ut,ModelPreferencesSchema:dt,ToolChoiceSchema:ft,ToolResultContentSchema:pt,SamplingContentSchema:mt,SamplingMessageContentBlockSchema:ht,SamplingMessageSchema:gt,CreateMessageRequestParamsSchema:_t,CreateMessageRequestSchema:vt,CreateMessageResultSchema:yt,CreateMessageResultWithToolsSchema:bt,BooleanSchemaSchema:xt,StringSchemaSchema:St,NumberSchemaSchema:Ct,UntitledSingleSelectEnumSchemaSchema:wt,TitledSingleSelectEnumSchemaSchema:Tt,LegacyTitledEnumSchemaSchema:Et,SingleSelectEnumSchemaSchema:Dt,UntitledMultiSelectEnumSchemaSchema:Ot,TitledMultiSelectEnumSchemaSchema:kt,MultiSelectEnumSchemaSchema:At,EnumSchemaSchema:jt,PrimitiveSchemaDefinitionSchema:Mt,ElicitRequestFormParamsSchema:Nt,ElicitRequestURLParamsSchema:Pt,ElicitRequestParamsSchema:Ft,ElicitRequestSchema:It,ElicitationCompleteNotificationParamsSchema:Lt,ElicitationCompleteNotificationSchema:Rt,ElicitResultSchema:zt,ResourceTemplateReferenceSchema:Bt,PromptReferenceSchema:Vt,CompleteRequestParamsSchema:Ht,CompleteRequestSchema:Ut,CompleteResultSchema:Wt,RootSchema:Gt,ListRootsRequestSchema:Kt,ListRootsResultSchema:qt,RootsListChangedNotificationSchema:Jt,TaskCreationParamsSchema:Yt,TaskStatusSchema:Xt,TaskSchema:Zt,CreateTaskResultSchema:Qt,TaskStatusNotificationParamsSchema:$t,TaskStatusNotificationSchema:en,GetTaskRequestSchema:tn,GetTaskResultSchema:nn,GetTaskPayloadRequestSchema:rn,GetTaskPayloadResultSchema:an,ListTasksRequestSchema:E,ListTasksResultSchema:on,CancelTaskRequestSchema:sn,CancelTaskResultSchema:f.merge(Zt),ClientRequestSchema:B([fe,ce,Ut,st,We,Ve,Te,b,Ae,Pe,Ie,rt,C,tn,rn,E,sn]),ClientNotificationSchema:B([ee,y,de,Jt,en]),ClientResultSchema:B([m,yt,bt,zt,qt,nn,on,Qt]),ServerRequestSchema:B([fe,vt,It,Kt,tn,rn,E,sn]),ServerNotificationSchema:B([ee,y,lt,Re,Me,it,$e,en,Rt]),ServerResultSchema:B([m,ue,Wt,Qe,He,Ee,De,je,nt,w,nn,on,Qt]),CallToolResultWireSchema:I().superRefine((e,t)=>{if(typeof e==`object`&&e&&!Array.isArray(e)&&e.content===void 0){for(let n of jf)if(n in e){t.addIssue({code:`custom`,message:`content is required when the body carries '${n}' — another result family cannot default into an empty tools/call success`});return}}}).transform(Mf).pipe(nt)}}var Pf;function Ff(){return Pf??=Nf()}function If(e){return e.type!==`object`}var Lf=new Set([`const`,`enum`,`default`,`examples`]),Rf=new Set([`properties`,`patternProperties`,`$defs`,`definitions`,`dependentSchemas`,`dependencies`]);function zf(e){return e!==void 0&&!(typeof e==`string`&&e.startsWith(`#`))}function Bf(e){let t=typeof e.$schema==`string`?e.$schema:void 0;if(zf(e.$id))return{...t!==void 0&&{$schema:t},type:`object`,properties:{result:e},required:[`result`]};let n=i(e.$schema)&&e.$recursiveAnchor!==!0,r=(e,t)=>{if(Array.isArray(e))return e.map(e=>r(e,!1));if(typeof e!=`object`||!e||!t&&zf(e.$id))return e;let i={},a=!1;for(let[o,s]of Object.entries(e))t?i[o]=r(s,!1):(o===`$ref`||o===`$dynamicRef`)&&typeof s==`string`?i[o]=s===`#`?`#/properties/result`:s.startsWith(`#/`)?`#/properties/result${s.slice(1)}`:s:o===`$recursiveRef`&&s===`#`&&n?a=!0:i[o]=Lf.has(o)?s:Rf.has(o)?r(s,!0):r(s,!1);return a&&(`$ref`in i?i.allOf=[...Array.isArray(i.allOf)?i.allOf:[],{$ref:`#/properties/result`}]:i.$ref=`#/properties/result`),i};return{...t!==void 0&&{$schema:t},type:`object`,properties:{result:r(e,!1)},required:[`result`]}}var Vf={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},Hf={"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},Uf={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},Wf;function Gf(){if(Wf)return Wf;let e=Ff();return Wf={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}},Wf}function Kf(e){return Object.prototype.hasOwnProperty.call(Vf,e)}function qf(e){return Object.prototype.hasOwnProperty.call(Hf,e)}function Jf(e){return Object.prototype.hasOwnProperty.call(Uf,e)}function Yf(e){return Jf(e)?Gf().resultSchemas[e]:void 0}function Xf(e){return Kf(e)?Gf().requestSchemas[e]:void 0}function Zf(e){return qf(e)?Gf().notificationSchemas[e]:void 0}Object.keys(Vf),Object.keys(Hf);function Qf(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function $f(e,t){if(e===void 0)return{ok:!1,reason:`not-in-era`};let n=e.safeParse(t);return n.success?{ok:!0,value:n.data}:{ok:!1,reason:`invalid`,message:String(n.error)}}var ep={ok:!1,reason:`not-in-era`};function tp(e){return Qf(e)&&Qf(e.outputSchema)&&If(e.outputSchema)}function np(e){return e}var rp={era:`2025-11-25`,hasRequestMethod:Kf,hasNotificationMethod:qf,validateRequest:(e,t)=>$f(Xf(e),t),validateResult:(e,t)=>$f(Yf(e),t),validateNotification:(e,t)=>$f(Zf(e),t),hasInputRequestMethod:()=>!1,validateInputRequest:()=>ep,validateInputResponse:()=>ep,samplingResultVariant:((e,t)=>{let n=Ff();return $f(e?n.CreateMessageResultWithToolsSchema:n.CreateMessageResultSchema,t)}),outboundEnvelope:e=>void 0,validateEnvelopeMeta:e=>[],projectCallToolResult(e,t){let n=Af(e),r=n.structuredContent;if(r===void 0)return n;let i=typeof r!=`object`||!r||Array.isArray(r),a=t!==void 0&&If(t);return!i&&!a?n:{...n,structuredContent:{result:r}}},decodeResult(e,t){if(Qf(t)&&`resultType`in t){let e={...t};return delete e.resultType,{kind:`complete`,result:np(e)}}return{kind:`complete`,result:np(t)}},encodeResult(e,t){if(e!==`tools/list`)return t;let n=t.tools;return!Array.isArray(n)||!n.some(e=>tp(e))?t:{...t,tools:n.map(e=>tp(e)?{...e,outputSchema:Bf(e.outputSchema)}:e)}},encodeErrorCode:e=>e===-32002?-32602:e,checkInboundEnvelope:e=>void 0};function ip(){let e=Wc(()=>B([M(),P(),F(),sc(),V(M(),e),L(e)])),t=V(M(),e),n=B([M(),P().int()]),r=M(),i=B([M(),P().int()]),a=H([`user`,`assistant`]),o=H([`debug`,`info`,`notice`,`warning`,`error`,`critical`,`alert`,`emergency`]),s=M().refine(e=>{try{return atob(e),!0}catch{return!1}},{message:`Invalid Base64 string`}),c=R({ttl:P().optional()}),l=R({taskId:M()}),u=z({progressToken:n.optional(),"io.modelcontextprotocol/related-task":l.optional()}),d=R({_meta:u.optional()}),f=d.extend({task:c.optional()}),p=R({_meta:u.optional()}),m=R({method:M(),params:p.loose().optional()}),h=R({src:M(),mimeType:M().optional(),sizes:L(M()).optional(),theme:H([`light`,`dark`]).optional()}),ee=R({icons:L(h).optional()}),g=R({name:M(),title:M().optional()}),te=g.extend({...g.shape,...ee.shape,version:M(),websiteUrl:M().optional(),description:M().optional()}),ne=Jc(e=>e&&typeof e==`object`&&!Array.isArray(e)&&Object.keys(e).length===0?{form:{}}:e,yc(R({form:yc(R({applyDefaults:F().optional()}),t).optional(),url:t.optional()}),t.optional())),re=z({list:t.optional(),cancel:t.optional(),requests:z({sampling:z({createMessage:t.optional()}).optional(),elicitation:z({create:t.optional()}).optional()}).optional()}),ie=z({list:t.optional(),cancel:t.optional(),requests:z({tools:z({call:t.optional()}).optional()}).optional()}),_=R({experimental:V(M(),t).optional(),sampling:R({context:t.optional(),tools:t.optional()}).optional(),elicitation:ne.optional(),roots:R({listChanged:F().optional()}).optional(),tasks:re.optional(),extensions:V(M(),t).optional()}),ae=R({experimental:V(M(),t).optional(),logging:t.optional(),completions:t.optional(),prompts:R({listChanged:F().optional()}).optional(),resources:R({subscribe:F().optional(),listChanged:F().optional()}).optional(),tools:R({listChanged:F().optional()}).optional(),tasks:ie.optional(),extensions:V(M(),t).optional()}),oe=R({progress:P(),total:W(P()),message:W(M())}),se=R({...p.shape,...oe.shape,progressToken:n}),ce=m.extend({method:U(`notifications/progress`),params:se}),le=p.extend({level:o,logger:M().optional(),data:I()}),ue=m.extend({method:U(`notifications/message`),params:le}),de=R({uri:M(),mimeType:W(M()),_meta:V(M(),I()).optional()}),fe=de.extend({text:M()}),pe=de.extend({blob:s}),v=R({audience:L(a).optional(),priority:P().min(0).max(1).optional(),lastModified:Zc({offset:!0}).optional()}),y=R({...g.shape,...ee.shape,uri:M(),description:W(M()),mimeType:W(M()),size:W(P()),annotations:v.optional(),_meta:W(z({}))}),me=R({...g.shape,...ee.shape,uriTemplate:M(),description:W(M()),mimeType:W(M()),annotations:v.optional(),_meta:W(z({}))}),he=m.extend({method:U(`notifications/resources/list_changed`),params:p.optional()}),ge=p.extend({uri:M()}),_e=m.extend({method:U(`notifications/resources/updated`),params:ge}),ve=R({name:M(),description:W(M()),required:W(F())}),ye=R({...g.shape,...ee.shape,description:W(M()),arguments:W(L(ve)),_meta:W(z({}))}),be=m.extend({method:U(`notifications/prompts/list_changed`),params:p.optional()}),xe=R({type:U(`text`),text:M(),annotations:v.optional(),_meta:V(M(),I()).optional()}),Se=R({type:U(`image`),data:s,mimeType:M(),annotations:v.optional(),_meta:V(M(),I()).optional()}),Ce=R({type:U(`audio`),data:s,mimeType:M(),annotations:v.optional(),_meta:V(M(),I()).optional()}),we=R({type:U(`tool_use`),name:M(),id:M(),input:V(M(),I()),_meta:V(M(),I()).optional()}),Te=R({type:U(`resource`),resource:B([fe,pe]),annotations:v.optional(),_meta:V(M(),I()).optional()}),Ee=y.extend({type:U(`resource_link`)}),b=B([xe,Se,Ce,Ee,Te]),De=R({role:a,content:b}),Oe=R({title:M().optional(),readOnlyHint:F().optional(),destructiveHint:F().optional(),idempotentHint:F().optional(),openWorldHint:F().optional()}),ke=m.extend({method:U(`notifications/tools/list_changed`),params:p.optional()}),Ae=R({name:M().optional()}),je=R({hints:L(Ae).optional(),costPriority:P().min(0).max(1).optional(),speedPriority:P().min(0).max(1).optional(),intelligencePriority:P().min(0).max(1).optional()}),Me=R({mode:H([`auto`,`required`,`none`]).optional()}),Ne=R({type:U(`boolean`),title:M().optional(),description:M().optional(),default:F().optional()}),Pe=R({type:U(`string`),title:M().optional(),description:M().optional(),minLength:P().optional(),maxLength:P().optional(),format:H([`email`,`uri`,`date`,`date-time`]).optional(),default:M().optional()}),Fe=R({type:H([`number`,`integer`]),title:M().optional(),description:M().optional(),minimum:P().optional(),maximum:P().optional(),default:P().optional()}),Ie=R({type:U(`string`),title:M().optional(),description:M().optional(),enum:L(M()),default:M().optional()}),Le=R({type:U(`string`),title:M().optional(),description:M().optional(),oneOf:L(R({const:M(),title:M()})),default:M().optional()}),Re=R({type:U(`string`),title:M().optional(),description:M().optional(),enum:L(M()),enumNames:L(M()).optional(),default:M().optional()}),ze=B([Ie,Le]),Be=R({type:U(`array`),title:M().optional(),description:M().optional(),minItems:P().optional(),maxItems:P().optional(),items:R({type:U(`string`),enum:L(M())}),default:L(M()).optional()}),Ve=R({type:U(`array`),title:M().optional(),description:M().optional(),minItems:P().optional(),maxItems:P().optional(),items:R({anyOf:L(R({const:M(),title:M()}))}),default:L(M()).optional()}),He=B([Be,Ve]),Ue=B([Re,ze,He]),We=B([Ue,Ne,Pe,Fe]),Ge=f.extend({mode:U(`form`).optional(),message:M(),requestedSchema:R({type:U(`object`),properties:V(M(),We),required:L(M()).optional()}).catchall(I())}),x=R({type:U(`ref/resource`),uri:M()}),Ke=R({type:U(`ref/prompt`),name:M()}),qe=R({uri:M().startsWith(`file://`),name:M().optional(),_meta:V(M(),I()).optional()}),Je=_.shape,Ye=R({experimental:Je.experimental,sampling:Je.sampling,elicitation:Je.elicitation,roots:Je.roots,extensions:Je.extensions}),Xe=ae.shape,Ze=R({experimental:Xe.experimental,logging:Xe.logging,completions:Xe.completions,prompts:Xe.prompts,resources:Xe.resources,tools:Xe.tools,extensions:Xe.extensions}),Qe=z({progressToken:n.optional(),[nl]:M(),[rl]:te.optional(),[al]:Ye,[sl]:o.optional()}),$e=R({...g.shape,...ee.shape,description:M().optional(),inputSchema:z({$schema:M().optional(),type:U(`object`)}),outputSchema:z({$schema:M().optional()}).optional(),annotations:Oe.optional(),_meta:V(M(),I()).optional()}),S=R({type:U(`tool_result`),toolUseId:M(),content:L(b),structuredContent:I().optional(),isError:F().optional(),_meta:V(M(),I()).optional()}),et=B([xe,Se,Ce,we,S]),tt=R({role:a,content:B([et,L(et)]),_meta:V(M(),I()).optional()}),C=M(),w=z({[il]:te.optional().catch(void 0)}),nt=w.optional();function T(e){return z({_meta:nt,resultType:C.default(`complete`),...e})}let rt=T({}),it=T({nextCursor:r.optional()}),at=T({content:L(b),structuredContent:I().optional(),isError:F().optional()}),ot=T({ttlMs:P().int().min(0),cacheScope:H([`public`,`private`]),tools:L($e),nextCursor:r.optional()}),st=T({ttlMs:P().int().min(0),cacheScope:H([`public`,`private`]),prompts:L(ye),nextCursor:r.optional()}),ct=T({description:M().optional(),messages:L(De)}),lt=T({ttlMs:P().int().min(0),cacheScope:H([`public`,`private`]),resources:L(y),nextCursor:r.optional()}),ut=T({ttlMs:P().int().min(0),cacheScope:H([`public`,`private`]),resourceTemplates:L(me),nextCursor:r.optional()}),dt=T({ttlMs:P().int().min(0),cacheScope:H([`public`,`private`]),contents:L(B([fe,pe]))}),ft=T({completion:R({values:L(M()).max(100),total:P().int().optional(),hasMore:F().optional()}).loose()}),pt=T({ttlMs:P().int().min(0),cacheScope:H([`public`,`private`])}),mt=T({ttlMs:P().int().min(0).catch(0),cacheScope:H([`public`,`private`]).catch(`private`),supportedVersions:L(M()),capabilities:Ze,instructions:M().optional()}),ht=R({messages:L(tt),modelPreferences:je.optional(),systemPrompt:M().optional(),includeContext:H([`none`,`thisServer`,`allServers`]).optional(),temperature:P().optional(),maxTokens:P().int(),stopSequences:L(M()).optional(),metadata:t.optional(),tools:L($e).optional(),toolChoice:Me.optional()}),gt=R({method:U(`sampling/createMessage`),params:ht}),_t=R({method:U(`roots/list`),params:R({_meta:V(M(),I()).optional()}).optional()}),vt=R({...tt.shape,model:M(),stopReason:M().optional()}),yt=R({roots:L(qe)}),bt=R({action:H([`accept`,`decline`,`cancel`]),content:V(M(),B([M(),P(),F(),L(M())])).optional()}),xt=R({mode:U(`url`),message:M(),url:M().url()}),St=B([Ge,xt]),Ct=R({method:U(`elicitation/create`),params:St}),wt=B([gt,_t,Ct]),Tt=B([vt,yt,bt]),Et=V(M(),wt),Dt=V(M(),Tt),Ot=T({inputRequests:Et.optional(),requestState:M().optional()}),kt={inputResponses:Dt.optional(),requestState:M().optional()},At=R({_meta:Qe,...kt}),jt=z({progressToken:n.optional()});function Mt(e,t){return R({method:U(e),params:R({_meta:Qe,...t})})}function Nt(e,t){return R({method:U(e),params:R({_meta:jt.optional(),...t}).optional()})}let Pt={name:M(),arguments:V(M(),I()).optional(),...kt},Ft={cursor:r.optional()},It=Mt(`tools/call`,Pt),Lt=Mt(`tools/list`,Ft),Rt=Mt(`prompts/list`,Ft),zt=Mt(`prompts/get`,{name:M(),arguments:V(M(),M()).optional(),...kt}),Bt=Mt(`resources/list`,Ft),Vt=Mt(`resources/templates/list`,Ft),Ht=Mt(`resources/read`,{uri:M(),...kt}),Ut={ref:B([Ke,x]),argument:R({name:M(),value:M()}),context:R({arguments:V(M(),M()).optional()}).optional()},Wt=Mt(`completion/complete`,Ut),Gt=Mt(`server/discover`,{}),Kt=R({toolsListChanged:F().optional(),promptsListChanged:F().optional(),resourcesListChanged:F().optional(),resourceSubscriptions:L(M()).optional()}),qt={notifications:Kt},Jt=Mt(`subscriptions/listen`,qt),Yt=w.extend({"io.modelcontextprotocol/subscriptionId":i}),Xt=z({_meta:Yt,resultType:C.default(`complete`)}),Zt={"tools/call":Nt(`tools/call`,Pt),"tools/list":Nt(`tools/list`,Ft),"prompts/get":Nt(`prompts/get`,{name:M(),arguments:V(M(),M()).optional()}),"prompts/list":Nt(`prompts/list`,Ft),"resources/list":Nt(`resources/list`,Ft),"resources/templates/list":Nt(`resources/templates/list`,Ft),"resources/read":Nt(`resources/read`,{uri:M()}),"completion/complete":Nt(`completion/complete`,Ut),"server/discover":Nt(`server/discover`,{}),"subscriptions/listen":Nt(`subscriptions/listen`,qt)};function Qt(e){return z({_meta:nt,...e})}let $t={"tools/call":Qt({content:L(b),structuredContent:I().optional(),isError:F().optional()}),"tools/list":Qt({ttlMs:P().int().min(0),cacheScope:H([`public`,`private`]),tools:L($e),nextCursor:r.optional()}),"prompts/get":Qt({description:M().optional(),messages:L(De)}),"prompts/list":Qt({ttlMs:P().int().min(0),cacheScope:H([`public`,`private`]),prompts:L(ye),nextCursor:r.optional()}),"resources/list":Qt({ttlMs:P().int().min(0),cacheScope:H([`public`,`private`]),resources:L(y),nextCursor:r.optional()}),"resources/templates/list":Qt({ttlMs:P().int().min(0),cacheScope:H([`public`,`private`]),resourceTemplates:L(me),nextCursor:r.optional()}),"resources/read":Qt({ttlMs:P().int().min(0),cacheScope:H([`public`,`private`]),contents:L(B([fe,pe]))}),"completion/complete":Qt({completion:R({values:L(M()).max(100),total:P().int().optional(),hasMore:F().optional()}).loose()}),"server/discover":Qt({ttlMs:P().int().min(0).catch(0),cacheScope:H([`public`,`private`]).catch(`private`),supportedVersions:L(M()),capabilities:Ze,instructions:M().optional()}),"subscriptions/listen":Qt({})},en=z({"io.modelcontextprotocol/subscriptionId":i.optional()}),tn=R({method:U(`notifications/subscriptions/acknowledged`),params:R({_meta:en.optional(),notifications:Kt})}),nn=R({_meta:en.optional(),requestId:i,reason:M().optional()}),rn=R({method:U(`notifications/cancelled`),params:nn}),an={"notifications/cancelled":rn,"notifications/progress":ce,"notifications/message":ue,"notifications/resources/updated":_e,"notifications/resources/list_changed":he,"notifications/tools/list_changed":ke,"notifications/prompts/list_changed":be,"notifications/subscriptions/acknowledged":tn},E=e=>R({jsonrpc:U(`2.0`),id:B([M(),P().int()]),result:e}).strict();return{JSONValueSchema:e,JSONObjectSchema:t,ProgressTokenSchema:n,CursorSchema:r,RequestIdSchema:i,RoleSchema:a,LoggingLevelSchema:o,TaskMetadataSchema:c,RelatedTaskMetadataSchema:l,RequestMetaSchema:u,BaseRequestParamsSchema:d,TaskAugmentedRequestParamsSchema:f,NotificationsParamsSchema:p,NotificationSchema:m,IconSchema:h,IconsSchema:ee,BaseMetadataSchema:g,ImplementationSchema:te,ClientTasksCapabilitySchema:re,ServerTasksCapabilitySchema:ie,ClientCapabilitiesSchema:_,ServerCapabilitiesSchema:ae,ProgressSchema:oe,ProgressNotificationParamsSchema:se,ProgressNotificationSchema:ce,LoggingMessageNotificationParamsSchema:le,LoggingMessageNotificationSchema:ue,ResourceContentsSchema:de,TextResourceContentsSchema:fe,BlobResourceContentsSchema:pe,AnnotationsSchema:v,ResourceSchema:y,ResourceTemplateSchema:me,ResourceListChangedNotificationSchema:he,ResourceUpdatedNotificationParamsSchema:ge,ResourceUpdatedNotificationSchema:_e,PromptArgumentSchema:ve,PromptSchema:ye,PromptListChangedNotificationSchema:be,TextContentSchema:xe,ImageContentSchema:Se,AudioContentSchema:Ce,ToolUseContentSchema:we,EmbeddedResourceSchema:Te,ResourceLinkSchema:Ee,ContentBlockSchema:b,PromptMessageSchema:De,ToolAnnotationsSchema:Oe,ToolListChangedNotificationSchema:ke,ModelHintSchema:Ae,ModelPreferencesSchema:je,ToolChoiceSchema:Me,BooleanSchemaSchema:Ne,StringSchemaSchema:Pe,NumberSchemaSchema:Fe,UntitledSingleSelectEnumSchemaSchema:Ie,TitledSingleSelectEnumSchemaSchema:Le,LegacyTitledEnumSchemaSchema:Re,SingleSelectEnumSchemaSchema:ze,UntitledMultiSelectEnumSchemaSchema:Be,TitledMultiSelectEnumSchemaSchema:Ve,MultiSelectEnumSchemaSchema:He,EnumSchemaSchema:Ue,PrimitiveSchemaDefinitionSchema:We,ElicitRequestFormParamsSchema:Ge,ResourceTemplateReferenceSchema:x,PromptReferenceSchema:Ke,RootSchema:qe,ClientCapabilities2026Schema:Ye,ServerCapabilities2026Schema:Ze,RequestMetaEnvelopeSchema:Qe,ToolSchema:$e,ToolResultContentSchema:S,SamplingMessageContentBlockSchema:et,SamplingMessageSchema:tt,ResultTypeSchema:C,ResultMetaSchema:w,ResultSchema:rt,PaginatedResultSchema:it,CallToolResultSchema:at,ListToolsResultSchema:ot,ListPromptsResultSchema:st,GetPromptResultSchema:ct,ListResourcesResultSchema:lt,ListResourceTemplatesResultSchema:ut,ReadResourceResultSchema:dt,CompleteResultSchema:ft,CacheableResultSchema:pt,DiscoverResultSchema:mt,CreateMessageRequestParamsSchema:ht,CreateMessageRequestSchema:gt,ListRootsRequestSchema:_t,CreateMessageResultSchema:vt,ListRootsResultSchema:yt,ElicitResultSchema:bt,ElicitRequestURLParamsSchema:xt,ElicitRequestParamsSchema:St,ElicitRequestSchema:Ct,InputRequestSchema:wt,InputResponseSchema:Tt,InputRequestsSchema:Et,InputResponsesSchema:Dt,InputRequiredResultSchema:Ot,InputResponseRequestParamsSchema:At,CallToolRequestSchema:It,ListToolsRequestSchema:Lt,ListPromptsRequestSchema:Rt,GetPromptRequestSchema:zt,ListResourcesRequestSchema:Bt,ListResourceTemplatesRequestSchema:Vt,ReadResourceRequestSchema:Ht,CompleteRequestSchema:Wt,DiscoverRequestSchema:Gt,SubscriptionFilterSchema:Kt,SubscriptionsListenRequestSchema:Jt,SubscriptionsListenResultMetaSchema:Yt,SubscriptionsListenResultSchema:Xt,dispatchRequestSchemas:Zt,dispatchResultSchemas:$t,NotificationMetaSchema:en,SubscriptionsAcknowledgedNotificationSchema:tn,CancelledNotificationParamsSchema:nn,CancelledNotificationSchema:rn,notificationSchemas2026:an,JSONRPCResultResponseSchema:E(rt),CallToolResultResponseSchema:E(B([at,Ot])),ListToolsResultResponseSchema:E(ot),ListPromptsResultResponseSchema:E(st),GetPromptResultResponseSchema:E(B([ct,Ot])),ListResourcesResultResponseSchema:E(lt),ListResourceTemplatesResultResponseSchema:E(ut),ReadResourceResultResponseSchema:E(B([dt,Ot])),CompleteResultResponseSchema:E(ft),DiscoverResultResponseSchema:E(mt)}}var ap;function op(){return ap??=ip()}var sp=[`tools/list`,`prompts/list`,`resources/list`,`resources/templates/list`,`resources/read`,`server/discover`];function cp(e){return sp.includes(e)}var lp=Symbol(`modelcontextprotocol.resultCacheHintFallback`);function up(e){return e[lp]}function dp(e){return typeof e==`number`&&Number.isSafeInteger(e)&&e>=0}function fp(e){return e===`public`||e===`private`}var Z=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}({}),Q=class e extends Error{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.ProtocolError`})}static[Symbol.hasInstance](e){return Ef(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 Ef(this,e)}constructor(e,t,n){super(t),this.code=e,this.data=n,this.name=`ProtocolError`,Tf(this,new.target)}static fromError(t,n,r){if(t===Z.UrlElicitationRequired&&r){let e=r;if(e.elicitations)return new mp(e.elicitations,n)}if(t===Z.UnsupportedProtocolVersion&&r){let e=r;if(Array.isArray(e.supported)&&typeof e.requested==`string`)return new hp({supported:e.supported,requested:e.requested},n)}if(t===Z.InvalidParams||t===Z.ResourceNotFound){let e=r;if(typeof e?.uri==`string`&&(t===Z.ResourceNotFound||Object.keys(e).length===1))return new pp(e.uri,n)}if(t===Z.MissingRequiredClientCapability&&r){let e=r;if(e.requiredCapabilities!==null&&typeof e.requiredCapabilities==`object`&&!Array.isArray(e.requiredCapabilities))return new gp({requiredCapabilities:e.requiredCapabilities},n)}return new e(t,n,r)}},pp=class extends Q{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.ResourceNotFoundError`})}constructor(e,t=`Resource not found: ${e}`){super(Z.InvalidParams,t,{uri:e})}get uri(){return this.data.uri}},mp=class extends Q{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.UrlElicitationRequiredError`})}constructor(e,t=`URL elicitation${e.length>1?`s`:``} required`){super(Z.UrlElicitationRequired,t,{elicitations:e})}get elicitations(){return this.data?.elicitations??[]}},hp=class extends Q{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.UnsupportedProtocolVersionError`})}constructor(e,t=`Unsupported protocol version: ${e.requested}`){super(Z.UnsupportedProtocolVersion,t,e)}get supported(){return this.data.supported}get requested(){return this.data.requested}},gp=class extends Q{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.MissingRequiredClientCapabilityError`})}constructor(e,t=`Missing required client capabilities: ${Object.keys(e.requiredCapabilities).join(`, `)}`){super(Z.MissingRequiredClientCapability,t,e)}get requiredCapabilities(){return this.data.requiredCapabilities}},_p=0,vp=`private`,yp=[`tools/call`,`prompts/get`,`resources/read`];function bp(e,t){let n=t.resultType;if(n===void 0)return{...t,resultType:`complete`};if(n===`complete`||yp.includes(e))return t;throw new Q(Z.InternalError,`Handler for ${e} returned resultType '${String(n)}', but results of ${e} only support 'complete' on protocol revision 2026-07-28`)}function xp(e,t){let n=up(t);if(t.resultType!==`complete`||!cp(e))return n===void 0?t:Ep(t);let r=t,i=dp(r.ttlMs)?r.ttlMs:wp(n),a=fp(r.cacheScope)?r.cacheScope:Tp(n),o={...r,ttlMs:i,cacheScope:a};return delete o[lp],o}function Sp(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Cp(e,t){if(t===void 0)return e;let n=e._meta;return n===void 0?{...e,_meta:{[il]:t}}:!Sp(n)||n[`io.modelcontextprotocol/serverInfo`]!==void 0?e:{...e,_meta:{...n,[il]:t}}}function wp(e){return e!==void 0&&dp(e.ttlMs)?e.ttlMs:_p}function Tp(e){return e!==void 0&&fp(e.cacheScope)?e.cacheScope:vp}function Ep(e){let t={...e};return delete t[lp],t}var Dp=[`elicitation/create`,`sampling/createMessage`,`roots/list`],Op;function kp(){if(Op)return Op;let e=op();return Op={request:{"elicitation/create":R({method:U(`elicitation/create`),params:e.ElicitRequestParamsSchema}),"sampling/createMessage":R({method:U(`sampling/createMessage`),params:e.CreateMessageRequestParamsSchema}),"roots/list":R({method:U(`roots/list`),params:z({}).optional()})},response:{"elicitation/create":e.ElicitResultSchema,"sampling/createMessage":e.CreateMessageResultSchema,"roots/list":e.ListRootsResultSchema}},Op}function Ap(e){return Dp.includes(e)}function jp(e){return Ap(e)?kp().request[e]:void 0}function Mp(e){return Ap(e)?kp().response[e]:void 0}var Np={"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},Pp={"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 Fp(e){return Object.prototype.hasOwnProperty.call(Np,e)}function Ip(e){return Object.prototype.hasOwnProperty.call(Pp,e)}function Lp(e){return Object.prototype.hasOwnProperty.call(Np,e)}function Rp(e){return Fp(e)?op().dispatchRequestSchemas[e]:void 0}function zp(e){return Lp(e)?op().dispatchResultSchemas[e]:void 0}function Bp(e){return Ip(e)?op().notificationSchemas2026[e]:void 0}Object.keys(Np),Object.keys(Pp);function Vp(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Hp(e,t){if(e===void 0)return{ok:!1,reason:`not-in-era`};let n=e.safeParse(t);return n.success?{ok:!0,value:n.data}:{ok:!1,reason:`invalid`,message:String(n.error)}}var Up={ok:!1,reason:`not-in-era`},Wp=[nl,al];function Gp(e,t){let n=t,r=!1,i=()=>(r||=(n={...n},!0),n),a=t.tools;e===`tools/list`&&Array.isArray(a)&&a.some(e=>Vp(e)&&`execution`in e)&&(i().tools=a.map(e=>{if(!Vp(e)||!(`execution`in e))return e;let t={...e};return delete t.execution,t}));let o=t.capabilities;if(Vp(o)&&`tasks`in o){let e={...o};delete e.tasks,i().capabilities=e}return n}var Kp={era:`2026-07-28`,hasRequestMethod:Fp,hasNotificationMethod:Ip,hasInputRequestMethod:e=>jp(e)!==void 0,validateRequest:(e,t)=>Hp(Rp(e),t),validateResult:(e,t)=>Hp(zp(e),t),validateNotification:(e,t)=>Hp(Bp(e),t),validateInputRequest:(e,t)=>Hp(jp(e),t),validateInputResponse:(e,t)=>Hp(Mp(e),t),samplingResultVariant:()=>Up,outboundEnvelope(e){return{[nl]:e.protocolVersion,[rl]:e.clientInfo,[al]:e.clientCapabilities,...e.logLevel!==void 0&&{"io.modelcontextprotocol/logLevel":e.logLevel}}},validateEnvelopeMeta(e){let t=[];for(let n of Wp)n in e||t.push({key:n,problem:`missing`});let n=op().RequestMetaEnvelopeSchema.safeParse(e);if(!n.success)for(let e of n.error.issues){let n=e.path.map(String),r=n.length>0?n.join(`.`):`_meta`;n.length===1&&t.some(e=>e.key===r&&e.problem===`missing`)||t.push({key:r,problem:e.message})}return t},projectCallToolResult:e=>Af(e),inputRequestSchema:jp,decodeResult(e,t){if(!Vp(t))return{kind:`invalid`,error:new X(Df.InvalidResult,`Invalid result for ${e}: not an object`,{method:e})};let n=t.resultType;if(n===void 0)return{kind:`invalid`,error:new X(Df.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 n!=`string`)return{kind:`invalid`,error:new X(Df.InvalidResult,`Invalid result for ${e}: non-string resultType`,{method:e,resultType:n})};if(n===`input_required`){let n=t.inputRequests,r=Vp(n)?n:{},i=t.requestState;return Object.keys(r).length===0&&typeof i!=`string`?{kind:`invalid`,error:new X(Df.InvalidResult,`Invalid result for ${e}: input_required carries neither inputRequests nor requestState (every input_required result must include at least one of the two)`,{method:e,violation:`input-required-missing-both`})}:{kind:`input_required`,inputRequests:r,...typeof i==`string`&&{requestState:i}}}if(n!==`complete`)return{kind:`invalid`,error:new X(Df.UnsupportedResultType,`Unsupported result type '${n}' for ${e}`,{resultType:n,method:e})};let r=Jp(),i=Object.hasOwn(r,e)?r[e]:void 0;if(i!==void 0){let n=i.safeParse(t);if(!n.success)return{kind:`invalid`,error:new X(Df.InvalidResult,`Invalid result for ${e}: ${n.error}`,{method:e})}}let a={...t};return delete a.resultType,{kind:`complete`,result:a}},encodeResult(e,t,n){return Cp(xp(e,bp(e,Gp(e,t))),n)},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=op().RequestMetaEnvelopeSchema.safeParse(e.envelope);if(!t.success)return`Invalid _meta envelope for protocol revision 2026-07-28: ${t.error.issues.map(e=>e.message).join(`; `)}`}},qp;function Jp(){if(qp)return qp;let e=op();return qp={"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},qp}var Yp=`2026-07-28`;function Xp(e){return e!==void 0&&kf(e)?Kp:rp}function Zp(e){return e.revision===void 0?e.era===`modern`?Kp.era:rp.era:Xp(e.revision).era}function Qp(e){return em.some(t=>t.hasRequestMethod(e))}function $p(e){return em.some(t=>t.hasNotificationMethod(e))}var em=[rp,Kp],tm=n({AnnotationsSchema:()=>nu,AudioContentSchema:()=>Fu,BaseMetadataSchema:()=>jl,BaseRequestParamsSchema:()=>K,BlobResourceContentsSchema:()=>eu,BooleanSchemaSchema:()=>gd,CallToolRequestParamsSchema:()=>Xu,CallToolRequestSchema:()=>Zu,CallToolResultSchema:()=>Ju,CancelTaskRequestSchema:()=>nf,CancelTaskResultSchema:()=>rf,CancelledNotificationParamsSchema:()=>Dl,CancelledNotificationSchema:()=>Ol,ClientCapabilitiesSchema:()=>Il,ClientNotificationSchema:()=>of,ClientRequestSchema:()=>af,ClientResultSchema:()=>sf,ClientTasksCapabilitySchema:()=>Pl,CompatibilityCallToolResultSchema:()=>Yu,CompleteRequestParamsSchema:()=>Ld,CompleteRequestSchema:()=>Rd,CompleteResultSchema:()=>zd,ContentBlockSchema:()=>zu,CreateMessageRequestParamsSchema:()=>fd,CreateMessageRequestSchema:()=>pd,CreateMessageResultSchema:()=>md,CreateMessageResultWithToolsSchema:()=>hd,CreateTaskResultSchema:()=>qd,CursorSchema:()=>dl,DiscoverRequestSchema:()=>Hl,DiscoverResultSchema:()=>Ul,ElicitRequestFormParamsSchema:()=>Od,ElicitRequestParamsSchema:()=>Ad,ElicitRequestSchema:()=>jd,ElicitRequestURLParamsSchema:()=>kd,ElicitResultSchema:()=>Pd,ElicitationCompleteNotificationParamsSchema:()=>Md,ElicitationCompleteNotificationSchema:()=>Nd,EmbeddedResourceSchema:()=>Lu,EmptyResultSchema:()=>El,EnumSchemaSchema:()=>Ed,GetPromptRequestParamsSchema:()=>ju,GetPromptRequestSchema:()=>Mu,GetPromptResultSchema:()=>Vu,GetTaskPayloadRequestSchema:()=>Qd,GetTaskPayloadResultSchema:()=>$d,GetTaskRequestSchema:()=>Xd,GetTaskResultSchema:()=>Zd,IconSchema:()=>kl,IconsSchema:()=>Al,ImageContentSchema:()=>Pu,ImplementationSchema:()=>Ml,InitializeRequestParamsSchema:()=>Ll,InitializeRequestSchema:()=>Rl,InitializeResultSchema:()=>Bl,InitializedNotificationSchema:()=>Vl,JSONArraySchema:()=>ll,JSONObjectSchema:()=>G,JSONRPCErrorResponseSchema:()=>Cl,JSONRPCMessageSchema:()=>wl,JSONRPCNotificationSchema:()=>xl,JSONRPCRequestSchema:()=>bl,JSONRPCResponseSchema:()=>Tl,JSONRPCResultResponseSchema:()=>Sl,JSONValueSchema:()=>cl,LegacyTitledEnumSchemaSchema:()=>xd,ListChangedOptionsBaseSchema:()=>$u,ListPromptsRequestSchema:()=>ku,ListPromptsResultSchema:()=>Au,ListResourceTemplatesRequestSchema:()=>su,ListResourceTemplatesResultSchema:()=>cu,ListResourcesRequestSchema:()=>au,ListResourcesResultSchema:()=>ou,ListRootsRequestSchema:()=>Vd,ListRootsResultSchema:()=>Hd,ListTasksRequestSchema:()=>ef,ListTasksResultSchema:()=>tf,ListToolsRequestSchema:()=>Ku,ListToolsResultSchema:()=>qu,LoggingLevelSchema:()=>ed,LoggingMessageNotificationParamsSchema:()=>rd,LoggingMessageNotificationSchema:()=>id,ModelHintSchema:()=>ad,ModelPreferencesSchema:()=>od,MultiSelectEnumSchemaSchema:()=>Td,NotificationSchema:()=>_l,NotificationsParamsSchema:()=>gl,NumberSchemaSchema:()=>vd,PaginatedRequestParamsSchema:()=>Jl,PaginatedRequestSchema:()=>Yl,PaginatedResultSchema:()=>Xl,PingRequestSchema:()=>Wl,PrimitiveSchemaDefinitionSchema:()=>Dd,ProgressNotificationParamsSchema:()=>Kl,ProgressNotificationSchema:()=>ql,ProgressSchema:()=>Gl,ProgressTokenSchema:()=>ul,PromptArgumentSchema:()=>Du,PromptListChangedNotificationSchema:()=>Hu,PromptMessageSchema:()=>Bu,PromptReferenceSchema:()=>Id,PromptSchema:()=>Ou,ReadResourceRequestParamsSchema:()=>uu,ReadResourceRequestSchema:()=>du,ReadResourceResultSchema:()=>fu,RelatedTaskMetadataSchema:()=>pl,RequestIdSchema:()=>yl,RequestMetaSchema:()=>ml,RequestSchema:()=>q,ResourceContentsSchema:()=>Zl,ResourceLinkSchema:()=>Ru,ResourceListChangedNotificationSchema:()=>pu,ResourceRequestParamsSchema:()=>lu,ResourceSchema:()=>ru,ResourceTemplateReferenceSchema:()=>Fd,ResourceTemplateSchema:()=>iu,ResourceUpdatedNotificationParamsSchema:()=>Tu,ResourceUpdatedNotificationSchema:()=>Eu,ResultMetaObjectSchema:()=>vl,ResultSchema:()=>J,RoleSchema:()=>tu,RootSchema:()=>Bd,RootsListChangedNotificationSchema:()=>Ud,SamplingContentSchema:()=>ld,SamplingMessageContentBlockSchema:()=>ud,SamplingMessageSchema:()=>dd,ServerCapabilitiesSchema:()=>zl,ServerNotificationSchema:()=>lf,ServerRequestSchema:()=>cf,ServerResultSchema:()=>uf,ServerTasksCapabilitySchema:()=>Fl,SetLevelRequestParamsSchema:()=>td,SetLevelRequestSchema:()=>nd,SingleSelectEnumSchemaSchema:()=>Sd,StringSchemaSchema:()=>_d,SubscribeRequestParamsSchema:()=>mu,SubscribeRequestSchema:()=>hu,SubscriptionFilterSchema:()=>vu,SubscriptionsAcknowledgedNotificationParamsSchema:()=>xu,SubscriptionsAcknowledgedNotificationSchema:()=>Su,SubscriptionsListenRequestParamsSchema:()=>yu,SubscriptionsListenRequestSchema:()=>bu,SubscriptionsListenResultMetaSchema:()=>Cu,SubscriptionsListenResultSchema:()=>wu,TaskAugmentedRequestParamsSchema:()=>hl,TaskCreationParamsSchema:()=>Wd,TaskMetadataSchema:()=>fl,TaskSchema:()=>Kd,TaskStatusNotificationParamsSchema:()=>Jd,TaskStatusNotificationSchema:()=>Yd,TaskStatusSchema:()=>Gd,TextContentSchema:()=>Nu,TextResourceContentsSchema:()=>Ql,TitledMultiSelectEnumSchemaSchema:()=>wd,TitledSingleSelectEnumSchemaSchema:()=>bd,ToolAnnotationsSchema:()=>Uu,ToolChoiceSchema:()=>sd,ToolExecutionSchema:()=>Wu,ToolListChangedNotificationSchema:()=>Qu,ToolResultContentSchema:()=>cd,ToolSchema:()=>Gu,ToolUseContentSchema:()=>Iu,UnsubscribeRequestParamsSchema:()=>gu,UnsubscribeRequestSchema:()=>_u,UntitledMultiSelectEnumSchemaSchema:()=>Cd,UntitledSingleSelectEnumSchemaSchema:()=>yd}),nm=e=>bl.safeParse(e).success,rm=e=>xl.safeParse(e).success,im=e=>Sl.safeParse(e).success,am=e=>Cl.safeParse(e).success;Z.InvalidRequest,Z.UnsupportedProtocolVersion,Z.InvalidParams,Z.MethodNotFound,Z.InvalidParams,Z.MissingRequiredClientCapability,Z.ParseError,Z.InvalidRequest,Z.MethodNotFound,Z.UnsupportedProtocolVersion,Z.MissingRequiredClientCapability;function om(e,t){return hs(e,t)}function sm(e){return new Set(e.flatMap(e=>Object.keys(e.shape)))}function cm(e){if(e==null)return!1;let t=typeof e;return t!==`object`&&t!==`function`||!(`~standard`in e)?!1:typeof e[`~standard`]?.validate==`function`}var lm=!1,um=`draft-2020-12`;function dm(e,t=`input`){let n=e[`~standard`],r;if(n.jsonSchema)r=n.jsonSchema[t]({target:um});else if(n.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().`);lm||(lm=!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=ls(e,{target:um,io:t})}else throw Error(`Schema library "${n.vendor}" does not implement StandardJSONSchemaV1 (\`~standard.jsonSchema\`). Upgrade to a version that does, or wrap your JSON Schema with fromJsonSchema().`);if(t===`output`)return r.type===void 0&&fm(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 fm(e){if(`properties`in e||`patternProperties`in e||`additionalProperties`in e||`required`in e)return!0;for(let t of[`oneOf`,`anyOf`,`allOf`]){let n=e[t];if(Array.isArray(n)&&n.length>0)return n.every(e=>typeof e==`object`&&!!e&&(e.type===`object`||fm(e)))}return!1}function pm(e){return e.path?.length?`${e.path.map(e=>String(typeof e==`object`?e.key:e)).join(`.`)}: ${e.message}`:e.message}async function mm(e,t){let n=await e[`~standard`].validate(t);return n.issues&&n.issues.length>0?{success:!1,error:n.issues.map(e=>pm(e)).join(`, `)}:{success:!0,data:n.value}}function hm(e){let t=ls(e,{target:um,io:`input`});return typeof t.pattern==`string`?t.pattern:void 0}var gm=/\\\.\\d\{(\d+)\}/;function _m(e){let t=gm.exec(e),n=[void 0,-1,0];return t&&n.push(Number(t[1])),[!1,!0].flatMap(e=>[!1,!0].flatMap(t=>n.map(n=>Zc({local:e,offset:t,precision:n}))))}function vm(e,t){let n;switch(e){case`email`:n=[Ps()];break;case`uri`:n=[Rs()];break;case`date`:n=[Qc()];break;case`date-time`:n=_m(t)}return new Set(n.map(e=>hm(e)).filter(e=>e!==void 0))}function ym(e,t,n){return n!==`zod`||vm(e,t).has(t)}function bm(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function xm(e){try{return dm(e,`input`)}catch(e){let t=e instanceof Error?e.message:String(e);throw new Q(Z.InvalidParams,`Elicitation requestedSchema must describe an object with flat primitive properties: ${t}`)}}var Sm=new Set([`$comment`,`deprecated`,`description`,`examples`,`readOnly`,`title`,`writeOnly`]);function Cm(e){return Sm.has(e)||e.startsWith(`x-`)}var wm=new Set([`$schema`,...Object.keys(Od.shape.requestedSchema.shape)]),Tm={string:sm([_d,yd,bd,xd]),number:sm([vd]),integer:sm([vd]),boolean:sm([gd]),array:sm([Cd,wd])},Em=new Set(_d.shape.format.unwrap().options);function Dm(e,t,n,r){if(!bm(e))return e;let i=typeof e.type==`string`&&Object.hasOwn(Tm,e.type)?Tm[e.type]:void 0;if(i===void 0)return e;let a={};for(let[o,s]of Object.entries(e))i.has(o)||Cm(o)?a[o]=s:o===`pattern`&&e.type===`string`&&typeof e.format==`string`?Em.has(e.format)?(typeof s!=`string`||!ym(e.format,s,n))&&r.push(`${t}.${o}`):a[o]=s:r.push(`${t}.${o}`);return a}function Om(e,t){let n={},r=[];for(let[i,a]of Object.entries(e))i===`properties`&&bm(a)?n[i]=Object.fromEntries(Object.entries(a).map(([e,n])=>[e,Dm(n,`properties.${e}`,t,r)])):wm.has(i)?n[i]=a:Cm(i)||r.push(i);if(r.length>0)throw new Q(Z.InvalidParams,`Elicitation requestedSchema contains unsupported JSON Schema constraint(s) after Standard Schema conversion: ${r.join(`, `)}`);return n}function km(e,t){if(!bm(e.properties))return t;let n=Object.entries(e.properties).filter(([,e])=>!om(Dd,e).success).map(([e])=>`properties.${e}`);return n.length>0?n.join(`, `):t}function Am(e,t,n=``){return Array.isArray(e)&&Array.isArray(t)?e.flatMap((e,r)=>Am(e,t[r],`${n}[${r}]`)):!bm(e)||!bm(t)?[]:Object.entries(e).flatMap(([e,r])=>{let i=n?`${n}.${e}`:e;return Object.prototype.hasOwnProperty.call(t,e)?Am(r,t[e],i):Cm(e)?[]:[i]})}function jm(e){if(!cm(e.requestedSchema))return{...e,mode:`form`,requestedSchema:e.requestedSchema};let t=e.requestedSchema[`~standard`].vendor,n=Om(xm(e.requestedSchema),t),r=om(Od.shape.requestedSchema,n);if(!r.success)throw new Q(Z.InvalidParams,`Elicitation requestedSchema only supports flat primitive properties (string, number, integer, boolean, and string enums): ${km(n,r.error.message)}`);let i=Am(n,r.data);if(i.length>0)throw new Q(Z.InvalidParams,`Elicitation requestedSchema contains unsupported JSON Schema constraint(s) after Standard Schema conversion: ${i.join(`, `)}`);let a=(r.data.required??[]).filter(e=>!Object.prototype.hasOwnProperty.call(r.data.properties,e));if(a.length>0)throw new Q(Z.InvalidParams,`Elicitation requestedSchema lists required properties that are not defined in properties: ${a.join(`, `)}`);return{...e,mode:`form`,requestedSchema:r.data}}function Mm(e){let t=e.inputRequests!==void 0&&Object.keys(e.inputRequests).length>0,n=typeof e.requestState==`string`;if(!t&&!n)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}}}Object.assign(Mm,{elicit(e){try{return{method:`elicitation/create`,params:jm(e)}}catch(e){throw e instanceof Q?TypeError(e.message,{cause:e}):e}},elicitUrl(e){return{method:`elicitation/create`,params:{...e,mode:`url`}}},createMessage(e){return{method:`sampling/createMessage`,params:e}},listRoots(){return{method:`roots/list`}}});var Nm=`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`.split(`.`),Pm={IdJagTokenExchangeResponseSchema:gf,OAuthClientInformationFullSchema:xf,OAuthClientInformationSchema:bf,OAuthClientMetadataSchema:yf,OAuthClientRegistrationErrorSchema:Sf,OAuthErrorResponseSchema:_f,OAuthMetadataSchema:ff,OAuthProtectedResourceMetadataSchema:df,OAuthTokenRevocationRequestSchema:Cf,OAuthTokensSchema:hf,OpenIdProviderDiscoveryMetadataSchema:mf,OpenIdProviderMetadataSchema:pf},Fm={},Im={};function Lm(e,t){let n=e.slice(0,-6);Fm[n]=t,Im[n]=e=>t.safeParse(e).success}for(let e of Nm)Lm(e,tm[e]);for(let[e,t]of Object.entries(Pm))Lm(e,t);Object.freeze(Fm),Object.freeze(Im);function Rm(e){switch(e){case`initialize`:case`notifications/initialized`:return Xp(void 0);case`server/discover`:return Xp(Yp);default:return}}var zm=[nl,rl,al,sl],Bm=[`inputResponses`,`requestState`];function Vm(e,t){let n=e.params;if(!Km(n))return{message:e,lifted:{}};let r=n._meta,i=Km(r)?zm.filter(e=>e in r):[],a=t===`request`?Bm.filter(e=>e in n):[];if(i.length===0&&a.length===0)return{message:e,lifted:{}};let o={},s={...n};if(i.length>0&&Km(r)){let e={},t={...r};for(let n of i)e[n]=r[n],delete t[n];o.envelope=e,Object.keys(t).length>0?s._meta=t:delete s._meta}for(let e of a)e===`inputResponses`&&(o.inputResponses=s[e]),e===`requestState`&&(o.requestState=s[e]),delete s[e];return{message:{...e,params:s},lifted:o}}function Hm(e,t){let n=e.validateResult(t,void 0);if(n.ok||n.reason!==`not-in-era`)return{"~standard":{version:1,vendor:`mcp-wire-codec`,validate(n){let r=e.validateResult(t,n);return r.ok?{value:r.value}:{issues:[{message:r.reason===`invalid`?r.message:`not-in-era: ${t}`}]}}}}}function Um(e){return()=>e}var Wm=Um(void 0),Gm=class{_transport;_requestMessageId=0;_requestHandlers=new Map;_requestHandlerAbortControllers=new Map;_notificationHandlers=new Map;_responseHandlers=new Map;_progressHandlers=new Map;_timeoutInfo=new Map;_pendingDebouncedNotifications=new Set;_negotiatedProtocolVersion;_supportedProtocolVersions;onclose;onerror;fallbackRequestHandler;fallbackNotificationHandler;constructor(e){this._options=e,this._supportedProtocolVersions=e?.supportedProtocolVersions??el,this.setNotificationHandler(`notifications/cancelled`,e=>{this._oncancel(e)}),this.setNotificationHandler(`notifications/progress`,e=>{this._onprogress(e)}),this.setRequestHandler(`ping`,e=>({}))}_shouldDropInbound(e){}_outboundMetaEnvelope(){}_envelopeOutbound(e){let t=this._outboundMetaEnvelope();if(t===void 0)return e;let n=e.params??{};return{...e,params:{...n,_meta:{...t,...n._meta}}}}_resolveNonCompleteResult(e,t){return Promise.reject(new X(Df.UnsupportedResultType,`Unsupported result type '${e.kind}' for ${t.request.method}`,{resultType:e.kind,method:t.request.method}))}_getRequestHandler(e){return this._requestHandlers.get(e)}async _oncancel(e){e.params.requestId&&this._requestHandlerAbortControllers.get(e.params.requestId)?.abort(e.params.reason)}_setupTimeout(e,t,n,r,i=!1){this._timeoutInfo.set(e,{timeoutId:setTimeout(r,t),startTime:Date.now(),timeout:t,maxTotalTimeout:n,resetTimeoutOnProgress:i,onTimeout:r})}_resetTimeout(e){let t=this._timeoutInfo.get(e);if(!t)return!1;let n=Date.now()-t.startTime;if(t.maxTotalTimeout&&n>=t.maxTotalTimeout)throw this._timeoutInfo.delete(e),new X(Df.RequestTimeout,`Maximum total timeout exceeded`,{maxTotalTimeout:t.maxTotalTimeout,totalElapsed:n});return clearTimeout(t.timeoutId),t.timeoutId=setTimeout(t.onTimeout,t.timeout),!0}_cleanupTimeout(e){let t=this._timeoutInfo.get(e);t&&(clearTimeout(t.timeoutId),this._timeoutInfo.delete(e))}async connect(e){this._transport=e;let t=this.transport?.onclose;this._transport.onclose=()=>{try{t?.()}finally{this._onclose()}};let n=this.transport?.onerror;this._transport.onerror=e=>{n?.(e),this._onerror(e)};let r=this._transport?.onmessage;this._transport.onmessage=(e,t)=>{r?.(e,t),im(e)||am(e)?this._onresponse(e):nm(e)?this._onrequest(e,t):rm(e)?this._onnotification(e,t):this._onerror(Error(`Unknown message type: ${JSON.stringify(e)}`))},e.setSupportedProtocolVersions?.(this._supportedProtocolVersions),await this._transport.start()}_onclose(){let e=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._pendingDebouncedNotifications.clear();for(let e of this._timeoutInfo.values())clearTimeout(e.timeoutId);this._timeoutInfo.clear();let t=this._requestHandlerAbortControllers;this._requestHandlerAbortControllers=new Map;let n=new X(Df.ConnectionClosed,`Connection closed`);this._transport=void 0;try{this.onclose?.()}finally{for(let t of e.values())t(n);for(let e of t.values())e.abort(n)}}_onerror(e){this.onerror?.(e)}_onnotification(e,t){let{message:n}=Vm(e,`notification`),r=this._negotiatedWireCodec();if(t?.classification===void 0&&this._shouldDropInbound(e)===`drop`)return;if(t?.classification!==void 0){let e=Zp(t.classification);if(e!==r.era){this._onerror(Error(`Era mismatch on inbound notification '${n.method}': classified as ${e} but this instance serves ${r.era}`));return}}if($p(n.method)&&!r.hasNotificationMethod(n.method))return;let i=this._notificationHandlers.get(n.method),a=this.fallbackNotificationHandler;(i!==void 0||a!==void 0)&&Promise.resolve().then(()=>i===void 0?a(n):i(n,r)).catch(e=>this._onerror(Error(`Uncaught error in notification handler: ${e}`)))}_onrequest(e,t){let{message:n,lifted:r}=Vm(e,`request`),i=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 a=this._transport,o=(e,t,r)=>{let i={jsonrpc:`2.0`,id:n.id,error:{code:e,message:t,...r!==void 0&&{data:r}}};a?.send(i).catch(e=>this._onerror(Error(`Failed to send an error response: ${e}`)))};if(t?.classification!==void 0){let e=Zp(t.classification);if(e!==i.era){this._onerror(Error(`Era mismatch on inbound request '${n.method}': classified as ${e} but this instance serves ${i.era}`));let r=t.classification.revision??e;o(Z.UnsupportedProtocolVersion,`Unsupported protocol version: ${r}`,{supported:this._supportedProtocolVersions,requested:r});return}}if(Qp(n.method)&&!i.hasRequestMethod(n.method)){o(Z.MethodNotFound,`Method not found`);return}let s=this._requestHandlers.get(n.method)??this.fallbackRequestHandler;if(s===void 0){o(Z.MethodNotFound,`Method not found`);return}let c=i.checkInboundEnvelope(r);if(c!==void 0){o(Z.InvalidParams,c);return}let l=(e,t)=>this._notificationViaCodec(this._resolveOutboundCodec(e.method),e,{...t,relatedRequestId:n.id}),u=(e,t,r)=>this._requestWithSchemaViaCodec(this._resolveOutboundCodec(e.method),e,t,{...r,relatedRequestId:n.id}),d=new AbortController;this._requestHandlerAbortControllers.set(n.id,d);let f=r.inputResponses===void 0?void 0:Jm(r.inputResponses),p={sessionId:a?.sessionId,mcpReq:{id:n.id,method:n.method,_meta:n.params?._meta,...r.envelope!==void 0&&{envelope:r.envelope},...f!==void 0&&{inputResponses:f.accepted},...f!==void 0&&f.droppedKeys.length>0&&{droppedInputResponseKeys:f.droppedKeys},requestState:r.requestState===void 0?Wm:Um(r.requestState),signal:d.signal,send:((e,t,n)=>{let r=this._resolveOutboundCodec(e.method);if(this._assertOutboundRequestInEra(r,e.method),cm(t))return u(e,t,n);let i=Hm(r,e.method);if(i===void 0)throw TypeError(`'${e.method}' is not a spec method; pass a result schema as the second argument to ctx.mcpReq.send().`);return u(e,i,t)}),notify:l},http:t?.authInfo?{authInfo:t.authInfo}:void 0},m=this.buildContext(p,t);Promise.resolve().then(()=>s(n,m)).then(async e=>{if(d.signal.aborted)return;let t;try{t=i.encodeResult(n.method,e,this._outboundServerInfo())}catch(e){this._onerror(Error(`Failed to encode result for ${n.method}: ${e}`)),o(Z.InternalError,`Internal error`);return}let r={result:t,jsonrpc:`2.0`,id:n.id};await a?.send(r)},async e=>{if(d.signal.aborted)return;let t=Number.isSafeInteger(e.code)?e.code:Z.InternalError,r={jsonrpc:`2.0`,id:n.id,error:{code:i.encodeErrorCode(t),message:e.message??`Internal error`,...e.data!==void 0&&{data:e.data}}};await a?.send(r)}).catch(e=>this._onerror(Error(`Failed to send response: ${e}`))).finally(()=>{this._requestHandlerAbortControllers.get(n.id)===d&&this._requestHandlerAbortControllers.delete(n.id)})}_onprogress(e){let{progressToken:t,...n}=e.params,r=Number(t),i=this._progressHandlers.get(r);if(!i){this._onerror(Error(`Received a progress notification for an unknown token: ${JSON.stringify(e)}`));return}let a=this._responseHandlers.get(r),o=this._timeoutInfo.get(r);if(o&&a&&o.resetTimeoutOnProgress)try{this._resetTimeout(r)}catch(e){this._responseHandlers.delete(r),this._progressHandlers.delete(r),this._cleanupTimeout(r),a(e);return}i(n)}_onresponse(e){let t=Number(e.id),n=this._responseHandlers.get(t);if(n===void 0){this._onerror(Error(`Received a response for an unknown message ID: ${JSON.stringify(e)}`));return}this._responseHandlers.delete(t),this._cleanupTimeout(t),this._progressHandlers.delete(t),im(e)?n(e):n(Q.fromError(e.error.code,e.error.message,e.error.data))}get transport(){return this._transport}async close(){await this._transport?.close()}request(e,t,n){let r=this._resolveOutboundCodec(e.method);if(this._assertOutboundRequestInEra(r,e.method),cm(t))return this._requestWithSchemaViaCodec(r,e,t,n);let i=Hm(r,e.method);if(i===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,i,t)}_negotiatedWireCodec(){return Xp(this._negotiatedProtocolVersion)}_wireCodec(){return this._negotiatedWireCodec()}_resolveOutboundCodec(e){if(this._negotiatedProtocolVersion===void 0){let t=Rm(e);if(t)return t}return this._negotiatedWireCodec()}_assertOutboundRequestInEra(e,t){if(Qp(t)&&!e.hasRequestMethod(t))throw new X(Df.MethodNotSupportedByProtocolVersion,`Method '${t}' is not supported by the negotiated protocol version (wire era ${e.era})`,{method:t,era:e.era})}_requestWithSchema(e,t,n){let r=this._resolveOutboundCodec(e.method);return this._assertOutboundRequestInEra(r,e.method),this._requestWithSchemaViaCodec(r,e,t,n)}_requestWithSchemaViaCodec(e,t,n,r){let{relatedRequestId:i,resumptionToken:a,onresumptiontoken:o,headers:s}=r??{},c=Date.now(),l,u;return new Promise((d,f)=>{let p=e=>{f(e)};if(!this._transport){p(Error(`Not connected`));return}if(this._options?.enforceStrictCapabilities===!0)try{this.assertCapabilityForMethod(t.method)}catch(e){p(e);return}if(r?.signal?.aborted){let e=r.signal.reason;throw e instanceof X?e:new X(Df.RequestTimeout,String(e))}let m=e.era===`2026-07-28`&&this._transport.hasPerRequestStream===!0?new AbortController:void 0,h=this._requestMessageId++;u=h;let ee={...t,jsonrpc:`2.0`,id:h};r?.onprogress&&(this._progressHandlers.set(h,r.onprogress),ee.params={...t.params,_meta:{...t.params?._meta,progressToken:h}});let g=this._envelopeOutbound(ee),te=!1,ne=e=>{te||(this._progressHandlers.delete(h),m===void 0?this._transport?.send(this._envelopeOutbound({jsonrpc:`2.0`,method:`notifications/cancelled`,params:{requestId:h,reason:String(e)}}),{relatedRequestId:i,resumptionToken:a,onresumptiontoken:o}).catch(e=>this._onerror(Error(`Failed to send cancellation: ${e}`))):m.abort(),f(e instanceof X?e:new X(Df.RequestTimeout,String(e))))};this._responseHandlers.set(h,i=>{if(r?.signal?.aborted)return;if(te=!0,i instanceof Error)return f(i);let a;try{a=e.decodeResult(t.method,i.result)}catch(e){return f(e instanceof Error?e:Error(String(e)))}if(a.kind===`invalid`)return f(a.error);if(a.kind===`input_required`){if(r?.allowInputRequired===!0)return d(Ym(a));let i={codec:e,request:t,resultSchema:n,options:r,flowStartedAt:c,retry:(r,i)=>this._requestWithSchemaViaCodec(e,r===void 0?{method:t.method}:{method:t.method,params:r},n,i)};return d(this._resolveNonCompleteResult(a,i))}let o=a.result;mm(n,o).then(e=>{e.success?d(e.data):f(new X(Df.InvalidResult,`Invalid result for ${t.method}: ${e.error}`))},f)}),l=()=>ne(r?.signal?.reason),r?.signal?.addEventListener(`abort`,l,{once:!0});let re=r?.timeout??6e4;this._setupTimeout(h,re,r?.maxTotalTimeout,()=>ne(new X(Df.RequestTimeout,`Request timed out`,{timeout:re})),r?.resetTimeoutOnProgress??!1),this._transport.send(g,{relatedRequestId:i,resumptionToken:a,onresumptiontoken:o,headers:s,requestSignal:m?.signal}).catch(e=>{this._progressHandlers.delete(h),f(e)})}).finally(()=>{l&&r?.signal?.removeEventListener(`abort`,l),u!==void 0&&(this._responseHandlers.delete(u),this._cleanupTimeout(u))})}async notification(e,t){return this._notificationViaCodec(this._resolveOutboundCodec(e.method),e,t)}async _notificationViaCodec(e,t,n){if(!this._transport)throw new X(Df.NotConnected,`Not connected`);if($p(t.method)&&!e.hasNotificationMethod(t.method))throw new X(Df.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&&!n?.relatedRequestId){if(this._pendingDebouncedNotifications.has(t.method))return;this._pendingDebouncedNotifications.add(t.method),Promise.resolve().then(()=>{this._pendingDebouncedNotifications.delete(t.method),this._transport&&this._transport?.send(r,n).catch(e=>this._onerror(e))});return}await this._transport.send(r,n)}setRequestHandler(e,t,n){this.assertRequestHandlerCapability(e);let r;if(typeof t==`function`){if(!Qp(e))throw TypeError(`'${e}' is not a spec request method; pass schemas as the second argument to setRequestHandler().`);r=(n,r)=>{let i=this._negotiatedWireCodec(),a=i.validateRequest(e,n);if(!a.ok&&a.reason===`not-in-era`&&(a=i.validateInputRequest(e,n)),!a.ok)throw a.reason===`not-in-era`?new Q(Z.InternalError,`No wire schema for ${e} in the resolved era`):Error(a.message);return Promise.resolve(t(a.value,r))}}else if(n)r=async(r,i)=>{let a=await mm(t.params,{...r.params});if(!a.success)throw new Q(Z.InvalidParams,`Invalid params for ${e}: ${a.error}`);return n(a.data,i)};else throw TypeError(`setRequestHandler: handler is required`);this._requestHandlers.set(e,this._wrapHandler(e,r))}_wrapHandler(e,t){return t}_outboundServerInfo(){}removeRequestHandler(e){this._requestHandlers.delete(e)}assertCanSetRequestHandler(e){if(this._requestHandlers.has(e))throw Error(`A request handler for ${e} already exists, which would be overridden`)}setNotificationHandler(e,t,n){if(typeof t==`function`){if(!$p(e))throw TypeError(`'${e}' is not a spec notification method; pass schemas as the second argument to setNotificationHandler().`);this._notificationHandlers.set(e,(n,r)=>{let i=r.validateNotification(e,n);if(!i.ok)throw i.reason===`not-in-era`?new Q(Z.InternalError,`No wire schema for ${e} in the resolved era`):Error(i.message);return Promise.resolve(t(i.value))});return}if(!n)throw TypeError(`setNotificationHandler: handler is required`);this._notificationHandlers.set(e,async r=>{let i=await mm(t.params,{...r.params});if(!i.success)throw new Q(Z.InvalidParams,`Invalid params for notification ${e}: ${i.error}`);await n(i.data,r)})}removeNotificationHandler(e){this._notificationHandlers.delete(e)}};function Km(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function qm(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Jm(e){let t={},n=[];if(!qm(e))return{accepted:t,droppedKeys:n};for(let[r,i]of Object.entries(e)){if(!qm(i)||`method`in i||`result`in i){n.push(r);continue}t[r]=i}return{accepted:t,droppedKeys:n}}function Ym(e){return{resultType:`input_required`,inputRequests:e.inputRequests,...e.requestState!==void 0&&{requestState:e.requestState}}}t((e=>{var t=/; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g,n=/\\([\u000b\u0020-\u00ff])/g,r=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;e.parse=i;function i(e){if(!e)throw TypeError(`argument string is required`);var i=typeof e==`object`?a(e):e;if(typeof i!=`string`)throw TypeError(`argument string is required to be a string`);var s=i.indexOf(`;`),c=s===-1?i.trim():i.slice(0,s).trim();if(!r.test(c))throw TypeError(`invalid media type`);var l=new o(c.toLowerCase());if(s!==-1){var u,d,f;for(t.lastIndex=s;d=t.exec(i);){if(d.index!==s)throw TypeError(`invalid parameter format`);s+=d[0].length,u=d[1].toLowerCase(),f=d[2],f.charCodeAt(0)===34&&(f=f.slice(1,-1),f.indexOf(`\\`)!==-1&&(f=f.replace(n,`$1`))),l.parameters[u]=f}if(s!==i.length)throw TypeError(`invalid parameter format`)}return l}function a(e){var t;if(typeof e.getHeader==`function`?t=e.getHeader(`content-type`):typeof e.headers==`object`&&(t=e.headers&&e.headers[`content-type`]),typeof t!=`string`)throw TypeError(`content-type header is missing from object`);return t}function o(e){this.parameters=Object.create(null),this.type=e}}))(),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 Xm=/^(\d\d):(\d\d):(\d\d)(\.\d+)?(z|[+-]\d\d(?::?\d\d)?)?$/i,Zm=/^(?=.{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,Qm=/^(?:[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,$m=/^(?:(?:[^\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,eh=/^(?:(?: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,th=/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,nh=/^(?:\/(?:[^~/]|~0|~1)*)*$/,rh=/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,ih=/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,ah=/^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/,oh=/^((([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;function sh(e){return e.test.bind(e)}ch.bind(void 0,!1),sh(Qm),sh($m),sh(eh),sh(Zm),sh(ah),sh(oh),sh(th),sh(nh),sh(rh),sh(ih);function ch(e,t){let n=t.match(Xm);if(!n)return!1;let r=+n[1],i=+n[2],a=+n[3],o=!!n[5];return(r<=23&&i<=59&&a<=59||r==23&&i==59&&a==60)&&(!e||o)}globalThis.crypto;var lh=class extends Error{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.OAuthClientFlowError`})}static[Symbol.hasInstance](e){return Ef(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 Ef(this,e)}constructor(e){super(e),this.name=new.target.name,Tf(this,new.target)}};(class extends lh{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.IssuerMismatchError`})}kind;expected;received;constructor(e,t,n){super(`Issuer mismatch in ${e===`metadata`?`authorization server metadata (RFC 8414 §3.3)`:`authorization response (RFC 9207)`}: expected ${JSON.stringify(t)}, received ${JSON.stringify(n)}`),this.kind=e,this.expected=t,this.received=n}}),class extends lh{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}},class extends lh{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.InsecureTokenEndpointError`})}tokenEndpoint;constructor(e){super(`Refusing to send credentials to non-https token endpoint '${e}'. OAuth token requests MUST use TLS (localhost / 127.0.0.1 / ::1 are exempt).`),this.tokenEndpoint=e}},class extends lh{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.AuthorizationServerMismatchError`})}constructor(e,t){super(`Authorization server changed between redirect and callback (redirected to ${JSON.stringify(e)}, callback resolved ${JSON.stringify(t)}); refusing to send authorization_code/code_verifier to a different token endpoint`),this.recordedIssuer=e,this.currentIssuer=t}},class extends lh{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}},class extends Error{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.UnauthorizedError`})}static[Symbol.hasInstance](e){return Ef(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 Ef(this,e)}constructor(e){super(e??`Unauthorized`),this.name=`UnauthorizedError`,Tf(this,new.target)}},class extends Error{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.SseError`})}static[Symbol.hasInstance](e){return Ef(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 Ef(this,e)}constructor(e,t,n){super(`SSE error: ${t}`),this.code=e,this.event=n,Tf(this,new.target)}};var uh=class{_eventSlots=new Map;setHandler(e,t){let n=this._ensureEventSlot(e);n.onHandler&&t&&console.warn(`[MCP Apps] on${String(e)} handler replaced. Use addEventListener("${String(e)}", …) to add multiple listeners without replacing.`),n.onHandler=t}getHandler(e){return this._eventSlots.get(e)?.onHandler}addEventListener(e,t){this._ensureEventSlot(e).listeners.push(t)}removeEventListener(e,t){let n=this._eventSlots.get(e);if(!n)return;let r=n.listeners.indexOf(t);r!==-1&&n.listeners.splice(r,1)}dispatch(e,t){let n=this._eventSlots.get(e);if(n){n.onHandler?.(t);for(let e of[...n.listeners])e(t)}}_ensureEventSlot(e){let t=this._eventSlots.get(e);return t||(t={listeners:[]},this._eventSlots.set(e,t)),t}},dh=class{_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)}},fh=new Set;function ph(e,t){let[n,r]=t,i=n?.shape;if(typeof i?.method?.value!=`string`)return;let a=i.method.value,o=e===`request`?`setRequestHandler`:`setNotificationHandler`;fh.has(o)||(fh.add(o),console.warn(`[ext-apps] ${o}(Schema, handler) is deprecated; use ${o}("${a}", { params: Schema.shape.params }, handler).`));let s=r;return[a,{params:i.params},e===`request`?(e,t)=>s({method:a,params:e},mh(t)):e=>s({method:a,params:e})]}function mh(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 hh=`2026-01-26`,gh=class{eventTarget;eventSource;messageListener;constructor(e=window.parent,t){this.eventTarget=e,this.eventSource=t,this.messageListener=e=>{if(t&&e.source!==this.eventSource){console.debug(`Ignoring message from unknown source`,e);return}let n=wl.safeParse(e.data);n.success?(console.debug(`Parsed message`,n.data),this.onmessage?.(n.data)):e.data?.jsonrpc===`2.0`?(console.error(`Failed to parse message`,n.error.message,e),this.onerror?.(Error(`Invalid JSON-RPC message received: `+n.error.message))):console.debug(`Ignoring non-JSON-RPC message`,n.error.message,e)}}async start(){window.addEventListener(`message`,this.messageListener)}async send(e,t){e.method!==`ui/notifications/tool-input-partial`&&console.debug(`Sending message`,e),this.eventTarget.postMessage(e,`*`)}async close(){window.removeEventListener(`message`,this.messageListener),this.onclose?.()}onclose;onerror;onmessage;sessionId;setProtocolVersion},_h=B([U(`light`),U(`dark`)]).describe(`Color theme preference for the host environment.`),vh=B([U(`inline`),U(`fullscreen`),U(`pip`)]).describe(`Display mode for UI presentation.`),yh=V(B([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.`).describe(`Style variables for theming MCP apps.
59
64
 
60
65
  Individual style keys are optional - hosts may provide any subset of these values.
61
66
  Values are strings containing CSS values (colors, sizes, font stacks, etc.).
62
67
 
63
68
  Note: This type uses \`Record<K, string | undefined>\` rather than \`Partial<Record<K, string>>\`
64
- for compatibility with Zod schema generation. Both are functionally equivalent for validation.`),z([j(),Ss()]).describe(`Style variables for theming MCP apps.
69
+ for compatibility with Zod schema generation. Both are functionally equivalent for validation.`),B([M(),ac()]).describe(`Style variables for theming MCP apps.
65
70
 
66
71
  Individual style keys are optional - hosts may provide any subset of these values.
67
72
  Values are strings containing CSS values (colors, sizes, font stacks, etc.).
@@ -73,18 +78,18 @@ Individual style keys are optional - hosts may provide any subset of these value
73
78
  Values are strings containing CSS values (colors, sizes, font stacks, etc.).
74
79
 
75
80
  Note: This type uses \`Record<K, string | undefined>\` rather than \`Partial<Record<K, string>>\`
76
- for compatibility with Zod schema generation. Both are functionally equivalent for validation.`);L({method:H(`ui/open-link`),params:L({url:j().describe(`URL to open in the host's browser`)})});var Im=L({isError:P().optional().describe(`True if the host failed to open the URL (e.g., due to security policy).`)}).passthrough(),Lm=L({isError:P().optional().describe(`True if the download failed (e.g., user cancelled or host denied).`)}).passthrough(),Rm=L({isError:P().optional().describe(`True if the host rejected or failed to deliver the message.`)}).passthrough();L({method:H(`ui/notifications/sandbox-proxy-ready`),params:L({})});var zm=L({connectDomains:I(j()).optional().describe(`Origins for network requests (fetch/XHR/WebSocket).
81
+ for compatibility with Zod schema generation. Both are functionally equivalent for validation.`);R({method:U(`ui/open-link`),params:R({url:M().describe(`URL to open in the host's browser`)})});var bh=R({isError:F().optional().describe(`True if the host failed to open the URL (e.g., due to security policy).`)}).passthrough(),xh=R({isError:F().optional().describe(`True if the download failed (e.g., user cancelled or host denied).`)}).passthrough(),Sh=R({isError:F().optional().describe(`True if the host rejected or failed to deliver the message.`)}).passthrough();R({method:U(`ui/notifications/sandbox-proxy-ready`),params:R({})});var Ch=R({connectDomains:L(M()).optional().describe(`Origins for network requests (fetch/XHR/WebSocket).
77
82
 
78
83
  - Maps to CSP \`connect-src\` directive
79
- - Empty or omitted → no network connections (secure default)`),resourceDomains:I(j()).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:I(j()).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:I(j()).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'`)")}),Bm=L({camera:L({}).optional().describe(`Request camera access.
84
+ - Empty or omitted → no network connections (secure default)`),resourceDomains:L(M()).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:L(M()).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:L(M()).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'`)")}),wh=R({camera:R({}).optional().describe(`Request camera access.
80
85
 
81
- Maps to Permission Policy \`camera\` feature.`),microphone:L({}).optional().describe(`Request microphone access.
86
+ Maps to Permission Policy \`camera\` feature.`),microphone:R({}).optional().describe(`Request microphone access.
82
87
 
83
- Maps to Permission Policy \`microphone\` feature.`),geolocation:L({}).optional().describe(`Request geolocation access.
88
+ Maps to Permission Policy \`microphone\` feature.`),geolocation:R({}).optional().describe(`Request geolocation access.
84
89
 
85
- Maps to Permission Policy \`geolocation\` feature.`),clipboardWrite:L({}).optional().describe(`Request clipboard write access.
90
+ Maps to Permission Policy \`geolocation\` feature.`),clipboardWrite:R({}).optional().describe(`Request clipboard write access.
86
91
 
87
- Maps to Permission Policy \`clipboard-write\` feature.`)});L({method:H(`ui/notifications/size-changed`),params:L({width:N().optional().describe(`New width in pixels.`),height:N().optional().describe(`New height in pixels.`)})});var Vm=L({method:H(`ui/notifications/tool-input`),params:L({arguments:B(j(),F().describe(`Complete tool call arguments as key-value pairs.`)).optional().describe(`Complete tool call arguments as key-value pairs.`)})}),Hm=L({method:H(`ui/notifications/tool-input-partial`),params:L({arguments:B(j(),F().describe(`Partial tool call arguments (incomplete, may change).`)).optional().describe(`Partial tool call arguments (incomplete, may change).`)})}),Um=L({method:H(`ui/notifications/tool-cancelled`),params:L({reason:j().optional().describe(`Optional reason for the cancellation (e.g., "user action", "timeout").`)})}),Wm=L({fonts:j().optional()}),Gm=L({variables:Fm.optional().describe(`CSS variables for theming the app.`),css:Wm.optional().describe(`CSS blocks that apps can inject.`)}),Km=L({method:H(`ui/resource-teardown`),params:L({})}),qm=B(j(),F()),Jm=L({text:L({}).optional().describe(`Host supports text content blocks.`),image:L({}).optional().describe(`Host supports image content blocks.`),audio:L({}).optional().describe(`Host supports audio content blocks.`),resource:L({}).optional().describe(`Host supports resource content blocks.`),resourceLink:L({}).optional().describe(`Host supports resource link content blocks.`),structuredContent:L({}).optional().describe(`Host supports structured content.`)});L({method:H(`ui/notifications/request-teardown`),params:L({}).optional()});var Ym=L({experimental:B(j(),B(j(),Es()).describe(`Experimental features keyed by identifier.`)).optional().describe(`Experimental features keyed by identifier.`),openLinks:L({}).optional().describe(`Host supports opening external URLs.`),downloadFile:L({}).optional().describe(`Host supports file downloads via ui/download-file.`),serverTools:L({listChanged:P().optional().describe(`Host supports tools/list_changed notifications.`)}).optional().describe(`Host can proxy tool calls to the MCP server.`),serverResources:L({listChanged:P().optional().describe(`Host supports resources/list_changed notifications.`)}).optional().describe(`Host can proxy resource reads to the MCP server.`),logging:L({}).optional().describe(`Host accepts log messages.`),sandbox:L({permissions:Bm.optional().describe(`Permissions granted by the host (camera, microphone, geolocation).`),csp:zm.optional().describe(`CSP domains approved by the host.`)}).optional().describe(`Sandbox configuration applied by the host.`),updateModelContext:Jm.optional().describe(`Host accepts context updates (ui/update-model-context) to be included in the model's context for future turns.`),message:Jm.optional().describe(`Host supports receiving content messages (ui/message) from the view.`),sampling:L({tools:L({}).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.")}),Xm=L({experimental:B(j(),B(j(),Es()).describe(`Experimental features keyed by identifier.`)).optional().describe(`Experimental features keyed by identifier.`),tools:L({listChanged:P().optional().describe(`App supports tools/list_changed notifications.`)}).optional().describe(`App exposes MCP-style tools that the host can call.`),availableDisplayModes:I(Pm).optional().describe(`Display modes the app supports.`)});L({method:H(`ui/notifications/initialized`),params:L({}).optional()}),L({csp:zm.optional().describe(`Content Security Policy configuration for UI resources.`),permissions:Bm.optional().describe(`Sandbox permissions requested by the UI resource.`),domain:j().optional().describe(`Dedicated origin for view sandbox.
92
+ Maps to Permission Policy \`clipboard-write\` feature.`)});R({method:U(`ui/notifications/size-changed`),params:R({width:P().optional().describe(`New width in pixels.`),height:P().optional().describe(`New height in pixels.`)})});var Th=R({method:U(`ui/notifications/tool-input`),params:R({arguments:V(M(),I().describe(`Complete tool call arguments as key-value pairs.`)).optional().describe(`Complete tool call arguments as key-value pairs.`)})}),Eh=R({method:U(`ui/notifications/tool-input-partial`),params:R({arguments:V(M(),I().describe(`Partial tool call arguments (incomplete, may change).`)).optional().describe(`Partial tool call arguments (incomplete, may change).`)})}),Dh=R({method:U(`ui/notifications/tool-cancelled`),params:R({reason:M().optional().describe(`Optional reason for the cancellation (e.g., "user action", "timeout").`)})}),Oh=R({fonts:M().optional()}),kh=R({variables:yh.optional().describe(`CSS variables for theming the app.`),css:Oh.optional().describe(`CSS blocks that apps can inject.`)}),Ah=R({method:U(`ui/resource-teardown`),params:R({})}),jh=V(M(),I()),Mh=R({text:R({}).optional().describe(`Host supports text content blocks.`),image:R({}).optional().describe(`Host supports image content blocks.`),audio:R({}).optional().describe(`Host supports audio content blocks.`),resource:R({}).optional().describe(`Host supports resource content blocks.`),resourceLink:R({}).optional().describe(`Host supports resource link content blocks.`),structuredContent:R({}).optional().describe(`Host supports structured content.`)});R({method:U(`ui/notifications/request-teardown`),params:R({}).optional()});var Nh=R({experimental:V(M(),V(M(),lc()).describe(`Experimental features keyed by identifier.`)).optional().describe(`Experimental features keyed by identifier.`),openLinks:R({}).optional().describe(`Host supports opening external URLs.`),downloadFile:R({}).optional().describe(`Host supports file downloads via ui/download-file.`),serverTools:R({listChanged:F().optional().describe(`Host supports tools/list_changed notifications.`)}).optional().describe(`Host can proxy tool calls to the MCP server.`),serverResources:R({listChanged:F().optional().describe(`Host supports resources/list_changed notifications.`)}).optional().describe(`Host can proxy resource reads to the MCP server.`),logging:R({}).optional().describe(`Host accepts log messages.`),sandbox:R({permissions:wh.optional().describe(`Permissions granted by the host (camera, microphone, geolocation).`),csp:Ch.optional().describe(`CSP domains approved by the host.`)}).optional().describe(`Sandbox configuration applied by the host.`),updateModelContext:Mh.optional().describe(`Host accepts context updates (ui/update-model-context) to be included in the model's context for future turns.`),message:Mh.optional().describe(`Host supports receiving content messages (ui/message) from the view.`),sampling:R({tools:R({}).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.")}),Ph=R({experimental:V(M(),V(M(),lc()).describe(`Experimental features keyed by identifier.`)).optional().describe(`Experimental features keyed by identifier.`),tools:R({listChanged:F().optional().describe(`App supports tools/list_changed notifications.`)}).optional().describe(`App exposes MCP-style tools that the host can call.`),availableDisplayModes:L(vh).optional().describe(`Display modes the app supports.`)});R({method:U(`ui/notifications/initialized`),params:R({}).optional()}),R({csp:Ch.optional().describe(`Content Security Policy configuration for UI resources.`),permissions:wh.optional().describe(`Sandbox permissions requested by the UI resource.`),domain:M().optional().describe(`Dedicated origin for view sandbox.
88
93
 
89
94
  Useful when views need stable, dedicated origins for OAuth callbacks, CORS policies, or API key allowlists.
90
95
 
@@ -92,16 +97,16 @@ Useful when views need stable, dedicated origins for OAuth callbacks, CORS polic
92
97
  - Hash-based subdomains (e.g., \`{hash}.claudemcpcontent.com\`)
93
98
  - URL-derived subdomains (e.g., \`www-example-com.oaiusercontent.com\`)
94
99
 
95
- If omitted, host uses default sandbox origin (typically per-conversation).`),prefersBorder:P().optional().describe(`Visual boundary preference - true if view prefers a visible border.
100
+ If omitted, host uses default sandbox origin (typically per-conversation).`),prefersBorder:F().optional().describe(`Visual boundary preference - true if view prefers a visible border.
96
101
 
97
102
  Boolean requesting whether a visible border and background is provided by the host. Specifying an explicit value for this is recommended because hosts' defaults may vary.
98
103
 
99
104
  - \`true\`: request visible border + background
100
105
  - \`false\`: request no visible border + background
101
- - omitted: host decides border`)}),L({method:H(`ui/request-display-mode`),params:L({mode:Pm.describe(`The display mode being requested.`)})});var Zm=L({mode:Pm.describe(`The display mode that was actually set. May differ from requested if not supported.`)}).passthrough(),Qm=z([H(`model`),H(`app`)]).describe(`Tool visibility scope - who can access the tool.`);L({resourceUri:j().optional(),visibility:I(Qm).optional().describe(`Who can access this tool. Default: ["model", "app"]
106
+ - omitted: host decides border`)}),R({method:U(`ui/request-display-mode`),params:R({mode:vh.describe(`The display mode being requested.`)})});var Fh=R({mode:vh.describe(`The display mode that was actually set. May differ from requested if not supported.`)}).passthrough(),Ih=B([U(`model`),U(`app`)]).describe(`Tool visibility scope - who can access the tool.`);R({resourceUri:M().optional(),visibility:L(Ih).optional().describe(`Who can access this tool. Default: ["model", "app"]
102
107
  - "model": Tool visible to and callable by the agent
103
- - "app": Tool callable by the app from this server only`),csp:ks().optional(),permissions:ks().optional()}),L({mimeTypes:I(j()).optional().describe('Array of supported MIME types for UI resources.\nMust include `"text/html;profile=mcp-app"` for MCP Apps support.')}),L({method:H(`ui/download-file`),params:L({contents:I(z([eu,tu])).describe(`Resource contents to download — embedded (inline data) or linked (host fetches). Uses standard MCP resource types.`)})}),L({method:H(`ui/message`),params:L({role:H(`user`).describe(`Message role, currently only "user" is supported.`),content:I(nu).describe(`Message content blocks (text, image, etc.).`)})}),L({method:H(`ui/notifications/sandbox-resource-ready`),params:L({html:j().describe(`HTML content to load into the inner iframe.`),sandbox:j().optional().describe(`Optional override for the inner iframe's sandbox attribute.`),csp:zm.optional().describe(`CSP configuration from resource metadata.`),permissions:Bm.optional().describe(`Sandbox permissions from resource metadata.`)})});var $m=L({method:H(`ui/notifications/tool-result`),params:du.describe(`Standard MCP tool execution result.`)}),eh=L({toolInfo:L({id:Ic.optional().describe(`JSON-RPC id of the tools/call request.`),tool:cu.describe(`Tool definition including name, inputSchema, etc.`)}).optional().describe(`Metadata of the tool call that instantiated this App.`),theme:Nm.optional().describe(`Current color theme preference.`),styles:Gm.optional().describe(`Style configuration for theming the app.`),displayMode:Pm.optional().describe(`How the UI is currently displayed.`),availableDisplayModes:I(Pm).optional().describe(`Display modes the host supports.`),containerDimensions:z([L({height:N().describe(`Fixed container height in pixels.`)}),L({maxHeight:z([N(),Ss()]).optional().describe(`Maximum container height in pixels.`)})]).and(z([L({width:N().describe(`Fixed container width in pixels.`)}),L({maxWidth:z([N(),Ss()]).optional().describe(`Maximum container width in pixels.`)})])).optional().describe(`Container dimensions. Represents the dimensions of the iframe or other
104
- container holding the app. Specify either width or maxWidth, and either height or maxHeight.`),locale:j().optional().describe(`User's language and region preference in BCP 47 format.`),timeZone:j().optional().describe(`User's timezone in IANA format.`),userAgent:j().optional().describe(`Host application identifier.`),platform:z([H(`web`),H(`desktop`),H(`mobile`)]).optional().describe(`Platform type for responsive design decisions.`),deviceCapabilities:L({touch:P().optional().describe(`Whether the device supports touch input.`),hover:P().optional().describe(`Whether the device supports hover interactions.`)}).optional().describe(`Device input capabilities.`),safeAreaInsets:L({top:N().describe(`Top safe area inset in pixels.`),right:N().describe(`Right safe area inset in pixels.`),bottom:N().describe(`Bottom safe area inset in pixels.`),left:N().describe(`Left safe area inset in pixels.`)}).optional().describe(`Mobile safe area boundaries in pixels.`)}).passthrough(),th=L({method:H(`ui/notifications/host-context-changed`),params:eh.describe(`Partial context update containing only changed fields.`)});L({method:H(`ui/update-model-context`),params:L({content:I(nu).optional().describe(`Context content blocks (text, image, etc.).`),structuredContent:B(j(),F().describe(`Structured content for machine-readable context data.`)).optional().describe(`Structured content for machine-readable context data.`)})}),L({method:H(`ui/initialize`),params:L({appInfo:Yc.describe(`App identification (name and version).`),appCapabilities:Xm.describe(`Features and capabilities this app provides.`),protocolVersion:j().describe(`Protocol version this app supports.`)})});var nh=L({protocolVersion:j().describe(`Negotiated protocol version string (e.g., "2025-11-21").`),hostInfo:Yc.describe(`Host application identification and version.`),hostCapabilities:Ym.describe(`Features and capabilities provided by the host.`),hostContext:eh.describe(`Rich context about the host environment.`)}).passthrough(),rh={target:`draft-2020-12`};async function ih(e,t){let n=e[`~standard`];if(n.jsonSchema)return n.jsonSchema[t](rh);throw Error(`Schema (vendor: ${n.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 ah(e,t,n=``){let r=await e[`~standard`].validate(t);if(r.issues){let e=r.issues.map(e=>{let t=e.path?.map(e=>typeof e==`object`?e.key:e).join(`.`);return t?`${t}: ${e.message}`:e.message}).join(`; `);throw Error(n+e)}return r.value}function oh(){let e=document.documentElement.getAttribute(`data-theme`);return e===`dark`||e===`light`?e:document.documentElement.classList.contains(`dark`)?`dark`:`light`}function sh(e){let t=document.documentElement;t.setAttribute(`data-theme`,e),t.style.colorScheme=e}function ch(e,t=document.documentElement){for(let[n,r]of Object.entries(e))r!==void 0&&t.style.setProperty(n,r)}function lh(e){if(document.getElementById(`__mcp-host-fonts`))return;let t=document.createElement(`style`);t.id=`__mcp-host-fonts`,t.textContent=e,document.head.appendChild(t)}function uh(e,t){let n={...e,...t};return t.experimental!==void 0&&(n.experimental={...e.experimental,...t.experimental}),t.tools!==void 0&&(n.tools={...e.tools,...t.tools}),n}var dh=class e extends sm{_appInfo;_appCapabilities;options;_hostCapabilities;_hostInfo;_hostContext;_registeredTools={};_initializedSent=!1;_registeredEvents=new Set;_events=new Em;_methods=new Dm;setRequestHandler=(...e)=>{let[t,...n]=km(`request`,e)??e;this._methods.claim(t,`setRequestHandler`),super.setRequestHandler.call(this,t,...n)};setNotificationHandler=(...e)=>{let[t,...n]=km(`notification`,e)??e;this._methods.claim(t,`setNotificationHandler`),super.setNotificationHandler.call(this,t,...n)};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:Vm,toolinputpartial:Hm,toolresult:$m,toolcancelled:Um,hostcontextchanged:th};static ONE_SHOT_EVENTS=new Set([`toolinput`,`toolinputpartial`,`toolresult`,`toolcancelled`]);_everHadListener=new Set;_assertHandlerTiming(t){if(!e.ONE_SHOT_EVENTS.has(t)||this._everHadListener.has(t)||(this._everHadListener.add(t),!this._initializedSent))return;let n=`[ext-apps] "${String(t)}" 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(n);console.warn(n)}setEventHandler(e,t){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},t=>{let n=t;e===`hostcontextchanged`&&(this._hostContext={...this._hostContext,...n}),this._events.dispatch(e,n)}),this._registeredEvents.add(e)}getEventHandler(e){return this._events.getHandler(e)}warnIfRequestHandlerReplaced(e,t,n){t&&n&&console.warn(`[MCP Apps] ${e} handler replaced. Previous handler will no longer be called.`)}constructor(e,t={},n={autoResize:!0}){super(n),this._appInfo=e,this._appCapabilities=t,this.options=n,this._methods.replace(`notifications/cancelled`),this._methods.replace(`notifications/progress`),!n.allowUnsafeEval&&S({jitless:!0}),this.replaceRequestHandler(`ping`,e=>(console.log(`Received ping:`,e.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=uh(this._appCapabilities,e)}registerTool(e,t,n){if(this._registeredTools[e])throw Error(`Tool ${e} is already registered`);let r=this,i=()=>{r._initializedSent&&r._appCapabilities.tools?.listChanged&&r.sendToolListChanged()},a=t.inputSchema!==void 0,o={title:t.title,description:t.description,inputSchema:t.inputSchema,outputSchema:t.outputSchema,annotations:t.annotations,_meta:t._meta,enabled:!0,enable(){this.enabled=!0,i()},disable(){this.enabled=!1,i()},update(e){Object.assign(this,e),i()},remove(){r._registeredTools[e]===o&&(delete r._registeredTools[e],i())},handler:async(t,r)=>{if(!o.enabled)throw Error(`Tool ${e} is disabled`);let i;if(a){let a=o.inputSchema;i=await n(a?await ah(a,t??{},`Invalid input for tool ${e}: `):t??{},r)}else i=await n(r);return o.outputSchema&&!i.isError&&(i.structuredContent=await ah(o.outputSchema,i.structuredContent,`Invalid output for tool ${e}: `)),i}};return this._registeredTools[e]=o,!this._appCapabilities.tools&&!this.transport&&this.registerAppCapabilities({tools:{listChanged:!0}}),this.ensureToolHandlersInitialized(),i(),o}_toolHandlersInitialized=!1;ensureToolHandlersInitialized(){this._toolHandlersInitialized||(this._toolHandlersInitialized=!0,this.oncalltool=async(e,t)=>{let n=this._registeredTools[e.name];if(!n)throw Error(`Tool ${e.name} not found`);return n.handler(e.arguments,t)},this.onlisttools=async(e,t)=>({tools:await Promise.all(Object.entries(this._registeredTools).filter(([e,t])=>t.enabled).map(async([e,t])=>{let n={name:e,title:t.title,description:t.description,inputSchema:t.inputSchema?await ih(t.inputSchema,`input`):{type:`object`,properties:{}}};return t.outputSchema&&(n.outputSchema=await ih(t.outputSchema,`output`)),t.annotations&&(n.annotations=t.annotations),t._meta&&(n._meta=t._meta),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:Km.shape.params,result:qm},(e,t)=>{if(!this._onteardown)throw Error(`No onteardown handler set`);return this._onteardown(e,t)})}_oncalltool;get oncalltool(){return this._oncalltool}set oncalltool(e){this.warnIfRequestHandlerReplaced(`oncalltool`,this._oncalltool,e),this._oncalltool=e,this.replaceRequestHandler(`tools/call`,(e,t)=>{if(!this._oncalltool)throw Error(`No oncalltool handler set`);return this._oncalltool(e.params,t)})}_onlisttools;get onlisttools(){return this._onlisttools}set onlisttools(e){this.warnIfRequestHandlerReplaced(`onlisttools`,this._onlisttools,e),this._onlisttools=e,this.replaceRequestHandler(`tools/list`,(e,t)=>{if(!this._onlisttools)throw Error(`No onlisttools handler set`);return this._onlisttools(e.params,t)})}assertCapabilityForMethod(e){if(e===`sampling/createMessage`&&!this._hostCapabilities?.sampling)throw Error(`Host does not support sampling (required for ${e})`)}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},Rm,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},Uc,t)}openLink(e,t){return this._assertInitialized(`openLink`),this.request({method:`ui/open-link`,params:e},Im,t)}sendOpenLink=this.openLink;downloadFile(e,t){return this._assertInitialized(`downloadFile`),this.request({method:`ui/download-file`,params:e},Lm,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},Zm,t)}sendSizeChanged(e){return this.notification({method:`ui/notifications/size-changed`,params:e})}setupSizeChangedNotifications(){let e=!1,t=0,n=0,r=()=>{e||(e=!0,requestAnimationFrame(()=>{e=!1;let r=document.documentElement,i=r.style.height;r.style.height=`max-content`;let a=Math.ceil(r.getBoundingClientRect().height);r.style.height=i;let o=Math.ceil(window.innerWidth);(o!==t||a!==n)&&(t=o,n=a,this.sendSizeChanged({width:o,height:a}))}))};r();let i=new ResizeObserver(r);return i.observe(document.documentElement),i.observe(document.body),()=>i.disconnect()}async connect(e=new Mm(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 n=await this.request({method:`ui/initialize`,params:{appCapabilities:this._appCapabilities,appInfo:this._appInfo,protocolVersion:jm}},nh,t);if(n===void 0)throw Error(`Server sent invalid initialize result: ${n}`);this._hostCapabilities=n.hostCapabilities,this._hostInfo=n.hostInfo,this._hostContext=n.hostContext,await this.notification({method:`ui/notifications/initialized`}),this._initializedSent=!0,this.options?.autoResize&&this.setupSizeChangedNotifications()}catch(e){throw this.close(),e}}};function $(e,t={},...n){let r=document.createElement(e);for(let[e,n]of Object.entries(t))e===`class`?r.className=n:r.setAttribute(e,n);for(let e of n.flat())e!==!1&&e!=null&&r.append(e instanceof Node?e:document.createTextNode(String(e)));return r}function fh(e,t,n={}){let r=$(`button`,{class:`btn${n.class?` ${n.class}`:``}`,...n.title?{title:n.title}:{}});return r.textContent=e,n.disabled&&(r.disabled=!0),r.addEventListener(`click`,t),r}function ph(e){e.onhostcontextchanged=e=>{if(e.theme&&sh(e.theme),e.styles?.variables&&ch(e.styles.variables),e.styles?.css?.fonts&&lh(e.styles.css.fonts),e.safeAreaInsets){let{top:t,right:n,bottom:r,left:i}=e.safeAreaInsets;document.body.style.padding=`${t+16}px ${n+16}px ${r+16}px ${i+16}px`}},sh(oh())}var mh=1e4;async function hh(e,t,n){try{return await e.connect(void 0,{timeout:mh}),console.warn(`[${t}] connected`,{host:e.getHostVersion(),caps:e.getHostCapabilities()}),!0}catch(e){console.error(`[${t}] connect failed`,e);let r=e instanceof Error&&/timed?\s*out/i.test(e.message)?`The MCP App host did not respond — make sure your client supports MCP Apps (ext-apps).`:`Connection failed: ${e instanceof Error?e.message:String(e)}`;return n.replaceChildren($(`div`,{class:`skeleton`},r)),!1}}var gh=`show_interfaces`,_h=document.getElementById(`app`),vh=null,yh=``,bh=!1;function xh(e){return(e.flags??``).includes(`R`)||e.running===`true`}function Sh(e){return(e.flags??``).includes(`X`)||e.disabled===`true`}function Ch(e,t){return!!t&&$(`div`,{class:`contents`},$(`span`,{},e),$(`b`,{},t))}function wh(e){let t=Sh(e),n=t?`dot is-down`:xh(e)?`dot is-up`:`dot`,r=$(`div`,{class:`if-card__meta`},Ch(`MTU`,e.mtu??e[`actual-mtu`]),Ch(`MAC`,e[`mac-address`]),Ch(`comment`,e.comment));return $(`div`,{class:`card if-card${t?` is-disabled`:``}`},$(`div`,{class:`if-card__top`},$(`span`,{class:n}),$(`span`,{class:`if-card__name`},e.name??`?`),$(`span`,{class:`badge`},e.type??`—`)),r)}function Th(e){let t=yh.trim().toLowerCase();return t?e.rows.filter(e=>Object.values(e).some(e=>e.toLowerCase().includes(t))):e.rows}function Eh(){if(!vh){_h.replaceChildren($(`div`,{class:`skeleton`},`Waiting for interfaces…`));return}let e=vh,t=Th(e),n=e.rows.filter(xh).length,r=e.rows.filter(Sh).length,i=$(`input`,{class:`search`,type:`search`,placeholder:`Search ${e.rows.length} interface(s)…`,value:yh});i.addEventListener(`input`,()=>{yh=i.value,Eh()});let a=$(`header`,{class:`hd`},$(`span`,{class:`hd__dot`}),$(`div`,{},$(`h1`,{class:`hd__title`},`Interfaces`),$(`p`,{class:`hd__sub`},`${n} running · ${r} disabled · ${e.rows.length} total`)),$(`span`,{class:`hd__spacer`}),$(`span`,{class:`pill`},`device `,$(`b`,{},e.device))),o=$(`div`,{class:`toolbar`},$(`div`,{class:`grow`},i),fh(bh?`Refreshing…`:`↻ Refresh`,kh,{disabled:bh})),s=t.length?$(`section`,{class:`if-grid`},...t.map(wh)):$(`div`,{class:`empty`},`No interfaces match the search.`),c=$(`footer`,{class:`foot`},$(`span`,{class:`grow`}),$(`span`,{},`updated ${new Date(e.generatedAt).toLocaleTimeString()}`));_h.replaceChildren(a,o,s,c)}var Dh=new dh({name:`mikrotik-interfaces`,version:`1.0.0`});function Oh(e){e&&typeof e==`object`&&e.__mikrotikView===`interfaces`&&(vh=e,Eh())}async function kh(){if(!bh){bh=!0,Eh();try{Oh((await Dh.callServerTool({name:gh,arguments:{}})).structuredContent)}catch(e){console.error(`[interfaces] refresh failed`,e)}finally{bh=!1,Eh()}}}Dh.ontoolresult=e=>{console.warn(`[interfaces] ontoolresult`,e),Oh(e.structuredContent)},Dh.ontoolinput=()=>{vh||Eh()},ph(Dh),Dh.onteardown=async()=>({}),Eh(),hh(Dh,`interfaces`,_h);
108
+ - "app": Tool callable by the app from this server only`),csp:fc().optional(),permissions:fc().optional()}),R({mimeTypes:L(M()).optional().describe('Array of supported MIME types for UI resources.\nMust include `"text/html;profile=mcp-app"` for MCP Apps support.')}),R({method:U(`ui/download-file`),params:R({contents:L(B([Lu,Ru])).describe(`Resource contents to download — embedded (inline data) or linked (host fetches). Uses standard MCP resource types.`)})}),R({method:U(`ui/message`),params:R({role:U(`user`).describe(`Message role, currently only "user" is supported.`),content:L(zu).describe(`Message content blocks (text, image, etc.).`)})}),R({method:U(`ui/notifications/sandbox-resource-ready`),params:R({html:M().describe(`HTML content to load into the inner iframe.`),sandbox:M().optional().describe(`Optional override for the inner iframe's sandbox attribute.`),csp:Ch.optional().describe(`CSP configuration from resource metadata.`),permissions:wh.optional().describe(`Sandbox permissions from resource metadata.`)})});var Lh=R({method:U(`ui/notifications/tool-result`),params:Ju.describe(`Standard MCP tool execution result.`)}),Rh=R({toolInfo:R({id:yl.optional().describe(`JSON-RPC id of the tools/call request.`),tool:Gu.describe(`Tool definition including name, inputSchema, etc.`)}).optional().describe(`Metadata of the tool call that instantiated this App.`),theme:_h.optional().describe(`Current color theme preference.`),styles:kh.optional().describe(`Style configuration for theming the app.`),displayMode:vh.optional().describe(`How the UI is currently displayed.`),availableDisplayModes:L(vh).optional().describe(`Display modes the host supports.`),containerDimensions:B([R({height:P().describe(`Fixed container height in pixels.`)}),R({maxHeight:B([P(),ac()]).optional().describe(`Maximum container height in pixels.`)})]).and(B([R({width:P().describe(`Fixed container width in pixels.`)}),R({maxWidth:B([P(),ac()]).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:M().optional().describe(`User's language and region preference in BCP 47 format.`),timeZone:M().optional().describe(`User's timezone in IANA format.`),userAgent:M().optional().describe(`Host application identifier.`),platform:B([U(`web`),U(`desktop`),U(`mobile`)]).optional().describe(`Platform type for responsive design decisions.`),deviceCapabilities:R({touch:F().optional().describe(`Whether the device supports touch input.`),hover:F().optional().describe(`Whether the device supports hover interactions.`)}).optional().describe(`Device input capabilities.`),safeAreaInsets:R({top:P().describe(`Top safe area inset in pixels.`),right:P().describe(`Right safe area inset in pixels.`),bottom:P().describe(`Bottom safe area inset in pixels.`),left:P().describe(`Left safe area inset in pixels.`)}).optional().describe(`Mobile safe area boundaries in pixels.`)}).passthrough(),zh=R({method:U(`ui/notifications/host-context-changed`),params:Rh.describe(`Partial context update containing only changed fields.`)});R({method:U(`ui/update-model-context`),params:R({content:L(zu).optional().describe(`Context content blocks (text, image, etc.).`),structuredContent:V(M(),I().describe(`Structured content for machine-readable context data.`)).optional().describe(`Structured content for machine-readable context data.`)})}),R({method:U(`ui/initialize`),params:R({appInfo:Ml.describe(`App identification (name and version).`),appCapabilities:Ph.describe(`Features and capabilities this app provides.`),protocolVersion:M().describe(`Protocol version this app supports.`)})});var Bh=R({protocolVersion:M().describe(`Negotiated protocol version string (e.g., "2025-11-21").`),hostInfo:Ml.describe(`Host application identification and version.`),hostCapabilities:Nh.describe(`Features and capabilities provided by the host.`),hostContext:Rh.describe(`Rich context about the host environment.`)}).passthrough(),Vh={target:`draft-2020-12`};async function Hh(e,t){let n=e[`~standard`];if(n.jsonSchema)return n.jsonSchema[t](Vh);throw Error(`Schema (vendor: ${n.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 Uh(e,t,n=``){let r=await e[`~standard`].validate(t);if(r.issues){let e=r.issues.map(e=>{let t=e.path?.map(e=>typeof e==`object`?e.key:e).join(`.`);return t?`${t}: ${e.message}`:e.message}).join(`; `);throw Error(n+e)}return r.value}function Wh(){let e=document.documentElement.getAttribute(`data-theme`);return e===`dark`||e===`light`?e:document.documentElement.classList.contains(`dark`)?`dark`:`light`}function Gh(e){let t=document.documentElement;t.setAttribute(`data-theme`,e),t.style.colorScheme=e}function Kh(e,t=document.documentElement){for(let[n,r]of Object.entries(e))r!==void 0&&t.style.setProperty(n,r)}function qh(e){if(document.getElementById(`__mcp-host-fonts`))return;let t=document.createElement(`style`);t.id=`__mcp-host-fonts`,t.textContent=e,document.head.appendChild(t)}function Jh(e,t){let n={...e,...t};return t.experimental!==void 0&&(n.experimental={...e.experimental,...t.experimental}),t.tools!==void 0&&(n.tools={...e.tools,...t.tools}),n}var Yh=class e extends Gm{_appInfo;_appCapabilities;options;_hostCapabilities;_hostInfo;_hostContext;_registeredTools={};_initializedSent=!1;_registeredEvents=new Set;_events=new uh;_methods=new dh;setRequestHandler=(...e)=>{let[t,...n]=ph(`request`,e)??e;this._methods.claim(t,`setRequestHandler`),super.setRequestHandler.call(this,t,...n)};setNotificationHandler=(...e)=>{let[t,...n]=ph(`notification`,e)??e;this._methods.claim(t,`setNotificationHandler`),super.setNotificationHandler.call(this,t,...n)};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:Th,toolinputpartial:Eh,toolresult:Lh,toolcancelled:Dh,hostcontextchanged:zh};static ONE_SHOT_EVENTS=new Set([`toolinput`,`toolinputpartial`,`toolresult`,`toolcancelled`]);_everHadListener=new Set;_assertHandlerTiming(t){if(!e.ONE_SHOT_EVENTS.has(t)||this._everHadListener.has(t)||(this._everHadListener.add(t),!this._initializedSent))return;let n=`[ext-apps] "${String(t)}" 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(n);console.warn(n)}setEventHandler(e,t){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},t=>{let n=t;e===`hostcontextchanged`&&(this._hostContext={...this._hostContext,...n}),this._events.dispatch(e,n)}),this._registeredEvents.add(e)}getEventHandler(e){return this._events.getHandler(e)}warnIfRequestHandlerReplaced(e,t,n){t&&n&&console.warn(`[MCP Apps] ${e} handler replaced. Previous handler will no longer be called.`)}constructor(e,t={},n={autoResize:!0}){super(n),this._appInfo=e,this._appCapabilities=t,this.options=n,this._methods.replace(`notifications/cancelled`),this._methods.replace(`notifications/progress`),!n.allowUnsafeEval&&w({jitless:!0}),this.replaceRequestHandler(`ping`,e=>(console.log(`Received ping:`,e.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=Jh(this._appCapabilities,e)}registerTool(e,t,n){if(this._registeredTools[e])throw Error(`Tool ${e} is already registered`);let r=this,i=()=>{r._initializedSent&&r._appCapabilities.tools?.listChanged&&r.sendToolListChanged()},a=t.inputSchema!==void 0,o={title:t.title,description:t.description,inputSchema:t.inputSchema,outputSchema:t.outputSchema,annotations:t.annotations,_meta:t._meta,enabled:!0,enable(){this.enabled=!0,i()},disable(){this.enabled=!1,i()},update(e){Object.assign(this,e),i()},remove(){r._registeredTools[e]===o&&(delete r._registeredTools[e],i())},handler:async(t,r)=>{if(!o.enabled)throw Error(`Tool ${e} is disabled`);let i;if(a){let a=o.inputSchema;i=await n(a?await Uh(a,t??{},`Invalid input for tool ${e}: `):t??{},r)}else i=await n(r);return o.outputSchema&&!i.isError&&(i.structuredContent=await Uh(o.outputSchema,i.structuredContent,`Invalid output for tool ${e}: `)),i}};return this._registeredTools[e]=o,!this._appCapabilities.tools&&!this.transport&&this.registerAppCapabilities({tools:{listChanged:!0}}),this.ensureToolHandlersInitialized(),i(),o}_toolHandlersInitialized=!1;ensureToolHandlersInitialized(){this._toolHandlersInitialized||(this._toolHandlersInitialized=!0,this.oncalltool=async(e,t)=>{let n=this._registeredTools[e.name];if(!n)throw Error(`Tool ${e.name} not found`);return n.handler(e.arguments,t)},this.onlisttools=async(e,t)=>({tools:await Promise.all(Object.entries(this._registeredTools).filter(([e,t])=>t.enabled).map(async([e,t])=>{let n={name:e,title:t.title,description:t.description,inputSchema:t.inputSchema?await Hh(t.inputSchema,`input`):{type:`object`,properties:{}}};return t.outputSchema&&(n.outputSchema=await Hh(t.outputSchema,`output`)),t.annotations&&(n.annotations=t.annotations),t._meta&&(n._meta=t._meta),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:Ah.shape.params,result:jh},(e,t)=>{if(!this._onteardown)throw Error(`No onteardown handler set`);return this._onteardown(e,t)})}_oncalltool;get oncalltool(){return this._oncalltool}set oncalltool(e){this.warnIfRequestHandlerReplaced(`oncalltool`,this._oncalltool,e),this._oncalltool=e,this.replaceRequestHandler(`tools/call`,(e,t)=>{if(!this._oncalltool)throw Error(`No oncalltool handler set`);return this._oncalltool(e.params,t)})}_onlisttools;get onlisttools(){return this._onlisttools}set onlisttools(e){this.warnIfRequestHandlerReplaced(`onlisttools`,this._onlisttools,e),this._onlisttools=e,this.replaceRequestHandler(`tools/list`,(e,t)=>{if(!this._onlisttools)throw Error(`No onlisttools handler set`);return this._onlisttools(e.params,t)})}assertCapabilityForMethod(e){if(e===`sampling/createMessage`&&!this._hostCapabilities?.sampling)throw Error(`Host does not support sampling (required for ${e})`)}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},Sh,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},El,t)}openLink(e,t){return this._assertInitialized(`openLink`),this.request({method:`ui/open-link`,params:e},bh,t)}sendOpenLink=this.openLink;downloadFile(e,t){return this._assertInitialized(`downloadFile`),this.request({method:`ui/download-file`,params:e},xh,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},Fh,t)}sendSizeChanged(e){return this.notification({method:`ui/notifications/size-changed`,params:e})}setupSizeChangedNotifications(){let e=!1,t=0,n=0,r=()=>{e||(e=!0,requestAnimationFrame(()=>{e=!1;let r=document.documentElement,i=r.style.height;r.style.height=`max-content`;let a=Math.ceil(r.getBoundingClientRect().height);r.style.height=i;let o=Math.ceil(window.innerWidth);(o!==t||a!==n)&&(t=o,n=a,this.sendSizeChanged({width:o,height:a}))}))};r();let i=new ResizeObserver(r);return i.observe(document.documentElement),i.observe(document.body),()=>i.disconnect()}async connect(e=new gh(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 n=await this.request({method:`ui/initialize`,params:{appCapabilities:this._appCapabilities,appInfo:this._appInfo,protocolVersion:hh}},Bh,t);if(n===void 0)throw Error(`Server sent invalid initialize result: ${n}`);this._hostCapabilities=n.hostCapabilities,this._hostInfo=n.hostInfo,this._hostContext=n.hostContext,await this.notification({method:`ui/notifications/initialized`}),this._initializedSent=!0,this.options?.autoResize&&this.setupSizeChangedNotifications()}catch(e){throw this.close(),e}}};function $(e,t={},...n){let r=document.createElement(e);for(let[e,n]of Object.entries(t))e===`class`?r.className=n:r.setAttribute(e,n);for(let e of n.flat())e!==!1&&e!=null&&r.append(e instanceof Node?e:document.createTextNode(String(e)));return r}function Xh(e,t,n={}){let r=$(`button`,{class:`btn${n.class?` ${n.class}`:``}`,...n.title?{title:n.title}:{}});return r.textContent=e,n.disabled&&(r.disabled=!0),r.addEventListener(`click`,t),r}function Zh(e){e.onhostcontextchanged=e=>{if(e.theme&&Gh(e.theme),e.styles?.variables&&Kh(e.styles.variables),e.styles?.css?.fonts&&qh(e.styles.css.fonts),e.safeAreaInsets){let{top:t,right:n,bottom:r,left:i}=e.safeAreaInsets;document.body.style.padding=`${t+16}px ${n+16}px ${r+16}px ${i+16}px`}},Gh(Wh())}var Qh=1e4;async function $h(e,t,n){try{return await e.connect(void 0,{timeout:Qh}),console.warn(`[${t}] connected`,{host:e.getHostVersion(),caps:e.getHostCapabilities()}),!0}catch(e){console.error(`[${t}] connect failed`,e);let r=e instanceof Error&&/timed?\s*out/i.test(e.message)?`The MCP App host did not respond — make sure your client supports MCP Apps (ext-apps).`:`Connection failed: ${e instanceof Error?e.message:String(e)}`;return n.replaceChildren($(`div`,{class:`skeleton`},r)),!1}}var eg=`show_interfaces`,tg=document.getElementById(`app`),ng=null,rg=``,ig=!1;function ag(e){return(e.flags??``).includes(`R`)||e.running===`true`}function og(e){return(e.flags??``).includes(`X`)||e.disabled===`true`}function sg(e,t){return!!t&&$(`div`,{class:`contents`},$(`span`,{},e),$(`b`,{},t))}function cg(e){let t=og(e),n=t?`dot is-down`:ag(e)?`dot is-up`:`dot`,r=$(`div`,{class:`if-card__meta`},sg(`MTU`,e.mtu??e[`actual-mtu`]),sg(`MAC`,e[`mac-address`]),sg(`comment`,e.comment));return $(`div`,{class:`card if-card${t?` is-disabled`:``}`},$(`div`,{class:`if-card__top`},$(`span`,{class:n}),$(`span`,{class:`if-card__name`},e.name??`?`),$(`span`,{class:`badge`},e.type??`—`)),r)}function lg(e){let t=rg.trim().toLowerCase();return t?e.rows.filter(e=>Object.values(e).some(e=>e.toLowerCase().includes(t))):e.rows}function ug(){if(!ng){tg.replaceChildren($(`div`,{class:`skeleton`},`Waiting for interfaces…`));return}let e=ng,t=lg(e),n=e.rows.filter(ag).length,r=e.rows.filter(og).length,i=$(`input`,{class:`search`,type:`search`,placeholder:`Search ${e.rows.length} interface(s)…`,value:rg});i.addEventListener(`input`,()=>{rg=i.value,ug()});let a=$(`header`,{class:`hd`},$(`span`,{class:`hd__dot`}),$(`div`,{},$(`h1`,{class:`hd__title`},`Interfaces`),$(`p`,{class:`hd__sub`},`${n} running · ${r} disabled · ${e.rows.length} total`)),$(`span`,{class:`hd__spacer`}),$(`span`,{class:`pill`},`device `,$(`b`,{},e.device))),o=$(`div`,{class:`toolbar`},$(`div`,{class:`grow`},i),Xh(ig?`Refreshing…`:`↻ Refresh`,pg,{disabled:ig})),s=t.length?$(`section`,{class:`if-grid`},...t.map(cg)):$(`div`,{class:`empty`},`No interfaces match the search.`),c=$(`footer`,{class:`foot`},$(`span`,{class:`grow`}),$(`span`,{},`updated ${new Date(e.generatedAt).toLocaleTimeString()}`));tg.replaceChildren(a,o,s,c)}var dg=new Yh({name:`mikrotik-interfaces`,version:`1.0.0`});function fg(e){e&&typeof e==`object`&&e.__mikrotikView===`interfaces`&&(ng=e,ug())}async function pg(){if(!ig){ig=!0,ug();try{fg((await dg.callServerTool({name:eg,arguments:{}})).structuredContent)}catch(e){console.error(`[interfaces] refresh failed`,e)}finally{ig=!1,ug()}}}dg.ontoolresult=e=>{console.warn(`[interfaces] ontoolresult`,e),fg(e.structuredContent)},dg.ontoolinput=()=>{ng||ug()},Zh(dg),dg.onteardown=async()=>({}),ug(),$h(dg,`interfaces`,tg);
105
110
  </script>
106
111
  <style>
107
112
  :root{--mt-bg:var(--color-background-primary,#0b0d10);--mt-surface:var(--color-background-secondary,#14171c);--mt-surface-2:var(--color-background-tertiary,#1b1f26);--mt-border:var(--color-border-primary,#262b33);--mt-text:var(--color-text-primary,#e8eaed);--mt-text-dim:var(--color-text-secondary,#9aa3af);--mt-text-faint:var(--color-text-tertiary,#6b7280);--mt-accent:var(--color-accent-primary,#6ea8fe);--mt-good:#34d399;--mt-warn:#fbbf24;--mt-bad:#f87171;--mt-radius:var(--border-radius-md,14px);--mt-radius-sm:var(--border-radius-sm,9px);--mt-mono:var(--font-mono,ui-monospace, "SF Mono", "JetBrains Mono", Menlo, monospace);--mt-sans:var(--font-sans,system-ui, -apple-system, "Segoe UI", sans-serif);--lightningcss-light:initial;--lightningcss-dark: ;color-scheme:light dark}@media (prefers-color-scheme:dark){:root{--lightningcss-light: ;--lightningcss-dark:initial}}*{box-sizing:border-box}body{background:var(--mt-bg);color:var(--mt-text);font-family:var(--mt-sans);-webkit-font-smoothing:antialiased;margin:0;padding:16px;font-size:13px;line-height:1.5}.app{gap:14px;max-width:960px;margin:0 auto;display:grid}.hd{flex-wrap:wrap;align-items:center;gap:12px;display:flex}.hd__dot{background:var(--mt-good);width:9px;height:9px;box-shadow:0 0 0 4px color-mix(in srgb, var(--mt-good) 22%, transparent);border-radius:50%}.hd__title{letter-spacing:-.01em;margin:0;font-size:17px;font-weight:650}.hd__sub{color:var(--mt-text-dim);font-family:var(--mt-mono);margin:0;font-size:12px}.hd__spacer{flex:1}.pill{border:1px solid var(--mt-border);background:var(--mt-surface);color:var(--mt-text-dim);font-family:var(--mt-mono);border-radius:999px;align-items:center;gap:6px;padding:3px 9px;font-size:11px;display:inline-flex}.pill b{color:var(--mt-text);font-weight:600}.grid{grid-template-columns:repeat(auto-fit,minmax(150px,1fr));gap:12px;display:grid}.card{background:linear-gradient(180deg, var(--mt-surface), var(--mt-surface-2));border:1px solid var(--mt-border);border-radius:var(--mt-radius);padding:14px}.card__label{color:var(--mt-text-dim);text-transform:uppercase;letter-spacing:.06em;margin:0 0 8px;font-size:11px}.card__value{font-family:var(--mt-mono);letter-spacing:-.01em;font-size:20px;font-weight:600}.toolbar{flex-wrap:wrap;align-items:center;gap:8px;display:flex}.toolbar .grow{flex:1;min-width:140px}.search{appearance:none;border:1px solid var(--mt-border);background:var(--mt-surface);width:100%;color:var(--mt-text);font:inherit;border-radius:var(--mt-radius-sm);padding:7px 11px;font-size:13px}.search:focus{border-color:var(--mt-accent);outline:none}.search::placeholder{color:var(--mt-text-faint)}.btn{appearance:none;border:1px solid var(--mt-border);background:var(--mt-surface);color:var(--mt-text);font:inherit;border-radius:var(--mt-radius-sm);cursor:pointer;white-space:nowrap;padding:6px 11px;font-size:12px;transition:border-color .15s,background .15s}.btn:hover{border-color:var(--mt-accent);background:var(--mt-surface-2)}.btn:disabled{opacity:.5;cursor:default}.btn.is-active{border-color:var(--mt-accent);color:var(--mt-accent)}.chip{border:1px solid var(--mt-border);background:var(--mt-surface);color:var(--mt-text-dim);font-family:var(--mt-mono);border-radius:999px;align-items:center;gap:4px;padding:1px 7px;font-size:11px;display:inline-flex}.chip.is-good{color:var(--mt-good);border-color:color-mix(in srgb, var(--mt-good) 45%, var(--mt-border))}.chip.is-warn{color:var(--mt-warn);border-color:color-mix(in srgb, var(--mt-warn) 45%, var(--mt-border))}.chip.is-bad{color:var(--mt-bad);border-color:color-mix(in srgb, var(--mt-bad) 45%, var(--mt-border))}.tablewrap{border:1px solid var(--mt-border);border-radius:var(--mt-radius);max-height:70vh;overflow:auto}table.tbl{border-collapse:collapse;width:100%;font-size:12px}table.tbl th,table.tbl td{text-align:left;border-bottom:1px solid color-mix(in srgb, var(--mt-border) 55%, transparent);white-space:nowrap;font-family:var(--mt-mono);padding:7px 12px}table.tbl thead th{z-index:1;background:var(--mt-surface-2);color:var(--mt-text-dim);cursor:pointer;-webkit-user-select:none;user-select:none;font-weight:600;position:sticky;top:0}table.tbl thead th:hover{color:var(--mt-text)}table.tbl thead th .arrow{color:var(--mt-accent);margin-left:4px}table.tbl tbody tr{cursor:pointer}table.tbl tbody tr:hover{background:color-mix(in srgb, var(--mt-accent) 8%, transparent)}table.tbl tbody tr.is-disabled td,table.tbl td.col-num{color:var(--mt-text-faint)}.kv__body{border:1px solid var(--mt-border);border-radius:var(--mt-radius);grid-template-columns:minmax(120px,.4fr) 1fr;display:grid;overflow:hidden}.kv__body>div{border-bottom:1px solid color-mix(in srgb, var(--mt-border) 55%, transparent);overflow-wrap:anywhere;min-width:0;font-size:12px;font-family:var(--mt-mono);padding:7px 14px}.kv__k{color:var(--mt-text-dim);background:color-mix(in srgb, var(--mt-surface) 60%, transparent)}.kv__v{color:var(--mt-text)}.drawer{border:1px solid var(--mt-accent);border-radius:var(--mt-radius);background:var(--mt-surface);gap:10px;padding:12px;display:grid}.drawer__hd{align-items:center;gap:8px;display:flex}.drawer__hd b{font-family:var(--mt-mono)}pre.raw{border:1px solid var(--mt-border);border-radius:var(--mt-radius);background:var(--mt-surface);color:var(--mt-text);font-family:var(--mt-mono);white-space:pre;max-height:70vh;margin:0;padding:14px;font-size:12px;overflow:auto}.foot{color:var(--mt-text-faint);font-size:11px;font-family:var(--mt-mono);flex-wrap:wrap;align-items:center;gap:10px;display:flex}.foot .grow{flex:1}.skeleton,.empty{color:var(--mt-text-faint);text-align:center;padding:40px 0}.if-grid{grid-template-columns:repeat(auto-fill,minmax(220px,1fr));gap:12px;display:grid}.if-card{gap:8px;display:grid}.if-card__top{align-items:center;gap:8px;display:flex}.if-card__name{font-family:var(--mt-mono);overflow-wrap:anywhere;font-size:14px;font-weight:650}.if-card.is-disabled{opacity:.6}.dot{background:var(--mt-text-faint);border-radius:50%;flex:none;width:9px;height:9px}.dot.is-up{background:var(--mt-good);box-shadow:0 0 0 4px color-mix(in srgb, var(--mt-good) 22%, transparent)}.dot.is-down{background:var(--mt-bad);box-shadow:0 0 0 4px color-mix(in srgb, var(--mt-bad) 18%, transparent)}.if-card__meta{font-family:var(--mt-mono);color:var(--mt-text-dim);grid-template-columns:auto 1fr;gap:2px 10px;font-size:11px;display:grid}.if-card__meta b{color:var(--mt-text);overflow-wrap:anywhere;font-weight:500}.if-card__meta .contents{display:contents}.badge{border:1px solid var(--mt-border);background:var(--mt-surface-2);color:var(--mt-text-dim);font-family:var(--mt-mono);text-transform:uppercase;letter-spacing:.04em;border-radius:999px;margin-left:auto;padding:1px 7px;font-size:10px}