@opentiny/next-sdk 0.1.15 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/agent/AgentModelProvider.ts +493 -2
- package/agent/type.ts +8 -2
- package/agent/utils/generateReActPrompt.ts +55 -0
- package/agent/utils/parseReActAction.ts +34 -0
- package/dist/agent/AgentModelProvider.d.ts +35 -1
- package/dist/agent/type.d.ts +8 -2
- package/dist/agent/utils/generateReActPrompt.d.ts +9 -0
- package/dist/agent/utils/parseReActAction.d.ts +14 -0
- package/dist/index.es.dev.js +29527 -22287
- package/dist/index.es.js +28124 -22534
- package/dist/index.js +2411 -320
- package/dist/index.umd.dev.js +29958 -22718
- package/dist/index.umd.js +113 -71
- package/dist/{mcpsdk@1.23.0.dev.js → mcpsdk@1.23.1.dev.js} +6580 -6455
- package/dist/{mcpsdk@1.23.0.es.dev.js → mcpsdk@1.23.1.es.dev.js} +6578 -6453
- package/dist/mcpsdk@1.23.1.es.js +15530 -0
- package/dist/mcpsdk@1.23.1.js +43 -0
- package/dist/transport/ExtensionPageServerTransport.d.ts +1 -2
- package/dist/webagent.dev.js +23337 -16088
- package/dist/webagent.es.dev.js +22235 -14986
- package/dist/webagent.es.js +23995 -18395
- package/dist/webagent.js +96 -54
- package/dist/webmcp-full.dev.js +14988 -10082
- package/dist/webmcp-full.es.dev.js +14965 -10059
- package/dist/webmcp-full.es.js +13484 -9668
- package/dist/webmcp-full.js +26 -26
- package/dist/webmcp.dev.js +666 -640
- package/dist/webmcp.es.dev.js +664 -638
- package/dist/webmcp.es.js +651 -619
- package/dist/webmcp.js +1 -1
- package/dist/zod@3.25.76.dev.js +30 -32
- package/dist/zod@3.25.76.es.dev.js +28 -30
- package/dist/zod@3.25.76.es.js +143 -145
- package/dist/zod@3.25.76.js +1 -1
- package/package.json +9 -8
- package/transport/ExtensionPageServerTransport.ts +2 -4
- package/dist/mcpsdk@1.23.0.es.js +0 -15584
- package/dist/mcpsdk@1.23.0.js +0 -43
package/dist/mcpsdk@1.23.0.js
DELETED
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
(function(_,Qt){typeof exports=="object"&&typeof module<"u"?Qt(exports):typeof define=="function"&&define.amd?define(["exports"],Qt):(_=typeof globalThis<"u"?globalThis:_||self,Qt(_.MCPSDK={}))})(this,function(_){"use strict";function Qt(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Cs={exports:{}},Oa={},Qe={},er={},Er={},Y={},Pr={};(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(m){if(super(),!t.IDENTIFIER.test(m))throw new Error("CodeGen: name must be a valid identifier");this.str=m}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}}t.Name=r;class n extends e{constructor(m){super(),this._items=typeof m=="string"?[m]:m}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;const m=this._items[0];return m===""||m==='""'}get str(){var m;return(m=this._str)!==null&&m!==void 0?m:this._str=this._items.reduce((S,E)=>`${S}${E}`,"")}get names(){var m;return(m=this._names)!==null&&m!==void 0?m:this._names=this._items.reduce((S,E)=>(E instanceof r&&(S[E.str]=(S[E.str]||0)+1),S),{})}}t._Code=n,t.nil=new n("");function s(d,...m){const S=[d[0]];let E=0;for(;E<m.length;)a(S,m[E]),S.push(d[++E]);return new n(S)}t._=s;const i=new n("+");function o(d,...m){const S=[$(d[0])];let E=0;for(;E<m.length;)S.push(i),a(S,m[E]),S.push(i,$(d[++E]));return c(S),new n(S)}t.str=o;function a(d,m){m instanceof n?d.push(...m._items):m instanceof r?d.push(m):d.push(f(m))}t.addCodeArg=a;function c(d){let m=1;for(;m<d.length-1;){if(d[m]===i){const S=u(d[m-1],d[m+1]);if(S!==void 0){d.splice(m-1,3,S);continue}d[m++]="+"}m++}}function u(d,m){if(m==='""')return d;if(d==='""')return m;if(typeof d=="string")return m instanceof r||d[d.length-1]!=='"'?void 0:typeof m!="string"?`${d.slice(0,-1)}${m}"`:m[0]==='"'?d.slice(0,-1)+m.slice(1):void 0;if(typeof m=="string"&&m[0]==='"'&&!(d instanceof r))return`"${d}${m.slice(1)}`}function l(d,m){return m.emptyStr()?d:d.emptyStr()?m:o`${d}${m}`}t.strConcat=l;function f(d){return typeof d=="number"||typeof d=="boolean"||d===null?d:$(Array.isArray(d)?d.join(","):d)}function w(d){return new n($(d))}t.stringify=w;function $(d){return JSON.stringify(d).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}t.safeStringify=$;function g(d){return typeof d=="string"&&t.IDENTIFIER.test(d)?new n(`.${d}`):s`[${d}]`}t.getProperty=g;function v(d){if(typeof d=="string"&&t.IDENTIFIER.test(d))return new n(`${d}`);throw new Error(`CodeGen: invalid export name: ${d}, use explicit $id name mapping`)}t.getEsmExportName=v;function p(d){return new n(d.toString())}t.regexpCode=p})(Pr);var Os={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.ValueScope=t.ValueScopeName=t.Scope=t.varKinds=t.UsedValueState=void 0;const e=Pr;class r extends Error{constructor(u){super(`CodeGen: "code" for ${u} not defined`),this.value=u.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:u,parent:l}={}){this._names={},this._prefixes=u,this._parent=l}toName(u){return u instanceof e.Name?u:this.name(u)}name(u){return new e.Name(this._newName(u))}_newName(u){const l=this._names[u]||this._nameGroup(u);return`${u}${l.index++}`}_nameGroup(u){var l,f;if(!((f=(l=this._parent)===null||l===void 0?void 0:l._prefixes)===null||f===void 0)&&f.has(u)||this._prefixes&&!this._prefixes.has(u))throw new Error(`CodeGen: prefix "${u}" is not allowed in this scope`);return this._names[u]={prefix:u,index:0}}}t.Scope=s;class i extends e.Name{constructor(u,l){super(l),this.prefix=u}setValue(u,{property:l,itemIndex:f}){this.value=u,this.scopePath=(0,e._)`.${new e.Name(l)}[${f}]`}}t.ValueScopeName=i;const o=(0,e._)`\n`;class a extends s{constructor(u){super(u),this._values={},this._scope=u.scope,this.opts={...u,_n:u.lines?o:e.nil}}get(){return this._scope}name(u){return new i(u,this._newName(u))}value(u,l){var f;if(l.ref===void 0)throw new Error("CodeGen: ref must be passed in value");const w=this.toName(u),{prefix:$}=w,g=(f=l.key)!==null&&f!==void 0?f:l.ref;let v=this._values[$];if(v){const m=v.get(g);if(m)return m}else v=this._values[$]=new Map;v.set(g,w);const p=this._scope[$]||(this._scope[$]=[]),d=p.length;return p[d]=l.ref,w.setValue(l,{property:$,itemIndex:d}),w}getValue(u,l){const f=this._values[u];if(f)return f.get(l)}scopeRefs(u,l=this._values){return this._reduceValues(l,f=>{if(f.scopePath===void 0)throw new Error(`CodeGen: name "${f}" has no value`);return(0,e._)`${u}${f.scopePath}`})}scopeCode(u=this._values,l,f){return this._reduceValues(u,w=>{if(w.value===void 0)throw new Error(`CodeGen: name "${w}" has no value`);return w.value.code},l,f)}_reduceValues(u,l,f={},w){let $=e.nil;for(const g in u){const v=u[g];if(!v)continue;const p=f[g]=f[g]||new Map;v.forEach(d=>{if(p.has(d))return;p.set(d,n.Started);let m=l(d);if(m){const S=this.opts.es5?t.varKinds.var:t.varKinds.const;$=(0,e._)`${$}${S} ${d} = ${m};${this.opts._n}`}else if(m=w==null?void 0:w(d))$=(0,e._)`${$}${m}${this.opts._n}`;else throw new r(d);p.set(d,n.Completed)})}return $}}t.ValueScope=a})(Os),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=Pr,r=Os;var n=Pr;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=Os;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 i{optimizeNodes(){return this}optimizeNames(h,y){return this}}class o extends i{constructor(h,y,T){super(),this.varKind=h,this.name=y,this.rhs=T}render({es5:h,_n:y}){const T=h?r.varKinds.var:this.varKind,V=this.rhs===void 0?"":` = ${this.rhs}`;return`${T} ${this.name}${V};`+y}optimizeNames(h,y){if(h[this.name.str])return this.rhs&&(this.rhs=ne(this.rhs,h,y)),this}get names(){return this.rhs instanceof e._CodeOrName?this.rhs.names:{}}}class a extends i{constructor(h,y,T){super(),this.lhs=h,this.rhs=y,this.sideEffects=T}render({_n:h}){return`${this.lhs} = ${this.rhs};`+h}optimizeNames(h,y){if(!(this.lhs instanceof e.Name&&!h[this.lhs.str]&&!this.sideEffects))return this.rhs=ne(this.rhs,h,y),this}get names(){const h=this.lhs instanceof e.Name?{}:{...this.lhs.names};return be(h,this.rhs)}}class c extends a{constructor(h,y,T,V){super(h,T,V),this.op=y}render({_n:h}){return`${this.lhs} ${this.op}= ${this.rhs};`+h}}class u extends i{constructor(h){super(),this.label=h,this.names={}}render({_n:h}){return`${this.label}:`+h}}class l extends i{constructor(h){super(),this.label=h,this.names={}}render({_n:h}){return`break${this.label?` ${this.label}`:""};`+h}}class f extends i{constructor(h){super(),this.error=h}render({_n:h}){return`throw ${this.error};`+h}get names(){return this.error.names}}class w extends i{constructor(h){super(),this.code=h}render({_n:h}){return`${this.code};`+h}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(h,y){return this.code=ne(this.code,h,y),this}get names(){return this.code instanceof e._CodeOrName?this.code.names:{}}}class $ extends i{constructor(h=[]){super(),this.nodes=h}render(h){return this.nodes.reduce((y,T)=>y+T.render(h),"")}optimizeNodes(){const{nodes:h}=this;let y=h.length;for(;y--;){const T=h[y].optimizeNodes();Array.isArray(T)?h.splice(y,1,...T):T?h[y]=T:h.splice(y,1)}return h.length>0?this:void 0}optimizeNames(h,y){const{nodes:T}=this;let V=T.length;for(;V--;){const F=T[V];F.optimizeNames(h,y)||(Ze(h,F.names),T.splice(V,1))}return T.length>0?this:void 0}get names(){return this.nodes.reduce((h,y)=>X(h,y.names),{})}}class g extends ${render(h){return"{"+h._n+super.render(h)+"}"+h._n}}class v extends ${}class p extends g{}p.kind="else";class d extends g{constructor(h,y){super(y),this.condition=h}render(h){let y=`if(${this.condition})`+super.render(h);return this.else&&(y+="else "+this.else.render(h)),y}optimizeNodes(){super.optimizeNodes();const h=this.condition;if(h===!0)return this.nodes;let y=this.else;if(y){const T=y.optimizeNodes();y=this.else=Array.isArray(T)?new p(T):T}if(y)return h===!1?y instanceof d?y:y.nodes:this.nodes.length?this:new d(St(h),y instanceof d?[y]:y.nodes);if(!(h===!1||!this.nodes.length))return this}optimizeNames(h,y){var T;if(this.else=(T=this.else)===null||T===void 0?void 0:T.optimizeNames(h,y),!!(super.optimizeNames(h,y)||this.else))return this.condition=ne(this.condition,h,y),this}get names(){const h=super.names;return be(h,this.condition),this.else&&X(h,this.else.names),h}}d.kind="if";class m extends g{}m.kind="for";class S extends m{constructor(h){super(),this.iteration=h}render(h){return`for(${this.iteration})`+super.render(h)}optimizeNames(h,y){if(super.optimizeNames(h,y))return this.iteration=ne(this.iteration,h,y),this}get names(){return X(super.names,this.iteration.names)}}class E extends m{constructor(h,y,T,V){super(),this.varKind=h,this.name=y,this.from=T,this.to=V}render(h){const y=h.es5?r.varKinds.var:this.varKind,{name:T,from:V,to:F}=this;return`for(${y} ${T}=${V}; ${T}<${F}; ${T}++)`+super.render(h)}get names(){const h=be(super.names,this.from);return be(h,this.to)}}class C extends m{constructor(h,y,T,V){super(),this.loop=h,this.varKind=y,this.name=T,this.iterable=V}render(h){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(h)}optimizeNames(h,y){if(super.optimizeNames(h,y))return this.iterable=ne(this.iterable,h,y),this}get names(){return X(super.names,this.iterable.names)}}class z extends g{constructor(h,y,T){super(),this.name=h,this.args=y,this.async=T}render(h){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(h)}}z.kind="func";class B extends ${render(h){return"return "+super.render(h)}}B.kind="return";class ye extends g{render(h){let y="try"+super.render(h);return this.catch&&(y+=this.catch.render(h)),this.finally&&(y+=this.finally.render(h)),y}optimizeNodes(){var h,y;return super.optimizeNodes(),(h=this.catch)===null||h===void 0||h.optimizeNodes(),(y=this.finally)===null||y===void 0||y.optimizeNodes(),this}optimizeNames(h,y){var T,V;return super.optimizeNames(h,y),(T=this.catch)===null||T===void 0||T.optimizeNames(h,y),(V=this.finally)===null||V===void 0||V.optimizeNames(h,y),this}get names(){const h=super.names;return this.catch&&X(h,this.catch.names),this.finally&&X(h,this.finally.names),h}}class Me extends g{constructor(h){super(),this.error=h}render(h){return`catch(${this.error})`+super.render(h)}}Me.kind="catch";class $t extends g{render(h){return"finally"+super.render(h)}}$t.kind="finally";class W{constructor(h,y={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...y,_n:y.lines?`
|
|
2
|
-
`:""},this._extScope=h,this._scope=new r.Scope({parent:h}),this._nodes=[new v]}toString(){return this._root.render(this.opts)}name(h){return this._scope.name(h)}scopeName(h){return this._extScope.name(h)}scopeValue(h,y){const T=this._extScope.value(h,y);return(this._values[T.prefix]||(this._values[T.prefix]=new Set)).add(T),T}getScopeValue(h,y){return this._extScope.getValue(h,y)}scopeRefs(h){return this._extScope.scopeRefs(h,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(h,y,T,V){const F=this._scope.toName(y);return T!==void 0&&V&&(this._constants[F.str]=T),this._leafNode(new o(h,F,T)),F}const(h,y,T){return this._def(r.varKinds.const,h,y,T)}let(h,y,T){return this._def(r.varKinds.let,h,y,T)}var(h,y,T){return this._def(r.varKinds.var,h,y,T)}assign(h,y,T){return this._leafNode(new a(h,y,T))}add(h,y){return this._leafNode(new c(h,t.operators.ADD,y))}code(h){return typeof h=="function"?h():h!==e.nil&&this._leafNode(new w(h)),this}object(...h){const y=["{"];for(const[T,V]of h)y.length>1&&y.push(","),y.push(T),(T!==V||this.opts.es5)&&(y.push(":"),(0,e.addCodeArg)(y,V));return y.push("}"),new e._Code(y)}if(h,y,T){if(this._blockNode(new d(h)),y&&T)this.code(y).else().code(T).endIf();else if(y)this.code(y).endIf();else if(T)throw new Error('CodeGen: "else" body without "then" body');return this}elseIf(h){return this._elseNode(new d(h))}else(){return this._elseNode(new p)}endIf(){return this._endBlockNode(d,p)}_for(h,y){return this._blockNode(h),y&&this.code(y).endFor(),this}for(h,y){return this._for(new S(h),y)}forRange(h,y,T,V,F=this.opts.es5?r.varKinds.var:r.varKinds.let){const le=this._scope.toName(h);return this._for(new E(F,le,y,T),()=>V(le))}forOf(h,y,T,V=r.varKinds.const){const F=this._scope.toName(h);if(this.opts.es5){const le=y instanceof e.Name?y:this.var("_arr",y);return this.forRange("_i",0,(0,e._)`${le}.length`,ce=>{this.var(F,(0,e._)`${le}[${ce}]`),T(F)})}return this._for(new C("of",V,F,y),()=>T(F))}forIn(h,y,T,V=this.opts.es5?r.varKinds.var:r.varKinds.const){if(this.opts.ownProperties)return this.forOf(h,(0,e._)`Object.keys(${y})`,T);const F=this._scope.toName(h);return this._for(new C("in",V,F,y),()=>T(F))}endFor(){return this._endBlockNode(m)}label(h){return this._leafNode(new u(h))}break(h){return this._leafNode(new l(h))}return(h){const y=new B;if(this._blockNode(y),this.code(h),y.nodes.length!==1)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(B)}try(h,y,T){if(!y&&!T)throw new Error('CodeGen: "try" without "catch" and "finally"');const V=new ye;if(this._blockNode(V),this.code(h),y){const F=this.name("e");this._currNode=V.catch=new Me(F),y(F)}return T&&(this._currNode=V.finally=new $t,this.code(T)),this._endBlockNode(Me,$t)}throw(h){return this._leafNode(new f(h))}block(h,y){return this._blockStarts.push(this._nodes.length),h&&this.code(h).endBlock(y),this}endBlock(h){const y=this._blockStarts.pop();if(y===void 0)throw new Error("CodeGen: not in self-balancing block");const T=this._nodes.length-y;if(T<0||h!==void 0&&T!==h)throw new Error(`CodeGen: wrong number of nodes: ${T} vs ${h} expected`);return this._nodes.length=y,this}func(h,y=e.nil,T,V){return this._blockNode(new z(h,y,T)),V&&this.code(V).endFunc(),this}endFunc(){return this._endBlockNode(z)}optimize(h=1){for(;h-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(h){return this._currNode.nodes.push(h),this}_blockNode(h){this._currNode.nodes.push(h),this._nodes.push(h)}_endBlockNode(h,y){const T=this._currNode;if(T instanceof h||y&&T instanceof y)return this._nodes.pop(),this;throw new Error(`CodeGen: not in block "${y?`${h.kind}/${y.kind}`:h.kind}"`)}_elseNode(h){const y=this._currNode;if(!(y instanceof d))throw new Error('CodeGen: "else" without "if"');return this._currNode=y.else=h,this}get _root(){return this._nodes[0]}get _currNode(){const h=this._nodes;return h[h.length-1]}set _currNode(h){const y=this._nodes;y[y.length-1]=h}}t.CodeGen=W;function X(P,h){for(const y in h)P[y]=(P[y]||0)+(h[y]||0);return P}function be(P,h){return h instanceof e._CodeOrName?X(P,h.names):P}function ne(P,h,y){if(P instanceof e.Name)return T(P);if(!V(P))return P;return new e._Code(P._items.reduce((F,le)=>(le instanceof e.Name&&(le=T(le)),le instanceof e._Code?F.push(...le._items):F.push(le),F),[]));function T(F){const le=y[F.str];return le===void 0||h[F.str]!==1?F:(delete h[F.str],le)}function V(F){return F instanceof e._Code&&F._items.some(le=>le instanceof e.Name&&h[le.str]===1&&y[le.str]!==void 0)}}function Ze(P,h){for(const y in h)P[y]=(P[y]||0)-(h[y]||0)}function St(P){return typeof P=="boolean"||typeof P=="number"||P===null?!P:(0,e._)`!${O(P)}`}t.not=St;const kt=k(t.operators.AND);function pn(...P){return P.reduce(kt)}t.and=pn;const Xt=k(t.operators.OR);function A(...P){return P.reduce(Xt)}t.or=A;function k(P){return(h,y)=>h===e.nil?y:y===e.nil?h:(0,e._)`${O(h)} ${P} ${O(y)}`}function O(P){return P instanceof e.Name?P:(0,e._)`(${P})`}}(Y);var x={};Object.defineProperty(x,"__esModule",{value:!0}),x.checkStrictMode=x.getErrorPath=x.Type=x.useFunc=x.setEvaluated=x.evaluatedPropsToName=x.mergeEvaluated=x.eachItem=x.unescapeJsonPointer=x.escapeJsonPointer=x.escapeFragment=x.unescapeFragment=x.schemaRefOrVal=x.schemaHasRulesButRef=x.schemaHasRules=x.checkUnknownRules=x.alwaysValidSchema=x.toHash=void 0;const de=Y,wf=Pr;function $f(t){const e={};for(const r of t)e[r]=!0;return e}x.toHash=$f;function Sf(t,e){return typeof e=="boolean"?e:Object.keys(e).length===0?!0:(Ia(t,e),!Na(e,t.self.RULES.all))}x.alwaysValidSchema=Sf;function Ia(t,e=t.schema){const{opts:r,self:n}=t;if(!r.strictSchema||typeof e=="boolean")return;const s=n.RULES.keywords;for(const i in e)s[i]||Za(t,`unknown keyword: "${i}"`)}x.checkUnknownRules=Ia;function Na(t,e){if(typeof t=="boolean")return!t;for(const r in t)if(e[r])return!0;return!1}x.schemaHasRules=Na;function kf(t,e){if(typeof t=="boolean")return!t;for(const r in t)if(r!=="$ref"&&e.all[r])return!0;return!1}x.schemaHasRulesButRef=kf;function Ef({topSchemaRef:t,schemaPath:e},r,n,s){if(!s){if(typeof r=="number"||typeof r=="boolean")return r;if(typeof r=="string")return(0,de._)`${r}`}return(0,de._)`${t}${e}${(0,de.getProperty)(n)}`}x.schemaRefOrVal=Ef;function Pf(t){return Aa(decodeURIComponent(t))}x.unescapeFragment=Pf;function Rf(t){return encodeURIComponent(Is(t))}x.escapeFragment=Rf;function Is(t){return typeof t=="number"?`${t}`:t.replace(/~/g,"~0").replace(/\//g,"~1")}x.escapeJsonPointer=Is;function Aa(t){return t.replace(/~1/g,"/").replace(/~0/g,"~")}x.unescapeJsonPointer=Aa;function Tf(t,e){if(Array.isArray(t))for(const r of t)e(r);else e(t)}x.eachItem=Tf;function ja({mergeNames:t,mergeToName:e,mergeValues:r,resultToName:n}){return(s,i,o,a)=>{const c=o===void 0?i:o instanceof de.Name?(i instanceof de.Name?t(s,i,o):e(s,i,o),o):i instanceof de.Name?(e(s,o,i),i):r(i,o);return a===de.Name&&!(c instanceof de.Name)?n(s,c):c}}x.mergeEvaluated={props:ja({mergeNames:(t,e,r)=>t.if((0,de._)`${r} !== true && ${e} !== undefined`,()=>{t.if((0,de._)`${e} === true`,()=>t.assign(r,!0),()=>t.assign(r,(0,de._)`${r} || {}`).code((0,de._)`Object.assign(${r}, ${e})`))}),mergeToName:(t,e,r)=>t.if((0,de._)`${r} !== true`,()=>{e===!0?t.assign(r,!0):(t.assign(r,(0,de._)`${r} || {}`),Ns(t,r,e))}),mergeValues:(t,e)=>t===!0?!0:{...t,...e},resultToName:za}),items:ja({mergeNames:(t,e,r)=>t.if((0,de._)`${r} !== true && ${e} !== undefined`,()=>t.assign(r,(0,de._)`${e} === true ? true : ${r} > ${e} ? ${r} : ${e}`)),mergeToName:(t,e,r)=>t.if((0,de._)`${r} !== true`,()=>t.assign(r,e===!0?!0:(0,de._)`${r} > ${e} ? ${r} : ${e}`)),mergeValues:(t,e)=>t===!0?!0:Math.max(t,e),resultToName:(t,e)=>t.var("items",e)})};function za(t,e){if(e===!0)return t.var("props",!0);const r=t.var("props",(0,de._)`{}`);return e!==void 0&&Ns(t,r,e),r}x.evaluatedPropsToName=za;function Ns(t,e,r){Object.keys(r).forEach(n=>t.assign((0,de._)`${e}${(0,de.getProperty)(n)}`,!0))}x.setEvaluated=Ns;const Ma={};function Cf(t,e){return t.scopeValue("func",{ref:e,code:Ma[e.code]||(Ma[e.code]=new wf._Code(e.code))})}x.useFunc=Cf;var As;(function(t){t[t.Num=0]="Num",t[t.Str=1]="Str"})(As||(x.Type=As={}));function Of(t,e,r){if(t instanceof de.Name){const n=e===As.Num;return r?n?(0,de._)`"[" + ${t} + "]"`:(0,de._)`"['" + ${t} + "']"`:n?(0,de._)`"/" + ${t}`:(0,de._)`"/" + ${t}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return r?(0,de.getProperty)(t).toString():"/"+Is(t)}x.getErrorPath=Of;function Za(t,e,r=t.opts.strictSchema){if(r){if(e=`strict mode: ${e}`,r===!0)throw new Error(e);t.self.logger.warn(e)}}x.checkStrictMode=Za;var lt={};Object.defineProperty(lt,"__esModule",{value:!0});const xe=Y,If={data:new xe.Name("data"),valCxt:new xe.Name("valCxt"),instancePath:new xe.Name("instancePath"),parentData:new xe.Name("parentData"),parentDataProperty:new xe.Name("parentDataProperty"),rootData:new xe.Name("rootData"),dynamicAnchors:new xe.Name("dynamicAnchors"),vErrors:new xe.Name("vErrors"),errors:new xe.Name("errors"),this:new xe.Name("this"),self:new xe.Name("self"),scope:new xe.Name("scope"),json:new xe.Name("json"),jsonPos:new xe.Name("jsonPos"),jsonLen:new xe.Name("jsonLen"),jsonPart:new xe.Name("jsonPart")};lt.default=If,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=Y,r=x,n=lt;t.keywordError={message:({keyword:p})=>(0,e.str)`must pass "${p}" keyword validation`},t.keyword$DataError={message:({keyword:p,schemaType:d})=>d?(0,e.str)`"${p}" keyword must be ${d} ($data)`:(0,e.str)`"${p}" keyword is invalid ($data)`};function s(p,d=t.keywordError,m,S){const{it:E}=p,{gen:C,compositeRule:z,allErrors:B}=E,ye=f(p,d,m);S??(z||B)?c(C,ye):u(E,(0,e._)`[${ye}]`)}t.reportError=s;function i(p,d=t.keywordError,m){const{it:S}=p,{gen:E,compositeRule:C,allErrors:z}=S,B=f(p,d,m);c(E,B),C||z||u(S,n.default.vErrors)}t.reportExtraError=i;function o(p,d){p.assign(n.default.errors,d),p.if((0,e._)`${n.default.vErrors} !== null`,()=>p.if(d,()=>p.assign((0,e._)`${n.default.vErrors}.length`,d),()=>p.assign(n.default.vErrors,null)))}t.resetErrorsCount=o;function a({gen:p,keyword:d,schemaValue:m,data:S,errsCount:E,it:C}){if(E===void 0)throw new Error("ajv implementation error");const z=p.name("err");p.forRange("i",E,n.default.errors,B=>{p.const(z,(0,e._)`${n.default.vErrors}[${B}]`),p.if((0,e._)`${z}.instancePath === undefined`,()=>p.assign((0,e._)`${z}.instancePath`,(0,e.strConcat)(n.default.instancePath,C.errorPath))),p.assign((0,e._)`${z}.schemaPath`,(0,e.str)`${C.errSchemaPath}/${d}`),C.opts.verbose&&(p.assign((0,e._)`${z}.schema`,m),p.assign((0,e._)`${z}.data`,S))})}t.extendErrors=a;function c(p,d){const m=p.const("err",d);p.if((0,e._)`${n.default.vErrors} === null`,()=>p.assign(n.default.vErrors,(0,e._)`[${m}]`),(0,e._)`${n.default.vErrors}.push(${m})`),p.code((0,e._)`${n.default.errors}++`)}function u(p,d){const{gen:m,validateName:S,schemaEnv:E}=p;E.$async?m.throw((0,e._)`new ${p.ValidationError}(${d})`):(m.assign((0,e._)`${S}.errors`,d),m.return(!1))}const l={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(p,d,m){const{createErrors:S}=p.it;return S===!1?(0,e._)`{}`:w(p,d,m)}function w(p,d,m={}){const{gen:S,it:E}=p,C=[$(E,m),g(p,m)];return v(p,d,C),S.object(...C)}function $({errorPath:p},{instancePath:d}){const m=d?(0,e.str)`${p}${(0,r.getErrorPath)(d,r.Type.Str)}`:p;return[n.default.instancePath,(0,e.strConcat)(n.default.instancePath,m)]}function g({keyword:p,it:{errSchemaPath:d}},{schemaPath:m,parentSchema:S}){let E=S?d:(0,e.str)`${d}/${p}`;return m&&(E=(0,e.str)`${E}${(0,r.getErrorPath)(m,r.Type.Str)}`),[l.schemaPath,E]}function v(p,{params:d,message:m},S){const{keyword:E,data:C,schemaValue:z,it:B}=p,{opts:ye,propertyName:Me,topSchemaRef:$t,schemaPath:W}=B;S.push([l.keyword,E],[l.params,typeof d=="function"?d(p):d||(0,e._)`{}`]),ye.messages&&S.push([l.message,typeof m=="function"?m(p):m]),ye.verbose&&S.push([l.schema,z],[l.parentSchema,(0,e._)`${$t}${W}`],[n.default.data,C]),Me&&S.push([l.propertyName,Me])}}(Er),Object.defineProperty(er,"__esModule",{value:!0}),er.boolOrEmptySchema=er.topBoolOrEmptySchema=void 0;const Nf=Er,Af=Y,jf=lt,zf={message:"boolean schema is false"};function Mf(t){const{gen:e,schema:r,validateName:n}=t;r===!1?xa(t,!1):typeof r=="object"&&r.$async===!0?e.return(jf.default.data):(e.assign((0,Af._)`${n}.errors`,null),e.return(!0))}er.topBoolOrEmptySchema=Mf;function Zf(t,e){const{gen:r,schema:n}=t;n===!1?(r.var(e,!1),xa(t)):r.var(e,!0)}er.boolOrEmptySchema=Zf;function xa(t,e){const{gen:r,data:n}=t,s={gen:r,keyword:"false schema",data:n,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:t};(0,Nf.reportError)(s,zf,void 0,e)}var Te={},Ut={};Object.defineProperty(Ut,"__esModule",{value:!0}),Ut.getRules=Ut.isJSONType=void 0;const xf=["string","number","integer","boolean","null","object","array"],Lf=new Set(xf);function Uf(t){return typeof t=="string"&&Lf.has(t)}Ut.isJSONType=Uf;function Df(){const t={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...t,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},t.number,t.string,t.array,t.object],post:{rules:[]},all:{},keywords:{}}}Ut.getRules=Df;var _t={};Object.defineProperty(_t,"__esModule",{value:!0}),_t.shouldUseRule=_t.shouldUseGroup=_t.schemaHasRulesForType=void 0;function qf({schema:t,self:e},r){const n=e.RULES.types[r];return n&&n!==!0&&La(t,n)}_t.schemaHasRulesForType=qf;function La(t,e){return e.rules.some(r=>Ua(t,r))}_t.shouldUseGroup=La;function Ua(t,e){var r;return t[e.keyword]!==void 0||((r=e.definition.implements)===null||r===void 0?void 0:r.some(n=>t[n]!==void 0))}_t.shouldUseRule=Ua,Object.defineProperty(Te,"__esModule",{value:!0}),Te.reportTypeError=Te.checkDataTypes=Te.checkDataType=Te.coerceAndCheckDataType=Te.getJSONTypes=Te.getSchemaTypes=Te.DataType=void 0;const Vf=Ut,Ff=_t,Hf=Er,G=Y,Da=x;var tr;(function(t){t[t.Correct=0]="Correct",t[t.Wrong=1]="Wrong"})(tr||(Te.DataType=tr={}));function Wf(t){const e=qa(t.type);if(e.includes("null")){if(t.nullable===!1)throw new Error("type: null contradicts nullable: false")}else{if(!e.length&&t.nullable!==void 0)throw new Error('"nullable" cannot be used without "type"');t.nullable===!0&&e.push("null")}return e}Te.getSchemaTypes=Wf;function qa(t){const e=Array.isArray(t)?t:t?[t]:[];if(e.every(Vf.isJSONType))return e;throw new Error("type must be JSONType or JSONType[]: "+e.join(","))}Te.getJSONTypes=qa;function Kf(t,e){const{gen:r,data:n,opts:s}=t,i=Jf(e,s.coerceTypes),o=e.length>0&&!(i.length===0&&e.length===1&&(0,Ff.schemaHasRulesForType)(t,e[0]));if(o){const a=zs(e,n,s.strictNumbers,tr.Wrong);r.if(a,()=>{i.length?Bf(t,e,i):Ms(t)})}return o}Te.coerceAndCheckDataType=Kf;const Va=new Set(["string","number","integer","boolean","null"]);function Jf(t,e){return e?t.filter(r=>Va.has(r)||e==="array"&&r==="array"):[]}function Bf(t,e,r){const{gen:n,data:s,opts:i}=t,o=n.let("dataType",(0,G._)`typeof ${s}`),a=n.let("coerced",(0,G._)`undefined`);i.coerceTypes==="array"&&n.if((0,G._)`${o} == 'object' && Array.isArray(${s}) && ${s}.length == 1`,()=>n.assign(s,(0,G._)`${s}[0]`).assign(o,(0,G._)`typeof ${s}`).if(zs(e,s,i.strictNumbers),()=>n.assign(a,s))),n.if((0,G._)`${a} !== undefined`);for(const u of r)(Va.has(u)||u==="array"&&i.coerceTypes==="array")&&c(u);n.else(),Ms(t),n.endIf(),n.if((0,G._)`${a} !== undefined`,()=>{n.assign(s,a),Gf(t,a)});function c(u){switch(u){case"string":n.elseIf((0,G._)`${o} == "number" || ${o} == "boolean"`).assign(a,(0,G._)`"" + ${s}`).elseIf((0,G._)`${s} === null`).assign(a,(0,G._)`""`);return;case"number":n.elseIf((0,G._)`${o} == "boolean" || ${s} === null
|
|
3
|
-
|| (${o} == "string" && ${s} && ${s} == +${s})`).assign(a,(0,G._)`+${s}`);return;case"integer":n.elseIf((0,G._)`${o} === "boolean" || ${s} === null
|
|
4
|
-
|| (${o} === "string" && ${s} && ${s} == +${s} && !(${s} % 1))`).assign(a,(0,G._)`+${s}`);return;case"boolean":n.elseIf((0,G._)`${s} === "false" || ${s} === 0 || ${s} === null`).assign(a,!1).elseIf((0,G._)`${s} === "true" || ${s} === 1`).assign(a,!0);return;case"null":n.elseIf((0,G._)`${s} === "" || ${s} === 0 || ${s} === false`),n.assign(a,null);return;case"array":n.elseIf((0,G._)`${o} === "string" || ${o} === "number"
|
|
5
|
-
|| ${o} === "boolean" || ${s} === null`).assign(a,(0,G._)`[${s}]`)}}}function Gf({gen:t,parentData:e,parentDataProperty:r},n){t.if((0,G._)`${e} !== undefined`,()=>t.assign((0,G._)`${e}[${r}]`,n))}function js(t,e,r,n=tr.Correct){const s=n===tr.Correct?G.operators.EQ:G.operators.NEQ;let i;switch(t){case"null":return(0,G._)`${e} ${s} null`;case"array":i=(0,G._)`Array.isArray(${e})`;break;case"object":i=(0,G._)`${e} && typeof ${e} == "object" && !Array.isArray(${e})`;break;case"integer":i=o((0,G._)`!(${e} % 1) && !isNaN(${e})`);break;case"number":i=o();break;default:return(0,G._)`typeof ${e} ${s} ${t}`}return n===tr.Correct?i:(0,G.not)(i);function o(a=G.nil){return(0,G.and)((0,G._)`typeof ${e} == "number"`,a,r?(0,G._)`isFinite(${e})`:G.nil)}}Te.checkDataType=js;function zs(t,e,r,n){if(t.length===1)return js(t[0],e,r,n);let s;const i=(0,Da.toHash)(t);if(i.array&&i.object){const o=(0,G._)`typeof ${e} != "object"`;s=i.null?o:(0,G._)`!${e} || ${o}`,delete i.null,delete i.array,delete i.object}else s=G.nil;i.number&&delete i.integer;for(const o in i)s=(0,G.and)(s,js(o,e,r,n));return s}Te.checkDataTypes=zs;const Yf={message:({schema:t})=>`must be ${t}`,params:({schema:t,schemaValue:e})=>typeof t=="string"?(0,G._)`{type: ${t}}`:(0,G._)`{type: ${e}}`};function Ms(t){const e=Xf(t);(0,Hf.reportError)(e,Yf)}Te.reportTypeError=Ms;function Xf(t){const{gen:e,data:r,schema:n}=t,s=(0,Da.schemaRefOrVal)(t,n,"type");return{gen:e,keyword:"type",data:r,schema:n.type,schemaCode:s,schemaValue:s,parentSchema:n,params:{},it:t}}var _n={};Object.defineProperty(_n,"__esModule",{value:!0}),_n.assignDefaults=void 0;const rr=Y,Qf=x;function eh(t,e){const{properties:r,items:n}=t.schema;if(e==="object"&&r)for(const s in r)Fa(t,s,r[s].default);else e==="array"&&Array.isArray(n)&&n.forEach((s,i)=>Fa(t,i,s.default))}_n.assignDefaults=eh;function Fa(t,e,r){const{gen:n,compositeRule:s,data:i,opts:o}=t;if(r===void 0)return;const a=(0,rr._)`${i}${(0,rr.getProperty)(e)}`;if(s){(0,Qf.checkStrictMode)(t,`default is ignored for: ${a}`);return}let c=(0,rr._)`${a} === undefined`;o.useDefaults==="empty"&&(c=(0,rr._)`${c} || ${a} === null || ${a} === ""`),n.if(c,(0,rr._)`${a} = ${(0,rr.stringify)(r)}`)}var dt={},Q={};Object.defineProperty(Q,"__esModule",{value:!0}),Q.validateUnion=Q.validateArray=Q.usePattern=Q.callValidateCode=Q.schemaProperties=Q.allSchemaProperties=Q.noPropertyInData=Q.propertyInData=Q.isOwnProperty=Q.hasPropFunc=Q.reportMissingProp=Q.checkMissingProp=Q.checkReportMissingProp=void 0;const pe=Y,Zs=x,Et=lt,th=x;function rh(t,e){const{gen:r,data:n,it:s}=t;r.if(Ls(r,n,e,s.opts.ownProperties),()=>{t.setParams({missingProperty:(0,pe._)`${e}`},!0),t.error()})}Q.checkReportMissingProp=rh;function nh({gen:t,data:e,it:{opts:r}},n,s){return(0,pe.or)(...n.map(i=>(0,pe.and)(Ls(t,e,i,r.ownProperties),(0,pe._)`${s} = ${i}`)))}Q.checkMissingProp=nh;function sh(t,e){t.setParams({missingProperty:e},!0),t.error()}Q.reportMissingProp=sh;function Ha(t){return t.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:(0,pe._)`Object.prototype.hasOwnProperty`})}Q.hasPropFunc=Ha;function xs(t,e,r){return(0,pe._)`${Ha(t)}.call(${e}, ${r})`}Q.isOwnProperty=xs;function ih(t,e,r,n){const s=(0,pe._)`${e}${(0,pe.getProperty)(r)} !== undefined`;return n?(0,pe._)`${s} && ${xs(t,e,r)}`:s}Q.propertyInData=ih;function Ls(t,e,r,n){const s=(0,pe._)`${e}${(0,pe.getProperty)(r)} === undefined`;return n?(0,pe.or)(s,(0,pe.not)(xs(t,e,r))):s}Q.noPropertyInData=Ls;function Wa(t){return t?Object.keys(t).filter(e=>e!=="__proto__"):[]}Q.allSchemaProperties=Wa;function oh(t,e){return Wa(e).filter(r=>!(0,Zs.alwaysValidSchema)(t,e[r]))}Q.schemaProperties=oh;function ah({schemaCode:t,data:e,it:{gen:r,topSchemaRef:n,schemaPath:s,errorPath:i},it:o},a,c,u){const l=u?(0,pe._)`${t}, ${e}, ${n}${s}`:e,f=[[Et.default.instancePath,(0,pe.strConcat)(Et.default.instancePath,i)],[Et.default.parentData,o.parentData],[Et.default.parentDataProperty,o.parentDataProperty],[Et.default.rootData,Et.default.rootData]];o.opts.dynamicRef&&f.push([Et.default.dynamicAnchors,Et.default.dynamicAnchors]);const w=(0,pe._)`${l}, ${r.object(...f)}`;return c!==pe.nil?(0,pe._)`${a}.call(${c}, ${w})`:(0,pe._)`${a}(${w})`}Q.callValidateCode=ah;const ch=(0,pe._)`new RegExp`;function uh({gen:t,it:{opts:e}},r){const n=e.unicodeRegExp?"u":"",{regExp:s}=e.code,i=s(r,n);return t.scopeValue("pattern",{key:i.toString(),ref:i,code:(0,pe._)`${s.code==="new RegExp"?ch:(0,th.useFunc)(t,s)}(${r}, ${n})`})}Q.usePattern=uh;function lh(t){const{gen:e,data:r,keyword:n,it:s}=t,i=e.name("valid");if(s.allErrors){const a=e.let("valid",!0);return o(()=>e.assign(a,!1)),a}return e.var(i,!0),o(()=>e.break()),i;function o(a){const c=e.const("len",(0,pe._)`${r}.length`);e.forRange("i",0,c,u=>{t.subschema({keyword:n,dataProp:u,dataPropType:Zs.Type.Num},i),e.if((0,pe.not)(i),a)})}}Q.validateArray=lh;function dh(t){const{gen:e,schema:r,keyword:n,it:s}=t;if(!Array.isArray(r))throw new Error("ajv implementation error");if(r.some(c=>(0,Zs.alwaysValidSchema)(s,c))&&!s.opts.unevaluated)return;const o=e.let("valid",!1),a=e.name("_valid");e.block(()=>r.forEach((c,u)=>{const l=t.subschema({keyword:n,schemaProp:u,compositeRule:!0},a);e.assign(o,(0,pe._)`${o} || ${a}`),t.mergeValidEvaluated(l,a)||e.if((0,pe.not)(o))})),t.result(o,()=>t.reset(),()=>t.error(!0))}Q.validateUnion=dh,Object.defineProperty(dt,"__esModule",{value:!0}),dt.validateKeywordUsage=dt.validSchemaType=dt.funcKeywordCode=dt.macroKeywordCode=void 0;const Le=Y,Dt=lt,fh=Q,hh=Er;function ph(t,e){const{gen:r,keyword:n,schema:s,parentSchema:i,it:o}=t,a=e.macro.call(o.self,s,i,o),c=Ja(r,n,a);o.opts.validateSchema!==!1&&o.self.validateSchema(a,!0);const u=r.name("valid");t.subschema({schema:a,schemaPath:Le.nil,errSchemaPath:`${o.errSchemaPath}/${n}`,topSchemaRef:c,compositeRule:!0},u),t.pass(u,()=>t.error(!0))}dt.macroKeywordCode=ph;function mh(t,e){var r;const{gen:n,keyword:s,schema:i,parentSchema:o,$data:a,it:c}=t;gh(c,e);const u=!a&&e.compile?e.compile.call(c.self,i,o,c):e.validate,l=Ja(n,s,u),f=n.let("valid");t.block$data(f,w),t.ok((r=e.valid)!==null&&r!==void 0?r:f);function w(){if(e.errors===!1)v(),e.modifying&&Ka(t),p(()=>t.error());else{const d=e.async?$():g();e.modifying&&Ka(t),p(()=>_h(t,d))}}function $(){const d=n.let("ruleErrs",null);return n.try(()=>v((0,Le._)`await `),m=>n.assign(f,!1).if((0,Le._)`${m} instanceof ${c.ValidationError}`,()=>n.assign(d,(0,Le._)`${m}.errors`),()=>n.throw(m))),d}function g(){const d=(0,Le._)`${l}.errors`;return n.assign(d,null),v(Le.nil),d}function v(d=e.async?(0,Le._)`await `:Le.nil){const m=c.opts.passContext?Dt.default.this:Dt.default.self,S=!("compile"in e&&!a||e.schema===!1);n.assign(f,(0,Le._)`${d}${(0,fh.callValidateCode)(t,l,m,S)}`,e.modifying)}function p(d){var m;n.if((0,Le.not)((m=e.valid)!==null&&m!==void 0?m:f),d)}}dt.funcKeywordCode=mh;function Ka(t){const{gen:e,data:r,it:n}=t;e.if(n.parentData,()=>e.assign(r,(0,Le._)`${n.parentData}[${n.parentDataProperty}]`))}function _h(t,e){const{gen:r}=t;r.if((0,Le._)`Array.isArray(${e})`,()=>{r.assign(Dt.default.vErrors,(0,Le._)`${Dt.default.vErrors} === null ? ${e} : ${Dt.default.vErrors}.concat(${e})`).assign(Dt.default.errors,(0,Le._)`${Dt.default.vErrors}.length`),(0,hh.extendErrors)(t)},()=>t.error())}function gh({schemaEnv:t},e){if(e.async&&!t.$async)throw new Error("async keyword in sync schema")}function Ja(t,e,r){if(r===void 0)throw new Error(`keyword "${e}" failed to compile`);return t.scopeValue("keyword",typeof r=="function"?{ref:r}:{ref:r,code:(0,Le.stringify)(r)})}function vh(t,e,r=!1){return!e.length||e.some(n=>n==="array"?Array.isArray(t):n==="object"?t&&typeof t=="object"&&!Array.isArray(t):typeof t==n||r&&typeof t>"u")}dt.validSchemaType=vh;function yh({schema:t,opts:e,self:r,errSchemaPath:n},s,i){if(Array.isArray(s.keyword)?!s.keyword.includes(i):s.keyword!==i)throw new Error("ajv implementation error");const o=s.dependencies;if(o!=null&&o.some(a=>!Object.prototype.hasOwnProperty.call(t,a)))throw new Error(`parent schema must have dependencies of ${i}: ${o.join(",")}`);if(s.validateSchema&&!s.validateSchema(t[i])){const c=`keyword "${i}" value is invalid at path "${n}": `+r.errorsText(s.validateSchema.errors);if(e.validateSchema==="log")r.logger.error(c);else throw new Error(c)}}dt.validateKeywordUsage=yh;var Pt={};Object.defineProperty(Pt,"__esModule",{value:!0}),Pt.extendSubschemaMode=Pt.extendSubschemaData=Pt.getSubschema=void 0;const ft=Y,Ba=x;function bh(t,{keyword:e,schemaProp:r,schema:n,schemaPath:s,errSchemaPath:i,topSchemaRef:o}){if(e!==void 0&&n!==void 0)throw new Error('both "keyword" and "schema" passed, only one allowed');if(e!==void 0){const a=t.schema[e];return r===void 0?{schema:a,schemaPath:(0,ft._)`${t.schemaPath}${(0,ft.getProperty)(e)}`,errSchemaPath:`${t.errSchemaPath}/${e}`}:{schema:a[r],schemaPath:(0,ft._)`${t.schemaPath}${(0,ft.getProperty)(e)}${(0,ft.getProperty)(r)}`,errSchemaPath:`${t.errSchemaPath}/${e}/${(0,Ba.escapeFragment)(r)}`}}if(n!==void 0){if(s===void 0||i===void 0||o===void 0)throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:n,schemaPath:s,topSchemaRef:o,errSchemaPath:i}}throw new Error('either "keyword" or "schema" must be passed')}Pt.getSubschema=bh;function wh(t,e,{dataProp:r,dataPropType:n,data:s,dataTypes:i,propertyName:o}){if(s!==void 0&&r!==void 0)throw new Error('both "data" and "dataProp" passed, only one allowed');const{gen:a}=e;if(r!==void 0){const{errorPath:u,dataPathArr:l,opts:f}=e,w=a.let("data",(0,ft._)`${e.data}${(0,ft.getProperty)(r)}`,!0);c(w),t.errorPath=(0,ft.str)`${u}${(0,Ba.getErrorPath)(r,n,f.jsPropertySyntax)}`,t.parentDataProperty=(0,ft._)`${r}`,t.dataPathArr=[...l,t.parentDataProperty]}if(s!==void 0){const u=s instanceof ft.Name?s:a.let("data",s,!0);c(u),o!==void 0&&(t.propertyName=o)}i&&(t.dataTypes=i);function c(u){t.data=u,t.dataLevel=e.dataLevel+1,t.dataTypes=[],e.definedProperties=new Set,t.parentData=e.data,t.dataNames=[...e.dataNames,u]}}Pt.extendSubschemaData=wh;function $h(t,{jtdDiscriminator:e,jtdMetadata:r,compositeRule:n,createErrors:s,allErrors:i}){n!==void 0&&(t.compositeRule=n),s!==void 0&&(t.createErrors=s),i!==void 0&&(t.allErrors=i),t.jtdDiscriminator=e,t.jtdMetadata=r}Pt.extendSubschemaMode=$h;var Ne={},Ga=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,i;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(i=Object.keys(e),n=i.length,n!==Object.keys(r).length)return!1;for(s=n;s--!==0;)if(!Object.prototype.hasOwnProperty.call(r,i[s]))return!1;for(s=n;s--!==0;){var o=i[s];if(!t(e[o],r[o]))return!1}return!0}return e!==e&&r!==r},Ya={exports:{}},Rt=Ya.exports=function(t,e,r){typeof e=="function"&&(r=e,e={}),r=e.cb||r;var n=typeof r=="function"?r:r.pre||function(){},s=r.post||function(){};gn(e,n,s,t,"",t)};Rt.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0},Rt.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0},Rt.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0},Rt.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 gn(t,e,r,n,s,i,o,a,c,u){if(n&&typeof n=="object"&&!Array.isArray(n)){e(n,s,i,o,a,c,u);for(var l in n){var f=n[l];if(Array.isArray(f)){if(l in Rt.arrayKeywords)for(var w=0;w<f.length;w++)gn(t,e,r,f[w],s+"/"+l+"/"+w,i,s,l,n,w)}else if(l in Rt.propsKeywords){if(f&&typeof f=="object")for(var $ in f)gn(t,e,r,f[$],s+"/"+l+"/"+Sh($),i,s,l,n,$)}else(l in Rt.keywords||t.allKeys&&!(l in Rt.skipKeywords))&&gn(t,e,r,f,s+"/"+l,i,s,l,n)}r(n,s,i,o,a,c,u)}}function Sh(t){return t.replace(/~/g,"~0").replace(/\//g,"~1")}var kh=Ya.exports;Object.defineProperty(Ne,"__esModule",{value:!0}),Ne.getSchemaRefs=Ne.resolveUrl=Ne.normalizeId=Ne._getFullPath=Ne.getFullPath=Ne.inlineRef=void 0;const Eh=x,Ph=Ga,Rh=kh,Th=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function Ch(t,e=!0){return typeof t=="boolean"?!0:e===!0?!Us(t):e?Xa(t)<=e:!1}Ne.inlineRef=Ch;const Oh=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function Us(t){for(const e in t){if(Oh.has(e))return!0;const r=t[e];if(Array.isArray(r)&&r.some(Us)||typeof r=="object"&&Us(r))return!0}return!1}function Xa(t){let e=0;for(const r in t){if(r==="$ref")return 1/0;if(e++,!Th.has(r)&&(typeof t[r]=="object"&&(0,Eh.eachItem)(t[r],n=>e+=Xa(n)),e===1/0))return 1/0}return e}function Qa(t,e="",r){r!==!1&&(e=nr(e));const n=t.parse(e);return ec(t,n)}Ne.getFullPath=Qa;function ec(t,e){return t.serialize(e).split("#")[0]+"#"}Ne._getFullPath=ec;const Ih=/#\/?$/;function nr(t){return t?t.replace(Ih,""):""}Ne.normalizeId=nr;function Nh(t,e,r){return r=nr(r),t.resolve(e,r)}Ne.resolveUrl=Nh;const Ah=/^[a-z_][-a-z0-9._]*$/i;function jh(t,e){if(typeof t=="boolean")return{};const{schemaId:r,uriResolver:n}=this.opts,s=nr(t[r]||e),i={"":s},o=Qa(n,s,!1),a={},c=new Set;return Rh(t,{allKeys:!0},(f,w,$,g)=>{if(g===void 0)return;const v=o+w;let p=i[g];typeof f[r]=="string"&&(p=d.call(this,f[r])),m.call(this,f.$anchor),m.call(this,f.$dynamicAnchor),i[w]=p;function d(S){const E=this.opts.uriResolver.resolve;if(S=nr(p?E(p,S):S),c.has(S))throw l(S);c.add(S);let C=this.refs[S];return typeof C=="string"&&(C=this.refs[C]),typeof C=="object"?u(f,C.schema,S):S!==nr(v)&&(S[0]==="#"?(u(f,a[S],S),a[S]=f):this.refs[S]=v),S}function m(S){if(typeof S=="string"){if(!Ah.test(S))throw new Error(`invalid anchor "${S}"`);d.call(this,`#${S}`)}}}),a;function u(f,w,$){if(w!==void 0&&!Ph(f,w))throw l($)}function l(f){return new Error(`reference "${f}" resolves to more than one schema`)}}Ne.getSchemaRefs=jh,Object.defineProperty(Qe,"__esModule",{value:!0}),Qe.getData=Qe.KeywordCxt=Qe.validateFunctionCode=void 0;const tc=er,rc=Te,Ds=_t,vn=Te,zh=_n,Rr=dt,qs=Pt,q=Y,K=lt,Mh=Ne,gt=x,Tr=Er;function Zh(t){if(oc(t)&&(ac(t),ic(t))){Uh(t);return}nc(t,()=>(0,tc.topBoolOrEmptySchema)(t))}Qe.validateFunctionCode=Zh;function nc({gen:t,validateName:e,schema:r,schemaEnv:n,opts:s},i){s.code.es5?t.func(e,(0,q._)`${K.default.data}, ${K.default.valCxt}`,n.$async,()=>{t.code((0,q._)`"use strict"; ${sc(r,s)}`),Lh(t,s),t.code(i)}):t.func(e,(0,q._)`${K.default.data}, ${xh(s)}`,n.$async,()=>t.code(sc(r,s)).code(i))}function xh(t){return(0,q._)`{${K.default.instancePath}="", ${K.default.parentData}, ${K.default.parentDataProperty}, ${K.default.rootData}=${K.default.data}${t.dynamicRef?(0,q._)`, ${K.default.dynamicAnchors}={}`:q.nil}}={}`}function Lh(t,e){t.if(K.default.valCxt,()=>{t.var(K.default.instancePath,(0,q._)`${K.default.valCxt}.${K.default.instancePath}`),t.var(K.default.parentData,(0,q._)`${K.default.valCxt}.${K.default.parentData}`),t.var(K.default.parentDataProperty,(0,q._)`${K.default.valCxt}.${K.default.parentDataProperty}`),t.var(K.default.rootData,(0,q._)`${K.default.valCxt}.${K.default.rootData}`),e.dynamicRef&&t.var(K.default.dynamicAnchors,(0,q._)`${K.default.valCxt}.${K.default.dynamicAnchors}`)},()=>{t.var(K.default.instancePath,(0,q._)`""`),t.var(K.default.parentData,(0,q._)`undefined`),t.var(K.default.parentDataProperty,(0,q._)`undefined`),t.var(K.default.rootData,K.default.data),e.dynamicRef&&t.var(K.default.dynamicAnchors,(0,q._)`{}`)})}function Uh(t){const{schema:e,opts:r,gen:n}=t;nc(t,()=>{r.$comment&&e.$comment&&uc(t),Hh(t),n.let(K.default.vErrors,null),n.let(K.default.errors,0),r.unevaluated&&Dh(t),cc(t),Jh(t)})}function Dh(t){const{gen:e,validateName:r}=t;t.evaluated=e.const("evaluated",(0,q._)`${r}.evaluated`),e.if((0,q._)`${t.evaluated}.dynamicProps`,()=>e.assign((0,q._)`${t.evaluated}.props`,(0,q._)`undefined`)),e.if((0,q._)`${t.evaluated}.dynamicItems`,()=>e.assign((0,q._)`${t.evaluated}.items`,(0,q._)`undefined`))}function sc(t,e){const r=typeof t=="object"&&t[e.schemaId];return r&&(e.code.source||e.code.process)?(0,q._)`/*# sourceURL=${r} */`:q.nil}function qh(t,e){if(oc(t)&&(ac(t),ic(t))){Vh(t,e);return}(0,tc.boolOrEmptySchema)(t,e)}function ic({schema:t,self:e}){if(typeof t=="boolean")return!t;for(const r in t)if(e.RULES.all[r])return!0;return!1}function oc(t){return typeof t.schema!="boolean"}function Vh(t,e){const{schema:r,gen:n,opts:s}=t;s.$comment&&r.$comment&&uc(t),Wh(t),Kh(t);const i=n.const("_errs",K.default.errors);cc(t,i),n.var(e,(0,q._)`${i} === ${K.default.errors}`)}function ac(t){(0,gt.checkUnknownRules)(t),Fh(t)}function cc(t,e){if(t.opts.jtd)return lc(t,[],!1,e);const r=(0,rc.getSchemaTypes)(t.schema),n=(0,rc.coerceAndCheckDataType)(t,r);lc(t,r,!n,e)}function Fh(t){const{schema:e,errSchemaPath:r,opts:n,self:s}=t;e.$ref&&n.ignoreKeywordsWithRef&&(0,gt.schemaHasRulesButRef)(e,s.RULES)&&s.logger.warn(`$ref: keywords ignored in schema at path "${r}"`)}function Hh(t){const{schema:e,opts:r}=t;e.default!==void 0&&r.useDefaults&&r.strictSchema&&(0,gt.checkStrictMode)(t,"default is ignored in the schema root")}function Wh(t){const e=t.schema[t.opts.schemaId];e&&(t.baseId=(0,Mh.resolveUrl)(t.opts.uriResolver,t.baseId,e))}function Kh(t){if(t.schema.$async&&!t.schemaEnv.$async)throw new Error("async schema in sync schema")}function uc({gen:t,schemaEnv:e,schema:r,errSchemaPath:n,opts:s}){const i=r.$comment;if(s.$comment===!0)t.code((0,q._)`${K.default.self}.logger.log(${i})`);else if(typeof s.$comment=="function"){const o=(0,q.str)`${n}/$comment`,a=t.scopeValue("root",{ref:e.root});t.code((0,q._)`${K.default.self}.opts.$comment(${i}, ${o}, ${a}.schema)`)}}function Jh(t){const{gen:e,schemaEnv:r,validateName:n,ValidationError:s,opts:i}=t;r.$async?e.if((0,q._)`${K.default.errors} === 0`,()=>e.return(K.default.data),()=>e.throw((0,q._)`new ${s}(${K.default.vErrors})`)):(e.assign((0,q._)`${n}.errors`,K.default.vErrors),i.unevaluated&&Bh(t),e.return((0,q._)`${K.default.errors} === 0`))}function Bh({gen:t,evaluated:e,props:r,items:n}){r instanceof q.Name&&t.assign((0,q._)`${e}.props`,r),n instanceof q.Name&&t.assign((0,q._)`${e}.items`,n)}function lc(t,e,r,n){const{gen:s,schema:i,data:o,allErrors:a,opts:c,self:u}=t,{RULES:l}=u;if(i.$ref&&(c.ignoreKeywordsWithRef||!(0,gt.schemaHasRulesButRef)(i,l))){s.block(()=>pc(t,"$ref",l.all.$ref.definition));return}c.jtd||Gh(t,e),s.block(()=>{for(const w of l.rules)f(w);f(l.post)});function f(w){(0,Ds.shouldUseGroup)(i,w)&&(w.type?(s.if((0,vn.checkDataType)(w.type,o,c.strictNumbers)),dc(t,w),e.length===1&&e[0]===w.type&&r&&(s.else(),(0,vn.reportTypeError)(t)),s.endIf()):dc(t,w),a||s.if((0,q._)`${K.default.errors} === ${n||0}`))}}function dc(t,e){const{gen:r,schema:n,opts:{useDefaults:s}}=t;s&&(0,zh.assignDefaults)(t,e.type),r.block(()=>{for(const i of e.rules)(0,Ds.shouldUseRule)(n,i)&&pc(t,i.keyword,i.definition,e.type)})}function Gh(t,e){t.schemaEnv.meta||!t.opts.strictTypes||(Yh(t,e),t.opts.allowUnionTypes||Xh(t,e),Qh(t,t.dataTypes))}function Yh(t,e){if(e.length){if(!t.dataTypes.length){t.dataTypes=e;return}e.forEach(r=>{fc(t.dataTypes,r)||Vs(t,`type "${r}" not allowed by context "${t.dataTypes.join(",")}"`)}),tp(t,e)}}function Xh(t,e){e.length>1&&!(e.length===2&&e.includes("null"))&&Vs(t,"use allowUnionTypes to allow union type keyword")}function Qh(t,e){const r=t.self.RULES.all;for(const n in r){const s=r[n];if(typeof s=="object"&&(0,Ds.shouldUseRule)(t.schema,s)){const{type:i}=s.definition;i.length&&!i.some(o=>ep(e,o))&&Vs(t,`missing type "${i.join(",")}" for keyword "${n}"`)}}}function ep(t,e){return t.includes(e)||e==="number"&&t.includes("integer")}function fc(t,e){return t.includes(e)||e==="integer"&&t.includes("number")}function tp(t,e){const r=[];for(const n of t.dataTypes)fc(e,n)?r.push(n):e.includes("integer")&&n==="number"&&r.push("integer");t.dataTypes=r}function Vs(t,e){const r=t.schemaEnv.baseId+t.errSchemaPath;e+=` at "${r}" (strictTypes)`,(0,gt.checkStrictMode)(t,e,t.opts.strictTypes)}class hc{constructor(e,r,n){if((0,Rr.validateKeywordUsage)(e,r,n),this.gen=e.gen,this.allErrors=e.allErrors,this.keyword=n,this.data=e.data,this.schema=e.schema[n],this.$data=r.$data&&e.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,gt.schemaRefOrVal)(e,this.schema,n,this.$data),this.schemaType=r.schemaType,this.parentSchema=e.schema,this.params={},this.it=e,this.def=r,this.$data)this.schemaCode=e.gen.const("vSchema",mc(this.$data,e));else if(this.schemaCode=this.schemaValue,!(0,Rr.validSchemaType)(this.schema,r.schemaType,r.allowUndefined))throw new Error(`${n} value must be ${JSON.stringify(r.schemaType)}`);("code"in r?r.trackErrors:r.errors!==!1)&&(this.errsCount=e.gen.const("_errs",K.default.errors))}result(e,r,n){this.failResult((0,q.not)(e),r,n)}failResult(e,r,n){this.gen.if(e),n?n():this.error(),r?(this.gen.else(),r(),this.allErrors&&this.gen.endIf()):this.allErrors?this.gen.endIf():this.gen.else()}pass(e,r){this.failResult((0,q.not)(e),void 0,r)}fail(e){if(e===void 0){this.error(),this.allErrors||this.gen.if(!1);return}this.gen.if(e),this.error(),this.allErrors?this.gen.endIf():this.gen.else()}fail$data(e){if(!this.$data)return this.fail(e);const{schemaCode:r}=this;this.fail((0,q._)`${r} !== undefined && (${(0,q.or)(this.invalid$data(),e)})`)}error(e,r,n){if(r){this.setParams(r),this._error(e,n),this.setParams({});return}this._error(e,n)}_error(e,r){(e?Tr.reportExtraError:Tr.reportError)(this,this.def.error,r)}$dataError(){(0,Tr.reportError)(this,this.def.$dataError||Tr.keyword$DataError)}reset(){if(this.errsCount===void 0)throw new Error('add "trackErrors" to keyword definition');(0,Tr.resetErrorsCount)(this.gen,this.errsCount)}ok(e){this.allErrors||this.gen.if(e)}setParams(e,r){r?Object.assign(this.params,e):this.params=e}block$data(e,r,n=q.nil){this.gen.block(()=>{this.check$data(e,n),r()})}check$data(e=q.nil,r=q.nil){if(!this.$data)return;const{gen:n,schemaCode:s,schemaType:i,def:o}=this;n.if((0,q.or)((0,q._)`${s} === undefined`,r)),e!==q.nil&&n.assign(e,!0),(i.length||o.validateSchema)&&(n.elseIf(this.invalid$data()),this.$dataError(),e!==q.nil&&n.assign(e,!1)),n.else()}invalid$data(){const{gen:e,schemaCode:r,schemaType:n,def:s,it:i}=this;return(0,q.or)(o(),a());function o(){if(n.length){if(!(r instanceof q.Name))throw new Error("ajv implementation error");const c=Array.isArray(n)?n:[n];return(0,q._)`${(0,vn.checkDataTypes)(c,r,i.opts.strictNumbers,vn.DataType.Wrong)}`}return q.nil}function a(){if(s.validateSchema){const c=e.scopeValue("validate$data",{ref:s.validateSchema});return(0,q._)`!${c}(${r})`}return q.nil}}subschema(e,r){const n=(0,qs.getSubschema)(this.it,e);(0,qs.extendSubschemaData)(n,this.it,e),(0,qs.extendSubschemaMode)(n,e);const s={...this.it,...n,items:void 0,props:void 0};return qh(s,r),s}mergeEvaluated(e,r){const{it:n,gen:s}=this;n.opts.unevaluated&&(n.props!==!0&&e.props!==void 0&&(n.props=gt.mergeEvaluated.props(s,e.props,n.props,r)),n.items!==!0&&e.items!==void 0&&(n.items=gt.mergeEvaluated.items(s,e.items,n.items,r)))}mergeValidEvaluated(e,r){const{it:n,gen:s}=this;if(n.opts.unevaluated&&(n.props!==!0||n.items!==!0))return s.if(r,()=>this.mergeEvaluated(e,q.Name)),!0}}Qe.KeywordCxt=hc;function pc(t,e,r,n){const s=new hc(t,r,e);"code"in r?r.code(s,n):s.$data&&r.validate?(0,Rr.funcKeywordCode)(s,r):"macro"in r?(0,Rr.macroKeywordCode)(s,r):(r.compile||r.validate)&&(0,Rr.funcKeywordCode)(s,r)}const rp=/^\/(?:[^~]|~0|~1)*$/,np=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function mc(t,{dataLevel:e,dataNames:r,dataPathArr:n}){let s,i;if(t==="")return K.default.rootData;if(t[0]==="/"){if(!rp.test(t))throw new Error(`Invalid JSON-pointer: ${t}`);s=t,i=K.default.rootData}else{const u=np.exec(t);if(!u)throw new Error(`Invalid JSON-pointer: ${t}`);const l=+u[1];if(s=u[2],s==="#"){if(l>=e)throw new Error(c("property/index",l));return n[e-l]}if(l>e)throw new Error(c("data",l));if(i=r[e-l],!s)return i}let o=i;const a=s.split("/");for(const u of a)u&&(i=(0,q._)`${i}${(0,q.getProperty)((0,gt.unescapeJsonPointer)(u))}`,o=(0,q._)`${o} && ${i}`);return o;function c(u,l){return`Cannot access ${u} ${l} levels up, current level is ${e}`}}Qe.getData=mc;var Cr={};Object.defineProperty(Cr,"__esModule",{value:!0});class sp extends Error{constructor(e){super("validation failed"),this.errors=e,this.ajv=this.validation=!0}}Cr.default=sp;var sr={};Object.defineProperty(sr,"__esModule",{value:!0});const Fs=Ne;class ip extends Error{constructor(e,r,n,s){super(s||`can't resolve reference ${n} from id ${r}`),this.missingRef=(0,Fs.resolveUrl)(e,r,n),this.missingSchema=(0,Fs.normalizeId)((0,Fs.getFullPath)(e,this.missingRef))}}sr.default=ip;var qe={};Object.defineProperty(qe,"__esModule",{value:!0}),qe.resolveSchema=qe.getCompilingSchema=qe.resolveRef=qe.compileSchema=qe.SchemaEnv=void 0;const et=Y,op=Cr,qt=lt,tt=Ne,_c=x,ap=Qe;class yn{constructor(e){var r;this.refs={},this.dynamicAnchors={};let n;typeof e.schema=="object"&&(n=e.schema),this.schema=e.schema,this.schemaId=e.schemaId,this.root=e.root||this,this.baseId=(r=e.baseId)!==null&&r!==void 0?r:(0,tt.normalizeId)(n==null?void 0:n[e.schemaId||"$id"]),this.schemaPath=e.schemaPath,this.localRefs=e.localRefs,this.meta=e.meta,this.$async=n==null?void 0:n.$async,this.refs={}}}qe.SchemaEnv=yn;function Hs(t){const e=gc.call(this,t);if(e)return e;const r=(0,tt.getFullPath)(this.opts.uriResolver,t.root.baseId),{es5:n,lines:s}=this.opts.code,{ownProperties:i}=this.opts,o=new et.CodeGen(this.scope,{es5:n,lines:s,ownProperties:i});let a;t.$async&&(a=o.scopeValue("Error",{ref:op.default,code:(0,et._)`require("ajv/dist/runtime/validation_error").default`}));const c=o.scopeName("validate");t.validateName=c;const u={gen:o,allErrors:this.opts.allErrors,data:qt.default.data,parentData:qt.default.parentData,parentDataProperty:qt.default.parentDataProperty,dataNames:[qt.default.data],dataPathArr:[et.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:o.scopeValue("schema",this.opts.code.source===!0?{ref:t.schema,code:(0,et.stringify)(t.schema)}:{ref:t.schema}),validateName:c,ValidationError:a,schema:t.schema,schemaEnv:t,rootId:r,baseId:t.baseId||r,schemaPath:et.nil,errSchemaPath:t.schemaPath||(this.opts.jtd?"":"#"),errorPath:(0,et._)`""`,opts:this.opts,self:this};let l;try{this._compilations.add(t),(0,ap.validateFunctionCode)(u),o.optimize(this.opts.code.optimize);const f=o.toString();l=`${o.scopeRefs(qt.default.scope)}return ${f}`,this.opts.code.process&&(l=this.opts.code.process(l,t));const $=new Function(`${qt.default.self}`,`${qt.default.scope}`,l)(this,this.scope.get());if(this.scope.value(c,{ref:$}),$.errors=null,$.schema=t.schema,$.schemaEnv=t,t.$async&&($.$async=!0),this.opts.code.source===!0&&($.source={validateName:c,validateCode:f,scopeValues:o._values}),this.opts.unevaluated){const{props:g,items:v}=u;$.evaluated={props:g instanceof et.Name?void 0:g,items:v instanceof et.Name?void 0:v,dynamicProps:g instanceof et.Name,dynamicItems:v instanceof et.Name},$.source&&($.source.evaluated=(0,et.stringify)($.evaluated))}return t.validate=$,t}catch(f){throw delete t.validate,delete t.validateName,l&&this.logger.error("Error compiling schema, function code:",l),f}finally{this._compilations.delete(t)}}qe.compileSchema=Hs;function cp(t,e,r){var n;r=(0,tt.resolveUrl)(this.opts.uriResolver,e,r);const s=t.refs[r];if(s)return s;let i=dp.call(this,t,r);if(i===void 0){const o=(n=t.localRefs)===null||n===void 0?void 0:n[r],{schemaId:a}=this.opts;o&&(i=new yn({schema:o,schemaId:a,root:t,baseId:e}))}if(i!==void 0)return t.refs[r]=up.call(this,i)}qe.resolveRef=cp;function up(t){return(0,tt.inlineRef)(t.schema,this.opts.inlineRefs)?t.schema:t.validate?t:Hs.call(this,t)}function gc(t){for(const e of this._compilations)if(lp(e,t))return e}qe.getCompilingSchema=gc;function lp(t,e){return t.schema===e.schema&&t.root===e.root&&t.baseId===e.baseId}function dp(t,e){let r;for(;typeof(r=this.refs[e])=="string";)e=r;return r||this.schemas[e]||bn.call(this,t,e)}function bn(t,e){const r=this.opts.uriResolver.parse(e),n=(0,tt._getFullPath)(this.opts.uriResolver,r);let s=(0,tt.getFullPath)(this.opts.uriResolver,t.baseId,void 0);if(Object.keys(t.schema).length>0&&n===s)return Ws.call(this,r,t);const i=(0,tt.normalizeId)(n),o=this.refs[i]||this.schemas[i];if(typeof o=="string"){const a=bn.call(this,t,o);return typeof(a==null?void 0:a.schema)!="object"?void 0:Ws.call(this,r,a)}if(typeof(o==null?void 0:o.schema)=="object"){if(o.validate||Hs.call(this,o),i===(0,tt.normalizeId)(e)){const{schema:a}=o,{schemaId:c}=this.opts,u=a[c];return u&&(s=(0,tt.resolveUrl)(this.opts.uriResolver,s,u)),new yn({schema:a,schemaId:c,root:t,baseId:s})}return Ws.call(this,r,o)}}qe.resolveSchema=bn;const fp=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function Ws(t,{baseId:e,schema:r,root:n}){var s;if(((s=t.fragment)===null||s===void 0?void 0:s[0])!=="/")return;for(const a of t.fragment.slice(1).split("/")){if(typeof r=="boolean")return;const c=r[(0,_c.unescapeFragment)(a)];if(c===void 0)return;r=c;const u=typeof r=="object"&&r[this.opts.schemaId];!fp.has(a)&&u&&(e=(0,tt.resolveUrl)(this.opts.uriResolver,e,u))}let i;if(typeof r!="boolean"&&r.$ref&&!(0,_c.schemaHasRulesButRef)(r,this.RULES)){const a=(0,tt.resolveUrl)(this.opts.uriResolver,e,r.$ref);i=bn.call(this,n,a)}const{schemaId:o}=this.opts;if(i=i||new yn({schema:r,schemaId:o,root:n,baseId:e}),i.schema!==i.root.schema)return i}const hp={$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 Ks={},wn={exports:{}};const pp=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),vc=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 yc(t){let e="",r=0,n=0;for(n=0;n<t.length;n++)if(r=t[n].charCodeAt(0),r!==48){if(!(r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";e+=t[n];break}for(n+=1;n<t.length;n++){if(r=t[n].charCodeAt(0),!(r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";e+=t[n]}return e}const mp=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function bc(t){return t.length=0,!0}function _p(t,e,r){if(t.length){const n=yc(t);if(n!=="")e.push(n);else return r.error=!0,!1;t.length=0}return!0}function gp(t){let e=0;const r={error:!1,address:"",zone:""},n=[],s=[];let i=!1,o=!1,a=_p;for(let c=0;c<t.length;c++){const u=t[c];if(!(u==="["||u==="]"))if(u===":"){if(i===!0&&(o=!0),!a(s,n,r))break;if(++e>7){r.error=!0;break}c>0&&t[c-1]===":"&&(i=!0),n.push(":");continue}else if(u==="%"){if(!a(s,n,r))break;a=bc}else{s.push(u);continue}}return s.length&&(a===bc?r.zone=s.join(""):o?n.push(s.join("")):n.push(yc(s))),r.address=n.join(""),r}function wc(t){if(vp(t,":")<2)return{host:t,isIPV6:!1};const e=gp(t);if(e.error)return{host:t,isIPV6:!1};{let r=e.address,n=e.address;return e.zone&&(r+="%"+e.zone,n+="%25"+e.zone),{host:r,isIPV6:!0,escapedHost:n}}}function vp(t,e){let r=0;for(let n=0;n<t.length;n++)t[n]===e&&r++;return r}function yp(t){let e=t;const r=[];let n=-1,s=0;for(;s=e.length;){if(s===1){if(e===".")break;if(e==="/"){r.push("/");break}else{r.push(e);break}}else if(s===2){if(e[0]==="."){if(e[1]===".")break;if(e[1]==="/"){e=e.slice(2);continue}}else if(e[0]==="/"&&(e[1]==="."||e[1]==="/")){r.push("/");break}}else if(s===3&&e==="/.."){r.length!==0&&r.pop(),r.push("/");break}if(e[0]==="."){if(e[1]==="."){if(e[2]==="/"){e=e.slice(3);continue}}else if(e[1]==="/"){e=e.slice(2);continue}}else if(e[0]==="/"&&e[1]==="."){if(e[2]==="/"){e=e.slice(2);continue}else if(e[2]==="."&&e[3]==="/"){e=e.slice(3),r.length!==0&&r.pop();continue}}if((n=e.indexOf("/",1))===-1){r.push(e);break}else r.push(e.slice(0,n)),e=e.slice(n)}return r.join("")}function bp(t,e){const r=e!==!0?escape:unescape;return t.scheme!==void 0&&(t.scheme=r(t.scheme)),t.userinfo!==void 0&&(t.userinfo=r(t.userinfo)),t.host!==void 0&&(t.host=r(t.host)),t.path!==void 0&&(t.path=r(t.path)),t.query!==void 0&&(t.query=r(t.query)),t.fragment!==void 0&&(t.fragment=r(t.fragment)),t}function wp(t){const e=[];if(t.userinfo!==void 0&&(e.push(t.userinfo),e.push("@")),t.host!==void 0){let r=unescape(t.host);if(!vc(r)){const n=wc(r);n.isIPV6===!0?r=`[${n.escapedHost}]`:r=t.host}e.push(r)}return(typeof t.port=="number"||typeof t.port=="string")&&(e.push(":"),e.push(String(t.port))),e.length?e.join(""):void 0}var $c={nonSimpleDomain:mp,recomposeAuthority:wp,normalizeComponentEncoding:bp,removeDotSegments:yp,isIPv4:vc,isUUID:pp,normalizeIPv6:wc};const{isUUID:$p}=$c,Sp=/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu;function Sc(t){return t.secure===!0?!0:t.secure===!1?!1:t.scheme?t.scheme.length===3&&(t.scheme[0]==="w"||t.scheme[0]==="W")&&(t.scheme[1]==="s"||t.scheme[1]==="S")&&(t.scheme[2]==="s"||t.scheme[2]==="S"):!1}function kc(t){return t.host||(t.error=t.error||"HTTP URIs must have a host."),t}function Ec(t){const e=String(t.scheme).toLowerCase()==="https";return(t.port===(e?443:80)||t.port==="")&&(t.port=void 0),t.path||(t.path="/"),t}function kp(t){return t.secure=Sc(t),t.resourceName=(t.path||"/")+(t.query?"?"+t.query:""),t.path=void 0,t.query=void 0,t}function Ep(t){if((t.port===(Sc(t)?443:80)||t.port==="")&&(t.port=void 0),typeof t.secure=="boolean"&&(t.scheme=t.secure?"wss":"ws",t.secure=void 0),t.resourceName){const[e,r]=t.resourceName.split("?");t.path=e&&e!=="/"?e:void 0,t.query=r,t.resourceName=void 0}return t.fragment=void 0,t}function Pp(t,e){if(!t.path)return t.error="URN can not be parsed",t;const r=t.path.match(Sp);if(r){const n=e.scheme||t.scheme||"urn";t.nid=r[1].toLowerCase(),t.nss=r[2];const s=`${n}:${e.nid||t.nid}`,i=Js(s);t.path=void 0,i&&(t=i.parse(t,e))}else t.error=t.error||"URN can not be parsed.";return t}function Rp(t,e){if(t.nid===void 0)throw new Error("URN without nid cannot be serialized");const r=e.scheme||t.scheme||"urn",n=t.nid.toLowerCase(),s=`${r}:${e.nid||n}`,i=Js(s);i&&(t=i.serialize(t,e));const o=t,a=t.nss;return o.path=`${n||e.nid}:${a}`,e.skipEscape=!0,o}function Tp(t,e){const r=t;return r.uuid=r.nss,r.nss=void 0,!e.tolerant&&(!r.uuid||!$p(r.uuid))&&(r.error=r.error||"UUID is not valid."),r}function Cp(t){const e=t;return e.nss=(t.uuid||"").toLowerCase(),e}const Pc={scheme:"http",domainHost:!0,parse:kc,serialize:Ec},Op={scheme:"https",domainHost:Pc.domainHost,parse:kc,serialize:Ec},$n={scheme:"ws",domainHost:!0,parse:kp,serialize:Ep},Ip={scheme:"wss",domainHost:$n.domainHost,parse:$n.parse,serialize:$n.serialize},Sn={http:Pc,https:Op,ws:$n,wss:Ip,urn:{scheme:"urn",parse:Pp,serialize:Rp,skipNormalize:!0},"urn:uuid":{scheme:"urn:uuid",parse:Tp,serialize:Cp,skipNormalize:!0}};Object.setPrototypeOf(Sn,null);function Js(t){return t&&(Sn[t]||Sn[t.toLowerCase()])||void 0}var Np={SCHEMES:Sn,getSchemeHandler:Js};const{normalizeIPv6:Ap,removeDotSegments:Or,recomposeAuthority:jp,normalizeComponentEncoding:kn,isIPv4:zp,nonSimpleDomain:Mp}=$c,{SCHEMES:Zp,getSchemeHandler:Rc}=Np;function xp(t,e){return typeof t=="string"?t=ht(vt(t,e),e):typeof t=="object"&&(t=vt(ht(t,e),e)),t}function Lp(t,e,r){const n=r?Object.assign({scheme:"null"},r):{scheme:"null"},s=Tc(vt(t,n),vt(e,n),n,!0);return n.skipEscape=!0,ht(s,n)}function Tc(t,e,r,n){const s={};return n||(t=vt(ht(t,r),r),e=vt(ht(e,r),r)),r=r||{},!r.tolerant&&e.scheme?(s.scheme=e.scheme,s.userinfo=e.userinfo,s.host=e.host,s.port=e.port,s.path=Or(e.path||""),s.query=e.query):(e.userinfo!==void 0||e.host!==void 0||e.port!==void 0?(s.userinfo=e.userinfo,s.host=e.host,s.port=e.port,s.path=Or(e.path||""),s.query=e.query):(e.path?(e.path[0]==="/"?s.path=Or(e.path):((t.userinfo!==void 0||t.host!==void 0||t.port!==void 0)&&!t.path?s.path="/"+e.path:t.path?s.path=t.path.slice(0,t.path.lastIndexOf("/")+1)+e.path:s.path=e.path,s.path=Or(s.path)),s.query=e.query):(s.path=t.path,e.query!==void 0?s.query=e.query:s.query=t.query),s.userinfo=t.userinfo,s.host=t.host,s.port=t.port),s.scheme=t.scheme),s.fragment=e.fragment,s}function Up(t,e,r){return typeof t=="string"?(t=unescape(t),t=ht(kn(vt(t,r),!0),{...r,skipEscape:!0})):typeof t=="object"&&(t=ht(kn(t,!0),{...r,skipEscape:!0})),typeof e=="string"?(e=unescape(e),e=ht(kn(vt(e,r),!0),{...r,skipEscape:!0})):typeof e=="object"&&(e=ht(kn(e,!0),{...r,skipEscape:!0})),t.toLowerCase()===e.toLowerCase()}function ht(t,e){const r={host:t.host,scheme:t.scheme,userinfo:t.userinfo,port:t.port,path:t.path,query:t.query,nid:t.nid,nss:t.nss,uuid:t.uuid,fragment:t.fragment,reference:t.reference,resourceName:t.resourceName,secure:t.secure,error:""},n=Object.assign({},e),s=[],i=Rc(n.scheme||r.scheme);i&&i.serialize&&i.serialize(r,n),r.path!==void 0&&(n.skipEscape?r.path=unescape(r.path):(r.path=escape(r.path),r.scheme!==void 0&&(r.path=r.path.split("%3A").join(":")))),n.reference!=="suffix"&&r.scheme&&s.push(r.scheme,":");const o=jp(r);if(o!==void 0&&(n.reference!=="suffix"&&s.push("//"),s.push(o),r.path&&r.path[0]!=="/"&&s.push("/")),r.path!==void 0){let a=r.path;!n.absolutePath&&(!i||!i.absolutePath)&&(a=Or(a)),o===void 0&&a[0]==="/"&&a[1]==="/"&&(a="/%2F"+a.slice(2)),s.push(a)}return r.query!==void 0&&s.push("?",r.query),r.fragment!==void 0&&s.push("#",r.fragment),s.join("")}const Dp=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;function vt(t,e){const r=Object.assign({},e),n={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0};let s=!1;r.reference==="suffix"&&(r.scheme?t=r.scheme+":"+t:t="//"+t);const i=t.match(Dp);if(i){if(n.scheme=i[1],n.userinfo=i[3],n.host=i[4],n.port=parseInt(i[5],10),n.path=i[6]||"",n.query=i[7],n.fragment=i[8],isNaN(n.port)&&(n.port=i[5]),n.host)if(zp(n.host)===!1){const c=Ap(n.host);n.host=c.host.toLowerCase(),s=c.isIPV6}else s=!0;n.scheme===void 0&&n.userinfo===void 0&&n.host===void 0&&n.port===void 0&&n.query===void 0&&!n.path?n.reference="same-document":n.scheme===void 0?n.reference="relative":n.fragment===void 0?n.reference="absolute":n.reference="uri",r.reference&&r.reference!=="suffix"&&r.reference!==n.reference&&(n.error=n.error||"URI is not a "+r.reference+" reference.");const o=Rc(r.scheme||n.scheme);if(!r.unicodeSupport&&(!o||!o.unicodeSupport)&&n.host&&(r.domainHost||o&&o.domainHost)&&s===!1&&Mp(n.host))try{n.host=URL.domainToASCII(n.host.toLowerCase())}catch(a){n.error=n.error||"Host's domain name can not be converted to ASCII: "+a}(!o||o&&!o.skipNormalize)&&(t.indexOf("%")!==-1&&(n.scheme!==void 0&&(n.scheme=unescape(n.scheme)),n.host!==void 0&&(n.host=unescape(n.host))),n.path&&(n.path=escape(unescape(n.path))),n.fragment&&(n.fragment=encodeURI(decodeURIComponent(n.fragment)))),o&&o.parse&&o.parse(n,r)}else n.error=n.error||"URI can not be parsed.";return n}const Bs={SCHEMES:Zp,normalize:xp,resolve:Lp,resolveComponent:Tc,equal:Up,serialize:ht,parse:vt};wn.exports=Bs,wn.exports.default=Bs,wn.exports.fastUri=Bs;var qp=wn.exports;Object.defineProperty(Ks,"__esModule",{value:!0});const Cc=qp;Cc.code='require("ajv/dist/runtime/uri").default',Ks.default=Cc,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=Qe;Object.defineProperty(t,"KeywordCxt",{enumerable:!0,get:function(){return e.KeywordCxt}});var r=Y;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=Cr,s=sr,i=Ut,o=qe,a=Y,c=Ne,u=Te,l=x,f=hp,w=Ks,$=(A,k)=>new RegExp(A,k);$.code="new RegExp";const g=["removeAdditional","useDefaults","coerceTypes"],v=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),p={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."},d={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},m=200;function S(A){var k,O,P,h,y,T,V,F,le,ce,Ie,kr,_a,ga,va,ya,ba,wa,$a,Sa,ka,Ea,Pa,Ra,Ta;const mn=A.strict,Ca=(k=A.code)===null||k===void 0?void 0:k.optimize,yf=Ca===!0||Ca===void 0?1:Ca||0,bf=(P=(O=A.code)===null||O===void 0?void 0:O.regExp)!==null&&P!==void 0?P:$,Ww=(h=A.uriResolver)!==null&&h!==void 0?h:w.default;return{strictSchema:(T=(y=A.strictSchema)!==null&&y!==void 0?y:mn)!==null&&T!==void 0?T:!0,strictNumbers:(F=(V=A.strictNumbers)!==null&&V!==void 0?V:mn)!==null&&F!==void 0?F:!0,strictTypes:(ce=(le=A.strictTypes)!==null&&le!==void 0?le:mn)!==null&&ce!==void 0?ce:"log",strictTuples:(kr=(Ie=A.strictTuples)!==null&&Ie!==void 0?Ie:mn)!==null&&kr!==void 0?kr:"log",strictRequired:(ga=(_a=A.strictRequired)!==null&&_a!==void 0?_a:mn)!==null&&ga!==void 0?ga:!1,code:A.code?{...A.code,optimize:yf,regExp:bf}:{optimize:yf,regExp:bf},loopRequired:(va=A.loopRequired)!==null&&va!==void 0?va:m,loopEnum:(ya=A.loopEnum)!==null&&ya!==void 0?ya:m,meta:(ba=A.meta)!==null&&ba!==void 0?ba:!0,messages:(wa=A.messages)!==null&&wa!==void 0?wa:!0,inlineRefs:($a=A.inlineRefs)!==null&&$a!==void 0?$a:!0,schemaId:(Sa=A.schemaId)!==null&&Sa!==void 0?Sa:"$id",addUsedSchema:(ka=A.addUsedSchema)!==null&&ka!==void 0?ka:!0,validateSchema:(Ea=A.validateSchema)!==null&&Ea!==void 0?Ea:!0,validateFormats:(Pa=A.validateFormats)!==null&&Pa!==void 0?Pa:!0,unicodeRegExp:(Ra=A.unicodeRegExp)!==null&&Ra!==void 0?Ra:!0,int32range:(Ta=A.int32range)!==null&&Ta!==void 0?Ta:!0,uriResolver:Ww}}class E{constructor(k={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,k=this.opts={...k,...S(k)};const{es5:O,lines:P}=this.opts.code;this.scope=new a.ValueScope({scope:{},prefixes:v,es5:O,lines:P}),this.logger=X(k.logger);const h=k.validateFormats;k.validateFormats=!1,this.RULES=(0,i.getRules)(),C.call(this,p,k,"NOT SUPPORTED"),C.call(this,d,k,"DEPRECATED","warn"),this._metaOpts=$t.call(this),k.formats&&ye.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),k.keywords&&Me.call(this,k.keywords),typeof k.meta=="object"&&this.addMetaSchema(k.meta),B.call(this),k.validateFormats=h}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){const{$data:k,meta:O,schemaId:P}=this.opts;let h=f;P==="id"&&(h={...f},h.id=h.$id,delete h.$id),O&&k&&this.addMetaSchema(h,h[P],!1)}defaultMeta(){const{meta:k,schemaId:O}=this.opts;return this.opts.defaultMeta=typeof k=="object"?k[O]||k:void 0}validate(k,O){let P;if(typeof k=="string"){if(P=this.getSchema(k),!P)throw new Error(`no schema with key or ref "${k}"`)}else P=this.compile(k);const h=P(O);return"$async"in P||(this.errors=P.errors),h}compile(k,O){const P=this._addSchema(k,O);return P.validate||this._compileSchemaEnv(P)}compileAsync(k,O){if(typeof this.opts.loadSchema!="function")throw new Error("options.loadSchema should be a function");const{loadSchema:P}=this.opts;return h.call(this,k,O);async function h(ce,Ie){await y.call(this,ce.$schema);const kr=this._addSchema(ce,Ie);return kr.validate||T.call(this,kr)}async function y(ce){ce&&!this.getSchema(ce)&&await h.call(this,{$ref:ce},!0)}async function T(ce){try{return this._compileSchemaEnv(ce)}catch(Ie){if(!(Ie instanceof s.default))throw Ie;return V.call(this,Ie),await F.call(this,Ie.missingSchema),T.call(this,ce)}}function V({missingSchema:ce,missingRef:Ie}){if(this.refs[ce])throw new Error(`AnySchema ${ce} is loaded but ${Ie} cannot be resolved`)}async function F(ce){const Ie=await le.call(this,ce);this.refs[ce]||await y.call(this,Ie.$schema),this.refs[ce]||this.addSchema(Ie,ce,O)}async function le(ce){const Ie=this._loading[ce];if(Ie)return Ie;try{return await(this._loading[ce]=P(ce))}finally{delete this._loading[ce]}}}addSchema(k,O,P,h=this.opts.validateSchema){if(Array.isArray(k)){for(const T of k)this.addSchema(T,void 0,P,h);return this}let y;if(typeof k=="object"){const{schemaId:T}=this.opts;if(y=k[T],y!==void 0&&typeof y!="string")throw new Error(`schema ${T} must be string`)}return O=(0,c.normalizeId)(O||y),this._checkUnique(O),this.schemas[O]=this._addSchema(k,P,O,h,!0),this}addMetaSchema(k,O,P=this.opts.validateSchema){return this.addSchema(k,O,!0,P),this}validateSchema(k,O){if(typeof k=="boolean")return!0;let P;if(P=k.$schema,P!==void 0&&typeof P!="string")throw new Error("$schema must be a string");if(P=P||this.opts.defaultMeta||this.defaultMeta(),!P)return this.logger.warn("meta-schema not available"),this.errors=null,!0;const h=this.validate(P,k);if(!h&&O){const y="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(y);else throw new Error(y)}return h}getSchema(k){let O;for(;typeof(O=z.call(this,k))=="string";)k=O;if(O===void 0){const{schemaId:P}=this.opts,h=new o.SchemaEnv({schema:{},schemaId:P});if(O=o.resolveSchema.call(this,h,k),!O)return;this.refs[k]=O}return O.validate||this._compileSchemaEnv(O)}removeSchema(k){if(k instanceof RegExp)return this._removeAllSchemas(this.schemas,k),this._removeAllSchemas(this.refs,k),this;switch(typeof k){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{const O=z.call(this,k);return typeof O=="object"&&this._cache.delete(O.schema),delete this.schemas[k],delete this.refs[k],this}case"object":{const O=k;this._cache.delete(O);let P=k[this.opts.schemaId];return P&&(P=(0,c.normalizeId)(P),delete this.schemas[P],delete this.refs[P]),this}default:throw new Error("ajv.removeSchema: invalid parameter")}}addVocabulary(k){for(const O of k)this.addKeyword(O);return this}addKeyword(k,O){let P;if(typeof k=="string")P=k,typeof O=="object"&&(this.logger.warn("these parameters are deprecated, see docs for addKeyword"),O.keyword=P);else if(typeof k=="object"&&O===void 0){if(O=k,P=O.keyword,Array.isArray(P)&&!P.length)throw new Error("addKeywords: keyword must be string or non-empty array")}else throw new Error("invalid addKeywords parameters");if(ne.call(this,P,O),!O)return(0,l.eachItem)(P,y=>Ze.call(this,y)),this;kt.call(this,O);const h={...O,type:(0,u.getJSONTypes)(O.type),schemaType:(0,u.getJSONTypes)(O.schemaType)};return(0,l.eachItem)(P,h.type.length===0?y=>Ze.call(this,y,h):y=>h.type.forEach(T=>Ze.call(this,y,h,T))),this}getKeyword(k){const O=this.RULES.all[k];return typeof O=="object"?O.definition:!!O}removeKeyword(k){const{RULES:O}=this;delete O.keywords[k],delete O.all[k];for(const P of O.rules){const h=P.rules.findIndex(y=>y.keyword===k);h>=0&&P.rules.splice(h,1)}return this}addFormat(k,O){return typeof O=="string"&&(O=new RegExp(O)),this.formats[k]=O,this}errorsText(k=this.errors,{separator:O=", ",dataVar:P="data"}={}){return!k||k.length===0?"No errors":k.map(h=>`${P}${h.instancePath} ${h.message}`).reduce((h,y)=>h+O+y)}$dataMetaSchema(k,O){const P=this.RULES.all;k=JSON.parse(JSON.stringify(k));for(const h of O){const y=h.split("/").slice(1);let T=k;for(const V of y)T=T[V];for(const V in P){const F=P[V];if(typeof F!="object")continue;const{$data:le}=F.definition,ce=T[V];le&&ce&&(T[V]=Xt(ce))}}return k}_removeAllSchemas(k,O){for(const P in k){const h=k[P];(!O||O.test(P))&&(typeof h=="string"?delete k[P]:h&&!h.meta&&(this._cache.delete(h.schema),delete k[P]))}}_addSchema(k,O,P,h=this.opts.validateSchema,y=this.opts.addUsedSchema){let T;const{schemaId:V}=this.opts;if(typeof k=="object")T=k[V];else{if(this.opts.jtd)throw new Error("schema must be object");if(typeof k!="boolean")throw new Error("schema must be object or boolean")}let F=this._cache.get(k);if(F!==void 0)return F;P=(0,c.normalizeId)(T||P);const le=c.getSchemaRefs.call(this,k,P);return F=new o.SchemaEnv({schema:k,schemaId:V,meta:O,baseId:P,localRefs:le}),this._cache.set(F.schema,F),y&&!P.startsWith("#")&&(P&&this._checkUnique(P),this.refs[P]=F),h&&this.validateSchema(k,!0),F}_checkUnique(k){if(this.schemas[k]||this.refs[k])throw new Error(`schema with key or id "${k}" already exists`)}_compileSchemaEnv(k){if(k.meta?this._compileMetaSchema(k):o.compileSchema.call(this,k),!k.validate)throw new Error("ajv implementation error");return k.validate}_compileMetaSchema(k){const O=this.opts;this.opts=this._metaOpts;try{o.compileSchema.call(this,k)}finally{this.opts=O}}}E.ValidationError=n.default,E.MissingRefError=s.default,t.default=E;function C(A,k,O,P="error"){for(const h in A){const y=h;y in k&&this.logger[P](`${O}: option ${h}. ${A[y]}`)}}function z(A){return A=(0,c.normalizeId)(A),this.schemas[A]||this.refs[A]}function B(){const A=this.opts.schemas;if(A)if(Array.isArray(A))this.addSchema(A);else for(const k in A)this.addSchema(A[k],k)}function ye(){for(const A in this.opts.formats){const k=this.opts.formats[A];k&&this.addFormat(A,k)}}function Me(A){if(Array.isArray(A)){this.addVocabulary(A);return}this.logger.warn("keywords option as map is deprecated, pass array");for(const k in A){const O=A[k];O.keyword||(O.keyword=k),this.addKeyword(O)}}function $t(){const A={...this.opts};for(const k of g)delete A[k];return A}const W={log(){},warn(){},error(){}};function X(A){if(A===!1)return W;if(A===void 0)return console;if(A.log&&A.warn&&A.error)return A;throw new Error("logger must implement log, warn and error methods")}const be=/^[a-z_$][a-z0-9_$:-]*$/i;function ne(A,k){const{RULES:O}=this;if((0,l.eachItem)(A,P=>{if(O.keywords[P])throw new Error(`Keyword ${P} is already defined`);if(!be.test(P))throw new Error(`Keyword ${P} has invalid name`)}),!!k&&k.$data&&!("code"in k||"validate"in k))throw new Error('$data keyword must have "code" or "validate" function')}function Ze(A,k,O){var P;const h=k==null?void 0:k.post;if(O&&h)throw new Error('keyword with "post" flag cannot have "type"');const{RULES:y}=this;let T=h?y.post:y.rules.find(({type:F})=>F===O);if(T||(T={type:O,rules:[]},y.rules.push(T)),y.keywords[A]=!0,!k)return;const V={keyword:A,definition:{...k,type:(0,u.getJSONTypes)(k.type),schemaType:(0,u.getJSONTypes)(k.schemaType)}};k.before?St.call(this,T,V,k.before):T.rules.push(V),y.all[A]=V,(P=k.implements)===null||P===void 0||P.forEach(F=>this.addKeyword(F))}function St(A,k,O){const P=A.rules.findIndex(h=>h.keyword===O);P>=0?A.rules.splice(P,0,k):(A.rules.push(k),this.logger.warn(`rule ${O} is not defined`))}function kt(A){let{metaSchema:k}=A;k!==void 0&&(A.$data&&this.opts.$data&&(k=Xt(k)),A.validateSchema=this.compile(k,!0))}const pn={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function Xt(A){return{anyOf:[A,pn]}}}(Oa);var Gs={},Ys={},Xs={};Object.defineProperty(Xs,"__esModule",{value:!0});const Vp={keyword:"id",code(){throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};Xs.default=Vp;var Vt={};Object.defineProperty(Vt,"__esModule",{value:!0}),Vt.callRef=Vt.getValidate=void 0;const Fp=sr,Oc=Q,Ve=Y,ir=lt,Ic=qe,En=x,Hp={keyword:"$ref",schemaType:"string",code(t){const{gen:e,schema:r,it:n}=t,{baseId:s,schemaEnv:i,validateName:o,opts:a,self:c}=n,{root:u}=i;if((r==="#"||r==="#/")&&s===u.baseId)return f();const l=Ic.resolveRef.call(c,u,s,r);if(l===void 0)throw new Fp.default(n.opts.uriResolver,s,r);if(l instanceof Ic.SchemaEnv)return w(l);return $(l);function f(){if(i===u)return Pn(t,o,i,i.$async);const g=e.scopeValue("root",{ref:u});return Pn(t,(0,Ve._)`${g}.validate`,u,u.$async)}function w(g){const v=Nc(t,g);Pn(t,v,g,g.$async)}function $(g){const v=e.scopeValue("schema",a.code.source===!0?{ref:g,code:(0,Ve.stringify)(g)}:{ref:g}),p=e.name("valid"),d=t.subschema({schema:g,dataTypes:[],schemaPath:Ve.nil,topSchemaRef:v,errSchemaPath:r},p);t.mergeEvaluated(d),t.ok(p)}}};function Nc(t,e){const{gen:r}=t;return e.validate?r.scopeValue("validate",{ref:e.validate}):(0,Ve._)`${r.scopeValue("wrapper",{ref:e})}.validate`}Vt.getValidate=Nc;function Pn(t,e,r,n){const{gen:s,it:i}=t,{allErrors:o,schemaEnv:a,opts:c}=i,u=c.passContext?ir.default.this:Ve.nil;n?l():f();function l(){if(!a.$async)throw new Error("async schema referenced by sync schema");const g=s.let("valid");s.try(()=>{s.code((0,Ve._)`await ${(0,Oc.callValidateCode)(t,e,u)}`),$(e),o||s.assign(g,!0)},v=>{s.if((0,Ve._)`!(${v} instanceof ${i.ValidationError})`,()=>s.throw(v)),w(v),o||s.assign(g,!1)}),t.ok(g)}function f(){t.result((0,Oc.callValidateCode)(t,e,u),()=>$(e),()=>w(e))}function w(g){const v=(0,Ve._)`${g}.errors`;s.assign(ir.default.vErrors,(0,Ve._)`${ir.default.vErrors} === null ? ${v} : ${ir.default.vErrors}.concat(${v})`),s.assign(ir.default.errors,(0,Ve._)`${ir.default.vErrors}.length`)}function $(g){var v;if(!i.opts.unevaluated)return;const p=(v=r==null?void 0:r.validate)===null||v===void 0?void 0:v.evaluated;if(i.props!==!0)if(p&&!p.dynamicProps)p.props!==void 0&&(i.props=En.mergeEvaluated.props(s,p.props,i.props));else{const d=s.var("props",(0,Ve._)`${g}.evaluated.props`);i.props=En.mergeEvaluated.props(s,d,i.props,Ve.Name)}if(i.items!==!0)if(p&&!p.dynamicItems)p.items!==void 0&&(i.items=En.mergeEvaluated.items(s,p.items,i.items));else{const d=s.var("items",(0,Ve._)`${g}.evaluated.items`);i.items=En.mergeEvaluated.items(s,d,i.items,Ve.Name)}}}Vt.callRef=Pn,Vt.default=Hp,Object.defineProperty(Ys,"__esModule",{value:!0});const Wp=Xs,Kp=Vt,Jp=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",Wp.default,Kp.default];Ys.default=Jp;var Qs={},ei={};Object.defineProperty(ei,"__esModule",{value:!0});const Rn=Y,Tt=Rn.operators,Tn={maximum:{okStr:"<=",ok:Tt.LTE,fail:Tt.GT},minimum:{okStr:">=",ok:Tt.GTE,fail:Tt.LT},exclusiveMaximum:{okStr:"<",ok:Tt.LT,fail:Tt.GTE},exclusiveMinimum:{okStr:">",ok:Tt.GT,fail:Tt.LTE}},Bp={message:({keyword:t,schemaCode:e})=>(0,Rn.str)`must be ${Tn[t].okStr} ${e}`,params:({keyword:t,schemaCode:e})=>(0,Rn._)`{comparison: ${Tn[t].okStr}, limit: ${e}}`},Gp={keyword:Object.keys(Tn),type:"number",schemaType:"number",$data:!0,error:Bp,code(t){const{keyword:e,data:r,schemaCode:n}=t;t.fail$data((0,Rn._)`${r} ${Tn[e].fail} ${n} || isNaN(${r})`)}};ei.default=Gp;var ti={};Object.defineProperty(ti,"__esModule",{value:!0});const Ir=Y,Yp={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:{message:({schemaCode:t})=>(0,Ir.str)`must be multiple of ${t}`,params:({schemaCode:t})=>(0,Ir._)`{multipleOf: ${t}}`},code(t){const{gen:e,data:r,schemaCode:n,it:s}=t,i=s.opts.multipleOfPrecision,o=e.let("res"),a=i?(0,Ir._)`Math.abs(Math.round(${o}) - ${o}) > 1e-${i}`:(0,Ir._)`${o} !== parseInt(${o})`;t.fail$data((0,Ir._)`(${n} === 0 || (${o} = ${r}/${n}, ${a}))`)}};ti.default=Yp;var ri={},ni={};Object.defineProperty(ni,"__esModule",{value:!0});function Ac(t){const e=t.length;let r=0,n=0,s;for(;n<e;)r++,s=t.charCodeAt(n++),s>=55296&&s<=56319&&n<e&&(s=t.charCodeAt(n),(s&64512)===56320&&n++);return r}ni.default=Ac,Ac.code='require("ajv/dist/runtime/ucs2length").default',Object.defineProperty(ri,"__esModule",{value:!0});const Ft=Y,Xp=x,Qp=ni,em={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:{message({keyword:t,schemaCode:e}){const r=t==="maxLength"?"more":"fewer";return(0,Ft.str)`must NOT have ${r} than ${e} characters`},params:({schemaCode:t})=>(0,Ft._)`{limit: ${t}}`},code(t){const{keyword:e,data:r,schemaCode:n,it:s}=t,i=e==="maxLength"?Ft.operators.GT:Ft.operators.LT,o=s.opts.unicode===!1?(0,Ft._)`${r}.length`:(0,Ft._)`${(0,Xp.useFunc)(t.gen,Qp.default)}(${r})`;t.fail$data((0,Ft._)`${o} ${i} ${n}`)}};ri.default=em;var si={};Object.defineProperty(si,"__esModule",{value:!0});const tm=Q,Cn=Y,rm={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:{message:({schemaCode:t})=>(0,Cn.str)`must match pattern "${t}"`,params:({schemaCode:t})=>(0,Cn._)`{pattern: ${t}}`},code(t){const{data:e,$data:r,schema:n,schemaCode:s,it:i}=t,o=i.opts.unicodeRegExp?"u":"",a=r?(0,Cn._)`(new RegExp(${s}, ${o}))`:(0,tm.usePattern)(t,n);t.fail$data((0,Cn._)`!${a}.test(${e})`)}};si.default=rm;var ii={};Object.defineProperty(ii,"__esModule",{value:!0});const Nr=Y,nm={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:{message({keyword:t,schemaCode:e}){const r=t==="maxProperties"?"more":"fewer";return(0,Nr.str)`must NOT have ${r} than ${e} properties`},params:({schemaCode:t})=>(0,Nr._)`{limit: ${t}}`},code(t){const{keyword:e,data:r,schemaCode:n}=t,s=e==="maxProperties"?Nr.operators.GT:Nr.operators.LT;t.fail$data((0,Nr._)`Object.keys(${r}).length ${s} ${n}`)}};ii.default=nm;var oi={};Object.defineProperty(oi,"__esModule",{value:!0});const Ar=Q,jr=Y,sm=x,im={keyword:"required",type:"object",schemaType:"array",$data:!0,error:{message:({params:{missingProperty:t}})=>(0,jr.str)`must have required property '${t}'`,params:({params:{missingProperty:t}})=>(0,jr._)`{missingProperty: ${t}}`},code(t){const{gen:e,schema:r,schemaCode:n,data:s,$data:i,it:o}=t,{opts:a}=o;if(!i&&r.length===0)return;const c=r.length>=a.loopRequired;if(o.allErrors?u():l(),a.strictRequired){const $=t.parentSchema.properties,{definedProperties:g}=t.it;for(const v of r)if(($==null?void 0:$[v])===void 0&&!g.has(v)){const p=o.schemaEnv.baseId+o.errSchemaPath,d=`required property "${v}" is not defined at "${p}" (strictRequired)`;(0,sm.checkStrictMode)(o,d,o.opts.strictRequired)}}function u(){if(c||i)t.block$data(jr.nil,f);else for(const $ of r)(0,Ar.checkReportMissingProp)(t,$)}function l(){const $=e.let("missing");if(c||i){const g=e.let("valid",!0);t.block$data(g,()=>w($,g)),t.ok(g)}else e.if((0,Ar.checkMissingProp)(t,r,$)),(0,Ar.reportMissingProp)(t,$),e.else()}function f(){e.forOf("prop",n,$=>{t.setParams({missingProperty:$}),e.if((0,Ar.noPropertyInData)(e,s,$,a.ownProperties),()=>t.error())})}function w($,g){t.setParams({missingProperty:$}),e.forOf($,n,()=>{e.assign(g,(0,Ar.propertyInData)(e,s,$,a.ownProperties)),e.if((0,jr.not)(g),()=>{t.error(),e.break()})},jr.nil)}}};oi.default=im;var ai={};Object.defineProperty(ai,"__esModule",{value:!0});const zr=Y,om={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:{message({keyword:t,schemaCode:e}){const r=t==="maxItems"?"more":"fewer";return(0,zr.str)`must NOT have ${r} than ${e} items`},params:({schemaCode:t})=>(0,zr._)`{limit: ${t}}`},code(t){const{keyword:e,data:r,schemaCode:n}=t,s=e==="maxItems"?zr.operators.GT:zr.operators.LT;t.fail$data((0,zr._)`${r}.length ${s} ${n}`)}};ai.default=om;var ci={},Mr={};Object.defineProperty(Mr,"__esModule",{value:!0});const jc=Ga;jc.code='require("ajv/dist/runtime/equal").default',Mr.default=jc,Object.defineProperty(ci,"__esModule",{value:!0});const ui=Te,Ae=Y,am=x,cm=Mr,um={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:{message:({params:{i:t,j:e}})=>(0,Ae.str)`must NOT have duplicate items (items ## ${e} and ${t} are identical)`,params:({params:{i:t,j:e}})=>(0,Ae._)`{i: ${t}, j: ${e}}`},code(t){const{gen:e,data:r,$data:n,schema:s,parentSchema:i,schemaCode:o,it:a}=t;if(!n&&!s)return;const c=e.let("valid"),u=i.items?(0,ui.getSchemaTypes)(i.items):[];t.block$data(c,l,(0,Ae._)`${o} === false`),t.ok(c);function l(){const g=e.let("i",(0,Ae._)`${r}.length`),v=e.let("j");t.setParams({i:g,j:v}),e.assign(c,!0),e.if((0,Ae._)`${g} > 1`,()=>(f()?w:$)(g,v))}function f(){return u.length>0&&!u.some(g=>g==="object"||g==="array")}function w(g,v){const p=e.name("item"),d=(0,ui.checkDataTypes)(u,p,a.opts.strictNumbers,ui.DataType.Wrong),m=e.const("indices",(0,Ae._)`{}`);e.for((0,Ae._)`;${g}--;`,()=>{e.let(p,(0,Ae._)`${r}[${g}]`),e.if(d,(0,Ae._)`continue`),u.length>1&&e.if((0,Ae._)`typeof ${p} == "string"`,(0,Ae._)`${p} += "_"`),e.if((0,Ae._)`typeof ${m}[${p}] == "number"`,()=>{e.assign(v,(0,Ae._)`${m}[${p}]`),t.error(),e.assign(c,!1).break()}).code((0,Ae._)`${m}[${p}] = ${g}`)})}function $(g,v){const p=(0,am.useFunc)(e,cm.default),d=e.name("outer");e.label(d).for((0,Ae._)`;${g}--;`,()=>e.for((0,Ae._)`${v} = ${g}; ${v}--;`,()=>e.if((0,Ae._)`${p}(${r}[${g}], ${r}[${v}])`,()=>{t.error(),e.assign(c,!1).break(d)})))}}};ci.default=um;var li={};Object.defineProperty(li,"__esModule",{value:!0});const di=Y,lm=x,dm=Mr,fm={keyword:"const",$data:!0,error:{message:"must be equal to constant",params:({schemaCode:t})=>(0,di._)`{allowedValue: ${t}}`},code(t){const{gen:e,data:r,$data:n,schemaCode:s,schema:i}=t;n||i&&typeof i=="object"?t.fail$data((0,di._)`!${(0,lm.useFunc)(e,dm.default)}(${r}, ${s})`):t.fail((0,di._)`${i} !== ${r}`)}};li.default=fm;var fi={};Object.defineProperty(fi,"__esModule",{value:!0});const Zr=Y,hm=x,pm=Mr,mm={keyword:"enum",schemaType:"array",$data:!0,error:{message:"must be equal to one of the allowed values",params:({schemaCode:t})=>(0,Zr._)`{allowedValues: ${t}}`},code(t){const{gen:e,data:r,$data:n,schema:s,schemaCode:i,it:o}=t;if(!n&&s.length===0)throw new Error("enum must have non-empty array");const a=s.length>=o.opts.loopEnum;let c;const u=()=>c??(c=(0,hm.useFunc)(e,pm.default));let l;if(a||n)l=e.let("valid"),t.block$data(l,f);else{if(!Array.isArray(s))throw new Error("ajv implementation error");const $=e.const("vSchema",i);l=(0,Zr.or)(...s.map((g,v)=>w($,v)))}t.pass(l);function f(){e.assign(l,!1),e.forOf("v",i,$=>e.if((0,Zr._)`${u()}(${r}, ${$})`,()=>e.assign(l,!0).break()))}function w($,g){const v=s[g];return typeof v=="object"&&v!==null?(0,Zr._)`${u()}(${r}, ${$}[${g}])`:(0,Zr._)`${r} === ${v}`}}};fi.default=mm,Object.defineProperty(Qs,"__esModule",{value:!0});const _m=ei,gm=ti,vm=ri,ym=si,bm=ii,wm=oi,$m=ai,Sm=ci,km=li,Em=fi,Pm=[_m.default,gm.default,vm.default,ym.default,bm.default,wm.default,$m.default,Sm.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},km.default,Em.default];Qs.default=Pm;var hi={},or={};Object.defineProperty(or,"__esModule",{value:!0}),or.validateAdditionalItems=void 0;const Ht=Y,pi=x,Rm={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:{message:({params:{len:t}})=>(0,Ht.str)`must NOT have more than ${t} items`,params:({params:{len:t}})=>(0,Ht._)`{limit: ${t}}`},code(t){const{parentSchema:e,it:r}=t,{items:n}=e;if(!Array.isArray(n)){(0,pi.checkStrictMode)(r,'"additionalItems" is ignored when "items" is not an array of schemas');return}zc(t,n)}};function zc(t,e){const{gen:r,schema:n,data:s,keyword:i,it:o}=t;o.items=!0;const a=r.const("len",(0,Ht._)`${s}.length`);if(n===!1)t.setParams({len:e.length}),t.pass((0,Ht._)`${a} <= ${e.length}`);else if(typeof n=="object"&&!(0,pi.alwaysValidSchema)(o,n)){const u=r.var("valid",(0,Ht._)`${a} <= ${e.length}`);r.if((0,Ht.not)(u),()=>c(u)),t.ok(u)}function c(u){r.forRange("i",e.length,a,l=>{t.subschema({keyword:i,dataProp:l,dataPropType:pi.Type.Num},u),o.allErrors||r.if((0,Ht.not)(u),()=>r.break())})}}or.validateAdditionalItems=zc,or.default=Rm;var mi={},ar={};Object.defineProperty(ar,"__esModule",{value:!0}),ar.validateTuple=void 0;const Mc=Y,On=x,Tm=Q,Cm={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(t){const{schema:e,it:r}=t;if(Array.isArray(e))return Zc(t,"additionalItems",e);r.items=!0,!(0,On.alwaysValidSchema)(r,e)&&t.ok((0,Tm.validateArray)(t))}};function Zc(t,e,r=t.schema){const{gen:n,parentSchema:s,data:i,keyword:o,it:a}=t;l(s),a.opts.unevaluated&&r.length&&a.items!==!0&&(a.items=On.mergeEvaluated.items(n,r.length,a.items));const c=n.name("valid"),u=n.const("len",(0,Mc._)`${i}.length`);r.forEach((f,w)=>{(0,On.alwaysValidSchema)(a,f)||(n.if((0,Mc._)`${u} > ${w}`,()=>t.subschema({keyword:o,schemaProp:w,dataProp:w},c)),t.ok(c))});function l(f){const{opts:w,errSchemaPath:$}=a,g=r.length,v=g===f.minItems&&(g===f.maxItems||f[e]===!1);if(w.strictTuples&&!v){const p=`"${o}" is ${g}-tuple, but minItems or maxItems/${e} are not specified or different at path "${$}"`;(0,On.checkStrictMode)(a,p,w.strictTuples)}}}ar.validateTuple=Zc,ar.default=Cm,Object.defineProperty(mi,"__esModule",{value:!0});const Om=ar,Im={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:t=>(0,Om.validateTuple)(t,"items")};mi.default=Im;var _i={};Object.defineProperty(_i,"__esModule",{value:!0});const xc=Y,Nm=x,Am=Q,jm=or,zm={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:{message:({params:{len:t}})=>(0,xc.str)`must NOT have more than ${t} items`,params:({params:{len:t}})=>(0,xc._)`{limit: ${t}}`},code(t){const{schema:e,parentSchema:r,it:n}=t,{prefixItems:s}=r;n.items=!0,!(0,Nm.alwaysValidSchema)(n,e)&&(s?(0,jm.validateAdditionalItems)(t,s):t.ok((0,Am.validateArray)(t)))}};_i.default=zm;var gi={};Object.defineProperty(gi,"__esModule",{value:!0});const Be=Y,In=x,Mm={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:{message:({params:{min:t,max:e}})=>e===void 0?(0,Be.str)`must contain at least ${t} valid item(s)`:(0,Be.str)`must contain at least ${t} and no more than ${e} valid item(s)`,params:({params:{min:t,max:e}})=>e===void 0?(0,Be._)`{minContains: ${t}}`:(0,Be._)`{minContains: ${t}, maxContains: ${e}}`},code(t){const{gen:e,schema:r,parentSchema:n,data:s,it:i}=t;let o,a;const{minContains:c,maxContains:u}=n;i.opts.next?(o=c===void 0?1:c,a=u):o=1;const l=e.const("len",(0,Be._)`${s}.length`);if(t.setParams({min:o,max:a}),a===void 0&&o===0){(0,In.checkStrictMode)(i,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(a!==void 0&&o>a){(0,In.checkStrictMode)(i,'"minContains" > "maxContains" is always invalid'),t.fail();return}if((0,In.alwaysValidSchema)(i,r)){let v=(0,Be._)`${l} >= ${o}`;a!==void 0&&(v=(0,Be._)`${v} && ${l} <= ${a}`),t.pass(v);return}i.items=!0;const f=e.name("valid");a===void 0&&o===1?$(f,()=>e.if(f,()=>e.break())):o===0?(e.let(f,!0),a!==void 0&&e.if((0,Be._)`${s}.length > 0`,w)):(e.let(f,!1),w()),t.result(f,()=>t.reset());function w(){const v=e.name("_valid"),p=e.let("count",0);$(v,()=>e.if(v,()=>g(p)))}function $(v,p){e.forRange("i",0,l,d=>{t.subschema({keyword:"contains",dataProp:d,dataPropType:In.Type.Num,compositeRule:!0},v),p()})}function g(v){e.code((0,Be._)`${v}++`),a===void 0?e.if((0,Be._)`${v} >= ${o}`,()=>e.assign(f,!0).break()):(e.if((0,Be._)`${v} > ${a}`,()=>e.assign(f,!1).break()),o===1?e.assign(f,!0):e.if((0,Be._)`${v} >= ${o}`,()=>e.assign(f,!0)))}}};gi.default=Mm;var Lc={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.validateSchemaDeps=t.validatePropertyDeps=t.error=void 0;const e=Y,r=x,n=Q;t.error={message:({params:{property:c,depsCount:u,deps:l}})=>{const f=u===1?"property":"properties";return(0,e.str)`must have ${f} ${l} when property ${c} is present`},params:({params:{property:c,depsCount:u,deps:l,missingProperty:f}})=>(0,e._)`{property: ${c},
|
|
6
|
-
missingProperty: ${f},
|
|
7
|
-
depsCount: ${u},
|
|
8
|
-
deps: ${l}}`};const s={keyword:"dependencies",type:"object",schemaType:"object",error:t.error,code(c){const[u,l]=i(c);o(c,u),a(c,l)}};function i({schema:c}){const u={},l={};for(const f in c){if(f==="__proto__")continue;const w=Array.isArray(c[f])?u:l;w[f]=c[f]}return[u,l]}function o(c,u=c.schema){const{gen:l,data:f,it:w}=c;if(Object.keys(u).length===0)return;const $=l.let("missing");for(const g in u){const v=u[g];if(v.length===0)continue;const p=(0,n.propertyInData)(l,f,g,w.opts.ownProperties);c.setParams({property:g,depsCount:v.length,deps:v.join(", ")}),w.allErrors?l.if(p,()=>{for(const d of v)(0,n.checkReportMissingProp)(c,d)}):(l.if((0,e._)`${p} && (${(0,n.checkMissingProp)(c,v,$)})`),(0,n.reportMissingProp)(c,$),l.else())}}t.validatePropertyDeps=o;function a(c,u=c.schema){const{gen:l,data:f,keyword:w,it:$}=c,g=l.name("valid");for(const v in u)(0,r.alwaysValidSchema)($,u[v])||(l.if((0,n.propertyInData)(l,f,v,$.opts.ownProperties),()=>{const p=c.subschema({keyword:w,schemaProp:v},g);c.mergeValidEvaluated(p,g)},()=>l.var(g,!0)),c.ok(g))}t.validateSchemaDeps=a,t.default=s})(Lc);var vi={};Object.defineProperty(vi,"__esModule",{value:!0});const Uc=Y,Zm=x,xm={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:{message:"property name must be valid",params:({params:t})=>(0,Uc._)`{propertyName: ${t.propertyName}}`},code(t){const{gen:e,schema:r,data:n,it:s}=t;if((0,Zm.alwaysValidSchema)(s,r))return;const i=e.name("valid");e.forIn("key",n,o=>{t.setParams({propertyName:o}),t.subschema({keyword:"propertyNames",data:o,dataTypes:["string"],propertyName:o,compositeRule:!0},i),e.if((0,Uc.not)(i),()=>{t.error(!0),s.allErrors||e.break()})}),t.ok(i)}};vi.default=xm;var Nn={};Object.defineProperty(Nn,"__esModule",{value:!0});const An=Q,rt=Y,Lm=lt,jn=x,Um={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:{message:"must NOT have additional properties",params:({params:t})=>(0,rt._)`{additionalProperty: ${t.additionalProperty}}`},code(t){const{gen:e,schema:r,parentSchema:n,data:s,errsCount:i,it:o}=t;if(!i)throw new Error("ajv implementation error");const{allErrors:a,opts:c}=o;if(o.props=!0,c.removeAdditional!=="all"&&(0,jn.alwaysValidSchema)(o,r))return;const u=(0,An.allSchemaProperties)(n.properties),l=(0,An.allSchemaProperties)(n.patternProperties);f(),t.ok((0,rt._)`${i} === ${Lm.default.errors}`);function f(){e.forIn("key",s,p=>{!u.length&&!l.length?g(p):e.if(w(p),()=>g(p))})}function w(p){let d;if(u.length>8){const m=(0,jn.schemaRefOrVal)(o,n.properties,"properties");d=(0,An.isOwnProperty)(e,m,p)}else u.length?d=(0,rt.or)(...u.map(m=>(0,rt._)`${p} === ${m}`)):d=rt.nil;return l.length&&(d=(0,rt.or)(d,...l.map(m=>(0,rt._)`${(0,An.usePattern)(t,m)}.test(${p})`))),(0,rt.not)(d)}function $(p){e.code((0,rt._)`delete ${s}[${p}]`)}function g(p){if(c.removeAdditional==="all"||c.removeAdditional&&r===!1){$(p);return}if(r===!1){t.setParams({additionalProperty:p}),t.error(),a||e.break();return}if(typeof r=="object"&&!(0,jn.alwaysValidSchema)(o,r)){const d=e.name("valid");c.removeAdditional==="failing"?(v(p,d,!1),e.if((0,rt.not)(d),()=>{t.reset(),$(p)})):(v(p,d),a||e.if((0,rt.not)(d),()=>e.break()))}}function v(p,d,m){const S={keyword:"additionalProperties",dataProp:p,dataPropType:jn.Type.Str};m===!1&&Object.assign(S,{compositeRule:!0,createErrors:!1,allErrors:!1}),t.subschema(S,d)}}};Nn.default=Um;var yi={};Object.defineProperty(yi,"__esModule",{value:!0});const Dm=Qe,Dc=Q,bi=x,qc=Nn,qm={keyword:"properties",type:"object",schemaType:"object",code(t){const{gen:e,schema:r,parentSchema:n,data:s,it:i}=t;i.opts.removeAdditional==="all"&&n.additionalProperties===void 0&&qc.default.code(new Dm.KeywordCxt(i,qc.default,"additionalProperties"));const o=(0,Dc.allSchemaProperties)(r);for(const f of o)i.definedProperties.add(f);i.opts.unevaluated&&o.length&&i.props!==!0&&(i.props=bi.mergeEvaluated.props(e,(0,bi.toHash)(o),i.props));const a=o.filter(f=>!(0,bi.alwaysValidSchema)(i,r[f]));if(a.length===0)return;const c=e.name("valid");for(const f of a)u(f)?l(f):(e.if((0,Dc.propertyInData)(e,s,f,i.opts.ownProperties)),l(f),i.allErrors||e.else().var(c,!0),e.endIf()),t.it.definedProperties.add(f),t.ok(c);function u(f){return i.opts.useDefaults&&!i.compositeRule&&r[f].default!==void 0}function l(f){t.subschema({keyword:"properties",schemaProp:f,dataProp:f},c)}}};yi.default=qm;var wi={};Object.defineProperty(wi,"__esModule",{value:!0});const Vc=Q,zn=Y,Fc=x,Hc=x,Vm={keyword:"patternProperties",type:"object",schemaType:"object",code(t){const{gen:e,schema:r,data:n,parentSchema:s,it:i}=t,{opts:o}=i,a=(0,Vc.allSchemaProperties)(r),c=a.filter(v=>(0,Fc.alwaysValidSchema)(i,r[v]));if(a.length===0||c.length===a.length&&(!i.opts.unevaluated||i.props===!0))return;const u=o.strictSchema&&!o.allowMatchingProperties&&s.properties,l=e.name("valid");i.props!==!0&&!(i.props instanceof zn.Name)&&(i.props=(0,Hc.evaluatedPropsToName)(e,i.props));const{props:f}=i;w();function w(){for(const v of a)u&&$(v),i.allErrors?g(v):(e.var(l,!0),g(v),e.if(l))}function $(v){for(const p in u)new RegExp(v).test(p)&&(0,Fc.checkStrictMode)(i,`property ${p} matches pattern ${v} (use allowMatchingProperties)`)}function g(v){e.forIn("key",n,p=>{e.if((0,zn._)`${(0,Vc.usePattern)(t,v)}.test(${p})`,()=>{const d=c.includes(v);d||t.subschema({keyword:"patternProperties",schemaProp:v,dataProp:p,dataPropType:Hc.Type.Str},l),i.opts.unevaluated&&f!==!0?e.assign((0,zn._)`${f}[${p}]`,!0):!d&&!i.allErrors&&e.if((0,zn.not)(l),()=>e.break())})})}}};wi.default=Vm;var $i={};Object.defineProperty($i,"__esModule",{value:!0});const Fm=x,Hm={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(t){const{gen:e,schema:r,it:n}=t;if((0,Fm.alwaysValidSchema)(n,r)){t.fail();return}const s=e.name("valid");t.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},s),t.failResult(s,()=>t.reset(),()=>t.error())},error:{message:"must NOT be valid"}};$i.default=Hm;var Si={};Object.defineProperty(Si,"__esModule",{value:!0});const Wm={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:Q.validateUnion,error:{message:"must match a schema in anyOf"}};Si.default=Wm;var ki={};Object.defineProperty(ki,"__esModule",{value:!0});const Mn=Y,Km=x,Jm={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:{message:"must match exactly one schema in oneOf",params:({params:t})=>(0,Mn._)`{passingSchemas: ${t.passing}}`},code(t){const{gen:e,schema:r,parentSchema:n,it:s}=t;if(!Array.isArray(r))throw new Error("ajv implementation error");if(s.opts.discriminator&&n.discriminator)return;const i=r,o=e.let("valid",!1),a=e.let("passing",null),c=e.name("_valid");t.setParams({passing:a}),e.block(u),t.result(o,()=>t.reset(),()=>t.error(!0));function u(){i.forEach((l,f)=>{let w;(0,Km.alwaysValidSchema)(s,l)?e.var(c,!0):w=t.subschema({keyword:"oneOf",schemaProp:f,compositeRule:!0},c),f>0&&e.if((0,Mn._)`${c} && ${o}`).assign(o,!1).assign(a,(0,Mn._)`[${a}, ${f}]`).else(),e.if(c,()=>{e.assign(o,!0),e.assign(a,f),w&&t.mergeEvaluated(w,Mn.Name)})})}}};ki.default=Jm;var Ei={};Object.defineProperty(Ei,"__esModule",{value:!0});const Bm=x,Gm={keyword:"allOf",schemaType:"array",code(t){const{gen:e,schema:r,it:n}=t;if(!Array.isArray(r))throw new Error("ajv implementation error");const s=e.name("valid");r.forEach((i,o)=>{if((0,Bm.alwaysValidSchema)(n,i))return;const a=t.subschema({keyword:"allOf",schemaProp:o},s);t.ok(s),t.mergeEvaluated(a)})}};Ei.default=Gm;var Pi={};Object.defineProperty(Pi,"__esModule",{value:!0});const Zn=Y,Wc=x,Ym={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:{message:({params:t})=>(0,Zn.str)`must match "${t.ifClause}" schema`,params:({params:t})=>(0,Zn._)`{failingKeyword: ${t.ifClause}}`},code(t){const{gen:e,parentSchema:r,it:n}=t;r.then===void 0&&r.else===void 0&&(0,Wc.checkStrictMode)(n,'"if" without "then" and "else" is ignored');const s=Kc(n,"then"),i=Kc(n,"else");if(!s&&!i)return;const o=e.let("valid",!0),a=e.name("_valid");if(c(),t.reset(),s&&i){const l=e.let("ifClause");t.setParams({ifClause:l}),e.if(a,u("then",l),u("else",l))}else s?e.if(a,u("then")):e.if((0,Zn.not)(a),u("else"));t.pass(o,()=>t.error(!0));function c(){const l=t.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},a);t.mergeEvaluated(l)}function u(l,f){return()=>{const w=t.subschema({keyword:l},a);e.assign(o,a),t.mergeValidEvaluated(w,o),f?e.assign(f,(0,Zn._)`${l}`):t.setParams({ifClause:l})}}}};function Kc(t,e){const r=t.schema[e];return r!==void 0&&!(0,Wc.alwaysValidSchema)(t,r)}Pi.default=Ym;var Ri={};Object.defineProperty(Ri,"__esModule",{value:!0});const Xm=x,Qm={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:t,parentSchema:e,it:r}){e.if===void 0&&(0,Xm.checkStrictMode)(r,`"${t}" without "if" is ignored`)}};Ri.default=Qm,Object.defineProperty(hi,"__esModule",{value:!0});const e_=or,t_=mi,r_=ar,n_=_i,s_=gi,i_=Lc,o_=vi,a_=Nn,c_=yi,u_=wi,l_=$i,d_=Si,f_=ki,h_=Ei,p_=Pi,m_=Ri;function __(t=!1){const e=[l_.default,d_.default,f_.default,h_.default,p_.default,m_.default,o_.default,a_.default,i_.default,c_.default,u_.default];return t?e.push(t_.default,n_.default):e.push(e_.default,r_.default),e.push(s_.default),e}hi.default=__;var Ti={},Ci={};Object.defineProperty(Ci,"__esModule",{value:!0});const ke=Y,g_={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:{message:({schemaCode:t})=>(0,ke.str)`must match format "${t}"`,params:({schemaCode:t})=>(0,ke._)`{format: ${t}}`},code(t,e){const{gen:r,data:n,$data:s,schema:i,schemaCode:o,it:a}=t,{opts:c,errSchemaPath:u,schemaEnv:l,self:f}=a;if(!c.validateFormats)return;s?w():$();function w(){const g=r.scopeValue("formats",{ref:f.formats,code:c.code.formats}),v=r.const("fDef",(0,ke._)`${g}[${o}]`),p=r.let("fType"),d=r.let("format");r.if((0,ke._)`typeof ${v} == "object" && !(${v} instanceof RegExp)`,()=>r.assign(p,(0,ke._)`${v}.type || "string"`).assign(d,(0,ke._)`${v}.validate`),()=>r.assign(p,(0,ke._)`"string"`).assign(d,v)),t.fail$data((0,ke.or)(m(),S()));function m(){return c.strictSchema===!1?ke.nil:(0,ke._)`${o} && !${d}`}function S(){const E=l.$async?(0,ke._)`(${v}.async ? await ${d}(${n}) : ${d}(${n}))`:(0,ke._)`${d}(${n})`,C=(0,ke._)`(typeof ${d} == "function" ? ${E} : ${d}.test(${n}))`;return(0,ke._)`${d} && ${d} !== true && ${p} === ${e} && !${C}`}}function $(){const g=f.formats[i];if(!g){m();return}if(g===!0)return;const[v,p,d]=S(g);v===e&&t.pass(E());function m(){if(c.strictSchema===!1){f.logger.warn(C());return}throw new Error(C());function C(){return`unknown format "${i}" ignored in schema at path "${u}"`}}function S(C){const z=C instanceof RegExp?(0,ke.regexpCode)(C):c.code.formats?(0,ke._)`${c.code.formats}${(0,ke.getProperty)(i)}`:void 0,B=r.scopeValue("formats",{key:i,ref:C,code:z});return typeof C=="object"&&!(C instanceof RegExp)?[C.type||"string",C.validate,(0,ke._)`${B}.validate`]:["string",C,B]}function E(){if(typeof g=="object"&&!(g instanceof RegExp)&&g.async){if(!l.$async)throw new Error("async format in sync schema");return(0,ke._)`await ${d}(${n})`}return typeof p=="function"?(0,ke._)`${d}(${n})`:(0,ke._)`${d}.test(${n})`}}}};Ci.default=g_,Object.defineProperty(Ti,"__esModule",{value:!0});const v_=[Ci.default];Ti.default=v_;var cr={};Object.defineProperty(cr,"__esModule",{value:!0}),cr.contentVocabulary=cr.metadataVocabulary=void 0,cr.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"],cr.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"],Object.defineProperty(Gs,"__esModule",{value:!0});const y_=Ys,b_=Qs,w_=hi,$_=Ti,Jc=cr,S_=[y_.default,b_.default,(0,w_.default)(),$_.default,Jc.metadataVocabulary,Jc.contentVocabulary];Gs.default=S_;var Oi={},xn={};Object.defineProperty(xn,"__esModule",{value:!0}),xn.DiscrError=void 0;var Bc;(function(t){t.Tag="tag",t.Mapping="mapping"})(Bc||(xn.DiscrError=Bc={})),Object.defineProperty(Oi,"__esModule",{value:!0});const ur=Y,Ii=xn,Gc=qe,k_=sr,E_=x,P_={keyword:"discriminator",type:"object",schemaType:"object",error:{message:({params:{discrError:t,tagName:e}})=>t===Ii.DiscrError.Tag?`tag "${e}" must be string`:`value of tag "${e}" must be in oneOf`,params:({params:{discrError:t,tag:e,tagName:r}})=>(0,ur._)`{error: ${t}, tag: ${r}, tagValue: ${e}}`},code(t){const{gen:e,data:r,schema:n,parentSchema:s,it:i}=t,{oneOf:o}=s;if(!i.opts.discriminator)throw new Error("discriminator: requires discriminator option");const a=n.propertyName;if(typeof a!="string")throw new Error("discriminator: requires propertyName");if(n.mapping)throw new Error("discriminator: mapping is not supported");if(!o)throw new Error("discriminator: requires oneOf keyword");const c=e.let("valid",!1),u=e.const("tag",(0,ur._)`${r}${(0,ur.getProperty)(a)}`);e.if((0,ur._)`typeof ${u} == "string"`,()=>l(),()=>t.error(!1,{discrError:Ii.DiscrError.Tag,tag:u,tagName:a})),t.ok(c);function l(){const $=w();e.if(!1);for(const g in $)e.elseIf((0,ur._)`${u} === ${g}`),e.assign(c,f($[g]));e.else(),t.error(!1,{discrError:Ii.DiscrError.Mapping,tag:u,tagName:a}),e.endIf()}function f($){const g=e.name("valid"),v=t.subschema({keyword:"oneOf",schemaProp:$},g);return t.mergeEvaluated(v,ur.Name),g}function w(){var $;const g={},v=d(s);let p=!0;for(let E=0;E<o.length;E++){let C=o[E];if(C!=null&&C.$ref&&!(0,E_.schemaHasRulesButRef)(C,i.self.RULES)){const B=C.$ref;if(C=Gc.resolveRef.call(i.self,i.schemaEnv.root,i.baseId,B),C instanceof Gc.SchemaEnv&&(C=C.schema),C===void 0)throw new k_.default(i.opts.uriResolver,i.baseId,B)}const z=($=C==null?void 0:C.properties)===null||$===void 0?void 0:$[a];if(typeof z!="object")throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${a}"`);p=p&&(v||d(C)),m(z,E)}if(!p)throw new Error(`discriminator: "${a}" must be required`);return g;function d({required:E}){return Array.isArray(E)&&E.includes(a)}function m(E,C){if(E.const)S(E.const,C);else if(E.enum)for(const z of E.enum)S(z,C);else throw new Error(`discriminator: "properties/${a}" must have "const" or "enum"`)}function S(E,C){if(typeof E!="string"||E in g)throw new Error(`discriminator: "${a}" values must be unique strings`);g[E]=C}}}};Oi.default=P_;const R_={$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};(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=Oa,n=Gs,s=Oi,i=R_,o=["/properties"],a="http://json-schema.org/draft-07/schema";class c extends r.default{_addVocabularies(){super._addVocabularies(),n.default.forEach(g=>this.addVocabulary(g)),this.opts.discriminator&&this.addKeyword(s.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;const g=this.opts.$data?this.$dataMetaSchema(i,o):i;this.addMetaSchema(g,a,!1),this.refs["http://json-schema.org/schema"]=a}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(a)?a:void 0)}}e.Ajv=c,t.exports=e=c,t.exports.Ajv=c,Object.defineProperty(e,"__esModule",{value:!0}),e.default=c;var u=Qe;Object.defineProperty(e,"KeywordCxt",{enumerable:!0,get:function(){return u.KeywordCxt}});var l=Y;Object.defineProperty(e,"_",{enumerable:!0,get:function(){return l._}}),Object.defineProperty(e,"str",{enumerable:!0,get:function(){return l.str}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return l.stringify}}),Object.defineProperty(e,"nil",{enumerable:!0,get:function(){return l.nil}}),Object.defineProperty(e,"Name",{enumerable:!0,get:function(){return l.Name}}),Object.defineProperty(e,"CodeGen",{enumerable:!0,get:function(){return l.CodeGen}});var f=Cr;Object.defineProperty(e,"ValidationError",{enumerable:!0,get:function(){return f.default}});var w=sr;Object.defineProperty(e,"MissingRefError",{enumerable:!0,get:function(){return w.default}})})(Cs,Cs.exports);var Ni=Cs.exports;const T_=Qt(Ni),C_=Object.freeze({status:"aborted"});function R(t,e,r){function n(a,c){var u;Object.defineProperty(a,"_zod",{value:a._zod??{},enumerable:!1}),(u=a._zod).traits??(u.traits=new Set),a._zod.traits.add(t),e(a,c);for(const l in o.prototype)l in a||Object.defineProperty(a,l,{value:o.prototype[l].bind(a)});a._zod.constr=o,a._zod.def=c}const s=(r==null?void 0:r.Parent)??Object;class i extends s{}Object.defineProperty(i,"name",{value:t});function o(a){var c;const u=r!=null&&r.Parent?new i:this;n(u,a),(c=u._zod).deferred??(c.deferred=[]);for(const l of u._zod.deferred)l();return u}return Object.defineProperty(o,"init",{value:n}),Object.defineProperty(o,Symbol.hasInstance,{value:a=>{var c,u;return r!=null&&r.Parent&&a instanceof r.Parent?!0:(u=(c=a==null?void 0:a._zod)==null?void 0:c.traits)==null?void 0:u.has(t)}}),Object.defineProperty(o,"name",{value:t}),o}class xr extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}const Yc={};function Ct(t){return Yc}function Xc(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 O_(t,e){return typeof e=="bigint"?e.toString():e}function Ai(t){return{get value(){{const e=t();return Object.defineProperty(this,"value",{value:e}),e}}}}function ji(t){return t==null}function zi(t){const e=t.startsWith("^")?1:0,r=t.endsWith("$")?t.length-1:t.length;return t.slice(e,r)}function I_(t,e){const r=(t.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,s=r>n?r:n,i=Number.parseInt(t.toFixed(s).replace(".","")),o=Number.parseInt(e.toFixed(s).replace(".",""));return i%o/10**s}function fe(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 Lr(t,e,r){Object.defineProperty(t,e,{value:r,writable:!0,enumerable:!0,configurable:!0})}function Ur(t){return JSON.stringify(t)}const Qc=Error.captureStackTrace?Error.captureStackTrace:(...t)=>{};function Ln(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}const N_=Ai(()=>{var t;if(typeof navigator<"u"&&((t=navigator==null?void 0:navigator.userAgent)!=null&&t.includes("Cloudflare")))return!1;try{const e=Function;return new e(""),!0}catch{return!1}});function Un(t){if(Ln(t)===!1)return!1;const e=t.constructor;if(e===void 0)return!0;const r=e.prototype;return!(Ln(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}const A_=new Set(["string","number","symbol"]);function Dr(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Ot(t,e,r){const n=new t._zod.constr(e??t._zod.def);return(!e||r!=null&&r.parent)&&(n._zod.parent=t),n}function D(t){const e=t;if(!e)return{};if(typeof e=="string")return{error:()=>e};if((e==null?void 0:e.message)!==void 0){if((e==null?void 0: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 j_(t){return Object.keys(t).filter(e=>t[e]._zod.optin==="optional"&&t[e]._zod.optout==="optional")}const z_={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 M_(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 Ot(t,{...t._zod.def,shape:r,checks:[]})}function Z_(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 Ot(t,{...t._zod.def,shape:r,checks:[]})}function x_(t,e){if(!Un(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 Lr(this,"shape",n),n},checks:[]};return Ot(t,r)}function L_(t,e){return Ot(t,{...t._zod.def,get shape(){const r={...t._zod.def.shape,...e._zod.def.shape};return Lr(this,"shape",r),r},catchall:e._zod.def.catchall,checks:[]})}function U_(t,e,r){const n=e._zod.def.shape,s={...n};if(r)for(const i in r){if(!(i in n))throw new Error(`Unrecognized key: "${i}"`);r[i]&&(s[i]=t?new t({type:"optional",innerType:n[i]}):n[i])}else for(const i in n)s[i]=t?new t({type:"optional",innerType:n[i]}):n[i];return Ot(e,{...e._zod.def,shape:s,checks:[]})}function D_(t,e,r){const n=e._zod.def.shape,s={...n};if(r)for(const i in r){if(!(i in s))throw new Error(`Unrecognized key: "${i}"`);r[i]&&(s[i]=new t({type:"nonoptional",innerType:n[i]}))}else for(const i in n)s[i]=new t({type:"nonoptional",innerType:n[i]});return Ot(e,{...e._zod.def,shape:s,checks:[]})}function qr(t,e=0){var r;for(let n=e;n<t.issues.length;n++)if(((r=t.issues[n])==null?void 0:r.continue)!==!0)return!0;return!1}function Wt(t,e){return e.map(r=>{var n;return(n=r).path??(n.path=[]),r.path.unshift(t),r})}function Dn(t){return typeof t=="string"?t:t==null?void 0:t.message}function It(t,e,r){var s,i,o,a,c,u;const n={...t,path:t.path??[]};if(!t.message){const l=Dn((o=(i=(s=t.inst)==null?void 0:s._zod.def)==null?void 0:i.error)==null?void 0:o.call(i,t))??Dn((a=e==null?void 0:e.error)==null?void 0:a.call(e,t))??Dn((c=r.customError)==null?void 0:c.call(r,t))??Dn((u=r.localeError)==null?void 0:u.call(r,t))??"Invalid input";n.message=l}return delete n.inst,delete n.continue,e!=null&&e.reportInput||delete n.input,n}function Mi(t){return Array.isArray(t)?"array":typeof t=="string"?"string":"unknown"}function Vr(...t){const[e,r,n]=t;return typeof e=="string"?{message:e,code:"custom",input:r,inst:n}:{...e}}const eu=(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,O_,2)},enumerable:!0}),Object.defineProperty(t,"toString",{value:()=>t.message,enumerable:!1})},tu=R("$ZodError",eu),qn=R("$ZodError",eu,{Parent:Error});function q_(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 V_(t,e){const r=e||function(i){return i.message},n={_errors:[]},s=i=>{for(const o of i.issues)if(o.code==="invalid_union"&&o.errors.length)o.errors.map(a=>s({issues:a}));else if(o.code==="invalid_key")s({issues:o.issues});else if(o.code==="invalid_element")s({issues:o.issues});else if(o.path.length===0)n._errors.push(r(o));else{let a=n,c=0;for(;c<o.path.length;){const u=o.path[c];c===o.path.length-1?(a[u]=a[u]||{_errors:[]},a[u]._errors.push(r(o))):a[u]=a[u]||{_errors:[]},a=a[u],c++}}};return s(t),n}const ru=t=>(e,r,n,s)=>{const i=n?Object.assign(n,{async:!1}):{async:!1},o=e._zod.run({value:r,issues:[]},i);if(o instanceof Promise)throw new xr;if(o.issues.length){const a=new((s==null?void 0:s.Err)??t)(o.issues.map(c=>It(c,i,Ct())));throw Qc(a,s==null?void 0:s.callee),a}return o.value},F_=ru(qn),nu=t=>async(e,r,n,s)=>{const i=n?Object.assign(n,{async:!0}):{async:!0};let o=e._zod.run({value:r,issues:[]},i);if(o instanceof Promise&&(o=await o),o.issues.length){const a=new((s==null?void 0:s.Err)??t)(o.issues.map(c=>It(c,i,Ct())));throw Qc(a,s==null?void 0:s.callee),a}return o.value},H_=nu(qn),su=t=>(e,r,n)=>{const s=n?{...n,async:!1}:{async:!1},i=e._zod.run({value:r,issues:[]},s);if(i instanceof Promise)throw new xr;return i.issues.length?{success:!1,error:new(t??tu)(i.issues.map(o=>It(o,s,Ct())))}:{success:!0,data:i.value}},Zi=su(qn),iu=t=>async(e,r,n)=>{const s=n?Object.assign(n,{async:!0}):{async:!0};let i=e._zod.run({value:r,issues:[]},s);return i instanceof Promise&&(i=await i),i.issues.length?{success:!1,error:new t(i.issues.map(o=>It(o,s,Ct())))}:{success:!0,data:i.value}},xi=iu(qn),W_=/^[cC][^\s-]{8,}$/,K_=/^[0-9a-z]+$/,J_=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,B_=/^[0-9a-vA-V]{20}$/,G_=/^[A-Za-z0-9]{27}$/,Y_=/^[a-zA-Z0-9_-]{21}$/,X_=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Q_=/^([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})$/,ou=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)$/,eg=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,tg="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function rg(){return new RegExp(tg,"u")}const ng=/^(?:(?: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])$/,sg=/^(([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})$/,ig=/^((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])$/,og=/^(([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])$/,ag=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,au=/^[A-Za-z0-9_-]*$/,cg=/^([a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+$/,ug=/^\+(?:[0-9]){6,14}[0-9]$/,cu="(?:(?:\\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])))",lg=new RegExp(`^${cu}$`);function uu(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 dg(t){return new RegExp(`^${uu(t)}$`)}function fg(t){const e=uu({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(`^${cu}T(?:${n})$`)}const hg=t=>{const e=t?`[\\s\\S]{${(t==null?void 0:t.minimum)??0},${(t==null?void 0:t.maximum)??""}}`:"[\\s\\S]*";return new RegExp(`^${e}$`)},pg=/^\d+$/,mg=/^-?\d+(?:\.\d+)?/i,_g=/true|false/i,gg=/^[^A-Z]*$/,vg=/^[^a-z]*$/,Fe=R("$ZodCheck",(t,e)=>{var r;t._zod??(t._zod={}),t._zod.def=e,(r=t._zod).onattach??(r.onattach=[])}),lu={number:"number",bigint:"bigint",object:"date"},du=R("$ZodCheckLessThan",(t,e)=>{Fe.init(t,e);const r=lu[typeof e.value];t._zod.onattach.push(n=>{const s=n._zod.bag,i=(e.inclusive?s.maximum:s.exclusiveMaximum)??Number.POSITIVE_INFINITY;e.value<i&&(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})}}),fu=R("$ZodCheckGreaterThan",(t,e)=>{Fe.init(t,e);const r=lu[typeof e.value];t._zod.onattach.push(n=>{const s=n._zod.bag,i=(e.inclusive?s.minimum:s.exclusiveMinimum)??Number.NEGATIVE_INFINITY;e.value>i&&(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})}}),yg=R("$ZodCheckMultipleOf",(t,e)=>{Fe.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):I_(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})}}),bg=R("$ZodCheckNumberFormat",(t,e)=>{var o;Fe.init(t,e),e.format=e.format||"float64";const r=(o=e.format)==null?void 0:o.includes("int"),n=r?"int":"number",[s,i]=z_[e.format];t._zod.onattach.push(a=>{const c=a._zod.bag;c.format=e.format,c.minimum=s,c.maximum=i,r&&(c.pattern=pg)}),t._zod.check=a=>{const c=a.value;if(r){if(!Number.isInteger(c)){a.issues.push({expected:n,format:e.format,code:"invalid_type",input:c,inst:t});return}if(!Number.isSafeInteger(c)){c>0?a.issues.push({input:c,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:t,origin:n,continue:!e.abort}):a.issues.push({input:c,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}}c<s&&a.issues.push({origin:"number",input:c,code:"too_small",minimum:s,inclusive:!0,inst:t,continue:!e.abort}),c>i&&a.issues.push({origin:"number",input:c,code:"too_big",maximum:i,inst:t})}}),wg=R("$ZodCheckMaxLength",(t,e)=>{var r;Fe.init(t,e),(r=t._zod.def).when??(r.when=n=>{const s=n.value;return!ji(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 o=Mi(s);n.issues.push({origin:o,code:"too_big",maximum:e.maximum,inclusive:!0,input:s,inst:t,continue:!e.abort})}}),$g=R("$ZodCheckMinLength",(t,e)=>{var r;Fe.init(t,e),(r=t._zod.def).when??(r.when=n=>{const s=n.value;return!ji(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 o=Mi(s);n.issues.push({origin:o,code:"too_small",minimum:e.minimum,inclusive:!0,input:s,inst:t,continue:!e.abort})}}),Sg=R("$ZodCheckLengthEquals",(t,e)=>{var r;Fe.init(t,e),(r=t._zod.def).when??(r.when=n=>{const s=n.value;return!ji(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,i=s.length;if(i===e.length)return;const o=Mi(s),a=i>e.length;n.issues.push({origin:o,...a?{code:"too_big",maximum:e.length}:{code:"too_small",minimum:e.length},inclusive:!0,exact:!0,input:n.value,inst:t,continue:!e.abort})}}),Vn=R("$ZodCheckStringFormat",(t,e)=>{var r,n;Fe.init(t,e),t._zod.onattach.push(s=>{const i=s._zod.bag;i.format=e.format,e.pattern&&(i.patterns??(i.patterns=new Set),i.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=()=>{})}),kg=R("$ZodCheckRegex",(t,e)=>{Vn.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})}}),Eg=R("$ZodCheckLowerCase",(t,e)=>{e.pattern??(e.pattern=gg),Vn.init(t,e)}),Pg=R("$ZodCheckUpperCase",(t,e)=>{e.pattern??(e.pattern=vg),Vn.init(t,e)}),Rg=R("$ZodCheckIncludes",(t,e)=>{Fe.init(t,e);const r=Dr(e.includes),n=new RegExp(typeof e.position=="number"?`^.{${e.position}}${r}`:r);e.pattern=n,t._zod.onattach.push(s=>{const i=s._zod.bag;i.patterns??(i.patterns=new Set),i.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})}}),Tg=R("$ZodCheckStartsWith",(t,e)=>{Fe.init(t,e);const r=new RegExp(`^${Dr(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})}}),Cg=R("$ZodCheckEndsWith",(t,e)=>{Fe.init(t,e);const r=new RegExp(`.*${Dr(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})}}),Og=R("$ZodCheckOverwrite",(t,e)=>{Fe.init(t,e),t._zod.check=r=>{r.value=e.tx(r.value)}});class Ig{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(o=>o),s=Math.min(...n.map(o=>o.length-o.trimStart().length)),i=n.map(o=>o.slice(s)).map(o=>" ".repeat(this.indent*2)+o);for(const o of i)this.content.push(o)}compile(){const e=Function,r=this==null?void 0:this.args,s=[...((this==null?void 0:this.content)??[""]).map(i=>` ${i}`)];return new e(...r,s.join(`
|
|
10
|
-
`))}}const Ng={major:4,minor:0,patch:0},he=R("$ZodType",(t,e)=>{var s;var r;t??(t={}),t._zod.def=e,t._zod.bag=t._zod.bag||{},t._zod.version=Ng;const n=[...t._zod.def.checks??[]];t._zod.traits.has("$ZodCheck")&&n.unshift(t);for(const i of n)for(const o of i._zod.onattach)o(t);if(n.length===0)(r=t._zod).deferred??(r.deferred=[]),(s=t._zod.deferred)==null||s.push(()=>{t._zod.run=t._zod.parse});else{const i=(o,a,c)=>{let u=qr(o),l;for(const f of a){if(f._zod.def.when){if(!f._zod.def.when(o))continue}else if(u)continue;const w=o.issues.length,$=f._zod.check(o);if($ instanceof Promise&&(c==null?void 0:c.async)===!1)throw new xr;if(l||$ instanceof Promise)l=(l??Promise.resolve()).then(async()=>{await $,o.issues.length!==w&&(u||(u=qr(o,w)))});else{if(o.issues.length===w)continue;u||(u=qr(o,w))}}return l?l.then(()=>o):o};t._zod.run=(o,a)=>{const c=t._zod.parse(o,a);if(c instanceof Promise){if(a.async===!1)throw new xr;return c.then(u=>i(u,n,a))}return i(c,n,a)}}t["~standard"]={validate:i=>{var o;try{const a=Zi(t,i);return a.success?{value:a.data}:{issues:(o=a.error)==null?void 0:o.issues}}catch{return xi(t,i).then(c=>{var u;return c.success?{value:c.data}:{issues:(u=c.error)==null?void 0:u.issues}})}},vendor:"zod",version:1}}),Li=R("$ZodString",(t,e)=>{var r;he.init(t,e),t._zod.pattern=[...((r=t==null?void 0:t._zod.bag)==null?void 0:r.patterns)??[]].pop()??hg(t._zod.bag),t._zod.parse=(n,s)=>{if(e.coerce)try{n.value=String(n.value)}catch{}return typeof n.value=="string"||n.issues.push({expected:"string",code:"invalid_type",input:n.value,inst:t}),n}}),me=R("$ZodStringFormat",(t,e)=>{Vn.init(t,e),Li.init(t,e)}),Ag=R("$ZodGUID",(t,e)=>{e.pattern??(e.pattern=Q_),me.init(t,e)}),jg=R("$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=ou(n))}else e.pattern??(e.pattern=ou());me.init(t,e)}),zg=R("$ZodEmail",(t,e)=>{e.pattern??(e.pattern=eg),me.init(t,e)}),Mg=R("$ZodURL",(t,e)=>{me.init(t,e),t._zod.check=r=>{try{const n=r.value,s=new URL(n),i=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:cg.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("/")&&i.endsWith("/")?r.value=i.slice(0,-1):r.value=i;return}catch{r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:t,continue:!e.abort})}}}),Zg=R("$ZodEmoji",(t,e)=>{e.pattern??(e.pattern=rg()),me.init(t,e)}),xg=R("$ZodNanoID",(t,e)=>{e.pattern??(e.pattern=Y_),me.init(t,e)}),Lg=R("$ZodCUID",(t,e)=>{e.pattern??(e.pattern=W_),me.init(t,e)}),Ug=R("$ZodCUID2",(t,e)=>{e.pattern??(e.pattern=K_),me.init(t,e)}),Dg=R("$ZodULID",(t,e)=>{e.pattern??(e.pattern=J_),me.init(t,e)}),qg=R("$ZodXID",(t,e)=>{e.pattern??(e.pattern=B_),me.init(t,e)}),Vg=R("$ZodKSUID",(t,e)=>{e.pattern??(e.pattern=G_),me.init(t,e)}),Fg=R("$ZodISODateTime",(t,e)=>{e.pattern??(e.pattern=fg(e)),me.init(t,e)}),Hg=R("$ZodISODate",(t,e)=>{e.pattern??(e.pattern=lg),me.init(t,e)}),Wg=R("$ZodISOTime",(t,e)=>{e.pattern??(e.pattern=dg(e)),me.init(t,e)}),Kg=R("$ZodISODuration",(t,e)=>{e.pattern??(e.pattern=X_),me.init(t,e)}),Jg=R("$ZodIPv4",(t,e)=>{e.pattern??(e.pattern=ng),me.init(t,e),t._zod.onattach.push(r=>{const n=r._zod.bag;n.format="ipv4"})}),Bg=R("$ZodIPv6",(t,e)=>{e.pattern??(e.pattern=sg),me.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})}}}),Gg=R("$ZodCIDRv4",(t,e)=>{e.pattern??(e.pattern=ig),me.init(t,e)}),Yg=R("$ZodCIDRv6",(t,e)=>{e.pattern??(e.pattern=og),me.init(t,e),t._zod.check=r=>{const[n,s]=r.value.split("/");try{if(!s)throw new Error;const i=Number(s);if(`${i}`!==s)throw new Error;if(i<0||i>128)throw new Error;new URL(`http://[${n}]`)}catch{r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:t,continue:!e.abort})}}});function hu(t){if(t==="")return!0;if(t.length%4!==0)return!1;try{return atob(t),!0}catch{return!1}}const Xg=R("$ZodBase64",(t,e)=>{e.pattern??(e.pattern=ag),me.init(t,e),t._zod.onattach.push(r=>{r._zod.bag.contentEncoding="base64"}),t._zod.check=r=>{hu(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:t,continue:!e.abort})}});function Qg(t){if(!au.test(t))return!1;const e=t.replace(/[-_]/g,n=>n==="-"?"+":"/"),r=e.padEnd(Math.ceil(e.length/4)*4,"=");return hu(r)}const ev=R("$ZodBase64URL",(t,e)=>{e.pattern??(e.pattern=au),me.init(t,e),t._zod.onattach.push(r=>{r._zod.bag.contentEncoding="base64url"}),t._zod.check=r=>{Qg(r.value)||r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:t,continue:!e.abort})}}),tv=R("$ZodE164",(t,e)=>{e.pattern??(e.pattern=ug),me.init(t,e)});function rv(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==null?void 0:s.typ)!=="JWT"||!s.alg||e&&(!("alg"in s)||s.alg!==e))}catch{return!1}}const nv=R("$ZodJWT",(t,e)=>{me.init(t,e),t._zod.check=r=>{rv(r.value,e.alg)||r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:t,continue:!e.abort})}}),pu=R("$ZodNumber",(t,e)=>{he.init(t,e),t._zod.pattern=t._zod.bag.pattern??mg,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 i=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,...i?{received:i}:{}}),r}}),sv=R("$ZodNumber",(t,e)=>{bg.init(t,e),pu.init(t,e)}),iv=R("$ZodBoolean",(t,e)=>{he.init(t,e),t._zod.pattern=_g,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}}),ov=R("$ZodAny",(t,e)=>{he.init(t,e),t._zod.parse=r=>r}),av=R("$ZodUnknown",(t,e)=>{he.init(t,e),t._zod.parse=r=>r}),cv=R("$ZodNever",(t,e)=>{he.init(t,e),t._zod.parse=(r,n)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:t}),r)});function mu(t,e,r){t.issues.length&&e.issues.push(...Wt(r,t.issues)),e.value[r]=t.value}const uv=R("$ZodArray",(t,e)=>{he.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 i=[];for(let o=0;o<s.length;o++){const a=s[o],c=e.element._zod.run({value:a,issues:[]},n);c instanceof Promise?i.push(c.then(u=>mu(u,r,o))):mu(c,r,o)}return i.length?Promise.all(i).then(()=>r):r}});function Fn(t,e,r){t.issues.length&&e.issues.push(...Wt(r,t.issues)),e.value[r]=t.value}function _u(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(...Wt(r,t.issues)):t.value===void 0?r in n&&(e.value[r]=void 0):e.value[r]=t.value}const gu=R("$ZodObject",(t,e)=>{he.init(t,e);const r=Ai(()=>{const f=Object.keys(e.shape);for(const $ of f)if(!(e.shape[$]instanceof he))throw new Error(`Invalid element at key "${$}": expected a Zod schema`);const w=j_(e.shape);return{shape:e.shape,keys:f,keySet:new Set(f),numKeys:f.length,optionalKeys:new Set(w)}});fe(t._zod,"propValues",()=>{const f=e.shape,w={};for(const $ in f){const g=f[$]._zod;if(g.values){w[$]??(w[$]=new Set);for(const v of g.values)w[$].add(v)}}return w});const n=f=>{const w=new Ig(["shape","payload","ctx"]),$=r.value,g=m=>{const S=Ur(m);return`shape[${S}]._zod.run({ value: input[${S}], issues: [] }, ctx)`};w.write("const input = payload.value;");const v=Object.create(null);let p=0;for(const m of $.keys)v[m]=`key_${p++}`;w.write("const newResult = {}");for(const m of $.keys)if($.optionalKeys.has(m)){const S=v[m];w.write(`const ${S} = ${g(m)};`);const E=Ur(m);w.write(`
|
|
11
|
-
if (${S}.issues.length) {
|
|
12
|
-
if (input[${E}] === undefined) {
|
|
13
|
-
if (${E} in input) {
|
|
14
|
-
newResult[${E}] = undefined;
|
|
15
|
-
}
|
|
16
|
-
} else {
|
|
17
|
-
payload.issues = payload.issues.concat(
|
|
18
|
-
${S}.issues.map((iss) => ({
|
|
19
|
-
...iss,
|
|
20
|
-
path: iss.path ? [${E}, ...iss.path] : [${E}],
|
|
21
|
-
}))
|
|
22
|
-
);
|
|
23
|
-
}
|
|
24
|
-
} else if (${S}.value === undefined) {
|
|
25
|
-
if (${E} in input) newResult[${E}] = undefined;
|
|
26
|
-
} else {
|
|
27
|
-
newResult[${E}] = ${S}.value;
|
|
28
|
-
}
|
|
29
|
-
`)}else{const S=v[m];w.write(`const ${S} = ${g(m)};`),w.write(`
|
|
30
|
-
if (${S}.issues.length) payload.issues = payload.issues.concat(${S}.issues.map(iss => ({
|
|
31
|
-
...iss,
|
|
32
|
-
path: iss.path ? [${Ur(m)}, ...iss.path] : [${Ur(m)}]
|
|
33
|
-
})));`),w.write(`newResult[${Ur(m)}] = ${S}.value`)}w.write("payload.value = newResult;"),w.write("return payload;");const d=w.compile();return(m,S)=>d(f,m,S)};let s;const i=Ln,o=!Yc.jitless,c=o&&N_.value,u=e.catchall;let l;t._zod.parse=(f,w)=>{l??(l=r.value);const $=f.value;if(!i($))return f.issues.push({expected:"object",code:"invalid_type",input:$,inst:t}),f;const g=[];if(o&&c&&(w==null?void 0:w.async)===!1&&w.jitless!==!0)s||(s=n(e.shape)),f=s(f,w);else{f.value={};const S=l.shape;for(const E of l.keys){const C=S[E],z=C._zod.run({value:$[E],issues:[]},w),B=C._zod.optin==="optional"&&C._zod.optout==="optional";z instanceof Promise?g.push(z.then(ye=>B?_u(ye,f,E,$):Fn(ye,f,E))):B?_u(z,f,E,$):Fn(z,f,E)}}if(!u)return g.length?Promise.all(g).then(()=>f):f;const v=[],p=l.keySet,d=u._zod,m=d.def.type;for(const S of Object.keys($)){if(p.has(S))continue;if(m==="never"){v.push(S);continue}const E=d.run({value:$[S],issues:[]},w);E instanceof Promise?g.push(E.then(C=>Fn(C,f,S))):Fn(E,f,S)}return v.length&&f.issues.push({code:"unrecognized_keys",keys:v,input:$,inst:t}),g.length?Promise.all(g).then(()=>f):f}});function vu(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(i=>It(i,n,Ct())))}),e}const yu=R("$ZodUnion",(t,e)=>{he.init(t,e),fe(t._zod,"optin",()=>e.options.some(r=>r._zod.optin==="optional")?"optional":void 0),fe(t._zod,"optout",()=>e.options.some(r=>r._zod.optout==="optional")?"optional":void 0),fe(t._zod,"values",()=>{if(e.options.every(r=>r._zod.values))return new Set(e.options.flatMap(r=>Array.from(r._zod.values)))}),fe(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=>zi(n.source)).join("|")})$`)}}),t._zod.parse=(r,n)=>{let s=!1;const i=[];for(const o of e.options){const a=o._zod.run({value:r.value,issues:[]},n);if(a instanceof Promise)i.push(a),s=!0;else{if(a.issues.length===0)return a;i.push(a)}}return s?Promise.all(i).then(o=>vu(o,r,t,n)):vu(i,r,t,n)}}),lv=R("$ZodDiscriminatedUnion",(t,e)=>{yu.init(t,e);const r=t._zod.parse;fe(t._zod,"propValues",()=>{const s={};for(const i of e.options){const o=i._zod.propValues;if(!o||Object.keys(o).length===0)throw new Error(`Invalid discriminated union option at index "${e.options.indexOf(i)}"`);for(const[a,c]of Object.entries(o)){s[a]||(s[a]=new Set);for(const u of c)s[a].add(u)}}return s});const n=Ai(()=>{const s=e.options,i=new Map;for(const o of s){const a=o._zod.propValues[e.discriminator];if(!a||a.size===0)throw new Error(`Invalid discriminated union option at index "${e.options.indexOf(o)}"`);for(const c of a){if(i.has(c))throw new Error(`Duplicate discriminator value "${String(c)}"`);i.set(c,o)}}return i});t._zod.parse=(s,i)=>{const o=s.value;if(!Ln(o))return s.issues.push({code:"invalid_type",expected:"object",input:o,inst:t}),s;const a=n.value.get(o==null?void 0:o[e.discriminator]);return a?a._zod.run(s,i):e.unionFallback?r(s,i):(s.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",input:o,path:[e.discriminator],inst:t}),s)}}),dv=R("$ZodIntersection",(t,e)=>{he.init(t,e),t._zod.parse=(r,n)=>{const s=r.value,i=e.left._zod.run({value:s,issues:[]},n),o=e.right._zod.run({value:s,issues:[]},n);return i instanceof Promise||o instanceof Promise?Promise.all([i,o]).then(([c,u])=>bu(r,c,u)):bu(r,i,o)}});function Ui(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(Un(t)&&Un(e)){const r=Object.keys(e),n=Object.keys(t).filter(i=>r.indexOf(i)!==-1),s={...t,...e};for(const i of n){const o=Ui(t[i],e[i]);if(!o.valid)return{valid:!1,mergeErrorPath:[i,...o.mergeErrorPath]};s[i]=o.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],i=e[n],o=Ui(s,i);if(!o.valid)return{valid:!1,mergeErrorPath:[n,...o.mergeErrorPath]};r.push(o.data)}return{valid:!0,data:r}}return{valid:!1,mergeErrorPath:[]}}function bu(t,e,r){if(e.issues.length&&t.issues.push(...e.issues),r.issues.length&&t.issues.push(...r.issues),qr(t))return t;const n=Ui(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 fv=R("$ZodRecord",(t,e)=>{he.init(t,e),t._zod.parse=(r,n)=>{const s=r.value;if(!Un(s))return r.issues.push({expected:"record",code:"invalid_type",input:s,inst:t}),r;const i=[];if(e.keyType._zod.values){const o=e.keyType._zod.values;r.value={};for(const c of o)if(typeof c=="string"||typeof c=="number"||typeof c=="symbol"){const u=e.valueType._zod.run({value:s[c],issues:[]},n);u instanceof Promise?i.push(u.then(l=>{l.issues.length&&r.issues.push(...Wt(c,l.issues)),r.value[c]=l.value})):(u.issues.length&&r.issues.push(...Wt(c,u.issues)),r.value[c]=u.value)}let a;for(const c in s)o.has(c)||(a=a??[],a.push(c));a&&a.length>0&&r.issues.push({code:"unrecognized_keys",input:s,inst:t,keys:a})}else{r.value={};for(const o of Reflect.ownKeys(s)){if(o==="__proto__")continue;const a=e.keyType._zod.run({value:o,issues:[]},n);if(a instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(a.issues.length){r.issues.push({origin:"record",code:"invalid_key",issues:a.issues.map(u=>It(u,n,Ct())),input:o,path:[o],inst:t}),r.value[a.value]=a.value;continue}const c=e.valueType._zod.run({value:s[o],issues:[]},n);c instanceof Promise?i.push(c.then(u=>{u.issues.length&&r.issues.push(...Wt(o,u.issues)),r.value[a.value]=u.value})):(c.issues.length&&r.issues.push(...Wt(o,c.issues)),r.value[a.value]=c.value)}}return i.length?Promise.all(i).then(()=>r):r}}),hv=R("$ZodEnum",(t,e)=>{he.init(t,e);const r=Xc(e.entries);t._zod.values=new Set(r),t._zod.pattern=new RegExp(`^(${r.filter(n=>A_.has(typeof n)).map(n=>typeof n=="string"?Dr(n):n.toString()).join("|")})$`),t._zod.parse=(n,s)=>{const i=n.value;return t._zod.values.has(i)||n.issues.push({code:"invalid_value",values:r,input:i,inst:t}),n}}),pv=R("$ZodLiteral",(t,e)=>{he.init(t,e),t._zod.values=new Set(e.values),t._zod.pattern=new RegExp(`^(${e.values.map(r=>typeof r=="string"?Dr(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}}),mv=R("$ZodTransform",(t,e)=>{he.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(o=>(r.value=o,r));if(s instanceof Promise)throw new xr;return r.value=s,r}}),_v=R("$ZodOptional",(t,e)=>{he.init(t,e),t._zod.optin="optional",t._zod.optout="optional",fe(t._zod,"values",()=>e.innerType._zod.values?new Set([...e.innerType._zod.values,void 0]):void 0),fe(t._zod,"pattern",()=>{const r=e.innerType._zod.pattern;return r?new RegExp(`^(${zi(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)}),gv=R("$ZodNullable",(t,e)=>{he.init(t,e),fe(t._zod,"optin",()=>e.innerType._zod.optin),fe(t._zod,"optout",()=>e.innerType._zod.optout),fe(t._zod,"pattern",()=>{const r=e.innerType._zod.pattern;return r?new RegExp(`^(${zi(r.source)}|null)$`):void 0}),fe(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)}),vv=R("$ZodDefault",(t,e)=>{he.init(t,e),t._zod.optin="optional",fe(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(i=>wu(i,e)):wu(s,e)}});function wu(t,e){return t.value===void 0&&(t.value=e.defaultValue),t}const yv=R("$ZodPrefault",(t,e)=>{he.init(t,e),t._zod.optin="optional",fe(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))}),bv=R("$ZodNonOptional",(t,e)=>{he.init(t,e),fe(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(i=>$u(i,t)):$u(s,t)}});function $u(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 wv=R("$ZodCatch",(t,e)=>{he.init(t,e),t._zod.optin="optional",fe(t._zod,"optout",()=>e.innerType._zod.optout),fe(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(i=>(r.value=i.value,i.issues.length&&(r.value=e.catchValue({...r,error:{issues:i.issues.map(o=>It(o,n,Ct()))},input:r.value}),r.issues=[]),r)):(r.value=s.value,s.issues.length&&(r.value=e.catchValue({...r,error:{issues:s.issues.map(i=>It(i,n,Ct()))},input:r.value}),r.issues=[]),r)}}),$v=R("$ZodPipe",(t,e)=>{he.init(t,e),fe(t._zod,"values",()=>e.in._zod.values),fe(t._zod,"optin",()=>e.in._zod.optin),fe(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(i=>Su(i,e,n)):Su(s,e,n)}});function Su(t,e,r){return qr(t)?t:e.out._zod.run({value:t.value,issues:t.issues},r)}const Sv=R("$ZodReadonly",(t,e)=>{he.init(t,e),fe(t._zod,"propValues",()=>e.innerType._zod.propValues),fe(t._zod,"values",()=>e.innerType._zod.values),fe(t._zod,"optin",()=>e.innerType._zod.optin),fe(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(ku):ku(s)}});function ku(t){return t.value=Object.freeze(t.value),t}const kv=R("$ZodCustom",(t,e)=>{Fe.init(t,e),he.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(i=>Eu(i,r,n,t));Eu(s,r,n,t)}});function Eu(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(Vr(s))}}class Pu{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 Ev(){return new Pu}const Fr=Ev();function Pv(t,e){return new t({type:"string",...D(e)})}function Rv(t,e){return new t({type:"string",format:"email",check:"string_format",abort:!1,...D(e)})}function Ru(t,e){return new t({type:"string",format:"guid",check:"string_format",abort:!1,...D(e)})}function Tv(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,...D(e)})}function Cv(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...D(e)})}function Ov(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...D(e)})}function Iv(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...D(e)})}function Tu(t,e){return new t({type:"string",format:"url",check:"string_format",abort:!1,...D(e)})}function Nv(t,e){return new t({type:"string",format:"emoji",check:"string_format",abort:!1,...D(e)})}function Av(t,e){return new t({type:"string",format:"nanoid",check:"string_format",abort:!1,...D(e)})}function jv(t,e){return new t({type:"string",format:"cuid",check:"string_format",abort:!1,...D(e)})}function zv(t,e){return new t({type:"string",format:"cuid2",check:"string_format",abort:!1,...D(e)})}function Mv(t,e){return new t({type:"string",format:"ulid",check:"string_format",abort:!1,...D(e)})}function Zv(t,e){return new t({type:"string",format:"xid",check:"string_format",abort:!1,...D(e)})}function xv(t,e){return new t({type:"string",format:"ksuid",check:"string_format",abort:!1,...D(e)})}function Lv(t,e){return new t({type:"string",format:"ipv4",check:"string_format",abort:!1,...D(e)})}function Uv(t,e){return new t({type:"string",format:"ipv6",check:"string_format",abort:!1,...D(e)})}function Dv(t,e){return new t({type:"string",format:"cidrv4",check:"string_format",abort:!1,...D(e)})}function qv(t,e){return new t({type:"string",format:"cidrv6",check:"string_format",abort:!1,...D(e)})}function Vv(t,e){return new t({type:"string",format:"base64",check:"string_format",abort:!1,...D(e)})}function Fv(t,e){return new t({type:"string",format:"base64url",check:"string_format",abort:!1,...D(e)})}function Hv(t,e){return new t({type:"string",format:"e164",check:"string_format",abort:!1,...D(e)})}function Wv(t,e){return new t({type:"string",format:"jwt",check:"string_format",abort:!1,...D(e)})}function Kv(t,e){return new t({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...D(e)})}function Jv(t,e){return new t({type:"string",format:"date",check:"string_format",...D(e)})}function Bv(t,e){return new t({type:"string",format:"time",check:"string_format",precision:null,...D(e)})}function Gv(t,e){return new t({type:"string",format:"duration",check:"string_format",...D(e)})}function Yv(t,e){return new t({type:"number",checks:[],...D(e)})}function Xv(t,e){return new t({type:"number",check:"number_format",abort:!1,format:"safeint",...D(e)})}function Qv(t,e){return new t({type:"boolean",...D(e)})}function ey(t){return new t({type:"any"})}function ty(t){return new t({type:"unknown"})}function ry(t,e){return new t({type:"never",...D(e)})}function Cu(t,e){return new du({check:"less_than",...D(e),value:t,inclusive:!1})}function Di(t,e){return new du({check:"less_than",...D(e),value:t,inclusive:!0})}function Ou(t,e){return new fu({check:"greater_than",...D(e),value:t,inclusive:!1})}function qi(t,e){return new fu({check:"greater_than",...D(e),value:t,inclusive:!0})}function Iu(t,e){return new yg({check:"multiple_of",...D(e),value:t})}function Nu(t,e){return new wg({check:"max_length",...D(e),maximum:t})}function Hn(t,e){return new $g({check:"min_length",...D(e),minimum:t})}function Au(t,e){return new Sg({check:"length_equals",...D(e),length:t})}function ny(t,e){return new kg({check:"string_format",format:"regex",...D(e),pattern:t})}function sy(t){return new Eg({check:"string_format",format:"lowercase",...D(t)})}function iy(t){return new Pg({check:"string_format",format:"uppercase",...D(t)})}function oy(t,e){return new Rg({check:"string_format",format:"includes",...D(e),includes:t})}function ay(t,e){return new Tg({check:"string_format",format:"starts_with",...D(e),prefix:t})}function cy(t,e){return new Cg({check:"string_format",format:"ends_with",...D(e),suffix:t})}function Hr(t){return new Og({check:"overwrite",tx:t})}function uy(t){return Hr(e=>e.normalize(t))}function ly(){return Hr(t=>t.trim())}function dy(){return Hr(t=>t.toLowerCase())}function fy(){return Hr(t=>t.toUpperCase())}function hy(t,e,r){return new t({type:"array",element:e,...D(r)})}function py(t,e,r){const n=D(r);return n.abort??(n.abort=!0),new t({type:"custom",check:"custom",fn:e,...n})}function my(t,e,r){return new t({type:"custom",check:"custom",fn:e,...D(r)})}class ju{constructor(e){this.counter=0,this.metadataRegistry=(e==null?void 0:e.metadata)??Fr,this.target=(e==null?void 0:e.target)??"draft-2020-12",this.unrepresentable=(e==null?void 0:e.unrepresentable)??"throw",this.override=(e==null?void 0:e.override)??(()=>{}),this.io=(e==null?void 0:e.io)??"output",this.seen=new Map}process(e,r={path:[],schemaPath:[]}){var f,w,$;var n;const s=e._zod.def,i={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},o=this.seen.get(e);if(o)return o.count++,r.schemaPath.includes(e)&&(o.cycle=r.path),o.schema;const a={schema:{},count:1,cycle:void 0,path:r.path};this.seen.set(e,a);const c=(w=(f=e._zod).toJSONSchema)==null?void 0:w.call(f);if(c)a.schema=c;else{const g={...r,schemaPath:[...r.schemaPath,e],path:r.path},v=e._zod.parent;if(v)a.ref=v,this.process(v,g),this.seen.get(v).isParent=!0;else{const p=a.schema;switch(s.type){case"string":{const d=p;d.type="string";const{minimum:m,maximum:S,format:E,patterns:C,contentEncoding:z}=e._zod.bag;if(typeof m=="number"&&(d.minLength=m),typeof S=="number"&&(d.maxLength=S),E&&(d.format=i[E]??E,d.format===""&&delete d.format),z&&(d.contentEncoding=z),C&&C.size>0){const B=[...C];B.length===1?d.pattern=B[0].source:B.length>1&&(a.schema.allOf=[...B.map(ye=>({...this.target==="draft-7"?{type:"string"}:{},pattern:ye.source}))])}break}case"number":{const d=p,{minimum:m,maximum:S,format:E,multipleOf:C,exclusiveMaximum:z,exclusiveMinimum:B}=e._zod.bag;typeof E=="string"&&E.includes("int")?d.type="integer":d.type="number",typeof B=="number"&&(d.exclusiveMinimum=B),typeof m=="number"&&(d.minimum=m,typeof B=="number"&&(B>=m?delete d.minimum:delete d.exclusiveMinimum)),typeof z=="number"&&(d.exclusiveMaximum=z),typeof S=="number"&&(d.maximum=S,typeof z=="number"&&(z<=S?delete d.maximum:delete d.exclusiveMaximum)),typeof C=="number"&&(d.multipleOf=C);break}case"boolean":{const d=p;d.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":{p.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":{p.not={};break}case"date":{if(this.unrepresentable==="throw")throw new Error("Date cannot be represented in JSON Schema");break}case"array":{const d=p,{minimum:m,maximum:S}=e._zod.bag;typeof m=="number"&&(d.minItems=m),typeof S=="number"&&(d.maxItems=S),d.type="array",d.items=this.process(s.element,{...g,path:[...g.path,"items"]});break}case"object":{const d=p;d.type="object",d.properties={};const m=s.shape;for(const C in m)d.properties[C]=this.process(m[C],{...g,path:[...g.path,"properties",C]});const S=new Set(Object.keys(m)),E=new Set([...S].filter(C=>{const z=s.shape[C]._zod;return this.io==="input"?z.optin===void 0:z.optout===void 0}));E.size>0&&(d.required=Array.from(E)),(($=s.catchall)==null?void 0:$._zod.def.type)==="never"?d.additionalProperties=!1:s.catchall?s.catchall&&(d.additionalProperties=this.process(s.catchall,{...g,path:[...g.path,"additionalProperties"]})):this.io==="output"&&(d.additionalProperties=!1);break}case"union":{const d=p;d.anyOf=s.options.map((m,S)=>this.process(m,{...g,path:[...g.path,"anyOf",S]}));break}case"intersection":{const d=p,m=this.process(s.left,{...g,path:[...g.path,"allOf",0]}),S=this.process(s.right,{...g,path:[...g.path,"allOf",1]}),E=z=>"allOf"in z&&Object.keys(z).length===1,C=[...E(m)?m.allOf:[m],...E(S)?S.allOf:[S]];d.allOf=C;break}case"tuple":{const d=p;d.type="array";const m=s.items.map((C,z)=>this.process(C,{...g,path:[...g.path,"prefixItems",z]}));if(this.target==="draft-2020-12"?d.prefixItems=m:d.items=m,s.rest){const C=this.process(s.rest,{...g,path:[...g.path,"items"]});this.target==="draft-2020-12"?d.items=C:d.additionalItems=C}s.rest&&(d.items=this.process(s.rest,{...g,path:[...g.path,"items"]}));const{minimum:S,maximum:E}=e._zod.bag;typeof S=="number"&&(d.minItems=S),typeof E=="number"&&(d.maxItems=E);break}case"record":{const d=p;d.type="object",d.propertyNames=this.process(s.keyType,{...g,path:[...g.path,"propertyNames"]}),d.additionalProperties=this.process(s.valueType,{...g,path:[...g.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 d=p,m=Xc(s.entries);m.every(S=>typeof S=="number")&&(d.type="number"),m.every(S=>typeof S=="string")&&(d.type="string"),d.enum=m;break}case"literal":{const d=p,m=[];for(const S of s.values)if(S===void 0){if(this.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof S=="bigint"){if(this.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");m.push(Number(S))}else m.push(S);if(m.length!==0)if(m.length===1){const S=m[0];d.type=S===null?"null":typeof S,d.const=S}else m.every(S=>typeof S=="number")&&(d.type="number"),m.every(S=>typeof S=="string")&&(d.type="string"),m.every(S=>typeof S=="boolean")&&(d.type="string"),m.every(S=>S===null)&&(d.type="null"),d.enum=m;break}case"file":{const d=p,m={type:"string",format:"binary",contentEncoding:"binary"},{minimum:S,maximum:E,mime:C}=e._zod.bag;S!==void 0&&(m.minLength=S),E!==void 0&&(m.maxLength=E),C?C.length===1?(m.contentMediaType=C[0],Object.assign(d,m)):d.anyOf=C.map(z=>({...m,contentMediaType:z})):Object.assign(d,m);break}case"transform":{if(this.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema");break}case"nullable":{const d=this.process(s.innerType,g);p.anyOf=[d,{type:"null"}];break}case"nonoptional":{this.process(s.innerType,g),a.ref=s.innerType;break}case"success":{const d=p;d.type="boolean";break}case"default":{this.process(s.innerType,g),a.ref=s.innerType,p.default=JSON.parse(JSON.stringify(s.defaultValue));break}case"prefault":{this.process(s.innerType,g),a.ref=s.innerType,this.io==="input"&&(p._prefault=JSON.parse(JSON.stringify(s.defaultValue)));break}case"catch":{this.process(s.innerType,g),a.ref=s.innerType;let d;try{d=s.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}p.default=d;break}case"nan":{if(this.unrepresentable==="throw")throw new Error("NaN cannot be represented in JSON Schema");break}case"template_literal":{const d=p,m=e._zod.pattern;if(!m)throw new Error("Pattern not found in template literal");d.type="string",d.pattern=m.source;break}case"pipe":{const d=this.io==="input"?s.in._zod.def.type==="transform"?s.out:s.in:s.out;this.process(d,g),a.ref=d;break}case"readonly":{this.process(s.innerType,g),a.ref=s.innerType,p.readOnly=!0;break}case"promise":{this.process(s.innerType,g),a.ref=s.innerType;break}case"optional":{this.process(s.innerType,g),a.ref=s.innerType;break}case"lazy":{const d=e._zod.innerType;this.process(d,g),a.ref=d;break}case"custom":{if(this.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema");break}}}}const u=this.metadataRegistry.get(e);return u&&Object.assign(a.schema,u),this.io==="input"&&Ce(e)&&(delete a.schema.examples,delete a.schema.default),this.io==="input"&&a.schema._prefault&&((n=a.schema).default??(n.default=a.schema._prefault)),delete a.schema._prefault,this.seen.get(e).schema}emit(e,r){var l,f,w,$,g,v;const n={cycles:(r==null?void 0:r.cycles)??"ref",reused:(r==null?void 0:r.reused)??"inline",external:(r==null?void 0:r.external)??void 0},s=this.seen.get(e);if(!s)throw new Error("Unprocessed schema. This is a bug in Zod.");const i=p=>{var C;const d=this.target==="draft-2020-12"?"$defs":"definitions";if(n.external){const z=(C=n.external.registry.get(p[0]))==null?void 0:C.id,B=n.external.uri??(Me=>Me);if(z)return{ref:B(z)};const ye=p[1].defId??p[1].schema.id??`schema${this.counter++}`;return p[1].defId=ye,{defId:ye,ref:`${B("__shared")}#/${d}/${ye}`}}if(p[1]===s)return{ref:"#"};const S=`#/${d}/`,E=p[1].schema.id??`__schema${this.counter++}`;return{defId:E,ref:S+E}},o=p=>{if(p[1].schema.$ref)return;const d=p[1],{ref:m,defId:S}=i(p);d.def={...d.schema},S&&(d.defId=S);const E=d.schema;for(const C in E)delete E[C];E.$ref=m};if(n.cycles==="throw")for(const p of this.seen.entries()){const d=p[1];if(d.cycle)throw new Error(`Cycle detected: #/${(l=d.cycle)==null?void 0:l.join("/")}/<root>
|
|
34
|
-
|
|
35
|
-
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const p of this.seen.entries()){const d=p[1];if(e===p[0]){o(p);continue}if(n.external){const S=(f=n.external.registry.get(p[0]))==null?void 0:f.id;if(e!==p[0]&&S){o(p);continue}}if((w=this.metadataRegistry.get(p[0]))==null?void 0:w.id){o(p);continue}if(d.cycle){o(p);continue}if(d.count>1&&n.reused==="ref"){o(p);continue}}const a=(p,d)=>{const m=this.seen.get(p),S=m.def??m.schema,E={...S};if(m.ref===null)return;const C=m.ref;if(m.ref=null,C){a(C,d);const z=this.seen.get(C).schema;z.$ref&&d.target==="draft-7"?(S.allOf=S.allOf??[],S.allOf.push(z)):(Object.assign(S,z),Object.assign(S,E))}m.isParent||this.override({zodSchema:p,jsonSchema:S,path:m.path??[]})};for(const p of[...this.seen.entries()].reverse())a(p[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)!=null&&$.uri){const p=(g=n.external.registry.get(e))==null?void 0:g.id;if(!p)throw new Error("Schema is missing an `id` property");c.$id=n.external.uri(p)}Object.assign(c,s.def);const u=((v=n.external)==null?void 0:v.defs)??{};for(const p of this.seen.entries()){const d=p[1];d.def&&d.defId&&(u[d.defId]=d.def)}n.external||Object.keys(u).length>0&&(this.target==="draft-2020-12"?c.$defs=u:c.definitions=u);try{return JSON.parse(JSON.stringify(c))}catch{throw new Error("Error converting schema to JSON.")}}}function _y(t,e){if(t instanceof Pu){const n=new ju(e),s={};for(const a of t._idmap.entries()){const[c,u]=a;n.process(u)}const i={},o={registry:t,uri:e==null?void 0:e.uri,defs:s};for(const a of t._idmap.entries()){const[c,u]=a;i[c]=n.emit(u,{...e,external:o})}if(Object.keys(s).length>0){const a=n.target==="draft-2020-12"?"$defs":"definitions";i.__shared={[a]:s}}return{schemas:i}}const r=new ju(e);return r.process(t),r.emit(t,e)}function Ce(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 Ce(s.element,r);case"object":{for(const i in s.shape)if(Ce(s.shape[i],r))return!0;return!1}case"union":{for(const i of s.options)if(Ce(i,r))return!0;return!1}case"intersection":return Ce(s.left,r)||Ce(s.right,r);case"tuple":{for(const i of s.items)if(Ce(i,r))return!0;return!!(s.rest&&Ce(s.rest,r))}case"record":return Ce(s.keyType,r)||Ce(s.valueType,r);case"map":return Ce(s.keyType,r)||Ce(s.valueType,r);case"set":return Ce(s.valueType,r);case"promise":case"optional":case"nonoptional":case"nullable":case"readonly":return Ce(s.innerType,r);case"lazy":return Ce(s.getter(),r);case"default":return Ce(s.innerType,r);case"prefault":return Ce(s.innerType,r);case"custom":return!1;case"transform":return!0;case"pipe":return Ce(s.in,r)||Ce(s.out,r);case"success":return!1;case"catch":return!1}throw new Error(`Unknown schema type: ${s.type}`)}const gy=R("ZodISODateTime",(t,e)=>{Fg.init(t,e),$e.init(t,e)});function vy(t){return Kv(gy,t)}const yy=R("ZodISODate",(t,e)=>{Hg.init(t,e),$e.init(t,e)});function by(t){return Jv(yy,t)}const wy=R("ZodISOTime",(t,e)=>{Wg.init(t,e),$e.init(t,e)});function $y(t){return Bv(wy,t)}const Sy=R("ZodISODuration",(t,e)=>{Kg.init(t,e),$e.init(t,e)});function ky(t){return Gv(Sy,t)}const Wn=R("ZodError",(t,e)=>{tu.init(t,e),t.name="ZodError",Object.defineProperties(t,{format:{value:r=>V_(t,r)},flatten:{value:r=>q_(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}),Ey=ru(Wn),Py=nu(Wn),Ry=su(Wn),Ty=iu(Wn),we=R("ZodType",(t,e)=>(he.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)=>Ot(t,r,n),t.brand=()=>t,t.register=(r,n)=>(r.add(t,n),t),t.parse=(r,n)=>Ey(t,r,n,{callee:t.parse}),t.safeParse=(r,n)=>Ry(t,r,n),t.parseAsync=async(r,n)=>Py(t,r,n,{callee:t.parseAsync}),t.safeParseAsync=async(r,n)=>Ty(t,r,n),t.spa=t.safeParseAsync,t.refine=(r,n)=>t.check(b0(r,n)),t.superRefine=r=>t.check(w0(r)),t.overwrite=r=>t.check(Hr(r)),t.optional=()=>ee(t),t.nullable=()=>Fu(t),t.nullish=()=>ee(Fu(t)),t.nonoptional=r=>f0(t,r),t.array=()=>j(t),t.or=r=>Se([t,r]),t.and=r=>Vi(t,r),t.transform=r=>Hi(t,qu(r)),t.default=r=>u0(t,r),t.prefault=r=>d0(t,r),t.catch=r=>p0(t,r),t.pipe=r=>Hi(t,r),t.readonly=()=>g0(t),t.describe=r=>{const n=t.clone();return Fr.add(n,{description:r}),n},Object.defineProperty(t,"description",{get(){var r;return(r=Fr.get(t))==null?void 0:r.description},configurable:!0}),t.meta=(...r)=>{if(r.length===0)return Fr.get(t);const n=t.clone();return Fr.add(n,r[0]),n},t.isOptional=()=>t.safeParse(void 0).success,t.isNullable=()=>t.safeParse(null).success,t)),zu=R("_ZodString",(t,e)=>{Li.init(t,e),we.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(ny(...n)),t.includes=(...n)=>t.check(oy(...n)),t.startsWith=(...n)=>t.check(ay(...n)),t.endsWith=(...n)=>t.check(cy(...n)),t.min=(...n)=>t.check(Hn(...n)),t.max=(...n)=>t.check(Nu(...n)),t.length=(...n)=>t.check(Au(...n)),t.nonempty=(...n)=>t.check(Hn(1,...n)),t.lowercase=n=>t.check(sy(n)),t.uppercase=n=>t.check(iy(n)),t.trim=()=>t.check(ly()),t.normalize=(...n)=>t.check(uy(...n)),t.toLowerCase=()=>t.check(dy()),t.toUpperCase=()=>t.check(fy())}),Cy=R("ZodString",(t,e)=>{Li.init(t,e),zu.init(t,e),t.email=r=>t.check(Rv(Oy,r)),t.url=r=>t.check(Tu(Zu,r)),t.jwt=r=>t.check(Wv(Wy,r)),t.emoji=r=>t.check(Nv(Ny,r)),t.guid=r=>t.check(Ru(Mu,r)),t.uuid=r=>t.check(Tv(Kn,r)),t.uuidv4=r=>t.check(Cv(Kn,r)),t.uuidv6=r=>t.check(Ov(Kn,r)),t.uuidv7=r=>t.check(Iv(Kn,r)),t.nanoid=r=>t.check(Av(Ay,r)),t.guid=r=>t.check(Ru(Mu,r)),t.cuid=r=>t.check(jv(jy,r)),t.cuid2=r=>t.check(zv(zy,r)),t.ulid=r=>t.check(Mv(My,r)),t.base64=r=>t.check(Vv(Vy,r)),t.base64url=r=>t.check(Fv(Fy,r)),t.xid=r=>t.check(Zv(Zy,r)),t.ksuid=r=>t.check(xv(xy,r)),t.ipv4=r=>t.check(Lv(Ly,r)),t.ipv6=r=>t.check(Uv(Uy,r)),t.cidrv4=r=>t.check(Dv(Dy,r)),t.cidrv6=r=>t.check(qv(qy,r)),t.e164=r=>t.check(Hv(Hy,r)),t.datetime=r=>t.check(vy(r)),t.date=r=>t.check(by(r)),t.time=r=>t.check($y(r)),t.duration=r=>t.check(ky(r))});function b(t){return Pv(Cy,t)}const $e=R("ZodStringFormat",(t,e)=>{me.init(t,e),zu.init(t,e)}),Oy=R("ZodEmail",(t,e)=>{zg.init(t,e),$e.init(t,e)}),Mu=R("ZodGUID",(t,e)=>{Ag.init(t,e),$e.init(t,e)}),Kn=R("ZodUUID",(t,e)=>{jg.init(t,e),$e.init(t,e)}),Zu=R("ZodURL",(t,e)=>{Mg.init(t,e),$e.init(t,e)});function Iy(t){return Tu(Zu,t)}const Ny=R("ZodEmoji",(t,e)=>{Zg.init(t,e),$e.init(t,e)}),Ay=R("ZodNanoID",(t,e)=>{xg.init(t,e),$e.init(t,e)}),jy=R("ZodCUID",(t,e)=>{Lg.init(t,e),$e.init(t,e)}),zy=R("ZodCUID2",(t,e)=>{Ug.init(t,e),$e.init(t,e)}),My=R("ZodULID",(t,e)=>{Dg.init(t,e),$e.init(t,e)}),Zy=R("ZodXID",(t,e)=>{qg.init(t,e),$e.init(t,e)}),xy=R("ZodKSUID",(t,e)=>{Vg.init(t,e),$e.init(t,e)}),Ly=R("ZodIPv4",(t,e)=>{Jg.init(t,e),$e.init(t,e)}),Uy=R("ZodIPv6",(t,e)=>{Bg.init(t,e),$e.init(t,e)}),Dy=R("ZodCIDRv4",(t,e)=>{Gg.init(t,e),$e.init(t,e)}),qy=R("ZodCIDRv6",(t,e)=>{Yg.init(t,e),$e.init(t,e)}),Vy=R("ZodBase64",(t,e)=>{Xg.init(t,e),$e.init(t,e)}),Fy=R("ZodBase64URL",(t,e)=>{ev.init(t,e),$e.init(t,e)}),Hy=R("ZodE164",(t,e)=>{tv.init(t,e),$e.init(t,e)}),Wy=R("ZodJWT",(t,e)=>{nv.init(t,e),$e.init(t,e)}),xu=R("ZodNumber",(t,e)=>{pu.init(t,e),we.init(t,e),t.gt=(n,s)=>t.check(Ou(n,s)),t.gte=(n,s)=>t.check(qi(n,s)),t.min=(n,s)=>t.check(qi(n,s)),t.lt=(n,s)=>t.check(Cu(n,s)),t.lte=(n,s)=>t.check(Di(n,s)),t.max=(n,s)=>t.check(Di(n,s)),t.int=n=>t.check(Lu(n)),t.safe=n=>t.check(Lu(n)),t.positive=n=>t.check(Ou(0,n)),t.nonnegative=n=>t.check(qi(0,n)),t.negative=n=>t.check(Cu(0,n)),t.nonpositive=n=>t.check(Di(0,n)),t.multipleOf=(n,s)=>t.check(Iu(n,s)),t.step=(n,s)=>t.check(Iu(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 _e(t){return Yv(xu,t)}const Ky=R("ZodNumberFormat",(t,e)=>{sv.init(t,e),xu.init(t,e)});function Lu(t){return Xv(Ky,t)}const Jy=R("ZodBoolean",(t,e)=>{iv.init(t,e),we.init(t,e)});function ge(t){return Qv(Jy,t)}const By=R("ZodAny",(t,e)=>{ov.init(t,e),we.init(t,e)});function Gy(){return ey(By)}const Yy=R("ZodUnknown",(t,e)=>{av.init(t,e),we.init(t,e)});function Ee(){return ty(Yy)}const Xy=R("ZodNever",(t,e)=>{cv.init(t,e),we.init(t,e)});function Qy(t){return ry(Xy,t)}const e0=R("ZodArray",(t,e)=>{uv.init(t,e),we.init(t,e),t.element=e.element,t.min=(r,n)=>t.check(Hn(r,n)),t.nonempty=r=>t.check(Hn(1,r)),t.max=(r,n)=>t.check(Nu(r,n)),t.length=(r,n)=>t.check(Au(r,n)),t.unwrap=()=>t.element});function j(t,e){return hy(e0,t,e)}const Uu=R("ZodObject",(t,e)=>{gu.init(t,e),we.init(t,e),fe(t,"shape",()=>e.shape),t.keyof=()=>st(Object.keys(t._zod.def.shape)),t.catchall=r=>t.clone({...t._zod.def,catchall:r}),t.passthrough=()=>t.clone({...t._zod.def,catchall:Ee()}),t.loose=()=>t.clone({...t._zod.def,catchall:Ee()}),t.strict=()=>t.clone({...t._zod.def,catchall:Qy()}),t.strip=()=>t.clone({...t._zod.def,catchall:void 0}),t.extend=r=>x_(t,r),t.merge=r=>L_(t,r),t.pick=r=>M_(t,r),t.omit=r=>Z_(t,r),t.partial=(...r)=>U_(Vu,t,r[0]),t.required=(...r)=>D_(Hu,t,r[0])});function M(t,e){const r={type:"object",get shape(){return Lr(this,"shape",{...t}),this.shape},...D(e)};return new Uu(r)}function nt(t,e){return new Uu({type:"object",get shape(){return Lr(this,"shape",{...t}),this.shape},catchall:Ee(),...D(e)})}const Du=R("ZodUnion",(t,e)=>{yu.init(t,e),we.init(t,e),t.options=e.options});function Se(t,e){return new Du({type:"union",options:t,...D(e)})}const t0=R("ZodDiscriminatedUnion",(t,e)=>{Du.init(t,e),lv.init(t,e)});function r0(t,e,r){return new t0({type:"union",options:e,discriminator:t,...D(r)})}const n0=R("ZodIntersection",(t,e)=>{dv.init(t,e),we.init(t,e)});function Vi(t,e){return new n0({type:"intersection",left:t,right:e})}const s0=R("ZodRecord",(t,e)=>{fv.init(t,e),we.init(t,e),t.keyType=e.keyType,t.valueType=e.valueType});function Pe(t,e,r){return new s0({type:"record",keyType:t,valueType:e,...D(r)})}const Fi=R("ZodEnum",(t,e)=>{hv.init(t,e),we.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 i={};for(const o of n)if(r.has(o))i[o]=e.entries[o];else throw new Error(`Key ${o} not found in enum`);return new Fi({...e,checks:[],...D(s),entries:i})},t.exclude=(n,s)=>{const i={...e.entries};for(const o of n)if(r.has(o))delete i[o];else throw new Error(`Key ${o} not found in enum`);return new Fi({...e,checks:[],...D(s),entries:i})}});function st(t,e){const r=Array.isArray(t)?Object.fromEntries(t.map(n=>[n,n])):t;return new Fi({type:"enum",entries:r,...D(e)})}const i0=R("ZodLiteral",(t,e)=>{pv.init(t,e),we.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 H(t,e){return new i0({type:"literal",values:Array.isArray(t)?t:[t],...D(e)})}const o0=R("ZodTransform",(t,e)=>{mv.init(t,e),we.init(t,e),t._zod.parse=(r,n)=>{r.addIssue=i=>{if(typeof i=="string")r.issues.push(Vr(i,r.value,e));else{const o=i;o.fatal&&(o.continue=!1),o.code??(o.code="custom"),o.input??(o.input=r.value),o.inst??(o.inst=t),o.continue??(o.continue=!0),r.issues.push(Vr(o))}};const s=e.transform(r.value,r);return s instanceof Promise?s.then(i=>(r.value=i,r)):(r.value=s,r)}});function qu(t){return new o0({type:"transform",transform:t})}const Vu=R("ZodOptional",(t,e)=>{_v.init(t,e),we.init(t,e),t.unwrap=()=>t._zod.def.innerType});function ee(t){return new Vu({type:"optional",innerType:t})}const a0=R("ZodNullable",(t,e)=>{gv.init(t,e),we.init(t,e),t.unwrap=()=>t._zod.def.innerType});function Fu(t){return new a0({type:"nullable",innerType:t})}const c0=R("ZodDefault",(t,e)=>{vv.init(t,e),we.init(t,e),t.unwrap=()=>t._zod.def.innerType,t.removeDefault=t.unwrap});function u0(t,e){return new c0({type:"default",innerType:t,get defaultValue(){return typeof e=="function"?e():e}})}const l0=R("ZodPrefault",(t,e)=>{yv.init(t,e),we.init(t,e),t.unwrap=()=>t._zod.def.innerType});function d0(t,e){return new l0({type:"prefault",innerType:t,get defaultValue(){return typeof e=="function"?e():e}})}const Hu=R("ZodNonOptional",(t,e)=>{bv.init(t,e),we.init(t,e),t.unwrap=()=>t._zod.def.innerType});function f0(t,e){return new Hu({type:"nonoptional",innerType:t,...D(e)})}const h0=R("ZodCatch",(t,e)=>{wv.init(t,e),we.init(t,e),t.unwrap=()=>t._zod.def.innerType,t.removeCatch=t.unwrap});function p0(t,e){return new h0({type:"catch",innerType:t,catchValue:typeof e=="function"?e:()=>e})}const m0=R("ZodPipe",(t,e)=>{$v.init(t,e),we.init(t,e),t.in=e.in,t.out=e.out});function Hi(t,e){return new m0({type:"pipe",in:t,out:e})}const _0=R("ZodReadonly",(t,e)=>{Sv.init(t,e),we.init(t,e)});function g0(t){return new _0({type:"readonly",innerType:t})}const Wu=R("ZodCustom",(t,e)=>{kv.init(t,e),we.init(t,e)});function v0(t){const e=new Fe({check:"custom"});return e._zod.check=t,e}function y0(t,e){return py(Wu,t??(()=>!0),e)}function b0(t,e={}){return my(Wu,t,e)}function w0(t){const e=v0(r=>(r.addIssue=n=>{if(typeof n=="string")r.issues.push(Vr(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(Vr(s))}},t(r.value,r)));return e}function $0(t,e){return Hi(qu(t),e)}const S0={custom:"custom"},Kt="2025-06-18",k0="2025-03-26",Wi=[Kt,"2025-03-26","2024-11-05","2024-10-07"],Wr="2.0",pt=y0(t=>t!==null&&(typeof t=="object"||typeof t=="function")),Ki=Se([b(),_e().int()]),Ji=b(),E0=nt({progressToken:Ki.optional()}),it=nt({_meta:E0.optional()}),Ue=M({method:b(),params:it.optional()}),lr=nt({_meta:Pe(b(),Ee()).optional()}),Ge=M({method:b(),params:lr.optional()}),Ke=nt({_meta:Pe(b(),Ee()).optional()}),Kr=Se([b(),_e().int()]),Bi=M({jsonrpc:H(Wr),id:Kr,...Ue.shape}).strict(),Gi=t=>Bi.safeParse(t).success,Yi=M({jsonrpc:H(Wr),...Ge.shape}).strict(),Ku=t=>Yi.safeParse(t).success,Xi=M({jsonrpc:H(Wr),id:Kr,result:Ke}).strict(),Jn=t=>Xi.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 Qi=M({jsonrpc:H(Wr),id:Kr,error:M({code:_e().int(),message:b(),data:ee(Ee())})}).strict(),Ju=t=>Qi.safeParse(t).success,Jr=Se([Bi,Yi,Xi,Qi]),Nt=Ke.strict(),Bu=lr.extend({requestId:Kr,reason:b().optional()}),Bn=Ge.extend({method:H("notifications/cancelled"),params:Bu}),Gu=M({src:b(),mimeType:b().optional(),sizes:j(b()).optional()}),dr=M({icons:j(Gu).optional()}),Jt=M({name:b(),title:b().optional()}),eo=Jt.extend({...Jt.shape,...dr.shape,version:b(),websiteUrl:b().optional()}),P0=Vi(M({applyDefaults:ge().optional()}),Pe(b(),Ee())),R0=$0(t=>t&&typeof t=="object"&&!Array.isArray(t)&&Object.keys(t).length===0?{form:{}}:t,Vi(M({form:P0.optional(),url:pt.optional()}),Pe(b(),Ee()).optional())),Yu=M({experimental:Pe(b(),pt).optional(),sampling:M({context:pt.optional(),tools:pt.optional()}).optional(),elicitation:R0.optional(),roots:M({listChanged:ge().optional()}).optional()}),Xu=it.extend({protocolVersion:b(),capabilities:Yu,clientInfo:eo}),Gn=Ue.extend({method:H("initialize"),params:Xu}),T0=t=>Gn.safeParse(t).success,Qu=M({experimental:Pe(b(),pt).optional(),logging:pt.optional(),completions:pt.optional(),prompts:ee(M({listChanged:ee(ge())})),resources:M({subscribe:ge().optional(),listChanged:ge().optional()}).optional(),tools:M({listChanged:ge().optional()}).optional()}),to=Ke.extend({protocolVersion:b(),capabilities:Qu,serverInfo:eo,instructions:b().optional()}),Yn=Ge.extend({method:H("notifications/initialized")}),el=t=>Yn.safeParse(t).success,Xn=Ue.extend({method:H("ping")}),tl=M({progress:_e(),total:ee(_e()),message:ee(b())}),rl=M({...lr.shape,...tl.shape,progressToken:Ki}),Qn=Ge.extend({method:H("notifications/progress"),params:rl}),nl=it.extend({cursor:Ji.optional()}),Br=Ue.extend({params:nl.optional()}),Gr=Ke.extend({nextCursor:ee(Ji)}),ro=M({uri:b(),mimeType:ee(b()),_meta:Pe(b(),Ee()).optional()}),no=ro.extend({text:b()}),so=b().refine(t=>{try{return atob(t),!0}catch{return!1}},{message:"Invalid Base64 string"}),io=ro.extend({blob:so}),oo=M({...Jt.shape,...dr.shape,uri:b(),description:ee(b()),mimeType:ee(b()),_meta:ee(nt({}))}),sl=M({...Jt.shape,...dr.shape,uriTemplate:b(),description:ee(b()),mimeType:ee(b()),_meta:ee(nt({}))}),es=Br.extend({method:H("resources/list")}),ao=Gr.extend({resources:j(oo)}),ts=Br.extend({method:H("resources/templates/list")}),co=Gr.extend({resourceTemplates:j(sl)}),rs=it.extend({uri:b()}),il=rs,ns=Ue.extend({method:H("resources/read"),params:il}),uo=Ke.extend({contents:j(Se([no,io]))}),ol=Ge.extend({method:H("notifications/resources/list_changed")}),al=rs,cl=Ue.extend({method:H("resources/subscribe"),params:al}),ul=rs,ll=Ue.extend({method:H("resources/unsubscribe"),params:ul}),dl=lr.extend({uri:b()}),fl=Ge.extend({method:H("notifications/resources/updated"),params:dl}),hl=M({name:b(),description:ee(b()),required:ee(ge())}),pl=M({...Jt.shape,...dr.shape,description:ee(b()),arguments:ee(j(hl)),_meta:ee(nt({}))}),ss=Br.extend({method:H("prompts/list")}),lo=Gr.extend({prompts:j(pl)}),ml=it.extend({name:b(),arguments:Pe(b(),b()).optional()}),is=Ue.extend({method:H("prompts/get"),params:ml}),fo=M({type:H("text"),text:b(),_meta:Pe(b(),Ee()).optional()}),ho=M({type:H("image"),data:so,mimeType:b(),_meta:Pe(b(),Ee()).optional()}),po=M({type:H("audio"),data:so,mimeType:b(),_meta:Pe(b(),Ee()).optional()}),_l=M({type:H("tool_use"),name:b(),id:b(),input:M({}).passthrough(),_meta:ee(M({}).passthrough())}).passthrough(),gl=M({type:H("resource"),resource:Se([no,io]),_meta:Pe(b(),Ee()).optional()}),vl=oo.extend({type:H("resource_link")}),os=Se([fo,ho,po,vl,gl]),yl=M({role:st(["user","assistant"]),content:os}),mo=Ke.extend({description:ee(b()),messages:j(yl)}),bl=Ge.extend({method:H("notifications/prompts/list_changed")}),wl=M({title:b().optional(),readOnlyHint:ge().optional(),destructiveHint:ge().optional(),idempotentHint:ge().optional(),openWorldHint:ge().optional()}),_o=M({...Jt.shape,...dr.shape,description:b().optional(),inputSchema:M({type:H("object"),properties:Pe(b(),pt).optional(),required:j(b()).optional()}).catchall(Ee()),outputSchema:M({type:H("object"),properties:Pe(b(),pt).optional(),required:j(b()).optional()}).catchall(Ee()).optional(),annotations:ee(wl),_meta:Pe(b(),Ee()).optional()}),as=Br.extend({method:H("tools/list")}),go=Gr.extend({tools:j(_o)}),cs=Ke.extend({content:j(os).default([]),structuredContent:Pe(b(),Ee()).optional(),isError:ee(ge())}),C0=cs.or(Ke.extend({toolResult:Ee()})),$l=it.extend({name:b(),arguments:ee(Pe(b(),Ee()))}),us=Ue.extend({method:H("tools/call"),params:$l}),Sl=Ge.extend({method:H("notifications/tools/list_changed")}),Yr=st(["debug","info","notice","warning","error","critical","alert","emergency"]),kl=it.extend({level:Yr}),vo=Ue.extend({method:H("logging/setLevel"),params:kl}),El=lr.extend({level:Yr,logger:b().optional(),data:Ee()}),Pl=Ge.extend({method:H("notifications/message"),params:El}),Rl=M({name:b().optional()}),Tl=M({hints:ee(j(Rl)),costPriority:ee(_e().min(0).max(1)),speedPriority:ee(_e().min(0).max(1)),intelligencePriority:ee(_e().min(0).max(1))}),Cl=M({mode:ee(st(["auto","required","none"]))}),Ol=M({type:H("tool_result"),toolUseId:b().describe("The unique identifier for the corresponding tool call."),content:j(os).default([]),structuredContent:M({}).passthrough().optional(),isError:ee(ge()),_meta:ee(M({}).passthrough())}).passthrough(),Xr=r0("type",[fo,ho,po,_l,Ol]),Il=M({role:st(["user","assistant"]),content:Se([Xr,j(Xr)]),_meta:ee(M({}).passthrough())}).passthrough(),Nl=it.extend({messages:j(Il),modelPreferences:Tl.optional(),systemPrompt:b().optional(),includeContext:st(["none","thisServer","allServers"]).optional(),temperature:_e().optional(),maxTokens:_e().int(),stopSequences:j(b()).optional(),metadata:pt.optional(),tools:ee(j(_o)),toolChoice:ee(Cl)}),Al=Ue.extend({method:H("sampling/createMessage"),params:Nl}),yo=Ke.extend({model:b(),stopReason:ee(st(["endTurn","stopSequence","maxTokens","toolUse"]).or(b())),role:st(["user","assistant"]),content:Se([Xr,j(Xr)])}),jl=M({type:H("boolean"),title:b().optional(),description:b().optional(),default:ge().optional()}),zl=M({type:H("string"),title:b().optional(),description:b().optional(),minLength:_e().optional(),maxLength:_e().optional(),format:st(["email","uri","date","date-time"]).optional(),default:b().optional()}),Ml=M({type:st(["number","integer"]),title:b().optional(),description:b().optional(),minimum:_e().optional(),maximum:_e().optional(),default:_e().optional()}),Zl=M({type:H("string"),title:b().optional(),description:b().optional(),enum:j(b()),default:b().optional()}),xl=M({type:H("string"),title:b().optional(),description:b().optional(),oneOf:j(M({const:b(),title:b()})),default:b().optional()}),Ll=M({type:H("string"),title:b().optional(),description:b().optional(),enum:j(b()),enumNames:j(b()).optional(),default:b().optional()}),Ul=Se([Zl,xl]),Dl=M({type:H("array"),title:b().optional(),description:b().optional(),minItems:_e().optional(),maxItems:_e().optional(),items:M({type:H("string"),enum:j(b())}),default:j(b()).optional()}),ql=M({type:H("array"),title:b().optional(),description:b().optional(),minItems:_e().optional(),maxItems:_e().optional(),items:M({anyOf:j(M({const:b(),title:b()}))}),default:j(b()).optional()}),Vl=Se([Dl,ql]),Fl=Se([Ll,Ul,Vl]),Hl=Se([Fl,jl,zl,Ml]),Wl=it.extend({mode:H("form").optional(),message:b(),requestedSchema:M({type:H("object"),properties:Pe(b(),Hl),required:j(b()).optional()})}),Kl=it.extend({mode:H("url"),message:b(),elicitationId:b(),url:b().url()}),Jl=Se([Wl,Kl]),bo=Ue.extend({method:H("elicitation/create"),params:Jl}),Bl=lr.extend({elicitationId:b()}),Gl=Ge.extend({method:H("notifications/elicitation/complete"),params:Bl}),Qr=Ke.extend({action:st(["accept","decline","cancel"]),content:Pe(b(),Se([b(),_e(),ge(),j(b())])).optional()}),wo=M({type:H("ref/resource"),uri:b()}),O0=wo,Yl=M({type:H("ref/prompt"),name:b()}),Xl=it.extend({ref:Se([Yl,wo]),argument:M({name:b(),value:b()}),context:M({arguments:Pe(b(),b()).optional()}).optional()}),ls=Ue.extend({method:H("completion/complete"),params:Xl});function Ql(t){if(t.params.ref.type!=="ref/prompt")throw new TypeError(`Expected CompleteRequestPrompt, but got ${t.params.ref.type}`)}function ed(t){if(t.params.ref.type!=="ref/resource")throw new TypeError(`Expected CompleteRequestResourceTemplate, but got ${t.params.ref.type}`)}const $o=Ke.extend({completion:nt({values:j(b()).max(100),total:ee(_e().int()),hasMore:ee(ge())})}),td=M({uri:b().startsWith("file://"),name:b().optional(),_meta:Pe(b(),Ee()).optional()}),rd=Ue.extend({method:H("roots/list")}),So=Ke.extend({roots:j(td)}),nd=Ge.extend({method:H("notifications/roots/list_changed")}),I0=Se([Xn,Gn,ls,vo,is,ss,es,ts,ns,cl,ll,us,as]),N0=Se([Bn,Qn,Yn,nd]),A0=Se([Nt,yo,Qr,So]),j0=Se([Xn,Al,bo,rd]),z0=Se([Bn,Qn,Pl,fl,ol,Sl,bl,Gl]),M0=Se([Nt,to,$o,mo,lo,ao,co,uo,cs,go]);class se 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 sd(s.elicitations,r)}return new se(e,r,n)}}class sd extends se{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 id=1e6,ko=1e6,od=1e4,Z0=1e6;class yt{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){yt.validateLength(e,id,"Template"),this.template=e,this.parts=this.parse(e)}toString(){return this.template}parse(e){const r=[];let n="",s=0,i=0;for(;s<e.length;)if(e[s]==="{"){n&&(r.push(n),n="");const o=e.indexOf("}",s);if(o===-1)throw new Error("Unclosed template expression");if(i++,i>od)throw new Error(`Template contains too many expressions (max ${od})`);const a=e.slice(s+1,o),c=this.getOperator(a),u=a.includes("*"),l=this.getNames(a),f=l[0];for(const w of l)yt.validateLength(w,ko,"Variable name");r.push({name:f,operator:c,names:l,exploded:u}),s=o+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 yt.validateLength(e,ko,"Variable value"),r==="+"||r==="#"?encodeURI(e):encodeURIComponent(e)}expandPart(e,r){if(e.operator==="?"||e.operator==="&"){const o=e.names.map(c=>{const u=r[c];if(u===void 0)return"";const l=Array.isArray(u)?u.map(f=>this.encodeValue(f,e.operator)).join(","):this.encodeValue(u.toString(),e.operator);return`${c}=${l}`}).filter(c=>c.length>0);return o.length===0?"":(e.operator==="?"?"?":"&")+o.join("&")}if(e.names.length>1){const o=e.names.map(a=>r[a]).filter(a=>a!==void 0);return o.length===0?"":o.map(a=>Array.isArray(a)?a[0]:a).join(",")}const n=r[e.name];if(n===void 0)return"";const i=(Array.isArray(n)?n:[n]).map(o=>this.encodeValue(o,e.operator));switch(e.operator){case"":return i.join(",");case"+":return i.join(",");case"#":return"#"+i.join(",");case".":return"."+i.join(".");case"/":return"/"+i.join("/");default:return i.join(",")}}expand(e){let r="",n=!1;for(const s of this.parts){if(typeof s=="string"){r+=s;continue}const i=this.expandPart(s,e);i&&((s.operator==="?"||s.operator==="&")&&n?r+=i.replace("?","&"):r+=i,(s.operator==="?"||s.operator==="&")&&(n=!0))}return r}escapeRegExp(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}partToRegExp(e){const r=[];for(const i of e.names)yt.validateLength(i,ko,"Variable name");if(e.operator==="?"||e.operator==="&"){for(let i=0;i<e.names.length;i++){const o=e.names[i],a=i===0?"\\"+e.operator:"&";r.push({pattern:a+this.escapeRegExp(o)+"=([^&]+)",name:o})}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){yt.validateLength(e,id,"URI");let r="^";const n=[];for(const a of this.parts)if(typeof a=="string")r+=this.escapeRegExp(a);else{const c=this.partToRegExp(a);for(const{pattern:u,name:l}of c)r+=u,n.push({name:l,exploded:a.exploded})}r+="$",yt.validateLength(r,Z0,"Generated regex pattern");const s=new RegExp(r),i=e.match(s);if(!i)return null;const o={};for(let a=0;a<n.length;a++){const{name:c,exploded:u}=n[a],l=i[a+1],f=c.replace("*","");u&&l.includes(",")?o[f]=l.split(","):o[f]=l}return o}}const ds=Symbol.for("mcp.completable");function x0(t,e){return Object.defineProperty(t,ds,{value:{complete:e},enumerable:!1,writable:!1,configurable:!1}),t}function ad(t){return!!t&&typeof t=="object"&&ds in t}function cd(t){const e=t[ds];return e==null?void 0:e.complete}function L0(t){return t}_.McpZodTypeKind=void 0,function(t){t.Completable="McpCompletable"}(_.McpZodTypeKind||(_.McpZodTypeKind={}));function U0(t){var e;return t.title!==void 0&&t.title!==""?t.title:!((e=t.annotations)===null||e===void 0)&&e.title?t.annotations.title:t.name}var oe;(function(t){t.assertEqual=s=>{};function e(s){}t.assertIs=e;function r(s){throw new Error}t.assertNever=r,t.arrayToEnum=s=>{const i={};for(const o of s)i[o]=o;return i},t.getValidEnumValues=s=>{const i=t.objectKeys(s).filter(a=>typeof s[s[a]]!="number"),o={};for(const a of i)o[a]=s[a];return t.objectValues(o)},t.objectValues=s=>t.objectKeys(s).map(function(i){return s[i]}),t.objectKeys=typeof Object.keys=="function"?s=>Object.keys(s):s=>{const i=[];for(const o in s)Object.prototype.hasOwnProperty.call(s,o)&&i.push(o);return i},t.find=(s,i)=>{for(const o of s)if(i(o))return o},t.isInteger=typeof Number.isInteger=="function"?s=>Number.isInteger(s):s=>typeof s=="number"&&Number.isFinite(s)&&Math.floor(s)===s;function n(s,i=" | "){return s.map(o=>typeof o=="string"?`'${o}'`:o).join(i)}t.joinValues=n,t.jsonStringifyReplacer=(s,i)=>typeof i=="bigint"?i.toString():i})(oe||(oe={}));var ud;(function(t){t.mergeShapes=(e,r)=>({...e,...r})})(ud||(ud={}));const L=oe.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),At=t=>{switch(typeof t){case"undefined":return L.undefined;case"string":return L.string;case"number":return Number.isNaN(t)?L.nan:L.number;case"boolean":return L.boolean;case"function":return L.function;case"bigint":return L.bigint;case"symbol":return L.symbol;case"object":return Array.isArray(t)?L.array:t===null?L.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?L.promise:typeof Map<"u"&&t instanceof Map?L.map:typeof Set<"u"&&t instanceof Set?L.set:typeof Date<"u"&&t instanceof Date?L.date:L.object;default:return L.unknown}},I=oe.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 bt 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(i){return i.message},n={_errors:[]},s=i=>{for(const o of i.issues)if(o.code==="invalid_union")o.unionErrors.map(s);else if(o.code==="invalid_return_type")s(o.returnTypeError);else if(o.code==="invalid_arguments")s(o.argumentsError);else if(o.path.length===0)n._errors.push(r(o));else{let a=n,c=0;for(;c<o.path.length;){const u=o.path[c];c===o.path.length-1?(a[u]=a[u]||{_errors:[]},a[u]._errors.push(r(o))):a[u]=a[u]||{_errors:[]},a=a[u],c++}}};return s(this),n}static assert(e){if(!(e instanceof bt))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,oe.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 i=s.path[0];r[i]=r[i]||[],r[i].push(e(s))}else n.push(e(s));return{formErrors:n,fieldErrors:r}}get formErrors(){return this.flatten()}}bt.create=t=>new bt(t);const Eo=(t,e)=>{let r;switch(t.code){case I.invalid_type:t.received===L.undefined?r="Required":r=`Expected ${t.expected}, received ${t.received}`;break;case I.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(t.expected,oe.jsonStringifyReplacer)}`;break;case I.unrecognized_keys:r=`Unrecognized key(s) in object: ${oe.joinValues(t.keys,", ")}`;break;case I.invalid_union:r="Invalid input";break;case I.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${oe.joinValues(t.options)}`;break;case I.invalid_enum_value:r=`Invalid enum value. Expected ${oe.joinValues(t.options)}, received '${t.received}'`;break;case I.invalid_arguments:r="Invalid function arguments";break;case I.invalid_return_type:r="Invalid function return type";break;case I.invalid_date:r="Invalid date";break;case I.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}"`:oe.assertNever(t.validation):t.validation!=="regex"?r=`Invalid ${t.validation}`:r="Invalid";break;case I.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 I.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 I.custom:r="Invalid input";break;case I.invalid_intersection_types:r="Intersection results could not be merged";break;case I.not_multiple_of:r=`Number must be a multiple of ${t.multipleOf}`;break;case I.not_finite:r="Number must be finite";break;default:r=e.defaultError,oe.assertNever(t)}return{message:r}};let D0=Eo;function q0(){return D0}const V0=t=>{const{data:e,path:r,errorMaps:n,issueData:s}=t,i=[...r,...s.path||[]],o={...s,path:i};if(s.message!==void 0)return{...s,path:i,message:s.message};let a="";const c=n.filter(u=>!!u).slice().reverse();for(const u of c)a=u(o,{data:e,defaultError:a}).message;return{...s,path:i,message:a}};function Z(t,e){const r=q0(),n=V0({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,r,r===Eo?void 0:Eo].filter(s=>!!s)});t.common.issues.push(n)}class Je{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 J;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 i=await s.key,o=await s.value;n.push({key:i,value:o})}return Je.mergeObjectSync(e,n)}static mergeObjectSync(e,r){const n={};for(const s of r){const{key:i,value:o}=s;if(i.status==="aborted"||o.status==="aborted")return J;i.status==="dirty"&&e.dirty(),o.status==="dirty"&&e.dirty(),i.value!=="__proto__"&&(typeof o.value<"u"||s.alwaysSet)&&(n[i.value]=o.value)}return{status:e.value,value:n}}}const J=Object.freeze({status:"aborted"}),en=t=>({status:"dirty",value:t}),Ye=t=>({status:"valid",value:t}),ld=t=>t.status==="aborted",dd=t=>t.status==="dirty",fr=t=>t.status==="valid",fs=t=>typeof Promise<"u"&&t instanceof Promise;var U;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(U||(U={}));class jt{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 fd=(t,e)=>{if(fr(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 bt(t.common.issues);return this._error=r,this._error}}};function te(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:(o,a)=>{const{message:c}=t;return o.code==="invalid_enum_value"?{message:c??a.defaultError}:typeof a.data>"u"?{message:c??n??a.defaultError}:o.code!=="invalid_type"?{message:a.defaultError}:{message:c??r??a.defaultError}},description:s}}class ie{get description(){return this._def.description}_getType(e){return At(e.data)}_getOrReturnCtx(e,r){return r||{common:e.parent.common,data:e.data,parsedType:At(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new Je,ctx:{common:e.parent.common,data:e.data,parsedType:At(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const r=this._parse(e);if(fs(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==null?void 0:r.async)??!1,contextualErrorMap:r==null?void 0:r.errorMap},path:(r==null?void 0:r.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:At(e)},s=this._parseSync({data:e,path:n.path,parent:n});return fd(n,s)}"~validate"(e){var n,s;const r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:At(e)};if(!this["~standard"].async)try{const i=this._parseSync({data:e,path:[],parent:r});return fr(i)?{value:i.value}:{issues:r.common.issues}}catch(i){(s=(n=i==null?void 0:i.message)==null?void 0:n.toLowerCase())!=null&&s.includes("encountered")&&(this["~standard"].async=!0),r.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:r}).then(i=>fr(i)?{value:i.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==null?void 0:r.errorMap,async:!0},path:(r==null?void 0:r.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:At(e)},s=this._parse({data:e,path:n.path,parent:n}),i=await(fs(s)?s:Promise.resolve(s));return fd(n,i)}refine(e,r){const n=s=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(s):r;return this._refinement((s,i)=>{const o=e(s),a=()=>i.addIssue({code:I.custom,...n(s)});return typeof Promise<"u"&&o instanceof Promise?o.then(c=>c?!0:(a(),!1)):o?!0:(a(),!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 mr({schema:this,typeName:N.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 Mt.create(this,this._def)}nullable(){return _r.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return mt.create(this)}promise(){return _s.create(this,this._def)}or(e){return ps.create([this,e],this._def)}and(e){return ms.create(this,e,this._def)}transform(e){return new mr({...te(this._def),schema:this,typeName:N.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const r=typeof e=="function"?e:()=>e;return new To({...te(this._def),innerType:this,defaultValue:r,typeName:N.ZodDefault})}brand(){return new fb({typeName:N.ZodBranded,type:this,...te(this._def)})}catch(e){const r=typeof e=="function"?e:()=>e;return new Co({...te(this._def),innerType:this,catchValue:r,typeName:N.ZodCatch})}describe(e){const r=this.constructor;return new r({...this._def,description:e})}pipe(e){return Oo.create(this,e)}readonly(){return Io.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const F0=/^c[^\s-]{8,}$/i,H0=/^[0-9a-z]+$/,W0=/^[0-9A-HJKMNP-TV-Z]{26}$/i,K0=/^[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,J0=/^[a-z0-9_-]{21}$/i,B0=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,G0=/^[-+]?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)?)??$/,Y0=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,X0="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let Po;const Q0=/^(?:(?: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])$/,eb=/^(?:(?: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])$/,tb=/^(([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]))$/,rb=/^(([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])$/,nb=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,sb=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,hd="((\\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])))",ib=new RegExp(`^${hd}$`);function pd(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 ob(t){return new RegExp(`^${pd(t)}$`)}function ab(t){let e=`${hd}T${pd(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 cb(t,e){return!!((e==="v4"||!e)&&Q0.test(t)||(e==="v6"||!e)&&tb.test(t))}function ub(t,e){if(!B0.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==null?void 0:s.typ)!=="JWT"||!s.alg||e&&s.alg!==e)}catch{return!1}}function lb(t,e){return!!((e==="v4"||!e)&&eb.test(t)||(e==="v6"||!e)&&rb.test(t))}class Bt extends ie{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==L.string){const i=this._getOrReturnCtx(e);return Z(i,{code:I.invalid_type,expected:L.string,received:i.parsedType}),J}const n=new Je;let s;for(const i of this._def.checks)if(i.kind==="min")e.data.length<i.value&&(s=this._getOrReturnCtx(e,s),Z(s,{code:I.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),n.dirty());else if(i.kind==="max")e.data.length>i.value&&(s=this._getOrReturnCtx(e,s),Z(s,{code:I.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),n.dirty());else if(i.kind==="length"){const o=e.data.length>i.value,a=e.data.length<i.value;(o||a)&&(s=this._getOrReturnCtx(e,s),o?Z(s,{code:I.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):a&&Z(s,{code:I.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),n.dirty())}else if(i.kind==="email")Y0.test(e.data)||(s=this._getOrReturnCtx(e,s),Z(s,{validation:"email",code:I.invalid_string,message:i.message}),n.dirty());else if(i.kind==="emoji")Po||(Po=new RegExp(X0,"u")),Po.test(e.data)||(s=this._getOrReturnCtx(e,s),Z(s,{validation:"emoji",code:I.invalid_string,message:i.message}),n.dirty());else if(i.kind==="uuid")K0.test(e.data)||(s=this._getOrReturnCtx(e,s),Z(s,{validation:"uuid",code:I.invalid_string,message:i.message}),n.dirty());else if(i.kind==="nanoid")J0.test(e.data)||(s=this._getOrReturnCtx(e,s),Z(s,{validation:"nanoid",code:I.invalid_string,message:i.message}),n.dirty());else if(i.kind==="cuid")F0.test(e.data)||(s=this._getOrReturnCtx(e,s),Z(s,{validation:"cuid",code:I.invalid_string,message:i.message}),n.dirty());else if(i.kind==="cuid2")H0.test(e.data)||(s=this._getOrReturnCtx(e,s),Z(s,{validation:"cuid2",code:I.invalid_string,message:i.message}),n.dirty());else if(i.kind==="ulid")W0.test(e.data)||(s=this._getOrReturnCtx(e,s),Z(s,{validation:"ulid",code:I.invalid_string,message:i.message}),n.dirty());else if(i.kind==="url")try{new URL(e.data)}catch{s=this._getOrReturnCtx(e,s),Z(s,{validation:"url",code:I.invalid_string,message:i.message}),n.dirty()}else i.kind==="regex"?(i.regex.lastIndex=0,i.regex.test(e.data)||(s=this._getOrReturnCtx(e,s),Z(s,{validation:"regex",code:I.invalid_string,message:i.message}),n.dirty())):i.kind==="trim"?e.data=e.data.trim():i.kind==="includes"?e.data.includes(i.value,i.position)||(s=this._getOrReturnCtx(e,s),Z(s,{code:I.invalid_string,validation:{includes:i.value,position:i.position},message:i.message}),n.dirty()):i.kind==="toLowerCase"?e.data=e.data.toLowerCase():i.kind==="toUpperCase"?e.data=e.data.toUpperCase():i.kind==="startsWith"?e.data.startsWith(i.value)||(s=this._getOrReturnCtx(e,s),Z(s,{code:I.invalid_string,validation:{startsWith:i.value},message:i.message}),n.dirty()):i.kind==="endsWith"?e.data.endsWith(i.value)||(s=this._getOrReturnCtx(e,s),Z(s,{code:I.invalid_string,validation:{endsWith:i.value},message:i.message}),n.dirty()):i.kind==="datetime"?ab(i).test(e.data)||(s=this._getOrReturnCtx(e,s),Z(s,{code:I.invalid_string,validation:"datetime",message:i.message}),n.dirty()):i.kind==="date"?ib.test(e.data)||(s=this._getOrReturnCtx(e,s),Z(s,{code:I.invalid_string,validation:"date",message:i.message}),n.dirty()):i.kind==="time"?ob(i).test(e.data)||(s=this._getOrReturnCtx(e,s),Z(s,{code:I.invalid_string,validation:"time",message:i.message}),n.dirty()):i.kind==="duration"?G0.test(e.data)||(s=this._getOrReturnCtx(e,s),Z(s,{validation:"duration",code:I.invalid_string,message:i.message}),n.dirty()):i.kind==="ip"?cb(e.data,i.version)||(s=this._getOrReturnCtx(e,s),Z(s,{validation:"ip",code:I.invalid_string,message:i.message}),n.dirty()):i.kind==="jwt"?ub(e.data,i.alg)||(s=this._getOrReturnCtx(e,s),Z(s,{validation:"jwt",code:I.invalid_string,message:i.message}),n.dirty()):i.kind==="cidr"?lb(e.data,i.version)||(s=this._getOrReturnCtx(e,s),Z(s,{validation:"cidr",code:I.invalid_string,message:i.message}),n.dirty()):i.kind==="base64"?nb.test(e.data)||(s=this._getOrReturnCtx(e,s),Z(s,{validation:"base64",code:I.invalid_string,message:i.message}),n.dirty()):i.kind==="base64url"?sb.test(e.data)||(s=this._getOrReturnCtx(e,s),Z(s,{validation:"base64url",code:I.invalid_string,message:i.message}),n.dirty()):oe.assertNever(i);return{status:n.value,value:e.data}}_regex(e,r,n){return this.refinement(s=>e.test(s),{validation:r,code:I.invalid_string,...U.errToObj(n)})}_addCheck(e){return new Bt({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...U.errToObj(e)})}url(e){return this._addCheck({kind:"url",...U.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...U.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...U.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...U.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...U.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...U.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...U.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...U.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...U.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...U.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...U.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...U.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==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,offset:(e==null?void 0:e.offset)??!1,local:(e==null?void 0:e.local)??!1,...U.errToObj(e==null?void 0: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==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,...U.errToObj(e==null?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...U.errToObj(e)})}regex(e,r){return this._addCheck({kind:"regex",regex:e,...U.errToObj(r)})}includes(e,r){return this._addCheck({kind:"includes",value:e,position:r==null?void 0:r.position,...U.errToObj(r==null?void 0:r.message)})}startsWith(e,r){return this._addCheck({kind:"startsWith",value:e,...U.errToObj(r)})}endsWith(e,r){return this._addCheck({kind:"endsWith",value:e,...U.errToObj(r)})}min(e,r){return this._addCheck({kind:"min",value:e,...U.errToObj(r)})}max(e,r){return this._addCheck({kind:"max",value:e,...U.errToObj(r)})}length(e,r){return this._addCheck({kind:"length",value:e,...U.errToObj(r)})}nonempty(e){return this.min(1,U.errToObj(e))}trim(){return new Bt({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new Bt({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new Bt({...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}}Bt.create=t=>new Bt({checks:[],typeName:N.ZodString,coerce:(t==null?void 0:t.coerce)??!1,...te(t)});function db(t,e){const r=(t.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,s=r>n?r:n,i=Number.parseInt(t.toFixed(s).replace(".","")),o=Number.parseInt(e.toFixed(s).replace(".",""));return i%o/10**s}class tn extends ie{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)!==L.number){const i=this._getOrReturnCtx(e);return Z(i,{code:I.invalid_type,expected:L.number,received:i.parsedType}),J}let n;const s=new Je;for(const i of this._def.checks)i.kind==="int"?oe.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),Z(n,{code:I.invalid_type,expected:"integer",received:"float",message:i.message}),s.dirty()):i.kind==="min"?(i.inclusive?e.data<i.value:e.data<=i.value)&&(n=this._getOrReturnCtx(e,n),Z(n,{code:I.too_small,minimum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),s.dirty()):i.kind==="max"?(i.inclusive?e.data>i.value:e.data>=i.value)&&(n=this._getOrReturnCtx(e,n),Z(n,{code:I.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),s.dirty()):i.kind==="multipleOf"?db(e.data,i.value)!==0&&(n=this._getOrReturnCtx(e,n),Z(n,{code:I.not_multiple_of,multipleOf:i.value,message:i.message}),s.dirty()):i.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),Z(n,{code:I.not_finite,message:i.message}),s.dirty()):oe.assertNever(i);return{status:s.value,value:e.data}}gte(e,r){return this.setLimit("min",e,!0,U.toString(r))}gt(e,r){return this.setLimit("min",e,!1,U.toString(r))}lte(e,r){return this.setLimit("max",e,!0,U.toString(r))}lt(e,r){return this.setLimit("max",e,!1,U.toString(r))}setLimit(e,r,n,s){return new tn({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:U.toString(s)}]})}_addCheck(e){return new tn({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:U.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:U.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:U.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:U.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:U.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:U.toString(r)})}finite(e){return this._addCheck({kind:"finite",message:U.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:U.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:U.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"&&oe.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)}}tn.create=t=>new tn({checks:[],typeName:N.ZodNumber,coerce:(t==null?void 0:t.coerce)||!1,...te(t)});class rn extends ie{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)!==L.bigint)return this._getInvalidInput(e);let n;const s=new Je;for(const i of this._def.checks)i.kind==="min"?(i.inclusive?e.data<i.value:e.data<=i.value)&&(n=this._getOrReturnCtx(e,n),Z(n,{code:I.too_small,type:"bigint",minimum:i.value,inclusive:i.inclusive,message:i.message}),s.dirty()):i.kind==="max"?(i.inclusive?e.data>i.value:e.data>=i.value)&&(n=this._getOrReturnCtx(e,n),Z(n,{code:I.too_big,type:"bigint",maximum:i.value,inclusive:i.inclusive,message:i.message}),s.dirty()):i.kind==="multipleOf"?e.data%i.value!==BigInt(0)&&(n=this._getOrReturnCtx(e,n),Z(n,{code:I.not_multiple_of,multipleOf:i.value,message:i.message}),s.dirty()):oe.assertNever(i);return{status:s.value,value:e.data}}_getInvalidInput(e){const r=this._getOrReturnCtx(e);return Z(r,{code:I.invalid_type,expected:L.bigint,received:r.parsedType}),J}gte(e,r){return this.setLimit("min",e,!0,U.toString(r))}gt(e,r){return this.setLimit("min",e,!1,U.toString(r))}lte(e,r){return this.setLimit("max",e,!0,U.toString(r))}lt(e,r){return this.setLimit("max",e,!1,U.toString(r))}setLimit(e,r,n,s){return new rn({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:U.toString(s)}]})}_addCheck(e){return new rn({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:U.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:U.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:U.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:U.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:U.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}}rn.create=t=>new rn({checks:[],typeName:N.ZodBigInt,coerce:(t==null?void 0:t.coerce)??!1,...te(t)});class md extends ie{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==L.boolean){const n=this._getOrReturnCtx(e);return Z(n,{code:I.invalid_type,expected:L.boolean,received:n.parsedType}),J}return Ye(e.data)}}md.create=t=>new md({typeName:N.ZodBoolean,coerce:(t==null?void 0:t.coerce)||!1,...te(t)});class hs extends ie{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==L.date){const i=this._getOrReturnCtx(e);return Z(i,{code:I.invalid_type,expected:L.date,received:i.parsedType}),J}if(Number.isNaN(e.data.getTime())){const i=this._getOrReturnCtx(e);return Z(i,{code:I.invalid_date}),J}const n=new Je;let s;for(const i of this._def.checks)i.kind==="min"?e.data.getTime()<i.value&&(s=this._getOrReturnCtx(e,s),Z(s,{code:I.too_small,message:i.message,inclusive:!0,exact:!1,minimum:i.value,type:"date"}),n.dirty()):i.kind==="max"?e.data.getTime()>i.value&&(s=this._getOrReturnCtx(e,s),Z(s,{code:I.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),n.dirty()):oe.assertNever(i);return{status:n.value,value:new Date(e.data.getTime())}}_addCheck(e){return new hs({...this._def,checks:[...this._def.checks,e]})}min(e,r){return this._addCheck({kind:"min",value:e.getTime(),message:U.toString(r)})}max(e,r){return this._addCheck({kind:"max",value:e.getTime(),message:U.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}}hs.create=t=>new hs({checks:[],coerce:(t==null?void 0:t.coerce)||!1,typeName:N.ZodDate,...te(t)});class _d extends ie{_parse(e){if(this._getType(e)!==L.symbol){const n=this._getOrReturnCtx(e);return Z(n,{code:I.invalid_type,expected:L.symbol,received:n.parsedType}),J}return Ye(e.data)}}_d.create=t=>new _d({typeName:N.ZodSymbol,...te(t)});class gd extends ie{_parse(e){if(this._getType(e)!==L.undefined){const n=this._getOrReturnCtx(e);return Z(n,{code:I.invalid_type,expected:L.undefined,received:n.parsedType}),J}return Ye(e.data)}}gd.create=t=>new gd({typeName:N.ZodUndefined,...te(t)});class vd extends ie{_parse(e){if(this._getType(e)!==L.null){const n=this._getOrReturnCtx(e);return Z(n,{code:I.invalid_type,expected:L.null,received:n.parsedType}),J}return Ye(e.data)}}vd.create=t=>new vd({typeName:N.ZodNull,...te(t)});class yd extends ie{constructor(){super(...arguments),this._any=!0}_parse(e){return Ye(e.data)}}yd.create=t=>new yd({typeName:N.ZodAny,...te(t)});class bd extends ie{constructor(){super(...arguments),this._unknown=!0}_parse(e){return Ye(e.data)}}bd.create=t=>new bd({typeName:N.ZodUnknown,...te(t)});class zt extends ie{_parse(e){const r=this._getOrReturnCtx(e);return Z(r,{code:I.invalid_type,expected:L.never,received:r.parsedType}),J}}zt.create=t=>new zt({typeName:N.ZodNever,...te(t)});class wd extends ie{_parse(e){if(this._getType(e)!==L.undefined){const n=this._getOrReturnCtx(e);return Z(n,{code:I.invalid_type,expected:L.void,received:n.parsedType}),J}return Ye(e.data)}}wd.create=t=>new wd({typeName:N.ZodVoid,...te(t)});class mt extends ie{_parse(e){const{ctx:r,status:n}=this._processInputParams(e),s=this._def;if(r.parsedType!==L.array)return Z(r,{code:I.invalid_type,expected:L.array,received:r.parsedType}),J;if(s.exactLength!==null){const o=r.data.length>s.exactLength.value,a=r.data.length<s.exactLength.value;(o||a)&&(Z(r,{code:o?I.too_big:I.too_small,minimum:a?s.exactLength.value:void 0,maximum:o?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&&(Z(r,{code:I.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&&(Z(r,{code:I.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((o,a)=>s.type._parseAsync(new jt(r,o,r.path,a)))).then(o=>Je.mergeArray(n,o));const i=[...r.data].map((o,a)=>s.type._parseSync(new jt(r,o,r.path,a)));return Je.mergeArray(n,i)}get element(){return this._def.type}min(e,r){return new mt({...this._def,minLength:{value:e,message:U.toString(r)}})}max(e,r){return new mt({...this._def,maxLength:{value:e,message:U.toString(r)}})}length(e,r){return new mt({...this._def,exactLength:{value:e,message:U.toString(r)}})}nonempty(e){return this.min(1,e)}}mt.create=(t,e)=>new mt({type:t,minLength:null,maxLength:null,exactLength:null,typeName:N.ZodArray,...te(e)});function hr(t){if(t instanceof Re){const e={};for(const r in t.shape){const n=t.shape[r];e[r]=Mt.create(hr(n))}return new Re({...t._def,shape:()=>e})}else return t instanceof mt?new mt({...t._def,type:hr(t.element)}):t instanceof Mt?Mt.create(hr(t.unwrap())):t instanceof _r?_r.create(hr(t.unwrap())):t instanceof Gt?Gt.create(t.items.map(e=>hr(e))):t}class Re extends ie{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=oe.objectKeys(e);return this._cached={shape:e,keys:r},this._cached}_parse(e){if(this._getType(e)!==L.object){const u=this._getOrReturnCtx(e);return Z(u,{code:I.invalid_type,expected:L.object,received:u.parsedType}),J}const{status:n,ctx:s}=this._processInputParams(e),{shape:i,keys:o}=this._getCached(),a=[];if(!(this._def.catchall instanceof zt&&this._def.unknownKeys==="strip"))for(const u in s.data)o.includes(u)||a.push(u);const c=[];for(const u of o){const l=i[u],f=s.data[u];c.push({key:{status:"valid",value:u},value:l._parse(new jt(s,f,s.path,u)),alwaysSet:u in s.data})}if(this._def.catchall instanceof zt){const u=this._def.unknownKeys;if(u==="passthrough")for(const l of a)c.push({key:{status:"valid",value:l},value:{status:"valid",value:s.data[l]}});else if(u==="strict")a.length>0&&(Z(s,{code:I.unrecognized_keys,keys:a}),n.dirty());else if(u!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const u=this._def.catchall;for(const l of a){const f=s.data[l];c.push({key:{status:"valid",value:l},value:u._parse(new jt(s,f,s.path,l)),alwaysSet:l in s.data})}}return s.common.async?Promise.resolve().then(async()=>{const u=[];for(const l of c){const f=await l.key,w=await l.value;u.push({key:f,value:w,alwaysSet:l.alwaysSet})}return u}).then(u=>Je.mergeObjectSync(n,u)):Je.mergeObjectSync(n,c)}get shape(){return this._def.shape()}strict(e){return U.errToObj,new Re({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(r,n)=>{var i,o;const s=((o=(i=this._def).errorMap)==null?void 0:o.call(i,r,n).message)??n.defaultError;return r.code==="unrecognized_keys"?{message:U.errToObj(e).message??s}:{message:s}}}:{}})}strip(){return new Re({...this._def,unknownKeys:"strip"})}passthrough(){return new Re({...this._def,unknownKeys:"passthrough"})}extend(e){return new Re({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new Re({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:N.ZodObject})}setKey(e,r){return this.augment({[e]:r})}catchall(e){return new Re({...this._def,catchall:e})}pick(e){const r={};for(const n of oe.objectKeys(e))e[n]&&this.shape[n]&&(r[n]=this.shape[n]);return new Re({...this._def,shape:()=>r})}omit(e){const r={};for(const n of oe.objectKeys(this.shape))e[n]||(r[n]=this.shape[n]);return new Re({...this._def,shape:()=>r})}deepPartial(){return hr(this)}partial(e){const r={};for(const n of oe.objectKeys(this.shape)){const s=this.shape[n];e&&!e[n]?r[n]=s:r[n]=s.optional()}return new Re({...this._def,shape:()=>r})}required(e){const r={};for(const n of oe.objectKeys(this.shape))if(e&&!e[n])r[n]=this.shape[n];else{let i=this.shape[n];for(;i instanceof Mt;)i=i._def.innerType;r[n]=i}return new Re({...this._def,shape:()=>r})}keyof(){return Ed(oe.objectKeys(this.shape))}}Re.create=(t,e)=>new Re({shape:()=>t,unknownKeys:"strip",catchall:zt.create(),typeName:N.ZodObject,...te(e)}),Re.strictCreate=(t,e)=>new Re({shape:()=>t,unknownKeys:"strict",catchall:zt.create(),typeName:N.ZodObject,...te(e)}),Re.lazycreate=(t,e)=>new Re({shape:t,unknownKeys:"strip",catchall:zt.create(),typeName:N.ZodObject,...te(e)});class ps extends ie{_parse(e){const{ctx:r}=this._processInputParams(e),n=this._def.options;function s(i){for(const a of i)if(a.result.status==="valid")return a.result;for(const a of i)if(a.result.status==="dirty")return r.common.issues.push(...a.ctx.common.issues),a.result;const o=i.map(a=>new bt(a.ctx.common.issues));return Z(r,{code:I.invalid_union,unionErrors:o}),J}if(r.common.async)return Promise.all(n.map(async i=>{const o={...r,common:{...r.common,issues:[]},parent:null};return{result:await i._parseAsync({data:r.data,path:r.path,parent:o}),ctx:o}})).then(s);{let i;const o=[];for(const c of n){const u={...r,common:{...r.common,issues:[]},parent:null},l=c._parseSync({data:r.data,path:r.path,parent:u});if(l.status==="valid")return l;l.status==="dirty"&&!i&&(i={result:l,ctx:u}),u.common.issues.length&&o.push(u.common.issues)}if(i)return r.common.issues.push(...i.ctx.common.issues),i.result;const a=o.map(c=>new bt(c));return Z(r,{code:I.invalid_union,unionErrors:a}),J}}get options(){return this._def.options}}ps.create=(t,e)=>new ps({options:t,typeName:N.ZodUnion,...te(e)});function Ro(t,e){const r=At(t),n=At(e);if(t===e)return{valid:!0,data:t};if(r===L.object&&n===L.object){const s=oe.objectKeys(e),i=oe.objectKeys(t).filter(a=>s.indexOf(a)!==-1),o={...t,...e};for(const a of i){const c=Ro(t[a],e[a]);if(!c.valid)return{valid:!1};o[a]=c.data}return{valid:!0,data:o}}else if(r===L.array&&n===L.array){if(t.length!==e.length)return{valid:!1};const s=[];for(let i=0;i<t.length;i++){const o=t[i],a=e[i],c=Ro(o,a);if(!c.valid)return{valid:!1};s.push(c.data)}return{valid:!0,data:s}}else return r===L.date&&n===L.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}class ms extends ie{_parse(e){const{status:r,ctx:n}=this._processInputParams(e),s=(i,o)=>{if(ld(i)||ld(o))return J;const a=Ro(i.value,o.value);return a.valid?((dd(i)||dd(o))&&r.dirty(),{status:r.value,value:a.data}):(Z(n,{code:I.invalid_intersection_types}),J)};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(([i,o])=>s(i,o)):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}))}}ms.create=(t,e,r)=>new ms({left:t,right:e,typeName:N.ZodIntersection,...te(r)});class Gt extends ie{_parse(e){const{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==L.array)return Z(n,{code:I.invalid_type,expected:L.array,received:n.parsedType}),J;if(n.data.length<this._def.items.length)return Z(n,{code:I.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),J;!this._def.rest&&n.data.length>this._def.items.length&&(Z(n,{code:I.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());const i=[...n.data].map((o,a)=>{const c=this._def.items[a]||this._def.rest;return c?c._parse(new jt(n,o,n.path,a)):null}).filter(o=>!!o);return n.common.async?Promise.all(i).then(o=>Je.mergeArray(r,o)):Je.mergeArray(r,i)}get items(){return this._def.items}rest(e){return new Gt({...this._def,rest:e})}}Gt.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Gt({items:t,typeName:N.ZodTuple,rest:null,...te(e)})};class $d extends ie{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!==L.map)return Z(n,{code:I.invalid_type,expected:L.map,received:n.parsedType}),J;const s=this._def.keyType,i=this._def.valueType,o=[...n.data.entries()].map(([a,c],u)=>({key:s._parse(new jt(n,a,n.path,[u,"key"])),value:i._parse(new jt(n,c,n.path,[u,"value"]))}));if(n.common.async){const a=new Map;return Promise.resolve().then(async()=>{for(const c of o){const u=await c.key,l=await c.value;if(u.status==="aborted"||l.status==="aborted")return J;(u.status==="dirty"||l.status==="dirty")&&r.dirty(),a.set(u.value,l.value)}return{status:r.value,value:a}})}else{const a=new Map;for(const c of o){const u=c.key,l=c.value;if(u.status==="aborted"||l.status==="aborted")return J;(u.status==="dirty"||l.status==="dirty")&&r.dirty(),a.set(u.value,l.value)}return{status:r.value,value:a}}}}$d.create=(t,e,r)=>new $d({valueType:e,keyType:t,typeName:N.ZodMap,...te(r)});class nn extends ie{_parse(e){const{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==L.set)return Z(n,{code:I.invalid_type,expected:L.set,received:n.parsedType}),J;const s=this._def;s.minSize!==null&&n.data.size<s.minSize.value&&(Z(n,{code:I.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&&(Z(n,{code:I.too_big,maximum:s.maxSize.value,type:"set",inclusive:!0,exact:!1,message:s.maxSize.message}),r.dirty());const i=this._def.valueType;function o(c){const u=new Set;for(const l of c){if(l.status==="aborted")return J;l.status==="dirty"&&r.dirty(),u.add(l.value)}return{status:r.value,value:u}}const a=[...n.data.values()].map((c,u)=>i._parse(new jt(n,c,n.path,u)));return n.common.async?Promise.all(a).then(c=>o(c)):o(a)}min(e,r){return new nn({...this._def,minSize:{value:e,message:U.toString(r)}})}max(e,r){return new nn({...this._def,maxSize:{value:e,message:U.toString(r)}})}size(e,r){return this.min(e,r).max(e,r)}nonempty(e){return this.min(1,e)}}nn.create=(t,e)=>new nn({valueType:t,minSize:null,maxSize:null,typeName:N.ZodSet,...te(e)});class Sd extends ie{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})}}Sd.create=(t,e)=>new Sd({getter:t,typeName:N.ZodLazy,...te(e)});class kd extends ie{_parse(e){if(e.data!==this._def.value){const r=this._getOrReturnCtx(e);return Z(r,{received:r.data,code:I.invalid_literal,expected:this._def.value}),J}return{status:"valid",value:e.data}}get value(){return this._def.value}}kd.create=(t,e)=>new kd({value:t,typeName:N.ZodLiteral,...te(e)});function Ed(t,e){return new pr({values:t,typeName:N.ZodEnum,...te(e)})}class pr extends ie{_parse(e){if(typeof e.data!="string"){const r=this._getOrReturnCtx(e),n=this._def.values;return Z(r,{expected:oe.joinValues(n),received:r.parsedType,code:I.invalid_type}),J}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 Z(r,{received:r.data,code:I.invalid_enum_value,options:n}),J}return Ye(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 pr.create(e,{...this._def,...r})}exclude(e,r=this._def){return pr.create(this.options.filter(n=>!e.includes(n)),{...this._def,...r})}}pr.create=Ed;class Pd extends ie{_parse(e){const r=oe.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==L.string&&n.parsedType!==L.number){const s=oe.objectValues(r);return Z(n,{expected:oe.joinValues(s),received:n.parsedType,code:I.invalid_type}),J}if(this._cache||(this._cache=new Set(oe.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){const s=oe.objectValues(r);return Z(n,{received:n.data,code:I.invalid_enum_value,options:s}),J}return Ye(e.data)}get enum(){return this._def.values}}Pd.create=(t,e)=>new Pd({values:t,typeName:N.ZodNativeEnum,...te(e)});class _s extends ie{unwrap(){return this._def.type}_parse(e){const{ctx:r}=this._processInputParams(e);if(r.parsedType!==L.promise&&r.common.async===!1)return Z(r,{code:I.invalid_type,expected:L.promise,received:r.parsedType}),J;const n=r.parsedType===L.promise?r.data:Promise.resolve(r.data);return Ye(n.then(s=>this._def.type.parseAsync(s,{path:r.path,errorMap:r.common.contextualErrorMap})))}}_s.create=(t,e)=>new _s({type:t,typeName:N.ZodPromise,...te(e)});class mr extends ie{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===N.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:r,ctx:n}=this._processInputParams(e),s=this._def.effect||null,i={addIssue:o=>{Z(n,o),o.fatal?r.abort():r.dirty()},get path(){return n.path}};if(i.addIssue=i.addIssue.bind(i),s.type==="preprocess"){const o=s.transform(n.data,i);if(n.common.async)return Promise.resolve(o).then(async a=>{if(r.value==="aborted")return J;const c=await this._def.schema._parseAsync({data:a,path:n.path,parent:n});return c.status==="aborted"?J:c.status==="dirty"||r.value==="dirty"?en(c.value):c});{if(r.value==="aborted")return J;const a=this._def.schema._parseSync({data:o,path:n.path,parent:n});return a.status==="aborted"?J:a.status==="dirty"||r.value==="dirty"?en(a.value):a}}if(s.type==="refinement"){const o=a=>{const c=s.refinement(a,i);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 a};if(n.common.async===!1){const a=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return a.status==="aborted"?J:(a.status==="dirty"&&r.dirty(),o(a.value),{status:r.value,value:a.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(a=>a.status==="aborted"?J:(a.status==="dirty"&&r.dirty(),o(a.value).then(()=>({status:r.value,value:a.value}))))}if(s.type==="transform")if(n.common.async===!1){const o=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!fr(o))return J;const a=s.transform(o.value,i);if(a instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:a}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(o=>fr(o)?Promise.resolve(s.transform(o.value,i)).then(a=>({status:r.value,value:a})):J);oe.assertNever(s)}}mr.create=(t,e,r)=>new mr({schema:t,typeName:N.ZodEffects,effect:e,...te(r)}),mr.createWithPreprocess=(t,e,r)=>new mr({schema:e,effect:{type:"preprocess",transform:t},typeName:N.ZodEffects,...te(r)});class Mt extends ie{_parse(e){return this._getType(e)===L.undefined?Ye(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Mt.create=(t,e)=>new Mt({innerType:t,typeName:N.ZodOptional,...te(e)});class _r extends ie{_parse(e){return this._getType(e)===L.null?Ye(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}_r.create=(t,e)=>new _r({innerType:t,typeName:N.ZodNullable,...te(e)});class To extends ie{_parse(e){const{ctx:r}=this._processInputParams(e);let n=r.data;return r.parsedType===L.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}}To.create=(t,e)=>new To({innerType:t,typeName:N.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...te(e)});class Co extends ie{_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 fs(s)?s.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new bt(n.common.issues)},input:n.data})})):{status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new bt(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}}Co.create=(t,e)=>new Co({innerType:t,typeName:N.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...te(e)});class Rd extends ie{_parse(e){if(this._getType(e)!==L.nan){const n=this._getOrReturnCtx(e);return Z(n,{code:I.invalid_type,expected:L.nan,received:n.parsedType}),J}return{status:"valid",value:e.data}}}Rd.create=t=>new Rd({typeName:N.ZodNaN,...te(t)});class fb extends ie{_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 Oo extends ie{_parse(e){const{status:r,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{const i=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return i.status==="aborted"?J:i.status==="dirty"?(r.dirty(),en(i.value)):this._def.out._parseAsync({data:i.value,path:n.path,parent:n})})();{const s=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return s.status==="aborted"?J: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 Oo({in:e,out:r,typeName:N.ZodPipeline})}}class Io extends ie{_parse(e){const r=this._def.innerType._parse(e),n=s=>(fr(s)&&(s.value=Object.freeze(s.value)),s);return fs(r)?r.then(s=>n(s)):n(r)}unwrap(){return this._def.innerType}}Io.create=(t,e)=>new Io({innerType:t,typeName:N.ZodReadonly,...te(e)});var N;(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"})(N||(N={})),zt.create,mt.create;const hb=Re.create;ps.create,ms.create,Gt.create,pr.create,_s.create,Mt.create,_r.create;const pb=R("ZodMiniType",(t,e)=>{if(!t._zod)throw new Error("Uninitialized schema in ZodMiniType.");he.init(t,e),t.def=e,t.parse=(r,n)=>F_(t,r,n,{callee:t.parse}),t.safeParse=(r,n)=>Zi(t,r,n),t.parseAsync=async(r,n)=>H_(t,r,n,{callee:t.parseAsync}),t.safeParseAsync=async(r,n)=>xi(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)=>Ot(t,r,n),t.brand=()=>t,t.register=(r,n)=>(r.add(t,n),t)}),mb=R("ZodMiniObject",(t,e)=>{gu.init(t,e),pb.init(t,e),fe(t,"shape",()=>e.shape)});function Td(t,e){const r={type:"object",get shape(){return Lr(this,"shape",{...t}),this.shape},...D(e)};return new mb(r)}function ot(t){return!!t._zod}function sn(t){const e=Object.values(t);if(e.length===0)return Td({});const r=e.every(ot),n=e.every(s=>!ot(s));if(r)return Td(t);if(n)return hb(t);throw new Error("Mixed Zod versions detected in object shape.")}function gs(t,e){return ot(t)?Zi(t,e):t.safeParse(e)}async function No(t,e){return ot(t)?await xi(t,e):await t.safeParseAsync(e)}function on(t){var e,r;if(!t)return;let n;if(ot(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 an(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(i=>typeof i=="object"&&i!==null&&(i._def!==void 0||i._zod!==void 0||typeof i.parse=="function")))return sn(t)}}if(ot(t)){const n=(e=t._zod)===null||e===void 0?void 0:e.def;if(n&&(n.typeName==="object"||n.shape!==void 0))return t}else if(t.shape!==void 0)return t}}function Ao(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 _b(t){var e,r,n,s;if(ot(t))return(r=(e=t._zod)===null||e===void 0?void 0:e.def)===null||r===void 0?void 0:r.description;const i=t;return(n=t.description)!==null&&n!==void 0?n:(s=i._def)===null||s===void 0?void 0:s.description}function gb(t){var e,r,n;if(ot(t))return((r=(e=t._zod)===null||e===void 0?void 0:e.def)===null||r===void 0?void 0:r.typeName)==="ZodOptional";const s=t;return typeof t.isOptional=="function"?t.isOptional():((n=s._def)===null||n===void 0?void 0:n.typeName)==="ZodOptional"}function Cd(t){var e;if(ot(t)){const o=(e=t._zod)===null||e===void 0?void 0:e.def;if(o){if(o.value!==void 0)return o.value;if(Array.isArray(o.values)&&o.values.length>0)return o.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}const vb=Symbol("Let zodToJsonSchema decide on which parser to use"),Od={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"},yb=t=>typeof t=="string"?{...Od,name:t}:{...Od,...t},bb=t=>{const e=yb(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 Id(t,e,r,n){n!=null&&n.errorMessages&&r&&(t.errorMessage={...t.errorMessage,[e]:r})}function ue(t,e,r,n,s){t[e]=r,Id(t,e,n,s)}const Nd=(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 He(t){if(t.target!=="openAi")return{};const e=[...t.basePath,t.definitionPath,t.openAiAnyTypeName];return t.flags.hasReferencedOpenAiAnyType=!0,{$ref:t.$refStrategy==="relative"?Nd(e,t.currentPath):e.join("/")}}function wb(t,e){var n,s,i;const r={type:"array"};return(n=t.type)!=null&&n._def&&((i=(s=t.type)==null?void 0:s._def)==null?void 0:i.typeName)!==N.ZodAny&&(r.items=ae(t.type._def,{...e,currentPath:[...e.currentPath,"items"]})),t.minLength&&ue(r,"minItems",t.minLength.value,t.minLength.message,e),t.maxLength&&ue(r,"maxItems",t.maxLength.value,t.maxLength.message,e),t.exactLength&&(ue(r,"minItems",t.exactLength.value,t.exactLength.message,e),ue(r,"maxItems",t.exactLength.value,t.exactLength.message,e)),r}function $b(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?ue(r,"minimum",n.value,n.message,e):ue(r,"exclusiveMinimum",n.value,n.message,e):(n.inclusive||(r.exclusiveMinimum=!0),ue(r,"minimum",n.value,n.message,e));break;case"max":e.target==="jsonSchema7"?n.inclusive?ue(r,"maximum",n.value,n.message,e):ue(r,"exclusiveMaximum",n.value,n.message,e):(n.inclusive||(r.exclusiveMaximum=!0),ue(r,"maximum",n.value,n.message,e));break;case"multipleOf":ue(r,"multipleOf",n.value,n.message,e);break}return r}function Sb(){return{type:"boolean"}}function Ad(t,e){return ae(t.type._def,e)}const kb=(t,e)=>ae(t.innerType._def,e);function jd(t,e,r){const n=r??e.dateStrategy;if(Array.isArray(n))return{anyOf:n.map((s,i)=>jd(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 Eb(t,e)}}const Eb=(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":ue(r,"minimum",n.value,n.message,e);break;case"max":ue(r,"maximum",n.value,n.message,e);break}return r};function Pb(t,e){return{...ae(t.innerType._def,e),default:t.defaultValue()}}function Rb(t,e){return e.effectStrategy==="input"?ae(t.schema._def,e):He(e)}function Tb(t){return{type:"string",enum:Array.from(t.values)}}const Cb=t=>"type"in t&&t.type==="string"?!1:"allOf"in t;function Ob(t,e){const r=[ae(t.left._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),ae(t.right._def,{...e,currentPath:[...e.currentPath,"allOf","1"]})].filter(i=>!!i);let n=e.target==="jsonSchema2019-09"?{unevaluatedProperties:!1}:void 0;const s=[];return r.forEach(i=>{if(Cb(i))s.push(...i.allOf),i.unevaluatedProperties===void 0&&(n=void 0);else{let o=i;if("additionalProperties"in i&&i.additionalProperties===!1){const{additionalProperties:a,...c}=i;o=c}else n=void 0;s.push(o)}}),s.length?{allOf:s,...n}:void 0}function Ib(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 jo;const at={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:()=>(jo===void 0&&(jo=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),jo),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 zd(t,e){const r={type:"string"};if(t.checks)for(const n of t.checks)switch(n.kind){case"min":ue(r,"minLength",typeof r.minLength=="number"?Math.max(r.minLength,n.value):n.value,n.message,e);break;case"max":ue(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":ct(r,"email",n.message,e);break;case"format:idn-email":ct(r,"idn-email",n.message,e);break;case"pattern:zod":De(r,at.email,n.message,e);break}break;case"url":ct(r,"uri",n.message,e);break;case"uuid":ct(r,"uuid",n.message,e);break;case"regex":De(r,n.regex,n.message,e);break;case"cuid":De(r,at.cuid,n.message,e);break;case"cuid2":De(r,at.cuid2,n.message,e);break;case"startsWith":De(r,RegExp(`^${zo(n.value,e)}`),n.message,e);break;case"endsWith":De(r,RegExp(`${zo(n.value,e)}$`),n.message,e);break;case"datetime":ct(r,"date-time",n.message,e);break;case"date":ct(r,"date",n.message,e);break;case"time":ct(r,"time",n.message,e);break;case"duration":ct(r,"duration",n.message,e);break;case"length":ue(r,"minLength",typeof r.minLength=="number"?Math.max(r.minLength,n.value):n.value,n.message,e),ue(r,"maxLength",typeof r.maxLength=="number"?Math.min(r.maxLength,n.value):n.value,n.message,e);break;case"includes":{De(r,RegExp(zo(n.value,e)),n.message,e);break}case"ip":{n.version!=="v6"&&ct(r,"ipv4",n.message,e),n.version!=="v4"&&ct(r,"ipv6",n.message,e);break}case"base64url":De(r,at.base64url,n.message,e);break;case"jwt":De(r,at.jwt,n.message,e);break;case"cidr":{n.version!=="v6"&&De(r,at.ipv4Cidr,n.message,e),n.version!=="v4"&&De(r,at.ipv6Cidr,n.message,e);break}case"emoji":De(r,at.emoji(),n.message,e);break;case"ulid":{De(r,at.ulid,n.message,e);break}case"base64":{switch(e.base64Strategy){case"format:binary":{ct(r,"binary",n.message,e);break}case"contentEncoding:base64":{ue(r,"contentEncoding","base64",n.message,e);break}case"pattern:zod":{De(r,at.base64,n.message,e);break}}break}case"nanoid":De(r,at.nanoid,n.message,e)}return r}function zo(t,e){return e.patternStrategy==="escape"?Ab(t):t}const Nb=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function Ab(t){let e="";for(let r=0;r<t.length;r++)Nb.has(t[r])||(e+="\\"),e+=t[r];return e}function ct(t,e,r,n){var s;t.format||(s=t.anyOf)!=null&&s.some(i=>i.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}}})):ue(t,"format",e,r,n)}function De(t,e,r,n){var s;t.pattern||(s=t.allOf)!=null&&s.some(i=>i.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:Md(e,n),...r&&n.errorMessages&&{errorMessage:{pattern:r}}})):ue(t,"pattern",Md(e,n),r,n)}function Md(t,e){var c;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="",i=!1,o=!1,a=!1;for(let u=0;u<n.length;u++){if(i){s+=n[u],i=!1;continue}if(r.i){if(o){if(n[u].match(/[a-z]/)){a?(s+=n[u],s+=`${n[u-2]}-${n[u]}`.toUpperCase(),a=!1):n[u+1]==="-"&&((c=n[u+2])!=null&&c.match(/[a-z]/))?(s+=n[u],a=!0):s+=`${n[u]}${n[u].toUpperCase()}`;continue}}else if(n[u].match(/[a-z]/)){s+=`[${n[u]}${n[u].toUpperCase()}]`;continue}}if(r.m){if(n[u]==="^"){s+=`(^|(?<=[\r
|
|
36
|
-
]))`;continue}else if(n[u]==="$"){s+=`($|(?=[\r
|
|
37
|
-
]))`;continue}}if(r.s&&n[u]==="."){s+=o?`${n[u]}\r
|
|
38
|
-
`:`[${n[u]}\r
|
|
39
|
-
]`;continue}s+=n[u],n[u]==="\\"?i=!0:o&&n[u]==="]"?o=!1:!o&&n[u]==="["&&(o=!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 Zd(t,e){var n,s,i,o,a,c;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"&&((n=t.keyType)==null?void 0:n._def.typeName)===N.ZodEnum)return{type:"object",required:t.keyType._def.values,properties:t.keyType._def.values.reduce((u,l)=>({...u,[l]:ae(t.valueType._def,{...e,currentPath:[...e.currentPath,"properties",l]})??He(e)}),{}),additionalProperties:e.rejectedAdditionalProperties};const r={type:"object",additionalProperties:ae(t.valueType._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]})??e.allowedAdditionalProperties};if(e.target==="openApi3")return r;if(((s=t.keyType)==null?void 0:s._def.typeName)===N.ZodString&&((i=t.keyType._def.checks)!=null&&i.length)){const{type:u,...l}=zd(t.keyType._def,e);return{...r,propertyNames:l}}else{if(((o=t.keyType)==null?void 0:o._def.typeName)===N.ZodEnum)return{...r,propertyNames:{enum:t.keyType._def.values}};if(((a=t.keyType)==null?void 0:a._def.typeName)===N.ZodBranded&&t.keyType._def.type._def.typeName===N.ZodString&&((c=t.keyType._def.type._def.checks)!=null&&c.length)){const{type:u,...l}=Ad(t.keyType._def,e);return{...r,propertyNames:l}}}return r}function jb(t,e){if(e.mapStrategy==="record")return Zd(t,e);const r=ae(t.keyType._def,{...e,currentPath:[...e.currentPath,"items","items","0"]})||He(e),n=ae(t.valueType._def,{...e,currentPath:[...e.currentPath,"items","items","1"]})||He(e);return{type:"array",maxItems:125,items:{type:"array",items:[r,n],minItems:2,maxItems:2}}}function zb(t){const e=t.values,n=Object.keys(t.values).filter(i=>typeof e[e[i]]!="number").map(i=>e[i]),s=Array.from(new Set(n.map(i=>typeof i)));return{type:s.length===1?s[0]==="string"?"string":"number":["string","number"],enum:n}}function Mb(t){return t.target==="openAi"?void 0:{not:He({...t,currentPath:[...t.currentPath,"not"]})}}function Zb(t){return t.target==="openApi3"?{enum:["null"],nullable:!0}:{type:"null"}}const vs={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};function xb(t,e){if(e.target==="openApi3")return xd(t,e);const r=t.options instanceof Map?Array.from(t.options.values()):t.options;if(r.every(n=>n._def.typeName in vs&&(!n._def.checks||!n._def.checks.length))){const n=r.reduce((s,i)=>{const o=vs[i._def.typeName];return o&&!s.includes(o)?[...s,o]: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,i)=>{const o=typeof i._def.value;switch(o){case"string":case"number":case"boolean":return[...s,o];case"bigint":return[...s,"integer"];case"object":if(i._def.value===null)return[...s,"null"];case"symbol":case"undefined":case"function":default:return s}},[]);if(n.length===r.length){const s=n.filter((i,o,a)=>a.indexOf(i)===o);return{type:s.length>1?s:s[0],enum:r.reduce((i,o)=>i.includes(o._def.value)?i:[...i,o._def.value],[])}}}else if(r.every(n=>n._def.typeName==="ZodEnum"))return{type:"string",enum:r.reduce((n,s)=>[...n,...s._def.values.filter(i=>!n.includes(i))],[])};return xd(t,e)}const xd=(t,e)=>{const r=(t.options instanceof Map?Array.from(t.options.values()):t.options).map((n,s)=>ae(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 Lb(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:vs[t.innerType._def.typeName],nullable:!0}:{type:[vs[t.innerType._def.typeName],"null"]};if(e.target==="openApi3"){const n=ae(t.innerType._def,{...e,currentPath:[...e.currentPath]});return n&&"$ref"in n?{allOf:[n],nullable:!0}:n&&{...n,nullable:!0}}const r=ae(t.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","0"]});return r&&{anyOf:[r,{type:"null"}]}}function Ub(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",Id(r,"type",n.message,e);break;case"min":e.target==="jsonSchema7"?n.inclusive?ue(r,"minimum",n.value,n.message,e):ue(r,"exclusiveMinimum",n.value,n.message,e):(n.inclusive||(r.exclusiveMinimum=!0),ue(r,"minimum",n.value,n.message,e));break;case"max":e.target==="jsonSchema7"?n.inclusive?ue(r,"maximum",n.value,n.message,e):ue(r,"exclusiveMaximum",n.value,n.message,e):(n.inclusive||(r.exclusiveMaximum=!0),ue(r,"maximum",n.value,n.message,e));break;case"multipleOf":ue(r,"multipleOf",n.value,n.message,e);break}return r}function Db(t,e){const r=e.target==="openAi",n={type:"object",properties:{}},s=[],i=t.shape();for(const a in i){let c=i[a];if(c===void 0||c._def===void 0)continue;let u=Vb(c);u&&r&&(c._def.typeName==="ZodOptional"&&(c=c._def.innerType),c.isNullable()||(c=c.nullable()),u=!1);const l=ae(c._def,{...e,currentPath:[...e.currentPath,"properties",a],propertyPath:[...e.currentPath,"properties",a]});l!==void 0&&(n.properties[a]=l,u||s.push(a))}s.length&&(n.required=s);const o=qb(t,e);return o!==void 0&&(n.additionalProperties=o),n}function qb(t,e){if(t.catchall._def.typeName!=="ZodNever")return ae(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 Vb(t){try{return t.isOptional()}catch{return!0}}const Fb=(t,e)=>{var n;if(e.currentPath.toString()===((n=e.propertyPath)==null?void 0:n.toString()))return ae(t.innerType._def,e);const r=ae(t.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","1"]});return r?{anyOf:[{not:He(e)},r]}:He(e)},Hb=(t,e)=>{if(e.pipeStrategy==="input")return ae(t.in._def,e);if(e.pipeStrategy==="output")return ae(t.out._def,e);const r=ae(t.in._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),n=ae(t.out._def,{...e,currentPath:[...e.currentPath,"allOf",r?"1":"0"]});return{allOf:[r,n].filter(s=>s!==void 0)}};function Wb(t,e){return ae(t.type._def,e)}function Kb(t,e){const n={type:"array",uniqueItems:!0,items:ae(t.valueType._def,{...e,currentPath:[...e.currentPath,"items"]})};return t.minSize&&ue(n,"minItems",t.minSize.value,t.minSize.message,e),t.maxSize&&ue(n,"maxItems",t.maxSize.value,t.maxSize.message,e),n}function Jb(t,e){return t.rest?{type:"array",minItems:t.items.length,items:t.items.map((r,n)=>ae(r._def,{...e,currentPath:[...e.currentPath,"items",`${n}`]})).reduce((r,n)=>n===void 0?r:[...r,n],[]),additionalItems:ae(t.rest._def,{...e,currentPath:[...e.currentPath,"additionalItems"]})}:{type:"array",minItems:t.items.length,maxItems:t.items.length,items:t.items.map((r,n)=>ae(r._def,{...e,currentPath:[...e.currentPath,"items",`${n}`]})).reduce((r,n)=>n===void 0?r:[...r,n],[])}}function Bb(t){return{not:He(t)}}function Gb(t){return He(t)}const Yb=(t,e)=>ae(t.innerType._def,e),Xb=(t,e,r)=>{switch(e){case N.ZodString:return zd(t,r);case N.ZodNumber:return Ub(t,r);case N.ZodObject:return Db(t,r);case N.ZodBigInt:return $b(t,r);case N.ZodBoolean:return Sb();case N.ZodDate:return jd(t,r);case N.ZodUndefined:return Bb(r);case N.ZodNull:return Zb(r);case N.ZodArray:return wb(t,r);case N.ZodUnion:case N.ZodDiscriminatedUnion:return xb(t,r);case N.ZodIntersection:return Ob(t,r);case N.ZodTuple:return Jb(t,r);case N.ZodRecord:return Zd(t,r);case N.ZodLiteral:return Ib(t,r);case N.ZodEnum:return Tb(t);case N.ZodNativeEnum:return zb(t);case N.ZodNullable:return Lb(t,r);case N.ZodOptional:return Fb(t,r);case N.ZodMap:return jb(t,r);case N.ZodSet:return Kb(t,r);case N.ZodLazy:return()=>t.getter()._def;case N.ZodPromise:return Wb(t,r);case N.ZodNaN:case N.ZodNever:return Mb(r);case N.ZodEffects:return Rb(t,r);case N.ZodAny:return He(r);case N.ZodUnknown:return Gb(r);case N.ZodDefault:return Pb(t,r);case N.ZodBranded:return Ad(t,r);case N.ZodReadonly:return Yb(t,r);case N.ZodCatch:return kb(t,r);case N.ZodPipeline:return Hb(t,r);case N.ZodFunction:case N.ZodVoid:case N.ZodSymbol:return;default:return(n=>{})()}};function ae(t,e,r=!1){var a;const n=e.seen.get(t);if(e.override){const c=(a=e.override)==null?void 0:a.call(e,t,e,n,r);if(c!==vb)return c}if(n&&!r){const c=Qb(n,e);if(c!==void 0)return c}const s={def:t,path:e.currentPath,jsonSchema:void 0};e.seen.set(t,s);const i=Xb(t,t.typeName,e),o=typeof i=="function"?ae(i(),e):i;if(o&&ew(t,e,o),e.postProcess){const c=e.postProcess(o,t,e);return s.jsonSchema=o,c}return s.jsonSchema=o,o}const Qb=(t,e)=>{switch(e.$refStrategy){case"root":return{$ref:t.path.join("/")};case"relative":return{$ref:Nd(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`),He(e)):e.$refStrategy==="seen"?He(e):void 0}},ew=(t,e,r)=>(t.description&&(r.description=t.description,e.markdownDescription&&(r.markdownDescription=t.description)),r),tw=(t,e)=>{const r=bb(e);let n=typeof e=="object"&&e.definitions?Object.entries(e.definitions).reduce((c,[u,l])=>({...c,[u]:ae(l._def,{...r,currentPath:[...r.basePath,r.definitionPath,u]},!0)??He(r)}),{}):void 0;const s=typeof e=="string"?e:(e==null?void 0:e.nameStrategy)==="title"||e==null?void 0:e.name,i=ae(t._def,s===void 0?r:{...r,currentPath:[...r.basePath,r.definitionPath,s]},!1)??He(r),o=typeof e=="object"&&e.name!==void 0&&e.nameStrategy==="title"?e.name:void 0;o!==void 0&&(i.title=o),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 a=s===void 0?n?{...i,[r.definitionPath]:n}:i:{$ref:[...r.$refStrategy==="relative"?[]:r.basePath,r.definitionPath,s].join("/"),[r.definitionPath]:{...n,[s]:i}};return r.target==="jsonSchema7"?a.$schema="http://json-schema.org/draft-07/schema#":(r.target==="jsonSchema2019-09"||r.target==="openAi")&&(a.$schema="https://json-schema.org/draft/2019-09/schema#"),r.target==="openAi"&&("anyOf"in a||"oneOf"in a||"allOf"in a||"type"in a&&Array.isArray(a.type))&&console.warn("Warning: OpenAI may not support schemas with unions as roots! Try wrapping it in an object property."),a};function rw(t){return!t||t==="jsonSchema7"||t==="draft-7"?"draft-7":t==="jsonSchema2019-09"||t==="draft-2020-12"?"draft-2020-12":"draft-7"}function Ld(t,e){var r,n,s;return ot(t)?_y(t,{target:rw(e==null?void 0:e.target),io:(r=e==null?void 0:e.pipeStrategy)!==null&&r!==void 0?r:"input"}):tw(t,{strictUnions:(n=e==null?void 0:e.strictUnions)!==null&&n!==void 0?n:!0,pipeStrategy:(s=e==null?void 0:e.pipeStrategy)!==null&&s!==void 0?s:"input"})}function Ud(t){const e=on(t),r=e==null?void 0:e.method;if(!r)throw new Error("Schema is missing a method literal");const n=Cd(r);if(typeof n!="string")throw new Error("Schema method literal must be a string");return n}function Dd(t,e){const r=gs(t,e);if(!r.success)throw r.error;return r.data}const qd=6e4;class Mo{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.setNotificationHandler(Bn,r=>{const n=this._requestHandlerAbortControllers.get(r.params.requestId);n==null||n.abort(r.params.reason)}),this.setNotificationHandler(Qn,r=>{this._onprogress(r)}),this.setRequestHandler(Xn,r=>({}))}_setupTimeout(e,r,n,s,i=!1){this._timeoutInfo.set(e,{timeoutId:setTimeout(s,r),startTime:Date.now(),timeout:r,maxTotalTimeout:n,resetTimeoutOnProgress:i,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),se.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 i=(r=this.transport)===null||r===void 0?void 0:r.onclose;this._transport.onclose=()=>{i==null||i(),this._onclose()};const o=(n=this.transport)===null||n===void 0?void 0:n.onerror;this._transport.onerror=c=>{o==null||o(c),this._onerror(c)};const a=(s=this._transport)===null||s===void 0?void 0:s.onmessage;this._transport.onmessage=(c,u)=>{a==null||a(c,u),Jn(c)||Ju(c)?this._onresponse(c):Gi(c)?this._onrequest(c,u):Ku(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._pendingDebouncedNotifications.clear(),this._transport=void 0,(e=this.onclose)===null||e===void 0||e.call(this);const n=se.fromError(_.ErrorCode.ConnectionClosed,"Connection closed");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;const i=(n=this._requestHandlers.get(e.method))!==null&&n!==void 0?n:this.fallbackRequestHandler,o=this._transport;if(i===void 0){o==null||o.send({jsonrpc:"2.0",id:e.id,error:{code:_.ErrorCode.MethodNotFound,message:"Method not found"}}).catch(u=>this._onerror(new Error(`Failed to send an error response: ${u}`)));return}const a=new AbortController;this._requestHandlerAbortControllers.set(e.id,a);const c={signal:a.signal,sessionId:o==null?void 0:o.sessionId,_meta:(s=e.params)===null||s===void 0?void 0:s._meta,sendNotification:u=>this.notification(u,{relatedRequestId:e.id}),sendRequest:(u,l,f)=>this.request(u,l,{...f,relatedRequestId:e.id}),authInfo:r==null?void 0:r.authInfo,requestId:e.id,requestInfo:r==null?void 0:r.requestInfo};Promise.resolve().then(()=>i(e,c)).then(u=>{if(!a.signal.aborted)return o==null?void 0:o.send({result:u,jsonrpc:"2.0",id:e.id})},u=>{var l;if(!a.signal.aborted)return o==null?void 0:o.send({jsonrpc:"2.0",id:e.id,error:{code:Number.isSafeInteger(u.code)?u.code:_.ErrorCode.InternalError,message:(l=u.message)!==null&&l!==void 0?l:"Internal error",...u.data!==void 0&&{data:u.data}}})}).catch(u=>this._onerror(new Error(`Failed to send response: ${u}`))).finally(()=>{this._requestHandlerAbortControllers.delete(e.id)})}_onprogress(e){const{progressToken:r,...n}=e.params,s=Number(r),i=this._progressHandlers.get(s);if(!i){this._onerror(new Error(`Received a progress notification for an unknown token: ${JSON.stringify(e)}`));return}const o=this._responseHandlers.get(s),a=this._timeoutInfo.get(s);if(a&&o&&a.resetTimeoutOnProgress)try{this._resetTimeout(s)}catch(c){o(c);return}i(n)}_onresponse(e){const r=Number(e.id),n=this._responseHandlers.get(r);if(n===void 0){this._onerror(new Error(`Received a response for an unknown message ID: ${JSON.stringify(e)}`));return}if(this._responseHandlers.delete(r),this._progressHandlers.delete(r),this._cleanupTimeout(r),Jn(e))n(e);else{const s=se.fromError(e.error.code,e.error.message,e.error.data);n(s)}}get transport(){return this._transport}async close(){var e;await((e=this._transport)===null||e===void 0?void 0:e.close())}request(e,r,n){const{relatedRequestId:s,resumptionToken:i,onresumptiontoken:o}=n??{};return new Promise((a,c)=>{var u,l,f,w,$,g;if(!this._transport){c(new Error("Not connected"));return}((u=this._options)===null||u===void 0?void 0:u.enforceStrictCapabilities)===!0&&this.assertCapabilityForMethod(e.method),(l=n==null?void 0:n.signal)===null||l===void 0||l.throwIfAborted();const v=this._requestMessageId++,p={...e,jsonrpc:"2.0",id:v};n!=null&&n.onprogress&&(this._progressHandlers.set(v,n.onprogress),p.params={...e.params,_meta:{...((f=e.params)===null||f===void 0?void 0:f._meta)||{},progressToken:v}});const d=E=>{var C;this._responseHandlers.delete(v),this._progressHandlers.delete(v),this._cleanupTimeout(v),(C=this._transport)===null||C===void 0||C.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:v,reason:String(E)}},{relatedRequestId:s,resumptionToken:i,onresumptiontoken:o}).catch(z=>this._onerror(new Error(`Failed to send cancellation: ${z}`))),c(E)};this._responseHandlers.set(v,E=>{var C;if(!(!((C=n==null?void 0:n.signal)===null||C===void 0)&&C.aborted)){if(E instanceof Error)return c(E);try{const z=gs(r,E.result);z.success?a(z.data):c(z.error)}catch(z){c(z)}}}),(w=n==null?void 0:n.signal)===null||w===void 0||w.addEventListener("abort",()=>{var E;d((E=n==null?void 0:n.signal)===null||E===void 0?void 0:E.reason)});const m=($=n==null?void 0:n.timeout)!==null&&$!==void 0?$:qd,S=()=>d(se.fromError(_.ErrorCode.RequestTimeout,"Request timed out",{timeout:m}));this._setupTimeout(v,m,n==null?void 0:n.maxTotalTimeout,S,(g=n==null?void 0:n.resetTimeoutOnProgress)!==null&&g!==void 0?g:!1),this._transport.send(p,{relatedRequestId:s,resumptionToken:i,onresumptiontoken:o}).catch(E=>{this._cleanupTimeout(v),c(E)})})}async notification(e,r){var n,s;if(!this._transport)throw new Error("Not connected");if(this.assertNotificationCapability(e.method),((s=(n=this._options)===null||n===void 0?void 0:n.debouncedNotificationMethods)!==null&&s!==void 0?s:[]).includes(e.method)&&!e.params&&!(r!=null&&r.relatedRequestId)){if(this._pendingDebouncedNotifications.has(e.method))return;this._pendingDebouncedNotifications.add(e.method),Promise.resolve().then(()=>{var c;if(this._pendingDebouncedNotifications.delete(e.method),!this._transport)return;const u={...e,jsonrpc:"2.0"};(c=this._transport)===null||c===void 0||c.send(u,r).catch(l=>this._onerror(l))});return}const a={...e,jsonrpc:"2.0"};await this._transport.send(a,r)}setRequestHandler(e,r){const n=Ud(e);this.assertRequestHandlerCapability(n),this._requestHandlers.set(n,(s,i)=>{const o=Dd(e,s);return Promise.resolve(r(o,i))})}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=Ud(e);this._notificationHandlers.set(n,s=>{const i=Dd(e,s);return Promise.resolve(r(i))})}removeNotificationHandler(e){this._notificationHandlers.delete(e)}}function Vd(t){return t!==null&&typeof t=="object"&&!Array.isArray(t)}function Zo(t,e){const r={...t};for(const n in e){const s=n,i=e[s];if(i===void 0)continue;const o=r[s];Vd(o)&&Vd(i)?r[s]={...o,...i}:r[s]=i}return r}var xo={exports:{}},Fd={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.formatNames=t.fastFormats=t.fullFormats=void 0;function e(W,X){return{validate:W,compare:X}}t.fullFormats={date:e(i,o),time:e(c(!0),u),"date-time":e(w(!0),$),"iso-time":e(c(),l),"iso-date-time":e(w(),g),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:d,"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:$t,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:S,int32:{type:"number",validate:z},int64:{type:"number",validate:B},float:{type:"number",validate:ye},double:{type:"number",validate:ye},password:!0,binary:!0},t.fastFormats={...t.fullFormats,date:e(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,o),time:e(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,u),"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,$),"iso-time":e(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,l),"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,g),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(W){return W%4===0&&(W%100!==0||W%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 i(W){const X=n.exec(W);if(!X)return!1;const be=+X[1],ne=+X[2],Ze=+X[3];return ne>=1&&ne<=12&&Ze>=1&&Ze<=(ne===2&&r(be)?29:s[ne])}function o(W,X){if(W&&X)return W>X?1:W<X?-1:0}const a=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function c(W){return function(be){const ne=a.exec(be);if(!ne)return!1;const Ze=+ne[1],St=+ne[2],kt=+ne[3],pn=ne[4],Xt=ne[5]==="-"?-1:1,A=+(ne[6]||0),k=+(ne[7]||0);if(A>23||k>59||W&&!pn)return!1;if(Ze<=23&&St<=59&&kt<60)return!0;const O=St-k*Xt,P=Ze-A*Xt-(O<0?1:0);return(P===23||P===-1)&&(O===59||O===-1)&&kt<61}}function u(W,X){if(!(W&&X))return;const be=new Date("2020-01-01T"+W).valueOf(),ne=new Date("2020-01-01T"+X).valueOf();if(be&&ne)return be-ne}function l(W,X){if(!(W&&X))return;const be=a.exec(W),ne=a.exec(X);if(be&&ne)return W=be[1]+be[2]+be[3],X=ne[1]+ne[2]+ne[3],W>X?1:W<X?-1:0}const f=/t|\s/i;function w(W){const X=c(W);return function(ne){const Ze=ne.split(f);return Ze.length===2&&i(Ze[0])&&X(Ze[1])}}function $(W,X){if(!(W&&X))return;const be=new Date(W).valueOf(),ne=new Date(X).valueOf();if(be&&ne)return be-ne}function g(W,X){if(!(W&&X))return;const[be,ne]=W.split(f),[Ze,St]=X.split(f),kt=o(be,Ze);if(kt!==void 0)return kt||u(ne,St)}const v=/\/|:/,p=/^(?:[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 d(W){return v.test(W)&&p.test(W)}const m=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function S(W){return m.lastIndex=0,m.test(W)}const E=-2147483648,C=2**31-1;function z(W){return Number.isInteger(W)&&W<=C&&W>=E}function B(W){return Number.isInteger(W)}function ye(){return!0}const Me=/[^\\]\\Z/;function $t(W){if(Me.test(W))return!1;try{return new RegExp(W),!0}catch{return!1}}})(Fd);var Hd={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.formatLimitDefinition=void 0;const e=Ni,r=Y,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}},i={message:({keyword:a,schemaCode:c})=>(0,r.str)`should be ${s[a].okStr} ${c}`,params:({keyword:a,schemaCode:c})=>(0,r._)`{comparison: ${s[a].okStr}, limit: ${c}}`};t.formatLimitDefinition={keyword:Object.keys(s),type:"string",schemaType:"string",$data:!0,error:i,code(a){const{gen:c,data:u,schemaCode:l,keyword:f,it:w}=a,{opts:$,self:g}=w;if(!$.validateFormats)return;const v=new e.KeywordCxt(w,g.RULES.all.format.definition,"format");v.$data?p():d();function p(){const S=c.scopeValue("formats",{ref:g.formats,code:$.code.formats}),E=c.const("fmt",(0,r._)`${S}[${v.schemaCode}]`);a.fail$data((0,r.or)((0,r._)`typeof ${E} != "object"`,(0,r._)`${E} instanceof RegExp`,(0,r._)`typeof ${E}.compare != "function"`,m(E)))}function d(){const S=v.schema,E=g.formats[S];if(!E||E===!0)return;if(typeof E!="object"||E instanceof RegExp||typeof E.compare!="function")throw new Error(`"${f}": format "${S}" does not define "compare" function`);const C=c.scopeValue("formats",{key:S,ref:E,code:$.code.formats?(0,r._)`${$.code.formats}${(0,r.getProperty)(S)}`:void 0});a.fail$data(m(C))}function m(S){return(0,r._)`${S}.compare(${u}, ${l}) ${s[f].fail} 0`}},dependencies:["format"]};const o=a=>(a.addKeyword(t.formatLimitDefinition),a);t.default=o})(Hd),function(t,e){Object.defineProperty(e,"__esModule",{value:!0});const r=Fd,n=Hd,s=Y,i=new s.Name("fullFormats"),o=new s.Name("fastFormats"),a=(u,l={keywords:!0})=>{if(Array.isArray(l))return c(u,l,r.fullFormats,i),u;const[f,w]=l.mode==="fast"?[r.fastFormats,o]:[r.fullFormats,i],$=l.formats||r.formatNames;return c(u,$,f,w),l.keywords&&(0,n.default)(u),u};a.get=(u,l="full")=>{const w=(l==="fast"?r.fastFormats:r.fullFormats)[u];if(!w)throw new Error(`Unknown format "${u}"`);return w};function c(u,l,f,w){var $,g;($=(g=u.opts.code).formats)!==null&&$!==void 0||(g.formats=(0,s._)`require("ajv-formats/dist/formats").${w}`);for(const v of l)u.addFormat(v,f[v])}t.exports=e=a,Object.defineProperty(e,"__esModule",{value:!0}),e.default=a}(xo,xo.exports);var nw=xo.exports;const sw=Qt(nw);function iw(){const t=new Ni.Ajv({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return sw(t),t}class Wd{constructor(e){this._ajv=e??iw()}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)}}}function ys(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 i=n[s];r[s]===void 0&&Object.prototype.hasOwnProperty.call(i,"default")&&(r[s]=i.default),r[s]!==void 0&&ys(i,r[s])}}if(Array.isArray(t.anyOf))for(const r of t.anyOf)ys(r,e);if(Array.isArray(t.oneOf))for(const r of t.oneOf)ys(r,e)}}function Kd(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 ow extends Mo{constructor(e,r){var n,s;super(r),this._clientInfo=e,this._cachedToolOutputValidators=new Map,this._capabilities=(n=r==null?void 0:r.capabilities)!==null&&n!==void 0?n:{},this._jsonSchemaValidator=(s=r==null?void 0:r.jsonSchemaValidator)!==null&&s!==void 0?s:new Wd}registerCapabilities(e){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=Zo(this._capabilities,e)}setRequestHandler(e,r){var n,s,i;const o=on(e),a=o==null?void 0:o.method;if(!a)throw new Error("Schema is missing a method literal");let c;if(ot(a)){const l=a,f=(n=l._zod)===null||n===void 0?void 0:n.def;c=(s=f==null?void 0:f.value)!==null&&s!==void 0?s:l.value}else{const l=a,f=l._def;c=(i=f==null?void 0:f.value)!==null&&i!==void 0?i:l.value}if(typeof c!="string")throw new Error("Schema method literal must be a string");if(c==="elicitation/create"){const l=async(f,w)=>{var $,g,v;const p=gs(bo,f);if(!p.success){const Me=p.error instanceof Error?p.error.message:String(p.error);throw new se(_.ErrorCode.InvalidParams,`Invalid elicitation request: ${Me}`)}const{params:d}=p.data,m=($=d.mode)!==null&&$!==void 0?$:"form",{supportsFormMode:S,supportsUrlMode:E}=Kd(this._capabilities.elicitation);if(m==="form"&&!S)throw new se(_.ErrorCode.InvalidParams,"Client does not support form-mode elicitation requests");if(m==="url"&&!E)throw new se(_.ErrorCode.InvalidParams,"Client does not support URL-mode elicitation requests");const C=await Promise.resolve(r(f,w)),z=gs(Qr,C);if(!z.success){const Me=z.error instanceof Error?z.error.message:String(z.error);throw new se(_.ErrorCode.InvalidParams,`Invalid elicitation result: ${Me}`)}const B=z.data,ye=m==="form"?d.requestedSchema:void 0;if(m==="form"&&B.action==="accept"&&B.content&&ye&&!((v=(g=this._capabilities.elicitation)===null||g===void 0?void 0:g.form)===null||v===void 0)&&v.applyDefaults)try{ys(ye,B.content)}catch{}return B};return super.setRequestHandler(e,l)}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:Kt,capabilities:this._capabilities,clientInfo:this._clientInfo}},to,r);if(n===void 0)throw new Error(`Server sent invalid initialize result: ${n}`);if(!Wi.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,i,o;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(!(!((i=this._serverCapabilities)===null||i===void 0)&&i.tools))throw new Error(`Server does not support tools (required for ${e})`);break;case"completion/complete":if(!(!((o=this._serverCapabilities)===null||o===void 0)&&o.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){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}}async ping(e){return this.request({method:"ping"},Nt,e)}async complete(e,r){return this.request({method:"completion/complete",params:e},$o,r)}async setLoggingLevel(e,r){return this.request({method:"logging/setLevel",params:{level:e}},Nt,r)}async getPrompt(e,r){return this.request({method:"prompts/get",params:e},mo,r)}async listPrompts(e,r){return this.request({method:"prompts/list",params:e},lo,r)}async listResources(e,r){return this.request({method:"resources/list",params:e},ao,r)}async listResourceTemplates(e,r){return this.request({method:"resources/templates/list",params:e},co,r)}async readResource(e,r){return this.request({method:"resources/read",params:e},uo,r)}async subscribeResource(e,r){return this.request({method:"resources/subscribe",params:e},Nt,r)}async unsubscribeResource(e,r){return this.request({method:"resources/unsubscribe",params:e},Nt,r)}async callTool(e,r=cs,n){const s=await this.request({method:"tools/call",params:e},r,n),i=this.getToolOutputValidator(e.name);if(i){if(!s.structuredContent&&!s.isError)throw new se(_.ErrorCode.InvalidRequest,`Tool ${e.name} has an output schema but did not return structured content`);if(s.structuredContent)try{const o=i(s.structuredContent);if(!o.valid)throw new se(_.ErrorCode.InvalidParams,`Structured content does not match the tool's output schema: ${o.errorMessage}`)}catch(o){throw o instanceof se?o:new se(_.ErrorCode.InvalidParams,`Failed to validate structured content: ${o instanceof Error?o.message:String(o)}`)}}return s}cacheToolOutputSchemas(e){this._cachedToolOutputValidators.clear();for(const r of e)if(r.outputSchema){const n=this._jsonSchemaValidator.getValidator(r.outputSchema);this._cachedToolOutputValidators.set(r.name,n)}}getToolOutputValidator(e){return this._cachedToolOutputValidators.get(e)}async listTools(e,r){const n=await this.request({method:"tools/list",params:e},go,r);return this.cacheToolOutputSchemas(n.tools),n}async sendRootsListChanged(){return this.notification({method:"notifications/roots/list_changed"})}}let Lo;Lo=globalThis.crypto;async function aw(t){return(await Lo).getRandomValues(new Uint8Array(t))}async function cw(t){const e="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-._~",r=Math.pow(2,8)-Math.pow(2,8)%e.length;let n="";for(;n.length<t;){const s=await aw(t-n.length);for(const i of s)i<r&&(n+=e[i%e.length])}return n}async function uw(t){return await cw(t)}async function lw(t){const e=await(await Lo).subtle.digest("SHA-256",new TextEncoder().encode(t));return btoa(String.fromCharCode(...new Uint8Array(e))).replace(/\//g,"_").replace(/\+/g,"-").replace(/=/g,"")}async function dw(t){if(t||(t=43),t<43||t>128)throw`Expected a length between 43 and 128. Received ${t}.`;const e=await uw(t),r=await lw(e);return{code_verifier:e,code_challenge:r}}const je=Iy().superRefine((t,e)=>{if(!URL.canParse(t))return e.addIssue({code:S0.custom,message:"URL must be parseable",fatal:!0}),C_}).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"}),fw=nt({resource:b().url(),authorization_servers:j(je).optional(),jwks_uri:b().url().optional(),scopes_supported:j(b()).optional(),bearer_methods_supported:j(b()).optional(),resource_signing_alg_values_supported:j(b()).optional(),resource_name:b().optional(),resource_documentation:b().optional(),resource_policy_uri:b().url().optional(),resource_tos_uri:b().url().optional(),tls_client_certificate_bound_access_tokens:ge().optional(),authorization_details_types_supported:j(b()).optional(),dpop_signing_alg_values_supported:j(b()).optional(),dpop_bound_access_tokens_required:ge().optional()}),Uo=nt({issuer:b(),authorization_endpoint:je,token_endpoint:je,registration_endpoint:je.optional(),scopes_supported:j(b()).optional(),response_types_supported:j(b()),response_modes_supported:j(b()).optional(),grant_types_supported:j(b()).optional(),token_endpoint_auth_methods_supported:j(b()).optional(),token_endpoint_auth_signing_alg_values_supported:j(b()).optional(),service_documentation:je.optional(),revocation_endpoint:je.optional(),revocation_endpoint_auth_methods_supported:j(b()).optional(),revocation_endpoint_auth_signing_alg_values_supported:j(b()).optional(),introspection_endpoint:b().optional(),introspection_endpoint_auth_methods_supported:j(b()).optional(),introspection_endpoint_auth_signing_alg_values_supported:j(b()).optional(),code_challenge_methods_supported:j(b()).optional(),client_id_metadata_document_supported:ge().optional()}),hw=nt({issuer:b(),authorization_endpoint:je,token_endpoint:je,userinfo_endpoint:je.optional(),jwks_uri:je,registration_endpoint:je.optional(),scopes_supported:j(b()).optional(),response_types_supported:j(b()),response_modes_supported:j(b()).optional(),grant_types_supported:j(b()).optional(),acr_values_supported:j(b()).optional(),subject_types_supported:j(b()),id_token_signing_alg_values_supported:j(b()),id_token_encryption_alg_values_supported:j(b()).optional(),id_token_encryption_enc_values_supported:j(b()).optional(),userinfo_signing_alg_values_supported:j(b()).optional(),userinfo_encryption_alg_values_supported:j(b()).optional(),userinfo_encryption_enc_values_supported:j(b()).optional(),request_object_signing_alg_values_supported:j(b()).optional(),request_object_encryption_alg_values_supported:j(b()).optional(),request_object_encryption_enc_values_supported:j(b()).optional(),token_endpoint_auth_methods_supported:j(b()).optional(),token_endpoint_auth_signing_alg_values_supported:j(b()).optional(),display_values_supported:j(b()).optional(),claim_types_supported:j(b()).optional(),claims_supported:j(b()).optional(),service_documentation:b().optional(),claims_locales_supported:j(b()).optional(),ui_locales_supported:j(b()).optional(),claims_parameter_supported:ge().optional(),request_parameter_supported:ge().optional(),request_uri_parameter_supported:ge().optional(),require_request_uri_registration:ge().optional(),op_policy_uri:je.optional(),op_tos_uri:je.optional(),client_id_metadata_document_supported:ge().optional()}),pw=M({...hw.shape,...Uo.pick({code_challenge_methods_supported:!0}).shape}),Jd=M({access_token:b(),id_token:b().optional(),token_type:b(),expires_in:_e().optional(),scope:b().optional(),refresh_token:b().optional()}).strip(),mw=M({error:b(),error_description:b().optional(),error_uri:b().optional()}),Bd=je.optional().or(H("").transform(()=>{})),_w=M({redirect_uris:j(je),token_endpoint_auth_method:b().optional(),grant_types:j(b()).optional(),response_types:j(b()).optional(),client_name:b().optional(),client_uri:je.optional(),logo_uri:Bd,scope:b().optional(),contacts:j(b()).optional(),tos_uri:Bd,policy_uri:b().optional(),jwks_uri:je.optional(),jwks:Gy().optional(),software_id:b().optional(),software_version:b().optional(),software_statement:b().optional()}).strip(),gw=M({client_id:b(),client_secret:b().optional(),client_id_issued_at:_e().optional(),client_secret_expires_at:_e().optional()}).strip(),vw=_w.merge(gw);M({error:b(),error_description:b().optional()}).strip(),M({token:b(),token_type_hint:b().optional()}).strip();function yw(t){const e=typeof t=="string"?new URL(t):new URL(t.href);return e.hash="",e}function bw({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+"/",i=n.pathname.endsWith("/")?n.pathname:n.pathname+"/";return s.startsWith(i)}class ze 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 Do extends ze{}Do.errorCode="invalid_request";class bs extends ze{}bs.errorCode="invalid_client";class ws extends ze{}ws.errorCode="invalid_grant";class $s extends ze{}$s.errorCode="unauthorized_client";class qo extends ze{}qo.errorCode="unsupported_grant_type";class Vo extends ze{}Vo.errorCode="invalid_scope";class Fo extends ze{}Fo.errorCode="access_denied";class gr extends ze{}gr.errorCode="server_error";class Ho extends ze{}Ho.errorCode="temporarily_unavailable";class Wo extends ze{}Wo.errorCode="unsupported_response_type";class Ko extends ze{}Ko.errorCode="unsupported_token_type";class Jo extends ze{}Jo.errorCode="invalid_token";class Bo extends ze{}Bo.errorCode="method_not_allowed";class Go extends ze{}Go.errorCode="too_many_requests";class Ss extends ze{}Ss.errorCode="invalid_client_metadata";class Yo extends ze{}Yo.errorCode="insufficient_scope";const ww={[Do.errorCode]:Do,[bs.errorCode]:bs,[ws.errorCode]:ws,[$s.errorCode]:$s,[qo.errorCode]:qo,[Vo.errorCode]:Vo,[Fo.errorCode]:Fo,[gr.errorCode]:gr,[Ho.errorCode]:Ho,[Wo.errorCode]:Wo,[Ko.errorCode]:Ko,[Jo.errorCode]:Jo,[Bo.errorCode]:Bo,[Go.errorCode]:Go,[Ss.errorCode]:Ss,[Yo.errorCode]:Yo};class Xe extends Error{constructor(e){super(e??"Unauthorized")}}function $w(t){return["client_secret_basic","client_secret_post","none"].includes(t)}const Xo="code",Qo="S256";function ea(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&&$w(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 Gd(t,e,r,n){const{client_id:s,client_secret:i}=e;switch(t){case"client_secret_basic":Sw(s,i,r);return;case"client_secret_post":kw(s,i,n);return;case"none":Ew(s,n);return;default:throw new Error(`Unsupported client authentication method: ${t}`)}}function Sw(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 kw(t,e,r){r.set("client_id",t),e&&r.set("client_secret",e)}function Ew(t,e){e.set("client_id",t)}async function ks(t){const e=t instanceof Response?t.status:void 0,r=t instanceof Response?await t.text():t;try{const n=mw.parse(JSON.parse(r)),{error:s,error_description:i,error_uri:o}=n,a=ww[s]||gr;return new a(i||"",o)}catch(n){const s=`${e?`HTTP ${e}: `:""}Invalid OAuth error response: ${n}. Raw body: ${r}`;return new gr(s)}}async function Zt(t,e){var r,n;try{return await ta(t,e)}catch(s){if(s instanceof bs||s instanceof $s)return await((r=t.invalidateCredentials)===null||r===void 0?void 0:r.call(t,"all")),await ta(t,e);if(s instanceof ws)return await((n=t.invalidateCredentials)===null||n===void 0?void 0:n.call(t,"tokens")),await ta(t,e);throw s}}async function ta(t,{serverUrl:e,authorizationCode:r,scope:n,resourceMetadataUrl:s,fetchFn:i}){var o,a;let c,u;try{c=await Qd(e,{resourceMetadataUrl:s},i),c.authorization_servers&&c.authorization_servers.length>0&&(u=c.authorization_servers[0])}catch{}u||(u=new URL("/",e));const l=await Xd(e,t,c),f=await nf(u,{fetchFn:i});let w=await Promise.resolve(t.clientInformation());if(!w){if(r!==void 0)throw new Error("Existing OAuth client information is required when exchanging an authorization code");const d=(f==null?void 0:f.client_id_metadata_document_supported)===!0,m=t.clientMetadataUrl;if(m&&!Yd(m))throw new Ss(`clientMetadataUrl must be a valid HTTPS URL with a non-root pathname, got: ${m}`);if(d&&m)w={client_id:m},await((o=t.saveClientInformation)===null||o===void 0?void 0:o.call(t,w));else{if(!t.saveClientInformation)throw new Error("OAuth client information must be saveable for dynamic registration");const E=await cf(u,{metadata:f,clientMetadata:t.clientMetadata,fetchFn:i});await t.saveClientInformation(E),w=E}}if(r!==void 0){const d=await t.codeVerifier(),m=await of(u,{metadata:f,clientInformation:w,authorizationCode:r,codeVerifier:d,redirectUri:t.redirectUrl,resource:l,addClientAuthentication:t.addClientAuthentication,fetchFn:i});return await t.saveTokens(m),"AUTHORIZED"}const $=await t.tokens();if($!=null&&$.refresh_token)try{const d=await af(u,{metadata:f,clientInformation:w,refreshToken:$.refresh_token,resource:l,addClientAuthentication:t.addClientAuthentication,fetchFn:i});return await t.saveTokens(d),"AUTHORIZED"}catch(d){if(!(!(d instanceof ze)||d instanceof gr))throw d}const g=t.state?await t.state():void 0,{authorizationUrl:v,codeVerifier:p}=await sf(u,{metadata:f,clientInformation:w,state:g,redirectUrl:t.redirectUrl,scope:n||((a=c==null?void 0:c.scopes_supported)===null||a===void 0?void 0:a.join(" "))||t.clientMetadata.scope,resource:l});return await t.saveCodeVerifier(p),await t.redirectToAuthorization(v),"REDIRECT"}function Yd(t){if(!t)return!1;try{const e=new URL(t);return e.protocol==="https:"&&e.pathname!=="/"}catch{return!1}}async function Xd(t,e,r){const n=yw(t);if(e.validateResourceURL)return await e.validateResourceURL(n,r==null?void 0:r.resource);if(r){if(!bw({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 cn(t){const e=t.headers.get("WWW-Authenticate");if(!e)return{};const[r,n]=e.split(" ");if(r.toLowerCase()!=="bearer"||!n)return{};const s=ra(t,"resource_metadata")||void 0;let i;if(s)try{i=new URL(s)}catch{}const o=ra(t,"scope")||void 0,a=ra(t,"error")||void 0;return{resourceMetadataUrl:i,scope:o,error:a}}function ra(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 Pw(t){const e=t.headers.get("WWW-Authenticate");if(!e)return;const[r,n]=e.split(" ");if(r.toLowerCase()!=="bearer"||!n)return;const i=/resource_metadata="([^"]*)"/.exec(e);if(i)try{return new URL(i[1])}catch{return}}async function Qd(t,e,r=fetch){const n=await tf(t,"oauth-protected-resource",r,{protocolVersion:e==null?void 0:e.protocolVersion,metadataUrl:e==null?void 0:e.resourceMetadataUrl});if(!n||n.status===404)throw new Error("Resource server does not implement OAuth 2.0 Protected Resource Metadata.");if(!n.ok)throw new Error(`HTTP ${n.status} trying to load well-known OAuth protected resource metadata.`);return fw.parse(await n.json())}async function na(t,e,r=fetch){try{return await r(t,{headers:e})}catch(n){if(n instanceof TypeError)return e?na(t,void 0,r):void 0;throw n}}function Rw(t,e="",r={}){return e.endsWith("/")&&(e=e.slice(0,-1)),r.prependPathname?`${e}/.well-known/${t}`:`/.well-known/${t}${e}`}async function ef(t,e,r=fetch){return await na(t,{"MCP-Protocol-Version":e},r)}function Tw(t,e){return!t||t.status>=400&&t.status<500&&e!=="/"}async function tf(t,e,r,n){var s,i;const o=new URL(t),a=(s=n==null?void 0:n.protocolVersion)!==null&&s!==void 0?s:Kt;let c;if(n!=null&&n.metadataUrl)c=new URL(n.metadataUrl);else{const l=Rw(e,o.pathname);c=new URL(l,(i=n==null?void 0:n.metadataServerUrl)!==null&&i!==void 0?i:o),c.search=o.search}let u=await ef(c,a,r);if(!(n!=null&&n.metadataUrl)&&Tw(u,o.pathname)){const l=new URL(`/.well-known/${e}`,o);u=await ef(l,a,r)}return u}async function Cw(t,{authorizationServerUrl:e,protocolVersion:r}={},n=fetch){typeof t=="string"&&(t=new URL(t)),e||(e=t),typeof e=="string"&&(e=new URL(e)),r??(r=Kt);const s=await tf(e,"oauth-authorization-server",n,{protocolVersion:r,metadataServerUrl:e});if(!(!s||s.status===404)){if(!s.ok)throw new Error(`HTTP ${s.status} trying to load well-known OAuth metadata`);return Uo.parse(await s.json())}}function rf(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 nf(t,{fetchFn:e=fetch,protocolVersion:r=Kt}={}){const n={"MCP-Protocol-Version":r,Accept:"application/json"},s=rf(t);for(const{url:i,type:o}of s){const a=await na(i,n,e);if(a){if(!a.ok){if(a.status>=400&&a.status<500)continue;throw new Error(`HTTP ${a.status} trying to load ${o==="oauth"?"OAuth":"OpenID provider"} metadata from ${i}`)}return o==="oauth"?Uo.parse(await a.json()):pw.parse(await a.json())}}}async function sf(t,{metadata:e,clientInformation:r,redirectUrl:n,scope:s,state:i,resource:o}){let a;if(e){if(a=new URL(e.authorization_endpoint),!e.response_types_supported.includes(Xo))throw new Error(`Incompatible auth server: does not support response type ${Xo}`);if(e.code_challenge_methods_supported&&!e.code_challenge_methods_supported.includes(Qo))throw new Error(`Incompatible auth server: does not support code challenge method ${Qo}`)}else a=new URL("/authorize",t);const c=await dw(),u=c.code_verifier,l=c.code_challenge;return a.searchParams.set("response_type",Xo),a.searchParams.set("client_id",r.client_id),a.searchParams.set("code_challenge",l),a.searchParams.set("code_challenge_method",Qo),a.searchParams.set("redirect_uri",String(n)),i&&a.searchParams.set("state",i),s&&a.searchParams.set("scope",s),s!=null&&s.includes("offline_access")&&a.searchParams.append("prompt","consent"),o&&a.searchParams.set("resource",o.href),{authorizationUrl:a,codeVerifier:u}}async function of(t,{metadata:e,clientInformation:r,authorizationCode:n,codeVerifier:s,redirectUri:i,resource:o,addClientAuthentication:a,fetchFn:c}){var u;const l="authorization_code",f=e!=null&&e.token_endpoint?new URL(e.token_endpoint):new URL("/token",t);if(e!=null&&e.grant_types_supported&&!e.grant_types_supported.includes(l))throw new Error(`Incompatible auth server: does not support grant type ${l}`);const w=new Headers({"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"}),$=new URLSearchParams({grant_type:l,code:n,code_verifier:s,redirect_uri:String(i)});if(a)a(w,$,t,e);else{const v=(u=e==null?void 0:e.token_endpoint_auth_methods_supported)!==null&&u!==void 0?u:[],p=ea(r,v);Gd(p,r,w,$)}o&&$.set("resource",o.href);const g=await(c??fetch)(f,{method:"POST",headers:w,body:$});if(!g.ok)throw await ks(g);return Jd.parse(await g.json())}async function af(t,{metadata:e,clientInformation:r,refreshToken:n,resource:s,addClientAuthentication:i,fetchFn:o}){var a;const c="refresh_token";let u;if(e){if(u=new URL(e.token_endpoint),e.grant_types_supported&&!e.grant_types_supported.includes(c))throw new Error(`Incompatible auth server: does not support grant type ${c}`)}else u=new URL("/token",t);const l=new Headers({"Content-Type":"application/x-www-form-urlencoded"}),f=new URLSearchParams({grant_type:c,refresh_token:n});if(i)i(l,f,t,e);else{const $=(a=e==null?void 0:e.token_endpoint_auth_methods_supported)!==null&&a!==void 0?a:[],g=ea(r,$);Gd(g,r,l,f)}s&&f.set("resource",s.href);const w=await(o??fetch)(u,{method:"POST",headers:l,body:f});if(!w.ok)throw await ks(w);return Jd.parse({refresh_token:n,...await w.json()})}async function cf(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 i=await(n??fetch)(s,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(r)});if(!i.ok)throw await ks(i);return vw.parse(await i.json())}class uf 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 sa(t){}function lf(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=sa,onError:r=sa,onRetry:n=sa,onComment:s}=t;let i="",o=!0,a,c="",u="";function l(v){const p=o?v.replace(/^\xEF\xBB\xBF/,""):v,[d,m]=Ow(`${i}${p}`);for(const S of d)f(S);i=m,o=!1}function f(v){if(v===""){$();return}if(v.startsWith(":")){s&&s(v.slice(v.startsWith(": ")?2:1));return}const p=v.indexOf(":");if(p!==-1){const d=v.slice(0,p),m=v[p+1]===" "?2:1,S=v.slice(p+m);w(d,S,v);return}w(v,"",v)}function w(v,p,d){switch(v){case"event":u=p;break;case"data":c=`${c}${p}
|
|
40
|
-
`;break;case"id":a=p.includes("\0")?void 0:p;break;case"retry":/^\d+$/.test(p)?n(parseInt(p,10)):r(new uf(`Invalid \`retry\` value: "${p}"`,{type:"invalid-retry",value:p,line:d}));break;default:r(new uf(`Unknown field "${v.length>20?`${v.slice(0,20)}…`:v}"`,{type:"unknown-field",field:v,value:p,line:d}));break}}function $(){c.length>0&&e({id:a,event:u||void 0,data:c.endsWith(`
|
|
41
|
-
`)?c.slice(0,-1):c}),a=void 0,c="",u=""}function g(v={}){i&&v.consume&&f(i),o=!0,a=void 0,c="",u="",i=""}return{feed:l,reset:g}}function Ow(t){const e=[];let r="",n=0;for(;n<t.length;){const s=t.indexOf("\r",n),i=t.indexOf(`
|
|
42
|
-
`,n);let o=-1;if(s!==-1&&i!==-1?o=Math.min(s,i):s!==-1?s===t.length-1?o=-1:o=s:i!==-1&&(o=i),o===-1){r=t.slice(n);break}else{const a=t.slice(n,o);e.push(a),n=o+1,t[n-1]==="\r"&&t[n]===`
|
|
43
|
-
`&&n++}}return[e,r]}class df extends Event{constructor(e,r){var n,s;super(e),this.code=(n=r==null?void 0:r.code)!=null?n:void 0,this.message=(s=r==null?void 0:r.message)!=null?s:void 0}[Symbol.for("nodejs.util.inspect.custom")](e,r,n){return n(ff(this),r)}[Symbol.for("Deno.customInspect")](e,r){return e(ff(this),r)}}function Iw(t){const e=globalThis.DOMException;return typeof e=="function"?new e(t,"SyntaxError"):new SyntaxError(t)}function ia(t){return t instanceof Error?"errors"in t&&Array.isArray(t.errors)?t.errors.map(ia).join(", "):"cause"in t&&t.cause instanceof Error?`${t}: ${ia(t.cause)}`:t.message:`${t}`}function ff(t){return{type:t.type,message:t.message,code:t.code,defaultPrevented:t.defaultPrevented,cancelable:t.cancelable,timeStamp:t.timeStamp}}var hf=t=>{throw TypeError(t)},oa=(t,e,r)=>e.has(t)||hf("Cannot "+r),re=(t,e,r)=>(oa(t,e,"read from private field"),r?r.call(t):e.get(t)),Oe=(t,e,r)=>e.has(t)?hf("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,r),ve=(t,e,r,n)=>(oa(t,e,"write to private field"),e.set(t,r),r),wt=(t,e,r)=>(oa(t,e,"access private method"),r),We,Yt,vr,Es,Ps,un,yr,ln,xt,br,wr,$r,dn,ut,aa,ca,ua,pf,la,da,fn,fa,ha;class Rs extends EventTarget{constructor(e,r){var n,s;super(),Oe(this,ut),this.CONNECTING=0,this.OPEN=1,this.CLOSED=2,Oe(this,We),Oe(this,Yt),Oe(this,vr),Oe(this,Es),Oe(this,Ps),Oe(this,un),Oe(this,yr),Oe(this,ln,null),Oe(this,xt),Oe(this,br),Oe(this,wr,null),Oe(this,$r,null),Oe(this,dn,null),Oe(this,ca,async i=>{var o;re(this,br).reset();const{body:a,redirected:c,status:u,headers:l}=i;if(u===204){wt(this,ut,fn).call(this,"Server sent HTTP 204, not reconnecting",204),this.close();return}if(c?ve(this,vr,new URL(i.url)):ve(this,vr,void 0),u!==200){wt(this,ut,fn).call(this,`Non-200 status code (${u})`,u);return}if(!(l.get("content-type")||"").startsWith("text/event-stream")){wt(this,ut,fn).call(this,'Invalid content type, expected "text/event-stream"',u);return}if(re(this,We)===this.CLOSED)return;ve(this,We,this.OPEN);const f=new Event("open");if((o=re(this,dn))==null||o.call(this,f),this.dispatchEvent(f),typeof a!="object"||!a||!("getReader"in a)){wt(this,ut,fn).call(this,"Invalid response body, expected a web ReadableStream",u),this.close();return}const w=new TextDecoder,$=a.getReader();let g=!0;do{const{done:v,value:p}=await $.read();p&&re(this,br).feed(w.decode(p,{stream:!v})),v&&(g=!1,re(this,br).reset(),wt(this,ut,fa).call(this))}while(g)}),Oe(this,ua,i=>{ve(this,xt,void 0),!(i.name==="AbortError"||i.type==="aborted")&&wt(this,ut,fa).call(this,ia(i))}),Oe(this,la,i=>{typeof i.id=="string"&&ve(this,ln,i.id);const o=new MessageEvent(i.event||"message",{data:i.data,origin:re(this,vr)?re(this,vr).origin:re(this,Yt).origin,lastEventId:i.id||""});re(this,$r)&&(!i.event||i.event==="message")&&re(this,$r).call(this,o),this.dispatchEvent(o)}),Oe(this,da,i=>{ve(this,un,i)}),Oe(this,ha,()=>{ve(this,yr,void 0),re(this,We)===this.CONNECTING&&wt(this,ut,aa).call(this)});try{if(e instanceof URL)ve(this,Yt,e);else if(typeof e=="string")ve(this,Yt,new URL(e,Nw()));else throw new Error("Invalid URL")}catch{throw Iw("An invalid or illegal string was specified")}ve(this,br,lf({onEvent:re(this,la),onRetry:re(this,da)})),ve(this,We,this.CONNECTING),ve(this,un,3e3),ve(this,Ps,(n=r==null?void 0:r.fetch)!=null?n:globalThis.fetch),ve(this,Es,(s=r==null?void 0:r.withCredentials)!=null?s:!1),wt(this,ut,aa).call(this)}get readyState(){return re(this,We)}get url(){return re(this,Yt).href}get withCredentials(){return re(this,Es)}get onerror(){return re(this,wr)}set onerror(e){ve(this,wr,e)}get onmessage(){return re(this,$r)}set onmessage(e){ve(this,$r,e)}get onopen(){return re(this,dn)}set onopen(e){ve(this,dn,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(){re(this,yr)&&clearTimeout(re(this,yr)),re(this,We)!==this.CLOSED&&(re(this,xt)&&re(this,xt).abort(),ve(this,We,this.CLOSED),ve(this,xt,void 0))}}We=new WeakMap,Yt=new WeakMap,vr=new WeakMap,Es=new WeakMap,Ps=new WeakMap,un=new WeakMap,yr=new WeakMap,ln=new WeakMap,xt=new WeakMap,br=new WeakMap,wr=new WeakMap,$r=new WeakMap,dn=new WeakMap,ut=new WeakSet,aa=function(){ve(this,We,this.CONNECTING),ve(this,xt,new AbortController),re(this,Ps)(re(this,Yt),wt(this,ut,pf).call(this)).then(re(this,ca)).catch(re(this,ua))},ca=new WeakMap,ua=new WeakMap,pf=function(){var t;const e={mode:"cors",redirect:"follow",headers:{Accept:"text/event-stream",...re(this,ln)?{"Last-Event-ID":re(this,ln)}:void 0},cache:"no-store",signal:(t=re(this,xt))==null?void 0:t.signal};return"window"in globalThis&&(e.credentials=this.withCredentials?"include":"same-origin"),e},la=new WeakMap,da=new WeakMap,fn=function(t,e){var r;re(this,We)!==this.CLOSED&&ve(this,We,this.CLOSED);const n=new df("error",{code:e,message:t});(r=re(this,wr))==null||r.call(this,n),this.dispatchEvent(n)},fa=function(t,e){var r;if(re(this,We)===this.CLOSED)return;ve(this,We,this.CONNECTING);const n=new df("error",{code:e,message:t});(r=re(this,wr))==null||r.call(this,n),this.dispatchEvent(n),ve(this,yr,setTimeout(re(this,ha),re(this,un)))},ha=new WeakMap,Rs.CONNECTING=0,Rs.OPEN=1,Rs.CLOSED=2;function Nw(){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 Ts(t){return t?t instanceof Headers?Object.fromEntries(t.entries()):Array.isArray(t)?Object.fromEntries(t):{...t}:{}}function pa(t=fetch,e){return e?async(r,n)=>{const s={...e,...n,headers:n!=null&&n.headers?{...Ts(e.headers),...Ts(n.headers)}:e.headers};return t(r,s)}:t}class mf extends Error{constructor(e,r,n){super(`SSE error: ${r}`),this.code=e,this.event=n}}class Aw{constructor(e,r){this._url=e,this._resourceMetadataUrl=void 0,this._scope=void 0,this._eventSourceInit=r==null?void 0:r.eventSourceInit,this._requestInit=r==null?void 0:r.requestInit,this._authProvider=r==null?void 0:r.authProvider,this._fetch=r==null?void 0:r.fetch,this._fetchWithInit=pa(r==null?void 0:r.fetch,r==null?void 0:r.requestInit)}async _authThenStart(){var e;if(!this._authProvider)throw new Xe("No auth provider");let r;try{r=await Zt(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 Xe;return await this._startOrAuth()}async _commonHeaders(){var e;const r={};if(this._authProvider){const n=await this._authProvider.tokens();n&&(r.Authorization=`Bearer ${n.access_token}`)}return this._protocolVersion&&(r["mcp-protocol-version"]=this._protocolVersion),new Headers({...r,...(e=this._requestInit)===null||e===void 0?void 0:e.headers})}_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((i,o)=>{this._eventSource=new Rs(this._url.href,{...this._eventSourceInit,fetch:async(a,c)=>{const u=await this._commonHeaders();u.set("Accept","text/event-stream");const l=await s(a,{...c,headers:u});if(l.status===401&&l.headers.has("www-authenticate")){const{resourceMetadataUrl:f,scope:w}=cn(l);this._resourceMetadataUrl=f,this._scope=w}return l}}),this._abortController=new AbortController,this._eventSource.onerror=a=>{var c;if(a.code===401&&this._authProvider){this._authThenStart().then(i,o);return}const u=new mf(a.code,a.message,a);o(u),(c=this.onerror)===null||c===void 0||c.call(this,u)},this._eventSource.onopen=()=>{},this._eventSource.addEventListener("endpoint",a=>{var c;const u=a;try{if(this._endpoint=new URL(u.data,this._url),this._endpoint.origin!==this._url.origin)throw new Error(`Endpoint origin does not match connection origin: ${this._endpoint.origin}`)}catch(l){o(l),(c=this.onerror)===null||c===void 0||c.call(this,l),this.close();return}i()}),this._eventSource.onmessage=a=>{var c,u;const l=a;let f;try{f=Jr.parse(JSON.parse(l.data))}catch(w){(c=this.onerror)===null||c===void 0||c.call(this,w);return}(u=this.onmessage)===null||u===void 0||u.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 Xe("No auth provider");if(await Zt(this._authProvider,{serverUrl:this._url,authorizationCode:e,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})!=="AUTHORIZED")throw new Xe("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;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},a=await((n=this._fetch)!==null&&n!==void 0?n:fetch)(this._endpoint,o);if(!a.ok){if(a.status===401&&this._authProvider){const{resourceMetadataUrl:u,scope:l}=cn(a);if(this._resourceMetadataUrl=u,this._scope=l,await Zt(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})!=="AUTHORIZED")throw new Xe;return this.send(e)}const c=await a.text().catch(()=>null);throw new Error(`Error POSTing to endpoint (HTTP ${a.status}): ${c}`)}}catch(i){throw(s=this.onerror)===null||s===void 0||s.call(this,i),i}}setProtocolVersion(e){this._protocolVersion=e}}class jw extends TransformStream{constructor({onError:e,onRetry:r,onComment:n}={}){let s;super({start(i){s=lf({onEvent:o=>{i.enqueue(o)},onError(o){e==="terminate"?i.error(o):typeof e=="function"&&e(o)},onRetry:r,onComment:n})},transform(i){s.feed(i)}})}}const zw={initialReconnectionDelay:1e3,maxReconnectionDelay:3e4,reconnectionDelayGrowFactor:1.5,maxRetries:2};class Sr extends Error{constructor(e,r){super(`Streamable HTTP error: ${r}`),this.code=e}}class Mw{constructor(e,r){var n;this._hasCompletedAuthFlow=!1,this._url=e,this._resourceMetadataUrl=void 0,this._scope=void 0,this._requestInit=r==null?void 0:r.requestInit,this._authProvider=r==null?void 0:r.authProvider,this._fetch=r==null?void 0:r.fetch,this._fetchWithInit=pa(r==null?void 0:r.fetch,r==null?void 0:r.requestInit),this._sessionId=r==null?void 0:r.sessionId,this._reconnectionOptions=(n=r==null?void 0:r.reconnectionOptions)!==null&&n!==void 0?n:zw}async _authThenStart(){var e;if(!this._authProvider)throw new Xe("No auth provider");let r;try{r=await Zt(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 Xe;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=Ts((e=this._requestInit)===null||e===void 0?void 0:e.headers);return new Headers({...r,...n})}async _startOrAuthSse(e){var r,n,s;const{resumptionToken:i}=e;try{const o=await this._commonHeaders();o.set("Accept","text/event-stream"),i&&o.set("last-event-id",i);const a=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(!a.ok){if(a.status===401&&this._authProvider)return await this._authThenStart();if(a.status===405)return;throw new Sr(a.status,`Failed to open SSE stream: ${a.statusText}`)}this._handleSseStream(a.body,e,!0)}catch(o){throw(s=this.onerror)===null||s===void 0||s.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(s>0&&r>=s){(n=this.onerror)===null||n===void 0||n.call(this,new Error(`Maximum reconnection attempts (${s}) exceeded.`));return}const i=this._getNextReconnectionDelay(r);setTimeout(()=>{this._startOrAuthSse(e).catch(o=>{var a;(a=this.onerror)===null||a===void 0||a.call(this,new Error(`Failed to reconnect SSE stream: ${o instanceof Error?o.message:String(o)}`)),this._scheduleReconnection(e,r+1)})},i)}_handleSseStream(e,r,n){if(!e)return;const{onresumptiontoken:s,replayMessageId:i}=r;let o,a=!1;(async()=>{var u,l,f,w;try{const $=e.pipeThrough(new TextDecoderStream).pipeThrough(new jw({onRetry:v=>{this._serverRetryMs=v}})).getReader();for(;;){const{value:v,done:p}=await $.read();if(p)break;if(v.id&&(o=v.id,a=!0,s==null||s(v.id)),!v.event||v.event==="message")try{const d=Jr.parse(JSON.parse(v.data));i!==void 0&&Jn(d)&&(d.id=i),(u=this.onmessage)===null||u===void 0||u.call(this,d)}catch(d){(l=this.onerror)===null||l===void 0||l.call(this,d)}}(n||a)&&this._abortController&&!this._abortController.signal.aborted&&this._scheduleReconnection({resumptionToken:o,onresumptiontoken:s,replayMessageId:i},0)}catch($){if((f=this.onerror)===null||f===void 0||f.call(this,new Error(`SSE stream disconnected: ${$}`)),(n||a)&&this._abortController&&!this._abortController.signal.aborted)try{this._scheduleReconnection({resumptionToken:o,onresumptiontoken:s,replayMessageId:i},0)}catch(v){(w=this.onerror)===null||w===void 0||w.call(this,new Error(`Failed to reconnect: ${v instanceof Error?v.message:String(v)}`))}}})()}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 Xe("No auth provider");if(await Zt(this._authProvider,{serverUrl:this._url,authorizationCode:e,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})!=="AUTHORIZED")throw new Xe("Failed to authorize")}async close(){var e,r;(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,i,o;try{const{resumptionToken:a,onresumptiontoken:c}=r||{};if(a){this._startOrAuthSse({resumptionToken:a,replayMessageId:Gi(e)?e.id:void 0}).catch(p=>{var d;return(d=this.onerror)===null||d===void 0?void 0:d.call(this,p)});return}const u=await this._commonHeaders();u.set("content-type","application/json"),u.set("accept","application/json, text/event-stream");const l={...this._requestInit,method:"POST",headers:u,body:JSON.stringify(e),signal:(n=this._abortController)===null||n===void 0?void 0:n.signal},f=await((s=this._fetch)!==null&&s!==void 0?s:fetch)(this._url,l),w=f.headers.get("mcp-session-id");if(w&&(this._sessionId=w),!f.ok){if(f.status===401&&this._authProvider){if(this._hasCompletedAuthFlow)throw new Sr(401,"Server returned 401 after successful authentication");const{resourceMetadataUrl:d,scope:m}=cn(f);if(this._resourceMetadataUrl=d,this._scope=m,await Zt(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})!=="AUTHORIZED")throw new Xe;return this._hasCompletedAuthFlow=!0,this.send(e)}if(f.status===403&&this._authProvider){const{resourceMetadataUrl:d,scope:m,error:S}=cn(f);if(S==="insufficient_scope"){const E=f.headers.get("WWW-Authenticate");if(this._lastUpscopingHeader===E)throw new Sr(403,"Server returned 403 after trying upscoping");if(m&&(this._scope=m),d&&(this._resourceMetadataUrl=d),this._lastUpscopingHeader=E??void 0,await Zt(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetch})!=="AUTHORIZED")throw new Xe;return this.send(e)}}const p=await f.text().catch(()=>null);throw new Error(`Error POSTing to endpoint (HTTP ${f.status}): ${p}`)}if(this._hasCompletedAuthFlow=!1,this._lastUpscopingHeader=void 0,f.status===202){el(e)&&this._startOrAuthSse({resumptionToken:void 0}).catch(p=>{var d;return(d=this.onerror)===null||d===void 0?void 0:d.call(this,p)});return}const g=(Array.isArray(e)?e:[e]).filter(p=>"method"in p&&"id"in p&&p.id!==void 0).length>0,v=f.headers.get("content-type");if(g)if(v!=null&&v.includes("text/event-stream"))this._handleSseStream(f.body,{onresumptiontoken:c},!1);else if(v!=null&&v.includes("application/json")){const p=await f.json(),d=Array.isArray(p)?p.map(m=>Jr.parse(m)):[Jr.parse(p)];for(const m of d)(i=this.onmessage)===null||i===void 0||i.call(this,m)}else throw new Sr(-1,`Unexpected content type: ${v}`)}catch(a){throw(o=this.onerror)===null||o===void 0||o.call(this,a),a}}get sessionId(){return this._sessionId}async terminateSession(){var e,r,n;if(this._sessionId)try{const s=await this._commonHeaders(),i={...this._requestInit,method:"DELETE",headers:s,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(!o.ok&&o.status!==405)throw new Sr(o.status,`Failed to terminate session: ${o.statusText}`);this._sessionId=void 0}catch(s){throw(n=this.onerror)===null||n===void 0||n.call(this,s),s}}setProtocolVersion(e){this._protocolVersion=e}get protocolVersion(){return this._protocolVersion}async resumeStream(e,r){await this._startOrAuthSse({resumptionToken:e,onresumptiontoken:r==null?void 0:r.onresumptiontoken})}}class Zw extends Mo{constructor(e,r){var n,s;super(r),this._serverInfo=e,this._loggingLevels=new Map,this.LOG_LEVEL_SEVERITY=new Map(Yr.options.map((i,o)=>[i,o])),this.isMessageIgnored=(i,o)=>{const a=this._loggingLevels.get(o);return a?this.LOG_LEVEL_SEVERITY.get(i)<this.LOG_LEVEL_SEVERITY.get(a):!1},this._capabilities=(n=r==null?void 0:r.capabilities)!==null&&n!==void 0?n:{},this._instructions=r==null?void 0:r.instructions,this._jsonSchemaValidator=(s=r==null?void 0:r.jsonSchemaValidator)!==null&&s!==void 0?s:new Wd,this.setRequestHandler(Gn,i=>this._oninitialize(i)),this.setNotificationHandler(Yn,()=>{var i;return(i=this.oninitialized)===null||i===void 0?void 0:i.call(this)}),this._capabilities.logging&&this.setRequestHandler(vo,async(i,o)=>{var a;const c=o.sessionId||((a=o.requestInfo)===null||a===void 0?void 0:a.headers["mcp-session-id"])||void 0,{level:u}=i.params,l=Yr.safeParse(u);return l.success&&this._loggingLevels.set(c,l.data),{}})}registerCapabilities(e){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=Zo(this._capabilities,e)}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){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}}async _oninitialize(e){const r=e.params.protocolVersion;return this._clientCapabilities=e.params.capabilities,this._clientVersion=e.params.clientInfo,{protocolVersion:Wi.includes(r)?r:Kt,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"},Nt)}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 i=e.messages[e.messages.length-1],o=Array.isArray(i.content)?i.content:[i.content],a=o.some(f=>f.type==="tool_result"),c=e.messages.length>1?e.messages[e.messages.length-2]:void 0,u=c?Array.isArray(c.content)?c.content:[c.content]:[],l=u.some(f=>f.type==="tool_use");if(a){if(o.some(f=>f.type!=="tool_result"))throw new Error("The last message must contain only tool_result content if any is present");if(!l)throw new Error("tool_result blocks are not matching any tool_use from the previous message")}if(l){const f=new Set(u.filter($=>$.type==="tool_use").map($=>$.id)),w=new Set(o.filter($=>$.type==="tool_result").map($=>$.toolUseId));if(f.size!==w.size||![...f].every($=>w.has($)))throw new Error("ids of tool_result blocks and tool_use blocks from previous message do not match")}}return this.request({method:"sampling/createMessage",params:e},yo,r)}async elicitInput(e,r){var n,s,i,o,a;switch((n=e.mode)!==null&&n!==void 0?n:"form"){case"url":{if(!(!((i=(s=this._clientCapabilities)===null||s===void 0?void 0:s.elicitation)===null||i===void 0)&&i.url))throw new Error("Client does not support url elicitation.");const u=e;return this.request({method:"elicitation/create",params:u},Qr,r)}case"form":{if(!(!((a=(o=this._clientCapabilities)===null||o===void 0?void 0:o.elicitation)===null||a===void 0)&&a.form))throw new Error("Client does not support form elicitation.");const u=e.mode==="form"?e:{...e,mode:"form"},l=await this.request({method:"elicitation/create",params:u},Qr,r);if(l.action==="accept"&&l.content&&u.requestedSchema)try{const w=this._jsonSchemaValidator.getValidator(u.requestedSchema)(l.content);if(!w.valid)throw new se(_.ErrorCode.InvalidParams,`Elicitation response content does not match requested schema: ${w.errorMessage}`)}catch(f){throw f instanceof se?f:new se(_.ErrorCode.InternalError,`Error validating elicitation response: ${f instanceof Error?f.message:String(f)}`)}return l}}}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},So,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 xw=/^[A-Za-z0-9._-]{1,128}$/;function Lw(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"),!xw.test(t)){const r=t.split("").filter(n=>!/[A-Za-z0-9._-]/.test(n)).filter((n,s,i)=>i.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 Uw(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 _f(t){const e=Lw(t);return Uw(t,e.warnings),e.isValid}class Dw{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 Zw(e,r)}async connect(e){return await this.server.connect(e)}async close(){await this.server.close()}setToolRequestHandlers(){this._toolHandlersInitialized||(this.server.assertCanSetRequestHandler(Lt(as)),this.server.assertCanSetRequestHandler(Lt(us)),this.server.registerCapabilities({tools:{listChanged:!0}}),this.server.setRequestHandler(as,()=>({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=an(r.inputSchema);return s?Ld(s,{strictUnions:!0,pipeStrategy:"input"}):Vw})(),annotations:r.annotations,_meta:r._meta};if(r.outputSchema){const s=an(r.outputSchema);s&&(n.outputSchema=Ld(s,{strictUnions:!0,pipeStrategy:"output"}))}return n})})),this.server.setRequestHandler(us,async(e,r)=>{const n=this._registeredTools[e.params.name];let s;try{if(!n)throw new se(_.ErrorCode.InvalidParams,`Tool ${e.params.name} not found`);if(!n.enabled)throw new se(_.ErrorCode.InvalidParams,`Tool ${e.params.name} disabled`);if(n.inputSchema){const i=n.callback,o=an(n.inputSchema),a=o??n.inputSchema,c=await No(a,e.params.arguments);if(!c.success)throw new se(_.ErrorCode.InvalidParams,`Input validation error: Invalid arguments for tool ${e.params.name}: ${Ao(c.error)}`);const u=c.data;s=await Promise.resolve(i(u,r))}else{const i=n.callback;s=await Promise.resolve(i(r))}if(n.outputSchema&&!s.isError){if(!s.structuredContent)throw new se(_.ErrorCode.InvalidParams,`Output validation error: Tool ${e.params.name} has an output schema but no structured content was provided`);const i=an(n.outputSchema),o=await No(i,s.structuredContent);if(!o.success)throw new se(_.ErrorCode.InvalidParams,`Output validation error: Invalid structured content for tool ${e.params.name}: ${Ao(o.error)}`)}}catch(i){if(i instanceof se&&i.code===_.ErrorCode.UrlElicitationRequired)throw i;return this.createToolError(i instanceof Error?i.message:String(i))}return s}),this._toolHandlersInitialized=!0)}createToolError(e){return{content:[{type:"text",text:e}],isError:!0}}setCompletionRequestHandler(){this._completionHandlerInitialized||(this.server.assertCanSetRequestHandler(Lt(ls)),this.server.registerCapabilities({completions:{}}),this.server.setRequestHandler(ls,async e=>{switch(e.params.ref.type){case"ref/prompt":return Ql(e),this.handlePromptCompletion(e,e.params.ref);case"ref/resource":return ed(e),this.handleResourceCompletion(e,e.params.ref);default:throw new se(_.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 se(_.ErrorCode.InvalidParams,`Prompt ${r.name} not found`);if(!n.enabled)throw new se(_.ErrorCode.InvalidParams,`Prompt ${r.name} disabled`);if(!n.argsSchema)return hn;const s=on(n.argsSchema),i=s==null?void 0:s[e.params.argument.name];if(!ad(i))return hn;const o=cd(i);if(!o)return hn;const a=await o(e.params.argument.value,e.params.context);return vf(a)}async handleResourceCompletion(e,r){const n=Object.values(this._registeredResourceTemplates).find(o=>o.resourceTemplate.uriTemplate.toString()===r.uri);if(!n){if(this._registeredResources[r.uri])return hn;throw new se(_.ErrorCode.InvalidParams,`Resource template ${e.params.ref.uri} not found`)}const s=n.resourceTemplate.completeCallback(e.params.argument.name);if(!s)return hn;const i=await s(e.params.argument.value,e.params.context);return vf(i)}setResourceRequestHandlers(){this._resourceHandlersInitialized||(this.server.assertCanSetRequestHandler(Lt(es)),this.server.assertCanSetRequestHandler(Lt(ts)),this.server.assertCanSetRequestHandler(Lt(ns)),this.server.registerCapabilities({resources:{listChanged:!0}}),this.server.setRequestHandler(es,async(e,r)=>{const n=Object.entries(this._registeredResources).filter(([i,o])=>o.enabled).map(([i,o])=>({uri:i,name:o.name,...o.metadata})),s=[];for(const i of Object.values(this._registeredResourceTemplates)){if(!i.resourceTemplate.listCallback)continue;const o=await i.resourceTemplate.listCallback(r);for(const a of o.resources)s.push({...i.metadata,...a})}return{resources:[...n,...s]}}),this.server.setRequestHandler(ts,async()=>({resourceTemplates:Object.entries(this._registeredResourceTemplates).map(([r,n])=>({name:r,uriTemplate:n.resourceTemplate.uriTemplate.toString(),...n.metadata}))})),this.server.setRequestHandler(ns,async(e,r)=>{const n=new URL(e.params.uri),s=this._registeredResources[n.toString()];if(s){if(!s.enabled)throw new se(_.ErrorCode.InvalidParams,`Resource ${n} disabled`);return s.readCallback(n,r)}for(const i of Object.values(this._registeredResourceTemplates)){const o=i.resourceTemplate.uriTemplate.match(n.toString());if(o)return i.readCallback(n,o,r)}throw new se(_.ErrorCode.InvalidParams,`Resource ${n} not found`)}),this.setCompletionRequestHandler(),this._resourceHandlersInitialized=!0)}setPromptRequestHandlers(){this._promptHandlersInitialized||(this.server.assertCanSetRequestHandler(Lt(ss)),this.server.assertCanSetRequestHandler(Lt(is)),this.server.registerCapabilities({prompts:{listChanged:!0}}),this.server.setRequestHandler(ss,()=>({prompts:Object.entries(this._registeredPrompts).filter(([,e])=>e.enabled).map(([e,r])=>({name:e,title:r.title,description:r.description,arguments:r.argsSchema?Hw(r.argsSchema):void 0}))})),this.server.setRequestHandler(is,async(e,r)=>{const n=this._registeredPrompts[e.params.name];if(!n)throw new se(_.ErrorCode.InvalidParams,`Prompt ${e.params.name} not found`);if(!n.enabled)throw new se(_.ErrorCode.InvalidParams,`Prompt ${e.params.name} disabled`);if(n.argsSchema){const s=an(n.argsSchema),i=await No(s,e.params.arguments);if(!i.success)throw new se(_.ErrorCode.InvalidParams,`Invalid arguments for prompt ${e.params.name}: ${Ao(i.error)}`);const o=i.data,a=n.callback;return await Promise.resolve(a(o,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 i=n[0];if(typeof r=="string"){if(this._registeredResources[r])throw new Error(`Resource ${r} is already registered`);const o=this._createRegisteredResource(e,void 0,r,s,i);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),o}else{if(this._registeredResourceTemplates[e])throw new Error(`Resource template ${e} is already registered`);const o=this._createRegisteredResourceTemplate(e,void 0,r,s,i);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),o}}registerResource(e,r,n,s){if(typeof r=="string"){if(this._registeredResources[r])throw new Error(`Resource ${r} is already registered`);const i=this._createRegisteredResource(e,n.title,r,n,s);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,n.title,r,n,s);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),i}}_createRegisteredResource(e,r,n,s,i){const o={name:e,title:r,metadata:s,readCallback:i,enabled:!0,disable:()=>o.update({enabled:!1}),enable:()=>o.update({enabled:!0}),remove:()=>o.update({uri:null}),update:a=>{typeof a.uri<"u"&&a.uri!==n&&(delete this._registeredResources[n],a.uri&&(this._registeredResources[a.uri]=o)),typeof a.name<"u"&&(o.name=a.name),typeof a.title<"u"&&(o.title=a.title),typeof a.metadata<"u"&&(o.metadata=a.metadata),typeof a.callback<"u"&&(o.readCallback=a.callback),typeof a.enabled<"u"&&(o.enabled=a.enabled),this.sendResourceListChanged()}};return this._registeredResources[n]=o,o}_createRegisteredResourceTemplate(e,r,n,s,i){const o={resourceTemplate:n,title:r,metadata:s,readCallback:i,enabled:!0,disable:()=>o.update({enabled:!1}),enable:()=>o.update({enabled:!0}),remove:()=>o.update({name:null}),update:a=>{typeof a.name<"u"&&a.name!==e&&(delete this._registeredResourceTemplates[e],a.name&&(this._registeredResourceTemplates[a.name]=o)),typeof a.title<"u"&&(o.title=a.title),typeof a.template<"u"&&(o.resourceTemplate=a.template),typeof a.metadata<"u"&&(o.metadata=a.metadata),typeof a.callback<"u"&&(o.readCallback=a.callback),typeof a.enabled<"u"&&(o.enabled=a.enabled),this.sendResourceListChanged()}};return this._registeredResourceTemplates[e]=o,o}_createRegisteredPrompt(e,r,n,s,i){const o={title:r,description:n,argsSchema:s===void 0?void 0:sn(s),callback:i,enabled:!0,disable:()=>o.update({enabled:!1}),enable:()=>o.update({enabled:!0}),remove:()=>o.update({name:null}),update:a=>{typeof a.name<"u"&&a.name!==e&&(delete this._registeredPrompts[e],a.name&&(this._registeredPrompts[a.name]=o)),typeof a.title<"u"&&(o.title=a.title),typeof a.description<"u"&&(o.description=a.description),typeof a.argsSchema<"u"&&(o.argsSchema=sn(a.argsSchema)),typeof a.callback<"u"&&(o.callback=a.callback),typeof a.enabled<"u"&&(o.enabled=a.enabled),this.sendPromptListChanged()}};return this._registeredPrompts[e]=o,o}_createRegisteredTool(e,r,n,s,i,o,a,c){_f(e);const u={title:r,description:n,inputSchema:gf(s),outputSchema:gf(i),annotations:o,_meta:a,callback:c,enabled:!0,disable:()=>u.update({enabled:!1}),enable:()=>u.update({enabled:!0}),remove:()=>u.update({name:null}),update:l=>{typeof l.name<"u"&&l.name!==e&&(typeof l.name=="string"&&_f(l.name),delete this._registeredTools[e],l.name&&(this._registeredTools[l.name]=u)),typeof l.title<"u"&&(u.title=l.title),typeof l.description<"u"&&(u.description=l.description),typeof l.paramsSchema<"u"&&(u.inputSchema=sn(l.paramsSchema)),typeof l.callback<"u"&&(u.callback=l.callback),typeof l.annotations<"u"&&(u.annotations=l.annotations),typeof l._meta<"u"&&(u._meta=l._meta),typeof l.enabled<"u"&&(u.enabled=l.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,i,o;if(typeof r[0]=="string"&&(n=r.shift()),r.length>1){const c=r[0];ma(c)?(s=r.shift(),r.length>1&&typeof r[0]=="object"&&r[0]!==null&&!ma(r[0])&&(o=r.shift())):typeof c=="object"&&c!==null&&(o=r.shift())}const a=r[0];return this._createRegisteredTool(e,void 0,n,s,i,o,void 0,a)}registerTool(e,r,n){if(this._registeredTools[e])throw new Error(`Tool ${e} is already registered`);const{title:s,description:i,inputSchema:o,outputSchema:a,annotations:c,_meta:u}=r;return this._createRegisteredTool(e,s,i,o,a,c,u,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 i=r[0],o=this._createRegisteredPrompt(e,void 0,n,s,i);return this.setPromptRequestHandlers(),this.sendPromptListChanged(),o}registerPrompt(e,r,n){if(this._registeredPrompts[e])throw new Error(`Prompt ${e} is already registered`);const{title:s,description:i,argsSchema:o}=r,a=this._createRegisteredPrompt(e,s,i,o,n);return this.setPromptRequestHandlers(),this.sendPromptListChanged(),a}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 qw{constructor(e,r){this._callbacks=r,this._uriTemplate=typeof e=="string"?new yt(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 Vw={type:"object",properties:{}};function ma(t){return typeof t!="object"||t===null?!1:Object.keys(t).length===0||Object.values(t).some(Fw)}function Fw(t){return t!==null&&typeof t=="object"&&"parse"in t&&typeof t.parse=="function"&&"safeParse"in t&&typeof t.safeParse=="function"}function gf(t){if(t)return ma(t)?sn(t):t}function Hw(t){const e=on(t);return e?Object.entries(e).map(([r,n])=>{const s=_b(n),i=gb(n);return{name:r,description:s,required:!i}}):[]}function Lt(t){const e=on(t),r=e==null?void 0:e.method;if(!r)throw new Error("Schema is missing a method literal");const n=Cd(r);if(typeof n=="string")return n;throw new Error("Schema method literal must be a string")}function vf(t){return{completion:{values:t.slice(0,100),total:t.length,hasMore:t.length>100}}}const hn={completion:{values:[],hasMore:!1}};_.Ajv=T_,_.AudioContentSchema=po,_.BaseMetadataSchema=Jt,_.BlobResourceContentsSchema=io,_.BooleanSchemaSchema=jl,_.COMPLETABLE_SYMBOL=ds,_.CallToolRequestParamsSchema=$l,_.CallToolRequestSchema=us,_.CallToolResultSchema=cs,_.CancelledNotificationParamsSchema=Bu,_.CancelledNotificationSchema=Bn,_.Client=ow,_.ClientCapabilitiesSchema=Yu,_.ClientNotificationSchema=N0,_.ClientRequestSchema=I0,_.ClientResultSchema=A0,_.CompatibilityCallToolResultSchema=C0,_.CompleteRequestParamsSchema=Xl,_.CompleteRequestSchema=ls,_.CompleteResultSchema=$o,_.ContentBlockSchema=os,_.CreateMessageRequestParamsSchema=Nl,_.CreateMessageRequestSchema=Al,_.CreateMessageResultSchema=yo,_.CursorSchema=Ji,_.DEFAULT_NEGOTIATED_PROTOCOL_VERSION=k0,_.DEFAULT_REQUEST_TIMEOUT_MSEC=qd,_.ElicitRequestFormParamsSchema=Wl,_.ElicitRequestParamsSchema=Jl,_.ElicitRequestSchema=bo,_.ElicitRequestURLParamsSchema=Kl,_.ElicitResultSchema=Qr,_.ElicitationCompleteNotificationParamsSchema=Bl,_.ElicitationCompleteNotificationSchema=Gl,_.EmbeddedResourceSchema=gl,_.EmptyResultSchema=Nt,_.EnumSchemaSchema=Fl,_.GetPromptRequestParamsSchema=ml,_.GetPromptRequestSchema=is,_.GetPromptResultSchema=mo,_.IconSchema=Gu,_.IconsSchema=dr,_.ImageContentSchema=ho,_.ImplementationSchema=eo,_.InitializeRequestParamsSchema=Xu,_.InitializeRequestSchema=Gn,_.InitializeResultSchema=to,_.InitializedNotificationSchema=Yn,_.JSONRPCErrorSchema=Qi,_.JSONRPCMessageSchema=Jr,_.JSONRPCNotificationSchema=Yi,_.JSONRPCRequestSchema=Bi,_.JSONRPCResponseSchema=Xi,_.JSONRPC_VERSION=Wr,_.LATEST_PROTOCOL_VERSION=Kt,_.LegacyTitledEnumSchemaSchema=Ll,_.ListPromptsRequestSchema=ss,_.ListPromptsResultSchema=lo,_.ListResourceTemplatesRequestSchema=ts,_.ListResourceTemplatesResultSchema=co,_.ListResourcesRequestSchema=es,_.ListResourcesResultSchema=ao,_.ListRootsRequestSchema=rd,_.ListRootsResultSchema=So,_.ListToolsRequestSchema=as,_.ListToolsResultSchema=go,_.LoggingLevelSchema=Yr,_.LoggingMessageNotificationParamsSchema=El,_.LoggingMessageNotificationSchema=Pl,_.McpError=se,_.McpServer=Dw,_.ModelHintSchema=Rl,_.ModelPreferencesSchema=Tl,_.MultiSelectEnumSchemaSchema=Vl,_.NotificationSchema=Ge,_.NumberSchemaSchema=Ml,_.PaginatedRequestParamsSchema=nl,_.PaginatedRequestSchema=Br,_.PaginatedResultSchema=Gr,_.PingRequestSchema=Xn,_.PrimitiveSchemaDefinitionSchema=Hl,_.ProgressNotificationParamsSchema=rl,_.ProgressNotificationSchema=Qn,_.ProgressSchema=tl,_.ProgressTokenSchema=Ki,_.PromptArgumentSchema=hl,_.PromptListChangedNotificationSchema=bl,_.PromptMessageSchema=yl,_.PromptReferenceSchema=Yl,_.PromptSchema=pl,_.Protocol=Mo,_.ReadResourceRequestParamsSchema=il,_.ReadResourceRequestSchema=ns,_.ReadResourceResultSchema=uo,_.RequestIdSchema=Kr,_.RequestSchema=Ue,_.ResourceContentsSchema=ro,_.ResourceLinkSchema=vl,_.ResourceListChangedNotificationSchema=ol,_.ResourceReferenceSchema=O0,_.ResourceRequestParamsSchema=rs,_.ResourceSchema=oo,_.ResourceTemplate=qw,_.ResourceTemplateReferenceSchema=wo,_.ResourceTemplateSchema=sl,_.ResourceUpdatedNotificationParamsSchema=dl,_.ResourceUpdatedNotificationSchema=fl,_.ResultSchema=Ke,_.RootSchema=td,_.RootsListChangedNotificationSchema=nd,_.SSEClientTransport=Aw,_.SUPPORTED_PROTOCOL_VERSIONS=Wi,_.SamplingMessageContentBlockSchema=Xr,_.SamplingMessageSchema=Il,_.ServerCapabilitiesSchema=Qu,_.ServerNotificationSchema=z0,_.ServerRequestSchema=j0,_.ServerResultSchema=M0,_.SetLevelRequestParamsSchema=kl,_.SetLevelRequestSchema=vo,_.SingleSelectEnumSchemaSchema=Ul,_.SseError=mf,_.StreamableHTTPClientTransport=Mw,_.StreamableHTTPError=Sr,_.StringSchemaSchema=zl,_.SubscribeRequestParamsSchema=al,_.SubscribeRequestSchema=cl,_.TextContentSchema=fo,_.TextResourceContentsSchema=no,_.TitledMultiSelectEnumSchemaSchema=ql,_.TitledSingleSelectEnumSchemaSchema=xl,_.ToolAnnotationsSchema=wl,_.ToolChoiceSchema=Cl,_.ToolListChangedNotificationSchema=Sl,_.ToolResultContentSchema=Ol,_.ToolSchema=_o,_.ToolUseContentSchema=_l,_.UnauthorizedError=Xe,_.UnsubscribeRequestParamsSchema=ul,_.UnsubscribeRequestSchema=ll,_.UntitledMultiSelectEnumSchemaSchema=Dl,_.UntitledSingleSelectEnumSchemaSchema=Zl,_.UriTemplate=yt,_.UrlElicitationRequiredError=sd,_.assertCompleteRequestPrompt=Ql,_.assertCompleteRequestResourceTemplate=ed,_.auth=Zt,_.buildDiscoveryUrls=rf,_.completable=x0,_.createFetchWithInit=pa,_.discoverAuthorizationServerMetadata=nf,_.discoverOAuthMetadata=Cw,_.discoverOAuthProtectedResourceMetadata=Qd,_.exchangeAuthorization=of,_.extractResourceMetadataUrl=Pw,_.extractWWWAuthenticateParams=cn,_.getCompleter=cd,_.getDisplayName=U0,_.getSupportedElicitationModes=Kd,_.isCompletable=ad,_.isHttpsUrl=Yd,_.isInitializeRequest=T0,_.isInitializedNotification=el,_.isJSONRPCError=Ju,_.isJSONRPCNotification=Ku,_.isJSONRPCRequest=Gi,_.isJSONRPCResponse=Jn,_.mergeCapabilities=Zo,_.normalizeHeaders=Ts,_.parseErrorResponse=ks,_.refreshAuthorization=af,_.registerClient=cf,_.selectClientAuthMethod=ea,_.selectResourceURL=Xd,_.startAuthorization=sf,_.unwrapCompletable=L0,Object.defineProperty(_,Symbol.toStringTag,{value:"Module"})});
|