@usex/mikrotik-mcp 6.3.0 → 6.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -5
- package/dist/cli.js +1831 -65789
- package/dist/index.js +1 -1
- package/dist/shared/{cli-dytg82ck.js → cli-5jnc1v2w.js} +1 -1
- package/dist/shared/{cli-rcgz8540.js → cli-6g4wtkj1.js} +1 -1
- package/dist/shared/{cli-3kxktenb.js → cli-71bbmd5h.js} +1 -1
- package/dist/shared/{cli-b7dr5556.js → cli-wn4ybhq4.js} +1 -1
- package/dist/shared/cli-y81nsdte.js +64611 -0
- package/dist/shared/{library-g661a57q.js → library-4c9wrr75.js} +1 -1
- package/dist/shared/{library-2m4as43g.js → library-9ygb3vgn.js} +1 -1
- package/dist/shared/{library-hykdpvnj.js → library-gcbk2m7w.js} +1 -1
- package/dist/shared/{library-ttgvk8a6.js → library-kssnaqqr.js} +4256 -4147
- package/dist/shared/{library-akf94mf2.js → library-rbaybv2t.js} +1 -1
- package/dist/ui/aaa.html +16 -16
- package/dist/ui/client-check.html +8 -8
- package/dist/ui/connected-devices.html +16 -16
- package/dist/ui/dashboard.html +12 -12
- package/dist/ui/fabric.html +19 -19
- package/dist/ui/firewall-audit.html +12 -12
- package/dist/ui/firewall.html +13 -13
- package/dist/ui/interfaces.html +12 -12
- package/dist/ui/investigations.html +19 -19
- package/dist/ui/observability.html +75 -75
- package/dist/ui/operations.html +19 -19
- package/dist/ui/records.html +13 -13
- package/dist/ui/reports.html +19 -19
- package/dist/ui/round-trip.html +19 -19
- package/dist/ui/service-health.html +19 -19
- package/package.json +26 -26
- package/schemas/devtools-manifest.json +1 -1
- package/schemas/tool-catalog.json +2 -2
package/dist/ui/records.html
CHANGED
|
@@ -8,9 +8,9 @@
|
|
|
8
8
|
<script type="module">
|
|
9
9
|
function e(e){return/^(--- |\+\+\+ |diff --git |index )/.test(e)?`file`:e.startsWith(`@@`)?`hunk`:e.startsWith(`+`)?`add`:e.startsWith(`-`)?`del`:`ctx`}function t(e){return/^@@ /m.test(e)||/^--- /m.test(e)&&/^\+\+\+ /m.test(e)}function n(t){let n=document.createElement(`pre`);n.className=`github-diff`,n.tabIndex=0,n.setAttribute(`aria-label`,`Configuration diff`);for(let r of t.replace(/\r\n/g,`
|
|
10
10
|
`).split(`
|
|
11
|
-
`)){let t=document.createElement(`div`);t.className=`github-diff-line diff-${e(r)}`,t.textContent=r,n.append(t)}return n}var r=Object.defineProperty,i=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),a=(e,t)=>{let n={};for(var i in e)r(n,i,{get:e[i],enumerable:!0});return t&&r(n,Symbol.toStringTag,{value:`Module`}),n},o=new Set([`https://json-schema.org/draft/2019-09/schema`,`http://json-schema.org/draft/2019-09/schema`]);function s(e){return typeof e==`string`&&o.has(e.replace(/#$/,``))}function c(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 l(e,t=`|`){return e.map(e=>ge(e)).join(t)}function u(e,t){return typeof t==`bigint`?t.toString():t}var d=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 f(e){return new d(e)}function p(e){return e==null}function m(e){let t=+!!e.startsWith(`^`),n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}function h(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 ee=Symbol(`evaluating`);function te(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==ee)return r===void 0&&(r=ee,r=n()),r},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function g(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function ne(e){let t=Object.getOwnPropertyDescriptor(e,`shape`);return t?.get?t.get.raw:t?.value}function _(e){return ne(e._zod.def)??e._zod.def.shape}function re(e,t,n){Object.defineProperty(e,t,{get(){let e=n();return g(this,t,e),e},enumerable:!0,configurable:!0})}function ie(e,t,n){t in e?g(e,t,n):e[t]=n}function ae(e,t,n,r){let i=_(t);for(let a of n){let n=Object.getOwnPropertyDescriptor(i,a);n.enumerable&&(n.get?re(e,a,()=>{let e=t._zod.def.shape[a];return r?r(e,a):e}):ie(e,a,r?r(n.value,a):n.value))}}function oe(e,t){for(let n of Reflect.ownKeys(t)){let r=Object.getOwnPropertyDescriptor(t,n);r.enumerable&&(r.get?re(e,n,()=>t[n]):ie(e,n,r.value))}}function v(...e){let t={};for(let n of e){let e=Object.getOwnPropertyDescriptors(n);Object.assign(t,e)}return Object.defineProperties({},t)}function se(e){return JSON.stringify(e)}function ce(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,``).replace(/[\s_-]+/g,`-`).replace(/^-+|-+$/g,``)}var le=`captureStackTrace`in Error?Error.captureStackTrace:(...e)=>{};function ue(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var de=f(()=>{if(C.jitless||typeof navigator<`u`&&navigator?.userAgent?.includes(`Cloudflare`))return!1;try{return Function(``),!0}catch{return!1}});function fe(e){if(ue(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!=`function`)return!0;let n=t.prototype;return ue(n)!==!1&&Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)!==!1}function pe(e){return fe(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}var me=new Set([`string`,`number`,`symbol`]);function he(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function y(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function b(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 ge(e){return typeof e==`bigint`?e.toString()+`n`:typeof e==`string`?`"${e}"`:`${e}`}function _e(e){return Object.keys(e).filter(t=>e[t]._zod.optin!==void 0&&e[t]._zod.optout===`optional`)}var ve={safeint:[-(2**53-1),2**53-1],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},ye={int64:[BigInt(`-9223372036854775808`),BigInt(`9223372036854775807`)],uint64:[BigInt(0),BigInt(`18446744073709551615`)]};function be(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 ae(i,e,xe(e,t)),y(e,v(n,{shape:i,checks:[]}))}function xe(e,t){let n=_(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 Se(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(xe(e,t)),a={};return ae(a,e,Reflect.ownKeys(_(e)).filter(e=>!i.has(e))),y(e,v(n,{shape:a,checks:[]}))}function Ce(e,t){if(!fe(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);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 y(e,v(e._zod.def,{shape:we(e,t)}))}function we(e,t){let n={};return ae(n,e,Reflect.ownKeys(_(e))),oe(n,t),n}function Te(e,t){if(!fe(t))throw Error(`Invalid input to safeExtend: expected a plain object`);return y(e,v(e._zod.def,{shape:we(e,t)}))}function Ee(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 ae(n,e,Reflect.ownKeys(_(e))),ae(n,t,Reflect.ownKeys(_(t))),y(e,v(e._zod.def,{shape:n,get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]}))}function De(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(xe(t,n)):void 0,o={};return ae(o,t,Reflect.ownKeys(_(t)),e&&((t,n)=>a&&!a.has(n)?t:new e({type:`optional`,innerType:t}))),y(t,v(t._zod.def,{shape:o,checks:[]}))}function Oe(e,t,n){let r=n?new Set(xe(t,n)):void 0,i={};return ae(i,t,Reflect.ownKeys(_(t)),(t,n)=>r&&!r.has(n)?t:new e({type:`nonoptional`,innerType:t})),y(t,v(t._zod.def,{shape:i}))}function ke(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 Ae(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 je(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function Me(e){return typeof e==`string`?e:e?.message}function Ne(e,t,n){var r;for(let i=t;i<e.length;i++)(r=e[i]).schema??(r.schema=n)}function Pe(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:Me(e.inst?._zod.def?.error?.(e))??Me(a?.(e))??Me(t?.error?.(e))??Me(n.customError?.(e))??Me(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 Fe=/[\uD800-\uDBFF]/;function Ie(e){let t=e.length;if(!Fe.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 Le(e){return Array.isArray(e)?`array`:typeof e==`string`?`string`:`unknown`}function Re(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 ze(...e){let[t,n,r]=e;return typeof t==`string`?{message:t,code:`custom`,input:n,inst:r}:{...t}}function Be(e,t){for(let n in t){let r=Object.getOwnPropertyDescriptor(t,n);r.get?Object.defineProperty(e,n,{...r,enumerable:!1}):We(e,n,r.value)}}function Ve(e,t,n,r=!0){return Object.defineProperty(e,t,{configurable:!0,writable:!0,enumerable:r,value:n}),n}function He(e,t,n){return Ve(e,t,n,!1)}function Ue(e,t){for(let n in e){let r=e[n];Object.defineProperty(t,n,{configurable:!0,enumerable:!0,get(){return Ve(this,n,r(this))},set(e){Ve(this,n,e)}})}return t}function We(e,t,n){Object.defineProperty(e,t,{configurable:!0,get(){return this==null?n:Ve(this,t,n.bind(this))},set(e){Ve(this,t,e)}})}function Ge(e,t){let n=Object.getPrototypeOf(e);return t in n?void 0:n}var Ke,qe=!1,Je={configurable:!0,get(){qe=!0}};function x(e,t,n){let r=Object.getPrototypeOf(e._zod);if(t in r&&Ke!==e._zod){Ke=void 0;return}Ke=e._zod,Object.defineProperty(r,t,{configurable:!0,get(){Object.defineProperty(this,t,Je);let e=qe;qe=!1;try{let r=n(this);return qe?delete this[t]:Object.defineProperty(this,t,{configurable:!0,writable:!0,value:r}),qe||=e,r}catch(n){throw delete this[t],qe||=e,n}},set(e){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:e})}})}function Ye(e,t,n,r){let i=Ge(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 Xe=`~constantCatch`;function Ze(e){let t=()=>e;return t[Xe]=!0,t}var Qe,$e=Object.freeze({status:`aborted`}),et={value:void 0,enumerable:!1},tt=`captureStackTrace`in Error?Error:null;function nt(e){let t=tt;if(t){let n=t.stackTraceLimit;if(typeof n==`number`){try{t.stackTraceLimit=0}catch{return tt=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){et.value=new a(r);try{Object.defineProperty(n,"_zod",et)}finally{et.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),Be(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?nt(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 rt=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}},it=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name=`ZodEncodeError`}};(Qe=globalThis).__zod_globalConfig??(Qe.__zod_globalConfig={});var C=globalThis.__zod_globalConfig;function w(e){return e&&Object.assign(C,e),C}function at(){let e=this._zod;return e.message??=JSON.stringify(e.def,u,2),e.message}function ot(e){this._zod.message=e}var st={get:at,set:ot,enumerable:!0,configurable:!0},ct={value:void 0,enumerable:!1},lt=new WeakSet([Object.prototype,Error.prototype]),ut=(e,t)=>{e.name=`$ZodError`,ct.value=t,Object.defineProperty(e,"issues",ct),ct.value=void 0,Object.defineProperty(e,"message",st);let n=Object.getPrototypeOf(e);lt.has(n)||(lt.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})}}))},dt=S(`$ZodError`,ut);S(`$ZodError`,ut,void 0,{Parent:Error});function ft(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 pt(e,t=e=>e.message){let n={},r=[];for(let i of e.issues)i.path.length>0?ft(n,i.path[0],()=>[]).push(t(i)):r.push(t(i));return{formErrors:r,fieldErrors:n}}function mt(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 ht(e,t){return{callee:t?.callee??e,Err:t?.Err}}var gt=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 rt;if(s.issues.length){let n=new((a?.Err)??e)(s.issues.map(e=>Pe(e,o,w())));throw le(n,a?.callee??t),n}return s.value};return t},_t=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=>Pe(e,o,w())));throw le(n,a?.callee??t),n}return s.value};return t},vt=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 rt;return a.issues.length?yt(e,a.issues,i):{success:!0,data:a.value}};function yt(e,t,n){let r;return{success:!1,get error(){return r||(r=new e(t.map(e=>Pe(e,n,w()))),t=void 0,n=void 0),r},set error(e){r=e,t=void 0,n=void 0}}}var bt=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?yt(e,a.issues,i):{success:!0,data:a.value}},xt=Symbol.for(`zod.compile.invalid`),St=Symbol.for(`zod.compile.fallback`),Ct=((e,t,n)=>{let r=e._zod.bag.validator;if(r!==void 0){if(r(t)!==xt)return!0;if(r.definite===!0&&n===void 0)return!1}return wt(e,t,n)});function wt(e,t,n){let r=n?{...n,async:!1,abortEarly:!0}:{async:!1,abortEarly:!0},i=e._zod.bag.fallbackRun,a;if(i?(r[St]=!0,a=i({value:t,issues:[]},r)):a=e._zod.run({value:t,issues:[]},r),a instanceof Promise)throw new rt;return a.issues.length===0}var Tt=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},Et=e=>{let t=gt(e),n=(e,r,i,a)=>{let o=i?{...i,direction:`backward`}:{direction:`backward`};return t(e,r,o,ht(n,a))};return n},Dt=e=>{let t=gt(e),n=(e,r,i,a)=>t(e,r,i,ht(n,a));return n},Ot=e=>{let t=_t(e),n=async(e,r,i,a)=>{let o=i?{...i,direction:`backward`}:{direction:`backward`};return await t(e,r,o,ht(n,a))};return n},kt=e=>{let t=_t(e),n=async(e,r,i,a)=>await t(e,r,i,ht(n,a));return n},At=e=>(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return vt(e)(t,n,i)},jt=e=>(t,n,r)=>vt(e)(t,n,r),Mt=e=>async(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return bt(e)(t,n,i)},Nt=e=>async(t,n,r)=>bt(e)(t,n,r),Pt=/^[cC][0-9a-z]{6,}$/,Ft=/^[0-9a-z]+$/,It=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/,Lt=/^[0-9a-vA-V]{20}$/,Rt=/^[A-Za-z0-9]{27}$/,zt=/^[a-zA-Z0-9_-]{21}$/;function Bt(e){return RegExp(`^[a-zA-Z0-9_-]{${e}}$`)}var Vt=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Ht=/^([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})$/,Ut=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)$/,Wt=/^(?:[A-Za-z0-9_'+\-]+\.)*[A-Za-z0-9_'+\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,Gt=`^(?=[\\s\\S]*[\\p{Extended_Pictographic}\\p{Regional_Indicator}\\u20E3])[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$`;function Kt(){return new RegExp(Gt,`u`)}var qt=/^(?:(?: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])$/,Jt=/^(([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}|:))$/,Yt=/^((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])$/,Xt=/^(([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])$/,Zt=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Qt=/^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$/,$t=/^https?$/,en=/^\+[1-9]\d{6,14}$/,tn=`(?:(?:\\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 nn(e){return RegExp(`^${e}$`)}var rn=nn(tn);function an(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 on(e){return RegExp(`^${an(e)}$`)}function T(e){let t=[`Z`];e.offset&&t.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);let n=`${an({precision:e.precision,seconds:!0})}(?:${t.join(`|`)})`,r=e.local?`${n}|${an({precision:e.precision})}`:n;return RegExp(`^${tn}T(?:${r})$`)}var sn=/^[\s\S]{0,}$/,cn=/^-?\d+$/,ln=/^-?\d+(?:\.\d+)?$/,un=/^(?:true|false)$/i,dn=/^null$/i,fn=/^undefined$/i,pn=/^[^A-Z]*$/,mn=/^[^a-z]*$/,hn=S(`$ZodCheck`,(e,t)=>{var n;e._zod??={},e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),gn=e=>{let t=e.value;return!p(t)&&t.length!==void 0},_n={number:`number`,bigint:`bigint`,object:`date`},vn=S(`$ZodCheckLessThan`,(e,t)=>{hn.init(e,t);let n=_n[typeof t.value];e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:_n[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})}}),yn=S(`$ZodCheckGreaterThan`,(e,t)=>{hn.init(e,t);let n=_n[typeof t.value];e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:_n[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})}}),bn=S(`$ZodCheckMultipleOf`,(e,t)=>{hn.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):h(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})}}),xn=S(`$ZodCheckNumberFormat`,(e,t)=>{hn.init(e,t),t.format=t.format||`float64`;let n=t.format?.includes(`int`),r=n?`int`:`number`,[i,a]=ve[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})}}),Sn=S(`$ZodCheckMaxLength`,(e,t)=>{var n;hn.init(e,t),(n=e._zod.def).when??(n.when=gn),e._zod.check=n=>{let r=n.value,i=r.length;if((typeof r==`string`&&i>t.maximum?Ie(r):i)<=t.maximum)return;let a=Le(r);n.issues.push({origin:a,code:`too_big`,maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),Cn=S(`$ZodCheckMinLength`,(e,t)=>{var n;hn.init(e,t),(n=e._zod.def).when??(n.when=gn),e._zod.check=n=>{let r=n.value,i=r.length;if((typeof r==`string`&&i>=t.minimum&&i<t.minimum*2?Ie(r):i)>=t.minimum)return;let a=Le(r);n.issues.push({origin:a,code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),wn=S(`$ZodCheckLengthEquals`,(e,t)=>{var n;hn.init(e,t),(n=e._zod.def).when??(n.when=gn),e._zod.check=n=>{let r=n.value,i=r.length,a=typeof r==`string`&&i>=t.length&&i<=t.length*2?Ie(r):i;if(a===t.length)return;let o=Le(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})}}),Tn=S(`$ZodCheckStringFormat`,(e,t)=>{var n,r;hn.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=()=>{})}),En=S(`$ZodCheckRegex`,(e,t)=>{Tn.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})}}),Dn=S(`$ZodCheckLowerCase`,(e,t)=>{t.pattern??=pn,Tn.init(e,t)}),On=S(`$ZodCheckUpperCase`,(e,t)=>{t.pattern??=mn,Tn.init(e,t)}),kn=S(`$ZodCheckIncludes`,(e,t)=>{hn.init(e,t);let n=he(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})}}),An=S(`$ZodCheckStartsWith`,(e,t)=>{hn.init(e,t);let n=RegExp(`^${he(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})}}),jn=S(`$ZodCheckEndsWith`,(e,t)=>{hn.init(e,t);let n=RegExp(`.*${he(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})}}),Mn=S(`$ZodCheckOverwrite`,(e,t)=>{hn.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}}),Nn=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(`
|
|
11
|
+
`)){let t=document.createElement(`div`);t.className=`github-diff-line diff-${e(r)}`,t.textContent=r,n.append(t)}return n}var r=Object.defineProperty,i=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),a=(e,t)=>{let n={};for(var i in e)r(n,i,{get:e[i],enumerable:!0});return t&&r(n,Symbol.toStringTag,{value:`Module`}),n},o=new Set([`https://json-schema.org/draft/2019-09/schema`,`http://json-schema.org/draft/2019-09/schema`]);function s(e){return typeof e==`string`&&o.has(e.replace(/#$/,``))}function c(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 l(e,t=`|`){return e.map(e=>ge(e)).join(t)}function u(e,t){return typeof t==`bigint`?t.toString():t}var d=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 f(e){return new d(e)}function p(e){return e==null}function m(e){let t=+!!e.startsWith(`^`),n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}function h(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 ee=Symbol(`evaluating`);function te(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==ee)return r===void 0&&(r=ee,r=n()),r},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function g(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function ne(e){let t=Object.getOwnPropertyDescriptor(e,`shape`);return t?.get?t.get.raw:t?.value}function _(e){return ne(e._zod.def)??e._zod.def.shape}function re(e,t,n){Object.defineProperty(e,t,{get(){let e=n();return g(this,t,e),e},enumerable:!0,configurable:!0})}function ie(e,t,n){t in e?g(e,t,n):e[t]=n}function ae(e,t,n,r){let i=_(t);for(let a of n){let n=Object.getOwnPropertyDescriptor(i,a);n.enumerable&&(n.get?re(e,a,()=>{let e=t._zod.def.shape[a];return r?r(e,a):e}):ie(e,a,r?r(n.value,a):n.value))}}function oe(e,t){for(let n of Reflect.ownKeys(t)){let r=Object.getOwnPropertyDescriptor(t,n);r.enumerable&&(r.get?re(e,n,()=>t[n]):ie(e,n,r.value))}}function v(...e){let t={};for(let n of e){let e=Object.getOwnPropertyDescriptors(n);Object.assign(t,e)}return Object.defineProperties({},t)}function se(e){return JSON.stringify(e)}function ce(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,``).replace(/[\s_-]+/g,`-`).replace(/^-+|-+$/g,``)}var le=`captureStackTrace`in Error?Error.captureStackTrace:(...e)=>{};function ue(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var de=f(()=>{if(w.jitless||typeof navigator<`u`&&navigator?.userAgent?.includes(`Cloudflare`))return!1;try{return Function(``),!0}catch{return!1}});function fe(e){if(ue(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!=`function`)return!0;let n=t.prototype;return ue(n)!==!1&&Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)!==!1}function pe(e){return fe(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}var me=new Set([`string`,`number`,`symbol`]);function he(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function y(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function b(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 ge(e){return typeof e==`bigint`?e.toString()+`n`:typeof e==`string`?`"${e}"`:`${e}`}function _e(e){return Object.keys(e).filter(t=>e[t]._zod.optin!==void 0&&e[t]._zod.optout===`optional`)}var ve={safeint:[-(2**53-1),2**53-1],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},ye={int64:[BigInt(`-9223372036854775808`),BigInt(`9223372036854775807`)],uint64:[BigInt(0),BigInt(`18446744073709551615`)]};function be(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 ae(i,e,xe(e,t)),y(e,v(n,{shape:i,checks:[]}))}function xe(e,t){let n=_(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 Se(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(xe(e,t)),a={};return ae(a,e,Reflect.ownKeys(_(e)).filter(e=>!i.has(e))),y(e,v(n,{shape:a,checks:[]}))}function Ce(e,t){if(!fe(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);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 y(e,v(e._zod.def,{shape:we(e,t)}))}function we(e,t){let n={};return ae(n,e,Reflect.ownKeys(_(e))),oe(n,t),n}function Te(e,t){if(!fe(t))throw Error(`Invalid input to safeExtend: expected a plain object`);return y(e,v(e._zod.def,{shape:we(e,t)}))}function Ee(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 ae(n,e,Reflect.ownKeys(_(e))),ae(n,t,Reflect.ownKeys(_(t))),y(e,v(e._zod.def,{shape:n,get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]}))}function De(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(xe(t,n)):void 0,o={};return ae(o,t,Reflect.ownKeys(_(t)),e&&((t,n)=>a&&!a.has(n)?t:new e({type:`optional`,innerType:t}))),y(t,v(t._zod.def,{shape:o,checks:[]}))}function Oe(e,t,n){let r=n?new Set(xe(t,n)):void 0,i={};return ae(i,t,Reflect.ownKeys(_(t)),(t,n)=>r&&!r.has(n)?t:new e({type:`nonoptional`,innerType:t})),y(t,v(t._zod.def,{shape:i}))}function ke(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 Ae(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 je(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function Me(e){return typeof e==`string`?e:e?.message}function Ne(e){let t=[];for(let n of e??[]){let e=n._zod.def;if(!/_(length|size)$|_equals$/.test(e.check))break;let r=e.maximum??e.length??e.size;r>=0&&t.push([r,n])}return t}function Pe(e,t,n){var r;for(let i=t;i<e.length;i++)(r=e[i]).schema??(r.schema=n)}function Fe(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:Me(e.inst?._zod.def?.error?.(e))??Me(a?.(e))??Me(t?.error?.(e))??Me(n.customError?.(e))??Me(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 Ie=/[\uD800-\uDBFF]/;function Le(e){let t=e.length;if(!Ie.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 Re(e){return Array.isArray(e)?`array`:typeof e==`string`?`string`:`unknown`}function ze(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 Be(...e){let[t,n,r]=e;return typeof t==`string`?{message:t,code:`custom`,input:n,inst:r}:{...t}}function Ve(e,t){for(let n in t){let r=Object.getOwnPropertyDescriptor(t,n);r.get?Object.defineProperty(e,n,{...r,enumerable:!1}):Ge(e,n,r.value)}}function He(e,t,n,r=!0){return Object.defineProperty(e,t,{configurable:!0,writable:!0,enumerable:r,value:n}),n}function Ue(e,t,n){return He(e,t,n,!1)}function We(e,t){for(let n in e){let r=e[n];Object.defineProperty(t,n,{configurable:!0,enumerable:!0,get(){return He(this,n,r(this))},set(e){He(this,n,e)}})}return t}function Ge(e,t,n){Object.defineProperty(e,t,{configurable:!0,get(){return this==null?n:He(this,t,n.bind(this))},set(e){He(this,t,e)}})}function Ke(e,t){let n=Object.getPrototypeOf(e);return t in n?void 0:n}var qe,Je=!1,Ye={configurable:!0,get(){Je=!0}};function x(e,t,n){let r=Object.getPrototypeOf(e._zod);if(t in r&&qe!==e._zod){qe=void 0;return}qe=e._zod,Object.defineProperty(r,t,{configurable:!0,get(){Object.defineProperty(this,t,Ye);let e=Je;Je=!1;try{let r=n(this);return Je?delete this[t]:Object.defineProperty(this,t,{configurable:!0,writable:!0,value:r}),Je||=e,r}catch(n){throw delete this[t],Je||=e,n}},set(e){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:e})}})}function Xe(e,t,n,r){let i=Ke(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 Ze=`~constantCatch`;function Qe(e){let t=()=>e;return t[Ze]=!0,t}var $e,et=Object.freeze({status:`aborted`}),tt={value:void 0,enumerable:!1},nt=`captureStackTrace`in Error?Error:null;function rt(e){let t=nt;if(t){let n=t.stackTraceLimit;if(typeof n==`number`){try{t.stackTraceLimit=0}catch{return nt=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){tt.value=new a(r);try{Object.defineProperty(n,"_zod",tt)}finally{tt.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),Ve(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?rt(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 it=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}},C=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name=`ZodEncodeError`}};($e=globalThis).__zod_globalConfig??($e.__zod_globalConfig={});var w=globalThis.__zod_globalConfig;function at(e){return e&&Object.assign(w,e),w}function ot(){let e=this._zod;return e.message??=JSON.stringify(e.def,u,2),e.message}function st(e){this._zod.message=e}var ct={get:ot,set:st,enumerable:!0,configurable:!0},lt={value:void 0,enumerable:!1},ut=new WeakSet([Object.prototype,Error.prototype]),dt=(e,t)=>{e.name=`$ZodError`,lt.value=t,Object.defineProperty(e,"issues",lt),lt.value=void 0,Object.defineProperty(e,"message",ct);let n=Object.getPrototypeOf(e);ut.has(n)||(ut.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})}}))},ft=S(`$ZodError`,dt);S(`$ZodError`,dt,void 0,{Parent:Error});function pt(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 mt(e,t=e=>e.message){let n={},r=[];for(let i of e.issues)i.path.length>0?pt(n,i.path[0],()=>[]).push(t(i)):r.push(t(i));return{formErrors:r,fieldErrors:n}}function ht(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 gt(e,t){return{callee:t?.callee??e,Err:t?.Err}}var _t=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 it;if(s.issues.length){let n=new((a?.Err)??e)(s.issues.map(e=>Fe(e,o,at())));throw le(n,a?.callee??t),n}return s.value};return t},vt=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=>Fe(e,o,at())));throw le(n,a?.callee??t),n}return s.value};return t},yt=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 it;return a.issues.length?bt(e,a.issues,i):{success:!0,data:a.value}};function bt(e,t,n){let r;return{success:!1,get error(){return r||(r=new e(t.map(e=>Fe(e,n,at()))),t=void 0,n=void 0),r},set error(e){r=e,t=void 0,n=void 0}}}var xt=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?bt(e,a.issues,i):{success:!0,data:a.value}},St=Symbol.for(`zod.compile.invalid`),Ct=Symbol.for(`zod.compile.fallback`),wt=((e,t,n)=>{let r=e._zod.bag.validator;if(r!==void 0){if(r(t)!==St)return!0;if(r.definite===!0&&n===void 0)return!1}return Tt(e,t,n)});function Tt(e,t,n){let r=n?{...n,async:!1,abortEarly:!0}:{async:!1,abortEarly:!0},i=e._zod.bag.fallbackRun,a;if(i?(r[Ct]=!0,a=i({value:t,issues:[]},r)):a=e._zod.run({value:t,issues:[]},r),a instanceof Promise)throw new it;return a.issues.length===0}var Et=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},Dt=e=>{let t=_t(e),n=(e,r,i,a)=>{let o=i?{...i,direction:`backward`}:{direction:`backward`};return t(e,r,o,gt(n,a))};return n},Ot=e=>{let t=_t(e),n=(e,r,i,a)=>t(e,r,i,gt(n,a));return n},kt=e=>{let t=vt(e),n=async(e,r,i,a)=>{let o=i?{...i,direction:`backward`}:{direction:`backward`};return await t(e,r,o,gt(n,a))};return n},At=e=>{let t=vt(e),n=async(e,r,i,a)=>await t(e,r,i,gt(n,a));return n},jt=e=>(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return yt(e)(t,n,i)},Mt=e=>(t,n,r)=>yt(e)(t,n,r),Nt=e=>async(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return xt(e)(t,n,i)},Pt=e=>async(t,n,r)=>xt(e)(t,n,r),Ft=/^[cC][0-9a-z]{6,}$/,It=/^[0-9a-z]+$/,Lt=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/,Rt=/^[0-9a-vA-V]{20}$/,zt=/^[A-Za-z0-9]{27}$/,Bt=/^[a-zA-Z0-9_-]{21}$/;function Vt(e){return RegExp(`^[a-zA-Z0-9_-]{${e}}$`)}var Ht=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Ut=/^([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})$/,Wt=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)$/,Gt=/^(?:[A-Za-z0-9_'+\-]+\.)*[A-Za-z0-9_'+\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,Kt=`^(?=[\\s\\S]*[\\p{Extended_Pictographic}\\p{Regional_Indicator}\\u20E3])[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$`;function qt(){return new RegExp(Kt,`u`)}var Jt=/^(?:(?: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])$/,Yt=/^(([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}|:))$/,Xt=/^((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])$/,Zt=/^(([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}=))?$/,$t=/^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$/,en=/^https?$/,tn=/^\+[1-9]\d{6,14}$/,nn=`(?:(?:\\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 rn(e){return RegExp(`^${e}$`)}var an=rn(nn);function on(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 T(e){return RegExp(`^${on(e)}$`)}function sn(e){let t=[`Z`];e.offset&&t.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);let n=`${on({precision:e.precision,seconds:!0})}(?:${t.join(`|`)})`,r=e.local?`${n}|${on({precision:e.precision})}`:n;return RegExp(`^${nn}T(?:${r})$`)}var cn=/^[\s\S]{0,}$/,ln=/^-?\d+$/,un=/^-?\d+(?:\.\d+)?$/,dn=/^(?:true|false)$/i,fn=/^null$/i,pn=/^undefined$/i,mn=/^[^A-Z]*$/,hn=/^[^a-z]*$/,gn=S(`$ZodCheck`,(e,t)=>{var n;e._zod??={},e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),_n=e=>{let t=e.value;return!p(t)&&t.length!==void 0},vn={number:`number`,bigint:`bigint`,object:`date`},yn=S(`$ZodCheckLessThan`,(e,t)=>{gn.init(e,t);let n=vn[typeof t.value];e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:vn[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})}}),bn=S(`$ZodCheckGreaterThan`,(e,t)=>{gn.init(e,t);let n=vn[typeof t.value];e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:vn[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})}}),xn=S(`$ZodCheckMultipleOf`,(e,t)=>{gn.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):h(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})}}),Sn=S(`$ZodCheckNumberFormat`,(e,t)=>{gn.init(e,t),t.format=t.format||`float64`;let n=t.format?.includes(`int`),r=n?`int`:`number`,[i,a]=ve[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})}}),Cn=S(`$ZodCheckMaxLength`,(e,t)=>{var n;gn.init(e,t),(n=e._zod.def).when??(n.when=_n),e._zod.check=n=>{let r=n.value,i=r.length;if((typeof r==`string`&&i>t.maximum?Le(r):i)<=t.maximum)return;let a=Re(r);n.issues.push({origin:a,code:`too_big`,maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),wn=S(`$ZodCheckMinLength`,(e,t)=>{var n;gn.init(e,t),(n=e._zod.def).when??(n.when=_n),e._zod.check=n=>{let r=n.value,i=r.length;if((typeof r==`string`&&i>=t.minimum&&i<t.minimum*2?Le(r):i)>=t.minimum)return;let a=Re(r);n.issues.push({origin:a,code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),Tn=S(`$ZodCheckLengthEquals`,(e,t)=>{var n;gn.init(e,t),(n=e._zod.def).when??(n.when=_n),e._zod.check=n=>{let r=n.value,i=r.length,a=typeof r==`string`&&i>=t.length&&i<=t.length*2?Le(r):i;if(a===t.length)return;let o=Re(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})}}),En=S(`$ZodCheckStringFormat`,(e,t)=>{var n,r;gn.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=()=>{})}),Dn=S(`$ZodCheckRegex`,(e,t)=>{En.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})}}),On=S(`$ZodCheckLowerCase`,(e,t)=>{t.pattern??=mn,En.init(e,t)}),kn=S(`$ZodCheckUpperCase`,(e,t)=>{t.pattern??=hn,En.init(e,t)}),An=S(`$ZodCheckIncludes`,(e,t)=>{gn.init(e,t);let n=he(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})}}),jn=S(`$ZodCheckStartsWith`,(e,t)=>{gn.init(e,t);let n=RegExp(`^${he(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})}}),Mn=S(`$ZodCheckEndsWith`,(e,t)=>{gn.init(e,t);let n=RegExp(`.*${he(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})}}),Nn=S(`$ZodCheckOverwrite`,(e,t)=>{gn.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}}),Pn=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(`
|
|
12
12
|
`).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(`
|
|
13
|
-
`)}\n};`)(...Object.values(this.closed))}},Pn={major:4,minor:6,patch:5},E=S(`$ZodType`,(e,t)=>{var n;e??={},e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Pn;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=ke(t),a;for(let o of n){if(o._zod.def.when){if(Ae(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 rt;if(a||s instanceof Promise)a=(a??Promise.resolve()).then(async()=>{await s,t.issues.length!==n&&(Ne(t.issues,n,e),i||=ke(t,n))});else{if(t.issues.length===n)continue;Ne(t.issues,n,e),i||=ke(t,n)}}return a?a.then(()=>t):t},n=(n,r,a)=>{if(ke(n))return n.aborted=!0,n;let o=t(r,i,a);if(o instanceof Promise){if(a.async===!1)throw new rt;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 rt;return o.then(e=>t(e,i,a))}return t(o,i,a)}}},{get"~standard"(){return He(this,`~standard`,Ln(this))},set"~standard"(e){Ve(this,`~standard`,e)}}),Fn=(e,t)=>e.issues.length?{issues:e.issues.map(e=>Pe(e,t,w()))}:{value:e.value};async function In(e,t){let n={async:!0};return Fn(await e._zod.run({value:t,issues:[]},n),n)}function Ln(e){return{validate:t=>{let n={async:!1};try{let r=e._zod.run({value:t,issues:[]},n);if(!(r instanceof Promise))return Fn(r,n)}catch{}return In(e,t)},vendor:`zod`,version:1}}var Rn=S(`$ZodString`,(e,t)=>{E.init(e,t),e._zod.pattern=t.pattern??sn,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}}),D=S(`$ZodStringFormat`,(e,t)=>{Tn.init(e,t),Rn.init(e,t)}),zn=S(`$ZodGUID`,(e,t)=>{t.pattern??=Ht,D.init(e,t)}),Bn=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??=Ut(e)}else t.pattern??=Ut();D.init(e,t)}),Vn=S(`$ZodEmail`,(e,t)=>{t.pattern??=Wt,D.init(e,t)});function Hn(e){try{return typeof URL<`u`&&typeof URL.canParse==`function`?URL.canParse(e):(new URL(e),!0)}catch{return!1}}function Un(e,t){return!(`normalize`in t)&&!(`hostname`in t)&&!(`protocol`in t)?Hn(e)||2:Wn(e,t)}function Wn(e,t){if(!t.normalize&&t.protocol?.source===$t.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 Gn=/[\t\n\r]/g;function Kn(e){return e.replace(Gn,``)}function qn(e,t){return t.lastIndex=0,t.test(e.hostname)}function Jn(e,t){return t.lastIndex=0,t.test(e.protocol.endsWith(`:`)?e.protocol.slice(0,-1):e.protocol)}var Yn=S(`$ZodURL`,(e,t)=>{D.init(e,t),e._zod.check=n=>{try{let r=n.value.trim(),i=Un(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=Kn(r);return}t.hostname&&!qn(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&&!Jn(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:Kn(r);return}catch{n.issues.push({code:`invalid_format`,format:`url`,input:n.value,inst:e,continue:!t.abort})}}}),Xn=S(`$ZodEmoji`,(e,t)=>{t.pattern??=Kt(),D.init(e,t)}),Zn=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?zt:Bt(t.length),D.init(e,t)}),Qn=S(`$ZodCUID`,(e,t)=>{t.pattern??=Pt,D.init(e,t)}),$n=S(`$ZodCUID2`,(e,t)=>{t.pattern??=Ft,D.init(e,t)}),er=S(`$ZodULID`,(e,t)=>{t.pattern??=It,D.init(e,t)}),tr=S(`$ZodXID`,(e,t)=>{t.pattern??=Lt,D.init(e,t)}),nr=S(`$ZodKSUID`,(e,t)=>{t.pattern??=Rt,D.init(e,t)}),rr=S(`$ZodISODateTime`,(e,t)=>{t.pattern??=T(t),D.init(e,t)}),ir=S(`$ZodISODate`,(e,t)=>{t.pattern??=rn,D.init(e,t)}),ar=S(`$ZodISOTime`,(e,t)=>{t.pattern??=on(t),D.init(e,t)}),or=S(`$ZodISODuration`,(e,t)=>{t.pattern??=Vt,D.init(e,t)}),sr=S(`$ZodIPv4`,(e,t)=>{t.pattern??=qt,D.init(e,t)}),cr=/^[0-9a-fA-F:.]+$/;function lr(e){return cr.test(e)?Hn(`http://[${e}]`):!1}var ur=S(`$ZodIPv6`,(e,t)=>{t.pattern??=Jt,D.init(e,t),e._zod.check=n=>{lr(n.value)||n.issues.push({code:`invalid_format`,format:`ipv6`,input:n.value,inst:e,continue:!t.abort})}}),dr=S(`$ZodCIDRv4`,(e,t)=>{t.pattern??=Yt,D.init(e,t)});function fr(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:lr(n)}var pr=S(`$ZodCIDRv6`,(e,t)=>{t.pattern??=Xt,D.init(e,t),e._zod.check=n=>{fr(n.value)||n.issues.push({code:`invalid_format`,format:`cidrv6`,input:n.value,inst:e,continue:!t.abort})}});function mr(e){if(e===``)return!0;if(/\s/.test(e)||e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}var hr=/^[0-9a-zA-Z+/]*={0,2}$/,gr=S(`$ZodBase64`,(e,t)=>{t.pattern??=hr,D.init(e,t),e._zod.check=n=>{mr(n.value)||n.issues.push({code:`invalid_format`,format:`base64`,input:n.value,inst:e,continue:!t.abort})}}),_r=/^[A-Za-z0-9_-]*$/;function vr(e){if(!_r.test(e))return!1;let t=e.replace(/[-_]/g,e=>e===`-`?`+`:`/`);return mr(t.padEnd(Math.ceil(t.length/4)*4,`=`))}var yr=S(`$ZodBase64URL`,(e,t)=>{t.pattern??=_r,D.init(e,t),e._zod.check=n=>{vr(n.value)||n.issues.push({code:`invalid_format`,format:`base64url`,input:n.value,inst:e,continue:!t.abort})}}),br=S(`$ZodE164`,(e,t)=>{t.pattern??=en,D.init(e,t)});function xr(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 Sr=S(`$ZodJWT`,(e,t)=>{D.init(e,t),e._zod.check=n=>{xr(n.value,t.alg)||n.issues.push({code:`invalid_format`,format:`jwt`,input:n.value,inst:e,continue:!t.abort})}}),Cr=S(`$ZodNumber`,(e,t)=>{E.init(e,t),e._zod.pattern=ln,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}}),wr=S(`$ZodNumberFormat`,(e,t)=>{xn.init(e,t),Cr.init(e,t)}),Tr=S(`$ZodBoolean`,(e,t)=>{E.init(e,t),e._zod.pattern=un,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}}),Er=S(`$ZodUndefined`,(e,t)=>{E.init(e,t),e._zod.pattern=fn,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}}),Dr=S(`$ZodNull`,(e,t)=>{E.init(e,t),e._zod.pattern=dn,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}}),Or=S(`$ZodAny`,(e,t)=>{E.init(e,t),e._zod.parse=e=>e}),kr=S(`$ZodUnknown`,(e,t)=>{E.init(e,t),e._zod.parse=e=>e}),Ar=S(`$ZodNever`,(e,t)=>{E.init(e,t),e._zod.parse=(t,n)=>(t.issues.push({expected:`never`,code:`invalid_type`,input:t.value,inst:e}),t)});function jr(e,t,n){e.issues.length&&t.issues.push(...je(n,e.issues)),t.value[n]=e.value}var Mr=S(`$ZodArray`,(e,t)=>{E.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=>jr(t,r,e)));else if(jr(c,r,e),s&&c.issues.length!==0&&ke(c))break}return o.length?Promise.all(o).then(()=>r):r}});function Nr(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(...je(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 Pr=[];function Fr(e){let t=Object.keys(e.shape),n=Object.getOwnPropertySymbols(e.shape),r=n.length?n:Pr,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=_e(e.shape);return{...e,allKeys:i,symbolKeys:r,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(a)}}function Ir(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(ke(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=>Nr(e,n,i,t,d,f))):Nr(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 Lr=S(`$ZodObject`,(e,t)=>{E.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=f(()=>Fr(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)||g(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=ue,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(ke(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=>Nr(n,t,e,r,a,o))):Nr(s,t,e,r,a,o)}return o?Ir(l,r,t,n,i.value,e,d===!0):l.length?Promise.all(l).then(()=>t):t}}),Rr=S(`$ZodObjectJIT`,(e,t)=>{Lr.init(e,t);let n=e._zod.parse,r=f(()=>Fr(t)),i=C.memoizer,a=t=>{let n=r.value,a=n.symbolKeys,o=new Nn([`payload`,`ctx`],{shape:t,inst:e,memo:i,syms:a}),s=e=>`shape[${e}]._zod.run({ value: input[${e}], issues: [] }, ctx)`,c=(e,t)=>`
|
|
13
|
+
`)}\n};`)(...Object.values(this.closed))}},Fn={major:4,minor:6,patch:7},E=S(`$ZodType`,(e,t)=>{var n;e??={},e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Fn;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=ke(t),a;for(let o of n){if(o._zod.def.when){if(Ae(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 it;if(a||s instanceof Promise)a=(a??Promise.resolve()).then(async()=>{await s,t.issues.length!==n&&(Pe(t.issues,n,e),i||=ke(t,n))});else{if(t.issues.length===n)continue;Pe(t.issues,n,e),i||=ke(t,n)}}return a?a.then(()=>t):t},n=(n,r,a)=>{if(ke(n))return n.aborted=!0,n;let o=t(r,i,a);if(o instanceof Promise){if(a.async===!1)throw new it;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 it;return o.then(e=>t(e,i,a))}return t(o,i,a)}}},{get"~standard"(){return Ue(this,`~standard`,Rn(this))},set"~standard"(e){He(this,`~standard`,e)}}),In=(e,t)=>e.issues.length?{issues:e.issues.map(e=>Fe(e,t,at()))}:{value:e.value};async function Ln(e,t){let n={async:!0};return In(await e._zod.run({value:t,issues:[]},n),n)}function Rn(e){return{validate:t=>{let n={async:!1};try{let r=e._zod.run({value:t,issues:[]},n);if(!(r instanceof Promise))return In(r,n)}catch{}return Ln(e,t)},vendor:`zod`,version:1}}var zn=S(`$ZodString`,(e,t)=>{E.init(e,t),e._zod.pattern=t.pattern??cn,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}}),D=S(`$ZodStringFormat`,(e,t)=>{En.init(e,t),zn.init(e,t)}),Bn=S(`$ZodGUID`,(e,t)=>{t.pattern??=Ut,D.init(e,t)}),Vn=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??=Wt(e)}else t.pattern??=Wt();D.init(e,t)}),Hn=S(`$ZodEmail`,(e,t)=>{t.pattern??=Gt,D.init(e,t)});function Un(e){try{return typeof URL<`u`&&typeof URL.canParse==`function`?URL.canParse(e):(new URL(e),!0)}catch{return!1}}function Wn(e,t){return!(`normalize`in t)&&!(`hostname`in t)&&!(`protocol`in t)?Un(e)||2:Gn(e,t)}function Gn(e,t){if(!t.normalize&&t.protocol?.source===en.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 Kn=/[\t\n\r]/g;function qn(e){return e.replace(Kn,``)}function Jn(e,t){return t.lastIndex=0,t.test(e.hostname)}function Yn(e,t){return t.lastIndex=0,t.test(e.protocol.endsWith(`:`)?e.protocol.slice(0,-1):e.protocol)}var Xn=S(`$ZodURL`,(e,t)=>{D.init(e,t),e._zod.check=n=>{try{let r=n.value.trim(),i=Wn(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=qn(r);return}t.hostname&&!Jn(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&&!Yn(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:qn(r);return}catch{n.issues.push({code:`invalid_format`,format:`url`,input:n.value,inst:e,continue:!t.abort})}}}),Zn=S(`$ZodEmoji`,(e,t)=>{t.pattern??=qt(),D.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?Bt:Vt(t.length),D.init(e,t)}),$n=S(`$ZodCUID`,(e,t)=>{t.pattern??=Ft,D.init(e,t)}),er=S(`$ZodCUID2`,(e,t)=>{t.pattern??=It,D.init(e,t)}),tr=S(`$ZodULID`,(e,t)=>{t.pattern??=Lt,D.init(e,t)}),nr=S(`$ZodXID`,(e,t)=>{t.pattern??=Rt,D.init(e,t)}),rr=S(`$ZodKSUID`,(e,t)=>{t.pattern??=zt,D.init(e,t)}),ir=S(`$ZodISODateTime`,(e,t)=>{t.pattern??=sn(t),D.init(e,t)}),ar=S(`$ZodISODate`,(e,t)=>{t.pattern??=an,D.init(e,t)}),or=S(`$ZodISOTime`,(e,t)=>{t.pattern??=T(t),D.init(e,t)}),sr=S(`$ZodISODuration`,(e,t)=>{t.pattern??=Ht,D.init(e,t)}),cr=S(`$ZodIPv4`,(e,t)=>{t.pattern??=Jt,D.init(e,t)}),lr=/^[0-9a-fA-F:.]+$/;function ur(e){return lr.test(e)?Un(`http://[${e}]`):!1}var dr=S(`$ZodIPv6`,(e,t)=>{t.pattern??=Yt,D.init(e,t),e._zod.check=n=>{ur(n.value)||n.issues.push({code:`invalid_format`,format:`ipv6`,input:n.value,inst:e,continue:!t.abort})}}),fr=S(`$ZodCIDRv4`,(e,t)=>{t.pattern??=Xt,D.init(e,t)});function pr(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:ur(n)}var mr=S(`$ZodCIDRv6`,(e,t)=>{t.pattern??=Zt,D.init(e,t),e._zod.check=n=>{pr(n.value)||n.issues.push({code:`invalid_format`,format:`cidrv6`,input:n.value,inst:e,continue:!t.abort})}});function hr(e){if(e===``)return!0;if(/\s/.test(e)||e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}var gr=/^[0-9a-zA-Z+/]*={0,2}$/,_r=S(`$ZodBase64`,(e,t)=>{t.pattern??=gr,D.init(e,t),e._zod.check=n=>{hr(n.value)||n.issues.push({code:`invalid_format`,format:`base64`,input:n.value,inst:e,continue:!t.abort})}}),vr=/^[A-Za-z0-9_-]*$/;function yr(e){if(!vr.test(e))return!1;let t=e.replace(/[-_]/g,e=>e===`-`?`+`:`/`);return hr(t.padEnd(Math.ceil(t.length/4)*4,`=`))}var br=S(`$ZodBase64URL`,(e,t)=>{t.pattern??=vr,D.init(e,t),e._zod.check=n=>{yr(n.value)||n.issues.push({code:`invalid_format`,format:`base64url`,input:n.value,inst:e,continue:!t.abort})}}),xr=S(`$ZodE164`,(e,t)=>{t.pattern??=tn,D.init(e,t)});function Sr(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 Cr=S(`$ZodJWT`,(e,t)=>{D.init(e,t),e._zod.check=n=>{Sr(n.value,t.alg)||n.issues.push({code:`invalid_format`,format:`jwt`,input:n.value,inst:e,continue:!t.abort})}}),wr=S(`$ZodNumber`,(e,t)=>{E.init(e,t),e._zod.pattern=un,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}}),Tr=S(`$ZodNumberFormat`,(e,t)=>{Sn.init(e,t),wr.init(e,t)}),Er=S(`$ZodBoolean`,(e,t)=>{E.init(e,t),e._zod.pattern=dn,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}}),Dr=S(`$ZodUndefined`,(e,t)=>{E.init(e,t),e._zod.pattern=pn,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}}),Or=S(`$ZodNull`,(e,t)=>{E.init(e,t),e._zod.pattern=fn,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}}),kr=S(`$ZodAny`,(e,t)=>{E.init(e,t),e._zod.parse=e=>e}),Ar=S(`$ZodUnknown`,(e,t)=>{E.init(e,t),e._zod.parse=e=>e}),jr=S(`$ZodNever`,(e,t)=>{E.init(e,t),e._zod.parse=(t,n)=>(t.issues.push({expected:`never`,code:`invalid_type`,input:t.value,inst:e}),t)});function Mr(e,t){let n=Ne(e._zod.def.checks);if(!n.length)return;let r=Math.min(...n.map(e=>e[0])),i=e._zod.parse;e._zod.parse=(n,a)=>{let o=t(n.value);if(o>r&&!a?.skipChecks&&a?.direction!==`backward`){for(let[t,r]of Ne(e._zod.def.checks))if(o>t&&r._zod.def.when(n)){let t=n.issues.length;return r._zod.check(n),n.issues[t].continue=!1,Pe(n.issues,t,e),n}}return i(n,a)}}var Nr=e=>Array.isArray(e)?e.length:-1;function Pr(e,t,n){e.issues.length&&t.issues.push(...je(n,e.issues)),t.value[n]=e.value}var Fr=S(`$ZodArray`,(e,t)=>{E.init(e,t);let n=w.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=>Pr(t,r,e)));else if(Pr(c,r,e),s&&c.issues.length!==0&&ke(c))break}return o.length?Promise.all(o).then(()=>r):r},Mr(e,Nr)});function Ir(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(...je(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 Lr=[];function Rr(e){let t=Object.keys(e.shape),n=Object.getOwnPropertySymbols(e.shape),r=n.length?n:Lr,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=_e(e.shape);return{...e,allKeys:i,symbolKeys:r,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(a)}}function zr(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(ke(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=>Ir(e,n,i,t,d,f))):Ir(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 Br=S(`$ZodObject`,(e,t)=>{E.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=f(()=>Rr(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)||g(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=ue,o=t.catchall,s,c=w.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(ke(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=>Ir(n,t,e,r,a,o))):Ir(s,t,e,r,a,o)}return o?zr(l,r,t,n,i.value,e,d===!0):l.length?Promise.all(l).then(()=>t):t}}),Vr=S(`$ZodObjectJIT`,(e,t)=>{Br.init(e,t);let n=e._zod.parse,r=f(()=>Rr(t)),i=w.memoizer,a=t=>{let n=r.value,a=n.symbolKeys,o=new Pn([`payload`,`ctx`],{shape:t,inst:e,memo:i,syms:a}),s=e=>`shape[${e}]._zod.run({ value: input[${e}], issues: [] }, ctx)`,c=(e,t)=>`
|
|
14
14
|
let ${e}_ab = false;
|
|
15
15
|
for (let i = 0; i < ${e}.issues.length; i++) {
|
|
16
16
|
const iss = ${e}.issues[i];
|
|
@@ -60,15 +60,15 @@ function e(e){return/^(--- |\+\+\+ |diff --git |index )/.test(e)?`file`:e.starts
|
|
|
60
60
|
newResult[${r}] = ${n}.value;
|
|
61
61
|
}
|
|
62
62
|
|
|
63
|
-
`)}return o.write(`payload.value = newResult;`),o.write(`return payload;`),o.compile()},o,s=ue,c=!C.jitless,l=c&&de.value,u=t.catchall,d;e._zod.parse=(i,f)=>{d??=r.value;let p=i.value;return s(p)?c&&l&&f?.async===!1&&f.jitless!==!0?(o||=a(t.shape),i=o(i,f),u?Ir([],p,i,f,d,e,f?.abortEarly===!0):i):n(i,f):(i.issues.push({expected:`object`,code:`invalid_type`,input:p,inst:e}),i)}});function zr(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=>!ke(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=>Pe(e,r,w())))}),t)}var Br=S(`$ZodUnion`,(e,t)=>{E.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=>m(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=>zr(t,r,e,i)):zr(o,r,e,i)}});function Vr(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 Hr=S(`$ZodDiscriminatedUnion`,(e,t)=>{t.inclusive=!1,Br.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)||g(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=ne(e._zod.def);if(r&&!Object.prototype.hasOwnProperty.call(r,t.discriminator))throw Error(`Invalid discriminated union option at index "${n}"`)});let r=f(()=>Vr(t));e._zod.parse=(i,a)=>{let o=i.value;if(!ue(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)}}),Ur=S(`$ZodIntersection`,(e,t)=>{E.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])=>Gr(e,t,n)):Gr(e,i,a)}});function Wr(e,t){if(e===t||e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(fe(e)&&fe(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 Gr(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(ke(e))return e;throw Error(`Unmergable intersection. Error path: ${JSON.stringify(c.mergeErrorPath)}`)}return e.value=c.data,e}var Kr=S(`$ZodRecord`,(e,t)=>{E.init(e,t);let n=C.memoizer;n?.attach(e),e._zod.parse=(r,i)=>{let a=r.value;if(!fe(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=>Pe(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(...je(n,e.issues)),r.value[l]=e.value})):(u.issues.length&&r.issues.push(...je(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`&&ln.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=>Pe(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(...je(n,e.issues)),r.value[u]=e.value})):(d.issues.length&&r.issues.push(...je(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}}),qr=S(`$ZodEnum`,(e,t)=>{E.init(e,t);let n=c(t.entries),r=new Set(n);e._zod.values=r,x(e,`pattern`,e=>{let t=c(e.def.entries).filter(e=>me.has(typeof e));return RegExp(t.length?`^(${t.map(e=>he(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}}),Jr=S(`$ZodLiteral`,(e,t)=>{E.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`?he(e):e?he(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}}),Yr=S(`$ZodTransform`,(e,t)=>{E.init(e,t),e._zod.optin=`optional`,C.memoizer?.guard(e),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new it(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 rt;return n.value=i,n}});function Xr(e,t){return e.value=t.issues.length?void 0:t.value,e}var Zr=S(`$ZodOptional`,(e,t)=>{E.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(`^(${m(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=>Xr(e,t)):Xr(e,r)}return t.innerType._zod.run(e,n)}}),Qr=S(`$ZodExactOptional`,(e,t)=>{Zr.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)}),$r=S(`$ZodNullable`,(e,t)=>{E.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(`^(${m(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)}),ei=S(`$ZodDefault`,(e,t)=>{E.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=>ti(e,t)):ti(r,t)}});function ti(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}var ni=S(`$ZodPrefault`,(e,t)=>{E.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))}),ri=S(`$ZodNonOptional`,(e,t)=>{E.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=>ii(t,e)):ii(i,e)}});function ii(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 ai(e,t,n,r){return t.issues.length?(e.value=n.catchValue({...t,value:e.value,error:{issues:t.issues.map(e=>Pe(e,r,w()))},input:e.value}),e):(e.value=t.value,t.memo&&(e.memo=!0),e)}var oi=S(`$ZodCatch`,(e,t)=>{E.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=>ai(e,r,t,n)):ai(e,r,t,n)}}),si=S(`$ZodPipe`,(e,t)=>{E.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=>ci(e,t.in,n)):ci(r,t.in,n)}let r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>ci(e,t.out,n)):ci(r,t.out,n)}});function ci(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 li=S(`$ZodPreprocess`,(e,t)=>{si.init(e,t)}),ui=S(`$ZodReadonly`,(e,t)=>{E.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(di):di(r)}});function di(e){return e.memo||(e.value=Object.freeze(e.value)),e}var fi=S(`$ZodLazy`,(e,t)=>{E.init(e,t),te(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)}),pi=S(`$ZodCustom`,(e,t)=>{hn.init(e,t),E.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=>mi(t,n,r,e));mi(i,n,r,e)}});function mi(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(ze(e))}}var hi=class extends Error{constructor(){super(`Cannot parse a reference cycle that closes through a transform`),this.name=`ZodCyclicError`}},gi=`~memo`,_i=[];function vi(e){return typeof e==`object`&&!!e}function yi(e){return e.map(e=>e.path?{...e,path:e.path.slice()}:{...e})}var bi=new WeakMap,xi=0,Si=1,Ci=2;function wi(e,t,n){let r=bi.get(e);if(r!==void 0)return r?Ci:xi;if(t.has(e))return Ci;t.add(e);let i=xi,a=e=>{if(i!==Ci&&e?._zod){let r=wi(e,t,n);r>i&&(i=r)}},o=(e,r)=>{let i=xi;for(let a of Reflect.ownKeys(e)){let o=Object.getOwnPropertyDescriptor(e,a);if(r&&!o.enumerable)continue;let s=o.get?Si:o.value?._zod?wi(o.value,t,n):xi;s>i&&(i=s)}return i},s=e=>{e>i&&(i=e)},c=e._zod.def;switch(c.type){case`object`:{let e=ne(c);s(e?o(e,!0):Si),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?wi(r,t,!1):Si);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),Ti(e,i)}function Ti(e,t){return t!==Si&&bi.set(e,t===Ci),t}function Ei(e,t){let n=e.buckets.get(t);return n||(n=new WeakMap,e.buckets.set(t,n)),n}var Di,Oi=[],ki={alloc(e,t,n){let r=Di;if(!r)return n;Di=void 0;let i={value:n,issues:null};return r.set(t.value,i),Oi.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`&&ji(n,e.value))throw new hi;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=wi(e,new Set,!1);if(i===xi)return e._zod.parse=t,e._zod.run===o&&(e._zod.run=t),t(s,c);i===Ci||r?n=!0:r=!0}let l=s.value;if(!vi(l))return t(s,c);let u=c[gi];u||(u={buckets:new WeakMap,backEdges:void 0},c[gi]=u);let d;i===c?d=a:(d=Ei(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(...yi(f.issues)):(s.memo=!0,u.backEdges??(u.backEdges=new WeakSet),u.backEdges.add(f.value)),s;Di=d;let p=Oi.length,m=t(s,c);Di=void 0;let h=Oi.length>p?Oi.pop():void 0;return m instanceof Promise?m.then(e=>(h&&(h.issues=e.issues.length?yi(e.issues):_i),e)):(h&&(h.issues=m.issues.length?yi(m.issues):_i),m)};e._zod.parse=o,e._zod.run===t&&(e._zod.run=o)})}};function Ai(){return ki}function ji(e,t){let n=e[gi]?.backEdges;return n!==void 0&&vi(t)&&n.has(t)}var Mi=()=>{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(Re(e.input),e.input)}`;case`invalid_value`:return e.values.length===1?`Invalid input: expected ${ge(e.values[0])}`:`Invalid option: expected one of ${l(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`:``}: ${l(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 Ni(){return{localeError:Mi()}}var Pi,Fi=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 Ii(){return new Fi}(Pi=globalThis).__zod_globalRegistry??(Pi.__zod_globalRegistry=Ii());var Li=globalThis.__zod_globalRegistry;function Ri(e){return e.checks&&=[...e.checks],e}function zi(e,t){return new e(Ri({type:`string`,...b(t)}))}function Bi(e,t){return new e({type:`string`,format:`email`,check:`string_format`,abort:!1,...b(t)})}function Vi(e,t){return new e({type:`string`,format:`guid`,check:`string_format`,abort:!1,...b(t)})}function Hi(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,...b(t)})}function Ui(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v4`,...b(t)})}function Wi(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v6`,...b(t)})}function Gi(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v7`,...b(t)})}function Ki(e,t){return new e({type:`string`,format:`url`,check:`string_format`,abort:!1,...b(t)})}function qi(e,t){return new e({type:`string`,format:`emoji`,check:`string_format`,abort:!1,...b(t)})}function Ji(e,t){return new e({type:`string`,format:`nanoid`,check:`string_format`,abort:!1,...b(t)})}function Yi(e,t){return new e({type:`string`,format:`cuid`,check:`string_format`,abort:!1,...b(t)})}function Xi(e,t){return new e({type:`string`,format:`cuid2`,check:`string_format`,abort:!1,...b(t)})}function Zi(e,t){return new e({type:`string`,format:`ulid`,check:`string_format`,abort:!1,...b(t)})}function Qi(e,t){return new e({type:`string`,format:`xid`,check:`string_format`,abort:!1,...b(t)})}function $i(e,t){return new e({type:`string`,format:`ksuid`,check:`string_format`,abort:!1,...b(t)})}function ea(e,t){return new e({type:`string`,format:`ipv4`,check:`string_format`,abort:!1,...b(t)})}function ta(e,t){return new e({type:`string`,format:`ipv6`,check:`string_format`,abort:!1,...b(t)})}function na(e,t){return new e({type:`string`,format:`cidrv4`,check:`string_format`,abort:!1,...b(t)})}function ra(e,t){return new e({type:`string`,format:`cidrv6`,check:`string_format`,abort:!1,...b(t)})}function ia(e,t){return new e({type:`string`,format:`base64`,check:`string_format`,abort:!1,...b(t)})}function aa(e,t){return new e({type:`string`,format:`base64url`,check:`string_format`,abort:!1,...b(t)})}function oa(e,t){return new e({type:`string`,format:`e164`,check:`string_format`,abort:!1,...b(t)})}function sa(e,t){return new e({type:`string`,format:`jwt`,check:`string_format`,abort:!1,...b(t)})}function ca(e,t){return new e({type:`string`,format:`datetime`,check:`string_format`,offset:!1,local:!1,precision:null,...b(t)})}function la(e,t){return new e({type:`string`,format:`date`,check:`string_format`,...b(t)})}function ua(e,t){return new e({type:`string`,format:`time`,check:`string_format`,precision:null,...b(t)})}function da(e,t){return new e({type:`string`,format:`duration`,check:`string_format`,...b(t)})}function fa(e,t){return new e(Ri({type:`number`,checks:[],...b(t)}))}function pa(e,t){return new e(Ri({type:`number`,coerce:!0,checks:[],...b(t)}))}function ma(e,t){return new e({type:`number`,check:`number_format`,abort:!1,format:`safeint`,...b(t)})}function ha(e,t){return new e({type:`boolean`,...b(t)})}function ga(e,t){return new e({type:`undefined`,...b(t)})}function _a(e,t){return new e({type:`null`,...b(t)})}function va(e){return new e({type:`any`})}function ya(e){return new e({type:`unknown`})}function ba(e,t){return new e({type:`never`,...b(t)})}function xa(e,t){return new vn({check:`less_than`,...b(t),value:e,inclusive:!1})}function Sa(e,t){return new vn({check:`less_than`,...b(t),value:e,inclusive:!0})}function Ca(e,t){return new yn({check:`greater_than`,...b(t),value:e,inclusive:!1})}function wa(e,t){return new yn({check:`greater_than`,...b(t),value:e,inclusive:!0})}function Ta(e,t){return new bn({check:`multiple_of`,...b(t),value:e})}function Ea(e,t){return new Sn({check:`max_length`,...b(t),maximum:e})}function Da(e,t){return new Cn({check:`min_length`,...b(t),minimum:e})}function Oa(e,t){return new wn({check:`length_equals`,...b(t),length:e})}function ka(e,t){return new En({check:`string_format`,format:`regex`,...b(t),pattern:e})}function Aa(e){return new Dn({check:`string_format`,format:`lowercase`,...b(e)})}function ja(e){return new On({check:`string_format`,format:`uppercase`,...b(e)})}function Ma(e,t){return new kn({check:`string_format`,format:`includes`,...b(t),includes:e})}function Na(e,t){return new An({check:`string_format`,format:`starts_with`,...b(t),prefix:e})}function Pa(e,t){return new jn({check:`string_format`,format:`ends_with`,...b(t),suffix:e})}function Fa(e){return new Mn({check:`overwrite`,tx:e})}function Ia(e){return Fa(t=>t.normalize(e))}function La(){return Fa(e=>e.trim())}function Ra(){return Fa(e=>e.toLowerCase())}function za(){return Fa(e=>e.toUpperCase())}function Ba(){return Fa(e=>ce(e))}function Va(e,t,n){return new e({type:`array`,element:t,...b(n)})}function Ha(e,t,n){return new e({type:`custom`,check:`custom`,fn:t,...b(n)})}function Ua(e,t){let n=Wa(t=>(t.addIssue=e=>{if(typeof e==`string`)t.issues.push(ze(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(ze(r))}},e(t.value,t)),t);return n}function Wa(e,t){let n=new hn({check:`custom`,...b(t)});return n._zod.check=e,n}function Ga(e,...t){for(let n of t)for(let t of Reflect.ownKeys(n))Object.prototype.propertyIsEnumerable.call(n,t)&&g(e,t,n[t]);return e}function Ka(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??Li,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 O(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 k(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,k(a,t,r),t.seen.get(a).isParent=!0)}let c=t.metadataRegistry.get(e);return c&&Ga(o.schema,c),t.io===`input`&&no(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 qa(e){return e.replace(/~/g,`~0`).replace(/\//g,`~1`)}function Ja(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}/${qa(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+qa(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>
|
|
63
|
+
`)}return o.write(`payload.value = newResult;`),o.write(`return payload;`),o.compile()},o,s=ue,c=!w.jitless,l=c&&de.value,u=t.catchall,d;e._zod.parse=(i,f)=>{d??=r.value;let p=i.value;return s(p)?c&&l&&f?.async===!1&&f.jitless!==!0?(o||=a(t.shape),i=o(i,f),u?zr([],p,i,f,d,e,f?.abortEarly===!0):i):n(i,f):(i.issues.push({expected:`object`,code:`invalid_type`,input:p,inst:e}),i)}});function Hr(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=>!ke(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=>Fe(e,r,at())))}),t)}var Ur=S(`$ZodUnion`,(e,t)=>{E.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=>m(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=>Hr(t,r,e,i)):Hr(o,r,e,i)}});function Wr(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 Gr=S(`$ZodDiscriminatedUnion`,(e,t)=>{t.inclusive=!1,Ur.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)||g(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=ne(e._zod.def);if(r&&!Object.prototype.hasOwnProperty.call(r,t.discriminator))throw Error(`Invalid discriminated union option at index "${n}"`)});let r=f(()=>Wr(t));e._zod.parse=(i,a)=>{let o=i.value;if(!ue(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)}}),Kr=S(`$ZodIntersection`,(e,t)=>{E.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])=>Jr(e,t,n)):Jr(e,i,a)}});function qr(e,t){if(e===t||e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(fe(e)&&fe(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=qr(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=qr(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 Jr(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=qr(t.value,n.value);if(!c.valid){if(ke(e))return e;throw Error(`Unmergable intersection. Error path: ${JSON.stringify(c.mergeErrorPath)}`)}return e.value=c.data,e}var Yr=S(`$ZodRecord`,(e,t)=>{E.init(e,t);let n=w.memoizer;n?.attach(e),e._zod.parse=(r,i)=>{let a=r.value;if(!fe(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=>Fe(e,i,at())),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(...je(n,e.issues)),r.value[l]=e.value})):(u.issues.length&&r.issues.push(...je(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`&&un.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=>Fe(e,i,at())),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(...je(n,e.issues)),r.value[u]=e.value})):(d.issues.length&&r.issues.push(...je(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}}),Xr=S(`$ZodEnum`,(e,t)=>{E.init(e,t);let n=c(t.entries),r=new Set(n);e._zod.values=r,x(e,`pattern`,e=>{let t=c(e.def.entries).filter(e=>me.has(typeof e));return RegExp(t.length?`^(${t.map(e=>he(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}}),Zr=S(`$ZodLiteral`,(e,t)=>{E.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`?he(e):e?he(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}}),Qr=S(`$ZodTransform`,(e,t)=>{E.init(e,t),e._zod.optin=`optional`,w.memoizer?.guard(e),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new C(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 it;return n.value=i,n}});function $r(e,t){return e.value=t.issues.length?void 0:t.value,e}var ei=S(`$ZodOptional`,(e,t)=>{E.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(`^(${m(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=>$r(e,t)):$r(e,r)}return t.innerType._zod.run(e,n)}}),ti=S(`$ZodExactOptional`,(e,t)=>{ei.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)}),ni=S(`$ZodNullable`,(e,t)=>{E.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(`^(${m(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)}),ri=S(`$ZodDefault`,(e,t)=>{E.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=>ii(e,t)):ii(r,t)}});function ii(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}var ai=S(`$ZodPrefault`,(e,t)=>{E.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))}),oi=S(`$ZodNonOptional`,(e,t)=>{E.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=>si(t,e)):si(i,e)}});function si(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 ci(e,t,n,r){return t.issues.length?(e.value=n.catchValue({...t,value:e.value,error:{issues:t.issues.map(e=>Fe(e,r,at()))},input:e.value}),e):(e.value=t.value,t.memo&&(e.memo=!0),e)}var li=S(`$ZodCatch`,(e,t)=>{E.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=>ci(e,r,t,n)):ci(e,r,t,n)}}),ui=S(`$ZodPipe`,(e,t)=>{E.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=>di(e,t.in,n)):di(r,t.in,n)}let r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>di(e,t.out,n)):di(r,t.out,n)}});function di(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 fi=S(`$ZodPreprocess`,(e,t)=>{ui.init(e,t)}),pi=S(`$ZodReadonly`,(e,t)=>{E.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(mi):mi(r)}});function mi(e){return e.memo||(e.value=Object.freeze(e.value)),e}var hi=S(`$ZodLazy`,(e,t)=>{E.init(e,t),te(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)}),gi=S(`$ZodCustom`,(e,t)=>{gn.init(e,t),E.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=>_i(t,n,r,e));_i(i,n,r,e)}});function _i(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(Be(e))}}var vi=class extends Error{constructor(){super(`Cannot parse a reference cycle that closes through a transform`),this.name=`ZodCyclicError`}},yi=`~memo`,bi=[];function xi(e){return typeof e==`object`&&!!e}function Si(e){return e.map(e=>e.path?{...e,path:e.path.slice()}:{...e})}var Ci=new WeakMap,wi=0,Ti=1,Ei=2;function Di(e,t,n){let r=Ci.get(e);if(r!==void 0)return r?Ei:wi;if(t.has(e))return Ei;t.add(e);let i=wi,a=e=>{if(i!==Ei&&e?._zod){let r=Di(e,t,n);r>i&&(i=r)}},o=(e,r)=>{let i=wi;for(let a of Reflect.ownKeys(e)){let o=Object.getOwnPropertyDescriptor(e,a);if(r&&!o.enumerable)continue;let s=o.get?Ti:o.value?._zod?Di(o.value,t,n):wi;s>i&&(i=s)}return i},s=e=>{e>i&&(i=e)},c=e._zod.def;switch(c.type){case`object`:{let e=ne(c);s(e?o(e,!0):Ti),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?Di(r,t,!1):Ti);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),Oi(e,i)}function Oi(e,t){return t!==Ti&&Ci.set(e,t===Ei),t}function ki(e,t){let n=e.buckets.get(t);return n||(n=new WeakMap,e.buckets.set(t,n)),n}var Ai,ji=[],Mi={alloc(e,t,n){let r=Ai;if(!r)return n;Ai=void 0;let i={value:n,issues:null};return r.set(t.value,i),ji.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`&&Pi(n,e.value))throw new vi;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=Di(e,new Set,!1);if(i===wi)return e._zod.parse=t,e._zod.run===o&&(e._zod.run=t),t(s,c);i===Ei||r?n=!0:r=!0}let l=s.value;if(!xi(l))return t(s,c);let u=c[yi];u||(u={buckets:new WeakMap,backEdges:void 0},c[yi]=u);let d;i===c?d=a:(d=ki(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(...Si(f.issues)):(s.memo=!0,u.backEdges??(u.backEdges=new WeakSet),u.backEdges.add(f.value)),s;Ai=d;let p=ji.length,m=t(s,c);Ai=void 0;let h=ji.length>p?ji.pop():void 0;return m instanceof Promise?m.then(e=>(h&&(h.issues=e.issues.length?Si(e.issues):bi),e)):(h&&(h.issues=m.issues.length?Si(m.issues):bi),m)};e._zod.parse=o,e._zod.run===t&&(e._zod.run=o)})}};function Ni(){return Mi}function Pi(e,t){let n=e[yi]?.backEdges;return n!==void 0&&xi(t)&&n.has(t)}var Fi=()=>{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(ze(e.input),e.input)}`;case`invalid_value`:return e.values.length===1?`Invalid input: expected ${ge(e.values[0])}`:`Invalid option: expected one of ${l(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`:``}: ${l(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 Ii(){return{localeError:Fi()}}var Li,Ri=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 zi(){return new Ri}(Li=globalThis).__zod_globalRegistry??(Li.__zod_globalRegistry=zi());var Bi=globalThis.__zod_globalRegistry;function Vi(e){return e.checks&&=[...e.checks],e}function Hi(e,t){return new e(Vi({type:`string`,...b(t)}))}function Ui(e,t){return new e({type:`string`,format:`email`,check:`string_format`,abort:!1,...b(t)})}function Wi(e,t){return new e({type:`string`,format:`guid`,check:`string_format`,abort:!1,...b(t)})}function Gi(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,...b(t)})}function Ki(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v4`,...b(t)})}function qi(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v6`,...b(t)})}function Ji(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v7`,...b(t)})}function Yi(e,t){return new e({type:`string`,format:`url`,check:`string_format`,abort:!1,...b(t)})}function Xi(e,t){return new e({type:`string`,format:`emoji`,check:`string_format`,abort:!1,...b(t)})}function Zi(e,t){return new e({type:`string`,format:`nanoid`,check:`string_format`,abort:!1,...b(t)})}function Qi(e,t){return new e({type:`string`,format:`cuid`,check:`string_format`,abort:!1,...b(t)})}function $i(e,t){return new e({type:`string`,format:`cuid2`,check:`string_format`,abort:!1,...b(t)})}function ea(e,t){return new e({type:`string`,format:`ulid`,check:`string_format`,abort:!1,...b(t)})}function ta(e,t){return new e({type:`string`,format:`xid`,check:`string_format`,abort:!1,...b(t)})}function na(e,t){return new e({type:`string`,format:`ksuid`,check:`string_format`,abort:!1,...b(t)})}function ra(e,t){return new e({type:`string`,format:`ipv4`,check:`string_format`,abort:!1,...b(t)})}function ia(e,t){return new e({type:`string`,format:`ipv6`,check:`string_format`,abort:!1,...b(t)})}function aa(e,t){return new e({type:`string`,format:`cidrv4`,check:`string_format`,abort:!1,...b(t)})}function oa(e,t){return new e({type:`string`,format:`cidrv6`,check:`string_format`,abort:!1,...b(t)})}function sa(e,t){return new e({type:`string`,format:`base64`,check:`string_format`,abort:!1,...b(t)})}function ca(e,t){return new e({type:`string`,format:`base64url`,check:`string_format`,abort:!1,...b(t)})}function la(e,t){return new e({type:`string`,format:`e164`,check:`string_format`,abort:!1,...b(t)})}function ua(e,t){return new e({type:`string`,format:`jwt`,check:`string_format`,abort:!1,...b(t)})}function da(e,t){return new e({type:`string`,format:`datetime`,check:`string_format`,offset:!1,local:!1,precision:null,...b(t)})}function fa(e,t){return new e({type:`string`,format:`date`,check:`string_format`,...b(t)})}function pa(e,t){return new e({type:`string`,format:`time`,check:`string_format`,precision:null,...b(t)})}function ma(e,t){return new e({type:`string`,format:`duration`,check:`string_format`,...b(t)})}function ha(e,t){return new e(Vi({type:`number`,checks:[],...b(t)}))}function ga(e,t){return new e(Vi({type:`number`,coerce:!0,checks:[],...b(t)}))}function _a(e,t){return new e({type:`number`,check:`number_format`,abort:!1,format:`safeint`,...b(t)})}function va(e,t){return new e({type:`boolean`,...b(t)})}function ya(e,t){return new e({type:`undefined`,...b(t)})}function ba(e,t){return new e({type:`null`,...b(t)})}function xa(e){return new e({type:`any`})}function Sa(e){return new e({type:`unknown`})}function Ca(e,t){return new e({type:`never`,...b(t)})}function wa(e,t){return new yn({check:`less_than`,...b(t),value:e,inclusive:!1})}function Ta(e,t){return new yn({check:`less_than`,...b(t),value:e,inclusive:!0})}function Ea(e,t){return new bn({check:`greater_than`,...b(t),value:e,inclusive:!1})}function Da(e,t){return new bn({check:`greater_than`,...b(t),value:e,inclusive:!0})}function Oa(e,t){return new xn({check:`multiple_of`,...b(t),value:e})}function ka(e,t){return new Cn({check:`max_length`,...b(t),maximum:e})}function Aa(e,t){return new wn({check:`min_length`,...b(t),minimum:e})}function ja(e,t){return new Tn({check:`length_equals`,...b(t),length:e})}function Ma(e,t){return new Dn({check:`string_format`,format:`regex`,...b(t),pattern:e})}function Na(e){return new On({check:`string_format`,format:`lowercase`,...b(e)})}function Pa(e){return new kn({check:`string_format`,format:`uppercase`,...b(e)})}function Fa(e,t){return new An({check:`string_format`,format:`includes`,...b(t),includes:e})}function Ia(e,t){return new jn({check:`string_format`,format:`starts_with`,...b(t),prefix:e})}function La(e,t){return new Mn({check:`string_format`,format:`ends_with`,...b(t),suffix:e})}function Ra(e){return new Nn({check:`overwrite`,tx:e})}function za(e){return Ra(t=>t.normalize(e))}function Ba(){return Ra(e=>e.trim())}function Va(){return Ra(e=>e.toLowerCase())}function Ha(){return Ra(e=>e.toUpperCase())}function Ua(){return Ra(e=>ce(e))}function Wa(e,t,n){return new e({type:`array`,element:t,...b(n)})}function Ga(e,t,n){return new e({type:`custom`,check:`custom`,fn:t,...b(n)})}function Ka(e,t){let n=qa(t=>(t.addIssue=e=>{if(typeof e==`string`)t.issues.push(Be(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(Be(r))}},e(t.value,t)),t);return n}function qa(e,t){let n=new gn({check:`custom`,...b(t)});return n._zod.check=e,n}function Ja(e,...t){for(let n of t)for(let t of Reflect.ownKeys(n))Object.prototype.propertyIsEnumerable.call(n,t)&&g(e,t,n[t]);return e}function Ya(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??Bi,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 O(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 k(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,k(a,t,r),t.seen.get(a).isParent=!0)}let c=t.metadataRegistry.get(e);return c&&Ja(o.schema,c),t.io===`input`&&ao(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 Za(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>
|
|
64
64
|
|
|
65
|
-
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 Ya(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;Ya(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 Xa=new Set([`type`,`properties`,`required`,`additionalProperties`]),Za=[`oneOf`,`anyOf`];function Qa(e){let t=e.additionalProperties;return t===void 0||t===!1||typeof t!=`object`||!t?null:Object.keys(t).length?t:null}function $a(e){let t=[];for(let n of e){if(typeof n!=`object`||n.type!==`object`)return null;for(let e in n)if(!Xa.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]??Qa(n);t!=null&&(e.some(e=>JSON.stringify(e)===JSON.stringify(t))||e.push(t))}g(n,r,e.length===1?e[0]:$a(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=Qa(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 eo(e){let t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(let t of Xa)if(t in e)return;let n=t.filter(e=>Za.some(t=>Array.isArray(e[t]))),r=null;if(!n.length)r=$a(t);else{let e=n[0],i=Za.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=>$a([...a,e]));if(o.some(e=>!e))return;r={[i]:o}}r&&(delete e.allOf,Ga(e,r))}function to(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)):Ga(i,s),Ga(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())Ya(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)??[])eo(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)}Ga(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,g(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:io(t,`input`,e.processors),output:io(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function no(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 no(r.element,n);if(r.type===`set`)return no(r.valueType,n);if(r.type===`lazy`)return no(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 no(r.innerType,n);if(r.type===`intersection`)return no(r.left,n)||no(r.right,n);if(r.type===`record`||r.type===`map`)return no(r.keyType,n)||no(r.valueType,n);if(r.type===`pipe`)return e._zod.traits.has(`$ZodCodec`)?!0:no(r.in,n)||no(r.out,n);if(r.type===`object`){for(let e in r.shape)if(no(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(no(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(no(e,n))return!0;return!!(r.rest&&no(r.rest,n))}return!1}var ro=(e,t={})=>n=>{let r=Ka({...n,processors:t});return k(e,r),Ja(r,e),to(r,e)},io=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=Ka({...i??{},target:a,io:t,processors:n});return k(e,o),Ja(o,e),to(o,e)},ao=(e,t,n)=>{(e[t]===void 0||n>e[t])&&(e[t]=n)},oo=(e,t,n)=>{(e[t]===void 0||n<e[t])&&(e[t]=n)},so=(e,t)=>{ao(e,`minimum`,t),oo(e,`maximum`,t)},co=(e,t)=>{e.multipleOf??=[],e.multipleOf.includes(t)||e.multipleOf.push(t)},lo=(e,t)=>{e.patterns??=new Set,e.patterns.add(t)},uo=(e,t)=>{e.mime=e.mime?e.mime.filter(e=>t.includes(e)):[...t]},fo=(e,t)=>{e.format=t,t.includes(`int`)&&(e.isInt=!0)},po=(e,t)=>ao(e,`minimum`,t.minimum),mo=(e,t)=>oo(e,`maximum`,t.maximum),ho=e=>(t,n)=>{fo(t,n.format);let[r,i]=e[n.format];ao(t,`minimum`,r),oo(t,`maximum`,i)},go={greater_than:(e,t)=>ao(e,t.inclusive?`minimum`:`exclusiveMinimum`,t.value),less_than:(e,t)=>oo(e,t.inclusive?`maximum`:`exclusiveMaximum`,t.value),multiple_of:(e,t)=>co(e,t.value),number_format:ho(ve),bigint_format:ho(ye),min_length:po,max_length:mo,length_equals:(e,t)=>so(e,t.length),min_size:po,max_size:mo,size_equals:(e,t)=>so(e,t.size),string_format:(e,t)=>{fo(e,t.format),t.pattern&&lo(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)=>uo(e,t.mime)};function _o(e){let t={},n=e._zod.def,r=e._zod.traits.has(`$ZodCheck`)?[e,...n.checks??[]]:n.checks??[];for(let e of r)go[e._zod.def.check]?.(t,e._zod.def);let i=e._zod.bag;i.minimum!==void 0&&ao(t,`minimum`,i.minimum),i.exclusiveMinimum!==void 0&&ao(t,`exclusiveMinimum`,i.exclusiveMinimum),i.maximum!==void 0&&oo(t,`maximum`,i.maximum),i.exclusiveMaximum!==void 0&&oo(t,`exclusiveMaximum`,i.exclusiveMaximum),i.multipleOf!==void 0&&co(t,i.multipleOf),i.format!==void 0&&(t.format??=i.format,i.format.includes(`int`)&&(t.isInt=!0)),i.mime&&uo(t,i.mime);for(let e of i.patterns??[])lo(t,e);return t}var vo={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},yo=new Map([[hr,Zt],[_r,Qt]]),bo=e=>yo.get(e)??e,xo=(e,t,n,r)=>{let i=n;i.type=`string`;let{minimum:a,maximum:o,format:s,patterns:c,contentEncoding:l,laxFormat:u}=_o(e);if(typeof a==`number`&&(i.minLength=a),typeof o==`number`&&(i.maxLength=o),s&&(i.format=vo[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(bo);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}))])}},So=(e,t,n,r)=>{let i=n,{minimum:a,maximum:o,multipleOf:s,exclusiveMaximum:c,exclusiveMinimum:l,isInt:u}=_o(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)):O(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}))])}},Co=(e,t,n,r)=>{n.type=`boolean`},wo=(e,t,n,r)=>{O(e,t,n,r,`BigInt cannot be represented in JSON Schema`)},To=(e,t,n,r)=>{O(e,t,n,r,`Symbols cannot be represented in JSON Schema`)},Eo=(e,t,n,r)=>{t.target===`openapi-3.0`?(n.type=`string`,n.nullable=!0,n.enum=[null]):n.type=`null`},Do=(e,t,n,r)=>{O(e,t,n,r,`Undefined cannot be represented in JSON Schema`)},Oo=(e,t,n,r)=>{O(e,t,n,r,`Void cannot be represented in JSON Schema`)},ko=(e,t,n,r)=>{n.not={}},Ao=(e,t,n,r)=>{},jo=(e,t,n,r)=>{},Mo=(e,t,n,r)=>{O(e,t,n,r,`Date cannot be represented in JSON Schema`)},No=(e,t,n,r)=>{let i=e._zod.def,a=c(i.entries);if(a.length===0){n.not={};return}a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),n.enum=a},Po=(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(O(e,t,n,r,"Literal `undefined` cannot be represented in JSON Schema"))return}else if(typeof o==`bigint`){if(O(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}},Fo=(e,t,n,r)=>{O(e,t,n,r,`NaN cannot be represented in JSON Schema`)},Io=(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},Lo=(e,t,n,r)=>{let i=n;i.type=`string`,i.format=`binary`,i.contentEncoding=`binary`;let{minimum:a,maximum:o,mime:s}=_o(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})))},Ro=(e,t,n,r)=>{n.type=`boolean`},zo=(e,t,n,r)=>{O(e,t,n,r,`Custom types cannot be represented in JSON Schema`)},Bo=(e,t,n,r)=>{O(e,t,n,r,`Function types cannot be represented in JSON Schema`)},Vo=(e,t,n,r)=>{O(e,t,n,r,`Transforms cannot be represented in JSON Schema`)},Ho=(e,t,n,r)=>{O(e,t,n,r,`Map cannot be represented in JSON Schema`)},Uo=(e,t,n,r)=>{O(e,t,n,r,`Set cannot be represented in JSON Schema`)},Wo=(e,t,n,r)=>{let i=n,a=e._zod.def,{minimum:o,maximum:s}=_o(e);typeof o==`number`&&(i.minItems=o),typeof s==`number`&&(i.maxItems=s),i.type=`array`,i.items=k(a.element,t,{...r,path:[...r.path,`items`]})};function Go(e){let t=e._zod.def;return t.type===`pipe`&&t.in._zod.traits.has(`$ZodTransform`)?Go(t.out):t.type===`catch`?Go(t.innerType):e._zod.optin}var Ko=(e,t,n,r)=>{let i=n,a=e._zod.def,o=a.shape;if(Object.getOwnPropertySymbols(o).length&&O(e,t,i,r,`Symbol keys cannot be represented in JSON Schema`))return;i.type=`object`,i.properties={};for(let e in o)g(i.properties,e,k(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`?Go(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=k(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},qo=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>k(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},Jo=(e,t,n,r)=>{let i=e._zod.def,a=k(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=k(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)},Yo=(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)=>k(e,t,{...r,path:[...r.path,o,n]})),l=a.rest?k(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`?Go(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}=_o(e);typeof p==`number`&&(i.minItems=p),typeof m==`number`&&(i.maxItems=m)};function Xo(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=Xo(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=>Xo(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`)?ln:cn).source),p):p}var Zo=new WeakMap;function Qo(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 Zo.get(e)??[]){let i=e.seen.get(r),a=(i?.def??i?.schema)?.propertyNames;if(!a||a===!0||n.has(a))continue;let o=Xo(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 $o=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`;let o=a.keyType,s=_o(o).patterns;if(a.mode===`loose`&&s&&s.size>0){let e=k(a.valueType,t,{...r,path:[...r.path,`patternProperties`,`*`]});i.patternProperties={};for(let t of s)g(i.patternProperties,bo(t).source,e)}else{if(t.target===`draft-07`||t.target===`draft-2020-12`){i.propertyNames=k(a.keyType,t,{...r,path:[...r.path,`propertyNames`]});let n=Zo.get(t);n||(n=[],Zo.set(t,n),t.deferred.push(()=>Qo(t))),n.push(e)}i.additionalProperties=k(a.valueType,t,{...r,path:[...r.path,`additionalProperties`]})}let c=o._zod.values,l=t.io===`input`&&Go(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))}},es=(e,t,n,r)=>{let i=e._zod.def,a=k(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`}]},ts=(e,t,n,r)=>{let i=e._zod.def;k(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},ns=Symbol();function rs(e,t,n,r,i){let a=!1,o=JSON.stringify(e,(e,t)=>typeof t==`bigint`?(a=!0,null):t);return a?(O(t,n,r,i,`BigInt defaults cannot be represented in JSON Schema`),ns):JSON.parse(o)}var is=(e,t,n,r)=>{let i=e._zod.def;k(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o=rs(i.defaultValue,e,t,n,r);o!==ns&&(n.default=o)},as=(e,t,n,r)=>{let i=e._zod.def;k(i.innerType,t,r);let a=t.seen.get(e);if(a.ref=i.innerType,t.io!==`input`)return;let o=rs(i.defaultValue,e,t,n,r);o!==ns&&(n._prefault=o)},os=(e,t,n,r)=>{let i=e._zod.def;k(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{O(e,t,n,r,`Dynamic catch values are not supported in JSON Schema`);return}n.default=o},ss=(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;k(o,t,r);let s=t.seen.get(e);s.ref=o},cs=(e,t,n,r)=>{let i=e._zod.def;k(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},ls=(e,t,n,r)=>{let i=e._zod.def;k(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},us=(e,t,n,r)=>{let i=e._zod.def;k(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},ds=(e,t,n,r)=>{let i=e._zod.innerType;k(i,t,r);let a=t.seen.get(e);a.ref=i},fs={string:xo,number:So,boolean:Co,bigint:wo,symbol:To,null:Eo,undefined:Do,void:Oo,never:ko,any:Ao,unknown:jo,date:Mo,enum:No,literal:Po,nan:Fo,template_literal:Io,file:Lo,success:Ro,custom:zo,function:Bo,transform:Vo,map:Ho,set:Uo,array:Wo,object:Ko,union:qo,intersection:Jo,tuple:Yo,record:$o,nullable:es,nonoptional:ts,default:is,prefault:as,catch:os,pipe:ss,readonly:cs,promise:ls,optional:us,lazy:ds};function ps(e,t){if(`_idmap`in e){let n=e,r=Ka({...t,processors:fs}),i={};for(let e of n._idmap.entries()){let[t,n]=e;k(n,r)}let a={};r.external={registry:n,uri:t?.uri,defs:i};for(let e of n._idmap.entries()){let[t,n]=e;Ja(r,n),g(a,t,to(r,n))}return Object.keys(i).length>0&&(a.__shared={[r.target===`draft-2020-12`?`$defs`:`definitions`]:i}),{schemas:a}}let n=Ka({...t,processors:fs});return k(e,n),Ja(n,e),to(n,e)}var ms=new WeakSet([Object.prototype,Error.prototype]);function hs(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 gs=S(`ZodError`,(e,t)=>{dt.init(e,t),e.name=`ZodError`;let n=Object.getPrototypeOf(e);ms.has(n)||(ms.add(n),hs(n,`format`,e=>t=>mt(e,t)),hs(n,`flatten`,e=>t=>pt(e,t)),hs(n,`addIssue`,e=>t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,u,2)}),hs(n,`addIssues`,e=>t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,u,2)}),Object.defineProperty(n,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}}))},void 0,{Parent:Error}),_s=gt(gs),vs=_t(gs),ys=vt(gs),bs=bt(gs),xs=Et(gs),Ss=Dt(gs),Cs=Ot(gs),ws=kt(gs),Ts=At(gs),Es=jt(gs),Ds=Mt(gs),Os=Nt(gs);function ks(){C.localeError||w(Ni())}function As(){C.memoizer||w({memoizer:Ai()})}var A=S(`ZodType`,(e,t)=>(ks(),E.init(e,t),e.def=t,e.type=t.type,e),{check(...e){let t=this.def;return this.clone(v(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 y(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(Xc(e,t))},superRefine(e,t){return this.check(Zc(e,t))},overwrite(e){return this.check(Fa(e))},optional(){return U(this)},exactOptional(){return jc(this)},nullable(){return Nc(this)},nullish(){return U(Nc(this))},nonoptional(e){return zc(this,e)},array(){return I(this)},or(e){return z([this,e])},and(e){return Cc(this,e)},transform(e){return Uc(this,Oc(e))},default(e){return Fc(this,e)},prefault(e){return Lc(this,e)},catch(e){return Vc(this,e)},pipe(e){return Uc(this,e)},readonly(){return Kc(this)},describe(e){let t=this.clone();return Li.add(t,{description:e}),t},meta(...e){if(e.length===0)return Li.get(this);let t=this.clone();return Li.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 He(this,`~standard`,{...Ln(this),jsonSchema:{input:io(this,`input`),output:io(this,`output`)}})},set"~standard"(e){Ve(this,`~standard`,e)},parse:function e(t,n){return _s(this,t,n,{callee:e})},parseAsync:async function e(t,n){return await vs(this,t,n,{callee:e})},safeParse(e,t){return ys(this,e,t)},async safeParseAsync(e,t){return bs(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){Ve(this,`spa`,e)},validate(e,t){return Ct(this,e,t)},validateAsync(e,t){return Tt(this,e,t)},encode:function e(t,n){return xs(this,t,n,{callee:e})},decode:function e(t,n){return Ss(this,t,n,{callee:e})},encodeAsync:async function e(t,n){return await Cs(this,t,n,{callee:e})},decodeAsync:async function e(t,n){return await ws(this,t,n,{callee:e})},safeEncode(e,t){return Ts(this,e,t)},safeDecode(e,t){return Es(this,e,t)},async safeEncodeAsync(e,t){return Ds(this,e,t)},async safeDecodeAsync(e,t){return Os(this,e,t)},toJSONSchema(e){return ro(this,{})(e)},get description(){return Li.get(this)?.description},get _def(){return this._zod.def}}),js=S(`_ZodString`,(e,t)=>{Rn.init(e,t),A.init(e,t),e._zod.processJSONSchema=(t,n,r)=>xo(e,t,n,r)},Ue({format:e=>_o(e).format??null,minLength:e=>_o(e).minimum??null,maxLength:e=>_o(e).maximum??null},{regex(...e){return this.check(ka(...e))},includes(...e){return this.check(Ma(...e))},startsWith(...e){return this.check(Na(...e))},endsWith(...e){return this.check(Pa(...e))},min(...e){return this.check(Da(...e))},max(...e){return this.check(Ea(...e))},length(...e){return this.check(Oa(...e))},nonempty(...e){return this.check(Da(1,...e))},lowercase(e){return this.check(Aa(e))},uppercase(e){return this.check(ja(e))},trim(){return this.check(La())},normalize(...e){return this.check(Ia(...e))},toLowerCase(){return this.check(Ra())},toUpperCase(){return this.check(za())},slugify(){return this.check(Ba())}})),Ms=S(`ZodString`,(e,t)=>{Rn.init(e,t),js.init(e,t)},{email(e){return this.check(Bi(Ls,e))},url(e){return this.check(Ki(Vs,e))},jwt(e){return this.check(sa(rc,e))},emoji(e){return this.check(qi(Us,e))},guid(e){return this.check(Vi(zs,e))},uuid(e){return this.check(Hi(Bs,e))},uuidv4(e){return this.check(Ui(Bs,e))},uuidv6(e){return this.check(Wi(Bs,e))},uuidv7(e){return this.check(Gi(Bs,e))},nanoid(e){return this.check(Ji(Ws,e))},cuid(e){return this.check(Yi(Gs,e))},cuid2(e){return this.check(Xi(Ks,e))},ulid(e){return this.check(Zi(qs,e))},base64(e){return this.check(ia(ec,e))},base64url(e){return this.check(aa(tc,e))},xid(e){return this.check(Qi(Js,e))},ksuid(e){return this.check($i(Ys,e))},ipv4(e){return this.check(ea(Xs,e))},ipv6(e){return this.check(ta(Zs,e))},cidrv4(e){return this.check(na(Qs,e))},cidrv6(e){return this.check(ra($s,e))},e164(e){return this.check(oa(nc,e))},datetime(e){return this.check(ca(Ns,e))},date(e){return this.check(la(Ps,e))},time(e){return this.check(ua(Fs,e))},duration(e){return this.check(da(Is,e))}});function j(e){return zi(Ms,e)}var M=S(`ZodStringFormat`,(e,t)=>{D.init(e,t),js.init(e,t)}),Ns=S(`ZodISODateTime`,(e,t)=>{rr.init(e,t),M.init(e,t)}),Ps=S(`ZodISODate`,(e,t)=>{ir.init(e,t),M.init(e,t)}),Fs=S(`ZodISOTime`,(e,t)=>{ar.init(e,t),M.init(e,t)}),Is=S(`ZodISODuration`,(e,t)=>{or.init(e,t),M.init(e,t)}),Ls=S(`ZodEmail`,(e,t)=>{Vn.init(e,t),M.init(e,t)});function Rs(e){return Bi(Ls,e)}var zs=S(`ZodGUID`,(e,t)=>{zn.init(e,t),M.init(e,t)}),Bs=S(`ZodUUID`,(e,t)=>{Bn.init(e,t),M.init(e,t)}),Vs=S(`ZodURL`,(e,t)=>{Yn.init(e,t),M.init(e,t)});function Hs(e){return Ki(Vs,e)}var Us=S(`ZodEmoji`,(e,t)=>{Xn.init(e,t),M.init(e,t)}),Ws=S(`ZodNanoID`,(e,t)=>{Zn.init(e,t),M.init(e,t)}),Gs=S(`ZodCUID`,(e,t)=>{Qn.init(e,t),M.init(e,t)}),Ks=S(`ZodCUID2`,(e,t)=>{$n.init(e,t),M.init(e,t)}),qs=S(`ZodULID`,(e,t)=>{er.init(e,t),M.init(e,t)}),Js=S(`ZodXID`,(e,t)=>{tr.init(e,t),M.init(e,t)}),Ys=S(`ZodKSUID`,(e,t)=>{nr.init(e,t),M.init(e,t)}),Xs=S(`ZodIPv4`,(e,t)=>{sr.init(e,t),M.init(e,t)}),Zs=S(`ZodIPv6`,(e,t)=>{ur.init(e,t),M.init(e,t)}),Qs=S(`ZodCIDRv4`,(e,t)=>{dr.init(e,t),M.init(e,t)}),$s=S(`ZodCIDRv6`,(e,t)=>{pr.init(e,t),M.init(e,t)}),ec=S(`ZodBase64`,(e,t)=>{gr.init(e,t),M.init(e,t)}),tc=S(`ZodBase64URL`,(e,t)=>{yr.init(e,t),M.init(e,t)}),nc=S(`ZodE164`,(e,t)=>{br.init(e,t),M.init(e,t)}),rc=S(`ZodJWT`,(e,t)=>{Sr.init(e,t),M.init(e,t)}),ic=S(`ZodNumber`,(e,t)=>{Cr.init(e,t),A.init(e,t),e._zod.processJSONSchema=(t,n,r)=>So(e,t,n,r),e.isFinite=!0},Ue({minValue:e=>{let{minimum:t,exclusiveMinimum:n}=_o(e);return Math.max(t??-1/0,n??-1/0)},maxValue:e=>{let{maximum:t,exclusiveMaximum:n}=_o(e);return Math.min(t??1/0,n??1/0)},isInt:e=>{let{isInt:t,multipleOf:n}=_o(e);return!!t||!!n?.some(Number.isSafeInteger)},format:e=>_o(e).format??null},{gt(e,t){return this.check(Ca(e,t))},gte(e,t){return this.check(wa(e,t))},min(e,t){return this.check(wa(e,t))},lt(e,t){return this.check(xa(e,t))},lte(e,t){return this.check(Sa(e,t))},max(e,t){return this.check(Sa(e,t))},int(e){return this.check(oc(e))},safe(e){return this.check(oc(e))},positive(e){return this.check(Ca(0,e))},nonnegative(e){return this.check(wa(0,e))},negative(e){return this.check(xa(0,e))},nonpositive(e){return this.check(Sa(0,e))},multipleOf(e,t){return this.check(Ta(e,t))},step(e,t){return this.check(Ta(e,t))},finite(){return this}}));function N(e){return fa(ic,e)}var ac=S(`ZodNumberFormat`,(e,t)=>{wr.init(e,t),ic.init(e,t)});function oc(e){return ma(ac,e)}var sc=S(`ZodBoolean`,(e,t)=>{Tr.init(e,t),A.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Co(e,t,n,r)});function P(e){return ha(sc,e)}var cc=S(`ZodUndefined`,(e,t)=>{Er.init(e,t),A.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Do(e,t,n,r)});function lc(e){return ga(cc,e)}var uc=S(`ZodNull`,(e,t)=>{Dr.init(e,t),A.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Eo(e,t,n,r)});function dc(e){return _a(uc,e)}var fc=S(`ZodAny`,(e,t)=>{Or.init(e,t),A.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function pc(){return va(fc)}var mc=S(`ZodUnknown`,(e,t)=>{kr.init(e,t),A.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function F(){return ya(mc)}var hc=S(`ZodNever`,(e,t)=>{Ar.init(e,t),A.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ko(e,t,n,r)});function gc(e){return ba(hc,e)}var _c=S(`ZodArray`,(e,t)=>{As(),Mr.init(e,t),A.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Wo(e,t,n,r),e.element=t.element},{min(e,t){return this.check(Da(e,t))},nonempty(e){return this.check(Da(1,e))},max(e,t){return this.check(Ea(e,t))},length(e,t){return this.check(Oa(e,t))},unwrap(){return this.element}});function I(e,t){return Va(_c,e,t)}var vc=S(`ZodObject`,(e,t)=>{As(),Rr.init(e,t),A.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ko(e,t,n,r),Ye(e,`shape`,e=>e._zod.def.shape,!1)},{keyof(){return V(Object.keys(this._zod.def.shape))},catchall(e){return this.clone(v(this._zod.def,{catchall:e}))},passthrough(){return this.clone(v(this._zod.def,{catchall:F()}))},loose(){return this.clone(v(this._zod.def,{catchall:F()}))},strict(){return this.clone(v(this._zod.def,{catchall:gc()}))},strip(){return this.clone(v(this._zod.def,{catchall:void 0}))},extend(e){return Ce(this,e)},safeExtend(e){return Te(this,e)},merge(e){return Ee(this,e)},pick(e){return be(this,e)},omit(e){return Se(this,e)},partial(...e){return De(kc,this,e[0])},exactPartial(...e){return De(Ac,this,e[0],`exactPartial`)},required(...e){return Oe(Rc,this,e[0])}});function L(e,t){return new vc({type:`object`,shape:e??{},...b(t)})}function R(e,t){return new vc({type:`object`,shape:e,catchall:F(),...b(t)})}var yc=S(`ZodUnion`,(e,t)=>{Br.init(e,t),A.init(e,t),e._zod.processJSONSchema=(t,n,r)=>qo(e,t,n,r),e.options=t.options});function z(e,t){return new yc({type:`union`,options:e,...b(t)})}var bc=S(`ZodDiscriminatedUnion`,(e,t)=>{yc.init(e,t),Hr.init(e,t)});function xc(e,t,n){return new bc({type:`union`,options:t,discriminator:e,...b(n)})}var Sc=S(`ZodIntersection`,(e,t)=>{Ur.init(e,t),A.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Jo(e,t,n,r)});function Cc(e,t){return new Sc({type:`intersection`,left:e,right:t})}var wc=S(`ZodRecord`,(e,t)=>{As(),Kr.init(e,t),A.init(e,t),e._zod.processJSONSchema=(t,n,r)=>$o(e,t,n,r),e.keyType=t.keyType,e.valueType=t.valueType});function B(e,t,n){return!t||!t._zod?new wc({type:`record`,keyType:j(),valueType:e,...b(t)}):new wc({type:`record`,keyType:e,valueType:t,...b(n)})}var Tc=S(`ZodEnum`,(e,t)=>{qr.init(e,t),A.init(e,t),e._zod.processJSONSchema=(t,n,r)=>No(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 Tc({...t,checks:[],...b(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 Tc({...t,checks:[],...b(r),entries:i})}});function V(e,t){return new Tc({type:`enum`,entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...b(t)})}var Ec=S(`ZodLiteral`,(e,t)=>{Jr.init(e,t),A.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Po(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 Ec({type:`literal`,values:Array.isArray(e)?e:[e],...b(t)})}var Dc=S(`ZodTransform`,(e,t)=>{As(),Yr.init(e,t),A.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Vo(e,t,n,r),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new it(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(ze(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(ze(t))}};let i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n)):(n.value=i,n)}});function Oc(e){return new Dc({type:`transform`,transform:e})}var kc=S(`ZodOptional`,(e,t)=>{Zr.init(e,t),A.init(e,t),e._zod.processJSONSchema=(t,n,r)=>us(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function U(e){return new kc({type:`optional`,innerType:e})}var Ac=S(`ZodExactOptional`,(e,t)=>{Qr.init(e,t),A.init(e,t),e._zod.processJSONSchema=(t,n,r)=>us(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function jc(e){return new Ac({type:`optional`,innerType:e})}var Mc=S(`ZodNullable`,(e,t)=>{$r.init(e,t),A.init(e,t),e._zod.processJSONSchema=(t,n,r)=>es(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Nc(e){return new Mc({type:`nullable`,innerType:e})}var Pc=S(`ZodDefault`,(e,t)=>{ei.init(e,t),A.init(e,t),e._zod.processJSONSchema=(t,n,r)=>is(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Fc(e,t){return new Pc({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():pe(t)}})}var Ic=S(`ZodPrefault`,(e,t)=>{ni.init(e,t),A.init(e,t),e._zod.processJSONSchema=(t,n,r)=>as(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Lc(e,t){return new Ic({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():pe(t)}})}var Rc=S(`ZodNonOptional`,(e,t)=>{ri.init(e,t),A.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ts(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function zc(e,t){return new Rc({type:`nonoptional`,innerType:e,...b(t)})}var Bc=S(`ZodCatch`,(e,t)=>{oi.init(e,t),A.init(e,t),e._zod.processJSONSchema=(t,n,r)=>os(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Vc(e,t){return new Bc({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:Ze(t)})}var Hc=S(`ZodPipe`,(e,t)=>{si.init(e,t),A.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ss(e,t,n,r),e.in=t.in,e.out=t.out});function Uc(e,t){return new Hc({type:`pipe`,in:e,out:t})}var Wc=S(`ZodPreprocess`,(e,t)=>{Hc.init(e,t),li.init(e,t)}),Gc=S(`ZodReadonly`,(e,t)=>{ui.init(e,t),A.init(e,t),e._zod.processJSONSchema=(t,n,r)=>cs(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Kc(e){return new Gc({type:`readonly`,innerType:e})}var qc=S(`ZodLazy`,(e,t)=>{fi.init(e,t),A.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ds(e,t,n,r),e.unwrap=()=>e._zod.def.getter()});function Jc(e){return new qc({type:`lazy`,getter:e})}var Yc=S(`ZodCustom`,(e,t)=>{pi.init(e,t),A.init(e,t),e._zod.processJSONSchema=(t,n,r)=>zo(e,t,n,r)});function Xc(e,t={}){return Ha(Yc,e,t)}function Zc(e,t){return Ua(e,t)}function Qc(e,t){return new Wc({type:`pipe`,in:Oc(e),out:t})}var $c={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`},el;el||={};function tl(e){return ca(Ns,e)}function nl(e){return la(Ps,e)}function rl(e){return pa(ic,e)}var il=[`2025-11-25`,`2025-06-18`,`2025-03-26`,`2024-11-05`,`2024-10-07`],al=`io.modelcontextprotocol/related-task`,ol=`io.modelcontextprotocol/protocolVersion`,sl=`io.modelcontextprotocol/clientInfo`,cl=`io.modelcontextprotocol/serverInfo`,ll=`io.modelcontextprotocol/clientCapabilities`,ul=`io.modelcontextprotocol/subscriptionId`,dl=`io.modelcontextprotocol/logLevel`,fl=Jc(()=>z([j(),N(),P(),dc(),B(j(),fl),I(fl)])),W=B(j(),fl),pl=I(fl),ml=z([j(),N().int()]),hl=j(),gl=L({ttl:N().optional()}),_l=L({taskId:j()}),vl=R({progressToken:ml.optional(),[al]:_l.optional()}),G=L({_meta:vl.optional()}),yl=G.extend({task:gl.optional()}),K=L({method:j(),params:G.loose().optional()}),bl=L({_meta:vl.optional()}),xl=L({method:j(),params:bl.loose().optional()}),Sl=R({get[cl](){return Il.optional().catch(void 0)}}),q=R({_meta:Sl.optional()}),Cl=z([j(),N().int()]),wl=L({jsonrpc:H(`2.0`),id:Cl,...K.shape}).strict(),Tl=L({jsonrpc:H(`2.0`),...xl.shape}).strict(),El=L({jsonrpc:H(`2.0`),id:Cl,result:q}).strict(),Dl=L({jsonrpc:H(`2.0`),id:Cl.optional(),error:L({code:N().int(),message:j(),data:F().optional()})}).strict(),Ol=z([wl,Tl,El,Dl]),kl=z([El,Dl]),Al=q.strict(),jl=bl.extend({requestId:Cl.optional(),reason:j().optional()}),Ml=xl.extend({method:H(`notifications/cancelled`),params:jl}),Nl=L({src:j(),mimeType:j().optional(),sizes:I(j()).optional(),theme:V([`light`,`dark`]).optional()}),Pl=L({icons:I(Nl).optional()}),Fl=L({name:j(),title:j().optional()}),Il=Fl.extend({...Fl.shape,...Pl.shape,version:j(),websiteUrl:j().optional(),description:j().optional()}),Ll=Qc(e=>e&&typeof e==`object`&&!Array.isArray(e)&&Object.keys(e).length===0?{form:{}}:e,Cc(L({form:Cc(L({applyDefaults:P().optional()}),W).optional(),url:W.optional()}),W.optional())),Rl=R({list:W.optional(),cancel:W.optional(),requests:R({sampling:R({createMessage:W.optional()}).optional(),elicitation:R({create:W.optional()}).optional()}).optional()}),zl=R({list:W.optional(),cancel:W.optional(),requests:R({tools:R({call:W.optional()}).optional()}).optional()}),Bl=L({experimental:B(j(),W).optional(),sampling:L({context:W.optional(),tools:W.optional()}).optional(),elicitation:Ll.optional(),roots:L({listChanged:P().optional()}).optional(),tasks:Rl.optional(),extensions:B(j(),W).optional()}),Vl=G.extend({protocolVersion:j(),capabilities:Bl,clientInfo:Il}),Hl=K.extend({method:H(`initialize`),params:Vl}),Ul=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:zl.optional(),extensions:B(j(),W).optional()}),Wl=q.extend({protocolVersion:j(),capabilities:Ul,serverInfo:Il,instructions:j().optional()}),Gl=xl.extend({method:H(`notifications/initialized`),params:bl.optional()}),Kl=K.extend({method:H(`server/discover`),params:G.optional()}),ql=q.extend({supportedVersions:I(j()),capabilities:Ul,instructions:j().optional()}),Jl=K.extend({method:H(`ping`),params:G.optional()}),Yl=L({progress:N(),total:U(N()),message:U(j())}),Xl=L({...bl.shape,...Yl.shape,progressToken:ml}),Zl=xl.extend({method:H(`notifications/progress`),params:Xl}),Ql=G.extend({cursor:hl.optional()}),$l=K.extend({params:Ql.optional()}),eu=q.extend({nextCursor:hl.optional()}),tu=L({uri:j(),mimeType:U(j()),_meta:B(j(),F()).optional()}),nu=tu.extend({text:j()}),ru=j().refine(e=>{try{return atob(e),!0}catch{return!1}},{message:`Invalid Base64 string`}),iu=tu.extend({blob:ru}),au=V([`user`,`assistant`]),ou=L({audience:I(au).optional(),priority:N().min(0).max(1).optional(),lastModified:tl({offset:!0}).optional()}),su=L({...Fl.shape,...Pl.shape,uri:j(),description:U(j()),mimeType:U(j()),size:U(N()),annotations:ou.optional(),_meta:U(R({}))}),cu=L({...Fl.shape,...Pl.shape,uriTemplate:j(),description:U(j()),mimeType:U(j()),annotations:ou.optional(),_meta:U(R({}))}),lu=$l.extend({method:H(`resources/list`)}),uu=eu.extend({resources:I(su)}),du=$l.extend({method:H(`resources/templates/list`)}),fu=eu.extend({resourceTemplates:I(cu)}),pu=G.extend({uri:j()}),mu=pu,hu=K.extend({method:H(`resources/read`),params:mu}),gu=q.extend({contents:I(z([nu,iu]))}),_u=xl.extend({method:H(`notifications/resources/list_changed`),params:bl.optional()}),vu=pu,yu=K.extend({method:H(`resources/subscribe`),params:vu}),bu=pu,xu=K.extend({method:H(`resources/unsubscribe`),params:bu}),Su=L({toolsListChanged:P().optional(),promptsListChanged:P().optional(),resourcesListChanged:P().optional(),resourceSubscriptions:I(j()).optional()}),Cu=G.extend({notifications:Su}),wu=K.extend({method:H(`subscriptions/listen`),params:Cu}),Tu=bl.extend({notifications:Su}),Eu=xl.extend({method:H(`notifications/subscriptions/acknowledged`),params:Tu}),Du=Sl.extend({[ul]:Cl}),Ou=q.extend({_meta:Du}),ku=bl.extend({uri:j()}),Au=xl.extend({method:H(`notifications/resources/updated`),params:ku}),ju=L({name:j(),description:U(j()),required:U(P())}),Mu=L({...Fl.shape,...Pl.shape,description:U(j()),arguments:U(I(ju)),_meta:U(R({}))}),Nu=$l.extend({method:H(`prompts/list`)}),Pu=eu.extend({prompts:I(Mu)}),Fu=G.extend({name:j(),arguments:B(j(),j()).optional()}),Iu=K.extend({method:H(`prompts/get`),params:Fu}),Lu=L({type:H(`text`),text:j(),annotations:ou.optional(),_meta:B(j(),F()).optional()}),Ru=L({type:H(`image`),data:ru,mimeType:j(),annotations:ou.optional(),_meta:B(j(),F()).optional()}),zu=L({type:H(`audio`),data:ru,mimeType:j(),annotations:ou.optional(),_meta:B(j(),F()).optional()}),Bu=L({type:H(`tool_use`),name:j(),id:j(),input:B(j(),F()),_meta:B(j(),F()).optional()}),Vu=L({type:H(`resource`),resource:z([nu,iu]),annotations:ou.optional(),_meta:B(j(),F()).optional()}),Hu=su.extend({type:H(`resource_link`)}),Uu=z([Lu,Ru,zu,Hu,Vu]),Wu=L({role:au,content:Uu}),Gu=q.extend({description:j().optional(),messages:I(Wu)}),Ku=xl.extend({method:H(`notifications/prompts/list_changed`),params:bl.optional()}),qu=L({title:j().optional(),readOnlyHint:P().optional(),destructiveHint:P().optional(),idempotentHint:P().optional(),openWorldHint:P().optional()}),Ju=L({taskSupport:V([`required`,`optional`,`forbidden`]).optional()}),Yu=L({...Fl.shape,...Pl.shape,description:j().optional(),inputSchema:L({type:H(`object`),properties:B(j(),fl).optional(),required:I(j()).optional()}).catchall(F()),outputSchema:R({$schema:j().optional()}).optional(),annotations:qu.optional(),execution:Ju.optional(),_meta:B(j(),F()).optional()}),Xu=$l.extend({method:H(`tools/list`)}),Zu=eu.extend({tools:I(Yu)}),Qu=q.extend({content:I(Uu).default([]),structuredContent:F().optional(),isError:P().optional()}),$u=Qu.or(q.extend({toolResult:F()})),ed=yl.extend({name:j(),arguments:B(j(),F()).optional()}),td=K.extend({method:H(`tools/call`),params:ed}),nd=xl.extend({method:H(`notifications/tools/list_changed`),params:bl.optional()}),rd=L({autoRefresh:P().default(!0),debounceMs:N().int().nonnegative().default(300)}),id=V([`debug`,`info`,`notice`,`warning`,`error`,`critical`,`alert`,`emergency`]),ad=G.extend({level:id}),od=K.extend({method:H(`logging/setLevel`),params:ad}),sd=bl.extend({level:id,logger:j().optional(),data:F()}),cd=xl.extend({method:H(`notifications/message`),params:sd}),ld=L({name:j().optional()}),ud=L({hints:I(ld).optional(),costPriority:N().min(0).max(1).optional(),speedPriority:N().min(0).max(1).optional(),intelligencePriority:N().min(0).max(1).optional()}),dd=L({mode:V([`auto`,`required`,`none`]).optional()}),fd=L({type:H(`tool_result`),toolUseId:j().describe(`The unique identifier for the corresponding tool call.`),content:I(Uu),structuredContent:F().optional(),isError:P().optional(),_meta:B(j(),F()).optional()}),pd=xc(`type`,[Lu,Ru,zu]),md=xc(`type`,[Lu,Ru,zu,Bu,fd]),hd=L({role:au,content:z([md,I(md)]),_meta:B(j(),F()).optional()}),gd=yl.extend({messages:I(hd),modelPreferences:ud.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(Yu).optional(),toolChoice:dd.optional()}),_d=K.extend({method:H(`sampling/createMessage`),params:gd}),vd=q.extend({model:j(),stopReason:U(V([`endTurn`,`stopSequence`,`maxTokens`]).or(j())),role:au,content:pd}),yd=q.extend({model:j(),stopReason:U(V([`endTurn`,`stopSequence`,`maxTokens`,`toolUse`]).or(j())),role:au,content:z([md,I(md)])}),bd=L({type:H(`boolean`),title:j().optional(),description:j().optional(),default:P().optional()}),xd=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()}),Sd=L({type:V([`number`,`integer`]),title:j().optional(),description:j().optional(),minimum:N().optional(),maximum:N().optional(),default:N().optional()}),Cd=L({type:H(`string`),title:j().optional(),description:j().optional(),enum:I(j()),default:j().optional()}),wd=L({type:H(`string`),title:j().optional(),description:j().optional(),oneOf:I(L({const:j(),title:j()})),default:j().optional()}),Td=L({type:H(`string`),title:j().optional(),description:j().optional(),enum:I(j()),enumNames:I(j()).optional(),default:j().optional()}),Ed=z([Cd,wd]),Dd=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()}),Od=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()}),kd=z([Dd,Od]),Ad=z([Td,Ed,kd]),jd=z([Ad,bd,xd,Sd]),Md=yl.extend({mode:H(`form`).optional(),message:j(),requestedSchema:L({type:H(`object`),properties:B(j(),jd),required:I(j()).optional()}).catchall(F())}),Nd=yl.extend({mode:H(`url`),message:j(),elicitationId:j(),url:j().url()}),Pd=z([Md,Nd]),Fd=K.extend({method:H(`elicitation/create`),params:Pd}),Id=bl.extend({elicitationId:j()}),Ld=xl.extend({method:H(`notifications/elicitation/complete`),params:Id}),Rd=q.extend({action:V([`accept`,`decline`,`cancel`]),content:Qc(e=>e===null?void 0:e,B(j(),z([j(),N(),P(),I(j())])).optional())}),zd=L({type:H(`ref/resource`),uri:j()}),Bd=L({type:H(`ref/prompt`),name:j()}),Vd=G.extend({ref:z([Bd,zd]),argument:L({name:j(),value:j()}),context:L({arguments:B(j(),j()).optional()}).optional()}),Hd=K.extend({method:H(`completion/complete`),params:Vd}),Ud=q.extend({completion:R({values:I(j()).max(100),total:U(N().int()),hasMore:U(P())})}),Wd=L({uri:j().startsWith(`file://`),name:j().optional(),_meta:B(j(),F()).optional()}),Gd=K.extend({method:H(`roots/list`),params:G.optional()}),Kd=q.extend({roots:I(Wd)}),qd=xl.extend({method:H(`notifications/roots/list_changed`),params:bl.optional()}),Jd=R({ttl:N().optional(),pollInterval:N().optional()}),Yd=V([`working`,`input_required`,`completed`,`failed`,`cancelled`]),Xd=L({taskId:j(),status:Yd,ttl:z([N(),dc()]),createdAt:j(),lastUpdatedAt:j(),pollInterval:U(N()),statusMessage:U(j())}),Zd=q.extend({task:Xd}),Qd=bl.merge(Xd),$d=xl.extend({method:H(`notifications/tasks/status`),params:Qd}),ef=K.extend({method:H(`tasks/get`),params:G.extend({taskId:j()})}),tf=q.merge(Xd),nf=K.extend({method:H(`tasks/result`),params:G.extend({taskId:j()})}),rf=q.loose(),af=$l.extend({method:H(`tasks/list`)}),of=eu.extend({tasks:I(Xd)}),sf=K.extend({method:H(`tasks/cancel`),params:G.extend({taskId:j()})}),cf=q.merge(Xd),lf=z([Jl,Hl,Kl,Hd,od,Iu,Nu,lu,du,hu,yu,xu,wu,td,Xu]),uf=z([Ml,Zl,Gl,qd]),df=z([Al,vd,yd,Rd,Kd]),ff=z([Jl,_d,Fd,Gd]),pf=z([Ml,Zl,cd,Au,_u,nd,Ku,Eu,Ld]),mf=z([Al,Wl,ql,Ud,Gu,Pu,uu,fu,gu,Qu,Zu,Ou]),J=Hs().superRefine((e,t)=>{if(!URL.canParse(e))return t.addIssue({code:$c.custom,message:`URL must be parseable`,fatal:!0}),$e}).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`}),hf=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()}),gf=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),dpop_signing_alg_values_supported:I(j()).optional()}),_f=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)}),vf=L({..._f.shape,...gf.pick({code_challenge_methods_supported:!0}).shape}),yf=L({access_token:j(),id_token:j().optional(),token_type:j(),expires_in:rl().optional(),scope:j().optional(),refresh_token:j().optional(),issuer:j().optional().catch(void 0)}).strip(),bf=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(),xf=L({error:j(),error_description:j().optional(),error_uri:j().optional()}),Sf=J.optional().or(H(``).transform(()=>void 0)),Cf=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:Sf,scope:j().optional(),contacts:I(j()).optional(),tos_uri:Sf,policy_uri:j().optional(),jwks_uri:J.optional(),jwks:pc().optional(),software_id:j().optional(),software_version:j().optional(),software_statement:j().optional()}).strip(),wf=L({client_id:j(),client_secret:j().optional(),client_id_issued_at:N().optional(),client_secret_expires_at:N().optional(),issuer:j().optional().catch(void 0)}).strip(),Tf=Cf.merge(wf),Ef=L({error:j(),error_description:j().optional()}).strip(),Df=L({token:j(),token_type_hint:j().optional()}).strip(),Of=Symbol.for(`mcp.sdk.errorBrands`);function kf(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,Of,{value:n,enumerable:!1,configurable:!0})}function Af(e,t){try{if(typeof t==`object`&&t&&Object.prototype.hasOwnProperty.call(e,`mcpBrand`)&&typeof e.mcpBrand==`string`&&Object.prototype.hasOwnProperty.call(t,Of)){let n=t[Of];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 Af(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 Af(this,e)}constructor(e,t,n){super(t),this.code=e,this.errorUri=n,this.name=`OAuthError`,kf(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 Af(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 Af(this,e)}constructor(e,t,n,r){super(t,r),this.code=e,this.data=n,this.name=`SdkError`,kf(this,new.target)}};(class extends X{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.SdkHttpError`})}constructor(e,t,n,r){super(e,t,n,r),this.name=`SdkHttpError`}get status(){return this.data.status}get statusText(){return this.data.statusText}});var jf=`2026-07-28`;function Mf(e){return e>=jf}function Nf(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 Pf=[`task`,`inputRequests`,`requestState`];function Ff(e){return typeof e!=`object`||!e||Array.isArray(e)||e.content!==void 0||Pf.some(t=>t in e)?e:{...e,content:[]}}function If(){let e=Jc(()=>z([j(),N(),P(),dc(),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()}),g=L({icons:I(te).optional()}),ne=L({name:j(),title:j().optional()}),_=ne.extend({...ne.shape,...g.shape,version:j(),websiteUrl:j().optional(),description:j().optional()}),re=Qc(e=>e&&typeof e==`object`&&!Array.isArray(e)&&Object.keys(e).length===0?{form:{}}:e,Cc(L({form:Cc(L({applyDefaults:P().optional()}),t).optional(),url:t.optional()}),t.optional())),ie=R({list:t.optional(),cancel:t.optional(),requests:R({sampling:R({createMessage:t.optional()}).optional(),elicitation:R({create:t.optional()}).optional()}).optional()}),ae=R({list:t.optional(),cancel:t.optional(),requests:R({tools:R({call:t.optional()}).optional()}).optional()}),oe=L({experimental:B(j(),t).optional(),sampling:L({context:t.optional(),tools:t.optional()}).optional(),elicitation:re.optional(),roots:L({listChanged:P().optional()}).optional(),tasks:ie.optional(),extensions:B(j(),t).optional()}),v=s.extend({protocolVersion:j(),capabilities:oe,clientInfo:_}),se=l.extend({method:H(`initialize`),params:v}),ce=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:ae.optional(),extensions:B(j(),t).optional()}),le=f.extend({protocolVersion:j(),capabilities:ce,serverInfo:_,instructions:j().optional()}),ue=d.extend({method:H(`notifications/initialized`),params:u.optional()}),de=l.extend({method:H(`ping`),params:s.optional()}),fe=L({progress:N(),total:U(N()),message:U(j())}),pe=L({...u.shape,...fe.shape,progressToken:n}),me=d.extend({method:H(`notifications/progress`),params:pe}),he=s.extend({cursor:r.optional()}),y=l.extend({params:he.optional()}),b=f.extend({nextCursor:r.optional()}),ge=L({uri:j(),mimeType:U(j()),_meta:B(j(),F()).optional()}),_e=ge.extend({text:j()}),ve=j().refine(e=>{try{return atob(e),!0}catch{return!1}},{message:`Invalid Base64 string`}),ye=ge.extend({blob:ve}),be=V([`user`,`assistant`]),xe=L({audience:I(be).optional(),priority:N().min(0).max(1).optional(),lastModified:tl({offset:!0}).optional()}),Se=L({...ne.shape,...g.shape,uri:j(),description:U(j()),mimeType:U(j()),size:U(N()),annotations:xe.optional(),_meta:U(R({}))}),Ce=L({...ne.shape,...g.shape,uriTemplate:j(),description:U(j()),mimeType:U(j()),annotations:xe.optional(),_meta:U(R({}))}),we=y.extend({method:H(`resources/list`)}),Te=b.extend({resources:I(Se)}),Ee=y.extend({method:H(`resources/templates/list`)}),De=b.extend({resourceTemplates:I(Ce)}),Oe=s.extend({uri:j()}),ke=Oe,Ae=l.extend({method:H(`resources/read`),params:ke}),je=f.extend({contents:I(z([_e,ye]))}),Me=d.extend({method:H(`notifications/resources/list_changed`),params:u.optional()}),Ne=Oe,Pe=l.extend({method:H(`resources/subscribe`),params:Ne}),Fe=Oe,Ie=l.extend({method:H(`resources/unsubscribe`),params:Fe}),Le=u.extend({uri:j()}),Re=d.extend({method:H(`notifications/resources/updated`),params:Le}),ze=L({name:j(),description:U(j()),required:U(P())}),Be=L({...ne.shape,...g.shape,description:U(j()),arguments:U(I(ze)),_meta:U(R({}))}),Ve=y.extend({method:H(`prompts/list`)}),He=b.extend({prompts:I(Be)}),Ue=s.extend({name:j(),arguments:B(j(),j()).optional()}),We=l.extend({method:H(`prompts/get`),params:Ue}),Ge=L({type:H(`text`),text:j(),annotations:xe.optional(),_meta:B(j(),F()).optional()}),Ke=L({type:H(`image`),data:ve,mimeType:j(),annotations:xe.optional(),_meta:B(j(),F()).optional()}),qe=L({type:H(`audio`),data:ve,mimeType:j(),annotations:xe.optional(),_meta:B(j(),F()).optional()}),Je=L({type:H(`tool_use`),name:j(),id:j(),input:B(j(),F()),_meta:B(j(),F()).optional()}),x=L({type:H(`resource`),resource:z([_e,ye]),annotations:xe.optional(),_meta:B(j(),F()).optional()}),Ye=Se.extend({type:H(`resource_link`)}),Xe=z([Ge,Ke,qe,Ye,x]),Ze=L({role:be,content:Xe}),Qe=f.extend({description:j().optional(),messages:I(Ze)}),$e=d.extend({method:H(`notifications/prompts/list_changed`),params:u.optional()}),et=L({title:j().optional(),readOnlyHint:P().optional(),destructiveHint:P().optional(),idempotentHint:P().optional(),openWorldHint:P().optional()}),tt=L({taskSupport:V([`required`,`optional`,`forbidden`]).optional()}),nt=L({...ne.shape,...g.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:et.optional(),execution:tt.optional(),_meta:B(j(),F()).optional()}),S=y.extend({method:H(`tools/list`)}),rt=b.extend({tools:I(nt)}),it=f.extend({content:I(Xe),structuredContent:B(j(),F()).optional(),isError:P().optional()}),C=c.extend({name:j(),arguments:B(j(),F()).optional()}),w=l.extend({method:H(`tools/call`),params:C}),at=d.extend({method:H(`notifications/tools/list_changed`),params:u.optional()}),ot=V([`debug`,`info`,`notice`,`warning`,`error`,`critical`,`alert`,`emergency`]),st=s.extend({level:ot}),ct=l.extend({method:H(`logging/setLevel`),params:st}),lt=u.extend({level:ot,logger:j().optional(),data:F()}),ut=d.extend({method:H(`notifications/message`),params:lt}),dt=L({name:j().optional()}),ft=L({hints:I(dt).optional(),costPriority:N().min(0).max(1).optional(),speedPriority:N().min(0).max(1).optional(),intelligencePriority:N().min(0).max(1).optional()}),pt=L({mode:V([`auto`,`required`,`none`]).optional()}),mt=L({type:H(`tool_result`),toolUseId:j().describe(`The unique identifier for the corresponding tool call.`),content:I(Xe),structuredContent:L({}).loose().optional(),isError:P().optional(),_meta:B(j(),F()).optional()}),ht=xc(`type`,[Ge,Ke,qe]),gt=xc(`type`,[Ge,Ke,qe,Je,mt]),_t=L({role:be,content:z([gt,I(gt)]),_meta:B(j(),F()).optional()}),vt=c.extend({messages:I(_t),modelPreferences:ft.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(nt).optional(),toolChoice:pt.optional()}),yt=l.extend({method:H(`sampling/createMessage`),params:vt}),bt=f.extend({model:j(),stopReason:U(V([`endTurn`,`stopSequence`,`maxTokens`]).or(j())),role:be,content:ht}),xt=f.extend({model:j(),stopReason:U(V([`endTurn`,`stopSequence`,`maxTokens`,`toolUse`]).or(j())),role:be,content:z([gt,I(gt)])}),St=L({type:H(`boolean`),title:j().optional(),description:j().optional(),default:P().optional()}),Ct=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()}),wt=L({type:V([`number`,`integer`]),title:j().optional(),description:j().optional(),minimum:N().optional(),maximum:N().optional(),default:N().optional()}),Tt=L({type:H(`string`),title:j().optional(),description:j().optional(),enum:I(j()),default:j().optional()}),Et=L({type:H(`string`),title:j().optional(),description:j().optional(),oneOf:I(L({const:j(),title:j()})),default:j().optional()}),Dt=L({type:H(`string`),title:j().optional(),description:j().optional(),enum:I(j()),enumNames:I(j()).optional(),default:j().optional()}),Ot=z([Tt,Et]),kt=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()}),At=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()}),jt=z([kt,At]),Mt=z([Dt,Ot,jt]),Nt=z([Mt,St,Ct,wt]),Pt=c.extend({mode:H(`form`).optional(),message:j(),requestedSchema:L({type:H(`object`),properties:B(j(),Nt),required:I(j()).optional()}).catchall(F())}),Ft=c.extend({mode:H(`url`),message:j(),elicitationId:j(),url:j().url()}),It=z([Pt,Ft]),Lt=l.extend({method:H(`elicitation/create`),params:It}),Rt=u.extend({elicitationId:j()}),zt=d.extend({method:H(`notifications/elicitation/complete`),params:Rt}),Bt=f.extend({action:V([`accept`,`decline`,`cancel`]),content:Qc(e=>e===null?void 0:e,B(j(),z([j(),N(),P(),I(j())])).optional())}),Vt=L({type:H(`ref/resource`),uri:j()}),Ht=L({type:H(`ref/prompt`),name:j()}),Ut=s.extend({ref:z([Ht,Vt]),argument:L({name:j(),value:j()}),context:L({arguments:B(j(),j()).optional()}).optional()}),Wt=l.extend({method:H(`completion/complete`),params:Ut}),Gt=f.extend({completion:R({values:I(j()).max(100),total:U(N().int()),hasMore:U(P())})}),Kt=L({uri:j().startsWith(`file://`),name:j().optional(),_meta:B(j(),F()).optional()}),qt=l.extend({method:H(`roots/list`),params:s.optional()}),Jt=f.extend({roots:I(Kt)}),Yt=d.extend({method:H(`notifications/roots/list_changed`),params:u.optional()}),Xt=R({ttl:N().optional(),pollInterval:N().optional()}),Zt=V([`working`,`input_required`,`completed`,`failed`,`cancelled`]),Qt=L({taskId:j(),status:Zt,ttl:z([N(),dc()]),createdAt:j(),lastUpdatedAt:j(),pollInterval:U(N()),statusMessage:U(j())}),$t=f.extend({task:Qt}),en=u.merge(Qt),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(Qt),an=l.extend({method:H(`tasks/result`),params:s.extend({taskId:j()})}),on=f.loose(),T=y.extend({method:H(`tasks/list`)}),sn=b.extend({tasks:I(Qt)}),cn=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:g,BaseMetadataSchema:ne,ImplementationSchema:_,ClientTasksCapabilitySchema:ie,ServerTasksCapabilitySchema:ae,ClientCapabilitiesSchema:oe,InitializeRequestParamsSchema:v,InitializeRequestSchema:se,ServerCapabilitiesSchema:ce,InitializeResultSchema:le,InitializedNotificationSchema:ue,PingRequestSchema:de,ProgressSchema:fe,ProgressNotificationParamsSchema:pe,ProgressNotificationSchema:me,PaginatedRequestParamsSchema:he,PaginatedRequestSchema:y,PaginatedResultSchema:b,ResourceContentsSchema:ge,TextResourceContentsSchema:_e,BlobResourceContentsSchema:ye,RoleSchema:be,AnnotationsSchema:xe,ResourceSchema:Se,ResourceTemplateSchema:Ce,ListResourcesRequestSchema:we,ListResourcesResultSchema:Te,ListResourceTemplatesRequestSchema:Ee,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:Ke,AudioContentSchema:qe,ToolUseContentSchema:Je,EmbeddedResourceSchema:x,ResourceLinkSchema:Ye,ContentBlockSchema:Xe,PromptMessageSchema:Ze,GetPromptResultSchema:Qe,PromptListChangedNotificationSchema:$e,ToolAnnotationsSchema:et,ToolExecutionSchema:tt,ToolSchema:nt,ListToolsRequestSchema:S,ListToolsResultSchema:rt,CallToolResultSchema:it,CallToolRequestParamsSchema:C,CallToolRequestSchema:w,ToolListChangedNotificationSchema:at,LoggingLevelSchema:ot,SetLevelRequestParamsSchema:st,SetLevelRequestSchema:ct,LoggingMessageNotificationParamsSchema:lt,LoggingMessageNotificationSchema:ut,ModelHintSchema:dt,ModelPreferencesSchema:ft,ToolChoiceSchema:pt,ToolResultContentSchema:mt,SamplingContentSchema:ht,SamplingMessageContentBlockSchema:gt,SamplingMessageSchema:_t,CreateMessageRequestParamsSchema:vt,CreateMessageRequestSchema:yt,CreateMessageResultSchema:bt,CreateMessageResultWithToolsSchema:xt,BooleanSchemaSchema:St,StringSchemaSchema:Ct,NumberSchemaSchema:wt,UntitledSingleSelectEnumSchemaSchema:Tt,TitledSingleSelectEnumSchemaSchema:Et,LegacyTitledEnumSchemaSchema:Dt,SingleSelectEnumSchemaSchema:Ot,UntitledMultiSelectEnumSchemaSchema:kt,TitledMultiSelectEnumSchemaSchema:At,MultiSelectEnumSchemaSchema:jt,EnumSchemaSchema:Mt,PrimitiveSchemaDefinitionSchema:Nt,ElicitRequestFormParamsSchema:Pt,ElicitRequestURLParamsSchema:Ft,ElicitRequestParamsSchema:It,ElicitRequestSchema:Lt,ElicitationCompleteNotificationParamsSchema:Rt,ElicitationCompleteNotificationSchema:zt,ElicitResultSchema:Bt,ResourceTemplateReferenceSchema:Vt,PromptReferenceSchema:Ht,CompleteRequestParamsSchema:Ut,CompleteRequestSchema:Wt,CompleteResultSchema:Gt,RootSchema:Kt,ListRootsRequestSchema:qt,ListRootsResultSchema:Jt,RootsListChangedNotificationSchema:Yt,TaskCreationParamsSchema:Xt,TaskStatusSchema:Zt,TaskSchema:Qt,CreateTaskResultSchema:$t,TaskStatusNotificationParamsSchema:en,TaskStatusNotificationSchema:tn,GetTaskRequestSchema:nn,GetTaskResultSchema:rn,GetTaskPayloadRequestSchema:an,GetTaskPayloadResultSchema:on,ListTasksRequestSchema:T,ListTasksResultSchema:sn,CancelTaskRequestSchema:cn,CancelTaskResultSchema:f.merge(Qt),ClientRequestSchema:z([de,se,Wt,ct,We,Ve,we,Ee,Ae,Pe,Ie,w,S,nn,an,T,cn]),ClientNotificationSchema:z([ee,me,ue,Yt,tn]),ClientResultSchema:z([m,bt,xt,Bt,Jt,rn,sn,$t]),ServerRequestSchema:z([de,yt,Lt,qt,nn,an,T,cn]),ServerNotificationSchema:z([ee,me,ut,Re,Me,at,$e,tn,zt]),ServerResultSchema:z([m,le,Gt,Qe,He,Te,De,je,it,rt,rn,sn,$t]),CallToolResultWireSchema:F().superRefine((e,t)=>{if(typeof e==`object`&&e&&!Array.isArray(e)&&e.content===void 0){for(let n of Pf)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(Ff).pipe(it)}}var Lf;function Rf(){return Lf??=If()}function zf(e){return e.type!==`object`}var Bf=new Set([`const`,`enum`,`default`,`examples`]),Vf=new Set([`properties`,`patternProperties`,`$defs`,`definitions`,`dependentSchemas`,`dependencies`]);function Hf(e){return e!==void 0&&!(typeof e==`string`&&e.startsWith(`#`))}function Uf(e){let t=typeof e.$schema==`string`?e.$schema:void 0;if(Hf(e.$id))return{...t!==void 0&&{$schema:t},type:`object`,properties:{result:e},required:[`result`]};let n=s(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&&Hf(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]=Bf.has(o)?s:Vf.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 Wf={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},Gf={"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},Kf={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},qf;function Jf(){if(qf)return qf;let e=Rf();return qf={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}},qf}function Yf(e){return Object.prototype.hasOwnProperty.call(Wf,e)}function Xf(e){return Object.prototype.hasOwnProperty.call(Gf,e)}function Zf(e){return Object.prototype.hasOwnProperty.call(Kf,e)}function Qf(e){return Zf(e)?Jf().resultSchemas[e]:void 0}function $f(e){return Yf(e)?Jf().requestSchemas[e]:void 0}function ep(e){return Xf(e)?Jf().notificationSchemas[e]:void 0}Object.keys(Wf),Object.keys(Gf);function tp(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function np(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 rp={ok:!1,reason:`not-in-era`};function ip(e){return tp(e)&&tp(e.outputSchema)&&zf(e.outputSchema)}function ap(e){return e}var op={era:`2025-11-25`,hasRequestMethod:Yf,hasNotificationMethod:Xf,validateRequest:(e,t)=>np($f(e),t),validateResult:(e,t)=>np(Qf(e),t),validateNotification:(e,t)=>np(ep(e),t),hasInputRequestMethod:()=>!1,validateInputRequest:()=>rp,validateInputResponse:()=>rp,samplingResultVariant:((e,t)=>{let n=Rf();return np(e?n.CreateMessageResultWithToolsSchema:n.CreateMessageResultSchema,t)}),outboundEnvelope:e=>void 0,validateEnvelopeMeta:e=>[],projectCallToolResult(e,t){let n=Nf(e),r=n.structuredContent;if(r===void 0)return n;let i=typeof r!=`object`||!r||Array.isArray(r),a=t!==void 0&&zf(t);return!i&&!a?n:{...n,structuredContent:{result:r}}},decodeResult(e,t){if(tp(t)&&`resultType`in t){let e={...t};return delete e.resultType,{kind:`complete`,result:ap(e)}}return{kind:`complete`,result:ap(t)}},encodeResult(e,t){if(e!==`tools/list`)return t;let n=t.tools;return!Array.isArray(n)||!n.some(e=>ip(e))?t:{...t,tools:n.map(e=>ip(e)?{...e,outputSchema:Uf(e.outputSchema)}:e)}},encodeErrorCode:e=>e===-32002?-32602:e,checkInboundEnvelope:e=>void 0};function sp(){let e=Jc(()=>z([j(),N(),P(),dc(),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()}),g=te.extend({...te.shape,...ee.shape,version:j(),websiteUrl:j().optional(),description:j().optional()}),ne=Qc(e=>e&&typeof e==`object`&&!Array.isArray(e)&&Object.keys(e).length===0?{form:{}}:e,Cc(L({form:Cc(L({applyDefaults:P().optional()}),t).optional(),url:t.optional()}),t.optional())),_=R({list:t.optional(),cancel:t.optional(),requests:R({sampling:R({createMessage:t.optional()}).optional(),elicitation:R({create:t.optional()}).optional()}).optional()}),re=R({list:t.optional(),cancel:t.optional(),requests:R({tools:R({call:t.optional()}).optional()}).optional()}),ie=L({experimental:B(j(),t).optional(),sampling:L({context:t.optional(),tools:t.optional()}).optional(),elicitation:ne.optional(),roots:L({listChanged:P().optional()}).optional(),tasks:_.optional(),extensions:B(j(),t).optional()}),ae=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:re.optional(),extensions:B(j(),t).optional()}),oe=L({progress:N(),total:U(N()),message:U(j())}),v=L({...p.shape,...oe.shape,progressToken:n}),se=m.extend({method:H(`notifications/progress`),params:v}),ce=p.extend({level:o,logger:j().optional(),data:F()}),le=m.extend({method:H(`notifications/message`),params:ce}),ue=L({uri:j(),mimeType:U(j()),_meta:B(j(),F()).optional()}),de=ue.extend({text:j()}),fe=ue.extend({blob:s}),pe=L({audience:I(a).optional(),priority:N().min(0).max(1).optional(),lastModified:tl({offset:!0}).optional()}),me=L({...te.shape,...ee.shape,uri:j(),description:U(j()),mimeType:U(j()),size:U(N()),annotations:pe.optional(),_meta:U(R({}))}),he=L({...te.shape,...ee.shape,uriTemplate:j(),description:U(j()),mimeType:U(j()),annotations:pe.optional(),_meta:U(R({}))}),y=m.extend({method:H(`notifications/resources/list_changed`),params:p.optional()}),b=p.extend({uri:j()}),ge=m.extend({method:H(`notifications/resources/updated`),params:b}),_e=L({name:j(),description:U(j()),required:U(P())}),ve=L({...te.shape,...ee.shape,description:U(j()),arguments:U(I(_e)),_meta:U(R({}))}),ye=m.extend({method:H(`notifications/prompts/list_changed`),params:p.optional()}),be=L({type:H(`text`),text:j(),annotations:pe.optional(),_meta:B(j(),F()).optional()}),xe=L({type:H(`image`),data:s,mimeType:j(),annotations:pe.optional(),_meta:B(j(),F()).optional()}),Se=L({type:H(`audio`),data:s,mimeType:j(),annotations:pe.optional(),_meta:B(j(),F()).optional()}),Ce=L({type:H(`tool_use`),name:j(),id:j(),input:B(j(),F()),_meta:B(j(),F()).optional()}),we=L({type:H(`resource`),resource:z([de,fe]),annotations:pe.optional(),_meta:B(j(),F()).optional()}),Te=me.extend({type:H(`resource_link`)}),Ee=z([be,xe,Se,Te,we]),De=L({role:a,content:Ee}),Oe=L({title:j().optional(),readOnlyHint:P().optional(),destructiveHint:P().optional(),idempotentHint:P().optional(),openWorldHint:P().optional()}),ke=m.extend({method:H(`notifications/tools/list_changed`),params:p.optional()}),Ae=L({name:j().optional()}),je=L({hints:I(Ae).optional(),costPriority:N().min(0).max(1).optional(),speedPriority:N().min(0).max(1).optional(),intelligencePriority:N().min(0).max(1).optional()}),Me=L({mode:V([`auto`,`required`,`none`]).optional()}),Ne=L({type:H(`boolean`),title:j().optional(),description:j().optional(),default:P().optional()}),Pe=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()}),Fe=L({type:V([`number`,`integer`]),title:j().optional(),description:j().optional(),minimum:N().optional(),maximum:N().optional(),default:N().optional()}),Ie=L({type:H(`string`),title:j().optional(),description:j().optional(),enum:I(j()),default:j().optional()}),Le=L({type:H(`string`),title:j().optional(),description:j().optional(),oneOf:I(L({const:j(),title:j()})),default:j().optional()}),Re=L({type:H(`string`),title:j().optional(),description:j().optional(),enum:I(j()),enumNames:I(j()).optional(),default:j().optional()}),ze=z([Ie,Le]),Be=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()}),Ve=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()}),He=z([Be,Ve]),Ue=z([Re,ze,He]),We=z([Ue,Ne,Pe,Fe]),Ge=f.extend({mode:H(`form`).optional(),message:j(),requestedSchema:L({type:H(`object`),properties:B(j(),We),required:I(j()).optional()}).catchall(F())}),Ke=L({type:H(`ref/resource`),uri:j()}),qe=L({type:H(`ref/prompt`),name:j()}),Je=L({uri:j().startsWith(`file://`),name:j().optional(),_meta:B(j(),F()).optional()}),x=ie.shape,Ye=L({experimental:x.experimental,sampling:x.sampling,elicitation:x.elicitation,roots:x.roots,extensions:x.extensions}),Xe=ae.shape,Ze=L({experimental:Xe.experimental,logging:Xe.logging,completions:Xe.completions,prompts:Xe.prompts,resources:Xe.resources,tools:Xe.tools,extensions:Xe.extensions}),Qe=R({progressToken:n.optional(),[ol]:j(),[sl]:g.optional(),[ll]:Ye,[dl]:o.optional()}),$e=L({...te.shape,...ee.shape,description:j().optional(),inputSchema:R({$schema:j().optional(),type:H(`object`)}),outputSchema:R({$schema:j().optional()}).optional(),annotations:Oe.optional(),_meta:B(j(),F()).optional()}),et=L({type:H(`tool_result`),toolUseId:j(),content:I(Ee),structuredContent:F().optional(),isError:P().optional(),_meta:B(j(),F()).optional()}),tt=z([be,xe,Se,Ce,et]),nt=L({role:a,content:z([tt,I(tt)]),_meta:B(j(),F()).optional()}),S=j(),rt=R({[cl]:g.optional().catch(void 0)}),it=rt.optional();function C(e){return R({_meta:it,resultType:S.default(`complete`),...e})}let w=C({}),at=C({nextCursor:r.optional()}),ot=C({content:I(Ee),structuredContent:F().optional(),isError:P().optional()}),st=C({ttlMs:N().int().min(0),cacheScope:V([`public`,`private`]),tools:I($e),nextCursor:r.optional()}),ct=C({ttlMs:N().int().min(0),cacheScope:V([`public`,`private`]),prompts:I(ve),nextCursor:r.optional()}),lt=C({description:j().optional(),messages:I(De)}),ut=C({ttlMs:N().int().min(0),cacheScope:V([`public`,`private`]),resources:I(me),nextCursor:r.optional()}),dt=C({ttlMs:N().int().min(0),cacheScope:V([`public`,`private`]),resourceTemplates:I(he),nextCursor:r.optional()}),ft=C({ttlMs:N().int().min(0),cacheScope:V([`public`,`private`]),contents:I(z([de,fe]))}),pt=C({completion:L({values:I(j()).max(100),total:N().int().optional(),hasMore:P().optional()}).loose()}),mt=C({ttlMs:N().int().min(0),cacheScope:V([`public`,`private`])}),ht=C({ttlMs:N().int().min(0).catch(0),cacheScope:V([`public`,`private`]).catch(`private`),supportedVersions:I(j()),capabilities:Ze,instructions:j().optional()}),gt=L({messages:I(nt),modelPreferences:je.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($e).optional(),toolChoice:Me.optional()}),_t=L({method:H(`sampling/createMessage`),params:gt}),vt=L({method:H(`roots/list`),params:L({_meta:B(j(),F()).optional()}).optional()}),yt=L({...nt.shape,model:j(),stopReason:j().optional()}),bt=L({roots:I(Je)}),xt=L({action:V([`accept`,`decline`,`cancel`]),content:B(j(),z([j(),N(),P(),I(j())])).optional()}),St=L({mode:H(`url`),message:j(),url:j().url()}),Ct=z([Ge,St]),wt=L({method:H(`elicitation/create`),params:Ct}),Tt=z([_t,vt,wt]),Et=z([yt,bt,xt]),Dt=B(j(),Tt),Ot=B(j(),Et),kt=C({inputRequests:Dt.optional(),requestState:j().optional()}),At={inputResponses:Ot.optional(),requestState:j().optional()},jt=L({_meta:Qe,...At}),Mt=R({progressToken:n.optional()});function Nt(e,t){return L({method:H(e),params:L({_meta:Qe,...t})})}function Pt(e,t){return L({method:H(e),params:L({_meta:Mt.optional(),...t}).optional()})}let Ft={name:j(),arguments:B(j(),F()).optional(),...At},It={cursor:r.optional()},Lt=Nt(`tools/call`,Ft),Rt=Nt(`tools/list`,It),zt=Nt(`prompts/list`,It),Bt=Nt(`prompts/get`,{name:j(),arguments:B(j(),j()).optional(),...At}),Vt=Nt(`resources/list`,It),Ht=Nt(`resources/templates/list`,It),Ut=Nt(`resources/read`,{uri:j(),...At}),Wt={ref:z([qe,Ke]),argument:L({name:j(),value:j()}),context:L({arguments:B(j(),j()).optional()}).optional()},Gt=Nt(`completion/complete`,Wt),Kt=Nt(`server/discover`,{}),qt=L({toolsListChanged:P().optional(),promptsListChanged:P().optional(),resourcesListChanged:P().optional(),resourceSubscriptions:I(j()).optional()}),Jt={notifications:qt},Yt=Nt(`subscriptions/listen`,Jt),Xt=rt.extend({"io.modelcontextprotocol/subscriptionId":i}),Zt=R({_meta:Xt,resultType:S.default(`complete`)}),Qt={"tools/call":Pt(`tools/call`,Ft),"tools/list":Pt(`tools/list`,It),"prompts/get":Pt(`prompts/get`,{name:j(),arguments:B(j(),j()).optional()}),"prompts/list":Pt(`prompts/list`,It),"resources/list":Pt(`resources/list`,It),"resources/templates/list":Pt(`resources/templates/list`,It),"resources/read":Pt(`resources/read`,{uri:j()}),"completion/complete":Pt(`completion/complete`,Wt),"server/discover":Pt(`server/discover`,{}),"subscriptions/listen":Pt(`subscriptions/listen`,Jt)};function $t(e){return R({_meta:it,...e})}let en={"tools/call":$t({content:I(Ee),structuredContent:F().optional(),isError:P().optional()}),"tools/list":$t({ttlMs:N().int().min(0),cacheScope:V([`public`,`private`]),tools:I($e),nextCursor:r.optional()}),"prompts/get":$t({description:j().optional(),messages:I(De)}),"prompts/list":$t({ttlMs:N().int().min(0),cacheScope:V([`public`,`private`]),prompts:I(ve),nextCursor:r.optional()}),"resources/list":$t({ttlMs:N().int().min(0),cacheScope:V([`public`,`private`]),resources:I(me),nextCursor:r.optional()}),"resources/templates/list":$t({ttlMs:N().int().min(0),cacheScope:V([`public`,`private`]),resourceTemplates:I(he),nextCursor:r.optional()}),"resources/read":$t({ttlMs:N().int().min(0),cacheScope:V([`public`,`private`]),contents:I(z([de,fe]))}),"completion/complete":$t({completion:L({values:I(j()).max(100),total:N().int().optional(),hasMore:P().optional()}).loose()}),"server/discover":$t({ttlMs:N().int().min(0).catch(0),cacheScope:V([`public`,`private`]).catch(`private`),supportedVersions:I(j()),capabilities:Ze,instructions:j().optional()}),"subscriptions/listen":$t({})},tn=R({"io.modelcontextprotocol/subscriptionId":i.optional()}),nn=L({method:H(`notifications/subscriptions/acknowledged`),params:L({_meta:tn.optional(),notifications:qt})}),rn=L({_meta:tn.optional(),requestId:i,reason:j().optional()}),an=L({method:H(`notifications/cancelled`),params:rn}),on={"notifications/cancelled":an,"notifications/progress":se,"notifications/message":le,"notifications/resources/updated":ge,"notifications/resources/list_changed":y,"notifications/tools/list_changed":ke,"notifications/prompts/list_changed":ye,"notifications/subscriptions/acknowledged":nn},T=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:g,ClientTasksCapabilitySchema:_,ServerTasksCapabilitySchema:re,ClientCapabilitiesSchema:ie,ServerCapabilitiesSchema:ae,ProgressSchema:oe,ProgressNotificationParamsSchema:v,ProgressNotificationSchema:se,LoggingMessageNotificationParamsSchema:ce,LoggingMessageNotificationSchema:le,ResourceContentsSchema:ue,TextResourceContentsSchema:de,BlobResourceContentsSchema:fe,AnnotationsSchema:pe,ResourceSchema:me,ResourceTemplateSchema:he,ResourceListChangedNotificationSchema:y,ResourceUpdatedNotificationParamsSchema:b,ResourceUpdatedNotificationSchema:ge,PromptArgumentSchema:_e,PromptSchema:ve,PromptListChangedNotificationSchema:ye,TextContentSchema:be,ImageContentSchema:xe,AudioContentSchema:Se,ToolUseContentSchema:Ce,EmbeddedResourceSchema:we,ResourceLinkSchema:Te,ContentBlockSchema:Ee,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:Ke,PromptReferenceSchema:qe,RootSchema:Je,ClientCapabilities2026Schema:Ye,ServerCapabilities2026Schema:Ze,RequestMetaEnvelopeSchema:Qe,ToolSchema:$e,ToolResultContentSchema:et,SamplingMessageContentBlockSchema:tt,SamplingMessageSchema:nt,ResultTypeSchema:S,ResultMetaSchema:rt,ResultSchema:w,PaginatedResultSchema:at,CallToolResultSchema:ot,ListToolsResultSchema:st,ListPromptsResultSchema:ct,GetPromptResultSchema:lt,ListResourcesResultSchema:ut,ListResourceTemplatesResultSchema:dt,ReadResourceResultSchema:ft,CompleteResultSchema:pt,CacheableResultSchema:mt,DiscoverResultSchema:ht,CreateMessageRequestParamsSchema:gt,CreateMessageRequestSchema:_t,ListRootsRequestSchema:vt,CreateMessageResultSchema:yt,ListRootsResultSchema:bt,ElicitResultSchema:xt,ElicitRequestURLParamsSchema:St,ElicitRequestParamsSchema:Ct,ElicitRequestSchema:wt,InputRequestSchema:Tt,InputResponseSchema:Et,InputRequestsSchema:Dt,InputResponsesSchema:Ot,InputRequiredResultSchema:kt,InputResponseRequestParamsSchema:jt,CallToolRequestSchema:Lt,ListToolsRequestSchema:Rt,ListPromptsRequestSchema:zt,GetPromptRequestSchema:Bt,ListResourcesRequestSchema:Vt,ListResourceTemplatesRequestSchema:Ht,ReadResourceRequestSchema:Ut,CompleteRequestSchema:Gt,DiscoverRequestSchema:Kt,SubscriptionFilterSchema:qt,SubscriptionsListenRequestSchema:Yt,SubscriptionsListenResultMetaSchema:Xt,SubscriptionsListenResultSchema:Zt,dispatchRequestSchemas:Qt,dispatchResultSchemas:en,NotificationMetaSchema:tn,SubscriptionsAcknowledgedNotificationSchema:nn,CancelledNotificationParamsSchema:rn,CancelledNotificationSchema:an,notificationSchemas2026:on,JSONRPCResultResponseSchema:T(w),CallToolResultResponseSchema:T(z([ot,kt])),ListToolsResultResponseSchema:T(st),ListPromptsResultResponseSchema:T(ct),GetPromptResultResponseSchema:T(z([lt,kt])),ListResourcesResultResponseSchema:T(ut),ListResourceTemplatesResultResponseSchema:T(dt),ReadResourceResultResponseSchema:T(z([ft,kt])),CompleteResultResponseSchema:T(pt),DiscoverResultResponseSchema:T(ht),SubscriptionsListenResultResponseSchema:T(Zt)}}var cp;function lp(){return cp??=sp()}var up=[`tools/list`,`prompts/list`,`resources/list`,`resources/templates/list`,`resources/read`,`server/discover`];function dp(e){return up.includes(e)}var fp=Symbol(`modelcontextprotocol.resultCacheHintFallback`);function pp(e){return e[fp]}function mp(e){return typeof e==`number`&&Number.isSafeInteger(e)&&e>=0}function hp(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 Af(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 Af(this,e)}constructor(e,t,n){super(t),this.code=e,this.data=n,this.name=`ProtocolError`,kf(this,new.target)}static fromError(t,n,r){if(t===Z.UrlElicitationRequired&&r){let e=r;if(e.elicitations)return new _p(e.elicitations,n)}if(t===Z.UnsupportedProtocolVersion&&r){let e=r;if(Array.isArray(e.supported)&&typeof e.requested==`string`)return new vp({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 gp(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 yp({requiredCapabilities:e.requiredCapabilities},n)}return new e(t,n,r)}},gp=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}},_p=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??[]}},vp=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}},yp=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}},bp=0,xp=`private`,Sp=[`tools/call`,`prompts/get`,`resources/read`];function Cp(e,t){let n=t.resultType;if(n===void 0)return{...t,resultType:`complete`};if(n===`complete`||Sp.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 wp(e,t){let n=pp(t);if(t.resultType!==`complete`||!dp(e))return n===void 0?t:kp(t);let r=t,i=mp(r.ttlMs)?r.ttlMs:Dp(n),a=hp(r.cacheScope)?r.cacheScope:Op(n),o={...r,ttlMs:i,cacheScope:a};return delete o[fp],o}function Tp(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Ep(e,t){if(t===void 0)return e;let n=e._meta;return n===void 0?{...e,_meta:{[cl]:t}}:!Tp(n)||n[`io.modelcontextprotocol/serverInfo`]!==void 0?e:{...e,_meta:{...n,[cl]:t}}}function Dp(e){return e!==void 0&&mp(e.ttlMs)?e.ttlMs:bp}function Op(e){return e!==void 0&&hp(e.cacheScope)?e.cacheScope:xp}function kp(e){let t={...e};return delete t[fp],t}var Ap=[`elicitation/create`,`sampling/createMessage`,`roots/list`],jp;function Mp(){if(jp)return jp;let e=lp();return jp={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}},jp}function Np(e){return Ap.includes(e)}function Pp(e){return Np(e)?Mp().request[e]:void 0}function Fp(e){return Np(e)?Mp().response[e]:void 0}var Ip={"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},Lp={"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 Rp(e){return Object.prototype.hasOwnProperty.call(Ip,e)}function zp(e){return Object.prototype.hasOwnProperty.call(Lp,e)}function Bp(e){return Object.prototype.hasOwnProperty.call(Ip,e)}function Vp(e){return Rp(e)?lp().dispatchRequestSchemas[e]:void 0}function Hp(e){return Bp(e)?lp().dispatchResultSchemas[e]:void 0}function Up(e){return zp(e)?lp().notificationSchemas2026[e]:void 0}Object.keys(Ip),Object.keys(Lp);function Wp(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Gp(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 Kp={ok:!1,reason:`not-in-era`},qp=[ol,ll];function Jp(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=>Wp(e)&&`execution`in e)&&(i().tools=a.map(e=>{if(!Wp(e)||!(`execution`in e))return e;let t={...e};return delete t.execution,t}));let o=t.capabilities;if(Wp(o)&&`tasks`in o){let e={...o};delete e.tasks,i().capabilities=e}return n}var Yp={era:`2026-07-28`,hasRequestMethod:Rp,hasNotificationMethod:zp,hasInputRequestMethod:e=>Pp(e)!==void 0,validateRequest:(e,t)=>Gp(Vp(e),t),validateResult:(e,t)=>Gp(Hp(e),t),validateNotification:(e,t)=>Gp(Up(e),t),validateInputRequest:(e,t)=>Gp(Pp(e),t),validateInputResponse:(e,t)=>Gp(Fp(e),t),samplingResultVariant:()=>Kp,outboundEnvelope(e){return{[ol]:e.protocolVersion,[sl]:e.clientInfo,[ll]:e.clientCapabilities,...e.logLevel!==void 0&&{"io.modelcontextprotocol/logLevel":e.logLevel}}},validateEnvelopeMeta(e){let t=[];for(let n of qp)n in e||t.push({key:n,problem:`missing`});let n=lp().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=>Nf(e),inputRequestSchema:Pp,decodeResult(e,t){if(!Wp(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=Wp(n)?n:{},i=t.requestState,a=t._meta===void 0?void 0:lp().ResultMetaSchema.safeParse(t._meta),o=a?.success?a.data:void 0;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},...o!==void 0&&{_meta:o}}}if(n!==`complete`)return{kind:`invalid`,error:new X(Y.UnsupportedResultType,`Unsupported result type '${n}' for ${e}`,{resultType:n,method:e})};let r=Zp(),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 Ep(wp(e,Cp(e,Jp(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=lp().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(`; `)}`}},Xp;function Zp(){if(Xp)return Xp;let e=lp();return Xp={"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},Xp}var Qp=`2026-07-28`;function $p(e){return e!==void 0&&Mf(e)?Yp:op}function em(e){return e.revision===void 0?e.era===`modern`?Yp.era:op.era:$p(e.revision).era}function tm(e){return im.some(t=>t.hasRequestMethod(e))}function nm(e){return im.some(t=>t.hasNotificationMethod(e))}function rm(e){return e===`tasks/get`||e===`tasks/cancel`}var im=[op,Yp],am=a({AnnotationsSchema:()=>ou,AudioContentSchema:()=>zu,BaseMetadataSchema:()=>Fl,BaseRequestParamsSchema:()=>G,BlobResourceContentsSchema:()=>iu,BooleanSchemaSchema:()=>bd,CallToolRequestParamsSchema:()=>ed,CallToolRequestSchema:()=>td,CallToolResultSchema:()=>Qu,CancelTaskRequestSchema:()=>sf,CancelTaskResultSchema:()=>cf,CancelledNotificationParamsSchema:()=>jl,CancelledNotificationSchema:()=>Ml,ClientCapabilitiesSchema:()=>Bl,ClientNotificationSchema:()=>uf,ClientRequestSchema:()=>lf,ClientResultSchema:()=>df,ClientTasksCapabilitySchema:()=>Rl,CompatibilityCallToolResultSchema:()=>$u,CompleteRequestParamsSchema:()=>Vd,CompleteRequestSchema:()=>Hd,CompleteResultSchema:()=>Ud,ContentBlockSchema:()=>Uu,CreateMessageRequestParamsSchema:()=>gd,CreateMessageRequestSchema:()=>_d,CreateMessageResultSchema:()=>vd,CreateMessageResultWithToolsSchema:()=>yd,CreateTaskResultSchema:()=>Zd,CursorSchema:()=>hl,DiscoverRequestSchema:()=>Kl,DiscoverResultSchema:()=>ql,ElicitRequestFormParamsSchema:()=>Md,ElicitRequestParamsSchema:()=>Pd,ElicitRequestSchema:()=>Fd,ElicitRequestURLParamsSchema:()=>Nd,ElicitResultSchema:()=>Rd,ElicitationCompleteNotificationParamsSchema:()=>Id,ElicitationCompleteNotificationSchema:()=>Ld,EmbeddedResourceSchema:()=>Vu,EmptyResultSchema:()=>Al,EnumSchemaSchema:()=>Ad,GetPromptRequestParamsSchema:()=>Fu,GetPromptRequestSchema:()=>Iu,GetPromptResultSchema:()=>Gu,GetTaskPayloadRequestSchema:()=>nf,GetTaskPayloadResultSchema:()=>rf,GetTaskRequestSchema:()=>ef,GetTaskResultSchema:()=>tf,IconSchema:()=>Nl,IconsSchema:()=>Pl,ImageContentSchema:()=>Ru,ImplementationSchema:()=>Il,InitializeRequestParamsSchema:()=>Vl,InitializeRequestSchema:()=>Hl,InitializeResultSchema:()=>Wl,InitializedNotificationSchema:()=>Gl,JSONArraySchema:()=>pl,JSONObjectSchema:()=>W,JSONRPCErrorResponseSchema:()=>Dl,JSONRPCMessageSchema:()=>Ol,JSONRPCNotificationSchema:()=>Tl,JSONRPCRequestSchema:()=>wl,JSONRPCResponseSchema:()=>kl,JSONRPCResultResponseSchema:()=>El,JSONValueSchema:()=>fl,LegacyTitledEnumSchemaSchema:()=>Td,ListChangedOptionsBaseSchema:()=>rd,ListPromptsRequestSchema:()=>Nu,ListPromptsResultSchema:()=>Pu,ListResourceTemplatesRequestSchema:()=>du,ListResourceTemplatesResultSchema:()=>fu,ListResourcesRequestSchema:()=>lu,ListResourcesResultSchema:()=>uu,ListRootsRequestSchema:()=>Gd,ListRootsResultSchema:()=>Kd,ListTasksRequestSchema:()=>af,ListTasksResultSchema:()=>of,ListToolsRequestSchema:()=>Xu,ListToolsResultSchema:()=>Zu,LoggingLevelSchema:()=>id,LoggingMessageNotificationParamsSchema:()=>sd,LoggingMessageNotificationSchema:()=>cd,ModelHintSchema:()=>ld,ModelPreferencesSchema:()=>ud,MultiSelectEnumSchemaSchema:()=>kd,NotificationSchema:()=>xl,NotificationsParamsSchema:()=>bl,NumberSchemaSchema:()=>Sd,PaginatedRequestParamsSchema:()=>Ql,PaginatedRequestSchema:()=>$l,PaginatedResultSchema:()=>eu,PingRequestSchema:()=>Jl,PrimitiveSchemaDefinitionSchema:()=>jd,ProgressNotificationParamsSchema:()=>Xl,ProgressNotificationSchema:()=>Zl,ProgressSchema:()=>Yl,ProgressTokenSchema:()=>ml,PromptArgumentSchema:()=>ju,PromptListChangedNotificationSchema:()=>Ku,PromptMessageSchema:()=>Wu,PromptReferenceSchema:()=>Bd,PromptSchema:()=>Mu,ReadResourceRequestParamsSchema:()=>mu,ReadResourceRequestSchema:()=>hu,ReadResourceResultSchema:()=>gu,RelatedTaskMetadataSchema:()=>_l,RequestIdSchema:()=>Cl,RequestMetaSchema:()=>vl,RequestSchema:()=>K,ResourceContentsSchema:()=>tu,ResourceLinkSchema:()=>Hu,ResourceListChangedNotificationSchema:()=>_u,ResourceRequestParamsSchema:()=>pu,ResourceSchema:()=>su,ResourceTemplateReferenceSchema:()=>zd,ResourceTemplateSchema:()=>cu,ResourceUpdatedNotificationParamsSchema:()=>ku,ResourceUpdatedNotificationSchema:()=>Au,ResultMetaObjectSchema:()=>Sl,ResultSchema:()=>q,RoleSchema:()=>au,RootSchema:()=>Wd,RootsListChangedNotificationSchema:()=>qd,SamplingContentSchema:()=>pd,SamplingMessageContentBlockSchema:()=>md,SamplingMessageSchema:()=>hd,ServerCapabilitiesSchema:()=>Ul,ServerNotificationSchema:()=>pf,ServerRequestSchema:()=>ff,ServerResultSchema:()=>mf,ServerTasksCapabilitySchema:()=>zl,SetLevelRequestParamsSchema:()=>ad,SetLevelRequestSchema:()=>od,SingleSelectEnumSchemaSchema:()=>Ed,StringSchemaSchema:()=>xd,SubscribeRequestParamsSchema:()=>vu,SubscribeRequestSchema:()=>yu,SubscriptionFilterSchema:()=>Su,SubscriptionsAcknowledgedNotificationParamsSchema:()=>Tu,SubscriptionsAcknowledgedNotificationSchema:()=>Eu,SubscriptionsListenRequestParamsSchema:()=>Cu,SubscriptionsListenRequestSchema:()=>wu,SubscriptionsListenResultMetaSchema:()=>Du,SubscriptionsListenResultSchema:()=>Ou,TaskAugmentedRequestParamsSchema:()=>yl,TaskCreationParamsSchema:()=>Jd,TaskMetadataSchema:()=>gl,TaskSchema:()=>Xd,TaskStatusNotificationParamsSchema:()=>Qd,TaskStatusNotificationSchema:()=>$d,TaskStatusSchema:()=>Yd,TextContentSchema:()=>Lu,TextResourceContentsSchema:()=>nu,TitledMultiSelectEnumSchemaSchema:()=>Od,TitledSingleSelectEnumSchemaSchema:()=>wd,ToolAnnotationsSchema:()=>qu,ToolChoiceSchema:()=>dd,ToolExecutionSchema:()=>Ju,ToolListChangedNotificationSchema:()=>nd,ToolResultContentSchema:()=>fd,ToolSchema:()=>Yu,ToolUseContentSchema:()=>Bu,UnsubscribeRequestParamsSchema:()=>bu,UnsubscribeRequestSchema:()=>xu,UntitledMultiSelectEnumSchemaSchema:()=>Dd,UntitledSingleSelectEnumSchemaSchema:()=>Cd}),om=e=>wl.safeParse(e).success,sm=e=>Tl.safeParse(e).success,cm=e=>El.safeParse(e).success,lm=e=>Dl.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 um(e,t){return ys(e,t)}function dm(e){return new Set(e.flatMap(e=>Object.keys(e.shape)))}function fm(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 pm=!1,mm=`draft-2020-12`;function hm(e,t=`input`){let n=e[`~standard`],r;if(n.jsonSchema)r=n.jsonSchema[t]({target:mm});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().`);pm||(pm=!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=ps(e,{target:mm,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&&gm(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 gm(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`||gm(e)))}return!1}function _m(e){return e.path?.length?`${e.path.map(e=>String(typeof e==`object`?e.key:e)).join(`.`)}: ${e.message}`:e.message}async function vm(e,t){let n=await e[`~standard`].validate(t);return n.issues&&n.issues.length>0?{success:!1,error:n.issues.map(e=>_m(e)).join(`, `)}:{success:!0,data:n.value}}function ym(e){let t=ps(e,{target:mm,io:`input`});return typeof t.pattern==`string`?t.pattern:void 0}var bm=/\\\.\\d\{(\d+)\}/;function xm(e){let t=bm.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=>tl({local:e,offset:t,precision:n}))))}function Sm(e,t){let n;switch(e){case`email`:n=[Rs()];break;case`uri`:n=[Hs()];break;case`date`:n=[nl()];break;case`date-time`:n=xm(t)}return new Set(n.map(e=>ym(e)).filter(e=>e!==void 0))}function Cm(e,t,n){return n!==`zod`||Sm(e,t).has(t)}function wm(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Tm(e){try{return hm(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 Em=new Set([`$comment`,`deprecated`,`description`,`examples`,`readOnly`,`title`,`writeOnly`]);function Dm(e){return Em.has(e)||e.startsWith(`x-`)}var Om=new Set([`$schema`,...Object.keys(Md.shape.requestedSchema.shape)]),km={string:dm([xd,Cd,wd,Td]),number:dm([Sd]),integer:dm([Sd]),boolean:dm([bd]),array:dm([Dd,Od])},Am=new Set(xd.shape.format.unwrap().options);function jm(e,t,n,r){if(!wm(e))return e;let i=typeof e.type==`string`&&Object.hasOwn(km,e.type)?km[e.type]:void 0;if(i===void 0)return e;let a={};for(let[o,s]of Object.entries(e))i.has(o)||Dm(o)?a[o]=s:o===`pattern`&&e.type===`string`&&typeof e.format==`string`?Am.has(e.format)?(typeof s!=`string`||!Cm(e.format,s,n))&&r.push(`${t}.${o}`):a[o]=s:r.push(`${t}.${o}`);return a}function Mm(e,t){let n={},r=[];for(let[i,a]of Object.entries(e))i===`properties`&&wm(a)?n[i]=Object.fromEntries(Object.entries(a).map(([e,n])=>[e,jm(n,`properties.${e}`,t,r)])):Om.has(i)?n[i]=a:Dm(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 Nm(e,t){if(!wm(e.properties))return t;let n=Object.entries(e.properties).filter(([,e])=>!um(jd,e).success).map(([e])=>`properties.${e}`);return n.length>0?n.join(`, `):t}function Pm(e,t,n=``){return Array.isArray(e)&&Array.isArray(t)?e.flatMap((e,r)=>Pm(e,t[r],`${n}[${r}]`)):!wm(e)||!wm(t)?[]:Object.entries(e).flatMap(([e,r])=>{let i=n?`${n}.${e}`:e;return Object.prototype.hasOwnProperty.call(t,e)?Pm(r,t[e],i):Dm(e)?[]:[i]})}function Fm(e){if(!fm(e.requestedSchema))return{...e,mode:`form`,requestedSchema:e.requestedSchema};let t=e.requestedSchema[`~standard`].vendor,n=Mm(Tm(e.requestedSchema),t),r=um(Md.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): ${Nm(n,r.error.message)}`);let i=Pm(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 Im(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(Im,{elicit(e){try{return{method:`elicitation/create`,params:Fm(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 Lm=`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(`.`),Rm={IdJagTokenExchangeResponseSchema:bf,OAuthClientInformationFullSchema:Tf,OAuthClientInformationSchema:wf,OAuthClientMetadataSchema:Cf,OAuthClientRegistrationErrorSchema:Ef,OAuthErrorResponseSchema:xf,OAuthMetadataSchema:gf,OAuthProtectedResourceMetadataSchema:hf,OAuthTokenRevocationRequestSchema:Df,OAuthTokensSchema:yf,OpenIdProviderDiscoveryMetadataSchema:vf,OpenIdProviderMetadataSchema:_f},zm={},Bm={};function Vm(e,t){let n=e.slice(0,-6);zm[n]=t,Bm[n]=e=>t.safeParse(e).success}for(let e of Lm)Vm(e,am[e]);for(let[e,t]of Object.entries(Rm))Vm(e,t);Object.freeze(zm),Object.freeze(Bm);function Hm(e){switch(e){case`initialize`:case`notifications/initialized`:return $p(void 0);case`server/discover`:return $p(Qp);default:return}}var Um=[ol,sl,ll,dl],Wm=[`inputResponses`,`requestState`];function Gm(e,t){let n=e.params;if(!Xm(n))return{message:e,lifted:{}};let r=n._meta,i=Xm(r)?Um.filter(e=>e in r):[],a=t===`request`?Wm.filter(e=>e in n):[];if(i.length===0&&a.length===0)return{message:e,lifted:{}};let o={},s={...n};if(i.length>0&&Xm(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 Km(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 qm(e){return()=>e}var Jm=qm(void 0),Ym=class{_transport;_requestMessageId=0;_requestHandlers=new Map;_customSchemaRequestMethods=new Set;_requestHandlerAbortControllers=new Map;_notificationHandlers=new Map;_responseHandlers=new Map;_progressHandlers=new Map;_timeoutInfo=new Map;_pendingDebouncedNotifications=new Set;_negotiatedProtocolVersion;_supportedProtocolVersions;onclose;onerror;fallbackRequestHandler;fallbackNotificationHandler;constructor(e){this._options=e,this._supportedProtocolVersions=e?.supportedProtocolVersions??il,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!==void 0&&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),cm(e)||lm(e)?this._onresponse(e):om(e)?this._onrequest(e,t):sm(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}=Gm(e,`notification`),r=this._negotiatedWireCodec();if(t?.classification===void 0&&this._shouldDropInbound(e)===`drop`)return;if(t?.classification!==void 0){let e=em(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(nm(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}=Gm(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=em(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(tm(n.method)&&!i.hasRequestMethod(n.method)&&!(rm(n.method)&&this._customSchemaRequestMethods.has(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:Qm(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?Jm:qm(r.requestState),signal:d.signal,send:((e,t,n)=>{let r=this._resolveOutboundCodec(e.method);if(this._assertOutboundRequestInEra(r,e.method),fm(t))return u(e,t,n);let i=Km(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),cm(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(fm(t))return rm(e.method)||this._assertOutboundRequestInEra(r,e.method),this._requestWithSchemaViaCodec(r,e,t,n);this._assertOutboundRequestInEra(r,e.method);let i=Km(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 $p(this._negotiatedProtocolVersion)}_wireCodec(){return this._negotiatedWireCodec()}_resolveOutboundCodec(e){if(this._negotiatedProtocolVersion===void 0){let t=Hm(e);if(t)return t}return this._negotiatedWireCodec()}_assertOutboundRequestInEra(e,t){if(tm(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),g=!1,ne=e=>{g||(this._progressHandlers.delete(h),m===void 0?t.method!==`initialize`&&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(g=!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($m(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;vm(n,o).then(e=>{e.success?d(e.data):f(new X(Y.InvalidResult,`Invalid result for ${t.method}: ${e.error}`))},f)}),l=()=>ne(r?.signal?.reason),r?.signal?.addEventListener(`abort`,l,{once:!0});let _=r?.timeout??6e4;this._setupTimeout(h,_,r?.maxTotalTimeout,()=>ne(new X(Y.RequestTimeout,`Request timed out`,{timeout:_})),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 await this._notificationViaCodec(this._resolveOutboundCodec(e.method),e,t)}async _notificationViaCodec(e,t,n){if(!this._transport)throw new X(Y.NotConnected,`Not connected`);if(nm(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===void 0){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(!tm(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 vm(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`);typeof t==`function`?this._customSchemaRequestMethods.delete(e):this._customSchemaRequestMethods.add(e),this._requestHandlers.set(e,this._wrapHandler(e,r))}_wrapHandler(e,t){return t}_outboundServerInfo(){}removeRequestHandler(e){this._requestHandlers.delete(e),this._customSchemaRequestMethods.delete(e)}assertCanSetRequestHandler(e){if(this._requestHandlers.has(e))throw Error(`A request handler for ${e} already exists, which would be overridden`)}setNotificationHandler(e,t,n){if(typeof t==`function`){if(!nm(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 vm(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 Xm(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Zm(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Qm(e){let t={},n=[];if(!Zm(e))return{accepted:t,droppedKeys:n};for(let[r,i]of Object.entries(e)){if(!Zm(i)||`method`in i||`result`in i){n.push(r);continue}t[r]=i}return{accepted:t,droppedKeys:n}}function $m(e){return{resultType:`input_required`,inputRequests:e.inputRequests,...e.requestState!==void 0&&{requestState:e.requestState},...e._meta!==void 0&&{_meta:e._meta}}}i((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 eh=/^(\d\d):(\d\d):(\d\d)(\.\d+)?(z|[+-]\d\d(?::?\d\d)?)?$/i,th=/^(?=.{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,nh=/^(?:[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,rh=/^(?:(?:[^\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,ih=/^(?:(?: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,ah=/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,oh=/^(?:\/(?:[^~/]|~0|~1)*)*$/,sh=/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,ch=/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,lh=/^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/,uh=/^((([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 dh(e){return e.test.bind(e)}fh.bind(void 0,!1),dh(nh),dh(rh),dh(ih),dh(th),dh(lh),dh(uh),dh(ah),dh(oh),dh(sh),dh(ch);function fh(e,t){let n=t.match(eh);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 ph=class extends Error{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.OAuthClientFlowError`})}static[Symbol.hasInstance](e){return Af(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 Af(this,e)}constructor(e){super(e),this.name=new.target.name,kf(this,new.target)}};(class extends ph{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 ph{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 ph{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.InsecureTokenEndpointError`})}tokenEndpoint;constructor(e){super(`Refusing to send credentials to non-https token endpoint '${e}'. OAuth token requests MUST use TLS (localhost / *.localhost / 127.0.0.1 / ::1 are exempt).`),this.tokenEndpoint=e}},class extends ph{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.AuthorizationServerMismatchError`})}constructor(e,t){super(`Authorization server mismatch: credentials are bound to ${JSON.stringify(e)} but this call resolved ${JSON.stringify(t)}; refusing to present them to a different authorization server`),this.recordedIssuer=e,this.currentIssuer=t}},class extends ph{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 Af(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 Af(this,e)}constructor(e){super(e??`Unauthorized`),this.name=`UnauthorizedError`,kf(this,new.target)}},class extends Error{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.SseError`})}static[Symbol.hasInstance](e){return Af(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 Af(this,e)}constructor(e,t,n){super(`SSE error: ${t}`),this.code=e,this.event=n,kf(this,new.target)}};var mh=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}},hh=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)}},gh=new Set;function _h(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`;gh.has(o)||(gh.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},vh(t)):e=>s({method:a,params:e})]}function vh(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 yh=`2026-01-26`,bh=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=Ol.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},xh=z([H(`light`),H(`dark`)]).describe(`Color theme preference for the host environment.`),Sh=z([H(`inline`),H(`fullscreen`),H(`pip`)]).describe(`Display mode for UI presentation.`),Ch=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.
|
|
65
|
+
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 Qa(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;Qa(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 $a=new Set([`type`,`properties`,`required`,`additionalProperties`]),eo=[`oneOf`,`anyOf`];function to(e){let t=e.additionalProperties;return t===void 0||t===!1||typeof t!=`object`||!t?null:Object.keys(t).length?t:null}function no(e){let t=[];for(let n of e){if(typeof n!=`object`||n.type!==`object`)return null;for(let e in n)if(!$a.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]??to(n);t!=null&&(e.some(e=>JSON.stringify(e)===JSON.stringify(t))||e.push(t))}g(n,r,e.length===1?e[0]:no(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=to(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 ro(e){let t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(let t of $a)if(t in e)return;let n=t.filter(e=>eo.some(t=>Array.isArray(e[t]))),r=null;if(!n.length)r=no(t);else{let e=n[0],i=eo.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=>no([...a,e]));if(o.some(e=>!e))return;r={[i]:o}}r&&(delete e.allOf,Ja(e,r))}function io(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)):Ja(i,s),Ja(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())Qa(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)??[])ro(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)}Ja(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,g(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:so(t,`input`,e.processors),output:so(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function ao(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 ao(r.element,n);if(r.type===`set`)return ao(r.valueType,n);if(r.type===`lazy`)return ao(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 ao(r.innerType,n);if(r.type===`intersection`)return ao(r.left,n)||ao(r.right,n);if(r.type===`record`||r.type===`map`)return ao(r.keyType,n)||ao(r.valueType,n);if(r.type===`pipe`)return e._zod.traits.has(`$ZodCodec`)?!0:ao(r.in,n)||ao(r.out,n);if(r.type===`object`){for(let e in r.shape)if(ao(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(ao(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(ao(e,n))return!0;return!!(r.rest&&ao(r.rest,n))}return!1}var oo=(e,t={})=>n=>{let r=Ya({...n,processors:t});return k(e,r),Za(r,e),io(r,e)},so=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=Ya({...i??{},target:a,io:t,processors:n});return k(e,o),Za(o,e),io(o,e)},co=(e,t,n)=>{(e[t]===void 0||n>e[t])&&(e[t]=n)},lo=(e,t,n)=>{(e[t]===void 0||n<e[t])&&(e[t]=n)},uo=(e,t)=>{co(e,`minimum`,t),lo(e,`maximum`,t)},fo=(e,t)=>{e.multipleOf??=[],e.multipleOf.includes(t)||e.multipleOf.push(t)},po=(e,t)=>{e.patterns??=new Set,e.patterns.add(t)},mo=(e,t)=>{e.mime=e.mime?e.mime.filter(e=>t.includes(e)):[...t]},ho=(e,t)=>{e.format=t,t.includes(`int`)&&(e.isInt=!0)},go=(e,t)=>co(e,`minimum`,t.minimum),_o=(e,t)=>lo(e,`maximum`,t.maximum),vo=e=>(t,n)=>{ho(t,n.format);let[r,i]=e[n.format];co(t,`minimum`,r),lo(t,`maximum`,i)},yo={greater_than:(e,t)=>co(e,t.inclusive?`minimum`:`exclusiveMinimum`,t.value),less_than:(e,t)=>lo(e,t.inclusive?`maximum`:`exclusiveMaximum`,t.value),multiple_of:(e,t)=>fo(e,t.value),number_format:vo(ve),bigint_format:vo(ye),min_length:go,max_length:_o,length_equals:(e,t)=>uo(e,t.length),min_size:go,max_size:_o,size_equals:(e,t)=>uo(e,t.size),string_format:(e,t)=>{ho(e,t.format),t.pattern&&po(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)=>mo(e,t.mime)};function bo(e){let t={},n=e._zod.def,r=e._zod.traits.has(`$ZodCheck`)?[e,...n.checks??[]]:n.checks??[];for(let e of r)yo[e._zod.def.check]?.(t,e._zod.def);let i=e._zod.bag;i.minimum!==void 0&&co(t,`minimum`,i.minimum),i.exclusiveMinimum!==void 0&&co(t,`exclusiveMinimum`,i.exclusiveMinimum),i.maximum!==void 0&&lo(t,`maximum`,i.maximum),i.exclusiveMaximum!==void 0&&lo(t,`exclusiveMaximum`,i.exclusiveMaximum),i.multipleOf!==void 0&&fo(t,i.multipleOf),i.format!==void 0&&(t.format??=i.format,i.format.includes(`int`)&&(t.isInt=!0)),i.mime&&mo(t,i.mime);for(let e of i.patterns??[])po(t,e);return t}var xo={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},So=new Map([[gr,Qt],[vr,$t]]),Co=e=>So.get(e)??e,wo=(e,t,n,r)=>{let i=n;i.type=`string`;let{minimum:a,maximum:o,format:s,patterns:c,contentEncoding:l,laxFormat:u}=bo(e);if(typeof a==`number`&&(i.minLength=a),typeof o==`number`&&(i.maxLength=o),s&&(i.format=xo[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(Co);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}))])}},To=(e,t,n,r)=>{let i=n,{minimum:a,maximum:o,multipleOf:s,exclusiveMaximum:c,exclusiveMinimum:l,isInt:u}=bo(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)):O(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}))])}},Eo=(e,t,n,r)=>{n.type=`boolean`},Do=(e,t,n,r)=>{O(e,t,n,r,`BigInt cannot be represented in JSON Schema`)},Oo=(e,t,n,r)=>{O(e,t,n,r,`Symbols cannot be represented in JSON Schema`)},ko=(e,t,n,r)=>{t.target===`openapi-3.0`?(n.type=`string`,n.nullable=!0,n.enum=[null]):n.type=`null`},Ao=(e,t,n,r)=>{O(e,t,n,r,`Undefined cannot be represented in JSON Schema`)},jo=(e,t,n,r)=>{O(e,t,n,r,`Void cannot be represented in JSON Schema`)},Mo=(e,t,n,r)=>{n.not={}},No=(e,t,n,r)=>{},Po=(e,t,n,r)=>{},Fo=(e,t,n,r)=>{O(e,t,n,r,`Date cannot be represented in JSON Schema`)},Io=(e,t,n,r)=>{let i=e._zod.def,a=c(i.entries);if(a.length===0){n.not={};return}a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),n.enum=a},Lo=(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(O(e,t,n,r,"Literal `undefined` cannot be represented in JSON Schema"))return}else if(typeof o==`bigint`){if(O(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}},Ro=(e,t,n,r)=>{O(e,t,n,r,`NaN cannot be represented in JSON Schema`)},zo=(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},Bo=(e,t,n,r)=>{let i=n;i.type=`string`,i.format=`binary`,i.contentEncoding=`binary`;let{minimum:a,maximum:o,mime:s}=bo(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})))},Vo=(e,t,n,r)=>{n.type=`boolean`},Ho=(e,t,n,r)=>{O(e,t,n,r,`Custom types cannot be represented in JSON Schema`)},Uo=(e,t,n,r)=>{O(e,t,n,r,`Function types cannot be represented in JSON Schema`)},Wo=(e,t,n,r)=>{O(e,t,n,r,`Transforms cannot be represented in JSON Schema`)},Go=(e,t,n,r)=>{O(e,t,n,r,`Map cannot be represented in JSON Schema`)},Ko=(e,t,n,r)=>{O(e,t,n,r,`Set cannot be represented in JSON Schema`)},qo=(e,t,n,r)=>{let i=n,a=e._zod.def,{minimum:o,maximum:s}=bo(e);typeof o==`number`&&(i.minItems=o),typeof s==`number`&&(i.maxItems=s),i.type=`array`,i.items=k(a.element,t,{...r,path:[...r.path,`items`]})};function Jo(e){let t=e._zod.def;return t.type===`pipe`&&t.in._zod.traits.has(`$ZodTransform`)?Jo(t.out):t.type===`catch`?Jo(t.innerType):e._zod.optin}var Yo=(e,t,n,r)=>{let i=n,a=e._zod.def,o=a.shape;if(Object.getOwnPropertySymbols(o).length&&O(e,t,i,r,`Symbol keys cannot be represented in JSON Schema`))return;i.type=`object`,i.properties={};for(let e in o)g(i.properties,e,k(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`?Jo(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=k(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},Xo=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>k(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},Zo=(e,t,n,r)=>{let i=e._zod.def,a=k(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=k(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)},Qo=(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)=>k(e,t,{...r,path:[...r.path,o,n]})),l=a.rest?k(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`?Jo(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}=bo(e);typeof p==`number`&&(i.minItems=p),typeof m==`number`&&(i.maxItems=m)};function $o(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=$o(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=>$o(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`)?un:ln).source),p):p}var es=new WeakMap;function ts(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 es.get(e)??[]){let i=e.seen.get(r),a=(i?.def??i?.schema)?.propertyNames;if(!a||a===!0||n.has(a))continue;let o=$o(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 ns=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`;let o=a.keyType,s=bo(o).patterns;if(a.mode===`loose`&&s&&s.size>0){let e=k(a.valueType,t,{...r,path:[...r.path,`patternProperties`,`*`]});i.patternProperties={};for(let t of s)g(i.patternProperties,Co(t).source,e)}else{if(t.target===`draft-07`||t.target===`draft-2020-12`){i.propertyNames=k(a.keyType,t,{...r,path:[...r.path,`propertyNames`]});let n=es.get(t);n||(n=[],es.set(t,n),t.deferred.push(()=>ts(t))),n.push(e)}i.additionalProperties=k(a.valueType,t,{...r,path:[...r.path,`additionalProperties`]})}let c=o._zod.values,l=t.io===`input`&&Jo(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))}},rs=(e,t,n,r)=>{let i=e._zod.def,a=k(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`}]},is=(e,t,n,r)=>{let i=e._zod.def;k(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},as=Symbol();function os(e,t,n,r,i){let a=!1,o=JSON.stringify(e,(e,t)=>typeof t==`bigint`?(a=!0,null):t);return a?(O(t,n,r,i,`BigInt defaults cannot be represented in JSON Schema`),as):JSON.parse(o)}var ss=(e,t,n,r)=>{let i=e._zod.def;k(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o=os(i.defaultValue,e,t,n,r);o!==as&&(n.default=o)},cs=(e,t,n,r)=>{let i=e._zod.def;k(i.innerType,t,r);let a=t.seen.get(e);if(a.ref=i.innerType,t.io!==`input`)return;let o=os(i.defaultValue,e,t,n,r);o!==as&&(n._prefault=o)},ls=(e,t,n,r)=>{let i=e._zod.def;k(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{O(e,t,n,r,`Dynamic catch values are not supported in JSON Schema`);return}n.default=o},us=(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;k(o,t,r);let s=t.seen.get(e);s.ref=o},ds=(e,t,n,r)=>{let i=e._zod.def;k(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},fs=(e,t,n,r)=>{let i=e._zod.def;k(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},ps=(e,t,n,r)=>{let i=e._zod.def;k(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},ms=(e,t,n,r)=>{let i=e._zod.innerType;k(i,t,r);let a=t.seen.get(e);a.ref=i},hs={string:wo,number:To,boolean:Eo,bigint:Do,symbol:Oo,null:ko,undefined:Ao,void:jo,never:Mo,any:No,unknown:Po,date:Fo,enum:Io,literal:Lo,nan:Ro,template_literal:zo,file:Bo,success:Vo,custom:Ho,function:Uo,transform:Wo,map:Go,set:Ko,array:qo,object:Yo,union:Xo,intersection:Zo,tuple:Qo,record:ns,nullable:rs,nonoptional:is,default:ss,prefault:cs,catch:ls,pipe:us,readonly:ds,promise:fs,optional:ps,lazy:ms};function gs(e,t){if(`_idmap`in e){let n=e,r=Ya({...t,processors:hs}),i={};for(let e of n._idmap.entries()){let[t,n]=e;k(n,r)}let a={};r.external={registry:n,uri:t?.uri,defs:i};for(let e of n._idmap.entries()){let[t,n]=e;Za(r,n),g(a,t,io(r,n))}return Object.keys(i).length>0&&(a.__shared={[r.target===`draft-2020-12`?`$defs`:`definitions`]:i}),{schemas:a}}let n=Ya({...t,processors:hs});return k(e,n),Za(n,e),io(n,e)}var _s=new WeakSet([Object.prototype,Error.prototype]);function vs(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 ys=S(`ZodError`,(e,t)=>{ft.init(e,t),e.name=`ZodError`;let n=Object.getPrototypeOf(e);_s.has(n)||(_s.add(n),vs(n,`format`,e=>t=>ht(e,t)),vs(n,`flatten`,e=>t=>mt(e,t)),vs(n,`addIssue`,e=>t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,u,2)}),vs(n,`addIssues`,e=>t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,u,2)}),Object.defineProperty(n,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}}))},void 0,{Parent:Error}),bs=_t(ys),xs=vt(ys),Ss=yt(ys),Cs=xt(ys),ws=Dt(ys),Ts=Ot(ys),Es=kt(ys),Ds=At(ys),Os=jt(ys),ks=Mt(ys),As=Nt(ys),js=Pt(ys);function Ms(){w.localeError||at(Ii())}function Ns(){w.memoizer||at({memoizer:Ni()})}var A=S(`ZodType`,(e,t)=>(Ms(),E.init(e,t),e.def=t,e.type=t.type,e),{check(...e){let t=this.def;return this.clone(v(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 y(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check($c(e,t))},superRefine(e,t){return this.check(el(e,t))},overwrite(e){return this.check(Ra(e))},optional(){return U(this)},exactOptional(){return Pc(this)},nullable(){return Ic(this)},nullish(){return U(Ic(this))},nonoptional(e){return Hc(this,e)},array(){return I(this)},or(e){return z([this,e])},and(e){return Ec(this,e)},transform(e){return Kc(this,jc(e))},default(e){return Rc(this,e)},prefault(e){return Bc(this,e)},catch(e){return Wc(this,e)},pipe(e){return Kc(this,e)},readonly(){return Yc(this)},describe(e){let t=this.clone();return Bi.add(t,{description:e}),t},meta(...e){if(e.length===0)return Bi.get(this);let t=this.clone();return Bi.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 Ue(this,`~standard`,{...Rn(this),jsonSchema:{input:so(this,`input`),output:so(this,`output`)}})},set"~standard"(e){He(this,`~standard`,e)},parse:function e(t,n){return bs(this,t,n,{callee:e})},parseAsync:async function e(t,n){return await xs(this,t,n,{callee:e})},safeParse(e,t){return Ss(this,e,t)},async safeParseAsync(e,t){return Cs(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){He(this,`spa`,e)},validate(e,t){return wt(this,e,t)},validateAsync(e,t){return Et(this,e,t)},encode:function e(t,n){return ws(this,t,n,{callee:e})},decode:function e(t,n){return Ts(this,t,n,{callee:e})},encodeAsync:async function e(t,n){return await Es(this,t,n,{callee:e})},decodeAsync:async function e(t,n){return await Ds(this,t,n,{callee:e})},safeEncode(e,t){return Os(this,e,t)},safeDecode(e,t){return ks(this,e,t)},async safeEncodeAsync(e,t){return As(this,e,t)},async safeDecodeAsync(e,t){return js(this,e,t)},toJSONSchema(e){return oo(this,{})(e)},get description(){return Bi.get(this)?.description},get _def(){return this._zod.def}}),Ps=S(`_ZodString`,(e,t)=>{zn.init(e,t),A.init(e,t),e._zod.processJSONSchema=(t,n,r)=>wo(e,t,n,r)},We({format:e=>bo(e).format??null,minLength:e=>bo(e).minimum??null,maxLength:e=>bo(e).maximum??null},{regex(...e){return this.check(Ma(...e))},includes(...e){return this.check(Fa(...e))},startsWith(...e){return this.check(Ia(...e))},endsWith(...e){return this.check(La(...e))},min(...e){return this.check(Aa(...e))},max(...e){return this.check(ka(...e))},length(...e){return this.check(ja(...e))},nonempty(...e){return this.check(Aa(1,...e))},lowercase(e){return this.check(Na(e))},uppercase(e){return this.check(Pa(e))},trim(){return this.check(Ba())},normalize(...e){return this.check(za(...e))},toLowerCase(){return this.check(Va())},toUpperCase(){return this.check(Ha())},slugify(){return this.check(Ua())}})),Fs=S(`ZodString`,(e,t)=>{zn.init(e,t),Ps.init(e,t)},{email(e){return this.check(Ui(Bs,e))},url(e){return this.check(Yi(Ws,e))},jwt(e){return this.check(ua(oc,e))},emoji(e){return this.check(Xi(Ks,e))},guid(e){return this.check(Wi(Hs,e))},uuid(e){return this.check(Gi(Us,e))},uuidv4(e){return this.check(Ki(Us,e))},uuidv6(e){return this.check(qi(Us,e))},uuidv7(e){return this.check(Ji(Us,e))},nanoid(e){return this.check(Zi(qs,e))},cuid(e){return this.check(Qi(Js,e))},cuid2(e){return this.check($i(Ys,e))},ulid(e){return this.check(ea(Xs,e))},base64(e){return this.check(sa(rc,e))},base64url(e){return this.check(ca(ic,e))},xid(e){return this.check(ta(Zs,e))},ksuid(e){return this.check(na(Qs,e))},ipv4(e){return this.check(ra($s,e))},ipv6(e){return this.check(ia(ec,e))},cidrv4(e){return this.check(aa(tc,e))},cidrv6(e){return this.check(oa(nc,e))},e164(e){return this.check(la(ac,e))},datetime(e){return this.check(da(Is,e))},date(e){return this.check(fa(Ls,e))},time(e){return this.check(pa(Rs,e))},duration(e){return this.check(ma(zs,e))}});function j(e){return Hi(Fs,e)}var M=S(`ZodStringFormat`,(e,t)=>{D.init(e,t),Ps.init(e,t)}),Is=S(`ZodISODateTime`,(e,t)=>{ir.init(e,t),M.init(e,t)}),Ls=S(`ZodISODate`,(e,t)=>{ar.init(e,t),M.init(e,t)}),Rs=S(`ZodISOTime`,(e,t)=>{or.init(e,t),M.init(e,t)}),zs=S(`ZodISODuration`,(e,t)=>{sr.init(e,t),M.init(e,t)}),Bs=S(`ZodEmail`,(e,t)=>{Hn.init(e,t),M.init(e,t)});function Vs(e){return Ui(Bs,e)}var Hs=S(`ZodGUID`,(e,t)=>{Bn.init(e,t),M.init(e,t)}),Us=S(`ZodUUID`,(e,t)=>{Vn.init(e,t),M.init(e,t)}),Ws=S(`ZodURL`,(e,t)=>{Xn.init(e,t),M.init(e,t)});function Gs(e){return Yi(Ws,e)}var Ks=S(`ZodEmoji`,(e,t)=>{Zn.init(e,t),M.init(e,t)}),qs=S(`ZodNanoID`,(e,t)=>{Qn.init(e,t),M.init(e,t)}),Js=S(`ZodCUID`,(e,t)=>{$n.init(e,t),M.init(e,t)}),Ys=S(`ZodCUID2`,(e,t)=>{er.init(e,t),M.init(e,t)}),Xs=S(`ZodULID`,(e,t)=>{tr.init(e,t),M.init(e,t)}),Zs=S(`ZodXID`,(e,t)=>{nr.init(e,t),M.init(e,t)}),Qs=S(`ZodKSUID`,(e,t)=>{rr.init(e,t),M.init(e,t)}),$s=S(`ZodIPv4`,(e,t)=>{cr.init(e,t),M.init(e,t)}),ec=S(`ZodIPv6`,(e,t)=>{dr.init(e,t),M.init(e,t)}),tc=S(`ZodCIDRv4`,(e,t)=>{fr.init(e,t),M.init(e,t)}),nc=S(`ZodCIDRv6`,(e,t)=>{mr.init(e,t),M.init(e,t)}),rc=S(`ZodBase64`,(e,t)=>{_r.init(e,t),M.init(e,t)}),ic=S(`ZodBase64URL`,(e,t)=>{br.init(e,t),M.init(e,t)}),ac=S(`ZodE164`,(e,t)=>{xr.init(e,t),M.init(e,t)}),oc=S(`ZodJWT`,(e,t)=>{Cr.init(e,t),M.init(e,t)}),sc=S(`ZodNumber`,(e,t)=>{wr.init(e,t),A.init(e,t),e._zod.processJSONSchema=(t,n,r)=>To(e,t,n,r),e.isFinite=!0},We({minValue:e=>{let{minimum:t,exclusiveMinimum:n}=bo(e);return Math.max(t??-1/0,n??-1/0)},maxValue:e=>{let{maximum:t,exclusiveMaximum:n}=bo(e);return Math.min(t??1/0,n??1/0)},isInt:e=>{let{isInt:t,multipleOf:n}=bo(e);return!!t||!!n?.some(Number.isSafeInteger)},format:e=>bo(e).format??null},{gt(e,t){return this.check(Ea(e,t))},gte(e,t){return this.check(Da(e,t))},min(e,t){return this.check(Da(e,t))},lt(e,t){return this.check(wa(e,t))},lte(e,t){return this.check(Ta(e,t))},max(e,t){return this.check(Ta(e,t))},int(e){return this.check(lc(e))},safe(e){return this.check(lc(e))},positive(e){return this.check(Ea(0,e))},nonnegative(e){return this.check(Da(0,e))},negative(e){return this.check(wa(0,e))},nonpositive(e){return this.check(Ta(0,e))},multipleOf(e,t){return this.check(Oa(e,t))},step(e,t){return this.check(Oa(e,t))},finite(){return this}}));function N(e){return ha(sc,e)}var cc=S(`ZodNumberFormat`,(e,t)=>{Tr.init(e,t),sc.init(e,t)});function lc(e){return _a(cc,e)}var uc=S(`ZodBoolean`,(e,t)=>{Er.init(e,t),A.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Eo(e,t,n,r)});function P(e){return va(uc,e)}var dc=S(`ZodUndefined`,(e,t)=>{Dr.init(e,t),A.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ao(e,t,n,r)});function fc(e){return ya(dc,e)}var pc=S(`ZodNull`,(e,t)=>{Or.init(e,t),A.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ko(e,t,n,r)});function mc(e){return ba(pc,e)}var hc=S(`ZodAny`,(e,t)=>{kr.init(e,t),A.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function gc(){return xa(hc)}var _c=S(`ZodUnknown`,(e,t)=>{Ar.init(e,t),A.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function F(){return Sa(_c)}var vc=S(`ZodNever`,(e,t)=>{jr.init(e,t),A.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Mo(e,t,n,r)});function yc(e){return Ca(vc,e)}var bc=S(`ZodArray`,(e,t)=>{Ns(),Fr.init(e,t),A.init(e,t),e._zod.processJSONSchema=(t,n,r)=>qo(e,t,n,r),e.element=t.element},{min(e,t){return this.check(Aa(e,t))},nonempty(e){return this.check(Aa(1,e))},max(e,t){return this.check(ka(e,t))},length(e,t){return this.check(ja(e,t))},unwrap(){return this.element}});function I(e,t){return Wa(bc,e,t)}var xc=S(`ZodObject`,(e,t)=>{Ns(),Vr.init(e,t),A.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Yo(e,t,n,r),Xe(e,`shape`,e=>e._zod.def.shape,!1)},{keyof(){return V(Object.keys(this._zod.def.shape))},catchall(e){return this.clone(v(this._zod.def,{catchall:e}))},passthrough(){return this.clone(v(this._zod.def,{catchall:F()}))},loose(){return this.clone(v(this._zod.def,{catchall:F()}))},strict(){return this.clone(v(this._zod.def,{catchall:yc()}))},strip(){return this.clone(v(this._zod.def,{catchall:void 0}))},extend(e){return Ce(this,e)},safeExtend(e){return Te(this,e)},merge(e){return Ee(this,e)},pick(e){return be(this,e)},omit(e){return Se(this,e)},partial(...e){return De(Mc,this,e[0])},exactPartial(...e){return De(Nc,this,e[0],`exactPartial`)},required(...e){return Oe(Vc,this,e[0])}});function L(e,t){return new xc({type:`object`,shape:e??{},...b(t)})}function R(e,t){return new xc({type:`object`,shape:e,catchall:F(),...b(t)})}var Sc=S(`ZodUnion`,(e,t)=>{Ur.init(e,t),A.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Xo(e,t,n,r),e.options=t.options});function z(e,t){return new Sc({type:`union`,options:e,...b(t)})}var Cc=S(`ZodDiscriminatedUnion`,(e,t)=>{Sc.init(e,t),Gr.init(e,t)});function wc(e,t,n){return new Cc({type:`union`,options:t,discriminator:e,...b(n)})}var Tc=S(`ZodIntersection`,(e,t)=>{Kr.init(e,t),A.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Zo(e,t,n,r)});function Ec(e,t){return new Tc({type:`intersection`,left:e,right:t})}var Dc=S(`ZodRecord`,(e,t)=>{Ns(),Yr.init(e,t),A.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ns(e,t,n,r),e.keyType=t.keyType,e.valueType=t.valueType});function B(e,t,n){return!t||!t._zod?new Dc({type:`record`,keyType:j(),valueType:e,...b(t)}):new Dc({type:`record`,keyType:e,valueType:t,...b(n)})}var Oc=S(`ZodEnum`,(e,t)=>{Xr.init(e,t),A.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Io(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 Oc({...t,checks:[],...b(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 Oc({...t,checks:[],...b(r),entries:i})}});function V(e,t){return new Oc({type:`enum`,entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...b(t)})}var kc=S(`ZodLiteral`,(e,t)=>{Zr.init(e,t),A.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Lo(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 kc({type:`literal`,values:Array.isArray(e)?e:[e],...b(t)})}var Ac=S(`ZodTransform`,(e,t)=>{Ns(),Qr.init(e,t),A.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Wo(e,t,n,r),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new C(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(Be(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(Be(t))}};let i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n)):(n.value=i,n)}});function jc(e){return new Ac({type:`transform`,transform:e})}var Mc=S(`ZodOptional`,(e,t)=>{ei.init(e,t),A.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ps(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function U(e){return new Mc({type:`optional`,innerType:e})}var Nc=S(`ZodExactOptional`,(e,t)=>{ti.init(e,t),A.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ps(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Pc(e){return new Nc({type:`optional`,innerType:e})}var Fc=S(`ZodNullable`,(e,t)=>{ni.init(e,t),A.init(e,t),e._zod.processJSONSchema=(t,n,r)=>rs(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Ic(e){return new Fc({type:`nullable`,innerType:e})}var Lc=S(`ZodDefault`,(e,t)=>{ri.init(e,t),A.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ss(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Rc(e,t){return new Lc({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():pe(t)}})}var zc=S(`ZodPrefault`,(e,t)=>{ai.init(e,t),A.init(e,t),e._zod.processJSONSchema=(t,n,r)=>cs(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Bc(e,t){return new zc({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():pe(t)}})}var Vc=S(`ZodNonOptional`,(e,t)=>{oi.init(e,t),A.init(e,t),e._zod.processJSONSchema=(t,n,r)=>is(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Hc(e,t){return new Vc({type:`nonoptional`,innerType:e,...b(t)})}var Uc=S(`ZodCatch`,(e,t)=>{li.init(e,t),A.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ls(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Wc(e,t){return new Uc({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:Qe(t)})}var Gc=S(`ZodPipe`,(e,t)=>{ui.init(e,t),A.init(e,t),e._zod.processJSONSchema=(t,n,r)=>us(e,t,n,r),e.in=t.in,e.out=t.out});function Kc(e,t){return new Gc({type:`pipe`,in:e,out:t})}var qc=S(`ZodPreprocess`,(e,t)=>{Gc.init(e,t),fi.init(e,t)}),Jc=S(`ZodReadonly`,(e,t)=>{pi.init(e,t),A.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ds(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Yc(e){return new Jc({type:`readonly`,innerType:e})}var Xc=S(`ZodLazy`,(e,t)=>{hi.init(e,t),A.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ms(e,t,n,r),e.unwrap=()=>e._zod.def.getter()});function Zc(e){return new Xc({type:`lazy`,getter:e})}var Qc=S(`ZodCustom`,(e,t)=>{gi.init(e,t),A.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ho(e,t,n,r)});function $c(e,t={}){return Ga(Qc,e,t)}function el(e,t){return Ka(e,t)}function tl(e,t){return new qc({type:`pipe`,in:jc(e),out:t})}var nl={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`},rl;rl||={};function il(e){return da(Is,e)}function al(e){return fa(Ls,e)}function ol(e){return ga(sc,e)}var sl=[`2025-11-25`,`2025-06-18`,`2025-03-26`,`2024-11-05`,`2024-10-07`],cl=`io.modelcontextprotocol/related-task`,ll=`io.modelcontextprotocol/protocolVersion`,ul=`io.modelcontextprotocol/clientInfo`,dl=`io.modelcontextprotocol/serverInfo`,fl=`io.modelcontextprotocol/clientCapabilities`,pl=`io.modelcontextprotocol/subscriptionId`,ml=`io.modelcontextprotocol/logLevel`,hl=Zc(()=>z([j(),N(),P(),mc(),B(j(),hl),I(hl)])),W=B(j(),hl),gl=I(hl),_l=z([j(),N().int()]),vl=j(),yl=L({ttl:N().optional()}),bl=L({taskId:j()}),xl=R({progressToken:_l.optional(),[cl]:bl.optional()}),G=L({_meta:xl.optional()}),Sl=G.extend({task:yl.optional()}),K=L({method:j(),params:G.loose().optional()}),Cl=L({_meta:xl.optional()}),wl=L({method:j(),params:Cl.loose().optional()}),Tl=R({get[dl](){return zl.optional().catch(void 0)}}),q=R({_meta:Tl.optional()}),El=z([j(),N().int()]),Dl=L({jsonrpc:H(`2.0`),id:El,...K.shape}).strict(),Ol=L({jsonrpc:H(`2.0`),...wl.shape}).strict(),kl=L({jsonrpc:H(`2.0`),id:El,result:q}).strict(),Al=L({jsonrpc:H(`2.0`),id:El.optional(),error:L({code:N().int(),message:j(),data:F().optional()})}).strict(),jl=z([Dl,Ol,kl,Al]),Ml=z([kl,Al]),Nl=q.strict(),Pl=Cl.extend({requestId:El.optional(),reason:j().optional()}),Fl=wl.extend({method:H(`notifications/cancelled`),params:Pl}),Il=L({src:j(),mimeType:j().optional(),sizes:I(j()).optional(),theme:V([`light`,`dark`]).optional()}),Ll=L({icons:I(Il).optional()}),Rl=L({name:j(),title:j().optional()}),zl=Rl.extend({...Rl.shape,...Ll.shape,version:j(),websiteUrl:j().optional(),description:j().optional()}),Bl=tl(e=>e&&typeof e==`object`&&!Array.isArray(e)&&Object.keys(e).length===0?{form:{}}:e,Ec(L({form:Ec(L({applyDefaults:P().optional()}),W).optional(),url:W.optional()}),W.optional())),Vl=R({list:W.optional(),cancel:W.optional(),requests:R({sampling:R({createMessage:W.optional()}).optional(),elicitation:R({create:W.optional()}).optional()}).optional()}),Hl=R({list:W.optional(),cancel:W.optional(),requests:R({tools:R({call:W.optional()}).optional()}).optional()}),Ul=L({experimental:B(j(),W).optional(),sampling:L({context:W.optional(),tools:W.optional()}).optional(),elicitation:Bl.optional(),roots:L({listChanged:P().optional()}).optional(),tasks:Vl.optional(),extensions:B(j(),W).optional()}),Wl=G.extend({protocolVersion:j(),capabilities:Ul,clientInfo:zl}),Gl=K.extend({method:H(`initialize`),params:Wl}),Kl=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:Hl.optional(),extensions:B(j(),W).optional()}),ql=q.extend({protocolVersion:j(),capabilities:Kl,serverInfo:zl,instructions:j().optional()}),Jl=wl.extend({method:H(`notifications/initialized`),params:Cl.optional()}),Yl=K.extend({method:H(`server/discover`),params:G.optional()}),Xl=q.extend({supportedVersions:I(j()),capabilities:Kl,instructions:j().optional()}),Zl=K.extend({method:H(`ping`),params:G.optional()}),Ql=L({progress:N(),total:U(N()),message:U(j())}),$l=L({...Cl.shape,...Ql.shape,progressToken:_l}),eu=wl.extend({method:H(`notifications/progress`),params:$l}),tu=G.extend({cursor:vl.optional()}),nu=K.extend({params:tu.optional()}),ru=q.extend({nextCursor:vl.optional()}),iu=L({uri:j(),mimeType:U(j()),_meta:B(j(),F()).optional()}),au=iu.extend({text:j()}),ou=j().refine(e=>{try{return atob(e),!0}catch{return!1}},{message:`Invalid Base64 string`}),su=iu.extend({blob:ou}),cu=V([`user`,`assistant`]),lu=L({audience:I(cu).optional(),priority:N().min(0).max(1).optional(),lastModified:il({offset:!0}).optional()}),uu=L({...Rl.shape,...Ll.shape,uri:j(),description:U(j()),mimeType:U(j()),size:U(N()),annotations:lu.optional(),_meta:U(R({}))}),du=L({...Rl.shape,...Ll.shape,uriTemplate:j(),description:U(j()),mimeType:U(j()),annotations:lu.optional(),_meta:U(R({}))}),fu=nu.extend({method:H(`resources/list`)}),pu=ru.extend({resources:I(uu)}),mu=nu.extend({method:H(`resources/templates/list`)}),hu=ru.extend({resourceTemplates:I(du)}),gu=G.extend({uri:j()}),_u=gu,vu=K.extend({method:H(`resources/read`),params:_u}),yu=q.extend({contents:I(z([au,su]))}),bu=wl.extend({method:H(`notifications/resources/list_changed`),params:Cl.optional()}),xu=gu,Su=K.extend({method:H(`resources/subscribe`),params:xu}),Cu=gu,wu=K.extend({method:H(`resources/unsubscribe`),params:Cu}),Tu=L({toolsListChanged:P().optional(),promptsListChanged:P().optional(),resourcesListChanged:P().optional(),resourceSubscriptions:I(j()).optional()}),Eu=G.extend({notifications:Tu}),Du=K.extend({method:H(`subscriptions/listen`),params:Eu}),Ou=Cl.extend({notifications:Tu}),ku=wl.extend({method:H(`notifications/subscriptions/acknowledged`),params:Ou}),Au=Tl.extend({[pl]:El}),ju=q.extend({_meta:Au}),Mu=Cl.extend({uri:j()}),Nu=wl.extend({method:H(`notifications/resources/updated`),params:Mu}),Pu=L({name:j(),description:U(j()),required:U(P())}),Fu=L({...Rl.shape,...Ll.shape,description:U(j()),arguments:U(I(Pu)),_meta:U(R({}))}),Iu=nu.extend({method:H(`prompts/list`)}),Lu=ru.extend({prompts:I(Fu)}),Ru=G.extend({name:j(),arguments:B(j(),j()).optional()}),zu=K.extend({method:H(`prompts/get`),params:Ru}),Bu=L({type:H(`text`),text:j(),annotations:lu.optional(),_meta:B(j(),F()).optional()}),Vu=L({type:H(`image`),data:ou,mimeType:j(),annotations:lu.optional(),_meta:B(j(),F()).optional()}),Hu=L({type:H(`audio`),data:ou,mimeType:j(),annotations:lu.optional(),_meta:B(j(),F()).optional()}),Uu=L({type:H(`tool_use`),name:j(),id:j(),input:B(j(),F()),_meta:B(j(),F()).optional()}),Wu=L({type:H(`resource`),resource:z([au,su]),annotations:lu.optional(),_meta:B(j(),F()).optional()}),Gu=uu.extend({type:H(`resource_link`)}),Ku=z([Bu,Vu,Hu,Gu,Wu]),qu=L({role:cu,content:Ku}),Ju=q.extend({description:j().optional(),messages:I(qu)}),Yu=wl.extend({method:H(`notifications/prompts/list_changed`),params:Cl.optional()}),Xu=L({title:j().optional(),readOnlyHint:P().optional(),destructiveHint:P().optional(),idempotentHint:P().optional(),openWorldHint:P().optional()}),Zu=L({taskSupport:V([`required`,`optional`,`forbidden`]).optional()}),Qu=L({...Rl.shape,...Ll.shape,description:j().optional(),inputSchema:L({type:H(`object`),properties:B(j(),hl).optional(),required:I(j()).optional()}).catchall(F()),outputSchema:R({$schema:j().optional()}).optional(),annotations:Xu.optional(),execution:Zu.optional(),_meta:B(j(),F()).optional()}),$u=nu.extend({method:H(`tools/list`)}),ed=ru.extend({tools:I(Qu)}),td=q.extend({content:I(Ku).default([]),structuredContent:F().optional(),isError:P().optional()}),nd=td.or(q.extend({toolResult:F()})),rd=Sl.extend({name:j(),arguments:B(j(),F()).optional()}),id=K.extend({method:H(`tools/call`),params:rd}),ad=wl.extend({method:H(`notifications/tools/list_changed`),params:Cl.optional()}),od=L({autoRefresh:P().default(!0),debounceMs:N().int().nonnegative().default(300)}),sd=V([`debug`,`info`,`notice`,`warning`,`error`,`critical`,`alert`,`emergency`]),cd=G.extend({level:sd}),ld=K.extend({method:H(`logging/setLevel`),params:cd}),ud=Cl.extend({level:sd,logger:j().optional(),data:F()}),dd=wl.extend({method:H(`notifications/message`),params:ud}),fd=L({name:j().optional()}),pd=L({hints:I(fd).optional(),costPriority:N().min(0).max(1).optional(),speedPriority:N().min(0).max(1).optional(),intelligencePriority:N().min(0).max(1).optional()}),md=L({mode:V([`auto`,`required`,`none`]).optional()}),hd=L({type:H(`tool_result`),toolUseId:j().describe(`The unique identifier for the corresponding tool call.`),content:I(Ku),structuredContent:F().optional(),isError:P().optional(),_meta:B(j(),F()).optional()}),gd=wc(`type`,[Bu,Vu,Hu]),_d=wc(`type`,[Bu,Vu,Hu,Uu,hd]),vd=L({role:cu,content:z([_d,I(_d)]),_meta:B(j(),F()).optional()}),yd=Sl.extend({messages:I(vd),modelPreferences:pd.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(Qu).optional(),toolChoice:md.optional()}),bd=K.extend({method:H(`sampling/createMessage`),params:yd}),xd=q.extend({model:j(),stopReason:U(V([`endTurn`,`stopSequence`,`maxTokens`]).or(j())),role:cu,content:gd}),Sd=q.extend({model:j(),stopReason:U(V([`endTurn`,`stopSequence`,`maxTokens`,`toolUse`]).or(j())),role:cu,content:z([_d,I(_d)])}),Cd=L({type:H(`boolean`),title:j().optional(),description:j().optional(),default:P().optional()}),wd=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()}),Td=L({type:V([`number`,`integer`]),title:j().optional(),description:j().optional(),minimum:N().optional(),maximum:N().optional(),default:N().optional()}),Ed=L({type:H(`string`),title:j().optional(),description:j().optional(),enum:I(j()),default:j().optional()}),Dd=L({type:H(`string`),title:j().optional(),description:j().optional(),oneOf:I(L({const:j(),title:j()})),default:j().optional()}),Od=L({type:H(`string`),title:j().optional(),description:j().optional(),enum:I(j()),enumNames:I(j()).optional(),default:j().optional()}),kd=z([Ed,Dd]),Ad=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()}),jd=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()}),Md=z([Ad,jd]),Nd=z([Od,kd,Md]),Pd=z([Nd,Cd,wd,Td]),Fd=Sl.extend({mode:H(`form`).optional(),message:j(),requestedSchema:L({type:H(`object`),properties:B(j(),Pd),required:I(j()).optional()}).catchall(F())}),Id=Sl.extend({mode:H(`url`),message:j(),elicitationId:j(),url:j().url()}),Ld=z([Fd,Id]),Rd=K.extend({method:H(`elicitation/create`),params:Ld}),zd=Cl.extend({elicitationId:j()}),Bd=wl.extend({method:H(`notifications/elicitation/complete`),params:zd}),Vd=q.extend({action:V([`accept`,`decline`,`cancel`]),content:tl(e=>e===null?void 0:e,B(j(),z([j(),N(),P(),I(j())])).optional())}),Hd=L({type:H(`ref/resource`),uri:j()}),Ud=L({type:H(`ref/prompt`),name:j()}),Wd=G.extend({ref:z([Ud,Hd]),argument:L({name:j(),value:j()}),context:L({arguments:B(j(),j()).optional()}).optional()}),Gd=K.extend({method:H(`completion/complete`),params:Wd}),Kd=q.extend({completion:R({values:I(j()).max(100),total:U(N().int()),hasMore:U(P())})}),qd=L({uri:j().startsWith(`file://`),name:j().optional(),_meta:B(j(),F()).optional()}),Jd=K.extend({method:H(`roots/list`),params:G.optional()}),Yd=q.extend({roots:I(qd)}),Xd=wl.extend({method:H(`notifications/roots/list_changed`),params:Cl.optional()}),Zd=R({ttl:N().optional(),pollInterval:N().optional()}),Qd=V([`working`,`input_required`,`completed`,`failed`,`cancelled`]),$d=L({taskId:j(),status:Qd,ttl:z([N(),mc()]),createdAt:j(),lastUpdatedAt:j(),pollInterval:U(N()),statusMessage:U(j())}),ef=q.extend({task:$d}),tf=Cl.merge($d),nf=wl.extend({method:H(`notifications/tasks/status`),params:tf}),rf=K.extend({method:H(`tasks/get`),params:G.extend({taskId:j()})}),af=q.merge($d),of=K.extend({method:H(`tasks/result`),params:G.extend({taskId:j()})}),sf=q.loose(),cf=nu.extend({method:H(`tasks/list`)}),lf=ru.extend({tasks:I($d)}),uf=K.extend({method:H(`tasks/cancel`),params:G.extend({taskId:j()})}),df=q.merge($d),ff=z([Zl,Gl,Yl,Gd,ld,zu,Iu,fu,mu,vu,Su,wu,Du,id,$u]),pf=z([Fl,eu,Jl,Xd]),mf=z([Nl,xd,Sd,Vd,Yd]),hf=z([Zl,bd,Rd,Jd]),gf=z([Fl,eu,dd,Nu,bu,ad,Yu,ku,Bd]),_f=z([Nl,ql,Xl,Kd,Ju,Lu,pu,hu,yu,td,ed,ju]),J=Gs().superRefine((e,t)=>{if(!URL.canParse(e))return t.addIssue({code:nl.custom,message:`URL must be parseable`,fatal:!0}),et}).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`}),vf=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()}),yf=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),dpop_signing_alg_values_supported:I(j()).optional()}),bf=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)}),xf=L({...bf.shape,...yf.pick({code_challenge_methods_supported:!0}).shape}),Sf=L({access_token:j(),id_token:j().optional(),token_type:j(),expires_in:ol().optional(),scope:j().optional(),refresh_token:j().optional(),issuer:j().optional().catch(void 0)}).strip(),Cf=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(),wf=L({error:j(),error_description:j().optional(),error_uri:j().optional()}),Tf=J.optional().or(H(``).transform(()=>void 0)),Ef=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:Tf,scope:j().optional(),contacts:I(j()).optional(),tos_uri:Tf,policy_uri:j().optional(),jwks_uri:J.optional(),jwks:gc().optional(),software_id:j().optional(),software_version:j().optional(),software_statement:j().optional()}).strip(),Df=L({client_id:j(),client_secret:j().optional(),client_id_issued_at:N().optional(),client_secret_expires_at:N().optional(),issuer:j().optional().catch(void 0)}).strip(),Of=Ef.merge(Df),kf=L({error:j(),error_description:j().optional()}).strip(),Af=L({token:j(),token_type_hint:j().optional()}).strip(),jf=Symbol.for(`mcp.sdk.errorBrands`);function Mf(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,jf,{value:n,enumerable:!1,configurable:!0})}function Nf(e,t){try{if(typeof t==`object`&&t&&Object.prototype.hasOwnProperty.call(e,`mcpBrand`)&&typeof e.mcpBrand==`string`&&Object.prototype.hasOwnProperty.call(t,jf)){let n=t[jf];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 Nf(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 Nf(this,e)}constructor(e,t,n){super(t),this.code=e,this.errorUri=n,this.name=`OAuthError`,Mf(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 Nf(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 Nf(this,e)}constructor(e,t,n,r){super(t,r),this.code=e,this.data=n,this.name=`SdkError`,Mf(this,new.target)}};(class extends X{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.SdkHttpError`})}constructor(e,t,n,r){super(e,t,n,r),this.name=`SdkHttpError`}get status(){return this.data.status}get statusText(){return this.data.statusText}});var Pf=`2026-07-28`;function Ff(e){return e>=Pf}function If(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 Lf=[`task`,`inputRequests`,`requestState`];function Rf(e){return typeof e!=`object`||!e||Array.isArray(e)||e.content!==void 0||Lf.some(t=>t in e)?e:{...e,content:[]}}function zf(){let e=Zc(()=>z([j(),N(),P(),mc(),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()}),g=L({icons:I(te).optional()}),ne=L({name:j(),title:j().optional()}),_=ne.extend({...ne.shape,...g.shape,version:j(),websiteUrl:j().optional(),description:j().optional()}),re=tl(e=>e&&typeof e==`object`&&!Array.isArray(e)&&Object.keys(e).length===0?{form:{}}:e,Ec(L({form:Ec(L({applyDefaults:P().optional()}),t).optional(),url:t.optional()}),t.optional())),ie=R({list:t.optional(),cancel:t.optional(),requests:R({sampling:R({createMessage:t.optional()}).optional(),elicitation:R({create:t.optional()}).optional()}).optional()}),ae=R({list:t.optional(),cancel:t.optional(),requests:R({tools:R({call:t.optional()}).optional()}).optional()}),oe=L({experimental:B(j(),t).optional(),sampling:L({context:t.optional(),tools:t.optional()}).optional(),elicitation:re.optional(),roots:L({listChanged:P().optional()}).optional(),tasks:ie.optional(),extensions:B(j(),t).optional()}),v=s.extend({protocolVersion:j(),capabilities:oe,clientInfo:_}),se=l.extend({method:H(`initialize`),params:v}),ce=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:ae.optional(),extensions:B(j(),t).optional()}),le=f.extend({protocolVersion:j(),capabilities:ce,serverInfo:_,instructions:j().optional()}),ue=d.extend({method:H(`notifications/initialized`),params:u.optional()}),de=l.extend({method:H(`ping`),params:s.optional()}),fe=L({progress:N(),total:U(N()),message:U(j())}),pe=L({...u.shape,...fe.shape,progressToken:n}),me=d.extend({method:H(`notifications/progress`),params:pe}),he=s.extend({cursor:r.optional()}),y=l.extend({params:he.optional()}),b=f.extend({nextCursor:r.optional()}),ge=L({uri:j(),mimeType:U(j()),_meta:B(j(),F()).optional()}),_e=ge.extend({text:j()}),ve=j().refine(e=>{try{return atob(e),!0}catch{return!1}},{message:`Invalid Base64 string`}),ye=ge.extend({blob:ve}),be=V([`user`,`assistant`]),xe=L({audience:I(be).optional(),priority:N().min(0).max(1).optional(),lastModified:il({offset:!0}).optional()}),Se=L({...ne.shape,...g.shape,uri:j(),description:U(j()),mimeType:U(j()),size:U(N()),annotations:xe.optional(),_meta:U(R({}))}),Ce=L({...ne.shape,...g.shape,uriTemplate:j(),description:U(j()),mimeType:U(j()),annotations:xe.optional(),_meta:U(R({}))}),we=y.extend({method:H(`resources/list`)}),Te=b.extend({resources:I(Se)}),Ee=y.extend({method:H(`resources/templates/list`)}),De=b.extend({resourceTemplates:I(Ce)}),Oe=s.extend({uri:j()}),ke=Oe,Ae=l.extend({method:H(`resources/read`),params:ke}),je=f.extend({contents:I(z([_e,ye]))}),Me=d.extend({method:H(`notifications/resources/list_changed`),params:u.optional()}),Ne=Oe,Pe=l.extend({method:H(`resources/subscribe`),params:Ne}),Fe=Oe,Ie=l.extend({method:H(`resources/unsubscribe`),params:Fe}),Le=u.extend({uri:j()}),Re=d.extend({method:H(`notifications/resources/updated`),params:Le}),ze=L({name:j(),description:U(j()),required:U(P())}),Be=L({...ne.shape,...g.shape,description:U(j()),arguments:U(I(ze)),_meta:U(R({}))}),Ve=y.extend({method:H(`prompts/list`)}),He=b.extend({prompts:I(Be)}),Ue=s.extend({name:j(),arguments:B(j(),j()).optional()}),We=l.extend({method:H(`prompts/get`),params:Ue}),Ge=L({type:H(`text`),text:j(),annotations:xe.optional(),_meta:B(j(),F()).optional()}),Ke=L({type:H(`image`),data:ve,mimeType:j(),annotations:xe.optional(),_meta:B(j(),F()).optional()}),qe=L({type:H(`audio`),data:ve,mimeType:j(),annotations:xe.optional(),_meta:B(j(),F()).optional()}),Je=L({type:H(`tool_use`),name:j(),id:j(),input:B(j(),F()),_meta:B(j(),F()).optional()}),Ye=L({type:H(`resource`),resource:z([_e,ye]),annotations:xe.optional(),_meta:B(j(),F()).optional()}),x=Se.extend({type:H(`resource_link`)}),Xe=z([Ge,Ke,qe,x,Ye]),Ze=L({role:be,content:Xe}),Qe=f.extend({description:j().optional(),messages:I(Ze)}),$e=d.extend({method:H(`notifications/prompts/list_changed`),params:u.optional()}),et=L({title:j().optional(),readOnlyHint:P().optional(),destructiveHint:P().optional(),idempotentHint:P().optional(),openWorldHint:P().optional()}),tt=L({taskSupport:V([`required`,`optional`,`forbidden`]).optional()}),nt=L({...ne.shape,...g.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:et.optional(),execution:tt.optional(),_meta:B(j(),F()).optional()}),rt=y.extend({method:H(`tools/list`)}),S=b.extend({tools:I(nt)}),it=f.extend({content:I(Xe),structuredContent:B(j(),F()).optional(),isError:P().optional()}),C=c.extend({name:j(),arguments:B(j(),F()).optional()}),w=l.extend({method:H(`tools/call`),params:C}),at=d.extend({method:H(`notifications/tools/list_changed`),params:u.optional()}),ot=V([`debug`,`info`,`notice`,`warning`,`error`,`critical`,`alert`,`emergency`]),st=s.extend({level:ot}),ct=l.extend({method:H(`logging/setLevel`),params:st}),lt=u.extend({level:ot,logger:j().optional(),data:F()}),ut=d.extend({method:H(`notifications/message`),params:lt}),dt=L({name:j().optional()}),ft=L({hints:I(dt).optional(),costPriority:N().min(0).max(1).optional(),speedPriority:N().min(0).max(1).optional(),intelligencePriority:N().min(0).max(1).optional()}),pt=L({mode:V([`auto`,`required`,`none`]).optional()}),mt=L({type:H(`tool_result`),toolUseId:j().describe(`The unique identifier for the corresponding tool call.`),content:I(Xe),structuredContent:L({}).loose().optional(),isError:P().optional(),_meta:B(j(),F()).optional()}),ht=wc(`type`,[Ge,Ke,qe]),gt=wc(`type`,[Ge,Ke,qe,Je,mt]),_t=L({role:be,content:z([gt,I(gt)]),_meta:B(j(),F()).optional()}),vt=c.extend({messages:I(_t),modelPreferences:ft.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(nt).optional(),toolChoice:pt.optional()}),yt=l.extend({method:H(`sampling/createMessage`),params:vt}),bt=f.extend({model:j(),stopReason:U(V([`endTurn`,`stopSequence`,`maxTokens`]).or(j())),role:be,content:ht}),xt=f.extend({model:j(),stopReason:U(V([`endTurn`,`stopSequence`,`maxTokens`,`toolUse`]).or(j())),role:be,content:z([gt,I(gt)])}),St=L({type:H(`boolean`),title:j().optional(),description:j().optional(),default:P().optional()}),Ct=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()}),wt=L({type:V([`number`,`integer`]),title:j().optional(),description:j().optional(),minimum:N().optional(),maximum:N().optional(),default:N().optional()}),Tt=L({type:H(`string`),title:j().optional(),description:j().optional(),enum:I(j()),default:j().optional()}),Et=L({type:H(`string`),title:j().optional(),description:j().optional(),oneOf:I(L({const:j(),title:j()})),default:j().optional()}),Dt=L({type:H(`string`),title:j().optional(),description:j().optional(),enum:I(j()),enumNames:I(j()).optional(),default:j().optional()}),Ot=z([Tt,Et]),kt=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()}),At=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()}),jt=z([kt,At]),Mt=z([Dt,Ot,jt]),Nt=z([Mt,St,Ct,wt]),Pt=c.extend({mode:H(`form`).optional(),message:j(),requestedSchema:L({type:H(`object`),properties:B(j(),Nt),required:I(j()).optional()}).catchall(F())}),Ft=c.extend({mode:H(`url`),message:j(),elicitationId:j(),url:j().url()}),It=z([Pt,Ft]),Lt=l.extend({method:H(`elicitation/create`),params:It}),Rt=u.extend({elicitationId:j()}),zt=d.extend({method:H(`notifications/elicitation/complete`),params:Rt}),Bt=f.extend({action:V([`accept`,`decline`,`cancel`]),content:tl(e=>e===null?void 0:e,B(j(),z([j(),N(),P(),I(j())])).optional())}),Vt=L({type:H(`ref/resource`),uri:j()}),Ht=L({type:H(`ref/prompt`),name:j()}),Ut=s.extend({ref:z([Ht,Vt]),argument:L({name:j(),value:j()}),context:L({arguments:B(j(),j()).optional()}).optional()}),Wt=l.extend({method:H(`completion/complete`),params:Ut}),Gt=f.extend({completion:R({values:I(j()).max(100),total:U(N().int()),hasMore:U(P())})}),Kt=L({uri:j().startsWith(`file://`),name:j().optional(),_meta:B(j(),F()).optional()}),qt=l.extend({method:H(`roots/list`),params:s.optional()}),Jt=f.extend({roots:I(Kt)}),Yt=d.extend({method:H(`notifications/roots/list_changed`),params:u.optional()}),Xt=R({ttl:N().optional(),pollInterval:N().optional()}),Zt=V([`working`,`input_required`,`completed`,`failed`,`cancelled`]),Qt=L({taskId:j(),status:Zt,ttl:z([N(),mc()]),createdAt:j(),lastUpdatedAt:j(),pollInterval:U(N()),statusMessage:U(j())}),$t=f.extend({task:Qt}),en=u.merge(Qt),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(Qt),an=l.extend({method:H(`tasks/result`),params:s.extend({taskId:j()})}),on=f.loose(),T=y.extend({method:H(`tasks/list`)}),sn=b.extend({tasks:I(Qt)}),cn=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:g,BaseMetadataSchema:ne,ImplementationSchema:_,ClientTasksCapabilitySchema:ie,ServerTasksCapabilitySchema:ae,ClientCapabilitiesSchema:oe,InitializeRequestParamsSchema:v,InitializeRequestSchema:se,ServerCapabilitiesSchema:ce,InitializeResultSchema:le,InitializedNotificationSchema:ue,PingRequestSchema:de,ProgressSchema:fe,ProgressNotificationParamsSchema:pe,ProgressNotificationSchema:me,PaginatedRequestParamsSchema:he,PaginatedRequestSchema:y,PaginatedResultSchema:b,ResourceContentsSchema:ge,TextResourceContentsSchema:_e,BlobResourceContentsSchema:ye,RoleSchema:be,AnnotationsSchema:xe,ResourceSchema:Se,ResourceTemplateSchema:Ce,ListResourcesRequestSchema:we,ListResourcesResultSchema:Te,ListResourceTemplatesRequestSchema:Ee,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:Ke,AudioContentSchema:qe,ToolUseContentSchema:Je,EmbeddedResourceSchema:Ye,ResourceLinkSchema:x,ContentBlockSchema:Xe,PromptMessageSchema:Ze,GetPromptResultSchema:Qe,PromptListChangedNotificationSchema:$e,ToolAnnotationsSchema:et,ToolExecutionSchema:tt,ToolSchema:nt,ListToolsRequestSchema:rt,ListToolsResultSchema:S,CallToolResultSchema:it,CallToolRequestParamsSchema:C,CallToolRequestSchema:w,ToolListChangedNotificationSchema:at,LoggingLevelSchema:ot,SetLevelRequestParamsSchema:st,SetLevelRequestSchema:ct,LoggingMessageNotificationParamsSchema:lt,LoggingMessageNotificationSchema:ut,ModelHintSchema:dt,ModelPreferencesSchema:ft,ToolChoiceSchema:pt,ToolResultContentSchema:mt,SamplingContentSchema:ht,SamplingMessageContentBlockSchema:gt,SamplingMessageSchema:_t,CreateMessageRequestParamsSchema:vt,CreateMessageRequestSchema:yt,CreateMessageResultSchema:bt,CreateMessageResultWithToolsSchema:xt,BooleanSchemaSchema:St,StringSchemaSchema:Ct,NumberSchemaSchema:wt,UntitledSingleSelectEnumSchemaSchema:Tt,TitledSingleSelectEnumSchemaSchema:Et,LegacyTitledEnumSchemaSchema:Dt,SingleSelectEnumSchemaSchema:Ot,UntitledMultiSelectEnumSchemaSchema:kt,TitledMultiSelectEnumSchemaSchema:At,MultiSelectEnumSchemaSchema:jt,EnumSchemaSchema:Mt,PrimitiveSchemaDefinitionSchema:Nt,ElicitRequestFormParamsSchema:Pt,ElicitRequestURLParamsSchema:Ft,ElicitRequestParamsSchema:It,ElicitRequestSchema:Lt,ElicitationCompleteNotificationParamsSchema:Rt,ElicitationCompleteNotificationSchema:zt,ElicitResultSchema:Bt,ResourceTemplateReferenceSchema:Vt,PromptReferenceSchema:Ht,CompleteRequestParamsSchema:Ut,CompleteRequestSchema:Wt,CompleteResultSchema:Gt,RootSchema:Kt,ListRootsRequestSchema:qt,ListRootsResultSchema:Jt,RootsListChangedNotificationSchema:Yt,TaskCreationParamsSchema:Xt,TaskStatusSchema:Zt,TaskSchema:Qt,CreateTaskResultSchema:$t,TaskStatusNotificationParamsSchema:en,TaskStatusNotificationSchema:tn,GetTaskRequestSchema:nn,GetTaskResultSchema:rn,GetTaskPayloadRequestSchema:an,GetTaskPayloadResultSchema:on,ListTasksRequestSchema:T,ListTasksResultSchema:sn,CancelTaskRequestSchema:cn,CancelTaskResultSchema:f.merge(Qt),ClientRequestSchema:z([de,se,Wt,ct,We,Ve,we,Ee,Ae,Pe,Ie,w,rt,nn,an,T,cn]),ClientNotificationSchema:z([ee,me,ue,Yt,tn]),ClientResultSchema:z([m,bt,xt,Bt,Jt,rn,sn,$t]),ServerRequestSchema:z([de,yt,Lt,qt,nn,an,T,cn]),ServerNotificationSchema:z([ee,me,ut,Re,Me,at,$e,tn,zt]),ServerResultSchema:z([m,le,Gt,Qe,He,Te,De,je,it,S,rn,sn,$t]),CallToolResultWireSchema:F().superRefine((e,t)=>{if(typeof e==`object`&&e&&!Array.isArray(e)&&e.content===void 0){for(let n of Lf)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(Rf).pipe(it)}}var Bf;function Vf(){return Bf??=zf()}function Hf(e){return e.type!==`object`}var Uf=new Set([`const`,`enum`,`default`,`examples`]),Wf=new Set([`properties`,`patternProperties`,`$defs`,`definitions`,`dependentSchemas`,`dependencies`]);function Gf(e){return e!==void 0&&!(typeof e==`string`&&e.startsWith(`#`))}function Kf(e){let t=typeof e.$schema==`string`?e.$schema:void 0;if(Gf(e.$id))return{...t!==void 0&&{$schema:t},type:`object`,properties:{result:e},required:[`result`]};let n=s(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&&Gf(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]=Uf.has(o)?s:Wf.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 qf={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},Jf={"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},Yf={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},Xf;function Zf(){if(Xf)return Xf;let e=Vf();return Xf={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}},Xf}function Qf(e){return Object.prototype.hasOwnProperty.call(qf,e)}function $f(e){return Object.prototype.hasOwnProperty.call(Jf,e)}function ep(e){return Object.prototype.hasOwnProperty.call(Yf,e)}function tp(e){return ep(e)?Zf().resultSchemas[e]:void 0}function np(e){return Qf(e)?Zf().requestSchemas[e]:void 0}function rp(e){return $f(e)?Zf().notificationSchemas[e]:void 0}Object.keys(qf),Object.keys(Jf);function ip(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function ap(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 op={ok:!1,reason:`not-in-era`};function sp(e){return ip(e)&&ip(e.outputSchema)&&Hf(e.outputSchema)}function cp(e){return e}var lp={era:`2025-11-25`,hasRequestMethod:Qf,hasNotificationMethod:$f,validateRequest:(e,t)=>ap(np(e),t),validateResult:(e,t)=>ap(tp(e),t),validateNotification:(e,t)=>ap(rp(e),t),hasInputRequestMethod:()=>!1,validateInputRequest:()=>op,validateInputResponse:()=>op,samplingResultVariant:((e,t)=>{let n=Vf();return ap(e?n.CreateMessageResultWithToolsSchema:n.CreateMessageResultSchema,t)}),outboundEnvelope:e=>void 0,validateEnvelopeMeta:e=>[],projectCallToolResult(e,t){let n=If(e),r=n.structuredContent;if(r===void 0)return n;let i=typeof r!=`object`||!r||Array.isArray(r),a=t!==void 0&&Hf(t);return!i&&!a?n:{...n,structuredContent:{result:r}}},decodeResult(e,t){if(ip(t)&&`resultType`in t){let e={...t};return delete e.resultType,{kind:`complete`,result:cp(e)}}return{kind:`complete`,result:cp(t)}},encodeResult(e,t){if(e!==`tools/list`)return t;let n=t.tools;return!Array.isArray(n)||!n.some(e=>sp(e))?t:{...t,tools:n.map(e=>sp(e)?{...e,outputSchema:Kf(e.outputSchema)}:e)}},encodeErrorCode:e=>e===-32002?-32602:e,checkInboundEnvelope:e=>void 0};function up(){let e=Zc(()=>z([j(),N(),P(),mc(),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()}),g=te.extend({...te.shape,...ee.shape,version:j(),websiteUrl:j().optional(),description:j().optional()}),ne=tl(e=>e&&typeof e==`object`&&!Array.isArray(e)&&Object.keys(e).length===0?{form:{}}:e,Ec(L({form:Ec(L({applyDefaults:P().optional()}),t).optional(),url:t.optional()}),t.optional())),_=R({list:t.optional(),cancel:t.optional(),requests:R({sampling:R({createMessage:t.optional()}).optional(),elicitation:R({create:t.optional()}).optional()}).optional()}),re=R({list:t.optional(),cancel:t.optional(),requests:R({tools:R({call:t.optional()}).optional()}).optional()}),ie=L({experimental:B(j(),t).optional(),sampling:L({context:t.optional(),tools:t.optional()}).optional(),elicitation:ne.optional(),roots:L({listChanged:P().optional()}).optional(),tasks:_.optional(),extensions:B(j(),t).optional()}),ae=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:re.optional(),extensions:B(j(),t).optional()}),oe=L({progress:N(),total:U(N()),message:U(j())}),v=L({...p.shape,...oe.shape,progressToken:n}),se=m.extend({method:H(`notifications/progress`),params:v}),ce=p.extend({level:o,logger:j().optional(),data:F()}),le=m.extend({method:H(`notifications/message`),params:ce}),ue=L({uri:j(),mimeType:U(j()),_meta:B(j(),F()).optional()}),de=ue.extend({text:j()}),fe=ue.extend({blob:s}),pe=L({audience:I(a).optional(),priority:N().min(0).max(1).optional(),lastModified:il({offset:!0}).optional()}),me=L({...te.shape,...ee.shape,uri:j(),description:U(j()),mimeType:U(j()),size:U(N()),annotations:pe.optional(),_meta:U(R({}))}),he=L({...te.shape,...ee.shape,uriTemplate:j(),description:U(j()),mimeType:U(j()),annotations:pe.optional(),_meta:U(R({}))}),y=m.extend({method:H(`notifications/resources/list_changed`),params:p.optional()}),b=p.extend({uri:j()}),ge=m.extend({method:H(`notifications/resources/updated`),params:b}),_e=L({name:j(),description:U(j()),required:U(P())}),ve=L({...te.shape,...ee.shape,description:U(j()),arguments:U(I(_e)),_meta:U(R({}))}),ye=m.extend({method:H(`notifications/prompts/list_changed`),params:p.optional()}),be=L({type:H(`text`),text:j(),annotations:pe.optional(),_meta:B(j(),F()).optional()}),xe=L({type:H(`image`),data:s,mimeType:j(),annotations:pe.optional(),_meta:B(j(),F()).optional()}),Se=L({type:H(`audio`),data:s,mimeType:j(),annotations:pe.optional(),_meta:B(j(),F()).optional()}),Ce=L({type:H(`tool_use`),name:j(),id:j(),input:B(j(),F()),_meta:B(j(),F()).optional()}),we=L({type:H(`resource`),resource:z([de,fe]),annotations:pe.optional(),_meta:B(j(),F()).optional()}),Te=me.extend({type:H(`resource_link`)}),Ee=z([be,xe,Se,Te,we]),De=L({role:a,content:Ee}),Oe=L({title:j().optional(),readOnlyHint:P().optional(),destructiveHint:P().optional(),idempotentHint:P().optional(),openWorldHint:P().optional()}),ke=m.extend({method:H(`notifications/tools/list_changed`),params:p.optional()}),Ae=L({name:j().optional()}),je=L({hints:I(Ae).optional(),costPriority:N().min(0).max(1).optional(),speedPriority:N().min(0).max(1).optional(),intelligencePriority:N().min(0).max(1).optional()}),Me=L({mode:V([`auto`,`required`,`none`]).optional()}),Ne=L({type:H(`boolean`),title:j().optional(),description:j().optional(),default:P().optional()}),Pe=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()}),Fe=L({type:V([`number`,`integer`]),title:j().optional(),description:j().optional(),minimum:N().optional(),maximum:N().optional(),default:N().optional()}),Ie=L({type:H(`string`),title:j().optional(),description:j().optional(),enum:I(j()),default:j().optional()}),Le=L({type:H(`string`),title:j().optional(),description:j().optional(),oneOf:I(L({const:j(),title:j()})),default:j().optional()}),Re=L({type:H(`string`),title:j().optional(),description:j().optional(),enum:I(j()),enumNames:I(j()).optional(),default:j().optional()}),ze=z([Ie,Le]),Be=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()}),Ve=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()}),He=z([Be,Ve]),Ue=z([Re,ze,He]),We=z([Ue,Ne,Pe,Fe]),Ge=f.extend({mode:H(`form`).optional(),message:j(),requestedSchema:L({type:H(`object`),properties:B(j(),We),required:I(j()).optional()}).catchall(F())}),Ke=L({type:H(`ref/resource`),uri:j()}),qe=L({type:H(`ref/prompt`),name:j()}),Je=L({uri:j().startsWith(`file://`),name:j().optional(),_meta:B(j(),F()).optional()}),Ye=ie.shape,x=L({experimental:Ye.experimental,sampling:Ye.sampling,elicitation:Ye.elicitation,roots:Ye.roots,extensions:Ye.extensions}),Xe=ae.shape,Ze=L({experimental:Xe.experimental,logging:Xe.logging,completions:Xe.completions,prompts:Xe.prompts,resources:Xe.resources,tools:Xe.tools,extensions:Xe.extensions}),Qe=R({progressToken:n.optional(),[ll]:j(),[ul]:g.optional(),[fl]:x,[ml]:o.optional()}),$e=L({...te.shape,...ee.shape,description:j().optional(),inputSchema:R({$schema:j().optional(),type:H(`object`)}),outputSchema:R({$schema:j().optional()}).optional(),annotations:Oe.optional(),_meta:B(j(),F()).optional()}),et=L({type:H(`tool_result`),toolUseId:j(),content:I(Ee),structuredContent:F().optional(),isError:P().optional(),_meta:B(j(),F()).optional()}),tt=z([be,xe,Se,Ce,et]),nt=L({role:a,content:z([tt,I(tt)]),_meta:B(j(),F()).optional()}),rt=j(),S=R({[dl]:g.optional().catch(void 0)}),it=S.optional();function C(e){return R({_meta:it,resultType:rt.default(`complete`),...e})}let w=C({}),at=C({nextCursor:r.optional()}),ot=C({content:I(Ee),structuredContent:F().optional(),isError:P().optional()}),st=C({ttlMs:N().int().min(0),cacheScope:V([`public`,`private`]),tools:I($e),nextCursor:r.optional()}),ct=C({ttlMs:N().int().min(0),cacheScope:V([`public`,`private`]),prompts:I(ve),nextCursor:r.optional()}),lt=C({description:j().optional(),messages:I(De)}),ut=C({ttlMs:N().int().min(0),cacheScope:V([`public`,`private`]),resources:I(me),nextCursor:r.optional()}),dt=C({ttlMs:N().int().min(0),cacheScope:V([`public`,`private`]),resourceTemplates:I(he),nextCursor:r.optional()}),ft=C({ttlMs:N().int().min(0),cacheScope:V([`public`,`private`]),contents:I(z([de,fe]))}),pt=C({completion:L({values:I(j()).max(100),total:N().int().optional(),hasMore:P().optional()}).loose()}),mt=C({ttlMs:N().int().min(0),cacheScope:V([`public`,`private`])}),ht=C({ttlMs:N().int().min(0).catch(0),cacheScope:V([`public`,`private`]).catch(`private`),supportedVersions:I(j()),capabilities:Ze,instructions:j().optional()}),gt=L({messages:I(nt),modelPreferences:je.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($e).optional(),toolChoice:Me.optional()}),_t=L({method:H(`sampling/createMessage`),params:gt}),vt=L({method:H(`roots/list`),params:L({_meta:B(j(),F()).optional()}).optional()}),yt=L({...nt.shape,model:j(),stopReason:j().optional()}),bt=L({roots:I(Je)}),xt=L({action:V([`accept`,`decline`,`cancel`]),content:B(j(),z([j(),N(),P(),I(j())])).optional()}),St=L({mode:H(`url`),message:j(),url:j().url()}),Ct=z([Ge,St]),wt=L({method:H(`elicitation/create`),params:Ct}),Tt=z([_t,vt,wt]),Et=z([yt,bt,xt]),Dt=B(j(),Tt),Ot=B(j(),Et),kt=C({inputRequests:Dt.optional(),requestState:j().optional()}),At={inputResponses:Ot.optional(),requestState:j().optional()},jt=L({_meta:Qe,...At}),Mt=R({progressToken:n.optional()});function Nt(e,t){return L({method:H(e),params:L({_meta:Qe,...t})})}function Pt(e,t){return L({method:H(e),params:L({_meta:Mt.optional(),...t}).optional()})}let Ft={name:j(),arguments:B(j(),F()).optional(),...At},It={cursor:r.optional()},Lt=Nt(`tools/call`,Ft),Rt=Nt(`tools/list`,It),zt=Nt(`prompts/list`,It),Bt=Nt(`prompts/get`,{name:j(),arguments:B(j(),j()).optional(),...At}),Vt=Nt(`resources/list`,It),Ht=Nt(`resources/templates/list`,It),Ut=Nt(`resources/read`,{uri:j(),...At}),Wt={ref:z([qe,Ke]),argument:L({name:j(),value:j()}),context:L({arguments:B(j(),j()).optional()}).optional()},Gt=Nt(`completion/complete`,Wt),Kt=Nt(`server/discover`,{}),qt=L({toolsListChanged:P().optional(),promptsListChanged:P().optional(),resourcesListChanged:P().optional(),resourceSubscriptions:I(j()).optional()}),Jt={notifications:qt},Yt=Nt(`subscriptions/listen`,Jt),Xt=S.extend({"io.modelcontextprotocol/subscriptionId":i}),Zt=R({_meta:Xt,resultType:rt.default(`complete`)}),Qt={"tools/call":Pt(`tools/call`,Ft),"tools/list":Pt(`tools/list`,It),"prompts/get":Pt(`prompts/get`,{name:j(),arguments:B(j(),j()).optional()}),"prompts/list":Pt(`prompts/list`,It),"resources/list":Pt(`resources/list`,It),"resources/templates/list":Pt(`resources/templates/list`,It),"resources/read":Pt(`resources/read`,{uri:j()}),"completion/complete":Pt(`completion/complete`,Wt),"server/discover":Pt(`server/discover`,{}),"subscriptions/listen":Pt(`subscriptions/listen`,Jt)};function $t(e){return R({_meta:it,...e})}let en={"tools/call":$t({content:I(Ee),structuredContent:F().optional(),isError:P().optional()}),"tools/list":$t({ttlMs:N().int().min(0),cacheScope:V([`public`,`private`]),tools:I($e),nextCursor:r.optional()}),"prompts/get":$t({description:j().optional(),messages:I(De)}),"prompts/list":$t({ttlMs:N().int().min(0),cacheScope:V([`public`,`private`]),prompts:I(ve),nextCursor:r.optional()}),"resources/list":$t({ttlMs:N().int().min(0),cacheScope:V([`public`,`private`]),resources:I(me),nextCursor:r.optional()}),"resources/templates/list":$t({ttlMs:N().int().min(0),cacheScope:V([`public`,`private`]),resourceTemplates:I(he),nextCursor:r.optional()}),"resources/read":$t({ttlMs:N().int().min(0),cacheScope:V([`public`,`private`]),contents:I(z([de,fe]))}),"completion/complete":$t({completion:L({values:I(j()).max(100),total:N().int().optional(),hasMore:P().optional()}).loose()}),"server/discover":$t({ttlMs:N().int().min(0).catch(0),cacheScope:V([`public`,`private`]).catch(`private`),supportedVersions:I(j()),capabilities:Ze,instructions:j().optional()}),"subscriptions/listen":$t({})},tn=R({"io.modelcontextprotocol/subscriptionId":i.optional()}),nn=L({method:H(`notifications/subscriptions/acknowledged`),params:L({_meta:tn.optional(),notifications:qt})}),rn=L({_meta:tn.optional(),requestId:i,reason:j().optional()}),an=L({method:H(`notifications/cancelled`),params:rn}),on={"notifications/cancelled":an,"notifications/progress":se,"notifications/message":le,"notifications/resources/updated":ge,"notifications/resources/list_changed":y,"notifications/tools/list_changed":ke,"notifications/prompts/list_changed":ye,"notifications/subscriptions/acknowledged":nn},T=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:g,ClientTasksCapabilitySchema:_,ServerTasksCapabilitySchema:re,ClientCapabilitiesSchema:ie,ServerCapabilitiesSchema:ae,ProgressSchema:oe,ProgressNotificationParamsSchema:v,ProgressNotificationSchema:se,LoggingMessageNotificationParamsSchema:ce,LoggingMessageNotificationSchema:le,ResourceContentsSchema:ue,TextResourceContentsSchema:de,BlobResourceContentsSchema:fe,AnnotationsSchema:pe,ResourceSchema:me,ResourceTemplateSchema:he,ResourceListChangedNotificationSchema:y,ResourceUpdatedNotificationParamsSchema:b,ResourceUpdatedNotificationSchema:ge,PromptArgumentSchema:_e,PromptSchema:ve,PromptListChangedNotificationSchema:ye,TextContentSchema:be,ImageContentSchema:xe,AudioContentSchema:Se,ToolUseContentSchema:Ce,EmbeddedResourceSchema:we,ResourceLinkSchema:Te,ContentBlockSchema:Ee,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:Ke,PromptReferenceSchema:qe,RootSchema:Je,ClientCapabilities2026Schema:x,ServerCapabilities2026Schema:Ze,RequestMetaEnvelopeSchema:Qe,ToolSchema:$e,ToolResultContentSchema:et,SamplingMessageContentBlockSchema:tt,SamplingMessageSchema:nt,ResultTypeSchema:rt,ResultMetaSchema:S,ResultSchema:w,PaginatedResultSchema:at,CallToolResultSchema:ot,ListToolsResultSchema:st,ListPromptsResultSchema:ct,GetPromptResultSchema:lt,ListResourcesResultSchema:ut,ListResourceTemplatesResultSchema:dt,ReadResourceResultSchema:ft,CompleteResultSchema:pt,CacheableResultSchema:mt,DiscoverResultSchema:ht,CreateMessageRequestParamsSchema:gt,CreateMessageRequestSchema:_t,ListRootsRequestSchema:vt,CreateMessageResultSchema:yt,ListRootsResultSchema:bt,ElicitResultSchema:xt,ElicitRequestURLParamsSchema:St,ElicitRequestParamsSchema:Ct,ElicitRequestSchema:wt,InputRequestSchema:Tt,InputResponseSchema:Et,InputRequestsSchema:Dt,InputResponsesSchema:Ot,InputRequiredResultSchema:kt,InputResponseRequestParamsSchema:jt,CallToolRequestSchema:Lt,ListToolsRequestSchema:Rt,ListPromptsRequestSchema:zt,GetPromptRequestSchema:Bt,ListResourcesRequestSchema:Vt,ListResourceTemplatesRequestSchema:Ht,ReadResourceRequestSchema:Ut,CompleteRequestSchema:Gt,DiscoverRequestSchema:Kt,SubscriptionFilterSchema:qt,SubscriptionsListenRequestSchema:Yt,SubscriptionsListenResultMetaSchema:Xt,SubscriptionsListenResultSchema:Zt,dispatchRequestSchemas:Qt,dispatchResultSchemas:en,NotificationMetaSchema:tn,SubscriptionsAcknowledgedNotificationSchema:nn,CancelledNotificationParamsSchema:rn,CancelledNotificationSchema:an,notificationSchemas2026:on,JSONRPCResultResponseSchema:T(w),CallToolResultResponseSchema:T(z([ot,kt])),ListToolsResultResponseSchema:T(st),ListPromptsResultResponseSchema:T(ct),GetPromptResultResponseSchema:T(z([lt,kt])),ListResourcesResultResponseSchema:T(ut),ListResourceTemplatesResultResponseSchema:T(dt),ReadResourceResultResponseSchema:T(z([ft,kt])),CompleteResultResponseSchema:T(pt),DiscoverResultResponseSchema:T(ht),SubscriptionsListenResultResponseSchema:T(Zt)}}var dp;function fp(){return dp??=up()}var pp=[`tools/list`,`prompts/list`,`resources/list`,`resources/templates/list`,`resources/read`,`server/discover`];function mp(e){return pp.includes(e)}var hp=Symbol(`modelcontextprotocol.resultCacheHintFallback`);function gp(e){return e[hp]}function _p(e){return typeof e==`number`&&Number.isSafeInteger(e)&&e>=0}function vp(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 Nf(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 Nf(this,e)}constructor(e,t,n){super(t),this.code=e,this.data=n,this.name=`ProtocolError`,Mf(this,new.target)}static fromError(t,n,r){if(t===Z.UrlElicitationRequired&&r){let e=r;if(e.elicitations)return new bp(e.elicitations,n)}if(t===Z.UnsupportedProtocolVersion&&r){let e=r;if(Array.isArray(e.supported)&&typeof e.requested==`string`)return new xp({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 yp(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 Sp({requiredCapabilities:e.requiredCapabilities},n)}return new e(t,n,r)}},yp=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}},bp=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??[]}},xp=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}},Sp=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}},Cp=0,wp=`private`,Tp=[`tools/call`,`prompts/get`,`resources/read`];function Ep(e,t){let n=t.resultType;if(n===void 0)return{...t,resultType:`complete`};if(n===`complete`||Tp.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 Dp(e,t){let n=gp(t);if(t.resultType!==`complete`||!mp(e))return n===void 0?t:Mp(t);let r=t,i=_p(r.ttlMs)?r.ttlMs:Ap(n),a=vp(r.cacheScope)?r.cacheScope:jp(n),o={...r,ttlMs:i,cacheScope:a};return delete o[hp],o}function Op(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function kp(e,t){if(t===void 0)return e;let n=e._meta;return n===void 0?{...e,_meta:{[dl]:t}}:!Op(n)||n[`io.modelcontextprotocol/serverInfo`]!==void 0?e:{...e,_meta:{...n,[dl]:t}}}function Ap(e){return e!==void 0&&_p(e.ttlMs)?e.ttlMs:Cp}function jp(e){return e!==void 0&&vp(e.cacheScope)?e.cacheScope:wp}function Mp(e){let t={...e};return delete t[hp],t}var Np=[`elicitation/create`,`sampling/createMessage`,`roots/list`],Pp;function Fp(){if(Pp)return Pp;let e=fp();return Pp={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}},Pp}function Ip(e){return Np.includes(e)}function Lp(e){return Ip(e)?Fp().request[e]:void 0}function Rp(e){return Ip(e)?Fp().response[e]:void 0}var zp={"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},Bp={"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 Vp(e){return Object.prototype.hasOwnProperty.call(zp,e)}function Hp(e){return Object.prototype.hasOwnProperty.call(Bp,e)}function Up(e){return Object.prototype.hasOwnProperty.call(zp,e)}function Wp(e){return Vp(e)?fp().dispatchRequestSchemas[e]:void 0}function Gp(e){return Up(e)?fp().dispatchResultSchemas[e]:void 0}function Kp(e){return Hp(e)?fp().notificationSchemas2026[e]:void 0}Object.keys(zp),Object.keys(Bp);function qp(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Jp(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 Yp={ok:!1,reason:`not-in-era`},Xp=[ll,fl];function Zp(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=>qp(e)&&`execution`in e)&&(i().tools=a.map(e=>{if(!qp(e)||!(`execution`in e))return e;let t={...e};return delete t.execution,t}));let o=t.capabilities;if(qp(o)&&`tasks`in o){let e={...o};delete e.tasks,i().capabilities=e}return n}var Qp={era:`2026-07-28`,hasRequestMethod:Vp,hasNotificationMethod:Hp,hasInputRequestMethod:e=>Lp(e)!==void 0,validateRequest:(e,t)=>Jp(Wp(e),t),validateResult:(e,t)=>Jp(Gp(e),t),validateNotification:(e,t)=>Jp(Kp(e),t),validateInputRequest:(e,t)=>Jp(Lp(e),t),validateInputResponse:(e,t)=>Jp(Rp(e),t),samplingResultVariant:()=>Yp,outboundEnvelope(e){return{[ll]:e.protocolVersion,[ul]:e.clientInfo,[fl]:e.clientCapabilities,...e.logLevel!==void 0&&{"io.modelcontextprotocol/logLevel":e.logLevel}}},validateEnvelopeMeta(e){let t=[];for(let n of Xp)n in e||t.push({key:n,problem:`missing`});let n=fp().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=>If(e),inputRequestSchema:Lp,decodeResult(e,t){if(!qp(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=qp(n)?n:{},i=t.requestState,a=t._meta===void 0?void 0:fp().ResultMetaSchema.safeParse(t._meta),o=a?.success?a.data:void 0;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},...o!==void 0&&{_meta:o}}}if(n!==`complete`)return{kind:`invalid`,error:new X(Y.UnsupportedResultType,`Unsupported result type '${n}' for ${e}`,{resultType:n,method:e})};let r=em(),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 kp(Dp(e,Ep(e,Zp(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=fp().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(`; `)}`}},$p;function em(){if($p)return $p;let e=fp();return $p={"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},$p}var tm=`2026-07-28`;function nm(e){return e!==void 0&&Ff(e)?Qp:lp}function rm(e){return e.revision===void 0?e.era===`modern`?Qp.era:lp.era:nm(e.revision).era}function im(e){return sm.some(t=>t.hasRequestMethod(e))}function am(e){return sm.some(t=>t.hasNotificationMethod(e))}function om(e){return e===`tasks/get`||e===`tasks/cancel`}var sm=[lp,Qp],cm=a({AnnotationsSchema:()=>lu,AudioContentSchema:()=>Hu,BaseMetadataSchema:()=>Rl,BaseRequestParamsSchema:()=>G,BlobResourceContentsSchema:()=>su,BooleanSchemaSchema:()=>Cd,CallToolRequestParamsSchema:()=>rd,CallToolRequestSchema:()=>id,CallToolResultSchema:()=>td,CancelTaskRequestSchema:()=>uf,CancelTaskResultSchema:()=>df,CancelledNotificationParamsSchema:()=>Pl,CancelledNotificationSchema:()=>Fl,ClientCapabilitiesSchema:()=>Ul,ClientNotificationSchema:()=>pf,ClientRequestSchema:()=>ff,ClientResultSchema:()=>mf,ClientTasksCapabilitySchema:()=>Vl,CompatibilityCallToolResultSchema:()=>nd,CompleteRequestParamsSchema:()=>Wd,CompleteRequestSchema:()=>Gd,CompleteResultSchema:()=>Kd,ContentBlockSchema:()=>Ku,CreateMessageRequestParamsSchema:()=>yd,CreateMessageRequestSchema:()=>bd,CreateMessageResultSchema:()=>xd,CreateMessageResultWithToolsSchema:()=>Sd,CreateTaskResultSchema:()=>ef,CursorSchema:()=>vl,DiscoverRequestSchema:()=>Yl,DiscoverResultSchema:()=>Xl,ElicitRequestFormParamsSchema:()=>Fd,ElicitRequestParamsSchema:()=>Ld,ElicitRequestSchema:()=>Rd,ElicitRequestURLParamsSchema:()=>Id,ElicitResultSchema:()=>Vd,ElicitationCompleteNotificationParamsSchema:()=>zd,ElicitationCompleteNotificationSchema:()=>Bd,EmbeddedResourceSchema:()=>Wu,EmptyResultSchema:()=>Nl,EnumSchemaSchema:()=>Nd,GetPromptRequestParamsSchema:()=>Ru,GetPromptRequestSchema:()=>zu,GetPromptResultSchema:()=>Ju,GetTaskPayloadRequestSchema:()=>of,GetTaskPayloadResultSchema:()=>sf,GetTaskRequestSchema:()=>rf,GetTaskResultSchema:()=>af,IconSchema:()=>Il,IconsSchema:()=>Ll,ImageContentSchema:()=>Vu,ImplementationSchema:()=>zl,InitializeRequestParamsSchema:()=>Wl,InitializeRequestSchema:()=>Gl,InitializeResultSchema:()=>ql,InitializedNotificationSchema:()=>Jl,JSONArraySchema:()=>gl,JSONObjectSchema:()=>W,JSONRPCErrorResponseSchema:()=>Al,JSONRPCMessageSchema:()=>jl,JSONRPCNotificationSchema:()=>Ol,JSONRPCRequestSchema:()=>Dl,JSONRPCResponseSchema:()=>Ml,JSONRPCResultResponseSchema:()=>kl,JSONValueSchema:()=>hl,LegacyTitledEnumSchemaSchema:()=>Od,ListChangedOptionsBaseSchema:()=>od,ListPromptsRequestSchema:()=>Iu,ListPromptsResultSchema:()=>Lu,ListResourceTemplatesRequestSchema:()=>mu,ListResourceTemplatesResultSchema:()=>hu,ListResourcesRequestSchema:()=>fu,ListResourcesResultSchema:()=>pu,ListRootsRequestSchema:()=>Jd,ListRootsResultSchema:()=>Yd,ListTasksRequestSchema:()=>cf,ListTasksResultSchema:()=>lf,ListToolsRequestSchema:()=>$u,ListToolsResultSchema:()=>ed,LoggingLevelSchema:()=>sd,LoggingMessageNotificationParamsSchema:()=>ud,LoggingMessageNotificationSchema:()=>dd,ModelHintSchema:()=>fd,ModelPreferencesSchema:()=>pd,MultiSelectEnumSchemaSchema:()=>Md,NotificationSchema:()=>wl,NotificationsParamsSchema:()=>Cl,NumberSchemaSchema:()=>Td,PaginatedRequestParamsSchema:()=>tu,PaginatedRequestSchema:()=>nu,PaginatedResultSchema:()=>ru,PingRequestSchema:()=>Zl,PrimitiveSchemaDefinitionSchema:()=>Pd,ProgressNotificationParamsSchema:()=>$l,ProgressNotificationSchema:()=>eu,ProgressSchema:()=>Ql,ProgressTokenSchema:()=>_l,PromptArgumentSchema:()=>Pu,PromptListChangedNotificationSchema:()=>Yu,PromptMessageSchema:()=>qu,PromptReferenceSchema:()=>Ud,PromptSchema:()=>Fu,ReadResourceRequestParamsSchema:()=>_u,ReadResourceRequestSchema:()=>vu,ReadResourceResultSchema:()=>yu,RelatedTaskMetadataSchema:()=>bl,RequestIdSchema:()=>El,RequestMetaSchema:()=>xl,RequestSchema:()=>K,ResourceContentsSchema:()=>iu,ResourceLinkSchema:()=>Gu,ResourceListChangedNotificationSchema:()=>bu,ResourceRequestParamsSchema:()=>gu,ResourceSchema:()=>uu,ResourceTemplateReferenceSchema:()=>Hd,ResourceTemplateSchema:()=>du,ResourceUpdatedNotificationParamsSchema:()=>Mu,ResourceUpdatedNotificationSchema:()=>Nu,ResultMetaObjectSchema:()=>Tl,ResultSchema:()=>q,RoleSchema:()=>cu,RootSchema:()=>qd,RootsListChangedNotificationSchema:()=>Xd,SamplingContentSchema:()=>gd,SamplingMessageContentBlockSchema:()=>_d,SamplingMessageSchema:()=>vd,ServerCapabilitiesSchema:()=>Kl,ServerNotificationSchema:()=>gf,ServerRequestSchema:()=>hf,ServerResultSchema:()=>_f,ServerTasksCapabilitySchema:()=>Hl,SetLevelRequestParamsSchema:()=>cd,SetLevelRequestSchema:()=>ld,SingleSelectEnumSchemaSchema:()=>kd,StringSchemaSchema:()=>wd,SubscribeRequestParamsSchema:()=>xu,SubscribeRequestSchema:()=>Su,SubscriptionFilterSchema:()=>Tu,SubscriptionsAcknowledgedNotificationParamsSchema:()=>Ou,SubscriptionsAcknowledgedNotificationSchema:()=>ku,SubscriptionsListenRequestParamsSchema:()=>Eu,SubscriptionsListenRequestSchema:()=>Du,SubscriptionsListenResultMetaSchema:()=>Au,SubscriptionsListenResultSchema:()=>ju,TaskAugmentedRequestParamsSchema:()=>Sl,TaskCreationParamsSchema:()=>Zd,TaskMetadataSchema:()=>yl,TaskSchema:()=>$d,TaskStatusNotificationParamsSchema:()=>tf,TaskStatusNotificationSchema:()=>nf,TaskStatusSchema:()=>Qd,TextContentSchema:()=>Bu,TextResourceContentsSchema:()=>au,TitledMultiSelectEnumSchemaSchema:()=>jd,TitledSingleSelectEnumSchemaSchema:()=>Dd,ToolAnnotationsSchema:()=>Xu,ToolChoiceSchema:()=>md,ToolExecutionSchema:()=>Zu,ToolListChangedNotificationSchema:()=>ad,ToolResultContentSchema:()=>hd,ToolSchema:()=>Qu,ToolUseContentSchema:()=>Uu,UnsubscribeRequestParamsSchema:()=>Cu,UnsubscribeRequestSchema:()=>wu,UntitledMultiSelectEnumSchemaSchema:()=>Ad,UntitledSingleSelectEnumSchemaSchema:()=>Ed}),lm=e=>Dl.safeParse(e).success,um=e=>Ol.safeParse(e).success,dm=e=>kl.safeParse(e).success,fm=e=>Al.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 pm(e,t){return Ss(e,t)}function mm(e){return new Set(e.flatMap(e=>Object.keys(e.shape)))}function hm(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 gm=!1,_m=`draft-2020-12`;function vm(e,t=`input`){let n=e[`~standard`],r;if(n.jsonSchema)r=n.jsonSchema[t]({target:_m});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().`);gm||(gm=!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=gs(e,{target:_m,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&&ym(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 ym(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`||ym(e)))}return!1}function bm(e){return e.path?.length?`${e.path.map(e=>String(typeof e==`object`?e.key:e)).join(`.`)}: ${e.message}`:e.message}async function xm(e,t){let n=await e[`~standard`].validate(t);return n.issues&&n.issues.length>0?{success:!1,error:n.issues.map(e=>bm(e)).join(`, `)}:{success:!0,data:n.value}}function Sm(e){let t=gs(e,{target:_m,io:`input`});return typeof t.pattern==`string`?t.pattern:void 0}var Cm=/\\\.\\d\{(\d+)\}/;function wm(e){let t=Cm.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=>il({local:e,offset:t,precision:n}))))}function Tm(e,t){let n;switch(e){case`email`:n=[Vs()];break;case`uri`:n=[Gs()];break;case`date`:n=[al()];break;case`date-time`:n=wm(t)}return new Set(n.map(e=>Sm(e)).filter(e=>e!==void 0))}function Em(e,t,n){return n!==`zod`||Tm(e,t).has(t)}function Dm(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Om(e){try{return vm(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 km=new Set([`$comment`,`deprecated`,`description`,`examples`,`readOnly`,`title`,`writeOnly`]);function Am(e){return km.has(e)||e.startsWith(`x-`)}var jm=new Set([`$schema`,...Object.keys(Fd.shape.requestedSchema.shape)]),Mm={string:mm([wd,Ed,Dd,Od]),number:mm([Td]),integer:mm([Td]),boolean:mm([Cd]),array:mm([Ad,jd])},Nm=new Set(wd.shape.format.unwrap().options);function Pm(e,t,n,r){if(!Dm(e))return e;let i=typeof e.type==`string`&&Object.hasOwn(Mm,e.type)?Mm[e.type]:void 0;if(i===void 0)return e;let a={};for(let[o,s]of Object.entries(e))i.has(o)||Am(o)?a[o]=s:o===`pattern`&&e.type===`string`&&typeof e.format==`string`?Nm.has(e.format)?(typeof s!=`string`||!Em(e.format,s,n))&&r.push(`${t}.${o}`):a[o]=s:r.push(`${t}.${o}`);return a}function Fm(e,t){let n={},r=[];for(let[i,a]of Object.entries(e))i===`properties`&&Dm(a)?n[i]=Object.fromEntries(Object.entries(a).map(([e,n])=>[e,Pm(n,`properties.${e}`,t,r)])):jm.has(i)?n[i]=a:Am(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 Im(e,t){if(!Dm(e.properties))return t;let n=Object.entries(e.properties).filter(([,e])=>!pm(Pd,e).success).map(([e])=>`properties.${e}`);return n.length>0?n.join(`, `):t}function Lm(e,t,n=``){return Array.isArray(e)&&Array.isArray(t)?e.flatMap((e,r)=>Lm(e,t[r],`${n}[${r}]`)):!Dm(e)||!Dm(t)?[]:Object.entries(e).flatMap(([e,r])=>{let i=n?`${n}.${e}`:e;return Object.prototype.hasOwnProperty.call(t,e)?Lm(r,t[e],i):Am(e)?[]:[i]})}function Rm(e){if(!hm(e.requestedSchema))return{...e,mode:`form`,requestedSchema:e.requestedSchema};let t=e.requestedSchema[`~standard`].vendor,n=Fm(Om(e.requestedSchema),t),r=pm(Fd.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): ${Im(n,r.error.message)}`);let i=Lm(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 zm(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(zm,{elicit(e){try{return{method:`elicitation/create`,params:Rm(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 Bm=`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(`.`),Vm={IdJagTokenExchangeResponseSchema:Cf,OAuthClientInformationFullSchema:Of,OAuthClientInformationSchema:Df,OAuthClientMetadataSchema:Ef,OAuthClientRegistrationErrorSchema:kf,OAuthErrorResponseSchema:wf,OAuthMetadataSchema:yf,OAuthProtectedResourceMetadataSchema:vf,OAuthTokenRevocationRequestSchema:Af,OAuthTokensSchema:Sf,OpenIdProviderDiscoveryMetadataSchema:xf,OpenIdProviderMetadataSchema:bf},Hm={},Um={};function Wm(e,t){let n=e.slice(0,-6);Hm[n]=t,Um[n]=e=>t.safeParse(e).success}for(let e of Bm)Wm(e,cm[e]);for(let[e,t]of Object.entries(Vm))Wm(e,t);Object.freeze(Hm),Object.freeze(Um);function Gm(e){switch(e){case`initialize`:case`notifications/initialized`:return nm(void 0);case`server/discover`:return nm(tm);default:return}}var Km=[ll,ul,fl,ml],qm=[`inputResponses`,`requestState`];function Jm(e,t){let n=e.params;if(!$m(n))return{message:e,lifted:{}};let r=n._meta,i=$m(r)?Km.filter(e=>e in r):[],a=t===`request`?qm.filter(e=>e in n):[];if(i.length===0&&a.length===0)return{message:e,lifted:{}};let o={},s={...n};if(i.length>0&&$m(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 Ym(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 Xm(e){return()=>e}var Zm=Xm(void 0),Qm=class{_transport;_requestMessageId=0;_requestHandlers=new Map;_customSchemaRequestMethods=new Set;_requestHandlerAbortControllers=new Map;_notificationHandlers=new Map;_responseHandlers=new Map;_progressHandlers=new Map;_timeoutInfo=new Map;_pendingDebouncedNotifications=new Set;_negotiatedProtocolVersion;_supportedProtocolVersions;onclose;onerror;fallbackRequestHandler;fallbackNotificationHandler;constructor(e){this._options=e,this._supportedProtocolVersions=e?.supportedProtocolVersions??sl,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!==void 0&&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),dm(e)||fm(e)?this._onresponse(e):lm(e)?this._onrequest(e,t):um(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}=Jm(e,`notification`),r=this._negotiatedWireCodec();if(t?.classification===void 0&&this._shouldDropInbound(e)===`drop`)return;if(t?.classification!==void 0){let e=rm(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(am(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}=Jm(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=rm(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(im(n.method)&&!i.hasRequestMethod(n.method)&&!(om(n.method)&&this._customSchemaRequestMethods.has(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:th(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?Zm:Xm(r.requestState),signal:d.signal,send:((e,t,n)=>{let r=this._resolveOutboundCodec(e.method);if(this._assertOutboundRequestInEra(r,e.method),hm(t))return u(e,t,n);let i=Ym(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),dm(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(hm(t))return om(e.method)||this._assertOutboundRequestInEra(r,e.method),this._requestWithSchemaViaCodec(r,e,t,n);this._assertOutboundRequestInEra(r,e.method);let i=Ym(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 nm(this._negotiatedProtocolVersion)}_wireCodec(){return this._negotiatedWireCodec()}_resolveOutboundCodec(e){if(this._negotiatedProtocolVersion===void 0){let t=Gm(e);if(t)return t}return this._negotiatedWireCodec()}_assertOutboundRequestInEra(e,t){if(im(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),g=!1,ne=e=>{g||(this._progressHandlers.delete(h),m===void 0?t.method!==`initialize`&&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(g=!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(nh(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;xm(n,o).then(e=>{e.success?d(e.data):f(new X(Y.InvalidResult,`Invalid result for ${t.method}: ${e.error}`))},f)}),l=()=>ne(r?.signal?.reason),r?.signal?.addEventListener(`abort`,l,{once:!0});let _=r?.timeout??6e4;this._setupTimeout(h,_,r?.maxTotalTimeout,()=>ne(new X(Y.RequestTimeout,`Request timed out`,{timeout:_})),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 await this._notificationViaCodec(this._resolveOutboundCodec(e.method),e,t)}async _notificationViaCodec(e,t,n){if(!this._transport)throw new X(Y.NotConnected,`Not connected`);if(am(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===void 0){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(!im(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 xm(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`);typeof t==`function`?this._customSchemaRequestMethods.delete(e):this._customSchemaRequestMethods.add(e),this._requestHandlers.set(e,this._wrapHandler(e,r))}_wrapHandler(e,t){return t}_outboundServerInfo(){}removeRequestHandler(e){this._requestHandlers.delete(e),this._customSchemaRequestMethods.delete(e)}assertCanSetRequestHandler(e){if(this._requestHandlers.has(e))throw Error(`A request handler for ${e} already exists, which would be overridden`)}setNotificationHandler(e,t,n){if(typeof t==`function`){if(!am(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 xm(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 $m(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function eh(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function th(e){let t={},n=[];if(!eh(e))return{accepted:t,droppedKeys:n};for(let[r,i]of Object.entries(e)){if(!eh(i)||`method`in i||`result`in i){n.push(r);continue}t[r]=i}return{accepted:t,droppedKeys:n}}function nh(e){return{resultType:`input_required`,inputRequests:e.inputRequests,...e.requestState!==void 0&&{requestState:e.requestState},...e._meta!==void 0&&{_meta:e._meta}}}i((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 rh=/^(\d\d):(\d\d):(\d\d)(\.\d+)?(z|[+-]\d\d(?::?\d\d)?)?$/i,ih=/^(?=.{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,ah=/^(?:[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,oh=/^(?:(?:[^\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,sh=/^(?:(?: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,ch=/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,lh=/^(?:\/(?:[^~/]|~0|~1)*)*$/,uh=/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,dh=/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,fh=/^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/,ph=/^((([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 mh(e){return e.test.bind(e)}hh.bind(void 0,!1),mh(ah),mh(oh),mh(sh),mh(ih),mh(fh),mh(ph),mh(ch),mh(lh),mh(uh),mh(dh);function hh(e,t){let n=t.match(rh);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 gh=class extends Error{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.OAuthClientFlowError`})}static[Symbol.hasInstance](e){return Nf(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 Nf(this,e)}constructor(e){super(e),this.name=new.target.name,Mf(this,new.target)}};(class extends gh{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 gh{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 gh{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.InsecureTokenEndpointError`})}tokenEndpoint;constructor(e){super(`Refusing to send credentials to non-https token endpoint '${e}'. OAuth token requests MUST use TLS (localhost / *.localhost / 127.0.0.1 / ::1 are exempt).`),this.tokenEndpoint=e}},class extends gh{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.AuthorizationServerMismatchError`})}constructor(e,t){super(`Authorization server mismatch: credentials are bound to ${JSON.stringify(e)} but this call resolved ${JSON.stringify(t)}; refusing to present them to a different authorization server`),this.recordedIssuer=e,this.currentIssuer=t}},class extends gh{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 Nf(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 Nf(this,e)}constructor(e){super(e??`Unauthorized`),this.name=`UnauthorizedError`,Mf(this,new.target)}},class extends Error{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.SseError`})}static[Symbol.hasInstance](e){return Nf(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 Nf(this,e)}constructor(e,t,n){super(`SSE error: ${t}`),this.code=e,this.event=n,Mf(this,new.target)}};var _h=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}},vh=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)}},yh=new Set;function bh(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`;yh.has(o)||(yh.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},xh(t)):e=>s({method:a,params:e})]}function xh(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 Sh=`2026-01-26`,Ch=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=jl.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},wh=z([H(`light`),H(`dark`)]).describe(`Color theme preference for the host environment.`),Th=z([H(`inline`),H(`fullscreen`),H(`pip`)]).describe(`Display mode for UI presentation.`),Eh=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.
|
|
66
66
|
|
|
67
67
|
Individual style keys are optional - hosts may provide any subset of these values.
|
|
68
68
|
Values are strings containing CSS values (colors, sizes, font stacks, etc.).
|
|
69
69
|
|
|
70
70
|
Note: This type uses \`Record<K, string | undefined>\` rather than \`Partial<Record<K, string>>\`
|
|
71
|
-
for compatibility with Zod schema generation. Both are functionally equivalent for validation.`),z([j(),
|
|
71
|
+
for compatibility with Zod schema generation. Both are functionally equivalent for validation.`),z([j(),fc()]).describe(`Style variables for theming MCP apps.
|
|
72
72
|
|
|
73
73
|
Individual style keys are optional - hosts may provide any subset of these values.
|
|
74
74
|
Values are strings containing CSS values (colors, sizes, font stacks, etc.).
|
|
@@ -80,10 +80,10 @@ Individual style keys are optional - hosts may provide any subset of these value
|
|
|
80
80
|
Values are strings containing CSS values (colors, sizes, font stacks, etc.).
|
|
81
81
|
|
|
82
82
|
Note: This type uses \`Record<K, string | undefined>\` rather than \`Partial<Record<K, string>>\`
|
|
83
|
-
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
|
|
83
|
+
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 Dh=L({isError:P().optional().describe(`True if the host failed to open the URL (e.g., due to security policy).`)}).passthrough(),Oh=L({isError:P().optional().describe(`True if the download failed (e.g., user cancelled or host denied).`)}).passthrough(),kh=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 Ah=L({connectDomains:I(j()).optional().describe(`Origins for network requests (fetch/XHR/WebSocket).
|
|
84
84
|
|
|
85
85
|
- Maps to CSP \`connect-src\` directive
|
|
86
|
-
- 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'`)")}),
|
|
86
|
+
- 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'`)")}),jh=L({camera:L({}).optional().describe(`Request camera access.
|
|
87
87
|
|
|
88
88
|
Maps to Permission Policy \`camera\` feature.`),microphone:L({}).optional().describe(`Request microphone access.
|
|
89
89
|
|
|
@@ -91,7 +91,7 @@ Maps to Permission Policy \`microphone\` feature.`),geolocation:L({}).optional()
|
|
|
91
91
|
|
|
92
92
|
Maps to Permission Policy \`geolocation\` feature.`),clipboardWrite:L({}).optional().describe(`Request clipboard write access.
|
|
93
93
|
|
|
94
|
-
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
|
|
94
|
+
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 Mh=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.`)})}),Nh=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).`)})}),Ph=L({method:H(`ui/notifications/tool-cancelled`),params:L({reason:j().optional().describe(`Optional reason for the cancellation (e.g., "user action", "timeout").`)})}),Fh=L({fonts:j().optional()}),Ih=L({variables:Eh.optional().describe(`CSS variables for theming the app.`),css:Fh.optional().describe(`CSS blocks that apps can inject.`)}),Lh=L({method:H(`ui/resource-teardown`),params:L({})}),Rh=B(j(),F()),zh=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 Bh=L({experimental:B(j(),B(j(),gc()).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:jh.optional().describe(`Permissions granted by the host (camera, microphone, geolocation).`),csp:Ah.optional().describe(`CSP domains approved by the host.`)}).optional().describe(`Sandbox configuration applied by the host.`),updateModelContext:zh.optional().describe(`Host accepts context updates (ui/update-model-context) to be included in the model's context for future turns.`),message:zh.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.")}),Vh=L({experimental:B(j(),B(j(),gc()).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(Th).optional().describe(`Display modes the app supports.`)});L({method:H(`ui/notifications/initialized`),params:L({}).optional()}),L({csp:Ah.optional().describe(`Content Security Policy configuration for UI resources.`),permissions:jh.optional().describe(`Sandbox permissions requested by the UI resource.`),domain:j().optional().describe(`Dedicated origin for view sandbox.
|
|
95
95
|
|
|
96
96
|
Useful when views need stable, dedicated origins for OAuth callbacks, CORS policies, or API key allowlists.
|
|
97
97
|
|
|
@@ -105,14 +105,14 @@ Boolean requesting whether a visible border and background is provided by the ho
|
|
|
105
105
|
|
|
106
106
|
- \`true\`: request visible border + background
|
|
107
107
|
- \`false\`: request no visible border + background
|
|
108
|
-
- omitted: host decides border`)}),L({method:H(`ui/request-display-mode`),params:L({mode:
|
|
108
|
+
- omitted: host decides border`)}),L({method:H(`ui/request-display-mode`),params:L({mode:Th.describe(`The display mode being requested.`)})});var Hh=L({mode:Th.describe(`The display mode that was actually set. May differ from requested if not supported.`)}).passthrough(),Uh=z([H(`model`),H(`app`)]).describe(`Tool visibility scope - who can access the tool.`);L({resourceUri:j().optional(),visibility:I(Uh).optional().describe(`Who can access this tool. Default: ["model", "app"]
|
|
109
109
|
- "model": Tool visible to and callable by the agent
|
|
110
|
-
- "app": Tool callable by the app from this server only`),csp:
|
|
111
|
-
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(),Uh=L({method:H(`ui/notifications/host-context-changed`),params:Hh.describe(`Partial context update containing only changed fields.`)});L({method:H(`ui/update-model-context`),params:L({content:I(Uu).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:Il.describe(`App identification (name and version).`),appCapabilities:Rh.describe(`Features and capabilities this app provides.`),protocolVersion:j().describe(`Protocol version this app supports.`)})});var Wh=L({protocolVersion:j().describe(`Negotiated protocol version string (e.g., "2025-11-21").`),hostInfo:Il.describe(`Host application identification and version.`),hostCapabilities:Lh.describe(`Features and capabilities provided by the host.`),hostContext:Hh.describe(`Rich context about the host environment.`)}).passthrough(),Gh={target:`draft-2020-12`};async function Kh(e,t){let n=e[`~standard`];if(n.jsonSchema)return n.jsonSchema[t](Gh);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 qh(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 Jh(){let e=document.documentElement.getAttribute(`data-theme`);return e===`dark`||e===`light`?e:document.documentElement.classList.contains(`dark`)?`dark`:`light`}function Yh(e){let t=document.documentElement;t.setAttribute(`data-theme`,e),t.style.colorScheme=e}function Xh(e,t=document.documentElement){for(let[n,r]of Object.entries(e))r!==void 0&&t.style.setProperty(n,r)}function Zh(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 Qh(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 $h=class e extends Ym{_appInfo;_appCapabilities;options;_hostCapabilities;_hostInfo;_hostContext;_registeredTools={};_initializedSent=!1;_registeredEvents=new Set;_events=new mh;_methods=new hh;setRequestHandler=(...e)=>{let[t,...n]=_h(`request`,e)??e;this._methods.claim(t,`setRequestHandler`),super.setRequestHandler.call(this,t,...n)};setNotificationHandler=(...e)=>{let[t,...n]=_h(`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:kh,toolinputpartial:Ah,toolresult:Vh,toolcancelled:jh,hostcontextchanged:Uh};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=Qh(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 qh(a,t??{},`Invalid input for tool ${e}: `):t??{},r)}else i=await n(r);return o.outputSchema&&!i.isError&&(i.structuredContent=await qh(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 Kh(t.inputSchema,`input`):{type:`object`,properties:{}}};return t.outputSchema&&(n.outputSchema=await Kh(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:Ph.shape.params,result:Fh},(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},Eh,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},Al,t)}openLink(e,t){return this._assertInitialized(`openLink`),this.request({method:`ui/open-link`,params:e},wh,t)}sendOpenLink=this.openLink;downloadFile(e,t){return this._assertInitialized(`downloadFile`),this.request({method:`ui/download-file`,params:e},Th,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},zh,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 bh(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:yh}},Wh,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 eg(e,t,n={}){let r=$(`button`,{class:`btn${n.class?` ${n.class}`:``}`,type:`button`,...n.title?{title:n.title}:{}});return r.textContent=e,n.disabled&&(r.disabled=!0),r.addEventListener(`click`,t),r}async function tg(e){try{await navigator.clipboard.writeText(e)}catch{let t=document.createElement(`textarea`);t.value=e,t.style.position=`fixed`,t.style.opacity=`0`,document.body.append(t),t.select();try{document.execCommand(`copy`)}finally{t.remove()}}}function ng(e,t,n=`text/plain`){let r=new Blob([t],{type:`${n};charset=utf-8`}),i=URL.createObjectURL(r),a=$(`a`,{href:i,download:e});document.body.append(a),a.click(),a.remove(),URL.revokeObjectURL(i)}function rg(e,t){let n=e=>/[",\n]/.test(e)?`"${e.replace(/"/g,`""`)}"`:e;return`${e.map(n).join(`,`)}\n${t.map(t=>e.map(e=>n(t[e]??``)).join(`,`)).join(`
|
|
112
|
-
`)}\n`}function
|
|
110
|
+
- "app": Tool callable by the app from this server only`),csp:yc().optional(),permissions:yc().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([Wu,Gu])).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(Ku).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:Ah.optional().describe(`CSP configuration from resource metadata.`),permissions:jh.optional().describe(`Sandbox permissions from resource metadata.`)})});var Wh=L({method:H(`ui/notifications/tool-result`),params:td.describe(`Standard MCP tool execution result.`)}),Gh=L({toolInfo:L({id:El.optional().describe(`JSON-RPC id of the tools/call request.`),tool:Qu.describe(`Tool definition including name, inputSchema, etc.`)}).optional().describe(`Metadata of the tool call that instantiated this App.`),theme:wh.optional().describe(`Current color theme preference.`),styles:Ih.optional().describe(`Style configuration for theming the app.`),displayMode:Th.optional().describe(`How the UI is currently displayed.`),availableDisplayModes:I(Th).optional().describe(`Display modes the host supports.`),containerDimensions:z([L({height:N().describe(`Fixed container height in pixels.`)}),L({maxHeight:z([N(),fc()]).optional().describe(`Maximum container height in pixels.`)})]).and(z([L({width:N().describe(`Fixed container width in pixels.`)}),L({maxWidth:z([N(),fc()]).optional().describe(`Maximum container width in pixels.`)})])).optional().describe(`Container dimensions. Represents the dimensions of the iframe or other
|
|
111
|
+
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(),Kh=L({method:H(`ui/notifications/host-context-changed`),params:Gh.describe(`Partial context update containing only changed fields.`)});L({method:H(`ui/update-model-context`),params:L({content:I(Ku).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:zl.describe(`App identification (name and version).`),appCapabilities:Vh.describe(`Features and capabilities this app provides.`),protocolVersion:j().describe(`Protocol version this app supports.`)})});var qh=L({protocolVersion:j().describe(`Negotiated protocol version string (e.g., "2025-11-21").`),hostInfo:zl.describe(`Host application identification and version.`),hostCapabilities:Bh.describe(`Features and capabilities provided by the host.`),hostContext:Gh.describe(`Rich context about the host environment.`)}).passthrough(),Jh={target:`draft-2020-12`};async function Yh(e,t){let n=e[`~standard`];if(n.jsonSchema)return n.jsonSchema[t](Jh);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 Xh(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 Zh(){let e=document.documentElement.getAttribute(`data-theme`);return e===`dark`||e===`light`?e:document.documentElement.classList.contains(`dark`)?`dark`:`light`}function Qh(e){let t=document.documentElement;t.setAttribute(`data-theme`,e),t.style.colorScheme=e}function $h(e,t=document.documentElement){for(let[n,r]of Object.entries(e))r!==void 0&&t.style.setProperty(n,r)}function eg(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 tg(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 ng=class e extends Qm{_appInfo;_appCapabilities;options;_hostCapabilities;_hostInfo;_hostContext;_registeredTools={};_initializedSent=!1;_registeredEvents=new Set;_events=new _h;_methods=new vh;setRequestHandler=(...e)=>{let[t,...n]=bh(`request`,e)??e;this._methods.claim(t,`setRequestHandler`),super.setRequestHandler.call(this,t,...n)};setNotificationHandler=(...e)=>{let[t,...n]=bh(`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:Mh,toolinputpartial:Nh,toolresult:Wh,toolcancelled:Ph,hostcontextchanged:Kh};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&&at({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=tg(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 Xh(a,t??{},`Invalid input for tool ${e}: `):t??{},r)}else i=await n(r);return o.outputSchema&&!i.isError&&(i.structuredContent=await Xh(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 Yh(t.inputSchema,`input`):{type:`object`,properties:{}}};return t.outputSchema&&(n.outputSchema=await Yh(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:Lh.shape.params,result:Rh},(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},kh,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},Nl,t)}openLink(e,t){return this._assertInitialized(`openLink`),this.request({method:`ui/open-link`,params:e},Dh,t)}sendOpenLink=this.openLink;downloadFile(e,t){return this._assertInitialized(`downloadFile`),this.request({method:`ui/download-file`,params:e},Oh,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},Hh,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 Ch(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:Sh}},qh,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 rg(e,t,n={}){let r=$(`button`,{class:`btn${n.class?` ${n.class}`:``}`,type:`button`,...n.title?{title:n.title}:{}});return r.textContent=e,n.disabled&&(r.disabled=!0),r.addEventListener(`click`,t),r}async function ig(e){try{await navigator.clipboard.writeText(e)}catch{let t=document.createElement(`textarea`);t.value=e,t.style.position=`fixed`,t.style.opacity=`0`,document.body.append(t),t.select();try{document.execCommand(`copy`)}finally{t.remove()}}}function ag(e,t,n=`text/plain`){let r=new Blob([t],{type:`${n};charset=utf-8`}),i=URL.createObjectURL(r),a=$(`a`,{href:i,download:e});document.body.append(a),a.click(),a.remove(),URL.revokeObjectURL(i)}function og(e,t){let n=e=>/[",\n]/.test(e)?`"${e.replace(/"/g,`""`)}"`:e;return`${e.map(n).join(`,`)}\n${t.map(t=>e.map(e=>n(t[e]??``)).join(`,`)).join(`
|
|
112
|
+
`)}\n`}function sg(e){e.onhostcontextchanged=e=>{if(e.theme&&Qh(e.theme),e.styles?.variables&&$h(e.styles.variables),e.styles?.css?.fonts&&eg(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`}},Qh(Zh())}var cg=1e4;function lg(){let e=`http://www.w3.org/2000/svg`,t=document.createElementNS(e,`svg`);for(let[e,n]of Object.entries({viewBox:`0 0 24 24`,width:`20`,height:`20`,fill:`none`,stroke:`currentColor`,"stroke-width":`1.5`,"aria-hidden":`true`}))t.setAttribute(e,n);let n=document.createElementNS(e,`path`);return n.setAttribute(`d`,`M6 7v4a6 6 0 0 0 6 6m6-10v4a6 6 0 0 1-6 6m0 0v3M4 3h4v4H4zm12 0h4v4h-4zM10 20h4v3h-4z`),t.append(n),t}function ug(e,t){document.documentElement.dataset.mcpView=t,e.classList.add(`app`),document.getElementById(`mcp-app-masthead`)?.remove(),e.before($(`header`,{id:`mcp-app-masthead`,class:`mcp-masthead`},$(`span`,{class:`mcp-mark`},lg()),$(`div`,{},$(`span`,{class:`mcp-brand`},`MikroTik `,$(`b`,{},`MCP`)),$(`p`,{class:`mcp-context`},{dashboard:`Device health`,records:`Data explorer`,interfaces:`Interface inventory`,firewall:`Firewall policy`,"firewall-audit":`Security findings`,"connected-devices":`Client inventory`,aaa:`Identity & access`,investigations:`Client investigations`,"round-trip":`Round-trip lab`,"service-health":`Service health`,fabric:`Layer-2 fabric`,operations:`Change operations`,reports:`Evidence reports`}[t]??`Tool workspace`)),$(`span`,{class:`mcp-response-label`},`TOOL RESPONSE`)))}async function dg(e,t,n,r){ug(n,t);let i=!1,a=!1,o,s=()=>{o!==void 0&&clearTimeout(o),o=void 0},c=(e,t,r,i=!1)=>{n.replaceChildren($(`section`,{class:`app-result`,role:i?`alert`:`status`},$(`h2`,{class:`app-result__title`},e),$(`p`,{class:`app-result__message`},t),r?$(`pre`,{class:`app-result__detail`},r):null))};e.ontoolresult=e=>{if(a)return;i=!0,s();let t=(e.content??[]).flatMap(e=>e.type===`text`?[e.text]:[]).join(`
|
|
113
113
|
`).trim();if(e.isError){c(`Tool failed`,`The tool returned an error. No successful result is available.`,t,!0);return}try{if(r(e.structuredContent,e))return;let n=e.structuredContent;t||n?c(`Tool result`,`The response is shown below; it does not use this view's interactive format.`,[t,n?JSON.stringify(n,null,2):``].filter(Boolean).join(`
|
|
114
114
|
|
|
115
|
-
`)):c(`No data returned`,e.content?.some(e=>e.type!==`text`)?`The tool returned non-text content. Open the original tool response in your client.`:`The tool completed without text or structured data.`)}catch{c(`Unable to display result`,`The tool returned an invalid view payload.`,t,!0)}},e.ontoolcancelled=e=>{a||(i=!0,s(),c(`Tool cancelled`,e.reason||`The host cancelled this tool call.`))};let l=e.onteardown;e.onteardown=(e,t)=>(a=!0,s(),l?.(e,t)??{});let u=e.onclose;e.onclose=()=>{!a&&!i&&c(`Host disconnected`,`The connection closed before a tool result arrived.`,void 0,!0),a=!0,s(),u?.()};try{if(await e.connect(void 0,{timeout:
|
|
115
|
+
`)):c(`No data returned`,e.content?.some(e=>e.type!==`text`)?`The tool returned non-text content. Open the original tool response in your client.`:`The tool completed without text or structured data.`)}catch{c(`Unable to display result`,`The tool returned an invalid view payload.`,t,!0)}},e.ontoolcancelled=e=>{a||(i=!0,s(),c(`Tool cancelled`,e.reason||`The host cancelled this tool call.`))};let l=e.onteardown;e.onteardown=(e,t)=>(a=!0,s(),l?.(e,t)??{});let u=e.onclose;e.onclose=()=>{!a&&!i&&c(`Host disconnected`,`The connection closed before a tool result arrived.`,void 0,!0),a=!0,s(),u?.()};try{if(await e.connect(void 0,{timeout:cg}),a)return!1;let n=e.getHostContext?.();return n&&e.onhostcontextchanged?.(n),i||(o=setTimeout(()=>{c(`Still awaiting the tool result`,`The host is connected, but has not delivered a result. Check the original tool response or your client's MCP connection. Do not repeat a configuration-changing call just to refresh this view. Late results will still appear here.`)},15e3)),console.warn(`[${t}] connected`,{host:e.getHostVersion(),caps:e.getHostCapabilities()}),!0}catch(e){return s(),!a&&(a=!0,console.error(`[${t}] connect failed`,e),c(`Cannot connect to the host`,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)}`,void 0,!0),!1)}}var fg=document.getElementById(`app`),pg=null,mg=``,hg=null,gg=1,_g=new Set,vg=null,yg=!1,bg=0,xg=null,Sg={};function Cg(e){let t=[`#`,`flags`].filter(t=>e.columns.includes(t));return[...t,...e.columns.filter(e=>!t.includes(e))]}function wg(e){let t=mg.trim().toLowerCase(),n=e.rows;if(t&&(n=n.filter(e=>Object.values(e).some(e=>e.toLowerCase().includes(t)))),_g.size&&(n=n.filter(e=>{let t=e.flags??``;return[..._g].every(e=>t.includes(e))})),hg){let e=hg;n=[...n].sort((t,n)=>{let r=t[e]??``,i=n[e]??``,a=Number(r),o=Number(i);return(r!==``&&i!==``&&!Number.isNaN(a)&&!Number.isNaN(o)?a-o:r.localeCompare(i))*gg})}return n}function Tg(e){let t=new Set;for(let n of e.rows)for(let e of n.flags??``)t.add(e);return[...t].sort()}function Eg(e){return Object.entries(e).filter(([e])=>e!==`#`&&e!==`flags`).map(([e,t])=>/\s/.test(t)?`${e}="${t}"`:`${e}=${t}`).join(` `)}function Dg(e){let t=Tg(e);return t.length?$(`div`,{class:`toolbar`},...t.map(t=>{let n=e.flags[t]??t,r=_g.has(t);return rg(`${t} · ${n}`,()=>{r?_g.delete(t):_g.add(t),Ig()},{class:r?`is-active`:``,title:`Filter rows flagged "${n}"`})})):!1}function Og(e){let t=$(`th`,e===`#`?{class:`col-num`}:{},e);return hg===e&&t.append($(`span`,{class:`arrow`},gg===1?`▲`:`▼`)),t.addEventListener(`click`,()=>{hg===e?gg=gg===1?-1:1:(hg=e,gg=1),Ig()}),t}function kg(e,t){let n=Cg(e),r=$(`thead`,{},$(`tr`,{},...n.map(Og))),i=$(`tbody`);return t.forEach(t=>{let r=$(`tr`,(t.flags??``).includes(`X`)?{class:`is-disabled`}:{});for(let e of n)r.append($(`td`,e===`#`?{class:`col-num`}:{},t[e]??`—`));r.addEventListener(`click`,()=>{vg=e.rows.indexOf(t),Ig()}),i.append(r)}),$(`div`,{class:`tablewrap`},$(`table`,{class:`tbl`},r,i))}function Ag(e){let t=$(`div`,{class:`kv__body`});for(let[n,r]of Object.entries(e))t.append($(`div`,{class:`kv__k`},n),$(`div`,{class:`kv__v`},r||`—`));return t}function jg(e){if(vg==null||!e.rows[vg])return!1;let t=e.rows[vg],n=t.name??t[`#`]??`record`;return $(`div`,{class:`drawer`},$(`div`,{class:`drawer__hd`},$(`span`,{},`Row `),$(`b`,{},String(n)),$(`span`,{class:`hd__spacer`}),rg(`Copy as CLI`,()=>void ig(Eg(t)),{title:`Copy key=value pairs`}),rg(`Close`,()=>{vg=null,Ig()})),Ag(t))}function Mg(e,t){let n=$(`input`,{class:`search`,type:`search`,placeholder:`Search ${e.count} row${e.count===1?``:`s`}…`,value:mg});n.addEventListener(`input`,()=>{mg=n.value,vg=null,Pg()});let r=$(`select`,{class:`btn`,title:`Auto-refresh interval`});for(let[e,t]of[[`Auto: off`,`0`],[`Auto: 5s`,`5000`],[`Auto: 15s`,`15000`],[`Auto: 60s`,`60000`]]){let n=$(`option`,{value:t},e);Number(t)===bg&&(n.selected=!0),r.append(n)}r.addEventListener(`change`,()=>Bg(Number(r.value)));let i=()=>wg(e),a=Cg(e);return $(`div`,{class:`toolbar`},$(`div`,{class:`grow`},n),rg(yg?`Refreshing…`:`↻ Refresh`,zg,{disabled:yg}),r,rg(`CSV`,()=>ag(`${e.tool}.csv`,og(a,i()),`text/csv`),{title:`Export visible rows as CSV`}),rg(`JSON`,()=>ag(`${e.tool}.json`,JSON.stringify(i(),null,2),`application/json`),{title:`Export visible rows as JSON`}),rg(`Copy`,()=>void ig(JSON.stringify(i(),null,2)),{title:`Copy visible rows as JSON`}),$(`span`,{class:`pill count-pill`},`showing `,$(`b`,{},`${t}/${e.count}`)))}function Ng(e){return $(`header`,{class:`hd`},$(`span`,{class:`hd__dot`}),$(`div`,{},$(`h1`,{class:`hd__title`},e.title),$(`p`,{class:`hd__sub`},e.tool)),$(`span`,{class:`hd__spacer`}))}function Pg(){if(!pg)return;let e=document.getElementById(`results`);if(!e){Ig();return}e.replaceChildren(Fg(pg));let t=document.querySelector(`.count-pill b`);t&&(t.textContent=`${wg(pg).length}/${pg.count}`)}function Fg(e){let r=wg(e);return e.rows.length===0?e.raw?t(e.raw)?n(e.raw):$(`pre`,{class:`raw`},e.raw):$(`div`,{class:`empty`},`No records returned.`):e.kind===`record`&&e.rows.length===1?Ag(e.rows[0]):r.length===0?$(`div`,{class:`empty`},`No rows match the current filter.`):kg(e,r)}function Ig(){if(!pg){fg.replaceChildren($(`div`,{class:`skeleton`},`Waiting for data…`));return}let e=pg,t=wg(e).length,n=e.kind===`list`&&e.rows.length>0,r=[Ng(e),n&&Mg(e,t),n&&Dg(e),$(`div`,{id:`results`},Fg(e)),jg(e),$(`footer`,{class:`foot`},$(`span`,{},`format: ${e.format}`),$(`span`,{class:`grow`}),$(`span`,{},`updated ${new Date(e.generatedAt).toLocaleTimeString()}`))];fg.replaceChildren(...r.filter(Boolean))}var Lg=new ng({name:`mikrotik-records`,version:`1.0.0`});function Rg(e){return e&&typeof e==`object`&&e.__mikrotikView===`records`?(pg=e,vg=null,Ig(),!0):!1}async function zg(){if(!yg&&pg){yg=!0,Ig();try{Rg((await Lg.callServerTool({name:pg.tool,arguments:Sg})).structuredContent)}catch(e){console.error(`[records] refresh failed`,e)}finally{yg=!1,Ig()}}}function Bg(e){bg=e,xg&&=(clearInterval(xg),null),e>0&&(xg=setInterval(()=>void zg(),e)),Ig()}Lg.ontoolinput=e=>{e&&typeof e==`object`&&`arguments`in e&&(Sg=e.arguments??{})},sg(Lg),Lg.onteardown=async()=>(xg&&clearInterval(xg),{}),Ig(),dg(Lg,`records`,fg,Rg);
|
|
116
116
|
</script>
|
|
117
117
|
<style>
|
|
118
118
|
:root{--diff-add-bg:#e6ffec;--diff-del-bg:#ffebe9;--diff-fg:#1f2328;--diff-hunk-bg:#ddf4ff;--diff-hunk-fg:#0969da;--diff-canvas:#fff;--diff-border:#d1d9e0}:root.dark,:root[data-theme=dark]{--diff-add-bg:#2ea04326;--diff-del-bg:#f8514926;--diff-fg:#e6edf3;--diff-hunk-bg:#182638;--diff-hunk-fg:#79c0ff;--diff-canvas:#0d1117;--diff-border:#30363d}.github-diff{box-sizing:border-box;contain:inline-size;overscroll-behavior:contain;border:1px solid var(--diff-border);background:var(--diff-canvas);width:100%;min-width:0;max-width:100%;max-height:500px;color:var(--diff-fg);text-align:left;white-space:pre;tab-size:4;direction:ltr;border-radius:8px;margin:0;font:12px/1.65 ui-monospace,SFMono-Regular,Consolas,monospace;overflow:auto}.github-diff-line{min-width:max-content;min-height:1.65em;padding:0 12px}.github-diff .diff-add{background:var(--diff-add-bg)}.github-diff .diff-del{background:var(--diff-del-bg)}.github-diff .diff-hunk{background:var(--diff-hunk-bg);color:var(--diff-hunk-fg)}.github-diff .diff-file{font-weight:600}.github-diff:focus-visible{outline:2px solid var(--diff-hunk-fg);outline-offset:2px}.app-result{border:1px solid var(--color-border-primary,#8886);background:var(--color-background-secondary,transparent);color:var(--color-text-primary,inherit);border-radius:12px;padding:20px}.app-result__title{margin:0 0 8px;font-size:16px;font-weight:600}.app-result__message{margin:0;font-size:13px;line-height:1.6}.app-result__detail{border:1px solid var(--color-border-primary,#8886);max-height:420px;font:12px/1.6 var(--font-mono,monospace);white-space:pre-wrap;overflow-wrap:anywhere;border-radius:8px;margin:16px 0 0;padding:12px;overflow:auto}html[data-mcp-view]{--lightningcss-light: ;--lightningcss-dark:initial;color-scheme:dark;--mt-bg:var(--color-background-primary,#101c2e);--mt-surface:var(--color-background-secondary,#17263b);--mt-surface-2:var(--color-background-tertiary,#20324a);--mt-border:var(--color-border-primary,#304660);--mt-text:var(--color-text-primary,#dae6f4);--mt-text-dim:var(--color-text-secondary,#a6b9ce);--mt-text-faint:var(--color-text-tertiary,#91a8c1);--mt-accent:var(--color-accent-primary,#9ebfee);--mt-good:#69d6c3;--mt-warn:#e5b56f;--mt-bad:#f18b94;--mt-radius:16px;--mt-radius-sm:10px;--mt-sans:var(--font-sans,"Avenir Next", "Segoe UI", sans-serif);--mt-display:var(--font-sans,"Avenir Next", "Segoe UI", sans-serif);--mt-mono:var(--font-mono,"SFMono-Regular", Consolas, monospace);--bg:var(--mt-bg);--surface:var(--mt-surface);--surface-2:var(--mt-surface-2);--border:var(--mt-border);--text:var(--mt-text);--text-dim:var(--mt-text-dim);--accent:var(--mt-accent);--danger:var(--mt-bad);--ok:var(--mt-good);--rx:var(--mt-good);--tx:var(--mt-accent)}html[data-mcp-view][data-theme=light]{--lightningcss-light:initial;--lightningcss-dark: ;color-scheme:light;--mt-bg:var(--color-background-primary,#f3f6fa);--mt-surface:var(--color-background-secondary,#fff);--mt-surface-2:var(--color-background-tertiary,#e9eff6);--mt-border:var(--color-border-primary,#c8d5e3);--mt-text:var(--color-text-primary,#20334d);--mt-text-dim:var(--color-text-secondary,#4b6480);--mt-text-faint:var(--color-text-tertiary,#5b728c);--mt-accent:var(--color-accent-primary,#325f9c);--mt-good:#157d6b;--mt-warn:#956313;--mt-bad:#b53446}html[data-mcp-view] body{background:var(--mt-bg);color:var(--mt-text);font:13px/1.6 var(--mt-sans);-webkit-font-smoothing:antialiased;margin:0;padding:20px}html[data-mcp-view] :where(*){box-sizing:border-box}html[data-mcp-view] body #app{gap:20px;width:100%;min-width:0;max-width:1120px;margin:0 auto;animation:.22s ease-out both workspace-arrive;display:grid}html[data-mcp-view] body #app>*{min-width:0}.mcp-masthead{border-bottom:1px solid var(--mt-border);align-items:center;gap:12px;width:100%;max-width:1120px;margin:0 auto 22px;padding-bottom:18px;display:flex}.mcp-mark{border:1px solid var(--mt-border);background:var(--mt-surface);width:38px;height:38px;color:var(--mt-accent);border-radius:12px;flex:none;place-items:center;display:grid}.mcp-brand{letter-spacing:-.02em;font-size:13px;font-weight:650}.mcp-brand b{color:var(--mt-accent)}.mcp-context{color:var(--mt-text-dim);margin:0;font-size:11px}.mcp-response-label{font:9px var(--mt-mono);letter-spacing:.12em;color:var(--mt-text-faint);margin-left:auto}body #app :where(.hd,.aaa-titlebar){border:1px solid var(--mt-border);border-radius:var(--mt-radius);background-color:var(--mt-surface);background-image:radial-gradient(color-mix(in srgb, var(--mt-border) 60%, transparent) .7px, transparent .7px);overflow-wrap:anywhere;background-size:16px 16px;flex-wrap:wrap;align-items:center;gap:16px;padding:22px;display:flex;position:relative}body #app :where(.hd__title,.aaa-title,.toolbar .title){font:650 clamp(19px, 3.8vw, 25px)/1.25 var(--mt-display);letter-spacing:-.035em;margin:0}body #app .hd__sub{color:var(--mt-text-dim);font:11px/1.7 var(--mt-mono);margin:6px 0 0}body #app .hd__dot{background:var(--mt-accent);box-shadow:0 0 0 6px color-mix(in srgb, var(--mt-accent) 10%, transparent)}body #app :where(.grid,.if-grid,.aaa-form-grid){grid-template-columns:repeat(auto-fit,minmax(min(100%,230px),1fr));gap:16px;display:grid}body #app :where(.card,.aaa-card,.aaa-form,.f-card){border:1px solid var(--mt-border);border-radius:var(--mt-radius);background:var(--mt-surface);min-width:0;margin:0;padding:20px}body #app .card__label{color:var(--mt-text-dim);font:11px/1.5 var(--mt-sans);letter-spacing:.03em;text-transform:none;margin:0 0 10px}body #app .card__value{font:550 27px/1.3 var(--mt-mono);letter-spacing:-.04em;overflow-wrap:anywhere}body #app .card__value small{font-size:12px}body #app :where(.toolbar,.aaa-bar){border:1px solid var(--mt-border);border-radius:var(--mt-radius);background:var(--mt-surface);flex-wrap:wrap;align-items:center;gap:10px;margin:0;padding:12px;display:flex}body #app .toolbar .grow{flex:200px;min-width:min(100%,200px)}body #app :where(.btn,.aaa-tab){border:1px solid var(--mt-border);background:var(--mt-surface-2);min-height:34px;color:var(--mt-text);font:500 12px/1.4 var(--mt-sans);cursor:pointer;border-radius:10px;justify-content:center;align-items:center;gap:7px;margin:0;padding:7px 12px;transition:background .14s,border-color .14s,transform .14s;display:inline-flex}body #app :where(.btn,.aaa-tab):hover:not(:disabled){border-color:var(--mt-accent);background:color-mix(in srgb, var(--mt-accent) 14%, var(--mt-surface));transform:translateY(-1px)}body #app :where(.btn,.aaa-tab):active:not(:disabled){transform:translateY(0)}body #app :where(.btn,.aaa-tab):disabled{opacity:.5;cursor:not-allowed}body #app :where(.btn.is-active,.btn.primary,.aaa-tab.is-active){border-color:color-mix(in srgb, var(--mt-accent) 70%, var(--mt-border));color:var(--mt-accent);background:color-mix(in srgb, var(--mt-accent) 12%, var(--mt-surface))}body #app :where(.btn-danger,.btn.danger){color:var(--mt-bad);border-color:color-mix(in srgb, var(--mt-bad) 50%, var(--mt-border));background:color-mix(in srgb, var(--mt-bad) 8%, var(--mt-surface))}body #app .btn.ok{color:var(--mt-good)}body #app :where(.search,.aaa-input){border:1px solid var(--mt-border);background:var(--mt-bg);width:100%;min-width:0;min-height:36px;color:var(--mt-text);font:12px/1.5 var(--mt-sans);border-radius:10px;padding:8px 12px}body #app :where(button,input,select,textarea,summary,[tabindex]):focus-visible{outline:2px solid var(--mt-accent);outline-offset:3px}body #app :where(.pill,.chip,.badge,.aaa-badge,.act){font:10px/1.4 var(--mt-mono);overflow-wrap:anywhere;border-radius:7px;max-width:100%;padding:4px 9px}body #app :where(.tablewrap,.table,.aaa-table){border:1px solid var(--mt-border);border-radius:var(--mt-radius);background:var(--mt-surface);width:100%;min-width:0;padding:0;overflow:auto}body #app :where(table.tbl th,table.tbl td){border-bottom:1px solid color-mix(in srgb, var(--mt-border) 65%, transparent);padding:12px 16px;font-size:11px;line-height:1.6}body #app table.tbl thead th{background:var(--mt-surface-2);font:600 11px var(--mt-sans);height:42px}body #app table.tbl tbody tr:nth-child(2n){background:color-mix(in srgb, var(--mt-surface-2) 30%, transparent)}body #app table.tbl tbody tr:hover{background:color-mix(in srgb, var(--mt-accent) 12%, var(--mt-surface))}body #app :where(.kv__body,details.kv){background:var(--mt-surface);border:1px solid var(--mt-border);border-radius:var(--mt-radius);overflow:hidden}body #app .kv__body{grid-template-columns:minmax(100px,.45fr) minmax(0,1fr)}body #app .kv__body>div{padding:12px 16px;font-size:11px;line-height:1.6}body #app details.kv .kv__body{border:0;border-top:1px solid var(--mt-border);border-radius:0}body #app details.kv>summary{padding:16px 20px;font-size:12px}body #app :where(.foot,.totals){color:var(--mt-text-faint);border-top:1px solid var(--mt-border);gap:12px;padding:12px 0;font-size:10px}body #app :where(.skeleton,.empty,.loading,.aaa-notice){border:1px dashed var(--mt-border);border-radius:var(--mt-radius);color:var(--mt-text-dim);background:var(--mt-surface);text-align:center;padding:36px 24px;font-size:12px}body #app pre.raw{white-space:pre-wrap;overflow-wrap:anywhere;padding:20px;font-size:11px;line-height:1.85}body #app .drawer{gap:16px;padding:20px}body #app .drawer__hd{flex-wrap:wrap}body #app .if-card{border-top:3px solid var(--mt-border);gap:20px}body #app .if-card:has(.dot.is-up){border-top-color:var(--mt-good)}body #app .if-card__top{flex-wrap:wrap;gap:10px}body #app .if-card__name{font-size:15px}body #app .if-card__meta{grid-template-columns:minmax(45px,.3fr) minmax(0,1fr);gap:8px 14px}body #app .f-list{grid-template-columns:repeat(auto-fit,minmax(min(100%,340px),1fr));gap:16px;margin:0;display:grid}body #app .f-card{border-top-width:3px}body #app .f-card.is-bad{border-top-color:var(--mt-bad)}body #app .f-card.is-warn{border-top-color:var(--mt-warn)}body #app .f-body{margin-top:14px}body #app .f-detail{font-size:12px;line-height:1.7}body #app .f-fix{margin-top:10px;font-size:11px}body #app .f-actions{margin-top:18px}body #app .aaa-wrap{gap:18px;min-width:0;padding:0;display:grid}body #app .aaa-tabs{border:1px solid var(--mt-border);border-radius:var(--mt-radius);background:var(--mt-surface);gap:8px;margin:0;padding:8px}body #app .aaa-tab{font-size:11px}body #app .aaa-row{min-width:max(100%, calc(var(--cols) * 105px + 190px));border-bottom:1px solid var(--mt-border);border-radius:0;gap:12px;padding:12px 16px;font-size:11px}body #app .aaa-head{background:var(--mt-surface-2)}body #app .aaa-actions,body #app .aaa-field{gap:8px}body #app .aaa-form-title{margin-bottom:16px;font-size:14px}body #app .aaa-settings{gap:16px}body #app .aaa-error{margin:0;padding:16px}body #app .row{border-bottom:1px solid var(--mt-border);border-radius:0;grid-template-columns:105px minmax(150px,1.4fr) 145px 85px 100px 165px;gap:14px;min-width:840px;padding:13px 16px;font-size:11px}body #app .row.header{background:var(--mt-surface-2);font:600 10px var(--mt-sans)}body #app .detail{border:1px solid var(--mt-border);border-radius:var(--mt-radius);background:var(--mt-surface);padding:22px}body #app .detail-title{margin-bottom:6px;font-size:19px}body #app .detail-sub{margin-bottom:22px}body #app .rates{font:15px var(--mt-mono);flex-wrap:wrap;gap:24px;margin:0 0 18px}body #app .traffic-chart{background-image:radial-gradient(var(--mt-border) .75px, transparent .75px);background-size:16px 16px;max-width:none;height:200px}body #app .app-result{border-color:var(--mt-border);background:var(--mt-surface);color:var(--mt-text);padding:26px}body #app .app-result[role=alert]{border-top:3px solid var(--mt-bad)}body #app .app-result__title{font-family:var(--mt-display);letter-spacing:-.025em;font-size:20px}body #app .app-result__message{color:var(--mt-text-dim);font-size:12px}body #app .app-result__detail{background:var(--mt-bg);border-color:var(--mt-border);font:11px/1.8 var(--mt-mono)}@keyframes workspace-arrive{0%{opacity:0;transform:translateY(5px)}to{opacity:1;transform:translateY(0)}}@media (width<=520px){html[data-mcp-view] body{padding:12px}html[data-mcp-view] body #app{gap:16px}.mcp-masthead{gap:10px;margin-bottom:16px}.mcp-response-label{letter-spacing:.04em;font-size:8px}body #app :where(.hd,.aaa-titlebar,.card,.f-card,.aaa-card,.aaa-form){padding:16px}body #app .kv__body{grid-template-columns:minmax(80px,.4fr) minmax(0,1fr)}body #app .kv__body>div{padding:10px 12px}body #app .if-grid{grid-template-columns:minmax(0,1fr)}}@media (prefers-reduced-motion:reduce){html[data-mcp-view] body #app,body #app *,body #app :before,body #app :after{scroll-behavior:auto!important;transition:none!important;animation:none!important}}: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}.count-pill b{color:var(--mt-accent)}table.tbl td.col-num,table.tbl th.col-num{width:1%}
|