@reqvire-org/ads 0.4.2 → 0.4.3

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 (62) hide show
  1. package/README.md +10 -1
  2. package/dist/a11y.mjs +71 -65
  3. package/dist/analysis/helpers.mjs +5 -3
  4. package/dist/analysis/inputs.mjs +13 -6
  5. package/dist/analysis/module-resolvers.mjs +46 -0
  6. package/dist/analysis/service.mjs +7 -0
  7. package/dist/analysis/syntax.mjs +20 -5
  8. package/dist/assets.mjs +1 -1
  9. package/dist/boundaries.mjs +6 -4
  10. package/dist/check-service.mjs +8 -5
  11. package/dist/check.mjs +8 -3
  12. package/dist/component-contrast.mjs +126 -8
  13. package/dist/contrast-composition.mjs +134 -0
  14. package/dist/finding-rules.mjs +2 -0
  15. package/dist/font-rules.mjs +20 -15
  16. package/dist/fonts-generated.mjs +21 -14
  17. package/dist/foundation-views.mjs +6 -2
  18. package/dist/image-attributes.mjs +96 -92
  19. package/dist/mcp/drafts.mjs +6 -4
  20. package/dist/mcp/mutations.mjs +11 -8
  21. package/dist/mcp/preview-widget.bundle.js +43 -43
  22. package/dist/mcp/server.mjs +9 -2
  23. package/dist/pictogram-model.mjs +59 -0
  24. package/dist/pictograms.mjs +52 -0
  25. package/dist/preview-bun.mjs +1 -0
  26. package/dist/render-audit/image-shape.mjs +13 -3
  27. package/dist/render-audit/pictograms.mjs +88 -0
  28. package/dist/render-audit/worker.mjs +12 -0
  29. package/dist/render-audit.mjs +11 -1
  30. package/dist/render-composition.mjs +164 -0
  31. package/dist/scenario-registry.mjs +2 -2
  32. package/dist/scenarios-compiler.mjs +1 -1
  33. package/dist/showcase/client.bundle.js +23 -23
  34. package/dist/showcase/draft-navigation.js +5 -5
  35. package/dist/showcase/foundation-view.css +3 -0
  36. package/dist/showcase/foundation-view.mjs +3 -0
  37. package/dist/showcase/pictogram-view.mjs +53 -0
  38. package/dist/showcase/ui/ui.js +2 -0
  39. package/dist/skills/ads-designer/SKILL.md +13 -1
  40. package/dist/skills/ads-designer/references/accessibility.md +66 -2
  41. package/dist/skills/ads-designer/references/branding.md +5 -16
  42. package/dist/skills/ads-designer/references/performance.md +3 -2
  43. package/dist/skills/ads-designer/references/pictograms.md +131 -0
  44. package/dist/skills/ads-port/SKILL.md +4 -1
  45. package/dist/source-values.mjs +4 -1
  46. package/dist/starters/react/design-system/assets/pictograms/catalog.ads.json +13 -0
  47. package/dist/starters/react/design-system/assets/pictograms/journey.dark.svg +7 -0
  48. package/dist/starters/react/design-system/assets/pictograms/journey.svg +7 -0
  49. package/dist/starters/react/design-system/components/Content/Pictogram/Pictogram.ads.exports.ts +1 -0
  50. package/dist/starters/react/design-system/components/Content/Pictogram/Pictogram.ads.fixture.ts +1 -0
  51. package/dist/starters/react/design-system/components/Content/Pictogram/Pictogram.ads.scenario.tsx +7 -0
  52. package/dist/starters/react/design-system/components/Content/Pictogram/Pictogram.tsx +26 -0
  53. package/dist/task-cache.mjs +2 -2
  54. package/dist/units.mjs +4 -4
  55. package/dist/validation-inputs.mjs +7 -3
  56. package/docs/ADS.md +6 -1
  57. package/docs/ARCHITECTURE.md +75 -2
  58. package/docs/CACHING.md +25 -0
  59. package/docs/CHANGELOG.md +75 -52
  60. package/docs/GUIDE.md +30 -5
  61. package/docs/MCP.md +6 -0
  62. package/package.json +2 -1
@@ -1,7 +1,7 @@
1
- function Zi(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:ab,defineProperty:Hi,getOwnPropertyDescriptor:ib,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)Hi(r,o,{get:e[o],enumerable:!0});if(t)Hi(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,a=s.length,i;n<a;n++)if(i=s[n],!lb.call(e,i)&&i!==r)Hi(e,i,{get:((u)=>t[u]).bind(null,i),enumerable:!(o=ib(t,i))||o.enumerable})}return e},bm=(e,t,r)=>(r=e!=null?ab(ub(e)):{},db(t||!e||!e.__esModule?Hi(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(i,u){if(!i._zod)Object.defineProperty(i,"_zod",{value:{def:u,constr:a,traits:new Set},enumerable:!1});if(i._zod.traits.has(e))return;i._zod.traits.add(e),t(i,u);let l=a.prototype,d=Object.keys(l);for(let f=0;f<d.length;f++){let h=d[f];if(!(h in i))i[h]=l[h].bind(i)}}let s=r?.Parent??Object;class n extends s{}Object.defineProperty(n,"name",{value:e});function a(i){var u;let l=r?.Parent?new n:this;o(l,i),(u=l._zod).deferred??(u.deferred=[]);for(let d of l._zod.deferred)d();return l}return Object.defineProperty(a,"init",{value:o}),Object.defineProperty(a,Symbol.hasInstance,{value:(i)=>{if(r?.Parent&&i instanceof r.Parent)return!0;return i?._zod?.traits?.has(e)}}),Object.defineProperty(a,"name",{value:e}),a}var fb=Symbol("zod_brand");class Ht extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class nn 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 Vi(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 an(e,t){if(typeof t==="bigint")return t.toString();return t}function cn(e){return{get value(){{let r=e();return Object.defineProperty(this,"value",{value:r}),r}throw Error("cached value already set")}}}function Bi(e){return e===null||e===void 0}function Ji(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 ir(...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=cn(()=>{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=ir(e._zod.def,{get shape(){let a={};for(let i in t){if(!(i in r.shape))throw Error(`Unrecognized key: "${i}"`);if(!t[i])continue;a[i]=r.shape[i]}return Zr(this,"shape",a),a},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=ir(e._zod.def,{get shape(){let a={...e._zod.def.shape};for(let i in t){if(!(i in r.shape))throw Error(`Unrecognized key: "${i}"`);if(!t[i])continue;delete a[i]}return Zr(this,"shape",a),a},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 a in t)if(Object.getOwnPropertyDescriptor(n,a)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}let s=ir(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=ir(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=ir(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 a=ir(t._zod.def,{get shape(){let i=t._zod.def.shape,u={...i};if(r)for(let l in r){if(!(l in i))throw Error(`Unrecognized key: "${l}"`);if(!r[l])continue;u[l]=e?new e({type:"optional",innerType:i[l]}):i[l]}else for(let l in i)u[l]=e?new e({type:"optional",innerType:i[l]}):i[l];return Zr(this,"shape",u),u},checks:[]});return pt(t,a)}function wb(e,t,r){let o=ir(t._zod.def,{get shape(){let s=t._zod.def.shape,n={...s};if(r)for(let a in r){if(!(a in n))throw Error(`Unrecognized key: "${a}"`);if(!r[a])continue;n[a]=new e({type:"nonoptional",innerType:s[a]})}else for(let a in s)n[a]=new e({type:"nonoptional",innerType:s[a]});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 Fi(e){return typeof e==="string"?e:e?.message}function ht(e,t,r){let o=e.message?e.message:Fi(e.inst?._zod.def?.error?.(e))??Fi(t?.error?.(e))??Fi(r.customError?.(e))??Fi(r.localeError?.(e))??"Invalid input",{inst:s,continue:n,input:a,...i}=e;if(i.path??(i.path=[]),i.message=o,t?.reportInput)i.input=a;return i}function Wi(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,an,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},Ki=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 a of s.issues)if(a.code==="invalid_union"&&a.errors.length)a.errors.map((i)=>o({issues:i},[...n,...a.path]));else if(a.code==="invalid_key")o({issues:a.issues},[...n,...a.path]);else if(a.code==="invalid_element")o({issues:a.issues},[...n,...a.path]);else{let i=[...n,...a.path];if(i.length===0)r._errors.push(t(a));else{let u=r,l=0;while(l<i.length){let d=i[l];if(l!==i.length-1)u[d]=u[d]||{_errors:[]};else u[d]=u[d]||{_errors:[]},u[d]._errors.push(t(a));u=u[d],l++}}}};return o(e),r}var Gi=(e)=>(t,r,o,s)=>{let n=o?{...o,async:!1}:{async:!1},a=t._zod.run({value:r,issues:[]},n);if(a instanceof Promise)throw new Ht;if(a.issues.length){let i=new(s?.Err??e)(a.issues.map((u)=>ht(u,n,Je())));throw qu(i,s?.callee),i}return a.value};var Yi=(e)=>async(t,r,o,s)=>{let n=o?{...o,async:!0}:{async:!0},a=t._zod.run({value:r,issues:[]},n);if(a instanceof Promise)a=await a;if(a.issues.length){let i=new(s?.Err??e)(a.issues.map((u)=>ht(u,n,Je())));throw qu(i,s?.callee),i}return a.value};var un=(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??Ki)(n.issues.map((a)=>ht(a,s,Je())))}:{success:!0,data:n.value}},Nm=un(ju),ln=(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((a)=>ht(a,s,Je())))}:{success:!0,data:n.value}},jm=ln(ju),Mm=(e)=>(t,r,o)=>{let s=o?{...o,direction:"backward"}:{direction:"backward"};return Gi(e)(t,r,s)};var Am=(e)=>(t,r,o)=>Gi(e)(t,r,o);var Lm=(e)=>async(t,r,o)=>{let s=o?{...o,direction:"backward"}:{direction:"backward"};return Yi(e)(t,r,s)};var Um=(e)=>async(t,r,o)=>Yi(e)(t,r,o);var Dm=(e)=>(t,r,o)=>{let s=o?{...o,direction:"backward"}:{direction:"backward"};return un(e)(t,r,s)};var Zm=(e)=>(t,r,o)=>un(e)(t,r,o);var Hm=(e)=>async(t,r,o)=>{let s=o?{...o,direction:"backward"}:{direction:"backward"};return ln(e)(t,r,s)};var Fm=(e)=>async(t,r,o)=>ln(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 ap=/^https?$/,ip=/^\+[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 Ce=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)=>{Ce.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)=>{Ce.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)=>{Ce.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)=>{Ce.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((a)=>{let i=a._zod.bag;if(i.format=t.format,i.minimum=s,i.maximum=n,r)i.pattern=hp}),e._zod.check=(a)=>{let i=a.value;if(r){if(!Number.isInteger(i)){a.issues.push({expected:o,format:t.format,code:"invalid_type",continue:!1,input:i,inst:e});return}if(!Number.isSafeInteger(i)){if(i>0)a.issues.push({input:i,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 a.issues.push({input:i,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(i<s)a.issues.push({origin:"number",input:i,code:"too_small",minimum:s,inclusive:!0,inst:e,continue:!t.abort});if(i>n)a.issues.push({origin:"number",input:i,code:"too_big",maximum:n,inclusive:!0,inst:e,continue:!t.abort})}});var zp=y("$ZodCheckMaxLength",(e,t)=>{var r;Ce.init(e,t),(r=e._zod.def).when??(r.when=(o)=>{let s=o.value;return!Bi(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 a=Wi(s);o.issues.push({origin:a,code:"too_big",maximum:t.maximum,inclusive:!0,input:s,inst:e,continue:!t.abort})}}),Rp=y("$ZodCheckMinLength",(e,t)=>{var r;Ce.init(e,t),(r=e._zod.def).when??(r.when=(o)=>{let s=o.value;return!Bi(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 a=Wi(s);o.issues.push({origin:a,code:"too_small",minimum:t.minimum,inclusive:!0,input:s,inst:e,continue:!t.abort})}}),xp=y("$ZodCheckLengthEquals",(e,t)=>{var r;Ce.init(e,t),(r=e._zod.def).when??(r.when=(o)=>{let s=o.value;return!Bi(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 a=Wi(s),i=n>t.length;o.issues.push({origin:a,...i?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:o.value,inst:e,continue:!t.abort})}}),mn=y("$ZodCheckStringFormat",(e,t)=>{var r,o;if(Ce.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)=>{mn.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),mn.init(e,t)}),Tp=y("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=vp),mn.init(e,t)}),Ep=y("$ZodCheckIncludes",(e,t)=>{Ce.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)=>{Ce.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)=>{Ce.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)=>{Ce.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 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(`
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 ie=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=(a,i,u)=>{let l=Fr(a),d;for(let f of i){if(f._zod.def.when){if(Im(a))continue;if(!f._zod.def.when(a))continue}else if(l)continue;let h=a.issues.length,g=f._zod.check(a);if(g instanceof Promise&&u?.async===!1)throw new Ht;if(d||g instanceof Promise)d=(d??Promise.resolve()).then(async()=>{if(await g,a.issues.length===h)return;if(!l)l=Fr(a,h)});else{if(a.issues.length===h)continue;if(!l)l=Fr(a,h)}}if(d)return d.then(()=>a);return a},n=(a,i,u)=>{if(Fr(a))return a.aborted=!0,a;let l=s(i,o,u);if(l instanceof Promise){if(u.async===!1)throw new Ht;return l.then((d)=>e._zod.parse(d,u))}return e._zod.parse(l,u)};e._zod.run=(a,i)=>{if(i.skipChecks)return e._zod.parse(a,i);if(i.direction==="backward"){let l=e._zod.parse({value:a.value,issues:[]},{...i,skipChecks:!0});if(l instanceof Promise)return l.then((d)=>n(d,a,i));return n(l,a,i)}let u=e._zod.parse(a,i);if(u instanceof Promise){if(i.async===!1)throw new Ht;return u.then((l)=>s(l,o,i))}return s(u,o,i)}}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((a)=>a.success?{value:a.data}:{issues:a.error?.issues})}},vendor:"zod",version:1}))}),ec=y("$ZodString",(e,t)=>{ie.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)=>{mn.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===ap.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 ah=y("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=op),me.init(e,t)}),ih=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 a=Number(n);if(`${a}`!==n)throw Error();if(a<0||a>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=ip),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)=>{ie.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(a){}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)=>{ie.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)=>{ie.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)=>{ie.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)=>{ie.init(e,t),e._zod.parse=(r)=>r}),Sh=y("$ZodUnknown",(e,t)=>{ie.init(e,t),e._zod.parse=(r)=>r}),vh=y("$ZodNever",(e,t)=>{ie.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)=>{ie.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 a=0;a<s.length;a++){let i=s[a],u=t.element._zod.run({value:i,issues:[]},o);if(u instanceof Promise)n.push(u.then((l)=>Np(l,r,a)));else Np(u,r,a)}if(n.length)return Promise.all(n).then(()=>r);return r}});function Qi(e,t,r,o,s,n){let a=r in o;if(e.issues.length){if(s&&n&&!a)return;t.issues.push(...ur(r,e.issues))}if(!a&&!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(a)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 a=[],i=s.keySet,u=s.catchall._zod,l=u.def.type,d=u.optin==="optional",f=u.optout==="optional";for(let h in t){if(h==="__proto__")continue;if(i.has(h))continue;if(l==="never"){a.push(h);continue}let g=u.run({value:t[h],issues:[]},o);if(g instanceof Promise)e.push(g.then((b)=>Qi(b,r,h,t,d,f)));else Qi(g,r,h,t,d,f)}if(a.length)r.issues.push({code:"unrecognized_keys",keys:a,input:t,inst:n});if(!e.length)return r;return Promise.all(e).then(()=>r)}var Pb=y("$ZodObject",(e,t)=>{if(ie.init(e,t),!Object.getOwnPropertyDescriptor(t,"shape")?.get){let i=t.shape;Object.defineProperty(t,"shape",{get:()=>{let u={...i};return Object.defineProperty(t,"shape",{value:u}),u}})}let o=cn(()=>yh(t));oe(e._zod,"propValues",()=>{let i=t.shape,u={};for(let l in i){let d=i[l]._zod;if(d.values){u[l]??(u[l]=new Set);for(let f of d.values)u[l].add(f)}}return u});let s=No,n=t.catchall,a;e._zod.parse=(i,u)=>{a??(a=o.value);let l=i.value;if(!s(l))return i.issues.push({expected:"object",code:"invalid_type",input:l,inst:e}),i;i.value={};let d=[],f=a.shape;for(let h of a.keys){let g=f[h],b=g._zod.optin==="optional",_=g._zod.optout==="optional",w=g._zod.run({value:l[h],issues:[]},u);if(w instanceof Promise)d.push(w.then((I)=>Qi(I,i,h,l,b,_)));else Qi(w,i,h,l,b,_)}if(!n)return d.length?Promise.all(d).then(()=>i):i;return wh(d,l,i,u,o.value,e)}}),zh=y("$ZodObjectJIT",(e,t)=>{Pb.init(e,t);let r=e._zod.parse,o=cn(()=>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(`
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
5
  if (${q}.issues.length) {
6
6
  if (${x} in input) {
7
7
  payload.issues = payload.issues.concat(${q}.issues.map(iss => ({
@@ -60,31 +60,31 @@ function Zi(e){if(e?.failure?.scope!=="project")return"Preview build failed";if(
60
60
  newResult[${x}] = ${q}.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,a=No,i=!Oo.jitless,l=i&&Tm.value,d=t.catchall,f;e._zod.parse=(h,g)=>{f??(f=o.value);let b=h.value;if(!a(b))return h.issues.push({expected:"object",code:"invalid_type",input:b,inst:e}),h;if(i&&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((a)=>ht(a,o,Je())))}),t}var Ju=y("$ZodUnion",(e,t)=>{ie.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)=>Ji(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,a=[];for(let i of t.options){let u=i._zod.run({value:o.value,issues:[]},s);if(u instanceof Promise)a.push(u),n=!0;else{if(u.issues.length===0)return u;a.push(u)}}if(!n)return jp(a,o,e,s);return Promise.all(a).then((i)=>jp(i,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 a=n._zod.propValues;if(!a||Object.keys(a).length===0)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(n)}"`);for(let[i,u]of Object.entries(a)){if(!s[i])s[i]=new Set;for(let l of u)s[i].add(l)}}return s});let o=cn(()=>{let s=t.options,n=new Map;for(let a of s){let i=a._zod.propValues?.[t.discriminator];if(!i||i.size===0)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(a)}"`);for(let u of i){if(n.has(u))throw Error(`Duplicate discriminator value "${String(u)}"`);n.set(u,a)}}return n});e._zod.parse=(s,n)=>{let a=s.value;if(!No(a))return s.issues.push({code:"invalid_type",expected:"object",input:a,inst:e}),s;let i=o.value.get(a?.[t.discriminator]);if(i)return i._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:a,path:[t.discriminator],inst:e}),s}}),xh=y("$ZodIntersection",(e,t)=>{ie.init(e,t),e._zod.parse=(r,o)=>{let s=r.value,n=t.left._zod.run({value:s,issues:[]},o),a=t.right._zod.run({value:s,issues:[]},o);if(n instanceof Promise||a instanceof Promise)return Promise.all([n,a]).then(([u,l])=>Mp(r,u,l));return Mp(r,n,a)}});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 a=Vu(e[n],t[n]);if(!a.valid)return{valid:!1,mergeErrorPath:[n,...a.mergeErrorPath]};s[n]=a.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],a=Vu(s,n);if(!a.valid)return{valid:!1,mergeErrorPath:[o,...a.mergeErrorPath]};r.push(a.data)}return{valid:!0,data:r}}return{valid:!1,mergeErrorPath:[]}}function Mp(e,t,r){let o=new Map,s;for(let i of t.issues)if(i.code==="unrecognized_keys"){s??(s=i);for(let u of i.keys){if(!o.has(u))o.set(u,{});o.get(u).l=!0}}else e.issues.push(i);for(let i of r.issues)if(i.code==="unrecognized_keys")for(let u of i.keys){if(!o.has(u))o.set(u,{});o.get(u).r=!0}else e.issues.push(i);let n=[...o].filter(([,i])=>i.l&&i.r).map(([i])=>i);if(n.length&&s)e.issues.push({...s,keys:n});if(Fr(e))return e;let a=Vu(t.value,r.value);if(!a.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(a.mergeErrorPath)}`);return e.value=a.data,e}var kh=y("$ZodRecord",(e,t)=>{ie.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=[],a=t.keyType._zod.values;if(a){r.value={};let i=new Set;for(let l of a)if(typeof l==="string"||typeof l==="number"||typeof l==="symbol"){i.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 u;for(let l in s)if(!i.has(l))u=u??[],u.push(l);if(u&&u.length>0)r.issues.push({code:"unrecognized_keys",input:s,inst:e,keys:u})}else{r.value={};for(let i of Reflect.ownKeys(s)){if(i==="__proto__")continue;if(!Object.prototype.propertyIsEnumerable.call(s,i))continue;let u=t.keyType._zod.run({value:i,issues:[]},o);if(u instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(typeof i==="string"&&Du.test(i)&&u.issues.length){let f=t.keyType._zod.run({value:Number(i),issues:[]},o);if(f instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(f.issues.length===0)u=f}if(u.issues.length){if(t.mode==="loose")r.value[i]=s[i];else r.issues.push({code:"invalid_key",origin:"record",issues:u.issues.map((f)=>ht(f,o,Je())),input:i,path:[i],inst:e});continue}let d=t.valueType._zod.run({value:s[i],issues:[]},o);if(d instanceof Promise)n.push(d.then((f)=>{if(f.issues.length)r.issues.push(...ur(i,f.issues));r.value[u.value]=f.value}));else{if(d.issues.length)r.issues.push(...ur(i,d.issues));r.value[u.value]=d.value}}}if(n.length)return Promise.all(n).then(()=>r);return r}});var Ph=y("$ZodEnum",(e,t)=>{ie.init(e,t);let r=Vi(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 a=s.value;if(o.has(a))return s;return s.issues.push({code:"invalid_value",values:r,input:a,inst:e}),s}}),Th=y("$ZodLiteral",(e,t)=>{if(ie.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)=>{ie.init(e,t),e._zod.optin="optional",e._zod.parse=(r,o)=>{if(o.direction==="backward")throw new nn(e.constructor.name);let s=t.transform(r.value,r);if(o.async)return(s instanceof Promise?s:Promise.resolve(s)).then((a)=>(r.value=a,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)=>{ie.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(`^(${Ji(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((a)=>Ap(a,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)=>{ie.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(`^(${Ji(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)=>{ie.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)=>{ie.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)=>{ie.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)=>{ie.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((a)=>ht(a,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)=>{ie.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((a)=>Xi(a,t.in,o));return Xi(n,t.in,o)}let s=t.in._zod.run(r,o);if(s instanceof Promise)return s.then((n)=>Xi(n,t.out,o));return Xi(s,t.out,o)}});function Xi(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)=>{ie.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)=>{ie.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)=>{Ce.init(e,t),ie.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,a=qm(s.input),i=o[a]??a;return`Invalid input: expected ${n}, received ${i}`}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?"<=":"<",a=t(s.origin);if(a)return`Too big: expected ${s.origin??"value"} to have ${n}${s.maximum.toString()} ${a.unit??"elements"}`;return`Too big: expected ${s.origin??"value"} to be ${n}${s.maximum.toString()}`}case"too_small":{let n=s.inclusive?">=":">",a=t(s.origin);if(a)return`Too small: expected ${s.origin} to have ${n}${s.minimum.toString()} ${a.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((a)=>`'${a}'`).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 pn(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 hn(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 al(e){return dr((t)=>t.normalize(e))}function il(){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 Ce({check:"custom",...H(t)});return r._zod.check=e,r}function _n(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 a={schema:{},count:1,cycle:void 0,path:r.path};t.seen.set(e,a);let i=e._zod.toJSONSchema?.();if(i)a.schema=i;else{let d={...r,schemaPath:[...r.schemaPath,e],path:r.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,a.schema,d);else{let h=a.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(!a.ref)a.ref=f;ce(f,t,d),t.seen.get(f).isParent=!0}}let u=t.metadataRegistry.get(e);if(u)Object.assign(a.schema,u);if(t.io==="input"&&He(e))delete a.schema.examples,delete a.schema.default;if(t.io==="input"&&"_prefault"in a.schema)(o=a.schema).default??(o.default=a.schema._prefault);return delete a.schema._prefault,t.seen.get(e).schema}function gn(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 a of e.seen.entries()){let i=e.metadataRegistry.get(a[0])?.id;if(i){let u=o.get(i);if(u&&u!==a[0])throw Error(`Duplicate schema id "${i}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);o.set(i,a[0])}}let s=(a)=>{let i=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){let f=e.external.registry.get(a[0])?.id,h=e.external.uri??((b)=>b);if(f)return{ref:h(f)};let g=a[1].defId??a[1].schema.id??`schema${e.counter++}`;return a[1].defId=g,{defId:g,ref:`${h("__shared")}#/${i}/${g}`}}if(a[1]===r)return{ref:"#"};let l=`${"#"}/${i}/`,d=a[1].schema.id??`__schema${e.counter++}`;return{defId:d,ref:l+d}},n=(a)=>{if(a[1].schema.$ref)return;let i=a[1],{ref:u,defId:l}=s(a);if(i.def={...i.schema},l)i.defId=l;let d=i.schema;for(let f in d)delete d[f];d.$ref=u};if(e.cycles==="throw")for(let a of e.seen.entries()){let i=a[1];if(i.cycle)throw Error(`Cycle detected: #/${i.cycle?.join("/")}/<root>
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>
64
64
 
65
- Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let a of e.seen.entries()){let i=a[1];if(t===a[0]){n(a);continue}if(e.external){let l=e.external.registry.get(a[0])?.id;if(t!==a[0]&&l){n(a);continue}}if(e.metadataRegistry.get(a[0])?.id){n(a);continue}if(i.cycle){n(a);continue}if(i.count>1){if(e.reused==="ref"){n(a);continue}}}}function Sn(e,t){let r=e.seen.get(t);if(!r)throw Error("Unprocessed schema. This is a bug in Zod.");let o=(i)=>{let u=e.seen.get(i);if(u.ref===null)return;let l=u.def??u.schema,d={...l},f=u.ref;if(u.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),i._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=i._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:i,jsonSchema:l,path:u.path??[]})};for(let i of[...e.seen.entries()].reverse())o(i[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 i=e.external.registry.get(t)?.id;if(!i)throw Error("Schema is missing an `id` property");s.$id=e.external.uri(i)}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 a=e.external?.defs??{};for(let i of e.seen.entries()){let u=i[1];if(u.def&&u.defId){if(u.def.id===u.defId)delete u.def.id;a[u.defId]=u.def}}if(e.external);else if(Object.keys(a).length>0)if(e.target==="draft-2020-12")s.$defs=a;else s.definitions=a;try{let i=JSON.parse(JSON.stringify(s));return Object.defineProperty(i,"~standard",{value:{...t["~standard"],jsonSchema:{input:fn(t,"input",e.processors),output:fn(t,"output",e.processors)}},enumerable:!1,writable:!1}),i}catch(i){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=_n({...r,processors:t});return ce(e,o),gn(o,e),Sn(o,e)},fn=(e,t,r={})=>(o)=>{let{libraryOptions:s,target:n}=o??{},a=_n({...s??{},target:n,io:t,processors:r});return ce(e,a),gn(a,e),Sn(a,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:a,format:i,patterns:u,contentEncoding:l}=e._zod.bag;if(typeof n==="number")s.minLength=n;if(typeof a==="number")s.maxLength=a;if(i){if(s.format=Ib[i]??i,s.format==="")delete s.format;if(i==="time")delete s.format}if(l)s.contentEncoding=l;if(u&&u.size>0){let d=[...u];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:a,format:i,multipleOf:u,exclusiveMaximum:l,exclusiveMinimum:d}=e._zod.bag;if(typeof i==="string"&&i.includes("int"))s.type="integer";else s.type="number";let f=typeof d==="number"&&d>=(n??Number.NEGATIVE_INFINITY),h=typeof l==="number"&&l<=(a??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 a==="number")s.maximum=a;if(typeof u==="number")s.multipleOf=u},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=Vi(s.entries);if(n.every((a)=>typeof a==="number"))r.type="number";if(n.every((a)=>typeof a==="string"))r.type="string";r.enum=n},bl=(e,t,r,o)=>{let s=e._zod.def,n=[];for(let a of s.values)if(a===void 0){if(t.unrepresentable==="throw")throw Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof a==="bigint")if(t.unrepresentable==="throw")throw Error("BigInt literals cannot be represented in JSON Schema");else n.push(Number(a));else n.push(a);if(n.length===0);else if(n.length===1){let a=n[0];if(r.type=a===null?"null":typeof a,t.target==="draft-04"||t.target==="openapi-3.0")r.enum=[a];else r.const=a}else{if(n.every((a)=>typeof a==="number"))r.type="number";if(n.every((a)=>typeof a==="string"))r.type="string";if(n.every((a)=>typeof a==="boolean"))r.type="boolean";if(n.every((a)=>a===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:a,maximum:i,mime:u}=e._zod.bag;if(a!==void 0)n.minLength=a;if(i!==void 0)n.maxLength=i;if(u)if(u.length===1)n.contentMediaType=u[0],Object.assign(s,n);else Object.assign(s,n),s.anyOf=u.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:a,maximum:i}=e._zod.bag;if(typeof a==="number")s.minItems=a;if(typeof i==="number")s.maxItems=i;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 a=n.shape;for(let l in a)s.properties[l]=ce(a[l],t,{...o,path:[...o.path,"properties",l]});let i=new Set(Object.keys(a)),u=new Set([...i].filter((l)=>{let d=n.shape[l]._zod;if(t.io==="input")return d.optin===void 0;else return d.optout===void 0}));if(u.size>0)s.required=Array.from(u);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,a=s.options.map((i,u)=>ce(i,t,{...o,path:[...o.path,n?"oneOf":"anyOf",u]}));if(n)r.oneOf=a;else r.anyOf=a},kl=(e,t,r,o)=>{let s=e._zod.def,n=ce(s.left,t,{...o,path:[...o.path,"allOf",0]}),a=ce(s.right,t,{...o,path:[...o.path,"allOf",1]}),i=(l)=>("allOf"in l)&&Object.keys(l).length===1,u=[...i(n)?n.allOf:[n],...i(a)?a.allOf:[a]];r.allOf=u},Lf=(e,t,r,o)=>{let s=r,n=e._zod.def;s.type="array";let a=t.target==="draft-2020-12"?"prefixItems":"items",i=t.target==="draft-2020-12"?"items":t.target==="openapi-3.0"?"items":"additionalItems",u=n.items.map((h,g)=>ce(h,t,{...o,path:[...o.path,a,g]})),l=n.rest?ce(n.rest,t,{...o,path:[...o.path,i,...t.target==="openapi-3.0"?[n.items.length]:[]]}):null;if(t.target==="draft-2020-12"){if(s.prefixItems=u,l)s.items=l}else if(t.target==="openapi-3.0"){if(s.items={anyOf:u},l)s.items.anyOf.push(l);if(s.minItems=u.length,!l)s.maxItems=u.length}else if(s.items=u,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 a=n.keyType,u=a._zod.bag?.patterns;if(n.mode==="loose"&&u&&u.size>0){let d=ce(n.valueType,t,{...o,path:[...o.path,"patternProperties","*"]});s.patternProperties={};for(let f of u)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=a._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),a=t.seen.get(e);if(t.target==="openapi-3.0")a.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 a;try{a=s.catchValue(void 0)}catch{throw Error("Dynamic catch values are not supported in JSON Schema")}r.default=a},ql=(e,t,r,o)=>{let s=e._zod.def,n=s.in._zod.traits.has("$ZodTransform"),a=t.io==="input"?n?s.out:s.in:s.out;ce(a,t,o);let i=t.seen.get(e);i.ref=a},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},ac=(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:ac,lazy:Nl};function ic(e,t){if("_idmap"in e){let o=e,s=_n({...t,processors:Pf}),n={};for(let u of o._idmap.entries()){let[l,d]=u;ce(d,s)}let a={},i={registry:o,uri:t?.uri,defs:n};s.external=i;for(let u of o._idmap.entries()){let[l,d]=u;gn(s,d),a[l]=Sn(s,d)}if(Object.keys(n).length>0){let u=s.target==="draft-2020-12"?"$defs":"definitions";a.__shared={[u]:n}}return{schemas:a}}let r=_n({...t,processors:Pf});return ce(e,r),gn(r,e),Sn(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)=>{Ki.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,an,2)}},addIssues:{value:(r)=>{e.issues.push(...r),e.message=JSON.stringify(e.issues,an,2)}},isEmpty:{get(){return e.issues.length===0}}})};var tt=y("ZodError",Fb,{Parent:Error});var Ff=Gi(tt),Vf=Yi(tt),uc=un(tt),Bf=ln(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 vn(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 a=r[n];Object.defineProperty(o,n,{configurable:!0,enumerable:!1,get(){let i=a.bind(this);return Object.defineProperty(this,n,{configurable:!0,writable:!0,enumerable:!0,value:i}),i},set(i){Object.defineProperty(this,n,{configurable:!0,writable:!0,enumerable:!0,value:i})}})}}var ue=y("ZodType",(e,t)=>(ie.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:fn(e,"input"),output:fn(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),vn(e,"ZodType",{check(...r){let o=this.def;return this.clone(ir(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 a_(this,f_(r))},default(r){return wy(this,r)},prefault(r){return Ry(this,r)},catch(r){return Py(this,r)},pipe(r){return a_(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)),i_=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,vn(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(il())},normalize(...o){return this.check(al(...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),i_.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(ay,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 c(e){return Hh(c_,e)}var he=y("ZodStringFormat",(e,t)=>{me.init(e,t),i_.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)=>{ah.init(e,t),he.init(e,t)});var ry=y("ZodCIDRv6",(e,t)=>{ih.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 ay=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),vn(e,"ZodNumber",{gt(o,s){return this.check(rc(o,s))},gte(o,s){return this.check(hn(o,s))},min(o,s){return this.check(hn(o,s))},lt(o,s){return this.check(tc(o,s))},lte(o,s){return this.check(pn(o,s))},max(o,s){return this.check(pn(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(hn(0,o))},negative(o){return this.check(tc(0,o))},nonpositive(o){return this.check(pn(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 iy=y("ZodNumberFormat",(e,t)=>{ph.init(e,t),mc.init(e,t)});function o_(e){return _f(iy,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,vn(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),vn(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:c(),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 a of o)if(r.has(a))n[a]=t.entries[a];else throw Error(`Key ${a} not found in enum`);return new Ml({...t,checks:[],...H(s),entries:n})},e.exclude=(o,s)=>{let n={...t.entries};for(let a of o)if(r.has(a))delete n[a];else throw Error(`Key ${a} 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 nn(e.constructor.name);r.addIssue=(n)=>{if(typeof n==="string")r.issues.push(Vr(n,r.value,t));else{let a=n;if(a.fatal)a.continue=!1;a.code??(a.code="custom"),a.input??(a.input=r.value),a.inst??(a.inst=e),r.issues.push(Vr(a))}};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)=>ac(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)=>ac(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 a_(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 bn(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=bn(()=>C([c(),k(),E(),Br(),T(c(),Vt),v(Vt)])),fe=T(c(),Vt),_c=v(Vt),Ho=C([c(),k().int()]),Fo=c(),yn=m({ttl:k().optional()}),wn=m({taskId:c()}),Vo=V({progressToken:Ho.optional(),[fc]:wn.optional()}),Te=m({_meta:Vo.optional()}),pr=Te.extend({task:yn.optional()}),_e=m({method:c(),params:Te.loose().optional()}),Me=m({_meta:Vo.optional()}),Ie=m({method:c(),params:Me.loose().optional()}),Bo=V({get[$t](){return Ct.optional().catch(void 0)}}),ge=V({_meta:Bo.optional()}),ft=C([c(),k().int()]),Jo=m({jsonrpc:p(Gr),id:ft,..._e.shape}).strict(),Wo=m({jsonrpc:p(Gr),...Ie.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:c(),data:D().optional()})}).strict(),_t=C([Jo,Wo,Yr,Xr]),gc=C([Yr,Xr]),hr=ge.strict(),zn=Me.extend({requestId:ft.optional(),reason:c().optional()}),Ko=Ie.extend({method:p("notifications/cancelled"),params:zn}),Rn=m({src:c(),mimeType:c().optional(),sizes:v(c()).optional(),theme:Y(["light","dark"]).optional()}),Jt=m({icons:v(Rn).optional()}),Et=m({name:c(),title:c().optional()}),Ct=Et.extend({...Et.shape,...Jt.shape,version:c(),websiteUrl:c().optional(),description:c().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()}),xn=m({experimental:T(c(),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(c(),fe).optional()}),kn=Te.extend({protocolVersion:c(),capabilities:xn,clientInfo:Ct}),Go=_e.extend({method:p("initialize"),params:kn}),Yo=m({experimental:T(c(),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(c(),fe).optional()}),Pn=ge.extend({protocolVersion:c(),capabilities:Yo,serverInfo:Ct,instructions:c().optional()}),Xo=Ie.extend({method:p("notifications/initialized"),params:Me.optional()}),Tn=_e.extend({method:p("server/discover"),params:Te.optional()}),fr=ge.extend({supportedVersions:v(c()),capabilities:Yo,instructions:c().optional()}),Qo=_e.extend({method:p("ping"),params:Te.optional()}),En=m({progress:k(),total:F(k()),message:F(c())}),$n=m({...Me.shape,...En.shape,progressToken:Ho}),es=Ie.extend({method:p("notifications/progress"),params:$n}),Cn=Te.extend({cursor:Fo.optional()}),Wt=_e.extend({params:Cn.optional()}),Kt=ge.extend({nextCursor:Fo.optional()}),ts=m({uri:c(),mimeType:F(c()),_meta:T(c(),D()).optional()}),rs=ts.extend({text:c()}),Ul=c().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:c(),description:F(c()),mimeType:F(c()),size:F(k()),annotations:It.optional(),_meta:F(V({}))}),In=m({...Et.shape,...Jt.shape,uriTemplate:c(),description:F(c()),mimeType:F(c()),annotations:It.optional(),_meta:F(V({}))}),qn=Wt.extend({method:p("resources/list")}),On=Kt.extend({resources:v(ss)}),Nn=Wt.extend({method:p("resources/templates/list")}),jn=Kt.extend({resourceTemplates:v(In)}),Qr=Te.extend({uri:c()}),Mn=Qr,An=_e.extend({method:p("resources/read"),params:Mn}),Ln=ge.extend({contents:v(C([rs,os]))}),Un=Ie.extend({method:p("notifications/resources/list_changed"),params:Me.optional()}),Dn=Qr,Zn=_e.extend({method:p("resources/subscribe"),params:Dn}),Hn=Qr,Fn=_e.extend({method:p("resources/unsubscribe"),params:Hn}),ns=m({toolsListChanged:E().optional(),promptsListChanged:E().optional(),resourcesListChanged:E().optional(),resourceSubscriptions:v(c()).optional()}),Vn=Te.extend({notifications:ns}),Bn=_e.extend({method:p("subscriptions/listen"),params:Vn}),Jn=Me.extend({notifications:ns}),Wn=Ie.extend({method:p("notifications/subscriptions/acknowledged"),params:Jn}),Kn=Bo.extend({[Do]:ft}),Gn=ge.extend({_meta:Kn}),Yn=Me.extend({uri:c()}),Xn=Ie.extend({method:p("notifications/resources/updated"),params:Yn}),Qn=m({name:c(),description:F(c()),required:F(E())}),ea=m({...Et.shape,...Jt.shape,description:F(c()),arguments:F(v(Qn)),_meta:F(V({}))}),ta=Wt.extend({method:p("prompts/list")}),ra=Kt.extend({prompts:v(ea)}),oa=Te.extend({name:c(),arguments:T(c(),c()).optional()}),sa=_e.extend({method:p("prompts/get"),params:oa}),eo=m({type:p("text"),text:c(),annotations:It.optional(),_meta:T(c(),D()).optional()}),to=m({type:p("image"),data:Ul,mimeType:c(),annotations:It.optional(),_meta:T(c(),D()).optional()}),ro=m({type:p("audio"),data:Ul,mimeType:c(),annotations:It.optional(),_meta:T(c(),D()).optional()}),na=m({type:p("tool_use"),name:c(),id:c(),input:T(c(),D()),_meta:T(c(),D()).optional()}),oo=m({type:p("resource"),resource:C([rs,os]),annotations:It.optional(),_meta:T(c(),D()).optional()}),so=ss.extend({type:p("resource_link")}),qt=C([eo,to,ro,so,oo]),aa=m({role:Gt,content:qt}),ia=ge.extend({description:c().optional(),messages:v(aa)}),ca=Ie.extend({method:p("notifications/prompts/list_changed"),params:Me.optional()}),ua=m({title:c().optional(),readOnlyHint:E().optional(),destructiveHint:E().optional(),idempotentHint:E().optional(),openWorldHint:E().optional()}),la=m({taskSupport:Y(["required","optional","forbidden"]).optional()}),_r=m({...Et.shape,...Jt.shape,description:c().optional(),inputSchema:m({type:p("object"),properties:T(c(),Vt).optional(),required:v(c()).optional()}).catchall(D()),outputSchema:V({$schema:c().optional()}).optional(),annotations:ua.optional(),execution:la.optional(),_meta:T(c(),D()).optional()}),da=Wt.extend({method:p("tools/list")}),ma=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()})),pa=pr.extend({name:c(),arguments:T(c(),D()).optional()}),ha=_e.extend({method:p("tools/call"),params:pa}),fa=Ie.extend({method:p("notifications/tools/list_changed"),params:Me.optional()}),_a=m({autoRefresh:E().default(!0),debounceMs:k().int().nonnegative().default(300)}),as=Y(["debug","info","notice","warning","error","critical","alert","emergency"]),ga=Te.extend({level:as}),Sa=_e.extend({method:p("logging/setLevel"),params:ga}),va=Me.extend({level:as,logger:c().optional(),data:D()}),no=Ie.extend({method:p("notifications/message"),params:va}),ba=m({name:c().optional()}),ya=m({hints:v(ba).optional(),costPriority:k().min(0).max(1).optional(),speedPriority:k().min(0).max(1).optional(),intelligencePriority:k().min(0).max(1).optional()}),wa=m({mode:Y(["auto","required","none"]).optional()}),za=m({type:p("tool_result"),toolUseId:c().describe("The unique identifier for the corresponding tool call."),content:v(qt),structuredContent:D().optional(),isError:E().optional(),_meta:T(c(),D()).optional()}),Ra=Lo("type",[eo,to,ro]),mr=Lo("type",[eo,to,ro,na,za]),xa=m({role:Gt,content:C([mr,v(mr)]),_meta:T(c(),D()).optional()}),ka=pr.extend({messages:v(xa),modelPreferences:ya.optional(),systemPrompt:c().optional(),includeContext:Y(["none","thisServer","allServers"]).optional(),temperature:k().optional(),maxTokens:k().int(),stopSequences:v(c()).optional(),metadata:fe.optional(),tools:v(_r).optional(),toolChoice:wa.optional()}),Pa=_e.extend({method:p("sampling/createMessage"),params:ka}),Ta=ge.extend({model:c(),stopReason:F(Y(["endTurn","stopSequence","maxTokens"]).or(c())),role:Gt,content:Ra}),Ea=ge.extend({model:c(),stopReason:F(Y(["endTurn","stopSequence","maxTokens","toolUse"]).or(c())),role:Gt,content:C([mr,v(mr)])}),is=m({type:p("boolean"),title:c().optional(),description:c().optional(),default:E().optional()}),ao=m({type:p("string"),title:c().optional(),description:c().optional(),minLength:k().optional(),maxLength:k().optional(),format:Y(["email","uri","date","date-time"]).optional(),default:c().optional()}),io=m({type:Y(["number","integer"]),title:c().optional(),description:c().optional(),minimum:k().optional(),maximum:k().optional(),default:k().optional()}),cs=m({type:p("string"),title:c().optional(),description:c().optional(),enum:v(c()),default:c().optional()}),us=m({type:p("string"),title:c().optional(),description:c().optional(),oneOf:v(m({const:c(),title:c()})),default:c().optional()}),ls=m({type:p("string"),title:c().optional(),description:c().optional(),enum:v(c()),enumNames:v(c()).optional(),default:c().optional()}),$a=C([cs,us]),ds=m({type:p("array"),title:c().optional(),description:c().optional(),minItems:k().optional(),maxItems:k().optional(),items:m({type:p("string"),enum:v(c())}),default:v(c()).optional()}),ms=m({type:p("array"),title:c().optional(),description:c().optional(),minItems:k().optional(),maxItems:k().optional(),items:m({anyOf:v(m({const:c(),title:c()}))}),default:v(c()).optional()}),Ca=C([ds,ms]),Ia=C([ls,$a,Ca]),ps=C([Ia,is,ao,io]),co=pr.extend({mode:p("form").optional(),message:c(),requestedSchema:m({type:p("object"),properties:T(c(),ps),required:v(c()).optional()}).catchall(D())}),qa=pr.extend({mode:p("url"),message:c(),elicitationId:c(),url:c().url()}),Oa=C([co,qa]),Na=_e.extend({method:p("elicitation/create"),params:Oa}),ja=Me.extend({elicitationId:c()}),Ma=Ie.extend({method:p("notifications/elicitation/complete"),params:ja}),Aa=ge.extend({action:Y(["accept","decline","cancel"]),content:Jr((e)=>e===null?void 0:e,T(c(),C([c(),k(),E(),v(c())])).optional())}),La=m({type:p("ref/resource"),uri:c()}),Ua=m({type:p("ref/prompt"),name:c()}),Da=Te.extend({ref:C([Ua,La]),argument:m({name:c(),value:c()}),context:m({arguments:T(c(),c()).optional()}).optional()}),Za=_e.extend({method:p("completion/complete"),params:Da}),Ha=ge.extend({completion:V({values:v(c()).max(100),total:F(k().int()),hasMore:F(E())})}),Fa=m({uri:c().startsWith("file://"),name:c().optional(),_meta:T(c(),D()).optional()}),Va=_e.extend({method:p("roots/list"),params:Te.optional()}),Ba=ge.extend({roots:v(Fa)}),Ja=Ie.extend({method:p("notifications/roots/list_changed"),params:Me.optional()}),yc=V({ttl:k().optional(),pollInterval:k().optional()}),Wa=Y(["working","input_required","completed","failed","cancelled"]),Yt=m({taskId:c(),status:Wa,ttl:C([k(),Br()]),createdAt:c(),lastUpdatedAt:c(),pollInterval:F(k()),statusMessage:F(c())}),wc=ge.extend({task:Yt}),Ka=Me.merge(Yt),zc=Ie.extend({method:p("notifications/tasks/status"),params:Ka}),Rc=_e.extend({method:p("tasks/get"),params:Te.extend({taskId:c()})}),xc=ge.merge(Yt),kc=_e.extend({method:p("tasks/result"),params:Te.extend({taskId:c()})}),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:c()})}),Cc=ge.merge(Yt),Ic=C([Qo,Go,Tn,Za,Sa,sa,ta,qn,Nn,An,Zn,Fn,Bn,ha,da]),qc=C([Ko,es,Xo,Ja]),Oc=C([hr,Ta,Ea,Aa,Ba]),Nc=C([Qo,Pa,Na,Va]),jc=C([Ko,es,no,Xn,Un,fa,ca,Wn,Ma]),Mc=C([hr,Pn,fr,Ha,ia,ra,On,jn,Ln,gr,ma,Gn]);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:c().url(),authorization_servers:v(Ee).optional(),jwks_uri:c().url().optional(),scopes_supported:v(c()).optional(),bearer_methods_supported:v(c()).optional(),resource_signing_alg_values_supported:v(c()).optional(),resource_name:c().optional(),resource_documentation:c().optional(),resource_policy_uri:c().url().optional(),resource_tos_uri:c().url().optional(),tls_client_certificate_bound_access_tokens:E().optional(),authorization_details_types_supported:v(c()).optional(),dpop_signing_alg_values_supported:v(c()).optional(),dpop_bound_access_tokens_required:E().optional()}),uo=V({issuer:c(),authorization_endpoint:Ee,token_endpoint:Ee,registration_endpoint:Ee.optional(),scopes_supported:v(c()).optional(),response_types_supported:v(c()),response_modes_supported:v(c()).optional(),grant_types_supported:v(c()).optional(),token_endpoint_auth_methods_supported:v(c()).optional(),token_endpoint_auth_signing_alg_values_supported:v(c()).optional(),service_documentation:Ee.optional(),revocation_endpoint:Ee.optional(),revocation_endpoint_auth_methods_supported:v(c()).optional(),revocation_endpoint_auth_signing_alg_values_supported:v(c()).optional(),introspection_endpoint:c().optional(),introspection_endpoint_auth_methods_supported:v(c()).optional(),introspection_endpoint_auth_signing_alg_values_supported:v(c()).optional(),code_challenge_methods_supported:v(c()).optional(),client_id_metadata_document_supported:E().optional(),authorization_response_iss_parameter_supported:E().optional().catch(void 0),dpop_signing_alg_values_supported:v(c()).optional()}),Ga=V({issuer:c(),authorization_endpoint:Ee,token_endpoint:Ee,userinfo_endpoint:Ee.optional(),jwks_uri:Ee,registration_endpoint:Ee.optional(),scopes_supported:v(c()).optional(),response_types_supported:v(c()),response_modes_supported:v(c()).optional(),grant_types_supported:v(c()).optional(),acr_values_supported:v(c()).optional(),subject_types_supported:v(c()),id_token_signing_alg_values_supported:v(c()),id_token_encryption_alg_values_supported:v(c()).optional(),id_token_encryption_enc_values_supported:v(c()).optional(),userinfo_signing_alg_values_supported:v(c()).optional(),userinfo_encryption_alg_values_supported:v(c()).optional(),userinfo_encryption_enc_values_supported:v(c()).optional(),request_object_signing_alg_values_supported:v(c()).optional(),request_object_encryption_alg_values_supported:v(c()).optional(),request_object_encryption_enc_values_supported:v(c()).optional(),token_endpoint_auth_methods_supported:v(c()).optional(),token_endpoint_auth_signing_alg_values_supported:v(c()).optional(),display_values_supported:v(c()).optional(),claim_types_supported:v(c()).optional(),claims_supported:v(c()).optional(),service_documentation:c().optional(),claims_locales_supported:v(c()).optional(),ui_locales_supported:v(c()).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({...Ga.shape,...uo.pick({code_challenge_methods_supported:!0}).shape}),lo=m({access_token:c(),id_token:c().optional(),token_type:c(),expires_in:Ny().optional(),scope:c().optional(),refresh_token:c().optional(),issuer:c().optional().catch(void 0)}).strip(),Ya=m({issued_token_type:p("urn:ietf:params:oauth:token-type:id-jag"),access_token:c(),token_type:c().optional(),expires_in:k().optional(),scope:c().optional()}).strip(),mo=m({error:c(),error_description:c().optional(),error_uri:c().optional()}),Dl=Ee.optional().or(p("").transform(()=>{return})),Xa=m({redirect_uris:v(Ee),token_endpoint_auth_method:c().optional(),grant_types:v(c()).optional(),response_types:v(c()).optional(),application_type:c().optional(),client_name:c().optional(),client_uri:Ee.optional(),logo_uri:Dl,scope:c().optional(),contacts:v(c()).optional(),tos_uri:Dl,policy_uri:c().optional(),jwks_uri:Ee.optional(),jwks:pc().optional(),software_id:c().optional(),software_version:c().optional(),software_statement:c().optional()}).strip(),Qa=m({client_id:c(),client_secret:c().optional(),client_id_issued_at:k().optional(),client_secret_expires_at:k().optional(),issuer:c().optional().catch(void 0)}).strip(),_s=Xa.merge(Qa),Ac=m({error:c(),error_description:c().optional()}).strip(),Lc=m({token:c(),token_type_hint:c().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 ni(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=bn(()=>C([c(),k(),E(),Br(),T(c(),e),v(e)])),t=T(c(),e),r=C([c(),k().int()]),o=c(),s=m({ttl:k().optional()}),n=m({taskId:c()}),a=V({progressToken:r.optional(),"io.modelcontextprotocol/related-task":n.optional()}),i=m({_meta:a.optional()}),u=i.extend({task:s.optional()}),l=m({method:c(),params:i.loose().optional()}),d=m({_meta:a.optional()}),f=m({method:c(),params:d.loose().optional()}),h=V({_meta:a.optional()}),g=C([c(),k().int()]),b=h.strict(),_=d.extend({requestId:g.optional(),reason:c().optional()}),w=f.extend({method:p("notifications/cancelled"),params:_}),I=m({src:c(),mimeType:c().optional(),sizes:v(c()).optional(),theme:Y(["light","dark"]).optional()}),A=m({icons:v(I).optional()}),z=m({name:c(),title:c().optional()}),q=z.extend({...z.shape,...A.shape,version:c(),websiteUrl:c().optional(),description:c().optional()}),x=Ft(m({applyDefaults:E().optional()}),t),R=Jr((je)=>{if(je&&typeof je==="object"&&!Array.isArray(je)&&Object.keys(je).length===0)return{form:{}};return je},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(c(),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(c(),t).optional()}),ne=i.extend({protocolVersion:c(),capabilities:X,clientInfo:q}),xe=l.extend({method:p("initialize"),params:ne}),te=m({experimental:T(c(),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(c(),t).optional()}),ae=h.extend({protocolVersion:c(),capabilities:te,serverInfo:q,instructions:c().optional()}),re=f.extend({method:p("notifications/initialized"),params:d.optional()}),de=l.extend({method:p("ping"),params:i.optional()}),bt=m({progress:k(),total:F(k()),message:F(c())}),Fe=m({...d.shape,...bt.shape,progressToken:r}),st=f.extend({method:p("notifications/progress"),params:Fe}),yt=i.extend({cursor:o.optional()}),Ge=l.extend({params:yt.optional()}),Le=h.extend({nextCursor:o.optional()}),Dt=m({uri:c(),mimeType:F(c()),_meta:T(c(),D()).optional()}),Zt=Dt.extend({text:c()}),wt=c().refine((je)=>{try{return atob(je),!0}catch{return!1}},{message:"Invalid Base64 string"}),Oe=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:c(),description:F(c()),mimeType:F(c()),size:F(k()),annotations:De.optional(),_meta:F(V({}))}),Cr=m({...z.shape,...A.shape,uriTemplate:c(),description:F(c()),mimeType:F(c()),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)}),at=i.extend({uri:c()}),zt=at,Rt=l.extend({method:p("resources/read"),params:zt}),or=h.extend({contents:v(C([Zt,Oe]))}),xt=f.extend({method:p("notifications/resources/list_changed"),params:d.optional()}),Ir=at,N=l.extend({method:p("resources/subscribe"),params:Ir}),kt=at,B=l.extend({method:p("resources/unsubscribe"),params:kt}),U=d.extend({uri:c()}),Q=f.extend({method:p("notifications/resources/updated"),params:U}),j=m({name:c(),description:F(c()),required:F(E())}),O=m({...z.shape,...A.shape,description:F(c()),arguments:F(v(j)),_meta:F(V({}))}),K=Ge.extend({method:p("prompts/list")}),J=Le.extend({prompts:v(O)}),ke=i.extend({name:c(),arguments:T(c(),c()).optional()}),qr=l.extend({method:p("prompts/get"),params:ke}),Pt=m({type:p("text"),text:c(),annotations:De.optional(),_meta:T(c(),D()).optional()}),Or=m({type:p("image"),data:wt,mimeType:c(),annotations:De.optional(),_meta:T(c(),D()).optional()}),Nr=m({type:p("audio"),data:wt,mimeType:c(),annotations:De.optional(),_meta:T(c(),D()).optional()}),Cs=m({type:p("tool_use"),name:c(),id:c(),input:T(c(),D()),_meta:T(c(),D()).optional()}),sr=m({type:p("resource"),resource:C([Zt,Oe]),annotations:De.optional(),_meta:T(c(),D()).optional()}),Is=dt.extend({type:p("resource_link")}),it=C([Pt,Or,Nr,Is,sr]),zo=m({role:Ue,content:it}),Ro=h.extend({description:c().optional(),messages:v(zo)}),jr=f.extend({method:p("notifications/prompts/list_changed"),params:d.optional()}),qs=m({title:c().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:c().optional(),inputSchema:m({type:p("object"),properties:T(c(),e).optional(),required:v(c()).optional()}).catchall(D()),outputSchema:m({type:p("object"),properties:T(c(),e).optional(),required:v(c()).optional()}).catchall(D()).optional(),annotations:qs.optional(),execution:xo.optional(),_meta:T(c(),D()).optional()}),ko=Ge.extend({method:p("tools/list")}),Po=Le.extend({tools:v(Mr)}),To=h.extend({content:v(it),structuredContent:T(c(),D()).optional(),isError:E().optional()}),Ne=u.extend({name:c(),arguments:T(c(),D()).optional()}),Os=l.extend({method:p("tools/call"),params:Ne}),ki=f.extend({method:p("notifications/tools/list_changed"),params:d.optional()}),Eo=Y(["debug","info","notice","warning","error","critical","alert","emergency"]),Ns=i.extend({level:Eo}),js=l.extend({method:p("logging/setLevel"),params:Ns}),Ms=d.extend({level:Eo,logger:c().optional(),data:D()}),As=f.extend({method:p("notifications/message"),params:Ms}),Ls=m({name:c().optional()}),Us=m({hints:v(Ls).optional(),costPriority:k().min(0).max(1).optional(),speedPriority:k().min(0).max(1).optional(),intelligencePriority:k().min(0).max(1).optional()}),Ds=m({mode:Y(["auto","required","none"]).optional()}),Pi=m({type:p("tool_result"),toolUseId:c().describe("The unique identifier for the corresponding tool call."),content:v(it),structuredContent:m({}).loose().optional(),isError:E().optional(),_meta:T(c(),D()).optional()}),Zs=Lo("type",[Pt,Or,Nr]),nr=Lo("type",[Pt,Or,Nr,Cs,Pi]),Hs=m({role:Ue,content:C([nr,v(nr)]),_meta:T(c(),D()).optional()}),Fs=u.extend({messages:v(Hs),modelPreferences:Us.optional(),systemPrompt:c().optional(),includeContext:Y(["none","thisServer","allServers"]).optional(),temperature:k().optional(),maxTokens:k().int(),stopSequences:v(c()).optional(),metadata:t.optional(),tools:v(Mr).optional(),toolChoice:Ds.optional()}),Vs=l.extend({method:p("sampling/createMessage"),params:Fs}),Bs=h.extend({model:c(),stopReason:F(Y(["endTurn","stopSequence","maxTokens"]).or(c())),role:Ue,content:Zs}),Js=h.extend({model:c(),stopReason:F(Y(["endTurn","stopSequence","maxTokens","toolUse"]).or(c())),role:Ue,content:C([nr,v(nr)])}),Ws=m({type:p("boolean"),title:c().optional(),description:c().optional(),default:E().optional()}),Ks=m({type:p("string"),title:c().optional(),description:c().optional(),minLength:k().optional(),maxLength:k().optional(),format:Y(["email","uri","date","date-time"]).optional(),default:c().optional()}),Gs=m({type:Y(["number","integer"]),title:c().optional(),description:c().optional(),minimum:k().optional(),maximum:k().optional(),default:k().optional()}),Ys=m({type:p("string"),title:c().optional(),description:c().optional(),enum:v(c()),default:c().optional()}),Xs=m({type:p("string"),title:c().optional(),description:c().optional(),oneOf:v(m({const:c(),title:c()})),default:c().optional()}),Qs=m({type:p("string"),title:c().optional(),description:c().optional(),enum:v(c()),enumNames:v(c()).optional(),default:c().optional()}),en=C([Ys,Xs]),Ar=m({type:p("array"),title:c().optional(),description:c().optional(),minItems:k().optional(),maxItems:k().optional(),items:m({type:p("string"),enum:v(c())}),default:v(c()).optional()}),Lr=m({type:p("array"),title:c().optional(),description:c().optional(),minItems:k().optional(),maxItems:k().optional(),items:m({anyOf:v(m({const:c(),title:c()}))}),default:v(c()).optional()}),Ti=C([Ar,Lr]),Ei=C([Qs,en,Ti]),Qe=C([Ei,Ws,Ks,Gs]),et=u.extend({mode:p("form").optional(),message:c(),requestedSchema:m({type:p("object"),properties:T(c(),Qe),required:v(c()).optional()}).catchall(D())}),tn=u.extend({mode:p("url"),message:c(),elicitationId:c(),url:c().url()}),mt=C([et,tn]),$i=l.extend({method:p("elicitation/create"),params:mt}),Ci=d.extend({elicitationId:c()}),Ii=f.extend({method:p("notifications/elicitation/complete"),params:Ci}),qi=h.extend({action:Y(["accept","decline","cancel"]),content:Jr((je)=>je===null?void 0:je,T(c(),C([c(),k(),E(),v(c())])).optional())}),Oi=m({type:p("ref/resource"),uri:c()}),Ni=m({type:p("ref/prompt"),name:c()}),ji=i.extend({ref:C([Ni,Oi]),argument:m({name:c(),value:c()}),context:m({arguments:T(c(),c()).optional()}).optional()}),rn=l.extend({method:p("completion/complete"),params:ji}),Mi=h.extend({completion:V({values:v(c()).max(100),total:F(k().int()),hasMore:F(E())})}),Ai=m({uri:c().startsWith("file://"),name:c().optional(),_meta:T(c(),D()).optional()}),$o=l.extend({method:p("roots/list"),params:i.optional()}),on=h.extend({roots:v(Ai)}),Li=f.extend({method:p("notifications/roots/list_changed"),params:d.optional()}),Ui=V({ttl:k().optional(),pollInterval:k().optional()}),sn=Y(["working","input_required","completed","failed","cancelled"]),ar=m({taskId:c(),status:sn,ttl:C([k(),Br()]),createdAt:c(),lastUpdatedAt:c(),pollInterval:F(k()),statusMessage:F(c())}),Be=h.extend({task:ar}),Di=d.merge(ar),Ur=f.extend({method:p("notifications/tasks/status"),params:Di}),Co=l.extend({method:p("tasks/get"),params:i.extend({taskId:c()})}),Io=h.merge(ar),qo=l.extend({method:p("tasks/result"),params:i.extend({taskId:c()})}),Tu=h.loose(),Ze=Ge.extend({method:p("tasks/list")}),ye=Le.extend({tasks:v(ar)}),Dr=l.extend({method:p("tasks/cancel"),params:i.extend({taskId:c()})});return{JSONValueSchema:e,JSONObjectSchema:t,ProgressTokenSchema:r,CursorSchema:o,TaskMetadataSchema:s,RelatedTaskMetadataSchema:n,RequestMetaSchema:a,BaseRequestParamsSchema:i,TaskAugmentedRequestParamsSchema:u,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:ae,InitializedNotificationSchema:re,PingRequestSchema:de,ProgressSchema:bt,ProgressNotificationParamsSchema:Fe,ProgressNotificationSchema:st,PaginatedRequestParamsSchema:yt,PaginatedRequestSchema:Ge,PaginatedResultSchema:Le,ResourceContentsSchema:Dt,TextResourceContentsSchema:Zt,BlobResourceContentsSchema:Oe,RoleSchema:Ue,AnnotationsSchema:De,ResourceSchema:dt,ResourceTemplateSchema:Cr,ListResourcesRequestSchema:Ye,ListResourcesResultSchema:Xe,ListResourceTemplatesRequestSchema:Ve,ListResourceTemplatesResultSchema:nt,ResourceRequestParamsSchema:at,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:Cs,EmbeddedResourceSchema:sr,ResourceLinkSchema:Is,ContentBlockSchema:it,PromptMessageSchema:zo,GetPromptResultSchema:Ro,PromptListChangedNotificationSchema:jr,ToolAnnotationsSchema:qs,ToolExecutionSchema:xo,ToolSchema:Mr,ListToolsRequestSchema:ko,ListToolsResultSchema:Po,CallToolResultSchema:To,CallToolRequestParamsSchema:Ne,CallToolRequestSchema:Os,ToolListChangedNotificationSchema:ki,LoggingLevelSchema:Eo,SetLevelRequestParamsSchema:Ns,SetLevelRequestSchema:js,LoggingMessageNotificationParamsSchema:Ms,LoggingMessageNotificationSchema:As,ModelHintSchema:Ls,ModelPreferencesSchema:Us,ToolChoiceSchema:Ds,ToolResultContentSchema:Pi,SamplingContentSchema:Zs,SamplingMessageContentBlockSchema:nr,SamplingMessageSchema:Hs,CreateMessageRequestParamsSchema:Fs,CreateMessageRequestSchema:Vs,CreateMessageResultSchema:Bs,CreateMessageResultWithToolsSchema:Js,BooleanSchemaSchema:Ws,StringSchemaSchema:Ks,NumberSchemaSchema:Gs,UntitledSingleSelectEnumSchemaSchema:Ys,TitledSingleSelectEnumSchemaSchema:Xs,LegacyTitledEnumSchemaSchema:Qs,SingleSelectEnumSchemaSchema:en,UntitledMultiSelectEnumSchemaSchema:Ar,TitledMultiSelectEnumSchemaSchema:Lr,MultiSelectEnumSchemaSchema:Ti,EnumSchemaSchema:Ei,PrimitiveSchemaDefinitionSchema:Qe,ElicitRequestFormParamsSchema:et,ElicitRequestURLParamsSchema:tn,ElicitRequestParamsSchema:mt,ElicitRequestSchema:$i,ElicitationCompleteNotificationParamsSchema:Ci,ElicitationCompleteNotificationSchema:Ii,ElicitResultSchema:qi,ResourceTemplateReferenceSchema:Oi,PromptReferenceSchema:Ni,CompleteRequestParamsSchema:ji,CompleteRequestSchema:rn,CompleteResultSchema:Mi,RootSchema:Ai,ListRootsRequestSchema:$o,ListRootsResultSchema:on,RootsListChangedNotificationSchema:Li,TaskCreationParamsSchema:Ui,TaskStatusSchema:sn,TaskSchema:ar,CreateTaskResultSchema:Be,TaskStatusNotificationParamsSchema:Di,TaskStatusNotificationSchema:Ur,GetTaskRequestSchema:Co,GetTaskResultSchema:Io,GetTaskPayloadRequestSchema:qo,GetTaskPayloadResultSchema:Tu,ListTasksRequestSchema:Ze,ListTasksResultSchema:ye,CancelTaskRequestSchema:Dr,CancelTaskResultSchema:h.merge(ar),ClientRequestSchema:C([de,xe,rn,js,qr,K,Ye,Ve,Rt,N,B,Os,ko,Co,qo,Ze,Dr]),ClientNotificationSchema:C([w,st,re,Li,Ur]),ClientResultSchema:C([b,Bs,Js,qi,on,Io,ye,Be]),ServerRequestSchema:C([de,Vs,$i,$o,Co,qo,Ze,Dr]),ServerNotificationSchema:C([w,st,As,Q,xt,ki,jr,Ur,Ii]),ServerResultSchema:C([b,ae,Mi,Ro,J,Xe,nt,or,To,Po,Io,ye,Be]),CallToolResultWireSchema:D().superRefine((je,nb)=>{if(typeof je!=="object"||je===null||Array.isArray(je)||je.content!==void 0)return;for(let _m of K_)if(_m in je){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((u)=>o(u,!1));if(s===null||typeof s!=="object")return s;if(!n&&q_(s.$id))return s;let a={},i=!1;for(let[u,l]of Object.entries(s))if(n)a[u]=o(l,!1);else if((u==="$ref"||u==="$dynamicRef")&&typeof l==="string")a[u]=l==="#"?"#/properties/result":l.startsWith("#/")?`#/properties/result${l.slice(1)}`:l;else if(u==="$recursiveRef"&&l==="#"&&r)i=!0;else if(Dy.has(u))a[u]=l;else if(Zy.has(u))a[u]=o(l,!0);else a[u]=o(l,!1);if(i)if("$ref"in a)a.allOf=[...Array.isArray(a.allOf)?a.allOf:[],{$ref:"#/properties/result"}];else a.$ref="#/properties/result";return a};return{...t!==void 0&&{$schema:t},type:"object",properties:{result: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=bn(()=>C([c(),k(),E(),Br(),T(c(),e),v(e)])),t=T(c(),e),r=C([c(),k().int()]),o=c(),s=C([c(),k().int()]),n=Y(["user","assistant"]),a=Y(["debug","info","notice","warning","error","critical","alert","emergency"]),i=c().refine((ye)=>{try{return atob(ye),!0}catch{return!1}},{message:"Invalid Base64 string"}),u=m({ttl:k().optional()}),l=m({taskId:c()}),d=V({progressToken:r.optional(),"io.modelcontextprotocol/related-task":l.optional()}),f=m({_meta:d.optional()}),h=f.extend({task:u.optional()}),g=m({_meta:d.optional()}),b=m({method:c(),params:g.loose().optional()}),_=m({src:c(),mimeType:c().optional(),sizes:v(c()).optional(),theme:Y(["light","dark"]).optional()}),w=m({icons:v(_).optional()}),I=m({name:c(),title:c().optional()}),A=I.extend({...I.shape,...w.shape,version:c(),websiteUrl:c().optional(),description:c().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(c(),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(c(),t).optional()}),ee=m({experimental:T(c(),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(c(),t).optional()}),X=m({progress:k(),total:F(k()),message:F(c())}),ne=m({...g.shape,...X.shape,progressToken:r}),xe=b.extend({method:p("notifications/progress"),params:ne}),te=g.extend({level:a,logger:c().optional(),data:D()}),ae=b.extend({method:p("notifications/message"),params:te}),re=m({uri:c(),mimeType:F(c()),_meta:T(c(),D()).optional()}),de=re.extend({text:c()}),bt=re.extend({blob:i}),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:c(),description:F(c()),mimeType:F(c()),size:F(k()),annotations:Fe.optional(),_meta:F(V({}))}),yt=m({...I.shape,...w.shape,uriTemplate:c(),description:F(c()),mimeType:F(c()),annotations:Fe.optional(),_meta:F(V({}))}),Ge=b.extend({method:p("notifications/resources/list_changed"),params:g.optional()}),Le=g.extend({uri:c()}),Dt=b.extend({method:p("notifications/resources/updated"),params:Le}),Zt=m({name:c(),description:F(c()),required:F(E())}),wt=m({...I.shape,...w.shape,description:F(c()),arguments:F(v(Zt)),_meta:F(V({}))}),Oe=b.extend({method:p("notifications/prompts/list_changed"),params:g.optional()}),Ue=m({type:p("text"),text:c(),annotations:Fe.optional(),_meta:T(c(),D()).optional()}),De=m({type:p("image"),data:i,mimeType:c(),annotations:Fe.optional(),_meta:T(c(),D()).optional()}),dt=m({type:p("audio"),data:i,mimeType:c(),annotations:Fe.optional(),_meta:T(c(),D()).optional()}),Cr=m({type:p("tool_use"),name:c(),id:c(),input:T(c(),D()),_meta:T(c(),D()).optional()}),Ye=m({type:p("resource"),resource:C([de,bt]),annotations:Fe.optional(),_meta:T(c(),D()).optional()}),Xe=st.extend({type:p("resource_link")}),Ve=C([Ue,De,dt,Xe,Ye]),nt=m({role:n,content:Ve}),at=m({title:c().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:c().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:c().optional(),description:c().optional(),default:E().optional()}),N=m({type:p("string"),title:c().optional(),description:c().optional(),minLength:k().optional(),maxLength:k().optional(),format:Y(["email","uri","date","date-time"]).optional(),default:c().optional()}),kt=m({type:Y(["number","integer"]),title:c().optional(),description:c().optional(),minimum:k().optional(),maximum:k().optional(),default:k().optional()}),B=m({type:p("string"),title:c().optional(),description:c().optional(),enum:v(c()),default:c().optional()}),U=m({type:p("string"),title:c().optional(),description:c().optional(),oneOf:v(m({const:c(),title:c()})),default:c().optional()}),Q=m({type:p("string"),title:c().optional(),description:c().optional(),enum:v(c()),enumNames:v(c()).optional(),default:c().optional()}),j=C([B,U]),O=m({type:p("array"),title:c().optional(),description:c().optional(),minItems:k().optional(),maxItems:k().optional(),items:m({type:p("string"),enum:v(c())}),default:v(c()).optional()}),K=m({type:p("array"),title:c().optional(),description:c().optional(),minItems:k().optional(),maxItems:k().optional(),items:m({anyOf:v(m({const:c(),title:c()}))}),default:v(c()).optional()}),J=C([O,K]),ke=C([Q,j,J]),qr=C([ke,Ir,N,kt]),Pt=h.extend({mode:p("form").optional(),message:c(),requestedSchema:m({type:p("object"),properties:T(c(),qr),required:v(c()).optional()}).catchall(D())}),Or=m({type:p("ref/resource"),uri:c()}),Nr=m({type:p("ref/prompt"),name:c()}),Cs=m({uri:c().startsWith("file://"),name:c().optional(),_meta:T(c(),D()).optional()}),sr=Z.shape,Is=m({experimental:sr.experimental,sampling:sr.sampling,elicitation:sr.elicitation,roots:sr.roots,extensions:sr.extensions}),it=ee.shape,zo=m({experimental:it.experimental,logging:it.logging,completions:it.completions,prompts:it.prompts,resources:it.resources,tools:it.tools,extensions:it.extensions}),Ro=V({progressToken:r.optional(),[Bt]:c(),[Uo]:A.optional(),[Kr]:Is,[Zo]:a.optional()}),jr=m({...I.shape,...w.shape,description:c().optional(),inputSchema:V({$schema:c().optional(),type:p("object")}),outputSchema:V({$schema:c().optional()}).optional(),annotations:at.optional(),_meta:T(c(),D()).optional()}),qs=m({type:p("tool_result"),toolUseId:c(),content:v(Ve),structuredContent:D().optional(),isError:E().optional(),_meta:T(c(),D()).optional()}),xo=C([Ue,De,dt,Cr,qs]),Mr=m({role:n,content:C([xo,v(xo)]),_meta:T(c(),D()).optional()}),ko=c(),Po=V({[$t]:A.optional().catch(void 0)}),To=Po.optional();function Ne(ye){return V({_meta:To,resultType:ko.default("complete"),...ye})}let Os=Ne({}),ki=Ne({nextCursor:o.optional()}),Eo=Ne({content:v(Ve),structuredContent:D().optional(),isError:E().optional()}),Ns=Ne({ttlMs:k().int().min(0),cacheScope:Y(["public","private"]),tools:v(jr),nextCursor:o.optional()}),js=Ne({ttlMs:k().int().min(0),cacheScope:Y(["public","private"]),prompts:v(wt),nextCursor:o.optional()}),Ms=Ne({description:c().optional(),messages:v(nt)}),As=Ne({ttlMs:k().int().min(0),cacheScope:Y(["public","private"]),resources:v(st),nextCursor:o.optional()}),Ls=Ne({ttlMs:k().int().min(0),cacheScope:Y(["public","private"]),resourceTemplates:v(yt),nextCursor:o.optional()}),Us=Ne({ttlMs:k().int().min(0),cacheScope:Y(["public","private"]),contents:v(C([de,bt]))}),Ds=Ne({completion:m({values:v(c()).max(100),total:k().int().optional(),hasMore:E().optional()}).loose()}),Pi=Ne({ttlMs:k().int().min(0),cacheScope:Y(["public","private"])}),Zs=Ne({ttlMs:k().int().min(0).catch(0),cacheScope:Y(["public","private"]).catch("private"),supportedVersions:v(c()),capabilities:zo,instructions:c().optional()}),nr=m({messages:v(Mr),modelPreferences:or.optional(),systemPrompt:c().optional(),includeContext:Y(["none","thisServer","allServers"]).optional(),temperature:k().optional(),maxTokens:k().int(),stopSequences:v(c()).optional(),metadata:t.optional(),tools:v(jr).optional(),toolChoice:xt.optional()}),Hs=m({method:p("sampling/createMessage"),params:nr}),Fs=m({method:p("roots/list"),params:m({_meta:T(c(),D()).optional()}).optional()}),Vs=m({...Mr.shape,model:c(),stopReason:c().optional()}),Bs=m({roots:v(Cs)}),Js=m({action:Y(["accept","decline","cancel"]),content:T(c(),C([c(),k(),E(),v(c())])).optional()}),Ws=m({mode:p("url"),message:c(),url:c().url()}),Ks=C([Pt,Ws]),Gs=m({method:p("elicitation/create"),params:Ks}),Ys=C([Hs,Fs,Gs]),Xs=C([Vs,Bs,Js]),Qs=T(c(),Ys),en=T(c(),Xs),Ar=Ne({inputRequests:Qs.optional(),requestState:c().optional()}),Lr={inputResponses:en.optional(),requestState:c().optional()},Ti=m({_meta:Ro,...Lr}),Ei=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:Ei.optional(),...Dr}).optional()})}let tn={name:c(),arguments:T(c(),D()).optional(),...Lr},mt={cursor:o.optional()},$i=Qe("tools/call",tn),Ci=Qe("tools/list",mt),Ii=Qe("prompts/list",mt),qi=Qe("prompts/get",{name:c(),arguments:T(c(),c()).optional(),...Lr}),Oi=Qe("resources/list",mt),Ni=Qe("resources/templates/list",mt),ji=Qe("resources/read",{uri:c(),...Lr}),rn={ref:C([Nr,Or]),argument:m({name:c(),value:c()}),context:m({arguments:T(c(),c()).optional()}).optional()},Mi=Qe("completion/complete",rn),Ai=Qe("server/discover",{}),$o=m({toolsListChanged:E().optional(),promptsListChanged:E().optional(),resourcesListChanged:E().optional(),resourceSubscriptions:v(c()).optional()}),on={notifications:$o},Li=Qe("subscriptions/listen",on),Ui=Po.extend({"io.modelcontextprotocol/subscriptionId":s}),sn=V({_meta:Ui,resultType:ko.default("complete")}),ar={"tools/call":et("tools/call",tn),"tools/list":et("tools/list",mt),"prompts/get":et("prompts/get",{name:c(),arguments:T(c(),c()).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:c()}),"completion/complete":et("completion/complete",rn),"server/discover":et("server/discover",{}),"subscriptions/listen":et("subscriptions/listen",on)};function Be(ye){return V({_meta:To,...ye})}let Di={"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:c().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(c()).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(c()),capabilities:zo,instructions:c().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:c().optional()}),qo=m({method:p("notifications/cancelled"),params:Io}),Tu={"notifications/cancelled":qo,"notifications/progress":xe,"notifications/message":ae,"notifications/resources/updated":Dt,"notifications/resources/list_changed":Ge,"notifications/tools/list_changed":zt,"notifications/prompts/list_changed":Oe,"notifications/subscriptions/acknowledged":Co},Ze=(ye)=>m({jsonrpc:p("2.0"),id:C([c(),k().int()]),result:ye}).strict();return{JSONValueSchema:e,JSONObjectSchema:t,ProgressTokenSchema:r,CursorSchema:o,RequestIdSchema:s,RoleSchema:n,LoggingLevelSchema:a,TaskMetadataSchema:u,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:ae,ResourceContentsSchema:re,TextResourceContentsSchema:de,BlobResourceContentsSchema:bt,AnnotationsSchema:Fe,ResourceSchema:st,ResourceTemplateSchema:yt,ResourceListChangedNotificationSchema:Ge,ResourceUpdatedNotificationParamsSchema:Le,ResourceUpdatedNotificationSchema:Dt,PromptArgumentSchema:Zt,PromptSchema:wt,PromptListChangedNotificationSchema:Oe,TextContentSchema:Ue,ImageContentSchema:De,AudioContentSchema:dt,ToolUseContentSchema:Cr,EmbeddedResourceSchema:Ye,ResourceLinkSchema:Xe,ContentBlockSchema:Ve,PromptMessageSchema:nt,ToolAnnotationsSchema:at,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:Cs,ClientCapabilities2026Schema:Is,ServerCapabilities2026Schema:zo,RequestMetaEnvelopeSchema:Ro,ToolSchema:jr,ToolResultContentSchema:qs,SamplingMessageContentBlockSchema:xo,SamplingMessageSchema:Mr,ResultTypeSchema:ko,ResultMetaSchema:Po,ResultSchema:Os,PaginatedResultSchema:ki,CallToolResultSchema:Eo,ListToolsResultSchema:Ns,ListPromptsResultSchema:js,GetPromptResultSchema:Ms,ListResourcesResultSchema:As,ListResourceTemplatesResultSchema:Ls,ReadResourceResultSchema:Us,CompleteResultSchema:Ds,CacheableResultSchema:Pi,DiscoverResultSchema:Zs,CreateMessageRequestParamsSchema:nr,CreateMessageRequestSchema:Hs,ListRootsRequestSchema:Fs,CreateMessageResultSchema:Vs,ListRootsResultSchema:Bs,ElicitResultSchema:Js,ElicitRequestURLParamsSchema:Ws,ElicitRequestParamsSchema:Ks,ElicitRequestSchema:Gs,InputRequestSchema:Ys,InputResponseSchema:Xs,InputRequestsSchema:Qs,InputResponsesSchema:en,InputRequiredResultSchema:Ar,InputResponseRequestParamsSchema:Ti,CallToolRequestSchema:$i,ListToolsRequestSchema:Ci,ListPromptsRequestSchema:Ii,GetPromptRequestSchema:qi,ListResourcesRequestSchema:Oi,ListResourceTemplatesRequestSchema:Ni,ReadResourceRequestSchema:ji,CompleteRequestSchema:Mi,DiscoverRequestSchema:Ai,SubscriptionFilterSchema:$o,SubscriptionsListenRequestSchema:Li,SubscriptionsListenResultMetaSchema:Ui,SubscriptionsListenResultSchema:sn,dispatchRequestSchemas:ar,dispatchResultSchemas:Di,NotificationMetaSchema:Ur,SubscriptionsAcknowledgedNotificationSchema:Co,CancelledNotificationParamsSchema:Io,CancelledNotificationSchema:qo,notificationSchemas2026:Tu,JSONRPCResultResponseSchema:Ze(Os),CallToolResultResponseSchema:Ze(C([Eo,Ar])),ListToolsResultResponseSchema:Ze(Ns),ListPromptsResultResponseSchema:Ze(js),GetPromptResultResponseSchema:Ze(C([Ms,Ar])),ListResourcesResultResponseSchema:Ze(As),ListResourceTemplatesResultResponseSchema:Ze(Ls),ReadResourceResultResponseSchema:Ze(C([Us,Ar])),CompleteResultResponseSchema:Ze(Ds),DiscoverResultResponseSchema:Ze(Zs),SubscriptionsListenResultResponseSchema:Ze(sn)}}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 ai({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 ag({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??[]}},ai=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}},ag=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:iw(r),n=og(o.cacheScope)?o.cacheScope:cw(r),a={...o,ttlMs:s,cacheScope:n};return delete a[od],a}function nw(e){return e!==null&&typeof e==="object"&&!Array.isArray(e)}function aw(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 iw(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 ig(){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)?ig().request[e]:void 0}function dw(e){return cg(e)?ig().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 ri(e){return e!==null&&typeof e==="object"&&!Array.isArray(e)}function ei(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((i)=>ri(i)&&("execution"in i)))s().tools=n.map((i)=>{if(!ri(i)||!("execution"in i))return i;let u={...i};return delete u.execution,u});let a=t.capabilities;if(ri(a)&&"tasks"in a){let i={...a};delete i.tasks,s().capabilities=i}return r}var nd={era:"2026-07-28",hasRequestMethod:lg,hasNotificationMethod:dg,hasInputRequestMethod:(e)=>Zl(e)!==void 0,validateRequest:(e,t)=>ei(pw(e),t),validateResult:(e,t)=>ei(hw(e),t),validateNotification:(e,t)=>ei(fw(e),t),validateInputRequest:(e,t)=>ei(Zl(e),t),validateInputResponse:(e,t)=>ei(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((a)=>a.key===n&&a.problem==="missing"))continue;t.push({key:n,problem:o.message})}return t},projectCallToolResult:(e)=>W_(e),inputRequestSchema:Zl,decodeResult(e,t){if(!ri(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 a=t.inputRequests,i=ri(a)?a:{},u=t.requestState,l=t._meta===void 0?void 0:Sr().ResultMetaSchema.safeParse(t._meta),d=l?.success?l.data:void 0;if(Object.keys(i).length===0&&typeof u!=="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:i,...typeof u==="string"&&{requestState:u},...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 a=s.safeParse(t);if(!a.success)return{kind:"invalid",error:new L(M.InvalidResult,`Invalid result for ${e}: ${a.error}`,{method:e})}}let n={...t};return delete n.resultType,{kind:"complete",result:n}},encodeResult(e,t,r){return aw(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:()=>is,CallToolRequestParamsSchema:()=>pa,CallToolRequestSchema:()=>ha,CallToolResultSchema:()=>gr,CancelTaskRequestSchema:()=>$c,CancelTaskResultSchema:()=>Cc,CancelledNotificationParamsSchema:()=>zn,CancelledNotificationSchema:()=>Ko,ClientCapabilitiesSchema:()=>xn,ClientNotificationSchema:()=>qc,ClientRequestSchema:()=>Ic,ClientResultSchema:()=>Oc,ClientTasksCapabilitySchema:()=>Sc,CompatibilityCallToolResultSchema:()=>bc,CompleteRequestParamsSchema:()=>Da,CompleteRequestSchema:()=>Za,CompleteResultSchema:()=>Ha,ContentBlockSchema:()=>qt,CreateMessageRequestParamsSchema:()=>ka,CreateMessageRequestSchema:()=>Pa,CreateMessageResultSchema:()=>Ta,CreateMessageResultWithToolsSchema:()=>Ea,CreateTaskResultSchema:()=>wc,CursorSchema:()=>Fo,DiscoverRequestSchema:()=>Tn,DiscoverResultSchema:()=>fr,ElicitRequestFormParamsSchema:()=>co,ElicitRequestParamsSchema:()=>Oa,ElicitRequestSchema:()=>Na,ElicitRequestURLParamsSchema:()=>qa,ElicitResultSchema:()=>Aa,ElicitationCompleteNotificationParamsSchema:()=>ja,ElicitationCompleteNotificationSchema:()=>Ma,EmbeddedResourceSchema:()=>oo,EmptyResultSchema:()=>hr,EnumSchemaSchema:()=>Ia,GetPromptRequestParamsSchema:()=>oa,GetPromptRequestSchema:()=>sa,GetPromptResultSchema:()=>ia,GetTaskPayloadRequestSchema:()=>kc,GetTaskPayloadResultSchema:()=>Pc,GetTaskRequestSchema:()=>Rc,GetTaskResultSchema:()=>xc,IconSchema:()=>Rn,IconsSchema:()=>Jt,ImageContentSchema:()=>to,ImplementationSchema:()=>Ct,InitializeRequestParamsSchema:()=>kn,InitializeRequestSchema:()=>Go,InitializeResultSchema:()=>Pn,InitializedNotificationSchema:()=>Xo,JSONArraySchema:()=>_c,JSONObjectSchema:()=>fe,JSONRPCErrorResponseSchema:()=>Xr,JSONRPCMessageSchema:()=>_t,JSONRPCNotificationSchema:()=>Wo,JSONRPCRequestSchema:()=>Jo,JSONRPCResponseSchema:()=>gc,JSONRPCResultResponseSchema:()=>Yr,JSONValueSchema:()=>Vt,LegacyTitledEnumSchemaSchema:()=>ls,ListChangedOptionsBaseSchema:()=>_a,ListPromptsRequestSchema:()=>ta,ListPromptsResultSchema:()=>ra,ListResourceTemplatesRequestSchema:()=>Nn,ListResourceTemplatesResultSchema:()=>jn,ListResourcesRequestSchema:()=>qn,ListResourcesResultSchema:()=>On,ListRootsRequestSchema:()=>Va,ListRootsResultSchema:()=>Ba,ListTasksRequestSchema:()=>Tc,ListTasksResultSchema:()=>Ec,ListToolsRequestSchema:()=>da,ListToolsResultSchema:()=>ma,LoggingLevelSchema:()=>as,LoggingMessageNotificationParamsSchema:()=>va,LoggingMessageNotificationSchema:()=>no,ModelHintSchema:()=>ba,ModelPreferencesSchema:()=>ya,MultiSelectEnumSchemaSchema:()=>Ca,NotificationSchema:()=>Ie,NotificationsParamsSchema:()=>Me,NumberSchemaSchema:()=>io,PaginatedRequestParamsSchema:()=>Cn,PaginatedRequestSchema:()=>Wt,PaginatedResultSchema:()=>Kt,PingRequestSchema:()=>Qo,PrimitiveSchemaDefinitionSchema:()=>ps,ProgressNotificationParamsSchema:()=>$n,ProgressNotificationSchema:()=>es,ProgressSchema:()=>En,ProgressTokenSchema:()=>Ho,PromptArgumentSchema:()=>Qn,PromptListChangedNotificationSchema:()=>ca,PromptMessageSchema:()=>aa,PromptReferenceSchema:()=>Ua,PromptSchema:()=>ea,ReadResourceRequestParamsSchema:()=>Mn,ReadResourceRequestSchema:()=>An,ReadResourceResultSchema:()=>Ln,RelatedTaskMetadataSchema:()=>wn,RequestIdSchema:()=>ft,RequestMetaSchema:()=>Vo,RequestSchema:()=>_e,ResourceContentsSchema:()=>ts,ResourceLinkSchema:()=>so,ResourceListChangedNotificationSchema:()=>Un,ResourceRequestParamsSchema:()=>Qr,ResourceSchema:()=>ss,ResourceTemplateReferenceSchema:()=>La,ResourceTemplateSchema:()=>In,ResourceUpdatedNotificationParamsSchema:()=>Yn,ResourceUpdatedNotificationSchema:()=>Xn,ResultMetaObjectSchema:()=>Bo,ResultSchema:()=>ge,RoleSchema:()=>Gt,RootSchema:()=>Fa,RootsListChangedNotificationSchema:()=>Ja,SamplingContentSchema:()=>Ra,SamplingMessageContentBlockSchema:()=>mr,SamplingMessageSchema:()=>xa,ServerCapabilitiesSchema:()=>Yo,ServerNotificationSchema:()=>jc,ServerRequestSchema:()=>Nc,ServerResultSchema:()=>Mc,ServerTasksCapabilitySchema:()=>vc,SetLevelRequestParamsSchema:()=>ga,SetLevelRequestSchema:()=>Sa,SingleSelectEnumSchemaSchema:()=>$a,StringSchemaSchema:()=>ao,SubscribeRequestParamsSchema:()=>Dn,SubscribeRequestSchema:()=>Zn,SubscriptionFilterSchema:()=>ns,SubscriptionsAcknowledgedNotificationParamsSchema:()=>Jn,SubscriptionsAcknowledgedNotificationSchema:()=>Wn,SubscriptionsListenRequestParamsSchema:()=>Vn,SubscriptionsListenRequestSchema:()=>Bn,SubscriptionsListenResultMetaSchema:()=>Kn,SubscriptionsListenResultSchema:()=>Gn,TaskAugmentedRequestParamsSchema:()=>pr,TaskCreationParamsSchema:()=>yc,TaskMetadataSchema:()=>yn,TaskSchema:()=>Yt,TaskStatusNotificationParamsSchema:()=>Ka,TaskStatusNotificationSchema:()=>zc,TaskStatusSchema:()=>Wa,TextContentSchema:()=>eo,TextResourceContentsSchema:()=>rs,TitledMultiSelectEnumSchemaSchema:()=>ms,TitledSingleSelectEnumSchemaSchema:()=>us,ToolAnnotationsSchema:()=>ua,ToolChoiceSchema:()=>wa,ToolExecutionSchema:()=>la,ToolListChangedNotificationSchema:()=>fa,ToolResultContentSchema:()=>za,ToolSchema:()=>_r,ToolUseContentSchema:()=>na,UnsubscribeRequestParamsSchema:()=>Hn,UnsubscribeRequestSchema:()=>Fn,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 ad=(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 id(e){let t=[],r=new Map,o,s=(a,i,u)=>{if(a===null||typeof a!=="object")return;let l=a;if(L_ in l){if(!u||i.length===0)return`${Fc(i)}: 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(i)}: x-mcp-header MUST be a non-empty string`;if(!ww.test(f))return`${Fc(i)}: 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(i)}: 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:i,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,[...i,f],u);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,[...i,`<${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 ti(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=ic(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=ic(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 si(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:ti([ao,cs,us,ls]),number:ti([io]),integer:ti([io]),boolean:ti([is]),array:ti([ds,ms])},Zw=new Set(ao.shape.format.unwrap().options);function Hw(e,t,r,o){if(!si(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[a,i]of Object.entries(e))if(s.has(a)||ud(a))n[a]=i;else if(a==="pattern"&&e.type==="string"&&typeof e.format==="string"){if(!Zw.has(e.format))n[a]=i;else if(typeof i!=="string"||!Aw(e.format,i,r))o.push(`${t}.${a}`)}else o.push(`${t}.${a}`);return n}function Fw(e,t){let r={},o=[];for(let[s,n]of Object.entries(e))if(s==="properties"&&si(n))r[s]=Object.fromEntries(Object.entries(n).map(([a,i])=>[a,Hw(i,`properties.${a}`,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(!si(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(!si(e)||!si(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((a)=>!Object.prototype.hasOwnProperty.call(o.data.properties,a));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:a}=e,i=e.flowStartedAt??Date.now(),u=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:u.inputRequests,...u.requestState!==void 0&&{requestState:u.requestState}}});s.onprogress?.({progress:l,message:`Fulfilling input required by '${r}' (round ${l})`});let d=Object.entries(u.inputRequests??{}),f;if(d.length>0){let b=ez(a);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,a);let h={...s.timeout!==void 0&&{timeout:s.timeout}};if(s.maxTotalTimeout!==void 0){let b=Date.now()-i,_=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,u.requestState),h);if(hg(g)){u={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:Ya,OAuthClientInformationFullSchema:_s,OAuthClientInformationSchema:Qa,OAuthClientMetadataSchema:Xa,OAuthClientRegistrationErrorSchema:Ac,OAuthErrorResponseSchema:mo,OAuthMetadataSchema:uo,OAuthProtectedResourceMetadataSchema:hs,OAuthTokenRevocationRequestSchema:Lc,OAuthTokensSchema:lo,OpenIdProviderDiscoveryMetadataSchema:fs,OpenIdProviderMetadataSchema:Ga},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 ii=60000,az=[Bt,Uo,Kr,Zo],iz=["inputResponses","requestState"];function H_(e,t){let r=e.params;if(!oi(r))return{message:e,lifted:{}};let o=r._meta,s=oi(o)?az.filter((u)=>(u in o)):[],n=t==="request"?iz.filter((u)=>(u in r)):[];if(s.length===0&&n.length===0)return{message:e,lifted:{}};let a={},i={...r};if(s.length>0&&oi(o)){let u={},l={...o};for(let d of s)u[d]=o[d],delete l[d];if(a.envelope=u,Object.keys(l).length>0)i._meta=l;else delete i._meta}for(let u of n){if(u==="inputResponses")a.inputResponses=i[u];if(u==="requestState")a.requestState=i[u];delete i[u]}return{message:{...e,params:i},lifted:a}}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,ci=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 a=M_(t.classification);if(a!==o.era){this._onerror(Error(`Era mismatch on inbound notification '${r.method}': classified as ${a} 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((a)=>this._onerror(Error(`Uncaught error in notification handler: ${a}`)))}_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,a=(_,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??_;a(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))){a(W.MethodNotFound,"Method not found");return}let i=this._requestHandlers.get(r.method)??this.fallbackRequestHandler;if(i===void 0){a(W.MethodNotFound,"Method not found");return}let u=s.checkInboundEnvelope(o);if(u!==void 0){a(W.InvalidParams,u);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(()=>i(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}`)),a(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),a=this._timeoutInfo.get(o);if(a&&n&&a.resetTimeoutOnProgress)try{this._resetTimeout(o)}catch(i){this._responseHandlers.delete(o),this._progressHandlers.delete(o),this._cleanupTimeout(o),n(i);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:a,headers:i}=o??{},u=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:a}).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:u,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??ii,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:a,headers:i,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 a=this._negotiatedWireCodec(),i=a.validateRequest(e,s);if(!i.ok&&i.reason==="not-in-era")i=a.validateInputRequest(e,s);if(!i.ok){if(i.reason==="not-in-era")throw new se(W.InternalError,`No wire schema for ${e} in the resolved era`);throw Error(i.message)}return Promise.resolve(t(i.value,n))}}else if(r)o=async(s,n)=>{let a=await Vl(t.params,{...s.params});if(!a.success)throw new se(W.InvalidParams,`Invalid params for ${e}: ${a.error}`);return r(a.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 oi(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 a=r[s];r[s]=oi(a)&&oi(n)?{...a,...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 a=e.getRequestHandler(n);if(a===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 i=Vc(o.params)?o.params:void 0;return await a({jsonrpc:"2.0",id:r,method:n,...i!==void 0&&{params:i}},e.buildContext(dz(r,n,i,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:a,flowStartedAt:i}=o,u={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(a,f))};return tz({config:t,method:n.method,originalParams:n.params,firstPayload:u,flowStartedAt:i,signal:a?.signal,requestOptions:{...a?.timeout!==void 0&&{timeout:a.timeout},...a?.maxTotalTimeout!==void 0&&{maxTotalTimeout:a.maxTotalTimeout},...a?.onprogress!==void 0&&{onprogress:a.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 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}}}/*!
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(i){if(!i)throw TypeError("argument string is required");var u=typeof i==="object"?n(i):i;if(typeof u!=="string")throw TypeError("argument string is required to be a string");var l=u.indexOf(";"),d=l!==-1?u.slice(0,l).trim():u.trim();if(!o.test(d))throw TypeError("invalid media type");var f=new a(d.toLowerCase());if(l!==-1){var h,g,b;t.lastIndex=l;while(g=t.exec(u)){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!==u.length)throw TypeError("invalid parameter format")}return f}function n(i){var u;if(typeof i.getHeader==="function")u=i.getHeader("content-type");else if(typeof i.headers==="object")u=i.headers&&i.headers["content-type"];if(typeof u!=="string")throw TypeError("content-type header is missing from object");return u}function a(i){this.parameters=Object.create(null),this.type=i}}),_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 a=await e(s,{...r,redirect:"manual"}),i=Tg(s,a);if(!i||n===Sz)return a;let u=new URL(s),l=o==="GET"||a.status===307||a.status===308,d=!(i.username||i.password)||i.username===u.username&&i.password===u.password;if(!l||!d||!vz(u,i))return a;await a.text?.().catch(()=>{}),s=i}}}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 ui(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(!ui(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(!ui(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 a=new URL(n,r.href);if(a.hash.length>1)t[a.href]=e;else if(a.hash="",o==="")r=a;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 a=`${o}/${St(n)}`,i=e[n];if(Array.isArray(i)){if(yz[n]){let u=i.length;for(let l=0;l<u;l++)fo(i[l],t,r,`${a}/${l}`)}}else if(wz[n])for(let u in i)fo(i[u],t,r,`${a}/${St(u)}`);else fo(i,t,r,a)}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],a=!!r[5];return(o<=23&&s<=59&&n<=59||o==23&&s==59&&n==60)&&(!e||a)}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,a="#",i="#",u=Object.create(null)){if(t===!0)return{valid:!0,errors:[]};if(t===!1)return{valid:!1,errors:[{instanceLocation:a,keyword:"false",keywordLocation:a,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:ae,minProperties:re,maxProperties:de,propertyNames:bt,dependentRequired:Fe,dependentSchemas:st,dependencies:yt,prefixItems:Ge,items:Le,additionalItems:Dt,unevaluatedItems:Zt,contains:wt,minContains:Oe,maxContains:Ue,minItems:De,maxItems:dt,uniqueItems:Cr,minimum:Ye,maximum:Xe,exclusiveMinimum:Ve,exclusiveMaximum:nt,multipleOf:at,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=`${i}/$recursiveRef`,Q=Se(e,n===null?t:n,r,o,s,B,a,U,u);if(!Q.valid)N.push({instanceLocation:a,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 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+=`
70
70
  Known schemas:
71
71
  - ${Object.keys(o).join(`
72
- - `)}`,Error(j)}let U=`${i}/$ref`,Q=Se(e,B,r,o,s,n,a,U,u);if(!Q.valid)N.push({instanceLocation:a,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:a,keyword:"type",keywordLocation:`${i}/type`,error:`Instance type "${d}" is invalid. Expected "${b.join('", "')}".`})}else if(b==="integer"){if(d!=="number"||e%1||e!==e)N.push({instanceLocation:a,keyword:"type",keywordLocation:`${i}/type`,error:`Instance type "${d}" is invalid. Expected "${b}".`})}else if(b!==void 0&&d!==b)N.push({instanceLocation:a,keyword:"type",keywordLocation:`${i}/type`,error:`Instance type "${d}" is invalid. Expected "${b}".`});if(_!==void 0){if(d==="object"||d==="array"){if(!ui(e,_))N.push({instanceLocation:a,keyword:"const",keywordLocation:`${i}/const`,error:`Instance does not match ${JSON.stringify(_)}.`})}else if(e!==_)N.push({instanceLocation:a,keyword:"const",keywordLocation:`${i}/const`,error:`Instance does not match ${JSON.stringify(_)}.`})}if(w!==void 0){if(d==="object"||d==="array"){if(!w.some((B)=>ui(e,B)))N.push({instanceLocation:a,keyword:"enum",keywordLocation:`${i}/enum`,error:`Instance does not match any of ${JSON.stringify(w)}.`})}else if(!w.some((B)=>e===B))N.push({instanceLocation:a,keyword:"enum",keywordLocation:`${i}/enum`,error:`Instance does not match any of ${JSON.stringify(w)}.`})}if(A!==void 0){let B=`${i}/not`;if(Se(e,A,r,o,s,n,a,B).valid)N.push({instanceLocation:a,keyword:"not",keywordLocation:B,error:'Instance matched "not" schema.'})}let kt=[];if(z!==void 0){let B=`${i}/anyOf`,U=N.length,Q=!1;for(let j=0;j<z.length;j++){let O=z[j],K=Object.create(u),J=Se(e,O,r,o,s,g===!0?n:null,a,`${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:a,keyword:"anyOf",keywordLocation:B,error:"Instance does not match any subschemas."})}if(q!==void 0){let B=`${i}/allOf`,U=N.length,Q=!0;for(let j=0;j<q.length;j++){let O=q[j],K=Object.create(u),J=Se(e,O,r,o,s,g===!0?n:null,a,`${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:a,keyword:"allOf",keywordLocation:B,error:"Instance does not match every subschema."})}if(x!==void 0){let B=`${i}/oneOf`,U=N.length,Q=x.filter((j,O)=>{let K=Object.create(u),J=Se(e,j,r,o,s,g===!0?n:null,a,`${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:a,keyword:"oneOf",keywordLocation:B,error:`Instance does not match exactly one subschema (${Q} matches).`})}if(d==="object"||d==="array")Object.assign(u,...kt);if(R!==void 0){let B=`${i}/if`;if(Se(e,R,r,o,s,n,a,B,u).valid){if(Z!==void 0){let U=Se(e,Z,r,o,s,n,a,`${i}/then`,u);if(!U.valid)N.push({instanceLocation:a,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,a,`${i}/else`,u);if(!U.valid)N.push({instanceLocation:a,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:a,keyword:"required",keywordLocation:`${i}/required`,error:`Instance does not have required property "${j}".`})}let B=Object.keys(e);if(re!==void 0&&B.length<re)N.push({instanceLocation:a,keyword:"minProperties",keywordLocation:`${i}/minProperties`,error:`Instance does not have at least ${re} properties.`});if(de!==void 0&&B.length>de)N.push({instanceLocation:a,keyword:"maxProperties",keywordLocation:`${i}/maxProperties`,error:`Instance does not have at least ${de} properties.`});if(bt!==void 0){let j=`${i}/propertyNames`;for(let O in e){let K=`${a}/${St(O)}`,J=Se(O,bt,r,o,s,n,K,j);if(!J.valid)N.push({instanceLocation:a,keyword:"propertyNames",keywordLocation:j,error:`Property name "${O}" does not match schema.`},...J.errors)}}if(Fe!==void 0){let j=`${i}/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:a,keyword:"dependentRequired",keywordLocation:j,error:`Instance has "${O}" but does not have "${J}".`})}}if(st!==void 0)for(let j in st){let O=`${i}/dependentSchemas`;if(j in e){let K=Se(e,st[j],r,o,s,n,a,`${O}/${St(j)}`,u);if(!K.valid)N.push({instanceLocation:a,keyword:"dependentSchemas",keywordLocation:O,error:`Instance has "${j}" but does not match dependant schema.`},...K.errors)}}if(yt!==void 0){let j=`${i}/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:a,keyword:"dependencies",keywordLocation:j,error:`Instance has "${O}" but does not have "${J}".`})}else{let J=Se(e,K,r,o,s,n,a,`${j}/${St(O)}`);if(!J.valid)N.push({instanceLocation:a,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=`${i}/properties`;for(let O in ne){if(!(O in e))continue;let K=`${a}/${St(O)}`,J=Se(e[O],ne[O],r,o,s,n,K,`${j}/${St(O)}`);if(J.valid)u[O]=U[O]=!0;else if(Q=s,N.push({instanceLocation:a,keyword:"properties",keywordLocation:j,error:`Property "${O}" does not match schema.`},...J.errors),Q)break}}if(!Q&&xe!==void 0){let j=`${i}/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=`${a}/${St(ke)}`,Pt=Se(e[ke],J,r,o,s,n,qr,`${j}/${St(O)}`);if(Pt.valid)u[ke]=U[ke]=!0;else Q=s,N.push({instanceLocation:a,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=`${i}/additionalProperties`;for(let O in e){if(U[O])continue;let K=`${a}/${St(O)}`,J=Se(e[O],te,r,o,s,n,K,j);if(J.valid)u[O]=!0;else Q=s,N.push({instanceLocation:a,keyword:"additionalProperties",keywordLocation:j,error:`Property "${O}" does not match additional properties schema.`},...J.errors)}}else if(!Q&&ae!==void 0){let j=`${i}/unevaluatedProperties`;for(let O in e)if(!u[O]){let K=`${a}/${St(O)}`,J=Se(e[O],ae,r,o,s,n,K,j);if(J.valid)u[O]=!0;else N.push({instanceLocation:a,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:a,keyword:"maxItems",keywordLocation:`${i}/maxItems`,error:`Array has too many items (${e.length} > ${dt}).`});if(De!==void 0&&e.length<De)N.push({instanceLocation:a,keyword:"minItems",keywordLocation:`${i}/minItems`,error:`Array has too few items (${e.length} < ${De}).`});let B=e.length,U=0,Q=!1;if(Ge!==void 0){let j=`${i}/prefixItems`,O=Math.min(Ge.length,B);for(;U<O;U++){let K=Se(e[U],Ge[U],r,o,s,n,`${a}/${U}`,`${j}/${U}`);if(u[U]=!0,!K.valid){if(Q=s,N.push({instanceLocation:a,keyword:"prefixItems",keywordLocation:j,error:"Items did not match schema."},...K.errors),Q)break}}}if(Le!==void 0){let j=`${i}/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,`${a}/${U}`,`${j}/${U}`);if(u[U]=!0,!K.valid){if(Q=s,N.push({instanceLocation:a,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,`${a}/${U}`,j);if(u[U]=!0,!O.valid){if(Q=s,N.push({instanceLocation:a,keyword:"items",keywordLocation:j,error:"Items did not match schema."},...O.errors),Q)break}}if(!Q&&Dt!==void 0){let O=`${i}/additionalItems`;for(;U<B;U++){let K=Se(e[U],Dt,r,o,s,n,`${a}/${U}`,O);if(u[U]=!0,!K.valid)Q=s,N.push({instanceLocation:a,keyword:"additionalItems",keywordLocation:O,error:"Items did not match additional items schema."},...K.errors)}}}if(wt!==void 0)if(B===0&&Oe===void 0)N.push({instanceLocation:a,keyword:"contains",keywordLocation:`${i}/contains`,error:"Array is empty. It must contain at least one item matching the schema."});else if(Oe!==void 0&&B<Oe)N.push({instanceLocation:a,keyword:"minContains",keywordLocation:`${i}/minContains`,error:`Array has less items (${B}) than minContains (${Oe}).`});else{let j=`${i}/contains`,O=N.length,K=0;for(let J=0;J<B;J++){let ke=Se(e[J],wt,r,o,s,n,`${a}/${J}`,j);if(ke.valid)u[J]=!0,K++;else N.push(...ke.errors)}if(K>=(Oe||0))N.length=O;if(Oe===void 0&&Ue===void 0&&K===0)N.splice(O,0,{instanceLocation:a,keyword:"contains",keywordLocation:j,error:"Array does not contain item matching schema."});else if(Oe!==void 0&&K<Oe)N.push({instanceLocation:a,keyword:"minContains",keywordLocation:`${i}/minContains`,error:`Array must contain at least ${Oe} items matching schema. Only ${K} items were found.`});else if(Ue!==void 0&&K>Ue)N.push({instanceLocation:a,keyword:"maxContains",keywordLocation:`${i}/maxContains`,error:`Array may contain at most ${Ue} items matching schema. ${K} items were found.`})}if(!Q&&Zt!==void 0){let j=`${i}/unevaluatedItems`;for(;U<B;U++){if(u[U])continue;let O=Se(e[U],Zt,r,o,s,n,`${a}/${U}`,j);if(u[U]=!0,!O.valid)N.push({instanceLocation:a,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&&ui(O,ke))N.push({instanceLocation:a,keyword:"uniqueItems",keywordLocation:`${i}/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:a,keyword:"minimum",keywordLocation:`${i}/minimum`,error:`${e} is less than ${Ve?"or equal to ":""} ${Ye}.`});if(Xe!==void 0&&(nt===!0&&e>=Xe||e>Xe))N.push({instanceLocation:a,keyword:"maximum",keywordLocation:`${i}/maximum`,error:`${e} is greater than ${nt?"or equal to ":""} ${Xe}.`})}else{if(Ye!==void 0&&e<Ye)N.push({instanceLocation:a,keyword:"minimum",keywordLocation:`${i}/minimum`,error:`${e} is less than ${Ye}.`});if(Xe!==void 0&&e>Xe)N.push({instanceLocation:a,keyword:"maximum",keywordLocation:`${i}/maximum`,error:`${e} is greater than ${Xe}.`});if(Ve!==void 0&&e<=Ve)N.push({instanceLocation:a,keyword:"exclusiveMinimum",keywordLocation:`${i}/exclusiveMinimum`,error:`${e} is less than ${Ve}.`});if(nt!==void 0&&e>=nt)N.push({instanceLocation:a,keyword:"exclusiveMaximum",keywordLocation:`${i}/exclusiveMaximum`,error:`${e} is greater than or equal to ${nt}.`})}if(at!==void 0){let B=e%at;if(Math.abs(0-B)>=0.00000011920929&&Math.abs(at-B)>=0.00000011920929)N.push({instanceLocation:a,keyword:"multipleOf",keywordLocation:`${i}/multipleOf`,error:`${e} is not a multiple of ${at}.`})}}else if(d==="string"){let B=zt===void 0&&Rt===void 0?0:Wz(e);if(zt!==void 0&&B<zt)N.push({instanceLocation:a,keyword:"minLength",keywordLocation:`${i}/minLength`,error:`String is too short (${B} < ${zt}).`});if(Rt!==void 0&&B>Rt)N.push({instanceLocation:a,keyword:"maxLength",keywordLocation:`${i}/maxLength`,error:`String is too long (${B} > ${Rt}).`});if(or!==void 0&&!new RegExp(or,"u").test(e))N.push({instanceLocation:a,keyword:"pattern",keywordLocation:`${i}/pattern`,error:"String does not match pattern."});if(X!==void 0&&Ig[X]&&!Ig[X](e))N.push({instanceLocation:a,keyword:"format",keywordLocation:`${i}/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}},li=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,a=e.get("code");if(a)return{authorizationCode:a,iss:n};let i=(await r.discoveryState?.())?.authorizationServerMetadata;if(!i)try{i=(await Ed(o,s)).authorizationServerMetadata}catch{i=void 0}if(!i)throw new vt("Authorization callback failed and the issuer could not be verified");eu({iss:n,expectedIssuer:i.issuer,issParameterSupported:kd(i)});let u=e.get("error");if(u)throw new br(u,e.get("error_description")??u,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 aR(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:a,skipIssuerMetadataValidation:i,forceReauthorization:u}){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:a,skipIssuerValidation:i}),!f)try{f=await Pd(t,{resourceMetadataUrl:_},a)}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:a,skipIssuerMetadataValidation:i});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 li("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 li(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=aR({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 li(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,ae=e.clientMetadataUrl;if(ae&&!rS(ae))throw new br(Ot.InvalidClientMetadata,`clientMetadataUrl must be a valid HTTPS URL with a non-root pathname, got: ${ae}`);if(te&&ae)R={client_id:ae,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:a}),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:a});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&&!u){let te=await e.scopeForRefresh?.(ee),ae;try{ae=await uS(h,{metadata:g,clientInformation:R,refreshToken:ee.refresh_token,scope:te,resource:z,addClientAuthentication:e.addClientAuthentication,dpop:await e.dpop?.(),fetchFn:a})}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(ae)return await e.saveTokens({...ae,issuer:w},I),"AUTHORIZED"}let X=e.state?await e.state():void 0,{authorizationUrl:ne,codeVerifier:xe}=await aS(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 iR=new Set(["bearer","dpop"]);function bs(e){let t=e.headers.get("WWW-Authenticate");if(!t)return{};let[r,o]=t.split(" ");if(!r||!iR.has(r.toLowerCase())||!o)return{};let s=Gc(e,"resource_metadata")||void 0,n;if(s)try{n=new URL(s)}catch{}let a=Gc(e,"scope")||void 0,i=Gc(e,"error")||void 0,u=Gc(e,"error_description")||void 0;return{resourceMetadataUrl:n,scope:a,error:i,errorDescription:u}}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,a;if(o?.metadataUrl)a=new URL(o.metadataUrl);else{let u=cR(t,s.pathname);a=new URL(u,o?.metadataServerUrl??s),a.search=s.search}let i=await Mg(a,n,r);if(!o?.metadataUrl&&uR(i,s.pathname))i=await Mg(new URL(`/.well-known/${t}`,s),n,r);return i}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:a,type:i}of n){let u=await sS(a,s,t);if(!u)continue;if(!u.ok){if(await u.text?.().catch(()=>{}),u.status<500||u.status===502)continue;throw Error(`HTTP ${u.status} trying to load ${i==="oauth"?"OAuth":"OpenID provider"} metadata from ${a}`)}let l=i==="oauth"?uo.parse(await u.json()):fs.parse(await u.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 aS(e,{metadata:t,clientInformation:r,redirectUrl:o,scope:s,state:n,resource:a}){let i;if(t){if(i=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 i=new URL("/authorize",e);let u=await hd(),{code_verifier:l,code_challenge:d}=u;if(i.searchParams.set("response_type",fd),i.searchParams.set("client_id",r.client_id),i.searchParams.set("code_challenge",d),i.searchParams.set("code_challenge_method",_d),i.searchParams.set("redirect_uri",String(o)),n)i.searchParams.set("state",n);if(s)i.searchParams.set("scope",s);if(s?.split(" ").includes("offline_access"))i.searchParams.append("prompt","consent");if(a)i.searchParams.set("resource",$d(a));return{authorizationUrl:i,codeVerifier:l}}function iS(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:a,fetchFn:i}){let u=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,u,t);if(a)g.set("DPoP",await a.buildProof({htm:"POST",htu:u}));return Ss(i??fetch)(u,{method:"POST",headers:g,body:r})},f=await d();if(a&&f.status===400){if((await f.clone().json().catch(()=>{}))?.error===Ot.UseDpopNonce)a.observeNonce(f,u),f=await d()}if(a?.observeNonce(f,u),!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:a,dpop:i,fetchFn:u}){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:a,resource:n,dpop:i,fetchFn:u});return{refresh_token:o,...d,...s&&!d.scope&&{scope:s}}}async function lS(e,t,{metadata:r,resource:o,authorizationCode:s,iss:n,scope:a,fetchFn:i}={}){if(s!==void 0)eu({iss:n,expectedIssuer:r?.issuer,issParameterSupported:kd(r)});let u=r?.issuer??String(t),l=async()=>{let g=await e.clientInformation({issuer:u}),b=yd(g,u,{canPersistStamp:!1});if(g&&b===void 0)throw new li(String(g.issuer),u);return b},d=await l(),f=a??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=iS(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:i})}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 a={...r,...o===void 0?{}:{scope:o}},i=await Ss(s??fetch)(n,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)});if(!i.ok)throw new Vg({status:i.status,body:await i.text(),submittedMetadata:a});return _s.parse(Bc(await i.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 a of this._entries.keys())if(!Yc.has(a.slice(0,a.indexOf("\x00")))){this._entries.delete(a),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 a=await this._store.get({...r,partition:n});return a?.scope==="public"?a: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"),a=this._partitionFor("public"),i=(o?.scope??"private")==="public"?a:n;try{await this._store.set({method:e,params:s,partition:i},{value:mR(t),expiresAt:o?.expiresAt,scope:o?.scope})}catch(u){this._reportError(u)}if(a!==n)try{await this._store.delete({method:e,params:s,partition:i===n?a:n})}catch(u){this._reportError(u)}}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 a=t(n);if(a!==void 0)s.set(n.name,a)}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 ai({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 a=new ai({supported:n,requested:yR(s)??t.requestedVersion},o),i=ni(n),u=t.clientModernVersions.find((l)=>i.includes(l));if(u!==void 0)return{kind:"corrective",version:u,error:a};if(i.length>0)return{kind:"error",error:a};return t.fallbackAvailable?{kind:"legacy"}:{kind:"error",error:a}}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?ni(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,a=(u)=>{if(n)return;if(n=!0,clearTimeout(i),this._pending?.id===o)this._pending=void 0;s(u)},i=setTimeout(()=>a({kind:"timeout"}),r);this._pending={id:o,resolve:a},this._transport.send(t(o)).catch((u)=>a({kind:"send-error",error:u}))})}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,a=await xR.open(t.transport),i=async()=>{let l=s[0],d=!1,f=o;for(;;){let h=await a.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}}},u;try{u=await i()}catch(l){throw a.detach(),l}return a.release(),u}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"}),a=t.close,i=!1,u,l=new Promise((f,h)=>{u=()=>h(Zg())});t.close=async function(){return i=!0,u?.(),a.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=a}if(i)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 ci{_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:a}=n.value;a.mode=a.mode??"form";let{supportsFormMode:i,supportsUrlMode:u}=SS(this._capabilities.elicitation);if(a.mode==="form"&&!i)throw new se(W.InvalidParams,"Client does not support form-mode elicitation requests");if(a.mode==="url"&&!u)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=a.mode==="form"?a.requestedSchema:void 0;if(a.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:a}=n.value,i=await t(r,o),u=Boolean(a.tools||a.toolChoice),l=s.samplingResultVariant(u,i);if(!l.ok&&l.reason==="not-in-era")l=s.validateInputResponse("sampling/createMessage",i);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??ii},a=s==="stdio"?ER(e):void 0;o=a===void 0?await gS(t,{...n,transport:e,transportKind:s}):await $R(t,e,a,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,a={...s.tools&&n?.tools?.listChanged&&{tools:s.tools},...s.prompts&&n?.prompts?.listChanged&&{prompts:s.prompts},...s.resources&&n?.resources?.listChanged&&{resources:s.resources}},i=!0;try{this._setupListChangedHandlers(a)}catch(l){i=!1,this.onerror?.(l instanceof Error?l:Error(String(l)))}let u=i?{...a.tools&&{toolsListChanged:!0},...a.prompts&&{promptsListChanged:!0},...a.resources&&{resourcesListChanged:!0}}:{};if(Object.keys(u).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(u,{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&&ni(s).length>0?ni(s):Ql).find((a)=>o.supportedVersions.includes(a));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(a){this.onerror?.(a instanceof Error?a:Error(String(a)))}}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",a=this._cache.captureGeneration(e),i=(l)=>{let d=l===void 0?t&&{...t}:{...t,cursor:l};return this.request({method:e,...d&&{params:d}},r)},u=await this._walkPages(e,i,o);if(delete u.nextCursor,s?.(u),n)return u;return await this._cache.write(e,u,a,this._freshness(u)),u}async _walkPages(e,t,r){let o=await t(void 0),s=o.nextCursor,n=o,a=1;while(s!==void 0){if(this._listMaxPages!==0&&a>=this._listMaxPages)throw new L(M.ListPaginationExceeded,`${e}: exceeded listMaxPages (${this._listMaxPages}); server pagination did not terminate`,{method:e,listMaxPages:this._listMaxPages});let i=await t(s);if(i.nextCursor===s&&JSON.stringify(r(i))===JSON.stringify(r(n)))break;r(o).push(...r(i)),n=i,s=i.nextCursor,a++}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:id(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",a,i,u,l,d=new Promise((z,q)=>{u=z,l=q}),f,h=new Promise((z)=>{f=z}),g=(z)=>{if(n==="closed")return;let q=n==="opening";if(a!==void 0)clearTimeout(a),a=void 0;if("ack"in z){n="open",u(z.ack);return}if(n="closed",i!==void 0)t?.signal?.removeEventListener("abort",i);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??ii;if(a=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;i=()=>{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",i,{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 u;try{u=await this._resolveXMcpHeaderScan(e.name,t?.toolDefinition)}catch(d){this._reportStoreError(d)}if(!u?.valid||u.declarations.length===0)return t;let l=Sg(u.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,(u)=>this._compileOutputValidator(u)).catch((u)=>void this._reportStoreError(u)):this._compileOutputValidator(t.toolDefinition),n=()=>{if(s===void 0||s.ok)return;let u=s.compileError,l=(u instanceof Error?u.message:String(u)).slice(0,200);throw new se(W.InvalidParams,`Tool '${e.name}' has an invalid outputSchema: ${l}`)};n();let a;try{a=await this.request({method:"tools/call",params:e},await o())}catch(u){let l=u instanceof se&&u.code===gs;if(!r||!l||t?.toolDefinition!==void 0)throw u;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(),a=await this.request({method:"tools/call",params:e},await o())}let i=s!==void 0&&s.ok?s.validator:void 0;if(i){if(a.structuredContent===void 0&&!a.isError)throw new se(W.InvalidRequest,`Tool ${e.name} has an output schema but did not return structured content`);if(a.structuredContent!==void 0&&!a.isError)try{let u=i(a.structuredContent);if(!u.valid)throw new se(W.InvalidParams,`Structured content does not match the tool's output schema: ${u.errorMessage}`)}catch(u){if(u instanceof se)throw u;throw new se(W.InvalidParams,`Failed to validate structured content: ${u instanceof Error?u.message:String(u)}`)}}return a}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=id(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(_a,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:a}=s.data,{onChanged:i}=r,u=async()=>{if(!n){i(null,null);return}try{i(null,await o())}catch(d){i(d instanceof Error?d:Error(String(d)),null)}},l=()=>{if(a){let d=this._listChangedDebounceTimers.get(e);if(d)clearTimeout(d);let f=setTimeout(u,a);this._listChangedDebounceTimers.set(e,f)}else u()};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,a=[],i=0,u=!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(u&&(u=!1,x.charCodeAt(0)===239&&x.charCodeAt(1)===187&&x.charCodeAt(2)===191&&(x=x.slice(3))),a.length===0){let ee=w(x);ee!==""&&(a.push(ee),i=ee.length),_();return}if(x.indexOf(`
73
- `)===-1&&x.indexOf("\r")===-1){a.push(x),i+=x.length,_();return}a.push(x);let R=a.join("");a.length=0,i=0;let Z=w(R);Z!==""&&(a.push(Z),i=Z.length),_()}function _(){n!==void 0&&(i+d.length<=n||(g=!0,a.length=0,i=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(`
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
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
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(`
76
76
  `,R);continue}d=f===0?ne:`${d}
77
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
78
  `,R)}return x.slice(R)}for(;R<x.length;){let Z=x.indexOf("\r",R),ee=x.indexOf(`
79
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,ae=X.slice(ne+te);A(xe,ae,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&&a.length>0){let R=a.join("");I(R,0,R.length)}u=!0,l=void 0,d="",f=0,h=void 0,a.length=0,i=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:(a)=>{n.enqueue(a)},onError(a){typeof e=="function"&&e(a),(e==="terminate"||a.type==="max-buffer-size-exceeded")&&n.error(a)},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 a=(n?.method??"GET").toUpperCase(),i=new URL(s.toString()),u=await o();if(!u)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 u.buildProof({htm:a,htu:i,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"))u.observeNonce(d,i),await d.text?.().catch(()=>{}),d=await l();return u.observeNonce(d,i),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 a=await this._commonHeaders(),i=[...a.get("accept")?.split(",").map((f)=>f.trim().toLowerCase())??[],"text/event-stream"];if(a.set("accept",[...new Set(i)].join(", ")),o)a.set("last-event-id",o);let u=this._abortController?.signal,l=s!==void 0&&u!==void 0?zS(u,s):s??u,d=await this._redirects(this._fetch??fetch)(this._url,{...this._requestInit,method:"GET",headers:a,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(a){if(!n())this.onerror?.(a);throw a}}_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(a){this.onerror?.(a instanceof Error?a:Error(String(a)))}})};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:a}=t,i=()=>this._abortController?.signal.aborted===!0||n?.aborted===!0,u,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)u=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&&!i())this._scheduleReconnection({resumptionToken:u,onresumptiontoken:o,replayMessageId:s,requestSignal:n,onRequestStreamEnd:a},0);else if(!i())a?.()}catch(h){if(i())return;if(this.onerror?.(Error(`SSE stream disconnected: ${h}`)),(r||l)&&!d&&this._abortController&&!i())try{this._scheduleReconnection({resumptionToken:u,onresumptiontoken:o,replayMessageId:s,requestSignal:n,onRequestStreamEnd:a},0)}catch(g){this.onerror?.(Error(`Failed to reconnect: ${g instanceof Error?g.message:String(g)}`)),a?.()}else a?.()}})()}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 a=await this._commonHeaders();this._applyBodyDerivedHeaders(a,e);let i=Array.isArray(e)?e.some((w)=>ad(w)):ad(e);if(i)a.delete("mcp-session-id");if(t?.headers!==void 0)for(let[w,I]of Object.entries(t.headers)){if(DR.has(w.toLowerCase()))continue;a.set(w,I)}a.set("content-type","application/json");let u=[...a.get("accept")?.split(",").map((w)=>w.trim().toLowerCase())??[],"application/json","text/event-stream"];a.set("accept",[...new Set(u)].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:a,body:JSON.stringify(e),signal:d},h=await this._redirects(this._fetch??fetch)(this._url,f);if(i&&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,a=e==="request"?"setRequestHandler":"setNotificationHandler";if(!xS.has(a))xS.add(a),console.warn(`[ext-apps] ${a}(Schema, handler) is deprecated; use ${a}("${n}", { params: Schema.shape.params }, handler).`);let i=o;return[n,{params:s.params},e==="request"?(u,l)=>i({method:n,params:u},ZR(l)):(u)=>i({method:n,params:u})]}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."),di=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.
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.
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([c(),Al()]).describe(`Style variables for theming MCP apps.
87
+ for compatibility with Zod schema generation. Both are functionally equivalent for validation.`),C([u(),Al()]).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:c().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(c()).optional().describe(`Origins for network requests (fetch/XHR/WebSocket).
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).
100
100
 
101
101
  - Maps to CSP \`connect-src\` directive
102
- - Empty or omitted → no network connections (secure default)`),resourceDomains:v(c()).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(c()).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(c()).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(c(),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(c(),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:c().optional().describe('Optional reason for the cancellation (e.g., "user action", "timeout").')})}),QR=m({fonts:c().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(c(),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(c(),T(c(),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(c(),T(c(),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(di).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:c().optional().describe(`Dedicated origin for view sandbox.
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.
103
103
 
104
104
  Useful when views need stable, dedicated origins for OAuth callbacks, CORS policies, or API key allowlists.
105
105
 
@@ -113,14 +113,14 @@ Boolean requesting whether a visible border and background is provided by the ho
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:di.describe("The display mode being requested.")})}),ES=m({mode:di.describe("The display mode that was actually set. May differ from requested if not supported.")}).passthrough(),ax=C([p("model"),p("app")]).describe("Tool visibility scope - who can access the tool."),hT=m({resourceUri:c().optional(),visibility:v(ax).optional().describe(`Who can access this tool. Default: ["model", "app"]
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"]
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(c()).optional().describe('Array of supported MIME types for UI resources.\nMust include `"text/html;profile=mcp-app"` for MCP Apps support.')}),ix=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:c().describe("HTML content to load into the inner iframe."),sandbox:c().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:di.optional().describe("How the UI is currently displayed."),availableDisplayModes:v(di).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:c().optional().describe("User's language and region preference in BCP 47 format."),timeZone:c().optional().describe("User's timezone in IANA format."),userAgent:c().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(c(),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:c().describe("Protocol version this app supports.")})}),dx=m({protocolVersion:c().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 mi{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 pi extends ci{_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:ix.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",a),r()},e),a=()=>{clearTimeout(n),t.removeEventListener("abort",a),o(t.reason)};t?.addEventListener("abort",a,{once:!0})})}function NS(e,{signal:t,onDiagnostic:r,wait:o=fx}={}){return async(s)=>{for(let n=1;;n++){t?.throwIfAborted();try{let a=await e(s);if(t?.throwIfAborted(),n>1)r?.({state:"recovered",uri:s.uri,attempt:n});return a}catch(a){if(t?.throwIfAborted(),!hx(a))throw a;if(n>OS.length)throw r?.({state:"exhausted",uri:s.uri,attempt:n,message:a.message}),Object.assign(Error(`MCP resource transport failed for ${s.uri} after ${n} attempts: ${a.message}. Inspect the host connection and browser network diagnostics; this resource-loading error does not establish a component assertion failure.`,{cause:a}),{code:"ADS_RESOURCE_TRANSPORT"});let i=OS[n-1];r?.({state:"retry",uri:s.uri,attempt:n,nextAttempt:n+1,delayMs:i,message:a.message}),await o(i,t)}}}}function jS(e,{onError:t,delay:r=150,setTimer:o=setTimeout,clearTimer:s=clearTimeout}={}){let n=!1,a=!1,i=!1,u=!1,l=!1,d;function f(){if(!n||a||i||!u||d!==void 0)return;d=o(()=>{d=void 0,i=!0;let h=l;u=l=!1,Promise.resolve().then(()=>e(h)).catch((g)=>{if(!a)t?.(g)}).finally(()=>{i=!1,f()})},r)}return{schedule(h=!1){if(a)return;u=!0,l||=h,f()},start(){n=!0,f()},close(){a=!0,u=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:a,context:i,onError:u,onState:l}){let d={slot:e,title:t,sandboxUrl:r,resourceUri:o,readResource:n,callTool:a,context:i,onError:u,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(!_)u(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:a,context:i,onError:u,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 pi(null,{name:"ADS showcase",version:"1.0.0"},{serverResources:{},serverTools:{},logging:{}},{hostContext:i(b)});_.onreadresource=n,_.oncalltool=a,_.onerror=(z)=>{if(!f)u(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")u(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(i(b)));try{await Promise.all([_.connect(new mi(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(i(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:u,title:l,revision:d,state:f,preview:h})=>[u,{id:u,title:l,revision:d,state:f,...h?{preview:h}:{}}])),n=new Map(e.map((u)=>[u.id,{...u,drafts:(u.drafts??[]).flatMap((l)=>s.has(l.id)?[s.get(l.id)]:[])}]));for(let u of t){let l=n.get(u.id);n.set(u.id,{...l,...u,kind:"tokens",drafts:l?.drafts??[]})}let a=(u,l)=>u==="tokens"&&l.kind==="tokens"||(l.unit?l.unit===u:nu(u,l.id)),i=(u,l)=>{if(!u.drafts.some((d)=>d.id===l.id))u.drafts.push(s.get(l.id))};for(let u of r){let l=o.get(u.id);for(let d of l?.scenarios??[]){if(!u.units.some((h)=>a(h,d)))continue;let f=n.get(d.id);if(!f)f={...d,draftOnly:!0,drafts:[]},n.set(d.id,f);i(f,u)}}for(let u of r)for(let l of u.units){let d=l.split("/")[0];if(!["brand","tokens","components","patterns","composition"].includes(d))continue;let f=[...n.values()].filter((h)=>a(l,h));if(f.length)for(let h of f)i(h,u);else n.set(l,{id:l,unit:l,title:l.split("/").at(-1),kind:d,draftOnly:!0,pendingDraftScenario:!0,drafts:[s.get(u.id)]})}return{scenarios:[...n.values()],categories:[...n.values()].filter((u)=>u.kind==="tokens")}}var _x=(e)=>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",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((a)=>a.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((i)=>n==="tokens"&&i.kind==="tokens"||i.unit===n||!i.unit&&nu(n,i.id)))continue;let a=_x(n);r.push({id:`drafts/${encodeURIComponent(o.id)}/${encodeURIComponent(n)}`,unit:n,kind:a,title:`${o.title||o.id} · ${n.split("/").at(-1)}`,group:su[a],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 hi(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}=hi(e);return{all:t==="always",...r}}function FS(e){let{mode:t,...r}=hi(e);return t!=="off"&&Object.values(r).some(Boolean)}function jd(e,t,r){let o=e.drafts?.find((u)=>u.id===r)??e.drafts?.[0],s=o&&(t?.drafts?.find((u)=>u.id===o.id)??o.preview),n=o?s?.scenarios?.find((u)=>u.id===e.id)??s:t?.previews?.find((u)=>u.id===e.id)??e.build,a=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",i={error:Zi(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:a,label:`${o?"Draft · ":""}${i[a]}${o&&a==="ready"?" · unaccepted":""}`}}var le,cv,wr,VS,lu,uv,iu,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,a,i,u;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,a=[],i=[],(u=r.__P)&&((o=go({constructor:void 0},s)).__v=s.__v+1,le.vnode&&le.vnode(o),Bd(u,o,s,r.__n,u.namespaceURI,32&s.__u?[n]:null,a,n||zr(s),32&s.__u,i),o.__v=s.__v,o.__.__k[o.__i]=o,_v(a,o,i),s.__=s.__e=null,o.__e!=n&&mv(o)))}finally{wr.length=lu=0}}function pv(e,t,r,o,s,n,a,i,u,l,d){var f,h,g,b,_,w,I=o.__k||mu,A=t.length;for(u=yx(r,t,I,u,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,a,i,u,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?(u=hv(g,u,e,!h.__v),h.__e&&(h.__e=null)):typeof g.type=="function"&&w!==void 0?u=w:b&&(u=b.nextSibling),g.__u&=-7);return r.__e=_,u}function yx(e,t,r,o,s){var n,a,i,u,l,d,f,h,g,b,_=r.length,w=_,I=0,A=!1,z=e.__k=Array(s);for(n=0;n<s;n++)(a=t[n])!=null&&typeof a!="boolean"&&typeof a!="function"?(typeof a!="object"||a.constructor==String?a=z[n]=cu(null,a):Vd(a)?a=z[n]=cu(Qt,{children:a}):a.constructor===void 0&&a.__b?a=z[n]=cu(a.type,a.props,a.key,a.ref,a.__v):z[n]=a,u=n+I,a.__=e,a.__b=e.__b+1,i=null,~(l=a.__i=wx(a,r,u,w))&&(w--,(i=r[l])&&(i.__u|=2)),i&&i.__v?(a.__u|=2,l==u-1?I--:l==u+1?I++:l!=u&&(l>u?I--:I++,A=!0)):(~l||(s>_?I--:s<_&&I++),typeof a.type!="function"&&(a.__u|=4))):z[n]=null;if(A){for(d=[],f=[],n=0;n<s;n++)if((a=z[n])&&2&a.__u){for(h=0,g=d.length;h<g;)d[b=h+g>>1]<a.__i?h=b+1:g=b;d[h]=a.__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++)!(i=r[n])||2&i.__u||(i.__e==o&&(o=zr(i)),Wd(i,i));return o}function hv(e,t,r,o){var s,n,a;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),a=t;a&&a.nodeType==8;)a=a.nextSibling;for(e.__e!=a&&(!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,a,{key:i,type:u}=e,l=t[r],d=l&&!(2&l.__u);if(l===null&&i==null||d&&i==l.key&&u==l.type)return r;if(o>(d?1:0)){for(s=r-1,n=r+1;s>=0||n<t.length;)if((l=t[a=s>=0?s--:n++])&&!(2&l.__u)&&i==l.key&&u==l.type)return a}return-1}function JS(e,t,r){r==null&&(r=""),t[0]=="-"?e.setProperty(t,r):e[t]=r}function au(e,t,r,o,s){var n,a;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||(a=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,a,n):e.removeEventListener(t,a,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(i){}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[iu]==null)t[iu]=Fd++;else if(t[iu]<this.__a[e])return;return r(le.event?le.event(t):t)}}}function Bd(e,t,r,o,s,n,a,i,u,l){var d,f,h,g,b,_,w,I,A,z,q,x,R,Z,ee,X,ne,xe,te,ae,re=t.type;if(t.constructor!==void 0)return null;if(128&r.__u&&(u=32&r.__u,d=r.__c.__z)){if(t.__u|=u,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);i=n[0]}(d=le.__b)&&d(t);e:if(typeof re=="function"){b=a.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&&a.push(_),i=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=i,s=(e=z.__P).namespaceURI,u=n=null,r.props&&r.props.__P!=e&&(r.__k.some(function(de){de&&Wd(de,de)}),r.__k=null),i=r.__k?zr(r,0):null),i=pv(e,Vd(X)?X:[X],t,r,o,s,n,a,i,u,l),z.__P&&(t.__e=null,i=d),t.__u&=-161,128&r.__u&&(_.__z=null),f&&f.some(pu),_.__h.length&&a.push(_),1&_.__g&&(_.__g&=-4)}catch(de){if(a.length=b,t.__v=null,u||n)if(de.then){if(ne=0,t.__u|=u?160:128,n){for(~(te=n.indexOf(i||void 0))||(te=n.length);(ae=n[te-1])&&ae.nodeType==8;)te--;for(;te<n.length;te++)if(ae=n[te]){if(n[te]=null,ae.nodeType==8){if(ae.data.startsWith("$s"))ne++||(xe=ae);else if(ne&&ae.data.startsWith("/$s")&&!--ne){i=ae;break}}else if(!ne)break}}if(!xe){for(;i&&i.nodeType==8&&i.nextSibling;)i=i.nextSibling;xe=i}t.__c.__z||(t.__c.__z=xe),t.__e=i}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 i=t.__e=Rx(r.__e,t,r,o,s,n,a,u,l,e);return(d=le.diffed)&&d(t),128&t.__u?void 0:i}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,a,i,u,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),i&&(le.__m&&le.__m(t,n),i=!1),n=null}if(x){if(l=x=="template"?e.content:e,n=x=="textarea"&&q.defaultValue!=null?null:n&&dv.call(l.childNodes),!i&&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)||au(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:i&&typeof b!="function"||!(z[d]!==b||A&&b!=null)||au(e,d,b,z[d],s);f?(i||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,a,n?n[0]:r.__k&&zr(r,0),i,u),n&&n.some(pu)),i&&x!="textarea"||(d="value",x=="progress"&&_==null?e.removeAttribute(d):_==null||_===e[d]&&(x!="progress"||_)||au(e,d,_,z[d],s),d="checked",w!=null&&w!=e[d]&&au(e,d,w,z[d],s))}else z===q||i&&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,a;t=t.__;)if((s=t.__c)&&!(1&s.__g)){s.__g|=4;try{if((n=s.constructor)&&n.getDerivedStateFromError&&(s.setState(n.getDerivedStateFromError(e)),a=8&s.__g),s.componentDidCatch&&(s.componentDidCatch(e,o||{}),a=8&s.__g),a)return void(s.__g|=2)}catch(i){e=i,a=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},iu=Symbol(),lv=/(PointerCapture)$|Capture$/i,Fd=0,Ud={};var kx=0;function S(e,t,r,o,s,n){t||(t={});var a,i,u=t;if("ref"in u&&typeof e!="function")for(i in u={},t)i=="ref"?a=t[i]:u[i]=t[i];var l={type:e,props:u,key:r,ref:a,__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((i)=>{if(i.startsWith("atm_")){let[,u]=i.split("_");r[u]=i}else o.push(i)})});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=(a)=>[...new Set([...Array.from({length:Math.floor(a/s)+1},(i,u)=>u*s),...r?[a/2]:[],a])].sort((i,u)=>i-u);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((a)=>S("line",{className:r&&a*2===e.width?"mid":void 0,x1:e.x+a,x2:e.x+a,y1:e.y,y2:e.y+e.height},`x${a}`)),n(e.height).map((a)=>S("line",{className:r&&a*2===e.height?"mid":void 0,x1:e.x,x2:e.x+e.width,y1:e.y+a,y2:e.y+a},`y${a}`))]})}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 qe({id:e,label:t,iconOnly:r,children:o,disabled:s,hidden:n,pressed:a,current:i,expanded:u,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":a,"aria-current":i?"page":void 0,"aria-expanded":u,"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>',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 Ae({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:a,onClick:i}){return S("a",{className:pe("ds-navigation-item",Fx),href:t,"aria-current":r?"page":void 0,"aria-description":s,onClick:i,children:[e,n&&S("span",{className:"draft-badge",title:a,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:a}){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:a})}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(Ae,{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:a}){var i;let u=(i=Md.find((l)=>l.name===r))==null?void 0:i.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(qe,{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:u}),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(Ae,{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(qe,{id:`${e}-preset-${l.name}`,label:l.label,onClick:()=>a==null?void 0:a(l.name)},l.name))]})]})})}var _i,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(_i++,2);if(o.t=e,!o.__c&&(o.__=[xv(void 0,t),function(n){var a=o.__N?o.__N[0]:o.__[0],i=o.t(a,n);Dd(a,i)||(o.__N=[i,o.__[1]],o.__c.setState({}))}],o.__c=Pe,!Pe.__f)){Pe.__f=!0;var s=Pe.shouldComponentUpdate;Pe.shouldComponentUpdate=function(n,a,i){var u=this.__H;if(!u)return!0;var l=!1,d=this.props!=n;if(u.__.some(function(h){h.__N&&(l=!0,Dd(h.__[0],h.__N[0])||(d=!0))}),s){var f=s.call(this,n,a,i);return l?f||d:f}return!l||d}}return o.__}function tk(e,t){var r=Kd(_i++,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(_i++,7);return Rv(r.__H,t)&&(r.__=e(),r.__H=t),r.__}function sk(){var e;do{for(;e=Zd.shift();)try{fi(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(fi),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),_i=0;var t=(Pe=e.__c).__H;t&&(Ad==Pe?Pe.__h=[]:(t.__h.some(fi),t.__h.some(Hd),_i=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(fi),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 fi(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 fi(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",av="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!==av||n.localName!=="svg")return;for(let i of n.querySelectorAll("*"))if(["script","foreignObject","iframe","image","a","animate","set","animateTransform","animateMotion"].includes(i.localName)||i.namespaceURI!==av)i.remove();for(let i of[n,...n.querySelectorAll("*")])for(let u of Array.from(i.attributes))if(/^on/i.test(u.name)||/href$/i.test(u.name)&&!u.value.trim().startsWith("#"))i.removeAttribute(u.name);let a=document.importNode(n,!0);return a.removeAttribute("class"),a.setAttribute("width",String(t)),a.setAttribute("height",String(t)),a.setAttribute("aria-hidden","true"),a.setAttribute("focusable","false"),(s=o.current)==null||s.replaceChildren(a),()=>{var i;return(i=o.current)==null?void 0:i.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 iv({finding:e}){return S("p",{className:"icons-finding",title:e.file,children:[S("strong",{children:e.rule})," ",e.message]})}function ak({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((a)=>a.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,a)=>S(iv,{finding:n},a)),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 a;return S("span",{className:"icons-set-item","data-glyph":n.name,role:"listitem",children:S(Ld,{item:n,size:((a=e.textSize)==null?void 0:a.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((a)=>a.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((a)=>S("span",{className:"icons-size",children:[S(Ld,{item:n,size:a.px}),S("small",{title:a.token,children:a.px})]},a.token))}),n.findings.map((a,i)=>S(iv,{finding:a},i))]},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 ik="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",ik),"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(Ae,{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=[],a=[];for(let i of[...o?[o[2]]:[],...r].map((u)=>u.trim()).filter(Boolean)){let u=/^(\S+?:\d+(?::\d+)?|[\w./-]+\.\w+):\s+(?:([a-z][a-z0-9-]*):\s+)?(.+)$/.exec(i);if(!u){a.push(i);continue}let l=u[3],d=/^(.+?[.!?])\s+(.+)$/.exec(l);n.push({location:u[1],rule:u[2],summary:d?d[1]:l,detail:d==null?void 0:d[2]})}return{title:s,problems:n,notes:a}}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=(a)=>e+a;return S("div",{className:pe("ux-preview-status",dk),children:[S(qe,{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(qe,{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:a,overlays:i,previewOverlay:u,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})]})]}),i,S("main",{className:pe("ux-workspace-main",t||r?$v:Ev),children:[S("aside",{id:"sidebar",className:"ux-workspace-sidebar",children:a}),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:[u,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:a,children:i}){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(qe,{id:"pane-toggle",label:"Hide navigation pane",iconOnly:!0,expanded:!0,controls:"sidebar",children:S(Ae,{name:"chevron-left"})})]}),sections:S(Qt,{children:[S(qe,{label:"Brand",section:"brand",current:r==="brand",children:S(Ae,{name:"brand"})}),S(qe,{label:"Icons",section:"icons",current:r==="icons",children:S(Ae,{name:"icons"})}),S(qe,{label:"Tokens",section:"tokens",current:r==="tokens",children:S(Ae,{name:"tokens"})}),S(qe,{label:"Components",section:"components",current:r==="components",children:S(Ae,{name:"components"})}),S(qe,{label:"Patterns",section:"patterns",current:r==="patterns",children:S(Ae,{name:"patterns"})}),S(qe,{label:"Composition",section:"composition",current:r==="composition",children:S(Ae,{name:"composition"})}),S(qe,{label:"Drafts",section:"drafts",current:r==="drafts",children:S(Ae,{name:"drafts"})})]}),actions:S(Qt,{children:[S(fk,{...o}),S(qe,{id:"viewport",label:"Phone viewport",iconOnly:!0,pressed:!1,controls:"frame-slot",children:S(Ae,{name:"phone"})}),S(qe,{id:"grid-overlay",label:"Layout guides",iconOnly:!0,controls:"grid-options",popoverTarget:"grid-options",hidden:!s,children:S(Ae,{name:"layout"})}),S("select",{id:"brand-select",className:"ux-workspace-brand-select","aria-label":"Preview brand",hidden:!0}),S(qe,{id:"theme",label:"Use dark theme",iconOnly:!0,children:S(Ae,{name:"moon"})}),S(qe,{id:"minimize",label:"Minimize showcase menu",iconOnly:!0,children:S(Ae,{name:"chevron-up"})})]}),overlays:S(Xx,{...n}),navigation:S(uk,{id:"entries",label:"Entries",children:a}),previewTools:S(qe,{id:"split-view",label:"Split view",iconOnly:!0,pressed:!1,disabled:!0,hidden:!0,children:S(Ae,{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:i})}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 gi=new WeakMap;function fu(e){let t=gi.get(e);return!!t&&t.parentNode===e&&!!t.firstElementChild}function Yd(e,t){let r=gi.get(e);if(!r||r.parentNode!==e){if(r)So(null,r);r=document.createElement("div"),r.className="ux-icons-mount",gi.set(e,r),e.replaceChildren(r)}return So(S(ak,{data:t}),r),r.firstElementChild}function Xd(e){let t=gi.get(e);if(!t)return;So(null,t),t.remove(),gi.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","tokens","components","patterns","composition","drafts"],vu=!1,bo=[],ze,yo=Ke.get("draft"),nm=[],Uv=[],am=new Map,kr=Ke.get("split")==="1",tm,Pr=[],Mt=0,zu;async function Ri(){let e=Pr;Pr=[],await Promise.allSettled(e.map((t)=>t.close()))}var zs=P("split-view"),G="brand",$e={},Av=new Map,ys=!0,Ru=[],vi=[],xu=[],ct,Ts,Re,ve,ws,bi,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,yi=!1,Rr,er,Qd=0,Si,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)}}),im=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=Ts?.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===$e[G])}function Es(e=Er()){let t=bo.find((r)=>r.id===yo&&am.get(r.id)?.scenario===e?.id);return e?.drafts?.find((r)=>r.id===yo)??t??e?.drafts?.[0]}function cm(){return Boolean(Es()&&(G==="drafts"||Er()?.draftOnly||kr))}function wi(){return G==="drafts"?Er()?.previewId:$e[G]}function zi(){return`${G}:${$e[G]}${cm()?`:draft:${Es().id}:split:${kr}`:""}`}function gu(e=Re){return e?.key===zi()}function Wv(e=Ts){if(cm()){let t=e?.drafts?.find((r)=>r.id===Es()?.id);return t?.scenarios?.find((r)=>r.id===wi())??t}return e?.previews?.find((t)=>t.id===wi())}var Kv=(e)=>JSON.stringify(e&&[e.session,e.revision,e.current,e.live]);function Gv(){({scenarios:vi,categories:Ru}=US(nm,Uv,bo,am))}function zk(e){am.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((a)=>t==="tokens"?a.kind==="tokens":a.unit?a.unit===t:nu(t,a.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((a)=>a.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=Es(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(vi,bo):G==="tokens"?Ru:G==="icons"?[{id:"icons",kind:"icons",title:"All icons"}]:vi.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,Ts,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"&&wi()==="tokens/Layout";function xi(){return Ps}function Rk(){return HS(xi())}function Qv(){return FS(xi())}function eb(){let e=Xv(),t=xi(),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===wi()?{adsFocus:Su}:{},theme:rm(),adsTheme:Tr,...tr?{adsBrand:tr}:{},gridOverlay:Xv()&&Qv(),gridGuides:Rk(),gridGuideChoices:xi(),displayMode:"inline",containerDimensions:{width:P("frame-slot").clientWidth,height:P("frame-slot").clientHeight}}}function $s(){P("workspace").dataset.loading="false",P("workspace").setAttribute("aria-busy","false");let e=vi.some((n)=>n.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";document.body.dataset.activeSection=G;let t=$r();if(!t.some((n)=>n.id===$e[G]))$e[G]=t[0]?.id??null;eb(),ve?.setHostContext(Lt()),history.replaceState(null,"",em($e[G]));let r=P("entries").scrollTop;P("entries").setAttribute("aria-label",G[0].toUpperCase()+G.slice(1));let o=(n)=>{let a=n.kind==="icons"&&G==="icons"?void 0:jd(n.previewId?{...n,id:n.previewId}:n,Ts,yo),i=n.drafts?.length&&G!=="drafts",u=Ov({label:n.title,href:em(n.id),current:n.id===$e[G],previewState:a?.state,previewLabel:a?.label,draftLabel:i?n.drafts.length>1?`Drafts ${n.drafts.length}`:"Draft":void 0,draftDescription:i?n.draftOnly?"Draft only; no accepted version yet":"Draft available; use Split view to compare":void 0});if(u.href=em(n.id),u.dataset.scenario=n.id,Yv(u,n),n.id===$e[G])u.setAttribute("aria-current","page");return u.addEventListener("click",(l)=>{if(l.button||l.metaKey||l.ctrlKey||l.shiftKey||l.altKey)return;l.preventDefault(),$e[G]=n.id,$s(),Ut().catch(lt)}),u},s=MS(t);if(G==="drafts"){let n=Object.values(su);s.sort((a,i)=>n.indexOf(a.label)-n.indexOf(i.label))}P("entries").replaceChildren(...s.flatMap((n)=>{if(!n.label)return n.entries.map(o);let a=`${G}:${n.label}`,i=qv({label:n.label,open:Av.get(a)??!0});return i.querySelector('[data-slot="entries"]').append(...n.entries.map(o)),i.addEventListener("toggle",()=>{if(i.isConnected)Av.set(a,i.open)}),[i]})),P("entries").scrollTop=r;for(let n of P("sections").querySelectorAll("button"))if(n.dataset.section===G)n.setAttribute("aria-current","page");else n.removeAttribute("aria-current");wu()}function lt(e){if(!Pu&&!yi)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||yi)return;yi=!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,Ri()}async function lm(){let e=await im("ads://project/explorer");if(ct=e.status,Ts=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:$e[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 a of Pr)if(a.side==="draft")await a.updateResult(n)}}let s=vi.find((n)=>n.id===t);if(G==="drafts"||ys&&Ke.get("section")==="drafts"){G="drafts";let n=$r(),a=n.find((i)=>i.drafts?.[0].id===yo&&i.previewId===t)??n.find((i)=>i.id===$e.drafts)??n.find((i)=>i.drafts?.[0].id===yo);$e.drafts=a?.id??n[0]?.id}else if(s&&wk.includes(s.kind))G=s.kind,$e[G]=s.id;else if(ys&&Ru.some((n)=>n.id===t))G="tokens",$e.tokens=t;else if(ys&&Ke.get("section")==="icons"&&ct.icons)G="icons";ys=!1,$s()}function Ut({force:e=!1}={}){if(yi)return Promise.resolve();if(G==="icons")return kk(e);vu=!1,Xd(P("frame-slot"));let t=wi(),r=zi();if(ws?.key===r)return ws.promise;if(!e&&bi?.key===r)return Promise.resolve();if(!e&&!ws&&Re?.key===r)return Promise.resolve();bi=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 Ri(),o!==ot)return;if(cm()){await xr(ve),ve=void 0,Rr=void 0,er=void 0;let u=Es(),l=await um(u,e,r.signal);if(o!==ot)return;if(ze=l.structuredContent,zu=l,G==="drafts"){let d=$r().find((f)=>f.drafts?.[0].id===u.id&&f.previewId===ze.scenario);if(d)$e.drafts=d.id}else if(Er()?.pendingDraftScenario||!$r().some((d)=>d.id===e))$e[G]=ze.scenario;Re={key:zi(),id:ze.scenario,draftId:u.id,generation:o,draft:!0},wu(),await Ek(),$s(),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((u)=>u.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 a=await sm(s.name,n,r.signal);if(o!==ot)return;if(a.isError)throw Object.assign(Error(a.content?.find((u)=>u.type==="text")?.text??"Preview build failed."),a.structuredContent?.failure);Re={key:t,id:e,generation:o,build:a.structuredContent?.build,manifestRevision:a.structuredContent?.manifestRevision};let i=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 i.sendToolInput({arguments:n}),await i.sendToolResult(a),o===ot&&!a.structuredContent?.manifestUri)rr(!0),be("")}catch(s){if(o===ot)bi={key:zi(),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 Ri();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 im(_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||yi)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=Si,P("frame-slot").replaceChildren(n);let a=new pi(null,{name:"ADS showcase",version:"1.0.0"},{serverResources:{},serverTools:{},logging:{}},{hostContext:Lt()});ve=a,a.onreadresource=(l)=>yu(l),a.oncalltool=Fv,a.onloggingmessage=(l)=>{if(a!==ve||l.logger!=="ads-preview"||Re?.generation!==ot||!gu()||l.data?.id!==Re?.id)return;if(l.data.state==="guide-options"){Ps=hi(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()},$e.tokens===f.id&&G==="tokens"){ve?.setHostContext(Lt());return}G="tokens",$e.tokens=f.id,$s(),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(a).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)}},a.onerror=lt;let i,u=new Promise((l,d)=>{i=setTimeout(()=>d(Error("MCP App initialization timed out.")),15000),a.oninitialized=()=>{clearTimeout(i),l()}});a.onsandboxready=()=>a.sendSandboxResourceReady({html:s.text,csp:s._meta?.ui?.csp,sandbox:"allow-scripts allow-forms"});try{await Promise.all([a.connect(new mi(n.contentWindow,n.contentWindow)),u])}catch(l){throw await xr(a),l}finally{clearTimeout(i)}return a})();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 im("ads://project/build");Ts=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(bi?.key===zi()){let o=Wv(t);if(o&&(o.current||o.live)&&Kv(o)!==bi.build)await Ut({force:!0});return}if(!e||xs||!gu(e))return;if(e.draft){let o=t.drafts?.find((a)=>a.id===e.draftId),s=o?.scenarios?.find((a)=>a.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 a=bo.find((i)=>i.id===e.draftId);if(a){let i=await um(a,ze.scenario);if(Re!==e||xs||!gu(e))return;ze=i.structuredContent,zu=i;for(let u of Pr)if(u.side==="draft")await u.updateResult(i)}}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(`${Zi(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 Ri(),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 a=document.createElement("section");a.className="draft-version";let i=document.createElement("h2");i.dataset.version=n,i.textContent=n==="accepted"?"Accepted":"Draft · unaccepted";let u=document.createElement("div");u.className="draft-stage",u.dataset.version=n,a.append(i,u),s.append(a)}P("frame-slot").replaceChildren(s),await Promise.all([...s.querySelectorAll(".draft-stage")].map(async(n)=>{let a=n.dataset.version,i=a==="draft"?t:await Hv("ads_show_scenario",{id:e.scenario,waitFor:"compiled"});if(i.isError)throw Error(i.content?.find((d)=>d.type==="text")?.text??"Comparison build failed.");if(r!==Mt)return;let u=xu.find((d)=>d.name===(a==="draft"?"ads_show_draft":"ads_show_scenario")),l=await LS({slot:n,title:a==="draft"?"Draft version":"Accepted version",sandboxUrl:Si,resourceUri:u._meta.ui.resourceUri,result:i,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=hi(d.options),fm();return}if(a!=="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:a})}))}function wu(){let e=Er(),t=Boolean(Es(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,$s(),Ut().catch(lt)});for(let e of P("sections").querySelectorAll("button"))e.addEventListener("click",()=>{G=e.dataset.section,$s(),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=xi();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,Ri(),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(Si=(await fetch("host.json").then((e)=>e.json())).sandboxUrl,!Si||new URL(Si).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: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)}