@opentiny/next-sdk 0.1.13 → 0.1.14-alpha.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.
Files changed (62) hide show
  1. package/agent/AgentModelProvider.ts +49 -20
  2. package/agent/type.ts +4 -4
  3. package/dist/McpSdk.d.ts +14 -0
  4. package/dist/WebAgent.d.ts +5 -0
  5. package/dist/WebMcp.d.ts +20 -0
  6. package/dist/WebMcpClient.d.ts +250 -1488
  7. package/dist/WebMcpServer.d.ts +190 -78
  8. package/dist/Zod.d.ts +1 -0
  9. package/dist/agent/AgentModelProvider.d.ts +6 -4
  10. package/dist/agent/type.d.ts +6 -2
  11. package/dist/agent/utils/getAISDKTools.d.ts +1 -0
  12. package/dist/index.d.ts +2 -1
  13. package/dist/index.es.dev.js +23743 -25868
  14. package/dist/index.es.js +24524 -24312
  15. package/dist/index.js +1789 -25
  16. package/dist/index.umd.dev.js +23845 -25970
  17. package/dist/index.umd.js +185 -129
  18. package/dist/{mcpsdk@1.20.1.dev.js → mcpsdk@1.23.0.dev.js} +13535 -14184
  19. package/dist/{mcpsdk@1.20.1.es.dev.js → mcpsdk@1.23.0.es.dev.js} +13563 -14212
  20. package/dist/mcpsdk@1.23.0.es.js +15584 -0
  21. package/dist/mcpsdk@1.23.0.js +43 -0
  22. package/dist/remoter/createRemoter.d.ts +9 -0
  23. package/dist/remoter/tooltips.d.ts +36 -0
  24. package/dist/script/utils.d.ts +1 -0
  25. package/dist/transport/ExtensionClientTransport.d.ts +3 -2
  26. package/dist/transport/ExtensionContentServerTransport.d.ts +3 -2
  27. package/dist/transport/ExtensionPageServerTransport.d.ts +3 -2
  28. package/dist/vite-build-tsc.d.ts +2 -0
  29. package/dist/vite.config.d.ts +2 -0
  30. package/dist/vite.config.mcpSdk.d.ts +2 -0
  31. package/dist/vite.config.webAgent.d.ts +2 -0
  32. package/dist/vite.config.webMcp.d.ts +2 -0
  33. package/dist/vite.config.webMcpFull.d.ts +2 -0
  34. package/dist/vite.config.zod.d.ts +2 -0
  35. package/dist/webagent.dev.js +18803 -18836
  36. package/dist/webagent.es.dev.js +17726 -17759
  37. package/dist/webagent.es.js +22571 -20829
  38. package/dist/webagent.js +172 -109
  39. package/dist/webmcp-full.dev.js +14463 -15009
  40. package/dist/webmcp-full.es.dev.js +14471 -15017
  41. package/dist/webmcp-full.es.js +13391 -12365
  42. package/dist/webmcp-full.js +43 -16
  43. package/package.json +3 -2
  44. package/remoter/createRemoter.ts +126 -71
  45. package/remoter/tooltips.ts +260 -0
  46. package/tsconfig.json +5 -3
  47. package/vite-build-tsc.ts +60 -0
  48. package/vite-env.d.ts +5 -0
  49. package/dist/WebMcpClient.js +0 -363
  50. package/dist/WebMcpServer.js +0 -283
  51. package/dist/agent/AgentModelProvider.js +0 -293
  52. package/dist/agent/type.js +0 -1
  53. package/dist/agent/utils/getAISDKTools.js +0 -36
  54. package/dist/mcpsdk@1.20.1.es.js +0 -14600
  55. package/dist/mcpsdk@1.20.1.js +0 -16
  56. package/dist/remoter/QrCode.js +0 -55
  57. package/dist/remoter/createRemoter.js +0 -743
  58. package/dist/transport/ExtensionClientTransport.js +0 -81
  59. package/dist/transport/ExtensionContentServerTransport.js +0 -128
  60. package/dist/transport/ExtensionPageServerTransport.js +0 -118
  61. package/dist/transport/messages.js +0 -51
  62. package/dist/utils/uuid.js +0 -10
@@ -1,16 +1,43 @@
1
- (function(Te,wa){typeof exports=="object"&&typeof module<"u"?wa(exports):typeof define=="function"&&define.amd?define(["exports"],wa):(Te=typeof globalThis<"u"?globalThis:Te||self,wa(Te.WebMCP={}))})(this,function(Te){"use strict";var wa=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function hc(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var An={exports:{}},pc={},kt={},Kr={},ba={},ge={},$a={};(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(w){if(super(),!t.IDENTIFIER.test(w))throw new Error("CodeGen: name must be a valid identifier");this.str=w}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}}t.Name=r;class s extends e{constructor(w){super(),this._items=typeof w=="string"?[w]:w}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;const w=this._items[0];return w===""||w==='""'}get str(){var w;return(w=this._str)!==null&&w!==void 0?w:this._str=this._items.reduce((P,S)=>`${P}${S}`,"")}get names(){var w;return(w=this._names)!==null&&w!==void 0?w:this._names=this._items.reduce((P,S)=>(S instanceof r&&(P[S.str]=(P[S.str]||0)+1),P),{})}}t._Code=s,t.nil=new s("");function a(v,...w){const P=[v[0]];let S=0;for(;S<w.length;)o(P,w[S]),P.push(v[++S]);return new s(P)}t._=a;const n=new s("+");function i(v,...w){const P=[f(v[0])];let S=0;for(;S<w.length;)P.push(n),o(P,w[S]),P.push(n,f(v[++S]));return l(P),new s(P)}t.str=i;function o(v,w){w instanceof s?v.push(...w._items):w instanceof r?v.push(w):v.push(d(w))}t.addCodeArg=o;function l(v){let w=1;for(;w<v.length-1;){if(v[w]===n){const P=c(v[w-1],v[w+1]);if(P!==void 0){v.splice(w-1,3,P);continue}v[w++]="+"}w++}}function c(v,w){if(w==='""')return v;if(v==='""')return w;if(typeof v=="string")return w instanceof r||v[v.length-1]!=='"'?void 0:typeof w!="string"?`${v.slice(0,-1)}${w}"`:w[0]==='"'?v.slice(0,-1)+w.slice(1):void 0;if(typeof w=="string"&&w[0]==='"'&&!(v instanceof r))return`"${v}${w.slice(1)}`}function u(v,w){return w.emptyStr()?v:v.emptyStr()?w:i`${v}${w}`}t.strConcat=u;function d(v){return typeof v=="number"||typeof v=="boolean"||v===null?v:f(Array.isArray(v)?v.join(","):v)}function g(v){return new s(f(v))}t.stringify=g;function f(v){return JSON.stringify(v).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}t.safeStringify=f;function m(v){return typeof v=="string"&&t.IDENTIFIER.test(v)?new s(`.${v}`):a`[${v}]`}t.getProperty=m;function p(v){if(typeof v=="string"&&t.IDENTIFIER.test(v))return new s(`${v}`);throw new Error(`CodeGen: invalid export name: ${v}, use explicit $id name mapping`)}t.getEsmExportName=p;function h(v){return new s(v.toString())}t.regexpCode=h})($a);var jn={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.ValueScope=t.ValueScopeName=t.Scope=t.varKinds=t.UsedValueState=void 0;const e=$a;class r extends Error{constructor(c){super(`CodeGen: "code" for ${c} not defined`),this.value=c.value}}var s;(function(l){l[l.Started=0]="Started",l[l.Completed=1]="Completed"})(s||(t.UsedValueState=s={})),t.varKinds={const:new e.Name("const"),let:new e.Name("let"),var:new e.Name("var")};class a{constructor({prefixes:c,parent:u}={}){this._names={},this._prefixes=c,this._parent=u}toName(c){return c instanceof e.Name?c:this.name(c)}name(c){return new e.Name(this._newName(c))}_newName(c){const u=this._names[c]||this._nameGroup(c);return`${c}${u.index++}`}_nameGroup(c){var u,d;if(!((d=(u=this._parent)===null||u===void 0?void 0:u._prefixes)===null||d===void 0)&&d.has(c)||this._prefixes&&!this._prefixes.has(c))throw new Error(`CodeGen: prefix "${c}" is not allowed in this scope`);return this._names[c]={prefix:c,index:0}}}t.Scope=a;class n extends e.Name{constructor(c,u){super(u),this.prefix=c}setValue(c,{property:u,itemIndex:d}){this.value=c,this.scopePath=(0,e._)`.${new e.Name(u)}[${d}]`}}t.ValueScopeName=n;const i=(0,e._)`\n`;class o extends a{constructor(c){super(c),this._values={},this._scope=c.scope,this.opts={...c,_n:c.lines?i:e.nil}}get(){return this._scope}name(c){return new n(c,this._newName(c))}value(c,u){var d;if(u.ref===void 0)throw new Error("CodeGen: ref must be passed in value");const g=this.toName(c),{prefix:f}=g,m=(d=u.key)!==null&&d!==void 0?d:u.ref;let p=this._values[f];if(p){const w=p.get(m);if(w)return w}else p=this._values[f]=new Map;p.set(m,g);const h=this._scope[f]||(this._scope[f]=[]),v=h.length;return h[v]=u.ref,g.setValue(u,{property:f,itemIndex:v}),g}getValue(c,u){const d=this._values[c];if(d)return d.get(u)}scopeRefs(c,u=this._values){return this._reduceValues(u,d=>{if(d.scopePath===void 0)throw new Error(`CodeGen: name "${d}" has no value`);return(0,e._)`${c}${d.scopePath}`})}scopeCode(c=this._values,u,d){return this._reduceValues(c,g=>{if(g.value===void 0)throw new Error(`CodeGen: name "${g}" has no value`);return g.value.code},u,d)}_reduceValues(c,u,d={},g){let f=e.nil;for(const m in c){const p=c[m];if(!p)continue;const h=d[m]=d[m]||new Map;p.forEach(v=>{if(h.has(v))return;h.set(v,s.Started);let w=u(v);if(w){const P=this.opts.es5?t.varKinds.var:t.varKinds.const;f=(0,e._)`${f}${P} ${v} = ${w};${this.opts._n}`}else if(w=g==null?void 0:g(v))f=(0,e._)`${f}${w}${this.opts._n}`;else throw new r(v);h.set(v,s.Completed)})}return f}}t.ValueScope=o})(jn),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=$a,r=jn;var s=$a;Object.defineProperty(t,"_",{enumerable:!0,get:function(){return s._}}),Object.defineProperty(t,"str",{enumerable:!0,get:function(){return s.str}}),Object.defineProperty(t,"strConcat",{enumerable:!0,get:function(){return s.strConcat}}),Object.defineProperty(t,"nil",{enumerable:!0,get:function(){return s.nil}}),Object.defineProperty(t,"getProperty",{enumerable:!0,get:function(){return s.getProperty}}),Object.defineProperty(t,"stringify",{enumerable:!0,get:function(){return s.stringify}}),Object.defineProperty(t,"regexpCode",{enumerable:!0,get:function(){return s.regexpCode}}),Object.defineProperty(t,"Name",{enumerable:!0,get:function(){return s.Name}});var a=jn;Object.defineProperty(t,"Scope",{enumerable:!0,get:function(){return a.Scope}}),Object.defineProperty(t,"ValueScope",{enumerable:!0,get:function(){return a.ValueScope}}),Object.defineProperty(t,"ValueScopeName",{enumerable:!0,get:function(){return a.ValueScopeName}}),Object.defineProperty(t,"varKinds",{enumerable:!0,get:function(){return a.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 n{optimizeNodes(){return this}optimizeNames(_,b){return this}}class i extends n{constructor(_,b,C){super(),this.varKind=_,this.name=b,this.rhs=C}render({es5:_,_n:b}){const C=_?r.varKinds.var:this.varKind,K=this.rhs===void 0?"":` = ${this.rhs}`;return`${C} ${this.name}${K};`+b}optimizeNames(_,b){if(_[this.name.str])return this.rhs&&(this.rhs=M(this.rhs,_,b)),this}get names(){return this.rhs instanceof e._CodeOrName?this.rhs.names:{}}}class o extends n{constructor(_,b,C){super(),this.lhs=_,this.rhs=b,this.sideEffects=C}render({_n:_}){return`${this.lhs} = ${this.rhs};`+_}optimizeNames(_,b){if(!(this.lhs instanceof e.Name&&!_[this.lhs.str]&&!this.sideEffects))return this.rhs=M(this.rhs,_,b),this}get names(){const _=this.lhs instanceof e.Name?{}:{...this.lhs.names};return F(_,this.rhs)}}class l extends o{constructor(_,b,C,K){super(_,C,K),this.op=b}render({_n:_}){return`${this.lhs} ${this.op}= ${this.rhs};`+_}}class c extends n{constructor(_){super(),this.label=_,this.names={}}render({_n:_}){return`${this.label}:`+_}}class u extends n{constructor(_){super(),this.label=_,this.names={}}render({_n:_}){return`break${this.label?` ${this.label}`:""};`+_}}class d extends n{constructor(_){super(),this.error=_}render({_n:_}){return`throw ${this.error};`+_}get names(){return this.error.names}}class g extends n{constructor(_){super(),this.code=_}render({_n:_}){return`${this.code};`+_}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(_,b){return this.code=M(this.code,_,b),this}get names(){return this.code instanceof e._CodeOrName?this.code.names:{}}}class f extends n{constructor(_=[]){super(),this.nodes=_}render(_){return this.nodes.reduce((b,C)=>b+C.render(_),"")}optimizeNodes(){const{nodes:_}=this;let b=_.length;for(;b--;){const C=_[b].optimizeNodes();Array.isArray(C)?_.splice(b,1,...C):C?_[b]=C:_.splice(b,1)}return _.length>0?this:void 0}optimizeNames(_,b){const{nodes:C}=this;let K=C.length;for(;K--;){const Q=C[K];Q.optimizeNames(_,b)||(te(_,Q.names),C.splice(K,1))}return C.length>0?this:void 0}get names(){return this.nodes.reduce((_,b)=>H(_,b.names),{})}}class m extends f{render(_){return"{"+_._n+super.render(_)+"}"+_._n}}class p extends f{}class h extends m{}h.kind="else";class v extends m{constructor(_,b){super(b),this.condition=_}render(_){let b=`if(${this.condition})`+super.render(_);return this.else&&(b+="else "+this.else.render(_)),b}optimizeNodes(){super.optimizeNodes();const _=this.condition;if(_===!0)return this.nodes;let b=this.else;if(b){const C=b.optimizeNodes();b=this.else=Array.isArray(C)?new h(C):C}if(b)return _===!1?b instanceof v?b:b.nodes:this.nodes.length?this:new v(ye(_),b instanceof v?[b]:b.nodes);if(!(_===!1||!this.nodes.length))return this}optimizeNames(_,b){var C;if(this.else=(C=this.else)===null||C===void 0?void 0:C.optimizeNames(_,b),!!(super.optimizeNames(_,b)||this.else))return this.condition=M(this.condition,_,b),this}get names(){const _=super.names;return F(_,this.condition),this.else&&H(_,this.else.names),_}}v.kind="if";class w extends m{}w.kind="for";class P extends w{constructor(_){super(),this.iteration=_}render(_){return`for(${this.iteration})`+super.render(_)}optimizeNames(_,b){if(super.optimizeNames(_,b))return this.iteration=M(this.iteration,_,b),this}get names(){return H(super.names,this.iteration.names)}}class S extends w{constructor(_,b,C,K){super(),this.varKind=_,this.name=b,this.from=C,this.to=K}render(_){const b=_.es5?r.varKinds.var:this.varKind,{name:C,from:K,to:Q}=this;return`for(${b} ${C}=${K}; ${C}<${Q}; ${C}++)`+super.render(_)}get names(){const _=F(super.names,this.from);return F(_,this.to)}}class x extends w{constructor(_,b,C,K){super(),this.loop=_,this.varKind=b,this.name=C,this.iterable=K}render(_){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(_)}optimizeNames(_,b){if(super.optimizeNames(_,b))return this.iterable=M(this.iterable,_,b),this}get names(){return H(super.names,this.iterable.names)}}class A extends m{constructor(_,b,C){super(),this.name=_,this.args=b,this.async=C}render(_){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(_)}}A.kind="func";class z extends f{render(_){return"return "+super.render(_)}}z.kind="return";class U extends m{render(_){let b="try"+super.render(_);return this.catch&&(b+=this.catch.render(_)),this.finally&&(b+=this.finally.render(_)),b}optimizeNodes(){var _,b;return super.optimizeNodes(),(_=this.catch)===null||_===void 0||_.optimizeNodes(),(b=this.finally)===null||b===void 0||b.optimizeNodes(),this}optimizeNames(_,b){var C,K;return super.optimizeNames(_,b),(C=this.catch)===null||C===void 0||C.optimizeNames(_,b),(K=this.finally)===null||K===void 0||K.optimizeNames(_,b),this}get names(){const _=super.names;return this.catch&&H(_,this.catch.names),this.finally&&H(_,this.finally.names),_}}class D extends m{constructor(_){super(),this.error=_}render(_){return`catch(${this.error})`+super.render(_)}}D.kind="catch";class W extends m{render(_){return"finally"+super.render(_)}}W.kind="finally";class J{constructor(_,b={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...b,_n:b.lines?`
2
- `:""},this._extScope=_,this._scope=new r.Scope({parent:_}),this._nodes=[new p]}toString(){return this._root.render(this.opts)}name(_){return this._scope.name(_)}scopeName(_){return this._extScope.name(_)}scopeValue(_,b){const C=this._extScope.value(_,b);return(this._values[C.prefix]||(this._values[C.prefix]=new Set)).add(C),C}getScopeValue(_,b){return this._extScope.getValue(_,b)}scopeRefs(_){return this._extScope.scopeRefs(_,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(_,b,C,K){const Q=this._scope.toName(b);return C!==void 0&&K&&(this._constants[Q.str]=C),this._leafNode(new i(_,Q,C)),Q}const(_,b,C){return this._def(r.varKinds.const,_,b,C)}let(_,b,C){return this._def(r.varKinds.let,_,b,C)}var(_,b,C){return this._def(r.varKinds.var,_,b,C)}assign(_,b,C){return this._leafNode(new o(_,b,C))}add(_,b){return this._leafNode(new l(_,t.operators.ADD,b))}code(_){return typeof _=="function"?_():_!==e.nil&&this._leafNode(new g(_)),this}object(..._){const b=["{"];for(const[C,K]of _)b.length>1&&b.push(","),b.push(C),(C!==K||this.opts.es5)&&(b.push(":"),(0,e.addCodeArg)(b,K));return b.push("}"),new e._Code(b)}if(_,b,C){if(this._blockNode(new v(_)),b&&C)this.code(b).else().code(C).endIf();else if(b)this.code(b).endIf();else if(C)throw new Error('CodeGen: "else" body without "then" body');return this}elseIf(_){return this._elseNode(new v(_))}else(){return this._elseNode(new h)}endIf(){return this._endBlockNode(v,h)}_for(_,b){return this._blockNode(_),b&&this.code(b).endFor(),this}for(_,b){return this._for(new P(_),b)}forRange(_,b,C,K,Q=this.opts.es5?r.varKinds.var:r.varKinds.let){const fe=this._scope.toName(_);return this._for(new S(Q,fe,b,C),()=>K(fe))}forOf(_,b,C,K=r.varKinds.const){const Q=this._scope.toName(_);if(this.opts.es5){const fe=b instanceof e.Name?b:this.var("_arr",b);return this.forRange("_i",0,(0,e._)`${fe}.length`,ne=>{this.var(Q,(0,e._)`${fe}[${ne}]`),C(Q)})}return this._for(new x("of",K,Q,b),()=>C(Q))}forIn(_,b,C,K=this.opts.es5?r.varKinds.var:r.varKinds.const){if(this.opts.ownProperties)return this.forOf(_,(0,e._)`Object.keys(${b})`,C);const Q=this._scope.toName(_);return this._for(new x("in",K,Q,b),()=>C(Q))}endFor(){return this._endBlockNode(w)}label(_){return this._leafNode(new c(_))}break(_){return this._leafNode(new u(_))}return(_){const b=new z;if(this._blockNode(b),this.code(_),b.nodes.length!==1)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(z)}try(_,b,C){if(!b&&!C)throw new Error('CodeGen: "try" without "catch" and "finally"');const K=new U;if(this._blockNode(K),this.code(_),b){const Q=this.name("e");this._currNode=K.catch=new D(Q),b(Q)}return C&&(this._currNode=K.finally=new W,this.code(C)),this._endBlockNode(D,W)}throw(_){return this._leafNode(new d(_))}block(_,b){return this._blockStarts.push(this._nodes.length),_&&this.code(_).endBlock(b),this}endBlock(_){const b=this._blockStarts.pop();if(b===void 0)throw new Error("CodeGen: not in self-balancing block");const C=this._nodes.length-b;if(C<0||_!==void 0&&C!==_)throw new Error(`CodeGen: wrong number of nodes: ${C} vs ${_} expected`);return this._nodes.length=b,this}func(_,b=e.nil,C,K){return this._blockNode(new A(_,b,C)),K&&this.code(K).endFunc(),this}endFunc(){return this._endBlockNode(A)}optimize(_=1){for(;_-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(_){return this._currNode.nodes.push(_),this}_blockNode(_){this._currNode.nodes.push(_),this._nodes.push(_)}_endBlockNode(_,b){const C=this._currNode;if(C instanceof _||b&&C instanceof b)return this._nodes.pop(),this;throw new Error(`CodeGen: not in block "${b?`${_.kind}/${b.kind}`:_.kind}"`)}_elseNode(_){const b=this._currNode;if(!(b instanceof v))throw new Error('CodeGen: "else" without "if"');return this._currNode=b.else=_,this}get _root(){return this._nodes[0]}get _currNode(){const _=this._nodes;return _[_.length-1]}set _currNode(_){const b=this._nodes;b[b.length-1]=_}}t.CodeGen=J;function H(k,_){for(const b in _)k[b]=(k[b]||0)+(_[b]||0);return k}function F(k,_){return _ instanceof e._CodeOrName?H(k,_.names):k}function M(k,_,b){if(k instanceof e.Name)return C(k);if(!K(k))return k;return new e._Code(k._items.reduce((Q,fe)=>(fe instanceof e.Name&&(fe=C(fe)),fe instanceof e._Code?Q.push(...fe._items):Q.push(fe),Q),[]));function C(Q){const fe=b[Q.str];return fe===void 0||_[Q.str]!==1?Q:(delete _[Q.str],fe)}function K(Q){return Q instanceof e._Code&&Q._items.some(fe=>fe instanceof e.Name&&_[fe.str]===1&&b[fe.str]!==void 0)}}function te(k,_){for(const b in _)k[b]=(k[b]||0)-(_[b]||0)}function ye(k){return typeof k=="boolean"||typeof k=="number"||k===null?!k:(0,e._)`!${j(k)}`}t.not=ye;const ve=R(t.operators.AND);function be(...k){return k.reduce(ve)}t.and=be;const de=R(t.operators.OR);function N(...k){return k.reduce(de)}t.or=N;function R(k){return(_,b)=>_===e.nil?b:b===e.nil?_:(0,e._)`${j(_)} ${k} ${j(b)}`}function j(k){return k instanceof e.Name?k:(0,e._)`(${k})`}}(ge);var G={};Object.defineProperty(G,"__esModule",{value:!0}),G.checkStrictMode=G.getErrorPath=G.Type=G.useFunc=G.setEvaluated=G.evaluatedPropsToName=G.mergeEvaluated=G.eachItem=G.unescapeJsonPointer=G.escapeJsonPointer=G.escapeFragment=G.unescapeFragment=G.schemaRefOrVal=G.schemaHasRulesButRef=G.schemaHasRules=G.checkUnknownRules=G.alwaysValidSchema=G.toHash=void 0;const xe=ge,lf=$a;function uf(t){const e={};for(const r of t)e[r]=!0;return e}G.toHash=uf;function df(t,e){return typeof e=="boolean"?e:Object.keys(e).length===0?!0:(mc(t,e),!vc(e,t.self.RULES.all))}G.alwaysValidSchema=df;function mc(t,e=t.schema){const{opts:r,self:s}=t;if(!r.strictSchema||typeof e=="boolean")return;const a=s.RULES.keywords;for(const n in e)a[n]||bc(t,`unknown keyword: "${n}"`)}G.checkUnknownRules=mc;function vc(t,e){if(typeof t=="boolean")return!t;for(const r in t)if(e[r])return!0;return!1}G.schemaHasRules=vc;function ff(t,e){if(typeof t=="boolean")return!t;for(const r in t)if(r!=="$ref"&&e.all[r])return!0;return!1}G.schemaHasRulesButRef=ff;function hf({topSchemaRef:t,schemaPath:e},r,s,a){if(!a){if(typeof r=="number"||typeof r=="boolean")return r;if(typeof r=="string")return(0,xe._)`${r}`}return(0,xe._)`${t}${e}${(0,xe.getProperty)(s)}`}G.schemaRefOrVal=hf;function pf(t){return gc(decodeURIComponent(t))}G.unescapeFragment=pf;function mf(t){return encodeURIComponent(Dn(t))}G.escapeFragment=mf;function Dn(t){return typeof t=="number"?`${t}`:t.replace(/~/g,"~0").replace(/\//g,"~1")}G.escapeJsonPointer=Dn;function gc(t){return t.replace(/~1/g,"/").replace(/~0/g,"~")}G.unescapeJsonPointer=gc;function vf(t,e){if(Array.isArray(t))for(const r of t)e(r);else e(t)}G.eachItem=vf;function _c({mergeNames:t,mergeToName:e,mergeValues:r,resultToName:s}){return(a,n,i,o)=>{const l=i===void 0?n:i instanceof xe.Name?(n instanceof xe.Name?t(a,n,i):e(a,n,i),i):n instanceof xe.Name?(e(a,i,n),n):r(n,i);return o===xe.Name&&!(l instanceof xe.Name)?s(a,l):l}}G.mergeEvaluated={props:_c({mergeNames:(t,e,r)=>t.if((0,xe._)`${r} !== true && ${e} !== undefined`,()=>{t.if((0,xe._)`${e} === true`,()=>t.assign(r,!0),()=>t.assign(r,(0,xe._)`${r} || {}`).code((0,xe._)`Object.assign(${r}, ${e})`))}),mergeToName:(t,e,r)=>t.if((0,xe._)`${r} !== true`,()=>{e===!0?t.assign(r,!0):(t.assign(r,(0,xe._)`${r} || {}`),Mn(t,r,e))}),mergeValues:(t,e)=>t===!0?!0:{...t,...e},resultToName:yc}),items:_c({mergeNames:(t,e,r)=>t.if((0,xe._)`${r} !== true && ${e} !== undefined`,()=>t.assign(r,(0,xe._)`${e} === true ? true : ${r} > ${e} ? ${r} : ${e}`)),mergeToName:(t,e,r)=>t.if((0,xe._)`${r} !== true`,()=>t.assign(r,e===!0?!0:(0,xe._)`${r} > ${e} ? ${r} : ${e}`)),mergeValues:(t,e)=>t===!0?!0:Math.max(t,e),resultToName:(t,e)=>t.var("items",e)})};function yc(t,e){if(e===!0)return t.var("props",!0);const r=t.var("props",(0,xe._)`{}`);return e!==void 0&&Mn(t,r,e),r}G.evaluatedPropsToName=yc;function Mn(t,e,r){Object.keys(r).forEach(s=>t.assign((0,xe._)`${e}${(0,xe.getProperty)(s)}`,!0))}G.setEvaluated=Mn;const wc={};function gf(t,e){return t.scopeValue("func",{ref:e,code:wc[e.code]||(wc[e.code]=new lf._Code(e.code))})}G.useFunc=gf;var Ln;(function(t){t[t.Num=0]="Num",t[t.Str=1]="Str"})(Ln||(G.Type=Ln={}));function _f(t,e,r){if(t instanceof xe.Name){const s=e===Ln.Num;return r?s?(0,xe._)`"[" + ${t} + "]"`:(0,xe._)`"['" + ${t} + "']"`:s?(0,xe._)`"/" + ${t}`:(0,xe._)`"/" + ${t}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return r?(0,xe.getProperty)(t).toString():"/"+Dn(t)}G.getErrorPath=_f;function bc(t,e,r=t.opts.strictSchema){if(r){if(e=`strict mode: ${e}`,r===!0)throw new Error(e);t.self.logger.warn(e)}}G.checkStrictMode=bc;var qt={};Object.defineProperty(qt,"__esModule",{value:!0});const it=ge,yf={data:new it.Name("data"),valCxt:new it.Name("valCxt"),instancePath:new it.Name("instancePath"),parentData:new it.Name("parentData"),parentDataProperty:new it.Name("parentDataProperty"),rootData:new it.Name("rootData"),dynamicAnchors:new it.Name("dynamicAnchors"),vErrors:new it.Name("vErrors"),errors:new it.Name("errors"),this:new it.Name("this"),self:new it.Name("self"),scope:new it.Name("scope"),json:new it.Name("json"),jsonPos:new it.Name("jsonPos"),jsonLen:new it.Name("jsonLen"),jsonPart:new it.Name("jsonPart")};qt.default=yf,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=ge,r=G,s=qt;t.keywordError={message:({keyword:h})=>(0,e.str)`must pass "${h}" keyword validation`},t.keyword$DataError={message:({keyword:h,schemaType:v})=>v?(0,e.str)`"${h}" keyword must be ${v} ($data)`:(0,e.str)`"${h}" keyword is invalid ($data)`};function a(h,v=t.keywordError,w,P){const{it:S}=h,{gen:x,compositeRule:A,allErrors:z}=S,U=d(h,v,w);P??(A||z)?l(x,U):c(S,(0,e._)`[${U}]`)}t.reportError=a;function n(h,v=t.keywordError,w){const{it:P}=h,{gen:S,compositeRule:x,allErrors:A}=P,z=d(h,v,w);l(S,z),x||A||c(P,s.default.vErrors)}t.reportExtraError=n;function i(h,v){h.assign(s.default.errors,v),h.if((0,e._)`${s.default.vErrors} !== null`,()=>h.if(v,()=>h.assign((0,e._)`${s.default.vErrors}.length`,v),()=>h.assign(s.default.vErrors,null)))}t.resetErrorsCount=i;function o({gen:h,keyword:v,schemaValue:w,data:P,errsCount:S,it:x}){if(S===void 0)throw new Error("ajv implementation error");const A=h.name("err");h.forRange("i",S,s.default.errors,z=>{h.const(A,(0,e._)`${s.default.vErrors}[${z}]`),h.if((0,e._)`${A}.instancePath === undefined`,()=>h.assign((0,e._)`${A}.instancePath`,(0,e.strConcat)(s.default.instancePath,x.errorPath))),h.assign((0,e._)`${A}.schemaPath`,(0,e.str)`${x.errSchemaPath}/${v}`),x.opts.verbose&&(h.assign((0,e._)`${A}.schema`,w),h.assign((0,e._)`${A}.data`,P))})}t.extendErrors=o;function l(h,v){const w=h.const("err",v);h.if((0,e._)`${s.default.vErrors} === null`,()=>h.assign(s.default.vErrors,(0,e._)`[${w}]`),(0,e._)`${s.default.vErrors}.push(${w})`),h.code((0,e._)`${s.default.errors}++`)}function c(h,v){const{gen:w,validateName:P,schemaEnv:S}=h;S.$async?w.throw((0,e._)`new ${h.ValidationError}(${v})`):(w.assign((0,e._)`${P}.errors`,v),w.return(!1))}const u={keyword:new e.Name("keyword"),schemaPath:new e.Name("schemaPath"),params:new e.Name("params"),propertyName:new e.Name("propertyName"),message:new e.Name("message"),schema:new e.Name("schema"),parentSchema:new e.Name("parentSchema")};function d(h,v,w){const{createErrors:P}=h.it;return P===!1?(0,e._)`{}`:g(h,v,w)}function g(h,v,w={}){const{gen:P,it:S}=h,x=[f(S,w),m(h,w)];return p(h,v,x),P.object(...x)}function f({errorPath:h},{instancePath:v}){const w=v?(0,e.str)`${h}${(0,r.getErrorPath)(v,r.Type.Str)}`:h;return[s.default.instancePath,(0,e.strConcat)(s.default.instancePath,w)]}function m({keyword:h,it:{errSchemaPath:v}},{schemaPath:w,parentSchema:P}){let S=P?v:(0,e.str)`${v}/${h}`;return w&&(S=(0,e.str)`${S}${(0,r.getErrorPath)(w,r.Type.Str)}`),[u.schemaPath,S]}function p(h,{params:v,message:w},P){const{keyword:S,data:x,schemaValue:A,it:z}=h,{opts:U,propertyName:D,topSchemaRef:W,schemaPath:J}=z;P.push([u.keyword,S],[u.params,typeof v=="function"?v(h):v||(0,e._)`{}`]),U.messages&&P.push([u.message,typeof w=="function"?w(h):w]),U.verbose&&P.push([u.schema,A],[u.parentSchema,(0,e._)`${W}${J}`],[s.default.data,x]),D&&P.push([u.propertyName,D])}}(ba),Object.defineProperty(Kr,"__esModule",{value:!0}),Kr.boolOrEmptySchema=Kr.topBoolOrEmptySchema=void 0;const wf=ba,bf=ge,$f=qt,Pf={message:"boolean schema is false"};function Ef(t){const{gen:e,schema:r,validateName:s}=t;r===!1?$c(t,!1):typeof r=="object"&&r.$async===!0?e.return($f.default.data):(e.assign((0,bf._)`${s}.errors`,null),e.return(!0))}Kr.topBoolOrEmptySchema=Ef;function Sf(t,e){const{gen:r,schema:s}=t;s===!1?(r.var(e,!1),$c(t)):r.var(e,!0)}Kr.boolOrEmptySchema=Sf;function $c(t,e){const{gen:r,data:s}=t,a={gen:r,keyword:"false schema",data:s,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:t};(0,wf.reportError)(a,Pf,void 0,e)}var Xe={},Ir={};Object.defineProperty(Ir,"__esModule",{value:!0}),Ir.getRules=Ir.isJSONType=void 0;const Rf=["string","number","integer","boolean","null","object","array"],xf=new Set(Rf);function kf(t){return typeof t=="string"&&xf.has(t)}Ir.isJSONType=kf;function If(){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:{}}}Ir.getRules=If;var rr={};Object.defineProperty(rr,"__esModule",{value:!0}),rr.shouldUseRule=rr.shouldUseGroup=rr.schemaHasRulesForType=void 0;function Tf({schema:t,self:e},r){const s=e.RULES.types[r];return s&&s!==!0&&Pc(t,s)}rr.schemaHasRulesForType=Tf;function Pc(t,e){return e.rules.some(r=>Ec(t,r))}rr.shouldUseGroup=Pc;function Ec(t,e){var r;return t[e.keyword]!==void 0||((r=e.definition.implements)===null||r===void 0?void 0:r.some(s=>t[s]!==void 0))}rr.shouldUseRule=Ec,Object.defineProperty(Xe,"__esModule",{value:!0}),Xe.reportTypeError=Xe.checkDataTypes=Xe.checkDataType=Xe.coerceAndCheckDataType=Xe.getJSONTypes=Xe.getSchemaTypes=Xe.DataType=void 0;const Of=Ir,Cf=rr,Nf=ba,pe=ge,Sc=G;var Br;(function(t){t[t.Correct=0]="Correct",t[t.Wrong=1]="Wrong"})(Br||(Xe.DataType=Br={}));function Af(t){const e=Rc(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}Xe.getSchemaTypes=Af;function Rc(t){const e=Array.isArray(t)?t:t?[t]:[];if(e.every(Of.isJSONType))return e;throw new Error("type must be JSONType or JSONType[]: "+e.join(","))}Xe.getJSONTypes=Rc;function jf(t,e){const{gen:r,data:s,opts:a}=t,n=Df(e,a.coerceTypes),i=e.length>0&&!(n.length===0&&e.length===1&&(0,Cf.schemaHasRulesForType)(t,e[0]));if(i){const o=qn(e,s,a.strictNumbers,Br.Wrong);r.if(o,()=>{n.length?Mf(t,e,n):Un(t)})}return i}Xe.coerceAndCheckDataType=jf;const xc=new Set(["string","number","integer","boolean","null"]);function Df(t,e){return e?t.filter(r=>xc.has(r)||e==="array"&&r==="array"):[]}function Mf(t,e,r){const{gen:s,data:a,opts:n}=t,i=s.let("dataType",(0,pe._)`typeof ${a}`),o=s.let("coerced",(0,pe._)`undefined`);n.coerceTypes==="array"&&s.if((0,pe._)`${i} == 'object' && Array.isArray(${a}) && ${a}.length == 1`,()=>s.assign(a,(0,pe._)`${a}[0]`).assign(i,(0,pe._)`typeof ${a}`).if(qn(e,a,n.strictNumbers),()=>s.assign(o,a))),s.if((0,pe._)`${o} !== undefined`);for(const c of r)(xc.has(c)||c==="array"&&n.coerceTypes==="array")&&l(c);s.else(),Un(t),s.endIf(),s.if((0,pe._)`${o} !== undefined`,()=>{s.assign(a,o),Lf(t,o)});function l(c){switch(c){case"string":s.elseIf((0,pe._)`${i} == "number" || ${i} == "boolean"`).assign(o,(0,pe._)`"" + ${a}`).elseIf((0,pe._)`${a} === null`).assign(o,(0,pe._)`""`);return;case"number":s.elseIf((0,pe._)`${i} == "boolean" || ${a} === null
3
- || (${i} == "string" && ${a} && ${a} == +${a})`).assign(o,(0,pe._)`+${a}`);return;case"integer":s.elseIf((0,pe._)`${i} === "boolean" || ${a} === null
4
- || (${i} === "string" && ${a} && ${a} == +${a} && !(${a} % 1))`).assign(o,(0,pe._)`+${a}`);return;case"boolean":s.elseIf((0,pe._)`${a} === "false" || ${a} === 0 || ${a} === null`).assign(o,!1).elseIf((0,pe._)`${a} === "true" || ${a} === 1`).assign(o,!0);return;case"null":s.elseIf((0,pe._)`${a} === "" || ${a} === 0 || ${a} === false`),s.assign(o,null);return;case"array":s.elseIf((0,pe._)`${i} === "string" || ${i} === "number"
5
- || ${i} === "boolean" || ${a} === null`).assign(o,(0,pe._)`[${a}]`)}}}function Lf({gen:t,parentData:e,parentDataProperty:r},s){t.if((0,pe._)`${e} !== undefined`,()=>t.assign((0,pe._)`${e}[${r}]`,s))}function Fn(t,e,r,s=Br.Correct){const a=s===Br.Correct?pe.operators.EQ:pe.operators.NEQ;let n;switch(t){case"null":return(0,pe._)`${e} ${a} null`;case"array":n=(0,pe._)`Array.isArray(${e})`;break;case"object":n=(0,pe._)`${e} && typeof ${e} == "object" && !Array.isArray(${e})`;break;case"integer":n=i((0,pe._)`!(${e} % 1) && !isNaN(${e})`);break;case"number":n=i();break;default:return(0,pe._)`typeof ${e} ${a} ${t}`}return s===Br.Correct?n:(0,pe.not)(n);function i(o=pe.nil){return(0,pe.and)((0,pe._)`typeof ${e} == "number"`,o,r?(0,pe._)`isFinite(${e})`:pe.nil)}}Xe.checkDataType=Fn;function qn(t,e,r,s){if(t.length===1)return Fn(t[0],e,r,s);let a;const n=(0,Sc.toHash)(t);if(n.array&&n.object){const i=(0,pe._)`typeof ${e} != "object"`;a=n.null?i:(0,pe._)`!${e} || ${i}`,delete n.null,delete n.array,delete n.object}else a=pe.nil;n.number&&delete n.integer;for(const i in n)a=(0,pe.and)(a,Fn(i,e,r,s));return a}Xe.checkDataTypes=qn;const Ff={message:({schema:t})=>`must be ${t}`,params:({schema:t,schemaValue:e})=>typeof t=="string"?(0,pe._)`{type: ${t}}`:(0,pe._)`{type: ${e}}`};function Un(t){const e=qf(t);(0,Nf.reportError)(e,Ff)}Xe.reportTypeError=Un;function qf(t){const{gen:e,data:r,schema:s}=t,a=(0,Sc.schemaRefOrVal)(t,s,"type");return{gen:e,keyword:"type",data:r,schema:s.type,schemaCode:a,schemaValue:a,parentSchema:s,params:{},it:t}}var us={};Object.defineProperty(us,"__esModule",{value:!0}),us.assignDefaults=void 0;const Wr=ge,Uf=G;function Vf(t,e){const{properties:r,items:s}=t.schema;if(e==="object"&&r)for(const a in r)kc(t,a,r[a].default);else e==="array"&&Array.isArray(s)&&s.forEach((a,n)=>kc(t,n,a.default))}us.assignDefaults=Vf;function kc(t,e,r){const{gen:s,compositeRule:a,data:n,opts:i}=t;if(r===void 0)return;const o=(0,Wr._)`${n}${(0,Wr.getProperty)(e)}`;if(a){(0,Uf.checkStrictMode)(t,`default is ignored for: ${o}`);return}let l=(0,Wr._)`${o} === undefined`;i.useDefaults==="empty"&&(l=(0,Wr._)`${l} || ${o} === null || ${o} === ""`),s.if(l,(0,Wr._)`${o} = ${(0,Wr.stringify)(r)}`)}var Ut={},_e={};Object.defineProperty(_e,"__esModule",{value:!0}),_e.validateUnion=_e.validateArray=_e.usePattern=_e.callValidateCode=_e.schemaProperties=_e.allSchemaProperties=_e.noPropertyInData=_e.propertyInData=_e.isOwnProperty=_e.hasPropFunc=_e.reportMissingProp=_e.checkMissingProp=_e.checkReportMissingProp=void 0;const Ne=ge,Vn=G,hr=qt,zf=G;function Hf(t,e){const{gen:r,data:s,it:a}=t;r.if(Hn(r,s,e,a.opts.ownProperties),()=>{t.setParams({missingProperty:(0,Ne._)`${e}`},!0),t.error()})}_e.checkReportMissingProp=Hf;function Zf({gen:t,data:e,it:{opts:r}},s,a){return(0,Ne.or)(...s.map(n=>(0,Ne.and)(Hn(t,e,n,r.ownProperties),(0,Ne._)`${a} = ${n}`)))}_e.checkMissingProp=Zf;function Kf(t,e){t.setParams({missingProperty:e},!0),t.error()}_e.reportMissingProp=Kf;function Ic(t){return t.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:(0,Ne._)`Object.prototype.hasOwnProperty`})}_e.hasPropFunc=Ic;function zn(t,e,r){return(0,Ne._)`${Ic(t)}.call(${e}, ${r})`}_e.isOwnProperty=zn;function Bf(t,e,r,s){const a=(0,Ne._)`${e}${(0,Ne.getProperty)(r)} !== undefined`;return s?(0,Ne._)`${a} && ${zn(t,e,r)}`:a}_e.propertyInData=Bf;function Hn(t,e,r,s){const a=(0,Ne._)`${e}${(0,Ne.getProperty)(r)} === undefined`;return s?(0,Ne.or)(a,(0,Ne.not)(zn(t,e,r))):a}_e.noPropertyInData=Hn;function Tc(t){return t?Object.keys(t).filter(e=>e!=="__proto__"):[]}_e.allSchemaProperties=Tc;function Wf(t,e){return Tc(e).filter(r=>!(0,Vn.alwaysValidSchema)(t,e[r]))}_e.schemaProperties=Wf;function Jf({schemaCode:t,data:e,it:{gen:r,topSchemaRef:s,schemaPath:a,errorPath:n},it:i},o,l,c){const u=c?(0,Ne._)`${t}, ${e}, ${s}${a}`:e,d=[[hr.default.instancePath,(0,Ne.strConcat)(hr.default.instancePath,n)],[hr.default.parentData,i.parentData],[hr.default.parentDataProperty,i.parentDataProperty],[hr.default.rootData,hr.default.rootData]];i.opts.dynamicRef&&d.push([hr.default.dynamicAnchors,hr.default.dynamicAnchors]);const g=(0,Ne._)`${u}, ${r.object(...d)}`;return l!==Ne.nil?(0,Ne._)`${o}.call(${l}, ${g})`:(0,Ne._)`${o}(${g})`}_e.callValidateCode=Jf;const Qf=(0,Ne._)`new RegExp`;function Gf({gen:t,it:{opts:e}},r){const s=e.unicodeRegExp?"u":"",{regExp:a}=e.code,n=a(r,s);return t.scopeValue("pattern",{key:n.toString(),ref:n,code:(0,Ne._)`${a.code==="new RegExp"?Qf:(0,zf.useFunc)(t,a)}(${r}, ${s})`})}_e.usePattern=Gf;function Yf(t){const{gen:e,data:r,keyword:s,it:a}=t,n=e.name("valid");if(a.allErrors){const o=e.let("valid",!0);return i(()=>e.assign(o,!1)),o}return e.var(n,!0),i(()=>e.break()),n;function i(o){const l=e.const("len",(0,Ne._)`${r}.length`);e.forRange("i",0,l,c=>{t.subschema({keyword:s,dataProp:c,dataPropType:Vn.Type.Num},n),e.if((0,Ne.not)(n),o)})}}_e.validateArray=Yf;function Xf(t){const{gen:e,schema:r,keyword:s,it:a}=t;if(!Array.isArray(r))throw new Error("ajv implementation error");if(r.some(l=>(0,Vn.alwaysValidSchema)(a,l))&&!a.opts.unevaluated)return;const i=e.let("valid",!1),o=e.name("_valid");e.block(()=>r.forEach((l,c)=>{const u=t.subschema({keyword:s,schemaProp:c,compositeRule:!0},o);e.assign(i,(0,Ne._)`${i} || ${o}`),t.mergeValidEvaluated(u,o)||e.if((0,Ne.not)(i))})),t.result(i,()=>t.reset(),()=>t.error(!0))}_e.validateUnion=Xf,Object.defineProperty(Ut,"__esModule",{value:!0}),Ut.validateKeywordUsage=Ut.validSchemaType=Ut.funcKeywordCode=Ut.macroKeywordCode=void 0;const ut=ge,Tr=qt,eh=_e,th=ba;function rh(t,e){const{gen:r,keyword:s,schema:a,parentSchema:n,it:i}=t,o=e.macro.call(i.self,a,n,i),l=Cc(r,s,o);i.opts.validateSchema!==!1&&i.self.validateSchema(o,!0);const c=r.name("valid");t.subschema({schema:o,schemaPath:ut.nil,errSchemaPath:`${i.errSchemaPath}/${s}`,topSchemaRef:l,compositeRule:!0},c),t.pass(c,()=>t.error(!0))}Ut.macroKeywordCode=rh;function ah(t,e){var r;const{gen:s,keyword:a,schema:n,parentSchema:i,$data:o,it:l}=t;nh(l,e);const c=!o&&e.compile?e.compile.call(l.self,n,i,l):e.validate,u=Cc(s,a,c),d=s.let("valid");t.block$data(d,g),t.ok((r=e.valid)!==null&&r!==void 0?r:d);function g(){if(e.errors===!1)p(),e.modifying&&Oc(t),h(()=>t.error());else{const v=e.async?f():m();e.modifying&&Oc(t),h(()=>sh(t,v))}}function f(){const v=s.let("ruleErrs",null);return s.try(()=>p((0,ut._)`await `),w=>s.assign(d,!1).if((0,ut._)`${w} instanceof ${l.ValidationError}`,()=>s.assign(v,(0,ut._)`${w}.errors`),()=>s.throw(w))),v}function m(){const v=(0,ut._)`${u}.errors`;return s.assign(v,null),p(ut.nil),v}function p(v=e.async?(0,ut._)`await `:ut.nil){const w=l.opts.passContext?Tr.default.this:Tr.default.self,P=!("compile"in e&&!o||e.schema===!1);s.assign(d,(0,ut._)`${v}${(0,eh.callValidateCode)(t,u,w,P)}`,e.modifying)}function h(v){var w;s.if((0,ut.not)((w=e.valid)!==null&&w!==void 0?w:d),v)}}Ut.funcKeywordCode=ah;function Oc(t){const{gen:e,data:r,it:s}=t;e.if(s.parentData,()=>e.assign(r,(0,ut._)`${s.parentData}[${s.parentDataProperty}]`))}function sh(t,e){const{gen:r}=t;r.if((0,ut._)`Array.isArray(${e})`,()=>{r.assign(Tr.default.vErrors,(0,ut._)`${Tr.default.vErrors} === null ? ${e} : ${Tr.default.vErrors}.concat(${e})`).assign(Tr.default.errors,(0,ut._)`${Tr.default.vErrors}.length`),(0,th.extendErrors)(t)},()=>t.error())}function nh({schemaEnv:t},e){if(e.async&&!t.$async)throw new Error("async keyword in sync schema")}function Cc(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,ut.stringify)(r)})}function ih(t,e,r=!1){return!e.length||e.some(s=>s==="array"?Array.isArray(t):s==="object"?t&&typeof t=="object"&&!Array.isArray(t):typeof t==s||r&&typeof t>"u")}Ut.validSchemaType=ih;function oh({schema:t,opts:e,self:r,errSchemaPath:s},a,n){if(Array.isArray(a.keyword)?!a.keyword.includes(n):a.keyword!==n)throw new Error("ajv implementation error");const i=a.dependencies;if(i!=null&&i.some(o=>!Object.prototype.hasOwnProperty.call(t,o)))throw new Error(`parent schema must have dependencies of ${n}: ${i.join(",")}`);if(a.validateSchema&&!a.validateSchema(t[n])){const l=`keyword "${n}" value is invalid at path "${s}": `+r.errorsText(a.validateSchema.errors);if(e.validateSchema==="log")r.logger.error(l);else throw new Error(l)}}Ut.validateKeywordUsage=oh;var pr={};Object.defineProperty(pr,"__esModule",{value:!0}),pr.extendSubschemaMode=pr.extendSubschemaData=pr.getSubschema=void 0;const Vt=ge,Nc=G;function ch(t,{keyword:e,schemaProp:r,schema:s,schemaPath:a,errSchemaPath:n,topSchemaRef:i}){if(e!==void 0&&s!==void 0)throw new Error('both "keyword" and "schema" passed, only one allowed');if(e!==void 0){const o=t.schema[e];return r===void 0?{schema:o,schemaPath:(0,Vt._)`${t.schemaPath}${(0,Vt.getProperty)(e)}`,errSchemaPath:`${t.errSchemaPath}/${e}`}:{schema:o[r],schemaPath:(0,Vt._)`${t.schemaPath}${(0,Vt.getProperty)(e)}${(0,Vt.getProperty)(r)}`,errSchemaPath:`${t.errSchemaPath}/${e}/${(0,Nc.escapeFragment)(r)}`}}if(s!==void 0){if(a===void 0||n===void 0||i===void 0)throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:s,schemaPath:a,topSchemaRef:i,errSchemaPath:n}}throw new Error('either "keyword" or "schema" must be passed')}pr.getSubschema=ch;function lh(t,e,{dataProp:r,dataPropType:s,data:a,dataTypes:n,propertyName:i}){if(a!==void 0&&r!==void 0)throw new Error('both "data" and "dataProp" passed, only one allowed');const{gen:o}=e;if(r!==void 0){const{errorPath:c,dataPathArr:u,opts:d}=e,g=o.let("data",(0,Vt._)`${e.data}${(0,Vt.getProperty)(r)}`,!0);l(g),t.errorPath=(0,Vt.str)`${c}${(0,Nc.getErrorPath)(r,s,d.jsPropertySyntax)}`,t.parentDataProperty=(0,Vt._)`${r}`,t.dataPathArr=[...u,t.parentDataProperty]}if(a!==void 0){const c=a instanceof Vt.Name?a:o.let("data",a,!0);l(c),i!==void 0&&(t.propertyName=i)}n&&(t.dataTypes=n);function l(c){t.data=c,t.dataLevel=e.dataLevel+1,t.dataTypes=[],e.definedProperties=new Set,t.parentData=e.data,t.dataNames=[...e.dataNames,c]}}pr.extendSubschemaData=lh;function uh(t,{jtdDiscriminator:e,jtdMetadata:r,compositeRule:s,createErrors:a,allErrors:n}){s!==void 0&&(t.compositeRule=s),a!==void 0&&(t.createErrors=a),n!==void 0&&(t.allErrors=n),t.jtdDiscriminator=e,t.jtdMetadata=r}pr.extendSubschemaMode=uh;var rt={},Pa=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 s,a,n;if(Array.isArray(e)){if(s=e.length,s!=r.length)return!1;for(a=s;a--!==0;)if(!t(e[a],r[a]))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(n=Object.keys(e),s=n.length,s!==Object.keys(r).length)return!1;for(a=s;a--!==0;)if(!Object.prototype.hasOwnProperty.call(r,n[a]))return!1;for(a=s;a--!==0;){var i=n[a];if(!t(e[i],r[i]))return!1}return!0}return e!==e&&r!==r},Ac={exports:{}},mr=Ac.exports=function(t,e,r){typeof e=="function"&&(r=e,e={}),r=e.cb||r;var s=typeof r=="function"?r:r.pre||function(){},a=r.post||function(){};ds(e,s,a,t,"",t)};mr.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0},mr.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0},mr.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0},mr.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 ds(t,e,r,s,a,n,i,o,l,c){if(s&&typeof s=="object"&&!Array.isArray(s)){e(s,a,n,i,o,l,c);for(var u in s){var d=s[u];if(Array.isArray(d)){if(u in mr.arrayKeywords)for(var g=0;g<d.length;g++)ds(t,e,r,d[g],a+"/"+u+"/"+g,n,a,u,s,g)}else if(u in mr.propsKeywords){if(d&&typeof d=="object")for(var f in d)ds(t,e,r,d[f],a+"/"+u+"/"+dh(f),n,a,u,s,f)}else(u in mr.keywords||t.allKeys&&!(u in mr.skipKeywords))&&ds(t,e,r,d,a+"/"+u,n,a,u,s)}r(s,a,n,i,o,l,c)}}function dh(t){return t.replace(/~/g,"~0").replace(/\//g,"~1")}var fh=Ac.exports;Object.defineProperty(rt,"__esModule",{value:!0}),rt.getSchemaRefs=rt.resolveUrl=rt.normalizeId=rt._getFullPath=rt.getFullPath=rt.inlineRef=void 0;const hh=G,ph=Pa,mh=fh,vh=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function gh(t,e=!0){return typeof t=="boolean"?!0:e===!0?!Zn(t):e?jc(t)<=e:!1}rt.inlineRef=gh;const _h=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function Zn(t){for(const e in t){if(_h.has(e))return!0;const r=t[e];if(Array.isArray(r)&&r.some(Zn)||typeof r=="object"&&Zn(r))return!0}return!1}function jc(t){let e=0;for(const r in t){if(r==="$ref")return 1/0;if(e++,!vh.has(r)&&(typeof t[r]=="object"&&(0,hh.eachItem)(t[r],s=>e+=jc(s)),e===1/0))return 1/0}return e}function Dc(t,e="",r){r!==!1&&(e=Jr(e));const s=t.parse(e);return Mc(t,s)}rt.getFullPath=Dc;function Mc(t,e){return t.serialize(e).split("#")[0]+"#"}rt._getFullPath=Mc;const yh=/#\/?$/;function Jr(t){return t?t.replace(yh,""):""}rt.normalizeId=Jr;function wh(t,e,r){return r=Jr(r),t.resolve(e,r)}rt.resolveUrl=wh;const bh=/^[a-z_][-a-z0-9._]*$/i;function $h(t,e){if(typeof t=="boolean")return{};const{schemaId:r,uriResolver:s}=this.opts,a=Jr(t[r]||e),n={"":a},i=Dc(s,a,!1),o={},l=new Set;return mh(t,{allKeys:!0},(d,g,f,m)=>{if(m===void 0)return;const p=i+g;let h=n[m];typeof d[r]=="string"&&(h=v.call(this,d[r])),w.call(this,d.$anchor),w.call(this,d.$dynamicAnchor),n[g]=h;function v(P){const S=this.opts.uriResolver.resolve;if(P=Jr(h?S(h,P):P),l.has(P))throw u(P);l.add(P);let x=this.refs[P];return typeof x=="string"&&(x=this.refs[x]),typeof x=="object"?c(d,x.schema,P):P!==Jr(p)&&(P[0]==="#"?(c(d,o[P],P),o[P]=d):this.refs[P]=p),P}function w(P){if(typeof P=="string"){if(!bh.test(P))throw new Error(`invalid anchor "${P}"`);v.call(this,`#${P}`)}}}),o;function c(d,g,f){if(g!==void 0&&!ph(d,g))throw u(f)}function u(d){return new Error(`reference "${d}" resolves to more than one schema`)}}rt.getSchemaRefs=$h,Object.defineProperty(kt,"__esModule",{value:!0}),kt.getData=kt.KeywordCxt=kt.validateFunctionCode=void 0;const Lc=Kr,Fc=Xe,Kn=rr,fs=Xe,Ph=us,Ea=Ut,Bn=pr,re=ge,oe=qt,Eh=rt,ar=G,Sa=ba;function Sh(t){if(zc(t)&&(Hc(t),Vc(t))){kh(t);return}qc(t,()=>(0,Lc.topBoolOrEmptySchema)(t))}kt.validateFunctionCode=Sh;function qc({gen:t,validateName:e,schema:r,schemaEnv:s,opts:a},n){a.code.es5?t.func(e,(0,re._)`${oe.default.data}, ${oe.default.valCxt}`,s.$async,()=>{t.code((0,re._)`"use strict"; ${Uc(r,a)}`),xh(t,a),t.code(n)}):t.func(e,(0,re._)`${oe.default.data}, ${Rh(a)}`,s.$async,()=>t.code(Uc(r,a)).code(n))}function Rh(t){return(0,re._)`{${oe.default.instancePath}="", ${oe.default.parentData}, ${oe.default.parentDataProperty}, ${oe.default.rootData}=${oe.default.data}${t.dynamicRef?(0,re._)`, ${oe.default.dynamicAnchors}={}`:re.nil}}={}`}function xh(t,e){t.if(oe.default.valCxt,()=>{t.var(oe.default.instancePath,(0,re._)`${oe.default.valCxt}.${oe.default.instancePath}`),t.var(oe.default.parentData,(0,re._)`${oe.default.valCxt}.${oe.default.parentData}`),t.var(oe.default.parentDataProperty,(0,re._)`${oe.default.valCxt}.${oe.default.parentDataProperty}`),t.var(oe.default.rootData,(0,re._)`${oe.default.valCxt}.${oe.default.rootData}`),e.dynamicRef&&t.var(oe.default.dynamicAnchors,(0,re._)`${oe.default.valCxt}.${oe.default.dynamicAnchors}`)},()=>{t.var(oe.default.instancePath,(0,re._)`""`),t.var(oe.default.parentData,(0,re._)`undefined`),t.var(oe.default.parentDataProperty,(0,re._)`undefined`),t.var(oe.default.rootData,oe.default.data),e.dynamicRef&&t.var(oe.default.dynamicAnchors,(0,re._)`{}`)})}function kh(t){const{schema:e,opts:r,gen:s}=t;qc(t,()=>{r.$comment&&e.$comment&&Kc(t),Nh(t),s.let(oe.default.vErrors,null),s.let(oe.default.errors,0),r.unevaluated&&Ih(t),Zc(t),Dh(t)})}function Ih(t){const{gen:e,validateName:r}=t;t.evaluated=e.const("evaluated",(0,re._)`${r}.evaluated`),e.if((0,re._)`${t.evaluated}.dynamicProps`,()=>e.assign((0,re._)`${t.evaluated}.props`,(0,re._)`undefined`)),e.if((0,re._)`${t.evaluated}.dynamicItems`,()=>e.assign((0,re._)`${t.evaluated}.items`,(0,re._)`undefined`))}function Uc(t,e){const r=typeof t=="object"&&t[e.schemaId];return r&&(e.code.source||e.code.process)?(0,re._)`/*# sourceURL=${r} */`:re.nil}function Th(t,e){if(zc(t)&&(Hc(t),Vc(t))){Oh(t,e);return}(0,Lc.boolOrEmptySchema)(t,e)}function Vc({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 zc(t){return typeof t.schema!="boolean"}function Oh(t,e){const{schema:r,gen:s,opts:a}=t;a.$comment&&r.$comment&&Kc(t),Ah(t),jh(t);const n=s.const("_errs",oe.default.errors);Zc(t,n),s.var(e,(0,re._)`${n} === ${oe.default.errors}`)}function Hc(t){(0,ar.checkUnknownRules)(t),Ch(t)}function Zc(t,e){if(t.opts.jtd)return Bc(t,[],!1,e);const r=(0,Fc.getSchemaTypes)(t.schema),s=(0,Fc.coerceAndCheckDataType)(t,r);Bc(t,r,!s,e)}function Ch(t){const{schema:e,errSchemaPath:r,opts:s,self:a}=t;e.$ref&&s.ignoreKeywordsWithRef&&(0,ar.schemaHasRulesButRef)(e,a.RULES)&&a.logger.warn(`$ref: keywords ignored in schema at path "${r}"`)}function Nh(t){const{schema:e,opts:r}=t;e.default!==void 0&&r.useDefaults&&r.strictSchema&&(0,ar.checkStrictMode)(t,"default is ignored in the schema root")}function Ah(t){const e=t.schema[t.opts.schemaId];e&&(t.baseId=(0,Eh.resolveUrl)(t.opts.uriResolver,t.baseId,e))}function jh(t){if(t.schema.$async&&!t.schemaEnv.$async)throw new Error("async schema in sync schema")}function Kc({gen:t,schemaEnv:e,schema:r,errSchemaPath:s,opts:a}){const n=r.$comment;if(a.$comment===!0)t.code((0,re._)`${oe.default.self}.logger.log(${n})`);else if(typeof a.$comment=="function"){const i=(0,re.str)`${s}/$comment`,o=t.scopeValue("root",{ref:e.root});t.code((0,re._)`${oe.default.self}.opts.$comment(${n}, ${i}, ${o}.schema)`)}}function Dh(t){const{gen:e,schemaEnv:r,validateName:s,ValidationError:a,opts:n}=t;r.$async?e.if((0,re._)`${oe.default.errors} === 0`,()=>e.return(oe.default.data),()=>e.throw((0,re._)`new ${a}(${oe.default.vErrors})`)):(e.assign((0,re._)`${s}.errors`,oe.default.vErrors),n.unevaluated&&Mh(t),e.return((0,re._)`${oe.default.errors} === 0`))}function Mh({gen:t,evaluated:e,props:r,items:s}){r instanceof re.Name&&t.assign((0,re._)`${e}.props`,r),s instanceof re.Name&&t.assign((0,re._)`${e}.items`,s)}function Bc(t,e,r,s){const{gen:a,schema:n,data:i,allErrors:o,opts:l,self:c}=t,{RULES:u}=c;if(n.$ref&&(l.ignoreKeywordsWithRef||!(0,ar.schemaHasRulesButRef)(n,u))){a.block(()=>Gc(t,"$ref",u.all.$ref.definition));return}l.jtd||Lh(t,e),a.block(()=>{for(const g of u.rules)d(g);d(u.post)});function d(g){(0,Kn.shouldUseGroup)(n,g)&&(g.type?(a.if((0,fs.checkDataType)(g.type,i,l.strictNumbers)),Wc(t,g),e.length===1&&e[0]===g.type&&r&&(a.else(),(0,fs.reportTypeError)(t)),a.endIf()):Wc(t,g),o||a.if((0,re._)`${oe.default.errors} === ${s||0}`))}}function Wc(t,e){const{gen:r,schema:s,opts:{useDefaults:a}}=t;a&&(0,Ph.assignDefaults)(t,e.type),r.block(()=>{for(const n of e.rules)(0,Kn.shouldUseRule)(s,n)&&Gc(t,n.keyword,n.definition,e.type)})}function Lh(t,e){t.schemaEnv.meta||!t.opts.strictTypes||(Fh(t,e),t.opts.allowUnionTypes||qh(t,e),Uh(t,t.dataTypes))}function Fh(t,e){if(e.length){if(!t.dataTypes.length){t.dataTypes=e;return}e.forEach(r=>{Jc(t.dataTypes,r)||Wn(t,`type "${r}" not allowed by context "${t.dataTypes.join(",")}"`)}),zh(t,e)}}function qh(t,e){e.length>1&&!(e.length===2&&e.includes("null"))&&Wn(t,"use allowUnionTypes to allow union type keyword")}function Uh(t,e){const r=t.self.RULES.all;for(const s in r){const a=r[s];if(typeof a=="object"&&(0,Kn.shouldUseRule)(t.schema,a)){const{type:n}=a.definition;n.length&&!n.some(i=>Vh(e,i))&&Wn(t,`missing type "${n.join(",")}" for keyword "${s}"`)}}}function Vh(t,e){return t.includes(e)||e==="number"&&t.includes("integer")}function Jc(t,e){return t.includes(e)||e==="integer"&&t.includes("number")}function zh(t,e){const r=[];for(const s of t.dataTypes)Jc(e,s)?r.push(s):e.includes("integer")&&s==="number"&&r.push("integer");t.dataTypes=r}function Wn(t,e){const r=t.schemaEnv.baseId+t.errSchemaPath;e+=` at "${r}" (strictTypes)`,(0,ar.checkStrictMode)(t,e,t.opts.strictTypes)}class Qc{constructor(e,r,s){if((0,Ea.validateKeywordUsage)(e,r,s),this.gen=e.gen,this.allErrors=e.allErrors,this.keyword=s,this.data=e.data,this.schema=e.schema[s],this.$data=r.$data&&e.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,ar.schemaRefOrVal)(e,this.schema,s,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",Yc(this.$data,e));else if(this.schemaCode=this.schemaValue,!(0,Ea.validSchemaType)(this.schema,r.schemaType,r.allowUndefined))throw new Error(`${s} value must be ${JSON.stringify(r.schemaType)}`);("code"in r?r.trackErrors:r.errors!==!1)&&(this.errsCount=e.gen.const("_errs",oe.default.errors))}result(e,r,s){this.failResult((0,re.not)(e),r,s)}failResult(e,r,s){this.gen.if(e),s?s():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,re.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,re._)`${r} !== undefined && (${(0,re.or)(this.invalid$data(),e)})`)}error(e,r,s){if(r){this.setParams(r),this._error(e,s),this.setParams({});return}this._error(e,s)}_error(e,r){(e?Sa.reportExtraError:Sa.reportError)(this,this.def.error,r)}$dataError(){(0,Sa.reportError)(this,this.def.$dataError||Sa.keyword$DataError)}reset(){if(this.errsCount===void 0)throw new Error('add "trackErrors" to keyword definition');(0,Sa.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,s=re.nil){this.gen.block(()=>{this.check$data(e,s),r()})}check$data(e=re.nil,r=re.nil){if(!this.$data)return;const{gen:s,schemaCode:a,schemaType:n,def:i}=this;s.if((0,re.or)((0,re._)`${a} === undefined`,r)),e!==re.nil&&s.assign(e,!0),(n.length||i.validateSchema)&&(s.elseIf(this.invalid$data()),this.$dataError(),e!==re.nil&&s.assign(e,!1)),s.else()}invalid$data(){const{gen:e,schemaCode:r,schemaType:s,def:a,it:n}=this;return(0,re.or)(i(),o());function i(){if(s.length){if(!(r instanceof re.Name))throw new Error("ajv implementation error");const l=Array.isArray(s)?s:[s];return(0,re._)`${(0,fs.checkDataTypes)(l,r,n.opts.strictNumbers,fs.DataType.Wrong)}`}return re.nil}function o(){if(a.validateSchema){const l=e.scopeValue("validate$data",{ref:a.validateSchema});return(0,re._)`!${l}(${r})`}return re.nil}}subschema(e,r){const s=(0,Bn.getSubschema)(this.it,e);(0,Bn.extendSubschemaData)(s,this.it,e),(0,Bn.extendSubschemaMode)(s,e);const a={...this.it,...s,items:void 0,props:void 0};return Th(a,r),a}mergeEvaluated(e,r){const{it:s,gen:a}=this;s.opts.unevaluated&&(s.props!==!0&&e.props!==void 0&&(s.props=ar.mergeEvaluated.props(a,e.props,s.props,r)),s.items!==!0&&e.items!==void 0&&(s.items=ar.mergeEvaluated.items(a,e.items,s.items,r)))}mergeValidEvaluated(e,r){const{it:s,gen:a}=this;if(s.opts.unevaluated&&(s.props!==!0||s.items!==!0))return a.if(r,()=>this.mergeEvaluated(e,re.Name)),!0}}kt.KeywordCxt=Qc;function Gc(t,e,r,s){const a=new Qc(t,r,e);"code"in r?r.code(a,s):a.$data&&r.validate?(0,Ea.funcKeywordCode)(a,r):"macro"in r?(0,Ea.macroKeywordCode)(a,r):(r.compile||r.validate)&&(0,Ea.funcKeywordCode)(a,r)}const Hh=/^\/(?:[^~]|~0|~1)*$/,Zh=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function Yc(t,{dataLevel:e,dataNames:r,dataPathArr:s}){let a,n;if(t==="")return oe.default.rootData;if(t[0]==="/"){if(!Hh.test(t))throw new Error(`Invalid JSON-pointer: ${t}`);a=t,n=oe.default.rootData}else{const c=Zh.exec(t);if(!c)throw new Error(`Invalid JSON-pointer: ${t}`);const u=+c[1];if(a=c[2],a==="#"){if(u>=e)throw new Error(l("property/index",u));return s[e-u]}if(u>e)throw new Error(l("data",u));if(n=r[e-u],!a)return n}let i=n;const o=a.split("/");for(const c of o)c&&(n=(0,re._)`${n}${(0,re.getProperty)((0,ar.unescapeJsonPointer)(c))}`,i=(0,re._)`${i} && ${n}`);return i;function l(c,u){return`Cannot access ${c} ${u} levels up, current level is ${e}`}}kt.getData=Yc;var Ra={};Object.defineProperty(Ra,"__esModule",{value:!0});let Kh=class extends Error{constructor(e){super("validation failed"),this.errors=e,this.ajv=this.validation=!0}};Ra.default=Kh;var Qr={};Object.defineProperty(Qr,"__esModule",{value:!0});const Jn=rt;let Bh=class extends Error{constructor(e,r,s,a){super(a||`can't resolve reference ${s} from id ${r}`),this.missingRef=(0,Jn.resolveUrl)(e,r,s),this.missingSchema=(0,Jn.normalizeId)((0,Jn.getFullPath)(e,this.missingRef))}};Qr.default=Bh;var ht={};Object.defineProperty(ht,"__esModule",{value:!0}),ht.resolveSchema=ht.getCompilingSchema=ht.resolveRef=ht.compileSchema=ht.SchemaEnv=void 0;const It=ge,Wh=Ra,Or=qt,Tt=rt,Xc=G,Jh=kt;class hs{constructor(e){var r;this.refs={},this.dynamicAnchors={};let s;typeof e.schema=="object"&&(s=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)(s==null?void 0:s[e.schemaId||"$id"]),this.schemaPath=e.schemaPath,this.localRefs=e.localRefs,this.meta=e.meta,this.$async=s==null?void 0:s.$async,this.refs={}}}ht.SchemaEnv=hs;function Qn(t){const e=el.call(this,t);if(e)return e;const r=(0,Tt.getFullPath)(this.opts.uriResolver,t.root.baseId),{es5:s,lines:a}=this.opts.code,{ownProperties:n}=this.opts,i=new It.CodeGen(this.scope,{es5:s,lines:a,ownProperties:n});let o;t.$async&&(o=i.scopeValue("Error",{ref:Wh.default,code:(0,It._)`require("ajv/dist/runtime/validation_error").default`}));const l=i.scopeName("validate");t.validateName=l;const c={gen:i,allErrors:this.opts.allErrors,data:Or.default.data,parentData:Or.default.parentData,parentDataProperty:Or.default.parentDataProperty,dataNames:[Or.default.data],dataPathArr:[It.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:i.scopeValue("schema",this.opts.code.source===!0?{ref:t.schema,code:(0,It.stringify)(t.schema)}:{ref:t.schema}),validateName:l,ValidationError:o,schema:t.schema,schemaEnv:t,rootId:r,baseId:t.baseId||r,schemaPath:It.nil,errSchemaPath:t.schemaPath||(this.opts.jtd?"":"#"),errorPath:(0,It._)`""`,opts:this.opts,self:this};let u;try{this._compilations.add(t),(0,Jh.validateFunctionCode)(c),i.optimize(this.opts.code.optimize);const d=i.toString();u=`${i.scopeRefs(Or.default.scope)}return ${d}`,this.opts.code.process&&(u=this.opts.code.process(u,t));const f=new Function(`${Or.default.self}`,`${Or.default.scope}`,u)(this,this.scope.get());if(this.scope.value(l,{ref:f}),f.errors=null,f.schema=t.schema,f.schemaEnv=t,t.$async&&(f.$async=!0),this.opts.code.source===!0&&(f.source={validateName:l,validateCode:d,scopeValues:i._values}),this.opts.unevaluated){const{props:m,items:p}=c;f.evaluated={props:m instanceof It.Name?void 0:m,items:p instanceof It.Name?void 0:p,dynamicProps:m instanceof It.Name,dynamicItems:p instanceof It.Name},f.source&&(f.source.evaluated=(0,It.stringify)(f.evaluated))}return t.validate=f,t}catch(d){throw delete t.validate,delete t.validateName,u&&this.logger.error("Error compiling schema, function code:",u),d}finally{this._compilations.delete(t)}}ht.compileSchema=Qn;function Qh(t,e,r){var s;r=(0,Tt.resolveUrl)(this.opts.uriResolver,e,r);const a=t.refs[r];if(a)return a;let n=Xh.call(this,t,r);if(n===void 0){const i=(s=t.localRefs)===null||s===void 0?void 0:s[r],{schemaId:o}=this.opts;i&&(n=new hs({schema:i,schemaId:o,root:t,baseId:e}))}if(n!==void 0)return t.refs[r]=Gh.call(this,n)}ht.resolveRef=Qh;function Gh(t){return(0,Tt.inlineRef)(t.schema,this.opts.inlineRefs)?t.schema:t.validate?t:Qn.call(this,t)}function el(t){for(const e of this._compilations)if(Yh(e,t))return e}ht.getCompilingSchema=el;function Yh(t,e){return t.schema===e.schema&&t.root===e.root&&t.baseId===e.baseId}function Xh(t,e){let r;for(;typeof(r=this.refs[e])=="string";)e=r;return r||this.schemas[e]||ps.call(this,t,e)}function ps(t,e){const r=this.opts.uriResolver.parse(e),s=(0,Tt._getFullPath)(this.opts.uriResolver,r);let a=(0,Tt.getFullPath)(this.opts.uriResolver,t.baseId,void 0);if(Object.keys(t.schema).length>0&&s===a)return Gn.call(this,r,t);const n=(0,Tt.normalizeId)(s),i=this.refs[n]||this.schemas[n];if(typeof i=="string"){const o=ps.call(this,t,i);return typeof(o==null?void 0:o.schema)!="object"?void 0:Gn.call(this,r,o)}if(typeof(i==null?void 0:i.schema)=="object"){if(i.validate||Qn.call(this,i),n===(0,Tt.normalizeId)(e)){const{schema:o}=i,{schemaId:l}=this.opts,c=o[l];return c&&(a=(0,Tt.resolveUrl)(this.opts.uriResolver,a,c)),new hs({schema:o,schemaId:l,root:t,baseId:a})}return Gn.call(this,r,i)}}ht.resolveSchema=ps;const ep=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function Gn(t,{baseId:e,schema:r,root:s}){var a;if(((a=t.fragment)===null||a===void 0?void 0:a[0])!=="/")return;for(const o of t.fragment.slice(1).split("/")){if(typeof r=="boolean")return;const l=r[(0,Xc.unescapeFragment)(o)];if(l===void 0)return;r=l;const c=typeof r=="object"&&r[this.opts.schemaId];!ep.has(o)&&c&&(e=(0,Tt.resolveUrl)(this.opts.uriResolver,e,c))}let n;if(typeof r!="boolean"&&r.$ref&&!(0,Xc.schemaHasRulesButRef)(r,this.RULES)){const o=(0,Tt.resolveUrl)(this.opts.uriResolver,e,r.$ref);n=ps.call(this,s,o)}const{schemaId:i}=this.opts;if(n=n||new hs({schema:r,schemaId:i,root:s,baseId:e}),n.schema!==n.root.schema)return n}const tp={$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 Yn={},ms={exports:{}};const rp=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),tl=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 rl(t){let e="",r=0,s=0;for(s=0;s<t.length;s++)if(r=t[s].charCodeAt(0),r!==48){if(!(r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";e+=t[s];break}for(s+=1;s<t.length;s++){if(r=t[s].charCodeAt(0),!(r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";e+=t[s]}return e}const ap=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function al(t){return t.length=0,!0}function sp(t,e,r){if(t.length){const s=rl(t);if(s!=="")e.push(s);else return r.error=!0,!1;t.length=0}return!0}function np(t){let e=0;const r={error:!1,address:"",zone:""},s=[],a=[];let n=!1,i=!1,o=sp;for(let l=0;l<t.length;l++){const c=t[l];if(!(c==="["||c==="]"))if(c===":"){if(n===!0&&(i=!0),!o(a,s,r))break;if(++e>7){r.error=!0;break}l>0&&t[l-1]===":"&&(n=!0),s.push(":");continue}else if(c==="%"){if(!o(a,s,r))break;o=al}else{a.push(c);continue}}return a.length&&(o===al?r.zone=a.join(""):i?s.push(a.join("")):s.push(rl(a))),r.address=s.join(""),r}function sl(t){if(ip(t,":")<2)return{host:t,isIPV6:!1};const e=np(t);if(e.error)return{host:t,isIPV6:!1};{let r=e.address,s=e.address;return e.zone&&(r+="%"+e.zone,s+="%25"+e.zone),{host:r,isIPV6:!0,escapedHost:s}}}function ip(t,e){let r=0;for(let s=0;s<t.length;s++)t[s]===e&&r++;return r}function op(t){let e=t;const r=[];let s=-1,a=0;for(;a=e.length;){if(a===1){if(e===".")break;if(e==="/"){r.push("/");break}else{r.push(e);break}}else if(a===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(a===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((s=e.indexOf("/",1))===-1){r.push(e);break}else r.push(e.slice(0,s)),e=e.slice(s)}return r.join("")}function cp(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 lp(t){const e=[];if(t.userinfo!==void 0&&(e.push(t.userinfo),e.push("@")),t.host!==void 0){let r=unescape(t.host);if(!tl(r)){const s=sl(r);s.isIPV6===!0?r=`[${s.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 nl={nonSimpleDomain:ap,recomposeAuthority:lp,normalizeComponentEncoding:cp,removeDotSegments:op,isIPv4:tl,isUUID:rp,normalizeIPv6:sl};const{isUUID:up}=nl,dp=/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu;function il(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 ol(t){return t.host||(t.error=t.error||"HTTP URIs must have a host."),t}function cl(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 fp(t){return t.secure=il(t),t.resourceName=(t.path||"/")+(t.query?"?"+t.query:""),t.path=void 0,t.query=void 0,t}function hp(t){if((t.port===(il(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(dp);if(r){const s=e.scheme||t.scheme||"urn";t.nid=r[1].toLowerCase(),t.nss=r[2];const a=`${s}:${e.nid||t.nid}`,n=Xn(a);t.path=void 0,n&&(t=n.parse(t,e))}else t.error=t.error||"URN can not be parsed.";return t}function mp(t,e){if(t.nid===void 0)throw new Error("URN without nid cannot be serialized");const r=e.scheme||t.scheme||"urn",s=t.nid.toLowerCase(),a=`${r}:${e.nid||s}`,n=Xn(a);n&&(t=n.serialize(t,e));const i=t,o=t.nss;return i.path=`${s||e.nid}:${o}`,e.skipEscape=!0,i}function vp(t,e){const r=t;return r.uuid=r.nss,r.nss=void 0,!e.tolerant&&(!r.uuid||!up(r.uuid))&&(r.error=r.error||"UUID is not valid."),r}function gp(t){const e=t;return e.nss=(t.uuid||"").toLowerCase(),e}const ll={scheme:"http",domainHost:!0,parse:ol,serialize:cl},_p={scheme:"https",domainHost:ll.domainHost,parse:ol,serialize:cl},vs={scheme:"ws",domainHost:!0,parse:fp,serialize:hp},yp={scheme:"wss",domainHost:vs.domainHost,parse:vs.parse,serialize:vs.serialize},gs={http:ll,https:_p,ws:vs,wss:yp,urn:{scheme:"urn",parse:pp,serialize:mp,skipNormalize:!0},"urn:uuid":{scheme:"urn:uuid",parse:vp,serialize:gp,skipNormalize:!0}};Object.setPrototypeOf(gs,null);function Xn(t){return t&&(gs[t]||gs[t.toLowerCase()])||void 0}var wp={SCHEMES:gs,getSchemeHandler:Xn};const{normalizeIPv6:bp,removeDotSegments:xa,recomposeAuthority:$p,normalizeComponentEncoding:_s,isIPv4:Pp,nonSimpleDomain:Ep}=nl,{SCHEMES:Sp,getSchemeHandler:ul}=wp;function Rp(t,e){return typeof t=="string"?t=zt(sr(t,e),e):typeof t=="object"&&(t=sr(zt(t,e),e)),t}function xp(t,e,r){const s=r?Object.assign({scheme:"null"},r):{scheme:"null"},a=dl(sr(t,s),sr(e,s),s,!0);return s.skipEscape=!0,zt(a,s)}function dl(t,e,r,s){const a={};return s||(t=sr(zt(t,r),r),e=sr(zt(e,r),r)),r=r||{},!r.tolerant&&e.scheme?(a.scheme=e.scheme,a.userinfo=e.userinfo,a.host=e.host,a.port=e.port,a.path=xa(e.path||""),a.query=e.query):(e.userinfo!==void 0||e.host!==void 0||e.port!==void 0?(a.userinfo=e.userinfo,a.host=e.host,a.port=e.port,a.path=xa(e.path||""),a.query=e.query):(e.path?(e.path[0]==="/"?a.path=xa(e.path):((t.userinfo!==void 0||t.host!==void 0||t.port!==void 0)&&!t.path?a.path="/"+e.path:t.path?a.path=t.path.slice(0,t.path.lastIndexOf("/")+1)+e.path:a.path=e.path,a.path=xa(a.path)),a.query=e.query):(a.path=t.path,e.query!==void 0?a.query=e.query:a.query=t.query),a.userinfo=t.userinfo,a.host=t.host,a.port=t.port),a.scheme=t.scheme),a.fragment=e.fragment,a}function kp(t,e,r){return typeof t=="string"?(t=unescape(t),t=zt(_s(sr(t,r),!0),{...r,skipEscape:!0})):typeof t=="object"&&(t=zt(_s(t,!0),{...r,skipEscape:!0})),typeof e=="string"?(e=unescape(e),e=zt(_s(sr(e,r),!0),{...r,skipEscape:!0})):typeof e=="object"&&(e=zt(_s(e,!0),{...r,skipEscape:!0})),t.toLowerCase()===e.toLowerCase()}function zt(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:""},s=Object.assign({},e),a=[],n=ul(s.scheme||r.scheme);n&&n.serialize&&n.serialize(r,s),r.path!==void 0&&(s.skipEscape?r.path=unescape(r.path):(r.path=escape(r.path),r.scheme!==void 0&&(r.path=r.path.split("%3A").join(":")))),s.reference!=="suffix"&&r.scheme&&a.push(r.scheme,":");const i=$p(r);if(i!==void 0&&(s.reference!=="suffix"&&a.push("//"),a.push(i),r.path&&r.path[0]!=="/"&&a.push("/")),r.path!==void 0){let o=r.path;!s.absolutePath&&(!n||!n.absolutePath)&&(o=xa(o)),i===void 0&&o[0]==="/"&&o[1]==="/"&&(o="/%2F"+o.slice(2)),a.push(o)}return r.query!==void 0&&a.push("?",r.query),r.fragment!==void 0&&a.push("#",r.fragment),a.join("")}const Ip=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;function sr(t,e){const r=Object.assign({},e),s={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0};let a=!1;r.reference==="suffix"&&(r.scheme?t=r.scheme+":"+t:t="//"+t);const n=t.match(Ip);if(n){if(s.scheme=n[1],s.userinfo=n[3],s.host=n[4],s.port=parseInt(n[5],10),s.path=n[6]||"",s.query=n[7],s.fragment=n[8],isNaN(s.port)&&(s.port=n[5]),s.host)if(Pp(s.host)===!1){const l=bp(s.host);s.host=l.host.toLowerCase(),a=l.isIPV6}else a=!0;s.scheme===void 0&&s.userinfo===void 0&&s.host===void 0&&s.port===void 0&&s.query===void 0&&!s.path?s.reference="same-document":s.scheme===void 0?s.reference="relative":s.fragment===void 0?s.reference="absolute":s.reference="uri",r.reference&&r.reference!=="suffix"&&r.reference!==s.reference&&(s.error=s.error||"URI is not a "+r.reference+" reference.");const i=ul(r.scheme||s.scheme);if(!r.unicodeSupport&&(!i||!i.unicodeSupport)&&s.host&&(r.domainHost||i&&i.domainHost)&&a===!1&&Ep(s.host))try{s.host=URL.domainToASCII(s.host.toLowerCase())}catch(o){s.error=s.error||"Host's domain name can not be converted to ASCII: "+o}(!i||i&&!i.skipNormalize)&&(t.indexOf("%")!==-1&&(s.scheme!==void 0&&(s.scheme=unescape(s.scheme)),s.host!==void 0&&(s.host=unescape(s.host))),s.path&&(s.path=escape(unescape(s.path))),s.fragment&&(s.fragment=encodeURI(decodeURIComponent(s.fragment)))),i&&i.parse&&i.parse(s,r)}else s.error=s.error||"URI can not be parsed.";return s}const ei={SCHEMES:Sp,normalize:Rp,resolve:xp,resolveComponent:dl,equal:kp,serialize:zt,parse:sr};ms.exports=ei,ms.exports.default=ei,ms.exports.fastUri=ei;var Tp=ms.exports;Object.defineProperty(Yn,"__esModule",{value:!0});const fl=Tp;fl.code='require("ajv/dist/runtime/uri").default',Yn.default=fl,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=kt;Object.defineProperty(t,"KeywordCxt",{enumerable:!0,get:function(){return e.KeywordCxt}});var r=ge;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 s=Ra,a=Qr,n=Ir,i=ht,o=ge,l=rt,c=Xe,u=G,d=tp,g=Yn,f=(N,R)=>new RegExp(N,R);f.code="new RegExp";const m=["removeAdditional","useDefaults","coerceTypes"],p=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),h={errorDataPath:"",format:"`validateFormats: false` can be used instead.",nullable:'"nullable" keyword is supported by default.',jsonPointers:"Deprecated jsPropertySyntax can be used instead.",extendRefs:"Deprecated ignoreKeywordsWithRef can be used instead.",missingRefs:"Pass empty schema with $id that should be ignored to ajv.addSchema.",processCode:"Use option `code: {process: (code, schemaEnv: object) => string}`",sourceCode:"Use option `code: {source: true}`",strictDefaults:"It is default now, see option `strict`.",strictKeywords:"It is default now, see option `strict`.",uniqueItems:'"uniqueItems" keyword is always validated.',unknownFormats:"Disable strict mode or pass `true` to `ajv.addFormat` (or `formats` option).",cache:"Map is used as cache, schema object as key.",serialize:"Map is used as cache, schema object as key.",ajvErrors:"It is default now."},v={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},w=200;function P(N){var R,j,k,_,b,C,K,Q,fe,ne,he,lt,Ke,Ie,Et,Ge,Gt,Ft,ze,St,ur,qe,Ue,tt,xr;const dr=N.strict,Vr=(R=N.code)===null||R===void 0?void 0:R.optimize,Tn=Vr===!0||Vr===void 0?1:Vr||0,Rt=(k=(j=N.code)===null||j===void 0?void 0:j.regExp)!==null&&k!==void 0?k:f,zr=(_=N.uriResolver)!==null&&_!==void 0?_:g.default;return{strictSchema:(C=(b=N.strictSchema)!==null&&b!==void 0?b:dr)!==null&&C!==void 0?C:!0,strictNumbers:(Q=(K=N.strictNumbers)!==null&&K!==void 0?K:dr)!==null&&Q!==void 0?Q:!0,strictTypes:(ne=(fe=N.strictTypes)!==null&&fe!==void 0?fe:dr)!==null&&ne!==void 0?ne:"log",strictTuples:(lt=(he=N.strictTuples)!==null&&he!==void 0?he:dr)!==null&&lt!==void 0?lt:"log",strictRequired:(Ie=(Ke=N.strictRequired)!==null&&Ke!==void 0?Ke:dr)!==null&&Ie!==void 0?Ie:!1,code:N.code?{...N.code,optimize:Tn,regExp:Rt}:{optimize:Tn,regExp:Rt},loopRequired:(Et=N.loopRequired)!==null&&Et!==void 0?Et:w,loopEnum:(Ge=N.loopEnum)!==null&&Ge!==void 0?Ge:w,meta:(Gt=N.meta)!==null&&Gt!==void 0?Gt:!0,messages:(Ft=N.messages)!==null&&Ft!==void 0?Ft:!0,inlineRefs:(ze=N.inlineRefs)!==null&&ze!==void 0?ze:!0,schemaId:(St=N.schemaId)!==null&&St!==void 0?St:"$id",addUsedSchema:(ur=N.addUsedSchema)!==null&&ur!==void 0?ur:!0,validateSchema:(qe=N.validateSchema)!==null&&qe!==void 0?qe:!0,validateFormats:(Ue=N.validateFormats)!==null&&Ue!==void 0?Ue:!0,unicodeRegExp:(tt=N.unicodeRegExp)!==null&&tt!==void 0?tt:!0,int32range:(xr=N.int32range)!==null&&xr!==void 0?xr:!0,uriResolver:zr}}class S{constructor(R={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,R=this.opts={...R,...P(R)};const{es5:j,lines:k}=this.opts.code;this.scope=new o.ValueScope({scope:{},prefixes:p,es5:j,lines:k}),this.logger=H(R.logger);const _=R.validateFormats;R.validateFormats=!1,this.RULES=(0,n.getRules)(),x.call(this,h,R,"NOT SUPPORTED"),x.call(this,v,R,"DEPRECATED","warn"),this._metaOpts=W.call(this),R.formats&&U.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),R.keywords&&D.call(this,R.keywords),typeof R.meta=="object"&&this.addMetaSchema(R.meta),z.call(this),R.validateFormats=_}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){const{$data:R,meta:j,schemaId:k}=this.opts;let _=d;k==="id"&&(_={...d},_.id=_.$id,delete _.$id),j&&R&&this.addMetaSchema(_,_[k],!1)}defaultMeta(){const{meta:R,schemaId:j}=this.opts;return this.opts.defaultMeta=typeof R=="object"?R[j]||R:void 0}validate(R,j){let k;if(typeof R=="string"){if(k=this.getSchema(R),!k)throw new Error(`no schema with key or ref "${R}"`)}else k=this.compile(R);const _=k(j);return"$async"in k||(this.errors=k.errors),_}compile(R,j){const k=this._addSchema(R,j);return k.validate||this._compileSchemaEnv(k)}compileAsync(R,j){if(typeof this.opts.loadSchema!="function")throw new Error("options.loadSchema should be a function");const{loadSchema:k}=this.opts;return _.call(this,R,j);async function _(ne,he){await b.call(this,ne.$schema);const lt=this._addSchema(ne,he);return lt.validate||C.call(this,lt)}async function b(ne){ne&&!this.getSchema(ne)&&await _.call(this,{$ref:ne},!0)}async function C(ne){try{return this._compileSchemaEnv(ne)}catch(he){if(!(he instanceof a.default))throw he;return K.call(this,he),await Q.call(this,he.missingSchema),C.call(this,ne)}}function K({missingSchema:ne,missingRef:he}){if(this.refs[ne])throw new Error(`AnySchema ${ne} is loaded but ${he} cannot be resolved`)}async function Q(ne){const he=await fe.call(this,ne);this.refs[ne]||await b.call(this,he.$schema),this.refs[ne]||this.addSchema(he,ne,j)}async function fe(ne){const he=this._loading[ne];if(he)return he;try{return await(this._loading[ne]=k(ne))}finally{delete this._loading[ne]}}}addSchema(R,j,k,_=this.opts.validateSchema){if(Array.isArray(R)){for(const C of R)this.addSchema(C,void 0,k,_);return this}let b;if(typeof R=="object"){const{schemaId:C}=this.opts;if(b=R[C],b!==void 0&&typeof b!="string")throw new Error(`schema ${C} must be string`)}return j=(0,l.normalizeId)(j||b),this._checkUnique(j),this.schemas[j]=this._addSchema(R,k,j,_,!0),this}addMetaSchema(R,j,k=this.opts.validateSchema){return this.addSchema(R,j,!0,k),this}validateSchema(R,j){if(typeof R=="boolean")return!0;let k;if(k=R.$schema,k!==void 0&&typeof k!="string")throw new Error("$schema must be a string");if(k=k||this.opts.defaultMeta||this.defaultMeta(),!k)return this.logger.warn("meta-schema not available"),this.errors=null,!0;const _=this.validate(k,R);if(!_&&j){const b="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(b);else throw new Error(b)}return _}getSchema(R){let j;for(;typeof(j=A.call(this,R))=="string";)R=j;if(j===void 0){const{schemaId:k}=this.opts,_=new i.SchemaEnv({schema:{},schemaId:k});if(j=i.resolveSchema.call(this,_,R),!j)return;this.refs[R]=j}return j.validate||this._compileSchemaEnv(j)}removeSchema(R){if(R instanceof RegExp)return this._removeAllSchemas(this.schemas,R),this._removeAllSchemas(this.refs,R),this;switch(typeof R){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{const j=A.call(this,R);return typeof j=="object"&&this._cache.delete(j.schema),delete this.schemas[R],delete this.refs[R],this}case"object":{const j=R;this._cache.delete(j);let k=R[this.opts.schemaId];return k&&(k=(0,l.normalizeId)(k),delete this.schemas[k],delete this.refs[k]),this}default:throw new Error("ajv.removeSchema: invalid parameter")}}addVocabulary(R){for(const j of R)this.addKeyword(j);return this}addKeyword(R,j){let k;if(typeof R=="string")k=R,typeof j=="object"&&(this.logger.warn("these parameters are deprecated, see docs for addKeyword"),j.keyword=k);else if(typeof R=="object"&&j===void 0){if(j=R,k=j.keyword,Array.isArray(k)&&!k.length)throw new Error("addKeywords: keyword must be string or non-empty array")}else throw new Error("invalid addKeywords parameters");if(M.call(this,k,j),!j)return(0,u.eachItem)(k,b=>te.call(this,b)),this;ve.call(this,j);const _={...j,type:(0,c.getJSONTypes)(j.type),schemaType:(0,c.getJSONTypes)(j.schemaType)};return(0,u.eachItem)(k,_.type.length===0?b=>te.call(this,b,_):b=>_.type.forEach(C=>te.call(this,b,_,C))),this}getKeyword(R){const j=this.RULES.all[R];return typeof j=="object"?j.definition:!!j}removeKeyword(R){const{RULES:j}=this;delete j.keywords[R],delete j.all[R];for(const k of j.rules){const _=k.rules.findIndex(b=>b.keyword===R);_>=0&&k.rules.splice(_,1)}return this}addFormat(R,j){return typeof j=="string"&&(j=new RegExp(j)),this.formats[R]=j,this}errorsText(R=this.errors,{separator:j=", ",dataVar:k="data"}={}){return!R||R.length===0?"No errors":R.map(_=>`${k}${_.instancePath} ${_.message}`).reduce((_,b)=>_+j+b)}$dataMetaSchema(R,j){const k=this.RULES.all;R=JSON.parse(JSON.stringify(R));for(const _ of j){const b=_.split("/").slice(1);let C=R;for(const K of b)C=C[K];for(const K in k){const Q=k[K];if(typeof Q!="object")continue;const{$data:fe}=Q.definition,ne=C[K];fe&&ne&&(C[K]=de(ne))}}return R}_removeAllSchemas(R,j){for(const k in R){const _=R[k];(!j||j.test(k))&&(typeof _=="string"?delete R[k]:_&&!_.meta&&(this._cache.delete(_.schema),delete R[k]))}}_addSchema(R,j,k,_=this.opts.validateSchema,b=this.opts.addUsedSchema){let C;const{schemaId:K}=this.opts;if(typeof R=="object")C=R[K];else{if(this.opts.jtd)throw new Error("schema must be object");if(typeof R!="boolean")throw new Error("schema must be object or boolean")}let Q=this._cache.get(R);if(Q!==void 0)return Q;k=(0,l.normalizeId)(C||k);const fe=l.getSchemaRefs.call(this,R,k);return Q=new i.SchemaEnv({schema:R,schemaId:K,meta:j,baseId:k,localRefs:fe}),this._cache.set(Q.schema,Q),b&&!k.startsWith("#")&&(k&&this._checkUnique(k),this.refs[k]=Q),_&&this.validateSchema(R,!0),Q}_checkUnique(R){if(this.schemas[R]||this.refs[R])throw new Error(`schema with key or id "${R}" already exists`)}_compileSchemaEnv(R){if(R.meta?this._compileMetaSchema(R):i.compileSchema.call(this,R),!R.validate)throw new Error("ajv implementation error");return R.validate}_compileMetaSchema(R){const j=this.opts;this.opts=this._metaOpts;try{i.compileSchema.call(this,R)}finally{this.opts=j}}}S.ValidationError=s.default,S.MissingRefError=a.default,t.default=S;function x(N,R,j,k="error"){for(const _ in N){const b=_;b in R&&this.logger[k](`${j}: option ${_}. ${N[b]}`)}}function A(N){return N=(0,l.normalizeId)(N),this.schemas[N]||this.refs[N]}function z(){const N=this.opts.schemas;if(N)if(Array.isArray(N))this.addSchema(N);else for(const R in N)this.addSchema(N[R],R)}function U(){for(const N in this.opts.formats){const R=this.opts.formats[N];R&&this.addFormat(N,R)}}function D(N){if(Array.isArray(N)){this.addVocabulary(N);return}this.logger.warn("keywords option as map is deprecated, pass array");for(const R in N){const j=N[R];j.keyword||(j.keyword=R),this.addKeyword(j)}}function W(){const N={...this.opts};for(const R of m)delete N[R];return N}const J={log(){},warn(){},error(){}};function H(N){if(N===!1)return J;if(N===void 0)return console;if(N.log&&N.warn&&N.error)return N;throw new Error("logger must implement log, warn and error methods")}const F=/^[a-z_$][a-z0-9_$:-]*$/i;function M(N,R){const{RULES:j}=this;if((0,u.eachItem)(N,k=>{if(j.keywords[k])throw new Error(`Keyword ${k} is already defined`);if(!F.test(k))throw new Error(`Keyword ${k} has invalid name`)}),!!R&&R.$data&&!("code"in R||"validate"in R))throw new Error('$data keyword must have "code" or "validate" function')}function te(N,R,j){var k;const _=R==null?void 0:R.post;if(j&&_)throw new Error('keyword with "post" flag cannot have "type"');const{RULES:b}=this;let C=_?b.post:b.rules.find(({type:Q})=>Q===j);if(C||(C={type:j,rules:[]},b.rules.push(C)),b.keywords[N]=!0,!R)return;const K={keyword:N,definition:{...R,type:(0,c.getJSONTypes)(R.type),schemaType:(0,c.getJSONTypes)(R.schemaType)}};R.before?ye.call(this,C,K,R.before):C.rules.push(K),b.all[N]=K,(k=R.implements)===null||k===void 0||k.forEach(Q=>this.addKeyword(Q))}function ye(N,R,j){const k=N.rules.findIndex(_=>_.keyword===j);k>=0?N.rules.splice(k,0,R):(N.rules.push(R),this.logger.warn(`rule ${j} is not defined`))}function ve(N){let{metaSchema:R}=N;R!==void 0&&(N.$data&&this.opts.$data&&(R=de(R)),N.validateSchema=this.compile(R,!0))}const be={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function de(N){return{anyOf:[N,be]}}}(pc);var ti={},ri={},ai={};Object.defineProperty(ai,"__esModule",{value:!0});const Op={keyword:"id",code(){throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};ai.default=Op;var Cr={};Object.defineProperty(Cr,"__esModule",{value:!0}),Cr.callRef=Cr.getValidate=void 0;const Cp=Qr,hl=_e,pt=ge,Gr=qt,pl=ht,ys=G,Np={keyword:"$ref",schemaType:"string",code(t){const{gen:e,schema:r,it:s}=t,{baseId:a,schemaEnv:n,validateName:i,opts:o,self:l}=s,{root:c}=n;if((r==="#"||r==="#/")&&a===c.baseId)return d();const u=pl.resolveRef.call(l,c,a,r);if(u===void 0)throw new Cp.default(s.opts.uriResolver,a,r);if(u instanceof pl.SchemaEnv)return g(u);return f(u);function d(){if(n===c)return ws(t,i,n,n.$async);const m=e.scopeValue("root",{ref:c});return ws(t,(0,pt._)`${m}.validate`,c,c.$async)}function g(m){const p=ml(t,m);ws(t,p,m,m.$async)}function f(m){const p=e.scopeValue("schema",o.code.source===!0?{ref:m,code:(0,pt.stringify)(m)}:{ref:m}),h=e.name("valid"),v=t.subschema({schema:m,dataTypes:[],schemaPath:pt.nil,topSchemaRef:p,errSchemaPath:r},h);t.mergeEvaluated(v),t.ok(h)}}};function ml(t,e){const{gen:r}=t;return e.validate?r.scopeValue("validate",{ref:e.validate}):(0,pt._)`${r.scopeValue("wrapper",{ref:e})}.validate`}Cr.getValidate=ml;function ws(t,e,r,s){const{gen:a,it:n}=t,{allErrors:i,schemaEnv:o,opts:l}=n,c=l.passContext?Gr.default.this:pt.nil;s?u():d();function u(){if(!o.$async)throw new Error("async schema referenced by sync schema");const m=a.let("valid");a.try(()=>{a.code((0,pt._)`await ${(0,hl.callValidateCode)(t,e,c)}`),f(e),i||a.assign(m,!0)},p=>{a.if((0,pt._)`!(${p} instanceof ${n.ValidationError})`,()=>a.throw(p)),g(p),i||a.assign(m,!1)}),t.ok(m)}function d(){t.result((0,hl.callValidateCode)(t,e,c),()=>f(e),()=>g(e))}function g(m){const p=(0,pt._)`${m}.errors`;a.assign(Gr.default.vErrors,(0,pt._)`${Gr.default.vErrors} === null ? ${p} : ${Gr.default.vErrors}.concat(${p})`),a.assign(Gr.default.errors,(0,pt._)`${Gr.default.vErrors}.length`)}function f(m){var p;if(!n.opts.unevaluated)return;const h=(p=r==null?void 0:r.validate)===null||p===void 0?void 0:p.evaluated;if(n.props!==!0)if(h&&!h.dynamicProps)h.props!==void 0&&(n.props=ys.mergeEvaluated.props(a,h.props,n.props));else{const v=a.var("props",(0,pt._)`${m}.evaluated.props`);n.props=ys.mergeEvaluated.props(a,v,n.props,pt.Name)}if(n.items!==!0)if(h&&!h.dynamicItems)h.items!==void 0&&(n.items=ys.mergeEvaluated.items(a,h.items,n.items));else{const v=a.var("items",(0,pt._)`${m}.evaluated.items`);n.items=ys.mergeEvaluated.items(a,v,n.items,pt.Name)}}}Cr.callRef=ws,Cr.default=Np,Object.defineProperty(ri,"__esModule",{value:!0});const Ap=ai,jp=Cr,Dp=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",Ap.default,jp.default];ri.default=Dp;var si={},ni={};Object.defineProperty(ni,"__esModule",{value:!0});const bs=ge,vr=bs.operators,$s={maximum:{okStr:"<=",ok:vr.LTE,fail:vr.GT},minimum:{okStr:">=",ok:vr.GTE,fail:vr.LT},exclusiveMaximum:{okStr:"<",ok:vr.LT,fail:vr.GTE},exclusiveMinimum:{okStr:">",ok:vr.GT,fail:vr.LTE}},Mp={message:({keyword:t,schemaCode:e})=>(0,bs.str)`must be ${$s[t].okStr} ${e}`,params:({keyword:t,schemaCode:e})=>(0,bs._)`{comparison: ${$s[t].okStr}, limit: ${e}}`},Lp={keyword:Object.keys($s),type:"number",schemaType:"number",$data:!0,error:Mp,code(t){const{keyword:e,data:r,schemaCode:s}=t;t.fail$data((0,bs._)`${r} ${$s[e].fail} ${s} || isNaN(${r})`)}};ni.default=Lp;var ii={};Object.defineProperty(ii,"__esModule",{value:!0});const ka=ge,Fp={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:{message:({schemaCode:t})=>(0,ka.str)`must be multiple of ${t}`,params:({schemaCode:t})=>(0,ka._)`{multipleOf: ${t}}`},code(t){const{gen:e,data:r,schemaCode:s,it:a}=t,n=a.opts.multipleOfPrecision,i=e.let("res"),o=n?(0,ka._)`Math.abs(Math.round(${i}) - ${i}) > 1e-${n}`:(0,ka._)`${i} !== parseInt(${i})`;t.fail$data((0,ka._)`(${s} === 0 || (${i} = ${r}/${s}, ${o}))`)}};ii.default=Fp;var oi={},ci={};Object.defineProperty(ci,"__esModule",{value:!0});function vl(t){const e=t.length;let r=0,s=0,a;for(;s<e;)r++,a=t.charCodeAt(s++),a>=55296&&a<=56319&&s<e&&(a=t.charCodeAt(s),(a&64512)===56320&&s++);return r}ci.default=vl,vl.code='require("ajv/dist/runtime/ucs2length").default',Object.defineProperty(oi,"__esModule",{value:!0});const Nr=ge,qp=G,Up=ci,Vp={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:{message({keyword:t,schemaCode:e}){const r=t==="maxLength"?"more":"fewer";return(0,Nr.str)`must NOT have ${r} than ${e} characters`},params:({schemaCode:t})=>(0,Nr._)`{limit: ${t}}`},code(t){const{keyword:e,data:r,schemaCode:s,it:a}=t,n=e==="maxLength"?Nr.operators.GT:Nr.operators.LT,i=a.opts.unicode===!1?(0,Nr._)`${r}.length`:(0,Nr._)`${(0,qp.useFunc)(t.gen,Up.default)}(${r})`;t.fail$data((0,Nr._)`${i} ${n} ${s}`)}};oi.default=Vp;var li={};Object.defineProperty(li,"__esModule",{value:!0});const zp=_e,Ps=ge,Hp={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:{message:({schemaCode:t})=>(0,Ps.str)`must match pattern "${t}"`,params:({schemaCode:t})=>(0,Ps._)`{pattern: ${t}}`},code(t){const{data:e,$data:r,schema:s,schemaCode:a,it:n}=t,i=n.opts.unicodeRegExp?"u":"",o=r?(0,Ps._)`(new RegExp(${a}, ${i}))`:(0,zp.usePattern)(t,s);t.fail$data((0,Ps._)`!${o}.test(${e})`)}};li.default=Hp;var ui={};Object.defineProperty(ui,"__esModule",{value:!0});const Ia=ge,Zp={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:{message({keyword:t,schemaCode:e}){const r=t==="maxProperties"?"more":"fewer";return(0,Ia.str)`must NOT have ${r} than ${e} properties`},params:({schemaCode:t})=>(0,Ia._)`{limit: ${t}}`},code(t){const{keyword:e,data:r,schemaCode:s}=t,a=e==="maxProperties"?Ia.operators.GT:Ia.operators.LT;t.fail$data((0,Ia._)`Object.keys(${r}).length ${a} ${s}`)}};ui.default=Zp;var di={};Object.defineProperty(di,"__esModule",{value:!0});const Ta=_e,Oa=ge,Kp=G,Bp={keyword:"required",type:"object",schemaType:"array",$data:!0,error:{message:({params:{missingProperty:t}})=>(0,Oa.str)`must have required property '${t}'`,params:({params:{missingProperty:t}})=>(0,Oa._)`{missingProperty: ${t}}`},code(t){const{gen:e,schema:r,schemaCode:s,data:a,$data:n,it:i}=t,{opts:o}=i;if(!n&&r.length===0)return;const l=r.length>=o.loopRequired;if(i.allErrors?c():u(),o.strictRequired){const f=t.parentSchema.properties,{definedProperties:m}=t.it;for(const p of r)if((f==null?void 0:f[p])===void 0&&!m.has(p)){const h=i.schemaEnv.baseId+i.errSchemaPath,v=`required property "${p}" is not defined at "${h}" (strictRequired)`;(0,Kp.checkStrictMode)(i,v,i.opts.strictRequired)}}function c(){if(l||n)t.block$data(Oa.nil,d);else for(const f of r)(0,Ta.checkReportMissingProp)(t,f)}function u(){const f=e.let("missing");if(l||n){const m=e.let("valid",!0);t.block$data(m,()=>g(f,m)),t.ok(m)}else e.if((0,Ta.checkMissingProp)(t,r,f)),(0,Ta.reportMissingProp)(t,f),e.else()}function d(){e.forOf("prop",s,f=>{t.setParams({missingProperty:f}),e.if((0,Ta.noPropertyInData)(e,a,f,o.ownProperties),()=>t.error())})}function g(f,m){t.setParams({missingProperty:f}),e.forOf(f,s,()=>{e.assign(m,(0,Ta.propertyInData)(e,a,f,o.ownProperties)),e.if((0,Oa.not)(m),()=>{t.error(),e.break()})},Oa.nil)}}};di.default=Bp;var fi={};Object.defineProperty(fi,"__esModule",{value:!0});const Ca=ge,Wp={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:{message({keyword:t,schemaCode:e}){const r=t==="maxItems"?"more":"fewer";return(0,Ca.str)`must NOT have ${r} than ${e} items`},params:({schemaCode:t})=>(0,Ca._)`{limit: ${t}}`},code(t){const{keyword:e,data:r,schemaCode:s}=t,a=e==="maxItems"?Ca.operators.GT:Ca.operators.LT;t.fail$data((0,Ca._)`${r}.length ${a} ${s}`)}};fi.default=Wp;var hi={},Na={};Object.defineProperty(Na,"__esModule",{value:!0});const gl=Pa;gl.code='require("ajv/dist/runtime/equal").default',Na.default=gl,Object.defineProperty(hi,"__esModule",{value:!0});const pi=Xe,at=ge,Jp=G,Qp=Na,Gp={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:{message:({params:{i:t,j:e}})=>(0,at.str)`must NOT have duplicate items (items ## ${e} and ${t} are identical)`,params:({params:{i:t,j:e}})=>(0,at._)`{i: ${t}, j: ${e}}`},code(t){const{gen:e,data:r,$data:s,schema:a,parentSchema:n,schemaCode:i,it:o}=t;if(!s&&!a)return;const l=e.let("valid"),c=n.items?(0,pi.getSchemaTypes)(n.items):[];t.block$data(l,u,(0,at._)`${i} === false`),t.ok(l);function u(){const m=e.let("i",(0,at._)`${r}.length`),p=e.let("j");t.setParams({i:m,j:p}),e.assign(l,!0),e.if((0,at._)`${m} > 1`,()=>(d()?g:f)(m,p))}function d(){return c.length>0&&!c.some(m=>m==="object"||m==="array")}function g(m,p){const h=e.name("item"),v=(0,pi.checkDataTypes)(c,h,o.opts.strictNumbers,pi.DataType.Wrong),w=e.const("indices",(0,at._)`{}`);e.for((0,at._)`;${m}--;`,()=>{e.let(h,(0,at._)`${r}[${m}]`),e.if(v,(0,at._)`continue`),c.length>1&&e.if((0,at._)`typeof ${h} == "string"`,(0,at._)`${h} += "_"`),e.if((0,at._)`typeof ${w}[${h}] == "number"`,()=>{e.assign(p,(0,at._)`${w}[${h}]`),t.error(),e.assign(l,!1).break()}).code((0,at._)`${w}[${h}] = ${m}`)})}function f(m,p){const h=(0,Jp.useFunc)(e,Qp.default),v=e.name("outer");e.label(v).for((0,at._)`;${m}--;`,()=>e.for((0,at._)`${p} = ${m}; ${p}--;`,()=>e.if((0,at._)`${h}(${r}[${m}], ${r}[${p}])`,()=>{t.error(),e.assign(l,!1).break(v)})))}}};hi.default=Gp;var mi={};Object.defineProperty(mi,"__esModule",{value:!0});const vi=ge,Yp=G,Xp=Na,em={keyword:"const",$data:!0,error:{message:"must be equal to constant",params:({schemaCode:t})=>(0,vi._)`{allowedValue: ${t}}`},code(t){const{gen:e,data:r,$data:s,schemaCode:a,schema:n}=t;s||n&&typeof n=="object"?t.fail$data((0,vi._)`!${(0,Yp.useFunc)(e,Xp.default)}(${r}, ${a})`):t.fail((0,vi._)`${n} !== ${r}`)}};mi.default=em;var gi={};Object.defineProperty(gi,"__esModule",{value:!0});const Aa=ge,tm=G,rm=Na,am={keyword:"enum",schemaType:"array",$data:!0,error:{message:"must be equal to one of the allowed values",params:({schemaCode:t})=>(0,Aa._)`{allowedValues: ${t}}`},code(t){const{gen:e,data:r,$data:s,schema:a,schemaCode:n,it:i}=t;if(!s&&a.length===0)throw new Error("enum must have non-empty array");const o=a.length>=i.opts.loopEnum;let l;const c=()=>l??(l=(0,tm.useFunc)(e,rm.default));let u;if(o||s)u=e.let("valid"),t.block$data(u,d);else{if(!Array.isArray(a))throw new Error("ajv implementation error");const f=e.const("vSchema",n);u=(0,Aa.or)(...a.map((m,p)=>g(f,p)))}t.pass(u);function d(){e.assign(u,!1),e.forOf("v",n,f=>e.if((0,Aa._)`${c()}(${r}, ${f})`,()=>e.assign(u,!0).break()))}function g(f,m){const p=a[m];return typeof p=="object"&&p!==null?(0,Aa._)`${c()}(${r}, ${f}[${m}])`:(0,Aa._)`${r} === ${p}`}}};gi.default=am,Object.defineProperty(si,"__esModule",{value:!0});const sm=ni,nm=ii,im=oi,om=li,cm=ui,lm=di,um=fi,dm=hi,fm=mi,hm=gi,pm=[sm.default,nm.default,im.default,om.default,cm.default,lm.default,um.default,dm.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},fm.default,hm.default];si.default=pm;var _i={},Yr={};Object.defineProperty(Yr,"__esModule",{value:!0}),Yr.validateAdditionalItems=void 0;const Ar=ge,yi=G,mm={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:{message:({params:{len:t}})=>(0,Ar.str)`must NOT have more than ${t} items`,params:({params:{len:t}})=>(0,Ar._)`{limit: ${t}}`},code(t){const{parentSchema:e,it:r}=t,{items:s}=e;if(!Array.isArray(s)){(0,yi.checkStrictMode)(r,'"additionalItems" is ignored when "items" is not an array of schemas');return}_l(t,s)}};function _l(t,e){const{gen:r,schema:s,data:a,keyword:n,it:i}=t;i.items=!0;const o=r.const("len",(0,Ar._)`${a}.length`);if(s===!1)t.setParams({len:e.length}),t.pass((0,Ar._)`${o} <= ${e.length}`);else if(typeof s=="object"&&!(0,yi.alwaysValidSchema)(i,s)){const c=r.var("valid",(0,Ar._)`${o} <= ${e.length}`);r.if((0,Ar.not)(c),()=>l(c)),t.ok(c)}function l(c){r.forRange("i",e.length,o,u=>{t.subschema({keyword:n,dataProp:u,dataPropType:yi.Type.Num},c),i.allErrors||r.if((0,Ar.not)(c),()=>r.break())})}}Yr.validateAdditionalItems=_l,Yr.default=mm;var wi={},Xr={};Object.defineProperty(Xr,"__esModule",{value:!0}),Xr.validateTuple=void 0;const yl=ge,Es=G,vm=_e,gm={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(t){const{schema:e,it:r}=t;if(Array.isArray(e))return wl(t,"additionalItems",e);r.items=!0,!(0,Es.alwaysValidSchema)(r,e)&&t.ok((0,vm.validateArray)(t))}};function wl(t,e,r=t.schema){const{gen:s,parentSchema:a,data:n,keyword:i,it:o}=t;u(a),o.opts.unevaluated&&r.length&&o.items!==!0&&(o.items=Es.mergeEvaluated.items(s,r.length,o.items));const l=s.name("valid"),c=s.const("len",(0,yl._)`${n}.length`);r.forEach((d,g)=>{(0,Es.alwaysValidSchema)(o,d)||(s.if((0,yl._)`${c} > ${g}`,()=>t.subschema({keyword:i,schemaProp:g,dataProp:g},l)),t.ok(l))});function u(d){const{opts:g,errSchemaPath:f}=o,m=r.length,p=m===d.minItems&&(m===d.maxItems||d[e]===!1);if(g.strictTuples&&!p){const h=`"${i}" is ${m}-tuple, but minItems or maxItems/${e} are not specified or different at path "${f}"`;(0,Es.checkStrictMode)(o,h,g.strictTuples)}}}Xr.validateTuple=wl,Xr.default=gm,Object.defineProperty(wi,"__esModule",{value:!0});const _m=Xr,ym={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:t=>(0,_m.validateTuple)(t,"items")};wi.default=ym;var bi={};Object.defineProperty(bi,"__esModule",{value:!0});const bl=ge,wm=G,bm=_e,$m=Yr,Pm={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:{message:({params:{len:t}})=>(0,bl.str)`must NOT have more than ${t} items`,params:({params:{len:t}})=>(0,bl._)`{limit: ${t}}`},code(t){const{schema:e,parentSchema:r,it:s}=t,{prefixItems:a}=r;s.items=!0,!(0,wm.alwaysValidSchema)(s,e)&&(a?(0,$m.validateAdditionalItems)(t,a):t.ok((0,bm.validateArray)(t)))}};bi.default=Pm;var $i={};Object.defineProperty($i,"__esModule",{value:!0});const bt=ge,Ss=G,Em={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:{message:({params:{min:t,max:e}})=>e===void 0?(0,bt.str)`must contain at least ${t} valid item(s)`:(0,bt.str)`must contain at least ${t} and no more than ${e} valid item(s)`,params:({params:{min:t,max:e}})=>e===void 0?(0,bt._)`{minContains: ${t}}`:(0,bt._)`{minContains: ${t}, maxContains: ${e}}`},code(t){const{gen:e,schema:r,parentSchema:s,data:a,it:n}=t;let i,o;const{minContains:l,maxContains:c}=s;n.opts.next?(i=l===void 0?1:l,o=c):i=1;const u=e.const("len",(0,bt._)`${a}.length`);if(t.setParams({min:i,max:o}),o===void 0&&i===0){(0,Ss.checkStrictMode)(n,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(o!==void 0&&i>o){(0,Ss.checkStrictMode)(n,'"minContains" > "maxContains" is always invalid'),t.fail();return}if((0,Ss.alwaysValidSchema)(n,r)){let p=(0,bt._)`${u} >= ${i}`;o!==void 0&&(p=(0,bt._)`${p} && ${u} <= ${o}`),t.pass(p);return}n.items=!0;const d=e.name("valid");o===void 0&&i===1?f(d,()=>e.if(d,()=>e.break())):i===0?(e.let(d,!0),o!==void 0&&e.if((0,bt._)`${a}.length > 0`,g)):(e.let(d,!1),g()),t.result(d,()=>t.reset());function g(){const p=e.name("_valid"),h=e.let("count",0);f(p,()=>e.if(p,()=>m(h)))}function f(p,h){e.forRange("i",0,u,v=>{t.subschema({keyword:"contains",dataProp:v,dataPropType:Ss.Type.Num,compositeRule:!0},p),h()})}function m(p){e.code((0,bt._)`${p}++`),o===void 0?e.if((0,bt._)`${p} >= ${i}`,()=>e.assign(d,!0).break()):(e.if((0,bt._)`${p} > ${o}`,()=>e.assign(d,!1).break()),i===1?e.assign(d,!0):e.if((0,bt._)`${p} >= ${i}`,()=>e.assign(d,!0)))}}};$i.default=Em;var $l={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.validateSchemaDeps=t.validatePropertyDeps=t.error=void 0;const e=ge,r=G,s=_e;t.error={message:({params:{property:l,depsCount:c,deps:u}})=>{const d=c===1?"property":"properties";return(0,e.str)`must have ${d} ${u} when property ${l} is present`},params:({params:{property:l,depsCount:c,deps:u,missingProperty:d}})=>(0,e._)`{property: ${l},
6
- missingProperty: ${d},
7
- depsCount: ${c},
8
- deps: ${u}}`};const a={keyword:"dependencies",type:"object",schemaType:"object",error:t.error,code(l){const[c,u]=n(l);i(l,c),o(l,u)}};function n({schema:l}){const c={},u={};for(const d in l){if(d==="__proto__")continue;const g=Array.isArray(l[d])?c:u;g[d]=l[d]}return[c,u]}function i(l,c=l.schema){const{gen:u,data:d,it:g}=l;if(Object.keys(c).length===0)return;const f=u.let("missing");for(const m in c){const p=c[m];if(p.length===0)continue;const h=(0,s.propertyInData)(u,d,m,g.opts.ownProperties);l.setParams({property:m,depsCount:p.length,deps:p.join(", ")}),g.allErrors?u.if(h,()=>{for(const v of p)(0,s.checkReportMissingProp)(l,v)}):(u.if((0,e._)`${h} && (${(0,s.checkMissingProp)(l,p,f)})`),(0,s.reportMissingProp)(l,f),u.else())}}t.validatePropertyDeps=i;function o(l,c=l.schema){const{gen:u,data:d,keyword:g,it:f}=l,m=u.name("valid");for(const p in c)(0,r.alwaysValidSchema)(f,c[p])||(u.if((0,s.propertyInData)(u,d,p,f.opts.ownProperties),()=>{const h=l.subschema({keyword:g,schemaProp:p},m);l.mergeValidEvaluated(h,m)},()=>u.var(m,!0)),l.ok(m))}t.validateSchemaDeps=o,t.default=a})($l);var Pi={};Object.defineProperty(Pi,"__esModule",{value:!0});const Pl=ge,Sm=G,Rm={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:{message:"property name must be valid",params:({params:t})=>(0,Pl._)`{propertyName: ${t.propertyName}}`},code(t){const{gen:e,schema:r,data:s,it:a}=t;if((0,Sm.alwaysValidSchema)(a,r))return;const n=e.name("valid");e.forIn("key",s,i=>{t.setParams({propertyName:i}),t.subschema({keyword:"propertyNames",data:i,dataTypes:["string"],propertyName:i,compositeRule:!0},n),e.if((0,Pl.not)(n),()=>{t.error(!0),a.allErrors||e.break()})}),t.ok(n)}};Pi.default=Rm;var Rs={};Object.defineProperty(Rs,"__esModule",{value:!0});const xs=_e,Ot=ge,xm=qt,ks=G,km={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:{message:"must NOT have additional properties",params:({params:t})=>(0,Ot._)`{additionalProperty: ${t.additionalProperty}}`},code(t){const{gen:e,schema:r,parentSchema:s,data:a,errsCount:n,it:i}=t;if(!n)throw new Error("ajv implementation error");const{allErrors:o,opts:l}=i;if(i.props=!0,l.removeAdditional!=="all"&&(0,ks.alwaysValidSchema)(i,r))return;const c=(0,xs.allSchemaProperties)(s.properties),u=(0,xs.allSchemaProperties)(s.patternProperties);d(),t.ok((0,Ot._)`${n} === ${xm.default.errors}`);function d(){e.forIn("key",a,h=>{!c.length&&!u.length?m(h):e.if(g(h),()=>m(h))})}function g(h){let v;if(c.length>8){const w=(0,ks.schemaRefOrVal)(i,s.properties,"properties");v=(0,xs.isOwnProperty)(e,w,h)}else c.length?v=(0,Ot.or)(...c.map(w=>(0,Ot._)`${h} === ${w}`)):v=Ot.nil;return u.length&&(v=(0,Ot.or)(v,...u.map(w=>(0,Ot._)`${(0,xs.usePattern)(t,w)}.test(${h})`))),(0,Ot.not)(v)}function f(h){e.code((0,Ot._)`delete ${a}[${h}]`)}function m(h){if(l.removeAdditional==="all"||l.removeAdditional&&r===!1){f(h);return}if(r===!1){t.setParams({additionalProperty:h}),t.error(),o||e.break();return}if(typeof r=="object"&&!(0,ks.alwaysValidSchema)(i,r)){const v=e.name("valid");l.removeAdditional==="failing"?(p(h,v,!1),e.if((0,Ot.not)(v),()=>{t.reset(),f(h)})):(p(h,v),o||e.if((0,Ot.not)(v),()=>e.break()))}}function p(h,v,w){const P={keyword:"additionalProperties",dataProp:h,dataPropType:ks.Type.Str};w===!1&&Object.assign(P,{compositeRule:!0,createErrors:!1,allErrors:!1}),t.subschema(P,v)}}};Rs.default=km;var Ei={};Object.defineProperty(Ei,"__esModule",{value:!0});const Im=kt,El=_e,Si=G,Sl=Rs,Tm={keyword:"properties",type:"object",schemaType:"object",code(t){const{gen:e,schema:r,parentSchema:s,data:a,it:n}=t;n.opts.removeAdditional==="all"&&s.additionalProperties===void 0&&Sl.default.code(new Im.KeywordCxt(n,Sl.default,"additionalProperties"));const i=(0,El.allSchemaProperties)(r);for(const d of i)n.definedProperties.add(d);n.opts.unevaluated&&i.length&&n.props!==!0&&(n.props=Si.mergeEvaluated.props(e,(0,Si.toHash)(i),n.props));const o=i.filter(d=>!(0,Si.alwaysValidSchema)(n,r[d]));if(o.length===0)return;const l=e.name("valid");for(const d of o)c(d)?u(d):(e.if((0,El.propertyInData)(e,a,d,n.opts.ownProperties)),u(d),n.allErrors||e.else().var(l,!0),e.endIf()),t.it.definedProperties.add(d),t.ok(l);function c(d){return n.opts.useDefaults&&!n.compositeRule&&r[d].default!==void 0}function u(d){t.subschema({keyword:"properties",schemaProp:d,dataProp:d},l)}}};Ei.default=Tm;var Ri={};Object.defineProperty(Ri,"__esModule",{value:!0});const Rl=_e,Is=ge,xl=G,kl=G,Om={keyword:"patternProperties",type:"object",schemaType:"object",code(t){const{gen:e,schema:r,data:s,parentSchema:a,it:n}=t,{opts:i}=n,o=(0,Rl.allSchemaProperties)(r),l=o.filter(p=>(0,xl.alwaysValidSchema)(n,r[p]));if(o.length===0||l.length===o.length&&(!n.opts.unevaluated||n.props===!0))return;const c=i.strictSchema&&!i.allowMatchingProperties&&a.properties,u=e.name("valid");n.props!==!0&&!(n.props instanceof Is.Name)&&(n.props=(0,kl.evaluatedPropsToName)(e,n.props));const{props:d}=n;g();function g(){for(const p of o)c&&f(p),n.allErrors?m(p):(e.var(u,!0),m(p),e.if(u))}function f(p){for(const h in c)new RegExp(p).test(h)&&(0,xl.checkStrictMode)(n,`property ${h} matches pattern ${p} (use allowMatchingProperties)`)}function m(p){e.forIn("key",s,h=>{e.if((0,Is._)`${(0,Rl.usePattern)(t,p)}.test(${h})`,()=>{const v=l.includes(p);v||t.subschema({keyword:"patternProperties",schemaProp:p,dataProp:h,dataPropType:kl.Type.Str},u),n.opts.unevaluated&&d!==!0?e.assign((0,Is._)`${d}[${h}]`,!0):!v&&!n.allErrors&&e.if((0,Is.not)(u),()=>e.break())})})}}};Ri.default=Om;var xi={};Object.defineProperty(xi,"__esModule",{value:!0});const Cm=G,Nm={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(t){const{gen:e,schema:r,it:s}=t;if((0,Cm.alwaysValidSchema)(s,r)){t.fail();return}const a=e.name("valid");t.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},a),t.failResult(a,()=>t.reset(),()=>t.error())},error:{message:"must NOT be valid"}};xi.default=Nm;var ki={};Object.defineProperty(ki,"__esModule",{value:!0});const Am={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:_e.validateUnion,error:{message:"must match a schema in anyOf"}};ki.default=Am;var Ii={};Object.defineProperty(Ii,"__esModule",{value:!0});const Ts=ge,jm=G,Dm={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:{message:"must match exactly one schema in oneOf",params:({params:t})=>(0,Ts._)`{passingSchemas: ${t.passing}}`},code(t){const{gen:e,schema:r,parentSchema:s,it:a}=t;if(!Array.isArray(r))throw new Error("ajv implementation error");if(a.opts.discriminator&&s.discriminator)return;const n=r,i=e.let("valid",!1),o=e.let("passing",null),l=e.name("_valid");t.setParams({passing:o}),e.block(c),t.result(i,()=>t.reset(),()=>t.error(!0));function c(){n.forEach((u,d)=>{let g;(0,jm.alwaysValidSchema)(a,u)?e.var(l,!0):g=t.subschema({keyword:"oneOf",schemaProp:d,compositeRule:!0},l),d>0&&e.if((0,Ts._)`${l} && ${i}`).assign(i,!1).assign(o,(0,Ts._)`[${o}, ${d}]`).else(),e.if(l,()=>{e.assign(i,!0),e.assign(o,d),g&&t.mergeEvaluated(g,Ts.Name)})})}}};Ii.default=Dm;var Ti={};Object.defineProperty(Ti,"__esModule",{value:!0});const Mm=G,Lm={keyword:"allOf",schemaType:"array",code(t){const{gen:e,schema:r,it:s}=t;if(!Array.isArray(r))throw new Error("ajv implementation error");const a=e.name("valid");r.forEach((n,i)=>{if((0,Mm.alwaysValidSchema)(s,n))return;const o=t.subschema({keyword:"allOf",schemaProp:i},a);t.ok(a),t.mergeEvaluated(o)})}};Ti.default=Lm;var Oi={};Object.defineProperty(Oi,"__esModule",{value:!0});const Os=ge,Il=G,Fm={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:{message:({params:t})=>(0,Os.str)`must match "${t.ifClause}" schema`,params:({params:t})=>(0,Os._)`{failingKeyword: ${t.ifClause}}`},code(t){const{gen:e,parentSchema:r,it:s}=t;r.then===void 0&&r.else===void 0&&(0,Il.checkStrictMode)(s,'"if" without "then" and "else" is ignored');const a=Tl(s,"then"),n=Tl(s,"else");if(!a&&!n)return;const i=e.let("valid",!0),o=e.name("_valid");if(l(),t.reset(),a&&n){const u=e.let("ifClause");t.setParams({ifClause:u}),e.if(o,c("then",u),c("else",u))}else a?e.if(o,c("then")):e.if((0,Os.not)(o),c("else"));t.pass(i,()=>t.error(!0));function l(){const u=t.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},o);t.mergeEvaluated(u)}function c(u,d){return()=>{const g=t.subschema({keyword:u},o);e.assign(i,o),t.mergeValidEvaluated(g,i),d?e.assign(d,(0,Os._)`${u}`):t.setParams({ifClause:u})}}}};function Tl(t,e){const r=t.schema[e];return r!==void 0&&!(0,Il.alwaysValidSchema)(t,r)}Oi.default=Fm;var Ci={};Object.defineProperty(Ci,"__esModule",{value:!0});const qm=G,Um={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:t,parentSchema:e,it:r}){e.if===void 0&&(0,qm.checkStrictMode)(r,`"${t}" without "if" is ignored`)}};Ci.default=Um,Object.defineProperty(_i,"__esModule",{value:!0});const Vm=Yr,zm=wi,Hm=Xr,Zm=bi,Km=$i,Bm=$l,Wm=Pi,Jm=Rs,Qm=Ei,Gm=Ri,Ym=xi,Xm=ki,ev=Ii,tv=Ti,rv=Oi,av=Ci;function sv(t=!1){const e=[Ym.default,Xm.default,ev.default,tv.default,rv.default,av.default,Wm.default,Jm.default,Bm.default,Qm.default,Gm.default];return t?e.push(zm.default,Zm.default):e.push(Vm.default,Hm.default),e.push(Km.default),e}_i.default=sv;var Ni={},Ai={};Object.defineProperty(Ai,"__esModule",{value:!0});const He=ge,nv={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:{message:({schemaCode:t})=>(0,He.str)`must match format "${t}"`,params:({schemaCode:t})=>(0,He._)`{format: ${t}}`},code(t,e){const{gen:r,data:s,$data:a,schema:n,schemaCode:i,it:o}=t,{opts:l,errSchemaPath:c,schemaEnv:u,self:d}=o;if(!l.validateFormats)return;a?g():f();function g(){const m=r.scopeValue("formats",{ref:d.formats,code:l.code.formats}),p=r.const("fDef",(0,He._)`${m}[${i}]`),h=r.let("fType"),v=r.let("format");r.if((0,He._)`typeof ${p} == "object" && !(${p} instanceof RegExp)`,()=>r.assign(h,(0,He._)`${p}.type || "string"`).assign(v,(0,He._)`${p}.validate`),()=>r.assign(h,(0,He._)`"string"`).assign(v,p)),t.fail$data((0,He.or)(w(),P()));function w(){return l.strictSchema===!1?He.nil:(0,He._)`${i} && !${v}`}function P(){const S=u.$async?(0,He._)`(${p}.async ? await ${v}(${s}) : ${v}(${s}))`:(0,He._)`${v}(${s})`,x=(0,He._)`(typeof ${v} == "function" ? ${S} : ${v}.test(${s}))`;return(0,He._)`${v} && ${v} !== true && ${h} === ${e} && !${x}`}}function f(){const m=d.formats[n];if(!m){w();return}if(m===!0)return;const[p,h,v]=P(m);p===e&&t.pass(S());function w(){if(l.strictSchema===!1){d.logger.warn(x());return}throw new Error(x());function x(){return`unknown format "${n}" ignored in schema at path "${c}"`}}function P(x){const A=x instanceof RegExp?(0,He.regexpCode)(x):l.code.formats?(0,He._)`${l.code.formats}${(0,He.getProperty)(n)}`:void 0,z=r.scopeValue("formats",{key:n,ref:x,code:A});return typeof x=="object"&&!(x instanceof RegExp)?[x.type||"string",x.validate,(0,He._)`${z}.validate`]:["string",x,z]}function S(){if(typeof m=="object"&&!(m instanceof RegExp)&&m.async){if(!u.$async)throw new Error("async format in sync schema");return(0,He._)`await ${v}(${s})`}return typeof h=="function"?(0,He._)`${v}(${s})`:(0,He._)`${v}.test(${s})`}}}};Ai.default=nv,Object.defineProperty(Ni,"__esModule",{value:!0});const iv=[Ai.default];Ni.default=iv;var ea={};Object.defineProperty(ea,"__esModule",{value:!0}),ea.contentVocabulary=ea.metadataVocabulary=void 0,ea.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"],ea.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"],Object.defineProperty(ti,"__esModule",{value:!0});const ov=ri,cv=si,lv=_i,uv=Ni,Ol=ea,dv=[ov.default,cv.default,(0,lv.default)(),uv.default,Ol.metadataVocabulary,Ol.contentVocabulary];ti.default=dv;var ji={},Cs={};Object.defineProperty(Cs,"__esModule",{value:!0}),Cs.DiscrError=void 0;var Cl;(function(t){t.Tag="tag",t.Mapping="mapping"})(Cl||(Cs.DiscrError=Cl={})),Object.defineProperty(ji,"__esModule",{value:!0});const ta=ge,Di=Cs,Nl=ht,fv=Qr,hv=G,pv={keyword:"discriminator",type:"object",schemaType:"object",error:{message:({params:{discrError:t,tagName:e}})=>t===Di.DiscrError.Tag?`tag "${e}" must be string`:`value of tag "${e}" must be in oneOf`,params:({params:{discrError:t,tag:e,tagName:r}})=>(0,ta._)`{error: ${t}, tag: ${r}, tagValue: ${e}}`},code(t){const{gen:e,data:r,schema:s,parentSchema:a,it:n}=t,{oneOf:i}=a;if(!n.opts.discriminator)throw new Error("discriminator: requires discriminator option");const o=s.propertyName;if(typeof o!="string")throw new Error("discriminator: requires propertyName");if(s.mapping)throw new Error("discriminator: mapping is not supported");if(!i)throw new Error("discriminator: requires oneOf keyword");const l=e.let("valid",!1),c=e.const("tag",(0,ta._)`${r}${(0,ta.getProperty)(o)}`);e.if((0,ta._)`typeof ${c} == "string"`,()=>u(),()=>t.error(!1,{discrError:Di.DiscrError.Tag,tag:c,tagName:o})),t.ok(l);function u(){const f=g();e.if(!1);for(const m in f)e.elseIf((0,ta._)`${c} === ${m}`),e.assign(l,d(f[m]));e.else(),t.error(!1,{discrError:Di.DiscrError.Mapping,tag:c,tagName:o}),e.endIf()}function d(f){const m=e.name("valid"),p=t.subschema({keyword:"oneOf",schemaProp:f},m);return t.mergeEvaluated(p,ta.Name),m}function g(){var f;const m={},p=v(a);let h=!0;for(let S=0;S<i.length;S++){let x=i[S];if(x!=null&&x.$ref&&!(0,hv.schemaHasRulesButRef)(x,n.self.RULES)){const z=x.$ref;if(x=Nl.resolveRef.call(n.self,n.schemaEnv.root,n.baseId,z),x instanceof Nl.SchemaEnv&&(x=x.schema),x===void 0)throw new fv.default(n.opts.uriResolver,n.baseId,z)}const A=(f=x==null?void 0:x.properties)===null||f===void 0?void 0:f[o];if(typeof A!="object")throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${o}"`);h=h&&(p||v(x)),w(A,S)}if(!h)throw new Error(`discriminator: "${o}" must be required`);return m;function v({required:S}){return Array.isArray(S)&&S.includes(o)}function w(S,x){if(S.const)P(S.const,x);else if(S.enum)for(const A of S.enum)P(A,x);else throw new Error(`discriminator: "properties/${o}" must have "const" or "enum"`)}function P(S,x){if(typeof S!="string"||S in m)throw new Error(`discriminator: "${o}" values must be unique strings`);m[S]=x}}}};ji.default=pv;const mv={$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=pc,s=ti,a=ji,n=mv,i=["/properties"],o="http://json-schema.org/draft-07/schema";class l extends r.default{_addVocabularies(){super._addVocabularies(),s.default.forEach(m=>this.addVocabulary(m)),this.opts.discriminator&&this.addKeyword(a.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;const m=this.opts.$data?this.$dataMetaSchema(n,i):n;this.addMetaSchema(m,o,!1),this.refs["http://json-schema.org/schema"]=o}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(o)?o:void 0)}}e.Ajv=l,t.exports=e=l,t.exports.Ajv=l,Object.defineProperty(e,"__esModule",{value:!0}),e.default=l;var c=kt;Object.defineProperty(e,"KeywordCxt",{enumerable:!0,get:function(){return c.KeywordCxt}});var u=ge;Object.defineProperty(e,"_",{enumerable:!0,get:function(){return u._}}),Object.defineProperty(e,"str",{enumerable:!0,get:function(){return u.str}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return u.stringify}}),Object.defineProperty(e,"nil",{enumerable:!0,get:function(){return u.nil}}),Object.defineProperty(e,"Name",{enumerable:!0,get:function(){return u.Name}}),Object.defineProperty(e,"CodeGen",{enumerable:!0,get:function(){return u.CodeGen}});var d=Ra;Object.defineProperty(e,"ValidationError",{enumerable:!0,get:function(){return d.default}});var g=Qr;Object.defineProperty(e,"MissingRefError",{enumerable:!0,get:function(){return g.default}})})(An,An.exports);var vv=An.exports;const gv=hc(vv);var Pe;(function(t){t.assertEqual=a=>{};function e(a){}t.assertIs=e;function r(a){throw new Error}t.assertNever=r,t.arrayToEnum=a=>{const n={};for(const i of a)n[i]=i;return n},t.getValidEnumValues=a=>{const n=t.objectKeys(a).filter(o=>typeof a[a[o]]!="number"),i={};for(const o of n)i[o]=a[o];return t.objectValues(i)},t.objectValues=a=>t.objectKeys(a).map(function(n){return a[n]}),t.objectKeys=typeof Object.keys=="function"?a=>Object.keys(a):a=>{const n=[];for(const i in a)Object.prototype.hasOwnProperty.call(a,i)&&n.push(i);return n},t.find=(a,n)=>{for(const i of a)if(n(i))return i},t.isInteger=typeof Number.isInteger=="function"?a=>Number.isInteger(a):a=>typeof a=="number"&&Number.isFinite(a)&&Math.floor(a)===a;function s(a,n=" | "){return a.map(i=>typeof i=="string"?`'${i}'`:i).join(n)}t.joinValues=s,t.jsonStringifyReplacer=(a,n)=>typeof n=="bigint"?n.toString():n})(Pe||(Pe={}));var Mi;(function(t){t.mergeShapes=(e,r)=>({...e,...r})})(Mi||(Mi={}));const Y=Pe.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),nr=t=>{switch(typeof t){case"undefined":return Y.undefined;case"string":return Y.string;case"number":return Number.isNaN(t)?Y.nan:Y.number;case"boolean":return Y.boolean;case"function":return Y.function;case"bigint":return Y.bigint;case"symbol":return Y.symbol;case"object":return Array.isArray(t)?Y.array:t===null?Y.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?Y.promise:typeof Map<"u"&&t instanceof Map?Y.map:typeof Set<"u"&&t instanceof Set?Y.set:typeof Date<"u"&&t instanceof Date?Y.date:Y.object;default:return Y.unknown}},q=Pe.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"]),_v=t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:");class yt extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=s=>{this.issues=[...this.issues,s]},this.addIssues=(s=[])=>{this.issues=[...this.issues,...s]};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(n){return n.message},s={_errors:[]},a=n=>{for(const i of n.issues)if(i.code==="invalid_union")i.unionErrors.map(a);else if(i.code==="invalid_return_type")a(i.returnTypeError);else if(i.code==="invalid_arguments")a(i.argumentsError);else if(i.path.length===0)s._errors.push(r(i));else{let o=s,l=0;for(;l<i.path.length;){const c=i.path[l];l===i.path.length-1?(o[c]=o[c]||{_errors:[]},o[c]._errors.push(r(i))):o[c]=o[c]||{_errors:[]},o=o[c],l++}}};return a(this),s}static assert(e){if(!(e instanceof yt))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Pe.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=r=>r.message){const r={},s=[];for(const a of this.issues)if(a.path.length>0){const n=a.path[0];r[n]=r[n]||[],r[n].push(e(a))}else s.push(e(a));return{formErrors:s,fieldErrors:r}}get formErrors(){return this.flatten()}}yt.create=t=>new yt(t);const ra=(t,e)=>{let r;switch(t.code){case q.invalid_type:t.received===Y.undefined?r="Required":r=`Expected ${t.expected}, received ${t.received}`;break;case q.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(t.expected,Pe.jsonStringifyReplacer)}`;break;case q.unrecognized_keys:r=`Unrecognized key(s) in object: ${Pe.joinValues(t.keys,", ")}`;break;case q.invalid_union:r="Invalid input";break;case q.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${Pe.joinValues(t.options)}`;break;case q.invalid_enum_value:r=`Invalid enum value. Expected ${Pe.joinValues(t.options)}, received '${t.received}'`;break;case q.invalid_arguments:r="Invalid function arguments";break;case q.invalid_return_type:r="Invalid function return type";break;case q.invalid_date:r="Invalid date";break;case q.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}"`:Pe.assertNever(t.validation):t.validation!=="regex"?r=`Invalid ${t.validation}`:r="Invalid";break;case q.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 q.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 q.custom:r="Invalid input";break;case q.invalid_intersection_types:r="Intersection results could not be merged";break;case q.not_multiple_of:r=`Number must be a multiple of ${t.multipleOf}`;break;case q.not_finite:r="Number must be finite";break;default:r=e.defaultError,Pe.assertNever(t)}return{message:r}};let Al=ra;function yv(t){Al=t}function Ns(){return Al}const As=t=>{const{data:e,path:r,errorMaps:s,issueData:a}=t,n=[...r,...a.path||[]],i={...a,path:n};if(a.message!==void 0)return{...a,path:n,message:a.message};let o="";const l=s.filter(c=>!!c).slice().reverse();for(const c of l)o=c(i,{data:e,defaultError:o}).message;return{...a,path:n,message:o}},wv=[];function B(t,e){const r=Ns(),s=As({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,r,r===ra?void 0:ra].filter(a=>!!a)});t.common.issues.push(s)}class ot{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,r){const s=[];for(const a of r){if(a.status==="aborted")return ie;a.status==="dirty"&&e.dirty(),s.push(a.value)}return{status:e.value,value:s}}static async mergeObjectAsync(e,r){const s=[];for(const a of r){const n=await a.key,i=await a.value;s.push({key:n,value:i})}return ot.mergeObjectSync(e,s)}static mergeObjectSync(e,r){const s={};for(const a of r){const{key:n,value:i}=a;if(n.status==="aborted"||i.status==="aborted")return ie;n.status==="dirty"&&e.dirty(),i.status==="dirty"&&e.dirty(),n.value!=="__proto__"&&(typeof i.value<"u"||a.alwaysSet)&&(s[n.value]=i.value)}return{status:e.value,value:s}}}const ie=Object.freeze({status:"aborted"}),aa=t=>({status:"dirty",value:t}),dt=t=>({status:"valid",value:t}),Li=t=>t.status==="aborted",Fi=t=>t.status==="dirty",jr=t=>t.status==="valid",ja=t=>typeof Promise<"u"&&t instanceof Promise;var ee;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(ee||(ee={}));class Ht{constructor(e,r,s,a){this._cachedPath=[],this.parent=e,this.data=r,this._path=s,this._key=a}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 jl=(t,e)=>{if(jr(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 yt(t.common.issues);return this._error=r,this._error}}};function ue(t){if(!t)return{};const{errorMap:e,invalid_type_error:r,required_error:s,description:a}=t;if(e&&(r||s))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:a}:{errorMap:(i,o)=>{const{message:l}=t;return i.code==="invalid_enum_value"?{message:l??o.defaultError}:typeof o.data>"u"?{message:l??s??o.defaultError}:i.code!=="invalid_type"?{message:o.defaultError}:{message:l??r??o.defaultError}},description:a}}class me{get description(){return this._def.description}_getType(e){return nr(e.data)}_getOrReturnCtx(e,r){return r||{common:e.parent.common,data:e.data,parsedType:nr(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new ot,ctx:{common:e.parent.common,data:e.data,parsedType:nr(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const r=this._parse(e);if(ja(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 s=this.safeParse(e,r);if(s.success)return s.data;throw s.error}safeParse(e,r){const s={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:nr(e)},a=this._parseSync({data:e,path:s.path,parent:s});return jl(s,a)}"~validate"(e){var s,a;const r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:nr(e)};if(!this["~standard"].async)try{const n=this._parseSync({data:e,path:[],parent:r});return jr(n)?{value:n.value}:{issues:r.common.issues}}catch(n){(a=(s=n==null?void 0:n.message)==null?void 0:s.toLowerCase())!=null&&a.includes("encountered")&&(this["~standard"].async=!0),r.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:r}).then(n=>jr(n)?{value:n.value}:{issues:r.common.issues})}async parseAsync(e,r){const s=await this.safeParseAsync(e,r);if(s.success)return s.data;throw s.error}async safeParseAsync(e,r){const s={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:nr(e)},a=this._parse({data:e,path:s.path,parent:s}),n=await(ja(a)?a:Promise.resolve(a));return jl(s,n)}refine(e,r){const s=a=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(a):r;return this._refinement((a,n)=>{const i=e(a),o=()=>n.addIssue({code:q.custom,...s(a)});return typeof Promise<"u"&&i instanceof Promise?i.then(l=>l?!0:(o(),!1)):i?!0:(o(),!1)})}refinement(e,r){return this._refinement((s,a)=>e(s)?!0:(a.addIssue(typeof r=="function"?r(s,a):r),!1))}_refinement(e){return new At({schema:this,typeName:V.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 Kt.create(this,this._def)}nullable(){return wr.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Nt.create(this)}promise(){return oa.create(this,this._def)}or(e){return Fa.create([this,e],this._def)}and(e){return qa.create(this,e,this._def)}transform(e){return new At({...ue(this._def),schema:this,typeName:V.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const r=typeof e=="function"?e:()=>e;return new Za({...ue(this._def),innerType:this,defaultValue:r,typeName:V.ZodDefault})}brand(){return new Vi({typeName:V.ZodBranded,type:this,...ue(this._def)})}catch(e){const r=typeof e=="function"?e:()=>e;return new Ka({...ue(this._def),innerType:this,catchValue:r,typeName:V.ZodCatch})}describe(e){const r=this.constructor;return new r({...this._def,description:e})}pipe(e){return Ba.create(this,e)}readonly(){return Wa.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const bv=/^c[^\s-]{8,}$/i,$v=/^[0-9a-z]+$/,Pv=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Ev=/^[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,Sv=/^[a-z0-9_-]{21}$/i,Rv=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,xv=/^[-+]?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)?)??$/,kv=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Iv="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let qi;const Tv=/^(?:(?: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])$/,Ov=/^(?:(?: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])$/,Cv=/^(([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]))$/,Nv=/^(([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])$/,Av=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,jv=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Dl="((\\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])))",Dv=new RegExp(`^${Dl}$`);function Ml(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 Mv(t){return new RegExp(`^${Ml(t)}$`)}function Ll(t){let e=`${Dl}T${Ml(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 Lv(t,e){return!!((e==="v4"||!e)&&Tv.test(t)||(e==="v6"||!e)&&Cv.test(t))}function Fv(t,e){if(!Rv.test(t))return!1;try{const[r]=t.split(".");if(!r)return!1;const s=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),a=JSON.parse(atob(s));return!(typeof a!="object"||a===null||"typ"in a&&(a==null?void 0:a.typ)!=="JWT"||!a.alg||e&&a.alg!==e)}catch{return!1}}function qv(t,e){return!!((e==="v4"||!e)&&Ov.test(t)||(e==="v6"||!e)&&Nv.test(t))}class Ct extends me{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==Y.string){const n=this._getOrReturnCtx(e);return B(n,{code:q.invalid_type,expected:Y.string,received:n.parsedType}),ie}const s=new ot;let a;for(const n of this._def.checks)if(n.kind==="min")e.data.length<n.value&&(a=this._getOrReturnCtx(e,a),B(a,{code:q.too_small,minimum:n.value,type:"string",inclusive:!0,exact:!1,message:n.message}),s.dirty());else if(n.kind==="max")e.data.length>n.value&&(a=this._getOrReturnCtx(e,a),B(a,{code:q.too_big,maximum:n.value,type:"string",inclusive:!0,exact:!1,message:n.message}),s.dirty());else if(n.kind==="length"){const i=e.data.length>n.value,o=e.data.length<n.value;(i||o)&&(a=this._getOrReturnCtx(e,a),i?B(a,{code:q.too_big,maximum:n.value,type:"string",inclusive:!0,exact:!0,message:n.message}):o&&B(a,{code:q.too_small,minimum:n.value,type:"string",inclusive:!0,exact:!0,message:n.message}),s.dirty())}else if(n.kind==="email")kv.test(e.data)||(a=this._getOrReturnCtx(e,a),B(a,{validation:"email",code:q.invalid_string,message:n.message}),s.dirty());else if(n.kind==="emoji")qi||(qi=new RegExp(Iv,"u")),qi.test(e.data)||(a=this._getOrReturnCtx(e,a),B(a,{validation:"emoji",code:q.invalid_string,message:n.message}),s.dirty());else if(n.kind==="uuid")Ev.test(e.data)||(a=this._getOrReturnCtx(e,a),B(a,{validation:"uuid",code:q.invalid_string,message:n.message}),s.dirty());else if(n.kind==="nanoid")Sv.test(e.data)||(a=this._getOrReturnCtx(e,a),B(a,{validation:"nanoid",code:q.invalid_string,message:n.message}),s.dirty());else if(n.kind==="cuid")bv.test(e.data)||(a=this._getOrReturnCtx(e,a),B(a,{validation:"cuid",code:q.invalid_string,message:n.message}),s.dirty());else if(n.kind==="cuid2")$v.test(e.data)||(a=this._getOrReturnCtx(e,a),B(a,{validation:"cuid2",code:q.invalid_string,message:n.message}),s.dirty());else if(n.kind==="ulid")Pv.test(e.data)||(a=this._getOrReturnCtx(e,a),B(a,{validation:"ulid",code:q.invalid_string,message:n.message}),s.dirty());else if(n.kind==="url")try{new URL(e.data)}catch{a=this._getOrReturnCtx(e,a),B(a,{validation:"url",code:q.invalid_string,message:n.message}),s.dirty()}else n.kind==="regex"?(n.regex.lastIndex=0,n.regex.test(e.data)||(a=this._getOrReturnCtx(e,a),B(a,{validation:"regex",code:q.invalid_string,message:n.message}),s.dirty())):n.kind==="trim"?e.data=e.data.trim():n.kind==="includes"?e.data.includes(n.value,n.position)||(a=this._getOrReturnCtx(e,a),B(a,{code:q.invalid_string,validation:{includes:n.value,position:n.position},message:n.message}),s.dirty()):n.kind==="toLowerCase"?e.data=e.data.toLowerCase():n.kind==="toUpperCase"?e.data=e.data.toUpperCase():n.kind==="startsWith"?e.data.startsWith(n.value)||(a=this._getOrReturnCtx(e,a),B(a,{code:q.invalid_string,validation:{startsWith:n.value},message:n.message}),s.dirty()):n.kind==="endsWith"?e.data.endsWith(n.value)||(a=this._getOrReturnCtx(e,a),B(a,{code:q.invalid_string,validation:{endsWith:n.value},message:n.message}),s.dirty()):n.kind==="datetime"?Ll(n).test(e.data)||(a=this._getOrReturnCtx(e,a),B(a,{code:q.invalid_string,validation:"datetime",message:n.message}),s.dirty()):n.kind==="date"?Dv.test(e.data)||(a=this._getOrReturnCtx(e,a),B(a,{code:q.invalid_string,validation:"date",message:n.message}),s.dirty()):n.kind==="time"?Mv(n).test(e.data)||(a=this._getOrReturnCtx(e,a),B(a,{code:q.invalid_string,validation:"time",message:n.message}),s.dirty()):n.kind==="duration"?xv.test(e.data)||(a=this._getOrReturnCtx(e,a),B(a,{validation:"duration",code:q.invalid_string,message:n.message}),s.dirty()):n.kind==="ip"?Lv(e.data,n.version)||(a=this._getOrReturnCtx(e,a),B(a,{validation:"ip",code:q.invalid_string,message:n.message}),s.dirty()):n.kind==="jwt"?Fv(e.data,n.alg)||(a=this._getOrReturnCtx(e,a),B(a,{validation:"jwt",code:q.invalid_string,message:n.message}),s.dirty()):n.kind==="cidr"?qv(e.data,n.version)||(a=this._getOrReturnCtx(e,a),B(a,{validation:"cidr",code:q.invalid_string,message:n.message}),s.dirty()):n.kind==="base64"?Av.test(e.data)||(a=this._getOrReturnCtx(e,a),B(a,{validation:"base64",code:q.invalid_string,message:n.message}),s.dirty()):n.kind==="base64url"?jv.test(e.data)||(a=this._getOrReturnCtx(e,a),B(a,{validation:"base64url",code:q.invalid_string,message:n.message}),s.dirty()):Pe.assertNever(n);return{status:s.value,value:e.data}}_regex(e,r,s){return this.refinement(a=>e.test(a),{validation:r,code:q.invalid_string,...ee.errToObj(s)})}_addCheck(e){return new Ct({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...ee.errToObj(e)})}url(e){return this._addCheck({kind:"url",...ee.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...ee.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...ee.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...ee.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...ee.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...ee.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...ee.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...ee.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...ee.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...ee.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...ee.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...ee.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,...ee.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,...ee.errToObj(e==null?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...ee.errToObj(e)})}regex(e,r){return this._addCheck({kind:"regex",regex:e,...ee.errToObj(r)})}includes(e,r){return this._addCheck({kind:"includes",value:e,position:r==null?void 0:r.position,...ee.errToObj(r==null?void 0:r.message)})}startsWith(e,r){return this._addCheck({kind:"startsWith",value:e,...ee.errToObj(r)})}endsWith(e,r){return this._addCheck({kind:"endsWith",value:e,...ee.errToObj(r)})}min(e,r){return this._addCheck({kind:"min",value:e,...ee.errToObj(r)})}max(e,r){return this._addCheck({kind:"max",value:e,...ee.errToObj(r)})}length(e,r){return this._addCheck({kind:"length",value:e,...ee.errToObj(r)})}nonempty(e){return this.min(1,ee.errToObj(e))}trim(){return new Ct({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new Ct({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new Ct({...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}}Ct.create=t=>new Ct({checks:[],typeName:V.ZodString,coerce:(t==null?void 0:t.coerce)??!1,...ue(t)});function Uv(t,e){const r=(t.toString().split(".")[1]||"").length,s=(e.toString().split(".")[1]||"").length,a=r>s?r:s,n=Number.parseInt(t.toFixed(a).replace(".","")),i=Number.parseInt(e.toFixed(a).replace(".",""));return n%i/10**a}class gr extends me{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)!==Y.number){const n=this._getOrReturnCtx(e);return B(n,{code:q.invalid_type,expected:Y.number,received:n.parsedType}),ie}let s;const a=new ot;for(const n of this._def.checks)n.kind==="int"?Pe.isInteger(e.data)||(s=this._getOrReturnCtx(e,s),B(s,{code:q.invalid_type,expected:"integer",received:"float",message:n.message}),a.dirty()):n.kind==="min"?(n.inclusive?e.data<n.value:e.data<=n.value)&&(s=this._getOrReturnCtx(e,s),B(s,{code:q.too_small,minimum:n.value,type:"number",inclusive:n.inclusive,exact:!1,message:n.message}),a.dirty()):n.kind==="max"?(n.inclusive?e.data>n.value:e.data>=n.value)&&(s=this._getOrReturnCtx(e,s),B(s,{code:q.too_big,maximum:n.value,type:"number",inclusive:n.inclusive,exact:!1,message:n.message}),a.dirty()):n.kind==="multipleOf"?Uv(e.data,n.value)!==0&&(s=this._getOrReturnCtx(e,s),B(s,{code:q.not_multiple_of,multipleOf:n.value,message:n.message}),a.dirty()):n.kind==="finite"?Number.isFinite(e.data)||(s=this._getOrReturnCtx(e,s),B(s,{code:q.not_finite,message:n.message}),a.dirty()):Pe.assertNever(n);return{status:a.value,value:e.data}}gte(e,r){return this.setLimit("min",e,!0,ee.toString(r))}gt(e,r){return this.setLimit("min",e,!1,ee.toString(r))}lte(e,r){return this.setLimit("max",e,!0,ee.toString(r))}lt(e,r){return this.setLimit("max",e,!1,ee.toString(r))}setLimit(e,r,s,a){return new gr({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:s,message:ee.toString(a)}]})}_addCheck(e){return new gr({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:ee.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:ee.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:ee.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:ee.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:ee.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:ee.toString(r)})}finite(e){return this._addCheck({kind:"finite",message:ee.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:ee.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:ee.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"&&Pe.isInteger(e.value))}get isFinite(){let e=null,r=null;for(const s of this._def.checks){if(s.kind==="finite"||s.kind==="int"||s.kind==="multipleOf")return!0;s.kind==="min"?(r===null||s.value>r)&&(r=s.value):s.kind==="max"&&(e===null||s.value<e)&&(e=s.value)}return Number.isFinite(r)&&Number.isFinite(e)}}gr.create=t=>new gr({checks:[],typeName:V.ZodNumber,coerce:(t==null?void 0:t.coerce)||!1,...ue(t)});class _r extends me{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)!==Y.bigint)return this._getInvalidInput(e);let s;const a=new ot;for(const n of this._def.checks)n.kind==="min"?(n.inclusive?e.data<n.value:e.data<=n.value)&&(s=this._getOrReturnCtx(e,s),B(s,{code:q.too_small,type:"bigint",minimum:n.value,inclusive:n.inclusive,message:n.message}),a.dirty()):n.kind==="max"?(n.inclusive?e.data>n.value:e.data>=n.value)&&(s=this._getOrReturnCtx(e,s),B(s,{code:q.too_big,type:"bigint",maximum:n.value,inclusive:n.inclusive,message:n.message}),a.dirty()):n.kind==="multipleOf"?e.data%n.value!==BigInt(0)&&(s=this._getOrReturnCtx(e,s),B(s,{code:q.not_multiple_of,multipleOf:n.value,message:n.message}),a.dirty()):Pe.assertNever(n);return{status:a.value,value:e.data}}_getInvalidInput(e){const r=this._getOrReturnCtx(e);return B(r,{code:q.invalid_type,expected:Y.bigint,received:r.parsedType}),ie}gte(e,r){return this.setLimit("min",e,!0,ee.toString(r))}gt(e,r){return this.setLimit("min",e,!1,ee.toString(r))}lte(e,r){return this.setLimit("max",e,!0,ee.toString(r))}lt(e,r){return this.setLimit("max",e,!1,ee.toString(r))}setLimit(e,r,s,a){return new _r({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:s,message:ee.toString(a)}]})}_addCheck(e){return new _r({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:ee.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:ee.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:ee.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:ee.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:ee.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}}_r.create=t=>new _r({checks:[],typeName:V.ZodBigInt,coerce:(t==null?void 0:t.coerce)??!1,...ue(t)});class Da extends me{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==Y.boolean){const s=this._getOrReturnCtx(e);return B(s,{code:q.invalid_type,expected:Y.boolean,received:s.parsedType}),ie}return dt(e.data)}}Da.create=t=>new Da({typeName:V.ZodBoolean,coerce:(t==null?void 0:t.coerce)||!1,...ue(t)});class Dr extends me{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==Y.date){const n=this._getOrReturnCtx(e);return B(n,{code:q.invalid_type,expected:Y.date,received:n.parsedType}),ie}if(Number.isNaN(e.data.getTime())){const n=this._getOrReturnCtx(e);return B(n,{code:q.invalid_date}),ie}const s=new ot;let a;for(const n of this._def.checks)n.kind==="min"?e.data.getTime()<n.value&&(a=this._getOrReturnCtx(e,a),B(a,{code:q.too_small,message:n.message,inclusive:!0,exact:!1,minimum:n.value,type:"date"}),s.dirty()):n.kind==="max"?e.data.getTime()>n.value&&(a=this._getOrReturnCtx(e,a),B(a,{code:q.too_big,message:n.message,inclusive:!0,exact:!1,maximum:n.value,type:"date"}),s.dirty()):Pe.assertNever(n);return{status:s.value,value:new Date(e.data.getTime())}}_addCheck(e){return new Dr({...this._def,checks:[...this._def.checks,e]})}min(e,r){return this._addCheck({kind:"min",value:e.getTime(),message:ee.toString(r)})}max(e,r){return this._addCheck({kind:"max",value:e.getTime(),message:ee.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}}Dr.create=t=>new Dr({checks:[],coerce:(t==null?void 0:t.coerce)||!1,typeName:V.ZodDate,...ue(t)});class js extends me{_parse(e){if(this._getType(e)!==Y.symbol){const s=this._getOrReturnCtx(e);return B(s,{code:q.invalid_type,expected:Y.symbol,received:s.parsedType}),ie}return dt(e.data)}}js.create=t=>new js({typeName:V.ZodSymbol,...ue(t)});class Ma extends me{_parse(e){if(this._getType(e)!==Y.undefined){const s=this._getOrReturnCtx(e);return B(s,{code:q.invalid_type,expected:Y.undefined,received:s.parsedType}),ie}return dt(e.data)}}Ma.create=t=>new Ma({typeName:V.ZodUndefined,...ue(t)});class La extends me{_parse(e){if(this._getType(e)!==Y.null){const s=this._getOrReturnCtx(e);return B(s,{code:q.invalid_type,expected:Y.null,received:s.parsedType}),ie}return dt(e.data)}}La.create=t=>new La({typeName:V.ZodNull,...ue(t)});class sa extends me{constructor(){super(...arguments),this._any=!0}_parse(e){return dt(e.data)}}sa.create=t=>new sa({typeName:V.ZodAny,...ue(t)});class Mr extends me{constructor(){super(...arguments),this._unknown=!0}_parse(e){return dt(e.data)}}Mr.create=t=>new Mr({typeName:V.ZodUnknown,...ue(t)});class ir extends me{_parse(e){const r=this._getOrReturnCtx(e);return B(r,{code:q.invalid_type,expected:Y.never,received:r.parsedType}),ie}}ir.create=t=>new ir({typeName:V.ZodNever,...ue(t)});class Ds extends me{_parse(e){if(this._getType(e)!==Y.undefined){const s=this._getOrReturnCtx(e);return B(s,{code:q.invalid_type,expected:Y.void,received:s.parsedType}),ie}return dt(e.data)}}Ds.create=t=>new Ds({typeName:V.ZodVoid,...ue(t)});class Nt extends me{_parse(e){const{ctx:r,status:s}=this._processInputParams(e),a=this._def;if(r.parsedType!==Y.array)return B(r,{code:q.invalid_type,expected:Y.array,received:r.parsedType}),ie;if(a.exactLength!==null){const i=r.data.length>a.exactLength.value,o=r.data.length<a.exactLength.value;(i||o)&&(B(r,{code:i?q.too_big:q.too_small,minimum:o?a.exactLength.value:void 0,maximum:i?a.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:a.exactLength.message}),s.dirty())}if(a.minLength!==null&&r.data.length<a.minLength.value&&(B(r,{code:q.too_small,minimum:a.minLength.value,type:"array",inclusive:!0,exact:!1,message:a.minLength.message}),s.dirty()),a.maxLength!==null&&r.data.length>a.maxLength.value&&(B(r,{code:q.too_big,maximum:a.maxLength.value,type:"array",inclusive:!0,exact:!1,message:a.maxLength.message}),s.dirty()),r.common.async)return Promise.all([...r.data].map((i,o)=>a.type._parseAsync(new Ht(r,i,r.path,o)))).then(i=>ot.mergeArray(s,i));const n=[...r.data].map((i,o)=>a.type._parseSync(new Ht(r,i,r.path,o)));return ot.mergeArray(s,n)}get element(){return this._def.type}min(e,r){return new Nt({...this._def,minLength:{value:e,message:ee.toString(r)}})}max(e,r){return new Nt({...this._def,maxLength:{value:e,message:ee.toString(r)}})}length(e,r){return new Nt({...this._def,exactLength:{value:e,message:ee.toString(r)}})}nonempty(e){return this.min(1,e)}}Nt.create=(t,e)=>new Nt({type:t,minLength:null,maxLength:null,exactLength:null,typeName:V.ZodArray,...ue(e)});function na(t){if(t instanceof Fe){const e={};for(const r in t.shape){const s=t.shape[r];e[r]=Kt.create(na(s))}return new Fe({...t._def,shape:()=>e})}else return t instanceof Nt?new Nt({...t._def,type:na(t.element)}):t instanceof Kt?Kt.create(na(t.unwrap())):t instanceof wr?wr.create(na(t.unwrap())):t instanceof Zt?Zt.create(t.items.map(e=>na(e))):t}class Fe extends me{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=Pe.objectKeys(e);return this._cached={shape:e,keys:r},this._cached}_parse(e){if(this._getType(e)!==Y.object){const c=this._getOrReturnCtx(e);return B(c,{code:q.invalid_type,expected:Y.object,received:c.parsedType}),ie}const{status:s,ctx:a}=this._processInputParams(e),{shape:n,keys:i}=this._getCached(),o=[];if(!(this._def.catchall instanceof ir&&this._def.unknownKeys==="strip"))for(const c in a.data)i.includes(c)||o.push(c);const l=[];for(const c of i){const u=n[c],d=a.data[c];l.push({key:{status:"valid",value:c},value:u._parse(new Ht(a,d,a.path,c)),alwaysSet:c in a.data})}if(this._def.catchall instanceof ir){const c=this._def.unknownKeys;if(c==="passthrough")for(const u of o)l.push({key:{status:"valid",value:u},value:{status:"valid",value:a.data[u]}});else if(c==="strict")o.length>0&&(B(a,{code:q.unrecognized_keys,keys:o}),s.dirty());else if(c!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const c=this._def.catchall;for(const u of o){const d=a.data[u];l.push({key:{status:"valid",value:u},value:c._parse(new Ht(a,d,a.path,u)),alwaysSet:u in a.data})}}return a.common.async?Promise.resolve().then(async()=>{const c=[];for(const u of l){const d=await u.key,g=await u.value;c.push({key:d,value:g,alwaysSet:u.alwaysSet})}return c}).then(c=>ot.mergeObjectSync(s,c)):ot.mergeObjectSync(s,l)}get shape(){return this._def.shape()}strict(e){return ee.errToObj,new Fe({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(r,s)=>{var n,i;const a=((i=(n=this._def).errorMap)==null?void 0:i.call(n,r,s).message)??s.defaultError;return r.code==="unrecognized_keys"?{message:ee.errToObj(e).message??a}:{message:a}}}:{}})}strip(){return new Fe({...this._def,unknownKeys:"strip"})}passthrough(){return new Fe({...this._def,unknownKeys:"passthrough"})}extend(e){return new Fe({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new Fe({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:V.ZodObject})}setKey(e,r){return this.augment({[e]:r})}catchall(e){return new Fe({...this._def,catchall:e})}pick(e){const r={};for(const s of Pe.objectKeys(e))e[s]&&this.shape[s]&&(r[s]=this.shape[s]);return new Fe({...this._def,shape:()=>r})}omit(e){const r={};for(const s of Pe.objectKeys(this.shape))e[s]||(r[s]=this.shape[s]);return new Fe({...this._def,shape:()=>r})}deepPartial(){return na(this)}partial(e){const r={};for(const s of Pe.objectKeys(this.shape)){const a=this.shape[s];e&&!e[s]?r[s]=a:r[s]=a.optional()}return new Fe({...this._def,shape:()=>r})}required(e){const r={};for(const s of Pe.objectKeys(this.shape))if(e&&!e[s])r[s]=this.shape[s];else{let n=this.shape[s];for(;n instanceof Kt;)n=n._def.innerType;r[s]=n}return new Fe({...this._def,shape:()=>r})}keyof(){return Fl(Pe.objectKeys(this.shape))}}Fe.create=(t,e)=>new Fe({shape:()=>t,unknownKeys:"strip",catchall:ir.create(),typeName:V.ZodObject,...ue(e)}),Fe.strictCreate=(t,e)=>new Fe({shape:()=>t,unknownKeys:"strict",catchall:ir.create(),typeName:V.ZodObject,...ue(e)}),Fe.lazycreate=(t,e)=>new Fe({shape:t,unknownKeys:"strip",catchall:ir.create(),typeName:V.ZodObject,...ue(e)});class Fa extends me{_parse(e){const{ctx:r}=this._processInputParams(e),s=this._def.options;function a(n){for(const o of n)if(o.result.status==="valid")return o.result;for(const o of n)if(o.result.status==="dirty")return r.common.issues.push(...o.ctx.common.issues),o.result;const i=n.map(o=>new yt(o.ctx.common.issues));return B(r,{code:q.invalid_union,unionErrors:i}),ie}if(r.common.async)return Promise.all(s.map(async n=>{const i={...r,common:{...r.common,issues:[]},parent:null};return{result:await n._parseAsync({data:r.data,path:r.path,parent:i}),ctx:i}})).then(a);{let n;const i=[];for(const l of s){const c={...r,common:{...r.common,issues:[]},parent:null},u=l._parseSync({data:r.data,path:r.path,parent:c});if(u.status==="valid")return u;u.status==="dirty"&&!n&&(n={result:u,ctx:c}),c.common.issues.length&&i.push(c.common.issues)}if(n)return r.common.issues.push(...n.ctx.common.issues),n.result;const o=i.map(l=>new yt(l));return B(r,{code:q.invalid_union,unionErrors:o}),ie}}get options(){return this._def.options}}Fa.create=(t,e)=>new Fa({options:t,typeName:V.ZodUnion,...ue(e)});const or=t=>t instanceof Va?or(t.schema):t instanceof At?or(t.innerType()):t instanceof za?[t.value]:t instanceof yr?t.options:t instanceof Ha?Pe.objectValues(t.enum):t instanceof Za?or(t._def.innerType):t instanceof Ma?[void 0]:t instanceof La?[null]:t instanceof Kt?[void 0,...or(t.unwrap())]:t instanceof wr?[null,...or(t.unwrap())]:t instanceof Vi||t instanceof Wa?or(t.unwrap()):t instanceof Ka?or(t._def.innerType):[];class Ms extends me{_parse(e){const{ctx:r}=this._processInputParams(e);if(r.parsedType!==Y.object)return B(r,{code:q.invalid_type,expected:Y.object,received:r.parsedType}),ie;const s=this.discriminator,a=r.data[s],n=this.optionsMap.get(a);return n?r.common.async?n._parseAsync({data:r.data,path:r.path,parent:r}):n._parseSync({data:r.data,path:r.path,parent:r}):(B(r,{code:q.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[s]}),ie)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,r,s){const a=new Map;for(const n of r){const i=or(n.shape[e]);if(!i.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const o of i){if(a.has(o))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(o)}`);a.set(o,n)}}return new Ms({typeName:V.ZodDiscriminatedUnion,discriminator:e,options:r,optionsMap:a,...ue(s)})}}function Ui(t,e){const r=nr(t),s=nr(e);if(t===e)return{valid:!0,data:t};if(r===Y.object&&s===Y.object){const a=Pe.objectKeys(e),n=Pe.objectKeys(t).filter(o=>a.indexOf(o)!==-1),i={...t,...e};for(const o of n){const l=Ui(t[o],e[o]);if(!l.valid)return{valid:!1};i[o]=l.data}return{valid:!0,data:i}}else if(r===Y.array&&s===Y.array){if(t.length!==e.length)return{valid:!1};const a=[];for(let n=0;n<t.length;n++){const i=t[n],o=e[n],l=Ui(i,o);if(!l.valid)return{valid:!1};a.push(l.data)}return{valid:!0,data:a}}else return r===Y.date&&s===Y.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}class qa extends me{_parse(e){const{status:r,ctx:s}=this._processInputParams(e),a=(n,i)=>{if(Li(n)||Li(i))return ie;const o=Ui(n.value,i.value);return o.valid?((Fi(n)||Fi(i))&&r.dirty(),{status:r.value,value:o.data}):(B(s,{code:q.invalid_intersection_types}),ie)};return s.common.async?Promise.all([this._def.left._parseAsync({data:s.data,path:s.path,parent:s}),this._def.right._parseAsync({data:s.data,path:s.path,parent:s})]).then(([n,i])=>a(n,i)):a(this._def.left._parseSync({data:s.data,path:s.path,parent:s}),this._def.right._parseSync({data:s.data,path:s.path,parent:s}))}}qa.create=(t,e,r)=>new qa({left:t,right:e,typeName:V.ZodIntersection,...ue(r)});class Zt extends me{_parse(e){const{status:r,ctx:s}=this._processInputParams(e);if(s.parsedType!==Y.array)return B(s,{code:q.invalid_type,expected:Y.array,received:s.parsedType}),ie;if(s.data.length<this._def.items.length)return B(s,{code:q.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),ie;!this._def.rest&&s.data.length>this._def.items.length&&(B(s,{code:q.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());const n=[...s.data].map((i,o)=>{const l=this._def.items[o]||this._def.rest;return l?l._parse(new Ht(s,i,s.path,o)):null}).filter(i=>!!i);return s.common.async?Promise.all(n).then(i=>ot.mergeArray(r,i)):ot.mergeArray(r,n)}get items(){return this._def.items}rest(e){return new Zt({...this._def,rest:e})}}Zt.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Zt({items:t,typeName:V.ZodTuple,rest:null,...ue(e)})};class Ua extends me{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:r,ctx:s}=this._processInputParams(e);if(s.parsedType!==Y.object)return B(s,{code:q.invalid_type,expected:Y.object,received:s.parsedType}),ie;const a=[],n=this._def.keyType,i=this._def.valueType;for(const o in s.data)a.push({key:n._parse(new Ht(s,o,s.path,o)),value:i._parse(new Ht(s,s.data[o],s.path,o)),alwaysSet:o in s.data});return s.common.async?ot.mergeObjectAsync(r,a):ot.mergeObjectSync(r,a)}get element(){return this._def.valueType}static create(e,r,s){return r instanceof me?new Ua({keyType:e,valueType:r,typeName:V.ZodRecord,...ue(s)}):new Ua({keyType:Ct.create(),valueType:e,typeName:V.ZodRecord,...ue(r)})}}class Ls extends me{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:r,ctx:s}=this._processInputParams(e);if(s.parsedType!==Y.map)return B(s,{code:q.invalid_type,expected:Y.map,received:s.parsedType}),ie;const a=this._def.keyType,n=this._def.valueType,i=[...s.data.entries()].map(([o,l],c)=>({key:a._parse(new Ht(s,o,s.path,[c,"key"])),value:n._parse(new Ht(s,l,s.path,[c,"value"]))}));if(s.common.async){const o=new Map;return Promise.resolve().then(async()=>{for(const l of i){const c=await l.key,u=await l.value;if(c.status==="aborted"||u.status==="aborted")return ie;(c.status==="dirty"||u.status==="dirty")&&r.dirty(),o.set(c.value,u.value)}return{status:r.value,value:o}})}else{const o=new Map;for(const l of i){const c=l.key,u=l.value;if(c.status==="aborted"||u.status==="aborted")return ie;(c.status==="dirty"||u.status==="dirty")&&r.dirty(),o.set(c.value,u.value)}return{status:r.value,value:o}}}}Ls.create=(t,e,r)=>new Ls({valueType:e,keyType:t,typeName:V.ZodMap,...ue(r)});class Lr extends me{_parse(e){const{status:r,ctx:s}=this._processInputParams(e);if(s.parsedType!==Y.set)return B(s,{code:q.invalid_type,expected:Y.set,received:s.parsedType}),ie;const a=this._def;a.minSize!==null&&s.data.size<a.minSize.value&&(B(s,{code:q.too_small,minimum:a.minSize.value,type:"set",inclusive:!0,exact:!1,message:a.minSize.message}),r.dirty()),a.maxSize!==null&&s.data.size>a.maxSize.value&&(B(s,{code:q.too_big,maximum:a.maxSize.value,type:"set",inclusive:!0,exact:!1,message:a.maxSize.message}),r.dirty());const n=this._def.valueType;function i(l){const c=new Set;for(const u of l){if(u.status==="aborted")return ie;u.status==="dirty"&&r.dirty(),c.add(u.value)}return{status:r.value,value:c}}const o=[...s.data.values()].map((l,c)=>n._parse(new Ht(s,l,s.path,c)));return s.common.async?Promise.all(o).then(l=>i(l)):i(o)}min(e,r){return new Lr({...this._def,minSize:{value:e,message:ee.toString(r)}})}max(e,r){return new Lr({...this._def,maxSize:{value:e,message:ee.toString(r)}})}size(e,r){return this.min(e,r).max(e,r)}nonempty(e){return this.min(1,e)}}Lr.create=(t,e)=>new Lr({valueType:t,minSize:null,maxSize:null,typeName:V.ZodSet,...ue(e)});class ia extends me{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:r}=this._processInputParams(e);if(r.parsedType!==Y.function)return B(r,{code:q.invalid_type,expected:Y.function,received:r.parsedType}),ie;function s(o,l){return As({data:o,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,Ns(),ra].filter(c=>!!c),issueData:{code:q.invalid_arguments,argumentsError:l}})}function a(o,l){return As({data:o,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,Ns(),ra].filter(c=>!!c),issueData:{code:q.invalid_return_type,returnTypeError:l}})}const n={errorMap:r.common.contextualErrorMap},i=r.data;if(this._def.returns instanceof oa){const o=this;return dt(async function(...l){const c=new yt([]),u=await o._def.args.parseAsync(l,n).catch(f=>{throw c.addIssue(s(l,f)),c}),d=await Reflect.apply(i,this,u);return await o._def.returns._def.type.parseAsync(d,n).catch(f=>{throw c.addIssue(a(d,f)),c})})}else{const o=this;return dt(function(...l){const c=o._def.args.safeParse(l,n);if(!c.success)throw new yt([s(l,c.error)]);const u=Reflect.apply(i,this,c.data),d=o._def.returns.safeParse(u,n);if(!d.success)throw new yt([a(u,d.error)]);return d.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new ia({...this._def,args:Zt.create(e).rest(Mr.create())})}returns(e){return new ia({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,r,s){return new ia({args:e||Zt.create([]).rest(Mr.create()),returns:r||Mr.create(),typeName:V.ZodFunction,...ue(s)})}}class Va extends me{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})}}Va.create=(t,e)=>new Va({getter:t,typeName:V.ZodLazy,...ue(e)});class za extends me{_parse(e){if(e.data!==this._def.value){const r=this._getOrReturnCtx(e);return B(r,{received:r.data,code:q.invalid_literal,expected:this._def.value}),ie}return{status:"valid",value:e.data}}get value(){return this._def.value}}za.create=(t,e)=>new za({value:t,typeName:V.ZodLiteral,...ue(e)});function Fl(t,e){return new yr({values:t,typeName:V.ZodEnum,...ue(e)})}class yr extends me{_parse(e){if(typeof e.data!="string"){const r=this._getOrReturnCtx(e),s=this._def.values;return B(r,{expected:Pe.joinValues(s),received:r.parsedType,code:q.invalid_type}),ie}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){const r=this._getOrReturnCtx(e),s=this._def.values;return B(r,{received:r.data,code:q.invalid_enum_value,options:s}),ie}return dt(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 yr.create(e,{...this._def,...r})}exclude(e,r=this._def){return yr.create(this.options.filter(s=>!e.includes(s)),{...this._def,...r})}}yr.create=Fl;class Ha extends me{_parse(e){const r=Pe.getValidEnumValues(this._def.values),s=this._getOrReturnCtx(e);if(s.parsedType!==Y.string&&s.parsedType!==Y.number){const a=Pe.objectValues(r);return B(s,{expected:Pe.joinValues(a),received:s.parsedType,code:q.invalid_type}),ie}if(this._cache||(this._cache=new Set(Pe.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){const a=Pe.objectValues(r);return B(s,{received:s.data,code:q.invalid_enum_value,options:a}),ie}return dt(e.data)}get enum(){return this._def.values}}Ha.create=(t,e)=>new Ha({values:t,typeName:V.ZodNativeEnum,...ue(e)});class oa extends me{unwrap(){return this._def.type}_parse(e){const{ctx:r}=this._processInputParams(e);if(r.parsedType!==Y.promise&&r.common.async===!1)return B(r,{code:q.invalid_type,expected:Y.promise,received:r.parsedType}),ie;const s=r.parsedType===Y.promise?r.data:Promise.resolve(r.data);return dt(s.then(a=>this._def.type.parseAsync(a,{path:r.path,errorMap:r.common.contextualErrorMap})))}}oa.create=(t,e)=>new oa({type:t,typeName:V.ZodPromise,...ue(e)});class At extends me{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===V.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:r,ctx:s}=this._processInputParams(e),a=this._def.effect||null,n={addIssue:i=>{B(s,i),i.fatal?r.abort():r.dirty()},get path(){return s.path}};if(n.addIssue=n.addIssue.bind(n),a.type==="preprocess"){const i=a.transform(s.data,n);if(s.common.async)return Promise.resolve(i).then(async o=>{if(r.value==="aborted")return ie;const l=await this._def.schema._parseAsync({data:o,path:s.path,parent:s});return l.status==="aborted"?ie:l.status==="dirty"||r.value==="dirty"?aa(l.value):l});{if(r.value==="aborted")return ie;const o=this._def.schema._parseSync({data:i,path:s.path,parent:s});return o.status==="aborted"?ie:o.status==="dirty"||r.value==="dirty"?aa(o.value):o}}if(a.type==="refinement"){const i=o=>{const l=a.refinement(o,n);if(s.common.async)return Promise.resolve(l);if(l instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return o};if(s.common.async===!1){const o=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});return o.status==="aborted"?ie:(o.status==="dirty"&&r.dirty(),i(o.value),{status:r.value,value:o.value})}else return this._def.schema._parseAsync({data:s.data,path:s.path,parent:s}).then(o=>o.status==="aborted"?ie:(o.status==="dirty"&&r.dirty(),i(o.value).then(()=>({status:r.value,value:o.value}))))}if(a.type==="transform")if(s.common.async===!1){const i=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});if(!jr(i))return ie;const o=a.transform(i.value,n);if(o instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:o}}else return this._def.schema._parseAsync({data:s.data,path:s.path,parent:s}).then(i=>jr(i)?Promise.resolve(a.transform(i.value,n)).then(o=>({status:r.value,value:o})):ie);Pe.assertNever(a)}}At.create=(t,e,r)=>new At({schema:t,typeName:V.ZodEffects,effect:e,...ue(r)}),At.createWithPreprocess=(t,e,r)=>new At({schema:e,effect:{type:"preprocess",transform:t},typeName:V.ZodEffects,...ue(r)});class Kt extends me{_parse(e){return this._getType(e)===Y.undefined?dt(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Kt.create=(t,e)=>new Kt({innerType:t,typeName:V.ZodOptional,...ue(e)});class wr extends me{_parse(e){return this._getType(e)===Y.null?dt(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}wr.create=(t,e)=>new wr({innerType:t,typeName:V.ZodNullable,...ue(e)});class Za extends me{_parse(e){const{ctx:r}=this._processInputParams(e);let s=r.data;return r.parsedType===Y.undefined&&(s=this._def.defaultValue()),this._def.innerType._parse({data:s,path:r.path,parent:r})}removeDefault(){return this._def.innerType}}Za.create=(t,e)=>new Za({innerType:t,typeName:V.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...ue(e)});class Ka extends me{_parse(e){const{ctx:r}=this._processInputParams(e),s={...r,common:{...r.common,issues:[]}},a=this._def.innerType._parse({data:s.data,path:s.path,parent:{...s}});return ja(a)?a.then(n=>({status:"valid",value:n.status==="valid"?n.value:this._def.catchValue({get error(){return new yt(s.common.issues)},input:s.data})})):{status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new yt(s.common.issues)},input:s.data})}}removeCatch(){return this._def.innerType}}Ka.create=(t,e)=>new Ka({innerType:t,typeName:V.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...ue(e)});class Fs extends me{_parse(e){if(this._getType(e)!==Y.nan){const s=this._getOrReturnCtx(e);return B(s,{code:q.invalid_type,expected:Y.nan,received:s.parsedType}),ie}return{status:"valid",value:e.data}}}Fs.create=t=>new Fs({typeName:V.ZodNaN,...ue(t)});const Vv=Symbol("zod_brand");class Vi extends me{_parse(e){const{ctx:r}=this._processInputParams(e),s=r.data;return this._def.type._parse({data:s,path:r.path,parent:r})}unwrap(){return this._def.type}}class Ba extends me{_parse(e){const{status:r,ctx:s}=this._processInputParams(e);if(s.common.async)return(async()=>{const n=await this._def.in._parseAsync({data:s.data,path:s.path,parent:s});return n.status==="aborted"?ie:n.status==="dirty"?(r.dirty(),aa(n.value)):this._def.out._parseAsync({data:n.value,path:s.path,parent:s})})();{const a=this._def.in._parseSync({data:s.data,path:s.path,parent:s});return a.status==="aborted"?ie:a.status==="dirty"?(r.dirty(),{status:"dirty",value:a.value}):this._def.out._parseSync({data:a.value,path:s.path,parent:s})}}static create(e,r){return new Ba({in:e,out:r,typeName:V.ZodPipeline})}}class Wa extends me{_parse(e){const r=this._def.innerType._parse(e),s=a=>(jr(a)&&(a.value=Object.freeze(a.value)),a);return ja(r)?r.then(a=>s(a)):s(r)}unwrap(){return this._def.innerType}}Wa.create=(t,e)=>new Wa({innerType:t,typeName:V.ZodReadonly,...ue(e)});function ql(t,e){const r=typeof t=="function"?t(e):typeof t=="string"?{message:t}:t;return typeof r=="string"?{message:r}:r}function Ul(t,e={},r){return t?sa.create().superRefine((s,a)=>{const n=t(s);if(n instanceof Promise)return n.then(i=>{if(!i){const o=ql(e,s),l=o.fatal??r??!0;a.addIssue({code:"custom",...o,fatal:l})}});if(!n){const i=ql(e,s),o=i.fatal??r??!0;a.addIssue({code:"custom",...i,fatal:o})}}):sa.create()}const zv={object:Fe.lazycreate};var V;(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"})(V||(V={}));const Hv=(t,e={message:`Input not instance of ${t.name}`})=>Ul(r=>r instanceof t,e),I=Ct.create,Je=gr.create,Zv=Fs.create,Kv=_r.create,Ze=Da.create,Bv=Dr.create,Wv=js.create,Jv=Ma.create,Qv=La.create,Vl=sa.create,ca=Mr.create,Gv=ir.create,Yv=Ds.create,X=Nt.create,Z=Fe.create,Xv=Fe.strictCreate,ct=Fa.create,zl=Ms.create,eg=qa.create,tg=Zt.create,la=Ua.create,rg=Ls.create,ag=Lr.create,sg=ia.create,ng=Va.create,ce=za.create,Bt=yr.create,ig=Ha.create,og=oa.create,Hl=At.create,L=Kt.create,cg=wr.create,lg=At.createWithPreprocess,ug=Ba.create,dg=()=>I().optional(),fg=()=>Je().optional(),hg=()=>Ze().optional(),pg={string:t=>Ct.create({...t,coerce:!0}),number:t=>gr.create({...t,coerce:!0}),boolean:t=>Da.create({...t,coerce:!0}),bigint:t=>_r.create({...t,coerce:!0}),date:t=>Dr.create({...t,coerce:!0})},Zl=ie,mg=Object.freeze(Object.defineProperty({__proto__:null,BRAND:Vv,DIRTY:aa,EMPTY_PATH:wv,INVALID:ie,NEVER:Zl,OK:dt,ParseStatus:ot,Schema:me,ZodAny:sa,ZodArray:Nt,ZodBigInt:_r,ZodBoolean:Da,ZodBranded:Vi,ZodCatch:Ka,ZodDate:Dr,ZodDefault:Za,ZodDiscriminatedUnion:Ms,ZodEffects:At,ZodEnum:yr,ZodError:yt,get ZodFirstPartyTypeKind(){return V},ZodFunction:ia,ZodIntersection:qa,ZodIssueCode:q,ZodLazy:Va,ZodLiteral:za,ZodMap:Ls,ZodNaN:Fs,ZodNativeEnum:Ha,ZodNever:ir,ZodNull:La,ZodNullable:wr,ZodNumber:gr,ZodObject:Fe,ZodOptional:Kt,ZodParsedType:Y,ZodPipeline:Ba,ZodPromise:oa,ZodReadonly:Wa,ZodRecord:Ua,ZodSchema:me,ZodSet:Lr,ZodString:Ct,ZodSymbol:js,ZodTransformer:At,ZodTuple:Zt,ZodType:me,ZodUndefined:Ma,ZodUnion:Fa,ZodUnknown:Mr,ZodVoid:Ds,addIssueToContext:B,any:Vl,array:X,bigint:Kv,boolean:Ze,coerce:pg,custom:Ul,date:Bv,datetimeRegex:Ll,defaultErrorMap:ra,discriminatedUnion:zl,effect:Hl,enum:Bt,function:sg,getErrorMap:Ns,getParsedType:nr,instanceof:Hv,intersection:eg,isAborted:Li,isAsync:ja,isDirty:Fi,isValid:jr,late:zv,lazy:ng,literal:ce,makeIssue:As,map:rg,nan:Zv,nativeEnum:ig,never:Gv,null:Qv,nullable:cg,number:Je,object:Z,get objectUtil(){return Mi},oboolean:hg,onumber:fg,optional:L,ostring:dg,pipeline:ug,preprocess:lg,promise:og,quotelessJson:_v,record:la,set:ag,setErrorMap:yv,strictObject:Xv,string:I,symbol:Wv,transformer:Hl,tuple:tg,undefined:Jv,union:ct,unknown:ca,get util(){return Pe},void:Yv},Symbol.toStringTag,{value:"Module"})),Ja="2025-06-18",Kl=[Ja,"2025-03-26","2024-11-05","2024-10-07"],qs="2.0",Bl=ct([I(),Je().int()]),Wl=I(),vg=Z({progressToken:L(Bl)}).passthrough(),$t=Z({_meta:L(vg)}).passthrough(),mt=Z({method:I(),params:L($t)}),Qa=Z({_meta:L(Z({}).passthrough())}).passthrough(),Wt=Z({method:I(),params:L(Qa)}),Pt=Z({_meta:L(Z({}).passthrough())}).passthrough(),Us=ct([I(),Je().int()]),Jl=Z({jsonrpc:ce(qs),id:Us}).merge(mt).strict(),Ql=t=>Jl.safeParse(t).success,Gl=Z({jsonrpc:ce(qs)}).merge(Wt).strict(),gg=t=>Gl.safeParse(t).success,Yl=Z({jsonrpc:ce(qs),id:Us,result:Pt}).strict(),zi=t=>Yl.safeParse(t).success;var Oe;(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"})(Oe||(Oe={}));const Xl=Z({jsonrpc:ce(qs),id:Us,error:Z({code:Je().int(),message:I(),data:L(ca())})}).strict(),_g=t=>Xl.safeParse(t).success,Fr=ct([Jl,Gl,Yl,Xl]),br=Pt.strict(),Hi=Wt.extend({method:ce("notifications/cancelled"),params:Qa.extend({requestId:Us,reason:I().optional()})}),yg=Z({src:I(),mimeType:L(I()),sizes:L(X(I()))}).passthrough(),Ga=Z({icons:X(yg).optional()}).passthrough(),Ya=Z({name:I(),title:L(I())}).passthrough(),eu=Ya.extend({version:I(),websiteUrl:L(I())}).merge(Ga),wg=Z({experimental:L(Z({}).passthrough()),sampling:L(Z({}).passthrough()),elicitation:L(Z({}).passthrough()),roots:L(Z({listChanged:L(Ze())}).passthrough())}).passthrough(),tu=mt.extend({method:ce("initialize"),params:$t.extend({protocolVersion:I(),capabilities:wg,clientInfo:eu})}),bg=Z({experimental:L(Z({}).passthrough()),logging:L(Z({}).passthrough()),completions:L(Z({}).passthrough()),prompts:L(Z({listChanged:L(Ze())}).passthrough()),resources:L(Z({subscribe:L(Ze()),listChanged:L(Ze())}).passthrough()),tools:L(Z({listChanged:L(Ze())}).passthrough())}).passthrough(),ru=Pt.extend({protocolVersion:I(),capabilities:bg,serverInfo:eu,instructions:L(I())}),Zi=Wt.extend({method:ce("notifications/initialized")}),$g=t=>Zi.safeParse(t).success,Ki=mt.extend({method:ce("ping")}),Pg=Z({progress:Je(),total:L(Je()),message:L(I())}).passthrough(),Bi=Wt.extend({method:ce("notifications/progress"),params:Qa.merge(Pg).extend({progressToken:Bl})}),Vs=mt.extend({params:$t.extend({cursor:L(Wl)}).optional()}),zs=Pt.extend({nextCursor:L(Wl)}),au=Z({uri:I(),mimeType:L(I()),_meta:L(Z({}).passthrough())}).passthrough(),su=au.extend({text:I()}),Wi=I().refine(t=>{try{return atob(t),!0}catch{return!1}},{message:"Invalid Base64 string"}),nu=au.extend({blob:Wi}),iu=Ya.extend({uri:I(),description:L(I()),mimeType:L(I()),_meta:L(Z({}).passthrough())}).merge(Ga),Eg=Ya.extend({uriTemplate:I(),description:L(I()),mimeType:L(I()),_meta:L(Z({}).passthrough())}).merge(Ga),Hs=Vs.extend({method:ce("resources/list")}),ou=zs.extend({resources:X(iu)}),Ji=Vs.extend({method:ce("resources/templates/list")}),cu=zs.extend({resourceTemplates:X(Eg)}),Qi=mt.extend({method:ce("resources/read"),params:$t.extend({uri:I()})}),lu=Pt.extend({contents:X(ct([su,nu]))}),uu=Wt.extend({method:ce("notifications/resources/list_changed")}),du=mt.extend({method:ce("resources/subscribe"),params:$t.extend({uri:I()})}),fu=mt.extend({method:ce("resources/unsubscribe"),params:$t.extend({uri:I()})}),hu=Wt.extend({method:ce("notifications/resources/updated"),params:Qa.extend({uri:I()})}),Sg=Z({name:I(),description:L(I()),required:L(Ze())}).passthrough(),Rg=Ya.extend({description:L(I()),arguments:L(X(Sg)),_meta:L(Z({}).passthrough())}).merge(Ga),Gi=Vs.extend({method:ce("prompts/list")}),pu=zs.extend({prompts:X(Rg)}),Yi=mt.extend({method:ce("prompts/get"),params:$t.extend({name:I(),arguments:L(la(I()))})}),Xi=Z({type:ce("text"),text:I(),_meta:L(Z({}).passthrough())}).passthrough(),eo=Z({type:ce("image"),data:Wi,mimeType:I(),_meta:L(Z({}).passthrough())}).passthrough(),to=Z({type:ce("audio"),data:Wi,mimeType:I(),_meta:L(Z({}).passthrough())}).passthrough(),xg=Z({type:ce("resource"),resource:ct([su,nu]),_meta:L(Z({}).passthrough())}).passthrough(),kg=iu.extend({type:ce("resource_link")}),mu=ct([Xi,eo,to,kg,xg]),Ig=Z({role:Bt(["user","assistant"]),content:mu}).passthrough(),vu=Pt.extend({description:L(I()),messages:X(Ig)}),gu=Wt.extend({method:ce("notifications/prompts/list_changed")}),Tg=Z({title:L(I()),readOnlyHint:L(Ze()),destructiveHint:L(Ze()),idempotentHint:L(Ze()),openWorldHint:L(Ze())}).passthrough(),Og=Ya.extend({description:L(I()),inputSchema:Z({type:ce("object"),properties:L(Z({}).passthrough()),required:L(X(I()))}).passthrough(),outputSchema:L(Z({type:ce("object"),properties:L(Z({}).passthrough()),required:L(X(I()))}).passthrough()),annotations:L(Tg),_meta:L(Z({}).passthrough())}).merge(Ga),ro=Vs.extend({method:ce("tools/list")}),_u=zs.extend({tools:X(Og)}),Zs=Pt.extend({content:X(mu).default([]),structuredContent:Z({}).passthrough().optional(),isError:L(Ze())});Zs.or(Pt.extend({toolResult:ca()}));const ao=mt.extend({method:ce("tools/call"),params:$t.extend({name:I(),arguments:L(la(ca()))})}),yu=Wt.extend({method:ce("notifications/tools/list_changed")}),Ks=Bt(["debug","info","notice","warning","error","critical","alert","emergency"]),Bs=mt.extend({method:ce("logging/setLevel"),params:$t.extend({level:Ks})}),wu=Wt.extend({method:ce("notifications/message"),params:Qa.extend({level:Ks,logger:L(I()),data:ca()})}),Cg=Z({name:I().optional()}).passthrough(),Ng=Z({hints:L(X(Cg)),costPriority:L(Je().min(0).max(1)),speedPriority:L(Je().min(0).max(1)),intelligencePriority:L(Je().min(0).max(1))}).passthrough(),Ag=Z({role:Bt(["user","assistant"]),content:ct([Xi,eo,to])}).passthrough(),bu=mt.extend({method:ce("sampling/createMessage"),params:$t.extend({messages:X(Ag),systemPrompt:L(I()),includeContext:L(Bt(["none","thisServer","allServers"])),temperature:L(Je()),maxTokens:Je().int(),stopSequences:L(X(I())),metadata:L(Z({}).passthrough()),modelPreferences:L(Ng)})}),so=Pt.extend({model:I(),stopReason:L(Bt(["endTurn","stopSequence","maxTokens"]).or(I())),role:Bt(["user","assistant"]),content:zl("type",[Xi,eo,to])}),jg=Z({type:ce("boolean"),title:L(I()),description:L(I()),default:L(Ze())}).passthrough(),Dg=Z({type:ce("string"),title:L(I()),description:L(I()),minLength:L(Je()),maxLength:L(Je()),format:L(Bt(["email","uri","date","date-time"]))}).passthrough(),Mg=Z({type:Bt(["number","integer"]),title:L(I()),description:L(I()),minimum:L(Je()),maximum:L(Je())}).passthrough(),Lg=Z({type:ce("string"),title:L(I()),description:L(I()),enum:X(I()),enumNames:L(X(I()))}).passthrough(),Fg=ct([jg,Dg,Mg,Lg]),$u=mt.extend({method:ce("elicitation/create"),params:$t.extend({message:I(),requestedSchema:Z({type:ce("object"),properties:la(I(),Fg),required:L(X(I()))}).passthrough()})}),no=Pt.extend({action:Bt(["accept","decline","cancel"]),content:L(la(I(),ca()))}),qg=Z({type:ce("ref/resource"),uri:I()}).passthrough(),Ug=Z({type:ce("ref/prompt"),name:I()}).passthrough(),io=mt.extend({method:ce("completion/complete"),params:$t.extend({ref:ct([Ug,qg]),argument:Z({name:I(),value:I()}).passthrough(),context:L(Z({arguments:L(la(I(),I()))}))})}),Pu=Pt.extend({completion:Z({values:X(I()).max(100),total:L(Je().int()),hasMore:L(Ze())}).passthrough()}),Vg=Z({uri:I().startsWith("file://"),name:L(I()),_meta:L(Z({}).passthrough())}).passthrough(),Eu=mt.extend({method:ce("roots/list")}),oo=Pt.extend({roots:X(Vg)}),Su=Wt.extend({method:ce("notifications/roots/list_changed")});ct([Ki,tu,io,Bs,Yi,Gi,Hs,Ji,Qi,du,fu,ao,ro]),ct([Hi,Bi,Zi,Su]),ct([br,so,no,oo]),ct([Ki,bu,$u,Eu]),ct([Hi,Bi,wu,hu,uu,yu,gu]),ct([br,ru,Pu,vu,pu,ou,cu,lu,Zs,_u]);class Ae extends Error{constructor(e,r,s){super(`MCP error ${e}: ${r}`),this.code=e,this.data=s,this.name="McpError"}}const zg=6e4;class Ru{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(Hi,r=>{const s=this._requestHandlerAbortControllers.get(r.params.requestId);s==null||s.abort(r.params.reason)}),this.setNotificationHandler(Bi,r=>{this._onprogress(r)}),this.setRequestHandler(Ki,r=>({}))}_setupTimeout(e,r,s,a,n=!1){this._timeoutInfo.set(e,{timeoutId:setTimeout(a,r),startTime:Date.now(),timeout:r,maxTotalTimeout:s,resetTimeoutOnProgress:n,onTimeout:a})}_resetTimeout(e){const r=this._timeoutInfo.get(e);if(!r)return!1;const s=Date.now()-r.startTime;if(r.maxTotalTimeout&&s>=r.maxTotalTimeout)throw this._timeoutInfo.delete(e),new Ae(Oe.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:r.maxTotalTimeout,totalElapsed:s});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,s,a;this._transport=e;const n=(r=this.transport)===null||r===void 0?void 0:r.onclose;this._transport.onclose=()=>{n==null||n(),this._onclose()};const i=(s=this.transport)===null||s===void 0?void 0:s.onerror;this._transport.onerror=l=>{i==null||i(l),this._onerror(l)};const o=(a=this._transport)===null||a===void 0?void 0:a.onmessage;this._transport.onmessage=(l,c)=>{o==null||o(l,c),zi(l)||_g(l)?this._onresponse(l):Ql(l)?this._onrequest(l,c):gg(l)?this._onnotification(l):this._onerror(new Error(`Unknown message type: ${JSON.stringify(l)}`))},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 s=new Ae(Oe.ConnectionClosed,"Connection closed");for(const a of r.values())a(s)}_onerror(e){var r;(r=this.onerror)===null||r===void 0||r.call(this,e)}_onnotification(e){var r;const s=(r=this._notificationHandlers.get(e.method))!==null&&r!==void 0?r:this.fallbackNotificationHandler;s!==void 0&&Promise.resolve().then(()=>s(e)).catch(a=>this._onerror(new Error(`Uncaught error in notification handler: ${a}`)))}_onrequest(e,r){var s,a;const n=(s=this._requestHandlers.get(e.method))!==null&&s!==void 0?s:this.fallbackRequestHandler,i=this._transport;if(n===void 0){i==null||i.send({jsonrpc:"2.0",id:e.id,error:{code:Oe.MethodNotFound,message:"Method not found"}}).catch(c=>this._onerror(new Error(`Failed to send an error response: ${c}`)));return}const o=new AbortController;this._requestHandlerAbortControllers.set(e.id,o);const l={signal:o.signal,sessionId:i==null?void 0:i.sessionId,_meta:(a=e.params)===null||a===void 0?void 0:a._meta,sendNotification:c=>this.notification(c,{relatedRequestId:e.id}),sendRequest:(c,u,d)=>this.request(c,u,{...d,relatedRequestId:e.id}),authInfo:r==null?void 0:r.authInfo,requestId:e.id,requestInfo:r==null?void 0:r.requestInfo};Promise.resolve().then(()=>n(e,l)).then(c=>{if(!o.signal.aborted)return i==null?void 0:i.send({result:c,jsonrpc:"2.0",id:e.id})},c=>{var u;if(!o.signal.aborted)return i==null?void 0:i.send({jsonrpc:"2.0",id:e.id,error:{code:Number.isSafeInteger(c.code)?c.code:Oe.InternalError,message:(u=c.message)!==null&&u!==void 0?u:"Internal error"}})}).catch(c=>this._onerror(new Error(`Failed to send response: ${c}`))).finally(()=>{this._requestHandlerAbortControllers.delete(e.id)})}_onprogress(e){const{progressToken:r,...s}=e.params,a=Number(r),n=this._progressHandlers.get(a);if(!n){this._onerror(new Error(`Received a progress notification for an unknown token: ${JSON.stringify(e)}`));return}const i=this._responseHandlers.get(a),o=this._timeoutInfo.get(a);if(o&&i&&o.resetTimeoutOnProgress)try{this._resetTimeout(a)}catch(l){i(l);return}n(s)}_onresponse(e){const r=Number(e.id),s=this._responseHandlers.get(r);if(s===void 0){this._onerror(new Error(`Received a response for an unknown message ID: ${JSON.stringify(e)}`));return}if(this._responseHandlers.delete(r),this._progressHandlers.delete(r),this._cleanupTimeout(r),zi(e))s(e);else{const a=new Ae(e.error.code,e.error.message,e.error.data);s(a)}}get transport(){return this._transport}async close(){var e;await((e=this._transport)===null||e===void 0?void 0:e.close())}request(e,r,s){const{relatedRequestId:a,resumptionToken:n,onresumptiontoken:i}=s??{};return new Promise((o,l)=>{var c,u,d,g,f,m;if(!this._transport){l(new Error("Not connected"));return}((c=this._options)===null||c===void 0?void 0:c.enforceStrictCapabilities)===!0&&this.assertCapabilityForMethod(e.method),(u=s==null?void 0:s.signal)===null||u===void 0||u.throwIfAborted();const p=this._requestMessageId++,h={...e,jsonrpc:"2.0",id:p};s!=null&&s.onprogress&&(this._progressHandlers.set(p,s.onprogress),h.params={...e.params,_meta:{...((d=e.params)===null||d===void 0?void 0:d._meta)||{},progressToken:p}});const v=S=>{var x;this._responseHandlers.delete(p),this._progressHandlers.delete(p),this._cleanupTimeout(p),(x=this._transport)===null||x===void 0||x.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:p,reason:String(S)}},{relatedRequestId:a,resumptionToken:n,onresumptiontoken:i}).catch(A=>this._onerror(new Error(`Failed to send cancellation: ${A}`))),l(S)};this._responseHandlers.set(p,S=>{var x;if(!(!((x=s==null?void 0:s.signal)===null||x===void 0)&&x.aborted)){if(S instanceof Error)return l(S);try{const A=r.parse(S.result);o(A)}catch(A){l(A)}}}),(g=s==null?void 0:s.signal)===null||g===void 0||g.addEventListener("abort",()=>{var S;v((S=s==null?void 0:s.signal)===null||S===void 0?void 0:S.reason)});const w=(f=s==null?void 0:s.timeout)!==null&&f!==void 0?f:zg,P=()=>v(new Ae(Oe.RequestTimeout,"Request timed out",{timeout:w}));this._setupTimeout(p,w,s==null?void 0:s.maxTotalTimeout,P,(m=s==null?void 0:s.resetTimeoutOnProgress)!==null&&m!==void 0?m:!1),this._transport.send(h,{relatedRequestId:a,resumptionToken:n,onresumptiontoken:i}).catch(S=>{this._cleanupTimeout(p),l(S)})})}async notification(e,r){var s,a;if(!this._transport)throw new Error("Not connected");if(this.assertNotificationCapability(e.method),((a=(s=this._options)===null||s===void 0?void 0:s.debouncedNotificationMethods)!==null&&a!==void 0?a:[]).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 l;if(this._pendingDebouncedNotifications.delete(e.method),!this._transport)return;const c={...e,jsonrpc:"2.0"};(l=this._transport)===null||l===void 0||l.send(c,r).catch(u=>this._onerror(u))});return}const o={...e,jsonrpc:"2.0"};await this._transport.send(o,r)}setRequestHandler(e,r){const s=e.shape.method.value;this.assertRequestHandlerCapability(s),this._requestHandlers.set(s,(a,n)=>Promise.resolve(r(e.parse(a),n)))}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){this._notificationHandlers.set(e.shape.method.value,s=>Promise.resolve(r(e.parse(s))))}removeNotificationHandler(e){this._notificationHandlers.delete(e)}}function xu(t,e){return Object.entries(e).reduce((r,[s,a])=>(a&&typeof a=="object"?r[s]=r[s]?{...r[s],...a}:a:r[s]=a,r),{...t})}var co={exports:{}};/** @license URI.js v4.4.1 (c) 2011 Gary Court. License: http://github.com/garycourt/uri-js */(function(t,e){(function(r,s){s(e)})(wa,function(r){function s(){for(var $=arguments.length,y=Array($),E=0;E<$;E++)y[E]=arguments[E];if(y.length>1){y[0]=y[0].slice(0,-1);for(var O=y.length-1,T=1;T<O;++T)y[T]=y[T].slice(1,-1);return y[O]=y[O].slice(1),y.join("")}else return y[0]}function a($){return"(?:"+$+")"}function n($){return $===void 0?"undefined":$===null?"null":Object.prototype.toString.call($).split(" ").pop().split("]").shift().toLowerCase()}function i($){return $.toUpperCase()}function o($){return $!=null?$ instanceof Array?$:typeof $.length!="number"||$.split||$.setInterval||$.call?[$]:Array.prototype.slice.call($):[]}function l($,y){var E=$;if(y)for(var O in y)E[O]=y[O];return E}function c($){var y="[A-Za-z]",E="[0-9]",O=s(E,"[A-Fa-f]"),T=a(a("%[EFef]"+O+"%"+O+O+"%"+O+O)+"|"+a("%[89A-Fa-f]"+O+"%"+O+O)+"|"+a("%"+O+O)),ae="[\\:\\/\\?\\#\\[\\]\\@]",se="[\\!\\$\\&\\'\\(\\)\\*\\+\\,\\;\\=]",Ee=s(ae,se),je=$?"[\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]":"[]",Be=$?"[\\uE000-\\uF8FF]":"[]",$e=s(y,E,"[\\-\\.\\_\\~]",je);a(y+s(y,E,"[\\+\\-\\.]")+"*"),a(a(T+"|"+s($e,se,"[\\:]"))+"*");var Ce=a(a("25[0-5]")+"|"+a("2[0-4]"+E)+"|"+a("1"+E+E)+"|"+a("0?[1-9]"+E)+"|0?0?"+E),We=a(Ce+"\\."+Ce+"\\."+Ce+"\\."+Ce),le=a(O+"{1,4}"),Me=a(a(le+"\\:"+le)+"|"+We),Ye=a(a(le+"\\:")+"{6}"+Me),Le=a("\\:\\:"+a(le+"\\:")+"{5}"+Me),kr=a(a(le)+"?\\:\\:"+a(le+"\\:")+"{4}"+Me),Xt=a(a(a(le+"\\:")+"{0,1}"+le)+"?\\:\\:"+a(le+"\\:")+"{3}"+Me),er=a(a(a(le+"\\:")+"{0,2}"+le)+"?\\:\\:"+a(le+"\\:")+"{2}"+Me),ya=a(a(a(le+"\\:")+"{0,3}"+le)+"?\\:\\:"+le+"\\:"+Me),Hr=a(a(a(le+"\\:")+"{0,4}"+le)+"?\\:\\:"+Me),xt=a(a(a(le+"\\:")+"{0,5}"+le)+"?\\:\\:"+le),tr=a(a(a(le+"\\:")+"{0,6}"+le)+"?\\:\\:"),Zr=a([Ye,Le,kr,Xt,er,ya,Hr,xt,tr].join("|")),fr=a(a($e+"|"+T)+"+");a("[vV]"+O+"+\\."+s($e,se,"[\\:]")+"+"),a(a(T+"|"+s($e,se))+"*");var cs=a(T+"|"+s($e,se,"[\\:\\@]"));return a(a(T+"|"+s($e,se,"[\\@]"))+"+"),a(a(cs+"|"+s("[\\/\\?]",Be))+"*"),{NOT_SCHEME:new RegExp(s("[^]",y,E,"[\\+\\-\\.]"),"g"),NOT_USERINFO:new RegExp(s("[^\\%\\:]",$e,se),"g"),NOT_HOST:new RegExp(s("[^\\%\\[\\]\\:]",$e,se),"g"),NOT_PATH:new RegExp(s("[^\\%\\/\\:\\@]",$e,se),"g"),NOT_PATH_NOSCHEME:new RegExp(s("[^\\%\\/\\@]",$e,se),"g"),NOT_QUERY:new RegExp(s("[^\\%]",$e,se,"[\\:\\@\\/\\?]",Be),"g"),NOT_FRAGMENT:new RegExp(s("[^\\%]",$e,se,"[\\:\\@\\/\\?]"),"g"),ESCAPE:new RegExp(s("[^]",$e,se),"g"),UNRESERVED:new RegExp($e,"g"),OTHER_CHARS:new RegExp(s("[^\\%]",$e,Ee),"g"),PCT_ENCODED:new RegExp(T,"g"),IPV4ADDRESS:new RegExp("^("+We+")$"),IPV6ADDRESS:new RegExp("^\\[?("+Zr+")"+a(a("\\%25|\\%(?!"+O+"{2})")+"("+fr+")")+"?\\]?$")}}var u=c(!1),d=c(!0),g=function(){function $(y,E){var O=[],T=!0,ae=!1,se=void 0;try{for(var Ee=y[Symbol.iterator](),je;!(T=(je=Ee.next()).done)&&(O.push(je.value),!(E&&O.length===E));T=!0);}catch(Be){ae=!0,se=Be}finally{try{!T&&Ee.return&&Ee.return()}finally{if(ae)throw se}}return O}return function(y,E){if(Array.isArray(y))return y;if(Symbol.iterator in Object(y))return $(y,E);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),f=function($){if(Array.isArray($)){for(var y=0,E=Array($.length);y<$.length;y++)E[y]=$[y];return E}else return Array.from($)},m=2147483647,p=36,h=1,v=26,w=38,P=700,S=72,x=128,A="-",z=/^xn--/,U=/[^\0-\x7E]/,D=/[\x2E\u3002\uFF0E\uFF61]/g,W={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},J=p-h,H=Math.floor,F=String.fromCharCode;function M($){throw new RangeError(W[$])}function te($,y){for(var E=[],O=$.length;O--;)E[O]=y($[O]);return E}function ye($,y){var E=$.split("@"),O="";E.length>1&&(O=E[0]+"@",$=E[1]),$=$.replace(D,".");var T=$.split("."),ae=te(T,y).join(".");return O+ae}function ve($){for(var y=[],E=0,O=$.length;E<O;){var T=$.charCodeAt(E++);if(T>=55296&&T<=56319&&E<O){var ae=$.charCodeAt(E++);(ae&64512)==56320?y.push(((T&1023)<<10)+(ae&1023)+65536):(y.push(T),E--)}else y.push(T)}return y}var be=function(y){return String.fromCodePoint.apply(String,f(y))},de=function(y){return y-48<10?y-22:y-65<26?y-65:y-97<26?y-97:p},N=function(y,E){return y+22+75*(y<26)-((E!=0)<<5)},R=function(y,E,O){var T=0;for(y=O?H(y/P):y>>1,y+=H(y/E);y>J*v>>1;T+=p)y=H(y/J);return H(T+(J+1)*y/(y+w))},j=function(y){var E=[],O=y.length,T=0,ae=x,se=S,Ee=y.lastIndexOf(A);Ee<0&&(Ee=0);for(var je=0;je<Ee;++je)y.charCodeAt(je)>=128&&M("not-basic"),E.push(y.charCodeAt(je));for(var Be=Ee>0?Ee+1:0;Be<O;){for(var $e=T,Ce=1,We=p;;We+=p){Be>=O&&M("invalid-input");var le=de(y.charCodeAt(Be++));(le>=p||le>H((m-T)/Ce))&&M("overflow"),T+=le*Ce;var Me=We<=se?h:We>=se+v?v:We-se;if(le<Me)break;var Ye=p-Me;Ce>H(m/Ye)&&M("overflow"),Ce*=Ye}var Le=E.length+1;se=R(T-$e,Le,$e==0),H(T/Le)>m-ae&&M("overflow"),ae+=H(T/Le),T%=Le,E.splice(T++,0,ae)}return String.fromCodePoint.apply(String,E)},k=function(y){var E=[];y=ve(y);var O=y.length,T=x,ae=0,se=S,Ee=!0,je=!1,Be=void 0;try{for(var $e=y[Symbol.iterator](),Ce;!(Ee=(Ce=$e.next()).done);Ee=!0){var We=Ce.value;We<128&&E.push(F(We))}}catch(ls){je=!0,Be=ls}finally{try{!Ee&&$e.return&&$e.return()}finally{if(je)throw Be}}var le=E.length,Me=le;for(le&&E.push(A);Me<O;){var Ye=m,Le=!0,kr=!1,Xt=void 0;try{for(var er=y[Symbol.iterator](),ya;!(Le=(ya=er.next()).done);Le=!0){var Hr=ya.value;Hr>=T&&Hr<Ye&&(Ye=Hr)}}catch(ls){kr=!0,Xt=ls}finally{try{!Le&&er.return&&er.return()}finally{if(kr)throw Xt}}var xt=Me+1;Ye-T>H((m-ae)/xt)&&M("overflow"),ae+=(Ye-T)*xt,T=Ye;var tr=!0,Zr=!1,fr=void 0;try{for(var cs=y[Symbol.iterator](),sf;!(tr=(sf=cs.next()).done);tr=!0){var nf=sf.value;if(nf<T&&++ae>m&&M("overflow"),nf==T){for(var On=ae,Cn=p;;Cn+=p){var Nn=Cn<=se?h:Cn>=se+v?v:Cn-se;if(On<Nn)break;var of=On-Nn,cf=p-Nn;E.push(F(N(Nn+of%cf,0))),On=H(of/cf)}E.push(F(N(On,0))),se=R(ae,xt,Me==le),ae=0,++Me}}}catch(ls){Zr=!0,fr=ls}finally{try{!tr&&cs.return&&cs.return()}finally{if(Zr)throw fr}}++ae,++T}return E.join("")},_=function(y){return ye(y,function(E){return z.test(E)?j(E.slice(4).toLowerCase()):E})},b=function(y){return ye(y,function(E){return U.test(E)?"xn--"+k(E):E})},C={version:"2.1.0",ucs2:{decode:ve,encode:be},decode:j,encode:k,toASCII:b,toUnicode:_},K={};function Q($){var y=$.charCodeAt(0),E=void 0;return y<16?E="%0"+y.toString(16).toUpperCase():y<128?E="%"+y.toString(16).toUpperCase():y<2048?E="%"+(y>>6|192).toString(16).toUpperCase()+"%"+(y&63|128).toString(16).toUpperCase():E="%"+(y>>12|224).toString(16).toUpperCase()+"%"+(y>>6&63|128).toString(16).toUpperCase()+"%"+(y&63|128).toString(16).toUpperCase(),E}function fe($){for(var y="",E=0,O=$.length;E<O;){var T=parseInt($.substr(E+1,2),16);if(T<128)y+=String.fromCharCode(T),E+=3;else if(T>=194&&T<224){if(O-E>=6){var ae=parseInt($.substr(E+4,2),16);y+=String.fromCharCode((T&31)<<6|ae&63)}else y+=$.substr(E,6);E+=6}else if(T>=224){if(O-E>=9){var se=parseInt($.substr(E+4,2),16),Ee=parseInt($.substr(E+7,2),16);y+=String.fromCharCode((T&15)<<12|(se&63)<<6|Ee&63)}else y+=$.substr(E,9);E+=9}else y+=$.substr(E,3),E+=3}return y}function ne($,y){function E(O){var T=fe(O);return T.match(y.UNRESERVED)?T:O}return $.scheme&&($.scheme=String($.scheme).replace(y.PCT_ENCODED,E).toLowerCase().replace(y.NOT_SCHEME,"")),$.userinfo!==void 0&&($.userinfo=String($.userinfo).replace(y.PCT_ENCODED,E).replace(y.NOT_USERINFO,Q).replace(y.PCT_ENCODED,i)),$.host!==void 0&&($.host=String($.host).replace(y.PCT_ENCODED,E).toLowerCase().replace(y.NOT_HOST,Q).replace(y.PCT_ENCODED,i)),$.path!==void 0&&($.path=String($.path).replace(y.PCT_ENCODED,E).replace($.scheme?y.NOT_PATH:y.NOT_PATH_NOSCHEME,Q).replace(y.PCT_ENCODED,i)),$.query!==void 0&&($.query=String($.query).replace(y.PCT_ENCODED,E).replace(y.NOT_QUERY,Q).replace(y.PCT_ENCODED,i)),$.fragment!==void 0&&($.fragment=String($.fragment).replace(y.PCT_ENCODED,E).replace(y.NOT_FRAGMENT,Q).replace(y.PCT_ENCODED,i)),$}function he($){return $.replace(/^0*(.*)/,"$1")||"0"}function lt($,y){var E=$.match(y.IPV4ADDRESS)||[],O=g(E,2),T=O[1];return T?T.split(".").map(he).join("."):$}function Ke($,y){var E=$.match(y.IPV6ADDRESS)||[],O=g(E,3),T=O[1],ae=O[2];if(T){for(var se=T.toLowerCase().split("::").reverse(),Ee=g(se,2),je=Ee[0],Be=Ee[1],$e=Be?Be.split(":").map(he):[],Ce=je.split(":").map(he),We=y.IPV4ADDRESS.test(Ce[Ce.length-1]),le=We?7:8,Me=Ce.length-le,Ye=Array(le),Le=0;Le<le;++Le)Ye[Le]=$e[Le]||Ce[Me+Le]||"";We&&(Ye[le-1]=lt(Ye[le-1],y));var kr=Ye.reduce(function(xt,tr,Zr){if(!tr||tr==="0"){var fr=xt[xt.length-1];fr&&fr.index+fr.length===Zr?fr.length++:xt.push({index:Zr,length:1})}return xt},[]),Xt=kr.sort(function(xt,tr){return tr.length-xt.length})[0],er=void 0;if(Xt&&Xt.length>1){var ya=Ye.slice(0,Xt.index),Hr=Ye.slice(Xt.index+Xt.length);er=ya.join(":")+"::"+Hr.join(":")}else er=Ye.join(":");return ae&&(er+="%"+ae),er}else return $}var Ie=/^(?:([^:\/?#]+):)?(?:\/\/((?:([^\/?#@]*)@)?(\[[^\/?#\]]+\]|[^\/?#:]*)(?:\:(\d*))?))?([^?#]*)(?:\?([^#]*))?(?:#((?:.|\n|\r)*))?/i,Et="".match(/(){0}/)[1]===void 0;function Ge($){var y=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},E={},O=y.iri!==!1?d:u;y.reference==="suffix"&&($=(y.scheme?y.scheme+":":"")+"//"+$);var T=$.match(Ie);if(T){Et?(E.scheme=T[1],E.userinfo=T[3],E.host=T[4],E.port=parseInt(T[5],10),E.path=T[6]||"",E.query=T[7],E.fragment=T[8],isNaN(E.port)&&(E.port=T[5])):(E.scheme=T[1]||void 0,E.userinfo=$.indexOf("@")!==-1?T[3]:void 0,E.host=$.indexOf("//")!==-1?T[4]:void 0,E.port=parseInt(T[5],10),E.path=T[6]||"",E.query=$.indexOf("?")!==-1?T[7]:void 0,E.fragment=$.indexOf("#")!==-1?T[8]:void 0,isNaN(E.port)&&(E.port=$.match(/\/\/(?:.|\n)*\:(?:\/|\?|\#|$)/)?T[4]:void 0)),E.host&&(E.host=Ke(lt(E.host,O),O)),E.scheme===void 0&&E.userinfo===void 0&&E.host===void 0&&E.port===void 0&&!E.path&&E.query===void 0?E.reference="same-document":E.scheme===void 0?E.reference="relative":E.fragment===void 0?E.reference="absolute":E.reference="uri",y.reference&&y.reference!=="suffix"&&y.reference!==E.reference&&(E.error=E.error||"URI is not a "+y.reference+" reference.");var ae=K[(y.scheme||E.scheme||"").toLowerCase()];if(!y.unicodeSupport&&(!ae||!ae.unicodeSupport)){if(E.host&&(y.domainHost||ae&&ae.domainHost))try{E.host=C.toASCII(E.host.replace(O.PCT_ENCODED,fe).toLowerCase())}catch(se){E.error=E.error||"Host's domain name can not be converted to ASCII via punycode: "+se}ne(E,u)}else ne(E,O);ae&&ae.parse&&ae.parse(E,y)}else E.error=E.error||"URI can not be parsed.";return E}function Gt($,y){var E=y.iri!==!1?d:u,O=[];return $.userinfo!==void 0&&(O.push($.userinfo),O.push("@")),$.host!==void 0&&O.push(Ke(lt(String($.host),E),E).replace(E.IPV6ADDRESS,function(T,ae,se){return"["+ae+(se?"%25"+se:"")+"]"})),(typeof $.port=="number"||typeof $.port=="string")&&(O.push(":"),O.push(String($.port))),O.length?O.join(""):void 0}var Ft=/^\.\.?\//,ze=/^\/\.(\/|$)/,St=/^\/\.\.(\/|$)/,ur=/^\/?(?:.|\n)*?(?=\/|$)/;function qe($){for(var y=[];$.length;)if($.match(Ft))$=$.replace(Ft,"");else if($.match(ze))$=$.replace(ze,"/");else if($.match(St))$=$.replace(St,"/"),y.pop();else if($==="."||$==="..")$="";else{var E=$.match(ur);if(E){var O=E[0];$=$.slice(O.length),y.push(O)}else throw new Error("Unexpected dot segment condition")}return y.join("")}function Ue($){var y=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},E=y.iri?d:u,O=[],T=K[(y.scheme||$.scheme||"").toLowerCase()];if(T&&T.serialize&&T.serialize($,y),$.host&&!E.IPV6ADDRESS.test($.host)){if(y.domainHost||T&&T.domainHost)try{$.host=y.iri?C.toUnicode($.host):C.toASCII($.host.replace(E.PCT_ENCODED,fe).toLowerCase())}catch(Ee){$.error=$.error||"Host's domain name can not be converted to "+(y.iri?"Unicode":"ASCII")+" via punycode: "+Ee}}ne($,E),y.reference!=="suffix"&&$.scheme&&(O.push($.scheme),O.push(":"));var ae=Gt($,y);if(ae!==void 0&&(y.reference!=="suffix"&&O.push("//"),O.push(ae),$.path&&$.path.charAt(0)!=="/"&&O.push("/")),$.path!==void 0){var se=$.path;!y.absolutePath&&(!T||!T.absolutePath)&&(se=qe(se)),ae===void 0&&(se=se.replace(/^\/\//,"/%2F")),O.push(se)}return $.query!==void 0&&(O.push("?"),O.push($.query)),$.fragment!==void 0&&(O.push("#"),O.push($.fragment)),O.join("")}function tt($,y){var E=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},O=arguments[3],T={};return O||($=Ge(Ue($,E),E),y=Ge(Ue(y,E),E)),E=E||{},!E.tolerant&&y.scheme?(T.scheme=y.scheme,T.userinfo=y.userinfo,T.host=y.host,T.port=y.port,T.path=qe(y.path||""),T.query=y.query):(y.userinfo!==void 0||y.host!==void 0||y.port!==void 0?(T.userinfo=y.userinfo,T.host=y.host,T.port=y.port,T.path=qe(y.path||""),T.query=y.query):(y.path?(y.path.charAt(0)==="/"?T.path=qe(y.path):(($.userinfo!==void 0||$.host!==void 0||$.port!==void 0)&&!$.path?T.path="/"+y.path:$.path?T.path=$.path.slice(0,$.path.lastIndexOf("/")+1)+y.path:T.path=y.path,T.path=qe(T.path)),T.query=y.query):(T.path=$.path,y.query!==void 0?T.query=y.query:T.query=$.query),T.userinfo=$.userinfo,T.host=$.host,T.port=$.port),T.scheme=$.scheme),T.fragment=y.fragment,T}function xr($,y,E){var O=l({scheme:"null"},E);return Ue(tt(Ge($,O),Ge(y,O),O,!0),O)}function dr($,y){return typeof $=="string"?$=Ue(Ge($,y),y):n($)==="object"&&($=Ge(Ue($,y),y)),$}function Vr($,y,E){return typeof $=="string"?$=Ue(Ge($,E),E):n($)==="object"&&($=Ue($,E)),typeof y=="string"?y=Ue(Ge(y,E),E):n(y)==="object"&&(y=Ue(y,E)),$===y}function Tn($,y){return $&&$.toString().replace(!y||!y.iri?u.ESCAPE:d.ESCAPE,Q)}function Rt($,y){return $&&$.toString().replace(!y||!y.iri?u.PCT_ENCODED:d.PCT_ENCODED,fe)}var zr={scheme:"http",domainHost:!0,parse:function(y,E){return y.host||(y.error=y.error||"HTTP URIs must have a host."),y},serialize:function(y,E){var O=String(y.scheme).toLowerCase()==="https";return(y.port===(O?443:80)||y.port==="")&&(y.port=void 0),y.path||(y.path="/"),y}},Qd={scheme:"https",domainHost:zr.domainHost,parse:zr.parse,serialize:zr.serialize};function Gd($){return typeof $.secure=="boolean"?$.secure:String($.scheme).toLowerCase()==="wss"}var os={scheme:"ws",domainHost:!0,parse:function(y,E){var O=y;return O.secure=Gd(O),O.resourceName=(O.path||"/")+(O.query?"?"+O.query:""),O.path=void 0,O.query=void 0,O},serialize:function(y,E){if((y.port===(Gd(y)?443:80)||y.port==="")&&(y.port=void 0),typeof y.secure=="boolean"&&(y.scheme=y.secure?"wss":"ws",y.secure=void 0),y.resourceName){var O=y.resourceName.split("?"),T=g(O,2),ae=T[0],se=T[1];y.path=ae&&ae!=="/"?ae:void 0,y.query=se,y.resourceName=void 0}return y.fragment=void 0,y}},Yd={scheme:"wss",domainHost:os.domainHost,parse:os.parse,serialize:os.serialize},lb={},Xd="[A-Za-z0-9\\-\\.\\_\\~\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]",Yt="[0-9A-Fa-f]",ub=a(a("%[EFef]"+Yt+"%"+Yt+Yt+"%"+Yt+Yt)+"|"+a("%[89A-Fa-f]"+Yt+"%"+Yt+Yt)+"|"+a("%"+Yt+Yt)),db="[A-Za-z0-9\\!\\$\\%\\'\\*\\+\\-\\^\\_\\`\\{\\|\\}\\~]",fb="[\\!\\$\\%\\'\\(\\)\\*\\+\\,\\-\\.0-9\\<\\>A-Z\\x5E-\\x7E]",hb=s(fb,'[\\"\\\\]'),pb="[\\!\\$\\'\\(\\)\\*\\+\\,\\;\\:\\@]",mb=new RegExp(Xd,"g"),_a=new RegExp(ub,"g"),vb=new RegExp(s("[^]",db,"[\\.]",'[\\"]',hb),"g"),ef=new RegExp(s("[^]",Xd,pb),"g"),gb=ef;function fc($){var y=fe($);return y.match(mb)?y:$}var tf={scheme:"mailto",parse:function(y,E){var O=y,T=O.to=O.path?O.path.split(","):[];if(O.path=void 0,O.query){for(var ae=!1,se={},Ee=O.query.split("&"),je=0,Be=Ee.length;je<Be;++je){var $e=Ee[je].split("=");switch($e[0]){case"to":for(var Ce=$e[1].split(","),We=0,le=Ce.length;We<le;++We)T.push(Ce[We]);break;case"subject":O.subject=Rt($e[1],E);break;case"body":O.body=Rt($e[1],E);break;default:ae=!0,se[Rt($e[0],E)]=Rt($e[1],E);break}}ae&&(O.headers=se)}O.query=void 0;for(var Me=0,Ye=T.length;Me<Ye;++Me){var Le=T[Me].split("@");if(Le[0]=Rt(Le[0]),E.unicodeSupport)Le[1]=Rt(Le[1],E).toLowerCase();else try{Le[1]=C.toASCII(Rt(Le[1],E).toLowerCase())}catch(kr){O.error=O.error||"Email address's domain name can not be converted to ASCII via punycode: "+kr}T[Me]=Le.join("@")}return O},serialize:function(y,E){var O=y,T=o(y.to);if(T){for(var ae=0,se=T.length;ae<se;++ae){var Ee=String(T[ae]),je=Ee.lastIndexOf("@"),Be=Ee.slice(0,je).replace(_a,fc).replace(_a,i).replace(vb,Q),$e=Ee.slice(je+1);try{$e=E.iri?C.toUnicode($e):C.toASCII(Rt($e,E).toLowerCase())}catch(Me){O.error=O.error||"Email address's domain name can not be converted to "+(E.iri?"Unicode":"ASCII")+" via punycode: "+Me}T[ae]=Be+"@"+$e}O.path=T.join(",")}var Ce=y.headers=y.headers||{};y.subject&&(Ce.subject=y.subject),y.body&&(Ce.body=y.body);var We=[];for(var le in Ce)Ce[le]!==lb[le]&&We.push(le.replace(_a,fc).replace(_a,i).replace(ef,Q)+"="+Ce[le].replace(_a,fc).replace(_a,i).replace(gb,Q));return We.length&&(O.query=We.join("&")),O}},_b=/^([^\:]+)\:(.*)/,rf={scheme:"urn",parse:function(y,E){var O=y.path&&y.path.match(_b),T=y;if(O){var ae=E.scheme||T.scheme||"urn",se=O[1].toLowerCase(),Ee=O[2],je=ae+":"+(E.nid||se),Be=K[je];T.nid=se,T.nss=Ee,T.path=void 0,Be&&(T=Be.parse(T,E))}else T.error=T.error||"URN can not be parsed.";return T},serialize:function(y,E){var O=E.scheme||y.scheme||"urn",T=y.nid,ae=O+":"+(E.nid||T),se=K[ae];se&&(y=se.serialize(y,E));var Ee=y,je=y.nss;return Ee.path=(T||E.nid)+":"+je,Ee}},yb=/^[0-9A-Fa-f]{8}(?:\-[0-9A-Fa-f]{4}){3}\-[0-9A-Fa-f]{12}$/,af={scheme:"urn:uuid",parse:function(y,E){var O=y;return O.uuid=O.nss,O.nss=void 0,!E.tolerant&&(!O.uuid||!O.uuid.match(yb))&&(O.error=O.error||"UUID is not valid."),O},serialize:function(y,E){var O=y;return O.nss=(y.uuid||"").toLowerCase(),O}};K[zr.scheme]=zr,K[Qd.scheme]=Qd,K[os.scheme]=os,K[Yd.scheme]=Yd,K[tf.scheme]=tf,K[rf.scheme]=rf,K[af.scheme]=af,r.SCHEMES=K,r.pctEncChar=Q,r.pctDecChars=fe,r.parse=Ge,r.removeDotSegments=qe,r.serialize=Ue,r.resolveComponents=tt,r.resolve=xr,r.normalize=dr,r.equal=Vr,r.escapeComponent=Tn,r.unescapeComponent=Rt,Object.defineProperty(r,"__esModule",{value:!0})})})(co,co.exports);var Hg=co.exports,Zg=function(e){for(var r=0,s=e.length,a=0,n;a<s;)r++,n=e.charCodeAt(a++),n>=55296&&n<=56319&&a<s&&(n=e.charCodeAt(a),(n&64512)==56320&&a++);return r},ua={copy:Kg,checkDataType:lo,checkDataTypes:Bg,coerceToTypes:Wg,toHash:uo,getProperty:fo,escapeQuotes:ho,equal:Pa,ucs2length:Zg,varOccurences:Gg,varReplace:Yg,schemaHasRules:Xg,schemaHasRulesExcept:e_,schemaUnknownRules:t_,toQuotedString:po,getPathExpr:r_,getPath:a_,getData:i_,unescapeFragment:o_,unescapeJsonPointer:vo,escapeFragment:c_,escapeJsonPointer:mo};function Kg(t,e){e=e||{};for(var r in t)e[r]=t[r];return e}function lo(t,e,r,s){var a=s?" !== ":" === ",n=s?" || ":" && ",i=s?"!":"",o=s?"":"!";switch(t){case"null":return e+a+"null";case"array":return i+"Array.isArray("+e+")";case"object":return"("+i+e+n+"typeof "+e+a+'"object"'+n+o+"Array.isArray("+e+"))";case"integer":return"(typeof "+e+a+'"number"'+n+o+"("+e+" % 1)"+n+e+a+e+(r?n+i+"isFinite("+e+")":"")+")";case"number":return"(typeof "+e+a+'"'+t+'"'+(r?n+i+"isFinite("+e+")":"")+")";default:return"typeof "+e+a+'"'+t+'"'}}function Bg(t,e,r){switch(t.length){case 1:return lo(t[0],e,r,!0);default:var s="",a=uo(t);a.array&&a.object&&(s=a.null?"(":"(!"+e+" || ",s+="typeof "+e+' !== "object")',delete a.null,delete a.array,delete a.object),a.number&&delete a.integer;for(var n in a)s+=(s?" && ":"")+lo(n,e,r,!0);return s}}var ku=uo(["string","number","integer","boolean","null"]);function Wg(t,e){if(Array.isArray(e)){for(var r=[],s=0;s<e.length;s++){var a=e[s];(ku[a]||t==="array"&&a==="array")&&(r[r.length]=a)}if(r.length)return r}else{if(ku[e])return[e];if(t==="array"&&e==="array")return["array"]}}function uo(t){for(var e={},r=0;r<t.length;r++)e[t[r]]=!0;return e}var Jg=/^[a-z$_][a-z$_0-9]*$/i,Qg=/'|\\/g;function fo(t){return typeof t=="number"?"["+t+"]":Jg.test(t)?"."+t:"['"+ho(t)+"']"}function ho(t){return t.replace(Qg,"\\$&").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\f/g,"\\f").replace(/\t/g,"\\t")}function Gg(t,e){e+="[^0-9]";var r=t.match(new RegExp(e,"g"));return r?r.length:0}function Yg(t,e,r){return e+="([^0-9])",r=r.replace(/\$/g,"$$$$"),t.replace(new RegExp(e,"g"),r+"$1")}function Xg(t,e){if(typeof t=="boolean")return!t;for(var r in t)if(e[r])return!0}function e_(t,e,r){if(typeof t=="boolean")return!t&&r!="not";for(var s in t)if(s!=r&&e[s])return!0}function t_(t,e){if(typeof t!="boolean"){for(var r in t)if(!e[r])return r}}function po(t){return"'"+ho(t)+"'"}function r_(t,e,r,s){var a=r?"'/' + "+e+(s?"":".replace(/~/g, '~0').replace(/\\//g, '~1')"):s?"'[' + "+e+" + ']'":"'[\\'' + "+e+" + '\\']'";return Iu(t,a)}function a_(t,e,r){var s=po(r?"/"+mo(e):fo(e));return Iu(t,s)}var s_=/^\/(?:[^~]|~0|~1)*$/,n_=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function i_(t,e,r){var s,a,n,i;if(t==="")return"rootData";if(t[0]=="/"){if(!s_.test(t))throw new Error("Invalid JSON-pointer: "+t);a=t,n="rootData"}else{if(i=t.match(n_),!i)throw new Error("Invalid JSON-pointer: "+t);if(s=+i[1],a=i[2],a=="#"){if(s>=e)throw new Error("Cannot access property/index "+s+" levels up, current level is "+e);return r[e-s]}if(s>e)throw new Error("Cannot access data "+s+" levels up, current level is "+e);if(n="data"+(e-s||""),!a)return n}for(var o=n,l=a.split("/"),c=0;c<l.length;c++){var u=l[c];u&&(n+=fo(vo(u)),o+=" && "+n)}return o}function Iu(t,e){return t=='""'?e:(t+" + "+e).replace(/([^\\])' \+ '/g,"$1")}function o_(t){return vo(decodeURIComponent(t))}function c_(t){return encodeURIComponent(mo(t))}function mo(t){return t.replace(/~/g,"~0").replace(/\//g,"~1")}function vo(t){return t.replace(/~1/g,"/").replace(/~0/g,"~")}var l_=ua,Tu=u_;function u_(t){l_.copy(t,this)}var Ou={exports:{}},$r=Ou.exports=function(t,e,r){typeof e=="function"&&(r=e,e={}),r=e.cb||r;var s=typeof r=="function"?r:r.pre||function(){},a=r.post||function(){};Ws(e,s,a,t,"",t)};$r.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0},$r.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0},$r.propsKeywords={definitions:!0,properties:!0,patternProperties:!0,dependencies:!0},$r.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 Ws(t,e,r,s,a,n,i,o,l,c){if(s&&typeof s=="object"&&!Array.isArray(s)){e(s,a,n,i,o,l,c);for(var u in s){var d=s[u];if(Array.isArray(d)){if(u in $r.arrayKeywords)for(var g=0;g<d.length;g++)Ws(t,e,r,d[g],a+"/"+u+"/"+g,n,a,u,s,g)}else if(u in $r.propsKeywords){if(d&&typeof d=="object")for(var f in d)Ws(t,e,r,d[f],a+"/"+u+"/"+d_(f),n,a,u,s,f)}else(u in $r.keywords||t.allKeys&&!(u in $r.skipKeywords))&&Ws(t,e,r,d,a+"/"+u,n,a,u,s)}r(s,a,n,i,o,l,c)}}function d_(t){return t.replace(/~/g,"~0").replace(/\//g,"~1")}var f_=Ou.exports,Xa=Hg,Cu=Pa,Js=ua,Qs=Tu,h_=f_,go=Pr;Pr.normalizeId=Er,Pr.fullPath=Ys,Pr.url=Xs,Pr.ids=__,Pr.inlineRef=_o,Pr.schema=Gs;function Pr(t,e,r){var s=this._refs[r];if(typeof s=="string")if(this._refs[s])s=this._refs[s];else return Pr.call(this,t,e,s);if(s=s||this._schemas[r],s instanceof Qs)return _o(s.schema,this._opts.inlineRefs)?s.schema:s.validate||this._compile(s);var a=Gs.call(this,e,r),n,i,o;return a&&(n=a.schema,e=a.root,o=a.baseId),n instanceof Qs?i=n.validate||t.call(this,n.schema,e,void 0,o):n!==void 0&&(i=_o(n,this._opts.inlineRefs)?n:t.call(this,n,e,void 0,o)),i}function Gs(t,e){var r=Xa.parse(e),s=Au(r),a=Ys(this._getId(t.schema));if(Object.keys(t.schema).length===0||s!==a){var n=Er(s),i=this._refs[n];if(typeof i=="string")return p_.call(this,t,i,r);if(i instanceof Qs)i.validate||this._compile(i),t=i;else if(i=this._schemas[n],i instanceof Qs){if(i.validate||this._compile(i),n==Er(e))return{schema:i,root:t,baseId:a};t=i}else return;if(!t.schema)return;a=Ys(this._getId(t.schema))}return Nu.call(this,r,a,t.schema,t)}function p_(t,e,r){var s=Gs.call(this,t,e);if(s){var a=s.schema,n=s.baseId;t=s.root;var i=this._getId(a);return i&&(n=Xs(n,i)),Nu.call(this,r,n,a,t)}}var m_=Js.toHash(["properties","patternProperties","enum","dependencies","definitions"]);function Nu(t,e,r,s){if(t.fragment=t.fragment||"",t.fragment.slice(0,1)=="/"){for(var a=t.fragment.split("/"),n=1;n<a.length;n++){var i=a[n];if(i){if(i=Js.unescapeFragment(i),r=r[i],r===void 0)break;var o;if(!m_[i]&&(o=this._getId(r),o&&(e=Xs(e,o)),r.$ref)){var l=Xs(e,r.$ref),c=Gs.call(this,s,l);c&&(r=c.schema,s=c.root,e=c.baseId)}}}if(r!==void 0&&r!==s.schema)return{schema:r,root:s,baseId:e}}}var v_=Js.toHash(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum"]);function _o(t,e){if(e===!1)return!1;if(e===void 0||e===!0)return yo(t);if(e)return wo(t)<=e}function yo(t){var e;if(Array.isArray(t)){for(var r=0;r<t.length;r++)if(e=t[r],typeof e=="object"&&!yo(e))return!1}else for(var s in t)if(s=="$ref"||(e=t[s],typeof e=="object"&&!yo(e)))return!1;return!0}function wo(t){var e=0,r;if(Array.isArray(t)){for(var s=0;s<t.length;s++)if(r=t[s],typeof r=="object"&&(e+=wo(r)),e==1/0)return 1/0}else for(var a in t){if(a=="$ref")return 1/0;if(v_[a])e++;else if(r=t[a],typeof r=="object"&&(e+=wo(r)+1),e==1/0)return 1/0}return e}function Ys(t,e){e!==!1&&(t=Er(t));var r=Xa.parse(t);return Au(r)}function Au(t){return Xa.serialize(t).split("#")[0]+"#"}var g_=/#\/?$/;function Er(t){return t?t.replace(g_,""):""}function Xs(t,e){return e=Er(e),Xa.resolve(t,e)}function __(t){var e=Er(this._getId(t)),r={"":e},s={"":Ys(e,!1)},a={},n=this;return h_(t,{allKeys:!0},function(i,o,l,c,u,d,g){if(o!==""){var f=n._getId(i),m=r[c],p=s[c]+"/"+u;if(g!==void 0&&(p+="/"+(typeof g=="number"?g:Js.escapeFragment(g))),typeof f=="string"){f=m=Er(m?Xa.resolve(m,f):f);var h=n._refs[f];if(typeof h=="string"&&(h=n._refs[h]),h&&h.schema){if(!Cu(i,h.schema))throw new Error('id "'+f+'" resolves to more than one schema')}else if(f!=Er(p))if(f[0]=="#"){if(a[f]&&!Cu(i,a[f]))throw new Error('id "'+f+'" resolves to more than one schema');a[f]=i}else n._refs[f]=p}r[o]=m,s[o]=p}}),a}var bo=go,$o={Validation:ju(y_),MissingRef:ju(Po)};function y_(t){this.message="validation failed",this.errors=t,this.ajv=this.validation=!0}Po.message=function(t,e){return"can't resolve reference "+e+" from id "+t};function Po(t,e,r){this.message=r||Po.message(t,e),this.missingRef=bo.url(t,e),this.missingSchema=bo.normalizeId(bo.fullPath(this.missingRef))}function ju(t){return t.prototype=Object.create(Error.prototype),t.prototype.constructor=t,t}var Du=function(t,e){e||(e={}),typeof e=="function"&&(e={cmp:e});var r=typeof e.cycles=="boolean"?e.cycles:!1,s=e.cmp&&function(n){return function(i){return function(o,l){var c={key:o,value:i[o]},u={key:l,value:i[l]};return n(c,u)}}}(e.cmp),a=[];return function n(i){if(i&&i.toJSON&&typeof i.toJSON=="function"&&(i=i.toJSON()),i!==void 0){if(typeof i=="number")return isFinite(i)?""+i:"null";if(typeof i!="object")return JSON.stringify(i);var o,l;if(Array.isArray(i)){for(l="[",o=0;o<i.length;o++)o&&(l+=","),l+=n(i[o])||"null";return l+"]"}if(i===null)return"null";if(a.indexOf(i)!==-1){if(r)return JSON.stringify("__cycle__");throw new TypeError("Converting circular structure to JSON")}var c=a.push(i)-1,u=Object.keys(i).sort(s&&s(i));for(l="",o=0;o<u.length;o++){var d=u[o],g=n(i[d]);g&&(l&&(l+=","),l+=JSON.stringify(d)+":"+g)}return a.splice(c,1),"{"+l+"}"}}(t)},Mu=function(e,r,s){var a="",n=e.schema.$async===!0,i=e.util.schemaHasRulesExcept(e.schema,e.RULES.all,"$ref"),o=e.self._getId(e.schema);if(e.opts.strictKeywords){var l=e.util.schemaUnknownRules(e.schema,e.RULES.keywords);if(l){var c="unknown keyword: "+l;if(e.opts.strictKeywords==="log")e.logger.warn(c);else throw new Error(c)}}if(e.isTop&&(a+=" var validate = ",n&&(e.async=!0,a+="async "),a+="function(data, dataPath, parentData, parentDataProperty, rootData) { 'use strict'; ",o&&(e.opts.sourceCode||e.opts.processCode)&&(a+=" "+("/*# sourceURL="+o+" */")+" ")),typeof e.schema=="boolean"||!(i||e.schema.$ref)){var r="false schema",u=e.level,d=e.dataLevel,g=e.schema[r],f=e.schemaPath+e.util.getProperty(r),m=e.errSchemaPath+"/"+r,x=!e.opts.allErrors,U,p="data"+(d||""),S="valid"+u;if(e.schema===!1){e.isTop?x=!0:a+=" var "+S+" = false; ";var h=h||[];h.push(a),a="",e.createErrors!==!1?(a+=" { keyword: '"+(U||"false schema")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(m)+" , params: {} ",e.opts.messages!==!1&&(a+=" , message: 'boolean schema is false' "),e.opts.verbose&&(a+=" , schema: false , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),a+=" } "):a+=" {} ";var v=a;a=h.pop(),!e.compositeRule&&x?e.async?a+=" throw new ValidationError(["+v+"]); ":a+=" validate.errors = ["+v+"]; return false; ":a+=" var err = "+v+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "}else e.isTop?n?a+=" return data; ":a+=" validate.errors = null; return true; ":a+=" var "+S+" = true; ";return e.isTop&&(a+=" }; return validate; "),a}if(e.isTop){var w=e.isTop,u=e.level=0,d=e.dataLevel=0,p="data";if(e.rootId=e.resolve.fullPath(e.self._getId(e.root.schema)),e.baseId=e.baseId||e.rootId,delete e.isTop,e.dataPathArr=[""],e.schema.default!==void 0&&e.opts.useDefaults&&e.opts.strictDefaults){var P="default is ignored in the schema root";if(e.opts.strictDefaults==="log")e.logger.warn(P);else throw new Error(P)}a+=" var vErrors = null; ",a+=" var errors = 0; ",a+=" if (rootData === undefined) rootData = data; "}else{var u=e.level,d=e.dataLevel,p="data"+(d||"");if(o&&(e.baseId=e.resolve.url(e.baseId,o)),n&&!e.async)throw new Error("async schema in sync schema");a+=" var errs_"+u+" = errors;"}var S="valid"+u,x=!e.opts.allErrors,A="",z="",U,D=e.schema.type,W=Array.isArray(D);if(D&&e.opts.nullable&&e.schema.nullable===!0&&(W?D.indexOf("null")==-1&&(D=D.concat("null")):D!="null"&&(D=[D,"null"],W=!0)),W&&D.length==1&&(D=D[0],W=!1),e.schema.$ref&&i){if(e.opts.extendRefs=="fail")throw new Error('$ref: validation keywords used in schema at path "'+e.errSchemaPath+'" (see option extendRefs)');e.opts.extendRefs!==!0&&(i=!1,e.logger.warn('$ref: keywords ignored in schema at path "'+e.errSchemaPath+'"'))}if(e.schema.$comment&&e.opts.$comment&&(a+=" "+e.RULES.all.$comment.code(e,"$comment")),D){if(e.opts.coerceTypes)var J=e.util.coerceToTypes(e.opts.coerceTypes,D);var H=e.RULES.types[D];if(J||W||H===!0||H&&!ze(H)){var f=e.schemaPath+".type",m=e.errSchemaPath+"/type",f=e.schemaPath+".type",m=e.errSchemaPath+"/type",F=W?"checkDataTypes":"checkDataType";if(a+=" if ("+e.util[F](D,p,e.opts.strictNumbers,!0)+") { ",J){var M="dataType"+u,te="coerced"+u;a+=" var "+M+" = typeof "+p+"; var "+te+" = undefined; ",e.opts.coerceTypes=="array"&&(a+=" if ("+M+" == 'object' && Array.isArray("+p+") && "+p+".length == 1) { "+p+" = "+p+"[0]; "+M+" = typeof "+p+"; if ("+e.util.checkDataType(e.schema.type,p,e.opts.strictNumbers)+") "+te+" = "+p+"; } "),a+=" if ("+te+" !== undefined) ; ";var ye=J;if(ye)for(var ve,be=-1,de=ye.length-1;be<de;)ve=ye[be+=1],ve=="string"?a+=" else if ("+M+" == 'number' || "+M+" == 'boolean') "+te+" = '' + "+p+"; else if ("+p+" === null) "+te+" = ''; ":ve=="number"||ve=="integer"?(a+=" else if ("+M+" == 'boolean' || "+p+" === null || ("+M+" == 'string' && "+p+" && "+p+" == +"+p+" ",ve=="integer"&&(a+=" && !("+p+" % 1)"),a+=")) "+te+" = +"+p+"; "):ve=="boolean"?a+=" else if ("+p+" === 'false' || "+p+" === 0 || "+p+" === null) "+te+" = false; else if ("+p+" === 'true' || "+p+" === 1) "+te+" = true; ":ve=="null"?a+=" else if ("+p+" === '' || "+p+" === 0 || "+p+" === false) "+te+" = null; ":e.opts.coerceTypes=="array"&&ve=="array"&&(a+=" else if ("+M+" == 'string' || "+M+" == 'number' || "+M+" == 'boolean' || "+p+" == null) "+te+" = ["+p+"]; ");a+=" else { ";var h=h||[];h.push(a),a="",e.createErrors!==!1?(a+=" { keyword: '"+(U||"type")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(m)+" , params: { type: '",W?a+=""+D.join(","):a+=""+D,a+="' } ",e.opts.messages!==!1&&(a+=" , message: 'should be ",W?a+=""+D.join(","):a+=""+D,a+="' "),e.opts.verbose&&(a+=" , schema: validate.schema"+f+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),a+=" } "):a+=" {} ";var v=a;a=h.pop(),!e.compositeRule&&x?e.async?a+=" throw new ValidationError(["+v+"]); ":a+=" validate.errors = ["+v+"]; return false; ":a+=" var err = "+v+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",a+=" } if ("+te+" !== undefined) { ";var N=d?"data"+(d-1||""):"parentData",R=d?e.dataPathArr[d]:"parentDataProperty";a+=" "+p+" = "+te+"; ",d||(a+="if ("+N+" !== undefined)"),a+=" "+N+"["+R+"] = "+te+"; } "}else{var h=h||[];h.push(a),a="",e.createErrors!==!1?(a+=" { keyword: '"+(U||"type")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(m)+" , params: { type: '",W?a+=""+D.join(","):a+=""+D,a+="' } ",e.opts.messages!==!1&&(a+=" , message: 'should be ",W?a+=""+D.join(","):a+=""+D,a+="' "),e.opts.verbose&&(a+=" , schema: validate.schema"+f+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),a+=" } "):a+=" {} ";var v=a;a=h.pop(),!e.compositeRule&&x?e.async?a+=" throw new ValidationError(["+v+"]); ":a+=" validate.errors = ["+v+"]; return false; ":a+=" var err = "+v+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "}a+=" } "}}if(e.schema.$ref&&!i)a+=" "+e.RULES.all.$ref.code(e,"$ref")+" ",x&&(a+=" } if (errors === ",w?a+="0":a+="errs_"+u,a+=") { ",z+="}");else{var j=e.RULES;if(j){for(var H,k=-1,_=j.length-1;k<_;)if(H=j[k+=1],ze(H)){if(H.type&&(a+=" if ("+e.util.checkDataType(H.type,p,e.opts.strictNumbers)+") { "),e.opts.useDefaults){if(H.type=="object"&&e.schema.properties){var g=e.schema.properties,b=Object.keys(g),C=b;if(C)for(var K,Q=-1,fe=C.length-1;Q<fe;){K=C[Q+=1];var ne=g[K];if(ne.default!==void 0){var he=p+e.util.getProperty(K);if(e.compositeRule){if(e.opts.strictDefaults){var P="default is ignored for: "+he;if(e.opts.strictDefaults==="log")e.logger.warn(P);else throw new Error(P)}}else a+=" if ("+he+" === undefined ",e.opts.useDefaults=="empty"&&(a+=" || "+he+" === null || "+he+" === '' "),a+=" ) "+he+" = ",e.opts.useDefaults=="shared"?a+=" "+e.useDefault(ne.default)+" ":a+=" "+JSON.stringify(ne.default)+" ",a+="; "}}}else if(H.type=="array"&&Array.isArray(e.schema.items)){var lt=e.schema.items;if(lt){for(var ne,be=-1,Ke=lt.length-1;be<Ke;)if(ne=lt[be+=1],ne.default!==void 0){var he=p+"["+be+"]";if(e.compositeRule){if(e.opts.strictDefaults){var P="default is ignored for: "+he;if(e.opts.strictDefaults==="log")e.logger.warn(P);else throw new Error(P)}}else a+=" if ("+he+" === undefined ",e.opts.useDefaults=="empty"&&(a+=" || "+he+" === null || "+he+" === '' "),a+=" ) "+he+" = ",e.opts.useDefaults=="shared"?a+=" "+e.useDefault(ne.default)+" ":a+=" "+JSON.stringify(ne.default)+" ",a+="; "}}}}var Ie=H.rules;if(Ie){for(var Et,Ge=-1,Gt=Ie.length-1;Ge<Gt;)if(Et=Ie[Ge+=1],St(Et)){var Ft=Et.code(e,Et.keyword,H.type);Ft&&(a+=" "+Ft+" ",x&&(A+="}"))}}if(x&&(a+=" "+A+" ",A=""),H.type&&(a+=" } ",D&&D===H.type&&!J)){a+=" else { ";var f=e.schemaPath+".type",m=e.errSchemaPath+"/type",h=h||[];h.push(a),a="",e.createErrors!==!1?(a+=" { keyword: '"+(U||"type")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(m)+" , params: { type: '",W?a+=""+D.join(","):a+=""+D,a+="' } ",e.opts.messages!==!1&&(a+=" , message: 'should be ",W?a+=""+D.join(","):a+=""+D,a+="' "),e.opts.verbose&&(a+=" , schema: validate.schema"+f+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),a+=" } "):a+=" {} ";var v=a;a=h.pop(),!e.compositeRule&&x?e.async?a+=" throw new ValidationError(["+v+"]); ":a+=" validate.errors = ["+v+"]; return false; ":a+=" var err = "+v+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",a+=" } "}x&&(a+=" if (errors === ",w?a+="0":a+="errs_"+u,a+=") { ",z+="}")}}}x&&(a+=" "+z+" "),w?(n?(a+=" if (errors === 0) return data; ",a+=" else throw new ValidationError(vErrors); "):(a+=" validate.errors = vErrors; ",a+=" return errors === 0; "),a+=" }; return validate;"):a+=" var "+S+" = errors === errs_"+u+";";function ze(qe){for(var Ue=qe.rules,tt=0;tt<Ue.length;tt++)if(St(Ue[tt]))return!0}function St(qe){return e.schema[qe.keyword]!==void 0||qe.implements&&ur(qe)}function ur(qe){for(var Ue=qe.implements,tt=0;tt<Ue.length;tt++)if(e.schema[Ue[tt]]!==void 0)return!0}return a},en=go,tn=ua,Lu=$o,w_=Du,Fu=Mu,b_=tn.ucs2length,$_=Pa,P_=Lu.Validation,E_=Eo;function Eo(t,e,r,s){var a=this,n=this._opts,i=[void 0],o={},l=[],c={},u=[],d={},g=[];e=e||{schema:t,refVal:i,refs:o};var f=S_.call(this,t,e,s),m=this._compilations[f.index];if(f.compiling)return m.callValidate=P;var p=this._formats,h=this.RULES;try{var v=S(t,e,r,s);m.validate=v;var w=m.callValidate;return w&&(w.schema=v.schema,w.errors=null,w.refs=v.refs,w.refVal=v.refVal,w.root=v.root,w.$async=v.$async,n.sourceCode&&(w.source=v.source)),v}finally{R_.call(this,t,e,s)}function P(){var F=m.validate,M=F.apply(this,arguments);return P.errors=F.errors,M}function S(F,M,te,ye){var ve=!M||M&&M.schema==F;if(M.schema!=e.schema)return Eo.call(a,F,M,te,ye);var be=F.$async===!0,de=Fu({isTop:!0,schema:F,isRoot:ve,baseId:ye,root:M,schemaPath:"",errSchemaPath:"#",errorPath:'""',MissingRefError:Lu.MissingRef,RULES:h,validate:Fu,util:tn,resolve:en,resolveRef:x,usePattern:W,useDefault:J,useCustomRule:H,opts:n,formats:p,logger:a.logger,self:a});de=rn(i,I_)+rn(l,x_)+rn(u,k_)+rn(g,T_)+de,n.processCode&&(de=n.processCode(de,F));var N;try{var R=new Function("self","RULES","formats","root","refVal","defaults","customRules","equal","ucs2length","ValidationError",de);N=R(a,h,p,e,i,u,g,$_,b_,P_),i[0]=N}catch(j){throw a.logger.error("Error compiling schema, function code:",de),j}return N.schema=F,N.errors=null,N.refs=o,N.refVal=i,N.root=ve?N:M,be&&(N.$async=!0),n.sourceCode===!0&&(N.source={code:de,patterns:l,defaults:u}),N}function x(F,M,te){M=en.url(F,M);var ye=o[M],ve,be;if(ye!==void 0)return ve=i[ye],be="refVal["+ye+"]",D(ve,be);if(!te&&e.refs){var de=e.refs[M];if(de!==void 0)return ve=e.refVal[de],be=A(M,ve),D(ve,be)}be=A(M);var N=en.call(a,S,e,M);if(N===void 0){var R=r&&r[M];R&&(N=en.inlineRef(R,n.inlineRefs)?R:Eo.call(a,R,e,r,F))}if(N===void 0)z(M);else return U(M,N),D(N,be)}function A(F,M){var te=i.length;return i[te]=M,o[F]=te,"refVal"+te}function z(F){delete o[F]}function U(F,M){var te=o[F];i[te]=M}function D(F,M){return typeof F=="object"||typeof F=="boolean"?{code:M,schema:F,inline:!0}:{code:M,$async:F&&!!F.$async}}function W(F){var M=c[F];return M===void 0&&(M=c[F]=l.length,l[M]=F),"pattern"+M}function J(F){switch(typeof F){case"boolean":case"number":return""+F;case"string":return tn.toQuotedString(F);case"object":if(F===null)return"null";var M=w_(F),te=d[M];return te===void 0&&(te=d[M]=u.length,u[te]=F),"default"+te}}function H(F,M,te,ye){if(a._opts.validateSchema!==!1){var ve=F.definition.dependencies;if(ve&&!ve.every(function(C){return Object.prototype.hasOwnProperty.call(te,C)}))throw new Error("parent schema must have all required keywords: "+ve.join(","));var be=F.definition.validateSchema;if(be){var de=be(M);if(!de){var N="keyword schema is invalid: "+a.errorsText(be.errors);if(a._opts.validateSchema=="log")a.logger.error(N);else throw new Error(N)}}}var R=F.definition.compile,j=F.definition.inline,k=F.definition.macro,_;if(R)_=R.call(a,M,te,ye);else if(k)_=k.call(a,M,te,ye),n.validateSchema!==!1&&a.validateSchema(_,!0);else if(j)_=j.call(a,ye,F.keyword,M,te);else if(_=F.definition.validate,!_)return;if(_===void 0)throw new Error('custom keyword "'+F.keyword+'"failed to compile');var b=g.length;return g[b]=_,{code:"customRule"+b,validate:_}}}function S_(t,e,r){var s=qu.call(this,t,e,r);return s>=0?{index:s,compiling:!0}:(s=this._compilations.length,this._compilations[s]={schema:t,root:e,baseId:r},{index:s,compiling:!1})}function R_(t,e,r){var s=qu.call(this,t,e,r);s>=0&&this._compilations.splice(s,1)}function qu(t,e,r){for(var s=0;s<this._compilations.length;s++){var a=this._compilations[s];if(a.schema==t&&a.root==e&&a.baseId==r)return s}return-1}function x_(t,e){return"var pattern"+t+" = new RegExp("+tn.toQuotedString(e[t])+");"}function k_(t){return"var default"+t+" = defaults["+t+"];"}function I_(t,e){return e[t]===void 0?"":"var refVal"+t+" = refVal["+t+"];"}function T_(t){return"var customRule"+t+" = customRules["+t+"];"}function rn(t,e){if(!t.length)return"";for(var r="",s=0;s<t.length;s++)r+=e(s,t);return r}var Uu={exports:{}},an=Uu.exports=function(){this._cache={}};an.prototype.put=function(e,r){this._cache[e]=r},an.prototype.get=function(e){return this._cache[e]},an.prototype.del=function(e){delete this._cache[e]},an.prototype.clear=function(){this._cache={}};var O_=Uu.exports,C_=ua,N_=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,A_=[0,31,28,31,30,31,30,31,31,30,31,30,31],j_=/^(\d\d):(\d\d):(\d\d)(\.\d+)?(z|[+-]\d\d(?::?\d\d)?)?$/i,Vu=/^(?=.{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,D_=/^(?:[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,M_=/^(?:[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,zu=/^(?:(?:[^\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,Hu=/^(?:(?:http[s\u017F]?|ftp):\/\/)(?:(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+(?::(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*)?@)?(?:(?!10(?:\.[0-9]{1,3}){3})(?!127(?:\.[0-9]{1,3}){3})(?!169\.254(?:\.[0-9]{1,3}){2})(?!192\.168(?:\.[0-9]{1,3}){2})(?!172\.(?:1[6-9]|2[0-9]|3[01])(?:\.[0-9]{1,3}){2})(?:[1-9][0-9]?|1[0-9][0-9]|2[01][0-9]|22[0-3])(?:\.(?:1?[0-9]{1,2}|2[0-4][0-9]|25[0-5])){2}(?:\.(?:[1-9][0-9]?|1[0-9][0-9]|2[0-4][0-9]|25[0-4]))|(?:(?:(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+-)*(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+)(?:\.(?:(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+-)*(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+)*(?:\.(?:(?:[a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]){2,})))(?::[0-9]{2,5})?(?:\/(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*)?$/i,Zu=/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,Ku=/^(?:\/(?:[^~/]|~0|~1)*)*$/,Bu=/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,Wu=/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,L_=sn;function sn(t){return t=t=="full"?"full":"fast",C_.copy(sn[t])}sn.fast={date:/^\d\d\d\d-[0-1]\d-[0-3]\d$/,time:/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,"date-time":/^\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,uri:/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i,"uri-reference":/^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,"uri-template":zu,url:Hu,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,hostname:Vu,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/,ipv6:/^\s*(?:(?:(?:[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}))|:)))(?:%.+)?\s*$/i,regex:Gu,uuid:Zu,"json-pointer":Ku,"json-pointer-uri-fragment":Bu,"relative-json-pointer":Wu},sn.full={date:Ju,time:Qu,"date-time":U_,uri:z_,"uri-reference":M_,"uri-template":zu,url:Hu,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:Vu,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/,ipv6:/^\s*(?:(?:(?:[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}))|:)))(?:%.+)?\s*$/i,regex:Gu,uuid:Zu,"json-pointer":Ku,"json-pointer-uri-fragment":Bu,"relative-json-pointer":Wu};function F_(t){return t%4===0&&(t%100!==0||t%400===0)}function Ju(t){var e=t.match(N_);if(!e)return!1;var r=+e[1],s=+e[2],a=+e[3];return s>=1&&s<=12&&a>=1&&a<=(s==2&&F_(r)?29:A_[s])}function Qu(t,e){var r=t.match(j_);if(!r)return!1;var s=r[1],a=r[2],n=r[3],i=r[5];return(s<=23&&a<=59&&n<=59||s==23&&a==59&&n==60)&&(!e||i)}var q_=/t|\s/i;function U_(t){var e=t.split(q_);return e.length==2&&Ju(e[0])&&Qu(e[1],!0)}var V_=/\/|:/;function z_(t){return V_.test(t)&&D_.test(t)}var H_=/[^\\]\\Z/;function Gu(t){if(H_.test(t))return!1;try{return new RegExp(t),!0}catch{return!1}}var Z_=function(e,r,s){var a=" ",n=e.level,i=e.dataLevel,o=e.schema[r],l=e.errSchemaPath+"/"+r,c=!e.opts.allErrors,u="data"+(i||""),d="valid"+n,g,f;if(o=="#"||o=="#/")e.isRoot?(g=e.async,f="validate"):(g=e.root.schema.$async===!0,f="root.refVal[0]");else{var m=e.resolveRef(e.baseId,o,e.isRoot);if(m===void 0){var p=e.MissingRefError.message(e.baseId,o);if(e.opts.missingRefs=="fail"){e.logger.error(p);var h=h||[];h.push(a),a="",e.createErrors!==!1?(a+=" { keyword: '$ref' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(l)+" , params: { ref: '"+e.util.escapeQuotes(o)+"' } ",e.opts.messages!==!1&&(a+=" , message: 'can\\'t resolve reference "+e.util.escapeQuotes(o)+"' "),e.opts.verbose&&(a+=" , schema: "+e.util.toQuotedString(o)+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+u+" "),a+=" } "):a+=" {} ";var v=a;a=h.pop(),!e.compositeRule&&c?e.async?a+=" throw new ValidationError(["+v+"]); ":a+=" validate.errors = ["+v+"]; return false; ":a+=" var err = "+v+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",c&&(a+=" if (false) { ")}else if(e.opts.missingRefs=="ignore")e.logger.warn(p),c&&(a+=" if (true) { ");else throw new e.MissingRefError(e.baseId,o,p)}else if(m.inline){var w=e.util.copy(e);w.level++;var P="valid"+w.level;w.schema=m.schema,w.schemaPath="",w.errSchemaPath=o;var S=e.validate(w).replace(/validate\.schema/g,m.code);a+=" "+S+" ",c&&(a+=" if ("+P+") { ")}else g=m.$async===!0||e.async&&m.$async!==!1,f=m.code}if(f){var h=h||[];h.push(a),a="",e.opts.passContext?a+=" "+f+".call(this, ":a+=" "+f+"( ",a+=" "+u+", (dataPath || '')",e.errorPath!='""'&&(a+=" + "+e.errorPath);var x=i?"data"+(i-1||""):"parentData",A=i?e.dataPathArr[i]:"parentDataProperty";a+=" , "+x+" , "+A+", rootData) ";var z=a;if(a=h.pop(),g){if(!e.async)throw new Error("async schema referenced by sync schema");c&&(a+=" var "+d+"; "),a+=" try { await "+z+"; ",c&&(a+=" "+d+" = true; "),a+=" } catch (e) { if (!(e instanceof ValidationError)) throw e; if (vErrors === null) vErrors = e.errors; else vErrors = vErrors.concat(e.errors); errors = vErrors.length; ",c&&(a+=" "+d+" = false; "),a+=" } ",c&&(a+=" if ("+d+") { ")}else a+=" if (!"+z+") { if (vErrors === null) vErrors = "+f+".errors; else vErrors = vErrors.concat("+f+".errors); errors = vErrors.length; } ",c&&(a+=" else { ")}return a},K_=function(e,r,s){var a=" ",n=e.schema[r],i=e.schemaPath+e.util.getProperty(r),o=e.errSchemaPath+"/"+r,l=!e.opts.allErrors,c=e.util.copy(e),u="";c.level++;var d="valid"+c.level,g=c.baseId,f=!0,m=n;if(m)for(var p,h=-1,v=m.length-1;h<v;)p=m[h+=1],(e.opts.strictKeywords?typeof p=="object"&&Object.keys(p).length>0||p===!1:e.util.schemaHasRules(p,e.RULES.all))&&(f=!1,c.schema=p,c.schemaPath=i+"["+h+"]",c.errSchemaPath=o+"/"+h,a+=" "+e.validate(c)+" ",c.baseId=g,l&&(a+=" if ("+d+") { ",u+="}"));return l&&(f?a+=" if (true) { ":a+=" "+u.slice(0,-1)+" "),a},B_=function(e,r,s){var a=" ",n=e.level,i=e.dataLevel,o=e.schema[r],l=e.schemaPath+e.util.getProperty(r),c=e.errSchemaPath+"/"+r,u=!e.opts.allErrors,d="data"+(i||""),g="valid"+n,f="errs__"+n,m=e.util.copy(e),p="";m.level++;var h="valid"+m.level,v=o.every(function(U){return e.opts.strictKeywords?typeof U=="object"&&Object.keys(U).length>0||U===!1:e.util.schemaHasRules(U,e.RULES.all)});if(v){var w=m.baseId;a+=" var "+f+" = errors; var "+g+" = false; ";var P=e.compositeRule;e.compositeRule=m.compositeRule=!0;var S=o;if(S)for(var x,A=-1,z=S.length-1;A<z;)x=S[A+=1],m.schema=x,m.schemaPath=l+"["+A+"]",m.errSchemaPath=c+"/"+A,a+=" "+e.validate(m)+" ",m.baseId=w,a+=" "+g+" = "+g+" || "+h+"; if (!"+g+") { ",p+="}";e.compositeRule=m.compositeRule=P,a+=" "+p+" if (!"+g+") { var err = ",e.createErrors!==!1?(a+=" { keyword: 'anyOf' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: {} ",e.opts.messages!==!1&&(a+=" , message: 'should match some schema in anyOf' "),e.opts.verbose&&(a+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),a+=" } "):a+=" {} ",a+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!e.compositeRule&&u&&(e.async?a+=" throw new ValidationError(vErrors); ":a+=" validate.errors = vErrors; return false; "),a+=" } else { errors = "+f+"; if (vErrors !== null) { if ("+f+") vErrors.length = "+f+"; else vErrors = null; } ",e.opts.allErrors&&(a+=" } ")}else u&&(a+=" if (true) { ");return a},W_=function(e,r,s){var a=" ",n=e.schema[r],i=e.errSchemaPath+"/"+r;e.opts.allErrors;var o=e.util.toQuotedString(n);return e.opts.$comment===!0?a+=" console.log("+o+");":typeof e.opts.$comment=="function"&&(a+=" self._opts.$comment("+o+", "+e.util.toQuotedString(i)+", validate.root.schema);"),a},J_=function(e,r,s){var a=" ",n=e.level,i=e.dataLevel,o=e.schema[r],l=e.schemaPath+e.util.getProperty(r),c=e.errSchemaPath+"/"+r,u=!e.opts.allErrors,d="data"+(i||""),g="valid"+n,f=e.opts.$data&&o&&o.$data;f&&(a+=" var schema"+n+" = "+e.util.getData(o.$data,i,e.dataPathArr)+"; "),f||(a+=" var schema"+n+" = validate.schema"+l+";"),a+="var "+g+" = equal("+d+", schema"+n+"); if (!"+g+") { ";var m=m||[];m.push(a),a="",e.createErrors!==!1?(a+=" { keyword: 'const' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { allowedValue: schema"+n+" } ",e.opts.messages!==!1&&(a+=" , message: 'should be equal to constant' "),e.opts.verbose&&(a+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),a+=" } "):a+=" {} ";var p=a;return a=m.pop(),!e.compositeRule&&u?e.async?a+=" throw new ValidationError(["+p+"]); ":a+=" validate.errors = ["+p+"]; return false; ":a+=" var err = "+p+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",a+=" }",u&&(a+=" else { "),a},Q_=function(e,r,s){var a=" ",n=e.level,i=e.dataLevel,o=e.schema[r],l=e.schemaPath+e.util.getProperty(r),c=e.errSchemaPath+"/"+r,u=!e.opts.allErrors,d="data"+(i||""),g="valid"+n,f="errs__"+n,m=e.util.copy(e),p="";m.level++;var h="valid"+m.level,v="i"+n,w=m.dataLevel=e.dataLevel+1,P="data"+w,S=e.baseId,x=e.opts.strictKeywords?typeof o=="object"&&Object.keys(o).length>0||o===!1:e.util.schemaHasRules(o,e.RULES.all);if(a+="var "+f+" = errors;var "+g+";",x){var A=e.compositeRule;e.compositeRule=m.compositeRule=!0,m.schema=o,m.schemaPath=l,m.errSchemaPath=c,a+=" var "+h+" = false; for (var "+v+" = 0; "+v+" < "+d+".length; "+v+"++) { ",m.errorPath=e.util.getPathExpr(e.errorPath,v,e.opts.jsonPointers,!0);var z=d+"["+v+"]";m.dataPathArr[w]=v;var U=e.validate(m);m.baseId=S,e.util.varOccurences(U,P)<2?a+=" "+e.util.varReplace(U,P,z)+" ":a+=" var "+P+" = "+z+"; "+U+" ",a+=" if ("+h+") break; } ",e.compositeRule=m.compositeRule=A,a+=" "+p+" if (!"+h+") {"}else a+=" if ("+d+".length == 0) {";var D=D||[];D.push(a),a="",e.createErrors!==!1?(a+=" { keyword: 'contains' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: {} ",e.opts.messages!==!1&&(a+=" , message: 'should contain a valid item' "),e.opts.verbose&&(a+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),a+=" } "):a+=" {} ";var W=a;return a=D.pop(),!e.compositeRule&&u?e.async?a+=" throw new ValidationError(["+W+"]); ":a+=" validate.errors = ["+W+"]; return false; ":a+=" var err = "+W+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",a+=" } else { ",x&&(a+=" errors = "+f+"; if (vErrors !== null) { if ("+f+") vErrors.length = "+f+"; else vErrors = null; } "),e.opts.allErrors&&(a+=" } "),a},G_=function(e,r,s){var a=" ",n=e.level,i=e.dataLevel,o=e.schema[r],l=e.schemaPath+e.util.getProperty(r),c=e.errSchemaPath+"/"+r,u=!e.opts.allErrors,d="data"+(i||""),g="errs__"+n,f=e.util.copy(e),m="";f.level++;var p="valid"+f.level,h={},v={},w=e.opts.ownProperties;for(A in o)if(A!="__proto__"){var P=o[A],S=Array.isArray(P)?v:h;S[A]=P}a+="var "+g+" = errors;";var x=e.errorPath;a+="var missing"+n+";";for(var A in v)if(S=v[A],S.length){if(a+=" if ( "+d+e.util.getProperty(A)+" !== undefined ",w&&(a+=" && Object.prototype.hasOwnProperty.call("+d+", '"+e.util.escapeQuotes(A)+"') "),u){a+=" && ( ";var z=S;if(z)for(var U,D=-1,W=z.length-1;D<W;){U=z[D+=1],D&&(a+=" || ");var J=e.util.getProperty(U),H=d+J;a+=" ( ( "+H+" === undefined ",w&&(a+=" || ! Object.prototype.hasOwnProperty.call("+d+", '"+e.util.escapeQuotes(U)+"') "),a+=") && (missing"+n+" = "+e.util.toQuotedString(e.opts.jsonPointers?U:J)+") ) "}a+=")) { ";var F="missing"+n,M="' + "+F+" + '";e.opts._errorDataPathProperty&&(e.errorPath=e.opts.jsonPointers?e.util.getPathExpr(x,F,!0):x+" + "+F);var te=te||[];te.push(a),a="",e.createErrors!==!1?(a+=" { keyword: 'dependencies' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { property: '"+e.util.escapeQuotes(A)+"', missingProperty: '"+M+"', depsCount: "+S.length+", deps: '"+e.util.escapeQuotes(S.length==1?S[0]:S.join(", "))+"' } ",e.opts.messages!==!1&&(a+=" , message: 'should have ",S.length==1?a+="property "+e.util.escapeQuotes(S[0]):a+="properties "+e.util.escapeQuotes(S.join(", ")),a+=" when property "+e.util.escapeQuotes(A)+" is present' "),e.opts.verbose&&(a+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),a+=" } "):a+=" {} ";var ye=a;a=te.pop(),!e.compositeRule&&u?e.async?a+=" throw new ValidationError(["+ye+"]); ":a+=" validate.errors = ["+ye+"]; return false; ":a+=" var err = "+ye+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "}else{a+=" ) { ";var ve=S;if(ve)for(var U,be=-1,de=ve.length-1;be<de;){U=ve[be+=1];var J=e.util.getProperty(U),M=e.util.escapeQuotes(U),H=d+J;e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPath(x,U,e.opts.jsonPointers)),a+=" if ( "+H+" === undefined ",w&&(a+=" || ! Object.prototype.hasOwnProperty.call("+d+", '"+e.util.escapeQuotes(U)+"') "),a+=") { var err = ",e.createErrors!==!1?(a+=" { keyword: 'dependencies' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { property: '"+e.util.escapeQuotes(A)+"', missingProperty: '"+M+"', depsCount: "+S.length+", deps: '"+e.util.escapeQuotes(S.length==1?S[0]:S.join(", "))+"' } ",e.opts.messages!==!1&&(a+=" , message: 'should have ",S.length==1?a+="property "+e.util.escapeQuotes(S[0]):a+="properties "+e.util.escapeQuotes(S.join(", ")),a+=" when property "+e.util.escapeQuotes(A)+" is present' "),e.opts.verbose&&(a+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),a+=" } "):a+=" {} ",a+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } "}}a+=" } ",u&&(m+="}",a+=" else { ")}e.errorPath=x;var N=f.baseId;for(var A in h){var P=h[A];(e.opts.strictKeywords?typeof P=="object"&&Object.keys(P).length>0||P===!1:e.util.schemaHasRules(P,e.RULES.all))&&(a+=" "+p+" = true; if ( "+d+e.util.getProperty(A)+" !== undefined ",w&&(a+=" && Object.prototype.hasOwnProperty.call("+d+", '"+e.util.escapeQuotes(A)+"') "),a+=") { ",f.schema=P,f.schemaPath=l+e.util.getProperty(A),f.errSchemaPath=c+"/"+e.util.escapeFragment(A),a+=" "+e.validate(f)+" ",f.baseId=N,a+=" } ",u&&(a+=" if ("+p+") { ",m+="}"))}return u&&(a+=" "+m+" if ("+g+" == errors) {"),a},Y_=function(e,r,s){var a=" ",n=e.level,i=e.dataLevel,o=e.schema[r],l=e.schemaPath+e.util.getProperty(r),c=e.errSchemaPath+"/"+r,u=!e.opts.allErrors,d="data"+(i||""),g="valid"+n,f=e.opts.$data&&o&&o.$data;f&&(a+=" var schema"+n+" = "+e.util.getData(o.$data,i,e.dataPathArr)+"; ");var m="i"+n,p="schema"+n;f||(a+=" var "+p+" = validate.schema"+l+";"),a+="var "+g+";",f&&(a+=" if (schema"+n+" === undefined) "+g+" = true; else if (!Array.isArray(schema"+n+")) "+g+" = false; else {"),a+=""+g+" = false;for (var "+m+"=0; "+m+"<"+p+".length; "+m+"++) if (equal("+d+", "+p+"["+m+"])) { "+g+" = true; break; }",f&&(a+=" } "),a+=" if (!"+g+") { ";var h=h||[];h.push(a),a="",e.createErrors!==!1?(a+=" { keyword: 'enum' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { allowedValues: schema"+n+" } ",e.opts.messages!==!1&&(a+=" , message: 'should be equal to one of the allowed values' "),e.opts.verbose&&(a+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),a+=" } "):a+=" {} ";var v=a;return a=h.pop(),!e.compositeRule&&u?e.async?a+=" throw new ValidationError(["+v+"]); ":a+=" validate.errors = ["+v+"]; return false; ":a+=" var err = "+v+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",a+=" }",u&&(a+=" else { "),a},X_=function(e,r,s){var a=" ",n=e.level,i=e.dataLevel,o=e.schema[r],l=e.schemaPath+e.util.getProperty(r),c=e.errSchemaPath+"/"+r,u=!e.opts.allErrors,d="data"+(i||"");if(e.opts.format===!1)return u&&(a+=" if (true) { "),a;var g=e.opts.$data&&o&&o.$data,f;g?(a+=" var schema"+n+" = "+e.util.getData(o.$data,i,e.dataPathArr)+"; ",f="schema"+n):f=o;var m=e.opts.unknownFormats,p=Array.isArray(m);if(g){var h="format"+n,v="isObject"+n,w="formatType"+n;a+=" var "+h+" = formats["+f+"]; var "+v+" = typeof "+h+" == 'object' && !("+h+" instanceof RegExp) && "+h+".validate; var "+w+" = "+v+" && "+h+".type || 'string'; if ("+v+") { ",e.async&&(a+=" var async"+n+" = "+h+".async; "),a+=" "+h+" = "+h+".validate; } if ( ",g&&(a+=" ("+f+" !== undefined && typeof "+f+" != 'string') || "),a+=" (",m!="ignore"&&(a+=" ("+f+" && !"+h+" ",p&&(a+=" && self._opts.unknownFormats.indexOf("+f+") == -1 "),a+=") || "),a+=" ("+h+" && "+w+" == '"+s+"' && !(typeof "+h+" == 'function' ? ",e.async?a+=" (async"+n+" ? await "+h+"("+d+") : "+h+"("+d+")) ":a+=" "+h+"("+d+") ",a+=" : "+h+".test("+d+"))))) {"}else{var h=e.formats[o];if(!h){if(m=="ignore")return e.logger.warn('unknown format "'+o+'" ignored in schema at path "'+e.errSchemaPath+'"'),u&&(a+=" if (true) { "),a;if(p&&m.indexOf(o)>=0)return u&&(a+=" if (true) { "),a;throw new Error('unknown format "'+o+'" is used in schema at path "'+e.errSchemaPath+'"')}var v=typeof h=="object"&&!(h instanceof RegExp)&&h.validate,w=v&&h.type||"string";if(v){var P=h.async===!0;h=h.validate}if(w!=s)return u&&(a+=" if (true) { "),a;if(P){if(!e.async)throw new Error("async format in sync schema");var S="formats"+e.util.getProperty(o)+".validate";a+=" if (!(await "+S+"("+d+"))) { "}else{a+=" if (! ";var S="formats"+e.util.getProperty(o);v&&(S+=".validate"),typeof h=="function"?a+=" "+S+"("+d+") ":a+=" "+S+".test("+d+") ",a+=") { "}}var x=x||[];x.push(a),a="",e.createErrors!==!1?(a+=" { keyword: 'format' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { format: ",g?a+=""+f:a+=""+e.util.toQuotedString(o),a+=" } ",e.opts.messages!==!1&&(a+=` , message: 'should match format "`,g?a+="' + "+f+" + '":a+=""+e.util.escapeQuotes(o),a+=`"' `),e.opts.verbose&&(a+=" , schema: ",g?a+="validate.schema"+l:a+=""+e.util.toQuotedString(o),a+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),a+=" } "):a+=" {} ";var A=a;return a=x.pop(),!e.compositeRule&&u?e.async?a+=" throw new ValidationError(["+A+"]); ":a+=" validate.errors = ["+A+"]; return false; ":a+=" var err = "+A+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",a+=" } ",u&&(a+=" else { "),a},ey=function(e,r,s){var a=" ",n=e.level,i=e.dataLevel,o=e.schema[r],l=e.schemaPath+e.util.getProperty(r),c=e.errSchemaPath+"/"+r,u=!e.opts.allErrors,d="data"+(i||""),g="valid"+n,f="errs__"+n,m=e.util.copy(e);m.level++;var p="valid"+m.level,h=e.schema.then,v=e.schema.else,w=h!==void 0&&(e.opts.strictKeywords?typeof h=="object"&&Object.keys(h).length>0||h===!1:e.util.schemaHasRules(h,e.RULES.all)),P=v!==void 0&&(e.opts.strictKeywords?typeof v=="object"&&Object.keys(v).length>0||v===!1:e.util.schemaHasRules(v,e.RULES.all)),S=m.baseId;if(w||P){var x;m.createErrors=!1,m.schema=o,m.schemaPath=l,m.errSchemaPath=c,a+=" var "+f+" = errors; var "+g+" = true; ";var A=e.compositeRule;e.compositeRule=m.compositeRule=!0,a+=" "+e.validate(m)+" ",m.baseId=S,m.createErrors=!0,a+=" errors = "+f+"; if (vErrors !== null) { if ("+f+") vErrors.length = "+f+"; else vErrors = null; } ",e.compositeRule=m.compositeRule=A,w?(a+=" if ("+p+") { ",m.schema=e.schema.then,m.schemaPath=e.schemaPath+".then",m.errSchemaPath=e.errSchemaPath+"/then",a+=" "+e.validate(m)+" ",m.baseId=S,a+=" "+g+" = "+p+"; ",w&&P?(x="ifClause"+n,a+=" var "+x+" = 'then'; "):x="'then'",a+=" } ",P&&(a+=" else { ")):a+=" if (!"+p+") { ",P&&(m.schema=e.schema.else,m.schemaPath=e.schemaPath+".else",m.errSchemaPath=e.errSchemaPath+"/else",a+=" "+e.validate(m)+" ",m.baseId=S,a+=" "+g+" = "+p+"; ",w&&P?(x="ifClause"+n,a+=" var "+x+" = 'else'; "):x="'else'",a+=" } "),a+=" if (!"+g+") { var err = ",e.createErrors!==!1?(a+=" { keyword: 'if' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { failingKeyword: "+x+" } ",e.opts.messages!==!1&&(a+=` , message: 'should match "' + `+x+` + '" schema' `),e.opts.verbose&&(a+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),a+=" } "):a+=" {} ",a+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!e.compositeRule&&u&&(e.async?a+=" throw new ValidationError(vErrors); ":a+=" validate.errors = vErrors; return false; "),a+=" } ",u&&(a+=" else { ")}else u&&(a+=" if (true) { ");return a},ty=function(e,r,s){var a=" ",n=e.level,i=e.dataLevel,o=e.schema[r],l=e.schemaPath+e.util.getProperty(r),c=e.errSchemaPath+"/"+r,u=!e.opts.allErrors,d="data"+(i||""),g="valid"+n,f="errs__"+n,m=e.util.copy(e),p="";m.level++;var h="valid"+m.level,v="i"+n,w=m.dataLevel=e.dataLevel+1,P="data"+w,S=e.baseId;if(a+="var "+f+" = errors;var "+g+";",Array.isArray(o)){var x=e.schema.additionalItems;if(x===!1){a+=" "+g+" = "+d+".length <= "+o.length+"; ";var A=c;c=e.errSchemaPath+"/additionalItems",a+=" if (!"+g+") { ";var z=z||[];z.push(a),a="",e.createErrors!==!1?(a+=" { keyword: 'additionalItems' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { limit: "+o.length+" } ",e.opts.messages!==!1&&(a+=" , message: 'should NOT have more than "+o.length+" items' "),e.opts.verbose&&(a+=" , schema: false , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),a+=" } "):a+=" {} ";var U=a;a=z.pop(),!e.compositeRule&&u?e.async?a+=" throw new ValidationError(["+U+"]); ":a+=" validate.errors = ["+U+"]; return false; ":a+=" var err = "+U+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",a+=" } ",c=A,u&&(p+="}",a+=" else { ")}var D=o;if(D){for(var W,J=-1,H=D.length-1;J<H;)if(W=D[J+=1],e.opts.strictKeywords?typeof W=="object"&&Object.keys(W).length>0||W===!1:e.util.schemaHasRules(W,e.RULES.all)){a+=" "+h+" = true; if ("+d+".length > "+J+") { ";var F=d+"["+J+"]";m.schema=W,m.schemaPath=l+"["+J+"]",m.errSchemaPath=c+"/"+J,m.errorPath=e.util.getPathExpr(e.errorPath,J,e.opts.jsonPointers,!0),m.dataPathArr[w]=J;var M=e.validate(m);m.baseId=S,e.util.varOccurences(M,P)<2?a+=" "+e.util.varReplace(M,P,F)+" ":a+=" var "+P+" = "+F+"; "+M+" ",a+=" } ",u&&(a+=" if ("+h+") { ",p+="}")}}if(typeof x=="object"&&(e.opts.strictKeywords?typeof x=="object"&&Object.keys(x).length>0||x===!1:e.util.schemaHasRules(x,e.RULES.all))){m.schema=x,m.schemaPath=e.schemaPath+".additionalItems",m.errSchemaPath=e.errSchemaPath+"/additionalItems",a+=" "+h+" = true; if ("+d+".length > "+o.length+") { for (var "+v+" = "+o.length+"; "+v+" < "+d+".length; "+v+"++) { ",m.errorPath=e.util.getPathExpr(e.errorPath,v,e.opts.jsonPointers,!0);var F=d+"["+v+"]";m.dataPathArr[w]=v;var M=e.validate(m);m.baseId=S,e.util.varOccurences(M,P)<2?a+=" "+e.util.varReplace(M,P,F)+" ":a+=" var "+P+" = "+F+"; "+M+" ",u&&(a+=" if (!"+h+") break; "),a+=" } } ",u&&(a+=" if ("+h+") { ",p+="}")}}else if(e.opts.strictKeywords?typeof o=="object"&&Object.keys(o).length>0||o===!1:e.util.schemaHasRules(o,e.RULES.all)){m.schema=o,m.schemaPath=l,m.errSchemaPath=c,a+=" for (var "+v+" = 0; "+v+" < "+d+".length; "+v+"++) { ",m.errorPath=e.util.getPathExpr(e.errorPath,v,e.opts.jsonPointers,!0);var F=d+"["+v+"]";m.dataPathArr[w]=v;var M=e.validate(m);m.baseId=S,e.util.varOccurences(M,P)<2?a+=" "+e.util.varReplace(M,P,F)+" ":a+=" var "+P+" = "+F+"; "+M+" ",u&&(a+=" if (!"+h+") break; "),a+=" }"}return u&&(a+=" "+p+" if ("+f+" == errors) {"),a},Yu=function(e,r,s){var a=" ",n=e.level,i=e.dataLevel,o=e.schema[r],l=e.schemaPath+e.util.getProperty(r),c=e.errSchemaPath+"/"+r,u=!e.opts.allErrors,S,d="data"+(i||""),g=e.opts.$data&&o&&o.$data,f;g?(a+=" var schema"+n+" = "+e.util.getData(o.$data,i,e.dataPathArr)+"; ",f="schema"+n):f=o;var m=r=="maximum",p=m?"exclusiveMaximum":"exclusiveMinimum",h=e.schema[p],v=e.opts.$data&&h&&h.$data,w=m?"<":">",P=m?">":"<",S=void 0;if(!(g||typeof o=="number"||o===void 0))throw new Error(r+" must be number");if(!(v||h===void 0||typeof h=="number"||typeof h=="boolean"))throw new Error(p+" must be number or boolean");if(v){var x=e.util.getData(h.$data,i,e.dataPathArr),A="exclusive"+n,z="exclType"+n,U="exclIsNumber"+n,D="op"+n,W="' + "+D+" + '";a+=" var schemaExcl"+n+" = "+x+"; ",x="schemaExcl"+n,a+=" var "+A+"; var "+z+" = typeof "+x+"; if ("+z+" != 'boolean' && "+z+" != 'undefined' && "+z+" != 'number') { ";var S=p,J=J||[];J.push(a),a="",e.createErrors!==!1?(a+=" { keyword: '"+(S||"_exclusiveLimit")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: {} ",e.opts.messages!==!1&&(a+=" , message: '"+p+" should be boolean' "),e.opts.verbose&&(a+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),a+=" } "):a+=" {} ";var H=a;a=J.pop(),!e.compositeRule&&u?e.async?a+=" throw new ValidationError(["+H+"]); ":a+=" validate.errors = ["+H+"]; return false; ":a+=" var err = "+H+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",a+=" } else if ( ",g&&(a+=" ("+f+" !== undefined && typeof "+f+" != 'number') || "),a+=" "+z+" == 'number' ? ( ("+A+" = "+f+" === undefined || "+x+" "+w+"= "+f+") ? "+d+" "+P+"= "+x+" : "+d+" "+P+" "+f+" ) : ( ("+A+" = "+x+" === true) ? "+d+" "+P+"= "+f+" : "+d+" "+P+" "+f+" ) || "+d+" !== "+d+") { var op"+n+" = "+A+" ? '"+w+"' : '"+w+"='; ",o===void 0&&(S=p,c=e.errSchemaPath+"/"+p,f=x,g=v)}else{var U=typeof h=="number",W=w;if(U&&g){var D="'"+W+"'";a+=" if ( ",g&&(a+=" ("+f+" !== undefined && typeof "+f+" != 'number') || "),a+=" ( "+f+" === undefined || "+h+" "+w+"= "+f+" ? "+d+" "+P+"= "+h+" : "+d+" "+P+" "+f+" ) || "+d+" !== "+d+") { "}else{U&&o===void 0?(A=!0,S=p,c=e.errSchemaPath+"/"+p,f=h,P+="="):(U&&(f=Math[m?"min":"max"](h,o)),h===(U?f:!0)?(A=!0,S=p,c=e.errSchemaPath+"/"+p,P+="="):(A=!1,W+="="));var D="'"+W+"'";a+=" if ( ",g&&(a+=" ("+f+" !== undefined && typeof "+f+" != 'number') || "),a+=" "+d+" "+P+" "+f+" || "+d+" !== "+d+") { "}}S=S||r;var J=J||[];J.push(a),a="",e.createErrors!==!1?(a+=" { keyword: '"+(S||"_limit")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { comparison: "+D+", limit: "+f+", exclusive: "+A+" } ",e.opts.messages!==!1&&(a+=" , message: 'should be "+W+" ",g?a+="' + "+f:a+=""+f+"'"),e.opts.verbose&&(a+=" , schema: ",g?a+="validate.schema"+l:a+=""+o,a+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),a+=" } "):a+=" {} ";var H=a;return a=J.pop(),!e.compositeRule&&u?e.async?a+=" throw new ValidationError(["+H+"]); ":a+=" validate.errors = ["+H+"]; return false; ":a+=" var err = "+H+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",a+=" } ",u&&(a+=" else { "),a},Xu=function(e,r,s){var a=" ",n=e.level,i=e.dataLevel,o=e.schema[r],l=e.schemaPath+e.util.getProperty(r),c=e.errSchemaPath+"/"+r,u=!e.opts.allErrors,p,d="data"+(i||""),g=e.opts.$data&&o&&o.$data,f;if(g?(a+=" var schema"+n+" = "+e.util.getData(o.$data,i,e.dataPathArr)+"; ",f="schema"+n):f=o,!(g||typeof o=="number"))throw new Error(r+" must be number");var m=r=="maxItems"?">":"<";a+="if ( ",g&&(a+=" ("+f+" !== undefined && typeof "+f+" != 'number') || "),a+=" "+d+".length "+m+" "+f+") { ";var p=r,h=h||[];h.push(a),a="",e.createErrors!==!1?(a+=" { keyword: '"+(p||"_limitItems")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { limit: "+f+" } ",e.opts.messages!==!1&&(a+=" , message: 'should NOT have ",r=="maxItems"?a+="more":a+="fewer",a+=" than ",g?a+="' + "+f+" + '":a+=""+o,a+=" items' "),e.opts.verbose&&(a+=" , schema: ",g?a+="validate.schema"+l:a+=""+o,a+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),a+=" } "):a+=" {} ";var v=a;return a=h.pop(),!e.compositeRule&&u?e.async?a+=" throw new ValidationError(["+v+"]); ":a+=" validate.errors = ["+v+"]; return false; ":a+=" var err = "+v+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",a+="} ",u&&(a+=" else { "),a},ed=function(e,r,s){var a=" ",n=e.level,i=e.dataLevel,o=e.schema[r],l=e.schemaPath+e.util.getProperty(r),c=e.errSchemaPath+"/"+r,u=!e.opts.allErrors,p,d="data"+(i||""),g=e.opts.$data&&o&&o.$data,f;if(g?(a+=" var schema"+n+" = "+e.util.getData(o.$data,i,e.dataPathArr)+"; ",f="schema"+n):f=o,!(g||typeof o=="number"))throw new Error(r+" must be number");var m=r=="maxLength"?">":"<";a+="if ( ",g&&(a+=" ("+f+" !== undefined && typeof "+f+" != 'number') || "),e.opts.unicode===!1?a+=" "+d+".length ":a+=" ucs2length("+d+") ",a+=" "+m+" "+f+") { ";var p=r,h=h||[];h.push(a),a="",e.createErrors!==!1?(a+=" { keyword: '"+(p||"_limitLength")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { limit: "+f+" } ",e.opts.messages!==!1&&(a+=" , message: 'should NOT be ",r=="maxLength"?a+="longer":a+="shorter",a+=" than ",g?a+="' + "+f+" + '":a+=""+o,a+=" characters' "),e.opts.verbose&&(a+=" , schema: ",g?a+="validate.schema"+l:a+=""+o,a+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),a+=" } "):a+=" {} ";var v=a;return a=h.pop(),!e.compositeRule&&u?e.async?a+=" throw new ValidationError(["+v+"]); ":a+=" validate.errors = ["+v+"]; return false; ":a+=" var err = "+v+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",a+="} ",u&&(a+=" else { "),a},td=function(e,r,s){var a=" ",n=e.level,i=e.dataLevel,o=e.schema[r],l=e.schemaPath+e.util.getProperty(r),c=e.errSchemaPath+"/"+r,u=!e.opts.allErrors,p,d="data"+(i||""),g=e.opts.$data&&o&&o.$data,f;if(g?(a+=" var schema"+n+" = "+e.util.getData(o.$data,i,e.dataPathArr)+"; ",f="schema"+n):f=o,!(g||typeof o=="number"))throw new Error(r+" must be number");var m=r=="maxProperties"?">":"<";a+="if ( ",g&&(a+=" ("+f+" !== undefined && typeof "+f+" != 'number') || "),a+=" Object.keys("+d+").length "+m+" "+f+") { ";var p=r,h=h||[];h.push(a),a="",e.createErrors!==!1?(a+=" { keyword: '"+(p||"_limitProperties")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { limit: "+f+" } ",e.opts.messages!==!1&&(a+=" , message: 'should NOT have ",r=="maxProperties"?a+="more":a+="fewer",a+=" than ",g?a+="' + "+f+" + '":a+=""+o,a+=" properties' "),e.opts.verbose&&(a+=" , schema: ",g?a+="validate.schema"+l:a+=""+o,a+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),a+=" } "):a+=" {} ";var v=a;return a=h.pop(),!e.compositeRule&&u?e.async?a+=" throw new ValidationError(["+v+"]); ":a+=" validate.errors = ["+v+"]; return false; ":a+=" var err = "+v+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",a+="} ",u&&(a+=" else { "),a},ry=function(e,r,s){var a=" ",n=e.level,i=e.dataLevel,o=e.schema[r],l=e.schemaPath+e.util.getProperty(r),c=e.errSchemaPath+"/"+r,u=!e.opts.allErrors,d="data"+(i||""),g=e.opts.$data&&o&&o.$data,f;if(g?(a+=" var schema"+n+" = "+e.util.getData(o.$data,i,e.dataPathArr)+"; ",f="schema"+n):f=o,!(g||typeof o=="number"))throw new Error(r+" must be number");a+="var division"+n+";if (",g&&(a+=" "+f+" !== undefined && ( typeof "+f+" != 'number' || "),a+=" (division"+n+" = "+d+" / "+f+", ",e.opts.multipleOfPrecision?a+=" Math.abs(Math.round(division"+n+") - division"+n+") > 1e-"+e.opts.multipleOfPrecision+" ":a+=" division"+n+" !== parseInt(division"+n+") ",a+=" ) ",g&&(a+=" ) "),a+=" ) { ";var m=m||[];m.push(a),a="",e.createErrors!==!1?(a+=" { keyword: 'multipleOf' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { multipleOf: "+f+" } ",e.opts.messages!==!1&&(a+=" , message: 'should be multiple of ",g?a+="' + "+f:a+=""+f+"'"),e.opts.verbose&&(a+=" , schema: ",g?a+="validate.schema"+l:a+=""+o,a+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),a+=" } "):a+=" {} ";var p=a;return a=m.pop(),!e.compositeRule&&u?e.async?a+=" throw new ValidationError(["+p+"]); ":a+=" validate.errors = ["+p+"]; return false; ":a+=" var err = "+p+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",a+="} ",u&&(a+=" else { "),a},ay=function(e,r,s){var a=" ",n=e.level,i=e.dataLevel,o=e.schema[r],l=e.schemaPath+e.util.getProperty(r),c=e.errSchemaPath+"/"+r,u=!e.opts.allErrors,d="data"+(i||""),g="errs__"+n,f=e.util.copy(e);f.level++;var m="valid"+f.level;if(e.opts.strictKeywords?typeof o=="object"&&Object.keys(o).length>0||o===!1:e.util.schemaHasRules(o,e.RULES.all)){f.schema=o,f.schemaPath=l,f.errSchemaPath=c,a+=" var "+g+" = errors; ";var p=e.compositeRule;e.compositeRule=f.compositeRule=!0,f.createErrors=!1;var h;f.opts.allErrors&&(h=f.opts.allErrors,f.opts.allErrors=!1),a+=" "+e.validate(f)+" ",f.createErrors=!0,h&&(f.opts.allErrors=h),e.compositeRule=f.compositeRule=p,a+=" if ("+m+") { ";var v=v||[];v.push(a),a="",e.createErrors!==!1?(a+=" { keyword: 'not' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: {} ",e.opts.messages!==!1&&(a+=" , message: 'should NOT be valid' "),e.opts.verbose&&(a+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),a+=" } "):a+=" {} ";var w=a;a=v.pop(),!e.compositeRule&&u?e.async?a+=" throw new ValidationError(["+w+"]); ":a+=" validate.errors = ["+w+"]; return false; ":a+=" var err = "+w+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",a+=" } else { errors = "+g+"; if (vErrors !== null) { if ("+g+") vErrors.length = "+g+"; else vErrors = null; } ",e.opts.allErrors&&(a+=" } ")}else a+=" var err = ",e.createErrors!==!1?(a+=" { keyword: 'not' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: {} ",e.opts.messages!==!1&&(a+=" , message: 'should NOT be valid' "),e.opts.verbose&&(a+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),a+=" } "):a+=" {} ",a+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",u&&(a+=" if (false) { ");return a},sy=function(e,r,s){var a=" ",n=e.level,i=e.dataLevel,o=e.schema[r],l=e.schemaPath+e.util.getProperty(r),c=e.errSchemaPath+"/"+r,u=!e.opts.allErrors,d="data"+(i||""),g="valid"+n,f="errs__"+n,m=e.util.copy(e),p="";m.level++;var h="valid"+m.level,v=m.baseId,w="prevValid"+n,P="passingSchemas"+n;a+="var "+f+" = errors , "+w+" = false , "+g+" = false , "+P+" = null; ";var S=e.compositeRule;e.compositeRule=m.compositeRule=!0;var x=o;if(x)for(var A,z=-1,U=x.length-1;z<U;)A=x[z+=1],(e.opts.strictKeywords?typeof A=="object"&&Object.keys(A).length>0||A===!1:e.util.schemaHasRules(A,e.RULES.all))?(m.schema=A,m.schemaPath=l+"["+z+"]",m.errSchemaPath=c+"/"+z,a+=" "+e.validate(m)+" ",m.baseId=v):a+=" var "+h+" = true; ",z&&(a+=" if ("+h+" && "+w+") { "+g+" = false; "+P+" = ["+P+", "+z+"]; } else { ",p+="}"),a+=" if ("+h+") { "+g+" = "+w+" = true; "+P+" = "+z+"; }";return e.compositeRule=m.compositeRule=S,a+=""+p+"if (!"+g+") { var err = ",e.createErrors!==!1?(a+=" { keyword: 'oneOf' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { passingSchemas: "+P+" } ",e.opts.messages!==!1&&(a+=" , message: 'should match exactly one schema in oneOf' "),e.opts.verbose&&(a+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),a+=" } "):a+=" {} ",a+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!e.compositeRule&&u&&(e.async?a+=" throw new ValidationError(vErrors); ":a+=" validate.errors = vErrors; return false; "),a+="} else { errors = "+f+"; if (vErrors !== null) { if ("+f+") vErrors.length = "+f+"; else vErrors = null; }",e.opts.allErrors&&(a+=" } "),a},ny=function(e,r,s){var a=" ",n=e.level,i=e.dataLevel,o=e.schema[r],l=e.schemaPath+e.util.getProperty(r),c=e.errSchemaPath+"/"+r,u=!e.opts.allErrors,d="data"+(i||""),g=e.opts.$data&&o&&o.$data,f;g?(a+=" var schema"+n+" = "+e.util.getData(o.$data,i,e.dataPathArr)+"; ",f="schema"+n):f=o;var m=g?"(new RegExp("+f+"))":e.usePattern(o);a+="if ( ",g&&(a+=" ("+f+" !== undefined && typeof "+f+" != 'string') || "),a+=" !"+m+".test("+d+") ) { ";var p=p||[];p.push(a),a="",e.createErrors!==!1?(a+=" { keyword: 'pattern' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { pattern: ",g?a+=""+f:a+=""+e.util.toQuotedString(o),a+=" } ",e.opts.messages!==!1&&(a+=` , message: 'should match pattern "`,g?a+="' + "+f+" + '":a+=""+e.util.escapeQuotes(o),a+=`"' `),e.opts.verbose&&(a+=" , schema: ",g?a+="validate.schema"+l:a+=""+e.util.toQuotedString(o),a+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),a+=" } "):a+=" {} ";var h=a;return a=p.pop(),!e.compositeRule&&u?e.async?a+=" throw new ValidationError(["+h+"]); ":a+=" validate.errors = ["+h+"]; return false; ":a+=" var err = "+h+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",a+="} ",u&&(a+=" else { "),a},iy=function(e,r,s){var a=" ",n=e.level,i=e.dataLevel,o=e.schema[r],l=e.schemaPath+e.util.getProperty(r),c=e.errSchemaPath+"/"+r,u=!e.opts.allErrors,d="data"+(i||""),g="errs__"+n,f=e.util.copy(e),m="";f.level++;var p="valid"+f.level,h="key"+n,v="idx"+n,w=f.dataLevel=e.dataLevel+1,P="data"+w,S="dataProperties"+n,x=Object.keys(o||{}).filter(be),A=e.schema.patternProperties||{},z=Object.keys(A).filter(be),U=e.schema.additionalProperties,D=x.length||z.length,W=U===!1,J=typeof U=="object"&&Object.keys(U).length,H=e.opts.removeAdditional,F=W||J||H,M=e.opts.ownProperties,te=e.baseId,ye=e.schema.required;if(ye&&!(e.opts.$data&&ye.$data)&&ye.length<e.opts.loopRequired)var ve=e.util.toHash(ye);function be(Vr){return Vr!=="__proto__"}if(a+="var "+g+" = errors;var "+p+" = true;",M&&(a+=" var "+S+" = undefined;"),F){if(M?a+=" "+S+" = "+S+" || Object.keys("+d+"); for (var "+v+"=0; "+v+"<"+S+".length; "+v+"++) { var "+h+" = "+S+"["+v+"]; ":a+=" for (var "+h+" in "+d+") { ",D){if(a+=" var isAdditional"+n+" = !(false ",x.length)if(x.length>8)a+=" || validate.schema"+l+".hasOwnProperty("+h+") ";else{var de=x;if(de)for(var N,R=-1,j=de.length-1;R<j;)N=de[R+=1],a+=" || "+h+" == "+e.util.toQuotedString(N)+" "}if(z.length){var k=z;if(k)for(var _,b=-1,C=k.length-1;b<C;)_=k[b+=1],a+=" || "+e.usePattern(_)+".test("+h+") "}a+=" ); if (isAdditional"+n+") { "}if(H=="all")a+=" delete "+d+"["+h+"]; ";else{var K=e.errorPath,Q="' + "+h+" + '";if(e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPathExpr(e.errorPath,h,e.opts.jsonPointers)),W)if(H)a+=" delete "+d+"["+h+"]; ";else{a+=" "+p+" = false; ";var fe=c;c=e.errSchemaPath+"/additionalProperties";var ne=ne||[];ne.push(a),a="",e.createErrors!==!1?(a+=" { keyword: 'additionalProperties' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { additionalProperty: '"+Q+"' } ",e.opts.messages!==!1&&(a+=" , message: '",e.opts._errorDataPathProperty?a+="is an invalid additional property":a+="should NOT have additional properties",a+="' "),e.opts.verbose&&(a+=" , schema: false , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),a+=" } "):a+=" {} ";var he=a;a=ne.pop(),!e.compositeRule&&u?e.async?a+=" throw new ValidationError(["+he+"]); ":a+=" validate.errors = ["+he+"]; return false; ":a+=" var err = "+he+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",c=fe,u&&(a+=" break; ")}else if(J)if(H=="failing"){a+=" var "+g+" = errors; ";var lt=e.compositeRule;e.compositeRule=f.compositeRule=!0,f.schema=U,f.schemaPath=e.schemaPath+".additionalProperties",f.errSchemaPath=e.errSchemaPath+"/additionalProperties",f.errorPath=e.opts._errorDataPathProperty?e.errorPath:e.util.getPathExpr(e.errorPath,h,e.opts.jsonPointers);var Ke=d+"["+h+"]";f.dataPathArr[w]=h;var Ie=e.validate(f);f.baseId=te,e.util.varOccurences(Ie,P)<2?a+=" "+e.util.varReplace(Ie,P,Ke)+" ":a+=" var "+P+" = "+Ke+"; "+Ie+" ",a+=" if (!"+p+") { errors = "+g+"; if (validate.errors !== null) { if (errors) validate.errors.length = errors; else validate.errors = null; } delete "+d+"["+h+"]; } ",e.compositeRule=f.compositeRule=lt}else{f.schema=U,f.schemaPath=e.schemaPath+".additionalProperties",f.errSchemaPath=e.errSchemaPath+"/additionalProperties",f.errorPath=e.opts._errorDataPathProperty?e.errorPath:e.util.getPathExpr(e.errorPath,h,e.opts.jsonPointers);var Ke=d+"["+h+"]";f.dataPathArr[w]=h;var Ie=e.validate(f);f.baseId=te,e.util.varOccurences(Ie,P)<2?a+=" "+e.util.varReplace(Ie,P,Ke)+" ":a+=" var "+P+" = "+Ke+"; "+Ie+" ",u&&(a+=" if (!"+p+") break; ")}e.errorPath=K}D&&(a+=" } "),a+=" } ",u&&(a+=" if ("+p+") { ",m+="}")}var Et=e.opts.useDefaults&&!e.compositeRule;if(x.length){var Ge=x;if(Ge)for(var N,Gt=-1,Ft=Ge.length-1;Gt<Ft;){N=Ge[Gt+=1];var ze=o[N];if(e.opts.strictKeywords?typeof ze=="object"&&Object.keys(ze).length>0||ze===!1:e.util.schemaHasRules(ze,e.RULES.all)){var St=e.util.getProperty(N),Ke=d+St,ur=Et&&ze.default!==void 0;f.schema=ze,f.schemaPath=l+St,f.errSchemaPath=c+"/"+e.util.escapeFragment(N),f.errorPath=e.util.getPath(e.errorPath,N,e.opts.jsonPointers),f.dataPathArr[w]=e.util.toQuotedString(N);var Ie=e.validate(f);if(f.baseId=te,e.util.varOccurences(Ie,P)<2){Ie=e.util.varReplace(Ie,P,Ke);var qe=Ke}else{var qe=P;a+=" var "+P+" = "+Ke+"; "}if(ur)a+=" "+Ie+" ";else{if(ve&&ve[N]){a+=" if ( "+qe+" === undefined ",M&&(a+=" || ! Object.prototype.hasOwnProperty.call("+d+", '"+e.util.escapeQuotes(N)+"') "),a+=") { "+p+" = false; ";var K=e.errorPath,fe=c,Ue=e.util.escapeQuotes(N);e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPath(K,N,e.opts.jsonPointers)),c=e.errSchemaPath+"/required";var ne=ne||[];ne.push(a),a="",e.createErrors!==!1?(a+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { missingProperty: '"+Ue+"' } ",e.opts.messages!==!1&&(a+=" , message: '",e.opts._errorDataPathProperty?a+="is a required property":a+="should have required property \\'"+Ue+"\\'",a+="' "),e.opts.verbose&&(a+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),a+=" } "):a+=" {} ";var he=a;a=ne.pop(),!e.compositeRule&&u?e.async?a+=" throw new ValidationError(["+he+"]); ":a+=" validate.errors = ["+he+"]; return false; ":a+=" var err = "+he+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",c=fe,e.errorPath=K,a+=" } else { "}else u?(a+=" if ( "+qe+" === undefined ",M&&(a+=" || ! Object.prototype.hasOwnProperty.call("+d+", '"+e.util.escapeQuotes(N)+"') "),a+=") { "+p+" = true; } else { "):(a+=" if ("+qe+" !== undefined ",M&&(a+=" && Object.prototype.hasOwnProperty.call("+d+", '"+e.util.escapeQuotes(N)+"') "),a+=" ) { ");a+=" "+Ie+" } "}}u&&(a+=" if ("+p+") { ",m+="}")}}if(z.length){var tt=z;if(tt)for(var _,xr=-1,dr=tt.length-1;xr<dr;){_=tt[xr+=1];var ze=A[_];if(e.opts.strictKeywords?typeof ze=="object"&&Object.keys(ze).length>0||ze===!1:e.util.schemaHasRules(ze,e.RULES.all)){f.schema=ze,f.schemaPath=e.schemaPath+".patternProperties"+e.util.getProperty(_),f.errSchemaPath=e.errSchemaPath+"/patternProperties/"+e.util.escapeFragment(_),M?a+=" "+S+" = "+S+" || Object.keys("+d+"); for (var "+v+"=0; "+v+"<"+S+".length; "+v+"++) { var "+h+" = "+S+"["+v+"]; ":a+=" for (var "+h+" in "+d+") { ",a+=" if ("+e.usePattern(_)+".test("+h+")) { ",f.errorPath=e.util.getPathExpr(e.errorPath,h,e.opts.jsonPointers);var Ke=d+"["+h+"]";f.dataPathArr[w]=h;var Ie=e.validate(f);f.baseId=te,e.util.varOccurences(Ie,P)<2?a+=" "+e.util.varReplace(Ie,P,Ke)+" ":a+=" var "+P+" = "+Ke+"; "+Ie+" ",u&&(a+=" if (!"+p+") break; "),a+=" } ",u&&(a+=" else "+p+" = true; "),a+=" } ",u&&(a+=" if ("+p+") { ",m+="}")}}}return u&&(a+=" "+m+" if ("+g+" == errors) {"),a},oy=function(e,r,s){var a=" ",n=e.level,i=e.dataLevel,o=e.schema[r],l=e.schemaPath+e.util.getProperty(r),c=e.errSchemaPath+"/"+r,u=!e.opts.allErrors,d="data"+(i||""),g="errs__"+n,f=e.util.copy(e),m="";f.level++;var p="valid"+f.level;if(a+="var "+g+" = errors;",e.opts.strictKeywords?typeof o=="object"&&Object.keys(o).length>0||o===!1:e.util.schemaHasRules(o,e.RULES.all)){f.schema=o,f.schemaPath=l,f.errSchemaPath=c;var h="key"+n,v="idx"+n,w="i"+n,P="' + "+h+" + '",S=f.dataLevel=e.dataLevel+1,x="data"+S,A="dataProperties"+n,z=e.opts.ownProperties,U=e.baseId;z&&(a+=" var "+A+" = undefined; "),z?a+=" "+A+" = "+A+" || Object.keys("+d+"); for (var "+v+"=0; "+v+"<"+A+".length; "+v+"++) { var "+h+" = "+A+"["+v+"]; ":a+=" for (var "+h+" in "+d+") { ",a+=" var startErrs"+n+" = errors; ";var D=h,W=e.compositeRule;e.compositeRule=f.compositeRule=!0;var J=e.validate(f);f.baseId=U,e.util.varOccurences(J,x)<2?a+=" "+e.util.varReplace(J,x,D)+" ":a+=" var "+x+" = "+D+"; "+J+" ",e.compositeRule=f.compositeRule=W,a+=" if (!"+p+") { for (var "+w+"=startErrs"+n+"; "+w+"<errors; "+w+"++) { vErrors["+w+"].propertyName = "+h+"; } var err = ",e.createErrors!==!1?(a+=" { keyword: 'propertyNames' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { propertyName: '"+P+"' } ",e.opts.messages!==!1&&(a+=" , message: 'property name \\'"+P+"\\' is invalid' "),e.opts.verbose&&(a+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),a+=" } "):a+=" {} ",a+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!e.compositeRule&&u&&(e.async?a+=" throw new ValidationError(vErrors); ":a+=" validate.errors = vErrors; return false; "),u&&(a+=" break; "),a+=" } }"}return u&&(a+=" "+m+" if ("+g+" == errors) {"),a},cy=function(e,r,s){var a=" ",n=e.level,i=e.dataLevel,o=e.schema[r],l=e.schemaPath+e.util.getProperty(r),c=e.errSchemaPath+"/"+r,u=!e.opts.allErrors,d="data"+(i||""),g="valid"+n,f=e.opts.$data&&o&&o.$data;f&&(a+=" var schema"+n+" = "+e.util.getData(o.$data,i,e.dataPathArr)+"; ");var m="schema"+n;if(!f)if(o.length<e.opts.loopRequired&&e.schema.properties&&Object.keys(e.schema.properties).length){var p=[],h=o;if(h)for(var v,w=-1,P=h.length-1;w<P;){v=h[w+=1];var S=e.schema.properties[v];S&&(e.opts.strictKeywords?typeof S=="object"&&Object.keys(S).length>0||S===!1:e.util.schemaHasRules(S,e.RULES.all))||(p[p.length]=v)}}else var p=o;if(f||p.length){var x=e.errorPath,A=f||p.length>=e.opts.loopRequired,z=e.opts.ownProperties;if(u)if(a+=" var missing"+n+"; ",A){f||(a+=" var "+m+" = validate.schema"+l+"; ");var U="i"+n,D="schema"+n+"["+U+"]",W="' + "+D+" + '";e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPathExpr(x,D,e.opts.jsonPointers)),a+=" var "+g+" = true; ",f&&(a+=" if (schema"+n+" === undefined) "+g+" = true; else if (!Array.isArray(schema"+n+")) "+g+" = false; else {"),a+=" for (var "+U+" = 0; "+U+" < "+m+".length; "+U+"++) { "+g+" = "+d+"["+m+"["+U+"]] !== undefined ",z&&(a+=" && Object.prototype.hasOwnProperty.call("+d+", "+m+"["+U+"]) "),a+="; if (!"+g+") break; } ",f&&(a+=" } "),a+=" if (!"+g+") { ";var J=J||[];J.push(a),a="",e.createErrors!==!1?(a+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { missingProperty: '"+W+"' } ",e.opts.messages!==!1&&(a+=" , message: '",e.opts._errorDataPathProperty?a+="is a required property":a+="should have required property \\'"+W+"\\'",a+="' "),e.opts.verbose&&(a+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),a+=" } "):a+=" {} ";var H=a;a=J.pop(),!e.compositeRule&&u?e.async?a+=" throw new ValidationError(["+H+"]); ":a+=" validate.errors = ["+H+"]; return false; ":a+=" var err = "+H+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",a+=" } else { "}else{a+=" if ( ";var F=p;if(F)for(var M,U=-1,te=F.length-1;U<te;){M=F[U+=1],U&&(a+=" || ");var ye=e.util.getProperty(M),ve=d+ye;a+=" ( ( "+ve+" === undefined ",z&&(a+=" || ! Object.prototype.hasOwnProperty.call("+d+", '"+e.util.escapeQuotes(M)+"') "),a+=") && (missing"+n+" = "+e.util.toQuotedString(e.opts.jsonPointers?M:ye)+") ) "}a+=") { ";var D="missing"+n,W="' + "+D+" + '";e.opts._errorDataPathProperty&&(e.errorPath=e.opts.jsonPointers?e.util.getPathExpr(x,D,!0):x+" + "+D);var J=J||[];J.push(a),a="",e.createErrors!==!1?(a+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { missingProperty: '"+W+"' } ",e.opts.messages!==!1&&(a+=" , message: '",e.opts._errorDataPathProperty?a+="is a required property":a+="should have required property \\'"+W+"\\'",a+="' "),e.opts.verbose&&(a+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),a+=" } "):a+=" {} ";var H=a;a=J.pop(),!e.compositeRule&&u?e.async?a+=" throw new ValidationError(["+H+"]); ":a+=" validate.errors = ["+H+"]; return false; ":a+=" var err = "+H+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",a+=" } else { "}else if(A){f||(a+=" var "+m+" = validate.schema"+l+"; ");var U="i"+n,D="schema"+n+"["+U+"]",W="' + "+D+" + '";e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPathExpr(x,D,e.opts.jsonPointers)),f&&(a+=" if ("+m+" && !Array.isArray("+m+")) { var err = ",e.createErrors!==!1?(a+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { missingProperty: '"+W+"' } ",e.opts.messages!==!1&&(a+=" , message: '",e.opts._errorDataPathProperty?a+="is a required property":a+="should have required property \\'"+W+"\\'",a+="' "),e.opts.verbose&&(a+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),a+=" } "):a+=" {} ",a+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } else if ("+m+" !== undefined) { "),a+=" for (var "+U+" = 0; "+U+" < "+m+".length; "+U+"++) { if ("+d+"["+m+"["+U+"]] === undefined ",z&&(a+=" || ! Object.prototype.hasOwnProperty.call("+d+", "+m+"["+U+"]) "),a+=") { var err = ",e.createErrors!==!1?(a+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { missingProperty: '"+W+"' } ",e.opts.messages!==!1&&(a+=" , message: '",e.opts._errorDataPathProperty?a+="is a required property":a+="should have required property \\'"+W+"\\'",a+="' "),e.opts.verbose&&(a+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),a+=" } "):a+=" {} ",a+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } } ",f&&(a+=" } ")}else{var be=p;if(be)for(var M,de=-1,N=be.length-1;de<N;){M=be[de+=1];var ye=e.util.getProperty(M),W=e.util.escapeQuotes(M),ve=d+ye;e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPath(x,M,e.opts.jsonPointers)),a+=" if ( "+ve+" === undefined ",z&&(a+=" || ! Object.prototype.hasOwnProperty.call("+d+", '"+e.util.escapeQuotes(M)+"') "),a+=") { var err = ",e.createErrors!==!1?(a+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { missingProperty: '"+W+"' } ",e.opts.messages!==!1&&(a+=" , message: '",e.opts._errorDataPathProperty?a+="is a required property":a+="should have required property \\'"+W+"\\'",a+="' "),e.opts.verbose&&(a+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),a+=" } "):a+=" {} ",a+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } "}}e.errorPath=x}else u&&(a+=" if (true) {");return a},ly=function(e,r,s){var a=" ",n=e.level,i=e.dataLevel,o=e.schema[r],l=e.schemaPath+e.util.getProperty(r),c=e.errSchemaPath+"/"+r,u=!e.opts.allErrors,d="data"+(i||""),g="valid"+n,f=e.opts.$data&&o&&o.$data,m;if(f?(a+=" var schema"+n+" = "+e.util.getData(o.$data,i,e.dataPathArr)+"; ",m="schema"+n):m=o,(o||f)&&e.opts.uniqueItems!==!1){f&&(a+=" var "+g+"; if ("+m+" === false || "+m+" === undefined) "+g+" = true; else if (typeof "+m+" != 'boolean') "+g+" = false; else { "),a+=" var i = "+d+".length , "+g+" = true , j; if (i > 1) { ";var p=e.schema.items&&e.schema.items.type,h=Array.isArray(p);if(!p||p=="object"||p=="array"||h&&(p.indexOf("object")>=0||p.indexOf("array")>=0))a+=" outer: for (;i--;) { for (j = i; j--;) { if (equal("+d+"[i], "+d+"[j])) { "+g+" = false; break outer; } } } ";else{a+=" var itemIndices = {}, item; for (;i--;) { var item = "+d+"[i]; ";var v="checkDataType"+(h?"s":"");a+=" if ("+e.util[v](p,"item",e.opts.strictNumbers,!0)+") continue; ",h&&(a+=` if (typeof item == 'string') item = '"' + item; `),a+=" if (typeof itemIndices[item] == 'number') { "+g+" = false; j = itemIndices[item]; break; } itemIndices[item] = i; } "}a+=" } ",f&&(a+=" } "),a+=" if (!"+g+") { ";var w=w||[];w.push(a),a="",e.createErrors!==!1?(a+=" { keyword: 'uniqueItems' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { i: i, j: j } ",e.opts.messages!==!1&&(a+=" , message: 'should NOT have duplicate items (items ## ' + j + ' and ' + i + ' are identical)' "),e.opts.verbose&&(a+=" , schema: ",f?a+="validate.schema"+l:a+=""+o,a+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),a+=" } "):a+=" {} ";var P=a;a=w.pop(),!e.compositeRule&&u?e.async?a+=" throw new ValidationError(["+P+"]); ":a+=" validate.errors = ["+P+"]; return false; ":a+=" var err = "+P+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",a+=" } ",u&&(a+=" else { ")}else u&&(a+=" if (true) { ");return a},uy={$ref:Z_,allOf:K_,anyOf:B_,$comment:W_,const:J_,contains:Q_,dependencies:G_,enum:Y_,format:X_,if:ey,items:ty,maximum:Yu,minimum:Yu,maxItems:Xu,minItems:Xu,maxLength:ed,minLength:ed,maxProperties:td,minProperties:td,multipleOf:ry,not:ay,oneOf:sy,pattern:ny,properties:iy,propertyNames:oy,required:cy,uniqueItems:ly,validate:Mu},rd=uy,So=ua.toHash,dy=function(){var e=[{type:"number",rules:[{maximum:["exclusiveMaximum"]},{minimum:["exclusiveMinimum"]},"multipleOf","format"]},{type:"string",rules:["maxLength","minLength","pattern","format"]},{type:"array",rules:["maxItems","minItems","items","contains","uniqueItems"]},{type:"object",rules:["maxProperties","minProperties","required","dependencies","propertyNames",{properties:["additionalProperties","patternProperties"]}]},{rules:["$ref","const","enum","not","anyOf","oneOf","allOf","if"]}],r=["type","$comment"],s=["$schema","$id","id","$data","$async","title","description","default","definitions","examples","readOnly","writeOnly","contentMediaType","contentEncoding","additionalItems","then","else"],a=["number","integer","string","array","object","boolean","null"];return e.all=So(r),e.types=So(a),e.forEach(function(n){n.rules=n.rules.map(function(i){var o;if(typeof i=="object"){var l=Object.keys(i)[0];o=i[l],i=l,o.forEach(function(u){r.push(u),e.all[u]=!0})}r.push(i);var c=e.all[i]={keyword:i,code:rd[i],implements:o};return c}),e.all.$comment={keyword:"$comment",code:rd.$comment},n.type&&(e.types[n.type]=n)}),e.keywords=So(r.concat(s)),e.custom={},e},ad=["multipleOf","maximum","exclusiveMaximum","minimum","exclusiveMinimum","maxLength","minLength","pattern","additionalItems","maxItems","minItems","uniqueItems","maxProperties","minProperties","required","additionalProperties","enum","format","const"],fy=function(t,e){for(var r=0;r<e.length;r++){t=JSON.parse(JSON.stringify(t));var s=e[r].split("/"),a=t,n;for(n=1;n<s.length;n++)a=a[s[n]];for(n=0;n<ad.length;n++){var i=ad[n],o=a[i];o&&(a[i]={anyOf:[o,{$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"}]})}}return t},hy=$o.MissingRef,py=sd;function sd(t,e,r){var s=this;if(typeof this._opts.loadSchema!="function")throw new Error("options.loadSchema should be a function");typeof e=="function"&&(r=e,e=void 0);var a=n(t).then(function(){var o=s._addSchema(t,void 0,e);return o.validate||i(o)});return r&&a.then(function(o){r(null,o)},r),a;function n(o){var l=o.$schema;return l&&!s.getSchema(l)?sd.call(s,{$ref:l},!0):Promise.resolve()}function i(o){try{return s._compile(o)}catch(c){if(c instanceof hy)return l(c);throw c}function l(c){var u=c.missingSchema;if(f(u))throw new Error("Schema "+u+" is loaded but "+c.missingRef+" cannot be resolved");var d=s._loadingSchemas[u];return d||(d=s._loadingSchemas[u]=s._opts.loadSchema(u),d.then(g,g)),d.then(function(m){if(!f(u))return n(m).then(function(){f(u)||s.addSchema(m,u,void 0,e)})}).then(function(){return i(o)});function g(){delete s._loadingSchemas[u]}function f(m){return s._refs[m]||s._schemas[m]}}}}var my=function(e,r,s){var a=" ",n=e.level,i=e.dataLevel,o=e.schema[r],l=e.schemaPath+e.util.getProperty(r),c=e.errSchemaPath+"/"+r,u=!e.opts.allErrors,d,g="data"+(i||""),f="valid"+n,m="errs__"+n,p=e.opts.$data&&o&&o.$data,h;p?(a+=" var schema"+n+" = "+e.util.getData(o.$data,i,e.dataPathArr)+"; ",h="schema"+n):h=o;var v=this,w="definition"+n,P=v.definition,S="",x,A,z,U,D;if(p&&P.$data){D="keywordValidate"+n;var W=P.validateSchema;a+=" var "+w+" = RULES.custom['"+r+"'].definition; var "+D+" = "+w+".validate;"}else{if(U=e.useCustomRule(v,o,e.schema,e),!U)return;h="validate.schema"+l,D=U.code,x=P.compile,A=P.inline,z=P.macro}var J=D+".errors",H="i"+n,F="ruleErr"+n,M=P.async;if(M&&!e.async)throw new Error("async keyword in sync schema");if(A||z||(a+=""+J+" = null;"),a+="var "+m+" = errors;var "+f+";",p&&P.$data&&(S+="}",a+=" if ("+h+" === undefined) { "+f+" = true; } else { ",W&&(S+="}",a+=" "+f+" = "+w+".validateSchema("+h+"); if ("+f+") { ")),A)P.statements?a+=" "+U.validate+" ":a+=" "+f+" = "+U.validate+"; ";else if(z){var te=e.util.copy(e),S="";te.level++;var ye="valid"+te.level;te.schema=U.validate,te.schemaPath="";var ve=e.compositeRule;e.compositeRule=te.compositeRule=!0;var be=e.validate(te).replace(/validate\.schema/g,D);e.compositeRule=te.compositeRule=ve,a+=" "+be}else{var de=de||[];de.push(a),a="",a+=" "+D+".call( ",e.opts.passContext?a+="this":a+="self",x||P.schema===!1?a+=" , "+g+" ":a+=" , "+h+" , "+g+" , validate.schema"+e.schemaPath+" ",a+=" , (dataPath || '')",e.errorPath!='""'&&(a+=" + "+e.errorPath);var N=i?"data"+(i-1||""):"parentData",R=i?e.dataPathArr[i]:"parentDataProperty";a+=" , "+N+" , "+R+" , rootData ) ";var j=a;a=de.pop(),P.errors===!1?(a+=" "+f+" = ",M&&(a+="await "),a+=""+j+"; "):M?(J="customErrors"+n,a+=" var "+J+" = null; try { "+f+" = await "+j+"; } catch (e) { "+f+" = false; if (e instanceof ValidationError) "+J+" = e.errors; else throw e; } "):a+=" "+J+" = null; "+f+" = "+j+"; "}if(P.modifying&&(a+=" if ("+N+") "+g+" = "+N+"["+R+"];"),a+=""+S,P.valid)u&&(a+=" if (true) { ");else{a+=" if ( ",P.valid===void 0?(a+=" !",z?a+=""+ye:a+=""+f):a+=" "+!P.valid+" ",a+=") { ",d=v.keyword;var de=de||[];de.push(a),a="";var de=de||[];de.push(a),a="",e.createErrors!==!1?(a+=" { keyword: '"+(d||"custom")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { keyword: '"+v.keyword+"' } ",e.opts.messages!==!1&&(a+=` , message: 'should pass "`+v.keyword+`" keyword validation' `),e.opts.verbose&&(a+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+g+" "),a+=" } "):a+=" {} ";var k=a;a=de.pop(),!e.compositeRule&&u?e.async?a+=" throw new ValidationError(["+k+"]); ":a+=" validate.errors = ["+k+"]; return false; ":a+=" var err = "+k+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";var _=a;a=de.pop(),A?P.errors?P.errors!="full"&&(a+=" for (var "+H+"="+m+"; "+H+"<errors; "+H+"++) { var "+F+" = vErrors["+H+"]; if ("+F+".dataPath === undefined) "+F+".dataPath = (dataPath || '') + "+e.errorPath+"; if ("+F+".schemaPath === undefined) { "+F+'.schemaPath = "'+c+'"; } ',e.opts.verbose&&(a+=" "+F+".schema = "+h+"; "+F+".data = "+g+"; "),a+=" } "):P.errors===!1?a+=" "+_+" ":(a+=" if ("+m+" == errors) { "+_+" } else { for (var "+H+"="+m+"; "+H+"<errors; "+H+"++) { var "+F+" = vErrors["+H+"]; if ("+F+".dataPath === undefined) "+F+".dataPath = (dataPath || '') + "+e.errorPath+"; if ("+F+".schemaPath === undefined) { "+F+'.schemaPath = "'+c+'"; } ',e.opts.verbose&&(a+=" "+F+".schema = "+h+"; "+F+".data = "+g+"; "),a+=" } } "):z?(a+=" var err = ",e.createErrors!==!1?(a+=" { keyword: '"+(d||"custom")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { keyword: '"+v.keyword+"' } ",e.opts.messages!==!1&&(a+=` , message: 'should pass "`+v.keyword+`" keyword validation' `),e.opts.verbose&&(a+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+g+" "),a+=" } "):a+=" {} ",a+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!e.compositeRule&&u&&(e.async?a+=" throw new ValidationError(vErrors); ":a+=" validate.errors = vErrors; return false; ")):P.errors===!1?a+=" "+_+" ":(a+=" if (Array.isArray("+J+")) { if (vErrors === null) vErrors = "+J+"; else vErrors = vErrors.concat("+J+"); errors = vErrors.length; for (var "+H+"="+m+"; "+H+"<errors; "+H+"++) { var "+F+" = vErrors["+H+"]; if ("+F+".dataPath === undefined) "+F+".dataPath = (dataPath || '') + "+e.errorPath+"; "+F+'.schemaPath = "'+c+'"; ',e.opts.verbose&&(a+=" "+F+".schema = "+h+"; "+F+".data = "+g+"; "),a+=" } } else { "+_+" } "),a+=" } ",u&&(a+=" else { ")}return a};const nd={$schema:"http://json-schema.org/draft-07/schema#",$id:"http://json-schema.org/draft-07/schema#",title:"Core schema meta-schema",definitions:{schemaArray:{type:"array",minItems:1,items:{$ref:"#"}},nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{allOf:[{$ref:"#/definitions/nonNegativeInteger"},{default:0}]},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}},type:["object","boolean"],properties:{$id:{type:"string",format:"uri-reference"},$schema:{type:"string",format:"uri"},$ref:{type:"string",format:"uri-reference"},$comment:{type:"string"},title:{type:"string"},description:{type:"string"},default:!0,readOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0},multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/definitions/nonNegativeInteger"},minLength:{$ref:"#/definitions/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},additionalItems:{$ref:"#"},items:{anyOf:[{$ref:"#"},{$ref:"#/definitions/schemaArray"}],default:!0},maxItems:{$ref:"#/definitions/nonNegativeInteger"},minItems:{$ref:"#/definitions/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},contains:{$ref:"#"},maxProperties:{$ref:"#/definitions/nonNegativeInteger"},minProperties:{$ref:"#/definitions/nonNegativeIntegerDefault0"},required:{$ref:"#/definitions/stringArray"},additionalProperties:{$ref:"#"},definitions:{type:"object",additionalProperties:{$ref:"#"},default:{}},properties:{type:"object",additionalProperties:{$ref:"#"},default:{}},patternProperties:{type:"object",additionalProperties:{$ref:"#"},propertyNames:{format:"regex"},default:{}},dependencies:{type:"object",additionalProperties:{anyOf:[{$ref:"#"},{$ref:"#/definitions/stringArray"}]}},propertyNames:{$ref:"#"},const:!0,enum:{type:"array",items:!0,minItems:1,uniqueItems:!0},type:{anyOf:[{$ref:"#/definitions/simpleTypes"},{type:"array",items:{$ref:"#/definitions/simpleTypes"},minItems:1,uniqueItems:!0}]},format:{type:"string"},contentMediaType:{type:"string"},contentEncoding:{type:"string"},if:{$ref:"#"},then:{$ref:"#"},else:{$ref:"#"},allOf:{$ref:"#/definitions/schemaArray"},anyOf:{$ref:"#/definitions/schemaArray"},oneOf:{$ref:"#/definitions/schemaArray"},not:{$ref:"#"}},default:!0};var id=nd,vy={$id:"https://github.com/ajv-validator/ajv/blob/master/lib/definition_schema.js",definitions:{simpleTypes:id.definitions.simpleTypes},type:"object",dependencies:{schema:["validate"],$data:["validate"],statements:["inline"],valid:{not:{required:["macro"]}}},properties:{type:id.properties.type,schema:{type:"boolean"},statements:{type:"boolean"},dependencies:{type:"array",items:{type:"string"}},metaSchema:{type:"object"},modifying:{type:"boolean"},valid:{type:"boolean"},$data:{type:"boolean"},async:{type:"boolean"},errors:{anyOf:[{type:"boolean"},{const:"full"}]}}},gy=/^[a-z_$][a-z0-9_$-]*$/i,_y=my,yy=vy,wy={add:by,get:$y,remove:Py,validate:Ro};function by(t,e){var r=this.RULES;if(r.keywords[t])throw new Error("Keyword "+t+" is already defined");if(!gy.test(t))throw new Error("Keyword "+t+" is not a valid identifier");if(e){this.validateKeyword(e,!0);var s=e.type;if(Array.isArray(s))for(var a=0;a<s.length;a++)i(t,s[a],e);else i(t,s,e);var n=e.metaSchema;n&&(e.$data&&this._opts.$data&&(n={anyOf:[n,{$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"}]}),e.validateSchema=this.compile(n,!0))}r.keywords[t]=r.all[t]=!0;function i(o,l,c){for(var u,d=0;d<r.length;d++){var g=r[d];if(g.type==l){u=g;break}}u||(u={type:l,rules:[]},r.push(u));var f={keyword:o,definition:c,custom:!0,code:_y,implements:c.implements};u.rules.push(f),r.custom[o]=f}return this}function $y(t){var e=this.RULES.custom[t];return e?e.definition:this.RULES.keywords[t]||!1}function Py(t){var e=this.RULES;delete e.keywords[t],delete e.all[t],delete e.custom[t];for(var r=0;r<e.length;r++)for(var s=e[r].rules,a=0;a<s.length;a++)if(s[a].keyword==t){s.splice(a,1);break}return this}function Ro(t,e){Ro.errors=null;var r=this._validateKeyword=this._validateKeyword||this.compile(yy,!0);if(r(t))return!0;if(Ro.errors=r.errors,e)throw new Error("custom keyword definition is invalid: "+this.errorsText(r.errors));return!1}const Ey={$schema:"http://json-schema.org/draft-07/schema#",$id:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#",description:"Meta-schema for $data reference (JSON Schema extension proposal)",type:"object",required:["$data"],properties:{$data:{type:"string",anyOf:[{format:"relative-json-pointer"},{format:"json-pointer"}]}},additionalProperties:!1};var od=E_,qr=go,Sy=O_,cd=Tu,Ry=Du,xy=L_,ky=dy,ld=fy,ud=ua,Iy=Ve;Ve.prototype.validate=Oy,Ve.prototype.compile=Cy,Ve.prototype.addSchema=Ny,Ve.prototype.addMetaSchema=Ay,Ve.prototype.validateSchema=jy,Ve.prototype.getSchema=My,Ve.prototype.removeSchema=Fy,Ve.prototype.addFormat=By,Ve.prototype.errorsText=Ky,Ve.prototype._addSchema=qy,Ve.prototype._compile=Uy,Ve.prototype.compileAsync=py;var nn=wy;Ve.prototype.addKeyword=nn.add,Ve.prototype.getKeyword=nn.get,Ve.prototype.removeKeyword=nn.remove,Ve.prototype.validateKeyword=nn.validate;var dd=$o;Ve.ValidationError=dd.Validation,Ve.MissingRefError=dd.MissingRef,Ve.$dataMetaSchema=ld;var on="http://json-schema.org/draft-07/schema",fd=["removeAdditional","useDefaults","coerceTypes","strictDefaults"],Ty=["/properties"];function Ve(t){if(!(this instanceof Ve))return new Ve(t);t=this._opts=ud.copy(t)||{},Xy(this),this._schemas={},this._refs={},this._fragments={},this._formats=xy(t.format),this._cache=t.cache||new Sy,this._loadingSchemas={},this._compilations=[],this.RULES=ky(),this._getId=Vy(t),t.loopRequired=t.loopRequired||1/0,t.errorDataPath=="property"&&(t._errorDataPathProperty=!0),t.serialize===void 0&&(t.serialize=Ry),this._metaOpts=Yy(this),t.formats&&Qy(this),t.keywords&&Gy(this),Wy(this),typeof t.meta=="object"&&this.addMetaSchema(t.meta),t.nullable&&this.addKeyword("nullable",{metaSchema:{type:"boolean"}}),Jy(this)}function Oy(t,e){var r;if(typeof t=="string"){if(r=this.getSchema(t),!r)throw new Error('no schema with key or ref "'+t+'"')}else{var s=this._addSchema(t);r=s.validate||this._compile(s)}var a=r(e);return r.$async!==!0&&(this.errors=r.errors),a}function Cy(t,e){var r=this._addSchema(t,void 0,e);return r.validate||this._compile(r)}function Ny(t,e,r,s){if(Array.isArray(t)){for(var a=0;a<t.length;a++)this.addSchema(t[a],void 0,r,s);return this}var n=this._getId(t);if(n!==void 0&&typeof n!="string")throw new Error("schema id must be string");return e=qr.normalizeId(e||n),pd(this,e),this._schemas[e]=this._addSchema(t,r,s,!0),this}function Ay(t,e,r){return this.addSchema(t,e,r,!0),this}function jy(t,e){var r=t.$schema;if(r!==void 0&&typeof r!="string")throw new Error("$schema must be a string");if(r=r||this._opts.defaultMeta||Dy(this),!r)return this.logger.warn("meta-schema not available"),this.errors=null,!0;var s=this.validate(r,t);if(!s&&e){var a="schema is invalid: "+this.errorsText();if(this._opts.validateSchema=="log")this.logger.error(a);else throw new Error(a)}return s}function Dy(t){var e=t._opts.meta;return t._opts.defaultMeta=typeof e=="object"?t._getId(e)||e:t.getSchema(on)?on:void 0,t._opts.defaultMeta}function My(t){var e=hd(this,t);switch(typeof e){case"object":return e.validate||this._compile(e);case"string":return this.getSchema(e);case"undefined":return Ly(this,t)}}function Ly(t,e){var r=qr.schema.call(t,{schema:{}},e);if(r){var s=r.schema,a=r.root,n=r.baseId,i=od.call(t,s,a,void 0,n);return t._fragments[e]=new cd({ref:e,fragment:!0,schema:s,root:a,baseId:n,validate:i}),i}}function hd(t,e){return e=qr.normalizeId(e),t._schemas[e]||t._refs[e]||t._fragments[e]}function Fy(t){if(t instanceof RegExp)return cn(this,this._schemas,t),cn(this,this._refs,t),this;switch(typeof t){case"undefined":return cn(this,this._schemas),cn(this,this._refs),this._cache.clear(),this;case"string":var e=hd(this,t);return e&&this._cache.del(e.cacheKey),delete this._schemas[t],delete this._refs[t],this;case"object":var r=this._opts.serialize,s=r?r(t):t;this._cache.del(s);var a=this._getId(t);a&&(a=qr.normalizeId(a),delete this._schemas[a],delete this._refs[a])}return this}function cn(t,e,r){for(var s in e){var a=e[s];!a.meta&&(!r||r.test(s))&&(t._cache.del(a.cacheKey),delete e[s])}}function qy(t,e,r,s){if(typeof t!="object"&&typeof t!="boolean")throw new Error("schema should be object or boolean");var a=this._opts.serialize,n=a?a(t):t,i=this._cache.get(n);if(i)return i;s=s||this._opts.addUsedSchema!==!1;var o=qr.normalizeId(this._getId(t));o&&s&&pd(this,o);var l=this._opts.validateSchema!==!1&&!e,c;l&&!(c=o&&o==qr.normalizeId(t.$schema))&&this.validateSchema(t,!0);var u=qr.ids.call(this,t),d=new cd({id:o,schema:t,localRefs:u,cacheKey:n,meta:r});return o[0]!="#"&&s&&(this._refs[o]=d),this._cache.put(n,d),l&&c&&this.validateSchema(t,!0),d}function Uy(t,e){if(t.compiling)return t.validate=a,a.schema=t.schema,a.errors=null,a.root=e||a,t.schema.$async===!0&&(a.$async=!0),a;t.compiling=!0;var r;t.meta&&(r=this._opts,this._opts=this._metaOpts);var s;try{s=od.call(this,t.schema,e,t.localRefs)}catch(n){throw delete t.validate,n}finally{t.compiling=!1,t.meta&&(this._opts=r)}return t.validate=s,t.refs=s.refs,t.refVal=s.refVal,t.root=s.root,s;function a(){var n=t.validate,i=n.apply(this,arguments);return a.errors=n.errors,i}}function Vy(t){switch(t.schemaId){case"auto":return Zy;case"id":return zy;default:return Hy}}function zy(t){return t.$id&&this.logger.warn("schema $id ignored",t.$id),t.id}function Hy(t){return t.id&&this.logger.warn("schema id ignored",t.id),t.$id}function Zy(t){if(t.$id&&t.id&&t.$id!=t.id)throw new Error("schema $id is different from id");return t.$id||t.id}function Ky(t,e){if(t=t||this.errors,!t)return"No errors";e=e||{};for(var r=e.separator===void 0?", ":e.separator,s=e.dataVar===void 0?"data":e.dataVar,a="",n=0;n<t.length;n++){var i=t[n];i&&(a+=s+i.dataPath+" "+i.message+r)}return a.slice(0,-r.length)}function By(t,e){return typeof e=="string"&&(e=new RegExp(e)),this._formats[t]=e,this}function Wy(t){var e;if(t._opts.$data&&(e=Ey,t.addMetaSchema(e,e.$id,!0)),t._opts.meta!==!1){var r=nd;t._opts.$data&&(r=ld(r,Ty)),t.addMetaSchema(r,on,!0),t._refs["http://json-schema.org/schema"]=on}}function Jy(t){var e=t._opts.schemas;if(e)if(Array.isArray(e))t.addSchema(e);else for(var r in e)t.addSchema(e[r],r)}function Qy(t){for(var e in t._opts.formats){var r=t._opts.formats[e];t.addFormat(e,r)}}function Gy(t){for(var e in t._opts.keywords){var r=t._opts.keywords[e];t.addKeyword(e,r)}}function pd(t,e){if(t._schemas[e]||t._refs[e])throw new Error('schema with key or id "'+e+'" already exists')}function Yy(t){for(var e=ud.copy(t._opts),r=0;r<fd.length;r++)delete e[fd[r]];return e}function Xy(t){var e=t._opts.logger;if(e===!1)t.logger={log:xo,warn:xo,error:xo};else{if(e===void 0&&(e=console),!(typeof e=="object"&&e.log&&e.warn&&e.error))throw new Error("logger must implement log, warn and error methods");t.logger=e}}function xo(){}const md=hc(Iy);class es extends Ru{constructor(e,r){var s;super(r),this._clientInfo=e,this._cachedToolOutputValidators=new Map,this._capabilities=(s=r==null?void 0:r.capabilities)!==null&&s!==void 0?s:{},this._ajv=new md}registerCapabilities(e){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=xu(this._capabilities,e)}assertCapability(e,r){var s;if(!(!((s=this._serverCapabilities)===null||s===void 0)&&s[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 s=await this.request({method:"initialize",params:{protocolVersion:Ja,capabilities:this._capabilities,clientInfo:this._clientInfo}},ru,r);if(s===void 0)throw new Error(`Server sent invalid initialize result: ${s}`);if(!Kl.includes(s.protocolVersion))throw new Error(`Server's protocol version is not supported: ${s.protocolVersion}`);this._serverCapabilities=s.capabilities,this._serverVersion=s.serverInfo,e.setProtocolVersion&&e.setProtocolVersion(s.protocolVersion),this._instructions=s.instructions,await this.notification({method:"notifications/initialized"})}catch(s){throw this.close(),s}}getServerCapabilities(){return this._serverCapabilities}getServerVersion(){return this._serverVersion}getInstructions(){return this._instructions}assertCapabilityForMethod(e){var r,s,a,n,i;switch(e){case"logging/setLevel":if(!(!((r=this._serverCapabilities)===null||r===void 0)&&r.logging))throw new Error(`Server does not support logging (required for ${e})`);break;case"prompts/get":case"prompts/list":if(!(!((s=this._serverCapabilities)===null||s===void 0)&&s.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(!(!((a=this._serverCapabilities)===null||a===void 0)&&a.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(!(!((n=this._serverCapabilities)===null||n===void 0)&&n.tools))throw new Error(`Server does not support tools (required for ${e})`);break;case"completion/complete":if(!(!((i=this._serverCapabilities)===null||i===void 0)&&i.completions))throw new Error(`Server does not support completions (required for ${e})`);break}}assertNotificationCapability(e){var r;switch(e){case"notifications/roots/list_changed":if(!(!((r=this._capabilities.roots)===null||r===void 0)&&r.listChanged))throw new Error(`Client does not support roots list changed notifications (required for ${e})`);break}}assertRequestHandlerCapability(e){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"},br,e)}async complete(e,r){return this.request({method:"completion/complete",params:e},Pu,r)}async setLoggingLevel(e,r){return this.request({method:"logging/setLevel",params:{level:e}},br,r)}async getPrompt(e,r){return this.request({method:"prompts/get",params:e},vu,r)}async listPrompts(e,r){return this.request({method:"prompts/list",params:e},pu,r)}async listResources(e,r){return this.request({method:"resources/list",params:e},ou,r)}async listResourceTemplates(e,r){return this.request({method:"resources/templates/list",params:e},cu,r)}async readResource(e,r){return this.request({method:"resources/read",params:e},lu,r)}async subscribeResource(e,r){return this.request({method:"resources/subscribe",params:e},br,r)}async unsubscribeResource(e,r){return this.request({method:"resources/unsubscribe",params:e},br,r)}async callTool(e,r=Zs,s){const a=await this.request({method:"tools/call",params:e},r,s),n=this.getToolOutputValidator(e.name);if(n){if(!a.structuredContent&&!a.isError)throw new Ae(Oe.InvalidRequest,`Tool ${e.name} has an output schema but did not return structured content`);if(a.structuredContent)try{if(!n(a.structuredContent))throw new Ae(Oe.InvalidParams,`Structured content does not match the tool's output schema: ${this._ajv.errorsText(n.errors)}`)}catch(i){throw i instanceof Ae?i:new Ae(Oe.InvalidParams,`Failed to validate structured content: ${i instanceof Error?i.message:String(i)}`)}}return a}cacheToolOutputSchemas(e){this._cachedToolOutputValidators.clear();for(const r of e)if(r.outputSchema)try{const s=this._ajv.compile(r.outputSchema);this._cachedToolOutputValidators.set(r.name,s)}catch{}}getToolOutputValidator(e){return this._cachedToolOutputValidators.get(e)}async listTools(e,r){const s=await this.request({method:"tools/list",params:e},_u,r);return this.cacheToolOutputSchemas(s.tools),s}async sendRootsListChanged(){return this.notification({method:"notifications/roots/list_changed"})}}class vd 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 ko(t){}function gd(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=ko,onError:r=ko,onRetry:s=ko,onComment:a}=t;let n="",i=!0,o,l="",c="";function u(p){const h=i?p.replace(/^\xEF\xBB\xBF/,""):p,[v,w]=e0(`${n}${h}`);for(const P of v)d(P);n=w,i=!1}function d(p){if(p===""){f();return}if(p.startsWith(":")){a&&a(p.slice(p.startsWith(": ")?2:1));return}const h=p.indexOf(":");if(h!==-1){const v=p.slice(0,h),w=p[h+1]===" "?2:1,P=p.slice(h+w);g(v,P,p);return}g(p,"",p)}function g(p,h,v){switch(p){case"event":c=h;break;case"data":l=`${l}${h}
9
- `;break;case"id":o=h.includes("\0")?void 0:h;break;case"retry":/^\d+$/.test(h)?s(parseInt(h,10)):r(new vd(`Invalid \`retry\` value: "${h}"`,{type:"invalid-retry",value:h,line:v}));break;default:r(new vd(`Unknown field "${p.length>20?`${p.slice(0,20)}…`:p}"`,{type:"unknown-field",field:p,value:h,line:v}));break}}function f(){l.length>0&&e({id:o,event:c||void 0,data:l.endsWith(`
10
- `)?l.slice(0,-1):l}),o=void 0,l="",c=""}function m(p={}){n&&p.consume&&d(n),i=!0,o=void 0,l="",c="",n=""}return{feed:u,reset:m}}function e0(t){const e=[];let r="",s=0;for(;s<t.length;){const a=t.indexOf("\r",s),n=t.indexOf(`
11
- `,s);let i=-1;if(a!==-1&&n!==-1?i=Math.min(a,n):a!==-1?a===t.length-1?i=-1:i=a:n!==-1&&(i=n),i===-1){r=t.slice(s);break}else{const o=t.slice(s,i);e.push(o),s=i+1,t[s-1]==="\r"&&t[s]===`
12
- `&&s++}}return[e,r]}class _d extends Event{constructor(e,r){var s,a;super(e),this.code=(s=r==null?void 0:r.code)!=null?s:void 0,this.message=(a=r==null?void 0:r.message)!=null?a:void 0}[Symbol.for("nodejs.util.inspect.custom")](e,r,s){return s(yd(this),r)}[Symbol.for("Deno.customInspect")](e,r){return e(yd(this),r)}}function t0(t){const e=globalThis.DOMException;return typeof e=="function"?new e(t,"SyntaxError"):new SyntaxError(t)}function Io(t){return t instanceof Error?"errors"in t&&Array.isArray(t.errors)?t.errors.map(Io).join(", "):"cause"in t&&t.cause instanceof Error?`${t}: ${Io(t.cause)}`:t.message:`${t}`}function yd(t){return{type:t.type,message:t.message,code:t.code,defaultPrevented:t.defaultPrevented,cancelable:t.cancelable,timeStamp:t.timeStamp}}var wd=t=>{throw TypeError(t)},To=(t,e,r)=>e.has(t)||wd("Cannot "+r),we=(t,e,r)=>(To(t,e,"read from private field"),r?r.call(t):e.get(t)),et=(t,e,r)=>e.has(t)?wd("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,r),De=(t,e,r,s)=>(To(t,e,"write to private field"),e.set(t,r),r),cr=(t,e,r)=>(To(t,e,"access private method"),r),vt,Ur,da,ln,un,ts,fa,rs,Sr,ha,pa,ma,as,jt,Oo,Co,No,bd,Ao,jo,ss,Do,Mo;class dn extends EventTarget{constructor(e,r){var s,a;super(),et(this,jt),this.CONNECTING=0,this.OPEN=1,this.CLOSED=2,et(this,vt),et(this,Ur),et(this,da),et(this,ln),et(this,un),et(this,ts),et(this,fa),et(this,rs,null),et(this,Sr),et(this,ha),et(this,pa,null),et(this,ma,null),et(this,as,null),et(this,Co,async n=>{var i;we(this,ha).reset();const{body:o,redirected:l,status:c,headers:u}=n;if(c===204){cr(this,jt,ss).call(this,"Server sent HTTP 204, not reconnecting",204),this.close();return}if(l?De(this,da,new URL(n.url)):De(this,da,void 0),c!==200){cr(this,jt,ss).call(this,`Non-200 status code (${c})`,c);return}if(!(u.get("content-type")||"").startsWith("text/event-stream")){cr(this,jt,ss).call(this,'Invalid content type, expected "text/event-stream"',c);return}if(we(this,vt)===this.CLOSED)return;De(this,vt,this.OPEN);const d=new Event("open");if((i=we(this,as))==null||i.call(this,d),this.dispatchEvent(d),typeof o!="object"||!o||!("getReader"in o)){cr(this,jt,ss).call(this,"Invalid response body, expected a web ReadableStream",c),this.close();return}const g=new TextDecoder,f=o.getReader();let m=!0;do{const{done:p,value:h}=await f.read();h&&we(this,ha).feed(g.decode(h,{stream:!p})),p&&(m=!1,we(this,ha).reset(),cr(this,jt,Do).call(this))}while(m)}),et(this,No,n=>{De(this,Sr,void 0),!(n.name==="AbortError"||n.type==="aborted")&&cr(this,jt,Do).call(this,Io(n))}),et(this,Ao,n=>{typeof n.id=="string"&&De(this,rs,n.id);const i=new MessageEvent(n.event||"message",{data:n.data,origin:we(this,da)?we(this,da).origin:we(this,Ur).origin,lastEventId:n.id||""});we(this,ma)&&(!n.event||n.event==="message")&&we(this,ma).call(this,i),this.dispatchEvent(i)}),et(this,jo,n=>{De(this,ts,n)}),et(this,Mo,()=>{De(this,fa,void 0),we(this,vt)===this.CONNECTING&&cr(this,jt,Oo).call(this)});try{if(e instanceof URL)De(this,Ur,e);else if(typeof e=="string")De(this,Ur,new URL(e,r0()));else throw new Error("Invalid URL")}catch{throw t0("An invalid or illegal string was specified")}De(this,ha,gd({onEvent:we(this,Ao),onRetry:we(this,jo)})),De(this,vt,this.CONNECTING),De(this,ts,3e3),De(this,un,(s=r==null?void 0:r.fetch)!=null?s:globalThis.fetch),De(this,ln,(a=r==null?void 0:r.withCredentials)!=null?a:!1),cr(this,jt,Oo).call(this)}get readyState(){return we(this,vt)}get url(){return we(this,Ur).href}get withCredentials(){return we(this,ln)}get onerror(){return we(this,pa)}set onerror(e){De(this,pa,e)}get onmessage(){return we(this,ma)}set onmessage(e){De(this,ma,e)}get onopen(){return we(this,as)}set onopen(e){De(this,as,e)}addEventListener(e,r,s){const a=r;super.addEventListener(e,a,s)}removeEventListener(e,r,s){const a=r;super.removeEventListener(e,a,s)}close(){we(this,fa)&&clearTimeout(we(this,fa)),we(this,vt)!==this.CLOSED&&(we(this,Sr)&&we(this,Sr).abort(),De(this,vt,this.CLOSED),De(this,Sr,void 0))}}vt=new WeakMap,Ur=new WeakMap,da=new WeakMap,ln=new WeakMap,un=new WeakMap,ts=new WeakMap,fa=new WeakMap,rs=new WeakMap,Sr=new WeakMap,ha=new WeakMap,pa=new WeakMap,ma=new WeakMap,as=new WeakMap,jt=new WeakSet,Oo=function(){De(this,vt,this.CONNECTING),De(this,Sr,new AbortController),we(this,un)(we(this,Ur),cr(this,jt,bd).call(this)).then(we(this,Co)).catch(we(this,No))},Co=new WeakMap,No=new WeakMap,bd=function(){var t;const e={mode:"cors",redirect:"follow",headers:{Accept:"text/event-stream",...we(this,rs)?{"Last-Event-ID":we(this,rs)}:void 0},cache:"no-store",signal:(t=we(this,Sr))==null?void 0:t.signal};return"window"in globalThis&&(e.credentials=this.withCredentials?"include":"same-origin"),e},Ao=new WeakMap,jo=new WeakMap,ss=function(t,e){var r;we(this,vt)!==this.CLOSED&&De(this,vt,this.CLOSED);const s=new _d("error",{code:e,message:t});(r=we(this,pa))==null||r.call(this,s),this.dispatchEvent(s)},Do=function(t,e){var r;if(we(this,vt)===this.CLOSED)return;De(this,vt,this.CONNECTING);const s=new _d("error",{code:e,message:t});(r=we(this,pa))==null||r.call(this,s),this.dispatchEvent(s),De(this,fa,setTimeout(we(this,Mo),we(this,ts)))},Mo=new WeakMap,dn.CONNECTING=0,dn.OPEN=1,dn.CLOSED=2;function r0(){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}let Lo;Lo=globalThis.crypto;async function a0(t){return(await Lo).getRandomValues(new Uint8Array(t))}async function s0(t){const e="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-._~";let r="";const s=await a0(t);for(let a=0;a<t;a++){const n=s[a]%e.length;r+=e[n]}return r}async function n0(t){return await s0(t)}async function i0(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 o0(t){if(t||(t=43),t<43||t>128)throw`Expected a length between 43 and 128. Received ${t}.`;const e=await n0(t),r=await i0(e);return{code_verifier:e,code_challenge:r}}const st=I().url().superRefine((t,e)=>{if(!URL.canParse(t))return e.addIssue({code:q.custom,message:"URL must be parseable",fatal:!0}),Zl}).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"}),c0=Z({resource:I().url(),authorization_servers:X(st).optional(),jwks_uri:I().url().optional(),scopes_supported:X(I()).optional(),bearer_methods_supported:X(I()).optional(),resource_signing_alg_values_supported:X(I()).optional(),resource_name:I().optional(),resource_documentation:I().optional(),resource_policy_uri:I().url().optional(),resource_tos_uri:I().url().optional(),tls_client_certificate_bound_access_tokens:Ze().optional(),authorization_details_types_supported:X(I()).optional(),dpop_signing_alg_values_supported:X(I()).optional(),dpop_bound_access_tokens_required:Ze().optional()}).passthrough(),$d=Z({issuer:I(),authorization_endpoint:st,token_endpoint:st,registration_endpoint:st.optional(),scopes_supported:X(I()).optional(),response_types_supported:X(I()),response_modes_supported:X(I()).optional(),grant_types_supported:X(I()).optional(),token_endpoint_auth_methods_supported:X(I()).optional(),token_endpoint_auth_signing_alg_values_supported:X(I()).optional(),service_documentation:st.optional(),revocation_endpoint:st.optional(),revocation_endpoint_auth_methods_supported:X(I()).optional(),revocation_endpoint_auth_signing_alg_values_supported:X(I()).optional(),introspection_endpoint:I().optional(),introspection_endpoint_auth_methods_supported:X(I()).optional(),introspection_endpoint_auth_signing_alg_values_supported:X(I()).optional(),code_challenge_methods_supported:X(I()).optional()}).passthrough(),l0=Z({issuer:I(),authorization_endpoint:st,token_endpoint:st,userinfo_endpoint:st.optional(),jwks_uri:st,registration_endpoint:st.optional(),scopes_supported:X(I()).optional(),response_types_supported:X(I()),response_modes_supported:X(I()).optional(),grant_types_supported:X(I()).optional(),acr_values_supported:X(I()).optional(),subject_types_supported:X(I()),id_token_signing_alg_values_supported:X(I()),id_token_encryption_alg_values_supported:X(I()).optional(),id_token_encryption_enc_values_supported:X(I()).optional(),userinfo_signing_alg_values_supported:X(I()).optional(),userinfo_encryption_alg_values_supported:X(I()).optional(),userinfo_encryption_enc_values_supported:X(I()).optional(),request_object_signing_alg_values_supported:X(I()).optional(),request_object_encryption_alg_values_supported:X(I()).optional(),request_object_encryption_enc_values_supported:X(I()).optional(),token_endpoint_auth_methods_supported:X(I()).optional(),token_endpoint_auth_signing_alg_values_supported:X(I()).optional(),display_values_supported:X(I()).optional(),claim_types_supported:X(I()).optional(),claims_supported:X(I()).optional(),service_documentation:I().optional(),claims_locales_supported:X(I()).optional(),ui_locales_supported:X(I()).optional(),claims_parameter_supported:Ze().optional(),request_parameter_supported:Ze().optional(),request_uri_parameter_supported:Ze().optional(),require_request_uri_registration:Ze().optional(),op_policy_uri:st.optional(),op_tos_uri:st.optional()}).passthrough().merge($d.pick({code_challenge_methods_supported:!0})),Pd=Z({access_token:I(),id_token:I().optional(),token_type:I(),expires_in:Je().optional(),scope:I().optional(),refresh_token:I().optional()}).strip(),u0=Z({error:I(),error_description:I().optional(),error_uri:I().optional()}),Ed=st.optional().or(ce("").transform(()=>{})),d0=Z({redirect_uris:X(st),token_endpoint_auth_method:I().optional(),grant_types:X(I()).optional(),response_types:X(I()).optional(),client_name:I().optional(),client_uri:st.optional(),logo_uri:Ed,scope:I().optional(),contacts:X(I()).optional(),tos_uri:Ed,policy_uri:I().optional(),jwks_uri:st.optional(),jwks:Vl().optional(),software_id:I().optional(),software_version:I().optional(),software_statement:I().optional()}).strip(),f0=Z({client_id:I(),client_secret:I().optional(),client_id_issued_at:Je().optional(),client_secret_expires_at:Je().optional()}).strip(),h0=d0.merge(f0);Z({error:I(),error_description:I().optional()}).strip(),Z({token:I(),token_type_hint:I().optional()}).strip();function p0(t){const e=typeof t=="string"?new URL(t):new URL(t.href);return e.hash="",e}function m0({requestedResource:t,configuredResource:e}){const r=typeof t=="string"?new URL(t):new URL(t.href),s=typeof e=="string"?new URL(e):new URL(e.href);if(r.origin!==s.origin||r.pathname.length<s.pathname.length)return!1;const a=r.pathname.endsWith("/")?r.pathname:r.pathname+"/",n=s.pathname.endsWith("/")?s.pathname:s.pathname+"/";return a.startsWith(n)}class nt 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 Fo extends nt{}Fo.errorCode="invalid_request";class fn extends nt{}fn.errorCode="invalid_client";class hn extends nt{}hn.errorCode="invalid_grant";class pn extends nt{}pn.errorCode="unauthorized_client";class qo extends nt{}qo.errorCode="unsupported_grant_type";class Uo extends nt{}Uo.errorCode="invalid_scope";class Vo extends nt{}Vo.errorCode="access_denied";class va extends nt{}va.errorCode="server_error";class zo extends nt{}zo.errorCode="temporarily_unavailable";class Ho extends nt{}Ho.errorCode="unsupported_response_type";class Zo extends nt{}Zo.errorCode="unsupported_token_type";class Ko extends nt{}Ko.errorCode="invalid_token";class Bo extends nt{}Bo.errorCode="method_not_allowed";class Wo extends nt{}Wo.errorCode="too_many_requests";class Jo extends nt{}Jo.errorCode="invalid_client_metadata";class Qo extends nt{}Qo.errorCode="insufficient_scope";const v0={[Fo.errorCode]:Fo,[fn.errorCode]:fn,[hn.errorCode]:hn,[pn.errorCode]:pn,[qo.errorCode]:qo,[Uo.errorCode]:Uo,[Vo.errorCode]:Vo,[va.errorCode]:va,[zo.errorCode]:zo,[Ho.errorCode]:Ho,[Zo.errorCode]:Zo,[Ko.errorCode]:Ko,[Bo.errorCode]:Bo,[Wo.errorCode]:Wo,[Jo.errorCode]:Jo,[Qo.errorCode]:Qo};class Dt extends Error{constructor(e){super(e??"Unauthorized")}}const Go="code",Yo="S256";function Sd(t,e){const r=t.client_secret!==void 0;return e.length===0?r?"client_secret_post":"none":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 Rd(t,e,r,s){const{client_id:a,client_secret:n}=e;switch(t){case"client_secret_basic":g0(a,n,r);return;case"client_secret_post":_0(a,n,s);return;case"none":y0(a,s);return;default:throw new Error(`Unsupported client authentication method: ${t}`)}}function g0(t,e,r){if(!e)throw new Error("client_secret_basic authentication requires a client_secret");const s=btoa(`${t}:${e}`);r.set("Authorization",`Basic ${s}`)}function _0(t,e,r){r.set("client_id",t),e&&r.set("client_secret",e)}function y0(t,e){e.set("client_id",t)}async function Xo(t){const e=t instanceof Response?t.status:void 0,r=t instanceof Response?await t.text():t;try{const s=u0.parse(JSON.parse(r)),{error:a,error_description:n,error_uri:i}=s,o=v0[a]||va;return new o(n||"",i)}catch(s){const a=`${e?`HTTP ${e}: `:""}Invalid OAuth error response: ${s}. Raw body: ${r}`;return new va(a)}}async function ga(t,e){var r,s;try{return await ec(t,e)}catch(a){if(a instanceof fn||a instanceof pn)return await((r=t.invalidateCredentials)===null||r===void 0?void 0:r.call(t,"all")),await ec(t,e);if(a instanceof hn)return await((s=t.invalidateCredentials)===null||s===void 0?void 0:s.call(t,"tokens")),await ec(t,e);throw a}}async function ec(t,{serverUrl:e,authorizationCode:r,scope:s,resourceMetadataUrl:a,fetchFn:n}){let i,o;try{i=await b0(e,{resourceMetadataUrl:a},n),i.authorization_servers&&i.authorization_servers.length>0&&(o=i.authorization_servers[0])}catch{}o||(o=e);const l=await w0(e,t,i),c=await R0(o,{fetchFn:n});let u=await Promise.resolve(t.clientInformation());if(!u){if(r!==void 0)throw new Error("Existing OAuth client information is required when exchanging an authorization code");if(!t.saveClientInformation)throw new Error("OAuth client information must be saveable for dynamic registration");const p=await T0(o,{metadata:c,clientMetadata:t.clientMetadata,fetchFn:n});await t.saveClientInformation(p),u=p}if(r!==void 0){const p=await t.codeVerifier(),h=await k0(o,{metadata:c,clientInformation:u,authorizationCode:r,codeVerifier:p,redirectUri:t.redirectUrl,resource:l,addClientAuthentication:t.addClientAuthentication,fetchFn:n});return await t.saveTokens(h),"AUTHORIZED"}const d=await t.tokens();if(d!=null&&d.refresh_token)try{const p=await I0(o,{metadata:c,clientInformation:u,refreshToken:d.refresh_token,resource:l,addClientAuthentication:t.addClientAuthentication,fetchFn:n});return await t.saveTokens(p),"AUTHORIZED"}catch(p){if(!(!(p instanceof nt)||p instanceof va))throw p}const g=t.state?await t.state():void 0,{authorizationUrl:f,codeVerifier:m}=await x0(o,{metadata:c,clientInformation:u,state:g,redirectUrl:t.redirectUrl,scope:s||t.clientMetadata.scope,resource:l});return await t.saveCodeVerifier(m),await t.redirectToAuthorization(f),"REDIRECT"}async function w0(t,e,r){const s=p0(t);if(e.validateResourceURL)return await e.validateResourceURL(s,r==null?void 0:r.resource);if(r){if(!m0({requestedResource:s,configuredResource:r.resource}))throw new Error(`Protected resource ${r.resource} does not match expected ${s} (or origin)`);return new URL(r.resource)}}function tc(t){const e=t.headers.get("WWW-Authenticate");if(!e)return;const[r,s]=e.split(" ");if(r.toLowerCase()!=="bearer"||!s)return;const n=/resource_metadata="([^"]*)"/.exec(e);if(n)try{return new URL(n[1])}catch{return}}async function b0(t,e,r=fetch){const s=await E0(t,"oauth-protected-resource",r,{protocolVersion:e==null?void 0:e.protocolVersion,metadataUrl:e==null?void 0:e.resourceMetadataUrl});if(!s||s.status===404)throw new Error("Resource server does not implement OAuth 2.0 Protected Resource Metadata.");if(!s.ok)throw new Error(`HTTP ${s.status} trying to load well-known OAuth protected resource metadata.`);return c0.parse(await s.json())}async function rc(t,e,r=fetch){try{return await r(t,{headers:e})}catch(s){if(s instanceof TypeError)return e?rc(t,void 0,r):void 0;throw s}}function $0(t,e="",r={}){return e.endsWith("/")&&(e=e.slice(0,-1)),r.prependPathname?`${e}/.well-known/${t}`:`/.well-known/${t}${e}`}async function xd(t,e,r=fetch){return await rc(t,{"MCP-Protocol-Version":e},r)}function P0(t,e){return!t||t.status>=400&&t.status<500&&e!=="/"}async function E0(t,e,r,s){var a,n;const i=new URL(t),o=(a=s==null?void 0:s.protocolVersion)!==null&&a!==void 0?a:Ja;let l;if(s!=null&&s.metadataUrl)l=new URL(s.metadataUrl);else{const u=$0(e,i.pathname);l=new URL(u,(n=s==null?void 0:s.metadataServerUrl)!==null&&n!==void 0?n:i),l.search=i.search}let c=await xd(l,o,r);if(!(s!=null&&s.metadataUrl)&&P0(c,i.pathname)){const u=new URL(`/.well-known/${e}`,i);c=await xd(u,o,r)}return c}function S0(t){const e=typeof t=="string"?new URL(t):t,r=e.pathname!=="/",s=[];if(!r)return s.push({url:new URL("/.well-known/oauth-authorization-server",e.origin),type:"oauth"}),s.push({url:new URL("/.well-known/openid-configuration",e.origin),type:"oidc"}),s;let a=e.pathname;return a.endsWith("/")&&(a=a.slice(0,-1)),s.push({url:new URL(`/.well-known/oauth-authorization-server${a}`,e.origin),type:"oauth"}),s.push({url:new URL("/.well-known/oauth-authorization-server",e.origin),type:"oauth"}),s.push({url:new URL(`/.well-known/openid-configuration${a}`,e.origin),type:"oidc"}),s.push({url:new URL(`${a}/.well-known/openid-configuration`,e.origin),type:"oidc"}),s}async function R0(t,{fetchFn:e=fetch,protocolVersion:r=Ja}={}){const s={"MCP-Protocol-Version":r,Accept:"application/json"},a=S0(t);for(const{url:n,type:i}of a){const o=await rc(n,s,e);if(o){if(!o.ok){if(o.status>=400&&o.status<500)continue;throw new Error(`HTTP ${o.status} trying to load ${i==="oauth"?"OAuth":"OpenID provider"} metadata from ${n}`)}return i==="oauth"?$d.parse(await o.json()):l0.parse(await o.json())}}}async function x0(t,{metadata:e,clientInformation:r,redirectUrl:s,scope:a,state:n,resource:i}){let o;if(e){if(o=new URL(e.authorization_endpoint),!e.response_types_supported.includes(Go))throw new Error(`Incompatible auth server: does not support response type ${Go}`);if(e.code_challenge_methods_supported&&!e.code_challenge_methods_supported.includes(Yo))throw new Error(`Incompatible auth server: does not support code challenge method ${Yo}`)}else o=new URL("/authorize",t);const l=await o0(),c=l.code_verifier,u=l.code_challenge;return o.searchParams.set("response_type",Go),o.searchParams.set("client_id",r.client_id),o.searchParams.set("code_challenge",u),o.searchParams.set("code_challenge_method",Yo),o.searchParams.set("redirect_uri",String(s)),n&&o.searchParams.set("state",n),a&&o.searchParams.set("scope",a),a!=null&&a.includes("offline_access")&&o.searchParams.append("prompt","consent"),i&&o.searchParams.set("resource",i.href),{authorizationUrl:o,codeVerifier:c}}async function k0(t,{metadata:e,clientInformation:r,authorizationCode:s,codeVerifier:a,redirectUri:n,resource:i,addClientAuthentication:o,fetchFn:l}){var c;const u="authorization_code",d=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(u))throw new Error(`Incompatible auth server: does not support grant type ${u}`);const g=new Headers({"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"}),f=new URLSearchParams({grant_type:u,code:s,code_verifier:a,redirect_uri:String(n)});if(o)o(g,f,t,e);else{const p=(c=e==null?void 0:e.token_endpoint_auth_methods_supported)!==null&&c!==void 0?c:[],h=Sd(r,p);Rd(h,r,g,f)}i&&f.set("resource",i.href);const m=await(l??fetch)(d,{method:"POST",headers:g,body:f});if(!m.ok)throw await Xo(m);return Pd.parse(await m.json())}async function I0(t,{metadata:e,clientInformation:r,refreshToken:s,resource:a,addClientAuthentication:n,fetchFn:i}){var o;const l="refresh_token";let c;if(e){if(c=new URL(e.token_endpoint),e.grant_types_supported&&!e.grant_types_supported.includes(l))throw new Error(`Incompatible auth server: does not support grant type ${l}`)}else c=new URL("/token",t);const u=new Headers({"Content-Type":"application/x-www-form-urlencoded"}),d=new URLSearchParams({grant_type:l,refresh_token:s});if(n)n(u,d,t,e);else{const f=(o=e==null?void 0:e.token_endpoint_auth_methods_supported)!==null&&o!==void 0?o:[],m=Sd(r,f);Rd(m,r,u,d)}a&&d.set("resource",a.href);const g=await(i??fetch)(c,{method:"POST",headers:u,body:d});if(!g.ok)throw await Xo(g);return Pd.parse({refresh_token:s,...await g.json()})}async function T0(t,{metadata:e,clientMetadata:r,fetchFn:s}){let a;if(e){if(!e.registration_endpoint)throw new Error("Incompatible auth server: does not support dynamic client registration");a=new URL(e.registration_endpoint)}else a=new URL("/register",t);const n=await(s??fetch)(a,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(r)});if(!n.ok)throw await Xo(n);return h0.parse(await n.json())}class O0 extends Error{constructor(e,r,s){super(`SSE error: ${r}`),this.code=e,this.event=s}}class ns{constructor(e,r){this._url=e,this._resourceMetadataUrl=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}async _authThenStart(){var e;if(!this._authProvider)throw new Dt("No auth provider");let r;try{r=await ga(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,fetchFn:this._fetch})}catch(s){throw(e=this.onerror)===null||e===void 0||e.call(this,s),s}if(r!=="AUTHORIZED")throw new Dt;return await this._startOrAuth()}async _commonHeaders(){var e;const r={};if(this._authProvider){const s=await this._authProvider.tokens();s&&(r.Authorization=`Bearer ${s.access_token}`)}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,s;const a=(s=(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&&s!==void 0?s:fetch;return new Promise((n,i)=>{this._eventSource=new dn(this._url.href,{...this._eventSourceInit,fetch:async(o,l)=>{const c=await this._commonHeaders();c.set("Accept","text/event-stream");const u=await a(o,{...l,headers:c});return u.status===401&&u.headers.has("www-authenticate")&&(this._resourceMetadataUrl=tc(u)),u}}),this._abortController=new AbortController,this._eventSource.onerror=o=>{var l;if(o.code===401&&this._authProvider){this._authThenStart().then(n,i);return}const c=new O0(o.code,o.message,o);i(c),(l=this.onerror)===null||l===void 0||l.call(this,c)},this._eventSource.onopen=()=>{},this._eventSource.addEventListener("endpoint",o=>{var l;const c=o;try{if(this._endpoint=new URL(c.data,this._url),this._endpoint.origin!==this._url.origin)throw new Error(`Endpoint origin does not match connection origin: ${this._endpoint.origin}`)}catch(u){i(u),(l=this.onerror)===null||l===void 0||l.call(this,u),this.close();return}n()}),this._eventSource.onmessage=o=>{var l,c;const u=o;let d;try{d=Fr.parse(JSON.parse(u.data))}catch(g){(l=this.onerror)===null||l===void 0||l.call(this,g);return}(c=this.onmessage)===null||c===void 0||c.call(this,d)}})}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 Dt("No auth provider");if(await ga(this._authProvider,{serverUrl:this._url,authorizationCode:e,resourceMetadataUrl:this._resourceMetadataUrl,fetchFn:this._fetch})!=="AUTHORIZED")throw new Dt("Failed to authorize")}async close(){var e,r,s;(e=this._abortController)===null||e===void 0||e.abort(),(r=this._eventSource)===null||r===void 0||r.close(),(s=this.onclose)===null||s===void 0||s.call(this)}async send(e){var r,s,a;if(!this._endpoint)throw new Error("Not connected");try{const n=await this._commonHeaders();n.set("content-type","application/json");const i={...this._requestInit,method:"POST",headers:n,body:JSON.stringify(e),signal:(r=this._abortController)===null||r===void 0?void 0:r.signal},o=await((s=this._fetch)!==null&&s!==void 0?s:fetch)(this._endpoint,i);if(!o.ok){if(o.status===401&&this._authProvider){if(this._resourceMetadataUrl=tc(o),await ga(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,fetchFn:this._fetch})!=="AUTHORIZED")throw new Dt;return this.send(e)}const l=await o.text().catch(()=>null);throw new Error(`Error POSTing to endpoint (HTTP ${o.status}): ${l}`)}}catch(n){throw(a=this.onerror)===null||a===void 0||a.call(this,n),n}}setProtocolVersion(e){this._protocolVersion=e}}class C0 extends TransformStream{constructor({onError:e,onRetry:r,onComment:s}={}){let a;super({start(n){a=gd({onEvent:i=>{n.enqueue(i)},onError(i){e==="terminate"?n.error(i):typeof e=="function"&&e(i)},onRetry:r,onComment:s})},transform(n){a.feed(n)}})}}const N0={initialReconnectionDelay:1e3,maxReconnectionDelay:3e4,reconnectionDelayGrowFactor:1.5,maxRetries:2};class mn extends Error{constructor(e,r){super(`Streamable HTTP error: ${r}`),this.code=e}}class vn{constructor(e,r){var s;this._hasCompletedAuthFlow=!1,this._url=e,this._resourceMetadataUrl=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._sessionId=r==null?void 0:r.sessionId,this._reconnectionOptions=(s=r==null?void 0:r.reconnectionOptions)!==null&&s!==void 0?s:N0}async _authThenStart(){var e;if(!this._authProvider)throw new Dt("No auth provider");let r;try{r=await ga(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,fetchFn:this._fetch})}catch(s){throw(e=this.onerror)===null||e===void 0||e.call(this,s),s}if(r!=="AUTHORIZED")throw new Dt;return await this._startOrAuthSse({resumptionToken:void 0})}async _commonHeaders(){var e;const r={};if(this._authProvider){const a=await this._authProvider.tokens();a&&(r.Authorization=`Bearer ${a.access_token}`)}this._sessionId&&(r["mcp-session-id"]=this._sessionId),this._protocolVersion&&(r["mcp-protocol-version"]=this._protocolVersion);const s=this._normalizeHeaders((e=this._requestInit)===null||e===void 0?void 0:e.headers);return new Headers({...r,...s})}async _startOrAuthSse(e){var r,s,a;const{resumptionToken:n}=e;try{const i=await this._commonHeaders();i.set("Accept","text/event-stream"),n&&i.set("last-event-id",n);const o=await((r=this._fetch)!==null&&r!==void 0?r:fetch)(this._url,{method:"GET",headers:i,signal:(s=this._abortController)===null||s===void 0?void 0:s.signal});if(!o.ok){if(o.status===401&&this._authProvider)return await this._authThenStart();if(o.status===405)return;throw new mn(o.status,`Failed to open SSE stream: ${o.statusText}`)}this._handleSseStream(o.body,e,!0)}catch(i){throw(a=this.onerror)===null||a===void 0||a.call(this,i),i}}_getNextReconnectionDelay(e){const r=this._reconnectionOptions.initialReconnectionDelay,s=this._reconnectionOptions.reconnectionDelayGrowFactor,a=this._reconnectionOptions.maxReconnectionDelay;return Math.min(r*Math.pow(s,e),a)}_normalizeHeaders(e){return e?e instanceof Headers?Object.fromEntries(e.entries()):Array.isArray(e)?Object.fromEntries(e):{...e}:{}}_scheduleReconnection(e,r=0){var s;const a=this._reconnectionOptions.maxRetries;if(a>0&&r>=a){(s=this.onerror)===null||s===void 0||s.call(this,new Error(`Maximum reconnection attempts (${a}) exceeded.`));return}const n=this._getNextReconnectionDelay(r);setTimeout(()=>{this._startOrAuthSse(e).catch(i=>{var o;(o=this.onerror)===null||o===void 0||o.call(this,new Error(`Failed to reconnect SSE stream: ${i instanceof Error?i.message:String(i)}`)),this._scheduleReconnection(e,r+1)})},n)}_handleSseStream(e,r,s){if(!e)return;const{onresumptiontoken:a,replayMessageId:n}=r;let i;(async()=>{var l,c,u,d;try{const g=e.pipeThrough(new TextDecoderStream).pipeThrough(new C0).getReader();for(;;){const{value:f,done:m}=await g.read();if(m)break;if(f.id&&(i=f.id,a==null||a(f.id)),!f.event||f.event==="message")try{const p=Fr.parse(JSON.parse(f.data));n!==void 0&&zi(p)&&(p.id=n),(l=this.onmessage)===null||l===void 0||l.call(this,p)}catch(p){(c=this.onerror)===null||c===void 0||c.call(this,p)}}}catch(g){if((u=this.onerror)===null||u===void 0||u.call(this,new Error(`SSE stream disconnected: ${g}`)),s&&this._abortController&&!this._abortController.signal.aborted)try{this._scheduleReconnection({resumptionToken:i,onresumptiontoken:a,replayMessageId:n},0)}catch(f){(d=this.onerror)===null||d===void 0||d.call(this,new Error(`Failed to reconnect: ${f instanceof Error?f.message:String(f)}`))}}})()}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 Dt("No auth provider");if(await ga(this._authProvider,{serverUrl:this._url,authorizationCode:e,resourceMetadataUrl:this._resourceMetadataUrl,fetchFn:this._fetch})!=="AUTHORIZED")throw new Dt("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 s,a,n,i;try{const{resumptionToken:o,onresumptiontoken:l}=r||{};if(o){this._startOrAuthSse({resumptionToken:o,replayMessageId:Ql(e)?e.id:void 0}).catch(h=>{var v;return(v=this.onerror)===null||v===void 0?void 0:v.call(this,h)});return}const c=await this._commonHeaders();c.set("content-type","application/json"),c.set("accept","application/json, text/event-stream");const u={...this._requestInit,method:"POST",headers:c,body:JSON.stringify(e),signal:(s=this._abortController)===null||s===void 0?void 0:s.signal},d=await((a=this._fetch)!==null&&a!==void 0?a:fetch)(this._url,u),g=d.headers.get("mcp-session-id");if(g&&(this._sessionId=g),!d.ok){if(d.status===401&&this._authProvider){if(this._hasCompletedAuthFlow)throw new mn(401,"Server returned 401 after successful authentication");if(this._resourceMetadataUrl=tc(d),await ga(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,fetchFn:this._fetch})!=="AUTHORIZED")throw new Dt;return this._hasCompletedAuthFlow=!0,this.send(e)}const h=await d.text().catch(()=>null);throw new Error(`Error POSTing to endpoint (HTTP ${d.status}): ${h}`)}if(this._hasCompletedAuthFlow=!1,d.status===202){$g(e)&&this._startOrAuthSse({resumptionToken:void 0}).catch(h=>{var v;return(v=this.onerror)===null||v===void 0?void 0:v.call(this,h)});return}const m=(Array.isArray(e)?e:[e]).filter(h=>"method"in h&&"id"in h&&h.id!==void 0).length>0,p=d.headers.get("content-type");if(m)if(p!=null&&p.includes("text/event-stream"))this._handleSseStream(d.body,{onresumptiontoken:l},!1);else if(p!=null&&p.includes("application/json")){const h=await d.json(),v=Array.isArray(h)?h.map(w=>Fr.parse(w)):[Fr.parse(h)];for(const w of v)(n=this.onmessage)===null||n===void 0||n.call(this,w)}else throw new mn(-1,`Unexpected content type: ${p}`)}catch(o){throw(i=this.onerror)===null||i===void 0||i.call(this,o),o}}get sessionId(){return this._sessionId}async terminateSession(){var e,r,s;if(this._sessionId)try{const a=await this._commonHeaders(),n={...this._requestInit,method:"DELETE",headers:a,signal:(e=this._abortController)===null||e===void 0?void 0:e.signal},i=await((r=this._fetch)!==null&&r!==void 0?r:fetch)(this._url,n);if(!i.ok&&i.status!==405)throw new mn(i.status,`Failed to terminate session: ${i.statusText}`);this._sessionId=void 0}catch(a){throw(s=this.onerror)===null||s===void 0||s.call(this,a),a}}setProtocolVersion(e){this._protocolVersion=e}get protocolVersion(){return this._protocolVersion}}const A0="mcp";class kd{constructor(e){this._url=e}start(){if(this._socket)throw new Error("WebSocketClientTransport already started! If using Client class, note that connect() calls start() automatically.");return new Promise((e,r)=>{this._socket=new WebSocket(this._url,A0),this._socket.onerror=s=>{var a;const n="error"in s?s.error:new Error(`WebSocket error: ${JSON.stringify(s)}`);r(n),(a=this.onerror)===null||a===void 0||a.call(this,n)},this._socket.onopen=()=>{e()},this._socket.onclose=()=>{var s;(s=this.onclose)===null||s===void 0||s.call(this)},this._socket.onmessage=s=>{var a,n;let i;try{i=Fr.parse(JSON.parse(s.data))}catch(o){(a=this.onerror)===null||a===void 0||a.call(this,o);return}(n=this.onmessage)===null||n===void 0||n.call(this,i)}})}async close(){var e;(e=this._socket)===null||e===void 0||e.close()}send(e){return new Promise((r,s)=>{var a;if(!this._socket){s(new Error("Not connected"));return}(a=this._socket)===null||a===void 0||a.send(JSON.stringify(e)),r()})}}function gn(){const t=["224340fQYLJj","function","onmessage","port2","341XVdnBD","313767JEBgqL","950bpstaX","1354759gUhUbE","wRKyh","onclose","2044SvCTUj","endpoint","24msSkHx","164VuWYGY","mOWMr","EkZCC","addEventListener","postMessage","120705iyGzUz","8878392ivIdKn","close","_listen","3619482FaLQHc","start","_endpoint","kgkem","bzNYT","MessageChannel transport error: ","stringify","onmessageerror","HvyCv","undefined","Jwyua","message","_globalObject","parse","authInfo","thraG","220pGvxgp","_port","EGhzU","onerror","data","MhriV"];return gn=function(){return t},gn()}(function(t,e){const r=Qe,s=Qe,a=t();for(;;)try{if(parseInt(r(417))/1*(parseInt(r(421))/2)+parseInt(r(433))/3+parseInt(r(424))/4*(-parseInt(s(429))/5)+parseInt(s(423))/6*(-parseInt(s(418))/7)+-parseInt(s(430))/8+-parseInt(r(416))/9*(-parseInt(r(405))/10)+-parseInt(r(415))/11*(-parseInt(r(411))/12)===e)break;a.push(a.shift())}catch{a.push(a.shift())}})(gn,650197);const Id=()=>{const t=Qe,e={EGhzU:function(r,s){return r!==s},kIrDB:"undefined",llYQe:function(r,s){return r!==s},PZfJg:function(r,s){return r(s)},Jwyua:"return this"};return typeof globalThis<"u"?globalThis:e[t(407)](typeof window,e.kIrDB)?window:e.llYQe(typeof global,e.kIrDB)?global:typeof self!==t(398)?self:e.PZfJg(Function,e[t(399)])()},j0=(t,e,r)=>{const s=Qe,a=Qe,n={};n[s(410)]=a(398),n.dBkaX=function(o,l){return o===l},n[a(393)]="function";const i=n;typeof window!==i[a(410)]?t.postMessage(e,"*",r):a(428)in t&&i.dBkaX(typeof t.postMessage,i[s(393)])&&t.postMessage(e,r)},D0=(t,e)=>{const r=Qe,s=Qe,a={};a.MbsGh="addEventListener",a.PPniK=function(i,o){return i===o},a[r(419)]=s(412),a[s(404)]="onmessage",a[r(397)]="undefined";const n=a;n.MbsGh in t&&n.PPniK(typeof t[r(427)],n.wRKyh)?t[r(427)](r(400),e):n.thraG in t&&typeof t[s(413)]!==n[s(397)]&&(t.onmessage=e)};class _n{constructor(e){const r=Qe;this[r(406)]=e}async start(){const e=Qe,r=Qe;this[e(406)]&&(this[e(406)][e(413)]=s=>{var a,n;const i=e,o=r;try{const l=Fr[i(402)](s.data[i(400)]);(a=this[i(413)])==null||a.call(this,l,s[o(409)].extra)}catch(l){const c=new Error("MessageChannel failed to parse message: "+l);(n=this[o(408)])==null||n.call(this,c)}},this._port[e(396)]=s=>{var a;const n=r,i=r,o=new Error(n(394)+JSON[i(395)](s));(a=this.onerror)==null||a.call(this,o)},this[e(406)][e(434)]())}async send(e,r){const s={lEyuq:function(a){return a()},YihNw:function(a,n){return a(n)}};return new Promise((a,n)=>{var i;const o=Qe,l=Qe;try{const c={};c[o(403)]=r==null?void 0:r[o(403)];const u={};u[l(400)]=e,u.extra=c,this[l(406)]&&this[o(406)].postMessage(u),s.lEyuq(a)}catch(c){const u=c instanceof Error?c:new Error(s.YihNw(String,c));(i=this[l(408)])==null||i.call(this,u),n(u)}})}async close(){var e,r;const s=Qe,a=Qe;(e=this._port)==null||e[s(431)](),this._port=void 0,(r=this[a(420)])==null||r.call(this)}}class ac extends _n{constructor(e,r=Id()){const s=Qe,a=Qe,n={EkZCC:function(o,l,c,u){return o(l,c,u)}};super(),this[s(391)]=e,this[a(401)]=r;const i=new MessageChannel;this[a(406)]=i.port1,n[a(426)](j0,this[s(401)],{endpoint:this[a(391)]},[i[a(414)]])}}class sc extends _n{constructor(e,r=Id()){const s=Qe,a={mOWMr:function(n,i){return n===i},kgkem:function(n,i,o){return n(i,o)}};super(),this._endpoint=e,this._globalObject=r,this[s(432)]=new Promise(n=>{const i=s,o=s;a[i(392)](D0,this[o(401)],l=>{const c=o,u=o;l.data&&a[c(425)](l.data[u(422)],this[u(391)])&&(this[u(406)]=l.ports[-1*4852+1*1601+3251],n())})})}async listen(){return this[Qe(432)]}}function Qe(t,e){const r=gn();return Qe=function(s,a){return s=s-(17*-491+-669+9407),r[s]},Qe(t,e)}const M0=()=>{const t=new MessageChannel;return[new _n(t.port1),new _n(t.port2)]};(function(t,e){const r=ke,s=ke,a=t();for(;;)try{if(parseInt(r(355))/1+-parseInt(r(356))/2*(-parseInt(r(373))/3)+-parseInt(r(337))/4+parseInt(s(357))/5+-parseInt(s(389))/6*(-parseInt(r(396))/7)+parseInt(s(325))/8*(parseInt(r(382))/9)+-parseInt(r(366))/10===e)break;a.push(a.shift())}catch{a.push(a.shift())}})(yn,-763475+-52067*10+1724410);const L0=async(t,e,r)=>{var s;const a=ke,n=ke,i={};i[a(345)]="tools/list",i.rqstG="tools/call",i.WqUnk="resources/list",i[a(329)]=n(358),i[a(365)]=a(335),i.ookoz="resources/unsubscribe",i[a(385)]=a(340),i.VTIWq="prompts/list",i.SkoRK=a(376),i.QUtUV=a(388),i.XtowM=n(332);const o=i,{id:l,method:c,params:u}=r;let d={};switch(c){case o[n(345)]:d=await e.listTools(u);break;case o.rqstG:d=await e.callTool(u);break;case o[a(334)]:d=await e[a(350)](u);break;case o[n(329)]:d=await e.listResourceTemplates(u);break;case a(372):d=await e[a(383)](u);break;case o.HgYgW:d=await e.subscribeResource(u);break;case o.ookoz:d=await e.unsubscribeResource(u);break;case o[a(385)]:d=await e.getPrompt(u);break;case o.VTIWq:d=await e.listPrompts(u);break;case o[a(344)]:d=await e[a(376)]();break;case o.QUtUV:d=await e.complete(u);break;case a(390):d=await e[a(336)](u==null?void 0:u.level);break}const g={};g[a(361)]=d,g[a(394)]=o[a(364)],g.id=l,await((s=t==null?void 0:t.transport)==null?void 0:s[a(392)](g))},F0=async(t,e,r)=>{var s;const a=ke,n=ke,i={};i.jQBBS="sampling/createMessage",i.EZqgC="elicitation/create",i[a(370)]=n(376),i.aVeaL=n(332);const o=i,{id:l,method:c,params:u}=r;let d={};switch(c){case a(368):const f={};f.method=c,f[n(367)]=u,d=await e.request(f,oo);break;case o[n(391)]:const m={};m.method=c,m[n(367)]=u,d=await e[n(381)](m,so);break;case o.EZqgC:const p={};p.method=c,p.params=u,d=await e.request(p,no);break;case o[n(370)]:const h={};h.method=c,d=await e[n(381)](h,br);break}const g={};return g[n(361)]=d,g.jsonrpc=o[n(387)],g.id=l,await((s=t==null?void 0:t[a(371)])==null?void 0:s.send(g)),d},q0=(t,e)=>{const r=ke,s={gXsjT:function(n,i){return n===i},oegpC:r(351),lZOUC:function(n,i,o,l){return n(i,o,l)},ifIKG:"2.0"},a=t._onrequest;t._onrequest=async(n,i)=>{var o,l,c,u,d;const g=r,f=r,{id:m,method:p}=n;try{s[g(333)](p,s.oegpC)?await a[g(386)](t,n,i):await s.lZOUC(L0,t,e,n)}catch(h){const{code:v,message:w,data:P}=h;try{if(v){const S={};S.code=v,S.message=w,S.data=P;const x={};x.error=S,x[g(394)]=s[f(331)],x.id=m,await((o=t==null?void 0:t.transport)==null?void 0:o.send(x))}else(c=(l=t==null?void 0:t[f(371)])==null?void 0:l.onerror)==null||c.call(l,h)}catch(S){(d=(u=t==null?void 0:t[g(371)])==null?void 0:u.onerror)==null||d.call(u,S)}}}},U0=(t,e)=>{const r=ke,s=ke,a={};a[r(363)]=function(i,o){return i!==o},a[r(398)]=r(353),a.hzhyg="notifications/cancelled";const n=a;t._onnotification=async i=>{var o,l;const c=r,u=s,{method:d,params:g}=i;if(n[c(363)](d,n[u(398)])&&(n[c(363)](d,n.hzhyg)||g!=null&&g.forward))try{await e.notification(i)}catch(f){(l=(o=t==null?void 0:t.transport)==null?void 0:o.onerror)==null||l.call(o,f)}}},V0=(t,e)=>async r=>{var s,a,n,i,o;const l=ke,c=ke,u={};u.SEmWX=l(332);const d=u;try{return await F0(t,e,r)}catch(g){const{code:f,message:m,data:p}=g;try{if(f){const h={};h[c(377)]=f,h.message=m,h.data=p;const v={};v[c(348)]=h,v.jsonrpc=d[l(338)],v.id=r.id,await((s=t==null?void 0:t.transport)==null?void 0:s[c(392)](v))}else(n=(a=t==null?void 0:t.transport)==null?void 0:a[c(339)])==null||n.call(a,g)}catch(h){(o=(i=t==null?void 0:t[l(371)])==null?void 0:i[c(339)])==null||o.call(i,h)}}},z0=(t,e)=>async r=>{var s,a,n;const i=ke,o=ke,l={};l.dtUgZ=function(g,f){return g!==f},l.jgCIb=i(353),l.uUjKY="2.0";const c=l,{method:u,params:d}=r;if(c.dtUgZ(u,c.jgCIb)&&(u!==i(400)||d!=null&&d.forward))try{const g={...r};g[i(394)]=c[o(352)],await((s=e==null?void 0:e[i(371)])==null?void 0:s[i(392)](g))}catch(g){(n=(a=t==null?void 0:t[i(371)])==null?void 0:a[o(339)])==null||n.call(a,g)}};function ke(t,e){const r=yn();return ke=function(s,a){return s=s-(9*-113+-1439*-1+-97),r[s]},ke(t,e)}const H0=(t,e)=>async r=>{var s,a,n,i,o,l;const c=ke,u=ke,d={};d[c(401)]=u(332);const g=d;try{await((s=e==null?void 0:e.transport)==null?void 0:s.send(r))}catch(f){const{code:m,message:p,data:h}=f;try{if(m){const v={};v.code=m,v[c(399)]=p,v.data=h;const w={};w[c(348)]=v,w[c(394)]=g.OhJjz,w.id=r.id,await((a=t==null?void 0:t[c(371)])==null?void 0:a.send(w))}else(i=(n=t==null?void 0:t.transport)==null?void 0:n[u(339)])==null||i.call(n,f)}catch(v){(l=(o=t==null?void 0:t.transport)==null?void 0:o.onerror)==null||l.call(o,v)}}},nc=()=>{const t=ke,e=ke,r={vnkqu:function(c,u){return c!==u},wxDWr:function(c,u){return c(u)},GdkkV:function(c,u){return c===u}},s=[],a=(c,u)=>{const d=ke,g=ke;if(u){const f=[];for(const m of s)try{f.push(m(c,u))}catch{}for(const m of f)if(r[d(379)](m,null))return m}else for(const f of s)try{r[g(343)](f,c)}catch{}},n=c=>{const u=ke;r[u(384)](typeof c,u(369))&&!s.includes(c)&&s.push(c)},i=c=>{const u=s.indexOf(c);u!==-1&&s.splice(u,1*-6854+8*-33+7119)},o=()=>{const c=ke;s[c(374)]=7102*1+5522+-526*24},l={};return l[t(346)]=a,l[e(330)]=n,l.removeListener=i,l[t(359)]=o,l},Z0=t=>{const e=ke,r=ke,s={xwPeb:function(a){return a()},Mfvzm:function(a){return a()}};{const{handleListener:a,addListener:n,removeListener:i,clearListener:o}=s[e(326)](nc);t._onresponse=a,t[e(395)]=n,t.removeResponseListener=i,t.clearResponseListener=o}{const{handleListener:a,addListener:n,removeListener:i,clearListener:o}=s[r(326)](nc);t[r(328)]=a,t.addRequestListener=n,t[r(354)]=i,t[r(341)]=o}{const{handleListener:a,addListener:n,removeListener:i,clearListener:o}=s[e(375)](nc);t[e(342)]=a,t[e(327)]=n,t.removeNotificationListener=i,t.clearNotificationListener=o}};function yn(){const t=["uUjKY","notifications/initialized","removeRequestListener","96194JysfjF","36346SGEWAV","1357830AJaOeY","resources/templates/list","clearListener","iQqcJ","result","tqDZP","sSeCz","XtowM","HgYgW","3913230mjiatC","params","roots/list","function","bfmJT","transport","resources/read","27FNuDmk","length","Mfvzm","ping","code","_onresponse","vnkqu","cjSoZ","request","9gIMIPC","readResource","GdkkV","ptMjy","call","aVeaL","completion/complete","5035122lFbpzR","logging/setLevel","jQBBS","send","_requestHandlers","jsonrpc","addResponseListener","7SpcenI","ElOQH","MDIkN","message","notifications/cancelled","OhJjz","clear","672216JzFEyR","xwPeb","addNotificationListener","fallbackRequestHandler","sYzPD","addListener","ifIKG","2.0","gXsjT","WqUnk","resources/subscribe","setLoggingLevel","2491772kFUWFh","SEmWX","onerror","prompts/get","clearRequestListener","fallbackNotificationHandler","wxDWr","SkoRK","uTeHc","handleListener","Zybtx","error","originalOnResponse","listResources","initialize"];return yn=function(){return t},yn()}const K0=(t,{beforeInit:e,afterInit:r}={})=>{const s=ke,a=ke,n={tqDZP:function(o,l){return o===l},cjSoZ:"function",iQqcJ:s(378),Zybtx:function(o,l){return o(l)},ElOQH:function(o){return o()}},i=new Map(t._notificationHandlers);t[s(393)][s(402)](),t._notificationHandlers[s(402)](),n.tqDZP(typeof e,n[s(380)])&&e(),n[s(362)](t._onresponse.name,n[s(360)])&&(t[a(349)]=t._onresponse),n[s(347)](Z0,t),t.addResponseListener(o=>{const l=a;t.originalOnResponse[l(386)](t,o)}),n.tqDZP(typeof r,n[a(380)])&&n[s(397)](r),t[a(327)](o=>{const{method:l}=o,c=i.get(l);n.tqDZP(typeof c,n.cjSoZ)&&c(o)})},B0=Jt,W0=Jt;(function(t,e){const r=Jt,s=Jt,a=t();for(;;)try{if(-parseInt(r(393))/1+parseInt(r(397))/2*(-parseInt(r(400))/3)+-parseInt(s(398))/4+parseInt(r(390))/5*(parseInt(s(388))/6)+-parseInt(r(389))/7+-parseInt(r(402))/8*(-parseInt(s(395))/9)+parseInt(s(399))/10*(parseInt(s(385))/11)===e)break;a.push(a.shift())}catch{a.push(a.shift())}})(wn,-1*-881393+2*180895+1*-644809);function Jt(t,e){const r=wn();return Jt=function(s,a){return s=s-(-1861+-499*4+4241),r[s]},Jt(t,e)}function wn(){const t=["toString","getRandomValues","2101mUsYMI","EQHzo","padStart","30UvDAkd","1609706yzlqYx","974735GrhZVO","randomUUID","REzPF","562771BvAnoG","dHTfU","2047455boiYXf","randomBytes","14664qHAdbF","3772144jLpQch","52310AkWksx","318MkjaVb","from","40WRwnSc"];return wn=function(){return t},wn()}const J0=()=>{const t=Jt,e=Jt,r={};r.REzPF=function(a,n){return a&n},r.suJHI=function(a,n){return a===n},r[t(386)]=function(a,n){return a&n},r[e(394)]="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx";const s=r;return s.suJHI(typeof crypto,"object")&&crypto.randomUUID?crypto[e(391)]():s.dHTfU.replace(/[xy]/g,a=>{const n=t,i=t,o=s[n(392)](crypto[n(384)](new Uint8Array(-25*-62+7113+2*-4331))[741*2+-1385*-2+4252*-1],8648+-107*62+-1999);return(s.suJHI(a,"x")?o:s[i(386)](o,-4377+4*1095)|5079+461*-11).toString(9449+4*-461+-7589)})},Q0=t=>{const e=Jt,r=Jt,s=new Uint8Array(t);return crypto.getRandomValues(s),Array[e(401)](s,a=>a[r(403)](-3*1739+-6509+2*5871)[e(387)](2,"0")).join("")},Rr={};Rr[B0(391)]=J0,Rr[W0(396)]=Q0;const wt=Qt;(function(t,e){const r=Qt,s=Qt,a=t();for(;;)try{if(parseInt(r(521))/1*(parseInt(s(499))/2)+parseInt(s(543))/3*(parseInt(s(514))/4)+parseInt(r(502))/5*(parseInt(s(539))/6)+parseInt(r(553))/7+parseInt(r(516))/8*(-parseInt(r(518))/9)+-parseInt(r(531))/10+-parseInt(r(545))/11*(parseInt(r(541))/12)===e)break;a.push(a.shift())}catch{a.push(a.shift())}})(bn,1472653*1+-2*-897917+-2275789);const G0=(t,e)=>{const r=Qt,s=Qt,a={FyYHt:function(l,c,u){return l(c,u)},Fxtoq:function(l,c,u){return l(c,u)}};q0(t,e),U0(t,e);const n=V0(e,t),i=a[r(510)](H0,e,t),o=a[s(549)](z0,e,t);e[s(537)](n),e[r(519)](i),e.addNotificationListener(o),t[s(556)]=()=>{const l=s;e.removeRequestListener(n),e[l(530)](i),e[l(529)](o)}},ic=(t,e,r)=>{const s=Qt,a={pMiva:function(o,l){return o instanceof l},TeTEy:s(546),fyZbd:function(o,l,c){return o(l,c)}},n=()=>{var o;const l=s;a.pMiva(r,ns)&&((o=r._eventSource)==null||o.addEventListener(a[l(547)],()=>{var c;const u=l;(c=r[u(509)])==null||c[u(546)]()})),G0(t,e)},i={};i.afterInit=n,a.fyZbd(K0,e,i)},Td=(t,e=Rr.randomUUID())=>{const r=Qt,s=Qt,a={OfssH:function(u,d,g){return u(d,g)}},n={};n[r(528)]=e;const i=n,o={};o[r(528)]=e;const l={};l[s(558)]=o,l[r(534)]=r(524);const c={requestInit:l,eventSourceInit:{async fetch(u,d){const g=r,f=s,m=new Headers((d==null?void 0:d[g(558)])||{});Object.entries(i)[f(498)](([h,v])=>{m[f(527)](h,v)});const p={...d};return p[f(558)]=m,a.OfssH(fetch,u,p)},withCredentials:!0}};return t&&(c.requestInit[r(558)].Authorization=r(533)+t,i.Authorization="Bearer "+t),c},Od=(t,e=Rr[wt(517)]())=>{const r=wt,s=wt,a={};a.nwQhY="include";const n=a,i={};i["stream-session-id"]=e;const o={};o.headers=i,o.credentials=n[r(520)];const l={};l[r(544)]=o;const c=l;return t&&(c.requestInit.headers[s(552)]=s(533)+t),c},oc=async(t,e,r)=>{const s=wt,a=wt,n={CFfFC:function(o){return o()},egwVO:function(o,l,c,u){return o(l,c,u)}},i=n.CFfFC(r);try{return await t[s(538)](i),i}catch(o){if(o instanceof Dt){const l=await e();return await i[a(505)](l),await n[s(525)](oc,t,e,r)}else throw o}};function Qt(t,e){const r=bn();return Qt=function(s,a){return s=s-(74*-67+-8341+-73*-189),r[s]},Qt(t,e)}const Cd=(t,e)=>{const r=wt,s=wt,a={};a.RsKXs=function(i,o){return i in o},a.PBhps="waitForOAuthCode",a[r(535)]="function",a[r(507)]="waitForOAuthCode need to be provided when authProvider is provided";const n=a;if(n.RsKXs(n[s(551)],t))return t[s(523)];if(typeof e===n.yTKoP)return e;throw new Error(n.RZhOv)},Y0=async t=>{const e=wt,r=wt,s={TFSRn:function(D,W,J){return D(W,J)},HwvVa:"mcp-sse-proxy-client",ufTHS:function(D){return D()},WIVYl:function(D,W,J,H){return D(W,J,H)},jniGY:"sessionId"},{client:a,url:n,token:i,sessionId:o,authProvider:l,requestInit:c,eventSourceInit:u,waitForOAuthCode:d}=t,g={};g.authProvider=l,g.requestInit=c,g.eventSourceInit=u;const f=g,m=o||Rr.randomUUID(),p=s[e(506)](Td,i,m);if(c){const D={...p.requestInit,...c};D.headers={...p[e(544)].headers,...c.headers},f.requestInit=D}else f[r(544)]=p.requestInit;if(u){const D={...p[e(559)],...u};f.eventSourceInit=D}else f.eventSourceInit=p.eventSourceInit;const h={};h.listChanged=!0;const v={};v.roots=h,v.sampling={},v[e(511)]={};const w=v,P={};P[r(536)]=s.HwvVa,P.version=e(526);const S={};S.capabilities=w;const x=new es(P,S),A=()=>new ns(new URL(n),f);let z=s[r(504)](A);if(l){const D=s[e(506)](Cd,l,d);z=await s[r(513)](oc,x,D,A)}else await x[e(538)](z);s[r(513)](ic,x,a,z),z[r(557)]=z[r(542)].searchParams[r(532)](s.jniGY);const U={};return U.transport=z,U.sessionId=z[e(557)],U};function bn(){const t=["ufTHS","finishAuth","TFSRn","RZhOv","Vajmx","_eventSource","FyYHt","elicitation","transport","WIVYl","13320uyrBtN","sampling","8WTwLJD","randomUUID","6438654bkJHij","addResponseListener","nwQhY","11721GVgRMJ","?sessionId=","waitForOAuthCode","include","egwVO","1.0.0","set","sse-session-id","removeNotificationListener","removeResponseListener","11838520fNkjrV","get","Bearer ","credentials","yTKoP","name","addRequestListener","connect","18VhCgQv","mcp-socket-proxy-client","2819364JNqkQZ","_endpoint","699JyrxCR","requestInit","44ofbsvb","close","TeTEy","QgzDy","Fxtoq","roots","PBhps","Authorization","11309130xGCFwl","&token=","version","onclose","sessionId","headers","eventSourceInit","forEach","62FcOkCa","mcp-stream-proxy-client","zXcpO","1794855cQEXDT","biJOc"];return bn=function(){return t},bn()}const X0=async t=>{const e=wt,r=wt,s={Vajmx:e(500),biJOc:function(D){return D()},zXcpO:function(D,W,J){return D(W,J)},zDnjZ:function(D,W,J,H){return D(W,J,H)},FQMAh:function(D,W,J,H){return D(W,J,H)}},{client:a,url:n,token:i,sessionId:o,authProvider:l,requestInit:c,reconnectionOptions:u,waitForOAuthCode:d}=t,g={};g.authProvider=l,g.requestInit=c,g.reconnectionOptions=u;const f=g,m=o||Rr.randomUUID(),p=Od(i,m);if(c){const D={...p.requestInit,...c};D.headers={...p.requestInit.headers,...c.headers},f[e(544)]=D}else f.requestInit=p.requestInit;const h={};h.listChanged=!0;const v={};v[r(550)]=h,v.sampling={},v.elicitation={};const w=v,P={};P[e(536)]=s[r(508)],P[e(555)]="1.0.0";const S={};S.capabilities=w;const x=new es(P,S),A=()=>new vn(new URL(n),f);let z=s[e(503)](A);if(l){const D=s[e(501)](Cd,l,d);z=await s.zDnjZ(oc,x,D,A)}else await x.connect(z);s.FQMAh(ic,x,a,z);const U={};return U.transport=z,U[r(557)]=z.sessionId,U},ew=async t=>{const e=wt,r=wt,s={QgzDy:e(540),jkaVB:function(v,w,P,S){return v(w,P,S)}},{client:a,url:n,token:i,sessionId:o}=t,l={};l.listChanged=!0;const c={};c[e(550)]=l,c[e(515)]={},c[r(511)]={};const u=c,d={};d.name=s[r(548)],d[r(555)]=r(526);const g={};g.capabilities=u;const f=new es(d,g),m=o||Rr[r(517)](),p=new kd(new URL(n+e(522)+m+r(554)+i));await f.connect(p),s.jkaVB(ic,f,a,p);const h={};return h[e(512)]=p,h[r(557)]=m,h},is=gt,$n=gt;function gt(t,e){const r=Pn();return gt=function(s,a){return s=s-(-16761+51*337),r[s]},gt(t,e)}(function(t,e){const r=gt,s=gt,a=t();for(;;)try{if(-parseInt(r(440))/1+-parseInt(r(458))/2*(parseInt(r(448))/3)+-parseInt(r(451))/4*(parseInt(s(449))/5)+-parseInt(s(455))/6+-parseInt(r(427))/7+-parseInt(s(438))/8*(parseInt(s(459))/9)+parseInt(r(430))/10*(parseInt(s(436))/11)===e)break;a.push(a.shift())}catch{a.push(a.shift())}})(Pn,-220880+1*-333337+-2*-384996);function Pn(){const t=["650XPHLhD","redirectToAuthorization","10856jPvMVb","GET","qcFPW","_redirectUrl","2187414WnlGuZ","resolve","tokens","3976YyOqUl","27ejNHsa","Content-Type","waitForOAuthCode","2903796yvWZFa","_clientMetadata","application/x-www-form-urlencoded","10beEWJk","json","code","_callBackPromise","reject","saveClientInformation","20776349mLNCcF","_codeVerifier","629912aTknXq","_tokens","52074GwcpRo","state","_state","_redirectCallback","_clientInformation","redirect_uris","Failed to redirect: ","clientInformation","381aduWsB"];return Pn=function(){return t},Pn()}const tw=()=>Rr.randomBytes(3485*1+-261+-3184);class rw{constructor(e){const r=gt,s=gt;this._callBackPromise={};const{clientMetadata:a,state:n,redirectCallback:i,getAuthCodeByState:o,waitForOAuthCode:l}=e;this[r(428)]=a,this[r(454)]=a[r(445)][0],this._state=n||tw(),this._redirectCallback=i||this.redirectCallbackFunction,this._getAuthCodeByState=o||this.getAuthCodeByStateFunction,this[s(426)]=l||this.waitForOAuthCodeFunction()}async redirectCallbackFunction(e){var r,s,a,n,i,o;const l=gt,c=gt,u={qITTp:function(m,p,h){return m(p,h)},qcFPW:l(452)},d=await u.qITTp(fetch,e,{method:u[l(453)]});!d.ok&&((s=(r=this._callBackPromise).reject)==null||s.call(r,c(446)+d.statusText));const g=await this._getAuthCodeByState(this[c(454)],this[l(442)]);if(!g.ok){(n=(a=this[l(433)]).reject)==null||n.call(a,"Failed to fetch auth code: "+g.statusText);return}const f=await g[l(431)]();(o=(i=this[c(433)])[l(456)])==null||o.call(i,f[l(432)])}async getAuthCodeByStateFunction(e,r){const s=gt,a=gt,n={};n.tuSmb=s(429);const i=n,o={};o[s(460)]=i.tuSmb;const l={};return l[a(441)]=r,fetch(e,{method:"POST",headers:o,body:new URLSearchParams(l)})}waitForOAuthCodeFunction(){const e=gt,r=this[e(433)];return()=>new Promise((s,a)=>{const n=e;r.resolve=s,r[n(434)]=a})}get redirectUrl(){return this[gt(454)]}get clientMetadata(){return this._clientMetadata}state(){return this._state}[is(447)](){return this[is(444)]}[$n(435)](e){const r=is;this[r(444)]=e}[$n(457)](){return this[$n(439)]}saveTokens(e){this._tokens=e}[$n(450)](e){this[is(443)](e)}saveCodeVerifier(e){this._codeVerifier=e}codeVerifier(){if(!this[is(437)])throw new Error("No code verifier saved");return this._codeVerifier}}(function(t,e){for(var r=Sn,s=Sn,a=t();;)try{var n=parseInt(r(361))/1*(parseInt(s(363))/2)+-parseInt(r(358))/3+parseInt(r(359))/4*(parseInt(r(357))/5)+parseInt(s(354))/6*(parseInt(r(360))/7)+parseInt(s(362))/8+parseInt(s(364))/9+-parseInt(s(356))/10*(parseInt(r(355))/11);if(n===e)break;a.push(a.shift())}catch{a.push(a.shift())}})(En,-73523*-3+1*-407717+530518);function En(){var t=["40ecBYYe","1095owKKYD","486870YOVwZy","5752xWiyTO","561484biNVMw","1fWJmxQ","1866064SPnyhb","1109522vMiuMX","1602351pPEGwH","12sVyMLL","2573296LTwOhv"];return En=function(){return t},En()}function Sn(t,e){var r=En();return Sn=function(s,a){s=s-(-1*-642+503*-5+2227);var n=r[s];return n},Sn(t,e)}class aw extends Ru{constructor(e,r){var s;super(r),this._serverInfo=e,this._loggingLevels=new Map,this.LOG_LEVEL_SEVERITY=new Map(Ks.options.map((a,n)=>[a,n])),this.isMessageIgnored=(a,n)=>{const i=this._loggingLevels.get(n);return i?this.LOG_LEVEL_SEVERITY.get(a)<this.LOG_LEVEL_SEVERITY.get(i):!1},this._capabilities=(s=r==null?void 0:r.capabilities)!==null&&s!==void 0?s:{},this._instructions=r==null?void 0:r.instructions,this.setRequestHandler(tu,a=>this._oninitialize(a)),this.setNotificationHandler(Zi,()=>{var a;return(a=this.oninitialized)===null||a===void 0?void 0:a.call(this)}),this._capabilities.logging&&this.setRequestHandler(Bs,async(a,n)=>{var i;const o=n.sessionId||((i=n.requestInfo)===null||i===void 0?void 0:i.headers["mcp-session-id"])||void 0,{level:l}=a.params,c=Ks.safeParse(l);return c.success&&this._loggingLevels.set(o,c.data),{}})}registerCapabilities(e){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=xu(this._capabilities,e)}assertCapabilityForMethod(e){var r,s,a;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(!(!((s=this._clientCapabilities)===null||s===void 0)&&s.elicitation))throw new Error(`Client does not support elicitation (required for ${e})`);break;case"roots/list":if(!(!((a=this._clientCapabilities)===null||a===void 0)&&a.roots))throw new Error(`Client does not support listing roots (required for ${e})`);break}}assertNotificationCapability(e){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}}assertRequestHandlerCapability(e){switch(e){case"sampling/createMessage":if(!this._capabilities.sampling)throw new Error(`Server does not support sampling (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:Kl.includes(r)?r:Ja,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"},br)}async createMessage(e,r){return this.request({method:"sampling/createMessage",params:e},so,r)}async elicitInput(e,r){const s=await this.request({method:"elicitation/create",params:e},no,r);if(s.action==="accept"&&s.content)try{const a=new md,n=a.compile(e.requestedSchema);if(!n(s.content))throw new Ae(Oe.InvalidParams,`Elicitation response content does not match requested schema: ${a.errorsText(n.errors)}`)}catch(a){throw a instanceof Ae?a:new Ae(Oe.InternalError,`Error validating elicitation response: ${a}`)}return s}async listRoots(e,r){return this.request({method:"roots/list",params:e},oo,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 sw=Symbol("Let zodToJsonSchema decide on which parser to use"),Nd={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"},nw=t=>typeof t=="string"?{...Nd,name:t}:{...Nd,...t},iw=t=>{const e=nw(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(([s,a])=>[a._def,{def:a._def,path:[...e.basePath,e.definitionPath,s],jsonSchema:void 0}]))}};function Ad(t,e,r,s){s!=null&&s.errorMessages&&r&&(t.errorMessage={...t.errorMessage,[e]:r})}function Re(t,e,r,s,a){t[e]=r,Ad(t,e,s,a)}const jd=(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 _t(t){if(t.target!=="openAi")return{};const e=[...t.basePath,t.definitionPath,t.openAiAnyTypeName];return t.flags.hasReferencedOpenAiAnyType=!0,{$ref:t.$refStrategy==="relative"?jd(e,t.currentPath):e.join("/")}}function ow(t,e){var s,a,n;const r={type:"array"};return(s=t.type)!=null&&s._def&&((n=(a=t.type)==null?void 0:a._def)==null?void 0:n.typeName)!==V.ZodAny&&(r.items=Se(t.type._def,{...e,currentPath:[...e.currentPath,"items"]})),t.minLength&&Re(r,"minItems",t.minLength.value,t.minLength.message,e),t.maxLength&&Re(r,"maxItems",t.maxLength.value,t.maxLength.message,e),t.exactLength&&(Re(r,"minItems",t.exactLength.value,t.exactLength.message,e),Re(r,"maxItems",t.exactLength.value,t.exactLength.message,e)),r}function cw(t,e){const r={type:"integer",format:"int64"};if(!t.checks)return r;for(const s of t.checks)switch(s.kind){case"min":e.target==="jsonSchema7"?s.inclusive?Re(r,"minimum",s.value,s.message,e):Re(r,"exclusiveMinimum",s.value,s.message,e):(s.inclusive||(r.exclusiveMinimum=!0),Re(r,"minimum",s.value,s.message,e));break;case"max":e.target==="jsonSchema7"?s.inclusive?Re(r,"maximum",s.value,s.message,e):Re(r,"exclusiveMaximum",s.value,s.message,e):(s.inclusive||(r.exclusiveMaximum=!0),Re(r,"maximum",s.value,s.message,e));break;case"multipleOf":Re(r,"multipleOf",s.value,s.message,e);break}return r}function lw(){return{type:"boolean"}}function Dd(t,e){return Se(t.type._def,e)}const uw=(t,e)=>Se(t.innerType._def,e);function Md(t,e,r){const s=r??e.dateStrategy;if(Array.isArray(s))return{anyOf:s.map((a,n)=>Md(t,e,a))};switch(s){case"string":case"format:date-time":return{type:"string",format:"date-time"};case"format:date":return{type:"string",format:"date"};case"integer":return dw(t,e)}}const dw=(t,e)=>{const r={type:"integer",format:"unix-time"};if(e.target==="openApi3")return r;for(const s of t.checks)switch(s.kind){case"min":Re(r,"minimum",s.value,s.message,e);break;case"max":Re(r,"maximum",s.value,s.message,e);break}return r};function fw(t,e){return{...Se(t.innerType._def,e),default:t.defaultValue()}}function hw(t,e){return e.effectStrategy==="input"?Se(t.schema._def,e):_t(e)}function pw(t){return{type:"string",enum:Array.from(t.values)}}const mw=t=>"type"in t&&t.type==="string"?!1:"allOf"in t;function vw(t,e){const r=[Se(t.left._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),Se(t.right._def,{...e,currentPath:[...e.currentPath,"allOf","1"]})].filter(n=>!!n);let s=e.target==="jsonSchema2019-09"?{unevaluatedProperties:!1}:void 0;const a=[];return r.forEach(n=>{if(mw(n))a.push(...n.allOf),n.unevaluatedProperties===void 0&&(s=void 0);else{let i=n;if("additionalProperties"in n&&n.additionalProperties===!1){const{additionalProperties:o,...l}=n;i=l}else s=void 0;a.push(i)}}),a.length?{allOf:a,...s}:void 0}function gw(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 cc;const Mt={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:()=>(cc===void 0&&(cc=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),cc),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 Ld(t,e){const r={type:"string"};if(t.checks)for(const s of t.checks)switch(s.kind){case"min":Re(r,"minLength",typeof r.minLength=="number"?Math.max(r.minLength,s.value):s.value,s.message,e);break;case"max":Re(r,"maxLength",typeof r.maxLength=="number"?Math.min(r.maxLength,s.value):s.value,s.message,e);break;case"email":switch(e.emailStrategy){case"format:email":Lt(r,"email",s.message,e);break;case"format:idn-email":Lt(r,"idn-email",s.message,e);break;case"pattern:zod":ft(r,Mt.email,s.message,e);break}break;case"url":Lt(r,"uri",s.message,e);break;case"uuid":Lt(r,"uuid",s.message,e);break;case"regex":ft(r,s.regex,s.message,e);break;case"cuid":ft(r,Mt.cuid,s.message,e);break;case"cuid2":ft(r,Mt.cuid2,s.message,e);break;case"startsWith":ft(r,RegExp(`^${lc(s.value,e)}`),s.message,e);break;case"endsWith":ft(r,RegExp(`${lc(s.value,e)}$`),s.message,e);break;case"datetime":Lt(r,"date-time",s.message,e);break;case"date":Lt(r,"date",s.message,e);break;case"time":Lt(r,"time",s.message,e);break;case"duration":Lt(r,"duration",s.message,e);break;case"length":Re(r,"minLength",typeof r.minLength=="number"?Math.max(r.minLength,s.value):s.value,s.message,e),Re(r,"maxLength",typeof r.maxLength=="number"?Math.min(r.maxLength,s.value):s.value,s.message,e);break;case"includes":{ft(r,RegExp(lc(s.value,e)),s.message,e);break}case"ip":{s.version!=="v6"&&Lt(r,"ipv4",s.message,e),s.version!=="v4"&&Lt(r,"ipv6",s.message,e);break}case"base64url":ft(r,Mt.base64url,s.message,e);break;case"jwt":ft(r,Mt.jwt,s.message,e);break;case"cidr":{s.version!=="v6"&&ft(r,Mt.ipv4Cidr,s.message,e),s.version!=="v4"&&ft(r,Mt.ipv6Cidr,s.message,e);break}case"emoji":ft(r,Mt.emoji(),s.message,e);break;case"ulid":{ft(r,Mt.ulid,s.message,e);break}case"base64":{switch(e.base64Strategy){case"format:binary":{Lt(r,"binary",s.message,e);break}case"contentEncoding:base64":{Re(r,"contentEncoding","base64",s.message,e);break}case"pattern:zod":{ft(r,Mt.base64,s.message,e);break}}break}case"nanoid":ft(r,Mt.nanoid,s.message,e)}return r}function lc(t,e){return e.patternStrategy==="escape"?yw(t):t}const _w=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function yw(t){let e="";for(let r=0;r<t.length;r++)_w.has(t[r])||(e+="\\"),e+=t[r];return e}function Lt(t,e,r,s){var a;t.format||(a=t.anyOf)!=null&&a.some(n=>n.format)?(t.anyOf||(t.anyOf=[]),t.format&&(t.anyOf.push({format:t.format,...t.errorMessage&&s.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&&s.errorMessages&&{errorMessage:{format:r}}})):Re(t,"format",e,r,s)}function ft(t,e,r,s){var a;t.pattern||(a=t.allOf)!=null&&a.some(n=>n.pattern)?(t.allOf||(t.allOf=[]),t.pattern&&(t.allOf.push({pattern:t.pattern,...t.errorMessage&&s.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:Fd(e,s),...r&&s.errorMessages&&{errorMessage:{pattern:r}}})):Re(t,"pattern",Fd(e,s),r,s)}function Fd(t,e){var l;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")},s=r.i?t.source.toLowerCase():t.source;let a="",n=!1,i=!1,o=!1;for(let c=0;c<s.length;c++){if(n){a+=s[c],n=!1;continue}if(r.i){if(i){if(s[c].match(/[a-z]/)){o?(a+=s[c],a+=`${s[c-2]}-${s[c]}`.toUpperCase(),o=!1):s[c+1]==="-"&&((l=s[c+2])!=null&&l.match(/[a-z]/))?(a+=s[c],o=!0):a+=`${s[c]}${s[c].toUpperCase()}`;continue}}else if(s[c].match(/[a-z]/)){a+=`[${s[c]}${s[c].toUpperCase()}]`;continue}}if(r.m){if(s[c]==="^"){a+=`(^|(?<=[\r
13
- ]))`;continue}else if(s[c]==="$"){a+=`($|(?=[\r
14
- ]))`;continue}}if(r.s&&s[c]==="."){a+=i?`${s[c]}\r
15
- `:`[${s[c]}\r
16
- ]`;continue}a+=s[c],s[c]==="\\"?n=!0:i&&s[c]==="]"?i=!1:!i&&s[c]==="["&&(i=!0)}try{new RegExp(a)}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 a}function qd(t,e){var s,a,n,i,o,l;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"&&((s=t.keyType)==null?void 0:s._def.typeName)===V.ZodEnum)return{type:"object",required:t.keyType._def.values,properties:t.keyType._def.values.reduce((c,u)=>({...c,[u]:Se(t.valueType._def,{...e,currentPath:[...e.currentPath,"properties",u]})??_t(e)}),{}),additionalProperties:e.rejectedAdditionalProperties};const r={type:"object",additionalProperties:Se(t.valueType._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]})??e.allowedAdditionalProperties};if(e.target==="openApi3")return r;if(((a=t.keyType)==null?void 0:a._def.typeName)===V.ZodString&&((n=t.keyType._def.checks)!=null&&n.length)){const{type:c,...u}=Ld(t.keyType._def,e);return{...r,propertyNames:u}}else{if(((i=t.keyType)==null?void 0:i._def.typeName)===V.ZodEnum)return{...r,propertyNames:{enum:t.keyType._def.values}};if(((o=t.keyType)==null?void 0:o._def.typeName)===V.ZodBranded&&t.keyType._def.type._def.typeName===V.ZodString&&((l=t.keyType._def.type._def.checks)!=null&&l.length)){const{type:c,...u}=Dd(t.keyType._def,e);return{...r,propertyNames:u}}}return r}function ww(t,e){if(e.mapStrategy==="record")return qd(t,e);const r=Se(t.keyType._def,{...e,currentPath:[...e.currentPath,"items","items","0"]})||_t(e),s=Se(t.valueType._def,{...e,currentPath:[...e.currentPath,"items","items","1"]})||_t(e);return{type:"array",maxItems:125,items:{type:"array",items:[r,s],minItems:2,maxItems:2}}}function bw(t){const e=t.values,s=Object.keys(t.values).filter(n=>typeof e[e[n]]!="number").map(n=>e[n]),a=Array.from(new Set(s.map(n=>typeof n)));return{type:a.length===1?a[0]==="string"?"string":"number":["string","number"],enum:s}}function $w(t){return t.target==="openAi"?void 0:{not:_t({...t,currentPath:[...t.currentPath,"not"]})}}function Pw(t){return t.target==="openApi3"?{enum:["null"],nullable:!0}:{type:"null"}}const Rn={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};function Ew(t,e){if(e.target==="openApi3")return Ud(t,e);const r=t.options instanceof Map?Array.from(t.options.values()):t.options;if(r.every(s=>s._def.typeName in Rn&&(!s._def.checks||!s._def.checks.length))){const s=r.reduce((a,n)=>{const i=Rn[n._def.typeName];return i&&!a.includes(i)?[...a,i]:a},[]);return{type:s.length>1?s:s[0]}}else if(r.every(s=>s._def.typeName==="ZodLiteral"&&!s.description)){const s=r.reduce((a,n)=>{const i=typeof n._def.value;switch(i){case"string":case"number":case"boolean":return[...a,i];case"bigint":return[...a,"integer"];case"object":if(n._def.value===null)return[...a,"null"];case"symbol":case"undefined":case"function":default:return a}},[]);if(s.length===r.length){const a=s.filter((n,i,o)=>o.indexOf(n)===i);return{type:a.length>1?a:a[0],enum:r.reduce((n,i)=>n.includes(i._def.value)?n:[...n,i._def.value],[])}}}else if(r.every(s=>s._def.typeName==="ZodEnum"))return{type:"string",enum:r.reduce((s,a)=>[...s,...a._def.values.filter(n=>!s.includes(n))],[])};return Ud(t,e)}const Ud=(t,e)=>{const r=(t.options instanceof Map?Array.from(t.options.values()):t.options).map((s,a)=>Se(s._def,{...e,currentPath:[...e.currentPath,"anyOf",`${a}`]})).filter(s=>!!s&&(!e.strictUnions||typeof s=="object"&&Object.keys(s).length>0));return r.length?{anyOf:r}:void 0};function Sw(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:Rn[t.innerType._def.typeName],nullable:!0}:{type:[Rn[t.innerType._def.typeName],"null"]};if(e.target==="openApi3"){const s=Se(t.innerType._def,{...e,currentPath:[...e.currentPath]});return s&&"$ref"in s?{allOf:[s],nullable:!0}:s&&{...s,nullable:!0}}const r=Se(t.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","0"]});return r&&{anyOf:[r,{type:"null"}]}}function Rw(t,e){const r={type:"number"};if(!t.checks)return r;for(const s of t.checks)switch(s.kind){case"int":r.type="integer",Ad(r,"type",s.message,e);break;case"min":e.target==="jsonSchema7"?s.inclusive?Re(r,"minimum",s.value,s.message,e):Re(r,"exclusiveMinimum",s.value,s.message,e):(s.inclusive||(r.exclusiveMinimum=!0),Re(r,"minimum",s.value,s.message,e));break;case"max":e.target==="jsonSchema7"?s.inclusive?Re(r,"maximum",s.value,s.message,e):Re(r,"exclusiveMaximum",s.value,s.message,e):(s.inclusive||(r.exclusiveMaximum=!0),Re(r,"maximum",s.value,s.message,e));break;case"multipleOf":Re(r,"multipleOf",s.value,s.message,e);break}return r}function xw(t,e){const r=e.target==="openAi",s={type:"object",properties:{}},a=[],n=t.shape();for(const o in n){let l=n[o];if(l===void 0||l._def===void 0)continue;let c=Iw(l);c&&r&&(l._def.typeName==="ZodOptional"&&(l=l._def.innerType),l.isNullable()||(l=l.nullable()),c=!1);const u=Se(l._def,{...e,currentPath:[...e.currentPath,"properties",o],propertyPath:[...e.currentPath,"properties",o]});u!==void 0&&(s.properties[o]=u,c||a.push(o))}a.length&&(s.required=a);const i=kw(t,e);return i!==void 0&&(s.additionalProperties=i),s}function kw(t,e){if(t.catchall._def.typeName!=="ZodNever")return Se(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 Iw(t){try{return t.isOptional()}catch{return!0}}const Tw=(t,e)=>{var s;if(e.currentPath.toString()===((s=e.propertyPath)==null?void 0:s.toString()))return Se(t.innerType._def,e);const r=Se(t.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","1"]});return r?{anyOf:[{not:_t(e)},r]}:_t(e)},Ow=(t,e)=>{if(e.pipeStrategy==="input")return Se(t.in._def,e);if(e.pipeStrategy==="output")return Se(t.out._def,e);const r=Se(t.in._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),s=Se(t.out._def,{...e,currentPath:[...e.currentPath,"allOf",r?"1":"0"]});return{allOf:[r,s].filter(a=>a!==void 0)}};function Cw(t,e){return Se(t.type._def,e)}function Nw(t,e){const s={type:"array",uniqueItems:!0,items:Se(t.valueType._def,{...e,currentPath:[...e.currentPath,"items"]})};return t.minSize&&Re(s,"minItems",t.minSize.value,t.minSize.message,e),t.maxSize&&Re(s,"maxItems",t.maxSize.value,t.maxSize.message,e),s}function Aw(t,e){return t.rest?{type:"array",minItems:t.items.length,items:t.items.map((r,s)=>Se(r._def,{...e,currentPath:[...e.currentPath,"items",`${s}`]})).reduce((r,s)=>s===void 0?r:[...r,s],[]),additionalItems:Se(t.rest._def,{...e,currentPath:[...e.currentPath,"additionalItems"]})}:{type:"array",minItems:t.items.length,maxItems:t.items.length,items:t.items.map((r,s)=>Se(r._def,{...e,currentPath:[...e.currentPath,"items",`${s}`]})).reduce((r,s)=>s===void 0?r:[...r,s],[])}}function jw(t){return{not:_t(t)}}function Dw(t){return _t(t)}const Mw=(t,e)=>Se(t.innerType._def,e),Lw=(t,e,r)=>{switch(e){case V.ZodString:return Ld(t,r);case V.ZodNumber:return Rw(t,r);case V.ZodObject:return xw(t,r);case V.ZodBigInt:return cw(t,r);case V.ZodBoolean:return lw();case V.ZodDate:return Md(t,r);case V.ZodUndefined:return jw(r);case V.ZodNull:return Pw(r);case V.ZodArray:return ow(t,r);case V.ZodUnion:case V.ZodDiscriminatedUnion:return Ew(t,r);case V.ZodIntersection:return vw(t,r);case V.ZodTuple:return Aw(t,r);case V.ZodRecord:return qd(t,r);case V.ZodLiteral:return gw(t,r);case V.ZodEnum:return pw(t);case V.ZodNativeEnum:return bw(t);case V.ZodNullable:return Sw(t,r);case V.ZodOptional:return Tw(t,r);case V.ZodMap:return ww(t,r);case V.ZodSet:return Nw(t,r);case V.ZodLazy:return()=>t.getter()._def;case V.ZodPromise:return Cw(t,r);case V.ZodNaN:case V.ZodNever:return $w(r);case V.ZodEffects:return hw(t,r);case V.ZodAny:return _t(r);case V.ZodUnknown:return Dw(r);case V.ZodDefault:return fw(t,r);case V.ZodBranded:return Dd(t,r);case V.ZodReadonly:return Mw(t,r);case V.ZodCatch:return uw(t,r);case V.ZodPipeline:return Ow(t,r);case V.ZodFunction:case V.ZodVoid:case V.ZodSymbol:return;default:return(s=>{})()}};function Se(t,e,r=!1){var o;const s=e.seen.get(t);if(e.override){const l=(o=e.override)==null?void 0:o.call(e,t,e,s,r);if(l!==sw)return l}if(s&&!r){const l=Fw(s,e);if(l!==void 0)return l}const a={def:t,path:e.currentPath,jsonSchema:void 0};e.seen.set(t,a);const n=Lw(t,t.typeName,e),i=typeof n=="function"?Se(n(),e):n;if(i&&qw(t,e,i),e.postProcess){const l=e.postProcess(i,t,e);return a.jsonSchema=i,l}return a.jsonSchema=i,i}const Fw=(t,e)=>{switch(e.$refStrategy){case"root":return{$ref:t.path.join("/")};case"relative":return{$ref:jd(e.currentPath,t.path)};case"none":case"seen":return t.path.length<e.currentPath.length&&t.path.every((r,s)=>e.currentPath[s]===r)?(console.warn(`Recursive reference detected at ${e.currentPath.join("/")}! Defaulting to any`),_t(e)):e.$refStrategy==="seen"?_t(e):void 0}},qw=(t,e,r)=>(t.description&&(r.description=t.description,e.markdownDescription&&(r.markdownDescription=t.description)),r),Vd=(t,e)=>{const r=iw(e);let s=typeof e=="object"&&e.definitions?Object.entries(e.definitions).reduce((l,[c,u])=>({...l,[c]:Se(u._def,{...r,currentPath:[...r.basePath,r.definitionPath,c]},!0)??_t(r)}),{}):void 0;const a=typeof e=="string"?e:(e==null?void 0:e.nameStrategy)==="title"||e==null?void 0:e.name,n=Se(t._def,a===void 0?r:{...r,currentPath:[...r.basePath,r.definitionPath,a]},!1)??_t(r),i=typeof e=="object"&&e.name!==void 0&&e.nameStrategy==="title"?e.name:void 0;i!==void 0&&(n.title=i),r.flags.hasReferencedOpenAiAnyType&&(s||(s={}),s[r.openAiAnyTypeName]||(s[r.openAiAnyTypeName]={type:["string","number","integer","boolean","array","null"],items:{$ref:r.$refStrategy==="relative"?"1":[...r.basePath,r.definitionPath,r.openAiAnyTypeName].join("/")}}));const o=a===void 0?s?{...n,[r.definitionPath]:s}:n:{$ref:[...r.$refStrategy==="relative"?[]:r.basePath,r.definitionPath,a].join("/"),[r.definitionPath]:{...s,[a]:n}};return r.target==="jsonSchema7"?o.$schema="http://json-schema.org/draft-07/schema#":(r.target==="jsonSchema2019-09"||r.target==="openAi")&&(o.$schema="https://json-schema.org/draft/2019-09/schema#"),r.target==="openAi"&&("anyOf"in o||"oneOf"in o||"allOf"in o||"type"in o&&Array.isArray(o.type))&&console.warn("Warning: OpenAI may not support schemas with unions as roots! Try wrapping it in an object property."),o};var uc;(function(t){t.Completable="McpCompletable"})(uc||(uc={}));class xn extends me{_parse(e){const{ctx:r}=this._processInputParams(e),s=r.data;return this._def.type._parse({data:s,path:r.path,parent:r})}unwrap(){return this._def.type}}xn.create=(t,e)=>new xn({type:t,typeName:uc.Completable,complete:e.complete,...Vw(e)});function Uw(t,e){return xn.create(t,{...t._def,complete:e})}function Vw(t){if(!t)return{};const{errorMap:e,invalid_type_error:r,required_error:s,description:a}=t;if(e&&(r||s))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:a}:{errorMap:(i,o)=>{var l,c;const{message:u}=t;return i.code==="invalid_enum_value"?{message:u??o.defaultError}:typeof o.data>"u"?{message:(l=u??s)!==null&&l!==void 0?l:o.defaultError}:i.code!=="invalid_type"?{message:o.defaultError}:{message:(c=u??r)!==null&&c!==void 0?c:o.defaultError}},description:a}}const zd=1e6,dc=1e6,Hd=1e4,zw=1e6;class lr{static isTemplate(e){return/\{[^}\s]+\}/.test(e)}static validateLength(e,r,s){if(e.length>r)throw new Error(`${s} exceeds maximum length of ${r} characters (got ${e.length})`)}get variableNames(){return this.parts.flatMap(e=>typeof e=="string"?[]:e.names)}constructor(e){lr.validateLength(e,zd,"Template"),this.template=e,this.parts=this.parse(e)}toString(){return this.template}parse(e){const r=[];let s="",a=0,n=0;for(;a<e.length;)if(e[a]==="{"){s&&(r.push(s),s="");const i=e.indexOf("}",a);if(i===-1)throw new Error("Unclosed template expression");if(n++,n>Hd)throw new Error(`Template contains too many expressions (max ${Hd})`);const o=e.slice(a+1,i),l=this.getOperator(o),c=o.includes("*"),u=this.getNames(o),d=u[0];for(const g of u)lr.validateLength(g,dc,"Variable name");r.push({name:d,operator:l,names:u,exploded:c}),a=i+1}else s+=e[a],a++;return s&&r.push(s),r}getOperator(e){return["+","#",".","/","?","&"].find(s=>e.startsWith(s))||""}getNames(e){const r=this.getOperator(e);return e.slice(r.length).split(",").map(s=>s.replace("*","").trim()).filter(s=>s.length>0)}encodeValue(e,r){return lr.validateLength(e,dc,"Variable value"),r==="+"||r==="#"?encodeURI(e):encodeURIComponent(e)}expandPart(e,r){if(e.operator==="?"||e.operator==="&"){const i=e.names.map(l=>{const c=r[l];if(c===void 0)return"";const u=Array.isArray(c)?c.map(d=>this.encodeValue(d,e.operator)).join(","):this.encodeValue(c.toString(),e.operator);return`${l}=${u}`}).filter(l=>l.length>0);return i.length===0?"":(e.operator==="?"?"?":"&")+i.join("&")}if(e.names.length>1){const i=e.names.map(o=>r[o]).filter(o=>o!==void 0);return i.length===0?"":i.map(o=>Array.isArray(o)?o[0]:o).join(",")}const s=r[e.name];if(s===void 0)return"";const n=(Array.isArray(s)?s:[s]).map(i=>this.encodeValue(i,e.operator));switch(e.operator){case"":return n.join(",");case"+":return n.join(",");case"#":return"#"+n.join(",");case".":return"."+n.join(".");case"/":return"/"+n.join("/");default:return n.join(",")}}expand(e){let r="",s=!1;for(const a of this.parts){if(typeof a=="string"){r+=a;continue}const n=this.expandPart(a,e);n&&((a.operator==="?"||a.operator==="&")&&s?r+=n.replace("?","&"):r+=n,(a.operator==="?"||a.operator==="&")&&(s=!0))}return r}escapeRegExp(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}partToRegExp(e){const r=[];for(const n of e.names)lr.validateLength(n,dc,"Variable name");if(e.operator==="?"||e.operator==="&"){for(let n=0;n<e.names.length;n++){const i=e.names[n],o=n===0?"\\"+e.operator:"&";r.push({pattern:o+this.escapeRegExp(i)+"=([^&]+)",name:i})}return r}let s;const a=e.name;switch(e.operator){case"":s=e.exploded?"([^/]+(?:,[^/]+)*)":"([^/,]+)";break;case"+":case"#":s="(.+)";break;case".":s="\\.([^/,]+)";break;case"/":s="/"+(e.exploded?"([^/]+(?:,[^/]+)*)":"([^/,]+)");break;default:s="([^/]+)"}return r.push({pattern:s,name:a}),r}match(e){lr.validateLength(e,zd,"URI");let r="^";const s=[];for(const o of this.parts)if(typeof o=="string")r+=this.escapeRegExp(o);else{const l=this.partToRegExp(o);for(const{pattern:c,name:u}of l)r+=c,s.push({name:u,exploded:o.exploded})}r+="$",lr.validateLength(r,zw,"Generated regex pattern");const a=new RegExp(r),n=e.match(a);if(!n)return null;const i={};for(let o=0;o<s.length;o++){const{name:l,exploded:c}=s[o],u=n[o+1],d=l.replace("*","");c&&u.includes(",")?i[d]=u.split(","):i[d]=u}return i}}class Zd{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 aw(e,r)}async connect(e){return await this.server.connect(e)}async close(){await this.server.close()}setToolRequestHandlers(){this._toolHandlersInitialized||(this.server.assertCanSetRequestHandler(ro.shape.method.value),this.server.assertCanSetRequestHandler(ao.shape.method.value),this.server.registerCapabilities({tools:{listChanged:!0}}),this.server.setRequestHandler(ro,()=>({tools:Object.entries(this._registeredTools).filter(([,e])=>e.enabled).map(([e,r])=>{const s={name:e,title:r.title,description:r.description,inputSchema:r.inputSchema?Vd(r.inputSchema,{strictUnions:!0}):Zw,annotations:r.annotations,_meta:r._meta};return r.outputSchema&&(s.outputSchema=Vd(r.outputSchema,{strictUnions:!0})),s})})),this.server.setRequestHandler(ao,async(e,r)=>{const s=this._registeredTools[e.params.name];if(!s)throw new Ae(Oe.InvalidParams,`Tool ${e.params.name} not found`);if(!s.enabled)throw new Ae(Oe.InvalidParams,`Tool ${e.params.name} disabled`);let a;if(s.inputSchema){const n=await s.inputSchema.safeParseAsync(e.params.arguments);if(!n.success)throw new Ae(Oe.InvalidParams,`Invalid arguments for tool ${e.params.name}: ${n.error.message}`);const i=n.data,o=s.callback;try{a=await Promise.resolve(o(i,r))}catch(l){a={content:[{type:"text",text:l instanceof Error?l.message:String(l)}],isError:!0}}}else{const n=s.callback;try{a=await Promise.resolve(n(r))}catch(i){a={content:[{type:"text",text:i instanceof Error?i.message:String(i)}],isError:!0}}}if(s.outputSchema&&!a.isError){if(!a.structuredContent)throw new Ae(Oe.InvalidParams,`Tool ${e.params.name} has an output schema but no structured content was provided`);const n=await s.outputSchema.safeParseAsync(a.structuredContent);if(!n.success)throw new Ae(Oe.InvalidParams,`Invalid structured content for tool ${e.params.name}: ${n.error.message}`)}return a}),this._toolHandlersInitialized=!0)}setCompletionRequestHandler(){this._completionHandlerInitialized||(this.server.assertCanSetRequestHandler(io.shape.method.value),this.server.registerCapabilities({completions:{}}),this.server.setRequestHandler(io,async e=>{switch(e.params.ref.type){case"ref/prompt":return this.handlePromptCompletion(e,e.params.ref);case"ref/resource":return this.handleResourceCompletion(e,e.params.ref);default:throw new Ae(Oe.InvalidParams,`Invalid completion reference: ${e.params.ref}`)}}),this._completionHandlerInitialized=!0)}async handlePromptCompletion(e,r){const s=this._registeredPrompts[r.name];if(!s)throw new Ae(Oe.InvalidParams,`Prompt ${r.name} not found`);if(!s.enabled)throw new Ae(Oe.InvalidParams,`Prompt ${r.name} disabled`);if(!s.argsSchema)return kn;const a=s.argsSchema.shape[e.params.argument.name];if(!(a instanceof xn))return kn;const i=await a._def.complete(e.params.argument.value,e.params.context);return Bd(i)}async handleResourceCompletion(e,r){const s=Object.values(this._registeredResourceTemplates).find(i=>i.resourceTemplate.uriTemplate.toString()===r.uri);if(!s){if(this._registeredResources[r.uri])return kn;throw new Ae(Oe.InvalidParams,`Resource template ${e.params.ref.uri} not found`)}const a=s.resourceTemplate.completeCallback(e.params.argument.name);if(!a)return kn;const n=await a(e.params.argument.value,e.params.context);return Bd(n)}setResourceRequestHandlers(){this._resourceHandlersInitialized||(this.server.assertCanSetRequestHandler(Hs.shape.method.value),this.server.assertCanSetRequestHandler(Ji.shape.method.value),this.server.assertCanSetRequestHandler(Qi.shape.method.value),this.server.registerCapabilities({resources:{listChanged:!0}}),this.server.setRequestHandler(Hs,async(e,r)=>{const s=Object.entries(this._registeredResources).filter(([n,i])=>i.enabled).map(([n,i])=>({uri:n,name:i.name,...i.metadata})),a=[];for(const n of Object.values(this._registeredResourceTemplates)){if(!n.resourceTemplate.listCallback)continue;const i=await n.resourceTemplate.listCallback(r);for(const o of i.resources)a.push({...n.metadata,...o})}return{resources:[...s,...a]}}),this.server.setRequestHandler(Ji,async()=>({resourceTemplates:Object.entries(this._registeredResourceTemplates).map(([r,s])=>({name:r,uriTemplate:s.resourceTemplate.uriTemplate.toString(),...s.metadata}))})),this.server.setRequestHandler(Qi,async(e,r)=>{const s=new URL(e.params.uri),a=this._registeredResources[s.toString()];if(a){if(!a.enabled)throw new Ae(Oe.InvalidParams,`Resource ${s} disabled`);return a.readCallback(s,r)}for(const n of Object.values(this._registeredResourceTemplates)){const i=n.resourceTemplate.uriTemplate.match(s.toString());if(i)return n.readCallback(s,i,r)}throw new Ae(Oe.InvalidParams,`Resource ${s} not found`)}),this.setCompletionRequestHandler(),this._resourceHandlersInitialized=!0)}setPromptRequestHandlers(){this._promptHandlersInitialized||(this.server.assertCanSetRequestHandler(Gi.shape.method.value),this.server.assertCanSetRequestHandler(Yi.shape.method.value),this.server.registerCapabilities({prompts:{listChanged:!0}}),this.server.setRequestHandler(Gi,()=>({prompts:Object.entries(this._registeredPrompts).filter(([,e])=>e.enabled).map(([e,r])=>({name:e,title:r.title,description:r.description,arguments:r.argsSchema?Bw(r.argsSchema):void 0}))})),this.server.setRequestHandler(Yi,async(e,r)=>{const s=this._registeredPrompts[e.params.name];if(!s)throw new Ae(Oe.InvalidParams,`Prompt ${e.params.name} not found`);if(!s.enabled)throw new Ae(Oe.InvalidParams,`Prompt ${e.params.name} disabled`);if(s.argsSchema){const a=await s.argsSchema.safeParseAsync(e.params.arguments);if(!a.success)throw new Ae(Oe.InvalidParams,`Invalid arguments for prompt ${e.params.name}: ${a.error.message}`);const n=a.data,i=s.callback;return await Promise.resolve(i(n,r))}else{const a=s.callback;return await Promise.resolve(a(r))}}),this.setCompletionRequestHandler(),this._promptHandlersInitialized=!0)}resource(e,r,...s){let a;typeof s[0]=="object"&&(a=s.shift());const n=s[0];if(typeof r=="string"){if(this._registeredResources[r])throw new Error(`Resource ${r} is already registered`);const i=this._createRegisteredResource(e,void 0,r,a,n);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),i}else{if(this._registeredResourceTemplates[e])throw new Error(`Resource template ${e} is already registered`);const i=this._createRegisteredResourceTemplate(e,void 0,r,a,n);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),i}}registerResource(e,r,s,a){if(typeof r=="string"){if(this._registeredResources[r])throw new Error(`Resource ${r} is already registered`);const n=this._createRegisteredResource(e,s.title,r,s,a);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),n}else{if(this._registeredResourceTemplates[e])throw new Error(`Resource template ${e} is already registered`);const n=this._createRegisteredResourceTemplate(e,s.title,r,s,a);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),n}}_createRegisteredResource(e,r,s,a,n){const i={name:e,title:r,metadata:a,readCallback:n,enabled:!0,disable:()=>i.update({enabled:!1}),enable:()=>i.update({enabled:!0}),remove:()=>i.update({uri:null}),update:o=>{typeof o.uri<"u"&&o.uri!==s&&(delete this._registeredResources[s],o.uri&&(this._registeredResources[o.uri]=i)),typeof o.name<"u"&&(i.name=o.name),typeof o.title<"u"&&(i.title=o.title),typeof o.metadata<"u"&&(i.metadata=o.metadata),typeof o.callback<"u"&&(i.readCallback=o.callback),typeof o.enabled<"u"&&(i.enabled=o.enabled),this.sendResourceListChanged()}};return this._registeredResources[s]=i,i}_createRegisteredResourceTemplate(e,r,s,a,n){const i={resourceTemplate:s,title:r,metadata:a,readCallback:n,enabled:!0,disable:()=>i.update({enabled:!1}),enable:()=>i.update({enabled:!0}),remove:()=>i.update({name:null}),update:o=>{typeof o.name<"u"&&o.name!==e&&(delete this._registeredResourceTemplates[e],o.name&&(this._registeredResourceTemplates[o.name]=i)),typeof o.title<"u"&&(i.title=o.title),typeof o.template<"u"&&(i.resourceTemplate=o.template),typeof o.metadata<"u"&&(i.metadata=o.metadata),typeof o.callback<"u"&&(i.readCallback=o.callback),typeof o.enabled<"u"&&(i.enabled=o.enabled),this.sendResourceListChanged()}};return this._registeredResourceTemplates[e]=i,i}_createRegisteredPrompt(e,r,s,a,n){const i={title:r,description:s,argsSchema:a===void 0?void 0:Z(a),callback:n,enabled:!0,disable:()=>i.update({enabled:!1}),enable:()=>i.update({enabled:!0}),remove:()=>i.update({name:null}),update:o=>{typeof o.name<"u"&&o.name!==e&&(delete this._registeredPrompts[e],o.name&&(this._registeredPrompts[o.name]=i)),typeof o.title<"u"&&(i.title=o.title),typeof o.description<"u"&&(i.description=o.description),typeof o.argsSchema<"u"&&(i.argsSchema=Z(o.argsSchema)),typeof o.callback<"u"&&(i.callback=o.callback),typeof o.enabled<"u"&&(i.enabled=o.enabled),this.sendPromptListChanged()}};return this._registeredPrompts[e]=i,i}_createRegisteredTool(e,r,s,a,n,i,o,l){const c={title:r,description:s,inputSchema:a===void 0?void 0:Z(a),outputSchema:n===void 0?void 0:Z(n),annotations:i,_meta:o,callback:l,enabled:!0,disable:()=>c.update({enabled:!1}),enable:()=>c.update({enabled:!0}),remove:()=>c.update({name:null}),update:u=>{typeof u.name<"u"&&u.name!==e&&(delete this._registeredTools[e],u.name&&(this._registeredTools[u.name]=c)),typeof u.title<"u"&&(c.title=u.title),typeof u.description<"u"&&(c.description=u.description),typeof u.paramsSchema<"u"&&(c.inputSchema=Z(u.paramsSchema)),typeof u.callback<"u"&&(c.callback=u.callback),typeof u.annotations<"u"&&(c.annotations=u.annotations),typeof u._meta<"u"&&(c._meta=u._meta),typeof u.enabled<"u"&&(c.enabled=u.enabled),this.sendToolListChanged()}};return this._registeredTools[e]=c,this.setToolRequestHandlers(),this.sendToolListChanged(),c}tool(e,...r){if(this._registeredTools[e])throw new Error(`Tool ${e} is already registered`);let s,a,n,i;if(typeof r[0]=="string"&&(s=r.shift()),r.length>1){const l=r[0];Kd(l)?(a=r.shift(),r.length>1&&typeof r[0]=="object"&&r[0]!==null&&!Kd(r[0])&&(i=r.shift())):typeof l=="object"&&l!==null&&(i=r.shift())}const o=r[0];return this._createRegisteredTool(e,void 0,s,a,n,i,void 0,o)}registerTool(e,r,s){if(this._registeredTools[e])throw new Error(`Tool ${e} is already registered`);const{title:a,description:n,inputSchema:i,outputSchema:o,annotations:l,_meta:c}=r;return this._createRegisteredTool(e,a,n,i,o,l,c,s)}prompt(e,...r){if(this._registeredPrompts[e])throw new Error(`Prompt ${e} is already registered`);let s;typeof r[0]=="string"&&(s=r.shift());let a;r.length>1&&(a=r.shift());const n=r[0],i=this._createRegisteredPrompt(e,void 0,s,a,n);return this.setPromptRequestHandlers(),this.sendPromptListChanged(),i}registerPrompt(e,r,s){if(this._registeredPrompts[e])throw new Error(`Prompt ${e} is already registered`);const{title:a,description:n,argsSchema:i}=r,o=this._createRegisteredPrompt(e,a,n,i,s);return this.setPromptRequestHandlers(),this.sendPromptListChanged(),o}isConnected(){return this.server.transport!==void 0}async sendLoggingMessage(e,r){return this.server.sendLoggingMessage(e,r)}sendResourceListChanged(){this.isConnected()&&this.server.sendResourceListChanged()}sendToolListChanged(){this.isConnected()&&this.server.sendToolListChanged()}sendPromptListChanged(){this.isConnected()&&this.server.sendPromptListChanged()}}class Hw{constructor(e,r){this._callbacks=r,this._uriTemplate=typeof e=="string"?new lr(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 Zw={type:"object",properties:{}};function Kd(t){return typeof t!="object"||t===null?!1:Object.keys(t).length===0||Object.values(t).some(Kw)}function Kw(t){return t!==null&&typeof t=="object"&&"parse"in t&&typeof t.parse=="function"&&"safeParse"in t&&typeof t.safeParse=="function"}function Bw(t){return Object.entries(t.shape).map(([e,r])=>({name:e,description:r.description,required:!r.isOptional()}))}function Bd(t){return{completion:{values:t.slice(0,100),total:t.length,hasMore:t.length>100}}}const kn={completion:{values:[],hasMore:!1}};class Ww{constructor(e,r){const s={name:"web-mcp-server",version:"1.0.0"},a={prompts:{listChanged:!0},resources:{subscribe:!0,listChanged:!0},tools:{listChanged:!0},completions:{},logging:{}};this.server=new Zd(e||s,r||{capabilities:a}),this.server.server.oninitialized=()=>{var n;(n=this.oninitialized)==null||n.call(this)},this.server.server.onclose=()=>{var n;(n=this.onclose)==null||n.call(this)},this.server.server.onerror=n=>{var i;(i=this.onerror)==null||i.call(this,n)},this.server.server.setRequestHandler(Bs,async()=>({}))}async connect(e){return typeof e.start=="function"?(this.transport=e,this.transport.onclose=void 0,this.transport.onerror=void 0,this.transport.onmessage=void 0):(this.transport=new sc(e),await this.transport.listen()),await this.server.connect(this.transport),this.transport}async close(){await this.server.close()}registerTool(e,r,s){return this.server.registerTool(e,r,s)}registerPrompt(e,r,s){return this.server.registerPrompt(e,r,s)}registerResource(e,r,s,a){return typeof r=="string"?this.server.registerResource(e,r,s,a):this.server.registerResource(e,r,s,a)}isConnected(){return this.server.isConnected()}sendResourceListChanged(){this.server.sendResourceListChanged()}sendToolListChanged(){this.server.sendToolListChanged()}sendPromptListChanged(){this.server.sendPromptListChanged()}getClientCapabilities(){return this.server.server.getClientCapabilities()}getClientVersion(){return this.server.server.getClientVersion()}async ping(){return await this.server.server.ping()}async createMessage(e,r){return await this.server.server.createMessage(e,r)}async elicitInput(e,r){return await this.server.server.elicitInput(e,r)}async listRoots(e,r){return await this.server.server.listRoots(e,r)}async sendLoggingMessage(e){return await this.server.server.sendLoggingMessage(e)}async sendResourceUpdated(e){return await this.server.server.sendResourceUpdated(e)}request(e,r,s){return this.server.server.request(e,r,s)}async notification(e,r){return await this.server.server.notification(e,r)}setRequestHandler(e,r){this.server.server.setRequestHandler(e,r)}removeRequestHandler(e){this.server.server.removeRequestHandler(e)}setNotificationHandler(e,r){this.server.server.setNotificationHandler(e,r)}removeNotificationHandler(e){this.server.server.removeNotificationHandler(e)}onSubscribe(e){this.server.server.setRequestHandler(du,e)}onUnsubscribe(e){this.server.server.setRequestHandler(fu,e)}onSetLogLevel(e){this.server.server.setRequestHandler(Bs,e)}onListResources(e){this.server.server.setRequestHandler(Hs,e)}onRootsListChanged(e){this.server.server.setNotificationHandler(Su,e)}async onPagehide(e){e.persisted||this.transport&&typeof this.transport.close=="function"&&await this.transport.close()}}const Jw=(t,e)=>new sc(t,e),Qw=()=>M0(),Gw=t=>t instanceof sc,Yw=t=>t instanceof Zd;class Xw{constructor(e,r){const s={name:"web-mcp-client",version:"1.0.0"},a={roots:{listChanged:!0},sampling:{},elicitation:{}};this.client=new es(e||s,r||{capabilities:a}),this.client.onclose=()=>{var n;(n=this.onclose)==null||n.call(this)},this.client.onerror=n=>{var i;(i=this.onerror)==null||i.call(this,n)}}async connect(e){if(typeof e.start=="function")return this.transport=e,this.transport.onclose=void 0,this.transport.onerror=void 0,this.transport.onmessage=void 0,await this.client.connect(this.transport),{transport:this.transport,sessionId:this.transport.sessionId};const{url:r,token:s,sessionId:a,type:n,agent:i,onError:o}=e;if(i===!0){const u={client:this.client,url:r,token:s,sessionId:a};let d;return await(async()=>{const{transport:f,sessionId:m}=n==="sse"?await Y0(u):n==="socket"?await ew(u):await X0(u);f.onerror=async p=>{o==null||o(p)},d={transport:f,sessionId:m}})(),d}const l=new URL(r);let c;if(n==="channel"&&(c=new ac(r),await this.client.connect(c)),n==="sse"){const u=Td(s,a);c=new ns(l,u),await this.client.connect(c)}if(n==="socket"&&(c=new kd(new URL(`${r}?sessionId=${a}&token=${s}`)),c.sessionId=a,await this.client.connect(c)),typeof c>"u"){const u=Od(s,a);c=new vn(l,u),await this.client.connect(c)}return this.transport=c,{transport:this.transport,sessionId:this.transport.sessionId}}async close(){await this.client.close()}getServerCapabilities(){return this.client.getServerCapabilities()}getServerVersion(){return this.client.getServerVersion()}getInstructions(){return this.client.getInstructions()}async ping(e){return await this.client.ping(e)}async complete(e,r){return await this.client.complete(e,r)}async setLoggingLevel(e,r){return await this.client.setLoggingLevel(e,r)}async getPrompt(e,r){return await this.client.getPrompt(e,r)}async listPrompts(e,r){return await this.client.listPrompts(e,r)}async listResources(e,r){return await this.client.listResources(e,r)}async listResourceTemplates(e,r){return await this.client.listResourceTemplates(e,r)}async readResource(e,r){return await this.client.readResource(e,r)}async subscribeResource(e,r){return await this.client.subscribeResource(e,r)}async unsubscribeResource(e,r){return await this.client.unsubscribeResource(e,r)}async callTool(e,r){return await this.client.callTool(e,Zs,r)}async listTools(e,r){return await this.client.listTools(e,r)}async sendRootsListChanged(){return await this.client.sendRootsListChanged()}request(e,r,s){return this.client.request(e,r,s)}async notification(e,r){return await this.client.notification(e,r)}setRequestHandler(e,r){this.client.setRequestHandler(e,r)}removeRequestHandler(e){this.client.removeRequestHandler(e)}setNotificationHandler(e,r){this.client.setNotificationHandler(e,r)}removeNotificationHandler(e){this.client.removeNotificationHandler(e)}onElicit(e){this.client.setRequestHandler($u,e)}onCreateMessage(e){this.client.setRequestHandler(bu,e)}onListRoots(e){this.client.setRequestHandler(Eu,e)}onToolListChanged(e){this.client.setNotificationHandler(yu,e)}onPromptListChanged(e){this.client.setNotificationHandler(gu,e)}onResourceListChanged(e){this.client.setNotificationHandler(uu,e)}onResourceUpdated(e){this.client.setNotificationHandler(hu,e)}onLoggingMessage(e){this.client.setNotificationHandler(wu,e)}async onPagehide(e){e.persisted||(Wd(this.transport)?await this.transport.terminateSession():this.transport&&typeof this.transport.close=="function"&&await this.transport.close())}}const eb=(t,e)=>new ns(t,e),tb=(t,e)=>new vn(t,e),rb=(t,e)=>new ac(t,e),ab=t=>t instanceof ns,Wd=t=>t instanceof vn,sb=t=>t instanceof ac,nb=t=>t instanceof es;function ib(t){var e;if(t.title!==void 0&&t.title!=="")return t.title;if("annotations"in t){const r=t;if(!((e=r.annotations)===null||e===void 0)&&e.title)return r.annotations.title}return t.name}const ob=()=>typeof crypto<"u"&&crypto.randomUUID?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,t=>{const e=Math.random()*16|0;return(t==="x"?e:e&3|8).toString(16)}),In=(t,e,r)=>{window.postMessage({type:t,direction:r,data:e},"*")},Jd=(t,e,r)=>{const s=async function(a){a.source===window&&a.data.type===t&&a.data.direction===r&&await e(a.data.data)};return window.addEventListener("message",s),()=>window.removeEventListener("message",s)};class cb{constructor(e=null,r){this._isStarted=!1,this._isClosed=!1,this._lastRegistration=null,this.sessionId=e||ob(),this.tabId=r,this._messageListener1=Jd("sidepanel-ready-to-page",()=>{this._lastRegistration&&this._isStarted&&this.notifyRegistration(this._lastRegistration).catch(s=>{console.error("【Page Svr Transport】 notifyRegistration失败:",s)})},"content->page"),this._messageListener2=Jd("mcp-client-to-server-to-page",s=>{var i,o,l;if(s.sessionId!==this.sessionId||s.tabId!==this.tabId)return;console.log("【Page Svr Transport】 即将处理 mcpMessage",s.mcpMessage);const a=Fr.parse(s.mcpMessage);(i=this.onmessage)==null||i.call(this,a),((o=s.mcpMessage.params)==null?void 0:o.name)&&In("update-page-app-message",{status:"run",message:(l=s.mcpMessage.params)==null?void 0:l.name},"page->content")},"content->page")}_throwError(e,r){if(e()){const s=new Error(r);throw console.log(r,s),this.onerror&&this.onerror(s),s}}async start(){if(!this._isStarted){if(this._isClosed)throw new Error("【Page Svr Transport】 已关闭,无法重新启动");this._isStarted=!0}}async send(e,r){var s;this._throwError(()=>!this._isStarted,"【Page Svr Transport】 未启动,无法发送消息"),this._throwError(()=>this._isClosed,"【Page Svr Transport】 已关闭,无法发送消息"),In("mcp-server-to-client-from-page",{sessionId:this.sessionId,mcpMessage:e},"page->content"),"result"in e&&((s=e.result)!=null&&s.content)&&In("update-page-app-message",{status:"ready",message:""},"page->content")}async notifyRegistration(e){this._throwError(()=>!this._isStarted,"【Page Svr Transport】 未启动,无法注册消息"),this._lastRegistration=e;try{In("mcp-server-register-from-page",{sessionId:this.sessionId,serverInfo:{...e,url:window.location.origin,title:document.title}},"page->content")}catch(r){this._throwError(()=>!0,"【Page Svr Transport】 注册 server 失败"+String(r))}}async close(){if(!this._isClosed)try{this._messageListener1&&this._messageListener1(),this._messageListener2&&this._messageListener2(),this._isClosed=!0,this._isStarted=!1,this.onclose&&this.onclose()}catch(e){this._throwError(()=>!0,"【Page Svr Transport】 关闭时发生错误"+String(e))}}}Te.Ajv=gv,Te.AuthClientProvider=rw,Te.ExtensionPageServerTransport=cb,Te.ResourceTemplate=Hw,Te.UriTemplate=lr,Te.WebMcpClient=Xw,Te.WebMcpServer=Ww,Te.completable=Uw,Te.createMessageChannelClientTransport=rb,Te.createMessageChannelPairTransport=Qw,Te.createMessageChannelServerTransport=Jw,Te.createSSEClientTransport=eb,Te.createStreamableHTTPClientTransport=tb,Te.getDisplayName=ib,Te.isMcpClient=nb,Te.isMcpServer=Yw,Te.isMessageChannelClientTransport=sb,Te.isMessageChannelServerTransport=Gw,Te.isSSEClientTransport=ab,Te.isStreamableHTTPClientTransport=Wd,Te.z=mg,Object.defineProperty(Te,Symbol.toStringTag,{value:"Module"})});
1
+ (function(me,_r){typeof exports=="object"&&typeof module<"u"?_r(exports):typeof define=="function"&&define.amd?define(["exports"],_r):(me=typeof globalThis<"u"?globalThis:me||self,_r(me.WebMCP={}))})(this,function(me){"use strict";function _r(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var no={exports:{}},Ja={},ot={},gr={},qr={},Q={},Vr={};(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((w,S)=>`${w}${S}`,"")}get names(){var m;return(m=this._names)!==null&&m!==void 0?m:this._names=this._items.reduce((w,S)=>(S instanceof r&&(w[S.str]=(w[S.str]||0)+1),w),{})}}t._Code=n,t.nil=new n("");function s(d,...m){const w=[d[0]];let S=0;for(;S<m.length;)a(w,m[S]),w.push(d[++S]);return new n(w)}t._=s;const o=new n("+");function i(d,...m){const w=[y(d[0])];let S=0;for(;S<m.length;)w.push(o),a(w,m[S]),w.push(o,y(d[++S]));return c(w),new n(w)}t.str=i;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]===o){const w=u(d[m-1],d[m+1]);if(w!==void 0){d.splice(m-1,3,w);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:i`${d}${m}`}t.strConcat=l;function f(d){return typeof d=="number"||typeof d=="boolean"||d===null?d:y(Array.isArray(d)?d.join(","):d)}function _(d){return new n(y(d))}t.stringify=_;function y(d){return JSON.stringify(d).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}t.safeStringify=y;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 h(d){return new n(d.toString())}t.regexpCode=h})(Vr);var so={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.ValueScope=t.ValueScopeName=t.Scope=t.varKinds=t.UsedValueState=void 0;const e=Vr;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 o 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=o;const i=(0,e._)`\n`;class a extends s{constructor(u){super(u),this._values={},this._scope=u.scope,this.opts={...u,_n:u.lines?i:e.nil}}get(){return this._scope}name(u){return new o(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 _=this.toName(u),{prefix:y}=_,g=(f=l.key)!==null&&f!==void 0?f:l.ref;let v=this._values[y];if(v){const m=v.get(g);if(m)return m}else v=this._values[y]=new Map;v.set(g,_);const h=this._scope[y]||(this._scope[y]=[]),d=h.length;return h[d]=l.ref,_.setValue(l,{property:y,itemIndex:d}),_}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,_=>{if(_.value===void 0)throw new Error(`CodeGen: name "${_}" has no value`);return _.value.code},l,f)}_reduceValues(u,l,f={},_){let y=e.nil;for(const g in u){const v=u[g];if(!v)continue;const h=f[g]=f[g]||new Map;v.forEach(d=>{if(h.has(d))return;h.set(d,n.Started);let m=l(d);if(m){const w=this.opts.es5?t.varKinds.var:t.varKinds.const;y=(0,e._)`${y}${w} ${d} = ${m};${this.opts._n}`}else if(m=_==null?void 0:_(d))y=(0,e._)`${y}${m}${this.opts._n}`;else throw new r(d);h.set(d,n.Completed)})}return y}}t.ValueScope=a})(so),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=Vr,r=so;var n=Vr;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=so;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 o{optimizeNodes(){return this}optimizeNames(p,b){return this}}class i extends o{constructor(p,b,x){super(),this.varKind=p,this.name=b,this.rhs=x}render({es5:p,_n:b}){const x=p?r.varKinds.var:this.varKind,F=this.rhs===void 0?"":` = ${this.rhs}`;return`${x} ${this.name}${F};`+b}optimizeNames(p,b){if(p[this.name.str])return this.rhs&&(this.rhs=se(this.rhs,p,b)),this}get names(){return this.rhs instanceof e._CodeOrName?this.rhs.names:{}}}class a extends o{constructor(p,b,x){super(),this.lhs=p,this.rhs=b,this.sideEffects=x}render({_n:p}){return`${this.lhs} = ${this.rhs};`+p}optimizeNames(p,b){if(!(this.lhs instanceof e.Name&&!p[this.lhs.str]&&!this.sideEffects))return this.rhs=se(this.rhs,p,b),this}get names(){const p=this.lhs instanceof e.Name?{}:{...this.lhs.names};return Se(p,this.rhs)}}class c extends a{constructor(p,b,x,F){super(p,x,F),this.op=b}render({_n:p}){return`${this.lhs} ${this.op}= ${this.rhs};`+p}}class u extends o{constructor(p){super(),this.label=p,this.names={}}render({_n:p}){return`${this.label}:`+p}}class l extends o{constructor(p){super(),this.label=p,this.names={}}render({_n:p}){return`break${this.label?` ${this.label}`:""};`+p}}class f extends o{constructor(p){super(),this.error=p}render({_n:p}){return`throw ${this.error};`+p}get names(){return this.error.names}}class _ extends o{constructor(p){super(),this.code=p}render({_n:p}){return`${this.code};`+p}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(p,b){return this.code=se(this.code,p,b),this}get names(){return this.code instanceof e._CodeOrName?this.code.names:{}}}class y extends o{constructor(p=[]){super(),this.nodes=p}render(p){return this.nodes.reduce((b,x)=>b+x.render(p),"")}optimizeNodes(){const{nodes:p}=this;let b=p.length;for(;b--;){const x=p[b].optimizeNodes();Array.isArray(x)?p.splice(b,1,...x):x?p[b]=x:p.splice(b,1)}return p.length>0?this:void 0}optimizeNames(p,b){const{nodes:x}=this;let F=x.length;for(;F--;){const H=x[F];H.optimizeNames(p,b)||(De(p,H.names),x.splice(F,1))}return x.length>0?this:void 0}get names(){return this.nodes.reduce((p,b)=>K(p,b.names),{})}}class g extends y{render(p){return"{"+p._n+super.render(p)+"}"+p._n}}class v extends y{}class h extends g{}h.kind="else";class d extends g{constructor(p,b){super(b),this.condition=p}render(p){let b=`if(${this.condition})`+super.render(p);return this.else&&(b+="else "+this.else.render(p)),b}optimizeNodes(){super.optimizeNodes();const p=this.condition;if(p===!0)return this.nodes;let b=this.else;if(b){const x=b.optimizeNodes();b=this.else=Array.isArray(x)?new h(x):x}if(b)return p===!1?b instanceof d?b:b.nodes:this.nodes.length?this:new d(Zt(p),b instanceof d?[b]:b.nodes);if(!(p===!1||!this.nodes.length))return this}optimizeNames(p,b){var x;if(this.else=(x=this.else)===null||x===void 0?void 0:x.optimizeNames(p,b),!!(super.optimizeNames(p,b)||this.else))return this.condition=se(this.condition,p,b),this}get names(){const p=super.names;return Se(p,this.condition),this.else&&K(p,this.else.names),p}}d.kind="if";class m extends g{}m.kind="for";class w extends m{constructor(p){super(),this.iteration=p}render(p){return`for(${this.iteration})`+super.render(p)}optimizeNames(p,b){if(super.optimizeNames(p,b))return this.iteration=se(this.iteration,p,b),this}get names(){return K(super.names,this.iteration.names)}}class S extends m{constructor(p,b,x,F){super(),this.varKind=p,this.name=b,this.from=x,this.to=F}render(p){const b=p.es5?r.varKinds.var:this.varKind,{name:x,from:F,to:H}=this;return`for(${b} ${x}=${F}; ${x}<${H}; ${x}++)`+super.render(p)}get names(){const p=Se(super.names,this.from);return Se(p,this.to)}}class P extends m{constructor(p,b,x,F){super(),this.loop=p,this.varKind=b,this.name=x,this.iterable=F}render(p){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(p)}optimizeNames(p,b){if(super.optimizeNames(p,b))return this.iterable=se(this.iterable,p,b),this}get names(){return K(super.names,this.iterable.names)}}class O extends g{constructor(p,b,x){super(),this.name=p,this.args=b,this.async=x}render(p){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(p)}}O.kind="func";class V extends y{render(p){return"return "+super.render(p)}}V.kind="return";class ce extends g{render(p){let b="try"+super.render(p);return this.catch&&(b+=this.catch.render(p)),this.finally&&(b+=this.finally.render(p)),b}optimizeNodes(){var p,b;return super.optimizeNodes(),(p=this.catch)===null||p===void 0||p.optimizeNodes(),(b=this.finally)===null||b===void 0||b.optimizeNodes(),this}optimizeNames(p,b){var x,F;return super.optimizeNames(p,b),(x=this.catch)===null||x===void 0||x.optimizeNames(p,b),(F=this.finally)===null||F===void 0||F.optimizeNames(p,b),this}get names(){const p=super.names;return this.catch&&K(p,this.catch.names),this.finally&&K(p,this.finally.names),p}}class G extends g{constructor(p){super(),this.error=p}render(p){return`catch(${this.error})`+super.render(p)}}G.kind="catch";class Ae extends g{render(p){return"finally"+super.render(p)}}Ae.kind="finally";class U{constructor(p,b={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...b,_n:b.lines?`
2
+ `:""},this._extScope=p,this._scope=new r.Scope({parent:p}),this._nodes=[new v]}toString(){return this._root.render(this.opts)}name(p){return this._scope.name(p)}scopeName(p){return this._extScope.name(p)}scopeValue(p,b){const x=this._extScope.value(p,b);return(this._values[x.prefix]||(this._values[x.prefix]=new Set)).add(x),x}getScopeValue(p,b){return this._extScope.getValue(p,b)}scopeRefs(p){return this._extScope.scopeRefs(p,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(p,b,x,F){const H=this._scope.toName(b);return x!==void 0&&F&&(this._constants[H.str]=x),this._leafNode(new i(p,H,x)),H}const(p,b,x){return this._def(r.varKinds.const,p,b,x)}let(p,b,x){return this._def(r.varKinds.let,p,b,x)}var(p,b,x){return this._def(r.varKinds.var,p,b,x)}assign(p,b,x){return this._leafNode(new a(p,b,x))}add(p,b){return this._leafNode(new c(p,t.operators.ADD,b))}code(p){return typeof p=="function"?p():p!==e.nil&&this._leafNode(new _(p)),this}object(...p){const b=["{"];for(const[x,F]of p)b.length>1&&b.push(","),b.push(x),(x!==F||this.opts.es5)&&(b.push(":"),(0,e.addCodeArg)(b,F));return b.push("}"),new e._Code(b)}if(p,b,x){if(this._blockNode(new d(p)),b&&x)this.code(b).else().code(x).endIf();else if(b)this.code(b).endIf();else if(x)throw new Error('CodeGen: "else" body without "then" body');return this}elseIf(p){return this._elseNode(new d(p))}else(){return this._elseNode(new h)}endIf(){return this._endBlockNode(d,h)}_for(p,b){return this._blockNode(p),b&&this.code(b).endFor(),this}for(p,b){return this._for(new w(p),b)}forRange(p,b,x,F,H=this.opts.es5?r.varKinds.var:r.varKinds.let){const fe=this._scope.toName(p);return this._for(new S(H,fe,b,x),()=>F(fe))}forOf(p,b,x,F=r.varKinds.const){const H=this._scope.toName(p);if(this.opts.es5){const fe=b instanceof e.Name?b:this.var("_arr",b);return this.forRange("_i",0,(0,e._)`${fe}.length`,le=>{this.var(H,(0,e._)`${fe}[${le}]`),x(H)})}return this._for(new P("of",F,H,b),()=>x(H))}forIn(p,b,x,F=this.opts.es5?r.varKinds.var:r.varKinds.const){if(this.opts.ownProperties)return this.forOf(p,(0,e._)`Object.keys(${b})`,x);const H=this._scope.toName(p);return this._for(new P("in",F,H,b),()=>x(H))}endFor(){return this._endBlockNode(m)}label(p){return this._leafNode(new u(p))}break(p){return this._leafNode(new l(p))}return(p){const b=new V;if(this._blockNode(b),this.code(p),b.nodes.length!==1)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(V)}try(p,b,x){if(!b&&!x)throw new Error('CodeGen: "try" without "catch" and "finally"');const F=new ce;if(this._blockNode(F),this.code(p),b){const H=this.name("e");this._currNode=F.catch=new G(H),b(H)}return x&&(this._currNode=F.finally=new Ae,this.code(x)),this._endBlockNode(G,Ae)}throw(p){return this._leafNode(new f(p))}block(p,b){return this._blockStarts.push(this._nodes.length),p&&this.code(p).endBlock(b),this}endBlock(p){const b=this._blockStarts.pop();if(b===void 0)throw new Error("CodeGen: not in self-balancing block");const x=this._nodes.length-b;if(x<0||p!==void 0&&x!==p)throw new Error(`CodeGen: wrong number of nodes: ${x} vs ${p} expected`);return this._nodes.length=b,this}func(p,b=e.nil,x,F){return this._blockNode(new O(p,b,x)),F&&this.code(F).endFunc(),this}endFunc(){return this._endBlockNode(O)}optimize(p=1){for(;p-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(p){return this._currNode.nodes.push(p),this}_blockNode(p){this._currNode.nodes.push(p),this._nodes.push(p)}_endBlockNode(p,b){const x=this._currNode;if(x instanceof p||b&&x instanceof b)return this._nodes.pop(),this;throw new Error(`CodeGen: not in block "${b?`${p.kind}/${b.kind}`:p.kind}"`)}_elseNode(p){const b=this._currNode;if(!(b instanceof d))throw new Error('CodeGen: "else" without "if"');return this._currNode=b.else=p,this}get _root(){return this._nodes[0]}get _currNode(){const p=this._nodes;return p[p.length-1]}set _currNode(p){const b=this._nodes;b[b.length-1]=p}}t.CodeGen=U;function K(E,p){for(const b in p)E[b]=(E[b]||0)+(p[b]||0);return E}function Se(E,p){return p instanceof e._CodeOrName?K(E,p.names):E}function se(E,p,b){if(E instanceof e.Name)return x(E);if(!F(E))return E;return new e._Code(E._items.reduce((H,fe)=>(fe instanceof e.Name&&(fe=x(fe)),fe instanceof e._Code?H.push(...fe._items):H.push(fe),H),[]));function x(H){const fe=b[H.str];return fe===void 0||p[H.str]!==1?H:(delete p[H.str],fe)}function F(H){return H instanceof e._Code&&H._items.some(fe=>fe instanceof e.Name&&p[fe.str]===1&&b[fe.str]!==void 0)}}function De(E,p){for(const b in p)E[b]=(E[b]||0)-(p[b]||0)}function Zt(E){return typeof E=="boolean"||typeof E=="number"||E===null?!E:(0,e._)`!${R(E)}`}t.not=Zt;const Lt=k(t.operators.AND);function Ln(...E){return E.reduce(Lt)}t.and=Ln;const mr=k(t.operators.OR);function N(...E){return E.reduce(mr)}t.or=N;function k(E){return(p,b)=>p===e.nil?b:b===e.nil?p:(0,e._)`${R(p)} ${E} ${R(b)}`}function R(E){return E instanceof e.Name?E:(0,e._)`(${E})`}}(Q);var M={};Object.defineProperty(M,"__esModule",{value:!0}),M.checkStrictMode=M.getErrorPath=M.Type=M.useFunc=M.setEvaluated=M.evaluatedPropsToName=M.mergeEvaluated=M.eachItem=M.unescapeJsonPointer=M.escapeJsonPointer=M.escapeFragment=M.unescapeFragment=M.schemaRefOrVal=M.schemaHasRulesButRef=M.schemaHasRules=M.checkUnknownRules=M.alwaysValidSchema=M.toHash=void 0;const he=Q,ef=Vr;function tf(t){const e={};for(const r of t)e[r]=!0;return e}M.toHash=tf;function rf(t,e){return typeof e=="boolean"?e:Object.keys(e).length===0?!0:(Ba(t,e),!Ka(e,t.self.RULES.all))}M.alwaysValidSchema=rf;function Ba(t,e=t.schema){const{opts:r,self:n}=t;if(!r.strictSchema||typeof e=="boolean")return;const s=n.RULES.keywords;for(const o in e)s[o]||ec(t,`unknown keyword: "${o}"`)}M.checkUnknownRules=Ba;function Ka(t,e){if(typeof t=="boolean")return!t;for(const r in t)if(e[r])return!0;return!1}M.schemaHasRules=Ka;function nf(t,e){if(typeof t=="boolean")return!t;for(const r in t)if(r!=="$ref"&&e.all[r])return!0;return!1}M.schemaHasRulesButRef=nf;function sf({topSchemaRef:t,schemaPath:e},r,n,s){if(!s){if(typeof r=="number"||typeof r=="boolean")return r;if(typeof r=="string")return(0,he._)`${r}`}return(0,he._)`${t}${e}${(0,he.getProperty)(n)}`}M.schemaRefOrVal=sf;function of(t){return Ga(decodeURIComponent(t))}M.unescapeFragment=of;function af(t){return encodeURIComponent(oo(t))}M.escapeFragment=af;function oo(t){return typeof t=="number"?`${t}`:t.replace(/~/g,"~0").replace(/\//g,"~1")}M.escapeJsonPointer=oo;function Ga(t){return t.replace(/~1/g,"/").replace(/~0/g,"~")}M.unescapeJsonPointer=Ga;function cf(t,e){if(Array.isArray(t))for(const r of t)e(r);else e(t)}M.eachItem=cf;function Ya({mergeNames:t,mergeToName:e,mergeValues:r,resultToName:n}){return(s,o,i,a)=>{const c=i===void 0?o:i instanceof he.Name?(o instanceof he.Name?t(s,o,i):e(s,o,i),i):o instanceof he.Name?(e(s,i,o),o):r(o,i);return a===he.Name&&!(c instanceof he.Name)?n(s,c):c}}M.mergeEvaluated={props:Ya({mergeNames:(t,e,r)=>t.if((0,he._)`${r} !== true && ${e} !== undefined`,()=>{t.if((0,he._)`${e} === true`,()=>t.assign(r,!0),()=>t.assign(r,(0,he._)`${r} || {}`).code((0,he._)`Object.assign(${r}, ${e})`))}),mergeToName:(t,e,r)=>t.if((0,he._)`${r} !== true`,()=>{e===!0?t.assign(r,!0):(t.assign(r,(0,he._)`${r} || {}`),io(t,r,e))}),mergeValues:(t,e)=>t===!0?!0:{...t,...e},resultToName:Xa}),items:Ya({mergeNames:(t,e,r)=>t.if((0,he._)`${r} !== true && ${e} !== undefined`,()=>t.assign(r,(0,he._)`${e} === true ? true : ${r} > ${e} ? ${r} : ${e}`)),mergeToName:(t,e,r)=>t.if((0,he._)`${r} !== true`,()=>t.assign(r,e===!0?!0:(0,he._)`${r} > ${e} ? ${r} : ${e}`)),mergeValues:(t,e)=>t===!0?!0:Math.max(t,e),resultToName:(t,e)=>t.var("items",e)})};function Xa(t,e){if(e===!0)return t.var("props",!0);const r=t.var("props",(0,he._)`{}`);return e!==void 0&&io(t,r,e),r}M.evaluatedPropsToName=Xa;function io(t,e,r){Object.keys(r).forEach(n=>t.assign((0,he._)`${e}${(0,he.getProperty)(n)}`,!0))}M.setEvaluated=io;const Qa={};function uf(t,e){return t.scopeValue("func",{ref:e,code:Qa[e.code]||(Qa[e.code]=new ef._Code(e.code))})}M.useFunc=uf;var ao;(function(t){t[t.Num=0]="Num",t[t.Str=1]="Str"})(ao||(M.Type=ao={}));function lf(t,e,r){if(t instanceof he.Name){const n=e===ao.Num;return r?n?(0,he._)`"[" + ${t} + "]"`:(0,he._)`"['" + ${t} + "']"`:n?(0,he._)`"/" + ${t}`:(0,he._)`"/" + ${t}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return r?(0,he.getProperty)(t).toString():"/"+oo(t)}M.getErrorPath=lf;function ec(t,e,r=t.opts.strictSchema){if(r){if(e=`strict mode: ${e}`,r===!0)throw new Error(e);t.self.logger.warn(e)}}M.checkStrictMode=ec;var bt={};Object.defineProperty(bt,"__esModule",{value:!0});const qe=Q,df={data:new qe.Name("data"),valCxt:new qe.Name("valCxt"),instancePath:new qe.Name("instancePath"),parentData:new qe.Name("parentData"),parentDataProperty:new qe.Name("parentDataProperty"),rootData:new qe.Name("rootData"),dynamicAnchors:new qe.Name("dynamicAnchors"),vErrors:new qe.Name("vErrors"),errors:new qe.Name("errors"),this:new qe.Name("this"),self:new qe.Name("self"),scope:new qe.Name("scope"),json:new qe.Name("json"),jsonPos:new qe.Name("jsonPos"),jsonLen:new qe.Name("jsonLen"),jsonPart:new qe.Name("jsonPart")};bt.default=df,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=Q,r=M,n=bt;t.keywordError={message:({keyword:h})=>(0,e.str)`must pass "${h}" keyword validation`},t.keyword$DataError={message:({keyword:h,schemaType:d})=>d?(0,e.str)`"${h}" keyword must be ${d} ($data)`:(0,e.str)`"${h}" keyword is invalid ($data)`};function s(h,d=t.keywordError,m,w){const{it:S}=h,{gen:P,compositeRule:O,allErrors:V}=S,ce=f(h,d,m);w??(O||V)?c(P,ce):u(S,(0,e._)`[${ce}]`)}t.reportError=s;function o(h,d=t.keywordError,m){const{it:w}=h,{gen:S,compositeRule:P,allErrors:O}=w,V=f(h,d,m);c(S,V),P||O||u(w,n.default.vErrors)}t.reportExtraError=o;function i(h,d){h.assign(n.default.errors,d),h.if((0,e._)`${n.default.vErrors} !== null`,()=>h.if(d,()=>h.assign((0,e._)`${n.default.vErrors}.length`,d),()=>h.assign(n.default.vErrors,null)))}t.resetErrorsCount=i;function a({gen:h,keyword:d,schemaValue:m,data:w,errsCount:S,it:P}){if(S===void 0)throw new Error("ajv implementation error");const O=h.name("err");h.forRange("i",S,n.default.errors,V=>{h.const(O,(0,e._)`${n.default.vErrors}[${V}]`),h.if((0,e._)`${O}.instancePath === undefined`,()=>h.assign((0,e._)`${O}.instancePath`,(0,e.strConcat)(n.default.instancePath,P.errorPath))),h.assign((0,e._)`${O}.schemaPath`,(0,e.str)`${P.errSchemaPath}/${d}`),P.opts.verbose&&(h.assign((0,e._)`${O}.schema`,m),h.assign((0,e._)`${O}.data`,w))})}t.extendErrors=a;function c(h,d){const m=h.const("err",d);h.if((0,e._)`${n.default.vErrors} === null`,()=>h.assign(n.default.vErrors,(0,e._)`[${m}]`),(0,e._)`${n.default.vErrors}.push(${m})`),h.code((0,e._)`${n.default.errors}++`)}function u(h,d){const{gen:m,validateName:w,schemaEnv:S}=h;S.$async?m.throw((0,e._)`new ${h.ValidationError}(${d})`):(m.assign((0,e._)`${w}.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(h,d,m){const{createErrors:w}=h.it;return w===!1?(0,e._)`{}`:_(h,d,m)}function _(h,d,m={}){const{gen:w,it:S}=h,P=[y(S,m),g(h,m)];return v(h,d,P),w.object(...P)}function y({errorPath:h},{instancePath:d}){const m=d?(0,e.str)`${h}${(0,r.getErrorPath)(d,r.Type.Str)}`:h;return[n.default.instancePath,(0,e.strConcat)(n.default.instancePath,m)]}function g({keyword:h,it:{errSchemaPath:d}},{schemaPath:m,parentSchema:w}){let S=w?d:(0,e.str)`${d}/${h}`;return m&&(S=(0,e.str)`${S}${(0,r.getErrorPath)(m,r.Type.Str)}`),[l.schemaPath,S]}function v(h,{params:d,message:m},w){const{keyword:S,data:P,schemaValue:O,it:V}=h,{opts:ce,propertyName:G,topSchemaRef:Ae,schemaPath:U}=V;w.push([l.keyword,S],[l.params,typeof d=="function"?d(h):d||(0,e._)`{}`]),ce.messages&&w.push([l.message,typeof m=="function"?m(h):m]),ce.verbose&&w.push([l.schema,O],[l.parentSchema,(0,e._)`${Ae}${U}`],[n.default.data,P]),G&&w.push([l.propertyName,G])}}(qr),Object.defineProperty(gr,"__esModule",{value:!0}),gr.boolOrEmptySchema=gr.topBoolOrEmptySchema=void 0;const ff=qr,hf=Q,pf=bt,mf={message:"boolean schema is false"};function _f(t){const{gen:e,schema:r,validateName:n}=t;r===!1?tc(t,!1):typeof r=="object"&&r.$async===!0?e.return(pf.default.data):(e.assign((0,hf._)`${n}.errors`,null),e.return(!0))}gr.topBoolOrEmptySchema=_f;function gf(t,e){const{gen:r,schema:n}=t;n===!1?(r.var(e,!1),tc(t)):r.var(e,!0)}gr.boolOrEmptySchema=gf;function tc(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,ff.reportError)(s,mf,void 0,e)}var Oe={},tr={};Object.defineProperty(tr,"__esModule",{value:!0}),tr.getRules=tr.isJSONType=void 0;const vf=["string","number","integer","boolean","null","object","array"],yf=new Set(vf);function bf(t){return typeof t=="string"&&yf.has(t)}tr.isJSONType=bf;function wf(){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:{}}}tr.getRules=wf;var It={};Object.defineProperty(It,"__esModule",{value:!0}),It.shouldUseRule=It.shouldUseGroup=It.schemaHasRulesForType=void 0;function $f({schema:t,self:e},r){const n=e.RULES.types[r];return n&&n!==!0&&rc(t,n)}It.schemaHasRulesForType=$f;function rc(t,e){return e.rules.some(r=>nc(t,r))}It.shouldUseGroup=rc;function nc(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))}It.shouldUseRule=nc,Object.defineProperty(Oe,"__esModule",{value:!0}),Oe.reportTypeError=Oe.checkDataTypes=Oe.checkDataType=Oe.coerceAndCheckDataType=Oe.getJSONTypes=Oe.getSchemaTypes=Oe.DataType=void 0;const Sf=tr,kf=It,Ef=qr,X=Q,sc=M;var vr;(function(t){t[t.Correct=0]="Correct",t[t.Wrong=1]="Wrong"})(vr||(Oe.DataType=vr={}));function Pf(t){const e=oc(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}Oe.getSchemaTypes=Pf;function oc(t){const e=Array.isArray(t)?t:t?[t]:[];if(e.every(Sf.isJSONType))return e;throw new Error("type must be JSONType or JSONType[]: "+e.join(","))}Oe.getJSONTypes=oc;function Tf(t,e){const{gen:r,data:n,opts:s}=t,o=xf(e,s.coerceTypes),i=e.length>0&&!(o.length===0&&e.length===1&&(0,kf.schemaHasRulesForType)(t,e[0]));if(i){const a=uo(e,n,s.strictNumbers,vr.Wrong);r.if(a,()=>{o.length?Rf(t,e,o):lo(t)})}return i}Oe.coerceAndCheckDataType=Tf;const ic=new Set(["string","number","integer","boolean","null"]);function xf(t,e){return e?t.filter(r=>ic.has(r)||e==="array"&&r==="array"):[]}function Rf(t,e,r){const{gen:n,data:s,opts:o}=t,i=n.let("dataType",(0,X._)`typeof ${s}`),a=n.let("coerced",(0,X._)`undefined`);o.coerceTypes==="array"&&n.if((0,X._)`${i} == 'object' && Array.isArray(${s}) && ${s}.length == 1`,()=>n.assign(s,(0,X._)`${s}[0]`).assign(i,(0,X._)`typeof ${s}`).if(uo(e,s,o.strictNumbers),()=>n.assign(a,s))),n.if((0,X._)`${a} !== undefined`);for(const u of r)(ic.has(u)||u==="array"&&o.coerceTypes==="array")&&c(u);n.else(),lo(t),n.endIf(),n.if((0,X._)`${a} !== undefined`,()=>{n.assign(s,a),If(t,a)});function c(u){switch(u){case"string":n.elseIf((0,X._)`${i} == "number" || ${i} == "boolean"`).assign(a,(0,X._)`"" + ${s}`).elseIf((0,X._)`${s} === null`).assign(a,(0,X._)`""`);return;case"number":n.elseIf((0,X._)`${i} == "boolean" || ${s} === null
3
+ || (${i} == "string" && ${s} && ${s} == +${s})`).assign(a,(0,X._)`+${s}`);return;case"integer":n.elseIf((0,X._)`${i} === "boolean" || ${s} === null
4
+ || (${i} === "string" && ${s} && ${s} == +${s} && !(${s} % 1))`).assign(a,(0,X._)`+${s}`);return;case"boolean":n.elseIf((0,X._)`${s} === "false" || ${s} === 0 || ${s} === null`).assign(a,!1).elseIf((0,X._)`${s} === "true" || ${s} === 1`).assign(a,!0);return;case"null":n.elseIf((0,X._)`${s} === "" || ${s} === 0 || ${s} === false`),n.assign(a,null);return;case"array":n.elseIf((0,X._)`${i} === "string" || ${i} === "number"
5
+ || ${i} === "boolean" || ${s} === null`).assign(a,(0,X._)`[${s}]`)}}}function If({gen:t,parentData:e,parentDataProperty:r},n){t.if((0,X._)`${e} !== undefined`,()=>t.assign((0,X._)`${e}[${r}]`,n))}function co(t,e,r,n=vr.Correct){const s=n===vr.Correct?X.operators.EQ:X.operators.NEQ;let o;switch(t){case"null":return(0,X._)`${e} ${s} null`;case"array":o=(0,X._)`Array.isArray(${e})`;break;case"object":o=(0,X._)`${e} && typeof ${e} == "object" && !Array.isArray(${e})`;break;case"integer":o=i((0,X._)`!(${e} % 1) && !isNaN(${e})`);break;case"number":o=i();break;default:return(0,X._)`typeof ${e} ${s} ${t}`}return n===vr.Correct?o:(0,X.not)(o);function i(a=X.nil){return(0,X.and)((0,X._)`typeof ${e} == "number"`,a,r?(0,X._)`isFinite(${e})`:X.nil)}}Oe.checkDataType=co;function uo(t,e,r,n){if(t.length===1)return co(t[0],e,r,n);let s;const o=(0,sc.toHash)(t);if(o.array&&o.object){const i=(0,X._)`typeof ${e} != "object"`;s=o.null?i:(0,X._)`!${e} || ${i}`,delete o.null,delete o.array,delete o.object}else s=X.nil;o.number&&delete o.integer;for(const i in o)s=(0,X.and)(s,co(i,e,r,n));return s}Oe.checkDataTypes=uo;const Cf={message:({schema:t})=>`must be ${t}`,params:({schema:t,schemaValue:e})=>typeof t=="string"?(0,X._)`{type: ${t}}`:(0,X._)`{type: ${e}}`};function lo(t){const e=Of(t);(0,Ef.reportError)(e,Cf)}Oe.reportTypeError=lo;function Of(t){const{gen:e,data:r,schema:n}=t,s=(0,sc.schemaRefOrVal)(t,n,"type");return{gen:e,keyword:"type",data:r,schema:n.type,schemaCode:s,schemaValue:s,parentSchema:n,params:{},it:t}}var Dn={};Object.defineProperty(Dn,"__esModule",{value:!0}),Dn.assignDefaults=void 0;const yr=Q,Nf=M;function jf(t,e){const{properties:r,items:n}=t.schema;if(e==="object"&&r)for(const s in r)ac(t,s,r[s].default);else e==="array"&&Array.isArray(n)&&n.forEach((s,o)=>ac(t,o,s.default))}Dn.assignDefaults=jf;function ac(t,e,r){const{gen:n,compositeRule:s,data:o,opts:i}=t;if(r===void 0)return;const a=(0,yr._)`${o}${(0,yr.getProperty)(e)}`;if(s){(0,Nf.checkStrictMode)(t,`default is ignored for: ${a}`);return}let c=(0,yr._)`${a} === undefined`;i.useDefaults==="empty"&&(c=(0,yr._)`${c} || ${a} === null || ${a} === ""`),n.if(c,(0,yr._)`${a} = ${(0,yr.stringify)(r)}`)}var wt={},te={};Object.defineProperty(te,"__esModule",{value:!0}),te.validateUnion=te.validateArray=te.usePattern=te.callValidateCode=te.schemaProperties=te.allSchemaProperties=te.noPropertyInData=te.propertyInData=te.isOwnProperty=te.hasPropFunc=te.reportMissingProp=te.checkMissingProp=te.checkReportMissingProp=void 0;const ve=Q,fo=M,Ut=bt,Af=M;function zf(t,e){const{gen:r,data:n,it:s}=t;r.if(po(r,n,e,s.opts.ownProperties),()=>{t.setParams({missingProperty:(0,ve._)`${e}`},!0),t.error()})}te.checkReportMissingProp=zf;function Mf({gen:t,data:e,it:{opts:r}},n,s){return(0,ve.or)(...n.map(o=>(0,ve.and)(po(t,e,o,r.ownProperties),(0,ve._)`${s} = ${o}`)))}te.checkMissingProp=Mf;function Zf(t,e){t.setParams({missingProperty:e},!0),t.error()}te.reportMissingProp=Zf;function cc(t){return t.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:(0,ve._)`Object.prototype.hasOwnProperty`})}te.hasPropFunc=cc;function ho(t,e,r){return(0,ve._)`${cc(t)}.call(${e}, ${r})`}te.isOwnProperty=ho;function Lf(t,e,r,n){const s=(0,ve._)`${e}${(0,ve.getProperty)(r)} !== undefined`;return n?(0,ve._)`${s} && ${ho(t,e,r)}`:s}te.propertyInData=Lf;function po(t,e,r,n){const s=(0,ve._)`${e}${(0,ve.getProperty)(r)} === undefined`;return n?(0,ve.or)(s,(0,ve.not)(ho(t,e,r))):s}te.noPropertyInData=po;function uc(t){return t?Object.keys(t).filter(e=>e!=="__proto__"):[]}te.allSchemaProperties=uc;function Uf(t,e){return uc(e).filter(r=>!(0,fo.alwaysValidSchema)(t,e[r]))}te.schemaProperties=Uf;function Df({schemaCode:t,data:e,it:{gen:r,topSchemaRef:n,schemaPath:s,errorPath:o},it:i},a,c,u){const l=u?(0,ve._)`${t}, ${e}, ${n}${s}`:e,f=[[Ut.default.instancePath,(0,ve.strConcat)(Ut.default.instancePath,o)],[Ut.default.parentData,i.parentData],[Ut.default.parentDataProperty,i.parentDataProperty],[Ut.default.rootData,Ut.default.rootData]];i.opts.dynamicRef&&f.push([Ut.default.dynamicAnchors,Ut.default.dynamicAnchors]);const _=(0,ve._)`${l}, ${r.object(...f)}`;return c!==ve.nil?(0,ve._)`${a}.call(${c}, ${_})`:(0,ve._)`${a}(${_})`}te.callValidateCode=Df;const qf=(0,ve._)`new RegExp`;function Vf({gen:t,it:{opts:e}},r){const n=e.unicodeRegExp?"u":"",{regExp:s}=e.code,o=s(r,n);return t.scopeValue("pattern",{key:o.toString(),ref:o,code:(0,ve._)`${s.code==="new RegExp"?qf:(0,Af.useFunc)(t,s)}(${r}, ${n})`})}te.usePattern=Vf;function Ff(t){const{gen:e,data:r,keyword:n,it:s}=t,o=e.name("valid");if(s.allErrors){const a=e.let("valid",!0);return i(()=>e.assign(a,!1)),a}return e.var(o,!0),i(()=>e.break()),o;function i(a){const c=e.const("len",(0,ve._)`${r}.length`);e.forRange("i",0,c,u=>{t.subschema({keyword:n,dataProp:u,dataPropType:fo.Type.Num},o),e.if((0,ve.not)(o),a)})}}te.validateArray=Ff;function Hf(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,fo.alwaysValidSchema)(s,c))&&!s.opts.unevaluated)return;const i=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(i,(0,ve._)`${i} || ${a}`),t.mergeValidEvaluated(l,a)||e.if((0,ve.not)(i))})),t.result(i,()=>t.reset(),()=>t.error(!0))}te.validateUnion=Hf,Object.defineProperty(wt,"__esModule",{value:!0}),wt.validateKeywordUsage=wt.validSchemaType=wt.funcKeywordCode=wt.macroKeywordCode=void 0;const Fe=Q,rr=bt,Wf=te,Jf=qr;function Bf(t,e){const{gen:r,keyword:n,schema:s,parentSchema:o,it:i}=t,a=e.macro.call(i.self,s,o,i),c=dc(r,n,a);i.opts.validateSchema!==!1&&i.self.validateSchema(a,!0);const u=r.name("valid");t.subschema({schema:a,schemaPath:Fe.nil,errSchemaPath:`${i.errSchemaPath}/${n}`,topSchemaRef:c,compositeRule:!0},u),t.pass(u,()=>t.error(!0))}wt.macroKeywordCode=Bf;function Kf(t,e){var r;const{gen:n,keyword:s,schema:o,parentSchema:i,$data:a,it:c}=t;Yf(c,e);const u=!a&&e.compile?e.compile.call(c.self,o,i,c):e.validate,l=dc(n,s,u),f=n.let("valid");t.block$data(f,_),t.ok((r=e.valid)!==null&&r!==void 0?r:f);function _(){if(e.errors===!1)v(),e.modifying&&lc(t),h(()=>t.error());else{const d=e.async?y():g();e.modifying&&lc(t),h(()=>Gf(t,d))}}function y(){const d=n.let("ruleErrs",null);return n.try(()=>v((0,Fe._)`await `),m=>n.assign(f,!1).if((0,Fe._)`${m} instanceof ${c.ValidationError}`,()=>n.assign(d,(0,Fe._)`${m}.errors`),()=>n.throw(m))),d}function g(){const d=(0,Fe._)`${l}.errors`;return n.assign(d,null),v(Fe.nil),d}function v(d=e.async?(0,Fe._)`await `:Fe.nil){const m=c.opts.passContext?rr.default.this:rr.default.self,w=!("compile"in e&&!a||e.schema===!1);n.assign(f,(0,Fe._)`${d}${(0,Wf.callValidateCode)(t,l,m,w)}`,e.modifying)}function h(d){var m;n.if((0,Fe.not)((m=e.valid)!==null&&m!==void 0?m:f),d)}}wt.funcKeywordCode=Kf;function lc(t){const{gen:e,data:r,it:n}=t;e.if(n.parentData,()=>e.assign(r,(0,Fe._)`${n.parentData}[${n.parentDataProperty}]`))}function Gf(t,e){const{gen:r}=t;r.if((0,Fe._)`Array.isArray(${e})`,()=>{r.assign(rr.default.vErrors,(0,Fe._)`${rr.default.vErrors} === null ? ${e} : ${rr.default.vErrors}.concat(${e})`).assign(rr.default.errors,(0,Fe._)`${rr.default.vErrors}.length`),(0,Jf.extendErrors)(t)},()=>t.error())}function Yf({schemaEnv:t},e){if(e.async&&!t.$async)throw new Error("async keyword in sync schema")}function dc(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,Fe.stringify)(r)})}function Xf(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")}wt.validSchemaType=Xf;function Qf({schema:t,opts:e,self:r,errSchemaPath:n},s,o){if(Array.isArray(s.keyword)?!s.keyword.includes(o):s.keyword!==o)throw new Error("ajv implementation error");const i=s.dependencies;if(i!=null&&i.some(a=>!Object.prototype.hasOwnProperty.call(t,a)))throw new Error(`parent schema must have dependencies of ${o}: ${i.join(",")}`);if(s.validateSchema&&!s.validateSchema(t[o])){const c=`keyword "${o}" value is invalid at path "${n}": `+r.errorsText(s.validateSchema.errors);if(e.validateSchema==="log")r.logger.error(c);else throw new Error(c)}}wt.validateKeywordUsage=Qf;var Dt={};Object.defineProperty(Dt,"__esModule",{value:!0}),Dt.extendSubschemaMode=Dt.extendSubschemaData=Dt.getSubschema=void 0;const $t=Q,fc=M;function eh(t,{keyword:e,schemaProp:r,schema:n,schemaPath:s,errSchemaPath:o,topSchemaRef:i}){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,$t._)`${t.schemaPath}${(0,$t.getProperty)(e)}`,errSchemaPath:`${t.errSchemaPath}/${e}`}:{schema:a[r],schemaPath:(0,$t._)`${t.schemaPath}${(0,$t.getProperty)(e)}${(0,$t.getProperty)(r)}`,errSchemaPath:`${t.errSchemaPath}/${e}/${(0,fc.escapeFragment)(r)}`}}if(n!==void 0){if(s===void 0||o===void 0||i===void 0)throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:n,schemaPath:s,topSchemaRef:i,errSchemaPath:o}}throw new Error('either "keyword" or "schema" must be passed')}Dt.getSubschema=eh;function th(t,e,{dataProp:r,dataPropType:n,data:s,dataTypes:o,propertyName:i}){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,_=a.let("data",(0,$t._)`${e.data}${(0,$t.getProperty)(r)}`,!0);c(_),t.errorPath=(0,$t.str)`${u}${(0,fc.getErrorPath)(r,n,f.jsPropertySyntax)}`,t.parentDataProperty=(0,$t._)`${r}`,t.dataPathArr=[...l,t.parentDataProperty]}if(s!==void 0){const u=s instanceof $t.Name?s:a.let("data",s,!0);c(u),i!==void 0&&(t.propertyName=i)}o&&(t.dataTypes=o);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]}}Dt.extendSubschemaData=th;function rh(t,{jtdDiscriminator:e,jtdMetadata:r,compositeRule:n,createErrors:s,allErrors:o}){n!==void 0&&(t.compositeRule=n),s!==void 0&&(t.createErrors=s),o!==void 0&&(t.allErrors=o),t.jtdDiscriminator=e,t.jtdMetadata=r}Dt.extendSubschemaMode=rh;var Me={},hc=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,o;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(o=Object.keys(e),n=o.length,n!==Object.keys(r).length)return!1;for(s=n;s--!==0;)if(!Object.prototype.hasOwnProperty.call(r,o[s]))return!1;for(s=n;s--!==0;){var i=o[s];if(!t(e[i],r[i]))return!1}return!0}return e!==e&&r!==r},pc={exports:{}},qt=pc.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(){};qn(e,n,s,t,"",t)};qt.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0},qt.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0},qt.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0},qt.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 qn(t,e,r,n,s,o,i,a,c,u){if(n&&typeof n=="object"&&!Array.isArray(n)){e(n,s,o,i,a,c,u);for(var l in n){var f=n[l];if(Array.isArray(f)){if(l in qt.arrayKeywords)for(var _=0;_<f.length;_++)qn(t,e,r,f[_],s+"/"+l+"/"+_,o,s,l,n,_)}else if(l in qt.propsKeywords){if(f&&typeof f=="object")for(var y in f)qn(t,e,r,f[y],s+"/"+l+"/"+nh(y),o,s,l,n,y)}else(l in qt.keywords||t.allKeys&&!(l in qt.skipKeywords))&&qn(t,e,r,f,s+"/"+l,o,s,l,n)}r(n,s,o,i,a,c,u)}}function nh(t){return t.replace(/~/g,"~0").replace(/\//g,"~1")}var sh=pc.exports;Object.defineProperty(Me,"__esModule",{value:!0}),Me.getSchemaRefs=Me.resolveUrl=Me.normalizeId=Me._getFullPath=Me.getFullPath=Me.inlineRef=void 0;const oh=M,ih=hc,ah=sh,ch=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function uh(t,e=!0){return typeof t=="boolean"?!0:e===!0?!mo(t):e?mc(t)<=e:!1}Me.inlineRef=uh;const lh=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function mo(t){for(const e in t){if(lh.has(e))return!0;const r=t[e];if(Array.isArray(r)&&r.some(mo)||typeof r=="object"&&mo(r))return!0}return!1}function mc(t){let e=0;for(const r in t){if(r==="$ref")return 1/0;if(e++,!ch.has(r)&&(typeof t[r]=="object"&&(0,oh.eachItem)(t[r],n=>e+=mc(n)),e===1/0))return 1/0}return e}function _c(t,e="",r){r!==!1&&(e=br(e));const n=t.parse(e);return gc(t,n)}Me.getFullPath=_c;function gc(t,e){return t.serialize(e).split("#")[0]+"#"}Me._getFullPath=gc;const dh=/#\/?$/;function br(t){return t?t.replace(dh,""):""}Me.normalizeId=br;function fh(t,e,r){return r=br(r),t.resolve(e,r)}Me.resolveUrl=fh;const hh=/^[a-z_][-a-z0-9._]*$/i;function ph(t,e){if(typeof t=="boolean")return{};const{schemaId:r,uriResolver:n}=this.opts,s=br(t[r]||e),o={"":s},i=_c(n,s,!1),a={},c=new Set;return ah(t,{allKeys:!0},(f,_,y,g)=>{if(g===void 0)return;const v=i+_;let h=o[g];typeof f[r]=="string"&&(h=d.call(this,f[r])),m.call(this,f.$anchor),m.call(this,f.$dynamicAnchor),o[_]=h;function d(w){const S=this.opts.uriResolver.resolve;if(w=br(h?S(h,w):w),c.has(w))throw l(w);c.add(w);let P=this.refs[w];return typeof P=="string"&&(P=this.refs[P]),typeof P=="object"?u(f,P.schema,w):w!==br(v)&&(w[0]==="#"?(u(f,a[w],w),a[w]=f):this.refs[w]=v),w}function m(w){if(typeof w=="string"){if(!hh.test(w))throw new Error(`invalid anchor "${w}"`);d.call(this,`#${w}`)}}}),a;function u(f,_,y){if(_!==void 0&&!ih(f,_))throw l(y)}function l(f){return new Error(`reference "${f}" resolves to more than one schema`)}}Me.getSchemaRefs=ph,Object.defineProperty(ot,"__esModule",{value:!0}),ot.getData=ot.KeywordCxt=ot.validateFunctionCode=void 0;const vc=gr,yc=Oe,_o=It,Vn=Oe,mh=Dn,Fr=wt,go=Dt,q=Q,B=bt,_h=Me,Ct=M,Hr=qr;function gh(t){if(Sc(t)&&(kc(t),$c(t))){bh(t);return}bc(t,()=>(0,vc.topBoolOrEmptySchema)(t))}ot.validateFunctionCode=gh;function bc({gen:t,validateName:e,schema:r,schemaEnv:n,opts:s},o){s.code.es5?t.func(e,(0,q._)`${B.default.data}, ${B.default.valCxt}`,n.$async,()=>{t.code((0,q._)`"use strict"; ${wc(r,s)}`),yh(t,s),t.code(o)}):t.func(e,(0,q._)`${B.default.data}, ${vh(s)}`,n.$async,()=>t.code(wc(r,s)).code(o))}function vh(t){return(0,q._)`{${B.default.instancePath}="", ${B.default.parentData}, ${B.default.parentDataProperty}, ${B.default.rootData}=${B.default.data}${t.dynamicRef?(0,q._)`, ${B.default.dynamicAnchors}={}`:q.nil}}={}`}function yh(t,e){t.if(B.default.valCxt,()=>{t.var(B.default.instancePath,(0,q._)`${B.default.valCxt}.${B.default.instancePath}`),t.var(B.default.parentData,(0,q._)`${B.default.valCxt}.${B.default.parentData}`),t.var(B.default.parentDataProperty,(0,q._)`${B.default.valCxt}.${B.default.parentDataProperty}`),t.var(B.default.rootData,(0,q._)`${B.default.valCxt}.${B.default.rootData}`),e.dynamicRef&&t.var(B.default.dynamicAnchors,(0,q._)`${B.default.valCxt}.${B.default.dynamicAnchors}`)},()=>{t.var(B.default.instancePath,(0,q._)`""`),t.var(B.default.parentData,(0,q._)`undefined`),t.var(B.default.parentDataProperty,(0,q._)`undefined`),t.var(B.default.rootData,B.default.data),e.dynamicRef&&t.var(B.default.dynamicAnchors,(0,q._)`{}`)})}function bh(t){const{schema:e,opts:r,gen:n}=t;bc(t,()=>{r.$comment&&e.$comment&&Pc(t),Eh(t),n.let(B.default.vErrors,null),n.let(B.default.errors,0),r.unevaluated&&wh(t),Ec(t),xh(t)})}function wh(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 wc(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 $h(t,e){if(Sc(t)&&(kc(t),$c(t))){Sh(t,e);return}(0,vc.boolOrEmptySchema)(t,e)}function $c({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 Sc(t){return typeof t.schema!="boolean"}function Sh(t,e){const{schema:r,gen:n,opts:s}=t;s.$comment&&r.$comment&&Pc(t),Ph(t),Th(t);const o=n.const("_errs",B.default.errors);Ec(t,o),n.var(e,(0,q._)`${o} === ${B.default.errors}`)}function kc(t){(0,Ct.checkUnknownRules)(t),kh(t)}function Ec(t,e){if(t.opts.jtd)return Tc(t,[],!1,e);const r=(0,yc.getSchemaTypes)(t.schema),n=(0,yc.coerceAndCheckDataType)(t,r);Tc(t,r,!n,e)}function kh(t){const{schema:e,errSchemaPath:r,opts:n,self:s}=t;e.$ref&&n.ignoreKeywordsWithRef&&(0,Ct.schemaHasRulesButRef)(e,s.RULES)&&s.logger.warn(`$ref: keywords ignored in schema at path "${r}"`)}function Eh(t){const{schema:e,opts:r}=t;e.default!==void 0&&r.useDefaults&&r.strictSchema&&(0,Ct.checkStrictMode)(t,"default is ignored in the schema root")}function Ph(t){const e=t.schema[t.opts.schemaId];e&&(t.baseId=(0,_h.resolveUrl)(t.opts.uriResolver,t.baseId,e))}function Th(t){if(t.schema.$async&&!t.schemaEnv.$async)throw new Error("async schema in sync schema")}function Pc({gen:t,schemaEnv:e,schema:r,errSchemaPath:n,opts:s}){const o=r.$comment;if(s.$comment===!0)t.code((0,q._)`${B.default.self}.logger.log(${o})`);else if(typeof s.$comment=="function"){const i=(0,q.str)`${n}/$comment`,a=t.scopeValue("root",{ref:e.root});t.code((0,q._)`${B.default.self}.opts.$comment(${o}, ${i}, ${a}.schema)`)}}function xh(t){const{gen:e,schemaEnv:r,validateName:n,ValidationError:s,opts:o}=t;r.$async?e.if((0,q._)`${B.default.errors} === 0`,()=>e.return(B.default.data),()=>e.throw((0,q._)`new ${s}(${B.default.vErrors})`)):(e.assign((0,q._)`${n}.errors`,B.default.vErrors),o.unevaluated&&Rh(t),e.return((0,q._)`${B.default.errors} === 0`))}function Rh({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 Tc(t,e,r,n){const{gen:s,schema:o,data:i,allErrors:a,opts:c,self:u}=t,{RULES:l}=u;if(o.$ref&&(c.ignoreKeywordsWithRef||!(0,Ct.schemaHasRulesButRef)(o,l))){s.block(()=>Cc(t,"$ref",l.all.$ref.definition));return}c.jtd||Ih(t,e),s.block(()=>{for(const _ of l.rules)f(_);f(l.post)});function f(_){(0,_o.shouldUseGroup)(o,_)&&(_.type?(s.if((0,Vn.checkDataType)(_.type,i,c.strictNumbers)),xc(t,_),e.length===1&&e[0]===_.type&&r&&(s.else(),(0,Vn.reportTypeError)(t)),s.endIf()):xc(t,_),a||s.if((0,q._)`${B.default.errors} === ${n||0}`))}}function xc(t,e){const{gen:r,schema:n,opts:{useDefaults:s}}=t;s&&(0,mh.assignDefaults)(t,e.type),r.block(()=>{for(const o of e.rules)(0,_o.shouldUseRule)(n,o)&&Cc(t,o.keyword,o.definition,e.type)})}function Ih(t,e){t.schemaEnv.meta||!t.opts.strictTypes||(Ch(t,e),t.opts.allowUnionTypes||Oh(t,e),Nh(t,t.dataTypes))}function Ch(t,e){if(e.length){if(!t.dataTypes.length){t.dataTypes=e;return}e.forEach(r=>{Rc(t.dataTypes,r)||vo(t,`type "${r}" not allowed by context "${t.dataTypes.join(",")}"`)}),Ah(t,e)}}function Oh(t,e){e.length>1&&!(e.length===2&&e.includes("null"))&&vo(t,"use allowUnionTypes to allow union type keyword")}function Nh(t,e){const r=t.self.RULES.all;for(const n in r){const s=r[n];if(typeof s=="object"&&(0,_o.shouldUseRule)(t.schema,s)){const{type:o}=s.definition;o.length&&!o.some(i=>jh(e,i))&&vo(t,`missing type "${o.join(",")}" for keyword "${n}"`)}}}function jh(t,e){return t.includes(e)||e==="number"&&t.includes("integer")}function Rc(t,e){return t.includes(e)||e==="integer"&&t.includes("number")}function Ah(t,e){const r=[];for(const n of t.dataTypes)Rc(e,n)?r.push(n):e.includes("integer")&&n==="number"&&r.push("integer");t.dataTypes=r}function vo(t,e){const r=t.schemaEnv.baseId+t.errSchemaPath;e+=` at "${r}" (strictTypes)`,(0,Ct.checkStrictMode)(t,e,t.opts.strictTypes)}class Ic{constructor(e,r,n){if((0,Fr.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,Ct.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",Oc(this.$data,e));else if(this.schemaCode=this.schemaValue,!(0,Fr.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",B.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?Hr.reportExtraError:Hr.reportError)(this,this.def.error,r)}$dataError(){(0,Hr.reportError)(this,this.def.$dataError||Hr.keyword$DataError)}reset(){if(this.errsCount===void 0)throw new Error('add "trackErrors" to keyword definition');(0,Hr.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:o,def:i}=this;n.if((0,q.or)((0,q._)`${s} === undefined`,r)),e!==q.nil&&n.assign(e,!0),(o.length||i.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:o}=this;return(0,q.or)(i(),a());function i(){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,o.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,go.getSubschema)(this.it,e);(0,go.extendSubschemaData)(n,this.it,e),(0,go.extendSubschemaMode)(n,e);const s={...this.it,...n,items:void 0,props:void 0};return $h(s,r),s}mergeEvaluated(e,r){const{it:n,gen:s}=this;n.opts.unevaluated&&(n.props!==!0&&e.props!==void 0&&(n.props=Ct.mergeEvaluated.props(s,e.props,n.props,r)),n.items!==!0&&e.items!==void 0&&(n.items=Ct.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}}ot.KeywordCxt=Ic;function Cc(t,e,r,n){const s=new Ic(t,r,e);"code"in r?r.code(s,n):s.$data&&r.validate?(0,Fr.funcKeywordCode)(s,r):"macro"in r?(0,Fr.macroKeywordCode)(s,r):(r.compile||r.validate)&&(0,Fr.funcKeywordCode)(s,r)}const zh=/^\/(?:[^~]|~0|~1)*$/,Mh=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function Oc(t,{dataLevel:e,dataNames:r,dataPathArr:n}){let s,o;if(t==="")return B.default.rootData;if(t[0]==="/"){if(!zh.test(t))throw new Error(`Invalid JSON-pointer: ${t}`);s=t,o=B.default.rootData}else{const u=Mh.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(o=r[e-l],!s)return o}let i=o;const a=s.split("/");for(const u of a)u&&(o=(0,q._)`${o}${(0,q.getProperty)((0,Ct.unescapeJsonPointer)(u))}`,i=(0,q._)`${i} && ${o}`);return i;function c(u,l){return`Cannot access ${u} ${l} levels up, current level is ${e}`}}ot.getData=Oc;var Wr={};Object.defineProperty(Wr,"__esModule",{value:!0});class Zh extends Error{constructor(e){super("validation failed"),this.errors=e,this.ajv=this.validation=!0}}Wr.default=Zh;var wr={};Object.defineProperty(wr,"__esModule",{value:!0});const yo=Me;class Lh extends Error{constructor(e,r,n,s){super(s||`can't resolve reference ${n} from id ${r}`),this.missingRef=(0,yo.resolveUrl)(e,r,n),this.missingSchema=(0,yo.normalizeId)((0,yo.getFullPath)(e,this.missingRef))}}wr.default=Lh;var Je={};Object.defineProperty(Je,"__esModule",{value:!0}),Je.resolveSchema=Je.getCompilingSchema=Je.resolveRef=Je.compileSchema=Je.SchemaEnv=void 0;const it=Q,Uh=Wr,nr=bt,at=Me,Nc=M,Dh=ot;class Fn{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,at.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={}}}Je.SchemaEnv=Fn;function bo(t){const e=jc.call(this,t);if(e)return e;const r=(0,at.getFullPath)(this.opts.uriResolver,t.root.baseId),{es5:n,lines:s}=this.opts.code,{ownProperties:o}=this.opts,i=new it.CodeGen(this.scope,{es5:n,lines:s,ownProperties:o});let a;t.$async&&(a=i.scopeValue("Error",{ref:Uh.default,code:(0,it._)`require("ajv/dist/runtime/validation_error").default`}));const c=i.scopeName("validate");t.validateName=c;const u={gen:i,allErrors:this.opts.allErrors,data:nr.default.data,parentData:nr.default.parentData,parentDataProperty:nr.default.parentDataProperty,dataNames:[nr.default.data],dataPathArr:[it.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:i.scopeValue("schema",this.opts.code.source===!0?{ref:t.schema,code:(0,it.stringify)(t.schema)}:{ref:t.schema}),validateName:c,ValidationError:a,schema:t.schema,schemaEnv:t,rootId:r,baseId:t.baseId||r,schemaPath:it.nil,errSchemaPath:t.schemaPath||(this.opts.jtd?"":"#"),errorPath:(0,it._)`""`,opts:this.opts,self:this};let l;try{this._compilations.add(t),(0,Dh.validateFunctionCode)(u),i.optimize(this.opts.code.optimize);const f=i.toString();l=`${i.scopeRefs(nr.default.scope)}return ${f}`,this.opts.code.process&&(l=this.opts.code.process(l,t));const y=new Function(`${nr.default.self}`,`${nr.default.scope}`,l)(this,this.scope.get());if(this.scope.value(c,{ref:y}),y.errors=null,y.schema=t.schema,y.schemaEnv=t,t.$async&&(y.$async=!0),this.opts.code.source===!0&&(y.source={validateName:c,validateCode:f,scopeValues:i._values}),this.opts.unevaluated){const{props:g,items:v}=u;y.evaluated={props:g instanceof it.Name?void 0:g,items:v instanceof it.Name?void 0:v,dynamicProps:g instanceof it.Name,dynamicItems:v instanceof it.Name},y.source&&(y.source.evaluated=(0,it.stringify)(y.evaluated))}return t.validate=y,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)}}Je.compileSchema=bo;function qh(t,e,r){var n;r=(0,at.resolveUrl)(this.opts.uriResolver,e,r);const s=t.refs[r];if(s)return s;let o=Hh.call(this,t,r);if(o===void 0){const i=(n=t.localRefs)===null||n===void 0?void 0:n[r],{schemaId:a}=this.opts;i&&(o=new Fn({schema:i,schemaId:a,root:t,baseId:e}))}if(o!==void 0)return t.refs[r]=Vh.call(this,o)}Je.resolveRef=qh;function Vh(t){return(0,at.inlineRef)(t.schema,this.opts.inlineRefs)?t.schema:t.validate?t:bo.call(this,t)}function jc(t){for(const e of this._compilations)if(Fh(e,t))return e}Je.getCompilingSchema=jc;function Fh(t,e){return t.schema===e.schema&&t.root===e.root&&t.baseId===e.baseId}function Hh(t,e){let r;for(;typeof(r=this.refs[e])=="string";)e=r;return r||this.schemas[e]||Hn.call(this,t,e)}function Hn(t,e){const r=this.opts.uriResolver.parse(e),n=(0,at._getFullPath)(this.opts.uriResolver,r);let s=(0,at.getFullPath)(this.opts.uriResolver,t.baseId,void 0);if(Object.keys(t.schema).length>0&&n===s)return wo.call(this,r,t);const o=(0,at.normalizeId)(n),i=this.refs[o]||this.schemas[o];if(typeof i=="string"){const a=Hn.call(this,t,i);return typeof(a==null?void 0:a.schema)!="object"?void 0:wo.call(this,r,a)}if(typeof(i==null?void 0:i.schema)=="object"){if(i.validate||bo.call(this,i),o===(0,at.normalizeId)(e)){const{schema:a}=i,{schemaId:c}=this.opts,u=a[c];return u&&(s=(0,at.resolveUrl)(this.opts.uriResolver,s,u)),new Fn({schema:a,schemaId:c,root:t,baseId:s})}return wo.call(this,r,i)}}Je.resolveSchema=Hn;const Wh=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function wo(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,Nc.unescapeFragment)(a)];if(c===void 0)return;r=c;const u=typeof r=="object"&&r[this.opts.schemaId];!Wh.has(a)&&u&&(e=(0,at.resolveUrl)(this.opts.uriResolver,e,u))}let o;if(typeof r!="boolean"&&r.$ref&&!(0,Nc.schemaHasRulesButRef)(r,this.RULES)){const a=(0,at.resolveUrl)(this.opts.uriResolver,e,r.$ref);o=Hn.call(this,n,a)}const{schemaId:i}=this.opts;if(o=o||new Fn({schema:r,schemaId:i,root:n,baseId:e}),o.schema!==o.root.schema)return o}const Jh={$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 $o={},Wn={exports:{}};const Bh=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),Ac=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 zc(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 Kh=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function Mc(t){return t.length=0,!0}function Gh(t,e,r){if(t.length){const n=zc(t);if(n!=="")e.push(n);else return r.error=!0,!1;t.length=0}return!0}function Yh(t){let e=0;const r={error:!1,address:"",zone:""},n=[],s=[];let o=!1,i=!1,a=Gh;for(let c=0;c<t.length;c++){const u=t[c];if(!(u==="["||u==="]"))if(u===":"){if(o===!0&&(i=!0),!a(s,n,r))break;if(++e>7){r.error=!0;break}c>0&&t[c-1]===":"&&(o=!0),n.push(":");continue}else if(u==="%"){if(!a(s,n,r))break;a=Mc}else{s.push(u);continue}}return s.length&&(a===Mc?r.zone=s.join(""):i?n.push(s.join("")):n.push(zc(s))),r.address=n.join(""),r}function Zc(t){if(Xh(t,":")<2)return{host:t,isIPV6:!1};const e=Yh(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 Xh(t,e){let r=0;for(let n=0;n<t.length;n++)t[n]===e&&r++;return r}function Qh(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 ep(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 tp(t){const e=[];if(t.userinfo!==void 0&&(e.push(t.userinfo),e.push("@")),t.host!==void 0){let r=unescape(t.host);if(!Ac(r)){const n=Zc(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 Lc={nonSimpleDomain:Kh,recomposeAuthority:tp,normalizeComponentEncoding:ep,removeDotSegments:Qh,isIPv4:Ac,isUUID:Bh,normalizeIPv6:Zc};const{isUUID:rp}=Lc,np=/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu;function Uc(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 Dc(t){return t.host||(t.error=t.error||"HTTP URIs must have a host."),t}function qc(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 sp(t){return t.secure=Uc(t),t.resourceName=(t.path||"/")+(t.query?"?"+t.query:""),t.path=void 0,t.query=void 0,t}function op(t){if((t.port===(Uc(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 ip(t,e){if(!t.path)return t.error="URN can not be parsed",t;const r=t.path.match(np);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}`,o=So(s);t.path=void 0,o&&(t=o.parse(t,e))}else t.error=t.error||"URN can not be parsed.";return t}function ap(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}`,o=So(s);o&&(t=o.serialize(t,e));const i=t,a=t.nss;return i.path=`${n||e.nid}:${a}`,e.skipEscape=!0,i}function cp(t,e){const r=t;return r.uuid=r.nss,r.nss=void 0,!e.tolerant&&(!r.uuid||!rp(r.uuid))&&(r.error=r.error||"UUID is not valid."),r}function up(t){const e=t;return e.nss=(t.uuid||"").toLowerCase(),e}const Vc={scheme:"http",domainHost:!0,parse:Dc,serialize:qc},lp={scheme:"https",domainHost:Vc.domainHost,parse:Dc,serialize:qc},Jn={scheme:"ws",domainHost:!0,parse:sp,serialize:op},dp={scheme:"wss",domainHost:Jn.domainHost,parse:Jn.parse,serialize:Jn.serialize},Bn={http:Vc,https:lp,ws:Jn,wss:dp,urn:{scheme:"urn",parse:ip,serialize:ap,skipNormalize:!0},"urn:uuid":{scheme:"urn:uuid",parse:cp,serialize:up,skipNormalize:!0}};Object.setPrototypeOf(Bn,null);function So(t){return t&&(Bn[t]||Bn[t.toLowerCase()])||void 0}var fp={SCHEMES:Bn,getSchemeHandler:So};const{normalizeIPv6:hp,removeDotSegments:Jr,recomposeAuthority:pp,normalizeComponentEncoding:Kn,isIPv4:mp,nonSimpleDomain:_p}=Lc,{SCHEMES:gp,getSchemeHandler:Fc}=fp;function vp(t,e){return typeof t=="string"?t=St(Ot(t,e),e):typeof t=="object"&&(t=Ot(St(t,e),e)),t}function yp(t,e,r){const n=r?Object.assign({scheme:"null"},r):{scheme:"null"},s=Hc(Ot(t,n),Ot(e,n),n,!0);return n.skipEscape=!0,St(s,n)}function Hc(t,e,r,n){const s={};return n||(t=Ot(St(t,r),r),e=Ot(St(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=Jr(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=Jr(e.path||""),s.query=e.query):(e.path?(e.path[0]==="/"?s.path=Jr(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=Jr(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 bp(t,e,r){return typeof t=="string"?(t=unescape(t),t=St(Kn(Ot(t,r),!0),{...r,skipEscape:!0})):typeof t=="object"&&(t=St(Kn(t,!0),{...r,skipEscape:!0})),typeof e=="string"?(e=unescape(e),e=St(Kn(Ot(e,r),!0),{...r,skipEscape:!0})):typeof e=="object"&&(e=St(Kn(e,!0),{...r,skipEscape:!0})),t.toLowerCase()===e.toLowerCase()}function St(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=[],o=Fc(n.scheme||r.scheme);o&&o.serialize&&o.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 i=pp(r);if(i!==void 0&&(n.reference!=="suffix"&&s.push("//"),s.push(i),r.path&&r.path[0]!=="/"&&s.push("/")),r.path!==void 0){let a=r.path;!n.absolutePath&&(!o||!o.absolutePath)&&(a=Jr(a)),i===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 wp=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;function Ot(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 o=t.match(wp);if(o){if(n.scheme=o[1],n.userinfo=o[3],n.host=o[4],n.port=parseInt(o[5],10),n.path=o[6]||"",n.query=o[7],n.fragment=o[8],isNaN(n.port)&&(n.port=o[5]),n.host)if(mp(n.host)===!1){const c=hp(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 i=Fc(r.scheme||n.scheme);if(!r.unicodeSupport&&(!i||!i.unicodeSupport)&&n.host&&(r.domainHost||i&&i.domainHost)&&s===!1&&_p(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}(!i||i&&!i.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)))),i&&i.parse&&i.parse(n,r)}else n.error=n.error||"URI can not be parsed.";return n}const ko={SCHEMES:gp,normalize:vp,resolve:yp,resolveComponent:Hc,equal:bp,serialize:St,parse:Ot};Wn.exports=ko,Wn.exports.default=ko,Wn.exports.fastUri=ko;var $p=Wn.exports;Object.defineProperty($o,"__esModule",{value:!0});const Wc=$p;Wc.code='require("ajv/dist/runtime/uri").default',$o.default=Wc,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=ot;Object.defineProperty(t,"KeywordCxt",{enumerable:!0,get:function(){return e.KeywordCxt}});var r=Q;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=Wr,s=wr,o=tr,i=Je,a=Q,c=Me,u=Oe,l=M,f=Jh,_=$o,y=(N,k)=>new RegExp(N,k);y.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"]),h={errorDataPath:"",format:"`validateFormats: false` can be used instead.",nullable:'"nullable" keyword is supported by default.',jsonPointers:"Deprecated jsPropertySyntax can be used instead.",extendRefs:"Deprecated ignoreKeywordsWithRef can be used instead.",missingRefs:"Pass empty schema with $id that should be ignored to ajv.addSchema.",processCode:"Use option `code: {process: (code, schemaEnv: object) => string}`",sourceCode:"Use option `code: {source: true}`",strictDefaults:"It is default now, see option `strict`.",strictKeywords:"It is default now, see option `strict`.",uniqueItems:'"uniqueItems" keyword is always validated.',unknownFormats:"Disable strict mode or pass `true` to `ajv.addFormat` (or `formats` option).",cache:"Map is used as cache, schema object as key.",serialize:"Map is used as cache, schema object as key.",ajvErrors:"It is default now."},d={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},m=200;function w(N){var k,R,E,p,b,x,F,H,fe,le,ze,Dr,Na,ja,Aa,za,Ma,Za,La,Ua,Da,qa,Va,Fa,Ha;const Un=N.strict,Wa=(k=N.code)===null||k===void 0?void 0:k.optimize,Xd=Wa===!0||Wa===void 0?1:Wa||0,Qd=(E=(R=N.code)===null||R===void 0?void 0:R.regExp)!==null&&E!==void 0?E:y,U1=(p=N.uriResolver)!==null&&p!==void 0?p:_.default;return{strictSchema:(x=(b=N.strictSchema)!==null&&b!==void 0?b:Un)!==null&&x!==void 0?x:!0,strictNumbers:(H=(F=N.strictNumbers)!==null&&F!==void 0?F:Un)!==null&&H!==void 0?H:!0,strictTypes:(le=(fe=N.strictTypes)!==null&&fe!==void 0?fe:Un)!==null&&le!==void 0?le:"log",strictTuples:(Dr=(ze=N.strictTuples)!==null&&ze!==void 0?ze:Un)!==null&&Dr!==void 0?Dr:"log",strictRequired:(ja=(Na=N.strictRequired)!==null&&Na!==void 0?Na:Un)!==null&&ja!==void 0?ja:!1,code:N.code?{...N.code,optimize:Xd,regExp:Qd}:{optimize:Xd,regExp:Qd},loopRequired:(Aa=N.loopRequired)!==null&&Aa!==void 0?Aa:m,loopEnum:(za=N.loopEnum)!==null&&za!==void 0?za:m,meta:(Ma=N.meta)!==null&&Ma!==void 0?Ma:!0,messages:(Za=N.messages)!==null&&Za!==void 0?Za:!0,inlineRefs:(La=N.inlineRefs)!==null&&La!==void 0?La:!0,schemaId:(Ua=N.schemaId)!==null&&Ua!==void 0?Ua:"$id",addUsedSchema:(Da=N.addUsedSchema)!==null&&Da!==void 0?Da:!0,validateSchema:(qa=N.validateSchema)!==null&&qa!==void 0?qa:!0,validateFormats:(Va=N.validateFormats)!==null&&Va!==void 0?Va:!0,unicodeRegExp:(Fa=N.unicodeRegExp)!==null&&Fa!==void 0?Fa:!0,int32range:(Ha=N.int32range)!==null&&Ha!==void 0?Ha:!0,uriResolver:U1}}class S{constructor(k={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,k=this.opts={...k,...w(k)};const{es5:R,lines:E}=this.opts.code;this.scope=new a.ValueScope({scope:{},prefixes:v,es5:R,lines:E}),this.logger=K(k.logger);const p=k.validateFormats;k.validateFormats=!1,this.RULES=(0,o.getRules)(),P.call(this,h,k,"NOT SUPPORTED"),P.call(this,d,k,"DEPRECATED","warn"),this._metaOpts=Ae.call(this),k.formats&&ce.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),k.keywords&&G.call(this,k.keywords),typeof k.meta=="object"&&this.addMetaSchema(k.meta),V.call(this),k.validateFormats=p}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){const{$data:k,meta:R,schemaId:E}=this.opts;let p=f;E==="id"&&(p={...f},p.id=p.$id,delete p.$id),R&&k&&this.addMetaSchema(p,p[E],!1)}defaultMeta(){const{meta:k,schemaId:R}=this.opts;return this.opts.defaultMeta=typeof k=="object"?k[R]||k:void 0}validate(k,R){let E;if(typeof k=="string"){if(E=this.getSchema(k),!E)throw new Error(`no schema with key or ref "${k}"`)}else E=this.compile(k);const p=E(R);return"$async"in E||(this.errors=E.errors),p}compile(k,R){const E=this._addSchema(k,R);return E.validate||this._compileSchemaEnv(E)}compileAsync(k,R){if(typeof this.opts.loadSchema!="function")throw new Error("options.loadSchema should be a function");const{loadSchema:E}=this.opts;return p.call(this,k,R);async function p(le,ze){await b.call(this,le.$schema);const Dr=this._addSchema(le,ze);return Dr.validate||x.call(this,Dr)}async function b(le){le&&!this.getSchema(le)&&await p.call(this,{$ref:le},!0)}async function x(le){try{return this._compileSchemaEnv(le)}catch(ze){if(!(ze instanceof s.default))throw ze;return F.call(this,ze),await H.call(this,ze.missingSchema),x.call(this,le)}}function F({missingSchema:le,missingRef:ze}){if(this.refs[le])throw new Error(`AnySchema ${le} is loaded but ${ze} cannot be resolved`)}async function H(le){const ze=await fe.call(this,le);this.refs[le]||await b.call(this,ze.$schema),this.refs[le]||this.addSchema(ze,le,R)}async function fe(le){const ze=this._loading[le];if(ze)return ze;try{return await(this._loading[le]=E(le))}finally{delete this._loading[le]}}}addSchema(k,R,E,p=this.opts.validateSchema){if(Array.isArray(k)){for(const x of k)this.addSchema(x,void 0,E,p);return this}let b;if(typeof k=="object"){const{schemaId:x}=this.opts;if(b=k[x],b!==void 0&&typeof b!="string")throw new Error(`schema ${x} must be string`)}return R=(0,c.normalizeId)(R||b),this._checkUnique(R),this.schemas[R]=this._addSchema(k,E,R,p,!0),this}addMetaSchema(k,R,E=this.opts.validateSchema){return this.addSchema(k,R,!0,E),this}validateSchema(k,R){if(typeof k=="boolean")return!0;let E;if(E=k.$schema,E!==void 0&&typeof E!="string")throw new Error("$schema must be a string");if(E=E||this.opts.defaultMeta||this.defaultMeta(),!E)return this.logger.warn("meta-schema not available"),this.errors=null,!0;const p=this.validate(E,k);if(!p&&R){const b="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(b);else throw new Error(b)}return p}getSchema(k){let R;for(;typeof(R=O.call(this,k))=="string";)k=R;if(R===void 0){const{schemaId:E}=this.opts,p=new i.SchemaEnv({schema:{},schemaId:E});if(R=i.resolveSchema.call(this,p,k),!R)return;this.refs[k]=R}return R.validate||this._compileSchemaEnv(R)}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 R=O.call(this,k);return typeof R=="object"&&this._cache.delete(R.schema),delete this.schemas[k],delete this.refs[k],this}case"object":{const R=k;this._cache.delete(R);let E=k[this.opts.schemaId];return E&&(E=(0,c.normalizeId)(E),delete this.schemas[E],delete this.refs[E]),this}default:throw new Error("ajv.removeSchema: invalid parameter")}}addVocabulary(k){for(const R of k)this.addKeyword(R);return this}addKeyword(k,R){let E;if(typeof k=="string")E=k,typeof R=="object"&&(this.logger.warn("these parameters are deprecated, see docs for addKeyword"),R.keyword=E);else if(typeof k=="object"&&R===void 0){if(R=k,E=R.keyword,Array.isArray(E)&&!E.length)throw new Error("addKeywords: keyword must be string or non-empty array")}else throw new Error("invalid addKeywords parameters");if(se.call(this,E,R),!R)return(0,l.eachItem)(E,b=>De.call(this,b)),this;Lt.call(this,R);const p={...R,type:(0,u.getJSONTypes)(R.type),schemaType:(0,u.getJSONTypes)(R.schemaType)};return(0,l.eachItem)(E,p.type.length===0?b=>De.call(this,b,p):b=>p.type.forEach(x=>De.call(this,b,p,x))),this}getKeyword(k){const R=this.RULES.all[k];return typeof R=="object"?R.definition:!!R}removeKeyword(k){const{RULES:R}=this;delete R.keywords[k],delete R.all[k];for(const E of R.rules){const p=E.rules.findIndex(b=>b.keyword===k);p>=0&&E.rules.splice(p,1)}return this}addFormat(k,R){return typeof R=="string"&&(R=new RegExp(R)),this.formats[k]=R,this}errorsText(k=this.errors,{separator:R=", ",dataVar:E="data"}={}){return!k||k.length===0?"No errors":k.map(p=>`${E}${p.instancePath} ${p.message}`).reduce((p,b)=>p+R+b)}$dataMetaSchema(k,R){const E=this.RULES.all;k=JSON.parse(JSON.stringify(k));for(const p of R){const b=p.split("/").slice(1);let x=k;for(const F of b)x=x[F];for(const F in E){const H=E[F];if(typeof H!="object")continue;const{$data:fe}=H.definition,le=x[F];fe&&le&&(x[F]=mr(le))}}return k}_removeAllSchemas(k,R){for(const E in k){const p=k[E];(!R||R.test(E))&&(typeof p=="string"?delete k[E]:p&&!p.meta&&(this._cache.delete(p.schema),delete k[E]))}}_addSchema(k,R,E,p=this.opts.validateSchema,b=this.opts.addUsedSchema){let x;const{schemaId:F}=this.opts;if(typeof k=="object")x=k[F];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 H=this._cache.get(k);if(H!==void 0)return H;E=(0,c.normalizeId)(x||E);const fe=c.getSchemaRefs.call(this,k,E);return H=new i.SchemaEnv({schema:k,schemaId:F,meta:R,baseId:E,localRefs:fe}),this._cache.set(H.schema,H),b&&!E.startsWith("#")&&(E&&this._checkUnique(E),this.refs[E]=H),p&&this.validateSchema(k,!0),H}_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):i.compileSchema.call(this,k),!k.validate)throw new Error("ajv implementation error");return k.validate}_compileMetaSchema(k){const R=this.opts;this.opts=this._metaOpts;try{i.compileSchema.call(this,k)}finally{this.opts=R}}}S.ValidationError=n.default,S.MissingRefError=s.default,t.default=S;function P(N,k,R,E="error"){for(const p in N){const b=p;b in k&&this.logger[E](`${R}: option ${p}. ${N[b]}`)}}function O(N){return N=(0,c.normalizeId)(N),this.schemas[N]||this.refs[N]}function V(){const N=this.opts.schemas;if(N)if(Array.isArray(N))this.addSchema(N);else for(const k in N)this.addSchema(N[k],k)}function ce(){for(const N in this.opts.formats){const k=this.opts.formats[N];k&&this.addFormat(N,k)}}function G(N){if(Array.isArray(N)){this.addVocabulary(N);return}this.logger.warn("keywords option as map is deprecated, pass array");for(const k in N){const R=N[k];R.keyword||(R.keyword=k),this.addKeyword(R)}}function Ae(){const N={...this.opts};for(const k of g)delete N[k];return N}const U={log(){},warn(){},error(){}};function K(N){if(N===!1)return U;if(N===void 0)return console;if(N.log&&N.warn&&N.error)return N;throw new Error("logger must implement log, warn and error methods")}const Se=/^[a-z_$][a-z0-9_$:-]*$/i;function se(N,k){const{RULES:R}=this;if((0,l.eachItem)(N,E=>{if(R.keywords[E])throw new Error(`Keyword ${E} is already defined`);if(!Se.test(E))throw new Error(`Keyword ${E} has invalid name`)}),!!k&&k.$data&&!("code"in k||"validate"in k))throw new Error('$data keyword must have "code" or "validate" function')}function De(N,k,R){var E;const p=k==null?void 0:k.post;if(R&&p)throw new Error('keyword with "post" flag cannot have "type"');const{RULES:b}=this;let x=p?b.post:b.rules.find(({type:H})=>H===R);if(x||(x={type:R,rules:[]},b.rules.push(x)),b.keywords[N]=!0,!k)return;const F={keyword:N,definition:{...k,type:(0,u.getJSONTypes)(k.type),schemaType:(0,u.getJSONTypes)(k.schemaType)}};k.before?Zt.call(this,x,F,k.before):x.rules.push(F),b.all[N]=F,(E=k.implements)===null||E===void 0||E.forEach(H=>this.addKeyword(H))}function Zt(N,k,R){const E=N.rules.findIndex(p=>p.keyword===R);E>=0?N.rules.splice(E,0,k):(N.rules.push(k),this.logger.warn(`rule ${R} is not defined`))}function Lt(N){let{metaSchema:k}=N;k!==void 0&&(N.$data&&this.opts.$data&&(k=mr(k)),N.validateSchema=this.compile(k,!0))}const Ln={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function mr(N){return{anyOf:[N,Ln]}}}(Ja);var Eo={},Po={},To={};Object.defineProperty(To,"__esModule",{value:!0});const Sp={keyword:"id",code(){throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};To.default=Sp;var sr={};Object.defineProperty(sr,"__esModule",{value:!0}),sr.callRef=sr.getValidate=void 0;const kp=wr,Jc=te,Be=Q,$r=bt,Bc=Je,Gn=M,Ep={keyword:"$ref",schemaType:"string",code(t){const{gen:e,schema:r,it:n}=t,{baseId:s,schemaEnv:o,validateName:i,opts:a,self:c}=n,{root:u}=o;if((r==="#"||r==="#/")&&s===u.baseId)return f();const l=Bc.resolveRef.call(c,u,s,r);if(l===void 0)throw new kp.default(n.opts.uriResolver,s,r);if(l instanceof Bc.SchemaEnv)return _(l);return y(l);function f(){if(o===u)return Yn(t,i,o,o.$async);const g=e.scopeValue("root",{ref:u});return Yn(t,(0,Be._)`${g}.validate`,u,u.$async)}function _(g){const v=Kc(t,g);Yn(t,v,g,g.$async)}function y(g){const v=e.scopeValue("schema",a.code.source===!0?{ref:g,code:(0,Be.stringify)(g)}:{ref:g}),h=e.name("valid"),d=t.subschema({schema:g,dataTypes:[],schemaPath:Be.nil,topSchemaRef:v,errSchemaPath:r},h);t.mergeEvaluated(d),t.ok(h)}}};function Kc(t,e){const{gen:r}=t;return e.validate?r.scopeValue("validate",{ref:e.validate}):(0,Be._)`${r.scopeValue("wrapper",{ref:e})}.validate`}sr.getValidate=Kc;function Yn(t,e,r,n){const{gen:s,it:o}=t,{allErrors:i,schemaEnv:a,opts:c}=o,u=c.passContext?$r.default.this:Be.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,Be._)`await ${(0,Jc.callValidateCode)(t,e,u)}`),y(e),i||s.assign(g,!0)},v=>{s.if((0,Be._)`!(${v} instanceof ${o.ValidationError})`,()=>s.throw(v)),_(v),i||s.assign(g,!1)}),t.ok(g)}function f(){t.result((0,Jc.callValidateCode)(t,e,u),()=>y(e),()=>_(e))}function _(g){const v=(0,Be._)`${g}.errors`;s.assign($r.default.vErrors,(0,Be._)`${$r.default.vErrors} === null ? ${v} : ${$r.default.vErrors}.concat(${v})`),s.assign($r.default.errors,(0,Be._)`${$r.default.vErrors}.length`)}function y(g){var v;if(!o.opts.unevaluated)return;const h=(v=r==null?void 0:r.validate)===null||v===void 0?void 0:v.evaluated;if(o.props!==!0)if(h&&!h.dynamicProps)h.props!==void 0&&(o.props=Gn.mergeEvaluated.props(s,h.props,o.props));else{const d=s.var("props",(0,Be._)`${g}.evaluated.props`);o.props=Gn.mergeEvaluated.props(s,d,o.props,Be.Name)}if(o.items!==!0)if(h&&!h.dynamicItems)h.items!==void 0&&(o.items=Gn.mergeEvaluated.items(s,h.items,o.items));else{const d=s.var("items",(0,Be._)`${g}.evaluated.items`);o.items=Gn.mergeEvaluated.items(s,d,o.items,Be.Name)}}}sr.callRef=Yn,sr.default=Ep,Object.defineProperty(Po,"__esModule",{value:!0});const Pp=To,Tp=sr,xp=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",Pp.default,Tp.default];Po.default=xp;var xo={},Ro={};Object.defineProperty(Ro,"__esModule",{value:!0});const Xn=Q,Vt=Xn.operators,Qn={maximum:{okStr:"<=",ok:Vt.LTE,fail:Vt.GT},minimum:{okStr:">=",ok:Vt.GTE,fail:Vt.LT},exclusiveMaximum:{okStr:"<",ok:Vt.LT,fail:Vt.GTE},exclusiveMinimum:{okStr:">",ok:Vt.GT,fail:Vt.LTE}},Rp={message:({keyword:t,schemaCode:e})=>(0,Xn.str)`must be ${Qn[t].okStr} ${e}`,params:({keyword:t,schemaCode:e})=>(0,Xn._)`{comparison: ${Qn[t].okStr}, limit: ${e}}`},Ip={keyword:Object.keys(Qn),type:"number",schemaType:"number",$data:!0,error:Rp,code(t){const{keyword:e,data:r,schemaCode:n}=t;t.fail$data((0,Xn._)`${r} ${Qn[e].fail} ${n} || isNaN(${r})`)}};Ro.default=Ip;var Io={};Object.defineProperty(Io,"__esModule",{value:!0});const Br=Q,Cp={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:{message:({schemaCode:t})=>(0,Br.str)`must be multiple of ${t}`,params:({schemaCode:t})=>(0,Br._)`{multipleOf: ${t}}`},code(t){const{gen:e,data:r,schemaCode:n,it:s}=t,o=s.opts.multipleOfPrecision,i=e.let("res"),a=o?(0,Br._)`Math.abs(Math.round(${i}) - ${i}) > 1e-${o}`:(0,Br._)`${i} !== parseInt(${i})`;t.fail$data((0,Br._)`(${n} === 0 || (${i} = ${r}/${n}, ${a}))`)}};Io.default=Cp;var Co={},Oo={};Object.defineProperty(Oo,"__esModule",{value:!0});function Gc(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}Oo.default=Gc,Gc.code='require("ajv/dist/runtime/ucs2length").default',Object.defineProperty(Co,"__esModule",{value:!0});const or=Q,Op=M,Np=Oo,jp={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:{message({keyword:t,schemaCode:e}){const r=t==="maxLength"?"more":"fewer";return(0,or.str)`must NOT have ${r} than ${e} characters`},params:({schemaCode:t})=>(0,or._)`{limit: ${t}}`},code(t){const{keyword:e,data:r,schemaCode:n,it:s}=t,o=e==="maxLength"?or.operators.GT:or.operators.LT,i=s.opts.unicode===!1?(0,or._)`${r}.length`:(0,or._)`${(0,Op.useFunc)(t.gen,Np.default)}(${r})`;t.fail$data((0,or._)`${i} ${o} ${n}`)}};Co.default=jp;var No={};Object.defineProperty(No,"__esModule",{value:!0});const Ap=te,es=Q,zp={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:{message:({schemaCode:t})=>(0,es.str)`must match pattern "${t}"`,params:({schemaCode:t})=>(0,es._)`{pattern: ${t}}`},code(t){const{data:e,$data:r,schema:n,schemaCode:s,it:o}=t,i=o.opts.unicodeRegExp?"u":"",a=r?(0,es._)`(new RegExp(${s}, ${i}))`:(0,Ap.usePattern)(t,n);t.fail$data((0,es._)`!${a}.test(${e})`)}};No.default=zp;var jo={};Object.defineProperty(jo,"__esModule",{value:!0});const Kr=Q,Mp={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:{message({keyword:t,schemaCode:e}){const r=t==="maxProperties"?"more":"fewer";return(0,Kr.str)`must NOT have ${r} than ${e} properties`},params:({schemaCode:t})=>(0,Kr._)`{limit: ${t}}`},code(t){const{keyword:e,data:r,schemaCode:n}=t,s=e==="maxProperties"?Kr.operators.GT:Kr.operators.LT;t.fail$data((0,Kr._)`Object.keys(${r}).length ${s} ${n}`)}};jo.default=Mp;var Ao={};Object.defineProperty(Ao,"__esModule",{value:!0});const Gr=te,Yr=Q,Zp=M,Lp={keyword:"required",type:"object",schemaType:"array",$data:!0,error:{message:({params:{missingProperty:t}})=>(0,Yr.str)`must have required property '${t}'`,params:({params:{missingProperty:t}})=>(0,Yr._)`{missingProperty: ${t}}`},code(t){const{gen:e,schema:r,schemaCode:n,data:s,$data:o,it:i}=t,{opts:a}=i;if(!o&&r.length===0)return;const c=r.length>=a.loopRequired;if(i.allErrors?u():l(),a.strictRequired){const y=t.parentSchema.properties,{definedProperties:g}=t.it;for(const v of r)if((y==null?void 0:y[v])===void 0&&!g.has(v)){const h=i.schemaEnv.baseId+i.errSchemaPath,d=`required property "${v}" is not defined at "${h}" (strictRequired)`;(0,Zp.checkStrictMode)(i,d,i.opts.strictRequired)}}function u(){if(c||o)t.block$data(Yr.nil,f);else for(const y of r)(0,Gr.checkReportMissingProp)(t,y)}function l(){const y=e.let("missing");if(c||o){const g=e.let("valid",!0);t.block$data(g,()=>_(y,g)),t.ok(g)}else e.if((0,Gr.checkMissingProp)(t,r,y)),(0,Gr.reportMissingProp)(t,y),e.else()}function f(){e.forOf("prop",n,y=>{t.setParams({missingProperty:y}),e.if((0,Gr.noPropertyInData)(e,s,y,a.ownProperties),()=>t.error())})}function _(y,g){t.setParams({missingProperty:y}),e.forOf(y,n,()=>{e.assign(g,(0,Gr.propertyInData)(e,s,y,a.ownProperties)),e.if((0,Yr.not)(g),()=>{t.error(),e.break()})},Yr.nil)}}};Ao.default=Lp;var zo={};Object.defineProperty(zo,"__esModule",{value:!0});const Xr=Q,Up={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:{message({keyword:t,schemaCode:e}){const r=t==="maxItems"?"more":"fewer";return(0,Xr.str)`must NOT have ${r} than ${e} items`},params:({schemaCode:t})=>(0,Xr._)`{limit: ${t}}`},code(t){const{keyword:e,data:r,schemaCode:n}=t,s=e==="maxItems"?Xr.operators.GT:Xr.operators.LT;t.fail$data((0,Xr._)`${r}.length ${s} ${n}`)}};zo.default=Up;var Mo={},Qr={};Object.defineProperty(Qr,"__esModule",{value:!0});const Yc=hc;Yc.code='require("ajv/dist/runtime/equal").default',Qr.default=Yc,Object.defineProperty(Mo,"__esModule",{value:!0});const Zo=Oe,Ze=Q,Dp=M,qp=Qr,Vp={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:{message:({params:{i:t,j:e}})=>(0,Ze.str)`must NOT have duplicate items (items ## ${e} and ${t} are identical)`,params:({params:{i:t,j:e}})=>(0,Ze._)`{i: ${t}, j: ${e}}`},code(t){const{gen:e,data:r,$data:n,schema:s,parentSchema:o,schemaCode:i,it:a}=t;if(!n&&!s)return;const c=e.let("valid"),u=o.items?(0,Zo.getSchemaTypes)(o.items):[];t.block$data(c,l,(0,Ze._)`${i} === false`),t.ok(c);function l(){const g=e.let("i",(0,Ze._)`${r}.length`),v=e.let("j");t.setParams({i:g,j:v}),e.assign(c,!0),e.if((0,Ze._)`${g} > 1`,()=>(f()?_:y)(g,v))}function f(){return u.length>0&&!u.some(g=>g==="object"||g==="array")}function _(g,v){const h=e.name("item"),d=(0,Zo.checkDataTypes)(u,h,a.opts.strictNumbers,Zo.DataType.Wrong),m=e.const("indices",(0,Ze._)`{}`);e.for((0,Ze._)`;${g}--;`,()=>{e.let(h,(0,Ze._)`${r}[${g}]`),e.if(d,(0,Ze._)`continue`),u.length>1&&e.if((0,Ze._)`typeof ${h} == "string"`,(0,Ze._)`${h} += "_"`),e.if((0,Ze._)`typeof ${m}[${h}] == "number"`,()=>{e.assign(v,(0,Ze._)`${m}[${h}]`),t.error(),e.assign(c,!1).break()}).code((0,Ze._)`${m}[${h}] = ${g}`)})}function y(g,v){const h=(0,Dp.useFunc)(e,qp.default),d=e.name("outer");e.label(d).for((0,Ze._)`;${g}--;`,()=>e.for((0,Ze._)`${v} = ${g}; ${v}--;`,()=>e.if((0,Ze._)`${h}(${r}[${g}], ${r}[${v}])`,()=>{t.error(),e.assign(c,!1).break(d)})))}}};Mo.default=Vp;var Lo={};Object.defineProperty(Lo,"__esModule",{value:!0});const Uo=Q,Fp=M,Hp=Qr,Wp={keyword:"const",$data:!0,error:{message:"must be equal to constant",params:({schemaCode:t})=>(0,Uo._)`{allowedValue: ${t}}`},code(t){const{gen:e,data:r,$data:n,schemaCode:s,schema:o}=t;n||o&&typeof o=="object"?t.fail$data((0,Uo._)`!${(0,Fp.useFunc)(e,Hp.default)}(${r}, ${s})`):t.fail((0,Uo._)`${o} !== ${r}`)}};Lo.default=Wp;var Do={};Object.defineProperty(Do,"__esModule",{value:!0});const en=Q,Jp=M,Bp=Qr,Kp={keyword:"enum",schemaType:"array",$data:!0,error:{message:"must be equal to one of the allowed values",params:({schemaCode:t})=>(0,en._)`{allowedValues: ${t}}`},code(t){const{gen:e,data:r,$data:n,schema:s,schemaCode:o,it:i}=t;if(!n&&s.length===0)throw new Error("enum must have non-empty array");const a=s.length>=i.opts.loopEnum;let c;const u=()=>c??(c=(0,Jp.useFunc)(e,Bp.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 y=e.const("vSchema",o);l=(0,en.or)(...s.map((g,v)=>_(y,v)))}t.pass(l);function f(){e.assign(l,!1),e.forOf("v",o,y=>e.if((0,en._)`${u()}(${r}, ${y})`,()=>e.assign(l,!0).break()))}function _(y,g){const v=s[g];return typeof v=="object"&&v!==null?(0,en._)`${u()}(${r}, ${y}[${g}])`:(0,en._)`${r} === ${v}`}}};Do.default=Kp,Object.defineProperty(xo,"__esModule",{value:!0});const Gp=Ro,Yp=Io,Xp=Co,Qp=No,em=jo,tm=Ao,rm=zo,nm=Mo,sm=Lo,om=Do,im=[Gp.default,Yp.default,Xp.default,Qp.default,em.default,tm.default,rm.default,nm.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},sm.default,om.default];xo.default=im;var qo={},Sr={};Object.defineProperty(Sr,"__esModule",{value:!0}),Sr.validateAdditionalItems=void 0;const ir=Q,Vo=M,am={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:{message:({params:{len:t}})=>(0,ir.str)`must NOT have more than ${t} items`,params:({params:{len:t}})=>(0,ir._)`{limit: ${t}}`},code(t){const{parentSchema:e,it:r}=t,{items:n}=e;if(!Array.isArray(n)){(0,Vo.checkStrictMode)(r,'"additionalItems" is ignored when "items" is not an array of schemas');return}Xc(t,n)}};function Xc(t,e){const{gen:r,schema:n,data:s,keyword:o,it:i}=t;i.items=!0;const a=r.const("len",(0,ir._)`${s}.length`);if(n===!1)t.setParams({len:e.length}),t.pass((0,ir._)`${a} <= ${e.length}`);else if(typeof n=="object"&&!(0,Vo.alwaysValidSchema)(i,n)){const u=r.var("valid",(0,ir._)`${a} <= ${e.length}`);r.if((0,ir.not)(u),()=>c(u)),t.ok(u)}function c(u){r.forRange("i",e.length,a,l=>{t.subschema({keyword:o,dataProp:l,dataPropType:Vo.Type.Num},u),i.allErrors||r.if((0,ir.not)(u),()=>r.break())})}}Sr.validateAdditionalItems=Xc,Sr.default=am;var Fo={},kr={};Object.defineProperty(kr,"__esModule",{value:!0}),kr.validateTuple=void 0;const Qc=Q,ts=M,cm=te,um={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(t){const{schema:e,it:r}=t;if(Array.isArray(e))return eu(t,"additionalItems",e);r.items=!0,!(0,ts.alwaysValidSchema)(r,e)&&t.ok((0,cm.validateArray)(t))}};function eu(t,e,r=t.schema){const{gen:n,parentSchema:s,data:o,keyword:i,it:a}=t;l(s),a.opts.unevaluated&&r.length&&a.items!==!0&&(a.items=ts.mergeEvaluated.items(n,r.length,a.items));const c=n.name("valid"),u=n.const("len",(0,Qc._)`${o}.length`);r.forEach((f,_)=>{(0,ts.alwaysValidSchema)(a,f)||(n.if((0,Qc._)`${u} > ${_}`,()=>t.subschema({keyword:i,schemaProp:_,dataProp:_},c)),t.ok(c))});function l(f){const{opts:_,errSchemaPath:y}=a,g=r.length,v=g===f.minItems&&(g===f.maxItems||f[e]===!1);if(_.strictTuples&&!v){const h=`"${i}" is ${g}-tuple, but minItems or maxItems/${e} are not specified or different at path "${y}"`;(0,ts.checkStrictMode)(a,h,_.strictTuples)}}}kr.validateTuple=eu,kr.default=um,Object.defineProperty(Fo,"__esModule",{value:!0});const lm=kr,dm={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:t=>(0,lm.validateTuple)(t,"items")};Fo.default=dm;var Ho={};Object.defineProperty(Ho,"__esModule",{value:!0});const tu=Q,fm=M,hm=te,pm=Sr,mm={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:{message:({params:{len:t}})=>(0,tu.str)`must NOT have more than ${t} items`,params:({params:{len:t}})=>(0,tu._)`{limit: ${t}}`},code(t){const{schema:e,parentSchema:r,it:n}=t,{prefixItems:s}=r;n.items=!0,!(0,fm.alwaysValidSchema)(n,e)&&(s?(0,pm.validateAdditionalItems)(t,s):t.ok((0,hm.validateArray)(t)))}};Ho.default=mm;var Wo={};Object.defineProperty(Wo,"__esModule",{value:!0});const rt=Q,rs=M,_m={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:{message:({params:{min:t,max:e}})=>e===void 0?(0,rt.str)`must contain at least ${t} valid item(s)`:(0,rt.str)`must contain at least ${t} and no more than ${e} valid item(s)`,params:({params:{min:t,max:e}})=>e===void 0?(0,rt._)`{minContains: ${t}}`:(0,rt._)`{minContains: ${t}, maxContains: ${e}}`},code(t){const{gen:e,schema:r,parentSchema:n,data:s,it:o}=t;let i,a;const{minContains:c,maxContains:u}=n;o.opts.next?(i=c===void 0?1:c,a=u):i=1;const l=e.const("len",(0,rt._)`${s}.length`);if(t.setParams({min:i,max:a}),a===void 0&&i===0){(0,rs.checkStrictMode)(o,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(a!==void 0&&i>a){(0,rs.checkStrictMode)(o,'"minContains" > "maxContains" is always invalid'),t.fail();return}if((0,rs.alwaysValidSchema)(o,r)){let v=(0,rt._)`${l} >= ${i}`;a!==void 0&&(v=(0,rt._)`${v} && ${l} <= ${a}`),t.pass(v);return}o.items=!0;const f=e.name("valid");a===void 0&&i===1?y(f,()=>e.if(f,()=>e.break())):i===0?(e.let(f,!0),a!==void 0&&e.if((0,rt._)`${s}.length > 0`,_)):(e.let(f,!1),_()),t.result(f,()=>t.reset());function _(){const v=e.name("_valid"),h=e.let("count",0);y(v,()=>e.if(v,()=>g(h)))}function y(v,h){e.forRange("i",0,l,d=>{t.subschema({keyword:"contains",dataProp:d,dataPropType:rs.Type.Num,compositeRule:!0},v),h()})}function g(v){e.code((0,rt._)`${v}++`),a===void 0?e.if((0,rt._)`${v} >= ${i}`,()=>e.assign(f,!0).break()):(e.if((0,rt._)`${v} > ${a}`,()=>e.assign(f,!1).break()),i===1?e.assign(f,!0):e.if((0,rt._)`${v} >= ${i}`,()=>e.assign(f,!0)))}}};Wo.default=_m;var ru={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.validateSchemaDeps=t.validatePropertyDeps=t.error=void 0;const e=Q,r=M,n=te;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]=o(c);i(c,u),a(c,l)}};function o({schema:c}){const u={},l={};for(const f in c){if(f==="__proto__")continue;const _=Array.isArray(c[f])?u:l;_[f]=c[f]}return[u,l]}function i(c,u=c.schema){const{gen:l,data:f,it:_}=c;if(Object.keys(u).length===0)return;const y=l.let("missing");for(const g in u){const v=u[g];if(v.length===0)continue;const h=(0,n.propertyInData)(l,f,g,_.opts.ownProperties);c.setParams({property:g,depsCount:v.length,deps:v.join(", ")}),_.allErrors?l.if(h,()=>{for(const d of v)(0,n.checkReportMissingProp)(c,d)}):(l.if((0,e._)`${h} && (${(0,n.checkMissingProp)(c,v,y)})`),(0,n.reportMissingProp)(c,y),l.else())}}t.validatePropertyDeps=i;function a(c,u=c.schema){const{gen:l,data:f,keyword:_,it:y}=c,g=l.name("valid");for(const v in u)(0,r.alwaysValidSchema)(y,u[v])||(l.if((0,n.propertyInData)(l,f,v,y.opts.ownProperties),()=>{const h=c.subschema({keyword:_,schemaProp:v},g);c.mergeValidEvaluated(h,g)},()=>l.var(g,!0)),c.ok(g))}t.validateSchemaDeps=a,t.default=s})(ru);var Jo={};Object.defineProperty(Jo,"__esModule",{value:!0});const nu=Q,gm=M,vm={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:{message:"property name must be valid",params:({params:t})=>(0,nu._)`{propertyName: ${t.propertyName}}`},code(t){const{gen:e,schema:r,data:n,it:s}=t;if((0,gm.alwaysValidSchema)(s,r))return;const o=e.name("valid");e.forIn("key",n,i=>{t.setParams({propertyName:i}),t.subschema({keyword:"propertyNames",data:i,dataTypes:["string"],propertyName:i,compositeRule:!0},o),e.if((0,nu.not)(o),()=>{t.error(!0),s.allErrors||e.break()})}),t.ok(o)}};Jo.default=vm;var ns={};Object.defineProperty(ns,"__esModule",{value:!0});const ss=te,ct=Q,ym=bt,os=M,bm={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:{message:"must NOT have additional properties",params:({params:t})=>(0,ct._)`{additionalProperty: ${t.additionalProperty}}`},code(t){const{gen:e,schema:r,parentSchema:n,data:s,errsCount:o,it:i}=t;if(!o)throw new Error("ajv implementation error");const{allErrors:a,opts:c}=i;if(i.props=!0,c.removeAdditional!=="all"&&(0,os.alwaysValidSchema)(i,r))return;const u=(0,ss.allSchemaProperties)(n.properties),l=(0,ss.allSchemaProperties)(n.patternProperties);f(),t.ok((0,ct._)`${o} === ${ym.default.errors}`);function f(){e.forIn("key",s,h=>{!u.length&&!l.length?g(h):e.if(_(h),()=>g(h))})}function _(h){let d;if(u.length>8){const m=(0,os.schemaRefOrVal)(i,n.properties,"properties");d=(0,ss.isOwnProperty)(e,m,h)}else u.length?d=(0,ct.or)(...u.map(m=>(0,ct._)`${h} === ${m}`)):d=ct.nil;return l.length&&(d=(0,ct.or)(d,...l.map(m=>(0,ct._)`${(0,ss.usePattern)(t,m)}.test(${h})`))),(0,ct.not)(d)}function y(h){e.code((0,ct._)`delete ${s}[${h}]`)}function g(h){if(c.removeAdditional==="all"||c.removeAdditional&&r===!1){y(h);return}if(r===!1){t.setParams({additionalProperty:h}),t.error(),a||e.break();return}if(typeof r=="object"&&!(0,os.alwaysValidSchema)(i,r)){const d=e.name("valid");c.removeAdditional==="failing"?(v(h,d,!1),e.if((0,ct.not)(d),()=>{t.reset(),y(h)})):(v(h,d),a||e.if((0,ct.not)(d),()=>e.break()))}}function v(h,d,m){const w={keyword:"additionalProperties",dataProp:h,dataPropType:os.Type.Str};m===!1&&Object.assign(w,{compositeRule:!0,createErrors:!1,allErrors:!1}),t.subschema(w,d)}}};ns.default=bm;var Bo={};Object.defineProperty(Bo,"__esModule",{value:!0});const wm=ot,su=te,Ko=M,ou=ns,$m={keyword:"properties",type:"object",schemaType:"object",code(t){const{gen:e,schema:r,parentSchema:n,data:s,it:o}=t;o.opts.removeAdditional==="all"&&n.additionalProperties===void 0&&ou.default.code(new wm.KeywordCxt(o,ou.default,"additionalProperties"));const i=(0,su.allSchemaProperties)(r);for(const f of i)o.definedProperties.add(f);o.opts.unevaluated&&i.length&&o.props!==!0&&(o.props=Ko.mergeEvaluated.props(e,(0,Ko.toHash)(i),o.props));const a=i.filter(f=>!(0,Ko.alwaysValidSchema)(o,r[f]));if(a.length===0)return;const c=e.name("valid");for(const f of a)u(f)?l(f):(e.if((0,su.propertyInData)(e,s,f,o.opts.ownProperties)),l(f),o.allErrors||e.else().var(c,!0),e.endIf()),t.it.definedProperties.add(f),t.ok(c);function u(f){return o.opts.useDefaults&&!o.compositeRule&&r[f].default!==void 0}function l(f){t.subschema({keyword:"properties",schemaProp:f,dataProp:f},c)}}};Bo.default=$m;var Go={};Object.defineProperty(Go,"__esModule",{value:!0});const iu=te,is=Q,au=M,cu=M,Sm={keyword:"patternProperties",type:"object",schemaType:"object",code(t){const{gen:e,schema:r,data:n,parentSchema:s,it:o}=t,{opts:i}=o,a=(0,iu.allSchemaProperties)(r),c=a.filter(v=>(0,au.alwaysValidSchema)(o,r[v]));if(a.length===0||c.length===a.length&&(!o.opts.unevaluated||o.props===!0))return;const u=i.strictSchema&&!i.allowMatchingProperties&&s.properties,l=e.name("valid");o.props!==!0&&!(o.props instanceof is.Name)&&(o.props=(0,cu.evaluatedPropsToName)(e,o.props));const{props:f}=o;_();function _(){for(const v of a)u&&y(v),o.allErrors?g(v):(e.var(l,!0),g(v),e.if(l))}function y(v){for(const h in u)new RegExp(v).test(h)&&(0,au.checkStrictMode)(o,`property ${h} matches pattern ${v} (use allowMatchingProperties)`)}function g(v){e.forIn("key",n,h=>{e.if((0,is._)`${(0,iu.usePattern)(t,v)}.test(${h})`,()=>{const d=c.includes(v);d||t.subschema({keyword:"patternProperties",schemaProp:v,dataProp:h,dataPropType:cu.Type.Str},l),o.opts.unevaluated&&f!==!0?e.assign((0,is._)`${f}[${h}]`,!0):!d&&!o.allErrors&&e.if((0,is.not)(l),()=>e.break())})})}}};Go.default=Sm;var Yo={};Object.defineProperty(Yo,"__esModule",{value:!0});const km=M,Em={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(t){const{gen:e,schema:r,it:n}=t;if((0,km.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"}};Yo.default=Em;var Xo={};Object.defineProperty(Xo,"__esModule",{value:!0});const Pm={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:te.validateUnion,error:{message:"must match a schema in anyOf"}};Xo.default=Pm;var Qo={};Object.defineProperty(Qo,"__esModule",{value:!0});const as=Q,Tm=M,xm={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:{message:"must match exactly one schema in oneOf",params:({params:t})=>(0,as._)`{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 o=r,i=e.let("valid",!1),a=e.let("passing",null),c=e.name("_valid");t.setParams({passing:a}),e.block(u),t.result(i,()=>t.reset(),()=>t.error(!0));function u(){o.forEach((l,f)=>{let _;(0,Tm.alwaysValidSchema)(s,l)?e.var(c,!0):_=t.subschema({keyword:"oneOf",schemaProp:f,compositeRule:!0},c),f>0&&e.if((0,as._)`${c} && ${i}`).assign(i,!1).assign(a,(0,as._)`[${a}, ${f}]`).else(),e.if(c,()=>{e.assign(i,!0),e.assign(a,f),_&&t.mergeEvaluated(_,as.Name)})})}}};Qo.default=xm;var ei={};Object.defineProperty(ei,"__esModule",{value:!0});const Rm=M,Im={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((o,i)=>{if((0,Rm.alwaysValidSchema)(n,o))return;const a=t.subschema({keyword:"allOf",schemaProp:i},s);t.ok(s),t.mergeEvaluated(a)})}};ei.default=Im;var ti={};Object.defineProperty(ti,"__esModule",{value:!0});const cs=Q,uu=M,Cm={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:{message:({params:t})=>(0,cs.str)`must match "${t.ifClause}" schema`,params:({params:t})=>(0,cs._)`{failingKeyword: ${t.ifClause}}`},code(t){const{gen:e,parentSchema:r,it:n}=t;r.then===void 0&&r.else===void 0&&(0,uu.checkStrictMode)(n,'"if" without "then" and "else" is ignored');const s=lu(n,"then"),o=lu(n,"else");if(!s&&!o)return;const i=e.let("valid",!0),a=e.name("_valid");if(c(),t.reset(),s&&o){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,cs.not)(a),u("else"));t.pass(i,()=>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 _=t.subschema({keyword:l},a);e.assign(i,a),t.mergeValidEvaluated(_,i),f?e.assign(f,(0,cs._)`${l}`):t.setParams({ifClause:l})}}}};function lu(t,e){const r=t.schema[e];return r!==void 0&&!(0,uu.alwaysValidSchema)(t,r)}ti.default=Cm;var ri={};Object.defineProperty(ri,"__esModule",{value:!0});const Om=M,Nm={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:t,parentSchema:e,it:r}){e.if===void 0&&(0,Om.checkStrictMode)(r,`"${t}" without "if" is ignored`)}};ri.default=Nm,Object.defineProperty(qo,"__esModule",{value:!0});const jm=Sr,Am=Fo,zm=kr,Mm=Ho,Zm=Wo,Lm=ru,Um=Jo,Dm=ns,qm=Bo,Vm=Go,Fm=Yo,Hm=Xo,Wm=Qo,Jm=ei,Bm=ti,Km=ri;function Gm(t=!1){const e=[Fm.default,Hm.default,Wm.default,Jm.default,Bm.default,Km.default,Um.default,Dm.default,Lm.default,qm.default,Vm.default];return t?e.push(Am.default,Mm.default):e.push(jm.default,zm.default),e.push(Zm.default),e}qo.default=Gm;var ni={},si={};Object.defineProperty(si,"__esModule",{value:!0});const xe=Q,Ym={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:{message:({schemaCode:t})=>(0,xe.str)`must match format "${t}"`,params:({schemaCode:t})=>(0,xe._)`{format: ${t}}`},code(t,e){const{gen:r,data:n,$data:s,schema:o,schemaCode:i,it:a}=t,{opts:c,errSchemaPath:u,schemaEnv:l,self:f}=a;if(!c.validateFormats)return;s?_():y();function _(){const g=r.scopeValue("formats",{ref:f.formats,code:c.code.formats}),v=r.const("fDef",(0,xe._)`${g}[${i}]`),h=r.let("fType"),d=r.let("format");r.if((0,xe._)`typeof ${v} == "object" && !(${v} instanceof RegExp)`,()=>r.assign(h,(0,xe._)`${v}.type || "string"`).assign(d,(0,xe._)`${v}.validate`),()=>r.assign(h,(0,xe._)`"string"`).assign(d,v)),t.fail$data((0,xe.or)(m(),w()));function m(){return c.strictSchema===!1?xe.nil:(0,xe._)`${i} && !${d}`}function w(){const S=l.$async?(0,xe._)`(${v}.async ? await ${d}(${n}) : ${d}(${n}))`:(0,xe._)`${d}(${n})`,P=(0,xe._)`(typeof ${d} == "function" ? ${S} : ${d}.test(${n}))`;return(0,xe._)`${d} && ${d} !== true && ${h} === ${e} && !${P}`}}function y(){const g=f.formats[o];if(!g){m();return}if(g===!0)return;const[v,h,d]=w(g);v===e&&t.pass(S());function m(){if(c.strictSchema===!1){f.logger.warn(P());return}throw new Error(P());function P(){return`unknown format "${o}" ignored in schema at path "${u}"`}}function w(P){const O=P instanceof RegExp?(0,xe.regexpCode)(P):c.code.formats?(0,xe._)`${c.code.formats}${(0,xe.getProperty)(o)}`:void 0,V=r.scopeValue("formats",{key:o,ref:P,code:O});return typeof P=="object"&&!(P instanceof RegExp)?[P.type||"string",P.validate,(0,xe._)`${V}.validate`]:["string",P,V]}function S(){if(typeof g=="object"&&!(g instanceof RegExp)&&g.async){if(!l.$async)throw new Error("async format in sync schema");return(0,xe._)`await ${d}(${n})`}return typeof h=="function"?(0,xe._)`${d}(${n})`:(0,xe._)`${d}.test(${n})`}}}};si.default=Ym,Object.defineProperty(ni,"__esModule",{value:!0});const Xm=[si.default];ni.default=Xm;var Er={};Object.defineProperty(Er,"__esModule",{value:!0}),Er.contentVocabulary=Er.metadataVocabulary=void 0,Er.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"],Er.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"],Object.defineProperty(Eo,"__esModule",{value:!0});const Qm=Po,e_=xo,t_=qo,r_=ni,du=Er,n_=[Qm.default,e_.default,(0,t_.default)(),r_.default,du.metadataVocabulary,du.contentVocabulary];Eo.default=n_;var oi={},us={};Object.defineProperty(us,"__esModule",{value:!0}),us.DiscrError=void 0;var fu;(function(t){t.Tag="tag",t.Mapping="mapping"})(fu||(us.DiscrError=fu={})),Object.defineProperty(oi,"__esModule",{value:!0});const Pr=Q,ii=us,hu=Je,s_=wr,o_=M,i_={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,Pr._)`{error: ${t}, tag: ${r}, tagValue: ${e}}`},code(t){const{gen:e,data:r,schema:n,parentSchema:s,it:o}=t,{oneOf:i}=s;if(!o.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(!i)throw new Error("discriminator: requires oneOf keyword");const c=e.let("valid",!1),u=e.const("tag",(0,Pr._)`${r}${(0,Pr.getProperty)(a)}`);e.if((0,Pr._)`typeof ${u} == "string"`,()=>l(),()=>t.error(!1,{discrError:ii.DiscrError.Tag,tag:u,tagName:a})),t.ok(c);function l(){const y=_();e.if(!1);for(const g in y)e.elseIf((0,Pr._)`${u} === ${g}`),e.assign(c,f(y[g]));e.else(),t.error(!1,{discrError:ii.DiscrError.Mapping,tag:u,tagName:a}),e.endIf()}function f(y){const g=e.name("valid"),v=t.subschema({keyword:"oneOf",schemaProp:y},g);return t.mergeEvaluated(v,Pr.Name),g}function _(){var y;const g={},v=d(s);let h=!0;for(let S=0;S<i.length;S++){let P=i[S];if(P!=null&&P.$ref&&!(0,o_.schemaHasRulesButRef)(P,o.self.RULES)){const V=P.$ref;if(P=hu.resolveRef.call(o.self,o.schemaEnv.root,o.baseId,V),P instanceof hu.SchemaEnv&&(P=P.schema),P===void 0)throw new s_.default(o.opts.uriResolver,o.baseId,V)}const O=(y=P==null?void 0:P.properties)===null||y===void 0?void 0:y[a];if(typeof O!="object")throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${a}"`);h=h&&(v||d(P)),m(O,S)}if(!h)throw new Error(`discriminator: "${a}" must be required`);return g;function d({required:S}){return Array.isArray(S)&&S.includes(a)}function m(S,P){if(S.const)w(S.const,P);else if(S.enum)for(const O of S.enum)w(O,P);else throw new Error(`discriminator: "properties/${a}" must have "const" or "enum"`)}function w(S,P){if(typeof S!="string"||S in g)throw new Error(`discriminator: "${a}" values must be unique strings`);g[S]=P}}}};oi.default=i_;const a_={$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=Ja,n=Eo,s=oi,o=a_,i=["/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(o,i):o;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=ot;Object.defineProperty(e,"KeywordCxt",{enumerable:!0,get:function(){return u.KeywordCxt}});var l=Q;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=Wr;Object.defineProperty(e,"ValidationError",{enumerable:!0,get:function(){return f.default}});var _=wr;Object.defineProperty(e,"MissingRefError",{enumerable:!0,get:function(){return _.default}})})(no,no.exports);var ai=no.exports;const c_=_r(ai),u_=Object.freeze({status:"aborted"});function T(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 i.prototype)l in a||Object.defineProperty(a,l,{value:i.prototype[l].bind(a)});a._zod.constr=i,a._zod.def=c}const s=(r==null?void 0:r.Parent)??Object;class o extends s{}Object.defineProperty(o,"name",{value:t});function i(a){var c;const u=r!=null&&r.Parent?new o:this;n(u,a),(c=u._zod).deferred??(c.deferred=[]);for(const l of u._zod.deferred)l();return u}return Object.defineProperty(i,"init",{value:n}),Object.defineProperty(i,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(i,"name",{value:t}),i}class tn extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}const pu={};function Ft(t){return pu}function mu(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 l_(t,e){return typeof e=="bigint"?e.toString():e}function ci(t){return{get value(){{const e=t();return Object.defineProperty(this,"value",{value:e}),e}}}}function ui(t){return t==null}function li(t){const e=t.startsWith("^")?1:0,r=t.endsWith("$")?t.length-1:t.length;return t.slice(e,r)}function d_(t,e){const r=(t.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,s=r>n?r:n,o=Number.parseInt(t.toFixed(s).replace(".","")),i=Number.parseInt(e.toFixed(s).replace(".",""));return o%i/10**s}function _e(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 rn(t,e,r){Object.defineProperty(t,e,{value:r,writable:!0,enumerable:!0,configurable:!0})}function nn(t){return JSON.stringify(t)}const _u=Error.captureStackTrace?Error.captureStackTrace:(...t)=>{};function ls(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}const f_=ci(()=>{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 ds(t){if(ls(t)===!1)return!1;const e=t.constructor;if(e===void 0)return!0;const r=e.prototype;return!(ls(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}const h_=new Set(["string","number","symbol"]);function sn(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Ht(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 p_(t){return Object.keys(t).filter(e=>t[e]._zod.optin==="optional"&&t[e]._zod.optout==="optional")}const m_={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 __(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 Ht(t,{...t._zod.def,shape:r,checks:[]})}function g_(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 Ht(t,{...t._zod.def,shape:r,checks:[]})}function v_(t,e){if(!ds(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 rn(this,"shape",n),n},checks:[]};return Ht(t,r)}function y_(t,e){return Ht(t,{...t._zod.def,get shape(){const r={...t._zod.def.shape,...e._zod.def.shape};return rn(this,"shape",r),r},catchall:e._zod.def.catchall,checks:[]})}function b_(t,e,r){const n=e._zod.def.shape,s={...n};if(r)for(const o in r){if(!(o in n))throw new Error(`Unrecognized key: "${o}"`);r[o]&&(s[o]=t?new t({type:"optional",innerType:n[o]}):n[o])}else for(const o in n)s[o]=t?new t({type:"optional",innerType:n[o]}):n[o];return Ht(e,{...e._zod.def,shape:s,checks:[]})}function w_(t,e,r){const n=e._zod.def.shape,s={...n};if(r)for(const o in r){if(!(o in s))throw new Error(`Unrecognized key: "${o}"`);r[o]&&(s[o]=new t({type:"nonoptional",innerType:n[o]}))}else for(const o in n)s[o]=new t({type:"nonoptional",innerType:n[o]});return Ht(e,{...e._zod.def,shape:s,checks:[]})}function on(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 ar(t,e){return e.map(r=>{var n;return(n=r).path??(n.path=[]),r.path.unshift(t),r})}function fs(t){return typeof t=="string"?t:t==null?void 0:t.message}function Wt(t,e,r){var s,o,i,a,c,u;const n={...t,path:t.path??[]};if(!t.message){const l=fs((i=(o=(s=t.inst)==null?void 0:s._zod.def)==null?void 0:o.error)==null?void 0:i.call(o,t))??fs((a=e==null?void 0:e.error)==null?void 0:a.call(e,t))??fs((c=r.customError)==null?void 0:c.call(r,t))??fs((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 di(t){return Array.isArray(t)?"array":typeof t=="string"?"string":"unknown"}function an(...t){const[e,r,n]=t;return typeof e=="string"?{message:e,code:"custom",input:r,inst:n}:{...e}}const gu=(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,l_,2)},enumerable:!0}),Object.defineProperty(t,"toString",{value:()=>t.message,enumerable:!1})},vu=T("$ZodError",gu),hs=T("$ZodError",gu,{Parent:Error});function $_(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 S_(t,e){const r=e||function(o){return o.message},n={_errors:[]},s=o=>{for(const i of o.issues)if(i.code==="invalid_union"&&i.errors.length)i.errors.map(a=>s({issues:a}));else if(i.code==="invalid_key")s({issues:i.issues});else if(i.code==="invalid_element")s({issues:i.issues});else if(i.path.length===0)n._errors.push(r(i));else{let a=n,c=0;for(;c<i.path.length;){const u=i.path[c];c===i.path.length-1?(a[u]=a[u]||{_errors:[]},a[u]._errors.push(r(i))):a[u]=a[u]||{_errors:[]},a=a[u],c++}}};return s(t),n}const yu=t=>(e,r,n,s)=>{const o=n?Object.assign(n,{async:!1}):{async:!1},i=e._zod.run({value:r,issues:[]},o);if(i instanceof Promise)throw new tn;if(i.issues.length){const a=new((s==null?void 0:s.Err)??t)(i.issues.map(c=>Wt(c,o,Ft())));throw _u(a,s==null?void 0:s.callee),a}return i.value},k_=yu(hs),bu=t=>async(e,r,n,s)=>{const o=n?Object.assign(n,{async:!0}):{async:!0};let i=e._zod.run({value:r,issues:[]},o);if(i instanceof Promise&&(i=await i),i.issues.length){const a=new((s==null?void 0:s.Err)??t)(i.issues.map(c=>Wt(c,o,Ft())));throw _u(a,s==null?void 0:s.callee),a}return i.value},E_=bu(hs),wu=t=>(e,r,n)=>{const s=n?{...n,async:!1}:{async:!1},o=e._zod.run({value:r,issues:[]},s);if(o instanceof Promise)throw new tn;return o.issues.length?{success:!1,error:new(t??vu)(o.issues.map(i=>Wt(i,s,Ft())))}:{success:!0,data:o.value}},fi=wu(hs),$u=t=>async(e,r,n)=>{const s=n?Object.assign(n,{async:!0}):{async:!0};let o=e._zod.run({value:r,issues:[]},s);return o instanceof Promise&&(o=await o),o.issues.length?{success:!1,error:new t(o.issues.map(i=>Wt(i,s,Ft())))}:{success:!0,data:o.value}},hi=$u(hs),P_=/^[cC][^\s-]{8,}$/,T_=/^[0-9a-z]+$/,x_=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,R_=/^[0-9a-vA-V]{20}$/,I_=/^[A-Za-z0-9]{27}$/,C_=/^[a-zA-Z0-9_-]{21}$/,O_=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,N_=/^([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})$/,Su=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)$/,j_=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,A_="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function z_(){return new RegExp(A_,"u")}const M_=/^(?:(?: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])$/,Z_=/^(([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})$/,L_=/^((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])$/,U_=/^(([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])$/,D_=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,ku=/^[A-Za-z0-9_-]*$/,q_=/^([a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+$/,V_=/^\+(?:[0-9]){6,14}[0-9]$/,Eu="(?:(?:\\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])))",F_=new RegExp(`^${Eu}$`);function Pu(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 H_(t){return new RegExp(`^${Pu(t)}$`)}function W_(t){const e=Pu({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(`^${Eu}T(?:${n})$`)}const J_=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}$`)},B_=/^\d+$/,K_=/^-?\d+(?:\.\d+)?/i,G_=/true|false/i,Y_=/^[^A-Z]*$/,X_=/^[^a-z]*$/,Ke=T("$ZodCheck",(t,e)=>{var r;t._zod??(t._zod={}),t._zod.def=e,(r=t._zod).onattach??(r.onattach=[])}),Tu={number:"number",bigint:"bigint",object:"date"},xu=T("$ZodCheckLessThan",(t,e)=>{Ke.init(t,e);const r=Tu[typeof e.value];t._zod.onattach.push(n=>{const s=n._zod.bag,o=(e.inclusive?s.maximum:s.exclusiveMaximum)??Number.POSITIVE_INFINITY;e.value<o&&(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})}}),Ru=T("$ZodCheckGreaterThan",(t,e)=>{Ke.init(t,e);const r=Tu[typeof e.value];t._zod.onattach.push(n=>{const s=n._zod.bag,o=(e.inclusive?s.minimum:s.exclusiveMinimum)??Number.NEGATIVE_INFINITY;e.value>o&&(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})}}),Q_=T("$ZodCheckMultipleOf",(t,e)=>{Ke.init(t,e),t._zod.onattach.push(r=>{var n;(n=r._zod.bag).multipleOf??(n.multipleOf=e.value)}),t._zod.check=r=>{if(typeof r.value!=typeof e.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof r.value=="bigint"?r.value%e.value===BigInt(0):d_(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})}}),eg=T("$ZodCheckNumberFormat",(t,e)=>{var i;Ke.init(t,e),e.format=e.format||"float64";const r=(i=e.format)==null?void 0:i.includes("int"),n=r?"int":"number",[s,o]=m_[e.format];t._zod.onattach.push(a=>{const c=a._zod.bag;c.format=e.format,c.minimum=s,c.maximum=o,r&&(c.pattern=B_)}),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>o&&a.issues.push({origin:"number",input:c,code:"too_big",maximum:o,inst:t})}}),tg=T("$ZodCheckMaxLength",(t,e)=>{var r;Ke.init(t,e),(r=t._zod.def).when??(r.when=n=>{const s=n.value;return!ui(s)&&s.length!==void 0}),t._zod.onattach.push(n=>{const s=n._zod.bag.maximum??Number.POSITIVE_INFINITY;e.maximum<s&&(n._zod.bag.maximum=e.maximum)}),t._zod.check=n=>{const s=n.value;if(s.length<=e.maximum)return;const i=di(s);n.issues.push({origin:i,code:"too_big",maximum:e.maximum,inclusive:!0,input:s,inst:t,continue:!e.abort})}}),rg=T("$ZodCheckMinLength",(t,e)=>{var r;Ke.init(t,e),(r=t._zod.def).when??(r.when=n=>{const s=n.value;return!ui(s)&&s.length!==void 0}),t._zod.onattach.push(n=>{const s=n._zod.bag.minimum??Number.NEGATIVE_INFINITY;e.minimum>s&&(n._zod.bag.minimum=e.minimum)}),t._zod.check=n=>{const s=n.value;if(s.length>=e.minimum)return;const i=di(s);n.issues.push({origin:i,code:"too_small",minimum:e.minimum,inclusive:!0,input:s,inst:t,continue:!e.abort})}}),ng=T("$ZodCheckLengthEquals",(t,e)=>{var r;Ke.init(t,e),(r=t._zod.def).when??(r.when=n=>{const s=n.value;return!ui(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,o=s.length;if(o===e.length)return;const i=di(s),a=o>e.length;n.issues.push({origin:i,...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})}}),ps=T("$ZodCheckStringFormat",(t,e)=>{var r,n;Ke.init(t,e),t._zod.onattach.push(s=>{const o=s._zod.bag;o.format=e.format,e.pattern&&(o.patterns??(o.patterns=new Set),o.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=()=>{})}),sg=T("$ZodCheckRegex",(t,e)=>{ps.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})}}),og=T("$ZodCheckLowerCase",(t,e)=>{e.pattern??(e.pattern=Y_),ps.init(t,e)}),ig=T("$ZodCheckUpperCase",(t,e)=>{e.pattern??(e.pattern=X_),ps.init(t,e)}),ag=T("$ZodCheckIncludes",(t,e)=>{Ke.init(t,e);const r=sn(e.includes),n=new RegExp(typeof e.position=="number"?`^.{${e.position}}${r}`:r);e.pattern=n,t._zod.onattach.push(s=>{const o=s._zod.bag;o.patterns??(o.patterns=new Set),o.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})}}),cg=T("$ZodCheckStartsWith",(t,e)=>{Ke.init(t,e);const r=new RegExp(`^${sn(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})}}),ug=T("$ZodCheckEndsWith",(t,e)=>{Ke.init(t,e);const r=new RegExp(`.*${sn(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})}}),lg=T("$ZodCheckOverwrite",(t,e)=>{Ke.init(t,e),t._zod.check=r=>{r.value=e.tx(r.value)}});class dg{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),this.indent-=1}write(e){if(typeof e=="function"){e(this,{execution:"sync"}),e(this,{execution:"async"});return}const n=e.split(`
9
+ `).filter(i=>i),s=Math.min(...n.map(i=>i.length-i.trimStart().length)),o=n.map(i=>i.slice(s)).map(i=>" ".repeat(this.indent*2)+i);for(const i of o)this.content.push(i)}compile(){const e=Function,r=this==null?void 0:this.args,s=[...((this==null?void 0:this.content)??[""]).map(o=>` ${o}`)];return new e(...r,s.join(`
10
+ `))}}const fg={major:4,minor:0,patch:0},ge=T("$ZodType",(t,e)=>{var s;var r;t??(t={}),t._zod.def=e,t._zod.bag=t._zod.bag||{},t._zod.version=fg;const n=[...t._zod.def.checks??[]];t._zod.traits.has("$ZodCheck")&&n.unshift(t);for(const o of n)for(const i of o._zod.onattach)i(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 o=(i,a,c)=>{let u=on(i),l;for(const f of a){if(f._zod.def.when){if(!f._zod.def.when(i))continue}else if(u)continue;const _=i.issues.length,y=f._zod.check(i);if(y instanceof Promise&&(c==null?void 0:c.async)===!1)throw new tn;if(l||y instanceof Promise)l=(l??Promise.resolve()).then(async()=>{await y,i.issues.length!==_&&(u||(u=on(i,_)))});else{if(i.issues.length===_)continue;u||(u=on(i,_))}}return l?l.then(()=>i):i};t._zod.run=(i,a)=>{const c=t._zod.parse(i,a);if(c instanceof Promise){if(a.async===!1)throw new tn;return c.then(u=>o(u,n,a))}return o(c,n,a)}}t["~standard"]={validate:o=>{var i;try{const a=fi(t,o);return a.success?{value:a.data}:{issues:(i=a.error)==null?void 0:i.issues}}catch{return hi(t,o).then(c=>{var u;return c.success?{value:c.data}:{issues:(u=c.error)==null?void 0:u.issues}})}},vendor:"zod",version:1}}),pi=T("$ZodString",(t,e)=>{var r;ge.init(t,e),t._zod.pattern=[...((r=t==null?void 0:t._zod.bag)==null?void 0:r.patterns)??[]].pop()??J_(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}}),ye=T("$ZodStringFormat",(t,e)=>{ps.init(t,e),pi.init(t,e)}),hg=T("$ZodGUID",(t,e)=>{e.pattern??(e.pattern=N_),ye.init(t,e)}),pg=T("$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=Su(n))}else e.pattern??(e.pattern=Su());ye.init(t,e)}),mg=T("$ZodEmail",(t,e)=>{e.pattern??(e.pattern=j_),ye.init(t,e)}),_g=T("$ZodURL",(t,e)=>{ye.init(t,e),t._zod.check=r=>{try{const n=r.value,s=new URL(n),o=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:q_.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("/")&&o.endsWith("/")?r.value=o.slice(0,-1):r.value=o;return}catch{r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:t,continue:!e.abort})}}}),gg=T("$ZodEmoji",(t,e)=>{e.pattern??(e.pattern=z_()),ye.init(t,e)}),vg=T("$ZodNanoID",(t,e)=>{e.pattern??(e.pattern=C_),ye.init(t,e)}),yg=T("$ZodCUID",(t,e)=>{e.pattern??(e.pattern=P_),ye.init(t,e)}),bg=T("$ZodCUID2",(t,e)=>{e.pattern??(e.pattern=T_),ye.init(t,e)}),wg=T("$ZodULID",(t,e)=>{e.pattern??(e.pattern=x_),ye.init(t,e)}),$g=T("$ZodXID",(t,e)=>{e.pattern??(e.pattern=R_),ye.init(t,e)}),Sg=T("$ZodKSUID",(t,e)=>{e.pattern??(e.pattern=I_),ye.init(t,e)}),kg=T("$ZodISODateTime",(t,e)=>{e.pattern??(e.pattern=W_(e)),ye.init(t,e)}),Eg=T("$ZodISODate",(t,e)=>{e.pattern??(e.pattern=F_),ye.init(t,e)}),Pg=T("$ZodISOTime",(t,e)=>{e.pattern??(e.pattern=H_(e)),ye.init(t,e)}),Tg=T("$ZodISODuration",(t,e)=>{e.pattern??(e.pattern=O_),ye.init(t,e)}),xg=T("$ZodIPv4",(t,e)=>{e.pattern??(e.pattern=M_),ye.init(t,e),t._zod.onattach.push(r=>{const n=r._zod.bag;n.format="ipv4"})}),Rg=T("$ZodIPv6",(t,e)=>{e.pattern??(e.pattern=Z_),ye.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})}}}),Ig=T("$ZodCIDRv4",(t,e)=>{e.pattern??(e.pattern=L_),ye.init(t,e)}),Cg=T("$ZodCIDRv6",(t,e)=>{e.pattern??(e.pattern=U_),ye.init(t,e),t._zod.check=r=>{const[n,s]=r.value.split("/");try{if(!s)throw new Error;const o=Number(s);if(`${o}`!==s)throw new Error;if(o<0||o>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 Iu(t){if(t==="")return!0;if(t.length%4!==0)return!1;try{return atob(t),!0}catch{return!1}}const Og=T("$ZodBase64",(t,e)=>{e.pattern??(e.pattern=D_),ye.init(t,e),t._zod.onattach.push(r=>{r._zod.bag.contentEncoding="base64"}),t._zod.check=r=>{Iu(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:t,continue:!e.abort})}});function Ng(t){if(!ku.test(t))return!1;const e=t.replace(/[-_]/g,n=>n==="-"?"+":"/"),r=e.padEnd(Math.ceil(e.length/4)*4,"=");return Iu(r)}const jg=T("$ZodBase64URL",(t,e)=>{e.pattern??(e.pattern=ku),ye.init(t,e),t._zod.onattach.push(r=>{r._zod.bag.contentEncoding="base64url"}),t._zod.check=r=>{Ng(r.value)||r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:t,continue:!e.abort})}}),Ag=T("$ZodE164",(t,e)=>{e.pattern??(e.pattern=V_),ye.init(t,e)});function zg(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 Mg=T("$ZodJWT",(t,e)=>{ye.init(t,e),t._zod.check=r=>{zg(r.value,e.alg)||r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:t,continue:!e.abort})}}),Cu=T("$ZodNumber",(t,e)=>{ge.init(t,e),t._zod.pattern=t._zod.bag.pattern??K_,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 o=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,...o?{received:o}:{}}),r}}),Zg=T("$ZodNumber",(t,e)=>{eg.init(t,e),Cu.init(t,e)}),Lg=T("$ZodBoolean",(t,e)=>{ge.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}}),Ug=T("$ZodAny",(t,e)=>{ge.init(t,e),t._zod.parse=r=>r}),Dg=T("$ZodUnknown",(t,e)=>{ge.init(t,e),t._zod.parse=r=>r}),qg=T("$ZodNever",(t,e)=>{ge.init(t,e),t._zod.parse=(r,n)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:t}),r)});function Ou(t,e,r){t.issues.length&&e.issues.push(...ar(r,t.issues)),e.value[r]=t.value}const Vg=T("$ZodArray",(t,e)=>{ge.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 o=[];for(let i=0;i<s.length;i++){const a=s[i],c=e.element._zod.run({value:a,issues:[]},n);c instanceof Promise?o.push(c.then(u=>Ou(u,r,i))):Ou(c,r,i)}return o.length?Promise.all(o).then(()=>r):r}});function ms(t,e,r){t.issues.length&&e.issues.push(...ar(r,t.issues)),e.value[r]=t.value}function Nu(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(...ar(r,t.issues)):t.value===void 0?r in n&&(e.value[r]=void 0):e.value[r]=t.value}const ju=T("$ZodObject",(t,e)=>{ge.init(t,e);const r=ci(()=>{const f=Object.keys(e.shape);for(const y of f)if(!(e.shape[y]instanceof ge))throw new Error(`Invalid element at key "${y}": expected a Zod schema`);const _=p_(e.shape);return{shape:e.shape,keys:f,keySet:new Set(f),numKeys:f.length,optionalKeys:new Set(_)}});_e(t._zod,"propValues",()=>{const f=e.shape,_={};for(const y in f){const g=f[y]._zod;if(g.values){_[y]??(_[y]=new Set);for(const v of g.values)_[y].add(v)}}return _});const n=f=>{const _=new dg(["shape","payload","ctx"]),y=r.value,g=m=>{const w=nn(m);return`shape[${w}]._zod.run({ value: input[${w}], issues: [] }, ctx)`};_.write("const input = payload.value;");const v=Object.create(null);let h=0;for(const m of y.keys)v[m]=`key_${h++}`;_.write("const newResult = {}");for(const m of y.keys)if(y.optionalKeys.has(m)){const w=v[m];_.write(`const ${w} = ${g(m)};`);const S=nn(m);_.write(`
11
+ if (${w}.issues.length) {
12
+ if (input[${S}] === undefined) {
13
+ if (${S} in input) {
14
+ newResult[${S}] = undefined;
15
+ }
16
+ } else {
17
+ payload.issues = payload.issues.concat(
18
+ ${w}.issues.map((iss) => ({
19
+ ...iss,
20
+ path: iss.path ? [${S}, ...iss.path] : [${S}],
21
+ }))
22
+ );
23
+ }
24
+ } else if (${w}.value === undefined) {
25
+ if (${S} in input) newResult[${S}] = undefined;
26
+ } else {
27
+ newResult[${S}] = ${w}.value;
28
+ }
29
+ `)}else{const w=v[m];_.write(`const ${w} = ${g(m)};`),_.write(`
30
+ if (${w}.issues.length) payload.issues = payload.issues.concat(${w}.issues.map(iss => ({
31
+ ...iss,
32
+ path: iss.path ? [${nn(m)}, ...iss.path] : [${nn(m)}]
33
+ })));`),_.write(`newResult[${nn(m)}] = ${w}.value`)}_.write("payload.value = newResult;"),_.write("return payload;");const d=_.compile();return(m,w)=>d(f,m,w)};let s;const o=ls,i=!pu.jitless,c=i&&f_.value,u=e.catchall;let l;t._zod.parse=(f,_)=>{l??(l=r.value);const y=f.value;if(!o(y))return f.issues.push({expected:"object",code:"invalid_type",input:y,inst:t}),f;const g=[];if(i&&c&&(_==null?void 0:_.async)===!1&&_.jitless!==!0)s||(s=n(e.shape)),f=s(f,_);else{f.value={};const w=l.shape;for(const S of l.keys){const P=w[S],O=P._zod.run({value:y[S],issues:[]},_),V=P._zod.optin==="optional"&&P._zod.optout==="optional";O instanceof Promise?g.push(O.then(ce=>V?Nu(ce,f,S,y):ms(ce,f,S))):V?Nu(O,f,S,y):ms(O,f,S)}}if(!u)return g.length?Promise.all(g).then(()=>f):f;const v=[],h=l.keySet,d=u._zod,m=d.def.type;for(const w of Object.keys(y)){if(h.has(w))continue;if(m==="never"){v.push(w);continue}const S=d.run({value:y[w],issues:[]},_);S instanceof Promise?g.push(S.then(P=>ms(P,f,w))):ms(S,f,w)}return v.length&&f.issues.push({code:"unrecognized_keys",keys:v,input:y,inst:t}),g.length?Promise.all(g).then(()=>f):f}});function Au(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(o=>Wt(o,n,Ft())))}),e}const zu=T("$ZodUnion",(t,e)=>{ge.init(t,e),_e(t._zod,"optin",()=>e.options.some(r=>r._zod.optin==="optional")?"optional":void 0),_e(t._zod,"optout",()=>e.options.some(r=>r._zod.optout==="optional")?"optional":void 0),_e(t._zod,"values",()=>{if(e.options.every(r=>r._zod.values))return new Set(e.options.flatMap(r=>Array.from(r._zod.values)))}),_e(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=>li(n.source)).join("|")})$`)}}),t._zod.parse=(r,n)=>{let s=!1;const o=[];for(const i of e.options){const a=i._zod.run({value:r.value,issues:[]},n);if(a instanceof Promise)o.push(a),s=!0;else{if(a.issues.length===0)return a;o.push(a)}}return s?Promise.all(o).then(i=>Au(i,r,t,n)):Au(o,r,t,n)}}),Fg=T("$ZodDiscriminatedUnion",(t,e)=>{zu.init(t,e);const r=t._zod.parse;_e(t._zod,"propValues",()=>{const s={};for(const o of e.options){const i=o._zod.propValues;if(!i||Object.keys(i).length===0)throw new Error(`Invalid discriminated union option at index "${e.options.indexOf(o)}"`);for(const[a,c]of Object.entries(i)){s[a]||(s[a]=new Set);for(const u of c)s[a].add(u)}}return s});const n=ci(()=>{const s=e.options,o=new Map;for(const i of s){const a=i._zod.propValues[e.discriminator];if(!a||a.size===0)throw new Error(`Invalid discriminated union option at index "${e.options.indexOf(i)}"`);for(const c of a){if(o.has(c))throw new Error(`Duplicate discriminator value "${String(c)}"`);o.set(c,i)}}return o});t._zod.parse=(s,o)=>{const i=s.value;if(!ls(i))return s.issues.push({code:"invalid_type",expected:"object",input:i,inst:t}),s;const a=n.value.get(i==null?void 0:i[e.discriminator]);return a?a._zod.run(s,o):e.unionFallback?r(s,o):(s.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",input:i,path:[e.discriminator],inst:t}),s)}}),Hg=T("$ZodIntersection",(t,e)=>{ge.init(t,e),t._zod.parse=(r,n)=>{const s=r.value,o=e.left._zod.run({value:s,issues:[]},n),i=e.right._zod.run({value:s,issues:[]},n);return o instanceof Promise||i instanceof Promise?Promise.all([o,i]).then(([c,u])=>Mu(r,c,u)):Mu(r,o,i)}});function mi(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(ds(t)&&ds(e)){const r=Object.keys(e),n=Object.keys(t).filter(o=>r.indexOf(o)!==-1),s={...t,...e};for(const o of n){const i=mi(t[o],e[o]);if(!i.valid)return{valid:!1,mergeErrorPath:[o,...i.mergeErrorPath]};s[o]=i.data}return{valid:!0,data:s}}if(Array.isArray(t)&&Array.isArray(e)){if(t.length!==e.length)return{valid:!1,mergeErrorPath:[]};const r=[];for(let n=0;n<t.length;n++){const s=t[n],o=e[n],i=mi(s,o);if(!i.valid)return{valid:!1,mergeErrorPath:[n,...i.mergeErrorPath]};r.push(i.data)}return{valid:!0,data:r}}return{valid:!1,mergeErrorPath:[]}}function Mu(t,e,r){if(e.issues.length&&t.issues.push(...e.issues),r.issues.length&&t.issues.push(...r.issues),on(t))return t;const n=mi(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 Wg=T("$ZodRecord",(t,e)=>{ge.init(t,e),t._zod.parse=(r,n)=>{const s=r.value;if(!ds(s))return r.issues.push({expected:"record",code:"invalid_type",input:s,inst:t}),r;const o=[];if(e.keyType._zod.values){const i=e.keyType._zod.values;r.value={};for(const c of i)if(typeof c=="string"||typeof c=="number"||typeof c=="symbol"){const u=e.valueType._zod.run({value:s[c],issues:[]},n);u instanceof Promise?o.push(u.then(l=>{l.issues.length&&r.issues.push(...ar(c,l.issues)),r.value[c]=l.value})):(u.issues.length&&r.issues.push(...ar(c,u.issues)),r.value[c]=u.value)}let a;for(const c in s)i.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 i of Reflect.ownKeys(s)){if(i==="__proto__")continue;const a=e.keyType._zod.run({value:i,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=>Wt(u,n,Ft())),input:i,path:[i],inst:t}),r.value[a.value]=a.value;continue}const c=e.valueType._zod.run({value:s[i],issues:[]},n);c instanceof Promise?o.push(c.then(u=>{u.issues.length&&r.issues.push(...ar(i,u.issues)),r.value[a.value]=u.value})):(c.issues.length&&r.issues.push(...ar(i,c.issues)),r.value[a.value]=c.value)}}return o.length?Promise.all(o).then(()=>r):r}}),Jg=T("$ZodEnum",(t,e)=>{ge.init(t,e);const r=mu(e.entries);t._zod.values=new Set(r),t._zod.pattern=new RegExp(`^(${r.filter(n=>h_.has(typeof n)).map(n=>typeof n=="string"?sn(n):n.toString()).join("|")})$`),t._zod.parse=(n,s)=>{const o=n.value;return t._zod.values.has(o)||n.issues.push({code:"invalid_value",values:r,input:o,inst:t}),n}}),Bg=T("$ZodLiteral",(t,e)=>{ge.init(t,e),t._zod.values=new Set(e.values),t._zod.pattern=new RegExp(`^(${e.values.map(r=>typeof r=="string"?sn(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}}),Kg=T("$ZodTransform",(t,e)=>{ge.init(t,e),t._zod.parse=(r,n)=>{const s=e.transform(r.value,r);if(n.async)return(s instanceof Promise?s:Promise.resolve(s)).then(i=>(r.value=i,r));if(s instanceof Promise)throw new tn;return r.value=s,r}}),Gg=T("$ZodOptional",(t,e)=>{ge.init(t,e),t._zod.optin="optional",t._zod.optout="optional",_e(t._zod,"values",()=>e.innerType._zod.values?new Set([...e.innerType._zod.values,void 0]):void 0),_e(t._zod,"pattern",()=>{const r=e.innerType._zod.pattern;return r?new RegExp(`^(${li(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)}),Yg=T("$ZodNullable",(t,e)=>{ge.init(t,e),_e(t._zod,"optin",()=>e.innerType._zod.optin),_e(t._zod,"optout",()=>e.innerType._zod.optout),_e(t._zod,"pattern",()=>{const r=e.innerType._zod.pattern;return r?new RegExp(`^(${li(r.source)}|null)$`):void 0}),_e(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)}),Xg=T("$ZodDefault",(t,e)=>{ge.init(t,e),t._zod.optin="optional",_e(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(o=>Zu(o,e)):Zu(s,e)}});function Zu(t,e){return t.value===void 0&&(t.value=e.defaultValue),t}const Qg=T("$ZodPrefault",(t,e)=>{ge.init(t,e),t._zod.optin="optional",_e(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))}),ev=T("$ZodNonOptional",(t,e)=>{ge.init(t,e),_e(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(o=>Lu(o,t)):Lu(s,t)}});function Lu(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 tv=T("$ZodCatch",(t,e)=>{ge.init(t,e),t._zod.optin="optional",_e(t._zod,"optout",()=>e.innerType._zod.optout),_e(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(o=>(r.value=o.value,o.issues.length&&(r.value=e.catchValue({...r,error:{issues:o.issues.map(i=>Wt(i,n,Ft()))},input:r.value}),r.issues=[]),r)):(r.value=s.value,s.issues.length&&(r.value=e.catchValue({...r,error:{issues:s.issues.map(o=>Wt(o,n,Ft()))},input:r.value}),r.issues=[]),r)}}),rv=T("$ZodPipe",(t,e)=>{ge.init(t,e),_e(t._zod,"values",()=>e.in._zod.values),_e(t._zod,"optin",()=>e.in._zod.optin),_e(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(o=>Uu(o,e,n)):Uu(s,e,n)}});function Uu(t,e,r){return on(t)?t:e.out._zod.run({value:t.value,issues:t.issues},r)}const nv=T("$ZodReadonly",(t,e)=>{ge.init(t,e),_e(t._zod,"propValues",()=>e.innerType._zod.propValues),_e(t._zod,"values",()=>e.innerType._zod.values),_e(t._zod,"optin",()=>e.innerType._zod.optin),_e(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(Du):Du(s)}});function Du(t){return t.value=Object.freeze(t.value),t}const sv=T("$ZodCustom",(t,e)=>{Ke.init(t,e),ge.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(o=>qu(o,r,n,t));qu(s,r,n,t)}});function qu(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(an(s))}}class Vu{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 ov(){return new Vu}const cn=ov();function iv(t,e){return new t({type:"string",...D(e)})}function av(t,e){return new t({type:"string",format:"email",check:"string_format",abort:!1,...D(e)})}function Fu(t,e){return new t({type:"string",format:"guid",check:"string_format",abort:!1,...D(e)})}function cv(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,...D(e)})}function uv(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...D(e)})}function lv(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...D(e)})}function dv(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...D(e)})}function Hu(t,e){return new t({type:"string",format:"url",check:"string_format",abort:!1,...D(e)})}function fv(t,e){return new t({type:"string",format:"emoji",check:"string_format",abort:!1,...D(e)})}function hv(t,e){return new t({type:"string",format:"nanoid",check:"string_format",abort:!1,...D(e)})}function pv(t,e){return new t({type:"string",format:"cuid",check:"string_format",abort:!1,...D(e)})}function mv(t,e){return new t({type:"string",format:"cuid2",check:"string_format",abort:!1,...D(e)})}function _v(t,e){return new t({type:"string",format:"ulid",check:"string_format",abort:!1,...D(e)})}function gv(t,e){return new t({type:"string",format:"xid",check:"string_format",abort:!1,...D(e)})}function vv(t,e){return new t({type:"string",format:"ksuid",check:"string_format",abort:!1,...D(e)})}function yv(t,e){return new t({type:"string",format:"ipv4",check:"string_format",abort:!1,...D(e)})}function bv(t,e){return new t({type:"string",format:"ipv6",check:"string_format",abort:!1,...D(e)})}function wv(t,e){return new t({type:"string",format:"cidrv4",check:"string_format",abort:!1,...D(e)})}function $v(t,e){return new t({type:"string",format:"cidrv6",check:"string_format",abort:!1,...D(e)})}function Sv(t,e){return new t({type:"string",format:"base64",check:"string_format",abort:!1,...D(e)})}function kv(t,e){return new t({type:"string",format:"base64url",check:"string_format",abort:!1,...D(e)})}function Ev(t,e){return new t({type:"string",format:"e164",check:"string_format",abort:!1,...D(e)})}function Pv(t,e){return new t({type:"string",format:"jwt",check:"string_format",abort:!1,...D(e)})}function Tv(t,e){return new t({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...D(e)})}function xv(t,e){return new t({type:"string",format:"date",check:"string_format",...D(e)})}function Rv(t,e){return new t({type:"string",format:"time",check:"string_format",precision:null,...D(e)})}function Iv(t,e){return new t({type:"string",format:"duration",check:"string_format",...D(e)})}function Cv(t,e){return new t({type:"number",checks:[],...D(e)})}function Ov(t,e){return new t({type:"number",check:"number_format",abort:!1,format:"safeint",...D(e)})}function Nv(t,e){return new t({type:"boolean",...D(e)})}function jv(t){return new t({type:"any"})}function Av(t){return new t({type:"unknown"})}function zv(t,e){return new t({type:"never",...D(e)})}function Wu(t,e){return new xu({check:"less_than",...D(e),value:t,inclusive:!1})}function _i(t,e){return new xu({check:"less_than",...D(e),value:t,inclusive:!0})}function Ju(t,e){return new Ru({check:"greater_than",...D(e),value:t,inclusive:!1})}function gi(t,e){return new Ru({check:"greater_than",...D(e),value:t,inclusive:!0})}function Bu(t,e){return new Q_({check:"multiple_of",...D(e),value:t})}function Ku(t,e){return new tg({check:"max_length",...D(e),maximum:t})}function _s(t,e){return new rg({check:"min_length",...D(e),minimum:t})}function Gu(t,e){return new ng({check:"length_equals",...D(e),length:t})}function Mv(t,e){return new sg({check:"string_format",format:"regex",...D(e),pattern:t})}function Zv(t){return new og({check:"string_format",format:"lowercase",...D(t)})}function Lv(t){return new ig({check:"string_format",format:"uppercase",...D(t)})}function Uv(t,e){return new ag({check:"string_format",format:"includes",...D(e),includes:t})}function Dv(t,e){return new cg({check:"string_format",format:"starts_with",...D(e),prefix:t})}function qv(t,e){return new ug({check:"string_format",format:"ends_with",...D(e),suffix:t})}function un(t){return new lg({check:"overwrite",tx:t})}function Vv(t){return un(e=>e.normalize(t))}function Fv(){return un(t=>t.trim())}function Hv(){return un(t=>t.toLowerCase())}function Wv(){return un(t=>t.toUpperCase())}function Jv(t,e,r){return new t({type:"array",element:e,...D(r)})}function Bv(t,e,r){const n=D(r);return n.abort??(n.abort=!0),new t({type:"custom",check:"custom",fn:e,...n})}function Kv(t,e,r){return new t({type:"custom",check:"custom",fn:e,...D(r)})}class Yu{constructor(e){this.counter=0,this.metadataRegistry=(e==null?void 0:e.metadata)??cn,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,_,y;var n;const s=e._zod.def,o={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},i=this.seen.get(e);if(i)return i.count++,r.schemaPath.includes(e)&&(i.cycle=r.path),i.schema;const a={schema:{},count:1,cycle:void 0,path:r.path};this.seen.set(e,a);const c=(_=(f=e._zod).toJSONSchema)==null?void 0:_.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 h=a.schema;switch(s.type){case"string":{const d=h;d.type="string";const{minimum:m,maximum:w,format:S,patterns:P,contentEncoding:O}=e._zod.bag;if(typeof m=="number"&&(d.minLength=m),typeof w=="number"&&(d.maxLength=w),S&&(d.format=o[S]??S,d.format===""&&delete d.format),O&&(d.contentEncoding=O),P&&P.size>0){const V=[...P];V.length===1?d.pattern=V[0].source:V.length>1&&(a.schema.allOf=[...V.map(ce=>({...this.target==="draft-7"?{type:"string"}:{},pattern:ce.source}))])}break}case"number":{const d=h,{minimum:m,maximum:w,format:S,multipleOf:P,exclusiveMaximum:O,exclusiveMinimum:V}=e._zod.bag;typeof S=="string"&&S.includes("int")?d.type="integer":d.type="number",typeof V=="number"&&(d.exclusiveMinimum=V),typeof m=="number"&&(d.minimum=m,typeof V=="number"&&(V>=m?delete d.minimum:delete d.exclusiveMinimum)),typeof O=="number"&&(d.exclusiveMaximum=O),typeof w=="number"&&(d.maximum=w,typeof O=="number"&&(O<=w?delete d.maximum:delete d.exclusiveMaximum)),typeof P=="number"&&(d.multipleOf=P);break}case"boolean":{const d=h;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":{h.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":{h.not={};break}case"date":{if(this.unrepresentable==="throw")throw new Error("Date cannot be represented in JSON Schema");break}case"array":{const d=h,{minimum:m,maximum:w}=e._zod.bag;typeof m=="number"&&(d.minItems=m),typeof w=="number"&&(d.maxItems=w),d.type="array",d.items=this.process(s.element,{...g,path:[...g.path,"items"]});break}case"object":{const d=h;d.type="object",d.properties={};const m=s.shape;for(const P in m)d.properties[P]=this.process(m[P],{...g,path:[...g.path,"properties",P]});const w=new Set(Object.keys(m)),S=new Set([...w].filter(P=>{const O=s.shape[P]._zod;return this.io==="input"?O.optin===void 0:O.optout===void 0}));S.size>0&&(d.required=Array.from(S)),((y=s.catchall)==null?void 0:y._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=h;d.anyOf=s.options.map((m,w)=>this.process(m,{...g,path:[...g.path,"anyOf",w]}));break}case"intersection":{const d=h,m=this.process(s.left,{...g,path:[...g.path,"allOf",0]}),w=this.process(s.right,{...g,path:[...g.path,"allOf",1]}),S=O=>"allOf"in O&&Object.keys(O).length===1,P=[...S(m)?m.allOf:[m],...S(w)?w.allOf:[w]];d.allOf=P;break}case"tuple":{const d=h;d.type="array";const m=s.items.map((P,O)=>this.process(P,{...g,path:[...g.path,"prefixItems",O]}));if(this.target==="draft-2020-12"?d.prefixItems=m:d.items=m,s.rest){const P=this.process(s.rest,{...g,path:[...g.path,"items"]});this.target==="draft-2020-12"?d.items=P:d.additionalItems=P}s.rest&&(d.items=this.process(s.rest,{...g,path:[...g.path,"items"]}));const{minimum:w,maximum:S}=e._zod.bag;typeof w=="number"&&(d.minItems=w),typeof S=="number"&&(d.maxItems=S);break}case"record":{const d=h;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=h,m=mu(s.entries);m.every(w=>typeof w=="number")&&(d.type="number"),m.every(w=>typeof w=="string")&&(d.type="string"),d.enum=m;break}case"literal":{const d=h,m=[];for(const w of s.values)if(w===void 0){if(this.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof w=="bigint"){if(this.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");m.push(Number(w))}else m.push(w);if(m.length!==0)if(m.length===1){const w=m[0];d.type=w===null?"null":typeof w,d.const=w}else m.every(w=>typeof w=="number")&&(d.type="number"),m.every(w=>typeof w=="string")&&(d.type="string"),m.every(w=>typeof w=="boolean")&&(d.type="string"),m.every(w=>w===null)&&(d.type="null"),d.enum=m;break}case"file":{const d=h,m={type:"string",format:"binary",contentEncoding:"binary"},{minimum:w,maximum:S,mime:P}=e._zod.bag;w!==void 0&&(m.minLength=w),S!==void 0&&(m.maxLength=S),P?P.length===1?(m.contentMediaType=P[0],Object.assign(d,m)):d.anyOf=P.map(O=>({...m,contentMediaType:O})):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);h.anyOf=[d,{type:"null"}];break}case"nonoptional":{this.process(s.innerType,g),a.ref=s.innerType;break}case"success":{const d=h;d.type="boolean";break}case"default":{this.process(s.innerType,g),a.ref=s.innerType,h.default=JSON.parse(JSON.stringify(s.defaultValue));break}case"prefault":{this.process(s.innerType,g),a.ref=s.innerType,this.io==="input"&&(h._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")}h.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=h,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,h.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"&&Ne(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,_,y,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 o=h=>{var P;const d=this.target==="draft-2020-12"?"$defs":"definitions";if(n.external){const O=(P=n.external.registry.get(h[0]))==null?void 0:P.id,V=n.external.uri??(G=>G);if(O)return{ref:V(O)};const ce=h[1].defId??h[1].schema.id??`schema${this.counter++}`;return h[1].defId=ce,{defId:ce,ref:`${V("__shared")}#/${d}/${ce}`}}if(h[1]===s)return{ref:"#"};const w=`#/${d}/`,S=h[1].schema.id??`__schema${this.counter++}`;return{defId:S,ref:w+S}},i=h=>{if(h[1].schema.$ref)return;const d=h[1],{ref:m,defId:w}=o(h);d.def={...d.schema},w&&(d.defId=w);const S=d.schema;for(const P in S)delete S[P];S.$ref=m};if(n.cycles==="throw")for(const h of this.seen.entries()){const d=h[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 h of this.seen.entries()){const d=h[1];if(e===h[0]){i(h);continue}if(n.external){const w=(f=n.external.registry.get(h[0]))==null?void 0:f.id;if(e!==h[0]&&w){i(h);continue}}if((_=this.metadataRegistry.get(h[0]))==null?void 0:_.id){i(h);continue}if(d.cycle){i(h);continue}if(d.count>1&&n.reused==="ref"){i(h);continue}}const a=(h,d)=>{const m=this.seen.get(h),w=m.def??m.schema,S={...w};if(m.ref===null)return;const P=m.ref;if(m.ref=null,P){a(P,d);const O=this.seen.get(P).schema;O.$ref&&d.target==="draft-7"?(w.allOf=w.allOf??[],w.allOf.push(O)):(Object.assign(w,O),Object.assign(w,S))}m.isParent||this.override({zodSchema:h,jsonSchema:w,path:m.path??[]})};for(const h of[...this.seen.entries()].reverse())a(h[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}`),(y=n.external)!=null&&y.uri){const h=(g=n.external.registry.get(e))==null?void 0:g.id;if(!h)throw new Error("Schema is missing an `id` property");c.$id=n.external.uri(h)}Object.assign(c,s.def);const u=((v=n.external)==null?void 0:v.defs)??{};for(const h of this.seen.entries()){const d=h[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 Gv(t,e){if(t instanceof Vu){const n=new Yu(e),s={};for(const a of t._idmap.entries()){const[c,u]=a;n.process(u)}const o={},i={registry:t,uri:e==null?void 0:e.uri,defs:s};for(const a of t._idmap.entries()){const[c,u]=a;o[c]=n.emit(u,{...e,external:i})}if(Object.keys(s).length>0){const a=n.target==="draft-2020-12"?"$defs":"definitions";o.__shared={[a]:s}}return{schemas:o}}const r=new Yu(e);return r.process(t),r.emit(t,e)}function Ne(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 Ne(s.element,r);case"object":{for(const o in s.shape)if(Ne(s.shape[o],r))return!0;return!1}case"union":{for(const o of s.options)if(Ne(o,r))return!0;return!1}case"intersection":return Ne(s.left,r)||Ne(s.right,r);case"tuple":{for(const o of s.items)if(Ne(o,r))return!0;return!!(s.rest&&Ne(s.rest,r))}case"record":return Ne(s.keyType,r)||Ne(s.valueType,r);case"map":return Ne(s.keyType,r)||Ne(s.valueType,r);case"set":return Ne(s.valueType,r);case"promise":case"optional":case"nonoptional":case"nullable":case"readonly":return Ne(s.innerType,r);case"lazy":return Ne(s.getter(),r);case"default":return Ne(s.innerType,r);case"prefault":return Ne(s.innerType,r);case"custom":return!1;case"transform":return!0;case"pipe":return Ne(s.in,r)||Ne(s.out,r);case"success":return!1;case"catch":return!1}throw new Error(`Unknown schema type: ${s.type}`)}const Yv=T("ZodISODateTime",(t,e)=>{kg.init(t,e),Ee.init(t,e)});function Xv(t){return Tv(Yv,t)}const Qv=T("ZodISODate",(t,e)=>{Eg.init(t,e),Ee.init(t,e)});function ey(t){return xv(Qv,t)}const ty=T("ZodISOTime",(t,e)=>{Pg.init(t,e),Ee.init(t,e)});function ry(t){return Rv(ty,t)}const ny=T("ZodISODuration",(t,e)=>{Tg.init(t,e),Ee.init(t,e)});function sy(t){return Iv(ny,t)}const gs=T("ZodError",(t,e)=>{vu.init(t,e),t.name="ZodError",Object.defineProperties(t,{format:{value:r=>S_(t,r)},flatten:{value:r=>$_(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}),oy=yu(gs),iy=bu(gs),ay=wu(gs),cy=$u(gs),ke=T("ZodType",(t,e)=>(ge.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)=>Ht(t,r,n),t.brand=()=>t,t.register=(r,n)=>(r.add(t,n),t),t.parse=(r,n)=>oy(t,r,n,{callee:t.parse}),t.safeParse=(r,n)=>ay(t,r,n),t.parseAsync=async(r,n)=>iy(t,r,n,{callee:t.parseAsync}),t.safeParseAsync=async(r,n)=>cy(t,r,n),t.spa=t.safeParseAsync,t.refine=(r,n)=>t.check(e0(r,n)),t.superRefine=r=>t.check(t0(r)),t.overwrite=r=>t.check(un(r)),t.optional=()=>re(t),t.nullable=()=>al(t),t.nullish=()=>re(al(t)),t.nonoptional=r=>Wy(t,r),t.array=()=>j(t),t.or=r=>Te([t,r]),t.and=r=>vi(t,r),t.transform=r=>bi(t,ol(r)),t.default=r=>Vy(t,r),t.prefault=r=>Hy(t,r),t.catch=r=>By(t,r),t.pipe=r=>bi(t,r),t.readonly=()=>Yy(t),t.describe=r=>{const n=t.clone();return cn.add(n,{description:r}),n},Object.defineProperty(t,"description",{get(){var r;return(r=cn.get(t))==null?void 0:r.description},configurable:!0}),t.meta=(...r)=>{if(r.length===0)return cn.get(t);const n=t.clone();return cn.add(n,r[0]),n},t.isOptional=()=>t.safeParse(void 0).success,t.isNullable=()=>t.safeParse(null).success,t)),Xu=T("_ZodString",(t,e)=>{pi.init(t,e),ke.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(Mv(...n)),t.includes=(...n)=>t.check(Uv(...n)),t.startsWith=(...n)=>t.check(Dv(...n)),t.endsWith=(...n)=>t.check(qv(...n)),t.min=(...n)=>t.check(_s(...n)),t.max=(...n)=>t.check(Ku(...n)),t.length=(...n)=>t.check(Gu(...n)),t.nonempty=(...n)=>t.check(_s(1,...n)),t.lowercase=n=>t.check(Zv(n)),t.uppercase=n=>t.check(Lv(n)),t.trim=()=>t.check(Fv()),t.normalize=(...n)=>t.check(Vv(...n)),t.toLowerCase=()=>t.check(Hv()),t.toUpperCase=()=>t.check(Wv())}),uy=T("ZodString",(t,e)=>{pi.init(t,e),Xu.init(t,e),t.email=r=>t.check(av(ly,r)),t.url=r=>t.check(Hu(el,r)),t.jwt=r=>t.check(Pv(Py,r)),t.emoji=r=>t.check(fv(fy,r)),t.guid=r=>t.check(Fu(Qu,r)),t.uuid=r=>t.check(cv(vs,r)),t.uuidv4=r=>t.check(uv(vs,r)),t.uuidv6=r=>t.check(lv(vs,r)),t.uuidv7=r=>t.check(dv(vs,r)),t.nanoid=r=>t.check(hv(hy,r)),t.guid=r=>t.check(Fu(Qu,r)),t.cuid=r=>t.check(pv(py,r)),t.cuid2=r=>t.check(mv(my,r)),t.ulid=r=>t.check(_v(_y,r)),t.base64=r=>t.check(Sv(Sy,r)),t.base64url=r=>t.check(kv(ky,r)),t.xid=r=>t.check(gv(gy,r)),t.ksuid=r=>t.check(vv(vy,r)),t.ipv4=r=>t.check(yv(yy,r)),t.ipv6=r=>t.check(bv(by,r)),t.cidrv4=r=>t.check(wv(wy,r)),t.cidrv6=r=>t.check($v($y,r)),t.e164=r=>t.check(Ev(Ey,r)),t.datetime=r=>t.check(Xv(r)),t.date=r=>t.check(ey(r)),t.time=r=>t.check(ry(r)),t.duration=r=>t.check(sy(r))});function $(t){return iv(uy,t)}const Ee=T("ZodStringFormat",(t,e)=>{ye.init(t,e),Xu.init(t,e)}),ly=T("ZodEmail",(t,e)=>{mg.init(t,e),Ee.init(t,e)}),Qu=T("ZodGUID",(t,e)=>{hg.init(t,e),Ee.init(t,e)}),vs=T("ZodUUID",(t,e)=>{pg.init(t,e),Ee.init(t,e)}),el=T("ZodURL",(t,e)=>{_g.init(t,e),Ee.init(t,e)});function dy(t){return Hu(el,t)}const fy=T("ZodEmoji",(t,e)=>{gg.init(t,e),Ee.init(t,e)}),hy=T("ZodNanoID",(t,e)=>{vg.init(t,e),Ee.init(t,e)}),py=T("ZodCUID",(t,e)=>{yg.init(t,e),Ee.init(t,e)}),my=T("ZodCUID2",(t,e)=>{bg.init(t,e),Ee.init(t,e)}),_y=T("ZodULID",(t,e)=>{wg.init(t,e),Ee.init(t,e)}),gy=T("ZodXID",(t,e)=>{$g.init(t,e),Ee.init(t,e)}),vy=T("ZodKSUID",(t,e)=>{Sg.init(t,e),Ee.init(t,e)}),yy=T("ZodIPv4",(t,e)=>{xg.init(t,e),Ee.init(t,e)}),by=T("ZodIPv6",(t,e)=>{Rg.init(t,e),Ee.init(t,e)}),wy=T("ZodCIDRv4",(t,e)=>{Ig.init(t,e),Ee.init(t,e)}),$y=T("ZodCIDRv6",(t,e)=>{Cg.init(t,e),Ee.init(t,e)}),Sy=T("ZodBase64",(t,e)=>{Og.init(t,e),Ee.init(t,e)}),ky=T("ZodBase64URL",(t,e)=>{jg.init(t,e),Ee.init(t,e)}),Ey=T("ZodE164",(t,e)=>{Ag.init(t,e),Ee.init(t,e)}),Py=T("ZodJWT",(t,e)=>{Mg.init(t,e),Ee.init(t,e)}),tl=T("ZodNumber",(t,e)=>{Cu.init(t,e),ke.init(t,e),t.gt=(n,s)=>t.check(Ju(n,s)),t.gte=(n,s)=>t.check(gi(n,s)),t.min=(n,s)=>t.check(gi(n,s)),t.lt=(n,s)=>t.check(Wu(n,s)),t.lte=(n,s)=>t.check(_i(n,s)),t.max=(n,s)=>t.check(_i(n,s)),t.int=n=>t.check(rl(n)),t.safe=n=>t.check(rl(n)),t.positive=n=>t.check(Ju(0,n)),t.nonnegative=n=>t.check(gi(0,n)),t.negative=n=>t.check(Wu(0,n)),t.nonpositive=n=>t.check(_i(0,n)),t.multipleOf=(n,s)=>t.check(Bu(n,s)),t.step=(n,s)=>t.check(Bu(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 be(t){return Cv(tl,t)}const Ty=T("ZodNumberFormat",(t,e)=>{Zg.init(t,e),tl.init(t,e)});function rl(t){return Ov(Ty,t)}const xy=T("ZodBoolean",(t,e)=>{Lg.init(t,e),ke.init(t,e)});function we(t){return Nv(xy,t)}const Ry=T("ZodAny",(t,e)=>{Ug.init(t,e),ke.init(t,e)});function Iy(){return jv(Ry)}const Cy=T("ZodUnknown",(t,e)=>{Dg.init(t,e),ke.init(t,e)});function Re(){return Av(Cy)}const Oy=T("ZodNever",(t,e)=>{qg.init(t,e),ke.init(t,e)});function Ny(t){return zv(Oy,t)}const jy=T("ZodArray",(t,e)=>{Vg.init(t,e),ke.init(t,e),t.element=e.element,t.min=(r,n)=>t.check(_s(r,n)),t.nonempty=r=>t.check(_s(1,r)),t.max=(r,n)=>t.check(Ku(r,n)),t.length=(r,n)=>t.check(Gu(r,n)),t.unwrap=()=>t.element});function j(t,e){return Jv(jy,t,e)}const nl=T("ZodObject",(t,e)=>{ju.init(t,e),ke.init(t,e),_e(t,"shape",()=>e.shape),t.keyof=()=>lt(Object.keys(t._zod.def.shape)),t.catchall=r=>t.clone({...t._zod.def,catchall:r}),t.passthrough=()=>t.clone({...t._zod.def,catchall:Re()}),t.loose=()=>t.clone({...t._zod.def,catchall:Re()}),t.strict=()=>t.clone({...t._zod.def,catchall:Ny()}),t.strip=()=>t.clone({...t._zod.def,catchall:void 0}),t.extend=r=>v_(t,r),t.merge=r=>y_(t,r),t.pick=r=>__(t,r),t.omit=r=>g_(t,r),t.partial=(...r)=>b_(il,t,r[0]),t.required=(...r)=>w_(cl,t,r[0])});function z(t,e){const r={type:"object",get shape(){return rn(this,"shape",{...t}),this.shape},...D(e)};return new nl(r)}function ut(t,e){return new nl({type:"object",get shape(){return rn(this,"shape",{...t}),this.shape},catchall:Re(),...D(e)})}const sl=T("ZodUnion",(t,e)=>{zu.init(t,e),ke.init(t,e),t.options=e.options});function Te(t,e){return new sl({type:"union",options:t,...D(e)})}const Ay=T("ZodDiscriminatedUnion",(t,e)=>{sl.init(t,e),Fg.init(t,e)});function zy(t,e,r){return new Ay({type:"union",options:e,discriminator:t,...D(r)})}const My=T("ZodIntersection",(t,e)=>{Hg.init(t,e),ke.init(t,e)});function vi(t,e){return new My({type:"intersection",left:t,right:e})}const Zy=T("ZodRecord",(t,e)=>{Wg.init(t,e),ke.init(t,e),t.keyType=e.keyType,t.valueType=e.valueType});function Ie(t,e,r){return new Zy({type:"record",keyType:t,valueType:e,...D(r)})}const yi=T("ZodEnum",(t,e)=>{Jg.init(t,e),ke.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 o={};for(const i of n)if(r.has(i))o[i]=e.entries[i];else throw new Error(`Key ${i} not found in enum`);return new yi({...e,checks:[],...D(s),entries:o})},t.exclude=(n,s)=>{const o={...e.entries};for(const i of n)if(r.has(i))delete o[i];else throw new Error(`Key ${i} not found in enum`);return new yi({...e,checks:[],...D(s),entries:o})}});function lt(t,e){const r=Array.isArray(t)?Object.fromEntries(t.map(n=>[n,n])):t;return new yi({type:"enum",entries:r,...D(e)})}const Ly=T("ZodLiteral",(t,e)=>{Bg.init(t,e),ke.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 W(t,e){return new Ly({type:"literal",values:Array.isArray(t)?t:[t],...D(e)})}const Uy=T("ZodTransform",(t,e)=>{Kg.init(t,e),ke.init(t,e),t._zod.parse=(r,n)=>{r.addIssue=o=>{if(typeof o=="string")r.issues.push(an(o,r.value,e));else{const i=o;i.fatal&&(i.continue=!1),i.code??(i.code="custom"),i.input??(i.input=r.value),i.inst??(i.inst=t),i.continue??(i.continue=!0),r.issues.push(an(i))}};const s=e.transform(r.value,r);return s instanceof Promise?s.then(o=>(r.value=o,r)):(r.value=s,r)}});function ol(t){return new Uy({type:"transform",transform:t})}const il=T("ZodOptional",(t,e)=>{Gg.init(t,e),ke.init(t,e),t.unwrap=()=>t._zod.def.innerType});function re(t){return new il({type:"optional",innerType:t})}const Dy=T("ZodNullable",(t,e)=>{Yg.init(t,e),ke.init(t,e),t.unwrap=()=>t._zod.def.innerType});function al(t){return new Dy({type:"nullable",innerType:t})}const qy=T("ZodDefault",(t,e)=>{Xg.init(t,e),ke.init(t,e),t.unwrap=()=>t._zod.def.innerType,t.removeDefault=t.unwrap});function Vy(t,e){return new qy({type:"default",innerType:t,get defaultValue(){return typeof e=="function"?e():e}})}const Fy=T("ZodPrefault",(t,e)=>{Qg.init(t,e),ke.init(t,e),t.unwrap=()=>t._zod.def.innerType});function Hy(t,e){return new Fy({type:"prefault",innerType:t,get defaultValue(){return typeof e=="function"?e():e}})}const cl=T("ZodNonOptional",(t,e)=>{ev.init(t,e),ke.init(t,e),t.unwrap=()=>t._zod.def.innerType});function Wy(t,e){return new cl({type:"nonoptional",innerType:t,...D(e)})}const Jy=T("ZodCatch",(t,e)=>{tv.init(t,e),ke.init(t,e),t.unwrap=()=>t._zod.def.innerType,t.removeCatch=t.unwrap});function By(t,e){return new Jy({type:"catch",innerType:t,catchValue:typeof e=="function"?e:()=>e})}const Ky=T("ZodPipe",(t,e)=>{rv.init(t,e),ke.init(t,e),t.in=e.in,t.out=e.out});function bi(t,e){return new Ky({type:"pipe",in:t,out:e})}const Gy=T("ZodReadonly",(t,e)=>{nv.init(t,e),ke.init(t,e)});function Yy(t){return new Gy({type:"readonly",innerType:t})}const ul=T("ZodCustom",(t,e)=>{sv.init(t,e),ke.init(t,e)});function Xy(t){const e=new Ke({check:"custom"});return e._zod.check=t,e}function Qy(t,e){return Bv(ul,t??(()=>!0),e)}function e0(t,e={}){return Kv(ul,t,e)}function t0(t){const e=Xy(r=>(r.addIssue=n=>{if(typeof n=="string")r.issues.push(an(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(an(s))}},t(r.value,r)));return e}function r0(t,e){return bi(ol(t),e)}const n0={custom:"custom"},ln="2025-06-18",ll=[ln,"2025-03-26","2024-11-05","2024-10-07"],ys="2.0",kt=Qy(t=>t!==null&&(typeof t=="object"||typeof t=="function")),dl=Te([$(),be().int()]),fl=$(),s0=ut({progressToken:dl.optional()}),dt=ut({_meta:s0.optional()}),Ge=z({method:$(),params:dt.optional()}),Tr=ut({_meta:Ie($(),Re()).optional()}),ft=z({method:$(),params:Tr.optional()}),nt=ut({_meta:Ie($(),Re()).optional()}),bs=Te([$(),be().int()]),hl=z({jsonrpc:W(ys),id:bs,...Ge.shape}).strict(),pl=t=>hl.safeParse(t).success,ml=z({jsonrpc:W(ys),...ft.shape}).strict(),o0=t=>ml.safeParse(t).success,_l=z({jsonrpc:W(ys),id:bs,result:nt}).strict(),wi=t=>_l.safeParse(t).success;var ie;(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"})(ie||(ie={}));const gl=z({jsonrpc:W(ys),id:bs,error:z({code:be().int(),message:$(),data:re(Re())})}).strict(),i0=t=>gl.safeParse(t).success,cr=Te([hl,ml,_l,gl]),Jt=nt.strict(),a0=Tr.extend({requestId:bs,reason:$().optional()}),$i=ft.extend({method:W("notifications/cancelled"),params:a0}),c0=z({src:$(),mimeType:$().optional(),sizes:j($()).optional()}),dn=z({icons:j(c0).optional()}),xr=z({name:$(),title:$().optional()}),vl=xr.extend({...xr.shape,...dn.shape,version:$(),websiteUrl:$().optional()}),u0=vi(z({applyDefaults:we().optional()}),Ie($(),Re())),l0=r0(t=>t&&typeof t=="object"&&!Array.isArray(t)&&Object.keys(t).length===0?{form:{}}:t,vi(z({form:u0.optional(),url:kt.optional()}),Ie($(),Re()).optional())),d0=z({experimental:Ie($(),kt).optional(),sampling:z({context:kt.optional(),tools:kt.optional()}).optional(),elicitation:l0.optional(),roots:z({listChanged:we().optional()}).optional()}),f0=dt.extend({protocolVersion:$(),capabilities:d0,clientInfo:vl}),yl=Ge.extend({method:W("initialize"),params:f0}),h0=z({experimental:Ie($(),kt).optional(),logging:kt.optional(),completions:kt.optional(),prompts:re(z({listChanged:re(we())})),resources:z({subscribe:we().optional(),listChanged:we().optional()}).optional(),tools:z({listChanged:we().optional()}).optional()}),bl=nt.extend({protocolVersion:$(),capabilities:h0,serverInfo:vl,instructions:$().optional()}),Si=ft.extend({method:W("notifications/initialized")}),p0=t=>Si.safeParse(t).success,ki=Ge.extend({method:W("ping")}),m0=z({progress:be(),total:re(be()),message:re($())}),_0=z({...Tr.shape,...m0.shape,progressToken:dl}),Ei=ft.extend({method:W("notifications/progress"),params:_0}),g0=dt.extend({cursor:fl.optional()}),ws=Ge.extend({params:g0.optional()}),$s=nt.extend({nextCursor:re(fl)}),wl=z({uri:$(),mimeType:re($()),_meta:Ie($(),Re()).optional()}),$l=wl.extend({text:$()}),Pi=$().refine(t=>{try{return atob(t),!0}catch{return!1}},{message:"Invalid Base64 string"}),Sl=wl.extend({blob:Pi}),kl=z({...xr.shape,...dn.shape,uri:$(),description:re($()),mimeType:re($()),_meta:re(ut({}))}),v0=z({...xr.shape,...dn.shape,uriTemplate:$(),description:re($()),mimeType:re($()),_meta:re(ut({}))}),Ss=ws.extend({method:W("resources/list")}),El=$s.extend({resources:j(kl)}),Ti=ws.extend({method:W("resources/templates/list")}),Pl=$s.extend({resourceTemplates:j(v0)}),xi=dt.extend({uri:$()}),y0=xi,Ri=Ge.extend({method:W("resources/read"),params:y0}),Tl=nt.extend({contents:j(Te([$l,Sl]))}),xl=ft.extend({method:W("notifications/resources/list_changed")}),b0=xi,Rl=Ge.extend({method:W("resources/subscribe"),params:b0}),w0=xi,Il=Ge.extend({method:W("resources/unsubscribe"),params:w0}),$0=Tr.extend({uri:$()}),Cl=ft.extend({method:W("notifications/resources/updated"),params:$0}),S0=z({name:$(),description:re($()),required:re(we())}),k0=z({...xr.shape,...dn.shape,description:re($()),arguments:re(j(S0)),_meta:re(ut({}))}),Ii=ws.extend({method:W("prompts/list")}),Ol=$s.extend({prompts:j(k0)}),E0=dt.extend({name:$(),arguments:Ie($(),$()).optional()}),Ci=Ge.extend({method:W("prompts/get"),params:E0}),Nl=z({type:W("text"),text:$(),_meta:Ie($(),Re()).optional()}),jl=z({type:W("image"),data:Pi,mimeType:$(),_meta:Ie($(),Re()).optional()}),Al=z({type:W("audio"),data:Pi,mimeType:$(),_meta:Ie($(),Re()).optional()}),P0=z({type:W("tool_use"),name:$(),id:$(),input:z({}).passthrough(),_meta:re(z({}).passthrough())}).passthrough(),T0=z({type:W("resource"),resource:Te([$l,Sl]),_meta:Ie($(),Re()).optional()}),x0=kl.extend({type:W("resource_link")}),Oi=Te([Nl,jl,Al,x0,T0]),R0=z({role:lt(["user","assistant"]),content:Oi}),zl=nt.extend({description:re($()),messages:j(R0)}),Ml=ft.extend({method:W("notifications/prompts/list_changed")}),I0=z({title:$().optional(),readOnlyHint:we().optional(),destructiveHint:we().optional(),idempotentHint:we().optional(),openWorldHint:we().optional()}),Zl=z({...xr.shape,...dn.shape,description:$().optional(),inputSchema:z({type:W("object"),properties:Ie($(),kt).optional(),required:j($()).optional()}).catchall(Re()),outputSchema:z({type:W("object"),properties:Ie($(),kt).optional(),required:j($()).optional()}).catchall(Re()).optional(),annotations:re(I0),_meta:Ie($(),Re()).optional()}),Ni=ws.extend({method:W("tools/list")}),Ll=$s.extend({tools:j(Zl)}),ks=nt.extend({content:j(Oi).default([]),structuredContent:Ie($(),Re()).optional(),isError:re(we())});ks.or(nt.extend({toolResult:Re()}));const C0=dt.extend({name:$(),arguments:re(Ie($(),Re()))}),ji=Ge.extend({method:W("tools/call"),params:C0}),Ul=ft.extend({method:W("notifications/tools/list_changed")}),Es=lt(["debug","info","notice","warning","error","critical","alert","emergency"]),O0=dt.extend({level:Es}),Ps=Ge.extend({method:W("logging/setLevel"),params:O0}),N0=Tr.extend({level:Es,logger:$().optional(),data:Re()}),Dl=ft.extend({method:W("notifications/message"),params:N0}),j0=z({name:$().optional()}),A0=z({hints:re(j(j0)),costPriority:re(be().min(0).max(1)),speedPriority:re(be().min(0).max(1)),intelligencePriority:re(be().min(0).max(1))}),z0=z({mode:re(lt(["auto","required","none"]))}),M0=z({type:W("tool_result"),toolUseId:$().describe("The unique identifier for the corresponding tool call."),content:j(Oi).default([]),structuredContent:z({}).passthrough().optional(),isError:re(we()),_meta:re(z({}).passthrough())}).passthrough(),Ts=zy("type",[Nl,jl,Al,P0,M0]),Z0=z({role:lt(["user","assistant"]),content:Te([Ts,j(Ts)]),_meta:re(z({}).passthrough())}).passthrough(),L0=dt.extend({messages:j(Z0),modelPreferences:A0.optional(),systemPrompt:$().optional(),includeContext:lt(["none","thisServer","allServers"]).optional(),temperature:be().optional(),maxTokens:be().int(),stopSequences:j($()).optional(),metadata:kt.optional(),tools:re(j(Zl)),toolChoice:re(z0)}),ql=Ge.extend({method:W("sampling/createMessage"),params:L0}),Ai=nt.extend({model:$(),stopReason:re(lt(["endTurn","stopSequence","maxTokens","toolUse"]).or($())),role:lt(["user","assistant"]),content:Te([Ts,j(Ts)])}),U0=z({type:W("boolean"),title:$().optional(),description:$().optional(),default:we().optional()}),D0=z({type:W("string"),title:$().optional(),description:$().optional(),minLength:be().optional(),maxLength:be().optional(),format:lt(["email","uri","date","date-time"]).optional(),default:$().optional()}),q0=z({type:lt(["number","integer"]),title:$().optional(),description:$().optional(),minimum:be().optional(),maximum:be().optional(),default:be().optional()}),V0=z({type:W("string"),title:$().optional(),description:$().optional(),enum:j($()),default:$().optional()}),F0=z({type:W("string"),title:$().optional(),description:$().optional(),oneOf:j(z({const:$(),title:$()})),default:$().optional()}),H0=z({type:W("string"),title:$().optional(),description:$().optional(),enum:j($()),enumNames:j($()).optional(),default:$().optional()}),W0=Te([V0,F0]),J0=z({type:W("array"),title:$().optional(),description:$().optional(),minItems:be().optional(),maxItems:be().optional(),items:z({type:W("string"),enum:j($())}),default:j($()).optional()}),B0=z({type:W("array"),title:$().optional(),description:$().optional(),minItems:be().optional(),maxItems:be().optional(),items:z({anyOf:j(z({const:$(),title:$()}))}),default:j($()).optional()}),K0=Te([J0,B0]),G0=Te([H0,W0,K0]),Y0=Te([G0,U0,D0,q0]),X0=dt.extend({mode:W("form").optional(),message:$(),requestedSchema:z({type:W("object"),properties:Ie($(),Y0),required:j($()).optional()})}),Q0=dt.extend({mode:W("url"),message:$(),elicitationId:$(),url:$().url()}),eb=Te([X0,Q0]),zi=Ge.extend({method:W("elicitation/create"),params:eb}),tb=Tr.extend({elicitationId:$()}),rb=ft.extend({method:W("notifications/elicitation/complete"),params:tb}),fn=nt.extend({action:lt(["accept","decline","cancel"]),content:Ie($(),Te([$(),be(),we(),j($())])).optional()}),nb=z({type:W("ref/resource"),uri:$()}),sb=z({type:W("ref/prompt"),name:$()}),ob=dt.extend({ref:Te([sb,nb]),argument:z({name:$(),value:$()}),context:z({arguments:Ie($(),$()).optional()}).optional()}),Mi=Ge.extend({method:W("completion/complete"),params:ob});function ib(t){if(t.params.ref.type!=="ref/prompt")throw new TypeError(`Expected CompleteRequestPrompt, but got ${t.params.ref.type}`)}function ab(t){if(t.params.ref.type!=="ref/resource")throw new TypeError(`Expected CompleteRequestResourceTemplate, but got ${t.params.ref.type}`)}const Vl=nt.extend({completion:ut({values:j($()).max(100),total:re(be().int()),hasMore:re(we())})}),cb=z({uri:$().startsWith("file://"),name:$().optional(),_meta:Ie($(),Re()).optional()}),Fl=Ge.extend({method:W("roots/list")}),Zi=nt.extend({roots:j(cb)}),Hl=ft.extend({method:W("notifications/roots/list_changed")});Te([ki,yl,Mi,Ps,Ci,Ii,Ss,Ti,Ri,Rl,Il,ji,Ni]),Te([$i,Ei,Si,Hl]),Te([Jt,Ai,fn,Zi]),Te([ki,ql,zi,Fl]),Te([$i,Ei,Dl,Cl,xl,Ul,Ml,rb]),Te([Jt,bl,Vl,zl,Ol,El,Pl,Tl,ks,Ll]);class ae 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===ie.UrlElicitationRequired&&n){const s=n;if(s.elicitations)return new ub(s.elicitations,r)}return new ae(e,r,n)}}class ub extends ae{constructor(e,r=`URL elicitation${e.length>1?"s":""} required`){super(ie.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:[]}}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 o={};for(const i of s)o[i]=i;return o},t.getValidEnumValues=s=>{const o=t.objectKeys(s).filter(a=>typeof s[s[a]]!="number"),i={};for(const a of o)i[a]=s[a];return t.objectValues(i)},t.objectValues=s=>t.objectKeys(s).map(function(o){return s[o]}),t.objectKeys=typeof Object.keys=="function"?s=>Object.keys(s):s=>{const o=[];for(const i in s)Object.prototype.hasOwnProperty.call(s,i)&&o.push(i);return o},t.find=(s,o)=>{for(const i of s)if(o(i))return i},t.isInteger=typeof Number.isInteger=="function"?s=>Number.isInteger(s):s=>typeof s=="number"&&Number.isFinite(s)&&Math.floor(s)===s;function n(s,o=" | "){return s.map(i=>typeof i=="string"?`'${i}'`:i).join(o)}t.joinValues=n,t.jsonStringifyReplacer=(s,o)=>typeof o=="bigint"?o.toString():o})(oe||(oe={}));var Li;(function(t){t.mergeShapes=(e,r)=>({...e,...r})})(Li||(Li={}));const Z=oe.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Nt=t=>{switch(typeof t){case"undefined":return Z.undefined;case"string":return Z.string;case"number":return Number.isNaN(t)?Z.nan:Z.number;case"boolean":return Z.boolean;case"function":return Z.function;case"bigint":return Z.bigint;case"symbol":return Z.symbol;case"object":return Array.isArray(t)?Z.array:t===null?Z.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?Z.promise:typeof Map<"u"&&t instanceof Map?Z.map:typeof Set<"u"&&t instanceof Set?Z.set:typeof Date<"u"&&t instanceof Date?Z.date:Z.object;default:return Z.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"]),lb=t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:");class et 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(o){return o.message},n={_errors:[]},s=o=>{for(const i of o.issues)if(i.code==="invalid_union")i.unionErrors.map(s);else if(i.code==="invalid_return_type")s(i.returnTypeError);else if(i.code==="invalid_arguments")s(i.argumentsError);else if(i.path.length===0)n._errors.push(r(i));else{let a=n,c=0;for(;c<i.path.length;){const u=i.path[c];c===i.path.length-1?(a[u]=a[u]||{_errors:[]},a[u]._errors.push(r(i))):a[u]=a[u]||{_errors:[]},a=a[u],c++}}};return s(this),n}static assert(e){if(!(e instanceof et))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 o=s.path[0];r[o]=r[o]||[],r[o].push(e(s))}else n.push(e(s));return{formErrors:n,fieldErrors:r}}get formErrors(){return this.flatten()}}et.create=t=>new et(t);const Rr=(t,e)=>{let r;switch(t.code){case I.invalid_type:t.received===Z.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 Wl=Rr;function db(t){Wl=t}function xs(){return Wl}const Rs=t=>{const{data:e,path:r,errorMaps:n,issueData:s}=t,o=[...r,...s.path||[]],i={...s,path:o};if(s.message!==void 0)return{...s,path:o,message:s.message};let a="";const c=n.filter(u=>!!u).slice().reverse();for(const u of c)a=u(i,{data:e,defaultError:a}).message;return{...s,path:o,message:a}},fb=[];function A(t,e){const r=xs(),n=Rs({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,r,r===Rr?void 0:Rr].filter(s=>!!s)});t.common.issues.push(n)}class Ve{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 o=await s.key,i=await s.value;n.push({key:o,value:i})}return Ve.mergeObjectSync(e,n)}static mergeObjectSync(e,r){const n={};for(const s of r){const{key:o,value:i}=s;if(o.status==="aborted"||i.status==="aborted")return J;o.status==="dirty"&&e.dirty(),i.status==="dirty"&&e.dirty(),o.value!=="__proto__"&&(typeof i.value<"u"||s.alwaysSet)&&(n[o.value]=i.value)}return{status:e.value,value:n}}}const J=Object.freeze({status:"aborted"}),Ir=t=>({status:"dirty",value:t}),He=t=>({status:"valid",value:t}),Ui=t=>t.status==="aborted",Di=t=>t.status==="dirty",ur=t=>t.status==="valid",hn=t=>typeof Promise<"u"&&t instanceof Promise;var L;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(L||(L={}));class Et{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 Jl=(t,e)=>{if(ur(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 et(t.common.issues);return this._error=r,this._error}}};function Y(t){if(!t)return{};const{errorMap:e,invalid_type_error:r,required_error:n,description:s}=t;if(e&&(r||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:s}:{errorMap:(i,a)=>{const{message:c}=t;return i.code==="invalid_enum_value"?{message:c??a.defaultError}:typeof a.data>"u"?{message:c??n??a.defaultError}:i.code!=="invalid_type"?{message:a.defaultError}:{message:c??r??a.defaultError}},description:s}}class ee{get description(){return this._def.description}_getType(e){return Nt(e.data)}_getOrReturnCtx(e,r){return r||{common:e.parent.common,data:e.data,parsedType:Nt(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new Ve,ctx:{common:e.parent.common,data:e.data,parsedType:Nt(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const r=this._parse(e);if(hn(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:Nt(e)},s=this._parseSync({data:e,path:n.path,parent:n});return Jl(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:Nt(e)};if(!this["~standard"].async)try{const o=this._parseSync({data:e,path:[],parent:r});return ur(o)?{value:o.value}:{issues:r.common.issues}}catch(o){(s=(n=o==null?void 0:o.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(o=>ur(o)?{value:o.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:Nt(e)},s=this._parse({data:e,path:n.path,parent:n}),o=await(hn(s)?s:Promise.resolve(s));return Jl(n,o)}refine(e,r){const n=s=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(s):r;return this._refinement((s,o)=>{const i=e(s),a=()=>o.addIssue({code:I.custom,...n(s)});return typeof Promise<"u"&&i instanceof Promise?i.then(c=>c?!0:(a(),!1)):i?!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 mt({schema:this,typeName:C.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 Tt.create(this,this._def)}nullable(){return Yt.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return pt.create(this)}promise(){return jr.create(this,this._def)}or(e){return gn.create([this,e],this._def)}and(e){return vn.create(this,e,this._def)}transform(e){return new mt({...Y(this._def),schema:this,typeName:C.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const r=typeof e=="function"?e:()=>e;return new Sn({...Y(this._def),innerType:this,defaultValue:r,typeName:C.ZodDefault})}brand(){return new Fi({typeName:C.ZodBranded,type:this,...Y(this._def)})}catch(e){const r=typeof e=="function"?e:()=>e;return new kn({...Y(this._def),innerType:this,catchValue:r,typeName:C.ZodCatch})}describe(e){const r=this.constructor;return new r({...this._def,description:e})}pipe(e){return En.create(this,e)}readonly(){return Pn.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const hb=/^c[^\s-]{8,}$/i,pb=/^[0-9a-z]+$/,mb=/^[0-9A-HJKMNP-TV-Z]{26}$/i,_b=/^[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,gb=/^[a-z0-9_-]{21}$/i,vb=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,yb=/^[-+]?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)?)??$/,bb=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,wb="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let qi;const $b=/^(?:(?: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])$/,Sb=/^(?:(?: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])$/,kb=/^(([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]))$/,Eb=/^(([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])$/,Pb=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Tb=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Bl="((\\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])))",xb=new RegExp(`^${Bl}$`);function Kl(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 Rb(t){return new RegExp(`^${Kl(t)}$`)}function Gl(t){let e=`${Bl}T${Kl(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 Ib(t,e){return!!((e==="v4"||!e)&&$b.test(t)||(e==="v6"||!e)&&kb.test(t))}function Cb(t,e){if(!vb.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 Ob(t,e){return!!((e==="v4"||!e)&&Sb.test(t)||(e==="v6"||!e)&&Eb.test(t))}class ht extends ee{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==Z.string){const o=this._getOrReturnCtx(e);return A(o,{code:I.invalid_type,expected:Z.string,received:o.parsedType}),J}const n=new Ve;let s;for(const o of this._def.checks)if(o.kind==="min")e.data.length<o.value&&(s=this._getOrReturnCtx(e,s),A(s,{code:I.too_small,minimum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),n.dirty());else if(o.kind==="max")e.data.length>o.value&&(s=this._getOrReturnCtx(e,s),A(s,{code:I.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),n.dirty());else if(o.kind==="length"){const i=e.data.length>o.value,a=e.data.length<o.value;(i||a)&&(s=this._getOrReturnCtx(e,s),i?A(s,{code:I.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message}):a&&A(s,{code:I.too_small,minimum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message}),n.dirty())}else if(o.kind==="email")bb.test(e.data)||(s=this._getOrReturnCtx(e,s),A(s,{validation:"email",code:I.invalid_string,message:o.message}),n.dirty());else if(o.kind==="emoji")qi||(qi=new RegExp(wb,"u")),qi.test(e.data)||(s=this._getOrReturnCtx(e,s),A(s,{validation:"emoji",code:I.invalid_string,message:o.message}),n.dirty());else if(o.kind==="uuid")_b.test(e.data)||(s=this._getOrReturnCtx(e,s),A(s,{validation:"uuid",code:I.invalid_string,message:o.message}),n.dirty());else if(o.kind==="nanoid")gb.test(e.data)||(s=this._getOrReturnCtx(e,s),A(s,{validation:"nanoid",code:I.invalid_string,message:o.message}),n.dirty());else if(o.kind==="cuid")hb.test(e.data)||(s=this._getOrReturnCtx(e,s),A(s,{validation:"cuid",code:I.invalid_string,message:o.message}),n.dirty());else if(o.kind==="cuid2")pb.test(e.data)||(s=this._getOrReturnCtx(e,s),A(s,{validation:"cuid2",code:I.invalid_string,message:o.message}),n.dirty());else if(o.kind==="ulid")mb.test(e.data)||(s=this._getOrReturnCtx(e,s),A(s,{validation:"ulid",code:I.invalid_string,message:o.message}),n.dirty());else if(o.kind==="url")try{new URL(e.data)}catch{s=this._getOrReturnCtx(e,s),A(s,{validation:"url",code:I.invalid_string,message:o.message}),n.dirty()}else o.kind==="regex"?(o.regex.lastIndex=0,o.regex.test(e.data)||(s=this._getOrReturnCtx(e,s),A(s,{validation:"regex",code:I.invalid_string,message:o.message}),n.dirty())):o.kind==="trim"?e.data=e.data.trim():o.kind==="includes"?e.data.includes(o.value,o.position)||(s=this._getOrReturnCtx(e,s),A(s,{code:I.invalid_string,validation:{includes:o.value,position:o.position},message:o.message}),n.dirty()):o.kind==="toLowerCase"?e.data=e.data.toLowerCase():o.kind==="toUpperCase"?e.data=e.data.toUpperCase():o.kind==="startsWith"?e.data.startsWith(o.value)||(s=this._getOrReturnCtx(e,s),A(s,{code:I.invalid_string,validation:{startsWith:o.value},message:o.message}),n.dirty()):o.kind==="endsWith"?e.data.endsWith(o.value)||(s=this._getOrReturnCtx(e,s),A(s,{code:I.invalid_string,validation:{endsWith:o.value},message:o.message}),n.dirty()):o.kind==="datetime"?Gl(o).test(e.data)||(s=this._getOrReturnCtx(e,s),A(s,{code:I.invalid_string,validation:"datetime",message:o.message}),n.dirty()):o.kind==="date"?xb.test(e.data)||(s=this._getOrReturnCtx(e,s),A(s,{code:I.invalid_string,validation:"date",message:o.message}),n.dirty()):o.kind==="time"?Rb(o).test(e.data)||(s=this._getOrReturnCtx(e,s),A(s,{code:I.invalid_string,validation:"time",message:o.message}),n.dirty()):o.kind==="duration"?yb.test(e.data)||(s=this._getOrReturnCtx(e,s),A(s,{validation:"duration",code:I.invalid_string,message:o.message}),n.dirty()):o.kind==="ip"?Ib(e.data,o.version)||(s=this._getOrReturnCtx(e,s),A(s,{validation:"ip",code:I.invalid_string,message:o.message}),n.dirty()):o.kind==="jwt"?Cb(e.data,o.alg)||(s=this._getOrReturnCtx(e,s),A(s,{validation:"jwt",code:I.invalid_string,message:o.message}),n.dirty()):o.kind==="cidr"?Ob(e.data,o.version)||(s=this._getOrReturnCtx(e,s),A(s,{validation:"cidr",code:I.invalid_string,message:o.message}),n.dirty()):o.kind==="base64"?Pb.test(e.data)||(s=this._getOrReturnCtx(e,s),A(s,{validation:"base64",code:I.invalid_string,message:o.message}),n.dirty()):o.kind==="base64url"?Tb.test(e.data)||(s=this._getOrReturnCtx(e,s),A(s,{validation:"base64url",code:I.invalid_string,message:o.message}),n.dirty()):oe.assertNever(o);return{status:n.value,value:e.data}}_regex(e,r,n){return this.refinement(s=>e.test(s),{validation:r,code:I.invalid_string,...L.errToObj(n)})}_addCheck(e){return new ht({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...L.errToObj(e)})}url(e){return this._addCheck({kind:"url",...L.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...L.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...L.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...L.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...L.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...L.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...L.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...L.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...L.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...L.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...L.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...L.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,...L.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,...L.errToObj(e==null?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...L.errToObj(e)})}regex(e,r){return this._addCheck({kind:"regex",regex:e,...L.errToObj(r)})}includes(e,r){return this._addCheck({kind:"includes",value:e,position:r==null?void 0:r.position,...L.errToObj(r==null?void 0:r.message)})}startsWith(e,r){return this._addCheck({kind:"startsWith",value:e,...L.errToObj(r)})}endsWith(e,r){return this._addCheck({kind:"endsWith",value:e,...L.errToObj(r)})}min(e,r){return this._addCheck({kind:"min",value:e,...L.errToObj(r)})}max(e,r){return this._addCheck({kind:"max",value:e,...L.errToObj(r)})}length(e,r){return this._addCheck({kind:"length",value:e,...L.errToObj(r)})}nonempty(e){return this.min(1,L.errToObj(e))}trim(){return new ht({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new ht({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new ht({...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}}ht.create=t=>new ht({checks:[],typeName:C.ZodString,coerce:(t==null?void 0:t.coerce)??!1,...Y(t)});function Nb(t,e){const r=(t.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,s=r>n?r:n,o=Number.parseInt(t.toFixed(s).replace(".","")),i=Number.parseInt(e.toFixed(s).replace(".",""));return o%i/10**s}class Bt extends ee{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)!==Z.number){const o=this._getOrReturnCtx(e);return A(o,{code:I.invalid_type,expected:Z.number,received:o.parsedType}),J}let n;const s=new Ve;for(const o of this._def.checks)o.kind==="int"?oe.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),A(n,{code:I.invalid_type,expected:"integer",received:"float",message:o.message}),s.dirty()):o.kind==="min"?(o.inclusive?e.data<o.value:e.data<=o.value)&&(n=this._getOrReturnCtx(e,n),A(n,{code:I.too_small,minimum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),s.dirty()):o.kind==="max"?(o.inclusive?e.data>o.value:e.data>=o.value)&&(n=this._getOrReturnCtx(e,n),A(n,{code:I.too_big,maximum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),s.dirty()):o.kind==="multipleOf"?Nb(e.data,o.value)!==0&&(n=this._getOrReturnCtx(e,n),A(n,{code:I.not_multiple_of,multipleOf:o.value,message:o.message}),s.dirty()):o.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),A(n,{code:I.not_finite,message:o.message}),s.dirty()):oe.assertNever(o);return{status:s.value,value:e.data}}gte(e,r){return this.setLimit("min",e,!0,L.toString(r))}gt(e,r){return this.setLimit("min",e,!1,L.toString(r))}lte(e,r){return this.setLimit("max",e,!0,L.toString(r))}lt(e,r){return this.setLimit("max",e,!1,L.toString(r))}setLimit(e,r,n,s){return new Bt({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:L.toString(s)}]})}_addCheck(e){return new Bt({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:L.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:L.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:L.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:L.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:L.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:L.toString(r)})}finite(e){return this._addCheck({kind:"finite",message:L.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:L.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:L.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)}}Bt.create=t=>new Bt({checks:[],typeName:C.ZodNumber,coerce:(t==null?void 0:t.coerce)||!1,...Y(t)});class Kt extends ee{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)!==Z.bigint)return this._getInvalidInput(e);let n;const s=new Ve;for(const o of this._def.checks)o.kind==="min"?(o.inclusive?e.data<o.value:e.data<=o.value)&&(n=this._getOrReturnCtx(e,n),A(n,{code:I.too_small,type:"bigint",minimum:o.value,inclusive:o.inclusive,message:o.message}),s.dirty()):o.kind==="max"?(o.inclusive?e.data>o.value:e.data>=o.value)&&(n=this._getOrReturnCtx(e,n),A(n,{code:I.too_big,type:"bigint",maximum:o.value,inclusive:o.inclusive,message:o.message}),s.dirty()):o.kind==="multipleOf"?e.data%o.value!==BigInt(0)&&(n=this._getOrReturnCtx(e,n),A(n,{code:I.not_multiple_of,multipleOf:o.value,message:o.message}),s.dirty()):oe.assertNever(o);return{status:s.value,value:e.data}}_getInvalidInput(e){const r=this._getOrReturnCtx(e);return A(r,{code:I.invalid_type,expected:Z.bigint,received:r.parsedType}),J}gte(e,r){return this.setLimit("min",e,!0,L.toString(r))}gt(e,r){return this.setLimit("min",e,!1,L.toString(r))}lte(e,r){return this.setLimit("max",e,!0,L.toString(r))}lt(e,r){return this.setLimit("max",e,!1,L.toString(r))}setLimit(e,r,n,s){return new Kt({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:L.toString(s)}]})}_addCheck(e){return new Kt({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:L.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:L.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:L.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:L.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:L.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}}Kt.create=t=>new Kt({checks:[],typeName:C.ZodBigInt,coerce:(t==null?void 0:t.coerce)??!1,...Y(t)});class pn extends ee{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==Z.boolean){const n=this._getOrReturnCtx(e);return A(n,{code:I.invalid_type,expected:Z.boolean,received:n.parsedType}),J}return He(e.data)}}pn.create=t=>new pn({typeName:C.ZodBoolean,coerce:(t==null?void 0:t.coerce)||!1,...Y(t)});class lr extends ee{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==Z.date){const o=this._getOrReturnCtx(e);return A(o,{code:I.invalid_type,expected:Z.date,received:o.parsedType}),J}if(Number.isNaN(e.data.getTime())){const o=this._getOrReturnCtx(e);return A(o,{code:I.invalid_date}),J}const n=new Ve;let s;for(const o of this._def.checks)o.kind==="min"?e.data.getTime()<o.value&&(s=this._getOrReturnCtx(e,s),A(s,{code:I.too_small,message:o.message,inclusive:!0,exact:!1,minimum:o.value,type:"date"}),n.dirty()):o.kind==="max"?e.data.getTime()>o.value&&(s=this._getOrReturnCtx(e,s),A(s,{code:I.too_big,message:o.message,inclusive:!0,exact:!1,maximum:o.value,type:"date"}),n.dirty()):oe.assertNever(o);return{status:n.value,value:new Date(e.data.getTime())}}_addCheck(e){return new lr({...this._def,checks:[...this._def.checks,e]})}min(e,r){return this._addCheck({kind:"min",value:e.getTime(),message:L.toString(r)})}max(e,r){return this._addCheck({kind:"max",value:e.getTime(),message:L.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}}lr.create=t=>new lr({checks:[],coerce:(t==null?void 0:t.coerce)||!1,typeName:C.ZodDate,...Y(t)});class Is extends ee{_parse(e){if(this._getType(e)!==Z.symbol){const n=this._getOrReturnCtx(e);return A(n,{code:I.invalid_type,expected:Z.symbol,received:n.parsedType}),J}return He(e.data)}}Is.create=t=>new Is({typeName:C.ZodSymbol,...Y(t)});class mn extends ee{_parse(e){if(this._getType(e)!==Z.undefined){const n=this._getOrReturnCtx(e);return A(n,{code:I.invalid_type,expected:Z.undefined,received:n.parsedType}),J}return He(e.data)}}mn.create=t=>new mn({typeName:C.ZodUndefined,...Y(t)});class _n extends ee{_parse(e){if(this._getType(e)!==Z.null){const n=this._getOrReturnCtx(e);return A(n,{code:I.invalid_type,expected:Z.null,received:n.parsedType}),J}return He(e.data)}}_n.create=t=>new _n({typeName:C.ZodNull,...Y(t)});class Cr extends ee{constructor(){super(...arguments),this._any=!0}_parse(e){return He(e.data)}}Cr.create=t=>new Cr({typeName:C.ZodAny,...Y(t)});class dr extends ee{constructor(){super(...arguments),this._unknown=!0}_parse(e){return He(e.data)}}dr.create=t=>new dr({typeName:C.ZodUnknown,...Y(t)});class jt extends ee{_parse(e){const r=this._getOrReturnCtx(e);return A(r,{code:I.invalid_type,expected:Z.never,received:r.parsedType}),J}}jt.create=t=>new jt({typeName:C.ZodNever,...Y(t)});class Cs extends ee{_parse(e){if(this._getType(e)!==Z.undefined){const n=this._getOrReturnCtx(e);return A(n,{code:I.invalid_type,expected:Z.void,received:n.parsedType}),J}return He(e.data)}}Cs.create=t=>new Cs({typeName:C.ZodVoid,...Y(t)});class pt extends ee{_parse(e){const{ctx:r,status:n}=this._processInputParams(e),s=this._def;if(r.parsedType!==Z.array)return A(r,{code:I.invalid_type,expected:Z.array,received:r.parsedType}),J;if(s.exactLength!==null){const i=r.data.length>s.exactLength.value,a=r.data.length<s.exactLength.value;(i||a)&&(A(r,{code:i?I.too_big:I.too_small,minimum:a?s.exactLength.value:void 0,maximum:i?s.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:s.exactLength.message}),n.dirty())}if(s.minLength!==null&&r.data.length<s.minLength.value&&(A(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&&(A(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((i,a)=>s.type._parseAsync(new Et(r,i,r.path,a)))).then(i=>Ve.mergeArray(n,i));const o=[...r.data].map((i,a)=>s.type._parseSync(new Et(r,i,r.path,a)));return Ve.mergeArray(n,o)}get element(){return this._def.type}min(e,r){return new pt({...this._def,minLength:{value:e,message:L.toString(r)}})}max(e,r){return new pt({...this._def,maxLength:{value:e,message:L.toString(r)}})}length(e,r){return new pt({...this._def,exactLength:{value:e,message:L.toString(r)}})}nonempty(e){return this.min(1,e)}}pt.create=(t,e)=>new pt({type:t,minLength:null,maxLength:null,exactLength:null,typeName:C.ZodArray,...Y(e)});function Or(t){if(t instanceof Pe){const e={};for(const r in t.shape){const n=t.shape[r];e[r]=Tt.create(Or(n))}return new Pe({...t._def,shape:()=>e})}else return t instanceof pt?new pt({...t._def,type:Or(t.element)}):t instanceof Tt?Tt.create(Or(t.unwrap())):t instanceof Yt?Yt.create(Or(t.unwrap())):t instanceof Pt?Pt.create(t.items.map(e=>Or(e))):t}class Pe extends ee{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)!==Z.object){const u=this._getOrReturnCtx(e);return A(u,{code:I.invalid_type,expected:Z.object,received:u.parsedType}),J}const{status:n,ctx:s}=this._processInputParams(e),{shape:o,keys:i}=this._getCached(),a=[];if(!(this._def.catchall instanceof jt&&this._def.unknownKeys==="strip"))for(const u in s.data)i.includes(u)||a.push(u);const c=[];for(const u of i){const l=o[u],f=s.data[u];c.push({key:{status:"valid",value:u},value:l._parse(new Et(s,f,s.path,u)),alwaysSet:u in s.data})}if(this._def.catchall instanceof jt){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&&(A(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 Et(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,_=await l.value;u.push({key:f,value:_,alwaysSet:l.alwaysSet})}return u}).then(u=>Ve.mergeObjectSync(n,u)):Ve.mergeObjectSync(n,c)}get shape(){return this._def.shape()}strict(e){return L.errToObj,new Pe({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(r,n)=>{var o,i;const s=((i=(o=this._def).errorMap)==null?void 0:i.call(o,r,n).message)??n.defaultError;return r.code==="unrecognized_keys"?{message:L.errToObj(e).message??s}:{message:s}}}:{}})}strip(){return new Pe({...this._def,unknownKeys:"strip"})}passthrough(){return new Pe({...this._def,unknownKeys:"passthrough"})}extend(e){return new Pe({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new Pe({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:C.ZodObject})}setKey(e,r){return this.augment({[e]:r})}catchall(e){return new Pe({...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 Pe({...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 Pe({...this._def,shape:()=>r})}deepPartial(){return Or(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 Pe({...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 o=this.shape[n];for(;o instanceof Tt;)o=o._def.innerType;r[n]=o}return new Pe({...this._def,shape:()=>r})}keyof(){return Yl(oe.objectKeys(this.shape))}}Pe.create=(t,e)=>new Pe({shape:()=>t,unknownKeys:"strip",catchall:jt.create(),typeName:C.ZodObject,...Y(e)}),Pe.strictCreate=(t,e)=>new Pe({shape:()=>t,unknownKeys:"strict",catchall:jt.create(),typeName:C.ZodObject,...Y(e)}),Pe.lazycreate=(t,e)=>new Pe({shape:t,unknownKeys:"strip",catchall:jt.create(),typeName:C.ZodObject,...Y(e)});class gn extends ee{_parse(e){const{ctx:r}=this._processInputParams(e),n=this._def.options;function s(o){for(const a of o)if(a.result.status==="valid")return a.result;for(const a of o)if(a.result.status==="dirty")return r.common.issues.push(...a.ctx.common.issues),a.result;const i=o.map(a=>new et(a.ctx.common.issues));return A(r,{code:I.invalid_union,unionErrors:i}),J}if(r.common.async)return Promise.all(n.map(async o=>{const i={...r,common:{...r.common,issues:[]},parent:null};return{result:await o._parseAsync({data:r.data,path:r.path,parent:i}),ctx:i}})).then(s);{let o;const i=[];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"&&!o&&(o={result:l,ctx:u}),u.common.issues.length&&i.push(u.common.issues)}if(o)return r.common.issues.push(...o.ctx.common.issues),o.result;const a=i.map(c=>new et(c));return A(r,{code:I.invalid_union,unionErrors:a}),J}}get options(){return this._def.options}}gn.create=(t,e)=>new gn({options:t,typeName:C.ZodUnion,...Y(e)});const At=t=>t instanceof bn?At(t.schema):t instanceof mt?At(t.innerType()):t instanceof wn?[t.value]:t instanceof Gt?t.options:t instanceof $n?oe.objectValues(t.enum):t instanceof Sn?At(t._def.innerType):t instanceof mn?[void 0]:t instanceof _n?[null]:t instanceof Tt?[void 0,...At(t.unwrap())]:t instanceof Yt?[null,...At(t.unwrap())]:t instanceof Fi||t instanceof Pn?At(t.unwrap()):t instanceof kn?At(t._def.innerType):[];class Os extends ee{_parse(e){const{ctx:r}=this._processInputParams(e);if(r.parsedType!==Z.object)return A(r,{code:I.invalid_type,expected:Z.object,received:r.parsedType}),J;const n=this.discriminator,s=r.data[n],o=this.optionsMap.get(s);return o?r.common.async?o._parseAsync({data:r.data,path:r.path,parent:r}):o._parseSync({data:r.data,path:r.path,parent:r}):(A(r,{code:I.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),J)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,r,n){const s=new Map;for(const o of r){const i=At(o.shape[e]);if(!i.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const a of i){if(s.has(a))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(a)}`);s.set(a,o)}}return new Os({typeName:C.ZodDiscriminatedUnion,discriminator:e,options:r,optionsMap:s,...Y(n)})}}function Vi(t,e){const r=Nt(t),n=Nt(e);if(t===e)return{valid:!0,data:t};if(r===Z.object&&n===Z.object){const s=oe.objectKeys(e),o=oe.objectKeys(t).filter(a=>s.indexOf(a)!==-1),i={...t,...e};for(const a of o){const c=Vi(t[a],e[a]);if(!c.valid)return{valid:!1};i[a]=c.data}return{valid:!0,data:i}}else if(r===Z.array&&n===Z.array){if(t.length!==e.length)return{valid:!1};const s=[];for(let o=0;o<t.length;o++){const i=t[o],a=e[o],c=Vi(i,a);if(!c.valid)return{valid:!1};s.push(c.data)}return{valid:!0,data:s}}else return r===Z.date&&n===Z.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}class vn extends ee{_parse(e){const{status:r,ctx:n}=this._processInputParams(e),s=(o,i)=>{if(Ui(o)||Ui(i))return J;const a=Vi(o.value,i.value);return a.valid?((Di(o)||Di(i))&&r.dirty(),{status:r.value,value:a.data}):(A(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(([o,i])=>s(o,i)):s(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}}vn.create=(t,e,r)=>new vn({left:t,right:e,typeName:C.ZodIntersection,...Y(r)});class Pt extends ee{_parse(e){const{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==Z.array)return A(n,{code:I.invalid_type,expected:Z.array,received:n.parsedType}),J;if(n.data.length<this._def.items.length)return A(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&&(A(n,{code:I.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());const o=[...n.data].map((i,a)=>{const c=this._def.items[a]||this._def.rest;return c?c._parse(new Et(n,i,n.path,a)):null}).filter(i=>!!i);return n.common.async?Promise.all(o).then(i=>Ve.mergeArray(r,i)):Ve.mergeArray(r,o)}get items(){return this._def.items}rest(e){return new Pt({...this._def,rest:e})}}Pt.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Pt({items:t,typeName:C.ZodTuple,rest:null,...Y(e)})};class yn extends ee{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!==Z.object)return A(n,{code:I.invalid_type,expected:Z.object,received:n.parsedType}),J;const s=[],o=this._def.keyType,i=this._def.valueType;for(const a in n.data)s.push({key:o._parse(new Et(n,a,n.path,a)),value:i._parse(new Et(n,n.data[a],n.path,a)),alwaysSet:a in n.data});return n.common.async?Ve.mergeObjectAsync(r,s):Ve.mergeObjectSync(r,s)}get element(){return this._def.valueType}static create(e,r,n){return r instanceof ee?new yn({keyType:e,valueType:r,typeName:C.ZodRecord,...Y(n)}):new yn({keyType:ht.create(),valueType:e,typeName:C.ZodRecord,...Y(r)})}}class Ns extends ee{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!==Z.map)return A(n,{code:I.invalid_type,expected:Z.map,received:n.parsedType}),J;const s=this._def.keyType,o=this._def.valueType,i=[...n.data.entries()].map(([a,c],u)=>({key:s._parse(new Et(n,a,n.path,[u,"key"])),value:o._parse(new Et(n,c,n.path,[u,"value"]))}));if(n.common.async){const a=new Map;return Promise.resolve().then(async()=>{for(const c of i){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 i){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}}}}Ns.create=(t,e,r)=>new Ns({valueType:e,keyType:t,typeName:C.ZodMap,...Y(r)});class fr extends ee{_parse(e){const{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==Z.set)return A(n,{code:I.invalid_type,expected:Z.set,received:n.parsedType}),J;const s=this._def;s.minSize!==null&&n.data.size<s.minSize.value&&(A(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&&(A(n,{code:I.too_big,maximum:s.maxSize.value,type:"set",inclusive:!0,exact:!1,message:s.maxSize.message}),r.dirty());const o=this._def.valueType;function i(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)=>o._parse(new Et(n,c,n.path,u)));return n.common.async?Promise.all(a).then(c=>i(c)):i(a)}min(e,r){return new fr({...this._def,minSize:{value:e,message:L.toString(r)}})}max(e,r){return new fr({...this._def,maxSize:{value:e,message:L.toString(r)}})}size(e,r){return this.min(e,r).max(e,r)}nonempty(e){return this.min(1,e)}}fr.create=(t,e)=>new fr({valueType:t,minSize:null,maxSize:null,typeName:C.ZodSet,...Y(e)});class Nr extends ee{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:r}=this._processInputParams(e);if(r.parsedType!==Z.function)return A(r,{code:I.invalid_type,expected:Z.function,received:r.parsedType}),J;function n(a,c){return Rs({data:a,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,xs(),Rr].filter(u=>!!u),issueData:{code:I.invalid_arguments,argumentsError:c}})}function s(a,c){return Rs({data:a,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,xs(),Rr].filter(u=>!!u),issueData:{code:I.invalid_return_type,returnTypeError:c}})}const o={errorMap:r.common.contextualErrorMap},i=r.data;if(this._def.returns instanceof jr){const a=this;return He(async function(...c){const u=new et([]),l=await a._def.args.parseAsync(c,o).catch(y=>{throw u.addIssue(n(c,y)),u}),f=await Reflect.apply(i,this,l);return await a._def.returns._def.type.parseAsync(f,o).catch(y=>{throw u.addIssue(s(f,y)),u})})}else{const a=this;return He(function(...c){const u=a._def.args.safeParse(c,o);if(!u.success)throw new et([n(c,u.error)]);const l=Reflect.apply(i,this,u.data),f=a._def.returns.safeParse(l,o);if(!f.success)throw new et([s(l,f.error)]);return f.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new Nr({...this._def,args:Pt.create(e).rest(dr.create())})}returns(e){return new Nr({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,r,n){return new Nr({args:e||Pt.create([]).rest(dr.create()),returns:r||dr.create(),typeName:C.ZodFunction,...Y(n)})}}class bn extends ee{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})}}bn.create=(t,e)=>new bn({getter:t,typeName:C.ZodLazy,...Y(e)});class wn extends ee{_parse(e){if(e.data!==this._def.value){const r=this._getOrReturnCtx(e);return A(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}}wn.create=(t,e)=>new wn({value:t,typeName:C.ZodLiteral,...Y(e)});function Yl(t,e){return new Gt({values:t,typeName:C.ZodEnum,...Y(e)})}class Gt extends ee{_parse(e){if(typeof e.data!="string"){const r=this._getOrReturnCtx(e),n=this._def.values;return A(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 A(r,{received:r.data,code:I.invalid_enum_value,options:n}),J}return He(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 Gt.create(e,{...this._def,...r})}exclude(e,r=this._def){return Gt.create(this.options.filter(n=>!e.includes(n)),{...this._def,...r})}}Gt.create=Yl;class $n extends ee{_parse(e){const r=oe.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==Z.string&&n.parsedType!==Z.number){const s=oe.objectValues(r);return A(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 A(n,{received:n.data,code:I.invalid_enum_value,options:s}),J}return He(e.data)}get enum(){return this._def.values}}$n.create=(t,e)=>new $n({values:t,typeName:C.ZodNativeEnum,...Y(e)});class jr extends ee{unwrap(){return this._def.type}_parse(e){const{ctx:r}=this._processInputParams(e);if(r.parsedType!==Z.promise&&r.common.async===!1)return A(r,{code:I.invalid_type,expected:Z.promise,received:r.parsedType}),J;const n=r.parsedType===Z.promise?r.data:Promise.resolve(r.data);return He(n.then(s=>this._def.type.parseAsync(s,{path:r.path,errorMap:r.common.contextualErrorMap})))}}jr.create=(t,e)=>new jr({type:t,typeName:C.ZodPromise,...Y(e)});class mt extends ee{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===C.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:r,ctx:n}=this._processInputParams(e),s=this._def.effect||null,o={addIssue:i=>{A(n,i),i.fatal?r.abort():r.dirty()},get path(){return n.path}};if(o.addIssue=o.addIssue.bind(o),s.type==="preprocess"){const i=s.transform(n.data,o);if(n.common.async)return Promise.resolve(i).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"?Ir(c.value):c});{if(r.value==="aborted")return J;const a=this._def.schema._parseSync({data:i,path:n.path,parent:n});return a.status==="aborted"?J:a.status==="dirty"||r.value==="dirty"?Ir(a.value):a}}if(s.type==="refinement"){const i=a=>{const c=s.refinement(a,o);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(),i(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(),i(a.value).then(()=>({status:r.value,value:a.value}))))}if(s.type==="transform")if(n.common.async===!1){const i=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!ur(i))return J;const a=s.transform(i.value,o);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(i=>ur(i)?Promise.resolve(s.transform(i.value,o)).then(a=>({status:r.value,value:a})):J);oe.assertNever(s)}}mt.create=(t,e,r)=>new mt({schema:t,typeName:C.ZodEffects,effect:e,...Y(r)}),mt.createWithPreprocess=(t,e,r)=>new mt({schema:e,effect:{type:"preprocess",transform:t},typeName:C.ZodEffects,...Y(r)});class Tt extends ee{_parse(e){return this._getType(e)===Z.undefined?He(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Tt.create=(t,e)=>new Tt({innerType:t,typeName:C.ZodOptional,...Y(e)});class Yt extends ee{_parse(e){return this._getType(e)===Z.null?He(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Yt.create=(t,e)=>new Yt({innerType:t,typeName:C.ZodNullable,...Y(e)});class Sn extends ee{_parse(e){const{ctx:r}=this._processInputParams(e);let n=r.data;return r.parsedType===Z.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}}Sn.create=(t,e)=>new Sn({innerType:t,typeName:C.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...Y(e)});class kn extends ee{_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 hn(s)?s.then(o=>({status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new et(n.common.issues)},input:n.data})})):{status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new et(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}}kn.create=(t,e)=>new kn({innerType:t,typeName:C.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...Y(e)});class js extends ee{_parse(e){if(this._getType(e)!==Z.nan){const n=this._getOrReturnCtx(e);return A(n,{code:I.invalid_type,expected:Z.nan,received:n.parsedType}),J}return{status:"valid",value:e.data}}}js.create=t=>new js({typeName:C.ZodNaN,...Y(t)});const jb=Symbol("zod_brand");class Fi extends ee{_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 En extends ee{_parse(e){const{status:r,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{const o=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return o.status==="aborted"?J:o.status==="dirty"?(r.dirty(),Ir(o.value)):this._def.out._parseAsync({data:o.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 En({in:e,out:r,typeName:C.ZodPipeline})}}class Pn extends ee{_parse(e){const r=this._def.innerType._parse(e),n=s=>(ur(s)&&(s.value=Object.freeze(s.value)),s);return hn(r)?r.then(s=>n(s)):n(r)}unwrap(){return this._def.innerType}}Pn.create=(t,e)=>new Pn({innerType:t,typeName:C.ZodReadonly,...Y(e)});function Xl(t,e){const r=typeof t=="function"?t(e):typeof t=="string"?{message:t}:t;return typeof r=="string"?{message:r}:r}function Ql(t,e={},r){return t?Cr.create().superRefine((n,s)=>{const o=t(n);if(o instanceof Promise)return o.then(i=>{if(!i){const a=Xl(e,n),c=a.fatal??r??!0;s.addIssue({code:"custom",...a,fatal:c})}});if(!o){const i=Xl(e,n),a=i.fatal??r??!0;s.addIssue({code:"custom",...i,fatal:a})}}):Cr.create()}const Ab={object:Pe.lazycreate};var C;(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"})(C||(C={}));const zb=(t,e={message:`Input not instance of ${t.name}`})=>Ql(r=>r instanceof t,e),ed=ht.create,td=Bt.create,Mb=js.create,Zb=Kt.create,rd=pn.create,Lb=lr.create,Ub=Is.create,Db=mn.create,qb=_n.create,Vb=Cr.create,Fb=dr.create,Hb=jt.create,Wb=Cs.create,Jb=pt.create,nd=Pe.create,Bb=Pe.strictCreate,Kb=gn.create,Gb=Os.create,Yb=vn.create,Xb=Pt.create,Qb=yn.create,ew=Ns.create,tw=fr.create,rw=Nr.create,nw=bn.create,sw=wn.create,ow=Gt.create,iw=$n.create,aw=jr.create,sd=mt.create,cw=Tt.create,uw=Yt.create,lw=mt.createWithPreprocess,dw=En.create,fw=Object.freeze(Object.defineProperty({__proto__:null,BRAND:jb,DIRTY:Ir,EMPTY_PATH:fb,INVALID:J,NEVER:J,OK:He,ParseStatus:Ve,Schema:ee,ZodAny:Cr,ZodArray:pt,ZodBigInt:Kt,ZodBoolean:pn,ZodBranded:Fi,ZodCatch:kn,ZodDate:lr,ZodDefault:Sn,ZodDiscriminatedUnion:Os,ZodEffects:mt,ZodEnum:Gt,ZodError:et,get ZodFirstPartyTypeKind(){return C},ZodFunction:Nr,ZodIntersection:vn,ZodIssueCode:I,ZodLazy:bn,ZodLiteral:wn,ZodMap:Ns,ZodNaN:js,ZodNativeEnum:$n,ZodNever:jt,ZodNull:_n,ZodNullable:Yt,ZodNumber:Bt,ZodObject:Pe,ZodOptional:Tt,ZodParsedType:Z,ZodPipeline:En,ZodPromise:jr,ZodReadonly:Pn,ZodRecord:yn,ZodSchema:ee,ZodSet:fr,ZodString:ht,ZodSymbol:Is,ZodTransformer:mt,ZodTuple:Pt,ZodType:ee,ZodUndefined:mn,ZodUnion:gn,ZodUnknown:dr,ZodVoid:Cs,addIssueToContext:A,any:Vb,array:Jb,bigint:Zb,boolean:rd,coerce:{string:t=>ht.create({...t,coerce:!0}),number:t=>Bt.create({...t,coerce:!0}),boolean:t=>pn.create({...t,coerce:!0}),bigint:t=>Kt.create({...t,coerce:!0}),date:t=>lr.create({...t,coerce:!0})},custom:Ql,date:Lb,datetimeRegex:Gl,defaultErrorMap:Rr,discriminatedUnion:Gb,effect:sd,enum:ow,function:rw,getErrorMap:xs,getParsedType:Nt,instanceof:zb,intersection:Yb,isAborted:Ui,isAsync:hn,isDirty:Di,isValid:ur,late:Ab,lazy:nw,literal:sw,makeIssue:Rs,map:ew,nan:Mb,nativeEnum:iw,never:Hb,null:qb,nullable:uw,number:td,object:nd,get objectUtil(){return Li},oboolean:()=>rd().optional(),onumber:()=>td().optional(),optional:cw,ostring:()=>ed().optional(),pipeline:dw,preprocess:lw,promise:aw,quotelessJson:lb,record:Qb,set:tw,setErrorMap:db,strictObject:Bb,string:ed,symbol:Ub,transformer:sd,tuple:Xb,undefined:Db,union:Kb,unknown:Fb,get util(){return oe},void:Wb},Symbol.toStringTag,{value:"Module"})),hw=T("ZodMiniType",(t,e)=>{if(!t._zod)throw new Error("Uninitialized schema in ZodMiniType.");ge.init(t,e),t.def=e,t.parse=(r,n)=>k_(t,r,n,{callee:t.parse}),t.safeParse=(r,n)=>fi(t,r,n),t.parseAsync=async(r,n)=>E_(t,r,n,{callee:t.parseAsync}),t.safeParseAsync=async(r,n)=>hi(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)=>Ht(t,r,n),t.brand=()=>t,t.register=(r,n)=>(r.add(t,n),t)}),pw=T("ZodMiniObject",(t,e)=>{ju.init(t,e),hw.init(t,e),_e(t,"shape",()=>e.shape)});function od(t,e){const r={type:"object",get shape(){return rn(this,"shape",{...t}),this.shape},...D(e)};return new pw(r)}function _t(t){return!!t._zod}function Tn(t){const e=Object.values(t);if(e.length===0)return od({});const r=e.every(_t),n=e.every(s=>!_t(s));if(r)return od(t);if(n)return nd(t);throw new Error("Mixed Zod versions detected in object shape.")}function As(t,e){return _t(t)?fi(t,e):t.safeParse(e)}async function Hi(t,e){return _t(t)?await hi(t,e):await t.safeParseAsync(e)}function xn(t){var e,r;if(!t)return;let n;if(_t(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 Rn(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(o=>typeof o=="object"&&o!==null&&(o._def!==void 0||o._zod!==void 0||typeof o.parse=="function")))return Tn(t)}}if(_t(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 Wi(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 mw(t){var e,r,n,s;if(_t(t))return(r=(e=t._zod)===null||e===void 0?void 0:e.def)===null||r===void 0?void 0:r.description;const o=t;return(n=t.description)!==null&&n!==void 0?n:(s=o._def)===null||s===void 0?void 0:s.description}function _w(t){var e,r,n;if(_t(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 id(t){var e;if(_t(t)){const i=(e=t._zod)===null||e===void 0?void 0:e.def;if(i){if(i.value!==void 0)return i.value;if(Array.isArray(i.values)&&i.values.length>0)return i.values[0]}}const n=t._def;if(n){if(n.value!==void 0)return n.value;if(Array.isArray(n.values)&&n.values.length>0)return n.values[0]}const s=t.value;if(s!==void 0)return s}const gw=Symbol("Let zodToJsonSchema decide on which parser to use"),ad={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"},vw=t=>typeof t=="string"?{...ad,name:t}:{...ad,...t},yw=t=>{const e=vw(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 cd(t,e,r,n){n!=null&&n.errorMessages&&r&&(t.errorMessage={...t.errorMessage,[e]:r})}function de(t,e,r,n,s){t[e]=r,cd(t,e,n,s)}const ud=(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 Ye(t){if(t.target!=="openAi")return{};const e=[...t.basePath,t.definitionPath,t.openAiAnyTypeName];return t.flags.hasReferencedOpenAiAnyType=!0,{$ref:t.$refStrategy==="relative"?ud(e,t.currentPath):e.join("/")}}function bw(t,e){var n,s,o;const r={type:"array"};return(n=t.type)!=null&&n._def&&((o=(s=t.type)==null?void 0:s._def)==null?void 0:o.typeName)!==C.ZodAny&&(r.items=ue(t.type._def,{...e,currentPath:[...e.currentPath,"items"]})),t.minLength&&de(r,"minItems",t.minLength.value,t.minLength.message,e),t.maxLength&&de(r,"maxItems",t.maxLength.value,t.maxLength.message,e),t.exactLength&&(de(r,"minItems",t.exactLength.value,t.exactLength.message,e),de(r,"maxItems",t.exactLength.value,t.exactLength.message,e)),r}function ww(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?de(r,"minimum",n.value,n.message,e):de(r,"exclusiveMinimum",n.value,n.message,e):(n.inclusive||(r.exclusiveMinimum=!0),de(r,"minimum",n.value,n.message,e));break;case"max":e.target==="jsonSchema7"?n.inclusive?de(r,"maximum",n.value,n.message,e):de(r,"exclusiveMaximum",n.value,n.message,e):(n.inclusive||(r.exclusiveMaximum=!0),de(r,"maximum",n.value,n.message,e));break;case"multipleOf":de(r,"multipleOf",n.value,n.message,e);break}return r}function $w(){return{type:"boolean"}}function ld(t,e){return ue(t.type._def,e)}const Sw=(t,e)=>ue(t.innerType._def,e);function dd(t,e,r){const n=r??e.dateStrategy;if(Array.isArray(n))return{anyOf:n.map((s,o)=>dd(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 kw(t,e)}}const kw=(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":de(r,"minimum",n.value,n.message,e);break;case"max":de(r,"maximum",n.value,n.message,e);break}return r};function Ew(t,e){return{...ue(t.innerType._def,e),default:t.defaultValue()}}function Pw(t,e){return e.effectStrategy==="input"?ue(t.schema._def,e):Ye(e)}function Tw(t){return{type:"string",enum:Array.from(t.values)}}const xw=t=>"type"in t&&t.type==="string"?!1:"allOf"in t;function Rw(t,e){const r=[ue(t.left._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),ue(t.right._def,{...e,currentPath:[...e.currentPath,"allOf","1"]})].filter(o=>!!o);let n=e.target==="jsonSchema2019-09"?{unevaluatedProperties:!1}:void 0;const s=[];return r.forEach(o=>{if(xw(o))s.push(...o.allOf),o.unevaluatedProperties===void 0&&(n=void 0);else{let i=o;if("additionalProperties"in o&&o.additionalProperties===!1){const{additionalProperties:a,...c}=o;i=c}else n=void 0;s.push(i)}}),s.length?{allOf:s,...n}:void 0}function Iw(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 Ji;const gt={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:()=>(Ji===void 0&&(Ji=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),Ji),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 fd(t,e){const r={type:"string"};if(t.checks)for(const n of t.checks)switch(n.kind){case"min":de(r,"minLength",typeof r.minLength=="number"?Math.max(r.minLength,n.value):n.value,n.message,e);break;case"max":de(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":vt(r,"email",n.message,e);break;case"format:idn-email":vt(r,"idn-email",n.message,e);break;case"pattern:zod":We(r,gt.email,n.message,e);break}break;case"url":vt(r,"uri",n.message,e);break;case"uuid":vt(r,"uuid",n.message,e);break;case"regex":We(r,n.regex,n.message,e);break;case"cuid":We(r,gt.cuid,n.message,e);break;case"cuid2":We(r,gt.cuid2,n.message,e);break;case"startsWith":We(r,RegExp(`^${Bi(n.value,e)}`),n.message,e);break;case"endsWith":We(r,RegExp(`${Bi(n.value,e)}$`),n.message,e);break;case"datetime":vt(r,"date-time",n.message,e);break;case"date":vt(r,"date",n.message,e);break;case"time":vt(r,"time",n.message,e);break;case"duration":vt(r,"duration",n.message,e);break;case"length":de(r,"minLength",typeof r.minLength=="number"?Math.max(r.minLength,n.value):n.value,n.message,e),de(r,"maxLength",typeof r.maxLength=="number"?Math.min(r.maxLength,n.value):n.value,n.message,e);break;case"includes":{We(r,RegExp(Bi(n.value,e)),n.message,e);break}case"ip":{n.version!=="v6"&&vt(r,"ipv4",n.message,e),n.version!=="v4"&&vt(r,"ipv6",n.message,e);break}case"base64url":We(r,gt.base64url,n.message,e);break;case"jwt":We(r,gt.jwt,n.message,e);break;case"cidr":{n.version!=="v6"&&We(r,gt.ipv4Cidr,n.message,e),n.version!=="v4"&&We(r,gt.ipv6Cidr,n.message,e);break}case"emoji":We(r,gt.emoji(),n.message,e);break;case"ulid":{We(r,gt.ulid,n.message,e);break}case"base64":{switch(e.base64Strategy){case"format:binary":{vt(r,"binary",n.message,e);break}case"contentEncoding:base64":{de(r,"contentEncoding","base64",n.message,e);break}case"pattern:zod":{We(r,gt.base64,n.message,e);break}}break}case"nanoid":We(r,gt.nanoid,n.message,e)}return r}function Bi(t,e){return e.patternStrategy==="escape"?Ow(t):t}const Cw=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function Ow(t){let e="";for(let r=0;r<t.length;r++)Cw.has(t[r])||(e+="\\"),e+=t[r];return e}function vt(t,e,r,n){var s;t.format||(s=t.anyOf)!=null&&s.some(o=>o.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}}})):de(t,"format",e,r,n)}function We(t,e,r,n){var s;t.pattern||(s=t.allOf)!=null&&s.some(o=>o.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:hd(e,n),...r&&n.errorMessages&&{errorMessage:{pattern:r}}})):de(t,"pattern",hd(e,n),r,n)}function hd(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="",o=!1,i=!1,a=!1;for(let u=0;u<n.length;u++){if(o){s+=n[u],o=!1;continue}if(r.i){if(i){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+=i?`${n[u]}\r
38
+ `:`[${n[u]}\r
39
+ ]`;continue}s+=n[u],n[u]==="\\"?o=!0:i&&n[u]==="]"?i=!1:!i&&n[u]==="["&&(i=!0)}try{new RegExp(s)}catch{return console.warn(`Could not convert regex pattern at ${e.currentPath.join("/")} to a flag-independent form! Falling back to the flag-ignorant source`),t.source}return s}function pd(t,e){var n,s,o,i,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)===C.ZodEnum)return{type:"object",required:t.keyType._def.values,properties:t.keyType._def.values.reduce((u,l)=>({...u,[l]:ue(t.valueType._def,{...e,currentPath:[...e.currentPath,"properties",l]})??Ye(e)}),{}),additionalProperties:e.rejectedAdditionalProperties};const r={type:"object",additionalProperties:ue(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)===C.ZodString&&((o=t.keyType._def.checks)!=null&&o.length)){const{type:u,...l}=fd(t.keyType._def,e);return{...r,propertyNames:l}}else{if(((i=t.keyType)==null?void 0:i._def.typeName)===C.ZodEnum)return{...r,propertyNames:{enum:t.keyType._def.values}};if(((a=t.keyType)==null?void 0:a._def.typeName)===C.ZodBranded&&t.keyType._def.type._def.typeName===C.ZodString&&((c=t.keyType._def.type._def.checks)!=null&&c.length)){const{type:u,...l}=ld(t.keyType._def,e);return{...r,propertyNames:l}}}return r}function Nw(t,e){if(e.mapStrategy==="record")return pd(t,e);const r=ue(t.keyType._def,{...e,currentPath:[...e.currentPath,"items","items","0"]})||Ye(e),n=ue(t.valueType._def,{...e,currentPath:[...e.currentPath,"items","items","1"]})||Ye(e);return{type:"array",maxItems:125,items:{type:"array",items:[r,n],minItems:2,maxItems:2}}}function jw(t){const e=t.values,n=Object.keys(t.values).filter(o=>typeof e[e[o]]!="number").map(o=>e[o]),s=Array.from(new Set(n.map(o=>typeof o)));return{type:s.length===1?s[0]==="string"?"string":"number":["string","number"],enum:n}}function Aw(t){return t.target==="openAi"?void 0:{not:Ye({...t,currentPath:[...t.currentPath,"not"]})}}function zw(t){return t.target==="openApi3"?{enum:["null"],nullable:!0}:{type:"null"}}const zs={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};function Mw(t,e){if(e.target==="openApi3")return md(t,e);const r=t.options instanceof Map?Array.from(t.options.values()):t.options;if(r.every(n=>n._def.typeName in zs&&(!n._def.checks||!n._def.checks.length))){const n=r.reduce((s,o)=>{const i=zs[o._def.typeName];return i&&!s.includes(i)?[...s,i]:s},[]);return{type:n.length>1?n:n[0]}}else if(r.every(n=>n._def.typeName==="ZodLiteral"&&!n.description)){const n=r.reduce((s,o)=>{const i=typeof o._def.value;switch(i){case"string":case"number":case"boolean":return[...s,i];case"bigint":return[...s,"integer"];case"object":if(o._def.value===null)return[...s,"null"];case"symbol":case"undefined":case"function":default:return s}},[]);if(n.length===r.length){const s=n.filter((o,i,a)=>a.indexOf(o)===i);return{type:s.length>1?s:s[0],enum:r.reduce((o,i)=>o.includes(i._def.value)?o:[...o,i._def.value],[])}}}else if(r.every(n=>n._def.typeName==="ZodEnum"))return{type:"string",enum:r.reduce((n,s)=>[...n,...s._def.values.filter(o=>!n.includes(o))],[])};return md(t,e)}const md=(t,e)=>{const r=(t.options instanceof Map?Array.from(t.options.values()):t.options).map((n,s)=>ue(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 Zw(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:zs[t.innerType._def.typeName],nullable:!0}:{type:[zs[t.innerType._def.typeName],"null"]};if(e.target==="openApi3"){const n=ue(t.innerType._def,{...e,currentPath:[...e.currentPath]});return n&&"$ref"in n?{allOf:[n],nullable:!0}:n&&{...n,nullable:!0}}const r=ue(t.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","0"]});return r&&{anyOf:[r,{type:"null"}]}}function Lw(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",cd(r,"type",n.message,e);break;case"min":e.target==="jsonSchema7"?n.inclusive?de(r,"minimum",n.value,n.message,e):de(r,"exclusiveMinimum",n.value,n.message,e):(n.inclusive||(r.exclusiveMinimum=!0),de(r,"minimum",n.value,n.message,e));break;case"max":e.target==="jsonSchema7"?n.inclusive?de(r,"maximum",n.value,n.message,e):de(r,"exclusiveMaximum",n.value,n.message,e):(n.inclusive||(r.exclusiveMaximum=!0),de(r,"maximum",n.value,n.message,e));break;case"multipleOf":de(r,"multipleOf",n.value,n.message,e);break}return r}function Uw(t,e){const r=e.target==="openAi",n={type:"object",properties:{}},s=[],o=t.shape();for(const a in o){let c=o[a];if(c===void 0||c._def===void 0)continue;let u=qw(c);u&&r&&(c._def.typeName==="ZodOptional"&&(c=c._def.innerType),c.isNullable()||(c=c.nullable()),u=!1);const l=ue(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 i=Dw(t,e);return i!==void 0&&(n.additionalProperties=i),n}function Dw(t,e){if(t.catchall._def.typeName!=="ZodNever")return ue(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 qw(t){try{return t.isOptional()}catch{return!0}}const Vw=(t,e)=>{var n;if(e.currentPath.toString()===((n=e.propertyPath)==null?void 0:n.toString()))return ue(t.innerType._def,e);const r=ue(t.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","1"]});return r?{anyOf:[{not:Ye(e)},r]}:Ye(e)},Fw=(t,e)=>{if(e.pipeStrategy==="input")return ue(t.in._def,e);if(e.pipeStrategy==="output")return ue(t.out._def,e);const r=ue(t.in._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),n=ue(t.out._def,{...e,currentPath:[...e.currentPath,"allOf",r?"1":"0"]});return{allOf:[r,n].filter(s=>s!==void 0)}};function Hw(t,e){return ue(t.type._def,e)}function Ww(t,e){const n={type:"array",uniqueItems:!0,items:ue(t.valueType._def,{...e,currentPath:[...e.currentPath,"items"]})};return t.minSize&&de(n,"minItems",t.minSize.value,t.minSize.message,e),t.maxSize&&de(n,"maxItems",t.maxSize.value,t.maxSize.message,e),n}function Jw(t,e){return t.rest?{type:"array",minItems:t.items.length,items:t.items.map((r,n)=>ue(r._def,{...e,currentPath:[...e.currentPath,"items",`${n}`]})).reduce((r,n)=>n===void 0?r:[...r,n],[]),additionalItems:ue(t.rest._def,{...e,currentPath:[...e.currentPath,"additionalItems"]})}:{type:"array",minItems:t.items.length,maxItems:t.items.length,items:t.items.map((r,n)=>ue(r._def,{...e,currentPath:[...e.currentPath,"items",`${n}`]})).reduce((r,n)=>n===void 0?r:[...r,n],[])}}function Bw(t){return{not:Ye(t)}}function Kw(t){return Ye(t)}const Gw=(t,e)=>ue(t.innerType._def,e),Yw=(t,e,r)=>{switch(e){case C.ZodString:return fd(t,r);case C.ZodNumber:return Lw(t,r);case C.ZodObject:return Uw(t,r);case C.ZodBigInt:return ww(t,r);case C.ZodBoolean:return $w();case C.ZodDate:return dd(t,r);case C.ZodUndefined:return Bw(r);case C.ZodNull:return zw(r);case C.ZodArray:return bw(t,r);case C.ZodUnion:case C.ZodDiscriminatedUnion:return Mw(t,r);case C.ZodIntersection:return Rw(t,r);case C.ZodTuple:return Jw(t,r);case C.ZodRecord:return pd(t,r);case C.ZodLiteral:return Iw(t,r);case C.ZodEnum:return Tw(t);case C.ZodNativeEnum:return jw(t);case C.ZodNullable:return Zw(t,r);case C.ZodOptional:return Vw(t,r);case C.ZodMap:return Nw(t,r);case C.ZodSet:return Ww(t,r);case C.ZodLazy:return()=>t.getter()._def;case C.ZodPromise:return Hw(t,r);case C.ZodNaN:case C.ZodNever:return Aw(r);case C.ZodEffects:return Pw(t,r);case C.ZodAny:return Ye(r);case C.ZodUnknown:return Kw(r);case C.ZodDefault:return Ew(t,r);case C.ZodBranded:return ld(t,r);case C.ZodReadonly:return Gw(t,r);case C.ZodCatch:return Sw(t,r);case C.ZodPipeline:return Fw(t,r);case C.ZodFunction:case C.ZodVoid:case C.ZodSymbol:return;default:return(n=>{})()}};function ue(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!==gw)return c}if(n&&!r){const c=Xw(n,e);if(c!==void 0)return c}const s={def:t,path:e.currentPath,jsonSchema:void 0};e.seen.set(t,s);const o=Yw(t,t.typeName,e),i=typeof o=="function"?ue(o(),e):o;if(i&&Qw(t,e,i),e.postProcess){const c=e.postProcess(i,t,e);return s.jsonSchema=i,c}return s.jsonSchema=i,i}const Xw=(t,e)=>{switch(e.$refStrategy){case"root":return{$ref:t.path.join("/")};case"relative":return{$ref:ud(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`),Ye(e)):e.$refStrategy==="seen"?Ye(e):void 0}},Qw=(t,e,r)=>(t.description&&(r.description=t.description,e.markdownDescription&&(r.markdownDescription=t.description)),r),e$=(t,e)=>{const r=yw(e);let n=typeof e=="object"&&e.definitions?Object.entries(e.definitions).reduce((c,[u,l])=>({...c,[u]:ue(l._def,{...r,currentPath:[...r.basePath,r.definitionPath,u]},!0)??Ye(r)}),{}):void 0;const s=typeof e=="string"?e:(e==null?void 0:e.nameStrategy)==="title"||e==null?void 0:e.name,o=ue(t._def,s===void 0?r:{...r,currentPath:[...r.basePath,r.definitionPath,s]},!1)??Ye(r),i=typeof e=="object"&&e.name!==void 0&&e.nameStrategy==="title"?e.name:void 0;i!==void 0&&(o.title=i),r.flags.hasReferencedOpenAiAnyType&&(n||(n={}),n[r.openAiAnyTypeName]||(n[r.openAiAnyTypeName]={type:["string","number","integer","boolean","array","null"],items:{$ref:r.$refStrategy==="relative"?"1":[...r.basePath,r.definitionPath,r.openAiAnyTypeName].join("/")}}));const a=s===void 0?n?{...o,[r.definitionPath]:n}:o:{$ref:[...r.$refStrategy==="relative"?[]:r.basePath,r.definitionPath,s].join("/"),[r.definitionPath]:{...n,[s]:o}};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 t$(t){return!t||t==="jsonSchema7"||t==="draft-7"?"draft-7":t==="jsonSchema2019-09"||t==="draft-2020-12"?"draft-2020-12":"draft-7"}function _d(t,e){var r,n,s;return _t(t)?Gv(t,{target:t$(e==null?void 0:e.target),io:(r=e==null?void 0:e.pipeStrategy)!==null&&r!==void 0?r:"input"}):e$(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 gd(t){const e=xn(t),r=e==null?void 0:e.method;if(!r)throw new Error("Schema is missing a method literal");const n=id(r);if(typeof n!="string")throw new Error("Schema method literal must be a string");return n}function vd(t,e){const r=As(t,e);if(!r.success)throw r.error;return r.data}const r$=6e4;class yd{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($i,r=>{const n=this._requestHandlerAbortControllers.get(r.params.requestId);n==null||n.abort(r.params.reason)}),this.setNotificationHandler(Ei,r=>{this._onprogress(r)}),this.setRequestHandler(ki,r=>({}))}_setupTimeout(e,r,n,s,o=!1){this._timeoutInfo.set(e,{timeoutId:setTimeout(s,r),startTime:Date.now(),timeout:r,maxTotalTimeout:n,resetTimeoutOnProgress:o,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),ae.fromError(ie.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 o=(r=this.transport)===null||r===void 0?void 0:r.onclose;this._transport.onclose=()=>{o==null||o(),this._onclose()};const i=(n=this.transport)===null||n===void 0?void 0:n.onerror;this._transport.onerror=c=>{i==null||i(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),wi(c)||i0(c)?this._onresponse(c):pl(c)?this._onrequest(c,u):o0(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=ae.fromError(ie.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 o=(n=this._requestHandlers.get(e.method))!==null&&n!==void 0?n:this.fallbackRequestHandler,i=this._transport;if(o===void 0){i==null||i.send({jsonrpc:"2.0",id:e.id,error:{code:ie.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:i==null?void 0:i.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(()=>o(e,c)).then(u=>{if(!a.signal.aborted)return i==null?void 0:i.send({result:u,jsonrpc:"2.0",id:e.id})},u=>{var l;if(!a.signal.aborted)return i==null?void 0:i.send({jsonrpc:"2.0",id:e.id,error:{code:Number.isSafeInteger(u.code)?u.code:ie.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),o=this._progressHandlers.get(s);if(!o){this._onerror(new Error(`Received a progress notification for an unknown token: ${JSON.stringify(e)}`));return}const i=this._responseHandlers.get(s),a=this._timeoutInfo.get(s);if(a&&i&&a.resetTimeoutOnProgress)try{this._resetTimeout(s)}catch(c){i(c);return}o(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),wi(e))n(e);else{const s=ae.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:o,onresumptiontoken:i}=n??{};return new Promise((a,c)=>{var u,l,f,_,y,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++,h={...e,jsonrpc:"2.0",id:v};n!=null&&n.onprogress&&(this._progressHandlers.set(v,n.onprogress),h.params={...e.params,_meta:{...((f=e.params)===null||f===void 0?void 0:f._meta)||{},progressToken:v}});const d=S=>{var P;this._responseHandlers.delete(v),this._progressHandlers.delete(v),this._cleanupTimeout(v),(P=this._transport)===null||P===void 0||P.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:v,reason:String(S)}},{relatedRequestId:s,resumptionToken:o,onresumptiontoken:i}).catch(O=>this._onerror(new Error(`Failed to send cancellation: ${O}`))),c(S)};this._responseHandlers.set(v,S=>{var P;if(!(!((P=n==null?void 0:n.signal)===null||P===void 0)&&P.aborted)){if(S instanceof Error)return c(S);try{const O=As(r,S.result);O.success?a(O.data):c(O.error)}catch(O){c(O)}}}),(_=n==null?void 0:n.signal)===null||_===void 0||_.addEventListener("abort",()=>{var S;d((S=n==null?void 0:n.signal)===null||S===void 0?void 0:S.reason)});const m=(y=n==null?void 0:n.timeout)!==null&&y!==void 0?y:r$,w=()=>d(ae.fromError(ie.RequestTimeout,"Request timed out",{timeout:m}));this._setupTimeout(v,m,n==null?void 0:n.maxTotalTimeout,w,(g=n==null?void 0:n.resetTimeoutOnProgress)!==null&&g!==void 0?g:!1),this._transport.send(h,{relatedRequestId:s,resumptionToken:o,onresumptiontoken:i}).catch(S=>{this._cleanupTimeout(v),c(S)})})}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=gd(e);this.assertRequestHandlerCapability(n),this._requestHandlers.set(n,(s,o)=>{const i=vd(e,s);return Promise.resolve(r(i,o))})}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=gd(e);this._notificationHandlers.set(n,s=>{const o=vd(e,s);return Promise.resolve(r(o))})}removeNotificationHandler(e){this._notificationHandlers.delete(e)}}function bd(t){return t!==null&&typeof t=="object"&&!Array.isArray(t)}function wd(t,e){const r={...t};for(const n in e){const s=n,o=e[s];if(o===void 0)continue;const i=r[s];bd(i)&&bd(o)?r[s]={...i,...o}:r[s]=o}return r}var Ki={exports:{}},$d={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.formatNames=t.fastFormats=t.fullFormats=void 0;function e(U,K){return{validate:U,compare:K}}t.fullFormats={date:e(o,i),time:e(c(!0),u),"date-time":e(_(!0),y),"iso-time":e(c(),l),"iso-date-time":e(_(),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:Ae,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:w,int32:{type:"number",validate:O},int64:{type:"number",validate:V},float:{type:"number",validate:ce},double:{type:"number",validate:ce},password:!0,binary:!0},t.fastFormats={...t.fullFormats,date:e(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,i),time:e(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,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,y),"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(U){return U%4===0&&(U%100!==0||U%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 o(U){const K=n.exec(U);if(!K)return!1;const Se=+K[1],se=+K[2],De=+K[3];return se>=1&&se<=12&&De>=1&&De<=(se===2&&r(Se)?29:s[se])}function i(U,K){if(U&&K)return U>K?1:U<K?-1:0}const a=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function c(U){return function(Se){const se=a.exec(Se);if(!se)return!1;const De=+se[1],Zt=+se[2],Lt=+se[3],Ln=se[4],mr=se[5]==="-"?-1:1,N=+(se[6]||0),k=+(se[7]||0);if(N>23||k>59||U&&!Ln)return!1;if(De<=23&&Zt<=59&&Lt<60)return!0;const R=Zt-k*mr,E=De-N*mr-(R<0?1:0);return(E===23||E===-1)&&(R===59||R===-1)&&Lt<61}}function u(U,K){if(!(U&&K))return;const Se=new Date("2020-01-01T"+U).valueOf(),se=new Date("2020-01-01T"+K).valueOf();if(Se&&se)return Se-se}function l(U,K){if(!(U&&K))return;const Se=a.exec(U),se=a.exec(K);if(Se&&se)return U=Se[1]+Se[2]+Se[3],K=se[1]+se[2]+se[3],U>K?1:U<K?-1:0}const f=/t|\s/i;function _(U){const K=c(U);return function(se){const De=se.split(f);return De.length===2&&o(De[0])&&K(De[1])}}function y(U,K){if(!(U&&K))return;const Se=new Date(U).valueOf(),se=new Date(K).valueOf();if(Se&&se)return Se-se}function g(U,K){if(!(U&&K))return;const[Se,se]=U.split(f),[De,Zt]=K.split(f),Lt=i(Se,De);if(Lt!==void 0)return Lt||u(se,Zt)}const v=/\/|:/,h=/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)(?:\?(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i;function d(U){return v.test(U)&&h.test(U)}const m=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function w(U){return m.lastIndex=0,m.test(U)}const S=-2147483648,P=2**31-1;function O(U){return Number.isInteger(U)&&U<=P&&U>=S}function V(U){return Number.isInteger(U)}function ce(){return!0}const G=/[^\\]\\Z/;function Ae(U){if(G.test(U))return!1;try{return new RegExp(U),!0}catch{return!1}}})($d);var Sd={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.formatLimitDefinition=void 0;const e=ai,r=Q,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}},o={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:o,code(a){const{gen:c,data:u,schemaCode:l,keyword:f,it:_}=a,{opts:y,self:g}=_;if(!y.validateFormats)return;const v=new e.KeywordCxt(_,g.RULES.all.format.definition,"format");v.$data?h():d();function h(){const w=c.scopeValue("formats",{ref:g.formats,code:y.code.formats}),S=c.const("fmt",(0,r._)`${w}[${v.schemaCode}]`);a.fail$data((0,r.or)((0,r._)`typeof ${S} != "object"`,(0,r._)`${S} instanceof RegExp`,(0,r._)`typeof ${S}.compare != "function"`,m(S)))}function d(){const w=v.schema,S=g.formats[w];if(!S||S===!0)return;if(typeof S!="object"||S instanceof RegExp||typeof S.compare!="function")throw new Error(`"${f}": format "${w}" does not define "compare" function`);const P=c.scopeValue("formats",{key:w,ref:S,code:y.code.formats?(0,r._)`${y.code.formats}${(0,r.getProperty)(w)}`:void 0});a.fail$data(m(P))}function m(w){return(0,r._)`${w}.compare(${u}, ${l}) ${s[f].fail} 0`}},dependencies:["format"]};const i=a=>(a.addKeyword(t.formatLimitDefinition),a);t.default=i})(Sd),function(t,e){Object.defineProperty(e,"__esModule",{value:!0});const r=$d,n=Sd,s=Q,o=new s.Name("fullFormats"),i=new s.Name("fastFormats"),a=(u,l={keywords:!0})=>{if(Array.isArray(l))return c(u,l,r.fullFormats,o),u;const[f,_]=l.mode==="fast"?[r.fastFormats,i]:[r.fullFormats,o],y=l.formats||r.formatNames;return c(u,y,f,_),l.keywords&&(0,n.default)(u),u};a.get=(u,l="full")=>{const _=(l==="fast"?r.fastFormats:r.fullFormats)[u];if(!_)throw new Error(`Unknown format "${u}"`);return _};function c(u,l,f,_){var y,g;(y=(g=u.opts.code).formats)!==null&&y!==void 0||(g.formats=(0,s._)`require("ajv-formats/dist/formats").${_}`);for(const v of l)u.addFormat(v,f[v])}t.exports=e=a,Object.defineProperty(e,"__esModule",{value:!0}),e.default=a}(Ki,Ki.exports);var n$=Ki.exports;const s$=_r(n$);function o$(){const t=new ai.Ajv({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return s$(t),t}class kd{constructor(e){this._ajv=e??o$()}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 Ms(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 o=n[s];r[s]===void 0&&Object.prototype.hasOwnProperty.call(o,"default")&&(r[s]=o.default),r[s]!==void 0&&Ms(o,r[s])}}if(Array.isArray(t.anyOf))for(const r of t.anyOf)Ms(r,e);if(Array.isArray(t.oneOf))for(const r of t.oneOf)Ms(r,e)}}function i$(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 In extends yd{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 kd}registerCapabilities(e){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=wd(this._capabilities,e)}setRequestHandler(e,r){var n,s,o;const i=xn(e),a=i==null?void 0:i.method;if(!a)throw new Error("Schema is missing a method literal");let c;if(_t(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=(o=f==null?void 0:f.value)!==null&&o!==void 0?o:l.value}if(typeof c!="string")throw new Error("Schema method literal must be a string");if(c==="elicitation/create"){const l=async(f,_)=>{var y,g,v;const h=As(zi,f);if(!h.success){const G=h.error instanceof Error?h.error.message:String(h.error);throw new ae(ie.InvalidParams,`Invalid elicitation request: ${G}`)}const{params:d}=h.data,m=(y=d.mode)!==null&&y!==void 0?y:"form",{supportsFormMode:w,supportsUrlMode:S}=i$(this._capabilities.elicitation);if(m==="form"&&!w)throw new ae(ie.InvalidParams,"Client does not support form-mode elicitation requests");if(m==="url"&&!S)throw new ae(ie.InvalidParams,"Client does not support URL-mode elicitation requests");const P=await Promise.resolve(r(f,_)),O=As(fn,P);if(!O.success){const G=O.error instanceof Error?O.error.message:String(O.error);throw new ae(ie.InvalidParams,`Invalid elicitation result: ${G}`)}const V=O.data,ce=m==="form"?d.requestedSchema:void 0;if(m==="form"&&V.action==="accept"&&V.content&&ce&&!((v=(g=this._capabilities.elicitation)===null||g===void 0?void 0:g.form)===null||v===void 0)&&v.applyDefaults)try{Ms(ce,V.content)}catch{}return V};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:ln,capabilities:this._capabilities,clientInfo:this._clientInfo}},bl,r);if(n===void 0)throw new Error(`Server sent invalid initialize result: ${n}`);if(!ll.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,o,i;switch(e){case"logging/setLevel":if(!(!((r=this._serverCapabilities)===null||r===void 0)&&r.logging))throw new Error(`Server does not support logging (required for ${e})`);break;case"prompts/get":case"prompts/list":if(!(!((n=this._serverCapabilities)===null||n===void 0)&&n.prompts))throw new Error(`Server does not support prompts (required for ${e})`);break;case"resources/list":case"resources/templates/list":case"resources/read":case"resources/subscribe":case"resources/unsubscribe":if(!(!((s=this._serverCapabilities)===null||s===void 0)&&s.resources))throw new Error(`Server does not support resources (required for ${e})`);if(e==="resources/subscribe"&&!this._serverCapabilities.resources.subscribe)throw new Error(`Server does not support resource subscriptions (required for ${e})`);break;case"tools/call":case"tools/list":if(!(!((o=this._serverCapabilities)===null||o===void 0)&&o.tools))throw new Error(`Server does not support tools (required for ${e})`);break;case"completion/complete":if(!(!((i=this._serverCapabilities)===null||i===void 0)&&i.completions))throw new Error(`Server does not support completions (required for ${e})`);break}}assertNotificationCapability(e){var r;switch(e){case"notifications/roots/list_changed":if(!(!((r=this._capabilities.roots)===null||r===void 0)&&r.listChanged))throw new Error(`Client does not support roots list changed notifications (required for ${e})`);break}}assertRequestHandlerCapability(e){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"},Jt,e)}async complete(e,r){return this.request({method:"completion/complete",params:e},Vl,r)}async setLoggingLevel(e,r){return this.request({method:"logging/setLevel",params:{level:e}},Jt,r)}async getPrompt(e,r){return this.request({method:"prompts/get",params:e},zl,r)}async listPrompts(e,r){return this.request({method:"prompts/list",params:e},Ol,r)}async listResources(e,r){return this.request({method:"resources/list",params:e},El,r)}async listResourceTemplates(e,r){return this.request({method:"resources/templates/list",params:e},Pl,r)}async readResource(e,r){return this.request({method:"resources/read",params:e},Tl,r)}async subscribeResource(e,r){return this.request({method:"resources/subscribe",params:e},Jt,r)}async unsubscribeResource(e,r){return this.request({method:"resources/unsubscribe",params:e},Jt,r)}async callTool(e,r=ks,n){const s=await this.request({method:"tools/call",params:e},r,n),o=this.getToolOutputValidator(e.name);if(o){if(!s.structuredContent&&!s.isError)throw new ae(ie.InvalidRequest,`Tool ${e.name} has an output schema but did not return structured content`);if(s.structuredContent)try{const i=o(s.structuredContent);if(!i.valid)throw new ae(ie.InvalidParams,`Structured content does not match the tool's output schema: ${i.errorMessage}`)}catch(i){throw i instanceof ae?i:new ae(ie.InvalidParams,`Failed to validate structured content: ${i instanceof Error?i.message:String(i)}`)}}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},Ll,r);return this.cacheToolOutputSchemas(n.tools),n}async sendRootsListChanged(){return this.notification({method:"notifications/roots/list_changed"})}}class Ed 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 Gi(t){}function Pd(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=Gi,onError:r=Gi,onRetry:n=Gi,onComment:s}=t;let o="",i=!0,a,c="",u="";function l(v){const h=i?v.replace(/^\xEF\xBB\xBF/,""):v,[d,m]=a$(`${o}${h}`);for(const w of d)f(w);o=m,i=!1}function f(v){if(v===""){y();return}if(v.startsWith(":")){s&&s(v.slice(v.startsWith(": ")?2:1));return}const h=v.indexOf(":");if(h!==-1){const d=v.slice(0,h),m=v[h+1]===" "?2:1,w=v.slice(h+m);_(d,w,v);return}_(v,"",v)}function _(v,h,d){switch(v){case"event":u=h;break;case"data":c=`${c}${h}
40
+ `;break;case"id":a=h.includes("\0")?void 0:h;break;case"retry":/^\d+$/.test(h)?n(parseInt(h,10)):r(new Ed(`Invalid \`retry\` value: "${h}"`,{type:"invalid-retry",value:h,line:d}));break;default:r(new Ed(`Unknown field "${v.length>20?`${v.slice(0,20)}…`:v}"`,{type:"unknown-field",field:v,value:h,line:d}));break}}function y(){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={}){o&&v.consume&&f(o),i=!0,a=void 0,c="",u="",o=""}return{feed:l,reset:g}}function a$(t){const e=[];let r="",n=0;for(;n<t.length;){const s=t.indexOf("\r",n),o=t.indexOf(`
42
+ `,n);let i=-1;if(s!==-1&&o!==-1?i=Math.min(s,o):s!==-1?s===t.length-1?i=-1:i=s:o!==-1&&(i=o),i===-1){r=t.slice(n);break}else{const a=t.slice(n,i);e.push(a),n=i+1,t[n-1]==="\r"&&t[n]===`
43
+ `&&n++}}return[e,r]}class Td 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(xd(this),r)}[Symbol.for("Deno.customInspect")](e,r){return e(xd(this),r)}}function c$(t){const e=globalThis.DOMException;return typeof e=="function"?new e(t,"SyntaxError"):new SyntaxError(t)}function Yi(t){return t instanceof Error?"errors"in t&&Array.isArray(t.errors)?t.errors.map(Yi).join(", "):"cause"in t&&t.cause instanceof Error?`${t}: ${Yi(t.cause)}`:t.message:`${t}`}function xd(t){return{type:t.type,message:t.message,code:t.code,defaultPrevented:t.defaultPrevented,cancelable:t.cancelable,timeStamp:t.timeStamp}}var Rd=t=>{throw TypeError(t)},Xi=(t,e,r)=>e.has(t)||Rd("Cannot "+r),ne=(t,e,r)=>(Xi(t,e,"read from private field"),r?r.call(t):e.get(t)),je=(t,e,r)=>e.has(t)?Rd("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,r),$e=(t,e,r,n)=>(Xi(t,e,"write to private field"),e.set(t,r),r),zt=(t,e,r)=>(Xi(t,e,"access private method"),r),Xe,hr,Ar,Zs,Ls,Cn,zr,On,Xt,Mr,Zr,Lr,Nn,yt,Qi,ea,ta,Id,ra,na,jn,sa,oa;class Us extends EventTarget{constructor(e,r){var n,s;super(),je(this,yt),this.CONNECTING=0,this.OPEN=1,this.CLOSED=2,je(this,Xe),je(this,hr),je(this,Ar),je(this,Zs),je(this,Ls),je(this,Cn),je(this,zr),je(this,On,null),je(this,Xt),je(this,Mr),je(this,Zr,null),je(this,Lr,null),je(this,Nn,null),je(this,ea,async o=>{var i;ne(this,Mr).reset();const{body:a,redirected:c,status:u,headers:l}=o;if(u===204){zt(this,yt,jn).call(this,"Server sent HTTP 204, not reconnecting",204),this.close();return}if(c?$e(this,Ar,new URL(o.url)):$e(this,Ar,void 0),u!==200){zt(this,yt,jn).call(this,`Non-200 status code (${u})`,u);return}if(!(l.get("content-type")||"").startsWith("text/event-stream")){zt(this,yt,jn).call(this,'Invalid content type, expected "text/event-stream"',u);return}if(ne(this,Xe)===this.CLOSED)return;$e(this,Xe,this.OPEN);const f=new Event("open");if((i=ne(this,Nn))==null||i.call(this,f),this.dispatchEvent(f),typeof a!="object"||!a||!("getReader"in a)){zt(this,yt,jn).call(this,"Invalid response body, expected a web ReadableStream",u),this.close();return}const _=new TextDecoder,y=a.getReader();let g=!0;do{const{done:v,value:h}=await y.read();h&&ne(this,Mr).feed(_.decode(h,{stream:!v})),v&&(g=!1,ne(this,Mr).reset(),zt(this,yt,sa).call(this))}while(g)}),je(this,ta,o=>{$e(this,Xt,void 0),!(o.name==="AbortError"||o.type==="aborted")&&zt(this,yt,sa).call(this,Yi(o))}),je(this,ra,o=>{typeof o.id=="string"&&$e(this,On,o.id);const i=new MessageEvent(o.event||"message",{data:o.data,origin:ne(this,Ar)?ne(this,Ar).origin:ne(this,hr).origin,lastEventId:o.id||""});ne(this,Lr)&&(!o.event||o.event==="message")&&ne(this,Lr).call(this,i),this.dispatchEvent(i)}),je(this,na,o=>{$e(this,Cn,o)}),je(this,oa,()=>{$e(this,zr,void 0),ne(this,Xe)===this.CONNECTING&&zt(this,yt,Qi).call(this)});try{if(e instanceof URL)$e(this,hr,e);else if(typeof e=="string")$e(this,hr,new URL(e,u$()));else throw new Error("Invalid URL")}catch{throw c$("An invalid or illegal string was specified")}$e(this,Mr,Pd({onEvent:ne(this,ra),onRetry:ne(this,na)})),$e(this,Xe,this.CONNECTING),$e(this,Cn,3e3),$e(this,Ls,(n=r==null?void 0:r.fetch)!=null?n:globalThis.fetch),$e(this,Zs,(s=r==null?void 0:r.withCredentials)!=null?s:!1),zt(this,yt,Qi).call(this)}get readyState(){return ne(this,Xe)}get url(){return ne(this,hr).href}get withCredentials(){return ne(this,Zs)}get onerror(){return ne(this,Zr)}set onerror(e){$e(this,Zr,e)}get onmessage(){return ne(this,Lr)}set onmessage(e){$e(this,Lr,e)}get onopen(){return ne(this,Nn)}set onopen(e){$e(this,Nn,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(){ne(this,zr)&&clearTimeout(ne(this,zr)),ne(this,Xe)!==this.CLOSED&&(ne(this,Xt)&&ne(this,Xt).abort(),$e(this,Xe,this.CLOSED),$e(this,Xt,void 0))}}Xe=new WeakMap,hr=new WeakMap,Ar=new WeakMap,Zs=new WeakMap,Ls=new WeakMap,Cn=new WeakMap,zr=new WeakMap,On=new WeakMap,Xt=new WeakMap,Mr=new WeakMap,Zr=new WeakMap,Lr=new WeakMap,Nn=new WeakMap,yt=new WeakSet,Qi=function(){$e(this,Xe,this.CONNECTING),$e(this,Xt,new AbortController),ne(this,Ls)(ne(this,hr),zt(this,yt,Id).call(this)).then(ne(this,ea)).catch(ne(this,ta))},ea=new WeakMap,ta=new WeakMap,Id=function(){var t;const e={mode:"cors",redirect:"follow",headers:{Accept:"text/event-stream",...ne(this,On)?{"Last-Event-ID":ne(this,On)}:void 0},cache:"no-store",signal:(t=ne(this,Xt))==null?void 0:t.signal};return"window"in globalThis&&(e.credentials=this.withCredentials?"include":"same-origin"),e},ra=new WeakMap,na=new WeakMap,jn=function(t,e){var r;ne(this,Xe)!==this.CLOSED&&$e(this,Xe,this.CLOSED);const n=new Td("error",{code:e,message:t});(r=ne(this,Zr))==null||r.call(this,n),this.dispatchEvent(n)},sa=function(t,e){var r;if(ne(this,Xe)===this.CLOSED)return;$e(this,Xe,this.CONNECTING);const n=new Td("error",{code:e,message:t});(r=ne(this,Zr))==null||r.call(this,n),this.dispatchEvent(n),$e(this,zr,setTimeout(ne(this,oa),ne(this,Cn)))},oa=new WeakMap,Us.CONNECTING=0,Us.OPEN=1,Us.CLOSED=2;function u$(){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 ia(t){return t?t instanceof Headers?Object.fromEntries(t.entries()):Array.isArray(t)?Object.fromEntries(t):{...t}:{}}function Cd(t=fetch,e){return e?async(r,n)=>{const s={...e,...n,headers:n!=null&&n.headers?{...ia(e.headers),...ia(n.headers)}:e.headers};return t(r,s)}:t}let aa;aa=globalThis.crypto;async function l$(t){return(await aa).getRandomValues(new Uint8Array(t))}async function d$(t){const e="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-._~",r=Math.pow(2,8)-Math.pow(2,8)%e.length;let n="";for(;n.length<t;){const s=await l$(t-n.length);for(const o of s)o<r&&(n+=e[o%e.length])}return n}async function f$(t){return await d$(t)}async function h$(t){const e=await(await aa).subtle.digest("SHA-256",new TextEncoder().encode(t));return btoa(String.fromCharCode(...new Uint8Array(e))).replace(/\//g,"_").replace(/\+/g,"-").replace(/=/g,"")}async function p$(t){if(t||(t=43),t<43||t>128)throw`Expected a length between 43 and 128. Received ${t}.`;const e=await f$(t),r=await h$(e);return{code_verifier:e,code_challenge:r}}const Le=dy().superRefine((t,e)=>{if(!URL.canParse(t))return e.addIssue({code:n0.custom,message:"URL must be parseable",fatal:!0}),u_}).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"}),m$=ut({resource:$().url(),authorization_servers:j(Le).optional(),jwks_uri:$().url().optional(),scopes_supported:j($()).optional(),bearer_methods_supported:j($()).optional(),resource_signing_alg_values_supported:j($()).optional(),resource_name:$().optional(),resource_documentation:$().optional(),resource_policy_uri:$().url().optional(),resource_tos_uri:$().url().optional(),tls_client_certificate_bound_access_tokens:we().optional(),authorization_details_types_supported:j($()).optional(),dpop_signing_alg_values_supported:j($()).optional(),dpop_bound_access_tokens_required:we().optional()}),Od=ut({issuer:$(),authorization_endpoint:Le,token_endpoint:Le,registration_endpoint:Le.optional(),scopes_supported:j($()).optional(),response_types_supported:j($()),response_modes_supported:j($()).optional(),grant_types_supported:j($()).optional(),token_endpoint_auth_methods_supported:j($()).optional(),token_endpoint_auth_signing_alg_values_supported:j($()).optional(),service_documentation:Le.optional(),revocation_endpoint:Le.optional(),revocation_endpoint_auth_methods_supported:j($()).optional(),revocation_endpoint_auth_signing_alg_values_supported:j($()).optional(),introspection_endpoint:$().optional(),introspection_endpoint_auth_methods_supported:j($()).optional(),introspection_endpoint_auth_signing_alg_values_supported:j($()).optional(),code_challenge_methods_supported:j($()).optional(),client_id_metadata_document_supported:we().optional()}),_$=ut({issuer:$(),authorization_endpoint:Le,token_endpoint:Le,userinfo_endpoint:Le.optional(),jwks_uri:Le,registration_endpoint:Le.optional(),scopes_supported:j($()).optional(),response_types_supported:j($()),response_modes_supported:j($()).optional(),grant_types_supported:j($()).optional(),acr_values_supported:j($()).optional(),subject_types_supported:j($()),id_token_signing_alg_values_supported:j($()),id_token_encryption_alg_values_supported:j($()).optional(),id_token_encryption_enc_values_supported:j($()).optional(),userinfo_signing_alg_values_supported:j($()).optional(),userinfo_encryption_alg_values_supported:j($()).optional(),userinfo_encryption_enc_values_supported:j($()).optional(),request_object_signing_alg_values_supported:j($()).optional(),request_object_encryption_alg_values_supported:j($()).optional(),request_object_encryption_enc_values_supported:j($()).optional(),token_endpoint_auth_methods_supported:j($()).optional(),token_endpoint_auth_signing_alg_values_supported:j($()).optional(),display_values_supported:j($()).optional(),claim_types_supported:j($()).optional(),claims_supported:j($()).optional(),service_documentation:$().optional(),claims_locales_supported:j($()).optional(),ui_locales_supported:j($()).optional(),claims_parameter_supported:we().optional(),request_parameter_supported:we().optional(),request_uri_parameter_supported:we().optional(),require_request_uri_registration:we().optional(),op_policy_uri:Le.optional(),op_tos_uri:Le.optional(),client_id_metadata_document_supported:we().optional()}),g$=z({..._$.shape,...Od.pick({code_challenge_methods_supported:!0}).shape}),Nd=z({access_token:$(),id_token:$().optional(),token_type:$(),expires_in:be().optional(),scope:$().optional(),refresh_token:$().optional()}).strip(),v$=z({error:$(),error_description:$().optional(),error_uri:$().optional()}),jd=Le.optional().or(W("").transform(()=>{})),y$=z({redirect_uris:j(Le),token_endpoint_auth_method:$().optional(),grant_types:j($()).optional(),response_types:j($()).optional(),client_name:$().optional(),client_uri:Le.optional(),logo_uri:jd,scope:$().optional(),contacts:j($()).optional(),tos_uri:jd,policy_uri:$().optional(),jwks_uri:Le.optional(),jwks:Iy().optional(),software_id:$().optional(),software_version:$().optional(),software_statement:$().optional()}).strip(),b$=z({client_id:$(),client_secret:$().optional(),client_id_issued_at:be().optional(),client_secret_expires_at:be().optional()}).strip(),w$=y$.merge(b$);z({error:$(),error_description:$().optional()}).strip(),z({token:$(),token_type_hint:$().optional()}).strip();function $$(t){const e=typeof t=="string"?new URL(t):new URL(t.href);return e.hash="",e}function S$({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+"/",o=n.pathname.endsWith("/")?n.pathname:n.pathname+"/";return s.startsWith(o)}class Ue 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 ca extends Ue{}ca.errorCode="invalid_request";class Ds extends Ue{}Ds.errorCode="invalid_client";class qs extends Ue{}qs.errorCode="invalid_grant";class Vs extends Ue{}Vs.errorCode="unauthorized_client";class ua extends Ue{}ua.errorCode="unsupported_grant_type";class la extends Ue{}la.errorCode="invalid_scope";class da extends Ue{}da.errorCode="access_denied";class Ur extends Ue{}Ur.errorCode="server_error";class fa extends Ue{}fa.errorCode="temporarily_unavailable";class ha extends Ue{}ha.errorCode="unsupported_response_type";class pa extends Ue{}pa.errorCode="unsupported_token_type";class ma extends Ue{}ma.errorCode="invalid_token";class _a extends Ue{}_a.errorCode="method_not_allowed";class ga extends Ue{}ga.errorCode="too_many_requests";class Fs extends Ue{}Fs.errorCode="invalid_client_metadata";class va extends Ue{}va.errorCode="insufficient_scope";const k$={[ca.errorCode]:ca,[Ds.errorCode]:Ds,[qs.errorCode]:qs,[Vs.errorCode]:Vs,[ua.errorCode]:ua,[la.errorCode]:la,[da.errorCode]:da,[Ur.errorCode]:Ur,[fa.errorCode]:fa,[ha.errorCode]:ha,[pa.errorCode]:pa,[ma.errorCode]:ma,[_a.errorCode]:_a,[ga.errorCode]:ga,[Fs.errorCode]:Fs,[va.errorCode]:va};class st extends Error{constructor(e){super(e??"Unauthorized")}}function E$(t){return["client_secret_basic","client_secret_post","none"].includes(t)}const ya="code",ba="S256";function Ad(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&&E$(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 zd(t,e,r,n){const{client_id:s,client_secret:o}=e;switch(t){case"client_secret_basic":P$(s,o,r);return;case"client_secret_post":T$(s,o,n);return;case"none":x$(s,n);return;default:throw new Error(`Unsupported client authentication method: ${t}`)}}function P$(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 T$(t,e,r){r.set("client_id",t),e&&r.set("client_secret",e)}function x$(t,e){e.set("client_id",t)}async function wa(t){const e=t instanceof Response?t.status:void 0,r=t instanceof Response?await t.text():t;try{const n=v$.parse(JSON.parse(r)),{error:s,error_description:o,error_uri:i}=n,a=k$[s]||Ur;return new a(o||"",i)}catch(n){const s=`${e?`HTTP ${e}: `:""}Invalid OAuth error response: ${n}. Raw body: ${r}`;return new Ur(s)}}async function pr(t,e){var r,n;try{return await $a(t,e)}catch(s){if(s instanceof Ds||s instanceof Vs)return await((r=t.invalidateCredentials)===null||r===void 0?void 0:r.call(t,"all")),await $a(t,e);if(s instanceof qs)return await((n=t.invalidateCredentials)===null||n===void 0?void 0:n.call(t,"tokens")),await $a(t,e);throw s}}async function $a(t,{serverUrl:e,authorizationCode:r,scope:n,resourceMetadataUrl:s,fetchFn:o}){var i,a;let c,u;try{c=await C$(e,{resourceMetadataUrl:s},o),c.authorization_servers&&c.authorization_servers.length>0&&(u=c.authorization_servers[0])}catch{}u||(u=new URL("/",e));const l=await I$(e,t,c),f=await z$(u,{fetchFn:o});let _=await Promise.resolve(t.clientInformation());if(!_){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&&!R$(m))throw new Fs(`clientMetadataUrl must be a valid HTTPS URL with a non-root pathname, got: ${m}`);if(d&&m)_={client_id:m},await((i=t.saveClientInformation)===null||i===void 0?void 0:i.call(t,_));else{if(!t.saveClientInformation)throw new Error("OAuth client information must be saveable for dynamic registration");const S=await U$(u,{metadata:f,clientMetadata:t.clientMetadata,fetchFn:o});await t.saveClientInformation(S),_=S}}if(r!==void 0){const d=await t.codeVerifier(),m=await Z$(u,{metadata:f,clientInformation:_,authorizationCode:r,codeVerifier:d,redirectUri:t.redirectUrl,resource:l,addClientAuthentication:t.addClientAuthentication,fetchFn:o});return await t.saveTokens(m),"AUTHORIZED"}const y=await t.tokens();if(y!=null&&y.refresh_token)try{const d=await L$(u,{metadata:f,clientInformation:_,refreshToken:y.refresh_token,resource:l,addClientAuthentication:t.addClientAuthentication,fetchFn:o});return await t.saveTokens(d),"AUTHORIZED"}catch(d){if(!(!(d instanceof Ue)||d instanceof Ur))throw d}const g=t.state?await t.state():void 0,{authorizationUrl:v,codeVerifier:h}=await M$(u,{metadata:f,clientInformation:_,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(h),await t.redirectToAuthorization(v),"REDIRECT"}function R$(t){if(!t)return!1;try{const e=new URL(t);return e.protocol==="https:"&&e.pathname!=="/"}catch{return!1}}async function I$(t,e,r){const n=$$(t);if(e.validateResourceURL)return await e.validateResourceURL(n,r==null?void 0:r.resource);if(r){if(!S$({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 Hs(t){const e=t.headers.get("WWW-Authenticate");if(!e)return{};const[r,n]=e.split(" ");if(r.toLowerCase()!=="bearer"||!n)return{};const s=Sa(t,"resource_metadata")||void 0;let o;if(s)try{o=new URL(s)}catch{}const i=Sa(t,"scope")||void 0,a=Sa(t,"error")||void 0;return{resourceMetadataUrl:o,scope:i,error:a}}function Sa(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}async function C$(t,e,r=fetch){const n=await j$(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 m$.parse(await n.json())}async function ka(t,e,r=fetch){try{return await r(t,{headers:e})}catch(n){if(n instanceof TypeError)return e?ka(t,void 0,r):void 0;throw n}}function O$(t,e="",r={}){return e.endsWith("/")&&(e=e.slice(0,-1)),r.prependPathname?`${e}/.well-known/${t}`:`/.well-known/${t}${e}`}async function Md(t,e,r=fetch){return await ka(t,{"MCP-Protocol-Version":e},r)}function N$(t,e){return!t||t.status>=400&&t.status<500&&e!=="/"}async function j$(t,e,r,n){var s,o;const i=new URL(t),a=(s=n==null?void 0:n.protocolVersion)!==null&&s!==void 0?s:ln;let c;if(n!=null&&n.metadataUrl)c=new URL(n.metadataUrl);else{const l=O$(e,i.pathname);c=new URL(l,(o=n==null?void 0:n.metadataServerUrl)!==null&&o!==void 0?o:i),c.search=i.search}let u=await Md(c,a,r);if(!(n!=null&&n.metadataUrl)&&N$(u,i.pathname)){const l=new URL(`/.well-known/${e}`,i);u=await Md(l,a,r)}return u}function A$(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 z$(t,{fetchFn:e=fetch,protocolVersion:r=ln}={}){const n={"MCP-Protocol-Version":r,Accept:"application/json"},s=A$(t);for(const{url:o,type:i}of s){const a=await ka(o,n,e);if(a){if(!a.ok){if(a.status>=400&&a.status<500)continue;throw new Error(`HTTP ${a.status} trying to load ${i==="oauth"?"OAuth":"OpenID provider"} metadata from ${o}`)}return i==="oauth"?Od.parse(await a.json()):g$.parse(await a.json())}}}async function M$(t,{metadata:e,clientInformation:r,redirectUrl:n,scope:s,state:o,resource:i}){let a;if(e){if(a=new URL(e.authorization_endpoint),!e.response_types_supported.includes(ya))throw new Error(`Incompatible auth server: does not support response type ${ya}`);if(e.code_challenge_methods_supported&&!e.code_challenge_methods_supported.includes(ba))throw new Error(`Incompatible auth server: does not support code challenge method ${ba}`)}else a=new URL("/authorize",t);const c=await p$(),u=c.code_verifier,l=c.code_challenge;return a.searchParams.set("response_type",ya),a.searchParams.set("client_id",r.client_id),a.searchParams.set("code_challenge",l),a.searchParams.set("code_challenge_method",ba),a.searchParams.set("redirect_uri",String(n)),o&&a.searchParams.set("state",o),s&&a.searchParams.set("scope",s),s!=null&&s.includes("offline_access")&&a.searchParams.append("prompt","consent"),i&&a.searchParams.set("resource",i.href),{authorizationUrl:a,codeVerifier:u}}async function Z$(t,{metadata:e,clientInformation:r,authorizationCode:n,codeVerifier:s,redirectUri:o,resource:i,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 _=new Headers({"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"}),y=new URLSearchParams({grant_type:l,code:n,code_verifier:s,redirect_uri:String(o)});if(a)a(_,y,t,e);else{const v=(u=e==null?void 0:e.token_endpoint_auth_methods_supported)!==null&&u!==void 0?u:[],h=Ad(r,v);zd(h,r,_,y)}i&&y.set("resource",i.href);const g=await(c??fetch)(f,{method:"POST",headers:_,body:y});if(!g.ok)throw await wa(g);return Nd.parse(await g.json())}async function L$(t,{metadata:e,clientInformation:r,refreshToken:n,resource:s,addClientAuthentication:o,fetchFn:i}){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(o)o(l,f,t,e);else{const y=(a=e==null?void 0:e.token_endpoint_auth_methods_supported)!==null&&a!==void 0?a:[],g=Ad(r,y);zd(g,r,l,f)}s&&f.set("resource",s.href);const _=await(i??fetch)(u,{method:"POST",headers:l,body:f});if(!_.ok)throw await wa(_);return Nd.parse({refresh_token:n,...await _.json()})}async function U$(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 o=await(n??fetch)(s,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(r)});if(!o.ok)throw await wa(o);return w$.parse(await o.json())}class D$ extends Error{constructor(e,r,n){super(`SSE error: ${r}`),this.code=e,this.event=n}}class An{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=Cd(r==null?void 0:r.fetch,r==null?void 0:r.requestInit)}async _authThenStart(){var e;if(!this._authProvider)throw new st("No auth provider");let r;try{r=await pr(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 st;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((o,i)=>{this._eventSource=new Us(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:_}=Hs(l);this._resourceMetadataUrl=f,this._scope=_}return l}}),this._abortController=new AbortController,this._eventSource.onerror=a=>{var c;if(a.code===401&&this._authProvider){this._authThenStart().then(o,i);return}const u=new D$(a.code,a.message,a);i(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){i(l),(c=this.onerror)===null||c===void 0||c.call(this,l),this.close();return}o()}),this._eventSource.onmessage=a=>{var c,u;const l=a;let f;try{f=cr.parse(JSON.parse(l.data))}catch(_){(c=this.onerror)===null||c===void 0||c.call(this,_);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 st("No auth provider");if(await pr(this._authProvider,{serverUrl:this._url,authorizationCode:e,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})!=="AUTHORIZED")throw new st("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 o=await this._commonHeaders();o.set("content-type","application/json");const i={...this._requestInit,method:"POST",headers:o,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,i);if(!a.ok){if(a.status===401&&this._authProvider){const{resourceMetadataUrl:u,scope:l}=Hs(a);if(this._resourceMetadataUrl=u,this._scope=l,await pr(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})!=="AUTHORIZED")throw new st;return this.send(e)}const c=await a.text().catch(()=>null);throw new Error(`Error POSTing to endpoint (HTTP ${a.status}): ${c}`)}}catch(o){throw(s=this.onerror)===null||s===void 0||s.call(this,o),o}}setProtocolVersion(e){this._protocolVersion=e}}class q$ extends TransformStream{constructor({onError:e,onRetry:r,onComment:n}={}){let s;super({start(o){s=Pd({onEvent:i=>{o.enqueue(i)},onError(i){e==="terminate"?o.error(i):typeof e=="function"&&e(i)},onRetry:r,onComment:n})},transform(o){s.feed(o)}})}}const V$={initialReconnectionDelay:1e3,maxReconnectionDelay:3e4,reconnectionDelayGrowFactor:1.5,maxRetries:2};class zn extends Error{constructor(e,r){super(`Streamable HTTP error: ${r}`),this.code=e}}class Ws{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=Cd(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:V$}async _authThenStart(){var e;if(!this._authProvider)throw new st("No auth provider");let r;try{r=await pr(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 st;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=ia((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:o}=e;try{const i=await this._commonHeaders();i.set("Accept","text/event-stream"),o&&i.set("last-event-id",o);const a=await((r=this._fetch)!==null&&r!==void 0?r:fetch)(this._url,{method:"GET",headers:i,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 zn(a.status,`Failed to open SSE stream: ${a.statusText}`)}this._handleSseStream(a.body,e,!0)}catch(i){throw(s=this.onerror)===null||s===void 0||s.call(this,i),i}}_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 o=this._getNextReconnectionDelay(r);setTimeout(()=>{this._startOrAuthSse(e).catch(i=>{var a;(a=this.onerror)===null||a===void 0||a.call(this,new Error(`Failed to reconnect SSE stream: ${i instanceof Error?i.message:String(i)}`)),this._scheduleReconnection(e,r+1)})},o)}_handleSseStream(e,r,n){if(!e)return;const{onresumptiontoken:s,replayMessageId:o}=r;let i,a=!1;(async()=>{var u,l,f,_;try{const y=e.pipeThrough(new TextDecoderStream).pipeThrough(new q$({onRetry:v=>{this._serverRetryMs=v}})).getReader();for(;;){const{value:v,done:h}=await y.read();if(h)break;if(v.id&&(i=v.id,a=!0,s==null||s(v.id)),!v.event||v.event==="message")try{const d=cr.parse(JSON.parse(v.data));o!==void 0&&wi(d)&&(d.id=o),(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:i,onresumptiontoken:s,replayMessageId:o},0)}catch(y){if((f=this.onerror)===null||f===void 0||f.call(this,new Error(`SSE stream disconnected: ${y}`)),(n||a)&&this._abortController&&!this._abortController.signal.aborted)try{this._scheduleReconnection({resumptionToken:i,onresumptiontoken:s,replayMessageId:o},0)}catch(v){(_=this.onerror)===null||_===void 0||_.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 st("No auth provider");if(await pr(this._authProvider,{serverUrl:this._url,authorizationCode:e,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})!=="AUTHORIZED")throw new st("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,o,i;try{const{resumptionToken:a,onresumptiontoken:c}=r||{};if(a){this._startOrAuthSse({resumptionToken:a,replayMessageId:pl(e)?e.id:void 0}).catch(h=>{var d;return(d=this.onerror)===null||d===void 0?void 0:d.call(this,h)});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),_=f.headers.get("mcp-session-id");if(_&&(this._sessionId=_),!f.ok){if(f.status===401&&this._authProvider){if(this._hasCompletedAuthFlow)throw new zn(401,"Server returned 401 after successful authentication");const{resourceMetadataUrl:d,scope:m}=Hs(f);if(this._resourceMetadataUrl=d,this._scope=m,await pr(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})!=="AUTHORIZED")throw new st;return this._hasCompletedAuthFlow=!0,this.send(e)}if(f.status===403&&this._authProvider){const{resourceMetadataUrl:d,scope:m,error:w}=Hs(f);if(w==="insufficient_scope"){const S=f.headers.get("WWW-Authenticate");if(this._lastUpscopingHeader===S)throw new zn(403,"Server returned 403 after trying upscoping");if(m&&(this._scope=m),d&&(this._resourceMetadataUrl=d),this._lastUpscopingHeader=S??void 0,await pr(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetch})!=="AUTHORIZED")throw new st;return this.send(e)}}const h=await f.text().catch(()=>null);throw new Error(`Error POSTing to endpoint (HTTP ${f.status}): ${h}`)}if(this._hasCompletedAuthFlow=!1,this._lastUpscopingHeader=void 0,f.status===202){p0(e)&&this._startOrAuthSse({resumptionToken:void 0}).catch(h=>{var d;return(d=this.onerror)===null||d===void 0?void 0:d.call(this,h)});return}const g=(Array.isArray(e)?e:[e]).filter(h=>"method"in h&&"id"in h&&h.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 h=await f.json(),d=Array.isArray(h)?h.map(m=>cr.parse(m)):[cr.parse(h)];for(const m of d)(o=this.onmessage)===null||o===void 0||o.call(this,m)}else throw new zn(-1,`Unexpected content type: ${v}`)}catch(a){throw(i=this.onerror)===null||i===void 0||i.call(this,a),a}}get sessionId(){return this._sessionId}async terminateSession(){var e,r,n;if(this._sessionId)try{const s=await this._commonHeaders(),o={...this._requestInit,method:"DELETE",headers:s,signal:(e=this._abortController)===null||e===void 0?void 0:e.signal},i=await((r=this._fetch)!==null&&r!==void 0?r:fetch)(this._url,o);if(!i.ok&&i.status!==405)throw new zn(i.status,`Failed to terminate session: ${i.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})}}const F$="mcp";class Zd{constructor(e){this._url=e}start(){if(this._socket)throw new Error("WebSocketClientTransport already started! If using Client class, note that connect() calls start() automatically.");return new Promise((e,r)=>{this._socket=new WebSocket(this._url,F$),this._socket.onerror=n=>{var s;const o="error"in n?n.error:new Error(`WebSocket error: ${JSON.stringify(n)}`);r(o),(s=this.onerror)===null||s===void 0||s.call(this,o)},this._socket.onopen=()=>{e()},this._socket.onclose=()=>{var n;(n=this.onclose)===null||n===void 0||n.call(this)},this._socket.onmessage=n=>{var s,o;let i;try{i=cr.parse(JSON.parse(n.data))}catch(a){(s=this.onerror)===null||s===void 0||s.call(this,a);return}(o=this.onmessage)===null||o===void 0||o.call(this,i)}})}async close(){var e;(e=this._socket)===null||e===void 0||e.close()}send(e){return new Promise((r,n)=>{var s;if(!this._socket){n(new Error("Not connected"));return}(s=this._socket)===null||s===void 0||s.send(JSON.stringify(e)),r()})}}function Js(){const t=["224340fQYLJj","function","onmessage","port2","341XVdnBD","313767JEBgqL","950bpstaX","1354759gUhUbE","wRKyh","onclose","2044SvCTUj","endpoint","24msSkHx","164VuWYGY","mOWMr","EkZCC","addEventListener","postMessage","120705iyGzUz","8878392ivIdKn","close","_listen","3619482FaLQHc","start","_endpoint","kgkem","bzNYT","MessageChannel transport error: ","stringify","onmessageerror","HvyCv","undefined","Jwyua","message","_globalObject","parse","authInfo","thraG","220pGvxgp","_port","EGhzU","onerror","data","MhriV"];return Js=function(){return t},Js()}(function(t,e){const r=Ce,n=Ce,s=t();for(;;)try{if(parseInt(r(417))/1*(parseInt(r(421))/2)+parseInt(r(433))/3+parseInt(r(424))/4*(-parseInt(n(429))/5)+parseInt(n(423))/6*(-parseInt(n(418))/7)+-parseInt(n(430))/8+-parseInt(r(416))/9*(-parseInt(r(405))/10)+-parseInt(r(415))/11*(-parseInt(r(411))/12)===e)break;s.push(s.shift())}catch{s.push(s.shift())}})(Js,650197);const Ld=()=>{const t=Ce,e={EGhzU:function(r,n){return r!==n},kIrDB:"undefined",llYQe:function(r,n){return r!==n},PZfJg:function(r,n){return r(n)},Jwyua:"return this"};return typeof globalThis<"u"?globalThis:e[t(407)](typeof window,e.kIrDB)?window:e.llYQe(typeof global,e.kIrDB)?global:typeof self!==t(398)?self:e.PZfJg(Function,e[t(399)])()},H$=(t,e,r)=>{const n=Ce,s=Ce,o={};o[n(410)]=s(398),o.dBkaX=function(a,c){return a===c},o[s(393)]="function";const i=o;typeof window!==i[s(410)]?t.postMessage(e,"*",r):s(428)in t&&i.dBkaX(typeof t.postMessage,i[n(393)])&&t.postMessage(e,r)},W$=(t,e)=>{const r=Ce,n=Ce,s={};s.MbsGh="addEventListener",s.PPniK=function(i,a){return i===a},s[r(419)]=n(412),s[n(404)]="onmessage",s[r(397)]="undefined";const o=s;o.MbsGh in t&&o.PPniK(typeof t[r(427)],o.wRKyh)?t[r(427)](r(400),e):o.thraG in t&&typeof t[n(413)]!==o[n(397)]&&(t.onmessage=e)};class Bs{constructor(e){const r=Ce;this[r(406)]=e}async start(){const e=Ce,r=Ce;this[e(406)]&&(this[e(406)][e(413)]=n=>{var s,o;const i=e,a=r;try{const c=cr[i(402)](n.data[i(400)]);(s=this[i(413)])==null||s.call(this,c,n[a(409)].extra)}catch(c){const u=new Error("MessageChannel failed to parse message: "+c);(o=this[a(408)])==null||o.call(this,u)}},this._port[e(396)]=n=>{var s;const o=r,i=r,a=new Error(o(394)+JSON[i(395)](n));(s=this.onerror)==null||s.call(this,a)},this[e(406)][e(434)]())}async send(e,r){const n={lEyuq:function(s){return s()},YihNw:function(s,o){return s(o)}};return new Promise((s,o)=>{var i;const a=Ce,c=Ce;try{const u={};u[a(403)]=r==null?void 0:r[a(403)];const l={};l[c(400)]=e,l.extra=u,this[c(406)]&&this[a(406)].postMessage(l),n.lEyuq(s)}catch(u){const l=u instanceof Error?u:new Error(n.YihNw(String,u));(i=this[c(408)])==null||i.call(this,l),o(l)}})}async close(){var e,r;const n=Ce,s=Ce;(e=this._port)==null||e[n(431)](),this._port=void 0,(r=this[s(420)])==null||r.call(this)}}class Ea extends Bs{constructor(e,r=Ld()){const n=Ce,s=Ce,o={EkZCC:function(a,c,u,l){return a(c,u,l)}};super(),this[n(391)]=e,this[s(401)]=r;const i=new MessageChannel;this[s(406)]=i.port1,o[s(426)](H$,this[n(401)],{endpoint:this[s(391)]},[i[s(414)]])}}class Pa extends Bs{constructor(e,r=Ld()){const n=Ce,s={mOWMr:function(o,i){return o===i},kgkem:function(o,i,a){return o(i,a)}};super(),this._endpoint=e,this._globalObject=r,this[n(432)]=new Promise(o=>{const i=n,a=n;s[i(392)](W$,this[a(401)],c=>{const u=a,l=a;c.data&&s[u(425)](c.data[l(422)],this[l(391)])&&(this[l(406)]=c.ports[-1*4852+1*1601+3251],o())})})}async listen(){return this[Ce(432)]}}function Ce(t,e){const r=Js();return Ce=function(n,s){return n=n-(17*-491+-669+9407),r[n]},Ce(t,e)}const J$=()=>{const t=new MessageChannel;return[new Bs(t.port1),new Bs(t.port2)]};(function(t,e){const r=pe,n=pe,s=t();for(;;)try{if(parseInt(r(355))/1+-parseInt(r(356))/2*(-parseInt(r(373))/3)+-parseInt(r(337))/4+parseInt(n(357))/5+-parseInt(n(389))/6*(-parseInt(r(396))/7)+parseInt(n(325))/8*(parseInt(r(382))/9)+-parseInt(r(366))/10===e)break;s.push(s.shift())}catch{s.push(s.shift())}})(Ks,-763475+-52067*10+1724410);const B$=async(t,e,r)=>{var n;const s=pe,o=pe,i={};i[s(345)]="tools/list",i.rqstG="tools/call",i.WqUnk="resources/list",i[s(329)]=o(358),i[s(365)]=s(335),i.ookoz="resources/unsubscribe",i[s(385)]=s(340),i.VTIWq="prompts/list",i.SkoRK=s(376),i.QUtUV=s(388),i.XtowM=o(332);const a=i,{id:c,method:u,params:l}=r;let f={};switch(u){case a[o(345)]:f=await e.listTools(l);break;case a.rqstG:f=await e.callTool(l);break;case a[s(334)]:f=await e[s(350)](l);break;case a[o(329)]:f=await e.listResourceTemplates(l);break;case s(372):f=await e[s(383)](l);break;case a.HgYgW:f=await e.subscribeResource(l);break;case a.ookoz:f=await e.unsubscribeResource(l);break;case a[s(385)]:f=await e.getPrompt(l);break;case a.VTIWq:f=await e.listPrompts(l);break;case a[s(344)]:f=await e[s(376)]();break;case a.QUtUV:f=await e.complete(l);break;case s(390):f=await e[s(336)](l==null?void 0:l.level);break}const _={};_[s(361)]=f,_[s(394)]=a[s(364)],_.id=c,await((n=t==null?void 0:t.transport)==null?void 0:n[s(392)](_))},K$=async(t,e,r)=>{var n;const s=pe,o=pe,i={};i.jQBBS="sampling/createMessage",i.EZqgC="elicitation/create",i[s(370)]=o(376),i.aVeaL=o(332);const a=i,{id:c,method:u,params:l}=r;let f={};switch(u){case s(368):const y={};y.method=u,y[o(367)]=l,f=await e.request(y,Zi);break;case a[o(391)]:const g={};g.method=u,g[o(367)]=l,f=await e[o(381)](g,Ai);break;case a.EZqgC:const v={};v.method=u,v.params=l,f=await e.request(v,fn);break;case a[o(370)]:const h={};h.method=u,f=await e[o(381)](h,Jt);break}const _={};return _[o(361)]=f,_.jsonrpc=a[o(387)],_.id=c,await((n=t==null?void 0:t[s(371)])==null?void 0:n.send(_)),f},G$=(t,e)=>{const r=pe,n={gXsjT:function(o,i){return o===i},oegpC:r(351),lZOUC:function(o,i,a,c){return o(i,a,c)},ifIKG:"2.0"},s=t._onrequest;t._onrequest=async(o,i)=>{var a,c,u,l,f;const _=r,y=r,{id:g,method:v}=o;try{n[_(333)](v,n.oegpC)?await s[_(386)](t,o,i):await n.lZOUC(B$,t,e,o)}catch(h){const{code:d,message:m,data:w}=h;try{if(d){const S={};S.code=d,S.message=m,S.data=w;const P={};P.error=S,P[_(394)]=n[y(331)],P.id=g,await((a=t==null?void 0:t.transport)==null?void 0:a.send(P))}else(u=(c=t==null?void 0:t[y(371)])==null?void 0:c.onerror)==null||u.call(c,h)}catch(S){(f=(l=t==null?void 0:t[_(371)])==null?void 0:l.onerror)==null||f.call(l,S)}}}},Y$=(t,e)=>{const r=pe,n=pe,s={};s[r(363)]=function(i,a){return i!==a},s[r(398)]=r(353),s.hzhyg="notifications/cancelled";const o=s;t._onnotification=async i=>{var a,c;const u=r,l=n,{method:f,params:_}=i;if(o[u(363)](f,o[l(398)])&&(o[u(363)](f,o.hzhyg)||_!=null&&_.forward))try{await e.notification(i)}catch(y){(c=(a=t==null?void 0:t.transport)==null?void 0:a.onerror)==null||c.call(a,y)}}},X$=(t,e)=>async r=>{var n,s,o,i,a;const c=pe,u=pe,l={};l.SEmWX=c(332);const f=l;try{return await K$(t,e,r)}catch(_){const{code:y,message:g,data:v}=_;try{if(y){const h={};h[u(377)]=y,h.message=g,h.data=v;const d={};d[u(348)]=h,d.jsonrpc=f[c(338)],d.id=r.id,await((n=t==null?void 0:t.transport)==null?void 0:n[u(392)](d))}else(o=(s=t==null?void 0:t.transport)==null?void 0:s[u(339)])==null||o.call(s,_)}catch(h){(a=(i=t==null?void 0:t[c(371)])==null?void 0:i[u(339)])==null||a.call(i,h)}}},Q$=(t,e)=>async r=>{var n,s,o;const i=pe,a=pe,c={};c.dtUgZ=function(_,y){return _!==y},c.jgCIb=i(353),c.uUjKY="2.0";const u=c,{method:l,params:f}=r;if(u.dtUgZ(l,u.jgCIb)&&(l!==i(400)||f!=null&&f.forward))try{const _={...r};_[i(394)]=u[a(352)],await((n=e==null?void 0:e[i(371)])==null?void 0:n[i(392)](_))}catch(_){(o=(s=t==null?void 0:t[i(371)])==null?void 0:s[a(339)])==null||o.call(s,_)}};function pe(t,e){const r=Ks();return pe=function(n,s){return n=n-(9*-113+-1439*-1+-97),r[n]},pe(t,e)}const e1=(t,e)=>async r=>{var n,s,o,i,a,c;const u=pe,l=pe,f={};f[u(401)]=l(332);const _=f;try{await((n=e==null?void 0:e.transport)==null?void 0:n.send(r))}catch(y){const{code:g,message:v,data:h}=y;try{if(g){const d={};d.code=g,d[u(399)]=v,d.data=h;const m={};m[u(348)]=d,m[u(394)]=_.OhJjz,m.id=r.id,await((s=t==null?void 0:t[u(371)])==null?void 0:s.send(m))}else(i=(o=t==null?void 0:t.transport)==null?void 0:o[l(339)])==null||i.call(o,y)}catch(d){(c=(a=t==null?void 0:t.transport)==null?void 0:a.onerror)==null||c.call(a,d)}}},Ta=()=>{const t=pe,e=pe,r={vnkqu:function(u,l){return u!==l},wxDWr:function(u,l){return u(l)},GdkkV:function(u,l){return u===l}},n=[],s=(u,l)=>{const f=pe,_=pe;if(l){const y=[];for(const g of n)try{y.push(g(u,l))}catch{}for(const g of y)if(r[f(379)](g,null))return g}else for(const y of n)try{r[_(343)](y,u)}catch{}},o=u=>{const l=pe;r[l(384)](typeof u,l(369))&&!n.includes(u)&&n.push(u)},i=u=>{const l=n.indexOf(u);l!==-1&&n.splice(l,1*-6854+8*-33+7119)},a=()=>{const u=pe;n[u(374)]=7102*1+5522+-526*24},c={};return c[t(346)]=s,c[e(330)]=o,c.removeListener=i,c[t(359)]=a,c},t1=t=>{const e=pe,r=pe,n={xwPeb:function(s){return s()},Mfvzm:function(s){return s()}};{const{handleListener:s,addListener:o,removeListener:i,clearListener:a}=n[e(326)](Ta);t._onresponse=s,t[e(395)]=o,t.removeResponseListener=i,t.clearResponseListener=a}{const{handleListener:s,addListener:o,removeListener:i,clearListener:a}=n[r(326)](Ta);t[r(328)]=s,t.addRequestListener=o,t[r(354)]=i,t[r(341)]=a}{const{handleListener:s,addListener:o,removeListener:i,clearListener:a}=n[e(375)](Ta);t[e(342)]=s,t[e(327)]=o,t.removeNotificationListener=i,t.clearNotificationListener=a}};function Ks(){const t=["uUjKY","notifications/initialized","removeRequestListener","96194JysfjF","36346SGEWAV","1357830AJaOeY","resources/templates/list","clearListener","iQqcJ","result","tqDZP","sSeCz","XtowM","HgYgW","3913230mjiatC","params","roots/list","function","bfmJT","transport","resources/read","27FNuDmk","length","Mfvzm","ping","code","_onresponse","vnkqu","cjSoZ","request","9gIMIPC","readResource","GdkkV","ptMjy","call","aVeaL","completion/complete","5035122lFbpzR","logging/setLevel","jQBBS","send","_requestHandlers","jsonrpc","addResponseListener","7SpcenI","ElOQH","MDIkN","message","notifications/cancelled","OhJjz","clear","672216JzFEyR","xwPeb","addNotificationListener","fallbackRequestHandler","sYzPD","addListener","ifIKG","2.0","gXsjT","WqUnk","resources/subscribe","setLoggingLevel","2491772kFUWFh","SEmWX","onerror","prompts/get","clearRequestListener","fallbackNotificationHandler","wxDWr","SkoRK","uTeHc","handleListener","Zybtx","error","originalOnResponse","listResources","initialize"];return Ks=function(){return t},Ks()}const r1=(t,{beforeInit:e,afterInit:r}={})=>{const n=pe,s=pe,o={tqDZP:function(a,c){return a===c},cjSoZ:"function",iQqcJ:n(378),Zybtx:function(a,c){return a(c)},ElOQH:function(a){return a()}},i=new Map(t._notificationHandlers);t[n(393)][n(402)](),t._notificationHandlers[n(402)](),o.tqDZP(typeof e,o[n(380)])&&e(),o[n(362)](t._onresponse.name,o[n(360)])&&(t[s(349)]=t._onresponse),o[n(347)](t1,t),t.addResponseListener(a=>{const c=s;t.originalOnResponse[c(386)](t,a)}),o.tqDZP(typeof r,o[s(380)])&&o[n(397)](r),t[s(327)](a=>{const{method:c}=a,u=i.get(c);o.tqDZP(typeof u,o.cjSoZ)&&u(a)})},n1=xt,s1=xt;(function(t,e){const r=xt,n=xt,s=t();for(;;)try{if(-parseInt(r(393))/1+parseInt(r(397))/2*(-parseInt(r(400))/3)+-parseInt(n(398))/4+parseInt(r(390))/5*(parseInt(n(388))/6)+-parseInt(r(389))/7+-parseInt(r(402))/8*(-parseInt(n(395))/9)+parseInt(n(399))/10*(parseInt(n(385))/11)===e)break;s.push(s.shift())}catch{s.push(s.shift())}})(Gs,-1*-881393+2*180895+1*-644809);function xt(t,e){const r=Gs();return xt=function(n,s){return n=n-(-1861+-499*4+4241),r[n]},xt(t,e)}function Gs(){const t=["toString","getRandomValues","2101mUsYMI","EQHzo","padStart","30UvDAkd","1609706yzlqYx","974735GrhZVO","randomUUID","REzPF","562771BvAnoG","dHTfU","2047455boiYXf","randomBytes","14664qHAdbF","3772144jLpQch","52310AkWksx","318MkjaVb","from","40WRwnSc"];return Gs=function(){return t},Gs()}const o1=()=>{const t=xt,e=xt,r={};r.REzPF=function(s,o){return s&o},r.suJHI=function(s,o){return s===o},r[t(386)]=function(s,o){return s&o},r[e(394)]="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx";const n=r;return n.suJHI(typeof crypto,"object")&&crypto.randomUUID?crypto[e(391)]():n.dHTfU.replace(/[xy]/g,s=>{const o=t,i=t,a=n[o(392)](crypto[o(384)](new Uint8Array(-25*-62+7113+2*-4331))[741*2+-1385*-2+4252*-1],8648+-107*62+-1999);return(n.suJHI(s,"x")?a:n[i(386)](a,-4377+4*1095)|5079+461*-11).toString(9449+4*-461+-7589)})},i1=t=>{const e=xt,r=xt,n=new Uint8Array(t);return crypto.getRandomValues(n),Array[e(401)](n,s=>s[r(403)](-3*1739+-6509+2*5871)[e(387)](2,"0")).join("")},Qt={};Qt[n1(391)]=o1,Qt[s1(396)]=i1;const tt=Rt;(function(t,e){const r=Rt,n=Rt,s=t();for(;;)try{if(parseInt(r(521))/1*(parseInt(n(499))/2)+parseInt(n(543))/3*(parseInt(n(514))/4)+parseInt(r(502))/5*(parseInt(n(539))/6)+parseInt(r(553))/7+parseInt(r(516))/8*(-parseInt(r(518))/9)+-parseInt(r(531))/10+-parseInt(r(545))/11*(parseInt(r(541))/12)===e)break;s.push(s.shift())}catch{s.push(s.shift())}})(Ys,1472653*1+-2*-897917+-2275789);const a1=(t,e)=>{const r=Rt,n=Rt,s={FyYHt:function(c,u,l){return c(u,l)},Fxtoq:function(c,u,l){return c(u,l)}};G$(t,e),Y$(t,e);const o=X$(e,t),i=s[r(510)](e1,e,t),a=s[n(549)](Q$,e,t);e[n(537)](o),e[r(519)](i),e.addNotificationListener(a),t[n(556)]=()=>{const c=n;e.removeRequestListener(o),e[c(530)](i),e[c(529)](a)}},xa=(t,e,r)=>{const n=Rt,s={pMiva:function(a,c){return a instanceof c},TeTEy:n(546),fyZbd:function(a,c,u){return a(c,u)}},o=()=>{var a;const c=n;s.pMiva(r,An)&&((a=r._eventSource)==null||a.addEventListener(s[c(547)],()=>{var u;const l=c;(u=r[l(509)])==null||u[l(546)]()})),a1(t,e)},i={};i.afterInit=o,s.fyZbd(r1,e,i)},Ud=(t,e=Qt.randomUUID())=>{const r=Rt,n=Rt,s={OfssH:function(l,f,_){return l(f,_)}},o={};o[r(528)]=e;const i=o,a={};a[r(528)]=e;const c={};c[n(558)]=a,c[r(534)]=r(524);const u={requestInit:c,eventSourceInit:{async fetch(l,f){const _=r,y=n,g=new Headers((f==null?void 0:f[_(558)])||{});Object.entries(i)[y(498)](([h,d])=>{g[y(527)](h,d)});const v={...f};return v[y(558)]=g,s.OfssH(fetch,l,v)},withCredentials:!0}};return t&&(u.requestInit[r(558)].Authorization=r(533)+t,i.Authorization="Bearer "+t),u},Dd=(t,e=Qt[tt(517)]())=>{const r=tt,n=tt,s={};s.nwQhY="include";const o=s,i={};i["stream-session-id"]=e;const a={};a.headers=i,a.credentials=o[r(520)];const c={};c[r(544)]=a;const u=c;return t&&(u.requestInit.headers[n(552)]=n(533)+t),u},Ra=async(t,e,r)=>{const n=tt,s=tt,o={CFfFC:function(a){return a()},egwVO:function(a,c,u,l){return a(c,u,l)}},i=o.CFfFC(r);try{return await t[n(538)](i),i}catch(a){if(a instanceof st){const c=await e();return await i[s(505)](c),await o[n(525)](Ra,t,e,r)}else throw a}};function Rt(t,e){const r=Ys();return Rt=function(n,s){return n=n-(74*-67+-8341+-73*-189),r[n]},Rt(t,e)}const qd=(t,e)=>{const r=tt,n=tt,s={};s.RsKXs=function(i,a){return i in a},s.PBhps="waitForOAuthCode",s[r(535)]="function",s[r(507)]="waitForOAuthCode need to be provided when authProvider is provided";const o=s;if(o.RsKXs(o[n(551)],t))return t[n(523)];if(typeof e===o.yTKoP)return e;throw new Error(o.RZhOv)},c1=async t=>{const e=tt,r=tt,n={TFSRn:function(G,Ae,U){return G(Ae,U)},HwvVa:"mcp-sse-proxy-client",ufTHS:function(G){return G()},WIVYl:function(G,Ae,U,K){return G(Ae,U,K)},jniGY:"sessionId"},{client:s,url:o,token:i,sessionId:a,authProvider:c,requestInit:u,eventSourceInit:l,waitForOAuthCode:f}=t,_={};_.authProvider=c,_.requestInit=u,_.eventSourceInit=l;const y=_,g=a||Qt.randomUUID(),v=n[e(506)](Ud,i,g);if(u){const G={...v.requestInit,...u};G.headers={...v[e(544)].headers,...u.headers},y.requestInit=G}else y[r(544)]=v.requestInit;if(l){const G={...v[e(559)],...l};y.eventSourceInit=G}else y.eventSourceInit=v.eventSourceInit;const h={};h.listChanged=!0;const d={};d.roots=h,d.sampling={},d[e(511)]={};const m=d,w={};w[r(536)]=n.HwvVa,w.version=e(526);const S={};S.capabilities=m;const P=new In(w,S),O=()=>new An(new URL(o),y);let V=n[r(504)](O);if(c){const G=n[e(506)](qd,c,f);V=await n[r(513)](Ra,P,G,O)}else await P[e(538)](V);n[r(513)](xa,P,s,V),V[r(557)]=V[r(542)].searchParams[r(532)](n.jniGY);const ce={};return ce.transport=V,ce.sessionId=V[e(557)],ce};function Ys(){const t=["ufTHS","finishAuth","TFSRn","RZhOv","Vajmx","_eventSource","FyYHt","elicitation","transport","WIVYl","13320uyrBtN","sampling","8WTwLJD","randomUUID","6438654bkJHij","addResponseListener","nwQhY","11721GVgRMJ","?sessionId=","waitForOAuthCode","include","egwVO","1.0.0","set","sse-session-id","removeNotificationListener","removeResponseListener","11838520fNkjrV","get","Bearer ","credentials","yTKoP","name","addRequestListener","connect","18VhCgQv","mcp-socket-proxy-client","2819364JNqkQZ","_endpoint","699JyrxCR","requestInit","44ofbsvb","close","TeTEy","QgzDy","Fxtoq","roots","PBhps","Authorization","11309130xGCFwl","&token=","version","onclose","sessionId","headers","eventSourceInit","forEach","62FcOkCa","mcp-stream-proxy-client","zXcpO","1794855cQEXDT","biJOc"];return Ys=function(){return t},Ys()}const u1=async t=>{const e=tt,r=tt,n={Vajmx:e(500),biJOc:function(G){return G()},zXcpO:function(G,Ae,U){return G(Ae,U)},zDnjZ:function(G,Ae,U,K){return G(Ae,U,K)},FQMAh:function(G,Ae,U,K){return G(Ae,U,K)}},{client:s,url:o,token:i,sessionId:a,authProvider:c,requestInit:u,reconnectionOptions:l,waitForOAuthCode:f}=t,_={};_.authProvider=c,_.requestInit=u,_.reconnectionOptions=l;const y=_,g=a||Qt.randomUUID(),v=Dd(i,g);if(u){const G={...v.requestInit,...u};G.headers={...v.requestInit.headers,...u.headers},y[e(544)]=G}else y.requestInit=v.requestInit;const h={};h.listChanged=!0;const d={};d[r(550)]=h,d.sampling={},d.elicitation={};const m=d,w={};w[e(536)]=n[r(508)],w[e(555)]="1.0.0";const S={};S.capabilities=m;const P=new In(w,S),O=()=>new Ws(new URL(o),y);let V=n[e(503)](O);if(c){const G=n[e(501)](qd,c,f);V=await n.zDnjZ(Ra,P,G,O)}else await P.connect(V);n.FQMAh(xa,P,s,V);const ce={};return ce.transport=V,ce[r(557)]=V.sessionId,ce},l1=async t=>{const e=tt,r=tt,n={QgzDy:e(540),jkaVB:function(d,m,w,S){return d(m,w,S)}},{client:s,url:o,token:i,sessionId:a}=t,c={};c.listChanged=!0;const u={};u[e(550)]=c,u[e(515)]={},u[r(511)]={};const l=u,f={};f.name=n[r(548)],f[r(555)]=r(526);const _={};_.capabilities=l;const y=new In(f,_),g=a||Qt[r(517)](),v=new Zd(new URL(o+e(522)+g+r(554)+i));await y.connect(v),n.jkaVB(xa,y,s,v);const h={};return h[e(512)]=v,h[r(557)]=g,h},Mn=Qe,Xs=Qe;function Qe(t,e){const r=Qs();return Qe=function(n,s){return n=n-(-16761+51*337),r[n]},Qe(t,e)}(function(t,e){const r=Qe,n=Qe,s=t();for(;;)try{if(-parseInt(r(440))/1+-parseInt(r(458))/2*(parseInt(r(448))/3)+-parseInt(r(451))/4*(parseInt(n(449))/5)+-parseInt(n(455))/6+-parseInt(r(427))/7+-parseInt(n(438))/8*(parseInt(n(459))/9)+parseInt(r(430))/10*(parseInt(n(436))/11)===e)break;s.push(s.shift())}catch{s.push(s.shift())}})(Qs,-220880+1*-333337+-2*-384996);function Qs(){const t=["650XPHLhD","redirectToAuthorization","10856jPvMVb","GET","qcFPW","_redirectUrl","2187414WnlGuZ","resolve","tokens","3976YyOqUl","27ejNHsa","Content-Type","waitForOAuthCode","2903796yvWZFa","_clientMetadata","application/x-www-form-urlencoded","10beEWJk","json","code","_callBackPromise","reject","saveClientInformation","20776349mLNCcF","_codeVerifier","629912aTknXq","_tokens","52074GwcpRo","state","_state","_redirectCallback","_clientInformation","redirect_uris","Failed to redirect: ","clientInformation","381aduWsB"];return Qs=function(){return t},Qs()}const d1=()=>Qt.randomBytes(3485*1+-261+-3184);class f1{constructor(e){const r=Qe,n=Qe;this._callBackPromise={};const{clientMetadata:s,state:o,redirectCallback:i,getAuthCodeByState:a,waitForOAuthCode:c}=e;this[r(428)]=s,this[r(454)]=s[r(445)][0],this._state=o||d1(),this._redirectCallback=i||this.redirectCallbackFunction,this._getAuthCodeByState=a||this.getAuthCodeByStateFunction,this[n(426)]=c||this.waitForOAuthCodeFunction()}async redirectCallbackFunction(e){var r,n,s,o,i,a;const c=Qe,u=Qe,l={qITTp:function(g,v,h){return g(v,h)},qcFPW:c(452)},f=await l.qITTp(fetch,e,{method:l[c(453)]});!f.ok&&((n=(r=this._callBackPromise).reject)==null||n.call(r,u(446)+f.statusText));const _=await this._getAuthCodeByState(this[u(454)],this[c(442)]);if(!_.ok){(o=(s=this[c(433)]).reject)==null||o.call(s,"Failed to fetch auth code: "+_.statusText);return}const y=await _[c(431)]();(a=(i=this[u(433)])[c(456)])==null||a.call(i,y[c(432)])}async getAuthCodeByStateFunction(e,r){const n=Qe,s=Qe,o={};o.tuSmb=n(429);const i=o,a={};a[n(460)]=i.tuSmb;const c={};return c[s(441)]=r,fetch(e,{method:"POST",headers:a,body:new URLSearchParams(c)})}waitForOAuthCodeFunction(){const e=Qe,r=this[e(433)];return()=>new Promise((n,s)=>{const o=e;r.resolve=n,r[o(434)]=s})}get redirectUrl(){return this[Qe(454)]}get clientMetadata(){return this._clientMetadata}state(){return this._state}[Mn(447)](){return this[Mn(444)]}[Xs(435)](e){const r=Mn;this[r(444)]=e}[Xs(457)](){return this[Xs(439)]}saveTokens(e){this._tokens=e}[Xs(450)](e){this[Mn(443)](e)}saveCodeVerifier(e){this._codeVerifier=e}codeVerifier(){if(!this[Mn(437)])throw new Error("No code verifier saved");return this._codeVerifier}}(function(t,e){for(var r=to,n=to,s=t();;)try{var o=parseInt(r(361))/1*(parseInt(n(363))/2)+-parseInt(r(358))/3+parseInt(r(359))/4*(parseInt(r(357))/5)+parseInt(n(354))/6*(parseInt(r(360))/7)+parseInt(n(362))/8+parseInt(n(364))/9+-parseInt(n(356))/10*(parseInt(r(355))/11);if(o===e)break;s.push(s.shift())}catch{s.push(s.shift())}})(eo,-73523*-3+1*-407717+530518);function eo(){var t=["40ecBYYe","1095owKKYD","486870YOVwZy","5752xWiyTO","561484biNVMw","1fWJmxQ","1866064SPnyhb","1109522vMiuMX","1602351pPEGwH","12sVyMLL","2573296LTwOhv"];return eo=function(){return t},eo()}function to(t,e){var r=eo();return to=function(n,s){n=n-(-1*-642+503*-5+2227);var o=r[n];return o},to(t,e)}class h1 extends yd{constructor(e,r){var n,s;super(r),this._serverInfo=e,this._loggingLevels=new Map,this.LOG_LEVEL_SEVERITY=new Map(Es.options.map((o,i)=>[o,i])),this.isMessageIgnored=(o,i)=>{const a=this._loggingLevels.get(i);return a?this.LOG_LEVEL_SEVERITY.get(o)<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 kd,this.setRequestHandler(yl,o=>this._oninitialize(o)),this.setNotificationHandler(Si,()=>{var o;return(o=this.oninitialized)===null||o===void 0?void 0:o.call(this)}),this._capabilities.logging&&this.setRequestHandler(Ps,async(o,i)=>{var a;const c=i.sessionId||((a=i.requestInfo)===null||a===void 0?void 0:a.headers["mcp-session-id"])||void 0,{level:u}=o.params,l=Es.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=wd(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:ll.includes(r)?r:ln,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"},Jt)}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 o=e.messages[e.messages.length-1],i=Array.isArray(o.content)?o.content:[o.content],a=i.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(i.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(y=>y.type==="tool_use").map(y=>y.id)),_=new Set(i.filter(y=>y.type==="tool_result").map(y=>y.toolUseId));if(f.size!==_.size||![...f].every(y=>_.has(y)))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},Ai,r)}async elicitInput(e,r){var n,s,o,i,a;switch((n=e.mode)!==null&&n!==void 0?n:"form"){case"url":{if(!(!((o=(s=this._clientCapabilities)===null||s===void 0?void 0:s.elicitation)===null||o===void 0)&&o.url))throw new Error("Client does not support url elicitation.");const u=e;return this.request({method:"elicitation/create",params:u},fn,r)}case"form":{if(!(!((a=(i=this._clientCapabilities)===null||i===void 0?void 0:i.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},fn,r);if(l.action==="accept"&&l.content&&u.requestedSchema)try{const _=this._jsonSchemaValidator.getValidator(u.requestedSchema)(l.content);if(!_.valid)throw new ae(ie.InvalidParams,`Elicitation response content does not match requested schema: ${_.errorMessage}`)}catch(f){throw f instanceof ae?f:new ae(ie.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},Zi,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 Ia=Symbol.for("mcp.completable");function p1(t,e){return Object.defineProperty(t,Ia,{value:{complete:e},enumerable:!1,writable:!1,configurable:!1}),t}function m1(t){return!!t&&typeof t=="object"&&Ia in t}function _1(t){const e=t[Ia];return e==null?void 0:e.complete}var Vd;(function(t){t.Completable="McpCompletable"})(Vd||(Vd={}));const Fd=1e6,Ca=1e6,Hd=1e4,g1=1e6;class Mt{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){Mt.validateLength(e,Fd,"Template"),this.template=e,this.parts=this.parse(e)}toString(){return this.template}parse(e){const r=[];let n="",s=0,o=0;for(;s<e.length;)if(e[s]==="{"){n&&(r.push(n),n="");const i=e.indexOf("}",s);if(i===-1)throw new Error("Unclosed template expression");if(o++,o>Hd)throw new Error(`Template contains too many expressions (max ${Hd})`);const a=e.slice(s+1,i),c=this.getOperator(a),u=a.includes("*"),l=this.getNames(a),f=l[0];for(const _ of l)Mt.validateLength(_,Ca,"Variable name");r.push({name:f,operator:c,names:l,exploded:u}),s=i+1}else n+=e[s],s++;return n&&r.push(n),r}getOperator(e){return["+","#",".","/","?","&"].find(n=>e.startsWith(n))||""}getNames(e){const r=this.getOperator(e);return e.slice(r.length).split(",").map(n=>n.replace("*","").trim()).filter(n=>n.length>0)}encodeValue(e,r){return Mt.validateLength(e,Ca,"Variable value"),r==="+"||r==="#"?encodeURI(e):encodeURIComponent(e)}expandPart(e,r){if(e.operator==="?"||e.operator==="&"){const i=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 i.length===0?"":(e.operator==="?"?"?":"&")+i.join("&")}if(e.names.length>1){const i=e.names.map(a=>r[a]).filter(a=>a!==void 0);return i.length===0?"":i.map(a=>Array.isArray(a)?a[0]:a).join(",")}const n=r[e.name];if(n===void 0)return"";const o=(Array.isArray(n)?n:[n]).map(i=>this.encodeValue(i,e.operator));switch(e.operator){case"":return o.join(",");case"+":return o.join(",");case"#":return"#"+o.join(",");case".":return"."+o.join(".");case"/":return"/"+o.join("/");default:return o.join(",")}}expand(e){let r="",n=!1;for(const s of this.parts){if(typeof s=="string"){r+=s;continue}const o=this.expandPart(s,e);o&&((s.operator==="?"||s.operator==="&")&&n?r+=o.replace("?","&"):r+=o,(s.operator==="?"||s.operator==="&")&&(n=!0))}return r}escapeRegExp(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}partToRegExp(e){const r=[];for(const o of e.names)Mt.validateLength(o,Ca,"Variable name");if(e.operator==="?"||e.operator==="&"){for(let o=0;o<e.names.length;o++){const i=e.names[o],a=o===0?"\\"+e.operator:"&";r.push({pattern:a+this.escapeRegExp(i)+"=([^&]+)",name:i})}return r}let n;const s=e.name;switch(e.operator){case"":n=e.exploded?"([^/]+(?:,[^/]+)*)":"([^/,]+)";break;case"+":case"#":n="(.+)";break;case".":n="\\.([^/,]+)";break;case"/":n="/"+(e.exploded?"([^/]+(?:,[^/]+)*)":"([^/,]+)");break;default:n="([^/]+)"}return r.push({pattern:n,name:s}),r}match(e){Mt.validateLength(e,Fd,"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+="$",Mt.validateLength(r,g1,"Generated regex pattern");const s=new RegExp(r),o=e.match(s);if(!o)return null;const i={};for(let a=0;a<n.length;a++){const{name:c,exploded:u}=n[a],l=o[a+1],f=c.replace("*","");u&&l.includes(",")?i[f]=l.split(","):i[f]=l}return i}}const v1=/^[A-Za-z0-9._-]{1,128}$/;function y1(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"),!v1.test(t)){const r=t.split("").filter(n=>!/[A-Za-z0-9._-]/.test(n)).filter((n,s,o)=>o.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 b1(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 Wd(t){const e=y1(t);return b1(t,e.warnings),e.isValid}class Jd{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 h1(e,r)}async connect(e){return await this.server.connect(e)}async close(){await this.server.close()}setToolRequestHandlers(){this._toolHandlersInitialized||(this.server.assertCanSetRequestHandler(er(Ni)),this.server.assertCanSetRequestHandler(er(ji)),this.server.registerCapabilities({tools:{listChanged:!0}}),this.server.setRequestHandler(Ni,()=>({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=Rn(r.inputSchema);return s?_d(s,{strictUnions:!0,pipeStrategy:"input"}):$1})(),annotations:r.annotations,_meta:r._meta};if(r.outputSchema){const s=Rn(r.outputSchema);s&&(n.outputSchema=_d(s,{strictUnions:!0,pipeStrategy:"output"}))}return n})})),this.server.setRequestHandler(ji,async(e,r)=>{const n=this._registeredTools[e.params.name];let s;try{if(!n)throw new ae(ie.InvalidParams,`Tool ${e.params.name} not found`);if(!n.enabled)throw new ae(ie.InvalidParams,`Tool ${e.params.name} disabled`);if(n.inputSchema){const o=n.callback,i=Rn(n.inputSchema),a=i??n.inputSchema,c=await Hi(a,e.params.arguments);if(!c.success)throw new ae(ie.InvalidParams,`Input validation error: Invalid arguments for tool ${e.params.name}: ${Wi(c.error)}`);const u=c.data;s=await Promise.resolve(o(u,r))}else{const o=n.callback;s=await Promise.resolve(o(r))}if(n.outputSchema&&!s.isError){if(!s.structuredContent)throw new ae(ie.InvalidParams,`Output validation error: Tool ${e.params.name} has an output schema but no structured content was provided`);const o=Rn(n.outputSchema),i=await Hi(o,s.structuredContent);if(!i.success)throw new ae(ie.InvalidParams,`Output validation error: Invalid structured content for tool ${e.params.name}: ${Wi(i.error)}`)}}catch(o){if(o instanceof ae&&o.code===ie.UrlElicitationRequired)throw o;return this.createToolError(o instanceof Error?o.message:String(o))}return s}),this._toolHandlersInitialized=!0)}createToolError(e){return{content:[{type:"text",text:e}],isError:!0}}setCompletionRequestHandler(){this._completionHandlerInitialized||(this.server.assertCanSetRequestHandler(er(Mi)),this.server.registerCapabilities({completions:{}}),this.server.setRequestHandler(Mi,async e=>{switch(e.params.ref.type){case"ref/prompt":return ib(e),this.handlePromptCompletion(e,e.params.ref);case"ref/resource":return ab(e),this.handleResourceCompletion(e,e.params.ref);default:throw new ae(ie.InvalidParams,`Invalid completion reference: ${e.params.ref}`)}}),this._completionHandlerInitialized=!0)}async handlePromptCompletion(e,r){const n=this._registeredPrompts[r.name];if(!n)throw new ae(ie.InvalidParams,`Prompt ${r.name} not found`);if(!n.enabled)throw new ae(ie.InvalidParams,`Prompt ${r.name} disabled`);if(!n.argsSchema)return Zn;const s=xn(n.argsSchema),o=s==null?void 0:s[e.params.argument.name];if(!m1(o))return Zn;const i=_1(o);if(!i)return Zn;const a=await i(e.params.argument.value,e.params.context);return Kd(a)}async handleResourceCompletion(e,r){const n=Object.values(this._registeredResourceTemplates).find(i=>i.resourceTemplate.uriTemplate.toString()===r.uri);if(!n){if(this._registeredResources[r.uri])return Zn;throw new ae(ie.InvalidParams,`Resource template ${e.params.ref.uri} not found`)}const s=n.resourceTemplate.completeCallback(e.params.argument.name);if(!s)return Zn;const o=await s(e.params.argument.value,e.params.context);return Kd(o)}setResourceRequestHandlers(){this._resourceHandlersInitialized||(this.server.assertCanSetRequestHandler(er(Ss)),this.server.assertCanSetRequestHandler(er(Ti)),this.server.assertCanSetRequestHandler(er(Ri)),this.server.registerCapabilities({resources:{listChanged:!0}}),this.server.setRequestHandler(Ss,async(e,r)=>{const n=Object.entries(this._registeredResources).filter(([o,i])=>i.enabled).map(([o,i])=>({uri:o,name:i.name,...i.metadata})),s=[];for(const o of Object.values(this._registeredResourceTemplates)){if(!o.resourceTemplate.listCallback)continue;const i=await o.resourceTemplate.listCallback(r);for(const a of i.resources)s.push({...o.metadata,...a})}return{resources:[...n,...s]}}),this.server.setRequestHandler(Ti,async()=>({resourceTemplates:Object.entries(this._registeredResourceTemplates).map(([r,n])=>({name:r,uriTemplate:n.resourceTemplate.uriTemplate.toString(),...n.metadata}))})),this.server.setRequestHandler(Ri,async(e,r)=>{const n=new URL(e.params.uri),s=this._registeredResources[n.toString()];if(s){if(!s.enabled)throw new ae(ie.InvalidParams,`Resource ${n} disabled`);return s.readCallback(n,r)}for(const o of Object.values(this._registeredResourceTemplates)){const i=o.resourceTemplate.uriTemplate.match(n.toString());if(i)return o.readCallback(n,i,r)}throw new ae(ie.InvalidParams,`Resource ${n} not found`)}),this.setCompletionRequestHandler(),this._resourceHandlersInitialized=!0)}setPromptRequestHandlers(){this._promptHandlersInitialized||(this.server.assertCanSetRequestHandler(er(Ii)),this.server.assertCanSetRequestHandler(er(Ci)),this.server.registerCapabilities({prompts:{listChanged:!0}}),this.server.setRequestHandler(Ii,()=>({prompts:Object.entries(this._registeredPrompts).filter(([,e])=>e.enabled).map(([e,r])=>({name:e,title:r.title,description:r.description,arguments:r.argsSchema?k1(r.argsSchema):void 0}))})),this.server.setRequestHandler(Ci,async(e,r)=>{const n=this._registeredPrompts[e.params.name];if(!n)throw new ae(ie.InvalidParams,`Prompt ${e.params.name} not found`);if(!n.enabled)throw new ae(ie.InvalidParams,`Prompt ${e.params.name} disabled`);if(n.argsSchema){const s=Rn(n.argsSchema),o=await Hi(s,e.params.arguments);if(!o.success)throw new ae(ie.InvalidParams,`Invalid arguments for prompt ${e.params.name}: ${Wi(o.error)}`);const i=o.data,a=n.callback;return await Promise.resolve(a(i,r))}else{const s=n.callback;return await Promise.resolve(s(r))}}),this.setCompletionRequestHandler(),this._promptHandlersInitialized=!0)}resource(e,r,...n){let s;typeof n[0]=="object"&&(s=n.shift());const o=n[0];if(typeof r=="string"){if(this._registeredResources[r])throw new Error(`Resource ${r} is already registered`);const i=this._createRegisteredResource(e,void 0,r,s,o);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),i}else{if(this._registeredResourceTemplates[e])throw new Error(`Resource template ${e} is already registered`);const i=this._createRegisteredResourceTemplate(e,void 0,r,s,o);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),i}}registerResource(e,r,n,s){if(typeof r=="string"){if(this._registeredResources[r])throw new Error(`Resource ${r} is already registered`);const o=this._createRegisteredResource(e,n.title,r,n,s);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,n.title,r,n,s);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),o}}_createRegisteredResource(e,r,n,s,o){const i={name:e,title:r,metadata:s,readCallback:o,enabled:!0,disable:()=>i.update({enabled:!1}),enable:()=>i.update({enabled:!0}),remove:()=>i.update({uri:null}),update:a=>{typeof a.uri<"u"&&a.uri!==n&&(delete this._registeredResources[n],a.uri&&(this._registeredResources[a.uri]=i)),typeof a.name<"u"&&(i.name=a.name),typeof a.title<"u"&&(i.title=a.title),typeof a.metadata<"u"&&(i.metadata=a.metadata),typeof a.callback<"u"&&(i.readCallback=a.callback),typeof a.enabled<"u"&&(i.enabled=a.enabled),this.sendResourceListChanged()}};return this._registeredResources[n]=i,i}_createRegisteredResourceTemplate(e,r,n,s,o){const i={resourceTemplate:n,title:r,metadata:s,readCallback:o,enabled:!0,disable:()=>i.update({enabled:!1}),enable:()=>i.update({enabled:!0}),remove:()=>i.update({name:null}),update:a=>{typeof a.name<"u"&&a.name!==e&&(delete this._registeredResourceTemplates[e],a.name&&(this._registeredResourceTemplates[a.name]=i)),typeof a.title<"u"&&(i.title=a.title),typeof a.template<"u"&&(i.resourceTemplate=a.template),typeof a.metadata<"u"&&(i.metadata=a.metadata),typeof a.callback<"u"&&(i.readCallback=a.callback),typeof a.enabled<"u"&&(i.enabled=a.enabled),this.sendResourceListChanged()}};return this._registeredResourceTemplates[e]=i,i}_createRegisteredPrompt(e,r,n,s,o){const i={title:r,description:n,argsSchema:s===void 0?void 0:Tn(s),callback:o,enabled:!0,disable:()=>i.update({enabled:!1}),enable:()=>i.update({enabled:!0}),remove:()=>i.update({name:null}),update:a=>{typeof a.name<"u"&&a.name!==e&&(delete this._registeredPrompts[e],a.name&&(this._registeredPrompts[a.name]=i)),typeof a.title<"u"&&(i.title=a.title),typeof a.description<"u"&&(i.description=a.description),typeof a.argsSchema<"u"&&(i.argsSchema=Tn(a.argsSchema)),typeof a.callback<"u"&&(i.callback=a.callback),typeof a.enabled<"u"&&(i.enabled=a.enabled),this.sendPromptListChanged()}};return this._registeredPrompts[e]=i,i}_createRegisteredTool(e,r,n,s,o,i,a,c){Wd(e);const u={title:r,description:n,inputSchema:Bd(s),outputSchema:Bd(o),annotations:i,_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"&&Wd(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=Tn(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,o,i;if(typeof r[0]=="string"&&(n=r.shift()),r.length>1){const c=r[0];Oa(c)?(s=r.shift(),r.length>1&&typeof r[0]=="object"&&r[0]!==null&&!Oa(r[0])&&(i=r.shift())):typeof c=="object"&&c!==null&&(i=r.shift())}const a=r[0];return this._createRegisteredTool(e,void 0,n,s,o,i,void 0,a)}registerTool(e,r,n){if(this._registeredTools[e])throw new Error(`Tool ${e} is already registered`);const{title:s,description:o,inputSchema:i,outputSchema:a,annotations:c,_meta:u}=r;return this._createRegisteredTool(e,s,o,i,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 o=r[0],i=this._createRegisteredPrompt(e,void 0,n,s,o);return this.setPromptRequestHandlers(),this.sendPromptListChanged(),i}registerPrompt(e,r,n){if(this._registeredPrompts[e])throw new Error(`Prompt ${e} is already registered`);const{title:s,description:o,argsSchema:i}=r,a=this._createRegisteredPrompt(e,s,o,i,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 w1{constructor(e,r){this._callbacks=r,this._uriTemplate=typeof e=="string"?new Mt(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 $1={type:"object",properties:{}};function Oa(t){return typeof t!="object"||t===null?!1:Object.keys(t).length===0||Object.values(t).some(S1)}function S1(t){return t!==null&&typeof t=="object"&&"parse"in t&&typeof t.parse=="function"&&"safeParse"in t&&typeof t.safeParse=="function"}function Bd(t){if(t)return Oa(t)?Tn(t):t}function k1(t){const e=xn(t);return e?Object.entries(e).map(([r,n])=>{const s=mw(n),o=_w(n);return{name:r,description:s,required:!o}}):[]}function er(t){const e=xn(t),r=e==null?void 0:e.method;if(!r)throw new Error("Schema is missing a method literal");const n=id(r);if(typeof n=="string")return n;throw new Error("Schema method literal must be a string")}function Kd(t){return{completion:{values:t.slice(0,100),total:t.length,hasMore:t.length>100}}}const Zn={completion:{values:[],hasMore:!1}};class E1{constructor(e,r){const n={name:"web-mcp-server",version:"1.0.0"},s={prompts:{listChanged:!0},resources:{subscribe:!0,listChanged:!0},tools:{listChanged:!0},completions:{},logging:{}};this.server=new Jd(e||n,r||{capabilities:s}),this.server.server.oninitialized=()=>{var o;(o=this.oninitialized)==null||o.call(this)},this.server.server.onclose=()=>{var o;(o=this.onclose)==null||o.call(this)},this.server.server.onerror=o=>{var i;(i=this.onerror)==null||i.call(this,o)},this.server.server.setRequestHandler(Ps,async()=>({}))}async connect(e){return typeof e.start=="function"?(this.transport=e,this.transport.onclose=void 0,this.transport.onerror=void 0,this.transport.onmessage=void 0):(this.transport=new Pa(e),await this.transport.listen()),await this.server.connect(this.transport),this.transport}async close(){await this.server.close()}registerTool(e,r,n){return this.server.registerTool(e,r,n)}registerPrompt(e,r,n){return this.server.registerPrompt(e,r,n)}registerResource(e,r,n,s){return typeof r=="string"?this.server.registerResource(e,r,n,s):this.server.registerResource(e,r,n,s)}isConnected(){return this.server.isConnected()}sendResourceListChanged(){this.server.sendResourceListChanged()}sendToolListChanged(){this.server.sendToolListChanged()}sendPromptListChanged(){this.server.sendPromptListChanged()}getClientCapabilities(){return this.server.server.getClientCapabilities()}getClientVersion(){return this.server.server.getClientVersion()}async ping(){return await this.server.server.ping()}async createMessage(e,r){return await this.server.server.createMessage(e,r)}async elicitInput(e,r){return await this.server.server.elicitInput(e,r)}async listRoots(e,r){return await this.server.server.listRoots(e,r)}async sendLoggingMessage(e){return await this.server.server.sendLoggingMessage(e)}async sendResourceUpdated(e){return await this.server.server.sendResourceUpdated(e)}request(e,r,n){return this.server.server.request(e,r,n)}async notification(e,r){return await this.server.server.notification(e,r)}setRequestHandler(e,r){this.server.server.setRequestHandler(e,r)}removeRequestHandler(e){this.server.server.removeRequestHandler(e)}setNotificationHandler(e,r){this.server.server.setNotificationHandler(e,r)}removeNotificationHandler(e){this.server.server.removeNotificationHandler(e)}onSubscribe(e){this.server.server.setRequestHandler(Rl,e)}onUnsubscribe(e){this.server.server.setRequestHandler(Il,e)}onSetLogLevel(e){this.server.server.setRequestHandler(Ps,e)}onListResources(e){this.server.server.setRequestHandler(Ss,e)}onRootsListChanged(e){this.server.server.setNotificationHandler(Hl,e)}async onPagehide(e){e.persisted||this.transport&&typeof this.transport.close=="function"&&await this.transport.close()}}const P1=(t,e)=>new Pa(t,e),T1=()=>J$(),x1=t=>t instanceof Pa,R1=t=>t instanceof Jd;class I1{constructor(e,r){const n={name:"web-mcp-client",version:"1.0.0"},s={roots:{listChanged:!0},sampling:{},elicitation:{}};this.client=new In(e||n,r||{capabilities:s}),this.client.onclose=()=>{var o;(o=this.onclose)==null||o.call(this)},this.client.onerror=o=>{var i;(i=this.onerror)==null||i.call(this,o)}}async connect(e){if(typeof e.start=="function")return this.transport=e,this.transport.onclose=void 0,this.transport.onerror=void 0,this.transport.onmessage=void 0,await this.client.connect(this.transport),{transport:this.transport,sessionId:this.transport.sessionId};const{url:r,token:n,sessionId:s,type:o,agent:i,onError:a}=e;if(i===!0){const l={client:this.client,url:r,token:n,sessionId:s};let f;return await(async()=>{const{transport:y,sessionId:g}=o==="sse"?await c1(l):o==="socket"?await l1(l):await u1(l);y.onerror=async v=>{a==null||a(v)},f={transport:y,sessionId:g}})(),f}const c=new URL(r);let u;if(o==="channel"&&(u=new Ea(r),await this.client.connect(u)),o==="sse"){const l=Ud(n,s);u=new An(c,l),await this.client.connect(u)}if(o==="socket"&&(u=new Zd(new URL(`${r}?sessionId=${s}&token=${n}`)),u.sessionId=s,await this.client.connect(u)),typeof u>"u"){const l=Dd(n,s);u=new Ws(c,l),await this.client.connect(u)}return this.transport=u,{transport:this.transport,sessionId:this.transport.sessionId}}async close(){await this.client.close()}getServerCapabilities(){return this.client.getServerCapabilities()}getServerVersion(){return this.client.getServerVersion()}getInstructions(){return this.client.getInstructions()}async ping(e){return await this.client.ping(e)}async complete(e,r){return await this.client.complete(e,r)}async setLoggingLevel(e,r){return await this.client.setLoggingLevel(e,r)}async getPrompt(e,r){return await this.client.getPrompt(e,r)}async listPrompts(e,r){return await this.client.listPrompts(e,r)}async listResources(e,r){return await this.client.listResources(e,r)}async listResourceTemplates(e,r){return await this.client.listResourceTemplates(e,r)}async readResource(e,r){return await this.client.readResource(e,r)}async subscribeResource(e,r){return await this.client.subscribeResource(e,r)}async unsubscribeResource(e,r){return await this.client.unsubscribeResource(e,r)}async callTool(e,r){return await this.client.callTool(e,ks,r)}async listTools(e,r){return await this.client.listTools(e,r)}async sendRootsListChanged(){return await this.client.sendRootsListChanged()}request(e,r,n){return this.client.request(e,r,n)}async notification(e,r){return await this.client.notification(e,r)}setRequestHandler(e,r){this.client.setRequestHandler(e,r)}removeRequestHandler(e){this.client.removeRequestHandler(e)}setNotificationHandler(e,r){this.client.setNotificationHandler(e,r)}removeNotificationHandler(e){this.client.removeNotificationHandler(e)}onElicit(e){this.client.setRequestHandler(zi,e)}onCreateMessage(e){this.client.setRequestHandler(ql,e)}onListRoots(e){this.client.setRequestHandler(Fl,e)}onToolListChanged(e){this.client.setNotificationHandler(Ul,e)}onPromptListChanged(e){this.client.setNotificationHandler(Ml,e)}onResourceListChanged(e){this.client.setNotificationHandler(xl,e)}onResourceUpdated(e){this.client.setNotificationHandler(Cl,e)}onLoggingMessage(e){this.client.setNotificationHandler(Dl,e)}async onPagehide(e){e.persisted||(Gd(this.transport)?await this.transport.terminateSession():this.transport&&typeof this.transport.close=="function"&&await this.transport.close())}}const C1=(t,e)=>new An(t,e),O1=(t,e)=>new Ws(t,e),N1=(t,e)=>new Ea(t,e),j1=t=>t instanceof An,Gd=t=>t instanceof Ws,A1=t=>t instanceof Ea,z1=t=>t instanceof In;function M1(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}const Z1=()=>typeof crypto<"u"&&crypto.randomUUID?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,t=>{const e=Math.random()*16|0;return(t==="x"?e:e&3|8).toString(16)}),ro=(t,e,r)=>{window.postMessage({type:t,direction:r,data:e},"*")},Yd=(t,e,r)=>{const n=async function(s){s.source===window&&s.data.type===t&&s.data.direction===r&&await e(s.data.data)};return window.addEventListener("message",n),()=>window.removeEventListener("message",n)};class L1{constructor(e=null,r){this._isStarted=!1,this._isClosed=!1,this._lastRegistration=null,this.sessionId=e||Z1(),this.tabId=r,this._messageListener1=Yd("sidepanel-ready-to-page",()=>{this._lastRegistration&&this._isStarted&&this.notifyRegistration(this._lastRegistration).catch(n=>{console.error("【Page Svr Transport】 notifyRegistration失败:",n)})},"content->page"),this._messageListener2=Yd("mcp-client-to-server-to-page",n=>{var i,a,c;if(n.sessionId!==this.sessionId||n.tabId!==this.tabId)return;console.log("【Page Svr Transport】 即将处理 mcpMessage",n.mcpMessage);const s=cr.parse(n.mcpMessage);(i=this.onmessage)==null||i.call(this,s),((a=n.mcpMessage.params)==null?void 0:a.name)&&ro("update-page-app-message",{status:"run",message:(c=n.mcpMessage.params)==null?void 0:c.name},"page->content")},"content->page")}_throwError(e,r){if(e()){const n=new Error(r);throw console.log(r,n),this.onerror&&this.onerror(n),n}}async start(){if(!this._isStarted){if(this._isClosed)throw new Error("【Page Svr Transport】 已关闭,无法重新启动");this._isStarted=!0}}async send(e,r){var n;this._throwError(()=>!this._isStarted,"【Page Svr Transport】 未启动,无法发送消息"),this._throwError(()=>this._isClosed,"【Page Svr Transport】 已关闭,无法发送消息"),ro("mcp-server-to-client-from-page",{sessionId:this.sessionId,mcpMessage:e},"page->content"),"result"in e&&((n=e.result)!=null&&n.content)&&ro("update-page-app-message",{status:"ready",message:""},"page->content")}async notifyRegistration(e){this._throwError(()=>!this._isStarted,"【Page Svr Transport】 未启动,无法注册消息"),this._lastRegistration=e;try{ro("mcp-server-register-from-page",{sessionId:this.sessionId,serverInfo:{...e,url:window.location.origin,title:document.title}},"page->content")}catch(r){this._throwError(()=>!0,"【Page Svr Transport】 注册 server 失败"+String(r))}}async close(){if(!this._isClosed)try{this._messageListener1&&this._messageListener1(),this._messageListener2&&this._messageListener2(),this._isClosed=!0,this._isStarted=!1,this.onclose&&this.onclose()}catch(e){this._throwError(()=>!0,"【Page Svr Transport】 关闭时发生错误"+String(e))}}}me.Ajv=c_,me.AuthClientProvider=f1,me.ExtensionPageServerTransport=L1,me.ResourceTemplate=w1,me.UriTemplate=Mt,me.WebMcpClient=I1,me.WebMcpServer=E1,me.completable=p1,me.createMessageChannelClientTransport=N1,me.createMessageChannelPairTransport=T1,me.createMessageChannelServerTransport=P1,me.createSSEClientTransport=C1,me.createStreamableHTTPClientTransport=O1,me.getDisplayName=M1,me.isMcpClient=z1,me.isMcpServer=R1,me.isMessageChannelClientTransport=A1,me.isMessageChannelServerTransport=x1,me.isSSEClientTransport=j1,me.isStreamableHTTPClientTransport=Gd,me.z=fw,Object.defineProperty(me,Symbol.toStringTag,{value:"Module"})});