@opentiny/next-sdk 0.1.14-alpha.0 → 0.1.15-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. package/agent/AgentModelProvider.ts +490 -1
  2. package/agent/type.ts +8 -2
  3. package/agent/utils/generateReActPrompt.ts +55 -0
  4. package/agent/utils/parseReActAction.ts +34 -0
  5. package/dist/WebMcpClient.d.ts +165 -26
  6. package/dist/WebMcpServer.d.ts +36 -147
  7. package/dist/agent/AgentModelProvider.d.ts +35 -1
  8. package/dist/agent/type.d.ts +8 -2
  9. package/dist/agent/utils/generateReActPrompt.d.ts +9 -0
  10. package/dist/agent/utils/parseReActAction.d.ts +14 -0
  11. package/dist/index.es.dev.js +14874 -11156
  12. package/dist/index.es.js +20957 -18178
  13. package/dist/index.js +2411 -320
  14. package/dist/index.umd.dev.js +14899 -11181
  15. package/dist/index.umd.js +111 -71
  16. package/dist/{mcpsdk@1.23.0.dev.js → mcpsdk@1.24.3.dev.js} +8866 -7205
  17. package/dist/{mcpsdk@1.23.0.es.dev.js → mcpsdk@1.24.3.es.dev.js} +8864 -7203
  18. package/dist/mcpsdk@1.24.3.es.js +16781 -0
  19. package/dist/mcpsdk@1.24.3.js +43 -0
  20. package/dist/transport/ExtensionPageServerTransport.d.ts +1 -2
  21. package/dist/webagent.dev.js +13963 -10522
  22. package/dist/webagent.es.dev.js +13949 -10508
  23. package/dist/webagent.es.js +18247 -15690
  24. package/dist/webagent.js +105 -65
  25. package/dist/webmcp-full.dev.js +8874 -7257
  26. package/dist/webmcp-full.es.dev.js +8872 -7255
  27. package/dist/webmcp-full.es.js +10395 -9241
  28. package/dist/webmcp-full.js +32 -32
  29. package/dist/webmcp.dev.js +14 -22
  30. package/dist/webmcp.es.dev.js +12 -20
  31. package/dist/webmcp.es.js +172 -179
  32. package/dist/webmcp.js +1 -1
  33. package/dist/zod@3.25.76.dev.js +30 -32
  34. package/dist/zod@3.25.76.es.dev.js +28 -30
  35. package/dist/zod@3.25.76.es.js +143 -145
  36. package/dist/zod@3.25.76.js +1 -1
  37. package/package.json +9 -8
  38. package/transport/ExtensionPageServerTransport.ts +2 -4
  39. package/dist/mcpsdk@1.23.0.es.js +0 -15584
  40. package/dist/mcpsdk@1.23.0.js +0 -43
@@ -0,0 +1,43 @@
1
+ (function($,Yt){typeof exports=="object"&&typeof module<"u"?Yt(exports):typeof define=="function"&&define.amd?define(["exports"],Yt):($=typeof globalThis<"u"?globalThis:$||self,Yt($.MCPSDK={}))})(this,(function($){"use strict";function Yt(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Qr={exports:{}},xs={},vt={},qt={},Ls={},Us={},Ds={},xi;function Xr(){return xi||(xi=1,(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.regexpCode=t.getEsmExportName=t.getProperty=t.safeStringify=t.stringify=t.strConcat=t.addCodeArg=t.str=t._=t.nil=t._Code=t.Name=t.IDENTIFIER=t._CodeOrName=void 0;class e{}t._CodeOrName=e,t.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;class r extends e{constructor(d){if(super(),!t.IDENTIFIER.test(d))throw new Error("CodeGen: name must be a valid identifier");this.str=d}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}}t.Name=r;class n extends e{constructor(d){super(),this._items=typeof d=="string"?[d]:d}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;const d=this._items[0];return d===""||d==='""'}get str(){var d;return(d=this._str)!==null&&d!==void 0?d:this._str=this._items.reduce((m,b)=>`${m}${b}`,"")}get names(){var d;return(d=this._names)!==null&&d!==void 0?d:this._names=this._items.reduce((m,b)=>(b instanceof r&&(m[b.str]=(m[b.str]||0)+1),m),{})}}t._Code=n,t.nil=new n("");function s(_,...d){const m=[_[0]];let b=0;for(;b<d.length;)o(m,d[b]),m.push(_[++b]);return new n(m)}t._=s;const a=new n("+");function i(_,...d){const m=[v(_[0])];let b=0;for(;b<d.length;)m.push(a),o(m,d[b]),m.push(a,v(_[++b]));return c(m),new n(m)}t.str=i;function o(_,d){d instanceof n?_.push(...d._items):d instanceof r?_.push(d):_.push(f(d))}t.addCodeArg=o;function c(_){let d=1;for(;d<_.length-1;){if(_[d]===a){const m=l(_[d-1],_[d+1]);if(m!==void 0){_.splice(d-1,3,m);continue}_[d++]="+"}d++}}function l(_,d){if(d==='""')return _;if(_==='""')return d;if(typeof _=="string")return d instanceof r||_[_.length-1]!=='"'?void 0:typeof d!="string"?`${_.slice(0,-1)}${d}"`:d[0]==='"'?_.slice(0,-1)+d.slice(1):void 0;if(typeof d=="string"&&d[0]==='"'&&!(_ instanceof r))return`"${_}${d.slice(1)}`}function u(_,d){return d.emptyStr()?_:_.emptyStr()?d:i`${_}${d}`}t.strConcat=u;function f(_){return typeof _=="number"||typeof _=="boolean"||_===null?_:v(Array.isArray(_)?_.join(","):_)}function y(_){return new n(v(_))}t.stringify=y;function v(_){return JSON.stringify(_).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}t.safeStringify=v;function p(_){return typeof _=="string"&&t.IDENTIFIER.test(_)?new n(`.${_}`):s`[${_}]`}t.getProperty=p;function w(_){if(typeof _=="string"&&t.IDENTIFIER.test(_))return new n(`${_}`);throw new Error(`CodeGen: invalid export name: ${_}, use explicit $id name mapping`)}t.getEsmExportName=w;function h(_){return new n(_.toString())}t.regexpCode=h})(Ds)),Ds}var Vs={},Li;function Ui(){return Li||(Li=1,(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.ValueScope=t.ValueScopeName=t.Scope=t.varKinds=t.UsedValueState=void 0;const e=Xr();class r extends Error{constructor(l){super(`CodeGen: "code" for ${l} not defined`),this.value=l.value}}var n;(function(c){c[c.Started=0]="Started",c[c.Completed=1]="Completed"})(n||(t.UsedValueState=n={})),t.varKinds={const:new e.Name("const"),let:new e.Name("let"),var:new e.Name("var")};class s{constructor({prefixes:l,parent:u}={}){this._names={},this._prefixes=l,this._parent=u}toName(l){return l instanceof e.Name?l:this.name(l)}name(l){return new e.Name(this._newName(l))}_newName(l){const u=this._names[l]||this._nameGroup(l);return`${l}${u.index++}`}_nameGroup(l){var u,f;if(!((f=(u=this._parent)===null||u===void 0?void 0:u._prefixes)===null||f===void 0)&&f.has(l)||this._prefixes&&!this._prefixes.has(l))throw new Error(`CodeGen: prefix "${l}" is not allowed in this scope`);return this._names[l]={prefix:l,index:0}}}t.Scope=s;class a extends e.Name{constructor(l,u){super(u),this.prefix=l}setValue(l,{property:u,itemIndex:f}){this.value=l,this.scopePath=(0,e._)`.${new e.Name(u)}[${f}]`}}t.ValueScopeName=a;const i=(0,e._)`\n`;class o extends s{constructor(l){super(l),this._values={},this._scope=l.scope,this.opts={...l,_n:l.lines?i:e.nil}}get(){return this._scope}name(l){return new a(l,this._newName(l))}value(l,u){var f;if(u.ref===void 0)throw new Error("CodeGen: ref must be passed in value");const y=this.toName(l),{prefix:v}=y,p=(f=u.key)!==null&&f!==void 0?f:u.ref;let w=this._values[v];if(w){const d=w.get(p);if(d)return d}else w=this._values[v]=new Map;w.set(p,y);const h=this._scope[v]||(this._scope[v]=[]),_=h.length;return h[_]=u.ref,y.setValue(u,{property:v,itemIndex:_}),y}getValue(l,u){const f=this._values[l];if(f)return f.get(u)}scopeRefs(l,u=this._values){return this._reduceValues(u,f=>{if(f.scopePath===void 0)throw new Error(`CodeGen: name "${f}" has no value`);return(0,e._)`${l}${f.scopePath}`})}scopeCode(l=this._values,u,f){return this._reduceValues(l,y=>{if(y.value===void 0)throw new Error(`CodeGen: name "${y}" has no value`);return y.value.code},u,f)}_reduceValues(l,u,f={},y){let v=e.nil;for(const p in l){const w=l[p];if(!w)continue;const h=f[p]=f[p]||new Map;w.forEach(_=>{if(h.has(_))return;h.set(_,n.Started);let d=u(_);if(d){const m=this.opts.es5?t.varKinds.var:t.varKinds.const;v=(0,e._)`${v}${m} ${_} = ${d};${this.opts._n}`}else if(d=y?.(_))v=(0,e._)`${v}${d}${this.opts._n}`;else throw new r(_);h.set(_,n.Completed)})}return v}}t.ValueScope=o})(Vs)),Vs}var Di;function ie(){return Di||(Di=1,(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.or=t.and=t.not=t.CodeGen=t.operators=t.varKinds=t.ValueScopeName=t.ValueScope=t.Scope=t.Name=t.regexpCode=t.stringify=t.getProperty=t.nil=t.strConcat=t.str=t._=void 0;const e=Xr(),r=Ui();var n=Xr();Object.defineProperty(t,"_",{enumerable:!0,get:function(){return n._}}),Object.defineProperty(t,"str",{enumerable:!0,get:function(){return n.str}}),Object.defineProperty(t,"strConcat",{enumerable:!0,get:function(){return n.strConcat}}),Object.defineProperty(t,"nil",{enumerable:!0,get:function(){return n.nil}}),Object.defineProperty(t,"getProperty",{enumerable:!0,get:function(){return n.getProperty}}),Object.defineProperty(t,"stringify",{enumerable:!0,get:function(){return n.stringify}}),Object.defineProperty(t,"regexpCode",{enumerable:!0,get:function(){return n.regexpCode}}),Object.defineProperty(t,"Name",{enumerable:!0,get:function(){return n.Name}});var s=Ui();Object.defineProperty(t,"Scope",{enumerable:!0,get:function(){return s.Scope}}),Object.defineProperty(t,"ValueScope",{enumerable:!0,get:function(){return s.ValueScope}}),Object.defineProperty(t,"ValueScopeName",{enumerable:!0,get:function(){return s.ValueScopeName}}),Object.defineProperty(t,"varKinds",{enumerable:!0,get:function(){return s.varKinds}}),t.operators={GT:new e._Code(">"),GTE:new e._Code(">="),LT:new e._Code("<"),LTE:new e._Code("<="),EQ:new e._Code("==="),NEQ:new e._Code("!=="),NOT:new e._Code("!"),OR:new e._Code("||"),AND:new e._Code("&&"),ADD:new e._Code("+")};class a{optimizeNodes(){return this}optimizeNames(k,T){return this}}class i extends a{constructor(k,T,z){super(),this.varKind=k,this.name=T,this.rhs=z}render({es5:k,_n:T}){const z=k?r.varKinds.var:this.varKind,ee=this.rhs===void 0?"":` = ${this.rhs}`;return`${z} ${this.name}${ee};`+T}optimizeNames(k,T){if(k[this.name.str])return this.rhs&&(this.rhs=Y(this.rhs,k,T)),this}get names(){return this.rhs instanceof e._CodeOrName?this.rhs.names:{}}}class o extends a{constructor(k,T,z){super(),this.lhs=k,this.rhs=T,this.sideEffects=z}render({_n:k}){return`${this.lhs} = ${this.rhs};`+k}optimizeNames(k,T){if(!(this.lhs instanceof e.Name&&!k[this.lhs.str]&&!this.sideEffects))return this.rhs=Y(this.rhs,k,T),this}get names(){const k=this.lhs instanceof e.Name?{}:{...this.lhs.names};return G(k,this.rhs)}}class c extends o{constructor(k,T,z,ee){super(k,z,ee),this.op=T}render({_n:k}){return`${this.lhs} ${this.op}= ${this.rhs};`+k}}class l extends a{constructor(k){super(),this.label=k,this.names={}}render({_n:k}){return`${this.label}:`+k}}class u extends a{constructor(k){super(),this.label=k,this.names={}}render({_n:k}){return`break${this.label?` ${this.label}`:""};`+k}}class f extends a{constructor(k){super(),this.error=k}render({_n:k}){return`throw ${this.error};`+k}get names(){return this.error.names}}class y extends a{constructor(k){super(),this.code=k}render({_n:k}){return`${this.code};`+k}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(k,T){return this.code=Y(this.code,k,T),this}get names(){return this.code instanceof e._CodeOrName?this.code.names:{}}}class v extends a{constructor(k=[]){super(),this.nodes=k}render(k){return this.nodes.reduce((T,z)=>T+z.render(k),"")}optimizeNodes(){const{nodes:k}=this;let T=k.length;for(;T--;){const z=k[T].optimizeNodes();Array.isArray(z)?k.splice(T,1,...z):z?k[T]=z:k.splice(T,1)}return k.length>0?this:void 0}optimizeNames(k,T){const{nodes:z}=this;let ee=z.length;for(;ee--;){const se=z[ee];se.optimizeNames(k,T)||(ge(k,se.names),z.splice(ee,1))}return z.length>0?this:void 0}get names(){return this.nodes.reduce((k,T)=>H(k,T.names),{})}}class p extends v{render(k){return"{"+k._n+super.render(k)+"}"+k._n}}class w extends v{}class h extends p{}h.kind="else";class _ extends p{constructor(k,T){super(T),this.condition=k}render(k){let T=`if(${this.condition})`+super.render(k);return this.else&&(T+="else "+this.else.render(k)),T}optimizeNodes(){super.optimizeNodes();const k=this.condition;if(k===!0)return this.nodes;let T=this.else;if(T){const z=T.optimizeNodes();T=this.else=Array.isArray(z)?new h(z):z}if(T)return k===!1?T instanceof _?T:T.nodes:this.nodes.length?this:new _(He(k),T instanceof _?[T]:T.nodes);if(!(k===!1||!this.nodes.length))return this}optimizeNames(k,T){var z;if(this.else=(z=this.else)===null||z===void 0?void 0:z.optimizeNames(k,T),!!(super.optimizeNames(k,T)||this.else))return this.condition=Y(this.condition,k,T),this}get names(){const k=super.names;return G(k,this.condition),this.else&&H(k,this.else.names),k}}_.kind="if";class d extends p{}d.kind="for";class m extends d{constructor(k){super(),this.iteration=k}render(k){return`for(${this.iteration})`+super.render(k)}optimizeNames(k,T){if(super.optimizeNames(k,T))return this.iteration=Y(this.iteration,k,T),this}get names(){return H(super.names,this.iteration.names)}}class b extends d{constructor(k,T,z,ee){super(),this.varKind=k,this.name=T,this.from=z,this.to=ee}render(k){const T=k.es5?r.varKinds.var:this.varKind,{name:z,from:ee,to:se}=this;return`for(${T} ${z}=${ee}; ${z}<${se}; ${z}++)`+super.render(k)}get names(){const k=G(super.names,this.from);return G(k,this.to)}}class g extends d{constructor(k,T,z,ee){super(),this.loop=k,this.varKind=T,this.name=z,this.iterable=ee}render(k){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(k)}optimizeNames(k,T){if(super.optimizeNames(k,T))return this.iterable=Y(this.iterable,k,T),this}get names(){return H(super.names,this.iterable.names)}}class S extends p{constructor(k,T,z){super(),this.name=k,this.args=T,this.async=z}render(k){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(k)}}S.kind="func";class E extends v{render(k){return"return "+super.render(k)}}E.kind="return";class N extends p{render(k){let T="try"+super.render(k);return this.catch&&(T+=this.catch.render(k)),this.finally&&(T+=this.finally.render(k)),T}optimizeNodes(){var k,T;return super.optimizeNodes(),(k=this.catch)===null||k===void 0||k.optimizeNodes(),(T=this.finally)===null||T===void 0||T.optimizeNodes(),this}optimizeNames(k,T){var z,ee;return super.optimizeNames(k,T),(z=this.catch)===null||z===void 0||z.optimizeNames(k,T),(ee=this.finally)===null||ee===void 0||ee.optimizeNames(k,T),this}get names(){const k=super.names;return this.catch&&H(k,this.catch.names),this.finally&&H(k,this.finally.names),k}}class j extends p{constructor(k){super(),this.error=k}render(k){return`catch(${this.error})`+super.render(k)}}j.kind="catch";class D extends p{render(k){return"finally"+super.render(k)}}D.kind="finally";class M{constructor(k,T={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...T,_n:T.lines?`
2
+ `:""},this._extScope=k,this._scope=new r.Scope({parent:k}),this._nodes=[new w]}toString(){return this._root.render(this.opts)}name(k){return this._scope.name(k)}scopeName(k){return this._extScope.name(k)}scopeValue(k,T){const z=this._extScope.value(k,T);return(this._values[z.prefix]||(this._values[z.prefix]=new Set)).add(z),z}getScopeValue(k,T){return this._extScope.getValue(k,T)}scopeRefs(k){return this._extScope.scopeRefs(k,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(k,T,z,ee){const se=this._scope.toName(T);return z!==void 0&&ee&&(this._constants[se.str]=z),this._leafNode(new i(k,se,z)),se}const(k,T,z){return this._def(r.varKinds.const,k,T,z)}let(k,T,z){return this._def(r.varKinds.let,k,T,z)}var(k,T,z){return this._def(r.varKinds.var,k,T,z)}assign(k,T,z){return this._leafNode(new o(k,T,z))}add(k,T){return this._leafNode(new c(k,t.operators.ADD,T))}code(k){return typeof k=="function"?k():k!==e.nil&&this._leafNode(new y(k)),this}object(...k){const T=["{"];for(const[z,ee]of k)T.length>1&&T.push(","),T.push(z),(z!==ee||this.opts.es5)&&(T.push(":"),(0,e.addCodeArg)(T,ee));return T.push("}"),new e._Code(T)}if(k,T,z){if(this._blockNode(new _(k)),T&&z)this.code(T).else().code(z).endIf();else if(T)this.code(T).endIf();else if(z)throw new Error('CodeGen: "else" body without "then" body');return this}elseIf(k){return this._elseNode(new _(k))}else(){return this._elseNode(new h)}endIf(){return this._endBlockNode(_,h)}_for(k,T){return this._blockNode(k),T&&this.code(T).endFor(),this}for(k,T){return this._for(new m(k),T)}forRange(k,T,z,ee,se=this.opts.es5?r.varKinds.var:r.varKinds.let){const _e=this._scope.toName(k);return this._for(new b(se,_e,T,z),()=>ee(_e))}forOf(k,T,z,ee=r.varKinds.const){const se=this._scope.toName(k);if(this.opts.es5){const _e=T instanceof e.Name?T:this.var("_arr",T);return this.forRange("_i",0,(0,e._)`${_e}.length`,de=>{this.var(se,(0,e._)`${_e}[${de}]`),z(se)})}return this._for(new g("of",ee,se,T),()=>z(se))}forIn(k,T,z,ee=this.opts.es5?r.varKinds.var:r.varKinds.const){if(this.opts.ownProperties)return this.forOf(k,(0,e._)`Object.keys(${T})`,z);const se=this._scope.toName(k);return this._for(new g("in",ee,se,T),()=>z(se))}endFor(){return this._endBlockNode(d)}label(k){return this._leafNode(new l(k))}break(k){return this._leafNode(new u(k))}return(k){const T=new E;if(this._blockNode(T),this.code(k),T.nodes.length!==1)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(E)}try(k,T,z){if(!T&&!z)throw new Error('CodeGen: "try" without "catch" and "finally"');const ee=new N;if(this._blockNode(ee),this.code(k),T){const se=this.name("e");this._currNode=ee.catch=new j(se),T(se)}return z&&(this._currNode=ee.finally=new D,this.code(z)),this._endBlockNode(j,D)}throw(k){return this._leafNode(new f(k))}block(k,T){return this._blockStarts.push(this._nodes.length),k&&this.code(k).endBlock(T),this}endBlock(k){const T=this._blockStarts.pop();if(T===void 0)throw new Error("CodeGen: not in self-balancing block");const z=this._nodes.length-T;if(z<0||k!==void 0&&z!==k)throw new Error(`CodeGen: wrong number of nodes: ${z} vs ${k} expected`);return this._nodes.length=T,this}func(k,T=e.nil,z,ee){return this._blockNode(new S(k,T,z)),ee&&this.code(ee).endFunc(),this}endFunc(){return this._endBlockNode(S)}optimize(k=1){for(;k-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(k){return this._currNode.nodes.push(k),this}_blockNode(k){this._currNode.nodes.push(k),this._nodes.push(k)}_endBlockNode(k,T){const z=this._currNode;if(z instanceof k||T&&z instanceof T)return this._nodes.pop(),this;throw new Error(`CodeGen: not in block "${T?`${k.kind}/${T.kind}`:k.kind}"`)}_elseNode(k){const T=this._currNode;if(!(T instanceof _))throw new Error('CodeGen: "else" without "if"');return this._currNode=T.else=k,this}get _root(){return this._nodes[0]}get _currNode(){const k=this._nodes;return k[k.length-1]}set _currNode(k){const T=this._nodes;T[T.length-1]=k}}t.CodeGen=M;function H(O,k){for(const T in k)O[T]=(O[T]||0)+(k[T]||0);return O}function G(O,k){return k instanceof e._CodeOrName?H(O,k.names):O}function Y(O,k,T){if(O instanceof e.Name)return z(O);if(!ee(O))return O;return new e._Code(O._items.reduce((se,_e)=>(_e instanceof e.Name&&(_e=z(_e)),_e instanceof e._Code?se.push(..._e._items):se.push(_e),se),[]));function z(se){const _e=T[se.str];return _e===void 0||k[se.str]!==1?se:(delete k[se.str],_e)}function ee(se){return se instanceof e._Code&&se._items.some(_e=>_e instanceof e.Name&&k[_e.str]===1&&T[_e.str]!==void 0)}}function ge(O,k){for(const T in k)O[T]=(O[T]||0)-(k[T]||0)}function He(O){return typeof O=="boolean"||typeof O=="number"||O===null?!O:(0,e._)`!${Z(O)}`}t.not=He;const We=C(t.operators.AND);function be(...O){return O.reduce(We)}t.and=be;const ht=C(t.operators.OR);function V(...O){return O.reduce(ht)}t.or=V;function C(O){return(k,T)=>k===e.nil?T:T===e.nil?k:(0,e._)`${Z(k)} ${O} ${Z(T)}`}function Z(O){return O instanceof e.Name?O:(0,e._)`(${O})`}})(Us)),Us}var oe={},Vi;function he(){if(Vi)return oe;Vi=1,Object.defineProperty(oe,"__esModule",{value:!0}),oe.checkStrictMode=oe.getErrorPath=oe.Type=oe.useFunc=oe.setEvaluated=oe.evaluatedPropsToName=oe.mergeEvaluated=oe.eachItem=oe.unescapeJsonPointer=oe.escapeJsonPointer=oe.escapeFragment=oe.unescapeFragment=oe.schemaRefOrVal=oe.schemaHasRulesButRef=oe.schemaHasRules=oe.checkUnknownRules=oe.alwaysValidSchema=oe.toHash=void 0;const t=ie(),e=Xr();function r(g){const S={};for(const E of g)S[E]=!0;return S}oe.toHash=r;function n(g,S){return typeof S=="boolean"?S:Object.keys(S).length===0?!0:(s(g,S),!a(S,g.self.RULES.all))}oe.alwaysValidSchema=n;function s(g,S=g.schema){const{opts:E,self:N}=g;if(!E.strictSchema||typeof S=="boolean")return;const j=N.RULES.keywords;for(const D in S)j[D]||b(g,`unknown keyword: "${D}"`)}oe.checkUnknownRules=s;function a(g,S){if(typeof g=="boolean")return!g;for(const E in g)if(S[E])return!0;return!1}oe.schemaHasRules=a;function i(g,S){if(typeof g=="boolean")return!g;for(const E in g)if(E!=="$ref"&&S.all[E])return!0;return!1}oe.schemaHasRulesButRef=i;function o({topSchemaRef:g,schemaPath:S},E,N,j){if(!j){if(typeof E=="number"||typeof E=="boolean")return E;if(typeof E=="string")return(0,t._)`${E}`}return(0,t._)`${g}${S}${(0,t.getProperty)(N)}`}oe.schemaRefOrVal=o;function c(g){return f(decodeURIComponent(g))}oe.unescapeFragment=c;function l(g){return encodeURIComponent(u(g))}oe.escapeFragment=l;function u(g){return typeof g=="number"?`${g}`:g.replace(/~/g,"~0").replace(/\//g,"~1")}oe.escapeJsonPointer=u;function f(g){return g.replace(/~1/g,"/").replace(/~0/g,"~")}oe.unescapeJsonPointer=f;function y(g,S){if(Array.isArray(g))for(const E of g)S(E);else S(g)}oe.eachItem=y;function v({mergeNames:g,mergeToName:S,mergeValues:E,resultToName:N}){return(j,D,M,H)=>{const G=M===void 0?D:M instanceof t.Name?(D instanceof t.Name?g(j,D,M):S(j,D,M),M):D instanceof t.Name?(S(j,M,D),D):E(D,M);return H===t.Name&&!(G instanceof t.Name)?N(j,G):G}}oe.mergeEvaluated={props:v({mergeNames:(g,S,E)=>g.if((0,t._)`${E} !== true && ${S} !== undefined`,()=>{g.if((0,t._)`${S} === true`,()=>g.assign(E,!0),()=>g.assign(E,(0,t._)`${E} || {}`).code((0,t._)`Object.assign(${E}, ${S})`))}),mergeToName:(g,S,E)=>g.if((0,t._)`${E} !== true`,()=>{S===!0?g.assign(E,!0):(g.assign(E,(0,t._)`${E} || {}`),w(g,E,S))}),mergeValues:(g,S)=>g===!0?!0:{...g,...S},resultToName:p}),items:v({mergeNames:(g,S,E)=>g.if((0,t._)`${E} !== true && ${S} !== undefined`,()=>g.assign(E,(0,t._)`${S} === true ? true : ${E} > ${S} ? ${E} : ${S}`)),mergeToName:(g,S,E)=>g.if((0,t._)`${E} !== true`,()=>g.assign(E,S===!0?!0:(0,t._)`${E} > ${S} ? ${E} : ${S}`)),mergeValues:(g,S)=>g===!0?!0:Math.max(g,S),resultToName:(g,S)=>g.var("items",S)})};function p(g,S){if(S===!0)return g.var("props",!0);const E=g.var("props",(0,t._)`{}`);return S!==void 0&&w(g,E,S),E}oe.evaluatedPropsToName=p;function w(g,S,E){Object.keys(E).forEach(N=>g.assign((0,t._)`${S}${(0,t.getProperty)(N)}`,!0))}oe.setEvaluated=w;const h={};function _(g,S){return g.scopeValue("func",{ref:S,code:h[S.code]||(h[S.code]=new e._Code(S.code))})}oe.useFunc=_;var d;(function(g){g[g.Num=0]="Num",g[g.Str=1]="Str"})(d||(oe.Type=d={}));function m(g,S,E){if(g instanceof t.Name){const N=S===d.Num;return E?N?(0,t._)`"[" + ${g} + "]"`:(0,t._)`"['" + ${g} + "']"`:N?(0,t._)`"/" + ${g}`:(0,t._)`"/" + ${g}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return E?(0,t.getProperty)(g).toString():"/"+u(g)}oe.getErrorPath=m;function b(g,S,E=g.opts.strictSchema){if(E){if(S=`strict mode: ${S}`,E===!0)throw new Error(S);g.self.logger.warn(S)}}return oe.checkStrictMode=b,oe}var en={},Fi;function $t(){if(Fi)return en;Fi=1,Object.defineProperty(en,"__esModule",{value:!0});const t=ie(),e={data:new t.Name("data"),valCxt:new t.Name("valCxt"),instancePath:new t.Name("instancePath"),parentData:new t.Name("parentData"),parentDataProperty:new t.Name("parentDataProperty"),rootData:new t.Name("rootData"),dynamicAnchors:new t.Name("dynamicAnchors"),vErrors:new t.Name("vErrors"),errors:new t.Name("errors"),this:new t.Name("this"),self:new t.Name("self"),scope:new t.Name("scope"),json:new t.Name("json"),jsonPos:new t.Name("jsonPos"),jsonLen:new t.Name("jsonLen"),jsonPart:new t.Name("jsonPart")};return en.default=e,en}var Hi;function tn(){return Hi||(Hi=1,(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.extendErrors=t.resetErrorsCount=t.reportExtraError=t.reportError=t.keyword$DataError=t.keywordError=void 0;const e=ie(),r=he(),n=$t();t.keywordError={message:({keyword:h})=>(0,e.str)`must pass "${h}" keyword validation`},t.keyword$DataError={message:({keyword:h,schemaType:_})=>_?(0,e.str)`"${h}" keyword must be ${_} ($data)`:(0,e.str)`"${h}" keyword is invalid ($data)`};function s(h,_=t.keywordError,d,m){const{it:b}=h,{gen:g,compositeRule:S,allErrors:E}=b,N=f(h,_,d);m??(S||E)?c(g,N):l(b,(0,e._)`[${N}]`)}t.reportError=s;function a(h,_=t.keywordError,d){const{it:m}=h,{gen:b,compositeRule:g,allErrors:S}=m,E=f(h,_,d);c(b,E),g||S||l(m,n.default.vErrors)}t.reportExtraError=a;function i(h,_){h.assign(n.default.errors,_),h.if((0,e._)`${n.default.vErrors} !== null`,()=>h.if(_,()=>h.assign((0,e._)`${n.default.vErrors}.length`,_),()=>h.assign(n.default.vErrors,null)))}t.resetErrorsCount=i;function o({gen:h,keyword:_,schemaValue:d,data:m,errsCount:b,it:g}){if(b===void 0)throw new Error("ajv implementation error");const S=h.name("err");h.forRange("i",b,n.default.errors,E=>{h.const(S,(0,e._)`${n.default.vErrors}[${E}]`),h.if((0,e._)`${S}.instancePath === undefined`,()=>h.assign((0,e._)`${S}.instancePath`,(0,e.strConcat)(n.default.instancePath,g.errorPath))),h.assign((0,e._)`${S}.schemaPath`,(0,e.str)`${g.errSchemaPath}/${_}`),g.opts.verbose&&(h.assign((0,e._)`${S}.schema`,d),h.assign((0,e._)`${S}.data`,m))})}t.extendErrors=o;function c(h,_){const d=h.const("err",_);h.if((0,e._)`${n.default.vErrors} === null`,()=>h.assign(n.default.vErrors,(0,e._)`[${d}]`),(0,e._)`${n.default.vErrors}.push(${d})`),h.code((0,e._)`${n.default.errors}++`)}function l(h,_){const{gen:d,validateName:m,schemaEnv:b}=h;b.$async?d.throw((0,e._)`new ${h.ValidationError}(${_})`):(d.assign((0,e._)`${m}.errors`,_),d.return(!1))}const u={keyword:new e.Name("keyword"),schemaPath:new e.Name("schemaPath"),params:new e.Name("params"),propertyName:new e.Name("propertyName"),message:new e.Name("message"),schema:new e.Name("schema"),parentSchema:new e.Name("parentSchema")};function f(h,_,d){const{createErrors:m}=h.it;return m===!1?(0,e._)`{}`:y(h,_,d)}function y(h,_,d={}){const{gen:m,it:b}=h,g=[v(b,d),p(h,d)];return w(h,_,g),m.object(...g)}function v({errorPath:h},{instancePath:_}){const d=_?(0,e.str)`${h}${(0,r.getErrorPath)(_,r.Type.Str)}`:h;return[n.default.instancePath,(0,e.strConcat)(n.default.instancePath,d)]}function p({keyword:h,it:{errSchemaPath:_}},{schemaPath:d,parentSchema:m}){let b=m?_:(0,e.str)`${_}/${h}`;return d&&(b=(0,e.str)`${b}${(0,r.getErrorPath)(d,r.Type.Str)}`),[u.schemaPath,b]}function w(h,{params:_,message:d},m){const{keyword:b,data:g,schemaValue:S,it:E}=h,{opts:N,propertyName:j,topSchemaRef:D,schemaPath:M}=E;m.push([u.keyword,b],[u.params,typeof _=="function"?_(h):_||(0,e._)`{}`]),N.messages&&m.push([u.message,typeof d=="function"?d(h):d]),N.verbose&&m.push([u.schema,S],[u.parentSchema,(0,e._)`${D}${M}`],[n.default.data,g]),j&&m.push([u.propertyName,j])}})(Ls)),Ls}var Wi;function Fd(){if(Wi)return qt;Wi=1,Object.defineProperty(qt,"__esModule",{value:!0}),qt.boolOrEmptySchema=qt.topBoolOrEmptySchema=void 0;const t=tn(),e=ie(),r=$t(),n={message:"boolean schema is false"};function s(o){const{gen:c,schema:l,validateName:u}=o;l===!1?i(o,!1):typeof l=="object"&&l.$async===!0?c.return(r.default.data):(c.assign((0,e._)`${u}.errors`,null),c.return(!0))}qt.topBoolOrEmptySchema=s;function a(o,c){const{gen:l,schema:u}=o;u===!1?(l.var(c,!1),i(o)):l.var(c,!0)}qt.boolOrEmptySchema=a;function i(o,c){const{gen:l,data:u}=o,f={gen:l,keyword:"false schema",data:u,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:o};(0,t.reportError)(f,n,void 0,c)}return qt}var qe={},Zt={},Ki;function Ji(){if(Ki)return Zt;Ki=1,Object.defineProperty(Zt,"__esModule",{value:!0}),Zt.getRules=Zt.isJSONType=void 0;const t=["string","number","integer","boolean","null","object","array"],e=new Set(t);function r(s){return typeof s=="string"&&e.has(s)}Zt.isJSONType=r;function n(){const s={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...s,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},s.number,s.string,s.array,s.object],post:{rules:[]},all:{},keywords:{}}}return Zt.getRules=n,Zt}var yt={},Gi;function Bi(){if(Gi)return yt;Gi=1,Object.defineProperty(yt,"__esModule",{value:!0}),yt.shouldUseRule=yt.shouldUseGroup=yt.schemaHasRulesForType=void 0;function t({schema:n,self:s},a){const i=s.RULES.types[a];return i&&i!==!0&&e(n,i)}yt.schemaHasRulesForType=t;function e(n,s){return s.rules.some(a=>r(n,a))}yt.shouldUseGroup=e;function r(n,s){var a;return n[s.keyword]!==void 0||((a=s.definition.implements)===null||a===void 0?void 0:a.some(i=>n[i]!==void 0))}return yt.shouldUseRule=r,yt}var Yi;function rn(){if(Yi)return qe;Yi=1,Object.defineProperty(qe,"__esModule",{value:!0}),qe.reportTypeError=qe.checkDataTypes=qe.checkDataType=qe.coerceAndCheckDataType=qe.getJSONTypes=qe.getSchemaTypes=qe.DataType=void 0;const t=Ji(),e=Bi(),r=tn(),n=ie(),s=he();var a;(function(d){d[d.Correct=0]="Correct",d[d.Wrong=1]="Wrong"})(a||(qe.DataType=a={}));function i(d){const m=o(d.type);if(m.includes("null")){if(d.nullable===!1)throw new Error("type: null contradicts nullable: false")}else{if(!m.length&&d.nullable!==void 0)throw new Error('"nullable" cannot be used without "type"');d.nullable===!0&&m.push("null")}return m}qe.getSchemaTypes=i;function o(d){const m=Array.isArray(d)?d:d?[d]:[];if(m.every(t.isJSONType))return m;throw new Error("type must be JSONType or JSONType[]: "+m.join(","))}qe.getJSONTypes=o;function c(d,m){const{gen:b,data:g,opts:S}=d,E=u(m,S.coerceTypes),N=m.length>0&&!(E.length===0&&m.length===1&&(0,e.schemaHasRulesForType)(d,m[0]));if(N){const j=p(m,g,S.strictNumbers,a.Wrong);b.if(j,()=>{E.length?f(d,m,E):h(d)})}return N}qe.coerceAndCheckDataType=c;const l=new Set(["string","number","integer","boolean","null"]);function u(d,m){return m?d.filter(b=>l.has(b)||m==="array"&&b==="array"):[]}function f(d,m,b){const{gen:g,data:S,opts:E}=d,N=g.let("dataType",(0,n._)`typeof ${S}`),j=g.let("coerced",(0,n._)`undefined`);E.coerceTypes==="array"&&g.if((0,n._)`${N} == 'object' && Array.isArray(${S}) && ${S}.length == 1`,()=>g.assign(S,(0,n._)`${S}[0]`).assign(N,(0,n._)`typeof ${S}`).if(p(m,S,E.strictNumbers),()=>g.assign(j,S))),g.if((0,n._)`${j} !== undefined`);for(const M of b)(l.has(M)||M==="array"&&E.coerceTypes==="array")&&D(M);g.else(),h(d),g.endIf(),g.if((0,n._)`${j} !== undefined`,()=>{g.assign(S,j),y(d,j)});function D(M){switch(M){case"string":g.elseIf((0,n._)`${N} == "number" || ${N} == "boolean"`).assign(j,(0,n._)`"" + ${S}`).elseIf((0,n._)`${S} === null`).assign(j,(0,n._)`""`);return;case"number":g.elseIf((0,n._)`${N} == "boolean" || ${S} === null
3
+ || (${N} == "string" && ${S} && ${S} == +${S})`).assign(j,(0,n._)`+${S}`);return;case"integer":g.elseIf((0,n._)`${N} === "boolean" || ${S} === null
4
+ || (${N} === "string" && ${S} && ${S} == +${S} && !(${S} % 1))`).assign(j,(0,n._)`+${S}`);return;case"boolean":g.elseIf((0,n._)`${S} === "false" || ${S} === 0 || ${S} === null`).assign(j,!1).elseIf((0,n._)`${S} === "true" || ${S} === 1`).assign(j,!0);return;case"null":g.elseIf((0,n._)`${S} === "" || ${S} === 0 || ${S} === false`),g.assign(j,null);return;case"array":g.elseIf((0,n._)`${N} === "string" || ${N} === "number"
5
+ || ${N} === "boolean" || ${S} === null`).assign(j,(0,n._)`[${S}]`)}}}function y({gen:d,parentData:m,parentDataProperty:b},g){d.if((0,n._)`${m} !== undefined`,()=>d.assign((0,n._)`${m}[${b}]`,g))}function v(d,m,b,g=a.Correct){const S=g===a.Correct?n.operators.EQ:n.operators.NEQ;let E;switch(d){case"null":return(0,n._)`${m} ${S} null`;case"array":E=(0,n._)`Array.isArray(${m})`;break;case"object":E=(0,n._)`${m} && typeof ${m} == "object" && !Array.isArray(${m})`;break;case"integer":E=N((0,n._)`!(${m} % 1) && !isNaN(${m})`);break;case"number":E=N();break;default:return(0,n._)`typeof ${m} ${S} ${d}`}return g===a.Correct?E:(0,n.not)(E);function N(j=n.nil){return(0,n.and)((0,n._)`typeof ${m} == "number"`,j,b?(0,n._)`isFinite(${m})`:n.nil)}}qe.checkDataType=v;function p(d,m,b,g){if(d.length===1)return v(d[0],m,b,g);let S;const E=(0,s.toHash)(d);if(E.array&&E.object){const N=(0,n._)`typeof ${m} != "object"`;S=E.null?N:(0,n._)`!${m} || ${N}`,delete E.null,delete E.array,delete E.object}else S=n.nil;E.number&&delete E.integer;for(const N in E)S=(0,n.and)(S,v(N,m,b,g));return S}qe.checkDataTypes=p;const w={message:({schema:d})=>`must be ${d}`,params:({schema:d,schemaValue:m})=>typeof d=="string"?(0,n._)`{type: ${d}}`:(0,n._)`{type: ${m}}`};function h(d){const m=_(d);(0,r.reportError)(m,w)}qe.reportTypeError=h;function _(d){const{gen:m,data:b,schema:g}=d,S=(0,s.schemaRefOrVal)(d,g,"type");return{gen:m,keyword:"type",data:b,schema:g.type,schemaCode:S,schemaValue:S,parentSchema:g,params:{},it:d}}return qe}var yr={},Qi;function Hd(){if(Qi)return yr;Qi=1,Object.defineProperty(yr,"__esModule",{value:!0}),yr.assignDefaults=void 0;const t=ie(),e=he();function r(s,a){const{properties:i,items:o}=s.schema;if(a==="object"&&i)for(const c in i)n(s,c,i[c].default);else a==="array"&&Array.isArray(o)&&o.forEach((c,l)=>n(s,l,c.default))}yr.assignDefaults=r;function n(s,a,i){const{gen:o,compositeRule:c,data:l,opts:u}=s;if(i===void 0)return;const f=(0,t._)`${l}${(0,t.getProperty)(a)}`;if(c){(0,e.checkStrictMode)(s,`default is ignored for: ${f}`);return}let y=(0,t._)`${f} === undefined`;u.useDefaults==="empty"&&(y=(0,t._)`${y} || ${f} === null || ${f} === ""`),o.if(y,(0,t._)`${f} = ${(0,t.stringify)(i)}`)}return yr}var ot={},ve={},Xi;function ct(){if(Xi)return ve;Xi=1,Object.defineProperty(ve,"__esModule",{value:!0}),ve.validateUnion=ve.validateArray=ve.usePattern=ve.callValidateCode=ve.schemaProperties=ve.allSchemaProperties=ve.noPropertyInData=ve.propertyInData=ve.isOwnProperty=ve.hasPropFunc=ve.reportMissingProp=ve.checkMissingProp=ve.checkReportMissingProp=void 0;const t=ie(),e=he(),r=$t(),n=he();function s(d,m){const{gen:b,data:g,it:S}=d;b.if(u(b,g,m,S.opts.ownProperties),()=>{d.setParams({missingProperty:(0,t._)`${m}`},!0),d.error()})}ve.checkReportMissingProp=s;function a({gen:d,data:m,it:{opts:b}},g,S){return(0,t.or)(...g.map(E=>(0,t.and)(u(d,m,E,b.ownProperties),(0,t._)`${S} = ${E}`)))}ve.checkMissingProp=a;function i(d,m){d.setParams({missingProperty:m},!0),d.error()}ve.reportMissingProp=i;function o(d){return d.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:(0,t._)`Object.prototype.hasOwnProperty`})}ve.hasPropFunc=o;function c(d,m,b){return(0,t._)`${o(d)}.call(${m}, ${b})`}ve.isOwnProperty=c;function l(d,m,b,g){const S=(0,t._)`${m}${(0,t.getProperty)(b)} !== undefined`;return g?(0,t._)`${S} && ${c(d,m,b)}`:S}ve.propertyInData=l;function u(d,m,b,g){const S=(0,t._)`${m}${(0,t.getProperty)(b)} === undefined`;return g?(0,t.or)(S,(0,t.not)(c(d,m,b))):S}ve.noPropertyInData=u;function f(d){return d?Object.keys(d).filter(m=>m!=="__proto__"):[]}ve.allSchemaProperties=f;function y(d,m){return f(m).filter(b=>!(0,e.alwaysValidSchema)(d,m[b]))}ve.schemaProperties=y;function v({schemaCode:d,data:m,it:{gen:b,topSchemaRef:g,schemaPath:S,errorPath:E},it:N},j,D,M){const H=M?(0,t._)`${d}, ${m}, ${g}${S}`:m,G=[[r.default.instancePath,(0,t.strConcat)(r.default.instancePath,E)],[r.default.parentData,N.parentData],[r.default.parentDataProperty,N.parentDataProperty],[r.default.rootData,r.default.rootData]];N.opts.dynamicRef&&G.push([r.default.dynamicAnchors,r.default.dynamicAnchors]);const Y=(0,t._)`${H}, ${b.object(...G)}`;return D!==t.nil?(0,t._)`${j}.call(${D}, ${Y})`:(0,t._)`${j}(${Y})`}ve.callValidateCode=v;const p=(0,t._)`new RegExp`;function w({gen:d,it:{opts:m}},b){const g=m.unicodeRegExp?"u":"",{regExp:S}=m.code,E=S(b,g);return d.scopeValue("pattern",{key:E.toString(),ref:E,code:(0,t._)`${S.code==="new RegExp"?p:(0,n.useFunc)(d,S)}(${b}, ${g})`})}ve.usePattern=w;function h(d){const{gen:m,data:b,keyword:g,it:S}=d,E=m.name("valid");if(S.allErrors){const j=m.let("valid",!0);return N(()=>m.assign(j,!1)),j}return m.var(E,!0),N(()=>m.break()),E;function N(j){const D=m.const("len",(0,t._)`${b}.length`);m.forRange("i",0,D,M=>{d.subschema({keyword:g,dataProp:M,dataPropType:e.Type.Num},E),m.if((0,t.not)(E),j)})}}ve.validateArray=h;function _(d){const{gen:m,schema:b,keyword:g,it:S}=d;if(!Array.isArray(b))throw new Error("ajv implementation error");if(b.some(D=>(0,e.alwaysValidSchema)(S,D))&&!S.opts.unevaluated)return;const N=m.let("valid",!1),j=m.name("_valid");m.block(()=>b.forEach((D,M)=>{const H=d.subschema({keyword:g,schemaProp:M,compositeRule:!0},j);m.assign(N,(0,t._)`${N} || ${j}`),d.mergeValidEvaluated(H,j)||m.if((0,t.not)(N))})),d.result(N,()=>d.reset(),()=>d.error(!0))}return ve.validateUnion=_,ve}var eo;function Wd(){if(eo)return ot;eo=1,Object.defineProperty(ot,"__esModule",{value:!0}),ot.validateKeywordUsage=ot.validSchemaType=ot.funcKeywordCode=ot.macroKeywordCode=void 0;const t=ie(),e=$t(),r=ct(),n=tn();function s(y,v){const{gen:p,keyword:w,schema:h,parentSchema:_,it:d}=y,m=v.macro.call(d.self,h,_,d),b=l(p,w,m);d.opts.validateSchema!==!1&&d.self.validateSchema(m,!0);const g=p.name("valid");y.subschema({schema:m,schemaPath:t.nil,errSchemaPath:`${d.errSchemaPath}/${w}`,topSchemaRef:b,compositeRule:!0},g),y.pass(g,()=>y.error(!0))}ot.macroKeywordCode=s;function a(y,v){var p;const{gen:w,keyword:h,schema:_,parentSchema:d,$data:m,it:b}=y;c(b,v);const g=!m&&v.compile?v.compile.call(b.self,_,d,b):v.validate,S=l(w,h,g),E=w.let("valid");y.block$data(E,N),y.ok((p=v.valid)!==null&&p!==void 0?p:E);function N(){if(v.errors===!1)M(),v.modifying&&i(y),H(()=>y.error());else{const G=v.async?j():D();v.modifying&&i(y),H(()=>o(y,G))}}function j(){const G=w.let("ruleErrs",null);return w.try(()=>M((0,t._)`await `),Y=>w.assign(E,!1).if((0,t._)`${Y} instanceof ${b.ValidationError}`,()=>w.assign(G,(0,t._)`${Y}.errors`),()=>w.throw(Y))),G}function D(){const G=(0,t._)`${S}.errors`;return w.assign(G,null),M(t.nil),G}function M(G=v.async?(0,t._)`await `:t.nil){const Y=b.opts.passContext?e.default.this:e.default.self,ge=!("compile"in v&&!m||v.schema===!1);w.assign(E,(0,t._)`${G}${(0,r.callValidateCode)(y,S,Y,ge)}`,v.modifying)}function H(G){var Y;w.if((0,t.not)((Y=v.valid)!==null&&Y!==void 0?Y:E),G)}}ot.funcKeywordCode=a;function i(y){const{gen:v,data:p,it:w}=y;v.if(w.parentData,()=>v.assign(p,(0,t._)`${w.parentData}[${w.parentDataProperty}]`))}function o(y,v){const{gen:p}=y;p.if((0,t._)`Array.isArray(${v})`,()=>{p.assign(e.default.vErrors,(0,t._)`${e.default.vErrors} === null ? ${v} : ${e.default.vErrors}.concat(${v})`).assign(e.default.errors,(0,t._)`${e.default.vErrors}.length`),(0,n.extendErrors)(y)},()=>y.error())}function c({schemaEnv:y},v){if(v.async&&!y.$async)throw new Error("async keyword in sync schema")}function l(y,v,p){if(p===void 0)throw new Error(`keyword "${v}" failed to compile`);return y.scopeValue("keyword",typeof p=="function"?{ref:p}:{ref:p,code:(0,t.stringify)(p)})}function u(y,v,p=!1){return!v.length||v.some(w=>w==="array"?Array.isArray(y):w==="object"?y&&typeof y=="object"&&!Array.isArray(y):typeof y==w||p&&typeof y>"u")}ot.validSchemaType=u;function f({schema:y,opts:v,self:p,errSchemaPath:w},h,_){if(Array.isArray(h.keyword)?!h.keyword.includes(_):h.keyword!==_)throw new Error("ajv implementation error");const d=h.dependencies;if(d?.some(m=>!Object.prototype.hasOwnProperty.call(y,m)))throw new Error(`parent schema must have dependencies of ${_}: ${d.join(",")}`);if(h.validateSchema&&!h.validateSchema(y[_])){const b=`keyword "${_}" value is invalid at path "${w}": `+p.errorsText(h.validateSchema.errors);if(v.validateSchema==="log")p.logger.error(b);else throw new Error(b)}}return ot.validateKeywordUsage=f,ot}var wt={},to;function Kd(){if(to)return wt;to=1,Object.defineProperty(wt,"__esModule",{value:!0}),wt.extendSubschemaMode=wt.extendSubschemaData=wt.getSubschema=void 0;const t=ie(),e=he();function r(a,{keyword:i,schemaProp:o,schema:c,schemaPath:l,errSchemaPath:u,topSchemaRef:f}){if(i!==void 0&&c!==void 0)throw new Error('both "keyword" and "schema" passed, only one allowed');if(i!==void 0){const y=a.schema[i];return o===void 0?{schema:y,schemaPath:(0,t._)`${a.schemaPath}${(0,t.getProperty)(i)}`,errSchemaPath:`${a.errSchemaPath}/${i}`}:{schema:y[o],schemaPath:(0,t._)`${a.schemaPath}${(0,t.getProperty)(i)}${(0,t.getProperty)(o)}`,errSchemaPath:`${a.errSchemaPath}/${i}/${(0,e.escapeFragment)(o)}`}}if(c!==void 0){if(l===void 0||u===void 0||f===void 0)throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:c,schemaPath:l,topSchemaRef:f,errSchemaPath:u}}throw new Error('either "keyword" or "schema" must be passed')}wt.getSubschema=r;function n(a,i,{dataProp:o,dataPropType:c,data:l,dataTypes:u,propertyName:f}){if(l!==void 0&&o!==void 0)throw new Error('both "data" and "dataProp" passed, only one allowed');const{gen:y}=i;if(o!==void 0){const{errorPath:p,dataPathArr:w,opts:h}=i,_=y.let("data",(0,t._)`${i.data}${(0,t.getProperty)(o)}`,!0);v(_),a.errorPath=(0,t.str)`${p}${(0,e.getErrorPath)(o,c,h.jsPropertySyntax)}`,a.parentDataProperty=(0,t._)`${o}`,a.dataPathArr=[...w,a.parentDataProperty]}if(l!==void 0){const p=l instanceof t.Name?l:y.let("data",l,!0);v(p),f!==void 0&&(a.propertyName=f)}u&&(a.dataTypes=u);function v(p){a.data=p,a.dataLevel=i.dataLevel+1,a.dataTypes=[],i.definedProperties=new Set,a.parentData=i.data,a.dataNames=[...i.dataNames,p]}}wt.extendSubschemaData=n;function s(a,{jtdDiscriminator:i,jtdMetadata:o,compositeRule:c,createErrors:l,allErrors:u}){c!==void 0&&(a.compositeRule=c),l!==void 0&&(a.createErrors=l),u!==void 0&&(a.allErrors=u),a.jtdDiscriminator=i,a.jtdMetadata=o}return wt.extendSubschemaMode=s,wt}var Ve={},Fs,ro;function no(){return ro||(ro=1,Fs=function t(e,r){if(e===r)return!0;if(e&&r&&typeof e=="object"&&typeof r=="object"){if(e.constructor!==r.constructor)return!1;var n,s,a;if(Array.isArray(e)){if(n=e.length,n!=r.length)return!1;for(s=n;s--!==0;)if(!t(e[s],r[s]))return!1;return!0}if(e.constructor===RegExp)return e.source===r.source&&e.flags===r.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===r.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===r.toString();if(a=Object.keys(e),n=a.length,n!==Object.keys(r).length)return!1;for(s=n;s--!==0;)if(!Object.prototype.hasOwnProperty.call(r,a[s]))return!1;for(s=n;s--!==0;){var i=a[s];if(!t(e[i],r[i]))return!1}return!0}return e!==e&&r!==r}),Fs}var Hs={exports:{}},so;function Jd(){if(so)return Hs.exports;so=1;var t=Hs.exports=function(n,s,a){typeof s=="function"&&(a=s,s={}),a=s.cb||a;var i=typeof a=="function"?a:a.pre||function(){},o=a.post||function(){};e(s,i,o,n,"",n)};t.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0},t.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0},t.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0},t.skipKeywords={default:!0,enum:!0,const:!0,required:!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};function e(n,s,a,i,o,c,l,u,f,y){if(i&&typeof i=="object"&&!Array.isArray(i)){s(i,o,c,l,u,f,y);for(var v in i){var p=i[v];if(Array.isArray(p)){if(v in t.arrayKeywords)for(var w=0;w<p.length;w++)e(n,s,a,p[w],o+"/"+v+"/"+w,c,o,v,i,w)}else if(v in t.propsKeywords){if(p&&typeof p=="object")for(var h in p)e(n,s,a,p[h],o+"/"+v+"/"+r(h),c,o,v,i,h)}else(v in t.keywords||n.allKeys&&!(v in t.skipKeywords))&&e(n,s,a,p,o+"/"+v,c,o,v,i)}a(i,o,c,l,u,f,y)}}function r(n){return n.replace(/~/g,"~0").replace(/\//g,"~1")}return Hs.exports}var ao;function nn(){if(ao)return Ve;ao=1,Object.defineProperty(Ve,"__esModule",{value:!0}),Ve.getSchemaRefs=Ve.resolveUrl=Ve.normalizeId=Ve._getFullPath=Ve.getFullPath=Ve.inlineRef=void 0;const t=he(),e=no(),r=Jd(),n=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function s(w,h=!0){return typeof w=="boolean"?!0:h===!0?!i(w):h?o(w)<=h:!1}Ve.inlineRef=s;const a=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function i(w){for(const h in w){if(a.has(h))return!0;const _=w[h];if(Array.isArray(_)&&_.some(i)||typeof _=="object"&&i(_))return!0}return!1}function o(w){let h=0;for(const _ in w){if(_==="$ref")return 1/0;if(h++,!n.has(_)&&(typeof w[_]=="object"&&(0,t.eachItem)(w[_],d=>h+=o(d)),h===1/0))return 1/0}return h}function c(w,h="",_){_!==!1&&(h=f(h));const d=w.parse(h);return l(w,d)}Ve.getFullPath=c;function l(w,h){return w.serialize(h).split("#")[0]+"#"}Ve._getFullPath=l;const u=/#\/?$/;function f(w){return w?w.replace(u,""):""}Ve.normalizeId=f;function y(w,h,_){return _=f(_),w.resolve(h,_)}Ve.resolveUrl=y;const v=/^[a-z_][-a-z0-9._]*$/i;function p(w,h){if(typeof w=="boolean")return{};const{schemaId:_,uriResolver:d}=this.opts,m=f(w[_]||h),b={"":m},g=c(d,m,!1),S={},E=new Set;return r(w,{allKeys:!0},(D,M,H,G)=>{if(G===void 0)return;const Y=g+M;let ge=b[G];typeof D[_]=="string"&&(ge=He.call(this,D[_])),We.call(this,D.$anchor),We.call(this,D.$dynamicAnchor),b[M]=ge;function He(be){const ht=this.opts.uriResolver.resolve;if(be=f(ge?ht(ge,be):be),E.has(be))throw j(be);E.add(be);let V=this.refs[be];return typeof V=="string"&&(V=this.refs[V]),typeof V=="object"?N(D,V.schema,be):be!==f(Y)&&(be[0]==="#"?(N(D,S[be],be),S[be]=D):this.refs[be]=Y),be}function We(be){if(typeof be=="string"){if(!v.test(be))throw new Error(`invalid anchor "${be}"`);He.call(this,`#${be}`)}}}),S;function N(D,M,H){if(M!==void 0&&!e(D,M))throw j(H)}function j(D){return new Error(`reference "${D}" resolves to more than one schema`)}}return Ve.getSchemaRefs=p,Ve}var io;function sn(){if(io)return vt;io=1,Object.defineProperty(vt,"__esModule",{value:!0}),vt.getData=vt.KeywordCxt=vt.validateFunctionCode=void 0;const t=Fd(),e=rn(),r=Bi(),n=rn(),s=Hd(),a=Wd(),i=Kd(),o=ie(),c=$t(),l=nn(),u=he(),f=tn();function y(P){if(g(P)&&(E(P),b(P))){h(P);return}v(P,()=>(0,t.topBoolOrEmptySchema)(P))}vt.validateFunctionCode=y;function v({gen:P,validateName:I,schema:q,schemaEnv:F,opts:ne},ue){ne.code.es5?P.func(I,(0,o._)`${c.default.data}, ${c.default.valCxt}`,F.$async,()=>{P.code((0,o._)`"use strict"; ${d(q,ne)}`),w(P,ne),P.code(ue)}):P.func(I,(0,o._)`${c.default.data}, ${p(ne)}`,F.$async,()=>P.code(d(q,ne)).code(ue))}function p(P){return(0,o._)`{${c.default.instancePath}="", ${c.default.parentData}, ${c.default.parentDataProperty}, ${c.default.rootData}=${c.default.data}${P.dynamicRef?(0,o._)`, ${c.default.dynamicAnchors}={}`:o.nil}}={}`}function w(P,I){P.if(c.default.valCxt,()=>{P.var(c.default.instancePath,(0,o._)`${c.default.valCxt}.${c.default.instancePath}`),P.var(c.default.parentData,(0,o._)`${c.default.valCxt}.${c.default.parentData}`),P.var(c.default.parentDataProperty,(0,o._)`${c.default.valCxt}.${c.default.parentDataProperty}`),P.var(c.default.rootData,(0,o._)`${c.default.valCxt}.${c.default.rootData}`),I.dynamicRef&&P.var(c.default.dynamicAnchors,(0,o._)`${c.default.valCxt}.${c.default.dynamicAnchors}`)},()=>{P.var(c.default.instancePath,(0,o._)`""`),P.var(c.default.parentData,(0,o._)`undefined`),P.var(c.default.parentDataProperty,(0,o._)`undefined`),P.var(c.default.rootData,c.default.data),I.dynamicRef&&P.var(c.default.dynamicAnchors,(0,o._)`{}`)})}function h(P){const{schema:I,opts:q,gen:F}=P;v(P,()=>{q.$comment&&I.$comment&&G(P),D(P),F.let(c.default.vErrors,null),F.let(c.default.errors,0),q.unevaluated&&_(P),N(P),Y(P)})}function _(P){const{gen:I,validateName:q}=P;P.evaluated=I.const("evaluated",(0,o._)`${q}.evaluated`),I.if((0,o._)`${P.evaluated}.dynamicProps`,()=>I.assign((0,o._)`${P.evaluated}.props`,(0,o._)`undefined`)),I.if((0,o._)`${P.evaluated}.dynamicItems`,()=>I.assign((0,o._)`${P.evaluated}.items`,(0,o._)`undefined`))}function d(P,I){const q=typeof P=="object"&&P[I.schemaId];return q&&(I.code.source||I.code.process)?(0,o._)`/*# sourceURL=${q} */`:o.nil}function m(P,I){if(g(P)&&(E(P),b(P))){S(P,I);return}(0,t.boolOrEmptySchema)(P,I)}function b({schema:P,self:I}){if(typeof P=="boolean")return!P;for(const q in P)if(I.RULES.all[q])return!0;return!1}function g(P){return typeof P.schema!="boolean"}function S(P,I){const{schema:q,gen:F,opts:ne}=P;ne.$comment&&q.$comment&&G(P),M(P),H(P);const ue=F.const("_errs",c.default.errors);N(P,ue),F.var(I,(0,o._)`${ue} === ${c.default.errors}`)}function E(P){(0,u.checkUnknownRules)(P),j(P)}function N(P,I){if(P.opts.jtd)return He(P,[],!1,I);const q=(0,e.getSchemaTypes)(P.schema),F=(0,e.coerceAndCheckDataType)(P,q);He(P,q,!F,I)}function j(P){const{schema:I,errSchemaPath:q,opts:F,self:ne}=P;I.$ref&&F.ignoreKeywordsWithRef&&(0,u.schemaHasRulesButRef)(I,ne.RULES)&&ne.logger.warn(`$ref: keywords ignored in schema at path "${q}"`)}function D(P){const{schema:I,opts:q}=P;I.default!==void 0&&q.useDefaults&&q.strictSchema&&(0,u.checkStrictMode)(P,"default is ignored in the schema root")}function M(P){const I=P.schema[P.opts.schemaId];I&&(P.baseId=(0,l.resolveUrl)(P.opts.uriResolver,P.baseId,I))}function H(P){if(P.schema.$async&&!P.schemaEnv.$async)throw new Error("async schema in sync schema")}function G({gen:P,schemaEnv:I,schema:q,errSchemaPath:F,opts:ne}){const ue=q.$comment;if(ne.$comment===!0)P.code((0,o._)`${c.default.self}.logger.log(${ue})`);else if(typeof ne.$comment=="function"){const Le=(0,o.str)`${F}/$comment`,mt=P.scopeValue("root",{ref:I.root});P.code((0,o._)`${c.default.self}.opts.$comment(${ue}, ${Le}, ${mt}.schema)`)}}function Y(P){const{gen:I,schemaEnv:q,validateName:F,ValidationError:ne,opts:ue}=P;q.$async?I.if((0,o._)`${c.default.errors} === 0`,()=>I.return(c.default.data),()=>I.throw((0,o._)`new ${ne}(${c.default.vErrors})`)):(I.assign((0,o._)`${F}.errors`,c.default.vErrors),ue.unevaluated&&ge(P),I.return((0,o._)`${c.default.errors} === 0`))}function ge({gen:P,evaluated:I,props:q,items:F}){q instanceof o.Name&&P.assign((0,o._)`${I}.props`,q),F instanceof o.Name&&P.assign((0,o._)`${I}.items`,F)}function He(P,I,q,F){const{gen:ne,schema:ue,data:Le,allErrors:mt,opts:Qe,self:Xe}=P,{RULES:Ue}=Xe;if(ue.$ref&&(Qe.ignoreKeywordsWithRef||!(0,u.schemaHasRulesButRef)(ue,Ue))){ne.block(()=>ee(P,"$ref",Ue.all.$ref.definition));return}Qe.jtd||be(P,I),ne.block(()=>{for(const it of Ue.rules)vr(it);vr(Ue.post)});function vr(it){(0,r.shouldUseGroup)(ue,it)&&(it.type?(ne.if((0,n.checkDataType)(it.type,Le,Qe.strictNumbers)),We(P,it),I.length===1&&I[0]===it.type&&q&&(ne.else(),(0,n.reportTypeError)(P)),ne.endIf()):We(P,it),mt||ne.if((0,o._)`${c.default.errors} === ${F||0}`))}}function We(P,I){const{gen:q,schema:F,opts:{useDefaults:ne}}=P;ne&&(0,s.assignDefaults)(P,I.type),q.block(()=>{for(const ue of I.rules)(0,r.shouldUseRule)(F,ue)&&ee(P,ue.keyword,ue.definition,I.type)})}function be(P,I){P.schemaEnv.meta||!P.opts.strictTypes||(ht(P,I),P.opts.allowUnionTypes||V(P,I),C(P,P.dataTypes))}function ht(P,I){if(I.length){if(!P.dataTypes.length){P.dataTypes=I;return}I.forEach(q=>{O(P.dataTypes,q)||T(P,`type "${q}" not allowed by context "${P.dataTypes.join(",")}"`)}),k(P,I)}}function V(P,I){I.length>1&&!(I.length===2&&I.includes("null"))&&T(P,"use allowUnionTypes to allow union type keyword")}function C(P,I){const q=P.self.RULES.all;for(const F in q){const ne=q[F];if(typeof ne=="object"&&(0,r.shouldUseRule)(P.schema,ne)){const{type:ue}=ne.definition;ue.length&&!ue.some(Le=>Z(I,Le))&&T(P,`missing type "${ue.join(",")}" for keyword "${F}"`)}}}function Z(P,I){return P.includes(I)||I==="number"&&P.includes("integer")}function O(P,I){return P.includes(I)||I==="integer"&&P.includes("number")}function k(P,I){const q=[];for(const F of P.dataTypes)O(I,F)?q.push(F):I.includes("integer")&&F==="number"&&q.push("integer");P.dataTypes=q}function T(P,I){const q=P.schemaEnv.baseId+P.errSchemaPath;I+=` at "${q}" (strictTypes)`,(0,u.checkStrictMode)(P,I,P.opts.strictTypes)}class z{constructor(I,q,F){if((0,a.validateKeywordUsage)(I,q,F),this.gen=I.gen,this.allErrors=I.allErrors,this.keyword=F,this.data=I.data,this.schema=I.schema[F],this.$data=q.$data&&I.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,u.schemaRefOrVal)(I,this.schema,F,this.$data),this.schemaType=q.schemaType,this.parentSchema=I.schema,this.params={},this.it=I,this.def=q,this.$data)this.schemaCode=I.gen.const("vSchema",de(this.$data,I));else if(this.schemaCode=this.schemaValue,!(0,a.validSchemaType)(this.schema,q.schemaType,q.allowUndefined))throw new Error(`${F} value must be ${JSON.stringify(q.schemaType)}`);("code"in q?q.trackErrors:q.errors!==!1)&&(this.errsCount=I.gen.const("_errs",c.default.errors))}result(I,q,F){this.failResult((0,o.not)(I),q,F)}failResult(I,q,F){this.gen.if(I),F?F():this.error(),q?(this.gen.else(),q(),this.allErrors&&this.gen.endIf()):this.allErrors?this.gen.endIf():this.gen.else()}pass(I,q){this.failResult((0,o.not)(I),void 0,q)}fail(I){if(I===void 0){this.error(),this.allErrors||this.gen.if(!1);return}this.gen.if(I),this.error(),this.allErrors?this.gen.endIf():this.gen.else()}fail$data(I){if(!this.$data)return this.fail(I);const{schemaCode:q}=this;this.fail((0,o._)`${q} !== undefined && (${(0,o.or)(this.invalid$data(),I)})`)}error(I,q,F){if(q){this.setParams(q),this._error(I,F),this.setParams({});return}this._error(I,F)}_error(I,q){(I?f.reportExtraError:f.reportError)(this,this.def.error,q)}$dataError(){(0,f.reportError)(this,this.def.$dataError||f.keyword$DataError)}reset(){if(this.errsCount===void 0)throw new Error('add "trackErrors" to keyword definition');(0,f.resetErrorsCount)(this.gen,this.errsCount)}ok(I){this.allErrors||this.gen.if(I)}setParams(I,q){q?Object.assign(this.params,I):this.params=I}block$data(I,q,F=o.nil){this.gen.block(()=>{this.check$data(I,F),q()})}check$data(I=o.nil,q=o.nil){if(!this.$data)return;const{gen:F,schemaCode:ne,schemaType:ue,def:Le}=this;F.if((0,o.or)((0,o._)`${ne} === undefined`,q)),I!==o.nil&&F.assign(I,!0),(ue.length||Le.validateSchema)&&(F.elseIf(this.invalid$data()),this.$dataError(),I!==o.nil&&F.assign(I,!1)),F.else()}invalid$data(){const{gen:I,schemaCode:q,schemaType:F,def:ne,it:ue}=this;return(0,o.or)(Le(),mt());function Le(){if(F.length){if(!(q instanceof o.Name))throw new Error("ajv implementation error");const Qe=Array.isArray(F)?F:[F];return(0,o._)`${(0,n.checkDataTypes)(Qe,q,ue.opts.strictNumbers,n.DataType.Wrong)}`}return o.nil}function mt(){if(ne.validateSchema){const Qe=I.scopeValue("validate$data",{ref:ne.validateSchema});return(0,o._)`!${Qe}(${q})`}return o.nil}}subschema(I,q){const F=(0,i.getSubschema)(this.it,I);(0,i.extendSubschemaData)(F,this.it,I),(0,i.extendSubschemaMode)(F,I);const ne={...this.it,...F,items:void 0,props:void 0};return m(ne,q),ne}mergeEvaluated(I,q){const{it:F,gen:ne}=this;F.opts.unevaluated&&(F.props!==!0&&I.props!==void 0&&(F.props=u.mergeEvaluated.props(ne,I.props,F.props,q)),F.items!==!0&&I.items!==void 0&&(F.items=u.mergeEvaluated.items(ne,I.items,F.items,q)))}mergeValidEvaluated(I,q){const{it:F,gen:ne}=this;if(F.opts.unevaluated&&(F.props!==!0||F.items!==!0))return ne.if(q,()=>this.mergeEvaluated(I,o.Name)),!0}}vt.KeywordCxt=z;function ee(P,I,q,F){const ne=new z(P,q,I);"code"in q?q.code(ne,F):ne.$data&&q.validate?(0,a.funcKeywordCode)(ne,q):"macro"in q?(0,a.macroKeywordCode)(ne,q):(q.compile||q.validate)&&(0,a.funcKeywordCode)(ne,q)}const se=/^\/(?:[^~]|~0|~1)*$/,_e=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function de(P,{dataLevel:I,dataNames:q,dataPathArr:F}){let ne,ue;if(P==="")return c.default.rootData;if(P[0]==="/"){if(!se.test(P))throw new Error(`Invalid JSON-pointer: ${P}`);ne=P,ue=c.default.rootData}else{const Xe=_e.exec(P);if(!Xe)throw new Error(`Invalid JSON-pointer: ${P}`);const Ue=+Xe[1];if(ne=Xe[2],ne==="#"){if(Ue>=I)throw new Error(Qe("property/index",Ue));return F[I-Ue]}if(Ue>I)throw new Error(Qe("data",Ue));if(ue=q[I-Ue],!ne)return ue}let Le=ue;const mt=ne.split("/");for(const Xe of mt)Xe&&(ue=(0,o._)`${ue}${(0,o.getProperty)((0,u.unescapeJsonPointer)(Xe))}`,Le=(0,o._)`${Le} && ${ue}`);return Le;function Qe(Xe,Ue){return`Cannot access ${Xe} ${Ue} levels up, current level is ${I}`}}return vt.getData=de,vt}var an={},oo;function Ws(){if(oo)return an;oo=1,Object.defineProperty(an,"__esModule",{value:!0});class t extends Error{constructor(r){super("validation failed"),this.errors=r,this.ajv=this.validation=!0}}return an.default=t,an}var on={},co;function cn(){if(co)return on;co=1,Object.defineProperty(on,"__esModule",{value:!0});const t=nn();class e extends Error{constructor(n,s,a,i){super(i||`can't resolve reference ${a} from id ${s}`),this.missingRef=(0,t.resolveUrl)(n,s,a),this.missingSchema=(0,t.normalizeId)((0,t.getFullPath)(n,this.missingRef))}}return on.default=e,on}var et={},uo;function Ks(){if(uo)return et;uo=1,Object.defineProperty(et,"__esModule",{value:!0}),et.resolveSchema=et.getCompilingSchema=et.resolveRef=et.compileSchema=et.SchemaEnv=void 0;const t=ie(),e=Ws(),r=$t(),n=nn(),s=he(),a=sn();class i{constructor(_){var d;this.refs={},this.dynamicAnchors={};let m;typeof _.schema=="object"&&(m=_.schema),this.schema=_.schema,this.schemaId=_.schemaId,this.root=_.root||this,this.baseId=(d=_.baseId)!==null&&d!==void 0?d:(0,n.normalizeId)(m?.[_.schemaId||"$id"]),this.schemaPath=_.schemaPath,this.localRefs=_.localRefs,this.meta=_.meta,this.$async=m?.$async,this.refs={}}}et.SchemaEnv=i;function o(h){const _=u.call(this,h);if(_)return _;const d=(0,n.getFullPath)(this.opts.uriResolver,h.root.baseId),{es5:m,lines:b}=this.opts.code,{ownProperties:g}=this.opts,S=new t.CodeGen(this.scope,{es5:m,lines:b,ownProperties:g});let E;h.$async&&(E=S.scopeValue("Error",{ref:e.default,code:(0,t._)`require("ajv/dist/runtime/validation_error").default`}));const N=S.scopeName("validate");h.validateName=N;const j={gen:S,allErrors:this.opts.allErrors,data:r.default.data,parentData:r.default.parentData,parentDataProperty:r.default.parentDataProperty,dataNames:[r.default.data],dataPathArr:[t.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:S.scopeValue("schema",this.opts.code.source===!0?{ref:h.schema,code:(0,t.stringify)(h.schema)}:{ref:h.schema}),validateName:N,ValidationError:E,schema:h.schema,schemaEnv:h,rootId:d,baseId:h.baseId||d,schemaPath:t.nil,errSchemaPath:h.schemaPath||(this.opts.jtd?"":"#"),errorPath:(0,t._)`""`,opts:this.opts,self:this};let D;try{this._compilations.add(h),(0,a.validateFunctionCode)(j),S.optimize(this.opts.code.optimize);const M=S.toString();D=`${S.scopeRefs(r.default.scope)}return ${M}`,this.opts.code.process&&(D=this.opts.code.process(D,h));const G=new Function(`${r.default.self}`,`${r.default.scope}`,D)(this,this.scope.get());if(this.scope.value(N,{ref:G}),G.errors=null,G.schema=h.schema,G.schemaEnv=h,h.$async&&(G.$async=!0),this.opts.code.source===!0&&(G.source={validateName:N,validateCode:M,scopeValues:S._values}),this.opts.unevaluated){const{props:Y,items:ge}=j;G.evaluated={props:Y instanceof t.Name?void 0:Y,items:ge instanceof t.Name?void 0:ge,dynamicProps:Y instanceof t.Name,dynamicItems:ge instanceof t.Name},G.source&&(G.source.evaluated=(0,t.stringify)(G.evaluated))}return h.validate=G,h}catch(M){throw delete h.validate,delete h.validateName,D&&this.logger.error("Error compiling schema, function code:",D),M}finally{this._compilations.delete(h)}}et.compileSchema=o;function c(h,_,d){var m;d=(0,n.resolveUrl)(this.opts.uriResolver,_,d);const b=h.refs[d];if(b)return b;let g=y.call(this,h,d);if(g===void 0){const S=(m=h.localRefs)===null||m===void 0?void 0:m[d],{schemaId:E}=this.opts;S&&(g=new i({schema:S,schemaId:E,root:h,baseId:_}))}if(g!==void 0)return h.refs[d]=l.call(this,g)}et.resolveRef=c;function l(h){return(0,n.inlineRef)(h.schema,this.opts.inlineRefs)?h.schema:h.validate?h:o.call(this,h)}function u(h){for(const _ of this._compilations)if(f(_,h))return _}et.getCompilingSchema=u;function f(h,_){return h.schema===_.schema&&h.root===_.root&&h.baseId===_.baseId}function y(h,_){let d;for(;typeof(d=this.refs[_])=="string";)_=d;return d||this.schemas[_]||v.call(this,h,_)}function v(h,_){const d=this.opts.uriResolver.parse(_),m=(0,n._getFullPath)(this.opts.uriResolver,d);let b=(0,n.getFullPath)(this.opts.uriResolver,h.baseId,void 0);if(Object.keys(h.schema).length>0&&m===b)return w.call(this,d,h);const g=(0,n.normalizeId)(m),S=this.refs[g]||this.schemas[g];if(typeof S=="string"){const E=v.call(this,h,S);return typeof E?.schema!="object"?void 0:w.call(this,d,E)}if(typeof S?.schema=="object"){if(S.validate||o.call(this,S),g===(0,n.normalizeId)(_)){const{schema:E}=S,{schemaId:N}=this.opts,j=E[N];return j&&(b=(0,n.resolveUrl)(this.opts.uriResolver,b,j)),new i({schema:E,schemaId:N,root:h,baseId:b})}return w.call(this,d,S)}}et.resolveSchema=v;const p=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function w(h,{baseId:_,schema:d,root:m}){var b;if(((b=h.fragment)===null||b===void 0?void 0:b[0])!=="/")return;for(const E of h.fragment.slice(1).split("/")){if(typeof d=="boolean")return;const N=d[(0,s.unescapeFragment)(E)];if(N===void 0)return;d=N;const j=typeof d=="object"&&d[this.opts.schemaId];!p.has(E)&&j&&(_=(0,n.resolveUrl)(this.opts.uriResolver,_,j))}let g;if(typeof d!="boolean"&&d.$ref&&!(0,s.schemaHasRulesButRef)(d,this.RULES)){const E=(0,n.resolveUrl)(this.opts.uriResolver,_,d.$ref);g=v.call(this,m,E)}const{schemaId:S}=this.opts;if(g=g||new i({schema:d,schemaId:S,root:m,baseId:_}),g.schema!==g.root.schema)return g}return et}const Gd={$id:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#",description:"Meta-schema for $data reference (JSON AnySchema extension proposal)",type:"object",required:["$data"],properties:{$data:{type:"string",anyOf:[{format:"relative-json-pointer"},{format:"json-pointer"}]}},additionalProperties:!1};var un={},wr={exports:{}},Js,lo;function fo(){if(lo)return Js;lo=1;const t=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),e=RegExp.prototype.test.bind(/^(?:(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)$/u);function r(y){let v="",p=0,w=0;for(w=0;w<y.length;w++)if(p=y[w].charCodeAt(0),p!==48){if(!(p>=48&&p<=57||p>=65&&p<=70||p>=97&&p<=102))return"";v+=y[w];break}for(w+=1;w<y.length;w++){if(p=y[w].charCodeAt(0),!(p>=48&&p<=57||p>=65&&p<=70||p>=97&&p<=102))return"";v+=y[w]}return v}const n=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function s(y){return y.length=0,!0}function a(y,v,p){if(y.length){const w=r(y);if(w!=="")v.push(w);else return p.error=!0,!1;y.length=0}return!0}function i(y){let v=0;const p={error:!1,address:"",zone:""},w=[],h=[];let _=!1,d=!1,m=a;for(let b=0;b<y.length;b++){const g=y[b];if(!(g==="["||g==="]"))if(g===":"){if(_===!0&&(d=!0),!m(h,w,p))break;if(++v>7){p.error=!0;break}b>0&&y[b-1]===":"&&(_=!0),w.push(":");continue}else if(g==="%"){if(!m(h,w,p))break;m=s}else{h.push(g);continue}}return h.length&&(m===s?p.zone=h.join(""):d?w.push(h.join("")):w.push(r(h))),p.address=w.join(""),p}function o(y){if(c(y,":")<2)return{host:y,isIPV6:!1};const v=i(y);if(v.error)return{host:y,isIPV6:!1};{let p=v.address,w=v.address;return v.zone&&(p+="%"+v.zone,w+="%25"+v.zone),{host:p,isIPV6:!0,escapedHost:w}}}function c(y,v){let p=0;for(let w=0;w<y.length;w++)y[w]===v&&p++;return p}function l(y){let v=y;const p=[];let w=-1,h=0;for(;h=v.length;){if(h===1){if(v===".")break;if(v==="/"){p.push("/");break}else{p.push(v);break}}else if(h===2){if(v[0]==="."){if(v[1]===".")break;if(v[1]==="/"){v=v.slice(2);continue}}else if(v[0]==="/"&&(v[1]==="."||v[1]==="/")){p.push("/");break}}else if(h===3&&v==="/.."){p.length!==0&&p.pop(),p.push("/");break}if(v[0]==="."){if(v[1]==="."){if(v[2]==="/"){v=v.slice(3);continue}}else if(v[1]==="/"){v=v.slice(2);continue}}else if(v[0]==="/"&&v[1]==="."){if(v[2]==="/"){v=v.slice(2);continue}else if(v[2]==="."&&v[3]==="/"){v=v.slice(3),p.length!==0&&p.pop();continue}}if((w=v.indexOf("/",1))===-1){p.push(v);break}else p.push(v.slice(0,w)),v=v.slice(w)}return p.join("")}function u(y,v){const p=v!==!0?escape:unescape;return y.scheme!==void 0&&(y.scheme=p(y.scheme)),y.userinfo!==void 0&&(y.userinfo=p(y.userinfo)),y.host!==void 0&&(y.host=p(y.host)),y.path!==void 0&&(y.path=p(y.path)),y.query!==void 0&&(y.query=p(y.query)),y.fragment!==void 0&&(y.fragment=p(y.fragment)),y}function f(y){const v=[];if(y.userinfo!==void 0&&(v.push(y.userinfo),v.push("@")),y.host!==void 0){let p=unescape(y.host);if(!e(p)){const w=o(p);w.isIPV6===!0?p=`[${w.escapedHost}]`:p=y.host}v.push(p)}return(typeof y.port=="number"||typeof y.port=="string")&&(v.push(":"),v.push(String(y.port))),v.length?v.join(""):void 0}return Js={nonSimpleDomain:n,recomposeAuthority:f,normalizeComponentEncoding:u,removeDotSegments:l,isIPv4:e,isUUID:t,normalizeIPv6:o,stringArrayToHexStripped:r},Js}var Gs,ho;function Bd(){if(ho)return Gs;ho=1;const{isUUID:t}=fo(),e=/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu,r=["http","https","ws","wss","urn","urn:uuid"];function n(g){return r.indexOf(g)!==-1}function s(g){return g.secure===!0?!0:g.secure===!1?!1:g.scheme?g.scheme.length===3&&(g.scheme[0]==="w"||g.scheme[0]==="W")&&(g.scheme[1]==="s"||g.scheme[1]==="S")&&(g.scheme[2]==="s"||g.scheme[2]==="S"):!1}function a(g){return g.host||(g.error=g.error||"HTTP URIs must have a host."),g}function i(g){const S=String(g.scheme).toLowerCase()==="https";return(g.port===(S?443:80)||g.port==="")&&(g.port=void 0),g.path||(g.path="/"),g}function o(g){return g.secure=s(g),g.resourceName=(g.path||"/")+(g.query?"?"+g.query:""),g.path=void 0,g.query=void 0,g}function c(g){if((g.port===(s(g)?443:80)||g.port==="")&&(g.port=void 0),typeof g.secure=="boolean"&&(g.scheme=g.secure?"wss":"ws",g.secure=void 0),g.resourceName){const[S,E]=g.resourceName.split("?");g.path=S&&S!=="/"?S:void 0,g.query=E,g.resourceName=void 0}return g.fragment=void 0,g}function l(g,S){if(!g.path)return g.error="URN can not be parsed",g;const E=g.path.match(e);if(E){const N=S.scheme||g.scheme||"urn";g.nid=E[1].toLowerCase(),g.nss=E[2];const j=`${N}:${S.nid||g.nid}`,D=b(j);g.path=void 0,D&&(g=D.parse(g,S))}else g.error=g.error||"URN can not be parsed.";return g}function u(g,S){if(g.nid===void 0)throw new Error("URN without nid cannot be serialized");const E=S.scheme||g.scheme||"urn",N=g.nid.toLowerCase(),j=`${E}:${S.nid||N}`,D=b(j);D&&(g=D.serialize(g,S));const M=g,H=g.nss;return M.path=`${N||S.nid}:${H}`,S.skipEscape=!0,M}function f(g,S){const E=g;return E.uuid=E.nss,E.nss=void 0,!S.tolerant&&(!E.uuid||!t(E.uuid))&&(E.error=E.error||"UUID is not valid."),E}function y(g){const S=g;return S.nss=(g.uuid||"").toLowerCase(),S}const v={scheme:"http",domainHost:!0,parse:a,serialize:i},p={scheme:"https",domainHost:v.domainHost,parse:a,serialize:i},w={scheme:"ws",domainHost:!0,parse:o,serialize:c},h={scheme:"wss",domainHost:w.domainHost,parse:w.parse,serialize:w.serialize},m={http:v,https:p,ws:w,wss:h,urn:{scheme:"urn",parse:l,serialize:u,skipNormalize:!0},"urn:uuid":{scheme:"urn:uuid",parse:f,serialize:y,skipNormalize:!0}};Object.setPrototypeOf(m,null);function b(g){return g&&(m[g]||m[g.toLowerCase()])||void 0}return Gs={wsIsSecure:s,SCHEMES:m,isValidSchemeName:n,getSchemeHandler:b},Gs}var mo;function Yd(){if(mo)return wr.exports;mo=1;const{normalizeIPv6:t,removeDotSegments:e,recomposeAuthority:r,normalizeComponentEncoding:n,isIPv4:s,nonSimpleDomain:a}=fo(),{SCHEMES:i,getSchemeHandler:o}=Bd();function c(h,_){return typeof h=="string"?h=y(p(h,_),_):typeof h=="object"&&(h=p(y(h,_),_)),h}function l(h,_,d){const m=d?Object.assign({scheme:"null"},d):{scheme:"null"},b=u(p(h,m),p(_,m),m,!0);return m.skipEscape=!0,y(b,m)}function u(h,_,d,m){const b={};return m||(h=p(y(h,d),d),_=p(y(_,d),d)),d=d||{},!d.tolerant&&_.scheme?(b.scheme=_.scheme,b.userinfo=_.userinfo,b.host=_.host,b.port=_.port,b.path=e(_.path||""),b.query=_.query):(_.userinfo!==void 0||_.host!==void 0||_.port!==void 0?(b.userinfo=_.userinfo,b.host=_.host,b.port=_.port,b.path=e(_.path||""),b.query=_.query):(_.path?(_.path[0]==="/"?b.path=e(_.path):((h.userinfo!==void 0||h.host!==void 0||h.port!==void 0)&&!h.path?b.path="/"+_.path:h.path?b.path=h.path.slice(0,h.path.lastIndexOf("/")+1)+_.path:b.path=_.path,b.path=e(b.path)),b.query=_.query):(b.path=h.path,_.query!==void 0?b.query=_.query:b.query=h.query),b.userinfo=h.userinfo,b.host=h.host,b.port=h.port),b.scheme=h.scheme),b.fragment=_.fragment,b}function f(h,_,d){return typeof h=="string"?(h=unescape(h),h=y(n(p(h,d),!0),{...d,skipEscape:!0})):typeof h=="object"&&(h=y(n(h,!0),{...d,skipEscape:!0})),typeof _=="string"?(_=unescape(_),_=y(n(p(_,d),!0),{...d,skipEscape:!0})):typeof _=="object"&&(_=y(n(_,!0),{...d,skipEscape:!0})),h.toLowerCase()===_.toLowerCase()}function y(h,_){const d={host:h.host,scheme:h.scheme,userinfo:h.userinfo,port:h.port,path:h.path,query:h.query,nid:h.nid,nss:h.nss,uuid:h.uuid,fragment:h.fragment,reference:h.reference,resourceName:h.resourceName,secure:h.secure,error:""},m=Object.assign({},_),b=[],g=o(m.scheme||d.scheme);g&&g.serialize&&g.serialize(d,m),d.path!==void 0&&(m.skipEscape?d.path=unescape(d.path):(d.path=escape(d.path),d.scheme!==void 0&&(d.path=d.path.split("%3A").join(":")))),m.reference!=="suffix"&&d.scheme&&b.push(d.scheme,":");const S=r(d);if(S!==void 0&&(m.reference!=="suffix"&&b.push("//"),b.push(S),d.path&&d.path[0]!=="/"&&b.push("/")),d.path!==void 0){let E=d.path;!m.absolutePath&&(!g||!g.absolutePath)&&(E=e(E)),S===void 0&&E[0]==="/"&&E[1]==="/"&&(E="/%2F"+E.slice(2)),b.push(E)}return d.query!==void 0&&b.push("?",d.query),d.fragment!==void 0&&b.push("#",d.fragment),b.join("")}const v=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;function p(h,_){const d=Object.assign({},_),m={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0};let b=!1;d.reference==="suffix"&&(d.scheme?h=d.scheme+":"+h:h="//"+h);const g=h.match(v);if(g){if(m.scheme=g[1],m.userinfo=g[3],m.host=g[4],m.port=parseInt(g[5],10),m.path=g[6]||"",m.query=g[7],m.fragment=g[8],isNaN(m.port)&&(m.port=g[5]),m.host)if(s(m.host)===!1){const N=t(m.host);m.host=N.host.toLowerCase(),b=N.isIPV6}else b=!0;m.scheme===void 0&&m.userinfo===void 0&&m.host===void 0&&m.port===void 0&&m.query===void 0&&!m.path?m.reference="same-document":m.scheme===void 0?m.reference="relative":m.fragment===void 0?m.reference="absolute":m.reference="uri",d.reference&&d.reference!=="suffix"&&d.reference!==m.reference&&(m.error=m.error||"URI is not a "+d.reference+" reference.");const S=o(d.scheme||m.scheme);if(!d.unicodeSupport&&(!S||!S.unicodeSupport)&&m.host&&(d.domainHost||S&&S.domainHost)&&b===!1&&a(m.host))try{m.host=URL.domainToASCII(m.host.toLowerCase())}catch(E){m.error=m.error||"Host's domain name can not be converted to ASCII: "+E}(!S||S&&!S.skipNormalize)&&(h.indexOf("%")!==-1&&(m.scheme!==void 0&&(m.scheme=unescape(m.scheme)),m.host!==void 0&&(m.host=unescape(m.host))),m.path&&(m.path=escape(unescape(m.path))),m.fragment&&(m.fragment=encodeURI(decodeURIComponent(m.fragment)))),S&&S.parse&&S.parse(m,d)}else m.error=m.error||"URI can not be parsed.";return m}const w={SCHEMES:i,normalize:c,resolve:l,resolveComponent:u,equal:f,serialize:y,parse:p};return wr.exports=w,wr.exports.default=w,wr.exports.fastUri=w,wr.exports}var po;function Qd(){if(po)return un;po=1,Object.defineProperty(un,"__esModule",{value:!0});const t=Yd();return t.code='require("ajv/dist/runtime/uri").default',un.default=t,un}var _o;function Xd(){return _o||(_o=1,(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.CodeGen=t.Name=t.nil=t.stringify=t.str=t._=t.KeywordCxt=void 0;var e=sn();Object.defineProperty(t,"KeywordCxt",{enumerable:!0,get:function(){return e.KeywordCxt}});var r=ie();Object.defineProperty(t,"_",{enumerable:!0,get:function(){return r._}}),Object.defineProperty(t,"str",{enumerable:!0,get:function(){return r.str}}),Object.defineProperty(t,"stringify",{enumerable:!0,get:function(){return r.stringify}}),Object.defineProperty(t,"nil",{enumerable:!0,get:function(){return r.nil}}),Object.defineProperty(t,"Name",{enumerable:!0,get:function(){return r.Name}}),Object.defineProperty(t,"CodeGen",{enumerable:!0,get:function(){return r.CodeGen}});const n=Ws(),s=cn(),a=Ji(),i=Ks(),o=ie(),c=nn(),l=rn(),u=he(),f=Gd,y=Qd(),v=(V,C)=>new RegExp(V,C);v.code="new RegExp";const p=["removeAdditional","useDefaults","coerceTypes"],w=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),h={errorDataPath:"",format:"`validateFormats: false` can be used instead.",nullable:'"nullable" keyword is supported by default.',jsonPointers:"Deprecated jsPropertySyntax can be used instead.",extendRefs:"Deprecated ignoreKeywordsWithRef can be used instead.",missingRefs:"Pass empty schema with $id that should be ignored to ajv.addSchema.",processCode:"Use option `code: {process: (code, schemaEnv: object) => string}`",sourceCode:"Use option `code: {source: true}`",strictDefaults:"It is default now, see option `strict`.",strictKeywords:"It is default now, see option `strict`.",uniqueItems:'"uniqueItems" keyword is always validated.',unknownFormats:"Disable strict mode or pass `true` to `ajv.addFormat` (or `formats` option).",cache:"Map is used as cache, schema object as key.",serialize:"Map is used as cache, schema object as key.",ajvErrors:"It is default now."},_={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},d=200;function m(V){var C,Z,O,k,T,z,ee,se,_e,de,P,I,q,F,ne,ue,Le,mt,Qe,Xe,Ue,vr,it,Mi,qi;const Yr=V.strict,Zi=(C=V.code)===null||C===void 0?void 0:C.optimize,Dd=Zi===!0||Zi===void 0?1:Zi||0,Vd=(O=(Z=V.code)===null||Z===void 0?void 0:Z.regExp)!==null&&O!==void 0?O:v,hy=(k=V.uriResolver)!==null&&k!==void 0?k:y.default;return{strictSchema:(z=(T=V.strictSchema)!==null&&T!==void 0?T:Yr)!==null&&z!==void 0?z:!0,strictNumbers:(se=(ee=V.strictNumbers)!==null&&ee!==void 0?ee:Yr)!==null&&se!==void 0?se:!0,strictTypes:(de=(_e=V.strictTypes)!==null&&_e!==void 0?_e:Yr)!==null&&de!==void 0?de:"log",strictTuples:(I=(P=V.strictTuples)!==null&&P!==void 0?P:Yr)!==null&&I!==void 0?I:"log",strictRequired:(F=(q=V.strictRequired)!==null&&q!==void 0?q:Yr)!==null&&F!==void 0?F:!1,code:V.code?{...V.code,optimize:Dd,regExp:Vd}:{optimize:Dd,regExp:Vd},loopRequired:(ne=V.loopRequired)!==null&&ne!==void 0?ne:d,loopEnum:(ue=V.loopEnum)!==null&&ue!==void 0?ue:d,meta:(Le=V.meta)!==null&&Le!==void 0?Le:!0,messages:(mt=V.messages)!==null&&mt!==void 0?mt:!0,inlineRefs:(Qe=V.inlineRefs)!==null&&Qe!==void 0?Qe:!0,schemaId:(Xe=V.schemaId)!==null&&Xe!==void 0?Xe:"$id",addUsedSchema:(Ue=V.addUsedSchema)!==null&&Ue!==void 0?Ue:!0,validateSchema:(vr=V.validateSchema)!==null&&vr!==void 0?vr:!0,validateFormats:(it=V.validateFormats)!==null&&it!==void 0?it:!0,unicodeRegExp:(Mi=V.unicodeRegExp)!==null&&Mi!==void 0?Mi:!0,int32range:(qi=V.int32range)!==null&&qi!==void 0?qi:!0,uriResolver:hy}}class b{constructor(C={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,C=this.opts={...C,...m(C)};const{es5:Z,lines:O}=this.opts.code;this.scope=new o.ValueScope({scope:{},prefixes:w,es5:Z,lines:O}),this.logger=H(C.logger);const k=C.validateFormats;C.validateFormats=!1,this.RULES=(0,a.getRules)(),g.call(this,h,C,"NOT SUPPORTED"),g.call(this,_,C,"DEPRECATED","warn"),this._metaOpts=D.call(this),C.formats&&N.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),C.keywords&&j.call(this,C.keywords),typeof C.meta=="object"&&this.addMetaSchema(C.meta),E.call(this),C.validateFormats=k}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){const{$data:C,meta:Z,schemaId:O}=this.opts;let k=f;O==="id"&&(k={...f},k.id=k.$id,delete k.$id),Z&&C&&this.addMetaSchema(k,k[O],!1)}defaultMeta(){const{meta:C,schemaId:Z}=this.opts;return this.opts.defaultMeta=typeof C=="object"?C[Z]||C:void 0}validate(C,Z){let O;if(typeof C=="string"){if(O=this.getSchema(C),!O)throw new Error(`no schema with key or ref "${C}"`)}else O=this.compile(C);const k=O(Z);return"$async"in O||(this.errors=O.errors),k}compile(C,Z){const O=this._addSchema(C,Z);return O.validate||this._compileSchemaEnv(O)}compileAsync(C,Z){if(typeof this.opts.loadSchema!="function")throw new Error("options.loadSchema should be a function");const{loadSchema:O}=this.opts;return k.call(this,C,Z);async function k(de,P){await T.call(this,de.$schema);const I=this._addSchema(de,P);return I.validate||z.call(this,I)}async function T(de){de&&!this.getSchema(de)&&await k.call(this,{$ref:de},!0)}async function z(de){try{return this._compileSchemaEnv(de)}catch(P){if(!(P instanceof s.default))throw P;return ee.call(this,P),await se.call(this,P.missingSchema),z.call(this,de)}}function ee({missingSchema:de,missingRef:P}){if(this.refs[de])throw new Error(`AnySchema ${de} is loaded but ${P} cannot be resolved`)}async function se(de){const P=await _e.call(this,de);this.refs[de]||await T.call(this,P.$schema),this.refs[de]||this.addSchema(P,de,Z)}async function _e(de){const P=this._loading[de];if(P)return P;try{return await(this._loading[de]=O(de))}finally{delete this._loading[de]}}}addSchema(C,Z,O,k=this.opts.validateSchema){if(Array.isArray(C)){for(const z of C)this.addSchema(z,void 0,O,k);return this}let T;if(typeof C=="object"){const{schemaId:z}=this.opts;if(T=C[z],T!==void 0&&typeof T!="string")throw new Error(`schema ${z} must be string`)}return Z=(0,c.normalizeId)(Z||T),this._checkUnique(Z),this.schemas[Z]=this._addSchema(C,O,Z,k,!0),this}addMetaSchema(C,Z,O=this.opts.validateSchema){return this.addSchema(C,Z,!0,O),this}validateSchema(C,Z){if(typeof C=="boolean")return!0;let O;if(O=C.$schema,O!==void 0&&typeof O!="string")throw new Error("$schema must be a string");if(O=O||this.opts.defaultMeta||this.defaultMeta(),!O)return this.logger.warn("meta-schema not available"),this.errors=null,!0;const k=this.validate(O,C);if(!k&&Z){const T="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(T);else throw new Error(T)}return k}getSchema(C){let Z;for(;typeof(Z=S.call(this,C))=="string";)C=Z;if(Z===void 0){const{schemaId:O}=this.opts,k=new i.SchemaEnv({schema:{},schemaId:O});if(Z=i.resolveSchema.call(this,k,C),!Z)return;this.refs[C]=Z}return Z.validate||this._compileSchemaEnv(Z)}removeSchema(C){if(C instanceof RegExp)return this._removeAllSchemas(this.schemas,C),this._removeAllSchemas(this.refs,C),this;switch(typeof C){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{const Z=S.call(this,C);return typeof Z=="object"&&this._cache.delete(Z.schema),delete this.schemas[C],delete this.refs[C],this}case"object":{const Z=C;this._cache.delete(Z);let O=C[this.opts.schemaId];return O&&(O=(0,c.normalizeId)(O),delete this.schemas[O],delete this.refs[O]),this}default:throw new Error("ajv.removeSchema: invalid parameter")}}addVocabulary(C){for(const Z of C)this.addKeyword(Z);return this}addKeyword(C,Z){let O;if(typeof C=="string")O=C,typeof Z=="object"&&(this.logger.warn("these parameters are deprecated, see docs for addKeyword"),Z.keyword=O);else if(typeof C=="object"&&Z===void 0){if(Z=C,O=Z.keyword,Array.isArray(O)&&!O.length)throw new Error("addKeywords: keyword must be string or non-empty array")}else throw new Error("invalid addKeywords parameters");if(Y.call(this,O,Z),!Z)return(0,u.eachItem)(O,T=>ge.call(this,T)),this;We.call(this,Z);const k={...Z,type:(0,l.getJSONTypes)(Z.type),schemaType:(0,l.getJSONTypes)(Z.schemaType)};return(0,u.eachItem)(O,k.type.length===0?T=>ge.call(this,T,k):T=>k.type.forEach(z=>ge.call(this,T,k,z))),this}getKeyword(C){const Z=this.RULES.all[C];return typeof Z=="object"?Z.definition:!!Z}removeKeyword(C){const{RULES:Z}=this;delete Z.keywords[C],delete Z.all[C];for(const O of Z.rules){const k=O.rules.findIndex(T=>T.keyword===C);k>=0&&O.rules.splice(k,1)}return this}addFormat(C,Z){return typeof Z=="string"&&(Z=new RegExp(Z)),this.formats[C]=Z,this}errorsText(C=this.errors,{separator:Z=", ",dataVar:O="data"}={}){return!C||C.length===0?"No errors":C.map(k=>`${O}${k.instancePath} ${k.message}`).reduce((k,T)=>k+Z+T)}$dataMetaSchema(C,Z){const O=this.RULES.all;C=JSON.parse(JSON.stringify(C));for(const k of Z){const T=k.split("/").slice(1);let z=C;for(const ee of T)z=z[ee];for(const ee in O){const se=O[ee];if(typeof se!="object")continue;const{$data:_e}=se.definition,de=z[ee];_e&&de&&(z[ee]=ht(de))}}return C}_removeAllSchemas(C,Z){for(const O in C){const k=C[O];(!Z||Z.test(O))&&(typeof k=="string"?delete C[O]:k&&!k.meta&&(this._cache.delete(k.schema),delete C[O]))}}_addSchema(C,Z,O,k=this.opts.validateSchema,T=this.opts.addUsedSchema){let z;const{schemaId:ee}=this.opts;if(typeof C=="object")z=C[ee];else{if(this.opts.jtd)throw new Error("schema must be object");if(typeof C!="boolean")throw new Error("schema must be object or boolean")}let se=this._cache.get(C);if(se!==void 0)return se;O=(0,c.normalizeId)(z||O);const _e=c.getSchemaRefs.call(this,C,O);return se=new i.SchemaEnv({schema:C,schemaId:ee,meta:Z,baseId:O,localRefs:_e}),this._cache.set(se.schema,se),T&&!O.startsWith("#")&&(O&&this._checkUnique(O),this.refs[O]=se),k&&this.validateSchema(C,!0),se}_checkUnique(C){if(this.schemas[C]||this.refs[C])throw new Error(`schema with key or id "${C}" already exists`)}_compileSchemaEnv(C){if(C.meta?this._compileMetaSchema(C):i.compileSchema.call(this,C),!C.validate)throw new Error("ajv implementation error");return C.validate}_compileMetaSchema(C){const Z=this.opts;this.opts=this._metaOpts;try{i.compileSchema.call(this,C)}finally{this.opts=Z}}}b.ValidationError=n.default,b.MissingRefError=s.default,t.default=b;function g(V,C,Z,O="error"){for(const k in V){const T=k;T in C&&this.logger[O](`${Z}: option ${k}. ${V[T]}`)}}function S(V){return V=(0,c.normalizeId)(V),this.schemas[V]||this.refs[V]}function E(){const V=this.opts.schemas;if(V)if(Array.isArray(V))this.addSchema(V);else for(const C in V)this.addSchema(V[C],C)}function N(){for(const V in this.opts.formats){const C=this.opts.formats[V];C&&this.addFormat(V,C)}}function j(V){if(Array.isArray(V)){this.addVocabulary(V);return}this.logger.warn("keywords option as map is deprecated, pass array");for(const C in V){const Z=V[C];Z.keyword||(Z.keyword=C),this.addKeyword(Z)}}function D(){const V={...this.opts};for(const C of p)delete V[C];return V}const M={log(){},warn(){},error(){}};function H(V){if(V===!1)return M;if(V===void 0)return console;if(V.log&&V.warn&&V.error)return V;throw new Error("logger must implement log, warn and error methods")}const G=/^[a-z_$][a-z0-9_$:-]*$/i;function Y(V,C){const{RULES:Z}=this;if((0,u.eachItem)(V,O=>{if(Z.keywords[O])throw new Error(`Keyword ${O} is already defined`);if(!G.test(O))throw new Error(`Keyword ${O} has invalid name`)}),!!C&&C.$data&&!("code"in C||"validate"in C))throw new Error('$data keyword must have "code" or "validate" function')}function ge(V,C,Z){var O;const k=C?.post;if(Z&&k)throw new Error('keyword with "post" flag cannot have "type"');const{RULES:T}=this;let z=k?T.post:T.rules.find(({type:se})=>se===Z);if(z||(z={type:Z,rules:[]},T.rules.push(z)),T.keywords[V]=!0,!C)return;const ee={keyword:V,definition:{...C,type:(0,l.getJSONTypes)(C.type),schemaType:(0,l.getJSONTypes)(C.schemaType)}};C.before?He.call(this,z,ee,C.before):z.rules.push(ee),T.all[V]=ee,(O=C.implements)===null||O===void 0||O.forEach(se=>this.addKeyword(se))}function He(V,C,Z){const O=V.rules.findIndex(k=>k.keyword===Z);O>=0?V.rules.splice(O,0,C):(V.rules.push(C),this.logger.warn(`rule ${Z} is not defined`))}function We(V){let{metaSchema:C}=V;C!==void 0&&(V.$data&&this.opts.$data&&(C=ht(C)),V.validateSchema=this.compile(C,!0))}const be={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function ht(V){return{anyOf:[V,be]}}})(xs)),xs}var ln={},dn={},fn={},go;function ef(){if(go)return fn;go=1,Object.defineProperty(fn,"__esModule",{value:!0});const t={keyword:"id",code(){throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};return fn.default=t,fn}var Et={},vo;function tf(){if(vo)return Et;vo=1,Object.defineProperty(Et,"__esModule",{value:!0}),Et.callRef=Et.getValidate=void 0;const t=cn(),e=ct(),r=ie(),n=$t(),s=Ks(),a=he(),i={keyword:"$ref",schemaType:"string",code(l){const{gen:u,schema:f,it:y}=l,{baseId:v,schemaEnv:p,validateName:w,opts:h,self:_}=y,{root:d}=p;if((f==="#"||f==="#/")&&v===d.baseId)return b();const m=s.resolveRef.call(_,d,v,f);if(m===void 0)throw new t.default(y.opts.uriResolver,v,f);if(m instanceof s.SchemaEnv)return g(m);return S(m);function b(){if(p===d)return c(l,w,p,p.$async);const E=u.scopeValue("root",{ref:d});return c(l,(0,r._)`${E}.validate`,d,d.$async)}function g(E){const N=o(l,E);c(l,N,E,E.$async)}function S(E){const N=u.scopeValue("schema",h.code.source===!0?{ref:E,code:(0,r.stringify)(E)}:{ref:E}),j=u.name("valid"),D=l.subschema({schema:E,dataTypes:[],schemaPath:r.nil,topSchemaRef:N,errSchemaPath:f},j);l.mergeEvaluated(D),l.ok(j)}}};function o(l,u){const{gen:f}=l;return u.validate?f.scopeValue("validate",{ref:u.validate}):(0,r._)`${f.scopeValue("wrapper",{ref:u})}.validate`}Et.getValidate=o;function c(l,u,f,y){const{gen:v,it:p}=l,{allErrors:w,schemaEnv:h,opts:_}=p,d=_.passContext?n.default.this:r.nil;y?m():b();function m(){if(!h.$async)throw new Error("async schema referenced by sync schema");const E=v.let("valid");v.try(()=>{v.code((0,r._)`await ${(0,e.callValidateCode)(l,u,d)}`),S(u),w||v.assign(E,!0)},N=>{v.if((0,r._)`!(${N} instanceof ${p.ValidationError})`,()=>v.throw(N)),g(N),w||v.assign(E,!1)}),l.ok(E)}function b(){l.result((0,e.callValidateCode)(l,u,d),()=>S(u),()=>g(u))}function g(E){const N=(0,r._)`${E}.errors`;v.assign(n.default.vErrors,(0,r._)`${n.default.vErrors} === null ? ${N} : ${n.default.vErrors}.concat(${N})`),v.assign(n.default.errors,(0,r._)`${n.default.vErrors}.length`)}function S(E){var N;if(!p.opts.unevaluated)return;const j=(N=f?.validate)===null||N===void 0?void 0:N.evaluated;if(p.props!==!0)if(j&&!j.dynamicProps)j.props!==void 0&&(p.props=a.mergeEvaluated.props(v,j.props,p.props));else{const D=v.var("props",(0,r._)`${E}.evaluated.props`);p.props=a.mergeEvaluated.props(v,D,p.props,r.Name)}if(p.items!==!0)if(j&&!j.dynamicItems)j.items!==void 0&&(p.items=a.mergeEvaluated.items(v,j.items,p.items));else{const D=v.var("items",(0,r._)`${E}.evaluated.items`);p.items=a.mergeEvaluated.items(v,D,p.items,r.Name)}}}return Et.callRef=c,Et.default=i,Et}var yo;function rf(){if(yo)return dn;yo=1,Object.defineProperty(dn,"__esModule",{value:!0});const t=ef(),e=tf(),r=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",t.default,e.default];return dn.default=r,dn}var hn={},mn={},wo;function nf(){if(wo)return mn;wo=1,Object.defineProperty(mn,"__esModule",{value:!0});const t=ie(),e=t.operators,r={maximum:{okStr:"<=",ok:e.LTE,fail:e.GT},minimum:{okStr:">=",ok:e.GTE,fail:e.LT},exclusiveMaximum:{okStr:"<",ok:e.LT,fail:e.GTE},exclusiveMinimum:{okStr:">",ok:e.GT,fail:e.LTE}},n={message:({keyword:a,schemaCode:i})=>(0,t.str)`must be ${r[a].okStr} ${i}`,params:({keyword:a,schemaCode:i})=>(0,t._)`{comparison: ${r[a].okStr}, limit: ${i}}`},s={keyword:Object.keys(r),type:"number",schemaType:"number",$data:!0,error:n,code(a){const{keyword:i,data:o,schemaCode:c}=a;a.fail$data((0,t._)`${o} ${r[i].fail} ${c} || isNaN(${o})`)}};return mn.default=s,mn}var pn={},bo;function sf(){if(bo)return pn;bo=1,Object.defineProperty(pn,"__esModule",{value:!0});const t=ie(),r={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:{message:({schemaCode:n})=>(0,t.str)`must be multiple of ${n}`,params:({schemaCode:n})=>(0,t._)`{multipleOf: ${n}}`},code(n){const{gen:s,data:a,schemaCode:i,it:o}=n,c=o.opts.multipleOfPrecision,l=s.let("res"),u=c?(0,t._)`Math.abs(Math.round(${l}) - ${l}) > 1e-${c}`:(0,t._)`${l} !== parseInt(${l})`;n.fail$data((0,t._)`(${i} === 0 || (${l} = ${a}/${i}, ${u}))`)}};return pn.default=r,pn}var _n={},gn={},So;function af(){if(So)return gn;So=1,Object.defineProperty(gn,"__esModule",{value:!0});function t(e){const r=e.length;let n=0,s=0,a;for(;s<r;)n++,a=e.charCodeAt(s++),a>=55296&&a<=56319&&s<r&&(a=e.charCodeAt(s),(a&64512)===56320&&s++);return n}return gn.default=t,t.code='require("ajv/dist/runtime/ucs2length").default',gn}var ko;function of(){if(ko)return _n;ko=1,Object.defineProperty(_n,"__esModule",{value:!0});const t=ie(),e=he(),r=af(),s={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:{message({keyword:a,schemaCode:i}){const o=a==="maxLength"?"more":"fewer";return(0,t.str)`must NOT have ${o} than ${i} characters`},params:({schemaCode:a})=>(0,t._)`{limit: ${a}}`},code(a){const{keyword:i,data:o,schemaCode:c,it:l}=a,u=i==="maxLength"?t.operators.GT:t.operators.LT,f=l.opts.unicode===!1?(0,t._)`${o}.length`:(0,t._)`${(0,e.useFunc)(a.gen,r.default)}(${o})`;a.fail$data((0,t._)`${f} ${u} ${c}`)}};return _n.default=s,_n}var vn={},$o;function cf(){if($o)return vn;$o=1,Object.defineProperty(vn,"__esModule",{value:!0});const t=ct(),e=ie(),n={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:{message:({schemaCode:s})=>(0,e.str)`must match pattern "${s}"`,params:({schemaCode:s})=>(0,e._)`{pattern: ${s}}`},code(s){const{data:a,$data:i,schema:o,schemaCode:c,it:l}=s,u=l.opts.unicodeRegExp?"u":"",f=i?(0,e._)`(new RegExp(${c}, ${u}))`:(0,t.usePattern)(s,o);s.fail$data((0,e._)`!${f}.test(${a})`)}};return vn.default=n,vn}var yn={},Eo;function uf(){if(Eo)return yn;Eo=1,Object.defineProperty(yn,"__esModule",{value:!0});const t=ie(),r={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:{message({keyword:n,schemaCode:s}){const a=n==="maxProperties"?"more":"fewer";return(0,t.str)`must NOT have ${a} than ${s} properties`},params:({schemaCode:n})=>(0,t._)`{limit: ${n}}`},code(n){const{keyword:s,data:a,schemaCode:i}=n,o=s==="maxProperties"?t.operators.GT:t.operators.LT;n.fail$data((0,t._)`Object.keys(${a}).length ${o} ${i}`)}};return yn.default=r,yn}var wn={},To;function lf(){if(To)return wn;To=1,Object.defineProperty(wn,"__esModule",{value:!0});const t=ct(),e=ie(),r=he(),s={keyword:"required",type:"object",schemaType:"array",$data:!0,error:{message:({params:{missingProperty:a}})=>(0,e.str)`must have required property '${a}'`,params:({params:{missingProperty:a}})=>(0,e._)`{missingProperty: ${a}}`},code(a){const{gen:i,schema:o,schemaCode:c,data:l,$data:u,it:f}=a,{opts:y}=f;if(!u&&o.length===0)return;const v=o.length>=y.loopRequired;if(f.allErrors?p():w(),y.strictRequired){const d=a.parentSchema.properties,{definedProperties:m}=a.it;for(const b of o)if(d?.[b]===void 0&&!m.has(b)){const g=f.schemaEnv.baseId+f.errSchemaPath,S=`required property "${b}" is not defined at "${g}" (strictRequired)`;(0,r.checkStrictMode)(f,S,f.opts.strictRequired)}}function p(){if(v||u)a.block$data(e.nil,h);else for(const d of o)(0,t.checkReportMissingProp)(a,d)}function w(){const d=i.let("missing");if(v||u){const m=i.let("valid",!0);a.block$data(m,()=>_(d,m)),a.ok(m)}else i.if((0,t.checkMissingProp)(a,o,d)),(0,t.reportMissingProp)(a,d),i.else()}function h(){i.forOf("prop",c,d=>{a.setParams({missingProperty:d}),i.if((0,t.noPropertyInData)(i,l,d,y.ownProperties),()=>a.error())})}function _(d,m){a.setParams({missingProperty:d}),i.forOf(d,c,()=>{i.assign(m,(0,t.propertyInData)(i,l,d,y.ownProperties)),i.if((0,e.not)(m),()=>{a.error(),i.break()})},e.nil)}}};return wn.default=s,wn}var bn={},Ro;function df(){if(Ro)return bn;Ro=1,Object.defineProperty(bn,"__esModule",{value:!0});const t=ie(),r={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:{message({keyword:n,schemaCode:s}){const a=n==="maxItems"?"more":"fewer";return(0,t.str)`must NOT have ${a} than ${s} items`},params:({schemaCode:n})=>(0,t._)`{limit: ${n}}`},code(n){const{keyword:s,data:a,schemaCode:i}=n,o=s==="maxItems"?t.operators.GT:t.operators.LT;n.fail$data((0,t._)`${a}.length ${o} ${i}`)}};return bn.default=r,bn}var Sn={},kn={},Po;function Bs(){if(Po)return kn;Po=1,Object.defineProperty(kn,"__esModule",{value:!0});const t=no();return t.code='require("ajv/dist/runtime/equal").default',kn.default=t,kn}var Co;function ff(){if(Co)return Sn;Co=1,Object.defineProperty(Sn,"__esModule",{value:!0});const t=rn(),e=ie(),r=he(),n=Bs(),a={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:{message:({params:{i,j:o}})=>(0,e.str)`must NOT have duplicate items (items ## ${o} and ${i} are identical)`,params:({params:{i,j:o}})=>(0,e._)`{i: ${i}, j: ${o}}`},code(i){const{gen:o,data:c,$data:l,schema:u,parentSchema:f,schemaCode:y,it:v}=i;if(!l&&!u)return;const p=o.let("valid"),w=f.items?(0,t.getSchemaTypes)(f.items):[];i.block$data(p,h,(0,e._)`${y} === false`),i.ok(p);function h(){const b=o.let("i",(0,e._)`${c}.length`),g=o.let("j");i.setParams({i:b,j:g}),o.assign(p,!0),o.if((0,e._)`${b} > 1`,()=>(_()?d:m)(b,g))}function _(){return w.length>0&&!w.some(b=>b==="object"||b==="array")}function d(b,g){const S=o.name("item"),E=(0,t.checkDataTypes)(w,S,v.opts.strictNumbers,t.DataType.Wrong),N=o.const("indices",(0,e._)`{}`);o.for((0,e._)`;${b}--;`,()=>{o.let(S,(0,e._)`${c}[${b}]`),o.if(E,(0,e._)`continue`),w.length>1&&o.if((0,e._)`typeof ${S} == "string"`,(0,e._)`${S} += "_"`),o.if((0,e._)`typeof ${N}[${S}] == "number"`,()=>{o.assign(g,(0,e._)`${N}[${S}]`),i.error(),o.assign(p,!1).break()}).code((0,e._)`${N}[${S}] = ${b}`)})}function m(b,g){const S=(0,r.useFunc)(o,n.default),E=o.name("outer");o.label(E).for((0,e._)`;${b}--;`,()=>o.for((0,e._)`${g} = ${b}; ${g}--;`,()=>o.if((0,e._)`${S}(${c}[${b}], ${c}[${g}])`,()=>{i.error(),o.assign(p,!1).break(E)})))}}};return Sn.default=a,Sn}var $n={},Io;function hf(){if(Io)return $n;Io=1,Object.defineProperty($n,"__esModule",{value:!0});const t=ie(),e=he(),r=Bs(),s={keyword:"const",$data:!0,error:{message:"must be equal to constant",params:({schemaCode:a})=>(0,t._)`{allowedValue: ${a}}`},code(a){const{gen:i,data:o,$data:c,schemaCode:l,schema:u}=a;c||u&&typeof u=="object"?a.fail$data((0,t._)`!${(0,e.useFunc)(i,r.default)}(${o}, ${l})`):a.fail((0,t._)`${u} !== ${o}`)}};return $n.default=s,$n}var En={},Oo;function mf(){if(Oo)return En;Oo=1,Object.defineProperty(En,"__esModule",{value:!0});const t=ie(),e=he(),r=Bs(),s={keyword:"enum",schemaType:"array",$data:!0,error:{message:"must be equal to one of the allowed values",params:({schemaCode:a})=>(0,t._)`{allowedValues: ${a}}`},code(a){const{gen:i,data:o,$data:c,schema:l,schemaCode:u,it:f}=a;if(!c&&l.length===0)throw new Error("enum must have non-empty array");const y=l.length>=f.opts.loopEnum;let v;const p=()=>v??(v=(0,e.useFunc)(i,r.default));let w;if(y||c)w=i.let("valid"),a.block$data(w,h);else{if(!Array.isArray(l))throw new Error("ajv implementation error");const d=i.const("vSchema",u);w=(0,t.or)(...l.map((m,b)=>_(d,b)))}a.pass(w);function h(){i.assign(w,!1),i.forOf("v",u,d=>i.if((0,t._)`${p()}(${o}, ${d})`,()=>i.assign(w,!0).break()))}function _(d,m){const b=l[m];return typeof b=="object"&&b!==null?(0,t._)`${p()}(${o}, ${d}[${m}])`:(0,t._)`${o} === ${b}`}}};return En.default=s,En}var No;function pf(){if(No)return hn;No=1,Object.defineProperty(hn,"__esModule",{value:!0});const t=nf(),e=sf(),r=of(),n=cf(),s=uf(),a=lf(),i=df(),o=ff(),c=hf(),l=mf(),u=[t.default,e.default,r.default,n.default,s.default,a.default,i.default,o.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},c.default,l.default];return hn.default=u,hn}var Tn={},Qt={},Ao;function jo(){if(Ao)return Qt;Ao=1,Object.defineProperty(Qt,"__esModule",{value:!0}),Qt.validateAdditionalItems=void 0;const t=ie(),e=he(),n={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:{message:({params:{len:a}})=>(0,t.str)`must NOT have more than ${a} items`,params:({params:{len:a}})=>(0,t._)`{limit: ${a}}`},code(a){const{parentSchema:i,it:o}=a,{items:c}=i;if(!Array.isArray(c)){(0,e.checkStrictMode)(o,'"additionalItems" is ignored when "items" is not an array of schemas');return}s(a,c)}};function s(a,i){const{gen:o,schema:c,data:l,keyword:u,it:f}=a;f.items=!0;const y=o.const("len",(0,t._)`${l}.length`);if(c===!1)a.setParams({len:i.length}),a.pass((0,t._)`${y} <= ${i.length}`);else if(typeof c=="object"&&!(0,e.alwaysValidSchema)(f,c)){const p=o.var("valid",(0,t._)`${y} <= ${i.length}`);o.if((0,t.not)(p),()=>v(p)),a.ok(p)}function v(p){o.forRange("i",i.length,y,w=>{a.subschema({keyword:u,dataProp:w,dataPropType:e.Type.Num},p),f.allErrors||o.if((0,t.not)(p),()=>o.break())})}}return Qt.validateAdditionalItems=s,Qt.default=n,Qt}var Rn={},Xt={},zo;function Mo(){if(zo)return Xt;zo=1,Object.defineProperty(Xt,"__esModule",{value:!0}),Xt.validateTuple=void 0;const t=ie(),e=he(),r=ct(),n={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(a){const{schema:i,it:o}=a;if(Array.isArray(i))return s(a,"additionalItems",i);o.items=!0,!(0,e.alwaysValidSchema)(o,i)&&a.ok((0,r.validateArray)(a))}};function s(a,i,o=a.schema){const{gen:c,parentSchema:l,data:u,keyword:f,it:y}=a;w(l),y.opts.unevaluated&&o.length&&y.items!==!0&&(y.items=e.mergeEvaluated.items(c,o.length,y.items));const v=c.name("valid"),p=c.const("len",(0,t._)`${u}.length`);o.forEach((h,_)=>{(0,e.alwaysValidSchema)(y,h)||(c.if((0,t._)`${p} > ${_}`,()=>a.subschema({keyword:f,schemaProp:_,dataProp:_},v)),a.ok(v))});function w(h){const{opts:_,errSchemaPath:d}=y,m=o.length,b=m===h.minItems&&(m===h.maxItems||h[i]===!1);if(_.strictTuples&&!b){const g=`"${f}" is ${m}-tuple, but minItems or maxItems/${i} are not specified or different at path "${d}"`;(0,e.checkStrictMode)(y,g,_.strictTuples)}}}return Xt.validateTuple=s,Xt.default=n,Xt}var qo;function _f(){if(qo)return Rn;qo=1,Object.defineProperty(Rn,"__esModule",{value:!0});const t=Mo(),e={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:r=>(0,t.validateTuple)(r,"items")};return Rn.default=e,Rn}var Pn={},Zo;function gf(){if(Zo)return Pn;Zo=1,Object.defineProperty(Pn,"__esModule",{value:!0});const t=ie(),e=he(),r=ct(),n=jo(),a={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:{message:({params:{len:i}})=>(0,t.str)`must NOT have more than ${i} items`,params:({params:{len:i}})=>(0,t._)`{limit: ${i}}`},code(i){const{schema:o,parentSchema:c,it:l}=i,{prefixItems:u}=c;l.items=!0,!(0,e.alwaysValidSchema)(l,o)&&(u?(0,n.validateAdditionalItems)(i,u):i.ok((0,r.validateArray)(i)))}};return Pn.default=a,Pn}var Cn={},xo;function vf(){if(xo)return Cn;xo=1,Object.defineProperty(Cn,"__esModule",{value:!0});const t=ie(),e=he(),n={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:{message:({params:{min:s,max:a}})=>a===void 0?(0,t.str)`must contain at least ${s} valid item(s)`:(0,t.str)`must contain at least ${s} and no more than ${a} valid item(s)`,params:({params:{min:s,max:a}})=>a===void 0?(0,t._)`{minContains: ${s}}`:(0,t._)`{minContains: ${s}, maxContains: ${a}}`},code(s){const{gen:a,schema:i,parentSchema:o,data:c,it:l}=s;let u,f;const{minContains:y,maxContains:v}=o;l.opts.next?(u=y===void 0?1:y,f=v):u=1;const p=a.const("len",(0,t._)`${c}.length`);if(s.setParams({min:u,max:f}),f===void 0&&u===0){(0,e.checkStrictMode)(l,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(f!==void 0&&u>f){(0,e.checkStrictMode)(l,'"minContains" > "maxContains" is always invalid'),s.fail();return}if((0,e.alwaysValidSchema)(l,i)){let m=(0,t._)`${p} >= ${u}`;f!==void 0&&(m=(0,t._)`${m} && ${p} <= ${f}`),s.pass(m);return}l.items=!0;const w=a.name("valid");f===void 0&&u===1?_(w,()=>a.if(w,()=>a.break())):u===0?(a.let(w,!0),f!==void 0&&a.if((0,t._)`${c}.length > 0`,h)):(a.let(w,!1),h()),s.result(w,()=>s.reset());function h(){const m=a.name("_valid"),b=a.let("count",0);_(m,()=>a.if(m,()=>d(b)))}function _(m,b){a.forRange("i",0,p,g=>{s.subschema({keyword:"contains",dataProp:g,dataPropType:e.Type.Num,compositeRule:!0},m),b()})}function d(m){a.code((0,t._)`${m}++`),f===void 0?a.if((0,t._)`${m} >= ${u}`,()=>a.assign(w,!0).break()):(a.if((0,t._)`${m} > ${f}`,()=>a.assign(w,!1).break()),u===1?a.assign(w,!0):a.if((0,t._)`${m} >= ${u}`,()=>a.assign(w,!0)))}}};return Cn.default=n,Cn}var Ys={},Lo;function yf(){return Lo||(Lo=1,(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.validateSchemaDeps=t.validatePropertyDeps=t.error=void 0;const e=ie(),r=he(),n=ct();t.error={message:({params:{property:c,depsCount:l,deps:u}})=>{const f=l===1?"property":"properties";return(0,e.str)`must have ${f} ${u} when property ${c} is present`},params:({params:{property:c,depsCount:l,deps:u,missingProperty:f}})=>(0,e._)`{property: ${c},
6
+ missingProperty: ${f},
7
+ depsCount: ${l},
8
+ deps: ${u}}`};const s={keyword:"dependencies",type:"object",schemaType:"object",error:t.error,code(c){const[l,u]=a(c);i(c,l),o(c,u)}};function a({schema:c}){const l={},u={};for(const f in c){if(f==="__proto__")continue;const y=Array.isArray(c[f])?l:u;y[f]=c[f]}return[l,u]}function i(c,l=c.schema){const{gen:u,data:f,it:y}=c;if(Object.keys(l).length===0)return;const v=u.let("missing");for(const p in l){const w=l[p];if(w.length===0)continue;const h=(0,n.propertyInData)(u,f,p,y.opts.ownProperties);c.setParams({property:p,depsCount:w.length,deps:w.join(", ")}),y.allErrors?u.if(h,()=>{for(const _ of w)(0,n.checkReportMissingProp)(c,_)}):(u.if((0,e._)`${h} && (${(0,n.checkMissingProp)(c,w,v)})`),(0,n.reportMissingProp)(c,v),u.else())}}t.validatePropertyDeps=i;function o(c,l=c.schema){const{gen:u,data:f,keyword:y,it:v}=c,p=u.name("valid");for(const w in l)(0,r.alwaysValidSchema)(v,l[w])||(u.if((0,n.propertyInData)(u,f,w,v.opts.ownProperties),()=>{const h=c.subschema({keyword:y,schemaProp:w},p);c.mergeValidEvaluated(h,p)},()=>u.var(p,!0)),c.ok(p))}t.validateSchemaDeps=o,t.default=s})(Ys)),Ys}var In={},Uo;function wf(){if(Uo)return In;Uo=1,Object.defineProperty(In,"__esModule",{value:!0});const t=ie(),e=he(),n={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:{message:"property name must be valid",params:({params:s})=>(0,t._)`{propertyName: ${s.propertyName}}`},code(s){const{gen:a,schema:i,data:o,it:c}=s;if((0,e.alwaysValidSchema)(c,i))return;const l=a.name("valid");a.forIn("key",o,u=>{s.setParams({propertyName:u}),s.subschema({keyword:"propertyNames",data:u,dataTypes:["string"],propertyName:u,compositeRule:!0},l),a.if((0,t.not)(l),()=>{s.error(!0),c.allErrors||a.break()})}),s.ok(l)}};return In.default=n,In}var On={},Do;function Vo(){if(Do)return On;Do=1,Object.defineProperty(On,"__esModule",{value:!0});const t=ct(),e=ie(),r=$t(),n=he(),a={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:{message:"must NOT have additional properties",params:({params:i})=>(0,e._)`{additionalProperty: ${i.additionalProperty}}`},code(i){const{gen:o,schema:c,parentSchema:l,data:u,errsCount:f,it:y}=i;if(!f)throw new Error("ajv implementation error");const{allErrors:v,opts:p}=y;if(y.props=!0,p.removeAdditional!=="all"&&(0,n.alwaysValidSchema)(y,c))return;const w=(0,t.allSchemaProperties)(l.properties),h=(0,t.allSchemaProperties)(l.patternProperties);_(),i.ok((0,e._)`${f} === ${r.default.errors}`);function _(){o.forIn("key",u,S=>{!w.length&&!h.length?b(S):o.if(d(S),()=>b(S))})}function d(S){let E;if(w.length>8){const N=(0,n.schemaRefOrVal)(y,l.properties,"properties");E=(0,t.isOwnProperty)(o,N,S)}else w.length?E=(0,e.or)(...w.map(N=>(0,e._)`${S} === ${N}`)):E=e.nil;return h.length&&(E=(0,e.or)(E,...h.map(N=>(0,e._)`${(0,t.usePattern)(i,N)}.test(${S})`))),(0,e.not)(E)}function m(S){o.code((0,e._)`delete ${u}[${S}]`)}function b(S){if(p.removeAdditional==="all"||p.removeAdditional&&c===!1){m(S);return}if(c===!1){i.setParams({additionalProperty:S}),i.error(),v||o.break();return}if(typeof c=="object"&&!(0,n.alwaysValidSchema)(y,c)){const E=o.name("valid");p.removeAdditional==="failing"?(g(S,E,!1),o.if((0,e.not)(E),()=>{i.reset(),m(S)})):(g(S,E),v||o.if((0,e.not)(E),()=>o.break()))}}function g(S,E,N){const j={keyword:"additionalProperties",dataProp:S,dataPropType:n.Type.Str};N===!1&&Object.assign(j,{compositeRule:!0,createErrors:!1,allErrors:!1}),i.subschema(j,E)}}};return On.default=a,On}var Nn={},Fo;function bf(){if(Fo)return Nn;Fo=1,Object.defineProperty(Nn,"__esModule",{value:!0});const t=sn(),e=ct(),r=he(),n=Vo(),s={keyword:"properties",type:"object",schemaType:"object",code(a){const{gen:i,schema:o,parentSchema:c,data:l,it:u}=a;u.opts.removeAdditional==="all"&&c.additionalProperties===void 0&&n.default.code(new t.KeywordCxt(u,n.default,"additionalProperties"));const f=(0,e.allSchemaProperties)(o);for(const h of f)u.definedProperties.add(h);u.opts.unevaluated&&f.length&&u.props!==!0&&(u.props=r.mergeEvaluated.props(i,(0,r.toHash)(f),u.props));const y=f.filter(h=>!(0,r.alwaysValidSchema)(u,o[h]));if(y.length===0)return;const v=i.name("valid");for(const h of y)p(h)?w(h):(i.if((0,e.propertyInData)(i,l,h,u.opts.ownProperties)),w(h),u.allErrors||i.else().var(v,!0),i.endIf()),a.it.definedProperties.add(h),a.ok(v);function p(h){return u.opts.useDefaults&&!u.compositeRule&&o[h].default!==void 0}function w(h){a.subschema({keyword:"properties",schemaProp:h,dataProp:h},v)}}};return Nn.default=s,Nn}var An={},Ho;function Sf(){if(Ho)return An;Ho=1,Object.defineProperty(An,"__esModule",{value:!0});const t=ct(),e=ie(),r=he(),n=he(),s={keyword:"patternProperties",type:"object",schemaType:"object",code(a){const{gen:i,schema:o,data:c,parentSchema:l,it:u}=a,{opts:f}=u,y=(0,t.allSchemaProperties)(o),v=y.filter(b=>(0,r.alwaysValidSchema)(u,o[b]));if(y.length===0||v.length===y.length&&(!u.opts.unevaluated||u.props===!0))return;const p=f.strictSchema&&!f.allowMatchingProperties&&l.properties,w=i.name("valid");u.props!==!0&&!(u.props instanceof e.Name)&&(u.props=(0,n.evaluatedPropsToName)(i,u.props));const{props:h}=u;_();function _(){for(const b of y)p&&d(b),u.allErrors?m(b):(i.var(w,!0),m(b),i.if(w))}function d(b){for(const g in p)new RegExp(b).test(g)&&(0,r.checkStrictMode)(u,`property ${g} matches pattern ${b} (use allowMatchingProperties)`)}function m(b){i.forIn("key",c,g=>{i.if((0,e._)`${(0,t.usePattern)(a,b)}.test(${g})`,()=>{const S=v.includes(b);S||a.subschema({keyword:"patternProperties",schemaProp:b,dataProp:g,dataPropType:n.Type.Str},w),u.opts.unevaluated&&h!==!0?i.assign((0,e._)`${h}[${g}]`,!0):!S&&!u.allErrors&&i.if((0,e.not)(w),()=>i.break())})})}}};return An.default=s,An}var jn={},Wo;function kf(){if(Wo)return jn;Wo=1,Object.defineProperty(jn,"__esModule",{value:!0});const t=he(),e={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(r){const{gen:n,schema:s,it:a}=r;if((0,t.alwaysValidSchema)(a,s)){r.fail();return}const i=n.name("valid");r.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},i),r.failResult(i,()=>r.reset(),()=>r.error())},error:{message:"must NOT be valid"}};return jn.default=e,jn}var zn={},Ko;function $f(){if(Ko)return zn;Ko=1,Object.defineProperty(zn,"__esModule",{value:!0});const e={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:ct().validateUnion,error:{message:"must match a schema in anyOf"}};return zn.default=e,zn}var Mn={},Jo;function Ef(){if(Jo)return Mn;Jo=1,Object.defineProperty(Mn,"__esModule",{value:!0});const t=ie(),e=he(),n={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:{message:"must match exactly one schema in oneOf",params:({params:s})=>(0,t._)`{passingSchemas: ${s.passing}}`},code(s){const{gen:a,schema:i,parentSchema:o,it:c}=s;if(!Array.isArray(i))throw new Error("ajv implementation error");if(c.opts.discriminator&&o.discriminator)return;const l=i,u=a.let("valid",!1),f=a.let("passing",null),y=a.name("_valid");s.setParams({passing:f}),a.block(v),s.result(u,()=>s.reset(),()=>s.error(!0));function v(){l.forEach((p,w)=>{let h;(0,e.alwaysValidSchema)(c,p)?a.var(y,!0):h=s.subschema({keyword:"oneOf",schemaProp:w,compositeRule:!0},y),w>0&&a.if((0,t._)`${y} && ${u}`).assign(u,!1).assign(f,(0,t._)`[${f}, ${w}]`).else(),a.if(y,()=>{a.assign(u,!0),a.assign(f,w),h&&s.mergeEvaluated(h,t.Name)})})}}};return Mn.default=n,Mn}var qn={},Go;function Tf(){if(Go)return qn;Go=1,Object.defineProperty(qn,"__esModule",{value:!0});const t=he(),e={keyword:"allOf",schemaType:"array",code(r){const{gen:n,schema:s,it:a}=r;if(!Array.isArray(s))throw new Error("ajv implementation error");const i=n.name("valid");s.forEach((o,c)=>{if((0,t.alwaysValidSchema)(a,o))return;const l=r.subschema({keyword:"allOf",schemaProp:c},i);r.ok(i),r.mergeEvaluated(l)})}};return qn.default=e,qn}var Zn={},Bo;function Rf(){if(Bo)return Zn;Bo=1,Object.defineProperty(Zn,"__esModule",{value:!0});const t=ie(),e=he(),n={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:{message:({params:a})=>(0,t.str)`must match "${a.ifClause}" schema`,params:({params:a})=>(0,t._)`{failingKeyword: ${a.ifClause}}`},code(a){const{gen:i,parentSchema:o,it:c}=a;o.then===void 0&&o.else===void 0&&(0,e.checkStrictMode)(c,'"if" without "then" and "else" is ignored');const l=s(c,"then"),u=s(c,"else");if(!l&&!u)return;const f=i.let("valid",!0),y=i.name("_valid");if(v(),a.reset(),l&&u){const w=i.let("ifClause");a.setParams({ifClause:w}),i.if(y,p("then",w),p("else",w))}else l?i.if(y,p("then")):i.if((0,t.not)(y),p("else"));a.pass(f,()=>a.error(!0));function v(){const w=a.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},y);a.mergeEvaluated(w)}function p(w,h){return()=>{const _=a.subschema({keyword:w},y);i.assign(f,y),a.mergeValidEvaluated(_,f),h?i.assign(h,(0,t._)`${w}`):a.setParams({ifClause:w})}}}};function s(a,i){const o=a.schema[i];return o!==void 0&&!(0,e.alwaysValidSchema)(a,o)}return Zn.default=n,Zn}var xn={},Yo;function Pf(){if(Yo)return xn;Yo=1,Object.defineProperty(xn,"__esModule",{value:!0});const t=he(),e={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:r,parentSchema:n,it:s}){n.if===void 0&&(0,t.checkStrictMode)(s,`"${r}" without "if" is ignored`)}};return xn.default=e,xn}var Qo;function Cf(){if(Qo)return Tn;Qo=1,Object.defineProperty(Tn,"__esModule",{value:!0});const t=jo(),e=_f(),r=Mo(),n=gf(),s=vf(),a=yf(),i=wf(),o=Vo(),c=bf(),l=Sf(),u=kf(),f=$f(),y=Ef(),v=Tf(),p=Rf(),w=Pf();function h(_=!1){const d=[u.default,f.default,y.default,v.default,p.default,w.default,i.default,o.default,a.default,c.default,l.default];return _?d.push(e.default,n.default):d.push(t.default,r.default),d.push(s.default),d}return Tn.default=h,Tn}var Ln={},Un={},Xo;function If(){if(Xo)return Un;Xo=1,Object.defineProperty(Un,"__esModule",{value:!0});const t=ie(),r={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:{message:({schemaCode:n})=>(0,t.str)`must match format "${n}"`,params:({schemaCode:n})=>(0,t._)`{format: ${n}}`},code(n,s){const{gen:a,data:i,$data:o,schema:c,schemaCode:l,it:u}=n,{opts:f,errSchemaPath:y,schemaEnv:v,self:p}=u;if(!f.validateFormats)return;o?w():h();function w(){const _=a.scopeValue("formats",{ref:p.formats,code:f.code.formats}),d=a.const("fDef",(0,t._)`${_}[${l}]`),m=a.let("fType"),b=a.let("format");a.if((0,t._)`typeof ${d} == "object" && !(${d} instanceof RegExp)`,()=>a.assign(m,(0,t._)`${d}.type || "string"`).assign(b,(0,t._)`${d}.validate`),()=>a.assign(m,(0,t._)`"string"`).assign(b,d)),n.fail$data((0,t.or)(g(),S()));function g(){return f.strictSchema===!1?t.nil:(0,t._)`${l} && !${b}`}function S(){const E=v.$async?(0,t._)`(${d}.async ? await ${b}(${i}) : ${b}(${i}))`:(0,t._)`${b}(${i})`,N=(0,t._)`(typeof ${b} == "function" ? ${E} : ${b}.test(${i}))`;return(0,t._)`${b} && ${b} !== true && ${m} === ${s} && !${N}`}}function h(){const _=p.formats[c];if(!_){g();return}if(_===!0)return;const[d,m,b]=S(_);d===s&&n.pass(E());function g(){if(f.strictSchema===!1){p.logger.warn(N());return}throw new Error(N());function N(){return`unknown format "${c}" ignored in schema at path "${y}"`}}function S(N){const j=N instanceof RegExp?(0,t.regexpCode)(N):f.code.formats?(0,t._)`${f.code.formats}${(0,t.getProperty)(c)}`:void 0,D=a.scopeValue("formats",{key:c,ref:N,code:j});return typeof N=="object"&&!(N instanceof RegExp)?[N.type||"string",N.validate,(0,t._)`${D}.validate`]:["string",N,D]}function E(){if(typeof _=="object"&&!(_ instanceof RegExp)&&_.async){if(!v.$async)throw new Error("async format in sync schema");return(0,t._)`await ${b}(${i})`}return typeof m=="function"?(0,t._)`${b}(${i})`:(0,t._)`${b}.test(${i})`}}}};return Un.default=r,Un}var ec;function Of(){if(ec)return Ln;ec=1,Object.defineProperty(Ln,"__esModule",{value:!0});const e=[If().default];return Ln.default=e,Ln}var xt={},tc;function Nf(){return tc||(tc=1,Object.defineProperty(xt,"__esModule",{value:!0}),xt.contentVocabulary=xt.metadataVocabulary=void 0,xt.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"],xt.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]),xt}var rc;function Af(){if(rc)return ln;rc=1,Object.defineProperty(ln,"__esModule",{value:!0});const t=rf(),e=pf(),r=Cf(),n=Of(),s=Nf(),a=[t.default,e.default,(0,r.default)(),n.default,s.metadataVocabulary,s.contentVocabulary];return ln.default=a,ln}var Dn={},br={},nc;function jf(){if(nc)return br;nc=1,Object.defineProperty(br,"__esModule",{value:!0}),br.DiscrError=void 0;var t;return(function(e){e.Tag="tag",e.Mapping="mapping"})(t||(br.DiscrError=t={})),br}var sc;function zf(){if(sc)return Dn;sc=1,Object.defineProperty(Dn,"__esModule",{value:!0});const t=ie(),e=jf(),r=Ks(),n=cn(),s=he(),i={keyword:"discriminator",type:"object",schemaType:"object",error:{message:({params:{discrError:o,tagName:c}})=>o===e.DiscrError.Tag?`tag "${c}" must be string`:`value of tag "${c}" must be in oneOf`,params:({params:{discrError:o,tag:c,tagName:l}})=>(0,t._)`{error: ${o}, tag: ${l}, tagValue: ${c}}`},code(o){const{gen:c,data:l,schema:u,parentSchema:f,it:y}=o,{oneOf:v}=f;if(!y.opts.discriminator)throw new Error("discriminator: requires discriminator option");const p=u.propertyName;if(typeof p!="string")throw new Error("discriminator: requires propertyName");if(u.mapping)throw new Error("discriminator: mapping is not supported");if(!v)throw new Error("discriminator: requires oneOf keyword");const w=c.let("valid",!1),h=c.const("tag",(0,t._)`${l}${(0,t.getProperty)(p)}`);c.if((0,t._)`typeof ${h} == "string"`,()=>_(),()=>o.error(!1,{discrError:e.DiscrError.Tag,tag:h,tagName:p})),o.ok(w);function _(){const b=m();c.if(!1);for(const g in b)c.elseIf((0,t._)`${h} === ${g}`),c.assign(w,d(b[g]));c.else(),o.error(!1,{discrError:e.DiscrError.Mapping,tag:h,tagName:p}),c.endIf()}function d(b){const g=c.name("valid"),S=o.subschema({keyword:"oneOf",schemaProp:b},g);return o.mergeEvaluated(S,t.Name),g}function m(){var b;const g={},S=N(f);let E=!0;for(let M=0;M<v.length;M++){let H=v[M];if(H?.$ref&&!(0,s.schemaHasRulesButRef)(H,y.self.RULES)){const Y=H.$ref;if(H=r.resolveRef.call(y.self,y.schemaEnv.root,y.baseId,Y),H instanceof r.SchemaEnv&&(H=H.schema),H===void 0)throw new n.default(y.opts.uriResolver,y.baseId,Y)}const G=(b=H?.properties)===null||b===void 0?void 0:b[p];if(typeof G!="object")throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${p}"`);E=E&&(S||N(H)),j(G,M)}if(!E)throw new Error(`discriminator: "${p}" must be required`);return g;function N({required:M}){return Array.isArray(M)&&M.includes(p)}function j(M,H){if(M.const)D(M.const,H);else if(M.enum)for(const G of M.enum)D(G,H);else throw new Error(`discriminator: "properties/${p}" must have "const" or "enum"`)}function D(M,H){if(typeof M!="string"||M in g)throw new Error(`discriminator: "${p}" values must be unique strings`);g[M]=H}}}};return Dn.default=i,Dn}const Mf={$schema:"http://json-schema.org/draft-07/schema#",$id:"http://json-schema.org/draft-07/schema#",title:"Core schema meta-schema",definitions:{schemaArray:{type:"array",minItems:1,items:{$ref:"#"}},nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{allOf:[{$ref:"#/definitions/nonNegativeInteger"},{default:0}]},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}},type:["object","boolean"],properties:{$id:{type:"string",format:"uri-reference"},$schema:{type:"string",format:"uri"},$ref:{type:"string",format:"uri-reference"},$comment:{type:"string"},title:{type:"string"},description:{type:"string"},default:!0,readOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0},multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/definitions/nonNegativeInteger"},minLength:{$ref:"#/definitions/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},additionalItems:{$ref:"#"},items:{anyOf:[{$ref:"#"},{$ref:"#/definitions/schemaArray"}],default:!0},maxItems:{$ref:"#/definitions/nonNegativeInteger"},minItems:{$ref:"#/definitions/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},contains:{$ref:"#"},maxProperties:{$ref:"#/definitions/nonNegativeInteger"},minProperties:{$ref:"#/definitions/nonNegativeIntegerDefault0"},required:{$ref:"#/definitions/stringArray"},additionalProperties:{$ref:"#"},definitions:{type:"object",additionalProperties:{$ref:"#"},default:{}},properties:{type:"object",additionalProperties:{$ref:"#"},default:{}},patternProperties:{type:"object",additionalProperties:{$ref:"#"},propertyNames:{format:"regex"},default:{}},dependencies:{type:"object",additionalProperties:{anyOf:[{$ref:"#"},{$ref:"#/definitions/stringArray"}]}},propertyNames:{$ref:"#"},const:!0,enum:{type:"array",items:!0,minItems:1,uniqueItems:!0},type:{anyOf:[{$ref:"#/definitions/simpleTypes"},{type:"array",items:{$ref:"#/definitions/simpleTypes"},minItems:1,uniqueItems:!0}]},format:{type:"string"},contentMediaType:{type:"string"},contentEncoding:{type:"string"},if:{$ref:"#"},then:{$ref:"#"},else:{$ref:"#"},allOf:{$ref:"#/definitions/schemaArray"},anyOf:{$ref:"#/definitions/schemaArray"},oneOf:{$ref:"#/definitions/schemaArray"},not:{$ref:"#"}},default:!0};var ac;function ic(){return ac||(ac=1,(function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.MissingRefError=e.ValidationError=e.CodeGen=e.Name=e.nil=e.stringify=e.str=e._=e.KeywordCxt=e.Ajv=void 0;const r=Xd(),n=Af(),s=zf(),a=Mf,i=["/properties"],o="http://json-schema.org/draft-07/schema";class c extends r.default{_addVocabularies(){super._addVocabularies(),n.default.forEach(p=>this.addVocabulary(p)),this.opts.discriminator&&this.addKeyword(s.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;const p=this.opts.$data?this.$dataMetaSchema(a,i):a;this.addMetaSchema(p,o,!1),this.refs["http://json-schema.org/schema"]=o}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(o)?o:void 0)}}e.Ajv=c,t.exports=e=c,t.exports.Ajv=c,Object.defineProperty(e,"__esModule",{value:!0}),e.default=c;var l=sn();Object.defineProperty(e,"KeywordCxt",{enumerable:!0,get:function(){return l.KeywordCxt}});var u=ie();Object.defineProperty(e,"_",{enumerable:!0,get:function(){return u._}}),Object.defineProperty(e,"str",{enumerable:!0,get:function(){return u.str}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return u.stringify}}),Object.defineProperty(e,"nil",{enumerable:!0,get:function(){return u.nil}}),Object.defineProperty(e,"Name",{enumerable:!0,get:function(){return u.Name}}),Object.defineProperty(e,"CodeGen",{enumerable:!0,get:function(){return u.CodeGen}});var f=Ws();Object.defineProperty(e,"ValidationError",{enumerable:!0,get:function(){return f.default}});var y=cn();Object.defineProperty(e,"MissingRefError",{enumerable:!0,get:function(){return y.default}})})(Qr,Qr.exports)),Qr.exports}var oc=ic();const qf=Yt(oc),Zf=Object.freeze({status:"aborted"});function A(t,e,r){function n(o,c){var l;Object.defineProperty(o,"_zod",{value:o._zod??{},enumerable:!1}),(l=o._zod).traits??(l.traits=new Set),o._zod.traits.add(t),e(o,c);for(const u in i.prototype)u in o||Object.defineProperty(o,u,{value:i.prototype[u].bind(o)});o._zod.constr=i,o._zod.def=c}const s=r?.Parent??Object;class a extends s{}Object.defineProperty(a,"name",{value:t});function i(o){var c;const l=r?.Parent?new a:this;n(l,o),(c=l._zod).deferred??(c.deferred=[]);for(const u of l._zod.deferred)u();return l}return Object.defineProperty(i,"init",{value:n}),Object.defineProperty(i,Symbol.hasInstance,{value:o=>r?.Parent&&o instanceof r.Parent?!0:o?._zod?.traits?.has(t)}),Object.defineProperty(i,"name",{value:t}),i}class Sr extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}const cc={};function Tt(t){return cc}function uc(t){const e=Object.values(t).filter(n=>typeof n=="number");return Object.entries(t).filter(([n,s])=>e.indexOf(+n)===-1).map(([n,s])=>s)}function xf(t,e){return typeof e=="bigint"?e.toString():e}function Qs(t){return{get value(){{const e=t();return Object.defineProperty(this,"value",{value:e}),e}}}}function Xs(t){return t==null}function ea(t){const e=t.startsWith("^")?1:0,r=t.endsWith("$")?t.length-1:t.length;return t.slice(e,r)}function Lf(t,e){const r=(t.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,s=r>n?r:n,a=Number.parseInt(t.toFixed(s).replace(".","")),i=Number.parseInt(e.toFixed(s).replace(".",""));return a%i/10**s}function ke(t,e,r){Object.defineProperty(t,e,{get(){{const n=r();return t[e]=n,n}},set(n){Object.defineProperty(t,e,{value:n})},configurable:!0})}function kr(t,e,r){Object.defineProperty(t,e,{value:r,writable:!0,enumerable:!0,configurable:!0})}function $r(t){return JSON.stringify(t)}const lc=Error.captureStackTrace?Error.captureStackTrace:(...t)=>{};function Vn(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}const Uf=Qs(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{const t=Function;return new t(""),!0}catch{return!1}});function Fn(t){if(Vn(t)===!1)return!1;const e=t.constructor;if(e===void 0)return!0;const r=e.prototype;return!(Vn(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}const Df=new Set(["string","number","symbol"]);function Er(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Rt(t,e,r){const n=new t._zod.constr(e??t._zod.def);return(!e||r?.parent)&&(n._zod.parent=t),n}function Q(t){const e=t;if(!e)return{};if(typeof e=="string")return{error:()=>e};if(e?.message!==void 0){if(e?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");e.error=e.message}return delete e.message,typeof e.error=="string"?{...e,error:()=>e.error}:e}function Vf(t){return Object.keys(t).filter(e=>t[e]._zod.optin==="optional"&&t[e]._zod.optout==="optional")}const Ff={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function Hf(t,e){const r={},n=t._zod.def;for(const s in e){if(!(s in n.shape))throw new Error(`Unrecognized key: "${s}"`);e[s]&&(r[s]=n.shape[s])}return Rt(t,{...t._zod.def,shape:r,checks:[]})}function Wf(t,e){const r={...t._zod.def.shape},n=t._zod.def;for(const s in e){if(!(s in n.shape))throw new Error(`Unrecognized key: "${s}"`);e[s]&&delete r[s]}return Rt(t,{...t._zod.def,shape:r,checks:[]})}function Kf(t,e){if(!Fn(e))throw new Error("Invalid input to extend: expected a plain object");const r={...t._zod.def,get shape(){const n={...t._zod.def.shape,...e};return kr(this,"shape",n),n},checks:[]};return Rt(t,r)}function Jf(t,e){return Rt(t,{...t._zod.def,get shape(){const r={...t._zod.def.shape,...e._zod.def.shape};return kr(this,"shape",r),r},catchall:e._zod.def.catchall,checks:[]})}function Gf(t,e,r){const n=e._zod.def.shape,s={...n};if(r)for(const a in r){if(!(a in n))throw new Error(`Unrecognized key: "${a}"`);r[a]&&(s[a]=t?new t({type:"optional",innerType:n[a]}):n[a])}else for(const a in n)s[a]=t?new t({type:"optional",innerType:n[a]}):n[a];return Rt(e,{...e._zod.def,shape:s,checks:[]})}function Bf(t,e,r){const n=e._zod.def.shape,s={...n};if(r)for(const a in r){if(!(a in s))throw new Error(`Unrecognized key: "${a}"`);r[a]&&(s[a]=new t({type:"nonoptional",innerType:n[a]}))}else for(const a in n)s[a]=new t({type:"nonoptional",innerType:n[a]});return Rt(e,{...e._zod.def,shape:s,checks:[]})}function Tr(t,e=0){for(let r=e;r<t.issues.length;r++)if(t.issues[r]?.continue!==!0)return!0;return!1}function Lt(t,e){return e.map(r=>{var n;return(n=r).path??(n.path=[]),r.path.unshift(t),r})}function Hn(t){return typeof t=="string"?t:t?.message}function Pt(t,e,r){const n={...t,path:t.path??[]};if(!t.message){const s=Hn(t.inst?._zod.def?.error?.(t))??Hn(e?.error?.(t))??Hn(r.customError?.(t))??Hn(r.localeError?.(t))??"Invalid input";n.message=s}return delete n.inst,delete n.continue,e?.reportInput||delete n.input,n}function ta(t){return Array.isArray(t)?"array":typeof t=="string"?"string":"unknown"}function Rr(...t){const[e,r,n]=t;return typeof e=="string"?{message:e,code:"custom",input:r,inst:n}:{...e}}const dc=(t,e)=>{t.name="$ZodError",Object.defineProperty(t,"_zod",{value:t._zod,enumerable:!1}),Object.defineProperty(t,"issues",{value:e,enumerable:!1}),Object.defineProperty(t,"message",{get(){return JSON.stringify(e,xf,2)},enumerable:!0}),Object.defineProperty(t,"toString",{value:()=>t.message,enumerable:!1})},fc=A("$ZodError",dc),Wn=A("$ZodError",dc,{Parent:Error});function Yf(t,e=r=>r.message){const r={},n=[];for(const s of t.issues)s.path.length>0?(r[s.path[0]]=r[s.path[0]]||[],r[s.path[0]].push(e(s))):n.push(e(s));return{formErrors:n,fieldErrors:r}}function Qf(t,e){const r=e||function(a){return a.message},n={_errors:[]},s=a=>{for(const i of a.issues)if(i.code==="invalid_union"&&i.errors.length)i.errors.map(o=>s({issues:o}));else if(i.code==="invalid_key")s({issues:i.issues});else if(i.code==="invalid_element")s({issues:i.issues});else if(i.path.length===0)n._errors.push(r(i));else{let o=n,c=0;for(;c<i.path.length;){const l=i.path[c];c===i.path.length-1?(o[l]=o[l]||{_errors:[]},o[l]._errors.push(r(i))):o[l]=o[l]||{_errors:[]},o=o[l],c++}}};return s(t),n}const hc=t=>(e,r,n,s)=>{const a=n?Object.assign(n,{async:!1}):{async:!1},i=e._zod.run({value:r,issues:[]},a);if(i instanceof Promise)throw new Sr;if(i.issues.length){const o=new(s?.Err??t)(i.issues.map(c=>Pt(c,a,Tt())));throw lc(o,s?.callee),o}return i.value},Xf=hc(Wn),mc=t=>async(e,r,n,s)=>{const a=n?Object.assign(n,{async:!0}):{async:!0};let i=e._zod.run({value:r,issues:[]},a);if(i instanceof Promise&&(i=await i),i.issues.length){const o=new(s?.Err??t)(i.issues.map(c=>Pt(c,a,Tt())));throw lc(o,s?.callee),o}return i.value},eh=mc(Wn),pc=t=>(e,r,n)=>{const s=n?{...n,async:!1}:{async:!1},a=e._zod.run({value:r,issues:[]},s);if(a instanceof Promise)throw new Sr;return a.issues.length?{success:!1,error:new(t??fc)(a.issues.map(i=>Pt(i,s,Tt())))}:{success:!0,data:a.value}},ra=pc(Wn),_c=t=>async(e,r,n)=>{const s=n?Object.assign(n,{async:!0}):{async:!0};let a=e._zod.run({value:r,issues:[]},s);return a instanceof Promise&&(a=await a),a.issues.length?{success:!1,error:new t(a.issues.map(i=>Pt(i,s,Tt())))}:{success:!0,data:a.value}},na=_c(Wn),th=/^[cC][^\s-]{8,}$/,rh=/^[0-9a-z]+$/,nh=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,sh=/^[0-9a-vA-V]{20}$/,ah=/^[A-Za-z0-9]{27}$/,ih=/^[a-zA-Z0-9_-]{21}$/,oh=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,ch=/^([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})$/,gc=t=>t?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${t}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000)$/,uh=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,lh="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function dh(){return new RegExp(lh,"u")}const fh=/^(?:(?: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])$/,hh=/^(([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})$/,mh=/^((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])$/,ph=/^(([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])$/,_h=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,vc=/^[A-Za-z0-9_-]*$/,gh=/^([a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+$/,vh=/^\+(?:[0-9]){6,14}[0-9]$/,yc="(?:(?:\\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])))",yh=new RegExp(`^${yc}$`);function wc(t){const e="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof t.precision=="number"?t.precision===-1?`${e}`:t.precision===0?`${e}:[0-5]\\d`:`${e}:[0-5]\\d\\.\\d{${t.precision}}`:`${e}(?::[0-5]\\d(?:\\.\\d+)?)?`}function wh(t){return new RegExp(`^${wc(t)}$`)}function bh(t){const e=wc({precision:t.precision}),r=["Z"];t.local&&r.push(""),t.offset&&r.push("([+-]\\d{2}:\\d{2})");const n=`${e}(?:${r.join("|")})`;return new RegExp(`^${yc}T(?:${n})$`)}const Sh=t=>{const e=t?`[\\s\\S]{${t?.minimum??0},${t?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${e}$`)},kh=/^\d+$/,$h=/^-?\d+(?:\.\d+)?/i,Eh=/true|false/i,Th=/null/i,Rh=/^[^A-Z]*$/,Ph=/^[^a-z]*$/,Ke=A("$ZodCheck",(t,e)=>{var r;t._zod??(t._zod={}),t._zod.def=e,(r=t._zod).onattach??(r.onattach=[])}),bc={number:"number",bigint:"bigint",object:"date"},Sc=A("$ZodCheckLessThan",(t,e)=>{Ke.init(t,e);const r=bc[typeof e.value];t._zod.onattach.push(n=>{const s=n._zod.bag,a=(e.inclusive?s.maximum:s.exclusiveMaximum)??Number.POSITIVE_INFINITY;e.value<a&&(e.inclusive?s.maximum=e.value:s.exclusiveMaximum=e.value)}),t._zod.check=n=>{(e.inclusive?n.value<=e.value:n.value<e.value)||n.issues.push({origin:r,code:"too_big",maximum:e.value,input:n.value,inclusive:e.inclusive,inst:t,continue:!e.abort})}}),kc=A("$ZodCheckGreaterThan",(t,e)=>{Ke.init(t,e);const r=bc[typeof e.value];t._zod.onattach.push(n=>{const s=n._zod.bag,a=(e.inclusive?s.minimum:s.exclusiveMinimum)??Number.NEGATIVE_INFINITY;e.value>a&&(e.inclusive?s.minimum=e.value:s.exclusiveMinimum=e.value)}),t._zod.check=n=>{(e.inclusive?n.value>=e.value:n.value>e.value)||n.issues.push({origin:r,code:"too_small",minimum:e.value,input:n.value,inclusive:e.inclusive,inst:t,continue:!e.abort})}}),Ch=A("$ZodCheckMultipleOf",(t,e)=>{Ke.init(t,e),t._zod.onattach.push(r=>{var n;(n=r._zod.bag).multipleOf??(n.multipleOf=e.value)}),t._zod.check=r=>{if(typeof r.value!=typeof e.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof r.value=="bigint"?r.value%e.value===BigInt(0):Lf(r.value,e.value)===0)||r.issues.push({origin:typeof r.value,code:"not_multiple_of",divisor:e.value,input:r.value,inst:t,continue:!e.abort})}}),Ih=A("$ZodCheckNumberFormat",(t,e)=>{Ke.init(t,e),e.format=e.format||"float64";const r=e.format?.includes("int"),n=r?"int":"number",[s,a]=Ff[e.format];t._zod.onattach.push(i=>{const o=i._zod.bag;o.format=e.format,o.minimum=s,o.maximum=a,r&&(o.pattern=kh)}),t._zod.check=i=>{const o=i.value;if(r){if(!Number.isInteger(o)){i.issues.push({expected:n,format:e.format,code:"invalid_type",input:o,inst:t});return}if(!Number.isSafeInteger(o)){o>0?i.issues.push({input:o,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:t,origin:n,continue:!e.abort}):i.issues.push({input:o,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:t,origin:n,continue:!e.abort});return}}o<s&&i.issues.push({origin:"number",input:o,code:"too_small",minimum:s,inclusive:!0,inst:t,continue:!e.abort}),o>a&&i.issues.push({origin:"number",input:o,code:"too_big",maximum:a,inst:t})}}),Oh=A("$ZodCheckMaxLength",(t,e)=>{var r;Ke.init(t,e),(r=t._zod.def).when??(r.when=n=>{const s=n.value;return!Xs(s)&&s.length!==void 0}),t._zod.onattach.push(n=>{const s=n._zod.bag.maximum??Number.POSITIVE_INFINITY;e.maximum<s&&(n._zod.bag.maximum=e.maximum)}),t._zod.check=n=>{const s=n.value;if(s.length<=e.maximum)return;const i=ta(s);n.issues.push({origin:i,code:"too_big",maximum:e.maximum,inclusive:!0,input:s,inst:t,continue:!e.abort})}}),Nh=A("$ZodCheckMinLength",(t,e)=>{var r;Ke.init(t,e),(r=t._zod.def).when??(r.when=n=>{const s=n.value;return!Xs(s)&&s.length!==void 0}),t._zod.onattach.push(n=>{const s=n._zod.bag.minimum??Number.NEGATIVE_INFINITY;e.minimum>s&&(n._zod.bag.minimum=e.minimum)}),t._zod.check=n=>{const s=n.value;if(s.length>=e.minimum)return;const i=ta(s);n.issues.push({origin:i,code:"too_small",minimum:e.minimum,inclusive:!0,input:s,inst:t,continue:!e.abort})}}),Ah=A("$ZodCheckLengthEquals",(t,e)=>{var r;Ke.init(t,e),(r=t._zod.def).when??(r.when=n=>{const s=n.value;return!Xs(s)&&s.length!==void 0}),t._zod.onattach.push(n=>{const s=n._zod.bag;s.minimum=e.length,s.maximum=e.length,s.length=e.length}),t._zod.check=n=>{const s=n.value,a=s.length;if(a===e.length)return;const i=ta(s),o=a>e.length;n.issues.push({origin:i,...o?{code:"too_big",maximum:e.length}:{code:"too_small",minimum:e.length},inclusive:!0,exact:!0,input:n.value,inst:t,continue:!e.abort})}}),Kn=A("$ZodCheckStringFormat",(t,e)=>{var r,n;Ke.init(t,e),t._zod.onattach.push(s=>{const a=s._zod.bag;a.format=e.format,e.pattern&&(a.patterns??(a.patterns=new Set),a.patterns.add(e.pattern))}),e.pattern?(r=t._zod).check??(r.check=s=>{e.pattern.lastIndex=0,!e.pattern.test(s.value)&&s.issues.push({origin:"string",code:"invalid_format",format:e.format,input:s.value,...e.pattern?{pattern:e.pattern.toString()}:{},inst:t,continue:!e.abort})}):(n=t._zod).check??(n.check=()=>{})}),jh=A("$ZodCheckRegex",(t,e)=>{Kn.init(t,e),t._zod.check=r=>{e.pattern.lastIndex=0,!e.pattern.test(r.value)&&r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:e.pattern.toString(),inst:t,continue:!e.abort})}}),zh=A("$ZodCheckLowerCase",(t,e)=>{e.pattern??(e.pattern=Rh),Kn.init(t,e)}),Mh=A("$ZodCheckUpperCase",(t,e)=>{e.pattern??(e.pattern=Ph),Kn.init(t,e)}),qh=A("$ZodCheckIncludes",(t,e)=>{Ke.init(t,e);const r=Er(e.includes),n=new RegExp(typeof e.position=="number"?`^.{${e.position}}${r}`:r);e.pattern=n,t._zod.onattach.push(s=>{const a=s._zod.bag;a.patterns??(a.patterns=new Set),a.patterns.add(n)}),t._zod.check=s=>{s.value.includes(e.includes,e.position)||s.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:e.includes,input:s.value,inst:t,continue:!e.abort})}}),Zh=A("$ZodCheckStartsWith",(t,e)=>{Ke.init(t,e);const r=new RegExp(`^${Er(e.prefix)}.*`);e.pattern??(e.pattern=r),t._zod.onattach.push(n=>{const s=n._zod.bag;s.patterns??(s.patterns=new Set),s.patterns.add(r)}),t._zod.check=n=>{n.value.startsWith(e.prefix)||n.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:e.prefix,input:n.value,inst:t,continue:!e.abort})}}),xh=A("$ZodCheckEndsWith",(t,e)=>{Ke.init(t,e);const r=new RegExp(`.*${Er(e.suffix)}$`);e.pattern??(e.pattern=r),t._zod.onattach.push(n=>{const s=n._zod.bag;s.patterns??(s.patterns=new Set),s.patterns.add(r)}),t._zod.check=n=>{n.value.endsWith(e.suffix)||n.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:e.suffix,input:n.value,inst:t,continue:!e.abort})}}),Lh=A("$ZodCheckOverwrite",(t,e)=>{Ke.init(t,e),t._zod.check=r=>{r.value=e.tx(r.value)}});class Uh{constructor(e=[]){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}const n=e.split(`
9
+ `).filter(i=>i),s=Math.min(...n.map(i=>i.length-i.trimStart().length)),a=n.map(i=>i.slice(s)).map(i=>" ".repeat(this.indent*2)+i);for(const i of a)this.content.push(i)}compile(){const e=Function,r=this?.args,s=[...(this?.content??[""]).map(a=>` ${a}`)];return new e(...r,s.join(`
10
+ `))}}const Dh={major:4,minor:0,patch:0},Se=A("$ZodType",(t,e)=>{var r;t??(t={}),t._zod.def=e,t._zod.bag=t._zod.bag||{},t._zod.version=Dh;const n=[...t._zod.def.checks??[]];t._zod.traits.has("$ZodCheck")&&n.unshift(t);for(const s of n)for(const a of s._zod.onattach)a(t);if(n.length===0)(r=t._zod).deferred??(r.deferred=[]),t._zod.deferred?.push(()=>{t._zod.run=t._zod.parse});else{const s=(a,i,o)=>{let c=Tr(a),l;for(const u of i){if(u._zod.def.when){if(!u._zod.def.when(a))continue}else if(c)continue;const f=a.issues.length,y=u._zod.check(a);if(y instanceof Promise&&o?.async===!1)throw new Sr;if(l||y instanceof Promise)l=(l??Promise.resolve()).then(async()=>{await y,a.issues.length!==f&&(c||(c=Tr(a,f)))});else{if(a.issues.length===f)continue;c||(c=Tr(a,f))}}return l?l.then(()=>a):a};t._zod.run=(a,i)=>{const o=t._zod.parse(a,i);if(o instanceof Promise){if(i.async===!1)throw new Sr;return o.then(c=>s(c,n,i))}return s(o,n,i)}}t["~standard"]={validate:s=>{try{const a=ra(t,s);return a.success?{value:a.data}:{issues:a.error?.issues}}catch{return na(t,s).then(i=>i.success?{value:i.data}:{issues:i.error?.issues})}},vendor:"zod",version:1}}),sa=A("$ZodString",(t,e)=>{Se.init(t,e),t._zod.pattern=[...t?._zod.bag?.patterns??[]].pop()??Sh(t._zod.bag),t._zod.parse=(r,n)=>{if(e.coerce)try{r.value=String(r.value)}catch{}return typeof r.value=="string"||r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:t}),r}}),$e=A("$ZodStringFormat",(t,e)=>{Kn.init(t,e),sa.init(t,e)}),Vh=A("$ZodGUID",(t,e)=>{e.pattern??(e.pattern=ch),$e.init(t,e)}),Fh=A("$ZodUUID",(t,e)=>{if(e.version){const n={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[e.version];if(n===void 0)throw new Error(`Invalid UUID version: "${e.version}"`);e.pattern??(e.pattern=gc(n))}else e.pattern??(e.pattern=gc());$e.init(t,e)}),Hh=A("$ZodEmail",(t,e)=>{e.pattern??(e.pattern=uh),$e.init(t,e)}),Wh=A("$ZodURL",(t,e)=>{$e.init(t,e),t._zod.check=r=>{try{const n=r.value,s=new URL(n),a=s.href;e.hostname&&(e.hostname.lastIndex=0,e.hostname.test(s.hostname)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:gh.source,input:r.value,inst:t,continue:!e.abort})),e.protocol&&(e.protocol.lastIndex=0,e.protocol.test(s.protocol.endsWith(":")?s.protocol.slice(0,-1):s.protocol)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:e.protocol.source,input:r.value,inst:t,continue:!e.abort})),!n.endsWith("/")&&a.endsWith("/")?r.value=a.slice(0,-1):r.value=a;return}catch{r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:t,continue:!e.abort})}}}),Kh=A("$ZodEmoji",(t,e)=>{e.pattern??(e.pattern=dh()),$e.init(t,e)}),Jh=A("$ZodNanoID",(t,e)=>{e.pattern??(e.pattern=ih),$e.init(t,e)}),Gh=A("$ZodCUID",(t,e)=>{e.pattern??(e.pattern=th),$e.init(t,e)}),Bh=A("$ZodCUID2",(t,e)=>{e.pattern??(e.pattern=rh),$e.init(t,e)}),Yh=A("$ZodULID",(t,e)=>{e.pattern??(e.pattern=nh),$e.init(t,e)}),Qh=A("$ZodXID",(t,e)=>{e.pattern??(e.pattern=sh),$e.init(t,e)}),Xh=A("$ZodKSUID",(t,e)=>{e.pattern??(e.pattern=ah),$e.init(t,e)}),em=A("$ZodISODateTime",(t,e)=>{e.pattern??(e.pattern=bh(e)),$e.init(t,e)}),tm=A("$ZodISODate",(t,e)=>{e.pattern??(e.pattern=yh),$e.init(t,e)}),rm=A("$ZodISOTime",(t,e)=>{e.pattern??(e.pattern=wh(e)),$e.init(t,e)}),nm=A("$ZodISODuration",(t,e)=>{e.pattern??(e.pattern=oh),$e.init(t,e)}),sm=A("$ZodIPv4",(t,e)=>{e.pattern??(e.pattern=fh),$e.init(t,e),t._zod.onattach.push(r=>{const n=r._zod.bag;n.format="ipv4"})}),am=A("$ZodIPv6",(t,e)=>{e.pattern??(e.pattern=hh),$e.init(t,e),t._zod.onattach.push(r=>{const n=r._zod.bag;n.format="ipv6"}),t._zod.check=r=>{try{new URL(`http://[${r.value}]`)}catch{r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:t,continue:!e.abort})}}}),im=A("$ZodCIDRv4",(t,e)=>{e.pattern??(e.pattern=mh),$e.init(t,e)}),om=A("$ZodCIDRv6",(t,e)=>{e.pattern??(e.pattern=ph),$e.init(t,e),t._zod.check=r=>{const[n,s]=r.value.split("/");try{if(!s)throw new Error;const a=Number(s);if(`${a}`!==s)throw new Error;if(a<0||a>128)throw new Error;new URL(`http://[${n}]`)}catch{r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:t,continue:!e.abort})}}});function $c(t){if(t==="")return!0;if(t.length%4!==0)return!1;try{return atob(t),!0}catch{return!1}}const cm=A("$ZodBase64",(t,e)=>{e.pattern??(e.pattern=_h),$e.init(t,e),t._zod.onattach.push(r=>{r._zod.bag.contentEncoding="base64"}),t._zod.check=r=>{$c(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:t,continue:!e.abort})}});function um(t){if(!vc.test(t))return!1;const e=t.replace(/[-_]/g,n=>n==="-"?"+":"/"),r=e.padEnd(Math.ceil(e.length/4)*4,"=");return $c(r)}const lm=A("$ZodBase64URL",(t,e)=>{e.pattern??(e.pattern=vc),$e.init(t,e),t._zod.onattach.push(r=>{r._zod.bag.contentEncoding="base64url"}),t._zod.check=r=>{um(r.value)||r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:t,continue:!e.abort})}}),dm=A("$ZodE164",(t,e)=>{e.pattern??(e.pattern=vh),$e.init(t,e)});function fm(t,e=null){try{const r=t.split(".");if(r.length!==3)return!1;const[n]=r;if(!n)return!1;const s=JSON.parse(atob(n));return!("typ"in s&&s?.typ!=="JWT"||!s.alg||e&&(!("alg"in s)||s.alg!==e))}catch{return!1}}const hm=A("$ZodJWT",(t,e)=>{$e.init(t,e),t._zod.check=r=>{fm(r.value,e.alg)||r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:t,continue:!e.abort})}}),Ec=A("$ZodNumber",(t,e)=>{Se.init(t,e),t._zod.pattern=t._zod.bag.pattern??$h,t._zod.parse=(r,n)=>{if(e.coerce)try{r.value=Number(r.value)}catch{}const s=r.value;if(typeof s=="number"&&!Number.isNaN(s)&&Number.isFinite(s))return r;const a=typeof s=="number"?Number.isNaN(s)?"NaN":Number.isFinite(s)?void 0:"Infinity":void 0;return r.issues.push({expected:"number",code:"invalid_type",input:s,inst:t,...a?{received:a}:{}}),r}}),mm=A("$ZodNumber",(t,e)=>{Ih.init(t,e),Ec.init(t,e)}),pm=A("$ZodBoolean",(t,e)=>{Se.init(t,e),t._zod.pattern=Eh,t._zod.parse=(r,n)=>{if(e.coerce)try{r.value=!!r.value}catch{}const s=r.value;return typeof s=="boolean"||r.issues.push({expected:"boolean",code:"invalid_type",input:s,inst:t}),r}}),_m=A("$ZodNull",(t,e)=>{Se.init(t,e),t._zod.pattern=Th,t._zod.values=new Set([null]),t._zod.parse=(r,n)=>{const s=r.value;return s===null||r.issues.push({expected:"null",code:"invalid_type",input:s,inst:t}),r}}),gm=A("$ZodAny",(t,e)=>{Se.init(t,e),t._zod.parse=r=>r}),vm=A("$ZodUnknown",(t,e)=>{Se.init(t,e),t._zod.parse=r=>r}),ym=A("$ZodNever",(t,e)=>{Se.init(t,e),t._zod.parse=(r,n)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:t}),r)});function Tc(t,e,r){t.issues.length&&e.issues.push(...Lt(r,t.issues)),e.value[r]=t.value}const wm=A("$ZodArray",(t,e)=>{Se.init(t,e),t._zod.parse=(r,n)=>{const s=r.value;if(!Array.isArray(s))return r.issues.push({expected:"array",code:"invalid_type",input:s,inst:t}),r;r.value=Array(s.length);const a=[];for(let i=0;i<s.length;i++){const o=s[i],c=e.element._zod.run({value:o,issues:[]},n);c instanceof Promise?a.push(c.then(l=>Tc(l,r,i))):Tc(c,r,i)}return a.length?Promise.all(a).then(()=>r):r}});function Jn(t,e,r){t.issues.length&&e.issues.push(...Lt(r,t.issues)),e.value[r]=t.value}function Rc(t,e,r,n){t.issues.length?n[r]===void 0?r in n?e.value[r]=void 0:e.value[r]=t.value:e.issues.push(...Lt(r,t.issues)):t.value===void 0?r in n&&(e.value[r]=void 0):e.value[r]=t.value}const Pc=A("$ZodObject",(t,e)=>{Se.init(t,e);const r=Qs(()=>{const f=Object.keys(e.shape);for(const v of f)if(!(e.shape[v]instanceof Se))throw new Error(`Invalid element at key "${v}": expected a Zod schema`);const y=Vf(e.shape);return{shape:e.shape,keys:f,keySet:new Set(f),numKeys:f.length,optionalKeys:new Set(y)}});ke(t._zod,"propValues",()=>{const f=e.shape,y={};for(const v in f){const p=f[v]._zod;if(p.values){y[v]??(y[v]=new Set);for(const w of p.values)y[v].add(w)}}return y});const n=f=>{const y=new Uh(["shape","payload","ctx"]),v=r.value,p=d=>{const m=$r(d);return`shape[${m}]._zod.run({ value: input[${m}], issues: [] }, ctx)`};y.write("const input = payload.value;");const w=Object.create(null);let h=0;for(const d of v.keys)w[d]=`key_${h++}`;y.write("const newResult = {}");for(const d of v.keys)if(v.optionalKeys.has(d)){const m=w[d];y.write(`const ${m} = ${p(d)};`);const b=$r(d);y.write(`
11
+ if (${m}.issues.length) {
12
+ if (input[${b}] === undefined) {
13
+ if (${b} in input) {
14
+ newResult[${b}] = undefined;
15
+ }
16
+ } else {
17
+ payload.issues = payload.issues.concat(
18
+ ${m}.issues.map((iss) => ({
19
+ ...iss,
20
+ path: iss.path ? [${b}, ...iss.path] : [${b}],
21
+ }))
22
+ );
23
+ }
24
+ } else if (${m}.value === undefined) {
25
+ if (${b} in input) newResult[${b}] = undefined;
26
+ } else {
27
+ newResult[${b}] = ${m}.value;
28
+ }
29
+ `)}else{const m=w[d];y.write(`const ${m} = ${p(d)};`),y.write(`
30
+ if (${m}.issues.length) payload.issues = payload.issues.concat(${m}.issues.map(iss => ({
31
+ ...iss,
32
+ path: iss.path ? [${$r(d)}, ...iss.path] : [${$r(d)}]
33
+ })));`),y.write(`newResult[${$r(d)}] = ${m}.value`)}y.write("payload.value = newResult;"),y.write("return payload;");const _=y.compile();return(d,m)=>_(f,d,m)};let s;const a=Vn,i=!cc.jitless,c=i&&Uf.value,l=e.catchall;let u;t._zod.parse=(f,y)=>{u??(u=r.value);const v=f.value;if(!a(v))return f.issues.push({expected:"object",code:"invalid_type",input:v,inst:t}),f;const p=[];if(i&&c&&y?.async===!1&&y.jitless!==!0)s||(s=n(e.shape)),f=s(f,y);else{f.value={};const m=u.shape;for(const b of u.keys){const g=m[b],S=g._zod.run({value:v[b],issues:[]},y),E=g._zod.optin==="optional"&&g._zod.optout==="optional";S instanceof Promise?p.push(S.then(N=>E?Rc(N,f,b,v):Jn(N,f,b))):E?Rc(S,f,b,v):Jn(S,f,b)}}if(!l)return p.length?Promise.all(p).then(()=>f):f;const w=[],h=u.keySet,_=l._zod,d=_.def.type;for(const m of Object.keys(v)){if(h.has(m))continue;if(d==="never"){w.push(m);continue}const b=_.run({value:v[m],issues:[]},y);b instanceof Promise?p.push(b.then(g=>Jn(g,f,m))):Jn(b,f,m)}return w.length&&f.issues.push({code:"unrecognized_keys",keys:w,input:v,inst:t}),p.length?Promise.all(p).then(()=>f):f}});function Cc(t,e,r,n){for(const s of t)if(s.issues.length===0)return e.value=s.value,e;return e.issues.push({code:"invalid_union",input:e.value,inst:r,errors:t.map(s=>s.issues.map(a=>Pt(a,n,Tt())))}),e}const Ic=A("$ZodUnion",(t,e)=>{Se.init(t,e),ke(t._zod,"optin",()=>e.options.some(r=>r._zod.optin==="optional")?"optional":void 0),ke(t._zod,"optout",()=>e.options.some(r=>r._zod.optout==="optional")?"optional":void 0),ke(t._zod,"values",()=>{if(e.options.every(r=>r._zod.values))return new Set(e.options.flatMap(r=>Array.from(r._zod.values)))}),ke(t._zod,"pattern",()=>{if(e.options.every(r=>r._zod.pattern)){const r=e.options.map(n=>n._zod.pattern);return new RegExp(`^(${r.map(n=>ea(n.source)).join("|")})$`)}}),t._zod.parse=(r,n)=>{let s=!1;const a=[];for(const i of e.options){const o=i._zod.run({value:r.value,issues:[]},n);if(o instanceof Promise)a.push(o),s=!0;else{if(o.issues.length===0)return o;a.push(o)}}return s?Promise.all(a).then(i=>Cc(i,r,t,n)):Cc(a,r,t,n)}}),bm=A("$ZodDiscriminatedUnion",(t,e)=>{Ic.init(t,e);const r=t._zod.parse;ke(t._zod,"propValues",()=>{const s={};for(const a of e.options){const i=a._zod.propValues;if(!i||Object.keys(i).length===0)throw new Error(`Invalid discriminated union option at index "${e.options.indexOf(a)}"`);for(const[o,c]of Object.entries(i)){s[o]||(s[o]=new Set);for(const l of c)s[o].add(l)}}return s});const n=Qs(()=>{const s=e.options,a=new Map;for(const i of s){const o=i._zod.propValues[e.discriminator];if(!o||o.size===0)throw new Error(`Invalid discriminated union option at index "${e.options.indexOf(i)}"`);for(const c of o){if(a.has(c))throw new Error(`Duplicate discriminator value "${String(c)}"`);a.set(c,i)}}return a});t._zod.parse=(s,a)=>{const i=s.value;if(!Vn(i))return s.issues.push({code:"invalid_type",expected:"object",input:i,inst:t}),s;const o=n.value.get(i?.[e.discriminator]);return o?o._zod.run(s,a):e.unionFallback?r(s,a):(s.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",input:i,path:[e.discriminator],inst:t}),s)}}),Sm=A("$ZodIntersection",(t,e)=>{Se.init(t,e),t._zod.parse=(r,n)=>{const s=r.value,a=e.left._zod.run({value:s,issues:[]},n),i=e.right._zod.run({value:s,issues:[]},n);return a instanceof Promise||i instanceof Promise?Promise.all([a,i]).then(([c,l])=>Oc(r,c,l)):Oc(r,a,i)}});function aa(t,e){if(t===e)return{valid:!0,data:t};if(t instanceof Date&&e instanceof Date&&+t==+e)return{valid:!0,data:t};if(Fn(t)&&Fn(e)){const r=Object.keys(e),n=Object.keys(t).filter(a=>r.indexOf(a)!==-1),s={...t,...e};for(const a of n){const i=aa(t[a],e[a]);if(!i.valid)return{valid:!1,mergeErrorPath:[a,...i.mergeErrorPath]};s[a]=i.data}return{valid:!0,data:s}}if(Array.isArray(t)&&Array.isArray(e)){if(t.length!==e.length)return{valid:!1,mergeErrorPath:[]};const r=[];for(let n=0;n<t.length;n++){const s=t[n],a=e[n],i=aa(s,a);if(!i.valid)return{valid:!1,mergeErrorPath:[n,...i.mergeErrorPath]};r.push(i.data)}return{valid:!0,data:r}}return{valid:!1,mergeErrorPath:[]}}function Oc(t,e,r){if(e.issues.length&&t.issues.push(...e.issues),r.issues.length&&t.issues.push(...r.issues),Tr(t))return t;const n=aa(e.value,r.value);if(!n.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(n.mergeErrorPath)}`);return t.value=n.data,t}const km=A("$ZodRecord",(t,e)=>{Se.init(t,e),t._zod.parse=(r,n)=>{const s=r.value;if(!Fn(s))return r.issues.push({expected:"record",code:"invalid_type",input:s,inst:t}),r;const a=[];if(e.keyType._zod.values){const i=e.keyType._zod.values;r.value={};for(const c of i)if(typeof c=="string"||typeof c=="number"||typeof c=="symbol"){const l=e.valueType._zod.run({value:s[c],issues:[]},n);l instanceof Promise?a.push(l.then(u=>{u.issues.length&&r.issues.push(...Lt(c,u.issues)),r.value[c]=u.value})):(l.issues.length&&r.issues.push(...Lt(c,l.issues)),r.value[c]=l.value)}let o;for(const c in s)i.has(c)||(o=o??[],o.push(c));o&&o.length>0&&r.issues.push({code:"unrecognized_keys",input:s,inst:t,keys:o})}else{r.value={};for(const i of Reflect.ownKeys(s)){if(i==="__proto__")continue;const o=e.keyType._zod.run({value:i,issues:[]},n);if(o instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(o.issues.length){r.issues.push({origin:"record",code:"invalid_key",issues:o.issues.map(l=>Pt(l,n,Tt())),input:i,path:[i],inst:t}),r.value[o.value]=o.value;continue}const c=e.valueType._zod.run({value:s[i],issues:[]},n);c instanceof Promise?a.push(c.then(l=>{l.issues.length&&r.issues.push(...Lt(i,l.issues)),r.value[o.value]=l.value})):(c.issues.length&&r.issues.push(...Lt(i,c.issues)),r.value[o.value]=c.value)}}return a.length?Promise.all(a).then(()=>r):r}}),$m=A("$ZodEnum",(t,e)=>{Se.init(t,e);const r=uc(e.entries);t._zod.values=new Set(r),t._zod.pattern=new RegExp(`^(${r.filter(n=>Df.has(typeof n)).map(n=>typeof n=="string"?Er(n):n.toString()).join("|")})$`),t._zod.parse=(n,s)=>{const a=n.value;return t._zod.values.has(a)||n.issues.push({code:"invalid_value",values:r,input:a,inst:t}),n}}),Em=A("$ZodLiteral",(t,e)=>{Se.init(t,e),t._zod.values=new Set(e.values),t._zod.pattern=new RegExp(`^(${e.values.map(r=>typeof r=="string"?Er(r):r?r.toString():String(r)).join("|")})$`),t._zod.parse=(r,n)=>{const s=r.value;return t._zod.values.has(s)||r.issues.push({code:"invalid_value",values:e.values,input:s,inst:t}),r}}),Tm=A("$ZodTransform",(t,e)=>{Se.init(t,e),t._zod.parse=(r,n)=>{const s=e.transform(r.value,r);if(n.async)return(s instanceof Promise?s:Promise.resolve(s)).then(i=>(r.value=i,r));if(s instanceof Promise)throw new Sr;return r.value=s,r}}),Rm=A("$ZodOptional",(t,e)=>{Se.init(t,e),t._zod.optin="optional",t._zod.optout="optional",ke(t._zod,"values",()=>e.innerType._zod.values?new Set([...e.innerType._zod.values,void 0]):void 0),ke(t._zod,"pattern",()=>{const r=e.innerType._zod.pattern;return r?new RegExp(`^(${ea(r.source)})?$`):void 0}),t._zod.parse=(r,n)=>e.innerType._zod.optin==="optional"?e.innerType._zod.run(r,n):r.value===void 0?r:e.innerType._zod.run(r,n)}),Pm=A("$ZodNullable",(t,e)=>{Se.init(t,e),ke(t._zod,"optin",()=>e.innerType._zod.optin),ke(t._zod,"optout",()=>e.innerType._zod.optout),ke(t._zod,"pattern",()=>{const r=e.innerType._zod.pattern;return r?new RegExp(`^(${ea(r.source)}|null)$`):void 0}),ke(t._zod,"values",()=>e.innerType._zod.values?new Set([...e.innerType._zod.values,null]):void 0),t._zod.parse=(r,n)=>r.value===null?r:e.innerType._zod.run(r,n)}),Cm=A("$ZodDefault",(t,e)=>{Se.init(t,e),t._zod.optin="optional",ke(t._zod,"values",()=>e.innerType._zod.values),t._zod.parse=(r,n)=>{if(r.value===void 0)return r.value=e.defaultValue,r;const s=e.innerType._zod.run(r,n);return s instanceof Promise?s.then(a=>Nc(a,e)):Nc(s,e)}});function Nc(t,e){return t.value===void 0&&(t.value=e.defaultValue),t}const Im=A("$ZodPrefault",(t,e)=>{Se.init(t,e),t._zod.optin="optional",ke(t._zod,"values",()=>e.innerType._zod.values),t._zod.parse=(r,n)=>(r.value===void 0&&(r.value=e.defaultValue),e.innerType._zod.run(r,n))}),Om=A("$ZodNonOptional",(t,e)=>{Se.init(t,e),ke(t._zod,"values",()=>{const r=e.innerType._zod.values;return r?new Set([...r].filter(n=>n!==void 0)):void 0}),t._zod.parse=(r,n)=>{const s=e.innerType._zod.run(r,n);return s instanceof Promise?s.then(a=>Ac(a,t)):Ac(s,t)}});function Ac(t,e){return!t.issues.length&&t.value===void 0&&t.issues.push({code:"invalid_type",expected:"nonoptional",input:t.value,inst:e}),t}const Nm=A("$ZodCatch",(t,e)=>{Se.init(t,e),t._zod.optin="optional",ke(t._zod,"optout",()=>e.innerType._zod.optout),ke(t._zod,"values",()=>e.innerType._zod.values),t._zod.parse=(r,n)=>{const s=e.innerType._zod.run(r,n);return s instanceof Promise?s.then(a=>(r.value=a.value,a.issues.length&&(r.value=e.catchValue({...r,error:{issues:a.issues.map(i=>Pt(i,n,Tt()))},input:r.value}),r.issues=[]),r)):(r.value=s.value,s.issues.length&&(r.value=e.catchValue({...r,error:{issues:s.issues.map(a=>Pt(a,n,Tt()))},input:r.value}),r.issues=[]),r)}}),Am=A("$ZodPipe",(t,e)=>{Se.init(t,e),ke(t._zod,"values",()=>e.in._zod.values),ke(t._zod,"optin",()=>e.in._zod.optin),ke(t._zod,"optout",()=>e.out._zod.optout),t._zod.parse=(r,n)=>{const s=e.in._zod.run(r,n);return s instanceof Promise?s.then(a=>jc(a,e,n)):jc(s,e,n)}});function jc(t,e,r){return Tr(t)?t:e.out._zod.run({value:t.value,issues:t.issues},r)}const jm=A("$ZodReadonly",(t,e)=>{Se.init(t,e),ke(t._zod,"propValues",()=>e.innerType._zod.propValues),ke(t._zod,"values",()=>e.innerType._zod.values),ke(t._zod,"optin",()=>e.innerType._zod.optin),ke(t._zod,"optout",()=>e.innerType._zod.optout),t._zod.parse=(r,n)=>{const s=e.innerType._zod.run(r,n);return s instanceof Promise?s.then(zc):zc(s)}});function zc(t){return t.value=Object.freeze(t.value),t}const zm=A("$ZodCustom",(t,e)=>{Ke.init(t,e),Se.init(t,e),t._zod.parse=(r,n)=>r,t._zod.check=r=>{const n=r.value,s=e.fn(n);if(s instanceof Promise)return s.then(a=>Mc(a,r,n,t));Mc(s,r,n,t)}});function Mc(t,e,r,n){if(!t){const s={code:"custom",input:r,inst:n,path:[...n._zod.def.path??[]],continue:!n._zod.def.abort};n._zod.def.params&&(s.params=n._zod.def.params),e.issues.push(Rr(s))}}class qc{constructor(){this._map=new Map,this._idmap=new Map}add(e,...r){const n=r[0];if(this._map.set(e,n),n&&typeof n=="object"&&"id"in n){if(this._idmap.has(n.id))throw new Error(`ID ${n.id} already exists in the registry`);this._idmap.set(n.id,e)}return this}clear(){return this._map=new Map,this._idmap=new Map,this}remove(e){const r=this._map.get(e);return r&&typeof r=="object"&&"id"in r&&this._idmap.delete(r.id),this._map.delete(e),this}get(e){const r=e._zod.parent;if(r){const n={...this.get(r)??{}};return delete n.id,{...n,...this._map.get(e)}}return this._map.get(e)}has(e){return this._map.has(e)}}function Mm(){return new qc}const Pr=Mm();function qm(t,e){return new t({type:"string",...Q(e)})}function Zm(t,e){return new t({type:"string",format:"email",check:"string_format",abort:!1,...Q(e)})}function Zc(t,e){return new t({type:"string",format:"guid",check:"string_format",abort:!1,...Q(e)})}function xm(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,...Q(e)})}function Lm(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...Q(e)})}function Um(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...Q(e)})}function Dm(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...Q(e)})}function xc(t,e){return new t({type:"string",format:"url",check:"string_format",abort:!1,...Q(e)})}function Vm(t,e){return new t({type:"string",format:"emoji",check:"string_format",abort:!1,...Q(e)})}function Fm(t,e){return new t({type:"string",format:"nanoid",check:"string_format",abort:!1,...Q(e)})}function Hm(t,e){return new t({type:"string",format:"cuid",check:"string_format",abort:!1,...Q(e)})}function Wm(t,e){return new t({type:"string",format:"cuid2",check:"string_format",abort:!1,...Q(e)})}function Km(t,e){return new t({type:"string",format:"ulid",check:"string_format",abort:!1,...Q(e)})}function Jm(t,e){return new t({type:"string",format:"xid",check:"string_format",abort:!1,...Q(e)})}function Gm(t,e){return new t({type:"string",format:"ksuid",check:"string_format",abort:!1,...Q(e)})}function Bm(t,e){return new t({type:"string",format:"ipv4",check:"string_format",abort:!1,...Q(e)})}function Ym(t,e){return new t({type:"string",format:"ipv6",check:"string_format",abort:!1,...Q(e)})}function Qm(t,e){return new t({type:"string",format:"cidrv4",check:"string_format",abort:!1,...Q(e)})}function Xm(t,e){return new t({type:"string",format:"cidrv6",check:"string_format",abort:!1,...Q(e)})}function ep(t,e){return new t({type:"string",format:"base64",check:"string_format",abort:!1,...Q(e)})}function tp(t,e){return new t({type:"string",format:"base64url",check:"string_format",abort:!1,...Q(e)})}function rp(t,e){return new t({type:"string",format:"e164",check:"string_format",abort:!1,...Q(e)})}function np(t,e){return new t({type:"string",format:"jwt",check:"string_format",abort:!1,...Q(e)})}function sp(t,e){return new t({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...Q(e)})}function ap(t,e){return new t({type:"string",format:"date",check:"string_format",...Q(e)})}function ip(t,e){return new t({type:"string",format:"time",check:"string_format",precision:null,...Q(e)})}function op(t,e){return new t({type:"string",format:"duration",check:"string_format",...Q(e)})}function cp(t,e){return new t({type:"number",checks:[],...Q(e)})}function up(t,e){return new t({type:"number",coerce:!0,checks:[],...Q(e)})}function lp(t,e){return new t({type:"number",check:"number_format",abort:!1,format:"safeint",...Q(e)})}function dp(t,e){return new t({type:"boolean",...Q(e)})}function fp(t,e){return new t({type:"null",...Q(e)})}function hp(t){return new t({type:"any"})}function mp(t){return new t({type:"unknown"})}function pp(t,e){return new t({type:"never",...Q(e)})}function Lc(t,e){return new Sc({check:"less_than",...Q(e),value:t,inclusive:!1})}function ia(t,e){return new Sc({check:"less_than",...Q(e),value:t,inclusive:!0})}function Uc(t,e){return new kc({check:"greater_than",...Q(e),value:t,inclusive:!1})}function oa(t,e){return new kc({check:"greater_than",...Q(e),value:t,inclusive:!0})}function Dc(t,e){return new Ch({check:"multiple_of",...Q(e),value:t})}function Vc(t,e){return new Oh({check:"max_length",...Q(e),maximum:t})}function Gn(t,e){return new Nh({check:"min_length",...Q(e),minimum:t})}function Fc(t,e){return new Ah({check:"length_equals",...Q(e),length:t})}function _p(t,e){return new jh({check:"string_format",format:"regex",...Q(e),pattern:t})}function gp(t){return new zh({check:"string_format",format:"lowercase",...Q(t)})}function vp(t){return new Mh({check:"string_format",format:"uppercase",...Q(t)})}function yp(t,e){return new qh({check:"string_format",format:"includes",...Q(e),includes:t})}function wp(t,e){return new Zh({check:"string_format",format:"starts_with",...Q(e),prefix:t})}function bp(t,e){return new xh({check:"string_format",format:"ends_with",...Q(e),suffix:t})}function Cr(t){return new Lh({check:"overwrite",tx:t})}function Sp(t){return Cr(e=>e.normalize(t))}function kp(){return Cr(t=>t.trim())}function $p(){return Cr(t=>t.toLowerCase())}function Ep(){return Cr(t=>t.toUpperCase())}function Tp(t,e,r){return new t({type:"array",element:e,...Q(r)})}function Rp(t,e,r){const n=Q(r);return n.abort??(n.abort=!0),new t({type:"custom",check:"custom",fn:e,...n})}function Pp(t,e,r){return new t({type:"custom",check:"custom",fn:e,...Q(r)})}class Hc{constructor(e){this.counter=0,this.metadataRegistry=e?.metadata??Pr,this.target=e?.target??"draft-2020-12",this.unrepresentable=e?.unrepresentable??"throw",this.override=e?.override??(()=>{}),this.io=e?.io??"output",this.seen=new Map}process(e,r={path:[],schemaPath:[]}){var n;const s=e._zod.def,a={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},i=this.seen.get(e);if(i)return i.count++,r.schemaPath.includes(e)&&(i.cycle=r.path),i.schema;const o={schema:{},count:1,cycle:void 0,path:r.path};this.seen.set(e,o);const c=e._zod.toJSONSchema?.();if(c)o.schema=c;else{const f={...r,schemaPath:[...r.schemaPath,e],path:r.path},y=e._zod.parent;if(y)o.ref=y,this.process(y,f),this.seen.get(y).isParent=!0;else{const v=o.schema;switch(s.type){case"string":{const p=v;p.type="string";const{minimum:w,maximum:h,format:_,patterns:d,contentEncoding:m}=e._zod.bag;if(typeof w=="number"&&(p.minLength=w),typeof h=="number"&&(p.maxLength=h),_&&(p.format=a[_]??_,p.format===""&&delete p.format),m&&(p.contentEncoding=m),d&&d.size>0){const b=[...d];b.length===1?p.pattern=b[0].source:b.length>1&&(o.schema.allOf=[...b.map(g=>({...this.target==="draft-7"?{type:"string"}:{},pattern:g.source}))])}break}case"number":{const p=v,{minimum:w,maximum:h,format:_,multipleOf:d,exclusiveMaximum:m,exclusiveMinimum:b}=e._zod.bag;typeof _=="string"&&_.includes("int")?p.type="integer":p.type="number",typeof b=="number"&&(p.exclusiveMinimum=b),typeof w=="number"&&(p.minimum=w,typeof b=="number"&&(b>=w?delete p.minimum:delete p.exclusiveMinimum)),typeof m=="number"&&(p.exclusiveMaximum=m),typeof h=="number"&&(p.maximum=h,typeof m=="number"&&(m<=h?delete p.maximum:delete p.exclusiveMaximum)),typeof d=="number"&&(p.multipleOf=d);break}case"boolean":{const p=v;p.type="boolean";break}case"bigint":{if(this.unrepresentable==="throw")throw new Error("BigInt cannot be represented in JSON Schema");break}case"symbol":{if(this.unrepresentable==="throw")throw new Error("Symbols cannot be represented in JSON Schema");break}case"null":{v.type="null";break}case"any":break;case"unknown":break;case"undefined":{if(this.unrepresentable==="throw")throw new Error("Undefined cannot be represented in JSON Schema");break}case"void":{if(this.unrepresentable==="throw")throw new Error("Void cannot be represented in JSON Schema");break}case"never":{v.not={};break}case"date":{if(this.unrepresentable==="throw")throw new Error("Date cannot be represented in JSON Schema");break}case"array":{const p=v,{minimum:w,maximum:h}=e._zod.bag;typeof w=="number"&&(p.minItems=w),typeof h=="number"&&(p.maxItems=h),p.type="array",p.items=this.process(s.element,{...f,path:[...f.path,"items"]});break}case"object":{const p=v;p.type="object",p.properties={};const w=s.shape;for(const d in w)p.properties[d]=this.process(w[d],{...f,path:[...f.path,"properties",d]});const h=new Set(Object.keys(w)),_=new Set([...h].filter(d=>{const m=s.shape[d]._zod;return this.io==="input"?m.optin===void 0:m.optout===void 0}));_.size>0&&(p.required=Array.from(_)),s.catchall?._zod.def.type==="never"?p.additionalProperties=!1:s.catchall?s.catchall&&(p.additionalProperties=this.process(s.catchall,{...f,path:[...f.path,"additionalProperties"]})):this.io==="output"&&(p.additionalProperties=!1);break}case"union":{const p=v;p.anyOf=s.options.map((w,h)=>this.process(w,{...f,path:[...f.path,"anyOf",h]}));break}case"intersection":{const p=v,w=this.process(s.left,{...f,path:[...f.path,"allOf",0]}),h=this.process(s.right,{...f,path:[...f.path,"allOf",1]}),_=m=>"allOf"in m&&Object.keys(m).length===1,d=[..._(w)?w.allOf:[w],..._(h)?h.allOf:[h]];p.allOf=d;break}case"tuple":{const p=v;p.type="array";const w=s.items.map((d,m)=>this.process(d,{...f,path:[...f.path,"prefixItems",m]}));if(this.target==="draft-2020-12"?p.prefixItems=w:p.items=w,s.rest){const d=this.process(s.rest,{...f,path:[...f.path,"items"]});this.target==="draft-2020-12"?p.items=d:p.additionalItems=d}s.rest&&(p.items=this.process(s.rest,{...f,path:[...f.path,"items"]}));const{minimum:h,maximum:_}=e._zod.bag;typeof h=="number"&&(p.minItems=h),typeof _=="number"&&(p.maxItems=_);break}case"record":{const p=v;p.type="object",p.propertyNames=this.process(s.keyType,{...f,path:[...f.path,"propertyNames"]}),p.additionalProperties=this.process(s.valueType,{...f,path:[...f.path,"additionalProperties"]});break}case"map":{if(this.unrepresentable==="throw")throw new Error("Map cannot be represented in JSON Schema");break}case"set":{if(this.unrepresentable==="throw")throw new Error("Set cannot be represented in JSON Schema");break}case"enum":{const p=v,w=uc(s.entries);w.every(h=>typeof h=="number")&&(p.type="number"),w.every(h=>typeof h=="string")&&(p.type="string"),p.enum=w;break}case"literal":{const p=v,w=[];for(const h of s.values)if(h===void 0){if(this.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof h=="bigint"){if(this.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");w.push(Number(h))}else w.push(h);if(w.length!==0)if(w.length===1){const h=w[0];p.type=h===null?"null":typeof h,p.const=h}else w.every(h=>typeof h=="number")&&(p.type="number"),w.every(h=>typeof h=="string")&&(p.type="string"),w.every(h=>typeof h=="boolean")&&(p.type="string"),w.every(h=>h===null)&&(p.type="null"),p.enum=w;break}case"file":{const p=v,w={type:"string",format:"binary",contentEncoding:"binary"},{minimum:h,maximum:_,mime:d}=e._zod.bag;h!==void 0&&(w.minLength=h),_!==void 0&&(w.maxLength=_),d?d.length===1?(w.contentMediaType=d[0],Object.assign(p,w)):p.anyOf=d.map(m=>({...w,contentMediaType:m})):Object.assign(p,w);break}case"transform":{if(this.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema");break}case"nullable":{const p=this.process(s.innerType,f);v.anyOf=[p,{type:"null"}];break}case"nonoptional":{this.process(s.innerType,f),o.ref=s.innerType;break}case"success":{const p=v;p.type="boolean";break}case"default":{this.process(s.innerType,f),o.ref=s.innerType,v.default=JSON.parse(JSON.stringify(s.defaultValue));break}case"prefault":{this.process(s.innerType,f),o.ref=s.innerType,this.io==="input"&&(v._prefault=JSON.parse(JSON.stringify(s.defaultValue)));break}case"catch":{this.process(s.innerType,f),o.ref=s.innerType;let p;try{p=s.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}v.default=p;break}case"nan":{if(this.unrepresentable==="throw")throw new Error("NaN cannot be represented in JSON Schema");break}case"template_literal":{const p=v,w=e._zod.pattern;if(!w)throw new Error("Pattern not found in template literal");p.type="string",p.pattern=w.source;break}case"pipe":{const p=this.io==="input"?s.in._zod.def.type==="transform"?s.out:s.in:s.out;this.process(p,f),o.ref=p;break}case"readonly":{this.process(s.innerType,f),o.ref=s.innerType,v.readOnly=!0;break}case"promise":{this.process(s.innerType,f),o.ref=s.innerType;break}case"optional":{this.process(s.innerType,f),o.ref=s.innerType;break}case"lazy":{const p=e._zod.innerType;this.process(p,f),o.ref=p;break}case"custom":{if(this.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema");break}}}}const l=this.metadataRegistry.get(e);return l&&Object.assign(o.schema,l),this.io==="input"&&Oe(e)&&(delete o.schema.examples,delete o.schema.default),this.io==="input"&&o.schema._prefault&&((n=o.schema).default??(n.default=o.schema._prefault)),delete o.schema._prefault,this.seen.get(e).schema}emit(e,r){const n={cycles:r?.cycles??"ref",reused:r?.reused??"inline",external:r?.external??void 0},s=this.seen.get(e);if(!s)throw new Error("Unprocessed schema. This is a bug in Zod.");const a=u=>{const f=this.target==="draft-2020-12"?"$defs":"definitions";if(n.external){const w=n.external.registry.get(u[0])?.id,h=n.external.uri??(d=>d);if(w)return{ref:h(w)};const _=u[1].defId??u[1].schema.id??`schema${this.counter++}`;return u[1].defId=_,{defId:_,ref:`${h("__shared")}#/${f}/${_}`}}if(u[1]===s)return{ref:"#"};const v=`#/${f}/`,p=u[1].schema.id??`__schema${this.counter++}`;return{defId:p,ref:v+p}},i=u=>{if(u[1].schema.$ref)return;const f=u[1],{ref:y,defId:v}=a(u);f.def={...f.schema},v&&(f.defId=v);const p=f.schema;for(const w in p)delete p[w];p.$ref=y};if(n.cycles==="throw")for(const u of this.seen.entries()){const f=u[1];if(f.cycle)throw new Error(`Cycle detected: #/${f.cycle?.join("/")}/<root>
34
+
35
+ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const u of this.seen.entries()){const f=u[1];if(e===u[0]){i(u);continue}if(n.external){const v=n.external.registry.get(u[0])?.id;if(e!==u[0]&&v){i(u);continue}}if(this.metadataRegistry.get(u[0])?.id){i(u);continue}if(f.cycle){i(u);continue}if(f.count>1&&n.reused==="ref"){i(u);continue}}const o=(u,f)=>{const y=this.seen.get(u),v=y.def??y.schema,p={...v};if(y.ref===null)return;const w=y.ref;if(y.ref=null,w){o(w,f);const h=this.seen.get(w).schema;h.$ref&&f.target==="draft-7"?(v.allOf=v.allOf??[],v.allOf.push(h)):(Object.assign(v,h),Object.assign(v,p))}y.isParent||this.override({zodSchema:u,jsonSchema:v,path:y.path??[]})};for(const u of[...this.seen.entries()].reverse())o(u[0],{target:this.target});const c={};if(this.target==="draft-2020-12"?c.$schema="https://json-schema.org/draft/2020-12/schema":this.target==="draft-7"?c.$schema="http://json-schema.org/draft-07/schema#":console.warn(`Invalid target: ${this.target}`),n.external?.uri){const u=n.external.registry.get(e)?.id;if(!u)throw new Error("Schema is missing an `id` property");c.$id=n.external.uri(u)}Object.assign(c,s.def);const l=n.external?.defs??{};for(const u of this.seen.entries()){const f=u[1];f.def&&f.defId&&(l[f.defId]=f.def)}n.external||Object.keys(l).length>0&&(this.target==="draft-2020-12"?c.$defs=l:c.definitions=l);try{return JSON.parse(JSON.stringify(c))}catch{throw new Error("Error converting schema to JSON.")}}}function Cp(t,e){if(t instanceof qc){const n=new Hc(e),s={};for(const o of t._idmap.entries()){const[c,l]=o;n.process(l)}const a={},i={registry:t,uri:e?.uri,defs:s};for(const o of t._idmap.entries()){const[c,l]=o;a[c]=n.emit(l,{...e,external:i})}if(Object.keys(s).length>0){const o=n.target==="draft-2020-12"?"$defs":"definitions";a.__shared={[o]:s}}return{schemas:a}}const r=new Hc(e);return r.process(t),r.emit(t,e)}function Oe(t,e){const r=e??{seen:new Set};if(r.seen.has(t))return!1;r.seen.add(t);const s=t._zod.def;switch(s.type){case"string":case"number":case"bigint":case"boolean":case"date":case"symbol":case"undefined":case"null":case"any":case"unknown":case"never":case"void":case"literal":case"enum":case"nan":case"file":case"template_literal":return!1;case"array":return Oe(s.element,r);case"object":{for(const a in s.shape)if(Oe(s.shape[a],r))return!0;return!1}case"union":{for(const a of s.options)if(Oe(a,r))return!0;return!1}case"intersection":return Oe(s.left,r)||Oe(s.right,r);case"tuple":{for(const a of s.items)if(Oe(a,r))return!0;return!!(s.rest&&Oe(s.rest,r))}case"record":return Oe(s.keyType,r)||Oe(s.valueType,r);case"map":return Oe(s.keyType,r)||Oe(s.valueType,r);case"set":return Oe(s.valueType,r);case"promise":case"optional":case"nonoptional":case"nullable":case"readonly":return Oe(s.innerType,r);case"lazy":return Oe(s.getter(),r);case"default":return Oe(s.innerType,r);case"prefault":return Oe(s.innerType,r);case"custom":return!1;case"transform":return!0;case"pipe":return Oe(s.in,r)||Oe(s.out,r);case"success":return!1;case"catch":return!1}throw new Error(`Unknown schema type: ${s.type}`)}const Ip=A("ZodISODateTime",(t,e)=>{em.init(t,e),Ce.init(t,e)});function Wc(t){return sp(Ip,t)}const Op=A("ZodISODate",(t,e)=>{tm.init(t,e),Ce.init(t,e)});function Np(t){return ap(Op,t)}const Ap=A("ZodISOTime",(t,e)=>{rm.init(t,e),Ce.init(t,e)});function jp(t){return ip(Ap,t)}const zp=A("ZodISODuration",(t,e)=>{nm.init(t,e),Ce.init(t,e)});function Mp(t){return op(zp,t)}const Bn=A("ZodError",(t,e)=>{fc.init(t,e),t.name="ZodError",Object.defineProperties(t,{format:{value:r=>Qf(t,r)},flatten:{value:r=>Yf(t,r)},addIssue:{value:r=>t.issues.push(r)},addIssues:{value:r=>t.issues.push(...r)},isEmpty:{get(){return t.issues.length===0}}})},{Parent:Error}),qp=hc(Bn),Zp=mc(Bn),xp=pc(Bn),Lp=_c(Bn),Ee=A("ZodType",(t,e)=>(Se.init(t,e),t.def=e,Object.defineProperty(t,"_def",{value:e}),t.check=(...r)=>t.clone({...e,checks:[...e.checks??[],...r.map(n=>typeof n=="function"?{_zod:{check:n,def:{check:"custom"},onattach:[]}}:n)]}),t.clone=(r,n)=>Rt(t,r,n),t.brand=()=>t,t.register=((r,n)=>(r.add(t,n),t)),t.parse=(r,n)=>qp(t,r,n,{callee:t.parse}),t.safeParse=(r,n)=>xp(t,r,n),t.parseAsync=async(r,n)=>Zp(t,r,n,{callee:t.parseAsync}),t.safeParseAsync=async(r,n)=>Lp(t,r,n),t.spa=t.safeParseAsync,t.refine=(r,n)=>t.check(N_(r,n)),t.superRefine=r=>t.check(A_(r)),t.overwrite=r=>t.check(Cr(r)),t.optional=()=>re(t),t.nullable=()=>nu(t),t.nullish=()=>re(nu(t)),t.nonoptional=r=>$_(t,r),t.array=()=>W(t),t.or=r=>Re([t,r]),t.and=r=>ua(t,r),t.transform=r=>da(t,tu(r)),t.default=r=>b_(t,r),t.prefault=r=>k_(t,r),t.catch=r=>T_(t,r),t.pipe=r=>da(t,r),t.readonly=()=>C_(t),t.describe=r=>{const n=t.clone();return Pr.add(n,{description:r}),n},Object.defineProperty(t,"description",{get(){return Pr.get(t)?.description},configurable:!0}),t.meta=(...r)=>{if(r.length===0)return Pr.get(t);const n=t.clone();return Pr.add(n,r[0]),n},t.isOptional=()=>t.safeParse(void 0).success,t.isNullable=()=>t.safeParse(null).success,t)),Kc=A("_ZodString",(t,e)=>{sa.init(t,e),Ee.init(t,e);const r=t._zod.bag;t.format=r.format??null,t.minLength=r.minimum??null,t.maxLength=r.maximum??null,t.regex=(...n)=>t.check(_p(...n)),t.includes=(...n)=>t.check(yp(...n)),t.startsWith=(...n)=>t.check(wp(...n)),t.endsWith=(...n)=>t.check(bp(...n)),t.min=(...n)=>t.check(Gn(...n)),t.max=(...n)=>t.check(Vc(...n)),t.length=(...n)=>t.check(Fc(...n)),t.nonempty=(...n)=>t.check(Gn(1,...n)),t.lowercase=n=>t.check(gp(n)),t.uppercase=n=>t.check(vp(n)),t.trim=()=>t.check(kp()),t.normalize=(...n)=>t.check(Sp(...n)),t.toLowerCase=()=>t.check($p()),t.toUpperCase=()=>t.check(Ep())}),Up=A("ZodString",(t,e)=>{sa.init(t,e),Kc.init(t,e),t.email=r=>t.check(Zm(Dp,r)),t.url=r=>t.check(xc(Gc,r)),t.jwt=r=>t.check(np(s_,r)),t.emoji=r=>t.check(Vm(Fp,r)),t.guid=r=>t.check(Zc(Jc,r)),t.uuid=r=>t.check(xm(Yn,r)),t.uuidv4=r=>t.check(Lm(Yn,r)),t.uuidv6=r=>t.check(Um(Yn,r)),t.uuidv7=r=>t.check(Dm(Yn,r)),t.nanoid=r=>t.check(Fm(Hp,r)),t.guid=r=>t.check(Zc(Jc,r)),t.cuid=r=>t.check(Hm(Wp,r)),t.cuid2=r=>t.check(Wm(Kp,r)),t.ulid=r=>t.check(Km(Jp,r)),t.base64=r=>t.check(ep(t_,r)),t.base64url=r=>t.check(tp(r_,r)),t.xid=r=>t.check(Jm(Gp,r)),t.ksuid=r=>t.check(Gm(Bp,r)),t.ipv4=r=>t.check(Bm(Yp,r)),t.ipv6=r=>t.check(Ym(Qp,r)),t.cidrv4=r=>t.check(Qm(Xp,r)),t.cidrv6=r=>t.check(Xm(e_,r)),t.e164=r=>t.check(rp(n_,r)),t.datetime=r=>t.check(Wc(r)),t.date=r=>t.check(Np(r)),t.time=r=>t.check(jp(r)),t.duration=r=>t.check(Mp(r))});function R(t){return qm(Up,t)}const Ce=A("ZodStringFormat",(t,e)=>{$e.init(t,e),Kc.init(t,e)}),Dp=A("ZodEmail",(t,e)=>{Hh.init(t,e),Ce.init(t,e)}),Jc=A("ZodGUID",(t,e)=>{Vh.init(t,e),Ce.init(t,e)}),Yn=A("ZodUUID",(t,e)=>{Fh.init(t,e),Ce.init(t,e)}),Gc=A("ZodURL",(t,e)=>{Wh.init(t,e),Ce.init(t,e)});function Vp(t){return xc(Gc,t)}const Fp=A("ZodEmoji",(t,e)=>{Kh.init(t,e),Ce.init(t,e)}),Hp=A("ZodNanoID",(t,e)=>{Jh.init(t,e),Ce.init(t,e)}),Wp=A("ZodCUID",(t,e)=>{Gh.init(t,e),Ce.init(t,e)}),Kp=A("ZodCUID2",(t,e)=>{Bh.init(t,e),Ce.init(t,e)}),Jp=A("ZodULID",(t,e)=>{Yh.init(t,e),Ce.init(t,e)}),Gp=A("ZodXID",(t,e)=>{Qh.init(t,e),Ce.init(t,e)}),Bp=A("ZodKSUID",(t,e)=>{Xh.init(t,e),Ce.init(t,e)}),Yp=A("ZodIPv4",(t,e)=>{sm.init(t,e),Ce.init(t,e)}),Qp=A("ZodIPv6",(t,e)=>{am.init(t,e),Ce.init(t,e)}),Xp=A("ZodCIDRv4",(t,e)=>{im.init(t,e),Ce.init(t,e)}),e_=A("ZodCIDRv6",(t,e)=>{om.init(t,e),Ce.init(t,e)}),t_=A("ZodBase64",(t,e)=>{cm.init(t,e),Ce.init(t,e)}),r_=A("ZodBase64URL",(t,e)=>{lm.init(t,e),Ce.init(t,e)}),n_=A("ZodE164",(t,e)=>{dm.init(t,e),Ce.init(t,e)}),s_=A("ZodJWT",(t,e)=>{hm.init(t,e),Ce.init(t,e)}),ca=A("ZodNumber",(t,e)=>{Ec.init(t,e),Ee.init(t,e),t.gt=(n,s)=>t.check(Uc(n,s)),t.gte=(n,s)=>t.check(oa(n,s)),t.min=(n,s)=>t.check(oa(n,s)),t.lt=(n,s)=>t.check(Lc(n,s)),t.lte=(n,s)=>t.check(ia(n,s)),t.max=(n,s)=>t.check(ia(n,s)),t.int=n=>t.check(Bc(n)),t.safe=n=>t.check(Bc(n)),t.positive=n=>t.check(Uc(0,n)),t.nonnegative=n=>t.check(oa(0,n)),t.negative=n=>t.check(Lc(0,n)),t.nonpositive=n=>t.check(ia(0,n)),t.multipleOf=(n,s)=>t.check(Dc(n,s)),t.step=(n,s)=>t.check(Dc(n,s)),t.finite=()=>t;const r=t._zod.bag;t.minValue=Math.max(r.minimum??Number.NEGATIVE_INFINITY,r.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,t.maxValue=Math.min(r.maximum??Number.POSITIVE_INFINITY,r.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,t.isInt=(r.format??"").includes("int")||Number.isSafeInteger(r.multipleOf??.5),t.isFinite=!0,t.format=r.format??null});function we(t){return cp(ca,t)}const a_=A("ZodNumberFormat",(t,e)=>{mm.init(t,e),ca.init(t,e)});function Bc(t){return lp(a_,t)}const i_=A("ZodBoolean",(t,e)=>{pm.init(t,e),Ee.init(t,e)});function Te(t){return dp(i_,t)}const o_=A("ZodNull",(t,e)=>{_m.init(t,e),Ee.init(t,e)});function Yc(t){return fp(o_,t)}const c_=A("ZodAny",(t,e)=>{gm.init(t,e),Ee.init(t,e)});function u_(){return hp(c_)}const l_=A("ZodUnknown",(t,e)=>{vm.init(t,e),Ee.init(t,e)});function Ne(){return mp(l_)}const d_=A("ZodNever",(t,e)=>{ym.init(t,e),Ee.init(t,e)});function f_(t){return pp(d_,t)}const h_=A("ZodArray",(t,e)=>{wm.init(t,e),Ee.init(t,e),t.element=e.element,t.min=(r,n)=>t.check(Gn(r,n)),t.nonempty=r=>t.check(Gn(1,r)),t.max=(r,n)=>t.check(Vc(r,n)),t.length=(r,n)=>t.check(Fc(r,n)),t.unwrap=()=>t.element});function W(t,e){return Tp(h_,t,e)}const Qc=A("ZodObject",(t,e)=>{Pc.init(t,e),Ee.init(t,e),ke(t,"shape",()=>e.shape),t.keyof=()=>De(Object.keys(t._zod.def.shape)),t.catchall=r=>t.clone({...t._zod.def,catchall:r}),t.passthrough=()=>t.clone({...t._zod.def,catchall:Ne()}),t.loose=()=>t.clone({...t._zod.def,catchall:Ne()}),t.strict=()=>t.clone({...t._zod.def,catchall:f_()}),t.strip=()=>t.clone({...t._zod.def,catchall:void 0}),t.extend=r=>Kf(t,r),t.merge=r=>Jf(t,r),t.pick=r=>Hf(t,r),t.omit=r=>Wf(t,r),t.partial=(...r)=>Gf(ru,t,r[0]),t.required=(...r)=>Bf(su,t,r[0])});function x(t,e){const r={type:"object",get shape(){return kr(this,"shape",{...t}),this.shape},...Q(e)};return new Qc(r)}function Je(t,e){return new Qc({type:"object",get shape(){return kr(this,"shape",{...t}),this.shape},catchall:Ne(),...Q(e)})}const Xc=A("ZodUnion",(t,e)=>{Ic.init(t,e),Ee.init(t,e),t.options=e.options});function Re(t,e){return new Xc({type:"union",options:t,...Q(e)})}const m_=A("ZodDiscriminatedUnion",(t,e)=>{Xc.init(t,e),bm.init(t,e)});function eu(t,e,r){return new m_({type:"union",options:e,discriminator:t,...Q(r)})}const p_=A("ZodIntersection",(t,e)=>{Sm.init(t,e),Ee.init(t,e)});function ua(t,e){return new p_({type:"intersection",left:t,right:e})}const __=A("ZodRecord",(t,e)=>{km.init(t,e),Ee.init(t,e),t.keyType=e.keyType,t.valueType=e.valueType});function Ae(t,e,r){return new __({type:"record",keyType:t,valueType:e,...Q(r)})}const la=A("ZodEnum",(t,e)=>{$m.init(t,e),Ee.init(t,e),t.enum=e.entries,t.options=Object.values(e.entries);const r=new Set(Object.keys(e.entries));t.extract=(n,s)=>{const a={};for(const i of n)if(r.has(i))a[i]=e.entries[i];else throw new Error(`Key ${i} not found in enum`);return new la({...e,checks:[],...Q(s),entries:a})},t.exclude=(n,s)=>{const a={...e.entries};for(const i of n)if(r.has(i))delete a[i];else throw new Error(`Key ${i} not found in enum`);return new la({...e,checks:[],...Q(s),entries:a})}});function De(t,e){const r=Array.isArray(t)?Object.fromEntries(t.map(n=>[n,n])):t;return new la({type:"enum",entries:r,...Q(e)})}const g_=A("ZodLiteral",(t,e)=>{Em.init(t,e),Ee.init(t,e),t.values=new Set(e.values),Object.defineProperty(t,"value",{get(){if(e.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return e.values[0]}})});function te(t,e){return new g_({type:"literal",values:Array.isArray(t)?t:[t],...Q(e)})}const v_=A("ZodTransform",(t,e)=>{Tm.init(t,e),Ee.init(t,e),t._zod.parse=(r,n)=>{r.addIssue=a=>{if(typeof a=="string")r.issues.push(Rr(a,r.value,e));else{const i=a;i.fatal&&(i.continue=!1),i.code??(i.code="custom"),i.input??(i.input=r.value),i.inst??(i.inst=t),i.continue??(i.continue=!0),r.issues.push(Rr(i))}};const s=e.transform(r.value,r);return s instanceof Promise?s.then(a=>(r.value=a,r)):(r.value=s,r)}});function tu(t){return new v_({type:"transform",transform:t})}const ru=A("ZodOptional",(t,e)=>{Rm.init(t,e),Ee.init(t,e),t.unwrap=()=>t._zod.def.innerType});function re(t){return new ru({type:"optional",innerType:t})}const y_=A("ZodNullable",(t,e)=>{Pm.init(t,e),Ee.init(t,e),t.unwrap=()=>t._zod.def.innerType});function nu(t){return new y_({type:"nullable",innerType:t})}const w_=A("ZodDefault",(t,e)=>{Cm.init(t,e),Ee.init(t,e),t.unwrap=()=>t._zod.def.innerType,t.removeDefault=t.unwrap});function b_(t,e){return new w_({type:"default",innerType:t,get defaultValue(){return typeof e=="function"?e():e}})}const S_=A("ZodPrefault",(t,e)=>{Im.init(t,e),Ee.init(t,e),t.unwrap=()=>t._zod.def.innerType});function k_(t,e){return new S_({type:"prefault",innerType:t,get defaultValue(){return typeof e=="function"?e():e}})}const su=A("ZodNonOptional",(t,e)=>{Om.init(t,e),Ee.init(t,e),t.unwrap=()=>t._zod.def.innerType});function $_(t,e){return new su({type:"nonoptional",innerType:t,...Q(e)})}const E_=A("ZodCatch",(t,e)=>{Nm.init(t,e),Ee.init(t,e),t.unwrap=()=>t._zod.def.innerType,t.removeCatch=t.unwrap});function T_(t,e){return new E_({type:"catch",innerType:t,catchValue:typeof e=="function"?e:()=>e})}const R_=A("ZodPipe",(t,e)=>{Am.init(t,e),Ee.init(t,e),t.in=e.in,t.out=e.out});function da(t,e){return new R_({type:"pipe",in:t,out:e})}const P_=A("ZodReadonly",(t,e)=>{jm.init(t,e),Ee.init(t,e)});function C_(t){return new P_({type:"readonly",innerType:t})}const au=A("ZodCustom",(t,e)=>{zm.init(t,e),Ee.init(t,e)});function I_(t){const e=new Ke({check:"custom"});return e._zod.check=t,e}function O_(t,e){return Rp(au,t??(()=>!0),e)}function N_(t,e={}){return Pp(au,t,e)}function A_(t){const e=I_(r=>(r.addIssue=n=>{if(typeof n=="string")r.issues.push(Rr(n,r.value,e._zod.def));else{const s=n;s.fatal&&(s.continue=!1),s.code??(s.code="custom"),s.input??(s.input=r.value),s.inst??(s.inst=e),s.continue??(s.continue=!e._zod.def.abort),r.issues.push(Rr(s))}},t(r.value,r)));return e}function iu(t,e){return da(tu(t),e)}const j_={custom:"custom"};function z_(t){return up(ca,t)}const Ut="2025-11-25",M_="2025-03-26",fa=[Ut,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],pt="io.modelcontextprotocol/related-task",Ir="2.0",_t=O_(t=>t!==null&&(typeof t=="object"||typeof t=="function")),ha=Re([R(),we().int()]),ma=R(),ou=Je({ttl:Re([we(),Yc()]).optional(),pollInterval:we().optional()}),Qn=Je({taskId:R()}),q_=Je({progressToken:ha.optional(),[pt]:Qn.optional()}),Ge=Je({task:ou.optional(),_meta:q_.optional()}),ze=x({method:R(),params:Ge.optional()}),Dt=Je({_meta:x({[pt]:re(Qn)}).passthrough().optional()}),tt=x({method:R(),params:Dt.optional()}),Ze=Je({_meta:Je({[pt]:Qn.optional()}).optional()}),Or=Re([R(),we().int()]),pa=x({jsonrpc:te(Ir),id:Or,...ze.shape}).strict(),Xn=t=>pa.safeParse(t).success,_a=x({jsonrpc:te(Ir),...tt.shape}).strict(),cu=t=>_a.safeParse(t).success,ga=x({jsonrpc:te(Ir),id:Or,result:Ze}).strict(),er=t=>ga.safeParse(t).success;$.ErrorCode=void 0,(function(t){t[t.ConnectionClosed=-32e3]="ConnectionClosed",t[t.RequestTimeout=-32001]="RequestTimeout",t[t.ParseError=-32700]="ParseError",t[t.InvalidRequest=-32600]="InvalidRequest",t[t.MethodNotFound=-32601]="MethodNotFound",t[t.InvalidParams=-32602]="InvalidParams",t[t.InternalError=-32603]="InternalError",t[t.UrlElicitationRequired=-32042]="UrlElicitationRequired"})($.ErrorCode||($.ErrorCode={}));const va=x({jsonrpc:te(Ir),id:Or,error:x({code:we().int(),message:R(),data:re(Ne())})}).strict(),uu=t=>va.safeParse(t).success,Nr=Re([pa,_a,ga,va]),Ct=Ze.strict(),lu=Dt.extend({requestId:Or,reason:R().optional()}),es=tt.extend({method:te("notifications/cancelled"),params:lu}),du=x({src:R(),mimeType:R().optional(),sizes:W(R()).optional()}),tr=x({icons:W(du).optional()}),Vt=x({name:R(),title:R().optional()}),ya=Vt.extend({...Vt.shape,...tr.shape,version:R(),websiteUrl:R().optional()}),Z_=ua(x({applyDefaults:Te().optional()}),Ae(R(),Ne())),x_=iu(t=>t&&typeof t=="object"&&!Array.isArray(t)&&Object.keys(t).length===0?{form:{}}:t,ua(x({form:Z_.optional(),url:_t.optional()}),Ae(R(),Ne()).optional())),fu=x({list:re(x({}).passthrough()),cancel:re(x({}).passthrough()),requests:re(x({sampling:re(x({createMessage:re(x({}).passthrough())}).passthrough()),elicitation:re(x({create:re(x({}).passthrough())}).passthrough())}).passthrough())}).passthrough(),hu=x({list:re(x({}).passthrough()),cancel:re(x({}).passthrough()),requests:re(x({tools:re(x({call:re(x({}).passthrough())}).passthrough())}).passthrough())}).passthrough(),mu=x({experimental:Ae(R(),_t).optional(),sampling:x({context:_t.optional(),tools:_t.optional()}).optional(),elicitation:x_.optional(),roots:x({listChanged:Te().optional()}).optional(),tasks:re(fu)}),pu=Ge.extend({protocolVersion:R(),capabilities:mu,clientInfo:ya}),ts=ze.extend({method:te("initialize"),params:pu}),L_=t=>ts.safeParse(t).success,_u=x({experimental:Ae(R(),_t).optional(),logging:_t.optional(),completions:_t.optional(),prompts:re(x({listChanged:re(Te())})),resources:x({subscribe:Te().optional(),listChanged:Te().optional()}).optional(),tools:x({listChanged:Te().optional()}).optional(),tasks:re(hu)}).passthrough(),wa=Ze.extend({protocolVersion:R(),capabilities:_u,serverInfo:ya,instructions:R().optional()}),rs=tt.extend({method:te("notifications/initialized")}),gu=t=>rs.safeParse(t).success,ns=ze.extend({method:te("ping")}),vu=x({progress:we(),total:re(we()),message:re(R())}),yu=x({...Dt.shape,...vu.shape,progressToken:ha}),ss=tt.extend({method:te("notifications/progress"),params:yu}),wu=Ge.extend({cursor:ma.optional()}),rr=ze.extend({params:wu.optional()}),nr=Ze.extend({nextCursor:re(ma)}),sr=x({taskId:R(),status:De(["working","input_required","completed","failed","cancelled"]),ttl:Re([we(),Yc()]),createdAt:R(),lastUpdatedAt:R(),pollInterval:re(we()),statusMessage:re(R())}),Ft=Ze.extend({task:sr}),bu=Dt.merge(sr),Ar=tt.extend({method:te("notifications/tasks/status"),params:bu}),as=ze.extend({method:te("tasks/get"),params:Ge.extend({taskId:R()})}),is=Ze.merge(sr),os=ze.extend({method:te("tasks/result"),params:Ge.extend({taskId:R()})}),cs=rr.extend({method:te("tasks/list")}),us=nr.extend({tasks:W(sr)}),Su=ze.extend({method:te("tasks/cancel"),params:Ge.extend({taskId:R()})}),ku=Ze.merge(sr),ba=x({uri:R(),mimeType:re(R()),_meta:Ae(R(),Ne()).optional()}),Sa=ba.extend({text:R()}),ka=R().refine(t=>{try{return atob(t),!0}catch{return!1}},{message:"Invalid Base64 string"}),$a=ba.extend({blob:ka}),Ht=x({audience:W(De(["user","assistant"])).optional(),priority:we().min(0).max(1).optional(),lastModified:Wc({offset:!0}).optional()}),Ea=x({...Vt.shape,...tr.shape,uri:R(),description:re(R()),mimeType:re(R()),annotations:Ht.optional(),_meta:re(Je({}))}),$u=x({...Vt.shape,...tr.shape,uriTemplate:R(),description:re(R()),mimeType:re(R()),annotations:Ht.optional(),_meta:re(Je({}))}),ls=rr.extend({method:te("resources/list")}),Ta=nr.extend({resources:W(Ea)}),ds=rr.extend({method:te("resources/templates/list")}),Ra=nr.extend({resourceTemplates:W($u)}),fs=Ge.extend({uri:R()}),Eu=fs,hs=ze.extend({method:te("resources/read"),params:Eu}),Pa=Ze.extend({contents:W(Re([Sa,$a]))}),Tu=tt.extend({method:te("notifications/resources/list_changed")}),Ru=fs,Pu=ze.extend({method:te("resources/subscribe"),params:Ru}),Cu=fs,Iu=ze.extend({method:te("resources/unsubscribe"),params:Cu}),Ou=Dt.extend({uri:R()}),Nu=tt.extend({method:te("notifications/resources/updated"),params:Ou}),Au=x({name:R(),description:re(R()),required:re(Te())}),ju=x({...Vt.shape,...tr.shape,description:re(R()),arguments:re(W(Au)),_meta:re(Je({}))}),ms=rr.extend({method:te("prompts/list")}),Ca=nr.extend({prompts:W(ju)}),zu=Ge.extend({name:R(),arguments:Ae(R(),R()).optional()}),ps=ze.extend({method:te("prompts/get"),params:zu}),_s=x({type:te("text"),text:R(),annotations:Ht.optional(),_meta:Ae(R(),Ne()).optional()}),gs=x({type:te("image"),data:ka,mimeType:R(),annotations:Ht.optional(),_meta:Ae(R(),Ne()).optional()}),vs=x({type:te("audio"),data:ka,mimeType:R(),annotations:Ht.optional(),_meta:Ae(R(),Ne()).optional()}),Mu=x({type:te("tool_use"),name:R(),id:R(),input:x({}).passthrough(),_meta:re(x({}).passthrough())}).passthrough(),qu=x({type:te("resource"),resource:Re([Sa,$a]),annotations:Ht.optional(),_meta:Ae(R(),Ne()).optional()}),Zu=Ea.extend({type:te("resource_link")}),ys=Re([_s,gs,vs,Zu,qu]),xu=x({role:De(["user","assistant"]),content:ys}),Ia=Ze.extend({description:re(R()),messages:W(xu)}),Lu=tt.extend({method:te("notifications/prompts/list_changed")}),Uu=x({title:R().optional(),readOnlyHint:Te().optional(),destructiveHint:Te().optional(),idempotentHint:Te().optional(),openWorldHint:Te().optional()}),Du=x({taskSupport:De(["required","optional","forbidden"]).optional()}),Oa=x({...Vt.shape,...tr.shape,description:R().optional(),inputSchema:x({type:te("object"),properties:Ae(R(),_t).optional(),required:W(R()).optional()}).catchall(Ne()),outputSchema:x({type:te("object"),properties:Ae(R(),_t).optional(),required:W(R()).optional()}).catchall(Ne()).optional(),annotations:re(Uu),execution:re(Du),_meta:Ae(R(),Ne()).optional()}),ws=rr.extend({method:te("tools/list")}),Na=nr.extend({tools:W(Oa)}),ar=Ze.extend({content:W(ys).default([]),structuredContent:Ae(R(),Ne()).optional(),isError:re(Te())}),U_=ar.or(Ze.extend({toolResult:Ne()})),Vu=Ge.extend({name:R(),arguments:re(Ae(R(),Ne()))}),jr=ze.extend({method:te("tools/call"),params:Vu}),Fu=tt.extend({method:te("notifications/tools/list_changed")}),zr=De(["debug","info","notice","warning","error","critical","alert","emergency"]),Hu=Ge.extend({level:zr}),Aa=ze.extend({method:te("logging/setLevel"),params:Hu}),Wu=Dt.extend({level:zr,logger:R().optional(),data:Ne()}),Ku=tt.extend({method:te("notifications/message"),params:Wu}),Ju=x({name:R().optional()}),Gu=x({hints:re(W(Ju)),costPriority:re(we().min(0).max(1)),speedPriority:re(we().min(0).max(1)),intelligencePriority:re(we().min(0).max(1))}),Bu=x({mode:re(De(["auto","required","none"]))}),Yu=x({type:te("tool_result"),toolUseId:R().describe("The unique identifier for the corresponding tool call."),content:W(ys).default([]),structuredContent:x({}).passthrough().optional(),isError:re(Te()),_meta:re(x({}).passthrough())}).passthrough(),Qu=eu("type",[_s,gs,vs]),Mr=eu("type",[_s,gs,vs,Mu,Yu]),Xu=x({role:De(["user","assistant"]),content:Re([Mr,W(Mr)]),_meta:re(x({}).passthrough())}).passthrough(),el=Ge.extend({messages:W(Xu),modelPreferences:Gu.optional(),systemPrompt:R().optional(),includeContext:De(["none","thisServer","allServers"]).optional(),temperature:we().optional(),maxTokens:we().int(),stopSequences:W(R()).optional(),metadata:_t.optional(),tools:re(W(Oa)),toolChoice:re(Bu)}),ja=ze.extend({method:te("sampling/createMessage"),params:el}),bs=Ze.extend({model:R(),stopReason:re(De(["endTurn","stopSequence","maxTokens"]).or(R())),role:De(["user","assistant"]),content:Qu}),za=Ze.extend({model:R(),stopReason:re(De(["endTurn","stopSequence","maxTokens","toolUse"]).or(R())),role:De(["user","assistant"]),content:Re([Mr,W(Mr)])}),tl=x({type:te("boolean"),title:R().optional(),description:R().optional(),default:Te().optional()}),rl=x({type:te("string"),title:R().optional(),description:R().optional(),minLength:we().optional(),maxLength:we().optional(),format:De(["email","uri","date","date-time"]).optional(),default:R().optional()}),nl=x({type:De(["number","integer"]),title:R().optional(),description:R().optional(),minimum:we().optional(),maximum:we().optional(),default:we().optional()}),sl=x({type:te("string"),title:R().optional(),description:R().optional(),enum:W(R()),default:R().optional()}),al=x({type:te("string"),title:R().optional(),description:R().optional(),oneOf:W(x({const:R(),title:R()})),default:R().optional()}),il=x({type:te("string"),title:R().optional(),description:R().optional(),enum:W(R()),enumNames:W(R()).optional(),default:R().optional()}),ol=Re([sl,al]),cl=x({type:te("array"),title:R().optional(),description:R().optional(),minItems:we().optional(),maxItems:we().optional(),items:x({type:te("string"),enum:W(R())}),default:W(R()).optional()}),ul=x({type:te("array"),title:R().optional(),description:R().optional(),minItems:we().optional(),maxItems:we().optional(),items:x({anyOf:W(x({const:R(),title:R()}))}),default:W(R()).optional()}),ll=Re([cl,ul]),dl=Re([il,ol,ll]),fl=Re([dl,tl,rl,nl]),hl=Ge.extend({mode:te("form").optional(),message:R(),requestedSchema:x({type:te("object"),properties:Ae(R(),fl),required:W(R()).optional()})}),ml=Ge.extend({mode:te("url"),message:R(),elicitationId:R(),url:R().url()}),pl=Re([hl,ml]),Ma=ze.extend({method:te("elicitation/create"),params:pl}),_l=Dt.extend({elicitationId:R()}),gl=tt.extend({method:te("notifications/elicitation/complete"),params:_l}),qr=Ze.extend({action:De(["accept","decline","cancel"]),content:iu(t=>t===null?void 0:t,Ae(R(),Re([R(),we(),Te(),W(R())])).optional())}),qa=x({type:te("ref/resource"),uri:R()}),D_=qa,vl=x({type:te("ref/prompt"),name:R()}),yl=Ge.extend({ref:Re([vl,qa]),argument:x({name:R(),value:R()}),context:x({arguments:Ae(R(),R()).optional()}).optional()}),Ss=ze.extend({method:te("completion/complete"),params:yl});function wl(t){if(t.params.ref.type!=="ref/prompt")throw new TypeError(`Expected CompleteRequestPrompt, but got ${t.params.ref.type}`)}function bl(t){if(t.params.ref.type!=="ref/resource")throw new TypeError(`Expected CompleteRequestResourceTemplate, but got ${t.params.ref.type}`)}const Za=Ze.extend({completion:Je({values:W(R()).max(100),total:re(we().int()),hasMore:re(Te())})}),Sl=x({uri:R().startsWith("file://"),name:R().optional(),_meta:Ae(R(),Ne()).optional()}),kl=ze.extend({method:te("roots/list")}),xa=Ze.extend({roots:W(Sl)}),$l=tt.extend({method:te("notifications/roots/list_changed")}),V_=Re([ns,ts,Ss,Aa,ps,ms,ls,ds,hs,Pu,Iu,jr,ws,as,os,cs]),F_=Re([es,ss,rs,$l,Ar]),H_=Re([Ct,bs,za,qr,xa,is,us,Ft]),W_=Re([ns,ja,Ma,kl,as,os,cs]),K_=Re([es,ss,Ku,Nu,Tu,Fu,Lu,Ar,gl]),J_=Re([Ct,wa,Za,Ia,Ca,Ta,Ra,Pa,ar,Na,is,us,Ft]);class K extends Error{constructor(e,r,n){super(`MCP error ${e}: ${r}`),this.code=e,this.data=n,this.name="McpError"}static fromError(e,r,n){if(e===$.ErrorCode.UrlElicitationRequired&&n){const s=n;if(s.elicitations)return new El(s.elicitations,r)}return new K(e,r,n)}}class El extends K{constructor(e,r=`URL elicitation${e.length>1?"s":""} required`){super($.ErrorCode.UrlElicitationRequired,r,{elicitations:e})}get elicitations(){var e,r;return(r=(e=this.data)===null||e===void 0?void 0:e.elicitations)!==null&&r!==void 0?r:[]}}const Tl=1e6,La=1e6,Rl=1e4,G_=1e6;class bt{static isTemplate(e){return/\{[^}\s]+\}/.test(e)}static validateLength(e,r,n){if(e.length>r)throw new Error(`${n} exceeds maximum length of ${r} characters (got ${e.length})`)}get variableNames(){return this.parts.flatMap(e=>typeof e=="string"?[]:e.names)}constructor(e){bt.validateLength(e,Tl,"Template"),this.template=e,this.parts=this.parse(e)}toString(){return this.template}parse(e){const r=[];let n="",s=0,a=0;for(;s<e.length;)if(e[s]==="{"){n&&(r.push(n),n="");const i=e.indexOf("}",s);if(i===-1)throw new Error("Unclosed template expression");if(a++,a>Rl)throw new Error(`Template contains too many expressions (max ${Rl})`);const o=e.slice(s+1,i),c=this.getOperator(o),l=o.includes("*"),u=this.getNames(o),f=u[0];for(const y of u)bt.validateLength(y,La,"Variable name");r.push({name:f,operator:c,names:u,exploded:l}),s=i+1}else n+=e[s],s++;return n&&r.push(n),r}getOperator(e){return["+","#",".","/","?","&"].find(n=>e.startsWith(n))||""}getNames(e){const r=this.getOperator(e);return e.slice(r.length).split(",").map(n=>n.replace("*","").trim()).filter(n=>n.length>0)}encodeValue(e,r){return bt.validateLength(e,La,"Variable value"),r==="+"||r==="#"?encodeURI(e):encodeURIComponent(e)}expandPart(e,r){if(e.operator==="?"||e.operator==="&"){const i=e.names.map(c=>{const l=r[c];if(l===void 0)return"";const u=Array.isArray(l)?l.map(f=>this.encodeValue(f,e.operator)).join(","):this.encodeValue(l.toString(),e.operator);return`${c}=${u}`}).filter(c=>c.length>0);return i.length===0?"":(e.operator==="?"?"?":"&")+i.join("&")}if(e.names.length>1){const i=e.names.map(o=>r[o]).filter(o=>o!==void 0);return i.length===0?"":i.map(o=>Array.isArray(o)?o[0]:o).join(",")}const n=r[e.name];if(n===void 0)return"";const a=(Array.isArray(n)?n:[n]).map(i=>this.encodeValue(i,e.operator));switch(e.operator){case"":return a.join(",");case"+":return a.join(",");case"#":return"#"+a.join(",");case".":return"."+a.join(".");case"/":return"/"+a.join("/");default:return a.join(",")}}expand(e){let r="",n=!1;for(const s of this.parts){if(typeof s=="string"){r+=s;continue}const a=this.expandPart(s,e);a&&((s.operator==="?"||s.operator==="&")&&n?r+=a.replace("?","&"):r+=a,(s.operator==="?"||s.operator==="&")&&(n=!0))}return r}escapeRegExp(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}partToRegExp(e){const r=[];for(const a of e.names)bt.validateLength(a,La,"Variable name");if(e.operator==="?"||e.operator==="&"){for(let a=0;a<e.names.length;a++){const i=e.names[a],o=a===0?"\\"+e.operator:"&";r.push({pattern:o+this.escapeRegExp(i)+"=([^&]+)",name:i})}return r}let n;const s=e.name;switch(e.operator){case"":n=e.exploded?"([^/]+(?:,[^/]+)*)":"([^/,]+)";break;case"+":case"#":n="(.+)";break;case".":n="\\.([^/,]+)";break;case"/":n="/"+(e.exploded?"([^/]+(?:,[^/]+)*)":"([^/,]+)");break;default:n="([^/]+)"}return r.push({pattern:n,name:s}),r}match(e){bt.validateLength(e,Tl,"URI");let r="^";const n=[];for(const o of this.parts)if(typeof o=="string")r+=this.escapeRegExp(o);else{const c=this.partToRegExp(o);for(const{pattern:l,name:u}of c)r+=l,n.push({name:u,exploded:o.exploded})}r+="$",bt.validateLength(r,G_,"Generated regex pattern");const s=new RegExp(r),a=e.match(s);if(!a)return null;const i={};for(let o=0;o<n.length;o++){const{name:c,exploded:l}=n[o],u=a[o+1],f=c.replace("*","");l&&u.includes(",")?i[f]=u.split(","):i[f]=u}return i}}const ks=Symbol.for("mcp.completable");function B_(t,e){return Object.defineProperty(t,ks,{value:{complete:e},enumerable:!1,writable:!1,configurable:!1}),t}function Pl(t){return!!t&&typeof t=="object"&&ks in t}function Cl(t){const e=t[ks];return e?.complete}function Y_(t){return t}$.McpZodTypeKind=void 0,(function(t){t.Completable="McpCompletable"})($.McpZodTypeKind||($.McpZodTypeKind={}));function Q_(t){var e;return t.title!==void 0&&t.title!==""?t.title:"annotations"in t&&(!((e=t.annotations)===null||e===void 0)&&e.title)?t.annotations.title:t.name}var me;(function(t){t.assertEqual=s=>{};function e(s){}t.assertIs=e;function r(s){throw new Error}t.assertNever=r,t.arrayToEnum=s=>{const a={};for(const i of s)a[i]=i;return a},t.getValidEnumValues=s=>{const a=t.objectKeys(s).filter(o=>typeof s[s[o]]!="number"),i={};for(const o of a)i[o]=s[o];return t.objectValues(i)},t.objectValues=s=>t.objectKeys(s).map(function(a){return s[a]}),t.objectKeys=typeof Object.keys=="function"?s=>Object.keys(s):s=>{const a=[];for(const i in s)Object.prototype.hasOwnProperty.call(s,i)&&a.push(i);return a},t.find=(s,a)=>{for(const i of s)if(a(i))return i},t.isInteger=typeof Number.isInteger=="function"?s=>Number.isInteger(s):s=>typeof s=="number"&&Number.isFinite(s)&&Math.floor(s)===s;function n(s,a=" | "){return s.map(i=>typeof i=="string"?`'${i}'`:i).join(a)}t.joinValues=n,t.jsonStringifyReplacer=(s,a)=>typeof a=="bigint"?a.toString():a})(me||(me={}));var Il;(function(t){t.mergeShapes=(e,r)=>({...e,...r})})(Il||(Il={}));const B=me.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),It=t=>{switch(typeof t){case"undefined":return B.undefined;case"string":return B.string;case"number":return Number.isNaN(t)?B.nan:B.number;case"boolean":return B.boolean;case"function":return B.function;case"bigint":return B.bigint;case"symbol":return B.symbol;case"object":return Array.isArray(t)?B.array:t===null?B.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?B.promise:typeof Map<"u"&&t instanceof Map?B.map:typeof Set<"u"&&t instanceof Set?B.set:typeof Date<"u"&&t instanceof Date?B.date:B.object;default:return B.unknown}},L=me.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class St extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};const r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=e}format(e){const r=e||function(a){return a.message},n={_errors:[]},s=a=>{for(const i of a.issues)if(i.code==="invalid_union")i.unionErrors.map(s);else if(i.code==="invalid_return_type")s(i.returnTypeError);else if(i.code==="invalid_arguments")s(i.argumentsError);else if(i.path.length===0)n._errors.push(r(i));else{let o=n,c=0;for(;c<i.path.length;){const l=i.path[c];c===i.path.length-1?(o[l]=o[l]||{_errors:[]},o[l]._errors.push(r(i))):o[l]=o[l]||{_errors:[]},o=o[l],c++}}};return s(this),n}static assert(e){if(!(e instanceof St))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,me.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=r=>r.message){const r={},n=[];for(const s of this.issues)if(s.path.length>0){const a=s.path[0];r[a]=r[a]||[],r[a].push(e(s))}else n.push(e(s));return{formErrors:n,fieldErrors:r}}get formErrors(){return this.flatten()}}St.create=t=>new St(t);const Ua=(t,e)=>{let r;switch(t.code){case L.invalid_type:t.received===B.undefined?r="Required":r=`Expected ${t.expected}, received ${t.received}`;break;case L.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(t.expected,me.jsonStringifyReplacer)}`;break;case L.unrecognized_keys:r=`Unrecognized key(s) in object: ${me.joinValues(t.keys,", ")}`;break;case L.invalid_union:r="Invalid input";break;case L.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${me.joinValues(t.options)}`;break;case L.invalid_enum_value:r=`Invalid enum value. Expected ${me.joinValues(t.options)}, received '${t.received}'`;break;case L.invalid_arguments:r="Invalid function arguments";break;case L.invalid_return_type:r="Invalid function return type";break;case L.invalid_date:r="Invalid date";break;case L.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(r=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(r=`${r} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?r=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?r=`Invalid input: must end with "${t.validation.endsWith}"`:me.assertNever(t.validation):t.validation!=="regex"?r=`Invalid ${t.validation}`:r="Invalid";break;case L.too_small:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="bigint"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:r="Invalid input";break;case L.too_big:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?r=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:r="Invalid input";break;case L.custom:r="Invalid input";break;case L.invalid_intersection_types:r="Intersection results could not be merged";break;case L.not_multiple_of:r=`Number must be a multiple of ${t.multipleOf}`;break;case L.not_finite:r="Number must be finite";break;default:r=e.defaultError,me.assertNever(t)}return{message:r}};let X_=Ua;function eg(){return X_}const tg=t=>{const{data:e,path:r,errorMaps:n,issueData:s}=t,a=[...r,...s.path||[]],i={...s,path:a};if(s.message!==void 0)return{...s,path:a,message:s.message};let o="";const c=n.filter(l=>!!l).slice().reverse();for(const l of c)o=l(i,{data:e,defaultError:o}).message;return{...s,path:a,message:o}};function J(t,e){const r=eg(),n=tg({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,r,r===Ua?void 0:Ua].filter(s=>!!s)});t.common.issues.push(n)}class rt{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,r){const n=[];for(const s of r){if(s.status==="aborted")return ae;s.status==="dirty"&&e.dirty(),n.push(s.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,r){const n=[];for(const s of r){const a=await s.key,i=await s.value;n.push({key:a,value:i})}return rt.mergeObjectSync(e,n)}static mergeObjectSync(e,r){const n={};for(const s of r){const{key:a,value:i}=s;if(a.status==="aborted"||i.status==="aborted")return ae;a.status==="dirty"&&e.dirty(),i.status==="dirty"&&e.dirty(),a.value!=="__proto__"&&(typeof i.value<"u"||s.alwaysSet)&&(n[a.value]=i.value)}return{status:e.value,value:n}}}const ae=Object.freeze({status:"aborted"}),Zr=t=>({status:"dirty",value:t}),nt=t=>({status:"valid",value:t}),Ol=t=>t.status==="aborted",Nl=t=>t.status==="dirty",ir=t=>t.status==="valid",$s=t=>typeof Promise<"u"&&t instanceof Promise;var X;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(X||(X={}));class Ot{constructor(e,r,n,s){this._cachedPath=[],this.parent=e,this.data=r,this._path=n,this._key=s}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const Al=(t,e)=>{if(ir(e))return{success:!0,data:e.value};if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const r=new St(t.common.issues);return this._error=r,this._error}}};function ce(t){if(!t)return{};const{errorMap:e,invalid_type_error:r,required_error:n,description:s}=t;if(e&&(r||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:s}:{errorMap:(i,o)=>{const{message:c}=t;return i.code==="invalid_enum_value"?{message:c??o.defaultError}:typeof o.data>"u"?{message:c??n??o.defaultError}:i.code!=="invalid_type"?{message:o.defaultError}:{message:c??r??o.defaultError}},description:s}}class fe{get description(){return this._def.description}_getType(e){return It(e.data)}_getOrReturnCtx(e,r){return r||{common:e.parent.common,data:e.data,parsedType:It(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new rt,ctx:{common:e.parent.common,data:e.data,parsedType:It(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const r=this._parse(e);if($s(r))throw new Error("Synchronous parse encountered promise.");return r}_parseAsync(e){const r=this._parse(e);return Promise.resolve(r)}parse(e,r){const n=this.safeParse(e,r);if(n.success)return n.data;throw n.error}safeParse(e,r){const n={common:{issues:[],async:r?.async??!1,contextualErrorMap:r?.errorMap},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:It(e)},s=this._parseSync({data:e,path:n.path,parent:n});return Al(n,s)}"~validate"(e){const r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:It(e)};if(!this["~standard"].async)try{const n=this._parseSync({data:e,path:[],parent:r});return ir(n)?{value:n.value}:{issues:r.common.issues}}catch(n){n?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),r.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:r}).then(n=>ir(n)?{value:n.value}:{issues:r.common.issues})}async parseAsync(e,r){const n=await this.safeParseAsync(e,r);if(n.success)return n.data;throw n.error}async safeParseAsync(e,r){const n={common:{issues:[],contextualErrorMap:r?.errorMap,async:!0},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:It(e)},s=this._parse({data:e,path:n.path,parent:n}),a=await($s(s)?s:Promise.resolve(s));return Al(n,a)}refine(e,r){const n=s=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(s):r;return this._refinement((s,a)=>{const i=e(s),o=()=>a.addIssue({code:L.custom,...n(s)});return typeof Promise<"u"&&i instanceof Promise?i.then(c=>c?!0:(o(),!1)):i?!0:(o(),!1)})}refinement(e,r){return this._refinement((n,s)=>e(n)?!0:(s.addIssue(typeof r=="function"?r(n,s):r),!1))}_refinement(e){return new ur({schema:this,typeName:U.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:r=>this["~validate"](r)}}optional(){return At.create(this,this._def)}nullable(){return lr.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return gt.create(this)}promise(){return Ps.create(this,this._def)}or(e){return Ts.create([this,e],this._def)}and(e){return Rs.create(this,e,this._def)}transform(e){return new ur({...ce(this._def),schema:this,typeName:U.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const r=typeof e=="function"?e:()=>e;return new Fa({...ce(this._def),innerType:this,defaultValue:r,typeName:U.ZodDefault})}brand(){return new $g({typeName:U.ZodBranded,type:this,...ce(this._def)})}catch(e){const r=typeof e=="function"?e:()=>e;return new Ha({...ce(this._def),innerType:this,catchValue:r,typeName:U.ZodCatch})}describe(e){const r=this.constructor;return new r({...this._def,description:e})}pipe(e){return Wa.create(this,e)}readonly(){return Ka.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const rg=/^c[^\s-]{8,}$/i,ng=/^[0-9a-z]+$/,sg=/^[0-9A-HJKMNP-TV-Z]{26}$/i,ag=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,ig=/^[a-z0-9_-]{21}$/i,og=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,cg=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,ug=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,lg="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let Da;const dg=/^(?:(?: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])$/,fg=/^(?:(?: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])\/(3[0-2]|[12]?[0-9])$/,hg=/^(([0-9a-fA-F]{1,4}:){7,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}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,mg=/^(([0-9a-fA-F]{1,4}:){7,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}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,pg=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,_g=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,jl="((\\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])))",gg=new RegExp(`^${jl}$`);function zl(t){let e="[0-5]\\d";t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`);const r=t.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${r}`}function vg(t){return new RegExp(`^${zl(t)}$`)}function yg(t){let e=`${jl}T${zl(t)}`;const r=[];return r.push(t.local?"Z?":"Z"),t.offset&&r.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${r.join("|")})`,new RegExp(`^${e}$`)}function wg(t,e){return!!((e==="v4"||!e)&&dg.test(t)||(e==="v6"||!e)&&hg.test(t))}function bg(t,e){if(!og.test(t))return!1;try{const[r]=t.split(".");if(!r)return!1;const n=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),s=JSON.parse(atob(n));return!(typeof s!="object"||s===null||"typ"in s&&s?.typ!=="JWT"||!s.alg||e&&s.alg!==e)}catch{return!1}}function Sg(t,e){return!!((e==="v4"||!e)&&fg.test(t)||(e==="v6"||!e)&&mg.test(t))}class Wt extends fe{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==B.string){const a=this._getOrReturnCtx(e);return J(a,{code:L.invalid_type,expected:B.string,received:a.parsedType}),ae}const n=new rt;let s;for(const a of this._def.checks)if(a.kind==="min")e.data.length<a.value&&(s=this._getOrReturnCtx(e,s),J(s,{code:L.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),n.dirty());else if(a.kind==="max")e.data.length>a.value&&(s=this._getOrReturnCtx(e,s),J(s,{code:L.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),n.dirty());else if(a.kind==="length"){const i=e.data.length>a.value,o=e.data.length<a.value;(i||o)&&(s=this._getOrReturnCtx(e,s),i?J(s,{code:L.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}):o&&J(s,{code:L.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}),n.dirty())}else if(a.kind==="email")ug.test(e.data)||(s=this._getOrReturnCtx(e,s),J(s,{validation:"email",code:L.invalid_string,message:a.message}),n.dirty());else if(a.kind==="emoji")Da||(Da=new RegExp(lg,"u")),Da.test(e.data)||(s=this._getOrReturnCtx(e,s),J(s,{validation:"emoji",code:L.invalid_string,message:a.message}),n.dirty());else if(a.kind==="uuid")ag.test(e.data)||(s=this._getOrReturnCtx(e,s),J(s,{validation:"uuid",code:L.invalid_string,message:a.message}),n.dirty());else if(a.kind==="nanoid")ig.test(e.data)||(s=this._getOrReturnCtx(e,s),J(s,{validation:"nanoid",code:L.invalid_string,message:a.message}),n.dirty());else if(a.kind==="cuid")rg.test(e.data)||(s=this._getOrReturnCtx(e,s),J(s,{validation:"cuid",code:L.invalid_string,message:a.message}),n.dirty());else if(a.kind==="cuid2")ng.test(e.data)||(s=this._getOrReturnCtx(e,s),J(s,{validation:"cuid2",code:L.invalid_string,message:a.message}),n.dirty());else if(a.kind==="ulid")sg.test(e.data)||(s=this._getOrReturnCtx(e,s),J(s,{validation:"ulid",code:L.invalid_string,message:a.message}),n.dirty());else if(a.kind==="url")try{new URL(e.data)}catch{s=this._getOrReturnCtx(e,s),J(s,{validation:"url",code:L.invalid_string,message:a.message}),n.dirty()}else a.kind==="regex"?(a.regex.lastIndex=0,a.regex.test(e.data)||(s=this._getOrReturnCtx(e,s),J(s,{validation:"regex",code:L.invalid_string,message:a.message}),n.dirty())):a.kind==="trim"?e.data=e.data.trim():a.kind==="includes"?e.data.includes(a.value,a.position)||(s=this._getOrReturnCtx(e,s),J(s,{code:L.invalid_string,validation:{includes:a.value,position:a.position},message:a.message}),n.dirty()):a.kind==="toLowerCase"?e.data=e.data.toLowerCase():a.kind==="toUpperCase"?e.data=e.data.toUpperCase():a.kind==="startsWith"?e.data.startsWith(a.value)||(s=this._getOrReturnCtx(e,s),J(s,{code:L.invalid_string,validation:{startsWith:a.value},message:a.message}),n.dirty()):a.kind==="endsWith"?e.data.endsWith(a.value)||(s=this._getOrReturnCtx(e,s),J(s,{code:L.invalid_string,validation:{endsWith:a.value},message:a.message}),n.dirty()):a.kind==="datetime"?yg(a).test(e.data)||(s=this._getOrReturnCtx(e,s),J(s,{code:L.invalid_string,validation:"datetime",message:a.message}),n.dirty()):a.kind==="date"?gg.test(e.data)||(s=this._getOrReturnCtx(e,s),J(s,{code:L.invalid_string,validation:"date",message:a.message}),n.dirty()):a.kind==="time"?vg(a).test(e.data)||(s=this._getOrReturnCtx(e,s),J(s,{code:L.invalid_string,validation:"time",message:a.message}),n.dirty()):a.kind==="duration"?cg.test(e.data)||(s=this._getOrReturnCtx(e,s),J(s,{validation:"duration",code:L.invalid_string,message:a.message}),n.dirty()):a.kind==="ip"?wg(e.data,a.version)||(s=this._getOrReturnCtx(e,s),J(s,{validation:"ip",code:L.invalid_string,message:a.message}),n.dirty()):a.kind==="jwt"?bg(e.data,a.alg)||(s=this._getOrReturnCtx(e,s),J(s,{validation:"jwt",code:L.invalid_string,message:a.message}),n.dirty()):a.kind==="cidr"?Sg(e.data,a.version)||(s=this._getOrReturnCtx(e,s),J(s,{validation:"cidr",code:L.invalid_string,message:a.message}),n.dirty()):a.kind==="base64"?pg.test(e.data)||(s=this._getOrReturnCtx(e,s),J(s,{validation:"base64",code:L.invalid_string,message:a.message}),n.dirty()):a.kind==="base64url"?_g.test(e.data)||(s=this._getOrReturnCtx(e,s),J(s,{validation:"base64url",code:L.invalid_string,message:a.message}),n.dirty()):me.assertNever(a);return{status:n.value,value:e.data}}_regex(e,r,n){return this.refinement(s=>e.test(s),{validation:r,code:L.invalid_string,...X.errToObj(n)})}_addCheck(e){return new Wt({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...X.errToObj(e)})}url(e){return this._addCheck({kind:"url",...X.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...X.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...X.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...X.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...X.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...X.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...X.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...X.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...X.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...X.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...X.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...X.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...X.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof e?.precision>"u"?null:e?.precision,...X.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...X.errToObj(e)})}regex(e,r){return this._addCheck({kind:"regex",regex:e,...X.errToObj(r)})}includes(e,r){return this._addCheck({kind:"includes",value:e,position:r?.position,...X.errToObj(r?.message)})}startsWith(e,r){return this._addCheck({kind:"startsWith",value:e,...X.errToObj(r)})}endsWith(e,r){return this._addCheck({kind:"endsWith",value:e,...X.errToObj(r)})}min(e,r){return this._addCheck({kind:"min",value:e,...X.errToObj(r)})}max(e,r){return this._addCheck({kind:"max",value:e,...X.errToObj(r)})}length(e,r){return this._addCheck({kind:"length",value:e,...X.errToObj(r)})}nonempty(e){return this.min(1,X.errToObj(e))}trim(){return new Wt({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new Wt({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new Wt({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(const r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxLength(){let e=null;for(const r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}}Wt.create=t=>new Wt({checks:[],typeName:U.ZodString,coerce:t?.coerce??!1,...ce(t)});function kg(t,e){const r=(t.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,s=r>n?r:n,a=Number.parseInt(t.toFixed(s).replace(".","")),i=Number.parseInt(e.toFixed(s).replace(".",""));return a%i/10**s}class xr extends fe{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==B.number){const a=this._getOrReturnCtx(e);return J(a,{code:L.invalid_type,expected:B.number,received:a.parsedType}),ae}let n;const s=new rt;for(const a of this._def.checks)a.kind==="int"?me.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),J(n,{code:L.invalid_type,expected:"integer",received:"float",message:a.message}),s.dirty()):a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(n=this._getOrReturnCtx(e,n),J(n,{code:L.too_small,minimum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),s.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(n=this._getOrReturnCtx(e,n),J(n,{code:L.too_big,maximum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),s.dirty()):a.kind==="multipleOf"?kg(e.data,a.value)!==0&&(n=this._getOrReturnCtx(e,n),J(n,{code:L.not_multiple_of,multipleOf:a.value,message:a.message}),s.dirty()):a.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),J(n,{code:L.not_finite,message:a.message}),s.dirty()):me.assertNever(a);return{status:s.value,value:e.data}}gte(e,r){return this.setLimit("min",e,!0,X.toString(r))}gt(e,r){return this.setLimit("min",e,!1,X.toString(r))}lte(e,r){return this.setLimit("max",e,!0,X.toString(r))}lt(e,r){return this.setLimit("max",e,!1,X.toString(r))}setLimit(e,r,n,s){return new xr({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:X.toString(s)}]})}_addCheck(e){return new xr({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:X.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:X.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:X.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:X.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:X.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:X.toString(r)})}finite(e){return this._addCheck({kind:"finite",message:X.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:X.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:X.toString(e)})}get minValue(){let e=null;for(const r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(const r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&me.isInteger(e.value))}get isFinite(){let e=null,r=null;for(const n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(r===null||n.value>r)&&(r=n.value):n.kind==="max"&&(e===null||n.value<e)&&(e=n.value)}return Number.isFinite(r)&&Number.isFinite(e)}}xr.create=t=>new xr({checks:[],typeName:U.ZodNumber,coerce:t?.coerce||!1,...ce(t)});class Lr extends fe{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==B.bigint)return this._getInvalidInput(e);let n;const s=new rt;for(const a of this._def.checks)a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(n=this._getOrReturnCtx(e,n),J(n,{code:L.too_small,type:"bigint",minimum:a.value,inclusive:a.inclusive,message:a.message}),s.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(n=this._getOrReturnCtx(e,n),J(n,{code:L.too_big,type:"bigint",maximum:a.value,inclusive:a.inclusive,message:a.message}),s.dirty()):a.kind==="multipleOf"?e.data%a.value!==BigInt(0)&&(n=this._getOrReturnCtx(e,n),J(n,{code:L.not_multiple_of,multipleOf:a.value,message:a.message}),s.dirty()):me.assertNever(a);return{status:s.value,value:e.data}}_getInvalidInput(e){const r=this._getOrReturnCtx(e);return J(r,{code:L.invalid_type,expected:B.bigint,received:r.parsedType}),ae}gte(e,r){return this.setLimit("min",e,!0,X.toString(r))}gt(e,r){return this.setLimit("min",e,!1,X.toString(r))}lte(e,r){return this.setLimit("max",e,!0,X.toString(r))}lt(e,r){return this.setLimit("max",e,!1,X.toString(r))}setLimit(e,r,n,s){return new Lr({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:X.toString(s)}]})}_addCheck(e){return new Lr({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:X.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:X.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:X.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:X.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:X.toString(r)})}get minValue(){let e=null;for(const r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(const r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}}Lr.create=t=>new Lr({checks:[],typeName:U.ZodBigInt,coerce:t?.coerce??!1,...ce(t)});class Ml extends fe{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==B.boolean){const n=this._getOrReturnCtx(e);return J(n,{code:L.invalid_type,expected:B.boolean,received:n.parsedType}),ae}return nt(e.data)}}Ml.create=t=>new Ml({typeName:U.ZodBoolean,coerce:t?.coerce||!1,...ce(t)});class Es extends fe{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==B.date){const a=this._getOrReturnCtx(e);return J(a,{code:L.invalid_type,expected:B.date,received:a.parsedType}),ae}if(Number.isNaN(e.data.getTime())){const a=this._getOrReturnCtx(e);return J(a,{code:L.invalid_date}),ae}const n=new rt;let s;for(const a of this._def.checks)a.kind==="min"?e.data.getTime()<a.value&&(s=this._getOrReturnCtx(e,s),J(s,{code:L.too_small,message:a.message,inclusive:!0,exact:!1,minimum:a.value,type:"date"}),n.dirty()):a.kind==="max"?e.data.getTime()>a.value&&(s=this._getOrReturnCtx(e,s),J(s,{code:L.too_big,message:a.message,inclusive:!0,exact:!1,maximum:a.value,type:"date"}),n.dirty()):me.assertNever(a);return{status:n.value,value:new Date(e.data.getTime())}}_addCheck(e){return new Es({...this._def,checks:[...this._def.checks,e]})}min(e,r){return this._addCheck({kind:"min",value:e.getTime(),message:X.toString(r)})}max(e,r){return this._addCheck({kind:"max",value:e.getTime(),message:X.toString(r)})}get minDate(){let e=null;for(const r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(const r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e!=null?new Date(e):null}}Es.create=t=>new Es({checks:[],coerce:t?.coerce||!1,typeName:U.ZodDate,...ce(t)});class ql extends fe{_parse(e){if(this._getType(e)!==B.symbol){const n=this._getOrReturnCtx(e);return J(n,{code:L.invalid_type,expected:B.symbol,received:n.parsedType}),ae}return nt(e.data)}}ql.create=t=>new ql({typeName:U.ZodSymbol,...ce(t)});class Zl extends fe{_parse(e){if(this._getType(e)!==B.undefined){const n=this._getOrReturnCtx(e);return J(n,{code:L.invalid_type,expected:B.undefined,received:n.parsedType}),ae}return nt(e.data)}}Zl.create=t=>new Zl({typeName:U.ZodUndefined,...ce(t)});class xl extends fe{_parse(e){if(this._getType(e)!==B.null){const n=this._getOrReturnCtx(e);return J(n,{code:L.invalid_type,expected:B.null,received:n.parsedType}),ae}return nt(e.data)}}xl.create=t=>new xl({typeName:U.ZodNull,...ce(t)});class Ll extends fe{constructor(){super(...arguments),this._any=!0}_parse(e){return nt(e.data)}}Ll.create=t=>new Ll({typeName:U.ZodAny,...ce(t)});class Ul extends fe{constructor(){super(...arguments),this._unknown=!0}_parse(e){return nt(e.data)}}Ul.create=t=>new Ul({typeName:U.ZodUnknown,...ce(t)});class Nt extends fe{_parse(e){const r=this._getOrReturnCtx(e);return J(r,{code:L.invalid_type,expected:B.never,received:r.parsedType}),ae}}Nt.create=t=>new Nt({typeName:U.ZodNever,...ce(t)});class Dl extends fe{_parse(e){if(this._getType(e)!==B.undefined){const n=this._getOrReturnCtx(e);return J(n,{code:L.invalid_type,expected:B.void,received:n.parsedType}),ae}return nt(e.data)}}Dl.create=t=>new Dl({typeName:U.ZodVoid,...ce(t)});class gt extends fe{_parse(e){const{ctx:r,status:n}=this._processInputParams(e),s=this._def;if(r.parsedType!==B.array)return J(r,{code:L.invalid_type,expected:B.array,received:r.parsedType}),ae;if(s.exactLength!==null){const i=r.data.length>s.exactLength.value,o=r.data.length<s.exactLength.value;(i||o)&&(J(r,{code:i?L.too_big:L.too_small,minimum:o?s.exactLength.value:void 0,maximum:i?s.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:s.exactLength.message}),n.dirty())}if(s.minLength!==null&&r.data.length<s.minLength.value&&(J(r,{code:L.too_small,minimum:s.minLength.value,type:"array",inclusive:!0,exact:!1,message:s.minLength.message}),n.dirty()),s.maxLength!==null&&r.data.length>s.maxLength.value&&(J(r,{code:L.too_big,maximum:s.maxLength.value,type:"array",inclusive:!0,exact:!1,message:s.maxLength.message}),n.dirty()),r.common.async)return Promise.all([...r.data].map((i,o)=>s.type._parseAsync(new Ot(r,i,r.path,o)))).then(i=>rt.mergeArray(n,i));const a=[...r.data].map((i,o)=>s.type._parseSync(new Ot(r,i,r.path,o)));return rt.mergeArray(n,a)}get element(){return this._def.type}min(e,r){return new gt({...this._def,minLength:{value:e,message:X.toString(r)}})}max(e,r){return new gt({...this._def,maxLength:{value:e,message:X.toString(r)}})}length(e,r){return new gt({...this._def,exactLength:{value:e,message:X.toString(r)}})}nonempty(e){return this.min(1,e)}}gt.create=(t,e)=>new gt({type:t,minLength:null,maxLength:null,exactLength:null,typeName:U.ZodArray,...ce(e)});function or(t){if(t instanceof Ie){const e={};for(const r in t.shape){const n=t.shape[r];e[r]=At.create(or(n))}return new Ie({...t._def,shape:()=>e})}else return t instanceof gt?new gt({...t._def,type:or(t.element)}):t instanceof At?At.create(or(t.unwrap())):t instanceof lr?lr.create(or(t.unwrap())):t instanceof Kt?Kt.create(t.items.map(e=>or(e))):t}class Ie extends fe{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const e=this._def.shape(),r=me.objectKeys(e);return this._cached={shape:e,keys:r},this._cached}_parse(e){if(this._getType(e)!==B.object){const l=this._getOrReturnCtx(e);return J(l,{code:L.invalid_type,expected:B.object,received:l.parsedType}),ae}const{status:n,ctx:s}=this._processInputParams(e),{shape:a,keys:i}=this._getCached(),o=[];if(!(this._def.catchall instanceof Nt&&this._def.unknownKeys==="strip"))for(const l in s.data)i.includes(l)||o.push(l);const c=[];for(const l of i){const u=a[l],f=s.data[l];c.push({key:{status:"valid",value:l},value:u._parse(new Ot(s,f,s.path,l)),alwaysSet:l in s.data})}if(this._def.catchall instanceof Nt){const l=this._def.unknownKeys;if(l==="passthrough")for(const u of o)c.push({key:{status:"valid",value:u},value:{status:"valid",value:s.data[u]}});else if(l==="strict")o.length>0&&(J(s,{code:L.unrecognized_keys,keys:o}),n.dirty());else if(l!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const l=this._def.catchall;for(const u of o){const f=s.data[u];c.push({key:{status:"valid",value:u},value:l._parse(new Ot(s,f,s.path,u)),alwaysSet:u in s.data})}}return s.common.async?Promise.resolve().then(async()=>{const l=[];for(const u of c){const f=await u.key,y=await u.value;l.push({key:f,value:y,alwaysSet:u.alwaysSet})}return l}).then(l=>rt.mergeObjectSync(n,l)):rt.mergeObjectSync(n,c)}get shape(){return this._def.shape()}strict(e){return X.errToObj,new Ie({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(r,n)=>{const s=this._def.errorMap?.(r,n).message??n.defaultError;return r.code==="unrecognized_keys"?{message:X.errToObj(e).message??s}:{message:s}}}:{}})}strip(){return new Ie({...this._def,unknownKeys:"strip"})}passthrough(){return new Ie({...this._def,unknownKeys:"passthrough"})}extend(e){return new Ie({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new Ie({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:U.ZodObject})}setKey(e,r){return this.augment({[e]:r})}catchall(e){return new Ie({...this._def,catchall:e})}pick(e){const r={};for(const n of me.objectKeys(e))e[n]&&this.shape[n]&&(r[n]=this.shape[n]);return new Ie({...this._def,shape:()=>r})}omit(e){const r={};for(const n of me.objectKeys(this.shape))e[n]||(r[n]=this.shape[n]);return new Ie({...this._def,shape:()=>r})}deepPartial(){return or(this)}partial(e){const r={};for(const n of me.objectKeys(this.shape)){const s=this.shape[n];e&&!e[n]?r[n]=s:r[n]=s.optional()}return new Ie({...this._def,shape:()=>r})}required(e){const r={};for(const n of me.objectKeys(this.shape))if(e&&!e[n])r[n]=this.shape[n];else{let a=this.shape[n];for(;a instanceof At;)a=a._def.innerType;r[n]=a}return new Ie({...this._def,shape:()=>r})}keyof(){return Wl(me.objectKeys(this.shape))}}Ie.create=(t,e)=>new Ie({shape:()=>t,unknownKeys:"strip",catchall:Nt.create(),typeName:U.ZodObject,...ce(e)}),Ie.strictCreate=(t,e)=>new Ie({shape:()=>t,unknownKeys:"strict",catchall:Nt.create(),typeName:U.ZodObject,...ce(e)}),Ie.lazycreate=(t,e)=>new Ie({shape:t,unknownKeys:"strip",catchall:Nt.create(),typeName:U.ZodObject,...ce(e)});class Ts extends fe{_parse(e){const{ctx:r}=this._processInputParams(e),n=this._def.options;function s(a){for(const o of a)if(o.result.status==="valid")return o.result;for(const o of a)if(o.result.status==="dirty")return r.common.issues.push(...o.ctx.common.issues),o.result;const i=a.map(o=>new St(o.ctx.common.issues));return J(r,{code:L.invalid_union,unionErrors:i}),ae}if(r.common.async)return Promise.all(n.map(async a=>{const i={...r,common:{...r.common,issues:[]},parent:null};return{result:await a._parseAsync({data:r.data,path:r.path,parent:i}),ctx:i}})).then(s);{let a;const i=[];for(const c of n){const l={...r,common:{...r.common,issues:[]},parent:null},u=c._parseSync({data:r.data,path:r.path,parent:l});if(u.status==="valid")return u;u.status==="dirty"&&!a&&(a={result:u,ctx:l}),l.common.issues.length&&i.push(l.common.issues)}if(a)return r.common.issues.push(...a.ctx.common.issues),a.result;const o=i.map(c=>new St(c));return J(r,{code:L.invalid_union,unionErrors:o}),ae}}get options(){return this._def.options}}Ts.create=(t,e)=>new Ts({options:t,typeName:U.ZodUnion,...ce(e)});function Va(t,e){const r=It(t),n=It(e);if(t===e)return{valid:!0,data:t};if(r===B.object&&n===B.object){const s=me.objectKeys(e),a=me.objectKeys(t).filter(o=>s.indexOf(o)!==-1),i={...t,...e};for(const o of a){const c=Va(t[o],e[o]);if(!c.valid)return{valid:!1};i[o]=c.data}return{valid:!0,data:i}}else if(r===B.array&&n===B.array){if(t.length!==e.length)return{valid:!1};const s=[];for(let a=0;a<t.length;a++){const i=t[a],o=e[a],c=Va(i,o);if(!c.valid)return{valid:!1};s.push(c.data)}return{valid:!0,data:s}}else return r===B.date&&n===B.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}class Rs extends fe{_parse(e){const{status:r,ctx:n}=this._processInputParams(e),s=(a,i)=>{if(Ol(a)||Ol(i))return ae;const o=Va(a.value,i.value);return o.valid?((Nl(a)||Nl(i))&&r.dirty(),{status:r.value,value:o.data}):(J(n,{code:L.invalid_intersection_types}),ae)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([a,i])=>s(a,i)):s(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}}Rs.create=(t,e,r)=>new Rs({left:t,right:e,typeName:U.ZodIntersection,...ce(r)});class Kt extends fe{_parse(e){const{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==B.array)return J(n,{code:L.invalid_type,expected:B.array,received:n.parsedType}),ae;if(n.data.length<this._def.items.length)return J(n,{code:L.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),ae;!this._def.rest&&n.data.length>this._def.items.length&&(J(n,{code:L.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());const a=[...n.data].map((i,o)=>{const c=this._def.items[o]||this._def.rest;return c?c._parse(new Ot(n,i,n.path,o)):null}).filter(i=>!!i);return n.common.async?Promise.all(a).then(i=>rt.mergeArray(r,i)):rt.mergeArray(r,a)}get items(){return this._def.items}rest(e){return new Kt({...this._def,rest:e})}}Kt.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Kt({items:t,typeName:U.ZodTuple,rest:null,...ce(e)})};class Vl extends fe{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==B.map)return J(n,{code:L.invalid_type,expected:B.map,received:n.parsedType}),ae;const s=this._def.keyType,a=this._def.valueType,i=[...n.data.entries()].map(([o,c],l)=>({key:s._parse(new Ot(n,o,n.path,[l,"key"])),value:a._parse(new Ot(n,c,n.path,[l,"value"]))}));if(n.common.async){const o=new Map;return Promise.resolve().then(async()=>{for(const c of i){const l=await c.key,u=await c.value;if(l.status==="aborted"||u.status==="aborted")return ae;(l.status==="dirty"||u.status==="dirty")&&r.dirty(),o.set(l.value,u.value)}return{status:r.value,value:o}})}else{const o=new Map;for(const c of i){const l=c.key,u=c.value;if(l.status==="aborted"||u.status==="aborted")return ae;(l.status==="dirty"||u.status==="dirty")&&r.dirty(),o.set(l.value,u.value)}return{status:r.value,value:o}}}}Vl.create=(t,e,r)=>new Vl({valueType:e,keyType:t,typeName:U.ZodMap,...ce(r)});class Ur extends fe{_parse(e){const{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==B.set)return J(n,{code:L.invalid_type,expected:B.set,received:n.parsedType}),ae;const s=this._def;s.minSize!==null&&n.data.size<s.minSize.value&&(J(n,{code:L.too_small,minimum:s.minSize.value,type:"set",inclusive:!0,exact:!1,message:s.minSize.message}),r.dirty()),s.maxSize!==null&&n.data.size>s.maxSize.value&&(J(n,{code:L.too_big,maximum:s.maxSize.value,type:"set",inclusive:!0,exact:!1,message:s.maxSize.message}),r.dirty());const a=this._def.valueType;function i(c){const l=new Set;for(const u of c){if(u.status==="aborted")return ae;u.status==="dirty"&&r.dirty(),l.add(u.value)}return{status:r.value,value:l}}const o=[...n.data.values()].map((c,l)=>a._parse(new Ot(n,c,n.path,l)));return n.common.async?Promise.all(o).then(c=>i(c)):i(o)}min(e,r){return new Ur({...this._def,minSize:{value:e,message:X.toString(r)}})}max(e,r){return new Ur({...this._def,maxSize:{value:e,message:X.toString(r)}})}size(e,r){return this.min(e,r).max(e,r)}nonempty(e){return this.min(1,e)}}Ur.create=(t,e)=>new Ur({valueType:t,minSize:null,maxSize:null,typeName:U.ZodSet,...ce(e)});class Fl extends fe{get schema(){return this._def.getter()}_parse(e){const{ctx:r}=this._processInputParams(e);return this._def.getter()._parse({data:r.data,path:r.path,parent:r})}}Fl.create=(t,e)=>new Fl({getter:t,typeName:U.ZodLazy,...ce(e)});class Hl extends fe{_parse(e){if(e.data!==this._def.value){const r=this._getOrReturnCtx(e);return J(r,{received:r.data,code:L.invalid_literal,expected:this._def.value}),ae}return{status:"valid",value:e.data}}get value(){return this._def.value}}Hl.create=(t,e)=>new Hl({value:t,typeName:U.ZodLiteral,...ce(e)});function Wl(t,e){return new cr({values:t,typeName:U.ZodEnum,...ce(e)})}class cr extends fe{_parse(e){if(typeof e.data!="string"){const r=this._getOrReturnCtx(e),n=this._def.values;return J(r,{expected:me.joinValues(n),received:r.parsedType,code:L.invalid_type}),ae}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){const r=this._getOrReturnCtx(e),n=this._def.values;return J(r,{received:r.data,code:L.invalid_enum_value,options:n}),ae}return nt(e.data)}get options(){return this._def.values}get enum(){const e={};for(const r of this._def.values)e[r]=r;return e}get Values(){const e={};for(const r of this._def.values)e[r]=r;return e}get Enum(){const e={};for(const r of this._def.values)e[r]=r;return e}extract(e,r=this._def){return cr.create(e,{...this._def,...r})}exclude(e,r=this._def){return cr.create(this.options.filter(n=>!e.includes(n)),{...this._def,...r})}}cr.create=Wl;class Kl extends fe{_parse(e){const r=me.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==B.string&&n.parsedType!==B.number){const s=me.objectValues(r);return J(n,{expected:me.joinValues(s),received:n.parsedType,code:L.invalid_type}),ae}if(this._cache||(this._cache=new Set(me.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){const s=me.objectValues(r);return J(n,{received:n.data,code:L.invalid_enum_value,options:s}),ae}return nt(e.data)}get enum(){return this._def.values}}Kl.create=(t,e)=>new Kl({values:t,typeName:U.ZodNativeEnum,...ce(e)});class Ps extends fe{unwrap(){return this._def.type}_parse(e){const{ctx:r}=this._processInputParams(e);if(r.parsedType!==B.promise&&r.common.async===!1)return J(r,{code:L.invalid_type,expected:B.promise,received:r.parsedType}),ae;const n=r.parsedType===B.promise?r.data:Promise.resolve(r.data);return nt(n.then(s=>this._def.type.parseAsync(s,{path:r.path,errorMap:r.common.contextualErrorMap})))}}Ps.create=(t,e)=>new Ps({type:t,typeName:U.ZodPromise,...ce(e)});class ur extends fe{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===U.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:r,ctx:n}=this._processInputParams(e),s=this._def.effect||null,a={addIssue:i=>{J(n,i),i.fatal?r.abort():r.dirty()},get path(){return n.path}};if(a.addIssue=a.addIssue.bind(a),s.type==="preprocess"){const i=s.transform(n.data,a);if(n.common.async)return Promise.resolve(i).then(async o=>{if(r.value==="aborted")return ae;const c=await this._def.schema._parseAsync({data:o,path:n.path,parent:n});return c.status==="aborted"?ae:c.status==="dirty"||r.value==="dirty"?Zr(c.value):c});{if(r.value==="aborted")return ae;const o=this._def.schema._parseSync({data:i,path:n.path,parent:n});return o.status==="aborted"?ae:o.status==="dirty"||r.value==="dirty"?Zr(o.value):o}}if(s.type==="refinement"){const i=o=>{const c=s.refinement(o,a);if(n.common.async)return Promise.resolve(c);if(c instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return o};if(n.common.async===!1){const o=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return o.status==="aborted"?ae:(o.status==="dirty"&&r.dirty(),i(o.value),{status:r.value,value:o.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(o=>o.status==="aborted"?ae:(o.status==="dirty"&&r.dirty(),i(o.value).then(()=>({status:r.value,value:o.value}))))}if(s.type==="transform")if(n.common.async===!1){const i=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!ir(i))return ae;const o=s.transform(i.value,a);if(o instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:o}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(i=>ir(i)?Promise.resolve(s.transform(i.value,a)).then(o=>({status:r.value,value:o})):ae);me.assertNever(s)}}ur.create=(t,e,r)=>new ur({schema:t,typeName:U.ZodEffects,effect:e,...ce(r)}),ur.createWithPreprocess=(t,e,r)=>new ur({schema:e,effect:{type:"preprocess",transform:t},typeName:U.ZodEffects,...ce(r)});class At extends fe{_parse(e){return this._getType(e)===B.undefined?nt(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}At.create=(t,e)=>new At({innerType:t,typeName:U.ZodOptional,...ce(e)});class lr extends fe{_parse(e){return this._getType(e)===B.null?nt(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}lr.create=(t,e)=>new lr({innerType:t,typeName:U.ZodNullable,...ce(e)});class Fa extends fe{_parse(e){const{ctx:r}=this._processInputParams(e);let n=r.data;return r.parsedType===B.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}}Fa.create=(t,e)=>new Fa({innerType:t,typeName:U.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...ce(e)});class Ha extends fe{_parse(e){const{ctx:r}=this._processInputParams(e),n={...r,common:{...r.common,issues:[]}},s=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return $s(s)?s.then(a=>({status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new St(n.common.issues)},input:n.data})})):{status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new St(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}}Ha.create=(t,e)=>new Ha({innerType:t,typeName:U.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...ce(e)});class Jl extends fe{_parse(e){if(this._getType(e)!==B.nan){const n=this._getOrReturnCtx(e);return J(n,{code:L.invalid_type,expected:B.nan,received:n.parsedType}),ae}return{status:"valid",value:e.data}}}Jl.create=t=>new Jl({typeName:U.ZodNaN,...ce(t)});class $g extends fe{_parse(e){const{ctx:r}=this._processInputParams(e),n=r.data;return this._def.type._parse({data:n,path:r.path,parent:r})}unwrap(){return this._def.type}}class Wa extends fe{_parse(e){const{status:r,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{const a=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return a.status==="aborted"?ae:a.status==="dirty"?(r.dirty(),Zr(a.value)):this._def.out._parseAsync({data:a.value,path:n.path,parent:n})})();{const s=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return s.status==="aborted"?ae:s.status==="dirty"?(r.dirty(),{status:"dirty",value:s.value}):this._def.out._parseSync({data:s.value,path:n.path,parent:n})}}static create(e,r){return new Wa({in:e,out:r,typeName:U.ZodPipeline})}}class Ka extends fe{_parse(e){const r=this._def.innerType._parse(e),n=s=>(ir(s)&&(s.value=Object.freeze(s.value)),s);return $s(r)?r.then(s=>n(s)):n(r)}unwrap(){return this._def.innerType}}Ka.create=(t,e)=>new Ka({innerType:t,typeName:U.ZodReadonly,...ce(e)});var U;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(U||(U={})),Nt.create,gt.create;const Eg=Ie.create;Ts.create,Rs.create,Kt.create,cr.create,Ps.create,At.create,lr.create;const Tg=A("ZodMiniType",(t,e)=>{if(!t._zod)throw new Error("Uninitialized schema in ZodMiniType.");Se.init(t,e),t.def=e,t.parse=(r,n)=>Xf(t,r,n,{callee:t.parse}),t.safeParse=(r,n)=>ra(t,r,n),t.parseAsync=async(r,n)=>eh(t,r,n,{callee:t.parseAsync}),t.safeParseAsync=async(r,n)=>na(t,r,n),t.check=(...r)=>t.clone({...e,checks:[...e.checks??[],...r.map(n=>typeof n=="function"?{_zod:{check:n,def:{check:"custom"},onattach:[]}}:n)]}),t.clone=(r,n)=>Rt(t,r,n),t.brand=()=>t,t.register=((r,n)=>(r.add(t,n),t))}),Rg=A("ZodMiniObject",(t,e)=>{Pc.init(t,e),Tg.init(t,e),ke(t,"shape",()=>e.shape)});function Gl(t,e){const r={type:"object",get shape(){return kr(this,"shape",{...t}),this.shape},...Q(e)};return new Rg(r)}function st(t){return!!t._zod}function Dr(t){const e=Object.values(t);if(e.length===0)return Gl({});const r=e.every(st),n=e.every(s=>!st(s));if(r)return Gl(t);if(n)return Eg(t);throw new Error("Mixed Zod versions detected in object shape.")}function ut(t,e){return st(t)?ra(t,e):t.safeParse(e)}async function Ja(t,e){return st(t)?await na(t,e):await t.safeParseAsync(e)}function dr(t){var e,r;if(!t)return;let n;if(st(t)?n=(r=(e=t._zod)===null||e===void 0?void 0:e.def)===null||r===void 0?void 0:r.shape:n=t.shape,!!n){if(typeof n=="function")try{return n()}catch{return}return n}}function Vr(t){var e;if(t){if(typeof t=="object"){const r=t,n=t;if(!r._def&&!n._zod){const s=Object.values(t);if(s.length>0&&s.every(a=>typeof a=="object"&&a!==null&&(a._def!==void 0||a._zod!==void 0||typeof a.parse=="function")))return Dr(t)}}if(st(t)){const n=(e=t._zod)===null||e===void 0?void 0:e.def;if(n&&(n.type==="object"||n.shape!==void 0))return t}else if(t.shape!==void 0)return t}}function Ga(t){if(t&&typeof t=="object"){if("message"in t&&typeof t.message=="string")return t.message;if("issues"in t&&Array.isArray(t.issues)&&t.issues.length>0){const e=t.issues[0];if(e&&typeof e=="object"&&"message"in e)return String(e.message)}try{return JSON.stringify(t)}catch{return String(t)}}return String(t)}function Pg(t){var e,r,n,s;if(st(t))return(r=(e=t._zod)===null||e===void 0?void 0:e.def)===null||r===void 0?void 0:r.description;const a=t;return(n=t.description)!==null&&n!==void 0?n:(s=a._def)===null||s===void 0?void 0:s.description}function Cg(t){var e,r,n;if(st(t))return((r=(e=t._zod)===null||e===void 0?void 0:e.def)===null||r===void 0?void 0:r.type)==="optional";const s=t;return typeof t.isOptional=="function"?t.isOptional():((n=s._def)===null||n===void 0?void 0:n.typeName)==="ZodOptional"}function Bl(t){var e;if(st(t)){const i=(e=t._zod)===null||e===void 0?void 0:e.def;if(i){if(i.value!==void 0)return i.value;if(Array.isArray(i.values)&&i.values.length>0)return i.values[0]}}const n=t._def;if(n){if(n.value!==void 0)return n.value;if(Array.isArray(n.values)&&n.values.length>0)return n.values[0]}const s=t.value;if(s!==void 0)return s}function Jt(t){return t==="completed"||t==="failed"||t==="cancelled"}const Ig=Symbol("Let zodToJsonSchema decide on which parser to use"),Yl={name:void 0,$refStrategy:"root",basePath:["#"],effectStrategy:"input",pipeStrategy:"all",dateStrategy:"format:date-time",mapStrategy:"entries",removeAdditionalStrategy:"passthrough",allowedAdditionalProperties:!0,rejectedAdditionalProperties:!1,definitionPath:"definitions",target:"jsonSchema7",strictUnions:!1,definitions:{},errorMessages:!1,markdownDescription:!1,patternStrategy:"escape",applyRegexFlags:!1,emailStrategy:"format:email",base64Strategy:"contentEncoding:base64",nameStrategy:"ref",openAiAnyTypeName:"OpenAiAnyType"},Og=t=>typeof t=="string"?{...Yl,name:t}:{...Yl,...t},Ng=t=>{const e=Og(t),r=e.name!==void 0?[...e.basePath,e.definitionPath,e.name]:e.basePath;return{...e,flags:{hasReferencedOpenAiAnyType:!1},currentPath:r,propertyPath:void 0,seen:new Map(Object.entries(e.definitions).map(([n,s])=>[s._def,{def:s._def,path:[...e.basePath,e.definitionPath,n],jsonSchema:void 0}]))}};function Ql(t,e,r,n){n?.errorMessages&&r&&(t.errorMessage={...t.errorMessage,[e]:r})}function ye(t,e,r,n,s){t[e]=r,Ql(t,e,n,s)}const Xl=(t,e)=>{let r=0;for(;r<t.length&&r<e.length&&t[r]===e[r];r++);return[(t.length-r).toString(),...e.slice(r)].join("/")};function Be(t){if(t.target!=="openAi")return{};const e=[...t.basePath,t.definitionPath,t.openAiAnyTypeName];return t.flags.hasReferencedOpenAiAnyType=!0,{$ref:t.$refStrategy==="relative"?Xl(e,t.currentPath):e.join("/")}}function Ag(t,e){const r={type:"array"};return t.type?._def&&t.type?._def?.typeName!==U.ZodAny&&(r.items=pe(t.type._def,{...e,currentPath:[...e.currentPath,"items"]})),t.minLength&&ye(r,"minItems",t.minLength.value,t.minLength.message,e),t.maxLength&&ye(r,"maxItems",t.maxLength.value,t.maxLength.message,e),t.exactLength&&(ye(r,"minItems",t.exactLength.value,t.exactLength.message,e),ye(r,"maxItems",t.exactLength.value,t.exactLength.message,e)),r}function jg(t,e){const r={type:"integer",format:"int64"};if(!t.checks)return r;for(const n of t.checks)switch(n.kind){case"min":e.target==="jsonSchema7"?n.inclusive?ye(r,"minimum",n.value,n.message,e):ye(r,"exclusiveMinimum",n.value,n.message,e):(n.inclusive||(r.exclusiveMinimum=!0),ye(r,"minimum",n.value,n.message,e));break;case"max":e.target==="jsonSchema7"?n.inclusive?ye(r,"maximum",n.value,n.message,e):ye(r,"exclusiveMaximum",n.value,n.message,e):(n.inclusive||(r.exclusiveMaximum=!0),ye(r,"maximum",n.value,n.message,e));break;case"multipleOf":ye(r,"multipleOf",n.value,n.message,e);break}return r}function zg(){return{type:"boolean"}}function ed(t,e){return pe(t.type._def,e)}const Mg=(t,e)=>pe(t.innerType._def,e);function td(t,e,r){const n=r??e.dateStrategy;if(Array.isArray(n))return{anyOf:n.map((s,a)=>td(t,e,s))};switch(n){case"string":case"format:date-time":return{type:"string",format:"date-time"};case"format:date":return{type:"string",format:"date"};case"integer":return qg(t,e)}}const qg=(t,e)=>{const r={type:"integer",format:"unix-time"};if(e.target==="openApi3")return r;for(const n of t.checks)switch(n.kind){case"min":ye(r,"minimum",n.value,n.message,e);break;case"max":ye(r,"maximum",n.value,n.message,e);break}return r};function Zg(t,e){return{...pe(t.innerType._def,e),default:t.defaultValue()}}function xg(t,e){return e.effectStrategy==="input"?pe(t.schema._def,e):Be(e)}function Lg(t){return{type:"string",enum:Array.from(t.values)}}const Ug=t=>"type"in t&&t.type==="string"?!1:"allOf"in t;function Dg(t,e){const r=[pe(t.left._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),pe(t.right._def,{...e,currentPath:[...e.currentPath,"allOf","1"]})].filter(a=>!!a);let n=e.target==="jsonSchema2019-09"?{unevaluatedProperties:!1}:void 0;const s=[];return r.forEach(a=>{if(Ug(a))s.push(...a.allOf),a.unevaluatedProperties===void 0&&(n=void 0);else{let i=a;if("additionalProperties"in a&&a.additionalProperties===!1){const{additionalProperties:o,...c}=a;i=c}else n=void 0;s.push(i)}}),s.length?{allOf:s,...n}:void 0}function Vg(t,e){const r=typeof t.value;return r!=="bigint"&&r!=="number"&&r!=="boolean"&&r!=="string"?{type:Array.isArray(t.value)?"array":"object"}:e.target==="openApi3"?{type:r==="bigint"?"integer":r,enum:[t.value]}:{type:r==="bigint"?"integer":r,const:t.value}}let Ba;const lt={cuid:/^[cC][^\s-]{8,}$/,cuid2:/^[0-9a-z]+$/,ulid:/^[0-9A-HJKMNP-TV-Z]{26}$/,email:/^(?!\.)(?!.*\.\.)([a-zA-Z0-9_'+\-\.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9\-]*\.)+[a-zA-Z]{2,}$/,emoji:()=>(Ba===void 0&&(Ba=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),Ba),uuid:/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/,ipv4:/^(?:(?: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])$/,ipv4Cidr:/^(?:(?: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])\/(3[0-2]|[12]?[0-9])$/,ipv6:/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,ipv6Cidr:/^(([0-9a-fA-F]{1,4}:){7,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}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,base64:/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,base64url:/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,nanoid:/^[a-zA-Z0-9_-]{21}$/,jwt:/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/};function rd(t,e){const r={type:"string"};if(t.checks)for(const n of t.checks)switch(n.kind){case"min":ye(r,"minLength",typeof r.minLength=="number"?Math.max(r.minLength,n.value):n.value,n.message,e);break;case"max":ye(r,"maxLength",typeof r.maxLength=="number"?Math.min(r.maxLength,n.value):n.value,n.message,e);break;case"email":switch(e.emailStrategy){case"format:email":dt(r,"email",n.message,e);break;case"format:idn-email":dt(r,"idn-email",n.message,e);break;case"pattern:zod":Fe(r,lt.email,n.message,e);break}break;case"url":dt(r,"uri",n.message,e);break;case"uuid":dt(r,"uuid",n.message,e);break;case"regex":Fe(r,n.regex,n.message,e);break;case"cuid":Fe(r,lt.cuid,n.message,e);break;case"cuid2":Fe(r,lt.cuid2,n.message,e);break;case"startsWith":Fe(r,RegExp(`^${Ya(n.value,e)}`),n.message,e);break;case"endsWith":Fe(r,RegExp(`${Ya(n.value,e)}$`),n.message,e);break;case"datetime":dt(r,"date-time",n.message,e);break;case"date":dt(r,"date",n.message,e);break;case"time":dt(r,"time",n.message,e);break;case"duration":dt(r,"duration",n.message,e);break;case"length":ye(r,"minLength",typeof r.minLength=="number"?Math.max(r.minLength,n.value):n.value,n.message,e),ye(r,"maxLength",typeof r.maxLength=="number"?Math.min(r.maxLength,n.value):n.value,n.message,e);break;case"includes":{Fe(r,RegExp(Ya(n.value,e)),n.message,e);break}case"ip":{n.version!=="v6"&&dt(r,"ipv4",n.message,e),n.version!=="v4"&&dt(r,"ipv6",n.message,e);break}case"base64url":Fe(r,lt.base64url,n.message,e);break;case"jwt":Fe(r,lt.jwt,n.message,e);break;case"cidr":{n.version!=="v6"&&Fe(r,lt.ipv4Cidr,n.message,e),n.version!=="v4"&&Fe(r,lt.ipv6Cidr,n.message,e);break}case"emoji":Fe(r,lt.emoji(),n.message,e);break;case"ulid":{Fe(r,lt.ulid,n.message,e);break}case"base64":{switch(e.base64Strategy){case"format:binary":{dt(r,"binary",n.message,e);break}case"contentEncoding:base64":{ye(r,"contentEncoding","base64",n.message,e);break}case"pattern:zod":{Fe(r,lt.base64,n.message,e);break}}break}case"nanoid":Fe(r,lt.nanoid,n.message,e)}return r}function Ya(t,e){return e.patternStrategy==="escape"?Hg(t):t}const Fg=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function Hg(t){let e="";for(let r=0;r<t.length;r++)Fg.has(t[r])||(e+="\\"),e+=t[r];return e}function dt(t,e,r,n){t.format||t.anyOf?.some(s=>s.format)?(t.anyOf||(t.anyOf=[]),t.format&&(t.anyOf.push({format:t.format,...t.errorMessage&&n.errorMessages&&{errorMessage:{format:t.errorMessage.format}}}),delete t.format,t.errorMessage&&(delete t.errorMessage.format,Object.keys(t.errorMessage).length===0&&delete t.errorMessage)),t.anyOf.push({format:e,...r&&n.errorMessages&&{errorMessage:{format:r}}})):ye(t,"format",e,r,n)}function Fe(t,e,r,n){t.pattern||t.allOf?.some(s=>s.pattern)?(t.allOf||(t.allOf=[]),t.pattern&&(t.allOf.push({pattern:t.pattern,...t.errorMessage&&n.errorMessages&&{errorMessage:{pattern:t.errorMessage.pattern}}}),delete t.pattern,t.errorMessage&&(delete t.errorMessage.pattern,Object.keys(t.errorMessage).length===0&&delete t.errorMessage)),t.allOf.push({pattern:nd(e,n),...r&&n.errorMessages&&{errorMessage:{pattern:r}}})):ye(t,"pattern",nd(e,n),r,n)}function nd(t,e){if(!e.applyRegexFlags||!t.flags)return t.source;const r={i:t.flags.includes("i"),m:t.flags.includes("m"),s:t.flags.includes("s")},n=r.i?t.source.toLowerCase():t.source;let s="",a=!1,i=!1,o=!1;for(let c=0;c<n.length;c++){if(a){s+=n[c],a=!1;continue}if(r.i){if(i){if(n[c].match(/[a-z]/)){o?(s+=n[c],s+=`${n[c-2]}-${n[c]}`.toUpperCase(),o=!1):n[c+1]==="-"&&n[c+2]?.match(/[a-z]/)?(s+=n[c],o=!0):s+=`${n[c]}${n[c].toUpperCase()}`;continue}}else if(n[c].match(/[a-z]/)){s+=`[${n[c]}${n[c].toUpperCase()}]`;continue}}if(r.m){if(n[c]==="^"){s+=`(^|(?<=[\r
36
+ ]))`;continue}else if(n[c]==="$"){s+=`($|(?=[\r
37
+ ]))`;continue}}if(r.s&&n[c]==="."){s+=i?`${n[c]}\r
38
+ `:`[${n[c]}\r
39
+ ]`;continue}s+=n[c],n[c]==="\\"?a=!0:i&&n[c]==="]"?i=!1:!i&&n[c]==="["&&(i=!0)}try{new RegExp(s)}catch{return console.warn(`Could not convert regex pattern at ${e.currentPath.join("/")} to a flag-independent form! Falling back to the flag-ignorant source`),t.source}return s}function sd(t,e){if(e.target==="openAi"&&console.warn("Warning: OpenAI may not support records in schemas! Try an array of key-value pairs instead."),e.target==="openApi3"&&t.keyType?._def.typeName===U.ZodEnum)return{type:"object",required:t.keyType._def.values,properties:t.keyType._def.values.reduce((n,s)=>({...n,[s]:pe(t.valueType._def,{...e,currentPath:[...e.currentPath,"properties",s]})??Be(e)}),{}),additionalProperties:e.rejectedAdditionalProperties};const r={type:"object",additionalProperties:pe(t.valueType._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]})??e.allowedAdditionalProperties};if(e.target==="openApi3")return r;if(t.keyType?._def.typeName===U.ZodString&&t.keyType._def.checks?.length){const{type:n,...s}=rd(t.keyType._def,e);return{...r,propertyNames:s}}else{if(t.keyType?._def.typeName===U.ZodEnum)return{...r,propertyNames:{enum:t.keyType._def.values}};if(t.keyType?._def.typeName===U.ZodBranded&&t.keyType._def.type._def.typeName===U.ZodString&&t.keyType._def.type._def.checks?.length){const{type:n,...s}=ed(t.keyType._def,e);return{...r,propertyNames:s}}}return r}function Wg(t,e){if(e.mapStrategy==="record")return sd(t,e);const r=pe(t.keyType._def,{...e,currentPath:[...e.currentPath,"items","items","0"]})||Be(e),n=pe(t.valueType._def,{...e,currentPath:[...e.currentPath,"items","items","1"]})||Be(e);return{type:"array",maxItems:125,items:{type:"array",items:[r,n],minItems:2,maxItems:2}}}function Kg(t){const e=t.values,n=Object.keys(t.values).filter(a=>typeof e[e[a]]!="number").map(a=>e[a]),s=Array.from(new Set(n.map(a=>typeof a)));return{type:s.length===1?s[0]==="string"?"string":"number":["string","number"],enum:n}}function Jg(t){return t.target==="openAi"?void 0:{not:Be({...t,currentPath:[...t.currentPath,"not"]})}}function Gg(t){return t.target==="openApi3"?{enum:["null"],nullable:!0}:{type:"null"}}const Cs={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};function Bg(t,e){if(e.target==="openApi3")return ad(t,e);const r=t.options instanceof Map?Array.from(t.options.values()):t.options;if(r.every(n=>n._def.typeName in Cs&&(!n._def.checks||!n._def.checks.length))){const n=r.reduce((s,a)=>{const i=Cs[a._def.typeName];return i&&!s.includes(i)?[...s,i]:s},[]);return{type:n.length>1?n:n[0]}}else if(r.every(n=>n._def.typeName==="ZodLiteral"&&!n.description)){const n=r.reduce((s,a)=>{const i=typeof a._def.value;switch(i){case"string":case"number":case"boolean":return[...s,i];case"bigint":return[...s,"integer"];case"object":if(a._def.value===null)return[...s,"null"];case"symbol":case"undefined":case"function":default:return s}},[]);if(n.length===r.length){const s=n.filter((a,i,o)=>o.indexOf(a)===i);return{type:s.length>1?s:s[0],enum:r.reduce((a,i)=>a.includes(i._def.value)?a:[...a,i._def.value],[])}}}else if(r.every(n=>n._def.typeName==="ZodEnum"))return{type:"string",enum:r.reduce((n,s)=>[...n,...s._def.values.filter(a=>!n.includes(a))],[])};return ad(t,e)}const ad=(t,e)=>{const r=(t.options instanceof Map?Array.from(t.options.values()):t.options).map((n,s)=>pe(n._def,{...e,currentPath:[...e.currentPath,"anyOf",`${s}`]})).filter(n=>!!n&&(!e.strictUnions||typeof n=="object"&&Object.keys(n).length>0));return r.length?{anyOf:r}:void 0};function Yg(t,e){if(["ZodString","ZodNumber","ZodBigInt","ZodBoolean","ZodNull"].includes(t.innerType._def.typeName)&&(!t.innerType._def.checks||!t.innerType._def.checks.length))return e.target==="openApi3"?{type:Cs[t.innerType._def.typeName],nullable:!0}:{type:[Cs[t.innerType._def.typeName],"null"]};if(e.target==="openApi3"){const n=pe(t.innerType._def,{...e,currentPath:[...e.currentPath]});return n&&"$ref"in n?{allOf:[n],nullable:!0}:n&&{...n,nullable:!0}}const r=pe(t.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","0"]});return r&&{anyOf:[r,{type:"null"}]}}function Qg(t,e){const r={type:"number"};if(!t.checks)return r;for(const n of t.checks)switch(n.kind){case"int":r.type="integer",Ql(r,"type",n.message,e);break;case"min":e.target==="jsonSchema7"?n.inclusive?ye(r,"minimum",n.value,n.message,e):ye(r,"exclusiveMinimum",n.value,n.message,e):(n.inclusive||(r.exclusiveMinimum=!0),ye(r,"minimum",n.value,n.message,e));break;case"max":e.target==="jsonSchema7"?n.inclusive?ye(r,"maximum",n.value,n.message,e):ye(r,"exclusiveMaximum",n.value,n.message,e):(n.inclusive||(r.exclusiveMaximum=!0),ye(r,"maximum",n.value,n.message,e));break;case"multipleOf":ye(r,"multipleOf",n.value,n.message,e);break}return r}function Xg(t,e){const r=e.target==="openAi",n={type:"object",properties:{}},s=[],a=t.shape();for(const o in a){let c=a[o];if(c===void 0||c._def===void 0)continue;let l=tv(c);l&&r&&(c._def.typeName==="ZodOptional"&&(c=c._def.innerType),c.isNullable()||(c=c.nullable()),l=!1);const u=pe(c._def,{...e,currentPath:[...e.currentPath,"properties",o],propertyPath:[...e.currentPath,"properties",o]});u!==void 0&&(n.properties[o]=u,l||s.push(o))}s.length&&(n.required=s);const i=ev(t,e);return i!==void 0&&(n.additionalProperties=i),n}function ev(t,e){if(t.catchall._def.typeName!=="ZodNever")return pe(t.catchall._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]});switch(t.unknownKeys){case"passthrough":return e.allowedAdditionalProperties;case"strict":return e.rejectedAdditionalProperties;case"strip":return e.removeAdditionalStrategy==="strict"?e.allowedAdditionalProperties:e.rejectedAdditionalProperties}}function tv(t){try{return t.isOptional()}catch{return!0}}const rv=(t,e)=>{if(e.currentPath.toString()===e.propertyPath?.toString())return pe(t.innerType._def,e);const r=pe(t.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","1"]});return r?{anyOf:[{not:Be(e)},r]}:Be(e)},nv=(t,e)=>{if(e.pipeStrategy==="input")return pe(t.in._def,e);if(e.pipeStrategy==="output")return pe(t.out._def,e);const r=pe(t.in._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),n=pe(t.out._def,{...e,currentPath:[...e.currentPath,"allOf",r?"1":"0"]});return{allOf:[r,n].filter(s=>s!==void 0)}};function sv(t,e){return pe(t.type._def,e)}function av(t,e){const n={type:"array",uniqueItems:!0,items:pe(t.valueType._def,{...e,currentPath:[...e.currentPath,"items"]})};return t.minSize&&ye(n,"minItems",t.minSize.value,t.minSize.message,e),t.maxSize&&ye(n,"maxItems",t.maxSize.value,t.maxSize.message,e),n}function iv(t,e){return t.rest?{type:"array",minItems:t.items.length,items:t.items.map((r,n)=>pe(r._def,{...e,currentPath:[...e.currentPath,"items",`${n}`]})).reduce((r,n)=>n===void 0?r:[...r,n],[]),additionalItems:pe(t.rest._def,{...e,currentPath:[...e.currentPath,"additionalItems"]})}:{type:"array",minItems:t.items.length,maxItems:t.items.length,items:t.items.map((r,n)=>pe(r._def,{...e,currentPath:[...e.currentPath,"items",`${n}`]})).reduce((r,n)=>n===void 0?r:[...r,n],[])}}function ov(t){return{not:Be(t)}}function cv(t){return Be(t)}const uv=(t,e)=>pe(t.innerType._def,e),lv=(t,e,r)=>{switch(e){case U.ZodString:return rd(t,r);case U.ZodNumber:return Qg(t,r);case U.ZodObject:return Xg(t,r);case U.ZodBigInt:return jg(t,r);case U.ZodBoolean:return zg();case U.ZodDate:return td(t,r);case U.ZodUndefined:return ov(r);case U.ZodNull:return Gg(r);case U.ZodArray:return Ag(t,r);case U.ZodUnion:case U.ZodDiscriminatedUnion:return Bg(t,r);case U.ZodIntersection:return Dg(t,r);case U.ZodTuple:return iv(t,r);case U.ZodRecord:return sd(t,r);case U.ZodLiteral:return Vg(t,r);case U.ZodEnum:return Lg(t);case U.ZodNativeEnum:return Kg(t);case U.ZodNullable:return Yg(t,r);case U.ZodOptional:return rv(t,r);case U.ZodMap:return Wg(t,r);case U.ZodSet:return av(t,r);case U.ZodLazy:return()=>t.getter()._def;case U.ZodPromise:return sv(t,r);case U.ZodNaN:case U.ZodNever:return Jg(r);case U.ZodEffects:return xg(t,r);case U.ZodAny:return Be(r);case U.ZodUnknown:return cv(r);case U.ZodDefault:return Zg(t,r);case U.ZodBranded:return ed(t,r);case U.ZodReadonly:return uv(t,r);case U.ZodCatch:return Mg(t,r);case U.ZodPipeline:return nv(t,r);case U.ZodFunction:case U.ZodVoid:case U.ZodSymbol:return;default:return(n=>{})()}};function pe(t,e,r=!1){const n=e.seen.get(t);if(e.override){const o=e.override?.(t,e,n,r);if(o!==Ig)return o}if(n&&!r){const o=dv(n,e);if(o!==void 0)return o}const s={def:t,path:e.currentPath,jsonSchema:void 0};e.seen.set(t,s);const a=lv(t,t.typeName,e),i=typeof a=="function"?pe(a(),e):a;if(i&&fv(t,e,i),e.postProcess){const o=e.postProcess(i,t,e);return s.jsonSchema=i,o}return s.jsonSchema=i,i}const dv=(t,e)=>{switch(e.$refStrategy){case"root":return{$ref:t.path.join("/")};case"relative":return{$ref:Xl(e.currentPath,t.path)};case"none":case"seen":return t.path.length<e.currentPath.length&&t.path.every((r,n)=>e.currentPath[n]===r)?(console.warn(`Recursive reference detected at ${e.currentPath.join("/")}! Defaulting to any`),Be(e)):e.$refStrategy==="seen"?Be(e):void 0}},fv=(t,e,r)=>(t.description&&(r.description=t.description,e.markdownDescription&&(r.markdownDescription=t.description)),r),hv=(t,e)=>{const r=Ng(e);let n=typeof e=="object"&&e.definitions?Object.entries(e.definitions).reduce((c,[l,u])=>({...c,[l]:pe(u._def,{...r,currentPath:[...r.basePath,r.definitionPath,l]},!0)??Be(r)}),{}):void 0;const s=typeof e=="string"?e:e?.nameStrategy==="title"?void 0:e?.name,a=pe(t._def,s===void 0?r:{...r,currentPath:[...r.basePath,r.definitionPath,s]},!1)??Be(r),i=typeof e=="object"&&e.name!==void 0&&e.nameStrategy==="title"?e.name:void 0;i!==void 0&&(a.title=i),r.flags.hasReferencedOpenAiAnyType&&(n||(n={}),n[r.openAiAnyTypeName]||(n[r.openAiAnyTypeName]={type:["string","number","integer","boolean","array","null"],items:{$ref:r.$refStrategy==="relative"?"1":[...r.basePath,r.definitionPath,r.openAiAnyTypeName].join("/")}}));const o=s===void 0?n?{...a,[r.definitionPath]:n}:a:{$ref:[...r.$refStrategy==="relative"?[]:r.basePath,r.definitionPath,s].join("/"),[r.definitionPath]:{...n,[s]:a}};return r.target==="jsonSchema7"?o.$schema="http://json-schema.org/draft-07/schema#":(r.target==="jsonSchema2019-09"||r.target==="openAi")&&(o.$schema="https://json-schema.org/draft/2019-09/schema#"),r.target==="openAi"&&("anyOf"in o||"oneOf"in o||"allOf"in o||"type"in o&&Array.isArray(o.type))&&console.warn("Warning: OpenAI may not support schemas with unions as roots! Try wrapping it in an object property."),o};function mv(t){return!t||t==="jsonSchema7"||t==="draft-7"?"draft-7":t==="jsonSchema2019-09"||t==="draft-2020-12"?"draft-2020-12":"draft-7"}function id(t,e){var r,n,s;return st(t)?Cp(t,{target:mv(e?.target),io:(r=e?.pipeStrategy)!==null&&r!==void 0?r:"input"}):hv(t,{strictUnions:(n=e?.strictUnions)!==null&&n!==void 0?n:!0,pipeStrategy:(s=e?.pipeStrategy)!==null&&s!==void 0?s:"input"})}function od(t){const e=dr(t),r=e?.method;if(!r)throw new Error("Schema is missing a method literal");const n=Bl(r);if(typeof n!="string")throw new Error("Schema method literal must be a string");return n}function cd(t,e){const r=ut(t,e);if(!r.success)throw r.error;return r.data}const ud=6e4;class Qa{constructor(e){this._options=e,this._requestMessageId=0,this._requestHandlers=new Map,this._requestHandlerAbortControllers=new Map,this._notificationHandlers=new Map,this._responseHandlers=new Map,this._progressHandlers=new Map,this._timeoutInfo=new Map,this._pendingDebouncedNotifications=new Set,this._taskProgressTokens=new Map,this._requestResolvers=new Map,this.setNotificationHandler(es,r=>{this._oncancel(r)}),this.setNotificationHandler(ss,r=>{this._onprogress(r)}),this.setRequestHandler(ns,r=>({})),this._taskStore=e?.taskStore,this._taskMessageQueue=e?.taskMessageQueue,this._taskStore&&(this.setRequestHandler(as,async(r,n)=>{const s=await this._taskStore.getTask(r.params.taskId,n.sessionId);if(!s)throw new K($.ErrorCode.InvalidParams,"Failed to retrieve task: Task not found");return{...s}}),this.setRequestHandler(os,async(r,n)=>{const s=async()=>{var a;const i=r.params.taskId;if(this._taskMessageQueue){let c;for(;c=await this._taskMessageQueue.dequeue(i,n.sessionId);){if(c.type==="response"||c.type==="error"){const l=c.message,u=l.id,f=this._requestResolvers.get(u);if(f)if(this._requestResolvers.delete(u),c.type==="response")f(l);else{const y=l,v=new K(y.error.code,y.error.message,y.error.data);f(v)}else{const y=c.type==="response"?"Response":"Error";this._onerror(new Error(`${y} handler missing for request ${u}`))}continue}await((a=this._transport)===null||a===void 0?void 0:a.send(c.message,{relatedRequestId:n.requestId}))}}const o=await this._taskStore.getTask(i,n.sessionId);if(!o)throw new K($.ErrorCode.InvalidParams,`Task not found: ${i}`);if(!Jt(o.status))return await this._waitForTaskUpdate(i,n.signal),await s();if(Jt(o.status)){const c=await this._taskStore.getTaskResult(i,n.sessionId);return this._clearTaskQueue(i),{...c,_meta:{...c._meta,[pt]:{taskId:i}}}}return await s()};return await s()}),this.setRequestHandler(cs,async(r,n)=>{var s;try{const{tasks:a,nextCursor:i}=await this._taskStore.listTasks((s=r.params)===null||s===void 0?void 0:s.cursor,n.sessionId);return{tasks:a,nextCursor:i,_meta:{}}}catch(a){throw new K($.ErrorCode.InvalidParams,`Failed to list tasks: ${a instanceof Error?a.message:String(a)}`)}}),this.setRequestHandler(Su,async(r,n)=>{try{const s=await this._taskStore.getTask(r.params.taskId,n.sessionId);if(!s)throw new K($.ErrorCode.InvalidParams,`Task not found: ${r.params.taskId}`);if(Jt(s.status))throw new K($.ErrorCode.InvalidParams,`Cannot cancel task in terminal status: ${s.status}`);await this._taskStore.updateTaskStatus(r.params.taskId,"cancelled","Client cancelled task execution.",n.sessionId),this._clearTaskQueue(r.params.taskId);const a=await this._taskStore.getTask(r.params.taskId,n.sessionId);if(!a)throw new K($.ErrorCode.InvalidParams,`Task not found after cancellation: ${r.params.taskId}`);return{_meta:{},...a}}catch(s){throw s instanceof K?s:new K($.ErrorCode.InvalidRequest,`Failed to cancel task: ${s instanceof Error?s.message:String(s)}`)}}))}async _oncancel(e){const r=this._requestHandlerAbortControllers.get(e.params.requestId);r?.abort(e.params.reason)}_setupTimeout(e,r,n,s,a=!1){this._timeoutInfo.set(e,{timeoutId:setTimeout(s,r),startTime:Date.now(),timeout:r,maxTotalTimeout:n,resetTimeoutOnProgress:a,onTimeout:s})}_resetTimeout(e){const r=this._timeoutInfo.get(e);if(!r)return!1;const n=Date.now()-r.startTime;if(r.maxTotalTimeout&&n>=r.maxTotalTimeout)throw this._timeoutInfo.delete(e),K.fromError($.ErrorCode.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:r.maxTotalTimeout,totalElapsed:n});return clearTimeout(r.timeoutId),r.timeoutId=setTimeout(r.onTimeout,r.timeout),!0}_cleanupTimeout(e){const r=this._timeoutInfo.get(e);r&&(clearTimeout(r.timeoutId),this._timeoutInfo.delete(e))}async connect(e){var r,n,s;this._transport=e;const a=(r=this.transport)===null||r===void 0?void 0:r.onclose;this._transport.onclose=()=>{a?.(),this._onclose()};const i=(n=this.transport)===null||n===void 0?void 0:n.onerror;this._transport.onerror=c=>{i?.(c),this._onerror(c)};const o=(s=this._transport)===null||s===void 0?void 0:s.onmessage;this._transport.onmessage=(c,l)=>{o?.(c,l),er(c)||uu(c)?this._onresponse(c):Xn(c)?this._onrequest(c,l):cu(c)?this._onnotification(c):this._onerror(new Error(`Unknown message type: ${JSON.stringify(c)}`))},await this._transport.start()}_onclose(){var e;const r=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._taskProgressTokens.clear(),this._pendingDebouncedNotifications.clear();const n=K.fromError($.ErrorCode.ConnectionClosed,"Connection closed");this._transport=void 0,(e=this.onclose)===null||e===void 0||e.call(this);for(const s of r.values())s(n)}_onerror(e){var r;(r=this.onerror)===null||r===void 0||r.call(this,e)}_onnotification(e){var r;const n=(r=this._notificationHandlers.get(e.method))!==null&&r!==void 0?r:this.fallbackNotificationHandler;n!==void 0&&Promise.resolve().then(()=>n(e)).catch(s=>this._onerror(new Error(`Uncaught error in notification handler: ${s}`)))}_onrequest(e,r){var n,s,a,i,o,c;const l=(n=this._requestHandlers.get(e.method))!==null&&n!==void 0?n:this.fallbackRequestHandler,u=this._transport,f=(i=(a=(s=e.params)===null||s===void 0?void 0:s._meta)===null||a===void 0?void 0:a[pt])===null||i===void 0?void 0:i.taskId;if(l===void 0){const h={jsonrpc:"2.0",id:e.id,error:{code:$.ErrorCode.MethodNotFound,message:"Method not found"}};f&&this._taskMessageQueue?this._enqueueTaskMessage(f,{type:"error",message:h,timestamp:Date.now()},u?.sessionId).catch(_=>this._onerror(new Error(`Failed to enqueue error response: ${_}`))):u?.send(h).catch(_=>this._onerror(new Error(`Failed to send an error response: ${_}`)));return}const y=new AbortController;this._requestHandlerAbortControllers.set(e.id,y);const v=(o=e.params)===null||o===void 0?void 0:o.task,p=this._taskStore?this.requestTaskStore(e,u?.sessionId):void 0,w={signal:y.signal,sessionId:u?.sessionId,_meta:(c=e.params)===null||c===void 0?void 0:c._meta,sendNotification:async h=>{const _={relatedRequestId:e.id};f&&(_.relatedTask={taskId:f}),await this.notification(h,_)},sendRequest:async(h,_,d)=>{var m,b;const g={...d,relatedRequestId:e.id};f&&!g.relatedTask&&(g.relatedTask={taskId:f});const S=(b=(m=g.relatedTask)===null||m===void 0?void 0:m.taskId)!==null&&b!==void 0?b:f;return S&&p&&await p.updateTaskStatus(S,"input_required"),await this.request(h,_,g)},authInfo:r?.authInfo,requestId:e.id,requestInfo:r?.requestInfo,taskId:f,taskStore:p,taskRequestedTtl:v?.ttl,closeSSEStream:r?.closeSSEStream,closeStandaloneSSEStream:r?.closeStandaloneSSEStream};Promise.resolve().then(()=>{v&&this.assertTaskHandlerCapability(e.method)}).then(()=>l(e,w)).then(async h=>{if(y.signal.aborted)return;const _={result:h,jsonrpc:"2.0",id:e.id};f&&this._taskMessageQueue?await this._enqueueTaskMessage(f,{type:"response",message:_,timestamp:Date.now()},u?.sessionId):await u?.send(_)},async h=>{var _;if(y.signal.aborted)return;const d={jsonrpc:"2.0",id:e.id,error:{code:Number.isSafeInteger(h.code)?h.code:$.ErrorCode.InternalError,message:(_=h.message)!==null&&_!==void 0?_:"Internal error",...h.data!==void 0&&{data:h.data}}};f&&this._taskMessageQueue?await this._enqueueTaskMessage(f,{type:"error",message:d,timestamp:Date.now()},u?.sessionId):await u?.send(d)}).catch(h=>this._onerror(new Error(`Failed to send response: ${h}`))).finally(()=>{this._requestHandlerAbortControllers.delete(e.id)})}_onprogress(e){const{progressToken:r,...n}=e.params,s=Number(r),a=this._progressHandlers.get(s);if(!a){this._onerror(new Error(`Received a progress notification for an unknown token: ${JSON.stringify(e)}`));return}const i=this._responseHandlers.get(s),o=this._timeoutInfo.get(s);if(o&&i&&o.resetTimeoutOnProgress)try{this._resetTimeout(s)}catch(c){this._responseHandlers.delete(s),this._progressHandlers.delete(s),this._cleanupTimeout(s),i(c);return}a(n)}_onresponse(e){const r=Number(e.id),n=this._requestResolvers.get(r);if(n){if(this._requestResolvers.delete(r),er(e))n(e);else{const i=new K(e.error.code,e.error.message,e.error.data);n(i)}return}const s=this._responseHandlers.get(r);if(s===void 0){this._onerror(new Error(`Received a response for an unknown message ID: ${JSON.stringify(e)}`));return}this._responseHandlers.delete(r),this._cleanupTimeout(r);let a=!1;if(er(e)&&e.result&&typeof e.result=="object"){const i=e.result;if(i.task&&typeof i.task=="object"){const o=i.task;typeof o.taskId=="string"&&(a=!0,this._taskProgressTokens.set(o.taskId,r))}}if(a||this._progressHandlers.delete(r),er(e))s(e);else{const i=K.fromError(e.error.code,e.error.message,e.error.data);s(i)}}get transport(){return this._transport}async close(){var e;await((e=this._transport)===null||e===void 0?void 0:e.close())}async*requestStream(e,r,n){var s,a,i,o;const{task:c}=n??{};if(!c){try{yield{type:"result",result:await this.request(e,r,n)}}catch(u){yield{type:"error",error:u instanceof K?u:new K($.ErrorCode.InternalError,String(u))}}return}let l;try{const u=await this.request(e,Ft,n);if(u.task)l=u.task.taskId,yield{type:"taskCreated",task:u.task};else throw new K($.ErrorCode.InternalError,"Task creation did not return a task");for(;;){const f=await this.getTask({taskId:l},n);if(yield{type:"taskStatus",task:f},Jt(f.status)){f.status==="completed"?yield{type:"result",result:await this.getTaskResult({taskId:l},r,n)}:f.status==="failed"?yield{type:"error",error:new K($.ErrorCode.InternalError,`Task ${l} failed`)}:f.status==="cancelled"&&(yield{type:"error",error:new K($.ErrorCode.InternalError,`Task ${l} was cancelled`)});return}if(f.status==="input_required"){yield{type:"result",result:await this.getTaskResult({taskId:l},r,n)};return}const y=(i=(s=f.pollInterval)!==null&&s!==void 0?s:(a=this._options)===null||a===void 0?void 0:a.defaultTaskPollInterval)!==null&&i!==void 0?i:1e3;await new Promise(v=>setTimeout(v,y)),(o=n?.signal)===null||o===void 0||o.throwIfAborted()}}catch(u){yield{type:"error",error:u instanceof K?u:new K($.ErrorCode.InternalError,String(u))}}}request(e,r,n){const{relatedRequestId:s,resumptionToken:a,onresumptiontoken:i,task:o,relatedTask:c}=n??{};return new Promise((l,u)=>{var f,y,v,p,w,h,_;const d=j=>{u(j)};if(!this._transport){d(new Error("Not connected"));return}if(((f=this._options)===null||f===void 0?void 0:f.enforceStrictCapabilities)===!0)try{this.assertCapabilityForMethod(e.method),o&&this.assertTaskCapability(e.method)}catch(j){d(j);return}(y=n?.signal)===null||y===void 0||y.throwIfAborted();const m=this._requestMessageId++,b={...e,jsonrpc:"2.0",id:m};n?.onprogress&&(this._progressHandlers.set(m,n.onprogress),b.params={...e.params,_meta:{...((v=e.params)===null||v===void 0?void 0:v._meta)||{},progressToken:m}}),o&&(b.params={...b.params,task:o}),c&&(b.params={...b.params,_meta:{...((p=b.params)===null||p===void 0?void 0:p._meta)||{},[pt]:c}});const g=j=>{var D;this._responseHandlers.delete(m),this._progressHandlers.delete(m),this._cleanupTimeout(m),(D=this._transport)===null||D===void 0||D.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:m,reason:String(j)}},{relatedRequestId:s,resumptionToken:a,onresumptiontoken:i}).catch(H=>this._onerror(new Error(`Failed to send cancellation: ${H}`)));const M=j instanceof K?j:new K($.ErrorCode.RequestTimeout,String(j));u(M)};this._responseHandlers.set(m,j=>{var D;if(!(!((D=n?.signal)===null||D===void 0)&&D.aborted)){if(j instanceof Error)return u(j);try{const M=ut(r,j.result);M.success?l(M.data):u(M.error)}catch(M){u(M)}}}),(w=n?.signal)===null||w===void 0||w.addEventListener("abort",()=>{var j;g((j=n?.signal)===null||j===void 0?void 0:j.reason)});const S=(h=n?.timeout)!==null&&h!==void 0?h:ud,E=()=>g(K.fromError($.ErrorCode.RequestTimeout,"Request timed out",{timeout:S}));this._setupTimeout(m,S,n?.maxTotalTimeout,E,(_=n?.resetTimeoutOnProgress)!==null&&_!==void 0?_:!1);const N=c?.taskId;if(N){const j=D=>{const M=this._responseHandlers.get(m);M?M(D):this._onerror(new Error(`Response handler missing for side-channeled request ${m}`))};this._requestResolvers.set(m,j),this._enqueueTaskMessage(N,{type:"request",message:b,timestamp:Date.now()}).catch(D=>{this._cleanupTimeout(m),u(D)})}else this._transport.send(b,{relatedRequestId:s,resumptionToken:a,onresumptiontoken:i}).catch(j=>{this._cleanupTimeout(m),u(j)})})}async getTask(e,r){return this.request({method:"tasks/get",params:e},is,r)}async getTaskResult(e,r,n){return this.request({method:"tasks/result",params:e},r,n)}async listTasks(e,r){return this.request({method:"tasks/list",params:e},us,r)}async cancelTask(e,r){return this.request({method:"tasks/cancel",params:e},ku,r)}async notification(e,r){var n,s,a,i,o;if(!this._transport)throw new Error("Not connected");this.assertNotificationCapability(e.method);const c=(n=r?.relatedTask)===null||n===void 0?void 0:n.taskId;if(c){const y={...e,jsonrpc:"2.0",params:{...e.params,_meta:{...((s=e.params)===null||s===void 0?void 0:s._meta)||{},[pt]:r.relatedTask}}};await this._enqueueTaskMessage(c,{type:"notification",message:y,timestamp:Date.now()});return}if(((i=(a=this._options)===null||a===void 0?void 0:a.debouncedNotificationMethods)!==null&&i!==void 0?i:[]).includes(e.method)&&!e.params&&!r?.relatedRequestId&&!r?.relatedTask){if(this._pendingDebouncedNotifications.has(e.method))return;this._pendingDebouncedNotifications.add(e.method),Promise.resolve().then(()=>{var y,v;if(this._pendingDebouncedNotifications.delete(e.method),!this._transport)return;let p={...e,jsonrpc:"2.0"};r?.relatedTask&&(p={...p,params:{...p.params,_meta:{...((y=p.params)===null||y===void 0?void 0:y._meta)||{},[pt]:r.relatedTask}}}),(v=this._transport)===null||v===void 0||v.send(p,r).catch(w=>this._onerror(w))});return}let f={...e,jsonrpc:"2.0"};r?.relatedTask&&(f={...f,params:{...f.params,_meta:{...((o=f.params)===null||o===void 0?void 0:o._meta)||{},[pt]:r.relatedTask}}}),await this._transport.send(f,r)}setRequestHandler(e,r){const n=od(e);this.assertRequestHandlerCapability(n),this._requestHandlers.set(n,(s,a)=>{const i=cd(e,s);return Promise.resolve(r(i,a))})}removeRequestHandler(e){this._requestHandlers.delete(e)}assertCanSetRequestHandler(e){if(this._requestHandlers.has(e))throw new Error(`A request handler for ${e} already exists, which would be overridden`)}setNotificationHandler(e,r){const n=od(e);this._notificationHandlers.set(n,s=>{const a=cd(e,s);return Promise.resolve(r(a))})}removeNotificationHandler(e){this._notificationHandlers.delete(e)}_cleanupTaskProgressHandler(e){const r=this._taskProgressTokens.get(e);r!==void 0&&(this._progressHandlers.delete(r),this._taskProgressTokens.delete(e))}async _enqueueTaskMessage(e,r,n){var s;if(!this._taskStore||!this._taskMessageQueue)throw new Error("Cannot enqueue task message: taskStore and taskMessageQueue are not configured");const a=(s=this._options)===null||s===void 0?void 0:s.maxTaskQueueSize;await this._taskMessageQueue.enqueue(e,r,n,a)}async _clearTaskQueue(e,r){if(this._taskMessageQueue){const n=await this._taskMessageQueue.dequeueAll(e,r);for(const s of n)if(s.type==="request"&&Xn(s.message)){const a=s.message.id,i=this._requestResolvers.get(a);i?(i(new K($.ErrorCode.InternalError,"Task cancelled or completed")),this._requestResolvers.delete(a)):this._onerror(new Error(`Resolver missing for request ${a} during task ${e} cleanup`))}}}async _waitForTaskUpdate(e,r){var n,s,a;let i=(s=(n=this._options)===null||n===void 0?void 0:n.defaultTaskPollInterval)!==null&&s!==void 0?s:1e3;try{const o=await((a=this._taskStore)===null||a===void 0?void 0:a.getTask(e));o?.pollInterval&&(i=o.pollInterval)}catch{}return new Promise((o,c)=>{if(r.aborted){c(new K($.ErrorCode.InvalidRequest,"Request cancelled"));return}const l=setTimeout(o,i);r.addEventListener("abort",()=>{clearTimeout(l),c(new K($.ErrorCode.InvalidRequest,"Request cancelled"))},{once:!0})})}requestTaskStore(e,r){const n=this._taskStore;if(!n)throw new Error("No task store configured");return{createTask:async s=>{if(!e)throw new Error("No request provided");return await n.createTask(s,e.id,{method:e.method,params:e.params},r)},getTask:async s=>{const a=await n.getTask(s,r);if(!a)throw new K($.ErrorCode.InvalidParams,"Failed to retrieve task: Task not found");return a},storeTaskResult:async(s,a,i)=>{await n.storeTaskResult(s,a,i,r);const o=await n.getTask(s,r);if(o){const c=Ar.parse({method:"notifications/tasks/status",params:o});await this.notification(c),Jt(o.status)&&this._cleanupTaskProgressHandler(s)}},getTaskResult:s=>n.getTaskResult(s,r),updateTaskStatus:async(s,a,i)=>{const o=await n.getTask(s,r);if(!o)throw new K($.ErrorCode.InvalidParams,`Task "${s}" not found - it may have been cleaned up`);if(Jt(o.status))throw new K($.ErrorCode.InvalidParams,`Cannot update task "${s}" from terminal status "${o.status}" to "${a}". Terminal states (completed, failed, cancelled) cannot transition to other states.`);await n.updateTaskStatus(s,a,i,r);const c=await n.getTask(s,r);if(c){const l=Ar.parse({method:"notifications/tasks/status",params:c});await this.notification(l),Jt(c.status)&&this._cleanupTaskProgressHandler(s)}},listTasks:s=>n.listTasks(s,r)}}}function ld(t){return t!==null&&typeof t=="object"&&!Array.isArray(t)}function Xa(t,e){const r={...t};for(const n in e){const s=n,a=e[s];if(a===void 0)continue;const i=r[s];ld(i)&&ld(a)?r[s]={...i,...a}:r[s]=a}return r}var Is={exports:{}},ei={},dd;function pv(){return dd||(dd=1,(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.formatNames=t.fastFormats=t.fullFormats=void 0;function e(M,H){return{validate:M,compare:H}}t.fullFormats={date:e(a,i),time:e(c(!0),l),"date-time":e(y(!0),v),"iso-time":e(c(),u),"iso-date-time":e(y(),p),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:_,"uri-reference":/^(?:[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,"uri-template":/^(?:(?:[^\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,url:/^(?:https?|ftp):\/\/(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|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-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)(?:\.(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu,email:/^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i,hostname:/^(?=.{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,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)$/,ipv6:/^((([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,regex:D,uuid:/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,"json-pointer":/^(?:\/(?:[^~/]|~0|~1)*)*$/,"json-pointer-uri-fragment":/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,"relative-json-pointer":/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,byte:m,int32:{type:"number",validate:S},int64:{type:"number",validate:E},float:{type:"number",validate:N},double:{type:"number",validate:N},password:!0,binary:!0},t.fastFormats={...t.fullFormats,date:e(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,i),time:e(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,l),"date-time":e(/^\d\d\d\d-[0-1]\d-[0-3]\dt(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,v),"iso-time":e(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,u),"iso-date-time":e(/^\d\d\d\d-[0-1]\d-[0-3]\d[t\s](?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,p),uri:/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i,"uri-reference":/^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,email:/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i},t.formatNames=Object.keys(t.fullFormats);function r(M){return M%4===0&&(M%100!==0||M%400===0)}const n=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,s=[0,31,28,31,30,31,30,31,31,30,31,30,31];function a(M){const H=n.exec(M);if(!H)return!1;const G=+H[1],Y=+H[2],ge=+H[3];return Y>=1&&Y<=12&&ge>=1&&ge<=(Y===2&&r(G)?29:s[Y])}function i(M,H){if(M&&H)return M>H?1:M<H?-1:0}const o=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function c(M){return function(G){const Y=o.exec(G);if(!Y)return!1;const ge=+Y[1],He=+Y[2],We=+Y[3],be=Y[4],ht=Y[5]==="-"?-1:1,V=+(Y[6]||0),C=+(Y[7]||0);if(V>23||C>59||M&&!be)return!1;if(ge<=23&&He<=59&&We<60)return!0;const Z=He-C*ht,O=ge-V*ht-(Z<0?1:0);return(O===23||O===-1)&&(Z===59||Z===-1)&&We<61}}function l(M,H){if(!(M&&H))return;const G=new Date("2020-01-01T"+M).valueOf(),Y=new Date("2020-01-01T"+H).valueOf();if(G&&Y)return G-Y}function u(M,H){if(!(M&&H))return;const G=o.exec(M),Y=o.exec(H);if(G&&Y)return M=G[1]+G[2]+G[3],H=Y[1]+Y[2]+Y[3],M>H?1:M<H?-1:0}const f=/t|\s/i;function y(M){const H=c(M);return function(Y){const ge=Y.split(f);return ge.length===2&&a(ge[0])&&H(ge[1])}}function v(M,H){if(!(M&&H))return;const G=new Date(M).valueOf(),Y=new Date(H).valueOf();if(G&&Y)return G-Y}function p(M,H){if(!(M&&H))return;const[G,Y]=M.split(f),[ge,He]=H.split(f),We=i(G,ge);if(We!==void 0)return We||l(Y,He)}const w=/\/|:/,h=/^(?:[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 _(M){return w.test(M)&&h.test(M)}const d=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function m(M){return d.lastIndex=0,d.test(M)}const b=-2147483648,g=2**31-1;function S(M){return Number.isInteger(M)&&M<=g&&M>=b}function E(M){return Number.isInteger(M)}function N(){return!0}const j=/[^\\]\\Z/;function D(M){if(j.test(M))return!1;try{return new RegExp(M),!0}catch{return!1}}})(ei)),ei}var ti={},fd;function _v(){return fd||(fd=1,(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.formatLimitDefinition=void 0;const e=ic(),r=ie(),n=r.operators,s={formatMaximum:{okStr:"<=",ok:n.LTE,fail:n.GT},formatMinimum:{okStr:">=",ok:n.GTE,fail:n.LT},formatExclusiveMaximum:{okStr:"<",ok:n.LT,fail:n.GTE},formatExclusiveMinimum:{okStr:">",ok:n.GT,fail:n.LTE}},a={message:({keyword:o,schemaCode:c})=>(0,r.str)`should be ${s[o].okStr} ${c}`,params:({keyword:o,schemaCode:c})=>(0,r._)`{comparison: ${s[o].okStr}, limit: ${c}}`};t.formatLimitDefinition={keyword:Object.keys(s),type:"string",schemaType:"string",$data:!0,error:a,code(o){const{gen:c,data:l,schemaCode:u,keyword:f,it:y}=o,{opts:v,self:p}=y;if(!v.validateFormats)return;const w=new e.KeywordCxt(y,p.RULES.all.format.definition,"format");w.$data?h():_();function h(){const m=c.scopeValue("formats",{ref:p.formats,code:v.code.formats}),b=c.const("fmt",(0,r._)`${m}[${w.schemaCode}]`);o.fail$data((0,r.or)((0,r._)`typeof ${b} != "object"`,(0,r._)`${b} instanceof RegExp`,(0,r._)`typeof ${b}.compare != "function"`,d(b)))}function _(){const m=w.schema,b=p.formats[m];if(!b||b===!0)return;if(typeof b!="object"||b instanceof RegExp||typeof b.compare!="function")throw new Error(`"${f}": format "${m}" does not define "compare" function`);const g=c.scopeValue("formats",{key:m,ref:b,code:v.code.formats?(0,r._)`${v.code.formats}${(0,r.getProperty)(m)}`:void 0});o.fail$data(d(g))}function d(m){return(0,r._)`${m}.compare(${l}, ${u}) ${s[f].fail} 0`}},dependencies:["format"]};const i=o=>(o.addKeyword(t.formatLimitDefinition),o);t.default=i})(ti)),ti}var hd;function gv(){return hd||(hd=1,(function(t,e){Object.defineProperty(e,"__esModule",{value:!0});const r=pv(),n=_v(),s=ie(),a=new s.Name("fullFormats"),i=new s.Name("fastFormats"),o=(l,u={keywords:!0})=>{if(Array.isArray(u))return c(l,u,r.fullFormats,a),l;const[f,y]=u.mode==="fast"?[r.fastFormats,i]:[r.fullFormats,a],v=u.formats||r.formatNames;return c(l,v,f,y),u.keywords&&(0,n.default)(l),l};o.get=(l,u="full")=>{const y=(u==="fast"?r.fastFormats:r.fullFormats)[l];if(!y)throw new Error(`Unknown format "${l}"`);return y};function c(l,u,f,y){var v,p;(v=(p=l.opts.code).formats)!==null&&v!==void 0||(p.formats=(0,s._)`require("ajv-formats/dist/formats").${y}`);for(const w of u)l.addFormat(w,f[w])}t.exports=e=o,Object.defineProperty(e,"__esModule",{value:!0}),e.default=o})(Is,Is.exports)),Is.exports}var vv=gv();const yv=Yt(vv);function wv(){const t=new oc.Ajv({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return yv(t),t}class md{constructor(e){this._ajv=e??wv()}getValidator(e){var r;const n="$id"in e&&typeof e.$id=="string"?(r=this._ajv.getSchema(e.$id))!==null&&r!==void 0?r:this._ajv.compile(e):this._ajv.compile(e);return s=>n(s)?{valid:!0,data:s,errorMessage:void 0}:{valid:!1,data:void 0,errorMessage:this._ajv.errorsText(n.errors)}}}class bv{constructor(e){this._client=e}async*callToolStream(e,r=ar,n){var s;const a=this._client,i={...n,task:(s=n?.task)!==null&&s!==void 0?s:a.isToolTask(e.name)?{}:void 0},o=a.requestStream({method:"tools/call",params:e},r,i),c=a.getToolOutputValidator(e.name);for await(const l of o){if(l.type==="result"&&c){const u=l.result;if(!u.structuredContent&&!u.isError){yield{type:"error",error:new K($.ErrorCode.InvalidRequest,`Tool ${e.name} has an output schema but did not return structured content`)};return}if(u.structuredContent)try{const f=c(u.structuredContent);if(!f.valid){yield{type:"error",error:new K($.ErrorCode.InvalidParams,`Structured content does not match the tool's output schema: ${f.errorMessage}`)};return}}catch(f){if(f instanceof K){yield{type:"error",error:f};return}yield{type:"error",error:new K($.ErrorCode.InvalidParams,`Failed to validate structured content: ${f instanceof Error?f.message:String(f)}`)};return}}yield l}}async getTask(e,r){return this._client.getTask({taskId:e},r)}async getTaskResult(e,r,n){return this._client.getTaskResult({taskId:e},r,n)}async listTasks(e,r){return this._client.listTasks(e?{cursor:e}:void 0,r)}async cancelTask(e,r){return this._client.cancelTask({taskId:e},r)}requestStream(e,r,n){return this._client.requestStream(e,r,n)}}function pd(t,e,r){var n;if(!t)throw new Error(`${r} does not support task creation (required for ${e})`);switch(e){case"tools/call":if(!(!((n=t.tools)===null||n===void 0)&&n.call))throw new Error(`${r} does not support task creation for tools/call (required for ${e})`);break}}function _d(t,e,r){var n,s;if(!t)throw new Error(`${r} does not support task creation (required for ${e})`);switch(e){case"sampling/createMessage":if(!(!((n=t.sampling)===null||n===void 0)&&n.createMessage))throw new Error(`${r} does not support task creation for sampling/createMessage (required for ${e})`);break;case"elicitation/create":if(!(!((s=t.elicitation)===null||s===void 0)&&s.create))throw new Error(`${r} does not support task creation for elicitation/create (required for ${e})`);break}}function Os(t,e){if(!(!t||e===null||typeof e!="object")){if(t.type==="object"&&t.properties&&typeof t.properties=="object"){const r=e,n=t.properties;for(const s of Object.keys(n)){const a=n[s];r[s]===void 0&&Object.prototype.hasOwnProperty.call(a,"default")&&(r[s]=a.default),r[s]!==void 0&&Os(a,r[s])}}if(Array.isArray(t.anyOf))for(const r of t.anyOf)Os(r,e);if(Array.isArray(t.oneOf))for(const r of t.oneOf)Os(r,e)}}function gd(t){if(!t)return{supportsFormMode:!1,supportsUrlMode:!1};const e=t.form!==void 0,r=t.url!==void 0;return{supportsFormMode:e||!e&&!r,supportsUrlMode:r}}class Sv extends Qa{constructor(e,r){var n,s;super(r),this._clientInfo=e,this._cachedToolOutputValidators=new Map,this._cachedKnownTaskTools=new Set,this._cachedRequiredTaskTools=new Set,this._capabilities=(n=r?.capabilities)!==null&&n!==void 0?n:{},this._jsonSchemaValidator=(s=r?.jsonSchemaValidator)!==null&&s!==void 0?s:new md}get experimental(){return this._experimental||(this._experimental={tasks:new bv(this)}),this._experimental}registerCapabilities(e){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=Xa(this._capabilities,e)}setRequestHandler(e,r){var n,s,a;const i=dr(e),o=i?.method;if(!o)throw new Error("Schema is missing a method literal");let c;if(st(o)){const u=o,f=(n=u._zod)===null||n===void 0?void 0:n.def;c=(s=f?.value)!==null&&s!==void 0?s:u.value}else{const u=o,f=u._def;c=(a=f?.value)!==null&&a!==void 0?a:u.value}if(typeof c!="string")throw new Error("Schema method literal must be a string");const l=c;if(l==="elicitation/create"){const u=async(f,y)=>{var v,p,w;const h=ut(Ma,f);if(!h.success){const j=h.error instanceof Error?h.error.message:String(h.error);throw new K($.ErrorCode.InvalidParams,`Invalid elicitation request: ${j}`)}const{params:_}=h.data,d=(v=_.mode)!==null&&v!==void 0?v:"form",{supportsFormMode:m,supportsUrlMode:b}=gd(this._capabilities.elicitation);if(d==="form"&&!m)throw new K($.ErrorCode.InvalidParams,"Client does not support form-mode elicitation requests");if(d==="url"&&!b)throw new K($.ErrorCode.InvalidParams,"Client does not support URL-mode elicitation requests");const g=await Promise.resolve(r(f,y));if(_.task){const j=ut(Ft,g);if(!j.success){const D=j.error instanceof Error?j.error.message:String(j.error);throw new K($.ErrorCode.InvalidParams,`Invalid task creation result: ${D}`)}return j.data}const S=ut(qr,g);if(!S.success){const j=S.error instanceof Error?S.error.message:String(S.error);throw new K($.ErrorCode.InvalidParams,`Invalid elicitation result: ${j}`)}const E=S.data,N=d==="form"?_.requestedSchema:void 0;if(d==="form"&&E.action==="accept"&&E.content&&N&&!((w=(p=this._capabilities.elicitation)===null||p===void 0?void 0:p.form)===null||w===void 0)&&w.applyDefaults)try{Os(N,E.content)}catch{}return E};return super.setRequestHandler(e,u)}if(l==="sampling/createMessage"){const u=async(f,y)=>{const v=ut(ja,f);if(!v.success){const _=v.error instanceof Error?v.error.message:String(v.error);throw new K($.ErrorCode.InvalidParams,`Invalid sampling request: ${_}`)}const{params:p}=v.data,w=await Promise.resolve(r(f,y));if(p.task){const _=ut(Ft,w);if(!_.success){const d=_.error instanceof Error?_.error.message:String(_.error);throw new K($.ErrorCode.InvalidParams,`Invalid task creation result: ${d}`)}return _.data}const h=ut(bs,w);if(!h.success){const _=h.error instanceof Error?h.error.message:String(h.error);throw new K($.ErrorCode.InvalidParams,`Invalid sampling result: ${_}`)}return h.data};return super.setRequestHandler(e,u)}return super.setRequestHandler(e,r)}assertCapability(e,r){var n;if(!(!((n=this._serverCapabilities)===null||n===void 0)&&n[e]))throw new Error(`Server does not support ${e} (required for ${r})`)}async connect(e,r){if(await super.connect(e),e.sessionId===void 0)try{const n=await this.request({method:"initialize",params:{protocolVersion:Ut,capabilities:this._capabilities,clientInfo:this._clientInfo}},wa,r);if(n===void 0)throw new Error(`Server sent invalid initialize result: ${n}`);if(!fa.includes(n.protocolVersion))throw new Error(`Server's protocol version is not supported: ${n.protocolVersion}`);this._serverCapabilities=n.capabilities,this._serverVersion=n.serverInfo,e.setProtocolVersion&&e.setProtocolVersion(n.protocolVersion),this._instructions=n.instructions,await this.notification({method:"notifications/initialized"})}catch(n){throw this.close(),n}}getServerCapabilities(){return this._serverCapabilities}getServerVersion(){return this._serverVersion}getInstructions(){return this._instructions}assertCapabilityForMethod(e){var r,n,s,a,i;switch(e){case"logging/setLevel":if(!(!((r=this._serverCapabilities)===null||r===void 0)&&r.logging))throw new Error(`Server does not support logging (required for ${e})`);break;case"prompts/get":case"prompts/list":if(!(!((n=this._serverCapabilities)===null||n===void 0)&&n.prompts))throw new Error(`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(!(!((s=this._serverCapabilities)===null||s===void 0)&&s.resources))throw new Error(`Server does not support resources (required for ${e})`);if(e==="resources/subscribe"&&!this._serverCapabilities.resources.subscribe)throw new Error(`Server does not support resource subscriptions (required for ${e})`);break;case"tools/call":case"tools/list":if(!(!((a=this._serverCapabilities)===null||a===void 0)&&a.tools))throw new Error(`Server does not support tools (required for ${e})`);break;case"completion/complete":if(!(!((i=this._serverCapabilities)===null||i===void 0)&&i.completions))throw new Error(`Server does not support completions (required for ${e})`);break}}assertNotificationCapability(e){var r;switch(e){case"notifications/roots/list_changed":if(!(!((r=this._capabilities.roots)===null||r===void 0)&&r.listChanged))throw new Error(`Client does not support roots list changed notifications (required for ${e})`);break}}assertRequestHandlerCapability(e){if(this._capabilities)switch(e){case"sampling/createMessage":if(!this._capabilities.sampling)throw new Error(`Client does not support sampling capability (required for ${e})`);break;case"elicitation/create":if(!this._capabilities.elicitation)throw new Error(`Client does not support elicitation capability (required for ${e})`);break;case"roots/list":if(!this._capabilities.roots)throw new Error(`Client does not support roots capability (required for ${e})`);break;case"tasks/get":case"tasks/list":case"tasks/result":case"tasks/cancel":if(!this._capabilities.tasks)throw new Error(`Client does not support tasks capability (required for ${e})`);break}}assertTaskCapability(e){var r,n;pd((n=(r=this._serverCapabilities)===null||r===void 0?void 0:r.tasks)===null||n===void 0?void 0:n.requests,e,"Server")}assertTaskHandlerCapability(e){var r;this._capabilities&&_d((r=this._capabilities.tasks)===null||r===void 0?void 0:r.requests,e,"Client")}async ping(e){return this.request({method:"ping"},Ct,e)}async complete(e,r){return this.request({method:"completion/complete",params:e},Za,r)}async setLoggingLevel(e,r){return this.request({method:"logging/setLevel",params:{level:e}},Ct,r)}async getPrompt(e,r){return this.request({method:"prompts/get",params:e},Ia,r)}async listPrompts(e,r){return this.request({method:"prompts/list",params:e},Ca,r)}async listResources(e,r){return this.request({method:"resources/list",params:e},Ta,r)}async listResourceTemplates(e,r){return this.request({method:"resources/templates/list",params:e},Ra,r)}async readResource(e,r){return this.request({method:"resources/read",params:e},Pa,r)}async subscribeResource(e,r){return this.request({method:"resources/subscribe",params:e},Ct,r)}async unsubscribeResource(e,r){return this.request({method:"resources/unsubscribe",params:e},Ct,r)}async callTool(e,r=ar,n){if(this.isToolTaskRequired(e.name))throw new K($.ErrorCode.InvalidRequest,`Tool "${e.name}" requires task-based execution. Use client.experimental.tasks.callToolStream() instead.`);const s=await this.request({method:"tools/call",params:e},r,n),a=this.getToolOutputValidator(e.name);if(a){if(!s.structuredContent&&!s.isError)throw new K($.ErrorCode.InvalidRequest,`Tool ${e.name} has an output schema but did not return structured content`);if(s.structuredContent)try{const i=a(s.structuredContent);if(!i.valid)throw new K($.ErrorCode.InvalidParams,`Structured content does not match the tool's output schema: ${i.errorMessage}`)}catch(i){throw i instanceof K?i:new K($.ErrorCode.InvalidParams,`Failed to validate structured content: ${i instanceof Error?i.message:String(i)}`)}}return s}isToolTask(e){var r,n,s,a;return!((a=(s=(n=(r=this._serverCapabilities)===null||r===void 0?void 0:r.tasks)===null||n===void 0?void 0:n.requests)===null||s===void 0?void 0:s.tools)===null||a===void 0)&&a.call?this._cachedKnownTaskTools.has(e):!1}isToolTaskRequired(e){return this._cachedRequiredTaskTools.has(e)}cacheToolMetadata(e){var r;this._cachedToolOutputValidators.clear(),this._cachedKnownTaskTools.clear(),this._cachedRequiredTaskTools.clear();for(const n of e){if(n.outputSchema){const a=this._jsonSchemaValidator.getValidator(n.outputSchema);this._cachedToolOutputValidators.set(n.name,a)}const s=(r=n.execution)===null||r===void 0?void 0:r.taskSupport;(s==="required"||s==="optional")&&this._cachedKnownTaskTools.add(n.name),s==="required"&&this._cachedRequiredTaskTools.add(n.name)}}getToolOutputValidator(e){return this._cachedToolOutputValidators.get(e)}async listTools(e,r){const n=await this.request({method:"tools/list",params:e},Na,r);return this.cacheToolMetadata(n.tools),n}async sendRootsListChanged(){return this.notification({method:"notifications/roots/list_changed"})}}let ri;ri=globalThis.crypto;async function kv(t){return(await ri).getRandomValues(new Uint8Array(t))}async function $v(t){const e="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-._~",r=Math.pow(2,8)-Math.pow(2,8)%e.length;let n="";for(;n.length<t;){const s=await kv(t-n.length);for(const a of s)a<r&&(n+=e[a%e.length])}return n}async function Ev(t){return await $v(t)}async function Tv(t){const e=await(await ri).subtle.digest("SHA-256",new TextEncoder().encode(t));return btoa(String.fromCharCode(...new Uint8Array(e))).replace(/\//g,"_").replace(/\+/g,"-").replace(/=/g,"")}async function Rv(t){if(t||(t=43),t<43||t>128)throw`Expected a length between 43 and 128. Received ${t}.`;const e=await Ev(t),r=await Tv(e);return{code_verifier:e,code_challenge:r}}const xe=Vp().superRefine((t,e)=>{if(!URL.canParse(t))return e.addIssue({code:j_.custom,message:"URL must be parseable",fatal:!0}),Zf}).refine(t=>{const e=new URL(t);return e.protocol!=="javascript:"&&e.protocol!=="data:"&&e.protocol!=="vbscript:"},{message:"URL cannot use javascript:, data:, or vbscript: scheme"}),Pv=Je({resource:R().url(),authorization_servers:W(xe).optional(),jwks_uri:R().url().optional(),scopes_supported:W(R()).optional(),bearer_methods_supported:W(R()).optional(),resource_signing_alg_values_supported:W(R()).optional(),resource_name:R().optional(),resource_documentation:R().optional(),resource_policy_uri:R().url().optional(),resource_tos_uri:R().url().optional(),tls_client_certificate_bound_access_tokens:Te().optional(),authorization_details_types_supported:W(R()).optional(),dpop_signing_alg_values_supported:W(R()).optional(),dpop_bound_access_tokens_required:Te().optional()}),ni=Je({issuer:R(),authorization_endpoint:xe,token_endpoint:xe,registration_endpoint:xe.optional(),scopes_supported:W(R()).optional(),response_types_supported:W(R()),response_modes_supported:W(R()).optional(),grant_types_supported:W(R()).optional(),token_endpoint_auth_methods_supported:W(R()).optional(),token_endpoint_auth_signing_alg_values_supported:W(R()).optional(),service_documentation:xe.optional(),revocation_endpoint:xe.optional(),revocation_endpoint_auth_methods_supported:W(R()).optional(),revocation_endpoint_auth_signing_alg_values_supported:W(R()).optional(),introspection_endpoint:R().optional(),introspection_endpoint_auth_methods_supported:W(R()).optional(),introspection_endpoint_auth_signing_alg_values_supported:W(R()).optional(),code_challenge_methods_supported:W(R()).optional(),client_id_metadata_document_supported:Te().optional()}),Cv=Je({issuer:R(),authorization_endpoint:xe,token_endpoint:xe,userinfo_endpoint:xe.optional(),jwks_uri:xe,registration_endpoint:xe.optional(),scopes_supported:W(R()).optional(),response_types_supported:W(R()),response_modes_supported:W(R()).optional(),grant_types_supported:W(R()).optional(),acr_values_supported:W(R()).optional(),subject_types_supported:W(R()),id_token_signing_alg_values_supported:W(R()),id_token_encryption_alg_values_supported:W(R()).optional(),id_token_encryption_enc_values_supported:W(R()).optional(),userinfo_signing_alg_values_supported:W(R()).optional(),userinfo_encryption_alg_values_supported:W(R()).optional(),userinfo_encryption_enc_values_supported:W(R()).optional(),request_object_signing_alg_values_supported:W(R()).optional(),request_object_encryption_alg_values_supported:W(R()).optional(),request_object_encryption_enc_values_supported:W(R()).optional(),token_endpoint_auth_methods_supported:W(R()).optional(),token_endpoint_auth_signing_alg_values_supported:W(R()).optional(),display_values_supported:W(R()).optional(),claim_types_supported:W(R()).optional(),claims_supported:W(R()).optional(),service_documentation:R().optional(),claims_locales_supported:W(R()).optional(),ui_locales_supported:W(R()).optional(),claims_parameter_supported:Te().optional(),request_parameter_supported:Te().optional(),request_uri_parameter_supported:Te().optional(),require_request_uri_registration:Te().optional(),op_policy_uri:xe.optional(),op_tos_uri:xe.optional(),client_id_metadata_document_supported:Te().optional()}),Iv=x({...Cv.shape,...ni.pick({code_challenge_methods_supported:!0}).shape}),Ov=x({access_token:R(),id_token:R().optional(),token_type:R(),expires_in:z_().optional(),scope:R().optional(),refresh_token:R().optional()}).strip(),Nv=x({error:R(),error_description:R().optional(),error_uri:R().optional()}),vd=xe.optional().or(te("").transform(()=>{})),Av=x({redirect_uris:W(xe),token_endpoint_auth_method:R().optional(),grant_types:W(R()).optional(),response_types:W(R()).optional(),client_name:R().optional(),client_uri:xe.optional(),logo_uri:vd,scope:R().optional(),contacts:W(R()).optional(),tos_uri:vd,policy_uri:R().optional(),jwks_uri:xe.optional(),jwks:u_().optional(),software_id:R().optional(),software_version:R().optional(),software_statement:R().optional()}).strip(),jv=x({client_id:R(),client_secret:R().optional(),client_id_issued_at:we().optional(),client_secret_expires_at:we().optional()}).strip(),zv=Av.merge(jv);x({error:R(),error_description:R().optional()}).strip(),x({token:R(),token_type_hint:R().optional()}).strip();function Mv(t){const e=typeof t=="string"?new URL(t):new URL(t.href);return e.hash="",e}function qv({requestedResource:t,configuredResource:e}){const r=typeof t=="string"?new URL(t):new URL(t.href),n=typeof e=="string"?new URL(e):new URL(e.href);if(r.origin!==n.origin||r.pathname.length<n.pathname.length)return!1;const s=r.pathname.endsWith("/")?r.pathname:r.pathname+"/",a=n.pathname.endsWith("/")?n.pathname:n.pathname+"/";return s.startsWith(a)}class Me extends Error{constructor(e,r){super(e),this.errorUri=r,this.name=this.constructor.name}toResponseObject(){const e={error:this.errorCode,error_description:this.message};return this.errorUri&&(e.error_uri=this.errorUri),e}get errorCode(){return this.constructor.errorCode}}class si extends Me{}si.errorCode="invalid_request";class Ns extends Me{}Ns.errorCode="invalid_client";class As extends Me{}As.errorCode="invalid_grant";class js extends Me{}js.errorCode="unauthorized_client";class ai extends Me{}ai.errorCode="unsupported_grant_type";class ii extends Me{}ii.errorCode="invalid_scope";class oi extends Me{}oi.errorCode="access_denied";class fr extends Me{}fr.errorCode="server_error";class ci extends Me{}ci.errorCode="temporarily_unavailable";class ui extends Me{}ui.errorCode="unsupported_response_type";class li extends Me{}li.errorCode="unsupported_token_type";class di extends Me{}di.errorCode="invalid_token";class fi extends Me{}fi.errorCode="method_not_allowed";class hi extends Me{}hi.errorCode="too_many_requests";class zs extends Me{}zs.errorCode="invalid_client_metadata";class mi extends Me{}mi.errorCode="insufficient_scope";class pi extends Me{}pi.errorCode="invalid_target";const Zv={[si.errorCode]:si,[Ns.errorCode]:Ns,[As.errorCode]:As,[js.errorCode]:js,[ai.errorCode]:ai,[ii.errorCode]:ii,[oi.errorCode]:oi,[fr.errorCode]:fr,[ci.errorCode]:ci,[ui.errorCode]:ui,[li.errorCode]:li,[di.errorCode]:di,[fi.errorCode]:fi,[hi.errorCode]:hi,[zs.errorCode]:zs,[mi.errorCode]:mi,[pi.errorCode]:pi};class at extends Error{constructor(e){super(e??"Unauthorized")}}function xv(t){return["client_secret_basic","client_secret_post","none"].includes(t)}const _i="code",gi="S256";function yd(t,e){const r=t.client_secret!==void 0;return e.length===0?r?"client_secret_post":"none":"token_endpoint_auth_method"in t&&t.token_endpoint_auth_method&&xv(t.token_endpoint_auth_method)&&e.includes(t.token_endpoint_auth_method)?t.token_endpoint_auth_method:r&&e.includes("client_secret_basic")?"client_secret_basic":r&&e.includes("client_secret_post")?"client_secret_post":e.includes("none")?"none":r?"client_secret_post":"none"}function Lv(t,e,r,n){const{client_id:s,client_secret:a}=e;switch(t){case"client_secret_basic":Uv(s,a,r);return;case"client_secret_post":Dv(s,a,n);return;case"none":Vv(s,n);return;default:throw new Error(`Unsupported client authentication method: ${t}`)}}function Uv(t,e,r){if(!e)throw new Error("client_secret_basic authentication requires a client_secret");const n=btoa(`${t}:${e}`);r.set("Authorization",`Basic ${n}`)}function Dv(t,e,r){r.set("client_id",t),e&&r.set("client_secret",e)}function Vv(t,e){e.set("client_id",t)}async function vi(t){const e=t instanceof Response?t.status:void 0,r=t instanceof Response?await t.text():t;try{const n=Nv.parse(JSON.parse(r)),{error:s,error_description:a,error_uri:i}=n,o=Zv[s]||fr;return new o(a||"",i)}catch(n){const s=`${e?`HTTP ${e}: `:""}Invalid OAuth error response: ${n}. Raw body: ${r}`;return new fr(s)}}async function jt(t,e){var r,n;try{return await yi(t,e)}catch(s){if(s instanceof Ns||s instanceof js)return await((r=t.invalidateCredentials)===null||r===void 0?void 0:r.call(t,"all")),await yi(t,e);if(s instanceof As)return await((n=t.invalidateCredentials)===null||n===void 0?void 0:n.call(t,"tokens")),await yi(t,e);throw s}}async function yi(t,{serverUrl:e,authorizationCode:r,scope:n,resourceMetadataUrl:s,fetchFn:a}){var i,o;let c,l;try{c=await Sd(e,{resourceMetadataUrl:s},a),c.authorization_servers&&c.authorization_servers.length>0&&(l=c.authorization_servers[0])}catch{}l||(l=new URL("/",e));const u=await bd(e,t,c),f=await Td(l,{fetchFn:a});let y=await Promise.resolve(t.clientInformation());if(!y){if(r!==void 0)throw new Error("Existing OAuth client information is required when exchanging an authorization code");const d=f?.client_id_metadata_document_supported===!0,m=t.clientMetadataUrl;if(m&&!wd(m))throw new zs(`clientMetadataUrl must be a valid HTTPS URL with a non-root pathname, got: ${m}`);if(d&&m)y={client_id:m},await((i=t.saveClientInformation)===null||i===void 0?void 0:i.call(t,y));else{if(!t.saveClientInformation)throw new Error("OAuth client information must be saveable for dynamic registration");const g=await Id(l,{metadata:f,clientMetadata:t.clientMetadata,fetchFn:a});await t.saveClientInformation(g),y=g}}const v=!t.redirectUrl;if(r!==void 0||v){const d=await Cd(t,l,{metadata:f,resource:u,authorizationCode:r,fetchFn:a});return await t.saveTokens(d),"AUTHORIZED"}const p=await t.tokens();if(p?.refresh_token)try{const d=await Pd(l,{metadata:f,clientInformation:y,refreshToken:p.refresh_token,resource:u,addClientAuthentication:t.addClientAuthentication,fetchFn:a});return await t.saveTokens(d),"AUTHORIZED"}catch(d){if(!(!(d instanceof Me)||d instanceof fr))throw d}const w=t.state?await t.state():void 0,{authorizationUrl:h,codeVerifier:_}=await Rd(l,{metadata:f,clientInformation:y,state:w,redirectUrl:t.redirectUrl,scope:n||((o=c?.scopes_supported)===null||o===void 0?void 0:o.join(" "))||t.clientMetadata.scope,resource:u});return await t.saveCodeVerifier(_),await t.redirectToAuthorization(h),"REDIRECT"}function wd(t){if(!t)return!1;try{const e=new URL(t);return e.protocol==="https:"&&e.pathname!=="/"}catch{return!1}}async function bd(t,e,r){const n=Mv(t);if(e.validateResourceURL)return await e.validateResourceURL(n,r?.resource);if(r){if(!qv({requestedResource:n,configuredResource:r.resource}))throw new Error(`Protected resource ${r.resource} does not match expected ${n} (or origin)`);return new URL(r.resource)}}function Fr(t){const e=t.headers.get("WWW-Authenticate");if(!e)return{};const[r,n]=e.split(" ");if(r.toLowerCase()!=="bearer"||!n)return{};const s=wi(t,"resource_metadata")||void 0;let a;if(s)try{a=new URL(s)}catch{}const i=wi(t,"scope")||void 0,o=wi(t,"error")||void 0;return{resourceMetadataUrl:a,scope:i,error:o}}function wi(t,e){const r=t.headers.get("WWW-Authenticate");if(!r)return null;const n=new RegExp(`${e}=(?:"([^"]+)"|([^\\s,]+))`),s=r.match(n);return s?s[1]||s[2]:null}function Fv(t){const e=t.headers.get("WWW-Authenticate");if(!e)return;const[r,n]=e.split(" ");if(r.toLowerCase()!=="bearer"||!n)return;const a=/resource_metadata="([^"]*)"/.exec(e);if(a)try{return new URL(a[1])}catch{return}}async function Sd(t,e,r=fetch){var n,s;const a=await $d(t,"oauth-protected-resource",r,{protocolVersion:e?.protocolVersion,metadataUrl:e?.resourceMetadataUrl});if(!a||a.status===404)throw await((n=a?.body)===null||n===void 0?void 0:n.cancel()),new Error("Resource server does not implement OAuth 2.0 Protected Resource Metadata.");if(!a.ok)throw await((s=a.body)===null||s===void 0?void 0:s.cancel()),new Error(`HTTP ${a.status} trying to load well-known OAuth protected resource metadata.`);return Pv.parse(await a.json())}async function bi(t,e,r=fetch){try{return await r(t,{headers:e})}catch(n){if(n instanceof TypeError)return e?bi(t,void 0,r):void 0;throw n}}function Hv(t,e="",r={}){return e.endsWith("/")&&(e=e.slice(0,-1)),r.prependPathname?`${e}/.well-known/${t}`:`/.well-known/${t}${e}`}async function kd(t,e,r=fetch){return await bi(t,{"MCP-Protocol-Version":e},r)}function Wv(t,e){return!t||t.status>=400&&t.status<500&&e!=="/"}async function $d(t,e,r,n){var s,a;const i=new URL(t),o=(s=n?.protocolVersion)!==null&&s!==void 0?s:Ut;let c;if(n?.metadataUrl)c=new URL(n.metadataUrl);else{const u=Hv(e,i.pathname);c=new URL(u,(a=n?.metadataServerUrl)!==null&&a!==void 0?a:i),c.search=i.search}let l=await kd(c,o,r);if(!n?.metadataUrl&&Wv(l,i.pathname)){const u=new URL(`/.well-known/${e}`,i);l=await kd(u,o,r)}return l}async function Kv(t,{authorizationServerUrl:e,protocolVersion:r}={},n=fetch){var s,a;typeof t=="string"&&(t=new URL(t)),e||(e=t),typeof e=="string"&&(e=new URL(e)),r??(r=Ut);const i=await $d(e,"oauth-authorization-server",n,{protocolVersion:r,metadataServerUrl:e});if(!i||i.status===404){await((s=i?.body)===null||s===void 0?void 0:s.cancel());return}if(!i.ok)throw await((a=i.body)===null||a===void 0?void 0:a.cancel()),new Error(`HTTP ${i.status} trying to load well-known OAuth metadata`);return ni.parse(await i.json())}function Ed(t){const e=typeof t=="string"?new URL(t):t,r=e.pathname!=="/",n=[];if(!r)return n.push({url:new URL("/.well-known/oauth-authorization-server",e.origin),type:"oauth"}),n.push({url:new URL("/.well-known/openid-configuration",e.origin),type:"oidc"}),n;let s=e.pathname;return s.endsWith("/")&&(s=s.slice(0,-1)),n.push({url:new URL(`/.well-known/oauth-authorization-server${s}`,e.origin),type:"oauth"}),n.push({url:new URL(`/.well-known/openid-configuration${s}`,e.origin),type:"oidc"}),n.push({url:new URL(`${s}/.well-known/openid-configuration`,e.origin),type:"oidc"}),n}async function Td(t,{fetchFn:e=fetch,protocolVersion:r=Ut}={}){var n;const s={"MCP-Protocol-Version":r,Accept:"application/json"},a=Ed(t);for(const{url:i,type:o}of a){const c=await bi(i,s,e);if(c){if(!c.ok){if(await((n=c.body)===null||n===void 0?void 0:n.cancel()),c.status>=400&&c.status<500)continue;throw new Error(`HTTP ${c.status} trying to load ${o==="oauth"?"OAuth":"OpenID provider"} metadata from ${i}`)}return o==="oauth"?ni.parse(await c.json()):Iv.parse(await c.json())}}}async function Rd(t,{metadata:e,clientInformation:r,redirectUrl:n,scope:s,state:a,resource:i}){let o;if(e){if(o=new URL(e.authorization_endpoint),!e.response_types_supported.includes(_i))throw new Error(`Incompatible auth server: does not support response type ${_i}`);if(e.code_challenge_methods_supported&&!e.code_challenge_methods_supported.includes(gi))throw new Error(`Incompatible auth server: does not support code challenge method ${gi}`)}else o=new URL("/authorize",t);const c=await Rv(),l=c.code_verifier,u=c.code_challenge;return o.searchParams.set("response_type",_i),o.searchParams.set("client_id",r.client_id),o.searchParams.set("code_challenge",u),o.searchParams.set("code_challenge_method",gi),o.searchParams.set("redirect_uri",String(n)),a&&o.searchParams.set("state",a),s&&o.searchParams.set("scope",s),s?.includes("offline_access")&&o.searchParams.append("prompt","consent"),i&&o.searchParams.set("resource",i.href),{authorizationUrl:o,codeVerifier:l}}function Si(t,e,r){return new URLSearchParams({grant_type:"authorization_code",code:t,code_verifier:e,redirect_uri:String(r)})}async function ki(t,{metadata:e,tokenRequestParams:r,clientInformation:n,addClientAuthentication:s,resource:a,fetchFn:i}){var o;const c=e?.token_endpoint?new URL(e.token_endpoint):new URL("/token",t),l=new Headers({"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"});if(a&&r.set("resource",a.href),s)await s(l,r,c,e);else if(n){const f=(o=e?.token_endpoint_auth_methods_supported)!==null&&o!==void 0?o:[],y=yd(n,f);Lv(y,n,l,r)}const u=await(i??fetch)(c,{method:"POST",headers:l,body:r});if(!u.ok)throw await vi(u);return Ov.parse(await u.json())}async function Jv(t,{metadata:e,clientInformation:r,authorizationCode:n,codeVerifier:s,redirectUri:a,resource:i,addClientAuthentication:o,fetchFn:c}){const l=Si(n,s,a);return ki(t,{metadata:e,tokenRequestParams:l,clientInformation:r,addClientAuthentication:o,resource:i,fetchFn:c})}async function Pd(t,{metadata:e,clientInformation:r,refreshToken:n,resource:s,addClientAuthentication:a,fetchFn:i}){const o=new URLSearchParams({grant_type:"refresh_token",refresh_token:n}),c=await ki(t,{metadata:e,tokenRequestParams:o,clientInformation:r,addClientAuthentication:a,resource:s,fetchFn:i});return{refresh_token:n,...c}}async function Cd(t,e,{metadata:r,resource:n,authorizationCode:s,fetchFn:a}={}){const i=t.clientMetadata.scope;let o;if(t.prepareTokenRequest&&(o=await t.prepareTokenRequest(i)),!o){if(!s)throw new Error("Either provider.prepareTokenRequest() or authorizationCode is required");if(!t.redirectUrl)throw new Error("redirectUrl is required for authorization_code flow");const l=await t.codeVerifier();o=Si(s,l,t.redirectUrl)}const c=await t.clientInformation();return ki(e,{metadata:r,tokenRequestParams:o,clientInformation:c??void 0,addClientAuthentication:t.addClientAuthentication,resource:n,fetchFn:a})}async function Id(t,{metadata:e,clientMetadata:r,fetchFn:n}){let s;if(e){if(!e.registration_endpoint)throw new Error("Incompatible auth server: does not support dynamic client registration");s=new URL(e.registration_endpoint)}else s=new URL("/register",t);const a=await(n??fetch)(s,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(r)});if(!a.ok)throw await vi(a);return zv.parse(await a.json())}class Od extends Error{constructor(e,r){super(e),this.name="ParseError",this.type=r.type,this.field=r.field,this.value=r.value,this.line=r.line}}function $i(t){}function Nd(t){if(typeof t=="function")throw new TypeError("`callbacks` must be an object, got a function instead. Did you mean `{onEvent: fn}`?");const{onEvent:e=$i,onError:r=$i,onRetry:n=$i,onComment:s}=t;let a="",i=!0,o,c="",l="";function u(w){const h=i?w.replace(/^\xEF\xBB\xBF/,""):w,[_,d]=Gv(`${a}${h}`);for(const m of _)f(m);a=d,i=!1}function f(w){if(w===""){v();return}if(w.startsWith(":")){s&&s(w.slice(w.startsWith(": ")?2:1));return}const h=w.indexOf(":");if(h!==-1){const _=w.slice(0,h),d=w[h+1]===" "?2:1,m=w.slice(h+d);y(_,m,w);return}y(w,"",w)}function y(w,h,_){switch(w){case"event":l=h;break;case"data":c=`${c}${h}
40
+ `;break;case"id":o=h.includes("\0")?void 0:h;break;case"retry":/^\d+$/.test(h)?n(parseInt(h,10)):r(new Od(`Invalid \`retry\` value: "${h}"`,{type:"invalid-retry",value:h,line:_}));break;default:r(new Od(`Unknown field "${w.length>20?`${w.slice(0,20)}…`:w}"`,{type:"unknown-field",field:w,value:h,line:_}));break}}function v(){c.length>0&&e({id:o,event:l||void 0,data:c.endsWith(`
41
+ `)?c.slice(0,-1):c}),o=void 0,c="",l=""}function p(w={}){a&&w.consume&&f(a),i=!0,o=void 0,c="",l="",a=""}return{feed:u,reset:p}}function Gv(t){const e=[];let r="",n=0;for(;n<t.length;){const s=t.indexOf("\r",n),a=t.indexOf(`
42
+ `,n);let i=-1;if(s!==-1&&a!==-1?i=Math.min(s,a):s!==-1?s===t.length-1?i=-1:i=s:a!==-1&&(i=a),i===-1){r=t.slice(n);break}else{const o=t.slice(n,i);e.push(o),n=i+1,t[n-1]==="\r"&&t[n]===`
43
+ `&&n++}}return[e,r]}class Ad extends Event{constructor(e,r){var n,s;super(e),this.code=(n=r?.code)!=null?n:void 0,this.message=(s=r?.message)!=null?s:void 0}[Symbol.for("nodejs.util.inspect.custom")](e,r,n){return n(jd(this),r)}[Symbol.for("Deno.customInspect")](e,r){return e(jd(this),r)}}function Bv(t){const e=globalThis.DOMException;return typeof e=="function"?new e(t,"SyntaxError"):new SyntaxError(t)}function Ei(t){return t instanceof Error?"errors"in t&&Array.isArray(t.errors)?t.errors.map(Ei).join(", "):"cause"in t&&t.cause instanceof Error?`${t}: ${Ei(t.cause)}`:t.message:`${t}`}function jd(t){return{type:t.type,message:t.message,code:t.code,defaultPrevented:t.defaultPrevented,cancelable:t.cancelable,timeStamp:t.timeStamp}}var zd=t=>{throw TypeError(t)},Ti=(t,e,r)=>e.has(t)||zd("Cannot "+r),le=(t,e,r)=>(Ti(t,e,"read from private field"),r?r.call(t):e.get(t)),je=(t,e,r)=>e.has(t)?zd("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,r),Pe=(t,e,r,n)=>(Ti(t,e,"write to private field"),e.set(t,r),r),kt=(t,e,r)=>(Ti(t,e,"access private method"),r),Ye,Gt,hr,Ms,qs,Hr,mr,Wr,zt,pr,_r,gr,Kr,ft,Ri,Pi,Ci,Md,Ii,Oi,Jr,Ni,Ai;class Zs extends EventTarget{constructor(e,r){var n,s;super(),je(this,ft),this.CONNECTING=0,this.OPEN=1,this.CLOSED=2,je(this,Ye),je(this,Gt),je(this,hr),je(this,Ms),je(this,qs),je(this,Hr),je(this,mr),je(this,Wr,null),je(this,zt),je(this,pr),je(this,_r,null),je(this,gr,null),je(this,Kr,null),je(this,Pi,async a=>{var i;le(this,pr).reset();const{body:o,redirected:c,status:l,headers:u}=a;if(l===204){kt(this,ft,Jr).call(this,"Server sent HTTP 204, not reconnecting",204),this.close();return}if(c?Pe(this,hr,new URL(a.url)):Pe(this,hr,void 0),l!==200){kt(this,ft,Jr).call(this,`Non-200 status code (${l})`,l);return}if(!(u.get("content-type")||"").startsWith("text/event-stream")){kt(this,ft,Jr).call(this,'Invalid content type, expected "text/event-stream"',l);return}if(le(this,Ye)===this.CLOSED)return;Pe(this,Ye,this.OPEN);const f=new Event("open");if((i=le(this,Kr))==null||i.call(this,f),this.dispatchEvent(f),typeof o!="object"||!o||!("getReader"in o)){kt(this,ft,Jr).call(this,"Invalid response body, expected a web ReadableStream",l),this.close();return}const y=new TextDecoder,v=o.getReader();let p=!0;do{const{done:w,value:h}=await v.read();h&&le(this,pr).feed(y.decode(h,{stream:!w})),w&&(p=!1,le(this,pr).reset(),kt(this,ft,Ni).call(this))}while(p)}),je(this,Ci,a=>{Pe(this,zt,void 0),!(a.name==="AbortError"||a.type==="aborted")&&kt(this,ft,Ni).call(this,Ei(a))}),je(this,Ii,a=>{typeof a.id=="string"&&Pe(this,Wr,a.id);const i=new MessageEvent(a.event||"message",{data:a.data,origin:le(this,hr)?le(this,hr).origin:le(this,Gt).origin,lastEventId:a.id||""});le(this,gr)&&(!a.event||a.event==="message")&&le(this,gr).call(this,i),this.dispatchEvent(i)}),je(this,Oi,a=>{Pe(this,Hr,a)}),je(this,Ai,()=>{Pe(this,mr,void 0),le(this,Ye)===this.CONNECTING&&kt(this,ft,Ri).call(this)});try{if(e instanceof URL)Pe(this,Gt,e);else if(typeof e=="string")Pe(this,Gt,new URL(e,Yv()));else throw new Error("Invalid URL")}catch{throw Bv("An invalid or illegal string was specified")}Pe(this,pr,Nd({onEvent:le(this,Ii),onRetry:le(this,Oi)})),Pe(this,Ye,this.CONNECTING),Pe(this,Hr,3e3),Pe(this,qs,(n=r?.fetch)!=null?n:globalThis.fetch),Pe(this,Ms,(s=r?.withCredentials)!=null?s:!1),kt(this,ft,Ri).call(this)}get readyState(){return le(this,Ye)}get url(){return le(this,Gt).href}get withCredentials(){return le(this,Ms)}get onerror(){return le(this,_r)}set onerror(e){Pe(this,_r,e)}get onmessage(){return le(this,gr)}set onmessage(e){Pe(this,gr,e)}get onopen(){return le(this,Kr)}set onopen(e){Pe(this,Kr,e)}addEventListener(e,r,n){const s=r;super.addEventListener(e,s,n)}removeEventListener(e,r,n){const s=r;super.removeEventListener(e,s,n)}close(){le(this,mr)&&clearTimeout(le(this,mr)),le(this,Ye)!==this.CLOSED&&(le(this,zt)&&le(this,zt).abort(),Pe(this,Ye,this.CLOSED),Pe(this,zt,void 0))}}Ye=new WeakMap,Gt=new WeakMap,hr=new WeakMap,Ms=new WeakMap,qs=new WeakMap,Hr=new WeakMap,mr=new WeakMap,Wr=new WeakMap,zt=new WeakMap,pr=new WeakMap,_r=new WeakMap,gr=new WeakMap,Kr=new WeakMap,ft=new WeakSet,Ri=function(){Pe(this,Ye,this.CONNECTING),Pe(this,zt,new AbortController),le(this,qs)(le(this,Gt),kt(this,ft,Md).call(this)).then(le(this,Pi)).catch(le(this,Ci))},Pi=new WeakMap,Ci=new WeakMap,Md=function(){var t;const e={mode:"cors",redirect:"follow",headers:{Accept:"text/event-stream",...le(this,Wr)?{"Last-Event-ID":le(this,Wr)}:void 0},cache:"no-store",signal:(t=le(this,zt))==null?void 0:t.signal};return"window"in globalThis&&(e.credentials=this.withCredentials?"include":"same-origin"),e},Ii=new WeakMap,Oi=new WeakMap,Jr=function(t,e){var r;le(this,Ye)!==this.CLOSED&&Pe(this,Ye,this.CLOSED);const n=new Ad("error",{code:e,message:t});(r=le(this,_r))==null||r.call(this,n),this.dispatchEvent(n)},Ni=function(t,e){var r;if(le(this,Ye)===this.CLOSED)return;Pe(this,Ye,this.CONNECTING);const n=new Ad("error",{code:e,message:t});(r=le(this,_r))==null||r.call(this,n),this.dispatchEvent(n),Pe(this,mr,setTimeout(le(this,Ai),le(this,Hr)))},Ai=new WeakMap,Zs.CONNECTING=0,Zs.OPEN=1,Zs.CLOSED=2;function Yv(){const t="document"in globalThis?globalThis.document:void 0;return t&&typeof t=="object"&&"baseURI"in t&&typeof t.baseURI=="string"?t.baseURI:void 0}function Gr(t){return t?t instanceof Headers?Object.fromEntries(t.entries()):Array.isArray(t)?Object.fromEntries(t):{...t}:{}}function ji(t=fetch,e){return e?async(r,n)=>{const s={...e,...n,headers:n?.headers?{...Gr(e.headers),...Gr(n.headers)}:e.headers};return t(r,s)}:t}class qd extends Error{constructor(e,r,n){super(`SSE error: ${r}`),this.code=e,this.event=n}}class Qv{constructor(e,r){this._url=e,this._resourceMetadataUrl=void 0,this._scope=void 0,this._eventSourceInit=r?.eventSourceInit,this._requestInit=r?.requestInit,this._authProvider=r?.authProvider,this._fetch=r?.fetch,this._fetchWithInit=ji(r?.fetch,r?.requestInit)}async _authThenStart(){var e;if(!this._authProvider)throw new at("No auth provider");let r;try{r=await jt(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})}catch(n){throw(e=this.onerror)===null||e===void 0||e.call(this,n),n}if(r!=="AUTHORIZED")throw new at;return await this._startOrAuth()}async _commonHeaders(){var e;const r={};if(this._authProvider){const s=await this._authProvider.tokens();s&&(r.Authorization=`Bearer ${s.access_token}`)}this._protocolVersion&&(r["mcp-protocol-version"]=this._protocolVersion);const n=Gr((e=this._requestInit)===null||e===void 0?void 0:e.headers);return new Headers({...r,...n})}_startOrAuth(){var e,r,n;const s=(n=(r=(e=this===null||this===void 0?void 0:this._eventSourceInit)===null||e===void 0?void 0:e.fetch)!==null&&r!==void 0?r:this._fetch)!==null&&n!==void 0?n:fetch;return new Promise((a,i)=>{this._eventSource=new Zs(this._url.href,{...this._eventSourceInit,fetch:async(o,c)=>{const l=await this._commonHeaders();l.set("Accept","text/event-stream");const u=await s(o,{...c,headers:l});if(u.status===401&&u.headers.has("www-authenticate")){const{resourceMetadataUrl:f,scope:y}=Fr(u);this._resourceMetadataUrl=f,this._scope=y}return u}}),this._abortController=new AbortController,this._eventSource.onerror=o=>{var c;if(o.code===401&&this._authProvider){this._authThenStart().then(a,i);return}const l=new qd(o.code,o.message,o);i(l),(c=this.onerror)===null||c===void 0||c.call(this,l)},this._eventSource.onopen=()=>{},this._eventSource.addEventListener("endpoint",o=>{var c;const l=o;try{if(this._endpoint=new URL(l.data,this._url),this._endpoint.origin!==this._url.origin)throw new Error(`Endpoint origin does not match connection origin: ${this._endpoint.origin}`)}catch(u){i(u),(c=this.onerror)===null||c===void 0||c.call(this,u),this.close();return}a()}),this._eventSource.onmessage=o=>{var c,l;const u=o;let f;try{f=Nr.parse(JSON.parse(u.data))}catch(y){(c=this.onerror)===null||c===void 0||c.call(this,y);return}(l=this.onmessage)===null||l===void 0||l.call(this,f)}})}async start(){if(this._eventSource)throw new Error("SSEClientTransport already started! If using Client class, note that connect() calls start() automatically.");return await this._startOrAuth()}async finishAuth(e){if(!this._authProvider)throw new at("No auth provider");if(await jt(this._authProvider,{serverUrl:this._url,authorizationCode:e,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})!=="AUTHORIZED")throw new at("Failed to authorize")}async close(){var e,r,n;(e=this._abortController)===null||e===void 0||e.abort(),(r=this._eventSource)===null||r===void 0||r.close(),(n=this.onclose)===null||n===void 0||n.call(this)}async send(e){var r,n,s,a;if(!this._endpoint)throw new Error("Not connected");try{const i=await this._commonHeaders();i.set("content-type","application/json");const o={...this._requestInit,method:"POST",headers:i,body:JSON.stringify(e),signal:(r=this._abortController)===null||r===void 0?void 0:r.signal},c=await((n=this._fetch)!==null&&n!==void 0?n:fetch)(this._endpoint,o);if(!c.ok){const l=await c.text().catch(()=>null);if(c.status===401&&this._authProvider){const{resourceMetadataUrl:u,scope:f}=Fr(c);if(this._resourceMetadataUrl=u,this._scope=f,await jt(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})!=="AUTHORIZED")throw new at;return this.send(e)}throw new Error(`Error POSTing to endpoint (HTTP ${c.status}): ${l}`)}await((s=c.body)===null||s===void 0?void 0:s.cancel())}catch(i){throw(a=this.onerror)===null||a===void 0||a.call(this,i),i}}setProtocolVersion(e){this._protocolVersion=e}}class Xv extends TransformStream{constructor({onError:e,onRetry:r,onComment:n}={}){let s;super({start(a){s=Nd({onEvent:i=>{a.enqueue(i)},onError(i){e==="terminate"?a.error(i):typeof e=="function"&&e(i)},onRetry:r,onComment:n})},transform(a){s.feed(a)}})}}const ey={initialReconnectionDelay:1e3,maxReconnectionDelay:3e4,reconnectionDelayGrowFactor:1.5,maxRetries:2};class Bt extends Error{constructor(e,r){super(`Streamable HTTP error: ${r}`),this.code=e}}class ty{constructor(e,r){var n;this._hasCompletedAuthFlow=!1,this._url=e,this._resourceMetadataUrl=void 0,this._scope=void 0,this._requestInit=r?.requestInit,this._authProvider=r?.authProvider,this._fetch=r?.fetch,this._fetchWithInit=ji(r?.fetch,r?.requestInit),this._sessionId=r?.sessionId,this._reconnectionOptions=(n=r?.reconnectionOptions)!==null&&n!==void 0?n:ey}async _authThenStart(){var e;if(!this._authProvider)throw new at("No auth provider");let r;try{r=await jt(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})}catch(n){throw(e=this.onerror)===null||e===void 0||e.call(this,n),n}if(r!=="AUTHORIZED")throw new at;return await this._startOrAuthSse({resumptionToken:void 0})}async _commonHeaders(){var e;const r={};if(this._authProvider){const s=await this._authProvider.tokens();s&&(r.Authorization=`Bearer ${s.access_token}`)}this._sessionId&&(r["mcp-session-id"]=this._sessionId),this._protocolVersion&&(r["mcp-protocol-version"]=this._protocolVersion);const n=Gr((e=this._requestInit)===null||e===void 0?void 0:e.headers);return new Headers({...r,...n})}async _startOrAuthSse(e){var r,n,s,a;const{resumptionToken:i}=e;try{const o=await this._commonHeaders();o.set("Accept","text/event-stream"),i&&o.set("last-event-id",i);const c=await((r=this._fetch)!==null&&r!==void 0?r:fetch)(this._url,{method:"GET",headers:o,signal:(n=this._abortController)===null||n===void 0?void 0:n.signal});if(!c.ok){if(await((s=c.body)===null||s===void 0?void 0:s.cancel()),c.status===401&&this._authProvider)return await this._authThenStart();if(c.status===405)return;throw new Bt(c.status,`Failed to open SSE stream: ${c.statusText}`)}this._handleSseStream(c.body,e,!0)}catch(o){throw(a=this.onerror)===null||a===void 0||a.call(this,o),o}}_getNextReconnectionDelay(e){if(this._serverRetryMs!==void 0)return this._serverRetryMs;const r=this._reconnectionOptions.initialReconnectionDelay,n=this._reconnectionOptions.reconnectionDelayGrowFactor,s=this._reconnectionOptions.maxReconnectionDelay;return Math.min(r*Math.pow(n,e),s)}_scheduleReconnection(e,r=0){var n;const s=this._reconnectionOptions.maxRetries;if(r>=s){(n=this.onerror)===null||n===void 0||n.call(this,new Error(`Maximum reconnection attempts (${s}) exceeded.`));return}const a=this._getNextReconnectionDelay(r);this._reconnectionTimeout=setTimeout(()=>{this._startOrAuthSse(e).catch(i=>{var o;(o=this.onerror)===null||o===void 0||o.call(this,new Error(`Failed to reconnect SSE stream: ${i instanceof Error?i.message:String(i)}`)),this._scheduleReconnection(e,r+1)})},a)}_handleSseStream(e,r,n){if(!e)return;const{onresumptiontoken:s,replayMessageId:a}=r;let i,o=!1,c=!1;(async()=>{var u,f,y,v;try{const p=e.pipeThrough(new TextDecoderStream).pipeThrough(new Xv({onRetry:_=>{this._serverRetryMs=_}})).getReader();for(;;){const{value:_,done:d}=await p.read();if(d)break;if(_.id&&(i=_.id,o=!0,s?.(_.id)),!!_.data&&(!_.event||_.event==="message"))try{const m=Nr.parse(JSON.parse(_.data));er(m)&&(c=!0,a!==void 0&&(m.id=a)),(u=this.onmessage)===null||u===void 0||u.call(this,m)}catch(m){(f=this.onerror)===null||f===void 0||f.call(this,m)}}(n||o)&&!c&&this._abortController&&!this._abortController.signal.aborted&&this._scheduleReconnection({resumptionToken:i,onresumptiontoken:s,replayMessageId:a},0)}catch(p){if((y=this.onerror)===null||y===void 0||y.call(this,new Error(`SSE stream disconnected: ${p}`)),(n||o)&&!c&&this._abortController&&!this._abortController.signal.aborted)try{this._scheduleReconnection({resumptionToken:i,onresumptiontoken:s,replayMessageId:a},0)}catch(_){(v=this.onerror)===null||v===void 0||v.call(this,new Error(`Failed to reconnect: ${_ instanceof Error?_.message:String(_)}`))}}})()}async start(){if(this._abortController)throw new Error("StreamableHTTPClientTransport already started! If using Client class, note that connect() calls start() automatically.");this._abortController=new AbortController}async finishAuth(e){if(!this._authProvider)throw new at("No auth provider");if(await jt(this._authProvider,{serverUrl:this._url,authorizationCode:e,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})!=="AUTHORIZED")throw new at("Failed to authorize")}async close(){var e,r;this._reconnectionTimeout&&(clearTimeout(this._reconnectionTimeout),this._reconnectionTimeout=void 0),(e=this._abortController)===null||e===void 0||e.abort(),(r=this.onclose)===null||r===void 0||r.call(this)}async send(e,r){var n,s,a,i,o,c,l;try{const{resumptionToken:u,onresumptiontoken:f}=r||{};if(u){this._startOrAuthSse({resumptionToken:u,replayMessageId:Xn(e)?e.id:void 0}).catch(m=>{var b;return(b=this.onerror)===null||b===void 0?void 0:b.call(this,m)});return}const y=await this._commonHeaders();y.set("content-type","application/json"),y.set("accept","application/json, text/event-stream");const v={...this._requestInit,method:"POST",headers:y,body:JSON.stringify(e),signal:(n=this._abortController)===null||n===void 0?void 0:n.signal},p=await((s=this._fetch)!==null&&s!==void 0?s:fetch)(this._url,v),w=p.headers.get("mcp-session-id");if(w&&(this._sessionId=w),!p.ok){const m=await p.text().catch(()=>null);if(p.status===401&&this._authProvider){if(this._hasCompletedAuthFlow)throw new Bt(401,"Server returned 401 after successful authentication");const{resourceMetadataUrl:b,scope:g}=Fr(p);if(this._resourceMetadataUrl=b,this._scope=g,await jt(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})!=="AUTHORIZED")throw new at;return this._hasCompletedAuthFlow=!0,this.send(e)}if(p.status===403&&this._authProvider){const{resourceMetadataUrl:b,scope:g,error:S}=Fr(p);if(S==="insufficient_scope"){const E=p.headers.get("WWW-Authenticate");if(this._lastUpscopingHeader===E)throw new Bt(403,"Server returned 403 after trying upscoping");if(g&&(this._scope=g),b&&(this._resourceMetadataUrl=b),this._lastUpscopingHeader=E??void 0,await jt(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetch})!=="AUTHORIZED")throw new at;return this.send(e)}}throw new Bt(p.status,`Error POSTing to endpoint: ${m}`)}if(this._hasCompletedAuthFlow=!1,this._lastUpscopingHeader=void 0,p.status===202){await((a=p.body)===null||a===void 0?void 0:a.cancel()),gu(e)&&this._startOrAuthSse({resumptionToken:void 0}).catch(m=>{var b;return(b=this.onerror)===null||b===void 0?void 0:b.call(this,m)});return}const _=(Array.isArray(e)?e:[e]).filter(m=>"method"in m&&"id"in m&&m.id!==void 0).length>0,d=p.headers.get("content-type");if(_)if(d?.includes("text/event-stream"))this._handleSseStream(p.body,{onresumptiontoken:f},!1);else if(d?.includes("application/json")){const m=await p.json(),b=Array.isArray(m)?m.map(g=>Nr.parse(g)):[Nr.parse(m)];for(const g of b)(i=this.onmessage)===null||i===void 0||i.call(this,g)}else throw await((o=p.body)===null||o===void 0?void 0:o.cancel()),new Bt(-1,`Unexpected content type: ${d}`);else await((c=p.body)===null||c===void 0?void 0:c.cancel())}catch(u){throw(l=this.onerror)===null||l===void 0||l.call(this,u),u}}get sessionId(){return this._sessionId}async terminateSession(){var e,r,n,s;if(this._sessionId)try{const a=await this._commonHeaders(),i={...this._requestInit,method:"DELETE",headers:a,signal:(e=this._abortController)===null||e===void 0?void 0:e.signal},o=await((r=this._fetch)!==null&&r!==void 0?r:fetch)(this._url,i);if(await((n=o.body)===null||n===void 0?void 0:n.cancel()),!o.ok&&o.status!==405)throw new Bt(o.status,`Failed to terminate session: ${o.statusText}`);this._sessionId=void 0}catch(a){throw(s=this.onerror)===null||s===void 0||s.call(this,a),a}}setProtocolVersion(e){this._protocolVersion=e}get protocolVersion(){return this._protocolVersion}async resumeStream(e,r){await this._startOrAuthSse({resumptionToken:e,onresumptiontoken:r?.onresumptiontoken})}}class ry{constructor(e){this._server=e}requestStream(e,r,n){return this._server.requestStream(e,r,n)}async getTask(e,r){return this._server.getTask({taskId:e},r)}async getTaskResult(e,r,n){return this._server.getTaskResult({taskId:e},r,n)}async listTasks(e,r){return this._server.listTasks(e?{cursor:e}:void 0,r)}async cancelTask(e,r){return this._server.cancelTask({taskId:e},r)}}class ny extends Qa{constructor(e,r){var n,s;super(r),this._serverInfo=e,this._loggingLevels=new Map,this.LOG_LEVEL_SEVERITY=new Map(zr.options.map((a,i)=>[a,i])),this.isMessageIgnored=(a,i)=>{const o=this._loggingLevels.get(i);return o?this.LOG_LEVEL_SEVERITY.get(a)<this.LOG_LEVEL_SEVERITY.get(o):!1},this._capabilities=(n=r?.capabilities)!==null&&n!==void 0?n:{},this._instructions=r?.instructions,this._jsonSchemaValidator=(s=r?.jsonSchemaValidator)!==null&&s!==void 0?s:new md,this.setRequestHandler(ts,a=>this._oninitialize(a)),this.setNotificationHandler(rs,()=>{var a;return(a=this.oninitialized)===null||a===void 0?void 0:a.call(this)}),this._capabilities.logging&&this.setRequestHandler(Aa,async(a,i)=>{var o;const c=i.sessionId||((o=i.requestInfo)===null||o===void 0?void 0:o.headers["mcp-session-id"])||void 0,{level:l}=a.params,u=zr.safeParse(l);return u.success&&this._loggingLevels.set(c,u.data),{}})}get experimental(){return this._experimental||(this._experimental={tasks:new ry(this)}),this._experimental}registerCapabilities(e){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=Xa(this._capabilities,e)}setRequestHandler(e,r){var n,s,a;const i=dr(e),o=i?.method;if(!o)throw new Error("Schema is missing a method literal");let c;if(st(o)){const u=o,f=(n=u._zod)===null||n===void 0?void 0:n.def;c=(s=f?.value)!==null&&s!==void 0?s:u.value}else{const u=o,f=u._def;c=(a=f?.value)!==null&&a!==void 0?a:u.value}if(typeof c!="string")throw new Error("Schema method literal must be a string");if(c==="tools/call"){const u=async(f,y)=>{const v=ut(jr,f);if(!v.success){const _=v.error instanceof Error?v.error.message:String(v.error);throw new K($.ErrorCode.InvalidParams,`Invalid tools/call request: ${_}`)}const{params:p}=v.data,w=await Promise.resolve(r(f,y));if(p.task){const _=ut(Ft,w);if(!_.success){const d=_.error instanceof Error?_.error.message:String(_.error);throw new K($.ErrorCode.InvalidParams,`Invalid task creation result: ${d}`)}return _.data}const h=ut(ar,w);if(!h.success){const _=h.error instanceof Error?h.error.message:String(h.error);throw new K($.ErrorCode.InvalidParams,`Invalid tools/call result: ${_}`)}return h.data};return super.setRequestHandler(e,u)}return super.setRequestHandler(e,r)}assertCapabilityForMethod(e){var r,n,s;switch(e){case"sampling/createMessage":if(!(!((r=this._clientCapabilities)===null||r===void 0)&&r.sampling))throw new Error(`Client does not support sampling (required for ${e})`);break;case"elicitation/create":if(!(!((n=this._clientCapabilities)===null||n===void 0)&&n.elicitation))throw new Error(`Client does not support elicitation (required for ${e})`);break;case"roots/list":if(!(!((s=this._clientCapabilities)===null||s===void 0)&&s.roots))throw new Error(`Client does not support listing roots (required for ${e})`);break}}assertNotificationCapability(e){var r,n;switch(e){case"notifications/message":if(!this._capabilities.logging)throw new Error(`Server does not support logging (required for ${e})`);break;case"notifications/resources/updated":case"notifications/resources/list_changed":if(!this._capabilities.resources)throw new Error(`Server does not support notifying about resources (required for ${e})`);break;case"notifications/tools/list_changed":if(!this._capabilities.tools)throw new Error(`Server does not support notifying of tool list changes (required for ${e})`);break;case"notifications/prompts/list_changed":if(!this._capabilities.prompts)throw new Error(`Server does not support notifying of prompt list changes (required for ${e})`);break;case"notifications/elicitation/complete":if(!(!((n=(r=this._clientCapabilities)===null||r===void 0?void 0:r.elicitation)===null||n===void 0)&&n.url))throw new Error(`Client does not support URL elicitation (required for ${e})`);break}}assertRequestHandlerCapability(e){if(this._capabilities)switch(e){case"completion/complete":if(!this._capabilities.completions)throw new Error(`Server does not support completions (required for ${e})`);break;case"logging/setLevel":if(!this._capabilities.logging)throw new Error(`Server does not support logging (required for ${e})`);break;case"prompts/get":case"prompts/list":if(!this._capabilities.prompts)throw new Error(`Server does not support prompts (required for ${e})`);break;case"resources/list":case"resources/templates/list":case"resources/read":if(!this._capabilities.resources)throw new Error(`Server does not support resources (required for ${e})`);break;case"tools/call":case"tools/list":if(!this._capabilities.tools)throw new Error(`Server does not support tools (required for ${e})`);break;case"tasks/get":case"tasks/list":case"tasks/result":case"tasks/cancel":if(!this._capabilities.tasks)throw new Error(`Server does not support tasks capability (required for ${e})`);break}}assertTaskCapability(e){var r,n;_d((n=(r=this._clientCapabilities)===null||r===void 0?void 0:r.tasks)===null||n===void 0?void 0:n.requests,e,"Client")}assertTaskHandlerCapability(e){var r;this._capabilities&&pd((r=this._capabilities.tasks)===null||r===void 0?void 0:r.requests,e,"Server")}async _oninitialize(e){const r=e.params.protocolVersion;return this._clientCapabilities=e.params.capabilities,this._clientVersion=e.params.clientInfo,{protocolVersion:fa.includes(r)?r:Ut,capabilities:this.getCapabilities(),serverInfo:this._serverInfo,...this._instructions&&{instructions:this._instructions}}}getClientCapabilities(){return this._clientCapabilities}getClientVersion(){return this._clientVersion}getCapabilities(){return this._capabilities}async ping(){return this.request({method:"ping"},Ct)}async createMessage(e,r){var n,s;if((e.tools||e.toolChoice)&&!(!((s=(n=this._clientCapabilities)===null||n===void 0?void 0:n.sampling)===null||s===void 0)&&s.tools))throw new Error("Client does not support sampling tools capability.");if(e.messages.length>0){const a=e.messages[e.messages.length-1],i=Array.isArray(a.content)?a.content:[a.content],o=i.some(f=>f.type==="tool_result"),c=e.messages.length>1?e.messages[e.messages.length-2]:void 0,l=c?Array.isArray(c.content)?c.content:[c.content]:[],u=l.some(f=>f.type==="tool_use");if(o){if(i.some(f=>f.type!=="tool_result"))throw new Error("The last message must contain only tool_result content if any is present");if(!u)throw new Error("tool_result blocks are not matching any tool_use from the previous message")}if(u){const f=new Set(l.filter(v=>v.type==="tool_use").map(v=>v.id)),y=new Set(i.filter(v=>v.type==="tool_result").map(v=>v.toolUseId));if(f.size!==y.size||![...f].every(v=>y.has(v)))throw new Error("ids of tool_result blocks and tool_use blocks from previous message do not match")}}return e.tools?this.request({method:"sampling/createMessage",params:e},za,r):this.request({method:"sampling/createMessage",params:e},bs,r)}async elicitInput(e,r){var n,s,a,i,o;switch((n=e.mode)!==null&&n!==void 0?n:"form"){case"url":{if(!(!((a=(s=this._clientCapabilities)===null||s===void 0?void 0:s.elicitation)===null||a===void 0)&&a.url))throw new Error("Client does not support url elicitation.");const l=e;return this.request({method:"elicitation/create",params:l},qr,r)}case"form":{if(!(!((o=(i=this._clientCapabilities)===null||i===void 0?void 0:i.elicitation)===null||o===void 0)&&o.form))throw new Error("Client does not support form elicitation.");const l=e.mode==="form"?e:{...e,mode:"form"},u=await this.request({method:"elicitation/create",params:l},qr,r);if(u.action==="accept"&&u.content&&l.requestedSchema)try{const y=this._jsonSchemaValidator.getValidator(l.requestedSchema)(u.content);if(!y.valid)throw new K($.ErrorCode.InvalidParams,`Elicitation response content does not match requested schema: ${y.errorMessage}`)}catch(f){throw f instanceof K?f:new K($.ErrorCode.InternalError,`Error validating elicitation response: ${f instanceof Error?f.message:String(f)}`)}return u}}}createElicitationCompletionNotifier(e,r){var n,s;if(!(!((s=(n=this._clientCapabilities)===null||n===void 0?void 0:n.elicitation)===null||s===void 0)&&s.url))throw new Error("Client does not support URL elicitation (required for notifications/elicitation/complete)");return()=>this.notification({method:"notifications/elicitation/complete",params:{elicitationId:e}},r)}async listRoots(e,r){return this.request({method:"roots/list",params:e},xa,r)}async sendLoggingMessage(e,r){if(this._capabilities.logging&&!this.isMessageIgnored(e.level,r))return this.notification({method:"notifications/message",params:e})}async sendResourceUpdated(e){return this.notification({method:"notifications/resources/updated",params:e})}async sendResourceListChanged(){return this.notification({method:"notifications/resources/list_changed"})}async sendToolListChanged(){return this.notification({method:"notifications/tools/list_changed"})}async sendPromptListChanged(){return this.notification({method:"notifications/prompts/list_changed"})}}const sy=/^[A-Za-z0-9._-]{1,128}$/;function ay(t){const e=[];if(t.length===0)return{isValid:!1,warnings:["Tool name cannot be empty"]};if(t.length>128)return{isValid:!1,warnings:[`Tool name exceeds maximum length of 128 characters (current: ${t.length})`]};if(t.includes(" ")&&e.push("Tool name contains spaces, which may cause parsing issues"),t.includes(",")&&e.push("Tool name contains commas, which may cause parsing issues"),(t.startsWith("-")||t.endsWith("-"))&&e.push("Tool name starts or ends with a dash, which may cause parsing issues in some contexts"),(t.startsWith(".")||t.endsWith("."))&&e.push("Tool name starts or ends with a dot, which may cause parsing issues in some contexts"),!sy.test(t)){const r=t.split("").filter(n=>!/[A-Za-z0-9._-]/.test(n)).filter((n,s,a)=>a.indexOf(n)===s);return e.push(`Tool name contains invalid characters: ${r.map(n=>`"${n}"`).join(", ")}`,"Allowed characters are: A-Z, a-z, 0-9, underscore (_), dash (-), and dot (.)"),{isValid:!1,warnings:e}}return{isValid:!0,warnings:e}}function iy(t,e){if(e.length>0){console.warn(`Tool name validation warning for "${t}":`);for(const r of e)console.warn(` - ${r}`);console.warn("Tool registration will proceed, but this may cause compatibility issues."),console.warn("Consider updating the tool name to conform to the MCP tool naming standard."),console.warn("See SEP: Specify Format for Tool Names (https://github.com/modelcontextprotocol/modelcontextprotocol/issues/986) for more details.")}}function Zd(t){const e=ay(t);return iy(t,e.warnings),e.isValid}class oy{constructor(e){this._mcpServer=e}registerToolTask(e,r,n){const s={taskSupport:"required",...r.execution};if(s.taskSupport==="forbidden")throw new Error(`Cannot register task-based tool '${e}' with taskSupport 'forbidden'. Use registerTool() instead.`);return this._mcpServer._createRegisteredTool(e,r.title,r.description,r.inputSchema,r.outputSchema,r.annotations,s,r._meta,n)}}class cy{constructor(e,r){this._registeredResources={},this._registeredResourceTemplates={},this._registeredTools={},this._registeredPrompts={},this._toolHandlersInitialized=!1,this._completionHandlerInitialized=!1,this._resourceHandlersInitialized=!1,this._promptHandlersInitialized=!1,this.server=new ny(e,r)}get experimental(){return this._experimental||(this._experimental={tasks:new oy(this)}),this._experimental}async connect(e){return await this.server.connect(e)}async close(){await this.server.close()}setToolRequestHandlers(){this._toolHandlersInitialized||(this.server.assertCanSetRequestHandler(Mt(ws)),this.server.assertCanSetRequestHandler(Mt(jr)),this.server.registerCapabilities({tools:{listChanged:!0}}),this.server.setRequestHandler(ws,()=>({tools:Object.entries(this._registeredTools).filter(([,e])=>e.enabled).map(([e,r])=>{const n={name:e,title:r.title,description:r.description,inputSchema:(()=>{const s=Vr(r.inputSchema);return s?id(s,{strictUnions:!0,pipeStrategy:"input"}):ly})(),annotations:r.annotations,execution:r.execution,_meta:r._meta};if(r.outputSchema){const s=Vr(r.outputSchema);s&&(n.outputSchema=id(s,{strictUnions:!0,pipeStrategy:"output"}))}return n})})),this.server.setRequestHandler(jr,async(e,r)=>{var n;try{const s=this._registeredTools[e.params.name];if(!s)throw new K($.ErrorCode.InvalidParams,`Tool ${e.params.name} not found`);if(!s.enabled)throw new K($.ErrorCode.InvalidParams,`Tool ${e.params.name} disabled`);const a=!!e.params.task,i=(n=s.execution)===null||n===void 0?void 0:n.taskSupport,o="createTask"in s.handler;if((i==="required"||i==="optional")&&!o)throw new K($.ErrorCode.InternalError,`Tool ${e.params.name} has taskSupport '${i}' but was not registered with registerToolTask`);if(i==="required"&&!a)throw new K($.ErrorCode.MethodNotFound,`Tool ${e.params.name} requires task augmentation (taskSupport: 'required')`);if(i==="optional"&&!a&&o)return await this.handleAutomaticTaskPolling(s,e,r);const c=await this.validateToolInput(s,e.params.arguments,e.params.name),l=await this.executeToolHandler(s,c,r);return a||await this.validateToolOutput(s,l,e.params.name),l}catch(s){if(s instanceof K&&s.code===$.ErrorCode.UrlElicitationRequired)throw s;return this.createToolError(s instanceof Error?s.message:String(s))}}),this._toolHandlersInitialized=!0)}createToolError(e){return{content:[{type:"text",text:e}],isError:!0}}async validateToolInput(e,r,n){if(!e.inputSchema)return;const s=Vr(e.inputSchema),a=s??e.inputSchema,i=await Ja(a,r);if(!i.success){const o="error"in i?i.error:"Unknown error",c=Ga(o);throw new K($.ErrorCode.InvalidParams,`Input validation error: Invalid arguments for tool ${n}: ${c}`)}return i.data}async validateToolOutput(e,r,n){if(!e.outputSchema||!("content"in r)||r.isError)return;if(!r.structuredContent)throw new K($.ErrorCode.InvalidParams,`Output validation error: Tool ${n} has an output schema but no structured content was provided`);const s=Vr(e.outputSchema),a=await Ja(s,r.structuredContent);if(!a.success){const i="error"in a?a.error:"Unknown error",o=Ga(i);throw new K($.ErrorCode.InvalidParams,`Output validation error: Invalid structured content for tool ${n}: ${o}`)}}async executeToolHandler(e,r,n){const s=e.handler;if("createTask"in s){if(!n.taskStore)throw new Error("No task store provided.");const i={...n,taskStore:n.taskStore};if(e.inputSchema){const o=s;return await Promise.resolve(o.createTask(r,i))}else{const o=s;return await Promise.resolve(o.createTask(i))}}if(e.inputSchema){const i=s;return await Promise.resolve(i(r,n))}else{const i=s;return await Promise.resolve(i(n))}}async handleAutomaticTaskPolling(e,r,n){var s;if(!n.taskStore)throw new Error("No task store provided for task-capable tool.");const a=await this.validateToolInput(e,r.params.arguments,r.params.name),i=e.handler,o={...n,taskStore:n.taskStore},c=a?await Promise.resolve(i.createTask(a,o)):await Promise.resolve(i.createTask(o)),l=c.task.taskId;let u=c.task;const f=(s=u.pollInterval)!==null&&s!==void 0?s:5e3;for(;u.status!=="completed"&&u.status!=="failed"&&u.status!=="cancelled";){await new Promise(v=>setTimeout(v,f));const y=await n.taskStore.getTask(l);if(!y)throw new K($.ErrorCode.InternalError,`Task ${l} not found during polling`);u=y}return await n.taskStore.getTaskResult(l)}setCompletionRequestHandler(){this._completionHandlerInitialized||(this.server.assertCanSetRequestHandler(Mt(Ss)),this.server.registerCapabilities({completions:{}}),this.server.setRequestHandler(Ss,async e=>{switch(e.params.ref.type){case"ref/prompt":return wl(e),this.handlePromptCompletion(e,e.params.ref);case"ref/resource":return bl(e),this.handleResourceCompletion(e,e.params.ref);default:throw new K($.ErrorCode.InvalidParams,`Invalid completion reference: ${e.params.ref}`)}}),this._completionHandlerInitialized=!0)}async handlePromptCompletion(e,r){const n=this._registeredPrompts[r.name];if(!n)throw new K($.ErrorCode.InvalidParams,`Prompt ${r.name} not found`);if(!n.enabled)throw new K($.ErrorCode.InvalidParams,`Prompt ${r.name} disabled`);if(!n.argsSchema)return Br;const s=dr(n.argsSchema),a=s?.[e.params.argument.name];if(!Pl(a))return Br;const i=Cl(a);if(!i)return Br;const o=await i(e.params.argument.value,e.params.context);return Ud(o)}async handleResourceCompletion(e,r){const n=Object.values(this._registeredResourceTemplates).find(i=>i.resourceTemplate.uriTemplate.toString()===r.uri);if(!n){if(this._registeredResources[r.uri])return Br;throw new K($.ErrorCode.InvalidParams,`Resource template ${e.params.ref.uri} not found`)}const s=n.resourceTemplate.completeCallback(e.params.argument.name);if(!s)return Br;const a=await s(e.params.argument.value,e.params.context);return Ud(a)}setResourceRequestHandlers(){this._resourceHandlersInitialized||(this.server.assertCanSetRequestHandler(Mt(ls)),this.server.assertCanSetRequestHandler(Mt(ds)),this.server.assertCanSetRequestHandler(Mt(hs)),this.server.registerCapabilities({resources:{listChanged:!0}}),this.server.setRequestHandler(ls,async(e,r)=>{const n=Object.entries(this._registeredResources).filter(([a,i])=>i.enabled).map(([a,i])=>({uri:a,name:i.name,...i.metadata})),s=[];for(const a of Object.values(this._registeredResourceTemplates)){if(!a.resourceTemplate.listCallback)continue;const i=await a.resourceTemplate.listCallback(r);for(const o of i.resources)s.push({...a.metadata,...o})}return{resources:[...n,...s]}}),this.server.setRequestHandler(ds,async()=>({resourceTemplates:Object.entries(this._registeredResourceTemplates).map(([r,n])=>({name:r,uriTemplate:n.resourceTemplate.uriTemplate.toString(),...n.metadata}))})),this.server.setRequestHandler(hs,async(e,r)=>{const n=new URL(e.params.uri),s=this._registeredResources[n.toString()];if(s){if(!s.enabled)throw new K($.ErrorCode.InvalidParams,`Resource ${n} disabled`);return s.readCallback(n,r)}for(const a of Object.values(this._registeredResourceTemplates)){const i=a.resourceTemplate.uriTemplate.match(n.toString());if(i)return a.readCallback(n,i,r)}throw new K($.ErrorCode.InvalidParams,`Resource ${n} not found`)}),this.setCompletionRequestHandler(),this._resourceHandlersInitialized=!0)}setPromptRequestHandlers(){this._promptHandlersInitialized||(this.server.assertCanSetRequestHandler(Mt(ms)),this.server.assertCanSetRequestHandler(Mt(ps)),this.server.registerCapabilities({prompts:{listChanged:!0}}),this.server.setRequestHandler(ms,()=>({prompts:Object.entries(this._registeredPrompts).filter(([,e])=>e.enabled).map(([e,r])=>({name:e,title:r.title,description:r.description,arguments:r.argsSchema?fy(r.argsSchema):void 0}))})),this.server.setRequestHandler(ps,async(e,r)=>{const n=this._registeredPrompts[e.params.name];if(!n)throw new K($.ErrorCode.InvalidParams,`Prompt ${e.params.name} not found`);if(!n.enabled)throw new K($.ErrorCode.InvalidParams,`Prompt ${e.params.name} disabled`);if(n.argsSchema){const s=Vr(n.argsSchema),a=await Ja(s,e.params.arguments);if(!a.success){const c="error"in a?a.error:"Unknown error",l=Ga(c);throw new K($.ErrorCode.InvalidParams,`Invalid arguments for prompt ${e.params.name}: ${l}`)}const i=a.data,o=n.callback;return await Promise.resolve(o(i,r))}else{const s=n.callback;return await Promise.resolve(s(r))}}),this.setCompletionRequestHandler(),this._promptHandlersInitialized=!0)}resource(e,r,...n){let s;typeof n[0]=="object"&&(s=n.shift());const a=n[0];if(typeof r=="string"){if(this._registeredResources[r])throw new Error(`Resource ${r} is already registered`);const i=this._createRegisteredResource(e,void 0,r,s,a);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),i}else{if(this._registeredResourceTemplates[e])throw new Error(`Resource template ${e} is already registered`);const i=this._createRegisteredResourceTemplate(e,void 0,r,s,a);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),i}}registerResource(e,r,n,s){if(typeof r=="string"){if(this._registeredResources[r])throw new Error(`Resource ${r} is already registered`);const a=this._createRegisteredResource(e,n.title,r,n,s);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),a}else{if(this._registeredResourceTemplates[e])throw new Error(`Resource template ${e} is already registered`);const a=this._createRegisteredResourceTemplate(e,n.title,r,n,s);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),a}}_createRegisteredResource(e,r,n,s,a){const i={name:e,title:r,metadata:s,readCallback:a,enabled:!0,disable:()=>i.update({enabled:!1}),enable:()=>i.update({enabled:!0}),remove:()=>i.update({uri:null}),update:o=>{typeof o.uri<"u"&&o.uri!==n&&(delete this._registeredResources[n],o.uri&&(this._registeredResources[o.uri]=i)),typeof o.name<"u"&&(i.name=o.name),typeof o.title<"u"&&(i.title=o.title),typeof o.metadata<"u"&&(i.metadata=o.metadata),typeof o.callback<"u"&&(i.readCallback=o.callback),typeof o.enabled<"u"&&(i.enabled=o.enabled),this.sendResourceListChanged()}};return this._registeredResources[n]=i,i}_createRegisteredResourceTemplate(e,r,n,s,a){const i={resourceTemplate:n,title:r,metadata:s,readCallback:a,enabled:!0,disable:()=>i.update({enabled:!1}),enable:()=>i.update({enabled:!0}),remove:()=>i.update({name:null}),update:o=>{typeof o.name<"u"&&o.name!==e&&(delete this._registeredResourceTemplates[e],o.name&&(this._registeredResourceTemplates[o.name]=i)),typeof o.title<"u"&&(i.title=o.title),typeof o.template<"u"&&(i.resourceTemplate=o.template),typeof o.metadata<"u"&&(i.metadata=o.metadata),typeof o.callback<"u"&&(i.readCallback=o.callback),typeof o.enabled<"u"&&(i.enabled=o.enabled),this.sendResourceListChanged()}};return this._registeredResourceTemplates[e]=i,i}_createRegisteredPrompt(e,r,n,s,a){const i={title:r,description:n,argsSchema:s===void 0?void 0:Dr(s),callback:a,enabled:!0,disable:()=>i.update({enabled:!1}),enable:()=>i.update({enabled:!0}),remove:()=>i.update({name:null}),update:o=>{typeof o.name<"u"&&o.name!==e&&(delete this._registeredPrompts[e],o.name&&(this._registeredPrompts[o.name]=i)),typeof o.title<"u"&&(i.title=o.title),typeof o.description<"u"&&(i.description=o.description),typeof o.argsSchema<"u"&&(i.argsSchema=Dr(o.argsSchema)),typeof o.callback<"u"&&(i.callback=o.callback),typeof o.enabled<"u"&&(i.enabled=o.enabled),this.sendPromptListChanged()}};return this._registeredPrompts[e]=i,i}_createRegisteredTool(e,r,n,s,a,i,o,c,l){Zd(e);const u={title:r,description:n,inputSchema:Ld(s),outputSchema:Ld(a),annotations:i,execution:o,_meta:c,handler:l,enabled:!0,disable:()=>u.update({enabled:!1}),enable:()=>u.update({enabled:!0}),remove:()=>u.update({name:null}),update:f=>{typeof f.name<"u"&&f.name!==e&&(typeof f.name=="string"&&Zd(f.name),delete this._registeredTools[e],f.name&&(this._registeredTools[f.name]=u)),typeof f.title<"u"&&(u.title=f.title),typeof f.description<"u"&&(u.description=f.description),typeof f.paramsSchema<"u"&&(u.inputSchema=Dr(f.paramsSchema)),typeof f.callback<"u"&&(u.handler=f.callback),typeof f.annotations<"u"&&(u.annotations=f.annotations),typeof f._meta<"u"&&(u._meta=f._meta),typeof f.enabled<"u"&&(u.enabled=f.enabled),this.sendToolListChanged()}};return this._registeredTools[e]=u,this.setToolRequestHandlers(),this.sendToolListChanged(),u}tool(e,...r){if(this._registeredTools[e])throw new Error(`Tool ${e} is already registered`);let n,s,a,i;if(typeof r[0]=="string"&&(n=r.shift()),r.length>1){const c=r[0];zi(c)?(s=r.shift(),r.length>1&&typeof r[0]=="object"&&r[0]!==null&&!zi(r[0])&&(i=r.shift())):typeof c=="object"&&c!==null&&(i=r.shift())}const o=r[0];return this._createRegisteredTool(e,void 0,n,s,a,i,{taskSupport:"forbidden"},void 0,o)}registerTool(e,r,n){if(this._registeredTools[e])throw new Error(`Tool ${e} is already registered`);const{title:s,description:a,inputSchema:i,outputSchema:o,annotations:c,_meta:l}=r;return this._createRegisteredTool(e,s,a,i,o,c,{taskSupport:"forbidden"},l,n)}prompt(e,...r){if(this._registeredPrompts[e])throw new Error(`Prompt ${e} is already registered`);let n;typeof r[0]=="string"&&(n=r.shift());let s;r.length>1&&(s=r.shift());const a=r[0],i=this._createRegisteredPrompt(e,void 0,n,s,a);return this.setPromptRequestHandlers(),this.sendPromptListChanged(),i}registerPrompt(e,r,n){if(this._registeredPrompts[e])throw new Error(`Prompt ${e} is already registered`);const{title:s,description:a,argsSchema:i}=r,o=this._createRegisteredPrompt(e,s,a,i,n);return this.setPromptRequestHandlers(),this.sendPromptListChanged(),o}isConnected(){return this.server.transport!==void 0}async sendLoggingMessage(e,r){return this.server.sendLoggingMessage(e,r)}sendResourceListChanged(){this.isConnected()&&this.server.sendResourceListChanged()}sendToolListChanged(){this.isConnected()&&this.server.sendToolListChanged()}sendPromptListChanged(){this.isConnected()&&this.server.sendPromptListChanged()}}class uy{constructor(e,r){this._callbacks=r,this._uriTemplate=typeof e=="string"?new bt(e):e}get uriTemplate(){return this._uriTemplate}get listCallback(){return this._callbacks.list}completeCallback(e){var r;return(r=this._callbacks.complete)===null||r===void 0?void 0:r[e]}}const ly={type:"object",properties:{}};function xd(t){return t!==null&&typeof t=="object"&&"parse"in t&&typeof t.parse=="function"&&"safeParse"in t&&typeof t.safeParse=="function"}function dy(t){return"_def"in t||"_zod"in t||xd(t)}function zi(t){return typeof t!="object"||t===null||dy(t)?!1:Object.keys(t).length===0?!0:Object.values(t).some(xd)}function Ld(t){if(t)return zi(t)?Dr(t):t}function fy(t){const e=dr(t);return e?Object.entries(e).map(([r,n])=>{const s=Pg(n),a=Cg(n);return{name:r,description:s,required:!a}}):[]}function Mt(t){const e=dr(t),r=e?.method;if(!r)throw new Error("Schema is missing a method literal");const n=Bl(r);if(typeof n=="string")return n;throw new Error("Schema method literal must be a string")}function Ud(t){return{completion:{values:t.slice(0,100),total:t.length,hasMore:t.length>100}}}const Br={completion:{values:[],hasMore:!1}};$.Ajv=qf,$.AnnotationsSchema=Ht,$.AudioContentSchema=vs,$.BaseMetadataSchema=Vt,$.BlobResourceContentsSchema=$a,$.BooleanSchemaSchema=tl,$.COMPLETABLE_SYMBOL=ks,$.CallToolRequestParamsSchema=Vu,$.CallToolRequestSchema=jr,$.CallToolResultSchema=ar,$.CancelTaskRequestSchema=Su,$.CancelTaskResultSchema=ku,$.CancelledNotificationParamsSchema=lu,$.CancelledNotificationSchema=es,$.Client=Sv,$.ClientCapabilitiesSchema=mu,$.ClientNotificationSchema=F_,$.ClientRequestSchema=V_,$.ClientResultSchema=H_,$.ClientTasksCapabilitySchema=fu,$.CompatibilityCallToolResultSchema=U_,$.CompleteRequestParamsSchema=yl,$.CompleteRequestSchema=Ss,$.CompleteResultSchema=Za,$.ContentBlockSchema=ys,$.CreateMessageRequestParamsSchema=el,$.CreateMessageRequestSchema=ja,$.CreateMessageResultSchema=bs,$.CreateMessageResultWithToolsSchema=za,$.CreateTaskResultSchema=Ft,$.CursorSchema=ma,$.DEFAULT_NEGOTIATED_PROTOCOL_VERSION=M_,$.DEFAULT_REQUEST_TIMEOUT_MSEC=ud,$.ElicitRequestFormParamsSchema=hl,$.ElicitRequestParamsSchema=pl,$.ElicitRequestSchema=Ma,$.ElicitRequestURLParamsSchema=ml,$.ElicitResultSchema=qr,$.ElicitationCompleteNotificationParamsSchema=_l,$.ElicitationCompleteNotificationSchema=gl,$.EmbeddedResourceSchema=qu,$.EmptyResultSchema=Ct,$.EnumSchemaSchema=dl,$.GetPromptRequestParamsSchema=zu,$.GetPromptRequestSchema=ps,$.GetPromptResultSchema=Ia,$.GetTaskPayloadRequestSchema=os,$.GetTaskRequestSchema=as,$.GetTaskResultSchema=is,$.IconSchema=du,$.IconsSchema=tr,$.ImageContentSchema=gs,$.ImplementationSchema=ya,$.InitializeRequestParamsSchema=pu,$.InitializeRequestSchema=ts,$.InitializeResultSchema=wa,$.InitializedNotificationSchema=rs,$.JSONRPCErrorSchema=va,$.JSONRPCMessageSchema=Nr,$.JSONRPCNotificationSchema=_a,$.JSONRPCRequestSchema=pa,$.JSONRPCResponseSchema=ga,$.JSONRPC_VERSION=Ir,$.LATEST_PROTOCOL_VERSION=Ut,$.LegacyTitledEnumSchemaSchema=il,$.ListPromptsRequestSchema=ms,$.ListPromptsResultSchema=Ca,$.ListResourceTemplatesRequestSchema=ds,$.ListResourceTemplatesResultSchema=Ra,$.ListResourcesRequestSchema=ls,$.ListResourcesResultSchema=Ta,$.ListRootsRequestSchema=kl,$.ListRootsResultSchema=xa,$.ListTasksRequestSchema=cs,$.ListTasksResultSchema=us,$.ListToolsRequestSchema=ws,$.ListToolsResultSchema=Na,$.LoggingLevelSchema=zr,$.LoggingMessageNotificationParamsSchema=Wu,$.LoggingMessageNotificationSchema=Ku,$.McpError=K,$.McpServer=cy,$.ModelHintSchema=Ju,$.ModelPreferencesSchema=Gu,$.MultiSelectEnumSchemaSchema=ll,$.NotificationSchema=tt,$.NumberSchemaSchema=nl,$.PaginatedRequestParamsSchema=wu,$.PaginatedRequestSchema=rr,$.PaginatedResultSchema=nr,$.PingRequestSchema=ns,$.PrimitiveSchemaDefinitionSchema=fl,$.ProgressNotificationParamsSchema=yu,$.ProgressNotificationSchema=ss,$.ProgressSchema=vu,$.ProgressTokenSchema=ha,$.PromptArgumentSchema=Au,$.PromptListChangedNotificationSchema=Lu,$.PromptMessageSchema=xu,$.PromptReferenceSchema=vl,$.PromptSchema=ju,$.Protocol=Qa,$.RELATED_TASK_META_KEY=pt,$.ReadResourceRequestParamsSchema=Eu,$.ReadResourceRequestSchema=hs,$.ReadResourceResultSchema=Pa,$.RelatedTaskMetadataSchema=Qn,$.RequestIdSchema=Or,$.RequestSchema=ze,$.ResourceContentsSchema=ba,$.ResourceLinkSchema=Zu,$.ResourceListChangedNotificationSchema=Tu,$.ResourceReferenceSchema=D_,$.ResourceRequestParamsSchema=fs,$.ResourceSchema=Ea,$.ResourceTemplate=uy,$.ResourceTemplateReferenceSchema=qa,$.ResourceTemplateSchema=$u,$.ResourceUpdatedNotificationParamsSchema=Ou,$.ResourceUpdatedNotificationSchema=Nu,$.ResultSchema=Ze,$.RootSchema=Sl,$.RootsListChangedNotificationSchema=$l,$.SSEClientTransport=Qv,$.SUPPORTED_PROTOCOL_VERSIONS=fa,$.SamplingContentSchema=Qu,$.SamplingMessageContentBlockSchema=Mr,$.SamplingMessageSchema=Xu,$.ServerCapabilitiesSchema=_u,$.ServerNotificationSchema=K_,$.ServerRequestSchema=W_,$.ServerResultSchema=J_,$.ServerTasksCapabilitySchema=hu,$.SetLevelRequestParamsSchema=Hu,$.SetLevelRequestSchema=Aa,$.SingleSelectEnumSchemaSchema=ol,$.SseError=qd,$.StreamableHTTPClientTransport=ty,$.StreamableHTTPError=Bt,$.StringSchemaSchema=rl,$.SubscribeRequestParamsSchema=Ru,$.SubscribeRequestSchema=Pu,$.TaskCreationParamsSchema=ou,$.TaskSchema=sr,$.TaskStatusNotificationParamsSchema=bu,$.TaskStatusNotificationSchema=Ar,$.TextContentSchema=_s,$.TextResourceContentsSchema=Sa,$.TitledMultiSelectEnumSchemaSchema=ul,$.TitledSingleSelectEnumSchemaSchema=al,$.ToolAnnotationsSchema=Uu,$.ToolChoiceSchema=Bu,$.ToolExecutionSchema=Du,$.ToolListChangedNotificationSchema=Fu,$.ToolResultContentSchema=Yu,$.ToolSchema=Oa,$.ToolUseContentSchema=Mu,$.UnauthorizedError=at,$.UnsubscribeRequestParamsSchema=Cu,$.UnsubscribeRequestSchema=Iu,$.UntitledMultiSelectEnumSchemaSchema=cl,$.UntitledSingleSelectEnumSchemaSchema=sl,$.UriTemplate=bt,$.UrlElicitationRequiredError=El,$.assertCompleteRequestPrompt=wl,$.assertCompleteRequestResourceTemplate=bl,$.auth=jt,$.buildDiscoveryUrls=Ed,$.completable=B_,$.createFetchWithInit=ji,$.discoverAuthorizationServerMetadata=Td,$.discoverOAuthMetadata=Kv,$.discoverOAuthProtectedResourceMetadata=Sd,$.exchangeAuthorization=Jv,$.extractResourceMetadataUrl=Fv,$.extractWWWAuthenticateParams=Fr,$.fetchToken=Cd,$.getCompleter=Cl,$.getDisplayName=Q_,$.getSupportedElicitationModes=gd,$.isCompletable=Pl,$.isHttpsUrl=wd,$.isInitializeRequest=L_,$.isInitializedNotification=gu,$.isJSONRPCError=uu,$.isJSONRPCNotification=cu,$.isJSONRPCRequest=Xn,$.isJSONRPCResponse=er,$.mergeCapabilities=Xa,$.normalizeHeaders=Gr,$.parseErrorResponse=vi,$.prepareAuthorizationCodeRequest=Si,$.refreshAuthorization=Pd,$.registerClient=Id,$.selectClientAuthMethod=yd,$.selectResourceURL=bd,$.startAuthorization=Rd,$.unwrapCompletable=Y_,Object.defineProperty($,Symbol.toStringTag,{value:"Module"})}));