@modelcontextprotocol/server-basic-vanillajs 1.2.2 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/mcp-app.html +6 -6
- package/dist/server.js +64 -60
- package/package.json +1 -1
package/dist/mcp-app.html
CHANGED
|
@@ -5,9 +5,9 @@
|
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
6
6
|
<meta name="color-scheme" content="light dark">
|
|
7
7
|
<title>Get Time App</title>
|
|
8
|
-
<script type="module" crossorigin>var ho=Object.defineProperty;var fo=(e,t,n)=>t in e?ho(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var H=(e,t,n)=>fo(e,typeof t!="symbol"?t+"":t,n);(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const r of document.querySelectorAll('link[rel="modulepreload"]'))o(r);new MutationObserver(r=>{for(const s of r)if(s.type==="childList")for(const i of s.addedNodes)i.tagName==="LINK"&&i.rel==="modulepreload"&&o(i)}).observe(document,{childList:!0,subtree:!0});function n(r){const s={};return r.integrity&&(s.integrity=r.integrity),r.referrerPolicy&&(s.referrerPolicy=r.referrerPolicy),r.crossOrigin==="use-credentials"?s.credentials="include":r.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function o(r){if(r.ep)return;r.ep=!0;const s=n(r);fetch(r.href,s)}})();function f(e,t,n){function o(a,c){if(a._zod||Object.defineProperty(a,"_zod",{value:{def:c,constr:i,traits:new Set},enumerable:!1}),a._zod.traits.has(e))return;a._zod.traits.add(e),t(a,c);const d=i.prototype,h=Object.keys(d);for(let m=0;m<h.length;m++){const g=h[m];g in a||(a[g]=d[g].bind(a))}}const r=(n==null?void 0:n.Parent)??Object;class s extends r{}Object.defineProperty(s,"name",{value:e});function i(a){var c;const d=n!=null&&n.Parent?new s:this;o(d,a),(c=d._zod).deferred??(c.deferred=[]);for(const h of d._zod.deferred)h();return d}return Object.defineProperty(i,"init",{value:o}),Object.defineProperty(i,Symbol.hasInstance,{value:a=>{var c,d;return n!=null&&n.Parent&&a instanceof n.Parent?!0:(d=(c=a==null?void 0:a._zod)==null?void 0:c.traits)==null?void 0:d.has(e)}}),Object.defineProperty(i,"name",{value:e}),i}class fe extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class sn extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}}const an={};function se(e){return an}function cn(e){const t=Object.values(e).filter(o=>typeof o=="number");return Object.entries(e).filter(([o,r])=>t.indexOf(+o)===-1).map(([o,r])=>r)}function Ye(e,t){return typeof t=="bigint"?t.toString():t}function Le(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function rt(e){return e==null}function st(e){const t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}function mo(e,t){const n=(e.toString().split(".")[1]||"").length,o=t.toString();let r=(o.split(".")[1]||"").length;if(r===0&&/\d?e-\d?/.test(o)){const c=o.match(/\d?e-(\d?)/);c!=null&&c[1]&&(r=Number.parseInt(c[1]))}const s=n>r?n:r,i=Number.parseInt(e.toFixed(s).replace(".","")),a=Number.parseInt(t.toFixed(s).replace(".",""));return i%a/10**s}const xt=Symbol("evaluating");function T(e,t,n){let o;Object.defineProperty(e,t,{get(){if(o!==xt)return o===void 0&&(o=xt,o=n()),o},set(r){Object.defineProperty(e,t,{value:r})},configurable:!0})}function de(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function ae(...e){const t={};for(const n of e){const o=Object.getOwnPropertyDescriptors(n);Object.assign(t,o)}return Object.defineProperties({},t)}function Ct(e){return JSON.stringify(e)}function go(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const un="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function ke(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const _o=Le(()=>{var e;if(typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)!=null&&e.includes("Cloudflare")))return!1;try{const t=Function;return new t(""),!0}catch{return!1}});function me(e){if(ke(e)===!1)return!1;const t=e.constructor;if(t===void 0||typeof t!="function")return!0;const n=t.prototype;return!(ke(n)===!1||Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")===!1)}function ln(e){return me(e)?{...e}:Array.isArray(e)?[...e]:e}const vo=new Set(["string","number","symbol"]);function ge(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function ce(e,t,n){const o=new e._zod.constr(t??e._zod.def);return(!t||n!=null&&n.parent)&&(o._zod.parent=e),o}function v(e){const t=e;if(!t)return{};if(typeof t=="string")return{error:()=>t};if((t==null?void 0:t.message)!==void 0){if((t==null?void 0:t.error)!==void 0)throw new 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 bo(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}const yo={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function ko(e,t){const n=e._zod.def,o=n.checks;if(o&&o.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");const s=ae(e._zod.def,{get shape(){const i={};for(const a in t){if(!(a in n.shape))throw new Error(`Unrecognized key: "${a}"`);t[a]&&(i[a]=n.shape[a])}return de(this,"shape",i),i},checks:[]});return ce(e,s)}function wo(e,t){const n=e._zod.def,o=n.checks;if(o&&o.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");const s=ae(e._zod.def,{get shape(){const i={...e._zod.def.shape};for(const a in t){if(!(a in n.shape))throw new Error(`Unrecognized key: "${a}"`);t[a]&&delete i[a]}return de(this,"shape",i),i},checks:[]});return ce(e,s)}function So(e,t){if(!me(t))throw new Error("Invalid input to extend: expected a plain object");const n=e._zod.def.checks;if(n&&n.length>0){const s=e._zod.def.shape;for(const i in t)if(Object.getOwnPropertyDescriptor(s,i)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}const r=ae(e._zod.def,{get shape(){const s={...e._zod.def.shape,...t};return de(this,"shape",s),s}});return ce(e,r)}function zo(e,t){if(!me(t))throw new Error("Invalid input to safeExtend: expected a plain object");const n=ae(e._zod.def,{get shape(){const o={...e._zod.def.shape,...t};return de(this,"shape",o),o}});return ce(e,n)}function To(e,t){const n=ae(e._zod.def,{get shape(){const o={...e._zod.def.shape,...t._zod.def.shape};return de(this,"shape",o),o},get catchall(){return t._zod.def.catchall},checks:[]});return ce(e,n)}function $o(e,t,n){const r=t._zod.def.checks;if(r&&r.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");const i=ae(t._zod.def,{get shape(){const a=t._zod.def.shape,c={...a};if(n)for(const d in n){if(!(d in a))throw new Error(`Unrecognized key: "${d}"`);n[d]&&(c[d]=e?new e({type:"optional",innerType:a[d]}):a[d])}else for(const d in a)c[d]=e?new e({type:"optional",innerType:a[d]}):a[d];return de(this,"shape",c),c},checks:[]});return ce(t,i)}function Io(e,t,n){const o=ae(t._zod.def,{get shape(){const r=t._zod.def.shape,s={...r};if(n)for(const i in n){if(!(i in s))throw new Error(`Unrecognized key: "${i}"`);n[i]&&(s[i]=new e({type:"nonoptional",innerType:r[i]}))}else for(const i in r)s[i]=new e({type:"nonoptional",innerType:r[i]});return de(this,"shape",s),s}});return ce(t,o)}function pe(e,t=0){var n;if(e.aborted===!0)return!0;for(let o=t;o<e.issues.length;o++)if(((n=e.issues[o])==null?void 0:n.continue)!==!0)return!0;return!1}function he(e,t){return t.map(n=>{var o;return(o=n).path??(o.path=[]),n.path.unshift(e),n})}function Oe(e){return typeof e=="string"?e:e==null?void 0:e.message}function ie(e,t,n){var r,s,i,a,c,d;const o={...e,path:e.path??[]};if(!e.message){const h=Oe((i=(s=(r=e.inst)==null?void 0:r._zod.def)==null?void 0:s.error)==null?void 0:i.call(s,e))??Oe((a=t==null?void 0:t.error)==null?void 0:a.call(t,e))??Oe((c=n.customError)==null?void 0:c.call(n,e))??Oe((d=n.localeError)==null?void 0:d.call(n,e))??"Invalid input";o.message=h}return delete o.inst,delete o.continue,t!=null&&t.reportInput||delete o.input,o}function it(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function we(...e){const[t,n,o]=e;return typeof t=="string"?{message:t,code:"custom",input:n,inst:o}:{...t}}const dn=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,Ye,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},pn=f("$ZodError",dn),hn=f("$ZodError",dn,{Parent:Error});function Ro(e,t=n=>n.message){const n={},o=[];for(const r of e.issues)r.path.length>0?(n[r.path[0]]=n[r.path[0]]||[],n[r.path[0]].push(t(r))):o.push(t(r));return{formErrors:o,fieldErrors:n}}function Po(e,t=n=>n.message){const n={_errors:[]},o=r=>{for(const s of r.issues)if(s.code==="invalid_union"&&s.errors.length)s.errors.map(i=>o({issues:i}));else if(s.code==="invalid_key")o({issues:s.issues});else if(s.code==="invalid_element")o({issues:s.issues});else if(s.path.length===0)n._errors.push(t(s));else{let i=n,a=0;for(;a<s.path.length;){const c=s.path[a];a===s.path.length-1?(i[c]=i[c]||{_errors:[]},i[c]._errors.push(t(s))):i[c]=i[c]||{_errors:[]},i=i[c],a++}}};return o(e),n}const at=e=>(t,n,o,r)=>{const s=o?Object.assign(o,{async:!1}):{async:!1},i=t._zod.run({value:n,issues:[]},s);if(i instanceof Promise)throw new fe;if(i.issues.length){const a=new((r==null?void 0:r.Err)??e)(i.issues.map(c=>ie(c,s,se())));throw un(a,r==null?void 0:r.callee),a}return i.value},ct=e=>async(t,n,o,r)=>{const s=o?Object.assign(o,{async:!0}):{async:!0};let i=t._zod.run({value:n,issues:[]},s);if(i instanceof Promise&&(i=await i),i.issues.length){const a=new((r==null?void 0:r.Err)??e)(i.issues.map(c=>ie(c,s,se())));throw un(a,r==null?void 0:r.callee),a}return i.value},He=e=>(t,n,o)=>{const r=o?{...o,async:!1}:{async:!1},s=t._zod.run({value:n,issues:[]},r);if(s instanceof Promise)throw new fe;return s.issues.length?{success:!1,error:new(e??pn)(s.issues.map(i=>ie(i,r,se())))}:{success:!0,data:s.value}},fn=He(hn),Fe=e=>async(t,n,o)=>{const r=o?Object.assign(o,{async:!0}):{async:!0};let s=t._zod.run({value:n,issues:[]},r);return s instanceof Promise&&(s=await s),s.issues.length?{success:!1,error:new e(s.issues.map(i=>ie(i,r,se())))}:{success:!0,data:s.value}},Eo=Fe(hn),Zo=e=>(t,n,o)=>{const r=o?Object.assign(o,{direction:"backward"}):{direction:"backward"};return at(e)(t,n,r)},Oo=e=>(t,n,o)=>at(e)(t,n,o),xo=e=>async(t,n,o)=>{const r=o?Object.assign(o,{direction:"backward"}):{direction:"backward"};return ct(e)(t,n,r)},Co=e=>async(t,n,o)=>ct(e)(t,n,o),No=e=>(t,n,o)=>{const r=o?Object.assign(o,{direction:"backward"}):{direction:"backward"};return He(e)(t,n,r)},Ao=e=>(t,n,o)=>He(e)(t,n,o),qo=e=>async(t,n,o)=>{const r=o?Object.assign(o,{direction:"backward"}):{direction:"backward"};return Fe(e)(t,n,r)},Mo=e=>async(t,n,o)=>Fe(e)(t,n,o),jo=/^[cC][^\s-]{8,}$/,Do=/^[0-9a-z]+$/,Uo=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Lo=/^[0-9a-vA-V]{20}$/,Ho=/^[A-Za-z0-9]{27}$/,Fo=/^[a-zA-Z0-9_-]{21}$/,Jo=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Vo=/^([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})$/,Nt=e=>e?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([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)$/,Bo=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,Wo="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function Ko(){return new RegExp(Wo,"u")}const Go=/^(?:(?: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])$/,Qo=/^(([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}|:))$/,Yo=/^((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])$/,Xo=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,er=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,mn=/^[A-Za-z0-9_-]*$/,tr=/^\+[1-9]\d{6,14}$/,gn="(?:(?:\\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])))",nr=new RegExp(`^${gn}$`);function _n(e){const 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}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function or(e){return new RegExp(`^${_n(e)}$`)}function rr(e){const t=_n({precision:e.precision}),n=["Z"];e.local&&n.push(""),e.offset&&n.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");const o=`${t}(?:${n.join("|")})`;return new RegExp(`^${gn}T(?:${o})$`)}const sr=e=>{const t=e?`[\\s\\S]{${(e==null?void 0:e.minimum)??0},${(e==null?void 0:e.maximum)??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},ir=/^-?\d+$/,vn=/^-?\d+(?:\.\d+)?$/,ar=/^(?:true|false)$/i,cr=/^null$/i,ur=/^undefined$/i,lr=/^[^A-Z]*$/,dr=/^[^a-z]*$/,B=f("$ZodCheck",(e,t)=>{var n;e._zod??(e._zod={}),e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),bn={number:"number",bigint:"bigint",object:"date"},yn=f("$ZodCheckLessThan",(e,t)=>{B.init(e,t);const n=bn[typeof t.value];e._zod.onattach.push(o=>{const r=o._zod.bag,s=(t.inclusive?r.maximum:r.exclusiveMaximum)??Number.POSITIVE_INFINITY;t.value<s&&(t.inclusive?r.maximum=t.value:r.exclusiveMaximum=t.value)}),e._zod.check=o=>{(t.inclusive?o.value<=t.value:o.value<t.value)||o.issues.push({origin:n,code:"too_big",maximum:typeof t.value=="object"?t.value.getTime():t.value,input:o.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),kn=f("$ZodCheckGreaterThan",(e,t)=>{B.init(e,t);const n=bn[typeof t.value];e._zod.onattach.push(o=>{const r=o._zod.bag,s=(t.inclusive?r.minimum:r.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>s&&(t.inclusive?r.minimum=t.value:r.exclusiveMinimum=t.value)}),e._zod.check=o=>{(t.inclusive?o.value>=t.value:o.value>t.value)||o.issues.push({origin:n,code:"too_small",minimum:typeof t.value=="object"?t.value.getTime():t.value,input:o.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),pr=f("$ZodCheckMultipleOf",(e,t)=>{B.init(e,t),e._zod.onattach.push(n=>{var o;(o=n._zod.bag).multipleOf??(o.multipleOf=t.value)}),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof n.value=="bigint"?n.value%t.value===BigInt(0):mo(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})}}),hr=f("$ZodCheckNumberFormat",(e,t)=>{var i;B.init(e,t),t.format=t.format||"float64";const n=(i=t.format)==null?void 0:i.includes("int"),o=n?"int":"number",[r,s]=yo[t.format];e._zod.onattach.push(a=>{const c=a._zod.bag;c.format=t.format,c.minimum=r,c.maximum=s,n&&(c.pattern=ir)}),e._zod.check=a=>{const c=a.value;if(n){if(!Number.isInteger(c)){a.issues.push({expected:o,format:t.format,code:"invalid_type",continue:!1,input:c,inst:e});return}if(!Number.isSafeInteger(c)){c>0?a.issues.push({input:c,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:o,inclusive:!0,continue:!t.abort}):a.issues.push({input:c,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:o,inclusive:!0,continue:!t.abort});return}}c<r&&a.issues.push({origin:"number",input:c,code:"too_small",minimum:r,inclusive:!0,inst:e,continue:!t.abort}),c>s&&a.issues.push({origin:"number",input:c,code:"too_big",maximum:s,inclusive:!0,inst:e,continue:!t.abort})}}),fr=f("$ZodCheckMaxLength",(e,t)=>{var n;B.init(e,t),(n=e._zod.def).when??(n.when=o=>{const r=o.value;return!rt(r)&&r.length!==void 0}),e._zod.onattach.push(o=>{const r=o._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<r&&(o._zod.bag.maximum=t.maximum)}),e._zod.check=o=>{const r=o.value;if(r.length<=t.maximum)return;const i=it(r);o.issues.push({origin:i,code:"too_big",maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),mr=f("$ZodCheckMinLength",(e,t)=>{var n;B.init(e,t),(n=e._zod.def).when??(n.when=o=>{const r=o.value;return!rt(r)&&r.length!==void 0}),e._zod.onattach.push(o=>{const r=o._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>r&&(o._zod.bag.minimum=t.minimum)}),e._zod.check=o=>{const r=o.value;if(r.length>=t.minimum)return;const i=it(r);o.issues.push({origin:i,code:"too_small",minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),gr=f("$ZodCheckLengthEquals",(e,t)=>{var n;B.init(e,t),(n=e._zod.def).when??(n.when=o=>{const r=o.value;return!rt(r)&&r.length!==void 0}),e._zod.onattach.push(o=>{const r=o._zod.bag;r.minimum=t.length,r.maximum=t.length,r.length=t.length}),e._zod.check=o=>{const r=o.value,s=r.length;if(s===t.length)return;const i=it(r),a=s>t.length;o.issues.push({origin:i,...a?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:o.value,inst:e,continue:!t.abort})}}),Je=f("$ZodCheckStringFormat",(e,t)=>{var n,o;B.init(e,t),e._zod.onattach.push(r=>{const s=r._zod.bag;s.format=t.format,t.pattern&&(s.patterns??(s.patterns=new Set),s.patterns.add(t.pattern))}),t.pattern?(n=e._zod).check??(n.check=r=>{t.pattern.lastIndex=0,!t.pattern.test(r.value)&&r.issues.push({origin:"string",code:"invalid_format",format:t.format,input:r.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(o=e._zod).check??(o.check=()=>{})}),_r=f("$ZodCheckRegex",(e,t)=>{Je.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})}}),vr=f("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=lr),Je.init(e,t)}),br=f("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=dr),Je.init(e,t)}),yr=f("$ZodCheckIncludes",(e,t)=>{B.init(e,t);const n=ge(t.includes),o=new RegExp(typeof t.position=="number"?`^.{${t.position}}${n}`:n);t.pattern=o,e._zod.onattach.push(r=>{const s=r._zod.bag;s.patterns??(s.patterns=new Set),s.patterns.add(o)}),e._zod.check=r=>{r.value.includes(t.includes,t.position)||r.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:r.value,inst:e,continue:!t.abort})}}),kr=f("$ZodCheckStartsWith",(e,t)=>{B.init(e,t);const n=new RegExp(`^${ge(t.prefix)}.*`);t.pattern??(t.pattern=n),e._zod.onattach.push(o=>{const r=o._zod.bag;r.patterns??(r.patterns=new Set),r.patterns.add(n)}),e._zod.check=o=>{o.value.startsWith(t.prefix)||o.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:o.value,inst:e,continue:!t.abort})}}),wr=f("$ZodCheckEndsWith",(e,t)=>{B.init(e,t);const n=new RegExp(`.*${ge(t.suffix)}$`);t.pattern??(t.pattern=n),e._zod.onattach.push(o=>{const r=o._zod.bag;r.patterns??(r.patterns=new Set),r.patterns.add(n)}),e._zod.check=o=>{o.value.endsWith(t.suffix)||o.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:o.value,inst:e,continue:!t.abort})}}),Sr=f("$ZodCheckOverwrite",(e,t)=>{B.init(e,t),e._zod.check=n=>{n.value=t.tx(n.value)}});class zr{constructor(t=[]){this.content=[],this.indent=0,this&&(this.args=t)}indented(t){this.indent+=1,t(this),this.indent-=1}write(t){if(typeof t=="function"){t(this,{execution:"sync"}),t(this,{execution:"async"});return}const o=t.split(`
|
|
8
|
+
<script type="module" crossorigin>var ho=Object.defineProperty;var fo=(e,t,n)=>t in e?ho(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var H=(e,t,n)=>fo(e,typeof t!="symbol"?t+"":t,n);(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const r of document.querySelectorAll('link[rel="modulepreload"]'))o(r);new MutationObserver(r=>{for(const s of r)if(s.type==="childList")for(const i of s.addedNodes)i.tagName==="LINK"&&i.rel==="modulepreload"&&o(i)}).observe(document,{childList:!0,subtree:!0});function n(r){const s={};return r.integrity&&(s.integrity=r.integrity),r.referrerPolicy&&(s.referrerPolicy=r.referrerPolicy),r.crossOrigin==="use-credentials"?s.credentials="include":r.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function o(r){if(r.ep)return;r.ep=!0;const s=n(r);fetch(r.href,s)}})();function f(e,t,n){function o(a,c){if(a._zod||Object.defineProperty(a,"_zod",{value:{def:c,constr:i,traits:new Set},enumerable:!1}),a._zod.traits.has(e))return;a._zod.traits.add(e),t(a,c);const d=i.prototype,h=Object.keys(d);for(let m=0;m<h.length;m++){const g=h[m];g in a||(a[g]=d[g].bind(a))}}const r=(n==null?void 0:n.Parent)??Object;class s extends r{}Object.defineProperty(s,"name",{value:e});function i(a){var c;const d=n!=null&&n.Parent?new s:this;o(d,a),(c=d._zod).deferred??(c.deferred=[]);for(const h of d._zod.deferred)h();return d}return Object.defineProperty(i,"init",{value:o}),Object.defineProperty(i,Symbol.hasInstance,{value:a=>{var c,d;return n!=null&&n.Parent&&a instanceof n.Parent?!0:(d=(c=a==null?void 0:a._zod)==null?void 0:c.traits)==null?void 0:d.has(e)}}),Object.defineProperty(i,"name",{value:e}),i}class fe extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class sn extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}}const an={};function se(e){return an}function cn(e){const t=Object.values(e).filter(o=>typeof o=="number");return Object.entries(e).filter(([o,r])=>t.indexOf(+o)===-1).map(([o,r])=>r)}function Ye(e,t){return typeof t=="bigint"?t.toString():t}function Le(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function rt(e){return e==null}function st(e){const t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}function mo(e,t){const n=(e.toString().split(".")[1]||"").length,o=t.toString();let r=(o.split(".")[1]||"").length;if(r===0&&/\d?e-\d?/.test(o)){const c=o.match(/\d?e-(\d?)/);c!=null&&c[1]&&(r=Number.parseInt(c[1]))}const s=n>r?n:r,i=Number.parseInt(e.toFixed(s).replace(".","")),a=Number.parseInt(t.toFixed(s).replace(".",""));return i%a/10**s}const xt=Symbol("evaluating");function T(e,t,n){let o;Object.defineProperty(e,t,{get(){if(o!==xt)return o===void 0&&(o=xt,o=n()),o},set(r){Object.defineProperty(e,t,{value:r})},configurable:!0})}function de(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function ae(...e){const t={};for(const n of e){const o=Object.getOwnPropertyDescriptors(n);Object.assign(t,o)}return Object.defineProperties({},t)}function Ct(e){return JSON.stringify(e)}function go(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const un="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function ke(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const _o=Le(()=>{var e;if(typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)!=null&&e.includes("Cloudflare")))return!1;try{const t=Function;return new t(""),!0}catch{return!1}});function me(e){if(ke(e)===!1)return!1;const t=e.constructor;if(t===void 0||typeof t!="function")return!0;const n=t.prototype;return!(ke(n)===!1||Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")===!1)}function ln(e){return me(e)?{...e}:Array.isArray(e)?[...e]:e}const vo=new Set(["string","number","symbol"]);function ge(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function ce(e,t,n){const o=new e._zod.constr(t??e._zod.def);return(!t||n!=null&&n.parent)&&(o._zod.parent=e),o}function v(e){const t=e;if(!t)return{};if(typeof t=="string")return{error:()=>t};if((t==null?void 0:t.message)!==void 0){if((t==null?void 0:t.error)!==void 0)throw new 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 bo(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}const yo={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function ko(e,t){const n=e._zod.def,o=n.checks;if(o&&o.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");const s=ae(e._zod.def,{get shape(){const i={};for(const a in t){if(!(a in n.shape))throw new Error(`Unrecognized key: "${a}"`);t[a]&&(i[a]=n.shape[a])}return de(this,"shape",i),i},checks:[]});return ce(e,s)}function wo(e,t){const n=e._zod.def,o=n.checks;if(o&&o.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");const s=ae(e._zod.def,{get shape(){const i={...e._zod.def.shape};for(const a in t){if(!(a in n.shape))throw new Error(`Unrecognized key: "${a}"`);t[a]&&delete i[a]}return de(this,"shape",i),i},checks:[]});return ce(e,s)}function So(e,t){if(!me(t))throw new Error("Invalid input to extend: expected a plain object");const n=e._zod.def.checks;if(n&&n.length>0){const s=e._zod.def.shape;for(const i in t)if(Object.getOwnPropertyDescriptor(s,i)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}const r=ae(e._zod.def,{get shape(){const s={...e._zod.def.shape,...t};return de(this,"shape",s),s}});return ce(e,r)}function zo(e,t){if(!me(t))throw new Error("Invalid input to safeExtend: expected a plain object");const n=ae(e._zod.def,{get shape(){const o={...e._zod.def.shape,...t};return de(this,"shape",o),o}});return ce(e,n)}function To(e,t){const n=ae(e._zod.def,{get shape(){const o={...e._zod.def.shape,...t._zod.def.shape};return de(this,"shape",o),o},get catchall(){return t._zod.def.catchall},checks:[]});return ce(e,n)}function $o(e,t,n){const r=t._zod.def.checks;if(r&&r.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");const i=ae(t._zod.def,{get shape(){const a=t._zod.def.shape,c={...a};if(n)for(const d in n){if(!(d in a))throw new Error(`Unrecognized key: "${d}"`);n[d]&&(c[d]=e?new e({type:"optional",innerType:a[d]}):a[d])}else for(const d in a)c[d]=e?new e({type:"optional",innerType:a[d]}):a[d];return de(this,"shape",c),c},checks:[]});return ce(t,i)}function Ro(e,t,n){const o=ae(t._zod.def,{get shape(){const r=t._zod.def.shape,s={...r};if(n)for(const i in n){if(!(i in s))throw new Error(`Unrecognized key: "${i}"`);n[i]&&(s[i]=new e({type:"nonoptional",innerType:r[i]}))}else for(const i in r)s[i]=new e({type:"nonoptional",innerType:r[i]});return de(this,"shape",s),s}});return ce(t,o)}function pe(e,t=0){var n;if(e.aborted===!0)return!0;for(let o=t;o<e.issues.length;o++)if(((n=e.issues[o])==null?void 0:n.continue)!==!0)return!0;return!1}function he(e,t){return t.map(n=>{var o;return(o=n).path??(o.path=[]),n.path.unshift(e),n})}function Oe(e){return typeof e=="string"?e:e==null?void 0:e.message}function ie(e,t,n){var r,s,i,a,c,d;const o={...e,path:e.path??[]};if(!e.message){const h=Oe((i=(s=(r=e.inst)==null?void 0:r._zod.def)==null?void 0:s.error)==null?void 0:i.call(s,e))??Oe((a=t==null?void 0:t.error)==null?void 0:a.call(t,e))??Oe((c=n.customError)==null?void 0:c.call(n,e))??Oe((d=n.localeError)==null?void 0:d.call(n,e))??"Invalid input";o.message=h}return delete o.inst,delete o.continue,t!=null&&t.reportInput||delete o.input,o}function it(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function we(...e){const[t,n,o]=e;return typeof t=="string"?{message:t,code:"custom",input:n,inst:o}:{...t}}const dn=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,Ye,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},pn=f("$ZodError",dn),hn=f("$ZodError",dn,{Parent:Error});function Io(e,t=n=>n.message){const n={},o=[];for(const r of e.issues)r.path.length>0?(n[r.path[0]]=n[r.path[0]]||[],n[r.path[0]].push(t(r))):o.push(t(r));return{formErrors:o,fieldErrors:n}}function Po(e,t=n=>n.message){const n={_errors:[]},o=r=>{for(const s of r.issues)if(s.code==="invalid_union"&&s.errors.length)s.errors.map(i=>o({issues:i}));else if(s.code==="invalid_key")o({issues:s.issues});else if(s.code==="invalid_element")o({issues:s.issues});else if(s.path.length===0)n._errors.push(t(s));else{let i=n,a=0;for(;a<s.path.length;){const c=s.path[a];a===s.path.length-1?(i[c]=i[c]||{_errors:[]},i[c]._errors.push(t(s))):i[c]=i[c]||{_errors:[]},i=i[c],a++}}};return o(e),n}const at=e=>(t,n,o,r)=>{const s=o?Object.assign(o,{async:!1}):{async:!1},i=t._zod.run({value:n,issues:[]},s);if(i instanceof Promise)throw new fe;if(i.issues.length){const a=new((r==null?void 0:r.Err)??e)(i.issues.map(c=>ie(c,s,se())));throw un(a,r==null?void 0:r.callee),a}return i.value},ct=e=>async(t,n,o,r)=>{const s=o?Object.assign(o,{async:!0}):{async:!0};let i=t._zod.run({value:n,issues:[]},s);if(i instanceof Promise&&(i=await i),i.issues.length){const a=new((r==null?void 0:r.Err)??e)(i.issues.map(c=>ie(c,s,se())));throw un(a,r==null?void 0:r.callee),a}return i.value},He=e=>(t,n,o)=>{const r=o?{...o,async:!1}:{async:!1},s=t._zod.run({value:n,issues:[]},r);if(s instanceof Promise)throw new fe;return s.issues.length?{success:!1,error:new(e??pn)(s.issues.map(i=>ie(i,r,se())))}:{success:!0,data:s.value}},fn=He(hn),Fe=e=>async(t,n,o)=>{const r=o?Object.assign(o,{async:!0}):{async:!0};let s=t._zod.run({value:n,issues:[]},r);return s instanceof Promise&&(s=await s),s.issues.length?{success:!1,error:new e(s.issues.map(i=>ie(i,r,se())))}:{success:!0,data:s.value}},Eo=Fe(hn),Zo=e=>(t,n,o)=>{const r=o?Object.assign(o,{direction:"backward"}):{direction:"backward"};return at(e)(t,n,r)},Oo=e=>(t,n,o)=>at(e)(t,n,o),xo=e=>async(t,n,o)=>{const r=o?Object.assign(o,{direction:"backward"}):{direction:"backward"};return ct(e)(t,n,r)},Co=e=>async(t,n,o)=>ct(e)(t,n,o),No=e=>(t,n,o)=>{const r=o?Object.assign(o,{direction:"backward"}):{direction:"backward"};return He(e)(t,n,r)},qo=e=>(t,n,o)=>He(e)(t,n,o),Ao=e=>async(t,n,o)=>{const r=o?Object.assign(o,{direction:"backward"}):{direction:"backward"};return Fe(e)(t,n,r)},Mo=e=>async(t,n,o)=>Fe(e)(t,n,o),jo=/^[cC][^\s-]{8,}$/,Do=/^[0-9a-z]+$/,Uo=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Lo=/^[0-9a-vA-V]{20}$/,Ho=/^[A-Za-z0-9]{27}$/,Fo=/^[a-zA-Z0-9_-]{21}$/,Jo=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Vo=/^([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})$/,Nt=e=>e?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([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)$/,Bo=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,Wo="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function Ko(){return new RegExp(Wo,"u")}const Go=/^(?:(?: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])$/,Qo=/^(([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}|:))$/,Yo=/^((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])$/,Xo=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,er=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,mn=/^[A-Za-z0-9_-]*$/,tr=/^\+[1-9]\d{6,14}$/,gn="(?:(?:\\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])))",nr=new RegExp(`^${gn}$`);function _n(e){const 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}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function or(e){return new RegExp(`^${_n(e)}$`)}function rr(e){const t=_n({precision:e.precision}),n=["Z"];e.local&&n.push(""),e.offset&&n.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");const o=`${t}(?:${n.join("|")})`;return new RegExp(`^${gn}T(?:${o})$`)}const sr=e=>{const t=e?`[\\s\\S]{${(e==null?void 0:e.minimum)??0},${(e==null?void 0:e.maximum)??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},ir=/^-?\d+$/,vn=/^-?\d+(?:\.\d+)?$/,ar=/^(?:true|false)$/i,cr=/^null$/i,ur=/^undefined$/i,lr=/^[^A-Z]*$/,dr=/^[^a-z]*$/,B=f("$ZodCheck",(e,t)=>{var n;e._zod??(e._zod={}),e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),bn={number:"number",bigint:"bigint",object:"date"},yn=f("$ZodCheckLessThan",(e,t)=>{B.init(e,t);const n=bn[typeof t.value];e._zod.onattach.push(o=>{const r=o._zod.bag,s=(t.inclusive?r.maximum:r.exclusiveMaximum)??Number.POSITIVE_INFINITY;t.value<s&&(t.inclusive?r.maximum=t.value:r.exclusiveMaximum=t.value)}),e._zod.check=o=>{(t.inclusive?o.value<=t.value:o.value<t.value)||o.issues.push({origin:n,code:"too_big",maximum:typeof t.value=="object"?t.value.getTime():t.value,input:o.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),kn=f("$ZodCheckGreaterThan",(e,t)=>{B.init(e,t);const n=bn[typeof t.value];e._zod.onattach.push(o=>{const r=o._zod.bag,s=(t.inclusive?r.minimum:r.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>s&&(t.inclusive?r.minimum=t.value:r.exclusiveMinimum=t.value)}),e._zod.check=o=>{(t.inclusive?o.value>=t.value:o.value>t.value)||o.issues.push({origin:n,code:"too_small",minimum:typeof t.value=="object"?t.value.getTime():t.value,input:o.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),pr=f("$ZodCheckMultipleOf",(e,t)=>{B.init(e,t),e._zod.onattach.push(n=>{var o;(o=n._zod.bag).multipleOf??(o.multipleOf=t.value)}),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof n.value=="bigint"?n.value%t.value===BigInt(0):mo(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})}}),hr=f("$ZodCheckNumberFormat",(e,t)=>{var i;B.init(e,t),t.format=t.format||"float64";const n=(i=t.format)==null?void 0:i.includes("int"),o=n?"int":"number",[r,s]=yo[t.format];e._zod.onattach.push(a=>{const c=a._zod.bag;c.format=t.format,c.minimum=r,c.maximum=s,n&&(c.pattern=ir)}),e._zod.check=a=>{const c=a.value;if(n){if(!Number.isInteger(c)){a.issues.push({expected:o,format:t.format,code:"invalid_type",continue:!1,input:c,inst:e});return}if(!Number.isSafeInteger(c)){c>0?a.issues.push({input:c,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:o,inclusive:!0,continue:!t.abort}):a.issues.push({input:c,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:o,inclusive:!0,continue:!t.abort});return}}c<r&&a.issues.push({origin:"number",input:c,code:"too_small",minimum:r,inclusive:!0,inst:e,continue:!t.abort}),c>s&&a.issues.push({origin:"number",input:c,code:"too_big",maximum:s,inclusive:!0,inst:e,continue:!t.abort})}}),fr=f("$ZodCheckMaxLength",(e,t)=>{var n;B.init(e,t),(n=e._zod.def).when??(n.when=o=>{const r=o.value;return!rt(r)&&r.length!==void 0}),e._zod.onattach.push(o=>{const r=o._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<r&&(o._zod.bag.maximum=t.maximum)}),e._zod.check=o=>{const r=o.value;if(r.length<=t.maximum)return;const i=it(r);o.issues.push({origin:i,code:"too_big",maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),mr=f("$ZodCheckMinLength",(e,t)=>{var n;B.init(e,t),(n=e._zod.def).when??(n.when=o=>{const r=o.value;return!rt(r)&&r.length!==void 0}),e._zod.onattach.push(o=>{const r=o._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>r&&(o._zod.bag.minimum=t.minimum)}),e._zod.check=o=>{const r=o.value;if(r.length>=t.minimum)return;const i=it(r);o.issues.push({origin:i,code:"too_small",minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),gr=f("$ZodCheckLengthEquals",(e,t)=>{var n;B.init(e,t),(n=e._zod.def).when??(n.when=o=>{const r=o.value;return!rt(r)&&r.length!==void 0}),e._zod.onattach.push(o=>{const r=o._zod.bag;r.minimum=t.length,r.maximum=t.length,r.length=t.length}),e._zod.check=o=>{const r=o.value,s=r.length;if(s===t.length)return;const i=it(r),a=s>t.length;o.issues.push({origin:i,...a?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:o.value,inst:e,continue:!t.abort})}}),Je=f("$ZodCheckStringFormat",(e,t)=>{var n,o;B.init(e,t),e._zod.onattach.push(r=>{const s=r._zod.bag;s.format=t.format,t.pattern&&(s.patterns??(s.patterns=new Set),s.patterns.add(t.pattern))}),t.pattern?(n=e._zod).check??(n.check=r=>{t.pattern.lastIndex=0,!t.pattern.test(r.value)&&r.issues.push({origin:"string",code:"invalid_format",format:t.format,input:r.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(o=e._zod).check??(o.check=()=>{})}),_r=f("$ZodCheckRegex",(e,t)=>{Je.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})}}),vr=f("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=lr),Je.init(e,t)}),br=f("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=dr),Je.init(e,t)}),yr=f("$ZodCheckIncludes",(e,t)=>{B.init(e,t);const n=ge(t.includes),o=new RegExp(typeof t.position=="number"?`^.{${t.position}}${n}`:n);t.pattern=o,e._zod.onattach.push(r=>{const s=r._zod.bag;s.patterns??(s.patterns=new Set),s.patterns.add(o)}),e._zod.check=r=>{r.value.includes(t.includes,t.position)||r.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:r.value,inst:e,continue:!t.abort})}}),kr=f("$ZodCheckStartsWith",(e,t)=>{B.init(e,t);const n=new RegExp(`^${ge(t.prefix)}.*`);t.pattern??(t.pattern=n),e._zod.onattach.push(o=>{const r=o._zod.bag;r.patterns??(r.patterns=new Set),r.patterns.add(n)}),e._zod.check=o=>{o.value.startsWith(t.prefix)||o.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:o.value,inst:e,continue:!t.abort})}}),wr=f("$ZodCheckEndsWith",(e,t)=>{B.init(e,t);const n=new RegExp(`.*${ge(t.suffix)}$`);t.pattern??(t.pattern=n),e._zod.onattach.push(o=>{const r=o._zod.bag;r.patterns??(r.patterns=new Set),r.patterns.add(n)}),e._zod.check=o=>{o.value.endsWith(t.suffix)||o.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:o.value,inst:e,continue:!t.abort})}}),Sr=f("$ZodCheckOverwrite",(e,t)=>{B.init(e,t),e._zod.check=n=>{n.value=t.tx(n.value)}});class zr{constructor(t=[]){this.content=[],this.indent=0,this&&(this.args=t)}indented(t){this.indent+=1,t(this),this.indent-=1}write(t){if(typeof t=="function"){t(this,{execution:"sync"}),t(this,{execution:"async"});return}const o=t.split(`
|
|
9
9
|
`).filter(i=>i),r=Math.min(...o.map(i=>i.length-i.trimStart().length)),s=o.map(i=>i.slice(r)).map(i=>" ".repeat(this.indent*2)+i);for(const i of s)this.content.push(i)}compile(){const t=Function,n=this==null?void 0:this.args,r=[...((this==null?void 0:this.content)??[""]).map(s=>` ${s}`)];return new t(...n,r.join(`
|
|
10
|
-
`))}}const Tr={major:4,minor:3,patch:5},E=f("$ZodType",(e,t)=>{var r;var n;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Tr;const o=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&o.unshift(e);for(const s of o)for(const i of s._zod.onattach)i(e);if(o.length===0)(n=e._zod).deferred??(n.deferred=[]),(r=e._zod.deferred)==null||r.push(()=>{e._zod.run=e._zod.parse});else{const s=(a,c,d)=>{let h=pe(a),m;for(const g of c){if(g._zod.def.when){if(!g._zod.def.when(a))continue}else if(h)continue;const _=a.issues.length,b=g._zod.check(a);if(b instanceof Promise&&(d==null?void 0:d.async)===!1)throw new fe;if(m||b instanceof Promise)m=(m??Promise.resolve()).then(async()=>{await b,a.issues.length!==_&&(h||(h=pe(a,_)))});else{if(a.issues.length===_)continue;h||(h=pe(a,_))}}return m?m.then(()=>a):a},i=(a,c,d)=>{if(pe(a))return a.aborted=!0,a;const h=s(c,o,d);if(h instanceof Promise){if(d.async===!1)throw new fe;return h.then(m=>e._zod.parse(m,d))}return e._zod.parse(h,d)};e._zod.run=(a,c)=>{if(c.skipChecks)return e._zod.parse(a,c);if(c.direction==="backward"){const h=e._zod.parse({value:a.value,issues:[]},{...c,skipChecks:!0});return h instanceof Promise?h.then(m=>i(m,a,c)):i(h,a,c)}const d=e._zod.parse(a,c);if(d instanceof Promise){if(c.async===!1)throw new fe;return d.then(h=>s(h,o,c))}return s(d,o,c)}}T(e,"~standard",()=>({validate:s=>{var i;try{const a=fn(e,s);return a.success?{value:a.data}:{issues:(i=a.error)==null?void 0:i.issues}}catch{return Eo(e,s).then(c=>{var d;return c.success?{value:c.data}:{issues:(d=c.error)==null?void 0:d.issues}})}},vendor:"zod",version:1}))}),ut=f("$ZodString",(e,t)=>{var n;E.init(e,t),e._zod.pattern=[...((n=e==null?void 0:e._zod.bag)==null?void 0:n.patterns)??[]].pop()??sr(e._zod.bag),e._zod.parse=(o,r)=>{if(t.coerce)try{o.value=String(o.value)}catch{}return typeof o.value=="string"||o.issues.push({expected:"string",code:"invalid_type",input:o.value,inst:e}),o}}),O=f("$ZodStringFormat",(e,t)=>{Je.init(e,t),ut.init(e,t)}),$r=f("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=Vo),O.init(e,t)}),Ir=f("$ZodUUID",(e,t)=>{if(t.version){const o={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(o===void 0)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=Nt(o))}else t.pattern??(t.pattern=Nt());O.init(e,t)}),Rr=f("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=Bo),O.init(e,t)}),Pr=f("$ZodURL",(e,t)=>{O.init(e,t),e._zod.check=n=>{try{const o=n.value.trim(),r=new URL(o);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(r.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&&(t.protocol.lastIndex=0,t.protocol.test(r.protocol.endsWith(":")?r.protocol.slice(0,-1):r.protocol)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort})),t.normalize?n.value=r.href:n.value=o;return}catch{n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:e,continue:!t.abort})}}}),Er=f("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=Ko()),O.init(e,t)}),Zr=f("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=Fo),O.init(e,t)}),Or=f("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=jo),O.init(e,t)}),xr=f("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=Do),O.init(e,t)}),Cr=f("$ZodULID",(e,t)=>{t.pattern??(t.pattern=Uo),O.init(e,t)}),Nr=f("$ZodXID",(e,t)=>{t.pattern??(t.pattern=Lo),O.init(e,t)}),Ar=f("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=Ho),O.init(e,t)}),qr=f("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=rr(t)),O.init(e,t)}),Mr=f("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=nr),O.init(e,t)}),jr=f("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=or(t)),O.init(e,t)}),Dr=f("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=Jo),O.init(e,t)}),Ur=f("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=Go),O.init(e,t),e._zod.bag.format="ipv4"}),Lr=f("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=Qo),O.init(e,t),e._zod.bag.format="ipv6",e._zod.check=n=>{try{new URL(`http://[${n.value}]`)}catch{n.issues.push({code:"invalid_format",format:"ipv6",input:n.value,inst:e,continue:!t.abort})}}}),Hr=f("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=Yo),O.init(e,t)}),Fr=f("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=Xo),O.init(e,t),e._zod.check=n=>{const o=n.value.split("/");try{if(o.length!==2)throw new Error;const[r,s]=o;if(!s)throw new Error;const i=Number(s);if(`${i}`!==s)throw new Error;if(i<0||i>128)throw new Error;new URL(`http://[${r}]`)}catch{n.issues.push({code:"invalid_format",format:"cidrv6",input:n.value,inst:e,continue:!t.abort})}}});function wn(e){if(e==="")return!0;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}const Jr=f("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=er),O.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=n=>{wn(n.value)||n.issues.push({code:"invalid_format",format:"base64",input:n.value,inst:e,continue:!t.abort})}});function Vr(e){if(!mn.test(e))return!1;const t=e.replace(/[-_]/g,o=>o==="-"?"+":"/"),n=t.padEnd(Math.ceil(t.length/4)*4,"=");return wn(n)}const Br=f("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=mn),O.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=n=>{Vr(n.value)||n.issues.push({code:"invalid_format",format:"base64url",input:n.value,inst:e,continue:!t.abort})}}),Wr=f("$ZodE164",(e,t)=>{t.pattern??(t.pattern=tr),O.init(e,t)});function Kr(e,t=null){try{const n=e.split(".");if(n.length!==3)return!1;const[o]=n;if(!o)return!1;const r=JSON.parse(atob(o));return!("typ"in r&&(r==null?void 0:r.typ)!=="JWT"||!r.alg||t&&(!("alg"in r)||r.alg!==t))}catch{return!1}}const Gr=f("$ZodJWT",(e,t)=>{O.init(e,t),e._zod.check=n=>{Kr(n.value,t.alg)||n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:e,continue:!t.abort})}}),Sn=f("$ZodNumber",(e,t)=>{E.init(e,t),e._zod.pattern=e._zod.bag.pattern??vn,e._zod.parse=(n,o)=>{if(t.coerce)try{n.value=Number(n.value)}catch{}const r=n.value;if(typeof r=="number"&&!Number.isNaN(r)&&Number.isFinite(r))return n;const s=typeof r=="number"?Number.isNaN(r)?"NaN":Number.isFinite(r)?void 0:"Infinity":void 0;return n.issues.push({expected:"number",code:"invalid_type",input:r,inst:e,...s?{received:s}:{}}),n}}),Qr=f("$ZodNumberFormat",(e,t)=>{hr.init(e,t),Sn.init(e,t)}),Yr=f("$ZodBoolean",(e,t)=>{E.init(e,t),e._zod.pattern=ar,e._zod.parse=(n,o)=>{if(t.coerce)try{n.value=!!n.value}catch{}const r=n.value;return typeof r=="boolean"||n.issues.push({expected:"boolean",code:"invalid_type",input:r,inst:e}),n}}),Xr=f("$ZodUndefined",(e,t)=>{E.init(e,t),e._zod.pattern=ur,e._zod.values=new Set([void 0]),e._zod.optin="optional",e._zod.optout="optional",e._zod.parse=(n,o)=>{const r=n.value;return typeof r>"u"||n.issues.push({expected:"undefined",code:"invalid_type",input:r,inst:e}),n}}),es=f("$ZodNull",(e,t)=>{E.init(e,t),e._zod.pattern=cr,e._zod.values=new Set([null]),e._zod.parse=(n,o)=>{const r=n.value;return r===null||n.issues.push({expected:"null",code:"invalid_type",input:r,inst:e}),n}}),ts=f("$ZodUnknown",(e,t)=>{E.init(e,t),e._zod.parse=n=>n}),ns=f("$ZodNever",(e,t)=>{E.init(e,t),e._zod.parse=(n,o)=>(n.issues.push({expected:"never",code:"invalid_type",input:n.value,inst:e}),n)});function At(e,t,n){e.issues.length&&t.issues.push(...he(n,e.issues)),t.value[n]=e.value}const os=f("$ZodArray",(e,t)=>{E.init(e,t),e._zod.parse=(n,o)=>{const r=n.value;if(!Array.isArray(r))return n.issues.push({expected:"array",code:"invalid_type",input:r,inst:e}),n;n.value=Array(r.length);const s=[];for(let i=0;i<r.length;i++){const a=r[i],c=t.element._zod.run({value:a,issues:[]},o);c instanceof Promise?s.push(c.then(d=>At(d,n,i))):At(c,n,i)}return s.length?Promise.all(s).then(()=>n):n}});function qe(e,t,n,o,r){if(e.issues.length){if(r&&!(n in o))return;t.issues.push(...he(n,e.issues))}e.value===void 0?n in o&&(t.value[n]=void 0):t.value[n]=e.value}function zn(e){var o,r,s,i;const t=Object.keys(e.shape);for(const a of t)if(!((i=(s=(r=(o=e.shape)==null?void 0:o[a])==null?void 0:r._zod)==null?void 0:s.traits)!=null&&i.has("$ZodType")))throw new Error(`Invalid element at key "${a}": expected a Zod schema`);const n=bo(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)}}function Tn(e,t,n,o,r,s){const i=[],a=r.keySet,c=r.catchall._zod,d=c.def.type,h=c.optout==="optional";for(const m in t){if(a.has(m))continue;if(d==="never"){i.push(m);continue}const g=c.run({value:t[m],issues:[]},o);g instanceof Promise?e.push(g.then(_=>qe(_,n,m,t,h))):qe(g,n,m,t,h)}return i.length&&n.issues.push({code:"unrecognized_keys",keys:i,input:t,inst:s}),e.length?Promise.all(e).then(()=>n):n}const rs=f("$ZodObject",(e,t)=>{E.init(e,t);const n=Object.getOwnPropertyDescriptor(t,"shape");if(!(n!=null&&n.get)){const a=t.shape;Object.defineProperty(t,"shape",{get:()=>{const c={...a};return Object.defineProperty(t,"shape",{value:c}),c}})}const o=Le(()=>zn(t));T(e._zod,"propValues",()=>{const a=t.shape,c={};for(const d in a){const h=a[d]._zod;if(h.values){c[d]??(c[d]=new Set);for(const m of h.values)c[d].add(m)}}return c});const r=ke,s=t.catchall;let i;e._zod.parse=(a,c)=>{i??(i=o.value);const d=a.value;if(!r(d))return a.issues.push({expected:"object",code:"invalid_type",input:d,inst:e}),a;a.value={};const h=[],m=i.shape;for(const g of i.keys){const _=m[g],b=_._zod.optout==="optional",y=_._zod.run({value:d[g],issues:[]},c);y instanceof Promise?h.push(y.then(x=>qe(x,a,g,d,b))):qe(y,a,g,d,b)}return s?Tn(h,d,a,c,o.value,e):h.length?Promise.all(h).then(()=>a):a}}),ss=f("$ZodObjectJIT",(e,t)=>{rs.init(e,t);const n=e._zod.parse,o=Le(()=>zn(t)),r=g=>{var oe;const _=new zr(["shape","payload","ctx"]),b=o.value,y=K=>{const j=Ct(K);return`shape[${j}]._zod.run({ value: input[${j}], issues: [] }, ctx)`};_.write("const input = payload.value;");const x=Object.create(null);let W=0;for(const K of b.keys)x[K]=`key_${W++}`;_.write("const newResult = {};");for(const K of b.keys){const j=x[K],J=Ct(K),N=g[K],re=((oe=N==null?void 0:N._zod)==null?void 0:oe.optout)==="optional";_.write(`const ${j} = ${y(K)};`),re?_.write(`
|
|
10
|
+
`))}}const Tr={major:4,minor:3,patch:5},E=f("$ZodType",(e,t)=>{var r;var n;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Tr;const o=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&o.unshift(e);for(const s of o)for(const i of s._zod.onattach)i(e);if(o.length===0)(n=e._zod).deferred??(n.deferred=[]),(r=e._zod.deferred)==null||r.push(()=>{e._zod.run=e._zod.parse});else{const s=(a,c,d)=>{let h=pe(a),m;for(const g of c){if(g._zod.def.when){if(!g._zod.def.when(a))continue}else if(h)continue;const _=a.issues.length,b=g._zod.check(a);if(b instanceof Promise&&(d==null?void 0:d.async)===!1)throw new fe;if(m||b instanceof Promise)m=(m??Promise.resolve()).then(async()=>{await b,a.issues.length!==_&&(h||(h=pe(a,_)))});else{if(a.issues.length===_)continue;h||(h=pe(a,_))}}return m?m.then(()=>a):a},i=(a,c,d)=>{if(pe(a))return a.aborted=!0,a;const h=s(c,o,d);if(h instanceof Promise){if(d.async===!1)throw new fe;return h.then(m=>e._zod.parse(m,d))}return e._zod.parse(h,d)};e._zod.run=(a,c)=>{if(c.skipChecks)return e._zod.parse(a,c);if(c.direction==="backward"){const h=e._zod.parse({value:a.value,issues:[]},{...c,skipChecks:!0});return h instanceof Promise?h.then(m=>i(m,a,c)):i(h,a,c)}const d=e._zod.parse(a,c);if(d instanceof Promise){if(c.async===!1)throw new fe;return d.then(h=>s(h,o,c))}return s(d,o,c)}}T(e,"~standard",()=>({validate:s=>{var i;try{const a=fn(e,s);return a.success?{value:a.data}:{issues:(i=a.error)==null?void 0:i.issues}}catch{return Eo(e,s).then(c=>{var d;return c.success?{value:c.data}:{issues:(d=c.error)==null?void 0:d.issues}})}},vendor:"zod",version:1}))}),ut=f("$ZodString",(e,t)=>{var n;E.init(e,t),e._zod.pattern=[...((n=e==null?void 0:e._zod.bag)==null?void 0:n.patterns)??[]].pop()??sr(e._zod.bag),e._zod.parse=(o,r)=>{if(t.coerce)try{o.value=String(o.value)}catch{}return typeof o.value=="string"||o.issues.push({expected:"string",code:"invalid_type",input:o.value,inst:e}),o}}),O=f("$ZodStringFormat",(e,t)=>{Je.init(e,t),ut.init(e,t)}),$r=f("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=Vo),O.init(e,t)}),Rr=f("$ZodUUID",(e,t)=>{if(t.version){const o={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(o===void 0)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=Nt(o))}else t.pattern??(t.pattern=Nt());O.init(e,t)}),Ir=f("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=Bo),O.init(e,t)}),Pr=f("$ZodURL",(e,t)=>{O.init(e,t),e._zod.check=n=>{try{const o=n.value.trim(),r=new URL(o);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(r.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&&(t.protocol.lastIndex=0,t.protocol.test(r.protocol.endsWith(":")?r.protocol.slice(0,-1):r.protocol)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort})),t.normalize?n.value=r.href:n.value=o;return}catch{n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:e,continue:!t.abort})}}}),Er=f("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=Ko()),O.init(e,t)}),Zr=f("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=Fo),O.init(e,t)}),Or=f("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=jo),O.init(e,t)}),xr=f("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=Do),O.init(e,t)}),Cr=f("$ZodULID",(e,t)=>{t.pattern??(t.pattern=Uo),O.init(e,t)}),Nr=f("$ZodXID",(e,t)=>{t.pattern??(t.pattern=Lo),O.init(e,t)}),qr=f("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=Ho),O.init(e,t)}),Ar=f("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=rr(t)),O.init(e,t)}),Mr=f("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=nr),O.init(e,t)}),jr=f("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=or(t)),O.init(e,t)}),Dr=f("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=Jo),O.init(e,t)}),Ur=f("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=Go),O.init(e,t),e._zod.bag.format="ipv4"}),Lr=f("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=Qo),O.init(e,t),e._zod.bag.format="ipv6",e._zod.check=n=>{try{new URL(`http://[${n.value}]`)}catch{n.issues.push({code:"invalid_format",format:"ipv6",input:n.value,inst:e,continue:!t.abort})}}}),Hr=f("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=Yo),O.init(e,t)}),Fr=f("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=Xo),O.init(e,t),e._zod.check=n=>{const o=n.value.split("/");try{if(o.length!==2)throw new Error;const[r,s]=o;if(!s)throw new Error;const i=Number(s);if(`${i}`!==s)throw new Error;if(i<0||i>128)throw new Error;new URL(`http://[${r}]`)}catch{n.issues.push({code:"invalid_format",format:"cidrv6",input:n.value,inst:e,continue:!t.abort})}}});function wn(e){if(e==="")return!0;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}const Jr=f("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=er),O.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=n=>{wn(n.value)||n.issues.push({code:"invalid_format",format:"base64",input:n.value,inst:e,continue:!t.abort})}});function Vr(e){if(!mn.test(e))return!1;const t=e.replace(/[-_]/g,o=>o==="-"?"+":"/"),n=t.padEnd(Math.ceil(t.length/4)*4,"=");return wn(n)}const Br=f("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=mn),O.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=n=>{Vr(n.value)||n.issues.push({code:"invalid_format",format:"base64url",input:n.value,inst:e,continue:!t.abort})}}),Wr=f("$ZodE164",(e,t)=>{t.pattern??(t.pattern=tr),O.init(e,t)});function Kr(e,t=null){try{const n=e.split(".");if(n.length!==3)return!1;const[o]=n;if(!o)return!1;const r=JSON.parse(atob(o));return!("typ"in r&&(r==null?void 0:r.typ)!=="JWT"||!r.alg||t&&(!("alg"in r)||r.alg!==t))}catch{return!1}}const Gr=f("$ZodJWT",(e,t)=>{O.init(e,t),e._zod.check=n=>{Kr(n.value,t.alg)||n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:e,continue:!t.abort})}}),Sn=f("$ZodNumber",(e,t)=>{E.init(e,t),e._zod.pattern=e._zod.bag.pattern??vn,e._zod.parse=(n,o)=>{if(t.coerce)try{n.value=Number(n.value)}catch{}const r=n.value;if(typeof r=="number"&&!Number.isNaN(r)&&Number.isFinite(r))return n;const s=typeof r=="number"?Number.isNaN(r)?"NaN":Number.isFinite(r)?void 0:"Infinity":void 0;return n.issues.push({expected:"number",code:"invalid_type",input:r,inst:e,...s?{received:s}:{}}),n}}),Qr=f("$ZodNumberFormat",(e,t)=>{hr.init(e,t),Sn.init(e,t)}),Yr=f("$ZodBoolean",(e,t)=>{E.init(e,t),e._zod.pattern=ar,e._zod.parse=(n,o)=>{if(t.coerce)try{n.value=!!n.value}catch{}const r=n.value;return typeof r=="boolean"||n.issues.push({expected:"boolean",code:"invalid_type",input:r,inst:e}),n}}),Xr=f("$ZodUndefined",(e,t)=>{E.init(e,t),e._zod.pattern=ur,e._zod.values=new Set([void 0]),e._zod.optin="optional",e._zod.optout="optional",e._zod.parse=(n,o)=>{const r=n.value;return typeof r>"u"||n.issues.push({expected:"undefined",code:"invalid_type",input:r,inst:e}),n}}),es=f("$ZodNull",(e,t)=>{E.init(e,t),e._zod.pattern=cr,e._zod.values=new Set([null]),e._zod.parse=(n,o)=>{const r=n.value;return r===null||n.issues.push({expected:"null",code:"invalid_type",input:r,inst:e}),n}}),ts=f("$ZodUnknown",(e,t)=>{E.init(e,t),e._zod.parse=n=>n}),ns=f("$ZodNever",(e,t)=>{E.init(e,t),e._zod.parse=(n,o)=>(n.issues.push({expected:"never",code:"invalid_type",input:n.value,inst:e}),n)});function qt(e,t,n){e.issues.length&&t.issues.push(...he(n,e.issues)),t.value[n]=e.value}const os=f("$ZodArray",(e,t)=>{E.init(e,t),e._zod.parse=(n,o)=>{const r=n.value;if(!Array.isArray(r))return n.issues.push({expected:"array",code:"invalid_type",input:r,inst:e}),n;n.value=Array(r.length);const s=[];for(let i=0;i<r.length;i++){const a=r[i],c=t.element._zod.run({value:a,issues:[]},o);c instanceof Promise?s.push(c.then(d=>qt(d,n,i))):qt(c,n,i)}return s.length?Promise.all(s).then(()=>n):n}});function Ae(e,t,n,o,r){if(e.issues.length){if(r&&!(n in o))return;t.issues.push(...he(n,e.issues))}e.value===void 0?n in o&&(t.value[n]=void 0):t.value[n]=e.value}function zn(e){var o,r,s,i;const t=Object.keys(e.shape);for(const a of t)if(!((i=(s=(r=(o=e.shape)==null?void 0:o[a])==null?void 0:r._zod)==null?void 0:s.traits)!=null&&i.has("$ZodType")))throw new Error(`Invalid element at key "${a}": expected a Zod schema`);const n=bo(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)}}function Tn(e,t,n,o,r,s){const i=[],a=r.keySet,c=r.catchall._zod,d=c.def.type,h=c.optout==="optional";for(const m in t){if(a.has(m))continue;if(d==="never"){i.push(m);continue}const g=c.run({value:t[m],issues:[]},o);g instanceof Promise?e.push(g.then(_=>Ae(_,n,m,t,h))):Ae(g,n,m,t,h)}return i.length&&n.issues.push({code:"unrecognized_keys",keys:i,input:t,inst:s}),e.length?Promise.all(e).then(()=>n):n}const rs=f("$ZodObject",(e,t)=>{E.init(e,t);const n=Object.getOwnPropertyDescriptor(t,"shape");if(!(n!=null&&n.get)){const a=t.shape;Object.defineProperty(t,"shape",{get:()=>{const c={...a};return Object.defineProperty(t,"shape",{value:c}),c}})}const o=Le(()=>zn(t));T(e._zod,"propValues",()=>{const a=t.shape,c={};for(const d in a){const h=a[d]._zod;if(h.values){c[d]??(c[d]=new Set);for(const m of h.values)c[d].add(m)}}return c});const r=ke,s=t.catchall;let i;e._zod.parse=(a,c)=>{i??(i=o.value);const d=a.value;if(!r(d))return a.issues.push({expected:"object",code:"invalid_type",input:d,inst:e}),a;a.value={};const h=[],m=i.shape;for(const g of i.keys){const _=m[g],b=_._zod.optout==="optional",y=_._zod.run({value:d[g],issues:[]},c);y instanceof Promise?h.push(y.then(x=>Ae(x,a,g,d,b))):Ae(y,a,g,d,b)}return s?Tn(h,d,a,c,o.value,e):h.length?Promise.all(h).then(()=>a):a}}),ss=f("$ZodObjectJIT",(e,t)=>{rs.init(e,t);const n=e._zod.parse,o=Le(()=>zn(t)),r=g=>{var oe;const _=new zr(["shape","payload","ctx"]),b=o.value,y=K=>{const j=Ct(K);return`shape[${j}]._zod.run({ value: input[${j}], issues: [] }, ctx)`};_.write("const input = payload.value;");const x=Object.create(null);let W=0;for(const K of b.keys)x[K]=`key_${W++}`;_.write("const newResult = {};");for(const K of b.keys){const j=x[K],J=Ct(K),N=g[K],re=((oe=N==null?void 0:N._zod)==null?void 0:oe.optout)==="optional";_.write(`const ${j} = ${y(K)};`),re?_.write(`
|
|
11
11
|
if (${j}.issues.length) {
|
|
12
12
|
if (${J} in input) {
|
|
13
13
|
payload.issues = payload.issues.concat(${j}.issues.map(iss => ({
|
|
@@ -41,9 +41,9 @@
|
|
|
41
41
|
newResult[${J}] = ${j}.value;
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
-
`)}_.write("payload.value = newResult;"),_.write("return payload;");const C=_.compile();return(K,j)=>C(g,K,j)};let s;const i=ke,a=!an.jitless,d=a&&_o.value,h=t.catchall;let m;e._zod.parse=(g,_)=>{m??(m=o.value);const b=g.value;return i(b)?a&&d&&(_==null?void 0:_.async)===!1&&_.jitless!==!0?(s||(s=r(t.shape)),g=s(g,_),h?Tn([],b,g,_,m,e):g):n(g,_):(g.issues.push({expected:"object",code:"invalid_type",input:b,inst:e}),g)}});function qt(e,t,n,o){for(const s of e)if(s.issues.length===0)return t.value=s.value,t;const r=e.filter(s=>!pe(s));return r.length===1?(t.value=r[0].value,r[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:n,errors:e.map(s=>s.issues.map(i=>ie(i,o,se())))}),t)}const $n=f("$ZodUnion",(e,t)=>{E.init(e,t),T(e._zod,"optin",()=>t.options.some(r=>r._zod.optin==="optional")?"optional":void 0),T(e._zod,"optout",()=>t.options.some(r=>r._zod.optout==="optional")?"optional":void 0),T(e._zod,"values",()=>{if(t.options.every(r=>r._zod.values))return new Set(t.options.flatMap(r=>Array.from(r._zod.values)))}),T(e._zod,"pattern",()=>{if(t.options.every(r=>r._zod.pattern)){const r=t.options.map(s=>s._zod.pattern);return new RegExp(`^(${r.map(s=>st(s.source)).join("|")})$`)}});const n=t.options.length===1,o=t.options[0]._zod.run;e._zod.parse=(r,s)=>{if(n)return o(r,s);let i=!1;const a=[];for(const c of t.options){const d=c._zod.run({value:r.value,issues:[]},s);if(d instanceof Promise)a.push(d),i=!0;else{if(d.issues.length===0)return d;a.push(d)}}return i?Promise.all(a).then(c=>qt(c,r,e,s)):qt(a,r,e,s)}}),is=f("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,$n.init(e,t);const n=e._zod.parse;T(e._zod,"propValues",()=>{const r={};for(const s of t.options){const i=s._zod.propValues;if(!i||Object.keys(i).length===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(s)}"`);for(const[a,c]of Object.entries(i)){r[a]||(r[a]=new Set);for(const d of c)r[a].add(d)}}return r});const o=Le(()=>{var i;const r=t.options,s=new Map;for(const a of r){const c=(i=a._zod.propValues)==null?void 0:i[t.discriminator];if(!c||c.size===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(a)}"`);for(const d of c){if(s.has(d))throw new Error(`Duplicate discriminator value "${String(d)}"`);s.set(d,a)}}return s});e._zod.parse=(r,s)=>{const i=r.value;if(!ke(i))return r.issues.push({code:"invalid_type",expected:"object",input:i,inst:e}),r;const a=o.value.get(i==null?void 0:i[t.discriminator]);return a?a._zod.run(r,s):t.unionFallback?n(r,s):(r.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,input:i,path:[t.discriminator],inst:e}),r)}}),as=f("$ZodIntersection",(e,t)=>{E.init(e,t),e._zod.parse=(n,o)=>{const r=n.value,s=t.left._zod.run({value:r,issues:[]},o),i=t.right._zod.run({value:r,issues:[]},o);return s instanceof Promise||i instanceof Promise?Promise.all([s,i]).then(([c,d])=>Mt(n,c,d)):Mt(n,s,i)}});function Xe(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(me(e)&&me(t)){const n=Object.keys(t),o=Object.keys(e).filter(s=>n.indexOf(s)!==-1),r={...e,...t};for(const s of o){const i=Xe(e[s],t[s]);if(!i.valid)return{valid:!1,mergeErrorPath:[s,...i.mergeErrorPath]};r[s]=i.data}return{valid:!0,data:r}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};const n=[];for(let o=0;o<e.length;o++){const r=e[o],s=t[o],i=Xe(r,s);if(!i.valid)return{valid:!1,mergeErrorPath:[o,...i.mergeErrorPath]};n.push(i.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function Mt(e,t,n){const o=new Map;let r;for(const a of t.issues)if(a.code==="unrecognized_keys"){r??(r=a);for(const c of a.keys)o.has(c)||o.set(c,{}),o.get(c).l=!0}else e.issues.push(a);for(const a of n.issues)if(a.code==="unrecognized_keys")for(const c of a.keys)o.has(c)||o.set(c,{}),o.get(c).r=!0;else e.issues.push(a);const s=[...o].filter(([,a])=>a.l&&a.r).map(([a])=>a);if(s.length&&r&&e.issues.push({...r,keys:s}),pe(e))return e;const i=Xe(t.value,n.value);if(!i.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(i.mergeErrorPath)}`);return e.value=i.data,e}const cs=f("$ZodRecord",(e,t)=>{E.init(e,t),e._zod.parse=(n,o)=>{const r=n.value;if(!me(r))return n.issues.push({expected:"record",code:"invalid_type",input:r,inst:e}),n;const s=[],i=t.keyType._zod.values;if(i){n.value={};const a=new Set;for(const d of i)if(typeof d=="string"||typeof d=="number"||typeof d=="symbol"){a.add(typeof d=="number"?d.toString():d);const h=t.valueType._zod.run({value:r[d],issues:[]},o);h instanceof Promise?s.push(h.then(m=>{m.issues.length&&n.issues.push(...he(d,m.issues)),n.value[d]=m.value})):(h.issues.length&&n.issues.push(...he(d,h.issues)),n.value[d]=h.value)}let c;for(const d in r)a.has(d)||(c=c??[],c.push(d));c&&c.length>0&&n.issues.push({code:"unrecognized_keys",input:r,inst:e,keys:c})}else{n.value={};for(const a of Reflect.ownKeys(r)){if(a==="__proto__")continue;let c=t.keyType._zod.run({value:a,issues:[]},o);if(c instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(typeof a=="string"&&vn.test(a)&&c.issues.length&&c.issues.some(m=>m.code==="invalid_type"&&m.expected==="number")){const m=t.keyType._zod.run({value:Number(a),issues:[]},o);if(m instanceof Promise)throw new Error("Async schemas not supported in object keys currently");m.issues.length===0&&(c=m)}if(c.issues.length){t.mode==="loose"?n.value[a]=r[a]:n.issues.push({code:"invalid_key",origin:"record",issues:c.issues.map(m=>ie(m,o,se())),input:a,path:[a],inst:e});continue}const h=t.valueType._zod.run({value:r[a],issues:[]},o);h instanceof Promise?s.push(h.then(m=>{m.issues.length&&n.issues.push(...he(a,m.issues)),n.value[c.value]=m.value})):(h.issues.length&&n.issues.push(...he(a,h.issues)),n.value[c.value]=h.value)}}return s.length?Promise.all(s).then(()=>n):n}}),us=f("$ZodEnum",(e,t)=>{E.init(e,t);const n=cn(t.entries),o=new Set(n);e._zod.values=o,e._zod.pattern=new RegExp(`^(${n.filter(r=>vo.has(typeof r)).map(r=>typeof r=="string"?ge(r):r.toString()).join("|")})$`),e._zod.parse=(r,s)=>{const i=r.value;return o.has(i)||r.issues.push({code:"invalid_value",values:n,input:i,inst:e}),r}}),ls=f("$ZodLiteral",(e,t)=>{if(E.init(e,t),t.values.length===0)throw new Error("Cannot create literal schema with no valid values");const n=new Set(t.values);e._zod.values=n,e._zod.pattern=new RegExp(`^(${t.values.map(o=>typeof o=="string"?ge(o):o?ge(o.toString()):String(o)).join("|")})$`),e._zod.parse=(o,r)=>{const s=o.value;return n.has(s)||o.issues.push({code:"invalid_value",values:t.values,input:s,inst:e}),o}}),ds=f("$ZodTransform",(e,t)=>{E.init(e,t),e._zod.parse=(n,o)=>{if(o.direction==="backward")throw new sn(e.constructor.name);const r=t.transform(n.value,n);if(o.async)return(r instanceof Promise?r:Promise.resolve(r)).then(i=>(n.value=i,n));if(r instanceof Promise)throw new fe;return n.value=r,n}});function jt(e,t){return e.issues.length&&t===void 0?{issues:[],value:void 0}:e}const In=f("$ZodOptional",(e,t)=>{E.init(e,t),e._zod.optin="optional",e._zod.optout="optional",T(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),T(e._zod,"pattern",()=>{const n=t.innerType._zod.pattern;return n?new RegExp(`^(${st(n.source)})?$`):void 0}),e._zod.parse=(n,o)=>{if(t.innerType._zod.optin==="optional"){const r=t.innerType._zod.run(n,o);return r instanceof Promise?r.then(s=>jt(s,n.value)):jt(r,n.value)}return n.value===void 0?n:t.innerType._zod.run(n,o)}}),ps=f("$ZodExactOptional",(e,t)=>{In.init(e,t),T(e._zod,"values",()=>t.innerType._zod.values),T(e._zod,"pattern",()=>t.innerType._zod.pattern),e._zod.parse=(n,o)=>t.innerType._zod.run(n,o)}),hs=f("$ZodNullable",(e,t)=>{E.init(e,t),T(e._zod,"optin",()=>t.innerType._zod.optin),T(e._zod,"optout",()=>t.innerType._zod.optout),T(e._zod,"pattern",()=>{const n=t.innerType._zod.pattern;return n?new RegExp(`^(${st(n.source)}|null)$`):void 0}),T(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(n,o)=>n.value===null?n:t.innerType._zod.run(n,o)}),fs=f("$ZodDefault",(e,t)=>{E.init(e,t),e._zod.optin="optional",T(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,o)=>{if(o.direction==="backward")return t.innerType._zod.run(n,o);if(n.value===void 0)return n.value=t.defaultValue,n;const r=t.innerType._zod.run(n,o);return r instanceof Promise?r.then(s=>Dt(s,t)):Dt(r,t)}});function Dt(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}const ms=f("$ZodPrefault",(e,t)=>{E.init(e,t),e._zod.optin="optional",T(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,o)=>(o.direction==="backward"||n.value===void 0&&(n.value=t.defaultValue),t.innerType._zod.run(n,o))}),gs=f("$ZodNonOptional",(e,t)=>{E.init(e,t),T(e._zod,"values",()=>{const n=t.innerType._zod.values;return n?new Set([...n].filter(o=>o!==void 0)):void 0}),e._zod.parse=(n,o)=>{const r=t.innerType._zod.run(n,o);return r instanceof Promise?r.then(s=>Ut(s,e)):Ut(r,e)}});function Ut(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}const _s=f("$ZodCatch",(e,t)=>{E.init(e,t),T(e._zod,"optin",()=>t.innerType._zod.optin),T(e._zod,"optout",()=>t.innerType._zod.optout),T(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,o)=>{if(o.direction==="backward")return t.innerType._zod.run(n,o);const r=t.innerType._zod.run(n,o);return r instanceof Promise?r.then(s=>(n.value=s.value,s.issues.length&&(n.value=t.catchValue({...n,error:{issues:s.issues.map(i=>ie(i,o,se()))},input:n.value}),n.issues=[]),n)):(n.value=r.value,r.issues.length&&(n.value=t.catchValue({...n,error:{issues:r.issues.map(s=>ie(s,o,se()))},input:n.value}),n.issues=[]),n)}}),vs=f("$ZodPipe",(e,t)=>{E.init(e,t),T(e._zod,"values",()=>t.in._zod.values),T(e._zod,"optin",()=>t.in._zod.optin),T(e._zod,"optout",()=>t.out._zod.optout),T(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(n,o)=>{if(o.direction==="backward"){const s=t.out._zod.run(n,o);return s instanceof Promise?s.then(i=>xe(i,t.in,o)):xe(s,t.in,o)}const r=t.in._zod.run(n,o);return r instanceof Promise?r.then(s=>xe(s,t.out,o)):xe(r,t.out,o)}});function xe(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}const bs=f("$ZodReadonly",(e,t)=>{E.init(e,t),T(e._zod,"propValues",()=>t.innerType._zod.propValues),T(e._zod,"values",()=>t.innerType._zod.values),T(e._zod,"optin",()=>{var n,o;return(o=(n=t.innerType)==null?void 0:n._zod)==null?void 0:o.optin}),T(e._zod,"optout",()=>{var n,o;return(o=(n=t.innerType)==null?void 0:n._zod)==null?void 0:o.optout}),e._zod.parse=(n,o)=>{if(o.direction==="backward")return t.innerType._zod.run(n,o);const r=t.innerType._zod.run(n,o);return r instanceof Promise?r.then(Lt):Lt(r)}});function Lt(e){return e.value=Object.freeze(e.value),e}const ys=f("$ZodCustom",(e,t)=>{B.init(e,t),E.init(e,t),e._zod.parse=(n,o)=>n,e._zod.check=n=>{const o=n.value,r=t.fn(o);if(r instanceof Promise)return r.then(s=>Ht(s,n,o,e));Ht(r,n,o,e)}});function Ht(e,t,n,o){if(!e){const r={code:"custom",input:n,inst:o,path:[...o._zod.def.path??[]],continue:!o._zod.def.abort};o._zod.def.params&&(r.params=o._zod.def.params),t.issues.push(we(r))}}var Ft;class ks{constructor(){this._map=new WeakMap,this._idmap=new Map}add(t,...n){const o=n[0];return this._map.set(t,o),o&&typeof o=="object"&&"id"in o&&this._idmap.set(o.id,t),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(t){const n=this._map.get(t);return n&&typeof n=="object"&&"id"in n&&this._idmap.delete(n.id),this._map.delete(t),this}get(t){const n=t._zod.parent;if(n){const o={...this.get(n)??{}};delete o.id;const r={...o,...this._map.get(t)};return Object.keys(r).length?r:void 0}return this._map.get(t)}has(t){return this._map.has(t)}}function ws(){return new ks}(Ft=globalThis).__zod_globalRegistry??(Ft.__zod_globalRegistry=ws());const ye=globalThis.__zod_globalRegistry;function Ss(e,t){return new e({type:"string",...v(t)})}function zs(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...v(t)})}function Jt(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...v(t)})}function Ts(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...v(t)})}function $s(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...v(t)})}function Is(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...v(t)})}function Rs(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...v(t)})}function Ps(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...v(t)})}function Es(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...v(t)})}function Zs(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...v(t)})}function Os(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...v(t)})}function xs(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...v(t)})}function Cs(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...v(t)})}function Ns(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...v(t)})}function As(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...v(t)})}function qs(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...v(t)})}function Ms(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...v(t)})}function js(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...v(t)})}function Ds(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...v(t)})}function Us(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...v(t)})}function Ls(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...v(t)})}function Hs(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...v(t)})}function Fs(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...v(t)})}function Js(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...v(t)})}function Vs(e,t){return new e({type:"string",format:"date",check:"string_format",...v(t)})}function Bs(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...v(t)})}function Ws(e,t){return new e({type:"string",format:"duration",check:"string_format",...v(t)})}function Ks(e,t){return new e({type:"number",checks:[],...v(t)})}function Gs(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...v(t)})}function Qs(e,t){return new e({type:"boolean",...v(t)})}function Ys(e,t){return new e({type:"undefined",...v(t)})}function Xs(e,t){return new e({type:"null",...v(t)})}function ei(e){return new e({type:"unknown"})}function ti(e,t){return new e({type:"never",...v(t)})}function Vt(e,t){return new yn({check:"less_than",...v(t),value:e,inclusive:!1})}function Ge(e,t){return new yn({check:"less_than",...v(t),value:e,inclusive:!0})}function Bt(e,t){return new kn({check:"greater_than",...v(t),value:e,inclusive:!1})}function Qe(e,t){return new kn({check:"greater_than",...v(t),value:e,inclusive:!0})}function Wt(e,t){return new pr({check:"multiple_of",...v(t),value:e})}function Rn(e,t){return new fr({check:"max_length",...v(t),maximum:e})}function Me(e,t){return new mr({check:"min_length",...v(t),minimum:e})}function Pn(e,t){return new gr({check:"length_equals",...v(t),length:e})}function ni(e,t){return new _r({check:"string_format",format:"regex",...v(t),pattern:e})}function oi(e){return new vr({check:"string_format",format:"lowercase",...v(e)})}function ri(e){return new br({check:"string_format",format:"uppercase",...v(e)})}function si(e,t){return new yr({check:"string_format",format:"includes",...v(t),includes:e})}function ii(e,t){return new kr({check:"string_format",format:"starts_with",...v(t),prefix:e})}function ai(e,t){return new wr({check:"string_format",format:"ends_with",...v(t),suffix:e})}function ve(e){return new Sr({check:"overwrite",tx:e})}function ci(e){return ve(t=>t.normalize(e))}function ui(){return ve(e=>e.trim())}function li(){return ve(e=>e.toLowerCase())}function di(){return ve(e=>e.toUpperCase())}function pi(){return ve(e=>go(e))}function hi(e,t,n){return new e({type:"array",element:t,...v(n)})}function fi(e,t,n){const o=v(n);return o.abort??(o.abort=!0),new e({type:"custom",check:"custom",fn:t,...o})}function mi(e,t,n){return new e({type:"custom",check:"custom",fn:t,...v(n)})}function gi(e){const t=_i(n=>(n.addIssue=o=>{if(typeof o=="string")n.issues.push(we(o,n.value,t._zod.def));else{const r=o;r.fatal&&(r.continue=!1),r.code??(r.code="custom"),r.input??(r.input=n.value),r.inst??(r.inst=t),r.continue??(r.continue=!t._zod.def.abort),n.issues.push(we(r))}},e(n.value,n)));return t}function _i(e,t){const n=new B({check:"custom",...v(t)});return n._zod.check=e,n}function En(e){let t=(e==null?void 0:e.target)??"draft-2020-12";return t==="draft-4"&&(t="draft-04"),t==="draft-7"&&(t="draft-07"),{processors:e.processors??{},metadataRegistry:(e==null?void 0:e.metadata)??ye,target:t,unrepresentable:(e==null?void 0:e.unrepresentable)??"throw",override:(e==null?void 0:e.override)??(()=>{}),io:(e==null?void 0:e.io)??"output",counter:0,seen:new Map,cycles:(e==null?void 0:e.cycles)??"ref",reused:(e==null?void 0:e.reused)??"inline",external:(e==null?void 0:e.external)??void 0}}function M(e,t,n={path:[],schemaPath:[]}){var h,m;var o;const r=e._zod.def,s=t.seen.get(e);if(s)return s.count++,n.schemaPath.includes(e)&&(s.cycle=n.path),s.schema;const i={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,i);const a=(m=(h=e._zod).toJSONSchema)==null?void 0:m.call(h);if(a)i.schema=a;else{const g={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,i.schema,g);else{const b=i.schema,y=t.processors[r.type];if(!y)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${r.type}`);y(e,t,b,g)}const _=e._zod.parent;_&&(i.ref||(i.ref=_),M(_,t,g),t.seen.get(_).isParent=!0)}const c=t.metadataRegistry.get(e);return c&&Object.assign(i.schema,c),t.io==="input"&&F(e)&&(delete i.schema.examples,delete i.schema.default),t.io==="input"&&i.schema._prefault&&((o=i.schema).default??(o.default=i.schema._prefault)),delete i.schema._prefault,t.seen.get(e).schema}function Zn(e,t){var i,a,c,d;const n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const o=new Map;for(const h of e.seen.entries()){const m=(i=e.metadataRegistry.get(h[0]))==null?void 0:i.id;if(m){const g=o.get(m);if(g&&g!==h[0])throw new Error(`Duplicate schema id "${m}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);o.set(m,h[0])}}const r=h=>{var y;const m=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){const x=(y=e.external.registry.get(h[0]))==null?void 0:y.id,W=e.external.uri??(oe=>oe);if(x)return{ref:W(x)};const C=h[1].defId??h[1].schema.id??`schema${e.counter++}`;return h[1].defId=C,{defId:C,ref:`${W("__shared")}#/${m}/${C}`}}if(h[1]===n)return{ref:"#"};const _=`#/${m}/`,b=h[1].schema.id??`__schema${e.counter++}`;return{defId:b,ref:_+b}},s=h=>{if(h[1].schema.$ref)return;const m=h[1],{ref:g,defId:_}=r(h);m.def={...m.schema},_&&(m.defId=_);const b=m.schema;for(const y in b)delete b[y];b.$ref=g};if(e.cycles==="throw")for(const h of e.seen.entries()){const m=h[1];if(m.cycle)throw new Error(`Cycle detected: #/${(a=m.cycle)==null?void 0:a.join("/")}/<root>
|
|
44
|
+
`)}_.write("payload.value = newResult;"),_.write("return payload;");const C=_.compile();return(K,j)=>C(g,K,j)};let s;const i=ke,a=!an.jitless,d=a&&_o.value,h=t.catchall;let m;e._zod.parse=(g,_)=>{m??(m=o.value);const b=g.value;return i(b)?a&&d&&(_==null?void 0:_.async)===!1&&_.jitless!==!0?(s||(s=r(t.shape)),g=s(g,_),h?Tn([],b,g,_,m,e):g):n(g,_):(g.issues.push({expected:"object",code:"invalid_type",input:b,inst:e}),g)}});function At(e,t,n,o){for(const s of e)if(s.issues.length===0)return t.value=s.value,t;const r=e.filter(s=>!pe(s));return r.length===1?(t.value=r[0].value,r[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:n,errors:e.map(s=>s.issues.map(i=>ie(i,o,se())))}),t)}const $n=f("$ZodUnion",(e,t)=>{E.init(e,t),T(e._zod,"optin",()=>t.options.some(r=>r._zod.optin==="optional")?"optional":void 0),T(e._zod,"optout",()=>t.options.some(r=>r._zod.optout==="optional")?"optional":void 0),T(e._zod,"values",()=>{if(t.options.every(r=>r._zod.values))return new Set(t.options.flatMap(r=>Array.from(r._zod.values)))}),T(e._zod,"pattern",()=>{if(t.options.every(r=>r._zod.pattern)){const r=t.options.map(s=>s._zod.pattern);return new RegExp(`^(${r.map(s=>st(s.source)).join("|")})$`)}});const n=t.options.length===1,o=t.options[0]._zod.run;e._zod.parse=(r,s)=>{if(n)return o(r,s);let i=!1;const a=[];for(const c of t.options){const d=c._zod.run({value:r.value,issues:[]},s);if(d instanceof Promise)a.push(d),i=!0;else{if(d.issues.length===0)return d;a.push(d)}}return i?Promise.all(a).then(c=>At(c,r,e,s)):At(a,r,e,s)}}),is=f("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,$n.init(e,t);const n=e._zod.parse;T(e._zod,"propValues",()=>{const r={};for(const s of t.options){const i=s._zod.propValues;if(!i||Object.keys(i).length===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(s)}"`);for(const[a,c]of Object.entries(i)){r[a]||(r[a]=new Set);for(const d of c)r[a].add(d)}}return r});const o=Le(()=>{var i;const r=t.options,s=new Map;for(const a of r){const c=(i=a._zod.propValues)==null?void 0:i[t.discriminator];if(!c||c.size===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(a)}"`);for(const d of c){if(s.has(d))throw new Error(`Duplicate discriminator value "${String(d)}"`);s.set(d,a)}}return s});e._zod.parse=(r,s)=>{const i=r.value;if(!ke(i))return r.issues.push({code:"invalid_type",expected:"object",input:i,inst:e}),r;const a=o.value.get(i==null?void 0:i[t.discriminator]);return a?a._zod.run(r,s):t.unionFallback?n(r,s):(r.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,input:i,path:[t.discriminator],inst:e}),r)}}),as=f("$ZodIntersection",(e,t)=>{E.init(e,t),e._zod.parse=(n,o)=>{const r=n.value,s=t.left._zod.run({value:r,issues:[]},o),i=t.right._zod.run({value:r,issues:[]},o);return s instanceof Promise||i instanceof Promise?Promise.all([s,i]).then(([c,d])=>Mt(n,c,d)):Mt(n,s,i)}});function Xe(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(me(e)&&me(t)){const n=Object.keys(t),o=Object.keys(e).filter(s=>n.indexOf(s)!==-1),r={...e,...t};for(const s of o){const i=Xe(e[s],t[s]);if(!i.valid)return{valid:!1,mergeErrorPath:[s,...i.mergeErrorPath]};r[s]=i.data}return{valid:!0,data:r}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};const n=[];for(let o=0;o<e.length;o++){const r=e[o],s=t[o],i=Xe(r,s);if(!i.valid)return{valid:!1,mergeErrorPath:[o,...i.mergeErrorPath]};n.push(i.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function Mt(e,t,n){const o=new Map;let r;for(const a of t.issues)if(a.code==="unrecognized_keys"){r??(r=a);for(const c of a.keys)o.has(c)||o.set(c,{}),o.get(c).l=!0}else e.issues.push(a);for(const a of n.issues)if(a.code==="unrecognized_keys")for(const c of a.keys)o.has(c)||o.set(c,{}),o.get(c).r=!0;else e.issues.push(a);const s=[...o].filter(([,a])=>a.l&&a.r).map(([a])=>a);if(s.length&&r&&e.issues.push({...r,keys:s}),pe(e))return e;const i=Xe(t.value,n.value);if(!i.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(i.mergeErrorPath)}`);return e.value=i.data,e}const cs=f("$ZodRecord",(e,t)=>{E.init(e,t),e._zod.parse=(n,o)=>{const r=n.value;if(!me(r))return n.issues.push({expected:"record",code:"invalid_type",input:r,inst:e}),n;const s=[],i=t.keyType._zod.values;if(i){n.value={};const a=new Set;for(const d of i)if(typeof d=="string"||typeof d=="number"||typeof d=="symbol"){a.add(typeof d=="number"?d.toString():d);const h=t.valueType._zod.run({value:r[d],issues:[]},o);h instanceof Promise?s.push(h.then(m=>{m.issues.length&&n.issues.push(...he(d,m.issues)),n.value[d]=m.value})):(h.issues.length&&n.issues.push(...he(d,h.issues)),n.value[d]=h.value)}let c;for(const d in r)a.has(d)||(c=c??[],c.push(d));c&&c.length>0&&n.issues.push({code:"unrecognized_keys",input:r,inst:e,keys:c})}else{n.value={};for(const a of Reflect.ownKeys(r)){if(a==="__proto__")continue;let c=t.keyType._zod.run({value:a,issues:[]},o);if(c instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(typeof a=="string"&&vn.test(a)&&c.issues.length&&c.issues.some(m=>m.code==="invalid_type"&&m.expected==="number")){const m=t.keyType._zod.run({value:Number(a),issues:[]},o);if(m instanceof Promise)throw new Error("Async schemas not supported in object keys currently");m.issues.length===0&&(c=m)}if(c.issues.length){t.mode==="loose"?n.value[a]=r[a]:n.issues.push({code:"invalid_key",origin:"record",issues:c.issues.map(m=>ie(m,o,se())),input:a,path:[a],inst:e});continue}const h=t.valueType._zod.run({value:r[a],issues:[]},o);h instanceof Promise?s.push(h.then(m=>{m.issues.length&&n.issues.push(...he(a,m.issues)),n.value[c.value]=m.value})):(h.issues.length&&n.issues.push(...he(a,h.issues)),n.value[c.value]=h.value)}}return s.length?Promise.all(s).then(()=>n):n}}),us=f("$ZodEnum",(e,t)=>{E.init(e,t);const n=cn(t.entries),o=new Set(n);e._zod.values=o,e._zod.pattern=new RegExp(`^(${n.filter(r=>vo.has(typeof r)).map(r=>typeof r=="string"?ge(r):r.toString()).join("|")})$`),e._zod.parse=(r,s)=>{const i=r.value;return o.has(i)||r.issues.push({code:"invalid_value",values:n,input:i,inst:e}),r}}),ls=f("$ZodLiteral",(e,t)=>{if(E.init(e,t),t.values.length===0)throw new Error("Cannot create literal schema with no valid values");const n=new Set(t.values);e._zod.values=n,e._zod.pattern=new RegExp(`^(${t.values.map(o=>typeof o=="string"?ge(o):o?ge(o.toString()):String(o)).join("|")})$`),e._zod.parse=(o,r)=>{const s=o.value;return n.has(s)||o.issues.push({code:"invalid_value",values:t.values,input:s,inst:e}),o}}),ds=f("$ZodTransform",(e,t)=>{E.init(e,t),e._zod.parse=(n,o)=>{if(o.direction==="backward")throw new sn(e.constructor.name);const r=t.transform(n.value,n);if(o.async)return(r instanceof Promise?r:Promise.resolve(r)).then(i=>(n.value=i,n));if(r instanceof Promise)throw new fe;return n.value=r,n}});function jt(e,t){return e.issues.length&&t===void 0?{issues:[],value:void 0}:e}const Rn=f("$ZodOptional",(e,t)=>{E.init(e,t),e._zod.optin="optional",e._zod.optout="optional",T(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),T(e._zod,"pattern",()=>{const n=t.innerType._zod.pattern;return n?new RegExp(`^(${st(n.source)})?$`):void 0}),e._zod.parse=(n,o)=>{if(t.innerType._zod.optin==="optional"){const r=t.innerType._zod.run(n,o);return r instanceof Promise?r.then(s=>jt(s,n.value)):jt(r,n.value)}return n.value===void 0?n:t.innerType._zod.run(n,o)}}),ps=f("$ZodExactOptional",(e,t)=>{Rn.init(e,t),T(e._zod,"values",()=>t.innerType._zod.values),T(e._zod,"pattern",()=>t.innerType._zod.pattern),e._zod.parse=(n,o)=>t.innerType._zod.run(n,o)}),hs=f("$ZodNullable",(e,t)=>{E.init(e,t),T(e._zod,"optin",()=>t.innerType._zod.optin),T(e._zod,"optout",()=>t.innerType._zod.optout),T(e._zod,"pattern",()=>{const n=t.innerType._zod.pattern;return n?new RegExp(`^(${st(n.source)}|null)$`):void 0}),T(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(n,o)=>n.value===null?n:t.innerType._zod.run(n,o)}),fs=f("$ZodDefault",(e,t)=>{E.init(e,t),e._zod.optin="optional",T(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,o)=>{if(o.direction==="backward")return t.innerType._zod.run(n,o);if(n.value===void 0)return n.value=t.defaultValue,n;const r=t.innerType._zod.run(n,o);return r instanceof Promise?r.then(s=>Dt(s,t)):Dt(r,t)}});function Dt(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}const ms=f("$ZodPrefault",(e,t)=>{E.init(e,t),e._zod.optin="optional",T(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,o)=>(o.direction==="backward"||n.value===void 0&&(n.value=t.defaultValue),t.innerType._zod.run(n,o))}),gs=f("$ZodNonOptional",(e,t)=>{E.init(e,t),T(e._zod,"values",()=>{const n=t.innerType._zod.values;return n?new Set([...n].filter(o=>o!==void 0)):void 0}),e._zod.parse=(n,o)=>{const r=t.innerType._zod.run(n,o);return r instanceof Promise?r.then(s=>Ut(s,e)):Ut(r,e)}});function Ut(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}const _s=f("$ZodCatch",(e,t)=>{E.init(e,t),T(e._zod,"optin",()=>t.innerType._zod.optin),T(e._zod,"optout",()=>t.innerType._zod.optout),T(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,o)=>{if(o.direction==="backward")return t.innerType._zod.run(n,o);const r=t.innerType._zod.run(n,o);return r instanceof Promise?r.then(s=>(n.value=s.value,s.issues.length&&(n.value=t.catchValue({...n,error:{issues:s.issues.map(i=>ie(i,o,se()))},input:n.value}),n.issues=[]),n)):(n.value=r.value,r.issues.length&&(n.value=t.catchValue({...n,error:{issues:r.issues.map(s=>ie(s,o,se()))},input:n.value}),n.issues=[]),n)}}),vs=f("$ZodPipe",(e,t)=>{E.init(e,t),T(e._zod,"values",()=>t.in._zod.values),T(e._zod,"optin",()=>t.in._zod.optin),T(e._zod,"optout",()=>t.out._zod.optout),T(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(n,o)=>{if(o.direction==="backward"){const s=t.out._zod.run(n,o);return s instanceof Promise?s.then(i=>xe(i,t.in,o)):xe(s,t.in,o)}const r=t.in._zod.run(n,o);return r instanceof Promise?r.then(s=>xe(s,t.out,o)):xe(r,t.out,o)}});function xe(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}const bs=f("$ZodReadonly",(e,t)=>{E.init(e,t),T(e._zod,"propValues",()=>t.innerType._zod.propValues),T(e._zod,"values",()=>t.innerType._zod.values),T(e._zod,"optin",()=>{var n,o;return(o=(n=t.innerType)==null?void 0:n._zod)==null?void 0:o.optin}),T(e._zod,"optout",()=>{var n,o;return(o=(n=t.innerType)==null?void 0:n._zod)==null?void 0:o.optout}),e._zod.parse=(n,o)=>{if(o.direction==="backward")return t.innerType._zod.run(n,o);const r=t.innerType._zod.run(n,o);return r instanceof Promise?r.then(Lt):Lt(r)}});function Lt(e){return e.value=Object.freeze(e.value),e}const ys=f("$ZodCustom",(e,t)=>{B.init(e,t),E.init(e,t),e._zod.parse=(n,o)=>n,e._zod.check=n=>{const o=n.value,r=t.fn(o);if(r instanceof Promise)return r.then(s=>Ht(s,n,o,e));Ht(r,n,o,e)}});function Ht(e,t,n,o){if(!e){const r={code:"custom",input:n,inst:o,path:[...o._zod.def.path??[]],continue:!o._zod.def.abort};o._zod.def.params&&(r.params=o._zod.def.params),t.issues.push(we(r))}}var Ft;class ks{constructor(){this._map=new WeakMap,this._idmap=new Map}add(t,...n){const o=n[0];return this._map.set(t,o),o&&typeof o=="object"&&"id"in o&&this._idmap.set(o.id,t),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(t){const n=this._map.get(t);return n&&typeof n=="object"&&"id"in n&&this._idmap.delete(n.id),this._map.delete(t),this}get(t){const n=t._zod.parent;if(n){const o={...this.get(n)??{}};delete o.id;const r={...o,...this._map.get(t)};return Object.keys(r).length?r:void 0}return this._map.get(t)}has(t){return this._map.has(t)}}function ws(){return new ks}(Ft=globalThis).__zod_globalRegistry??(Ft.__zod_globalRegistry=ws());const ye=globalThis.__zod_globalRegistry;function Ss(e,t){return new e({type:"string",...v(t)})}function zs(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...v(t)})}function Jt(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...v(t)})}function Ts(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...v(t)})}function $s(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...v(t)})}function Rs(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...v(t)})}function Is(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...v(t)})}function Ps(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...v(t)})}function Es(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...v(t)})}function Zs(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...v(t)})}function Os(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...v(t)})}function xs(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...v(t)})}function Cs(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...v(t)})}function Ns(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...v(t)})}function qs(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...v(t)})}function As(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...v(t)})}function Ms(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...v(t)})}function js(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...v(t)})}function Ds(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...v(t)})}function Us(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...v(t)})}function Ls(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...v(t)})}function Hs(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...v(t)})}function Fs(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...v(t)})}function Js(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...v(t)})}function Vs(e,t){return new e({type:"string",format:"date",check:"string_format",...v(t)})}function Bs(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...v(t)})}function Ws(e,t){return new e({type:"string",format:"duration",check:"string_format",...v(t)})}function Ks(e,t){return new e({type:"number",checks:[],...v(t)})}function Gs(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...v(t)})}function Qs(e,t){return new e({type:"boolean",...v(t)})}function Ys(e,t){return new e({type:"undefined",...v(t)})}function Xs(e,t){return new e({type:"null",...v(t)})}function ei(e){return new e({type:"unknown"})}function ti(e,t){return new e({type:"never",...v(t)})}function Vt(e,t){return new yn({check:"less_than",...v(t),value:e,inclusive:!1})}function Ge(e,t){return new yn({check:"less_than",...v(t),value:e,inclusive:!0})}function Bt(e,t){return new kn({check:"greater_than",...v(t),value:e,inclusive:!1})}function Qe(e,t){return new kn({check:"greater_than",...v(t),value:e,inclusive:!0})}function Wt(e,t){return new pr({check:"multiple_of",...v(t),value:e})}function In(e,t){return new fr({check:"max_length",...v(t),maximum:e})}function Me(e,t){return new mr({check:"min_length",...v(t),minimum:e})}function Pn(e,t){return new gr({check:"length_equals",...v(t),length:e})}function ni(e,t){return new _r({check:"string_format",format:"regex",...v(t),pattern:e})}function oi(e){return new vr({check:"string_format",format:"lowercase",...v(e)})}function ri(e){return new br({check:"string_format",format:"uppercase",...v(e)})}function si(e,t){return new yr({check:"string_format",format:"includes",...v(t),includes:e})}function ii(e,t){return new kr({check:"string_format",format:"starts_with",...v(t),prefix:e})}function ai(e,t){return new wr({check:"string_format",format:"ends_with",...v(t),suffix:e})}function ve(e){return new Sr({check:"overwrite",tx:e})}function ci(e){return ve(t=>t.normalize(e))}function ui(){return ve(e=>e.trim())}function li(){return ve(e=>e.toLowerCase())}function di(){return ve(e=>e.toUpperCase())}function pi(){return ve(e=>go(e))}function hi(e,t,n){return new e({type:"array",element:t,...v(n)})}function fi(e,t,n){const o=v(n);return o.abort??(o.abort=!0),new e({type:"custom",check:"custom",fn:t,...o})}function mi(e,t,n){return new e({type:"custom",check:"custom",fn:t,...v(n)})}function gi(e){const t=_i(n=>(n.addIssue=o=>{if(typeof o=="string")n.issues.push(we(o,n.value,t._zod.def));else{const r=o;r.fatal&&(r.continue=!1),r.code??(r.code="custom"),r.input??(r.input=n.value),r.inst??(r.inst=t),r.continue??(r.continue=!t._zod.def.abort),n.issues.push(we(r))}},e(n.value,n)));return t}function _i(e,t){const n=new B({check:"custom",...v(t)});return n._zod.check=e,n}function En(e){let t=(e==null?void 0:e.target)??"draft-2020-12";return t==="draft-4"&&(t="draft-04"),t==="draft-7"&&(t="draft-07"),{processors:e.processors??{},metadataRegistry:(e==null?void 0:e.metadata)??ye,target:t,unrepresentable:(e==null?void 0:e.unrepresentable)??"throw",override:(e==null?void 0:e.override)??(()=>{}),io:(e==null?void 0:e.io)??"output",counter:0,seen:new Map,cycles:(e==null?void 0:e.cycles)??"ref",reused:(e==null?void 0:e.reused)??"inline",external:(e==null?void 0:e.external)??void 0}}function M(e,t,n={path:[],schemaPath:[]}){var h,m;var o;const r=e._zod.def,s=t.seen.get(e);if(s)return s.count++,n.schemaPath.includes(e)&&(s.cycle=n.path),s.schema;const i={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,i);const a=(m=(h=e._zod).toJSONSchema)==null?void 0:m.call(h);if(a)i.schema=a;else{const g={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,i.schema,g);else{const b=i.schema,y=t.processors[r.type];if(!y)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${r.type}`);y(e,t,b,g)}const _=e._zod.parent;_&&(i.ref||(i.ref=_),M(_,t,g),t.seen.get(_).isParent=!0)}const c=t.metadataRegistry.get(e);return c&&Object.assign(i.schema,c),t.io==="input"&&F(e)&&(delete i.schema.examples,delete i.schema.default),t.io==="input"&&i.schema._prefault&&((o=i.schema).default??(o.default=i.schema._prefault)),delete i.schema._prefault,t.seen.get(e).schema}function Zn(e,t){var i,a,c,d;const n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const o=new Map;for(const h of e.seen.entries()){const m=(i=e.metadataRegistry.get(h[0]))==null?void 0:i.id;if(m){const g=o.get(m);if(g&&g!==h[0])throw new Error(`Duplicate schema id "${m}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);o.set(m,h[0])}}const r=h=>{var y;const m=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){const x=(y=e.external.registry.get(h[0]))==null?void 0:y.id,W=e.external.uri??(oe=>oe);if(x)return{ref:W(x)};const C=h[1].defId??h[1].schema.id??`schema${e.counter++}`;return h[1].defId=C,{defId:C,ref:`${W("__shared")}#/${m}/${C}`}}if(h[1]===n)return{ref:"#"};const _=`#/${m}/`,b=h[1].schema.id??`__schema${e.counter++}`;return{defId:b,ref:_+b}},s=h=>{if(h[1].schema.$ref)return;const m=h[1],{ref:g,defId:_}=r(h);m.def={...m.schema},_&&(m.defId=_);const b=m.schema;for(const y in b)delete b[y];b.$ref=g};if(e.cycles==="throw")for(const h of e.seen.entries()){const m=h[1];if(m.cycle)throw new Error(`Cycle detected: #/${(a=m.cycle)==null?void 0:a.join("/")}/<root>
|
|
45
45
|
|
|
46
|
-
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const h of e.seen.entries()){const m=h[1];if(t===h[0]){s(h);continue}if(e.external){const _=(c=e.external.registry.get(h[0]))==null?void 0:c.id;if(t!==h[0]&&_){s(h);continue}}if((d=e.metadataRegistry.get(h[0]))==null?void 0:d.id){s(h);continue}if(m.cycle){s(h);continue}if(m.count>1&&e.reused==="ref"){s(h);continue}}}function On(e,t){var i,a,c;const n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const o=d=>{const h=e.seen.get(d);if(h.ref===null)return;const m=h.def??h.schema,g={...m},_=h.ref;if(h.ref=null,_){o(_);const y=e.seen.get(_),x=y.schema;if(x.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(m.allOf=m.allOf??[],m.allOf.push(x)):Object.assign(m,x),Object.assign(m,g),d._zod.parent===_)for(const C in m)C==="$ref"||C==="allOf"||C in g||delete m[C];if(x.$ref)for(const C in m)C==="$ref"||C==="allOf"||C in y.def&&JSON.stringify(m[C])===JSON.stringify(y.def[C])&&delete m[C]}const b=d._zod.parent;if(b&&b!==_){o(b);const y=e.seen.get(b);if(y!=null&&y.schema.$ref&&(m.$ref=y.schema.$ref,y.def))for(const x in m)x==="$ref"||x==="allOf"||x in y.def&&JSON.stringify(m[x])===JSON.stringify(y.def[x])&&delete m[x]}e.override({zodSchema:d,jsonSchema:m,path:h.path??[]})};for(const d of[...e.seen.entries()].reverse())o(d[0]);const r={};if(e.target==="draft-2020-12"?r.$schema="https://json-schema.org/draft/2020-12/schema":e.target==="draft-07"?r.$schema="http://json-schema.org/draft-07/schema#":e.target==="draft-04"?r.$schema="http://json-schema.org/draft-04/schema#":e.target,(i=e.external)!=null&&i.uri){const d=(a=e.external.registry.get(t))==null?void 0:a.id;if(!d)throw new Error("Schema is missing an `id` property");r.$id=e.external.uri(d)}Object.assign(r,n.def??n.schema);const s=((c=e.external)==null?void 0:c.defs)??{};for(const d of e.seen.entries()){const h=d[1];h.def&&h.defId&&(s[h.defId]=h.def)}e.external||Object.keys(s).length>0&&(e.target==="draft-2020-12"?r.$defs=s:r.definitions=s);try{const d=JSON.parse(JSON.stringify(r));return Object.defineProperty(d,"~standard",{value:{...t["~standard"],jsonSchema:{input:je(t,"input",e.processors),output:je(t,"output",e.processors)}},enumerable:!1,writable:!1}),d}catch{throw new Error("Error converting schema to JSON.")}}function F(e,t){const n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);const o=e._zod.def;if(o.type==="transform")return!0;if(o.type==="array")return F(o.element,n);if(o.type==="set")return F(o.valueType,n);if(o.type==="lazy")return F(o.getter(),n);if(o.type==="promise"||o.type==="optional"||o.type==="nonoptional"||o.type==="nullable"||o.type==="readonly"||o.type==="default"||o.type==="prefault")return F(o.innerType,n);if(o.type==="intersection")return F(o.left,n)||F(o.right,n);if(o.type==="record"||o.type==="map")return F(o.keyType,n)||F(o.valueType,n);if(o.type==="pipe")return F(o.in,n)||F(o.out,n);if(o.type==="object"){for(const r in o.shape)if(F(o.shape[r],n))return!0;return!1}if(o.type==="union"){for(const r of o.options)if(F(r,n))return!0;return!1}if(o.type==="tuple"){for(const r of o.items)if(F(r,n))return!0;return!!(o.rest&&F(o.rest,n))}return!1}const vi=(e,t={})=>n=>{const o=En({...n,processors:t});return M(e,o),Zn(o,e),On(o,e)},je=(e,t,n={})=>o=>{const{libraryOptions:r,target:s}=o??{},i=En({...r??{},target:s,io:t,processors:n});return M(e,i),Zn(i,e),On(i,e)},bi={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},yi=(e,t,n,o)=>{const r=n;r.type="string";const{minimum:s,maximum:i,format:a,patterns:c,contentEncoding:d}=e._zod.bag;if(typeof s=="number"&&(r.minLength=s),typeof i=="number"&&(r.maxLength=i),a&&(r.format=bi[a]??a,r.format===""&&delete r.format,a==="time"&&delete r.format),d&&(r.contentEncoding=d),c&&c.size>0){const h=[...c];h.length===1?r.pattern=h[0].source:h.length>1&&(r.allOf=[...h.map(m=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:m.source}))])}},ki=(e,t,n,o)=>{const r=n,{minimum:s,maximum:i,format:a,multipleOf:c,exclusiveMaximum:d,exclusiveMinimum:h}=e._zod.bag;typeof a=="string"&&a.includes("int")?r.type="integer":r.type="number",typeof h=="number"&&(t.target==="draft-04"||t.target==="openapi-3.0"?(r.minimum=h,r.exclusiveMinimum=!0):r.exclusiveMinimum=h),typeof s=="number"&&(r.minimum=s,typeof h=="number"&&t.target!=="draft-04"&&(h>=s?delete r.minimum:delete r.exclusiveMinimum)),typeof d=="number"&&(t.target==="draft-04"||t.target==="openapi-3.0"?(r.maximum=d,r.exclusiveMaximum=!0):r.exclusiveMaximum=d),typeof i=="number"&&(r.maximum=i,typeof d=="number"&&t.target!=="draft-04"&&(d<=i?delete r.maximum:delete r.exclusiveMaximum)),typeof c=="number"&&(r.multipleOf=c)},wi=(e,t,n,o)=>{n.type="boolean"},Si=(e,t,n,o)=>{t.target==="openapi-3.0"?(n.type="string",n.nullable=!0,n.enum=[null]):n.type="null"},zi=(e,t,n,o)=>{if(t.unrepresentable==="throw")throw new Error("Undefined cannot be represented in JSON Schema")},Ti=(e,t,n,o)=>{n.not={}},$i=(e,t,n,o)=>{},Ii=(e,t,n,o)=>{const r=e._zod.def,s=cn(r.entries);s.every(i=>typeof i=="number")&&(n.type="number"),s.every(i=>typeof i=="string")&&(n.type="string"),n.enum=s},Ri=(e,t,n,o)=>{const r=e._zod.def,s=[];for(const i of r.values)if(i===void 0){if(t.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof i=="bigint"){if(t.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");s.push(Number(i))}else s.push(i);if(s.length!==0)if(s.length===1){const i=s[0];n.type=i===null?"null":typeof i,t.target==="draft-04"||t.target==="openapi-3.0"?n.enum=[i]:n.const=i}else s.every(i=>typeof i=="number")&&(n.type="number"),s.every(i=>typeof i=="string")&&(n.type="string"),s.every(i=>typeof i=="boolean")&&(n.type="boolean"),s.every(i=>i===null)&&(n.type="null"),n.enum=s},Pi=(e,t,n,o)=>{if(t.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},Ei=(e,t,n,o)=>{if(t.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},Zi=(e,t,n,o)=>{const r=n,s=e._zod.def,{minimum:i,maximum:a}=e._zod.bag;typeof i=="number"&&(r.minItems=i),typeof a=="number"&&(r.maxItems=a),r.type="array",r.items=M(s.element,t,{...o,path:[...o.path,"items"]})},Oi=(e,t,n,o)=>{var d;const r=n,s=e._zod.def;r.type="object",r.properties={};const i=s.shape;for(const h in i)r.properties[h]=M(i[h],t,{...o,path:[...o.path,"properties",h]});const a=new Set(Object.keys(i)),c=new Set([...a].filter(h=>{const m=s.shape[h]._zod;return t.io==="input"?m.optin===void 0:m.optout===void 0}));c.size>0&&(r.required=Array.from(c)),((d=s.catchall)==null?void 0:d._zod.def.type)==="never"?r.additionalProperties=!1:s.catchall?s.catchall&&(r.additionalProperties=M(s.catchall,t,{...o,path:[...o.path,"additionalProperties"]})):t.io==="output"&&(r.additionalProperties=!1)},xi=(e,t,n,o)=>{const r=e._zod.def,s=r.inclusive===!1,i=r.options.map((a,c)=>M(a,t,{...o,path:[...o.path,s?"oneOf":"anyOf",c]}));s?n.oneOf=i:n.anyOf=i},Ci=(e,t,n,o)=>{const r=e._zod.def,s=M(r.left,t,{...o,path:[...o.path,"allOf",0]}),i=M(r.right,t,{...o,path:[...o.path,"allOf",1]}),a=d=>"allOf"in d&&Object.keys(d).length===1,c=[...a(s)?s.allOf:[s],...a(i)?i.allOf:[i]];n.allOf=c},Ni=(e,t,n,o)=>{const r=n,s=e._zod.def;r.type="object";const i=s.keyType,a=i._zod.bag,c=a==null?void 0:a.patterns;if(s.mode==="loose"&&c&&c.size>0){const h=M(s.valueType,t,{...o,path:[...o.path,"patternProperties","*"]});r.patternProperties={};for(const m of c)r.patternProperties[m.source]=h}else(t.target==="draft-07"||t.target==="draft-2020-12")&&(r.propertyNames=M(s.keyType,t,{...o,path:[...o.path,"propertyNames"]})),r.additionalProperties=M(s.valueType,t,{...o,path:[...o.path,"additionalProperties"]});const d=i._zod.values;if(d){const h=[...d].filter(m=>typeof m=="string"||typeof m=="number");h.length>0&&(r.required=h)}},Ai=(e,t,n,o)=>{const r=e._zod.def,s=M(r.innerType,t,o),i=t.seen.get(e);t.target==="openapi-3.0"?(i.ref=r.innerType,n.nullable=!0):n.anyOf=[s,{type:"null"}]},qi=(e,t,n,o)=>{const r=e._zod.def;M(r.innerType,t,o);const s=t.seen.get(e);s.ref=r.innerType},Mi=(e,t,n,o)=>{const r=e._zod.def;M(r.innerType,t,o);const s=t.seen.get(e);s.ref=r.innerType,n.default=JSON.parse(JSON.stringify(r.defaultValue))},ji=(e,t,n,o)=>{const r=e._zod.def;M(r.innerType,t,o);const s=t.seen.get(e);s.ref=r.innerType,t.io==="input"&&(n._prefault=JSON.parse(JSON.stringify(r.defaultValue)))},Di=(e,t,n,o)=>{const r=e._zod.def;M(r.innerType,t,o);const s=t.seen.get(e);s.ref=r.innerType;let i;try{i=r.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}n.default=i},Ui=(e,t,n,o)=>{const r=e._zod.def,s=t.io==="input"?r.in._zod.def.type==="transform"?r.out:r.in:r.out;M(s,t,o);const i=t.seen.get(e);i.ref=s},Li=(e,t,n,o)=>{const r=e._zod.def;M(r.innerType,t,o);const s=t.seen.get(e);s.ref=r.innerType,n.readOnly=!0},xn=(e,t,n,o)=>{const r=e._zod.def;M(r.innerType,t,o);const s=t.seen.get(e);s.ref=r.innerType};function lt(e){return!!e._zod}function Cn(e,t){return lt(e)?fn(e,t):e.safeParse(t)}function Hi(e){var n,o;if(!e)return;let t;if(lt(e)?t=(o=(n=e._zod)==null?void 0:n.def)==null?void 0:o.shape:t=e.shape,!!t){if(typeof t=="function")try{return t()}catch{return}return t}}function Fi(e){var r;if(lt(e)){const i=(r=e._zod)==null?void 0:r.def;if(i){if(i.value!==void 0)return i.value;if(Array.isArray(i.values)&&i.values.length>0)return i.values[0]}}const n=e._def;if(n){if(n.value!==void 0)return n.value;if(Array.isArray(n.values)&&n.values.length>0)return n.values[0]}const o=e.value;if(o!==void 0)return o}const Ji=f("ZodISODateTime",(e,t)=>{qr.init(e,t),A.init(e,t)});function Nn(e){return Js(Ji,e)}const Vi=f("ZodISODate",(e,t)=>{Mr.init(e,t),A.init(e,t)});function Bi(e){return Vs(Vi,e)}const Wi=f("ZodISOTime",(e,t)=>{jr.init(e,t),A.init(e,t)});function Ki(e){return Bs(Wi,e)}const Gi=f("ZodISODuration",(e,t)=>{Dr.init(e,t),A.init(e,t)});function Qi(e){return Ws(Gi,e)}const Yi=(e,t)=>{pn.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:n=>Po(e,n)},flatten:{value:n=>Ro(e,n)},addIssue:{value:n=>{e.issues.push(n),e.message=JSON.stringify(e.issues,Ye,2)}},addIssues:{value:n=>{e.issues.push(...n),e.message=JSON.stringify(e.issues,Ye,2)}},isEmpty:{get(){return e.issues.length===0}}})},X=f("ZodError",Yi,{Parent:Error}),Xi=at(X),ea=ct(X),ta=He(X),na=Fe(X),oa=Zo(X),ra=Oo(X),sa=xo(X),ia=Co(X),aa=No(X),ca=Ao(X),ua=qo(X),la=Mo(X),Z=f("ZodType",(e,t)=>(E.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:je(e,"input"),output:je(e,"output")}}),e.toJSONSchema=vi(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.check=(...n)=>e.clone(ae(t,{checks:[...t.checks??[],...n.map(o=>typeof o=="function"?{_zod:{check:o,def:{check:"custom"},onattach:[]}}:o)]}),{parent:!0}),e.with=e.check,e.clone=(n,o)=>ce(e,n,o),e.brand=()=>e,e.register=((n,o)=>(n.add(e,o),e)),e.parse=(n,o)=>Xi(e,n,o,{callee:e.parse}),e.safeParse=(n,o)=>ta(e,n,o),e.parseAsync=async(n,o)=>ea(e,n,o,{callee:e.parseAsync}),e.safeParseAsync=async(n,o)=>na(e,n,o),e.spa=e.safeParseAsync,e.encode=(n,o)=>oa(e,n,o),e.decode=(n,o)=>ra(e,n,o),e.encodeAsync=async(n,o)=>sa(e,n,o),e.decodeAsync=async(n,o)=>ia(e,n,o),e.safeEncode=(n,o)=>aa(e,n,o),e.safeDecode=(n,o)=>ca(e,n,o),e.safeEncodeAsync=async(n,o)=>ua(e,n,o),e.safeDecodeAsync=async(n,o)=>la(e,n,o),e.refine=(n,o)=>e.check(nc(n,o)),e.superRefine=n=>e.check(oc(n)),e.overwrite=n=>e.check(ve(n)),e.optional=()=>q(e),e.exactOptional=()=>Ha(e),e.nullable=()=>Qt(e),e.nullish=()=>q(Qt(e)),e.nonoptional=n=>Ka(e,n),e.array=()=>k(e),e.or=n=>S([e,n]),e.and=n=>dt(e,n),e.transform=n=>nt(e,Ln(n)),e.default=n=>Va(e,n),e.prefault=n=>Wa(e,n),e.catch=n=>Qa(e,n),e.pipe=n=>nt(e,n),e.readonly=()=>ec(e),e.describe=n=>{const o=e.clone();return ye.add(o,{description:n}),o},Object.defineProperty(e,"description",{get(){var n;return(n=ye.get(e))==null?void 0:n.description},configurable:!0}),e.meta=(...n)=>{if(n.length===0)return ye.get(e);const o=e.clone();return ye.add(o,n[0]),o},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e.apply=n=>n(e),e)),An=f("_ZodString",(e,t)=>{ut.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(o,r,s)=>yi(e,o,r);const n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,e.regex=(...o)=>e.check(ni(...o)),e.includes=(...o)=>e.check(si(...o)),e.startsWith=(...o)=>e.check(ii(...o)),e.endsWith=(...o)=>e.check(ai(...o)),e.min=(...o)=>e.check(Me(...o)),e.max=(...o)=>e.check(Rn(...o)),e.length=(...o)=>e.check(Pn(...o)),e.nonempty=(...o)=>e.check(Me(1,...o)),e.lowercase=o=>e.check(oi(o)),e.uppercase=o=>e.check(ri(o)),e.trim=()=>e.check(ui()),e.normalize=(...o)=>e.check(ci(...o)),e.toLowerCase=()=>e.check(li()),e.toUpperCase=()=>e.check(di()),e.slugify=()=>e.check(pi())}),da=f("ZodString",(e,t)=>{ut.init(e,t),An.init(e,t),e.email=n=>e.check(zs(pa,n)),e.url=n=>e.check(Ps(ha,n)),e.jwt=n=>e.check(Fs(Ra,n)),e.emoji=n=>e.check(Es(fa,n)),e.guid=n=>e.check(Jt(Kt,n)),e.uuid=n=>e.check(Ts(Ce,n)),e.uuidv4=n=>e.check($s(Ce,n)),e.uuidv6=n=>e.check(Is(Ce,n)),e.uuidv7=n=>e.check(Rs(Ce,n)),e.nanoid=n=>e.check(Zs(ma,n)),e.guid=n=>e.check(Jt(Kt,n)),e.cuid=n=>e.check(Os(ga,n)),e.cuid2=n=>e.check(xs(_a,n)),e.ulid=n=>e.check(Cs(va,n)),e.base64=n=>e.check(Us(Ta,n)),e.base64url=n=>e.check(Ls($a,n)),e.xid=n=>e.check(Ns(ba,n)),e.ksuid=n=>e.check(As(ya,n)),e.ipv4=n=>e.check(qs(ka,n)),e.ipv6=n=>e.check(Ms(wa,n)),e.cidrv4=n=>e.check(js(Sa,n)),e.cidrv6=n=>e.check(Ds(za,n)),e.e164=n=>e.check(Hs(Ia,n)),e.datetime=n=>e.check(Nn(n)),e.date=n=>e.check(Bi(n)),e.time=n=>e.check(Ki(n)),e.duration=n=>e.check(Qi(n))});function l(e){return Ss(da,e)}const A=f("ZodStringFormat",(e,t)=>{O.init(e,t),An.init(e,t)}),pa=f("ZodEmail",(e,t)=>{Rr.init(e,t),A.init(e,t)}),Kt=f("ZodGUID",(e,t)=>{$r.init(e,t),A.init(e,t)}),Ce=f("ZodUUID",(e,t)=>{Ir.init(e,t),A.init(e,t)}),ha=f("ZodURL",(e,t)=>{Pr.init(e,t),A.init(e,t)}),fa=f("ZodEmoji",(e,t)=>{Er.init(e,t),A.init(e,t)}),ma=f("ZodNanoID",(e,t)=>{Zr.init(e,t),A.init(e,t)}),ga=f("ZodCUID",(e,t)=>{Or.init(e,t),A.init(e,t)}),_a=f("ZodCUID2",(e,t)=>{xr.init(e,t),A.init(e,t)}),va=f("ZodULID",(e,t)=>{Cr.init(e,t),A.init(e,t)}),ba=f("ZodXID",(e,t)=>{Nr.init(e,t),A.init(e,t)}),ya=f("ZodKSUID",(e,t)=>{Ar.init(e,t),A.init(e,t)}),ka=f("ZodIPv4",(e,t)=>{Ur.init(e,t),A.init(e,t)}),wa=f("ZodIPv6",(e,t)=>{Lr.init(e,t),A.init(e,t)}),Sa=f("ZodCIDRv4",(e,t)=>{Hr.init(e,t),A.init(e,t)}),za=f("ZodCIDRv6",(e,t)=>{Fr.init(e,t),A.init(e,t)}),Ta=f("ZodBase64",(e,t)=>{Jr.init(e,t),A.init(e,t)}),$a=f("ZodBase64URL",(e,t)=>{Br.init(e,t),A.init(e,t)}),Ia=f("ZodE164",(e,t)=>{Wr.init(e,t),A.init(e,t)}),Ra=f("ZodJWT",(e,t)=>{Gr.init(e,t),A.init(e,t)}),qn=f("ZodNumber",(e,t)=>{Sn.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(o,r,s)=>ki(e,o,r),e.gt=(o,r)=>e.check(Bt(o,r)),e.gte=(o,r)=>e.check(Qe(o,r)),e.min=(o,r)=>e.check(Qe(o,r)),e.lt=(o,r)=>e.check(Vt(o,r)),e.lte=(o,r)=>e.check(Ge(o,r)),e.max=(o,r)=>e.check(Ge(o,r)),e.int=o=>e.check(Gt(o)),e.safe=o=>e.check(Gt(o)),e.positive=o=>e.check(Bt(0,o)),e.nonnegative=o=>e.check(Qe(0,o)),e.negative=o=>e.check(Vt(0,o)),e.nonpositive=o=>e.check(Ge(0,o)),e.multipleOf=(o,r)=>e.check(Wt(o,r)),e.step=(o,r)=>e.check(Wt(o,r)),e.finite=()=>e;const n=e._zod.bag;e.minValue=Math.max(n.minimum??Number.NEGATIVE_INFINITY,n.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(n.maximum??Number.POSITIVE_INFINITY,n.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(n.format??"").includes("int")||Number.isSafeInteger(n.multipleOf??.5),e.isFinite=!0,e.format=n.format??null});function w(e){return Ks(qn,e)}const Pa=f("ZodNumberFormat",(e,t)=>{Qr.init(e,t),qn.init(e,t)});function Gt(e){return Gs(Pa,e)}const Ea=f("ZodBoolean",(e,t)=>{Yr.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(n,o,r)=>wi(e,n,o)});function P(e){return Qs(Ea,e)}const Za=f("ZodUndefined",(e,t)=>{Xr.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(n,o,r)=>zi(e,n)});function et(e){return Ys(Za,e)}const Oa=f("ZodNull",(e,t)=>{es.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(n,o,r)=>Si(e,n,o)});function Mn(e){return Xs(Oa,e)}const xa=f("ZodUnknown",(e,t)=>{ts.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(n,o,r)=>$i()});function R(){return ei(xa)}const Ca=f("ZodNever",(e,t)=>{ns.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(n,o,r)=>Ti(e,n,o)});function Na(e){return ti(Ca,e)}const Aa=f("ZodArray",(e,t)=>{os.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(n,o,r)=>Zi(e,n,o,r),e.element=t.element,e.min=(n,o)=>e.check(Me(n,o)),e.nonempty=n=>e.check(Me(1,n)),e.max=(n,o)=>e.check(Rn(n,o)),e.length=(n,o)=>e.check(Pn(n,o)),e.unwrap=()=>e.element});function k(e,t){return hi(Aa,e,t)}const jn=f("ZodObject",(e,t)=>{ss.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(n,o,r)=>Oi(e,n,o,r),T(e,"shape",()=>t.shape),e.keyof=()=>G(Object.keys(e._zod.def.shape)),e.catchall=n=>e.clone({...e._zod.def,catchall:n}),e.passthrough=()=>e.clone({...e._zod.def,catchall:R()}),e.loose=()=>e.clone({...e._zod.def,catchall:R()}),e.strict=()=>e.clone({...e._zod.def,catchall:Na()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=n=>So(e,n),e.safeExtend=n=>zo(e,n),e.merge=n=>To(e,n),e.pick=n=>ko(e,n),e.omit=n=>wo(e,n),e.partial=(...n)=>$o(Hn,e,n[0]),e.required=(...n)=>Io(Fn,e,n[0])});function p(e,t){const n={type:"object",shape:e??{},...v(t)};return new jn(n)}function V(e,t){return new jn({type:"object",shape:e,catchall:R(),...v(t)})}const Dn=f("ZodUnion",(e,t)=>{$n.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(n,o,r)=>xi(e,n,o,r),e.options=t.options});function S(e,t){return new Dn({type:"union",options:e,...v(t)})}const qa=f("ZodDiscriminatedUnion",(e,t)=>{Dn.init(e,t),is.init(e,t)});function Un(e,t,n){return new qa({type:"union",options:t,discriminator:e,...v(n)})}const Ma=f("ZodIntersection",(e,t)=>{as.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(n,o,r)=>Ci(e,n,o,r)});function dt(e,t){return new Ma({type:"intersection",left:e,right:t})}const ja=f("ZodRecord",(e,t)=>{cs.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(n,o,r)=>Ni(e,n,o,r),e.keyType=t.keyType,e.valueType=t.valueType});function I(e,t,n){return new ja({type:"record",keyType:e,valueType:t,...v(n)})}const tt=f("ZodEnum",(e,t)=>{us.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(o,r,s)=>Ii(e,o,r),e.enum=t.entries,e.options=Object.values(t.entries);const n=new Set(Object.keys(t.entries));e.extract=(o,r)=>{const s={};for(const i of o)if(n.has(i))s[i]=t.entries[i];else throw new Error(`Key ${i} not found in enum`);return new tt({...t,checks:[],...v(r),entries:s})},e.exclude=(o,r)=>{const s={...t.entries};for(const i of o)if(n.has(i))delete s[i];else throw new Error(`Key ${i} not found in enum`);return new tt({...t,checks:[],...v(r),entries:s})}});function G(e,t){const n=Array.isArray(e)?Object.fromEntries(e.map(o=>[o,o])):e;return new tt({type:"enum",entries:n,...v(t)})}const Da=f("ZodLiteral",(e,t)=>{ls.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(n,o,r)=>Ri(e,n,o),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function u(e,t){return new Da({type:"literal",values:Array.isArray(e)?e:[e],...v(t)})}const Ua=f("ZodTransform",(e,t)=>{ds.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(n,o,r)=>Ei(e,n),e._zod.parse=(n,o)=>{if(o.direction==="backward")throw new sn(e.constructor.name);n.addIssue=s=>{if(typeof s=="string")n.issues.push(we(s,n.value,t));else{const i=s;i.fatal&&(i.continue=!1),i.code??(i.code="custom"),i.input??(i.input=n.value),i.inst??(i.inst=e),n.issues.push(we(i))}};const r=t.transform(n.value,n);return r instanceof Promise?r.then(s=>(n.value=s,n)):(n.value=r,n)}});function Ln(e){return new Ua({type:"transform",transform:e})}const Hn=f("ZodOptional",(e,t)=>{In.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(n,o,r)=>xn(e,n,o,r),e.unwrap=()=>e._zod.def.innerType});function q(e){return new Hn({type:"optional",innerType:e})}const La=f("ZodExactOptional",(e,t)=>{ps.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(n,o,r)=>xn(e,n,o,r),e.unwrap=()=>e._zod.def.innerType});function Ha(e){return new La({type:"optional",innerType:e})}const Fa=f("ZodNullable",(e,t)=>{hs.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(n,o,r)=>Ai(e,n,o,r),e.unwrap=()=>e._zod.def.innerType});function Qt(e){return new Fa({type:"nullable",innerType:e})}const Ja=f("ZodDefault",(e,t)=>{fs.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(n,o,r)=>Mi(e,n,o,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Va(e,t){return new Ja({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():ln(t)}})}const Ba=f("ZodPrefault",(e,t)=>{ms.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(n,o,r)=>ji(e,n,o,r),e.unwrap=()=>e._zod.def.innerType});function Wa(e,t){return new Ba({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():ln(t)}})}const Fn=f("ZodNonOptional",(e,t)=>{gs.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(n,o,r)=>qi(e,n,o,r),e.unwrap=()=>e._zod.def.innerType});function Ka(e,t){return new Fn({type:"nonoptional",innerType:e,...v(t)})}const Ga=f("ZodCatch",(e,t)=>{_s.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(n,o,r)=>Di(e,n,o,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Qa(e,t){return new Ga({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}const Ya=f("ZodPipe",(e,t)=>{vs.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(n,o,r)=>Ui(e,n,o,r),e.in=t.in,e.out=t.out});function nt(e,t){return new Ya({type:"pipe",in:e,out:t})}const Xa=f("ZodReadonly",(e,t)=>{bs.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(n,o,r)=>Li(e,n,o,r),e.unwrap=()=>e._zod.def.innerType});function ec(e){return new Xa({type:"readonly",innerType:e})}const Jn=f("ZodCustom",(e,t)=>{ys.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(n,o,r)=>Pi(e,n)});function tc(e,t){return fi(Jn,e??(()=>!0),t)}function nc(e,t={}){return mi(Jn,e,t)}function oc(e){return gi(e)}function Vn(e,t){return nt(Ln(e),t)}const le="io.modelcontextprotocol/related-task",Ve="2.0",D=tc(e=>e!==null&&(typeof e=="object"||typeof e=="function")),Bn=S([l(),w().int()]),Wn=l();V({ttl:S([w(),Mn()]).optional(),pollInterval:w().optional()});const rc=p({ttl:w().optional()}),sc=p({taskId:l()}),pt=V({progressToken:Bn.optional(),[le]:sc.optional()}),Q=p({_meta:pt.optional()}),ze=Q.extend({task:rc.optional()}),ic=e=>ze.safeParse(e).success,U=p({method:l(),params:Q.loose().optional()}),ee=p({_meta:pt.optional()}),te=p({method:l(),params:ee.loose().optional()}),L=V({_meta:pt.optional()}),Te=S([l(),w().int()]),Kn=p({jsonrpc:u(Ve),id:Te,...U.shape}).strict(),Yt=e=>Kn.safeParse(e).success,Gn=p({jsonrpc:u(Ve),...te.shape}).strict(),ac=e=>Gn.safeParse(e).success,ht=p({jsonrpc:u(Ve),id:Te,result:L}).strict(),Ne=e=>ht.safeParse(e).success;var $;(function(e){e[e.ConnectionClosed=-32e3]="ConnectionClosed",e[e.RequestTimeout=-32001]="RequestTimeout",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.UrlElicitationRequired=-32042]="UrlElicitationRequired"})($||($={}));const ft=p({jsonrpc:u(Ve),id:Te.optional(),error:p({code:w().int(),message:l(),data:R().optional()})}).strict(),cc=e=>ft.safeParse(e).success,uc=S([Kn,Gn,ht,ft]);S([ht,ft]);const mt=L.strict(),lc=ee.extend({requestId:Te.optional(),reason:l().optional()}),gt=te.extend({method:u("notifications/cancelled"),params:lc}),dc=p({src:l(),mimeType:l().optional(),sizes:k(l()).optional(),theme:G(["light","dark"]).optional()}),$e=p({icons:k(dc).optional()}),_e=p({name:l(),title:l().optional()}),Be=_e.extend({..._e.shape,...$e.shape,version:l(),websiteUrl:l().optional(),description:l().optional()}),pc=dt(p({applyDefaults:P().optional()}),I(l(),R())),hc=Vn(e=>e&&typeof e=="object"&&!Array.isArray(e)&&Object.keys(e).length===0?{form:{}}:e,dt(p({form:pc.optional(),url:D.optional()}),I(l(),R()).optional())),fc=V({list:D.optional(),cancel:D.optional(),requests:V({sampling:V({createMessage:D.optional()}).optional(),elicitation:V({create:D.optional()}).optional()}).optional()}),mc=V({list:D.optional(),cancel:D.optional(),requests:V({tools:V({call:D.optional()}).optional()}).optional()}),gc=p({experimental:I(l(),D).optional(),sampling:p({context:D.optional(),tools:D.optional()}).optional(),elicitation:hc.optional(),roots:p({listChanged:P().optional()}).optional(),tasks:fc.optional()}),_c=Q.extend({protocolVersion:l(),capabilities:gc,clientInfo:Be}),vc=U.extend({method:u("initialize"),params:_c}),bc=p({experimental:I(l(),D).optional(),logging:D.optional(),completions:D.optional(),prompts:p({listChanged:P().optional()}).optional(),resources:p({subscribe:P().optional(),listChanged:P().optional()}).optional(),tools:p({listChanged:P().optional()}).optional(),tasks:mc.optional()}),yc=L.extend({protocolVersion:l(),capabilities:bc,serverInfo:Be,instructions:l().optional()}),kc=te.extend({method:u("notifications/initialized"),params:ee.optional()}),We=U.extend({method:u("ping"),params:Q.optional()}),wc=p({progress:w(),total:q(w()),message:q(l())}),Sc=p({...ee.shape,...wc.shape,progressToken:Bn}),_t=te.extend({method:u("notifications/progress"),params:Sc}),zc=Q.extend({cursor:Wn.optional()}),Ie=U.extend({params:zc.optional()}),Re=L.extend({nextCursor:Wn.optional()}),Tc=G(["working","input_required","completed","failed","cancelled"]),Pe=p({taskId:l(),status:Tc,ttl:S([w(),Mn()]),createdAt:l(),lastUpdatedAt:l(),pollInterval:q(w()),statusMessage:q(l())}),vt=L.extend({task:Pe}),$c=ee.merge(Pe),De=te.extend({method:u("notifications/tasks/status"),params:$c}),bt=U.extend({method:u("tasks/get"),params:Q.extend({taskId:l()})}),yt=L.merge(Pe),kt=U.extend({method:u("tasks/result"),params:Q.extend({taskId:l()})});L.loose();const wt=Ie.extend({method:u("tasks/list")}),St=Re.extend({tasks:k(Pe)}),zt=U.extend({method:u("tasks/cancel"),params:Q.extend({taskId:l()})}),Ic=L.merge(Pe),Qn=p({uri:l(),mimeType:q(l()),_meta:I(l(),R()).optional()}),Yn=Qn.extend({text:l()}),Tt=l().refine(e=>{try{return atob(e),!0}catch{return!1}},{message:"Invalid Base64 string"}),Xn=Qn.extend({blob:Tt}),Ee=G(["user","assistant"]),be=p({audience:k(Ee).optional(),priority:w().min(0).max(1).optional(),lastModified:Nn({offset:!0}).optional()}),eo=p({..._e.shape,...$e.shape,uri:l(),description:q(l()),mimeType:q(l()),annotations:be.optional(),_meta:q(V({}))}),Rc=p({..._e.shape,...$e.shape,uriTemplate:l(),description:q(l()),mimeType:q(l()),annotations:be.optional(),_meta:q(V({}))}),Pc=Ie.extend({method:u("resources/list")}),to=Re.extend({resources:k(eo)}),Ec=Ie.extend({method:u("resources/templates/list")}),Zc=Re.extend({resourceTemplates:k(Rc)}),$t=Q.extend({uri:l()}),Oc=$t,xc=U.extend({method:u("resources/read"),params:Oc}),no=L.extend({contents:k(S([Yn,Xn]))}),Cc=te.extend({method:u("notifications/resources/list_changed"),params:ee.optional()}),Nc=$t,Ac=U.extend({method:u("resources/subscribe"),params:Nc}),qc=$t,Mc=U.extend({method:u("resources/unsubscribe"),params:qc}),jc=ee.extend({uri:l()}),Dc=te.extend({method:u("notifications/resources/updated"),params:jc}),Uc=p({name:l(),description:q(l()),required:q(P())}),Lc=p({..._e.shape,...$e.shape,description:q(l()),arguments:q(k(Uc)),_meta:q(V({}))}),Hc=Ie.extend({method:u("prompts/list")}),Fc=Re.extend({prompts:k(Lc)}),Jc=Q.extend({name:l(),arguments:I(l(),l()).optional()}),Vc=U.extend({method:u("prompts/get"),params:Jc}),It=p({type:u("text"),text:l(),annotations:be.optional(),_meta:I(l(),R()).optional()}),Rt=p({type:u("image"),data:Tt,mimeType:l(),annotations:be.optional(),_meta:I(l(),R()).optional()}),Pt=p({type:u("audio"),data:Tt,mimeType:l(),annotations:be.optional(),_meta:I(l(),R()).optional()}),Bc=p({type:u("tool_use"),name:l(),id:l(),input:I(l(),R()),_meta:I(l(),R()).optional()}),oo=p({type:u("resource"),resource:S([Yn,Xn]),annotations:be.optional(),_meta:I(l(),R()).optional()}),ro=eo.extend({type:u("resource_link")}),Ze=S([It,Rt,Pt,ro,oo]),Wc=p({role:Ee,content:Ze}),Kc=L.extend({description:l().optional(),messages:k(Wc)}),Gc=te.extend({method:u("notifications/prompts/list_changed"),params:ee.optional()}),Qc=p({title:l().optional(),readOnlyHint:P().optional(),destructiveHint:P().optional(),idempotentHint:P().optional(),openWorldHint:P().optional()}),Yc=p({taskSupport:G(["required","optional","forbidden"]).optional()}),Et=p({..._e.shape,...$e.shape,description:l().optional(),inputSchema:p({type:u("object"),properties:I(l(),D).optional(),required:k(l()).optional()}).catchall(R()),outputSchema:p({type:u("object"),properties:I(l(),D).optional(),required:k(l()).optional()}).catchall(R()).optional(),annotations:Qc.optional(),execution:Yc.optional(),_meta:I(l(),R()).optional()}),so=Ie.extend({method:u("tools/list")}),Xc=Re.extend({tools:k(Et)}),Ke=L.extend({content:k(Ze).default([]),structuredContent:I(l(),R()).optional(),isError:P().optional()});Ke.or(L.extend({toolResult:R()}));const eu=ze.extend({name:l(),arguments:I(l(),R()).optional()}),io=U.extend({method:u("tools/call"),params:eu}),tu=te.extend({method:u("notifications/tools/list_changed"),params:ee.optional()});p({autoRefresh:P().default(!0),debounceMs:w().int().nonnegative().default(300)});const ao=G(["debug","info","notice","warning","error","critical","alert","emergency"]),nu=Q.extend({level:ao}),ou=U.extend({method:u("logging/setLevel"),params:nu}),ru=ee.extend({level:ao,logger:l().optional(),data:R()}),su=te.extend({method:u("notifications/message"),params:ru}),iu=p({name:l().optional()}),au=p({hints:k(iu).optional(),costPriority:w().min(0).max(1).optional(),speedPriority:w().min(0).max(1).optional(),intelligencePriority:w().min(0).max(1).optional()}),cu=p({mode:G(["auto","required","none"]).optional()}),uu=p({type:u("tool_result"),toolUseId:l().describe("The unique identifier for the corresponding tool call."),content:k(Ze).default([]),structuredContent:p({}).loose().optional(),isError:P().optional(),_meta:I(l(),R()).optional()}),lu=Un("type",[It,Rt,Pt]),Ue=Un("type",[It,Rt,Pt,Bc,uu]),du=p({role:Ee,content:S([Ue,k(Ue)]),_meta:I(l(),R()).optional()}),pu=ze.extend({messages:k(du),modelPreferences:au.optional(),systemPrompt:l().optional(),includeContext:G(["none","thisServer","allServers"]).optional(),temperature:w().optional(),maxTokens:w().int(),stopSequences:k(l()).optional(),metadata:D.optional(),tools:k(Et).optional(),toolChoice:cu.optional()}),hu=U.extend({method:u("sampling/createMessage"),params:pu}),fu=L.extend({model:l(),stopReason:q(G(["endTurn","stopSequence","maxTokens"]).or(l())),role:Ee,content:lu}),mu=L.extend({model:l(),stopReason:q(G(["endTurn","stopSequence","maxTokens","toolUse"]).or(l())),role:Ee,content:S([Ue,k(Ue)])}),gu=p({type:u("boolean"),title:l().optional(),description:l().optional(),default:P().optional()}),_u=p({type:u("string"),title:l().optional(),description:l().optional(),minLength:w().optional(),maxLength:w().optional(),format:G(["email","uri","date","date-time"]).optional(),default:l().optional()}),vu=p({type:G(["number","integer"]),title:l().optional(),description:l().optional(),minimum:w().optional(),maximum:w().optional(),default:w().optional()}),bu=p({type:u("string"),title:l().optional(),description:l().optional(),enum:k(l()),default:l().optional()}),yu=p({type:u("string"),title:l().optional(),description:l().optional(),oneOf:k(p({const:l(),title:l()})),default:l().optional()}),ku=p({type:u("string"),title:l().optional(),description:l().optional(),enum:k(l()),enumNames:k(l()).optional(),default:l().optional()}),wu=S([bu,yu]),Su=p({type:u("array"),title:l().optional(),description:l().optional(),minItems:w().optional(),maxItems:w().optional(),items:p({type:u("string"),enum:k(l())}),default:k(l()).optional()}),zu=p({type:u("array"),title:l().optional(),description:l().optional(),minItems:w().optional(),maxItems:w().optional(),items:p({anyOf:k(p({const:l(),title:l()}))}),default:k(l()).optional()}),Tu=S([Su,zu]),$u=S([ku,wu,Tu]),Iu=S([$u,gu,_u,vu]),Ru=ze.extend({mode:u("form").optional(),message:l(),requestedSchema:p({type:u("object"),properties:I(l(),Iu),required:k(l()).optional()})}),Pu=ze.extend({mode:u("url"),message:l(),elicitationId:l(),url:l().url()}),Eu=S([Ru,Pu]),Zu=U.extend({method:u("elicitation/create"),params:Eu}),Ou=ee.extend({elicitationId:l()}),xu=te.extend({method:u("notifications/elicitation/complete"),params:Ou}),Cu=L.extend({action:G(["accept","decline","cancel"]),content:Vn(e=>e===null?void 0:e,I(l(),S([l(),w(),P(),k(l())])).optional())}),Nu=p({type:u("ref/resource"),uri:l()}),Au=p({type:u("ref/prompt"),name:l()}),qu=Q.extend({ref:S([Au,Nu]),argument:p({name:l(),value:l()}),context:p({arguments:I(l(),l()).optional()}).optional()}),Mu=U.extend({method:u("completion/complete"),params:qu}),ju=L.extend({completion:V({values:k(l()).max(100),total:q(w().int()),hasMore:q(P())})}),Du=p({uri:l().startsWith("file://"),name:l().optional(),_meta:I(l(),R()).optional()}),Uu=U.extend({method:u("roots/list"),params:Q.optional()}),Lu=L.extend({roots:k(Du)}),Hu=te.extend({method:u("notifications/roots/list_changed"),params:ee.optional()});S([We,vc,Mu,ou,Vc,Hc,Pc,Ec,xc,Ac,Mc,io,so,bt,kt,wt,zt]);S([gt,_t,kc,Hu,De]);S([mt,fu,mu,Cu,Lu,yt,St,vt]);S([We,hu,Zu,Uu,bt,kt,wt,zt]);S([gt,_t,su,Dc,Cc,tu,Gc,De,xu]);S([mt,yc,ju,Kc,Fc,to,Zc,no,Ke,Xc,yt,St,vt]);class z extends Error{constructor(t,n,o){super(`MCP error ${t}: ${n}`),this.code=t,this.data=o,this.name="McpError"}static fromError(t,n,o){if(t===$.UrlElicitationRequired&&o){const r=o;if(r.elicitations)return new Fu(r.elicitations,n)}return new z(t,n,o)}}class Fu extends z{constructor(t,n=`URL elicitation${t.length>1?"s":""} required`){super($.UrlElicitationRequired,n,{elicitations:t})}get elicitations(){var t;return((t=this.data)==null?void 0:t.elicitations)??[]}}function ue(e){return e==="completed"||e==="failed"||e==="cancelled"}new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function Xt(e){const t=Hi(e),n=t==null?void 0:t.method;if(!n)throw new Error("Schema is missing a method literal");const o=Fi(n);if(typeof o!="string")throw new Error("Schema method literal must be a string");return o}function en(e,t){const n=Cn(e,t);if(!n.success)throw n.error;return n.data}const Ju=6e4;class Vu{constructor(t){this._options=t,this._requestMessageId=0,this._requestHandlers=new Map,this._requestHandlerAbortControllers=new Map,this._notificationHandlers=new Map,this._responseHandlers=new Map,this._progressHandlers=new Map,this._timeoutInfo=new Map,this._pendingDebouncedNotifications=new Set,this._taskProgressTokens=new Map,this._requestResolvers=new Map,this.setNotificationHandler(gt,n=>{this._oncancel(n)}),this.setNotificationHandler(_t,n=>{this._onprogress(n)}),this.setRequestHandler(We,n=>({})),this._taskStore=t==null?void 0:t.taskStore,this._taskMessageQueue=t==null?void 0:t.taskMessageQueue,this._taskStore&&(this.setRequestHandler(bt,async(n,o)=>{const r=await this._taskStore.getTask(n.params.taskId,o.sessionId);if(!r)throw new z($.InvalidParams,"Failed to retrieve task: Task not found");return{...r}}),this.setRequestHandler(kt,async(n,o)=>{const r=async()=>{var a;const s=n.params.taskId;if(this._taskMessageQueue){let c;for(;c=await this._taskMessageQueue.dequeue(s,o.sessionId);){if(c.type==="response"||c.type==="error"){const d=c.message,h=d.id,m=this._requestResolvers.get(h);if(m)if(this._requestResolvers.delete(h),c.type==="response")m(d);else{const g=d,_=new z(g.error.code,g.error.message,g.error.data);m(_)}else{const g=c.type==="response"?"Response":"Error";this._onerror(new Error(`${g} handler missing for request ${h}`))}continue}await((a=this._transport)==null?void 0:a.send(c.message,{relatedRequestId:o.requestId}))}}const i=await this._taskStore.getTask(s,o.sessionId);if(!i)throw new z($.InvalidParams,`Task not found: ${s}`);if(!ue(i.status))return await this._waitForTaskUpdate(s,o.signal),await r();if(ue(i.status)){const c=await this._taskStore.getTaskResult(s,o.sessionId);return this._clearTaskQueue(s),{...c,_meta:{...c._meta,[le]:{taskId:s}}}}return await r()};return await r()}),this.setRequestHandler(wt,async(n,o)=>{var r;try{const{tasks:s,nextCursor:i}=await this._taskStore.listTasks((r=n.params)==null?void 0:r.cursor,o.sessionId);return{tasks:s,nextCursor:i,_meta:{}}}catch(s){throw new z($.InvalidParams,`Failed to list tasks: ${s instanceof Error?s.message:String(s)}`)}}),this.setRequestHandler(zt,async(n,o)=>{try{const r=await this._taskStore.getTask(n.params.taskId,o.sessionId);if(!r)throw new z($.InvalidParams,`Task not found: ${n.params.taskId}`);if(ue(r.status))throw new z($.InvalidParams,`Cannot cancel task in terminal status: ${r.status}`);await this._taskStore.updateTaskStatus(n.params.taskId,"cancelled","Client cancelled task execution.",o.sessionId),this._clearTaskQueue(n.params.taskId);const s=await this._taskStore.getTask(n.params.taskId,o.sessionId);if(!s)throw new z($.InvalidParams,`Task not found after cancellation: ${n.params.taskId}`);return{_meta:{},...s}}catch(r){throw r instanceof z?r:new z($.InvalidRequest,`Failed to cancel task: ${r instanceof Error?r.message:String(r)}`)}}))}async _oncancel(t){if(!t.params.requestId)return;const n=this._requestHandlerAbortControllers.get(t.params.requestId);n==null||n.abort(t.params.reason)}_setupTimeout(t,n,o,r,s=!1){this._timeoutInfo.set(t,{timeoutId:setTimeout(r,n),startTime:Date.now(),timeout:n,maxTotalTimeout:o,resetTimeoutOnProgress:s,onTimeout:r})}_resetTimeout(t){const n=this._timeoutInfo.get(t);if(!n)return!1;const o=Date.now()-n.startTime;if(n.maxTotalTimeout&&o>=n.maxTotalTimeout)throw this._timeoutInfo.delete(t),z.fromError($.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:n.maxTotalTimeout,totalElapsed:o});return clearTimeout(n.timeoutId),n.timeoutId=setTimeout(n.onTimeout,n.timeout),!0}_cleanupTimeout(t){const n=this._timeoutInfo.get(t);n&&(clearTimeout(n.timeoutId),this._timeoutInfo.delete(t))}async connect(t){var s,i,a;this._transport=t;const n=(s=this.transport)==null?void 0:s.onclose;this._transport.onclose=()=>{n==null||n(),this._onclose()};const o=(i=this.transport)==null?void 0:i.onerror;this._transport.onerror=c=>{o==null||o(c),this._onerror(c)};const r=(a=this._transport)==null?void 0:a.onmessage;this._transport.onmessage=(c,d)=>{r==null||r(c,d),Ne(c)||cc(c)?this._onresponse(c):Yt(c)?this._onrequest(c,d):ac(c)?this._onnotification(c):this._onerror(new Error(`Unknown message type: ${JSON.stringify(c)}`))},await this._transport.start()}_onclose(){var o;const t=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._taskProgressTokens.clear(),this._pendingDebouncedNotifications.clear();const n=z.fromError($.ConnectionClosed,"Connection closed");this._transport=void 0,(o=this.onclose)==null||o.call(this);for(const r of t.values())r(n)}_onerror(t){var n;(n=this.onerror)==null||n.call(this,t)}_onnotification(t){const n=this._notificationHandlers.get(t.method)??this.fallbackNotificationHandler;n!==void 0&&Promise.resolve().then(()=>n(t)).catch(o=>this._onerror(new Error(`Uncaught error in notification handler: ${o}`)))}_onrequest(t,n){var h,m,g,_;const o=this._requestHandlers.get(t.method)??this.fallbackRequestHandler,r=this._transport,s=(g=(m=(h=t.params)==null?void 0:h._meta)==null?void 0:m[le])==null?void 0:g.taskId;if(o===void 0){const b={jsonrpc:"2.0",id:t.id,error:{code:$.MethodNotFound,message:"Method not found"}};s&&this._taskMessageQueue?this._enqueueTaskMessage(s,{type:"error",message:b,timestamp:Date.now()},r==null?void 0:r.sessionId).catch(y=>this._onerror(new Error(`Failed to enqueue error response: ${y}`))):r==null||r.send(b).catch(y=>this._onerror(new Error(`Failed to send an error response: ${y}`)));return}const i=new AbortController;this._requestHandlerAbortControllers.set(t.id,i);const a=ic(t.params)?t.params.task:void 0,c=this._taskStore?this.requestTaskStore(t,r==null?void 0:r.sessionId):void 0,d={signal:i.signal,sessionId:r==null?void 0:r.sessionId,_meta:(_=t.params)==null?void 0:_._meta,sendNotification:async b=>{const y={relatedRequestId:t.id};s&&(y.relatedTask={taskId:s}),await this.notification(b,y)},sendRequest:async(b,y,x)=>{var oe;const W={...x,relatedRequestId:t.id};s&&!W.relatedTask&&(W.relatedTask={taskId:s});const C=((oe=W.relatedTask)==null?void 0:oe.taskId)??s;return C&&c&&await c.updateTaskStatus(C,"input_required"),await this.request(b,y,W)},authInfo:n==null?void 0:n.authInfo,requestId:t.id,requestInfo:n==null?void 0:n.requestInfo,taskId:s,taskStore:c,taskRequestedTtl:a==null?void 0:a.ttl,closeSSEStream:n==null?void 0:n.closeSSEStream,closeStandaloneSSEStream:n==null?void 0:n.closeStandaloneSSEStream};Promise.resolve().then(()=>{a&&this.assertTaskHandlerCapability(t.method)}).then(()=>o(t,d)).then(async b=>{if(i.signal.aborted)return;const y={result:b,jsonrpc:"2.0",id:t.id};s&&this._taskMessageQueue?await this._enqueueTaskMessage(s,{type:"response",message:y,timestamp:Date.now()},r==null?void 0:r.sessionId):await(r==null?void 0:r.send(y))},async b=>{if(i.signal.aborted)return;const y={jsonrpc:"2.0",id:t.id,error:{code:Number.isSafeInteger(b.code)?b.code:$.InternalError,message:b.message??"Internal error",...b.data!==void 0&&{data:b.data}}};s&&this._taskMessageQueue?await this._enqueueTaskMessage(s,{type:"error",message:y,timestamp:Date.now()},r==null?void 0:r.sessionId):await(r==null?void 0:r.send(y))}).catch(b=>this._onerror(new Error(`Failed to send response: ${b}`))).finally(()=>{this._requestHandlerAbortControllers.delete(t.id)})}_onprogress(t){const{progressToken:n,...o}=t.params,r=Number(n),s=this._progressHandlers.get(r);if(!s){this._onerror(new Error(`Received a progress notification for an unknown token: ${JSON.stringify(t)}`));return}const i=this._responseHandlers.get(r),a=this._timeoutInfo.get(r);if(a&&i&&a.resetTimeoutOnProgress)try{this._resetTimeout(r)}catch(c){this._responseHandlers.delete(r),this._progressHandlers.delete(r),this._cleanupTimeout(r),i(c);return}s(o)}_onresponse(t){const n=Number(t.id),o=this._requestResolvers.get(n);if(o){if(this._requestResolvers.delete(n),Ne(t))o(t);else{const i=new z(t.error.code,t.error.message,t.error.data);o(i)}return}const r=this._responseHandlers.get(n);if(r===void 0){this._onerror(new Error(`Received a response for an unknown message ID: ${JSON.stringify(t)}`));return}this._responseHandlers.delete(n),this._cleanupTimeout(n);let s=!1;if(Ne(t)&&t.result&&typeof t.result=="object"){const i=t.result;if(i.task&&typeof i.task=="object"){const a=i.task;typeof a.taskId=="string"&&(s=!0,this._taskProgressTokens.set(a.taskId,n))}}if(s||this._progressHandlers.delete(n),Ne(t))r(t);else{const i=z.fromError(t.error.code,t.error.message,t.error.data);r(i)}}get transport(){return this._transport}async close(){var t;await((t=this._transport)==null?void 0:t.close())}async*requestStream(t,n,o){var i,a;const{task:r}=o??{};if(!r){try{yield{type:"result",result:await this.request(t,n,o)}}catch(c){yield{type:"error",error:c instanceof z?c:new z($.InternalError,String(c))}}return}let s;try{const c=await this.request(t,vt,o);if(c.task)s=c.task.taskId,yield{type:"taskCreated",task:c.task};else throw new z($.InternalError,"Task creation did not return a task");for(;;){const d=await this.getTask({taskId:s},o);if(yield{type:"taskStatus",task:d},ue(d.status)){d.status==="completed"?yield{type:"result",result:await this.getTaskResult({taskId:s},n,o)}:d.status==="failed"?yield{type:"error",error:new z($.InternalError,`Task ${s} failed`)}:d.status==="cancelled"&&(yield{type:"error",error:new z($.InternalError,`Task ${s} was cancelled`)});return}if(d.status==="input_required"){yield{type:"result",result:await this.getTaskResult({taskId:s},n,o)};return}const h=d.pollInterval??((i=this._options)==null?void 0:i.defaultTaskPollInterval)??1e3;await new Promise(m=>setTimeout(m,h)),(a=o==null?void 0:o.signal)==null||a.throwIfAborted()}}catch(c){yield{type:"error",error:c instanceof z?c:new z($.InternalError,String(c))}}}request(t,n,o){const{relatedRequestId:r,resumptionToken:s,onresumptiontoken:i,task:a,relatedTask:c}=o??{};return new Promise((d,h)=>{var C,oe,K,j,J;const m=N=>{h(N)};if(!this._transport){m(new Error("Not connected"));return}if(((C=this._options)==null?void 0:C.enforceStrictCapabilities)===!0)try{this.assertCapabilityForMethod(t.method),a&&this.assertTaskCapability(t.method)}catch(N){m(N);return}(oe=o==null?void 0:o.signal)==null||oe.throwIfAborted();const g=this._requestMessageId++,_={...t,jsonrpc:"2.0",id:g};o!=null&&o.onprogress&&(this._progressHandlers.set(g,o.onprogress),_.params={...t.params,_meta:{...((K=t.params)==null?void 0:K._meta)||{},progressToken:g}}),a&&(_.params={..._.params,task:a}),c&&(_.params={..._.params,_meta:{...((j=_.params)==null?void 0:j._meta)||{},[le]:c}});const b=N=>{var ne;this._responseHandlers.delete(g),this._progressHandlers.delete(g),this._cleanupTimeout(g),(ne=this._transport)==null||ne.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:g,reason:String(N)}},{relatedRequestId:r,resumptionToken:s,onresumptiontoken:i}).catch(po=>this._onerror(new Error(`Failed to send cancellation: ${po}`)));const re=N instanceof z?N:new z($.RequestTimeout,String(N));h(re)};this._responseHandlers.set(g,N=>{var re;if(!((re=o==null?void 0:o.signal)!=null&&re.aborted)){if(N instanceof Error)return h(N);try{const ne=Cn(n,N.result);ne.success?d(ne.data):h(ne.error)}catch(ne){h(ne)}}}),(J=o==null?void 0:o.signal)==null||J.addEventListener("abort",()=>{var N;b((N=o==null?void 0:o.signal)==null?void 0:N.reason)});const y=(o==null?void 0:o.timeout)??Ju,x=()=>b(z.fromError($.RequestTimeout,"Request timed out",{timeout:y}));this._setupTimeout(g,y,o==null?void 0:o.maxTotalTimeout,x,(o==null?void 0:o.resetTimeoutOnProgress)??!1);const W=c==null?void 0:c.taskId;if(W){const N=re=>{const ne=this._responseHandlers.get(g);ne?ne(re):this._onerror(new Error(`Response handler missing for side-channeled request ${g}`))};this._requestResolvers.set(g,N),this._enqueueTaskMessage(W,{type:"request",message:_,timestamp:Date.now()}).catch(re=>{this._cleanupTimeout(g),h(re)})}else this._transport.send(_,{relatedRequestId:r,resumptionToken:s,onresumptiontoken:i}).catch(N=>{this._cleanupTimeout(g),h(N)})})}async getTask(t,n){return this.request({method:"tasks/get",params:t},yt,n)}async getTaskResult(t,n,o){return this.request({method:"tasks/result",params:t},n,o)}async listTasks(t,n){return this.request({method:"tasks/list",params:t},St,n)}async cancelTask(t,n){return this.request({method:"tasks/cancel",params:t},Ic,n)}async notification(t,n){var a,c,d,h;if(!this._transport)throw new Error("Not connected");this.assertNotificationCapability(t.method);const o=(a=n==null?void 0:n.relatedTask)==null?void 0:a.taskId;if(o){const m={...t,jsonrpc:"2.0",params:{...t.params,_meta:{...((c=t.params)==null?void 0:c._meta)||{},[le]:n.relatedTask}}};await this._enqueueTaskMessage(o,{type:"notification",message:m,timestamp:Date.now()});return}if((((d=this._options)==null?void 0:d.debouncedNotificationMethods)??[]).includes(t.method)&&!t.params&&!(n!=null&&n.relatedRequestId)&&!(n!=null&&n.relatedTask)){if(this._pendingDebouncedNotifications.has(t.method))return;this._pendingDebouncedNotifications.add(t.method),Promise.resolve().then(()=>{var g,_;if(this._pendingDebouncedNotifications.delete(t.method),!this._transport)return;let m={...t,jsonrpc:"2.0"};n!=null&&n.relatedTask&&(m={...m,params:{...m.params,_meta:{...((g=m.params)==null?void 0:g._meta)||{},[le]:n.relatedTask}}}),(_=this._transport)==null||_.send(m,n).catch(b=>this._onerror(b))});return}let i={...t,jsonrpc:"2.0"};n!=null&&n.relatedTask&&(i={...i,params:{...i.params,_meta:{...((h=i.params)==null?void 0:h._meta)||{},[le]:n.relatedTask}}}),await this._transport.send(i,n)}setRequestHandler(t,n){const o=Xt(t);this.assertRequestHandlerCapability(o),this._requestHandlers.set(o,(r,s)=>{const i=en(t,r);return Promise.resolve(n(i,s))})}removeRequestHandler(t){this._requestHandlers.delete(t)}assertCanSetRequestHandler(t){if(this._requestHandlers.has(t))throw new Error(`A request handler for ${t} already exists, which would be overridden`)}setNotificationHandler(t,n){const o=Xt(t);this._notificationHandlers.set(o,r=>{const s=en(t,r);return Promise.resolve(n(s))})}removeNotificationHandler(t){this._notificationHandlers.delete(t)}_cleanupTaskProgressHandler(t){const n=this._taskProgressTokens.get(t);n!==void 0&&(this._progressHandlers.delete(n),this._taskProgressTokens.delete(t))}async _enqueueTaskMessage(t,n,o){var s;if(!this._taskStore||!this._taskMessageQueue)throw new Error("Cannot enqueue task message: taskStore and taskMessageQueue are not configured");const r=(s=this._options)==null?void 0:s.maxTaskQueueSize;await this._taskMessageQueue.enqueue(t,n,o,r)}async _clearTaskQueue(t,n){if(this._taskMessageQueue){const o=await this._taskMessageQueue.dequeueAll(t,n);for(const r of o)if(r.type==="request"&&Yt(r.message)){const s=r.message.id,i=this._requestResolvers.get(s);i?(i(new z($.InternalError,"Task cancelled or completed")),this._requestResolvers.delete(s)):this._onerror(new Error(`Resolver missing for request ${s} during task ${t} cleanup`))}}}async _waitForTaskUpdate(t,n){var r,s;let o=((r=this._options)==null?void 0:r.defaultTaskPollInterval)??1e3;try{const i=await((s=this._taskStore)==null?void 0:s.getTask(t));i!=null&&i.pollInterval&&(o=i.pollInterval)}catch{}return new Promise((i,a)=>{if(n.aborted){a(new z($.InvalidRequest,"Request cancelled"));return}const c=setTimeout(i,o);n.addEventListener("abort",()=>{clearTimeout(c),a(new z($.InvalidRequest,"Request cancelled"))},{once:!0})})}requestTaskStore(t,n){const o=this._taskStore;if(!o)throw new Error("No task store configured");return{createTask:async r=>{if(!t)throw new Error("No request provided");return await o.createTask(r,t.id,{method:t.method,params:t.params},n)},getTask:async r=>{const s=await o.getTask(r,n);if(!s)throw new z($.InvalidParams,"Failed to retrieve task: Task not found");return s},storeTaskResult:async(r,s,i)=>{await o.storeTaskResult(r,s,i,n);const a=await o.getTask(r,n);if(a){const c=De.parse({method:"notifications/tasks/status",params:a});await this.notification(c),ue(a.status)&&this._cleanupTaskProgressHandler(r)}},getTaskResult:r=>o.getTaskResult(r,n),updateTaskStatus:async(r,s,i)=>{const a=await o.getTask(r,n);if(!a)throw new z($.InvalidParams,`Task "${r}" not found - it may have been cleaned up`);if(ue(a.status))throw new z($.InvalidParams,`Cannot update task "${r}" from terminal status "${a.status}" to "${s}". Terminal states (completed, failed, cancelled) cannot transition to other states.`);await o.updateTaskStatus(r,s,i,n);const c=await o.getTask(r,n);if(c){const d=De.parse({method:"notifications/tasks/status",params:c});await this.notification(d),ue(c.status)&&this._cleanupTaskProgressHandler(r)}},listTasks:r=>o.listTasks(r,n)}}}var Bu="2026-01-26",Wu="ui/notifications/tool-input-partial";class Ku{constructor(t=window.parent,n){H(this,"eventTarget");H(this,"eventSource");H(this,"messageListener");H(this,"onclose");H(this,"onerror");H(this,"onmessage");H(this,"sessionId");H(this,"setProtocolVersion");this.eventTarget=t,this.eventSource=n,this.messageListener=o=>{var s,i,a;if(n&&o.source!==this.eventSource){console.debug("Ignoring message from unknown source",o);return}let r=uc.safeParse(o.data);r.success?(console.debug("Parsed message",r.data),(s=this.onmessage)==null||s.call(this,r.data)):((i=o.data)==null?void 0:i.jsonrpc)!=="2.0"?console.debug("Ignoring non-JSON-RPC message",r.error.message,o):(console.error("Failed to parse message",r.error.message,o),(a=this.onerror)==null||a.call(this,Error("Invalid JSON-RPC message received: "+r.error.message)))}}async start(){window.addEventListener("message",this.messageListener)}async send(t,n){t.method!==Wu&&console.debug("Sending message",t),this.eventTarget.postMessage(t,"*")}async close(){var t;window.removeEventListener("message",this.messageListener),(t=this.onclose)==null||t.call(this)}}var Gu=S([u("light"),u("dark")]).describe("Color theme preference for the host environment."),Se=S([u("inline"),u("fullscreen"),u("pip")]).describe("Display mode for UI presentation."),Qu=S([u("--color-background-primary"),u("--color-background-secondary"),u("--color-background-tertiary"),u("--color-background-inverse"),u("--color-background-ghost"),u("--color-background-info"),u("--color-background-danger"),u("--color-background-success"),u("--color-background-warning"),u("--color-background-disabled"),u("--color-text-primary"),u("--color-text-secondary"),u("--color-text-tertiary"),u("--color-text-inverse"),u("--color-text-ghost"),u("--color-text-info"),u("--color-text-danger"),u("--color-text-success"),u("--color-text-warning"),u("--color-text-disabled"),u("--color-border-primary"),u("--color-border-secondary"),u("--color-border-tertiary"),u("--color-border-inverse"),u("--color-border-ghost"),u("--color-border-info"),u("--color-border-danger"),u("--color-border-success"),u("--color-border-warning"),u("--color-border-disabled"),u("--color-ring-primary"),u("--color-ring-secondary"),u("--color-ring-inverse"),u("--color-ring-info"),u("--color-ring-danger"),u("--color-ring-success"),u("--color-ring-warning"),u("--font-sans"),u("--font-mono"),u("--font-weight-normal"),u("--font-weight-medium"),u("--font-weight-semibold"),u("--font-weight-bold"),u("--font-text-xs-size"),u("--font-text-sm-size"),u("--font-text-md-size"),u("--font-text-lg-size"),u("--font-heading-xs-size"),u("--font-heading-sm-size"),u("--font-heading-md-size"),u("--font-heading-lg-size"),u("--font-heading-xl-size"),u("--font-heading-2xl-size"),u("--font-heading-3xl-size"),u("--font-text-xs-line-height"),u("--font-text-sm-line-height"),u("--font-text-md-line-height"),u("--font-text-lg-line-height"),u("--font-heading-xs-line-height"),u("--font-heading-sm-line-height"),u("--font-heading-md-line-height"),u("--font-heading-lg-line-height"),u("--font-heading-xl-line-height"),u("--font-heading-2xl-line-height"),u("--font-heading-3xl-line-height"),u("--border-radius-xs"),u("--border-radius-sm"),u("--border-radius-md"),u("--border-radius-lg"),u("--border-radius-xl"),u("--border-radius-full"),u("--border-width-regular"),u("--shadow-hairline"),u("--shadow-sm"),u("--shadow-md"),u("--shadow-lg")]).describe("CSS variable keys available to MCP apps for theming."),Yu=I(Qu.describe(`Style variables for theming MCP apps.
|
|
46
|
+
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const h of e.seen.entries()){const m=h[1];if(t===h[0]){s(h);continue}if(e.external){const _=(c=e.external.registry.get(h[0]))==null?void 0:c.id;if(t!==h[0]&&_){s(h);continue}}if((d=e.metadataRegistry.get(h[0]))==null?void 0:d.id){s(h);continue}if(m.cycle){s(h);continue}if(m.count>1&&e.reused==="ref"){s(h);continue}}}function On(e,t){var i,a,c;const n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const o=d=>{const h=e.seen.get(d);if(h.ref===null)return;const m=h.def??h.schema,g={...m},_=h.ref;if(h.ref=null,_){o(_);const y=e.seen.get(_),x=y.schema;if(x.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(m.allOf=m.allOf??[],m.allOf.push(x)):Object.assign(m,x),Object.assign(m,g),d._zod.parent===_)for(const C in m)C==="$ref"||C==="allOf"||C in g||delete m[C];if(x.$ref)for(const C in m)C==="$ref"||C==="allOf"||C in y.def&&JSON.stringify(m[C])===JSON.stringify(y.def[C])&&delete m[C]}const b=d._zod.parent;if(b&&b!==_){o(b);const y=e.seen.get(b);if(y!=null&&y.schema.$ref&&(m.$ref=y.schema.$ref,y.def))for(const x in m)x==="$ref"||x==="allOf"||x in y.def&&JSON.stringify(m[x])===JSON.stringify(y.def[x])&&delete m[x]}e.override({zodSchema:d,jsonSchema:m,path:h.path??[]})};for(const d of[...e.seen.entries()].reverse())o(d[0]);const r={};if(e.target==="draft-2020-12"?r.$schema="https://json-schema.org/draft/2020-12/schema":e.target==="draft-07"?r.$schema="http://json-schema.org/draft-07/schema#":e.target==="draft-04"?r.$schema="http://json-schema.org/draft-04/schema#":e.target,(i=e.external)!=null&&i.uri){const d=(a=e.external.registry.get(t))==null?void 0:a.id;if(!d)throw new Error("Schema is missing an `id` property");r.$id=e.external.uri(d)}Object.assign(r,n.def??n.schema);const s=((c=e.external)==null?void 0:c.defs)??{};for(const d of e.seen.entries()){const h=d[1];h.def&&h.defId&&(s[h.defId]=h.def)}e.external||Object.keys(s).length>0&&(e.target==="draft-2020-12"?r.$defs=s:r.definitions=s);try{const d=JSON.parse(JSON.stringify(r));return Object.defineProperty(d,"~standard",{value:{...t["~standard"],jsonSchema:{input:je(t,"input",e.processors),output:je(t,"output",e.processors)}},enumerable:!1,writable:!1}),d}catch{throw new Error("Error converting schema to JSON.")}}function F(e,t){const n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);const o=e._zod.def;if(o.type==="transform")return!0;if(o.type==="array")return F(o.element,n);if(o.type==="set")return F(o.valueType,n);if(o.type==="lazy")return F(o.getter(),n);if(o.type==="promise"||o.type==="optional"||o.type==="nonoptional"||o.type==="nullable"||o.type==="readonly"||o.type==="default"||o.type==="prefault")return F(o.innerType,n);if(o.type==="intersection")return F(o.left,n)||F(o.right,n);if(o.type==="record"||o.type==="map")return F(o.keyType,n)||F(o.valueType,n);if(o.type==="pipe")return F(o.in,n)||F(o.out,n);if(o.type==="object"){for(const r in o.shape)if(F(o.shape[r],n))return!0;return!1}if(o.type==="union"){for(const r of o.options)if(F(r,n))return!0;return!1}if(o.type==="tuple"){for(const r of o.items)if(F(r,n))return!0;return!!(o.rest&&F(o.rest,n))}return!1}const vi=(e,t={})=>n=>{const o=En({...n,processors:t});return M(e,o),Zn(o,e),On(o,e)},je=(e,t,n={})=>o=>{const{libraryOptions:r,target:s}=o??{},i=En({...r??{},target:s,io:t,processors:n});return M(e,i),Zn(i,e),On(i,e)},bi={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},yi=(e,t,n,o)=>{const r=n;r.type="string";const{minimum:s,maximum:i,format:a,patterns:c,contentEncoding:d}=e._zod.bag;if(typeof s=="number"&&(r.minLength=s),typeof i=="number"&&(r.maxLength=i),a&&(r.format=bi[a]??a,r.format===""&&delete r.format,a==="time"&&delete r.format),d&&(r.contentEncoding=d),c&&c.size>0){const h=[...c];h.length===1?r.pattern=h[0].source:h.length>1&&(r.allOf=[...h.map(m=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:m.source}))])}},ki=(e,t,n,o)=>{const r=n,{minimum:s,maximum:i,format:a,multipleOf:c,exclusiveMaximum:d,exclusiveMinimum:h}=e._zod.bag;typeof a=="string"&&a.includes("int")?r.type="integer":r.type="number",typeof h=="number"&&(t.target==="draft-04"||t.target==="openapi-3.0"?(r.minimum=h,r.exclusiveMinimum=!0):r.exclusiveMinimum=h),typeof s=="number"&&(r.minimum=s,typeof h=="number"&&t.target!=="draft-04"&&(h>=s?delete r.minimum:delete r.exclusiveMinimum)),typeof d=="number"&&(t.target==="draft-04"||t.target==="openapi-3.0"?(r.maximum=d,r.exclusiveMaximum=!0):r.exclusiveMaximum=d),typeof i=="number"&&(r.maximum=i,typeof d=="number"&&t.target!=="draft-04"&&(d<=i?delete r.maximum:delete r.exclusiveMaximum)),typeof c=="number"&&(r.multipleOf=c)},wi=(e,t,n,o)=>{n.type="boolean"},Si=(e,t,n,o)=>{t.target==="openapi-3.0"?(n.type="string",n.nullable=!0,n.enum=[null]):n.type="null"},zi=(e,t,n,o)=>{if(t.unrepresentable==="throw")throw new Error("Undefined cannot be represented in JSON Schema")},Ti=(e,t,n,o)=>{n.not={}},$i=(e,t,n,o)=>{},Ri=(e,t,n,o)=>{const r=e._zod.def,s=cn(r.entries);s.every(i=>typeof i=="number")&&(n.type="number"),s.every(i=>typeof i=="string")&&(n.type="string"),n.enum=s},Ii=(e,t,n,o)=>{const r=e._zod.def,s=[];for(const i of r.values)if(i===void 0){if(t.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof i=="bigint"){if(t.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");s.push(Number(i))}else s.push(i);if(s.length!==0)if(s.length===1){const i=s[0];n.type=i===null?"null":typeof i,t.target==="draft-04"||t.target==="openapi-3.0"?n.enum=[i]:n.const=i}else s.every(i=>typeof i=="number")&&(n.type="number"),s.every(i=>typeof i=="string")&&(n.type="string"),s.every(i=>typeof i=="boolean")&&(n.type="boolean"),s.every(i=>i===null)&&(n.type="null"),n.enum=s},Pi=(e,t,n,o)=>{if(t.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},Ei=(e,t,n,o)=>{if(t.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},Zi=(e,t,n,o)=>{const r=n,s=e._zod.def,{minimum:i,maximum:a}=e._zod.bag;typeof i=="number"&&(r.minItems=i),typeof a=="number"&&(r.maxItems=a),r.type="array",r.items=M(s.element,t,{...o,path:[...o.path,"items"]})},Oi=(e,t,n,o)=>{var d;const r=n,s=e._zod.def;r.type="object",r.properties={};const i=s.shape;for(const h in i)r.properties[h]=M(i[h],t,{...o,path:[...o.path,"properties",h]});const a=new Set(Object.keys(i)),c=new Set([...a].filter(h=>{const m=s.shape[h]._zod;return t.io==="input"?m.optin===void 0:m.optout===void 0}));c.size>0&&(r.required=Array.from(c)),((d=s.catchall)==null?void 0:d._zod.def.type)==="never"?r.additionalProperties=!1:s.catchall?s.catchall&&(r.additionalProperties=M(s.catchall,t,{...o,path:[...o.path,"additionalProperties"]})):t.io==="output"&&(r.additionalProperties=!1)},xi=(e,t,n,o)=>{const r=e._zod.def,s=r.inclusive===!1,i=r.options.map((a,c)=>M(a,t,{...o,path:[...o.path,s?"oneOf":"anyOf",c]}));s?n.oneOf=i:n.anyOf=i},Ci=(e,t,n,o)=>{const r=e._zod.def,s=M(r.left,t,{...o,path:[...o.path,"allOf",0]}),i=M(r.right,t,{...o,path:[...o.path,"allOf",1]}),a=d=>"allOf"in d&&Object.keys(d).length===1,c=[...a(s)?s.allOf:[s],...a(i)?i.allOf:[i]];n.allOf=c},Ni=(e,t,n,o)=>{const r=n,s=e._zod.def;r.type="object";const i=s.keyType,a=i._zod.bag,c=a==null?void 0:a.patterns;if(s.mode==="loose"&&c&&c.size>0){const h=M(s.valueType,t,{...o,path:[...o.path,"patternProperties","*"]});r.patternProperties={};for(const m of c)r.patternProperties[m.source]=h}else(t.target==="draft-07"||t.target==="draft-2020-12")&&(r.propertyNames=M(s.keyType,t,{...o,path:[...o.path,"propertyNames"]})),r.additionalProperties=M(s.valueType,t,{...o,path:[...o.path,"additionalProperties"]});const d=i._zod.values;if(d){const h=[...d].filter(m=>typeof m=="string"||typeof m=="number");h.length>0&&(r.required=h)}},qi=(e,t,n,o)=>{const r=e._zod.def,s=M(r.innerType,t,o),i=t.seen.get(e);t.target==="openapi-3.0"?(i.ref=r.innerType,n.nullable=!0):n.anyOf=[s,{type:"null"}]},Ai=(e,t,n,o)=>{const r=e._zod.def;M(r.innerType,t,o);const s=t.seen.get(e);s.ref=r.innerType},Mi=(e,t,n,o)=>{const r=e._zod.def;M(r.innerType,t,o);const s=t.seen.get(e);s.ref=r.innerType,n.default=JSON.parse(JSON.stringify(r.defaultValue))},ji=(e,t,n,o)=>{const r=e._zod.def;M(r.innerType,t,o);const s=t.seen.get(e);s.ref=r.innerType,t.io==="input"&&(n._prefault=JSON.parse(JSON.stringify(r.defaultValue)))},Di=(e,t,n,o)=>{const r=e._zod.def;M(r.innerType,t,o);const s=t.seen.get(e);s.ref=r.innerType;let i;try{i=r.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}n.default=i},Ui=(e,t,n,o)=>{const r=e._zod.def,s=t.io==="input"?r.in._zod.def.type==="transform"?r.out:r.in:r.out;M(s,t,o);const i=t.seen.get(e);i.ref=s},Li=(e,t,n,o)=>{const r=e._zod.def;M(r.innerType,t,o);const s=t.seen.get(e);s.ref=r.innerType,n.readOnly=!0},xn=(e,t,n,o)=>{const r=e._zod.def;M(r.innerType,t,o);const s=t.seen.get(e);s.ref=r.innerType};function lt(e){return!!e._zod}function Cn(e,t){return lt(e)?fn(e,t):e.safeParse(t)}function Hi(e){var n,o;if(!e)return;let t;if(lt(e)?t=(o=(n=e._zod)==null?void 0:n.def)==null?void 0:o.shape:t=e.shape,!!t){if(typeof t=="function")try{return t()}catch{return}return t}}function Fi(e){var r;if(lt(e)){const i=(r=e._zod)==null?void 0:r.def;if(i){if(i.value!==void 0)return i.value;if(Array.isArray(i.values)&&i.values.length>0)return i.values[0]}}const n=e._def;if(n){if(n.value!==void 0)return n.value;if(Array.isArray(n.values)&&n.values.length>0)return n.values[0]}const o=e.value;if(o!==void 0)return o}const Ji=f("ZodISODateTime",(e,t)=>{Ar.init(e,t),q.init(e,t)});function Nn(e){return Js(Ji,e)}const Vi=f("ZodISODate",(e,t)=>{Mr.init(e,t),q.init(e,t)});function Bi(e){return Vs(Vi,e)}const Wi=f("ZodISOTime",(e,t)=>{jr.init(e,t),q.init(e,t)});function Ki(e){return Bs(Wi,e)}const Gi=f("ZodISODuration",(e,t)=>{Dr.init(e,t),q.init(e,t)});function Qi(e){return Ws(Gi,e)}const Yi=(e,t)=>{pn.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:n=>Po(e,n)},flatten:{value:n=>Io(e,n)},addIssue:{value:n=>{e.issues.push(n),e.message=JSON.stringify(e.issues,Ye,2)}},addIssues:{value:n=>{e.issues.push(...n),e.message=JSON.stringify(e.issues,Ye,2)}},isEmpty:{get(){return e.issues.length===0}}})},X=f("ZodError",Yi,{Parent:Error}),Xi=at(X),ea=ct(X),ta=He(X),na=Fe(X),oa=Zo(X),ra=Oo(X),sa=xo(X),ia=Co(X),aa=No(X),ca=qo(X),ua=Ao(X),la=Mo(X),Z=f("ZodType",(e,t)=>(E.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:je(e,"input"),output:je(e,"output")}}),e.toJSONSchema=vi(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.check=(...n)=>e.clone(ae(t,{checks:[...t.checks??[],...n.map(o=>typeof o=="function"?{_zod:{check:o,def:{check:"custom"},onattach:[]}}:o)]}),{parent:!0}),e.with=e.check,e.clone=(n,o)=>ce(e,n,o),e.brand=()=>e,e.register=((n,o)=>(n.add(e,o),e)),e.parse=(n,o)=>Xi(e,n,o,{callee:e.parse}),e.safeParse=(n,o)=>ta(e,n,o),e.parseAsync=async(n,o)=>ea(e,n,o,{callee:e.parseAsync}),e.safeParseAsync=async(n,o)=>na(e,n,o),e.spa=e.safeParseAsync,e.encode=(n,o)=>oa(e,n,o),e.decode=(n,o)=>ra(e,n,o),e.encodeAsync=async(n,o)=>sa(e,n,o),e.decodeAsync=async(n,o)=>ia(e,n,o),e.safeEncode=(n,o)=>aa(e,n,o),e.safeDecode=(n,o)=>ca(e,n,o),e.safeEncodeAsync=async(n,o)=>ua(e,n,o),e.safeDecodeAsync=async(n,o)=>la(e,n,o),e.refine=(n,o)=>e.check(nc(n,o)),e.superRefine=n=>e.check(oc(n)),e.overwrite=n=>e.check(ve(n)),e.optional=()=>A(e),e.exactOptional=()=>Ha(e),e.nullable=()=>Qt(e),e.nullish=()=>A(Qt(e)),e.nonoptional=n=>Ka(e,n),e.array=()=>k(e),e.or=n=>S([e,n]),e.and=n=>dt(e,n),e.transform=n=>nt(e,Ln(n)),e.default=n=>Va(e,n),e.prefault=n=>Wa(e,n),e.catch=n=>Qa(e,n),e.pipe=n=>nt(e,n),e.readonly=()=>ec(e),e.describe=n=>{const o=e.clone();return ye.add(o,{description:n}),o},Object.defineProperty(e,"description",{get(){var n;return(n=ye.get(e))==null?void 0:n.description},configurable:!0}),e.meta=(...n)=>{if(n.length===0)return ye.get(e);const o=e.clone();return ye.add(o,n[0]),o},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e.apply=n=>n(e),e)),qn=f("_ZodString",(e,t)=>{ut.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(o,r,s)=>yi(e,o,r);const n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,e.regex=(...o)=>e.check(ni(...o)),e.includes=(...o)=>e.check(si(...o)),e.startsWith=(...o)=>e.check(ii(...o)),e.endsWith=(...o)=>e.check(ai(...o)),e.min=(...o)=>e.check(Me(...o)),e.max=(...o)=>e.check(In(...o)),e.length=(...o)=>e.check(Pn(...o)),e.nonempty=(...o)=>e.check(Me(1,...o)),e.lowercase=o=>e.check(oi(o)),e.uppercase=o=>e.check(ri(o)),e.trim=()=>e.check(ui()),e.normalize=(...o)=>e.check(ci(...o)),e.toLowerCase=()=>e.check(li()),e.toUpperCase=()=>e.check(di()),e.slugify=()=>e.check(pi())}),da=f("ZodString",(e,t)=>{ut.init(e,t),qn.init(e,t),e.email=n=>e.check(zs(pa,n)),e.url=n=>e.check(Ps(ha,n)),e.jwt=n=>e.check(Fs(Ia,n)),e.emoji=n=>e.check(Es(fa,n)),e.guid=n=>e.check(Jt(Kt,n)),e.uuid=n=>e.check(Ts(Ce,n)),e.uuidv4=n=>e.check($s(Ce,n)),e.uuidv6=n=>e.check(Rs(Ce,n)),e.uuidv7=n=>e.check(Is(Ce,n)),e.nanoid=n=>e.check(Zs(ma,n)),e.guid=n=>e.check(Jt(Kt,n)),e.cuid=n=>e.check(Os(ga,n)),e.cuid2=n=>e.check(xs(_a,n)),e.ulid=n=>e.check(Cs(va,n)),e.base64=n=>e.check(Us(Ta,n)),e.base64url=n=>e.check(Ls($a,n)),e.xid=n=>e.check(Ns(ba,n)),e.ksuid=n=>e.check(qs(ya,n)),e.ipv4=n=>e.check(As(ka,n)),e.ipv6=n=>e.check(Ms(wa,n)),e.cidrv4=n=>e.check(js(Sa,n)),e.cidrv6=n=>e.check(Ds(za,n)),e.e164=n=>e.check(Hs(Ra,n)),e.datetime=n=>e.check(Nn(n)),e.date=n=>e.check(Bi(n)),e.time=n=>e.check(Ki(n)),e.duration=n=>e.check(Qi(n))});function l(e){return Ss(da,e)}const q=f("ZodStringFormat",(e,t)=>{O.init(e,t),qn.init(e,t)}),pa=f("ZodEmail",(e,t)=>{Ir.init(e,t),q.init(e,t)}),Kt=f("ZodGUID",(e,t)=>{$r.init(e,t),q.init(e,t)}),Ce=f("ZodUUID",(e,t)=>{Rr.init(e,t),q.init(e,t)}),ha=f("ZodURL",(e,t)=>{Pr.init(e,t),q.init(e,t)}),fa=f("ZodEmoji",(e,t)=>{Er.init(e,t),q.init(e,t)}),ma=f("ZodNanoID",(e,t)=>{Zr.init(e,t),q.init(e,t)}),ga=f("ZodCUID",(e,t)=>{Or.init(e,t),q.init(e,t)}),_a=f("ZodCUID2",(e,t)=>{xr.init(e,t),q.init(e,t)}),va=f("ZodULID",(e,t)=>{Cr.init(e,t),q.init(e,t)}),ba=f("ZodXID",(e,t)=>{Nr.init(e,t),q.init(e,t)}),ya=f("ZodKSUID",(e,t)=>{qr.init(e,t),q.init(e,t)}),ka=f("ZodIPv4",(e,t)=>{Ur.init(e,t),q.init(e,t)}),wa=f("ZodIPv6",(e,t)=>{Lr.init(e,t),q.init(e,t)}),Sa=f("ZodCIDRv4",(e,t)=>{Hr.init(e,t),q.init(e,t)}),za=f("ZodCIDRv6",(e,t)=>{Fr.init(e,t),q.init(e,t)}),Ta=f("ZodBase64",(e,t)=>{Jr.init(e,t),q.init(e,t)}),$a=f("ZodBase64URL",(e,t)=>{Br.init(e,t),q.init(e,t)}),Ra=f("ZodE164",(e,t)=>{Wr.init(e,t),q.init(e,t)}),Ia=f("ZodJWT",(e,t)=>{Gr.init(e,t),q.init(e,t)}),An=f("ZodNumber",(e,t)=>{Sn.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(o,r,s)=>ki(e,o,r),e.gt=(o,r)=>e.check(Bt(o,r)),e.gte=(o,r)=>e.check(Qe(o,r)),e.min=(o,r)=>e.check(Qe(o,r)),e.lt=(o,r)=>e.check(Vt(o,r)),e.lte=(o,r)=>e.check(Ge(o,r)),e.max=(o,r)=>e.check(Ge(o,r)),e.int=o=>e.check(Gt(o)),e.safe=o=>e.check(Gt(o)),e.positive=o=>e.check(Bt(0,o)),e.nonnegative=o=>e.check(Qe(0,o)),e.negative=o=>e.check(Vt(0,o)),e.nonpositive=o=>e.check(Ge(0,o)),e.multipleOf=(o,r)=>e.check(Wt(o,r)),e.step=(o,r)=>e.check(Wt(o,r)),e.finite=()=>e;const n=e._zod.bag;e.minValue=Math.max(n.minimum??Number.NEGATIVE_INFINITY,n.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(n.maximum??Number.POSITIVE_INFINITY,n.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(n.format??"").includes("int")||Number.isSafeInteger(n.multipleOf??.5),e.isFinite=!0,e.format=n.format??null});function w(e){return Ks(An,e)}const Pa=f("ZodNumberFormat",(e,t)=>{Qr.init(e,t),An.init(e,t)});function Gt(e){return Gs(Pa,e)}const Ea=f("ZodBoolean",(e,t)=>{Yr.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(n,o,r)=>wi(e,n,o)});function P(e){return Qs(Ea,e)}const Za=f("ZodUndefined",(e,t)=>{Xr.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(n,o,r)=>zi(e,n)});function et(e){return Ys(Za,e)}const Oa=f("ZodNull",(e,t)=>{es.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(n,o,r)=>Si(e,n,o)});function Mn(e){return Xs(Oa,e)}const xa=f("ZodUnknown",(e,t)=>{ts.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(n,o,r)=>$i()});function I(){return ei(xa)}const Ca=f("ZodNever",(e,t)=>{ns.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(n,o,r)=>Ti(e,n,o)});function Na(e){return ti(Ca,e)}const qa=f("ZodArray",(e,t)=>{os.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(n,o,r)=>Zi(e,n,o,r),e.element=t.element,e.min=(n,o)=>e.check(Me(n,o)),e.nonempty=n=>e.check(Me(1,n)),e.max=(n,o)=>e.check(In(n,o)),e.length=(n,o)=>e.check(Pn(n,o)),e.unwrap=()=>e.element});function k(e,t){return hi(qa,e,t)}const jn=f("ZodObject",(e,t)=>{ss.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(n,o,r)=>Oi(e,n,o,r),T(e,"shape",()=>t.shape),e.keyof=()=>G(Object.keys(e._zod.def.shape)),e.catchall=n=>e.clone({...e._zod.def,catchall:n}),e.passthrough=()=>e.clone({...e._zod.def,catchall:I()}),e.loose=()=>e.clone({...e._zod.def,catchall:I()}),e.strict=()=>e.clone({...e._zod.def,catchall:Na()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=n=>So(e,n),e.safeExtend=n=>zo(e,n),e.merge=n=>To(e,n),e.pick=n=>ko(e,n),e.omit=n=>wo(e,n),e.partial=(...n)=>$o(Hn,e,n[0]),e.required=(...n)=>Ro(Fn,e,n[0])});function p(e,t){const n={type:"object",shape:e??{},...v(t)};return new jn(n)}function V(e,t){return new jn({type:"object",shape:e,catchall:I(),...v(t)})}const Dn=f("ZodUnion",(e,t)=>{$n.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(n,o,r)=>xi(e,n,o,r),e.options=t.options});function S(e,t){return new Dn({type:"union",options:e,...v(t)})}const Aa=f("ZodDiscriminatedUnion",(e,t)=>{Dn.init(e,t),is.init(e,t)});function Un(e,t,n){return new Aa({type:"union",options:t,discriminator:e,...v(n)})}const Ma=f("ZodIntersection",(e,t)=>{as.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(n,o,r)=>Ci(e,n,o,r)});function dt(e,t){return new Ma({type:"intersection",left:e,right:t})}const ja=f("ZodRecord",(e,t)=>{cs.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(n,o,r)=>Ni(e,n,o,r),e.keyType=t.keyType,e.valueType=t.valueType});function R(e,t,n){return new ja({type:"record",keyType:e,valueType:t,...v(n)})}const tt=f("ZodEnum",(e,t)=>{us.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(o,r,s)=>Ri(e,o,r),e.enum=t.entries,e.options=Object.values(t.entries);const n=new Set(Object.keys(t.entries));e.extract=(o,r)=>{const s={};for(const i of o)if(n.has(i))s[i]=t.entries[i];else throw new Error(`Key ${i} not found in enum`);return new tt({...t,checks:[],...v(r),entries:s})},e.exclude=(o,r)=>{const s={...t.entries};for(const i of o)if(n.has(i))delete s[i];else throw new Error(`Key ${i} not found in enum`);return new tt({...t,checks:[],...v(r),entries:s})}});function G(e,t){const n=Array.isArray(e)?Object.fromEntries(e.map(o=>[o,o])):e;return new tt({type:"enum",entries:n,...v(t)})}const Da=f("ZodLiteral",(e,t)=>{ls.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(n,o,r)=>Ii(e,n,o),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function u(e,t){return new Da({type:"literal",values:Array.isArray(e)?e:[e],...v(t)})}const Ua=f("ZodTransform",(e,t)=>{ds.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(n,o,r)=>Ei(e,n),e._zod.parse=(n,o)=>{if(o.direction==="backward")throw new sn(e.constructor.name);n.addIssue=s=>{if(typeof s=="string")n.issues.push(we(s,n.value,t));else{const i=s;i.fatal&&(i.continue=!1),i.code??(i.code="custom"),i.input??(i.input=n.value),i.inst??(i.inst=e),n.issues.push(we(i))}};const r=t.transform(n.value,n);return r instanceof Promise?r.then(s=>(n.value=s,n)):(n.value=r,n)}});function Ln(e){return new Ua({type:"transform",transform:e})}const Hn=f("ZodOptional",(e,t)=>{Rn.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(n,o,r)=>xn(e,n,o,r),e.unwrap=()=>e._zod.def.innerType});function A(e){return new Hn({type:"optional",innerType:e})}const La=f("ZodExactOptional",(e,t)=>{ps.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(n,o,r)=>xn(e,n,o,r),e.unwrap=()=>e._zod.def.innerType});function Ha(e){return new La({type:"optional",innerType:e})}const Fa=f("ZodNullable",(e,t)=>{hs.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(n,o,r)=>qi(e,n,o,r),e.unwrap=()=>e._zod.def.innerType});function Qt(e){return new Fa({type:"nullable",innerType:e})}const Ja=f("ZodDefault",(e,t)=>{fs.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(n,o,r)=>Mi(e,n,o,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Va(e,t){return new Ja({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():ln(t)}})}const Ba=f("ZodPrefault",(e,t)=>{ms.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(n,o,r)=>ji(e,n,o,r),e.unwrap=()=>e._zod.def.innerType});function Wa(e,t){return new Ba({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():ln(t)}})}const Fn=f("ZodNonOptional",(e,t)=>{gs.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(n,o,r)=>Ai(e,n,o,r),e.unwrap=()=>e._zod.def.innerType});function Ka(e,t){return new Fn({type:"nonoptional",innerType:e,...v(t)})}const Ga=f("ZodCatch",(e,t)=>{_s.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(n,o,r)=>Di(e,n,o,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Qa(e,t){return new Ga({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}const Ya=f("ZodPipe",(e,t)=>{vs.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(n,o,r)=>Ui(e,n,o,r),e.in=t.in,e.out=t.out});function nt(e,t){return new Ya({type:"pipe",in:e,out:t})}const Xa=f("ZodReadonly",(e,t)=>{bs.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(n,o,r)=>Li(e,n,o,r),e.unwrap=()=>e._zod.def.innerType});function ec(e){return new Xa({type:"readonly",innerType:e})}const Jn=f("ZodCustom",(e,t)=>{ys.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(n,o,r)=>Pi(e,n)});function tc(e,t){return fi(Jn,e??(()=>!0),t)}function nc(e,t={}){return mi(Jn,e,t)}function oc(e){return gi(e)}function Vn(e,t){return nt(Ln(e),t)}const le="io.modelcontextprotocol/related-task",Ve="2.0",D=tc(e=>e!==null&&(typeof e=="object"||typeof e=="function")),Bn=S([l(),w().int()]),Wn=l();V({ttl:S([w(),Mn()]).optional(),pollInterval:w().optional()});const rc=p({ttl:w().optional()}),sc=p({taskId:l()}),pt=V({progressToken:Bn.optional(),[le]:sc.optional()}),Q=p({_meta:pt.optional()}),ze=Q.extend({task:rc.optional()}),ic=e=>ze.safeParse(e).success,U=p({method:l(),params:Q.loose().optional()}),ee=p({_meta:pt.optional()}),te=p({method:l(),params:ee.loose().optional()}),L=V({_meta:pt.optional()}),Te=S([l(),w().int()]),Kn=p({jsonrpc:u(Ve),id:Te,...U.shape}).strict(),Yt=e=>Kn.safeParse(e).success,Gn=p({jsonrpc:u(Ve),...te.shape}).strict(),ac=e=>Gn.safeParse(e).success,ht=p({jsonrpc:u(Ve),id:Te,result:L}).strict(),Ne=e=>ht.safeParse(e).success;var $;(function(e){e[e.ConnectionClosed=-32e3]="ConnectionClosed",e[e.RequestTimeout=-32001]="RequestTimeout",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.UrlElicitationRequired=-32042]="UrlElicitationRequired"})($||($={}));const ft=p({jsonrpc:u(Ve),id:Te.optional(),error:p({code:w().int(),message:l(),data:I().optional()})}).strict(),cc=e=>ft.safeParse(e).success,uc=S([Kn,Gn,ht,ft]);S([ht,ft]);const mt=L.strict(),lc=ee.extend({requestId:Te.optional(),reason:l().optional()}),gt=te.extend({method:u("notifications/cancelled"),params:lc}),dc=p({src:l(),mimeType:l().optional(),sizes:k(l()).optional(),theme:G(["light","dark"]).optional()}),$e=p({icons:k(dc).optional()}),_e=p({name:l(),title:l().optional()}),Be=_e.extend({..._e.shape,...$e.shape,version:l(),websiteUrl:l().optional(),description:l().optional()}),pc=dt(p({applyDefaults:P().optional()}),R(l(),I())),hc=Vn(e=>e&&typeof e=="object"&&!Array.isArray(e)&&Object.keys(e).length===0?{form:{}}:e,dt(p({form:pc.optional(),url:D.optional()}),R(l(),I()).optional())),fc=V({list:D.optional(),cancel:D.optional(),requests:V({sampling:V({createMessage:D.optional()}).optional(),elicitation:V({create:D.optional()}).optional()}).optional()}),mc=V({list:D.optional(),cancel:D.optional(),requests:V({tools:V({call:D.optional()}).optional()}).optional()}),gc=p({experimental:R(l(),D).optional(),sampling:p({context:D.optional(),tools:D.optional()}).optional(),elicitation:hc.optional(),roots:p({listChanged:P().optional()}).optional(),tasks:fc.optional()}),_c=Q.extend({protocolVersion:l(),capabilities:gc,clientInfo:Be}),vc=U.extend({method:u("initialize"),params:_c}),bc=p({experimental:R(l(),D).optional(),logging:D.optional(),completions:D.optional(),prompts:p({listChanged:P().optional()}).optional(),resources:p({subscribe:P().optional(),listChanged:P().optional()}).optional(),tools:p({listChanged:P().optional()}).optional(),tasks:mc.optional()}),yc=L.extend({protocolVersion:l(),capabilities:bc,serverInfo:Be,instructions:l().optional()}),kc=te.extend({method:u("notifications/initialized"),params:ee.optional()}),We=U.extend({method:u("ping"),params:Q.optional()}),wc=p({progress:w(),total:A(w()),message:A(l())}),Sc=p({...ee.shape,...wc.shape,progressToken:Bn}),_t=te.extend({method:u("notifications/progress"),params:Sc}),zc=Q.extend({cursor:Wn.optional()}),Re=U.extend({params:zc.optional()}),Ie=L.extend({nextCursor:Wn.optional()}),Tc=G(["working","input_required","completed","failed","cancelled"]),Pe=p({taskId:l(),status:Tc,ttl:S([w(),Mn()]),createdAt:l(),lastUpdatedAt:l(),pollInterval:A(w()),statusMessage:A(l())}),vt=L.extend({task:Pe}),$c=ee.merge(Pe),De=te.extend({method:u("notifications/tasks/status"),params:$c}),bt=U.extend({method:u("tasks/get"),params:Q.extend({taskId:l()})}),yt=L.merge(Pe),kt=U.extend({method:u("tasks/result"),params:Q.extend({taskId:l()})});L.loose();const wt=Re.extend({method:u("tasks/list")}),St=Ie.extend({tasks:k(Pe)}),zt=U.extend({method:u("tasks/cancel"),params:Q.extend({taskId:l()})}),Rc=L.merge(Pe),Qn=p({uri:l(),mimeType:A(l()),_meta:R(l(),I()).optional()}),Yn=Qn.extend({text:l()}),Tt=l().refine(e=>{try{return atob(e),!0}catch{return!1}},{message:"Invalid Base64 string"}),Xn=Qn.extend({blob:Tt}),Ee=G(["user","assistant"]),be=p({audience:k(Ee).optional(),priority:w().min(0).max(1).optional(),lastModified:Nn({offset:!0}).optional()}),eo=p({..._e.shape,...$e.shape,uri:l(),description:A(l()),mimeType:A(l()),annotations:be.optional(),_meta:A(V({}))}),Ic=p({..._e.shape,...$e.shape,uriTemplate:l(),description:A(l()),mimeType:A(l()),annotations:be.optional(),_meta:A(V({}))}),Pc=Re.extend({method:u("resources/list")}),to=Ie.extend({resources:k(eo)}),Ec=Re.extend({method:u("resources/templates/list")}),Zc=Ie.extend({resourceTemplates:k(Ic)}),$t=Q.extend({uri:l()}),Oc=$t,xc=U.extend({method:u("resources/read"),params:Oc}),no=L.extend({contents:k(S([Yn,Xn]))}),Cc=te.extend({method:u("notifications/resources/list_changed"),params:ee.optional()}),Nc=$t,qc=U.extend({method:u("resources/subscribe"),params:Nc}),Ac=$t,Mc=U.extend({method:u("resources/unsubscribe"),params:Ac}),jc=ee.extend({uri:l()}),Dc=te.extend({method:u("notifications/resources/updated"),params:jc}),Uc=p({name:l(),description:A(l()),required:A(P())}),Lc=p({..._e.shape,...$e.shape,description:A(l()),arguments:A(k(Uc)),_meta:A(V({}))}),Hc=Re.extend({method:u("prompts/list")}),Fc=Ie.extend({prompts:k(Lc)}),Jc=Q.extend({name:l(),arguments:R(l(),l()).optional()}),Vc=U.extend({method:u("prompts/get"),params:Jc}),Rt=p({type:u("text"),text:l(),annotations:be.optional(),_meta:R(l(),I()).optional()}),It=p({type:u("image"),data:Tt,mimeType:l(),annotations:be.optional(),_meta:R(l(),I()).optional()}),Pt=p({type:u("audio"),data:Tt,mimeType:l(),annotations:be.optional(),_meta:R(l(),I()).optional()}),Bc=p({type:u("tool_use"),name:l(),id:l(),input:R(l(),I()),_meta:R(l(),I()).optional()}),oo=p({type:u("resource"),resource:S([Yn,Xn]),annotations:be.optional(),_meta:R(l(),I()).optional()}),ro=eo.extend({type:u("resource_link")}),Ze=S([Rt,It,Pt,ro,oo]),Wc=p({role:Ee,content:Ze}),Kc=L.extend({description:l().optional(),messages:k(Wc)}),Gc=te.extend({method:u("notifications/prompts/list_changed"),params:ee.optional()}),Qc=p({title:l().optional(),readOnlyHint:P().optional(),destructiveHint:P().optional(),idempotentHint:P().optional(),openWorldHint:P().optional()}),Yc=p({taskSupport:G(["required","optional","forbidden"]).optional()}),Et=p({..._e.shape,...$e.shape,description:l().optional(),inputSchema:p({type:u("object"),properties:R(l(),D).optional(),required:k(l()).optional()}).catchall(I()),outputSchema:p({type:u("object"),properties:R(l(),D).optional(),required:k(l()).optional()}).catchall(I()).optional(),annotations:Qc.optional(),execution:Yc.optional(),_meta:R(l(),I()).optional()}),so=Re.extend({method:u("tools/list")}),Xc=Ie.extend({tools:k(Et)}),Ke=L.extend({content:k(Ze).default([]),structuredContent:R(l(),I()).optional(),isError:P().optional()});Ke.or(L.extend({toolResult:I()}));const eu=ze.extend({name:l(),arguments:R(l(),I()).optional()}),io=U.extend({method:u("tools/call"),params:eu}),tu=te.extend({method:u("notifications/tools/list_changed"),params:ee.optional()});p({autoRefresh:P().default(!0),debounceMs:w().int().nonnegative().default(300)});const ao=G(["debug","info","notice","warning","error","critical","alert","emergency"]),nu=Q.extend({level:ao}),ou=U.extend({method:u("logging/setLevel"),params:nu}),ru=ee.extend({level:ao,logger:l().optional(),data:I()}),su=te.extend({method:u("notifications/message"),params:ru}),iu=p({name:l().optional()}),au=p({hints:k(iu).optional(),costPriority:w().min(0).max(1).optional(),speedPriority:w().min(0).max(1).optional(),intelligencePriority:w().min(0).max(1).optional()}),cu=p({mode:G(["auto","required","none"]).optional()}),uu=p({type:u("tool_result"),toolUseId:l().describe("The unique identifier for the corresponding tool call."),content:k(Ze).default([]),structuredContent:p({}).loose().optional(),isError:P().optional(),_meta:R(l(),I()).optional()}),lu=Un("type",[Rt,It,Pt]),Ue=Un("type",[Rt,It,Pt,Bc,uu]),du=p({role:Ee,content:S([Ue,k(Ue)]),_meta:R(l(),I()).optional()}),pu=ze.extend({messages:k(du),modelPreferences:au.optional(),systemPrompt:l().optional(),includeContext:G(["none","thisServer","allServers"]).optional(),temperature:w().optional(),maxTokens:w().int(),stopSequences:k(l()).optional(),metadata:D.optional(),tools:k(Et).optional(),toolChoice:cu.optional()}),hu=U.extend({method:u("sampling/createMessage"),params:pu}),fu=L.extend({model:l(),stopReason:A(G(["endTurn","stopSequence","maxTokens"]).or(l())),role:Ee,content:lu}),mu=L.extend({model:l(),stopReason:A(G(["endTurn","stopSequence","maxTokens","toolUse"]).or(l())),role:Ee,content:S([Ue,k(Ue)])}),gu=p({type:u("boolean"),title:l().optional(),description:l().optional(),default:P().optional()}),_u=p({type:u("string"),title:l().optional(),description:l().optional(),minLength:w().optional(),maxLength:w().optional(),format:G(["email","uri","date","date-time"]).optional(),default:l().optional()}),vu=p({type:G(["number","integer"]),title:l().optional(),description:l().optional(),minimum:w().optional(),maximum:w().optional(),default:w().optional()}),bu=p({type:u("string"),title:l().optional(),description:l().optional(),enum:k(l()),default:l().optional()}),yu=p({type:u("string"),title:l().optional(),description:l().optional(),oneOf:k(p({const:l(),title:l()})),default:l().optional()}),ku=p({type:u("string"),title:l().optional(),description:l().optional(),enum:k(l()),enumNames:k(l()).optional(),default:l().optional()}),wu=S([bu,yu]),Su=p({type:u("array"),title:l().optional(),description:l().optional(),minItems:w().optional(),maxItems:w().optional(),items:p({type:u("string"),enum:k(l())}),default:k(l()).optional()}),zu=p({type:u("array"),title:l().optional(),description:l().optional(),minItems:w().optional(),maxItems:w().optional(),items:p({anyOf:k(p({const:l(),title:l()}))}),default:k(l()).optional()}),Tu=S([Su,zu]),$u=S([ku,wu,Tu]),Ru=S([$u,gu,_u,vu]),Iu=ze.extend({mode:u("form").optional(),message:l(),requestedSchema:p({type:u("object"),properties:R(l(),Ru),required:k(l()).optional()})}),Pu=ze.extend({mode:u("url"),message:l(),elicitationId:l(),url:l().url()}),Eu=S([Iu,Pu]),Zu=U.extend({method:u("elicitation/create"),params:Eu}),Ou=ee.extend({elicitationId:l()}),xu=te.extend({method:u("notifications/elicitation/complete"),params:Ou}),Cu=L.extend({action:G(["accept","decline","cancel"]),content:Vn(e=>e===null?void 0:e,R(l(),S([l(),w(),P(),k(l())])).optional())}),Nu=p({type:u("ref/resource"),uri:l()}),qu=p({type:u("ref/prompt"),name:l()}),Au=Q.extend({ref:S([qu,Nu]),argument:p({name:l(),value:l()}),context:p({arguments:R(l(),l()).optional()}).optional()}),Mu=U.extend({method:u("completion/complete"),params:Au}),ju=L.extend({completion:V({values:k(l()).max(100),total:A(w().int()),hasMore:A(P())})}),Du=p({uri:l().startsWith("file://"),name:l().optional(),_meta:R(l(),I()).optional()}),Uu=U.extend({method:u("roots/list"),params:Q.optional()}),Lu=L.extend({roots:k(Du)}),Hu=te.extend({method:u("notifications/roots/list_changed"),params:ee.optional()});S([We,vc,Mu,ou,Vc,Hc,Pc,Ec,xc,qc,Mc,io,so,bt,kt,wt,zt]);S([gt,_t,kc,Hu,De]);S([mt,fu,mu,Cu,Lu,yt,St,vt]);S([We,hu,Zu,Uu,bt,kt,wt,zt]);S([gt,_t,su,Dc,Cc,tu,Gc,De,xu]);S([mt,yc,ju,Kc,Fc,to,Zc,no,Ke,Xc,yt,St,vt]);class z extends Error{constructor(t,n,o){super(`MCP error ${t}: ${n}`),this.code=t,this.data=o,this.name="McpError"}static fromError(t,n,o){if(t===$.UrlElicitationRequired&&o){const r=o;if(r.elicitations)return new Fu(r.elicitations,n)}return new z(t,n,o)}}class Fu extends z{constructor(t,n=`URL elicitation${t.length>1?"s":""} required`){super($.UrlElicitationRequired,n,{elicitations:t})}get elicitations(){var t;return((t=this.data)==null?void 0:t.elicitations)??[]}}function ue(e){return e==="completed"||e==="failed"||e==="cancelled"}new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function Xt(e){const t=Hi(e),n=t==null?void 0:t.method;if(!n)throw new Error("Schema is missing a method literal");const o=Fi(n);if(typeof o!="string")throw new Error("Schema method literal must be a string");return o}function en(e,t){const n=Cn(e,t);if(!n.success)throw n.error;return n.data}const Ju=6e4;class Vu{constructor(t){this._options=t,this._requestMessageId=0,this._requestHandlers=new Map,this._requestHandlerAbortControllers=new Map,this._notificationHandlers=new Map,this._responseHandlers=new Map,this._progressHandlers=new Map,this._timeoutInfo=new Map,this._pendingDebouncedNotifications=new Set,this._taskProgressTokens=new Map,this._requestResolvers=new Map,this.setNotificationHandler(gt,n=>{this._oncancel(n)}),this.setNotificationHandler(_t,n=>{this._onprogress(n)}),this.setRequestHandler(We,n=>({})),this._taskStore=t==null?void 0:t.taskStore,this._taskMessageQueue=t==null?void 0:t.taskMessageQueue,this._taskStore&&(this.setRequestHandler(bt,async(n,o)=>{const r=await this._taskStore.getTask(n.params.taskId,o.sessionId);if(!r)throw new z($.InvalidParams,"Failed to retrieve task: Task not found");return{...r}}),this.setRequestHandler(kt,async(n,o)=>{const r=async()=>{var a;const s=n.params.taskId;if(this._taskMessageQueue){let c;for(;c=await this._taskMessageQueue.dequeue(s,o.sessionId);){if(c.type==="response"||c.type==="error"){const d=c.message,h=d.id,m=this._requestResolvers.get(h);if(m)if(this._requestResolvers.delete(h),c.type==="response")m(d);else{const g=d,_=new z(g.error.code,g.error.message,g.error.data);m(_)}else{const g=c.type==="response"?"Response":"Error";this._onerror(new Error(`${g} handler missing for request ${h}`))}continue}await((a=this._transport)==null?void 0:a.send(c.message,{relatedRequestId:o.requestId}))}}const i=await this._taskStore.getTask(s,o.sessionId);if(!i)throw new z($.InvalidParams,`Task not found: ${s}`);if(!ue(i.status))return await this._waitForTaskUpdate(s,o.signal),await r();if(ue(i.status)){const c=await this._taskStore.getTaskResult(s,o.sessionId);return this._clearTaskQueue(s),{...c,_meta:{...c._meta,[le]:{taskId:s}}}}return await r()};return await r()}),this.setRequestHandler(wt,async(n,o)=>{var r;try{const{tasks:s,nextCursor:i}=await this._taskStore.listTasks((r=n.params)==null?void 0:r.cursor,o.sessionId);return{tasks:s,nextCursor:i,_meta:{}}}catch(s){throw new z($.InvalidParams,`Failed to list tasks: ${s instanceof Error?s.message:String(s)}`)}}),this.setRequestHandler(zt,async(n,o)=>{try{const r=await this._taskStore.getTask(n.params.taskId,o.sessionId);if(!r)throw new z($.InvalidParams,`Task not found: ${n.params.taskId}`);if(ue(r.status))throw new z($.InvalidParams,`Cannot cancel task in terminal status: ${r.status}`);await this._taskStore.updateTaskStatus(n.params.taskId,"cancelled","Client cancelled task execution.",o.sessionId),this._clearTaskQueue(n.params.taskId);const s=await this._taskStore.getTask(n.params.taskId,o.sessionId);if(!s)throw new z($.InvalidParams,`Task not found after cancellation: ${n.params.taskId}`);return{_meta:{},...s}}catch(r){throw r instanceof z?r:new z($.InvalidRequest,`Failed to cancel task: ${r instanceof Error?r.message:String(r)}`)}}))}async _oncancel(t){if(!t.params.requestId)return;const n=this._requestHandlerAbortControllers.get(t.params.requestId);n==null||n.abort(t.params.reason)}_setupTimeout(t,n,o,r,s=!1){this._timeoutInfo.set(t,{timeoutId:setTimeout(r,n),startTime:Date.now(),timeout:n,maxTotalTimeout:o,resetTimeoutOnProgress:s,onTimeout:r})}_resetTimeout(t){const n=this._timeoutInfo.get(t);if(!n)return!1;const o=Date.now()-n.startTime;if(n.maxTotalTimeout&&o>=n.maxTotalTimeout)throw this._timeoutInfo.delete(t),z.fromError($.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:n.maxTotalTimeout,totalElapsed:o});return clearTimeout(n.timeoutId),n.timeoutId=setTimeout(n.onTimeout,n.timeout),!0}_cleanupTimeout(t){const n=this._timeoutInfo.get(t);n&&(clearTimeout(n.timeoutId),this._timeoutInfo.delete(t))}async connect(t){var s,i,a;this._transport=t;const n=(s=this.transport)==null?void 0:s.onclose;this._transport.onclose=()=>{n==null||n(),this._onclose()};const o=(i=this.transport)==null?void 0:i.onerror;this._transport.onerror=c=>{o==null||o(c),this._onerror(c)};const r=(a=this._transport)==null?void 0:a.onmessage;this._transport.onmessage=(c,d)=>{r==null||r(c,d),Ne(c)||cc(c)?this._onresponse(c):Yt(c)?this._onrequest(c,d):ac(c)?this._onnotification(c):this._onerror(new Error(`Unknown message type: ${JSON.stringify(c)}`))},await this._transport.start()}_onclose(){var o;const t=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._taskProgressTokens.clear(),this._pendingDebouncedNotifications.clear();const n=z.fromError($.ConnectionClosed,"Connection closed");this._transport=void 0,(o=this.onclose)==null||o.call(this);for(const r of t.values())r(n)}_onerror(t){var n;(n=this.onerror)==null||n.call(this,t)}_onnotification(t){const n=this._notificationHandlers.get(t.method)??this.fallbackNotificationHandler;n!==void 0&&Promise.resolve().then(()=>n(t)).catch(o=>this._onerror(new Error(`Uncaught error in notification handler: ${o}`)))}_onrequest(t,n){var h,m,g,_;const o=this._requestHandlers.get(t.method)??this.fallbackRequestHandler,r=this._transport,s=(g=(m=(h=t.params)==null?void 0:h._meta)==null?void 0:m[le])==null?void 0:g.taskId;if(o===void 0){const b={jsonrpc:"2.0",id:t.id,error:{code:$.MethodNotFound,message:"Method not found"}};s&&this._taskMessageQueue?this._enqueueTaskMessage(s,{type:"error",message:b,timestamp:Date.now()},r==null?void 0:r.sessionId).catch(y=>this._onerror(new Error(`Failed to enqueue error response: ${y}`))):r==null||r.send(b).catch(y=>this._onerror(new Error(`Failed to send an error response: ${y}`)));return}const i=new AbortController;this._requestHandlerAbortControllers.set(t.id,i);const a=ic(t.params)?t.params.task:void 0,c=this._taskStore?this.requestTaskStore(t,r==null?void 0:r.sessionId):void 0,d={signal:i.signal,sessionId:r==null?void 0:r.sessionId,_meta:(_=t.params)==null?void 0:_._meta,sendNotification:async b=>{const y={relatedRequestId:t.id};s&&(y.relatedTask={taskId:s}),await this.notification(b,y)},sendRequest:async(b,y,x)=>{var oe;const W={...x,relatedRequestId:t.id};s&&!W.relatedTask&&(W.relatedTask={taskId:s});const C=((oe=W.relatedTask)==null?void 0:oe.taskId)??s;return C&&c&&await c.updateTaskStatus(C,"input_required"),await this.request(b,y,W)},authInfo:n==null?void 0:n.authInfo,requestId:t.id,requestInfo:n==null?void 0:n.requestInfo,taskId:s,taskStore:c,taskRequestedTtl:a==null?void 0:a.ttl,closeSSEStream:n==null?void 0:n.closeSSEStream,closeStandaloneSSEStream:n==null?void 0:n.closeStandaloneSSEStream};Promise.resolve().then(()=>{a&&this.assertTaskHandlerCapability(t.method)}).then(()=>o(t,d)).then(async b=>{if(i.signal.aborted)return;const y={result:b,jsonrpc:"2.0",id:t.id};s&&this._taskMessageQueue?await this._enqueueTaskMessage(s,{type:"response",message:y,timestamp:Date.now()},r==null?void 0:r.sessionId):await(r==null?void 0:r.send(y))},async b=>{if(i.signal.aborted)return;const y={jsonrpc:"2.0",id:t.id,error:{code:Number.isSafeInteger(b.code)?b.code:$.InternalError,message:b.message??"Internal error",...b.data!==void 0&&{data:b.data}}};s&&this._taskMessageQueue?await this._enqueueTaskMessage(s,{type:"error",message:y,timestamp:Date.now()},r==null?void 0:r.sessionId):await(r==null?void 0:r.send(y))}).catch(b=>this._onerror(new Error(`Failed to send response: ${b}`))).finally(()=>{this._requestHandlerAbortControllers.delete(t.id)})}_onprogress(t){const{progressToken:n,...o}=t.params,r=Number(n),s=this._progressHandlers.get(r);if(!s){this._onerror(new Error(`Received a progress notification for an unknown token: ${JSON.stringify(t)}`));return}const i=this._responseHandlers.get(r),a=this._timeoutInfo.get(r);if(a&&i&&a.resetTimeoutOnProgress)try{this._resetTimeout(r)}catch(c){this._responseHandlers.delete(r),this._progressHandlers.delete(r),this._cleanupTimeout(r),i(c);return}s(o)}_onresponse(t){const n=Number(t.id),o=this._requestResolvers.get(n);if(o){if(this._requestResolvers.delete(n),Ne(t))o(t);else{const i=new z(t.error.code,t.error.message,t.error.data);o(i)}return}const r=this._responseHandlers.get(n);if(r===void 0){this._onerror(new Error(`Received a response for an unknown message ID: ${JSON.stringify(t)}`));return}this._responseHandlers.delete(n),this._cleanupTimeout(n);let s=!1;if(Ne(t)&&t.result&&typeof t.result=="object"){const i=t.result;if(i.task&&typeof i.task=="object"){const a=i.task;typeof a.taskId=="string"&&(s=!0,this._taskProgressTokens.set(a.taskId,n))}}if(s||this._progressHandlers.delete(n),Ne(t))r(t);else{const i=z.fromError(t.error.code,t.error.message,t.error.data);r(i)}}get transport(){return this._transport}async close(){var t;await((t=this._transport)==null?void 0:t.close())}async*requestStream(t,n,o){var i,a;const{task:r}=o??{};if(!r){try{yield{type:"result",result:await this.request(t,n,o)}}catch(c){yield{type:"error",error:c instanceof z?c:new z($.InternalError,String(c))}}return}let s;try{const c=await this.request(t,vt,o);if(c.task)s=c.task.taskId,yield{type:"taskCreated",task:c.task};else throw new z($.InternalError,"Task creation did not return a task");for(;;){const d=await this.getTask({taskId:s},o);if(yield{type:"taskStatus",task:d},ue(d.status)){d.status==="completed"?yield{type:"result",result:await this.getTaskResult({taskId:s},n,o)}:d.status==="failed"?yield{type:"error",error:new z($.InternalError,`Task ${s} failed`)}:d.status==="cancelled"&&(yield{type:"error",error:new z($.InternalError,`Task ${s} was cancelled`)});return}if(d.status==="input_required"){yield{type:"result",result:await this.getTaskResult({taskId:s},n,o)};return}const h=d.pollInterval??((i=this._options)==null?void 0:i.defaultTaskPollInterval)??1e3;await new Promise(m=>setTimeout(m,h)),(a=o==null?void 0:o.signal)==null||a.throwIfAborted()}}catch(c){yield{type:"error",error:c instanceof z?c:new z($.InternalError,String(c))}}}request(t,n,o){const{relatedRequestId:r,resumptionToken:s,onresumptiontoken:i,task:a,relatedTask:c}=o??{};return new Promise((d,h)=>{var C,oe,K,j,J;const m=N=>{h(N)};if(!this._transport){m(new Error("Not connected"));return}if(((C=this._options)==null?void 0:C.enforceStrictCapabilities)===!0)try{this.assertCapabilityForMethod(t.method),a&&this.assertTaskCapability(t.method)}catch(N){m(N);return}(oe=o==null?void 0:o.signal)==null||oe.throwIfAborted();const g=this._requestMessageId++,_={...t,jsonrpc:"2.0",id:g};o!=null&&o.onprogress&&(this._progressHandlers.set(g,o.onprogress),_.params={...t.params,_meta:{...((K=t.params)==null?void 0:K._meta)||{},progressToken:g}}),a&&(_.params={..._.params,task:a}),c&&(_.params={..._.params,_meta:{...((j=_.params)==null?void 0:j._meta)||{},[le]:c}});const b=N=>{var ne;this._responseHandlers.delete(g),this._progressHandlers.delete(g),this._cleanupTimeout(g),(ne=this._transport)==null||ne.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:g,reason:String(N)}},{relatedRequestId:r,resumptionToken:s,onresumptiontoken:i}).catch(po=>this._onerror(new Error(`Failed to send cancellation: ${po}`)));const re=N instanceof z?N:new z($.RequestTimeout,String(N));h(re)};this._responseHandlers.set(g,N=>{var re;if(!((re=o==null?void 0:o.signal)!=null&&re.aborted)){if(N instanceof Error)return h(N);try{const ne=Cn(n,N.result);ne.success?d(ne.data):h(ne.error)}catch(ne){h(ne)}}}),(J=o==null?void 0:o.signal)==null||J.addEventListener("abort",()=>{var N;b((N=o==null?void 0:o.signal)==null?void 0:N.reason)});const y=(o==null?void 0:o.timeout)??Ju,x=()=>b(z.fromError($.RequestTimeout,"Request timed out",{timeout:y}));this._setupTimeout(g,y,o==null?void 0:o.maxTotalTimeout,x,(o==null?void 0:o.resetTimeoutOnProgress)??!1);const W=c==null?void 0:c.taskId;if(W){const N=re=>{const ne=this._responseHandlers.get(g);ne?ne(re):this._onerror(new Error(`Response handler missing for side-channeled request ${g}`))};this._requestResolvers.set(g,N),this._enqueueTaskMessage(W,{type:"request",message:_,timestamp:Date.now()}).catch(re=>{this._cleanupTimeout(g),h(re)})}else this._transport.send(_,{relatedRequestId:r,resumptionToken:s,onresumptiontoken:i}).catch(N=>{this._cleanupTimeout(g),h(N)})})}async getTask(t,n){return this.request({method:"tasks/get",params:t},yt,n)}async getTaskResult(t,n,o){return this.request({method:"tasks/result",params:t},n,o)}async listTasks(t,n){return this.request({method:"tasks/list",params:t},St,n)}async cancelTask(t,n){return this.request({method:"tasks/cancel",params:t},Rc,n)}async notification(t,n){var a,c,d,h;if(!this._transport)throw new Error("Not connected");this.assertNotificationCapability(t.method);const o=(a=n==null?void 0:n.relatedTask)==null?void 0:a.taskId;if(o){const m={...t,jsonrpc:"2.0",params:{...t.params,_meta:{...((c=t.params)==null?void 0:c._meta)||{},[le]:n.relatedTask}}};await this._enqueueTaskMessage(o,{type:"notification",message:m,timestamp:Date.now()});return}if((((d=this._options)==null?void 0:d.debouncedNotificationMethods)??[]).includes(t.method)&&!t.params&&!(n!=null&&n.relatedRequestId)&&!(n!=null&&n.relatedTask)){if(this._pendingDebouncedNotifications.has(t.method))return;this._pendingDebouncedNotifications.add(t.method),Promise.resolve().then(()=>{var g,_;if(this._pendingDebouncedNotifications.delete(t.method),!this._transport)return;let m={...t,jsonrpc:"2.0"};n!=null&&n.relatedTask&&(m={...m,params:{...m.params,_meta:{...((g=m.params)==null?void 0:g._meta)||{},[le]:n.relatedTask}}}),(_=this._transport)==null||_.send(m,n).catch(b=>this._onerror(b))});return}let i={...t,jsonrpc:"2.0"};n!=null&&n.relatedTask&&(i={...i,params:{...i.params,_meta:{...((h=i.params)==null?void 0:h._meta)||{},[le]:n.relatedTask}}}),await this._transport.send(i,n)}setRequestHandler(t,n){const o=Xt(t);this.assertRequestHandlerCapability(o),this._requestHandlers.set(o,(r,s)=>{const i=en(t,r);return Promise.resolve(n(i,s))})}removeRequestHandler(t){this._requestHandlers.delete(t)}assertCanSetRequestHandler(t){if(this._requestHandlers.has(t))throw new Error(`A request handler for ${t} already exists, which would be overridden`)}setNotificationHandler(t,n){const o=Xt(t);this._notificationHandlers.set(o,r=>{const s=en(t,r);return Promise.resolve(n(s))})}removeNotificationHandler(t){this._notificationHandlers.delete(t)}_cleanupTaskProgressHandler(t){const n=this._taskProgressTokens.get(t);n!==void 0&&(this._progressHandlers.delete(n),this._taskProgressTokens.delete(t))}async _enqueueTaskMessage(t,n,o){var s;if(!this._taskStore||!this._taskMessageQueue)throw new Error("Cannot enqueue task message: taskStore and taskMessageQueue are not configured");const r=(s=this._options)==null?void 0:s.maxTaskQueueSize;await this._taskMessageQueue.enqueue(t,n,o,r)}async _clearTaskQueue(t,n){if(this._taskMessageQueue){const o=await this._taskMessageQueue.dequeueAll(t,n);for(const r of o)if(r.type==="request"&&Yt(r.message)){const s=r.message.id,i=this._requestResolvers.get(s);i?(i(new z($.InternalError,"Task cancelled or completed")),this._requestResolvers.delete(s)):this._onerror(new Error(`Resolver missing for request ${s} during task ${t} cleanup`))}}}async _waitForTaskUpdate(t,n){var r,s;let o=((r=this._options)==null?void 0:r.defaultTaskPollInterval)??1e3;try{const i=await((s=this._taskStore)==null?void 0:s.getTask(t));i!=null&&i.pollInterval&&(o=i.pollInterval)}catch{}return new Promise((i,a)=>{if(n.aborted){a(new z($.InvalidRequest,"Request cancelled"));return}const c=setTimeout(i,o);n.addEventListener("abort",()=>{clearTimeout(c),a(new z($.InvalidRequest,"Request cancelled"))},{once:!0})})}requestTaskStore(t,n){const o=this._taskStore;if(!o)throw new Error("No task store configured");return{createTask:async r=>{if(!t)throw new Error("No request provided");return await o.createTask(r,t.id,{method:t.method,params:t.params},n)},getTask:async r=>{const s=await o.getTask(r,n);if(!s)throw new z($.InvalidParams,"Failed to retrieve task: Task not found");return s},storeTaskResult:async(r,s,i)=>{await o.storeTaskResult(r,s,i,n);const a=await o.getTask(r,n);if(a){const c=De.parse({method:"notifications/tasks/status",params:a});await this.notification(c),ue(a.status)&&this._cleanupTaskProgressHandler(r)}},getTaskResult:r=>o.getTaskResult(r,n),updateTaskStatus:async(r,s,i)=>{const a=await o.getTask(r,n);if(!a)throw new z($.InvalidParams,`Task "${r}" not found - it may have been cleaned up`);if(ue(a.status))throw new z($.InvalidParams,`Cannot update task "${r}" from terminal status "${a.status}" to "${s}". Terminal states (completed, failed, cancelled) cannot transition to other states.`);await o.updateTaskStatus(r,s,i,n);const c=await o.getTask(r,n);if(c){const d=De.parse({method:"notifications/tasks/status",params:c});await this.notification(d),ue(c.status)&&this._cleanupTaskProgressHandler(r)}},listTasks:r=>o.listTasks(r,n)}}}var Bu="2026-01-26",Wu="ui/notifications/tool-input-partial";class Ku{constructor(t=window.parent,n){H(this,"eventTarget");H(this,"eventSource");H(this,"messageListener");H(this,"onclose");H(this,"onerror");H(this,"onmessage");H(this,"sessionId");H(this,"setProtocolVersion");this.eventTarget=t,this.eventSource=n,this.messageListener=o=>{var s,i,a;if(n&&o.source!==this.eventSource){console.debug("Ignoring message from unknown source",o);return}let r=uc.safeParse(o.data);r.success?(console.debug("Parsed message",r.data),(s=this.onmessage)==null||s.call(this,r.data)):((i=o.data)==null?void 0:i.jsonrpc)!=="2.0"?console.debug("Ignoring non-JSON-RPC message",r.error.message,o):(console.error("Failed to parse message",r.error.message,o),(a=this.onerror)==null||a.call(this,Error("Invalid JSON-RPC message received: "+r.error.message)))}}async start(){window.addEventListener("message",this.messageListener)}async send(t,n){t.method!==Wu&&console.debug("Sending message",t),this.eventTarget.postMessage(t,"*")}async close(){var t;window.removeEventListener("message",this.messageListener),(t=this.onclose)==null||t.call(this)}}var Gu=S([u("light"),u("dark")]).describe("Color theme preference for the host environment."),Se=S([u("inline"),u("fullscreen"),u("pip")]).describe("Display mode for UI presentation."),Qu=S([u("--color-background-primary"),u("--color-background-secondary"),u("--color-background-tertiary"),u("--color-background-inverse"),u("--color-background-ghost"),u("--color-background-info"),u("--color-background-danger"),u("--color-background-success"),u("--color-background-warning"),u("--color-background-disabled"),u("--color-text-primary"),u("--color-text-secondary"),u("--color-text-tertiary"),u("--color-text-inverse"),u("--color-text-ghost"),u("--color-text-info"),u("--color-text-danger"),u("--color-text-success"),u("--color-text-warning"),u("--color-text-disabled"),u("--color-border-primary"),u("--color-border-secondary"),u("--color-border-tertiary"),u("--color-border-inverse"),u("--color-border-ghost"),u("--color-border-info"),u("--color-border-danger"),u("--color-border-success"),u("--color-border-warning"),u("--color-border-disabled"),u("--color-ring-primary"),u("--color-ring-secondary"),u("--color-ring-inverse"),u("--color-ring-info"),u("--color-ring-danger"),u("--color-ring-success"),u("--color-ring-warning"),u("--font-sans"),u("--font-mono"),u("--font-weight-normal"),u("--font-weight-medium"),u("--font-weight-semibold"),u("--font-weight-bold"),u("--font-text-xs-size"),u("--font-text-sm-size"),u("--font-text-md-size"),u("--font-text-lg-size"),u("--font-heading-xs-size"),u("--font-heading-sm-size"),u("--font-heading-md-size"),u("--font-heading-lg-size"),u("--font-heading-xl-size"),u("--font-heading-2xl-size"),u("--font-heading-3xl-size"),u("--font-text-xs-line-height"),u("--font-text-sm-line-height"),u("--font-text-md-line-height"),u("--font-text-lg-line-height"),u("--font-heading-xs-line-height"),u("--font-heading-sm-line-height"),u("--font-heading-md-line-height"),u("--font-heading-lg-line-height"),u("--font-heading-xl-line-height"),u("--font-heading-2xl-line-height"),u("--font-heading-3xl-line-height"),u("--border-radius-xs"),u("--border-radius-sm"),u("--border-radius-md"),u("--border-radius-lg"),u("--border-radius-xl"),u("--border-radius-full"),u("--border-width-regular"),u("--shadow-hairline"),u("--shadow-sm"),u("--shadow-md"),u("--shadow-lg")]).describe("CSS variable keys available to MCP apps for theming."),Yu=R(Qu.describe(`Style variables for theming MCP apps.
|
|
47
47
|
|
|
48
48
|
Individual style keys are optional - hosts may provide any subset of these values.
|
|
49
49
|
Values are strings containing CSS values (colors, sizes, font stacks, etc.).
|
|
@@ -64,7 +64,7 @@ Note: This type uses \`Record<K, string | undefined>\` rather than \`Partial<Rec
|
|
|
64
64
|
for compatibility with Zod schema generation. Both are functionally equivalent for validation.`);p({method:u("ui/open-link"),params:p({url:l().describe("URL to open in the host's browser")})});var Xu=p({isError:P().optional().describe("True if the host failed to open the URL (e.g., due to security policy).")}).passthrough(),el=p({isError:P().optional().describe("True if the download failed (e.g., user cancelled or host denied).")}).passthrough(),tl=p({isError:P().optional().describe("True if the host rejected or failed to deliver the message.")}).passthrough();p({method:u("ui/notifications/sandbox-proxy-ready"),params:p({})});var Zt=p({connectDomains:k(l()).optional().describe(`Origins for network requests (fetch/XHR/WebSocket).
|
|
65
65
|
|
|
66
66
|
- Maps to CSP \`connect-src\` directive
|
|
67
|
-
- Empty or omitted → no network connections (secure default)`),resourceDomains:k(l()).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:k(l()).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:k(l()).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'`)")}),Ot=p({camera:p({}).optional().describe("Request camera access.\n\nMaps to Permission Policy `camera` feature."),microphone:p({}).optional().describe("Request microphone access.\n\nMaps to Permission Policy `microphone` feature."),geolocation:p({}).optional().describe("Request geolocation access.\n\nMaps to Permission Policy `geolocation` feature."),clipboardWrite:p({}).optional().describe("Request clipboard write access.\n\nMaps to Permission Policy `clipboard-write` feature.")});p({method:u("ui/notifications/size-changed"),params:p({width:w().optional().describe("New width in pixels."),height:w().optional().describe("New height in pixels.")})});var nl=p({method:u("ui/notifications/tool-input"),params:p({arguments:
|
|
67
|
+
- Empty or omitted → no network connections (secure default)`),resourceDomains:k(l()).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:k(l()).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:k(l()).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'`)")}),Ot=p({camera:p({}).optional().describe("Request camera access.\n\nMaps to Permission Policy `camera` feature."),microphone:p({}).optional().describe("Request microphone access.\n\nMaps to Permission Policy `microphone` feature."),geolocation:p({}).optional().describe("Request geolocation access.\n\nMaps to Permission Policy `geolocation` feature."),clipboardWrite:p({}).optional().describe("Request clipboard write access.\n\nMaps to Permission Policy `clipboard-write` feature.")});p({method:u("ui/notifications/size-changed"),params:p({width:w().optional().describe("New width in pixels."),height:w().optional().describe("New height in pixels.")})});var nl=p({method:u("ui/notifications/tool-input"),params:p({arguments:R(l(),I().describe("Complete tool call arguments as key-value pairs.")).optional().describe("Complete tool call arguments as key-value pairs.")})}),ol=p({method:u("ui/notifications/tool-input-partial"),params:p({arguments:R(l(),I().describe("Partial tool call arguments (incomplete, may change).")).optional().describe("Partial tool call arguments (incomplete, may change).")})}),rl=p({method:u("ui/notifications/tool-cancelled"),params:p({reason:l().optional().describe('Optional reason for the cancellation (e.g., "user action", "timeout").')})}),sl=p({fonts:l().optional()}),il=p({variables:Yu.optional().describe("CSS variables for theming the app."),css:sl.optional().describe("CSS blocks that apps can inject.")}),al=p({method:u("ui/resource-teardown"),params:p({})});R(l(),I());var tn=p({text:p({}).optional().describe("Host supports text content blocks."),image:p({}).optional().describe("Host supports image content blocks."),audio:p({}).optional().describe("Host supports audio content blocks."),resource:p({}).optional().describe("Host supports resource content blocks."),resourceLink:p({}).optional().describe("Host supports resource link content blocks."),structuredContent:p({}).optional().describe("Host supports structured content.")});p({method:u("ui/notifications/request-teardown"),params:p({}).optional()});var cl=p({experimental:p({}).optional().describe("Experimental features (structure TBD)."),openLinks:p({}).optional().describe("Host supports opening external URLs."),downloadFile:p({}).optional().describe("Host supports file downloads via ui/download-file."),serverTools:p({listChanged:P().optional().describe("Host supports tools/list_changed notifications.")}).optional().describe("Host can proxy tool calls to the MCP server."),serverResources:p({listChanged:P().optional().describe("Host supports resources/list_changed notifications.")}).optional().describe("Host can proxy resource reads to the MCP server."),logging:p({}).optional().describe("Host accepts log messages."),sandbox:p({permissions:Ot.optional().describe("Permissions granted by the host (camera, microphone, geolocation)."),csp:Zt.optional().describe("CSP domains approved by the host.")}).optional().describe("Sandbox configuration applied by the host."),updateModelContext:tn.optional().describe("Host accepts context updates (ui/update-model-context) to be included in the model's context for future turns."),message:tn.optional().describe("Host supports receiving content messages (ui/message) from the view.")}),ul=p({experimental:p({}).optional().describe("Experimental features (structure TBD)."),tools:p({listChanged:P().optional().describe("App supports tools/list_changed notifications.")}).optional().describe("App exposes MCP-style tools that the host can call."),availableDisplayModes:k(Se).optional().describe("Display modes the app supports.")});p({method:u("ui/notifications/initialized"),params:p({}).optional()});p({csp:Zt.optional().describe("Content Security Policy configuration for UI resources."),permissions:Ot.optional().describe("Sandbox permissions requested by the UI resource."),domain:l().optional().describe(`Dedicated origin for view sandbox.
|
|
68
68
|
|
|
69
69
|
Useful when views need stable, dedicated origins for OAuth callbacks, CORS policies, or API key allowlists.
|
|
70
70
|
|
|
@@ -81,7 +81,7 @@ Boolean requesting whether a visible border and background is provided by the ho
|
|
|
81
81
|
- omitted: host decides border`)});p({method:u("ui/request-display-mode"),params:p({mode:Se.describe("The display mode being requested.")})});var ll=p({mode:Se.describe("The display mode that was actually set. May differ from requested if not supported.")}).passthrough(),dl=S([u("model"),u("app")]).describe("Tool visibility scope - who can access the tool.");p({resourceUri:l().optional(),visibility:k(dl).optional().describe(`Who can access this tool. Default: ["model", "app"]
|
|
82
82
|
- "model": Tool visible to and callable by the agent
|
|
83
83
|
- "app": Tool callable by the app from this server only`)});p({mimeTypes:k(l()).optional().describe('Array of supported MIME types for UI resources.\nMust include `"text/html;profile=mcp-app"` for MCP Apps support.')});p({method:u("ui/download-file"),params:p({contents:k(S([oo,ro])).describe("Resource contents to download — embedded (inline data) or linked (host fetches). Uses standard MCP resource types.")})});p({method:u("ui/message"),params:p({role:u("user").describe('Message role, currently only "user" is supported.'),content:k(Ze).describe("Message content blocks (text, image, etc.).")})});p({method:u("ui/notifications/sandbox-resource-ready"),params:p({html:l().describe("HTML content to load into the inner iframe."),sandbox:l().optional().describe("Optional override for the inner iframe's sandbox attribute."),csp:Zt.optional().describe("CSP configuration from resource metadata."),permissions:Ot.optional().describe("Sandbox permissions from resource metadata.")})});var pl=p({method:u("ui/notifications/tool-result"),params:Ke.describe("Standard MCP tool execution result.")}),co=p({toolInfo:p({id:Te.optional().describe("JSON-RPC id of the tools/call request."),tool:Et.describe("Tool definition including name, inputSchema, etc.")}).optional().describe("Metadata of the tool call that instantiated this App."),theme:Gu.optional().describe("Current color theme preference."),styles:il.optional().describe("Style configuration for theming the app."),displayMode:Se.optional().describe("How the UI is currently displayed."),availableDisplayModes:k(Se).optional().describe("Display modes the host supports."),containerDimensions:S([p({height:w().describe("Fixed container height in pixels.")}),p({maxHeight:S([w(),et()]).optional().describe("Maximum container height in pixels.")})]).and(S([p({width:w().describe("Fixed container width in pixels.")}),p({maxWidth:S([w(),et()]).optional().describe("Maximum container width in pixels.")})])).optional().describe(`Container dimensions. Represents the dimensions of the iframe or other
|
|
84
|
-
container holding the app. Specify either width or maxWidth, and either height or maxHeight.`),locale:l().optional().describe("User's language and region preference in BCP 47 format."),timeZone:l().optional().describe("User's timezone in IANA format."),userAgent:l().optional().describe("Host application identifier."),platform:S([u("web"),u("desktop"),u("mobile")]).optional().describe("Platform type for responsive design decisions."),deviceCapabilities:p({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:p({top:w().describe("Top safe area inset in pixels."),right:w().describe("Right safe area inset in pixels."),bottom:w().describe("Bottom safe area inset in pixels."),left:w().describe("Left safe area inset in pixels.")}).optional().describe("Mobile safe area boundaries in pixels.")}).passthrough(),hl=p({method:u("ui/notifications/host-context-changed"),params:co.describe("Partial context update containing only changed fields.")});p({method:u("ui/update-model-context"),params:p({content:k(Ze).optional().describe("Context content blocks (text, image, etc.)."),structuredContent:
|
|
84
|
+
container holding the app. Specify either width or maxWidth, and either height or maxHeight.`),locale:l().optional().describe("User's language and region preference in BCP 47 format."),timeZone:l().optional().describe("User's timezone in IANA format."),userAgent:l().optional().describe("Host application identifier."),platform:S([u("web"),u("desktop"),u("mobile")]).optional().describe("Platform type for responsive design decisions."),deviceCapabilities:p({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:p({top:w().describe("Top safe area inset in pixels."),right:w().describe("Right safe area inset in pixels."),bottom:w().describe("Bottom safe area inset in pixels."),left:w().describe("Left safe area inset in pixels.")}).optional().describe("Mobile safe area boundaries in pixels.")}).passthrough(),hl=p({method:u("ui/notifications/host-context-changed"),params:co.describe("Partial context update containing only changed fields.")});p({method:u("ui/update-model-context"),params:p({content:k(Ze).optional().describe("Context content blocks (text, image, etc.)."),structuredContent:R(l(),I().describe("Structured content for machine-readable context data.")).optional().describe("Structured content for machine-readable context data.")})});p({method:u("ui/initialize"),params:p({appInfo:Be.describe("App identification (name and version)."),appCapabilities:ul.describe("Features and capabilities this app provides."),protocolVersion:l().describe("Protocol version this app supports.")})});var fl=p({protocolVersion:l().describe('Negotiated protocol version string (e.g., "2025-11-21").'),hostInfo:Be.describe("Host application identification and version."),hostCapabilities:cl.describe("Features and capabilities provided by the host."),hostContext:co.describe("Rich context about the host environment.")}).passthrough();function ml(e){let t=document.documentElement;t.setAttribute("data-theme",e),t.style.colorScheme=e}function gl(e,t=document.documentElement){for(let[n,o]of Object.entries(e))o!==void 0&&t.style.setProperty(n,o)}function _l(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)}class vl extends Vu{constructor(n,o={},r={autoResize:!0}){super(r);H(this,"_appInfo");H(this,"_capabilities");H(this,"options");H(this,"_hostCapabilities");H(this,"_hostInfo");H(this,"_hostContext");H(this,"sendOpenLink",this.openLink);this._appInfo=n,this._capabilities=o,this.options=r,this.setRequestHandler(We,s=>(console.log("Received ping:",s.params),{})),this.onhostcontextchanged=()=>{}}getHostCapabilities(){return this._hostCapabilities}getHostVersion(){return this._hostInfo}getHostContext(){return this._hostContext}set ontoolinput(n){this.setNotificationHandler(nl,o=>n(o.params))}set ontoolinputpartial(n){this.setNotificationHandler(ol,o=>n(o.params))}set ontoolresult(n){this.setNotificationHandler(pl,o=>n(o.params))}set ontoolcancelled(n){this.setNotificationHandler(rl,o=>n(o.params))}set onhostcontextchanged(n){this.setNotificationHandler(hl,o=>{this._hostContext={...this._hostContext,...o.params},n(o.params)})}set onteardown(n){this.setRequestHandler(al,(o,r)=>n(o.params,r))}set oncalltool(n){this.setRequestHandler(io,(o,r)=>n(o.params,r))}set onlisttools(n){this.setRequestHandler(so,(o,r)=>n(o.params,r))}assertCapabilityForMethod(n){}assertRequestHandlerCapability(n){switch(n){case"tools/call":case"tools/list":if(!this._capabilities.tools)throw Error(`Client does not support tool capability (required for ${n})`);return;case"ping":case"ui/resource-teardown":return;default:throw Error(`No handler for method ${n} registered`)}}assertNotificationCapability(n){}assertTaskCapability(n){throw Error("Tasks are not supported in MCP Apps")}assertTaskHandlerCapability(n){throw Error("Task handlers are not supported in MCP Apps")}async callServerTool(n,o){if(typeof n=="string")throw Error(`callServerTool() expects an object as its first argument, but received a string ("${n}"). Did you mean: callServerTool({ name: "${n}", arguments: { ... } })?`);return await this.request({method:"tools/call",params:n},Ke,o)}async readServerResource(n,o){return await this.request({method:"resources/read",params:n},no,o)}async listServerResources(n,o){return await this.request({method:"resources/list",params:n},to,o)}sendMessage(n,o){return this.request({method:"ui/message",params:n},tl,o)}sendLog(n){return this.notification({method:"notifications/message",params:n})}updateModelContext(n,o){return this.request({method:"ui/update-model-context",params:n},mt,o)}openLink(n,o){return this.request({method:"ui/open-link",params:n},Xu,o)}downloadFile(n,o){return this.request({method:"ui/download-file",params:n},el,o)}requestTeardown(n={}){return this.notification({method:"ui/notifications/request-teardown",params:n})}requestDisplayMode(n,o){return this.request({method:"ui/request-display-mode",params:n},ll,o)}sendSizeChanged(n){return this.notification({method:"ui/notifications/size-changed",params:n})}setupSizeChangedNotifications(){let n=!1,o=0,r=0,s=()=>{n||(n=!0,requestAnimationFrame(()=>{n=!1;let a=document.documentElement,c=a.style.width,d=a.style.height;a.style.width="fit-content",a.style.height="max-content";let h=a.getBoundingClientRect();a.style.width=c,a.style.height=d;let m=window.innerWidth-a.clientWidth,g=Math.ceil(h.width+m),_=Math.ceil(h.height);(g!==o||_!==r)&&(o=g,r=_,this.sendSizeChanged({width:g,height:_}))}))};s();let i=new ResizeObserver(s);return i.observe(document.documentElement),i.observe(document.body),()=>i.disconnect()}async connect(n=new Ku(window.parent,window.parent),o){var r;if(this.transport)throw Error("App is already connected. Call close() before connecting again.");await super.connect(n);try{let s=await this.request({method:"ui/initialize",params:{appCapabilities:this._capabilities,appInfo:this._appInfo,protocolVersion:Bu}},fl,o);if(s===void 0)throw Error(`Server sent invalid initialize result: ${s}`);this._hostCapabilities=s.hostCapabilities,this._hostInfo=s.hostInfo,this._hostContext=s.hostContext,await this.notification({method:"ui/notifications/initialized"}),(r=this.options)!=null&&r.autoResize&&this.setupSizeChangedNotifications()}catch(s){throw this.close(),s}}}function uo(e){const{time:t}=e.structuredContent??{};return t??"[ERROR]"}const qe=document.querySelector(".main"),ot=document.getElementById("server-time"),bl=document.getElementById("get-time-btn"),nn=document.getElementById("message-text"),yl=document.getElementById("send-message-btn"),on=document.getElementById("log-text"),kl=document.getElementById("send-log-btn"),rn=document.getElementById("link-url"),wl=document.getElementById("open-link-btn");function lo(e){var t,n,o;e.theme&&ml(e.theme),(t=e.styles)!=null&&t.variables&&gl(e.styles.variables),(o=(n=e.styles)==null?void 0:n.css)!=null&&o.fonts&&_l(e.styles.css.fonts),e.safeAreaInsets&&(qe.style.paddingTop=`${e.safeAreaInsets.top}px`,qe.style.paddingRight=`${e.safeAreaInsets.right}px`,qe.style.paddingBottom=`${e.safeAreaInsets.bottom}px`,qe.style.paddingLeft=`${e.safeAreaInsets.left}px`)}const Y=new vl({name:"Get Time App",version:"1.0.0"});Y.onteardown=async()=>(console.info("App is being torn down"),{});Y.ontoolinput=e=>{console.info("Received tool call input:",e)};Y.ontoolresult=e=>{console.info("Received tool call result:",e),ot.textContent=uo(e)};Y.ontoolcancelled=e=>{console.info("Tool call cancelled:",e.reason)};Y.onerror=console.error;Y.onhostcontextchanged=lo;bl.addEventListener("click",async()=>{try{console.info("Calling get-time tool...");const e=await Y.callServerTool({name:"get-time",arguments:{}});console.info("get-time result:",e),ot.textContent=uo(e)}catch(e){console.error(e),ot.textContent="[ERROR]"}});yl.addEventListener("click",async()=>{const e=AbortSignal.timeout(5e3);try{console.info("Sending message text to Host:",nn.value);const{isError:t}=await Y.sendMessage({role:"user",content:[{type:"text",text:nn.value}]},{signal:e});console.info("Message",t?"rejected":"accepted")}catch(t){console.error("Message send error:",e.aborted?"timed out":t)}});kl.addEventListener("click",async()=>{console.info("Sending log text to Host:",on.value),await Y.sendLog({level:"info",data:on.value})});wl.addEventListener("click",async()=>{console.info("Sending open link request to Host:",rn.value);const{isError:e}=await Y.openLink({url:rn.value});console.info("Open link request",e?"rejected":"accepted")});Y.connect().then(()=>{const e=Y.getHostContext();e&&lo(e)});</script>
|
|
85
85
|
<style rel="stylesheet" crossorigin>:root{color-scheme:light dark;--color-text-primary: light-dark(#1f2937, #f3f4f6);--color-text-inverse: light-dark(#f3f4f6, #1f2937);--color-text-info: light-dark(#1d4ed8, #60a5fa);--color-background-primary: light-dark(#ffffff, #1a1a1a);--color-background-inverse: light-dark(#1a1a1a, #ffffff);--color-background-info: light-dark(#eff6ff, #1e3a5f);--color-ring-primary: light-dark(#3b82f6, #60a5fa);--border-radius-md: 6px;--border-width-regular: 1px;--font-sans: ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";--font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;--font-weight-normal: 400;--font-weight-bold: 700;--font-text-md-size: 1rem;--font-text-md-line-height: 1.5;--font-heading-3xl-size: 2.25rem;--font-heading-3xl-line-height: 1.1;--font-heading-2xl-size: 1.875rem;--font-heading-2xl-line-height: 1.2;--font-heading-xl-size: 1.5rem;--font-heading-xl-line-height: 1.25;--font-heading-lg-size: 1.25rem;--font-heading-lg-line-height: 1.3;--font-heading-md-size: 1rem;--font-heading-md-line-height: 1.4;--font-heading-sm-size: .875rem;--font-heading-sm-line-height: 1.4;--spacing-unit: var(--font-text-md-size);--spacing-xs: calc(var(--spacing-unit) * .25);--spacing-sm: calc(var(--spacing-unit) * .5);--spacing-md: var(--spacing-unit);--spacing-lg: calc(var(--spacing-unit) * 1.5);--color-accent: #2563eb;--color-text-on-accent: #ffffff}*{box-sizing:border-box}html,body{font-family:var(--font-sans);font-size:var(--font-text-md-size);font-weight:var(--font-weight-normal);line-height:var(--font-text-md-line-height);color:var(--color-text-primary)}h1{font-size:var(--font-heading-3xl-size);line-height:var(--font-heading-3xl-line-height)}h2{font-size:var(--font-heading-2xl-size);line-height:var(--font-heading-2xl-line-height)}h3{font-size:var(--font-heading-xl-size);line-height:var(--font-heading-xl-line-height)}h4{font-size:var(--font-heading-lg-size);line-height:var(--font-heading-lg-line-height)}h5{font-size:var(--font-heading-md-size);line-height:var(--font-heading-md-line-height)}h6{font-size:var(--font-heading-sm-size);line-height:var(--font-heading-sm-line-height)}code,pre,kbd{font-family:var(--font-mono);font-size:1em}b,strong{font-weight:var(--font-weight-bold)}.main{width:100%;max-width:425px;box-sizing:border-box}.main>*{margin-top:0;margin-bottom:0}.main>*+*{margin-top:var(--spacing-lg)}.action>*{margin-top:0;margin-bottom:0;width:100%}.action>*+*{margin-top:var(--spacing-sm)}.action>p{display:flex;align-items:baseline;gap:var(--spacing-xs)}.action textarea,.action input{display:block;font-family:inherit;font-size:inherit}.action button{padding:var(--spacing-sm) var(--spacing-md);border:none;border-radius:var(--border-radius-md);color:var(--color-text-on-accent);font-weight:var(--font-weight-bold);background-color:var(--color-accent);cursor:pointer}.action button:hover{background-color:color-mix(in srgb,var(--color-accent) 85%,var(--color-background-inverse))}.action button:focus-visible{outline:calc(var(--border-width-regular) * 2) solid var(--color-ring-primary);outline-offset:var(--border-width-regular)}.notice{padding:var(--spacing-sm) var(--spacing-md);color:var(--color-text-info);text-align:center;font-style:italic;background-color:var(--color-background-info)}.notice:before{content:"ℹ️ ";font-style:normal}#server-time{flex:1;min-width:0}</style>
|
|
86
86
|
</head>
|
|
87
87
|
<body>
|
package/dist/server.js
CHANGED
|
@@ -147,22 +147,22 @@ var require_code = __commonJS((exports) => {
|
|
|
147
147
|
i2++;
|
|
148
148
|
}
|
|
149
149
|
}
|
|
150
|
-
function mergeExprItems(a2,
|
|
151
|
-
if (
|
|
150
|
+
function mergeExprItems(a2, b) {
|
|
151
|
+
if (b === '""')
|
|
152
152
|
return a2;
|
|
153
153
|
if (a2 === '""')
|
|
154
|
-
return
|
|
154
|
+
return b;
|
|
155
155
|
if (typeof a2 == "string") {
|
|
156
|
-
if (
|
|
156
|
+
if (b instanceof Name || a2[a2.length - 1] !== '"')
|
|
157
157
|
return;
|
|
158
|
-
if (typeof
|
|
159
|
-
return `${a2.slice(0, -1)}${
|
|
160
|
-
if (
|
|
161
|
-
return a2.slice(0, -1) +
|
|
158
|
+
if (typeof b != "string")
|
|
159
|
+
return `${a2.slice(0, -1)}${b}"`;
|
|
160
|
+
if (b[0] === '"')
|
|
161
|
+
return a2.slice(0, -1) + b.slice(1);
|
|
162
162
|
return;
|
|
163
163
|
}
|
|
164
|
-
if (typeof
|
|
165
|
-
return `"${a2}${
|
|
164
|
+
if (typeof b == "string" && b[0] === '"' && !(a2 instanceof Name))
|
|
165
|
+
return `"${a2}${b.slice(1)}`;
|
|
166
166
|
return;
|
|
167
167
|
}
|
|
168
168
|
function strConcat(c1, c2) {
|
|
@@ -1997,43 +1997,43 @@ var require_subschema = __commonJS((exports) => {
|
|
|
1997
1997
|
|
|
1998
1998
|
// ../../node_modules/fast-deep-equal/index.js
|
|
1999
1999
|
var require_fast_deep_equal = __commonJS((exports, module) => {
|
|
2000
|
-
module.exports = function equal(a2,
|
|
2001
|
-
if (a2 ===
|
|
2000
|
+
module.exports = function equal(a2, b) {
|
|
2001
|
+
if (a2 === b)
|
|
2002
2002
|
return true;
|
|
2003
|
-
if (a2 &&
|
|
2004
|
-
if (a2.constructor !==
|
|
2003
|
+
if (a2 && b && typeof a2 == "object" && typeof b == "object") {
|
|
2004
|
+
if (a2.constructor !== b.constructor)
|
|
2005
2005
|
return false;
|
|
2006
2006
|
var length, i2, keys;
|
|
2007
2007
|
if (Array.isArray(a2)) {
|
|
2008
2008
|
length = a2.length;
|
|
2009
|
-
if (length !=
|
|
2009
|
+
if (length != b.length)
|
|
2010
2010
|
return false;
|
|
2011
2011
|
for (i2 = length;i2-- !== 0; )
|
|
2012
|
-
if (!equal(a2[i2],
|
|
2012
|
+
if (!equal(a2[i2], b[i2]))
|
|
2013
2013
|
return false;
|
|
2014
2014
|
return true;
|
|
2015
2015
|
}
|
|
2016
2016
|
if (a2.constructor === RegExp)
|
|
2017
|
-
return a2.source ===
|
|
2017
|
+
return a2.source === b.source && a2.flags === b.flags;
|
|
2018
2018
|
if (a2.valueOf !== Object.prototype.valueOf)
|
|
2019
|
-
return a2.valueOf() ===
|
|
2019
|
+
return a2.valueOf() === b.valueOf();
|
|
2020
2020
|
if (a2.toString !== Object.prototype.toString)
|
|
2021
|
-
return a2.toString() ===
|
|
2021
|
+
return a2.toString() === b.toString();
|
|
2022
2022
|
keys = Object.keys(a2);
|
|
2023
2023
|
length = keys.length;
|
|
2024
|
-
if (length !== Object.keys(
|
|
2024
|
+
if (length !== Object.keys(b).length)
|
|
2025
2025
|
return false;
|
|
2026
2026
|
for (i2 = length;i2-- !== 0; )
|
|
2027
|
-
if (!Object.prototype.hasOwnProperty.call(
|
|
2027
|
+
if (!Object.prototype.hasOwnProperty.call(b, keys[i2]))
|
|
2028
2028
|
return false;
|
|
2029
2029
|
for (i2 = length;i2-- !== 0; ) {
|
|
2030
2030
|
var key = keys[i2];
|
|
2031
|
-
if (!equal(a2[key],
|
|
2031
|
+
if (!equal(a2[key], b[key]))
|
|
2032
2032
|
return false;
|
|
2033
2033
|
}
|
|
2034
2034
|
return true;
|
|
2035
2035
|
}
|
|
2036
|
-
return a2 !== a2 &&
|
|
2036
|
+
return a2 !== a2 && b !== b;
|
|
2037
2037
|
};
|
|
2038
2038
|
});
|
|
2039
2039
|
|
|
@@ -27025,8 +27025,8 @@ class j {
|
|
|
27025
27025
|
sessionId;
|
|
27026
27026
|
setProtocolVersion;
|
|
27027
27027
|
}
|
|
27028
|
-
var
|
|
27029
|
-
var
|
|
27028
|
+
var g = exports_external.union([exports_external.literal("light"), exports_external.literal("dark")]).describe("Color theme preference for the host environment.");
|
|
27029
|
+
var G = exports_external.union([exports_external.literal("inline"), exports_external.literal("fullscreen"), exports_external.literal("pip")]).describe("Display mode for UI presentation.");
|
|
27030
27030
|
var i = exports_external.union([exports_external.literal("--color-background-primary"), exports_external.literal("--color-background-secondary"), exports_external.literal("--color-background-tertiary"), exports_external.literal("--color-background-inverse"), exports_external.literal("--color-background-ghost"), exports_external.literal("--color-background-info"), exports_external.literal("--color-background-danger"), exports_external.literal("--color-background-success"), exports_external.literal("--color-background-warning"), exports_external.literal("--color-background-disabled"), exports_external.literal("--color-text-primary"), exports_external.literal("--color-text-secondary"), exports_external.literal("--color-text-tertiary"), exports_external.literal("--color-text-inverse"), exports_external.literal("--color-text-ghost"), exports_external.literal("--color-text-info"), exports_external.literal("--color-text-danger"), exports_external.literal("--color-text-success"), exports_external.literal("--color-text-warning"), exports_external.literal("--color-text-disabled"), exports_external.literal("--color-border-primary"), exports_external.literal("--color-border-secondary"), exports_external.literal("--color-border-tertiary"), exports_external.literal("--color-border-inverse"), exports_external.literal("--color-border-ghost"), exports_external.literal("--color-border-info"), exports_external.literal("--color-border-danger"), exports_external.literal("--color-border-success"), exports_external.literal("--color-border-warning"), exports_external.literal("--color-border-disabled"), exports_external.literal("--color-ring-primary"), exports_external.literal("--color-ring-secondary"), exports_external.literal("--color-ring-inverse"), exports_external.literal("--color-ring-info"), exports_external.literal("--color-ring-danger"), exports_external.literal("--color-ring-success"), exports_external.literal("--color-ring-warning"), exports_external.literal("--font-sans"), exports_external.literal("--font-mono"), exports_external.literal("--font-weight-normal"), exports_external.literal("--font-weight-medium"), exports_external.literal("--font-weight-semibold"), exports_external.literal("--font-weight-bold"), exports_external.literal("--font-text-xs-size"), exports_external.literal("--font-text-sm-size"), exports_external.literal("--font-text-md-size"), exports_external.literal("--font-text-lg-size"), exports_external.literal("--font-heading-xs-size"), exports_external.literal("--font-heading-sm-size"), exports_external.literal("--font-heading-md-size"), exports_external.literal("--font-heading-lg-size"), exports_external.literal("--font-heading-xl-size"), exports_external.literal("--font-heading-2xl-size"), exports_external.literal("--font-heading-3xl-size"), exports_external.literal("--font-text-xs-line-height"), exports_external.literal("--font-text-sm-line-height"), exports_external.literal("--font-text-md-line-height"), exports_external.literal("--font-text-lg-line-height"), exports_external.literal("--font-heading-xs-line-height"), exports_external.literal("--font-heading-sm-line-height"), exports_external.literal("--font-heading-md-line-height"), exports_external.literal("--font-heading-lg-line-height"), exports_external.literal("--font-heading-xl-line-height"), exports_external.literal("--font-heading-2xl-line-height"), exports_external.literal("--font-heading-3xl-line-height"), exports_external.literal("--border-radius-xs"), exports_external.literal("--border-radius-sm"), exports_external.literal("--border-radius-md"), exports_external.literal("--border-radius-lg"), exports_external.literal("--border-radius-xl"), exports_external.literal("--border-radius-full"), exports_external.literal("--border-width-regular"), exports_external.literal("--shadow-hairline"), exports_external.literal("--shadow-sm"), exports_external.literal("--shadow-md"), exports_external.literal("--shadow-lg")]).describe("CSS variable keys available to MCP apps for theming.");
|
|
27031
27031
|
var o = exports_external.record(i.describe(`Style variables for theming MCP apps.
|
|
27032
27032
|
|
|
@@ -27061,15 +27061,16 @@ var t = exports_external.object({ method: exports_external.literal("ui/notificat
|
|
|
27061
27061
|
var A = exports_external.object({ method: exports_external.literal("ui/notifications/tool-input"), params: exports_external.object({ arguments: exports_external.record(exports_external.string(), exports_external.unknown().describe("Complete tool call arguments as key-value pairs.")).optional().describe("Complete tool call arguments as key-value pairs.") }) });
|
|
27062
27062
|
var P = exports_external.object({ method: exports_external.literal("ui/notifications/tool-input-partial"), params: exports_external.object({ arguments: exports_external.record(exports_external.string(), exports_external.unknown().describe("Partial tool call arguments (incomplete, may change).")).optional().describe("Partial tool call arguments (incomplete, may change).") }) });
|
|
27063
27063
|
var H = exports_external.object({ method: exports_external.literal("ui/notifications/tool-cancelled"), params: exports_external.object({ reason: exports_external.string().optional().describe('Optional reason for the cancellation (e.g., "user action", "timeout").') }) });
|
|
27064
|
-
var
|
|
27065
|
-
var
|
|
27064
|
+
var S = exports_external.object({ fonts: exports_external.string().optional() });
|
|
27065
|
+
var y = exports_external.object({ variables: o.optional().describe("CSS variables for theming the app."), css: S.optional().describe("CSS blocks that apps can inject.") });
|
|
27066
27066
|
var _ = exports_external.object({ method: exports_external.literal("ui/resource-teardown"), params: exports_external.object({}) });
|
|
27067
27067
|
var e = exports_external.record(exports_external.string(), exports_external.unknown());
|
|
27068
27068
|
var q = exports_external.object({ text: exports_external.object({}).optional().describe("Host supports text content blocks."), image: exports_external.object({}).optional().describe("Host supports image content blocks."), audio: exports_external.object({}).optional().describe("Host supports audio content blocks."), resource: exports_external.object({}).optional().describe("Host supports resource content blocks."), resourceLink: exports_external.object({}).optional().describe("Host supports resource link content blocks."), structuredContent: exports_external.object({}).optional().describe("Host supports structured content.") });
|
|
27069
|
-
var
|
|
27070
|
-
var
|
|
27071
|
-
var
|
|
27072
|
-
var ZQ = exports_external.object({
|
|
27069
|
+
var QQ = exports_external.object({ method: exports_external.literal("ui/notifications/request-teardown"), params: exports_external.object({}).optional() });
|
|
27070
|
+
var C = exports_external.object({ experimental: exports_external.object({}).optional().describe("Experimental features (structure TBD)."), openLinks: exports_external.object({}).optional().describe("Host supports opening external URLs."), downloadFile: exports_external.object({}).optional().describe("Host supports file downloads via ui/download-file."), serverTools: exports_external.object({ listChanged: exports_external.boolean().optional().describe("Host supports tools/list_changed notifications.") }).optional().describe("Host can proxy tool calls to the MCP server."), serverResources: exports_external.object({ listChanged: exports_external.boolean().optional().describe("Host supports resources/list_changed notifications.") }).optional().describe("Host can proxy resource reads to the MCP server."), logging: exports_external.object({}).optional().describe("Host accepts log messages."), sandbox: exports_external.object({ permissions: K.optional().describe("Permissions granted by the host (camera, microphone, geolocation)."), csp: B.optional().describe("CSP domains approved by the host.") }).optional().describe("Sandbox configuration applied by the host."), updateModelContext: q.optional().describe("Host accepts context updates (ui/update-model-context) to be included in the model's context for future turns."), message: q.optional().describe("Host supports receiving content messages (ui/message) from the view.") });
|
|
27071
|
+
var f = exports_external.object({ experimental: exports_external.object({}).optional().describe("Experimental features (structure TBD)."), tools: exports_external.object({ listChanged: exports_external.boolean().optional().describe("App supports tools/list_changed notifications.") }).optional().describe("App exposes MCP-style tools that the host can call."), availableDisplayModes: exports_external.array(G).optional().describe("Display modes the app supports.") });
|
|
27072
|
+
var ZQ = exports_external.object({ method: exports_external.literal("ui/notifications/initialized"), params: exports_external.object({}).optional() });
|
|
27073
|
+
var $Q = exports_external.object({ csp: B.optional().describe("Content Security Policy configuration for UI resources."), permissions: K.optional().describe("Sandbox permissions requested by the UI resource."), domain: exports_external.string().optional().describe(`Dedicated origin for view sandbox.
|
|
27073
27074
|
|
|
27074
27075
|
Useful when views need stable, dedicated origins for OAuth callbacks, CORS policies, or API key allowlists.
|
|
27075
27076
|
|
|
@@ -27084,27 +27085,27 @@ Boolean requesting whether a visible border and background is provided by the ho
|
|
|
27084
27085
|
- \`true\`: request visible border + background
|
|
27085
27086
|
- \`false\`: request no visible border + background
|
|
27086
27087
|
- omitted: host decides border`) });
|
|
27087
|
-
var
|
|
27088
|
-
var T = exports_external.object({ mode:
|
|
27089
|
-
var
|
|
27090
|
-
var
|
|
27088
|
+
var JQ = exports_external.object({ method: exports_external.literal("ui/request-display-mode"), params: exports_external.object({ mode: G.describe("The display mode being requested.") }) });
|
|
27089
|
+
var T = exports_external.object({ mode: G.describe("The display mode that was actually set. May differ from requested if not supported.") }).passthrough();
|
|
27090
|
+
var u = exports_external.union([exports_external.literal("model"), exports_external.literal("app")]).describe("Tool visibility scope - who can access the tool.");
|
|
27091
|
+
var XQ = exports_external.object({ resourceUri: exports_external.string().optional(), visibility: exports_external.array(u).optional().describe(`Who can access this tool. Default: ["model", "app"]
|
|
27091
27092
|
- "model": Tool visible to and callable by the agent
|
|
27092
27093
|
- "app": Tool callable by the app from this server only`) });
|
|
27093
|
-
var
|
|
27094
|
-
var
|
|
27095
|
-
var
|
|
27096
|
-
var
|
|
27097
|
-
var
|
|
27098
|
-
var k = exports_external.object({ toolInfo: exports_external.object({ id: RequestIdSchema.optional().describe("JSON-RPC id of the tools/call request."), tool: ToolSchema.describe("Tool definition including name, inputSchema, etc.") }).optional().describe("Metadata of the tool call that instantiated this App."), theme:
|
|
27094
|
+
var RQ = exports_external.object({ mimeTypes: exports_external.array(exports_external.string()).optional().describe('Array of supported MIME types for UI resources.\nMust include `"text/html;profile=mcp-app"` for MCP Apps support.') });
|
|
27095
|
+
var VQ = exports_external.object({ method: exports_external.literal("ui/download-file"), params: exports_external.object({ contents: exports_external.array(exports_external.union([EmbeddedResourceSchema, ResourceLinkSchema])).describe("Resource contents to download — embedded (inline data) or linked (host fetches). Uses standard MCP resource types.") }) });
|
|
27096
|
+
var DQ = exports_external.object({ method: exports_external.literal("ui/message"), params: exports_external.object({ role: exports_external.literal("user").describe('Message role, currently only "user" is supported.'), content: exports_external.array(ContentBlockSchema).describe("Message content blocks (text, image, etc.).") }) });
|
|
27097
|
+
var GQ = exports_external.object({ method: exports_external.literal("ui/notifications/sandbox-resource-ready"), params: exports_external.object({ html: exports_external.string().describe("HTML content to load into the inner iframe."), sandbox: exports_external.string().optional().describe("Optional override for the inner iframe's sandbox attribute."), csp: B.optional().describe("CSP configuration from resource metadata."), permissions: K.optional().describe("Sandbox permissions from resource metadata.") }) });
|
|
27098
|
+
var E = exports_external.object({ method: exports_external.literal("ui/notifications/tool-result"), params: CallToolResultSchema.describe("Standard MCP tool execution result.") });
|
|
27099
|
+
var k = exports_external.object({ toolInfo: exports_external.object({ id: RequestIdSchema.optional().describe("JSON-RPC id of the tools/call request."), tool: ToolSchema.describe("Tool definition including name, inputSchema, etc.") }).optional().describe("Metadata of the tool call that instantiated this App."), theme: g.optional().describe("Current color theme preference."), styles: y.optional().describe("Style configuration for theming the app."), displayMode: G.optional().describe("How the UI is currently displayed."), availableDisplayModes: exports_external.array(G).optional().describe("Display modes the host supports."), containerDimensions: exports_external.union([exports_external.object({ height: exports_external.number().describe("Fixed container height in pixels.") }), exports_external.object({ maxHeight: exports_external.union([exports_external.number(), exports_external.undefined()]).optional().describe("Maximum container height in pixels.") })]).and(exports_external.union([exports_external.object({ width: exports_external.number().describe("Fixed container width in pixels.") }), exports_external.object({ maxWidth: exports_external.union([exports_external.number(), exports_external.undefined()]).optional().describe("Maximum container width in pixels.") })])).optional().describe(`Container dimensions. Represents the dimensions of the iframe or other
|
|
27099
27100
|
container holding the app. Specify either width or maxWidth, and either height or maxHeight.`), locale: exports_external.string().optional().describe("User's language and region preference in BCP 47 format."), timeZone: exports_external.string().optional().describe("User's timezone in IANA format."), userAgent: exports_external.string().optional().describe("Host application identifier."), platform: exports_external.union([exports_external.literal("web"), exports_external.literal("desktop"), exports_external.literal("mobile")]).optional().describe("Platform type for responsive design decisions."), deviceCapabilities: exports_external.object({ touch: exports_external.boolean().optional().describe("Whether the device supports touch input."), hover: exports_external.boolean().optional().describe("Whether the device supports hover interactions.") }).optional().describe("Device input capabilities."), safeAreaInsets: exports_external.object({ top: exports_external.number().describe("Top safe area inset in pixels."), right: exports_external.number().describe("Right safe area inset in pixels."), bottom: exports_external.number().describe("Bottom safe area inset in pixels."), left: exports_external.number().describe("Left safe area inset in pixels.") }).optional().describe("Mobile safe area boundaries in pixels.") }).passthrough();
|
|
27100
|
-
var
|
|
27101
|
+
var R = exports_external.object({ method: exports_external.literal("ui/notifications/host-context-changed"), params: k.describe("Partial context update containing only changed fields.") });
|
|
27101
27102
|
var LQ = exports_external.object({ method: exports_external.literal("ui/update-model-context"), params: exports_external.object({ content: exports_external.array(ContentBlockSchema).optional().describe("Context content blocks (text, image, etc.)."), structuredContent: exports_external.record(exports_external.string(), exports_external.unknown().describe("Structured content for machine-readable context data.")).optional().describe("Structured content for machine-readable context data.") }) });
|
|
27102
|
-
var
|
|
27103
|
-
var
|
|
27103
|
+
var WQ = exports_external.object({ method: exports_external.literal("ui/initialize"), params: exports_external.object({ appInfo: ImplementationSchema.describe("App identification (name and version)."), appCapabilities: f.describe("Features and capabilities this app provides."), protocolVersion: exports_external.string().describe("Protocol version this app supports.") }) });
|
|
27104
|
+
var U = exports_external.object({ protocolVersion: exports_external.string().describe('Negotiated protocol version string (e.g., "2025-11-21").'), hostInfo: ImplementationSchema.describe("Host application identification and version."), hostCapabilities: C.describe("Features and capabilities provided by the host."), hostContext: k.describe("Rich context about the host environment.") }).passthrough();
|
|
27104
27105
|
var v = "ui/resourceUri";
|
|
27105
27106
|
var d = "text/html;profile=mcp-app";
|
|
27106
27107
|
|
|
27107
|
-
class
|
|
27108
|
+
class OQ extends Protocol {
|
|
27108
27109
|
_appInfo;
|
|
27109
27110
|
_capabilities;
|
|
27110
27111
|
options;
|
|
@@ -27136,13 +27137,13 @@ class qQ extends Protocol {
|
|
|
27136
27137
|
this.setNotificationHandler(P, ($) => Z($.params));
|
|
27137
27138
|
}
|
|
27138
27139
|
set ontoolresult(Z) {
|
|
27139
|
-
this.setNotificationHandler(
|
|
27140
|
+
this.setNotificationHandler(E, ($) => Z($.params));
|
|
27140
27141
|
}
|
|
27141
27142
|
set ontoolcancelled(Z) {
|
|
27142
27143
|
this.setNotificationHandler(H, ($) => Z($.params));
|
|
27143
27144
|
}
|
|
27144
27145
|
set onhostcontextchanged(Z) {
|
|
27145
|
-
this.setNotificationHandler(
|
|
27146
|
+
this.setNotificationHandler(R, ($) => {
|
|
27146
27147
|
this._hostContext = { ...this._hostContext, ...$.params }, Z($.params);
|
|
27147
27148
|
});
|
|
27148
27149
|
}
|
|
@@ -27204,6 +27205,9 @@ class qQ extends Protocol {
|
|
|
27204
27205
|
downloadFile(Z, $) {
|
|
27205
27206
|
return this.request({ method: "ui/download-file", params: Z }, I, $);
|
|
27206
27207
|
}
|
|
27208
|
+
requestTeardown(Z = {}) {
|
|
27209
|
+
return this.notification({ method: "ui/notifications/request-teardown", params: Z });
|
|
27210
|
+
}
|
|
27207
27211
|
requestDisplayMode(Z, $) {
|
|
27208
27212
|
return this.request({ method: "ui/request-display-mode", params: Z }, T, $);
|
|
27209
27213
|
}
|
|
@@ -27216,11 +27220,11 @@ class qQ extends Protocol {
|
|
|
27216
27220
|
return;
|
|
27217
27221
|
Z = true, requestAnimationFrame(() => {
|
|
27218
27222
|
Z = false;
|
|
27219
|
-
let V = document.documentElement,
|
|
27223
|
+
let V = document.documentElement, L = V.style.width, W = V.style.height;
|
|
27220
27224
|
V.style.width = "fit-content", V.style.height = "max-content";
|
|
27221
|
-
let
|
|
27222
|
-
V.style.width =
|
|
27223
|
-
let h = window.innerWidth - V.clientWidth, N = Math.ceil(
|
|
27225
|
+
let x = V.getBoundingClientRect();
|
|
27226
|
+
V.style.width = L, V.style.height = W;
|
|
27227
|
+
let h = window.innerWidth - V.clientWidth, N = Math.ceil(x.width + h), Y = Math.ceil(x.height);
|
|
27224
27228
|
if (N !== $ || Y !== J)
|
|
27225
27229
|
$ = N, J = Y, this.sendSizeChanged({ width: N, height: Y });
|
|
27226
27230
|
});
|
|
@@ -27234,7 +27238,7 @@ class qQ extends Protocol {
|
|
|
27234
27238
|
throw Error("App is already connected. Call close() before connecting again.");
|
|
27235
27239
|
await super.connect(Z);
|
|
27236
27240
|
try {
|
|
27237
|
-
let J = await this.request({ method: "ui/initialize", params: { appCapabilities: this._capabilities, appInfo: this._appInfo, protocolVersion: F } },
|
|
27241
|
+
let J = await this.request({ method: "ui/initialize", params: { appCapabilities: this._capabilities, appInfo: this._appInfo, protocolVersion: F } }, U, $);
|
|
27238
27242
|
if (J === undefined)
|
|
27239
27243
|
throw Error(`Server sent invalid initialize result: ${J}`);
|
|
27240
27244
|
if (this._hostCapabilities = J.hostCapabilities, this._hostInfo = J.hostInfo, this._hostContext = J.hostContext, await this.notification({ method: "ui/notifications/initialized" }), this.options?.autoResize)
|
|
@@ -27244,15 +27248,15 @@ class qQ extends Protocol {
|
|
|
27244
27248
|
}
|
|
27245
27249
|
}
|
|
27246
27250
|
}
|
|
27247
|
-
function
|
|
27248
|
-
let D = J._meta, V = D.ui,
|
|
27249
|
-
if (V?.resourceUri && !
|
|
27251
|
+
function hZ(Z, $, J, X) {
|
|
27252
|
+
let D = J._meta, V = D.ui, L = D[v], W = D;
|
|
27253
|
+
if (V?.resourceUri && !L)
|
|
27250
27254
|
W = { ...D, [v]: V.resourceUri };
|
|
27251
|
-
else if (
|
|
27252
|
-
W = { ...D, ui: { ...V, resourceUri:
|
|
27255
|
+
else if (L && !V?.resourceUri)
|
|
27256
|
+
W = { ...D, ui: { ...V, resourceUri: L } };
|
|
27253
27257
|
return Z.registerTool($, { ...J, _meta: W }, X);
|
|
27254
27258
|
}
|
|
27255
|
-
function
|
|
27259
|
+
function mZ(Z, $, J, X, D) {
|
|
27256
27260
|
return Z.registerResource($, J, { mimeType: d, ...X }, D);
|
|
27257
27261
|
}
|
|
27258
27262
|
|
|
@@ -28502,7 +28506,7 @@ function createServer() {
|
|
|
28502
28506
|
version: "1.0.0"
|
|
28503
28507
|
});
|
|
28504
28508
|
const resourceUri = "ui://get-time/mcp-app.html";
|
|
28505
|
-
|
|
28509
|
+
hZ(server, "get-time", {
|
|
28506
28510
|
title: "Get Time",
|
|
28507
28511
|
description: "Returns the current server time as an ISO 8601 string.",
|
|
28508
28512
|
inputSchema: {},
|
|
@@ -28517,7 +28521,7 @@ function createServer() {
|
|
|
28517
28521
|
structuredContent: { time: time3 }
|
|
28518
28522
|
};
|
|
28519
28523
|
});
|
|
28520
|
-
|
|
28524
|
+
mZ(server, resourceUri, resourceUri, { mimeType: d }, async () => {
|
|
28521
28525
|
const html = await fs.readFile(path.join(DIST_DIR, "mcp-app.html"), "utf-8");
|
|
28522
28526
|
return {
|
|
28523
28527
|
contents: [
|