@reqvire-org/ads 0.4.4 → 0.4.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (53) hide show
  1. package/README.md +11 -8
  2. package/dist/capture.mjs +1 -1
  3. package/dist/cli.mjs +1 -1
  4. package/dist/input-scope.mjs +57 -0
  5. package/dist/mcp/apps.mjs +7 -1
  6. package/dist/mcp/build-status.mjs +12 -3
  7. package/dist/mcp/drafts.mjs +7 -0
  8. package/dist/mcp/mutations.mjs +1 -1
  9. package/dist/mcp/preview-http.bundle.js +7 -0
  10. package/dist/mcp/preview-http.mjs +148 -0
  11. package/dist/mcp/preview-watch.mjs +14 -3
  12. package/dist/mcp/preview-widget.bundle.js +20 -20
  13. package/dist/mcp/resource-loader.js +1 -1
  14. package/dist/mcp/sandbox-host.mjs +6 -1
  15. package/dist/mcp/server.mjs +49 -9
  16. package/dist/mcp/showcase-host.mjs +56 -5
  17. package/dist/mcp/showcase-http.mjs +66 -0
  18. package/dist/preview-inputs.mjs +7 -2
  19. package/dist/scenario-registry.mjs +2 -2
  20. package/dist/scenarios-compiler.mjs +19 -1
  21. package/dist/showcase/client.bundle.js +54 -54
  22. package/dist/showcase/comparison.js +15 -12
  23. package/dist/showcase/connection.js +10 -0
  24. package/dist/showcase/http-client.bundle.js +9 -0
  25. package/dist/showcase/http-connection.js +86 -0
  26. package/dist/showcase/http-preview.js +81 -0
  27. package/dist/showcase-http-routes.mjs +31 -0
  28. package/dist/skills/README.md +2 -2
  29. package/dist/skills/ads-designer/references/captures.md +1 -1
  30. package/dist/skills/ads-designer/references/runtimes.md +18 -2
  31. package/dist/skills/ads-designer/references/workflows.md +16 -0
  32. package/dist/skills/ads-import/references/captures.md +1 -1
  33. package/dist/skills/ads-import/references/runtimes.md +18 -2
  34. package/dist/skills/ads-import/references/workflows.md +16 -0
  35. package/dist/skills/ads-migrate/SKILL.md +1 -0
  36. package/dist/skills/ads-migrate/references/0.4.3-to-0.4.4.md +9 -0
  37. package/dist/skills/ads-migrate/references/0.4.4-to-0.4.5.md +72 -0
  38. package/dist/skills/ads-port/references/captures.md +1 -1
  39. package/dist/skills/ads-port/references/runtimes.md +18 -2
  40. package/dist/skills/ads-port/references/workflows.md +16 -0
  41. package/dist/stage-timing.cjs +3 -2
  42. package/dist/validation-inputs.mjs +21 -3
  43. package/dist/verification/browser.mjs +2 -2
  44. package/docs/ADS.md +9 -7
  45. package/docs/ARCHITECTURE.md +56 -42
  46. package/docs/CHANGELOG.md +45 -25
  47. package/docs/GUIDE.md +15 -8
  48. package/docs/HTTP-SHOWCASE-POC.md +397 -0
  49. package/docs/MCP.md +63 -9
  50. package/docs/benchmarks/http-showcase-optimized.json +1879 -0
  51. package/docs/benchmarks/http-showcase-profile.json +308 -0
  52. package/docs/benchmarks/http-showcase.json +3069 -0
  53. package/package.json +1 -1
@@ -1,90 +1,90 @@
1
- function Za(e){if(e?.failure?.scope!=="project")return"Preview build failed";if(e.failure.phase==="validation")return"Project validation failed";if(e.failure.phase==="discovery")return"Project scenario discovery failed";return"Project preview build failed"}function gm(e=[]){return e.map((t)=>{let r=t.file?t.file+(t.line?`:${t.line}`:"")+(t.column?`:${t.column}`:""):"";return(r?`${r}: `:"")+t.message}).join(`
2
- `)}var{create:ib,defineProperty:Ha,getOwnPropertyDescriptor:ab,getOwnPropertyNames:cb,getPrototypeOf:ub}=Object,lb=Object.prototype.hasOwnProperty,Sm=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),vm=(e,t)=>{let r={};for(var o in e)Ha(r,o,{get:e[o],enumerable:!0});if(t)Ha(r,Symbol.toStringTag,{value:"Module"});return r},db=(e,t,r,o)=>{if(t&&typeof t==="object"||typeof t==="function"){for(var s=cb(t),n=0,i=s.length,a;n<i;n++)if(a=s[n],!lb.call(e,a)&&a!==r)Ha(e,a,{get:((c)=>t[c]).bind(null,a),enumerable:!(o=ab(t,a))||o.enumerable})}return e},bm=(e,t,r)=>(r=e!=null?ib(ub(e)):{},db(t||!e||!e.__esModule?Ha(r,"default",{value:e,enumerable:!0}):r,e));var mb=new Set(["https://json-schema.org/draft/2020-12/schema","http://json-schema.org/draft/2020-12/schema"]),ym=new Set(["https://json-schema.org/draft/2019-09/schema","http://json-schema.org/draft/2019-09/schema"]),pb=new Set(["https://json-schema.org/draft-07/schema","http://json-schema.org/draft-07/schema"]),hb=new Set(["https://json-schema.org/draft-06/schema","http://json-schema.org/draft-06/schema"]);function wm(e){return typeof e==="string"&&ym.has(e.replace(/#$/,""))}function zm(e,t){if(!("$schema"in e)||typeof e.$schema!=="string")return"2020-12";let r=e.$schema.replace(/#$/,"");if(mb.has(r))return"2020-12";if(ym.has(r))return"2019-09";if(pb.has(r)||hb.has(r))return"draft-7";throw Error(`JSON Schema declares an unsupported dialect ("$schema": "${e.$schema.slice(0,200)}"). The default validator supports JSON Schema 2020-12, 2019-09, draft-07, and draft-06; ${t}`)}var Rm,Eu=Object.freeze({status:"aborted"});function y(e,t,r){function o(a,c){if(!a._zod)Object.defineProperty(a,"_zod",{value:{def:c,constr:i,traits:new Set},enumerable:!1});if(a._zod.traits.has(e))return;a._zod.traits.add(e),t(a,c);let l=i.prototype,d=Object.keys(l);for(let f=0;f<d.length;f++){let h=d[f];if(!(h in a))a[h]=l[h].bind(a)}}let s=r?.Parent??Object;class n extends s{}Object.defineProperty(n,"name",{value:e});function i(a){var c;let l=r?.Parent?new n:this;o(l,a),(c=l._zod).deferred??(c.deferred=[]);for(let d of l._zod.deferred)d();return l}return Object.defineProperty(i,"init",{value:o}),Object.defineProperty(i,Symbol.hasInstance,{value:(a)=>{if(r?.Parent&&a instanceof r.Parent)return!0;return a?._zod?.traits?.has(e)}}),Object.defineProperty(i,"name",{value:e}),i}var fb=Symbol("zod_brand");class Ht extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class an extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`);this.name="ZodEncodeError"}}(Rm=globalThis).__zod_globalConfig??(Rm.__zod_globalConfig={});var Oo=globalThis.__zod_globalConfig;function Je(e){if(e)Object.assign(Oo,e);return Oo}function Va(e){let t=Object.values(e).filter((o)=>typeof o==="number");return Object.entries(e).filter(([o,s])=>t.indexOf(+o)===-1).map(([o,s])=>s)}function Cu(e,t="|"){return e.map((r)=>Nu(r)).join(t)}function cn(e,t){if(typeof t==="bigint")return t.toString();return t}function un(e){return{get value(){{let r=e();return Object.defineProperty(this,"value",{value:r}),r}throw Error("cached value already set")}}}function Ba(e){return e===null||e===void 0}function Ja(e){let t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}function km(e,t){let r=e/t,o=Math.round(r),s=Number.EPSILON*Math.max(Math.abs(r),1);if(Math.abs(r-o)<s)return 0;return r-o}var xm=Symbol("evaluating");function oe(e,t,r){let o=void 0;Object.defineProperty(e,t,{get(){if(o===xm)return;if(o===void 0)o=xm,o=r();return o},set(s){Object.defineProperty(e,t,{value:s})},configurable:!0})}function Zr(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function ar(...e){let t={};for(let r of e){let o=Object.getOwnPropertyDescriptors(r);Object.assign(t,o)}return Object.defineProperties({},t)}function Iu(e){return JSON.stringify(e)}function Pm(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var qu="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function No(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}var Tm=un(()=>{if(Oo.jitless)return!1;if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return new Function(""),!0}catch(e){return!1}});function Hr(e){if(No(e)===!1)return!1;let t=e.constructor;if(t===void 0)return!0;if(typeof t!=="function")return!0;let r=t.prototype;if(No(r)===!1)return!1;if(Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)return!1;return!0}function Ou(e){if(Hr(e))return{...e};if(Array.isArray(e))return[...e];if(e instanceof Map)return new Map(e);if(e instanceof Set)return new Set(e);return e}var Em=new Set(["string","number","symbol"]);function cr(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function pt(e,t,r){let o=new e._zod.constr(t??e._zod.def);if(!t||r?.parent)o._zod.parent=e;return o}function H(e){let t=e;if(!t)return{};if(typeof t==="string")return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}if(delete t.message,typeof t.error==="string")return{...t,error:()=>t.error};return t}function Nu(e){if(typeof e==="bigint")return e.toString()+"n";if(typeof e==="string")return`"${e}"`;return`${e}`}function $m(e){return Object.keys(e).filter((t)=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}var Cm={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-340282346638528860000000000000000000000,340282346638528860000000000000000000000],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function _b(e,t){let r=e._zod.def,o=r.checks;if(o&&o.length>0)throw Error(".pick() cannot be used on object schemas containing refinements");let n=ar(e._zod.def,{get shape(){let i={};for(let a in t){if(!(a in r.shape))throw Error(`Unrecognized key: "${a}"`);if(!t[a])continue;i[a]=r.shape[a]}return Zr(this,"shape",i),i},checks:[]});return pt(e,n)}function gb(e,t){let r=e._zod.def,o=r.checks;if(o&&o.length>0)throw Error(".omit() cannot be used on object schemas containing refinements");let n=ar(e._zod.def,{get shape(){let i={...e._zod.def.shape};for(let a in t){if(!(a in r.shape))throw Error(`Unrecognized key: "${a}"`);if(!t[a])continue;delete i[a]}return Zr(this,"shape",i),i},checks:[]});return pt(e,n)}function Sb(e,t){if(!Hr(t))throw Error("Invalid input to extend: expected a plain object");let r=e._zod.def.checks;if(r&&r.length>0){let n=e._zod.def.shape;for(let i in t)if(Object.getOwnPropertyDescriptor(n,i)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}let s=ar(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return Zr(this,"shape",n),n}});return pt(e,s)}function vb(e,t){if(!Hr(t))throw Error("Invalid input to safeExtend: expected a plain object");let r=ar(e._zod.def,{get shape(){let o={...e._zod.def.shape,...t};return Zr(this,"shape",o),o}});return pt(e,r)}function bb(e,t){if(e._zod.def.checks?.length)throw Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");let r=ar(e._zod.def,{get shape(){let o={...e._zod.def.shape,...t._zod.def.shape};return Zr(this,"shape",o),o},get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]});return pt(e,r)}function yb(e,t,r){let s=t._zod.def.checks;if(s&&s.length>0)throw Error(".partial() cannot be used on object schemas containing refinements");let i=ar(t._zod.def,{get shape(){let a=t._zod.def.shape,c={...a};if(r)for(let l in r){if(!(l in a))throw Error(`Unrecognized key: "${l}"`);if(!r[l])continue;c[l]=e?new e({type:"optional",innerType:a[l]}):a[l]}else for(let l in a)c[l]=e?new e({type:"optional",innerType:a[l]}):a[l];return Zr(this,"shape",c),c},checks:[]});return pt(t,i)}function wb(e,t,r){let o=ar(t._zod.def,{get shape(){let s=t._zod.def.shape,n={...s};if(r)for(let i in r){if(!(i in n))throw Error(`Unrecognized key: "${i}"`);if(!r[i])continue;n[i]=new e({type:"nonoptional",innerType:s[i]})}else for(let i in s)n[i]=new e({type:"nonoptional",innerType:s[i]});return Zr(this,"shape",n),n}});return pt(t,o)}function Fr(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue!==!0)return!0;return!1}function Im(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue===!1)return!0;return!1}function ur(e,t){return t.map((r)=>{var o;return(o=r).path??(o.path=[]),r.path.unshift(e),r})}function Fa(e){return typeof e==="string"?e:e?.message}function ht(e,t,r){let o=e.message?e.message:Fa(e.inst?._zod.def?.error?.(e))??Fa(t?.error?.(e))??Fa(r.customError?.(e))??Fa(r.localeError?.(e))??"Invalid input",{inst:s,continue:n,input:i,...a}=e;if(a.path??(a.path=[]),a.message=o,t?.reportInput)a.input=i;return a}function Wa(e){if(Array.isArray(e))return"array";if(typeof e==="string")return"string";return"unknown"}function qm(e){let t=typeof e;switch(t){case"number":return Number.isNaN(e)?"nan":"number";case"object":{if(e===null)return"null";if(Array.isArray(e))return"array";let r=e;if(r&&Object.getPrototypeOf(r)!==Object.prototype&&"constructor"in r&&r.constructor)return r.constructor.name}}return t}function Vr(...e){let[t,r,o]=e;if(typeof t==="string")return{message:t,code:"custom",input:r,inst:o};return{...t}}var Om=(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,cn,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},Ka=y("$ZodError",Om),ju=y("$ZodError",Om,{Parent:Error});function Mu(e,t=(r)=>r.message){let r={},o=[];for(let s of e.issues)if(s.path.length>0)r[s.path[0]]=r[s.path[0]]||[],r[s.path[0]].push(t(s));else o.push(t(s));return{formErrors:o,fieldErrors:r}}function Au(e,t=(r)=>r.message){let r={_errors:[]},o=(s,n=[])=>{for(let i of s.issues)if(i.code==="invalid_union"&&i.errors.length)i.errors.map((a)=>o({issues:a},[...n,...i.path]));else if(i.code==="invalid_key")o({issues:i.issues},[...n,...i.path]);else if(i.code==="invalid_element")o({issues:i.issues},[...n,...i.path]);else{let a=[...n,...i.path];if(a.length===0)r._errors.push(t(i));else{let c=r,l=0;while(l<a.length){let d=a[l];if(l!==a.length-1)c[d]=c[d]||{_errors:[]};else c[d]=c[d]||{_errors:[]},c[d]._errors.push(t(i));c=c[d],l++}}}};return o(e),r}var Ga=(e)=>(t,r,o,s)=>{let n=o?{...o,async:!1}:{async:!1},i=t._zod.run({value:r,issues:[]},n);if(i instanceof Promise)throw new Ht;if(i.issues.length){let a=new(s?.Err??e)(i.issues.map((c)=>ht(c,n,Je())));throw qu(a,s?.callee),a}return i.value};var Ya=(e)=>async(t,r,o,s)=>{let n=o?{...o,async:!0}:{async:!0},i=t._zod.run({value:r,issues:[]},n);if(i instanceof Promise)i=await i;if(i.issues.length){let a=new(s?.Err??e)(i.issues.map((c)=>ht(c,n,Je())));throw qu(a,s?.callee),a}return i.value};var ln=(e)=>(t,r,o)=>{let s=o?{...o,async:!1}:{async:!1},n=t._zod.run({value:r,issues:[]},s);if(n instanceof Promise)throw new Ht;return n.issues.length?{success:!1,error:new(e??Ka)(n.issues.map((i)=>ht(i,s,Je())))}:{success:!0,data:n.value}},Nm=ln(ju),dn=(e)=>async(t,r,o)=>{let s=o?{...o,async:!0}:{async:!0},n=t._zod.run({value:r,issues:[]},s);if(n instanceof Promise)n=await n;return n.issues.length?{success:!1,error:new e(n.issues.map((i)=>ht(i,s,Je())))}:{success:!0,data:n.value}},jm=dn(ju),Mm=(e)=>(t,r,o)=>{let s=o?{...o,direction:"backward"}:{direction:"backward"};return Ga(e)(t,r,s)};var Am=(e)=>(t,r,o)=>Ga(e)(t,r,o);var Lm=(e)=>async(t,r,o)=>{let s=o?{...o,direction:"backward"}:{direction:"backward"};return Ya(e)(t,r,s)};var Um=(e)=>async(t,r,o)=>Ya(e)(t,r,o);var Dm=(e)=>(t,r,o)=>{let s=o?{...o,direction:"backward"}:{direction:"backward"};return ln(e)(t,r,s)};var Zm=(e)=>(t,r,o)=>ln(e)(t,r,o);var Hm=(e)=>async(t,r,o)=>{let s=o?{...o,direction:"backward"}:{direction:"backward"};return dn(e)(t,r,s)};var Fm=(e)=>async(t,r,o)=>dn(e)(t,r,o);var Vm=/^[cC][0-9a-z]{6,}$/,Bm=/^[0-9a-z]+$/,Jm=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Wm=/^[0-9a-vA-V]{20}$/,Km=/^[A-Za-z0-9]{27}$/,Gm=/^[a-zA-Z0-9_-]{21}$/,Ym=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/;var Xm=/^([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})$/,Lu=(e)=>{if(!e)return/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/;return new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`)};var Qm=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;var Rb="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function ep(){return new RegExp(Rb,"u")}var tp=/^(?:(?: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])$/,rp=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/;var op=/^((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])$/,sp=/^(([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])$/,np=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Uu=/^[A-Za-z0-9_-]*$/;var ip=/^https?$/,ap=/^\+[1-9]\d{6,14}$/,cp="(?:(?:\\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])))",up=new RegExp(`^${cp}$`);function lp(e){return typeof e.precision==="number"?e.precision===-1?"(?:[01]\\d|2[0-3]):[0-5]\\d":e.precision===0?"(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d":`(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d\\.\\d{${e.precision}}`:"(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?"}function dp(e){return new RegExp(`^${lp(e)}$`)}function mp(e){let t=lp({precision:e.precision}),r=["Z"];if(e.local)r.push("");if(e.offset)r.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let o=`${t}(?:${r.join("|")})`;return new RegExp(`^${cp}T(?:${o})$`)}var pp=(e)=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)};var hp=/^-?\d+$/,Du=/^-?\d+(?:\.\d+)?$/,fp=/^(?:true|false)$/i,_p=/^null$/i;var gp=/^undefined$/i;var Sp=/^[^A-Z]*$/,vp=/^[^a-z]*$/;var Ie=y("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])}),bp={number:"number",bigint:"bigint",object:"date"},Zu=y("$ZodCheckLessThan",(e,t)=>{Ie.init(e,t);let r=bp[typeof t.value];e._zod.onattach.push((o)=>{let s=o._zod.bag,n=(t.inclusive?s.maximum:s.exclusiveMaximum)??Number.POSITIVE_INFINITY;if(t.value<n)if(t.inclusive)s.maximum=t.value;else s.exclusiveMaximum=t.value}),e._zod.check=(o)=>{if(t.inclusive?o.value<=t.value:o.value<t.value)return;o.issues.push({origin:r,code:"too_big",maximum:typeof t.value==="object"?t.value.getTime():t.value,input:o.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Hu=y("$ZodCheckGreaterThan",(e,t)=>{Ie.init(e,t);let r=bp[typeof t.value];e._zod.onattach.push((o)=>{let s=o._zod.bag,n=(t.inclusive?s.minimum:s.exclusiveMinimum)??Number.NEGATIVE_INFINITY;if(t.value>n)if(t.inclusive)s.minimum=t.value;else s.exclusiveMinimum=t.value}),e._zod.check=(o)=>{if(t.inclusive?o.value>=t.value:o.value>t.value)return;o.issues.push({origin:r,code:"too_small",minimum:typeof t.value==="object"?t.value.getTime():t.value,input:o.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),yp=y("$ZodCheckMultipleOf",(e,t)=>{Ie.init(e,t),e._zod.onattach.push((r)=>{var o;(o=r._zod.bag).multipleOf??(o.multipleOf=t.value)}),e._zod.check=(r)=>{if(typeof r.value!==typeof t.value)throw Error("Cannot mix number and bigint in multiple_of check.");if(typeof r.value==="bigint"?r.value%t.value===BigInt(0):km(r.value,t.value)===0)return;r.issues.push({origin:typeof r.value,code:"not_multiple_of",divisor:t.value,input:r.value,inst:e,continue:!t.abort})}}),wp=y("$ZodCheckNumberFormat",(e,t)=>{Ie.init(e,t),t.format=t.format||"float64";let r=t.format?.includes("int"),o=r?"int":"number",[s,n]=Cm[t.format];e._zod.onattach.push((i)=>{let a=i._zod.bag;if(a.format=t.format,a.minimum=s,a.maximum=n,r)a.pattern=hp}),e._zod.check=(i)=>{let a=i.value;if(r){if(!Number.isInteger(a)){i.issues.push({expected:o,format:t.format,code:"invalid_type",continue:!1,input:a,inst:e});return}if(!Number.isSafeInteger(a)){if(a>0)i.issues.push({input:a,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});else i.issues.push({input:a,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}}if(a<s)i.issues.push({origin:"number",input:a,code:"too_small",minimum:s,inclusive:!0,inst:e,continue:!t.abort});if(a>n)i.issues.push({origin:"number",input:a,code:"too_big",maximum:n,inclusive:!0,inst:e,continue:!t.abort})}});var zp=y("$ZodCheckMaxLength",(e,t)=>{var r;Ie.init(e,t),(r=e._zod.def).when??(r.when=(o)=>{let s=o.value;return!Ba(s)&&s.length!==void 0}),e._zod.onattach.push((o)=>{let s=o._zod.bag.maximum??Number.POSITIVE_INFINITY;if(t.maximum<s)o._zod.bag.maximum=t.maximum}),e._zod.check=(o)=>{let s=o.value;if(s.length<=t.maximum)return;let i=Wa(s);o.issues.push({origin:i,code:"too_big",maximum:t.maximum,inclusive:!0,input:s,inst:e,continue:!t.abort})}}),Rp=y("$ZodCheckMinLength",(e,t)=>{var r;Ie.init(e,t),(r=e._zod.def).when??(r.when=(o)=>{let s=o.value;return!Ba(s)&&s.length!==void 0}),e._zod.onattach.push((o)=>{let s=o._zod.bag.minimum??Number.NEGATIVE_INFINITY;if(t.minimum>s)o._zod.bag.minimum=t.minimum}),e._zod.check=(o)=>{let s=o.value;if(s.length>=t.minimum)return;let i=Wa(s);o.issues.push({origin:i,code:"too_small",minimum:t.minimum,inclusive:!0,input:s,inst:e,continue:!t.abort})}}),xp=y("$ZodCheckLengthEquals",(e,t)=>{var r;Ie.init(e,t),(r=e._zod.def).when??(r.when=(o)=>{let s=o.value;return!Ba(s)&&s.length!==void 0}),e._zod.onattach.push((o)=>{let s=o._zod.bag;s.minimum=t.length,s.maximum=t.length,s.length=t.length}),e._zod.check=(o)=>{let s=o.value,n=s.length;if(n===t.length)return;let i=Wa(s),a=n>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})}}),pn=y("$ZodCheckStringFormat",(e,t)=>{var r,o;if(Ie.init(e,t),e._zod.onattach.push((s)=>{let n=s._zod.bag;if(n.format=t.format,t.pattern)n.patterns??(n.patterns=new Set),n.patterns.add(t.pattern)}),t.pattern)(r=e._zod).check??(r.check=(s)=>{if(t.pattern.lastIndex=0,t.pattern.test(s.value))return;s.issues.push({origin:"string",code:"invalid_format",format:t.format,input:s.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})});else(o=e._zod).check??(o.check=()=>{})}),kp=y("$ZodCheckRegex",(e,t)=>{pn.init(e,t),e._zod.check=(r)=>{if(t.pattern.lastIndex=0,t.pattern.test(r.value))return;r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),Pp=y("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=Sp),pn.init(e,t)}),Tp=y("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=vp),pn.init(e,t)}),Ep=y("$ZodCheckIncludes",(e,t)=>{Ie.init(e,t);let r=cr(t.includes),o=new RegExp(typeof t.position==="number"?`^.{${t.position}}${r}`:r);t.pattern=o,e._zod.onattach.push((s)=>{let n=s._zod.bag;n.patterns??(n.patterns=new Set),n.patterns.add(o)}),e._zod.check=(s)=>{if(s.value.includes(t.includes,t.position))return;s.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:s.value,inst:e,continue:!t.abort})}}),$p=y("$ZodCheckStartsWith",(e,t)=>{Ie.init(e,t);let r=new RegExp(`^${cr(t.prefix)}.*`);t.pattern??(t.pattern=r),e._zod.onattach.push((o)=>{let s=o._zod.bag;s.patterns??(s.patterns=new Set),s.patterns.add(r)}),e._zod.check=(o)=>{if(o.value.startsWith(t.prefix))return;o.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:o.value,inst:e,continue:!t.abort})}}),Cp=y("$ZodCheckEndsWith",(e,t)=>{Ie.init(e,t);let r=new RegExp(`.*${cr(t.suffix)}$`);t.pattern??(t.pattern=r),e._zod.onattach.push((o)=>{let s=o._zod.bag;s.patterns??(s.patterns=new Set),s.patterns.add(r)}),e._zod.check=(o)=>{if(o.value.endsWith(t.suffix))return;o.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:o.value,inst:e,continue:!t.abort})}});var Ip=y("$ZodCheckOverwrite",(e,t)=>{Ie.init(e,t),e._zod.check=(r)=>{r.value=t.tx(r.value)}});class Fu{constructor(e=[]){if(this.content=[],this.indent=0,this)this.args=e}indented(e){this.indent+=1,e(this),this.indent-=1}write(e){if(typeof e==="function"){e(this,{execution:"sync"}),e(this,{execution:"async"});return}let r=e.split(`
1
+ function Va(e){if(e?.failure?.scope!=="project")return"Preview build failed";if(e.failure.phase==="validation")return"Project validation failed";if(e.failure.phase==="discovery")return"Project scenario discovery failed";return"Project preview build failed"}function wp(e=[]){return e.map((t)=>{let r=t.file?t.file+(t.line?`:${t.line}`:"")+(t.column?`:${t.column}`:""):"";return(r?`${r}: `:"")+t.message}).join(`
2
+ `)}var{create:hb,defineProperty:Ba,getOwnPropertyDescriptor:fb,getOwnPropertyNames:_b,getPrototypeOf:gb}=Object,Sb=Object.prototype.hasOwnProperty,zp=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),Rp=(e,t)=>{let r={};for(var o in e)Ba(r,o,{get:e[o],enumerable:!0});if(t)Ba(r,Symbol.toStringTag,{value:"Module"});return r},vb=(e,t,r,o)=>{if(t&&typeof t==="object"||typeof t==="function"){for(var s=_b(t),n=0,i=s.length,a;n<i;n++)if(a=s[n],!Sb.call(e,a)&&a!==r)Ba(e,a,{get:((c)=>t[c]).bind(null,a),enumerable:!(o=fb(t,a))||o.enumerable})}return e},xp=(e,t,r)=>(r=e!=null?hb(gb(e)):{},vb(t||!e||!e.__esModule?Ba(r,"default",{value:e,enumerable:!0}):r,e));var bb=new Set(["https://json-schema.org/draft/2020-12/schema","http://json-schema.org/draft/2020-12/schema"]),kp=new Set(["https://json-schema.org/draft/2019-09/schema","http://json-schema.org/draft/2019-09/schema"]),yb=new Set(["https://json-schema.org/draft-07/schema","http://json-schema.org/draft-07/schema"]),wb=new Set(["https://json-schema.org/draft-06/schema","http://json-schema.org/draft-06/schema"]);function Pp(e){return typeof e==="string"&&kp.has(e.replace(/#$/,""))}function Tp(e,t){if(!("$schema"in e)||typeof e.$schema!=="string")return"2020-12";let r=e.$schema.replace(/#$/,"");if(bb.has(r))return"2020-12";if(kp.has(r))return"2019-09";if(yb.has(r)||wb.has(r))return"draft-7";throw Error(`JSON Schema declares an unsupported dialect ("$schema": "${e.$schema.slice(0,200)}"). The default validator supports JSON Schema 2020-12, 2019-09, draft-07, and draft-06; ${t}`)}var Ep,qu=Object.freeze({status:"aborted"});function w(e,t,r){function o(a,c){if(!a._zod)Object.defineProperty(a,"_zod",{value:{def:c,constr:i,traits:new Set},enumerable:!1});if(a._zod.traits.has(e))return;a._zod.traits.add(e),t(a,c);let l=i.prototype,d=Object.keys(l);for(let f=0;f<d.length;f++){let h=d[f];if(!(h in a))a[h]=l[h].bind(a)}}let s=r?.Parent??Object;class n extends s{}Object.defineProperty(n,"name",{value:e});function i(a){var c;let l=r?.Parent?new n:this;o(l,a),(c=l._zod).deferred??(c.deferred=[]);for(let d of l._zod.deferred)d();return l}return Object.defineProperty(i,"init",{value:o}),Object.defineProperty(i,Symbol.hasInstance,{value:(a)=>{if(r?.Parent&&a instanceof r.Parent)return!0;return a?._zod?.traits?.has(e)}}),Object.defineProperty(i,"name",{value:e}),i}var zb=Symbol("zod_brand");class Ft extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class dn extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`);this.name="ZodEncodeError"}}(Ep=globalThis).__zod_globalConfig??(Ep.__zod_globalConfig={});var No=globalThis.__zod_globalConfig;function Je(e){if(e)Object.assign(No,e);return No}function Wa(e){let t=Object.values(e).filter((o)=>typeof o==="number");return Object.entries(e).filter(([o,s])=>t.indexOf(+o)===-1).map(([o,s])=>s)}function Nu(e,t="|"){return e.map((r)=>Lu(r)).join(t)}function pn(e,t){if(typeof t==="bigint")return t.toString();return t}function mn(e){return{get value(){{let r=e();return Object.defineProperty(this,"value",{value:r}),r}throw Error("cached value already set")}}}function Ka(e){return e===null||e===void 0}function Ga(e){let t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}function Cp(e,t){let r=e/t,o=Math.round(r),s=Number.EPSILON*Math.max(Math.abs(r),1);if(Math.abs(r-o)<s)return 0;return r-o}var $p=Symbol("evaluating");function oe(e,t,r){let o=void 0;Object.defineProperty(e,t,{get(){if(o===$p)return;if(o===void 0)o=$p,o=r();return o},set(s){Object.defineProperty(e,t,{value:s})},configurable:!0})}function Hr(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function cr(...e){let t={};for(let r of e){let o=Object.getOwnPropertyDescriptors(r);Object.assign(t,o)}return Object.defineProperties({},t)}function ju(e){return JSON.stringify(e)}function Ip(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var Mu="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function jo(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}var qp=mn(()=>{if(No.jitless)return!1;if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return new Function(""),!0}catch(e){return!1}});function Fr(e){if(jo(e)===!1)return!1;let t=e.constructor;if(t===void 0)return!0;if(typeof t!=="function")return!0;let r=t.prototype;if(jo(r)===!1)return!1;if(Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)return!1;return!0}function Au(e){if(Fr(e))return{...e};if(Array.isArray(e))return[...e];if(e instanceof Map)return new Map(e);if(e instanceof Set)return new Set(e);return e}var Op=new Set(["string","number","symbol"]);function ur(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function ht(e,t,r){let o=new e._zod.constr(t??e._zod.def);if(!t||r?.parent)o._zod.parent=e;return o}function H(e){let t=e;if(!t)return{};if(typeof t==="string")return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}if(delete t.message,typeof t.error==="string")return{...t,error:()=>t.error};return t}function Lu(e){if(typeof e==="bigint")return e.toString()+"n";if(typeof e==="string")return`"${e}"`;return`${e}`}function Np(e){return Object.keys(e).filter((t)=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}var jp={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-340282346638528860000000000000000000000,340282346638528860000000000000000000000],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function Rb(e,t){let r=e._zod.def,o=r.checks;if(o&&o.length>0)throw Error(".pick() cannot be used on object schemas containing refinements");let n=cr(e._zod.def,{get shape(){let i={};for(let a in t){if(!(a in r.shape))throw Error(`Unrecognized key: "${a}"`);if(!t[a])continue;i[a]=r.shape[a]}return Hr(this,"shape",i),i},checks:[]});return ht(e,n)}function xb(e,t){let r=e._zod.def,o=r.checks;if(o&&o.length>0)throw Error(".omit() cannot be used on object schemas containing refinements");let n=cr(e._zod.def,{get shape(){let i={...e._zod.def.shape};for(let a in t){if(!(a in r.shape))throw Error(`Unrecognized key: "${a}"`);if(!t[a])continue;delete i[a]}return Hr(this,"shape",i),i},checks:[]});return ht(e,n)}function kb(e,t){if(!Fr(t))throw Error("Invalid input to extend: expected a plain object");let r=e._zod.def.checks;if(r&&r.length>0){let n=e._zod.def.shape;for(let i in t)if(Object.getOwnPropertyDescriptor(n,i)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}let s=cr(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return Hr(this,"shape",n),n}});return ht(e,s)}function Pb(e,t){if(!Fr(t))throw Error("Invalid input to safeExtend: expected a plain object");let r=cr(e._zod.def,{get shape(){let o={...e._zod.def.shape,...t};return Hr(this,"shape",o),o}});return ht(e,r)}function Tb(e,t){if(e._zod.def.checks?.length)throw Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");let r=cr(e._zod.def,{get shape(){let o={...e._zod.def.shape,...t._zod.def.shape};return Hr(this,"shape",o),o},get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]});return ht(e,r)}function Eb(e,t,r){let s=t._zod.def.checks;if(s&&s.length>0)throw Error(".partial() cannot be used on object schemas containing refinements");let i=cr(t._zod.def,{get shape(){let a=t._zod.def.shape,c={...a};if(r)for(let l in r){if(!(l in a))throw Error(`Unrecognized key: "${l}"`);if(!r[l])continue;c[l]=e?new e({type:"optional",innerType:a[l]}):a[l]}else for(let l in a)c[l]=e?new e({type:"optional",innerType:a[l]}):a[l];return Hr(this,"shape",c),c},checks:[]});return ht(t,i)}function $b(e,t,r){let o=cr(t._zod.def,{get shape(){let s=t._zod.def.shape,n={...s};if(r)for(let i in r){if(!(i in n))throw Error(`Unrecognized key: "${i}"`);if(!r[i])continue;n[i]=new e({type:"nonoptional",innerType:s[i]})}else for(let i in s)n[i]=new e({type:"nonoptional",innerType:s[i]});return Hr(this,"shape",n),n}});return ht(t,o)}function Vr(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue!==!0)return!0;return!1}function Mp(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue===!1)return!0;return!1}function lr(e,t){return t.map((r)=>{var o;return(o=r).path??(o.path=[]),r.path.unshift(e),r})}function Ja(e){return typeof e==="string"?e:e?.message}function ft(e,t,r){let o=e.message?e.message:Ja(e.inst?._zod.def?.error?.(e))??Ja(t?.error?.(e))??Ja(r.customError?.(e))??Ja(r.localeError?.(e))??"Invalid input",{inst:s,continue:n,input:i,...a}=e;if(a.path??(a.path=[]),a.message=o,t?.reportInput)a.input=i;return a}function Ya(e){if(Array.isArray(e))return"array";if(typeof e==="string")return"string";return"unknown"}function Ap(e){let t=typeof e;switch(t){case"number":return Number.isNaN(e)?"nan":"number";case"object":{if(e===null)return"null";if(Array.isArray(e))return"array";let r=e;if(r&&Object.getPrototypeOf(r)!==Object.prototype&&"constructor"in r&&r.constructor)return r.constructor.name}}return t}function Br(...e){let[t,r,o]=e;if(typeof t==="string")return{message:t,code:"custom",input:r,inst:o};return{...t}}var Lp=(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,pn,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},Xa=w("$ZodError",Lp),Uu=w("$ZodError",Lp,{Parent:Error});function Du(e,t=(r)=>r.message){let r={},o=[];for(let s of e.issues)if(s.path.length>0)r[s.path[0]]=r[s.path[0]]||[],r[s.path[0]].push(t(s));else o.push(t(s));return{formErrors:o,fieldErrors:r}}function Zu(e,t=(r)=>r.message){let r={_errors:[]},o=(s,n=[])=>{for(let i of s.issues)if(i.code==="invalid_union"&&i.errors.length)i.errors.map((a)=>o({issues:a},[...n,...i.path]));else if(i.code==="invalid_key")o({issues:i.issues},[...n,...i.path]);else if(i.code==="invalid_element")o({issues:i.issues},[...n,...i.path]);else{let a=[...n,...i.path];if(a.length===0)r._errors.push(t(i));else{let c=r,l=0;while(l<a.length){let d=a[l];if(l!==a.length-1)c[d]=c[d]||{_errors:[]};else c[d]=c[d]||{_errors:[]},c[d]._errors.push(t(i));c=c[d],l++}}}};return o(e),r}var Qa=(e)=>(t,r,o,s)=>{let n=o?{...o,async:!1}:{async:!1},i=t._zod.run({value:r,issues:[]},n);if(i instanceof Promise)throw new Ft;if(i.issues.length){let a=new(s?.Err??e)(i.issues.map((c)=>ft(c,n,Je())));throw Mu(a,s?.callee),a}return i.value};var ec=(e)=>async(t,r,o,s)=>{let n=o?{...o,async:!0}:{async:!0},i=t._zod.run({value:r,issues:[]},n);if(i instanceof Promise)i=await i;if(i.issues.length){let a=new(s?.Err??e)(i.issues.map((c)=>ft(c,n,Je())));throw Mu(a,s?.callee),a}return i.value};var hn=(e)=>(t,r,o)=>{let s=o?{...o,async:!1}:{async:!1},n=t._zod.run({value:r,issues:[]},s);if(n instanceof Promise)throw new Ft;return n.issues.length?{success:!1,error:new(e??Xa)(n.issues.map((i)=>ft(i,s,Je())))}:{success:!0,data:n.value}},Up=hn(Uu),fn=(e)=>async(t,r,o)=>{let s=o?{...o,async:!0}:{async:!0},n=t._zod.run({value:r,issues:[]},s);if(n instanceof Promise)n=await n;return n.issues.length?{success:!1,error:new e(n.issues.map((i)=>ft(i,s,Je())))}:{success:!0,data:n.value}},Dp=fn(Uu),Zp=(e)=>(t,r,o)=>{let s=o?{...o,direction:"backward"}:{direction:"backward"};return Qa(e)(t,r,s)};var Hp=(e)=>(t,r,o)=>Qa(e)(t,r,o);var Fp=(e)=>async(t,r,o)=>{let s=o?{...o,direction:"backward"}:{direction:"backward"};return ec(e)(t,r,s)};var Vp=(e)=>async(t,r,o)=>ec(e)(t,r,o);var Bp=(e)=>(t,r,o)=>{let s=o?{...o,direction:"backward"}:{direction:"backward"};return hn(e)(t,r,s)};var Jp=(e)=>(t,r,o)=>hn(e)(t,r,o);var Wp=(e)=>async(t,r,o)=>{let s=o?{...o,direction:"backward"}:{direction:"backward"};return fn(e)(t,r,s)};var Kp=(e)=>async(t,r,o)=>fn(e)(t,r,o);var Gp=/^[cC][0-9a-z]{6,}$/,Yp=/^[0-9a-z]+$/,Xp=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Qp=/^[0-9a-vA-V]{20}$/,em=/^[A-Za-z0-9]{27}$/,tm=/^[a-zA-Z0-9_-]{21}$/,rm=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/;var om=/^([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})$/,Hu=(e)=>{if(!e)return/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/;return new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`)};var sm=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;var Ib="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function nm(){return new RegExp(Ib,"u")}var im=/^(?:(?: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])$/,am=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/;var cm=/^((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])$/,um=/^(([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])$/,lm=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Fu=/^[A-Za-z0-9_-]*$/;var dm=/^https?$/,pm=/^\+[1-9]\d{6,14}$/,mm="(?:(?:\\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])))",hm=new RegExp(`^${mm}$`);function fm(e){return typeof e.precision==="number"?e.precision===-1?"(?:[01]\\d|2[0-3]):[0-5]\\d":e.precision===0?"(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d":`(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d\\.\\d{${e.precision}}`:"(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?"}function _m(e){return new RegExp(`^${fm(e)}$`)}function gm(e){let t=fm({precision:e.precision}),r=["Z"];if(e.local)r.push("");if(e.offset)r.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let o=`${t}(?:${r.join("|")})`;return new RegExp(`^${mm}T(?:${o})$`)}var Sm=(e)=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)};var vm=/^-?\d+$/,Vu=/^-?\d+(?:\.\d+)?$/,bm=/^(?:true|false)$/i,ym=/^null$/i;var wm=/^undefined$/i;var zm=/^[^A-Z]*$/,Rm=/^[^a-z]*$/;var Ie=w("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])}),xm={number:"number",bigint:"bigint",object:"date"},Bu=w("$ZodCheckLessThan",(e,t)=>{Ie.init(e,t);let r=xm[typeof t.value];e._zod.onattach.push((o)=>{let s=o._zod.bag,n=(t.inclusive?s.maximum:s.exclusiveMaximum)??Number.POSITIVE_INFINITY;if(t.value<n)if(t.inclusive)s.maximum=t.value;else s.exclusiveMaximum=t.value}),e._zod.check=(o)=>{if(t.inclusive?o.value<=t.value:o.value<t.value)return;o.issues.push({origin:r,code:"too_big",maximum:typeof t.value==="object"?t.value.getTime():t.value,input:o.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Ju=w("$ZodCheckGreaterThan",(e,t)=>{Ie.init(e,t);let r=xm[typeof t.value];e._zod.onattach.push((o)=>{let s=o._zod.bag,n=(t.inclusive?s.minimum:s.exclusiveMinimum)??Number.NEGATIVE_INFINITY;if(t.value>n)if(t.inclusive)s.minimum=t.value;else s.exclusiveMinimum=t.value}),e._zod.check=(o)=>{if(t.inclusive?o.value>=t.value:o.value>t.value)return;o.issues.push({origin:r,code:"too_small",minimum:typeof t.value==="object"?t.value.getTime():t.value,input:o.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),km=w("$ZodCheckMultipleOf",(e,t)=>{Ie.init(e,t),e._zod.onattach.push((r)=>{var o;(o=r._zod.bag).multipleOf??(o.multipleOf=t.value)}),e._zod.check=(r)=>{if(typeof r.value!==typeof t.value)throw Error("Cannot mix number and bigint in multiple_of check.");if(typeof r.value==="bigint"?r.value%t.value===BigInt(0):Cp(r.value,t.value)===0)return;r.issues.push({origin:typeof r.value,code:"not_multiple_of",divisor:t.value,input:r.value,inst:e,continue:!t.abort})}}),Pm=w("$ZodCheckNumberFormat",(e,t)=>{Ie.init(e,t),t.format=t.format||"float64";let r=t.format?.includes("int"),o=r?"int":"number",[s,n]=jp[t.format];e._zod.onattach.push((i)=>{let a=i._zod.bag;if(a.format=t.format,a.minimum=s,a.maximum=n,r)a.pattern=vm}),e._zod.check=(i)=>{let a=i.value;if(r){if(!Number.isInteger(a)){i.issues.push({expected:o,format:t.format,code:"invalid_type",continue:!1,input:a,inst:e});return}if(!Number.isSafeInteger(a)){if(a>0)i.issues.push({input:a,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});else i.issues.push({input:a,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}}if(a<s)i.issues.push({origin:"number",input:a,code:"too_small",minimum:s,inclusive:!0,inst:e,continue:!t.abort});if(a>n)i.issues.push({origin:"number",input:a,code:"too_big",maximum:n,inclusive:!0,inst:e,continue:!t.abort})}});var Tm=w("$ZodCheckMaxLength",(e,t)=>{var r;Ie.init(e,t),(r=e._zod.def).when??(r.when=(o)=>{let s=o.value;return!Ka(s)&&s.length!==void 0}),e._zod.onattach.push((o)=>{let s=o._zod.bag.maximum??Number.POSITIVE_INFINITY;if(t.maximum<s)o._zod.bag.maximum=t.maximum}),e._zod.check=(o)=>{let s=o.value;if(s.length<=t.maximum)return;let i=Ya(s);o.issues.push({origin:i,code:"too_big",maximum:t.maximum,inclusive:!0,input:s,inst:e,continue:!t.abort})}}),Em=w("$ZodCheckMinLength",(e,t)=>{var r;Ie.init(e,t),(r=e._zod.def).when??(r.when=(o)=>{let s=o.value;return!Ka(s)&&s.length!==void 0}),e._zod.onattach.push((o)=>{let s=o._zod.bag.minimum??Number.NEGATIVE_INFINITY;if(t.minimum>s)o._zod.bag.minimum=t.minimum}),e._zod.check=(o)=>{let s=o.value;if(s.length>=t.minimum)return;let i=Ya(s);o.issues.push({origin:i,code:"too_small",minimum:t.minimum,inclusive:!0,input:s,inst:e,continue:!t.abort})}}),$m=w("$ZodCheckLengthEquals",(e,t)=>{var r;Ie.init(e,t),(r=e._zod.def).when??(r.when=(o)=>{let s=o.value;return!Ka(s)&&s.length!==void 0}),e._zod.onattach.push((o)=>{let s=o._zod.bag;s.minimum=t.length,s.maximum=t.length,s.length=t.length}),e._zod.check=(o)=>{let s=o.value,n=s.length;if(n===t.length)return;let i=Ya(s),a=n>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})}}),gn=w("$ZodCheckStringFormat",(e,t)=>{var r,o;if(Ie.init(e,t),e._zod.onattach.push((s)=>{let n=s._zod.bag;if(n.format=t.format,t.pattern)n.patterns??(n.patterns=new Set),n.patterns.add(t.pattern)}),t.pattern)(r=e._zod).check??(r.check=(s)=>{if(t.pattern.lastIndex=0,t.pattern.test(s.value))return;s.issues.push({origin:"string",code:"invalid_format",format:t.format,input:s.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})});else(o=e._zod).check??(o.check=()=>{})}),Cm=w("$ZodCheckRegex",(e,t)=>{gn.init(e,t),e._zod.check=(r)=>{if(t.pattern.lastIndex=0,t.pattern.test(r.value))return;r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),Im=w("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=zm),gn.init(e,t)}),qm=w("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=Rm),gn.init(e,t)}),Om=w("$ZodCheckIncludes",(e,t)=>{Ie.init(e,t);let r=ur(t.includes),o=new RegExp(typeof t.position==="number"?`^.{${t.position}}${r}`:r);t.pattern=o,e._zod.onattach.push((s)=>{let n=s._zod.bag;n.patterns??(n.patterns=new Set),n.patterns.add(o)}),e._zod.check=(s)=>{if(s.value.includes(t.includes,t.position))return;s.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:s.value,inst:e,continue:!t.abort})}}),Nm=w("$ZodCheckStartsWith",(e,t)=>{Ie.init(e,t);let r=new RegExp(`^${ur(t.prefix)}.*`);t.pattern??(t.pattern=r),e._zod.onattach.push((o)=>{let s=o._zod.bag;s.patterns??(s.patterns=new Set),s.patterns.add(r)}),e._zod.check=(o)=>{if(o.value.startsWith(t.prefix))return;o.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:o.value,inst:e,continue:!t.abort})}}),jm=w("$ZodCheckEndsWith",(e,t)=>{Ie.init(e,t);let r=new RegExp(`.*${ur(t.suffix)}$`);t.pattern??(t.pattern=r),e._zod.onattach.push((o)=>{let s=o._zod.bag;s.patterns??(s.patterns=new Set),s.patterns.add(r)}),e._zod.check=(o)=>{if(o.value.endsWith(t.suffix))return;o.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:o.value,inst:e,continue:!t.abort})}});var Mm=w("$ZodCheckOverwrite",(e,t)=>{Ie.init(e,t),e._zod.check=(r)=>{r.value=t.tx(r.value)}});class Wu{constructor(e=[]){if(this.content=[],this.indent=0,this)this.args=e}indented(e){this.indent+=1,e(this),this.indent-=1}write(e){if(typeof e==="function"){e(this,{execution:"sync"}),e(this,{execution:"async"});return}let r=e.split(`
3
3
  `).filter((n)=>n),o=Math.min(...r.map((n)=>n.length-n.trimStart().length)),s=r.map((n)=>n.slice(o)).map((n)=>" ".repeat(this.indent*2)+n);for(let n of s)this.content.push(n)}compile(){let e=Function,t=this?.args,o=[...(this?.content??[""]).map((s)=>` ${s}`)];return new e(...t,o.join(`
4
- `))}}var Op={major:4,minor:4,patch:3};var ae=y("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Op;let o=[...e._zod.def.checks??[]];if(e._zod.traits.has("$ZodCheck"))o.unshift(e);for(let s of o)for(let n of s._zod.onattach)n(e);if(o.length===0)(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let s=(i,a,c)=>{let l=Fr(i),d;for(let f of a){if(f._zod.def.when){if(Im(i))continue;if(!f._zod.def.when(i))continue}else if(l)continue;let h=i.issues.length,g=f._zod.check(i);if(g instanceof Promise&&c?.async===!1)throw new Ht;if(d||g instanceof Promise)d=(d??Promise.resolve()).then(async()=>{if(await g,i.issues.length===h)return;if(!l)l=Fr(i,h)});else{if(i.issues.length===h)continue;if(!l)l=Fr(i,h)}}if(d)return d.then(()=>i);return i},n=(i,a,c)=>{if(Fr(i))return i.aborted=!0,i;let l=s(a,o,c);if(l instanceof Promise){if(c.async===!1)throw new Ht;return l.then((d)=>e._zod.parse(d,c))}return e._zod.parse(l,c)};e._zod.run=(i,a)=>{if(a.skipChecks)return e._zod.parse(i,a);if(a.direction==="backward"){let l=e._zod.parse({value:i.value,issues:[]},{...a,skipChecks:!0});if(l instanceof Promise)return l.then((d)=>n(d,i,a));return n(l,i,a)}let c=e._zod.parse(i,a);if(c instanceof Promise){if(a.async===!1)throw new Ht;return c.then((l)=>s(l,o,a))}return s(c,o,a)}}oe(e,"~standard",()=>({validate:(s)=>{try{let n=Nm(e,s);return n.success?{value:n.data}:{issues:n.error?.issues}}catch(n){return jm(e,s).then((i)=>i.success?{value:i.data}:{issues:i.error?.issues})}},vendor:"zod",version:1}))}),ec=y("$ZodString",(e,t)=>{ae.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??pp(e._zod.bag),e._zod.parse=(r,o)=>{if(t.coerce)try{r.value=String(r.value)}catch(s){}if(typeof r.value==="string")return r;return r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:e}),r}}),me=y("$ZodStringFormat",(e,t)=>{pn.init(e,t),ec.init(e,t)}),Hp=y("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=Xm),me.init(e,t)}),Fp=y("$ZodUUID",(e,t)=>{if(t.version){let o={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(o===void 0)throw Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=Lu(o))}else t.pattern??(t.pattern=Lu());me.init(e,t)}),Vp=y("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=Qm),me.init(e,t)}),Bp=y("$ZodURL",(e,t)=>{me.init(e,t),e._zod.check=(r)=>{try{let o=r.value.trim();if(!t.normalize&&t.protocol?.source===ip.source){if(!/^https?:\/\//i.test(o)){r.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:r.value,inst:e,continue:!t.abort});return}}let s=new URL(o);if(t.hostname){if(t.hostname.lastIndex=0,!t.hostname.test(s.hostname))r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:r.value,inst:e,continue:!t.abort})}if(t.protocol){if(t.protocol.lastIndex=0,!t.protocol.test(s.protocol.endsWith(":")?s.protocol.slice(0,-1):s.protocol))r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:r.value,inst:e,continue:!t.abort})}if(t.normalize)r.value=s.href;else r.value=o;return}catch(o){r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort})}}}),Jp=y("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=ep()),me.init(e,t)}),Wp=y("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=Gm),me.init(e,t)}),Kp=y("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=Vm),me.init(e,t)}),Gp=y("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=Bm),me.init(e,t)}),Yp=y("$ZodULID",(e,t)=>{t.pattern??(t.pattern=Jm),me.init(e,t)}),Xp=y("$ZodXID",(e,t)=>{t.pattern??(t.pattern=Wm),me.init(e,t)}),Qp=y("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=Km),me.init(e,t)}),eh=y("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=mp(t)),me.init(e,t)}),th=y("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=up),me.init(e,t)}),rh=y("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=dp(t)),me.init(e,t)}),oh=y("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=Ym),me.init(e,t)}),sh=y("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=tp),me.init(e,t),e._zod.bag.format="ipv4"}),nh=y("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=rp),me.init(e,t),e._zod.bag.format="ipv6",e._zod.check=(r)=>{try{new URL(`http://[${r.value}]`)}catch{r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:e,continue:!t.abort})}}});var ih=y("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=op),me.init(e,t)}),ah=y("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=sp),me.init(e,t),e._zod.check=(r)=>{let o=r.value.split("/");try{if(o.length!==2)throw Error();let[s,n]=o;if(!n)throw Error();let i=Number(n);if(`${i}`!==n)throw Error();if(i<0||i>128)throw Error();new URL(`http://[${s}]`)}catch{r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:e,continue:!t.abort})}}});function ch(e){if(e==="")return!0;if(/\s/.test(e))return!1;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}var uh=y("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=np),me.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=(r)=>{if(ch(r.value))return;r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}});function xb(e){if(!Uu.test(e))return!1;let t=e.replace(/[-_]/g,(o)=>o==="-"?"+":"/"),r=t.padEnd(Math.ceil(t.length/4)*4,"=");return ch(r)}var lh=y("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=Uu),me.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=(r)=>{if(xb(r.value))return;r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:e,continue:!t.abort})}}),dh=y("$ZodE164",(e,t)=>{t.pattern??(t.pattern=ap),me.init(e,t)});function kb(e,t=null){try{let r=e.split(".");if(r.length!==3)return!1;let[o]=r;if(!o)return!1;let s=JSON.parse(atob(o));if("typ"in s&&s?.typ!=="JWT")return!1;if(!s.alg)return!1;if(t&&(!("alg"in s)||s.alg!==t))return!1;return!0}catch{return!1}}var mh=y("$ZodJWT",(e,t)=>{me.init(e,t),e._zod.check=(r)=>{if(kb(r.value,t.alg))return;r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:e,continue:!t.abort})}});var Bu=y("$ZodNumber",(e,t)=>{ae.init(e,t),e._zod.pattern=e._zod.bag.pattern??Du,e._zod.parse=(r,o)=>{if(t.coerce)try{r.value=Number(r.value)}catch(i){}let s=r.value;if(typeof s==="number"&&!Number.isNaN(s)&&Number.isFinite(s))return r;let n=typeof s==="number"?Number.isNaN(s)?"NaN":!Number.isFinite(s)?"Infinity":void 0:void 0;return r.issues.push({expected:"number",code:"invalid_type",input:s,inst:e,...n?{received:n}:{}}),r}}),ph=y("$ZodNumberFormat",(e,t)=>{wp.init(e,t),Bu.init(e,t)}),hh=y("$ZodBoolean",(e,t)=>{ae.init(e,t),e._zod.pattern=fp,e._zod.parse=(r,o)=>{if(t.coerce)try{r.value=Boolean(r.value)}catch(n){}let s=r.value;if(typeof s==="boolean")return r;return r.issues.push({expected:"boolean",code:"invalid_type",input:s,inst:e}),r}});var fh=y("$ZodUndefined",(e,t)=>{ae.init(e,t),e._zod.pattern=gp,e._zod.values=new Set([void 0]),e._zod.parse=(r,o)=>{let s=r.value;if(typeof s>"u")return r;return r.issues.push({expected:"undefined",code:"invalid_type",input:s,inst:e}),r}}),_h=y("$ZodNull",(e,t)=>{ae.init(e,t),e._zod.pattern=_p,e._zod.values=new Set([null]),e._zod.parse=(r,o)=>{let s=r.value;if(s===null)return r;return r.issues.push({expected:"null",code:"invalid_type",input:s,inst:e}),r}}),gh=y("$ZodAny",(e,t)=>{ae.init(e,t),e._zod.parse=(r)=>r}),Sh=y("$ZodUnknown",(e,t)=>{ae.init(e,t),e._zod.parse=(r)=>r}),vh=y("$ZodNever",(e,t)=>{ae.init(e,t),e._zod.parse=(r,o)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:e}),r)});function Np(e,t,r){if(e.issues.length)t.issues.push(...ur(r,e.issues));t.value[r]=e.value}var bh=y("$ZodArray",(e,t)=>{ae.init(e,t),e._zod.parse=(r,o)=>{let s=r.value;if(!Array.isArray(s))return r.issues.push({expected:"array",code:"invalid_type",input:s,inst:e}),r;r.value=Array(s.length);let n=[];for(let i=0;i<s.length;i++){let a=s[i],c=t.element._zod.run({value:a,issues:[]},o);if(c instanceof Promise)n.push(c.then((l)=>Np(l,r,i)));else Np(c,r,i)}if(n.length)return Promise.all(n).then(()=>r);return r}});function Qa(e,t,r,o,s,n){let i=r in o;if(e.issues.length){if(s&&n&&!i)return;t.issues.push(...ur(r,e.issues))}if(!i&&!s){if(!e.issues.length)t.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[r]});return}if(e.value===void 0){if(i)t.value[r]=void 0}else t.value[r]=e.value}function yh(e){let t=Object.keys(e.shape);for(let o of t)if(!e.shape?.[o]?._zod?.traits?.has("$ZodType"))throw Error(`Invalid element at key "${o}": expected a Zod schema`);let r=$m(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(r)}}function wh(e,t,r,o,s,n){let i=[],a=s.keySet,c=s.catchall._zod,l=c.def.type,d=c.optin==="optional",f=c.optout==="optional";for(let h in t){if(h==="__proto__")continue;if(a.has(h))continue;if(l==="never"){i.push(h);continue}let g=c.run({value:t[h],issues:[]},o);if(g instanceof Promise)e.push(g.then((b)=>Qa(b,r,h,t,d,f)));else Qa(g,r,h,t,d,f)}if(i.length)r.issues.push({code:"unrecognized_keys",keys:i,input:t,inst:n});if(!e.length)return r;return Promise.all(e).then(()=>r)}var Pb=y("$ZodObject",(e,t)=>{if(ae.init(e,t),!Object.getOwnPropertyDescriptor(t,"shape")?.get){let a=t.shape;Object.defineProperty(t,"shape",{get:()=>{let c={...a};return Object.defineProperty(t,"shape",{value:c}),c}})}let o=un(()=>yh(t));oe(e._zod,"propValues",()=>{let a=t.shape,c={};for(let l in a){let d=a[l]._zod;if(d.values){c[l]??(c[l]=new Set);for(let f of d.values)c[l].add(f)}}return c});let s=No,n=t.catchall,i;e._zod.parse=(a,c)=>{i??(i=o.value);let l=a.value;if(!s(l))return a.issues.push({expected:"object",code:"invalid_type",input:l,inst:e}),a;a.value={};let d=[],f=i.shape;for(let h of i.keys){let g=f[h],b=g._zod.optin==="optional",_=g._zod.optout==="optional",w=g._zod.run({value:l[h],issues:[]},c);if(w instanceof Promise)d.push(w.then((I)=>Qa(I,a,h,l,b,_)));else Qa(w,a,h,l,b,_)}if(!n)return d.length?Promise.all(d).then(()=>a):a;return wh(d,l,a,c,o.value,e)}}),zh=y("$ZodObjectJIT",(e,t)=>{Pb.init(e,t);let r=e._zod.parse,o=un(()=>yh(t)),s=(h)=>{let g=new Fu(["shape","payload","ctx"]),b=o.value,_=(z)=>{let q=Iu(z);return`shape[${q}]._zod.run({ value: input[${q}], issues: [] }, ctx)`};g.write("const input = payload.value;");let w=Object.create(null),I=0;for(let z of b.keys)w[z]=`key_${I++}`;g.write("const newResult = {};");for(let z of b.keys){let q=w[z],x=Iu(z),R=h[z],Z=R?._zod?.optin==="optional",ee=R?._zod?.optout==="optional";if(g.write(`const ${q} = ${_(z)};`),Z&&ee)g.write(`
5
- if (${q}.issues.length) {
6
- if (${x} in input) {
7
- payload.issues = payload.issues.concat(${q}.issues.map(iss => ({
4
+ `))}}var Lm={major:4,minor:4,patch:3};var ae=w("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Lm;let o=[...e._zod.def.checks??[]];if(e._zod.traits.has("$ZodCheck"))o.unshift(e);for(let s of o)for(let n of s._zod.onattach)n(e);if(o.length===0)(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let s=(i,a,c)=>{let l=Vr(i),d;for(let f of a){if(f._zod.def.when){if(Mp(i))continue;if(!f._zod.def.when(i))continue}else if(l)continue;let h=i.issues.length,g=f._zod.check(i);if(g instanceof Promise&&c?.async===!1)throw new Ft;if(d||g instanceof Promise)d=(d??Promise.resolve()).then(async()=>{if(await g,i.issues.length===h)return;if(!l)l=Vr(i,h)});else{if(i.issues.length===h)continue;if(!l)l=Vr(i,h)}}if(d)return d.then(()=>i);return i},n=(i,a,c)=>{if(Vr(i))return i.aborted=!0,i;let l=s(a,o,c);if(l instanceof Promise){if(c.async===!1)throw new Ft;return l.then((d)=>e._zod.parse(d,c))}return e._zod.parse(l,c)};e._zod.run=(i,a)=>{if(a.skipChecks)return e._zod.parse(i,a);if(a.direction==="backward"){let l=e._zod.parse({value:i.value,issues:[]},{...a,skipChecks:!0});if(l instanceof Promise)return l.then((d)=>n(d,i,a));return n(l,i,a)}let c=e._zod.parse(i,a);if(c instanceof Promise){if(a.async===!1)throw new Ft;return c.then((l)=>s(l,o,a))}return s(c,o,a)}}oe(e,"~standard",()=>({validate:(s)=>{try{let n=Up(e,s);return n.success?{value:n.data}:{issues:n.error?.issues}}catch(n){return Dp(e,s).then((i)=>i.success?{value:i.data}:{issues:i.error?.issues})}},vendor:"zod",version:1}))}),oc=w("$ZodString",(e,t)=>{ae.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??Sm(e._zod.bag),e._zod.parse=(r,o)=>{if(t.coerce)try{r.value=String(r.value)}catch(s){}if(typeof r.value==="string")return r;return r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:e}),r}}),pe=w("$ZodStringFormat",(e,t)=>{gn.init(e,t),oc.init(e,t)}),Wm=w("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=om),pe.init(e,t)}),Km=w("$ZodUUID",(e,t)=>{if(t.version){let o={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(o===void 0)throw Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=Hu(o))}else t.pattern??(t.pattern=Hu());pe.init(e,t)}),Gm=w("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=sm),pe.init(e,t)}),Ym=w("$ZodURL",(e,t)=>{pe.init(e,t),e._zod.check=(r)=>{try{let o=r.value.trim();if(!t.normalize&&t.protocol?.source===dm.source){if(!/^https?:\/\//i.test(o)){r.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:r.value,inst:e,continue:!t.abort});return}}let s=new URL(o);if(t.hostname){if(t.hostname.lastIndex=0,!t.hostname.test(s.hostname))r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:r.value,inst:e,continue:!t.abort})}if(t.protocol){if(t.protocol.lastIndex=0,!t.protocol.test(s.protocol.endsWith(":")?s.protocol.slice(0,-1):s.protocol))r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:r.value,inst:e,continue:!t.abort})}if(t.normalize)r.value=s.href;else r.value=o;return}catch(o){r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort})}}}),Xm=w("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=nm()),pe.init(e,t)}),Qm=w("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=tm),pe.init(e,t)}),eh=w("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=Gp),pe.init(e,t)}),th=w("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=Yp),pe.init(e,t)}),rh=w("$ZodULID",(e,t)=>{t.pattern??(t.pattern=Xp),pe.init(e,t)}),oh=w("$ZodXID",(e,t)=>{t.pattern??(t.pattern=Qp),pe.init(e,t)}),sh=w("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=em),pe.init(e,t)}),nh=w("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=gm(t)),pe.init(e,t)}),ih=w("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=hm),pe.init(e,t)}),ah=w("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=_m(t)),pe.init(e,t)}),ch=w("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=rm),pe.init(e,t)}),uh=w("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=im),pe.init(e,t),e._zod.bag.format="ipv4"}),lh=w("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=am),pe.init(e,t),e._zod.bag.format="ipv6",e._zod.check=(r)=>{try{new URL(`http://[${r.value}]`)}catch{r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:e,continue:!t.abort})}}});var dh=w("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=cm),pe.init(e,t)}),ph=w("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=um),pe.init(e,t),e._zod.check=(r)=>{let o=r.value.split("/");try{if(o.length!==2)throw Error();let[s,n]=o;if(!n)throw Error();let i=Number(n);if(`${i}`!==n)throw Error();if(i<0||i>128)throw Error();new URL(`http://[${s}]`)}catch{r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:e,continue:!t.abort})}}});function mh(e){if(e==="")return!0;if(/\s/.test(e))return!1;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}var hh=w("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=lm),pe.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=(r)=>{if(mh(r.value))return;r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}});function qb(e){if(!Fu.test(e))return!1;let t=e.replace(/[-_]/g,(o)=>o==="-"?"+":"/"),r=t.padEnd(Math.ceil(t.length/4)*4,"=");return mh(r)}var fh=w("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=Fu),pe.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=(r)=>{if(qb(r.value))return;r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:e,continue:!t.abort})}}),_h=w("$ZodE164",(e,t)=>{t.pattern??(t.pattern=pm),pe.init(e,t)});function Ob(e,t=null){try{let r=e.split(".");if(r.length!==3)return!1;let[o]=r;if(!o)return!1;let s=JSON.parse(atob(o));if("typ"in s&&s?.typ!=="JWT")return!1;if(!s.alg)return!1;if(t&&(!("alg"in s)||s.alg!==t))return!1;return!0}catch{return!1}}var gh=w("$ZodJWT",(e,t)=>{pe.init(e,t),e._zod.check=(r)=>{if(Ob(r.value,t.alg))return;r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:e,continue:!t.abort})}});var Gu=w("$ZodNumber",(e,t)=>{ae.init(e,t),e._zod.pattern=e._zod.bag.pattern??Vu,e._zod.parse=(r,o)=>{if(t.coerce)try{r.value=Number(r.value)}catch(i){}let s=r.value;if(typeof s==="number"&&!Number.isNaN(s)&&Number.isFinite(s))return r;let n=typeof s==="number"?Number.isNaN(s)?"NaN":!Number.isFinite(s)?"Infinity":void 0:void 0;return r.issues.push({expected:"number",code:"invalid_type",input:s,inst:e,...n?{received:n}:{}}),r}}),Sh=w("$ZodNumberFormat",(e,t)=>{Pm.init(e,t),Gu.init(e,t)}),vh=w("$ZodBoolean",(e,t)=>{ae.init(e,t),e._zod.pattern=bm,e._zod.parse=(r,o)=>{if(t.coerce)try{r.value=Boolean(r.value)}catch(n){}let s=r.value;if(typeof s==="boolean")return r;return r.issues.push({expected:"boolean",code:"invalid_type",input:s,inst:e}),r}});var bh=w("$ZodUndefined",(e,t)=>{ae.init(e,t),e._zod.pattern=wm,e._zod.values=new Set([void 0]),e._zod.parse=(r,o)=>{let s=r.value;if(typeof s>"u")return r;return r.issues.push({expected:"undefined",code:"invalid_type",input:s,inst:e}),r}}),yh=w("$ZodNull",(e,t)=>{ae.init(e,t),e._zod.pattern=ym,e._zod.values=new Set([null]),e._zod.parse=(r,o)=>{let s=r.value;if(s===null)return r;return r.issues.push({expected:"null",code:"invalid_type",input:s,inst:e}),r}}),wh=w("$ZodAny",(e,t)=>{ae.init(e,t),e._zod.parse=(r)=>r}),zh=w("$ZodUnknown",(e,t)=>{ae.init(e,t),e._zod.parse=(r)=>r}),Rh=w("$ZodNever",(e,t)=>{ae.init(e,t),e._zod.parse=(r,o)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:e}),r)});function Um(e,t,r){if(e.issues.length)t.issues.push(...lr(r,e.issues));t.value[r]=e.value}var xh=w("$ZodArray",(e,t)=>{ae.init(e,t),e._zod.parse=(r,o)=>{let s=r.value;if(!Array.isArray(s))return r.issues.push({expected:"array",code:"invalid_type",input:s,inst:e}),r;r.value=Array(s.length);let n=[];for(let i=0;i<s.length;i++){let a=s[i],c=t.element._zod.run({value:a,issues:[]},o);if(c instanceof Promise)n.push(c.then((l)=>Um(l,r,i)));else Um(c,r,i)}if(n.length)return Promise.all(n).then(()=>r);return r}});function rc(e,t,r,o,s,n){let i=r in o;if(e.issues.length){if(s&&n&&!i)return;t.issues.push(...lr(r,e.issues))}if(!i&&!s){if(!e.issues.length)t.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[r]});return}if(e.value===void 0){if(i)t.value[r]=void 0}else t.value[r]=e.value}function kh(e){let t=Object.keys(e.shape);for(let o of t)if(!e.shape?.[o]?._zod?.traits?.has("$ZodType"))throw Error(`Invalid element at key "${o}": expected a Zod schema`);let r=Np(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(r)}}function Ph(e,t,r,o,s,n){let i=[],a=s.keySet,c=s.catchall._zod,l=c.def.type,d=c.optin==="optional",f=c.optout==="optional";for(let h in t){if(h==="__proto__")continue;if(a.has(h))continue;if(l==="never"){i.push(h);continue}let g=c.run({value:t[h],issues:[]},o);if(g instanceof Promise)e.push(g.then((v)=>rc(v,r,h,t,d,f)));else rc(g,r,h,t,d,f)}if(i.length)r.issues.push({code:"unrecognized_keys",keys:i,input:t,inst:n});if(!e.length)return r;return Promise.all(e).then(()=>r)}var Nb=w("$ZodObject",(e,t)=>{if(ae.init(e,t),!Object.getOwnPropertyDescriptor(t,"shape")?.get){let a=t.shape;Object.defineProperty(t,"shape",{get:()=>{let c={...a};return Object.defineProperty(t,"shape",{value:c}),c}})}let o=mn(()=>kh(t));oe(e._zod,"propValues",()=>{let a=t.shape,c={};for(let l in a){let d=a[l]._zod;if(d.values){c[l]??(c[l]=new Set);for(let f of d.values)c[l].add(f)}}return c});let s=jo,n=t.catchall,i;e._zod.parse=(a,c)=>{i??(i=o.value);let l=a.value;if(!s(l))return a.issues.push({expected:"object",code:"invalid_type",input:l,inst:e}),a;a.value={};let d=[],f=i.shape;for(let h of i.keys){let g=f[h],v=g._zod.optin==="optional",_=g._zod.optout==="optional",y=g._zod.run({value:l[h],issues:[]},c);if(y instanceof Promise)d.push(y.then((T)=>rc(T,a,h,l,v,_)));else rc(y,a,h,l,v,_)}if(!n)return d.length?Promise.all(d).then(()=>a):a;return Ph(d,l,a,c,o.value,e)}}),Th=w("$ZodObjectJIT",(e,t)=>{Nb.init(e,t);let r=e._zod.parse,o=mn(()=>kh(t)),s=(h)=>{let g=new Wu(["shape","payload","ctx"]),v=o.value,_=(k)=>{let P=ju(k);return`shape[${P}]._zod.run({ value: input[${P}], issues: [] }, ctx)`};g.write("const input = payload.value;");let y=Object.create(null),T=0;for(let k of v.keys)y[k]=`key_${T++}`;g.write("const newResult = {};");for(let k of v.keys){let P=y[k],z=ju(k),R=h[k],Z=R?._zod?.optin==="optional",ee=R?._zod?.optout==="optional";if(g.write(`const ${P} = ${_(k)};`),Z&&ee)g.write(`
5
+ if (${P}.issues.length) {
6
+ if (${z} in input) {
7
+ payload.issues = payload.issues.concat(${P}.issues.map(iss => ({
8
8
  ...iss,
9
- path: iss.path ? [${x}, ...iss.path] : [${x}]
9
+ path: iss.path ? [${z}, ...iss.path] : [${z}]
10
10
  })));
11
11
  }
12
12
  }
13
13
 
14
- if (${q}.value === undefined) {
15
- if (${x} in input) {
16
- newResult[${x}] = undefined;
14
+ if (${P}.value === undefined) {
15
+ if (${z} in input) {
16
+ newResult[${z}] = undefined;
17
17
  }
18
18
  } else {
19
- newResult[${x}] = ${q}.value;
19
+ newResult[${z}] = ${P}.value;
20
20
  }
21
21
 
22
22
  `);else if(!Z)g.write(`
23
- const ${q}_present = ${x} in input;
24
- if (${q}.issues.length) {
25
- payload.issues = payload.issues.concat(${q}.issues.map(iss => ({
23
+ const ${P}_present = ${z} in input;
24
+ if (${P}.issues.length) {
25
+ payload.issues = payload.issues.concat(${P}.issues.map(iss => ({
26
26
  ...iss,
27
- path: iss.path ? [${x}, ...iss.path] : [${x}]
27
+ path: iss.path ? [${z}, ...iss.path] : [${z}]
28
28
  })));
29
29
  }
30
- if (!${q}_present && !${q}.issues.length) {
30
+ if (!${P}_present && !${P}.issues.length) {
31
31
  payload.issues.push({
32
32
  code: "invalid_type",
33
33
  expected: "nonoptional",
34
34
  input: undefined,
35
- path: [${x}]
35
+ path: [${z}]
36
36
  });
37
37
  }
38
38
 
39
- if (${q}_present) {
40
- if (${q}.value === undefined) {
41
- newResult[${x}] = undefined;
39
+ if (${P}_present) {
40
+ if (${P}.value === undefined) {
41
+ newResult[${z}] = undefined;
42
42
  } else {
43
- newResult[${x}] = ${q}.value;
43
+ newResult[${z}] = ${P}.value;
44
44
  }
45
45
  }
46
46
 
47
47
  `);else g.write(`
48
- if (${q}.issues.length) {
49
- payload.issues = payload.issues.concat(${q}.issues.map(iss => ({
48
+ if (${P}.issues.length) {
49
+ payload.issues = payload.issues.concat(${P}.issues.map(iss => ({
50
50
  ...iss,
51
- path: iss.path ? [${x}, ...iss.path] : [${x}]
51
+ path: iss.path ? [${z}, ...iss.path] : [${z}]
52
52
  })));
53
53
  }
54
54
 
55
- if (${q}.value === undefined) {
56
- if (${x} in input) {
57
- newResult[${x}] = undefined;
55
+ if (${P}.value === undefined) {
56
+ if (${z} in input) {
57
+ newResult[${z}] = undefined;
58
58
  }
59
59
  } else {
60
- newResult[${x}] = ${q}.value;
60
+ newResult[${z}] = ${P}.value;
61
61
  }
62
62
 
63
- `)}g.write("payload.value = newResult;"),g.write("return payload;");let A=g.compile();return(z,q)=>A(h,z,q)},n,i=No,a=!Oo.jitless,l=a&&Tm.value,d=t.catchall,f;e._zod.parse=(h,g)=>{f??(f=o.value);let b=h.value;if(!i(b))return h.issues.push({expected:"object",code:"invalid_type",input:b,inst:e}),h;if(a&&l&&g?.async===!1&&g.jitless!==!0){if(!n)n=s(t.shape);if(h=n(h,g),!d)return h;return wh([],b,h,g,f,e)}return r(h,g)}});function jp(e,t,r,o){for(let n of e)if(n.issues.length===0)return t.value=n.value,t;let s=e.filter((n)=>!Fr(n));if(s.length===1)return t.value=s[0].value,s[0];return t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map((n)=>n.issues.map((i)=>ht(i,o,Je())))}),t}var Ju=y("$ZodUnion",(e,t)=>{ae.init(e,t),oe(e._zod,"optin",()=>t.options.some((o)=>o._zod.optin==="optional")?"optional":void 0),oe(e._zod,"optout",()=>t.options.some((o)=>o._zod.optout==="optional")?"optional":void 0),oe(e._zod,"values",()=>{if(t.options.every((o)=>o._zod.values))return new Set(t.options.flatMap((o)=>Array.from(o._zod.values)));return}),oe(e._zod,"pattern",()=>{if(t.options.every((o)=>o._zod.pattern)){let o=t.options.map((s)=>s._zod.pattern);return new RegExp(`^(${o.map((s)=>Ja(s.source)).join("|")})$`)}return});let r=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(o,s)=>{if(r)return r(o,s);let n=!1,i=[];for(let a of t.options){let c=a._zod.run({value:o.value,issues:[]},s);if(c instanceof Promise)i.push(c),n=!0;else{if(c.issues.length===0)return c;i.push(c)}}if(!n)return jp(i,o,e,s);return Promise.all(i).then((a)=>jp(a,o,e,s))}});var Rh=y("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,Ju.init(e,t);let r=e._zod.parse;oe(e._zod,"propValues",()=>{let s={};for(let n of t.options){let i=n._zod.propValues;if(!i||Object.keys(i).length===0)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(n)}"`);for(let[a,c]of Object.entries(i)){if(!s[a])s[a]=new Set;for(let l of c)s[a].add(l)}}return s});let o=un(()=>{let s=t.options,n=new Map;for(let i of s){let a=i._zod.propValues?.[t.discriminator];if(!a||a.size===0)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(i)}"`);for(let c of a){if(n.has(c))throw Error(`Duplicate discriminator value "${String(c)}"`);n.set(c,i)}}return n});e._zod.parse=(s,n)=>{let i=s.value;if(!No(i))return s.issues.push({code:"invalid_type",expected:"object",input:i,inst:e}),s;let a=o.value.get(i?.[t.discriminator]);if(a)return a._zod.run(s,n);if(t.unionFallback||n.direction==="backward")return r(s,n);return s.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,options:Array.from(o.value.keys()),input:i,path:[t.discriminator],inst:e}),s}}),xh=y("$ZodIntersection",(e,t)=>{ae.init(e,t),e._zod.parse=(r,o)=>{let s=r.value,n=t.left._zod.run({value:s,issues:[]},o),i=t.right._zod.run({value:s,issues:[]},o);if(n instanceof Promise||i instanceof Promise)return Promise.all([n,i]).then(([c,l])=>Mp(r,c,l));return Mp(r,n,i)}});function Vu(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(Hr(e)&&Hr(t)){let r=Object.keys(t),o=Object.keys(e).filter((n)=>r.indexOf(n)!==-1),s={...e,...t};for(let n of o){let i=Vu(e[n],t[n]);if(!i.valid)return{valid:!1,mergeErrorPath:[n,...i.mergeErrorPath]};s[n]=i.data}return{valid:!0,data:s}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let r=[];for(let o=0;o<e.length;o++){let s=e[o],n=t[o],i=Vu(s,n);if(!i.valid)return{valid:!1,mergeErrorPath:[o,...i.mergeErrorPath]};r.push(i.data)}return{valid:!0,data:r}}return{valid:!1,mergeErrorPath:[]}}function Mp(e,t,r){let o=new Map,s;for(let a of t.issues)if(a.code==="unrecognized_keys"){s??(s=a);for(let c of a.keys){if(!o.has(c))o.set(c,{});o.get(c).l=!0}}else e.issues.push(a);for(let a of r.issues)if(a.code==="unrecognized_keys")for(let c of a.keys){if(!o.has(c))o.set(c,{});o.get(c).r=!0}else e.issues.push(a);let n=[...o].filter(([,a])=>a.l&&a.r).map(([a])=>a);if(n.length&&s)e.issues.push({...s,keys:n});if(Fr(e))return e;let i=Vu(t.value,r.value);if(!i.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(i.mergeErrorPath)}`);return e.value=i.data,e}var kh=y("$ZodRecord",(e,t)=>{ae.init(e,t),e._zod.parse=(r,o)=>{let s=r.value;if(!Hr(s))return r.issues.push({expected:"record",code:"invalid_type",input:s,inst:e}),r;let n=[],i=t.keyType._zod.values;if(i){r.value={};let a=new Set;for(let l of i)if(typeof l==="string"||typeof l==="number"||typeof l==="symbol"){a.add(typeof l==="number"?l.toString():l);let d=t.keyType._zod.run({value:l,issues:[]},o);if(d instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(d.issues.length){r.issues.push({code:"invalid_key",origin:"record",issues:d.issues.map((g)=>ht(g,o,Je())),input:l,path:[l],inst:e});continue}let f=d.value,h=t.valueType._zod.run({value:s[l],issues:[]},o);if(h instanceof Promise)n.push(h.then((g)=>{if(g.issues.length)r.issues.push(...ur(l,g.issues));r.value[f]=g.value}));else{if(h.issues.length)r.issues.push(...ur(l,h.issues));r.value[f]=h.value}}let c;for(let l in s)if(!a.has(l))c=c??[],c.push(l);if(c&&c.length>0)r.issues.push({code:"unrecognized_keys",input:s,inst:e,keys:c})}else{r.value={};for(let a of Reflect.ownKeys(s)){if(a==="__proto__")continue;if(!Object.prototype.propertyIsEnumerable.call(s,a))continue;let c=t.keyType._zod.run({value:a,issues:[]},o);if(c instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(typeof a==="string"&&Du.test(a)&&c.issues.length){let f=t.keyType._zod.run({value:Number(a),issues:[]},o);if(f instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(f.issues.length===0)c=f}if(c.issues.length){if(t.mode==="loose")r.value[a]=s[a];else r.issues.push({code:"invalid_key",origin:"record",issues:c.issues.map((f)=>ht(f,o,Je())),input:a,path:[a],inst:e});continue}let d=t.valueType._zod.run({value:s[a],issues:[]},o);if(d instanceof Promise)n.push(d.then((f)=>{if(f.issues.length)r.issues.push(...ur(a,f.issues));r.value[c.value]=f.value}));else{if(d.issues.length)r.issues.push(...ur(a,d.issues));r.value[c.value]=d.value}}}if(n.length)return Promise.all(n).then(()=>r);return r}});var Ph=y("$ZodEnum",(e,t)=>{ae.init(e,t);let r=Va(t.entries),o=new Set(r);e._zod.values=o,e._zod.pattern=new RegExp(`^(${r.filter((s)=>Em.has(typeof s)).map((s)=>typeof s==="string"?cr(s):s.toString()).join("|")})$`),e._zod.parse=(s,n)=>{let i=s.value;if(o.has(i))return s;return s.issues.push({code:"invalid_value",values:r,input:i,inst:e}),s}}),Th=y("$ZodLiteral",(e,t)=>{if(ae.init(e,t),t.values.length===0)throw Error("Cannot create literal schema with no valid values");let r=new Set(t.values);e._zod.values=r,e._zod.pattern=new RegExp(`^(${t.values.map((o)=>typeof o==="string"?cr(o):o?cr(o.toString()):String(o)).join("|")})$`),e._zod.parse=(o,s)=>{let n=o.value;if(r.has(n))return o;return o.issues.push({code:"invalid_value",values:t.values,input:n,inst:e}),o}});var Eh=y("$ZodTransform",(e,t)=>{ae.init(e,t),e._zod.optin="optional",e._zod.parse=(r,o)=>{if(o.direction==="backward")throw new an(e.constructor.name);let s=t.transform(r.value,r);if(o.async)return(s instanceof Promise?s:Promise.resolve(s)).then((i)=>(r.value=i,r.fallback=!0,r));if(s instanceof Promise)throw new Ht;return r.value=s,r.fallback=!0,r}});function Ap(e,t){if(t===void 0&&(e.issues.length||e.fallback))return{issues:[],value:void 0};return e}var Wu=y("$ZodOptional",(e,t)=>{ae.init(e,t),e._zod.optin="optional",e._zod.optout="optional",oe(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),oe(e._zod,"pattern",()=>{let r=t.innerType._zod.pattern;return r?new RegExp(`^(${Ja(r.source)})?$`):void 0}),e._zod.parse=(r,o)=>{if(t.innerType._zod.optin==="optional"){let s=r.value,n=t.innerType._zod.run(r,o);if(n instanceof Promise)return n.then((i)=>Ap(i,s));return Ap(n,s)}if(r.value===void 0)return r;return t.innerType._zod.run(r,o)}}),$h=y("$ZodExactOptional",(e,t)=>{Wu.init(e,t),oe(e._zod,"values",()=>t.innerType._zod.values),oe(e._zod,"pattern",()=>t.innerType._zod.pattern),e._zod.parse=(r,o)=>t.innerType._zod.run(r,o)}),Ch=y("$ZodNullable",(e,t)=>{ae.init(e,t),oe(e._zod,"optin",()=>t.innerType._zod.optin),oe(e._zod,"optout",()=>t.innerType._zod.optout),oe(e._zod,"pattern",()=>{let r=t.innerType._zod.pattern;return r?new RegExp(`^(${Ja(r.source)}|null)$`):void 0}),oe(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(r,o)=>{if(r.value===null)return r;return t.innerType._zod.run(r,o)}}),Ih=y("$ZodDefault",(e,t)=>{ae.init(e,t),e._zod.optin="optional",oe(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,o)=>{if(o.direction==="backward")return t.innerType._zod.run(r,o);if(r.value===void 0)return r.value=t.defaultValue,r;let s=t.innerType._zod.run(r,o);if(s instanceof Promise)return s.then((n)=>Lp(n,t));return Lp(s,t)}});function Lp(e,t){if(e.value===void 0)e.value=t.defaultValue;return e}var qh=y("$ZodPrefault",(e,t)=>{ae.init(e,t),e._zod.optin="optional",oe(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,o)=>{if(o.direction==="backward")return t.innerType._zod.run(r,o);if(r.value===void 0)r.value=t.defaultValue;return t.innerType._zod.run(r,o)}}),Oh=y("$ZodNonOptional",(e,t)=>{ae.init(e,t),oe(e._zod,"values",()=>{let r=t.innerType._zod.values;return r?new Set([...r].filter((o)=>o!==void 0)):void 0}),e._zod.parse=(r,o)=>{let s=t.innerType._zod.run(r,o);if(s instanceof Promise)return s.then((n)=>Up(n,e));return Up(s,e)}});function Up(e,t){if(!e.issues.length&&e.value===void 0)e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t});return e}var Nh=y("$ZodCatch",(e,t)=>{ae.init(e,t),e._zod.optin="optional",oe(e._zod,"optout",()=>t.innerType._zod.optout),oe(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,o)=>{if(o.direction==="backward")return t.innerType._zod.run(r,o);let s=t.innerType._zod.run(r,o);if(s instanceof Promise)return s.then((n)=>{if(r.value=n.value,n.issues.length)r.value=t.catchValue({...r,error:{issues:n.issues.map((i)=>ht(i,o,Je()))},input:r.value}),r.issues=[],r.fallback=!0;return r});if(r.value=s.value,s.issues.length)r.value=t.catchValue({...r,error:{issues:s.issues.map((n)=>ht(n,o,Je()))},input:r.value}),r.issues=[],r.fallback=!0;return r}});var Ku=y("$ZodPipe",(e,t)=>{ae.init(e,t),oe(e._zod,"values",()=>t.in._zod.values),oe(e._zod,"optin",()=>t.in._zod.optin),oe(e._zod,"optout",()=>t.out._zod.optout),oe(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(r,o)=>{if(o.direction==="backward"){let n=t.out._zod.run(r,o);if(n instanceof Promise)return n.then((i)=>Xa(i,t.in,o));return Xa(n,t.in,o)}let s=t.in._zod.run(r,o);if(s instanceof Promise)return s.then((n)=>Xa(n,t.out,o));return Xa(s,t.out,o)}});function Xa(e,t,r){if(e.issues.length)return e.aborted=!0,e;return t._zod.run({value:e.value,issues:e.issues,fallback:e.fallback},r)}var jh=y("$ZodPreprocess",(e,t)=>{Ku.init(e,t)}),Mh=y("$ZodReadonly",(e,t)=>{ae.init(e,t),oe(e._zod,"propValues",()=>t.innerType._zod.propValues),oe(e._zod,"values",()=>t.innerType._zod.values),oe(e._zod,"optin",()=>t.innerType?._zod?.optin),oe(e._zod,"optout",()=>t.innerType?._zod?.optout),e._zod.parse=(r,o)=>{if(o.direction==="backward")return t.innerType._zod.run(r,o);let s=t.innerType._zod.run(r,o);if(s instanceof Promise)return s.then(Dp);return Dp(s)}});function Dp(e){return e.value=Object.freeze(e.value),e}var Ah=y("$ZodLazy",(e,t)=>{ae.init(e,t),oe(e._zod,"innerType",()=>{let r=t;if(!r._cachedInner)r._cachedInner=t.getter();return r._cachedInner}),oe(e._zod,"pattern",()=>e._zod.innerType?._zod?.pattern),oe(e._zod,"propValues",()=>e._zod.innerType?._zod?.propValues),oe(e._zod,"optin",()=>e._zod.innerType?._zod?.optin??void 0),oe(e._zod,"optout",()=>e._zod.innerType?._zod?.optout??void 0),e._zod.parse=(r,o)=>e._zod.innerType._zod.run(r,o)}),Lh=y("$ZodCustom",(e,t)=>{Ie.init(e,t),ae.init(e,t),e._zod.parse=(r,o)=>r,e._zod.check=(r)=>{let o=r.value,s=t.fn(o);if(s instanceof Promise)return s.then((n)=>Zp(n,r,o,e));Zp(s,r,o,e);return}});function Zp(e,t,r,o){if(!e){let s={code:"custom",input:r,inst:o,path:[...o._zod.def.path??[]],continue:!o._zod.def.abort};if(o._zod.def.params)s.params=o._zod.def.params;t.issues.push(Vr(s))}}var Tb=()=>{let e={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"},map:{unit:"entries",verb:"to have"}};function t(s){return e[s]??null}let r={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",mac:"MAC address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",jwt:"JWT",template_literal:"input"},o={nan:"NaN"};return(s)=>{switch(s.code){case"invalid_type":{let n=o[s.expected]??s.expected,i=qm(s.input),a=o[i]??i;return`Invalid input: expected ${n}, received ${a}`}case"invalid_value":if(s.values.length===1)return`Invalid input: expected ${Nu(s.values[0])}`;return`Invalid option: expected one of ${Cu(s.values,"|")}`;case"too_big":{let n=s.inclusive?"<=":"<",i=t(s.origin);if(i)return`Too big: expected ${s.origin??"value"} to have ${n}${s.maximum.toString()} ${i.unit??"elements"}`;return`Too big: expected ${s.origin??"value"} to be ${n}${s.maximum.toString()}`}case"too_small":{let n=s.inclusive?">=":">",i=t(s.origin);if(i)return`Too small: expected ${s.origin} to have ${n}${s.minimum.toString()} ${i.unit}`;return`Too small: expected ${s.origin} to be ${n}${s.minimum.toString()}`}case"invalid_format":{let n=s;if(n.format==="starts_with")return`Invalid string: must start with "${n.prefix}"`;if(n.format==="ends_with")return`Invalid string: must end with "${n.suffix}"`;if(n.format==="includes")return`Invalid string: must include "${n.includes}"`;if(n.format==="regex")return`Invalid string: must match pattern ${n.pattern}`;return`Invalid ${r[n.format]??s.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${s.divisor}`;case"unrecognized_keys":return`Unrecognized key${s.keys.length>1?"s":""}: ${Cu(s.keys,", ")}`;case"invalid_key":return`Invalid key in ${s.origin}`;case"invalid_union":if(s.options&&Array.isArray(s.options)&&s.options.length>0)return`Invalid discriminator value. Expected ${s.options.map((i)=>`'${i}'`).join(" | ")}`;return"Invalid input";case"invalid_element":return`Invalid value in ${s.origin}`;default:return"Invalid input"}}};function Gu(){return{localeError:Tb()}}var Uh,Eb=Symbol("ZodOutput"),$b=Symbol("ZodInput");class Dh{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){let r=t[0];if(this._map.set(e,r),r&&typeof r==="object"&&"id"in r)this._idmap.set(r.id,e);return this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let t=this._map.get(e);if(t&&typeof t==="object"&&"id"in t)this._idmap.delete(t.id);return this._map.delete(e),this}get(e){let t=e._zod.parent;if(t){let r={...this.get(t)??{}};delete r.id;let o={...r,...this._map.get(e)};return Object.keys(o).length?o:void 0}return this._map.get(e)}has(e){return this._map.has(e)}}function Zh(){return new Dh}(Uh=globalThis).__zod_globalRegistry??(Uh.__zod_globalRegistry=Zh());var lr=globalThis.__zod_globalRegistry;function Hh(e,t){return new e({type:"string",...H(t)})}function Yu(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...H(t)})}function Xu(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...H(t)})}function Fh(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...H(t)})}function Vh(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...H(t)})}function Bh(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...H(t)})}function Jh(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...H(t)})}function Qu(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...H(t)})}function Wh(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...H(t)})}function Kh(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...H(t)})}function Gh(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...H(t)})}function Yh(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...H(t)})}function Xh(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...H(t)})}function Qh(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...H(t)})}function ef(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...H(t)})}function tf(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...H(t)})}function rf(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...H(t)})}function of(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...H(t)})}function sf(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...H(t)})}function nf(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...H(t)})}function af(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...H(t)})}function cf(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...H(t)})}function uf(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...H(t)})}function lf(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...H(t)})}function df(e,t){return new e({type:"string",format:"date",check:"string_format",...H(t)})}function mf(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...H(t)})}function pf(e,t){return new e({type:"string",format:"duration",check:"string_format",...H(t)})}function hf(e,t){return new e({type:"number",checks:[],...H(t)})}function ff(e,t){return new e({type:"number",coerce:!0,checks:[],...H(t)})}function _f(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...H(t)})}function gf(e,t){return new e({type:"boolean",...H(t)})}function Sf(e,t){return new e({type:"undefined",...H(t)})}function vf(e,t){return new e({type:"null",...H(t)})}function bf(e){return new e({type:"any"})}function yf(e){return new e({type:"unknown"})}function wf(e,t){return new e({type:"never",...H(t)})}function tc(e,t){return new Zu({check:"less_than",...H(t),value:e,inclusive:!1})}function hn(e,t){return new Zu({check:"less_than",...H(t),value:e,inclusive:!0})}function rc(e,t){return new Hu({check:"greater_than",...H(t),value:e,inclusive:!1})}function fn(e,t){return new Hu({check:"greater_than",...H(t),value:e,inclusive:!0})}function oc(e,t){return new yp({check:"multiple_of",...H(t),value:e})}function sc(e,t){return new zp({check:"max_length",...H(t),maximum:e})}function jo(e,t){return new Rp({check:"min_length",...H(t),minimum:e})}function nc(e,t){return new xp({check:"length_equals",...H(t),length:e})}function el(e,t){return new kp({check:"string_format",format:"regex",...H(t),pattern:e})}function tl(e){return new Pp({check:"string_format",format:"lowercase",...H(e)})}function rl(e){return new Tp({check:"string_format",format:"uppercase",...H(e)})}function ol(e,t){return new Ep({check:"string_format",format:"includes",...H(t),includes:e})}function sl(e,t){return new $p({check:"string_format",format:"starts_with",...H(t),prefix:e})}function nl(e,t){return new Cp({check:"string_format",format:"ends_with",...H(t),suffix:e})}function dr(e){return new Ip({check:"overwrite",tx:e})}function il(e){return dr((t)=>t.normalize(e))}function al(){return dr((e)=>e.trim())}function cl(){return dr((e)=>e.toLowerCase())}function ul(){return dr((e)=>e.toUpperCase())}function ll(){return dr((e)=>Pm(e))}function zf(e,t,r){return new e({type:"array",element:t,...H(r)})}function Rf(e,t,r){return new e({type:"custom",check:"custom",fn:t,...H(r)})}function xf(e,t){let r=Cb((o)=>(o.addIssue=(s)=>{if(typeof s==="string")o.issues.push(Vr(s,o.value,r._zod.def));else{let n=s;if(n.fatal)n.continue=!1;n.code??(n.code="custom"),n.input??(n.input=o.value),n.inst??(n.inst=r),n.continue??(n.continue=!r._zod.def.abort),o.issues.push(Vr(n))}},e(o.value,o)),t);return r}function Cb(e,t){let r=new Ie({check:"custom",...H(t)});return r._zod.check=e,r}function gn(e){let t=e?.target??"draft-2020-12";if(t==="draft-4")t="draft-04";if(t==="draft-7")t="draft-07";return{processors:e.processors??{},metadataRegistry:e?.metadata??lr,target:t,unrepresentable:e?.unrepresentable??"throw",override:e?.override??(()=>{}),io:e?.io??"output",counter:0,seen:new Map,cycles:e?.cycles??"ref",reused:e?.reused??"inline",external:e?.external??void 0}}function ce(e,t,r={path:[],schemaPath:[]}){var o;let s=e._zod.def,n=t.seen.get(e);if(n){if(n.count++,r.schemaPath.includes(e))n.cycle=r.path;return n.schema}let i={schema:{},count:1,cycle:void 0,path:r.path};t.seen.set(e,i);let a=e._zod.toJSONSchema?.();if(a)i.schema=a;else{let d={...r,schemaPath:[...r.schemaPath,e],path:r.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,i.schema,d);else{let h=i.schema,g=t.processors[s.type];if(!g)throw Error(`[toJSONSchema]: Non-representable type encountered: ${s.type}`);g(e,t,h,d)}let f=e._zod.parent;if(f){if(!i.ref)i.ref=f;ce(f,t,d),t.seen.get(f).isParent=!0}}let c=t.metadataRegistry.get(e);if(c)Object.assign(i.schema,c);if(t.io==="input"&&He(e))delete i.schema.examples,delete i.schema.default;if(t.io==="input"&&"_prefault"in i.schema)(o=i.schema).default??(o.default=i.schema._prefault);return delete i.schema._prefault,t.seen.get(e).schema}function Sn(e,t){let r=e.seen.get(t);if(!r)throw Error("Unprocessed schema. This is a bug in Zod.");let o=new Map;for(let i of e.seen.entries()){let a=e.metadataRegistry.get(i[0])?.id;if(a){let c=o.get(a);if(c&&c!==i[0])throw Error(`Duplicate schema id "${a}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);o.set(a,i[0])}}let s=(i)=>{let a=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){let f=e.external.registry.get(i[0])?.id,h=e.external.uri??((b)=>b);if(f)return{ref:h(f)};let g=i[1].defId??i[1].schema.id??`schema${e.counter++}`;return i[1].defId=g,{defId:g,ref:`${h("__shared")}#/${a}/${g}`}}if(i[1]===r)return{ref:"#"};let l=`${"#"}/${a}/`,d=i[1].schema.id??`__schema${e.counter++}`;return{defId:d,ref:l+d}},n=(i)=>{if(i[1].schema.$ref)return;let a=i[1],{ref:c,defId:l}=s(i);if(a.def={...a.schema},l)a.defId=l;let d=a.schema;for(let f in d)delete d[f];d.$ref=c};if(e.cycles==="throw")for(let i of e.seen.entries()){let a=i[1];if(a.cycle)throw Error(`Cycle detected: #/${a.cycle?.join("/")}/<root>
63
+ `)}g.write("payload.value = newResult;"),g.write("return payload;");let O=g.compile();return(k,P)=>O(h,k,P)},n,i=jo,a=!No.jitless,l=a&&qp.value,d=t.catchall,f;e._zod.parse=(h,g)=>{f??(f=o.value);let v=h.value;if(!i(v))return h.issues.push({expected:"object",code:"invalid_type",input:v,inst:e}),h;if(a&&l&&g?.async===!1&&g.jitless!==!0){if(!n)n=s(t.shape);if(h=n(h,g),!d)return h;return Ph([],v,h,g,f,e)}return r(h,g)}});function Dm(e,t,r,o){for(let n of e)if(n.issues.length===0)return t.value=n.value,t;let s=e.filter((n)=>!Vr(n));if(s.length===1)return t.value=s[0].value,s[0];return t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map((n)=>n.issues.map((i)=>ft(i,o,Je())))}),t}var Yu=w("$ZodUnion",(e,t)=>{ae.init(e,t),oe(e._zod,"optin",()=>t.options.some((o)=>o._zod.optin==="optional")?"optional":void 0),oe(e._zod,"optout",()=>t.options.some((o)=>o._zod.optout==="optional")?"optional":void 0),oe(e._zod,"values",()=>{if(t.options.every((o)=>o._zod.values))return new Set(t.options.flatMap((o)=>Array.from(o._zod.values)));return}),oe(e._zod,"pattern",()=>{if(t.options.every((o)=>o._zod.pattern)){let o=t.options.map((s)=>s._zod.pattern);return new RegExp(`^(${o.map((s)=>Ga(s.source)).join("|")})$`)}return});let r=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(o,s)=>{if(r)return r(o,s);let n=!1,i=[];for(let a of t.options){let c=a._zod.run({value:o.value,issues:[]},s);if(c instanceof Promise)i.push(c),n=!0;else{if(c.issues.length===0)return c;i.push(c)}}if(!n)return Dm(i,o,e,s);return Promise.all(i).then((a)=>Dm(a,o,e,s))}});var Eh=w("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,Yu.init(e,t);let r=e._zod.parse;oe(e._zod,"propValues",()=>{let s={};for(let n of t.options){let i=n._zod.propValues;if(!i||Object.keys(i).length===0)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(n)}"`);for(let[a,c]of Object.entries(i)){if(!s[a])s[a]=new Set;for(let l of c)s[a].add(l)}}return s});let o=mn(()=>{let s=t.options,n=new Map;for(let i of s){let a=i._zod.propValues?.[t.discriminator];if(!a||a.size===0)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(i)}"`);for(let c of a){if(n.has(c))throw Error(`Duplicate discriminator value "${String(c)}"`);n.set(c,i)}}return n});e._zod.parse=(s,n)=>{let i=s.value;if(!jo(i))return s.issues.push({code:"invalid_type",expected:"object",input:i,inst:e}),s;let a=o.value.get(i?.[t.discriminator]);if(a)return a._zod.run(s,n);if(t.unionFallback||n.direction==="backward")return r(s,n);return s.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,options:Array.from(o.value.keys()),input:i,path:[t.discriminator],inst:e}),s}}),$h=w("$ZodIntersection",(e,t)=>{ae.init(e,t),e._zod.parse=(r,o)=>{let s=r.value,n=t.left._zod.run({value:s,issues:[]},o),i=t.right._zod.run({value:s,issues:[]},o);if(n instanceof Promise||i instanceof Promise)return Promise.all([n,i]).then(([c,l])=>Zm(r,c,l));return Zm(r,n,i)}});function Ku(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(Fr(e)&&Fr(t)){let r=Object.keys(t),o=Object.keys(e).filter((n)=>r.indexOf(n)!==-1),s={...e,...t};for(let n of o){let i=Ku(e[n],t[n]);if(!i.valid)return{valid:!1,mergeErrorPath:[n,...i.mergeErrorPath]};s[n]=i.data}return{valid:!0,data:s}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let r=[];for(let o=0;o<e.length;o++){let s=e[o],n=t[o],i=Ku(s,n);if(!i.valid)return{valid:!1,mergeErrorPath:[o,...i.mergeErrorPath]};r.push(i.data)}return{valid:!0,data:r}}return{valid:!1,mergeErrorPath:[]}}function Zm(e,t,r){let o=new Map,s;for(let a of t.issues)if(a.code==="unrecognized_keys"){s??(s=a);for(let c of a.keys){if(!o.has(c))o.set(c,{});o.get(c).l=!0}}else e.issues.push(a);for(let a of r.issues)if(a.code==="unrecognized_keys")for(let c of a.keys){if(!o.has(c))o.set(c,{});o.get(c).r=!0}else e.issues.push(a);let n=[...o].filter(([,a])=>a.l&&a.r).map(([a])=>a);if(n.length&&s)e.issues.push({...s,keys:n});if(Vr(e))return e;let i=Ku(t.value,r.value);if(!i.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(i.mergeErrorPath)}`);return e.value=i.data,e}var Ch=w("$ZodRecord",(e,t)=>{ae.init(e,t),e._zod.parse=(r,o)=>{let s=r.value;if(!Fr(s))return r.issues.push({expected:"record",code:"invalid_type",input:s,inst:e}),r;let n=[],i=t.keyType._zod.values;if(i){r.value={};let a=new Set;for(let l of i)if(typeof l==="string"||typeof l==="number"||typeof l==="symbol"){a.add(typeof l==="number"?l.toString():l);let d=t.keyType._zod.run({value:l,issues:[]},o);if(d instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(d.issues.length){r.issues.push({code:"invalid_key",origin:"record",issues:d.issues.map((g)=>ft(g,o,Je())),input:l,path:[l],inst:e});continue}let f=d.value,h=t.valueType._zod.run({value:s[l],issues:[]},o);if(h instanceof Promise)n.push(h.then((g)=>{if(g.issues.length)r.issues.push(...lr(l,g.issues));r.value[f]=g.value}));else{if(h.issues.length)r.issues.push(...lr(l,h.issues));r.value[f]=h.value}}let c;for(let l in s)if(!a.has(l))c=c??[],c.push(l);if(c&&c.length>0)r.issues.push({code:"unrecognized_keys",input:s,inst:e,keys:c})}else{r.value={};for(let a of Reflect.ownKeys(s)){if(a==="__proto__")continue;if(!Object.prototype.propertyIsEnumerable.call(s,a))continue;let c=t.keyType._zod.run({value:a,issues:[]},o);if(c instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(typeof a==="string"&&Vu.test(a)&&c.issues.length){let f=t.keyType._zod.run({value:Number(a),issues:[]},o);if(f instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(f.issues.length===0)c=f}if(c.issues.length){if(t.mode==="loose")r.value[a]=s[a];else r.issues.push({code:"invalid_key",origin:"record",issues:c.issues.map((f)=>ft(f,o,Je())),input:a,path:[a],inst:e});continue}let d=t.valueType._zod.run({value:s[a],issues:[]},o);if(d instanceof Promise)n.push(d.then((f)=>{if(f.issues.length)r.issues.push(...lr(a,f.issues));r.value[c.value]=f.value}));else{if(d.issues.length)r.issues.push(...lr(a,d.issues));r.value[c.value]=d.value}}}if(n.length)return Promise.all(n).then(()=>r);return r}});var Ih=w("$ZodEnum",(e,t)=>{ae.init(e,t);let r=Wa(t.entries),o=new Set(r);e._zod.values=o,e._zod.pattern=new RegExp(`^(${r.filter((s)=>Op.has(typeof s)).map((s)=>typeof s==="string"?ur(s):s.toString()).join("|")})$`),e._zod.parse=(s,n)=>{let i=s.value;if(o.has(i))return s;return s.issues.push({code:"invalid_value",values:r,input:i,inst:e}),s}}),qh=w("$ZodLiteral",(e,t)=>{if(ae.init(e,t),t.values.length===0)throw Error("Cannot create literal schema with no valid values");let r=new Set(t.values);e._zod.values=r,e._zod.pattern=new RegExp(`^(${t.values.map((o)=>typeof o==="string"?ur(o):o?ur(o.toString()):String(o)).join("|")})$`),e._zod.parse=(o,s)=>{let n=o.value;if(r.has(n))return o;return o.issues.push({code:"invalid_value",values:t.values,input:n,inst:e}),o}});var Oh=w("$ZodTransform",(e,t)=>{ae.init(e,t),e._zod.optin="optional",e._zod.parse=(r,o)=>{if(o.direction==="backward")throw new dn(e.constructor.name);let s=t.transform(r.value,r);if(o.async)return(s instanceof Promise?s:Promise.resolve(s)).then((i)=>(r.value=i,r.fallback=!0,r));if(s instanceof Promise)throw new Ft;return r.value=s,r.fallback=!0,r}});function Hm(e,t){if(t===void 0&&(e.issues.length||e.fallback))return{issues:[],value:void 0};return e}var Xu=w("$ZodOptional",(e,t)=>{ae.init(e,t),e._zod.optin="optional",e._zod.optout="optional",oe(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),oe(e._zod,"pattern",()=>{let r=t.innerType._zod.pattern;return r?new RegExp(`^(${Ga(r.source)})?$`):void 0}),e._zod.parse=(r,o)=>{if(t.innerType._zod.optin==="optional"){let s=r.value,n=t.innerType._zod.run(r,o);if(n instanceof Promise)return n.then((i)=>Hm(i,s));return Hm(n,s)}if(r.value===void 0)return r;return t.innerType._zod.run(r,o)}}),Nh=w("$ZodExactOptional",(e,t)=>{Xu.init(e,t),oe(e._zod,"values",()=>t.innerType._zod.values),oe(e._zod,"pattern",()=>t.innerType._zod.pattern),e._zod.parse=(r,o)=>t.innerType._zod.run(r,o)}),jh=w("$ZodNullable",(e,t)=>{ae.init(e,t),oe(e._zod,"optin",()=>t.innerType._zod.optin),oe(e._zod,"optout",()=>t.innerType._zod.optout),oe(e._zod,"pattern",()=>{let r=t.innerType._zod.pattern;return r?new RegExp(`^(${Ga(r.source)}|null)$`):void 0}),oe(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(r,o)=>{if(r.value===null)return r;return t.innerType._zod.run(r,o)}}),Mh=w("$ZodDefault",(e,t)=>{ae.init(e,t),e._zod.optin="optional",oe(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,o)=>{if(o.direction==="backward")return t.innerType._zod.run(r,o);if(r.value===void 0)return r.value=t.defaultValue,r;let s=t.innerType._zod.run(r,o);if(s instanceof Promise)return s.then((n)=>Fm(n,t));return Fm(s,t)}});function Fm(e,t){if(e.value===void 0)e.value=t.defaultValue;return e}var Ah=w("$ZodPrefault",(e,t)=>{ae.init(e,t),e._zod.optin="optional",oe(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,o)=>{if(o.direction==="backward")return t.innerType._zod.run(r,o);if(r.value===void 0)r.value=t.defaultValue;return t.innerType._zod.run(r,o)}}),Lh=w("$ZodNonOptional",(e,t)=>{ae.init(e,t),oe(e._zod,"values",()=>{let r=t.innerType._zod.values;return r?new Set([...r].filter((o)=>o!==void 0)):void 0}),e._zod.parse=(r,o)=>{let s=t.innerType._zod.run(r,o);if(s instanceof Promise)return s.then((n)=>Vm(n,e));return Vm(s,e)}});function Vm(e,t){if(!e.issues.length&&e.value===void 0)e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t});return e}var Uh=w("$ZodCatch",(e,t)=>{ae.init(e,t),e._zod.optin="optional",oe(e._zod,"optout",()=>t.innerType._zod.optout),oe(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,o)=>{if(o.direction==="backward")return t.innerType._zod.run(r,o);let s=t.innerType._zod.run(r,o);if(s instanceof Promise)return s.then((n)=>{if(r.value=n.value,n.issues.length)r.value=t.catchValue({...r,error:{issues:n.issues.map((i)=>ft(i,o,Je()))},input:r.value}),r.issues=[],r.fallback=!0;return r});if(r.value=s.value,s.issues.length)r.value=t.catchValue({...r,error:{issues:s.issues.map((n)=>ft(n,o,Je()))},input:r.value}),r.issues=[],r.fallback=!0;return r}});var Qu=w("$ZodPipe",(e,t)=>{ae.init(e,t),oe(e._zod,"values",()=>t.in._zod.values),oe(e._zod,"optin",()=>t.in._zod.optin),oe(e._zod,"optout",()=>t.out._zod.optout),oe(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(r,o)=>{if(o.direction==="backward"){let n=t.out._zod.run(r,o);if(n instanceof Promise)return n.then((i)=>tc(i,t.in,o));return tc(n,t.in,o)}let s=t.in._zod.run(r,o);if(s instanceof Promise)return s.then((n)=>tc(n,t.out,o));return tc(s,t.out,o)}});function tc(e,t,r){if(e.issues.length)return e.aborted=!0,e;return t._zod.run({value:e.value,issues:e.issues,fallback:e.fallback},r)}var Dh=w("$ZodPreprocess",(e,t)=>{Qu.init(e,t)}),Zh=w("$ZodReadonly",(e,t)=>{ae.init(e,t),oe(e._zod,"propValues",()=>t.innerType._zod.propValues),oe(e._zod,"values",()=>t.innerType._zod.values),oe(e._zod,"optin",()=>t.innerType?._zod?.optin),oe(e._zod,"optout",()=>t.innerType?._zod?.optout),e._zod.parse=(r,o)=>{if(o.direction==="backward")return t.innerType._zod.run(r,o);let s=t.innerType._zod.run(r,o);if(s instanceof Promise)return s.then(Bm);return Bm(s)}});function Bm(e){return e.value=Object.freeze(e.value),e}var Hh=w("$ZodLazy",(e,t)=>{ae.init(e,t),oe(e._zod,"innerType",()=>{let r=t;if(!r._cachedInner)r._cachedInner=t.getter();return r._cachedInner}),oe(e._zod,"pattern",()=>e._zod.innerType?._zod?.pattern),oe(e._zod,"propValues",()=>e._zod.innerType?._zod?.propValues),oe(e._zod,"optin",()=>e._zod.innerType?._zod?.optin??void 0),oe(e._zod,"optout",()=>e._zod.innerType?._zod?.optout??void 0),e._zod.parse=(r,o)=>e._zod.innerType._zod.run(r,o)}),Fh=w("$ZodCustom",(e,t)=>{Ie.init(e,t),ae.init(e,t),e._zod.parse=(r,o)=>r,e._zod.check=(r)=>{let o=r.value,s=t.fn(o);if(s instanceof Promise)return s.then((n)=>Jm(n,r,o,e));Jm(s,r,o,e);return}});function Jm(e,t,r,o){if(!e){let s={code:"custom",input:r,inst:o,path:[...o._zod.def.path??[]],continue:!o._zod.def.abort};if(o._zod.def.params)s.params=o._zod.def.params;t.issues.push(Br(s))}}var jb=()=>{let e={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"},map:{unit:"entries",verb:"to have"}};function t(s){return e[s]??null}let r={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",mac:"MAC address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",jwt:"JWT",template_literal:"input"},o={nan:"NaN"};return(s)=>{switch(s.code){case"invalid_type":{let n=o[s.expected]??s.expected,i=Ap(s.input),a=o[i]??i;return`Invalid input: expected ${n}, received ${a}`}case"invalid_value":if(s.values.length===1)return`Invalid input: expected ${Lu(s.values[0])}`;return`Invalid option: expected one of ${Nu(s.values,"|")}`;case"too_big":{let n=s.inclusive?"<=":"<",i=t(s.origin);if(i)return`Too big: expected ${s.origin??"value"} to have ${n}${s.maximum.toString()} ${i.unit??"elements"}`;return`Too big: expected ${s.origin??"value"} to be ${n}${s.maximum.toString()}`}case"too_small":{let n=s.inclusive?">=":">",i=t(s.origin);if(i)return`Too small: expected ${s.origin} to have ${n}${s.minimum.toString()} ${i.unit}`;return`Too small: expected ${s.origin} to be ${n}${s.minimum.toString()}`}case"invalid_format":{let n=s;if(n.format==="starts_with")return`Invalid string: must start with "${n.prefix}"`;if(n.format==="ends_with")return`Invalid string: must end with "${n.suffix}"`;if(n.format==="includes")return`Invalid string: must include "${n.includes}"`;if(n.format==="regex")return`Invalid string: must match pattern ${n.pattern}`;return`Invalid ${r[n.format]??s.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${s.divisor}`;case"unrecognized_keys":return`Unrecognized key${s.keys.length>1?"s":""}: ${Nu(s.keys,", ")}`;case"invalid_key":return`Invalid key in ${s.origin}`;case"invalid_union":if(s.options&&Array.isArray(s.options)&&s.options.length>0)return`Invalid discriminator value. Expected ${s.options.map((i)=>`'${i}'`).join(" | ")}`;return"Invalid input";case"invalid_element":return`Invalid value in ${s.origin}`;default:return"Invalid input"}}};function el(){return{localeError:jb()}}var Vh,Mb=Symbol("ZodOutput"),Ab=Symbol("ZodInput");class Bh{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){let r=t[0];if(this._map.set(e,r),r&&typeof r==="object"&&"id"in r)this._idmap.set(r.id,e);return this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let t=this._map.get(e);if(t&&typeof t==="object"&&"id"in t)this._idmap.delete(t.id);return this._map.delete(e),this}get(e){let t=e._zod.parent;if(t){let r={...this.get(t)??{}};delete r.id;let o={...r,...this._map.get(e)};return Object.keys(o).length?o:void 0}return this._map.get(e)}has(e){return this._map.has(e)}}function Jh(){return new Bh}(Vh=globalThis).__zod_globalRegistry??(Vh.__zod_globalRegistry=Jh());var dr=globalThis.__zod_globalRegistry;function Wh(e,t){return new e({type:"string",...H(t)})}function tl(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...H(t)})}function rl(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...H(t)})}function Kh(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...H(t)})}function Gh(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...H(t)})}function Yh(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...H(t)})}function Xh(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...H(t)})}function ol(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...H(t)})}function Qh(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...H(t)})}function ef(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...H(t)})}function tf(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...H(t)})}function rf(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...H(t)})}function of(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...H(t)})}function sf(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...H(t)})}function nf(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...H(t)})}function af(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...H(t)})}function cf(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...H(t)})}function uf(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...H(t)})}function lf(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...H(t)})}function df(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...H(t)})}function pf(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...H(t)})}function mf(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...H(t)})}function hf(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...H(t)})}function ff(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...H(t)})}function _f(e,t){return new e({type:"string",format:"date",check:"string_format",...H(t)})}function gf(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...H(t)})}function Sf(e,t){return new e({type:"string",format:"duration",check:"string_format",...H(t)})}function vf(e,t){return new e({type:"number",checks:[],...H(t)})}function bf(e,t){return new e({type:"number",coerce:!0,checks:[],...H(t)})}function yf(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...H(t)})}function wf(e,t){return new e({type:"boolean",...H(t)})}function zf(e,t){return new e({type:"undefined",...H(t)})}function Rf(e,t){return new e({type:"null",...H(t)})}function xf(e){return new e({type:"any"})}function kf(e){return new e({type:"unknown"})}function Pf(e,t){return new e({type:"never",...H(t)})}function sc(e,t){return new Bu({check:"less_than",...H(t),value:e,inclusive:!1})}function Sn(e,t){return new Bu({check:"less_than",...H(t),value:e,inclusive:!0})}function nc(e,t){return new Ju({check:"greater_than",...H(t),value:e,inclusive:!1})}function vn(e,t){return new Ju({check:"greater_than",...H(t),value:e,inclusive:!0})}function ic(e,t){return new km({check:"multiple_of",...H(t),value:e})}function ac(e,t){return new Tm({check:"max_length",...H(t),maximum:e})}function Mo(e,t){return new Em({check:"min_length",...H(t),minimum:e})}function cc(e,t){return new $m({check:"length_equals",...H(t),length:e})}function sl(e,t){return new Cm({check:"string_format",format:"regex",...H(t),pattern:e})}function nl(e){return new Im({check:"string_format",format:"lowercase",...H(e)})}function il(e){return new qm({check:"string_format",format:"uppercase",...H(e)})}function al(e,t){return new Om({check:"string_format",format:"includes",...H(t),includes:e})}function cl(e,t){return new Nm({check:"string_format",format:"starts_with",...H(t),prefix:e})}function ul(e,t){return new jm({check:"string_format",format:"ends_with",...H(t),suffix:e})}function pr(e){return new Mm({check:"overwrite",tx:e})}function ll(e){return pr((t)=>t.normalize(e))}function dl(){return pr((e)=>e.trim())}function pl(){return pr((e)=>e.toLowerCase())}function ml(){return pr((e)=>e.toUpperCase())}function hl(){return pr((e)=>Ip(e))}function Tf(e,t,r){return new e({type:"array",element:t,...H(r)})}function Ef(e,t,r){return new e({type:"custom",check:"custom",fn:t,...H(r)})}function $f(e,t){let r=Lb((o)=>(o.addIssue=(s)=>{if(typeof s==="string")o.issues.push(Br(s,o.value,r._zod.def));else{let n=s;if(n.fatal)n.continue=!1;n.code??(n.code="custom"),n.input??(n.input=o.value),n.inst??(n.inst=r),n.continue??(n.continue=!r._zod.def.abort),o.issues.push(Br(n))}},e(o.value,o)),t);return r}function Lb(e,t){let r=new Ie({check:"custom",...H(t)});return r._zod.check=e,r}function yn(e){let t=e?.target??"draft-2020-12";if(t==="draft-4")t="draft-04";if(t==="draft-7")t="draft-07";return{processors:e.processors??{},metadataRegistry:e?.metadata??dr,target:t,unrepresentable:e?.unrepresentable??"throw",override:e?.override??(()=>{}),io:e?.io??"output",counter:0,seen:new Map,cycles:e?.cycles??"ref",reused:e?.reused??"inline",external:e?.external??void 0}}function ce(e,t,r={path:[],schemaPath:[]}){var o;let s=e._zod.def,n=t.seen.get(e);if(n){if(n.count++,r.schemaPath.includes(e))n.cycle=r.path;return n.schema}let i={schema:{},count:1,cycle:void 0,path:r.path};t.seen.set(e,i);let a=e._zod.toJSONSchema?.();if(a)i.schema=a;else{let d={...r,schemaPath:[...r.schemaPath,e],path:r.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,i.schema,d);else{let h=i.schema,g=t.processors[s.type];if(!g)throw Error(`[toJSONSchema]: Non-representable type encountered: ${s.type}`);g(e,t,h,d)}let f=e._zod.parent;if(f){if(!i.ref)i.ref=f;ce(f,t,d),t.seen.get(f).isParent=!0}}let c=t.metadataRegistry.get(e);if(c)Object.assign(i.schema,c);if(t.io==="input"&&He(e))delete i.schema.examples,delete i.schema.default;if(t.io==="input"&&"_prefault"in i.schema)(o=i.schema).default??(o.default=i.schema._prefault);return delete i.schema._prefault,t.seen.get(e).schema}function wn(e,t){let r=e.seen.get(t);if(!r)throw Error("Unprocessed schema. This is a bug in Zod.");let o=new Map;for(let i of e.seen.entries()){let a=e.metadataRegistry.get(i[0])?.id;if(a){let c=o.get(a);if(c&&c!==i[0])throw Error(`Duplicate schema id "${a}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);o.set(a,i[0])}}let s=(i)=>{let a=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){let f=e.external.registry.get(i[0])?.id,h=e.external.uri??((v)=>v);if(f)return{ref:h(f)};let g=i[1].defId??i[1].schema.id??`schema${e.counter++}`;return i[1].defId=g,{defId:g,ref:`${h("__shared")}#/${a}/${g}`}}if(i[1]===r)return{ref:"#"};let l=`${"#"}/${a}/`,d=i[1].schema.id??`__schema${e.counter++}`;return{defId:d,ref:l+d}},n=(i)=>{if(i[1].schema.$ref)return;let a=i[1],{ref:c,defId:l}=s(i);if(a.def={...a.schema},l)a.defId=l;let d=a.schema;for(let f in d)delete d[f];d.$ref=c};if(e.cycles==="throw")for(let i of e.seen.entries()){let a=i[1];if(a.cycle)throw Error(`Cycle detected: #/${a.cycle?.join("/")}/<root>
64
64
 
65
- Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let i of e.seen.entries()){let a=i[1];if(t===i[0]){n(i);continue}if(e.external){let l=e.external.registry.get(i[0])?.id;if(t!==i[0]&&l){n(i);continue}}if(e.metadataRegistry.get(i[0])?.id){n(i);continue}if(a.cycle){n(i);continue}if(a.count>1){if(e.reused==="ref"){n(i);continue}}}}function vn(e,t){let r=e.seen.get(t);if(!r)throw Error("Unprocessed schema. This is a bug in Zod.");let o=(a)=>{let c=e.seen.get(a);if(c.ref===null)return;let l=c.def??c.schema,d={...l},f=c.ref;if(c.ref=null,f){o(f);let g=e.seen.get(f),b=g.schema;if(b.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0"))l.allOf=l.allOf??[],l.allOf.push(b);else Object.assign(l,b);if(Object.assign(l,d),a._zod.parent===f)for(let w in l){if(w==="$ref"||w==="allOf")continue;if(!(w in d))delete l[w]}if(b.$ref&&g.def)for(let w in l){if(w==="$ref"||w==="allOf")continue;if(w in g.def&&JSON.stringify(l[w])===JSON.stringify(g.def[w]))delete l[w]}}let h=a._zod.parent;if(h&&h!==f){o(h);let g=e.seen.get(h);if(g?.schema.$ref){if(l.$ref=g.schema.$ref,g.def)for(let b in l){if(b==="$ref"||b==="allOf")continue;if(b in g.def&&JSON.stringify(l[b])===JSON.stringify(g.def[b]))delete l[b]}}}e.override({zodSchema:a,jsonSchema:l,path:c.path??[]})};for(let a of[...e.seen.entries()].reverse())o(a[0]);let s={};if(e.target==="draft-2020-12")s.$schema="https://json-schema.org/draft/2020-12/schema";else if(e.target==="draft-07")s.$schema="http://json-schema.org/draft-07/schema#";else if(e.target==="draft-04")s.$schema="http://json-schema.org/draft-04/schema#";else if(e.target==="openapi-3.0");if(e.external?.uri){let a=e.external.registry.get(t)?.id;if(!a)throw Error("Schema is missing an `id` property");s.$id=e.external.uri(a)}Object.assign(s,r.def??r.schema);let n=e.metadataRegistry.get(t)?.id;if(n!==void 0&&s.id===n)delete s.id;let i=e.external?.defs??{};for(let a of e.seen.entries()){let c=a[1];if(c.def&&c.defId){if(c.def.id===c.defId)delete c.def.id;i[c.defId]=c.def}}if(e.external);else if(Object.keys(i).length>0)if(e.target==="draft-2020-12")s.$defs=i;else s.definitions=i;try{let a=JSON.parse(JSON.stringify(s));return Object.defineProperty(a,"~standard",{value:{...t["~standard"],jsonSchema:{input:_n(t,"input",e.processors),output:_n(t,"output",e.processors)}},enumerable:!1,writable:!1}),a}catch(a){throw Error("Error converting schema to JSON.")}}function He(e,t){let r=t??{seen:new Set};if(r.seen.has(e))return!1;r.seen.add(e);let o=e._zod.def;if(o.type==="transform")return!0;if(o.type==="array")return He(o.element,r);if(o.type==="set")return He(o.valueType,r);if(o.type==="lazy")return He(o.getter(),r);if(o.type==="promise"||o.type==="optional"||o.type==="nonoptional"||o.type==="nullable"||o.type==="readonly"||o.type==="default"||o.type==="prefault")return He(o.innerType,r);if(o.type==="intersection")return He(o.left,r)||He(o.right,r);if(o.type==="record"||o.type==="map")return He(o.keyType,r)||He(o.valueType,r);if(o.type==="pipe"){if(e._zod.traits.has("$ZodCodec"))return!0;return He(o.in,r)||He(o.out,r)}if(o.type==="object"){for(let s in o.shape)if(He(o.shape[s],r))return!0;return!1}if(o.type==="union"){for(let s of o.options)if(He(s,r))return!0;return!1}if(o.type==="tuple"){for(let s of o.items)if(He(s,r))return!0;if(o.rest&&He(o.rest,r))return!0;return!1}return!1}var kf=(e,t={})=>(r)=>{let o=gn({...r,processors:t});return ce(e,o),Sn(o,e),vn(o,e)},_n=(e,t,r={})=>(o)=>{let{libraryOptions:s,target:n}=o??{},i=gn({...s??{},target:n,io:t,processors:r});return ce(e,i),Sn(i,e),vn(i,e)};var Ib={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},dl=(e,t,r,o)=>{let s=r;s.type="string";let{minimum:n,maximum:i,format:a,patterns:c,contentEncoding:l}=e._zod.bag;if(typeof n==="number")s.minLength=n;if(typeof i==="number")s.maxLength=i;if(a){if(s.format=Ib[a]??a,s.format==="")delete s.format;if(a==="time")delete s.format}if(l)s.contentEncoding=l;if(c&&c.size>0){let d=[...c];if(d.length===1)s.pattern=d[0].source;else if(d.length>1)s.allOf=[...d.map((f)=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:f.source}))]}},ml=(e,t,r,o)=>{let s=r,{minimum:n,maximum:i,format:a,multipleOf:c,exclusiveMaximum:l,exclusiveMinimum:d}=e._zod.bag;if(typeof a==="string"&&a.includes("int"))s.type="integer";else s.type="number";let f=typeof d==="number"&&d>=(n??Number.NEGATIVE_INFINITY),h=typeof l==="number"&&l<=(i??Number.POSITIVE_INFINITY),g=t.target==="draft-04"||t.target==="openapi-3.0";if(f)if(g)s.minimum=d,s.exclusiveMinimum=!0;else s.exclusiveMinimum=d;else if(typeof n==="number")s.minimum=n;if(h)if(g)s.maximum=l,s.exclusiveMaximum=!0;else s.exclusiveMaximum=l;else if(typeof i==="number")s.maximum=i;if(typeof c==="number")s.multipleOf=c},pl=(e,t,r,o)=>{r.type="boolean"},Tf=(e,t,r,o)=>{if(t.unrepresentable==="throw")throw Error("BigInt cannot be represented in JSON Schema")},Ef=(e,t,r,o)=>{if(t.unrepresentable==="throw")throw Error("Symbols cannot be represented in JSON Schema")},hl=(e,t,r,o)=>{if(t.target==="openapi-3.0")r.type="string",r.nullable=!0,r.enum=[null];else r.type="null"},fl=(e,t,r,o)=>{if(t.unrepresentable==="throw")throw Error("Undefined cannot be represented in JSON Schema")},$f=(e,t,r,o)=>{if(t.unrepresentable==="throw")throw Error("Void cannot be represented in JSON Schema")},_l=(e,t,r,o)=>{r.not={}},gl=(e,t,r,o)=>{},Sl=(e,t,r,o)=>{},Cf=(e,t,r,o)=>{if(t.unrepresentable==="throw")throw Error("Date cannot be represented in JSON Schema")},vl=(e,t,r,o)=>{let s=e._zod.def,n=Va(s.entries);if(n.every((i)=>typeof i==="number"))r.type="number";if(n.every((i)=>typeof i==="string"))r.type="string";r.enum=n},bl=(e,t,r,o)=>{let s=e._zod.def,n=[];for(let i of s.values)if(i===void 0){if(t.unrepresentable==="throw")throw Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof i==="bigint")if(t.unrepresentable==="throw")throw Error("BigInt literals cannot be represented in JSON Schema");else n.push(Number(i));else n.push(i);if(n.length===0);else if(n.length===1){let i=n[0];if(r.type=i===null?"null":typeof i,t.target==="draft-04"||t.target==="openapi-3.0")r.enum=[i];else r.const=i}else{if(n.every((i)=>typeof i==="number"))r.type="number";if(n.every((i)=>typeof i==="string"))r.type="string";if(n.every((i)=>typeof i==="boolean"))r.type="boolean";if(n.every((i)=>i===null))r.type="null";r.enum=n}},If=(e,t,r,o)=>{if(t.unrepresentable==="throw")throw Error("NaN cannot be represented in JSON Schema")},qf=(e,t,r,o)=>{let s=r,n=e._zod.pattern;if(!n)throw Error("Pattern not found in template literal");s.type="string",s.pattern=n.source},Of=(e,t,r,o)=>{let s=r,n={type:"string",format:"binary",contentEncoding:"binary"},{minimum:i,maximum:a,mime:c}=e._zod.bag;if(i!==void 0)n.minLength=i;if(a!==void 0)n.maxLength=a;if(c)if(c.length===1)n.contentMediaType=c[0],Object.assign(s,n);else Object.assign(s,n),s.anyOf=c.map((l)=>({contentMediaType:l}));else Object.assign(s,n)},Nf=(e,t,r,o)=>{r.type="boolean"},yl=(e,t,r,o)=>{if(t.unrepresentable==="throw")throw Error("Custom types cannot be represented in JSON Schema")},jf=(e,t,r,o)=>{if(t.unrepresentable==="throw")throw Error("Function types cannot be represented in JSON Schema")},wl=(e,t,r,o)=>{if(t.unrepresentable==="throw")throw Error("Transforms cannot be represented in JSON Schema")},Mf=(e,t,r,o)=>{if(t.unrepresentable==="throw")throw Error("Map cannot be represented in JSON Schema")},Af=(e,t,r,o)=>{if(t.unrepresentable==="throw")throw Error("Set cannot be represented in JSON Schema")},zl=(e,t,r,o)=>{let s=r,n=e._zod.def,{minimum:i,maximum:a}=e._zod.bag;if(typeof i==="number")s.minItems=i;if(typeof a==="number")s.maxItems=a;s.type="array",s.items=ce(n.element,t,{...o,path:[...o.path,"items"]})},Rl=(e,t,r,o)=>{let s=r,n=e._zod.def;s.type="object",s.properties={};let i=n.shape;for(let l in i)s.properties[l]=ce(i[l],t,{...o,path:[...o.path,"properties",l]});let a=new Set(Object.keys(i)),c=new Set([...a].filter((l)=>{let d=n.shape[l]._zod;if(t.io==="input")return d.optin===void 0;else return d.optout===void 0}));if(c.size>0)s.required=Array.from(c);if(n.catchall?._zod.def.type==="never")s.additionalProperties=!1;else if(!n.catchall){if(t.io==="output")s.additionalProperties=!1}else if(n.catchall)s.additionalProperties=ce(n.catchall,t,{...o,path:[...o.path,"additionalProperties"]})},xl=(e,t,r,o)=>{let s=e._zod.def,n=s.inclusive===!1,i=s.options.map((a,c)=>ce(a,t,{...o,path:[...o.path,n?"oneOf":"anyOf",c]}));if(n)r.oneOf=i;else r.anyOf=i},kl=(e,t,r,o)=>{let s=e._zod.def,n=ce(s.left,t,{...o,path:[...o.path,"allOf",0]}),i=ce(s.right,t,{...o,path:[...o.path,"allOf",1]}),a=(l)=>("allOf"in l)&&Object.keys(l).length===1,c=[...a(n)?n.allOf:[n],...a(i)?i.allOf:[i]];r.allOf=c},Lf=(e,t,r,o)=>{let s=r,n=e._zod.def;s.type="array";let i=t.target==="draft-2020-12"?"prefixItems":"items",a=t.target==="draft-2020-12"?"items":t.target==="openapi-3.0"?"items":"additionalItems",c=n.items.map((h,g)=>ce(h,t,{...o,path:[...o.path,i,g]})),l=n.rest?ce(n.rest,t,{...o,path:[...o.path,a,...t.target==="openapi-3.0"?[n.items.length]:[]]}):null;if(t.target==="draft-2020-12"){if(s.prefixItems=c,l)s.items=l}else if(t.target==="openapi-3.0"){if(s.items={anyOf:c},l)s.items.anyOf.push(l);if(s.minItems=c.length,!l)s.maxItems=c.length}else if(s.items=c,l)s.additionalItems=l;let{minimum:d,maximum:f}=e._zod.bag;if(typeof d==="number")s.minItems=d;if(typeof f==="number")s.maxItems=f},Pl=(e,t,r,o)=>{let s=r,n=e._zod.def;s.type="object";let i=n.keyType,c=i._zod.bag?.patterns;if(n.mode==="loose"&&c&&c.size>0){let d=ce(n.valueType,t,{...o,path:[...o.path,"patternProperties","*"]});s.patternProperties={};for(let f of c)s.patternProperties[f.source]=d}else{if(t.target==="draft-07"||t.target==="draft-2020-12")s.propertyNames=ce(n.keyType,t,{...o,path:[...o.path,"propertyNames"]});s.additionalProperties=ce(n.valueType,t,{...o,path:[...o.path,"additionalProperties"]})}let l=i._zod.values;if(l){let d=[...l].filter((f)=>typeof f==="string"||typeof f==="number");if(d.length>0)s.required=d}},Tl=(e,t,r,o)=>{let s=e._zod.def,n=ce(s.innerType,t,o),i=t.seen.get(e);if(t.target==="openapi-3.0")i.ref=s.innerType,r.nullable=!0;else r.anyOf=[n,{type:"null"}]},El=(e,t,r,o)=>{let s=e._zod.def;ce(s.innerType,t,o);let n=t.seen.get(e);n.ref=s.innerType},$l=(e,t,r,o)=>{let s=e._zod.def;ce(s.innerType,t,o);let n=t.seen.get(e);n.ref=s.innerType,r.default=JSON.parse(JSON.stringify(s.defaultValue))},Cl=(e,t,r,o)=>{let s=e._zod.def;ce(s.innerType,t,o);let n=t.seen.get(e);if(n.ref=s.innerType,t.io==="input")r._prefault=JSON.parse(JSON.stringify(s.defaultValue))},Il=(e,t,r,o)=>{let s=e._zod.def;ce(s.innerType,t,o);let n=t.seen.get(e);n.ref=s.innerType;let i;try{i=s.catchValue(void 0)}catch{throw Error("Dynamic catch values are not supported in JSON Schema")}r.default=i},ql=(e,t,r,o)=>{let s=e._zod.def,n=s.in._zod.traits.has("$ZodTransform"),i=t.io==="input"?n?s.out:s.in:s.out;ce(i,t,o);let a=t.seen.get(e);a.ref=i},Ol=(e,t,r,o)=>{let s=e._zod.def;ce(s.innerType,t,o);let n=t.seen.get(e);n.ref=s.innerType,r.readOnly=!0},Uf=(e,t,r,o)=>{let s=e._zod.def;ce(s.innerType,t,o);let n=t.seen.get(e);n.ref=s.innerType},ic=(e,t,r,o)=>{let s=e._zod.def;ce(s.innerType,t,o);let n=t.seen.get(e);n.ref=s.innerType},Nl=(e,t,r,o)=>{let s=e._zod.innerType;ce(s,t,o);let n=t.seen.get(e);n.ref=s},Pf={string:dl,number:ml,boolean:pl,bigint:Tf,symbol:Ef,null:hl,undefined:fl,void:$f,never:_l,any:gl,unknown:Sl,date:Cf,enum:vl,literal:bl,nan:If,template_literal:qf,file:Of,success:Nf,custom:yl,function:jf,transform:wl,map:Mf,set:Af,array:zl,object:Rl,union:xl,intersection:kl,tuple:Lf,record:Pl,nullable:Tl,nonoptional:El,default:$l,prefault:Cl,catch:Il,pipe:ql,readonly:Ol,promise:Uf,optional:ic,lazy:Nl};function ac(e,t){if("_idmap"in e){let o=e,s=gn({...t,processors:Pf}),n={};for(let c of o._idmap.entries()){let[l,d]=c;ce(d,s)}let i={},a={registry:o,uri:t?.uri,defs:n};s.external=a;for(let c of o._idmap.entries()){let[l,d]=c;Sn(s,d),i[l]=vn(s,d)}if(Object.keys(n).length>0){let c=s.target==="draft-2020-12"?"$defs":"definitions";i.__shared={[c]:n}}return{schemas:i}}let r=gn({...t,processors:Pf});return ce(e,r),Sn(r,e),vn(r,e)}var Ub=y("ZodISODateTime",(e,t)=>{eh.init(e,t),he.init(e,t)});function Ao(e){return lf(Ub,e)}var Db=y("ZodISODate",(e,t)=>{th.init(e,t),he.init(e,t)});function jl(e){return df(Db,e)}var Zb=y("ZodISOTime",(e,t)=>{rh.init(e,t),he.init(e,t)});function Df(e){return mf(Zb,e)}var Hb=y("ZodISODuration",(e,t)=>{oh.init(e,t),he.init(e,t)});function Zf(e){return pf(Hb,e)}var Fb=(e,t)=>{Ka.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:(r)=>Au(e,r)},flatten:{value:(r)=>Mu(e,r)},addIssue:{value:(r)=>{e.issues.push(r),e.message=JSON.stringify(e.issues,cn,2)}},addIssues:{value:(r)=>{e.issues.push(...r),e.message=JSON.stringify(e.issues,cn,2)}},isEmpty:{get(){return e.issues.length===0}}})};var tt=y("ZodError",Fb,{Parent:Error});var Ff=Ga(tt),Vf=Ya(tt),uc=ln(tt),Bf=dn(tt),Jf=Mm(tt),Wf=Am(tt),Kf=Lm(tt),Gf=Um(tt),Yf=Dm(tt),Xf=Zm(tt),Qf=Hm(tt),e_=Fm(tt);var t_=new WeakMap;function bn(e,t,r){let o=Object.getPrototypeOf(e),s=t_.get(o);if(!s)s=new Set,t_.set(o,s);if(s.has(t))return;s.add(t);for(let n in r){let i=r[n];Object.defineProperty(o,n,{configurable:!0,enumerable:!1,get(){let a=i.bind(this);return Object.defineProperty(this,n,{configurable:!0,writable:!0,enumerable:!0,value:a}),a},set(a){Object.defineProperty(this,n,{configurable:!0,writable:!0,enumerable:!0,value:a})}})}}var ue=y("ZodType",(e,t)=>(ae.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:_n(e,"input"),output:_n(e,"output")}}),e.toJSONSchema=kf(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.parse=(r,o)=>Ff(e,r,o,{callee:e.parse}),e.safeParse=(r,o)=>uc(e,r,o),e.parseAsync=async(r,o)=>Vf(e,r,o,{callee:e.parseAsync}),e.safeParseAsync=async(r,o)=>Bf(e,r,o),e.spa=e.safeParseAsync,e.encode=(r,o)=>Jf(e,r,o),e.decode=(r,o)=>Wf(e,r,o),e.encodeAsync=async(r,o)=>Kf(e,r,o),e.decodeAsync=async(r,o)=>Gf(e,r,o),e.safeEncode=(r,o)=>Yf(e,r,o),e.safeDecode=(r,o)=>Xf(e,r,o),e.safeEncodeAsync=async(r,o)=>Qf(e,r,o),e.safeDecodeAsync=async(r,o)=>e_(e,r,o),bn(e,"ZodType",{check(...r){let o=this.def;return this.clone(ar(o,{checks:[...o.checks??[],...r.map((s)=>typeof s==="function"?{_zod:{check:s,def:{check:"custom"},onattach:[]}}:s)]}),{parent:!0})},with(...r){return this.check(...r)},clone(r,o){return pt(this,r,o)},brand(){return this},register(r,o){return r.add(this,o),this},refine(r,o){return this.check(qy(r,o))},superRefine(r,o){return this.check(Oy(r,o))},overwrite(r){return this.check(dr(r))},optional(){return F(this)},exactOptional(){return vy(this)},nullable(){return n_(this)},nullish(){return F(n_(this))},nonoptional(r){return xy(this,r)},array(){return v(this)},or(r){return C([this,r])},and(r){return Ft(this,r)},transform(r){return i_(this,f_(r))},default(r){return wy(this,r)},prefault(r){return Ry(this,r)},catch(r){return Py(this,r)},pipe(r){return i_(this,r)},readonly(){return $y(this)},describe(r){let o=this.clone();return lr.add(o,{description:r}),o},meta(...r){if(r.length===0)return lr.get(this);let o=this.clone();return lr.add(o,r[0]),o},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(r){return r(this)}}),Object.defineProperty(e,"description",{get(){return lr.get(e)?.description},configurable:!0}),e)),a_=y("_ZodString",(e,t)=>{ec.init(e,t),ue.init(e,t),e._zod.processJSONSchema=(o,s,n)=>dl(e,o,s,n);let r=e._zod.bag;e.format=r.format??null,e.minLength=r.minimum??null,e.maxLength=r.maximum??null,bn(e,"_ZodString",{regex(...o){return this.check(el(...o))},includes(...o){return this.check(ol(...o))},startsWith(...o){return this.check(sl(...o))},endsWith(...o){return this.check(nl(...o))},min(...o){return this.check(jo(...o))},max(...o){return this.check(sc(...o))},length(...o){return this.check(nc(...o))},nonempty(...o){return this.check(jo(1,...o))},lowercase(o){return this.check(tl(o))},uppercase(o){return this.check(rl(o))},trim(){return this.check(al())},normalize(...o){return this.check(il(...o))},toLowerCase(){return this.check(cl())},toUpperCase(){return this.check(ul())},slugify(){return this.check(ll())}})}),c_=y("ZodString",(e,t)=>{ec.init(e,t),a_.init(e,t),e.email=(r)=>e.check(Yu(u_,r)),e.url=(r)=>e.check(Qu(d_,r)),e.jwt=(r)=>e.check(uf(iy,r)),e.emoji=(r)=>e.check(Wh(Bb,r)),e.guid=(r)=>e.check(Xu(r_,r)),e.uuid=(r)=>e.check(Fh(lc,r)),e.uuidv4=(r)=>e.check(Vh(lc,r)),e.uuidv6=(r)=>e.check(Bh(lc,r)),e.uuidv7=(r)=>e.check(Jh(lc,r)),e.nanoid=(r)=>e.check(Kh(Jb,r)),e.guid=(r)=>e.check(Xu(r_,r)),e.cuid=(r)=>e.check(Gh(Wb,r)),e.cuid2=(r)=>e.check(Yh(Kb,r)),e.ulid=(r)=>e.check(Xh(Gb,r)),e.base64=(r)=>e.check(nf(oy,r)),e.base64url=(r)=>e.check(af(sy,r)),e.xid=(r)=>e.check(Qh(Yb,r)),e.ksuid=(r)=>e.check(ef(Xb,r)),e.ipv4=(r)=>e.check(tf(Qb,r)),e.ipv6=(r)=>e.check(rf(ey,r)),e.cidrv4=(r)=>e.check(of(ty,r)),e.cidrv6=(r)=>e.check(sf(ry,r)),e.e164=(r)=>e.check(cf(ny,r)),e.datetime=(r)=>e.check(Ao(r)),e.date=(r)=>e.check(jl(r)),e.time=(r)=>e.check(Df(r)),e.duration=(r)=>e.check(Zf(r))});function u(e){return Hh(c_,e)}var he=y("ZodStringFormat",(e,t)=>{me.init(e,t),a_.init(e,t)}),u_=y("ZodEmail",(e,t)=>{Vp.init(e,t),he.init(e,t)});function l_(e){return Yu(u_,e)}var r_=y("ZodGUID",(e,t)=>{Hp.init(e,t),he.init(e,t)});var lc=y("ZodUUID",(e,t)=>{Fp.init(e,t),he.init(e,t)});var d_=y("ZodURL",(e,t)=>{Bp.init(e,t),he.init(e,t)});function dc(e){return Qu(d_,e)}var Bb=y("ZodEmoji",(e,t)=>{Jp.init(e,t),he.init(e,t)});var Jb=y("ZodNanoID",(e,t)=>{Wp.init(e,t),he.init(e,t)});var Wb=y("ZodCUID",(e,t)=>{Kp.init(e,t),he.init(e,t)});var Kb=y("ZodCUID2",(e,t)=>{Gp.init(e,t),he.init(e,t)});var Gb=y("ZodULID",(e,t)=>{Yp.init(e,t),he.init(e,t)});var Yb=y("ZodXID",(e,t)=>{Xp.init(e,t),he.init(e,t)});var Xb=y("ZodKSUID",(e,t)=>{Qp.init(e,t),he.init(e,t)});var Qb=y("ZodIPv4",(e,t)=>{sh.init(e,t),he.init(e,t)});var ey=y("ZodIPv6",(e,t)=>{nh.init(e,t),he.init(e,t)});var ty=y("ZodCIDRv4",(e,t)=>{ih.init(e,t),he.init(e,t)});var ry=y("ZodCIDRv6",(e,t)=>{ah.init(e,t),he.init(e,t)});var oy=y("ZodBase64",(e,t)=>{uh.init(e,t),he.init(e,t)});var sy=y("ZodBase64URL",(e,t)=>{lh.init(e,t),he.init(e,t)});var ny=y("ZodE164",(e,t)=>{dh.init(e,t),he.init(e,t)});var iy=y("ZodJWT",(e,t)=>{mh.init(e,t),he.init(e,t)});var mc=y("ZodNumber",(e,t)=>{Bu.init(e,t),ue.init(e,t),e._zod.processJSONSchema=(o,s,n)=>ml(e,o,s,n),bn(e,"ZodNumber",{gt(o,s){return this.check(rc(o,s))},gte(o,s){return this.check(fn(o,s))},min(o,s){return this.check(fn(o,s))},lt(o,s){return this.check(tc(o,s))},lte(o,s){return this.check(hn(o,s))},max(o,s){return this.check(hn(o,s))},int(o){return this.check(o_(o))},safe(o){return this.check(o_(o))},positive(o){return this.check(rc(0,o))},nonnegative(o){return this.check(fn(0,o))},negative(o){return this.check(tc(0,o))},nonpositive(o){return this.check(hn(0,o))},multipleOf(o,s){return this.check(oc(o,s))},step(o,s){return this.check(oc(o,s))},finite(){return this}});let r=e._zod.bag;e.minValue=Math.max(r.minimum??Number.NEGATIVE_INFINITY,r.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(r.maximum??Number.POSITIVE_INFINITY,r.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(r.format??"").includes("int")||Number.isSafeInteger(r.multipleOf??0.5),e.isFinite=!0,e.format=r.format??null});function k(e){return hf(mc,e)}var ay=y("ZodNumberFormat",(e,t)=>{ph.init(e,t),mc.init(e,t)});function o_(e){return _f(ay,e)}var m_=y("ZodBoolean",(e,t)=>{hh.init(e,t),ue.init(e,t),e._zod.processJSONSchema=(r,o,s)=>pl(e,r,o,s)});function E(e){return gf(m_,e)}var cy=y("ZodUndefined",(e,t)=>{fh.init(e,t),ue.init(e,t),e._zod.processJSONSchema=(r,o,s)=>fl(e,r,o,s)});function Al(e){return Sf(cy,e)}var uy=y("ZodNull",(e,t)=>{_h.init(e,t),ue.init(e,t),e._zod.processJSONSchema=(r,o,s)=>hl(e,r,o,s)});function Br(e){return vf(uy,e)}var ly=y("ZodAny",(e,t)=>{gh.init(e,t),ue.init(e,t),e._zod.processJSONSchema=(r,o,s)=>gl(e,r,o,s)});function pc(){return bf(ly)}var dy=y("ZodUnknown",(e,t)=>{Sh.init(e,t),ue.init(e,t),e._zod.processJSONSchema=(r,o,s)=>Sl(e,r,o,s)});function D(){return yf(dy)}var my=y("ZodNever",(e,t)=>{vh.init(e,t),ue.init(e,t),e._zod.processJSONSchema=(r,o,s)=>_l(e,r,o,s)});function Ll(e){return wf(my,e)}var py=y("ZodArray",(e,t)=>{bh.init(e,t),ue.init(e,t),e._zod.processJSONSchema=(r,o,s)=>zl(e,r,o,s),e.element=t.element,bn(e,"ZodArray",{min(r,o){return this.check(jo(r,o))},nonempty(r){return this.check(jo(1,r))},max(r,o){return this.check(sc(r,o))},length(r,o){return this.check(nc(r,o))},unwrap(){return this.element}})});function v(e,t){return zf(py,e,t)}var p_=y("ZodObject",(e,t)=>{zh.init(e,t),ue.init(e,t),e._zod.processJSONSchema=(r,o,s)=>Rl(e,r,o,s),oe(e,"shape",()=>t.shape),bn(e,"ZodObject",{keyof(){return Y(Object.keys(this._zod.def.shape))},catchall(r){return this.clone({...this._zod.def,catchall:r})},passthrough(){return this.clone({...this._zod.def,catchall:D()})},loose(){return this.clone({...this._zod.def,catchall:D()})},strict(){return this.clone({...this._zod.def,catchall:Ll()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(r){return Sb(this,r)},safeExtend(r){return vb(this,r)},merge(r){return bb(this,r)},pick(r){return _b(this,r)},omit(r){return gb(this,r)},partial(...r){return yb(__,this,r[0])},required(...r){return wb(g_,this,r[0])}})});function m(e,t){let r={type:"object",shape:e??{},...H(t)};return new p_(r)}function V(e,t){return new p_({type:"object",shape:e,catchall:D(),...H(t)})}var h_=y("ZodUnion",(e,t)=>{Ju.init(e,t),ue.init(e,t),e._zod.processJSONSchema=(r,o,s)=>xl(e,r,o,s),e.options=t.options});function C(e,t){return new h_({type:"union",options:e,...H(t)})}var hy=y("ZodDiscriminatedUnion",(e,t)=>{h_.init(e,t),Rh.init(e,t)});function Lo(e,t,r){return new hy({type:"union",options:t,discriminator:e,...H(r)})}var fy=y("ZodIntersection",(e,t)=>{xh.init(e,t),ue.init(e,t),e._zod.processJSONSchema=(r,o,s)=>kl(e,r,o,s)});function Ft(e,t){return new fy({type:"intersection",left:e,right:t})}var s_=y("ZodRecord",(e,t)=>{kh.init(e,t),ue.init(e,t),e._zod.processJSONSchema=(r,o,s)=>Pl(e,r,o,s),e.keyType=t.keyType,e.valueType=t.valueType});function T(e,t,r){if(!t||!t._zod)return new s_({type:"record",keyType:u(),valueType:e,...H(t)});return new s_({type:"record",keyType:e,valueType:t,...H(r)})}var Ml=y("ZodEnum",(e,t)=>{Ph.init(e,t),ue.init(e,t),e._zod.processJSONSchema=(o,s,n)=>vl(e,o,s,n),e.enum=t.entries,e.options=Object.values(t.entries);let r=new Set(Object.keys(t.entries));e.extract=(o,s)=>{let n={};for(let i of o)if(r.has(i))n[i]=t.entries[i];else throw Error(`Key ${i} not found in enum`);return new Ml({...t,checks:[],...H(s),entries:n})},e.exclude=(o,s)=>{let n={...t.entries};for(let i of o)if(r.has(i))delete n[i];else throw Error(`Key ${i} not found in enum`);return new Ml({...t,checks:[],...H(s),entries:n})}});function Y(e,t){let r=Array.isArray(e)?Object.fromEntries(e.map((o)=>[o,o])):e;return new Ml({type:"enum",entries:r,...H(t)})}var _y=y("ZodLiteral",(e,t)=>{Th.init(e,t),ue.init(e,t),e._zod.processJSONSchema=(r,o,s)=>bl(e,r,o,s),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function p(e,t){return new _y({type:"literal",values:Array.isArray(e)?e:[e],...H(t)})}var gy=y("ZodTransform",(e,t)=>{Eh.init(e,t),ue.init(e,t),e._zod.processJSONSchema=(r,o,s)=>wl(e,r,o,s),e._zod.parse=(r,o)=>{if(o.direction==="backward")throw new an(e.constructor.name);r.addIssue=(n)=>{if(typeof n==="string")r.issues.push(Vr(n,r.value,t));else{let i=n;if(i.fatal)i.continue=!1;i.code??(i.code="custom"),i.input??(i.input=r.value),i.inst??(i.inst=e),r.issues.push(Vr(i))}};let s=t.transform(r.value,r);if(s instanceof Promise)return s.then((n)=>(r.value=n,r.fallback=!0,r));return r.value=s,r.fallback=!0,r}});function f_(e){return new gy({type:"transform",transform:e})}var __=y("ZodOptional",(e,t)=>{Wu.init(e,t),ue.init(e,t),e._zod.processJSONSchema=(r,o,s)=>ic(e,r,o,s),e.unwrap=()=>e._zod.def.innerType});function F(e){return new __({type:"optional",innerType:e})}var Sy=y("ZodExactOptional",(e,t)=>{$h.init(e,t),ue.init(e,t),e._zod.processJSONSchema=(r,o,s)=>ic(e,r,o,s),e.unwrap=()=>e._zod.def.innerType});function vy(e){return new Sy({type:"optional",innerType:e})}var by=y("ZodNullable",(e,t)=>{Ch.init(e,t),ue.init(e,t),e._zod.processJSONSchema=(r,o,s)=>Tl(e,r,o,s),e.unwrap=()=>e._zod.def.innerType});function n_(e){return new by({type:"nullable",innerType:e})}var yy=y("ZodDefault",(e,t)=>{Ih.init(e,t),ue.init(e,t),e._zod.processJSONSchema=(r,o,s)=>$l(e,r,o,s),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function wy(e,t){return new yy({type:"default",innerType:e,get defaultValue(){return typeof t==="function"?t():Ou(t)}})}var zy=y("ZodPrefault",(e,t)=>{qh.init(e,t),ue.init(e,t),e._zod.processJSONSchema=(r,o,s)=>Cl(e,r,o,s),e.unwrap=()=>e._zod.def.innerType});function Ry(e,t){return new zy({type:"prefault",innerType:e,get defaultValue(){return typeof t==="function"?t():Ou(t)}})}var g_=y("ZodNonOptional",(e,t)=>{Oh.init(e,t),ue.init(e,t),e._zod.processJSONSchema=(r,o,s)=>El(e,r,o,s),e.unwrap=()=>e._zod.def.innerType});function xy(e,t){return new g_({type:"nonoptional",innerType:e,...H(t)})}var ky=y("ZodCatch",(e,t)=>{Nh.init(e,t),ue.init(e,t),e._zod.processJSONSchema=(r,o,s)=>Il(e,r,o,s),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Py(e,t){return new ky({type:"catch",innerType:e,catchValue:typeof t==="function"?t:()=>t})}var S_=y("ZodPipe",(e,t)=>{Ku.init(e,t),ue.init(e,t),e._zod.processJSONSchema=(r,o,s)=>ql(e,r,o,s),e.in=t.in,e.out=t.out});function i_(e,t){return new S_({type:"pipe",in:e,out:t})}var Ty=y("ZodPreprocess",(e,t)=>{S_.init(e,t),jh.init(e,t)}),Ey=y("ZodReadonly",(e,t)=>{Mh.init(e,t),ue.init(e,t),e._zod.processJSONSchema=(r,o,s)=>Ol(e,r,o,s),e.unwrap=()=>e._zod.def.innerType});function $y(e){return new Ey({type:"readonly",innerType:e})}var Cy=y("ZodLazy",(e,t)=>{Ah.init(e,t),ue.init(e,t),e._zod.processJSONSchema=(r,o,s)=>Nl(e,r,o,s),e.unwrap=()=>e._zod.def.getter()});function yn(e){return new Cy({type:"lazy",getter:e})}var Iy=y("ZodCustom",(e,t)=>{Lh.init(e,t),ue.init(e,t),e._zod.processJSONSchema=(r,o,s)=>yl(e,r,o,s)});function qy(e,t={}){return Rf(Iy,e,t)}function Oy(e,t){return xf(e,t)}function Jr(e,t){return new Ty({type:"pipe",in:f_(e),out:t})}var b_={invalid_type:"invalid_type",too_big:"too_big",too_small:"too_small",invalid_format:"invalid_format",not_multiple_of:"not_multiple_of",unrecognized_keys:"unrecognized_keys",invalid_union:"invalid_union",invalid_key:"invalid_key",invalid_element:"invalid_element",invalid_value:"invalid_value",custom:"custom"};var v_;(function(e){})(v_||(v_={}));function Ny(e){return ff(mc,e)}Je(Gu());var Wr="2025-11-25";var hc=[Wr,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],fc="io.modelcontextprotocol/related-task",Bt="io.modelcontextprotocol/protocolVersion",Uo="io.modelcontextprotocol/clientInfo",$t="io.modelcontextprotocol/serverInfo",Kr="io.modelcontextprotocol/clientCapabilities",Do="io.modelcontextprotocol/subscriptionId",Zo="io.modelcontextprotocol/logLevel";var Gr="2.0";var Vt=yn(()=>C([u(),k(),E(),Br(),T(u(),Vt),v(Vt)])),fe=T(u(),Vt),_c=v(Vt),Ho=C([u(),k().int()]),Fo=u(),wn=m({ttl:k().optional()}),zn=m({taskId:u()}),Vo=V({progressToken:Ho.optional(),[fc]:zn.optional()}),Te=m({_meta:Vo.optional()}),pr=Te.extend({task:wn.optional()}),_e=m({method:u(),params:Te.loose().optional()}),Ae=m({_meta:Vo.optional()}),qe=m({method:u(),params:Ae.loose().optional()}),Bo=V({get[$t](){return Ct.optional().catch(void 0)}}),ge=V({_meta:Bo.optional()}),ft=C([u(),k().int()]),Jo=m({jsonrpc:p(Gr),id:ft,..._e.shape}).strict(),Wo=m({jsonrpc:p(Gr),...qe.shape}).strict(),Yr=m({jsonrpc:p(Gr),id:ft,result:ge}).strict(),Xr=m({jsonrpc:p(Gr),id:ft.optional(),error:m({code:k().int(),message:u(),data:D().optional()})}).strict(),_t=C([Jo,Wo,Yr,Xr]),gc=C([Yr,Xr]),hr=ge.strict(),Rn=Ae.extend({requestId:ft.optional(),reason:u().optional()}),Ko=qe.extend({method:p("notifications/cancelled"),params:Rn}),xn=m({src:u(),mimeType:u().optional(),sizes:v(u()).optional(),theme:Y(["light","dark"]).optional()}),Jt=m({icons:v(xn).optional()}),Et=m({name:u(),title:u().optional()}),Ct=Et.extend({...Et.shape,...Jt.shape,version:u(),websiteUrl:u().optional(),description:u().optional()}),jy=Ft(m({applyDefaults:E().optional()}),fe),My=Jr((e)=>{if(e&&typeof e==="object"&&!Array.isArray(e)&&Object.keys(e).length===0)return{form:{}};return e},Ft(m({form:jy.optional(),url:fe.optional()}),fe.optional())),Sc=V({list:fe.optional(),cancel:fe.optional(),requests:V({sampling:V({createMessage:fe.optional()}).optional(),elicitation:V({create:fe.optional()}).optional()}).optional()}),vc=V({list:fe.optional(),cancel:fe.optional(),requests:V({tools:V({call:fe.optional()}).optional()}).optional()}),kn=m({experimental:T(u(),fe).optional(),sampling:m({context:fe.optional(),tools:fe.optional()}).optional(),elicitation:My.optional(),roots:m({listChanged:E().optional()}).optional(),tasks:Sc.optional(),extensions:T(u(),fe).optional()}),Pn=Te.extend({protocolVersion:u(),capabilities:kn,clientInfo:Ct}),Go=_e.extend({method:p("initialize"),params:Pn}),Yo=m({experimental:T(u(),fe).optional(),logging:fe.optional(),completions:fe.optional(),prompts:m({listChanged:E().optional()}).optional(),resources:m({subscribe:E().optional(),listChanged:E().optional()}).optional(),tools:m({listChanged:E().optional()}).optional(),tasks:vc.optional(),extensions:T(u(),fe).optional()}),Tn=ge.extend({protocolVersion:u(),capabilities:Yo,serverInfo:Ct,instructions:u().optional()}),Xo=qe.extend({method:p("notifications/initialized"),params:Ae.optional()}),En=_e.extend({method:p("server/discover"),params:Te.optional()}),fr=ge.extend({supportedVersions:v(u()),capabilities:Yo,instructions:u().optional()}),Qo=_e.extend({method:p("ping"),params:Te.optional()}),$n=m({progress:k(),total:F(k()),message:F(u())}),Cn=m({...Ae.shape,...$n.shape,progressToken:Ho}),es=qe.extend({method:p("notifications/progress"),params:Cn}),In=Te.extend({cursor:Fo.optional()}),Wt=_e.extend({params:In.optional()}),Kt=ge.extend({nextCursor:Fo.optional()}),ts=m({uri:u(),mimeType:F(u()),_meta:T(u(),D()).optional()}),rs=ts.extend({text:u()}),Ul=u().refine((e)=>{try{return atob(e),!0}catch{return!1}},{message:"Invalid Base64 string"}),os=ts.extend({blob:Ul}),Gt=Y(["user","assistant"]),It=m({audience:v(Gt).optional(),priority:k().min(0).max(1).optional(),lastModified:Ao({offset:!0}).optional()}),ss=m({...Et.shape,...Jt.shape,uri:u(),description:F(u()),mimeType:F(u()),size:F(k()),annotations:It.optional(),_meta:F(V({}))}),qn=m({...Et.shape,...Jt.shape,uriTemplate:u(),description:F(u()),mimeType:F(u()),annotations:It.optional(),_meta:F(V({}))}),On=Wt.extend({method:p("resources/list")}),Nn=Kt.extend({resources:v(ss)}),jn=Wt.extend({method:p("resources/templates/list")}),Mn=Kt.extend({resourceTemplates:v(qn)}),Qr=Te.extend({uri:u()}),An=Qr,Ln=_e.extend({method:p("resources/read"),params:An}),Un=ge.extend({contents:v(C([rs,os]))}),Dn=qe.extend({method:p("notifications/resources/list_changed"),params:Ae.optional()}),Zn=Qr,Hn=_e.extend({method:p("resources/subscribe"),params:Zn}),Fn=Qr,Vn=_e.extend({method:p("resources/unsubscribe"),params:Fn}),ns=m({toolsListChanged:E().optional(),promptsListChanged:E().optional(),resourcesListChanged:E().optional(),resourceSubscriptions:v(u()).optional()}),Bn=Te.extend({notifications:ns}),Jn=_e.extend({method:p("subscriptions/listen"),params:Bn}),Wn=Ae.extend({notifications:ns}),Kn=qe.extend({method:p("notifications/subscriptions/acknowledged"),params:Wn}),Gn=Bo.extend({[Do]:ft}),Yn=ge.extend({_meta:Gn}),Xn=Ae.extend({uri:u()}),Qn=qe.extend({method:p("notifications/resources/updated"),params:Xn}),ei=m({name:u(),description:F(u()),required:F(E())}),ti=m({...Et.shape,...Jt.shape,description:F(u()),arguments:F(v(ei)),_meta:F(V({}))}),ri=Wt.extend({method:p("prompts/list")}),oi=Kt.extend({prompts:v(ti)}),si=Te.extend({name:u(),arguments:T(u(),u()).optional()}),ni=_e.extend({method:p("prompts/get"),params:si}),eo=m({type:p("text"),text:u(),annotations:It.optional(),_meta:T(u(),D()).optional()}),to=m({type:p("image"),data:Ul,mimeType:u(),annotations:It.optional(),_meta:T(u(),D()).optional()}),ro=m({type:p("audio"),data:Ul,mimeType:u(),annotations:It.optional(),_meta:T(u(),D()).optional()}),ii=m({type:p("tool_use"),name:u(),id:u(),input:T(u(),D()),_meta:T(u(),D()).optional()}),oo=m({type:p("resource"),resource:C([rs,os]),annotations:It.optional(),_meta:T(u(),D()).optional()}),so=ss.extend({type:p("resource_link")}),qt=C([eo,to,ro,so,oo]),ai=m({role:Gt,content:qt}),ci=ge.extend({description:u().optional(),messages:v(ai)}),ui=qe.extend({method:p("notifications/prompts/list_changed"),params:Ae.optional()}),li=m({title:u().optional(),readOnlyHint:E().optional(),destructiveHint:E().optional(),idempotentHint:E().optional(),openWorldHint:E().optional()}),di=m({taskSupport:Y(["required","optional","forbidden"]).optional()}),_r=m({...Et.shape,...Jt.shape,description:u().optional(),inputSchema:m({type:p("object"),properties:T(u(),Vt).optional(),required:v(u()).optional()}).catchall(D()),outputSchema:V({$schema:u().optional()}).optional(),annotations:li.optional(),execution:di.optional(),_meta:T(u(),D()).optional()}),mi=Wt.extend({method:p("tools/list")}),pi=Kt.extend({tools:v(_r)}),gr=ge.extend({content:v(qt).default([]),structuredContent:D().optional(),isError:E().optional()}),bc=gr.or(ge.extend({toolResult:D()})),hi=pr.extend({name:u(),arguments:T(u(),D()).optional()}),fi=_e.extend({method:p("tools/call"),params:hi}),_i=qe.extend({method:p("notifications/tools/list_changed"),params:Ae.optional()}),gi=m({autoRefresh:E().default(!0),debounceMs:k().int().nonnegative().default(300)}),is=Y(["debug","info","notice","warning","error","critical","alert","emergency"]),Si=Te.extend({level:is}),vi=_e.extend({method:p("logging/setLevel"),params:Si}),bi=Ae.extend({level:is,logger:u().optional(),data:D()}),no=qe.extend({method:p("notifications/message"),params:bi}),yi=m({name:u().optional()}),wi=m({hints:v(yi).optional(),costPriority:k().min(0).max(1).optional(),speedPriority:k().min(0).max(1).optional(),intelligencePriority:k().min(0).max(1).optional()}),zi=m({mode:Y(["auto","required","none"]).optional()}),Ri=m({type:p("tool_result"),toolUseId:u().describe("The unique identifier for the corresponding tool call."),content:v(qt),structuredContent:D().optional(),isError:E().optional(),_meta:T(u(),D()).optional()}),xi=Lo("type",[eo,to,ro]),mr=Lo("type",[eo,to,ro,ii,Ri]),ki=m({role:Gt,content:C([mr,v(mr)]),_meta:T(u(),D()).optional()}),Pi=pr.extend({messages:v(ki),modelPreferences:wi.optional(),systemPrompt:u().optional(),includeContext:Y(["none","thisServer","allServers"]).optional(),temperature:k().optional(),maxTokens:k().int(),stopSequences:v(u()).optional(),metadata:fe.optional(),tools:v(_r).optional(),toolChoice:zi.optional()}),Ti=_e.extend({method:p("sampling/createMessage"),params:Pi}),Ei=ge.extend({model:u(),stopReason:F(Y(["endTurn","stopSequence","maxTokens"]).or(u())),role:Gt,content:xi}),$i=ge.extend({model:u(),stopReason:F(Y(["endTurn","stopSequence","maxTokens","toolUse"]).or(u())),role:Gt,content:C([mr,v(mr)])}),as=m({type:p("boolean"),title:u().optional(),description:u().optional(),default:E().optional()}),io=m({type:p("string"),title:u().optional(),description:u().optional(),minLength:k().optional(),maxLength:k().optional(),format:Y(["email","uri","date","date-time"]).optional(),default:u().optional()}),ao=m({type:Y(["number","integer"]),title:u().optional(),description:u().optional(),minimum:k().optional(),maximum:k().optional(),default:k().optional()}),cs=m({type:p("string"),title:u().optional(),description:u().optional(),enum:v(u()),default:u().optional()}),us=m({type:p("string"),title:u().optional(),description:u().optional(),oneOf:v(m({const:u(),title:u()})),default:u().optional()}),ls=m({type:p("string"),title:u().optional(),description:u().optional(),enum:v(u()),enumNames:v(u()).optional(),default:u().optional()}),Ci=C([cs,us]),ds=m({type:p("array"),title:u().optional(),description:u().optional(),minItems:k().optional(),maxItems:k().optional(),items:m({type:p("string"),enum:v(u())}),default:v(u()).optional()}),ms=m({type:p("array"),title:u().optional(),description:u().optional(),minItems:k().optional(),maxItems:k().optional(),items:m({anyOf:v(m({const:u(),title:u()}))}),default:v(u()).optional()}),Ii=C([ds,ms]),qi=C([ls,Ci,Ii]),ps=C([qi,as,io,ao]),co=pr.extend({mode:p("form").optional(),message:u(),requestedSchema:m({type:p("object"),properties:T(u(),ps),required:v(u()).optional()}).catchall(D())}),Oi=pr.extend({mode:p("url"),message:u(),elicitationId:u(),url:u().url()}),Ni=C([co,Oi]),ji=_e.extend({method:p("elicitation/create"),params:Ni}),Mi=Ae.extend({elicitationId:u()}),Ai=qe.extend({method:p("notifications/elicitation/complete"),params:Mi}),Li=ge.extend({action:Y(["accept","decline","cancel"]),content:Jr((e)=>e===null?void 0:e,T(u(),C([u(),k(),E(),v(u())])).optional())}),Ui=m({type:p("ref/resource"),uri:u()}),Di=m({type:p("ref/prompt"),name:u()}),Zi=Te.extend({ref:C([Di,Ui]),argument:m({name:u(),value:u()}),context:m({arguments:T(u(),u()).optional()}).optional()}),Hi=_e.extend({method:p("completion/complete"),params:Zi}),Fi=ge.extend({completion:V({values:v(u()).max(100),total:F(k().int()),hasMore:F(E())})}),Vi=m({uri:u().startsWith("file://"),name:u().optional(),_meta:T(u(),D()).optional()}),Bi=_e.extend({method:p("roots/list"),params:Te.optional()}),Ji=ge.extend({roots:v(Vi)}),Wi=qe.extend({method:p("notifications/roots/list_changed"),params:Ae.optional()}),yc=V({ttl:k().optional(),pollInterval:k().optional()}),Ki=Y(["working","input_required","completed","failed","cancelled"]),Yt=m({taskId:u(),status:Ki,ttl:C([k(),Br()]),createdAt:u(),lastUpdatedAt:u(),pollInterval:F(k()),statusMessage:F(u())}),wc=ge.extend({task:Yt}),Gi=Ae.merge(Yt),zc=qe.extend({method:p("notifications/tasks/status"),params:Gi}),Rc=_e.extend({method:p("tasks/get"),params:Te.extend({taskId:u()})}),xc=ge.merge(Yt),kc=_e.extend({method:p("tasks/result"),params:Te.extend({taskId:u()})}),Pc=ge.loose(),Tc=Wt.extend({method:p("tasks/list")}),Ec=Kt.extend({tasks:v(Yt)}),$c=_e.extend({method:p("tasks/cancel"),params:Te.extend({taskId:u()})}),Cc=ge.merge(Yt),Ic=C([Qo,Go,En,Hi,vi,ni,ri,On,jn,Ln,Hn,Vn,Jn,fi,mi]),qc=C([Ko,es,Xo,Wi]),Oc=C([hr,Ei,$i,Li,Ji]),Nc=C([Qo,Ti,ji,Bi]),jc=C([Ko,es,no,Qn,Dn,_i,ui,Kn,Ai]),Mc=C([hr,Tn,fr,Fi,ci,oi,Nn,Mn,Un,gr,pi,Yn]);var Ee=dc().superRefine((e,t)=>{if(!URL.canParse(e))return t.addIssue({code:b_.custom,message:"URL must be parseable",fatal:!0}),Eu}).refine((e)=>{let t=new URL(e);return t.protocol!=="javascript:"&&t.protocol!=="data:"&&t.protocol!=="vbscript:"},{message:"URL cannot use javascript:, data:, or vbscript: scheme"}),hs=V({resource:u().url(),authorization_servers:v(Ee).optional(),jwks_uri:u().url().optional(),scopes_supported:v(u()).optional(),bearer_methods_supported:v(u()).optional(),resource_signing_alg_values_supported:v(u()).optional(),resource_name:u().optional(),resource_documentation:u().optional(),resource_policy_uri:u().url().optional(),resource_tos_uri:u().url().optional(),tls_client_certificate_bound_access_tokens:E().optional(),authorization_details_types_supported:v(u()).optional(),dpop_signing_alg_values_supported:v(u()).optional(),dpop_bound_access_tokens_required:E().optional()}),uo=V({issuer:u(),authorization_endpoint:Ee,token_endpoint:Ee,registration_endpoint:Ee.optional(),scopes_supported:v(u()).optional(),response_types_supported:v(u()),response_modes_supported:v(u()).optional(),grant_types_supported:v(u()).optional(),token_endpoint_auth_methods_supported:v(u()).optional(),token_endpoint_auth_signing_alg_values_supported:v(u()).optional(),service_documentation:Ee.optional(),revocation_endpoint:Ee.optional(),revocation_endpoint_auth_methods_supported:v(u()).optional(),revocation_endpoint_auth_signing_alg_values_supported:v(u()).optional(),introspection_endpoint:u().optional(),introspection_endpoint_auth_methods_supported:v(u()).optional(),introspection_endpoint_auth_signing_alg_values_supported:v(u()).optional(),code_challenge_methods_supported:v(u()).optional(),client_id_metadata_document_supported:E().optional(),authorization_response_iss_parameter_supported:E().optional().catch(void 0),dpop_signing_alg_values_supported:v(u()).optional()}),Yi=V({issuer:u(),authorization_endpoint:Ee,token_endpoint:Ee,userinfo_endpoint:Ee.optional(),jwks_uri:Ee,registration_endpoint:Ee.optional(),scopes_supported:v(u()).optional(),response_types_supported:v(u()),response_modes_supported:v(u()).optional(),grant_types_supported:v(u()).optional(),acr_values_supported:v(u()).optional(),subject_types_supported:v(u()),id_token_signing_alg_values_supported:v(u()),id_token_encryption_alg_values_supported:v(u()).optional(),id_token_encryption_enc_values_supported:v(u()).optional(),userinfo_signing_alg_values_supported:v(u()).optional(),userinfo_encryption_alg_values_supported:v(u()).optional(),userinfo_encryption_enc_values_supported:v(u()).optional(),request_object_signing_alg_values_supported:v(u()).optional(),request_object_encryption_alg_values_supported:v(u()).optional(),request_object_encryption_enc_values_supported:v(u()).optional(),token_endpoint_auth_methods_supported:v(u()).optional(),token_endpoint_auth_signing_alg_values_supported:v(u()).optional(),display_values_supported:v(u()).optional(),claim_types_supported:v(u()).optional(),claims_supported:v(u()).optional(),service_documentation:u().optional(),claims_locales_supported:v(u()).optional(),ui_locales_supported:v(u()).optional(),claims_parameter_supported:E().optional(),request_parameter_supported:E().optional(),request_uri_parameter_supported:E().optional(),require_request_uri_registration:E().optional(),op_policy_uri:Ee.optional(),op_tos_uri:Ee.optional(),client_id_metadata_document_supported:E().optional(),authorization_response_iss_parameter_supported:E().optional().catch(void 0)}),fs=m({...Yi.shape,...uo.pick({code_challenge_methods_supported:!0}).shape}),lo=m({access_token:u(),id_token:u().optional(),token_type:u(),expires_in:Ny().optional(),scope:u().optional(),refresh_token:u().optional(),issuer:u().optional().catch(void 0)}).strip(),Xi=m({issued_token_type:p("urn:ietf:params:oauth:token-type:id-jag"),access_token:u(),token_type:u().optional(),expires_in:k().optional(),scope:u().optional()}).strip(),mo=m({error:u(),error_description:u().optional(),error_uri:u().optional()}),Dl=Ee.optional().or(p("").transform(()=>{return})),Qi=m({redirect_uris:v(Ee),token_endpoint_auth_method:u().optional(),grant_types:v(u()).optional(),response_types:v(u()).optional(),application_type:u().optional(),client_name:u().optional(),client_uri:Ee.optional(),logo_uri:Dl,scope:u().optional(),contacts:v(u()).optional(),tos_uri:Dl,policy_uri:u().optional(),jwks_uri:Ee.optional(),jwks:pc().optional(),software_id:u().optional(),software_version:u().optional(),software_statement:u().optional()}).strip(),ea=m({client_id:u(),client_secret:u().optional(),client_id_issued_at:k().optional(),client_secret_expires_at:k().optional(),issuer:u().optional().catch(void 0)}).strip(),_s=Qi.merge(ea),Ac=m({error:u(),error_description:u().optional()}).strip(),Lc=m({token:u(),token_type_hint:u().optional()}).strip();var Bl=Symbol.for("mcp.sdk.errorBrands");function vr(e,t){let r=new Set,o=t;while(typeof o==="function"){let s=o.mcpBrand;if(Object.prototype.hasOwnProperty.call(o,"mcpBrand")&&typeof s==="string")r.add(s);o=Object.getPrototypeOf(o)}if(r.size===0)return;Object.defineProperty(e,Bl,{value:r,enumerable:!1,configurable:!0})}function We(e,t){try{if(typeof t==="object"&&t!==null&&Object.prototype.hasOwnProperty.call(e,"mcpBrand")&&typeof e.mcpBrand==="string"&&Object.prototype.hasOwnProperty.call(t,Bl)){let r=t[Bl];if(r&&typeof r.has==="function"&&r.has(e.mcpBrand))return!0}}catch{}return Function.prototype[Symbol.hasInstance].call(e,t)}var Ot=function(e){return e.InvalidRequest="invalid_request",e.InvalidClient="invalid_client",e.InvalidGrant="invalid_grant",e.UnauthorizedClient="unauthorized_client",e.UnsupportedGrantType="unsupported_grant_type",e.InvalidScope="invalid_scope",e.AccessDenied="access_denied",e.ServerError="server_error",e.TemporarilyUnavailable="temporarily_unavailable",e.UnsupportedResponseType="unsupported_response_type",e.UnsupportedTokenType="unsupported_token_type",e.InvalidToken="invalid_token",e.MethodNotAllowed="method_not_allowed",e.TooManyRequests="too_many_requests",e.InvalidClientMetadata="invalid_client_metadata",e.InvalidRedirectUri="invalid_redirect_uri",e.InsufficientScope="insufficient_scope",e.InvalidTarget="invalid_target",e.InvalidDpopProof="invalid_dpop_proof",e.UseDpopNonce="use_dpop_nonce",e}({}),br=class e extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.OAuthError"})}static[Symbol.hasInstance](t){return We(this,t)}static isInstance(t){if(typeof this!=="function")throw TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return We(this,t)}constructor(t,r,o){super(r);this.code=t,this.errorUri=o,this.name="OAuthError",vr(this,new.target)}toResponseObject(){let t={error:this.code,error_description:this.message};if(this.errorUri)t.error_uri=this.errorUri;return t}static fromResponse(t){return new e(t.error,t.error_description??t.error,t.error_uri)}},M=function(e){return e.NotConnected="NOT_CONNECTED",e.AlreadyConnected="ALREADY_CONNECTED",e.NotInitialized="NOT_INITIALIZED",e.CapabilityNotSupported="CAPABILITY_NOT_SUPPORTED",e.RequestTimeout="REQUEST_TIMEOUT",e.ConnectionClosed="CONNECTION_CLOSED",e.SendFailed="SEND_FAILED",e.InvalidResult="INVALID_RESULT",e.UnsupportedResultType="UNSUPPORTED_RESULT_TYPE",e.InputRequiredRoundsExceeded="INPUT_REQUIRED_ROUNDS_EXCEEDED",e.ListPaginationExceeded="LIST_PAGINATION_EXCEEDED",e.MethodNotSupportedByProtocolVersion="METHOD_NOT_SUPPORTED_BY_PROTOCOL_VERSION",e.EraNegotiationFailed="ERA_NEGOTIATION_FAILED",e.ClientHttpNotImplemented="CLIENT_HTTP_NOT_IMPLEMENTED",e.ClientHttpAuthentication="CLIENT_HTTP_AUTHENTICATION",e.ClientHttpForbidden="CLIENT_HTTP_FORBIDDEN",e.ClientHttpUnexpectedContent="CLIENT_HTTP_UNEXPECTED_CONTENT",e.ClientHttpFailedToOpenStream="CLIENT_HTTP_FAILED_TO_OPEN_STREAM",e.ClientHttpFailedToTerminateSession="CLIENT_HTTP_FAILED_TO_TERMINATE_SESSION",e}({}),L=class extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.SdkError"})}static[Symbol.hasInstance](e){return We(this,e)}static isInstance(e){if(typeof this!=="function")throw TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return We(this,e)}constructor(e,t,r,o){super(t,o);this.code=e,this.data=r,this.name="SdkError",vr(this,new.target)}},gt=class extends L{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.SdkHttpError"})}constructor(e,t,r,o){super(e,t,r,o);this.name="SdkHttpError"}get status(){return this.data.status}get statusText(){return this.data.statusText}};function Yl(e){let t=typeof e==="string"?new URL(e):new URL(e.href);return t.hash="",t}function Bc(e){if(typeof e!=="object"||e===null||Array.isArray(e))return e;let t={...e};return delete t.issuer,t}function Xl({requestedResource:e,configuredResource:t}){let r=typeof e==="string"?new URL(e):new URL(e.href),o=typeof t==="string"?new URL(t):new URL(t.href);if(r.origin!==o.origin)return!1;if(r.pathname.length<o.pathname.length)return!1;let s=r.pathname.endsWith("/")?r.pathname:r.pathname+"/",n=o.pathname.endsWith("/")?o.pathname:o.pathname+"/";return s.startsWith(n)}var J_="2026-07-28",Ql=[J_];function Nt(e){return e>=J_}function ed(e){return e.filter((t)=>!Nt(t))}function ia(e){return e.filter((t)=>Nt(t))}function W_(e){let t=e.structuredContent;if(t===void 0)return e;if(!(typeof t!=="object"||t===null||Array.isArray(t)))return e;if(e.content?.some((r)=>r.type==="text")??!1)return e;return{...e,content:[...e.content??[],{type:"text",text:JSON.stringify(t)}]}}var K_=["task","inputRequests","requestState"];function Ay(e){if(e===null||typeof e!=="object"||Array.isArray(e)||e.content!==void 0||K_.some((t)=>(t in e)))return e;return{...e,content:[]}}function Ly(){let e=yn(()=>C([u(),k(),E(),Br(),T(u(),e),v(e)])),t=T(u(),e),r=C([u(),k().int()]),o=u(),s=m({ttl:k().optional()}),n=m({taskId:u()}),i=V({progressToken:r.optional(),"io.modelcontextprotocol/related-task":n.optional()}),a=m({_meta:i.optional()}),c=a.extend({task:s.optional()}),l=m({method:u(),params:a.loose().optional()}),d=m({_meta:i.optional()}),f=m({method:u(),params:d.loose().optional()}),h=V({_meta:i.optional()}),g=C([u(),k().int()]),b=h.strict(),_=d.extend({requestId:g.optional(),reason:u().optional()}),w=f.extend({method:p("notifications/cancelled"),params:_}),I=m({src:u(),mimeType:u().optional(),sizes:v(u()).optional(),theme:Y(["light","dark"]).optional()}),A=m({icons:v(I).optional()}),z=m({name:u(),title:u().optional()}),q=z.extend({...z.shape,...A.shape,version:u(),websiteUrl:u().optional(),description:u().optional()}),x=Ft(m({applyDefaults:E().optional()}),t),R=Jr((Me)=>{if(Me&&typeof Me==="object"&&!Array.isArray(Me)&&Object.keys(Me).length===0)return{form:{}};return Me},Ft(m({form:x.optional(),url:t.optional()}),t.optional())),Z=V({list:t.optional(),cancel:t.optional(),requests:V({sampling:V({createMessage:t.optional()}).optional(),elicitation:V({create:t.optional()}).optional()}).optional()}),ee=V({list:t.optional(),cancel:t.optional(),requests:V({tools:V({call:t.optional()}).optional()}).optional()}),X=m({experimental:T(u(),t).optional(),sampling:m({context:t.optional(),tools:t.optional()}).optional(),elicitation:R.optional(),roots:m({listChanged:E().optional()}).optional(),tasks:Z.optional(),extensions:T(u(),t).optional()}),ne=a.extend({protocolVersion:u(),capabilities:X,clientInfo:q}),xe=l.extend({method:p("initialize"),params:ne}),te=m({experimental:T(u(),t).optional(),logging:t.optional(),completions:t.optional(),prompts:m({listChanged:E().optional()}).optional(),resources:m({subscribe:E().optional(),listChanged:E().optional()}).optional(),tools:m({listChanged:E().optional()}).optional(),tasks:ee.optional(),extensions:T(u(),t).optional()}),ie=h.extend({protocolVersion:u(),capabilities:te,serverInfo:q,instructions:u().optional()}),re=f.extend({method:p("notifications/initialized"),params:d.optional()}),de=l.extend({method:p("ping"),params:a.optional()}),bt=m({progress:k(),total:F(k()),message:F(u())}),Fe=m({...d.shape,...bt.shape,progressToken:r}),st=f.extend({method:p("notifications/progress"),params:Fe}),yt=a.extend({cursor:o.optional()}),Ge=l.extend({params:yt.optional()}),Le=h.extend({nextCursor:o.optional()}),Dt=m({uri:u(),mimeType:F(u()),_meta:T(u(),D()).optional()}),Zt=Dt.extend({text:u()}),wt=u().refine((Me)=>{try{return atob(Me),!0}catch{return!1}},{message:"Invalid Base64 string"}),Ne=Dt.extend({blob:wt}),Ue=Y(["user","assistant"]),De=m({audience:v(Ue).optional(),priority:k().min(0).max(1).optional(),lastModified:Ao({offset:!0}).optional()}),dt=m({...z.shape,...A.shape,uri:u(),description:F(u()),mimeType:F(u()),size:F(k()),annotations:De.optional(),_meta:F(V({}))}),Cr=m({...z.shape,...A.shape,uriTemplate:u(),description:F(u()),mimeType:F(u()),annotations:De.optional(),_meta:F(V({}))}),Ye=Ge.extend({method:p("resources/list")}),Xe=Le.extend({resources:v(dt)}),Ve=Ge.extend({method:p("resources/templates/list")}),nt=Le.extend({resourceTemplates:v(Cr)}),it=a.extend({uri:u()}),zt=it,Rt=l.extend({method:p("resources/read"),params:zt}),or=h.extend({contents:v(C([Zt,Ne]))}),xt=f.extend({method:p("notifications/resources/list_changed"),params:d.optional()}),Ir=it,N=l.extend({method:p("resources/subscribe"),params:Ir}),kt=it,B=l.extend({method:p("resources/unsubscribe"),params:kt}),U=d.extend({uri:u()}),Q=f.extend({method:p("notifications/resources/updated"),params:U}),j=m({name:u(),description:F(u()),required:F(E())}),O=m({...z.shape,...A.shape,description:F(u()),arguments:F(v(j)),_meta:F(V({}))}),K=Ge.extend({method:p("prompts/list")}),J=Le.extend({prompts:v(O)}),ke=a.extend({name:u(),arguments:T(u(),u()).optional()}),qr=l.extend({method:p("prompts/get"),params:ke}),Pt=m({type:p("text"),text:u(),annotations:De.optional(),_meta:T(u(),D()).optional()}),Or=m({type:p("image"),data:wt,mimeType:u(),annotations:De.optional(),_meta:T(u(),D()).optional()}),Nr=m({type:p("audio"),data:wt,mimeType:u(),annotations:De.optional(),_meta:T(u(),D()).optional()}),Is=m({type:p("tool_use"),name:u(),id:u(),input:T(u(),D()),_meta:T(u(),D()).optional()}),sr=m({type:p("resource"),resource:C([Zt,Ne]),annotations:De.optional(),_meta:T(u(),D()).optional()}),qs=dt.extend({type:p("resource_link")}),at=C([Pt,Or,Nr,qs,sr]),zo=m({role:Ue,content:at}),Ro=h.extend({description:u().optional(),messages:v(zo)}),jr=f.extend({method:p("notifications/prompts/list_changed"),params:d.optional()}),Os=m({title:u().optional(),readOnlyHint:E().optional(),destructiveHint:E().optional(),idempotentHint:E().optional(),openWorldHint:E().optional()}),xo=m({taskSupport:Y(["required","optional","forbidden"]).optional()}),Mr=m({...z.shape,...A.shape,description:u().optional(),inputSchema:m({type:p("object"),properties:T(u(),e).optional(),required:v(u()).optional()}).catchall(D()),outputSchema:m({type:p("object"),properties:T(u(),e).optional(),required:v(u()).optional()}).catchall(D()).optional(),annotations:Os.optional(),execution:xo.optional(),_meta:T(u(),D()).optional()}),ko=Ge.extend({method:p("tools/list")}),Po=Le.extend({tools:v(Mr)}),To=h.extend({content:v(at),structuredContent:T(u(),D()).optional(),isError:E().optional()}),je=c.extend({name:u(),arguments:T(u(),D()).optional()}),Ns=l.extend({method:p("tools/call"),params:je}),ka=f.extend({method:p("notifications/tools/list_changed"),params:d.optional()}),Eo=Y(["debug","info","notice","warning","error","critical","alert","emergency"]),js=a.extend({level:Eo}),Ms=l.extend({method:p("logging/setLevel"),params:js}),As=d.extend({level:Eo,logger:u().optional(),data:D()}),Ls=f.extend({method:p("notifications/message"),params:As}),Us=m({name:u().optional()}),Ds=m({hints:v(Us).optional(),costPriority:k().min(0).max(1).optional(),speedPriority:k().min(0).max(1).optional(),intelligencePriority:k().min(0).max(1).optional()}),Zs=m({mode:Y(["auto","required","none"]).optional()}),Pa=m({type:p("tool_result"),toolUseId:u().describe("The unique identifier for the corresponding tool call."),content:v(at),structuredContent:m({}).loose().optional(),isError:E().optional(),_meta:T(u(),D()).optional()}),Hs=Lo("type",[Pt,Or,Nr]),nr=Lo("type",[Pt,Or,Nr,Is,Pa]),Fs=m({role:Ue,content:C([nr,v(nr)]),_meta:T(u(),D()).optional()}),Vs=c.extend({messages:v(Fs),modelPreferences:Ds.optional(),systemPrompt:u().optional(),includeContext:Y(["none","thisServer","allServers"]).optional(),temperature:k().optional(),maxTokens:k().int(),stopSequences:v(u()).optional(),metadata:t.optional(),tools:v(Mr).optional(),toolChoice:Zs.optional()}),Bs=l.extend({method:p("sampling/createMessage"),params:Vs}),Js=h.extend({model:u(),stopReason:F(Y(["endTurn","stopSequence","maxTokens"]).or(u())),role:Ue,content:Hs}),Ws=h.extend({model:u(),stopReason:F(Y(["endTurn","stopSequence","maxTokens","toolUse"]).or(u())),role:Ue,content:C([nr,v(nr)])}),Ks=m({type:p("boolean"),title:u().optional(),description:u().optional(),default:E().optional()}),Gs=m({type:p("string"),title:u().optional(),description:u().optional(),minLength:k().optional(),maxLength:k().optional(),format:Y(["email","uri","date","date-time"]).optional(),default:u().optional()}),Ys=m({type:Y(["number","integer"]),title:u().optional(),description:u().optional(),minimum:k().optional(),maximum:k().optional(),default:k().optional()}),Xs=m({type:p("string"),title:u().optional(),description:u().optional(),enum:v(u()),default:u().optional()}),Qs=m({type:p("string"),title:u().optional(),description:u().optional(),oneOf:v(m({const:u(),title:u()})),default:u().optional()}),en=m({type:p("string"),title:u().optional(),description:u().optional(),enum:v(u()),enumNames:v(u()).optional(),default:u().optional()}),tn=C([Xs,Qs]),Ar=m({type:p("array"),title:u().optional(),description:u().optional(),minItems:k().optional(),maxItems:k().optional(),items:m({type:p("string"),enum:v(u())}),default:v(u()).optional()}),Lr=m({type:p("array"),title:u().optional(),description:u().optional(),minItems:k().optional(),maxItems:k().optional(),items:m({anyOf:v(m({const:u(),title:u()}))}),default:v(u()).optional()}),Ta=C([Ar,Lr]),Ea=C([en,tn,Ta]),Qe=C([Ea,Ks,Gs,Ys]),et=c.extend({mode:p("form").optional(),message:u(),requestedSchema:m({type:p("object"),properties:T(u(),Qe),required:v(u()).optional()}).catchall(D())}),rn=c.extend({mode:p("url"),message:u(),elicitationId:u(),url:u().url()}),mt=C([et,rn]),$a=l.extend({method:p("elicitation/create"),params:mt}),Ca=d.extend({elicitationId:u()}),Ia=f.extend({method:p("notifications/elicitation/complete"),params:Ca}),qa=h.extend({action:Y(["accept","decline","cancel"]),content:Jr((Me)=>Me===null?void 0:Me,T(u(),C([u(),k(),E(),v(u())])).optional())}),Oa=m({type:p("ref/resource"),uri:u()}),Na=m({type:p("ref/prompt"),name:u()}),ja=a.extend({ref:C([Na,Oa]),argument:m({name:u(),value:u()}),context:m({arguments:T(u(),u()).optional()}).optional()}),on=l.extend({method:p("completion/complete"),params:ja}),Ma=h.extend({completion:V({values:v(u()).max(100),total:F(k().int()),hasMore:F(E())})}),Aa=m({uri:u().startsWith("file://"),name:u().optional(),_meta:T(u(),D()).optional()}),$o=l.extend({method:p("roots/list"),params:a.optional()}),sn=h.extend({roots:v(Aa)}),La=f.extend({method:p("notifications/roots/list_changed"),params:d.optional()}),Ua=V({ttl:k().optional(),pollInterval:k().optional()}),nn=Y(["working","input_required","completed","failed","cancelled"]),ir=m({taskId:u(),status:nn,ttl:C([k(),Br()]),createdAt:u(),lastUpdatedAt:u(),pollInterval:F(k()),statusMessage:F(u())}),Be=h.extend({task:ir}),Da=d.merge(ir),Ur=f.extend({method:p("notifications/tasks/status"),params:Da}),Co=l.extend({method:p("tasks/get"),params:a.extend({taskId:u()})}),Io=h.merge(ir),qo=l.extend({method:p("tasks/result"),params:a.extend({taskId:u()})}),Tu=h.loose(),Ze=Ge.extend({method:p("tasks/list")}),ye=Le.extend({tasks:v(ir)}),Dr=l.extend({method:p("tasks/cancel"),params:a.extend({taskId:u()})});return{JSONValueSchema:e,JSONObjectSchema:t,ProgressTokenSchema:r,CursorSchema:o,TaskMetadataSchema:s,RelatedTaskMetadataSchema:n,RequestMetaSchema:i,BaseRequestParamsSchema:a,TaskAugmentedRequestParamsSchema:c,RequestSchema:l,NotificationsParamsSchema:d,NotificationSchema:f,ResultSchema:h,RequestIdSchema:g,EmptyResultSchema:b,CancelledNotificationParamsSchema:_,CancelledNotificationSchema:w,IconSchema:I,IconsSchema:A,BaseMetadataSchema:z,ImplementationSchema:q,ClientTasksCapabilitySchema:Z,ServerTasksCapabilitySchema:ee,ClientCapabilitiesSchema:X,InitializeRequestParamsSchema:ne,InitializeRequestSchema:xe,ServerCapabilitiesSchema:te,InitializeResultSchema:ie,InitializedNotificationSchema:re,PingRequestSchema:de,ProgressSchema:bt,ProgressNotificationParamsSchema:Fe,ProgressNotificationSchema:st,PaginatedRequestParamsSchema:yt,PaginatedRequestSchema:Ge,PaginatedResultSchema:Le,ResourceContentsSchema:Dt,TextResourceContentsSchema:Zt,BlobResourceContentsSchema:Ne,RoleSchema:Ue,AnnotationsSchema:De,ResourceSchema:dt,ResourceTemplateSchema:Cr,ListResourcesRequestSchema:Ye,ListResourcesResultSchema:Xe,ListResourceTemplatesRequestSchema:Ve,ListResourceTemplatesResultSchema:nt,ResourceRequestParamsSchema:it,ReadResourceRequestParamsSchema:zt,ReadResourceRequestSchema:Rt,ReadResourceResultSchema:or,ResourceListChangedNotificationSchema:xt,SubscribeRequestParamsSchema:Ir,SubscribeRequestSchema:N,UnsubscribeRequestParamsSchema:kt,UnsubscribeRequestSchema:B,ResourceUpdatedNotificationParamsSchema:U,ResourceUpdatedNotificationSchema:Q,PromptArgumentSchema:j,PromptSchema:O,ListPromptsRequestSchema:K,ListPromptsResultSchema:J,GetPromptRequestParamsSchema:ke,GetPromptRequestSchema:qr,TextContentSchema:Pt,ImageContentSchema:Or,AudioContentSchema:Nr,ToolUseContentSchema:Is,EmbeddedResourceSchema:sr,ResourceLinkSchema:qs,ContentBlockSchema:at,PromptMessageSchema:zo,GetPromptResultSchema:Ro,PromptListChangedNotificationSchema:jr,ToolAnnotationsSchema:Os,ToolExecutionSchema:xo,ToolSchema:Mr,ListToolsRequestSchema:ko,ListToolsResultSchema:Po,CallToolResultSchema:To,CallToolRequestParamsSchema:je,CallToolRequestSchema:Ns,ToolListChangedNotificationSchema:ka,LoggingLevelSchema:Eo,SetLevelRequestParamsSchema:js,SetLevelRequestSchema:Ms,LoggingMessageNotificationParamsSchema:As,LoggingMessageNotificationSchema:Ls,ModelHintSchema:Us,ModelPreferencesSchema:Ds,ToolChoiceSchema:Zs,ToolResultContentSchema:Pa,SamplingContentSchema:Hs,SamplingMessageContentBlockSchema:nr,SamplingMessageSchema:Fs,CreateMessageRequestParamsSchema:Vs,CreateMessageRequestSchema:Bs,CreateMessageResultSchema:Js,CreateMessageResultWithToolsSchema:Ws,BooleanSchemaSchema:Ks,StringSchemaSchema:Gs,NumberSchemaSchema:Ys,UntitledSingleSelectEnumSchemaSchema:Xs,TitledSingleSelectEnumSchemaSchema:Qs,LegacyTitledEnumSchemaSchema:en,SingleSelectEnumSchemaSchema:tn,UntitledMultiSelectEnumSchemaSchema:Ar,TitledMultiSelectEnumSchemaSchema:Lr,MultiSelectEnumSchemaSchema:Ta,EnumSchemaSchema:Ea,PrimitiveSchemaDefinitionSchema:Qe,ElicitRequestFormParamsSchema:et,ElicitRequestURLParamsSchema:rn,ElicitRequestParamsSchema:mt,ElicitRequestSchema:$a,ElicitationCompleteNotificationParamsSchema:Ca,ElicitationCompleteNotificationSchema:Ia,ElicitResultSchema:qa,ResourceTemplateReferenceSchema:Oa,PromptReferenceSchema:Na,CompleteRequestParamsSchema:ja,CompleteRequestSchema:on,CompleteResultSchema:Ma,RootSchema:Aa,ListRootsRequestSchema:$o,ListRootsResultSchema:sn,RootsListChangedNotificationSchema:La,TaskCreationParamsSchema:Ua,TaskStatusSchema:nn,TaskSchema:ir,CreateTaskResultSchema:Be,TaskStatusNotificationParamsSchema:Da,TaskStatusNotificationSchema:Ur,GetTaskRequestSchema:Co,GetTaskResultSchema:Io,GetTaskPayloadRequestSchema:qo,GetTaskPayloadResultSchema:Tu,ListTasksRequestSchema:Ze,ListTasksResultSchema:ye,CancelTaskRequestSchema:Dr,CancelTaskResultSchema:h.merge(ir),ClientRequestSchema:C([de,xe,on,Ms,qr,K,Ye,Ve,Rt,N,B,Ns,ko,Co,qo,Ze,Dr]),ClientNotificationSchema:C([w,st,re,La,Ur]),ClientResultSchema:C([b,Js,Ws,qa,sn,Io,ye,Be]),ServerRequestSchema:C([de,Bs,$a,$o,Co,qo,Ze,Dr]),ServerNotificationSchema:C([w,st,Ls,Q,xt,ka,jr,Ur,Ia]),ServerResultSchema:C([b,ie,Ma,Ro,J,Xe,nt,or,To,Po,Io,ye,Be]),CallToolResultWireSchema:D().superRefine((Me,nb)=>{if(typeof Me!=="object"||Me===null||Array.isArray(Me)||Me.content!==void 0)return;for(let _m of K_)if(_m in Me){nb.addIssue({code:"custom",message:`content is required when the body carries '${_m}' — another result family cannot default into an empty tools/call success`});return}}).transform(Ay).pipe(To)}}var Uy;function G_(){return Uy??=Ly()}function Y_(e){return e.type!=="object"}var Dy=new Set(["const","enum","default","examples"]),Zy=new Set(["properties","patternProperties","$defs","definitions","dependentSchemas","dependencies"]);function q_(e){return e!==void 0&&!(typeof e==="string"&&e.startsWith("#"))}function Hy(e){let t=typeof e.$schema==="string"?e.$schema:void 0;if(q_(e.$id))return{...t!==void 0&&{$schema:t},type:"object",properties:{result:e},required:["result"]};let r=wm(e.$schema)&&e.$recursiveAnchor!==!0,o=(s,n)=>{if(Array.isArray(s))return s.map((c)=>o(c,!1));if(s===null||typeof s!=="object")return s;if(!n&&q_(s.$id))return s;let i={},a=!1;for(let[c,l]of Object.entries(s))if(n)i[c]=o(l,!1);else if((c==="$ref"||c==="$dynamicRef")&&typeof l==="string")i[c]=l==="#"?"#/properties/result":l.startsWith("#/")?`#/properties/result${l.slice(1)}`:l;else if(c==="$recursiveRef"&&l==="#"&&r)a=!0;else if(Dy.has(c))i[c]=l;else if(Zy.has(c))i[c]=o(l,!0);else i[c]=o(l,!1);if(a)if("$ref"in i)i.allOf=[...Array.isArray(i.allOf)?i.allOf:[],{$ref:"#/properties/result"}];else i.$ref="#/properties/result";return i};return{...t!==void 0&&{$schema:t},type:"object",properties:{result:o(e,!1)},required:["result"]}}var X_={ping:null,initialize:null,"completion/complete":null,"logging/setLevel":null,"prompts/get":null,"prompts/list":null,"resources/list":null,"resources/templates/list":null,"resources/read":null,"resources/subscribe":null,"resources/unsubscribe":null,"tools/call":null,"tools/list":null,"tasks/get":null,"tasks/result":null,"tasks/list":null,"tasks/cancel":null,"sampling/createMessage":null,"elicitation/create":null,"roots/list":null},Q_={"notifications/cancelled":null,"notifications/progress":null,"notifications/initialized":null,"notifications/roots/list_changed":null,"notifications/tasks/status":null,"notifications/message":null,"notifications/resources/updated":null,"notifications/resources/list_changed":null,"notifications/tools/list_changed":null,"notifications/prompts/list_changed":null,"notifications/elicitation/complete":null},Fy={ping:null,initialize:null,"completion/complete":null,"logging/setLevel":null,"prompts/get":null,"prompts/list":null,"resources/list":null,"resources/templates/list":null,"resources/read":null,"resources/subscribe":null,"resources/unsubscribe":null,"tools/call":null,"tools/list":null,"sampling/createMessage":null,"elicitation/create":null,"roots/list":null},Uc;function td(){if(Uc)return Uc;let e=G_();return Uc={requestSchemas:{ping:e.PingRequestSchema,initialize:e.InitializeRequestSchema,"completion/complete":e.CompleteRequestSchema,"logging/setLevel":e.SetLevelRequestSchema,"prompts/get":e.GetPromptRequestSchema,"prompts/list":e.ListPromptsRequestSchema,"resources/list":e.ListResourcesRequestSchema,"resources/templates/list":e.ListResourceTemplatesRequestSchema,"resources/read":e.ReadResourceRequestSchema,"resources/subscribe":e.SubscribeRequestSchema,"resources/unsubscribe":e.UnsubscribeRequestSchema,"tools/call":e.CallToolRequestSchema,"tools/list":e.ListToolsRequestSchema,"tasks/get":e.GetTaskRequestSchema,"tasks/result":e.GetTaskPayloadRequestSchema,"tasks/list":e.ListTasksRequestSchema,"tasks/cancel":e.CancelTaskRequestSchema,"sampling/createMessage":e.CreateMessageRequestSchema,"elicitation/create":e.ElicitRequestSchema,"roots/list":e.ListRootsRequestSchema},notificationSchemas:{"notifications/cancelled":e.CancelledNotificationSchema,"notifications/progress":e.ProgressNotificationSchema,"notifications/initialized":e.InitializedNotificationSchema,"notifications/roots/list_changed":e.RootsListChangedNotificationSchema,"notifications/tasks/status":e.TaskStatusNotificationSchema,"notifications/message":e.LoggingMessageNotificationSchema,"notifications/resources/updated":e.ResourceUpdatedNotificationSchema,"notifications/resources/list_changed":e.ResourceListChangedNotificationSchema,"notifications/tools/list_changed":e.ToolListChangedNotificationSchema,"notifications/prompts/list_changed":e.PromptListChangedNotificationSchema,"notifications/elicitation/complete":e.ElicitationCompleteNotificationSchema},resultSchemas:{ping:e.EmptyResultSchema,initialize:e.InitializeResultSchema,"completion/complete":e.CompleteResultSchema,"logging/setLevel":e.EmptyResultSchema,"prompts/get":e.GetPromptResultSchema,"prompts/list":e.ListPromptsResultSchema,"resources/list":e.ListResourcesResultSchema,"resources/templates/list":e.ListResourceTemplatesResultSchema,"resources/read":e.ReadResourceResultSchema,"resources/subscribe":e.EmptyResultSchema,"resources/unsubscribe":e.EmptyResultSchema,"tools/call":e.CallToolResultWireSchema,"tools/list":e.ListToolsResultSchema,"sampling/createMessage":e.CreateMessageResultWithToolsSchema,"elicitation/create":e.ElicitResultSchema,"roots/list":e.ListRootsResultSchema}},Uc}function eg(e){return Object.prototype.hasOwnProperty.call(X_,e)}function tg(e){return Object.prototype.hasOwnProperty.call(Q_,e)}function Vy(e){return Object.prototype.hasOwnProperty.call(Fy,e)}function By(e){return Vy(e)?td().resultSchemas[e]:void 0}function Jy(e){return eg(e)?td().requestSchemas[e]:void 0}function Wy(e){return tg(e)?td().notificationSchemas[e]:void 0}var Z0=Object.keys(X_),H0=Object.keys(Q_);function Jl(e){return e!==null&&typeof e==="object"&&!Array.isArray(e)}function Dc(e,t){if(e===void 0)return{ok:!1,reason:"not-in-era"};let r=e.safeParse(t);return r.success?{ok:!0,value:r.data}:{ok:!1,reason:"invalid",message:String(r.error)}}var O_={ok:!1,reason:"not-in-era"};function N_(e){return Jl(e)&&Jl(e.outputSchema)&&Y_(e.outputSchema)}function j_(e){return e}var rd={era:"2025-11-25",hasRequestMethod:eg,hasNotificationMethod:tg,validateRequest:(e,t)=>Dc(Jy(e),t),validateResult:(e,t)=>Dc(By(e),t),validateNotification:(e,t)=>Dc(Wy(e),t),hasInputRequestMethod:()=>!1,validateInputRequest:()=>O_,validateInputResponse:()=>O_,samplingResultVariant:(e,t)=>{let r=G_();return Dc(e?r.CreateMessageResultWithToolsSchema:r.CreateMessageResultSchema,t)},outboundEnvelope:(e)=>{return},validateEnvelopeMeta:(e)=>[],projectCallToolResult(e,t){let r=W_(e),o=r.structuredContent;if(o===void 0)return r;let s=typeof o!=="object"||o===null||Array.isArray(o),n=t!==void 0&&Y_(t);if(!s&&!n)return r;return{...r,structuredContent:{result:o}}},decodeResult(e,t){if(Jl(t)&&"resultType"in t){let r={...t};return delete r.resultType,{kind:"complete",result:j_(r)}}return{kind:"complete",result:j_(t)}},encodeResult(e,t){if(e!=="tools/list")return t;let r=t.tools;if(!Array.isArray(r)||!r.some((o)=>N_(o)))return t;return{...t,tools:r.map((o)=>N_(o)?{...o,outputSchema:Hy(o.outputSchema)}:o)}},encodeErrorCode:(e)=>e===-32002?-32602:e,checkInboundEnvelope:(e)=>{return}};function Ky(){let e=yn(()=>C([u(),k(),E(),Br(),T(u(),e),v(e)])),t=T(u(),e),r=C([u(),k().int()]),o=u(),s=C([u(),k().int()]),n=Y(["user","assistant"]),i=Y(["debug","info","notice","warning","error","critical","alert","emergency"]),a=u().refine((ye)=>{try{return atob(ye),!0}catch{return!1}},{message:"Invalid Base64 string"}),c=m({ttl:k().optional()}),l=m({taskId:u()}),d=V({progressToken:r.optional(),"io.modelcontextprotocol/related-task":l.optional()}),f=m({_meta:d.optional()}),h=f.extend({task:c.optional()}),g=m({_meta:d.optional()}),b=m({method:u(),params:g.loose().optional()}),_=m({src:u(),mimeType:u().optional(),sizes:v(u()).optional(),theme:Y(["light","dark"]).optional()}),w=m({icons:v(_).optional()}),I=m({name:u(),title:u().optional()}),A=I.extend({...I.shape,...w.shape,version:u(),websiteUrl:u().optional(),description:u().optional()}),z=Ft(m({applyDefaults:E().optional()}),t),q=Jr((ye)=>{if(ye&&typeof ye==="object"&&!Array.isArray(ye)&&Object.keys(ye).length===0)return{form:{}};return ye},Ft(m({form:z.optional(),url:t.optional()}),t.optional())),x=V({list:t.optional(),cancel:t.optional(),requests:V({sampling:V({createMessage:t.optional()}).optional(),elicitation:V({create:t.optional()}).optional()}).optional()}),R=V({list:t.optional(),cancel:t.optional(),requests:V({tools:V({call:t.optional()}).optional()}).optional()}),Z=m({experimental:T(u(),t).optional(),sampling:m({context:t.optional(),tools:t.optional()}).optional(),elicitation:q.optional(),roots:m({listChanged:E().optional()}).optional(),tasks:x.optional(),extensions:T(u(),t).optional()}),ee=m({experimental:T(u(),t).optional(),logging:t.optional(),completions:t.optional(),prompts:m({listChanged:E().optional()}).optional(),resources:m({subscribe:E().optional(),listChanged:E().optional()}).optional(),tools:m({listChanged:E().optional()}).optional(),tasks:R.optional(),extensions:T(u(),t).optional()}),X=m({progress:k(),total:F(k()),message:F(u())}),ne=m({...g.shape,...X.shape,progressToken:r}),xe=b.extend({method:p("notifications/progress"),params:ne}),te=g.extend({level:i,logger:u().optional(),data:D()}),ie=b.extend({method:p("notifications/message"),params:te}),re=m({uri:u(),mimeType:F(u()),_meta:T(u(),D()).optional()}),de=re.extend({text:u()}),bt=re.extend({blob:a}),Fe=m({audience:v(n).optional(),priority:k().min(0).max(1).optional(),lastModified:Ao({offset:!0}).optional()}),st=m({...I.shape,...w.shape,uri:u(),description:F(u()),mimeType:F(u()),size:F(k()),annotations:Fe.optional(),_meta:F(V({}))}),yt=m({...I.shape,...w.shape,uriTemplate:u(),description:F(u()),mimeType:F(u()),annotations:Fe.optional(),_meta:F(V({}))}),Ge=b.extend({method:p("notifications/resources/list_changed"),params:g.optional()}),Le=g.extend({uri:u()}),Dt=b.extend({method:p("notifications/resources/updated"),params:Le}),Zt=m({name:u(),description:F(u()),required:F(E())}),wt=m({...I.shape,...w.shape,description:F(u()),arguments:F(v(Zt)),_meta:F(V({}))}),Ne=b.extend({method:p("notifications/prompts/list_changed"),params:g.optional()}),Ue=m({type:p("text"),text:u(),annotations:Fe.optional(),_meta:T(u(),D()).optional()}),De=m({type:p("image"),data:a,mimeType:u(),annotations:Fe.optional(),_meta:T(u(),D()).optional()}),dt=m({type:p("audio"),data:a,mimeType:u(),annotations:Fe.optional(),_meta:T(u(),D()).optional()}),Cr=m({type:p("tool_use"),name:u(),id:u(),input:T(u(),D()),_meta:T(u(),D()).optional()}),Ye=m({type:p("resource"),resource:C([de,bt]),annotations:Fe.optional(),_meta:T(u(),D()).optional()}),Xe=st.extend({type:p("resource_link")}),Ve=C([Ue,De,dt,Xe,Ye]),nt=m({role:n,content:Ve}),it=m({title:u().optional(),readOnlyHint:E().optional(),destructiveHint:E().optional(),idempotentHint:E().optional(),openWorldHint:E().optional()}),zt=b.extend({method:p("notifications/tools/list_changed"),params:g.optional()}),Rt=m({name:u().optional()}),or=m({hints:v(Rt).optional(),costPriority:k().min(0).max(1).optional(),speedPriority:k().min(0).max(1).optional(),intelligencePriority:k().min(0).max(1).optional()}),xt=m({mode:Y(["auto","required","none"]).optional()}),Ir=m({type:p("boolean"),title:u().optional(),description:u().optional(),default:E().optional()}),N=m({type:p("string"),title:u().optional(),description:u().optional(),minLength:k().optional(),maxLength:k().optional(),format:Y(["email","uri","date","date-time"]).optional(),default:u().optional()}),kt=m({type:Y(["number","integer"]),title:u().optional(),description:u().optional(),minimum:k().optional(),maximum:k().optional(),default:k().optional()}),B=m({type:p("string"),title:u().optional(),description:u().optional(),enum:v(u()),default:u().optional()}),U=m({type:p("string"),title:u().optional(),description:u().optional(),oneOf:v(m({const:u(),title:u()})),default:u().optional()}),Q=m({type:p("string"),title:u().optional(),description:u().optional(),enum:v(u()),enumNames:v(u()).optional(),default:u().optional()}),j=C([B,U]),O=m({type:p("array"),title:u().optional(),description:u().optional(),minItems:k().optional(),maxItems:k().optional(),items:m({type:p("string"),enum:v(u())}),default:v(u()).optional()}),K=m({type:p("array"),title:u().optional(),description:u().optional(),minItems:k().optional(),maxItems:k().optional(),items:m({anyOf:v(m({const:u(),title:u()}))}),default:v(u()).optional()}),J=C([O,K]),ke=C([Q,j,J]),qr=C([ke,Ir,N,kt]),Pt=h.extend({mode:p("form").optional(),message:u(),requestedSchema:m({type:p("object"),properties:T(u(),qr),required:v(u()).optional()}).catchall(D())}),Or=m({type:p("ref/resource"),uri:u()}),Nr=m({type:p("ref/prompt"),name:u()}),Is=m({uri:u().startsWith("file://"),name:u().optional(),_meta:T(u(),D()).optional()}),sr=Z.shape,qs=m({experimental:sr.experimental,sampling:sr.sampling,elicitation:sr.elicitation,roots:sr.roots,extensions:sr.extensions}),at=ee.shape,zo=m({experimental:at.experimental,logging:at.logging,completions:at.completions,prompts:at.prompts,resources:at.resources,tools:at.tools,extensions:at.extensions}),Ro=V({progressToken:r.optional(),[Bt]:u(),[Uo]:A.optional(),[Kr]:qs,[Zo]:i.optional()}),jr=m({...I.shape,...w.shape,description:u().optional(),inputSchema:V({$schema:u().optional(),type:p("object")}),outputSchema:V({$schema:u().optional()}).optional(),annotations:it.optional(),_meta:T(u(),D()).optional()}),Os=m({type:p("tool_result"),toolUseId:u(),content:v(Ve),structuredContent:D().optional(),isError:E().optional(),_meta:T(u(),D()).optional()}),xo=C([Ue,De,dt,Cr,Os]),Mr=m({role:n,content:C([xo,v(xo)]),_meta:T(u(),D()).optional()}),ko=u(),Po=V({[$t]:A.optional().catch(void 0)}),To=Po.optional();function je(ye){return V({_meta:To,resultType:ko.default("complete"),...ye})}let Ns=je({}),ka=je({nextCursor:o.optional()}),Eo=je({content:v(Ve),structuredContent:D().optional(),isError:E().optional()}),js=je({ttlMs:k().int().min(0),cacheScope:Y(["public","private"]),tools:v(jr),nextCursor:o.optional()}),Ms=je({ttlMs:k().int().min(0),cacheScope:Y(["public","private"]),prompts:v(wt),nextCursor:o.optional()}),As=je({description:u().optional(),messages:v(nt)}),Ls=je({ttlMs:k().int().min(0),cacheScope:Y(["public","private"]),resources:v(st),nextCursor:o.optional()}),Us=je({ttlMs:k().int().min(0),cacheScope:Y(["public","private"]),resourceTemplates:v(yt),nextCursor:o.optional()}),Ds=je({ttlMs:k().int().min(0),cacheScope:Y(["public","private"]),contents:v(C([de,bt]))}),Zs=je({completion:m({values:v(u()).max(100),total:k().int().optional(),hasMore:E().optional()}).loose()}),Pa=je({ttlMs:k().int().min(0),cacheScope:Y(["public","private"])}),Hs=je({ttlMs:k().int().min(0).catch(0),cacheScope:Y(["public","private"]).catch("private"),supportedVersions:v(u()),capabilities:zo,instructions:u().optional()}),nr=m({messages:v(Mr),modelPreferences:or.optional(),systemPrompt:u().optional(),includeContext:Y(["none","thisServer","allServers"]).optional(),temperature:k().optional(),maxTokens:k().int(),stopSequences:v(u()).optional(),metadata:t.optional(),tools:v(jr).optional(),toolChoice:xt.optional()}),Fs=m({method:p("sampling/createMessage"),params:nr}),Vs=m({method:p("roots/list"),params:m({_meta:T(u(),D()).optional()}).optional()}),Bs=m({...Mr.shape,model:u(),stopReason:u().optional()}),Js=m({roots:v(Is)}),Ws=m({action:Y(["accept","decline","cancel"]),content:T(u(),C([u(),k(),E(),v(u())])).optional()}),Ks=m({mode:p("url"),message:u(),url:u().url()}),Gs=C([Pt,Ks]),Ys=m({method:p("elicitation/create"),params:Gs}),Xs=C([Fs,Vs,Ys]),Qs=C([Bs,Js,Ws]),en=T(u(),Xs),tn=T(u(),Qs),Ar=je({inputRequests:en.optional(),requestState:u().optional()}),Lr={inputResponses:tn.optional(),requestState:u().optional()},Ta=m({_meta:Ro,...Lr}),Ea=V({progressToken:r.optional()});function Qe(ye,Dr){return m({method:p(ye),params:m({_meta:Ro,...Dr})})}function et(ye,Dr){return m({method:p(ye),params:m({_meta:Ea.optional(),...Dr}).optional()})}let rn={name:u(),arguments:T(u(),D()).optional(),...Lr},mt={cursor:o.optional()},$a=Qe("tools/call",rn),Ca=Qe("tools/list",mt),Ia=Qe("prompts/list",mt),qa=Qe("prompts/get",{name:u(),arguments:T(u(),u()).optional(),...Lr}),Oa=Qe("resources/list",mt),Na=Qe("resources/templates/list",mt),ja=Qe("resources/read",{uri:u(),...Lr}),on={ref:C([Nr,Or]),argument:m({name:u(),value:u()}),context:m({arguments:T(u(),u()).optional()}).optional()},Ma=Qe("completion/complete",on),Aa=Qe("server/discover",{}),$o=m({toolsListChanged:E().optional(),promptsListChanged:E().optional(),resourcesListChanged:E().optional(),resourceSubscriptions:v(u()).optional()}),sn={notifications:$o},La=Qe("subscriptions/listen",sn),Ua=Po.extend({"io.modelcontextprotocol/subscriptionId":s}),nn=V({_meta:Ua,resultType:ko.default("complete")}),ir={"tools/call":et("tools/call",rn),"tools/list":et("tools/list",mt),"prompts/get":et("prompts/get",{name:u(),arguments:T(u(),u()).optional()}),"prompts/list":et("prompts/list",mt),"resources/list":et("resources/list",mt),"resources/templates/list":et("resources/templates/list",mt),"resources/read":et("resources/read",{uri:u()}),"completion/complete":et("completion/complete",on),"server/discover":et("server/discover",{}),"subscriptions/listen":et("subscriptions/listen",sn)};function Be(ye){return V({_meta:To,...ye})}let Da={"tools/call":Be({content:v(Ve),structuredContent:D().optional(),isError:E().optional()}),"tools/list":Be({ttlMs:k().int().min(0),cacheScope:Y(["public","private"]),tools:v(jr),nextCursor:o.optional()}),"prompts/get":Be({description:u().optional(),messages:v(nt)}),"prompts/list":Be({ttlMs:k().int().min(0),cacheScope:Y(["public","private"]),prompts:v(wt),nextCursor:o.optional()}),"resources/list":Be({ttlMs:k().int().min(0),cacheScope:Y(["public","private"]),resources:v(st),nextCursor:o.optional()}),"resources/templates/list":Be({ttlMs:k().int().min(0),cacheScope:Y(["public","private"]),resourceTemplates:v(yt),nextCursor:o.optional()}),"resources/read":Be({ttlMs:k().int().min(0),cacheScope:Y(["public","private"]),contents:v(C([de,bt]))}),"completion/complete":Be({completion:m({values:v(u()).max(100),total:k().int().optional(),hasMore:E().optional()}).loose()}),"server/discover":Be({ttlMs:k().int().min(0).catch(0),cacheScope:Y(["public","private"]).catch("private"),supportedVersions:v(u()),capabilities:zo,instructions:u().optional()}),"subscriptions/listen":Be({})},Ur=V({"io.modelcontextprotocol/subscriptionId":s.optional()}),Co=m({method:p("notifications/subscriptions/acknowledged"),params:m({_meta:Ur.optional(),notifications:$o})}),Io=m({_meta:Ur.optional(),requestId:s,reason:u().optional()}),qo=m({method:p("notifications/cancelled"),params:Io}),Tu={"notifications/cancelled":qo,"notifications/progress":xe,"notifications/message":ie,"notifications/resources/updated":Dt,"notifications/resources/list_changed":Ge,"notifications/tools/list_changed":zt,"notifications/prompts/list_changed":Ne,"notifications/subscriptions/acknowledged":Co},Ze=(ye)=>m({jsonrpc:p("2.0"),id:C([u(),k().int()]),result:ye}).strict();return{JSONValueSchema:e,JSONObjectSchema:t,ProgressTokenSchema:r,CursorSchema:o,RequestIdSchema:s,RoleSchema:n,LoggingLevelSchema:i,TaskMetadataSchema:c,RelatedTaskMetadataSchema:l,RequestMetaSchema:d,BaseRequestParamsSchema:f,TaskAugmentedRequestParamsSchema:h,NotificationsParamsSchema:g,NotificationSchema:b,IconSchema:_,IconsSchema:w,BaseMetadataSchema:I,ImplementationSchema:A,ClientTasksCapabilitySchema:x,ServerTasksCapabilitySchema:R,ClientCapabilitiesSchema:Z,ServerCapabilitiesSchema:ee,ProgressSchema:X,ProgressNotificationParamsSchema:ne,ProgressNotificationSchema:xe,LoggingMessageNotificationParamsSchema:te,LoggingMessageNotificationSchema:ie,ResourceContentsSchema:re,TextResourceContentsSchema:de,BlobResourceContentsSchema:bt,AnnotationsSchema:Fe,ResourceSchema:st,ResourceTemplateSchema:yt,ResourceListChangedNotificationSchema:Ge,ResourceUpdatedNotificationParamsSchema:Le,ResourceUpdatedNotificationSchema:Dt,PromptArgumentSchema:Zt,PromptSchema:wt,PromptListChangedNotificationSchema:Ne,TextContentSchema:Ue,ImageContentSchema:De,AudioContentSchema:dt,ToolUseContentSchema:Cr,EmbeddedResourceSchema:Ye,ResourceLinkSchema:Xe,ContentBlockSchema:Ve,PromptMessageSchema:nt,ToolAnnotationsSchema:it,ToolListChangedNotificationSchema:zt,ModelHintSchema:Rt,ModelPreferencesSchema:or,ToolChoiceSchema:xt,BooleanSchemaSchema:Ir,StringSchemaSchema:N,NumberSchemaSchema:kt,UntitledSingleSelectEnumSchemaSchema:B,TitledSingleSelectEnumSchemaSchema:U,LegacyTitledEnumSchemaSchema:Q,SingleSelectEnumSchemaSchema:j,UntitledMultiSelectEnumSchemaSchema:O,TitledMultiSelectEnumSchemaSchema:K,MultiSelectEnumSchemaSchema:J,EnumSchemaSchema:ke,PrimitiveSchemaDefinitionSchema:qr,ElicitRequestFormParamsSchema:Pt,ResourceTemplateReferenceSchema:Or,PromptReferenceSchema:Nr,RootSchema:Is,ClientCapabilities2026Schema:qs,ServerCapabilities2026Schema:zo,RequestMetaEnvelopeSchema:Ro,ToolSchema:jr,ToolResultContentSchema:Os,SamplingMessageContentBlockSchema:xo,SamplingMessageSchema:Mr,ResultTypeSchema:ko,ResultMetaSchema:Po,ResultSchema:Ns,PaginatedResultSchema:ka,CallToolResultSchema:Eo,ListToolsResultSchema:js,ListPromptsResultSchema:Ms,GetPromptResultSchema:As,ListResourcesResultSchema:Ls,ListResourceTemplatesResultSchema:Us,ReadResourceResultSchema:Ds,CompleteResultSchema:Zs,CacheableResultSchema:Pa,DiscoverResultSchema:Hs,CreateMessageRequestParamsSchema:nr,CreateMessageRequestSchema:Fs,ListRootsRequestSchema:Vs,CreateMessageResultSchema:Bs,ListRootsResultSchema:Js,ElicitResultSchema:Ws,ElicitRequestURLParamsSchema:Ks,ElicitRequestParamsSchema:Gs,ElicitRequestSchema:Ys,InputRequestSchema:Xs,InputResponseSchema:Qs,InputRequestsSchema:en,InputResponsesSchema:tn,InputRequiredResultSchema:Ar,InputResponseRequestParamsSchema:Ta,CallToolRequestSchema:$a,ListToolsRequestSchema:Ca,ListPromptsRequestSchema:Ia,GetPromptRequestSchema:qa,ListResourcesRequestSchema:Oa,ListResourceTemplatesRequestSchema:Na,ReadResourceRequestSchema:ja,CompleteRequestSchema:Ma,DiscoverRequestSchema:Aa,SubscriptionFilterSchema:$o,SubscriptionsListenRequestSchema:La,SubscriptionsListenResultMetaSchema:Ua,SubscriptionsListenResultSchema:nn,dispatchRequestSchemas:ir,dispatchResultSchemas:Da,NotificationMetaSchema:Ur,SubscriptionsAcknowledgedNotificationSchema:Co,CancelledNotificationParamsSchema:Io,CancelledNotificationSchema:qo,notificationSchemas2026:Tu,JSONRPCResultResponseSchema:Ze(Ns),CallToolResultResponseSchema:Ze(C([Eo,Ar])),ListToolsResultResponseSchema:Ze(js),ListPromptsResultResponseSchema:Ze(Ms),GetPromptResultResponseSchema:Ze(C([As,Ar])),ListResourcesResultResponseSchema:Ze(Ls),ListResourceTemplatesResultResponseSchema:Ze(Us),ReadResourceResultResponseSchema:Ze(C([Ds,Ar])),CompleteResultResponseSchema:Ze(Zs),DiscoverResultResponseSchema:Ze(Hs),SubscriptionsListenResultResponseSchema:Ze(nn)}}var Gy;function Sr(){return Gy??=Ky()}var Yy=["tools/list","prompts/list","resources/list","resources/templates/list","resources/read","server/discover"];function Xy(e){return Yy.includes(e)}var od=Symbol("modelcontextprotocol.resultCacheHintFallback");function Qy(e){return e[od]}function rg(e){return typeof e==="number"&&Number.isSafeInteger(e)&&e>=0}function og(e){return e==="public"||e==="private"}var W=function(e){return e[e.ParseError=-32700]="ParseError",e[e.InvalidRequest=-32600]="InvalidRequest",e[e.MethodNotFound=-32601]="MethodNotFound",e[e.InvalidParams=-32602]="InvalidParams",e[e.InternalError=-32603]="InternalError",e[e.ResourceNotFound=-32002]="ResourceNotFound",e[e.MissingRequiredClientCapability=-32021]="MissingRequiredClientCapability",e[e.UnsupportedProtocolVersion=-32022]="UnsupportedProtocolVersion",e[e.UrlElicitationRequired=-32042]="UrlElicitationRequired",e}({}),se=class e extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.ProtocolError"})}static[Symbol.hasInstance](t){return We(this,t)}static isInstance(t){if(typeof this!=="function")throw TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return We(this,t)}constructor(t,r,o){super(r);this.code=t,this.data=o,this.name="ProtocolError",vr(this,new.target)}static fromError(t,r,o){if(t===W.UrlElicitationRequired&&o){let s=o;if(s.elicitations)return new ng(s.elicitations,r)}if(t===W.UnsupportedProtocolVersion&&o){let s=o;if(Array.isArray(s.supported)&&typeof s.requested==="string")return new aa({supported:s.supported,requested:s.requested},r)}if(t===W.InvalidParams||t===W.ResourceNotFound){let s=o;if(typeof s?.uri==="string"&&(t===W.ResourceNotFound||Object.keys(s).length===1))return new sg(s.uri,r)}if(t===W.MissingRequiredClientCapability&&o){let s=o;if(s.requiredCapabilities!==null&&typeof s.requiredCapabilities==="object"&&!Array.isArray(s.requiredCapabilities))return new ig({requiredCapabilities:s.requiredCapabilities},r)}return new e(t,r,o)}},sg=class extends se{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.ResourceNotFoundError"})}constructor(e,t=`Resource not found: ${e}`){super(W.InvalidParams,t,{uri:e})}get uri(){return this.data.uri}},ng=class extends se{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.UrlElicitationRequiredError"})}constructor(e,t=`URL elicitation${e.length>1?"s":""} required`){super(W.UrlElicitationRequired,t,{elicitations:e})}get elicitations(){return this.data?.elicitations??[]}},aa=class extends se{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.UnsupportedProtocolVersionError"})}constructor(e,t=`Unsupported protocol version: ${e.requested}`){super(W.UnsupportedProtocolVersion,t,e)}get supported(){return this.data.supported}get requested(){return this.data.requested}},ig=class extends se{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.MissingRequiredClientCapabilityError"})}constructor(e,t=`Missing required client capabilities: ${Object.keys(e.requiredCapabilities).join(", ")}`){super(W.MissingRequiredClientCapability,t,e)}get requiredCapabilities(){return this.data.requiredCapabilities}},ew=0,tw="private",rw=["tools/call","prompts/get","resources/read"];function ow(e,t){let r=t.resultType;if(r===void 0)return{...t,resultType:"complete"};if(r==="complete")return t;if(rw.includes(e))return t;throw new se(W.InternalError,`Handler for ${e} returned resultType '${String(r)}', but results of ${e} only support 'complete' on protocol revision 2026-07-28`)}function sw(e,t){let r=Qy(t);if(t.resultType!=="complete"||!Xy(e))return r===void 0?t:uw(t);let o=t,s=rg(o.ttlMs)?o.ttlMs:aw(r),n=og(o.cacheScope)?o.cacheScope:cw(r),i={...o,ttlMs:s,cacheScope:n};return delete i[od],i}function nw(e){return e!==null&&typeof e==="object"&&!Array.isArray(e)}function iw(e,t){if(t===void 0)return e;let r=e._meta;if(r===void 0)return{...e,_meta:{[$t]:t}};if(!nw(r))return e;if(r[$t]!==void 0)return e;return{...e,_meta:{...r,[$t]:t}}}function aw(e){return e!==void 0&&rg(e.ttlMs)?e.ttlMs:ew}function cw(e){return e!==void 0&&og(e.cacheScope)?e.cacheScope:tw}function uw(e){let t={...e};return delete t[od],t}var lw=["elicitation/create","sampling/createMessage","roots/list"],Zc;function ag(){if(Zc)return Zc;let e=Sr();return Zc={request:{"elicitation/create":m({method:p("elicitation/create"),params:e.ElicitRequestParamsSchema}),"sampling/createMessage":m({method:p("sampling/createMessage"),params:e.CreateMessageRequestParamsSchema}),"roots/list":m({method:p("roots/list"),params:V({}).optional()})},response:{"elicitation/create":e.ElicitResultSchema,"sampling/createMessage":e.CreateMessageResultSchema,"roots/list":e.ListRootsResultSchema}},Zc}function cg(e){return lw.includes(e)}function Zl(e){return cg(e)?ag().request[e]:void 0}function dw(e){return cg(e)?ag().response[e]:void 0}var sd={"tools/call":null,"tools/list":null,"prompts/get":null,"prompts/list":null,"resources/list":null,"resources/templates/list":null,"resources/read":null,"completion/complete":null,"server/discover":null,"subscriptions/listen":null},ug={"notifications/cancelled":null,"notifications/progress":null,"notifications/message":null,"notifications/resources/updated":null,"notifications/resources/list_changed":null,"notifications/tools/list_changed":null,"notifications/prompts/list_changed":null,"notifications/subscriptions/acknowledged":null};function lg(e){return Object.prototype.hasOwnProperty.call(sd,e)}function dg(e){return Object.prototype.hasOwnProperty.call(ug,e)}function mw(e){return Object.prototype.hasOwnProperty.call(sd,e)}function pw(e){return lg(e)?Sr().dispatchRequestSchemas[e]:void 0}function hw(e){return mw(e)?Sr().dispatchResultSchemas[e]:void 0}function fw(e){return dg(e)?Sr().notificationSchemas2026[e]:void 0}var F0=Object.keys(sd),V0=Object.keys(ug);function oa(e){return e!==null&&typeof e==="object"&&!Array.isArray(e)}function ta(e,t){if(e===void 0)return{ok:!1,reason:"not-in-era"};let r=e.safeParse(t);return r.success?{ok:!0,value:r.data}:{ok:!1,reason:"invalid",message:String(r.error)}}var _w={ok:!1,reason:"not-in-era"},gw=[Bt,Kr];function Sw(e,t){let r=t,o=!1,s=()=>{if(!o)r={...r},o=!0;return r},n=t.tools;if(e==="tools/list"&&Array.isArray(n)&&n.some((a)=>oa(a)&&("execution"in a)))s().tools=n.map((a)=>{if(!oa(a)||!("execution"in a))return a;let c={...a};return delete c.execution,c});let i=t.capabilities;if(oa(i)&&"tasks"in i){let a={...i};delete a.tasks,s().capabilities=a}return r}var nd={era:"2026-07-28",hasRequestMethod:lg,hasNotificationMethod:dg,hasInputRequestMethod:(e)=>Zl(e)!==void 0,validateRequest:(e,t)=>ta(pw(e),t),validateResult:(e,t)=>ta(hw(e),t),validateNotification:(e,t)=>ta(fw(e),t),validateInputRequest:(e,t)=>ta(Zl(e),t),validateInputResponse:(e,t)=>ta(dw(e),t),samplingResultVariant:()=>_w,outboundEnvelope(e){return{[Bt]:e.protocolVersion,[Uo]:e.clientInfo,[Kr]:e.clientCapabilities,...e.logLevel!==void 0&&{[Zo]:e.logLevel}}},validateEnvelopeMeta(e){let t=[];for(let o of gw)if(!(o in e))t.push({key:o,problem:"missing"});let r=Sr().RequestMetaEnvelopeSchema.safeParse(e);if(!r.success)for(let o of r.error.issues){let s=o.path.map(String),n=s.length>0?s.join("."):"_meta";if(s.length===1&&t.some((i)=>i.key===n&&i.problem==="missing"))continue;t.push({key:n,problem:o.message})}return t},projectCallToolResult:(e)=>W_(e),inputRequestSchema:Zl,decodeResult(e,t){if(!oa(t))return{kind:"invalid",error:new L(M.InvalidResult,`Invalid result for ${e}: not an object`,{method:e})};let r=t.resultType;if(r===void 0)return{kind:"invalid",error:new L(M.InvalidResult,`Invalid result for ${e}: missing required resultType — servers implementing protocol revision 2026-07-28 MUST include it (the absent-means-complete bridge applies only to earlier-revision servers)`,{method:e,violation:"missing-resultType"})};if(typeof r!=="string")return{kind:"invalid",error:new L(M.InvalidResult,`Invalid result for ${e}: non-string resultType`,{method:e,resultType:r})};if(r==="input_required"){let i=t.inputRequests,a=oa(i)?i:{},c=t.requestState,l=t._meta===void 0?void 0:Sr().ResultMetaSchema.safeParse(t._meta),d=l?.success?l.data:void 0;if(Object.keys(a).length===0&&typeof c!=="string")return{kind:"invalid",error:new L(M.InvalidResult,`Invalid result for ${e}: input_required carries neither inputRequests nor requestState (every input_required result must include at least one of the two)`,{method:e,violation:"input-required-missing-both"})};return{kind:"input_required",inputRequests:a,...typeof c==="string"&&{requestState:c},...d!==void 0&&{_meta:d}}}if(r!=="complete")return{kind:"invalid",error:new L(M.UnsupportedResultType,`Unsupported result type '${r}' for ${e}`,{resultType:r,method:e})};let o=vw(),s=Object.hasOwn(o,e)?o[e]:void 0;if(s!==void 0){let i=s.safeParse(t);if(!i.success)return{kind:"invalid",error:new L(M.InvalidResult,`Invalid result for ${e}: ${i.error}`,{method:e})}}let n={...t};return delete n.resultType,{kind:"complete",result:n}},encodeResult(e,t,r){return iw(sw(e,ow(e,Sw(e,t))),r)},encodeErrorCode:(e)=>e===-32002?-32602:e,checkInboundEnvelope(e){if(e.envelope===void 0)return"Request is missing the required _meta envelope for protocol revision 2026-07-28 (io.modelcontextprotocol/protocolVersion, io.modelcontextprotocol/clientCapabilities)";let t=Sr().RequestMetaEnvelopeSchema.safeParse(e.envelope);if(!t.success)return`Invalid _meta envelope for protocol revision 2026-07-28: ${t.error.issues.map((r)=>r.message).join("; ")}`}},Hc;function vw(){if(Hc)return Hc;let e=Sr();return Hc={"tools/call":e.CallToolResultSchema,"tools/list":e.ListToolsResultSchema,"prompts/get":e.GetPromptResultSchema,"prompts/list":e.ListPromptsResultSchema,"resources/list":e.ListResourcesResultSchema,"resources/templates/list":e.ListResourceTemplatesResultSchema,"resources/read":e.ReadResourceResultSchema,"completion/complete":e.CompleteResultSchema,"server/discover":e.DiscoverResultSchema},Hc}var Jc="2026-07-28";function Xt(e){return e!==void 0&&Nt(e)?nd:rd}function M_(e){if(e.revision!==void 0)return Xt(e.revision).era;return e.era==="modern"?nd.era:rd.era}function Hl(e){return mg.some((t)=>t.hasRequestMethod(e))}function Fl(e){return mg.some((t)=>t.hasNotificationMethod(e))}function A_(e){return e==="tasks/get"||e==="tasks/cancel"}var mg=[rd,nd],bw=vm({AnnotationsSchema:()=>It,AudioContentSchema:()=>ro,BaseMetadataSchema:()=>Et,BaseRequestParamsSchema:()=>Te,BlobResourceContentsSchema:()=>os,BooleanSchemaSchema:()=>as,CallToolRequestParamsSchema:()=>hi,CallToolRequestSchema:()=>fi,CallToolResultSchema:()=>gr,CancelTaskRequestSchema:()=>$c,CancelTaskResultSchema:()=>Cc,CancelledNotificationParamsSchema:()=>Rn,CancelledNotificationSchema:()=>Ko,ClientCapabilitiesSchema:()=>kn,ClientNotificationSchema:()=>qc,ClientRequestSchema:()=>Ic,ClientResultSchema:()=>Oc,ClientTasksCapabilitySchema:()=>Sc,CompatibilityCallToolResultSchema:()=>bc,CompleteRequestParamsSchema:()=>Zi,CompleteRequestSchema:()=>Hi,CompleteResultSchema:()=>Fi,ContentBlockSchema:()=>qt,CreateMessageRequestParamsSchema:()=>Pi,CreateMessageRequestSchema:()=>Ti,CreateMessageResultSchema:()=>Ei,CreateMessageResultWithToolsSchema:()=>$i,CreateTaskResultSchema:()=>wc,CursorSchema:()=>Fo,DiscoverRequestSchema:()=>En,DiscoverResultSchema:()=>fr,ElicitRequestFormParamsSchema:()=>co,ElicitRequestParamsSchema:()=>Ni,ElicitRequestSchema:()=>ji,ElicitRequestURLParamsSchema:()=>Oi,ElicitResultSchema:()=>Li,ElicitationCompleteNotificationParamsSchema:()=>Mi,ElicitationCompleteNotificationSchema:()=>Ai,EmbeddedResourceSchema:()=>oo,EmptyResultSchema:()=>hr,EnumSchemaSchema:()=>qi,GetPromptRequestParamsSchema:()=>si,GetPromptRequestSchema:()=>ni,GetPromptResultSchema:()=>ci,GetTaskPayloadRequestSchema:()=>kc,GetTaskPayloadResultSchema:()=>Pc,GetTaskRequestSchema:()=>Rc,GetTaskResultSchema:()=>xc,IconSchema:()=>xn,IconsSchema:()=>Jt,ImageContentSchema:()=>to,ImplementationSchema:()=>Ct,InitializeRequestParamsSchema:()=>Pn,InitializeRequestSchema:()=>Go,InitializeResultSchema:()=>Tn,InitializedNotificationSchema:()=>Xo,JSONArraySchema:()=>_c,JSONObjectSchema:()=>fe,JSONRPCErrorResponseSchema:()=>Xr,JSONRPCMessageSchema:()=>_t,JSONRPCNotificationSchema:()=>Wo,JSONRPCRequestSchema:()=>Jo,JSONRPCResponseSchema:()=>gc,JSONRPCResultResponseSchema:()=>Yr,JSONValueSchema:()=>Vt,LegacyTitledEnumSchemaSchema:()=>ls,ListChangedOptionsBaseSchema:()=>gi,ListPromptsRequestSchema:()=>ri,ListPromptsResultSchema:()=>oi,ListResourceTemplatesRequestSchema:()=>jn,ListResourceTemplatesResultSchema:()=>Mn,ListResourcesRequestSchema:()=>On,ListResourcesResultSchema:()=>Nn,ListRootsRequestSchema:()=>Bi,ListRootsResultSchema:()=>Ji,ListTasksRequestSchema:()=>Tc,ListTasksResultSchema:()=>Ec,ListToolsRequestSchema:()=>mi,ListToolsResultSchema:()=>pi,LoggingLevelSchema:()=>is,LoggingMessageNotificationParamsSchema:()=>bi,LoggingMessageNotificationSchema:()=>no,ModelHintSchema:()=>yi,ModelPreferencesSchema:()=>wi,MultiSelectEnumSchemaSchema:()=>Ii,NotificationSchema:()=>qe,NotificationsParamsSchema:()=>Ae,NumberSchemaSchema:()=>ao,PaginatedRequestParamsSchema:()=>In,PaginatedRequestSchema:()=>Wt,PaginatedResultSchema:()=>Kt,PingRequestSchema:()=>Qo,PrimitiveSchemaDefinitionSchema:()=>ps,ProgressNotificationParamsSchema:()=>Cn,ProgressNotificationSchema:()=>es,ProgressSchema:()=>$n,ProgressTokenSchema:()=>Ho,PromptArgumentSchema:()=>ei,PromptListChangedNotificationSchema:()=>ui,PromptMessageSchema:()=>ai,PromptReferenceSchema:()=>Di,PromptSchema:()=>ti,ReadResourceRequestParamsSchema:()=>An,ReadResourceRequestSchema:()=>Ln,ReadResourceResultSchema:()=>Un,RelatedTaskMetadataSchema:()=>zn,RequestIdSchema:()=>ft,RequestMetaSchema:()=>Vo,RequestSchema:()=>_e,ResourceContentsSchema:()=>ts,ResourceLinkSchema:()=>so,ResourceListChangedNotificationSchema:()=>Dn,ResourceRequestParamsSchema:()=>Qr,ResourceSchema:()=>ss,ResourceTemplateReferenceSchema:()=>Ui,ResourceTemplateSchema:()=>qn,ResourceUpdatedNotificationParamsSchema:()=>Xn,ResourceUpdatedNotificationSchema:()=>Qn,ResultMetaObjectSchema:()=>Bo,ResultSchema:()=>ge,RoleSchema:()=>Gt,RootSchema:()=>Vi,RootsListChangedNotificationSchema:()=>Wi,SamplingContentSchema:()=>xi,SamplingMessageContentBlockSchema:()=>mr,SamplingMessageSchema:()=>ki,ServerCapabilitiesSchema:()=>Yo,ServerNotificationSchema:()=>jc,ServerRequestSchema:()=>Nc,ServerResultSchema:()=>Mc,ServerTasksCapabilitySchema:()=>vc,SetLevelRequestParamsSchema:()=>Si,SetLevelRequestSchema:()=>vi,SingleSelectEnumSchemaSchema:()=>Ci,StringSchemaSchema:()=>io,SubscribeRequestParamsSchema:()=>Zn,SubscribeRequestSchema:()=>Hn,SubscriptionFilterSchema:()=>ns,SubscriptionsAcknowledgedNotificationParamsSchema:()=>Wn,SubscriptionsAcknowledgedNotificationSchema:()=>Kn,SubscriptionsListenRequestParamsSchema:()=>Bn,SubscriptionsListenRequestSchema:()=>Jn,SubscriptionsListenResultMetaSchema:()=>Gn,SubscriptionsListenResultSchema:()=>Yn,TaskAugmentedRequestParamsSchema:()=>pr,TaskCreationParamsSchema:()=>yc,TaskMetadataSchema:()=>wn,TaskSchema:()=>Yt,TaskStatusNotificationParamsSchema:()=>Gi,TaskStatusNotificationSchema:()=>zc,TaskStatusSchema:()=>Ki,TextContentSchema:()=>eo,TextResourceContentsSchema:()=>rs,TitledMultiSelectEnumSchemaSchema:()=>ms,TitledSingleSelectEnumSchemaSchema:()=>us,ToolAnnotationsSchema:()=>li,ToolChoiceSchema:()=>zi,ToolExecutionSchema:()=>di,ToolListChangedNotificationSchema:()=>_i,ToolResultContentSchema:()=>Ri,ToolSchema:()=>_r,ToolUseContentSchema:()=>ii,UnsubscribeRequestParamsSchema:()=>Fn,UnsubscribeRequestSchema:()=>Vn,UntitledMultiSelectEnumSchemaSchema:()=>ds,UntitledSingleSelectEnumSchemaSchema:()=>cs});var yr=(e)=>Jo.safeParse(e).success,pg=(e)=>Wo.safeParse(e).success,po=(e)=>Yr.safeParse(e).success,ho=(e)=>Xr.safeParse(e).success;var hg=(e)=>typeof e==="object"&&e!==null&&!Array.isArray(e)&&e.resultType==="input_required";var id=(e)=>Go.safeParse(e).success,fg=(e)=>Xo.safeParse(e).success;var yw="Mcp-Param-",L_="x-mcp-header",ww=/^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/,zw=new Set(["string","integer","boolean"]);function ad(e){let t=[],r=new Map,o,s=(i,a,c)=>{if(i===null||typeof i!=="object")return;let l=i;if(L_ in l){if(!c||a.length===0)return`${Fc(a)}: x-mcp-header is only permitted on properties statically reachable via a chain of 'properties' keys (not under items, additionalProperties, oneOf/anyOf/allOf/not, if/then/else, or $ref)`;let f=l[L_];if(typeof f!=="string"||f.length===0)return`${Fc(a)}: x-mcp-header MUST be a non-empty string`;if(!ww.test(f))return`${Fc(a)}: x-mcp-header '${f}' is not a valid RFC 9110 token (no spaces, control characters or HTTP delimiters)`;let h=typeof l.type==="string"?l.type:void 0;if(h===void 0||!zw.has(h)){let _=`${Fc(a)}: x-mcp-header is only permitted on primitive-typed properties (string, integer, boolean); got ${h??"<none>"}`;if(h!=="number")return _;o??=_}let g=f.toLowerCase(),b=r.get(g);if(b!==void 0)return`x-mcp-header '${f}' is not case-insensitively unique (also declared as '${b}')`;r.set(g,f),t.push({path:a,headerName:f,type:h})}let d=l.properties;if(d!==null&&typeof d==="object")for(let[f,h]of Object.entries(d)){let g=s(h,[...a,f],c);if(g!==void 0)return g}for(let f of Rw){let h=l[f];if(h===void 0)continue;let g=Array.isArray(h)?h:h!==null&&typeof h==="object"&&xw.has(f)?Object.values(h):[h];for(let b of g){let _=s(b,[...a,`<${f}>`],!1);if(_!==void 0)return _}}},n=s(e,[],!0);if(n!==void 0)return{valid:!1,reason:o??n};return o===void 0?{valid:!0,declarations:t}:{valid:!1,reason:o,declarations:t}}var Rw=["items","prefixItems","contains","additionalProperties","unevaluatedProperties","unevaluatedItems","propertyNames","patternProperties","dependentSchemas","oneOf","anyOf","allOf","not","if","then","else","$defs","definitions"],xw=new Set(["patternProperties","dependentSchemas","$defs","definitions"]);function Fc(e){return e.length===0?"<root>":e.join(".")}var _g="=?base64?",gg="?=";function kw(e){if(typeof e==="string")return e;if(typeof e==="boolean")return e?"true":"false";if(typeof e==="number"){if(!Number.isFinite(e))return;if(Number.isInteger(e)&&!Number.isSafeInteger(e))return;return String(e)}}function Pw(e){if(e.length===0)return!0;if(e.startsWith(_g)&&e.endsWith(gg))return!0;if(e!==e.trim())return!0;for(let t=0;t<e.length;t++){let r=e.codePointAt(t);if(r===9||r>=32&&r<=126)continue;return!0}return!1}function Tw(e){let t=new TextEncoder().encode(e),r="";for(let o of t)r+=String.fromCodePoint(o);return btoa(r)}function cd(e){return Pw(e)?`${_g}${Tw(e)}${gg}`:e}function Ew(e,t){let r=e;for(let o of t){if(r===null||typeof r!=="object")return;r=r[o]}return r}function Sg(e,t){let r={};for(let o of e){let s=Ew(t,o.path);if(s===void 0||s===null)continue;let n=kw(s);if(n===void 0)continue;r[`${yw}${o.headerName}`]=cd(n)}return r}var gs=-32020,B0=[{rung:"http-method",order:1,evaluatedAt:"edge",codes:[-32000],conformance:[],rationale:"The modern era is POST-only; GET/DELETE are body-less 2025-era session operations and are method-routed to legacy serving (405 when legacy serving is not configured), before any body is read."},{rung:"jsonrpc-shape",order:2,evaluatedAt:"edge",codes:[W.InvalidRequest],conformance:["server-stateless"],rationale:"The body must be a JSON-RPC request or notification: posted responses and batch arrays containing a modern or invalid element are rejected before classification (element-wise batch rule); all-legacy arrays stay legacy traffic."},{rung:"era-classification",order:3,evaluatedAt:"edge",codes:[gs,W.UnsupportedProtocolVersion],conformance:["server-stateless","http-header-validation","http-custom-header-server-validation"],rationale:"Body-primary era classification with the protocol-version header as a cross-check; a header/body disagreement is rejected with -32020 (HeaderMismatch), and an envelope-less request on a modern-only endpoint is answered with the unsupported-protocol-version error naming the supported revisions."},{rung:"envelope",order:4,evaluatedAt:"edge",codes:[W.InvalidParams],conformance:["server-stateless"],rationale:"A present envelope claim with a malformed envelope — and a missing envelope on a request whose protocol-version header names a modern revision — is an invalid-params rejection naming the offending or missing key(s); never a silent fall back to legacy handling. This is the only place an invalid-params rejection maps to HTTP 400."},{rung:"method-registry",order:5,evaluatedAt:"dispatch",codes:[W.MethodNotFound],conformance:["server-stateless"],rationale:"Method existence outranks parameter validity: a method absent from the negotiated revision’s registry (or with no handler installed) answers method-not-found before params or capabilities are looked at."},{rung:"request-params",order:6,evaluatedAt:"dispatch",codes:[W.InvalidParams],conformance:[],rationale:"Per-method params validation; emitted in-band by the dispatch layer (HTTP 200), never via the ladder status table."},{rung:"standard-header-validation",order:7,evaluatedAt:"pre-dispatch",codes:[gs],conformance:["http-header-validation"],rationale:"SEP-2243 standard `MCP-Protocol-Version` / `Mcp-Method` / `Mcp-Name` headers — presence, sentinel decoding, and `Mcp-Name` ↔ body cross-check — are validated by the HTTP entry on a modern-classified request after the supported-revision gate and before dispatch. The spec requires `MCP-Protocol-Version` and `Mcp-Method` on every modern *request* POST (`Mcp-Name` only for the methods that mirror `params.name` / `params.uri` / `params.taskId`, see `MCP_NAME_HEADER_SOURCE`) and names them in that order, so a request missing several is answered by the earliest. Notification POSTs are exempt: the presence half runs on requests only, so a modern-enveloped notification is dispatched even with no standard headers at all. The classifier’s own header-mismatch cells (protocol-version, `Mcp-Method` mismatch) stay on the edge `era-classification` rung; this rung carries the entry-layer presence/`Mcp-Name` half — including the missing `MCP-Protocol-Version` cell, which cannot live on the edge rung without breaking body-primary classification. Evaluated before the capability gate, the factory call, and the `Mcp-Param-*` rung so a request that fails several rungs is answered by the standard-header rung first. The documented order (after method-registry 5 and request-params 6) is NOT the observed precedence: serveModern evaluates this rung immediately after the supported-revision gate, so a request that also fails a dispatch rung is answered here before the dispatch rungs (5–6) are consulted."},{rung:"client-capabilities",order:8,evaluatedAt:"pre-dispatch",codes:[W.MissingRequiredClientCapability],conformance:["server-stateless"],rationale:"The capability requirement is checked by the HTTP entry, pre-dispatch, against the validated envelope the classifier produced — pinning the spec-mandated HTTP 400 independently of how dispatch- and handler-produced errors are mapped. The documented order (after method resolution and params validation) is preserved observably only while the requirement table is empty: once a served method gains a requirement entry, a request that is missing the capability and would also fail a dispatch rung is answered by this gate first, so the entry must consult the method registry before the gate if the documented precedence is to stay observable."},{rung:"param-header-validation",order:9,evaluatedAt:"pre-dispatch",codes:[gs],conformance:["http-custom-header-server-validation"],rationale:"SEP-2243 `Mcp-Param-*` headers are validated against the named tool’s `x-mcp-header` declarations and the body `arguments` after the tool registry is known and before dispatch reaches the handler; a missing/disagreeing/malformed header is rejected 400 / -32020 with the same shape as the standard-header cross-checks. The documented order (after method resolution and params validation) is preserved observably only when the body `arguments` would otherwise validate: the check runs pre-dispatch, so a `tools/call` that fails BOTH this rung and a dispatch-time rung (e.g. order-6 `request-params`, -32602) is answered by this gate first with 400 / -32020, not by the earlier-ordered rung."}],J0={[W.ParseError]:400,[W.InvalidRequest]:400,[W.MethodNotFound]:404,[W.UnsupportedProtocolVersion]:400,[W.MissingRequiredClientCapability]:400,[gs]:400},U_={"tools/call":"name","prompts/get":"name","resources/read":"uri","tasks/get":"taskId","tasks/update":"taskId","tasks/cancel":"taskId"};function vg(e,t){let r=Object.hasOwn(U_,e)?U_[e]:void 0;if(r===void 0)return;let o=$w(t)?t[r]:void 0;return{field:r,value:typeof o==="string"?o:void 0}}function $w(e){return e!==null&&typeof e==="object"&&!Array.isArray(e)}function Wc(e,t){return uc(e,t)}function ra(e){return new Set(e.flatMap((t)=>Object.keys(t.shape)))}function Wl(e){if(e==null)return!1;let t=typeof e;if(t!=="object"&&t!=="function")return!1;if(!("~standard"in e))return!1;return typeof e["~standard"]?.validate==="function"}var D_=!1,Kl="draft-2020-12";function Cw(e,t="input"){let r=e["~standard"],o;if(r.jsonSchema)o=r.jsonSchema[t]({target:Kl});else if(r.vendor==="zod"){if(!("_zod"in e))throw Error("Schema appears to be from zod 3, which the SDK cannot convert to JSON Schema. Upgrade to zod >=4.2.0, or wrap your JSON Schema with fromJsonSchema().");if(!D_)D_=!0,console.warn("[mcp-sdk] Your zod version does not implement `~standard.jsonSchema` (added in zod 4.2.0). Falling back to z.toJSONSchema(). Upgrade to zod >=4.2.0 to silence this warning.");o=ac(e,{target:Kl,io:t})}else throw Error(`Schema library "${r.vendor}" does not implement StandardJSONSchemaV1 (\`~standard.jsonSchema\`). Upgrade to a version that does, or wrap your JSON Schema with fromJsonSchema().`);if(t==="output"){if(o.type!==void 0)return o;return bg(o)?{type:"object",...o}:o}if(o.type!==void 0&&o.type!=="object")throw Error(`MCP tool and prompt schemas must describe objects (got type: ${JSON.stringify(o.type)}). Wrap your schema in z.object({...}) or equivalent.`);return{type:"object",...o}}var Iw=/^#\/(\$defs|definitions)\/([^/~%]+)$/;function bg(e,t=e){if("properties"in e||"patternProperties"in e||"additionalProperties"in e||"required"in e)return!0;let r=typeof e.$ref==="string"&&Iw.exec(e.$ref);if(r&&t[r[1]]?.[r[2]]?.type==="object")return!0;for(let o of["oneOf","anyOf","allOf"]){let s=e[o];if(Array.isArray(s)&&s.length>0)return s.every((n)=>n!==null&&typeof n==="object"&&(n.type==="object"||bg(n,"$id"in n?{}:t)))}return!1}function qw(e){if(!e.path?.length)return e.message;return`${e.path.map((t)=>String(typeof t==="object"?t.key:t)).join(".")}: ${e.message}`}async function Vl(e,t){let r=await e["~standard"].validate(t);if(r.issues&&r.issues.length>0)return{success:!1,error:r.issues.map((o)=>qw(o)).join(", ")};return{success:!0,data:r.value}}function Ow(e){let t=ac(e,{target:Kl,io:"input"});return typeof t.pattern==="string"?t.pattern:void 0}var Nw=/\\\.\\d\{(\d+)\}/;function jw(e){let t=Nw.exec(e),r=[void 0,-1,0];if(t)r.push(Number(t[1]));return[!1,!0].flatMap((o)=>[!1,!0].flatMap((s)=>r.map((n)=>Ao({local:o,offset:s,precision:n}))))}function Mw(e,t){let r;switch(e){case"email":r=[l_()];break;case"uri":r=[dc()];break;case"date":r=[jl()];break;case"date-time":r=jw(t);break}return new Set(r.map((o)=>Ow(o)).filter((o)=>o!==void 0))}function Aw(e,t,r){if(r!=="zod")return!0;return Mw(e,t).has(t)}function na(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}function Lw(e){try{return Cw(e,"input")}catch(t){let r=t instanceof Error?t.message:String(t);throw new se(W.InvalidParams,`Elicitation requestedSchema must describe an object with flat primitive properties: ${r}`)}}var Uw=new Set(["$comment","deprecated","description","examples","readOnly","title","writeOnly"]);function ud(e){return Uw.has(e)||e.startsWith("x-")}var Dw=new Set(["$schema",...Object.keys(co.shape.requestedSchema.shape)]),Z_={string:ra([io,cs,us,ls]),number:ra([ao]),integer:ra([ao]),boolean:ra([as]),array:ra([ds,ms])},Zw=new Set(io.shape.format.unwrap().options);function Hw(e,t,r,o){if(!na(e))return e;let s=typeof e.type==="string"&&Object.hasOwn(Z_,e.type)?Z_[e.type]:void 0;if(s===void 0)return e;let n={};for(let[i,a]of Object.entries(e))if(s.has(i)||ud(i))n[i]=a;else if(i==="pattern"&&e.type==="string"&&typeof e.format==="string"){if(!Zw.has(e.format))n[i]=a;else if(typeof a!=="string"||!Aw(e.format,a,r))o.push(`${t}.${i}`)}else o.push(`${t}.${i}`);return n}function Fw(e,t){let r={},o=[];for(let[s,n]of Object.entries(e))if(s==="properties"&&na(n))r[s]=Object.fromEntries(Object.entries(n).map(([i,a])=>[i,Hw(a,`properties.${i}`,t,o)]));else if(Dw.has(s))r[s]=n;else if(!ud(s))o.push(s);if(o.length>0)throw new se(W.InvalidParams,`Elicitation requestedSchema contains unsupported JSON Schema constraint(s) after Standard Schema conversion: ${o.join(", ")}`);return r}function Vw(e,t){if(!na(e.properties))return t;let r=Object.entries(e.properties).filter(([,o])=>!Wc(ps,o).success).map(([o])=>`properties.${o}`);return r.length>0?r.join(", "):t}function Gl(e,t,r=""){if(Array.isArray(e)&&Array.isArray(t))return e.flatMap((o,s)=>Gl(o,t[s],`${r}[${s}]`));if(!na(e)||!na(t))return[];return Object.entries(e).flatMap(([o,s])=>{let n=r?`${r}.${o}`:o;if(!Object.prototype.hasOwnProperty.call(t,o))return ud(o)?[]:[n];return Gl(s,t[o],n)})}function Bw(e){if(!Wl(e.requestedSchema))return{...e,mode:"form",requestedSchema:e.requestedSchema};let t=e.requestedSchema["~standard"].vendor,r=Fw(Lw(e.requestedSchema),t),o=Wc(co.shape.requestedSchema,r);if(!o.success)throw new se(W.InvalidParams,`Elicitation requestedSchema only supports flat primitive properties (string, number, integer, boolean, and string enums): ${Vw(r,o.error.message)}`);let s=Gl(r,o.data);if(s.length>0)throw new se(W.InvalidParams,`Elicitation requestedSchema contains unsupported JSON Schema constraint(s) after Standard Schema conversion: ${s.join(", ")}`);let n=(o.data.required??[]).filter((i)=>!Object.prototype.hasOwnProperty.call(o.data.properties,i));if(n.length>0)throw new se(W.InvalidParams,`Elicitation requestedSchema lists required properties that are not defined in properties: ${n.join(", ")}`);return{...e,mode:"form",requestedSchema:o.data}}function Jw(e){let t=e.inputRequests!==void 0&&Object.keys(e.inputRequests).length>0,r=typeof e.requestState==="string";if(!t&&!r)throw TypeError("inputRequired() requires at least one of inputRequests (with at least one entry) or requestState (spec: every InputRequiredResult MUST include at least one of the two)");return{resultType:"input_required",...e.inputRequests!==void 0&&{inputRequests:e.inputRequests},...e.requestState!==void 0&&{requestState:e.requestState}}}var W0=Object.assign(Jw,{elicit(e){try{return{method:"elicitation/create",params:Bw(e)}}catch(t){throw t instanceof se?TypeError(t.message,{cause:t}):t}},elicitUrl(e){return{method:"elicitation/create",params:{...e,mode:"url"}}},createMessage(e){return{method:"sampling/createMessage",params:e}},listRoots(){return{method:"roots/list"}}});var Ww=!0,Kw=10,Gw=250;function yg(e){return{autoFulfill:e?.autoFulfill??Ww,maxRounds:e?.maxRounds??Kw}}function Yw(e,t,r){let o=t!==void 0&&Object.keys(t).length>0;if(!o&&r===void 0)return e;return{...e,...o&&{inputResponses:t},...r!==void 0&&{requestState:r}}}function Xw(e,t){return`Multi-round-trip request '${e}' still required input after ${t} rounds (inputRequired.maxRounds)`}function Qw(e,t){return new Promise((r,o)=>{if(t?.aborted){o(t.reason instanceof L?t.reason:new L(M.RequestTimeout,String(t.reason)));return}let s=setTimeout(()=>{t?.removeEventListener("abort",n),r()},e),n=()=>{clearTimeout(s),o(t?.reason instanceof L?t.reason:new L(M.RequestTimeout,String(t?.reason)))};t?.addEventListener("abort",n,{once:!0})})}function ez(e){let t=new AbortController,r=()=>t.abort(e?.reason);if(e?.addEventListener("abort",r,{once:!0}),e?.aborted)t.abort(e.reason);return{signal:t.signal,abort:(o)=>t.abort(o),dispose:()=>e?.removeEventListener("abort",r)}}async function tz(e){let{config:t,method:r,originalParams:o,requestOptions:s,hooks:n,signal:i}=e,a=e.flowStartedAt??Date.now(),c=e.firstPayload,l=0;while(!0){if(l+=1,l>t.maxRounds)throw new L(M.InputRequiredRoundsExceeded,Xw(r,t.maxRounds),{rounds:t.maxRounds,lastResult:{inputRequests:c.inputRequests,...c.requestState!==void 0&&{requestState:c.requestState}}});s.onprogress?.({progress:l,message:`Fulfilling input required by '${r}' (round ${l})`});let d=Object.entries(c.inputRequests??{}),f;if(d.length>0){let b=ez(i);try{let _=await Promise.all(d.map(async([w,I])=>{try{return[w,await n.dispatchInputRequest(w,I,b.signal)]}catch(A){throw b.abort(A),A}}));f=Object.fromEntries(_)}finally{b.dispose()}}else await Qw(Gw,i);let h={...s.timeout!==void 0&&{timeout:s.timeout}};if(s.maxTotalTimeout!==void 0){let b=Date.now()-a,_=s.maxTotalTimeout-b;if(_<=0)throw new L(M.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:s.maxTotalTimeout,totalElapsed:b});h.maxTotalTimeout=_}let g=await n.retry(Yw(o,f,c.requestState),h);if(hg(g)){c={inputRequests:g.inputRequests??{},...g.requestState!==void 0&&{requestState:g.requestState}};continue}return g}}var rz=["AnnotationsSchema","AudioContentSchema","BaseMetadataSchema","BlobResourceContentsSchema","BooleanSchemaSchema","CallToolRequestSchema","CallToolRequestParamsSchema","CallToolResultSchema","CancelledNotificationSchema","CancelledNotificationParamsSchema","CancelTaskRequestSchema","CancelTaskResultSchema","ClientCapabilitiesSchema","ClientNotificationSchema","ClientRequestSchema","ClientResultSchema","CompatibilityCallToolResultSchema","CompleteRequestSchema","CompleteRequestParamsSchema","CompleteResultSchema","ContentBlockSchema","CreateMessageRequestSchema","CreateMessageRequestParamsSchema","CreateMessageResultSchema","CreateMessageResultWithToolsSchema","CreateTaskResultSchema","CursorSchema","DiscoverRequestSchema","DiscoverResultSchema","ElicitationCompleteNotificationSchema","ElicitationCompleteNotificationParamsSchema","ElicitRequestSchema","ElicitRequestFormParamsSchema","ElicitRequestParamsSchema","ElicitRequestURLParamsSchema","ElicitResultSchema","EmbeddedResourceSchema","EmptyResultSchema","EnumSchemaSchema","GetPromptRequestSchema","GetPromptRequestParamsSchema","GetPromptResultSchema","GetTaskPayloadRequestSchema","GetTaskPayloadResultSchema","GetTaskRequestSchema","GetTaskResultSchema","IconSchema","IconsSchema","ImageContentSchema","ImplementationSchema","InitializedNotificationSchema","InitializeRequestSchema","InitializeRequestParamsSchema","InitializeResultSchema","JSONArraySchema","JSONObjectSchema","JSONRPCErrorResponseSchema","JSONRPCMessageSchema","JSONRPCNotificationSchema","JSONRPCRequestSchema","JSONRPCResponseSchema","JSONRPCResultResponseSchema","JSONValueSchema","LegacyTitledEnumSchemaSchema","ListPromptsRequestSchema","ListPromptsResultSchema","ListResourcesRequestSchema","ListResourcesResultSchema","ListResourceTemplatesRequestSchema","ListResourceTemplatesResultSchema","ListRootsRequestSchema","ListRootsResultSchema","ListTasksRequestSchema","ListTasksResultSchema","ListToolsRequestSchema","ListToolsResultSchema","LoggingLevelSchema","LoggingMessageNotificationSchema","LoggingMessageNotificationParamsSchema","ModelHintSchema","ModelPreferencesSchema","MultiSelectEnumSchemaSchema","NotificationSchema","NumberSchemaSchema","PaginatedRequestSchema","PaginatedRequestParamsSchema","PaginatedResultSchema","PingRequestSchema","PrimitiveSchemaDefinitionSchema","ProgressSchema","ProgressNotificationSchema","ProgressNotificationParamsSchema","ProgressTokenSchema","PromptSchema","PromptArgumentSchema","PromptListChangedNotificationSchema","PromptMessageSchema","PromptReferenceSchema","ReadResourceRequestSchema","ReadResourceRequestParamsSchema","ReadResourceResultSchema","RelatedTaskMetadataSchema","RequestSchema","RequestIdSchema","RequestMetaSchema","ResourceSchema","ResourceContentsSchema","ResourceLinkSchema","ResourceListChangedNotificationSchema","ResourceRequestParamsSchema","ResourceTemplateSchema","ResourceTemplateReferenceSchema","ResourceUpdatedNotificationSchema","ResourceUpdatedNotificationParamsSchema","ResultMetaObjectSchema","ResultSchema","RoleSchema","RootSchema","RootsListChangedNotificationSchema","SamplingContentSchema","SamplingMessageSchema","SamplingMessageContentBlockSchema","ServerCapabilitiesSchema","ServerNotificationSchema","ServerRequestSchema","ServerResultSchema","SetLevelRequestSchema","SetLevelRequestParamsSchema","SingleSelectEnumSchemaSchema","StringSchemaSchema","SubscribeRequestSchema","SubscribeRequestParamsSchema","SubscriptionFilterSchema","SubscriptionsAcknowledgedNotificationSchema","SubscriptionsAcknowledgedNotificationParamsSchema","SubscriptionsListenRequestSchema","SubscriptionsListenRequestParamsSchema","SubscriptionsListenResultSchema","SubscriptionsListenResultMetaSchema","TaskAugmentedRequestParamsSchema","TaskCreationParamsSchema","TaskMetadataSchema","TaskSchema","TaskStatusSchema","TaskStatusNotificationSchema","TaskStatusNotificationParamsSchema","TextContentSchema","TextResourceContentsSchema","TitledMultiSelectEnumSchemaSchema","TitledSingleSelectEnumSchemaSchema","ToolSchema","ToolAnnotationsSchema","ToolChoiceSchema","ToolExecutionSchema","ToolListChangedNotificationSchema","ToolResultContentSchema","ToolUseContentSchema","UnsubscribeRequestSchema","UnsubscribeRequestParamsSchema","UntitledMultiSelectEnumSchemaSchema","UntitledSingleSelectEnumSchemaSchema"],oz={IdJagTokenExchangeResponseSchema:Xi,OAuthClientInformationFullSchema:_s,OAuthClientInformationSchema:ea,OAuthClientMetadataSchema:Qi,OAuthClientRegistrationErrorSchema:Ac,OAuthErrorResponseSchema:mo,OAuthMetadataSchema:uo,OAuthProtectedResourceMetadataSchema:hs,OAuthTokenRevocationRequestSchema:Lc,OAuthTokensSchema:lo,OpenIdProviderDiscoveryMetadataSchema:fs,OpenIdProviderMetadataSchema:Yi},wg={},zg={};function Rg(e,t){let r=e.slice(0,-6);wg[r]=t,zg[r]=(o)=>t.safeParse(o).success}for(let e of rz)Rg(e,bw[e]);for(let[e,t]of Object.entries(oz))Rg(e,t);var sz=Object.freeze(wg),ld=Object.freeze(zg);function nz(e){switch(e){case"initialize":case"notifications/initialized":return Xt(void 0);case"server/discover":return Xt(Jc);default:return}}var ca=60000,iz=[Bt,Uo,Kr,Zo],az=["inputResponses","requestState"];function H_(e,t){let r=e.params;if(!sa(r))return{message:e,lifted:{}};let o=r._meta,s=sa(o)?iz.filter((c)=>(c in o)):[],n=t==="request"?az.filter((c)=>(c in r)):[];if(s.length===0&&n.length===0)return{message:e,lifted:{}};let i={},a={...r};if(s.length>0&&sa(o)){let c={},l={...o};for(let d of s)c[d]=o[d],delete l[d];if(i.envelope=c,Object.keys(l).length>0)a._meta=l;else delete a._meta}for(let c of n){if(c==="inputResponses")i.inputResponses=a[c];if(c==="requestState")i.requestState=a[c];delete a[c]}return{message:{...e,params:a},lifted:i}}function F_(e,t){let r=e.validateResult(t,void 0);if(!r.ok&&r.reason==="not-in-era")return;return{"~standard":{version:1,vendor:"mcp-wire-codec",validate(o){let s=e.validateResult(t,o);if(s.ok)return{value:s.value};return{issues:[{message:s.reason==="invalid"?s.message:`not-in-era: ${t}`}]}}}}}function dd(e){return()=>e}var cz=dd(void 0),uz,ua=class{_transport;_requestMessageId=0;_requestHandlers=new Map;_customSchemaRequestMethods=new Set;_requestHandlerAbortControllers=new Map;_notificationHandlers=new Map;_responseHandlers=new Map;_progressHandlers=new Map;_timeoutInfo=new Map;_pendingDebouncedNotifications=new Set;_negotiatedProtocolVersion;static{uz=(e,t)=>{e._negotiatedProtocolVersion=t}}_supportedProtocolVersions;onclose;onerror;fallbackRequestHandler;fallbackNotificationHandler;constructor(e){this._options=e,this._supportedProtocolVersions=e?.supportedProtocolVersions??hc,this.setNotificationHandler("notifications/cancelled",(t)=>{this._oncancel(t)}),this.setNotificationHandler("notifications/progress",(t)=>{this._onprogress(t)}),this.setRequestHandler("ping",(t)=>({}))}_shouldDropInbound(e){}_outboundMetaEnvelope(){}_envelopeOutbound(e){let t=this._outboundMetaEnvelope();if(t===void 0)return e;let r=e.params??{};return{...e,params:{...r,_meta:{...t,...r._meta}}}}_resolveNonCompleteResult(e,t){return Promise.reject(new L(M.UnsupportedResultType,`Unsupported result type '${e.kind}' for ${t.request.method}`,{resultType:e.kind,method:t.request.method}))}_getRequestHandler(e){return this._requestHandlers.get(e)}async _oncancel(e){if(e.params.requestId===void 0)return;this._requestHandlerAbortControllers.get(e.params.requestId)?.abort(e.params.reason)}_setupTimeout(e,t,r,o,s=!1){this._timeoutInfo.set(e,{timeoutId:setTimeout(o,t),startTime:Date.now(),timeout:t,maxTotalTimeout:r,resetTimeoutOnProgress:s,onTimeout:o})}_resetTimeout(e){let t=this._timeoutInfo.get(e);if(!t)return!1;let r=Date.now()-t.startTime;if(t.maxTotalTimeout&&r>=t.maxTotalTimeout)throw this._timeoutInfo.delete(e),new L(M.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:t.maxTotalTimeout,totalElapsed:r});return clearTimeout(t.timeoutId),t.timeoutId=setTimeout(t.onTimeout,t.timeout),!0}_cleanupTimeout(e){let t=this._timeoutInfo.get(e);if(t)clearTimeout(t.timeoutId),this._timeoutInfo.delete(e)}async connect(e){this._transport=e;let t=this.transport?.onclose;this._transport.onclose=()=>{try{t?.()}finally{this._onclose()}};let r=this.transport?.onerror;this._transport.onerror=(s)=>{r?.(s),this._onerror(s)};let o=this._transport?.onmessage;this._transport.onmessage=(s,n)=>{if(o?.(s,n),po(s)||ho(s))this._onresponse(s);else if(yr(s))this._onrequest(s,n);else if(pg(s))this._onnotification(s,n);else this._onerror(Error(`Unknown message type: ${JSON.stringify(s)}`))},e.setSupportedProtocolVersions?.(this._supportedProtocolVersions),await this._transport.start()}_onclose(){let e=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._pendingDebouncedNotifications.clear();for(let o of this._timeoutInfo.values())clearTimeout(o.timeoutId);this._timeoutInfo.clear();let t=this._requestHandlerAbortControllers;this._requestHandlerAbortControllers=new Map;let r=new L(M.ConnectionClosed,"Connection closed");this._transport=void 0;try{this.onclose?.()}finally{for(let o of e.values())o(r);for(let o of t.values())o.abort(r)}}_onerror(e){this.onerror?.(e)}_onnotification(e,t){let{message:r}=H_(e,"notification"),o=this._negotiatedWireCodec();if(t?.classification===void 0&&this._shouldDropInbound(e)==="drop")return;if(t?.classification!==void 0){let i=M_(t.classification);if(i!==o.era){this._onerror(Error(`Era mismatch on inbound notification '${r.method}': classified as ${i} but this instance serves ${o.era}`));return}}if(Fl(r.method)&&!o.hasNotificationMethod(r.method))return;let s=this._notificationHandlers.get(r.method),n=this.fallbackNotificationHandler;if(s===void 0&&n===void 0)return;Promise.resolve().then(()=>s===void 0?n(r):s(r,o)).catch((i)=>this._onerror(Error(`Uncaught error in notification handler: ${i}`)))}_onrequest(e,t){let{message:r,lifted:o}=H_(e,"request"),s=this._negotiatedWireCodec();if(t?.classification===void 0&&this._shouldDropInbound(e)==="drop"){this._onerror(Error(`Dropped inbound request '${e.method}': not servable on this connection's protocol era`));return}let n=this._transport,i=(_,w,I)=>{let A={jsonrpc:"2.0",id:r.id,error:{code:_,message:w,...I!==void 0&&{data:I}}};n?.send(A).catch((z)=>this._onerror(Error(`Failed to send an error response: ${z}`)))};if(t?.classification!==void 0){let _=M_(t.classification);if(_!==s.era){this._onerror(Error(`Era mismatch on inbound request '${r.method}': classified as ${_} but this instance serves ${s.era}`));let w=t.classification.revision??_;i(W.UnsupportedProtocolVersion,`Unsupported protocol version: ${w}`,{supported:this._supportedProtocolVersions,requested:w});return}}if(Hl(r.method)&&!s.hasRequestMethod(r.method)&&!(A_(r.method)&&this._customSchemaRequestMethods.has(r.method))){i(W.MethodNotFound,"Method not found");return}let a=this._requestHandlers.get(r.method)??this.fallbackRequestHandler;if(a===void 0){i(W.MethodNotFound,"Method not found");return}let c=s.checkInboundEnvelope(o);if(c!==void 0){i(W.InvalidParams,c);return}let l=(_,w)=>this._notificationViaCodec(this._resolveOutboundCodec(_.method),_,{...w,relatedRequestId:r.id}),d=(_,w,I)=>this._requestWithSchemaViaCodec(this._resolveOutboundCodec(_.method),_,w,{...I,relatedRequestId:r.id}),f=new AbortController;this._requestHandlerAbortControllers.set(r.id,f);let h=o.inputResponses===void 0?void 0:lz(o.inputResponses),g={sessionId:n?.sessionId,mcpReq:{id:r.id,method:r.method,_meta:r.params?._meta,...o.envelope!==void 0&&{envelope:o.envelope},...h!==void 0&&{inputResponses:h.accepted},...h!==void 0&&h.droppedKeys.length>0&&{droppedInputResponseKeys:h.droppedKeys},requestState:o.requestState===void 0?cz:dd(o.requestState),signal:f.signal,send:(_,w,I)=>{let A=this._resolveOutboundCodec(_.method);if(this._assertOutboundRequestInEra(A,_.method),Wl(w))return d(_,w,I);let z=F_(A,_.method);if(z===void 0)throw TypeError(`'${_.method}' is not a spec method; pass a result schema as the second argument to ctx.mcpReq.send().`);return d(_,z,w)},notify:l},http:t?.authInfo?{authInfo:t.authInfo}:void 0},b=this.buildContext(g,t);Promise.resolve().then(()=>a(r,b)).then(async(_)=>{if(f.signal.aborted)return;let w;try{w=s.encodeResult(r.method,_,this._outboundServerInfo())}catch(A){this._onerror(Error(`Failed to encode result for ${r.method}: ${A}`)),i(W.InternalError,"Internal error");return}let I={result:w,jsonrpc:"2.0",id:r.id};await n?.send(I)},async(_)=>{if(f.signal.aborted)return;let w=Number.isSafeInteger(_.code)?_.code:W.InternalError,I={jsonrpc:"2.0",id:r.id,error:{code:s.encodeErrorCode(w),message:_.message??"Internal error",..._.data!==void 0&&{data:_.data}}};await n?.send(I)}).catch((_)=>this._onerror(Error(`Failed to send response: ${_}`))).finally(()=>{if(this._requestHandlerAbortControllers.get(r.id)===f)this._requestHandlerAbortControllers.delete(r.id)})}_onprogress(e){let{progressToken:t,...r}=e.params,o=Number(t),s=this._progressHandlers.get(o);if(!s){this._onerror(Error(`Received a progress notification for an unknown token: ${JSON.stringify(e)}`));return}let n=this._responseHandlers.get(o),i=this._timeoutInfo.get(o);if(i&&n&&i.resetTimeoutOnProgress)try{this._resetTimeout(o)}catch(a){this._responseHandlers.delete(o),this._progressHandlers.delete(o),this._cleanupTimeout(o),n(a);return}s(r)}_onresponse(e){let t=Number(e.id),r=this._responseHandlers.get(t);if(r===void 0){this._onerror(Error(`Received a response for an unknown message ID: ${JSON.stringify(e)}`));return}if(this._responseHandlers.delete(t),this._cleanupTimeout(t),this._progressHandlers.delete(t),po(e))r(e);else r(se.fromError(e.error.code,e.error.message,e.error.data))}get transport(){return this._transport}async close(){await this._transport?.close()}request(e,t,r){let o=this._resolveOutboundCodec(e.method);if(Wl(t)){if(!A_(e.method))this._assertOutboundRequestInEra(o,e.method);return this._requestWithSchemaViaCodec(o,e,t,r)}this._assertOutboundRequestInEra(o,e.method);let s=F_(o,e.method);if(s===void 0)throw TypeError(`'${e.method}' is not a spec method; pass a result schema as the second argument to request().`);return this._requestWithSchemaViaCodec(o,e,s,t)}_negotiatedWireCodec(){return Xt(this._negotiatedProtocolVersion)}_wireCodec(){return this._negotiatedWireCodec()}_resolveOutboundCodec(e){if(this._negotiatedProtocolVersion===void 0){let t=nz(e);if(t)return t}return this._negotiatedWireCodec()}_assertOutboundRequestInEra(e,t){if(Hl(t)&&!e.hasRequestMethod(t))throw new L(M.MethodNotSupportedByProtocolVersion,`Method '${t}' is not supported by the negotiated protocol version (wire era ${e.era})`,{method:t,era:e.era})}_requestWithSchema(e,t,r){let o=this._resolveOutboundCodec(e.method);return this._assertOutboundRequestInEra(o,e.method),this._requestWithSchemaViaCodec(o,e,t,r)}_requestWithSchemaViaCodec(e,t,r,o){let{relatedRequestId:s,resumptionToken:n,onresumptiontoken:i,headers:a}=o??{},c=Date.now(),l,d;return new Promise((f,h)=>{let g=(R)=>{h(R)};if(!this._transport){g(Error("Not connected"));return}if(this._options?.enforceStrictCapabilities===!0)try{this.assertCapabilityForMethod(t.method)}catch(R){g(R);return}if(o?.signal?.aborted){let R=o.signal.reason;throw R instanceof L?R:new L(M.RequestTimeout,String(R))}let b=e.era===Jc&&this._transport.hasPerRequestStream===!0?new AbortController:void 0,_=this._requestMessageId++;d=_;let w={...t,jsonrpc:"2.0",id:_};if(o?.onprogress)this._progressHandlers.set(_,o.onprogress),w.params={...t.params,_meta:{...t.params?._meta,progressToken:_}};let I=this._envelopeOutbound(w),A=!1,z=(R)=>{if(A)return;if(this._progressHandlers.delete(_),b===void 0){if(t.method!=="initialize")this._transport?.send(this._envelopeOutbound({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:_,reason:String(R)}}),{relatedRequestId:s,resumptionToken:n,onresumptiontoken:i}).catch((Z)=>this._onerror(Error(`Failed to send cancellation: ${Z}`)))}else b.abort();h(R instanceof L?R:new L(M.RequestTimeout,String(R)))};this._responseHandlers.set(_,(R)=>{if(o?.signal?.aborted)return;if(A=!0,R instanceof Error)return h(R);let Z;try{Z=e.decodeResult(t.method,R.result)}catch(X){return h(X instanceof Error?X:Error(String(X)))}if(Z.kind==="invalid")return h(Z.error);if(Z.kind==="input_required"){if(o?.allowInputRequired===!0)return f(hz(Z));let X={codec:e,request:t,resultSchema:r,options:o,flowStartedAt:c,retry:(ne,xe)=>this._requestWithSchemaViaCodec(e,ne===void 0?{method:t.method}:{method:t.method,params:ne},r,xe)};return f(this._resolveNonCompleteResult(Z,X))}let ee=Z.result;Vl(r,ee).then((X)=>{if(X.success)f(X.data);else h(new L(M.InvalidResult,`Invalid result for ${t.method}: ${X.error}`))},h)}),l=()=>z(o?.signal?.reason),o?.signal?.addEventListener("abort",l,{once:!0});let q=o?.timeout??ca,x=()=>z(new L(M.RequestTimeout,"Request timed out",{timeout:q}));this._setupTimeout(_,q,o?.maxTotalTimeout,x,o?.resetTimeoutOnProgress??!1),this._transport.send(I,{relatedRequestId:s,resumptionToken:n,onresumptiontoken:i,headers:a,requestSignal:b?.signal}).catch((R)=>{this._progressHandlers.delete(_),h(R)})}).finally(()=>{if(l)o?.signal?.removeEventListener("abort",l);if(d!==void 0)this._responseHandlers.delete(d),this._cleanupTimeout(d)})}async notification(e,t){return await this._notificationViaCodec(this._resolveOutboundCodec(e.method),e,t)}async _notificationViaCodec(e,t,r){if(!this._transport)throw new L(M.NotConnected,"Not connected");if(Fl(t.method)&&!e.hasNotificationMethod(t.method))throw new L(M.MethodNotSupportedByProtocolVersion,`Notification '${t.method}' is not supported by the negotiated protocol version (wire era ${e.era})`,{method:t.method,era:e.era});this.assertNotificationCapability(t.method);let o=this._envelopeOutbound({jsonrpc:"2.0",...t});if((this._options?.debouncedNotificationMethods??[]).includes(t.method)&&!t.params&&r?.relatedRequestId===void 0){if(this._pendingDebouncedNotifications.has(t.method))return;this._pendingDebouncedNotifications.add(t.method),Promise.resolve().then(()=>{if(this._pendingDebouncedNotifications.delete(t.method),!this._transport)return;this._transport?.send(o,r).catch((s)=>this._onerror(s))});return}await this._transport.send(o,r)}setRequestHandler(e,t,r){this.assertRequestHandlerCapability(e);let o;if(typeof t==="function"){if(!Hl(e))throw TypeError(`'${e}' is not a spec request method; pass schemas as the second argument to setRequestHandler().`);o=(s,n)=>{let i=this._negotiatedWireCodec(),a=i.validateRequest(e,s);if(!a.ok&&a.reason==="not-in-era")a=i.validateInputRequest(e,s);if(!a.ok){if(a.reason==="not-in-era")throw new se(W.InternalError,`No wire schema for ${e} in the resolved era`);throw Error(a.message)}return Promise.resolve(t(a.value,n))}}else if(r)o=async(s,n)=>{let i=await Vl(t.params,{...s.params});if(!i.success)throw new se(W.InvalidParams,`Invalid params for ${e}: ${i.error}`);return r(i.data,n)};else throw TypeError("setRequestHandler: handler is required");if(typeof t==="function")this._customSchemaRequestMethods.delete(e);else this._customSchemaRequestMethods.add(e);this._requestHandlers.set(e,this._wrapHandler(e,o))}_wrapHandler(e,t){return t}_outboundServerInfo(){}removeRequestHandler(e){this._requestHandlers.delete(e),this._customSchemaRequestMethods.delete(e)}assertCanSetRequestHandler(e){if(this._requestHandlers.has(e))throw Error(`A request handler for ${e} already exists, which would be overridden`)}setNotificationHandler(e,t,r){if(typeof t==="function"){if(!Fl(e))throw TypeError(`'${e}' is not a spec notification method; pass schemas as the second argument to setNotificationHandler().`);this._notificationHandlers.set(e,(o,s)=>{let n=s.validateNotification(e,o);if(!n.ok){if(n.reason==="not-in-era")throw new se(W.InternalError,`No wire schema for ${e} in the resolved era`);throw Error(n.message)}return Promise.resolve(t(n.value))});return}if(!r)throw TypeError("setNotificationHandler: handler is required");this._notificationHandlers.set(e,async(o)=>{let s=await Vl(t.params,{...o.params});if(!s.success)throw new se(W.InvalidParams,`Invalid params for notification ${e}: ${s.error}`);await r(s.data,o)})}removeNotificationHandler(e){this._notificationHandlers.delete(e)}};function sa(e){return e!==null&&typeof e==="object"&&!Array.isArray(e)}function md(e,t){let r={...e};for(let o in t){let s=o,n=t[s];if(n===void 0)continue;let i=r[s];r[s]=sa(i)&&sa(n)?{...i,...n}:n}return r}function Vc(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}function lz(e){let t={},r=[];if(!Vc(e))return{accepted:t,droppedKeys:r};for(let[o,s]of Object.entries(e)){if(!Vc(s)||"method"in s||"result"in s){r.push(o);continue}t[o]=s}return{accepted:t,droppedKeys:r}}function V_(e){throw new L(M.SendFailed,`ctx.mcpReq.${e} is not available while fulfilling an embedded input request: the request is fulfilled locally and has no related peer request`)}function dz(e,t,r,o,s){return{sessionId:s,mcpReq:{id:e,method:t,_meta:r?._meta,requestState:dd(void 0),signal:o,send:()=>V_("send"),notify:()=>V_("notify")}}}async function mz(e,t,r,o,s){if(!Vc(o)||typeof o.method!=="string")throw new L(M.InvalidResult,`Invalid input request '${r}': each inputRequests entry must be an embedded request object with a method`,{key:r});let n=o.method;if(!t.hasInputRequestMethod(n))throw new L(M.InvalidResult,`Invalid input request '${r}': '${n}' is not an embedded request the ${t.era} revision defines (expected elicitation/create, sampling/createMessage, or roots/list)`,{key:r,method:n});let i=e.getRequestHandler(n);if(i===void 0)throw new L(M.CapabilityNotSupported,`Cannot fulfil input request '${r}': no handler is registered for '${n}' on this client. Declare the corresponding capability and register a handler, or handle input_required results manually.`,{key:r,method:n});let a=Vc(o.params)?o.params:void 0;return await i({jsonrpc:"2.0",id:r,method:n,...a!==void 0&&{params:a}},e.buildContext(dz(r,n,a,s,e.sessionId)))}function pz(e,t){return{...e?.signal!==void 0&&{signal:e.signal},...e?.onprogress!==void 0&&{onprogress:e.onprogress},...e?.resetTimeoutOnProgress!==void 0&&{resetTimeoutOnProgress:e.resetTimeoutOnProgress},...e?.headers!==void 0&&{headers:e.headers},...t.timeout!==void 0&&{timeout:t.timeout},...t.maxTotalTimeout!==void 0&&{maxTotalTimeout:t.maxTotalTimeout},allowInputRequired:!0}}function xg(e,t,r,o){let{codec:s,request:n,options:i,flowStartedAt:a}=o,c={inputRequests:r.inputRequests,...r.requestState!==void 0&&{requestState:r.requestState}},l={dispatchInputRequest:(d,f,h)=>mz(e,s,d,f,h),retry:(d,f)=>o.retry(d,pz(i,f))};return tz({config:t,method:n.method,originalParams:n.params,firstPayload:c,flowStartedAt:a,signal:i?.signal,requestOptions:{...i?.timeout!==void 0&&{timeout:i.timeout},...i?.maxTotalTimeout!==void 0&&{maxTotalTimeout:i.maxTotalTimeout},...i?.onprogress!==void 0&&{onprogress:i.onprogress}},hooks:l})}function hz(e){return{resultType:"input_required",inputRequests:e.inputRequests,...e.requestState!==void 0&&{requestState:e.requestState},...e._meta!==void 0&&{_meta:e._meta}}}/*!
65
+ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let i of e.seen.entries()){let a=i[1];if(t===i[0]){n(i);continue}if(e.external){let l=e.external.registry.get(i[0])?.id;if(t!==i[0]&&l){n(i);continue}}if(e.metadataRegistry.get(i[0])?.id){n(i);continue}if(a.cycle){n(i);continue}if(a.count>1){if(e.reused==="ref"){n(i);continue}}}}function zn(e,t){let r=e.seen.get(t);if(!r)throw Error("Unprocessed schema. This is a bug in Zod.");let o=(a)=>{let c=e.seen.get(a);if(c.ref===null)return;let l=c.def??c.schema,d={...l},f=c.ref;if(c.ref=null,f){o(f);let g=e.seen.get(f),v=g.schema;if(v.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0"))l.allOf=l.allOf??[],l.allOf.push(v);else Object.assign(l,v);if(Object.assign(l,d),a._zod.parent===f)for(let y in l){if(y==="$ref"||y==="allOf")continue;if(!(y in d))delete l[y]}if(v.$ref&&g.def)for(let y in l){if(y==="$ref"||y==="allOf")continue;if(y in g.def&&JSON.stringify(l[y])===JSON.stringify(g.def[y]))delete l[y]}}let h=a._zod.parent;if(h&&h!==f){o(h);let g=e.seen.get(h);if(g?.schema.$ref){if(l.$ref=g.schema.$ref,g.def)for(let v in l){if(v==="$ref"||v==="allOf")continue;if(v in g.def&&JSON.stringify(l[v])===JSON.stringify(g.def[v]))delete l[v]}}}e.override({zodSchema:a,jsonSchema:l,path:c.path??[]})};for(let a of[...e.seen.entries()].reverse())o(a[0]);let s={};if(e.target==="draft-2020-12")s.$schema="https://json-schema.org/draft/2020-12/schema";else if(e.target==="draft-07")s.$schema="http://json-schema.org/draft-07/schema#";else if(e.target==="draft-04")s.$schema="http://json-schema.org/draft-04/schema#";else if(e.target==="openapi-3.0");if(e.external?.uri){let a=e.external.registry.get(t)?.id;if(!a)throw Error("Schema is missing an `id` property");s.$id=e.external.uri(a)}Object.assign(s,r.def??r.schema);let n=e.metadataRegistry.get(t)?.id;if(n!==void 0&&s.id===n)delete s.id;let i=e.external?.defs??{};for(let a of e.seen.entries()){let c=a[1];if(c.def&&c.defId){if(c.def.id===c.defId)delete c.def.id;i[c.defId]=c.def}}if(e.external);else if(Object.keys(i).length>0)if(e.target==="draft-2020-12")s.$defs=i;else s.definitions=i;try{let a=JSON.parse(JSON.stringify(s));return Object.defineProperty(a,"~standard",{value:{...t["~standard"],jsonSchema:{input:bn(t,"input",e.processors),output:bn(t,"output",e.processors)}},enumerable:!1,writable:!1}),a}catch(a){throw Error("Error converting schema to JSON.")}}function He(e,t){let r=t??{seen:new Set};if(r.seen.has(e))return!1;r.seen.add(e);let o=e._zod.def;if(o.type==="transform")return!0;if(o.type==="array")return He(o.element,r);if(o.type==="set")return He(o.valueType,r);if(o.type==="lazy")return He(o.getter(),r);if(o.type==="promise"||o.type==="optional"||o.type==="nonoptional"||o.type==="nullable"||o.type==="readonly"||o.type==="default"||o.type==="prefault")return He(o.innerType,r);if(o.type==="intersection")return He(o.left,r)||He(o.right,r);if(o.type==="record"||o.type==="map")return He(o.keyType,r)||He(o.valueType,r);if(o.type==="pipe"){if(e._zod.traits.has("$ZodCodec"))return!0;return He(o.in,r)||He(o.out,r)}if(o.type==="object"){for(let s in o.shape)if(He(o.shape[s],r))return!0;return!1}if(o.type==="union"){for(let s of o.options)if(He(s,r))return!0;return!1}if(o.type==="tuple"){for(let s of o.items)if(He(s,r))return!0;if(o.rest&&He(o.rest,r))return!0;return!1}return!1}var Cf=(e,t={})=>(r)=>{let o=yn({...r,processors:t});return ce(e,o),wn(o,e),zn(o,e)},bn=(e,t,r={})=>(o)=>{let{libraryOptions:s,target:n}=o??{},i=yn({...s??{},target:n,io:t,processors:r});return ce(e,i),wn(i,e),zn(i,e)};var Ub={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},fl=(e,t,r,o)=>{let s=r;s.type="string";let{minimum:n,maximum:i,format:a,patterns:c,contentEncoding:l}=e._zod.bag;if(typeof n==="number")s.minLength=n;if(typeof i==="number")s.maxLength=i;if(a){if(s.format=Ub[a]??a,s.format==="")delete s.format;if(a==="time")delete s.format}if(l)s.contentEncoding=l;if(c&&c.size>0){let d=[...c];if(d.length===1)s.pattern=d[0].source;else if(d.length>1)s.allOf=[...d.map((f)=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:f.source}))]}},_l=(e,t,r,o)=>{let s=r,{minimum:n,maximum:i,format:a,multipleOf:c,exclusiveMaximum:l,exclusiveMinimum:d}=e._zod.bag;if(typeof a==="string"&&a.includes("int"))s.type="integer";else s.type="number";let f=typeof d==="number"&&d>=(n??Number.NEGATIVE_INFINITY),h=typeof l==="number"&&l<=(i??Number.POSITIVE_INFINITY),g=t.target==="draft-04"||t.target==="openapi-3.0";if(f)if(g)s.minimum=d,s.exclusiveMinimum=!0;else s.exclusiveMinimum=d;else if(typeof n==="number")s.minimum=n;if(h)if(g)s.maximum=l,s.exclusiveMaximum=!0;else s.exclusiveMaximum=l;else if(typeof i==="number")s.maximum=i;if(typeof c==="number")s.multipleOf=c},gl=(e,t,r,o)=>{r.type="boolean"},qf=(e,t,r,o)=>{if(t.unrepresentable==="throw")throw Error("BigInt cannot be represented in JSON Schema")},Of=(e,t,r,o)=>{if(t.unrepresentable==="throw")throw Error("Symbols cannot be represented in JSON Schema")},Sl=(e,t,r,o)=>{if(t.target==="openapi-3.0")r.type="string",r.nullable=!0,r.enum=[null];else r.type="null"},vl=(e,t,r,o)=>{if(t.unrepresentable==="throw")throw Error("Undefined cannot be represented in JSON Schema")},Nf=(e,t,r,o)=>{if(t.unrepresentable==="throw")throw Error("Void cannot be represented in JSON Schema")},bl=(e,t,r,o)=>{r.not={}},yl=(e,t,r,o)=>{},wl=(e,t,r,o)=>{},jf=(e,t,r,o)=>{if(t.unrepresentable==="throw")throw Error("Date cannot be represented in JSON Schema")},zl=(e,t,r,o)=>{let s=e._zod.def,n=Wa(s.entries);if(n.every((i)=>typeof i==="number"))r.type="number";if(n.every((i)=>typeof i==="string"))r.type="string";r.enum=n},Rl=(e,t,r,o)=>{let s=e._zod.def,n=[];for(let i of s.values)if(i===void 0){if(t.unrepresentable==="throw")throw Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof i==="bigint")if(t.unrepresentable==="throw")throw Error("BigInt literals cannot be represented in JSON Schema");else n.push(Number(i));else n.push(i);if(n.length===0);else if(n.length===1){let i=n[0];if(r.type=i===null?"null":typeof i,t.target==="draft-04"||t.target==="openapi-3.0")r.enum=[i];else r.const=i}else{if(n.every((i)=>typeof i==="number"))r.type="number";if(n.every((i)=>typeof i==="string"))r.type="string";if(n.every((i)=>typeof i==="boolean"))r.type="boolean";if(n.every((i)=>i===null))r.type="null";r.enum=n}},Mf=(e,t,r,o)=>{if(t.unrepresentable==="throw")throw Error("NaN cannot be represented in JSON Schema")},Af=(e,t,r,o)=>{let s=r,n=e._zod.pattern;if(!n)throw Error("Pattern not found in template literal");s.type="string",s.pattern=n.source},Lf=(e,t,r,o)=>{let s=r,n={type:"string",format:"binary",contentEncoding:"binary"},{minimum:i,maximum:a,mime:c}=e._zod.bag;if(i!==void 0)n.minLength=i;if(a!==void 0)n.maxLength=a;if(c)if(c.length===1)n.contentMediaType=c[0],Object.assign(s,n);else Object.assign(s,n),s.anyOf=c.map((l)=>({contentMediaType:l}));else Object.assign(s,n)},Uf=(e,t,r,o)=>{r.type="boolean"},xl=(e,t,r,o)=>{if(t.unrepresentable==="throw")throw Error("Custom types cannot be represented in JSON Schema")},Df=(e,t,r,o)=>{if(t.unrepresentable==="throw")throw Error("Function types cannot be represented in JSON Schema")},kl=(e,t,r,o)=>{if(t.unrepresentable==="throw")throw Error("Transforms cannot be represented in JSON Schema")},Zf=(e,t,r,o)=>{if(t.unrepresentable==="throw")throw Error("Map cannot be represented in JSON Schema")},Hf=(e,t,r,o)=>{if(t.unrepresentable==="throw")throw Error("Set cannot be represented in JSON Schema")},Pl=(e,t,r,o)=>{let s=r,n=e._zod.def,{minimum:i,maximum:a}=e._zod.bag;if(typeof i==="number")s.minItems=i;if(typeof a==="number")s.maxItems=a;s.type="array",s.items=ce(n.element,t,{...o,path:[...o.path,"items"]})},Tl=(e,t,r,o)=>{let s=r,n=e._zod.def;s.type="object",s.properties={};let i=n.shape;for(let l in i)s.properties[l]=ce(i[l],t,{...o,path:[...o.path,"properties",l]});let a=new Set(Object.keys(i)),c=new Set([...a].filter((l)=>{let d=n.shape[l]._zod;if(t.io==="input")return d.optin===void 0;else return d.optout===void 0}));if(c.size>0)s.required=Array.from(c);if(n.catchall?._zod.def.type==="never")s.additionalProperties=!1;else if(!n.catchall){if(t.io==="output")s.additionalProperties=!1}else if(n.catchall)s.additionalProperties=ce(n.catchall,t,{...o,path:[...o.path,"additionalProperties"]})},El=(e,t,r,o)=>{let s=e._zod.def,n=s.inclusive===!1,i=s.options.map((a,c)=>ce(a,t,{...o,path:[...o.path,n?"oneOf":"anyOf",c]}));if(n)r.oneOf=i;else r.anyOf=i},$l=(e,t,r,o)=>{let s=e._zod.def,n=ce(s.left,t,{...o,path:[...o.path,"allOf",0]}),i=ce(s.right,t,{...o,path:[...o.path,"allOf",1]}),a=(l)=>("allOf"in l)&&Object.keys(l).length===1,c=[...a(n)?n.allOf:[n],...a(i)?i.allOf:[i]];r.allOf=c},Ff=(e,t,r,o)=>{let s=r,n=e._zod.def;s.type="array";let i=t.target==="draft-2020-12"?"prefixItems":"items",a=t.target==="draft-2020-12"?"items":t.target==="openapi-3.0"?"items":"additionalItems",c=n.items.map((h,g)=>ce(h,t,{...o,path:[...o.path,i,g]})),l=n.rest?ce(n.rest,t,{...o,path:[...o.path,a,...t.target==="openapi-3.0"?[n.items.length]:[]]}):null;if(t.target==="draft-2020-12"){if(s.prefixItems=c,l)s.items=l}else if(t.target==="openapi-3.0"){if(s.items={anyOf:c},l)s.items.anyOf.push(l);if(s.minItems=c.length,!l)s.maxItems=c.length}else if(s.items=c,l)s.additionalItems=l;let{minimum:d,maximum:f}=e._zod.bag;if(typeof d==="number")s.minItems=d;if(typeof f==="number")s.maxItems=f},Cl=(e,t,r,o)=>{let s=r,n=e._zod.def;s.type="object";let i=n.keyType,c=i._zod.bag?.patterns;if(n.mode==="loose"&&c&&c.size>0){let d=ce(n.valueType,t,{...o,path:[...o.path,"patternProperties","*"]});s.patternProperties={};for(let f of c)s.patternProperties[f.source]=d}else{if(t.target==="draft-07"||t.target==="draft-2020-12")s.propertyNames=ce(n.keyType,t,{...o,path:[...o.path,"propertyNames"]});s.additionalProperties=ce(n.valueType,t,{...o,path:[...o.path,"additionalProperties"]})}let l=i._zod.values;if(l){let d=[...l].filter((f)=>typeof f==="string"||typeof f==="number");if(d.length>0)s.required=d}},Il=(e,t,r,o)=>{let s=e._zod.def,n=ce(s.innerType,t,o),i=t.seen.get(e);if(t.target==="openapi-3.0")i.ref=s.innerType,r.nullable=!0;else r.anyOf=[n,{type:"null"}]},ql=(e,t,r,o)=>{let s=e._zod.def;ce(s.innerType,t,o);let n=t.seen.get(e);n.ref=s.innerType},Ol=(e,t,r,o)=>{let s=e._zod.def;ce(s.innerType,t,o);let n=t.seen.get(e);n.ref=s.innerType,r.default=JSON.parse(JSON.stringify(s.defaultValue))},Nl=(e,t,r,o)=>{let s=e._zod.def;ce(s.innerType,t,o);let n=t.seen.get(e);if(n.ref=s.innerType,t.io==="input")r._prefault=JSON.parse(JSON.stringify(s.defaultValue))},jl=(e,t,r,o)=>{let s=e._zod.def;ce(s.innerType,t,o);let n=t.seen.get(e);n.ref=s.innerType;let i;try{i=s.catchValue(void 0)}catch{throw Error("Dynamic catch values are not supported in JSON Schema")}r.default=i},Ml=(e,t,r,o)=>{let s=e._zod.def,n=s.in._zod.traits.has("$ZodTransform"),i=t.io==="input"?n?s.out:s.in:s.out;ce(i,t,o);let a=t.seen.get(e);a.ref=i},Al=(e,t,r,o)=>{let s=e._zod.def;ce(s.innerType,t,o);let n=t.seen.get(e);n.ref=s.innerType,r.readOnly=!0},Vf=(e,t,r,o)=>{let s=e._zod.def;ce(s.innerType,t,o);let n=t.seen.get(e);n.ref=s.innerType},uc=(e,t,r,o)=>{let s=e._zod.def;ce(s.innerType,t,o);let n=t.seen.get(e);n.ref=s.innerType},Ll=(e,t,r,o)=>{let s=e._zod.innerType;ce(s,t,o);let n=t.seen.get(e);n.ref=s},If={string:fl,number:_l,boolean:gl,bigint:qf,symbol:Of,null:Sl,undefined:vl,void:Nf,never:bl,any:yl,unknown:wl,date:jf,enum:zl,literal:Rl,nan:Mf,template_literal:Af,file:Lf,success:Uf,custom:xl,function:Df,transform:kl,map:Zf,set:Hf,array:Pl,object:Tl,union:El,intersection:$l,tuple:Ff,record:Cl,nullable:Il,nonoptional:ql,default:Ol,prefault:Nl,catch:jl,pipe:Ml,readonly:Al,promise:Vf,optional:uc,lazy:Ll};function lc(e,t){if("_idmap"in e){let o=e,s=yn({...t,processors:If}),n={};for(let c of o._idmap.entries()){let[l,d]=c;ce(d,s)}let i={},a={registry:o,uri:t?.uri,defs:n};s.external=a;for(let c of o._idmap.entries()){let[l,d]=c;wn(s,d),i[l]=zn(s,d)}if(Object.keys(n).length>0){let c=s.target==="draft-2020-12"?"$defs":"definitions";i.__shared={[c]:n}}return{schemas:i}}let r=yn({...t,processors:If});return ce(e,r),wn(r,e),zn(r,e)}var Wb=w("ZodISODateTime",(e,t)=>{nh.init(e,t),fe.init(e,t)});function Lo(e){return ff(Wb,e)}var Kb=w("ZodISODate",(e,t)=>{ih.init(e,t),fe.init(e,t)});function Ul(e){return _f(Kb,e)}var Gb=w("ZodISOTime",(e,t)=>{ah.init(e,t),fe.init(e,t)});function Bf(e){return gf(Gb,e)}var Yb=w("ZodISODuration",(e,t)=>{ch.init(e,t),fe.init(e,t)});function Jf(e){return Sf(Yb,e)}var Xb=(e,t)=>{Xa.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:(r)=>Zu(e,r)},flatten:{value:(r)=>Du(e,r)},addIssue:{value:(r)=>{e.issues.push(r),e.message=JSON.stringify(e.issues,pn,2)}},addIssues:{value:(r)=>{e.issues.push(...r),e.message=JSON.stringify(e.issues,pn,2)}},isEmpty:{get(){return e.issues.length===0}}})};var tt=w("ZodError",Xb,{Parent:Error});var Kf=Qa(tt),Gf=ec(tt),pc=hn(tt),Yf=fn(tt),Xf=Zp(tt),Qf=Hp(tt),e_=Fp(tt),t_=Vp(tt),r_=Bp(tt),o_=Jp(tt),s_=Wp(tt),n_=Kp(tt);var i_=new WeakMap;function Rn(e,t,r){let o=Object.getPrototypeOf(e),s=i_.get(o);if(!s)s=new Set,i_.set(o,s);if(s.has(t))return;s.add(t);for(let n in r){let i=r[n];Object.defineProperty(o,n,{configurable:!0,enumerable:!1,get(){let a=i.bind(this);return Object.defineProperty(this,n,{configurable:!0,writable:!0,enumerable:!0,value:a}),a},set(a){Object.defineProperty(this,n,{configurable:!0,writable:!0,enumerable:!0,value:a})}})}}var ue=w("ZodType",(e,t)=>(ae.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:bn(e,"input"),output:bn(e,"output")}}),e.toJSONSchema=Cf(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.parse=(r,o)=>Kf(e,r,o,{callee:e.parse}),e.safeParse=(r,o)=>pc(e,r,o),e.parseAsync=async(r,o)=>Gf(e,r,o,{callee:e.parseAsync}),e.safeParseAsync=async(r,o)=>Yf(e,r,o),e.spa=e.safeParseAsync,e.encode=(r,o)=>Xf(e,r,o),e.decode=(r,o)=>Qf(e,r,o),e.encodeAsync=async(r,o)=>e_(e,r,o),e.decodeAsync=async(r,o)=>t_(e,r,o),e.safeEncode=(r,o)=>r_(e,r,o),e.safeDecode=(r,o)=>o_(e,r,o),e.safeEncodeAsync=async(r,o)=>s_(e,r,o),e.safeDecodeAsync=async(r,o)=>n_(e,r,o),Rn(e,"ZodType",{check(...r){let o=this.def;return this.clone(cr(o,{checks:[...o.checks??[],...r.map((s)=>typeof s==="function"?{_zod:{check:s,def:{check:"custom"},onattach:[]}}:s)]}),{parent:!0})},with(...r){return this.check(...r)},clone(r,o){return ht(this,r,o)},brand(){return this},register(r,o){return r.add(this,o),this},refine(r,o){return this.check(Dy(r,o))},superRefine(r,o){return this.check(Zy(r,o))},overwrite(r){return this.check(pr(r))},optional(){return F(this)},exactOptional(){return Py(this)},nullable(){return l_(this)},nullish(){return F(l_(this))},nonoptional(r){return qy(this,r)},array(){return b(this)},or(r){return q([this,r])},and(r){return Vt(this,r)},transform(r){return d_(this,b_(r))},default(r){return $y(this,r)},prefault(r){return Iy(this,r)},catch(r){return Ny(this,r)},pipe(r){return d_(this,r)},readonly(){return Ay(this)},describe(r){let o=this.clone();return dr.add(o,{description:r}),o},meta(...r){if(r.length===0)return dr.get(this);let o=this.clone();return dr.add(o,r[0]),o},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(r){return r(this)}}),Object.defineProperty(e,"description",{get(){return dr.get(e)?.description},configurable:!0}),e)),p_=w("_ZodString",(e,t)=>{oc.init(e,t),ue.init(e,t),e._zod.processJSONSchema=(o,s,n)=>fl(e,o,s,n);let r=e._zod.bag;e.format=r.format??null,e.minLength=r.minimum??null,e.maxLength=r.maximum??null,Rn(e,"_ZodString",{regex(...o){return this.check(sl(...o))},includes(...o){return this.check(al(...o))},startsWith(...o){return this.check(cl(...o))},endsWith(...o){return this.check(ul(...o))},min(...o){return this.check(Mo(...o))},max(...o){return this.check(ac(...o))},length(...o){return this.check(cc(...o))},nonempty(...o){return this.check(Mo(1,...o))},lowercase(o){return this.check(nl(o))},uppercase(o){return this.check(il(o))},trim(){return this.check(dl())},normalize(...o){return this.check(ll(...o))},toLowerCase(){return this.check(pl())},toUpperCase(){return this.check(ml())},slugify(){return this.check(hl())}})}),m_=w("ZodString",(e,t)=>{oc.init(e,t),p_.init(e,t),e.email=(r)=>e.check(tl(h_,r)),e.url=(r)=>e.check(ol(__,r)),e.jwt=(r)=>e.check(hf(hy,r)),e.emoji=(r)=>e.check(Qh(ey,r)),e.guid=(r)=>e.check(rl(a_,r)),e.uuid=(r)=>e.check(Kh(mc,r)),e.uuidv4=(r)=>e.check(Gh(mc,r)),e.uuidv6=(r)=>e.check(Yh(mc,r)),e.uuidv7=(r)=>e.check(Xh(mc,r)),e.nanoid=(r)=>e.check(ef(ty,r)),e.guid=(r)=>e.check(rl(a_,r)),e.cuid=(r)=>e.check(tf(ry,r)),e.cuid2=(r)=>e.check(rf(oy,r)),e.ulid=(r)=>e.check(of(sy,r)),e.base64=(r)=>e.check(df(dy,r)),e.base64url=(r)=>e.check(pf(py,r)),e.xid=(r)=>e.check(sf(ny,r)),e.ksuid=(r)=>e.check(nf(iy,r)),e.ipv4=(r)=>e.check(af(ay,r)),e.ipv6=(r)=>e.check(cf(cy,r)),e.cidrv4=(r)=>e.check(uf(uy,r)),e.cidrv6=(r)=>e.check(lf(ly,r)),e.e164=(r)=>e.check(mf(my,r)),e.datetime=(r)=>e.check(Lo(r)),e.date=(r)=>e.check(Ul(r)),e.time=(r)=>e.check(Bf(r)),e.duration=(r)=>e.check(Jf(r))});function u(e){return Wh(m_,e)}var fe=w("ZodStringFormat",(e,t)=>{pe.init(e,t),p_.init(e,t)}),h_=w("ZodEmail",(e,t)=>{Gm.init(e,t),fe.init(e,t)});function f_(e){return tl(h_,e)}var a_=w("ZodGUID",(e,t)=>{Wm.init(e,t),fe.init(e,t)});var mc=w("ZodUUID",(e,t)=>{Km.init(e,t),fe.init(e,t)});var __=w("ZodURL",(e,t)=>{Ym.init(e,t),fe.init(e,t)});function hc(e){return ol(__,e)}var ey=w("ZodEmoji",(e,t)=>{Xm.init(e,t),fe.init(e,t)});var ty=w("ZodNanoID",(e,t)=>{Qm.init(e,t),fe.init(e,t)});var ry=w("ZodCUID",(e,t)=>{eh.init(e,t),fe.init(e,t)});var oy=w("ZodCUID2",(e,t)=>{th.init(e,t),fe.init(e,t)});var sy=w("ZodULID",(e,t)=>{rh.init(e,t),fe.init(e,t)});var ny=w("ZodXID",(e,t)=>{oh.init(e,t),fe.init(e,t)});var iy=w("ZodKSUID",(e,t)=>{sh.init(e,t),fe.init(e,t)});var ay=w("ZodIPv4",(e,t)=>{uh.init(e,t),fe.init(e,t)});var cy=w("ZodIPv6",(e,t)=>{lh.init(e,t),fe.init(e,t)});var uy=w("ZodCIDRv4",(e,t)=>{dh.init(e,t),fe.init(e,t)});var ly=w("ZodCIDRv6",(e,t)=>{ph.init(e,t),fe.init(e,t)});var dy=w("ZodBase64",(e,t)=>{hh.init(e,t),fe.init(e,t)});var py=w("ZodBase64URL",(e,t)=>{fh.init(e,t),fe.init(e,t)});var my=w("ZodE164",(e,t)=>{_h.init(e,t),fe.init(e,t)});var hy=w("ZodJWT",(e,t)=>{gh.init(e,t),fe.init(e,t)});var fc=w("ZodNumber",(e,t)=>{Gu.init(e,t),ue.init(e,t),e._zod.processJSONSchema=(o,s,n)=>_l(e,o,s,n),Rn(e,"ZodNumber",{gt(o,s){return this.check(nc(o,s))},gte(o,s){return this.check(vn(o,s))},min(o,s){return this.check(vn(o,s))},lt(o,s){return this.check(sc(o,s))},lte(o,s){return this.check(Sn(o,s))},max(o,s){return this.check(Sn(o,s))},int(o){return this.check(c_(o))},safe(o){return this.check(c_(o))},positive(o){return this.check(nc(0,o))},nonnegative(o){return this.check(vn(0,o))},negative(o){return this.check(sc(0,o))},nonpositive(o){return this.check(Sn(0,o))},multipleOf(o,s){return this.check(ic(o,s))},step(o,s){return this.check(ic(o,s))},finite(){return this}});let r=e._zod.bag;e.minValue=Math.max(r.minimum??Number.NEGATIVE_INFINITY,r.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(r.maximum??Number.POSITIVE_INFINITY,r.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(r.format??"").includes("int")||Number.isSafeInteger(r.multipleOf??0.5),e.isFinite=!0,e.format=r.format??null});function x(e){return vf(fc,e)}var fy=w("ZodNumberFormat",(e,t)=>{Sh.init(e,t),fc.init(e,t)});function c_(e){return yf(fy,e)}var g_=w("ZodBoolean",(e,t)=>{vh.init(e,t),ue.init(e,t),e._zod.processJSONSchema=(r,o,s)=>gl(e,r,o,s)});function I(e){return wf(g_,e)}var _y=w("ZodUndefined",(e,t)=>{bh.init(e,t),ue.init(e,t),e._zod.processJSONSchema=(r,o,s)=>vl(e,r,o,s)});function Zl(e){return zf(_y,e)}var gy=w("ZodNull",(e,t)=>{yh.init(e,t),ue.init(e,t),e._zod.processJSONSchema=(r,o,s)=>Sl(e,r,o,s)});function Jr(e){return Rf(gy,e)}var Sy=w("ZodAny",(e,t)=>{wh.init(e,t),ue.init(e,t),e._zod.processJSONSchema=(r,o,s)=>yl(e,r,o,s)});function _c(){return xf(Sy)}var vy=w("ZodUnknown",(e,t)=>{zh.init(e,t),ue.init(e,t),e._zod.processJSONSchema=(r,o,s)=>wl(e,r,o,s)});function D(){return kf(vy)}var by=w("ZodNever",(e,t)=>{Rh.init(e,t),ue.init(e,t),e._zod.processJSONSchema=(r,o,s)=>bl(e,r,o,s)});function Hl(e){return Pf(by,e)}var yy=w("ZodArray",(e,t)=>{xh.init(e,t),ue.init(e,t),e._zod.processJSONSchema=(r,o,s)=>Pl(e,r,o,s),e.element=t.element,Rn(e,"ZodArray",{min(r,o){return this.check(Mo(r,o))},nonempty(r){return this.check(Mo(1,r))},max(r,o){return this.check(ac(r,o))},length(r,o){return this.check(cc(r,o))},unwrap(){return this.element}})});function b(e,t){return Tf(yy,e,t)}var S_=w("ZodObject",(e,t)=>{Th.init(e,t),ue.init(e,t),e._zod.processJSONSchema=(r,o,s)=>Tl(e,r,o,s),oe(e,"shape",()=>t.shape),Rn(e,"ZodObject",{keyof(){return Y(Object.keys(this._zod.def.shape))},catchall(r){return this.clone({...this._zod.def,catchall:r})},passthrough(){return this.clone({...this._zod.def,catchall:D()})},loose(){return this.clone({...this._zod.def,catchall:D()})},strict(){return this.clone({...this._zod.def,catchall:Hl()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(r){return kb(this,r)},safeExtend(r){return Pb(this,r)},merge(r){return Tb(this,r)},pick(r){return Rb(this,r)},omit(r){return xb(this,r)},partial(...r){return Eb(y_,this,r[0])},required(...r){return $b(w_,this,r[0])}})});function p(e,t){let r={type:"object",shape:e??{},...H(t)};return new S_(r)}function V(e,t){return new S_({type:"object",shape:e,catchall:D(),...H(t)})}var v_=w("ZodUnion",(e,t)=>{Yu.init(e,t),ue.init(e,t),e._zod.processJSONSchema=(r,o,s)=>El(e,r,o,s),e.options=t.options});function q(e,t){return new v_({type:"union",options:e,...H(t)})}var wy=w("ZodDiscriminatedUnion",(e,t)=>{v_.init(e,t),Eh.init(e,t)});function Uo(e,t,r){return new wy({type:"union",options:t,discriminator:e,...H(r)})}var zy=w("ZodIntersection",(e,t)=>{$h.init(e,t),ue.init(e,t),e._zod.processJSONSchema=(r,o,s)=>$l(e,r,o,s)});function Vt(e,t){return new zy({type:"intersection",left:e,right:t})}var u_=w("ZodRecord",(e,t)=>{Ch.init(e,t),ue.init(e,t),e._zod.processJSONSchema=(r,o,s)=>Cl(e,r,o,s),e.keyType=t.keyType,e.valueType=t.valueType});function C(e,t,r){if(!t||!t._zod)return new u_({type:"record",keyType:u(),valueType:e,...H(t)});return new u_({type:"record",keyType:e,valueType:t,...H(r)})}var Dl=w("ZodEnum",(e,t)=>{Ih.init(e,t),ue.init(e,t),e._zod.processJSONSchema=(o,s,n)=>zl(e,o,s,n),e.enum=t.entries,e.options=Object.values(t.entries);let r=new Set(Object.keys(t.entries));e.extract=(o,s)=>{let n={};for(let i of o)if(r.has(i))n[i]=t.entries[i];else throw Error(`Key ${i} not found in enum`);return new Dl({...t,checks:[],...H(s),entries:n})},e.exclude=(o,s)=>{let n={...t.entries};for(let i of o)if(r.has(i))delete n[i];else throw Error(`Key ${i} not found in enum`);return new Dl({...t,checks:[],...H(s),entries:n})}});function Y(e,t){let r=Array.isArray(e)?Object.fromEntries(e.map((o)=>[o,o])):e;return new Dl({type:"enum",entries:r,...H(t)})}var Ry=w("ZodLiteral",(e,t)=>{qh.init(e,t),ue.init(e,t),e._zod.processJSONSchema=(r,o,s)=>Rl(e,r,o,s),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function m(e,t){return new Ry({type:"literal",values:Array.isArray(e)?e:[e],...H(t)})}var xy=w("ZodTransform",(e,t)=>{Oh.init(e,t),ue.init(e,t),e._zod.processJSONSchema=(r,o,s)=>kl(e,r,o,s),e._zod.parse=(r,o)=>{if(o.direction==="backward")throw new dn(e.constructor.name);r.addIssue=(n)=>{if(typeof n==="string")r.issues.push(Br(n,r.value,t));else{let i=n;if(i.fatal)i.continue=!1;i.code??(i.code="custom"),i.input??(i.input=r.value),i.inst??(i.inst=e),r.issues.push(Br(i))}};let s=t.transform(r.value,r);if(s instanceof Promise)return s.then((n)=>(r.value=n,r.fallback=!0,r));return r.value=s,r.fallback=!0,r}});function b_(e){return new xy({type:"transform",transform:e})}var y_=w("ZodOptional",(e,t)=>{Xu.init(e,t),ue.init(e,t),e._zod.processJSONSchema=(r,o,s)=>uc(e,r,o,s),e.unwrap=()=>e._zod.def.innerType});function F(e){return new y_({type:"optional",innerType:e})}var ky=w("ZodExactOptional",(e,t)=>{Nh.init(e,t),ue.init(e,t),e._zod.processJSONSchema=(r,o,s)=>uc(e,r,o,s),e.unwrap=()=>e._zod.def.innerType});function Py(e){return new ky({type:"optional",innerType:e})}var Ty=w("ZodNullable",(e,t)=>{jh.init(e,t),ue.init(e,t),e._zod.processJSONSchema=(r,o,s)=>Il(e,r,o,s),e.unwrap=()=>e._zod.def.innerType});function l_(e){return new Ty({type:"nullable",innerType:e})}var Ey=w("ZodDefault",(e,t)=>{Mh.init(e,t),ue.init(e,t),e._zod.processJSONSchema=(r,o,s)=>Ol(e,r,o,s),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function $y(e,t){return new Ey({type:"default",innerType:e,get defaultValue(){return typeof t==="function"?t():Au(t)}})}var Cy=w("ZodPrefault",(e,t)=>{Ah.init(e,t),ue.init(e,t),e._zod.processJSONSchema=(r,o,s)=>Nl(e,r,o,s),e.unwrap=()=>e._zod.def.innerType});function Iy(e,t){return new Cy({type:"prefault",innerType:e,get defaultValue(){return typeof t==="function"?t():Au(t)}})}var w_=w("ZodNonOptional",(e,t)=>{Lh.init(e,t),ue.init(e,t),e._zod.processJSONSchema=(r,o,s)=>ql(e,r,o,s),e.unwrap=()=>e._zod.def.innerType});function qy(e,t){return new w_({type:"nonoptional",innerType:e,...H(t)})}var Oy=w("ZodCatch",(e,t)=>{Uh.init(e,t),ue.init(e,t),e._zod.processJSONSchema=(r,o,s)=>jl(e,r,o,s),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Ny(e,t){return new Oy({type:"catch",innerType:e,catchValue:typeof t==="function"?t:()=>t})}var z_=w("ZodPipe",(e,t)=>{Qu.init(e,t),ue.init(e,t),e._zod.processJSONSchema=(r,o,s)=>Ml(e,r,o,s),e.in=t.in,e.out=t.out});function d_(e,t){return new z_({type:"pipe",in:e,out:t})}var jy=w("ZodPreprocess",(e,t)=>{z_.init(e,t),Dh.init(e,t)}),My=w("ZodReadonly",(e,t)=>{Zh.init(e,t),ue.init(e,t),e._zod.processJSONSchema=(r,o,s)=>Al(e,r,o,s),e.unwrap=()=>e._zod.def.innerType});function Ay(e){return new My({type:"readonly",innerType:e})}var Ly=w("ZodLazy",(e,t)=>{Hh.init(e,t),ue.init(e,t),e._zod.processJSONSchema=(r,o,s)=>Ll(e,r,o,s),e.unwrap=()=>e._zod.def.getter()});function xn(e){return new Ly({type:"lazy",getter:e})}var Uy=w("ZodCustom",(e,t)=>{Fh.init(e,t),ue.init(e,t),e._zod.processJSONSchema=(r,o,s)=>xl(e,r,o,s)});function Dy(e,t={}){return Ef(Uy,e,t)}function Zy(e,t){return $f(e,t)}function Wr(e,t){return new jy({type:"pipe",in:b_(e),out:t})}var x_={invalid_type:"invalid_type",too_big:"too_big",too_small:"too_small",invalid_format:"invalid_format",not_multiple_of:"not_multiple_of",unrecognized_keys:"unrecognized_keys",invalid_union:"invalid_union",invalid_key:"invalid_key",invalid_element:"invalid_element",invalid_value:"invalid_value",custom:"custom"};var R_;(function(e){})(R_||(R_={}));function Hy(e){return bf(fc,e)}Je(el());var Kr="2025-11-25";var gc=[Kr,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],Sc="io.modelcontextprotocol/related-task",Jt="io.modelcontextprotocol/protocolVersion",Do="io.modelcontextprotocol/clientInfo",It="io.modelcontextprotocol/serverInfo",Gr="io.modelcontextprotocol/clientCapabilities",Zo="io.modelcontextprotocol/subscriptionId",Ho="io.modelcontextprotocol/logLevel";var Yr="2.0";var Bt=xn(()=>q([u(),x(),I(),Jr(),C(u(),Bt),b(Bt)])),ge=C(u(),Bt),vc=b(Bt),Fo=q([u(),x().int()]),Vo=u(),kn=p({ttl:x().optional()}),Pn=p({taskId:u()}),Bo=V({progressToken:Fo.optional(),[Sc]:Pn.optional()}),Te=p({_meta:Bo.optional()}),hr=Te.extend({task:kn.optional()}),Se=p({method:u(),params:Te.loose().optional()}),Ae=p({_meta:Bo.optional()}),qe=p({method:u(),params:Ae.loose().optional()}),Jo=V({get[It](){return qt.optional().catch(void 0)}}),ve=V({_meta:Jo.optional()}),_t=q([u(),x().int()]),Wo=p({jsonrpc:m(Yr),id:_t,...Se.shape}).strict(),Ko=p({jsonrpc:m(Yr),...qe.shape}).strict(),Xr=p({jsonrpc:m(Yr),id:_t,result:ve}).strict(),Qr=p({jsonrpc:m(Yr),id:_t.optional(),error:p({code:x().int(),message:u(),data:D().optional()})}).strict(),gt=q([Wo,Ko,Xr,Qr]),bc=q([Xr,Qr]),fr=ve.strict(),Tn=Ae.extend({requestId:_t.optional(),reason:u().optional()}),Go=qe.extend({method:m("notifications/cancelled"),params:Tn}),En=p({src:u(),mimeType:u().optional(),sizes:b(u()).optional(),theme:Y(["light","dark"]).optional()}),Wt=p({icons:b(En).optional()}),Ct=p({name:u(),title:u().optional()}),qt=Ct.extend({...Ct.shape,...Wt.shape,version:u(),websiteUrl:u().optional(),description:u().optional()}),Fy=Vt(p({applyDefaults:I().optional()}),ge),Vy=Wr((e)=>{if(e&&typeof e==="object"&&!Array.isArray(e)&&Object.keys(e).length===0)return{form:{}};return e},Vt(p({form:Fy.optional(),url:ge.optional()}),ge.optional())),yc=V({list:ge.optional(),cancel:ge.optional(),requests:V({sampling:V({createMessage:ge.optional()}).optional(),elicitation:V({create:ge.optional()}).optional()}).optional()}),wc=V({list:ge.optional(),cancel:ge.optional(),requests:V({tools:V({call:ge.optional()}).optional()}).optional()}),$n=p({experimental:C(u(),ge).optional(),sampling:p({context:ge.optional(),tools:ge.optional()}).optional(),elicitation:Vy.optional(),roots:p({listChanged:I().optional()}).optional(),tasks:yc.optional(),extensions:C(u(),ge).optional()}),Cn=Te.extend({protocolVersion:u(),capabilities:$n,clientInfo:qt}),Yo=Se.extend({method:m("initialize"),params:Cn}),Xo=p({experimental:C(u(),ge).optional(),logging:ge.optional(),completions:ge.optional(),prompts:p({listChanged:I().optional()}).optional(),resources:p({subscribe:I().optional(),listChanged:I().optional()}).optional(),tools:p({listChanged:I().optional()}).optional(),tasks:wc.optional(),extensions:C(u(),ge).optional()}),In=ve.extend({protocolVersion:u(),capabilities:Xo,serverInfo:qt,instructions:u().optional()}),Qo=qe.extend({method:m("notifications/initialized"),params:Ae.optional()}),qn=Se.extend({method:m("server/discover"),params:Te.optional()}),_r=ve.extend({supportedVersions:b(u()),capabilities:Xo,instructions:u().optional()}),es=Se.extend({method:m("ping"),params:Te.optional()}),On=p({progress:x(),total:F(x()),message:F(u())}),Nn=p({...Ae.shape,...On.shape,progressToken:Fo}),ts=qe.extend({method:m("notifications/progress"),params:Nn}),jn=Te.extend({cursor:Vo.optional()}),Kt=Se.extend({params:jn.optional()}),Gt=ve.extend({nextCursor:Vo.optional()}),rs=p({uri:u(),mimeType:F(u()),_meta:C(u(),D()).optional()}),os=rs.extend({text:u()}),Fl=u().refine((e)=>{try{return atob(e),!0}catch{return!1}},{message:"Invalid Base64 string"}),ss=rs.extend({blob:Fl}),Yt=Y(["user","assistant"]),Ot=p({audience:b(Yt).optional(),priority:x().min(0).max(1).optional(),lastModified:Lo({offset:!0}).optional()}),ns=p({...Ct.shape,...Wt.shape,uri:u(),description:F(u()),mimeType:F(u()),size:F(x()),annotations:Ot.optional(),_meta:F(V({}))}),Mn=p({...Ct.shape,...Wt.shape,uriTemplate:u(),description:F(u()),mimeType:F(u()),annotations:Ot.optional(),_meta:F(V({}))}),An=Kt.extend({method:m("resources/list")}),Ln=Gt.extend({resources:b(ns)}),Un=Kt.extend({method:m("resources/templates/list")}),Dn=Gt.extend({resourceTemplates:b(Mn)}),eo=Te.extend({uri:u()}),Zn=eo,Hn=Se.extend({method:m("resources/read"),params:Zn}),Fn=ve.extend({contents:b(q([os,ss]))}),Vn=qe.extend({method:m("notifications/resources/list_changed"),params:Ae.optional()}),Bn=eo,Jn=Se.extend({method:m("resources/subscribe"),params:Bn}),Wn=eo,Kn=Se.extend({method:m("resources/unsubscribe"),params:Wn}),is=p({toolsListChanged:I().optional(),promptsListChanged:I().optional(),resourcesListChanged:I().optional(),resourceSubscriptions:b(u()).optional()}),Gn=Te.extend({notifications:is}),Yn=Se.extend({method:m("subscriptions/listen"),params:Gn}),Xn=Ae.extend({notifications:is}),Qn=qe.extend({method:m("notifications/subscriptions/acknowledged"),params:Xn}),ei=Jo.extend({[Zo]:_t}),ti=ve.extend({_meta:ei}),ri=Ae.extend({uri:u()}),oi=qe.extend({method:m("notifications/resources/updated"),params:ri}),si=p({name:u(),description:F(u()),required:F(I())}),ni=p({...Ct.shape,...Wt.shape,description:F(u()),arguments:F(b(si)),_meta:F(V({}))}),ii=Kt.extend({method:m("prompts/list")}),ai=Gt.extend({prompts:b(ni)}),ci=Te.extend({name:u(),arguments:C(u(),u()).optional()}),ui=Se.extend({method:m("prompts/get"),params:ci}),to=p({type:m("text"),text:u(),annotations:Ot.optional(),_meta:C(u(),D()).optional()}),ro=p({type:m("image"),data:Fl,mimeType:u(),annotations:Ot.optional(),_meta:C(u(),D()).optional()}),oo=p({type:m("audio"),data:Fl,mimeType:u(),annotations:Ot.optional(),_meta:C(u(),D()).optional()}),li=p({type:m("tool_use"),name:u(),id:u(),input:C(u(),D()),_meta:C(u(),D()).optional()}),so=p({type:m("resource"),resource:q([os,ss]),annotations:Ot.optional(),_meta:C(u(),D()).optional()}),no=ns.extend({type:m("resource_link")}),Nt=q([to,ro,oo,no,so]),di=p({role:Yt,content:Nt}),pi=ve.extend({description:u().optional(),messages:b(di)}),mi=qe.extend({method:m("notifications/prompts/list_changed"),params:Ae.optional()}),hi=p({title:u().optional(),readOnlyHint:I().optional(),destructiveHint:I().optional(),idempotentHint:I().optional(),openWorldHint:I().optional()}),fi=p({taskSupport:Y(["required","optional","forbidden"]).optional()}),gr=p({...Ct.shape,...Wt.shape,description:u().optional(),inputSchema:p({type:m("object"),properties:C(u(),Bt).optional(),required:b(u()).optional()}).catchall(D()),outputSchema:V({$schema:u().optional()}).optional(),annotations:hi.optional(),execution:fi.optional(),_meta:C(u(),D()).optional()}),_i=Kt.extend({method:m("tools/list")}),gi=Gt.extend({tools:b(gr)}),Sr=ve.extend({content:b(Nt).default([]),structuredContent:D().optional(),isError:I().optional()}),zc=Sr.or(ve.extend({toolResult:D()})),Si=hr.extend({name:u(),arguments:C(u(),D()).optional()}),vi=Se.extend({method:m("tools/call"),params:Si}),bi=qe.extend({method:m("notifications/tools/list_changed"),params:Ae.optional()}),yi=p({autoRefresh:I().default(!0),debounceMs:x().int().nonnegative().default(300)}),as=Y(["debug","info","notice","warning","error","critical","alert","emergency"]),wi=Te.extend({level:as}),zi=Se.extend({method:m("logging/setLevel"),params:wi}),Ri=Ae.extend({level:as,logger:u().optional(),data:D()}),io=qe.extend({method:m("notifications/message"),params:Ri}),xi=p({name:u().optional()}),ki=p({hints:b(xi).optional(),costPriority:x().min(0).max(1).optional(),speedPriority:x().min(0).max(1).optional(),intelligencePriority:x().min(0).max(1).optional()}),Pi=p({mode:Y(["auto","required","none"]).optional()}),Ti=p({type:m("tool_result"),toolUseId:u().describe("The unique identifier for the corresponding tool call."),content:b(Nt),structuredContent:D().optional(),isError:I().optional(),_meta:C(u(),D()).optional()}),Ei=Uo("type",[to,ro,oo]),mr=Uo("type",[to,ro,oo,li,Ti]),$i=p({role:Yt,content:q([mr,b(mr)]),_meta:C(u(),D()).optional()}),Ci=hr.extend({messages:b($i),modelPreferences:ki.optional(),systemPrompt:u().optional(),includeContext:Y(["none","thisServer","allServers"]).optional(),temperature:x().optional(),maxTokens:x().int(),stopSequences:b(u()).optional(),metadata:ge.optional(),tools:b(gr).optional(),toolChoice:Pi.optional()}),Ii=Se.extend({method:m("sampling/createMessage"),params:Ci}),qi=ve.extend({model:u(),stopReason:F(Y(["endTurn","stopSequence","maxTokens"]).or(u())),role:Yt,content:Ei}),Oi=ve.extend({model:u(),stopReason:F(Y(["endTurn","stopSequence","maxTokens","toolUse"]).or(u())),role:Yt,content:q([mr,b(mr)])}),cs=p({type:m("boolean"),title:u().optional(),description:u().optional(),default:I().optional()}),ao=p({type:m("string"),title:u().optional(),description:u().optional(),minLength:x().optional(),maxLength:x().optional(),format:Y(["email","uri","date","date-time"]).optional(),default:u().optional()}),co=p({type:Y(["number","integer"]),title:u().optional(),description:u().optional(),minimum:x().optional(),maximum:x().optional(),default:x().optional()}),us=p({type:m("string"),title:u().optional(),description:u().optional(),enum:b(u()),default:u().optional()}),ls=p({type:m("string"),title:u().optional(),description:u().optional(),oneOf:b(p({const:u(),title:u()})),default:u().optional()}),ds=p({type:m("string"),title:u().optional(),description:u().optional(),enum:b(u()),enumNames:b(u()).optional(),default:u().optional()}),Ni=q([us,ls]),ps=p({type:m("array"),title:u().optional(),description:u().optional(),minItems:x().optional(),maxItems:x().optional(),items:p({type:m("string"),enum:b(u())}),default:b(u()).optional()}),ms=p({type:m("array"),title:u().optional(),description:u().optional(),minItems:x().optional(),maxItems:x().optional(),items:p({anyOf:b(p({const:u(),title:u()}))}),default:b(u()).optional()}),ji=q([ps,ms]),Mi=q([ds,Ni,ji]),hs=q([Mi,cs,ao,co]),uo=hr.extend({mode:m("form").optional(),message:u(),requestedSchema:p({type:m("object"),properties:C(u(),hs),required:b(u()).optional()}).catchall(D())}),Ai=hr.extend({mode:m("url"),message:u(),elicitationId:u(),url:u().url()}),Li=q([uo,Ai]),Ui=Se.extend({method:m("elicitation/create"),params:Li}),Di=Ae.extend({elicitationId:u()}),Zi=qe.extend({method:m("notifications/elicitation/complete"),params:Di}),Hi=ve.extend({action:Y(["accept","decline","cancel"]),content:Wr((e)=>e===null?void 0:e,C(u(),q([u(),x(),I(),b(u())])).optional())}),Fi=p({type:m("ref/resource"),uri:u()}),Vi=p({type:m("ref/prompt"),name:u()}),Bi=Te.extend({ref:q([Vi,Fi]),argument:p({name:u(),value:u()}),context:p({arguments:C(u(),u()).optional()}).optional()}),Ji=Se.extend({method:m("completion/complete"),params:Bi}),Wi=ve.extend({completion:V({values:b(u()).max(100),total:F(x().int()),hasMore:F(I())})}),Ki=p({uri:u().startsWith("file://"),name:u().optional(),_meta:C(u(),D()).optional()}),Gi=Se.extend({method:m("roots/list"),params:Te.optional()}),Yi=ve.extend({roots:b(Ki)}),Xi=qe.extend({method:m("notifications/roots/list_changed"),params:Ae.optional()}),Rc=V({ttl:x().optional(),pollInterval:x().optional()}),Qi=Y(["working","input_required","completed","failed","cancelled"]),Xt=p({taskId:u(),status:Qi,ttl:q([x(),Jr()]),createdAt:u(),lastUpdatedAt:u(),pollInterval:F(x()),statusMessage:F(u())}),xc=ve.extend({task:Xt}),ea=Ae.merge(Xt),kc=qe.extend({method:m("notifications/tasks/status"),params:ea}),Pc=Se.extend({method:m("tasks/get"),params:Te.extend({taskId:u()})}),Tc=ve.merge(Xt),Ec=Se.extend({method:m("tasks/result"),params:Te.extend({taskId:u()})}),$c=ve.loose(),Cc=Kt.extend({method:m("tasks/list")}),Ic=Gt.extend({tasks:b(Xt)}),qc=Se.extend({method:m("tasks/cancel"),params:Te.extend({taskId:u()})}),Oc=ve.merge(Xt),Nc=q([es,Yo,qn,Ji,zi,ui,ii,An,Un,Hn,Jn,Kn,Yn,vi,_i]),jc=q([Go,ts,Qo,Xi]),Mc=q([fr,qi,Oi,Hi,Yi]),Ac=q([es,Ii,Ui,Gi]),Lc=q([Go,ts,io,oi,Vn,bi,mi,Qn,Zi]),Uc=q([fr,In,_r,Wi,pi,ai,Ln,Dn,Fn,Sr,gi,ti]);var Ee=hc().superRefine((e,t)=>{if(!URL.canParse(e))return t.addIssue({code:x_.custom,message:"URL must be parseable",fatal:!0}),qu}).refine((e)=>{let t=new URL(e);return t.protocol!=="javascript:"&&t.protocol!=="data:"&&t.protocol!=="vbscript:"},{message:"URL cannot use javascript:, data:, or vbscript: scheme"}),fs=V({resource:u().url(),authorization_servers:b(Ee).optional(),jwks_uri:u().url().optional(),scopes_supported:b(u()).optional(),bearer_methods_supported:b(u()).optional(),resource_signing_alg_values_supported:b(u()).optional(),resource_name:u().optional(),resource_documentation:u().optional(),resource_policy_uri:u().url().optional(),resource_tos_uri:u().url().optional(),tls_client_certificate_bound_access_tokens:I().optional(),authorization_details_types_supported:b(u()).optional(),dpop_signing_alg_values_supported:b(u()).optional(),dpop_bound_access_tokens_required:I().optional()}),lo=V({issuer:u(),authorization_endpoint:Ee,token_endpoint:Ee,registration_endpoint:Ee.optional(),scopes_supported:b(u()).optional(),response_types_supported:b(u()),response_modes_supported:b(u()).optional(),grant_types_supported:b(u()).optional(),token_endpoint_auth_methods_supported:b(u()).optional(),token_endpoint_auth_signing_alg_values_supported:b(u()).optional(),service_documentation:Ee.optional(),revocation_endpoint:Ee.optional(),revocation_endpoint_auth_methods_supported:b(u()).optional(),revocation_endpoint_auth_signing_alg_values_supported:b(u()).optional(),introspection_endpoint:u().optional(),introspection_endpoint_auth_methods_supported:b(u()).optional(),introspection_endpoint_auth_signing_alg_values_supported:b(u()).optional(),code_challenge_methods_supported:b(u()).optional(),client_id_metadata_document_supported:I().optional(),authorization_response_iss_parameter_supported:I().optional().catch(void 0),dpop_signing_alg_values_supported:b(u()).optional()}),ta=V({issuer:u(),authorization_endpoint:Ee,token_endpoint:Ee,userinfo_endpoint:Ee.optional(),jwks_uri:Ee,registration_endpoint:Ee.optional(),scopes_supported:b(u()).optional(),response_types_supported:b(u()),response_modes_supported:b(u()).optional(),grant_types_supported:b(u()).optional(),acr_values_supported:b(u()).optional(),subject_types_supported:b(u()),id_token_signing_alg_values_supported:b(u()),id_token_encryption_alg_values_supported:b(u()).optional(),id_token_encryption_enc_values_supported:b(u()).optional(),userinfo_signing_alg_values_supported:b(u()).optional(),userinfo_encryption_alg_values_supported:b(u()).optional(),userinfo_encryption_enc_values_supported:b(u()).optional(),request_object_signing_alg_values_supported:b(u()).optional(),request_object_encryption_alg_values_supported:b(u()).optional(),request_object_encryption_enc_values_supported:b(u()).optional(),token_endpoint_auth_methods_supported:b(u()).optional(),token_endpoint_auth_signing_alg_values_supported:b(u()).optional(),display_values_supported:b(u()).optional(),claim_types_supported:b(u()).optional(),claims_supported:b(u()).optional(),service_documentation:u().optional(),claims_locales_supported:b(u()).optional(),ui_locales_supported:b(u()).optional(),claims_parameter_supported:I().optional(),request_parameter_supported:I().optional(),request_uri_parameter_supported:I().optional(),require_request_uri_registration:I().optional(),op_policy_uri:Ee.optional(),op_tos_uri:Ee.optional(),client_id_metadata_document_supported:I().optional(),authorization_response_iss_parameter_supported:I().optional().catch(void 0)}),_s=p({...ta.shape,...lo.pick({code_challenge_methods_supported:!0}).shape}),po=p({access_token:u(),id_token:u().optional(),token_type:u(),expires_in:Hy().optional(),scope:u().optional(),refresh_token:u().optional(),issuer:u().optional().catch(void 0)}).strip(),ra=p({issued_token_type:m("urn:ietf:params:oauth:token-type:id-jag"),access_token:u(),token_type:u().optional(),expires_in:x().optional(),scope:u().optional()}).strip(),mo=p({error:u(),error_description:u().optional(),error_uri:u().optional()}),Vl=Ee.optional().or(m("").transform(()=>{return})),oa=p({redirect_uris:b(Ee),token_endpoint_auth_method:u().optional(),grant_types:b(u()).optional(),response_types:b(u()).optional(),application_type:u().optional(),client_name:u().optional(),client_uri:Ee.optional(),logo_uri:Vl,scope:u().optional(),contacts:b(u()).optional(),tos_uri:Vl,policy_uri:u().optional(),jwks_uri:Ee.optional(),jwks:_c().optional(),software_id:u().optional(),software_version:u().optional(),software_statement:u().optional()}).strip(),sa=p({client_id:u(),client_secret:u().optional(),client_id_issued_at:x().optional(),client_secret_expires_at:x().optional(),issuer:u().optional().catch(void 0)}).strip(),gs=oa.merge(sa),Dc=p({error:u(),error_description:u().optional()}).strip(),Zc=p({token:u(),token_type_hint:u().optional()}).strip();var Gl=Symbol.for("mcp.sdk.errorBrands");function br(e,t){let r=new Set,o=t;while(typeof o==="function"){let s=o.mcpBrand;if(Object.prototype.hasOwnProperty.call(o,"mcpBrand")&&typeof s==="string")r.add(s);o=Object.getPrototypeOf(o)}if(r.size===0)return;Object.defineProperty(e,Gl,{value:r,enumerable:!1,configurable:!0})}function We(e,t){try{if(typeof t==="object"&&t!==null&&Object.prototype.hasOwnProperty.call(e,"mcpBrand")&&typeof e.mcpBrand==="string"&&Object.prototype.hasOwnProperty.call(t,Gl)){let r=t[Gl];if(r&&typeof r.has==="function"&&r.has(e.mcpBrand))return!0}}catch{}return Function.prototype[Symbol.hasInstance].call(e,t)}var jt=function(e){return e.InvalidRequest="invalid_request",e.InvalidClient="invalid_client",e.InvalidGrant="invalid_grant",e.UnauthorizedClient="unauthorized_client",e.UnsupportedGrantType="unsupported_grant_type",e.InvalidScope="invalid_scope",e.AccessDenied="access_denied",e.ServerError="server_error",e.TemporarilyUnavailable="temporarily_unavailable",e.UnsupportedResponseType="unsupported_response_type",e.UnsupportedTokenType="unsupported_token_type",e.InvalidToken="invalid_token",e.MethodNotAllowed="method_not_allowed",e.TooManyRequests="too_many_requests",e.InvalidClientMetadata="invalid_client_metadata",e.InvalidRedirectUri="invalid_redirect_uri",e.InsufficientScope="insufficient_scope",e.InvalidTarget="invalid_target",e.InvalidDpopProof="invalid_dpop_proof",e.UseDpopNonce="use_dpop_nonce",e}({}),yr=class e extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.OAuthError"})}static[Symbol.hasInstance](t){return We(this,t)}static isInstance(t){if(typeof this!=="function")throw TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return We(this,t)}constructor(t,r,o){super(r);this.code=t,this.errorUri=o,this.name="OAuthError",br(this,new.target)}toResponseObject(){let t={error:this.code,error_description:this.message};if(this.errorUri)t.error_uri=this.errorUri;return t}static fromResponse(t){return new e(t.error,t.error_description??t.error,t.error_uri)}},A=function(e){return e.NotConnected="NOT_CONNECTED",e.AlreadyConnected="ALREADY_CONNECTED",e.NotInitialized="NOT_INITIALIZED",e.CapabilityNotSupported="CAPABILITY_NOT_SUPPORTED",e.RequestTimeout="REQUEST_TIMEOUT",e.ConnectionClosed="CONNECTION_CLOSED",e.SendFailed="SEND_FAILED",e.InvalidResult="INVALID_RESULT",e.UnsupportedResultType="UNSUPPORTED_RESULT_TYPE",e.InputRequiredRoundsExceeded="INPUT_REQUIRED_ROUNDS_EXCEEDED",e.ListPaginationExceeded="LIST_PAGINATION_EXCEEDED",e.MethodNotSupportedByProtocolVersion="METHOD_NOT_SUPPORTED_BY_PROTOCOL_VERSION",e.EraNegotiationFailed="ERA_NEGOTIATION_FAILED",e.ClientHttpNotImplemented="CLIENT_HTTP_NOT_IMPLEMENTED",e.ClientHttpAuthentication="CLIENT_HTTP_AUTHENTICATION",e.ClientHttpForbidden="CLIENT_HTTP_FORBIDDEN",e.ClientHttpUnexpectedContent="CLIENT_HTTP_UNEXPECTED_CONTENT",e.ClientHttpFailedToOpenStream="CLIENT_HTTP_FAILED_TO_OPEN_STREAM",e.ClientHttpFailedToTerminateSession="CLIENT_HTTP_FAILED_TO_TERMINATE_SESSION",e}({}),L=class extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.SdkError"})}static[Symbol.hasInstance](e){return We(this,e)}static isInstance(e){if(typeof this!=="function")throw TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return We(this,e)}constructor(e,t,r,o){super(t,o);this.code=e,this.data=r,this.name="SdkError",br(this,new.target)}},St=class extends L{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.SdkHttpError"})}constructor(e,t,r,o){super(e,t,r,o);this.name="SdkHttpError"}get status(){return this.data.status}get statusText(){return this.data.statusText}};function td(e){let t=typeof e==="string"?new URL(e):new URL(e.href);return t.hash="",t}function Kc(e){if(typeof e!=="object"||e===null||Array.isArray(e))return e;let t={...e};return delete t.issuer,t}function rd({requestedResource:e,configuredResource:t}){let r=typeof e==="string"?new URL(e):new URL(e.href),o=typeof t==="string"?new URL(t):new URL(t.href);if(r.origin!==o.origin)return!1;if(r.pathname.length<o.pathname.length)return!1;let s=r.pathname.endsWith("/")?r.pathname:r.pathname+"/",n=o.pathname.endsWith("/")?o.pathname:o.pathname+"/";return s.startsWith(n)}var X_="2026-07-28",od=[X_];function Mt(e){return e>=X_}function sd(e){return e.filter((t)=>!Mt(t))}function la(e){return e.filter((t)=>Mt(t))}function Q_(e){let t=e.structuredContent;if(t===void 0)return e;if(!(typeof t!=="object"||t===null||Array.isArray(t)))return e;if(e.content?.some((r)=>r.type==="text")??!1)return e;return{...e,content:[...e.content??[],{type:"text",text:JSON.stringify(t)}]}}var eg=["task","inputRequests","requestState"];function By(e){if(e===null||typeof e!=="object"||Array.isArray(e)||e.content!==void 0||eg.some((t)=>(t in e)))return e;return{...e,content:[]}}function Jy(){let e=xn(()=>q([u(),x(),I(),Jr(),C(u(),e),b(e)])),t=C(u(),e),r=q([u(),x().int()]),o=u(),s=p({ttl:x().optional()}),n=p({taskId:u()}),i=V({progressToken:r.optional(),"io.modelcontextprotocol/related-task":n.optional()}),a=p({_meta:i.optional()}),c=a.extend({task:s.optional()}),l=p({method:u(),params:a.loose().optional()}),d=p({_meta:i.optional()}),f=p({method:u(),params:d.loose().optional()}),h=V({_meta:i.optional()}),g=q([u(),x().int()]),v=h.strict(),_=d.extend({requestId:g.optional(),reason:u().optional()}),y=f.extend({method:m("notifications/cancelled"),params:_}),T=p({src:u(),mimeType:u().optional(),sizes:b(u()).optional(),theme:Y(["light","dark"]).optional()}),O=p({icons:b(T).optional()}),k=p({name:u(),title:u().optional()}),P=k.extend({...k.shape,...O.shape,version:u(),websiteUrl:u().optional(),description:u().optional()}),z=Vt(p({applyDefaults:I().optional()}),t),R=Wr((Me)=>{if(Me&&typeof Me==="object"&&!Array.isArray(Me)&&Object.keys(Me).length===0)return{form:{}};return Me},Vt(p({form:z.optional(),url:t.optional()}),t.optional())),Z=V({list:t.optional(),cancel:t.optional(),requests:V({sampling:V({createMessage:t.optional()}).optional(),elicitation:V({create:t.optional()}).optional()}).optional()}),ee=V({list:t.optional(),cancel:t.optional(),requests:V({tools:V({call:t.optional()}).optional()}).optional()}),X=p({experimental:C(u(),t).optional(),sampling:p({context:t.optional(),tools:t.optional()}).optional(),elicitation:R.optional(),roots:p({listChanged:I().optional()}).optional(),tasks:Z.optional(),extensions:C(u(),t).optional()}),ne=a.extend({protocolVersion:u(),capabilities:X,clientInfo:P}),xe=l.extend({method:m("initialize"),params:ne}),te=p({experimental:C(u(),t).optional(),logging:t.optional(),completions:t.optional(),prompts:p({listChanged:I().optional()}).optional(),resources:p({subscribe:I().optional(),listChanged:I().optional()}).optional(),tools:p({listChanged:I().optional()}).optional(),tasks:ee.optional(),extensions:C(u(),t).optional()}),ie=h.extend({protocolVersion:u(),capabilities:te,serverInfo:P,instructions:u().optional()}),re=f.extend({method:m("notifications/initialized"),params:d.optional()}),de=l.extend({method:m("ping"),params:a.optional()}),wt=p({progress:x(),total:F(x()),message:F(u())}),Fe=p({...d.shape,...wt.shape,progressToken:r}),nt=f.extend({method:m("notifications/progress"),params:Fe}),zt=a.extend({cursor:o.optional()}),Ge=l.extend({params:zt.optional()}),Le=h.extend({nextCursor:o.optional()}),Zt=p({uri:u(),mimeType:F(u()),_meta:C(u(),D()).optional()}),Ht=Zt.extend({text:u()}),Rt=u().refine((Me)=>{try{return atob(Me),!0}catch{return!1}},{message:"Invalid Base64 string"}),Ne=Zt.extend({blob:Rt}),Ue=Y(["user","assistant"]),De=p({audience:b(Ue).optional(),priority:x().min(0).max(1).optional(),lastModified:Lo({offset:!0}).optional()}),pt=p({...k.shape,...O.shape,uri:u(),description:F(u()),mimeType:F(u()),size:F(x()),annotations:De.optional(),_meta:F(V({}))}),Ir=p({...k.shape,...O.shape,uriTemplate:u(),description:F(u()),mimeType:F(u()),annotations:De.optional(),_meta:F(V({}))}),Ye=Ge.extend({method:m("resources/list")}),Xe=Le.extend({resources:b(pt)}),Ve=Ge.extend({method:m("resources/templates/list")}),it=Le.extend({resourceTemplates:b(Ir)}),at=a.extend({uri:u()}),xt=at,kt=l.extend({method:m("resources/read"),params:xt}),sr=h.extend({contents:b(q([Ht,Ne]))}),Pt=f.extend({method:m("notifications/resources/list_changed"),params:d.optional()}),qr=at,j=l.extend({method:m("resources/subscribe"),params:qr}),Tt=at,B=l.extend({method:m("resources/unsubscribe"),params:Tt}),U=d.extend({uri:u()}),Q=f.extend({method:m("notifications/resources/updated"),params:U}),M=p({name:u(),description:F(u()),required:F(I())}),N=p({...k.shape,...O.shape,description:F(u()),arguments:F(b(M)),_meta:F(V({}))}),K=Ge.extend({method:m("prompts/list")}),J=Le.extend({prompts:b(N)}),ke=a.extend({name:u(),arguments:C(u(),u()).optional()}),Or=l.extend({method:m("prompts/get"),params:ke}),Et=p({type:m("text"),text:u(),annotations:De.optional(),_meta:C(u(),D()).optional()}),Nr=p({type:m("image"),data:Rt,mimeType:u(),annotations:De.optional(),_meta:C(u(),D()).optional()}),jr=p({type:m("audio"),data:Rt,mimeType:u(),annotations:De.optional(),_meta:C(u(),D()).optional()}),js=p({type:m("tool_use"),name:u(),id:u(),input:C(u(),D()),_meta:C(u(),D()).optional()}),nr=p({type:m("resource"),resource:q([Ht,Ne]),annotations:De.optional(),_meta:C(u(),D()).optional()}),Ms=pt.extend({type:m("resource_link")}),ct=q([Et,Nr,jr,Ms,nr]),Ro=p({role:Ue,content:ct}),xo=h.extend({description:u().optional(),messages:b(Ro)}),Mr=f.extend({method:m("notifications/prompts/list_changed"),params:d.optional()}),As=p({title:u().optional(),readOnlyHint:I().optional(),destructiveHint:I().optional(),idempotentHint:I().optional(),openWorldHint:I().optional()}),ko=p({taskSupport:Y(["required","optional","forbidden"]).optional()}),Ar=p({...k.shape,...O.shape,description:u().optional(),inputSchema:p({type:m("object"),properties:C(u(),e).optional(),required:b(u()).optional()}).catchall(D()),outputSchema:p({type:m("object"),properties:C(u(),e).optional(),required:b(u()).optional()}).catchall(D()).optional(),annotations:As.optional(),execution:ko.optional(),_meta:C(u(),D()).optional()}),Po=Ge.extend({method:m("tools/list")}),To=Le.extend({tools:b(Ar)}),Eo=h.extend({content:b(ct),structuredContent:C(u(),D()).optional(),isError:I().optional()}),je=c.extend({name:u(),arguments:C(u(),D()).optional()}),Ls=l.extend({method:m("tools/call"),params:je}),Ea=f.extend({method:m("notifications/tools/list_changed"),params:d.optional()}),$o=Y(["debug","info","notice","warning","error","critical","alert","emergency"]),Us=a.extend({level:$o}),Ds=l.extend({method:m("logging/setLevel"),params:Us}),Zs=d.extend({level:$o,logger:u().optional(),data:D()}),Hs=f.extend({method:m("notifications/message"),params:Zs}),Fs=p({name:u().optional()}),Vs=p({hints:b(Fs).optional(),costPriority:x().min(0).max(1).optional(),speedPriority:x().min(0).max(1).optional(),intelligencePriority:x().min(0).max(1).optional()}),Bs=p({mode:Y(["auto","required","none"]).optional()}),$a=p({type:m("tool_result"),toolUseId:u().describe("The unique identifier for the corresponding tool call."),content:b(ct),structuredContent:p({}).loose().optional(),isError:I().optional(),_meta:C(u(),D()).optional()}),Js=Uo("type",[Et,Nr,jr]),ir=Uo("type",[Et,Nr,jr,js,$a]),Ws=p({role:Ue,content:q([ir,b(ir)]),_meta:C(u(),D()).optional()}),Ks=c.extend({messages:b(Ws),modelPreferences:Vs.optional(),systemPrompt:u().optional(),includeContext:Y(["none","thisServer","allServers"]).optional(),temperature:x().optional(),maxTokens:x().int(),stopSequences:b(u()).optional(),metadata:t.optional(),tools:b(Ar).optional(),toolChoice:Bs.optional()}),Gs=l.extend({method:m("sampling/createMessage"),params:Ks}),Ys=h.extend({model:u(),stopReason:F(Y(["endTurn","stopSequence","maxTokens"]).or(u())),role:Ue,content:Js}),Xs=h.extend({model:u(),stopReason:F(Y(["endTurn","stopSequence","maxTokens","toolUse"]).or(u())),role:Ue,content:q([ir,b(ir)])}),Qs=p({type:m("boolean"),title:u().optional(),description:u().optional(),default:I().optional()}),en=p({type:m("string"),title:u().optional(),description:u().optional(),minLength:x().optional(),maxLength:x().optional(),format:Y(["email","uri","date","date-time"]).optional(),default:u().optional()}),tn=p({type:Y(["number","integer"]),title:u().optional(),description:u().optional(),minimum:x().optional(),maximum:x().optional(),default:x().optional()}),rn=p({type:m("string"),title:u().optional(),description:u().optional(),enum:b(u()),default:u().optional()}),on=p({type:m("string"),title:u().optional(),description:u().optional(),oneOf:b(p({const:u(),title:u()})),default:u().optional()}),sn=p({type:m("string"),title:u().optional(),description:u().optional(),enum:b(u()),enumNames:b(u()).optional(),default:u().optional()}),nn=q([rn,on]),Lr=p({type:m("array"),title:u().optional(),description:u().optional(),minItems:x().optional(),maxItems:x().optional(),items:p({type:m("string"),enum:b(u())}),default:b(u()).optional()}),Ur=p({type:m("array"),title:u().optional(),description:u().optional(),minItems:x().optional(),maxItems:x().optional(),items:p({anyOf:b(p({const:u(),title:u()}))}),default:b(u()).optional()}),Ca=q([Lr,Ur]),Ia=q([sn,nn,Ca]),Qe=q([Ia,Qs,en,tn]),et=c.extend({mode:m("form").optional(),message:u(),requestedSchema:p({type:m("object"),properties:C(u(),Qe),required:b(u()).optional()}).catchall(D())}),an=c.extend({mode:m("url"),message:u(),elicitationId:u(),url:u().url()}),mt=q([et,an]),qa=l.extend({method:m("elicitation/create"),params:mt}),Oa=d.extend({elicitationId:u()}),Na=f.extend({method:m("notifications/elicitation/complete"),params:Oa}),ja=h.extend({action:Y(["accept","decline","cancel"]),content:Wr((Me)=>Me===null?void 0:Me,C(u(),q([u(),x(),I(),b(u())])).optional())}),Ma=p({type:m("ref/resource"),uri:u()}),Aa=p({type:m("ref/prompt"),name:u()}),La=a.extend({ref:q([Aa,Ma]),argument:p({name:u(),value:u()}),context:p({arguments:C(u(),u()).optional()}).optional()}),cn=l.extend({method:m("completion/complete"),params:La}),Ua=h.extend({completion:V({values:b(u()).max(100),total:F(x().int()),hasMore:F(I())})}),Da=p({uri:u().startsWith("file://"),name:u().optional(),_meta:C(u(),D()).optional()}),Co=l.extend({method:m("roots/list"),params:a.optional()}),un=h.extend({roots:b(Da)}),Za=f.extend({method:m("notifications/roots/list_changed"),params:d.optional()}),Ha=V({ttl:x().optional(),pollInterval:x().optional()}),ln=Y(["working","input_required","completed","failed","cancelled"]),ar=p({taskId:u(),status:ln,ttl:q([x(),Jr()]),createdAt:u(),lastUpdatedAt:u(),pollInterval:F(x()),statusMessage:F(u())}),Be=h.extend({task:ar}),Fa=d.merge(ar),Dr=f.extend({method:m("notifications/tasks/status"),params:Fa}),Io=l.extend({method:m("tasks/get"),params:a.extend({taskId:u()})}),qo=h.merge(ar),Oo=l.extend({method:m("tasks/result"),params:a.extend({taskId:u()})}),Iu=h.loose(),Ze=Ge.extend({method:m("tasks/list")}),ye=Le.extend({tasks:b(ar)}),Zr=l.extend({method:m("tasks/cancel"),params:a.extend({taskId:u()})});return{JSONValueSchema:e,JSONObjectSchema:t,ProgressTokenSchema:r,CursorSchema:o,TaskMetadataSchema:s,RelatedTaskMetadataSchema:n,RequestMetaSchema:i,BaseRequestParamsSchema:a,TaskAugmentedRequestParamsSchema:c,RequestSchema:l,NotificationsParamsSchema:d,NotificationSchema:f,ResultSchema:h,RequestIdSchema:g,EmptyResultSchema:v,CancelledNotificationParamsSchema:_,CancelledNotificationSchema:y,IconSchema:T,IconsSchema:O,BaseMetadataSchema:k,ImplementationSchema:P,ClientTasksCapabilitySchema:Z,ServerTasksCapabilitySchema:ee,ClientCapabilitiesSchema:X,InitializeRequestParamsSchema:ne,InitializeRequestSchema:xe,ServerCapabilitiesSchema:te,InitializeResultSchema:ie,InitializedNotificationSchema:re,PingRequestSchema:de,ProgressSchema:wt,ProgressNotificationParamsSchema:Fe,ProgressNotificationSchema:nt,PaginatedRequestParamsSchema:zt,PaginatedRequestSchema:Ge,PaginatedResultSchema:Le,ResourceContentsSchema:Zt,TextResourceContentsSchema:Ht,BlobResourceContentsSchema:Ne,RoleSchema:Ue,AnnotationsSchema:De,ResourceSchema:pt,ResourceTemplateSchema:Ir,ListResourcesRequestSchema:Ye,ListResourcesResultSchema:Xe,ListResourceTemplatesRequestSchema:Ve,ListResourceTemplatesResultSchema:it,ResourceRequestParamsSchema:at,ReadResourceRequestParamsSchema:xt,ReadResourceRequestSchema:kt,ReadResourceResultSchema:sr,ResourceListChangedNotificationSchema:Pt,SubscribeRequestParamsSchema:qr,SubscribeRequestSchema:j,UnsubscribeRequestParamsSchema:Tt,UnsubscribeRequestSchema:B,ResourceUpdatedNotificationParamsSchema:U,ResourceUpdatedNotificationSchema:Q,PromptArgumentSchema:M,PromptSchema:N,ListPromptsRequestSchema:K,ListPromptsResultSchema:J,GetPromptRequestParamsSchema:ke,GetPromptRequestSchema:Or,TextContentSchema:Et,ImageContentSchema:Nr,AudioContentSchema:jr,ToolUseContentSchema:js,EmbeddedResourceSchema:nr,ResourceLinkSchema:Ms,ContentBlockSchema:ct,PromptMessageSchema:Ro,GetPromptResultSchema:xo,PromptListChangedNotificationSchema:Mr,ToolAnnotationsSchema:As,ToolExecutionSchema:ko,ToolSchema:Ar,ListToolsRequestSchema:Po,ListToolsResultSchema:To,CallToolResultSchema:Eo,CallToolRequestParamsSchema:je,CallToolRequestSchema:Ls,ToolListChangedNotificationSchema:Ea,LoggingLevelSchema:$o,SetLevelRequestParamsSchema:Us,SetLevelRequestSchema:Ds,LoggingMessageNotificationParamsSchema:Zs,LoggingMessageNotificationSchema:Hs,ModelHintSchema:Fs,ModelPreferencesSchema:Vs,ToolChoiceSchema:Bs,ToolResultContentSchema:$a,SamplingContentSchema:Js,SamplingMessageContentBlockSchema:ir,SamplingMessageSchema:Ws,CreateMessageRequestParamsSchema:Ks,CreateMessageRequestSchema:Gs,CreateMessageResultSchema:Ys,CreateMessageResultWithToolsSchema:Xs,BooleanSchemaSchema:Qs,StringSchemaSchema:en,NumberSchemaSchema:tn,UntitledSingleSelectEnumSchemaSchema:rn,TitledSingleSelectEnumSchemaSchema:on,LegacyTitledEnumSchemaSchema:sn,SingleSelectEnumSchemaSchema:nn,UntitledMultiSelectEnumSchemaSchema:Lr,TitledMultiSelectEnumSchemaSchema:Ur,MultiSelectEnumSchemaSchema:Ca,EnumSchemaSchema:Ia,PrimitiveSchemaDefinitionSchema:Qe,ElicitRequestFormParamsSchema:et,ElicitRequestURLParamsSchema:an,ElicitRequestParamsSchema:mt,ElicitRequestSchema:qa,ElicitationCompleteNotificationParamsSchema:Oa,ElicitationCompleteNotificationSchema:Na,ElicitResultSchema:ja,ResourceTemplateReferenceSchema:Ma,PromptReferenceSchema:Aa,CompleteRequestParamsSchema:La,CompleteRequestSchema:cn,CompleteResultSchema:Ua,RootSchema:Da,ListRootsRequestSchema:Co,ListRootsResultSchema:un,RootsListChangedNotificationSchema:Za,TaskCreationParamsSchema:Ha,TaskStatusSchema:ln,TaskSchema:ar,CreateTaskResultSchema:Be,TaskStatusNotificationParamsSchema:Fa,TaskStatusNotificationSchema:Dr,GetTaskRequestSchema:Io,GetTaskResultSchema:qo,GetTaskPayloadRequestSchema:Oo,GetTaskPayloadResultSchema:Iu,ListTasksRequestSchema:Ze,ListTasksResultSchema:ye,CancelTaskRequestSchema:Zr,CancelTaskResultSchema:h.merge(ar),ClientRequestSchema:q([de,xe,cn,Ds,Or,K,Ye,Ve,kt,j,B,Ls,Po,Io,Oo,Ze,Zr]),ClientNotificationSchema:q([y,nt,re,Za,Dr]),ClientResultSchema:q([v,Ys,Xs,ja,un,qo,ye,Be]),ServerRequestSchema:q([de,Gs,qa,Co,Io,Oo,Ze,Zr]),ServerNotificationSchema:q([y,nt,Hs,Q,Pt,Ea,Mr,Dr,Na]),ServerResultSchema:q([v,ie,Ua,xo,J,Xe,it,sr,Eo,To,qo,ye,Be]),CallToolResultWireSchema:D().superRefine((Me,mb)=>{if(typeof Me!=="object"||Me===null||Array.isArray(Me)||Me.content!==void 0)return;for(let yp of eg)if(yp in Me){mb.addIssue({code:"custom",message:`content is required when the body carries '${yp}' — another result family cannot default into an empty tools/call success`});return}}).transform(By).pipe(Eo)}}var Wy;function tg(){return Wy??=Jy()}function rg(e){return e.type!=="object"}var Ky=new Set(["const","enum","default","examples"]),Gy=new Set(["properties","patternProperties","$defs","definitions","dependentSchemas","dependencies"]);function A_(e){return e!==void 0&&!(typeof e==="string"&&e.startsWith("#"))}function Yy(e){let t=typeof e.$schema==="string"?e.$schema:void 0;if(A_(e.$id))return{...t!==void 0&&{$schema:t},type:"object",properties:{result:e},required:["result"]};let r=Pp(e.$schema)&&e.$recursiveAnchor!==!0,o=(s,n)=>{if(Array.isArray(s))return s.map((c)=>o(c,!1));if(s===null||typeof s!=="object")return s;if(!n&&A_(s.$id))return s;let i={},a=!1;for(let[c,l]of Object.entries(s))if(n)i[c]=o(l,!1);else if((c==="$ref"||c==="$dynamicRef")&&typeof l==="string")i[c]=l==="#"?"#/properties/result":l.startsWith("#/")?`#/properties/result${l.slice(1)}`:l;else if(c==="$recursiveRef"&&l==="#"&&r)a=!0;else if(Ky.has(c))i[c]=l;else if(Gy.has(c))i[c]=o(l,!0);else i[c]=o(l,!1);if(a)if("$ref"in i)i.allOf=[...Array.isArray(i.allOf)?i.allOf:[],{$ref:"#/properties/result"}];else i.$ref="#/properties/result";return i};return{...t!==void 0&&{$schema:t},type:"object",properties:{result:o(e,!1)},required:["result"]}}var og={ping:null,initialize:null,"completion/complete":null,"logging/setLevel":null,"prompts/get":null,"prompts/list":null,"resources/list":null,"resources/templates/list":null,"resources/read":null,"resources/subscribe":null,"resources/unsubscribe":null,"tools/call":null,"tools/list":null,"tasks/get":null,"tasks/result":null,"tasks/list":null,"tasks/cancel":null,"sampling/createMessage":null,"elicitation/create":null,"roots/list":null},sg={"notifications/cancelled":null,"notifications/progress":null,"notifications/initialized":null,"notifications/roots/list_changed":null,"notifications/tasks/status":null,"notifications/message":null,"notifications/resources/updated":null,"notifications/resources/list_changed":null,"notifications/tools/list_changed":null,"notifications/prompts/list_changed":null,"notifications/elicitation/complete":null},Xy={ping:null,initialize:null,"completion/complete":null,"logging/setLevel":null,"prompts/get":null,"prompts/list":null,"resources/list":null,"resources/templates/list":null,"resources/read":null,"resources/subscribe":null,"resources/unsubscribe":null,"tools/call":null,"tools/list":null,"sampling/createMessage":null,"elicitation/create":null,"roots/list":null},Hc;function nd(){if(Hc)return Hc;let e=tg();return Hc={requestSchemas:{ping:e.PingRequestSchema,initialize:e.InitializeRequestSchema,"completion/complete":e.CompleteRequestSchema,"logging/setLevel":e.SetLevelRequestSchema,"prompts/get":e.GetPromptRequestSchema,"prompts/list":e.ListPromptsRequestSchema,"resources/list":e.ListResourcesRequestSchema,"resources/templates/list":e.ListResourceTemplatesRequestSchema,"resources/read":e.ReadResourceRequestSchema,"resources/subscribe":e.SubscribeRequestSchema,"resources/unsubscribe":e.UnsubscribeRequestSchema,"tools/call":e.CallToolRequestSchema,"tools/list":e.ListToolsRequestSchema,"tasks/get":e.GetTaskRequestSchema,"tasks/result":e.GetTaskPayloadRequestSchema,"tasks/list":e.ListTasksRequestSchema,"tasks/cancel":e.CancelTaskRequestSchema,"sampling/createMessage":e.CreateMessageRequestSchema,"elicitation/create":e.ElicitRequestSchema,"roots/list":e.ListRootsRequestSchema},notificationSchemas:{"notifications/cancelled":e.CancelledNotificationSchema,"notifications/progress":e.ProgressNotificationSchema,"notifications/initialized":e.InitializedNotificationSchema,"notifications/roots/list_changed":e.RootsListChangedNotificationSchema,"notifications/tasks/status":e.TaskStatusNotificationSchema,"notifications/message":e.LoggingMessageNotificationSchema,"notifications/resources/updated":e.ResourceUpdatedNotificationSchema,"notifications/resources/list_changed":e.ResourceListChangedNotificationSchema,"notifications/tools/list_changed":e.ToolListChangedNotificationSchema,"notifications/prompts/list_changed":e.PromptListChangedNotificationSchema,"notifications/elicitation/complete":e.ElicitationCompleteNotificationSchema},resultSchemas:{ping:e.EmptyResultSchema,initialize:e.InitializeResultSchema,"completion/complete":e.CompleteResultSchema,"logging/setLevel":e.EmptyResultSchema,"prompts/get":e.GetPromptResultSchema,"prompts/list":e.ListPromptsResultSchema,"resources/list":e.ListResourcesResultSchema,"resources/templates/list":e.ListResourceTemplatesResultSchema,"resources/read":e.ReadResourceResultSchema,"resources/subscribe":e.EmptyResultSchema,"resources/unsubscribe":e.EmptyResultSchema,"tools/call":e.CallToolResultWireSchema,"tools/list":e.ListToolsResultSchema,"sampling/createMessage":e.CreateMessageResultWithToolsSchema,"elicitation/create":e.ElicitResultSchema,"roots/list":e.ListRootsResultSchema}},Hc}function ng(e){return Object.prototype.hasOwnProperty.call(og,e)}function ig(e){return Object.prototype.hasOwnProperty.call(sg,e)}function Qy(e){return Object.prototype.hasOwnProperty.call(Xy,e)}function ew(e){return Qy(e)?nd().resultSchemas[e]:void 0}function tw(e){return ng(e)?nd().requestSchemas[e]:void 0}function rw(e){return ig(e)?nd().notificationSchemas[e]:void 0}var G0=Object.keys(og),Y0=Object.keys(sg);function Yl(e){return e!==null&&typeof e==="object"&&!Array.isArray(e)}function Fc(e,t){if(e===void 0)return{ok:!1,reason:"not-in-era"};let r=e.safeParse(t);return r.success?{ok:!0,value:r.data}:{ok:!1,reason:"invalid",message:String(r.error)}}var L_={ok:!1,reason:"not-in-era"};function U_(e){return Yl(e)&&Yl(e.outputSchema)&&rg(e.outputSchema)}function D_(e){return e}var id={era:"2025-11-25",hasRequestMethod:ng,hasNotificationMethod:ig,validateRequest:(e,t)=>Fc(tw(e),t),validateResult:(e,t)=>Fc(ew(e),t),validateNotification:(e,t)=>Fc(rw(e),t),hasInputRequestMethod:()=>!1,validateInputRequest:()=>L_,validateInputResponse:()=>L_,samplingResultVariant:(e,t)=>{let r=tg();return Fc(e?r.CreateMessageResultWithToolsSchema:r.CreateMessageResultSchema,t)},outboundEnvelope:(e)=>{return},validateEnvelopeMeta:(e)=>[],projectCallToolResult(e,t){let r=Q_(e),o=r.structuredContent;if(o===void 0)return r;let s=typeof o!=="object"||o===null||Array.isArray(o),n=t!==void 0&&rg(t);if(!s&&!n)return r;return{...r,structuredContent:{result:o}}},decodeResult(e,t){if(Yl(t)&&"resultType"in t){let r={...t};return delete r.resultType,{kind:"complete",result:D_(r)}}return{kind:"complete",result:D_(t)}},encodeResult(e,t){if(e!=="tools/list")return t;let r=t.tools;if(!Array.isArray(r)||!r.some((o)=>U_(o)))return t;return{...t,tools:r.map((o)=>U_(o)?{...o,outputSchema:Yy(o.outputSchema)}:o)}},encodeErrorCode:(e)=>e===-32002?-32602:e,checkInboundEnvelope:(e)=>{return}};function ow(){let e=xn(()=>q([u(),x(),I(),Jr(),C(u(),e),b(e)])),t=C(u(),e),r=q([u(),x().int()]),o=u(),s=q([u(),x().int()]),n=Y(["user","assistant"]),i=Y(["debug","info","notice","warning","error","critical","alert","emergency"]),a=u().refine((ye)=>{try{return atob(ye),!0}catch{return!1}},{message:"Invalid Base64 string"}),c=p({ttl:x().optional()}),l=p({taskId:u()}),d=V({progressToken:r.optional(),"io.modelcontextprotocol/related-task":l.optional()}),f=p({_meta:d.optional()}),h=f.extend({task:c.optional()}),g=p({_meta:d.optional()}),v=p({method:u(),params:g.loose().optional()}),_=p({src:u(),mimeType:u().optional(),sizes:b(u()).optional(),theme:Y(["light","dark"]).optional()}),y=p({icons:b(_).optional()}),T=p({name:u(),title:u().optional()}),O=T.extend({...T.shape,...y.shape,version:u(),websiteUrl:u().optional(),description:u().optional()}),k=Vt(p({applyDefaults:I().optional()}),t),P=Wr((ye)=>{if(ye&&typeof ye==="object"&&!Array.isArray(ye)&&Object.keys(ye).length===0)return{form:{}};return ye},Vt(p({form:k.optional(),url:t.optional()}),t.optional())),z=V({list:t.optional(),cancel:t.optional(),requests:V({sampling:V({createMessage:t.optional()}).optional(),elicitation:V({create:t.optional()}).optional()}).optional()}),R=V({list:t.optional(),cancel:t.optional(),requests:V({tools:V({call:t.optional()}).optional()}).optional()}),Z=p({experimental:C(u(),t).optional(),sampling:p({context:t.optional(),tools:t.optional()}).optional(),elicitation:P.optional(),roots:p({listChanged:I().optional()}).optional(),tasks:z.optional(),extensions:C(u(),t).optional()}),ee=p({experimental:C(u(),t).optional(),logging:t.optional(),completions:t.optional(),prompts:p({listChanged:I().optional()}).optional(),resources:p({subscribe:I().optional(),listChanged:I().optional()}).optional(),tools:p({listChanged:I().optional()}).optional(),tasks:R.optional(),extensions:C(u(),t).optional()}),X=p({progress:x(),total:F(x()),message:F(u())}),ne=p({...g.shape,...X.shape,progressToken:r}),xe=v.extend({method:m("notifications/progress"),params:ne}),te=g.extend({level:i,logger:u().optional(),data:D()}),ie=v.extend({method:m("notifications/message"),params:te}),re=p({uri:u(),mimeType:F(u()),_meta:C(u(),D()).optional()}),de=re.extend({text:u()}),wt=re.extend({blob:a}),Fe=p({audience:b(n).optional(),priority:x().min(0).max(1).optional(),lastModified:Lo({offset:!0}).optional()}),nt=p({...T.shape,...y.shape,uri:u(),description:F(u()),mimeType:F(u()),size:F(x()),annotations:Fe.optional(),_meta:F(V({}))}),zt=p({...T.shape,...y.shape,uriTemplate:u(),description:F(u()),mimeType:F(u()),annotations:Fe.optional(),_meta:F(V({}))}),Ge=v.extend({method:m("notifications/resources/list_changed"),params:g.optional()}),Le=g.extend({uri:u()}),Zt=v.extend({method:m("notifications/resources/updated"),params:Le}),Ht=p({name:u(),description:F(u()),required:F(I())}),Rt=p({...T.shape,...y.shape,description:F(u()),arguments:F(b(Ht)),_meta:F(V({}))}),Ne=v.extend({method:m("notifications/prompts/list_changed"),params:g.optional()}),Ue=p({type:m("text"),text:u(),annotations:Fe.optional(),_meta:C(u(),D()).optional()}),De=p({type:m("image"),data:a,mimeType:u(),annotations:Fe.optional(),_meta:C(u(),D()).optional()}),pt=p({type:m("audio"),data:a,mimeType:u(),annotations:Fe.optional(),_meta:C(u(),D()).optional()}),Ir=p({type:m("tool_use"),name:u(),id:u(),input:C(u(),D()),_meta:C(u(),D()).optional()}),Ye=p({type:m("resource"),resource:q([de,wt]),annotations:Fe.optional(),_meta:C(u(),D()).optional()}),Xe=nt.extend({type:m("resource_link")}),Ve=q([Ue,De,pt,Xe,Ye]),it=p({role:n,content:Ve}),at=p({title:u().optional(),readOnlyHint:I().optional(),destructiveHint:I().optional(),idempotentHint:I().optional(),openWorldHint:I().optional()}),xt=v.extend({method:m("notifications/tools/list_changed"),params:g.optional()}),kt=p({name:u().optional()}),sr=p({hints:b(kt).optional(),costPriority:x().min(0).max(1).optional(),speedPriority:x().min(0).max(1).optional(),intelligencePriority:x().min(0).max(1).optional()}),Pt=p({mode:Y(["auto","required","none"]).optional()}),qr=p({type:m("boolean"),title:u().optional(),description:u().optional(),default:I().optional()}),j=p({type:m("string"),title:u().optional(),description:u().optional(),minLength:x().optional(),maxLength:x().optional(),format:Y(["email","uri","date","date-time"]).optional(),default:u().optional()}),Tt=p({type:Y(["number","integer"]),title:u().optional(),description:u().optional(),minimum:x().optional(),maximum:x().optional(),default:x().optional()}),B=p({type:m("string"),title:u().optional(),description:u().optional(),enum:b(u()),default:u().optional()}),U=p({type:m("string"),title:u().optional(),description:u().optional(),oneOf:b(p({const:u(),title:u()})),default:u().optional()}),Q=p({type:m("string"),title:u().optional(),description:u().optional(),enum:b(u()),enumNames:b(u()).optional(),default:u().optional()}),M=q([B,U]),N=p({type:m("array"),title:u().optional(),description:u().optional(),minItems:x().optional(),maxItems:x().optional(),items:p({type:m("string"),enum:b(u())}),default:b(u()).optional()}),K=p({type:m("array"),title:u().optional(),description:u().optional(),minItems:x().optional(),maxItems:x().optional(),items:p({anyOf:b(p({const:u(),title:u()}))}),default:b(u()).optional()}),J=q([N,K]),ke=q([Q,M,J]),Or=q([ke,qr,j,Tt]),Et=h.extend({mode:m("form").optional(),message:u(),requestedSchema:p({type:m("object"),properties:C(u(),Or),required:b(u()).optional()}).catchall(D())}),Nr=p({type:m("ref/resource"),uri:u()}),jr=p({type:m("ref/prompt"),name:u()}),js=p({uri:u().startsWith("file://"),name:u().optional(),_meta:C(u(),D()).optional()}),nr=Z.shape,Ms=p({experimental:nr.experimental,sampling:nr.sampling,elicitation:nr.elicitation,roots:nr.roots,extensions:nr.extensions}),ct=ee.shape,Ro=p({experimental:ct.experimental,logging:ct.logging,completions:ct.completions,prompts:ct.prompts,resources:ct.resources,tools:ct.tools,extensions:ct.extensions}),xo=V({progressToken:r.optional(),[Jt]:u(),[Do]:O.optional(),[Gr]:Ms,[Ho]:i.optional()}),Mr=p({...T.shape,...y.shape,description:u().optional(),inputSchema:V({$schema:u().optional(),type:m("object")}),outputSchema:V({$schema:u().optional()}).optional(),annotations:at.optional(),_meta:C(u(),D()).optional()}),As=p({type:m("tool_result"),toolUseId:u(),content:b(Ve),structuredContent:D().optional(),isError:I().optional(),_meta:C(u(),D()).optional()}),ko=q([Ue,De,pt,Ir,As]),Ar=p({role:n,content:q([ko,b(ko)]),_meta:C(u(),D()).optional()}),Po=u(),To=V({[It]:O.optional().catch(void 0)}),Eo=To.optional();function je(ye){return V({_meta:Eo,resultType:Po.default("complete"),...ye})}let Ls=je({}),Ea=je({nextCursor:o.optional()}),$o=je({content:b(Ve),structuredContent:D().optional(),isError:I().optional()}),Us=je({ttlMs:x().int().min(0),cacheScope:Y(["public","private"]),tools:b(Mr),nextCursor:o.optional()}),Ds=je({ttlMs:x().int().min(0),cacheScope:Y(["public","private"]),prompts:b(Rt),nextCursor:o.optional()}),Zs=je({description:u().optional(),messages:b(it)}),Hs=je({ttlMs:x().int().min(0),cacheScope:Y(["public","private"]),resources:b(nt),nextCursor:o.optional()}),Fs=je({ttlMs:x().int().min(0),cacheScope:Y(["public","private"]),resourceTemplates:b(zt),nextCursor:o.optional()}),Vs=je({ttlMs:x().int().min(0),cacheScope:Y(["public","private"]),contents:b(q([de,wt]))}),Bs=je({completion:p({values:b(u()).max(100),total:x().int().optional(),hasMore:I().optional()}).loose()}),$a=je({ttlMs:x().int().min(0),cacheScope:Y(["public","private"])}),Js=je({ttlMs:x().int().min(0).catch(0),cacheScope:Y(["public","private"]).catch("private"),supportedVersions:b(u()),capabilities:Ro,instructions:u().optional()}),ir=p({messages:b(Ar),modelPreferences:sr.optional(),systemPrompt:u().optional(),includeContext:Y(["none","thisServer","allServers"]).optional(),temperature:x().optional(),maxTokens:x().int(),stopSequences:b(u()).optional(),metadata:t.optional(),tools:b(Mr).optional(),toolChoice:Pt.optional()}),Ws=p({method:m("sampling/createMessage"),params:ir}),Ks=p({method:m("roots/list"),params:p({_meta:C(u(),D()).optional()}).optional()}),Gs=p({...Ar.shape,model:u(),stopReason:u().optional()}),Ys=p({roots:b(js)}),Xs=p({action:Y(["accept","decline","cancel"]),content:C(u(),q([u(),x(),I(),b(u())])).optional()}),Qs=p({mode:m("url"),message:u(),url:u().url()}),en=q([Et,Qs]),tn=p({method:m("elicitation/create"),params:en}),rn=q([Ws,Ks,tn]),on=q([Gs,Ys,Xs]),sn=C(u(),rn),nn=C(u(),on),Lr=je({inputRequests:sn.optional(),requestState:u().optional()}),Ur={inputResponses:nn.optional(),requestState:u().optional()},Ca=p({_meta:xo,...Ur}),Ia=V({progressToken:r.optional()});function Qe(ye,Zr){return p({method:m(ye),params:p({_meta:xo,...Zr})})}function et(ye,Zr){return p({method:m(ye),params:p({_meta:Ia.optional(),...Zr}).optional()})}let an={name:u(),arguments:C(u(),D()).optional(),...Ur},mt={cursor:o.optional()},qa=Qe("tools/call",an),Oa=Qe("tools/list",mt),Na=Qe("prompts/list",mt),ja=Qe("prompts/get",{name:u(),arguments:C(u(),u()).optional(),...Ur}),Ma=Qe("resources/list",mt),Aa=Qe("resources/templates/list",mt),La=Qe("resources/read",{uri:u(),...Ur}),cn={ref:q([jr,Nr]),argument:p({name:u(),value:u()}),context:p({arguments:C(u(),u()).optional()}).optional()},Ua=Qe("completion/complete",cn),Da=Qe("server/discover",{}),Co=p({toolsListChanged:I().optional(),promptsListChanged:I().optional(),resourcesListChanged:I().optional(),resourceSubscriptions:b(u()).optional()}),un={notifications:Co},Za=Qe("subscriptions/listen",un),Ha=To.extend({"io.modelcontextprotocol/subscriptionId":s}),ln=V({_meta:Ha,resultType:Po.default("complete")}),ar={"tools/call":et("tools/call",an),"tools/list":et("tools/list",mt),"prompts/get":et("prompts/get",{name:u(),arguments:C(u(),u()).optional()}),"prompts/list":et("prompts/list",mt),"resources/list":et("resources/list",mt),"resources/templates/list":et("resources/templates/list",mt),"resources/read":et("resources/read",{uri:u()}),"completion/complete":et("completion/complete",cn),"server/discover":et("server/discover",{}),"subscriptions/listen":et("subscriptions/listen",un)};function Be(ye){return V({_meta:Eo,...ye})}let Fa={"tools/call":Be({content:b(Ve),structuredContent:D().optional(),isError:I().optional()}),"tools/list":Be({ttlMs:x().int().min(0),cacheScope:Y(["public","private"]),tools:b(Mr),nextCursor:o.optional()}),"prompts/get":Be({description:u().optional(),messages:b(it)}),"prompts/list":Be({ttlMs:x().int().min(0),cacheScope:Y(["public","private"]),prompts:b(Rt),nextCursor:o.optional()}),"resources/list":Be({ttlMs:x().int().min(0),cacheScope:Y(["public","private"]),resources:b(nt),nextCursor:o.optional()}),"resources/templates/list":Be({ttlMs:x().int().min(0),cacheScope:Y(["public","private"]),resourceTemplates:b(zt),nextCursor:o.optional()}),"resources/read":Be({ttlMs:x().int().min(0),cacheScope:Y(["public","private"]),contents:b(q([de,wt]))}),"completion/complete":Be({completion:p({values:b(u()).max(100),total:x().int().optional(),hasMore:I().optional()}).loose()}),"server/discover":Be({ttlMs:x().int().min(0).catch(0),cacheScope:Y(["public","private"]).catch("private"),supportedVersions:b(u()),capabilities:Ro,instructions:u().optional()}),"subscriptions/listen":Be({})},Dr=V({"io.modelcontextprotocol/subscriptionId":s.optional()}),Io=p({method:m("notifications/subscriptions/acknowledged"),params:p({_meta:Dr.optional(),notifications:Co})}),qo=p({_meta:Dr.optional(),requestId:s,reason:u().optional()}),Oo=p({method:m("notifications/cancelled"),params:qo}),Iu={"notifications/cancelled":Oo,"notifications/progress":xe,"notifications/message":ie,"notifications/resources/updated":Zt,"notifications/resources/list_changed":Ge,"notifications/tools/list_changed":xt,"notifications/prompts/list_changed":Ne,"notifications/subscriptions/acknowledged":Io},Ze=(ye)=>p({jsonrpc:m("2.0"),id:q([u(),x().int()]),result:ye}).strict();return{JSONValueSchema:e,JSONObjectSchema:t,ProgressTokenSchema:r,CursorSchema:o,RequestIdSchema:s,RoleSchema:n,LoggingLevelSchema:i,TaskMetadataSchema:c,RelatedTaskMetadataSchema:l,RequestMetaSchema:d,BaseRequestParamsSchema:f,TaskAugmentedRequestParamsSchema:h,NotificationsParamsSchema:g,NotificationSchema:v,IconSchema:_,IconsSchema:y,BaseMetadataSchema:T,ImplementationSchema:O,ClientTasksCapabilitySchema:z,ServerTasksCapabilitySchema:R,ClientCapabilitiesSchema:Z,ServerCapabilitiesSchema:ee,ProgressSchema:X,ProgressNotificationParamsSchema:ne,ProgressNotificationSchema:xe,LoggingMessageNotificationParamsSchema:te,LoggingMessageNotificationSchema:ie,ResourceContentsSchema:re,TextResourceContentsSchema:de,BlobResourceContentsSchema:wt,AnnotationsSchema:Fe,ResourceSchema:nt,ResourceTemplateSchema:zt,ResourceListChangedNotificationSchema:Ge,ResourceUpdatedNotificationParamsSchema:Le,ResourceUpdatedNotificationSchema:Zt,PromptArgumentSchema:Ht,PromptSchema:Rt,PromptListChangedNotificationSchema:Ne,TextContentSchema:Ue,ImageContentSchema:De,AudioContentSchema:pt,ToolUseContentSchema:Ir,EmbeddedResourceSchema:Ye,ResourceLinkSchema:Xe,ContentBlockSchema:Ve,PromptMessageSchema:it,ToolAnnotationsSchema:at,ToolListChangedNotificationSchema:xt,ModelHintSchema:kt,ModelPreferencesSchema:sr,ToolChoiceSchema:Pt,BooleanSchemaSchema:qr,StringSchemaSchema:j,NumberSchemaSchema:Tt,UntitledSingleSelectEnumSchemaSchema:B,TitledSingleSelectEnumSchemaSchema:U,LegacyTitledEnumSchemaSchema:Q,SingleSelectEnumSchemaSchema:M,UntitledMultiSelectEnumSchemaSchema:N,TitledMultiSelectEnumSchemaSchema:K,MultiSelectEnumSchemaSchema:J,EnumSchemaSchema:ke,PrimitiveSchemaDefinitionSchema:Or,ElicitRequestFormParamsSchema:Et,ResourceTemplateReferenceSchema:Nr,PromptReferenceSchema:jr,RootSchema:js,ClientCapabilities2026Schema:Ms,ServerCapabilities2026Schema:Ro,RequestMetaEnvelopeSchema:xo,ToolSchema:Mr,ToolResultContentSchema:As,SamplingMessageContentBlockSchema:ko,SamplingMessageSchema:Ar,ResultTypeSchema:Po,ResultMetaSchema:To,ResultSchema:Ls,PaginatedResultSchema:Ea,CallToolResultSchema:$o,ListToolsResultSchema:Us,ListPromptsResultSchema:Ds,GetPromptResultSchema:Zs,ListResourcesResultSchema:Hs,ListResourceTemplatesResultSchema:Fs,ReadResourceResultSchema:Vs,CompleteResultSchema:Bs,CacheableResultSchema:$a,DiscoverResultSchema:Js,CreateMessageRequestParamsSchema:ir,CreateMessageRequestSchema:Ws,ListRootsRequestSchema:Ks,CreateMessageResultSchema:Gs,ListRootsResultSchema:Ys,ElicitResultSchema:Xs,ElicitRequestURLParamsSchema:Qs,ElicitRequestParamsSchema:en,ElicitRequestSchema:tn,InputRequestSchema:rn,InputResponseSchema:on,InputRequestsSchema:sn,InputResponsesSchema:nn,InputRequiredResultSchema:Lr,InputResponseRequestParamsSchema:Ca,CallToolRequestSchema:qa,ListToolsRequestSchema:Oa,ListPromptsRequestSchema:Na,GetPromptRequestSchema:ja,ListResourcesRequestSchema:Ma,ListResourceTemplatesRequestSchema:Aa,ReadResourceRequestSchema:La,CompleteRequestSchema:Ua,DiscoverRequestSchema:Da,SubscriptionFilterSchema:Co,SubscriptionsListenRequestSchema:Za,SubscriptionsListenResultMetaSchema:Ha,SubscriptionsListenResultSchema:ln,dispatchRequestSchemas:ar,dispatchResultSchemas:Fa,NotificationMetaSchema:Dr,SubscriptionsAcknowledgedNotificationSchema:Io,CancelledNotificationParamsSchema:qo,CancelledNotificationSchema:Oo,notificationSchemas2026:Iu,JSONRPCResultResponseSchema:Ze(Ls),CallToolResultResponseSchema:Ze(q([$o,Lr])),ListToolsResultResponseSchema:Ze(Us),ListPromptsResultResponseSchema:Ze(Ds),GetPromptResultResponseSchema:Ze(q([Zs,Lr])),ListResourcesResultResponseSchema:Ze(Hs),ListResourceTemplatesResultResponseSchema:Ze(Fs),ReadResourceResultResponseSchema:Ze(q([Vs,Lr])),CompleteResultResponseSchema:Ze(Bs),DiscoverResultResponseSchema:Ze(Js),SubscriptionsListenResultResponseSchema:Ze(ln)}}var sw;function vr(){return sw??=ow()}var nw=["tools/list","prompts/list","resources/list","resources/templates/list","resources/read","server/discover"];function iw(e){return nw.includes(e)}var ad=Symbol("modelcontextprotocol.resultCacheHintFallback");function aw(e){return e[ad]}function ag(e){return typeof e==="number"&&Number.isSafeInteger(e)&&e>=0}function cg(e){return e==="public"||e==="private"}var W=function(e){return e[e.ParseError=-32700]="ParseError",e[e.InvalidRequest=-32600]="InvalidRequest",e[e.MethodNotFound=-32601]="MethodNotFound",e[e.InvalidParams=-32602]="InvalidParams",e[e.InternalError=-32603]="InternalError",e[e.ResourceNotFound=-32002]="ResourceNotFound",e[e.MissingRequiredClientCapability=-32021]="MissingRequiredClientCapability",e[e.UnsupportedProtocolVersion=-32022]="UnsupportedProtocolVersion",e[e.UrlElicitationRequired=-32042]="UrlElicitationRequired",e}({}),se=class e extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.ProtocolError"})}static[Symbol.hasInstance](t){return We(this,t)}static isInstance(t){if(typeof this!=="function")throw TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return We(this,t)}constructor(t,r,o){super(r);this.code=t,this.data=o,this.name="ProtocolError",br(this,new.target)}static fromError(t,r,o){if(t===W.UrlElicitationRequired&&o){let s=o;if(s.elicitations)return new lg(s.elicitations,r)}if(t===W.UnsupportedProtocolVersion&&o){let s=o;if(Array.isArray(s.supported)&&typeof s.requested==="string")return new da({supported:s.supported,requested:s.requested},r)}if(t===W.InvalidParams||t===W.ResourceNotFound){let s=o;if(typeof s?.uri==="string"&&(t===W.ResourceNotFound||Object.keys(s).length===1))return new ug(s.uri,r)}if(t===W.MissingRequiredClientCapability&&o){let s=o;if(s.requiredCapabilities!==null&&typeof s.requiredCapabilities==="object"&&!Array.isArray(s.requiredCapabilities))return new dg({requiredCapabilities:s.requiredCapabilities},r)}return new e(t,r,o)}},ug=class extends se{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.ResourceNotFoundError"})}constructor(e,t=`Resource not found: ${e}`){super(W.InvalidParams,t,{uri:e})}get uri(){return this.data.uri}},lg=class extends se{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.UrlElicitationRequiredError"})}constructor(e,t=`URL elicitation${e.length>1?"s":""} required`){super(W.UrlElicitationRequired,t,{elicitations:e})}get elicitations(){return this.data?.elicitations??[]}},da=class extends se{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.UnsupportedProtocolVersionError"})}constructor(e,t=`Unsupported protocol version: ${e.requested}`){super(W.UnsupportedProtocolVersion,t,e)}get supported(){return this.data.supported}get requested(){return this.data.requested}},dg=class extends se{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.MissingRequiredClientCapabilityError"})}constructor(e,t=`Missing required client capabilities: ${Object.keys(e.requiredCapabilities).join(", ")}`){super(W.MissingRequiredClientCapability,t,e)}get requiredCapabilities(){return this.data.requiredCapabilities}},cw=0,uw="private",lw=["tools/call","prompts/get","resources/read"];function dw(e,t){let r=t.resultType;if(r===void 0)return{...t,resultType:"complete"};if(r==="complete")return t;if(lw.includes(e))return t;throw new se(W.InternalError,`Handler for ${e} returned resultType '${String(r)}', but results of ${e} only support 'complete' on protocol revision 2026-07-28`)}function pw(e,t){let r=aw(t);if(t.resultType!=="complete"||!iw(e))return r===void 0?t:gw(t);let o=t,s=ag(o.ttlMs)?o.ttlMs:fw(r),n=cg(o.cacheScope)?o.cacheScope:_w(r),i={...o,ttlMs:s,cacheScope:n};return delete i[ad],i}function mw(e){return e!==null&&typeof e==="object"&&!Array.isArray(e)}function hw(e,t){if(t===void 0)return e;let r=e._meta;if(r===void 0)return{...e,_meta:{[It]:t}};if(!mw(r))return e;if(r[It]!==void 0)return e;return{...e,_meta:{...r,[It]:t}}}function fw(e){return e!==void 0&&ag(e.ttlMs)?e.ttlMs:cw}function _w(e){return e!==void 0&&cg(e.cacheScope)?e.cacheScope:uw}function gw(e){let t={...e};return delete t[ad],t}var Sw=["elicitation/create","sampling/createMessage","roots/list"],Vc;function pg(){if(Vc)return Vc;let e=vr();return Vc={request:{"elicitation/create":p({method:m("elicitation/create"),params:e.ElicitRequestParamsSchema}),"sampling/createMessage":p({method:m("sampling/createMessage"),params:e.CreateMessageRequestParamsSchema}),"roots/list":p({method:m("roots/list"),params:V({}).optional()})},response:{"elicitation/create":e.ElicitResultSchema,"sampling/createMessage":e.CreateMessageResultSchema,"roots/list":e.ListRootsResultSchema}},Vc}function mg(e){return Sw.includes(e)}function Bl(e){return mg(e)?pg().request[e]:void 0}function vw(e){return mg(e)?pg().response[e]:void 0}var cd={"tools/call":null,"tools/list":null,"prompts/get":null,"prompts/list":null,"resources/list":null,"resources/templates/list":null,"resources/read":null,"completion/complete":null,"server/discover":null,"subscriptions/listen":null},hg={"notifications/cancelled":null,"notifications/progress":null,"notifications/message":null,"notifications/resources/updated":null,"notifications/resources/list_changed":null,"notifications/tools/list_changed":null,"notifications/prompts/list_changed":null,"notifications/subscriptions/acknowledged":null};function fg(e){return Object.prototype.hasOwnProperty.call(cd,e)}function _g(e){return Object.prototype.hasOwnProperty.call(hg,e)}function bw(e){return Object.prototype.hasOwnProperty.call(cd,e)}function yw(e){return fg(e)?vr().dispatchRequestSchemas[e]:void 0}function ww(e){return bw(e)?vr().dispatchResultSchemas[e]:void 0}function zw(e){return _g(e)?vr().notificationSchemas2026[e]:void 0}var X0=Object.keys(cd),Q0=Object.keys(hg);function aa(e){return e!==null&&typeof e==="object"&&!Array.isArray(e)}function na(e,t){if(e===void 0)return{ok:!1,reason:"not-in-era"};let r=e.safeParse(t);return r.success?{ok:!0,value:r.data}:{ok:!1,reason:"invalid",message:String(r.error)}}var Rw={ok:!1,reason:"not-in-era"},xw=[Jt,Gr];function kw(e,t){let r=t,o=!1,s=()=>{if(!o)r={...r},o=!0;return r},n=t.tools;if(e==="tools/list"&&Array.isArray(n)&&n.some((a)=>aa(a)&&("execution"in a)))s().tools=n.map((a)=>{if(!aa(a)||!("execution"in a))return a;let c={...a};return delete c.execution,c});let i=t.capabilities;if(aa(i)&&"tasks"in i){let a={...i};delete a.tasks,s().capabilities=a}return r}var ud={era:"2026-07-28",hasRequestMethod:fg,hasNotificationMethod:_g,hasInputRequestMethod:(e)=>Bl(e)!==void 0,validateRequest:(e,t)=>na(yw(e),t),validateResult:(e,t)=>na(ww(e),t),validateNotification:(e,t)=>na(zw(e),t),validateInputRequest:(e,t)=>na(Bl(e),t),validateInputResponse:(e,t)=>na(vw(e),t),samplingResultVariant:()=>Rw,outboundEnvelope(e){return{[Jt]:e.protocolVersion,[Do]:e.clientInfo,[Gr]:e.clientCapabilities,...e.logLevel!==void 0&&{[Ho]:e.logLevel}}},validateEnvelopeMeta(e){let t=[];for(let o of xw)if(!(o in e))t.push({key:o,problem:"missing"});let r=vr().RequestMetaEnvelopeSchema.safeParse(e);if(!r.success)for(let o of r.error.issues){let s=o.path.map(String),n=s.length>0?s.join("."):"_meta";if(s.length===1&&t.some((i)=>i.key===n&&i.problem==="missing"))continue;t.push({key:n,problem:o.message})}return t},projectCallToolResult:(e)=>Q_(e),inputRequestSchema:Bl,decodeResult(e,t){if(!aa(t))return{kind:"invalid",error:new L(A.InvalidResult,`Invalid result for ${e}: not an object`,{method:e})};let r=t.resultType;if(r===void 0)return{kind:"invalid",error:new L(A.InvalidResult,`Invalid result for ${e}: missing required resultType — servers implementing protocol revision 2026-07-28 MUST include it (the absent-means-complete bridge applies only to earlier-revision servers)`,{method:e,violation:"missing-resultType"})};if(typeof r!=="string")return{kind:"invalid",error:new L(A.InvalidResult,`Invalid result for ${e}: non-string resultType`,{method:e,resultType:r})};if(r==="input_required"){let i=t.inputRequests,a=aa(i)?i:{},c=t.requestState,l=t._meta===void 0?void 0:vr().ResultMetaSchema.safeParse(t._meta),d=l?.success?l.data:void 0;if(Object.keys(a).length===0&&typeof c!=="string")return{kind:"invalid",error:new L(A.InvalidResult,`Invalid result for ${e}: input_required carries neither inputRequests nor requestState (every input_required result must include at least one of the two)`,{method:e,violation:"input-required-missing-both"})};return{kind:"input_required",inputRequests:a,...typeof c==="string"&&{requestState:c},...d!==void 0&&{_meta:d}}}if(r!=="complete")return{kind:"invalid",error:new L(A.UnsupportedResultType,`Unsupported result type '${r}' for ${e}`,{resultType:r,method:e})};let o=Pw(),s=Object.hasOwn(o,e)?o[e]:void 0;if(s!==void 0){let i=s.safeParse(t);if(!i.success)return{kind:"invalid",error:new L(A.InvalidResult,`Invalid result for ${e}: ${i.error}`,{method:e})}}let n={...t};return delete n.resultType,{kind:"complete",result:n}},encodeResult(e,t,r){return hw(pw(e,dw(e,kw(e,t))),r)},encodeErrorCode:(e)=>e===-32002?-32602:e,checkInboundEnvelope(e){if(e.envelope===void 0)return"Request is missing the required _meta envelope for protocol revision 2026-07-28 (io.modelcontextprotocol/protocolVersion, io.modelcontextprotocol/clientCapabilities)";let t=vr().RequestMetaEnvelopeSchema.safeParse(e.envelope);if(!t.success)return`Invalid _meta envelope for protocol revision 2026-07-28: ${t.error.issues.map((r)=>r.message).join("; ")}`}},Bc;function Pw(){if(Bc)return Bc;let e=vr();return Bc={"tools/call":e.CallToolResultSchema,"tools/list":e.ListToolsResultSchema,"prompts/get":e.GetPromptResultSchema,"prompts/list":e.ListPromptsResultSchema,"resources/list":e.ListResourcesResultSchema,"resources/templates/list":e.ListResourceTemplatesResultSchema,"resources/read":e.ReadResourceResultSchema,"completion/complete":e.CompleteResultSchema,"server/discover":e.DiscoverResultSchema},Bc}var Gc="2026-07-28";function Qt(e){return e!==void 0&&Mt(e)?ud:id}function Z_(e){if(e.revision!==void 0)return Qt(e.revision).era;return e.era==="modern"?ud.era:id.era}function Jl(e){return gg.some((t)=>t.hasRequestMethod(e))}function Wl(e){return gg.some((t)=>t.hasNotificationMethod(e))}function H_(e){return e==="tasks/get"||e==="tasks/cancel"}var gg=[id,ud],Tw=Rp({AnnotationsSchema:()=>Ot,AudioContentSchema:()=>oo,BaseMetadataSchema:()=>Ct,BaseRequestParamsSchema:()=>Te,BlobResourceContentsSchema:()=>ss,BooleanSchemaSchema:()=>cs,CallToolRequestParamsSchema:()=>Si,CallToolRequestSchema:()=>vi,CallToolResultSchema:()=>Sr,CancelTaskRequestSchema:()=>qc,CancelTaskResultSchema:()=>Oc,CancelledNotificationParamsSchema:()=>Tn,CancelledNotificationSchema:()=>Go,ClientCapabilitiesSchema:()=>$n,ClientNotificationSchema:()=>jc,ClientRequestSchema:()=>Nc,ClientResultSchema:()=>Mc,ClientTasksCapabilitySchema:()=>yc,CompatibilityCallToolResultSchema:()=>zc,CompleteRequestParamsSchema:()=>Bi,CompleteRequestSchema:()=>Ji,CompleteResultSchema:()=>Wi,ContentBlockSchema:()=>Nt,CreateMessageRequestParamsSchema:()=>Ci,CreateMessageRequestSchema:()=>Ii,CreateMessageResultSchema:()=>qi,CreateMessageResultWithToolsSchema:()=>Oi,CreateTaskResultSchema:()=>xc,CursorSchema:()=>Vo,DiscoverRequestSchema:()=>qn,DiscoverResultSchema:()=>_r,ElicitRequestFormParamsSchema:()=>uo,ElicitRequestParamsSchema:()=>Li,ElicitRequestSchema:()=>Ui,ElicitRequestURLParamsSchema:()=>Ai,ElicitResultSchema:()=>Hi,ElicitationCompleteNotificationParamsSchema:()=>Di,ElicitationCompleteNotificationSchema:()=>Zi,EmbeddedResourceSchema:()=>so,EmptyResultSchema:()=>fr,EnumSchemaSchema:()=>Mi,GetPromptRequestParamsSchema:()=>ci,GetPromptRequestSchema:()=>ui,GetPromptResultSchema:()=>pi,GetTaskPayloadRequestSchema:()=>Ec,GetTaskPayloadResultSchema:()=>$c,GetTaskRequestSchema:()=>Pc,GetTaskResultSchema:()=>Tc,IconSchema:()=>En,IconsSchema:()=>Wt,ImageContentSchema:()=>ro,ImplementationSchema:()=>qt,InitializeRequestParamsSchema:()=>Cn,InitializeRequestSchema:()=>Yo,InitializeResultSchema:()=>In,InitializedNotificationSchema:()=>Qo,JSONArraySchema:()=>vc,JSONObjectSchema:()=>ge,JSONRPCErrorResponseSchema:()=>Qr,JSONRPCMessageSchema:()=>gt,JSONRPCNotificationSchema:()=>Ko,JSONRPCRequestSchema:()=>Wo,JSONRPCResponseSchema:()=>bc,JSONRPCResultResponseSchema:()=>Xr,JSONValueSchema:()=>Bt,LegacyTitledEnumSchemaSchema:()=>ds,ListChangedOptionsBaseSchema:()=>yi,ListPromptsRequestSchema:()=>ii,ListPromptsResultSchema:()=>ai,ListResourceTemplatesRequestSchema:()=>Un,ListResourceTemplatesResultSchema:()=>Dn,ListResourcesRequestSchema:()=>An,ListResourcesResultSchema:()=>Ln,ListRootsRequestSchema:()=>Gi,ListRootsResultSchema:()=>Yi,ListTasksRequestSchema:()=>Cc,ListTasksResultSchema:()=>Ic,ListToolsRequestSchema:()=>_i,ListToolsResultSchema:()=>gi,LoggingLevelSchema:()=>as,LoggingMessageNotificationParamsSchema:()=>Ri,LoggingMessageNotificationSchema:()=>io,ModelHintSchema:()=>xi,ModelPreferencesSchema:()=>ki,MultiSelectEnumSchemaSchema:()=>ji,NotificationSchema:()=>qe,NotificationsParamsSchema:()=>Ae,NumberSchemaSchema:()=>co,PaginatedRequestParamsSchema:()=>jn,PaginatedRequestSchema:()=>Kt,PaginatedResultSchema:()=>Gt,PingRequestSchema:()=>es,PrimitiveSchemaDefinitionSchema:()=>hs,ProgressNotificationParamsSchema:()=>Nn,ProgressNotificationSchema:()=>ts,ProgressSchema:()=>On,ProgressTokenSchema:()=>Fo,PromptArgumentSchema:()=>si,PromptListChangedNotificationSchema:()=>mi,PromptMessageSchema:()=>di,PromptReferenceSchema:()=>Vi,PromptSchema:()=>ni,ReadResourceRequestParamsSchema:()=>Zn,ReadResourceRequestSchema:()=>Hn,ReadResourceResultSchema:()=>Fn,RelatedTaskMetadataSchema:()=>Pn,RequestIdSchema:()=>_t,RequestMetaSchema:()=>Bo,RequestSchema:()=>Se,ResourceContentsSchema:()=>rs,ResourceLinkSchema:()=>no,ResourceListChangedNotificationSchema:()=>Vn,ResourceRequestParamsSchema:()=>eo,ResourceSchema:()=>ns,ResourceTemplateReferenceSchema:()=>Fi,ResourceTemplateSchema:()=>Mn,ResourceUpdatedNotificationParamsSchema:()=>ri,ResourceUpdatedNotificationSchema:()=>oi,ResultMetaObjectSchema:()=>Jo,ResultSchema:()=>ve,RoleSchema:()=>Yt,RootSchema:()=>Ki,RootsListChangedNotificationSchema:()=>Xi,SamplingContentSchema:()=>Ei,SamplingMessageContentBlockSchema:()=>mr,SamplingMessageSchema:()=>$i,ServerCapabilitiesSchema:()=>Xo,ServerNotificationSchema:()=>Lc,ServerRequestSchema:()=>Ac,ServerResultSchema:()=>Uc,ServerTasksCapabilitySchema:()=>wc,SetLevelRequestParamsSchema:()=>wi,SetLevelRequestSchema:()=>zi,SingleSelectEnumSchemaSchema:()=>Ni,StringSchemaSchema:()=>ao,SubscribeRequestParamsSchema:()=>Bn,SubscribeRequestSchema:()=>Jn,SubscriptionFilterSchema:()=>is,SubscriptionsAcknowledgedNotificationParamsSchema:()=>Xn,SubscriptionsAcknowledgedNotificationSchema:()=>Qn,SubscriptionsListenRequestParamsSchema:()=>Gn,SubscriptionsListenRequestSchema:()=>Yn,SubscriptionsListenResultMetaSchema:()=>ei,SubscriptionsListenResultSchema:()=>ti,TaskAugmentedRequestParamsSchema:()=>hr,TaskCreationParamsSchema:()=>Rc,TaskMetadataSchema:()=>kn,TaskSchema:()=>Xt,TaskStatusNotificationParamsSchema:()=>ea,TaskStatusNotificationSchema:()=>kc,TaskStatusSchema:()=>Qi,TextContentSchema:()=>to,TextResourceContentsSchema:()=>os,TitledMultiSelectEnumSchemaSchema:()=>ms,TitledSingleSelectEnumSchemaSchema:()=>ls,ToolAnnotationsSchema:()=>hi,ToolChoiceSchema:()=>Pi,ToolExecutionSchema:()=>fi,ToolListChangedNotificationSchema:()=>bi,ToolResultContentSchema:()=>Ti,ToolSchema:()=>gr,ToolUseContentSchema:()=>li,UnsubscribeRequestParamsSchema:()=>Wn,UnsubscribeRequestSchema:()=>Kn,UntitledMultiSelectEnumSchemaSchema:()=>ps,UntitledSingleSelectEnumSchemaSchema:()=>us});var wr=(e)=>Wo.safeParse(e).success,Sg=(e)=>Ko.safeParse(e).success,ho=(e)=>Xr.safeParse(e).success,fo=(e)=>Qr.safeParse(e).success;var vg=(e)=>typeof e==="object"&&e!==null&&!Array.isArray(e)&&e.resultType==="input_required";var ld=(e)=>Yo.safeParse(e).success,bg=(e)=>Qo.safeParse(e).success;var Ew="Mcp-Param-",F_="x-mcp-header",$w=/^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/,Cw=new Set(["string","integer","boolean"]);function dd(e){let t=[],r=new Map,o,s=(i,a,c)=>{if(i===null||typeof i!=="object")return;let l=i;if(F_ in l){if(!c||a.length===0)return`${Jc(a)}: x-mcp-header is only permitted on properties statically reachable via a chain of 'properties' keys (not under items, additionalProperties, oneOf/anyOf/allOf/not, if/then/else, or $ref)`;let f=l[F_];if(typeof f!=="string"||f.length===0)return`${Jc(a)}: x-mcp-header MUST be a non-empty string`;if(!$w.test(f))return`${Jc(a)}: x-mcp-header '${f}' is not a valid RFC 9110 token (no spaces, control characters or HTTP delimiters)`;let h=typeof l.type==="string"?l.type:void 0;if(h===void 0||!Cw.has(h)){let _=`${Jc(a)}: x-mcp-header is only permitted on primitive-typed properties (string, integer, boolean); got ${h??"<none>"}`;if(h!=="number")return _;o??=_}let g=f.toLowerCase(),v=r.get(g);if(v!==void 0)return`x-mcp-header '${f}' is not case-insensitively unique (also declared as '${v}')`;r.set(g,f),t.push({path:a,headerName:f,type:h})}let d=l.properties;if(d!==null&&typeof d==="object")for(let[f,h]of Object.entries(d)){let g=s(h,[...a,f],c);if(g!==void 0)return g}for(let f of Iw){let h=l[f];if(h===void 0)continue;let g=Array.isArray(h)?h:h!==null&&typeof h==="object"&&qw.has(f)?Object.values(h):[h];for(let v of g){let _=s(v,[...a,`<${f}>`],!1);if(_!==void 0)return _}}},n=s(e,[],!0);if(n!==void 0)return{valid:!1,reason:o??n};return o===void 0?{valid:!0,declarations:t}:{valid:!1,reason:o,declarations:t}}var Iw=["items","prefixItems","contains","additionalProperties","unevaluatedProperties","unevaluatedItems","propertyNames","patternProperties","dependentSchemas","oneOf","anyOf","allOf","not","if","then","else","$defs","definitions"],qw=new Set(["patternProperties","dependentSchemas","$defs","definitions"]);function Jc(e){return e.length===0?"<root>":e.join(".")}var yg="=?base64?",wg="?=";function Ow(e){if(typeof e==="string")return e;if(typeof e==="boolean")return e?"true":"false";if(typeof e==="number"){if(!Number.isFinite(e))return;if(Number.isInteger(e)&&!Number.isSafeInteger(e))return;return String(e)}}function Nw(e){if(e.length===0)return!0;if(e.startsWith(yg)&&e.endsWith(wg))return!0;if(e!==e.trim())return!0;for(let t=0;t<e.length;t++){let r=e.codePointAt(t);if(r===9||r>=32&&r<=126)continue;return!0}return!1}function jw(e){let t=new TextEncoder().encode(e),r="";for(let o of t)r+=String.fromCodePoint(o);return btoa(r)}function pd(e){return Nw(e)?`${yg}${jw(e)}${wg}`:e}function Mw(e,t){let r=e;for(let o of t){if(r===null||typeof r!=="object")return;r=r[o]}return r}function zg(e,t){let r={};for(let o of e){let s=Mw(t,o.path);if(s===void 0||s===null)continue;let n=Ow(s);if(n===void 0)continue;r[`${Ew}${o.headerName}`]=pd(n)}return r}var Ss=-32020,eP=[{rung:"http-method",order:1,evaluatedAt:"edge",codes:[-32000],conformance:[],rationale:"The modern era is POST-only; GET/DELETE are body-less 2025-era session operations and are method-routed to legacy serving (405 when legacy serving is not configured), before any body is read."},{rung:"jsonrpc-shape",order:2,evaluatedAt:"edge",codes:[W.InvalidRequest],conformance:["server-stateless"],rationale:"The body must be a JSON-RPC request or notification: posted responses and batch arrays containing a modern or invalid element are rejected before classification (element-wise batch rule); all-legacy arrays stay legacy traffic."},{rung:"era-classification",order:3,evaluatedAt:"edge",codes:[Ss,W.UnsupportedProtocolVersion],conformance:["server-stateless","http-header-validation","http-custom-header-server-validation"],rationale:"Body-primary era classification with the protocol-version header as a cross-check; a header/body disagreement is rejected with -32020 (HeaderMismatch), and an envelope-less request on a modern-only endpoint is answered with the unsupported-protocol-version error naming the supported revisions."},{rung:"envelope",order:4,evaluatedAt:"edge",codes:[W.InvalidParams],conformance:["server-stateless"],rationale:"A present envelope claim with a malformed envelope — and a missing envelope on a request whose protocol-version header names a modern revision — is an invalid-params rejection naming the offending or missing key(s); never a silent fall back to legacy handling. This is the only place an invalid-params rejection maps to HTTP 400."},{rung:"method-registry",order:5,evaluatedAt:"dispatch",codes:[W.MethodNotFound],conformance:["server-stateless"],rationale:"Method existence outranks parameter validity: a method absent from the negotiated revision’s registry (or with no handler installed) answers method-not-found before params or capabilities are looked at."},{rung:"request-params",order:6,evaluatedAt:"dispatch",codes:[W.InvalidParams],conformance:[],rationale:"Per-method params validation; emitted in-band by the dispatch layer (HTTP 200), never via the ladder status table."},{rung:"standard-header-validation",order:7,evaluatedAt:"pre-dispatch",codes:[Ss],conformance:["http-header-validation"],rationale:"SEP-2243 standard `MCP-Protocol-Version` / `Mcp-Method` / `Mcp-Name` headers — presence, sentinel decoding, and `Mcp-Name` ↔ body cross-check — are validated by the HTTP entry on a modern-classified request after the supported-revision gate and before dispatch. The spec requires `MCP-Protocol-Version` and `Mcp-Method` on every modern *request* POST (`Mcp-Name` only for the methods that mirror `params.name` / `params.uri` / `params.taskId`, see `MCP_NAME_HEADER_SOURCE`) and names them in that order, so a request missing several is answered by the earliest. Notification POSTs are exempt: the presence half runs on requests only, so a modern-enveloped notification is dispatched even with no standard headers at all. The classifier’s own header-mismatch cells (protocol-version, `Mcp-Method` mismatch) stay on the edge `era-classification` rung; this rung carries the entry-layer presence/`Mcp-Name` half — including the missing `MCP-Protocol-Version` cell, which cannot live on the edge rung without breaking body-primary classification. Evaluated before the capability gate, the factory call, and the `Mcp-Param-*` rung so a request that fails several rungs is answered by the standard-header rung first. The documented order (after method-registry 5 and request-params 6) is NOT the observed precedence: serveModern evaluates this rung immediately after the supported-revision gate, so a request that also fails a dispatch rung is answered here before the dispatch rungs (5–6) are consulted."},{rung:"client-capabilities",order:8,evaluatedAt:"pre-dispatch",codes:[W.MissingRequiredClientCapability],conformance:["server-stateless"],rationale:"The capability requirement is checked by the HTTP entry, pre-dispatch, against the validated envelope the classifier produced — pinning the spec-mandated HTTP 400 independently of how dispatch- and handler-produced errors are mapped. The documented order (after method resolution and params validation) is preserved observably only while the requirement table is empty: once a served method gains a requirement entry, a request that is missing the capability and would also fail a dispatch rung is answered by this gate first, so the entry must consult the method registry before the gate if the documented precedence is to stay observable."},{rung:"param-header-validation",order:9,evaluatedAt:"pre-dispatch",codes:[Ss],conformance:["http-custom-header-server-validation"],rationale:"SEP-2243 `Mcp-Param-*` headers are validated against the named tool’s `x-mcp-header` declarations and the body `arguments` after the tool registry is known and before dispatch reaches the handler; a missing/disagreeing/malformed header is rejected 400 / -32020 with the same shape as the standard-header cross-checks. The documented order (after method resolution and params validation) is preserved observably only when the body `arguments` would otherwise validate: the check runs pre-dispatch, so a `tools/call` that fails BOTH this rung and a dispatch-time rung (e.g. order-6 `request-params`, -32602) is answered by this gate first with 400 / -32020, not by the earlier-ordered rung."}],tP={[W.ParseError]:400,[W.InvalidRequest]:400,[W.MethodNotFound]:404,[W.UnsupportedProtocolVersion]:400,[W.MissingRequiredClientCapability]:400,[Ss]:400},V_={"tools/call":"name","prompts/get":"name","resources/read":"uri","tasks/get":"taskId","tasks/update":"taskId","tasks/cancel":"taskId"};function Rg(e,t){let r=Object.hasOwn(V_,e)?V_[e]:void 0;if(r===void 0)return;let o=Aw(t)?t[r]:void 0;return{field:r,value:typeof o==="string"?o:void 0}}function Aw(e){return e!==null&&typeof e==="object"&&!Array.isArray(e)}function Yc(e,t){return pc(e,t)}function ia(e){return new Set(e.flatMap((t)=>Object.keys(t.shape)))}function Xl(e){if(e==null)return!1;let t=typeof e;if(t!=="object"&&t!=="function")return!1;if(!("~standard"in e))return!1;return typeof e["~standard"]?.validate==="function"}var B_=!1,Ql="draft-2020-12";function Lw(e,t="input"){let r=e["~standard"],o;if(r.jsonSchema)o=r.jsonSchema[t]({target:Ql});else if(r.vendor==="zod"){if(!("_zod"in e))throw Error("Schema appears to be from zod 3, which the SDK cannot convert to JSON Schema. Upgrade to zod >=4.2.0, or wrap your JSON Schema with fromJsonSchema().");if(!B_)B_=!0,console.warn("[mcp-sdk] Your zod version does not implement `~standard.jsonSchema` (added in zod 4.2.0). Falling back to z.toJSONSchema(). Upgrade to zod >=4.2.0 to silence this warning.");o=lc(e,{target:Ql,io:t})}else throw Error(`Schema library "${r.vendor}" does not implement StandardJSONSchemaV1 (\`~standard.jsonSchema\`). Upgrade to a version that does, or wrap your JSON Schema with fromJsonSchema().`);if(t==="output"){if(o.type!==void 0)return o;return xg(o)?{type:"object",...o}:o}if(o.type!==void 0&&o.type!=="object")throw Error(`MCP tool and prompt schemas must describe objects (got type: ${JSON.stringify(o.type)}). Wrap your schema in z.object({...}) or equivalent.`);return{type:"object",...o}}var Uw=/^#\/(\$defs|definitions)\/([^/~%]+)$/;function xg(e,t=e){if("properties"in e||"patternProperties"in e||"additionalProperties"in e||"required"in e)return!0;let r=typeof e.$ref==="string"&&Uw.exec(e.$ref);if(r&&t[r[1]]?.[r[2]]?.type==="object")return!0;for(let o of["oneOf","anyOf","allOf"]){let s=e[o];if(Array.isArray(s)&&s.length>0)return s.every((n)=>n!==null&&typeof n==="object"&&(n.type==="object"||xg(n,"$id"in n?{}:t)))}return!1}function Dw(e){if(!e.path?.length)return e.message;return`${e.path.map((t)=>String(typeof t==="object"?t.key:t)).join(".")}: ${e.message}`}async function Kl(e,t){let r=await e["~standard"].validate(t);if(r.issues&&r.issues.length>0)return{success:!1,error:r.issues.map((o)=>Dw(o)).join(", ")};return{success:!0,data:r.value}}function Zw(e){let t=lc(e,{target:Ql,io:"input"});return typeof t.pattern==="string"?t.pattern:void 0}var Hw=/\\\.\\d\{(\d+)\}/;function Fw(e){let t=Hw.exec(e),r=[void 0,-1,0];if(t)r.push(Number(t[1]));return[!1,!0].flatMap((o)=>[!1,!0].flatMap((s)=>r.map((n)=>Lo({local:o,offset:s,precision:n}))))}function Vw(e,t){let r;switch(e){case"email":r=[f_()];break;case"uri":r=[hc()];break;case"date":r=[Ul()];break;case"date-time":r=Fw(t);break}return new Set(r.map((o)=>Zw(o)).filter((o)=>o!==void 0))}function Bw(e,t,r){if(r!=="zod")return!0;return Vw(e,t).has(t)}function ua(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}function Jw(e){try{return Lw(e,"input")}catch(t){let r=t instanceof Error?t.message:String(t);throw new se(W.InvalidParams,`Elicitation requestedSchema must describe an object with flat primitive properties: ${r}`)}}var Ww=new Set(["$comment","deprecated","description","examples","readOnly","title","writeOnly"]);function md(e){return Ww.has(e)||e.startsWith("x-")}var Kw=new Set(["$schema",...Object.keys(uo.shape.requestedSchema.shape)]),J_={string:ia([ao,us,ls,ds]),number:ia([co]),integer:ia([co]),boolean:ia([cs]),array:ia([ps,ms])},Gw=new Set(ao.shape.format.unwrap().options);function Yw(e,t,r,o){if(!ua(e))return e;let s=typeof e.type==="string"&&Object.hasOwn(J_,e.type)?J_[e.type]:void 0;if(s===void 0)return e;let n={};for(let[i,a]of Object.entries(e))if(s.has(i)||md(i))n[i]=a;else if(i==="pattern"&&e.type==="string"&&typeof e.format==="string"){if(!Gw.has(e.format))n[i]=a;else if(typeof a!=="string"||!Bw(e.format,a,r))o.push(`${t}.${i}`)}else o.push(`${t}.${i}`);return n}function Xw(e,t){let r={},o=[];for(let[s,n]of Object.entries(e))if(s==="properties"&&ua(n))r[s]=Object.fromEntries(Object.entries(n).map(([i,a])=>[i,Yw(a,`properties.${i}`,t,o)]));else if(Kw.has(s))r[s]=n;else if(!md(s))o.push(s);if(o.length>0)throw new se(W.InvalidParams,`Elicitation requestedSchema contains unsupported JSON Schema constraint(s) after Standard Schema conversion: ${o.join(", ")}`);return r}function Qw(e,t){if(!ua(e.properties))return t;let r=Object.entries(e.properties).filter(([,o])=>!Yc(hs,o).success).map(([o])=>`properties.${o}`);return r.length>0?r.join(", "):t}function ed(e,t,r=""){if(Array.isArray(e)&&Array.isArray(t))return e.flatMap((o,s)=>ed(o,t[s],`${r}[${s}]`));if(!ua(e)||!ua(t))return[];return Object.entries(e).flatMap(([o,s])=>{let n=r?`${r}.${o}`:o;if(!Object.prototype.hasOwnProperty.call(t,o))return md(o)?[]:[n];return ed(s,t[o],n)})}function ez(e){if(!Xl(e.requestedSchema))return{...e,mode:"form",requestedSchema:e.requestedSchema};let t=e.requestedSchema["~standard"].vendor,r=Xw(Jw(e.requestedSchema),t),o=Yc(uo.shape.requestedSchema,r);if(!o.success)throw new se(W.InvalidParams,`Elicitation requestedSchema only supports flat primitive properties (string, number, integer, boolean, and string enums): ${Qw(r,o.error.message)}`);let s=ed(r,o.data);if(s.length>0)throw new se(W.InvalidParams,`Elicitation requestedSchema contains unsupported JSON Schema constraint(s) after Standard Schema conversion: ${s.join(", ")}`);let n=(o.data.required??[]).filter((i)=>!Object.prototype.hasOwnProperty.call(o.data.properties,i));if(n.length>0)throw new se(W.InvalidParams,`Elicitation requestedSchema lists required properties that are not defined in properties: ${n.join(", ")}`);return{...e,mode:"form",requestedSchema:o.data}}function tz(e){let t=e.inputRequests!==void 0&&Object.keys(e.inputRequests).length>0,r=typeof e.requestState==="string";if(!t&&!r)throw TypeError("inputRequired() requires at least one of inputRequests (with at least one entry) or requestState (spec: every InputRequiredResult MUST include at least one of the two)");return{resultType:"input_required",...e.inputRequests!==void 0&&{inputRequests:e.inputRequests},...e.requestState!==void 0&&{requestState:e.requestState}}}var rP=Object.assign(tz,{elicit(e){try{return{method:"elicitation/create",params:ez(e)}}catch(t){throw t instanceof se?TypeError(t.message,{cause:t}):t}},elicitUrl(e){return{method:"elicitation/create",params:{...e,mode:"url"}}},createMessage(e){return{method:"sampling/createMessage",params:e}},listRoots(){return{method:"roots/list"}}});var rz=!0,oz=10,sz=250;function kg(e){return{autoFulfill:e?.autoFulfill??rz,maxRounds:e?.maxRounds??oz}}function nz(e,t,r){let o=t!==void 0&&Object.keys(t).length>0;if(!o&&r===void 0)return e;return{...e,...o&&{inputResponses:t},...r!==void 0&&{requestState:r}}}function iz(e,t){return`Multi-round-trip request '${e}' still required input after ${t} rounds (inputRequired.maxRounds)`}function az(e,t){return new Promise((r,o)=>{if(t?.aborted){o(t.reason instanceof L?t.reason:new L(A.RequestTimeout,String(t.reason)));return}let s=setTimeout(()=>{t?.removeEventListener("abort",n),r()},e),n=()=>{clearTimeout(s),o(t?.reason instanceof L?t.reason:new L(A.RequestTimeout,String(t?.reason)))};t?.addEventListener("abort",n,{once:!0})})}function cz(e){let t=new AbortController,r=()=>t.abort(e?.reason);if(e?.addEventListener("abort",r,{once:!0}),e?.aborted)t.abort(e.reason);return{signal:t.signal,abort:(o)=>t.abort(o),dispose:()=>e?.removeEventListener("abort",r)}}async function uz(e){let{config:t,method:r,originalParams:o,requestOptions:s,hooks:n,signal:i}=e,a=e.flowStartedAt??Date.now(),c=e.firstPayload,l=0;while(!0){if(l+=1,l>t.maxRounds)throw new L(A.InputRequiredRoundsExceeded,iz(r,t.maxRounds),{rounds:t.maxRounds,lastResult:{inputRequests:c.inputRequests,...c.requestState!==void 0&&{requestState:c.requestState}}});s.onprogress?.({progress:l,message:`Fulfilling input required by '${r}' (round ${l})`});let d=Object.entries(c.inputRequests??{}),f;if(d.length>0){let v=cz(i);try{let _=await Promise.all(d.map(async([y,T])=>{try{return[y,await n.dispatchInputRequest(y,T,v.signal)]}catch(O){throw v.abort(O),O}}));f=Object.fromEntries(_)}finally{v.dispose()}}else await az(sz,i);let h={...s.timeout!==void 0&&{timeout:s.timeout}};if(s.maxTotalTimeout!==void 0){let v=Date.now()-a,_=s.maxTotalTimeout-v;if(_<=0)throw new L(A.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:s.maxTotalTimeout,totalElapsed:v});h.maxTotalTimeout=_}let g=await n.retry(nz(o,f,c.requestState),h);if(vg(g)){c={inputRequests:g.inputRequests??{},...g.requestState!==void 0&&{requestState:g.requestState}};continue}return g}}var lz=["AnnotationsSchema","AudioContentSchema","BaseMetadataSchema","BlobResourceContentsSchema","BooleanSchemaSchema","CallToolRequestSchema","CallToolRequestParamsSchema","CallToolResultSchema","CancelledNotificationSchema","CancelledNotificationParamsSchema","CancelTaskRequestSchema","CancelTaskResultSchema","ClientCapabilitiesSchema","ClientNotificationSchema","ClientRequestSchema","ClientResultSchema","CompatibilityCallToolResultSchema","CompleteRequestSchema","CompleteRequestParamsSchema","CompleteResultSchema","ContentBlockSchema","CreateMessageRequestSchema","CreateMessageRequestParamsSchema","CreateMessageResultSchema","CreateMessageResultWithToolsSchema","CreateTaskResultSchema","CursorSchema","DiscoverRequestSchema","DiscoverResultSchema","ElicitationCompleteNotificationSchema","ElicitationCompleteNotificationParamsSchema","ElicitRequestSchema","ElicitRequestFormParamsSchema","ElicitRequestParamsSchema","ElicitRequestURLParamsSchema","ElicitResultSchema","EmbeddedResourceSchema","EmptyResultSchema","EnumSchemaSchema","GetPromptRequestSchema","GetPromptRequestParamsSchema","GetPromptResultSchema","GetTaskPayloadRequestSchema","GetTaskPayloadResultSchema","GetTaskRequestSchema","GetTaskResultSchema","IconSchema","IconsSchema","ImageContentSchema","ImplementationSchema","InitializedNotificationSchema","InitializeRequestSchema","InitializeRequestParamsSchema","InitializeResultSchema","JSONArraySchema","JSONObjectSchema","JSONRPCErrorResponseSchema","JSONRPCMessageSchema","JSONRPCNotificationSchema","JSONRPCRequestSchema","JSONRPCResponseSchema","JSONRPCResultResponseSchema","JSONValueSchema","LegacyTitledEnumSchemaSchema","ListPromptsRequestSchema","ListPromptsResultSchema","ListResourcesRequestSchema","ListResourcesResultSchema","ListResourceTemplatesRequestSchema","ListResourceTemplatesResultSchema","ListRootsRequestSchema","ListRootsResultSchema","ListTasksRequestSchema","ListTasksResultSchema","ListToolsRequestSchema","ListToolsResultSchema","LoggingLevelSchema","LoggingMessageNotificationSchema","LoggingMessageNotificationParamsSchema","ModelHintSchema","ModelPreferencesSchema","MultiSelectEnumSchemaSchema","NotificationSchema","NumberSchemaSchema","PaginatedRequestSchema","PaginatedRequestParamsSchema","PaginatedResultSchema","PingRequestSchema","PrimitiveSchemaDefinitionSchema","ProgressSchema","ProgressNotificationSchema","ProgressNotificationParamsSchema","ProgressTokenSchema","PromptSchema","PromptArgumentSchema","PromptListChangedNotificationSchema","PromptMessageSchema","PromptReferenceSchema","ReadResourceRequestSchema","ReadResourceRequestParamsSchema","ReadResourceResultSchema","RelatedTaskMetadataSchema","RequestSchema","RequestIdSchema","RequestMetaSchema","ResourceSchema","ResourceContentsSchema","ResourceLinkSchema","ResourceListChangedNotificationSchema","ResourceRequestParamsSchema","ResourceTemplateSchema","ResourceTemplateReferenceSchema","ResourceUpdatedNotificationSchema","ResourceUpdatedNotificationParamsSchema","ResultMetaObjectSchema","ResultSchema","RoleSchema","RootSchema","RootsListChangedNotificationSchema","SamplingContentSchema","SamplingMessageSchema","SamplingMessageContentBlockSchema","ServerCapabilitiesSchema","ServerNotificationSchema","ServerRequestSchema","ServerResultSchema","SetLevelRequestSchema","SetLevelRequestParamsSchema","SingleSelectEnumSchemaSchema","StringSchemaSchema","SubscribeRequestSchema","SubscribeRequestParamsSchema","SubscriptionFilterSchema","SubscriptionsAcknowledgedNotificationSchema","SubscriptionsAcknowledgedNotificationParamsSchema","SubscriptionsListenRequestSchema","SubscriptionsListenRequestParamsSchema","SubscriptionsListenResultSchema","SubscriptionsListenResultMetaSchema","TaskAugmentedRequestParamsSchema","TaskCreationParamsSchema","TaskMetadataSchema","TaskSchema","TaskStatusSchema","TaskStatusNotificationSchema","TaskStatusNotificationParamsSchema","TextContentSchema","TextResourceContentsSchema","TitledMultiSelectEnumSchemaSchema","TitledSingleSelectEnumSchemaSchema","ToolSchema","ToolAnnotationsSchema","ToolChoiceSchema","ToolExecutionSchema","ToolListChangedNotificationSchema","ToolResultContentSchema","ToolUseContentSchema","UnsubscribeRequestSchema","UnsubscribeRequestParamsSchema","UntitledMultiSelectEnumSchemaSchema","UntitledSingleSelectEnumSchemaSchema"],dz={IdJagTokenExchangeResponseSchema:ra,OAuthClientInformationFullSchema:gs,OAuthClientInformationSchema:sa,OAuthClientMetadataSchema:oa,OAuthClientRegistrationErrorSchema:Dc,OAuthErrorResponseSchema:mo,OAuthMetadataSchema:lo,OAuthProtectedResourceMetadataSchema:fs,OAuthTokenRevocationRequestSchema:Zc,OAuthTokensSchema:po,OpenIdProviderDiscoveryMetadataSchema:_s,OpenIdProviderMetadataSchema:ta},Pg={},Tg={};function Eg(e,t){let r=e.slice(0,-6);Pg[r]=t,Tg[r]=(o)=>t.safeParse(o).success}for(let e of lz)Eg(e,Tw[e]);for(let[e,t]of Object.entries(dz))Eg(e,t);var pz=Object.freeze(Pg),hd=Object.freeze(Tg);function mz(e){switch(e){case"initialize":case"notifications/initialized":return Qt(void 0);case"server/discover":return Qt(Gc);default:return}}var pa=60000,hz=[Jt,Do,Gr,Ho],fz=["inputResponses","requestState"];function W_(e,t){let r=e.params;if(!ca(r))return{message:e,lifted:{}};let o=r._meta,s=ca(o)?hz.filter((c)=>(c in o)):[],n=t==="request"?fz.filter((c)=>(c in r)):[];if(s.length===0&&n.length===0)return{message:e,lifted:{}};let i={},a={...r};if(s.length>0&&ca(o)){let c={},l={...o};for(let d of s)c[d]=o[d],delete l[d];if(i.envelope=c,Object.keys(l).length>0)a._meta=l;else delete a._meta}for(let c of n){if(c==="inputResponses")i.inputResponses=a[c];if(c==="requestState")i.requestState=a[c];delete a[c]}return{message:{...e,params:a},lifted:i}}function K_(e,t){let r=e.validateResult(t,void 0);if(!r.ok&&r.reason==="not-in-era")return;return{"~standard":{version:1,vendor:"mcp-wire-codec",validate(o){let s=e.validateResult(t,o);if(s.ok)return{value:s.value};return{issues:[{message:s.reason==="invalid"?s.message:`not-in-era: ${t}`}]}}}}}function fd(e){return()=>e}var _z=fd(void 0),gz,ma=class{_transport;_requestMessageId=0;_requestHandlers=new Map;_customSchemaRequestMethods=new Set;_requestHandlerAbortControllers=new Map;_notificationHandlers=new Map;_responseHandlers=new Map;_progressHandlers=new Map;_timeoutInfo=new Map;_pendingDebouncedNotifications=new Set;_negotiatedProtocolVersion;static{gz=(e,t)=>{e._negotiatedProtocolVersion=t}}_supportedProtocolVersions;onclose;onerror;fallbackRequestHandler;fallbackNotificationHandler;constructor(e){this._options=e,this._supportedProtocolVersions=e?.supportedProtocolVersions??gc,this.setNotificationHandler("notifications/cancelled",(t)=>{this._oncancel(t)}),this.setNotificationHandler("notifications/progress",(t)=>{this._onprogress(t)}),this.setRequestHandler("ping",(t)=>({}))}_shouldDropInbound(e){}_outboundMetaEnvelope(){}_envelopeOutbound(e){let t=this._outboundMetaEnvelope();if(t===void 0)return e;let r=e.params??{};return{...e,params:{...r,_meta:{...t,...r._meta}}}}_resolveNonCompleteResult(e,t){return Promise.reject(new L(A.UnsupportedResultType,`Unsupported result type '${e.kind}' for ${t.request.method}`,{resultType:e.kind,method:t.request.method}))}_getRequestHandler(e){return this._requestHandlers.get(e)}async _oncancel(e){if(e.params.requestId===void 0)return;this._requestHandlerAbortControllers.get(e.params.requestId)?.abort(e.params.reason)}_setupTimeout(e,t,r,o,s=!1){this._timeoutInfo.set(e,{timeoutId:setTimeout(o,t),startTime:Date.now(),timeout:t,maxTotalTimeout:r,resetTimeoutOnProgress:s,onTimeout:o})}_resetTimeout(e){let t=this._timeoutInfo.get(e);if(!t)return!1;let r=Date.now()-t.startTime;if(t.maxTotalTimeout&&r>=t.maxTotalTimeout)throw this._timeoutInfo.delete(e),new L(A.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:t.maxTotalTimeout,totalElapsed:r});return clearTimeout(t.timeoutId),t.timeoutId=setTimeout(t.onTimeout,t.timeout),!0}_cleanupTimeout(e){let t=this._timeoutInfo.get(e);if(t)clearTimeout(t.timeoutId),this._timeoutInfo.delete(e)}async connect(e){this._transport=e;let t=this.transport?.onclose;this._transport.onclose=()=>{try{t?.()}finally{this._onclose()}};let r=this.transport?.onerror;this._transport.onerror=(s)=>{r?.(s),this._onerror(s)};let o=this._transport?.onmessage;this._transport.onmessage=(s,n)=>{if(o?.(s,n),ho(s)||fo(s))this._onresponse(s);else if(wr(s))this._onrequest(s,n);else if(Sg(s))this._onnotification(s,n);else this._onerror(Error(`Unknown message type: ${JSON.stringify(s)}`))},e.setSupportedProtocolVersions?.(this._supportedProtocolVersions),await this._transport.start()}_onclose(){let e=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._pendingDebouncedNotifications.clear();for(let o of this._timeoutInfo.values())clearTimeout(o.timeoutId);this._timeoutInfo.clear();let t=this._requestHandlerAbortControllers;this._requestHandlerAbortControllers=new Map;let r=new L(A.ConnectionClosed,"Connection closed");this._transport=void 0;try{this.onclose?.()}finally{for(let o of e.values())o(r);for(let o of t.values())o.abort(r)}}_onerror(e){this.onerror?.(e)}_onnotification(e,t){let{message:r}=W_(e,"notification"),o=this._negotiatedWireCodec();if(t?.classification===void 0&&this._shouldDropInbound(e)==="drop")return;if(t?.classification!==void 0){let i=Z_(t.classification);if(i!==o.era){this._onerror(Error(`Era mismatch on inbound notification '${r.method}': classified as ${i} but this instance serves ${o.era}`));return}}if(Wl(r.method)&&!o.hasNotificationMethod(r.method))return;let s=this._notificationHandlers.get(r.method),n=this.fallbackNotificationHandler;if(s===void 0&&n===void 0)return;Promise.resolve().then(()=>s===void 0?n(r):s(r,o)).catch((i)=>this._onerror(Error(`Uncaught error in notification handler: ${i}`)))}_onrequest(e,t){let{message:r,lifted:o}=W_(e,"request"),s=this._negotiatedWireCodec();if(t?.classification===void 0&&this._shouldDropInbound(e)==="drop"){this._onerror(Error(`Dropped inbound request '${e.method}': not servable on this connection's protocol era`));return}let n=this._transport,i=(_,y,T)=>{let O={jsonrpc:"2.0",id:r.id,error:{code:_,message:y,...T!==void 0&&{data:T}}};n?.send(O).catch((k)=>this._onerror(Error(`Failed to send an error response: ${k}`)))};if(t?.classification!==void 0){let _=Z_(t.classification);if(_!==s.era){this._onerror(Error(`Era mismatch on inbound request '${r.method}': classified as ${_} but this instance serves ${s.era}`));let y=t.classification.revision??_;i(W.UnsupportedProtocolVersion,`Unsupported protocol version: ${y}`,{supported:this._supportedProtocolVersions,requested:y});return}}if(Jl(r.method)&&!s.hasRequestMethod(r.method)&&!(H_(r.method)&&this._customSchemaRequestMethods.has(r.method))){i(W.MethodNotFound,"Method not found");return}let a=this._requestHandlers.get(r.method)??this.fallbackRequestHandler;if(a===void 0){i(W.MethodNotFound,"Method not found");return}let c=s.checkInboundEnvelope(o);if(c!==void 0){i(W.InvalidParams,c);return}let l=(_,y)=>this._notificationViaCodec(this._resolveOutboundCodec(_.method),_,{...y,relatedRequestId:r.id}),d=(_,y,T)=>this._requestWithSchemaViaCodec(this._resolveOutboundCodec(_.method),_,y,{...T,relatedRequestId:r.id}),f=new AbortController;this._requestHandlerAbortControllers.set(r.id,f);let h=o.inputResponses===void 0?void 0:Sz(o.inputResponses),g={sessionId:n?.sessionId,mcpReq:{id:r.id,method:r.method,_meta:r.params?._meta,...o.envelope!==void 0&&{envelope:o.envelope},...h!==void 0&&{inputResponses:h.accepted},...h!==void 0&&h.droppedKeys.length>0&&{droppedInputResponseKeys:h.droppedKeys},requestState:o.requestState===void 0?_z:fd(o.requestState),signal:f.signal,send:(_,y,T)=>{let O=this._resolveOutboundCodec(_.method);if(this._assertOutboundRequestInEra(O,_.method),Xl(y))return d(_,y,T);let k=K_(O,_.method);if(k===void 0)throw TypeError(`'${_.method}' is not a spec method; pass a result schema as the second argument to ctx.mcpReq.send().`);return d(_,k,y)},notify:l},http:t?.authInfo?{authInfo:t.authInfo}:void 0},v=this.buildContext(g,t);Promise.resolve().then(()=>a(r,v)).then(async(_)=>{if(f.signal.aborted)return;let y;try{y=s.encodeResult(r.method,_,this._outboundServerInfo())}catch(O){this._onerror(Error(`Failed to encode result for ${r.method}: ${O}`)),i(W.InternalError,"Internal error");return}let T={result:y,jsonrpc:"2.0",id:r.id};await n?.send(T)},async(_)=>{if(f.signal.aborted)return;let y=Number.isSafeInteger(_.code)?_.code:W.InternalError,T={jsonrpc:"2.0",id:r.id,error:{code:s.encodeErrorCode(y),message:_.message??"Internal error",..._.data!==void 0&&{data:_.data}}};await n?.send(T)}).catch((_)=>this._onerror(Error(`Failed to send response: ${_}`))).finally(()=>{if(this._requestHandlerAbortControllers.get(r.id)===f)this._requestHandlerAbortControllers.delete(r.id)})}_onprogress(e){let{progressToken:t,...r}=e.params,o=Number(t),s=this._progressHandlers.get(o);if(!s){this._onerror(Error(`Received a progress notification for an unknown token: ${JSON.stringify(e)}`));return}let n=this._responseHandlers.get(o),i=this._timeoutInfo.get(o);if(i&&n&&i.resetTimeoutOnProgress)try{this._resetTimeout(o)}catch(a){this._responseHandlers.delete(o),this._progressHandlers.delete(o),this._cleanupTimeout(o),n(a);return}s(r)}_onresponse(e){let t=Number(e.id),r=this._responseHandlers.get(t);if(r===void 0){this._onerror(Error(`Received a response for an unknown message ID: ${JSON.stringify(e)}`));return}if(this._responseHandlers.delete(t),this._cleanupTimeout(t),this._progressHandlers.delete(t),ho(e))r(e);else r(se.fromError(e.error.code,e.error.message,e.error.data))}get transport(){return this._transport}async close(){await this._transport?.close()}request(e,t,r){let o=this._resolveOutboundCodec(e.method);if(Xl(t)){if(!H_(e.method))this._assertOutboundRequestInEra(o,e.method);return this._requestWithSchemaViaCodec(o,e,t,r)}this._assertOutboundRequestInEra(o,e.method);let s=K_(o,e.method);if(s===void 0)throw TypeError(`'${e.method}' is not a spec method; pass a result schema as the second argument to request().`);return this._requestWithSchemaViaCodec(o,e,s,t)}_negotiatedWireCodec(){return Qt(this._negotiatedProtocolVersion)}_wireCodec(){return this._negotiatedWireCodec()}_resolveOutboundCodec(e){if(this._negotiatedProtocolVersion===void 0){let t=mz(e);if(t)return t}return this._negotiatedWireCodec()}_assertOutboundRequestInEra(e,t){if(Jl(t)&&!e.hasRequestMethod(t))throw new L(A.MethodNotSupportedByProtocolVersion,`Method '${t}' is not supported by the negotiated protocol version (wire era ${e.era})`,{method:t,era:e.era})}_requestWithSchema(e,t,r){let o=this._resolveOutboundCodec(e.method);return this._assertOutboundRequestInEra(o,e.method),this._requestWithSchemaViaCodec(o,e,t,r)}_requestWithSchemaViaCodec(e,t,r,o){let{relatedRequestId:s,resumptionToken:n,onresumptiontoken:i,headers:a}=o??{},c=Date.now(),l,d;return new Promise((f,h)=>{let g=(R)=>{h(R)};if(!this._transport){g(Error("Not connected"));return}if(this._options?.enforceStrictCapabilities===!0)try{this.assertCapabilityForMethod(t.method)}catch(R){g(R);return}if(o?.signal?.aborted){let R=o.signal.reason;throw R instanceof L?R:new L(A.RequestTimeout,String(R))}let v=e.era===Gc&&this._transport.hasPerRequestStream===!0?new AbortController:void 0,_=this._requestMessageId++;d=_;let y={...t,jsonrpc:"2.0",id:_};if(o?.onprogress)this._progressHandlers.set(_,o.onprogress),y.params={...t.params,_meta:{...t.params?._meta,progressToken:_}};let T=this._envelopeOutbound(y),O=!1,k=(R)=>{if(O)return;if(this._progressHandlers.delete(_),v===void 0){if(t.method!=="initialize")this._transport?.send(this._envelopeOutbound({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:_,reason:String(R)}}),{relatedRequestId:s,resumptionToken:n,onresumptiontoken:i}).catch((Z)=>this._onerror(Error(`Failed to send cancellation: ${Z}`)))}else v.abort();h(R instanceof L?R:new L(A.RequestTimeout,String(R)))};this._responseHandlers.set(_,(R)=>{if(o?.signal?.aborted)return;if(O=!0,R instanceof Error)return h(R);let Z;try{Z=e.decodeResult(t.method,R.result)}catch(X){return h(X instanceof Error?X:Error(String(X)))}if(Z.kind==="invalid")return h(Z.error);if(Z.kind==="input_required"){if(o?.allowInputRequired===!0)return f(wz(Z));let X={codec:e,request:t,resultSchema:r,options:o,flowStartedAt:c,retry:(ne,xe)=>this._requestWithSchemaViaCodec(e,ne===void 0?{method:t.method}:{method:t.method,params:ne},r,xe)};return f(this._resolveNonCompleteResult(Z,X))}let ee=Z.result;Kl(r,ee).then((X)=>{if(X.success)f(X.data);else h(new L(A.InvalidResult,`Invalid result for ${t.method}: ${X.error}`))},h)}),l=()=>k(o?.signal?.reason),o?.signal?.addEventListener("abort",l,{once:!0});let P=o?.timeout??pa,z=()=>k(new L(A.RequestTimeout,"Request timed out",{timeout:P}));this._setupTimeout(_,P,o?.maxTotalTimeout,z,o?.resetTimeoutOnProgress??!1),this._transport.send(T,{relatedRequestId:s,resumptionToken:n,onresumptiontoken:i,headers:a,requestSignal:v?.signal}).catch((R)=>{this._progressHandlers.delete(_),h(R)})}).finally(()=>{if(l)o?.signal?.removeEventListener("abort",l);if(d!==void 0)this._responseHandlers.delete(d),this._cleanupTimeout(d)})}async notification(e,t){return await this._notificationViaCodec(this._resolveOutboundCodec(e.method),e,t)}async _notificationViaCodec(e,t,r){if(!this._transport)throw new L(A.NotConnected,"Not connected");if(Wl(t.method)&&!e.hasNotificationMethod(t.method))throw new L(A.MethodNotSupportedByProtocolVersion,`Notification '${t.method}' is not supported by the negotiated protocol version (wire era ${e.era})`,{method:t.method,era:e.era});this.assertNotificationCapability(t.method);let o=this._envelopeOutbound({jsonrpc:"2.0",...t});if((this._options?.debouncedNotificationMethods??[]).includes(t.method)&&!t.params&&r?.relatedRequestId===void 0){if(this._pendingDebouncedNotifications.has(t.method))return;this._pendingDebouncedNotifications.add(t.method),Promise.resolve().then(()=>{if(this._pendingDebouncedNotifications.delete(t.method),!this._transport)return;this._transport?.send(o,r).catch((s)=>this._onerror(s))});return}await this._transport.send(o,r)}setRequestHandler(e,t,r){this.assertRequestHandlerCapability(e);let o;if(typeof t==="function"){if(!Jl(e))throw TypeError(`'${e}' is not a spec request method; pass schemas as the second argument to setRequestHandler().`);o=(s,n)=>{let i=this._negotiatedWireCodec(),a=i.validateRequest(e,s);if(!a.ok&&a.reason==="not-in-era")a=i.validateInputRequest(e,s);if(!a.ok){if(a.reason==="not-in-era")throw new se(W.InternalError,`No wire schema for ${e} in the resolved era`);throw Error(a.message)}return Promise.resolve(t(a.value,n))}}else if(r)o=async(s,n)=>{let i=await Kl(t.params,{...s.params});if(!i.success)throw new se(W.InvalidParams,`Invalid params for ${e}: ${i.error}`);return r(i.data,n)};else throw TypeError("setRequestHandler: handler is required");if(typeof t==="function")this._customSchemaRequestMethods.delete(e);else this._customSchemaRequestMethods.add(e);this._requestHandlers.set(e,this._wrapHandler(e,o))}_wrapHandler(e,t){return t}_outboundServerInfo(){}removeRequestHandler(e){this._requestHandlers.delete(e),this._customSchemaRequestMethods.delete(e)}assertCanSetRequestHandler(e){if(this._requestHandlers.has(e))throw Error(`A request handler for ${e} already exists, which would be overridden`)}setNotificationHandler(e,t,r){if(typeof t==="function"){if(!Wl(e))throw TypeError(`'${e}' is not a spec notification method; pass schemas as the second argument to setNotificationHandler().`);this._notificationHandlers.set(e,(o,s)=>{let n=s.validateNotification(e,o);if(!n.ok){if(n.reason==="not-in-era")throw new se(W.InternalError,`No wire schema for ${e} in the resolved era`);throw Error(n.message)}return Promise.resolve(t(n.value))});return}if(!r)throw TypeError("setNotificationHandler: handler is required");this._notificationHandlers.set(e,async(o)=>{let s=await Kl(t.params,{...o.params});if(!s.success)throw new se(W.InvalidParams,`Invalid params for notification ${e}: ${s.error}`);await r(s.data,o)})}removeNotificationHandler(e){this._notificationHandlers.delete(e)}};function ca(e){return e!==null&&typeof e==="object"&&!Array.isArray(e)}function _d(e,t){let r={...e};for(let o in t){let s=o,n=t[s];if(n===void 0)continue;let i=r[s];r[s]=ca(i)&&ca(n)?{...i,...n}:n}return r}function Wc(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}function Sz(e){let t={},r=[];if(!Wc(e))return{accepted:t,droppedKeys:r};for(let[o,s]of Object.entries(e)){if(!Wc(s)||"method"in s||"result"in s){r.push(o);continue}t[o]=s}return{accepted:t,droppedKeys:r}}function G_(e){throw new L(A.SendFailed,`ctx.mcpReq.${e} is not available while fulfilling an embedded input request: the request is fulfilled locally and has no related peer request`)}function vz(e,t,r,o,s){return{sessionId:s,mcpReq:{id:e,method:t,_meta:r?._meta,requestState:fd(void 0),signal:o,send:()=>G_("send"),notify:()=>G_("notify")}}}async function bz(e,t,r,o,s){if(!Wc(o)||typeof o.method!=="string")throw new L(A.InvalidResult,`Invalid input request '${r}': each inputRequests entry must be an embedded request object with a method`,{key:r});let n=o.method;if(!t.hasInputRequestMethod(n))throw new L(A.InvalidResult,`Invalid input request '${r}': '${n}' is not an embedded request the ${t.era} revision defines (expected elicitation/create, sampling/createMessage, or roots/list)`,{key:r,method:n});let i=e.getRequestHandler(n);if(i===void 0)throw new L(A.CapabilityNotSupported,`Cannot fulfil input request '${r}': no handler is registered for '${n}' on this client. Declare the corresponding capability and register a handler, or handle input_required results manually.`,{key:r,method:n});let a=Wc(o.params)?o.params:void 0;return await i({jsonrpc:"2.0",id:r,method:n,...a!==void 0&&{params:a}},e.buildContext(vz(r,n,a,s,e.sessionId)))}function yz(e,t){return{...e?.signal!==void 0&&{signal:e.signal},...e?.onprogress!==void 0&&{onprogress:e.onprogress},...e?.resetTimeoutOnProgress!==void 0&&{resetTimeoutOnProgress:e.resetTimeoutOnProgress},...e?.headers!==void 0&&{headers:e.headers},...t.timeout!==void 0&&{timeout:t.timeout},...t.maxTotalTimeout!==void 0&&{maxTotalTimeout:t.maxTotalTimeout},allowInputRequired:!0}}function $g(e,t,r,o){let{codec:s,request:n,options:i,flowStartedAt:a}=o,c={inputRequests:r.inputRequests,...r.requestState!==void 0&&{requestState:r.requestState}},l={dispatchInputRequest:(d,f,h)=>bz(e,s,d,f,h),retry:(d,f)=>o.retry(d,yz(i,f))};return uz({config:t,method:n.method,originalParams:n.params,firstPayload:c,flowStartedAt:a,signal:i?.signal,requestOptions:{...i?.timeout!==void 0&&{timeout:i.timeout},...i?.maxTotalTimeout!==void 0&&{maxTotalTimeout:i.maxTotalTimeout},...i?.onprogress!==void 0&&{onprogress:i.onprogress}},hooks:l})}function wz(e){return{resultType:"input_required",inputRequests:e.inputRequests,...e.requestState!==void 0&&{requestState:e.requestState},...e._meta!==void 0&&{_meta:e._meta}}}/*!
66
66
  * content-type
67
67
  * Copyright(c) 2015 Douglas Christopher Wilson
68
68
  * MIT Licensed
69
- */var fz=Sm((e)=>{var t=/; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g,r=/\\([\u000b\u0020-\u00ff])/g,o=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;e.parse=s;function s(a){if(!a)throw TypeError("argument string is required");var c=typeof a==="object"?n(a):a;if(typeof c!=="string")throw TypeError("argument string is required to be a string");var l=c.indexOf(";"),d=l!==-1?c.slice(0,l).trim():c.trim();if(!o.test(d))throw TypeError("invalid media type");var f=new i(d.toLowerCase());if(l!==-1){var h,g,b;t.lastIndex=l;while(g=t.exec(c)){if(g.index!==l)throw TypeError("invalid parameter format");if(l+=g[0].length,h=g[1].toLowerCase(),b=g[2],b.charCodeAt(0)===34){if(b=b.slice(1,-1),b.indexOf("\\")!==-1)b=b.replace(r,"$1")}f.parameters[h]=b}if(l!==c.length)throw TypeError("invalid parameter format")}return f}function n(a){var c;if(typeof a.getHeader==="function")c=a.getHeader("content-type");else if(typeof a.headers==="object")c=a.headers&&a.headers["content-type"];if(typeof c!=="string")throw TypeError("content-type header is missing from object");return c}function i(a){this.parameters=Object.create(null),this.type=a}}),_z=bm(fz(),1);function kg(e){if(!e)return;try{return _z.parse(e).type}catch{let t=(e.split(";",1)[0]??"").trim().toLowerCase();if(t===""||e.slice(t.length).includes(","))return;return t}}function B_(e){if(!e)return{};if(e instanceof Headers)return Object.fromEntries(e.entries());if(Array.isArray(e))return Object.fromEntries(e);return{...e}}function Pg(e=fetch,t){if(!t)return e;return async(r,o)=>e(r,{...t,...o,headers:o?.headers?{...B_(t.headers),...B_(o.headers)}:t.headers})}var gz=new Set([301,302,303,307,308]),Sz=5;function vz(e,t){if(e.protocol===t.protocol&&e.host===t.host)return!0;return e.protocol==="http:"&&t.protocol==="https:"&&e.hostname===t.hostname&&!e.port&&!t.port}function Tg(e,t){let r=gz.has(t.status)?t.headers?.get("location"):void 0;if(!r)return;try{return new URL(r,e)}catch{return}}var Eg=new WeakSet;function $g(e){let t=(r,o)=>e(r,o);return Eg.add(t),t}function Ss(e){if(Eg.has(e))return e;return async(t,r)=>{if(r?.redirect==="error"||r?.redirect==="manual")return e(t,r);let o=(r?.method??"GET").toUpperCase(),s=t;for(let n=0;;n++){let i=await e(s,{...r,redirect:"manual"}),a=Tg(s,i);if(!a||n===Sz)return i;let c=new URL(s),l=o==="GET"||i.status===307||i.status===308,d=!(a.username||a.password)||a.username===c.username&&a.password===c.password;if(!l||!d||!vz(c,a))return i;await i.text?.().catch(()=>{}),s=a}}}function Cg(e,t){if(t.type==="opaqueredirect")return"Redirect not followed: this runtime does not expose where it points";let r=Tg(t.url||e,t);if(!r)return;if(r.username=r.password=r.search=r.hash="",r.protocol==="http:"&&new URL(t.url||e).protocol==="https:")return r.protocol="https:",`Redirect from https to plain http not followed; try ${r.href} as the endpoint`;return`Redirect to ${r.href} not followed; use that URL as the endpoint if it is the intended server`}function la(e,t){let r=typeof e;if(r!==typeof t)return!1;if(Array.isArray(e)){if(!Array.isArray(t))return!1;let o=e.length;if(o!==t.length)return!1;for(let s=0;s<o;s++)if(!la(e[s],t[s]))return!1;return!0}if(r==="object"){if(!e||!t)return e===t;let o=Object.keys(e),s=Object.keys(t);if(o.length!==s.length)return!1;for(let n of o)if(!la(e[n],t[n]))return!1;return!0}return e===t}function St(e){return encodeURI(bz(e))}function bz(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}var yz={prefixItems:!0,items:!0,allOf:!0,anyOf:!0,oneOf:!0},wz={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependentSchemas:!0},zz={id:!0,$id:!0,$ref:!0,$schema:!0,$anchor:!0,$vocabulary:!0,$comment:!0,default:!0,enum:!0,const:!0,required:!0,type:!0,maximum:!0,minimum:!0,exclusiveMaximum:!0,exclusiveMinimum:!0,multipleOf:!0,maxLength:!0,minLength:!0,pattern:!0,format:!0,maxItems:!0,minItems:!0,uniqueItems:!0,maxProperties:!0,minProperties:!0},Rz=typeof self<"u"&&self.location&&self.location.origin!=="null"?new URL(self.location.origin+self.location.pathname+location.search):new URL("https://github.com/cfworker");function fo(e,t=Object.create(null),r=Rz,o=""){if(e&&typeof e==="object"&&!Array.isArray(e)){let n=e.$id||e.id;if(n){let i=new URL(n,r.href);if(i.hash.length>1)t[i.href]=e;else if(i.hash="",o==="")r=i;else fo(e,t,r)}}else if(e!==!0&&e!==!1)return t;let s=r.href+(o?"#"+o:"");if(t[s]!==void 0)throw Error(`Duplicate schema URI "${s}".`);if(t[s]=e,e===!0||e===!1)return t;if(e.__absolute_uri__===void 0)Object.defineProperty(e,"__absolute_uri__",{enumerable:!1,value:s});if(e.$ref&&e.__absolute_ref__===void 0){let n=new URL(e.$ref,r.href);n.hash=n.hash,Object.defineProperty(e,"__absolute_ref__",{enumerable:!1,value:n.href})}if(e.$recursiveRef&&e.__absolute_recursive_ref__===void 0){let n=new URL(e.$recursiveRef,r.href);n.hash=n.hash,Object.defineProperty(e,"__absolute_recursive_ref__",{enumerable:!1,value:n.href})}if(e.$anchor){let n=new URL("#"+e.$anchor,r.href);t[n.href]=e}for(let n in e){if(zz[n])continue;let i=`${o}/${St(n)}`,a=e[n];if(Array.isArray(a)){if(yz[n]){let c=a.length;for(let l=0;l<c;l++)fo(a[l],t,r,`${i}/${l}`)}}else if(wz[n])for(let c in a)fo(a[c],t,r,`${i}/${St(c)}`);else fo(a,t,r,i)}return t}var xz=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,kz=[0,31,28,31,30,31,30,31,31,30,31,30,31],Pz=/^(\d\d):(\d\d):(\d\d)(\.\d+)?(z|[+-]\d\d(?::?\d\d)?)?$/i,Tz=/^(?=.{1,253}\.?$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*\.?$/i,Ez=/^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,$z=/^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i,Cz=/^(?:(?:https?|ftp):\/\/)(?:\S+(?::\S*)?@)?(?:(?!10(?:\.\d{1,3}){3})(?!127(?:\.\d{1,3}){3})(?!169\.254(?:\.\d{1,3}){2})(?!192\.168(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z\u{00a1}-\u{ffff}0-9]+-?)*[a-z\u{00a1}-\u{ffff}0-9]+)(?:\.(?:[a-z\u{00a1}-\u{ffff}0-9]+-?)*[a-z\u{00a1}-\u{ffff}0-9]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu,Iz=/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,qz=/^(?:\/(?:[^~/]|~0|~1)*)*$/,Oz=/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,Nz=/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,jz=(e)=>{if(e[0]==='"')return!1;let[t,r,...o]=e.split("@");if(!t||!r||o.length!==0||t.length>64||r.length>253)return!1;if(t[0]==="."||t.endsWith(".")||t.includes(".."))return!1;if(!/^[a-z0-9.-]+$/i.test(r)||!/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+$/i.test(t))return!1;return r.split(".").every((s)=>/^[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?$/i.test(s))},Mz=/^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/,Az=/^((([0-9a-f]{1,4}:){7}([0-9a-f]{1,4}|:))|(([0-9a-f]{1,4}:){6}(:[0-9a-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){5}(((:[0-9a-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){4}(((:[0-9a-f]{1,4}){1,3})|((:[0-9a-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){3}(((:[0-9a-f]{1,4}){1,4})|((:[0-9a-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){2}(((:[0-9a-f]{1,4}){1,5})|((:[0-9a-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){1}(((:[0-9a-f]{1,4}){1,6})|((:[0-9a-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9a-f]{1,4}){1,7})|((:[0-9a-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))$/i,Lz=(e)=>e.length>1&&e.length<80&&(/^P\d+([.,]\d+)?W$/.test(e)||/^P[\dYMDTHS]*(\d[.,]\d+)?[YMDHS]$/.test(e)&&/^P([.,\d]+Y)?([.,\d]+M)?([.,\d]+D)?(T([.,\d]+H)?([.,\d]+M)?([.,\d]+S)?)?$/.test(e));function jt(e){return e.test.bind(e)}var Ig={date:qg,time:Og.bind(void 0,!1),"date-time":Zz,duration:Lz,uri:Vz,"uri-reference":jt(Ez),"uri-template":jt($z),url:jt(Cz),email:jz,hostname:jt(Tz),ipv4:jt(Mz),ipv6:jt(Az),regex:Jz,uuid:jt(Iz),"json-pointer":jt(qz),"json-pointer-uri-fragment":jt(Oz),"relative-json-pointer":jt(Nz)};function Uz(e){return e%4===0&&(e%100!==0||e%400===0)}function qg(e){let t=e.match(xz);if(!t)return!1;let r=+t[1],o=+t[2],s=+t[3];return o>=1&&o<=12&&s>=1&&s<=(o==2&&Uz(r)?29:kz[o])}function Og(e,t){let r=t.match(Pz);if(!r)return!1;let o=+r[1],s=+r[2],n=+r[3],i=!!r[5];return(o<=23&&s<=59&&n<=59||o==23&&s==59&&n==60)&&(!e||i)}var Dz=/t|\s/i;function Zz(e){let t=e.split(Dz);return t.length==2&&qg(t[0])&&Og(!0,t[1])}var Hz=/\/|:/,Fz=/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)(?:\?(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i;function Vz(e){return Hz.test(e)&&Fz.test(e)}var Bz=/[^\\]\\Z/;function Jz(e){if(Bz.test(e))return!1;try{return new RegExp(e,"u"),!0}catch(t){return!1}}function Wz(e){let t=0,r=e.length,o=0,s;while(o<r)if(t++,s=e.charCodeAt(o++),s>=55296&&s<=56319&&o<r){if(s=e.charCodeAt(o),(s&64512)==56320)o++}return t}function Se(e,t,r="2019-09",o=fo(t),s=!0,n=null,i="#",a="#",c=Object.create(null)){if(t===!0)return{valid:!0,errors:[]};if(t===!1)return{valid:!1,errors:[{instanceLocation:i,keyword:"false",keywordLocation:i,error:"False boolean schema."}]};let l=typeof e,d;switch(l){case"boolean":case"number":case"string":d=l;break;case"object":if(e===null)d="null";else if(Array.isArray(e))d="array";else d="object";break;default:throw Error(`Instances of "${l}" type are not supported.`)}let{$ref:f,$recursiveRef:h,$recursiveAnchor:g,type:b,const:_,enum:w,required:I,not:A,anyOf:z,allOf:q,oneOf:x,if:R,then:Z,else:ee,format:X,properties:ne,patternProperties:xe,additionalProperties:te,unevaluatedProperties:ie,minProperties:re,maxProperties:de,propertyNames:bt,dependentRequired:Fe,dependentSchemas:st,dependencies:yt,prefixItems:Ge,items:Le,additionalItems:Dt,unevaluatedItems:Zt,contains:wt,minContains:Ne,maxContains:Ue,minItems:De,maxItems:dt,uniqueItems:Cr,minimum:Ye,maximum:Xe,exclusiveMinimum:Ve,exclusiveMaximum:nt,multipleOf:it,minLength:zt,maxLength:Rt,pattern:or,__absolute_ref__:xt,__absolute_recursive_ref__:Ir}=t,N=[];if(g===!0&&n===null)n=t;if(h==="#"){let B=n===null?o[Ir]:n,U=`${a}/$recursiveRef`,Q=Se(e,n===null?t:n,r,o,s,B,i,U,c);if(!Q.valid)N.push({instanceLocation:i,keyword:"$recursiveRef",keywordLocation:U,error:"A subschema had errors."},...Q.errors)}if(f!==void 0){let B=o[xt||f];if(B===void 0){let j=`Unresolved $ref "${f}".`;if(xt&&xt!==f)j+=` Absolute URI "${xt}".`;throw j+=`
69
+ */var zz=zp((e)=>{var t=/; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g,r=/\\([\u000b\u0020-\u00ff])/g,o=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;e.parse=s;function s(a){if(!a)throw TypeError("argument string is required");var c=typeof a==="object"?n(a):a;if(typeof c!=="string")throw TypeError("argument string is required to be a string");var l=c.indexOf(";"),d=l!==-1?c.slice(0,l).trim():c.trim();if(!o.test(d))throw TypeError("invalid media type");var f=new i(d.toLowerCase());if(l!==-1){var h,g,v;t.lastIndex=l;while(g=t.exec(c)){if(g.index!==l)throw TypeError("invalid parameter format");if(l+=g[0].length,h=g[1].toLowerCase(),v=g[2],v.charCodeAt(0)===34){if(v=v.slice(1,-1),v.indexOf("\\")!==-1)v=v.replace(r,"$1")}f.parameters[h]=v}if(l!==c.length)throw TypeError("invalid parameter format")}return f}function n(a){var c;if(typeof a.getHeader==="function")c=a.getHeader("content-type");else if(typeof a.headers==="object")c=a.headers&&a.headers["content-type"];if(typeof c!=="string")throw TypeError("content-type header is missing from object");return c}function i(a){this.parameters=Object.create(null),this.type=a}}),Rz=xp(zz(),1);function Cg(e){if(!e)return;try{return Rz.parse(e).type}catch{let t=(e.split(";",1)[0]??"").trim().toLowerCase();if(t===""||e.slice(t.length).includes(","))return;return t}}function Y_(e){if(!e)return{};if(e instanceof Headers)return Object.fromEntries(e.entries());if(Array.isArray(e))return Object.fromEntries(e);return{...e}}function Ig(e=fetch,t){if(!t)return e;return async(r,o)=>e(r,{...t,...o,headers:o?.headers?{...Y_(t.headers),...Y_(o.headers)}:t.headers})}var xz=new Set([301,302,303,307,308]),kz=5;function Pz(e,t){if(e.protocol===t.protocol&&e.host===t.host)return!0;return e.protocol==="http:"&&t.protocol==="https:"&&e.hostname===t.hostname&&!e.port&&!t.port}function qg(e,t){let r=xz.has(t.status)?t.headers?.get("location"):void 0;if(!r)return;try{return new URL(r,e)}catch{return}}var Og=new WeakSet;function Ng(e){let t=(r,o)=>e(r,o);return Og.add(t),t}function vs(e){if(Og.has(e))return e;return async(t,r)=>{if(r?.redirect==="error"||r?.redirect==="manual")return e(t,r);let o=(r?.method??"GET").toUpperCase(),s=t;for(let n=0;;n++){let i=await e(s,{...r,redirect:"manual"}),a=qg(s,i);if(!a||n===kz)return i;let c=new URL(s),l=o==="GET"||i.status===307||i.status===308,d=!(a.username||a.password)||a.username===c.username&&a.password===c.password;if(!l||!d||!Pz(c,a))return i;await i.text?.().catch(()=>{}),s=a}}}function jg(e,t){if(t.type==="opaqueredirect")return"Redirect not followed: this runtime does not expose where it points";let r=qg(t.url||e,t);if(!r)return;if(r.username=r.password=r.search=r.hash="",r.protocol==="http:"&&new URL(t.url||e).protocol==="https:")return r.protocol="https:",`Redirect from https to plain http not followed; try ${r.href} as the endpoint`;return`Redirect to ${r.href} not followed; use that URL as the endpoint if it is the intended server`}function ha(e,t){let r=typeof e;if(r!==typeof t)return!1;if(Array.isArray(e)){if(!Array.isArray(t))return!1;let o=e.length;if(o!==t.length)return!1;for(let s=0;s<o;s++)if(!ha(e[s],t[s]))return!1;return!0}if(r==="object"){if(!e||!t)return e===t;let o=Object.keys(e),s=Object.keys(t);if(o.length!==s.length)return!1;for(let n of o)if(!ha(e[n],t[n]))return!1;return!0}return e===t}function vt(e){return encodeURI(Tz(e))}function Tz(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}var Ez={prefixItems:!0,items:!0,allOf:!0,anyOf:!0,oneOf:!0},$z={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependentSchemas:!0},Cz={id:!0,$id:!0,$ref:!0,$schema:!0,$anchor:!0,$vocabulary:!0,$comment:!0,default:!0,enum:!0,const:!0,required:!0,type:!0,maximum:!0,minimum:!0,exclusiveMaximum:!0,exclusiveMinimum:!0,multipleOf:!0,maxLength:!0,minLength:!0,pattern:!0,format:!0,maxItems:!0,minItems:!0,uniqueItems:!0,maxProperties:!0,minProperties:!0},Iz=typeof self<"u"&&self.location&&self.location.origin!=="null"?new URL(self.location.origin+self.location.pathname+location.search):new URL("https://github.com/cfworker");function _o(e,t=Object.create(null),r=Iz,o=""){if(e&&typeof e==="object"&&!Array.isArray(e)){let n=e.$id||e.id;if(n){let i=new URL(n,r.href);if(i.hash.length>1)t[i.href]=e;else if(i.hash="",o==="")r=i;else _o(e,t,r)}}else if(e!==!0&&e!==!1)return t;let s=r.href+(o?"#"+o:"");if(t[s]!==void 0)throw Error(`Duplicate schema URI "${s}".`);if(t[s]=e,e===!0||e===!1)return t;if(e.__absolute_uri__===void 0)Object.defineProperty(e,"__absolute_uri__",{enumerable:!1,value:s});if(e.$ref&&e.__absolute_ref__===void 0){let n=new URL(e.$ref,r.href);n.hash=n.hash,Object.defineProperty(e,"__absolute_ref__",{enumerable:!1,value:n.href})}if(e.$recursiveRef&&e.__absolute_recursive_ref__===void 0){let n=new URL(e.$recursiveRef,r.href);n.hash=n.hash,Object.defineProperty(e,"__absolute_recursive_ref__",{enumerable:!1,value:n.href})}if(e.$anchor){let n=new URL("#"+e.$anchor,r.href);t[n.href]=e}for(let n in e){if(Cz[n])continue;let i=`${o}/${vt(n)}`,a=e[n];if(Array.isArray(a)){if(Ez[n]){let c=a.length;for(let l=0;l<c;l++)_o(a[l],t,r,`${i}/${l}`)}}else if($z[n])for(let c in a)_o(a[c],t,r,`${i}/${vt(c)}`);else _o(a,t,r,i)}return t}var qz=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,Oz=[0,31,28,31,30,31,30,31,31,30,31,30,31],Nz=/^(\d\d):(\d\d):(\d\d)(\.\d+)?(z|[+-]\d\d(?::?\d\d)?)?$/i,jz=/^(?=.{1,253}\.?$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*\.?$/i,Mz=/^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,Az=/^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i,Lz=/^(?:(?:https?|ftp):\/\/)(?:\S+(?::\S*)?@)?(?:(?!10(?:\.\d{1,3}){3})(?!127(?:\.\d{1,3}){3})(?!169\.254(?:\.\d{1,3}){2})(?!192\.168(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z\u{00a1}-\u{ffff}0-9]+-?)*[a-z\u{00a1}-\u{ffff}0-9]+)(?:\.(?:[a-z\u{00a1}-\u{ffff}0-9]+-?)*[a-z\u{00a1}-\u{ffff}0-9]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu,Uz=/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,Dz=/^(?:\/(?:[^~/]|~0|~1)*)*$/,Zz=/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,Hz=/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,Fz=(e)=>{if(e[0]==='"')return!1;let[t,r,...o]=e.split("@");if(!t||!r||o.length!==0||t.length>64||r.length>253)return!1;if(t[0]==="."||t.endsWith(".")||t.includes(".."))return!1;if(!/^[a-z0-9.-]+$/i.test(r)||!/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+$/i.test(t))return!1;return r.split(".").every((s)=>/^[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?$/i.test(s))},Vz=/^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/,Bz=/^((([0-9a-f]{1,4}:){7}([0-9a-f]{1,4}|:))|(([0-9a-f]{1,4}:){6}(:[0-9a-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){5}(((:[0-9a-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){4}(((:[0-9a-f]{1,4}){1,3})|((:[0-9a-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){3}(((:[0-9a-f]{1,4}){1,4})|((:[0-9a-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){2}(((:[0-9a-f]{1,4}){1,5})|((:[0-9a-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){1}(((:[0-9a-f]{1,4}){1,6})|((:[0-9a-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9a-f]{1,4}){1,7})|((:[0-9a-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))$/i,Jz=(e)=>e.length>1&&e.length<80&&(/^P\d+([.,]\d+)?W$/.test(e)||/^P[\dYMDTHS]*(\d[.,]\d+)?[YMDHS]$/.test(e)&&/^P([.,\d]+Y)?([.,\d]+M)?([.,\d]+D)?(T([.,\d]+H)?([.,\d]+M)?([.,\d]+S)?)?$/.test(e));function At(e){return e.test.bind(e)}var Mg={date:Ag,time:Lg.bind(void 0,!1),"date-time":Gz,duration:Jz,uri:Qz,"uri-reference":At(Mz),"uri-template":At(Az),url:At(Lz),email:Fz,hostname:At(jz),ipv4:At(Vz),ipv6:At(Bz),regex:tR,uuid:At(Uz),"json-pointer":At(Dz),"json-pointer-uri-fragment":At(Zz),"relative-json-pointer":At(Hz)};function Wz(e){return e%4===0&&(e%100!==0||e%400===0)}function Ag(e){let t=e.match(qz);if(!t)return!1;let r=+t[1],o=+t[2],s=+t[3];return o>=1&&o<=12&&s>=1&&s<=(o==2&&Wz(r)?29:Oz[o])}function Lg(e,t){let r=t.match(Nz);if(!r)return!1;let o=+r[1],s=+r[2],n=+r[3],i=!!r[5];return(o<=23&&s<=59&&n<=59||o==23&&s==59&&n==60)&&(!e||i)}var Kz=/t|\s/i;function Gz(e){let t=e.split(Kz);return t.length==2&&Ag(t[0])&&Lg(!0,t[1])}var Yz=/\/|:/,Xz=/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)(?:\?(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i;function Qz(e){return Yz.test(e)&&Xz.test(e)}var eR=/[^\\]\\Z/;function tR(e){if(eR.test(e))return!1;try{return new RegExp(e,"u"),!0}catch(t){return!1}}function rR(e){let t=0,r=e.length,o=0,s;while(o<r)if(t++,s=e.charCodeAt(o++),s>=55296&&s<=56319&&o<r){if(s=e.charCodeAt(o),(s&64512)==56320)o++}return t}function be(e,t,r="2019-09",o=_o(t),s=!0,n=null,i="#",a="#",c=Object.create(null)){if(t===!0)return{valid:!0,errors:[]};if(t===!1)return{valid:!1,errors:[{instanceLocation:i,keyword:"false",keywordLocation:i,error:"False boolean schema."}]};let l=typeof e,d;switch(l){case"boolean":case"number":case"string":d=l;break;case"object":if(e===null)d="null";else if(Array.isArray(e))d="array";else d="object";break;default:throw Error(`Instances of "${l}" type are not supported.`)}let{$ref:f,$recursiveRef:h,$recursiveAnchor:g,type:v,const:_,enum:y,required:T,not:O,anyOf:k,allOf:P,oneOf:z,if:R,then:Z,else:ee,format:X,properties:ne,patternProperties:xe,additionalProperties:te,unevaluatedProperties:ie,minProperties:re,maxProperties:de,propertyNames:wt,dependentRequired:Fe,dependentSchemas:nt,dependencies:zt,prefixItems:Ge,items:Le,additionalItems:Zt,unevaluatedItems:Ht,contains:Rt,minContains:Ne,maxContains:Ue,minItems:De,maxItems:pt,uniqueItems:Ir,minimum:Ye,maximum:Xe,exclusiveMinimum:Ve,exclusiveMaximum:it,multipleOf:at,minLength:xt,maxLength:kt,pattern:sr,__absolute_ref__:Pt,__absolute_recursive_ref__:qr}=t,j=[];if(g===!0&&n===null)n=t;if(h==="#"){let B=n===null?o[qr]:n,U=`${a}/$recursiveRef`,Q=be(e,n===null?t:n,r,o,s,B,i,U,c);if(!Q.valid)j.push({instanceLocation:i,keyword:"$recursiveRef",keywordLocation:U,error:"A subschema had errors."},...Q.errors)}if(f!==void 0){let B=o[Pt||f];if(B===void 0){let M=`Unresolved $ref "${f}".`;if(Pt&&Pt!==f)M+=` Absolute URI "${Pt}".`;throw M+=`
70
70
  Known schemas:
71
71
  - ${Object.keys(o).join(`
72
- - `)}`,Error(j)}let U=`${a}/$ref`,Q=Se(e,B,r,o,s,n,i,U,c);if(!Q.valid)N.push({instanceLocation:i,keyword:"$ref",keywordLocation:U,error:"A subschema had errors."},...Q.errors);if(r==="4"||r==="7")return{valid:N.length===0,errors:N}}if(Array.isArray(b)){let B=b.length,U=!1;for(let Q=0;Q<B;Q++)if(d===b[Q]||b[Q]==="integer"&&d==="number"&&e%1===0&&e===e){U=!0;break}if(!U)N.push({instanceLocation:i,keyword:"type",keywordLocation:`${a}/type`,error:`Instance type "${d}" is invalid. Expected "${b.join('", "')}".`})}else if(b==="integer"){if(d!=="number"||e%1||e!==e)N.push({instanceLocation:i,keyword:"type",keywordLocation:`${a}/type`,error:`Instance type "${d}" is invalid. Expected "${b}".`})}else if(b!==void 0&&d!==b)N.push({instanceLocation:i,keyword:"type",keywordLocation:`${a}/type`,error:`Instance type "${d}" is invalid. Expected "${b}".`});if(_!==void 0){if(d==="object"||d==="array"){if(!la(e,_))N.push({instanceLocation:i,keyword:"const",keywordLocation:`${a}/const`,error:`Instance does not match ${JSON.stringify(_)}.`})}else if(e!==_)N.push({instanceLocation:i,keyword:"const",keywordLocation:`${a}/const`,error:`Instance does not match ${JSON.stringify(_)}.`})}if(w!==void 0){if(d==="object"||d==="array"){if(!w.some((B)=>la(e,B)))N.push({instanceLocation:i,keyword:"enum",keywordLocation:`${a}/enum`,error:`Instance does not match any of ${JSON.stringify(w)}.`})}else if(!w.some((B)=>e===B))N.push({instanceLocation:i,keyword:"enum",keywordLocation:`${a}/enum`,error:`Instance does not match any of ${JSON.stringify(w)}.`})}if(A!==void 0){let B=`${a}/not`;if(Se(e,A,r,o,s,n,i,B).valid)N.push({instanceLocation:i,keyword:"not",keywordLocation:B,error:'Instance matched "not" schema.'})}let kt=[];if(z!==void 0){let B=`${a}/anyOf`,U=N.length,Q=!1;for(let j=0;j<z.length;j++){let O=z[j],K=Object.create(c),J=Se(e,O,r,o,s,g===!0?n:null,i,`${B}/${j}`,K);if(N.push(...J.errors),Q=Q||J.valid,J.valid)kt.push(K)}if(Q)N.length=U;else N.splice(U,0,{instanceLocation:i,keyword:"anyOf",keywordLocation:B,error:"Instance does not match any subschemas."})}if(q!==void 0){let B=`${a}/allOf`,U=N.length,Q=!0;for(let j=0;j<q.length;j++){let O=q[j],K=Object.create(c),J=Se(e,O,r,o,s,g===!0?n:null,i,`${B}/${j}`,K);if(N.push(...J.errors),Q=Q&&J.valid,J.valid)kt.push(K)}if(Q)N.length=U;else N.splice(U,0,{instanceLocation:i,keyword:"allOf",keywordLocation:B,error:"Instance does not match every subschema."})}if(x!==void 0){let B=`${a}/oneOf`,U=N.length,Q=x.filter((j,O)=>{let K=Object.create(c),J=Se(e,j,r,o,s,g===!0?n:null,i,`${B}/${O}`,K);if(N.push(...J.errors),J.valid)kt.push(K);return J.valid}).length;if(Q===1)N.length=U;else N.splice(U,0,{instanceLocation:i,keyword:"oneOf",keywordLocation:B,error:`Instance does not match exactly one subschema (${Q} matches).`})}if(d==="object"||d==="array")Object.assign(c,...kt);if(R!==void 0){let B=`${a}/if`;if(Se(e,R,r,o,s,n,i,B,c).valid){if(Z!==void 0){let U=Se(e,Z,r,o,s,n,i,`${a}/then`,c);if(!U.valid)N.push({instanceLocation:i,keyword:"if",keywordLocation:B,error:'Instance does not match "then" schema.'},...U.errors)}}else if(ee!==void 0){let U=Se(e,ee,r,o,s,n,i,`${a}/else`,c);if(!U.valid)N.push({instanceLocation:i,keyword:"if",keywordLocation:B,error:'Instance does not match "else" schema.'},...U.errors)}}if(d==="object"){if(I!==void 0){for(let j of I)if(!(j in e))N.push({instanceLocation:i,keyword:"required",keywordLocation:`${a}/required`,error:`Instance does not have required property "${j}".`})}let B=Object.keys(e);if(re!==void 0&&B.length<re)N.push({instanceLocation:i,keyword:"minProperties",keywordLocation:`${a}/minProperties`,error:`Instance does not have at least ${re} properties.`});if(de!==void 0&&B.length>de)N.push({instanceLocation:i,keyword:"maxProperties",keywordLocation:`${a}/maxProperties`,error:`Instance does not have at least ${de} properties.`});if(bt!==void 0){let j=`${a}/propertyNames`;for(let O in e){let K=`${i}/${St(O)}`,J=Se(O,bt,r,o,s,n,K,j);if(!J.valid)N.push({instanceLocation:i,keyword:"propertyNames",keywordLocation:j,error:`Property name "${O}" does not match schema.`},...J.errors)}}if(Fe!==void 0){let j=`${a}/dependantRequired`;for(let O in Fe)if(O in e){let K=Fe[O];for(let J of K)if(!(J in e))N.push({instanceLocation:i,keyword:"dependentRequired",keywordLocation:j,error:`Instance has "${O}" but does not have "${J}".`})}}if(st!==void 0)for(let j in st){let O=`${a}/dependentSchemas`;if(j in e){let K=Se(e,st[j],r,o,s,n,i,`${O}/${St(j)}`,c);if(!K.valid)N.push({instanceLocation:i,keyword:"dependentSchemas",keywordLocation:O,error:`Instance has "${j}" but does not match dependant schema.`},...K.errors)}}if(yt!==void 0){let j=`${a}/dependencies`;for(let O in yt)if(O in e){let K=yt[O];if(Array.isArray(K)){for(let J of K)if(!(J in e))N.push({instanceLocation:i,keyword:"dependencies",keywordLocation:j,error:`Instance has "${O}" but does not have "${J}".`})}else{let J=Se(e,K,r,o,s,n,i,`${j}/${St(O)}`);if(!J.valid)N.push({instanceLocation:i,keyword:"dependencies",keywordLocation:j,error:`Instance has "${O}" but does not match dependant schema.`},...J.errors)}}}let U=Object.create(null),Q=!1;if(ne!==void 0){let j=`${a}/properties`;for(let O in ne){if(!(O in e))continue;let K=`${i}/${St(O)}`,J=Se(e[O],ne[O],r,o,s,n,K,`${j}/${St(O)}`);if(J.valid)c[O]=U[O]=!0;else if(Q=s,N.push({instanceLocation:i,keyword:"properties",keywordLocation:j,error:`Property "${O}" does not match schema.`},...J.errors),Q)break}}if(!Q&&xe!==void 0){let j=`${a}/patternProperties`;for(let O in xe){let K=new RegExp(O,"u"),J=xe[O];for(let ke in e){if(!K.test(ke))continue;let qr=`${i}/${St(ke)}`,Pt=Se(e[ke],J,r,o,s,n,qr,`${j}/${St(O)}`);if(Pt.valid)c[ke]=U[ke]=!0;else Q=s,N.push({instanceLocation:i,keyword:"patternProperties",keywordLocation:j,error:`Property "${ke}" matches pattern "${O}" but does not match associated schema.`},...Pt.errors)}}}if(!Q&&te!==void 0){let j=`${a}/additionalProperties`;for(let O in e){if(U[O])continue;let K=`${i}/${St(O)}`,J=Se(e[O],te,r,o,s,n,K,j);if(J.valid)c[O]=!0;else Q=s,N.push({instanceLocation:i,keyword:"additionalProperties",keywordLocation:j,error:`Property "${O}" does not match additional properties schema.`},...J.errors)}}else if(!Q&&ie!==void 0){let j=`${a}/unevaluatedProperties`;for(let O in e)if(!c[O]){let K=`${i}/${St(O)}`,J=Se(e[O],ie,r,o,s,n,K,j);if(J.valid)c[O]=!0;else N.push({instanceLocation:i,keyword:"unevaluatedProperties",keywordLocation:j,error:`Property "${O}" does not match unevaluated properties schema.`},...J.errors)}}}else if(d==="array"){if(dt!==void 0&&e.length>dt)N.push({instanceLocation:i,keyword:"maxItems",keywordLocation:`${a}/maxItems`,error:`Array has too many items (${e.length} > ${dt}).`});if(De!==void 0&&e.length<De)N.push({instanceLocation:i,keyword:"minItems",keywordLocation:`${a}/minItems`,error:`Array has too few items (${e.length} < ${De}).`});let B=e.length,U=0,Q=!1;if(Ge!==void 0){let j=`${a}/prefixItems`,O=Math.min(Ge.length,B);for(;U<O;U++){let K=Se(e[U],Ge[U],r,o,s,n,`${i}/${U}`,`${j}/${U}`);if(c[U]=!0,!K.valid){if(Q=s,N.push({instanceLocation:i,keyword:"prefixItems",keywordLocation:j,error:"Items did not match schema."},...K.errors),Q)break}}}if(Le!==void 0){let j=`${a}/items`;if(Array.isArray(Le)){let O=Math.min(Le.length,B);for(;U<O;U++){let K=Se(e[U],Le[U],r,o,s,n,`${i}/${U}`,`${j}/${U}`);if(c[U]=!0,!K.valid){if(Q=s,N.push({instanceLocation:i,keyword:"items",keywordLocation:j,error:"Items did not match schema."},...K.errors),Q)break}}}else for(;U<B;U++){let O=Se(e[U],Le,r,o,s,n,`${i}/${U}`,j);if(c[U]=!0,!O.valid){if(Q=s,N.push({instanceLocation:i,keyword:"items",keywordLocation:j,error:"Items did not match schema."},...O.errors),Q)break}}if(!Q&&Dt!==void 0){let O=`${a}/additionalItems`;for(;U<B;U++){let K=Se(e[U],Dt,r,o,s,n,`${i}/${U}`,O);if(c[U]=!0,!K.valid)Q=s,N.push({instanceLocation:i,keyword:"additionalItems",keywordLocation:O,error:"Items did not match additional items schema."},...K.errors)}}}if(wt!==void 0)if(B===0&&Ne===void 0)N.push({instanceLocation:i,keyword:"contains",keywordLocation:`${a}/contains`,error:"Array is empty. It must contain at least one item matching the schema."});else if(Ne!==void 0&&B<Ne)N.push({instanceLocation:i,keyword:"minContains",keywordLocation:`${a}/minContains`,error:`Array has less items (${B}) than minContains (${Ne}).`});else{let j=`${a}/contains`,O=N.length,K=0;for(let J=0;J<B;J++){let ke=Se(e[J],wt,r,o,s,n,`${i}/${J}`,j);if(ke.valid)c[J]=!0,K++;else N.push(...ke.errors)}if(K>=(Ne||0))N.length=O;if(Ne===void 0&&Ue===void 0&&K===0)N.splice(O,0,{instanceLocation:i,keyword:"contains",keywordLocation:j,error:"Array does not contain item matching schema."});else if(Ne!==void 0&&K<Ne)N.push({instanceLocation:i,keyword:"minContains",keywordLocation:`${a}/minContains`,error:`Array must contain at least ${Ne} items matching schema. Only ${K} items were found.`});else if(Ue!==void 0&&K>Ue)N.push({instanceLocation:i,keyword:"maxContains",keywordLocation:`${a}/maxContains`,error:`Array may contain at most ${Ue} items matching schema. ${K} items were found.`})}if(!Q&&Zt!==void 0){let j=`${a}/unevaluatedItems`;for(;U<B;U++){if(c[U])continue;let O=Se(e[U],Zt,r,o,s,n,`${i}/${U}`,j);if(c[U]=!0,!O.valid)N.push({instanceLocation:i,keyword:"unevaluatedItems",keywordLocation:j,error:"Items did not match unevaluated items schema."},...O.errors)}}if(Cr)for(let j=0;j<B;j++){let O=e[j],K=typeof O==="object"&&O!==null;for(let J=0;J<B;J++){if(j===J)continue;let ke=e[J];if(O===ke||K&&typeof ke==="object"&&ke!==null&&la(O,ke))N.push({instanceLocation:i,keyword:"uniqueItems",keywordLocation:`${a}/uniqueItems`,error:`Duplicate items at indexes ${j} and ${J}.`}),j=Number.MAX_SAFE_INTEGER,J=Number.MAX_SAFE_INTEGER}}}else if(d==="number"){if(r==="4"){if(Ye!==void 0&&(Ve===!0&&e<=Ye||e<Ye))N.push({instanceLocation:i,keyword:"minimum",keywordLocation:`${a}/minimum`,error:`${e} is less than ${Ve?"or equal to ":""} ${Ye}.`});if(Xe!==void 0&&(nt===!0&&e>=Xe||e>Xe))N.push({instanceLocation:i,keyword:"maximum",keywordLocation:`${a}/maximum`,error:`${e} is greater than ${nt?"or equal to ":""} ${Xe}.`})}else{if(Ye!==void 0&&e<Ye)N.push({instanceLocation:i,keyword:"minimum",keywordLocation:`${a}/minimum`,error:`${e} is less than ${Ye}.`});if(Xe!==void 0&&e>Xe)N.push({instanceLocation:i,keyword:"maximum",keywordLocation:`${a}/maximum`,error:`${e} is greater than ${Xe}.`});if(Ve!==void 0&&e<=Ve)N.push({instanceLocation:i,keyword:"exclusiveMinimum",keywordLocation:`${a}/exclusiveMinimum`,error:`${e} is less than ${Ve}.`});if(nt!==void 0&&e>=nt)N.push({instanceLocation:i,keyword:"exclusiveMaximum",keywordLocation:`${a}/exclusiveMaximum`,error:`${e} is greater than or equal to ${nt}.`})}if(it!==void 0){let B=e%it;if(Math.abs(0-B)>=0.00000011920929&&Math.abs(it-B)>=0.00000011920929)N.push({instanceLocation:i,keyword:"multipleOf",keywordLocation:`${a}/multipleOf`,error:`${e} is not a multiple of ${it}.`})}}else if(d==="string"){let B=zt===void 0&&Rt===void 0?0:Wz(e);if(zt!==void 0&&B<zt)N.push({instanceLocation:i,keyword:"minLength",keywordLocation:`${a}/minLength`,error:`String is too short (${B} < ${zt}).`});if(Rt!==void 0&&B>Rt)N.push({instanceLocation:i,keyword:"maxLength",keywordLocation:`${a}/maxLength`,error:`String is too long (${B} > ${Rt}).`});if(or!==void 0&&!new RegExp(or,"u").test(e))N.push({instanceLocation:i,keyword:"pattern",keywordLocation:`${a}/pattern`,error:"String does not match pattern."});if(X!==void 0&&Ig[X]&&!Ig[X](e))N.push({instanceLocation:i,keyword:"format",keywordLocation:`${a}/format`,error:`String does not match format "${X}".`})}return{valid:N.length===0,errors:N}}var Kz=class{schema;draft;shortCircuit;lookup;constructor(e,t="2019-09",r=!0){this.schema=e,this.draft=t,this.shortCircuit=r,this.lookup=fo(e)}validate(e){return Se(e,this.schema,this.draft,this.lookup,this.shortCircuit)}addSchema(e,t){if(t)e={...e,$id:t};fo(e,this.lookup)}},Kc=class{shortcircuit;draft;constructor(e){this.shortcircuit=e?.shortcircuit??!0,this.draft=e?.draft}_draftFor(e){let t=zm(e,"pass an explicit { draft } to CfWorkerJsonSchemaValidator to validate other dialects.");return t==="draft-7"?"7":t}getValidator(e){let t=new Kz(e,this.draft??this._draftFor(e),this.shortcircuit);return(r)=>{let o=t.validate(r);return o.valid?{valid:!0,data:r,errorMessage:void 0}:{valid:!1,data:void 0,errorMessage:o.errors.map((s)=>`${s.instanceLocation}: ${s.error}`).join("; ")}}}};var Ng=!0;var pd;pd=globalThis.crypto;async function Gz(e){return(await pd).getRandomValues(new Uint8Array(e))}async function Yz(e){let r=Math.pow(2,8)-Math.pow(2,8)%66,o="";while(o.length<e){let s=await Gz(e-o.length);for(let n of s)if(n<r)o+="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-._~"[n%66]}return o}async function Xz(e){return await Yz(e)}async function Qz(e){let t=await(await pd).subtle.digest("SHA-256",new TextEncoder().encode(e));return btoa(String.fromCharCode(...new Uint8Array(t))).replace(/\//g,"_").replace(/\+/g,"-").replace(/=/g,"")}async function hd(e){if(!e)e=43;if(e<43||e>128)throw`Expected a length between 43 and 128. Received ${e}.`;let t=await Xz(e),r=await Qz(t);return{code_verifier:t,code_challenge:r}}var vs=class extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.OAuthClientFlowError"})}static[Symbol.hasInstance](e){return We(this,e)}static isInstance(e){if(typeof this!=="function")throw TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return We(this,e)}constructor(e){super(e);this.name=new.target.name,vr(this,new.target)}},Qc=class extends vs{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.IssuerMismatchError"})}kind;expected;received;constructor(e,t,r){super(`Issuer mismatch in ${e==="metadata"?"authorization server metadata (RFC 8414 §3.3)":"authorization response (RFC 9207)"}: expected ${JSON.stringify(t)}, received ${JSON.stringify(r)}`);this.kind=e,this.expected=t,this.received=r}},Vg=class extends vs{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.RegistrationRejectedError"})}status;body;submittedMetadata;constructor(e){super(`Dynamic Client Registration rejected (HTTP ${e.status}): ${e.body}`);this.status=e.status,this.body=e.body,this.submittedMetadata=e.submittedMetadata}},Rd=class extends vs{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.InsecureTokenEndpointError"})}tokenEndpoint;constructor(e){super(`Refusing to send credentials to non-https token endpoint '${e}'. OAuth token requests MUST use TLS (localhost / *.localhost / 127.0.0.1 / ::1 are exempt).`);this.tokenEndpoint=e}},da=class extends vs{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.AuthorizationServerMismatchError"})}constructor(e,t){super(`Authorization server mismatch: credentials are bound to ${JSON.stringify(e)} but this call resolved ${JSON.stringify(t)}; refusing to present them to a different authorization server`);this.recordedIssuer=e,this.currentIssuer=t}},xd=class extends vs{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.InsufficientScopeError"})}requiredScope;resourceMetadataUrl;errorDescription;constructor(e){super(`Insufficient scope${e.requiredScope?`: required "${e.requiredScope}"`:""}`);this.requiredScope=e.requiredScope,this.resourceMetadataUrl=e.resourceMetadataUrl,this.errorDescription=e.errorDescription}};function yd(e,t,r){if(!e)return;if(typeof e.issuer!=="string"){if(r?.canPersistStamp!==!1)console.warn("[mcp-sdk] SEP-2352: stored OAuth credential has no 'issuer' stamp (pre-upgrade storage or provider not round-tripping the value). SEP-2352 isolation is inactive for this read; ensure your provider round-trips the issuer field.");return e.issuer===void 0?e:{...e,issuer:void 0}}return Bg(e.issuer,t)?e:void 0}function Bg(e,t){return e===t||e.endsWith("/")&&e.slice(0,-1)===t||t.endsWith("/")&&t.slice(0,-1)===e}function Jg(e){if(e==null)return!1;let t=e;return typeof t.tokens==="function"&&typeof t.clientInformation==="function"}async function eR(e,t,r){let{resourceMetadataUrl:o,scope:s}=bs(t.response);if(await ru(e,{serverUrl:t.serverUrl,resourceMetadataUrl:o,scope:s,fetchFn:t.fetchFn,...r})!=="AUTHORIZED")throw new vt}function Wg(e,t){return{token:async()=>(await e.tokens())?.access_token,onUnauthorized:async(r)=>eR(e,r,t)}}var vt=class extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.UnauthorizedError"})}static[Symbol.hasInstance](e){return We(this,e)}static isInstance(e){if(typeof this!=="function")throw TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return We(this,e)}constructor(e){super(e??"Unauthorized");this.name="UnauthorizedError",vr(this,new.target)}};function kd(e){return e?.authorization_response_iss_parameter_supported===!0}function eu({iss:e,expectedIssuer:t,issParameterSupported:r}){if(t===void 0)return;if(e===void 0){if(r)throw new Qc("authorization_response",t,void 0);return}if(e!==t)throw new Qc("authorization_response",t,e)}function tu(...e){let t=new Set;for(let r of e){if(!r)continue;for(let o of r.split(/\s+/))if(o)t.add(o)}return t.size>0?[...t].join(" "):void 0}function Kg(e,t){if(!e)return!1;let r=new Set((t??"").split(/\s+/).filter(Boolean));for(let o of e.split(/\s+/))if(o&&!r.has(o))return!0;return!1}async function Gg(e,t,r,o,s){if(typeof e==="string")return{authorizationCode:e,iss:t};let n=e.get("iss")??void 0,i=e.get("code");if(i)return{authorizationCode:i,iss:n};let a=(await r.discoveryState?.())?.authorizationServerMetadata;if(!a)try{a=(await Ed(o,s)).authorizationServerMetadata}catch{a=void 0}if(!a)throw new vt("Authorization callback failed and the issuer could not be verified");eu({iss:n,expectedIssuer:a.issuer,issParameterSupported:kd(a)});let c=e.get("error");if(c)throw new br(c,e.get("error_description")??c,e.get("error_uri")??void 0);throw new vt("Authorization callback contained neither `code` nor `error`")}function tR(e){return["client_secret_basic","client_secret_post","none"].includes(e)}var fd="code",_d="S256";function Yg(e,t){let r=e.client_secret!==void 0;if("token_endpoint_auth_method"in e&&e.token_endpoint_auth_method&&tR(e.token_endpoint_auth_method)&&(t.length===0||t.includes(e.token_endpoint_auth_method)))return e.token_endpoint_auth_method;if(t.length===0)return r?"client_secret_basic":"none";if(r&&t.includes("client_secret_basic"))return"client_secret_basic";if(r&&t.includes("client_secret_post"))return"client_secret_post";if(t.includes("none"))return"none";return r?"client_secret_post":"none"}function Xg(e,t,r,o){let{client_id:s,client_secret:n}=t;switch(e){case"client_secret_basic":rR(s,n,r);return;case"client_secret_post":oR(s,n,o);return;case"none":sR(s,o);return;default:throw Error(`Unsupported client authentication method: ${e}`)}}function rR(e,t,r){if(!t)throw Error("client_secret_basic authentication requires a client_secret");let o=btoa(`${e}:${t}`);r.set("Authorization",`Basic ${o}`)}function oR(e,t,r){if(r.set("client_id",e),t)r.set("client_secret",t)}function sR(e,t){t.set("client_id",e)}function Qg(e){return e==="localhost"||e.endsWith(".localhost")||e==="127.0.0.1"||e==="[::1]"||e==="::1"}function eS(e){let t=new URL(String(e));if(t.protocol!=="https:"&&!Qg(t.hostname))throw new Rd(t.href);return t}function nR(e){for(let t of e??[]){let r;try{r=new URL(t)}catch{continue}if(r.protocol!=="http:"&&r.protocol!=="https:")return"native";if(Qg(r.hostname))return"native"}return"web"}function tS(e){let t=e.clientMetadata;return{...t,grant_types:t.grant_types??(e.redirectUrl===void 0?void 0:["authorization_code","refresh_token"]),application_type:t.application_type??nR(t.redirect_uris)}}async function wd(e){let t=e instanceof Response?e.status:void 0,r=e instanceof Response?await e.text():e;try{let o=mo.parse(JSON.parse(r));return br.fromResponse(o)}catch(o){let s=`${t?`HTTP ${t}: `:""}Invalid OAuth error response: ${o}. Raw body: ${r}`;return new br(Ot.ServerError,s)}}function jg(e,t,r){let o=e.invalidateCredentials===void 0?`retrying authorization without discarding the stored ${r} (provider implements no invalidateCredentials())`:`invalidating the stored ${r} and retrying authorization`;console.warn(`[mcp-sdk] OAuth ${JSON.stringify(t.code)} — ${o}. Cause: ${JSON.stringify(t.message)}`)}async function ru(e,t){try{return await gd(e,t)}catch(r){if(r instanceof br){if(r.code===Ot.InvalidClient||r.code===Ot.UnauthorizedClient)return jg(e,r,"client credentials and tokens"),await e.invalidateCredentials?.("client"),await e.invalidateCredentials?.("tokens"),await gd(e,t);else if(r.code===Ot.InvalidGrant||r.code===Ot.InvalidDpopProof)return jg(e,r,"tokens"),await e.invalidateCredentials?.("tokens"),await gd(e,t)}throw r}}function iR(e){let{requestedScope:t,resourceMetadata:r,authServerMetadata:o,clientMetadata:s}=e,n=t||r?.scopes_supported?.join(" ")||s.scope;if(n&&o?.scopes_supported?.includes("offline_access")&&!n.split(" ").includes("offline_access")&&s.grant_types?.includes("refresh_token"))n=`${n} offline_access`;return n}async function gd(e,{serverUrl:t,authorizationCode:r,iss:o,scope:s,resourceMetadataUrl:n,fetchFn:i,skipIssuerMetadataValidation:a,forceReauthorization:c}){let l=tS(e),d=await e.discoveryState?.(),f,h,g,b,_=n;if(!_&&d?.resourceMetadataUrl)_=new URL(d.resourceMetadataUrl);if(d?.authorizationServerUrl){if(h=d.authorizationServerUrl,f=d.resourceMetadata,g=d.authorizationServerMetadata??await Td(h,{fetchFn:i,skipIssuerValidation:a}),!f)try{f=await Pd(t,{resourceMetadataUrl:_},i)}catch(te){if(te instanceof TypeError)throw te}if(g!==d.authorizationServerMetadata||f!==d.resourceMetadata)await e.saveDiscoveryState?.({authorizationServerUrl:String(h),resourceMetadataUrl:_?.toString(),resourceMetadata:f,authorizationServerMetadata:g})}else{let te=await Ed(t,{resourceMetadataUrl:_,fetchFn:i,skipIssuerMetadataValidation:a});h=te.authorizationServerUrl,g=te.authorizationServerMetadata,f=te.resourceMetadata,b={authorizationServerUrl:String(h),resourceMetadataUrl:_?.toString(),resourceMetadata:f,authorizationServerMetadata:g}}let w=g?.issuer??String(h),I={issuer:w};if(await e.saveAuthorizationServerUrl?.(w),r!==void 0){let te=d?.authorizationServerMetadata?.issuer??d?.authorizationServerUrl;if(te===void 0){if(e.saveDiscoveryState!==void 0)throw new da("discoveryState was not available on the callback leg; ensure your provider persists discoveryState alongside codeVerifier",w);console.warn("[mcp-sdk] OAuthClientProvider does not implement saveDiscoveryState()/discoveryState(); the SEP-2352 callback-leg authorization-server binding cannot be checked. Implement discoveryState (persist alongside codeVerifier) — see docs/migration/upgrade-to-v2.md §SEP-2352.")}else if(!Bg(te,w))throw new da(te,w)}if(b)await e.saveDiscoveryState?.(b);let A=await oS(t,e,f),z=A&&f&&!e.validateResourceURL?f.resource:A;if(z)await e.saveResourceUrl?.($d(z));let q=iR({requestedScope:s,resourceMetadata:f,authServerMetadata:g,clientMetadata:e.clientMetadata}),x=await Promise.resolve(e.clientInformation(I)),R=yd(x,w,{canPersistStamp:e.saveClientInformation!==void 0});if(R===void 0&&x?.issuer&&e.saveClientInformation===void 0)throw new da(x.issuer,w);if(R&&R.issuer===void 0)R={...R,issuer:w},await e.saveClientInformation?.(R,I);if(!R){if(r!==void 0)throw Error("Existing OAuth client information is required when exchanging an authorization code");let te=g?.client_id_metadata_document_supported===!0,ie=e.clientMetadataUrl;if(ie&&!rS(ie))throw new br(Ot.InvalidClientMetadata,`clientMetadataUrl must be a valid HTTPS URL with a non-root pathname, got: ${ie}`);if(te&&ie)R={client_id:ie,issuer:w},await e.saveClientInformation?.(R,I);else{if(!e.saveClientInformation)throw Error("OAuth client information must be saveable for dynamic registration");R={...await dS(h,{metadata:g,clientMetadata:l,scope:q,fetchFn:i}),issuer:w},await e.saveClientInformation(R,I)}}let Z=!e.redirectUrl;if(r!==void 0||Z){if(r!==void 0)eu({iss:o,expectedIssuer:g?.issuer,issParameterSupported:kd(g)});let te=await lS(e,h,{metadata:g,resource:z,authorizationCode:r,iss:o,scope:q,fetchFn:i});return await e.saveTokens({...te,issuer:w},I),"AUTHORIZED"}let ee=yd(await e.tokens(I),w);if(ee&&ee.issuer===void 0)ee={...ee,issuer:w},await e.saveTokens(ee,I);if(ee?.refresh_token&&!c){let te=await e.scopeForRefresh?.(ee),ie;try{ie=await uS(h,{metadata:g,clientInformation:R,refreshToken:ee.refresh_token,scope:te,resource:z,addClientAuthentication:e.addClientAuthentication,dpop:await e.dpop?.(),fetchFn:i})}catch(re){if(re instanceof Rd)throw re;if(!(re instanceof br)||re.code===Ot.ServerError)console.warn(`[mcp-sdk] Could not refresh OAuth tokens; falling back to a new authorization request. Cause: ${JSON.stringify(re instanceof Error?re.message:String(re))}`);else throw re}if(ie)return await e.saveTokens({...ie,issuer:w},I),"AUTHORIZED"}let X=e.state?await e.state():void 0,{authorizationUrl:ne,codeVerifier:xe}=await iS(h,{metadata:g,clientInformation:R,state:X,redirectUrl:e.redirectUrl,scope:q,resource:z});return await e.saveCodeVerifier(xe),await e.redirectToAuthorization(ne),"REDIRECT"}function rS(e){if(!e)return!1;try{let t=new URL(e);return t.protocol==="https:"&&t.pathname!=="/"}catch{return!1}}async function oS(e,t,r){let o=Yl(e);if(t.validateResourceURL)return await t.validateResourceURL(o,r?.resource);if(!r)return;if(!Xl({requestedResource:o,configuredResource:r.resource}))throw Error(`Protected resource ${r.resource} does not match expected ${o} (or origin)`);return new URL(r.resource)}var aR=new Set(["bearer","dpop"]);function bs(e){let t=e.headers.get("WWW-Authenticate");if(!t)return{};let[r,o]=t.split(" ");if(!r||!aR.has(r.toLowerCase())||!o)return{};let s=Gc(e,"resource_metadata")||void 0,n;if(s)try{n=new URL(s)}catch{}let i=Gc(e,"scope")||void 0,a=Gc(e,"error")||void 0,c=Gc(e,"error_description")||void 0;return{resourceMetadataUrl:n,scope:i,error:a,errorDescription:c}}function Gc(e,t){let r=e.headers.get("WWW-Authenticate");if(!r)return null;let o=new RegExp(String.raw`${t}=(?:"([^"]+)"|([^\s,]+))`),s=r.match(o);if(s){let n=s[1]||s[2];if(n)return n}return null}async function Pd(e,t,r=fetch){let o=await lR(e,"oauth-protected-resource",r,{protocolVersion:t?.protocolVersion,metadataUrl:t?.resourceMetadataUrl});if(!o||o.status===404)throw await o?.text?.().catch(()=>{}),Error("Resource server does not implement OAuth 2.0 Protected Resource Metadata.");if(!o.ok)throw await o.text?.().catch(()=>{}),Error(`HTTP ${o.status} trying to load well-known OAuth protected resource metadata.`);return hs.parse(await o.json())}async function sS(e,t,r=fetch){let o=Ss(r);try{return await o(e,{headers:t})}catch(s){if(!(s instanceof TypeError)||!Ng)throw s;if(t)try{return await o(e,{})}catch(n){if(!(n instanceof TypeError))throw n;return}return}}function cR(e,t="",r={}){if(t.endsWith("/"))t=t.slice(0,-1);return r.prependPathname?`${t}/.well-known/${e}`:`/.well-known/${e}${t}`}async function Mg(e,t,r=fetch){return await sS(e,{"MCP-Protocol-Version":t},r)}function uR(e,t){if(!e)return!0;if(t==="/")return!1;return!e.ok&&e.status<500||e.status===502}async function lR(e,t,r,o){let s=new URL(e),n=o?.protocolVersion??Wr,i;if(o?.metadataUrl)i=new URL(o.metadataUrl);else{let c=cR(t,s.pathname);i=new URL(c,o?.metadataServerUrl??s),i.search=s.search}let a=await Mg(i,n,r);if(!o?.metadataUrl&&uR(a,s.pathname))a=await Mg(new URL(`/.well-known/${t}`,s),n,r);return a}function nS(e){let t=typeof e==="string"?new URL(e):e,r=t.pathname!=="/",o=[];if(!r)return o.push({url:new URL("/.well-known/oauth-authorization-server",t.origin),type:"oauth"},{url:new URL("/.well-known/openid-configuration",t.origin),type:"oidc"}),o;let s=t.pathname;if(s.endsWith("/"))s=s.slice(0,-1);return o.push({url:new URL(`/.well-known/oauth-authorization-server${s}`,t.origin),type:"oauth"},{url:new URL(`/.well-known/openid-configuration${s}`,t.origin),type:"oidc"},{url:new URL(`${s}/.well-known/openid-configuration`,t.origin),type:"oidc"}),o}async function Td(e,{fetchFn:t=fetch,protocolVersion:r=Wr,skipIssuerValidation:o=!1}={}){let s={"MCP-Protocol-Version":r,Accept:"application/json"},n=nS(e);for(let{url:i,type:a}of n){let c=await sS(i,s,t);if(!c)continue;if(!c.ok){if(await c.text?.().catch(()=>{}),c.status<500||c.status===502)continue;throw Error(`HTTP ${c.status} trying to load ${a==="oauth"?"OAuth":"OpenID provider"} metadata from ${i}`)}let l=a==="oauth"?uo.parse(await c.json()):fs.parse(await c.json());if(!o){let d=typeof e==="string"?e:e.href;if(!(l.issuer===d||d.endsWith("/")&&l.issuer===d.slice(0,-1)))throw new Qc("metadata",d,l.issuer)}return l}}async function Ed(e,t){let r,o;try{if(r=await Pd(e,{resourceMetadataUrl:t?.resourceMetadataUrl},t?.fetchFn),r.authorization_servers&&r.authorization_servers.length>0)o=r.authorization_servers[0]}catch(n){if(n instanceof TypeError)throw n}if(!o)o=String(new URL("/",e));let s=await Td(o,{fetchFn:t?.fetchFn,skipIssuerValidation:t?.skipIssuerMetadataValidation});return{authorizationServerUrl:o,authorizationServerMetadata:s,resourceMetadata:r}}function $d(e){return typeof e==="string"?e:e.href}async function iS(e,{metadata:t,clientInformation:r,redirectUrl:o,scope:s,state:n,resource:i}){let a;if(t){if(a=new URL(t.authorization_endpoint),!t.response_types_supported.includes(fd))throw Error(`Incompatible auth server: does not support response type ${fd}`);if(t.code_challenge_methods_supported&&!t.code_challenge_methods_supported.includes(_d))throw Error(`Incompatible auth server: does not support code challenge method ${_d}`)}else a=new URL("/authorize",e);let c=await hd(),{code_verifier:l,code_challenge:d}=c;if(a.searchParams.set("response_type",fd),a.searchParams.set("client_id",r.client_id),a.searchParams.set("code_challenge",d),a.searchParams.set("code_challenge_method",_d),a.searchParams.set("redirect_uri",String(o)),n)a.searchParams.set("state",n);if(s)a.searchParams.set("scope",s);if(s?.split(" ").includes("offline_access"))a.searchParams.append("prompt","consent");if(i)a.searchParams.set("resource",$d(i));return{authorizationUrl:a,codeVerifier:l}}function aS(e,t,r){return new URLSearchParams({grant_type:"authorization_code",code:e,code_verifier:t,redirect_uri:String(r)})}async function cS(e,{metadata:t,tokenRequestParams:r,clientInformation:o,addClientAuthentication:s,resource:n,dpop:i,fetchFn:a}){let c=eS(t?.token_endpoint??new URL("/token",e)),l=new Headers({"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"});if(n)r.set("resource",$d(n));if(!s&&o)Xg(Yg(o,t?.token_endpoint_auth_methods_supported??[]),o,l,r);let d=async()=>{let g=new Headers(l);if(s)await s(g,r,c,t);if(i)g.set("DPoP",await i.buildProof({htm:"POST",htu:c}));return Ss(a??fetch)(c,{method:"POST",headers:g,body:r})},f=await d();if(i&&f.status===400){if((await f.clone().json().catch(()=>{}))?.error===Ot.UseDpopNonce)i.observeNonce(f,c),f=await d()}if(i?.observeNonce(f,c),!f.ok)throw await wd(f);let h=await f.json();try{return lo.parse(Bc(h))}catch(g){if(typeof h==="object"&&h!==null&&"error"in h)throw await wd(JSON.stringify(h));throw g}}async function uS(e,{metadata:t,clientInformation:r,refreshToken:o,scope:s,resource:n,addClientAuthentication:i,dpop:a,fetchFn:c}){let l=new URLSearchParams({grant_type:"refresh_token",refresh_token:o});if(s)l.set("scope",s);let d=await cS(e,{metadata:t,tokenRequestParams:l,clientInformation:r,addClientAuthentication:i,resource:n,dpop:a,fetchFn:c});return{refresh_token:o,...d,...s&&!d.scope&&{scope:s}}}async function lS(e,t,{metadata:r,resource:o,authorizationCode:s,iss:n,scope:i,fetchFn:a}={}){if(s!==void 0)eu({iss:n,expectedIssuer:r?.issuer,issParameterSupported:kd(r)});let c=r?.issuer??String(t),l=async()=>{let g=await e.clientInformation({issuer:c}),b=yd(g,c,{canPersistStamp:!1});if(g&&b===void 0)throw new da(String(g.issuer),c);return b},d=await l(),f=i??e.clientMetadata.scope,h;if(e.prepareTokenRequest)h=await e.prepareTokenRequest(f);if(!h){if(!s)throw Error("Either provider.prepareTokenRequest() or authorizationCode is required");if(!e.redirectUrl)throw Error("redirectUrl is required for authorization_code flow");h=aS(s,await e.codeVerifier(),e.redirectUrl)}return d??=await l(),cS(t,{metadata:r,tokenRequestParams:h,clientInformation:d,addClientAuthentication:e.addClientAuthentication,resource:o,dpop:await e.dpop?.(),fetchFn:a})}async function dS(e,{metadata:t,clientMetadata:r,scope:o,fetchFn:s}){let n;if(t){if(!t.registration_endpoint)throw Error("Incompatible auth server: does not support dynamic client registration");n=new URL(t.registration_endpoint)}else n=new URL("/register",e);let i={...r,...o===void 0?{}:{scope:o}},a=await Ss(s??fetch)(n,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(i)});if(!a.ok)throw new Vg({status:a.status,body:await a.text(),submittedMetadata:i});return _s.parse(Bc(await a.json()))}var Yc=new Set(["tools/list","prompts/list","resources/list","resources/templates/list","server/discover"]),mS=class{_entries=new Map;_maxEntries;_stamp=0;_cappedSize=0;constructor(e){this._maxEntries=e?.maxEntries??512}get size(){return this._entries.size}get(e){return this._entries.get(Sd(e))}set(e,t){let r=Sd(e),o=Yc.has(e.method),s=!this._entries.has(r);if(!o&&s&&this._maxEntries>0&&this._cappedSize>=this._maxEntries){for(let i of this._entries.keys())if(!Yc.has(i.slice(0,i.indexOf("\x00")))){this._entries.delete(i),this._cappedSize--;break}}let n=++this._stamp;if(this._entries.set(r,{...t,stamp:n}),s&&!o)this._cappedSize++;return n}delete(e){if(this._entries.delete(Sd(e))&&!Yc.has(e.method))this._cappedSize--}evict(e){let t=`${e}\x00`,r=Yc.has(e);for(let o of this._entries.keys())if(o.startsWith(t)){if(this._entries.delete(o),!r)this._cappedSize--}}clear(){this._entries.clear(),this._cappedSize=0}};function Sd(e){return`${e.method}\x00${JSON.stringify([e.partition??"",e.params??""])}`}function vd(e,t){return t===void 0?e:`${e}\x00${t}`}var pS=86400000,dR=class{_evictionGeneration=new Map;_toolIndex;_toolOutputValidatorIndex;_serverIdentity="";constructor(e,t,r=()=>{},o="",s=Date.now){this._store=e,this._isUserSupplied=t,this._reportError=r,this._cachePartition=o,this._now=s}now(){return this._now()}setServerIdentity(e){this._serverIdentity=e}_partitionFor(e){return JSON.stringify([this._serverIdentity,e==="public"?"":this._cachePartition])}async _probe(e,t){let r={method:e,params:t??""},o=this._partitionFor("private"),s=await this._store.get({...r,partition:o});if(s!==void 0)return s;let n=this._partitionFor("public");if(n===o)return;let i=await this._store.get({...r,partition:n});return i?.scope==="public"?i:void 0}async evict(e){this._evictionGeneration.set(e,(this._evictionGeneration.get(e)??0)+1),await this._deleteBoth(e,"")}async _deleteBoth(e,t){let r=this._partitionFor("private"),o=this._partitionFor("public");try{await this._store.delete({method:e,params:t,partition:r})}catch(s){this._reportError(s)}if(o!==r)try{await this._store.delete({method:e,params:t,partition:o})}catch(s){this._reportError(s)}}async evictKey(e,t){let r=vd(e,t),o=this._evictionGeneration.get(r);if(o!==void 0)this._evictionGeneration.set(r,o+1);await this._deleteBoth(e,t)}captureGeneration(e,t){let r=vd(e,t),o=this._evictionGeneration.get(r)??0;return this._evictionGeneration.set(r,o),o}async write(e,t,r,o){if((this._evictionGeneration.get(vd(e,o?.params))??0)!==r)return;let s=o?.params??"",n=this._partitionFor("private"),i=this._partitionFor("public"),a=(o?.scope??"private")==="public"?i:n;try{await this._store.set({method:e,params:s,partition:a},{value:mR(t),expiresAt:o?.expiresAt,scope:o?.scope})}catch(c){this._reportError(c)}if(i!==n)try{await this._store.delete({method:e,params:s,partition:a===n?i:n})}catch(c){this._reportError(c)}}async read(e,t){let r=await this._probe(e,t);if(r?.expiresAt===void 0||!(r.expiresAt>this.now()))return;try{let o=JSON.parse(r.value);if(typeof o!=="object"||o===null||Array.isArray(o))throw TypeError("cached document is not an object");return{value:o}}catch(o){this._reportError(o),await this._deleteBoth(e,t??"");return}}resetForReconnect(){if(!this._isUserSupplied)this._store.clear();this._evictionGeneration.clear(),this._toolIndex=void 0,this._toolOutputValidatorIndex=void 0,this._serverIdentity=""}async toolDefinition(e){let t=await this._probe("tools/list");if(t===void 0){this._toolIndex=void 0;return}if(this._toolIndex?.stamp!==t.stamp){let r=this._decodeListTools(t),o=new Map;if(r!==void 0)for(let s of r.tools)o.set(s.name,s);this._toolIndex={stamp:t.stamp,byName:o}}return this._toolIndex.byName.get(e)}async outputValidator(e,t){let r=await this._probe("tools/list");if(r===void 0){this._toolOutputValidatorIndex=void 0;return}if(this._toolOutputValidatorIndex?.stamp!==r.stamp){let o=this._decodeListTools(r)??{tools:[]},s=new Map;for(let n of o.tools){let i=t(n);if(i!==void 0)s.set(n.name,i)}this._toolOutputValidatorIndex={stamp:r.stamp,byName:s}}return this._toolOutputValidatorIndex.byName.get(e)}_decodeListTools(e){try{let t=JSON.parse(e.value);if(!Array.isArray(t?.tools)||!t.tools.every((r)=>r!==null&&typeof r==="object"))throw TypeError("cached tools/list document has a malformed tools array");return t}catch(t){this._reportError(t);return}}};function mR(e){let t;try{t=JSON.stringify(e)}catch(r){throw TypeError(`cache value is not JSON-serializable: ${r instanceof Error?r.message:String(r)}`)}if(typeof t!=="string")throw TypeError("cache value is not JSON-serializable: it has no JSON representation");return t}var hS=Symbol.for("mcp.authSeamEscape");function rt(e){if(typeof e==="object"&&e!==null||typeof e==="function")try{Object.defineProperty(e,hS,{value:!0,configurable:!0})}catch{}return e}function pR(e){return(typeof e==="object"&&e!==null||typeof e==="function")&&e[hS]===!0}var hR=-32022,fR=new Set([-32001,-32020,-32021]);function _R(e,t){switch(e.kind){case"result":return gR(e.result,t);case"rpc-error":return fS(e,t);case"http-error":return SR(e,t);case"network-error":return Ag(e.error,t);case"unusable-reply":return{kind:"error",error:new L(M.EraNegotiationFailed,`Version negotiation probe failed: the server answered with an unusable reply (${_S(e.error)})`,{cause:e.error},{cause:e.error})};case"auth-required":return{kind:"error",error:e.error};case"closed":if(t.transportKind==="stdio")return{kind:"legacy"};return Ag(Error("Connection closed during the version negotiation probe"),t);case"timeout":if(t.transportKind==="stdio")return{kind:"legacy"};return{kind:"error",error:new L(M.RequestTimeout,`Version negotiation probe timed out after ${e.timeoutMs}ms`,{timeout:e.timeoutMs})}}}function gR(e,t){let r=Xt(Jc).validateResult("server/discover",e);if(!r.ok)return{kind:"legacy"};let o=r.value.supportedVersions,s=t.clientModernVersions.find((n)=>o.includes(n));if(s!==void 0)return{kind:"modern",version:s,discover:r.value};if(t.fallbackAvailable)return{kind:"legacy"};return{kind:"error",error:new aa({supported:[...o],requested:t.requestedVersion})}}function fS(e,t){let{code:r,message:o,data:s}=e;if(r===hR){let n=bR(s);if(n===void 0)return{kind:"legacy"};let i=new aa({supported:n,requested:yR(s)??t.requestedVersion},o),a=ia(n),c=t.clientModernVersions.find((l)=>a.includes(l));if(c!==void 0)return{kind:"corrective",version:c,error:i};if(a.length>0)return{kind:"error",error:i};return t.fallbackAvailable?{kind:"legacy"}:{kind:"error",error:i}}if(fR.has(r))return{kind:"legacy"};return{kind:"legacy"}}function SR(e,t){if(e.status===401||e.status===403){let o=e.status===403;return{kind:"error",error:new gt(o?M.ClientHttpForbidden:M.ClientHttpAuthentication,`Version negotiation failed: ${o?"the server denied access (HTTP 403)":"the server requires authorization (HTTP 401)"}`,{status:e.status,statusText:e.statusText,text:e.body})}}if(e.status>=500)return{kind:"error",error:new gt(M.EraNegotiationFailed,`Version negotiation failed: the server answered the probe with HTTP ${e.status}`,{status:e.status,statusText:e.statusText,text:e.body})};let r=wR(e.body);if(r!==void 0)return fS(r,t);return{kind:"legacy"}}function Ag(e,t){if(t.environment==="browser"&&vR(e))return{kind:"legacy"};return{kind:"error",error:new L(M.EraNegotiationFailed,`Version negotiation probe failed: ${_S(e)}`,{cause:e},{cause:e})}}function vR(e){return e instanceof TypeError||e instanceof Error&&e.name==="TypeError"}function _S(e){return e instanceof Error?e.message:String(e)}function bR(e){if(typeof e!=="object"||e===null)return;let t=e.supported;if(!Array.isArray(t)||t.length===0||!t.every((r)=>typeof r==="string"))return;return t}function yR(e){if(typeof e!=="object"||e===null)return;let t=e.requested;return typeof t==="string"?t:void 0}function wR(e){if(e===void 0||e==="")return;let t;try{t=JSON.parse(e)}catch{return}if(typeof t!=="object"||t===null)return;let r=t.error;if(typeof r!=="object"||r===null)return;let{code:o,message:s,data:n}=r;if(typeof o!=="number")return;return{code:o,message:typeof s==="string"?s:"",data:n}}var zR="legacy";function RR(e,t){let r=e?.mode??zR;if(r==="legacy")return{kind:"legacy"};let o=e?.probe??{};if(typeof r==="object"){if(!Nt(r.pin))throw TypeError(`versionNegotiation: { pin: '${r.pin}' } is not a modern protocol revision — pinning is for 2026-07-28 and later; omit versionNegotiation (or use mode: 'legacy') for 2025-era servers.`);return{kind:"pin",version:r.pin,probe:o}}let s=t?ia(t):[];return{kind:"auto",modernVersions:s.length>0?s:[...Ql],fallbackAvailable:t?ed(t).length>0:!0,probe:o}}function Lg(){let e=globalThis;return e.window!==void 0&&e.document!==void 0?"browser":"node"}function Ug(e){return"stderr"in e&&"pid"in e?"stdio":"http"}var xR=class e{_pending;_probeCounter=0;_savedOnMessage;_savedOnError;_savedOnClose;_closeDelivered=!1;constructor(t){this._transport=t,this._savedOnMessage=t.onmessage,this._savedOnError=t.onerror,this._savedOnClose=t.onclose}static async open(t){let r=new e(t);t.onmessage=(o)=>{let s=r._pending;if(s!==void 0&&(po(o)||ho(o))&&o.id===s.id){if(r._pending=void 0,po(o))s.resolve({kind:"response",result:o.result});else s.resolve({kind:"response",error:o.error});return}},t.onerror=(o)=>{r._savedOnError?.(o)},t.onclose=()=>{let o=r._pending;if(o!==void 0)r._pending=void 0,o.resolve({kind:"closed"});r._closeDelivered=!0,r._savedOnClose?.()};try{await t.start()}catch(o){throw r.detach(),o}return r}async exchange(t,r){let o=`server-discover-probe-${++this._probeCounter}`;return new Promise((s)=>{let n=!1,i=(c)=>{if(n)return;if(n=!0,clearTimeout(a),this._pending?.id===o)this._pending=void 0;s(c)},a=setTimeout(()=>i({kind:"timeout"}),r);this._pending={id:o,resolve:i},this._transport.send(t(o)).catch((c)=>i({kind:"send-error",error:c}))})}detach(){if(this._pending=void 0,this._transport.onmessage=this._savedOnMessage,this._transport.onerror=this._savedOnError,this._closeDelivered&&this._savedOnClose!==void 0){let t=this._savedOnClose,r=this._transport,o=!1,s=()=>{if(!o){o=!0;return}t()};r.onclose=s,zd.set(r,()=>{if(r.onclose===s)r.onclose=t})}else this._transport.onclose=this._savedOnClose}release(){this.detach();let t=this._transport,r=t.start,o=!0;t.start=async function(){if(o){o=!1,t.start=r;return}return r.call(t)}}},zd=new WeakMap;function Dg(e){let t=zd.get(e);zd.delete(e),t?.()}function kR(e,t,r,o){return{jsonrpc:"2.0",id:e,method:"server/discover",params:{_meta:Xt(t).outboundEnvelope({protocolVersion:t,clientInfo:r,clientCapabilities:o})}}}function PR(e){if(e instanceof L&&e.code===M.ClientHttpUnexpectedContent)return!0;return e instanceof Error&&e.name==="SyntaxError"}function TR(e,t){switch(e.kind){case"response":return e.error===void 0?{kind:"result",result:e.result}:{kind:"rpc-error",...e.error};case"send-error":{let r=e.error;if(pR(r)||r instanceof vt||r instanceof Error&&r.name==="UnauthorizedError")return{kind:"auth-required",error:r};if(r instanceof gt){let o=r.data?.text;return{kind:"http-error",status:r.data.status,body:typeof o==="string"?o:void 0,statusText:r.data.statusText}}if(PR(r))return{kind:"unusable-reply",error:r};return{kind:"network-error",error:r}}case"closed":return{kind:"closed"};case"timeout":return{kind:"timeout",timeoutMs:t}}}async function gS(e,t){let r=e.probe.timeoutMs??t.defaultTimeoutMs,o=Math.max(0,e.probe.maxRetries??0),s=e.kind==="pin"?[e.version]:e.modernVersions,n=e.kind==="auto"&&e.fallbackAvailable,i=await xR.open(t.transport),a=async()=>{let l=s[0],d=!1,f=o;for(;;){let h=await i.exchange((_)=>kR(_,l,t.clientInfo,t.capabilities),r);if(h.kind==="timeout"&&f>0){f--;continue}let g=TR(h,r),b=_R(g,{clientModernVersions:s,requestedVersion:l,fallbackAvailable:n,environment:t.environment,transportKind:t.transportKind});switch(b.kind){case"modern":return{era:"modern",version:b.version,discover:b.discover};case"corrective":if(d)throw b.error;d=!0,l=b.version;continue;case"legacy":{let _=g.kind==="closed"?"the connection closed during the server/discover probe":void 0;if(e.kind==="pin")throw new L(M.EraNegotiationFailed,_===void 0?`Version negotiation failed: the server did not offer pinned protocol version ${e.version} via server/discover (no fallback in pin mode)`:`Version negotiation failed: ${_} before the server offered pinned protocol version ${e.version} (no fallback in pin mode)`);if(!e.fallbackAvailable)throw new L(M.EraNegotiationFailed,_===void 0?"Version negotiation failed: the server gave no modern evidence and this client supports no pre-2026-07-28 protocol version to fall back to":`Version negotiation failed: ${_} and this client supports no pre-2026-07-28 protocol version to fall back to`);if(_!==void 0&&t.disposableProbe!==!0)throw new L(M.EraNegotiationFailed,`Version negotiation failed: ${_} (this transport probed in place — the disposable sibling probe requires the SDK's base StdioClientTransport)`);return{era:"legacy"}}case"error":throw b.error}}},c;try{c=await a()}catch(l){throw i.detach(),l}return i.release(),c}function ER(e){let t=Object.getPrototypeOf(e);if(t===null||!Object.prototype.hasOwnProperty.call(t,"_dispose"))return;let r=e._serverParams;return typeof r==="object"&&r!==null&&typeof r.command==="string"?r:void 0}async function $R(e,t,r,o){let n=new t.constructor({...r,stderr:"ignore"}),i=t.close,a=!1,c,l=new Promise((f,h)=>{c=()=>h(Zg())});t.close=async function(){return a=!0,c?.(),i.call(t)};let d;try{let f=gS(e,{...o,transport:n,transportKind:"stdio",disposableProbe:!0});f.catch(()=>{}),d=await Promise.race([f,l])}finally{await CR(n),t.close=i}if(a)throw Zg();return d}function Zg(){return new L(M.EraNegotiationFailed,"Version negotiation failed: the transport was closed during the server/discover probe")}async function CR(e){try{let t=e._dispose;await(typeof t==="function"?t.call(e):e.close())}catch{}}function Hg(e){let t=e._meta?.[$t];return ld.Implementation(t)?t:void 0}function Xc(e,t){if(!e||t===null||typeof t!=="object")return;if(e.type==="object"&&e.properties&&typeof e.properties==="object"){let r=t,o=e.properties;for(let s of Object.keys(o)){let n=o[s];if(r[s]===void 0&&Object.prototype.hasOwnProperty.call(n,"default"))r[s]=n.default;if(r[s]!==void 0)Xc(n,r[s])}}if(Array.isArray(e.anyOf)){for(let r of e.anyOf)if(typeof r!=="boolean")Xc(r,t)}if(Array.isArray(e.oneOf)){for(let r of e.oneOf)if(typeof r!=="boolean")Xc(r,t)}}function SS(e){if(!e)return{supportsFormMode:!1,supportsUrlMode:!1};let t=e.form!==void 0,r=e.url!==void 0;return{supportsFormMode:t||!t&&!r,supportsUrlMode:r}}function IR(e){if(typeof e==="object"&&e!==null){if(e.kind==="legacy"&&!("supportedVersions"in e)&&!("discover"in e))return e;if(e.kind==="modern"&&fr.safeParse(e.discover).success)return e}throw new L(M.EraNegotiationFailed,"connect({ prior }): unrecognized prior — expected { kind: 'modern', discover } or { kind: 'legacy' }")}var Fg={"notifications/tools/list_changed":["tools/list"],"notifications/prompts/list_changed":["prompts/list"],"notifications/resources/list_changed":["resources/list","resources/templates/list"]},qR=64,bd={},Cd=class extends ua{_serverCapabilities;_serverVersion;_capabilities;_instructions;_jsonSchemaValidator;_cache;_defaultCacheTtlMs;_listMaxPages;_listChangedDebounceTimers=new Map;_listChangedConfig;_enforceStrictCapabilities;_versionNegotiation;_supportedProtocolVersionsOption;_inputRequiredDriverConfig;_listenState=new Map;_nextListenId=0;_autoOpenedSubscription;_discoverResult;static{bd.enforceStrictCapabilities=(e)=>e._enforceStrictCapabilities,bd.walkPages=(e,t,r,o)=>e._walkPages(t,r,o),bd.readResource=(e,t,r)=>e._readResource(t,r)}_resetConnectionState(){if(this._negotiatedProtocolVersion=void 0,this._serverCapabilities=void 0,this._serverVersion=void 0,this._instructions=void 0,this._discoverResult=void 0,this._autoOpenedSubscription=void 0,this._listenState.size>0){let e=new L(M.ConnectionClosed,"subscriptions/listen: client reconnected or closed; subscription state from the previous connection was reset");for(let t of this._listenState.values())t.settle({cause:"remote",error:e})}this._listenState.clear();for(let e of this._listChangedDebounceTimers.values())clearTimeout(e);this._listChangedDebounceTimers.clear(),this._cache.resetForReconnect()}async close(){try{await super.close()}finally{this._resetConnectionState()}}constructor(e,t){super(t);if(this._clientInfo=e,this._capabilities=t?.capabilities?{...t.capabilities}:{},this._jsonSchemaValidator=t?.jsonSchemaValidator??new Kc,this._enforceStrictCapabilities=t?.enforceStrictCapabilities??!1,this._versionNegotiation=t?.versionNegotiation,this._supportedProtocolVersionsOption=t?.supportedProtocolVersions,this._inputRequiredDriverConfig=yg(t?.inputRequired),this._cache=new dR(t?.responseCacheStore??new mS,t?.responseCacheStore!==void 0,(r)=>this._reportStoreError(r),t?.cachePartition??""),this._defaultCacheTtlMs=t?.defaultCacheTtlMs??0,this._listMaxPages=t?.listMaxPages??qR,t?.listChanged)this._listChangedConfig=t.listChanged}buildContext(e,t){return e}_shouldDropInbound(e){if(this._negotiatedProtocolVersion!==void 0&&Nt(this._negotiatedProtocolVersion)&&yr(e))return"drop"}_outboundMetaEnvelope(){let e=this._negotiatedProtocolVersion;if(e===void 0)return;return this._wireCodec().outboundEnvelope({protocolVersion:e,clientInfo:this._clientInfo,clientCapabilities:this._capabilities})}_resolveNonCompleteResult(e,t){if(!this._inputRequiredDriverConfig.autoFulfill)return Promise.reject(new L(M.UnsupportedResultType,`Unsupported result type 'input_required' for ${t.request.method}: multi-round-trip auto-fulfilment is not enabled on this instance — pass allowInputRequired: true to handle it manually, or enable inputRequired.autoFulfill`,{resultType:"input_required",method:t.request.method}));return xg({getRequestHandler:(r)=>this._getRequestHandler(r),buildContext:(r)=>this.buildContext(r,void 0),sessionId:this.transport?.sessionId},this._inputRequiredDriverConfig,e,t)}_setupListChangedHandlers(e){if(e.tools&&this._serverCapabilities?.tools?.listChanged)this._setupListChangedHandler("tools","notifications/tools/list_changed",e.tools,async()=>(await this.listTools(void 0,{cacheMode:"refresh"})).tools);if(e.prompts&&this._serverCapabilities?.prompts?.listChanged)this._setupListChangedHandler("prompts","notifications/prompts/list_changed",e.prompts,async()=>(await this.listPrompts(void 0,{cacheMode:"refresh"})).prompts);if(e.resources&&this._serverCapabilities?.resources?.listChanged)this._setupListChangedHandler("resources","notifications/resources/list_changed",e.resources,async()=>(await this.listResources(void 0,{cacheMode:"refresh"})).resources)}registerCapabilities(e){if(this.transport)throw Error("Cannot register capabilities after connecting to transport");this._capabilities=md(this._capabilities,e)}setVersionNegotiation(e){if(this.transport)throw Error("Cannot configure version negotiation after connecting to transport");this._versionNegotiation=e}_wrapHandler(e,t){if(e==="elicitation/create")return async(r,o)=>{let s=Xt(this._negotiatedProtocolVersion),n=s.validateRequest("elicitation/create",r);if(!n.ok&&n.reason==="not-in-era")n=s.validateInputRequest("elicitation/create",r);if(!n.ok)throw new se(n.reason==="not-in-era"?W.InternalError:W.InvalidParams,n.reason==="not-in-era"?"No wire schema for elicitation/create in the resolved era":`Invalid elicitation request: ${n.message}`);let{params:i}=n.value;i.mode=i.mode??"form";let{supportsFormMode:a,supportsUrlMode:c}=SS(this._capabilities.elicitation);if(i.mode==="form"&&!a)throw new se(W.InvalidParams,"Client does not support form-mode elicitation requests");if(i.mode==="url"&&!c)throw new se(W.InvalidParams,"Client does not support URL-mode elicitation requests");let l=await t(r,o),d=s.validateResult("elicitation/create",l);if(!d.ok&&d.reason==="not-in-era")d=s.validateInputResponse("elicitation/create",l);if(!d.ok)throw new se(d.reason==="not-in-era"?W.InternalError:W.InvalidParams,d.reason==="not-in-era"?"No wire schema for elicitation/create in the resolved era":`Invalid elicitation result: ${d.message}`);let f=d.value,h=i.mode==="form"?i.requestedSchema:void 0;if(i.mode==="form"&&f.action==="accept"&&f.content&&h&&this._capabilities.elicitation?.form?.applyDefaults)try{Xc(h,f.content)}catch{}return f};if(e==="sampling/createMessage")return async(r,o)=>{let s=Xt(this._negotiatedProtocolVersion),n=s.validateRequest("sampling/createMessage",r);if(!n.ok&&n.reason==="not-in-era")n=s.validateInputRequest("sampling/createMessage",r);if(!n.ok)throw new se(n.reason==="not-in-era"?W.InternalError:W.InvalidParams,n.reason==="not-in-era"?"No wire schema for sampling/createMessage in the resolved era":`Invalid sampling request: ${n.message}`);let{params:i}=n.value,a=await t(r,o),c=Boolean(i.tools||i.toolChoice),l=s.samplingResultVariant(c,a);if(!l.ok&&l.reason==="not-in-era")l=s.validateInputResponse("sampling/createMessage",a);if(!l.ok)throw new se(l.reason==="not-in-era"?W.InternalError:W.InvalidParams,l.reason==="not-in-era"?"No result schema for sampling/createMessage in the resolved era":`Invalid sampling result: ${l.message}`);return l.value};return t}assertCapability(e,t){if(!this._serverCapabilities?.[e])throw new L(M.CapabilityNotSupported,`Server does not support ${e} (required for ${t})`)}async connect(e,t){if(t?.prior!=null)return this._connectFromPrior(e,IR(t.prior),t);let r=RR(this._versionNegotiation,this._supportedProtocolVersionsOption);if(r.kind!=="legacy")return this._connectNegotiated(e,r,t);return this._connectPlainLegacy(e,t)}async _connectPlainLegacy(e,t){if(await super.connect(e),e.sessionId!==void 0){let r=this._negotiatedProtocolVersion;if(r!==void 0)e.setProtocolVersion?.(r);return}this._resetConnectionState(),await this._legacyHandshake(e,t)}async _legacyHandshake(e,t){let r=ed(this._supportedProtocolVersions);try{let o=r[0];if(o===void 0)throw new L(M.EraNegotiationFailed,"Cannot run the initialize handshake: supportedProtocolVersions contains no pre-2026-07-28 protocol version");let s=await this.request({method:"initialize",params:{protocolVersion:o,capabilities:this._capabilities,clientInfo:this._clientInfo}},t);if(s===void 0)throw Error(`Server sent invalid initialize result: ${s}`);if(!r.includes(s.protocolVersion))throw Error(`Server's protocol version is not supported: ${s.protocolVersion}`);if(this._serverCapabilities=s.capabilities,this._serverVersion=s.serverInfo,this._cache.setServerIdentity(this._deriveServerIdentity(e)),e.setProtocolVersion)e.setProtocolVersion(s.protocolVersion);if(this._instructions=s.instructions,await this.notification({method:"notifications/initialized"}),this._negotiatedProtocolVersion=s.protocolVersion,this._listChangedConfig)this._setupListChangedHandlers(this._listChangedConfig)}catch(o){throw this.close(),o}}async _connectNegotiated(e,t,r){if(e.sessionId!==void 0){await super.connect(e);let s=this._negotiatedProtocolVersion;if(s!==void 0&&e.setProtocolVersion)e.setProtocolVersion(s);return}this._resetConnectionState();let o;try{let s=Ug(e),n={clientInfo:this._clientInfo,capabilities:this._capabilities,environment:Lg(),defaultTimeoutMs:r?.timeout??ca},i=s==="stdio"?ER(e):void 0;o=i===void 0?await gS(t,{...n,transport:e,transportKind:s}):await $R(t,e,i,n)}catch(s){throw await e.close().catch(()=>{}),Dg(e),s}if(Dg(e),await super.connect(e),o.era==="legacy"){await this._legacyHandshake(e,r);return}if(this._serverCapabilities=o.discover.capabilities,this._serverVersion=Hg(o.discover),this._cache.setServerIdentity(this._deriveServerIdentity(e)),this._instructions=o.discover.instructions,this._discoverResult=o.discover,this._negotiatedProtocolVersion=o.version,e.setProtocolVersion)e.setProtocolVersion(o.version);if(this._listChangedConfig){let s=this._listChangedConfig,n=this._serverCapabilities,i={...s.tools&&n?.tools?.listChanged&&{tools:s.tools},...s.prompts&&n?.prompts?.listChanged&&{prompts:s.prompts},...s.resources&&n?.resources?.listChanged&&{resources:s.resources}},a=!0;try{this._setupListChangedHandlers(i)}catch(l){a=!1,this.onerror?.(l instanceof Error?l:Error(String(l)))}let c=a?{...i.tools&&{toolsListChanged:!0},...i.prompts&&{promptsListChanged:!0},...i.resources&&{resourcesListChanged:!0}}:{};if(Object.keys(c).length>0){let l=new AbortController,d=()=>l.abort(r?.signal?.reason);if(r?.signal?.aborted)d();r?.signal?.addEventListener("abort",d);try{this._autoOpenedSubscription=await this.listen(c,{timeout:r?.timeout,signal:l.signal})}catch(f){if(r?.signal?.aborted)throw await this.close().catch(()=>{}),f;this.onerror?.(f instanceof Error?f:Error(String(f)))}finally{r?.signal?.removeEventListener("abort",d)}}}}async _connectFromPrior(e,t,r){if(t.kind==="legacy")return this._connectPlainLegacy(e,r);let o=t.discover;this._resetConnectionState();let s=this._supportedProtocolVersionsOption,n=(s&&ia(s).length>0?ia(s):Ql).find((i)=>o.supportedVersions.includes(i));if(n===void 0)throw new L(M.EraNegotiationFailed,"connect({ prior }) with a modern verdict requires a 2026-07-28+ mutual protocol version; the supplied DiscoverResult and this client's supportedProtocolVersions have no modern overlap. For a server known to be legacy, pass prior: { kind: 'legacy' } to skip the probe and initialize directly, or use versionNegotiation: { mode: 'auto' } to re-probe with legacy fallback.");if(await super.connect(e),this._discoverResult=o,this._serverCapabilities=o.capabilities,this._serverVersion=Hg(o),this._cache.setServerIdentity(this._deriveServerIdentity(e)),this._instructions=o.instructions,this._negotiatedProtocolVersion=n,e.setProtocolVersion?.(n),this._listChangedConfig)try{this._setupListChangedHandlers(this._listChangedConfig)}catch(i){this.onerror?.(i instanceof Error?i:Error(String(i)))}}getServerCapabilities(){return this._serverCapabilities}getServerVersion(){return this._serverVersion}_deriveServerIdentity(e){let t=this._serverVersion;if(t!==void 0)return`${t.name}@${t.version}`;return e.sessionId??`anonymous:${Date.now()}-${Math.random().toString(36).slice(2)}`}getNegotiatedProtocolVersion(){return this._negotiatedProtocolVersion}getProtocolEra(){let e=this._negotiatedProtocolVersion;if(e===void 0)return;return Nt(e)?"modern":"legacy"}getInstructions(){return this._instructions}getDiscoverResult(){return this._discoverResult}assertCapabilityForMethod(e){switch(e){case"logging/setLevel":if(!this._serverCapabilities?.logging)throw new L(M.CapabilityNotSupported,`Server does not support logging (required for ${e})`);break;case"prompts/get":case"prompts/list":if(!this._serverCapabilities?.prompts)throw new L(M.CapabilityNotSupported,`Server does not support prompts (required for ${e})`);break;case"resources/list":case"resources/templates/list":case"resources/read":case"resources/subscribe":case"resources/unsubscribe":if(!this._serverCapabilities?.resources)throw new L(M.CapabilityNotSupported,`Server does not support resources (required for ${e})`);if(e==="resources/subscribe"&&!this._serverCapabilities.resources.subscribe)throw new L(M.CapabilityNotSupported,`Server does not support resource subscriptions (required for ${e})`);break;case"tools/call":case"tools/list":if(!this._serverCapabilities?.tools)throw new L(M.CapabilityNotSupported,`Server does not support tools (required for ${e})`);break;case"completion/complete":if(!this._serverCapabilities?.completions)throw new L(M.CapabilityNotSupported,`Server does not support completions (required for ${e})`);break;case"initialize":break;case"server/discover":break;case"ping":break}}assertNotificationCapability(e){switch(e){case"notifications/roots/list_changed":if(!this._capabilities.roots?.listChanged)throw new L(M.CapabilityNotSupported,`Client does not support roots list changed notifications (required for ${e})`);break;case"notifications/initialized":break;case"notifications/cancelled":break;case"notifications/progress":break}}assertRequestHandlerCapability(e){switch(e){case"sampling/createMessage":if(!this._capabilities.sampling)throw new L(M.CapabilityNotSupported,`Client does not support sampling capability (required for ${e})`);break;case"elicitation/create":if(!this._capabilities.elicitation)throw new L(M.CapabilityNotSupported,`Client does not support elicitation capability (required for ${e})`);break;case"roots/list":if(!this._capabilities.roots)throw new L(M.CapabilityNotSupported,`Client does not support roots capability (required for ${e})`);break;case"ping":break}}async ping(e){return this.request({method:"ping"},e)}async discover(e){let t=await this._requestWithSchema({method:"server/discover"},fr,e);return this._discoverResult=t,t}async complete(e,t){return this.request({method:"completion/complete",params:e},t)}async setLoggingLevel(e,t){return this.request({method:"logging/setLevel",params:{level:e}},t)}async getPrompt(e,t){return this.request({method:"prompts/get",params:e},t)}async listPrompts(e,t){if(!this._serverCapabilities?.prompts&&!this._enforceStrictCapabilities)return console.debug("Client.listPrompts() called but server does not advertise prompts capability - returning empty list"),{prompts:[]};if(e?.cursor!==void 0)return this.request({method:"prompts/list",params:e},t);let r=await this._serveFromCache("prompts/list",void 0,t);if(r!==void 0)return r;return this._listAllPages("prompts/list",e,t,(o)=>o.prompts)}async listResources(e,t){if(!this._serverCapabilities?.resources&&!this._enforceStrictCapabilities)return console.debug("Client.listResources() called but server does not advertise resources capability - returning empty list"),{resources:[]};if(e?.cursor!==void 0)return this.request({method:"resources/list",params:e},t);let r=await this._serveFromCache("resources/list",void 0,t);if(r!==void 0)return r;return this._listAllPages("resources/list",e,t,(o)=>o.resources)}async listResourceTemplates(e,t){if(!this._serverCapabilities?.resources&&!this._enforceStrictCapabilities)return console.debug("Client.listResourceTemplates() called but server does not advertise resources capability - returning empty list"),{resourceTemplates:[]};if(e?.cursor!==void 0)return this.request({method:"resources/templates/list",params:e},t);let r=await this._serveFromCache("resources/templates/list",void 0,t);if(r!==void 0)return r;return this._listAllPages("resources/templates/list",e,t,(o)=>o.resourceTemplates)}async _listAllPages(e,t,r,o,s){let n=r?.cacheMode==="bypass",i=this._cache.captureGeneration(e),a=(l)=>{let d=l===void 0?t&&{...t}:{...t,cursor:l};return this.request({method:e,...d&&{params:d}},r)},c=await this._walkPages(e,a,o);if(delete c.nextCursor,s?.(c),n)return c;return await this._cache.write(e,c,i,this._freshness(c)),c}async _walkPages(e,t,r){let o=await t(void 0),s=o.nextCursor,n=o,i=1;while(s!==void 0){if(this._listMaxPages!==0&&i>=this._listMaxPages)throw new L(M.ListPaginationExceeded,`${e}: exceeded listMaxPages (${this._listMaxPages}); server pagination did not terminate`,{method:e,listMaxPages:this._listMaxPages});let a=await t(s);if(a.nextCursor===s&&JSON.stringify(r(a))===JSON.stringify(r(n)))break;r(o).push(...r(a)),n=a,s=a.nextCursor,i++}return o}_freshness(e,t){let r=e,o=typeof r.ttlMs==="number"?r.ttlMs:this._defaultCacheTtlMs,s=r.cacheScope==="public"?"public":"private";return{expiresAt:this._cache.now()+Math.min(Math.max(0,o),pS),scope:s,params:t}}async _serveFromCache(e,t,r){if(r?.cacheMode==="bypass"||r?.cacheMode==="refresh")return;let o=await this._cache.read(e,t).catch((s)=>void this._reportStoreError(s));if(o!==void 0){if(r?.signal?.aborted){let s=r.signal.reason;throw s instanceof L?s:new L(M.RequestTimeout,String(s))}return o.value}}_reportStoreError(e){this.onerror?.(e instanceof Error?e:Error(String(e)))}_compileOutputValidator(e){if(!e.outputSchema)return;try{return{ok:!0,validator:this._jsonSchemaValidator.getValidator(e.outputSchema)}}catch(t){return{ok:!1,compileError:t}}}async _resolveXMcpHeaderScan(e,t){let r=t??await this._cache.toolDefinition(e);return r===void 0?void 0:ad(r.inputSchema)}async readResource(e,t){let{result:r}=await this._readResource(e,t);return r}async _readResource(e,t){let r=await this._serveFromCache("resources/read",e.uri,t);if(r!==void 0)return{result:r,cached:!0};let o=this._cache.captureGeneration("resources/read",e.uri),s=await this.request({method:"resources/read",params:e},t);if(t?.cacheMode!=="bypass"){let n=this._freshness(s,e.uri);if(n.expiresAt>this._cache.now())await this._cache.write("resources/read",s,o,n);else if(t?.cacheMode==="refresh")await this._cache.evictKey("resources/read",e.uri)}return{result:s,cached:!1}}async subscribeResource(e,t){return this.request({method:"resources/subscribe",params:e},t)}async unsubscribeResource(e,t){return this.request({method:"resources/unsubscribe",params:e},t)}async listen(e,t){if(this.transport===void 0)throw new L(M.NotConnected,"Not connected");let r=this._negotiatedProtocolVersion;if(r===void 0||!Nt(r))throw new L(M.MethodNotSupportedByProtocolVersion,`subscriptions/listen requires a 2026-07-28-era connection (negotiated: ${r??"none"}). On a 2025-era connection, change notifications are delivered unsolicited: use ClientOptions.listChanged and resources/subscribe instead.`,{method:"subscriptions/listen",protocolVersion:r});if(t?.signal?.aborted){let z=t.signal.reason;throw z instanceof L?z:new L(M.RequestTimeout,String(z))}let o=new AbortController,s=`listen:${this._nextListenId++}`,n="opening",i,a,c,l,d=new Promise((z,q)=>{c=z,l=q}),f,h=new Promise((z)=>{f=z}),g=(z)=>{if(n==="closed")return;let q=n==="opening";if(i!==void 0)clearTimeout(i),i=void 0;if("ack"in z){n="open",c(z.ack);return}if(n="closed",a!==void 0)t?.signal?.removeEventListener("abort",a);if(this._listenState.delete(s),o.abort(),f(z.cause),q)l(z.error??new L(M.ConnectionClosed,"subscriptions/listen closed before the server acknowledged"))},b=async()=>{o.abort(),await this.notification({method:"notifications/cancelled",params:{requestId:s}}).catch(()=>{})},_=async()=>{if(n==="closed")return;g({cause:"local"}),await b()};this._listenState.set(s,{settle:g});let w=t?.timeout??ca;if(i=setTimeout(()=>{g({cause:"remote",error:new L(M.RequestTimeout,"subscriptions/listen ack timed out",{timeout:w})}),b().catch(()=>{})},w),t?.signal){let z=t.signal;a=()=>{if(n==="closed")return;let q=z.reason;g({cause:"local",error:q instanceof Error?q:Error(String(q??"Aborted"))}),b().catch(()=>{})},z.addEventListener("abort",a,{once:!0})}let I={jsonrpc:"2.0",id:s,method:"subscriptions/listen",params:{_meta:{...this._outboundMetaEnvelope()},notifications:e}},A=(z)=>{g({cause:"remote",error:z instanceof Error?z:Error(String(z))})};try{this.transport.send(I,{requestSignal:o.signal,onRequestStreamEnd:()=>g({cause:"remote",error:Error("subscriptions/listen: stream ended")})}).catch(A)}catch(z){A(z)}return{honoredFilter:await d,close:_,closed:h}}get autoOpenedSubscription(){return this._autoOpenedSubscription}_onnotification(e,t){let r=Object.hasOwn(Fg,e.method)?Fg[e.method]:void 0;if(e.method==="notifications/resources/updated"){let o=e.params?.uri;if(typeof o==="string")this._cache.evictKey("resources/read",o)}else if(r!==void 0)for(let o of r)this._cache.evict(o);if(e.method==="notifications/subscriptions/acknowledged"){let o=e.params?._meta?.[Do],s=typeof o==="string"?this._listenState.get(o):void 0;if(s!==void 0){let n=this._wireCodec().validateNotification("notifications/subscriptions/acknowledged",e);s.settle({ack:n.ok?n.value.params.notifications:{}});return}}if(e.method==="notifications/cancelled"){let o=e.params?.requestId,s=typeof o==="string"?this._listenState.get(o):void 0;if(s!==void 0){s.settle({cause:"remote",error:Error("subscriptions/listen: server cancelled the subscription")});return}}super._onnotification(e,t)}_onresponse(e){let t=e.id,r=typeof t==="string"?this._listenState.get(t):void 0;if(r!==void 0){if(ho(e))r.settle({cause:"remote",error:se.fromError(e.error.code,e.error.message,e.error.data)});else r.settle({cause:"graceful",error:new L(M.ConnectionClosed,"subscriptions/listen: server closed the subscription gracefully before acknowledging")});return}super._onresponse(e)}_onclose(){if(this._listenState.size>0){let e=new L(M.ConnectionClosed,"Connection closed");for(let t of this._listenState.values())t.settle({cause:"remote",error:e});this._listenState.clear()}super._onclose()}async callTool(e,t){let r=this.getProtocolEra()==="modern"&&Lg()!=="browser",o=async()=>{if(!r)return t;let c;try{c=await this._resolveXMcpHeaderScan(e.name,t?.toolDefinition)}catch(d){this._reportStoreError(d)}if(!c?.valid||c.declarations.length===0)return t;let l=Sg(c.declarations,e.arguments);return Object.keys(l).length===0?t:{...t,headers:{...t?.headers,...l}}},s=t?.toolDefinition===void 0?await this._cache.outputValidator(e.name,(c)=>this._compileOutputValidator(c)).catch((c)=>void this._reportStoreError(c)):this._compileOutputValidator(t.toolDefinition),n=()=>{if(s===void 0||s.ok)return;let c=s.compileError,l=(c instanceof Error?c.message:String(c)).slice(0,200);throw new se(W.InvalidParams,`Tool '${e.name}' has an invalid outputSchema: ${l}`)};n();let i;try{i=await this.request({method:"tools/call",params:e},await o())}catch(c){let l=c instanceof se&&c.code===gs;if(!r||!l||t?.toolDefinition!==void 0)throw c;let d={signal:t?.signal,timeout:t?.timeout,cacheMode:"refresh"};await this._cache.evict("tools/list"),await this.listTools(void 0,d).catch((f)=>this._reportStoreError(f)),s=await this._cache.outputValidator(e.name,(f)=>this._compileOutputValidator(f)).catch((f)=>void this._reportStoreError(f)),n(),i=await this.request({method:"tools/call",params:e},await o())}let a=s!==void 0&&s.ok?s.validator:void 0;if(a){if(i.structuredContent===void 0&&!i.isError)throw new se(W.InvalidRequest,`Tool ${e.name} has an output schema but did not return structured content`);if(i.structuredContent!==void 0&&!i.isError)try{let c=a(i.structuredContent);if(!c.valid)throw new se(W.InvalidParams,`Structured content does not match the tool's output schema: ${c.errorMessage}`)}catch(c){if(c instanceof se)throw c;throw new se(W.InvalidParams,`Failed to validate structured content: ${c instanceof Error?c.message:String(c)}`)}}return i}async listTools(e,t){if(!this._serverCapabilities?.tools&&!this._enforceStrictCapabilities)return console.debug("Client.listTools() called but server does not advertise tools capability - returning empty list"),{tools:[]};if(e?.cursor!==void 0){let o=await this.request({method:"tools/list",params:e},t);return this._excludeInvalidXMcpHeaderTools(o),o}let r=await this._serveFromCache("tools/list",void 0,t);if(r!==void 0)return r;return this._listAllPages("tools/list",e,t,(o)=>o.tools,(o)=>this._excludeInvalidXMcpHeaderTools(o))}_excludeInvalidXMcpHeaderTools(e){if(this.getProtocolEra()!=="modern"||!this.transport||Ug(this.transport)==="stdio")return;let t=e.tools.filter((r)=>{let o=ad(r.inputSchema);if(!o.valid)return console.warn(`[mcp-sdk] excluding tool '${r.name}' from tools/list: invalid x-mcp-header declaration — ${o.reason}`),!1;return!0});if(t.length!==e.tools.length)e.tools=t}_setupListChangedHandler(e,t,r,o){let s=Wc(gi,r);if(!s.success)throw Error(`Invalid ${e} listChanged options: ${s.error.message}`);if(typeof r.onChanged!=="function")throw TypeError(`Invalid ${e} listChanged options: onChanged must be a function`);let{autoRefresh:n,debounceMs:i}=s.data,{onChanged:a}=r,c=async()=>{if(!n){a(null,null);return}try{a(null,await o())}catch(d){a(d instanceof Error?d:Error(String(d)),null)}},l=()=>{if(i){let d=this._listChangedDebounceTimers.get(e);if(d)clearTimeout(d);let f=setTimeout(c,i);this._listChangedDebounceTimers.set(e,f)}else c()};this.setNotificationHandler(t,l)}async sendRootsListChanged(){return this.notification({method:"notifications/roots/list_changed"})}};class ou extends Error{constructor(e,t){super(e),this.name="ParseError",this.type=t.type,this.field=t.field,this.value=t.value,this.line=t.line}}var vS=10,OR=13,_o=32;function Id(e){}function wS(e){if(typeof e=="function")throw TypeError("`config` must be an object, got a function instead. Did you mean `createParser({onEvent: fn})`?");let{onEvent:t=Id,onError:r=Id,onRetry:o=Id,onComment:s,maxBufferSize:n}=e,i=[],a=0,c=!0,l,d="",f=0,h,g=!1;function b(x){if(g)throw Error("Cannot feed parser: it was terminated after exceeding the configured max buffer size. Call `reset()` to resume parsing.");if(c&&(c=!1,x.charCodeAt(0)===239&&x.charCodeAt(1)===187&&x.charCodeAt(2)===191&&(x=x.slice(3))),i.length===0){let ee=w(x);ee!==""&&(i.push(ee),a=ee.length),_();return}if(x.indexOf(`
73
- `)===-1&&x.indexOf("\r")===-1){i.push(x),a+=x.length,_();return}i.push(x);let R=i.join("");i.length=0,a=0;let Z=w(R);Z!==""&&(i.push(Z),a=Z.length),_()}function _(){n!==void 0&&(a+d.length<=n||(g=!0,i.length=0,a=0,l=void 0,d="",f=0,h=void 0,r(new ou(`Buffered data exceeded max buffer size of ${n} characters`,{type:"max-buffer-size-exceeded"}))))}function w(x){let R=0;if(x.indexOf("\r")===-1){let Z=x.indexOf(`
74
- `,R);for(;Z!==-1;){if(R===Z){f>0&&t({id:l,event:h,data:d}),l=void 0,d="",f=0,h=void 0,R=Z+1,Z=x.indexOf(`
75
- `,R);continue}let ee=x.charCodeAt(R);if(bS(x,R,ee)){let X=x.charCodeAt(R+5)===_o?R+6:R+5,ne=x.slice(X,Z);if(f===0&&x.charCodeAt(Z+1)===vS){t({id:l,event:h,data:ne}),l=void 0,d="",h=void 0,R=Z+2,Z=x.indexOf(`
72
+ - `)}`,Error(M)}let U=`${a}/$ref`,Q=be(e,B,r,o,s,n,i,U,c);if(!Q.valid)j.push({instanceLocation:i,keyword:"$ref",keywordLocation:U,error:"A subschema had errors."},...Q.errors);if(r==="4"||r==="7")return{valid:j.length===0,errors:j}}if(Array.isArray(v)){let B=v.length,U=!1;for(let Q=0;Q<B;Q++)if(d===v[Q]||v[Q]==="integer"&&d==="number"&&e%1===0&&e===e){U=!0;break}if(!U)j.push({instanceLocation:i,keyword:"type",keywordLocation:`${a}/type`,error:`Instance type "${d}" is invalid. Expected "${v.join('", "')}".`})}else if(v==="integer"){if(d!=="number"||e%1||e!==e)j.push({instanceLocation:i,keyword:"type",keywordLocation:`${a}/type`,error:`Instance type "${d}" is invalid. Expected "${v}".`})}else if(v!==void 0&&d!==v)j.push({instanceLocation:i,keyword:"type",keywordLocation:`${a}/type`,error:`Instance type "${d}" is invalid. Expected "${v}".`});if(_!==void 0){if(d==="object"||d==="array"){if(!ha(e,_))j.push({instanceLocation:i,keyword:"const",keywordLocation:`${a}/const`,error:`Instance does not match ${JSON.stringify(_)}.`})}else if(e!==_)j.push({instanceLocation:i,keyword:"const",keywordLocation:`${a}/const`,error:`Instance does not match ${JSON.stringify(_)}.`})}if(y!==void 0){if(d==="object"||d==="array"){if(!y.some((B)=>ha(e,B)))j.push({instanceLocation:i,keyword:"enum",keywordLocation:`${a}/enum`,error:`Instance does not match any of ${JSON.stringify(y)}.`})}else if(!y.some((B)=>e===B))j.push({instanceLocation:i,keyword:"enum",keywordLocation:`${a}/enum`,error:`Instance does not match any of ${JSON.stringify(y)}.`})}if(O!==void 0){let B=`${a}/not`;if(be(e,O,r,o,s,n,i,B).valid)j.push({instanceLocation:i,keyword:"not",keywordLocation:B,error:'Instance matched "not" schema.'})}let Tt=[];if(k!==void 0){let B=`${a}/anyOf`,U=j.length,Q=!1;for(let M=0;M<k.length;M++){let N=k[M],K=Object.create(c),J=be(e,N,r,o,s,g===!0?n:null,i,`${B}/${M}`,K);if(j.push(...J.errors),Q=Q||J.valid,J.valid)Tt.push(K)}if(Q)j.length=U;else j.splice(U,0,{instanceLocation:i,keyword:"anyOf",keywordLocation:B,error:"Instance does not match any subschemas."})}if(P!==void 0){let B=`${a}/allOf`,U=j.length,Q=!0;for(let M=0;M<P.length;M++){let N=P[M],K=Object.create(c),J=be(e,N,r,o,s,g===!0?n:null,i,`${B}/${M}`,K);if(j.push(...J.errors),Q=Q&&J.valid,J.valid)Tt.push(K)}if(Q)j.length=U;else j.splice(U,0,{instanceLocation:i,keyword:"allOf",keywordLocation:B,error:"Instance does not match every subschema."})}if(z!==void 0){let B=`${a}/oneOf`,U=j.length,Q=z.filter((M,N)=>{let K=Object.create(c),J=be(e,M,r,o,s,g===!0?n:null,i,`${B}/${N}`,K);if(j.push(...J.errors),J.valid)Tt.push(K);return J.valid}).length;if(Q===1)j.length=U;else j.splice(U,0,{instanceLocation:i,keyword:"oneOf",keywordLocation:B,error:`Instance does not match exactly one subschema (${Q} matches).`})}if(d==="object"||d==="array")Object.assign(c,...Tt);if(R!==void 0){let B=`${a}/if`;if(be(e,R,r,o,s,n,i,B,c).valid){if(Z!==void 0){let U=be(e,Z,r,o,s,n,i,`${a}/then`,c);if(!U.valid)j.push({instanceLocation:i,keyword:"if",keywordLocation:B,error:'Instance does not match "then" schema.'},...U.errors)}}else if(ee!==void 0){let U=be(e,ee,r,o,s,n,i,`${a}/else`,c);if(!U.valid)j.push({instanceLocation:i,keyword:"if",keywordLocation:B,error:'Instance does not match "else" schema.'},...U.errors)}}if(d==="object"){if(T!==void 0){for(let M of T)if(!(M in e))j.push({instanceLocation:i,keyword:"required",keywordLocation:`${a}/required`,error:`Instance does not have required property "${M}".`})}let B=Object.keys(e);if(re!==void 0&&B.length<re)j.push({instanceLocation:i,keyword:"minProperties",keywordLocation:`${a}/minProperties`,error:`Instance does not have at least ${re} properties.`});if(de!==void 0&&B.length>de)j.push({instanceLocation:i,keyword:"maxProperties",keywordLocation:`${a}/maxProperties`,error:`Instance does not have at least ${de} properties.`});if(wt!==void 0){let M=`${a}/propertyNames`;for(let N in e){let K=`${i}/${vt(N)}`,J=be(N,wt,r,o,s,n,K,M);if(!J.valid)j.push({instanceLocation:i,keyword:"propertyNames",keywordLocation:M,error:`Property name "${N}" does not match schema.`},...J.errors)}}if(Fe!==void 0){let M=`${a}/dependantRequired`;for(let N in Fe)if(N in e){let K=Fe[N];for(let J of K)if(!(J in e))j.push({instanceLocation:i,keyword:"dependentRequired",keywordLocation:M,error:`Instance has "${N}" but does not have "${J}".`})}}if(nt!==void 0)for(let M in nt){let N=`${a}/dependentSchemas`;if(M in e){let K=be(e,nt[M],r,o,s,n,i,`${N}/${vt(M)}`,c);if(!K.valid)j.push({instanceLocation:i,keyword:"dependentSchemas",keywordLocation:N,error:`Instance has "${M}" but does not match dependant schema.`},...K.errors)}}if(zt!==void 0){let M=`${a}/dependencies`;for(let N in zt)if(N in e){let K=zt[N];if(Array.isArray(K)){for(let J of K)if(!(J in e))j.push({instanceLocation:i,keyword:"dependencies",keywordLocation:M,error:`Instance has "${N}" but does not have "${J}".`})}else{let J=be(e,K,r,o,s,n,i,`${M}/${vt(N)}`);if(!J.valid)j.push({instanceLocation:i,keyword:"dependencies",keywordLocation:M,error:`Instance has "${N}" but does not match dependant schema.`},...J.errors)}}}let U=Object.create(null),Q=!1;if(ne!==void 0){let M=`${a}/properties`;for(let N in ne){if(!(N in e))continue;let K=`${i}/${vt(N)}`,J=be(e[N],ne[N],r,o,s,n,K,`${M}/${vt(N)}`);if(J.valid)c[N]=U[N]=!0;else if(Q=s,j.push({instanceLocation:i,keyword:"properties",keywordLocation:M,error:`Property "${N}" does not match schema.`},...J.errors),Q)break}}if(!Q&&xe!==void 0){let M=`${a}/patternProperties`;for(let N in xe){let K=new RegExp(N,"u"),J=xe[N];for(let ke in e){if(!K.test(ke))continue;let Or=`${i}/${vt(ke)}`,Et=be(e[ke],J,r,o,s,n,Or,`${M}/${vt(N)}`);if(Et.valid)c[ke]=U[ke]=!0;else Q=s,j.push({instanceLocation:i,keyword:"patternProperties",keywordLocation:M,error:`Property "${ke}" matches pattern "${N}" but does not match associated schema.`},...Et.errors)}}}if(!Q&&te!==void 0){let M=`${a}/additionalProperties`;for(let N in e){if(U[N])continue;let K=`${i}/${vt(N)}`,J=be(e[N],te,r,o,s,n,K,M);if(J.valid)c[N]=!0;else Q=s,j.push({instanceLocation:i,keyword:"additionalProperties",keywordLocation:M,error:`Property "${N}" does not match additional properties schema.`},...J.errors)}}else if(!Q&&ie!==void 0){let M=`${a}/unevaluatedProperties`;for(let N in e)if(!c[N]){let K=`${i}/${vt(N)}`,J=be(e[N],ie,r,o,s,n,K,M);if(J.valid)c[N]=!0;else j.push({instanceLocation:i,keyword:"unevaluatedProperties",keywordLocation:M,error:`Property "${N}" does not match unevaluated properties schema.`},...J.errors)}}}else if(d==="array"){if(pt!==void 0&&e.length>pt)j.push({instanceLocation:i,keyword:"maxItems",keywordLocation:`${a}/maxItems`,error:`Array has too many items (${e.length} > ${pt}).`});if(De!==void 0&&e.length<De)j.push({instanceLocation:i,keyword:"minItems",keywordLocation:`${a}/minItems`,error:`Array has too few items (${e.length} < ${De}).`});let B=e.length,U=0,Q=!1;if(Ge!==void 0){let M=`${a}/prefixItems`,N=Math.min(Ge.length,B);for(;U<N;U++){let K=be(e[U],Ge[U],r,o,s,n,`${i}/${U}`,`${M}/${U}`);if(c[U]=!0,!K.valid){if(Q=s,j.push({instanceLocation:i,keyword:"prefixItems",keywordLocation:M,error:"Items did not match schema."},...K.errors),Q)break}}}if(Le!==void 0){let M=`${a}/items`;if(Array.isArray(Le)){let N=Math.min(Le.length,B);for(;U<N;U++){let K=be(e[U],Le[U],r,o,s,n,`${i}/${U}`,`${M}/${U}`);if(c[U]=!0,!K.valid){if(Q=s,j.push({instanceLocation:i,keyword:"items",keywordLocation:M,error:"Items did not match schema."},...K.errors),Q)break}}}else for(;U<B;U++){let N=be(e[U],Le,r,o,s,n,`${i}/${U}`,M);if(c[U]=!0,!N.valid){if(Q=s,j.push({instanceLocation:i,keyword:"items",keywordLocation:M,error:"Items did not match schema."},...N.errors),Q)break}}if(!Q&&Zt!==void 0){let N=`${a}/additionalItems`;for(;U<B;U++){let K=be(e[U],Zt,r,o,s,n,`${i}/${U}`,N);if(c[U]=!0,!K.valid)Q=s,j.push({instanceLocation:i,keyword:"additionalItems",keywordLocation:N,error:"Items did not match additional items schema."},...K.errors)}}}if(Rt!==void 0)if(B===0&&Ne===void 0)j.push({instanceLocation:i,keyword:"contains",keywordLocation:`${a}/contains`,error:"Array is empty. It must contain at least one item matching the schema."});else if(Ne!==void 0&&B<Ne)j.push({instanceLocation:i,keyword:"minContains",keywordLocation:`${a}/minContains`,error:`Array has less items (${B}) than minContains (${Ne}).`});else{let M=`${a}/contains`,N=j.length,K=0;for(let J=0;J<B;J++){let ke=be(e[J],Rt,r,o,s,n,`${i}/${J}`,M);if(ke.valid)c[J]=!0,K++;else j.push(...ke.errors)}if(K>=(Ne||0))j.length=N;if(Ne===void 0&&Ue===void 0&&K===0)j.splice(N,0,{instanceLocation:i,keyword:"contains",keywordLocation:M,error:"Array does not contain item matching schema."});else if(Ne!==void 0&&K<Ne)j.push({instanceLocation:i,keyword:"minContains",keywordLocation:`${a}/minContains`,error:`Array must contain at least ${Ne} items matching schema. Only ${K} items were found.`});else if(Ue!==void 0&&K>Ue)j.push({instanceLocation:i,keyword:"maxContains",keywordLocation:`${a}/maxContains`,error:`Array may contain at most ${Ue} items matching schema. ${K} items were found.`})}if(!Q&&Ht!==void 0){let M=`${a}/unevaluatedItems`;for(;U<B;U++){if(c[U])continue;let N=be(e[U],Ht,r,o,s,n,`${i}/${U}`,M);if(c[U]=!0,!N.valid)j.push({instanceLocation:i,keyword:"unevaluatedItems",keywordLocation:M,error:"Items did not match unevaluated items schema."},...N.errors)}}if(Ir)for(let M=0;M<B;M++){let N=e[M],K=typeof N==="object"&&N!==null;for(let J=0;J<B;J++){if(M===J)continue;let ke=e[J];if(N===ke||K&&typeof ke==="object"&&ke!==null&&ha(N,ke))j.push({instanceLocation:i,keyword:"uniqueItems",keywordLocation:`${a}/uniqueItems`,error:`Duplicate items at indexes ${M} and ${J}.`}),M=Number.MAX_SAFE_INTEGER,J=Number.MAX_SAFE_INTEGER}}}else if(d==="number"){if(r==="4"){if(Ye!==void 0&&(Ve===!0&&e<=Ye||e<Ye))j.push({instanceLocation:i,keyword:"minimum",keywordLocation:`${a}/minimum`,error:`${e} is less than ${Ve?"or equal to ":""} ${Ye}.`});if(Xe!==void 0&&(it===!0&&e>=Xe||e>Xe))j.push({instanceLocation:i,keyword:"maximum",keywordLocation:`${a}/maximum`,error:`${e} is greater than ${it?"or equal to ":""} ${Xe}.`})}else{if(Ye!==void 0&&e<Ye)j.push({instanceLocation:i,keyword:"minimum",keywordLocation:`${a}/minimum`,error:`${e} is less than ${Ye}.`});if(Xe!==void 0&&e>Xe)j.push({instanceLocation:i,keyword:"maximum",keywordLocation:`${a}/maximum`,error:`${e} is greater than ${Xe}.`});if(Ve!==void 0&&e<=Ve)j.push({instanceLocation:i,keyword:"exclusiveMinimum",keywordLocation:`${a}/exclusiveMinimum`,error:`${e} is less than ${Ve}.`});if(it!==void 0&&e>=it)j.push({instanceLocation:i,keyword:"exclusiveMaximum",keywordLocation:`${a}/exclusiveMaximum`,error:`${e} is greater than or equal to ${it}.`})}if(at!==void 0){let B=e%at;if(Math.abs(0-B)>=0.00000011920929&&Math.abs(at-B)>=0.00000011920929)j.push({instanceLocation:i,keyword:"multipleOf",keywordLocation:`${a}/multipleOf`,error:`${e} is not a multiple of ${at}.`})}}else if(d==="string"){let B=xt===void 0&&kt===void 0?0:rR(e);if(xt!==void 0&&B<xt)j.push({instanceLocation:i,keyword:"minLength",keywordLocation:`${a}/minLength`,error:`String is too short (${B} < ${xt}).`});if(kt!==void 0&&B>kt)j.push({instanceLocation:i,keyword:"maxLength",keywordLocation:`${a}/maxLength`,error:`String is too long (${B} > ${kt}).`});if(sr!==void 0&&!new RegExp(sr,"u").test(e))j.push({instanceLocation:i,keyword:"pattern",keywordLocation:`${a}/pattern`,error:"String does not match pattern."});if(X!==void 0&&Mg[X]&&!Mg[X](e))j.push({instanceLocation:i,keyword:"format",keywordLocation:`${a}/format`,error:`String does not match format "${X}".`})}return{valid:j.length===0,errors:j}}var oR=class{schema;draft;shortCircuit;lookup;constructor(e,t="2019-09",r=!0){this.schema=e,this.draft=t,this.shortCircuit=r,this.lookup=_o(e)}validate(e){return be(e,this.schema,this.draft,this.lookup,this.shortCircuit)}addSchema(e,t){if(t)e={...e,$id:t};_o(e,this.lookup)}},Xc=class{shortcircuit;draft;constructor(e){this.shortcircuit=e?.shortcircuit??!0,this.draft=e?.draft}_draftFor(e){let t=Tp(e,"pass an explicit { draft } to CfWorkerJsonSchemaValidator to validate other dialects.");return t==="draft-7"?"7":t}getValidator(e){let t=new oR(e,this.draft??this._draftFor(e),this.shortcircuit);return(r)=>{let o=t.validate(r);return o.valid?{valid:!0,data:r,errorMessage:void 0}:{valid:!1,data:void 0,errorMessage:o.errors.map((s)=>`${s.instanceLocation}: ${s.error}`).join("; ")}}}};var Ug=!0;var gd;gd=globalThis.crypto;async function sR(e){return(await gd).getRandomValues(new Uint8Array(e))}async function nR(e){let r=Math.pow(2,8)-Math.pow(2,8)%66,o="";while(o.length<e){let s=await sR(e-o.length);for(let n of s)if(n<r)o+="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-._~"[n%66]}return o}async function iR(e){return await nR(e)}async function aR(e){let t=await(await gd).subtle.digest("SHA-256",new TextEncoder().encode(e));return btoa(String.fromCharCode(...new Uint8Array(t))).replace(/\//g,"_").replace(/\+/g,"-").replace(/=/g,"")}async function Sd(e){if(!e)e=43;if(e<43||e>128)throw`Expected a length between 43 and 128. Received ${e}.`;let t=await iR(e),r=await aR(t);return{code_verifier:t,code_challenge:r}}var bs=class extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.OAuthClientFlowError"})}static[Symbol.hasInstance](e){return We(this,e)}static isInstance(e){if(typeof this!=="function")throw TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return We(this,e)}constructor(e){super(e);this.name=new.target.name,br(this,new.target)}},ru=class extends bs{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.IssuerMismatchError"})}kind;expected;received;constructor(e,t,r){super(`Issuer mismatch in ${e==="metadata"?"authorization server metadata (RFC 8414 §3.3)":"authorization response (RFC 9207)"}: expected ${JSON.stringify(t)}, received ${JSON.stringify(r)}`);this.kind=e,this.expected=t,this.received=r}},Gg=class extends bs{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.RegistrationRejectedError"})}status;body;submittedMetadata;constructor(e){super(`Dynamic Client Registration rejected (HTTP ${e.status}): ${e.body}`);this.status=e.status,this.body=e.body,this.submittedMetadata=e.submittedMetadata}},Td=class extends bs{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.InsecureTokenEndpointError"})}tokenEndpoint;constructor(e){super(`Refusing to send credentials to non-https token endpoint '${e}'. OAuth token requests MUST use TLS (localhost / *.localhost / 127.0.0.1 / ::1 are exempt).`);this.tokenEndpoint=e}},fa=class extends bs{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.AuthorizationServerMismatchError"})}constructor(e,t){super(`Authorization server mismatch: credentials are bound to ${JSON.stringify(e)} but this call resolved ${JSON.stringify(t)}; refusing to present them to a different authorization server`);this.recordedIssuer=e,this.currentIssuer=t}},Ed=class extends bs{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.InsufficientScopeError"})}requiredScope;resourceMetadataUrl;errorDescription;constructor(e){super(`Insufficient scope${e.requiredScope?`: required "${e.requiredScope}"`:""}`);this.requiredScope=e.requiredScope,this.resourceMetadataUrl=e.resourceMetadataUrl,this.errorDescription=e.errorDescription}};function xd(e,t,r){if(!e)return;if(typeof e.issuer!=="string"){if(r?.canPersistStamp!==!1)console.warn("[mcp-sdk] SEP-2352: stored OAuth credential has no 'issuer' stamp (pre-upgrade storage or provider not round-tripping the value). SEP-2352 isolation is inactive for this read; ensure your provider round-trips the issuer field.");return e.issuer===void 0?e:{...e,issuer:void 0}}return Yg(e.issuer,t)?e:void 0}function Yg(e,t){return e===t||e.endsWith("/")&&e.slice(0,-1)===t||t.endsWith("/")&&t.slice(0,-1)===e}function Xg(e){if(e==null)return!1;let t=e;return typeof t.tokens==="function"&&typeof t.clientInformation==="function"}async function cR(e,t,r){let{resourceMetadataUrl:o,scope:s}=ys(t.response);if(await nu(e,{serverUrl:t.serverUrl,resourceMetadataUrl:o,scope:s,fetchFn:t.fetchFn,...r})!=="AUTHORIZED")throw new bt}function Qg(e,t){return{token:async()=>(await e.tokens())?.access_token,onUnauthorized:async(r)=>cR(e,r,t)}}var bt=class extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.UnauthorizedError"})}static[Symbol.hasInstance](e){return We(this,e)}static isInstance(e){if(typeof this!=="function")throw TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return We(this,e)}constructor(e){super(e??"Unauthorized");this.name="UnauthorizedError",br(this,new.target)}};function $d(e){return e?.authorization_response_iss_parameter_supported===!0}function ou({iss:e,expectedIssuer:t,issParameterSupported:r}){if(t===void 0)return;if(e===void 0){if(r)throw new ru("authorization_response",t,void 0);return}if(e!==t)throw new ru("authorization_response",t,e)}function su(...e){let t=new Set;for(let r of e){if(!r)continue;for(let o of r.split(/\s+/))if(o)t.add(o)}return t.size>0?[...t].join(" "):void 0}function eS(e,t){if(!e)return!1;let r=new Set((t??"").split(/\s+/).filter(Boolean));for(let o of e.split(/\s+/))if(o&&!r.has(o))return!0;return!1}async function tS(e,t,r,o,s){if(typeof e==="string")return{authorizationCode:e,iss:t};let n=e.get("iss")??void 0,i=e.get("code");if(i)return{authorizationCode:i,iss:n};let a=(await r.discoveryState?.())?.authorizationServerMetadata;if(!a)try{a=(await qd(o,s)).authorizationServerMetadata}catch{a=void 0}if(!a)throw new bt("Authorization callback failed and the issuer could not be verified");ou({iss:n,expectedIssuer:a.issuer,issParameterSupported:$d(a)});let c=e.get("error");if(c)throw new yr(c,e.get("error_description")??c,e.get("error_uri")??void 0);throw new bt("Authorization callback contained neither `code` nor `error`")}function uR(e){return["client_secret_basic","client_secret_post","none"].includes(e)}var vd="code",bd="S256";function rS(e,t){let r=e.client_secret!==void 0;if("token_endpoint_auth_method"in e&&e.token_endpoint_auth_method&&uR(e.token_endpoint_auth_method)&&(t.length===0||t.includes(e.token_endpoint_auth_method)))return e.token_endpoint_auth_method;if(t.length===0)return r?"client_secret_basic":"none";if(r&&t.includes("client_secret_basic"))return"client_secret_basic";if(r&&t.includes("client_secret_post"))return"client_secret_post";if(t.includes("none"))return"none";return r?"client_secret_post":"none"}function oS(e,t,r,o){let{client_id:s,client_secret:n}=t;switch(e){case"client_secret_basic":lR(s,n,r);return;case"client_secret_post":dR(s,n,o);return;case"none":pR(s,o);return;default:throw Error(`Unsupported client authentication method: ${e}`)}}function lR(e,t,r){if(!t)throw Error("client_secret_basic authentication requires a client_secret");let o=btoa(`${e}:${t}`);r.set("Authorization",`Basic ${o}`)}function dR(e,t,r){if(r.set("client_id",e),t)r.set("client_secret",t)}function pR(e,t){t.set("client_id",e)}function sS(e){return e==="localhost"||e.endsWith(".localhost")||e==="127.0.0.1"||e==="[::1]"||e==="::1"}function nS(e){let t=new URL(String(e));if(t.protocol!=="https:"&&!sS(t.hostname))throw new Td(t.href);return t}function mR(e){for(let t of e??[]){let r;try{r=new URL(t)}catch{continue}if(r.protocol!=="http:"&&r.protocol!=="https:")return"native";if(sS(r.hostname))return"native"}return"web"}function iS(e){let t=e.clientMetadata;return{...t,grant_types:t.grant_types??(e.redirectUrl===void 0?void 0:["authorization_code","refresh_token"]),application_type:t.application_type??mR(t.redirect_uris)}}async function kd(e){let t=e instanceof Response?e.status:void 0,r=e instanceof Response?await e.text():e;try{let o=mo.parse(JSON.parse(r));return yr.fromResponse(o)}catch(o){let s=`${t?`HTTP ${t}: `:""}Invalid OAuth error response: ${o}. Raw body: ${r}`;return new yr(jt.ServerError,s)}}function Dg(e,t,r){let o=e.invalidateCredentials===void 0?`retrying authorization without discarding the stored ${r} (provider implements no invalidateCredentials())`:`invalidating the stored ${r} and retrying authorization`;console.warn(`[mcp-sdk] OAuth ${JSON.stringify(t.code)} — ${o}. Cause: ${JSON.stringify(t.message)}`)}async function nu(e,t){try{return await yd(e,t)}catch(r){if(r instanceof yr){if(r.code===jt.InvalidClient||r.code===jt.UnauthorizedClient)return Dg(e,r,"client credentials and tokens"),await e.invalidateCredentials?.("client"),await e.invalidateCredentials?.("tokens"),await yd(e,t);else if(r.code===jt.InvalidGrant||r.code===jt.InvalidDpopProof)return Dg(e,r,"tokens"),await e.invalidateCredentials?.("tokens"),await yd(e,t)}throw r}}function hR(e){let{requestedScope:t,resourceMetadata:r,authServerMetadata:o,clientMetadata:s}=e,n=t||r?.scopes_supported?.join(" ")||s.scope;if(n&&o?.scopes_supported?.includes("offline_access")&&!n.split(" ").includes("offline_access")&&s.grant_types?.includes("refresh_token"))n=`${n} offline_access`;return n}async function yd(e,{serverUrl:t,authorizationCode:r,iss:o,scope:s,resourceMetadataUrl:n,fetchFn:i,skipIssuerMetadataValidation:a,forceReauthorization:c}){let l=iS(e),d=await e.discoveryState?.(),f,h,g,v,_=n;if(!_&&d?.resourceMetadataUrl)_=new URL(d.resourceMetadataUrl);if(d?.authorizationServerUrl){if(h=d.authorizationServerUrl,f=d.resourceMetadata,g=d.authorizationServerMetadata??await Id(h,{fetchFn:i,skipIssuerValidation:a}),!f)try{f=await Cd(t,{resourceMetadataUrl:_},i)}catch(te){if(te instanceof TypeError)throw te}if(g!==d.authorizationServerMetadata||f!==d.resourceMetadata)await e.saveDiscoveryState?.({authorizationServerUrl:String(h),resourceMetadataUrl:_?.toString(),resourceMetadata:f,authorizationServerMetadata:g})}else{let te=await qd(t,{resourceMetadataUrl:_,fetchFn:i,skipIssuerMetadataValidation:a});h=te.authorizationServerUrl,g=te.authorizationServerMetadata,f=te.resourceMetadata,v={authorizationServerUrl:String(h),resourceMetadataUrl:_?.toString(),resourceMetadata:f,authorizationServerMetadata:g}}let y=g?.issuer??String(h),T={issuer:y};if(await e.saveAuthorizationServerUrl?.(y),r!==void 0){let te=d?.authorizationServerMetadata?.issuer??d?.authorizationServerUrl;if(te===void 0){if(e.saveDiscoveryState!==void 0)throw new fa("discoveryState was not available on the callback leg; ensure your provider persists discoveryState alongside codeVerifier",y);console.warn("[mcp-sdk] OAuthClientProvider does not implement saveDiscoveryState()/discoveryState(); the SEP-2352 callback-leg authorization-server binding cannot be checked. Implement discoveryState (persist alongside codeVerifier) — see docs/migration/upgrade-to-v2.md §SEP-2352.")}else if(!Yg(te,y))throw new fa(te,y)}if(v)await e.saveDiscoveryState?.(v);let O=await cS(t,e,f),k=O&&f&&!e.validateResourceURL?f.resource:O;if(k)await e.saveResourceUrl?.(Od(k));let P=hR({requestedScope:s,resourceMetadata:f,authServerMetadata:g,clientMetadata:e.clientMetadata}),z=await Promise.resolve(e.clientInformation(T)),R=xd(z,y,{canPersistStamp:e.saveClientInformation!==void 0});if(R===void 0&&z?.issuer&&e.saveClientInformation===void 0)throw new fa(z.issuer,y);if(R&&R.issuer===void 0)R={...R,issuer:y},await e.saveClientInformation?.(R,T);if(!R){if(r!==void 0)throw Error("Existing OAuth client information is required when exchanging an authorization code");let te=g?.client_id_metadata_document_supported===!0,ie=e.clientMetadataUrl;if(ie&&!aS(ie))throw new yr(jt.InvalidClientMetadata,`clientMetadataUrl must be a valid HTTPS URL with a non-root pathname, got: ${ie}`);if(te&&ie)R={client_id:ie,issuer:y},await e.saveClientInformation?.(R,T);else{if(!e.saveClientInformation)throw Error("OAuth client information must be saveable for dynamic registration");R={...await _S(h,{metadata:g,clientMetadata:l,scope:P,fetchFn:i}),issuer:y},await e.saveClientInformation(R,T)}}let Z=!e.redirectUrl;if(r!==void 0||Z){if(r!==void 0)ou({iss:o,expectedIssuer:g?.issuer,issParameterSupported:$d(g)});let te=await fS(e,h,{metadata:g,resource:k,authorizationCode:r,iss:o,scope:P,fetchFn:i});return await e.saveTokens({...te,issuer:y},T),"AUTHORIZED"}let ee=xd(await e.tokens(T),y);if(ee&&ee.issuer===void 0)ee={...ee,issuer:y},await e.saveTokens(ee,T);if(ee?.refresh_token&&!c){let te=await e.scopeForRefresh?.(ee),ie;try{ie=await hS(h,{metadata:g,clientInformation:R,refreshToken:ee.refresh_token,scope:te,resource:k,addClientAuthentication:e.addClientAuthentication,dpop:await e.dpop?.(),fetchFn:i})}catch(re){if(re instanceof Td)throw re;if(!(re instanceof yr)||re.code===jt.ServerError)console.warn(`[mcp-sdk] Could not refresh OAuth tokens; falling back to a new authorization request. Cause: ${JSON.stringify(re instanceof Error?re.message:String(re))}`);else throw re}if(ie)return await e.saveTokens({...ie,issuer:y},T),"AUTHORIZED"}let X=e.state?await e.state():void 0,{authorizationUrl:ne,codeVerifier:xe}=await dS(h,{metadata:g,clientInformation:R,state:X,redirectUrl:e.redirectUrl,scope:P,resource:k});return await e.saveCodeVerifier(xe),await e.redirectToAuthorization(ne),"REDIRECT"}function aS(e){if(!e)return!1;try{let t=new URL(e);return t.protocol==="https:"&&t.pathname!=="/"}catch{return!1}}async function cS(e,t,r){let o=td(e);if(t.validateResourceURL)return await t.validateResourceURL(o,r?.resource);if(!r)return;if(!rd({requestedResource:o,configuredResource:r.resource}))throw Error(`Protected resource ${r.resource} does not match expected ${o} (or origin)`);return new URL(r.resource)}var fR=new Set(["bearer","dpop"]);function ys(e){let t=e.headers.get("WWW-Authenticate");if(!t)return{};let[r,o]=t.split(" ");if(!r||!fR.has(r.toLowerCase())||!o)return{};let s=Qc(e,"resource_metadata")||void 0,n;if(s)try{n=new URL(s)}catch{}let i=Qc(e,"scope")||void 0,a=Qc(e,"error")||void 0,c=Qc(e,"error_description")||void 0;return{resourceMetadataUrl:n,scope:i,error:a,errorDescription:c}}function Qc(e,t){let r=e.headers.get("WWW-Authenticate");if(!r)return null;let o=new RegExp(String.raw`${t}=(?:"([^"]+)"|([^\s,]+))`),s=r.match(o);if(s){let n=s[1]||s[2];if(n)return n}return null}async function Cd(e,t,r=fetch){let o=await SR(e,"oauth-protected-resource",r,{protocolVersion:t?.protocolVersion,metadataUrl:t?.resourceMetadataUrl});if(!o||o.status===404)throw await o?.text?.().catch(()=>{}),Error("Resource server does not implement OAuth 2.0 Protected Resource Metadata.");if(!o.ok)throw await o.text?.().catch(()=>{}),Error(`HTTP ${o.status} trying to load well-known OAuth protected resource metadata.`);return fs.parse(await o.json())}async function uS(e,t,r=fetch){let o=vs(r);try{return await o(e,{headers:t})}catch(s){if(!(s instanceof TypeError)||!Ug)throw s;if(t)try{return await o(e,{})}catch(n){if(!(n instanceof TypeError))throw n;return}return}}function _R(e,t="",r={}){if(t.endsWith("/"))t=t.slice(0,-1);return r.prependPathname?`${t}/.well-known/${e}`:`/.well-known/${e}${t}`}async function Zg(e,t,r=fetch){return await uS(e,{"MCP-Protocol-Version":t},r)}function gR(e,t){if(!e)return!0;if(t==="/")return!1;return!e.ok&&e.status<500||e.status===502}async function SR(e,t,r,o){let s=new URL(e),n=o?.protocolVersion??Kr,i;if(o?.metadataUrl)i=new URL(o.metadataUrl);else{let c=_R(t,s.pathname);i=new URL(c,o?.metadataServerUrl??s),i.search=s.search}let a=await Zg(i,n,r);if(!o?.metadataUrl&&gR(a,s.pathname))a=await Zg(new URL(`/.well-known/${t}`,s),n,r);return a}function lS(e){let t=typeof e==="string"?new URL(e):e,r=t.pathname!=="/",o=[];if(!r)return o.push({url:new URL("/.well-known/oauth-authorization-server",t.origin),type:"oauth"},{url:new URL("/.well-known/openid-configuration",t.origin),type:"oidc"}),o;let s=t.pathname;if(s.endsWith("/"))s=s.slice(0,-1);return o.push({url:new URL(`/.well-known/oauth-authorization-server${s}`,t.origin),type:"oauth"},{url:new URL(`/.well-known/openid-configuration${s}`,t.origin),type:"oidc"},{url:new URL(`${s}/.well-known/openid-configuration`,t.origin),type:"oidc"}),o}async function Id(e,{fetchFn:t=fetch,protocolVersion:r=Kr,skipIssuerValidation:o=!1}={}){let s={"MCP-Protocol-Version":r,Accept:"application/json"},n=lS(e);for(let{url:i,type:a}of n){let c=await uS(i,s,t);if(!c)continue;if(!c.ok){if(await c.text?.().catch(()=>{}),c.status<500||c.status===502)continue;throw Error(`HTTP ${c.status} trying to load ${a==="oauth"?"OAuth":"OpenID provider"} metadata from ${i}`)}let l=a==="oauth"?lo.parse(await c.json()):_s.parse(await c.json());if(!o){let d=typeof e==="string"?e:e.href;if(!(l.issuer===d||d.endsWith("/")&&l.issuer===d.slice(0,-1)))throw new ru("metadata",d,l.issuer)}return l}}async function qd(e,t){let r,o;try{if(r=await Cd(e,{resourceMetadataUrl:t?.resourceMetadataUrl},t?.fetchFn),r.authorization_servers&&r.authorization_servers.length>0)o=r.authorization_servers[0]}catch(n){if(n instanceof TypeError)throw n}if(!o)o=String(new URL("/",e));let s=await Id(o,{fetchFn:t?.fetchFn,skipIssuerValidation:t?.skipIssuerMetadataValidation});return{authorizationServerUrl:o,authorizationServerMetadata:s,resourceMetadata:r}}function Od(e){return typeof e==="string"?e:e.href}async function dS(e,{metadata:t,clientInformation:r,redirectUrl:o,scope:s,state:n,resource:i}){let a;if(t){if(a=new URL(t.authorization_endpoint),!t.response_types_supported.includes(vd))throw Error(`Incompatible auth server: does not support response type ${vd}`);if(t.code_challenge_methods_supported&&!t.code_challenge_methods_supported.includes(bd))throw Error(`Incompatible auth server: does not support code challenge method ${bd}`)}else a=new URL("/authorize",e);let c=await Sd(),{code_verifier:l,code_challenge:d}=c;if(a.searchParams.set("response_type",vd),a.searchParams.set("client_id",r.client_id),a.searchParams.set("code_challenge",d),a.searchParams.set("code_challenge_method",bd),a.searchParams.set("redirect_uri",String(o)),n)a.searchParams.set("state",n);if(s)a.searchParams.set("scope",s);if(s?.split(" ").includes("offline_access"))a.searchParams.append("prompt","consent");if(i)a.searchParams.set("resource",Od(i));return{authorizationUrl:a,codeVerifier:l}}function pS(e,t,r){return new URLSearchParams({grant_type:"authorization_code",code:e,code_verifier:t,redirect_uri:String(r)})}async function mS(e,{metadata:t,tokenRequestParams:r,clientInformation:o,addClientAuthentication:s,resource:n,dpop:i,fetchFn:a}){let c=nS(t?.token_endpoint??new URL("/token",e)),l=new Headers({"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"});if(n)r.set("resource",Od(n));if(!s&&o)oS(rS(o,t?.token_endpoint_auth_methods_supported??[]),o,l,r);let d=async()=>{let g=new Headers(l);if(s)await s(g,r,c,t);if(i)g.set("DPoP",await i.buildProof({htm:"POST",htu:c}));return vs(a??fetch)(c,{method:"POST",headers:g,body:r})},f=await d();if(i&&f.status===400){if((await f.clone().json().catch(()=>{}))?.error===jt.UseDpopNonce)i.observeNonce(f,c),f=await d()}if(i?.observeNonce(f,c),!f.ok)throw await kd(f);let h=await f.json();try{return po.parse(Kc(h))}catch(g){if(typeof h==="object"&&h!==null&&"error"in h)throw await kd(JSON.stringify(h));throw g}}async function hS(e,{metadata:t,clientInformation:r,refreshToken:o,scope:s,resource:n,addClientAuthentication:i,dpop:a,fetchFn:c}){let l=new URLSearchParams({grant_type:"refresh_token",refresh_token:o});if(s)l.set("scope",s);let d=await mS(e,{metadata:t,tokenRequestParams:l,clientInformation:r,addClientAuthentication:i,resource:n,dpop:a,fetchFn:c});return{refresh_token:o,...d,...s&&!d.scope&&{scope:s}}}async function fS(e,t,{metadata:r,resource:o,authorizationCode:s,iss:n,scope:i,fetchFn:a}={}){if(s!==void 0)ou({iss:n,expectedIssuer:r?.issuer,issParameterSupported:$d(r)});let c=r?.issuer??String(t),l=async()=>{let g=await e.clientInformation({issuer:c}),v=xd(g,c,{canPersistStamp:!1});if(g&&v===void 0)throw new fa(String(g.issuer),c);return v},d=await l(),f=i??e.clientMetadata.scope,h;if(e.prepareTokenRequest)h=await e.prepareTokenRequest(f);if(!h){if(!s)throw Error("Either provider.prepareTokenRequest() or authorizationCode is required");if(!e.redirectUrl)throw Error("redirectUrl is required for authorization_code flow");h=pS(s,await e.codeVerifier(),e.redirectUrl)}return d??=await l(),mS(t,{metadata:r,tokenRequestParams:h,clientInformation:d,addClientAuthentication:e.addClientAuthentication,resource:o,dpop:await e.dpop?.(),fetchFn:a})}async function _S(e,{metadata:t,clientMetadata:r,scope:o,fetchFn:s}){let n;if(t){if(!t.registration_endpoint)throw Error("Incompatible auth server: does not support dynamic client registration");n=new URL(t.registration_endpoint)}else n=new URL("/register",e);let i={...r,...o===void 0?{}:{scope:o}},a=await vs(s??fetch)(n,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(i)});if(!a.ok)throw new Gg({status:a.status,body:await a.text(),submittedMetadata:i});return gs.parse(Kc(await a.json()))}var eu=new Set(["tools/list","prompts/list","resources/list","resources/templates/list","server/discover"]),gS=class{_entries=new Map;_maxEntries;_stamp=0;_cappedSize=0;constructor(e){this._maxEntries=e?.maxEntries??512}get size(){return this._entries.size}get(e){return this._entries.get(wd(e))}set(e,t){let r=wd(e),o=eu.has(e.method),s=!this._entries.has(r);if(!o&&s&&this._maxEntries>0&&this._cappedSize>=this._maxEntries){for(let i of this._entries.keys())if(!eu.has(i.slice(0,i.indexOf("\x00")))){this._entries.delete(i),this._cappedSize--;break}}let n=++this._stamp;if(this._entries.set(r,{...t,stamp:n}),s&&!o)this._cappedSize++;return n}delete(e){if(this._entries.delete(wd(e))&&!eu.has(e.method))this._cappedSize--}evict(e){let t=`${e}\x00`,r=eu.has(e);for(let o of this._entries.keys())if(o.startsWith(t)){if(this._entries.delete(o),!r)this._cappedSize--}}clear(){this._entries.clear(),this._cappedSize=0}};function wd(e){return`${e.method}\x00${JSON.stringify([e.partition??"",e.params??""])}`}function zd(e,t){return t===void 0?e:`${e}\x00${t}`}var SS=86400000,vR=class{_evictionGeneration=new Map;_toolIndex;_toolOutputValidatorIndex;_serverIdentity="";constructor(e,t,r=()=>{},o="",s=Date.now){this._store=e,this._isUserSupplied=t,this._reportError=r,this._cachePartition=o,this._now=s}now(){return this._now()}setServerIdentity(e){this._serverIdentity=e}_partitionFor(e){return JSON.stringify([this._serverIdentity,e==="public"?"":this._cachePartition])}async _probe(e,t){let r={method:e,params:t??""},o=this._partitionFor("private"),s=await this._store.get({...r,partition:o});if(s!==void 0)return s;let n=this._partitionFor("public");if(n===o)return;let i=await this._store.get({...r,partition:n});return i?.scope==="public"?i:void 0}async evict(e){this._evictionGeneration.set(e,(this._evictionGeneration.get(e)??0)+1),await this._deleteBoth(e,"")}async _deleteBoth(e,t){let r=this._partitionFor("private"),o=this._partitionFor("public");try{await this._store.delete({method:e,params:t,partition:r})}catch(s){this._reportError(s)}if(o!==r)try{await this._store.delete({method:e,params:t,partition:o})}catch(s){this._reportError(s)}}async evictKey(e,t){let r=zd(e,t),o=this._evictionGeneration.get(r);if(o!==void 0)this._evictionGeneration.set(r,o+1);await this._deleteBoth(e,t)}captureGeneration(e,t){let r=zd(e,t),o=this._evictionGeneration.get(r)??0;return this._evictionGeneration.set(r,o),o}async write(e,t,r,o){if((this._evictionGeneration.get(zd(e,o?.params))??0)!==r)return;let s=o?.params??"",n=this._partitionFor("private"),i=this._partitionFor("public"),a=(o?.scope??"private")==="public"?i:n;try{await this._store.set({method:e,params:s,partition:a},{value:bR(t),expiresAt:o?.expiresAt,scope:o?.scope})}catch(c){this._reportError(c)}if(i!==n)try{await this._store.delete({method:e,params:s,partition:a===n?i:n})}catch(c){this._reportError(c)}}async read(e,t){let r=await this._probe(e,t);if(r?.expiresAt===void 0||!(r.expiresAt>this.now()))return;try{let o=JSON.parse(r.value);if(typeof o!=="object"||o===null||Array.isArray(o))throw TypeError("cached document is not an object");return{value:o}}catch(o){this._reportError(o),await this._deleteBoth(e,t??"");return}}resetForReconnect(){if(!this._isUserSupplied)this._store.clear();this._evictionGeneration.clear(),this._toolIndex=void 0,this._toolOutputValidatorIndex=void 0,this._serverIdentity=""}async toolDefinition(e){let t=await this._probe("tools/list");if(t===void 0){this._toolIndex=void 0;return}if(this._toolIndex?.stamp!==t.stamp){let r=this._decodeListTools(t),o=new Map;if(r!==void 0)for(let s of r.tools)o.set(s.name,s);this._toolIndex={stamp:t.stamp,byName:o}}return this._toolIndex.byName.get(e)}async outputValidator(e,t){let r=await this._probe("tools/list");if(r===void 0){this._toolOutputValidatorIndex=void 0;return}if(this._toolOutputValidatorIndex?.stamp!==r.stamp){let o=this._decodeListTools(r)??{tools:[]},s=new Map;for(let n of o.tools){let i=t(n);if(i!==void 0)s.set(n.name,i)}this._toolOutputValidatorIndex={stamp:r.stamp,byName:s}}return this._toolOutputValidatorIndex.byName.get(e)}_decodeListTools(e){try{let t=JSON.parse(e.value);if(!Array.isArray(t?.tools)||!t.tools.every((r)=>r!==null&&typeof r==="object"))throw TypeError("cached tools/list document has a malformed tools array");return t}catch(t){this._reportError(t);return}}};function bR(e){let t;try{t=JSON.stringify(e)}catch(r){throw TypeError(`cache value is not JSON-serializable: ${r instanceof Error?r.message:String(r)}`)}if(typeof t!=="string")throw TypeError("cache value is not JSON-serializable: it has no JSON representation");return t}var vS=Symbol.for("mcp.authSeamEscape");function rt(e){if(typeof e==="object"&&e!==null||typeof e==="function")try{Object.defineProperty(e,vS,{value:!0,configurable:!0})}catch{}return e}function yR(e){return(typeof e==="object"&&e!==null||typeof e==="function")&&e[vS]===!0}var wR=-32022,zR=new Set([-32001,-32020,-32021]);function RR(e,t){switch(e.kind){case"result":return xR(e.result,t);case"rpc-error":return bS(e,t);case"http-error":return kR(e,t);case"network-error":return Hg(e.error,t);case"unusable-reply":return{kind:"error",error:new L(A.EraNegotiationFailed,`Version negotiation probe failed: the server answered with an unusable reply (${yS(e.error)})`,{cause:e.error},{cause:e.error})};case"auth-required":return{kind:"error",error:e.error};case"closed":if(t.transportKind==="stdio")return{kind:"legacy"};return Hg(Error("Connection closed during the version negotiation probe"),t);case"timeout":if(t.transportKind==="stdio")return{kind:"legacy"};return{kind:"error",error:new L(A.RequestTimeout,`Version negotiation probe timed out after ${e.timeoutMs}ms`,{timeout:e.timeoutMs})}}}function xR(e,t){let r=Qt(Gc).validateResult("server/discover",e);if(!r.ok)return{kind:"legacy"};let o=r.value.supportedVersions,s=t.clientModernVersions.find((n)=>o.includes(n));if(s!==void 0)return{kind:"modern",version:s,discover:r.value};if(t.fallbackAvailable)return{kind:"legacy"};return{kind:"error",error:new da({supported:[...o],requested:t.requestedVersion})}}function bS(e,t){let{code:r,message:o,data:s}=e;if(r===wR){let n=TR(s);if(n===void 0)return{kind:"legacy"};let i=new da({supported:n,requested:ER(s)??t.requestedVersion},o),a=la(n),c=t.clientModernVersions.find((l)=>a.includes(l));if(c!==void 0)return{kind:"corrective",version:c,error:i};if(a.length>0)return{kind:"error",error:i};return t.fallbackAvailable?{kind:"legacy"}:{kind:"error",error:i}}if(zR.has(r))return{kind:"legacy"};return{kind:"legacy"}}function kR(e,t){if(e.status===401||e.status===403){let o=e.status===403;return{kind:"error",error:new St(o?A.ClientHttpForbidden:A.ClientHttpAuthentication,`Version negotiation failed: ${o?"the server denied access (HTTP 403)":"the server requires authorization (HTTP 401)"}`,{status:e.status,statusText:e.statusText,text:e.body})}}if(e.status>=500)return{kind:"error",error:new St(A.EraNegotiationFailed,`Version negotiation failed: the server answered the probe with HTTP ${e.status}`,{status:e.status,statusText:e.statusText,text:e.body})};let r=$R(e.body);if(r!==void 0)return bS(r,t);return{kind:"legacy"}}function Hg(e,t){if(t.environment==="browser"&&PR(e))return{kind:"legacy"};return{kind:"error",error:new L(A.EraNegotiationFailed,`Version negotiation probe failed: ${yS(e)}`,{cause:e},{cause:e})}}function PR(e){return e instanceof TypeError||e instanceof Error&&e.name==="TypeError"}function yS(e){return e instanceof Error?e.message:String(e)}function TR(e){if(typeof e!=="object"||e===null)return;let t=e.supported;if(!Array.isArray(t)||t.length===0||!t.every((r)=>typeof r==="string"))return;return t}function ER(e){if(typeof e!=="object"||e===null)return;let t=e.requested;return typeof t==="string"?t:void 0}function $R(e){if(e===void 0||e==="")return;let t;try{t=JSON.parse(e)}catch{return}if(typeof t!=="object"||t===null)return;let r=t.error;if(typeof r!=="object"||r===null)return;let{code:o,message:s,data:n}=r;if(typeof o!=="number")return;return{code:o,message:typeof s==="string"?s:"",data:n}}var CR="legacy";function IR(e,t){let r=e?.mode??CR;if(r==="legacy")return{kind:"legacy"};let o=e?.probe??{};if(typeof r==="object"){if(!Mt(r.pin))throw TypeError(`versionNegotiation: { pin: '${r.pin}' } is not a modern protocol revision — pinning is for 2026-07-28 and later; omit versionNegotiation (or use mode: 'legacy') for 2025-era servers.`);return{kind:"pin",version:r.pin,probe:o}}let s=t?la(t):[];return{kind:"auto",modernVersions:s.length>0?s:[...od],fallbackAvailable:t?sd(t).length>0:!0,probe:o}}function Fg(){let e=globalThis;return e.window!==void 0&&e.document!==void 0?"browser":"node"}function Vg(e){return"stderr"in e&&"pid"in e?"stdio":"http"}var qR=class e{_pending;_probeCounter=0;_savedOnMessage;_savedOnError;_savedOnClose;_closeDelivered=!1;constructor(t){this._transport=t,this._savedOnMessage=t.onmessage,this._savedOnError=t.onerror,this._savedOnClose=t.onclose}static async open(t){let r=new e(t);t.onmessage=(o)=>{let s=r._pending;if(s!==void 0&&(ho(o)||fo(o))&&o.id===s.id){if(r._pending=void 0,ho(o))s.resolve({kind:"response",result:o.result});else s.resolve({kind:"response",error:o.error});return}},t.onerror=(o)=>{r._savedOnError?.(o)},t.onclose=()=>{let o=r._pending;if(o!==void 0)r._pending=void 0,o.resolve({kind:"closed"});r._closeDelivered=!0,r._savedOnClose?.()};try{await t.start()}catch(o){throw r.detach(),o}return r}async exchange(t,r){let o=`server-discover-probe-${++this._probeCounter}`;return new Promise((s)=>{let n=!1,i=(c)=>{if(n)return;if(n=!0,clearTimeout(a),this._pending?.id===o)this._pending=void 0;s(c)},a=setTimeout(()=>i({kind:"timeout"}),r);this._pending={id:o,resolve:i},this._transport.send(t(o)).catch((c)=>i({kind:"send-error",error:c}))})}detach(){if(this._pending=void 0,this._transport.onmessage=this._savedOnMessage,this._transport.onerror=this._savedOnError,this._closeDelivered&&this._savedOnClose!==void 0){let t=this._savedOnClose,r=this._transport,o=!1,s=()=>{if(!o){o=!0;return}t()};r.onclose=s,Pd.set(r,()=>{if(r.onclose===s)r.onclose=t})}else this._transport.onclose=this._savedOnClose}release(){this.detach();let t=this._transport,r=t.start,o=!0;t.start=async function(){if(o){o=!1,t.start=r;return}return r.call(t)}}},Pd=new WeakMap;function Bg(e){let t=Pd.get(e);Pd.delete(e),t?.()}function OR(e,t,r,o){return{jsonrpc:"2.0",id:e,method:"server/discover",params:{_meta:Qt(t).outboundEnvelope({protocolVersion:t,clientInfo:r,clientCapabilities:o})}}}function NR(e){if(e instanceof L&&e.code===A.ClientHttpUnexpectedContent)return!0;return e instanceof Error&&e.name==="SyntaxError"}function jR(e,t){switch(e.kind){case"response":return e.error===void 0?{kind:"result",result:e.result}:{kind:"rpc-error",...e.error};case"send-error":{let r=e.error;if(yR(r)||r instanceof bt||r instanceof Error&&r.name==="UnauthorizedError")return{kind:"auth-required",error:r};if(r instanceof St){let o=r.data?.text;return{kind:"http-error",status:r.data.status,body:typeof o==="string"?o:void 0,statusText:r.data.statusText}}if(NR(r))return{kind:"unusable-reply",error:r};return{kind:"network-error",error:r}}case"closed":return{kind:"closed"};case"timeout":return{kind:"timeout",timeoutMs:t}}}async function wS(e,t){let r=e.probe.timeoutMs??t.defaultTimeoutMs,o=Math.max(0,e.probe.maxRetries??0),s=e.kind==="pin"?[e.version]:e.modernVersions,n=e.kind==="auto"&&e.fallbackAvailable,i=await qR.open(t.transport),a=async()=>{let l=s[0],d=!1,f=o;for(;;){let h=await i.exchange((_)=>OR(_,l,t.clientInfo,t.capabilities),r);if(h.kind==="timeout"&&f>0){f--;continue}let g=jR(h,r),v=RR(g,{clientModernVersions:s,requestedVersion:l,fallbackAvailable:n,environment:t.environment,transportKind:t.transportKind});switch(v.kind){case"modern":return{era:"modern",version:v.version,discover:v.discover};case"corrective":if(d)throw v.error;d=!0,l=v.version;continue;case"legacy":{let _=g.kind==="closed"?"the connection closed during the server/discover probe":void 0;if(e.kind==="pin")throw new L(A.EraNegotiationFailed,_===void 0?`Version negotiation failed: the server did not offer pinned protocol version ${e.version} via server/discover (no fallback in pin mode)`:`Version negotiation failed: ${_} before the server offered pinned protocol version ${e.version} (no fallback in pin mode)`);if(!e.fallbackAvailable)throw new L(A.EraNegotiationFailed,_===void 0?"Version negotiation failed: the server gave no modern evidence and this client supports no pre-2026-07-28 protocol version to fall back to":`Version negotiation failed: ${_} and this client supports no pre-2026-07-28 protocol version to fall back to`);if(_!==void 0&&t.disposableProbe!==!0)throw new L(A.EraNegotiationFailed,`Version negotiation failed: ${_} (this transport probed in place — the disposable sibling probe requires the SDK's base StdioClientTransport)`);return{era:"legacy"}}case"error":throw v.error}}},c;try{c=await a()}catch(l){throw i.detach(),l}return i.release(),c}function MR(e){let t=Object.getPrototypeOf(e);if(t===null||!Object.prototype.hasOwnProperty.call(t,"_dispose"))return;let r=e._serverParams;return typeof r==="object"&&r!==null&&typeof r.command==="string"?r:void 0}async function AR(e,t,r,o){let n=new t.constructor({...r,stderr:"ignore"}),i=t.close,a=!1,c,l=new Promise((f,h)=>{c=()=>h(Jg())});t.close=async function(){return a=!0,c?.(),i.call(t)};let d;try{let f=wS(e,{...o,transport:n,transportKind:"stdio",disposableProbe:!0});f.catch(()=>{}),d=await Promise.race([f,l])}finally{await LR(n),t.close=i}if(a)throw Jg();return d}function Jg(){return new L(A.EraNegotiationFailed,"Version negotiation failed: the transport was closed during the server/discover probe")}async function LR(e){try{let t=e._dispose;await(typeof t==="function"?t.call(e):e.close())}catch{}}function Wg(e){let t=e._meta?.[It];return hd.Implementation(t)?t:void 0}function tu(e,t){if(!e||t===null||typeof t!=="object")return;if(e.type==="object"&&e.properties&&typeof e.properties==="object"){let r=t,o=e.properties;for(let s of Object.keys(o)){let n=o[s];if(r[s]===void 0&&Object.prototype.hasOwnProperty.call(n,"default"))r[s]=n.default;if(r[s]!==void 0)tu(n,r[s])}}if(Array.isArray(e.anyOf)){for(let r of e.anyOf)if(typeof r!=="boolean")tu(r,t)}if(Array.isArray(e.oneOf)){for(let r of e.oneOf)if(typeof r!=="boolean")tu(r,t)}}function zS(e){if(!e)return{supportsFormMode:!1,supportsUrlMode:!1};let t=e.form!==void 0,r=e.url!==void 0;return{supportsFormMode:t||!t&&!r,supportsUrlMode:r}}function UR(e){if(typeof e==="object"&&e!==null){if(e.kind==="legacy"&&!("supportedVersions"in e)&&!("discover"in e))return e;if(e.kind==="modern"&&_r.safeParse(e.discover).success)return e}throw new L(A.EraNegotiationFailed,"connect({ prior }): unrecognized prior — expected { kind: 'modern', discover } or { kind: 'legacy' }")}var Kg={"notifications/tools/list_changed":["tools/list"],"notifications/prompts/list_changed":["prompts/list"],"notifications/resources/list_changed":["resources/list","resources/templates/list"]},DR=64,Rd={},Nd=class extends ma{_serverCapabilities;_serverVersion;_capabilities;_instructions;_jsonSchemaValidator;_cache;_defaultCacheTtlMs;_listMaxPages;_listChangedDebounceTimers=new Map;_listChangedConfig;_enforceStrictCapabilities;_versionNegotiation;_supportedProtocolVersionsOption;_inputRequiredDriverConfig;_listenState=new Map;_nextListenId=0;_autoOpenedSubscription;_discoverResult;static{Rd.enforceStrictCapabilities=(e)=>e._enforceStrictCapabilities,Rd.walkPages=(e,t,r,o)=>e._walkPages(t,r,o),Rd.readResource=(e,t,r)=>e._readResource(t,r)}_resetConnectionState(){if(this._negotiatedProtocolVersion=void 0,this._serverCapabilities=void 0,this._serverVersion=void 0,this._instructions=void 0,this._discoverResult=void 0,this._autoOpenedSubscription=void 0,this._listenState.size>0){let e=new L(A.ConnectionClosed,"subscriptions/listen: client reconnected or closed; subscription state from the previous connection was reset");for(let t of this._listenState.values())t.settle({cause:"remote",error:e})}this._listenState.clear();for(let e of this._listChangedDebounceTimers.values())clearTimeout(e);this._listChangedDebounceTimers.clear(),this._cache.resetForReconnect()}async close(){try{await super.close()}finally{this._resetConnectionState()}}constructor(e,t){super(t);if(this._clientInfo=e,this._capabilities=t?.capabilities?{...t.capabilities}:{},this._jsonSchemaValidator=t?.jsonSchemaValidator??new Xc,this._enforceStrictCapabilities=t?.enforceStrictCapabilities??!1,this._versionNegotiation=t?.versionNegotiation,this._supportedProtocolVersionsOption=t?.supportedProtocolVersions,this._inputRequiredDriverConfig=kg(t?.inputRequired),this._cache=new vR(t?.responseCacheStore??new gS,t?.responseCacheStore!==void 0,(r)=>this._reportStoreError(r),t?.cachePartition??""),this._defaultCacheTtlMs=t?.defaultCacheTtlMs??0,this._listMaxPages=t?.listMaxPages??DR,t?.listChanged)this._listChangedConfig=t.listChanged}buildContext(e,t){return e}_shouldDropInbound(e){if(this._negotiatedProtocolVersion!==void 0&&Mt(this._negotiatedProtocolVersion)&&wr(e))return"drop"}_outboundMetaEnvelope(){let e=this._negotiatedProtocolVersion;if(e===void 0)return;return this._wireCodec().outboundEnvelope({protocolVersion:e,clientInfo:this._clientInfo,clientCapabilities:this._capabilities})}_resolveNonCompleteResult(e,t){if(!this._inputRequiredDriverConfig.autoFulfill)return Promise.reject(new L(A.UnsupportedResultType,`Unsupported result type 'input_required' for ${t.request.method}: multi-round-trip auto-fulfilment is not enabled on this instance — pass allowInputRequired: true to handle it manually, or enable inputRequired.autoFulfill`,{resultType:"input_required",method:t.request.method}));return $g({getRequestHandler:(r)=>this._getRequestHandler(r),buildContext:(r)=>this.buildContext(r,void 0),sessionId:this.transport?.sessionId},this._inputRequiredDriverConfig,e,t)}_setupListChangedHandlers(e){if(e.tools&&this._serverCapabilities?.tools?.listChanged)this._setupListChangedHandler("tools","notifications/tools/list_changed",e.tools,async()=>(await this.listTools(void 0,{cacheMode:"refresh"})).tools);if(e.prompts&&this._serverCapabilities?.prompts?.listChanged)this._setupListChangedHandler("prompts","notifications/prompts/list_changed",e.prompts,async()=>(await this.listPrompts(void 0,{cacheMode:"refresh"})).prompts);if(e.resources&&this._serverCapabilities?.resources?.listChanged)this._setupListChangedHandler("resources","notifications/resources/list_changed",e.resources,async()=>(await this.listResources(void 0,{cacheMode:"refresh"})).resources)}registerCapabilities(e){if(this.transport)throw Error("Cannot register capabilities after connecting to transport");this._capabilities=_d(this._capabilities,e)}setVersionNegotiation(e){if(this.transport)throw Error("Cannot configure version negotiation after connecting to transport");this._versionNegotiation=e}_wrapHandler(e,t){if(e==="elicitation/create")return async(r,o)=>{let s=Qt(this._negotiatedProtocolVersion),n=s.validateRequest("elicitation/create",r);if(!n.ok&&n.reason==="not-in-era")n=s.validateInputRequest("elicitation/create",r);if(!n.ok)throw new se(n.reason==="not-in-era"?W.InternalError:W.InvalidParams,n.reason==="not-in-era"?"No wire schema for elicitation/create in the resolved era":`Invalid elicitation request: ${n.message}`);let{params:i}=n.value;i.mode=i.mode??"form";let{supportsFormMode:a,supportsUrlMode:c}=zS(this._capabilities.elicitation);if(i.mode==="form"&&!a)throw new se(W.InvalidParams,"Client does not support form-mode elicitation requests");if(i.mode==="url"&&!c)throw new se(W.InvalidParams,"Client does not support URL-mode elicitation requests");let l=await t(r,o),d=s.validateResult("elicitation/create",l);if(!d.ok&&d.reason==="not-in-era")d=s.validateInputResponse("elicitation/create",l);if(!d.ok)throw new se(d.reason==="not-in-era"?W.InternalError:W.InvalidParams,d.reason==="not-in-era"?"No wire schema for elicitation/create in the resolved era":`Invalid elicitation result: ${d.message}`);let f=d.value,h=i.mode==="form"?i.requestedSchema:void 0;if(i.mode==="form"&&f.action==="accept"&&f.content&&h&&this._capabilities.elicitation?.form?.applyDefaults)try{tu(h,f.content)}catch{}return f};if(e==="sampling/createMessage")return async(r,o)=>{let s=Qt(this._negotiatedProtocolVersion),n=s.validateRequest("sampling/createMessage",r);if(!n.ok&&n.reason==="not-in-era")n=s.validateInputRequest("sampling/createMessage",r);if(!n.ok)throw new se(n.reason==="not-in-era"?W.InternalError:W.InvalidParams,n.reason==="not-in-era"?"No wire schema for sampling/createMessage in the resolved era":`Invalid sampling request: ${n.message}`);let{params:i}=n.value,a=await t(r,o),c=Boolean(i.tools||i.toolChoice),l=s.samplingResultVariant(c,a);if(!l.ok&&l.reason==="not-in-era")l=s.validateInputResponse("sampling/createMessage",a);if(!l.ok)throw new se(l.reason==="not-in-era"?W.InternalError:W.InvalidParams,l.reason==="not-in-era"?"No result schema for sampling/createMessage in the resolved era":`Invalid sampling result: ${l.message}`);return l.value};return t}assertCapability(e,t){if(!this._serverCapabilities?.[e])throw new L(A.CapabilityNotSupported,`Server does not support ${e} (required for ${t})`)}async connect(e,t){if(t?.prior!=null)return this._connectFromPrior(e,UR(t.prior),t);let r=IR(this._versionNegotiation,this._supportedProtocolVersionsOption);if(r.kind!=="legacy")return this._connectNegotiated(e,r,t);return this._connectPlainLegacy(e,t)}async _connectPlainLegacy(e,t){if(await super.connect(e),e.sessionId!==void 0){let r=this._negotiatedProtocolVersion;if(r!==void 0)e.setProtocolVersion?.(r);return}this._resetConnectionState(),await this._legacyHandshake(e,t)}async _legacyHandshake(e,t){let r=sd(this._supportedProtocolVersions);try{let o=r[0];if(o===void 0)throw new L(A.EraNegotiationFailed,"Cannot run the initialize handshake: supportedProtocolVersions contains no pre-2026-07-28 protocol version");let s=await this.request({method:"initialize",params:{protocolVersion:o,capabilities:this._capabilities,clientInfo:this._clientInfo}},t);if(s===void 0)throw Error(`Server sent invalid initialize result: ${s}`);if(!r.includes(s.protocolVersion))throw Error(`Server's protocol version is not supported: ${s.protocolVersion}`);if(this._serverCapabilities=s.capabilities,this._serverVersion=s.serverInfo,this._cache.setServerIdentity(this._deriveServerIdentity(e)),e.setProtocolVersion)e.setProtocolVersion(s.protocolVersion);if(this._instructions=s.instructions,await this.notification({method:"notifications/initialized"}),this._negotiatedProtocolVersion=s.protocolVersion,this._listChangedConfig)this._setupListChangedHandlers(this._listChangedConfig)}catch(o){throw this.close(),o}}async _connectNegotiated(e,t,r){if(e.sessionId!==void 0){await super.connect(e);let s=this._negotiatedProtocolVersion;if(s!==void 0&&e.setProtocolVersion)e.setProtocolVersion(s);return}this._resetConnectionState();let o;try{let s=Vg(e),n={clientInfo:this._clientInfo,capabilities:this._capabilities,environment:Fg(),defaultTimeoutMs:r?.timeout??pa},i=s==="stdio"?MR(e):void 0;o=i===void 0?await wS(t,{...n,transport:e,transportKind:s}):await AR(t,e,i,n)}catch(s){throw await e.close().catch(()=>{}),Bg(e),s}if(Bg(e),await super.connect(e),o.era==="legacy"){await this._legacyHandshake(e,r);return}if(this._serverCapabilities=o.discover.capabilities,this._serverVersion=Wg(o.discover),this._cache.setServerIdentity(this._deriveServerIdentity(e)),this._instructions=o.discover.instructions,this._discoverResult=o.discover,this._negotiatedProtocolVersion=o.version,e.setProtocolVersion)e.setProtocolVersion(o.version);if(this._listChangedConfig){let s=this._listChangedConfig,n=this._serverCapabilities,i={...s.tools&&n?.tools?.listChanged&&{tools:s.tools},...s.prompts&&n?.prompts?.listChanged&&{prompts:s.prompts},...s.resources&&n?.resources?.listChanged&&{resources:s.resources}},a=!0;try{this._setupListChangedHandlers(i)}catch(l){a=!1,this.onerror?.(l instanceof Error?l:Error(String(l)))}let c=a?{...i.tools&&{toolsListChanged:!0},...i.prompts&&{promptsListChanged:!0},...i.resources&&{resourcesListChanged:!0}}:{};if(Object.keys(c).length>0){let l=new AbortController,d=()=>l.abort(r?.signal?.reason);if(r?.signal?.aborted)d();r?.signal?.addEventListener("abort",d);try{this._autoOpenedSubscription=await this.listen(c,{timeout:r?.timeout,signal:l.signal})}catch(f){if(r?.signal?.aborted)throw await this.close().catch(()=>{}),f;this.onerror?.(f instanceof Error?f:Error(String(f)))}finally{r?.signal?.removeEventListener("abort",d)}}}}async _connectFromPrior(e,t,r){if(t.kind==="legacy")return this._connectPlainLegacy(e,r);let o=t.discover;this._resetConnectionState();let s=this._supportedProtocolVersionsOption,n=(s&&la(s).length>0?la(s):od).find((i)=>o.supportedVersions.includes(i));if(n===void 0)throw new L(A.EraNegotiationFailed,"connect({ prior }) with a modern verdict requires a 2026-07-28+ mutual protocol version; the supplied DiscoverResult and this client's supportedProtocolVersions have no modern overlap. For a server known to be legacy, pass prior: { kind: 'legacy' } to skip the probe and initialize directly, or use versionNegotiation: { mode: 'auto' } to re-probe with legacy fallback.");if(await super.connect(e),this._discoverResult=o,this._serverCapabilities=o.capabilities,this._serverVersion=Wg(o),this._cache.setServerIdentity(this._deriveServerIdentity(e)),this._instructions=o.instructions,this._negotiatedProtocolVersion=n,e.setProtocolVersion?.(n),this._listChangedConfig)try{this._setupListChangedHandlers(this._listChangedConfig)}catch(i){this.onerror?.(i instanceof Error?i:Error(String(i)))}}getServerCapabilities(){return this._serverCapabilities}getServerVersion(){return this._serverVersion}_deriveServerIdentity(e){let t=this._serverVersion;if(t!==void 0)return`${t.name}@${t.version}`;return e.sessionId??`anonymous:${Date.now()}-${Math.random().toString(36).slice(2)}`}getNegotiatedProtocolVersion(){return this._negotiatedProtocolVersion}getProtocolEra(){let e=this._negotiatedProtocolVersion;if(e===void 0)return;return Mt(e)?"modern":"legacy"}getInstructions(){return this._instructions}getDiscoverResult(){return this._discoverResult}assertCapabilityForMethod(e){switch(e){case"logging/setLevel":if(!this._serverCapabilities?.logging)throw new L(A.CapabilityNotSupported,`Server does not support logging (required for ${e})`);break;case"prompts/get":case"prompts/list":if(!this._serverCapabilities?.prompts)throw new L(A.CapabilityNotSupported,`Server does not support prompts (required for ${e})`);break;case"resources/list":case"resources/templates/list":case"resources/read":case"resources/subscribe":case"resources/unsubscribe":if(!this._serverCapabilities?.resources)throw new L(A.CapabilityNotSupported,`Server does not support resources (required for ${e})`);if(e==="resources/subscribe"&&!this._serverCapabilities.resources.subscribe)throw new L(A.CapabilityNotSupported,`Server does not support resource subscriptions (required for ${e})`);break;case"tools/call":case"tools/list":if(!this._serverCapabilities?.tools)throw new L(A.CapabilityNotSupported,`Server does not support tools (required for ${e})`);break;case"completion/complete":if(!this._serverCapabilities?.completions)throw new L(A.CapabilityNotSupported,`Server does not support completions (required for ${e})`);break;case"initialize":break;case"server/discover":break;case"ping":break}}assertNotificationCapability(e){switch(e){case"notifications/roots/list_changed":if(!this._capabilities.roots?.listChanged)throw new L(A.CapabilityNotSupported,`Client does not support roots list changed notifications (required for ${e})`);break;case"notifications/initialized":break;case"notifications/cancelled":break;case"notifications/progress":break}}assertRequestHandlerCapability(e){switch(e){case"sampling/createMessage":if(!this._capabilities.sampling)throw new L(A.CapabilityNotSupported,`Client does not support sampling capability (required for ${e})`);break;case"elicitation/create":if(!this._capabilities.elicitation)throw new L(A.CapabilityNotSupported,`Client does not support elicitation capability (required for ${e})`);break;case"roots/list":if(!this._capabilities.roots)throw new L(A.CapabilityNotSupported,`Client does not support roots capability (required for ${e})`);break;case"ping":break}}async ping(e){return this.request({method:"ping"},e)}async discover(e){let t=await this._requestWithSchema({method:"server/discover"},_r,e);return this._discoverResult=t,t}async complete(e,t){return this.request({method:"completion/complete",params:e},t)}async setLoggingLevel(e,t){return this.request({method:"logging/setLevel",params:{level:e}},t)}async getPrompt(e,t){return this.request({method:"prompts/get",params:e},t)}async listPrompts(e,t){if(!this._serverCapabilities?.prompts&&!this._enforceStrictCapabilities)return console.debug("Client.listPrompts() called but server does not advertise prompts capability - returning empty list"),{prompts:[]};if(e?.cursor!==void 0)return this.request({method:"prompts/list",params:e},t);let r=await this._serveFromCache("prompts/list",void 0,t);if(r!==void 0)return r;return this._listAllPages("prompts/list",e,t,(o)=>o.prompts)}async listResources(e,t){if(!this._serverCapabilities?.resources&&!this._enforceStrictCapabilities)return console.debug("Client.listResources() called but server does not advertise resources capability - returning empty list"),{resources:[]};if(e?.cursor!==void 0)return this.request({method:"resources/list",params:e},t);let r=await this._serveFromCache("resources/list",void 0,t);if(r!==void 0)return r;return this._listAllPages("resources/list",e,t,(o)=>o.resources)}async listResourceTemplates(e,t){if(!this._serverCapabilities?.resources&&!this._enforceStrictCapabilities)return console.debug("Client.listResourceTemplates() called but server does not advertise resources capability - returning empty list"),{resourceTemplates:[]};if(e?.cursor!==void 0)return this.request({method:"resources/templates/list",params:e},t);let r=await this._serveFromCache("resources/templates/list",void 0,t);if(r!==void 0)return r;return this._listAllPages("resources/templates/list",e,t,(o)=>o.resourceTemplates)}async _listAllPages(e,t,r,o,s){let n=r?.cacheMode==="bypass",i=this._cache.captureGeneration(e),a=(l)=>{let d=l===void 0?t&&{...t}:{...t,cursor:l};return this.request({method:e,...d&&{params:d}},r)},c=await this._walkPages(e,a,o);if(delete c.nextCursor,s?.(c),n)return c;return await this._cache.write(e,c,i,this._freshness(c)),c}async _walkPages(e,t,r){let o=await t(void 0),s=o.nextCursor,n=o,i=1;while(s!==void 0){if(this._listMaxPages!==0&&i>=this._listMaxPages)throw new L(A.ListPaginationExceeded,`${e}: exceeded listMaxPages (${this._listMaxPages}); server pagination did not terminate`,{method:e,listMaxPages:this._listMaxPages});let a=await t(s);if(a.nextCursor===s&&JSON.stringify(r(a))===JSON.stringify(r(n)))break;r(o).push(...r(a)),n=a,s=a.nextCursor,i++}return o}_freshness(e,t){let r=e,o=typeof r.ttlMs==="number"?r.ttlMs:this._defaultCacheTtlMs,s=r.cacheScope==="public"?"public":"private";return{expiresAt:this._cache.now()+Math.min(Math.max(0,o),SS),scope:s,params:t}}async _serveFromCache(e,t,r){if(r?.cacheMode==="bypass"||r?.cacheMode==="refresh")return;let o=await this._cache.read(e,t).catch((s)=>void this._reportStoreError(s));if(o!==void 0){if(r?.signal?.aborted){let s=r.signal.reason;throw s instanceof L?s:new L(A.RequestTimeout,String(s))}return o.value}}_reportStoreError(e){this.onerror?.(e instanceof Error?e:Error(String(e)))}_compileOutputValidator(e){if(!e.outputSchema)return;try{return{ok:!0,validator:this._jsonSchemaValidator.getValidator(e.outputSchema)}}catch(t){return{ok:!1,compileError:t}}}async _resolveXMcpHeaderScan(e,t){let r=t??await this._cache.toolDefinition(e);return r===void 0?void 0:dd(r.inputSchema)}async readResource(e,t){let{result:r}=await this._readResource(e,t);return r}async _readResource(e,t){let r=await this._serveFromCache("resources/read",e.uri,t);if(r!==void 0)return{result:r,cached:!0};let o=this._cache.captureGeneration("resources/read",e.uri),s=await this.request({method:"resources/read",params:e},t);if(t?.cacheMode!=="bypass"){let n=this._freshness(s,e.uri);if(n.expiresAt>this._cache.now())await this._cache.write("resources/read",s,o,n);else if(t?.cacheMode==="refresh")await this._cache.evictKey("resources/read",e.uri)}return{result:s,cached:!1}}async subscribeResource(e,t){return this.request({method:"resources/subscribe",params:e},t)}async unsubscribeResource(e,t){return this.request({method:"resources/unsubscribe",params:e},t)}async listen(e,t){if(this.transport===void 0)throw new L(A.NotConnected,"Not connected");let r=this._negotiatedProtocolVersion;if(r===void 0||!Mt(r))throw new L(A.MethodNotSupportedByProtocolVersion,`subscriptions/listen requires a 2026-07-28-era connection (negotiated: ${r??"none"}). On a 2025-era connection, change notifications are delivered unsolicited: use ClientOptions.listChanged and resources/subscribe instead.`,{method:"subscriptions/listen",protocolVersion:r});if(t?.signal?.aborted){let k=t.signal.reason;throw k instanceof L?k:new L(A.RequestTimeout,String(k))}let o=new AbortController,s=`listen:${this._nextListenId++}`,n="opening",i,a,c,l,d=new Promise((k,P)=>{c=k,l=P}),f,h=new Promise((k)=>{f=k}),g=(k)=>{if(n==="closed")return;let P=n==="opening";if(i!==void 0)clearTimeout(i),i=void 0;if("ack"in k){n="open",c(k.ack);return}if(n="closed",a!==void 0)t?.signal?.removeEventListener("abort",a);if(this._listenState.delete(s),o.abort(),f(k.cause),P)l(k.error??new L(A.ConnectionClosed,"subscriptions/listen closed before the server acknowledged"))},v=async()=>{o.abort(),await this.notification({method:"notifications/cancelled",params:{requestId:s}}).catch(()=>{})},_=async()=>{if(n==="closed")return;g({cause:"local"}),await v()};this._listenState.set(s,{settle:g});let y=t?.timeout??pa;if(i=setTimeout(()=>{g({cause:"remote",error:new L(A.RequestTimeout,"subscriptions/listen ack timed out",{timeout:y})}),v().catch(()=>{})},y),t?.signal){let k=t.signal;a=()=>{if(n==="closed")return;let P=k.reason;g({cause:"local",error:P instanceof Error?P:Error(String(P??"Aborted"))}),v().catch(()=>{})},k.addEventListener("abort",a,{once:!0})}let T={jsonrpc:"2.0",id:s,method:"subscriptions/listen",params:{_meta:{...this._outboundMetaEnvelope()},notifications:e}},O=(k)=>{g({cause:"remote",error:k instanceof Error?k:Error(String(k))})};try{this.transport.send(T,{requestSignal:o.signal,onRequestStreamEnd:()=>g({cause:"remote",error:Error("subscriptions/listen: stream ended")})}).catch(O)}catch(k){O(k)}return{honoredFilter:await d,close:_,closed:h}}get autoOpenedSubscription(){return this._autoOpenedSubscription}_onnotification(e,t){let r=Object.hasOwn(Kg,e.method)?Kg[e.method]:void 0;if(e.method==="notifications/resources/updated"){let o=e.params?.uri;if(typeof o==="string")this._cache.evictKey("resources/read",o)}else if(r!==void 0)for(let o of r)this._cache.evict(o);if(e.method==="notifications/subscriptions/acknowledged"){let o=e.params?._meta?.[Zo],s=typeof o==="string"?this._listenState.get(o):void 0;if(s!==void 0){let n=this._wireCodec().validateNotification("notifications/subscriptions/acknowledged",e);s.settle({ack:n.ok?n.value.params.notifications:{}});return}}if(e.method==="notifications/cancelled"){let o=e.params?.requestId,s=typeof o==="string"?this._listenState.get(o):void 0;if(s!==void 0){s.settle({cause:"remote",error:Error("subscriptions/listen: server cancelled the subscription")});return}}super._onnotification(e,t)}_onresponse(e){let t=e.id,r=typeof t==="string"?this._listenState.get(t):void 0;if(r!==void 0){if(fo(e))r.settle({cause:"remote",error:se.fromError(e.error.code,e.error.message,e.error.data)});else r.settle({cause:"graceful",error:new L(A.ConnectionClosed,"subscriptions/listen: server closed the subscription gracefully before acknowledging")});return}super._onresponse(e)}_onclose(){if(this._listenState.size>0){let e=new L(A.ConnectionClosed,"Connection closed");for(let t of this._listenState.values())t.settle({cause:"remote",error:e});this._listenState.clear()}super._onclose()}async callTool(e,t){let r=this.getProtocolEra()==="modern"&&Fg()!=="browser",o=async()=>{if(!r)return t;let c;try{c=await this._resolveXMcpHeaderScan(e.name,t?.toolDefinition)}catch(d){this._reportStoreError(d)}if(!c?.valid||c.declarations.length===0)return t;let l=zg(c.declarations,e.arguments);return Object.keys(l).length===0?t:{...t,headers:{...t?.headers,...l}}},s=t?.toolDefinition===void 0?await this._cache.outputValidator(e.name,(c)=>this._compileOutputValidator(c)).catch((c)=>void this._reportStoreError(c)):this._compileOutputValidator(t.toolDefinition),n=()=>{if(s===void 0||s.ok)return;let c=s.compileError,l=(c instanceof Error?c.message:String(c)).slice(0,200);throw new se(W.InvalidParams,`Tool '${e.name}' has an invalid outputSchema: ${l}`)};n();let i;try{i=await this.request({method:"tools/call",params:e},await o())}catch(c){let l=c instanceof se&&c.code===Ss;if(!r||!l||t?.toolDefinition!==void 0)throw c;let d={signal:t?.signal,timeout:t?.timeout,cacheMode:"refresh"};await this._cache.evict("tools/list"),await this.listTools(void 0,d).catch((f)=>this._reportStoreError(f)),s=await this._cache.outputValidator(e.name,(f)=>this._compileOutputValidator(f)).catch((f)=>void this._reportStoreError(f)),n(),i=await this.request({method:"tools/call",params:e},await o())}let a=s!==void 0&&s.ok?s.validator:void 0;if(a){if(i.structuredContent===void 0&&!i.isError)throw new se(W.InvalidRequest,`Tool ${e.name} has an output schema but did not return structured content`);if(i.structuredContent!==void 0&&!i.isError)try{let c=a(i.structuredContent);if(!c.valid)throw new se(W.InvalidParams,`Structured content does not match the tool's output schema: ${c.errorMessage}`)}catch(c){if(c instanceof se)throw c;throw new se(W.InvalidParams,`Failed to validate structured content: ${c instanceof Error?c.message:String(c)}`)}}return i}async listTools(e,t){if(!this._serverCapabilities?.tools&&!this._enforceStrictCapabilities)return console.debug("Client.listTools() called but server does not advertise tools capability - returning empty list"),{tools:[]};if(e?.cursor!==void 0){let o=await this.request({method:"tools/list",params:e},t);return this._excludeInvalidXMcpHeaderTools(o),o}let r=await this._serveFromCache("tools/list",void 0,t);if(r!==void 0)return r;return this._listAllPages("tools/list",e,t,(o)=>o.tools,(o)=>this._excludeInvalidXMcpHeaderTools(o))}_excludeInvalidXMcpHeaderTools(e){if(this.getProtocolEra()!=="modern"||!this.transport||Vg(this.transport)==="stdio")return;let t=e.tools.filter((r)=>{let o=dd(r.inputSchema);if(!o.valid)return console.warn(`[mcp-sdk] excluding tool '${r.name}' from tools/list: invalid x-mcp-header declaration — ${o.reason}`),!1;return!0});if(t.length!==e.tools.length)e.tools=t}_setupListChangedHandler(e,t,r,o){let s=Yc(yi,r);if(!s.success)throw Error(`Invalid ${e} listChanged options: ${s.error.message}`);if(typeof r.onChanged!=="function")throw TypeError(`Invalid ${e} listChanged options: onChanged must be a function`);let{autoRefresh:n,debounceMs:i}=s.data,{onChanged:a}=r,c=async()=>{if(!n){a(null,null);return}try{a(null,await o())}catch(d){a(d instanceof Error?d:Error(String(d)),null)}},l=()=>{if(i){let d=this._listChangedDebounceTimers.get(e);if(d)clearTimeout(d);let f=setTimeout(c,i);this._listChangedDebounceTimers.set(e,f)}else c()};this.setNotificationHandler(t,l)}async sendRootsListChanged(){return this.notification({method:"notifications/roots/list_changed"})}};class iu extends Error{constructor(e,t){super(e),this.name="ParseError",this.type=t.type,this.field=t.field,this.value=t.value,this.line=t.line}}var RS=10,ZR=13,go=32;function jd(e){}function PS(e){if(typeof e=="function")throw TypeError("`config` must be an object, got a function instead. Did you mean `createParser({onEvent: fn})`?");let{onEvent:t=jd,onError:r=jd,onRetry:o=jd,onComment:s,maxBufferSize:n}=e,i=[],a=0,c=!0,l,d="",f=0,h,g=!1;function v(z){if(g)throw Error("Cannot feed parser: it was terminated after exceeding the configured max buffer size. Call `reset()` to resume parsing.");if(c&&(c=!1,z.charCodeAt(0)===239&&z.charCodeAt(1)===187&&z.charCodeAt(2)===191&&(z=z.slice(3))),i.length===0){let ee=y(z);ee!==""&&(i.push(ee),a=ee.length),_();return}if(z.indexOf(`
73
+ `)===-1&&z.indexOf("\r")===-1){i.push(z),a+=z.length,_();return}i.push(z);let R=i.join("");i.length=0,a=0;let Z=y(R);Z!==""&&(i.push(Z),a=Z.length),_()}function _(){n!==void 0&&(a+d.length<=n||(g=!0,i.length=0,a=0,l=void 0,d="",f=0,h=void 0,r(new iu(`Buffered data exceeded max buffer size of ${n} characters`,{type:"max-buffer-size-exceeded"}))))}function y(z){let R=0;if(z.indexOf("\r")===-1){let Z=z.indexOf(`
74
+ `,R);for(;Z!==-1;){if(R===Z){f>0&&t({id:l,event:h,data:d}),l=void 0,d="",f=0,h=void 0,R=Z+1,Z=z.indexOf(`
75
+ `,R);continue}let ee=z.charCodeAt(R);if(xS(z,R,ee)){let X=z.charCodeAt(R+5)===go?R+6:R+5,ne=z.slice(X,Z);if(f===0&&z.charCodeAt(Z+1)===RS){t({id:l,event:h,data:ne}),l=void 0,d="",h=void 0,R=Z+2,Z=z.indexOf(`
76
76
  `,R);continue}d=f===0?ne:`${d}
77
- ${ne}`,f++}else yS(x,R,ee)?h=x.slice(x.charCodeAt(R+6)===_o?R+7:R+6,Z)||void 0:I(x,R,Z);R=Z+1,Z=x.indexOf(`
78
- `,R)}return x.slice(R)}for(;R<x.length;){let Z=x.indexOf("\r",R),ee=x.indexOf(`
79
- `,R),X=-1;if(Z!==-1&&ee!==-1?X=Z<ee?Z:ee:Z!==-1?Z===x.length-1?X=-1:X=Z:ee!==-1&&(X=ee),X===-1)break;I(x,R,X),R=X+1,x.charCodeAt(R-1)===OR&&x.charCodeAt(R)===vS&&R++}return x.slice(R)}function I(x,R,Z){if(R===Z){z();return}let ee=x.charCodeAt(R);if(bS(x,R,ee)){let re=x.charCodeAt(R+5)===_o?R+6:R+5,de=x.slice(re,Z);d=f===0?de:`${d}
80
- ${de}`,f++;return}if(yS(x,R,ee)){h=x.slice(x.charCodeAt(R+6)===_o?R+7:R+6,Z)||void 0;return}if(ee===105&&x.charCodeAt(R+1)===100&&x.charCodeAt(R+2)===58){let re=x.slice(x.charCodeAt(R+3)===_o?R+4:R+3,Z);re.includes("\x00")||(l=re);return}if(ee===58){if(s){let re=x.slice(R,Z);s(re.slice(x.charCodeAt(R+1)===_o?2:1))}return}let X=x.slice(R,Z),ne=X.indexOf(":");if(ne===-1){A(X,"",X);return}let xe=X.slice(0,ne),te=X.charCodeAt(ne+1)===_o?2:1,ie=X.slice(ne+te);A(xe,ie,X)}function A(x,R,Z){switch(x){case"event":h=R||void 0;break;case"data":d=f===0?R:`${d}
81
- ${R}`,f++;break;case"id":R.includes("\x00")||(l=R);break;case"retry":/^\d+$/.test(R)?o(parseInt(R,10)):r(new ou(`Invalid \`retry\` value: "${R}"`,{type:"invalid-retry",value:R,line:Z}));break;default:r(new ou(`Unknown field "${x.length>20?`${x.slice(0,20)}…`:x}"`,{type:"unknown-field",field:x,value:R,line:Z}));break}}function z(){f>0&&t({id:l,event:h,data:d}),l=void 0,d="",f=0,h=void 0}function q(x={}){if(x.consume&&i.length>0){let R=i.join("");I(R,0,R.length)}c=!0,l=void 0,d="",f=0,h=void 0,i.length=0,a=0,g=!1}return{feed:b,reset:q}}function bS(e,t,r){return r===100&&e.charCodeAt(t+1)===97&&e.charCodeAt(t+2)===116&&e.charCodeAt(t+3)===97&&e.charCodeAt(t+4)===58}function yS(e,t,r){return r===101&&e.charCodeAt(t+1)===118&&e.charCodeAt(t+2)===101&&e.charCodeAt(t+3)===110&&e.charCodeAt(t+4)===116&&e.charCodeAt(t+5)===58}class qd extends TransformStream{constructor({onError:e,onRetry:t,onComment:r,maxBufferSize:o}={}){let s;super({start(n){s=wS({onEvent:(i)=>{n.enqueue(i)},onError(i){typeof e=="function"&&e(i),(e==="terminate"||i.type==="max-buffer-size-exceeded")&&n.error(i)},onRetry:t,onComment:r,maxBufferSize:o})},transform(n){s.feed(n)}})}}function NR(e){return/(?:^|,)\s*dpop(?:\s|$|,)/i.test(e)}function jR(e){if(e.status!==401)return!1;let t=e.headers.get("www-authenticate")??"";return NR(t)&&/use_dpop_nonce/i.test(t)}var MR=(e,t)=>(r)=>{let o=typeof e==="function"?e:()=>e;return async(s,n)=>{let i=(n?.method??"GET").toUpperCase(),a=new URL(s.toString()),c=await o();if(!c)return r(s,n);let l=async()=>{let f=await t();if(!f)return r(s,n);let h=new Headers(n?.headers),g=await c.buildProof({htm:i,htu:a,accessToken:f});return h.set("Authorization",`DPoP ${f}`),h.set("DPoP",g),r(s,{...n,headers:h})},d=await l();if(jR(d)&&d.headers.has("dpop-nonce"))c.observeNonce(d,a),await d.text?.().catch(()=>{}),d=await l();return c.observeNonce(d,a),d}},AR=(e)=>MR(async()=>{try{return await e.dpop?.()}catch(t){throw rt(t)}},async()=>{let t;try{t=await e.tokens()}catch(r){throw rt(r)}return t?.token_type?.toLowerCase()==="dpop"?t.access_token:void 0});var XP=class extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.SseError"})}static[Symbol.hasInstance](e){return We(this,e)}static isInstance(e){if(typeof this!=="function")throw TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return We(this,e)}constructor(e,t,r){super(`SSE error: ${t}`);this.code=e,this.event=r,vr(this,new.target)}};var LR=1,UR={initialReconnectionDelay:1000,maxReconnectionDelay:30000,reconnectionDelayGrowFactor:1.5,maxRetries:2},DR=new Set(["authorization","dpop","content-type","mcp-protocol-version","mcp-method","mcp-name","mcp-session-id"]);function zS(e,t){if(typeof AbortSignal.any==="function")return AbortSignal.any([e,t]);let r=new AbortController;if(e.aborted)return r.abort(e.reason),r.signal;if(t.aborted)return r.abort(t.reason),r.signal;let o=()=>{e.removeEventListener("abort",s),t.removeEventListener("abort",n)};function s(){o(),r.abort(e.reason)}function n(){o(),r.abort(t.reason)}return e.addEventListener("abort",s,{once:!0}),t.addEventListener("abort",n,{once:!0}),r.signal}var RS=class{_abortController;_url;_resourceMetadataUrl;_scope;_requestInit;_authProvider;_oauthProvider;_skipIssuerMetadataValidation;_fetch;_fetchWithInit;_redirectPolicy;_sessionId;_reconnectionOptions;_protocolVersion;_onInsufficientScope;_maxStepUpRetries;_serverRetryMs;_reconnectionScheduler;_cancelReconnection;onclose;onerror;onmessage;hasPerRequestStream=!0;constructor(e,t){if(this._url=e,this._resourceMetadataUrl=void 0,this._scope=void 0,this._requestInit=t?.requestInit,this._skipIssuerMetadataValidation=t?.skipIssuerMetadataValidation,this._fetch=t?.fetch,Jg(t?.authProvider)){if(this._oauthProvider=t.authProvider,this._authProvider=Wg(t.authProvider,{skipIssuerMetadataValidation:t.skipIssuerMetadataValidation}),t.authProvider.dpop)this._fetch=AR(t.authProvider)(t.fetch??fetch)}else this._authProvider=t?.authProvider;if(this._redirectPolicy=t?.redirectPolicy,this._fetchWithInit=Pg(t?.fetch,t?.requestInit),this._redirectPolicy==="follow")this._fetchWithInit=$g(this._fetchWithInit);this._sessionId=t?.sessionId,this._protocolVersion=t?.protocolVersion,this._reconnectionOptions=t?.reconnectionOptions??UR,this._reconnectionScheduler=t?.reconnectionScheduler,this._onInsufficientScope=t?.onInsufficientScope??"reauthorize",this._maxStepUpRetries=Math.max(0,t?.maxStepUpRetries??LR)}async _stepUpAuthorize(e,t){try{return await this._stepUpAuthorizeInner(e,t)}catch(r){throw rt(r)}}async _stepUpAuthorizeInner(e,t){if(this._onInsufficientScope==="throw")throw new xd({requiredScope:e.scope,resourceMetadataUrl:e.resourceMetadataUrl,errorDescription:e.errorDescription});if(!this._oauthProvider)throw new xd({requiredScope:e.scope,resourceMetadataUrl:e.resourceMetadataUrl,errorDescription:e.errorDescription});if(t>=this._maxStepUpRetries)throw new gt(M.ClientHttpForbidden,`Server returned 403 insufficient_scope after step-up re-authorization (retry limit ${this._maxStepUpRetries} reached)`,{status:403,statusText:e.statusText??"Forbidden",text:e.text});if(e.resourceMetadataUrl)this._resourceMetadataUrl=e.resourceMetadataUrl;let r=await this._oauthProvider.tokens(),o=tu(this._scope,r?.scope,e.scope);this._scope=o;let s=Kg(o,r?.scope);return ru(this._oauthProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:o,forceReauthorization:s,fetchFn:this._fetchWithInit,skipIssuerMetadataValidation:this._skipIssuerMetadataValidation})}_redirects(e){return this._redirectPolicy==="follow"?e:Ss(e)}_unfollowedRedirect(e,t){let r=this._redirectPolicy==="follow"?void 0:Cg(e,t);return r&&`${r} (redirectPolicy: 'same-origin')`}async _commonHeaders(){let e=new Headers(this._requestInit?.headers||void 0),t;try{t=await this._authProvider?.token()}catch(r){throw rt(r)}if(t)e.set("Authorization",`Bearer ${t}`);if(this._sessionId)e.set("mcp-session-id",this._sessionId);if(this._protocolVersion)e.set("mcp-protocol-version",this._protocolVersion);return e}_applyBodyDerivedHeaders(e,t){if(Array.isArray(t)||!yr(t))return;let r=t.params?._meta?.[Bt];if(typeof r!=="string")return;e.set("mcp-protocol-version",r),e.set("mcp-method",t.method);let o=vg(t.method,t.params);if(o?.value!==void 0)e.set("mcp-name",cd(o.value))}_isModernEnvelopedRequest(e){if(Array.isArray(e)||!yr(e))return!1;let t=e.params?._meta?.[Bt];return typeof t==="string"&&Nt(t)}async _startOrAuthSse(e,t=!1,r=0){let{resumptionToken:o,requestSignal:s}=e,n=()=>this._abortController?.signal.aborted===!0||s?.aborted===!0;try{let i=await this._commonHeaders(),a=[...i.get("accept")?.split(",").map((f)=>f.trim().toLowerCase())??[],"text/event-stream"];if(i.set("accept",[...new Set(a)].join(", ")),o)i.set("last-event-id",o);let c=this._abortController?.signal,l=s!==void 0&&c!==void 0?zS(c,s):s??c,d=await this._redirects(this._fetch??fetch)(this._url,{...this._requestInit,method:"GET",headers:i,signal:l});if(!d.ok){if(d.status===401&&this._authProvider){if(d.headers.has("www-authenticate")){let{resourceMetadataUrl:h,scope:g}=bs(d);this._resourceMetadataUrl=h,this._scope=tu(this._scope,g)}if(this._authProvider.onUnauthorized&&!t){try{await this._authProvider.onUnauthorized({response:d,serverUrl:this._url,fetchFn:this._fetchWithInit})}catch(h){throw rt(h)}return await d.text?.().catch(()=>{}),this._startOrAuthSse(e,!0,r)}if(await d.text?.().catch(()=>{}),t)throw rt(new gt(M.ClientHttpAuthentication,"Server returned 401 after re-authentication",{status:401,statusText:d.statusText}));throw rt(new vt)}if(d.status===403){let{resourceMetadataUrl:h,scope:g,error:b,errorDescription:_}=bs(d);if(b==="insufficient_scope"){let w=await d.text?.().catch(()=>null);if(await this._stepUpAuthorize({scope:g,resourceMetadataUrl:h,errorDescription:_,statusText:d.statusText,text:w},r)!=="AUTHORIZED")throw rt(new vt);return this._startOrAuthSse(e,t,r+1)}}if(await d.text?.().catch(()=>{}),d.status===405){e.onRequestStreamEnd?.();return}let f=this._unfollowedRedirect(this._url,d)??d.statusText;throw new gt(M.ClientHttpFailedToOpenStream,`Failed to open SSE stream: ${f}`,{status:d.status,statusText:d.statusText})}this._handleSseStream(d.body,e,!0)}catch(i){if(!n())this.onerror?.(i);throw i}}_getNextReconnectionDelay(e){if(this._serverRetryMs!==void 0)return this._serverRetryMs;let t=this._reconnectionOptions.initialReconnectionDelay,r=this._reconnectionOptions.reconnectionDelayGrowFactor,o=this._reconnectionOptions.maxReconnectionDelay;return Math.min(t*Math.pow(r,e),o)}_scheduleReconnection(e,t=0){let r=this._reconnectionOptions.maxRetries;if(t>=r){this.onerror?.(Error(`Maximum reconnection attempts (${r}) exceeded.`)),e.onRequestStreamEnd?.();return}let o=this._getNextReconnectionDelay(t),s=()=>{if(this._cancelReconnection=void 0,this._abortController?.signal.aborted||e.requestSignal?.aborted)return;this._startOrAuthSse(e).catch((n)=>{if(this._abortController?.signal.aborted||e.requestSignal?.aborted)return;this.onerror?.(Error(`Failed to reconnect SSE stream: ${n instanceof Error?n.message:String(n)}`));try{this._scheduleReconnection(e,t+1)}catch(i){this.onerror?.(i instanceof Error?i:Error(String(i)))}})};if(this._reconnectionScheduler){let n=this._reconnectionScheduler(s,o,t);this._cancelReconnection=typeof n==="function"?n:void 0}else{let n=setTimeout(s,o);this._cancelReconnection=()=>clearTimeout(n)}}_handleSseStream(e,t,r){if(!e){t.onRequestStreamEnd?.();return}let{onresumptiontoken:o,replayMessageId:s,requestSignal:n,onRequestStreamEnd:i}=t,a=()=>this._abortController?.signal.aborted===!0||n?.aborted===!0,c,l=!1,d=!1;(async()=>{try{let h=e.pipeThrough(new TextDecoderStream).pipeThrough(new qd({onRetry:(g)=>{this._serverRetryMs=g}})).getReader();while(!0){let{value:g,done:b}=await h.read();if(b)break;if(g.id)c=g.id,l=!0,o?.(g.id);if(!g.data)continue;if(!g.event||g.event==="message")try{let _=_t.parse(JSON.parse(g.data));if(po(_)||ho(_)){if(d=!0,s!==void 0)_.id=s}this.onmessage?.(_)}catch(_){this.onerror?.(_)}}if((r||l)&&!d&&this._abortController&&!a())this._scheduleReconnection({resumptionToken:c,onresumptiontoken:o,replayMessageId:s,requestSignal:n,onRequestStreamEnd:i},0);else if(!a())i?.()}catch(h){if(a())return;if(this.onerror?.(Error(`SSE stream disconnected: ${h}`)),(r||l)&&!d&&this._abortController&&!a())try{this._scheduleReconnection({resumptionToken:c,onresumptiontoken:o,replayMessageId:s,requestSignal:n,onRequestStreamEnd:i},0)}catch(g){this.onerror?.(Error(`Failed to reconnect: ${g instanceof Error?g.message:String(g)}`)),i?.()}else i?.()}})()}async start(){if(this._abortController)throw Error("StreamableHTTPClientTransport already started! If using Client class, note that connect() calls start() automatically.");this._abortController=new AbortController}async finishAuth(e,t){if(!this._oauthProvider)throw new vt("finishAuth requires an OAuthClientProvider");let{authorizationCode:r,iss:o}=await Gg(e,t,this._oauthProvider,this._url,{fetchFn:this._fetchWithInit,resourceMetadataUrl:this._resourceMetadataUrl});if(await ru(this._oauthProvider,{serverUrl:this._url,authorizationCode:r,iss:o,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit,skipIssuerMetadataValidation:this._skipIssuerMetadataValidation})!=="AUTHORIZED")throw new vt("Failed to authorize")}async close(){try{this._cancelReconnection?.()}finally{this._cancelReconnection=void 0,this._abortController?.abort(),this.onclose?.()}}async send(e,t){return this._send(e,t,!1)}async _send(e,t,r,o=0){try{let{resumptionToken:s,onresumptiontoken:n}=t||{};if(s){this._startOrAuthSse({resumptionToken:s,replayMessageId:yr(e)?e.id:void 0,requestSignal:t?.requestSignal}).catch((w)=>this.onerror?.(w));return}let i=await this._commonHeaders();this._applyBodyDerivedHeaders(i,e);let a=Array.isArray(e)?e.some((w)=>id(w)):id(e);if(a)i.delete("mcp-session-id");if(t?.headers!==void 0)for(let[w,I]of Object.entries(t.headers)){if(DR.has(w.toLowerCase()))continue;i.set(w,I)}i.set("content-type","application/json");let c=[...i.get("accept")?.split(",").map((w)=>w.trim().toLowerCase())??[],"application/json","text/event-stream"];i.set("accept",[...new Set(c)].join(", "));let l=this._abortController?.signal,d=t?.requestSignal!==void 0&&l!==void 0?zS(l,t.requestSignal):t?.requestSignal??l,f={...this._requestInit,method:"POST",headers:i,body:JSON.stringify(e),signal:d},h=await this._redirects(this._fetch??fetch)(this._url,f);if(a&&h.ok)this._sessionId=h.headers.get("mcp-session-id")||void 0;if(!h.ok){if(h.status===401&&this._authProvider){if(h.headers.has("www-authenticate")){let{resourceMetadataUrl:A,scope:z}=bs(h);this._resourceMetadataUrl=A,this._scope=tu(this._scope,z)}if(this._authProvider.onUnauthorized&&!r){try{await this._authProvider.onUnauthorized({response:h,serverUrl:this._url,fetchFn:this._fetchWithInit})}catch(A){throw rt(A)}return await h.text?.().catch(()=>{}),this._send(e,t,!0,o)}if(await h.text?.().catch(()=>{}),r)throw rt(new gt(M.ClientHttpAuthentication,"Server returned 401 after re-authentication",{status:401,statusText:h.statusText}));throw rt(new vt)}let w=await h.text?.().catch(()=>null);if(h.status===403){let{resourceMetadataUrl:A,scope:z,error:q,errorDescription:x}=bs(h);if(q==="insufficient_scope"){if(await this._stepUpAuthorize({scope:z,resourceMetadataUrl:A,errorDescription:x,statusText:h.statusText,text:w},o)!=="AUTHORIZED")throw rt(new vt);return this._send(e,t,r,o+1)}}if(h.status===400&&typeof w==="string"&&this._isModernEnvelopedRequest(e))try{let A=_t.parse(JSON.parse(w)),z=(Array.isArray(e)?e:[e]).filter((q)=>yr(q));if(ho(A)&&z.some((q)=>q.id===A.id)){this.onmessage?.(A);return}}catch{}let I=this._unfollowedRedirect(this._url,h)??w;throw new gt(M.ClientHttpNotImplemented,`Error POSTing to endpoint: ${I}`,{status:h.status,statusText:h.statusText,text:w})}if(h.status===202){if(await h.text?.().catch(()=>{}),fg(e))this._startOrAuthSse({resumptionToken:void 0}).catch((w)=>this.onerror?.(w));return}let g=(Array.isArray(e)?e:[e]).some((w)=>("method"in w)&&("id"in w)&&w.id!==void 0),b=h.headers.get("content-type"),_=kg(b);if(g)if(_==="text/event-stream")this._handleSseStream(h.body,{onresumptiontoken:n,requestSignal:t?.requestSignal,onRequestStreamEnd:t?.onRequestStreamEnd},!1);else if(_==="application/json"){let w=await h.json(),I=Array.isArray(w)?w.map((A)=>_t.parse(A)):[_t.parse(w)];for(let A of I)this.onmessage?.(A)}else throw await h.text?.().catch(()=>{}),new L(M.ClientHttpUnexpectedContent,`Unexpected content type: ${b}`,{contentType:b});else await h.text?.().catch(()=>{})}catch(s){if(t?.requestSignal?.aborted!==!0)this.onerror?.(s);throw s}}get sessionId(){return this._sessionId}async terminateSession(){if(!this._sessionId)return;try{let e=await this._commonHeaders(),t={...this._requestInit,method:"DELETE",headers:e,signal:this._abortController?.signal},r=await this._redirects(this._fetch??fetch)(this._url,t);if(await r.text?.().catch(()=>{}),!r.ok&&r.status!==405)throw new gt(M.ClientHttpFailedToTerminateSession,`Failed to terminate session: ${this._unfollowedRedirect(this._url,r)??r.statusText}`,{status:r.status,statusText:r.statusText});this._sessionId=void 0}catch(e){throw this.onerror?.(e),e}}setProtocolVersion(e){this._protocolVersion=e}get protocolVersion(){return this._protocolVersion}async resumeStream(e,t){await this._startOrAuthSse({resumptionToken:e,onresumptiontoken:t?.onresumptiontoken})}};class $S{_eventSlots=new Map;setHandler(e,t){let r=this._ensureEventSlot(e);if(r.onHandler&&t)console.warn(`[MCP Apps] on${String(e)} handler replaced. Use addEventListener("${String(e)}", …) to add multiple listeners without replacing.`);r.onHandler=t}getHandler(e){return this._eventSlots.get(e)?.onHandler}addEventListener(e,t){this._ensureEventSlot(e).listeners.push(t)}removeEventListener(e,t){let r=this._eventSlots.get(e);if(!r)return;let o=r.listeners.indexOf(t);if(o!==-1)r.listeners.splice(o,1)}dispatch(e,t){let r=this._eventSlots.get(e);if(!r)return;r.onHandler?.(t);for(let o of[...r.listeners])o(t)}_ensureEventSlot(e){let t=this._eventSlots.get(e);if(!t)t={listeners:[]},this._eventSlots.set(e,t);return t}}class CS{_methods=new Set;claim(e,t){if(this._methods.has(e))throw Error(`Handler for "${e}" already registered (via ${t}). Use addEventListener() to attach multiple listeners, or the on* setter for replace semantics.`);this._methods.add(e)}replace(e){this._methods.add(e)}release(e){this._methods.delete(e)}has(e){return this._methods.has(e)}}var xS=new Set;function kS(e,t){let[r,o]=t,s=r?.shape;if(typeof s?.method?.value!=="string")return;let n=s.method.value,i=e==="request"?"setRequestHandler":"setNotificationHandler";if(!xS.has(i))xS.add(i),console.warn(`[ext-apps] ${i}(Schema, handler) is deprecated; use ${i}("${n}", { params: Schema.shape.params }, handler).`);let a=o;return[n,{params:s.params},e==="request"?(c,l)=>a({method:n,params:c},ZR(l)):(c)=>a({method:n,params:c})]}function ZR(e){return{signal:e.mcpReq.signal,requestId:e.mcpReq.id,sessionId:e.sessionId,_meta:e.mcpReq._meta,sendRequest:e.mcpReq.send,sendNotification:e.mcpReq.notify,authInfo:e.http?.authInfo}}var IS="2026-01-26";var HR="ui/notifications/tool-input-partial";var FR=C([p("light"),p("dark")]).describe("Color theme preference for the host environment."),ma=C([p("inline"),p("fullscreen"),p("pip")]).describe("Display mode for UI presentation."),VR=C([p("--color-background-primary"),p("--color-background-secondary"),p("--color-background-tertiary"),p("--color-background-inverse"),p("--color-background-ghost"),p("--color-background-info"),p("--color-background-danger"),p("--color-background-success"),p("--color-background-warning"),p("--color-background-disabled"),p("--color-text-primary"),p("--color-text-secondary"),p("--color-text-tertiary"),p("--color-text-inverse"),p("--color-text-ghost"),p("--color-text-info"),p("--color-text-danger"),p("--color-text-success"),p("--color-text-warning"),p("--color-text-disabled"),p("--color-border-primary"),p("--color-border-secondary"),p("--color-border-tertiary"),p("--color-border-inverse"),p("--color-border-ghost"),p("--color-border-info"),p("--color-border-danger"),p("--color-border-success"),p("--color-border-warning"),p("--color-border-disabled"),p("--color-ring-primary"),p("--color-ring-secondary"),p("--color-ring-inverse"),p("--color-ring-info"),p("--color-ring-danger"),p("--color-ring-success"),p("--color-ring-warning"),p("--font-sans"),p("--font-mono"),p("--font-weight-normal"),p("--font-weight-medium"),p("--font-weight-semibold"),p("--font-weight-bold"),p("--font-text-xs-size"),p("--font-text-sm-size"),p("--font-text-md-size"),p("--font-text-lg-size"),p("--font-heading-xs-size"),p("--font-heading-sm-size"),p("--font-heading-md-size"),p("--font-heading-lg-size"),p("--font-heading-xl-size"),p("--font-heading-2xl-size"),p("--font-heading-3xl-size"),p("--font-text-xs-line-height"),p("--font-text-sm-line-height"),p("--font-text-md-line-height"),p("--font-text-lg-line-height"),p("--font-heading-xs-line-height"),p("--font-heading-sm-line-height"),p("--font-heading-md-line-height"),p("--font-heading-lg-line-height"),p("--font-heading-xl-line-height"),p("--font-heading-2xl-line-height"),p("--font-heading-3xl-line-height"),p("--border-radius-xs"),p("--border-radius-sm"),p("--border-radius-md"),p("--border-radius-lg"),p("--border-radius-xl"),p("--border-radius-full"),p("--border-width-regular"),p("--shadow-hairline"),p("--shadow-sm"),p("--shadow-md"),p("--shadow-lg")]).describe("CSS variable keys available to MCP apps for theming."),BR=T(VR.describe(`Style variables for theming MCP apps.
77
+ ${ne}`,f++}else kS(z,R,ee)?h=z.slice(z.charCodeAt(R+6)===go?R+7:R+6,Z)||void 0:T(z,R,Z);R=Z+1,Z=z.indexOf(`
78
+ `,R)}return z.slice(R)}for(;R<z.length;){let Z=z.indexOf("\r",R),ee=z.indexOf(`
79
+ `,R),X=-1;if(Z!==-1&&ee!==-1?X=Z<ee?Z:ee:Z!==-1?Z===z.length-1?X=-1:X=Z:ee!==-1&&(X=ee),X===-1)break;T(z,R,X),R=X+1,z.charCodeAt(R-1)===ZR&&z.charCodeAt(R)===RS&&R++}return z.slice(R)}function T(z,R,Z){if(R===Z){k();return}let ee=z.charCodeAt(R);if(xS(z,R,ee)){let re=z.charCodeAt(R+5)===go?R+6:R+5,de=z.slice(re,Z);d=f===0?de:`${d}
80
+ ${de}`,f++;return}if(kS(z,R,ee)){h=z.slice(z.charCodeAt(R+6)===go?R+7:R+6,Z)||void 0;return}if(ee===105&&z.charCodeAt(R+1)===100&&z.charCodeAt(R+2)===58){let re=z.slice(z.charCodeAt(R+3)===go?R+4:R+3,Z);re.includes("\x00")||(l=re);return}if(ee===58){if(s){let re=z.slice(R,Z);s(re.slice(z.charCodeAt(R+1)===go?2:1))}return}let X=z.slice(R,Z),ne=X.indexOf(":");if(ne===-1){O(X,"",X);return}let xe=X.slice(0,ne),te=X.charCodeAt(ne+1)===go?2:1,ie=X.slice(ne+te);O(xe,ie,X)}function O(z,R,Z){switch(z){case"event":h=R||void 0;break;case"data":d=f===0?R:`${d}
81
+ ${R}`,f++;break;case"id":R.includes("\x00")||(l=R);break;case"retry":/^\d+$/.test(R)?o(parseInt(R,10)):r(new iu(`Invalid \`retry\` value: "${R}"`,{type:"invalid-retry",value:R,line:Z}));break;default:r(new iu(`Unknown field "${z.length>20?`${z.slice(0,20)}…`:z}"`,{type:"unknown-field",field:z,value:R,line:Z}));break}}function k(){f>0&&t({id:l,event:h,data:d}),l=void 0,d="",f=0,h=void 0}function P(z={}){if(z.consume&&i.length>0){let R=i.join("");T(R,0,R.length)}c=!0,l=void 0,d="",f=0,h=void 0,i.length=0,a=0,g=!1}return{feed:v,reset:P}}function xS(e,t,r){return r===100&&e.charCodeAt(t+1)===97&&e.charCodeAt(t+2)===116&&e.charCodeAt(t+3)===97&&e.charCodeAt(t+4)===58}function kS(e,t,r){return r===101&&e.charCodeAt(t+1)===118&&e.charCodeAt(t+2)===101&&e.charCodeAt(t+3)===110&&e.charCodeAt(t+4)===116&&e.charCodeAt(t+5)===58}class Md extends TransformStream{constructor({onError:e,onRetry:t,onComment:r,maxBufferSize:o}={}){let s;super({start(n){s=PS({onEvent:(i)=>{n.enqueue(i)},onError(i){typeof e=="function"&&e(i),(e==="terminate"||i.type==="max-buffer-size-exceeded")&&n.error(i)},onRetry:t,onComment:r,maxBufferSize:o})},transform(n){s.feed(n)}})}}function HR(e){return/(?:^|,)\s*dpop(?:\s|$|,)/i.test(e)}function FR(e){if(e.status!==401)return!1;let t=e.headers.get("www-authenticate")??"";return HR(t)&&/use_dpop_nonce/i.test(t)}var VR=(e,t)=>(r)=>{let o=typeof e==="function"?e:()=>e;return async(s,n)=>{let i=(n?.method??"GET").toUpperCase(),a=new URL(s.toString()),c=await o();if(!c)return r(s,n);let l=async()=>{let f=await t();if(!f)return r(s,n);let h=new Headers(n?.headers),g=await c.buildProof({htm:i,htu:a,accessToken:f});return h.set("Authorization",`DPoP ${f}`),h.set("DPoP",g),r(s,{...n,headers:h})},d=await l();if(FR(d)&&d.headers.has("dpop-nonce"))c.observeNonce(d,a),await d.text?.().catch(()=>{}),d=await l();return c.observeNonce(d,a),d}},BR=(e)=>VR(async()=>{try{return await e.dpop?.()}catch(t){throw rt(t)}},async()=>{let t;try{t=await e.tokens()}catch(r){throw rt(r)}return t?.token_type?.toLowerCase()==="dpop"?t.access_token:void 0});var iT=class extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.SseError"})}static[Symbol.hasInstance](e){return We(this,e)}static isInstance(e){if(typeof this!=="function")throw TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return We(this,e)}constructor(e,t,r){super(`SSE error: ${t}`);this.code=e,this.event=r,br(this,new.target)}};var JR=1,WR={initialReconnectionDelay:1000,maxReconnectionDelay:30000,reconnectionDelayGrowFactor:1.5,maxRetries:2},KR=new Set(["authorization","dpop","content-type","mcp-protocol-version","mcp-method","mcp-name","mcp-session-id"]);function TS(e,t){if(typeof AbortSignal.any==="function")return AbortSignal.any([e,t]);let r=new AbortController;if(e.aborted)return r.abort(e.reason),r.signal;if(t.aborted)return r.abort(t.reason),r.signal;let o=()=>{e.removeEventListener("abort",s),t.removeEventListener("abort",n)};function s(){o(),r.abort(e.reason)}function n(){o(),r.abort(t.reason)}return e.addEventListener("abort",s,{once:!0}),t.addEventListener("abort",n,{once:!0}),r.signal}var ES=class{_abortController;_url;_resourceMetadataUrl;_scope;_requestInit;_authProvider;_oauthProvider;_skipIssuerMetadataValidation;_fetch;_fetchWithInit;_redirectPolicy;_sessionId;_reconnectionOptions;_protocolVersion;_onInsufficientScope;_maxStepUpRetries;_serverRetryMs;_reconnectionScheduler;_cancelReconnection;onclose;onerror;onmessage;hasPerRequestStream=!0;constructor(e,t){if(this._url=e,this._resourceMetadataUrl=void 0,this._scope=void 0,this._requestInit=t?.requestInit,this._skipIssuerMetadataValidation=t?.skipIssuerMetadataValidation,this._fetch=t?.fetch,Xg(t?.authProvider)){if(this._oauthProvider=t.authProvider,this._authProvider=Qg(t.authProvider,{skipIssuerMetadataValidation:t.skipIssuerMetadataValidation}),t.authProvider.dpop)this._fetch=BR(t.authProvider)(t.fetch??fetch)}else this._authProvider=t?.authProvider;if(this._redirectPolicy=t?.redirectPolicy,this._fetchWithInit=Ig(t?.fetch,t?.requestInit),this._redirectPolicy==="follow")this._fetchWithInit=Ng(this._fetchWithInit);this._sessionId=t?.sessionId,this._protocolVersion=t?.protocolVersion,this._reconnectionOptions=t?.reconnectionOptions??WR,this._reconnectionScheduler=t?.reconnectionScheduler,this._onInsufficientScope=t?.onInsufficientScope??"reauthorize",this._maxStepUpRetries=Math.max(0,t?.maxStepUpRetries??JR)}async _stepUpAuthorize(e,t){try{return await this._stepUpAuthorizeInner(e,t)}catch(r){throw rt(r)}}async _stepUpAuthorizeInner(e,t){if(this._onInsufficientScope==="throw")throw new Ed({requiredScope:e.scope,resourceMetadataUrl:e.resourceMetadataUrl,errorDescription:e.errorDescription});if(!this._oauthProvider)throw new Ed({requiredScope:e.scope,resourceMetadataUrl:e.resourceMetadataUrl,errorDescription:e.errorDescription});if(t>=this._maxStepUpRetries)throw new St(A.ClientHttpForbidden,`Server returned 403 insufficient_scope after step-up re-authorization (retry limit ${this._maxStepUpRetries} reached)`,{status:403,statusText:e.statusText??"Forbidden",text:e.text});if(e.resourceMetadataUrl)this._resourceMetadataUrl=e.resourceMetadataUrl;let r=await this._oauthProvider.tokens(),o=su(this._scope,r?.scope,e.scope);this._scope=o;let s=eS(o,r?.scope);return nu(this._oauthProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:o,forceReauthorization:s,fetchFn:this._fetchWithInit,skipIssuerMetadataValidation:this._skipIssuerMetadataValidation})}_redirects(e){return this._redirectPolicy==="follow"?e:vs(e)}_unfollowedRedirect(e,t){let r=this._redirectPolicy==="follow"?void 0:jg(e,t);return r&&`${r} (redirectPolicy: 'same-origin')`}async _commonHeaders(){let e=new Headers(this._requestInit?.headers||void 0),t;try{t=await this._authProvider?.token()}catch(r){throw rt(r)}if(t)e.set("Authorization",`Bearer ${t}`);if(this._sessionId)e.set("mcp-session-id",this._sessionId);if(this._protocolVersion)e.set("mcp-protocol-version",this._protocolVersion);return e}_applyBodyDerivedHeaders(e,t){if(Array.isArray(t)||!wr(t))return;let r=t.params?._meta?.[Jt];if(typeof r!=="string")return;e.set("mcp-protocol-version",r),e.set("mcp-method",t.method);let o=Rg(t.method,t.params);if(o?.value!==void 0)e.set("mcp-name",pd(o.value))}_isModernEnvelopedRequest(e){if(Array.isArray(e)||!wr(e))return!1;let t=e.params?._meta?.[Jt];return typeof t==="string"&&Mt(t)}async _startOrAuthSse(e,t=!1,r=0){let{resumptionToken:o,requestSignal:s}=e,n=()=>this._abortController?.signal.aborted===!0||s?.aborted===!0;try{let i=await this._commonHeaders(),a=[...i.get("accept")?.split(",").map((f)=>f.trim().toLowerCase())??[],"text/event-stream"];if(i.set("accept",[...new Set(a)].join(", ")),o)i.set("last-event-id",o);let c=this._abortController?.signal,l=s!==void 0&&c!==void 0?TS(c,s):s??c,d=await this._redirects(this._fetch??fetch)(this._url,{...this._requestInit,method:"GET",headers:i,signal:l});if(!d.ok){if(d.status===401&&this._authProvider){if(d.headers.has("www-authenticate")){let{resourceMetadataUrl:h,scope:g}=ys(d);this._resourceMetadataUrl=h,this._scope=su(this._scope,g)}if(this._authProvider.onUnauthorized&&!t){try{await this._authProvider.onUnauthorized({response:d,serverUrl:this._url,fetchFn:this._fetchWithInit})}catch(h){throw rt(h)}return await d.text?.().catch(()=>{}),this._startOrAuthSse(e,!0,r)}if(await d.text?.().catch(()=>{}),t)throw rt(new St(A.ClientHttpAuthentication,"Server returned 401 after re-authentication",{status:401,statusText:d.statusText}));throw rt(new bt)}if(d.status===403){let{resourceMetadataUrl:h,scope:g,error:v,errorDescription:_}=ys(d);if(v==="insufficient_scope"){let y=await d.text?.().catch(()=>null);if(await this._stepUpAuthorize({scope:g,resourceMetadataUrl:h,errorDescription:_,statusText:d.statusText,text:y},r)!=="AUTHORIZED")throw rt(new bt);return this._startOrAuthSse(e,t,r+1)}}if(await d.text?.().catch(()=>{}),d.status===405){e.onRequestStreamEnd?.();return}let f=this._unfollowedRedirect(this._url,d)??d.statusText;throw new St(A.ClientHttpFailedToOpenStream,`Failed to open SSE stream: ${f}`,{status:d.status,statusText:d.statusText})}this._handleSseStream(d.body,e,!0)}catch(i){if(!n())this.onerror?.(i);throw i}}_getNextReconnectionDelay(e){if(this._serverRetryMs!==void 0)return this._serverRetryMs;let t=this._reconnectionOptions.initialReconnectionDelay,r=this._reconnectionOptions.reconnectionDelayGrowFactor,o=this._reconnectionOptions.maxReconnectionDelay;return Math.min(t*Math.pow(r,e),o)}_scheduleReconnection(e,t=0){let r=this._reconnectionOptions.maxRetries;if(t>=r){this.onerror?.(Error(`Maximum reconnection attempts (${r}) exceeded.`)),e.onRequestStreamEnd?.();return}let o=this._getNextReconnectionDelay(t),s=()=>{if(this._cancelReconnection=void 0,this._abortController?.signal.aborted||e.requestSignal?.aborted)return;this._startOrAuthSse(e).catch((n)=>{if(this._abortController?.signal.aborted||e.requestSignal?.aborted)return;this.onerror?.(Error(`Failed to reconnect SSE stream: ${n instanceof Error?n.message:String(n)}`));try{this._scheduleReconnection(e,t+1)}catch(i){this.onerror?.(i instanceof Error?i:Error(String(i)))}})};if(this._reconnectionScheduler){let n=this._reconnectionScheduler(s,o,t);this._cancelReconnection=typeof n==="function"?n:void 0}else{let n=setTimeout(s,o);this._cancelReconnection=()=>clearTimeout(n)}}_handleSseStream(e,t,r){if(!e){t.onRequestStreamEnd?.();return}let{onresumptiontoken:o,replayMessageId:s,requestSignal:n,onRequestStreamEnd:i}=t,a=()=>this._abortController?.signal.aborted===!0||n?.aborted===!0,c,l=!1,d=!1;(async()=>{try{let h=e.pipeThrough(new TextDecoderStream).pipeThrough(new Md({onRetry:(g)=>{this._serverRetryMs=g}})).getReader();while(!0){let{value:g,done:v}=await h.read();if(v)break;if(g.id)c=g.id,l=!0,o?.(g.id);if(!g.data)continue;if(!g.event||g.event==="message")try{let _=gt.parse(JSON.parse(g.data));if(ho(_)||fo(_)){if(d=!0,s!==void 0)_.id=s}this.onmessage?.(_)}catch(_){this.onerror?.(_)}}if((r||l)&&!d&&this._abortController&&!a())this._scheduleReconnection({resumptionToken:c,onresumptiontoken:o,replayMessageId:s,requestSignal:n,onRequestStreamEnd:i},0);else if(!a())i?.()}catch(h){if(a())return;if(this.onerror?.(Error(`SSE stream disconnected: ${h}`)),(r||l)&&!d&&this._abortController&&!a())try{this._scheduleReconnection({resumptionToken:c,onresumptiontoken:o,replayMessageId:s,requestSignal:n,onRequestStreamEnd:i},0)}catch(g){this.onerror?.(Error(`Failed to reconnect: ${g instanceof Error?g.message:String(g)}`)),i?.()}else i?.()}})()}async start(){if(this._abortController)throw Error("StreamableHTTPClientTransport already started! If using Client class, note that connect() calls start() automatically.");this._abortController=new AbortController}async finishAuth(e,t){if(!this._oauthProvider)throw new bt("finishAuth requires an OAuthClientProvider");let{authorizationCode:r,iss:o}=await tS(e,t,this._oauthProvider,this._url,{fetchFn:this._fetchWithInit,resourceMetadataUrl:this._resourceMetadataUrl});if(await nu(this._oauthProvider,{serverUrl:this._url,authorizationCode:r,iss:o,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit,skipIssuerMetadataValidation:this._skipIssuerMetadataValidation})!=="AUTHORIZED")throw new bt("Failed to authorize")}async close(){try{this._cancelReconnection?.()}finally{this._cancelReconnection=void 0,this._abortController?.abort(),this.onclose?.()}}async send(e,t){return this._send(e,t,!1)}async _send(e,t,r,o=0){try{let{resumptionToken:s,onresumptiontoken:n}=t||{};if(s){this._startOrAuthSse({resumptionToken:s,replayMessageId:wr(e)?e.id:void 0,requestSignal:t?.requestSignal}).catch((y)=>this.onerror?.(y));return}let i=await this._commonHeaders();this._applyBodyDerivedHeaders(i,e);let a=Array.isArray(e)?e.some((y)=>ld(y)):ld(e);if(a)i.delete("mcp-session-id");if(t?.headers!==void 0)for(let[y,T]of Object.entries(t.headers)){if(KR.has(y.toLowerCase()))continue;i.set(y,T)}i.set("content-type","application/json");let c=[...i.get("accept")?.split(",").map((y)=>y.trim().toLowerCase())??[],"application/json","text/event-stream"];i.set("accept",[...new Set(c)].join(", "));let l=this._abortController?.signal,d=t?.requestSignal!==void 0&&l!==void 0?TS(l,t.requestSignal):t?.requestSignal??l,f={...this._requestInit,method:"POST",headers:i,body:JSON.stringify(e),signal:d},h=await this._redirects(this._fetch??fetch)(this._url,f);if(a&&h.ok)this._sessionId=h.headers.get("mcp-session-id")||void 0;if(!h.ok){if(h.status===401&&this._authProvider){if(h.headers.has("www-authenticate")){let{resourceMetadataUrl:O,scope:k}=ys(h);this._resourceMetadataUrl=O,this._scope=su(this._scope,k)}if(this._authProvider.onUnauthorized&&!r){try{await this._authProvider.onUnauthorized({response:h,serverUrl:this._url,fetchFn:this._fetchWithInit})}catch(O){throw rt(O)}return await h.text?.().catch(()=>{}),this._send(e,t,!0,o)}if(await h.text?.().catch(()=>{}),r)throw rt(new St(A.ClientHttpAuthentication,"Server returned 401 after re-authentication",{status:401,statusText:h.statusText}));throw rt(new bt)}let y=await h.text?.().catch(()=>null);if(h.status===403){let{resourceMetadataUrl:O,scope:k,error:P,errorDescription:z}=ys(h);if(P==="insufficient_scope"){if(await this._stepUpAuthorize({scope:k,resourceMetadataUrl:O,errorDescription:z,statusText:h.statusText,text:y},o)!=="AUTHORIZED")throw rt(new bt);return this._send(e,t,r,o+1)}}if(h.status===400&&typeof y==="string"&&this._isModernEnvelopedRequest(e))try{let O=gt.parse(JSON.parse(y)),k=(Array.isArray(e)?e:[e]).filter((P)=>wr(P));if(fo(O)&&k.some((P)=>P.id===O.id)){this.onmessage?.(O);return}}catch{}let T=this._unfollowedRedirect(this._url,h)??y;throw new St(A.ClientHttpNotImplemented,`Error POSTing to endpoint: ${T}`,{status:h.status,statusText:h.statusText,text:y})}if(h.status===202){if(await h.text?.().catch(()=>{}),bg(e))this._startOrAuthSse({resumptionToken:void 0}).catch((y)=>this.onerror?.(y));return}let g=(Array.isArray(e)?e:[e]).some((y)=>("method"in y)&&("id"in y)&&y.id!==void 0),v=h.headers.get("content-type"),_=Cg(v);if(g)if(_==="text/event-stream")this._handleSseStream(h.body,{onresumptiontoken:n,requestSignal:t?.requestSignal,onRequestStreamEnd:t?.onRequestStreamEnd},!1);else if(_==="application/json"){let y=await h.json(),T=Array.isArray(y)?y.map((O)=>gt.parse(O)):[gt.parse(y)];for(let O of T)this.onmessage?.(O)}else throw await h.text?.().catch(()=>{}),new L(A.ClientHttpUnexpectedContent,`Unexpected content type: ${v}`,{contentType:v});else await h.text?.().catch(()=>{})}catch(s){if(t?.requestSignal?.aborted!==!0)this.onerror?.(s);throw s}}get sessionId(){return this._sessionId}async terminateSession(){if(!this._sessionId)return;try{let e=await this._commonHeaders(),t={...this._requestInit,method:"DELETE",headers:e,signal:this._abortController?.signal},r=await this._redirects(this._fetch??fetch)(this._url,t);if(await r.text?.().catch(()=>{}),!r.ok&&r.status!==405)throw new St(A.ClientHttpFailedToTerminateSession,`Failed to terminate session: ${this._unfollowedRedirect(this._url,r)??r.statusText}`,{status:r.status,statusText:r.statusText});this._sessionId=void 0}catch(e){throw this.onerror?.(e),e}}setProtocolVersion(e){this._protocolVersion=e}get protocolVersion(){return this._protocolVersion}async resumeStream(e,t){await this._startOrAuthSse({resumptionToken:e,onresumptiontoken:t?.onresumptiontoken})}};class NS{_eventSlots=new Map;setHandler(e,t){let r=this._ensureEventSlot(e);if(r.onHandler&&t)console.warn(`[MCP Apps] on${String(e)} handler replaced. Use addEventListener("${String(e)}", …) to add multiple listeners without replacing.`);r.onHandler=t}getHandler(e){return this._eventSlots.get(e)?.onHandler}addEventListener(e,t){this._ensureEventSlot(e).listeners.push(t)}removeEventListener(e,t){let r=this._eventSlots.get(e);if(!r)return;let o=r.listeners.indexOf(t);if(o!==-1)r.listeners.splice(o,1)}dispatch(e,t){let r=this._eventSlots.get(e);if(!r)return;r.onHandler?.(t);for(let o of[...r.listeners])o(t)}_ensureEventSlot(e){let t=this._eventSlots.get(e);if(!t)t={listeners:[]},this._eventSlots.set(e,t);return t}}class jS{_methods=new Set;claim(e,t){if(this._methods.has(e))throw Error(`Handler for "${e}" already registered (via ${t}). Use addEventListener() to attach multiple listeners, or the on* setter for replace semantics.`);this._methods.add(e)}replace(e){this._methods.add(e)}release(e){this._methods.delete(e)}has(e){return this._methods.has(e)}}var $S=new Set;function CS(e,t){let[r,o]=t,s=r?.shape;if(typeof s?.method?.value!=="string")return;let n=s.method.value,i=e==="request"?"setRequestHandler":"setNotificationHandler";if(!$S.has(i))$S.add(i),console.warn(`[ext-apps] ${i}(Schema, handler) is deprecated; use ${i}("${n}", { params: Schema.shape.params }, handler).`);let a=o;return[n,{params:s.params},e==="request"?(c,l)=>a({method:n,params:c},GR(l)):(c)=>a({method:n,params:c})]}function GR(e){return{signal:e.mcpReq.signal,requestId:e.mcpReq.id,sessionId:e.sessionId,_meta:e.mcpReq._meta,sendRequest:e.mcpReq.send,sendNotification:e.mcpReq.notify,authInfo:e.http?.authInfo}}var MS="2026-01-26";var YR="ui/notifications/tool-input-partial";var XR=q([m("light"),m("dark")]).describe("Color theme preference for the host environment."),_a=q([m("inline"),m("fullscreen"),m("pip")]).describe("Display mode for UI presentation."),QR=q([m("--color-background-primary"),m("--color-background-secondary"),m("--color-background-tertiary"),m("--color-background-inverse"),m("--color-background-ghost"),m("--color-background-info"),m("--color-background-danger"),m("--color-background-success"),m("--color-background-warning"),m("--color-background-disabled"),m("--color-text-primary"),m("--color-text-secondary"),m("--color-text-tertiary"),m("--color-text-inverse"),m("--color-text-ghost"),m("--color-text-info"),m("--color-text-danger"),m("--color-text-success"),m("--color-text-warning"),m("--color-text-disabled"),m("--color-border-primary"),m("--color-border-secondary"),m("--color-border-tertiary"),m("--color-border-inverse"),m("--color-border-ghost"),m("--color-border-info"),m("--color-border-danger"),m("--color-border-success"),m("--color-border-warning"),m("--color-border-disabled"),m("--color-ring-primary"),m("--color-ring-secondary"),m("--color-ring-inverse"),m("--color-ring-info"),m("--color-ring-danger"),m("--color-ring-success"),m("--color-ring-warning"),m("--font-sans"),m("--font-mono"),m("--font-weight-normal"),m("--font-weight-medium"),m("--font-weight-semibold"),m("--font-weight-bold"),m("--font-text-xs-size"),m("--font-text-sm-size"),m("--font-text-md-size"),m("--font-text-lg-size"),m("--font-heading-xs-size"),m("--font-heading-sm-size"),m("--font-heading-md-size"),m("--font-heading-lg-size"),m("--font-heading-xl-size"),m("--font-heading-2xl-size"),m("--font-heading-3xl-size"),m("--font-text-xs-line-height"),m("--font-text-sm-line-height"),m("--font-text-md-line-height"),m("--font-text-lg-line-height"),m("--font-heading-xs-line-height"),m("--font-heading-sm-line-height"),m("--font-heading-md-line-height"),m("--font-heading-lg-line-height"),m("--font-heading-xl-line-height"),m("--font-heading-2xl-line-height"),m("--font-heading-3xl-line-height"),m("--border-radius-xs"),m("--border-radius-sm"),m("--border-radius-md"),m("--border-radius-lg"),m("--border-radius-xl"),m("--border-radius-full"),m("--border-width-regular"),m("--shadow-hairline"),m("--shadow-sm"),m("--shadow-md"),m("--shadow-lg")]).describe("CSS variable keys available to MCP apps for theming."),ex=C(QR.describe(`Style variables for theming MCP apps.
82
82
 
83
83
  Individual style keys are optional - hosts may provide any subset of these values.
84
84
  Values are strings containing CSS values (colors, sizes, font stacks, etc.).
85
85
 
86
86
  Note: This type uses \`Record<K, string | undefined>\` rather than \`Partial<Record<K, string>>\`
87
- for compatibility with Zod schema generation. Both are functionally equivalent for validation.`),C([u(),Al()]).describe(`Style variables for theming MCP apps.
87
+ for compatibility with Zod schema generation. Both are functionally equivalent for validation.`),q([u(),Zl()]).describe(`Style variables for theming MCP apps.
88
88
 
89
89
  Individual style keys are optional - hosts may provide any subset of these values.
90
90
  Values are strings containing CSS values (colors, sizes, font stacks, etc.).
@@ -96,10 +96,10 @@ Individual style keys are optional - hosts may provide any subset of these value
96
96
  Values are strings containing CSS values (colors, sizes, font stacks, etc.).
97
97
 
98
98
  Note: This type uses \`Record<K, string | undefined>\` rather than \`Partial<Record<K, string>>\`
99
- for compatibility with Zod schema generation. Both are functionally equivalent for validation.`),JR=m({method:p("ui/open-link"),params:m({url:u().describe("URL to open in the host's browser")})}),WR=m({isError:E().optional().describe("True if the host failed to open the URL (e.g., due to security policy).")}).passthrough(),KR=m({isError:E().optional().describe("True if the download failed (e.g., user cancelled or host denied).")}).passthrough(),GR=m({isError:E().optional().describe("True if the host rejected or failed to deliver the message.")}).passthrough(),YR=m({method:p("ui/notifications/sandbox-proxy-ready"),params:m({})}),Od=m({connectDomains:v(u()).optional().describe(`Origins for network requests (fetch/XHR/WebSocket).
99
+ for compatibility with Zod schema generation. Both are functionally equivalent for validation.`),tx=p({method:m("ui/open-link"),params:p({url:u().describe("URL to open in the host's browser")})}),rx=p({isError:I().optional().describe("True if the host failed to open the URL (e.g., due to security policy).")}).passthrough(),ox=p({isError:I().optional().describe("True if the download failed (e.g., user cancelled or host denied).")}).passthrough(),sx=p({isError:I().optional().describe("True if the host rejected or failed to deliver the message.")}).passthrough(),nx=p({method:m("ui/notifications/sandbox-proxy-ready"),params:p({})}),Ad=p({connectDomains:b(u()).optional().describe(`Origins for network requests (fetch/XHR/WebSocket).
100
100
 
101
101
  - Maps to CSP \`connect-src\` directive
102
- - Empty or omitted → no network connections (secure default)`),resourceDomains:v(u()).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:v(u()).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:v(u()).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'`)")}),Nd=m({camera:m({}).optional().describe("Request camera access.\n\nMaps to Permission Policy `camera` feature."),microphone:m({}).optional().describe("Request microphone access.\n\nMaps to Permission Policy `microphone` feature."),geolocation:m({}).optional().describe("Request geolocation access.\n\nMaps to Permission Policy `geolocation` feature."),clipboardWrite:m({}).optional().describe("Request clipboard write access.\n\nMaps to Permission Policy `clipboard-write` feature.")}),XR=m({method:p("ui/notifications/size-changed"),params:m({width:k().optional().describe("New width in pixels."),height:k().optional().describe("New height in pixels.")})}),uT=m({method:p("ui/notifications/tool-input"),params:m({arguments:T(u(),D().describe("Complete tool call arguments as key-value pairs.")).optional().describe("Complete tool call arguments as key-value pairs.")})}),lT=m({method:p("ui/notifications/tool-input-partial"),params:m({arguments:T(u(),D().describe("Partial tool call arguments (incomplete, may change).")).optional().describe("Partial tool call arguments (incomplete, may change).")})}),dT=m({method:p("ui/notifications/tool-cancelled"),params:m({reason:u().optional().describe('Optional reason for the cancellation (e.g., "user action", "timeout").')})}),QR=m({fonts:u().optional()}),ex=m({variables:BR.optional().describe("CSS variables for theming the app."),css:QR.optional().describe("CSS blocks that apps can inject.")}),mT=m({method:p("ui/resource-teardown"),params:m({})}),tx=T(u(),D()),PS=m({text:m({}).optional().describe("Host supports text content blocks."),image:m({}).optional().describe("Host supports image content blocks."),audio:m({}).optional().describe("Host supports audio content blocks."),resource:m({}).optional().describe("Host supports resource content blocks."),resourceLink:m({}).optional().describe("Host supports resource link content blocks."),structuredContent:m({}).optional().describe("Host supports structured content.")}),rx=m({method:p("ui/notifications/request-teardown"),params:m({}).optional()}),ox=m({experimental:T(u(),T(u(),pc()).describe("Experimental features keyed by identifier.")).optional().describe("Experimental features keyed by identifier."),openLinks:m({}).optional().describe("Host supports opening external URLs."),downloadFile:m({}).optional().describe("Host supports file downloads via ui/download-file."),serverTools:m({listChanged:E().optional().describe("Host supports tools/list_changed notifications.")}).optional().describe("Host can proxy tool calls to the MCP server."),serverResources:m({listChanged:E().optional().describe("Host supports resources/list_changed notifications.")}).optional().describe("Host can proxy resource reads to the MCP server."),logging:m({}).optional().describe("Host accepts log messages."),sandbox:m({permissions:Nd.optional().describe("Permissions granted by the host (camera, microphone, geolocation)."),csp:Od.optional().describe("CSP domains approved by the host.")}).optional().describe("Sandbox configuration applied by the host."),updateModelContext:PS.optional().describe("Host accepts context updates (ui/update-model-context) to be included in the model's context for future turns."),message:PS.optional().describe("Host supports receiving content messages (ui/message) from the view."),sampling:m({tools:m({}).optional().describe("Host supports tool use via `tools` and `toolChoice` parameters.")}).optional().describe("Host supports LLM sampling (sampling/createMessage) from the view.\nMirrors the MCP `ClientCapabilities.sampling` shape so hosts can pass it through.")}),sx=m({experimental:T(u(),T(u(),pc()).describe("Experimental features keyed by identifier.")).optional().describe("Experimental features keyed by identifier."),tools:m({listChanged:E().optional().describe("App supports tools/list_changed notifications.")}).optional().describe("App exposes MCP-style tools that the host can call."),availableDisplayModes:v(ma).optional().describe("Display modes the app supports.")}),nx=m({method:p("ui/notifications/initialized"),params:m({}).optional()}),pT=m({csp:Od.optional().describe("Content Security Policy configuration for UI resources."),permissions:Nd.optional().describe("Sandbox permissions requested by the UI resource."),domain:u().optional().describe(`Dedicated origin for view sandbox.
102
+ - Empty or omitted → no network connections (secure default)`),resourceDomains:b(u()).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:b(u()).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:b(u()).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'`)")}),Ld=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.")}),ix=p({method:m("ui/notifications/size-changed"),params:p({width:x().optional().describe("New width in pixels."),height:x().optional().describe("New height in pixels.")})}),gT=p({method:m("ui/notifications/tool-input"),params:p({arguments:C(u(),D().describe("Complete tool call arguments as key-value pairs.")).optional().describe("Complete tool call arguments as key-value pairs.")})}),ST=p({method:m("ui/notifications/tool-input-partial"),params:p({arguments:C(u(),D().describe("Partial tool call arguments (incomplete, may change).")).optional().describe("Partial tool call arguments (incomplete, may change).")})}),vT=p({method:m("ui/notifications/tool-cancelled"),params:p({reason:u().optional().describe('Optional reason for the cancellation (e.g., "user action", "timeout").')})}),ax=p({fonts:u().optional()}),cx=p({variables:ex.optional().describe("CSS variables for theming the app."),css:ax.optional().describe("CSS blocks that apps can inject.")}),bT=p({method:m("ui/resource-teardown"),params:p({})}),ux=C(u(),D()),IS=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.")}),lx=p({method:m("ui/notifications/request-teardown"),params:p({}).optional()}),dx=p({experimental:C(u(),C(u(),_c()).describe("Experimental features keyed by identifier.")).optional().describe("Experimental features keyed by identifier."),openLinks:p({}).optional().describe("Host supports opening external URLs."),downloadFile:p({}).optional().describe("Host supports file downloads via ui/download-file."),serverTools:p({listChanged:I().optional().describe("Host supports tools/list_changed notifications.")}).optional().describe("Host can proxy tool calls to the MCP server."),serverResources:p({listChanged:I().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:Ld.optional().describe("Permissions granted by the host (camera, microphone, geolocation)."),csp:Ad.optional().describe("CSP domains approved by the host.")}).optional().describe("Sandbox configuration applied by the host."),updateModelContext:IS.optional().describe("Host accepts context updates (ui/update-model-context) to be included in the model's context for future turns."),message:IS.optional().describe("Host supports receiving content messages (ui/message) from the view."),sampling:p({tools:p({}).optional().describe("Host supports tool use via `tools` and `toolChoice` parameters.")}).optional().describe("Host supports LLM sampling (sampling/createMessage) from the view.\nMirrors the MCP `ClientCapabilities.sampling` shape so hosts can pass it through.")}),px=p({experimental:C(u(),C(u(),_c()).describe("Experimental features keyed by identifier.")).optional().describe("Experimental features keyed by identifier."),tools:p({listChanged:I().optional().describe("App supports tools/list_changed notifications.")}).optional().describe("App exposes MCP-style tools that the host can call."),availableDisplayModes:b(_a).optional().describe("Display modes the app supports.")}),mx=p({method:m("ui/notifications/initialized"),params:p({}).optional()}),yT=p({csp:Ad.optional().describe("Content Security Policy configuration for UI resources."),permissions:Ld.optional().describe("Sandbox permissions requested by the UI resource."),domain:u().optional().describe(`Dedicated origin for view sandbox.
103
103
 
104
104
  Useful when views need stable, dedicated origins for OAuth callbacks, CORS policies, or API key allowlists.
105
105
 
@@ -107,20 +107,20 @@ Useful when views need stable, dedicated origins for OAuth callbacks, CORS polic
107
107
  - Hash-based subdomains (e.g., \`{hash}.claudemcpcontent.com\`)
108
108
  - URL-derived subdomains (e.g., \`www-example-com.oaiusercontent.com\`)
109
109
 
110
- If omitted, host uses default sandbox origin (typically per-conversation).`),prefersBorder:E().optional().describe(`Visual boundary preference - true if view prefers a visible border.
110
+ If omitted, host uses default sandbox origin (typically per-conversation).`),prefersBorder:I().optional().describe(`Visual boundary preference - true if view prefers a visible border.
111
111
 
112
112
  Boolean requesting whether a visible border and background is provided by the host. Specifying an explicit value for this is recommended because hosts' defaults may vary.
113
113
 
114
114
  - \`true\`: request visible border + background
115
115
  - \`false\`: request no visible border + background
116
- - omitted: host decides border`)}),TS=m({method:p("ui/request-display-mode"),params:m({mode:ma.describe("The display mode being requested.")})}),ES=m({mode:ma.describe("The display mode that was actually set. May differ from requested if not supported.")}).passthrough(),ix=C([p("model"),p("app")]).describe("Tool visibility scope - who can access the tool."),hT=m({resourceUri:u().optional(),visibility:v(ix).optional().describe(`Who can access this tool. Default: ["model", "app"]
116
+ - omitted: host decides border`)}),qS=p({method:m("ui/request-display-mode"),params:p({mode:_a.describe("The display mode being requested.")})}),OS=p({mode:_a.describe("The display mode that was actually set. May differ from requested if not supported.")}).passthrough(),hx=q([m("model"),m("app")]).describe("Tool visibility scope - who can access the tool."),wT=p({resourceUri:u().optional(),visibility:b(hx).optional().describe(`Who can access this tool. Default: ["model", "app"]
117
117
  - "model": Tool visible to and callable by the agent
118
- - "app": Tool callable by the app from this server only`),csp:Ll().optional(),permissions:Ll().optional()}),fT=m({mimeTypes:v(u()).optional().describe('Array of supported MIME types for UI resources.\nMust include `"text/html;profile=mcp-app"` for MCP Apps support.')}),ax=m({method:p("ui/download-file"),params:m({contents:v(C([oo,so])).describe("Resource contents to download — embedded (inline data) or linked (host fetches). Uses standard MCP resource types.")})}),cx=m({method:p("ui/message"),params:m({role:p("user").describe('Message role, currently only "user" is supported.'),content:v(qt).describe("Message content blocks (text, image, etc.).")})}),_T=m({method:p("ui/notifications/sandbox-resource-ready"),params:m({html:u().describe("HTML content to load into the inner iframe."),sandbox:u().optional().describe("Optional override for the inner iframe's sandbox attribute."),csp:Od.optional().describe("CSP configuration from resource metadata."),permissions:Nd.optional().describe("Sandbox permissions from resource metadata.")})}),gT=m({method:p("ui/notifications/tool-result"),params:gr.describe("Standard MCP tool execution result.")}),qS=m({toolInfo:m({id:ft.optional().describe("JSON-RPC id of the tools/call request."),tool:_r.describe("Tool definition including name, inputSchema, etc.")}).optional().describe("Metadata of the tool call that instantiated this App."),theme:FR.optional().describe("Current color theme preference."),styles:ex.optional().describe("Style configuration for theming the app."),displayMode:ma.optional().describe("How the UI is currently displayed."),availableDisplayModes:v(ma).optional().describe("Display modes the host supports."),containerDimensions:C([m({height:k().describe("Fixed container height in pixels.")}),m({maxHeight:C([k(),Al()]).optional().describe("Maximum container height in pixels.")})]).and(C([m({width:k().describe("Fixed container width in pixels.")}),m({maxWidth:C([k(),Al()]).optional().describe("Maximum container width in pixels.")})])).optional().describe(`Container dimensions. Represents the dimensions of the iframe or other
119
- container holding the app. Specify either width or maxWidth, and either height or maxHeight.`),locale:u().optional().describe("User's language and region preference in BCP 47 format."),timeZone:u().optional().describe("User's timezone in IANA format."),userAgent:u().optional().describe("Host application identifier."),platform:C([p("web"),p("desktop"),p("mobile")]).optional().describe("Platform type for responsive design decisions."),deviceCapabilities:m({touch:E().optional().describe("Whether the device supports touch input."),hover:E().optional().describe("Whether the device supports hover interactions.")}).optional().describe("Device input capabilities."),safeAreaInsets:m({top:k().describe("Top safe area inset in pixels."),right:k().describe("Right safe area inset in pixels."),bottom:k().describe("Bottom safe area inset in pixels."),left:k().describe("Left safe area inset in pixels.")}).optional().describe("Mobile safe area boundaries in pixels.")}).passthrough(),ST=m({method:p("ui/notifications/host-context-changed"),params:qS.describe("Partial context update containing only changed fields.")}),ux=m({method:p("ui/update-model-context"),params:m({content:v(qt).optional().describe("Context content blocks (text, image, etc.)."),structuredContent:T(u(),D().describe("Structured content for machine-readable context data.")).optional().describe("Structured content for machine-readable context data.")})}),lx=m({method:p("ui/initialize"),params:m({appInfo:Ct.describe("App identification (name and version)."),appCapabilities:sx.describe("Features and capabilities this app provides."),protocolVersion:u().describe("Protocol version this app supports.")})}),dx=m({protocolVersion:u().describe('Negotiated protocol version string (e.g., "2025-11-21").'),hostInfo:Ct.describe("Host application identification and version."),hostCapabilities:ox.describe("Features and capabilities provided by the host."),hostContext:qS.describe("Rich context about the host environment.")}).passthrough();class pa{eventTarget;eventSource;messageListener;constructor(e=window.parent,t){this.eventTarget=e,this.eventSource=t,this.messageListener=(r)=>{if(t&&r.source!==this.eventSource){console.debug("Ignoring message from unknown source",r);return}let o=_t.safeParse(r.data);if(o.success)console.debug("Parsed message",o.data),this.onmessage?.(o.data);else if(r.data?.jsonrpc!=="2.0")console.debug("Ignoring non-JSON-RPC message",o.error.message,r);else console.error("Failed to parse message",o.error.message,r),this.onerror?.(Error("Invalid JSON-RPC message received: "+o.error.message))}}async start(){window.addEventListener("message",this.messageListener)}async send(e,t){if(e.method!==HR)console.debug("Sending message",e);this.eventTarget.postMessage(e,"*")}async close(){window.removeEventListener("message",this.messageListener),this.onclose?.()}onclose;onerror;onmessage;sessionId;setProtocolVersion}var mx=[IS];class ha extends ua{_client;_hostInfo;_hostCapabilities;_appCapabilities;_hostContext={};_appInfo;_initializedReceived=!1;_registeredEvents=new Set;_events=new $S;_methods=new CS;setRequestHandler=(...e)=>{let[t,...r]=kS("request",e)??e;this._methods.claim(t,"setRequestHandler"),super.setRequestHandler.call(this,t,...r)};setNotificationHandler=(...e)=>{let[t,...r]=kS("notification",e)??e;this._methods.claim(t,"setNotificationHandler"),super.setNotificationHandler.call(this,t,...r)};removeRequestHandler=(e)=>{this._methods.release(e),super.removeRequestHandler(e)};removeNotificationHandler=(e)=>{this._methods.release(e),super.removeNotificationHandler(e)};replaceRequestHandler=(e,...t)=>{this._methods.replace(e),super.setRequestHandler.call(this,e,...t)};_wrapHandler(e,t){let r=super._wrapHandler(e,t);if(e==="ui/initialize"||e==="ping")return r;return async(o,s)=>{if(!this._initializedReceived)console.warn(`[ext-apps] AppBridge received '${e}' before ui/notifications/initialized. The View is calling host methods before completing the handshake; it should await app.connect() first.`);return r(o,s)}}eventSchemas={sizechange:XR,sandboxready:YR,initialized:nx,requestteardown:rx,loggingmessage:no};setEventHandler(e,t){this._ensureEventSlot(e),this._events.setHandler(e,t)}getEventHandler(e){return this._events.getHandler(e)}addEventListener(e,t){this._ensureEventSlot(e),this._events.addEventListener(e,t)}removeEventListener(e,t){this._events.removeEventListener(e,t)}_ensureEventSlot(e){if(this._registeredEvents.has(e))return;let t=this.eventSchemas[e];if(!t)throw Error(`Unknown event: ${String(e)}`);let r=(o)=>{if(e==="initialized")this._initializedReceived=!0;this._events.dispatch(e,o)};if(e==="loggingmessage")this.setNotificationHandler("notifications/message",(o)=>{r(o.params)});else this.setNotificationHandler(t.shape.method.value,{params:t.shape.params},(o)=>r(o));this._registeredEvents.add(e)}warnIfRequestHandlerReplaced(e,t,r){if(t&&r)console.warn(`[MCP Apps] ${e} handler replaced. Previous handler will no longer be called.`)}constructor(e,t,r,o){super(o);this._client=e,this._hostInfo=t,this._hostCapabilities=r,this._methods.replace("notifications/cancelled"),this._methods.replace("notifications/progress"),this._ensureEventSlot("initialized"),this._hostContext=o?.hostContext||{},this.replaceRequestHandler("ui/initialize",{params:lx.shape.params,result:dx},(s)=>this._onAppsInitialize(s)),this.replaceRequestHandler("ping",(s,n)=>(this.onping?.(s.params,n),{})),this.replaceRequestHandler("ui/request-display-mode",{params:TS.shape.params,result:ES},()=>({mode:this._hostContext.displayMode??"inline"}))}buildContext(e){return e}assertCapabilityForMethod(e){}assertRequestHandlerCapability(e){}assertNotificationCapability(e){}getAppCapabilities(){return this._appCapabilities}getAppVersion(){return this._appInfo}onping;get onsizechange(){return this.getEventHandler("sizechange")}set onsizechange(e){this.setEventHandler("sizechange",e)}get onsandboxready(){return this.getEventHandler("sandboxready")}set onsandboxready(e){this.setEventHandler("sandboxready",e)}get oninitialized(){return this.getEventHandler("initialized")}set oninitialized(e){this.setEventHandler("initialized",e)}_onmessage;get onmessage(){return this._onmessage}set onmessage(e){this.warnIfRequestHandlerReplaced("onmessage",this._onmessage,e),this._onmessage=e,this.replaceRequestHandler("ui/message",{params:cx.shape.params,result:GR},async(t,r)=>{if(!this._onmessage)throw Error("No onmessage handler set");return this._onmessage(t,r)})}_onopenlink;get onopenlink(){return this._onopenlink}set onopenlink(e){this.warnIfRequestHandlerReplaced("onopenlink",this._onopenlink,e),this._onopenlink=e,this.replaceRequestHandler("ui/open-link",{params:JR.shape.params,result:WR},async(t,r)=>{if(!this._onopenlink)throw Error("No onopenlink handler set");return this._onopenlink(t,r)})}_ondownloadfile;get ondownloadfile(){return this._ondownloadfile}set ondownloadfile(e){this.warnIfRequestHandlerReplaced("ondownloadfile",this._ondownloadfile,e),this._ondownloadfile=e,this.replaceRequestHandler("ui/download-file",{params:ax.shape.params,result:KR},async(t,r)=>{if(!this._ondownloadfile)throw Error("No ondownloadfile handler set");return this._ondownloadfile(t,r)})}get onrequestteardown(){return this.getEventHandler("requestteardown")}set onrequestteardown(e){this.setEventHandler("requestteardown",e)}_onrequestdisplaymode;get onrequestdisplaymode(){return this._onrequestdisplaymode}set onrequestdisplaymode(e){this.warnIfRequestHandlerReplaced("onrequestdisplaymode",this._onrequestdisplaymode,e),this._onrequestdisplaymode=e,this.replaceRequestHandler("ui/request-display-mode",{params:TS.shape.params,result:ES},async(t,r)=>{if(!this._onrequestdisplaymode)throw Error("No onrequestdisplaymode handler set");return this._onrequestdisplaymode(t,r)})}get onloggingmessage(){return this.getEventHandler("loggingmessage")}set onloggingmessage(e){this.setEventHandler("loggingmessage",e)}_onupdatemodelcontext;get onupdatemodelcontext(){return this._onupdatemodelcontext}set onupdatemodelcontext(e){this.warnIfRequestHandlerReplaced("onupdatemodelcontext",this._onupdatemodelcontext,e),this._onupdatemodelcontext=e,this.replaceRequestHandler("ui/update-model-context",{params:ux.shape.params,result:hr},async(t,r)=>{if(!this._onupdatemodelcontext)throw Error("No onupdatemodelcontext handler set");return this._onupdatemodelcontext(t,r)})}_oncalltool;get oncalltool(){return this._oncalltool}set oncalltool(e){this.warnIfRequestHandlerReplaced("oncalltool",this._oncalltool,e),this._oncalltool=e,this.replaceRequestHandler("tools/call",async(t,r)=>{if(!this._oncalltool)throw Error("No oncalltool handler set");return this._oncalltool(t.params,r)})}_oncreatesamplingmessage;get oncreatesamplingmessage(){return this._oncreatesamplingmessage}set oncreatesamplingmessage(e){this.warnIfRequestHandlerReplaced("oncreatesamplingmessage",this._oncreatesamplingmessage,e),this._oncreatesamplingmessage=e,this.replaceRequestHandler("sampling/createMessage",async(t,r)=>{if(!this._oncreatesamplingmessage)throw Error("No oncreatesamplingmessage handler set");return this._oncreatesamplingmessage(t.params,r)})}sendToolListChanged(e={}){return this.notification({method:"notifications/tools/list_changed",params:e})}_onlistresources;get onlistresources(){return this._onlistresources}set onlistresources(e){this.warnIfRequestHandlerReplaced("onlistresources",this._onlistresources,e),this._onlistresources=e,this.replaceRequestHandler("resources/list",async(t,r)=>{if(!this._onlistresources)throw Error("No onlistresources handler set");return this._onlistresources(t.params,r)})}_onlistresourcetemplates;get onlistresourcetemplates(){return this._onlistresourcetemplates}set onlistresourcetemplates(e){this.warnIfRequestHandlerReplaced("onlistresourcetemplates",this._onlistresourcetemplates,e),this._onlistresourcetemplates=e,this.replaceRequestHandler("resources/templates/list",async(t,r)=>{if(!this._onlistresourcetemplates)throw Error("No onlistresourcetemplates handler set");return this._onlistresourcetemplates(t.params,r)})}_onreadresource;get onreadresource(){return this._onreadresource}set onreadresource(e){this.warnIfRequestHandlerReplaced("onreadresource",this._onreadresource,e),this._onreadresource=e,this.replaceRequestHandler("resources/read",async(t,r)=>{if(!this._onreadresource)throw Error("No onreadresource handler set");return this._onreadresource(t.params,r)})}sendResourceListChanged(e={}){return this.notification({method:"notifications/resources/list_changed",params:e})}_onlistprompts;get onlistprompts(){return this._onlistprompts}set onlistprompts(e){this.warnIfRequestHandlerReplaced("onlistprompts",this._onlistprompts,e),this._onlistprompts=e,this.replaceRequestHandler("prompts/list",async(t,r)=>{if(!this._onlistprompts)throw Error("No onlistprompts handler set");return this._onlistprompts(t.params,r)})}sendPromptListChanged(e={}){return this.notification({method:"notifications/prompts/list_changed",params:e})}getCapabilities(){return this._hostCapabilities}async _onAppsInitialize(e){let t=e.protocolVersion;if(this._appInfo!==void 0)console.warn("[ext-apps] AppBridge received a second ui/initialize. The View may be double-mounting (e.g. React StrictMode in dev) without closing the previous App instance. Responding normally; the latest appInfo/appCapabilities replace the previous values.");return this._appCapabilities=e.appCapabilities,this._appInfo=e.appInfo,{protocolVersion:mx.includes(t)?t:IS,hostCapabilities:this.getCapabilities(),hostInfo:this._hostInfo,hostContext:this._hostContext}}setHostContext(e){let t={},r=!1;for(let o of Object.keys(e)){let s=this._hostContext[o],n=e[o];if(px(s,n))continue;t[o]=n,r=!0}if(r)this._hostContext=e,this.sendHostContextChange(t)}sendHostContextChange(e){return this.notification({method:"ui/notifications/host-context-changed",params:e})}sendToolInput(e){return this.notification({method:"ui/notifications/tool-input",params:e})}sendToolInputPartial(e){return this.notification({method:"ui/notifications/tool-input-partial",params:e})}sendToolResult(e){return this.notification({method:"ui/notifications/tool-result",params:e})}sendToolCancelled(e){return this.notification({method:"ui/notifications/tool-cancelled",params:e})}sendSandboxResourceReady(e){return this.notification({method:"ui/notifications/sandbox-resource-ready",params:e})}teardownResource(e,t){return this.request({method:"ui/resource-teardown",params:e},tx,t)}sendResourceTeardown=this.teardownResource;callTool(e,t){return this.request({method:"tools/call",params:e},t)}listTools(e,t){return this.request({method:"tools/list",params:e},t)}async connect(e){if(this.transport)throw Error("AppBridge is already connected. Call close() before connecting again.");if(this._initializedReceived=!1,this._client){let t=this._client.getServerCapabilities();if(!t)throw Error("Client server capabilities not available");if(t.tools){if(this.oncalltool=async(r,o)=>this._client.request({method:"tools/call",params:r},{signal:o.mcpReq.signal}),t.tools.listChanged)this._client.setNotificationHandler("notifications/tools/list_changed",(r)=>this.sendToolListChanged(r.params))}if(t.resources){if(this.onlistresources=async(r,o)=>this._client.request({method:"resources/list",params:r},{signal:o.mcpReq.signal}),this.onlistresourcetemplates=async(r,o)=>this._client.request({method:"resources/templates/list",params:r},{signal:o.mcpReq.signal}),this.onreadresource=async(r,o)=>this._client.request({method:"resources/read",params:r},{signal:o.mcpReq.signal}),t.resources.listChanged)this._client.setNotificationHandler("notifications/resources/list_changed",(r)=>this.sendResourceListChanged(r.params))}if(t.prompts){if(this.onlistprompts=async(r,o)=>this._client.request({method:"prompts/list",params:r},{signal:o.mcpReq.signal}),t.prompts.listChanged)this._client.setNotificationHandler("notifications/prompts/list_changed",(r)=>this.sendPromptListChanged(r.params))}}return super.connect(e)}}function px(e,t){return JSON.stringify(e)===JSON.stringify(t)}var OS=[200,800],hx=(e)=>e?.name==="TypeError"&&/^(Failed to fetch|fetch failed|Load failed|NetworkError when attempting to fetch resource\.)$/.test(e.message);function fx(e,t){return new Promise((r,o)=>{t?.throwIfAborted();let n=setTimeout(()=>{t?.removeEventListener("abort",i),r()},e),i=()=>{clearTimeout(n),t.removeEventListener("abort",i),o(t.reason)};t?.addEventListener("abort",i,{once:!0})})}function NS(e,{signal:t,onDiagnostic:r,wait:o=fx}={}){return async(s)=>{for(let n=1;;n++){t?.throwIfAborted();try{let i=await e(s);if(t?.throwIfAborted(),n>1)r?.({state:"recovered",uri:s.uri,attempt:n});return i}catch(i){if(t?.throwIfAborted(),!hx(i))throw i;if(n>OS.length)throw r?.({state:"exhausted",uri:s.uri,attempt:n,message:i.message}),Object.assign(Error(`MCP resource transport failed for ${s.uri} after ${n} attempts: ${i.message}. Inspect the host connection and browser network diagnostics; this resource-loading error does not establish a component assertion failure.`,{cause:i}),{code:"ADS_RESOURCE_TRANSPORT"});let a=OS[n-1];r?.({state:"retry",uri:s.uri,attempt:n,nextAttempt:n+1,delayMs:a,message:i.message}),await o(a,t)}}}}function jS(e,{onError:t,delay:r=150,setTimer:o=setTimeout,clearTimer:s=clearTimeout}={}){let n=!1,i=!1,a=!1,c=!1,l=!1,d;function f(){if(!n||i||a||!c||d!==void 0)return;d=o(()=>{d=void 0,a=!0;let h=l;c=l=!1,Promise.resolve().then(()=>e(h)).catch((g)=>{if(!i)t?.(g)}).finally(()=>{a=!1,f()})},r)}return{schedule(h=!1){if(i)return;c=!0,l||=h,f()},start(){n=!0,f()},close(){i=!0,c=l=!1,s(d),d=void 0}}}function MS(e){let t=[],r=new Map;for(let o of e){if(!o.group){t.push(o);continue}if(!r.has(o.group))r.set(o.group,[]);r.get(o.group).push(o)}return[...t.length?[{label:null,entries:t}]:[],...[...r].sort(([o],[s])=>o.localeCompare(s)).map(([o,s])=>({label:o,entries:s}))]}async function LS({slot:e,title:t,sandboxUrl:r,resourceUri:o,result:s,readResource:n,callTool:i,context:a,onError:c,onState:l}){let d={slot:e,title:t,sandboxUrl:r,resourceUri:o,readResource:n,callTool:i,context:a,onError:c,onState:l},f=s,h,g,b,_=!1;function w(){if(_||b)return;l?.({state:"loading"}),b=Promise.resolve().then(async()=>{if(await g,await h?.close(),_)return;g=AS({...d,result:f,onReopen:w});try{h=await g}finally{g=void 0}}).catch((I)=>{if(!_)c(I)}).finally(()=>{b=void 0})}g=AS({...d,result:f,onReopen:w});try{h=await g}finally{g=void 0}return{async updateResult(I){if(f=I,await b,!_)await h.updateResult(f)},refreshContext(){if(!_&&!b)h.refreshContext()},async close(){_=!0,await b,await h?.close()}}}async function AS({slot:e,title:t,sandboxUrl:r,resourceUri:o,result:s,readResource:n,callTool:i,context:a,onError:c,onState:l,onReopen:d}){let f=!1,g=(await n({uri:o})).contents.find((z)=>z.mimeType==="text/html;profile=mcp-app"&&typeof z.text==="string");if(!g)throw Error("Comparison preview App is unavailable.");let b=document.createElement("iframe");b.title=t,b.setAttribute("sandbox","allow-scripts allow-same-origin allow-forms"),b.src=r,e.append(b);let _=new ha(null,{name:"ADS showcase",version:"1.0.0"},{serverResources:{},serverTools:{},logging:{}},{hostContext:a(b)});_.onreadresource=n,_.oncalltool=i,_.onerror=(z)=>{if(!f)c(z)},_.onloggingmessage=(z)=>{if(f||z.logger!=="ads-preview")return;if(z.data?.code==="ADS_PREVIEW_REOPEN"){d();return}if(l?.(z.data),z.data?.state==="error")c(Error(z.data.message))};let w,I=new Promise((z,q)=>{w=setTimeout(()=>q(Error("Comparison App initialization timed out.")),15000),_.oninitialized=()=>{clearTimeout(w),z()}});_.onsandboxready=()=>_.sendSandboxResourceReady({html:g.text,csp:g._meta?.ui?.csp,sandbox:"allow-scripts allow-forms"});let A=new ResizeObserver(()=>_.setHostContext(a(b)));try{await Promise.all([_.connect(new pa(b.contentWindow,b.contentWindow)),I]),A.observe(b),await _.sendToolInput({arguments:{}}),await _.sendToolResult(s)}catch(z){throw A.disconnect(),b.remove(),await _.close(),z}finally{clearTimeout(w)}return{updateResult:(z)=>_.sendToolResult(z),refreshContext:()=>_.setHostContext(a(b)),async close(){f=!0,A.disconnect();try{await _.teardownResource({},{timeout:500})}catch{}await _.close(),b.remove()}}}function nu(e,t){return t===e||t.startsWith(e+"/")||t.startsWith(e+".")}function US(e,t,r,o=new Map){let s=new Map(r.map(({id:c,title:l,revision:d,state:f,preview:h})=>[c,{id:c,title:l,revision:d,state:f,...h?{preview:h}:{}}])),n=new Map(e.map((c)=>[c.id,{...c,drafts:(c.drafts??[]).flatMap((l)=>s.has(l.id)?[s.get(l.id)]:[])}]));for(let c of t){let l=n.get(c.id);n.set(c.id,{...l,...c,kind:"tokens",drafts:l?.drafts??[]})}let i=(c,l)=>c==="assets/pictograms"&&l.kind==="pictograms"||c==="tokens"&&l.kind==="tokens"||(l.unit?l.unit===c:nu(c,l.id)),a=(c,l)=>{if(!c.drafts.some((d)=>d.id===l.id))c.drafts.push(s.get(l.id))};for(let c of r){let l=o.get(c.id);for(let d of l?.scenarios??[]){if(!c.units.some((h)=>i(h,d)))continue;let f=n.get(d.id);if(!f)f={...d,draftOnly:!0,drafts:[]},n.set(d.id,f);a(f,c)}}for(let c of r)for(let l of c.units){let d=l==="assets/pictograms"?"pictograms":l.split("/")[0];if(!["brand","pictograms","tokens","components","patterns","composition"].includes(d))continue;let f=[...n.values()].filter((h)=>i(l,h));if(f.length)for(let h of f)a(h,c);else n.set(l,{id:l,unit:l,title:l.split("/").at(-1),kind:d,draftOnly:!0,pendingDraftScenario:!0,drafts:[s.get(c.id)]})}return{scenarios:[...n.values()],categories:[...n.values()].filter((c)=>c.kind==="tokens")}}var _x=(e)=>e==="assets/pictograms"?"pictograms":e==="assets/glyphs"||e==="assets/logos"?"icons":e==="assets/brand"?"brand":e==="foundation"?"tokens":["brand","tokens","icons","components","patterns","composition"].includes(e.split("/")[0])?e.split("/")[0]:"other",su={brand:"Brand",icons:"Icons",pictograms:"Pictograms",tokens:"Tokens",components:"Components",patterns:"Patterns",composition:"Compositions",other:"Other"};function DS(e,t){let r=[];for(let o of t){let s=e.filter((n)=>n.drafts?.some((i)=>i.id===o.id));for(let n of s)r.push({...n,id:`drafts/${encodeURIComponent(o.id)}/${encodeURIComponent(n.id)}`,previewId:n.id,title:`${o.title||o.id} · ${n.title}`,group:su[n.kind]??"Other",drafts:[o]});for(let n of o.units??[]){if(s.some((a)=>n==="tokens"&&a.kind==="tokens"||a.unit===n||!a.unit&&nu(n,a.id)))continue;let i=_x(n);r.push({id:`drafts/${encodeURIComponent(o.id)}/${encodeURIComponent(n)}`,unit:n,kind:i,title:`${o.title||o.id} · ${n.split("/").at(-1)}`,group:su[i],drafts:[o]})}if(!s.length&&!o.units?.length)r.push({id:`drafts/${encodeURIComponent(o.id)}`,kind:"other",title:o.title||o.id,group:"Other",drafts:[o]})}return r}var gx=["off","hover","always"],Sx=["bounds","tracks","gaps","padding","margins","mini"],ZS=Object.freeze({mode:"off",bounds:!0,tracks:!1,gaps:!1,padding:!0,margins:!0,mini:!1});function fa(e){return{mode:gx.includes(e?.mode)?e.mode:e?.all===!0?"always":"off",...Object.fromEntries(Sx.map((r)=>[r,e?.[r]===!0]))}}function HS(e){let{mode:t,...r}=fa(e);return{all:t==="always",...r}}function FS(e){let{mode:t,...r}=fa(e);return t!=="off"&&Object.values(r).some(Boolean)}function jd(e,t,r){let o=e.drafts?.find((c)=>c.id===r)??e.drafts?.[0],s=o&&(t?.drafts?.find((c)=>c.id===o.id)??o.preview),n=o?s?.scenarios?.find((c)=>c.id===e.id)??s:t?.previews?.find((c)=>c.id===e.id)??e.build,i=n?.state==="error"?"error":n?.state==="checking"||n?.live?"checking":n?.building||["queued","building"].includes(n?.state)?"building":n?.current?"ready":n?.stale?"stale":"unreported",a={error:Za(n),checking:"Preview compiled; checking changes",building:"Preview build in progress",ready:"Preview build complete",stale:"Previous preview; current source not built",unreported:"Preview not built"};return{state:i,label:`${o?"Draft · ":""}${a[i]}${o&&i==="ready"?" · unaccepted":""}`}}var le,cv,wr,VS,lu,uv,au,lv,Fd,Ud,du={},mu=[],vx=/^m(i|n|o|s|text|space)$/,Vd=Array.isArray,dv=mu.slice,go=Object.assign;function pu(e){e&&e.parentNode&&e.remove()}function cu(e,t,r,o,s){var n={type:e,props:t,key:r,ref:o,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:s||++cv,__i:-1,__u:0};return!s&&le.vnode&&le.vnode(n),n}function Qt(e){return e.children}function uu(e,t){this.props=e,this.context=t,this.__g=0}function zr(e,t){if(t==null)return e.__?zr(e.__,e.__i+1):null;for(var r;t<e.__k.length;t++)if((r=e.__k[t])&&r.__e)return r.__e;return typeof e.type!="function"||e.props.__P?null:zr(e)}function mv(e){if((e=e.__)&&e.__c&&!e.props.__P)return e.__e=null,e.__k.some(function(t){return t&&(e.__e=t.__e)}),mv(e)}function BS(e){(8&e.__g||!(e.__g|=8)||!wr.push(e)||lu++)&&VS==le.debounceRendering||((VS=le.debounceRendering)||queueMicrotask)(bx)}function bx(){var e,t,r,o,s,n,i,a,c;try{for(t=1;wr.length;)wr.length>t&&wr.sort(uv),e=wr.shift(),t=wr.length,8&e.__g&&(o=void 0,s=void 0,n=(s=(r=e).__v).__e,i=[],a=[],(c=r.__P)&&((o=go({constructor:void 0},s)).__v=s.__v+1,le.vnode&&le.vnode(o),Bd(c,o,s,r.__n,c.namespaceURI,32&s.__u?[n]:null,i,n||zr(s),32&s.__u,a),o.__v=s.__v,o.__.__k[o.__i]=o,_v(i,o,a),s.__=s.__e=null,o.__e!=n&&mv(o)))}finally{wr.length=lu=0}}function pv(e,t,r,o,s,n,i,a,c,l,d){var f,h,g,b,_,w,I=o.__k||mu,A=t.length;for(c=yx(r,t,I,c,A),f=0;f<A;f++)(g=r.__k[f])!=null&&(h=~g.__i&&I[g.__i]||du,g.__i=f,w=Bd(e,g,h,s,n,i,a,c,l,d),b=g.__e,(h.ref!=g.ref||8&h.__u)&&(h.ref&&Jd(h.ref,null,g,h),g.ref&&d.push(g.ref,g.__c||b,g)),_=_||b,4&g.__u?(c=hv(g,c,e,!h.__v),h.__e&&(h.__e=null)):typeof g.type=="function"&&w!==void 0?c=w:b&&(c=b.nextSibling),g.__u&=-7);return r.__e=_,c}function yx(e,t,r,o,s){var n,i,a,c,l,d,f,h,g,b,_=r.length,w=_,I=0,A=!1,z=e.__k=Array(s);for(n=0;n<s;n++)(i=t[n])!=null&&typeof i!="boolean"&&typeof i!="function"?(typeof i!="object"||i.constructor==String?i=z[n]=cu(null,i):Vd(i)?i=z[n]=cu(Qt,{children:i}):i.constructor===void 0&&i.__b?i=z[n]=cu(i.type,i.props,i.key,i.ref,i.__v):z[n]=i,c=n+I,i.__=e,i.__b=e.__b+1,a=null,~(l=i.__i=wx(i,r,c,w))&&(w--,(a=r[l])&&(a.__u|=2)),a&&a.__v?(i.__u|=2,l==c-1?I--:l==c+1?I++:l!=c&&(l>c?I--:I++,A=!0)):(~l||(s>_?I--:s<_&&I++),typeof i.type!="function"&&(i.__u|=4))):z[n]=null;if(A){for(d=[],f=[],n=0;n<s;n++)if((i=z[n])&&2&i.__u){for(h=0,g=d.length;h<g;)d[b=h+g>>1]<i.__i?h=b+1:g=b;d[h]=i.__i,f[n]=h+1}for(I=d.length;n--;)f[n]&&(f[n]==I?I--:z[n].__u|=4)}if(w)for(n=0;n<_;n++)!(a=r[n])||2&a.__u||(a.__e==o&&(o=zr(a)),Wd(a,a));return o}function hv(e,t,r,o){var s,n,i;if(typeof e.type=="function"){if(e.props.__P)return t;if(s=e.__k)for(n=0;n<s.length;n++)s[n]&&(s[n].__=e,t=hv(s[n],t,r,!1));return t}for(t&&!t.parentNode&&(t=zr(e))&&!t.parentNode&&(t=null),i=t;i&&i.nodeType==8;)i=i.nextSibling;for(e.__e!=i&&(!o&&r.moveBefore&&e.__e.parentNode?r.moveBefore(e.__e,t):r.insertBefore(e.__e,t||null)),t=e.__e;(t=t&&t.nextSibling)&&t.nodeType==8;);return t}function wx(e,t,r,o){var s,n,i,{key:a,type:c}=e,l=t[r],d=l&&!(2&l.__u);if(l===null&&a==null||d&&a==l.key&&c==l.type)return r;if(o>(d?1:0)){for(s=r-1,n=r+1;s>=0||n<t.length;)if((l=t[i=s>=0?s--:n++])&&!(2&l.__u)&&a==l.key&&c==l.type)return i}return-1}function JS(e,t,r){r==null&&(r=""),t[0]=="-"?e.setProperty(t,r):e[t]=r}function iu(e,t,r,o,s){var n,i;e:if(t=="style")if(typeof r=="string")e.style.cssText=r;else{if(typeof o=="string"&&(e.style.cssText=o=""),o)for(t in o)r&&t in r||JS(e.style,t,"");if(r)for(t in r)o&&r[t]==o[t]||JS(e.style,t,r[t])}else if(t[0]=="o"&&t[1]=="n")(e.__e||(e.__e={}))[t]=r,r&&o||(i=Ud[t]||(Ud[t]=zx(t)),(e.__a||(e.__a={}))[t]=Fd,n=t!=(t=t.replace(lv,"$1")),(t=t.slice(2))[0]<"a"&&(t=t.toLowerCase()),r?e.addEventListener(t,i,n):e.removeEventListener(t,i,n));else{if(s=="http://www.w3.org/2000/svg")t=t.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(t!="width"&&t!="height"&&t!="href"&&t!="list"&&t!="form"&&t!="tabIndex"&&t!="download"&&t!="rowSpan"&&t!="colSpan"&&t!="role"&&t!="popover"&&t in e)try{e[t]=r==null?"":r;break e}catch(a){}typeof r=="function"||(r==null||r===!1&&t[4]!="-"?e.removeAttribute(t):e.setAttribute(t,t=="popover"&&r==1?"":r))}}function zx(e){return function(t){if(this.__e){var r=this.__e[e];if(t[au]==null)t[au]=Fd++;else if(t[au]<this.__a[e])return;return r(le.event?le.event(t):t)}}}function Bd(e,t,r,o,s,n,i,a,c,l){var d,f,h,g,b,_,w,I,A,z,q,x,R,Z,ee,X,ne,xe,te,ie,re=t.type;if(t.constructor!==void 0)return null;if(128&r.__u&&(c=32&r.__u,d=r.__c.__z)){if(t.__u|=c,f=n=[],d.nodeType==8)for(h=1,g=d.nextSibling;g;g=g.nextSibling){if(g.nodeType==8){if(g.data.startsWith("$s"))h++;else if(g.data.startsWith("/$s")&&!--h)break}n.push(g)}else n.push(d);a=n[0]}(d=le.__b)&&d(t);e:if(typeof re=="function"){b=i.length;try{if(z=t.props,q=(d=re.prototype)&&d.render,x=(d=re.contextType)&&o[d.__c],R=d?x?x.props.value:d.__:o,r.__c?2&(_=t.__c=r.__c).__g&&(_.__g|=1):(q?t.__c=_=new re(z,R):(t.__c=_=new uu(z,R),_.constructor=re,_.render=xx),x&&x.sub(_),_.state||(_.state={}),_.__n=o,_.__g|=8,_.__h=[],_.__k=[]),q&&(_.__s||(_.__s=_.state),re.getDerivedStateFromProps&&(_.__s==_.state&&(_.__s=go({},_.__s)),go(_.__s,re.getDerivedStateFromProps(z,_.__s)))),w=_.props,I=_.state,_.__v=t,r.__c){if(q&&!re.getDerivedStateFromProps&&z!==w&&_.componentWillReceiveProps&&_.componentWillReceiveProps(z,R),t.__v==r.__v&&!(8&_.__g)||!(4&_.__g)&&_.shouldComponentUpdate&&_.shouldComponentUpdate(z,_.__s,R)===!1){t.__v!=r.__v&&(_.props=z,_.state=_.__s,_.__g&=-9),t.__e=r.__e,t.__k=r.__k,t.__k.some(function(de){de&&(de.__=t)}),mu.push.apply(_.__h,_.__k),_.__k=[],_.__h.length&&i.push(_),a=zr(r);break e}_.componentWillUpdate&&_.componentWillUpdate(z,_.__s,R),q&&_.componentDidUpdate&&_.__h.push(function(){_.componentDidUpdate(w,I,A)})}else q&&!re.getDerivedStateFromProps&&_.componentWillMount&&_.componentWillMount(),q&&_.componentDidMount&&_.__h.push(_.componentDidMount);if(_.context=R,_.props=z,_.__P=e,_.__g&=-5,Z=le.__r,ee=0,q)_.state=_.__s,_.__g&=-9,Z&&Z(t),d=_.render(_.props,_.state,_.context),mu.push.apply(_.__h,_.__k),_.__k=[];else do _.__g&=-9,Z&&Z(t),d=_.render(_.props,_.state,_.context),_.state=_.__s;while(8&_.__g&&++ee<25);_.state=_.__s,_.getChildContext&&(o=go({},o,_.getChildContext())),q&&r.__c&&_.getSnapshotBeforeUpdate&&(A=_.getSnapshotBeforeUpdate(w,I)),X=d&&d.type===Qt&&d.key==null?d.props.children:d,z.__P&&(d=a,s=(e=z.__P).namespaceURI,c=n=null,r.props&&r.props.__P!=e&&(r.__k.some(function(de){de&&Wd(de,de)}),r.__k=null),a=r.__k?zr(r,0):null),a=pv(e,Vd(X)?X:[X],t,r,o,s,n,i,a,c,l),z.__P&&(t.__e=null,a=d),t.__u&=-161,128&r.__u&&(_.__z=null),f&&f.some(pu),_.__h.length&&i.push(_),1&_.__g&&(_.__g&=-4)}catch(de){if(i.length=b,t.__v=null,c||n)if(de.then){if(ne=0,t.__u|=c?160:128,n){for(~(te=n.indexOf(a||void 0))||(te=n.length);(ie=n[te-1])&&ie.nodeType==8;)te--;for(;te<n.length;te++)if(ie=n[te]){if(n[te]=null,ie.nodeType==8){if(ie.data.startsWith("$s"))ne++||(xe=ie);else if(ne&&ie.data.startsWith("/$s")&&!--ne){a=ie;break}}else if(!ne)break}}if(!xe){for(;a&&a.nodeType==8&&a.nextSibling;)a=a.nextSibling;xe=a}t.__c.__z||(t.__c.__z=xe),t.__e=a}else n&&n.some(pu);else t.__e=r.__e;t.__k||(t.__k=r.__k||[]),de.then||fv(t),le.__e(de,t,r)}}else a=t.__e=Rx(r.__e,t,r,o,s,n,i,c,l,e);return(d=le.diffed)&&d(t),128&t.__u?void 0:a}function fv(e){e&&(e.__c&&(e.__c.__g|=4),e.__k&&e.__k.some(fv))}function _v(e,t,r){for(var o=0;o<r.length;)Jd(r[o++],r[o++],r[o++]);le.__c&&le.__c(t,e),e.some(function(s){try{e=s.__h,s.__h=[],e.some(function(n){n.call(s)})}catch(n){le.__e(n,s.__v)}})}function Rx(e,t,r,o,s,n,i,a,c,l){var d,f,h,g,b,_,w,I,A,z=r.props||du,{props:q,type:x}=t;if(x=="svg"?s="http://www.w3.org/2000/svg":x=="math"?s="http://www.w3.org/1998/Math/MathML":s||(s="http://www.w3.org/1999/xhtml"),n){for(d=0;d<n.length;d++)if((b=n[d])&&(x?b.localName==x:b.nodeType==3)){e=b,n[d]=null;break}}if(!e){if(I=l.ownerDocument||document,!x)return I.createTextNode(q);e=I.createElementNS(s,x,q.is&&q),a&&(le.__m&&le.__m(t,n),a=!1),n=null}if(x){if(l=x=="template"?e.content:e,n=x=="textarea"&&q.defaultValue!=null?null:n&&dv.call(l.childNodes),!a&&n)for(z={},d=0;d<e.attributes.length;d++)z[(b=e.attributes[d]).name]=b.value;for(d in z)b=z[d],d=="dangerouslySetInnerHTML"?h=b:d=="children"||(d in q)||d=="value"&&("defaultValue"in q)||d=="checked"&&("defaultChecked"in q)||iu(e,d,null,b,s);for(d in A=1&r.__u,q)b=q[d],d=="children"?g=b:d=="dangerouslySetInnerHTML"?f=b:d=="value"?_=b:d=="checked"?w=b:a&&typeof b!="function"||!(z[d]!==b||A&&b!=null)||iu(e,d,b,z[d],s);f?(a||h&&(f.__html==h.__html||f.__html==e.innerHTML)||(e.innerHTML=f.__html),t.__k=[]):(h&&(e.textContent=""),(x=="foreignObject"||s=="http://www.w3.org/1998/Math/MathML"&&vx.test(x))&&(s="http://www.w3.org/1999/xhtml"),pv(l,Vd(g)?g:[g],t,r,o,s,n,i,n?n[0]:r.__k&&zr(r,0),a,c),n&&n.some(pu)),a&&x!="textarea"||(d="value",x=="progress"&&_==null?e.removeAttribute(d):_==null||_===e[d]&&(x!="progress"||_)||iu(e,d,_,z[d],s),d="checked",w!=null&&w!=e[d]&&iu(e,d,w,z[d],s))}else z===q||a&&e.data==q||(e.data=q);return e}function Jd(e,t,r,o){try{typeof e=="function"?t?t.__x=e(t)||1:o&&(o=o.__c||o.__e)&&(t=o.__x)&&(o.__x=null,typeof t=="function"?t():e(null)):e.current=t}catch(s){le.__e(s,r)}}function Wd(e,t,r){var o,s;if(le.unmount&&le.unmount(e),!(o=e.ref)||o.current&&o.current!=e.__e||Jd(o,null,t,e),o=e.__c){if(o.componentWillUnmount)try{o.componentWillUnmount()}catch(n){le.__e(n,t)}o.__P=o.__n=null}if(o=e.__k)for(s=0;s<o.length;s++)o[s]&&Wd(o[s],t,typeof e.type!="function"||r&&!e.props.__P);(o=e.__e)&&(r||pu(o),o.__e&&(o.__e=null)),e.__e=e.__c=e.__=null}function xx(e,t,r){return this.constructor(e,r)}function So(e,t){var r,o,s,n;le.__&&le.__(e,t),t.nodeType==9&&(t=t.documentElement),o=(r=e&&32&e.__u)?null:t.__k,t.__k=cu(Qt,{children:[e]}),s=[],n=[],Bd(t,t.__k,o||du,du,t.namespaceURI,o?null:t.firstChild?dv.call(t.childNodes):null,s,o?o.__e:t.firstChild,r,n),_v(s,t.__k,n),t.__k.props.children=null}le={__e:function(e,t,r,o){for(var s,n,i;t=t.__;)if((s=t.__c)&&!(1&s.__g)){s.__g|=4;try{if((n=s.constructor)&&n.getDerivedStateFromError&&(s.setState(n.getDerivedStateFromError(e)),i=8&s.__g),s.componentDidCatch&&(s.componentDidCatch(e,o||{}),i=8&s.__g),i)return void(s.__g|=2)}catch(a){e=a,i=0}}throw lu=0,e}},cv=0,uu.prototype.setState=function(e,t){var r=this.__s;r&&r!=this.state||(r=this.__s=go({},this.state)),typeof e=="function"&&(e=e(go({},r),this.props)),e&&(go(r,e),this.__v&&(t&&this.__k.push(t),BS(this)))},uu.prototype.forceUpdate=function(e){this.__v&&(this.__g|=4,e&&this.__h.push(e),BS(this))},uu.prototype.render=Qt,wr=[],lu=0,uv=function(e,t){return e.__v.__b-t.__v.__b},au=Symbol(),lv=/(PointerCapture)$|Capture$/i,Fd=0,Ud={};var kx=0;function S(e,t,r,o,s,n){t||(t={});var i,a,c=t;if("ref"in c&&typeof e!="function")for(a in c={},t)a=="ref"?i=t[a]:c[a]=t[a];var l={type:e,props:c,key:r,ref:i,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--kx,__i:-1,__u:0};return le.vnode&&le.vnode(l),l}var Px=function(){let t=Array.prototype.slice.call(arguments).filter(Boolean),r={},o=[];t.forEach((n)=>{(n?n.split(" "):[]).forEach((a)=>{if(a.startsWith("atm_")){let[,c]=a.split("_");r[c]=a}else o.push(a)})});let s=[];for(let n in r)if(Object.prototype.hasOwnProperty.call(r,n))s.push(r[n]);return s.push(...o),s.join(" ")},pe=Px,Tx="atm_adsuimk_stnw88 atm_adsuif3_idpfg4 atm_adsuivy_1osqo2v atm_adsuie2_1osqo2v",Ex="atm_adsui9s_1ulexfb atm_adsuimj_glywfm atm_adsuiy1254f_icygq7 atm_adsui1s0cpq2_1y4oovw atm_adsui11bgp38_ltqb7t atm_adsuiylp9lw_1627y59 atm_adsuig6en28_1ohcsmr";function $x({box:e,preserveAspectRatio:t="xMidYMid meet",axes:r=!0,overlay:o=!1}){if(![e.x,e.y,e.width,e.height].every(Number.isFinite)||e.width<=0||e.height<=0)return null;let s=Math.max(1,Math.ceil(Math.max(e.width,e.height)/48)),n=(i)=>[...new Set([...Array.from({length:Math.floor(i/s)+1},(a,c)=>c*s),...r?[i/2]:[],i])].sort((a,c)=>a-c);return S("svg",{className:pe("ds-artwork-grid",Ex,o&&Tx),viewBox:`${e.x} ${e.y} ${e.width} ${e.height}`,"data-step":s,preserveAspectRatio:t,"aria-hidden":"true",focusable:"false",children:[n(e.width).map((i)=>S("line",{className:r&&i*2===e.width?"mid":void 0,x1:e.x+i,x2:e.x+i,y1:e.y,y2:e.y+e.height},`x${i}`)),n(e.height).map((i)=>S("line",{className:r&&i*2===e.height?"mid":void 0,x1:e.x,x2:e.x+e.width,y1:e.y+i,y2:e.y+i},`y${i}`))]})}var Cx="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2016%2016'%20fill='%23b4b4b4'%3e%3ctitle%3eADS%20—%20Eye%20in%20the%20grid,%20greyscale%20small%20size%3c/title%3e%3cpath%20d='M1%201h4v4H1zM6%201h4v4H6zM11%201h4v4H11zM1%206h4v4H1zM11%206h4v4H11zM1%2011h4v4H1zM6%2011h4v4H6zM11%2011h4v4H11z'/%3e%3cpath%20d='M6%206h4v4H6z'%20fill='%23444444'/%3e%3cpath%20d='M7%207h2v2H7z'%20fill='%23fafafa'/%3e%3c/svg%3e",Ix="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2016%2016'%20fill='%235c5c5c'%3e%3ctitle%3eADS%20—%20Eye%20in%20the%20grid,%20greyscale%20small%20size%3c/title%3e%3cpath%20d='M1%201h4v4H1zM6%201h4v4H6zM11%201h4v4H11zM1%206h4v4H1zM11%206h4v4H11zM1%2011h4v4H1zM6%2011h4v4H6zM11%2011h4v4H11z'/%3e%3cpath%20d='M6%206h4v4H6z'%20fill='%23dddddd'/%3e%3cpath%20d='M7%207h2v2H7z'%20fill='%231b1b1b'/%3e%3c/svg%3e",qx="atm_adsui9s_116y0ak atm_adsuibb_idpfg4 atm_adsuivy_1aou828 atm_adsuie2_1aou828 atm_adsui1w_kb7nvz",WS="atm_adsuivy_1osqo2v atm_adsuie2_1osqo2v",Ox="atm_adsui9s_o8hunj",Nx="atm_adsui9s_1a9ryah";function jx({label:e}){return S("span",{className:pe("ds-brand-mark",qx),role:e?"img":void 0,"aria-label":e,"aria-hidden":e?void 0:!0,children:[S("img",{className:pe(WS,Ox),loading:"eager",src:Cx,width:16,height:16,alt:""}),S("img",{className:pe(WS,Nx),loading:"eager",src:Ix,width:16,height:16,alt:""})]})}var Mx="atm_adsui9s_116y0ak atm_adsuih_1h6ojuz atm_adsuifc_1h6ojuz atm_adsuicx_tx1for atm_adsuij6_1wdkmbo atm_adsuilh_dcxj7s atm_adsuilb_tx1for atm_adsui3f_e8f45q atm_adsui5j_idpfg4 atm_adsui26_1j28jx2 atm_adsui7l_1wskm3t atm_adsuibx_rhlbdi atm_adsuics_el7ql6 atm_adsuic8_1m800s6 atm_adsuig3_3szr2b atm_adsuird_glywfm atm_adsui9j_tlke0l atm_adsuibb_idpfg4 atm_adsuiv6g6dd_pt45zb atm_adsuit4h5aw_1wskm3t atm_adsui15xrhy7_pt45zb atm_adsui17yrrpa_16x0t2t atm_adsui6zeuib_15wi45 atm_adsui1jhk75u_1mfz0iu atm_adsui174zlj6_73adwj atm_adsui1tcisp7_glywfm",Ax="atm_adsui4b_1627y59 atm_adsui26_1u3842e atm_adsui7l_1r1dq30 atm_adsuics_1d1fc98 atm_adsuiv6g6dd_1wskm3t atm_adsui168r6ku_8o97w",Lx="atm_adsuivy_alpu0l atm_adsuie2_alpu0l atm_adsuij6_alpu0l atm_adsuilh_idpfg4 atm_adsuilb_idpfg4";function $e({id:e,label:t,iconOnly:r,children:o,disabled:s,hidden:n,pressed:i,current:a,expanded:c,controls:l,popoverTarget:d,section:f,phase:h,variant:g="quiet",onClick:b}){return S("button",{id:e,type:"button",className:pe("ds-toolbar-button",Mx,g==="outlined"&&Ax,r&&Lx),"aria-label":r?t:void 0,title:r?t:void 0,disabled:s,hidden:n,"aria-pressed":i,"aria-current":a?"page":void 0,"aria-expanded":c,"aria-controls":l,popovertarget:d,"data-section":f,"data-phase":h,onClick:b,children:[o,!r&&t]})}var Ux="atm_adsui9s_1txwivl atm_adsuiar_1bp4okc atm_adsuih_1h6ojuz atm_adsuifc_1h6ojuz atm_adsuicx_tx1for atm_adsuijb_idpfg4 atm_adsuil8_1lr73f0 atm_adsui3f_e8f45q atm_adsui5j_idpfg4 atm_adsui26_1j28jx2 atm_adsui7l_1mqbmot atm_adsuibx_rhlbdi atm_adsuic8_1m800s6 atm_adsuig3_3szr2b atm_adsuir3_1h6ojuz atm_adsui9j_tlke0l atm_adsuiv6g6dd_pt45zb atm_adsui1qpv5ur_1r1dq30 atm_adsui1p5227w_pt45zb atm_adsui17yrrpa_16x0t2t atm_adsui6zeuib_15wi45 atm_adsui1jhk75u_1mfz0iu atm_adsui174zlj6_73adwj";function Dx({id:e,label:t,pressed:r=!1,disabled:o,children:s,onClick:n}){return S("button",{id:e,type:"button",className:pe("ds-toggle-tile",Ux),"aria-pressed":r,disabled:o,onClick:n,children:[s,S("span",{children:t})]})}var gv={brand:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="M8 1.5 9.9 5.6l4.4.5-3.3 3 .9 4.4L8 11.3l-3.9 2.2.9-4.4-3.3-3 4.4-.5L8 1.5Z"/></svg>',"chevron-left":'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="M10 4l-4 4 4 4"/></svg>',"chevron-right":'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="m6 4 4 4-4 4"/></svg>',"chevron-up":'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="m4 10 4-4 4 4"/></svg>',close:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="m4 4 8 8M12 4l-8 8"/></svg>',components:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="m8 1 6 3.5v7L8 15l-6-3.5v-7L8 1Zm-6 3.5 6 3.5 6-3.5M8 8v7"/></svg>',composition:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="M2 2h4v4H2zM10 2h4v4h-4zM2 10h4v4H2zM10 10h4v4h-4z"/></svg>',drafts:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="M3 1h7l3 3v11H3zM10 1v4h3M5 8h6M5 11h4"/></svg>',"guide-bounds":'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><rect x="2" y="3.5" width="12" height="9"/></svg>',"guide-gaps":'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><rect x="1.5" y="3" width="3.5" height="10"/><rect x="6.25" y="3" width="3.5" height="10"/><rect x="11" y="3" width="3.5" height="10"/></svg>',"guide-margins":'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><rect x="1.5" y="2.5" width="13" height="11" stroke-dasharray="1.5 1.5"/><rect x="4.5" y="5.5" width="7" height="5"/></svg>',"guide-mini":'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="M2 2v12M6 2v12M10 2v12M14 2v12M2 2h12M2 6h12M2 10h12M2 14h12" stroke-width="1"/></svg>',"guide-padding":'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><rect x="1.5" y="2.5" width="13" height="11"/><rect x="4.5" y="5.5" width="7" height="5" stroke-dasharray="1.5 1.5"/></svg>',"guide-tracks":'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="M2.5 2v12M6 2v12M10 2v12M13.5 2v12"/></svg>',icons:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><circle cx="5" cy="5" r="2.5"/><rect x="9.5" y="2.5" width="4" height="5" rx="1"/><path d="m2.5 13.5 2.5-4 2.5 4ZM9.5 11.5h4M11.5 9.5v4"/></svg>',layout:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="M3 2v12M6.5 2v12M9.5 2v12M13 2v12"/></svg>',moon:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="M13.5 9a5.5 5.5 0 0 1-6.5-6.5A5.5 5.5 0 1 0 13.5 9Z"/></svg>',patterns:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><rect x="2" y="2" width="5" height="5"/><rect x="10" y="2" width="4" height="5"/><rect x="2" y="10" width="5" height="4"/><rect x="10" y="10" width="4" height="4"/></svg>',phone:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><rect x="4" y="1" width="8" height="14" rx="1.5"/><path d="M7 12.5h2"/></svg>',pictograms:'<svg fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><rect x="1.5" y="2.5" width="13" height="11" rx="1"/><circle cx="5" cy="6" r="1"/><path d="m2 12 4-3 3 2 3-4 2 2"/></svg>',source:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="m5 4-4 4 4 4m6-8 4 4-4 4M9 2 7 14"/></svg>',split:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><rect x="1" y="2" width="14" height="12" rx="1"/><path d="M8 2v12"/></svg>',sun:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><circle cx="8" cy="8" r="3"/><path d="M8 1v1M8 14v1M1 8h1M14 8h1M3 3l1 1M12 12l1 1M3 13l1-1M12 4l1-1"/></svg>',tokens:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="m8 2 6 3-6 3-6-3 6-3Zm-6 6 6 3 6-3M2 11l6 3 6-3"/></svg>',warning:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="m8 2 7 12H1L8 2Z"/><path d="M8 6v3M8 11v.5"/></svg>'},KS={};Object.keys(gv).sort();var Zx="atm_adsui9s_116y0ak atm_adsuiam_glywfm atm_adsuih_1h6ojuz atm_adsuifc_1h6ojuz atm_adsuivh_nkobfv atm_adsui7l_1kw7nm4 atm_adsuix4ub3y_1ulexfb atm_adsuivskwj7_1osqo2v atm_adsui158k9f9_1osqo2v",Hx={sm:"atm_adsuivy_1aou828 atm_adsuie2_1aou828",md:"atm_adsuivy_fjcok3 atm_adsuie2_fjcok3",lg:"atm_adsuivy_14k5dlv atm_adsuie2_14k5dlv",xl:"atm_adsuivy_1j39cg3 atm_adsuie2_1j39cg3"};function Oe({name:e,size:t="sm",label:r}){let o=e in KS?KS[e]:e;return S("span",{className:pe("ds-icon",Zx,Hx[t]),...r?{role:"img","aria-label":r}:{"aria-hidden":!0},dangerouslySetInnerHTML:{__html:gv[o]}})}var Fx="atm_adsui9s_1txwivl atm_adsuih_1h6ojuz atm_adsuicx_tx1for atm_adsuij6_1wdkmbo atm_adsuil8_kr1xch atm_adsui3f_e8f45q atm_adsui5j_idpfg4 atm_adsui26_1j28jx2 atm_adsui7l_1wskm3t atm_adsuibx_rhlbdi atm_adsuics_el7ql6 atm_adsuic8_1m800s6 atm_adsuig3_sqnntc atm_adsuird_glywfm atm_adsuikz_fg65tv atm_adsui1e7xapd_1wugsn5 atm_adsui1cc01an_1m800s6 atm_adsuiz89mj4_el7ql6 atm_adsui19izows_1mqbmot atm_adsui1a1iq7z_1q9ccgz atm_adsui18vqbco_pt45zb atm_adsuisrk7fl_pt45zb atm_adsui1dpiaj6_1wskm3t atm_adsuizrwyxp_1d1fc98 atm_adsui17yrrpa_16x0t2t atm_adsui6zeuib_15wi45";function Vx({label:e,href:t,current:r,previewState:o,previewLabel:s,draftLabel:n,draftDescription:i,onClick:a}){return S("a",{className:pe("ds-navigation-item",Fx),href:t,"aria-current":r?"page":void 0,"aria-description":s,onClick:a,children:[e,n&&S("span",{className:"draft-badge",title:i,children:[" ",n]}),o&&S(vv,{state:o})]})}var Bx="atm_adsuimk_1n9t6rb atm_adsuif3_aqos4q atm_adsui73_usvi9m atm_adsuigi_idpfg4 atm_adsuiiy_102o88r atm_adsuiks_1wugsn5 atm_adsuil8_1aqtv8w atm_adsui3f_m9afv7 atm_adsui5j_idpfg4 atm_adsui26_1bplolx atm_adsui7l_1wskm3t atm_adsui70_1fjsgd1 atm_adsuibx_rhlbdi atm_adsuic8_1m800s6 atm_adsuig3_sqnntc atm_adsuiarf92d_1txwivl atm_adsui1qpaa0x_1bp4okc",Jx="atm_adsuil8_idpfg4",Wx={narrow:"atm_adsuivy_hvzi4f",wide:"atm_adsuivy_1risgsc atm_adsuij3_1y8qh3w"},Kx="atm_adsuimk_pfqszd atm_adsuiiy_glywfm atm_adsuij3_1osqo2v";function Sv({id:e,label:t,role:r,width:o="narrow",inline:s=!1,flush:n=!1,children:i}){return S("div",{id:e,className:pe("ds-popover",Bx,Wx[o],n&&Jx,s&&Kx),popover:s?void 0:"auto",role:r,"aria-label":t,children:i})}var Gx="atm_adsui9s_116y0ak atm_adsuiam_glywfm atm_adsuih_1h6ojuz atm_adsuifc_1h6ojuz atm_adsuivy_1aou828 atm_adsuie2_1aou828 atm_adsui7l_1mqbmot atm_adsuivskwj7_1osqo2v atm_adsui158k9f9_1osqo2v atm_adsuio2zchm_glywfm atm_adsuibupyu4_1r31cwp atm_adsui91z0ma_c484nn atm_adsuieyuh4p_glywfm atm_adsuis7vg1k_1ulexfb atm_adsui1a7gqnz_glywfm atm_adsui1ypv4g8_glywfm atm_adsuisc4h6w_116y0ak";function vv({state:e="unreported",variant:t="navigation",label:r}){return S("span",{className:pe("ds-preview-indicator",t==="navigation"&&"entry-preview",Gx),"data-state":e,"data-variant":t,role:r?"img":void 0,"aria-label":r,"aria-hidden":r?void 0:!0,title:r,children:[S("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[S("circle",{"data-mark":"unreported",cx:"8",cy:"8",r:"3"}),S("circle",{"data-mark":"building",cx:"8",cy:"8",r:"5","stroke-dasharray":"22 10"}),S("circle",{"data-mark":"checking",cx:"8",cy:"8",r:"5","stroke-dasharray":"3 3"}),S("circle",{"data-mark":"ready",cx:"8",cy:"8",r:"5"}),S("circle",{"data-mark":"stale",cx:"8",cy:"8",r:"5","stroke-dasharray":"2 3"}),S("circle",{"data-mark":"error",cx:"8",cy:"8",r:"5",fill:"currentColor",stroke:"none"})]}),t==="toolbar"&&S("span",{className:"preview-warning",children:S(Oe,{name:"warning"})})]})}var Yx="atm_adsuig1e7fr_1hh10yn atm_adsuina064p_1c8rstr atm_adsuibyi8sh_1d1fc98 atm_adsuit8tn60_1r1dq30 atm_adsui18xy9f7_1txwivl atm_adsui1kvotse_1xi6ry0 atm_adsui13bcc9y_q4j4l1 atm_adsui9ht5kt_1iwn3l9 atm_adsuiw49f19_1m800s6 atm_adsui1mb7f0m_1mqbmot atm_adsui1o7g9kp_sqnntc atm_adsuicsppdr_11p5wf0 atm_adsui156xhju_13mtsfm atm_adsui2uzat_iqvn5y atm_adsuizf04m1_1mfz0iu atm_adsuil2ckyf_1txwivl atm_adsuim3rxq9_1h6ojuz atm_adsuilfeyld_iqvn5y atm_adsuidl3q2m_ynj908 atm_adsui12er3fd_tx1for atm_adsui8e79fz_m9afv7 atm_adsui1qnfl3r_1m800s6 atm_adsui1sj4mjq_1mqbmot atm_adsui6ql2ro_iqvn5y",Md=[{name:"off",label:"Off",hint:"Guides are hidden. Your layer choice is kept."},{name:"hover",label:"Hover",hint:"Point at or focus an element to see the selected layers."},{name:"always",label:"Always",hint:"Every element shows the selected layers."}],bv=[{name:"bounds",label:"Bounds"},{name:"tracks",label:"Columns and rows"},{name:"gaps",label:"Gaps and gutters"},{name:"padding",label:"Padding"},{name:"margins",label:"Margins"},{name:"mini",label:"Mini-unit grid"}],yv=[{name:"spacing",label:"Spacing",layers:["padding","margins","gaps"]},{name:"grid",label:"Grid",layers:["tracks","mini"]},{name:"all",label:"All",layers:["bounds","tracks","gaps","padding","margins","mini"]}];function wv(e){var t;let r=((t=yv.find((o)=>o.name===e))==null?void 0:t.layers)??[];return Object.fromEntries(bv.map((o)=>[o.name,r.includes(o.name)]))}function Xx({id:e="grid-options",inline:t=!1,mode:r="off",layers:o={},onModeChange:s,onLayerChange:n,onPreset:i}){var a;let c=(a=Md.find((l)=>l.name===r))==null?void 0:a.hint;return S(Sv,{id:e,label:"Layout guides",role:"dialog",inline:t,children:S("div",{id:`${e}-content`,className:pe("ux-guide-options",Yx),"data-mode":r,children:[S("h2",{children:"Layout guides"}),S("div",{className:"ux-guide-modes",role:"group","aria-label":"Show guides",children:Md.map((l)=>S($e,{id:`${e}-mode-${l.name}`,label:l.label,pressed:r===l.name,onClick:()=>s==null?void 0:s(l.name)},l.name))}),S("p",{id:`${e}-hint`,className:"ux-guide-hint","aria-live":"polite",...Object.fromEntries(Md.map((l)=>[`data-${l.name}`,l.hint])),children:c}),S("div",{className:"ux-guide-layers",role:"group","aria-label":"Layers",children:bv.map((l)=>S(Dx,{id:`${e}-layer-${l.name}`,label:l.label,pressed:o[l.name]===!0,onClick:()=>n==null?void 0:n(l.name,o[l.name]!==!0),children:S(Oe,{name:`guide-${l.name}`,size:"lg"})},l.name))}),S("div",{className:"ux-guide-presets",role:"group","aria-label":"Presets",children:[S("span",{children:"Presets"}),yv.map((l)=>S($e,{id:`${e}-preset-${l.name}`,label:l.label,onClick:()=>i==null?void 0:i(l.name)},l.name))]})]})})}var ga,Pe,Ad,GS,Dd=Object.is,hu=0,zv=[],Zd=[],we=le,{__b:YS,__r:XS,diffed:QS,__c:ev,unmount:tv,__:rv}=we;function Kd(e,t){we.__h&&we.__h(Pe,e,hu||t),hu=0;var r=Pe.__H||(Pe.__H={__:[],__h:[]});return e>=r.__.length&&r.__.push({}),r.__[e]}function Qx(e){return hu=1,ek(xv,e)}function ek(e,t,r){var o=Kd(ga++,2);if(o.t=e,!o.__c&&(o.__=[xv(void 0,t),function(n){var i=o.__N?o.__N[0]:o.__[0],a=o.t(i,n);Dd(i,a)||(o.__N=[a,o.__[1]],o.__c.setState({}))}],o.__c=Pe,!Pe.__f)){Pe.__f=!0;var s=Pe.shouldComponentUpdate;Pe.shouldComponentUpdate=function(n,i,a){var c=this.__H;if(!c)return!0;var l=!1,d=this.props!=n;if(c.__.some(function(h){h.__N&&(l=!0,Dd(h.__[0],h.__N[0])||(d=!0))}),s){var f=s.call(this,n,i,a);return l?f||d:f}return!l||d}}return o.__}function tk(e,t){var r=Kd(ga++,4);!we.__s&&Rv(r.__H,t)&&(r.__P=!1,r.__=e,r.u=t,Pe.__h.push(r))}function rk(e){return hu=5,ok(function(){return{current:e}},[])}function ok(e,t){var r=Kd(ga++,7);return Rv(r.__H,t)&&(r.__=e(),r.__H=t),r.__}function sk(){var e;do{for(;e=Zd.shift();)try{_a(e)}catch(r){we.__e(r,{__:(e=e.__P)&&e.__v})}for(;e=zv.shift();){var t=e.__H;if(e.__P&&t)try{t.__h.some(_a),t.__h.some(Hd),t.__h=[]}catch(r){t.__h=[],we.__e(r,e.__v)}}}while(Zd.length)}we.__b=function(e){Pe=null,YS&&YS(e)},we.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),rv&&rv(e,t)},we.__r=function(e){XS&&XS(e),ga=0;var t=(Pe=e.__c).__H;t&&(Ad==Pe?Pe.__h=[]:(t.__h.some(_a),t.__h.some(Hd),ga=0),t.__h=[],t.__.some(function(r){r.__N&&(r.__=r.__N),r.u=r.__N=void 0})),Ad=Pe},we.diffed=function(e){QS&&QS(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&sv(zv.push(t)),t.__H.__.some(function(r){r.u&&(r.__H=r.u)})),Ad=Pe=null},we.__c=function(e,t){t.some(function(r){try{r.__h.some(_a),r.__h=r.__h.filter(function(o){return!o.__||Hd(o)})}catch(o){t.some(function(s){s.__h&&(s.__h=[])}),t=[],we.__e(o,r.__v)}}),ev&&ev(e,t)},we.unmount=function(e){tv&&tv(e);var t,r,o=e.__c;o&&o.__H&&(o.__H.__.some(function(s){try{if(s.__P&&s.__c){if(r===void 0){for(r=e.__;r&&(!r.__c||!r.__c.__P);)r=r.__;r=r&&r.__c}s.__P=r,sv(Zd.push(s))}else _a(s)}catch(n){t=n}}),o.__H=void 0,t&&we.__e(t,o.__v))};var ov=typeof requestAnimationFrame=="function";function nk(e){var t,r=function(){clearTimeout(o),ov&&cancelAnimationFrame(t),setTimeout(e)},o=setTimeout(r,35);ov&&(t=requestAnimationFrame(r))}function sv(e){e!=1&&GS==we.requestAnimationFrame||((GS=we.requestAnimationFrame)||nk)(sk)}function _a(e){var t=Pe,r=e.__c;typeof r=="function"&&(e.__c=void 0,r()),Pe=t}function Hd(e){var t=Pe;e.__c=e.__(),Pe=t}function Rv(e,t){return!e||e.length!=t.length||t.some(function(r,o){return!Dd(r,e[o])})}function xv(e,t){return typeof t=="function"?t(e):t}var nv="atm_adsuie2_1osqo2v atm_adsuiks_1wugsn5 atm_adsuil8_1ru0ig4 atm_adsuibx_rhlbdi atm_adsuic8_1c8rstr atm_adsuig3_sqnntc atm_adsui7l_an4usv atm_adsui1s9zg6e_idpfg4 atm_adsui1y1itgh_1heflvk atm_adsui124toe7_1d1fc98 atm_adsui1ajpmqv_3szr2b atm_adsuig1e7fr_81zv9y atm_adsuina064p_1ye8rbs atm_adsuibyi8sh_1d1fc98 atm_adsui1t8i83k_1ulexfb atm_adsui1t4u5ad_iqvn5y atm_adsui1ucxlaq_1m800s6 atm_adsuicqysi0_el7ql6 atm_adsuiugp1nr_1mqbmot atm_adsuimzw80z_1txwivl atm_adsuims933x_v2br90 atm_adsuikqzblj_1yb4nlp atm_adsui157qtsd_1doep66 atm_adsuipps9nr_1g80g66 atm_adsui1696orj_6e9m65 atm_adsui1kwsnex_1mqbmot atm_adsui1749l82_1m800s6 atm_adsui1pm6vxp_fg65tv atm_adsui1985805_rhlbdi atm_adsuifgvpx0_1m800s6 atm_adsui1f7jbwv_1wdkmbo atm_adsui4v11ke_13r6pey atm_adsui1ph4l26_kr1xch atm_adsui1td1et_58tz3v atm_adsui16q9e9r_idpfg4 atm_adsui1e1cn77_1u3842e atm_adsui1ok557x_an4usv atm_adsui8oqreq_16x0t2t atm_adsuidogt2j_15wi45 atm_adsui1ha57is_1txwivl atm_adsui154gtli_1g80g66 atm_adsui1m0o9p4_1doep66 atm_adsuitul8sy_116y0ak atm_adsuid9rgyl_1h6ojuz atm_adsui1ew4plt_1h6ojuz atm_adsui44kz9m_tx1for atm_adsui1l2cw9c_116y0ak atm_adsui1p2daoe_glywfm atm_adsui1lrgcs0_1kw7nm4 atm_adsui21ajbm_1ulexfb atm_adsuiv4i7ad_glywfm atm_adsui18exmc6_11p5wf0 atm_adsuinrahr7_14kz4g7 atm_adsui1sapuqh_1ak2vn7 atm_adsuia9snxg_v2br90 atm_adsuic1efku_idpfg4 atm_adsui1s5glk1_1h6ojuz atm_adsui4zbjz7_1txwivl atm_adsui1nrl83w_1h6ojuz atm_adsuidcq6po_1h6ojuz atm_adsuiodevil_1g80g66 atm_adsui15luuzb_tx1for atm_adsuiy20kxr_idpfg4 atm_adsui1pfuy6w_l6f2xw atm_adsuifo0n28_1m800s6 atm_adsui1yka5lj_sqnntc atm_adsuiazx38y_19dj2kj atm_adsuildippw_fg65tv atm_adsui2kz6ah_177qeyn atm_adsui5go7c5_1m800s6 atm_adsui12ii74i_1q4684i atm_adsui1t756hg_1mqbmot atm_adsui1n1nucf_h2mmj6 atm_adsuis5orb_qpi3z3 atm_adsui1maakrc_qpi3z3 atm_adsui3jvufv_6g0xcp atm_adsui1a6bvuq_6lcubb atm_adsui7le0qg_stnw88 atm_adsuikc8k8m_idpfg4 atm_adsui10ojrnp_1le1gz4 atm_adsuimhax7p_moqrwa atm_adsui1eq72d_1txwivl atm_adsuitglio1_1g80g66 atm_adsui1uq2nym_1h6ojuz atm_adsui1g6vde0_esu3gu atm_adsui1lgf0nm_1aqtv8w atm_adsui1e184xh_1txwivl atm_adsuila89rv_1bp4okc atm_adsui3c75k5_1h6ojuz atm_adsuihmh6q_tx1for atm_adsui1gfpqoj_1m800s6 atm_adsui1lezx94_1mqbmot atm_adsui1fnmsk6_b6kj4x atm_adsuip4zrj7_1le1gz4 atm_adsui1lf327s_1m800s6 atm_adsui10hei5o_glywfm atm_adsui11ndfci_12j2sah atm_adsuiewnzgi_1r3tyjr atm_adsuincp59s_19dj2kj atm_adsui5aykc5_ynj908 atm_adsui1z5d1z_1vz6rot atm_adsui1w4ry55_mrub5a atm_adsuinfdfyh_fg65tv atm_adsui1d1ue3r_1mqbmot atm_adsui1m3cqh4_1txwivl atm_adsuijhqbse_1g80g66 atm_adsui1y90xlu_1doep66 atm_adsui1konks8_idpfg4 atm_adsuirgczd9_1txwivl atm_adsui1tv24b1_1h6ojuz atm_adsui1adwpcp_ynj908 atm_adsui61s2ls_1m800s6 atm_adsui7olkud_116y0ak atm_adsuiu2kdnu_tx1for atm_adsuiv7vy6e_qm87f6 atm_adsuin0y7c7_1ivmhas atm_adsui1mpi4sj_1ulexfb atm_adsuit6wwae_1f51e7f",iv="http://www.w3.org/2000/svg";function Ld({item:e,size:t,label:r}){let o=rk(null);return tk(()=>{var s;let n=new DOMParser().parseFromString(e.svg,"image/svg+xml").documentElement;if(n.namespaceURI!==iv||n.localName!=="svg")return;for(let a of n.querySelectorAll("*"))if(["script","foreignObject","iframe","image","a","animate","set","animateTransform","animateMotion"].includes(a.localName)||a.namespaceURI!==iv)a.remove();for(let a of[n,...n.querySelectorAll("*")])for(let c of Array.from(a.attributes))if(/^on/i.test(c.name)||/href$/i.test(c.name)&&!c.value.trim().startsWith("#"))a.removeAttribute(c.name);let i=document.importNode(n,!0);return i.removeAttribute("class"),i.setAttribute("width",String(t)),i.setAttribute("height",String(t)),i.setAttribute("aria-hidden","true"),i.setAttribute("focusable","false"),(s=o.current)==null||s.replaceChildren(i),()=>{var a;return(a=o.current)==null?void 0:a.replaceChildren()}},[e.svg,t]),S("span",{className:"icons-glyph",ref:o,role:r?"img":void 0,"aria-label":r,title:r,"aria-hidden":r?void 0:"true"})}function av({finding:e}){return S("p",{className:"icons-finding",title:e.file,children:[S("strong",{children:e.rule})," ",e.message]})}function ik({data:e}){var t;let[r,o]=Qx("");if(!e.configured)return S("section",{className:pe("icons-view",nv),"aria-label":"Icons",children:[S("h1",{children:"Icons"}),S("p",{className:"icons-summary",children:"The project configures no glyph set."})]});let s=e.glyphs.filter((n)=>[n.name,...n.aliases].some((i)=>i.toLowerCase().includes(r.trim().toLowerCase())));return S("section",{className:pe("icons-view",nv),"aria-label":"Icons",children:[S("div",{className:"icons-head",children:[S("div",{children:[S("h1",{children:"Icons"}),S("p",{className:"icons-summary",children:[e.source," · ",e.glyphs.length," glyphs",e.grid?` · ${e.grid.width} × ${e.grid.height} grid`:e.mixed?" · Mixed grids":""," · ",e.aliasCount," aliases"]})]}),S("input",{type:"search",value:r,onInput:(n)=>o(n.currentTarget.value),placeholder:"Search name or alias","aria-label":"Search glyphs by name or alias"})]}),e.findings.map((n,i)=>S(av,{finding:n},i)),S("h2",{children:["The set",S("small",{children:["Every glyph at ",((t=e.textSize)==null?void 0:t.px)??16,"px, the size used beside text"]})]}),S("div",{className:"icons-set",role:"list","aria-label":"The set",children:s.map((n)=>{var i;return S("span",{className:"icons-set-item","data-glyph":n.name,role:"listitem",children:S(Ld,{item:n,size:((i=e.textSize)==null?void 0:i.px)??16,label:n.name})},n.name)})}),S("h2",{children:["Glyphs",S("small",{children:"Enlarged construction grid and actual icon sizes"})]}),!s.length&&S("p",{className:"icons-empty",children:e.glyphs.length?`No glyph matches “${r.trim()}”.`:"No glyphs in this set."}),S("div",{className:"icons-cards",children:s.map((n)=>S("article",{className:"icons-card","data-glyph":n.name,"data-findings":n.findings.length||void 0,"aria-label":n.name,children:[S("div",{className:"icons-card-head",children:[S("h3",{children:n.name}),n.findings.length>0&&S("span",{className:"icons-badge",children:[n.findings.length," ",n.findings.every((i)=>i.severity==="error")?"error":"issue",n.findings.length===1?"":"s"]})]}),S("p",{className:"icons-alias",children:n.aliases.length?`alias: ${n.aliases.join(", ")}`:""}),S("div",{className:"icons-mag",children:[n.grid&&S($x,{box:n.grid,overlay:!0}),S(Ld,{item:n,size:96})]}),S("div",{className:"icons-sizes",children:e.sizes.map((i)=>S("span",{className:"icons-size",children:[S(Ld,{item:n,size:i.px}),S("small",{title:i.token,children:i.px})]},i.token))}),n.findings.map((i,a)=>S(av,{finding:i},a))]},n.name))}),e.logos&&S(Qt,{children:[S("h2",{children:["Other products’ logos",S("small",{children:e.logos.source})]}),S("div",{className:"icons-logos",children:e.logos.files.map((n)=>S("figure",{className:"icons-logo","data-logo":n.name,children:n.tooLarge?S("figcaption",{children:[n.name," (over 1 MB; not shown)"]}):S(Qt,{children:[S("span",{className:"icons-logo-tile",children:S("img",{src:n.src,alt:n.name,title:n.file,width:24,height:24,loading:"lazy",decoding:"async"})}),S("span",{className:"icons-logo-tile icons-logo-tile-black",children:S("img",{src:n.src,alt:"",width:24,height:24,loading:"lazy",decoding:"async"})}),S("figcaption",{children:n.name})]})},n.name))})]})]})}var ak="atm_adsui9s_1txwivl atm_adsuiar_1bp4okc atm_adsuicx_idpfg4 atm_adsuijb_idpfg4",ck="atm_adsuijb_idpfg4 atm_adsui1pqo7b0_1txwivl atm_adsuiywbgd0_1h6ojuz atm_adsui1a6nw8z_tx1for atm_adsui1vu1bue_kr1xch atm_adsuiyzr3rh_1wdkmbo atm_adsuila54r4_glywfm atm_adsui10x1lus_tlke0l atm_adsui107eb71_1m800s6 atm_adsuir3v91m_1d1fc98 atm_adsui3vd9bk_1wskm3t atm_adsui1pvchle_glywfm atm_adsui93k5wf_1aou828 atm_adsui1jhtvjp_1aou828 atm_adsuixwcn1n_glywfm atm_adsuiaxt0xi_1r31cwp atm_adsuiu9ecgn_c484nn atm_adsui1rd1yp5_glywfm atm_adsuir4atoz_14w8a5s atm_adsuikwnb5l_16x0t2t atm_adsui1b3ry6x_xrd58z atm_adsui9abqyk_1txwivl atm_adsui152ylkv_1bp4okc atm_adsui4nxdgq_idpfg4 atm_adsui1jf9b6q_1aqtv8w";function uk({id:e,label:t,children:r}){return S("nav",{id:e,className:pe("ux-navigation-menu",ak),"aria-label":t,children:r})}function lk({label:e,open:t=!0,children:r}){return S("details",{className:pe("entry-group",ck),open:t,children:[S("summary",{children:[S(Oe,{name:"chevron-right"}),S("span",{children:e})]}),S("div",{role:"group","aria-label":e,"data-slot":"entries",children:r})]})}var dk="atm_adsui9s_116y0ak atm_adsuih_1h6ojuz",mk="atm_adsui9s_1txwivl atm_adsuiar_1bp4okc atm_adsuij6_idpfg4 atm_adsuiam_kb7nvz atm_adsui1swzw65_glywfm atm_adsui1n6gq6x_idpfg4 atm_adsui1ew16gs_fg65tv atm_adsuilt2xkg_1txwivl atm_adsuicvgua_1bp4okc atm_adsuiibt2oz_idpfg4 atm_adsui13rscvo_kb7nvz atm_adsuifaj8v5_1txwivl atm_adsui1x9f3se_1h6ojuz atm_adsui7ff47s_1aqtv8w atm_adsui19ywhw4_5z7wz8 atm_adsuik8mrq7_m9afv7 atm_adsuitx6td0_glywfm atm_adsui24gkm1_kb7nvz atm_adsuibo9v2x_1mqbmot atm_adsuiof0hc7_1wugsn5",pk="atm_adsui9s_1txwivl atm_adsuiar_1bp4okc atm_adsuij6_idpfg4 atm_adsuiam_kb7nvz atm_adsui1n6gq6x_idpfg4 atm_adsui1ew16gs_fg65tv atm_adsui18hfcpa_5z7wz8 atm_adsui15kvw8j_1d1fc98 atm_adsuiput1jn_1r1dq30 atm_adsuiwst7e9_tx1for atm_adsuidds7x8_el7ql6 atm_adsuilhyqxr_1mqbmot atm_adsui10yw2xd_idpfg4 atm_adsui1womkjg_idpfg4 atm_adsui108aoln_glywfm atm_adsuirdnh25_1wugsn5 atm_adsuiiq3m8p_m9afv7 atm_adsui17tjeyp_5z7wz8 atm_adsui1s7p0pk_m9afv7 atm_adsuiq065rl_idpfg4 atm_adsui132u42p_1txwivl atm_adsuiy4slwo_1g80g66 atm_adsui41lbvx_1q9ycp6 atm_adsui1gu70gy_4baac9 atm_adsui3ffk06_iqvn5y atm_adsuiy5406h_l6f2xw atm_adsui1t4fsou_10of7rf atm_adsui1kdkncg_1mqbmot atm_adsuizdczfh_fg65tv atm_adsui1fkhvt8_1k2i9i8 atm_adsui1jjfms9_m9afv7 atm_adsuixcw6qj_l6f2xw atm_adsui1l7l6jv_10of7rf atm_adsui1n2a233_1wskm3t atm_adsui1gqwc3l_1r1dq30 atm_adsui1sox6pi_iqvn5y atm_adsuib4u3xt_1mqbmot atm_adsui14bm868_tlke0l atm_adsuiix7db5_1risgsc atm_adsui6nxdxv_16x0t2t atm_adsui1ouftwa_15wi45 atm_adsui1spa2l4_iqvn5y atm_adsui10ldf3v_ofj6oc atm_adsui167gjxu_1mqbmot";function hk(e){let[t="",...r]=e.split(`
120
- `),o=/^(.+?\.)\s+(.+)$/.exec(t),s=o?o[1]:t,n=[],i=[];for(let a of[...o?[o[2]]:[],...r].map((c)=>c.trim()).filter(Boolean)){let c=/^(\S+?:\d+(?::\d+)?|[\w./-]+\.\w+):\s+(?:([a-z][a-z0-9-]*):\s+)?(.+)$/.exec(a);if(!c){i.push(a);continue}let l=c[3],d=/^(.+?[.!?])\s+(.+)$/.exec(l);n.push({location:c[1],rule:c[2],summary:d?d[1]:l,detail:d==null?void 0:d[2]})}return{title:s,problems:n,notes:i}}function kv({message:e}){let{title:t,problems:r,notes:o}=hk(e);return S("div",{className:pe("ux-status-content",pk),children:[S("p",{className:"ux-status-title",children:[t,r.length>1&&S("span",{className:"ux-status-count",children:[r.length," problems"]})]}),r.length>0&&S("ul",{className:"ux-status-problems",children:r.map((s,n)=>S("li",{className:"ux-status-problem",children:[S("div",{className:"ux-status-where",children:[s.location&&S("span",{className:"ux-status-file",children:s.location}),s.rule&&S("span",{className:"ux-status-rule",children:s.rule})]}),S("p",{className:"ux-status-summary",children:s.summary}),s.detail&&S("details",{children:[S("summary",{children:"Why and how to fix"}),S("p",{children:s.detail})]})]},n))}),o.map((s,n)=>S("p",{className:"ux-status-note",children:s},n))]})}function fk({idPrefix:e="",phase:t="ready",message:r="Preview is up to date.",warmup:o,onRetry:s}){let n=(i)=>e+i;return S("div",{className:pe("ux-preview-status",dk),children:[S($e,{id:n("preview-status"),label:`Preview status: ${r.split(`
121
- `)[0]}`,phase:t,iconOnly:!0,popoverTarget:n("status-details"),children:S(vv,{variant:"toolbar",state:t==="reloading"?"building":t})}),S(Sv,{id:n("status-details"),width:"wide",flush:!0,children:S("div",{className:pe("ux-status-details",mk),children:[S("div",{id:n("status"),className:"ux-status-message",role:t==="error"?"alert":"status",children:S(kv,{message:r})}),S("div",{className:"ux-status-footer",children:[S("p",{id:n("warmup-status"),className:"ux-status-warmup",hidden:!o,children:o}),S("div",{id:n("preview-error"),className:"preview-retry",hidden:t!=="error",children:S($e,{id:n("retry-preview"),label:"Retry preview",variant:"outlined",onClick:s})})]})]})})]})}var _k="atm_adsuijb_idpfg4 atm_adsuij6_1osqo2v atm_adsuil8_1ru0ig4 atm_adsui7l_an4usv atm_adsuibx_rhlbdi atm_adsuic8_1c8rstr atm_adsuig3_sqnntc atm_adsui3z5xaq_d3l4uo atm_adsui1wgjgno_idpfg4 atm_adsuip5t3iw_glywfm atm_adsuixo4njo_uqc78k atm_adsui5o4a8h_rfutky atm_adsui1fodpaq_1g68hxi atm_adsuiw6dnwv_1j28jx2 atm_adsuigj0umz_1ru0ig4 atm_adsui12f0w6t_1txwivl atm_adsui1gdpbuc_1g80g66 atm_adsuiuqbam3_1h6ojuz atm_adsuio8ubsb_1aqtv8w atm_adsui5ug4ic_1wdkmbo atm_adsui1w6vi1x_13r6pey atm_adsuiz9prp4_kr1xch atm_adsuiwdfvbd_m9afv7 atm_adsui13fkfdg_idpfg4 atm_adsui1do7trk_1j28jx2 atm_adsui1rlis1a_an4usv atm_adsuizf9kzn_rhlbdi atm_adsuii5gv9h_1m800s6 atm_adsuindj6xq_16x0t2t atm_adsuitdd4i9_15wi45 atm_adsui11chkp6_irm9pb atm_adsui10tyobk_1heflvk atm_adsui1h392tq_3szr2b atm_adsuiatrpru_1d1fc98 atm_adsuiwv6oyq_1r1dq30 atm_adsui1wjk0g8_6e9m65 atm_adsui1bmpb92_cpeews atm_adsui1lgjzhx_1m800s6 atm_adsuijzdzyy_1mqbmot";function gk({title:e,description:t,onSearch:r,children:o}){return S("section",{className:pe("ux-specimen-page",_k),"aria-label":e,children:[S("header",{children:[S("div",{className:"ux-specimen-heading",children:[S("h1",{children:e}),r&&S("input",{type:"search","aria-label":"Find token",placeholder:"Find a token",onInput:(s)=>r(s.currentTarget.value)})]}),t&&S("p",{children:t})]}),S("div",{"data-slot":"content",children:o})]})}var Pv="atm_adsuij7_idpfg4 atm_adsui9s_11p5wf0 atm_adsuin5_idpfg4 atm_adsui84_idpfg4 atm_adsuidz_1y3gjcq atm_adsuigw_1gem2g7 atm_adsuiiz_glywfm atm_adsuimrwrxb_1210cad atm_adsui165a258_idpfg4 atm_adsuindcbtc_idpfg4 atm_adsui1ywdvs7_idpfg4 atm_adsui7bg9zp_107lskt atm_adsuiqjzyof_idpfg4 atm_adsui15n9hsn_idpfg4 atm_adsuigpq1w8_idpfg4 atm_adsui1ts7i44_1gr7bv3 atm_adsui1xz6qul_1gem2g7 atm_adsui1pqqic1_glywfm atm_adsuilz7qdd_6s8zn8 atm_adsui134y5xe_1ncjpb7 atm_adsui1nznzd5_1gr7bv3 atm_adsuiom2ku1_1gem2g7 atm_adsui9o08mg_glywfm atm_adsui1iqqh5c_6s8zn8 atm_adsui1j124uw_1ncjpb7 atm_adsui1qgxgro_1gr7bv3 atm_adsui1ol26gk_1gem2g7 atm_adsuifnju3y_glywfm atm_adsui8dg1eh_6s8zn8 atm_adsui1t5abo5_1ncjpb7 atm_adsui1pcy8k9_1gr7bv3 atm_adsuiuzkx18_1gem2g7 atm_adsui1s22a1g_glywfm atm_adsuiv4wfzc_6s8zn8 atm_adsuiln2feu_1ncjpb7",Tv="atm_adsuij7_idpfg4 atm_adsui9s_11p5wf0 atm_adsuin5_idpfg4 atm_adsui84_idpfg4 atm_adsuidz_kyo2w3 atm_adsuigw_1gem2g7 atm_adsuiiz_glywfm atm_adsuimrwrxb_6s8zn8 atm_adsui165a258_idpfg4 atm_adsuindcbtc_idpfg4 atm_adsui1ywdvs7_idpfg4 atm_adsui7bg9zp_h3ouum atm_adsuiqjzyof_idpfg4 atm_adsui15n9hsn_idpfg4 atm_adsuigpq1w8_idpfg4 atm_adsui1ts7i44_kyo2w3 atm_adsui1xz6qul_1gem2g7 atm_adsui1pqqic1_glywfm atm_adsuilz7qdd_6s8zn8 atm_adsui134y5xe_h3ouum atm_adsui1nznzd5_kyo2w3 atm_adsuiom2ku1_1gem2g7 atm_adsui9o08mg_glywfm atm_adsui1iqqh5c_6s8zn8 atm_adsui1j124uw_h3ouum atm_adsui1qgxgro_kyo2w3 atm_adsui1ol26gk_1gem2g7 atm_adsuifnju3y_glywfm atm_adsui8dg1eh_6s8zn8 atm_adsui1t5abo5_h3ouum atm_adsui1pcy8k9_kyo2w3 atm_adsuiuzkx18_1gem2g7 atm_adsui1s22a1g_glywfm atm_adsuiv4wfzc_6s8zn8 atm_adsuiln2feu_h3ouum",Ev="atm_adsuij7_idpfg4 atm_adsui9s_11p5wf0 atm_adsuin5_idpfg4 atm_adsui84_idpfg4 atm_adsuidz_1y3gjcq atm_adsuigw_1gem2g7 atm_adsuiiz_glywfm atm_adsui1xr9v27_1210cad atm_adsuif3wayr_idpfg4 atm_adsuimgqw9w_idpfg4 atm_adsui8iopdn_idpfg4 atm_adsuix9z4xg_107lskt atm_adsui1wohlm_idpfg4 atm_adsuiu9g1y7_idpfg4 atm_adsui1orm0qo_idpfg4 atm_adsuiskdtbx_15wbn57 atm_adsuip945hm_1pzsloo atm_adsui1ts7i44_1gr7bv3 atm_adsui1xz6qul_1gem2g7 atm_adsui1pqqic1_glywfm atm_adsuizryume_6s8zn8 atm_adsui1ngmxnq_1ncjpb7 atm_adsui1nznzd5_1gr7bv3 atm_adsuiom2ku1_1gem2g7 atm_adsui9o08mg_glywfm atm_adsuin783i1_6s8zn8 atm_adsui1l75c4v_1ncjpb7 atm_adsui1qgxgro_1gr7bv3 atm_adsui1ol26gk_1gem2g7 atm_adsuifnju3y_glywfm atm_adsui1i44mqh_6s8zn8 atm_adsuivsouqh_1ncjpb7 atm_adsui1pcy8k9_1gr7bv3 atm_adsuiuzkx18_1gem2g7 atm_adsui1s22a1g_glywfm atm_adsuiehc6gd_6s8zn8 atm_adsuittpjm6_1ncjpb7",$v="atm_adsuij7_idpfg4 atm_adsui9s_11p5wf0 atm_adsuin5_idpfg4 atm_adsui84_idpfg4 atm_adsuidz_dk28gj atm_adsuigw_1gem2g7 atm_adsuiiz_glywfm atm_adsui1xr9v27_6s8zn8 atm_adsuif3wayr_idpfg4 atm_adsuimgqw9w_idpfg4 atm_adsui8iopdn_idpfg4 atm_adsuix9z4xg_h3ouum atm_adsui1wohlm_idpfg4 atm_adsuiu9g1y7_idpfg4 atm_adsui1orm0qo_idpfg4 atm_adsuiskdtbx_15wbn57 atm_adsuip945hm_1pzsloo atm_adsui1ts7i44_dk28gj atm_adsui1xz6qul_1gem2g7 atm_adsui1pqqic1_glywfm atm_adsuizryume_6s8zn8 atm_adsui1ngmxnq_h3ouum atm_adsui1nznzd5_dk28gj atm_adsuiom2ku1_1gem2g7 atm_adsui9o08mg_glywfm atm_adsuin783i1_6s8zn8 atm_adsui1l75c4v_h3ouum atm_adsui1qgxgro_dk28gj atm_adsui1ol26gk_1gem2g7 atm_adsuifnju3y_glywfm atm_adsui1i44mqh_6s8zn8 atm_adsuivsouqh_h3ouum atm_adsui1pcy8k9_dk28gj atm_adsuiuzkx18_1gem2g7 atm_adsui1s22a1g_glywfm atm_adsuiehc6gd_6s8zn8 atm_adsuittpjm6_h3ouum",Sk="atm_adsui9s_116y0ak atm_adsuiar_vrvcex atm_adsuih_1h6ojuz atm_adsui1xk5jbi_1aou828 atm_adsui15ztyo3_1wugsn5 atm_adsuiya8ym_12336oc atm_adsuiou0xue_1h6ojuz atm_adsuip2cq0w_idpfg4 atm_adsui3y46a7_pfqszd atm_adsui1e8hxr8_1f51e7f atm_adsui1w4yjon_1wugsn5 atm_adsui1fm6vu0_1aou828 atm_adsuieb1l7_1wugsn5 atm_adsuiu4pov9_1f51e7f atm_adsuibd751w_1wugsn5 atm_adsuip12vv8_1aou828 atm_adsui119azkn_1wugsn5 atm_adsuidutd7r_1f51e7f atm_adsuivm5w66_1wugsn5 atm_adsui7msh7_116y0ak atm_adsuijq6hmp_1q9ycp6 atm_adsuiqu4bbn_1h6ojuz atm_adsui1450k7n_1ulexfb atm_adsui7bxzlg_h68d5v atm_adsuin2zkk7_24x154 atm_adsuicx_tx1for atm_adsuijb_idpfg4";function Cv(e=!1,t=!1){return{header:pe("ux-workspace-header",e?Tv:Pv),main:pe("ux-workspace-main",e||t?$v:Ev)}}var vk="atm_adsui9s_1txwivl atm_adsuiar_1bp4okc atm_adsuivy_1osqo2v atm_adsuie2_1osqo2v atm_adsuij6_idpfg4 atm_adsui26_1bplolx atm_adsui7l_1wskm3t atm_adsuibx_rhlbdi atm_adsuic8_1m800s6 atm_adsuig3_sqnntc atm_adsui1swzw65_glywfm atm_adsuitwidkn_1eorbtc atm_adsui9sygfm_idpfg4 atm_adsui12bw0u4_10rgqv3 atm_adsuilgsf2q_1bplolx atm_adsui1czrkxg_m9afv7 atm_adsui1xxn05p_1txwivl atm_adsuijvq3zr_tx1for atm_adsui192tkol_1h6ojuz atm_adsui1uphbw0_1aqtv8w atm_adsui18j3xf2_1txwivl atm_adsuiv4kl24_1fhbwtr atm_adsui7tg88j_116y0ak atm_adsui3hsxdi_116y0ak atm_adsuiw4isa_1q9ycp6 atm_adsui1e372br_tx1for atm_adsuiol208p_idpfg4 atm_adsui1hwqkvt_14k5dlv atm_adsui1brizz9_1d1fc98 atm_adsui1qytvf8_1r1dq30 atm_adsui1i52crn_idpfg4 atm_adsui1rva9te_15vqwwr atm_adsui1ux9w3e_1l2sidv atm_adsui16phkqt_1q9ccgz atm_adsui11e3yb3_1wugsn5 atm_adsui121hswv_1txwivl atm_adsuikokisn_iqvn5y atm_adsui1xmdvl_1h6ojuz atm_adsuidgi0se_idpfg4 atm_adsui1106ncu_1wugsn5 atm_adsuiu6bb7r_tx1for atm_adsui1nngew9_1txwivl atm_adsui1hijnjn_1h6ojuz atm_adsui14yqywo_idpfg4 atm_adsui1n3v6f3_1wugsn5 atm_adsuibmhjpv_tx1for atm_adsuitwhtux_idpfg4 atm_adsui1t7jlm4_kb7nvz atm_adsuigr19py_idpfg4 atm_adsui1r3dd4x_1txwivl atm_adsui1dr8vx7_1bp4okc atm_adsui12n32ac_idpfg4 atm_adsui15x0kgb_m9afv7 atm_adsuixqxvxy_15vqwwr atm_adsuivq6bgu_ynj908 atm_adsui1o135n7_1bplolx atm_adsui7r55s8_kb7nvz atm_adsuiwklih5_idpfg4 atm_adsuixjj1j1_1wugsn5 atm_adsuirae8ic_1txwivl atm_adsui16ywoy7_kb7nvz atm_adsui3zzzu1_1bp4okc atm_adsuioe3i46_idpfg4 atm_adsuigjcmck_h2mmj6 atm_adsui16iisfr_15vqwwr atm_adsui1jwmmnn_idpfg4 atm_adsuiobixd9_kb7nvz atm_adsui1bb1xke_idpfg4 atm_adsuivnahyn_idpfg4 atm_adsui1xr98ve_1bgihbq atm_adsui18tesp1_1ulexfb atm_adsui3im4ne_idpfg4 atm_adsui3aiucy_1osqo2v atm_adsui1rjdu20_1osqo2v atm_adsuitmy5t6_1txwivl atm_adsui1dgldxt_esu3gu atm_adsui1ggjjzu_iqvn5y atm_adsui138t24g_4baac9 atm_adsui1qnyawd_m9afv7 atm_adsui4v0vbm_1bplolx atm_adsui1jhz6h2_glywfm atm_adsui1chybqy_stnw88 atm_adsui1br56z7_idpfg4 atm_adsui888a6e_o2ms3 atm_adsui1xuvgmd_11p5wf0 atm_adsuirxsuh_1h6ojuz atm_adsui1mqap2g_1bplolx atm_adsui1xhqumc_14k5dlv atm_adsuirc18cp_14k5dlv atm_adsuirrx08l_moeofi atm_adsuiey7ewl_nqa18y atm_adsuigux95j_7uy8cq atm_adsui1fe4k5a_12j2sah atm_adsuig4uoah_1v7nmpu atm_adsui11rdqaw_1wdkmbo atm_adsui18vvlvy_19uah5m atm_adsui1cw8iwc_dcxj7s atm_adsui1x2b1m8_1kw7nm4 atm_adsuitbv4yw_1bplolx atm_adsuizgbt4v_1wskm3t atm_adsui17eejsz_m9afv7 atm_adsuid87q3_idpfg4 atm_adsuitcdkhm_glywfm atm_adsui1xeiopu_1h6ojuz atm_adsui1ggp9a3_idpfg4 atm_adsui1k34kje_glywfm atm_adsui1gdfntm_idpfg4 atm_adsuiz1ci95_1knmvda atm_adsuiiqm1lt_1wugsn5 atm_adsuiez3a21_15vqwwr atm_adsui8ru30r_glywfm atm_adsui1b3wxlc_1osqo2v atm_adsui129m0mj_11p5wf0 atm_adsui5w99fc_cmo227 atm_adsuirt32k7_idpfg4 atm_adsui1bb439o_1uq4mm2 atm_adsui1azndq0_1txwivl atm_adsui1ef74b0_1bp4okc atm_adsui1r8nml_idpfg4 atm_adsui1oioy44_idpfg4 atm_adsui4s98mp_m9afv7 atm_adsuipkg9do_1m800s6 atm_adsui805znv_19dj2kj atm_adsui1uyulxv_8p4f3e atm_adsuiwjjjyp_idpfg4 atm_adsuii2eazt_m9afv7 atm_adsui1gx3q7f_kb7nvz atm_adsui1adcp8o_idpfg4 atm_adsui3micw4_1txwivl atm_adsui1q69jt1_1h6ojuz atm_adsui12dg9uo_1osqo2v atm_adsuia71lpn_1knmvda atm_adsuim1gh36_glywfm atm_adsui10vojm5_glywfm";function bk({loading:e=!1,collapsed:t=!1,capture:r=!1,brand:o,sections:s,actions:n,navigation:i,overlays:a,previewOverlay:c,previewTools:l,children:d}){return S("div",{id:"workspace","data-loading":e,"data-collapsed":t,"data-capture":r,"aria-busy":e,className:pe("ux-workspace",vk),children:[S("header",{id:"header",className:pe("ux-workspace-header",t?Tv:Pv),children:[S("div",{id:"brand",className:"ux-workspace-brand",children:o}),S("div",{className:"ux-workspace-bar",children:[S("nav",{id:"sections",className:"ux-workspace-sections","aria-label":"Showcase sections",children:s}),S("div",{className:"ux-workspace-actions",children:n})]})]}),a,S("main",{className:pe("ux-workspace-main",t||r?$v:Ev),children:[S("aside",{id:"sidebar",className:"ux-workspace-sidebar",children:i}),S("section",{id:"preview-workspace",className:"ux-workspace-content","aria-label":"Preview workspace",children:S("section",{id:"preview",className:"ux-workspace-preview","aria-label":"Preview",children:[c,l&&S("div",{className:"ux-workspace-preview-tools",role:"toolbar","aria-label":"Preview tools",children:l}),S("div",{id:"frame-slot",className:"ux-workspace-slot",children:d})]})})]})]})}function yk({title:e="Design system",loading:t=!1,section:r="tokens",previewStatus:o,guidesAvailable:s=!1,guideOptions:n,navigation:i,children:a}){return S(bk,{loading:t,brand:S(Qt,{children:[S("span",{className:pe("ux-workspace-name",Sk),children:[S("span",{className:"ux-workspace-logo",children:S(jx,{})}),S("span",{className:"ux-workspace-name-text",children:[S("span",{className:"ux-workspace-mark",children:"ADS"}),S("span",{id:"title",className:"ux-workspace-title",children:e})]})]}),S($e,{id:"pane-toggle",label:"Hide navigation pane",iconOnly:!0,expanded:!0,controls:"sidebar",children:S(Oe,{name:"chevron-left"})})]}),sections:S(Qt,{children:[S($e,{label:"Brand",section:"brand",current:r==="brand",children:S(Oe,{name:"brand"})}),S($e,{label:"Icons",section:"icons",current:r==="icons",children:S(Oe,{name:"icons"})}),S($e,{label:"Pictograms",section:"pictograms",current:r==="pictograms",children:S(Oe,{name:"pictograms"})}),S($e,{label:"Tokens",section:"tokens",current:r==="tokens",children:S(Oe,{name:"tokens"})}),S($e,{label:"Components",section:"components",current:r==="components",children:S(Oe,{name:"components"})}),S($e,{label:"Patterns",section:"patterns",current:r==="patterns",children:S(Oe,{name:"patterns"})}),S($e,{label:"Composition",section:"composition",current:r==="composition",children:S(Oe,{name:"composition"})}),S($e,{label:"Drafts",section:"drafts",current:r==="drafts",children:S(Oe,{name:"drafts"})})]}),actions:S(Qt,{children:[S(fk,{...o}),S($e,{id:"viewport",label:"Phone viewport",iconOnly:!0,pressed:!1,controls:"frame-slot",children:S(Oe,{name:"phone"})}),S($e,{id:"grid-overlay",label:"Layout guides",iconOnly:!0,controls:"grid-options",popoverTarget:"grid-options",hidden:!s,children:S(Oe,{name:"layout"})}),S("select",{id:"brand-select",className:"ux-workspace-brand-select","aria-label":"Preview brand",hidden:!0}),S($e,{id:"theme",label:"Use dark theme",iconOnly:!0,children:S(Oe,{name:"moon"})}),S($e,{id:"minimize",label:"Minimize showcase menu",iconOnly:!0,children:S(Oe,{name:"chevron-up"})})]}),overlays:S(Xx,{...n}),navigation:S(uk,{id:"entries",label:"Entries",children:i}),previewTools:S($e,{id:"split-view",label:"Split view",iconOnly:!0,pressed:!1,disabled:!0,hidden:!0,children:S(Oe,{name:"split"})}),previewOverlay:S("div",{id:"loader",className:"ux-workspace-loader",role:"status","aria-label":"Loading preview",hidden:!0,children:S("span",{className:"ux-workspace-spinner","aria-hidden":"true"})}),children:a})}function Gd(e,t){let r=document.createElement("div");return So(S(e,{...t}),r),r.firstElementChild}function Iv(e){return So(S(yk,{title:"",loading:!0}),e),()=>So(null,e)}var qv=(e)=>Gd(lk,e),Ov=(e)=>Gd(Vx,e),Nv=(e)=>Gd(gk,e);var Sa=new WeakMap;function fu(e){let t=Sa.get(e);return!!t&&t.parentNode===e&&!!t.firstElementChild}function Yd(e,t){let r=Sa.get(e);if(!r||r.parentNode!==e){if(r)So(null,r);r=document.createElement("div"),r.className="ux-icons-mount",Sa.set(e,r),e.replaceChildren(r)}return So(S(ik,{data:t}),r),r.firstElementChild}function Xd(e){let t=Sa.get(e);if(!t)return;So(null,t),t.remove(),Sa.delete(e)}function jv(e,t){So(S(kv,{message:t}),e)}var _u="ads://project/icons";Iv(document.getElementById("app"));var P=(e)=>document.getElementById(e),Ke=new URLSearchParams(location.search),Mv=Ke.get("scenario"),wk=["brand","icons","pictograms","tokens","components","patterns","composition","drafts"],vu=!1,bo=[],ze,yo=Ke.get("draft"),nm=[],Uv=[],im=new Map,kr=Ke.get("split")==="1",tm,Pr=[],Mt=0,zu;async function Ra(){let e=Pr;Pr=[],await Promise.allSettled(e.map((t)=>t.close()))}var zs=P("split-view"),G="brand",Ce={},Av=new Map,ys=!0,Ru=[],Ts=[],xu=[],ct,Es,Re,ve,ws,ba,xs,bu,Rs,ot=0,ks=Ke.get("capture")!=="1"&&Ke.get("viewport")==="phone",ut=[{name:"light",scheme:"light"},{name:"dark",scheme:"dark"}],Tr=Ke.get("capture")==="1"&&Ke.get("theme")||"light";if(Ke.get("capture")==="1")P("workspace").dataset.capture="true",rb();var rm=()=>ut.find((e)=>e.name===Tr)?.scheme??"light";function Dv(){document.documentElement.dataset.theme=rm();let e=ut[(ut.findIndex((r)=>r.name===Tr)+1)%ut.length],t=ut.length>1?`Use ${e.name} theme`:`Theme: ${Tr}`;P("theme").setAttribute("aria-label",t),P("theme").title=t,P("theme").disabled=ut.length<2,P("theme").querySelector("svg").innerHTML=rm()==="dark"?'<circle cx="8" cy="8" r="3"/><path d="M8 1v1M8 14v1M1 8h1M14 8h1M3 3l1 1M12 12l1 1M3 13l1-1M12 4l1-1"/>':'<path d="M13.5 9a5.5 5.5 0 0 1-6.5-6.5A5.5 5.5 0 1 0 13.5 9Z"/>'}document.documentElement.dataset.theme="light";var vo=[],tr=Ke.get("capture")==="1"&&Ke.get("brand")||null;function Zv(){let e=P("brand-select");if(e.hidden=!vo.length,e.options.length!==vo.length||vo.some((t,r)=>e.options[r].value!==t.name))e.replaceChildren(...vo.map((t)=>Object.assign(document.createElement("option"),{value:t.name,textContent:t.name})));if(tr)e.value=tr,e.title=`Brand: ${tr}`}var ku=jS(async(e)=>{if(e)await lm();await Ut(),await Tk()},{onError:lt}),om,Pu=!1,ya=!1,Rr,er,Qd=0,va,wo=new AbortController;window.addEventListener("blur",()=>setTimeout(()=>{if(document.activeElement?.tagName==="IFRAME")for(let e of document.querySelectorAll(":popover-open"))e.hidePopover()},0));var At=new Cd({name:"ads-showcase",version:"1.0.0"},{versionNegotiation:{mode:"auto"},capabilities:{extensions:{"io.modelcontextprotocol/ui":{mimeTypes:["text/html;profile=mcp-app"]}}}}),Hv=(e,t={},r={})=>At.callTool({name:e,arguments:t},{signal:wo.signal,...r}),yu=NS((e)=>At.readResource(e,{signal:wo.signal}),{signal:wo.signal,onDiagnostic:(e)=>{if(e.state==="retry")document.documentElement.dataset.adsResourceRetries=String(Number(document.documentElement.dataset.adsResourceRetries??0)+1);console.warn("ADS resource transport",e)}}),am=async(e)=>JSON.parse((await yu({uri:e})).contents.find((t)=>typeof t.text==="string").text);function Fv(e){let t=xu.find((r)=>r.name===e.name);if(!t||!(t._meta?.ui?.visibility??["model","app"]).includes("app"))throw Error("This tool is not callable from an App.");return At.callTool(e)}var Vv="";function be(e,t=!1,r=t?"error":e?"checking":"ready"){let o=e||"Preview is up to date.";if(P("preview-error").hidden=!t,jv(P("status"),o),Vv=o,P("status").dataset.error=String(t),!t)for(let s of["errorCategory","errorCode","resourceUri"])delete P("status").dataset[s];P("status").setAttribute("role",t?"alert":"status"),P("preview-status").dataset.phase=r,P("preview-status").querySelector(".ds-preview-indicator").dataset.state=["reloading","compiling","reverting"].includes(r)?"building":r,P("preview-status").title=o,P("preview-status").setAttribute("aria-label",`Preview status: ${o.split(`
122
- `)[0]}`),Bv()}function Bv(){let e=Es?.warmup,t=e?`Background views: ${e.completed}/${e.total} compiled${e.failed?`; ${e.failed} failed`:""}.`:"";P("warmup-status").hidden=!e,P("warmup-status").textContent=t,P("preview-status").dataset.warmup=e?.state??"disabled",P("preview-status").title=[Vv,t].filter(Boolean).join(`
123
- `)}function Jv(){be(Re?"Updating preview…":"Opening preview…",!1,"reloading")}function Er(){return $r().find((e)=>e.id===Ce[G])}function $s(e=Er()){let t=bo.find((r)=>r.id===yo&&im.get(r.id)?.scenario===e?.id);return e?.drafts?.find((r)=>r.id===yo)??t??e?.drafts?.[0]}function cm(){return Boolean($s()&&(G==="drafts"||Er()?.draftOnly||kr))}function wa(){return G==="drafts"?Er()?.previewId:Ce[G]}function za(){return`${G}:${Ce[G]}${cm()?`:draft:${$s().id}:split:${kr}`:""}`}function gu(e=Re){return e?.key===za()}function Wv(e=Es){if(cm()){let t=e?.drafts?.find((r)=>r.id===$s()?.id);return t?.scenarios?.find((r)=>r.id===wa())??t}return e?.previews?.find((t)=>t.id===wa())}var Kv=(e)=>JSON.stringify(e&&[e.session,e.revision,e.current,e.live]);function Gv(){({scenarios:Ts,categories:Ru}=US(nm,Uv,bo,im))}function zk(e){im.set(e.structuredContent.id,e.structuredContent),Gv()}async function sm(e,t,r=wo.signal){let o=(ct?.compiler?.buildTimeoutMs??30000)+15000;try{return await Hv(e,t,{signal:AbortSignal.any([wo.signal,r]),timeout:o})}catch(s){if(s.code!=="REQUEST_TIMEOUT")throw s;throw Object.assign(Error(`The preview request timed out after ${Math.ceil(o/1000)} seconds. No preview result was received. Retry the preview.`,{cause:s}),{code:"ADS_PREVIEW_REQUEST_TIMEOUT",category:"transport"})}}async function um(e,t,r){let o=(Er()?.id===t||G==="drafts")&&Er()?.pendingDraftScenario||e.units?.includes(t)&&!nm.some((n)=>n.id===t),s=await sm("ads_show_draft",{id:e.id,...!o&&t?{scenario:t}:{}},r);if(s.isError)throw Error(s.content?.find((n)=>n.type==="text")?.text??"Draft preview failed.");if(o){let n=s.structuredContent.scenarios.find((i)=>t==="tokens"?i.kind==="tokens":i.unit?i.unit===t:nu(t,i.id));if(!n)throw Error("Draft owner has no scenario yet. Add an independently mountable scenario before previewing it.");if(n.id!==s.structuredContent.scenario)s=await sm("ads_show_draft",{id:e.id,scenario:n.id},r);if(s.isError)throw Error(s.content?.find((i)=>i.type==="text")?.text??"Draft preview failed.")}return zk(s),s}function rr(e=!1){if(e)Rs=Re?.key;xs=void 0,P("loader").hidden=!0,P("preview").setAttribute("aria-busy","false")}function em(e){let t=new URL(location.href);for(let s of["scenario","draft","split","section"])t.searchParams.delete(s);if(G==="icons")return t.searchParams.set("section","icons"),t.pathname+t.search+t.hash;if(G==="drafts"){t.searchParams.set("section","drafts");let s=$r().find((n)=>n.id===e);if(s?.drafts?.[0])t.searchParams.set("draft",s.drafts[0].id);if(s?.previewId)t.searchParams.set("scenario",s.previewId);if(kr)t.searchParams.set("split","1");return t.pathname+t.search+t.hash}if(e)t.searchParams.set("scenario",e);let r=$r().find((s)=>s.id===e),o=$s(r);if(o&&(r.draftOnly||kr)){if(t.searchParams.set("draft",o.id),!r.draftOnly)t.searchParams.set("split","1")}return t.pathname+t.search+t.hash}function $r(){return G==="drafts"?DS(Ts,bo):G==="tokens"?Ru:G==="icons"?[{id:"icons",kind:"icons",title:"All icons"}]:Ts.filter((e)=>e.kind===G)}function Yv(e,t){if(t.kind==="icons"&&G==="icons")return;let{state:r,label:o}=jd(t.previewId?{...t,id:t.previewId}:t,Es,yo),s=e.querySelector(".entry-preview");if(!s)return;s.dataset.state=r,s.title=o,e.dataset.buildState=r,e.setAttribute("aria-description",o)}var Ps={...ZS},Lv=()=>G==="drafts"?Er()?.kind:G,Xv=()=>["components","patterns","composition"].includes(Lv())||Lv()==="tokens"&&wa()==="tokens/Layout";function xa(){return Ps}function Rk(){return HS(xa())}function Qv(){return FS(xa())}function eb(){let e=Xv(),t=xa(),r=Qv();P("grid-overlay").hidden=!e,P("grid-overlay").dataset.enabled=String(e&&r),P("grid-options-content").dataset.mode=t.mode;for(let o of P("grid-options").querySelectorAll('[id^="grid-options-mode-"]'))o.setAttribute("aria-pressed",String(o.id==="grid-options-mode-"+t.mode));for(let o of P("grid-options").querySelectorAll('[id^="grid-options-layer-"]'))o.setAttribute("aria-pressed",String(t[o.id.slice(19)]===!0));if(P("grid-options-hint").textContent=P("grid-options-hint").dataset[t.mode]??"",!e&&P("grid-options").matches(":popover-open"))P("grid-options").hidePopover()}var Su;function Lt(){return{...Su&&Su.target===wa()?{adsFocus:Su}:{},theme:rm(),adsTheme:Tr,...tr?{adsBrand:tr}:{},gridOverlay:Xv()&&Qv(),gridGuides:Rk(),gridGuideChoices:xa(),displayMode:"inline",containerDimensions:{width:P("frame-slot").clientWidth,height:P("frame-slot").clientHeight}}}function Cs(){P("workspace").dataset.loading="false",P("workspace").setAttribute("aria-busy","false");let e=Ts.some((i)=>i.kind==="brand");if(P("sections").querySelector('[data-section="brand"]').hidden=!e,G==="brand"&&!e)G="tokens";if(P("sections").querySelector('[data-section="icons"]').hidden=!ct?.icons,G==="icons"&&!ct?.icons)G="tokens";let t=Ts.some((i)=>i.kind==="pictograms");if(P("sections").querySelector('[data-section="pictograms"]').hidden=!t,G==="pictograms"&&!t)G="tokens";document.body.dataset.activeSection=G;let r=$r();if(!r.some((i)=>i.id===Ce[G]))Ce[G]=r[0]?.id??null;eb(),ve?.setHostContext(Lt()),history.replaceState(null,"",em(Ce[G]));let o=P("entries").scrollTop;P("entries").setAttribute("aria-label",G[0].toUpperCase()+G.slice(1));let s=(i)=>{let a=i.kind==="icons"&&G==="icons"?void 0:jd(i.previewId?{...i,id:i.previewId}:i,Es,yo),c=i.drafts?.length&&G!=="drafts",l=Ov({label:i.title,href:em(i.id),current:i.id===Ce[G],previewState:a?.state,previewLabel:a?.label,draftLabel:c?i.drafts.length>1?`Drafts ${i.drafts.length}`:"Draft":void 0,draftDescription:c?i.draftOnly?"Draft only; no accepted version yet":"Draft available; use Split view to compare":void 0});if(l.href=em(i.id),l.dataset.scenario=i.id,Yv(l,i),i.id===Ce[G])l.setAttribute("aria-current","page");return l.addEventListener("click",(d)=>{if(d.button||d.metaKey||d.ctrlKey||d.shiftKey||d.altKey)return;d.preventDefault(),Ce[G]=i.id,Cs(),Ut().catch(lt)}),l},n=MS(r);if(G==="drafts"){let i=Object.values(su);n.sort((a,c)=>i.indexOf(a.label)-i.indexOf(c.label))}P("entries").replaceChildren(...n.flatMap((i)=>{if(!i.label)return i.entries.map(s);let a=`${G}:${i.label}`,c=qv({label:i.label,open:Av.get(a)??!0});return c.querySelector('[data-slot="entries"]').append(...i.entries.map(s)),c.addEventListener("toggle",()=>{if(c.isConnected)Av.set(a,c.open)}),[c]})),P("entries").scrollTop=o;for(let i of P("sections").querySelectorAll("button"))if(i.dataset.section===G)i.setAttribute("aria-current","page");else i.removeAttribute("aria-current");wu()}function lt(e){if(!Pu&&!ya)rr(),P("status").dataset.errorCategory=e.category??(e.code==="ADS_RESOURCE_TRANSPORT"?"transport":"runner"),P("status").dataset.errorCode=e.code??"ADS_HOST_STARTUP",be(`${e.message}${Re?`
124
- The retained preview is not verified against the current source.`:""}`,!0)}async function xr(e){if(!e)return;try{await e.teardownResource({},{timeout:500})}catch{}await e.close()}function tb(){if(Pu||ya)return;ya=!0,wo.abort(),++ot,ku.close(),rr(),be("MCP disconnected. The retained preview is stale. Refresh the page after restarting ADS.",!0);let e=ve;ve=void 0,xr(e),++Mt,Ra()}async function lm(){let e=await am("ads://project/explorer");if(ct=e.status,Es=ct.build,xu=e.tools,ct.themes?.length){if(ut=ct.themes,!ut.some((n)=>n.name===Tr))Tr=ut[0].name;Dv(),ve?.setHostContext(Lt())}vo=ct.brands??[],tr=vo.some((n)=>n.name===tr)?tr:vo[0]?.name??null,Zv(),ve?.setHostContext(Lt()),Uv=e.categories,nm=e.scenarios,bo=e.drafts,P("title").textContent=(ct.drafts?.previewOnly?"Draft · ":"")+ct.project.showcase.title,P("title").title=ct.projectRoot,Gv();let t=ys?Mv:Ce[G],r=ys&&bo.find((n)=>n.id===yo),o=Re?.draft&&bo.find((n)=>n.id===Re.draftId);if(r||o&&ze&&(o.revision!==ze.revision||ze.discovery?.state==="pending")){let n=await um(r||o,r?Mv:ze.scenario);if(r)t=n.structuredContent.scenario;if(Re?.draft&&o){ze=n.structuredContent,zu=n;for(let i of Pr)if(i.side==="draft")await i.updateResult(n)}}let s=Ts.find((n)=>n.id===t);if(G==="drafts"||ys&&Ke.get("section")==="drafts"){G="drafts";let n=$r(),i=n.find((a)=>a.drafts?.[0].id===yo&&a.previewId===t)??n.find((a)=>a.id===Ce.drafts)??n.find((a)=>a.drafts?.[0].id===yo);Ce.drafts=i?.id??n[0]?.id}else if(s&&wk.includes(s.kind))G=s.kind,Ce[G]=s.id;else if(ys&&Ru.some((n)=>n.id===t))G="tokens",Ce.tokens=t;else if(ys&&Ke.get("section")==="icons"&&ct.icons)G="icons";ys=!1,Cs()}function Ut({force:e=!1}={}){if(ya)return Promise.resolve();if(G==="icons")return kk(e);vu=!1,Xd(P("frame-slot"));let t=wa(),r=za();if(ws?.key===r)return ws.promise;if(!e&&ba?.key===r)return Promise.resolve();if(!e&&!ws&&Re?.key===r)return Promise.resolve();ba=void 0;let o={key:r};return ws=o,o.promise=xk(t,r).finally(()=>{if(ws===o)ws=void 0}),o.promise}async function xk(e,t){bu?.abort();let r=bu=new AbortController,o=++ot;xs=!0,P("loader").hidden=t===Rs,P("preview").setAttribute("aria-busy","true");try{if(++Mt,await Ra(),o!==ot)return;if(cm()){await xr(ve),ve=void 0,Rr=void 0,er=void 0;let c=$s(),l=await um(c,e,r.signal);if(o!==ot)return;if(ze=l.structuredContent,zu=l,G==="drafts"){let d=$r().find((f)=>f.drafts?.[0].id===c.id&&f.previewId===ze.scenario);if(d)Ce.drafts=d.id}else if(Er()?.pendingDraftScenario||!$r().some((d)=>d.id===e))Ce[G]=ze.scenario;Re={key:za(),id:ze.scenario,draftId:c.id,generation:o,draft:!0},wu(),await Ek(),Cs(),rr(!0),be("Draft preview only. Acceptance checks have not run.",!1,"ready");return}if(ze=void 0,wu(),!e){if(await xr(ve),o!==ot)return;if(ve=void 0,Re=void 0,Rs=void 0,Rr=void 0,er=void 0,P("frame-slot").replaceChildren(),rr(),G==="drafts"){P("frame-slot").append(Nv({title:"Drafts",description:"No active drafts."})),be("");return}be("No scenarios discovered. Colocate an independently mountable scenario and fixture with the public implementation.");return}let s=xu.find((c)=>c.name==="ads_show_scenario");if(!s?._meta?.ui?.resourceUri)throw Error("The server did not expose a preview App tool.");let n={id:e};if(s.inputSchema?.properties?.waitFor)n.waitFor=Ke.get("capture")==="1"||Ke.get("waitFor")==="verified"?"verified":"compiled";Jv();let i=await sm(s.name,n,r.signal);if(o!==ot)return;if(i.isError)throw Object.assign(Error(i.content?.find((c)=>c.type==="text")?.text??"Preview build failed."),i.structuredContent?.failure);Re={key:t,id:e,generation:o,build:i.structuredContent?.build,manifestRevision:i.structuredContent?.manifestRevision};let a=await Pk(s._meta.ui.resourceUri);if(o!==ot)return;if(Rr==="ui://ads/preview"&&!Re.manifestRevision)throw Error("The resource preview has no manifest revision.");if(Rs!==t)Rs=void 0;if(await a.sendToolInput({arguments:n}),await a.sendToolResult(i),o===ot&&!i.structuredContent?.manifestUri)rr(!0),be("")}catch(s){if(o===ot)ba={key:za(),build:Kv(Wv())},lt(s)}}async function kk(e){if(vu&&!e&&fu(P("frame-slot")))return;bu?.abort();let t=++ot;if(!fu(P("frame-slot"))){P("loader").hidden=!1,++Mt,await Ra();let r=ve;ve=void 0,Re=void 0,Rs=void 0,Rr=void 0,er=void 0,ze=void 0,await xr(r)}try{let r=await am(_u);if(t!==ot||G!=="icons")return;Yd(P("frame-slot"),r),vu=!0,rr(),be(""),wu()}catch(r){if(t===ot)lt(r)}}async function Pk(e){if(Rr===e&&er)return er;let t=++Qd,r=ve;ve=void 0,Rr=e,er=(async()=>{await xr(r);let o=await yu({uri:e});if(t!==Qd||Pu||ya)throw Error("Preview opening was superseded.");let s=o.contents.find((l)=>l.mimeType==="text/html;profile=mcp-app"&&typeof l.text==="string");if(!s)throw Error("The preview resource contains no MCP App.");let n=document.createElement("iframe");n.title="Design-system preview",n.setAttribute("sandbox","allow-scripts allow-same-origin allow-forms"),n.src=va,P("frame-slot").replaceChildren(n);let i=new ha(null,{name:"ADS showcase",version:"1.0.0"},{serverResources:{},serverTools:{},logging:{}},{hostContext:Lt()});ve=i,i.onreadresource=(l)=>yu(l),i.oncalltool=Fv,i.onloggingmessage=(l)=>{if(i!==ve||l.logger!=="ads-preview"||Re?.generation!==ot||!gu()||l.data?.id!==Re?.id)return;if(l.data.state==="guide-options"){Ps=fa(l.data.options),fm();return}if(l.data.state==="navigate"){let f=Ru.find((h)=>h.id===l.data.target);if(!f)return;if(Su={target:f.id,token:typeof l.data.token==="string"?l.data.token:void 0,nonce:Date.now()},Ce.tokens===f.id&&G==="tokens"){ve?.setHostContext(Lt());return}G="tokens",Ce.tokens=f.id,Cs(),Ut().catch(lt);return}let d=l.data.revision===Re.manifestRevision||l.data.selectionRevision===Re.manifestRevision;if(l.data.state==="ready"&&d)Re.manifestRevision=l.data.revision,rr(!0),be("");else if(l.data.state==="checking"&&(!xs||d))rr(!0),be("Checking changes…");else if(l.data.state==="loading")be("Updating preview…",!1,"reloading");else if(l.data.state==="reverting")be("Restoring the last verified preview…",!1,"reverting");else if(l.data.code==="ADS_PREVIEW_REOPEN")ve=void 0,Rr=void 0,er=void 0,Jv(),xr(i).then(()=>Ut({force:!0})).catch(lt);else if(l.data.state==="error"){if(rr(),P("status").dataset.errorCategory=l.data.category??"build",P("status").dataset.errorCode=l.data.code??"ADS_PREVIEW_BUILD",l.data.resourceUri)P("status").dataset.resourceUri=l.data.resourceUri;else delete P("status").dataset.resourceUri;be([l.data.message,l.data.code,l.data.resourceUri].filter(Boolean).join(`
125
- `),!0)}},i.onerror=lt;let a,c=new Promise((l,d)=>{a=setTimeout(()=>d(Error("MCP App initialization timed out.")),15000),i.oninitialized=()=>{clearTimeout(a),l()}});i.onsandboxready=()=>i.sendSandboxResourceReady({html:s.text,csp:s._meta?.ui?.csp,sandbox:"allow-scripts allow-forms"});try{await Promise.all([i.connect(new pa(n.contentWindow,n.contentWindow)),c])}catch(l){throw await xr(i),l}finally{clearTimeout(a)}return i})();try{return await er}catch(o){if(t===Qd)Rr=void 0,er=void 0;throw o}}async function Tk(){let e=Re,t=await am("ads://project/build");Es=t,Bv();for(let o of P("entries").querySelectorAll("a[data-scenario]")){let s=$r().find((n)=>n.id===o.dataset.scenario);if(s)Yv(o,s)}if(ba?.key===za()){let o=Wv(t);if(o&&(o.current||o.live)&&Kv(o)!==ba.build)await Ut({force:!0});return}if(!e||xs||!gu(e))return;if(e.draft){let o=t.drafts?.find((i)=>i.id===e.draftId),s=o?.scenarios?.find((i)=>i.id===ze?.scenario)??o,n=s&&JSON.stringify([o?.session,s.revision,s.live?.revision,s.current]);if(s&&(s.current||s.live)&&e.buildSignature!==n){e.buildSignature=n;let i=bo.find((a)=>a.id===e.draftId);if(i){let a=await um(i,ze.scenario);if(Re!==e||xs||!gu(e))return;ze=a.structuredContent,zu=a;for(let c of Pr)if(c.side==="draft")await c.updateResult(a)}}if(s?.state==="error")be("Draft preview build failed. Showing the previous preview.",!0);else if(s?.building)be(s.live||s.state==="checking"?"Draft preview compiled; checking changes…":"Building draft preview… Showing the previous preview.",!1,s.live||s.state==="checking"?"checking":"compiling");else if(s?.current&&tm?.state==="ready")be("Draft preview ready · unaccepted.");return}if(Re!==e||xs||!gu(e))return;let r=t.previews.find((o)=>o.id===e.id);if(!r){be("The selected scenario is no longer registered.",!0);return}if(["idle","building"].includes(r.state)&&e.build?.current&&r.session===e.build.session&&r.revision<=e.build.revision)return;if(r.state==="error"){be(`${Za(r)}. Showing an earlier view.
126
- ${gm(r.diagnostics)}`,!0);return}if(["idle","building"].includes(r.state)){be(r.live?"Checking changes…":"Compiling changes… The current view is the previous preview.",!1,r.live?"checking":"compiling");return}if(r.current&&(r.revision!==e.build?.revision||r.session!==e.build?.session))await Ut({force:!0})}function dm(e=!1){ku.schedule(e)}async function Ek(){if(!ze)return;let e=ze,t=zu;tm=void 0;let r=++Mt;if(await Ra(),r!==Mt)return;let o=kr&&e.acceptedExists;zs.setAttribute("aria-pressed",String(o));let s=document.createElement("div");s.className="draft-comparison",s.dataset.split=String(o);for(let n of o?["accepted","draft"]:["draft"]){let i=document.createElement("section");i.className="draft-version";let a=document.createElement("h2");a.dataset.version=n,a.textContent=n==="accepted"?"Accepted":"Draft · unaccepted";let c=document.createElement("div");c.className="draft-stage",c.dataset.version=n,i.append(a,c),s.append(i)}P("frame-slot").replaceChildren(s),await Promise.all([...s.querySelectorAll(".draft-stage")].map(async(n)=>{let i=n.dataset.version,a=i==="draft"?t:await Hv("ads_show_scenario",{id:e.scenario,waitFor:"compiled"});if(a.isError)throw Error(a.content?.find((d)=>d.type==="text")?.text??"Comparison build failed.");if(r!==Mt)return;let c=xu.find((d)=>d.name===(i==="draft"?"ads_show_draft":"ads_show_scenario")),l=await LS({slot:n,title:i==="draft"?"Draft version":"Accepted version",sandboxUrl:va,resourceUri:c._meta.ui.resourceUri,result:a,readResource:yu,callTool:Fv,context:(d)=>({...Lt(),containerDimensions:{width:d.clientWidth,height:d.clientHeight}}),onError:(d)=>{if(r===Mt)lt(d)},onState:(d)=>{if(r!==Mt)return;if(d.state==="guide-options"){Ps=fa(d.options),fm();return}if(i!=="draft")return;if(tm=d,d.state==="ready")be("Draft preview ready · unaccepted.");else if(d.state==="checking")be("Draft preview compiled; checking changes…",!1,"checking");else if(["loading","reverting"].includes(d.state))be("Updating draft preview…",!1,"reloading")}});if(r!==Mt)await l.close();else Pr.push({...l,side:i})}))}function wu(){let e=Er(),t=Boolean($s(e))&&!e?.draftOnly;zs.disabled=!t,zs.hidden=!t,zs.title=e?.draftOnly?"No accepted version yet":t?"Compare accepted and draft versions":"No draft for this entry",zs.setAttribute("aria-pressed",String(t&&kr));let r=document.querySelector('.draft-version h2[data-version="draft"]');if(r&&ze){let o={draft:"unaccepted",checking:"checking acceptance",failed:"acceptance failed",conflict:"source conflict",interrupted:"acceptance interrupted","dependency-error":"dependency needs attention"};r.textContent=`Draft · ${o[ze.state]??ze.state}`,r.title=ze.dependencies?.length?`Draft dependencies: ${ze.dependencies.join(", ")}`:""}}zs.addEventListener("click",()=>{kr=!kr,Cs(),Ut().catch(lt)});for(let e of P("sections").querySelectorAll("button"))e.addEventListener("click",()=>{G=e.dataset.section,Cs(),Ut().catch(lt)});var mm=window.matchMedia("(max-width: 760px)");function rb(){let e=P("workspace"),t=Cv(e.dataset.collapsed==="true",e.dataset.capture==="true");P("header").className=t.header,e.querySelector(":scope > main").className=t.main}function pm(e){P("workspace").dataset.collapsed=String(e),rb(),P("pane-toggle").setAttribute("aria-expanded",String(!e)),P("pane-toggle").setAttribute("aria-label",e?"Show navigation pane":"Hide navigation pane"),P("pane-toggle").title=e?"Show navigation pane":"Hide navigation pane",P("pane-toggle").querySelector("path").setAttribute("d",e?"M6 4l4 4-4 4":"M10 4l-4 4 4 4")}var hm=()=>pm(mm.matches||P("header").hidden);hm();mm.addEventListener("change",hm);P("pane-toggle").addEventListener("click",()=>pm(P("workspace").dataset.collapsed!=="true"));function ob(){P("workspace").dataset.viewport=ks?"phone":"auto",P("viewport").setAttribute("aria-pressed",String(ks)),P("viewport").title=ks?"Use available preview width":"Preview at phone width (390 px)"}ob();P("viewport").addEventListener("click",()=>{ks=!ks,ob();let e=new URL(location.href);if(ks)e.searchParams.set("viewport","phone");else e.searchParams.delete("viewport");history.replaceState(null,"",e.pathname+e.search+e.hash)});P("theme").addEventListener("click",()=>{Tr=ut[(ut.findIndex((e)=>e.name===Tr)+1)%ut.length].name,Dv(),ve?.setHostContext(Lt())});P("theme").addEventListener("click",()=>{for(let e of Pr)e.refreshContext()});P("brand-select").addEventListener("change",()=>{tr=P("brand-select").value,Zv(),ve?.setHostContext(Lt());for(let e of Pr)e.refreshContext()});P("grid-options").addEventListener("click",(e)=>{let[,t,r]=/^grid-options-(mode|layer|preset)-(.+)$/.exec(e.target.closest("button")?.id??"")??[],o=xa();if(t==="mode")Ps={...o,mode:r};else if(t==="layer")Ps={...o,[r]:o[r]!==!0};else if(t==="preset")Ps={...o,...wv(r),mode:o.mode==="off"?"hover":o.mode};else return;fm()});function fm(){eb(),ve?.setHostContext(Lt());for(let e of Pr)e.refreshContext()}P("grid-options").addEventListener("toggle",(e)=>P("grid-overlay").setAttribute("aria-expanded",String(e.newState==="open")));P("minimize").addEventListener("click",()=>{P("header").hidden=!0,pm(!0)});var sb=new ResizeObserver(()=>ve?.setHostContext(Lt()));sb.observe(P("frame-slot"));P("retry-preview").addEventListener("click",()=>{(async()=>{await lm(),await Ut({force:!0})})().catch(lt)});window.addEventListener("pagehide",()=>{Pu=!0,bu?.abort(),wo.abort(),ku.close(),sb.disconnect(),mm.removeEventListener("change",hm),xr(ve),++Mt,Ra(),om?.close(),At.close()},{once:!0});At.onclose=tb;At.setNotificationHandler("notifications/resources/list_changed",()=>dm(!0));At.setNotificationHandler("notifications/tools/list_changed",()=>dm(!0));At.setNotificationHandler("notifications/resources/updated",({params:e})=>{if(e.uri===_u)vu=!1;dm(e.uri==="ads://project/explorer")});try{if(va=(await fetch("host.json").then((e)=>e.json())).sandboxUrl,!va||new URL(va).origin===location.origin)throw Error("The separate-origin MCP App sandbox is unavailable.");await At.connect(new RS(new URL("mcp",location.href))),om=await At.listen({resourcesListChanged:!0,toolsListChanged:!0,resourceSubscriptions:["ads://project/build","ads://project/tokens","ads://project/explorer",_u]}),om.closed.then((e)=>{if(e!=="local")tb()}),await lm(),ku.start(),await Ut()}catch(e){lt(e)}
118
+ - "app": Tool callable by the app from this server only`),csp:Hl().optional(),permissions:Hl().optional()}),zT=p({mimeTypes:b(u()).optional().describe('Array of supported MIME types for UI resources.\nMust include `"text/html;profile=mcp-app"` for MCP Apps support.')}),fx=p({method:m("ui/download-file"),params:p({contents:b(q([so,no])).describe("Resource contents to download — embedded (inline data) or linked (host fetches). Uses standard MCP resource types.")})}),_x=p({method:m("ui/message"),params:p({role:m("user").describe('Message role, currently only "user" is supported.'),content:b(Nt).describe("Message content blocks (text, image, etc.).")})}),RT=p({method:m("ui/notifications/sandbox-resource-ready"),params:p({html:u().describe("HTML content to load into the inner iframe."),sandbox:u().optional().describe("Optional override for the inner iframe's sandbox attribute."),csp:Ad.optional().describe("CSP configuration from resource metadata."),permissions:Ld.optional().describe("Sandbox permissions from resource metadata.")})}),xT=p({method:m("ui/notifications/tool-result"),params:Sr.describe("Standard MCP tool execution result.")}),AS=p({toolInfo:p({id:_t.optional().describe("JSON-RPC id of the tools/call request."),tool:gr.describe("Tool definition including name, inputSchema, etc.")}).optional().describe("Metadata of the tool call that instantiated this App."),theme:XR.optional().describe("Current color theme preference."),styles:cx.optional().describe("Style configuration for theming the app."),displayMode:_a.optional().describe("How the UI is currently displayed."),availableDisplayModes:b(_a).optional().describe("Display modes the host supports."),containerDimensions:q([p({height:x().describe("Fixed container height in pixels.")}),p({maxHeight:q([x(),Zl()]).optional().describe("Maximum container height in pixels.")})]).and(q([p({width:x().describe("Fixed container width in pixels.")}),p({maxWidth:q([x(),Zl()]).optional().describe("Maximum container width in pixels.")})])).optional().describe(`Container dimensions. Represents the dimensions of the iframe or other
119
+ container holding the app. Specify either width or maxWidth, and either height or maxHeight.`),locale:u().optional().describe("User's language and region preference in BCP 47 format."),timeZone:u().optional().describe("User's timezone in IANA format."),userAgent:u().optional().describe("Host application identifier."),platform:q([m("web"),m("desktop"),m("mobile")]).optional().describe("Platform type for responsive design decisions."),deviceCapabilities:p({touch:I().optional().describe("Whether the device supports touch input."),hover:I().optional().describe("Whether the device supports hover interactions.")}).optional().describe("Device input capabilities."),safeAreaInsets:p({top:x().describe("Top safe area inset in pixels."),right:x().describe("Right safe area inset in pixels."),bottom:x().describe("Bottom safe area inset in pixels."),left:x().describe("Left safe area inset in pixels.")}).optional().describe("Mobile safe area boundaries in pixels.")}).passthrough(),kT=p({method:m("ui/notifications/host-context-changed"),params:AS.describe("Partial context update containing only changed fields.")}),gx=p({method:m("ui/update-model-context"),params:p({content:b(Nt).optional().describe("Context content blocks (text, image, etc.)."),structuredContent:C(u(),D().describe("Structured content for machine-readable context data.")).optional().describe("Structured content for machine-readable context data.")})}),Sx=p({method:m("ui/initialize"),params:p({appInfo:qt.describe("App identification (name and version)."),appCapabilities:px.describe("Features and capabilities this app provides."),protocolVersion:u().describe("Protocol version this app supports.")})}),vx=p({protocolVersion:u().describe('Negotiated protocol version string (e.g., "2025-11-21").'),hostInfo:qt.describe("Host application identification and version."),hostCapabilities:dx.describe("Features and capabilities provided by the host."),hostContext:AS.describe("Rich context about the host environment.")}).passthrough();class ws{eventTarget;eventSource;messageListener;constructor(e=window.parent,t){this.eventTarget=e,this.eventSource=t,this.messageListener=(r)=>{if(t&&r.source!==this.eventSource){console.debug("Ignoring message from unknown source",r);return}let o=gt.safeParse(r.data);if(o.success)console.debug("Parsed message",o.data),this.onmessage?.(o.data);else if(r.data?.jsonrpc!=="2.0")console.debug("Ignoring non-JSON-RPC message",o.error.message,r);else console.error("Failed to parse message",o.error.message,r),this.onerror?.(Error("Invalid JSON-RPC message received: "+o.error.message))}}async start(){window.addEventListener("message",this.messageListener)}async send(e,t){if(e.method!==YR)console.debug("Sending message",e);this.eventTarget.postMessage(e,"*")}async close(){window.removeEventListener("message",this.messageListener),this.onclose?.()}onclose;onerror;onmessage;sessionId;setProtocolVersion}var bx=[MS];class zs extends ma{_client;_hostInfo;_hostCapabilities;_appCapabilities;_hostContext={};_appInfo;_initializedReceived=!1;_registeredEvents=new Set;_events=new NS;_methods=new jS;setRequestHandler=(...e)=>{let[t,...r]=CS("request",e)??e;this._methods.claim(t,"setRequestHandler"),super.setRequestHandler.call(this,t,...r)};setNotificationHandler=(...e)=>{let[t,...r]=CS("notification",e)??e;this._methods.claim(t,"setNotificationHandler"),super.setNotificationHandler.call(this,t,...r)};removeRequestHandler=(e)=>{this._methods.release(e),super.removeRequestHandler(e)};removeNotificationHandler=(e)=>{this._methods.release(e),super.removeNotificationHandler(e)};replaceRequestHandler=(e,...t)=>{this._methods.replace(e),super.setRequestHandler.call(this,e,...t)};_wrapHandler(e,t){let r=super._wrapHandler(e,t);if(e==="ui/initialize"||e==="ping")return r;return async(o,s)=>{if(!this._initializedReceived)console.warn(`[ext-apps] AppBridge received '${e}' before ui/notifications/initialized. The View is calling host methods before completing the handshake; it should await app.connect() first.`);return r(o,s)}}eventSchemas={sizechange:ix,sandboxready:nx,initialized:mx,requestteardown:lx,loggingmessage:io};setEventHandler(e,t){this._ensureEventSlot(e),this._events.setHandler(e,t)}getEventHandler(e){return this._events.getHandler(e)}addEventListener(e,t){this._ensureEventSlot(e),this._events.addEventListener(e,t)}removeEventListener(e,t){this._events.removeEventListener(e,t)}_ensureEventSlot(e){if(this._registeredEvents.has(e))return;let t=this.eventSchemas[e];if(!t)throw Error(`Unknown event: ${String(e)}`);let r=(o)=>{if(e==="initialized")this._initializedReceived=!0;this._events.dispatch(e,o)};if(e==="loggingmessage")this.setNotificationHandler("notifications/message",(o)=>{r(o.params)});else this.setNotificationHandler(t.shape.method.value,{params:t.shape.params},(o)=>r(o));this._registeredEvents.add(e)}warnIfRequestHandlerReplaced(e,t,r){if(t&&r)console.warn(`[MCP Apps] ${e} handler replaced. Previous handler will no longer be called.`)}constructor(e,t,r,o){super(o);this._client=e,this._hostInfo=t,this._hostCapabilities=r,this._methods.replace("notifications/cancelled"),this._methods.replace("notifications/progress"),this._ensureEventSlot("initialized"),this._hostContext=o?.hostContext||{},this.replaceRequestHandler("ui/initialize",{params:Sx.shape.params,result:vx},(s)=>this._onAppsInitialize(s)),this.replaceRequestHandler("ping",(s,n)=>(this.onping?.(s.params,n),{})),this.replaceRequestHandler("ui/request-display-mode",{params:qS.shape.params,result:OS},()=>({mode:this._hostContext.displayMode??"inline"}))}buildContext(e){return e}assertCapabilityForMethod(e){}assertRequestHandlerCapability(e){}assertNotificationCapability(e){}getAppCapabilities(){return this._appCapabilities}getAppVersion(){return this._appInfo}onping;get onsizechange(){return this.getEventHandler("sizechange")}set onsizechange(e){this.setEventHandler("sizechange",e)}get onsandboxready(){return this.getEventHandler("sandboxready")}set onsandboxready(e){this.setEventHandler("sandboxready",e)}get oninitialized(){return this.getEventHandler("initialized")}set oninitialized(e){this.setEventHandler("initialized",e)}_onmessage;get onmessage(){return this._onmessage}set onmessage(e){this.warnIfRequestHandlerReplaced("onmessage",this._onmessage,e),this._onmessage=e,this.replaceRequestHandler("ui/message",{params:_x.shape.params,result:sx},async(t,r)=>{if(!this._onmessage)throw Error("No onmessage handler set");return this._onmessage(t,r)})}_onopenlink;get onopenlink(){return this._onopenlink}set onopenlink(e){this.warnIfRequestHandlerReplaced("onopenlink",this._onopenlink,e),this._onopenlink=e,this.replaceRequestHandler("ui/open-link",{params:tx.shape.params,result:rx},async(t,r)=>{if(!this._onopenlink)throw Error("No onopenlink handler set");return this._onopenlink(t,r)})}_ondownloadfile;get ondownloadfile(){return this._ondownloadfile}set ondownloadfile(e){this.warnIfRequestHandlerReplaced("ondownloadfile",this._ondownloadfile,e),this._ondownloadfile=e,this.replaceRequestHandler("ui/download-file",{params:fx.shape.params,result:ox},async(t,r)=>{if(!this._ondownloadfile)throw Error("No ondownloadfile handler set");return this._ondownloadfile(t,r)})}get onrequestteardown(){return this.getEventHandler("requestteardown")}set onrequestteardown(e){this.setEventHandler("requestteardown",e)}_onrequestdisplaymode;get onrequestdisplaymode(){return this._onrequestdisplaymode}set onrequestdisplaymode(e){this.warnIfRequestHandlerReplaced("onrequestdisplaymode",this._onrequestdisplaymode,e),this._onrequestdisplaymode=e,this.replaceRequestHandler("ui/request-display-mode",{params:qS.shape.params,result:OS},async(t,r)=>{if(!this._onrequestdisplaymode)throw Error("No onrequestdisplaymode handler set");return this._onrequestdisplaymode(t,r)})}get onloggingmessage(){return this.getEventHandler("loggingmessage")}set onloggingmessage(e){this.setEventHandler("loggingmessage",e)}_onupdatemodelcontext;get onupdatemodelcontext(){return this._onupdatemodelcontext}set onupdatemodelcontext(e){this.warnIfRequestHandlerReplaced("onupdatemodelcontext",this._onupdatemodelcontext,e),this._onupdatemodelcontext=e,this.replaceRequestHandler("ui/update-model-context",{params:gx.shape.params,result:fr},async(t,r)=>{if(!this._onupdatemodelcontext)throw Error("No onupdatemodelcontext handler set");return this._onupdatemodelcontext(t,r)})}_oncalltool;get oncalltool(){return this._oncalltool}set oncalltool(e){this.warnIfRequestHandlerReplaced("oncalltool",this._oncalltool,e),this._oncalltool=e,this.replaceRequestHandler("tools/call",async(t,r)=>{if(!this._oncalltool)throw Error("No oncalltool handler set");return this._oncalltool(t.params,r)})}_oncreatesamplingmessage;get oncreatesamplingmessage(){return this._oncreatesamplingmessage}set oncreatesamplingmessage(e){this.warnIfRequestHandlerReplaced("oncreatesamplingmessage",this._oncreatesamplingmessage,e),this._oncreatesamplingmessage=e,this.replaceRequestHandler("sampling/createMessage",async(t,r)=>{if(!this._oncreatesamplingmessage)throw Error("No oncreatesamplingmessage handler set");return this._oncreatesamplingmessage(t.params,r)})}sendToolListChanged(e={}){return this.notification({method:"notifications/tools/list_changed",params:e})}_onlistresources;get onlistresources(){return this._onlistresources}set onlistresources(e){this.warnIfRequestHandlerReplaced("onlistresources",this._onlistresources,e),this._onlistresources=e,this.replaceRequestHandler("resources/list",async(t,r)=>{if(!this._onlistresources)throw Error("No onlistresources handler set");return this._onlistresources(t.params,r)})}_onlistresourcetemplates;get onlistresourcetemplates(){return this._onlistresourcetemplates}set onlistresourcetemplates(e){this.warnIfRequestHandlerReplaced("onlistresourcetemplates",this._onlistresourcetemplates,e),this._onlistresourcetemplates=e,this.replaceRequestHandler("resources/templates/list",async(t,r)=>{if(!this._onlistresourcetemplates)throw Error("No onlistresourcetemplates handler set");return this._onlistresourcetemplates(t.params,r)})}_onreadresource;get onreadresource(){return this._onreadresource}set onreadresource(e){this.warnIfRequestHandlerReplaced("onreadresource",this._onreadresource,e),this._onreadresource=e,this.replaceRequestHandler("resources/read",async(t,r)=>{if(!this._onreadresource)throw Error("No onreadresource handler set");return this._onreadresource(t.params,r)})}sendResourceListChanged(e={}){return this.notification({method:"notifications/resources/list_changed",params:e})}_onlistprompts;get onlistprompts(){return this._onlistprompts}set onlistprompts(e){this.warnIfRequestHandlerReplaced("onlistprompts",this._onlistprompts,e),this._onlistprompts=e,this.replaceRequestHandler("prompts/list",async(t,r)=>{if(!this._onlistprompts)throw Error("No onlistprompts handler set");return this._onlistprompts(t.params,r)})}sendPromptListChanged(e={}){return this.notification({method:"notifications/prompts/list_changed",params:e})}getCapabilities(){return this._hostCapabilities}async _onAppsInitialize(e){let t=e.protocolVersion;if(this._appInfo!==void 0)console.warn("[ext-apps] AppBridge received a second ui/initialize. The View may be double-mounting (e.g. React StrictMode in dev) without closing the previous App instance. Responding normally; the latest appInfo/appCapabilities replace the previous values.");return this._appCapabilities=e.appCapabilities,this._appInfo=e.appInfo,{protocolVersion:bx.includes(t)?t:MS,hostCapabilities:this.getCapabilities(),hostInfo:this._hostInfo,hostContext:this._hostContext}}setHostContext(e){let t={},r=!1;for(let o of Object.keys(e)){let s=this._hostContext[o],n=e[o];if(yx(s,n))continue;t[o]=n,r=!0}if(r)this._hostContext=e,this.sendHostContextChange(t)}sendHostContextChange(e){return this.notification({method:"ui/notifications/host-context-changed",params:e})}sendToolInput(e){return this.notification({method:"ui/notifications/tool-input",params:e})}sendToolInputPartial(e){return this.notification({method:"ui/notifications/tool-input-partial",params:e})}sendToolResult(e){return this.notification({method:"ui/notifications/tool-result",params:e})}sendToolCancelled(e){return this.notification({method:"ui/notifications/tool-cancelled",params:e})}sendSandboxResourceReady(e){return this.notification({method:"ui/notifications/sandbox-resource-ready",params:e})}teardownResource(e,t){return this.request({method:"ui/resource-teardown",params:e},ux,t)}sendResourceTeardown=this.teardownResource;callTool(e,t){return this.request({method:"tools/call",params:e},t)}listTools(e,t){return this.request({method:"tools/list",params:e},t)}async connect(e){if(this.transport)throw Error("AppBridge is already connected. Call close() before connecting again.");if(this._initializedReceived=!1,this._client){let t=this._client.getServerCapabilities();if(!t)throw Error("Client server capabilities not available");if(t.tools){if(this.oncalltool=async(r,o)=>this._client.request({method:"tools/call",params:r},{signal:o.mcpReq.signal}),t.tools.listChanged)this._client.setNotificationHandler("notifications/tools/list_changed",(r)=>this.sendToolListChanged(r.params))}if(t.resources){if(this.onlistresources=async(r,o)=>this._client.request({method:"resources/list",params:r},{signal:o.mcpReq.signal}),this.onlistresourcetemplates=async(r,o)=>this._client.request({method:"resources/templates/list",params:r},{signal:o.mcpReq.signal}),this.onreadresource=async(r,o)=>this._client.request({method:"resources/read",params:r},{signal:o.mcpReq.signal}),t.resources.listChanged)this._client.setNotificationHandler("notifications/resources/list_changed",(r)=>this.sendResourceListChanged(r.params))}if(t.prompts){if(this.onlistprompts=async(r,o)=>this._client.request({method:"prompts/list",params:r},{signal:o.mcpReq.signal}),t.prompts.listChanged)this._client.setNotificationHandler("notifications/prompts/list_changed",(r)=>this.sendPromptListChanged(r.params))}}return super.connect(e)}}function yx(e,t){return JSON.stringify(e)===JSON.stringify(t)}var ga=!1;function LS(){return new Nd({name:"ads-showcase",version:"1.0.0"},{versionNegotiation:{mode:"auto"},capabilities:{extensions:{"io.modelcontextprotocol/ui":{mimeTypes:["text/html;profile=mcp-app"]}}}})}var US=(e)=>e.connect(new ES(new URL("mcp",location.href)));var DS=[200,800],wx=(e)=>e?.name==="TypeError"&&/^(Failed to fetch|fetch failed|Load failed|NetworkError when attempting to fetch resource\.)$/.test(e.message);function zx(e,t){return new Promise((r,o)=>{t?.throwIfAborted();let n=setTimeout(()=>{t?.removeEventListener("abort",i),r()},e),i=()=>{clearTimeout(n),t.removeEventListener("abort",i),o(t.reason)};t?.addEventListener("abort",i,{once:!0})})}function ZS(e,{signal:t,onDiagnostic:r,wait:o=zx}={}){return async(s)=>{for(let n=1;;n++){t?.throwIfAborted();try{let i=await e(s);if(t?.throwIfAborted(),n>1)r?.({state:"recovered",uri:s.uri,attempt:n});return i}catch(i){if(t?.throwIfAborted(),!wx(i))throw i;if(n>DS.length)throw r?.({state:"exhausted",uri:s.uri,attempt:n,message:i.message}),Object.assign(Error(`MCP resource transport failed for ${s.uri} after ${n} attempts: ${i.message}. Inspect the host connection and browser network diagnostics; this resource-loading error does not establish a component assertion failure.`,{cause:i}),{code:"ADS_RESOURCE_TRANSPORT"});let a=DS[n-1];r?.({state:"retry",uri:s.uri,attempt:n,nextAttempt:n+1,delayMs:a,message:i.message}),await o(a,t)}}}}function HS(e,{onError:t,delay:r=150,setTimer:o=setTimeout,clearTimer:s=clearTimeout}={}){let n=!1,i=!1,a=!1,c=!1,l=!1,d;function f(){if(!n||i||a||!c||d!==void 0)return;d=o(()=>{d=void 0,a=!0;let h=l;c=l=!1,Promise.resolve().then(()=>e(h)).catch((g)=>{if(!i)t?.(g)}).finally(()=>{a=!1,f()})},r)}return{schedule(h=!1){if(i)return;c=!0,l||=h,f()},start(){n=!0,f()},close(){i=!0,c=l=!1,s(d),d=void 0}}}function FS(e){let t=[],r=new Map;for(let o of e){if(!o.group){t.push(o);continue}if(!r.has(o.group))r.set(o.group,[]);r.get(o.group).push(o)}return[...t.length?[{label:null,entries:t}]:[],...[...r].sort(([o],[s])=>o.localeCompare(s)).map(([o,s])=>({label:o,entries:s}))]}var Rx=(e)=>typeof e==="string"&&/^(?:ads:\/\/project\/build|ads:\/\/preview\/(?:manifest|live)(?:\?from=[a-f0-9]{64})?)$/.test(e);function au({frame:e,context:t,draftScope:r}){let o,s=0,n=!1,i,a,c,l=new AbortController;async function d(v,_=!1){let y=await fetch("preview-http",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(v),..._?{keepalive:!0}:{signal:l.signal}}),T=await y.json();if(!y.ok)throw Object.assign(Error(T.error??"HTTP preview control failed."),{code:T.code});return T}function f(v,_,y={}){if(!n&&o)e.contentWindow?.postMessage({channel:"ads-preview-http",instance:o.id,epoch:s,method:v,params:_,...y},"*")}async function h(v){let _=v.data;if(n||v.source!==e.contentWindow||v.origin!=="null"||_?.channel!=="ads-preview-http"||_.instance!==o?.id)return;if(_.method==="ready"){f("init",t),clearTimeout(a),i?.(),g.oninitialized?.();return}if(_.epoch!==s)return;if(_.method==="log"){g.onloggingmessage?.(_.params);return}if(!["read","prepare"].includes(_.method)||!Number.isSafeInteger(_.request))return;let y=s;try{let T;if(_.method==="prepare")T=await d({..._.params,op:"prepare",id:o.id});else{let O=_.params?.uri,k=r&&typeof O==="string"&&O.startsWith(r)?decodeURIComponent(O.slice(r.length)):O;if(!Rx(k)||r&&O===k)throw Error("Unexpected HTTP preview control resource.");T=await g.onreadresource({uri:O})}if(!n&&s===y)f("response",void 0,{request:_.request,result:T})}catch(T){if(!n&&s===y)f("response",void 0,{request:_.request,error:T.message,code:T.code})}}let g={async reconcileBuild(){if(n||!o)return;try{await d({op:"keepalive",id:o.id});let v=r?r+encodeURIComponent("ads://project/build"):"ads://project/build",_=await g.onreadresource({uri:v});g.receiveBuild(v,JSON.parse(_.contents.find((y)=>typeof y.text==="string").text))}catch(v){if(n)return;if(v.code==="ADS_PREVIEW_REOPEN")g.onloggingmessage?.({logger:"ads-preview",data:{state:"error",id:c,code:v.code}});else g.onerror?.(v)}},receiveBuild(v,_){let y=r?r+encodeURIComponent("ads://project/build"):"ads://project/build";if(v===y)f("build",_)},setHostContext(v){t=v,f("context",v)},async sendToolInput(){},async sendToolResult(v){if(v.structuredContent?.draftScope!==r)throw Error("Cannot change the scope of an HTTP preview instance.");c=(v.structuredContent?.previewResult?.structuredContent??v.structuredContent)?.scenario?.id,s++,f("select",v)},async connect(){if(o=await d({op:"open",draftScope:r}),n){await d({op:"close",id:o.id},!0);return}window.addEventListener("message",h);let v=new Promise((_,y)=>{i=_,a=setTimeout(()=>y(Error("HTTP preview initialization timed out.")),15000)});e.setAttribute("sandbox","allow-scripts allow-forms"),e.dataset.previewDelivery="http",e.src=o.url,await v},async teardownResource(){f("teardown")},async close(){if(n)return;if(f("teardown"),n=!0,clearTimeout(a),window.removeEventListener("message",h),l.abort(),o)await d({op:"close",id:o.id},!0).catch(()=>{});e.remove()}};return g}async function BS({slot:e,title:t,sandboxUrl:r,httpPreview:o=!1,resourceUri:s,result:n,readResource:i,callTool:a,context:c,onError:l,onState:d}){let f={slot:e,title:t,sandboxUrl:r,httpPreview:o,resourceUri:s,readResource:i,callTool:a,context:c,onError:l,onState:d},h=n,g,v,_,y=!1;function T(){if(y||_)return;d?.({state:"loading"}),_=Promise.resolve().then(async()=>{if(await v,await g?.close(),y)return;v=VS({...f,result:h,onReopen:T});try{g=await v}finally{v=void 0}}).catch((O)=>{if(!y)l(O)}).finally(()=>{_=void 0})}v=VS({...f,result:h,onReopen:T});try{g=await v}finally{v=void 0}return{async updateResult(O){if(h=O,await _,!y)await g.updateResult(h)},refreshContext(){if(!y&&!_)g.refreshContext()},receiveBuild(O,k){if(!y&&!_)g.receiveBuild?.(O,k)},reconcileBuild(){if(!y&&!_)return g.reconcileBuild?.()},async close(){y=!0,await _,await g?.close()}}}async function VS({slot:e,title:t,sandboxUrl:r,httpPreview:o,resourceUri:s,result:n,readResource:i,callTool:a,context:c,onError:l,onState:d,onReopen:f}){let h=!1,v=(o?void 0:await i({uri:s}))?.contents.find((P)=>P.mimeType==="text/html;profile=mcp-app"&&typeof P.text==="string");if(!o&&!v)throw Error("Comparison preview App is unavailable.");let _=document.createElement("iframe");if(_.title=t,_.setAttribute("sandbox","allow-scripts allow-same-origin allow-forms"),!o)_.src=r;e.append(_);let y=o?au({frame:_,context:c(_),draftScope:n.structuredContent?.draftScope}):new zs(null,{name:"ADS showcase",version:"1.0.0"},{serverResources:{},serverTools:{},logging:{}},{hostContext:c(_)});y.onreadresource=i,y.oncalltool=a,y.onerror=(P)=>{if(!h)l(P)},y.onloggingmessage=(P)=>{if(h||P.logger!=="ads-preview")return;if(P.data?.code==="ADS_PREVIEW_REOPEN"){f();return}if(d?.(P.data),P.data?.state==="error")l(Error(P.data.message))};let T,O=new Promise((P,z)=>{T=setTimeout(()=>z(Error("Comparison App initialization timed out.")),15000),y.oninitialized=()=>{clearTimeout(T),P()}});if(!o)y.onsandboxready=()=>y.sendSandboxResourceReady({html:v.text,csp:v._meta?.ui?.csp,sandbox:"allow-scripts allow-forms"});let k=new ResizeObserver(()=>y.setHostContext(c(_)));try{await Promise.all([y.connect(o?void 0:new ws(_.contentWindow,_.contentWindow)),O]),k.observe(_),await y.sendToolInput({arguments:{}}),await y.sendToolResult(n)}catch(P){throw k.disconnect(),_.remove(),await y.close(),P}finally{clearTimeout(T)}return{updateResult:(P)=>y.sendToolResult(P),refreshContext:()=>y.setHostContext(c(_)),receiveBuild:(P,z)=>y.receiveBuild?.(P,z),reconcileBuild:()=>y.reconcileBuild?.(),async close(){h=!0,k.disconnect();try{await y.teardownResource({},{timeout:500})}catch{}await y.close(),_.remove()}}}function uu(e,t){return t===e||t.startsWith(e+"/")||t.startsWith(e+".")}function JS(e,t,r,o=new Map){let s=new Map(r.map(({id:c,title:l,revision:d,state:f,preview:h})=>[c,{id:c,title:l,revision:d,state:f,...h?{preview:h}:{}}])),n=new Map(e.map((c)=>[c.id,{...c,drafts:(c.drafts??[]).flatMap((l)=>s.has(l.id)?[s.get(l.id)]:[])}]));for(let c of t){let l=n.get(c.id);n.set(c.id,{...l,...c,kind:"tokens",drafts:l?.drafts??[]})}let i=(c,l)=>c==="assets/pictograms"&&l.kind==="pictograms"||c==="tokens"&&l.kind==="tokens"||(l.unit?l.unit===c:uu(c,l.id)),a=(c,l)=>{if(!c.drafts.some((d)=>d.id===l.id))c.drafts.push(s.get(l.id))};for(let c of r){let l=o.get(c.id);for(let d of l?.scenarios??[]){if(!c.units.some((h)=>i(h,d)))continue;let f=n.get(d.id);if(!f)f={...d,draftOnly:!0,drafts:[]},n.set(d.id,f);a(f,c)}}for(let c of r)for(let l of c.units){let d=l==="assets/pictograms"?"pictograms":l.split("/")[0];if(!["brand","pictograms","tokens","components","patterns","composition"].includes(d))continue;let f=[...n.values()].filter((h)=>i(l,h));if(f.length)for(let h of f)a(h,c);else n.set(l,{id:l,unit:l,title:l.split("/").at(-1),kind:d,draftOnly:!0,pendingDraftScenario:!0,drafts:[s.get(c.id)]})}return{scenarios:[...n.values()],categories:[...n.values()].filter((c)=>c.kind==="tokens")}}var xx=(e)=>e==="assets/pictograms"?"pictograms":e==="assets/glyphs"||e==="assets/logos"?"icons":e==="assets/brand"?"brand":e==="foundation"?"tokens":["brand","tokens","icons","components","patterns","composition"].includes(e.split("/")[0])?e.split("/")[0]:"other",cu={brand:"Brand",icons:"Icons",pictograms:"Pictograms",tokens:"Tokens",components:"Components",patterns:"Patterns",composition:"Compositions",other:"Other"};function WS(e,t){let r=[];for(let o of t){let s=e.filter((n)=>n.drafts?.some((i)=>i.id===o.id));for(let n of s)r.push({...n,id:`drafts/${encodeURIComponent(o.id)}/${encodeURIComponent(n.id)}`,previewId:n.id,title:`${o.title||o.id} · ${n.title}`,group:cu[n.kind]??"Other",drafts:[o]});for(let n of o.units??[]){if(s.some((a)=>n==="tokens"&&a.kind==="tokens"||a.unit===n||!a.unit&&uu(n,a.id)))continue;let i=xx(n);r.push({id:`drafts/${encodeURIComponent(o.id)}/${encodeURIComponent(n)}`,unit:n,kind:i,title:`${o.title||o.id} · ${n.split("/").at(-1)}`,group:cu[i],drafts:[o]})}if(!s.length&&!o.units?.length)r.push({id:`drafts/${encodeURIComponent(o.id)}`,kind:"other",title:o.title||o.id,group:"Other",drafts:[o]})}return r}var kx=["off","hover","always"],Px=["bounds","tracks","gaps","padding","margins","mini"],KS=Object.freeze({mode:"off",bounds:!0,tracks:!1,gaps:!1,padding:!0,margins:!0,mini:!1});function Sa(e){return{mode:kx.includes(e?.mode)?e.mode:e?.all===!0?"always":"off",...Object.fromEntries(Px.map((r)=>[r,e?.[r]===!0]))}}function GS(e){let{mode:t,...r}=Sa(e);return{all:t==="always",...r}}function YS(e){let{mode:t,...r}=Sa(e);return t!=="off"&&Object.values(r).some(Boolean)}function Ud(e,t,r){let o=e.drafts?.find((c)=>c.id===r)??e.drafts?.[0],s=o&&(t?.drafts?.find((c)=>c.id===o.id)??o.preview),n=o?s?.scenarios?.find((c)=>c.id===e.id)??s:t?.previews?.find((c)=>c.id===e.id)??e.build,i=n?.state==="error"?"error":n?.state==="checking"||n?.live?"checking":n?.building||["queued","building"].includes(n?.state)?"building":n?.current?"ready":n?.stale?"stale":"unreported",a={error:Va(n),checking:"Preview compiled; checking changes",building:"Preview build in progress",ready:"Preview build complete",stale:"Previous preview; current source not built",unreported:"Preview not built"};return{state:i,label:`${o?"Draft · ":""}${a[i]}${o&&i==="ready"?" · unaccepted":""}`}}var le,fv,zr,XS,hu,_v,du,gv,Wd,Fd,fu={},_u=[],Tx=/^m(i|n|o|s|text|space)$/,Kd=Array.isArray,Sv=_u.slice,So=Object.assign;function gu(e){e&&e.parentNode&&e.remove()}function pu(e,t,r,o,s){var n={type:e,props:t,key:r,ref:o,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:s||++fv,__i:-1,__u:0};return!s&&le.vnode&&le.vnode(n),n}function er(e){return e.children}function mu(e,t){this.props=e,this.context=t,this.__g=0}function Rr(e,t){if(t==null)return e.__?Rr(e.__,e.__i+1):null;for(var r;t<e.__k.length;t++)if((r=e.__k[t])&&r.__e)return r.__e;return typeof e.type!="function"||e.props.__P?null:Rr(e)}function vv(e){if((e=e.__)&&e.__c&&!e.props.__P)return e.__e=null,e.__k.some(function(t){return t&&(e.__e=t.__e)}),vv(e)}function QS(e){(8&e.__g||!(e.__g|=8)||!zr.push(e)||hu++)&&XS==le.debounceRendering||((XS=le.debounceRendering)||queueMicrotask)(Ex)}function Ex(){var e,t,r,o,s,n,i,a,c;try{for(t=1;zr.length;)zr.length>t&&zr.sort(_v),e=zr.shift(),t=zr.length,8&e.__g&&(o=void 0,s=void 0,n=(s=(r=e).__v).__e,i=[],a=[],(c=r.__P)&&((o=So({constructor:void 0},s)).__v=s.__v+1,le.vnode&&le.vnode(o),Gd(c,o,s,r.__n,c.namespaceURI,32&s.__u?[n]:null,i,n||Rr(s),32&s.__u,a),o.__v=s.__v,o.__.__k[o.__i]=o,zv(i,o,a),s.__=s.__e=null,o.__e!=n&&vv(o)))}finally{zr.length=hu=0}}function bv(e,t,r,o,s,n,i,a,c,l,d){var f,h,g,v,_,y,T=o.__k||_u,O=t.length;for(c=$x(r,t,T,c,O),f=0;f<O;f++)(g=r.__k[f])!=null&&(h=~g.__i&&T[g.__i]||fu,g.__i=f,y=Gd(e,g,h,s,n,i,a,c,l,d),v=g.__e,(h.ref!=g.ref||8&h.__u)&&(h.ref&&Yd(h.ref,null,g,h),g.ref&&d.push(g.ref,g.__c||v,g)),_=_||v,4&g.__u?(c=yv(g,c,e,!h.__v),h.__e&&(h.__e=null)):typeof g.type=="function"&&y!==void 0?c=y:v&&(c=v.nextSibling),g.__u&=-7);return r.__e=_,c}function $x(e,t,r,o,s){var n,i,a,c,l,d,f,h,g,v,_=r.length,y=_,T=0,O=!1,k=e.__k=Array(s);for(n=0;n<s;n++)(i=t[n])!=null&&typeof i!="boolean"&&typeof i!="function"?(typeof i!="object"||i.constructor==String?i=k[n]=pu(null,i):Kd(i)?i=k[n]=pu(er,{children:i}):i.constructor===void 0&&i.__b?i=k[n]=pu(i.type,i.props,i.key,i.ref,i.__v):k[n]=i,c=n+T,i.__=e,i.__b=e.__b+1,a=null,~(l=i.__i=Cx(i,r,c,y))&&(y--,(a=r[l])&&(a.__u|=2)),a&&a.__v?(i.__u|=2,l==c-1?T--:l==c+1?T++:l!=c&&(l>c?T--:T++,O=!0)):(~l||(s>_?T--:s<_&&T++),typeof i.type!="function"&&(i.__u|=4))):k[n]=null;if(O){for(d=[],f=[],n=0;n<s;n++)if((i=k[n])&&2&i.__u){for(h=0,g=d.length;h<g;)d[v=h+g>>1]<i.__i?h=v+1:g=v;d[h]=i.__i,f[n]=h+1}for(T=d.length;n--;)f[n]&&(f[n]==T?T--:k[n].__u|=4)}if(y)for(n=0;n<_;n++)!(a=r[n])||2&a.__u||(a.__e==o&&(o=Rr(a)),Xd(a,a));return o}function yv(e,t,r,o){var s,n,i;if(typeof e.type=="function"){if(e.props.__P)return t;if(s=e.__k)for(n=0;n<s.length;n++)s[n]&&(s[n].__=e,t=yv(s[n],t,r,!1));return t}for(t&&!t.parentNode&&(t=Rr(e))&&!t.parentNode&&(t=null),i=t;i&&i.nodeType==8;)i=i.nextSibling;for(e.__e!=i&&(!o&&r.moveBefore&&e.__e.parentNode?r.moveBefore(e.__e,t):r.insertBefore(e.__e,t||null)),t=e.__e;(t=t&&t.nextSibling)&&t.nodeType==8;);return t}function Cx(e,t,r,o){var s,n,i,{key:a,type:c}=e,l=t[r],d=l&&!(2&l.__u);if(l===null&&a==null||d&&a==l.key&&c==l.type)return r;if(o>(d?1:0)){for(s=r-1,n=r+1;s>=0||n<t.length;)if((l=t[i=s>=0?s--:n++])&&!(2&l.__u)&&a==l.key&&c==l.type)return i}return-1}function ev(e,t,r){r==null&&(r=""),t[0]=="-"?e.setProperty(t,r):e[t]=r}function lu(e,t,r,o,s){var n,i;e:if(t=="style")if(typeof r=="string")e.style.cssText=r;else{if(typeof o=="string"&&(e.style.cssText=o=""),o)for(t in o)r&&t in r||ev(e.style,t,"");if(r)for(t in r)o&&r[t]==o[t]||ev(e.style,t,r[t])}else if(t[0]=="o"&&t[1]=="n")(e.__e||(e.__e={}))[t]=r,r&&o||(i=Fd[t]||(Fd[t]=Ix(t)),(e.__a||(e.__a={}))[t]=Wd,n=t!=(t=t.replace(gv,"$1")),(t=t.slice(2))[0]<"a"&&(t=t.toLowerCase()),r?e.addEventListener(t,i,n):e.removeEventListener(t,i,n));else{if(s=="http://www.w3.org/2000/svg")t=t.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(t!="width"&&t!="height"&&t!="href"&&t!="list"&&t!="form"&&t!="tabIndex"&&t!="download"&&t!="rowSpan"&&t!="colSpan"&&t!="role"&&t!="popover"&&t in e)try{e[t]=r==null?"":r;break e}catch(a){}typeof r=="function"||(r==null||r===!1&&t[4]!="-"?e.removeAttribute(t):e.setAttribute(t,t=="popover"&&r==1?"":r))}}function Ix(e){return function(t){if(this.__e){var r=this.__e[e];if(t[du]==null)t[du]=Wd++;else if(t[du]<this.__a[e])return;return r(le.event?le.event(t):t)}}}function Gd(e,t,r,o,s,n,i,a,c,l){var d,f,h,g,v,_,y,T,O,k,P,z,R,Z,ee,X,ne,xe,te,ie,re=t.type;if(t.constructor!==void 0)return null;if(128&r.__u&&(c=32&r.__u,d=r.__c.__z)){if(t.__u|=c,f=n=[],d.nodeType==8)for(h=1,g=d.nextSibling;g;g=g.nextSibling){if(g.nodeType==8){if(g.data.startsWith("$s"))h++;else if(g.data.startsWith("/$s")&&!--h)break}n.push(g)}else n.push(d);a=n[0]}(d=le.__b)&&d(t);e:if(typeof re=="function"){v=i.length;try{if(k=t.props,P=(d=re.prototype)&&d.render,z=(d=re.contextType)&&o[d.__c],R=d?z?z.props.value:d.__:o,r.__c?2&(_=t.__c=r.__c).__g&&(_.__g|=1):(P?t.__c=_=new re(k,R):(t.__c=_=new mu(k,R),_.constructor=re,_.render=Ox),z&&z.sub(_),_.state||(_.state={}),_.__n=o,_.__g|=8,_.__h=[],_.__k=[]),P&&(_.__s||(_.__s=_.state),re.getDerivedStateFromProps&&(_.__s==_.state&&(_.__s=So({},_.__s)),So(_.__s,re.getDerivedStateFromProps(k,_.__s)))),y=_.props,T=_.state,_.__v=t,r.__c){if(P&&!re.getDerivedStateFromProps&&k!==y&&_.componentWillReceiveProps&&_.componentWillReceiveProps(k,R),t.__v==r.__v&&!(8&_.__g)||!(4&_.__g)&&_.shouldComponentUpdate&&_.shouldComponentUpdate(k,_.__s,R)===!1){t.__v!=r.__v&&(_.props=k,_.state=_.__s,_.__g&=-9),t.__e=r.__e,t.__k=r.__k,t.__k.some(function(de){de&&(de.__=t)}),_u.push.apply(_.__h,_.__k),_.__k=[],_.__h.length&&i.push(_),a=Rr(r);break e}_.componentWillUpdate&&_.componentWillUpdate(k,_.__s,R),P&&_.componentDidUpdate&&_.__h.push(function(){_.componentDidUpdate(y,T,O)})}else P&&!re.getDerivedStateFromProps&&_.componentWillMount&&_.componentWillMount(),P&&_.componentDidMount&&_.__h.push(_.componentDidMount);if(_.context=R,_.props=k,_.__P=e,_.__g&=-5,Z=le.__r,ee=0,P)_.state=_.__s,_.__g&=-9,Z&&Z(t),d=_.render(_.props,_.state,_.context),_u.push.apply(_.__h,_.__k),_.__k=[];else do _.__g&=-9,Z&&Z(t),d=_.render(_.props,_.state,_.context),_.state=_.__s;while(8&_.__g&&++ee<25);_.state=_.__s,_.getChildContext&&(o=So({},o,_.getChildContext())),P&&r.__c&&_.getSnapshotBeforeUpdate&&(O=_.getSnapshotBeforeUpdate(y,T)),X=d&&d.type===er&&d.key==null?d.props.children:d,k.__P&&(d=a,s=(e=k.__P).namespaceURI,c=n=null,r.props&&r.props.__P!=e&&(r.__k.some(function(de){de&&Xd(de,de)}),r.__k=null),a=r.__k?Rr(r,0):null),a=bv(e,Kd(X)?X:[X],t,r,o,s,n,i,a,c,l),k.__P&&(t.__e=null,a=d),t.__u&=-161,128&r.__u&&(_.__z=null),f&&f.some(gu),_.__h.length&&i.push(_),1&_.__g&&(_.__g&=-4)}catch(de){if(i.length=v,t.__v=null,c||n)if(de.then){if(ne=0,t.__u|=c?160:128,n){for(~(te=n.indexOf(a||void 0))||(te=n.length);(ie=n[te-1])&&ie.nodeType==8;)te--;for(;te<n.length;te++)if(ie=n[te]){if(n[te]=null,ie.nodeType==8){if(ie.data.startsWith("$s"))ne++||(xe=ie);else if(ne&&ie.data.startsWith("/$s")&&!--ne){a=ie;break}}else if(!ne)break}}if(!xe){for(;a&&a.nodeType==8&&a.nextSibling;)a=a.nextSibling;xe=a}t.__c.__z||(t.__c.__z=xe),t.__e=a}else n&&n.some(gu);else t.__e=r.__e;t.__k||(t.__k=r.__k||[]),de.then||wv(t),le.__e(de,t,r)}}else a=t.__e=qx(r.__e,t,r,o,s,n,i,c,l,e);return(d=le.diffed)&&d(t),128&t.__u?void 0:a}function wv(e){e&&(e.__c&&(e.__c.__g|=4),e.__k&&e.__k.some(wv))}function zv(e,t,r){for(var o=0;o<r.length;)Yd(r[o++],r[o++],r[o++]);le.__c&&le.__c(t,e),e.some(function(s){try{e=s.__h,s.__h=[],e.some(function(n){n.call(s)})}catch(n){le.__e(n,s.__v)}})}function qx(e,t,r,o,s,n,i,a,c,l){var d,f,h,g,v,_,y,T,O,k=r.props||fu,{props:P,type:z}=t;if(z=="svg"?s="http://www.w3.org/2000/svg":z=="math"?s="http://www.w3.org/1998/Math/MathML":s||(s="http://www.w3.org/1999/xhtml"),n){for(d=0;d<n.length;d++)if((v=n[d])&&(z?v.localName==z:v.nodeType==3)){e=v,n[d]=null;break}}if(!e){if(T=l.ownerDocument||document,!z)return T.createTextNode(P);e=T.createElementNS(s,z,P.is&&P),a&&(le.__m&&le.__m(t,n),a=!1),n=null}if(z){if(l=z=="template"?e.content:e,n=z=="textarea"&&P.defaultValue!=null?null:n&&Sv.call(l.childNodes),!a&&n)for(k={},d=0;d<e.attributes.length;d++)k[(v=e.attributes[d]).name]=v.value;for(d in k)v=k[d],d=="dangerouslySetInnerHTML"?h=v:d=="children"||(d in P)||d=="value"&&("defaultValue"in P)||d=="checked"&&("defaultChecked"in P)||lu(e,d,null,v,s);for(d in O=1&r.__u,P)v=P[d],d=="children"?g=v:d=="dangerouslySetInnerHTML"?f=v:d=="value"?_=v:d=="checked"?y=v:a&&typeof v!="function"||!(k[d]!==v||O&&v!=null)||lu(e,d,v,k[d],s);f?(a||h&&(f.__html==h.__html||f.__html==e.innerHTML)||(e.innerHTML=f.__html),t.__k=[]):(h&&(e.textContent=""),(z=="foreignObject"||s=="http://www.w3.org/1998/Math/MathML"&&Tx.test(z))&&(s="http://www.w3.org/1999/xhtml"),bv(l,Kd(g)?g:[g],t,r,o,s,n,i,n?n[0]:r.__k&&Rr(r,0),a,c),n&&n.some(gu)),a&&z!="textarea"||(d="value",z=="progress"&&_==null?e.removeAttribute(d):_==null||_===e[d]&&(z!="progress"||_)||lu(e,d,_,k[d],s),d="checked",y!=null&&y!=e[d]&&lu(e,d,y,k[d],s))}else k===P||a&&e.data==P||(e.data=P);return e}function Yd(e,t,r,o){try{typeof e=="function"?t?t.__x=e(t)||1:o&&(o=o.__c||o.__e)&&(t=o.__x)&&(o.__x=null,typeof t=="function"?t():e(null)):e.current=t}catch(s){le.__e(s,r)}}function Xd(e,t,r){var o,s;if(le.unmount&&le.unmount(e),!(o=e.ref)||o.current&&o.current!=e.__e||Yd(o,null,t,e),o=e.__c){if(o.componentWillUnmount)try{o.componentWillUnmount()}catch(n){le.__e(n,t)}o.__P=o.__n=null}if(o=e.__k)for(s=0;s<o.length;s++)o[s]&&Xd(o[s],t,typeof e.type!="function"||r&&!e.props.__P);(o=e.__e)&&(r||gu(o),o.__e&&(o.__e=null)),e.__e=e.__c=e.__=null}function Ox(e,t,r){return this.constructor(e,r)}function vo(e,t){var r,o,s,n;le.__&&le.__(e,t),t.nodeType==9&&(t=t.documentElement),o=(r=e&&32&e.__u)?null:t.__k,t.__k=pu(er,{children:[e]}),s=[],n=[],Gd(t,t.__k,o||fu,fu,t.namespaceURI,o?null:t.firstChild?Sv.call(t.childNodes):null,s,o?o.__e:t.firstChild,r,n),zv(s,t.__k,n),t.__k.props.children=null}le={__e:function(e,t,r,o){for(var s,n,i;t=t.__;)if((s=t.__c)&&!(1&s.__g)){s.__g|=4;try{if((n=s.constructor)&&n.getDerivedStateFromError&&(s.setState(n.getDerivedStateFromError(e)),i=8&s.__g),s.componentDidCatch&&(s.componentDidCatch(e,o||{}),i=8&s.__g),i)return void(s.__g|=2)}catch(a){e=a,i=0}}throw hu=0,e}},fv=0,mu.prototype.setState=function(e,t){var r=this.__s;r&&r!=this.state||(r=this.__s=So({},this.state)),typeof e=="function"&&(e=e(So({},r),this.props)),e&&(So(r,e),this.__v&&(t&&this.__k.push(t),QS(this)))},mu.prototype.forceUpdate=function(e){this.__v&&(this.__g|=4,e&&this.__h.push(e),QS(this))},mu.prototype.render=er,zr=[],hu=0,_v=function(e,t){return e.__v.__b-t.__v.__b},du=Symbol(),gv=/(PointerCapture)$|Capture$/i,Wd=0,Fd={};var Nx=0;function S(e,t,r,o,s,n){t||(t={});var i,a,c=t;if("ref"in c&&typeof e!="function")for(a in c={},t)a=="ref"?i=t[a]:c[a]=t[a];var l={type:e,props:c,key:r,ref:i,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--Nx,__i:-1,__u:0};return le.vnode&&le.vnode(l),l}var jx=function(){let t=Array.prototype.slice.call(arguments).filter(Boolean),r={},o=[];t.forEach((n)=>{(n?n.split(" "):[]).forEach((a)=>{if(a.startsWith("atm_")){let[,c]=a.split("_");r[c]=a}else o.push(a)})});let s=[];for(let n in r)if(Object.prototype.hasOwnProperty.call(r,n))s.push(r[n]);return s.push(...o),s.join(" ")},me=jx,Mx="atm_adsuimk_stnw88 atm_adsuif3_idpfg4 atm_adsuivy_1osqo2v atm_adsuie2_1osqo2v",Ax="atm_adsui9s_1ulexfb atm_adsuimj_glywfm atm_adsuiy1254f_icygq7 atm_adsui1s0cpq2_1y4oovw atm_adsui11bgp38_ltqb7t atm_adsuiylp9lw_1627y59 atm_adsuig6en28_1ohcsmr";function Lx({box:e,preserveAspectRatio:t="xMidYMid meet",axes:r=!0,overlay:o=!1}){if(![e.x,e.y,e.width,e.height].every(Number.isFinite)||e.width<=0||e.height<=0)return null;let s=Math.max(1,Math.ceil(Math.max(e.width,e.height)/48)),n=(i)=>[...new Set([...Array.from({length:Math.floor(i/s)+1},(a,c)=>c*s),...r?[i/2]:[],i])].sort((a,c)=>a-c);return S("svg",{className:me("ds-artwork-grid",Ax,o&&Mx),viewBox:`${e.x} ${e.y} ${e.width} ${e.height}`,"data-step":s,preserveAspectRatio:t,"aria-hidden":"true",focusable:"false",children:[n(e.width).map((i)=>S("line",{className:r&&i*2===e.width?"mid":void 0,x1:e.x+i,x2:e.x+i,y1:e.y,y2:e.y+e.height},`x${i}`)),n(e.height).map((i)=>S("line",{className:r&&i*2===e.height?"mid":void 0,x1:e.x,x2:e.x+e.width,y1:e.y+i,y2:e.y+i},`y${i}`))]})}var Ux="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2016%2016'%20fill='%23b4b4b4'%3e%3ctitle%3eADS%20—%20Eye%20in%20the%20grid,%20greyscale%20small%20size%3c/title%3e%3cpath%20d='M1%201h4v4H1zM6%201h4v4H6zM11%201h4v4H11zM1%206h4v4H1zM11%206h4v4H11zM1%2011h4v4H1zM6%2011h4v4H6zM11%2011h4v4H11z'/%3e%3cpath%20d='M6%206h4v4H6z'%20fill='%23444444'/%3e%3cpath%20d='M7%207h2v2H7z'%20fill='%23fafafa'/%3e%3c/svg%3e",Dx="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2016%2016'%20fill='%235c5c5c'%3e%3ctitle%3eADS%20—%20Eye%20in%20the%20grid,%20greyscale%20small%20size%3c/title%3e%3cpath%20d='M1%201h4v4H1zM6%201h4v4H6zM11%201h4v4H11zM1%206h4v4H1zM11%206h4v4H11zM1%2011h4v4H1zM6%2011h4v4H6zM11%2011h4v4H11z'/%3e%3cpath%20d='M6%206h4v4H6z'%20fill='%23dddddd'/%3e%3cpath%20d='M7%207h2v2H7z'%20fill='%231b1b1b'/%3e%3c/svg%3e",Zx="atm_adsui9s_116y0ak atm_adsuibb_idpfg4 atm_adsuivy_1aou828 atm_adsuie2_1aou828 atm_adsui1w_kb7nvz",tv="atm_adsuivy_1osqo2v atm_adsuie2_1osqo2v",Hx="atm_adsui9s_o8hunj",Fx="atm_adsui9s_1a9ryah";function Vx({label:e}){return S("span",{className:me("ds-brand-mark",Zx),role:e?"img":void 0,"aria-label":e,"aria-hidden":e?void 0:!0,children:[S("img",{className:me(tv,Hx),loading:"eager",src:Ux,width:16,height:16,alt:""}),S("img",{className:me(tv,Fx),loading:"eager",src:Dx,width:16,height:16,alt:""})]})}var Bx="atm_adsui9s_116y0ak atm_adsuih_1h6ojuz atm_adsuifc_1h6ojuz atm_adsuicx_tx1for atm_adsuij6_1wdkmbo atm_adsuilh_dcxj7s atm_adsuilb_tx1for atm_adsui3f_e8f45q atm_adsui5j_idpfg4 atm_adsui26_1j28jx2 atm_adsui7l_1wskm3t atm_adsuibx_rhlbdi atm_adsuics_el7ql6 atm_adsuic8_1m800s6 atm_adsuig3_3szr2b atm_adsuird_glywfm atm_adsui9j_tlke0l atm_adsuibb_idpfg4 atm_adsuiv6g6dd_pt45zb atm_adsuit4h5aw_1wskm3t atm_adsui15xrhy7_pt45zb atm_adsui17yrrpa_16x0t2t atm_adsui6zeuib_15wi45 atm_adsui1jhk75u_1mfz0iu atm_adsui174zlj6_73adwj atm_adsui1tcisp7_glywfm",Jx="atm_adsui4b_1627y59 atm_adsui26_1u3842e atm_adsui7l_1r1dq30 atm_adsuics_1d1fc98 atm_adsuiv6g6dd_1wskm3t atm_adsui168r6ku_8o97w",Wx="atm_adsuivy_alpu0l atm_adsuie2_alpu0l atm_adsuij6_alpu0l atm_adsuilh_idpfg4 atm_adsuilb_idpfg4";function $e({id:e,label:t,iconOnly:r,children:o,disabled:s,hidden:n,pressed:i,current:a,expanded:c,controls:l,popoverTarget:d,section:f,phase:h,variant:g="quiet",onClick:v}){return S("button",{id:e,type:"button",className:me("ds-toolbar-button",Bx,g==="outlined"&&Jx,r&&Wx),"aria-label":r?t:void 0,title:r?t:void 0,disabled:s,hidden:n,"aria-pressed":i,"aria-current":a?"page":void 0,"aria-expanded":c,"aria-controls":l,popovertarget:d,"data-section":f,"data-phase":h,onClick:v,children:[o,!r&&t]})}var Kx="atm_adsui9s_1txwivl atm_adsuiar_1bp4okc atm_adsuih_1h6ojuz atm_adsuifc_1h6ojuz atm_adsuicx_tx1for atm_adsuijb_idpfg4 atm_adsuil8_1lr73f0 atm_adsui3f_e8f45q atm_adsui5j_idpfg4 atm_adsui26_1j28jx2 atm_adsui7l_1mqbmot atm_adsuibx_rhlbdi atm_adsuic8_1m800s6 atm_adsuig3_3szr2b atm_adsuir3_1h6ojuz atm_adsui9j_tlke0l atm_adsuiv6g6dd_pt45zb atm_adsui1qpv5ur_1r1dq30 atm_adsui1p5227w_pt45zb atm_adsui17yrrpa_16x0t2t atm_adsui6zeuib_15wi45 atm_adsui1jhk75u_1mfz0iu atm_adsui174zlj6_73adwj";function Gx({id:e,label:t,pressed:r=!1,disabled:o,children:s,onClick:n}){return S("button",{id:e,type:"button",className:me("ds-toggle-tile",Kx),"aria-pressed":r,disabled:o,onClick:n,children:[s,S("span",{children:t})]})}var Rv={brand:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="M8 1.5 9.9 5.6l4.4.5-3.3 3 .9 4.4L8 11.3l-3.9 2.2.9-4.4-3.3-3 4.4-.5L8 1.5Z"/></svg>',"chevron-left":'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="M10 4l-4 4 4 4"/></svg>',"chevron-right":'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="m6 4 4 4-4 4"/></svg>',"chevron-up":'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="m4 10 4-4 4 4"/></svg>',close:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="m4 4 8 8M12 4l-8 8"/></svg>',components:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="m8 1 6 3.5v7L8 15l-6-3.5v-7L8 1Zm-6 3.5 6 3.5 6-3.5M8 8v7"/></svg>',composition:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="M2 2h4v4H2zM10 2h4v4h-4zM2 10h4v4H2zM10 10h4v4h-4z"/></svg>',drafts:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="M3 1h7l3 3v11H3zM10 1v4h3M5 8h6M5 11h4"/></svg>',"guide-bounds":'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><rect x="2" y="3.5" width="12" height="9"/></svg>',"guide-gaps":'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><rect x="1.5" y="3" width="3.5" height="10"/><rect x="6.25" y="3" width="3.5" height="10"/><rect x="11" y="3" width="3.5" height="10"/></svg>',"guide-margins":'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><rect x="1.5" y="2.5" width="13" height="11" stroke-dasharray="1.5 1.5"/><rect x="4.5" y="5.5" width="7" height="5"/></svg>',"guide-mini":'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="M2 2v12M6 2v12M10 2v12M14 2v12M2 2h12M2 6h12M2 10h12M2 14h12" stroke-width="1"/></svg>',"guide-padding":'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><rect x="1.5" y="2.5" width="13" height="11"/><rect x="4.5" y="5.5" width="7" height="5" stroke-dasharray="1.5 1.5"/></svg>',"guide-tracks":'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="M2.5 2v12M6 2v12M10 2v12M13.5 2v12"/></svg>',icons:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><circle cx="5" cy="5" r="2.5"/><rect x="9.5" y="2.5" width="4" height="5" rx="1"/><path d="m2.5 13.5 2.5-4 2.5 4ZM9.5 11.5h4M11.5 9.5v4"/></svg>',layout:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="M3 2v12M6.5 2v12M9.5 2v12M13 2v12"/></svg>',moon:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="M13.5 9a5.5 5.5 0 0 1-6.5-6.5A5.5 5.5 0 1 0 13.5 9Z"/></svg>',patterns:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><rect x="2" y="2" width="5" height="5"/><rect x="10" y="2" width="4" height="5"/><rect x="2" y="10" width="5" height="4"/><rect x="10" y="10" width="4" height="4"/></svg>',phone:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><rect x="4" y="1" width="8" height="14" rx="1.5"/><path d="M7 12.5h2"/></svg>',pictograms:'<svg fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><rect x="1.5" y="2.5" width="13" height="11" rx="1"/><circle cx="5" cy="6" r="1"/><path d="m2 12 4-3 3 2 3-4 2 2"/></svg>',source:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="m5 4-4 4 4 4m6-8 4 4-4 4M9 2 7 14"/></svg>',split:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><rect x="1" y="2" width="14" height="12" rx="1"/><path d="M8 2v12"/></svg>',sun:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><circle cx="8" cy="8" r="3"/><path d="M8 1v1M8 14v1M1 8h1M14 8h1M3 3l1 1M12 12l1 1M3 13l1-1M12 4l1-1"/></svg>',tokens:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="m8 2 6 3-6 3-6-3 6-3Zm-6 6 6 3 6-3M2 11l6 3 6-3"/></svg>',warning:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="m8 2 7 12H1L8 2Z"/><path d="M8 6v3M8 11v.5"/></svg>'},rv={};Object.keys(Rv).sort();var Yx="atm_adsui9s_116y0ak atm_adsuiam_glywfm atm_adsuih_1h6ojuz atm_adsuifc_1h6ojuz atm_adsuivh_nkobfv atm_adsui7l_1kw7nm4 atm_adsuix4ub3y_1ulexfb atm_adsuivskwj7_1osqo2v atm_adsui158k9f9_1osqo2v",Xx={sm:"atm_adsuivy_1aou828 atm_adsuie2_1aou828",md:"atm_adsuivy_fjcok3 atm_adsuie2_fjcok3",lg:"atm_adsuivy_14k5dlv atm_adsuie2_14k5dlv",xl:"atm_adsuivy_1j39cg3 atm_adsuie2_1j39cg3"};function Oe({name:e,size:t="sm",label:r}){let o=e in rv?rv[e]:e;return S("span",{className:me("ds-icon",Yx,Xx[t]),...r?{role:"img","aria-label":r}:{"aria-hidden":!0},dangerouslySetInnerHTML:{__html:Rv[o]}})}var Qx="atm_adsui9s_1txwivl atm_adsuih_1h6ojuz atm_adsuicx_tx1for atm_adsuij6_1wdkmbo atm_adsuil8_kr1xch atm_adsui3f_e8f45q atm_adsui5j_idpfg4 atm_adsui26_1j28jx2 atm_adsui7l_1wskm3t atm_adsuibx_rhlbdi atm_adsuics_el7ql6 atm_adsuic8_1m800s6 atm_adsuig3_sqnntc atm_adsuird_glywfm atm_adsuikz_fg65tv atm_adsui1e7xapd_1wugsn5 atm_adsui1cc01an_1m800s6 atm_adsuiz89mj4_el7ql6 atm_adsui19izows_1mqbmot atm_adsui1a1iq7z_1q9ccgz atm_adsui18vqbco_pt45zb atm_adsuisrk7fl_pt45zb atm_adsui1dpiaj6_1wskm3t atm_adsuizrwyxp_1d1fc98 atm_adsui17yrrpa_16x0t2t atm_adsui6zeuib_15wi45";function ek({label:e,href:t,current:r,previewState:o,previewLabel:s,draftLabel:n,draftDescription:i,onClick:a}){return S("a",{className:me("ds-navigation-item",Qx),href:t,"aria-current":r?"page":void 0,"aria-description":s,onClick:a,children:[e,n&&S("span",{className:"draft-badge",title:i,children:[" ",n]}),o&&S(kv,{state:o})]})}var tk="atm_adsuimk_1n9t6rb atm_adsuif3_aqos4q atm_adsui73_usvi9m atm_adsuigi_idpfg4 atm_adsuiiy_102o88r atm_adsuiks_1wugsn5 atm_adsuil8_1aqtv8w atm_adsui3f_m9afv7 atm_adsui5j_idpfg4 atm_adsui26_1bplolx atm_adsui7l_1wskm3t atm_adsui70_1fjsgd1 atm_adsuibx_rhlbdi atm_adsuic8_1m800s6 atm_adsuig3_sqnntc atm_adsuiarf92d_1txwivl atm_adsui1qpaa0x_1bp4okc",rk="atm_adsuil8_idpfg4",ok={narrow:"atm_adsuivy_hvzi4f",wide:"atm_adsuivy_1risgsc atm_adsuij3_1y8qh3w"},sk="atm_adsuimk_pfqszd atm_adsuiiy_glywfm atm_adsuij3_1osqo2v";function xv({id:e,label:t,role:r,width:o="narrow",inline:s=!1,flush:n=!1,children:i}){return S("div",{id:e,className:me("ds-popover",tk,ok[o],n&&rk,s&&sk),popover:s?void 0:"auto",role:r,"aria-label":t,children:i})}var nk="atm_adsui9s_116y0ak atm_adsuiam_glywfm atm_adsuih_1h6ojuz atm_adsuifc_1h6ojuz atm_adsuivy_1aou828 atm_adsuie2_1aou828 atm_adsui7l_1mqbmot atm_adsuivskwj7_1osqo2v atm_adsui158k9f9_1osqo2v atm_adsuio2zchm_glywfm atm_adsuibupyu4_1r31cwp atm_adsui91z0ma_c484nn atm_adsuieyuh4p_glywfm atm_adsuis7vg1k_1ulexfb atm_adsui1a7gqnz_glywfm atm_adsui1ypv4g8_glywfm atm_adsuisc4h6w_116y0ak";function kv({state:e="unreported",variant:t="navigation",label:r}){return S("span",{className:me("ds-preview-indicator",t==="navigation"&&"entry-preview",nk),"data-state":e,"data-variant":t,role:r?"img":void 0,"aria-label":r,"aria-hidden":r?void 0:!0,title:r,children:[S("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[S("circle",{"data-mark":"unreported",cx:"8",cy:"8",r:"3"}),S("circle",{"data-mark":"building",cx:"8",cy:"8",r:"5","stroke-dasharray":"22 10"}),S("circle",{"data-mark":"checking",cx:"8",cy:"8",r:"5","stroke-dasharray":"3 3"}),S("circle",{"data-mark":"ready",cx:"8",cy:"8",r:"5"}),S("circle",{"data-mark":"stale",cx:"8",cy:"8",r:"5","stroke-dasharray":"2 3"}),S("circle",{"data-mark":"error",cx:"8",cy:"8",r:"5",fill:"currentColor",stroke:"none"})]}),t==="toolbar"&&S("span",{className:"preview-warning",children:S(Oe,{name:"warning"})})]})}var ik="atm_adsuig1e7fr_1hh10yn atm_adsuina064p_1c8rstr atm_adsuibyi8sh_1d1fc98 atm_adsuit8tn60_1r1dq30 atm_adsui18xy9f7_1txwivl atm_adsui1kvotse_1xi6ry0 atm_adsui13bcc9y_q4j4l1 atm_adsui9ht5kt_1iwn3l9 atm_adsuiw49f19_1m800s6 atm_adsui1mb7f0m_1mqbmot atm_adsui1o7g9kp_sqnntc atm_adsuicsppdr_11p5wf0 atm_adsui156xhju_13mtsfm atm_adsui2uzat_iqvn5y atm_adsuizf04m1_1mfz0iu atm_adsuil2ckyf_1txwivl atm_adsuim3rxq9_1h6ojuz atm_adsuilfeyld_iqvn5y atm_adsuidl3q2m_ynj908 atm_adsui12er3fd_tx1for atm_adsui8e79fz_m9afv7 atm_adsui1qnfl3r_1m800s6 atm_adsui1sj4mjq_1mqbmot atm_adsui6ql2ro_iqvn5y",Dd=[{name:"off",label:"Off",hint:"Guides are hidden. Your layer choice is kept."},{name:"hover",label:"Hover",hint:"Point at or focus an element to see the selected layers."},{name:"always",label:"Always",hint:"Every element shows the selected layers."}],Pv=[{name:"bounds",label:"Bounds"},{name:"tracks",label:"Columns and rows"},{name:"gaps",label:"Gaps and gutters"},{name:"padding",label:"Padding"},{name:"margins",label:"Margins"},{name:"mini",label:"Mini-unit grid"}],Tv=[{name:"spacing",label:"Spacing",layers:["padding","margins","gaps"]},{name:"grid",label:"Grid",layers:["tracks","mini"]},{name:"all",label:"All",layers:["bounds","tracks","gaps","padding","margins","mini"]}];function Ev(e){var t;let r=((t=Tv.find((o)=>o.name===e))==null?void 0:t.layers)??[];return Object.fromEntries(Pv.map((o)=>[o.name,r.includes(o.name)]))}function ak({id:e="grid-options",inline:t=!1,mode:r="off",layers:o={},onModeChange:s,onLayerChange:n,onPreset:i}){var a;let c=(a=Dd.find((l)=>l.name===r))==null?void 0:a.hint;return S(xv,{id:e,label:"Layout guides",role:"dialog",inline:t,children:S("div",{id:`${e}-content`,className:me("ux-guide-options",ik),"data-mode":r,children:[S("h2",{children:"Layout guides"}),S("div",{className:"ux-guide-modes",role:"group","aria-label":"Show guides",children:Dd.map((l)=>S($e,{id:`${e}-mode-${l.name}`,label:l.label,pressed:r===l.name,onClick:()=>s==null?void 0:s(l.name)},l.name))}),S("p",{id:`${e}-hint`,className:"ux-guide-hint","aria-live":"polite",...Object.fromEntries(Dd.map((l)=>[`data-${l.name}`,l.hint])),children:c}),S("div",{className:"ux-guide-layers",role:"group","aria-label":"Layers",children:Pv.map((l)=>S(Gx,{id:`${e}-layer-${l.name}`,label:l.label,pressed:o[l.name]===!0,onClick:()=>n==null?void 0:n(l.name,o[l.name]!==!0),children:S(Oe,{name:`guide-${l.name}`,size:"lg"})},l.name))}),S("div",{className:"ux-guide-presets",role:"group","aria-label":"Presets",children:[S("span",{children:"Presets"}),Tv.map((l)=>S($e,{id:`${e}-preset-${l.name}`,label:l.label,onClick:()=>i==null?void 0:i(l.name)},l.name))]})]})})}var ba,Pe,Zd,ov,Vd=Object.is,Su=0,$v=[],Bd=[],we=le,{__b:sv,__r:nv,diffed:iv,__c:av,unmount:cv,__:uv}=we;function Qd(e,t){we.__h&&we.__h(Pe,e,Su||t),Su=0;var r=Pe.__H||(Pe.__H={__:[],__h:[]});return e>=r.__.length&&r.__.push({}),r.__[e]}function ck(e){return Su=1,uk(Iv,e)}function uk(e,t,r){var o=Qd(ba++,2);if(o.t=e,!o.__c&&(o.__=[Iv(void 0,t),function(n){var i=o.__N?o.__N[0]:o.__[0],a=o.t(i,n);Vd(i,a)||(o.__N=[a,o.__[1]],o.__c.setState({}))}],o.__c=Pe,!Pe.__f)){Pe.__f=!0;var s=Pe.shouldComponentUpdate;Pe.shouldComponentUpdate=function(n,i,a){var c=this.__H;if(!c)return!0;var l=!1,d=this.props!=n;if(c.__.some(function(h){h.__N&&(l=!0,Vd(h.__[0],h.__N[0])||(d=!0))}),s){var f=s.call(this,n,i,a);return l?f||d:f}return!l||d}}return o.__}function lk(e,t){var r=Qd(ba++,4);!we.__s&&Cv(r.__H,t)&&(r.__P=!1,r.__=e,r.u=t,Pe.__h.push(r))}function dk(e){return Su=5,pk(function(){return{current:e}},[])}function pk(e,t){var r=Qd(ba++,7);return Cv(r.__H,t)&&(r.__=e(),r.__H=t),r.__}function mk(){var e;do{for(;e=Bd.shift();)try{va(e)}catch(r){we.__e(r,{__:(e=e.__P)&&e.__v})}for(;e=$v.shift();){var t=e.__H;if(e.__P&&t)try{t.__h.some(va),t.__h.some(Jd),t.__h=[]}catch(r){t.__h=[],we.__e(r,e.__v)}}}while(Bd.length)}we.__b=function(e){Pe=null,sv&&sv(e)},we.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),uv&&uv(e,t)},we.__r=function(e){nv&&nv(e),ba=0;var t=(Pe=e.__c).__H;t&&(Zd==Pe?Pe.__h=[]:(t.__h.some(va),t.__h.some(Jd),ba=0),t.__h=[],t.__.some(function(r){r.__N&&(r.__=r.__N),r.u=r.__N=void 0})),Zd=Pe},we.diffed=function(e){iv&&iv(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&dv($v.push(t)),t.__H.__.some(function(r){r.u&&(r.__H=r.u)})),Zd=Pe=null},we.__c=function(e,t){t.some(function(r){try{r.__h.some(va),r.__h=r.__h.filter(function(o){return!o.__||Jd(o)})}catch(o){t.some(function(s){s.__h&&(s.__h=[])}),t=[],we.__e(o,r.__v)}}),av&&av(e,t)},we.unmount=function(e){cv&&cv(e);var t,r,o=e.__c;o&&o.__H&&(o.__H.__.some(function(s){try{if(s.__P&&s.__c){if(r===void 0){for(r=e.__;r&&(!r.__c||!r.__c.__P);)r=r.__;r=r&&r.__c}s.__P=r,dv(Bd.push(s))}else va(s)}catch(n){t=n}}),o.__H=void 0,t&&we.__e(t,o.__v))};var lv=typeof requestAnimationFrame=="function";function hk(e){var t,r=function(){clearTimeout(o),lv&&cancelAnimationFrame(t),setTimeout(e)},o=setTimeout(r,35);lv&&(t=requestAnimationFrame(r))}function dv(e){e!=1&&ov==we.requestAnimationFrame||((ov=we.requestAnimationFrame)||hk)(mk)}function va(e){var t=Pe,r=e.__c;typeof r=="function"&&(e.__c=void 0,r()),Pe=t}function Jd(e){var t=Pe;e.__c=e.__(),Pe=t}function Cv(e,t){return!e||e.length!=t.length||t.some(function(r,o){return!Vd(r,e[o])})}function Iv(e,t){return typeof t=="function"?t(e):t}var pv="atm_adsuie2_1osqo2v atm_adsuiks_1wugsn5 atm_adsuil8_1ru0ig4 atm_adsuibx_rhlbdi atm_adsuic8_1c8rstr atm_adsuig3_sqnntc atm_adsui7l_an4usv atm_adsui1s9zg6e_idpfg4 atm_adsui1y1itgh_1heflvk atm_adsui124toe7_1d1fc98 atm_adsui1ajpmqv_3szr2b atm_adsuig1e7fr_81zv9y atm_adsuina064p_1ye8rbs atm_adsuibyi8sh_1d1fc98 atm_adsui1t8i83k_1ulexfb atm_adsui1t4u5ad_iqvn5y atm_adsui1ucxlaq_1m800s6 atm_adsuicqysi0_el7ql6 atm_adsuiugp1nr_1mqbmot atm_adsuimzw80z_1txwivl atm_adsuims933x_v2br90 atm_adsuikqzblj_1yb4nlp atm_adsui157qtsd_1doep66 atm_adsuipps9nr_1g80g66 atm_adsui1696orj_6e9m65 atm_adsui1kwsnex_1mqbmot atm_adsui1749l82_1m800s6 atm_adsui1pm6vxp_fg65tv atm_adsui1985805_rhlbdi atm_adsuifgvpx0_1m800s6 atm_adsui1f7jbwv_1wdkmbo atm_adsui4v11ke_13r6pey atm_adsui1ph4l26_kr1xch atm_adsui1td1et_58tz3v atm_adsui16q9e9r_idpfg4 atm_adsui1e1cn77_1u3842e atm_adsui1ok557x_an4usv atm_adsui8oqreq_16x0t2t atm_adsuidogt2j_15wi45 atm_adsui1ha57is_1txwivl atm_adsui154gtli_1g80g66 atm_adsui1m0o9p4_1doep66 atm_adsuitul8sy_116y0ak atm_adsuid9rgyl_1h6ojuz atm_adsui1ew4plt_1h6ojuz atm_adsui44kz9m_tx1for atm_adsui1l2cw9c_116y0ak atm_adsui1p2daoe_glywfm atm_adsui1lrgcs0_1kw7nm4 atm_adsui21ajbm_1ulexfb atm_adsuiv4i7ad_glywfm atm_adsui18exmc6_11p5wf0 atm_adsuinrahr7_14kz4g7 atm_adsui1sapuqh_1ak2vn7 atm_adsuia9snxg_v2br90 atm_adsuic1efku_idpfg4 atm_adsui1s5glk1_1h6ojuz atm_adsui4zbjz7_1txwivl atm_adsui1nrl83w_1h6ojuz atm_adsuidcq6po_1h6ojuz atm_adsuiodevil_1g80g66 atm_adsui15luuzb_tx1for atm_adsuiy20kxr_idpfg4 atm_adsui1pfuy6w_l6f2xw atm_adsuifo0n28_1m800s6 atm_adsui1yka5lj_sqnntc atm_adsuiazx38y_19dj2kj atm_adsuildippw_fg65tv atm_adsui2kz6ah_177qeyn atm_adsui5go7c5_1m800s6 atm_adsui12ii74i_1q4684i atm_adsui1t756hg_1mqbmot atm_adsui1n1nucf_h2mmj6 atm_adsuis5orb_qpi3z3 atm_adsui1maakrc_qpi3z3 atm_adsui3jvufv_6g0xcp atm_adsui1a6bvuq_6lcubb atm_adsui7le0qg_stnw88 atm_adsuikc8k8m_idpfg4 atm_adsui10ojrnp_1le1gz4 atm_adsuimhax7p_moqrwa atm_adsui1eq72d_1txwivl atm_adsuitglio1_1g80g66 atm_adsui1uq2nym_1h6ojuz atm_adsui1g6vde0_esu3gu atm_adsui1lgf0nm_1aqtv8w atm_adsui1e184xh_1txwivl atm_adsuila89rv_1bp4okc atm_adsui3c75k5_1h6ojuz atm_adsuihmh6q_tx1for atm_adsui1gfpqoj_1m800s6 atm_adsui1lezx94_1mqbmot atm_adsui1fnmsk6_b6kj4x atm_adsuip4zrj7_1le1gz4 atm_adsui1lf327s_1m800s6 atm_adsui10hei5o_glywfm atm_adsui11ndfci_12j2sah atm_adsuiewnzgi_1r3tyjr atm_adsuincp59s_19dj2kj atm_adsui5aykc5_ynj908 atm_adsui1z5d1z_1vz6rot atm_adsui1w4ry55_mrub5a atm_adsuinfdfyh_fg65tv atm_adsui1d1ue3r_1mqbmot atm_adsui1m3cqh4_1txwivl atm_adsuijhqbse_1g80g66 atm_adsui1y90xlu_1doep66 atm_adsui1konks8_idpfg4 atm_adsuirgczd9_1txwivl atm_adsui1tv24b1_1h6ojuz atm_adsui1adwpcp_ynj908 atm_adsui61s2ls_1m800s6 atm_adsui7olkud_116y0ak atm_adsuiu2kdnu_tx1for atm_adsuiv7vy6e_qm87f6 atm_adsuin0y7c7_1ivmhas atm_adsui1mpi4sj_1ulexfb atm_adsuit6wwae_1f51e7f",mv="http://www.w3.org/2000/svg";function Hd({item:e,size:t,label:r}){let o=dk(null);return lk(()=>{var s;let n=new DOMParser().parseFromString(e.svg,"image/svg+xml").documentElement;if(n.namespaceURI!==mv||n.localName!=="svg")return;for(let a of n.querySelectorAll("*"))if(["script","foreignObject","iframe","image","a","animate","set","animateTransform","animateMotion"].includes(a.localName)||a.namespaceURI!==mv)a.remove();for(let a of[n,...n.querySelectorAll("*")])for(let c of Array.from(a.attributes))if(/^on/i.test(c.name)||/href$/i.test(c.name)&&!c.value.trim().startsWith("#"))a.removeAttribute(c.name);let i=document.importNode(n,!0);return i.removeAttribute("class"),i.setAttribute("width",String(t)),i.setAttribute("height",String(t)),i.setAttribute("aria-hidden","true"),i.setAttribute("focusable","false"),(s=o.current)==null||s.replaceChildren(i),()=>{var a;return(a=o.current)==null?void 0:a.replaceChildren()}},[e.svg,t]),S("span",{className:"icons-glyph",ref:o,role:r?"img":void 0,"aria-label":r,title:r,"aria-hidden":r?void 0:"true"})}function hv({finding:e}){return S("p",{className:"icons-finding",title:e.file,children:[S("strong",{children:e.rule})," ",e.message]})}function fk({data:e}){var t;let[r,o]=ck("");if(!e.configured)return S("section",{className:me("icons-view",pv),"aria-label":"Icons",children:[S("h1",{children:"Icons"}),S("p",{className:"icons-summary",children:"The project configures no glyph set."})]});let s=e.glyphs.filter((n)=>[n.name,...n.aliases].some((i)=>i.toLowerCase().includes(r.trim().toLowerCase())));return S("section",{className:me("icons-view",pv),"aria-label":"Icons",children:[S("div",{className:"icons-head",children:[S("div",{children:[S("h1",{children:"Icons"}),S("p",{className:"icons-summary",children:[e.source," · ",e.glyphs.length," glyphs",e.grid?` · ${e.grid.width} × ${e.grid.height} grid`:e.mixed?" · Mixed grids":""," · ",e.aliasCount," aliases"]})]}),S("input",{type:"search",value:r,onInput:(n)=>o(n.currentTarget.value),placeholder:"Search name or alias","aria-label":"Search glyphs by name or alias"})]}),e.findings.map((n,i)=>S(hv,{finding:n},i)),S("h2",{children:["The set",S("small",{children:["Every glyph at ",((t=e.textSize)==null?void 0:t.px)??16,"px, the size used beside text"]})]}),S("div",{className:"icons-set",role:"list","aria-label":"The set",children:s.map((n)=>{var i;return S("span",{className:"icons-set-item","data-glyph":n.name,role:"listitem",children:S(Hd,{item:n,size:((i=e.textSize)==null?void 0:i.px)??16,label:n.name})},n.name)})}),S("h2",{children:["Glyphs",S("small",{children:"Enlarged construction grid and actual icon sizes"})]}),!s.length&&S("p",{className:"icons-empty",children:e.glyphs.length?`No glyph matches “${r.trim()}”.`:"No glyphs in this set."}),S("div",{className:"icons-cards",children:s.map((n)=>S("article",{className:"icons-card","data-glyph":n.name,"data-findings":n.findings.length||void 0,"aria-label":n.name,children:[S("div",{className:"icons-card-head",children:[S("h3",{children:n.name}),n.findings.length>0&&S("span",{className:"icons-badge",children:[n.findings.length," ",n.findings.every((i)=>i.severity==="error")?"error":"issue",n.findings.length===1?"":"s"]})]}),S("p",{className:"icons-alias",children:n.aliases.length?`alias: ${n.aliases.join(", ")}`:""}),S("div",{className:"icons-mag",children:[n.grid&&S(Lx,{box:n.grid,overlay:!0}),S(Hd,{item:n,size:96})]}),S("div",{className:"icons-sizes",children:e.sizes.map((i)=>S("span",{className:"icons-size",children:[S(Hd,{item:n,size:i.px}),S("small",{title:i.token,children:i.px})]},i.token))}),n.findings.map((i,a)=>S(hv,{finding:i},a))]},n.name))}),e.logos&&S(er,{children:[S("h2",{children:["Other products’ logos",S("small",{children:e.logos.source})]}),S("div",{className:"icons-logos",children:e.logos.files.map((n)=>S("figure",{className:"icons-logo","data-logo":n.name,children:n.tooLarge?S("figcaption",{children:[n.name," (over 1 MB; not shown)"]}):S(er,{children:[S("span",{className:"icons-logo-tile",children:S("img",{src:n.src,alt:n.name,title:n.file,width:24,height:24,loading:"lazy",decoding:"async"})}),S("span",{className:"icons-logo-tile icons-logo-tile-black",children:S("img",{src:n.src,alt:"",width:24,height:24,loading:"lazy",decoding:"async"})}),S("figcaption",{children:n.name})]})},n.name))})]})]})}var _k="atm_adsui9s_1txwivl atm_adsuiar_1bp4okc atm_adsuicx_idpfg4 atm_adsuijb_idpfg4",gk="atm_adsuijb_idpfg4 atm_adsui1pqo7b0_1txwivl atm_adsuiywbgd0_1h6ojuz atm_adsui1a6nw8z_tx1for atm_adsui1vu1bue_kr1xch atm_adsuiyzr3rh_1wdkmbo atm_adsuila54r4_glywfm atm_adsui10x1lus_tlke0l atm_adsui107eb71_1m800s6 atm_adsuir3v91m_1d1fc98 atm_adsui3vd9bk_1wskm3t atm_adsui1pvchle_glywfm atm_adsui93k5wf_1aou828 atm_adsui1jhtvjp_1aou828 atm_adsuixwcn1n_glywfm atm_adsuiaxt0xi_1r31cwp atm_adsuiu9ecgn_c484nn atm_adsui1rd1yp5_glywfm atm_adsuir4atoz_14w8a5s atm_adsuikwnb5l_16x0t2t atm_adsui1b3ry6x_xrd58z atm_adsui9abqyk_1txwivl atm_adsui152ylkv_1bp4okc atm_adsui4nxdgq_idpfg4 atm_adsui1jf9b6q_1aqtv8w";function Sk({id:e,label:t,children:r}){return S("nav",{id:e,className:me("ux-navigation-menu",_k),"aria-label":t,children:r})}function vk({label:e,open:t=!0,children:r}){return S("details",{className:me("entry-group",gk),open:t,children:[S("summary",{children:[S(Oe,{name:"chevron-right"}),S("span",{children:e})]}),S("div",{role:"group","aria-label":e,"data-slot":"entries",children:r})]})}var bk="atm_adsui9s_116y0ak atm_adsuih_1h6ojuz",yk="atm_adsui9s_1txwivl atm_adsuiar_1bp4okc atm_adsuij6_idpfg4 atm_adsuiam_kb7nvz atm_adsui1swzw65_glywfm atm_adsui1n6gq6x_idpfg4 atm_adsui1ew16gs_fg65tv atm_adsuilt2xkg_1txwivl atm_adsuicvgua_1bp4okc atm_adsuiibt2oz_idpfg4 atm_adsui13rscvo_kb7nvz atm_adsuifaj8v5_1txwivl atm_adsui1x9f3se_1h6ojuz atm_adsui7ff47s_1aqtv8w atm_adsui19ywhw4_5z7wz8 atm_adsuik8mrq7_m9afv7 atm_adsuitx6td0_glywfm atm_adsui24gkm1_kb7nvz atm_adsuibo9v2x_1mqbmot atm_adsuiof0hc7_1wugsn5",wk="atm_adsui9s_1txwivl atm_adsuiar_1bp4okc atm_adsuij6_idpfg4 atm_adsuiam_kb7nvz atm_adsui1n6gq6x_idpfg4 atm_adsui1ew16gs_fg65tv atm_adsui18hfcpa_5z7wz8 atm_adsui15kvw8j_1d1fc98 atm_adsuiput1jn_1r1dq30 atm_adsuiwst7e9_tx1for atm_adsuidds7x8_el7ql6 atm_adsuilhyqxr_1mqbmot atm_adsui10yw2xd_idpfg4 atm_adsui1womkjg_idpfg4 atm_adsui108aoln_glywfm atm_adsuirdnh25_1wugsn5 atm_adsuiiq3m8p_m9afv7 atm_adsui17tjeyp_5z7wz8 atm_adsui1s7p0pk_m9afv7 atm_adsuiq065rl_idpfg4 atm_adsui132u42p_1txwivl atm_adsuiy4slwo_1g80g66 atm_adsui41lbvx_1q9ycp6 atm_adsui1gu70gy_4baac9 atm_adsui3ffk06_iqvn5y atm_adsuiy5406h_l6f2xw atm_adsui1t4fsou_10of7rf atm_adsui1kdkncg_1mqbmot atm_adsuizdczfh_fg65tv atm_adsui1fkhvt8_1k2i9i8 atm_adsui1jjfms9_m9afv7 atm_adsuixcw6qj_l6f2xw atm_adsui1l7l6jv_10of7rf atm_adsui1n2a233_1wskm3t atm_adsui1gqwc3l_1r1dq30 atm_adsui1sox6pi_iqvn5y atm_adsuib4u3xt_1mqbmot atm_adsui14bm868_tlke0l atm_adsuiix7db5_1risgsc atm_adsui6nxdxv_16x0t2t atm_adsui1ouftwa_15wi45 atm_adsui1spa2l4_iqvn5y atm_adsui10ldf3v_ofj6oc atm_adsui167gjxu_1mqbmot";function zk(e){let[t="",...r]=e.split(`
120
+ `),o=/^(.+?\.)\s+(.+)$/.exec(t),s=o?o[1]:t,n=[],i=[];for(let a of[...o?[o[2]]:[],...r].map((c)=>c.trim()).filter(Boolean)){let c=/^(\S+?:\d+(?::\d+)?|[\w./-]+\.\w+):\s+(?:([a-z][a-z0-9-]*):\s+)?(.+)$/.exec(a);if(!c){i.push(a);continue}let l=c[3],d=/^(.+?[.!?])\s+(.+)$/.exec(l);n.push({location:c[1],rule:c[2],summary:d?d[1]:l,detail:d==null?void 0:d[2]})}return{title:s,problems:n,notes:i}}function qv({message:e}){let{title:t,problems:r,notes:o}=zk(e);return S("div",{className:me("ux-status-content",wk),children:[S("p",{className:"ux-status-title",children:[t,r.length>1&&S("span",{className:"ux-status-count",children:[r.length," problems"]})]}),r.length>0&&S("ul",{className:"ux-status-problems",children:r.map((s,n)=>S("li",{className:"ux-status-problem",children:[S("div",{className:"ux-status-where",children:[s.location&&S("span",{className:"ux-status-file",children:s.location}),s.rule&&S("span",{className:"ux-status-rule",children:s.rule})]}),S("p",{className:"ux-status-summary",children:s.summary}),s.detail&&S("details",{children:[S("summary",{children:"Why and how to fix"}),S("p",{children:s.detail})]})]},n))}),o.map((s,n)=>S("p",{className:"ux-status-note",children:s},n))]})}function Rk({idPrefix:e="",phase:t="ready",message:r="Preview is up to date.",warmup:o,onRetry:s}){let n=(i)=>e+i;return S("div",{className:me("ux-preview-status",bk),children:[S($e,{id:n("preview-status"),label:`Preview status: ${r.split(`
121
+ `)[0]}`,phase:t,iconOnly:!0,popoverTarget:n("status-details"),children:S(kv,{variant:"toolbar",state:t==="reloading"?"building":t})}),S(xv,{id:n("status-details"),width:"wide",flush:!0,children:S("div",{className:me("ux-status-details",yk),children:[S("div",{id:n("status"),className:"ux-status-message",role:t==="error"?"alert":"status",children:S(qv,{message:r})}),S("div",{className:"ux-status-footer",children:[S("p",{id:n("warmup-status"),className:"ux-status-warmup",hidden:!o,children:o}),S("div",{id:n("preview-error"),className:"preview-retry",hidden:t!=="error",children:S($e,{id:n("retry-preview"),label:"Retry preview",variant:"outlined",onClick:s})})]})]})})]})}var xk="atm_adsuijb_idpfg4 atm_adsuij6_1osqo2v atm_adsuil8_1ru0ig4 atm_adsui7l_an4usv atm_adsuibx_rhlbdi atm_adsuic8_1c8rstr atm_adsuig3_sqnntc atm_adsui3z5xaq_d3l4uo atm_adsui1wgjgno_idpfg4 atm_adsuip5t3iw_glywfm atm_adsuixo4njo_uqc78k atm_adsui5o4a8h_rfutky atm_adsui1fodpaq_1g68hxi atm_adsuiw6dnwv_1j28jx2 atm_adsuigj0umz_1ru0ig4 atm_adsui12f0w6t_1txwivl atm_adsui1gdpbuc_1g80g66 atm_adsuiuqbam3_1h6ojuz atm_adsuio8ubsb_1aqtv8w atm_adsui5ug4ic_1wdkmbo atm_adsui1w6vi1x_13r6pey atm_adsuiz9prp4_kr1xch atm_adsuiwdfvbd_m9afv7 atm_adsui13fkfdg_idpfg4 atm_adsui1do7trk_1j28jx2 atm_adsui1rlis1a_an4usv atm_adsuizf9kzn_rhlbdi atm_adsuii5gv9h_1m800s6 atm_adsuindj6xq_16x0t2t atm_adsuitdd4i9_15wi45 atm_adsui11chkp6_irm9pb atm_adsui10tyobk_1heflvk atm_adsui1h392tq_3szr2b atm_adsuiatrpru_1d1fc98 atm_adsuiwv6oyq_1r1dq30 atm_adsui1wjk0g8_6e9m65 atm_adsui1bmpb92_cpeews atm_adsui1lgjzhx_1m800s6 atm_adsuijzdzyy_1mqbmot";function kk({title:e,description:t,onSearch:r,children:o}){return S("section",{className:me("ux-specimen-page",xk),"aria-label":e,children:[S("header",{children:[S("div",{className:"ux-specimen-heading",children:[S("h1",{children:e}),r&&S("input",{type:"search","aria-label":"Find token",placeholder:"Find a token",onInput:(s)=>r(s.currentTarget.value)})]}),t&&S("p",{children:t})]}),S("div",{"data-slot":"content",children:o})]})}var Ov="atm_adsuij7_idpfg4 atm_adsui9s_11p5wf0 atm_adsuin5_idpfg4 atm_adsui84_idpfg4 atm_adsuidz_1y3gjcq atm_adsuigw_1gem2g7 atm_adsuiiz_glywfm atm_adsuimrwrxb_1210cad atm_adsui165a258_idpfg4 atm_adsuindcbtc_idpfg4 atm_adsui1ywdvs7_idpfg4 atm_adsui7bg9zp_107lskt atm_adsuiqjzyof_idpfg4 atm_adsui15n9hsn_idpfg4 atm_adsuigpq1w8_idpfg4 atm_adsui1ts7i44_1gr7bv3 atm_adsui1xz6qul_1gem2g7 atm_adsui1pqqic1_glywfm atm_adsuilz7qdd_6s8zn8 atm_adsui134y5xe_1ncjpb7 atm_adsui1nznzd5_1gr7bv3 atm_adsuiom2ku1_1gem2g7 atm_adsui9o08mg_glywfm atm_adsui1iqqh5c_6s8zn8 atm_adsui1j124uw_1ncjpb7 atm_adsui1qgxgro_1gr7bv3 atm_adsui1ol26gk_1gem2g7 atm_adsuifnju3y_glywfm atm_adsui8dg1eh_6s8zn8 atm_adsui1t5abo5_1ncjpb7 atm_adsui1pcy8k9_1gr7bv3 atm_adsuiuzkx18_1gem2g7 atm_adsui1s22a1g_glywfm atm_adsuiv4wfzc_6s8zn8 atm_adsuiln2feu_1ncjpb7",Nv="atm_adsuij7_idpfg4 atm_adsui9s_11p5wf0 atm_adsuin5_idpfg4 atm_adsui84_idpfg4 atm_adsuidz_kyo2w3 atm_adsuigw_1gem2g7 atm_adsuiiz_glywfm atm_adsuimrwrxb_6s8zn8 atm_adsui165a258_idpfg4 atm_adsuindcbtc_idpfg4 atm_adsui1ywdvs7_idpfg4 atm_adsui7bg9zp_h3ouum atm_adsuiqjzyof_idpfg4 atm_adsui15n9hsn_idpfg4 atm_adsuigpq1w8_idpfg4 atm_adsui1ts7i44_kyo2w3 atm_adsui1xz6qul_1gem2g7 atm_adsui1pqqic1_glywfm atm_adsuilz7qdd_6s8zn8 atm_adsui134y5xe_h3ouum atm_adsui1nznzd5_kyo2w3 atm_adsuiom2ku1_1gem2g7 atm_adsui9o08mg_glywfm atm_adsui1iqqh5c_6s8zn8 atm_adsui1j124uw_h3ouum atm_adsui1qgxgro_kyo2w3 atm_adsui1ol26gk_1gem2g7 atm_adsuifnju3y_glywfm atm_adsui8dg1eh_6s8zn8 atm_adsui1t5abo5_h3ouum atm_adsui1pcy8k9_kyo2w3 atm_adsuiuzkx18_1gem2g7 atm_adsui1s22a1g_glywfm atm_adsuiv4wfzc_6s8zn8 atm_adsuiln2feu_h3ouum",jv="atm_adsuij7_idpfg4 atm_adsui9s_11p5wf0 atm_adsuin5_idpfg4 atm_adsui84_idpfg4 atm_adsuidz_1y3gjcq atm_adsuigw_1gem2g7 atm_adsuiiz_glywfm atm_adsui1xr9v27_1210cad atm_adsuif3wayr_idpfg4 atm_adsuimgqw9w_idpfg4 atm_adsui8iopdn_idpfg4 atm_adsuix9z4xg_107lskt atm_adsui1wohlm_idpfg4 atm_adsuiu9g1y7_idpfg4 atm_adsui1orm0qo_idpfg4 atm_adsuiskdtbx_15wbn57 atm_adsuip945hm_1pzsloo atm_adsui1ts7i44_1gr7bv3 atm_adsui1xz6qul_1gem2g7 atm_adsui1pqqic1_glywfm atm_adsuizryume_6s8zn8 atm_adsui1ngmxnq_1ncjpb7 atm_adsui1nznzd5_1gr7bv3 atm_adsuiom2ku1_1gem2g7 atm_adsui9o08mg_glywfm atm_adsuin783i1_6s8zn8 atm_adsui1l75c4v_1ncjpb7 atm_adsui1qgxgro_1gr7bv3 atm_adsui1ol26gk_1gem2g7 atm_adsuifnju3y_glywfm atm_adsui1i44mqh_6s8zn8 atm_adsuivsouqh_1ncjpb7 atm_adsui1pcy8k9_1gr7bv3 atm_adsuiuzkx18_1gem2g7 atm_adsui1s22a1g_glywfm atm_adsuiehc6gd_6s8zn8 atm_adsuittpjm6_1ncjpb7",Mv="atm_adsuij7_idpfg4 atm_adsui9s_11p5wf0 atm_adsuin5_idpfg4 atm_adsui84_idpfg4 atm_adsuidz_dk28gj atm_adsuigw_1gem2g7 atm_adsuiiz_glywfm atm_adsui1xr9v27_6s8zn8 atm_adsuif3wayr_idpfg4 atm_adsuimgqw9w_idpfg4 atm_adsui8iopdn_idpfg4 atm_adsuix9z4xg_h3ouum atm_adsui1wohlm_idpfg4 atm_adsuiu9g1y7_idpfg4 atm_adsui1orm0qo_idpfg4 atm_adsuiskdtbx_15wbn57 atm_adsuip945hm_1pzsloo atm_adsui1ts7i44_dk28gj atm_adsui1xz6qul_1gem2g7 atm_adsui1pqqic1_glywfm atm_adsuizryume_6s8zn8 atm_adsui1ngmxnq_h3ouum atm_adsui1nznzd5_dk28gj atm_adsuiom2ku1_1gem2g7 atm_adsui9o08mg_glywfm atm_adsuin783i1_6s8zn8 atm_adsui1l75c4v_h3ouum atm_adsui1qgxgro_dk28gj atm_adsui1ol26gk_1gem2g7 atm_adsuifnju3y_glywfm atm_adsui1i44mqh_6s8zn8 atm_adsuivsouqh_h3ouum atm_adsui1pcy8k9_dk28gj atm_adsuiuzkx18_1gem2g7 atm_adsui1s22a1g_glywfm atm_adsuiehc6gd_6s8zn8 atm_adsuittpjm6_h3ouum",Pk="atm_adsui9s_116y0ak atm_adsuiar_vrvcex atm_adsuih_1h6ojuz atm_adsui1xk5jbi_1aou828 atm_adsui15ztyo3_1wugsn5 atm_adsuiya8ym_12336oc atm_adsuiou0xue_1h6ojuz atm_adsuip2cq0w_idpfg4 atm_adsui3y46a7_pfqszd atm_adsui1e8hxr8_1f51e7f atm_adsui1w4yjon_1wugsn5 atm_adsui1fm6vu0_1aou828 atm_adsuieb1l7_1wugsn5 atm_adsuiu4pov9_1f51e7f atm_adsuibd751w_1wugsn5 atm_adsuip12vv8_1aou828 atm_adsui119azkn_1wugsn5 atm_adsuidutd7r_1f51e7f atm_adsuivm5w66_1wugsn5 atm_adsui7msh7_116y0ak atm_adsuijq6hmp_1q9ycp6 atm_adsuiqu4bbn_1h6ojuz atm_adsui1450k7n_1ulexfb atm_adsui7bxzlg_h68d5v atm_adsuin2zkk7_24x154 atm_adsuicx_tx1for atm_adsuijb_idpfg4";function Av(e=!1,t=!1){return{header:me("ux-workspace-header",e?Nv:Ov),main:me("ux-workspace-main",e||t?Mv:jv)}}var Tk="atm_adsui9s_1txwivl atm_adsuiar_1bp4okc atm_adsuivy_1osqo2v atm_adsuie2_1osqo2v atm_adsuij6_idpfg4 atm_adsui26_1bplolx atm_adsui7l_1wskm3t atm_adsuibx_rhlbdi atm_adsuic8_1m800s6 atm_adsuig3_sqnntc atm_adsui1swzw65_glywfm atm_adsuitwidkn_1eorbtc atm_adsui9sygfm_idpfg4 atm_adsui12bw0u4_10rgqv3 atm_adsuilgsf2q_1bplolx atm_adsui1czrkxg_m9afv7 atm_adsui1xxn05p_1txwivl atm_adsuijvq3zr_tx1for atm_adsui192tkol_1h6ojuz atm_adsui1uphbw0_1aqtv8w atm_adsui18j3xf2_1txwivl atm_adsuiv4kl24_1fhbwtr atm_adsui7tg88j_116y0ak atm_adsui3hsxdi_116y0ak atm_adsuiw4isa_1q9ycp6 atm_adsui1e372br_tx1for atm_adsuiol208p_idpfg4 atm_adsui1hwqkvt_14k5dlv atm_adsui1brizz9_1d1fc98 atm_adsui1qytvf8_1r1dq30 atm_adsui1i52crn_idpfg4 atm_adsui1rva9te_15vqwwr atm_adsui1ux9w3e_1l2sidv atm_adsui16phkqt_1q9ccgz atm_adsui11e3yb3_1wugsn5 atm_adsui121hswv_1txwivl atm_adsuikokisn_iqvn5y atm_adsui1xmdvl_1h6ojuz atm_adsuidgi0se_idpfg4 atm_adsui1106ncu_1wugsn5 atm_adsuiu6bb7r_tx1for atm_adsui1nngew9_1txwivl atm_adsui1hijnjn_1h6ojuz atm_adsui14yqywo_idpfg4 atm_adsui1n3v6f3_1wugsn5 atm_adsuibmhjpv_tx1for atm_adsuitwhtux_idpfg4 atm_adsui1t7jlm4_kb7nvz atm_adsuigr19py_idpfg4 atm_adsui1r3dd4x_1txwivl atm_adsui1dr8vx7_1bp4okc atm_adsui12n32ac_idpfg4 atm_adsui15x0kgb_m9afv7 atm_adsuixqxvxy_15vqwwr atm_adsuivq6bgu_ynj908 atm_adsui1o135n7_1bplolx atm_adsui7r55s8_kb7nvz atm_adsuiwklih5_idpfg4 atm_adsuixjj1j1_1wugsn5 atm_adsuirae8ic_1txwivl atm_adsui16ywoy7_kb7nvz atm_adsui3zzzu1_1bp4okc atm_adsuioe3i46_idpfg4 atm_adsuigjcmck_h2mmj6 atm_adsui16iisfr_15vqwwr atm_adsui1jwmmnn_idpfg4 atm_adsuiobixd9_kb7nvz atm_adsui1bb1xke_idpfg4 atm_adsuivnahyn_idpfg4 atm_adsui1xr98ve_1bgihbq atm_adsui18tesp1_1ulexfb atm_adsui3im4ne_idpfg4 atm_adsui3aiucy_1osqo2v atm_adsui1rjdu20_1osqo2v atm_adsuitmy5t6_1txwivl atm_adsui1dgldxt_esu3gu atm_adsui1ggjjzu_iqvn5y atm_adsui138t24g_4baac9 atm_adsui1qnyawd_m9afv7 atm_adsui4v0vbm_1bplolx atm_adsui1jhz6h2_glywfm atm_adsui1chybqy_stnw88 atm_adsui1br56z7_idpfg4 atm_adsui888a6e_o2ms3 atm_adsui1xuvgmd_11p5wf0 atm_adsuirxsuh_1h6ojuz atm_adsui1mqap2g_1bplolx atm_adsui1xhqumc_14k5dlv atm_adsuirc18cp_14k5dlv atm_adsuirrx08l_moeofi atm_adsuiey7ewl_nqa18y atm_adsuigux95j_7uy8cq atm_adsui1fe4k5a_12j2sah atm_adsuig4uoah_1v7nmpu atm_adsui11rdqaw_1wdkmbo atm_adsui18vvlvy_19uah5m atm_adsui1cw8iwc_dcxj7s atm_adsui1x2b1m8_1kw7nm4 atm_adsuitbv4yw_1bplolx atm_adsuizgbt4v_1wskm3t atm_adsui17eejsz_m9afv7 atm_adsuid87q3_idpfg4 atm_adsuitcdkhm_glywfm atm_adsui1xeiopu_1h6ojuz atm_adsui1ggp9a3_idpfg4 atm_adsui1k34kje_glywfm atm_adsui1gdfntm_idpfg4 atm_adsuiz1ci95_1knmvda atm_adsuiiqm1lt_1wugsn5 atm_adsuiez3a21_15vqwwr atm_adsui8ru30r_glywfm atm_adsui1b3wxlc_1osqo2v atm_adsui129m0mj_11p5wf0 atm_adsui5w99fc_cmo227 atm_adsuirt32k7_idpfg4 atm_adsui1bb439o_1uq4mm2 atm_adsui1azndq0_1txwivl atm_adsui1ef74b0_1bp4okc atm_adsui1r8nml_idpfg4 atm_adsui1oioy44_idpfg4 atm_adsui4s98mp_m9afv7 atm_adsuipkg9do_1m800s6 atm_adsui805znv_19dj2kj atm_adsui1uyulxv_8p4f3e atm_adsuiwjjjyp_idpfg4 atm_adsuii2eazt_m9afv7 atm_adsui1gx3q7f_kb7nvz atm_adsui1adcp8o_idpfg4 atm_adsui3micw4_1txwivl atm_adsui1q69jt1_1h6ojuz atm_adsui12dg9uo_1osqo2v atm_adsuia71lpn_1knmvda atm_adsuim1gh36_glywfm atm_adsui10vojm5_glywfm";function Ek({loading:e=!1,collapsed:t=!1,capture:r=!1,brand:o,sections:s,actions:n,navigation:i,overlays:a,previewOverlay:c,previewTools:l,children:d}){return S("div",{id:"workspace","data-loading":e,"data-collapsed":t,"data-capture":r,"aria-busy":e,className:me("ux-workspace",Tk),children:[S("header",{id:"header",className:me("ux-workspace-header",t?Nv:Ov),children:[S("div",{id:"brand",className:"ux-workspace-brand",children:o}),S("div",{className:"ux-workspace-bar",children:[S("nav",{id:"sections",className:"ux-workspace-sections","aria-label":"Showcase sections",children:s}),S("div",{className:"ux-workspace-actions",children:n})]})]}),a,S("main",{className:me("ux-workspace-main",t||r?Mv:jv),children:[S("aside",{id:"sidebar",className:"ux-workspace-sidebar",children:i}),S("section",{id:"preview-workspace",className:"ux-workspace-content","aria-label":"Preview workspace",children:S("section",{id:"preview",className:"ux-workspace-preview","aria-label":"Preview",children:[c,l&&S("div",{className:"ux-workspace-preview-tools",role:"toolbar","aria-label":"Preview tools",children:l}),S("div",{id:"frame-slot",className:"ux-workspace-slot",children:d})]})})]})]})}function $k({title:e="Design system",loading:t=!1,section:r="tokens",previewStatus:o,guidesAvailable:s=!1,guideOptions:n,navigation:i,children:a}){return S(Ek,{loading:t,brand:S(er,{children:[S("span",{className:me("ux-workspace-name",Pk),children:[S("span",{className:"ux-workspace-logo",children:S(Vx,{})}),S("span",{className:"ux-workspace-name-text",children:[S("span",{className:"ux-workspace-mark",children:"ADS"}),S("span",{id:"title",className:"ux-workspace-title",children:e})]})]}),S($e,{id:"pane-toggle",label:"Hide navigation pane",iconOnly:!0,expanded:!0,controls:"sidebar",children:S(Oe,{name:"chevron-left"})})]}),sections:S(er,{children:[S($e,{label:"Brand",section:"brand",current:r==="brand",children:S(Oe,{name:"brand"})}),S($e,{label:"Icons",section:"icons",current:r==="icons",children:S(Oe,{name:"icons"})}),S($e,{label:"Pictograms",section:"pictograms",current:r==="pictograms",children:S(Oe,{name:"pictograms"})}),S($e,{label:"Tokens",section:"tokens",current:r==="tokens",children:S(Oe,{name:"tokens"})}),S($e,{label:"Components",section:"components",current:r==="components",children:S(Oe,{name:"components"})}),S($e,{label:"Patterns",section:"patterns",current:r==="patterns",children:S(Oe,{name:"patterns"})}),S($e,{label:"Composition",section:"composition",current:r==="composition",children:S(Oe,{name:"composition"})}),S($e,{label:"Drafts",section:"drafts",current:r==="drafts",children:S(Oe,{name:"drafts"})})]}),actions:S(er,{children:[S(Rk,{...o}),S($e,{id:"viewport",label:"Phone viewport",iconOnly:!0,pressed:!1,controls:"frame-slot",children:S(Oe,{name:"phone"})}),S($e,{id:"grid-overlay",label:"Layout guides",iconOnly:!0,controls:"grid-options",popoverTarget:"grid-options",hidden:!s,children:S(Oe,{name:"layout"})}),S("select",{id:"brand-select",className:"ux-workspace-brand-select","aria-label":"Preview brand",hidden:!0}),S($e,{id:"theme",label:"Use dark theme",iconOnly:!0,children:S(Oe,{name:"moon"})}),S($e,{id:"minimize",label:"Minimize showcase menu",iconOnly:!0,children:S(Oe,{name:"chevron-up"})})]}),overlays:S(ak,{...n}),navigation:S(Sk,{id:"entries",label:"Entries",children:i}),previewTools:S($e,{id:"split-view",label:"Split view",iconOnly:!0,pressed:!1,disabled:!0,hidden:!0,children:S(Oe,{name:"split"})}),previewOverlay:S("div",{id:"loader",className:"ux-workspace-loader",role:"status","aria-label":"Loading preview",hidden:!0,children:S("span",{className:"ux-workspace-spinner","aria-hidden":"true"})}),children:a})}function ep(e,t){let r=document.createElement("div");return vo(S(e,{...t}),r),r.firstElementChild}function Lv(e){return vo(S($k,{title:"",loading:!0}),e),()=>vo(null,e)}var Uv=(e)=>ep(vk,e),Dv=(e)=>ep(ek,e),Zv=(e)=>ep(kk,e);var ya=new WeakMap;function vu(e){let t=ya.get(e);return!!t&&t.parentNode===e&&!!t.firstElementChild}function tp(e,t){let r=ya.get(e);if(!r||r.parentNode!==e){if(r)vo(null,r);r=document.createElement("div"),r.className="ux-icons-mount",ya.set(e,r),e.replaceChildren(r)}return vo(S(fk,{data:t}),r),r.firstElementChild}function rp(e){let t=ya.get(e);if(!t)return;vo(null,t),t.remove(),ya.delete(e)}function Hv(e,t){vo(S(qv,{message:t}),e)}var bu="ads://project/icons";Lv(document.getElementById("app"));var E=(e)=>document.getElementById(e),Ke=new URLSearchParams(location.search),Fv=Ke.get("scenario"),Ck=["brand","icons","pictograms","tokens","components","patterns","composition","drafts"],zu=!1,yo=[],ze,wo=Ke.get("draft"),up=[],Jv=[],lp=new Map,Tr=Ke.get("split")==="1",np,Ut=[],Lt=0,Pu;async function ka(){let e=Ut;Ut=[],await Promise.allSettled(e.map((t)=>t.close()))}var ks=E("split-view"),G="brand",Ce={},Vv=new Map,Rs=!0,Tu=[],Cs=[],Eu=[],ut,qs,Re,_e,xs,za,Ts,Ru,Ps,ot=0,Es=Ke.get("capture")!=="1"&&Ke.get("viewport")==="phone",lt=[{name:"light",scheme:"light"},{name:"dark",scheme:"dark"}],Er=Ke.get("capture")==="1"&&Ke.get("theme")||"light";if(Ke.get("capture")==="1")E("workspace").dataset.capture="true",lb();var ip=()=>lt.find((e)=>e.name===Er)?.scheme??"light";function Wv(){document.documentElement.dataset.theme=ip();let e=lt[(lt.findIndex((r)=>r.name===Er)+1)%lt.length],t=lt.length>1?`Use ${e.name} theme`:`Theme: ${Er}`;E("theme").setAttribute("aria-label",t),E("theme").title=t,E("theme").disabled=lt.length<2,E("theme").querySelector("svg").innerHTML=ip()==="dark"?'<circle cx="8" cy="8" r="3"/><path d="M8 1v1M8 14v1M1 8h1M14 8h1M3 3l1 1M12 12l1 1M3 13l1-1M12 4l1-1"/>':'<path d="M13.5 9a5.5 5.5 0 0 1-6.5-6.5A5.5 5.5 0 1 0 13.5 9Z"/>'}document.documentElement.dataset.theme="light";var bo=[],rr=Ke.get("capture")==="1"&&Ke.get("brand")||null;function Kv(){let e=E("brand-select");if(e.hidden=!bo.length,e.options.length!==bo.length||bo.some((t,r)=>e.options[r].value!==t.name))e.replaceChildren(...bo.map((t)=>Object.assign(document.createElement("option"),{value:t.name,textContent:t.name})));if(rr)e.value=rr,e.title=`Brand: ${rr}`}var $u=HS(async(e)=>{if(e)await _p();await Dt(),await ub()},{onError:st}),ap,Pa=!1,Is=!1,dp=!1,kr,tr,op=0,wa,xr=!1,zo=new AbortController;window.addEventListener("blur",()=>setTimeout(()=>{if(document.activeElement?.tagName==="IFRAME")for(let e of document.querySelectorAll(":popover-open"))e.hidePopover()},0));var dt=LS(),Gv=(e,t={},r={})=>dt.callTool({name:e,arguments:t},{signal:zo.signal,...r}),xu=ZS((e)=>dt.readResource(e,{signal:zo.signal}),{signal:zo.signal,onDiagnostic:(e)=>{if(e.state==="retry")document.documentElement.dataset.adsResourceRetries=String(Number(document.documentElement.dataset.adsResourceRetries??0)+1);console.warn("ADS resource transport",e)}}),pp=async(e)=>JSON.parse((await xu({uri:e})).contents.find((t)=>typeof t.text==="string").text);function Yv(e){let t=Eu.find((r)=>r.name===e.name);if(!t||!(t._meta?.ui?.visibility??["model","app"]).includes("app"))throw Error("This tool is not callable from an App.");return dt.callTool(e)}var mp="";function he(e,t=!1,r=t?"error":e?"checking":"ready"){if(dp)e="Connection interrupted. Reconnecting… The retained preview may be stale.",t=!0,r="error";let o=e||"Preview is up to date.";if(E("preview-error").hidden=!t,Hv(E("status"),o),mp=o,E("status").dataset.error=String(t),!t)for(let s of["errorCategory","errorCode","resourceUri"])delete E("status").dataset[s];E("status").setAttribute("role",t?"alert":"status"),E("preview-status").dataset.phase=r,E("preview-status").querySelector(".ds-preview-indicator").dataset.state=["reloading","compiling","reverting"].includes(r)?"building":r,E("preview-status").title=o,E("preview-status").setAttribute("aria-label",`Preview status: ${o.split(`
122
+ `)[0]}`),Xv()}function Xv(){let e=qs?.warmup,t=e?`Background views: ${e.completed}/${e.total} compiled${e.failed?`; ${e.failed} failed`:""}.`:"";E("warmup-status").hidden=!e,E("warmup-status").textContent=t,E("preview-status").dataset.warmup=e?.state??"disabled",E("preview-status").title=[mp,t].filter(Boolean).join(`
123
+ `)}function Qv(){he(Re?"Updating preview…":"Opening preview…",!1,"reloading")}function $r(){return Cr().find((e)=>e.id===Ce[G])}function Os(e=$r()){let t=yo.find((r)=>r.id===wo&&lp.get(r.id)?.scenario===e?.id);return e?.drafts?.find((r)=>r.id===wo)??t??e?.drafts?.[0]}function hp(){return Boolean(Os()&&(G==="drafts"||$r()?.draftOnly||Tr))}function Ra(){return G==="drafts"?$r()?.previewId:Ce[G]}function xa(){return`${G}:${Ce[G]}${hp()?`:draft:${Os().id}:split:${Tr}`:""}`}function yu(e=Re){return e?.key===xa()}function eb(e=qs){if(hp()){let t=e?.drafts?.find((r)=>r.id===Os()?.id);return t?.scenarios?.find((r)=>r.id===Ra())??t}return e?.previews?.find((t)=>t.id===Ra())}var tb=(e)=>JSON.stringify(e&&[e.session,e.revision,e.current,e.live]);function rb(){({scenarios:Cs,categories:Tu}=JS(up,Jv,yo,lp))}function Ik(e){lp.set(e.structuredContent.id,e.structuredContent),rb()}async function cp(e,t,r=zo.signal){let o=(ut?.compiler?.buildTimeoutMs??30000)+15000;try{return await Gv(e,t,{signal:AbortSignal.any([zo.signal,r]),timeout:o})}catch(s){if(s.code!=="REQUEST_TIMEOUT")throw s;throw Object.assign(Error(`The preview request timed out after ${Math.ceil(o/1000)} seconds. No preview result was received. Retry the preview.`,{cause:s}),{code:"ADS_PREVIEW_REQUEST_TIMEOUT",category:"transport"})}}async function fp(e,t,r){let o=($r()?.id===t||G==="drafts")&&$r()?.pendingDraftScenario||e.units?.includes(t)&&!up.some((n)=>n.id===t),s=await cp("ads_show_draft",{id:e.id,...!o&&t?{scenario:t}:{}},r);if(s.isError)throw Error(s.content?.find((n)=>n.type==="text")?.text??"Draft preview failed.");if(o){let n=s.structuredContent.scenarios.find((i)=>t==="tokens"?i.kind==="tokens":i.unit?i.unit===t:uu(t,i.id));if(!n)throw Error("Draft owner has no scenario yet. Add an independently mountable scenario before previewing it.");if(n.id!==s.structuredContent.scenario)s=await cp("ads_show_draft",{id:e.id,scenario:n.id},r);if(s.isError)throw Error(s.content?.find((i)=>i.type==="text")?.text??"Draft preview failed.")}return Ik(s),s}function or(e=!1){if(e)Ps=Re?.key;Ts=void 0,E("loader").hidden=!0,E("preview").setAttribute("aria-busy","false")}function sp(e){let t=new URL(location.href);for(let s of["scenario","draft","split","section"])t.searchParams.delete(s);if(G==="icons")return t.searchParams.set("section","icons"),t.pathname+t.search+t.hash;if(G==="drafts"){t.searchParams.set("section","drafts");let s=Cr().find((n)=>n.id===e);if(s?.drafts?.[0])t.searchParams.set("draft",s.drafts[0].id);if(s?.previewId)t.searchParams.set("scenario",s.previewId);if(Tr)t.searchParams.set("split","1");return t.pathname+t.search+t.hash}if(e)t.searchParams.set("scenario",e);let r=Cr().find((s)=>s.id===e),o=Os(r);if(o&&(r.draftOnly||Tr)){if(t.searchParams.set("draft",o.id),!r.draftOnly)t.searchParams.set("split","1")}return t.pathname+t.search+t.hash}function Cr(){return G==="drafts"?WS(Cs,yo):G==="tokens"?Tu:G==="icons"?[{id:"icons",kind:"icons",title:"All icons"}]:Cs.filter((e)=>e.kind===G)}function ob(e,t){if(t.kind==="icons"&&G==="icons")return;let{state:r,label:o}=Ud(t.previewId?{...t,id:t.previewId}:t,qs,wo),s=e.querySelector(".entry-preview");if(!s)return;s.dataset.state=r,s.title=o,e.dataset.buildState=r,e.setAttribute("aria-description",o)}var $s={...KS},Bv=()=>G==="drafts"?$r()?.kind:G,sb=()=>["components","patterns","composition"].includes(Bv())||Bv()==="tokens"&&Ra()==="tokens/Layout";function Ta(){return $s}function qk(){return GS(Ta())}function nb(){return YS(Ta())}function ib(){let e=sb(),t=Ta(),r=nb();E("grid-overlay").hidden=!e,E("grid-overlay").dataset.enabled=String(e&&r),E("grid-options-content").dataset.mode=t.mode;for(let o of E("grid-options").querySelectorAll('[id^="grid-options-mode-"]'))o.setAttribute("aria-pressed",String(o.id==="grid-options-mode-"+t.mode));for(let o of E("grid-options").querySelectorAll('[id^="grid-options-layer-"]'))o.setAttribute("aria-pressed",String(t[o.id.slice(19)]===!0));if(E("grid-options-hint").textContent=E("grid-options-hint").dataset[t.mode]??"",!e&&E("grid-options").matches(":popover-open"))E("grid-options").hidePopover()}var wu;function yt(){return{...wu&&wu.target===Ra()?{adsFocus:wu}:{},theme:ip(),adsTheme:Er,...rr?{adsBrand:rr}:{},gridOverlay:sb()&&nb(),gridGuides:qk(),gridGuideChoices:Ta(),displayMode:"inline",containerDimensions:{width:E("frame-slot").clientWidth,height:E("frame-slot").clientHeight}}}function Ns(){E("workspace").dataset.loading="false",E("workspace").setAttribute("aria-busy","false");let e=Cs.some((i)=>i.kind==="brand");if(E("sections").querySelector('[data-section="brand"]').hidden=!e,G==="brand"&&!e)G="tokens";if(E("sections").querySelector('[data-section="icons"]').hidden=!ut?.icons,G==="icons"&&!ut?.icons)G="tokens";let t=Cs.some((i)=>i.kind==="pictograms");if(E("sections").querySelector('[data-section="pictograms"]').hidden=!t,G==="pictograms"&&!t)G="tokens";document.body.dataset.activeSection=G;let r=Cr();if(!r.some((i)=>i.id===Ce[G]))Ce[G]=r[0]?.id??null;ib(),_e?.setHostContext(yt()),history.replaceState(null,"",sp(Ce[G]));let o=E("entries").scrollTop;E("entries").setAttribute("aria-label",G[0].toUpperCase()+G.slice(1));let s=(i)=>{let a=i.kind==="icons"&&G==="icons"?void 0:Ud(i.previewId?{...i,id:i.previewId}:i,qs,wo),c=i.drafts?.length&&G!=="drafts",l=Dv({label:i.title,href:sp(i.id),current:i.id===Ce[G],previewState:a?.state,previewLabel:a?.label,draftLabel:c?i.drafts.length>1?`Drafts ${i.drafts.length}`:"Draft":void 0,draftDescription:c?i.draftOnly?"Draft only; no accepted version yet":"Draft available; use Split view to compare":void 0});if(l.href=sp(i.id),l.dataset.scenario=i.id,ob(l,i),i.id===Ce[G])l.setAttribute("aria-current","page");return l.addEventListener("click",(d)=>{if(d.button||d.metaKey||d.ctrlKey||d.shiftKey||d.altKey)return;d.preventDefault(),Ce[G]=i.id,Ns(),Dt().catch(st)}),l},n=FS(r);if(G==="drafts"){let i=Object.values(cu);n.sort((a,c)=>i.indexOf(a.label)-i.indexOf(c.label))}E("entries").replaceChildren(...n.flatMap((i)=>{if(!i.label)return i.entries.map(s);let a=`${G}:${i.label}`,c=Uv({label:i.label,open:Vv.get(a)??!0});return c.querySelector('[data-slot="entries"]').append(...i.entries.map(s)),c.addEventListener("toggle",()=>{if(c.isConnected)Vv.set(a,c.open)}),[c]})),E("entries").scrollTop=o;for(let i of E("sections").querySelectorAll("button"))if(i.dataset.section===G)i.setAttribute("aria-current","page");else i.removeAttribute("aria-current");ku()}function st(e){if(!Pa&&!Is)or(),E("status").dataset.errorCategory=e.category??(e.code==="ADS_RESOURCE_TRANSPORT"?"transport":"runner"),E("status").dataset.errorCode=e.code??"ADS_HOST_STARTUP",he(`${e.message}${Re?`
124
+ The retained preview is not verified against the current source.`:""}`,!0)}async function Pr(e){if(!e)return;try{await e.teardownResource({},{timeout:500})}catch{}await e.close()}function ab(){if(Pa||Is)return;dp=!1,Is=!0,zo.abort(),++ot,$u.close(),or(),he(`${ga?"HTTP showcase":"MCP"} disconnected. The retained preview is stale. Refresh the page after restarting ADS.`,!0);let e=_e;_e=void 0,Pr(e),++Lt,ka()}async function _p(){let e=await pp("ads://project/explorer");if(ut=e.status,qs=ut.build,Eu=e.tools,ut.themes?.length){if(lt=ut.themes,!lt.some((n)=>n.name===Er))Er=lt[0].name;Wv(),_e?.setHostContext(yt())}bo=ut.brands??[],rr=bo.some((n)=>n.name===rr)?rr:bo[0]?.name??null,Kv(),_e?.setHostContext(yt()),Jv=e.categories,up=e.scenarios,yo=e.drafts,E("title").textContent=(ut.drafts?.previewOnly?"Draft · ":"")+ut.project.showcase.title,E("title").title=ut.projectRoot,rb();let t=Rs?Fv:Ce[G],r=Rs&&yo.find((n)=>n.id===wo),o=Re?.draft&&yo.find((n)=>n.id===Re.draftId);if(r||o&&ze&&(o.revision!==ze.revision||ze.discovery?.state==="pending")){let n=await fp(r||o,r?Fv:ze.scenario);if(r)t=n.structuredContent.scenario;if(Re?.draft&&o){ze=n.structuredContent,Pu=n;for(let i of Ut)if(i.side==="draft")await i.updateResult(n)}}let s=Cs.find((n)=>n.id===t);if(G==="drafts"||Rs&&Ke.get("section")==="drafts"){G="drafts";let n=Cr(),i=n.find((a)=>a.drafts?.[0].id===wo&&a.previewId===t)??n.find((a)=>a.id===Ce.drafts)??n.find((a)=>a.drafts?.[0].id===wo);Ce.drafts=i?.id??n[0]?.id}else if(s&&Ck.includes(s.kind))G=s.kind,Ce[G]=s.id;else if(Rs&&Tu.some((n)=>n.id===t))G="tokens",Ce.tokens=t;else if(Rs&&Ke.get("section")==="icons"&&ut.icons)G="icons";Rs=!1,Ns()}function Dt({force:e=!1}={}){if(Is)return Promise.resolve();if(G==="icons")return Nk(e);zu=!1,rp(E("frame-slot"));let t=Ra(),r=xa();if(xs?.key===r)return xs.promise;if(!e&&za?.key===r)return Promise.resolve();if(!e&&!xs&&Re?.key===r)return Promise.resolve();za=void 0;let o={key:r};return xs=o,o.promise=Ok(t,r).finally(()=>{if(xs===o)xs=void 0}),o.promise}async function Ok(e,t){Ru?.abort();let r=Ru=new AbortController,o=++ot;Ts=!0,E("loader").hidden=t===Ps,E("preview").setAttribute("aria-busy","true");try{if(++Lt,await ka(),o!==ot)return;if(hp()){await Pr(_e),_e=void 0,kr=void 0,tr=void 0;let c=Os(),l=await fp(c,e,r.signal);if(o!==ot)return;if(ze=l.structuredContent,Pu=l,G==="drafts"){let d=Cr().find((f)=>f.drafts?.[0].id===c.id&&f.previewId===ze.scenario);if(d)Ce.drafts=d.id}else if($r()?.pendingDraftScenario||!Cr().some((d)=>d.id===e))Ce[G]=ze.scenario;Re={key:xa(),id:ze.scenario,draftId:c.id,generation:o,draft:!0},ku(),await Mk(),Ns(),or(!0),he("Draft preview only. Acceptance checks have not run.",!1,"ready");return}if(ze=void 0,ku(),!e){if(await Pr(_e),o!==ot)return;if(_e=void 0,Re=void 0,Ps=void 0,kr=void 0,tr=void 0,E("frame-slot").replaceChildren(),or(),G==="drafts"){E("frame-slot").append(Zv({title:"Drafts",description:"No active drafts."})),he("");return}he("No scenarios discovered. Colocate an independently mountable scenario and fixture with the public implementation.");return}let s=Eu.find((c)=>c.name==="ads_show_scenario");if(!s?._meta?.ui?.resourceUri)throw Error("The server did not expose a preview App tool.");let n={id:e};if(s.inputSchema?.properties?.waitFor)n.waitFor=Ke.get("capture")==="1"||Ke.get("waitFor")==="verified"?"verified":"compiled";Qv();let i=await cp(s.name,n,r.signal);if(o!==ot)return;if(i.isError)throw Object.assign(Error(i.content?.find((c)=>c.type==="text")?.text??"Preview build failed."),i.structuredContent?.failure);Re={key:t,id:e,generation:o,build:i.structuredContent?.build,manifestRevision:i.structuredContent?.manifestRevision};let a=await jk(s._meta.ui.resourceUri);if(o!==ot)return;if(kr==="ui://ads/preview"&&!Re.manifestRevision)throw Error("The resource preview has no manifest revision.");if(Ps!==t)Ps=void 0;if(await a.sendToolInput({arguments:n}),await a.sendToolResult(i),o===ot&&!i.structuredContent?.manifestUri)or(!0),he("")}catch(s){if(o===ot)za={key:xa(),build:tb(eb())},st(s)}}async function Nk(e){if(zu&&!e&&vu(E("frame-slot")))return;Ru?.abort();let t=++ot;if(!vu(E("frame-slot"))){E("loader").hidden=!1,++Lt,await ka();let r=_e;_e=void 0,Re=void 0,Ps=void 0,kr=void 0,tr=void 0,ze=void 0,await Pr(r)}try{let r=await pp(bu);if(t!==ot||G!=="icons")return;tp(E("frame-slot"),r),zu=!0,or(),he(""),ku()}catch(r){if(t===ot)st(r)}}async function jk(e){if(kr===e&&tr)return tr;let t=++op,r=_e;_e=void 0,kr=e,tr=(async()=>{await Pr(r);let o=xr?void 0:await xu({uri:e});if(t!==op||Pa||Is)throw Error("Preview opening was superseded.");let s=o?.contents.find((l)=>l.mimeType==="text/html;profile=mcp-app"&&typeof l.text==="string");if(!xr&&!s)throw Error("The preview resource contains no MCP App.");let n=document.createElement("iframe");if(n.title="Design-system preview",n.setAttribute("sandbox","allow-scripts allow-same-origin allow-forms"),!xr)n.src=wa;E("frame-slot").replaceChildren(n);let i=xr?au({frame:n,context:yt()}):new zs(null,{name:"ADS showcase",version:"1.0.0"},{serverResources:{},serverTools:{},logging:{}},{hostContext:yt()});_e=i,i.onreadresource=(l)=>xu(l),i.oncalltool=Yv,i.onloggingmessage=(l)=>{if(i!==_e||l.logger!=="ads-preview"||Re?.generation!==ot||!yu()||l.data?.id!==Re?.id)return;if(l.data.state==="guide-options"){$s=Sa(l.data.options),bp();return}if(l.data.state==="navigate"){let f=Tu.find((h)=>h.id===l.data.target);if(!f)return;if(wu={target:f.id,token:typeof l.data.token==="string"?l.data.token:void 0,nonce:Date.now()},Ce.tokens===f.id&&G==="tokens"){_e?.setHostContext(yt());return}G="tokens",Ce.tokens=f.id,Ns(),Dt().catch(st);return}let d=l.data.revision===Re.manifestRevision||l.data.selectionRevision===Re.manifestRevision;if(l.data.state==="ready"&&d)Re.manifestRevision=l.data.revision,or(!0),he("");else if(l.data.state==="checking"&&(!Ts||d))or(!0),he("Checking changes…");else if(l.data.state==="loading")he("Updating preview…",!1,"reloading");else if(l.data.state==="reverting")he("Restoring the last verified preview…",!1,"reverting");else if(l.data.code==="ADS_PREVIEW_REOPEN")_e=void 0,kr=void 0,tr=void 0,Qv(),Pr(i).then(()=>Dt({force:!0})).catch(st);else if(l.data.state==="error"){if(or(),E("status").dataset.errorCategory=l.data.category??"build",E("status").dataset.errorCode=l.data.code??"ADS_PREVIEW_BUILD",l.data.resourceUri)E("status").dataset.resourceUri=l.data.resourceUri;else delete E("status").dataset.resourceUri;he([l.data.message,l.data.code,l.data.resourceUri].filter(Boolean).join(`
125
+ `),!0)}},i.onerror=st;let a,c=new Promise((l,d)=>{a=setTimeout(()=>d(Error("MCP App initialization timed out.")),15000),i.oninitialized=()=>{clearTimeout(a),l()}});if(!xr)i.onsandboxready=()=>i.sendSandboxResourceReady({html:s.text,csp:s._meta?.ui?.csp,sandbox:"allow-scripts allow-forms"});try{await Promise.all([i.connect(xr?void 0:new ws(n.contentWindow,n.contentWindow)),c])}catch(l){throw await Pr(i),l}finally{clearTimeout(a)}return i})();try{return await tr}catch(o){if(t===op)kr=void 0,tr=void 0;throw o}}function cb(e,t){_e?.receiveBuild?.(e,t);for(let r of Ut)r.receiveBuild?.(e,t)}async function ub(e){let t=Re,r=e??await pp("ads://project/build");cb("ads://project/build",r),qs=r,Xv();for(let s of E("entries").querySelectorAll("a[data-scenario]")){let n=Cr().find((i)=>i.id===s.dataset.scenario);if(n)ob(s,n)}if(za?.key===xa()){let s=eb(r);if(s&&(s.current||s.live)&&tb(s)!==za.build)await Dt({force:!0});return}if(!t||Ts||!yu(t))return;if(t.draft){let s=r.drafts?.find((a)=>a.id===t.draftId),n=s?.scenarios?.find((a)=>a.id===ze?.scenario)??s,i=n&&JSON.stringify([s?.session,n.revision,n.live?.revision,n.current]);if(n&&(n.current||n.live)&&t.buildSignature!==i){t.buildSignature=i;let a=yo.find((c)=>c.id===t.draftId);if(a){let c=await fp(a,ze.scenario);if(Re!==t||Ts||!yu(t))return;ze=c.structuredContent,Pu=c;for(let l of Ut)if(l.side==="draft")await l.updateResult(c)}}if(n?.state==="error")he("Draft preview build failed. Showing the previous preview.",!0);else if(n?.building)he(n.live||n.state==="checking"?"Draft preview compiled; checking changes…":"Building draft preview… Showing the previous preview.",!1,n.live||n.state==="checking"?"checking":"compiling");else if(n?.current&&np?.state==="ready")he("Draft preview ready · unaccepted.");return}if(Re!==t||Ts||!yu(t))return;let o=r.previews.find((s)=>s.id===t.id);if(!o){he("The selected scenario is no longer registered.",!0);return}if(["idle","building"].includes(o.state)&&t.build?.current&&o.session===t.build.session&&o.revision<=t.build.revision)return;if(o.state==="error"){he(`${Va(o)}. Showing an earlier view.
126
+ ${wp(o.diagnostics)}`,!0);return}if(["idle","building"].includes(o.state)){he(o.live?"Checking changes…":"Compiling changes… The current view is the previous preview.",!1,o.live?"checking":"compiling");return}if(o.current&&(o.revision!==t.build?.revision||o.session!==t.build?.session))await Dt({force:!0});else if(o.current&&document.documentElement.dataset.adsConnection==="connected"&&mp.startsWith("Connection restored."))he("")}function Cu(e=!1){$u.schedule(e)}async function Mk(){if(!ze)return;let e=ze,t=Pu;np=void 0;let r=++Lt;if(await ka(),r!==Lt)return;let o=Tr&&e.acceptedExists;ks.setAttribute("aria-pressed",String(o));let s=document.createElement("div");s.className="draft-comparison",s.dataset.split=String(o);for(let n of o?["accepted","draft"]:["draft"]){let i=document.createElement("section");i.className="draft-version";let a=document.createElement("h2");a.dataset.version=n,a.textContent=n==="accepted"?"Accepted":"Draft · unaccepted";let c=document.createElement("div");c.className="draft-stage",c.dataset.version=n,i.append(a,c),s.append(i)}E("frame-slot").replaceChildren(s),await Promise.all([...s.querySelectorAll(".draft-stage")].map(async(n)=>{let i=n.dataset.version,a=i==="draft"?t:await Gv("ads_show_scenario",{id:e.scenario,waitFor:"compiled"});if(a.isError)throw Error(a.content?.find((d)=>d.type==="text")?.text??"Comparison build failed.");if(r!==Lt)return;let c=Eu.find((d)=>d.name===(i==="draft"?"ads_show_draft":"ads_show_scenario")),l=await BS({slot:n,title:i==="draft"?"Draft version":"Accepted version",sandboxUrl:wa,httpPreview:xr,resourceUri:c._meta.ui.resourceUri,result:a,readResource:xu,callTool:Yv,context:(d)=>({...yt(),containerDimensions:{width:d.clientWidth,height:d.clientHeight}}),onError:(d)=>{if(r===Lt)st(d)},onState:(d)=>{if(r!==Lt)return;if(d.state==="guide-options"){$s=Sa(d.options),bp();return}if(i!=="draft")return;if(np=d,d.state==="ready")he("Draft preview ready · unaccepted.");else if(d.state==="checking")he("Draft preview compiled; checking changes…",!1,"checking");else if(["loading","reverting"].includes(d.state))he("Updating draft preview…",!1,"reloading")}});if(r!==Lt)await l.close();else Ut.push({...l,side:i})}))}function ku(){let e=$r(),t=Boolean(Os(e))&&!e?.draftOnly;ks.disabled=!t,ks.hidden=!t,ks.title=e?.draftOnly?"No accepted version yet":t?"Compare accepted and draft versions":"No draft for this entry",ks.setAttribute("aria-pressed",String(t&&Tr));let r=document.querySelector('.draft-version h2[data-version="draft"]');if(r&&ze){let o={draft:"unaccepted",checking:"checking acceptance",failed:"acceptance failed",conflict:"source conflict",interrupted:"acceptance interrupted","dependency-error":"dependency needs attention"};r.textContent=`Draft · ${o[ze.state]??ze.state}`,r.title=ze.dependencies?.length?`Draft dependencies: ${ze.dependencies.join(", ")}`:""}}ks.addEventListener("click",()=>{Tr=!Tr,Ns(),Dt().catch(st)});for(let e of E("sections").querySelectorAll("button"))e.addEventListener("click",()=>{G=e.dataset.section,Ns(),Dt().catch(st)});var gp=window.matchMedia("(max-width: 760px)");function lb(){let e=E("workspace"),t=Av(e.dataset.collapsed==="true",e.dataset.capture==="true");E("header").className=t.header,e.querySelector(":scope > main").className=t.main}function Sp(e){E("workspace").dataset.collapsed=String(e),lb(),E("pane-toggle").setAttribute("aria-expanded",String(!e)),E("pane-toggle").setAttribute("aria-label",e?"Show navigation pane":"Hide navigation pane"),E("pane-toggle").title=e?"Show navigation pane":"Hide navigation pane",E("pane-toggle").querySelector("path").setAttribute("d",e?"M6 4l4 4-4 4":"M10 4l-4 4 4 4")}var vp=()=>Sp(gp.matches||E("header").hidden);vp();gp.addEventListener("change",vp);E("pane-toggle").addEventListener("click",()=>Sp(E("workspace").dataset.collapsed!=="true"));function db(){E("workspace").dataset.viewport=Es?"phone":"auto",E("viewport").setAttribute("aria-pressed",String(Es)),E("viewport").title=Es?"Use available preview width":"Preview at phone width (390 px)"}db();E("viewport").addEventListener("click",()=>{Es=!Es,db();let e=new URL(location.href);if(Es)e.searchParams.set("viewport","phone");else e.searchParams.delete("viewport");history.replaceState(null,"",e.pathname+e.search+e.hash)});E("theme").addEventListener("click",()=>{Er=lt[(lt.findIndex((e)=>e.name===Er)+1)%lt.length].name,Wv(),_e?.setHostContext(yt())});E("theme").addEventListener("click",()=>{for(let e of Ut)e.refreshContext()});E("brand-select").addEventListener("change",()=>{rr=E("brand-select").value,Kv(),_e?.setHostContext(yt());for(let e of Ut)e.refreshContext()});E("grid-options").addEventListener("click",(e)=>{let[,t,r]=/^grid-options-(mode|layer|preset)-(.+)$/.exec(e.target.closest("button")?.id??"")??[],o=Ta();if(t==="mode")$s={...o,mode:r};else if(t==="layer")$s={...o,[r]:o[r]!==!0};else if(t==="preset")$s={...o,...Ev(r),mode:o.mode==="off"?"hover":o.mode};else return;bp()});function bp(){ib(),_e?.setHostContext(yt());for(let e of Ut)e.refreshContext()}E("grid-options").addEventListener("toggle",(e)=>E("grid-overlay").setAttribute("aria-expanded",String(e.newState==="open")));E("minimize").addEventListener("click",()=>{E("header").hidden=!0,Sp(!0)});var pb=new ResizeObserver(()=>_e?.setHostContext(yt()));pb.observe(E("frame-slot"));E("retry-preview").addEventListener("click",()=>{(async()=>{await _p(),await Dt({force:!0})})().catch(st)});window.addEventListener("pagehide",()=>{Pa=!0,Ru?.abort(),zo.abort(),$u.close(),pb.disconnect(),gp.removeEventListener("change",vp),Pr(_e),++Lt,ka(),ap?.close(),dt.close()},{once:!0});dt.onclose=ab;dt.onconnectionchange=({connected:e,reconnected:t})=>{if(Pa||Is)return;if(dp=!e,document.documentElement.dataset.adsConnection=e?"connected":"reconnecting",!e){he("");return}if(t){he("Connection restored. Checking the current preview…",!1,"checking"),Cu(!0),_e?.reconcileBuild?.();for(let r of Ut)r.reconcileBuild?.()}};dt.onBuildReport?.((e,t)=>{if(e==="ads://project/build")ub(t).catch(st);else cb(e,t)});dt.setNotificationHandler("notifications/resources/list_changed",()=>Cu(!0));dt.setNotificationHandler("notifications/tools/list_changed",()=>Cu(!0));dt.setNotificationHandler("notifications/resources/updated",({params:e})=>{if(ga&&e.uri==="ads://project/build")return;if(e.uri===bu)zu=!1;Cu(e.uri==="ads://project/explorer")});try{let e=await fetch("host.json").then((t)=>t.json());if(wa=e.sandboxUrl,xr=ga,ga&&!e.httpPreview)throw Error("HTTP showcase delivery is unavailable.");if(!wa||new URL(wa).origin===location.origin)throw Error("The separate-origin preview sandbox is unavailable.");await US(dt),ap=await dt.listen({resourcesListChanged:!0,toolsListChanged:!0,resourceSubscriptions:["ads://project/build","ads://project/tokens","ads://project/explorer",bu]}),ap.closed.then((t)=>{if(t!=="local")ab()}),await _p(),$u.start(),await Dt()}catch(e){st(e)}