@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.
- package/agent/AgentModelProvider.ts +49 -20
- package/agent/type.ts +4 -4
- package/dist/McpSdk.d.ts +14 -0
- package/dist/WebAgent.d.ts +5 -0
- package/dist/WebMcp.d.ts +20 -0
- package/dist/WebMcpClient.d.ts +250 -1488
- package/dist/WebMcpServer.d.ts +190 -78
- package/dist/Zod.d.ts +1 -0
- package/dist/agent/AgentModelProvider.d.ts +6 -4
- package/dist/agent/type.d.ts +6 -2
- package/dist/agent/utils/getAISDKTools.d.ts +1 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.es.dev.js +23743 -25868
- package/dist/index.es.js +24524 -24312
- package/dist/index.js +1789 -25
- package/dist/index.umd.dev.js +23845 -25970
- package/dist/index.umd.js +185 -129
- package/dist/{mcpsdk@1.20.1.dev.js → mcpsdk@1.23.0.dev.js} +13535 -14184
- package/dist/{mcpsdk@1.20.1.es.dev.js → mcpsdk@1.23.0.es.dev.js} +13563 -14212
- package/dist/mcpsdk@1.23.0.es.js +15584 -0
- package/dist/mcpsdk@1.23.0.js +43 -0
- package/dist/remoter/createRemoter.d.ts +9 -0
- package/dist/remoter/tooltips.d.ts +36 -0
- package/dist/script/utils.d.ts +1 -0
- package/dist/transport/ExtensionClientTransport.d.ts +3 -2
- package/dist/transport/ExtensionContentServerTransport.d.ts +3 -2
- package/dist/transport/ExtensionPageServerTransport.d.ts +3 -2
- package/dist/vite-build-tsc.d.ts +2 -0
- package/dist/vite.config.d.ts +2 -0
- package/dist/vite.config.mcpSdk.d.ts +2 -0
- package/dist/vite.config.webAgent.d.ts +2 -0
- package/dist/vite.config.webMcp.d.ts +2 -0
- package/dist/vite.config.webMcpFull.d.ts +2 -0
- package/dist/vite.config.zod.d.ts +2 -0
- package/dist/webagent.dev.js +18803 -18836
- package/dist/webagent.es.dev.js +17726 -17759
- package/dist/webagent.es.js +22571 -20829
- package/dist/webagent.js +172 -109
- package/dist/webmcp-full.dev.js +14463 -15009
- package/dist/webmcp-full.es.dev.js +14471 -15017
- package/dist/webmcp-full.es.js +13391 -12365
- package/dist/webmcp-full.js +43 -16
- package/package.json +3 -2
- package/remoter/createRemoter.ts +126 -71
- package/remoter/tooltips.ts +260 -0
- package/tsconfig.json +5 -3
- package/vite-build-tsc.ts +60 -0
- package/vite-env.d.ts +5 -0
- package/dist/WebMcpClient.js +0 -363
- package/dist/WebMcpServer.js +0 -283
- package/dist/agent/AgentModelProvider.js +0 -293
- package/dist/agent/type.js +0 -1
- package/dist/agent/utils/getAISDKTools.js +0 -36
- package/dist/mcpsdk@1.20.1.es.js +0 -14600
- package/dist/mcpsdk@1.20.1.js +0 -16
- package/dist/remoter/QrCode.js +0 -55
- package/dist/remoter/createRemoter.js +0 -743
- package/dist/transport/ExtensionClientTransport.js +0 -81
- package/dist/transport/ExtensionContentServerTransport.js +0 -128
- package/dist/transport/ExtensionPageServerTransport.js +0 -118
- package/dist/transport/messages.js +0 -51
- package/dist/utils/uuid.js +0 -10
package/dist/mcpsdk@1.20.1.js
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
(function(R,aa){typeof exports=="object"&&typeof module<"u"?aa(exports):typeof define=="function"&&define.amd?define(["exports"],aa):(R=typeof globalThis<"u"?globalThis:R||self,aa(R.MCPSDK={}))})(this,function(R){"use strict";var aa=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function tl(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var fn={exports:{}},rl={},bt={},Ar={},sa={},ge={},na={};(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 a extends e{constructor($){if(super(),!t.IDENTIFIER.test($))throw new Error("CodeGen: name must be a valid identifier");this.str=$}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}}t.Name=a;class s extends e{constructor($){super(),this._items=typeof $=="string"?[$]:$}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;const $=this._items[0];return $===""||$==='""'}get str(){var $;return($=this._str)!==null&&$!==void 0?$:this._str=this._items.reduce((P,k)=>`${P}${k}`,"")}get names(){var $;return($=this._names)!==null&&$!==void 0?$:this._names=this._items.reduce((P,k)=>(k instanceof a&&(P[k.str]=(P[k.str]||0)+1),P),{})}}t._Code=s,t.nil=new s("");function r(v,...$){const P=[v[0]];let k=0;for(;k<$.length;)o(P,$[k]),P.push(v[++k]);return new s(P)}t._=r;const n=new s("+");function i(v,...$){const P=[d(v[0])];let k=0;for(;k<$.length;)P.push(n),o(P,$[k]),P.push(n,d(v[++k]));return c(P),new s(P)}t.str=i;function o(v,$){$ instanceof s?v.push(...$._items):$ instanceof a?v.push($):v.push(f($))}t.addCodeArg=o;function c(v){let $=1;for(;$<v.length-1;){if(v[$]===n){const P=l(v[$-1],v[$+1]);if(P!==void 0){v.splice($-1,3,P);continue}v[$++]="+"}$++}}function l(v,$){if($==='""')return v;if(v==='""')return $;if(typeof v=="string")return $ instanceof a||v[v.length-1]!=='"'?void 0:typeof $!="string"?`${v.slice(0,-1)}${$}"`:$[0]==='"'?v.slice(0,-1)+$.slice(1):void 0;if(typeof $=="string"&&$[0]==='"'&&!(v instanceof a))return`"${v}${$.slice(1)}`}function u(v,$){return $.emptyStr()?v:v.emptyStr()?$:i`${v}${$}`}t.strConcat=u;function f(v){return typeof v=="number"||typeof v=="boolean"||v===null?v:d(Array.isArray(v)?v.join(","):v)}function y(v){return new s(d(v))}t.stringify=y;function d(v){return JSON.stringify(v).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}t.safeStringify=d;function m(v){return typeof v=="string"&&t.IDENTIFIER.test(v)?new s(`.${v}`):r`[${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})(na);var hn={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.ValueScope=t.ValueScopeName=t.Scope=t.varKinds=t.UsedValueState=void 0;const e=na;class a extends Error{constructor(l){super(`CodeGen: "code" for ${l} not defined`),this.value=l.value}}var s;(function(c){c[c.Started=0]="Started",c[c.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 r{constructor({prefixes:l,parent:u}={}){this._names={},this._prefixes=l,this._parent=u}toName(l){return l instanceof e.Name?l:this.name(l)}name(l){return new e.Name(this._newName(l))}_newName(l){const u=this._names[l]||this._nameGroup(l);return`${l}${u.index++}`}_nameGroup(l){var u,f;if(!((f=(u=this._parent)===null||u===void 0?void 0:u._prefixes)===null||f===void 0)&&f.has(l)||this._prefixes&&!this._prefixes.has(l))throw new Error(`CodeGen: prefix "${l}" is not allowed in this scope`);return this._names[l]={prefix:l,index:0}}}t.Scope=r;class n extends e.Name{constructor(l,u){super(u),this.prefix=l}setValue(l,{property:u,itemIndex:f}){this.value=l,this.scopePath=(0,e._)`.${new e.Name(u)}[${f}]`}}t.ValueScopeName=n;const i=(0,e._)`\n`;class o extends r{constructor(l){super(l),this._values={},this._scope=l.scope,this.opts={...l,_n:l.lines?i:e.nil}}get(){return this._scope}name(l){return new n(l,this._newName(l))}value(l,u){var f;if(u.ref===void 0)throw new Error("CodeGen: ref must be passed in value");const y=this.toName(l),{prefix:d}=y,m=(f=u.key)!==null&&f!==void 0?f:u.ref;let p=this._values[d];if(p){const $=p.get(m);if($)return $}else p=this._values[d]=new Map;p.set(m,y);const h=this._scope[d]||(this._scope[d]=[]),v=h.length;return h[v]=u.ref,y.setValue(u,{property:d,itemIndex:v}),y}getValue(l,u){const f=this._values[l];if(f)return f.get(u)}scopeRefs(l,u=this._values){return this._reduceValues(u,f=>{if(f.scopePath===void 0)throw new Error(`CodeGen: name "${f}" has no value`);return(0,e._)`${l}${f.scopePath}`})}scopeCode(l=this._values,u,f){return this._reduceValues(l,y=>{if(y.value===void 0)throw new Error(`CodeGen: name "${y}" has no value`);return y.value.code},u,f)}_reduceValues(l,u,f={},y){let d=e.nil;for(const m in l){const p=l[m];if(!p)continue;const h=f[m]=f[m]||new Map;p.forEach(v=>{if(h.has(v))return;h.set(v,s.Started);let $=u(v);if($){const P=this.opts.es5?t.varKinds.var:t.varKinds.const;d=(0,e._)`${d}${P} ${v} = ${$};${this.opts._n}`}else if($=y==null?void 0:y(v))d=(0,e._)`${d}${$}${this.opts._n}`;else throw new a(v);h.set(v,s.Completed)})}return d}}t.ValueScope=o})(hn),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=na,a=hn;var s=na;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 r=hn;Object.defineProperty(t,"Scope",{enumerable:!0,get:function(){return r.Scope}}),Object.defineProperty(t,"ValueScope",{enumerable:!0,get:function(){return r.ValueScope}}),Object.defineProperty(t,"ValueScopeName",{enumerable:!0,get:function(){return r.ValueScopeName}}),Object.defineProperty(t,"varKinds",{enumerable:!0,get:function(){return r.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(g,w){return this}}class i extends n{constructor(g,w,A){super(),this.varKind=g,this.name=w,this.rhs=A}render({es5:g,_n:w}){const A=g?a.varKinds.var:this.varKind,Z=this.rhs===void 0?"":` = ${this.rhs}`;return`${A} ${this.name}${Z};`+w}optimizeNames(g,w){if(g[this.name.str])return this.rhs&&(this.rhs=M(this.rhs,g,w)),this}get names(){return this.rhs instanceof e._CodeOrName?this.rhs.names:{}}}class o extends n{constructor(g,w,A){super(),this.lhs=g,this.rhs=w,this.sideEffects=A}render({_n:g}){return`${this.lhs} = ${this.rhs};`+g}optimizeNames(g,w){if(!(this.lhs instanceof e.Name&&!g[this.lhs.str]&&!this.sideEffects))return this.rhs=M(this.rhs,g,w),this}get names(){const g=this.lhs instanceof e.Name?{}:{...this.lhs.names};return F(g,this.rhs)}}class c extends o{constructor(g,w,A,Z){super(g,A,Z),this.op=w}render({_n:g}){return`${this.lhs} ${this.op}= ${this.rhs};`+g}}class l extends n{constructor(g){super(),this.label=g,this.names={}}render({_n:g}){return`${this.label}:`+g}}class u extends n{constructor(g){super(),this.label=g,this.names={}}render({_n:g}){return`break${this.label?` ${this.label}`:""};`+g}}class f extends n{constructor(g){super(),this.error=g}render({_n:g}){return`throw ${this.error};`+g}get names(){return this.error.names}}class y extends n{constructor(g){super(),this.code=g}render({_n:g}){return`${this.code};`+g}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(g,w){return this.code=M(this.code,g,w),this}get names(){return this.code instanceof e._CodeOrName?this.code.names:{}}}class d extends n{constructor(g=[]){super(),this.nodes=g}render(g){return this.nodes.reduce((w,A)=>w+A.render(g),"")}optimizeNodes(){const{nodes:g}=this;let w=g.length;for(;w--;){const A=g[w].optimizeNodes();Array.isArray(A)?g.splice(w,1,...A):A?g[w]=A:g.splice(w,1)}return g.length>0?this:void 0}optimizeNames(g,w){const{nodes:A}=this;let Z=A.length;for(;Z--;){const Q=A[Z];Q.optimizeNames(g,w)||(re(g,Q.names),A.splice(Z,1))}return A.length>0?this:void 0}get names(){return this.nodes.reduce((g,w)=>B(g,w.names),{})}}class m extends d{render(g){return"{"+g._n+super.render(g)+"}"+g._n}}class p extends d{}class h extends m{}h.kind="else";class v extends m{constructor(g,w){super(w),this.condition=g}render(g){let w=`if(${this.condition})`+super.render(g);return this.else&&(w+="else "+this.else.render(g)),w}optimizeNodes(){super.optimizeNodes();const g=this.condition;if(g===!0)return this.nodes;let w=this.else;if(w){const A=w.optimizeNodes();w=this.else=Array.isArray(A)?new h(A):A}if(w)return g===!1?w instanceof v?w:w.nodes:this.nodes.length?this:new v(_e(g),w instanceof v?[w]:w.nodes);if(!(g===!1||!this.nodes.length))return this}optimizeNames(g,w){var A;if(this.else=(A=this.else)===null||A===void 0?void 0:A.optimizeNames(g,w),!!(super.optimizeNames(g,w)||this.else))return this.condition=M(this.condition,g,w),this}get names(){const g=super.names;return F(g,this.condition),this.else&&B(g,this.else.names),g}}v.kind="if";class $ extends m{}$.kind="for";class P extends ${constructor(g){super(),this.iteration=g}render(g){return`for(${this.iteration})`+super.render(g)}optimizeNames(g,w){if(super.optimizeNames(g,w))return this.iteration=M(this.iteration,g,w),this}get names(){return B(super.names,this.iteration.names)}}class k extends ${constructor(g,w,A,Z){super(),this.varKind=g,this.name=w,this.from=A,this.to=Z}render(g){const w=g.es5?a.varKinds.var:this.varKind,{name:A,from:Z,to:Q}=this;return`for(${w} ${A}=${Z}; ${A}<${Q}; ${A}++)`+super.render(g)}get names(){const g=F(super.names,this.from);return F(g,this.to)}}class T extends ${constructor(g,w,A,Z){super(),this.loop=g,this.varKind=w,this.name=A,this.iterable=Z}render(g){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(g)}optimizeNames(g,w){if(super.optimizeNames(g,w))return this.iterable=M(this.iterable,g,w),this}get names(){return B(super.names,this.iterable.names)}}class x extends m{constructor(g,w,A){super(),this.name=g,this.args=w,this.async=A}render(g){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(g)}}x.kind="func";class K extends d{render(g){return"return "+super.render(g)}}K.kind="return";class V extends m{render(g){let w="try"+super.render(g);return this.catch&&(w+=this.catch.render(g)),this.finally&&(w+=this.finally.render(g)),w}optimizeNodes(){var g,w;return super.optimizeNodes(),(g=this.catch)===null||g===void 0||g.optimizeNodes(),(w=this.finally)===null||w===void 0||w.optimizeNodes(),this}optimizeNames(g,w){var A,Z;return super.optimizeNames(g,w),(A=this.catch)===null||A===void 0||A.optimizeNames(g,w),(Z=this.finally)===null||Z===void 0||Z.optimizeNames(g,w),this}get names(){const g=super.names;return this.catch&&B(g,this.catch.names),this.finally&&B(g,this.finally.names),g}}class z extends m{constructor(g){super(),this.error=g}render(g){return`catch(${this.error})`+super.render(g)}}z.kind="catch";class Y extends m{render(g){return"finally"+super.render(g)}}Y.kind="finally";class ee{constructor(g,w={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...w,_n:w.lines?`
|
|
2
|
-
`:""},this._extScope=g,this._scope=new a.Scope({parent:g}),this._nodes=[new p]}toString(){return this._root.render(this.opts)}name(g){return this._scope.name(g)}scopeName(g){return this._extScope.name(g)}scopeValue(g,w){const A=this._extScope.value(g,w);return(this._values[A.prefix]||(this._values[A.prefix]=new Set)).add(A),A}getScopeValue(g,w){return this._extScope.getValue(g,w)}scopeRefs(g){return this._extScope.scopeRefs(g,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(g,w,A,Z){const Q=this._scope.toName(w);return A!==void 0&&Z&&(this._constants[Q.str]=A),this._leafNode(new i(g,Q,A)),Q}const(g,w,A){return this._def(a.varKinds.const,g,w,A)}let(g,w,A){return this._def(a.varKinds.let,g,w,A)}var(g,w,A){return this._def(a.varKinds.var,g,w,A)}assign(g,w,A){return this._leafNode(new o(g,w,A))}add(g,w){return this._leafNode(new c(g,t.operators.ADD,w))}code(g){return typeof g=="function"?g():g!==e.nil&&this._leafNode(new y(g)),this}object(...g){const w=["{"];for(const[A,Z]of g)w.length>1&&w.push(","),w.push(A),(A!==Z||this.opts.es5)&&(w.push(":"),(0,e.addCodeArg)(w,Z));return w.push("}"),new e._Code(w)}if(g,w,A){if(this._blockNode(new v(g)),w&&A)this.code(w).else().code(A).endIf();else if(w)this.code(w).endIf();else if(A)throw new Error('CodeGen: "else" body without "then" body');return this}elseIf(g){return this._elseNode(new v(g))}else(){return this._elseNode(new h)}endIf(){return this._endBlockNode(v,h)}_for(g,w){return this._blockNode(g),w&&this.code(w).endFor(),this}for(g,w){return this._for(new P(g),w)}forRange(g,w,A,Z,Q=this.opts.es5?a.varKinds.var:a.varKinds.let){const fe=this._scope.toName(g);return this._for(new k(Q,fe,w,A),()=>Z(fe))}forOf(g,w,A,Z=a.varKinds.const){const Q=this._scope.toName(g);if(this.opts.es5){const fe=w instanceof e.Name?w:this.var("_arr",w);return this.forRange("_i",0,(0,e._)`${fe}.length`,ie=>{this.var(Q,(0,e._)`${fe}[${ie}]`),A(Q)})}return this._for(new T("of",Z,Q,w),()=>A(Q))}forIn(g,w,A,Z=this.opts.es5?a.varKinds.var:a.varKinds.const){if(this.opts.ownProperties)return this.forOf(g,(0,e._)`Object.keys(${w})`,A);const Q=this._scope.toName(g);return this._for(new T("in",Z,Q,w),()=>A(Q))}endFor(){return this._endBlockNode($)}label(g){return this._leafNode(new l(g))}break(g){return this._leafNode(new u(g))}return(g){const w=new K;if(this._blockNode(w),this.code(g),w.nodes.length!==1)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(K)}try(g,w,A){if(!w&&!A)throw new Error('CodeGen: "try" without "catch" and "finally"');const Z=new V;if(this._blockNode(Z),this.code(g),w){const Q=this.name("e");this._currNode=Z.catch=new z(Q),w(Q)}return A&&(this._currNode=Z.finally=new Y,this.code(A)),this._endBlockNode(z,Y)}throw(g){return this._leafNode(new f(g))}block(g,w){return this._blockStarts.push(this._nodes.length),g&&this.code(g).endBlock(w),this}endBlock(g){const w=this._blockStarts.pop();if(w===void 0)throw new Error("CodeGen: not in self-balancing block");const A=this._nodes.length-w;if(A<0||g!==void 0&&A!==g)throw new Error(`CodeGen: wrong number of nodes: ${A} vs ${g} expected`);return this._nodes.length=w,this}func(g,w=e.nil,A,Z){return this._blockNode(new x(g,w,A)),Z&&this.code(Z).endFunc(),this}endFunc(){return this._endBlockNode(x)}optimize(g=1){for(;g-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(g){return this._currNode.nodes.push(g),this}_blockNode(g){this._currNode.nodes.push(g),this._nodes.push(g)}_endBlockNode(g,w){const A=this._currNode;if(A instanceof g||w&&A instanceof w)return this._nodes.pop(),this;throw new Error(`CodeGen: not in block "${w?`${g.kind}/${w.kind}`:g.kind}"`)}_elseNode(g){const w=this._currNode;if(!(w instanceof v))throw new Error('CodeGen: "else" without "if"');return this._currNode=w.else=g,this}get _root(){return this._nodes[0]}get _currNode(){const g=this._nodes;return g[g.length-1]}set _currNode(g){const w=this._nodes;w[w.length-1]=g}}t.CodeGen=ee;function B(O,g){for(const w in g)O[w]=(O[w]||0)+(g[w]||0);return O}function F(O,g){return g instanceof e._CodeOrName?B(O,g.names):O}function M(O,g,w){if(O instanceof e.Name)return A(O);if(!Z(O))return O;return new e._Code(O._items.reduce((Q,fe)=>(fe instanceof e.Name&&(fe=A(fe)),fe instanceof e._Code?Q.push(...fe._items):Q.push(fe),Q),[]));function A(Q){const fe=w[Q.str];return fe===void 0||g[Q.str]!==1?Q:(delete g[Q.str],fe)}function Z(Q){return Q instanceof e._Code&&Q._items.some(fe=>fe instanceof e.Name&&g[fe.str]===1&&w[fe.str]!==void 0)}}function re(O,g){for(const w in g)O[w]=(O[w]||0)-(g[w]||0)}function _e(O){return typeof O=="boolean"||typeof O=="number"||O===null?!O:(0,e._)`!${D(O)}`}t.not=_e;const ve=S(t.operators.AND);function be(...O){return O.reduce(ve)}t.and=be;const de=S(t.operators.OR);function j(...O){return O.reduce(de)}t.or=j;function S(O){return(g,w)=>g===e.nil?w:w===e.nil?g:(0,e._)`${D(g)} ${O} ${D(w)}`}function D(O){return O instanceof e.Name?O:(0,e._)`(${O})`}}(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 Oe=ge,Yd=na;function Xd(t){const e={};for(const a of t)e[a]=!0;return e}G.toHash=Xd;function ef(t,e){return typeof e=="boolean"?e:Object.keys(e).length===0?!0:(al(t,e),!sl(e,t.self.RULES.all))}G.alwaysValidSchema=ef;function al(t,e=t.schema){const{opts:a,self:s}=t;if(!a.strictSchema||typeof e=="boolean")return;const r=s.RULES.keywords;for(const n in e)r[n]||cl(t,`unknown keyword: "${n}"`)}G.checkUnknownRules=al;function sl(t,e){if(typeof t=="boolean")return!t;for(const a in t)if(e[a])return!0;return!1}G.schemaHasRules=sl;function tf(t,e){if(typeof t=="boolean")return!t;for(const a in t)if(a!=="$ref"&&e.all[a])return!0;return!1}G.schemaHasRulesButRef=tf;function rf({topSchemaRef:t,schemaPath:e},a,s,r){if(!r){if(typeof a=="number"||typeof a=="boolean")return a;if(typeof a=="string")return(0,Oe._)`${a}`}return(0,Oe._)`${t}${e}${(0,Oe.getProperty)(s)}`}G.schemaRefOrVal=rf;function af(t){return nl(decodeURIComponent(t))}G.unescapeFragment=af;function sf(t){return encodeURIComponent(pn(t))}G.escapeFragment=sf;function pn(t){return typeof t=="number"?`${t}`:t.replace(/~/g,"~0").replace(/\//g,"~1")}G.escapeJsonPointer=pn;function nl(t){return t.replace(/~1/g,"/").replace(/~0/g,"~")}G.unescapeJsonPointer=nl;function nf(t,e){if(Array.isArray(t))for(const a of t)e(a);else e(t)}G.eachItem=nf;function il({mergeNames:t,mergeToName:e,mergeValues:a,resultToName:s}){return(r,n,i,o)=>{const c=i===void 0?n:i instanceof Oe.Name?(n instanceof Oe.Name?t(r,n,i):e(r,n,i),i):n instanceof Oe.Name?(e(r,i,n),n):a(n,i);return o===Oe.Name&&!(c instanceof Oe.Name)?s(r,c):c}}G.mergeEvaluated={props:il({mergeNames:(t,e,a)=>t.if((0,Oe._)`${a} !== true && ${e} !== undefined`,()=>{t.if((0,Oe._)`${e} === true`,()=>t.assign(a,!0),()=>t.assign(a,(0,Oe._)`${a} || {}`).code((0,Oe._)`Object.assign(${a}, ${e})`))}),mergeToName:(t,e,a)=>t.if((0,Oe._)`${a} !== true`,()=>{e===!0?t.assign(a,!0):(t.assign(a,(0,Oe._)`${a} || {}`),mn(t,a,e))}),mergeValues:(t,e)=>t===!0?!0:{...t,...e},resultToName:ol}),items:il({mergeNames:(t,e,a)=>t.if((0,Oe._)`${a} !== true && ${e} !== undefined`,()=>t.assign(a,(0,Oe._)`${e} === true ? true : ${a} > ${e} ? ${a} : ${e}`)),mergeToName:(t,e,a)=>t.if((0,Oe._)`${a} !== true`,()=>t.assign(a,e===!0?!0:(0,Oe._)`${a} > ${e} ? ${a} : ${e}`)),mergeValues:(t,e)=>t===!0?!0:Math.max(t,e),resultToName:(t,e)=>t.var("items",e)})};function ol(t,e){if(e===!0)return t.var("props",!0);const a=t.var("props",(0,Oe._)`{}`);return e!==void 0&&mn(t,a,e),a}G.evaluatedPropsToName=ol;function mn(t,e,a){Object.keys(a).forEach(s=>t.assign((0,Oe._)`${e}${(0,Oe.getProperty)(s)}`,!0))}G.setEvaluated=mn;const ll={};function of(t,e){return t.scopeValue("func",{ref:e,code:ll[e.code]||(ll[e.code]=new Yd._Code(e.code))})}G.useFunc=of;var vn;(function(t){t[t.Num=0]="Num",t[t.Str=1]="Str"})(vn||(G.Type=vn={}));function lf(t,e,a){if(t instanceof Oe.Name){const s=e===vn.Num;return a?s?(0,Oe._)`"[" + ${t} + "]"`:(0,Oe._)`"['" + ${t} + "']"`:s?(0,Oe._)`"/" + ${t}`:(0,Oe._)`"/" + ${t}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return a?(0,Oe.getProperty)(t).toString():"/"+pn(t)}G.getErrorPath=lf;function cl(t,e,a=t.opts.strictSchema){if(a){if(e=`strict mode: ${e}`,a===!0)throw new Error(e);t.self.logger.warn(e)}}G.checkStrictMode=cl;var Nt={};Object.defineProperty(Nt,"__esModule",{value:!0});const at=ge,cf={data:new at.Name("data"),valCxt:new at.Name("valCxt"),instancePath:new at.Name("instancePath"),parentData:new at.Name("parentData"),parentDataProperty:new at.Name("parentDataProperty"),rootData:new at.Name("rootData"),dynamicAnchors:new at.Name("dynamicAnchors"),vErrors:new at.Name("vErrors"),errors:new at.Name("errors"),this:new at.Name("this"),self:new at.Name("self"),scope:new at.Name("scope"),json:new at.Name("json"),jsonPos:new at.Name("jsonPos"),jsonLen:new at.Name("jsonLen"),jsonPart:new at.Name("jsonPart")};Nt.default=cf,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,a=G,s=Nt;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 r(h,v=t.keywordError,$,P){const{it:k}=h,{gen:T,compositeRule:x,allErrors:K}=k,V=f(h,v,$);P??(x||K)?c(T,V):l(k,(0,e._)`[${V}]`)}t.reportError=r;function n(h,v=t.keywordError,$){const{it:P}=h,{gen:k,compositeRule:T,allErrors:x}=P,K=f(h,v,$);c(k,K),T||x||l(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:$,data:P,errsCount:k,it:T}){if(k===void 0)throw new Error("ajv implementation error");const x=h.name("err");h.forRange("i",k,s.default.errors,K=>{h.const(x,(0,e._)`${s.default.vErrors}[${K}]`),h.if((0,e._)`${x}.instancePath === undefined`,()=>h.assign((0,e._)`${x}.instancePath`,(0,e.strConcat)(s.default.instancePath,T.errorPath))),h.assign((0,e._)`${x}.schemaPath`,(0,e.str)`${T.errSchemaPath}/${v}`),T.opts.verbose&&(h.assign((0,e._)`${x}.schema`,$),h.assign((0,e._)`${x}.data`,P))})}t.extendErrors=o;function c(h,v){const $=h.const("err",v);h.if((0,e._)`${s.default.vErrors} === null`,()=>h.assign(s.default.vErrors,(0,e._)`[${$}]`),(0,e._)`${s.default.vErrors}.push(${$})`),h.code((0,e._)`${s.default.errors}++`)}function l(h,v){const{gen:$,validateName:P,schemaEnv:k}=h;k.$async?$.throw((0,e._)`new ${h.ValidationError}(${v})`):($.assign((0,e._)`${P}.errors`,v),$.return(!1))}const u={keyword:new e.Name("keyword"),schemaPath:new e.Name("schemaPath"),params:new e.Name("params"),propertyName:new e.Name("propertyName"),message:new e.Name("message"),schema:new e.Name("schema"),parentSchema:new e.Name("parentSchema")};function f(h,v,$){const{createErrors:P}=h.it;return P===!1?(0,e._)`{}`:y(h,v,$)}function y(h,v,$={}){const{gen:P,it:k}=h,T=[d(k,$),m(h,$)];return p(h,v,T),P.object(...T)}function d({errorPath:h},{instancePath:v}){const $=v?(0,e.str)`${h}${(0,a.getErrorPath)(v,a.Type.Str)}`:h;return[s.default.instancePath,(0,e.strConcat)(s.default.instancePath,$)]}function m({keyword:h,it:{errSchemaPath:v}},{schemaPath:$,parentSchema:P}){let k=P?v:(0,e.str)`${v}/${h}`;return $&&(k=(0,e.str)`${k}${(0,a.getErrorPath)($,a.Type.Str)}`),[u.schemaPath,k]}function p(h,{params:v,message:$},P){const{keyword:k,data:T,schemaValue:x,it:K}=h,{opts:V,propertyName:z,topSchemaRef:Y,schemaPath:ee}=K;P.push([u.keyword,k],[u.params,typeof v=="function"?v(h):v||(0,e._)`{}`]),V.messages&&P.push([u.message,typeof $=="function"?$(h):$]),V.verbose&&P.push([u.schema,x],[u.parentSchema,(0,e._)`${Y}${ee}`],[s.default.data,T]),z&&P.push([u.propertyName,z])}}(sa),Object.defineProperty(Ar,"__esModule",{value:!0}),Ar.boolOrEmptySchema=Ar.topBoolOrEmptySchema=void 0;const uf=sa,df=ge,ff=Nt,hf={message:"boolean schema is false"};function pf(t){const{gen:e,schema:a,validateName:s}=t;a===!1?ul(t,!1):typeof a=="object"&&a.$async===!0?e.return(ff.default.data):(e.assign((0,df._)`${s}.errors`,null),e.return(!0))}Ar.topBoolOrEmptySchema=pf;function mf(t,e){const{gen:a,schema:s}=t;s===!1?(a.var(e,!1),ul(t)):a.var(e,!0)}Ar.boolOrEmptySchema=mf;function ul(t,e){const{gen:a,data:s}=t,r={gen:a,keyword:"false schema",data:s,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:t};(0,uf.reportError)(r,hf,void 0,e)}var Je={},mr={};Object.defineProperty(mr,"__esModule",{value:!0}),mr.getRules=mr.isJSONType=void 0;const vf=["string","number","integer","boolean","null","object","array"],gf=new Set(vf);function yf(t){return typeof t=="string"&&gf.has(t)}mr.isJSONType=yf;function _f(){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:{}}}mr.getRules=_f;var zt={};Object.defineProperty(zt,"__esModule",{value:!0}),zt.shouldUseRule=zt.shouldUseGroup=zt.schemaHasRulesForType=void 0;function $f({schema:t,self:e},a){const s=e.RULES.types[a];return s&&s!==!0&&dl(t,s)}zt.schemaHasRulesForType=$f;function dl(t,e){return e.rules.some(a=>fl(t,a))}zt.shouldUseGroup=dl;function fl(t,e){var a;return t[e.keyword]!==void 0||((a=e.definition.implements)===null||a===void 0?void 0:a.some(s=>t[s]!==void 0))}zt.shouldUseRule=fl,Object.defineProperty(Je,"__esModule",{value:!0}),Je.reportTypeError=Je.checkDataTypes=Je.checkDataType=Je.coerceAndCheckDataType=Je.getJSONTypes=Je.getSchemaTypes=Je.DataType=void 0;const wf=mr,bf=zt,Ef=sa,pe=ge,hl=G;var jr;(function(t){t[t.Correct=0]="Correct",t[t.Wrong=1]="Wrong"})(jr||(Je.DataType=jr={}));function Pf(t){const e=pl(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}Je.getSchemaTypes=Pf;function pl(t){const e=Array.isArray(t)?t:t?[t]:[];if(e.every(wf.isJSONType))return e;throw new Error("type must be JSONType or JSONType[]: "+e.join(","))}Je.getJSONTypes=pl;function Sf(t,e){const{gen:a,data:s,opts:r}=t,n=Rf(e,r.coerceTypes),i=e.length>0&&!(n.length===0&&e.length===1&&(0,bf.schemaHasRulesForType)(t,e[0]));if(i){const o=yn(e,s,r.strictNumbers,jr.Wrong);a.if(o,()=>{n.length?kf(t,e,n):_n(t)})}return i}Je.coerceAndCheckDataType=Sf;const ml=new Set(["string","number","integer","boolean","null"]);function Rf(t,e){return e?t.filter(a=>ml.has(a)||e==="array"&&a==="array"):[]}function kf(t,e,a){const{gen:s,data:r,opts:n}=t,i=s.let("dataType",(0,pe._)`typeof ${r}`),o=s.let("coerced",(0,pe._)`undefined`);n.coerceTypes==="array"&&s.if((0,pe._)`${i} == 'object' && Array.isArray(${r}) && ${r}.length == 1`,()=>s.assign(r,(0,pe._)`${r}[0]`).assign(i,(0,pe._)`typeof ${r}`).if(yn(e,r,n.strictNumbers),()=>s.assign(o,r))),s.if((0,pe._)`${o} !== undefined`);for(const l of a)(ml.has(l)||l==="array"&&n.coerceTypes==="array")&&c(l);s.else(),_n(t),s.endIf(),s.if((0,pe._)`${o} !== undefined`,()=>{s.assign(r,o),Of(t,o)});function c(l){switch(l){case"string":s.elseIf((0,pe._)`${i} == "number" || ${i} == "boolean"`).assign(o,(0,pe._)`"" + ${r}`).elseIf((0,pe._)`${r} === null`).assign(o,(0,pe._)`""`);return;case"number":s.elseIf((0,pe._)`${i} == "boolean" || ${r} === null
|
|
3
|
-
|| (${i} == "string" && ${r} && ${r} == +${r})`).assign(o,(0,pe._)`+${r}`);return;case"integer":s.elseIf((0,pe._)`${i} === "boolean" || ${r} === null
|
|
4
|
-
|| (${i} === "string" && ${r} && ${r} == +${r} && !(${r} % 1))`).assign(o,(0,pe._)`+${r}`);return;case"boolean":s.elseIf((0,pe._)`${r} === "false" || ${r} === 0 || ${r} === null`).assign(o,!1).elseIf((0,pe._)`${r} === "true" || ${r} === 1`).assign(o,!0);return;case"null":s.elseIf((0,pe._)`${r} === "" || ${r} === 0 || ${r} === false`),s.assign(o,null);return;case"array":s.elseIf((0,pe._)`${i} === "string" || ${i} === "number"
|
|
5
|
-
|| ${i} === "boolean" || ${r} === null`).assign(o,(0,pe._)`[${r}]`)}}}function Of({gen:t,parentData:e,parentDataProperty:a},s){t.if((0,pe._)`${e} !== undefined`,()=>t.assign((0,pe._)`${e}[${a}]`,s))}function gn(t,e,a,s=jr.Correct){const r=s===jr.Correct?pe.operators.EQ:pe.operators.NEQ;let n;switch(t){case"null":return(0,pe._)`${e} ${r} 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} ${r} ${t}`}return s===jr.Correct?n:(0,pe.not)(n);function i(o=pe.nil){return(0,pe.and)((0,pe._)`typeof ${e} == "number"`,o,a?(0,pe._)`isFinite(${e})`:pe.nil)}}Je.checkDataType=gn;function yn(t,e,a,s){if(t.length===1)return gn(t[0],e,a,s);let r;const n=(0,hl.toHash)(t);if(n.array&&n.object){const i=(0,pe._)`typeof ${e} != "object"`;r=n.null?i:(0,pe._)`!${e} || ${i}`,delete n.null,delete n.array,delete n.object}else r=pe.nil;n.number&&delete n.integer;for(const i in n)r=(0,pe.and)(r,gn(i,e,a,s));return r}Je.checkDataTypes=yn;const Tf={message:({schema:t})=>`must be ${t}`,params:({schema:t,schemaValue:e})=>typeof t=="string"?(0,pe._)`{type: ${t}}`:(0,pe._)`{type: ${e}}`};function _n(t){const e=Cf(t);(0,Ef.reportError)(e,Tf)}Je.reportTypeError=_n;function Cf(t){const{gen:e,data:a,schema:s}=t,r=(0,hl.schemaRefOrVal)(t,s,"type");return{gen:e,keyword:"type",data:a,schema:s.type,schemaCode:r,schemaValue:r,parentSchema:s,params:{},it:t}}var qa={};Object.defineProperty(qa,"__esModule",{value:!0}),qa.assignDefaults=void 0;const Dr=ge,If=G;function Nf(t,e){const{properties:a,items:s}=t.schema;if(e==="object"&&a)for(const r in a)vl(t,r,a[r].default);else e==="array"&&Array.isArray(s)&&s.forEach((r,n)=>vl(t,n,r.default))}qa.assignDefaults=Nf;function vl(t,e,a){const{gen:s,compositeRule:r,data:n,opts:i}=t;if(a===void 0)return;const o=(0,Dr._)`${n}${(0,Dr.getProperty)(e)}`;if(r){(0,If.checkStrictMode)(t,`default is ignored for: ${o}`);return}let c=(0,Dr._)`${o} === undefined`;i.useDefaults==="empty"&&(c=(0,Dr._)`${c} || ${o} === null || ${o} === ""`),s.if(c,(0,Dr._)`${o} = ${(0,Dr.stringify)(a)}`)}var At={},ye={};Object.defineProperty(ye,"__esModule",{value:!0}),ye.validateUnion=ye.validateArray=ye.usePattern=ye.callValidateCode=ye.schemaProperties=ye.allSchemaProperties=ye.noPropertyInData=ye.propertyInData=ye.isOwnProperty=ye.hasPropFunc=ye.reportMissingProp=ye.checkMissingProp=ye.checkReportMissingProp=void 0;const Ne=ge,$n=G,rr=Nt,Af=G;function jf(t,e){const{gen:a,data:s,it:r}=t;a.if(bn(a,s,e,r.opts.ownProperties),()=>{t.setParams({missingProperty:(0,Ne._)`${e}`},!0),t.error()})}ye.checkReportMissingProp=jf;function Df({gen:t,data:e,it:{opts:a}},s,r){return(0,Ne.or)(...s.map(n=>(0,Ne.and)(bn(t,e,n,a.ownProperties),(0,Ne._)`${r} = ${n}`)))}ye.checkMissingProp=Df;function xf(t,e){t.setParams({missingProperty:e},!0),t.error()}ye.reportMissingProp=xf;function gl(t){return t.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:(0,Ne._)`Object.prototype.hasOwnProperty`})}ye.hasPropFunc=gl;function wn(t,e,a){return(0,Ne._)`${gl(t)}.call(${e}, ${a})`}ye.isOwnProperty=wn;function Mf(t,e,a,s){const r=(0,Ne._)`${e}${(0,Ne.getProperty)(a)} !== undefined`;return s?(0,Ne._)`${r} && ${wn(t,e,a)}`:r}ye.propertyInData=Mf;function bn(t,e,a,s){const r=(0,Ne._)`${e}${(0,Ne.getProperty)(a)} === undefined`;return s?(0,Ne.or)(r,(0,Ne.not)(wn(t,e,a))):r}ye.noPropertyInData=bn;function yl(t){return t?Object.keys(t).filter(e=>e!=="__proto__"):[]}ye.allSchemaProperties=yl;function Lf(t,e){return yl(e).filter(a=>!(0,$n.alwaysValidSchema)(t,e[a]))}ye.schemaProperties=Lf;function Ff({schemaCode:t,data:e,it:{gen:a,topSchemaRef:s,schemaPath:r,errorPath:n},it:i},o,c,l){const u=l?(0,Ne._)`${t}, ${e}, ${s}${r}`:e,f=[[rr.default.instancePath,(0,Ne.strConcat)(rr.default.instancePath,n)],[rr.default.parentData,i.parentData],[rr.default.parentDataProperty,i.parentDataProperty],[rr.default.rootData,rr.default.rootData]];i.opts.dynamicRef&&f.push([rr.default.dynamicAnchors,rr.default.dynamicAnchors]);const y=(0,Ne._)`${u}, ${a.object(...f)}`;return c!==Ne.nil?(0,Ne._)`${o}.call(${c}, ${y})`:(0,Ne._)`${o}(${y})`}ye.callValidateCode=Ff;const qf=(0,Ne._)`new RegExp`;function Uf({gen:t,it:{opts:e}},a){const s=e.unicodeRegExp?"u":"",{regExp:r}=e.code,n=r(a,s);return t.scopeValue("pattern",{key:n.toString(),ref:n,code:(0,Ne._)`${r.code==="new RegExp"?qf:(0,Af.useFunc)(t,r)}(${a}, ${s})`})}ye.usePattern=Uf;function Vf(t){const{gen:e,data:a,keyword:s,it:r}=t,n=e.name("valid");if(r.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 c=e.const("len",(0,Ne._)`${a}.length`);e.forRange("i",0,c,l=>{t.subschema({keyword:s,dataProp:l,dataPropType:$n.Type.Num},n),e.if((0,Ne.not)(n),o)})}}ye.validateArray=Vf;function zf(t){const{gen:e,schema:a,keyword:s,it:r}=t;if(!Array.isArray(a))throw new Error("ajv implementation error");if(a.some(c=>(0,$n.alwaysValidSchema)(r,c))&&!r.opts.unevaluated)return;const i=e.let("valid",!1),o=e.name("_valid");e.block(()=>a.forEach((c,l)=>{const u=t.subschema({keyword:s,schemaProp:l,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))}ye.validateUnion=zf,Object.defineProperty(At,"__esModule",{value:!0}),At.validateKeywordUsage=At.validSchemaType=At.funcKeywordCode=At.macroKeywordCode=void 0;const nt=ge,vr=Nt,Hf=ye,Zf=sa;function Kf(t,e){const{gen:a,keyword:s,schema:r,parentSchema:n,it:i}=t,o=e.macro.call(i.self,r,n,i),c=$l(a,s,o);i.opts.validateSchema!==!1&&i.self.validateSchema(o,!0);const l=a.name("valid");t.subschema({schema:o,schemaPath:nt.nil,errSchemaPath:`${i.errSchemaPath}/${s}`,topSchemaRef:c,compositeRule:!0},l),t.pass(l,()=>t.error(!0))}At.macroKeywordCode=Kf;function Bf(t,e){var a;const{gen:s,keyword:r,schema:n,parentSchema:i,$data:o,it:c}=t;Qf(c,e);const l=!o&&e.compile?e.compile.call(c.self,n,i,c):e.validate,u=$l(s,r,l),f=s.let("valid");t.block$data(f,y),t.ok((a=e.valid)!==null&&a!==void 0?a:f);function y(){if(e.errors===!1)p(),e.modifying&&_l(t),h(()=>t.error());else{const v=e.async?d():m();e.modifying&&_l(t),h(()=>Jf(t,v))}}function d(){const v=s.let("ruleErrs",null);return s.try(()=>p((0,nt._)`await `),$=>s.assign(f,!1).if((0,nt._)`${$} instanceof ${c.ValidationError}`,()=>s.assign(v,(0,nt._)`${$}.errors`),()=>s.throw($))),v}function m(){const v=(0,nt._)`${u}.errors`;return s.assign(v,null),p(nt.nil),v}function p(v=e.async?(0,nt._)`await `:nt.nil){const $=c.opts.passContext?vr.default.this:vr.default.self,P=!("compile"in e&&!o||e.schema===!1);s.assign(f,(0,nt._)`${v}${(0,Hf.callValidateCode)(t,u,$,P)}`,e.modifying)}function h(v){var $;s.if((0,nt.not)(($=e.valid)!==null&&$!==void 0?$:f),v)}}At.funcKeywordCode=Bf;function _l(t){const{gen:e,data:a,it:s}=t;e.if(s.parentData,()=>e.assign(a,(0,nt._)`${s.parentData}[${s.parentDataProperty}]`))}function Jf(t,e){const{gen:a}=t;a.if((0,nt._)`Array.isArray(${e})`,()=>{a.assign(vr.default.vErrors,(0,nt._)`${vr.default.vErrors} === null ? ${e} : ${vr.default.vErrors}.concat(${e})`).assign(vr.default.errors,(0,nt._)`${vr.default.vErrors}.length`),(0,Zf.extendErrors)(t)},()=>t.error())}function Qf({schemaEnv:t},e){if(e.async&&!t.$async)throw new Error("async keyword in sync schema")}function $l(t,e,a){if(a===void 0)throw new Error(`keyword "${e}" failed to compile`);return t.scopeValue("keyword",typeof a=="function"?{ref:a}:{ref:a,code:(0,nt.stringify)(a)})}function Gf(t,e,a=!1){return!e.length||e.some(s=>s==="array"?Array.isArray(t):s==="object"?t&&typeof t=="object"&&!Array.isArray(t):typeof t==s||a&&typeof t>"u")}At.validSchemaType=Gf;function Wf({schema:t,opts:e,self:a,errSchemaPath:s},r,n){if(Array.isArray(r.keyword)?!r.keyword.includes(n):r.keyword!==n)throw new Error("ajv implementation error");const i=r.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(r.validateSchema&&!r.validateSchema(t[n])){const c=`keyword "${n}" value is invalid at path "${s}": `+a.errorsText(r.validateSchema.errors);if(e.validateSchema==="log")a.logger.error(c);else throw new Error(c)}}At.validateKeywordUsage=Wf;var ar={};Object.defineProperty(ar,"__esModule",{value:!0}),ar.extendSubschemaMode=ar.extendSubschemaData=ar.getSubschema=void 0;const jt=ge,wl=G;function Yf(t,{keyword:e,schemaProp:a,schema:s,schemaPath:r,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 a===void 0?{schema:o,schemaPath:(0,jt._)`${t.schemaPath}${(0,jt.getProperty)(e)}`,errSchemaPath:`${t.errSchemaPath}/${e}`}:{schema:o[a],schemaPath:(0,jt._)`${t.schemaPath}${(0,jt.getProperty)(e)}${(0,jt.getProperty)(a)}`,errSchemaPath:`${t.errSchemaPath}/${e}/${(0,wl.escapeFragment)(a)}`}}if(s!==void 0){if(r===void 0||n===void 0||i===void 0)throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:s,schemaPath:r,topSchemaRef:i,errSchemaPath:n}}throw new Error('either "keyword" or "schema" must be passed')}ar.getSubschema=Yf;function Xf(t,e,{dataProp:a,dataPropType:s,data:r,dataTypes:n,propertyName:i}){if(r!==void 0&&a!==void 0)throw new Error('both "data" and "dataProp" passed, only one allowed');const{gen:o}=e;if(a!==void 0){const{errorPath:l,dataPathArr:u,opts:f}=e,y=o.let("data",(0,jt._)`${e.data}${(0,jt.getProperty)(a)}`,!0);c(y),t.errorPath=(0,jt.str)`${l}${(0,wl.getErrorPath)(a,s,f.jsPropertySyntax)}`,t.parentDataProperty=(0,jt._)`${a}`,t.dataPathArr=[...u,t.parentDataProperty]}if(r!==void 0){const l=r instanceof jt.Name?r:o.let("data",r,!0);c(l),i!==void 0&&(t.propertyName=i)}n&&(t.dataTypes=n);function c(l){t.data=l,t.dataLevel=e.dataLevel+1,t.dataTypes=[],e.definedProperties=new Set,t.parentData=e.data,t.dataNames=[...e.dataNames,l]}}ar.extendSubschemaData=Xf;function eh(t,{jtdDiscriminator:e,jtdMetadata:a,compositeRule:s,createErrors:r,allErrors:n}){s!==void 0&&(t.compositeRule=s),r!==void 0&&(t.createErrors=r),n!==void 0&&(t.allErrors=n),t.jtdDiscriminator=e,t.jtdMetadata=a}ar.extendSubschemaMode=eh;var Xe={},ia=function t(e,a){if(e===a)return!0;if(e&&a&&typeof e=="object"&&typeof a=="object"){if(e.constructor!==a.constructor)return!1;var s,r,n;if(Array.isArray(e)){if(s=e.length,s!=a.length)return!1;for(r=s;r--!==0;)if(!t(e[r],a[r]))return!1;return!0}if(e.constructor===RegExp)return e.source===a.source&&e.flags===a.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===a.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===a.toString();if(n=Object.keys(e),s=n.length,s!==Object.keys(a).length)return!1;for(r=s;r--!==0;)if(!Object.prototype.hasOwnProperty.call(a,n[r]))return!1;for(r=s;r--!==0;){var i=n[r];if(!t(e[i],a[i]))return!1}return!0}return e!==e&&a!==a},bl={exports:{}},sr=bl.exports=function(t,e,a){typeof e=="function"&&(a=e,e={}),a=e.cb||a;var s=typeof a=="function"?a:a.pre||function(){},r=a.post||function(){};Ua(e,s,r,t,"",t)};sr.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0},sr.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0},sr.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0},sr.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 Ua(t,e,a,s,r,n,i,o,c,l){if(s&&typeof s=="object"&&!Array.isArray(s)){e(s,r,n,i,o,c,l);for(var u in s){var f=s[u];if(Array.isArray(f)){if(u in sr.arrayKeywords)for(var y=0;y<f.length;y++)Ua(t,e,a,f[y],r+"/"+u+"/"+y,n,r,u,s,y)}else if(u in sr.propsKeywords){if(f&&typeof f=="object")for(var d in f)Ua(t,e,a,f[d],r+"/"+u+"/"+th(d),n,r,u,s,d)}else(u in sr.keywords||t.allKeys&&!(u in sr.skipKeywords))&&Ua(t,e,a,f,r+"/"+u,n,r,u,s)}a(s,r,n,i,o,c,l)}}function th(t){return t.replace(/~/g,"~0").replace(/\//g,"~1")}var rh=bl.exports;Object.defineProperty(Xe,"__esModule",{value:!0}),Xe.getSchemaRefs=Xe.resolveUrl=Xe.normalizeId=Xe._getFullPath=Xe.getFullPath=Xe.inlineRef=void 0;const ah=G,sh=ia,nh=rh,ih=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function oh(t,e=!0){return typeof t=="boolean"?!0:e===!0?!En(t):e?El(t)<=e:!1}Xe.inlineRef=oh;const lh=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function En(t){for(const e in t){if(lh.has(e))return!0;const a=t[e];if(Array.isArray(a)&&a.some(En)||typeof a=="object"&&En(a))return!0}return!1}function El(t){let e=0;for(const a in t){if(a==="$ref")return 1/0;if(e++,!ih.has(a)&&(typeof t[a]=="object"&&(0,ah.eachItem)(t[a],s=>e+=El(s)),e===1/0))return 1/0}return e}function Pl(t,e="",a){a!==!1&&(e=xr(e));const s=t.parse(e);return Sl(t,s)}Xe.getFullPath=Pl;function Sl(t,e){return t.serialize(e).split("#")[0]+"#"}Xe._getFullPath=Sl;const ch=/#\/?$/;function xr(t){return t?t.replace(ch,""):""}Xe.normalizeId=xr;function uh(t,e,a){return a=xr(a),t.resolve(e,a)}Xe.resolveUrl=uh;const dh=/^[a-z_][-a-z0-9._]*$/i;function fh(t,e){if(typeof t=="boolean")return{};const{schemaId:a,uriResolver:s}=this.opts,r=xr(t[a]||e),n={"":r},i=Pl(s,r,!1),o={},c=new Set;return nh(t,{allKeys:!0},(f,y,d,m)=>{if(m===void 0)return;const p=i+y;let h=n[m];typeof f[a]=="string"&&(h=v.call(this,f[a])),$.call(this,f.$anchor),$.call(this,f.$dynamicAnchor),n[y]=h;function v(P){const k=this.opts.uriResolver.resolve;if(P=xr(h?k(h,P):P),c.has(P))throw u(P);c.add(P);let T=this.refs[P];return typeof T=="string"&&(T=this.refs[T]),typeof T=="object"?l(f,T.schema,P):P!==xr(p)&&(P[0]==="#"?(l(f,o[P],P),o[P]=f):this.refs[P]=p),P}function $(P){if(typeof P=="string"){if(!dh.test(P))throw new Error(`invalid anchor "${P}"`);v.call(this,`#${P}`)}}}),o;function l(f,y,d){if(y!==void 0&&!sh(f,y))throw u(d)}function u(f){return new Error(`reference "${f}" resolves to more than one schema`)}}Xe.getSchemaRefs=fh,Object.defineProperty(bt,"__esModule",{value:!0}),bt.getData=bt.KeywordCxt=bt.validateFunctionCode=void 0;const Rl=Ar,kl=Je,Pn=zt,Va=Je,hh=qa,oa=At,Sn=ar,ae=ge,le=Nt,ph=Xe,Ht=G,la=sa;function mh(t){if(Il(t)&&(Nl(t),Cl(t))){yh(t);return}Ol(t,()=>(0,Rl.topBoolOrEmptySchema)(t))}bt.validateFunctionCode=mh;function Ol({gen:t,validateName:e,schema:a,schemaEnv:s,opts:r},n){r.code.es5?t.func(e,(0,ae._)`${le.default.data}, ${le.default.valCxt}`,s.$async,()=>{t.code((0,ae._)`"use strict"; ${Tl(a,r)}`),gh(t,r),t.code(n)}):t.func(e,(0,ae._)`${le.default.data}, ${vh(r)}`,s.$async,()=>t.code(Tl(a,r)).code(n))}function vh(t){return(0,ae._)`{${le.default.instancePath}="", ${le.default.parentData}, ${le.default.parentDataProperty}, ${le.default.rootData}=${le.default.data}${t.dynamicRef?(0,ae._)`, ${le.default.dynamicAnchors}={}`:ae.nil}}={}`}function gh(t,e){t.if(le.default.valCxt,()=>{t.var(le.default.instancePath,(0,ae._)`${le.default.valCxt}.${le.default.instancePath}`),t.var(le.default.parentData,(0,ae._)`${le.default.valCxt}.${le.default.parentData}`),t.var(le.default.parentDataProperty,(0,ae._)`${le.default.valCxt}.${le.default.parentDataProperty}`),t.var(le.default.rootData,(0,ae._)`${le.default.valCxt}.${le.default.rootData}`),e.dynamicRef&&t.var(le.default.dynamicAnchors,(0,ae._)`${le.default.valCxt}.${le.default.dynamicAnchors}`)},()=>{t.var(le.default.instancePath,(0,ae._)`""`),t.var(le.default.parentData,(0,ae._)`undefined`),t.var(le.default.parentDataProperty,(0,ae._)`undefined`),t.var(le.default.rootData,le.default.data),e.dynamicRef&&t.var(le.default.dynamicAnchors,(0,ae._)`{}`)})}function yh(t){const{schema:e,opts:a,gen:s}=t;Ol(t,()=>{a.$comment&&e.$comment&&jl(t),Eh(t),s.let(le.default.vErrors,null),s.let(le.default.errors,0),a.unevaluated&&_h(t),Al(t),Rh(t)})}function _h(t){const{gen:e,validateName:a}=t;t.evaluated=e.const("evaluated",(0,ae._)`${a}.evaluated`),e.if((0,ae._)`${t.evaluated}.dynamicProps`,()=>e.assign((0,ae._)`${t.evaluated}.props`,(0,ae._)`undefined`)),e.if((0,ae._)`${t.evaluated}.dynamicItems`,()=>e.assign((0,ae._)`${t.evaluated}.items`,(0,ae._)`undefined`))}function Tl(t,e){const a=typeof t=="object"&&t[e.schemaId];return a&&(e.code.source||e.code.process)?(0,ae._)`/*# sourceURL=${a} */`:ae.nil}function $h(t,e){if(Il(t)&&(Nl(t),Cl(t))){wh(t,e);return}(0,Rl.boolOrEmptySchema)(t,e)}function Cl({schema:t,self:e}){if(typeof t=="boolean")return!t;for(const a in t)if(e.RULES.all[a])return!0;return!1}function Il(t){return typeof t.schema!="boolean"}function wh(t,e){const{schema:a,gen:s,opts:r}=t;r.$comment&&a.$comment&&jl(t),Ph(t),Sh(t);const n=s.const("_errs",le.default.errors);Al(t,n),s.var(e,(0,ae._)`${n} === ${le.default.errors}`)}function Nl(t){(0,Ht.checkUnknownRules)(t),bh(t)}function Al(t,e){if(t.opts.jtd)return Dl(t,[],!1,e);const a=(0,kl.getSchemaTypes)(t.schema),s=(0,kl.coerceAndCheckDataType)(t,a);Dl(t,a,!s,e)}function bh(t){const{schema:e,errSchemaPath:a,opts:s,self:r}=t;e.$ref&&s.ignoreKeywordsWithRef&&(0,Ht.schemaHasRulesButRef)(e,r.RULES)&&r.logger.warn(`$ref: keywords ignored in schema at path "${a}"`)}function Eh(t){const{schema:e,opts:a}=t;e.default!==void 0&&a.useDefaults&&a.strictSchema&&(0,Ht.checkStrictMode)(t,"default is ignored in the schema root")}function Ph(t){const e=t.schema[t.opts.schemaId];e&&(t.baseId=(0,ph.resolveUrl)(t.opts.uriResolver,t.baseId,e))}function Sh(t){if(t.schema.$async&&!t.schemaEnv.$async)throw new Error("async schema in sync schema")}function jl({gen:t,schemaEnv:e,schema:a,errSchemaPath:s,opts:r}){const n=a.$comment;if(r.$comment===!0)t.code((0,ae._)`${le.default.self}.logger.log(${n})`);else if(typeof r.$comment=="function"){const i=(0,ae.str)`${s}/$comment`,o=t.scopeValue("root",{ref:e.root});t.code((0,ae._)`${le.default.self}.opts.$comment(${n}, ${i}, ${o}.schema)`)}}function Rh(t){const{gen:e,schemaEnv:a,validateName:s,ValidationError:r,opts:n}=t;a.$async?e.if((0,ae._)`${le.default.errors} === 0`,()=>e.return(le.default.data),()=>e.throw((0,ae._)`new ${r}(${le.default.vErrors})`)):(e.assign((0,ae._)`${s}.errors`,le.default.vErrors),n.unevaluated&&kh(t),e.return((0,ae._)`${le.default.errors} === 0`))}function kh({gen:t,evaluated:e,props:a,items:s}){a instanceof ae.Name&&t.assign((0,ae._)`${e}.props`,a),s instanceof ae.Name&&t.assign((0,ae._)`${e}.items`,s)}function Dl(t,e,a,s){const{gen:r,schema:n,data:i,allErrors:o,opts:c,self:l}=t,{RULES:u}=l;if(n.$ref&&(c.ignoreKeywordsWithRef||!(0,Ht.schemaHasRulesButRef)(n,u))){r.block(()=>Fl(t,"$ref",u.all.$ref.definition));return}c.jtd||Oh(t,e),r.block(()=>{for(const y of u.rules)f(y);f(u.post)});function f(y){(0,Pn.shouldUseGroup)(n,y)&&(y.type?(r.if((0,Va.checkDataType)(y.type,i,c.strictNumbers)),xl(t,y),e.length===1&&e[0]===y.type&&a&&(r.else(),(0,Va.reportTypeError)(t)),r.endIf()):xl(t,y),o||r.if((0,ae._)`${le.default.errors} === ${s||0}`))}}function xl(t,e){const{gen:a,schema:s,opts:{useDefaults:r}}=t;r&&(0,hh.assignDefaults)(t,e.type),a.block(()=>{for(const n of e.rules)(0,Pn.shouldUseRule)(s,n)&&Fl(t,n.keyword,n.definition,e.type)})}function Oh(t,e){t.schemaEnv.meta||!t.opts.strictTypes||(Th(t,e),t.opts.allowUnionTypes||Ch(t,e),Ih(t,t.dataTypes))}function Th(t,e){if(e.length){if(!t.dataTypes.length){t.dataTypes=e;return}e.forEach(a=>{Ml(t.dataTypes,a)||Rn(t,`type "${a}" not allowed by context "${t.dataTypes.join(",")}"`)}),Ah(t,e)}}function Ch(t,e){e.length>1&&!(e.length===2&&e.includes("null"))&&Rn(t,"use allowUnionTypes to allow union type keyword")}function Ih(t,e){const a=t.self.RULES.all;for(const s in a){const r=a[s];if(typeof r=="object"&&(0,Pn.shouldUseRule)(t.schema,r)){const{type:n}=r.definition;n.length&&!n.some(i=>Nh(e,i))&&Rn(t,`missing type "${n.join(",")}" for keyword "${s}"`)}}}function Nh(t,e){return t.includes(e)||e==="number"&&t.includes("integer")}function Ml(t,e){return t.includes(e)||e==="integer"&&t.includes("number")}function Ah(t,e){const a=[];for(const s of t.dataTypes)Ml(e,s)?a.push(s):e.includes("integer")&&s==="number"&&a.push("integer");t.dataTypes=a}function Rn(t,e){const a=t.schemaEnv.baseId+t.errSchemaPath;e+=` at "${a}" (strictTypes)`,(0,Ht.checkStrictMode)(t,e,t.opts.strictTypes)}class Ll{constructor(e,a,s){if((0,oa.validateKeywordUsage)(e,a,s),this.gen=e.gen,this.allErrors=e.allErrors,this.keyword=s,this.data=e.data,this.schema=e.schema[s],this.$data=a.$data&&e.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,Ht.schemaRefOrVal)(e,this.schema,s,this.$data),this.schemaType=a.schemaType,this.parentSchema=e.schema,this.params={},this.it=e,this.def=a,this.$data)this.schemaCode=e.gen.const("vSchema",ql(this.$data,e));else if(this.schemaCode=this.schemaValue,!(0,oa.validSchemaType)(this.schema,a.schemaType,a.allowUndefined))throw new Error(`${s} value must be ${JSON.stringify(a.schemaType)}`);("code"in a?a.trackErrors:a.errors!==!1)&&(this.errsCount=e.gen.const("_errs",le.default.errors))}result(e,a,s){this.failResult((0,ae.not)(e),a,s)}failResult(e,a,s){this.gen.if(e),s?s():this.error(),a?(this.gen.else(),a(),this.allErrors&&this.gen.endIf()):this.allErrors?this.gen.endIf():this.gen.else()}pass(e,a){this.failResult((0,ae.not)(e),void 0,a)}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:a}=this;this.fail((0,ae._)`${a} !== undefined && (${(0,ae.or)(this.invalid$data(),e)})`)}error(e,a,s){if(a){this.setParams(a),this._error(e,s),this.setParams({});return}this._error(e,s)}_error(e,a){(e?la.reportExtraError:la.reportError)(this,this.def.error,a)}$dataError(){(0,la.reportError)(this,this.def.$dataError||la.keyword$DataError)}reset(){if(this.errsCount===void 0)throw new Error('add "trackErrors" to keyword definition');(0,la.resetErrorsCount)(this.gen,this.errsCount)}ok(e){this.allErrors||this.gen.if(e)}setParams(e,a){a?Object.assign(this.params,e):this.params=e}block$data(e,a,s=ae.nil){this.gen.block(()=>{this.check$data(e,s),a()})}check$data(e=ae.nil,a=ae.nil){if(!this.$data)return;const{gen:s,schemaCode:r,schemaType:n,def:i}=this;s.if((0,ae.or)((0,ae._)`${r} === undefined`,a)),e!==ae.nil&&s.assign(e,!0),(n.length||i.validateSchema)&&(s.elseIf(this.invalid$data()),this.$dataError(),e!==ae.nil&&s.assign(e,!1)),s.else()}invalid$data(){const{gen:e,schemaCode:a,schemaType:s,def:r,it:n}=this;return(0,ae.or)(i(),o());function i(){if(s.length){if(!(a instanceof ae.Name))throw new Error("ajv implementation error");const c=Array.isArray(s)?s:[s];return(0,ae._)`${(0,Va.checkDataTypes)(c,a,n.opts.strictNumbers,Va.DataType.Wrong)}`}return ae.nil}function o(){if(r.validateSchema){const c=e.scopeValue("validate$data",{ref:r.validateSchema});return(0,ae._)`!${c}(${a})`}return ae.nil}}subschema(e,a){const s=(0,Sn.getSubschema)(this.it,e);(0,Sn.extendSubschemaData)(s,this.it,e),(0,Sn.extendSubschemaMode)(s,e);const r={...this.it,...s,items:void 0,props:void 0};return $h(r,a),r}mergeEvaluated(e,a){const{it:s,gen:r}=this;s.opts.unevaluated&&(s.props!==!0&&e.props!==void 0&&(s.props=Ht.mergeEvaluated.props(r,e.props,s.props,a)),s.items!==!0&&e.items!==void 0&&(s.items=Ht.mergeEvaluated.items(r,e.items,s.items,a)))}mergeValidEvaluated(e,a){const{it:s,gen:r}=this;if(s.opts.unevaluated&&(s.props!==!0||s.items!==!0))return r.if(a,()=>this.mergeEvaluated(e,ae.Name)),!0}}bt.KeywordCxt=Ll;function Fl(t,e,a,s){const r=new Ll(t,a,e);"code"in a?a.code(r,s):r.$data&&a.validate?(0,oa.funcKeywordCode)(r,a):"macro"in a?(0,oa.macroKeywordCode)(r,a):(a.compile||a.validate)&&(0,oa.funcKeywordCode)(r,a)}const jh=/^\/(?:[^~]|~0|~1)*$/,Dh=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function ql(t,{dataLevel:e,dataNames:a,dataPathArr:s}){let r,n;if(t==="")return le.default.rootData;if(t[0]==="/"){if(!jh.test(t))throw new Error(`Invalid JSON-pointer: ${t}`);r=t,n=le.default.rootData}else{const l=Dh.exec(t);if(!l)throw new Error(`Invalid JSON-pointer: ${t}`);const u=+l[1];if(r=l[2],r==="#"){if(u>=e)throw new Error(c("property/index",u));return s[e-u]}if(u>e)throw new Error(c("data",u));if(n=a[e-u],!r)return n}let i=n;const o=r.split("/");for(const l of o)l&&(n=(0,ae._)`${n}${(0,ae.getProperty)((0,Ht.unescapeJsonPointer)(l))}`,i=(0,ae._)`${i} && ${n}`);return i;function c(l,u){return`Cannot access ${l} ${u} levels up, current level is ${e}`}}bt.getData=ql;var ca={};Object.defineProperty(ca,"__esModule",{value:!0});let xh=class extends Error{constructor(e){super("validation failed"),this.errors=e,this.ajv=this.validation=!0}};ca.default=xh;var Mr={};Object.defineProperty(Mr,"__esModule",{value:!0});const kn=Xe;let Mh=class extends Error{constructor(e,a,s,r){super(r||`can't resolve reference ${s} from id ${a}`),this.missingRef=(0,kn.resolveUrl)(e,a,s),this.missingSchema=(0,kn.normalizeId)((0,kn.getFullPath)(e,this.missingRef))}};Mr.default=Mh;var ut={};Object.defineProperty(ut,"__esModule",{value:!0}),ut.resolveSchema=ut.getCompilingSchema=ut.resolveRef=ut.compileSchema=ut.SchemaEnv=void 0;const Et=ge,Lh=ca,gr=Nt,Pt=Xe,Ul=G,Fh=bt;class za{constructor(e){var a;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=(a=e.baseId)!==null&&a!==void 0?a:(0,Pt.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={}}}ut.SchemaEnv=za;function On(t){const e=Vl.call(this,t);if(e)return e;const a=(0,Pt.getFullPath)(this.opts.uriResolver,t.root.baseId),{es5:s,lines:r}=this.opts.code,{ownProperties:n}=this.opts,i=new Et.CodeGen(this.scope,{es5:s,lines:r,ownProperties:n});let o;t.$async&&(o=i.scopeValue("Error",{ref:Lh.default,code:(0,Et._)`require("ajv/dist/runtime/validation_error").default`}));const c=i.scopeName("validate");t.validateName=c;const l={gen:i,allErrors:this.opts.allErrors,data:gr.default.data,parentData:gr.default.parentData,parentDataProperty:gr.default.parentDataProperty,dataNames:[gr.default.data],dataPathArr:[Et.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:i.scopeValue("schema",this.opts.code.source===!0?{ref:t.schema,code:(0,Et.stringify)(t.schema)}:{ref:t.schema}),validateName:c,ValidationError:o,schema:t.schema,schemaEnv:t,rootId:a,baseId:t.baseId||a,schemaPath:Et.nil,errSchemaPath:t.schemaPath||(this.opts.jtd?"":"#"),errorPath:(0,Et._)`""`,opts:this.opts,self:this};let u;try{this._compilations.add(t),(0,Fh.validateFunctionCode)(l),i.optimize(this.opts.code.optimize);const f=i.toString();u=`${i.scopeRefs(gr.default.scope)}return ${f}`,this.opts.code.process&&(u=this.opts.code.process(u,t));const d=new Function(`${gr.default.self}`,`${gr.default.scope}`,u)(this,this.scope.get());if(this.scope.value(c,{ref:d}),d.errors=null,d.schema=t.schema,d.schemaEnv=t,t.$async&&(d.$async=!0),this.opts.code.source===!0&&(d.source={validateName:c,validateCode:f,scopeValues:i._values}),this.opts.unevaluated){const{props:m,items:p}=l;d.evaluated={props:m instanceof Et.Name?void 0:m,items:p instanceof Et.Name?void 0:p,dynamicProps:m instanceof Et.Name,dynamicItems:p instanceof Et.Name},d.source&&(d.source.evaluated=(0,Et.stringify)(d.evaluated))}return t.validate=d,t}catch(f){throw delete t.validate,delete t.validateName,u&&this.logger.error("Error compiling schema, function code:",u),f}finally{this._compilations.delete(t)}}ut.compileSchema=On;function qh(t,e,a){var s;a=(0,Pt.resolveUrl)(this.opts.uriResolver,e,a);const r=t.refs[a];if(r)return r;let n=zh.call(this,t,a);if(n===void 0){const i=(s=t.localRefs)===null||s===void 0?void 0:s[a],{schemaId:o}=this.opts;i&&(n=new za({schema:i,schemaId:o,root:t,baseId:e}))}if(n!==void 0)return t.refs[a]=Uh.call(this,n)}ut.resolveRef=qh;function Uh(t){return(0,Pt.inlineRef)(t.schema,this.opts.inlineRefs)?t.schema:t.validate?t:On.call(this,t)}function Vl(t){for(const e of this._compilations)if(Vh(e,t))return e}ut.getCompilingSchema=Vl;function Vh(t,e){return t.schema===e.schema&&t.root===e.root&&t.baseId===e.baseId}function zh(t,e){let a;for(;typeof(a=this.refs[e])=="string";)e=a;return a||this.schemas[e]||Ha.call(this,t,e)}function Ha(t,e){const a=this.opts.uriResolver.parse(e),s=(0,Pt._getFullPath)(this.opts.uriResolver,a);let r=(0,Pt.getFullPath)(this.opts.uriResolver,t.baseId,void 0);if(Object.keys(t.schema).length>0&&s===r)return Tn.call(this,a,t);const n=(0,Pt.normalizeId)(s),i=this.refs[n]||this.schemas[n];if(typeof i=="string"){const o=Ha.call(this,t,i);return typeof(o==null?void 0:o.schema)!="object"?void 0:Tn.call(this,a,o)}if(typeof(i==null?void 0:i.schema)=="object"){if(i.validate||On.call(this,i),n===(0,Pt.normalizeId)(e)){const{schema:o}=i,{schemaId:c}=this.opts,l=o[c];return l&&(r=(0,Pt.resolveUrl)(this.opts.uriResolver,r,l)),new za({schema:o,schemaId:c,root:t,baseId:r})}return Tn.call(this,a,i)}}ut.resolveSchema=Ha;const Hh=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function Tn(t,{baseId:e,schema:a,root:s}){var r;if(((r=t.fragment)===null||r===void 0?void 0:r[0])!=="/")return;for(const o of t.fragment.slice(1).split("/")){if(typeof a=="boolean")return;const c=a[(0,Ul.unescapeFragment)(o)];if(c===void 0)return;a=c;const l=typeof a=="object"&&a[this.opts.schemaId];!Hh.has(o)&&l&&(e=(0,Pt.resolveUrl)(this.opts.uriResolver,e,l))}let n;if(typeof a!="boolean"&&a.$ref&&!(0,Ul.schemaHasRulesButRef)(a,this.RULES)){const o=(0,Pt.resolveUrl)(this.opts.uriResolver,e,a.$ref);n=Ha.call(this,s,o)}const{schemaId:i}=this.opts;if(n=n||new za({schema:a,schemaId:i,root:s,baseId:e}),n.schema!==n.root.schema)return n}const Zh={$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 Cn={},Za={exports:{}};const Kh=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),zl=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 Hl(t){let e="",a=0,s=0;for(s=0;s<t.length;s++)if(a=t[s].charCodeAt(0),a!==48){if(!(a>=48&&a<=57||a>=65&&a<=70||a>=97&&a<=102))return"";e+=t[s];break}for(s+=1;s<t.length;s++){if(a=t[s].charCodeAt(0),!(a>=48&&a<=57||a>=65&&a<=70||a>=97&&a<=102))return"";e+=t[s]}return e}const Bh=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function Zl(t){return t.length=0,!0}function Jh(t,e,a){if(t.length){const s=Hl(t);if(s!=="")e.push(s);else return a.error=!0,!1;t.length=0}return!0}function Qh(t){let e=0;const a={error:!1,address:"",zone:""},s=[],r=[];let n=!1,i=!1,o=Jh;for(let c=0;c<t.length;c++){const l=t[c];if(!(l==="["||l==="]"))if(l===":"){if(n===!0&&(i=!0),!o(r,s,a))break;if(++e>7){a.error=!0;break}c>0&&t[c-1]===":"&&(n=!0),s.push(":");continue}else if(l==="%"){if(!o(r,s,a))break;o=Zl}else{r.push(l);continue}}return r.length&&(o===Zl?a.zone=r.join(""):i?s.push(r.join("")):s.push(Hl(r))),a.address=s.join(""),a}function Kl(t){if(Gh(t,":")<2)return{host:t,isIPV6:!1};const e=Qh(t);if(e.error)return{host:t,isIPV6:!1};{let a=e.address,s=e.address;return e.zone&&(a+="%"+e.zone,s+="%25"+e.zone),{host:a,isIPV6:!0,escapedHost:s}}}function Gh(t,e){let a=0;for(let s=0;s<t.length;s++)t[s]===e&&a++;return a}function Wh(t){let e=t;const a=[];let s=-1,r=0;for(;r=e.length;){if(r===1){if(e===".")break;if(e==="/"){a.push("/");break}else{a.push(e);break}}else if(r===2){if(e[0]==="."){if(e[1]===".")break;if(e[1]==="/"){e=e.slice(2);continue}}else if(e[0]==="/"&&(e[1]==="."||e[1]==="/")){a.push("/");break}}else if(r===3&&e==="/.."){a.length!==0&&a.pop(),a.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),a.length!==0&&a.pop();continue}}if((s=e.indexOf("/",1))===-1){a.push(e);break}else a.push(e.slice(0,s)),e=e.slice(s)}return a.join("")}function Yh(t,e){const a=e!==!0?escape:unescape;return t.scheme!==void 0&&(t.scheme=a(t.scheme)),t.userinfo!==void 0&&(t.userinfo=a(t.userinfo)),t.host!==void 0&&(t.host=a(t.host)),t.path!==void 0&&(t.path=a(t.path)),t.query!==void 0&&(t.query=a(t.query)),t.fragment!==void 0&&(t.fragment=a(t.fragment)),t}function Xh(t){const e=[];if(t.userinfo!==void 0&&(e.push(t.userinfo),e.push("@")),t.host!==void 0){let a=unescape(t.host);if(!zl(a)){const s=Kl(a);s.isIPV6===!0?a=`[${s.escapedHost}]`:a=t.host}e.push(a)}return(typeof t.port=="number"||typeof t.port=="string")&&(e.push(":"),e.push(String(t.port))),e.length?e.join(""):void 0}var Bl={nonSimpleDomain:Bh,recomposeAuthority:Xh,normalizeComponentEncoding:Yh,removeDotSegments:Wh,isIPv4:zl,isUUID:Kh,normalizeIPv6:Kl};const{isUUID:ep}=Bl,tp=/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu;function Jl(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 Ql(t){return t.host||(t.error=t.error||"HTTP URIs must have a host."),t}function Gl(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 rp(t){return t.secure=Jl(t),t.resourceName=(t.path||"/")+(t.query?"?"+t.query:""),t.path=void 0,t.query=void 0,t}function ap(t){if((t.port===(Jl(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,a]=t.resourceName.split("?");t.path=e&&e!=="/"?e:void 0,t.query=a,t.resourceName=void 0}return t.fragment=void 0,t}function sp(t,e){if(!t.path)return t.error="URN can not be parsed",t;const a=t.path.match(tp);if(a){const s=e.scheme||t.scheme||"urn";t.nid=a[1].toLowerCase(),t.nss=a[2];const r=`${s}:${e.nid||t.nid}`,n=In(r);t.path=void 0,n&&(t=n.parse(t,e))}else t.error=t.error||"URN can not be parsed.";return t}function np(t,e){if(t.nid===void 0)throw new Error("URN without nid cannot be serialized");const a=e.scheme||t.scheme||"urn",s=t.nid.toLowerCase(),r=`${a}:${e.nid||s}`,n=In(r);n&&(t=n.serialize(t,e));const i=t,o=t.nss;return i.path=`${s||e.nid}:${o}`,e.skipEscape=!0,i}function ip(t,e){const a=t;return a.uuid=a.nss,a.nss=void 0,!e.tolerant&&(!a.uuid||!ep(a.uuid))&&(a.error=a.error||"UUID is not valid."),a}function op(t){const e=t;return e.nss=(t.uuid||"").toLowerCase(),e}const Wl={scheme:"http",domainHost:!0,parse:Ql,serialize:Gl},lp={scheme:"https",domainHost:Wl.domainHost,parse:Ql,serialize:Gl},Ka={scheme:"ws",domainHost:!0,parse:rp,serialize:ap},cp={scheme:"wss",domainHost:Ka.domainHost,parse:Ka.parse,serialize:Ka.serialize},Ba={http:Wl,https:lp,ws:Ka,wss:cp,urn:{scheme:"urn",parse:sp,serialize:np,skipNormalize:!0},"urn:uuid":{scheme:"urn:uuid",parse:ip,serialize:op,skipNormalize:!0}};Object.setPrototypeOf(Ba,null);function In(t){return t&&(Ba[t]||Ba[t.toLowerCase()])||void 0}var up={SCHEMES:Ba,getSchemeHandler:In};const{normalizeIPv6:dp,removeDotSegments:ua,recomposeAuthority:fp,normalizeComponentEncoding:Ja,isIPv4:hp,nonSimpleDomain:pp}=Bl,{SCHEMES:mp,getSchemeHandler:Yl}=up;function vp(t,e){return typeof t=="string"?t=Dt(Zt(t,e),e):typeof t=="object"&&(t=Zt(Dt(t,e),e)),t}function gp(t,e,a){const s=a?Object.assign({scheme:"null"},a):{scheme:"null"},r=Xl(Zt(t,s),Zt(e,s),s,!0);return s.skipEscape=!0,Dt(r,s)}function Xl(t,e,a,s){const r={};return s||(t=Zt(Dt(t,a),a),e=Zt(Dt(e,a),a)),a=a||{},!a.tolerant&&e.scheme?(r.scheme=e.scheme,r.userinfo=e.userinfo,r.host=e.host,r.port=e.port,r.path=ua(e.path||""),r.query=e.query):(e.userinfo!==void 0||e.host!==void 0||e.port!==void 0?(r.userinfo=e.userinfo,r.host=e.host,r.port=e.port,r.path=ua(e.path||""),r.query=e.query):(e.path?(e.path[0]==="/"?r.path=ua(e.path):((t.userinfo!==void 0||t.host!==void 0||t.port!==void 0)&&!t.path?r.path="/"+e.path:t.path?r.path=t.path.slice(0,t.path.lastIndexOf("/")+1)+e.path:r.path=e.path,r.path=ua(r.path)),r.query=e.query):(r.path=t.path,e.query!==void 0?r.query=e.query:r.query=t.query),r.userinfo=t.userinfo,r.host=t.host,r.port=t.port),r.scheme=t.scheme),r.fragment=e.fragment,r}function yp(t,e,a){return typeof t=="string"?(t=unescape(t),t=Dt(Ja(Zt(t,a),!0),{...a,skipEscape:!0})):typeof t=="object"&&(t=Dt(Ja(t,!0),{...a,skipEscape:!0})),typeof e=="string"?(e=unescape(e),e=Dt(Ja(Zt(e,a),!0),{...a,skipEscape:!0})):typeof e=="object"&&(e=Dt(Ja(e,!0),{...a,skipEscape:!0})),t.toLowerCase()===e.toLowerCase()}function Dt(t,e){const a={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),r=[],n=Yl(s.scheme||a.scheme);n&&n.serialize&&n.serialize(a,s),a.path!==void 0&&(s.skipEscape?a.path=unescape(a.path):(a.path=escape(a.path),a.scheme!==void 0&&(a.path=a.path.split("%3A").join(":")))),s.reference!=="suffix"&&a.scheme&&r.push(a.scheme,":");const i=fp(a);if(i!==void 0&&(s.reference!=="suffix"&&r.push("//"),r.push(i),a.path&&a.path[0]!=="/"&&r.push("/")),a.path!==void 0){let o=a.path;!s.absolutePath&&(!n||!n.absolutePath)&&(o=ua(o)),i===void 0&&o[0]==="/"&&o[1]==="/"&&(o="/%2F"+o.slice(2)),r.push(o)}return a.query!==void 0&&r.push("?",a.query),a.fragment!==void 0&&r.push("#",a.fragment),r.join("")}const _p=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;function Zt(t,e){const a=Object.assign({},e),s={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0};let r=!1;a.reference==="suffix"&&(a.scheme?t=a.scheme+":"+t:t="//"+t);const n=t.match(_p);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(hp(s.host)===!1){const c=dp(s.host);s.host=c.host.toLowerCase(),r=c.isIPV6}else r=!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",a.reference&&a.reference!=="suffix"&&a.reference!==s.reference&&(s.error=s.error||"URI is not a "+a.reference+" reference.");const i=Yl(a.scheme||s.scheme);if(!a.unicodeSupport&&(!i||!i.unicodeSupport)&&s.host&&(a.domainHost||i&&i.domainHost)&&r===!1&&pp(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,a)}else s.error=s.error||"URI can not be parsed.";return s}const Nn={SCHEMES:mp,normalize:vp,resolve:gp,resolveComponent:Xl,equal:yp,serialize:Dt,parse:Zt};Za.exports=Nn,Za.exports.default=Nn,Za.exports.fastUri=Nn;var $p=Za.exports;Object.defineProperty(Cn,"__esModule",{value:!0});const ec=$p;ec.code='require("ajv/dist/runtime/uri").default',Cn.default=ec,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=bt;Object.defineProperty(t,"KeywordCxt",{enumerable:!0,get:function(){return e.KeywordCxt}});var a=ge;Object.defineProperty(t,"_",{enumerable:!0,get:function(){return a._}}),Object.defineProperty(t,"str",{enumerable:!0,get:function(){return a.str}}),Object.defineProperty(t,"stringify",{enumerable:!0,get:function(){return a.stringify}}),Object.defineProperty(t,"nil",{enumerable:!0,get:function(){return a.nil}}),Object.defineProperty(t,"Name",{enumerable:!0,get:function(){return a.Name}}),Object.defineProperty(t,"CodeGen",{enumerable:!0,get:function(){return a.CodeGen}});const s=ca,r=Mr,n=mr,i=ut,o=ge,c=Xe,l=Je,u=G,f=Zh,y=Cn,d=(j,S)=>new RegExp(j,S);d.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.'},$=200;function P(j){var S,D,O,g,w,A,Z,Q,fe,ie,he,st,Ve,Te,yt,Ke,Lt,It,qe,_t,Xt,Me,Le,Ye,hr;const er=j.strict,Tr=(S=j.code)===null||S===void 0?void 0:S.optimize,ln=Tr===!0||Tr===void 0?1:Tr||0,$t=(O=(D=j.code)===null||D===void 0?void 0:D.regExp)!==null&&O!==void 0?O:d,Cr=(g=j.uriResolver)!==null&&g!==void 0?g:y.default;return{strictSchema:(A=(w=j.strictSchema)!==null&&w!==void 0?w:er)!==null&&A!==void 0?A:!0,strictNumbers:(Q=(Z=j.strictNumbers)!==null&&Z!==void 0?Z:er)!==null&&Q!==void 0?Q:!0,strictTypes:(ie=(fe=j.strictTypes)!==null&&fe!==void 0?fe:er)!==null&&ie!==void 0?ie:"log",strictTuples:(st=(he=j.strictTuples)!==null&&he!==void 0?he:er)!==null&&st!==void 0?st:"log",strictRequired:(Te=(Ve=j.strictRequired)!==null&&Ve!==void 0?Ve:er)!==null&&Te!==void 0?Te:!1,code:j.code?{...j.code,optimize:ln,regExp:$t}:{optimize:ln,regExp:$t},loopRequired:(yt=j.loopRequired)!==null&&yt!==void 0?yt:$,loopEnum:(Ke=j.loopEnum)!==null&&Ke!==void 0?Ke:$,meta:(Lt=j.meta)!==null&&Lt!==void 0?Lt:!0,messages:(It=j.messages)!==null&&It!==void 0?It:!0,inlineRefs:(qe=j.inlineRefs)!==null&&qe!==void 0?qe:!0,schemaId:(_t=j.schemaId)!==null&&_t!==void 0?_t:"$id",addUsedSchema:(Xt=j.addUsedSchema)!==null&&Xt!==void 0?Xt:!0,validateSchema:(Me=j.validateSchema)!==null&&Me!==void 0?Me:!0,validateFormats:(Le=j.validateFormats)!==null&&Le!==void 0?Le:!0,unicodeRegExp:(Ye=j.unicodeRegExp)!==null&&Ye!==void 0?Ye:!0,int32range:(hr=j.int32range)!==null&&hr!==void 0?hr:!0,uriResolver:Cr}}class k{constructor(S={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,S=this.opts={...S,...P(S)};const{es5:D,lines:O}=this.opts.code;this.scope=new o.ValueScope({scope:{},prefixes:p,es5:D,lines:O}),this.logger=B(S.logger);const g=S.validateFormats;S.validateFormats=!1,this.RULES=(0,n.getRules)(),T.call(this,h,S,"NOT SUPPORTED"),T.call(this,v,S,"DEPRECATED","warn"),this._metaOpts=Y.call(this),S.formats&&V.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),S.keywords&&z.call(this,S.keywords),typeof S.meta=="object"&&this.addMetaSchema(S.meta),K.call(this),S.validateFormats=g}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){const{$data:S,meta:D,schemaId:O}=this.opts;let g=f;O==="id"&&(g={...f},g.id=g.$id,delete g.$id),D&&S&&this.addMetaSchema(g,g[O],!1)}defaultMeta(){const{meta:S,schemaId:D}=this.opts;return this.opts.defaultMeta=typeof S=="object"?S[D]||S:void 0}validate(S,D){let O;if(typeof S=="string"){if(O=this.getSchema(S),!O)throw new Error(`no schema with key or ref "${S}"`)}else O=this.compile(S);const g=O(D);return"$async"in O||(this.errors=O.errors),g}compile(S,D){const O=this._addSchema(S,D);return O.validate||this._compileSchemaEnv(O)}compileAsync(S,D){if(typeof this.opts.loadSchema!="function")throw new Error("options.loadSchema should be a function");const{loadSchema:O}=this.opts;return g.call(this,S,D);async function g(ie,he){await w.call(this,ie.$schema);const st=this._addSchema(ie,he);return st.validate||A.call(this,st)}async function w(ie){ie&&!this.getSchema(ie)&&await g.call(this,{$ref:ie},!0)}async function A(ie){try{return this._compileSchemaEnv(ie)}catch(he){if(!(he instanceof r.default))throw he;return Z.call(this,he),await Q.call(this,he.missingSchema),A.call(this,ie)}}function Z({missingSchema:ie,missingRef:he}){if(this.refs[ie])throw new Error(`AnySchema ${ie} is loaded but ${he} cannot be resolved`)}async function Q(ie){const he=await fe.call(this,ie);this.refs[ie]||await w.call(this,he.$schema),this.refs[ie]||this.addSchema(he,ie,D)}async function fe(ie){const he=this._loading[ie];if(he)return he;try{return await(this._loading[ie]=O(ie))}finally{delete this._loading[ie]}}}addSchema(S,D,O,g=this.opts.validateSchema){if(Array.isArray(S)){for(const A of S)this.addSchema(A,void 0,O,g);return this}let w;if(typeof S=="object"){const{schemaId:A}=this.opts;if(w=S[A],w!==void 0&&typeof w!="string")throw new Error(`schema ${A} must be string`)}return D=(0,c.normalizeId)(D||w),this._checkUnique(D),this.schemas[D]=this._addSchema(S,O,D,g,!0),this}addMetaSchema(S,D,O=this.opts.validateSchema){return this.addSchema(S,D,!0,O),this}validateSchema(S,D){if(typeof S=="boolean")return!0;let O;if(O=S.$schema,O!==void 0&&typeof O!="string")throw new Error("$schema must be a string");if(O=O||this.opts.defaultMeta||this.defaultMeta(),!O)return this.logger.warn("meta-schema not available"),this.errors=null,!0;const g=this.validate(O,S);if(!g&&D){const w="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(w);else throw new Error(w)}return g}getSchema(S){let D;for(;typeof(D=x.call(this,S))=="string";)S=D;if(D===void 0){const{schemaId:O}=this.opts,g=new i.SchemaEnv({schema:{},schemaId:O});if(D=i.resolveSchema.call(this,g,S),!D)return;this.refs[S]=D}return D.validate||this._compileSchemaEnv(D)}removeSchema(S){if(S instanceof RegExp)return this._removeAllSchemas(this.schemas,S),this._removeAllSchemas(this.refs,S),this;switch(typeof S){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{const D=x.call(this,S);return typeof D=="object"&&this._cache.delete(D.schema),delete this.schemas[S],delete this.refs[S],this}case"object":{const D=S;this._cache.delete(D);let O=S[this.opts.schemaId];return O&&(O=(0,c.normalizeId)(O),delete this.schemas[O],delete this.refs[O]),this}default:throw new Error("ajv.removeSchema: invalid parameter")}}addVocabulary(S){for(const D of S)this.addKeyword(D);return this}addKeyword(S,D){let O;if(typeof S=="string")O=S,typeof D=="object"&&(this.logger.warn("these parameters are deprecated, see docs for addKeyword"),D.keyword=O);else if(typeof S=="object"&&D===void 0){if(D=S,O=D.keyword,Array.isArray(O)&&!O.length)throw new Error("addKeywords: keyword must be string or non-empty array")}else throw new Error("invalid addKeywords parameters");if(M.call(this,O,D),!D)return(0,u.eachItem)(O,w=>re.call(this,w)),this;ve.call(this,D);const g={...D,type:(0,l.getJSONTypes)(D.type),schemaType:(0,l.getJSONTypes)(D.schemaType)};return(0,u.eachItem)(O,g.type.length===0?w=>re.call(this,w,g):w=>g.type.forEach(A=>re.call(this,w,g,A))),this}getKeyword(S){const D=this.RULES.all[S];return typeof D=="object"?D.definition:!!D}removeKeyword(S){const{RULES:D}=this;delete D.keywords[S],delete D.all[S];for(const O of D.rules){const g=O.rules.findIndex(w=>w.keyword===S);g>=0&&O.rules.splice(g,1)}return this}addFormat(S,D){return typeof D=="string"&&(D=new RegExp(D)),this.formats[S]=D,this}errorsText(S=this.errors,{separator:D=", ",dataVar:O="data"}={}){return!S||S.length===0?"No errors":S.map(g=>`${O}${g.instancePath} ${g.message}`).reduce((g,w)=>g+D+w)}$dataMetaSchema(S,D){const O=this.RULES.all;S=JSON.parse(JSON.stringify(S));for(const g of D){const w=g.split("/").slice(1);let A=S;for(const Z of w)A=A[Z];for(const Z in O){const Q=O[Z];if(typeof Q!="object")continue;const{$data:fe}=Q.definition,ie=A[Z];fe&&ie&&(A[Z]=de(ie))}}return S}_removeAllSchemas(S,D){for(const O in S){const g=S[O];(!D||D.test(O))&&(typeof g=="string"?delete S[O]:g&&!g.meta&&(this._cache.delete(g.schema),delete S[O]))}}_addSchema(S,D,O,g=this.opts.validateSchema,w=this.opts.addUsedSchema){let A;const{schemaId:Z}=this.opts;if(typeof S=="object")A=S[Z];else{if(this.opts.jtd)throw new Error("schema must be object");if(typeof S!="boolean")throw new Error("schema must be object or boolean")}let Q=this._cache.get(S);if(Q!==void 0)return Q;O=(0,c.normalizeId)(A||O);const fe=c.getSchemaRefs.call(this,S,O);return Q=new i.SchemaEnv({schema:S,schemaId:Z,meta:D,baseId:O,localRefs:fe}),this._cache.set(Q.schema,Q),w&&!O.startsWith("#")&&(O&&this._checkUnique(O),this.refs[O]=Q),g&&this.validateSchema(S,!0),Q}_checkUnique(S){if(this.schemas[S]||this.refs[S])throw new Error(`schema with key or id "${S}" already exists`)}_compileSchemaEnv(S){if(S.meta?this._compileMetaSchema(S):i.compileSchema.call(this,S),!S.validate)throw new Error("ajv implementation error");return S.validate}_compileMetaSchema(S){const D=this.opts;this.opts=this._metaOpts;try{i.compileSchema.call(this,S)}finally{this.opts=D}}}k.ValidationError=s.default,k.MissingRefError=r.default,t.default=k;function T(j,S,D,O="error"){for(const g in j){const w=g;w in S&&this.logger[O](`${D}: option ${g}. ${j[w]}`)}}function x(j){return j=(0,c.normalizeId)(j),this.schemas[j]||this.refs[j]}function K(){const j=this.opts.schemas;if(j)if(Array.isArray(j))this.addSchema(j);else for(const S in j)this.addSchema(j[S],S)}function V(){for(const j in this.opts.formats){const S=this.opts.formats[j];S&&this.addFormat(j,S)}}function z(j){if(Array.isArray(j)){this.addVocabulary(j);return}this.logger.warn("keywords option as map is deprecated, pass array");for(const S in j){const D=j[S];D.keyword||(D.keyword=S),this.addKeyword(D)}}function Y(){const j={...this.opts};for(const S of m)delete j[S];return j}const ee={log(){},warn(){},error(){}};function B(j){if(j===!1)return ee;if(j===void 0)return console;if(j.log&&j.warn&&j.error)return j;throw new Error("logger must implement log, warn and error methods")}const F=/^[a-z_$][a-z0-9_$:-]*$/i;function M(j,S){const{RULES:D}=this;if((0,u.eachItem)(j,O=>{if(D.keywords[O])throw new Error(`Keyword ${O} is already defined`);if(!F.test(O))throw new Error(`Keyword ${O} has invalid name`)}),!!S&&S.$data&&!("code"in S||"validate"in S))throw new Error('$data keyword must have "code" or "validate" function')}function re(j,S,D){var O;const g=S==null?void 0:S.post;if(D&&g)throw new Error('keyword with "post" flag cannot have "type"');const{RULES:w}=this;let A=g?w.post:w.rules.find(({type:Q})=>Q===D);if(A||(A={type:D,rules:[]},w.rules.push(A)),w.keywords[j]=!0,!S)return;const Z={keyword:j,definition:{...S,type:(0,l.getJSONTypes)(S.type),schemaType:(0,l.getJSONTypes)(S.schemaType)}};S.before?_e.call(this,A,Z,S.before):A.rules.push(Z),w.all[j]=Z,(O=S.implements)===null||O===void 0||O.forEach(Q=>this.addKeyword(Q))}function _e(j,S,D){const O=j.rules.findIndex(g=>g.keyword===D);O>=0?j.rules.splice(O,0,S):(j.rules.push(S),this.logger.warn(`rule ${D} is not defined`))}function ve(j){let{metaSchema:S}=j;S!==void 0&&(j.$data&&this.opts.$data&&(S=de(S)),j.validateSchema=this.compile(S,!0))}const be={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function de(j){return{anyOf:[j,be]}}}(rl);var An={},jn={},Dn={};Object.defineProperty(Dn,"__esModule",{value:!0});const wp={keyword:"id",code(){throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};Dn.default=wp;var yr={};Object.defineProperty(yr,"__esModule",{value:!0}),yr.callRef=yr.getValidate=void 0;const bp=Mr,tc=ye,dt=ge,Lr=Nt,rc=ut,Qa=G,Ep={keyword:"$ref",schemaType:"string",code(t){const{gen:e,schema:a,it:s}=t,{baseId:r,schemaEnv:n,validateName:i,opts:o,self:c}=s,{root:l}=n;if((a==="#"||a==="#/")&&r===l.baseId)return f();const u=rc.resolveRef.call(c,l,r,a);if(u===void 0)throw new bp.default(s.opts.uriResolver,r,a);if(u instanceof rc.SchemaEnv)return y(u);return d(u);function f(){if(n===l)return Ga(t,i,n,n.$async);const m=e.scopeValue("root",{ref:l});return Ga(t,(0,dt._)`${m}.validate`,l,l.$async)}function y(m){const p=ac(t,m);Ga(t,p,m,m.$async)}function d(m){const p=e.scopeValue("schema",o.code.source===!0?{ref:m,code:(0,dt.stringify)(m)}:{ref:m}),h=e.name("valid"),v=t.subschema({schema:m,dataTypes:[],schemaPath:dt.nil,topSchemaRef:p,errSchemaPath:a},h);t.mergeEvaluated(v),t.ok(h)}}};function ac(t,e){const{gen:a}=t;return e.validate?a.scopeValue("validate",{ref:e.validate}):(0,dt._)`${a.scopeValue("wrapper",{ref:e})}.validate`}yr.getValidate=ac;function Ga(t,e,a,s){const{gen:r,it:n}=t,{allErrors:i,schemaEnv:o,opts:c}=n,l=c.passContext?Lr.default.this:dt.nil;s?u():f();function u(){if(!o.$async)throw new Error("async schema referenced by sync schema");const m=r.let("valid");r.try(()=>{r.code((0,dt._)`await ${(0,tc.callValidateCode)(t,e,l)}`),d(e),i||r.assign(m,!0)},p=>{r.if((0,dt._)`!(${p} instanceof ${n.ValidationError})`,()=>r.throw(p)),y(p),i||r.assign(m,!1)}),t.ok(m)}function f(){t.result((0,tc.callValidateCode)(t,e,l),()=>d(e),()=>y(e))}function y(m){const p=(0,dt._)`${m}.errors`;r.assign(Lr.default.vErrors,(0,dt._)`${Lr.default.vErrors} === null ? ${p} : ${Lr.default.vErrors}.concat(${p})`),r.assign(Lr.default.errors,(0,dt._)`${Lr.default.vErrors}.length`)}function d(m){var p;if(!n.opts.unevaluated)return;const h=(p=a==null?void 0:a.validate)===null||p===void 0?void 0:p.evaluated;if(n.props!==!0)if(h&&!h.dynamicProps)h.props!==void 0&&(n.props=Qa.mergeEvaluated.props(r,h.props,n.props));else{const v=r.var("props",(0,dt._)`${m}.evaluated.props`);n.props=Qa.mergeEvaluated.props(r,v,n.props,dt.Name)}if(n.items!==!0)if(h&&!h.dynamicItems)h.items!==void 0&&(n.items=Qa.mergeEvaluated.items(r,h.items,n.items));else{const v=r.var("items",(0,dt._)`${m}.evaluated.items`);n.items=Qa.mergeEvaluated.items(r,v,n.items,dt.Name)}}}yr.callRef=Ga,yr.default=Ep,Object.defineProperty(jn,"__esModule",{value:!0});const Pp=Dn,Sp=yr,Rp=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",Pp.default,Sp.default];jn.default=Rp;var xn={},Mn={};Object.defineProperty(Mn,"__esModule",{value:!0});const Wa=ge,nr=Wa.operators,Ya={maximum:{okStr:"<=",ok:nr.LTE,fail:nr.GT},minimum:{okStr:">=",ok:nr.GTE,fail:nr.LT},exclusiveMaximum:{okStr:"<",ok:nr.LT,fail:nr.GTE},exclusiveMinimum:{okStr:">",ok:nr.GT,fail:nr.LTE}},kp={message:({keyword:t,schemaCode:e})=>(0,Wa.str)`must be ${Ya[t].okStr} ${e}`,params:({keyword:t,schemaCode:e})=>(0,Wa._)`{comparison: ${Ya[t].okStr}, limit: ${e}}`},Op={keyword:Object.keys(Ya),type:"number",schemaType:"number",$data:!0,error:kp,code(t){const{keyword:e,data:a,schemaCode:s}=t;t.fail$data((0,Wa._)`${a} ${Ya[e].fail} ${s} || isNaN(${a})`)}};Mn.default=Op;var Ln={};Object.defineProperty(Ln,"__esModule",{value:!0});const da=ge,Tp={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:{message:({schemaCode:t})=>(0,da.str)`must be multiple of ${t}`,params:({schemaCode:t})=>(0,da._)`{multipleOf: ${t}}`},code(t){const{gen:e,data:a,schemaCode:s,it:r}=t,n=r.opts.multipleOfPrecision,i=e.let("res"),o=n?(0,da._)`Math.abs(Math.round(${i}) - ${i}) > 1e-${n}`:(0,da._)`${i} !== parseInt(${i})`;t.fail$data((0,da._)`(${s} === 0 || (${i} = ${a}/${s}, ${o}))`)}};Ln.default=Tp;var Fn={},qn={};Object.defineProperty(qn,"__esModule",{value:!0});function sc(t){const e=t.length;let a=0,s=0,r;for(;s<e;)a++,r=t.charCodeAt(s++),r>=55296&&r<=56319&&s<e&&(r=t.charCodeAt(s),(r&64512)===56320&&s++);return a}qn.default=sc,sc.code='require("ajv/dist/runtime/ucs2length").default',Object.defineProperty(Fn,"__esModule",{value:!0});const _r=ge,Cp=G,Ip=qn,Np={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:{message({keyword:t,schemaCode:e}){const a=t==="maxLength"?"more":"fewer";return(0,_r.str)`must NOT have ${a} than ${e} characters`},params:({schemaCode:t})=>(0,_r._)`{limit: ${t}}`},code(t){const{keyword:e,data:a,schemaCode:s,it:r}=t,n=e==="maxLength"?_r.operators.GT:_r.operators.LT,i=r.opts.unicode===!1?(0,_r._)`${a}.length`:(0,_r._)`${(0,Cp.useFunc)(t.gen,Ip.default)}(${a})`;t.fail$data((0,_r._)`${i} ${n} ${s}`)}};Fn.default=Np;var Un={};Object.defineProperty(Un,"__esModule",{value:!0});const Ap=ye,Xa=ge,jp={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:{message:({schemaCode:t})=>(0,Xa.str)`must match pattern "${t}"`,params:({schemaCode:t})=>(0,Xa._)`{pattern: ${t}}`},code(t){const{data:e,$data:a,schema:s,schemaCode:r,it:n}=t,i=n.opts.unicodeRegExp?"u":"",o=a?(0,Xa._)`(new RegExp(${r}, ${i}))`:(0,Ap.usePattern)(t,s);t.fail$data((0,Xa._)`!${o}.test(${e})`)}};Un.default=jp;var Vn={};Object.defineProperty(Vn,"__esModule",{value:!0});const fa=ge,Dp={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:{message({keyword:t,schemaCode:e}){const a=t==="maxProperties"?"more":"fewer";return(0,fa.str)`must NOT have ${a} than ${e} properties`},params:({schemaCode:t})=>(0,fa._)`{limit: ${t}}`},code(t){const{keyword:e,data:a,schemaCode:s}=t,r=e==="maxProperties"?fa.operators.GT:fa.operators.LT;t.fail$data((0,fa._)`Object.keys(${a}).length ${r} ${s}`)}};Vn.default=Dp;var zn={};Object.defineProperty(zn,"__esModule",{value:!0});const ha=ye,pa=ge,xp=G,Mp={keyword:"required",type:"object",schemaType:"array",$data:!0,error:{message:({params:{missingProperty:t}})=>(0,pa.str)`must have required property '${t}'`,params:({params:{missingProperty:t}})=>(0,pa._)`{missingProperty: ${t}}`},code(t){const{gen:e,schema:a,schemaCode:s,data:r,$data:n,it:i}=t,{opts:o}=i;if(!n&&a.length===0)return;const c=a.length>=o.loopRequired;if(i.allErrors?l():u(),o.strictRequired){const d=t.parentSchema.properties,{definedProperties:m}=t.it;for(const p of a)if((d==null?void 0:d[p])===void 0&&!m.has(p)){const h=i.schemaEnv.baseId+i.errSchemaPath,v=`required property "${p}" is not defined at "${h}" (strictRequired)`;(0,xp.checkStrictMode)(i,v,i.opts.strictRequired)}}function l(){if(c||n)t.block$data(pa.nil,f);else for(const d of a)(0,ha.checkReportMissingProp)(t,d)}function u(){const d=e.let("missing");if(c||n){const m=e.let("valid",!0);t.block$data(m,()=>y(d,m)),t.ok(m)}else e.if((0,ha.checkMissingProp)(t,a,d)),(0,ha.reportMissingProp)(t,d),e.else()}function f(){e.forOf("prop",s,d=>{t.setParams({missingProperty:d}),e.if((0,ha.noPropertyInData)(e,r,d,o.ownProperties),()=>t.error())})}function y(d,m){t.setParams({missingProperty:d}),e.forOf(d,s,()=>{e.assign(m,(0,ha.propertyInData)(e,r,d,o.ownProperties)),e.if((0,pa.not)(m),()=>{t.error(),e.break()})},pa.nil)}}};zn.default=Mp;var Hn={};Object.defineProperty(Hn,"__esModule",{value:!0});const ma=ge,Lp={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:{message({keyword:t,schemaCode:e}){const a=t==="maxItems"?"more":"fewer";return(0,ma.str)`must NOT have ${a} than ${e} items`},params:({schemaCode:t})=>(0,ma._)`{limit: ${t}}`},code(t){const{keyword:e,data:a,schemaCode:s}=t,r=e==="maxItems"?ma.operators.GT:ma.operators.LT;t.fail$data((0,ma._)`${a}.length ${r} ${s}`)}};Hn.default=Lp;var Zn={},va={};Object.defineProperty(va,"__esModule",{value:!0});const nc=ia;nc.code='require("ajv/dist/runtime/equal").default',va.default=nc,Object.defineProperty(Zn,"__esModule",{value:!0});const Kn=Je,et=ge,Fp=G,qp=va,Up={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:{message:({params:{i:t,j:e}})=>(0,et.str)`must NOT have duplicate items (items ## ${e} and ${t} are identical)`,params:({params:{i:t,j:e}})=>(0,et._)`{i: ${t}, j: ${e}}`},code(t){const{gen:e,data:a,$data:s,schema:r,parentSchema:n,schemaCode:i,it:o}=t;if(!s&&!r)return;const c=e.let("valid"),l=n.items?(0,Kn.getSchemaTypes)(n.items):[];t.block$data(c,u,(0,et._)`${i} === false`),t.ok(c);function u(){const m=e.let("i",(0,et._)`${a}.length`),p=e.let("j");t.setParams({i:m,j:p}),e.assign(c,!0),e.if((0,et._)`${m} > 1`,()=>(f()?y:d)(m,p))}function f(){return l.length>0&&!l.some(m=>m==="object"||m==="array")}function y(m,p){const h=e.name("item"),v=(0,Kn.checkDataTypes)(l,h,o.opts.strictNumbers,Kn.DataType.Wrong),$=e.const("indices",(0,et._)`{}`);e.for((0,et._)`;${m}--;`,()=>{e.let(h,(0,et._)`${a}[${m}]`),e.if(v,(0,et._)`continue`),l.length>1&&e.if((0,et._)`typeof ${h} == "string"`,(0,et._)`${h} += "_"`),e.if((0,et._)`typeof ${$}[${h}] == "number"`,()=>{e.assign(p,(0,et._)`${$}[${h}]`),t.error(),e.assign(c,!1).break()}).code((0,et._)`${$}[${h}] = ${m}`)})}function d(m,p){const h=(0,Fp.useFunc)(e,qp.default),v=e.name("outer");e.label(v).for((0,et._)`;${m}--;`,()=>e.for((0,et._)`${p} = ${m}; ${p}--;`,()=>e.if((0,et._)`${h}(${a}[${m}], ${a}[${p}])`,()=>{t.error(),e.assign(c,!1).break(v)})))}}};Zn.default=Up;var Bn={};Object.defineProperty(Bn,"__esModule",{value:!0});const Jn=ge,Vp=G,zp=va,Hp={keyword:"const",$data:!0,error:{message:"must be equal to constant",params:({schemaCode:t})=>(0,Jn._)`{allowedValue: ${t}}`},code(t){const{gen:e,data:a,$data:s,schemaCode:r,schema:n}=t;s||n&&typeof n=="object"?t.fail$data((0,Jn._)`!${(0,Vp.useFunc)(e,zp.default)}(${a}, ${r})`):t.fail((0,Jn._)`${n} !== ${a}`)}};Bn.default=Hp;var Qn={};Object.defineProperty(Qn,"__esModule",{value:!0});const ga=ge,Zp=G,Kp=va,Bp={keyword:"enum",schemaType:"array",$data:!0,error:{message:"must be equal to one of the allowed values",params:({schemaCode:t})=>(0,ga._)`{allowedValues: ${t}}`},code(t){const{gen:e,data:a,$data:s,schema:r,schemaCode:n,it:i}=t;if(!s&&r.length===0)throw new Error("enum must have non-empty array");const o=r.length>=i.opts.loopEnum;let c;const l=()=>c??(c=(0,Zp.useFunc)(e,Kp.default));let u;if(o||s)u=e.let("valid"),t.block$data(u,f);else{if(!Array.isArray(r))throw new Error("ajv implementation error");const d=e.const("vSchema",n);u=(0,ga.or)(...r.map((m,p)=>y(d,p)))}t.pass(u);function f(){e.assign(u,!1),e.forOf("v",n,d=>e.if((0,ga._)`${l()}(${a}, ${d})`,()=>e.assign(u,!0).break()))}function y(d,m){const p=r[m];return typeof p=="object"&&p!==null?(0,ga._)`${l()}(${a}, ${d}[${m}])`:(0,ga._)`${a} === ${p}`}}};Qn.default=Bp,Object.defineProperty(xn,"__esModule",{value:!0});const Jp=Mn,Qp=Ln,Gp=Fn,Wp=Un,Yp=Vn,Xp=zn,em=Hn,tm=Zn,rm=Bn,am=Qn,sm=[Jp.default,Qp.default,Gp.default,Wp.default,Yp.default,Xp.default,em.default,tm.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},rm.default,am.default];xn.default=sm;var Gn={},Fr={};Object.defineProperty(Fr,"__esModule",{value:!0}),Fr.validateAdditionalItems=void 0;const $r=ge,Wn=G,nm={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:{message:({params:{len:t}})=>(0,$r.str)`must NOT have more than ${t} items`,params:({params:{len:t}})=>(0,$r._)`{limit: ${t}}`},code(t){const{parentSchema:e,it:a}=t,{items:s}=e;if(!Array.isArray(s)){(0,Wn.checkStrictMode)(a,'"additionalItems" is ignored when "items" is not an array of schemas');return}ic(t,s)}};function ic(t,e){const{gen:a,schema:s,data:r,keyword:n,it:i}=t;i.items=!0;const o=a.const("len",(0,$r._)`${r}.length`);if(s===!1)t.setParams({len:e.length}),t.pass((0,$r._)`${o} <= ${e.length}`);else if(typeof s=="object"&&!(0,Wn.alwaysValidSchema)(i,s)){const l=a.var("valid",(0,$r._)`${o} <= ${e.length}`);a.if((0,$r.not)(l),()=>c(l)),t.ok(l)}function c(l){a.forRange("i",e.length,o,u=>{t.subschema({keyword:n,dataProp:u,dataPropType:Wn.Type.Num},l),i.allErrors||a.if((0,$r.not)(l),()=>a.break())})}}Fr.validateAdditionalItems=ic,Fr.default=nm;var Yn={},qr={};Object.defineProperty(qr,"__esModule",{value:!0}),qr.validateTuple=void 0;const oc=ge,es=G,im=ye,om={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(t){const{schema:e,it:a}=t;if(Array.isArray(e))return lc(t,"additionalItems",e);a.items=!0,!(0,es.alwaysValidSchema)(a,e)&&t.ok((0,im.validateArray)(t))}};function lc(t,e,a=t.schema){const{gen:s,parentSchema:r,data:n,keyword:i,it:o}=t;u(r),o.opts.unevaluated&&a.length&&o.items!==!0&&(o.items=es.mergeEvaluated.items(s,a.length,o.items));const c=s.name("valid"),l=s.const("len",(0,oc._)`${n}.length`);a.forEach((f,y)=>{(0,es.alwaysValidSchema)(o,f)||(s.if((0,oc._)`${l} > ${y}`,()=>t.subschema({keyword:i,schemaProp:y,dataProp:y},c)),t.ok(c))});function u(f){const{opts:y,errSchemaPath:d}=o,m=a.length,p=m===f.minItems&&(m===f.maxItems||f[e]===!1);if(y.strictTuples&&!p){const h=`"${i}" is ${m}-tuple, but minItems or maxItems/${e} are not specified or different at path "${d}"`;(0,es.checkStrictMode)(o,h,y.strictTuples)}}}qr.validateTuple=lc,qr.default=om,Object.defineProperty(Yn,"__esModule",{value:!0});const lm=qr,cm={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:t=>(0,lm.validateTuple)(t,"items")};Yn.default=cm;var Xn={};Object.defineProperty(Xn,"__esModule",{value:!0});const cc=ge,um=G,dm=ye,fm=Fr,hm={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:{message:({params:{len:t}})=>(0,cc.str)`must NOT have more than ${t} items`,params:({params:{len:t}})=>(0,cc._)`{limit: ${t}}`},code(t){const{schema:e,parentSchema:a,it:s}=t,{prefixItems:r}=a;s.items=!0,!(0,um.alwaysValidSchema)(s,e)&&(r?(0,fm.validateAdditionalItems)(t,r):t.ok((0,dm.validateArray)(t)))}};Xn.default=hm;var ei={};Object.defineProperty(ei,"__esModule",{value:!0});const mt=ge,ts=G,pm={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:{message:({params:{min:t,max:e}})=>e===void 0?(0,mt.str)`must contain at least ${t} valid item(s)`:(0,mt.str)`must contain at least ${t} and no more than ${e} valid item(s)`,params:({params:{min:t,max:e}})=>e===void 0?(0,mt._)`{minContains: ${t}}`:(0,mt._)`{minContains: ${t}, maxContains: ${e}}`},code(t){const{gen:e,schema:a,parentSchema:s,data:r,it:n}=t;let i,o;const{minContains:c,maxContains:l}=s;n.opts.next?(i=c===void 0?1:c,o=l):i=1;const u=e.const("len",(0,mt._)`${r}.length`);if(t.setParams({min:i,max:o}),o===void 0&&i===0){(0,ts.checkStrictMode)(n,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(o!==void 0&&i>o){(0,ts.checkStrictMode)(n,'"minContains" > "maxContains" is always invalid'),t.fail();return}if((0,ts.alwaysValidSchema)(n,a)){let p=(0,mt._)`${u} >= ${i}`;o!==void 0&&(p=(0,mt._)`${p} && ${u} <= ${o}`),t.pass(p);return}n.items=!0;const f=e.name("valid");o===void 0&&i===1?d(f,()=>e.if(f,()=>e.break())):i===0?(e.let(f,!0),o!==void 0&&e.if((0,mt._)`${r}.length > 0`,y)):(e.let(f,!1),y()),t.result(f,()=>t.reset());function y(){const p=e.name("_valid"),h=e.let("count",0);d(p,()=>e.if(p,()=>m(h)))}function d(p,h){e.forRange("i",0,u,v=>{t.subschema({keyword:"contains",dataProp:v,dataPropType:ts.Type.Num,compositeRule:!0},p),h()})}function m(p){e.code((0,mt._)`${p}++`),o===void 0?e.if((0,mt._)`${p} >= ${i}`,()=>e.assign(f,!0).break()):(e.if((0,mt._)`${p} > ${o}`,()=>e.assign(f,!1).break()),i===1?e.assign(f,!0):e.if((0,mt._)`${p} >= ${i}`,()=>e.assign(f,!0)))}}};ei.default=pm;var uc={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.validateSchemaDeps=t.validatePropertyDeps=t.error=void 0;const e=ge,a=G,s=ye;t.error={message:({params:{property:c,depsCount:l,deps:u}})=>{const f=l===1?"property":"properties";return(0,e.str)`must have ${f} ${u} when property ${c} is present`},params:({params:{property:c,depsCount:l,deps:u,missingProperty:f}})=>(0,e._)`{property: ${c},
|
|
6
|
-
missingProperty: ${f},
|
|
7
|
-
depsCount: ${l},
|
|
8
|
-
deps: ${u}}`};const r={keyword:"dependencies",type:"object",schemaType:"object",error:t.error,code(c){const[l,u]=n(c);i(c,l),o(c,u)}};function n({schema:c}){const l={},u={};for(const f in c){if(f==="__proto__")continue;const y=Array.isArray(c[f])?l:u;y[f]=c[f]}return[l,u]}function i(c,l=c.schema){const{gen:u,data:f,it:y}=c;if(Object.keys(l).length===0)return;const d=u.let("missing");for(const m in l){const p=l[m];if(p.length===0)continue;const h=(0,s.propertyInData)(u,f,m,y.opts.ownProperties);c.setParams({property:m,depsCount:p.length,deps:p.join(", ")}),y.allErrors?u.if(h,()=>{for(const v of p)(0,s.checkReportMissingProp)(c,v)}):(u.if((0,e._)`${h} && (${(0,s.checkMissingProp)(c,p,d)})`),(0,s.reportMissingProp)(c,d),u.else())}}t.validatePropertyDeps=i;function o(c,l=c.schema){const{gen:u,data:f,keyword:y,it:d}=c,m=u.name("valid");for(const p in l)(0,a.alwaysValidSchema)(d,l[p])||(u.if((0,s.propertyInData)(u,f,p,d.opts.ownProperties),()=>{const h=c.subschema({keyword:y,schemaProp:p},m);c.mergeValidEvaluated(h,m)},()=>u.var(m,!0)),c.ok(m))}t.validateSchemaDeps=o,t.default=r})(uc);var ti={};Object.defineProperty(ti,"__esModule",{value:!0});const dc=ge,mm=G,vm={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:{message:"property name must be valid",params:({params:t})=>(0,dc._)`{propertyName: ${t.propertyName}}`},code(t){const{gen:e,schema:a,data:s,it:r}=t;if((0,mm.alwaysValidSchema)(r,a))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,dc.not)(n),()=>{t.error(!0),r.allErrors||e.break()})}),t.ok(n)}};ti.default=vm;var rs={};Object.defineProperty(rs,"__esModule",{value:!0});const as=ye,St=ge,gm=Nt,ss=G,ym={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:{message:"must NOT have additional properties",params:({params:t})=>(0,St._)`{additionalProperty: ${t.additionalProperty}}`},code(t){const{gen:e,schema:a,parentSchema:s,data:r,errsCount:n,it:i}=t;if(!n)throw new Error("ajv implementation error");const{allErrors:o,opts:c}=i;if(i.props=!0,c.removeAdditional!=="all"&&(0,ss.alwaysValidSchema)(i,a))return;const l=(0,as.allSchemaProperties)(s.properties),u=(0,as.allSchemaProperties)(s.patternProperties);f(),t.ok((0,St._)`${n} === ${gm.default.errors}`);function f(){e.forIn("key",r,h=>{!l.length&&!u.length?m(h):e.if(y(h),()=>m(h))})}function y(h){let v;if(l.length>8){const $=(0,ss.schemaRefOrVal)(i,s.properties,"properties");v=(0,as.isOwnProperty)(e,$,h)}else l.length?v=(0,St.or)(...l.map($=>(0,St._)`${h} === ${$}`)):v=St.nil;return u.length&&(v=(0,St.or)(v,...u.map($=>(0,St._)`${(0,as.usePattern)(t,$)}.test(${h})`))),(0,St.not)(v)}function d(h){e.code((0,St._)`delete ${r}[${h}]`)}function m(h){if(c.removeAdditional==="all"||c.removeAdditional&&a===!1){d(h);return}if(a===!1){t.setParams({additionalProperty:h}),t.error(),o||e.break();return}if(typeof a=="object"&&!(0,ss.alwaysValidSchema)(i,a)){const v=e.name("valid");c.removeAdditional==="failing"?(p(h,v,!1),e.if((0,St.not)(v),()=>{t.reset(),d(h)})):(p(h,v),o||e.if((0,St.not)(v),()=>e.break()))}}function p(h,v,$){const P={keyword:"additionalProperties",dataProp:h,dataPropType:ss.Type.Str};$===!1&&Object.assign(P,{compositeRule:!0,createErrors:!1,allErrors:!1}),t.subschema(P,v)}}};rs.default=ym;var ri={};Object.defineProperty(ri,"__esModule",{value:!0});const _m=bt,fc=ye,ai=G,hc=rs,$m={keyword:"properties",type:"object",schemaType:"object",code(t){const{gen:e,schema:a,parentSchema:s,data:r,it:n}=t;n.opts.removeAdditional==="all"&&s.additionalProperties===void 0&&hc.default.code(new _m.KeywordCxt(n,hc.default,"additionalProperties"));const i=(0,fc.allSchemaProperties)(a);for(const f of i)n.definedProperties.add(f);n.opts.unevaluated&&i.length&&n.props!==!0&&(n.props=ai.mergeEvaluated.props(e,(0,ai.toHash)(i),n.props));const o=i.filter(f=>!(0,ai.alwaysValidSchema)(n,a[f]));if(o.length===0)return;const c=e.name("valid");for(const f of o)l(f)?u(f):(e.if((0,fc.propertyInData)(e,r,f,n.opts.ownProperties)),u(f),n.allErrors||e.else().var(c,!0),e.endIf()),t.it.definedProperties.add(f),t.ok(c);function l(f){return n.opts.useDefaults&&!n.compositeRule&&a[f].default!==void 0}function u(f){t.subschema({keyword:"properties",schemaProp:f,dataProp:f},c)}}};ri.default=$m;var si={};Object.defineProperty(si,"__esModule",{value:!0});const pc=ye,ns=ge,mc=G,vc=G,wm={keyword:"patternProperties",type:"object",schemaType:"object",code(t){const{gen:e,schema:a,data:s,parentSchema:r,it:n}=t,{opts:i}=n,o=(0,pc.allSchemaProperties)(a),c=o.filter(p=>(0,mc.alwaysValidSchema)(n,a[p]));if(o.length===0||c.length===o.length&&(!n.opts.unevaluated||n.props===!0))return;const l=i.strictSchema&&!i.allowMatchingProperties&&r.properties,u=e.name("valid");n.props!==!0&&!(n.props instanceof ns.Name)&&(n.props=(0,vc.evaluatedPropsToName)(e,n.props));const{props:f}=n;y();function y(){for(const p of o)l&&d(p),n.allErrors?m(p):(e.var(u,!0),m(p),e.if(u))}function d(p){for(const h in l)new RegExp(p).test(h)&&(0,mc.checkStrictMode)(n,`property ${h} matches pattern ${p} (use allowMatchingProperties)`)}function m(p){e.forIn("key",s,h=>{e.if((0,ns._)`${(0,pc.usePattern)(t,p)}.test(${h})`,()=>{const v=c.includes(p);v||t.subschema({keyword:"patternProperties",schemaProp:p,dataProp:h,dataPropType:vc.Type.Str},u),n.opts.unevaluated&&f!==!0?e.assign((0,ns._)`${f}[${h}]`,!0):!v&&!n.allErrors&&e.if((0,ns.not)(u),()=>e.break())})})}}};si.default=wm;var ni={};Object.defineProperty(ni,"__esModule",{value:!0});const bm=G,Em={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(t){const{gen:e,schema:a,it:s}=t;if((0,bm.alwaysValidSchema)(s,a)){t.fail();return}const r=e.name("valid");t.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},r),t.failResult(r,()=>t.reset(),()=>t.error())},error:{message:"must NOT be valid"}};ni.default=Em;var ii={};Object.defineProperty(ii,"__esModule",{value:!0});const Pm={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:ye.validateUnion,error:{message:"must match a schema in anyOf"}};ii.default=Pm;var oi={};Object.defineProperty(oi,"__esModule",{value:!0});const is=ge,Sm=G,Rm={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:{message:"must match exactly one schema in oneOf",params:({params:t})=>(0,is._)`{passingSchemas: ${t.passing}}`},code(t){const{gen:e,schema:a,parentSchema:s,it:r}=t;if(!Array.isArray(a))throw new Error("ajv implementation error");if(r.opts.discriminator&&s.discriminator)return;const n=a,i=e.let("valid",!1),o=e.let("passing",null),c=e.name("_valid");t.setParams({passing:o}),e.block(l),t.result(i,()=>t.reset(),()=>t.error(!0));function l(){n.forEach((u,f)=>{let y;(0,Sm.alwaysValidSchema)(r,u)?e.var(c,!0):y=t.subschema({keyword:"oneOf",schemaProp:f,compositeRule:!0},c),f>0&&e.if((0,is._)`${c} && ${i}`).assign(i,!1).assign(o,(0,is._)`[${o}, ${f}]`).else(),e.if(c,()=>{e.assign(i,!0),e.assign(o,f),y&&t.mergeEvaluated(y,is.Name)})})}}};oi.default=Rm;var li={};Object.defineProperty(li,"__esModule",{value:!0});const km=G,Om={keyword:"allOf",schemaType:"array",code(t){const{gen:e,schema:a,it:s}=t;if(!Array.isArray(a))throw new Error("ajv implementation error");const r=e.name("valid");a.forEach((n,i)=>{if((0,km.alwaysValidSchema)(s,n))return;const o=t.subschema({keyword:"allOf",schemaProp:i},r);t.ok(r),t.mergeEvaluated(o)})}};li.default=Om;var ci={};Object.defineProperty(ci,"__esModule",{value:!0});const os=ge,gc=G,Tm={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:a,it:s}=t;a.then===void 0&&a.else===void 0&&(0,gc.checkStrictMode)(s,'"if" without "then" and "else" is ignored');const r=yc(s,"then"),n=yc(s,"else");if(!r&&!n)return;const i=e.let("valid",!0),o=e.name("_valid");if(c(),t.reset(),r&&n){const u=e.let("ifClause");t.setParams({ifClause:u}),e.if(o,l("then",u),l("else",u))}else r?e.if(o,l("then")):e.if((0,os.not)(o),l("else"));t.pass(i,()=>t.error(!0));function c(){const u=t.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},o);t.mergeEvaluated(u)}function l(u,f){return()=>{const y=t.subschema({keyword:u},o);e.assign(i,o),t.mergeValidEvaluated(y,i),f?e.assign(f,(0,os._)`${u}`):t.setParams({ifClause:u})}}}};function yc(t,e){const a=t.schema[e];return a!==void 0&&!(0,gc.alwaysValidSchema)(t,a)}ci.default=Tm;var ui={};Object.defineProperty(ui,"__esModule",{value:!0});const Cm=G,Im={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:t,parentSchema:e,it:a}){e.if===void 0&&(0,Cm.checkStrictMode)(a,`"${t}" without "if" is ignored`)}};ui.default=Im,Object.defineProperty(Gn,"__esModule",{value:!0});const Nm=Fr,Am=Yn,jm=qr,Dm=Xn,xm=ei,Mm=uc,Lm=ti,Fm=rs,qm=ri,Um=si,Vm=ni,zm=ii,Hm=oi,Zm=li,Km=ci,Bm=ui;function Jm(t=!1){const e=[Vm.default,zm.default,Hm.default,Zm.default,Km.default,Bm.default,Lm.default,Fm.default,Mm.default,qm.default,Um.default];return t?e.push(Am.default,Dm.default):e.push(Nm.default,jm.default),e.push(xm.default),e}Gn.default=Jm;var di={},fi={};Object.defineProperty(fi,"__esModule",{value:!0});const Ue=ge,Qm={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:{message:({schemaCode:t})=>(0,Ue.str)`must match format "${t}"`,params:({schemaCode:t})=>(0,Ue._)`{format: ${t}}`},code(t,e){const{gen:a,data:s,$data:r,schema:n,schemaCode:i,it:o}=t,{opts:c,errSchemaPath:l,schemaEnv:u,self:f}=o;if(!c.validateFormats)return;r?y():d();function y(){const m=a.scopeValue("formats",{ref:f.formats,code:c.code.formats}),p=a.const("fDef",(0,Ue._)`${m}[${i}]`),h=a.let("fType"),v=a.let("format");a.if((0,Ue._)`typeof ${p} == "object" && !(${p} instanceof RegExp)`,()=>a.assign(h,(0,Ue._)`${p}.type || "string"`).assign(v,(0,Ue._)`${p}.validate`),()=>a.assign(h,(0,Ue._)`"string"`).assign(v,p)),t.fail$data((0,Ue.or)($(),P()));function $(){return c.strictSchema===!1?Ue.nil:(0,Ue._)`${i} && !${v}`}function P(){const k=u.$async?(0,Ue._)`(${p}.async ? await ${v}(${s}) : ${v}(${s}))`:(0,Ue._)`${v}(${s})`,T=(0,Ue._)`(typeof ${v} == "function" ? ${k} : ${v}.test(${s}))`;return(0,Ue._)`${v} && ${v} !== true && ${h} === ${e} && !${T}`}}function d(){const m=f.formats[n];if(!m){$();return}if(m===!0)return;const[p,h,v]=P(m);p===e&&t.pass(k());function $(){if(c.strictSchema===!1){f.logger.warn(T());return}throw new Error(T());function T(){return`unknown format "${n}" ignored in schema at path "${l}"`}}function P(T){const x=T instanceof RegExp?(0,Ue.regexpCode)(T):c.code.formats?(0,Ue._)`${c.code.formats}${(0,Ue.getProperty)(n)}`:void 0,K=a.scopeValue("formats",{key:n,ref:T,code:x});return typeof T=="object"&&!(T instanceof RegExp)?[T.type||"string",T.validate,(0,Ue._)`${K}.validate`]:["string",T,K]}function k(){if(typeof m=="object"&&!(m instanceof RegExp)&&m.async){if(!u.$async)throw new Error("async format in sync schema");return(0,Ue._)`await ${v}(${s})`}return typeof h=="function"?(0,Ue._)`${v}(${s})`:(0,Ue._)`${v}.test(${s})`}}}};fi.default=Qm,Object.defineProperty(di,"__esModule",{value:!0});const Gm=[fi.default];di.default=Gm;var Ur={};Object.defineProperty(Ur,"__esModule",{value:!0}),Ur.contentVocabulary=Ur.metadataVocabulary=void 0,Ur.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"],Ur.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"],Object.defineProperty(An,"__esModule",{value:!0});const Wm=jn,Ym=xn,Xm=Gn,ev=di,_c=Ur,tv=[Wm.default,Ym.default,(0,Xm.default)(),ev.default,_c.metadataVocabulary,_c.contentVocabulary];An.default=tv;var hi={},ls={};Object.defineProperty(ls,"__esModule",{value:!0}),ls.DiscrError=void 0;var $c;(function(t){t.Tag="tag",t.Mapping="mapping"})($c||(ls.DiscrError=$c={})),Object.defineProperty(hi,"__esModule",{value:!0});const Vr=ge,pi=ls,wc=ut,rv=Mr,av=G,sv={keyword:"discriminator",type:"object",schemaType:"object",error:{message:({params:{discrError:t,tagName:e}})=>t===pi.DiscrError.Tag?`tag "${e}" must be string`:`value of tag "${e}" must be in oneOf`,params:({params:{discrError:t,tag:e,tagName:a}})=>(0,Vr._)`{error: ${t}, tag: ${a}, tagValue: ${e}}`},code(t){const{gen:e,data:a,schema:s,parentSchema:r,it:n}=t,{oneOf:i}=r;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 c=e.let("valid",!1),l=e.const("tag",(0,Vr._)`${a}${(0,Vr.getProperty)(o)}`);e.if((0,Vr._)`typeof ${l} == "string"`,()=>u(),()=>t.error(!1,{discrError:pi.DiscrError.Tag,tag:l,tagName:o})),t.ok(c);function u(){const d=y();e.if(!1);for(const m in d)e.elseIf((0,Vr._)`${l} === ${m}`),e.assign(c,f(d[m]));e.else(),t.error(!1,{discrError:pi.DiscrError.Mapping,tag:l,tagName:o}),e.endIf()}function f(d){const m=e.name("valid"),p=t.subschema({keyword:"oneOf",schemaProp:d},m);return t.mergeEvaluated(p,Vr.Name),m}function y(){var d;const m={},p=v(r);let h=!0;for(let k=0;k<i.length;k++){let T=i[k];if(T!=null&&T.$ref&&!(0,av.schemaHasRulesButRef)(T,n.self.RULES)){const K=T.$ref;if(T=wc.resolveRef.call(n.self,n.schemaEnv.root,n.baseId,K),T instanceof wc.SchemaEnv&&(T=T.schema),T===void 0)throw new rv.default(n.opts.uriResolver,n.baseId,K)}const x=(d=T==null?void 0:T.properties)===null||d===void 0?void 0:d[o];if(typeof x!="object")throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${o}"`);h=h&&(p||v(T)),$(x,k)}if(!h)throw new Error(`discriminator: "${o}" must be required`);return m;function v({required:k}){return Array.isArray(k)&&k.includes(o)}function $(k,T){if(k.const)P(k.const,T);else if(k.enum)for(const x of k.enum)P(x,T);else throw new Error(`discriminator: "properties/${o}" must have "const" or "enum"`)}function P(k,T){if(typeof k!="string"||k in m)throw new Error(`discriminator: "${o}" values must be unique strings`);m[k]=T}}}};hi.default=sv;const nv={$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 a=rl,s=An,r=hi,n=nv,i=["/properties"],o="http://json-schema.org/draft-07/schema";class c extends a.default{_addVocabularies(){super._addVocabularies(),s.default.forEach(m=>this.addVocabulary(m)),this.opts.discriminator&&this.addKeyword(r.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=c,t.exports=e=c,t.exports.Ajv=c,Object.defineProperty(e,"__esModule",{value:!0}),e.default=c;var l=bt;Object.defineProperty(e,"KeywordCxt",{enumerable:!0,get:function(){return l.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 f=ca;Object.defineProperty(e,"ValidationError",{enumerable:!0,get:function(){return f.default}});var y=Mr;Object.defineProperty(e,"MissingRefError",{enumerable:!0,get:function(){return y.default}})})(fn,fn.exports);var iv=fn.exports;const ov=tl(iv);var Se;(function(t){t.assertEqual=r=>{};function e(r){}t.assertIs=e;function a(r){throw new Error}t.assertNever=a,t.arrayToEnum=r=>{const n={};for(const i of r)n[i]=i;return n},t.getValidEnumValues=r=>{const n=t.objectKeys(r).filter(o=>typeof r[r[o]]!="number"),i={};for(const o of n)i[o]=r[o];return t.objectValues(i)},t.objectValues=r=>t.objectKeys(r).map(function(n){return r[n]}),t.objectKeys=typeof Object.keys=="function"?r=>Object.keys(r):r=>{const n=[];for(const i in r)Object.prototype.hasOwnProperty.call(r,i)&&n.push(i);return n},t.find=(r,n)=>{for(const i of r)if(n(i))return i},t.isInteger=typeof Number.isInteger=="function"?r=>Number.isInteger(r):r=>typeof r=="number"&&Number.isFinite(r)&&Math.floor(r)===r;function s(r,n=" | "){return r.map(i=>typeof i=="string"?`'${i}'`:i).join(n)}t.joinValues=s,t.jsonStringifyReplacer=(r,n)=>typeof n=="bigint"?n.toString():n})(Se||(Se={}));var bc;(function(t){t.mergeShapes=(e,a)=>({...e,...a})})(bc||(bc={}));const W=Se.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),ir=t=>{switch(typeof t){case"undefined":return W.undefined;case"string":return W.string;case"number":return Number.isNaN(t)?W.nan:W.number;case"boolean":return W.boolean;case"function":return W.function;case"bigint":return W.bigint;case"symbol":return W.symbol;case"object":return Array.isArray(t)?W.array:t===null?W.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?W.promise:typeof Map<"u"&&t instanceof Map?W.map:typeof Set<"u"&&t instanceof Set?W.set:typeof Date<"u"&&t instanceof Date?W.date:W.object;default:return W.unknown}},q=Se.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class Kt 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 a=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,a):this.__proto__=a,this.name="ZodError",this.issues=e}format(e){const a=e||function(n){return n.message},s={_errors:[]},r=n=>{for(const i of n.issues)if(i.code==="invalid_union")i.unionErrors.map(r);else if(i.code==="invalid_return_type")r(i.returnTypeError);else if(i.code==="invalid_arguments")r(i.argumentsError);else if(i.path.length===0)s._errors.push(a(i));else{let o=s,c=0;for(;c<i.path.length;){const l=i.path[c];c===i.path.length-1?(o[l]=o[l]||{_errors:[]},o[l]._errors.push(a(i))):o[l]=o[l]||{_errors:[]},o=o[l],c++}}};return r(this),s}static assert(e){if(!(e instanceof Kt))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Se.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=a=>a.message){const a={},s=[];for(const r of this.issues)if(r.path.length>0){const n=r.path[0];a[n]=a[n]||[],a[n].push(e(r))}else s.push(e(r));return{formErrors:s,fieldErrors:a}}get formErrors(){return this.flatten()}}Kt.create=t=>new Kt(t);const mi=(t,e)=>{let a;switch(t.code){case q.invalid_type:t.received===W.undefined?a="Required":a=`Expected ${t.expected}, received ${t.received}`;break;case q.invalid_literal:a=`Invalid literal value, expected ${JSON.stringify(t.expected,Se.jsonStringifyReplacer)}`;break;case q.unrecognized_keys:a=`Unrecognized key(s) in object: ${Se.joinValues(t.keys,", ")}`;break;case q.invalid_union:a="Invalid input";break;case q.invalid_union_discriminator:a=`Invalid discriminator value. Expected ${Se.joinValues(t.options)}`;break;case q.invalid_enum_value:a=`Invalid enum value. Expected ${Se.joinValues(t.options)}, received '${t.received}'`;break;case q.invalid_arguments:a="Invalid function arguments";break;case q.invalid_return_type:a="Invalid function return type";break;case q.invalid_date:a="Invalid date";break;case q.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(a=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(a=`${a} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?a=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?a=`Invalid input: must end with "${t.validation.endsWith}"`:Se.assertNever(t.validation):t.validation!=="regex"?a=`Invalid ${t.validation}`:a="Invalid";break;case q.too_small:t.type==="array"?a=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?a=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?a=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="bigint"?a=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?a=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:a="Invalid input";break;case q.too_big:t.type==="array"?a=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?a=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?a=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?a=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?a=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:a="Invalid input";break;case q.custom:a="Invalid input";break;case q.invalid_intersection_types:a="Intersection results could not be merged";break;case q.not_multiple_of:a=`Number must be a multiple of ${t.multipleOf}`;break;case q.not_finite:a="Number must be finite";break;default:a=e.defaultError,Se.assertNever(t)}return{message:a}};let lv=mi;function cv(){return lv}const uv=t=>{const{data:e,path:a,errorMaps:s,issueData:r}=t,n=[...a,...r.path||[]],i={...r,path:n};if(r.message!==void 0)return{...r,path:n,message:r.message};let o="";const c=s.filter(l=>!!l).slice().reverse();for(const l of c)o=l(i,{data:e,defaultError:o}).message;return{...r,path:n,message:o}};function J(t,e){const a=cv(),s=uv({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,a,a===mi?void 0:mi].filter(r=>!!r)});t.common.issues.push(s)}class it{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,a){const s=[];for(const r of a){if(r.status==="aborted")return oe;r.status==="dirty"&&e.dirty(),s.push(r.value)}return{status:e.value,value:s}}static async mergeObjectAsync(e,a){const s=[];for(const r of a){const n=await r.key,i=await r.value;s.push({key:n,value:i})}return it.mergeObjectSync(e,s)}static mergeObjectSync(e,a){const s={};for(const r of a){const{key:n,value:i}=r;if(n.status==="aborted"||i.status==="aborted")return oe;n.status==="dirty"&&e.dirty(),i.status==="dirty"&&e.dirty(),n.value!=="__proto__"&&(typeof i.value<"u"||r.alwaysSet)&&(s[n.value]=i.value)}return{status:e.value,value:s}}}const oe=Object.freeze({status:"aborted"}),ya=t=>({status:"dirty",value:t}),vt=t=>({status:"valid",value:t}),Ec=t=>t.status==="aborted",Pc=t=>t.status==="dirty",zr=t=>t.status==="valid",cs=t=>typeof Promise<"u"&&t instanceof Promise;var te;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(te||(te={}));class xt{constructor(e,a,s,r){this._cachedPath=[],this.parent=e,this.data=a,this._path=s,this._key=r}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 Sc=(t,e)=>{if(zr(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 a=new Kt(t.common.issues);return this._error=a,this._error}}};function me(t){if(!t)return{};const{errorMap:e,invalid_type_error:a,required_error:s,description:r}=t;if(e&&(a||s))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:r}:{errorMap:(i,o)=>{const{message:c}=t;return i.code==="invalid_enum_value"?{message:c??o.defaultError}:typeof o.data>"u"?{message:c??s??o.defaultError}:i.code!=="invalid_type"?{message:o.defaultError}:{message:c??a??o.defaultError}},description:r}}class $e{get description(){return this._def.description}_getType(e){return ir(e.data)}_getOrReturnCtx(e,a){return a||{common:e.parent.common,data:e.data,parsedType:ir(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new it,ctx:{common:e.parent.common,data:e.data,parsedType:ir(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const a=this._parse(e);if(cs(a))throw new Error("Synchronous parse encountered promise.");return a}_parseAsync(e){const a=this._parse(e);return Promise.resolve(a)}parse(e,a){const s=this.safeParse(e,a);if(s.success)return s.data;throw s.error}safeParse(e,a){const s={common:{issues:[],async:(a==null?void 0:a.async)??!1,contextualErrorMap:a==null?void 0:a.errorMap},path:(a==null?void 0:a.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:ir(e)},r=this._parseSync({data:e,path:s.path,parent:s});return Sc(s,r)}"~validate"(e){var s,r;const a={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:ir(e)};if(!this["~standard"].async)try{const n=this._parseSync({data:e,path:[],parent:a});return zr(n)?{value:n.value}:{issues:a.common.issues}}catch(n){(r=(s=n==null?void 0:n.message)==null?void 0:s.toLowerCase())!=null&&r.includes("encountered")&&(this["~standard"].async=!0),a.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:a}).then(n=>zr(n)?{value:n.value}:{issues:a.common.issues})}async parseAsync(e,a){const s=await this.safeParseAsync(e,a);if(s.success)return s.data;throw s.error}async safeParseAsync(e,a){const s={common:{issues:[],contextualErrorMap:a==null?void 0:a.errorMap,async:!0},path:(a==null?void 0:a.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:ir(e)},r=this._parse({data:e,path:s.path,parent:s}),n=await(cs(r)?r:Promise.resolve(r));return Sc(s,n)}refine(e,a){const s=r=>typeof a=="string"||typeof a>"u"?{message:a}:typeof a=="function"?a(r):a;return this._refinement((r,n)=>{const i=e(r),o=()=>n.addIssue({code:q.custom,...s(r)});return typeof Promise<"u"&&i instanceof Promise?i.then(c=>c?!0:(o(),!1)):i?!0:(o(),!1)})}refinement(e,a){return this._refinement((s,r)=>e(s)?!0:(r.addIssue(typeof a=="function"?a(s,r):a),!1))}_refinement(e){return new Er({schema:this,typeName:U.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:a=>this["~validate"](a)}}optional(){return Qt.create(this,this._def)}nullable(){return Pr.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Mt.create(this)}promise(){return ms.create(this,this._def)}or(e){return ds.create([this,e],this._def)}and(e){return fs.create(this,e,this._def)}transform(e){return new Er({...me(this._def),schema:this,typeName:U.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const a=typeof e=="function"?e:()=>e;return new vs({...me(this._def),innerType:this,defaultValue:a,typeName:U.ZodDefault})}brand(){return new Ac({typeName:U.ZodBranded,type:this,...me(this._def)})}catch(e){const a=typeof e=="function"?e:()=>e;return new gs({...me(this._def),innerType:this,catchValue:a,typeName:U.ZodCatch})}describe(e){const a=this.constructor;return new a({...this._def,description:e})}pipe(e){return Ri.create(this,e)}readonly(){return ys.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const dv=/^c[^\s-]{8,}$/i,fv=/^[0-9a-z]+$/,hv=/^[0-9A-HJKMNP-TV-Z]{26}$/i,pv=/^[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,mv=/^[a-z0-9_-]{21}$/i,vv=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,gv=/^[-+]?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)?)??$/,yv=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,_v="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let vi;const $v=/^(?:(?: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])$/,wv=/^(?:(?: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])$/,bv=/^(([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]))$/,Ev=/^(([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])$/,Pv=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Sv=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Rc="((\\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])))",Rv=new RegExp(`^${Rc}$`);function kc(t){let e="[0-5]\\d";t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`);const a=t.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${a}`}function kv(t){return new RegExp(`^${kc(t)}$`)}function Ov(t){let e=`${Rc}T${kc(t)}`;const a=[];return a.push(t.local?"Z?":"Z"),t.offset&&a.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${a.join("|")})`,new RegExp(`^${e}$`)}function Tv(t,e){return!!((e==="v4"||!e)&&$v.test(t)||(e==="v6"||!e)&&bv.test(t))}function Cv(t,e){if(!vv.test(t))return!1;try{const[a]=t.split(".");if(!a)return!1;const s=a.replace(/-/g,"+").replace(/_/g,"/").padEnd(a.length+(4-a.length%4)%4,"="),r=JSON.parse(atob(s));return!(typeof r!="object"||r===null||"typ"in r&&(r==null?void 0:r.typ)!=="JWT"||!r.alg||e&&r.alg!==e)}catch{return!1}}function Iv(t,e){return!!((e==="v4"||!e)&&wv.test(t)||(e==="v6"||!e)&&Ev.test(t))}class Bt extends $e{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==W.string){const n=this._getOrReturnCtx(e);return J(n,{code:q.invalid_type,expected:W.string,received:n.parsedType}),oe}const s=new it;let r;for(const n of this._def.checks)if(n.kind==="min")e.data.length<n.value&&(r=this._getOrReturnCtx(e,r),J(r,{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&&(r=this._getOrReturnCtx(e,r),J(r,{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)&&(r=this._getOrReturnCtx(e,r),i?J(r,{code:q.too_big,maximum:n.value,type:"string",inclusive:!0,exact:!0,message:n.message}):o&&J(r,{code:q.too_small,minimum:n.value,type:"string",inclusive:!0,exact:!0,message:n.message}),s.dirty())}else if(n.kind==="email")yv.test(e.data)||(r=this._getOrReturnCtx(e,r),J(r,{validation:"email",code:q.invalid_string,message:n.message}),s.dirty());else if(n.kind==="emoji")vi||(vi=new RegExp(_v,"u")),vi.test(e.data)||(r=this._getOrReturnCtx(e,r),J(r,{validation:"emoji",code:q.invalid_string,message:n.message}),s.dirty());else if(n.kind==="uuid")pv.test(e.data)||(r=this._getOrReturnCtx(e,r),J(r,{validation:"uuid",code:q.invalid_string,message:n.message}),s.dirty());else if(n.kind==="nanoid")mv.test(e.data)||(r=this._getOrReturnCtx(e,r),J(r,{validation:"nanoid",code:q.invalid_string,message:n.message}),s.dirty());else if(n.kind==="cuid")dv.test(e.data)||(r=this._getOrReturnCtx(e,r),J(r,{validation:"cuid",code:q.invalid_string,message:n.message}),s.dirty());else if(n.kind==="cuid2")fv.test(e.data)||(r=this._getOrReturnCtx(e,r),J(r,{validation:"cuid2",code:q.invalid_string,message:n.message}),s.dirty());else if(n.kind==="ulid")hv.test(e.data)||(r=this._getOrReturnCtx(e,r),J(r,{validation:"ulid",code:q.invalid_string,message:n.message}),s.dirty());else if(n.kind==="url")try{new URL(e.data)}catch{r=this._getOrReturnCtx(e,r),J(r,{validation:"url",code:q.invalid_string,message:n.message}),s.dirty()}else n.kind==="regex"?(n.regex.lastIndex=0,n.regex.test(e.data)||(r=this._getOrReturnCtx(e,r),J(r,{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)||(r=this._getOrReturnCtx(e,r),J(r,{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)||(r=this._getOrReturnCtx(e,r),J(r,{code:q.invalid_string,validation:{startsWith:n.value},message:n.message}),s.dirty()):n.kind==="endsWith"?e.data.endsWith(n.value)||(r=this._getOrReturnCtx(e,r),J(r,{code:q.invalid_string,validation:{endsWith:n.value},message:n.message}),s.dirty()):n.kind==="datetime"?Ov(n).test(e.data)||(r=this._getOrReturnCtx(e,r),J(r,{code:q.invalid_string,validation:"datetime",message:n.message}),s.dirty()):n.kind==="date"?Rv.test(e.data)||(r=this._getOrReturnCtx(e,r),J(r,{code:q.invalid_string,validation:"date",message:n.message}),s.dirty()):n.kind==="time"?kv(n).test(e.data)||(r=this._getOrReturnCtx(e,r),J(r,{code:q.invalid_string,validation:"time",message:n.message}),s.dirty()):n.kind==="duration"?gv.test(e.data)||(r=this._getOrReturnCtx(e,r),J(r,{validation:"duration",code:q.invalid_string,message:n.message}),s.dirty()):n.kind==="ip"?Tv(e.data,n.version)||(r=this._getOrReturnCtx(e,r),J(r,{validation:"ip",code:q.invalid_string,message:n.message}),s.dirty()):n.kind==="jwt"?Cv(e.data,n.alg)||(r=this._getOrReturnCtx(e,r),J(r,{validation:"jwt",code:q.invalid_string,message:n.message}),s.dirty()):n.kind==="cidr"?Iv(e.data,n.version)||(r=this._getOrReturnCtx(e,r),J(r,{validation:"cidr",code:q.invalid_string,message:n.message}),s.dirty()):n.kind==="base64"?Pv.test(e.data)||(r=this._getOrReturnCtx(e,r),J(r,{validation:"base64",code:q.invalid_string,message:n.message}),s.dirty()):n.kind==="base64url"?Sv.test(e.data)||(r=this._getOrReturnCtx(e,r),J(r,{validation:"base64url",code:q.invalid_string,message:n.message}),s.dirty()):Se.assertNever(n);return{status:s.value,value:e.data}}_regex(e,a,s){return this.refinement(r=>e.test(r),{validation:a,code:q.invalid_string,...te.errToObj(s)})}_addCheck(e){return new Bt({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...te.errToObj(e)})}url(e){return this._addCheck({kind:"url",...te.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...te.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...te.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...te.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...te.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...te.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...te.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...te.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...te.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...te.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...te.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...te.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,...te.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,...te.errToObj(e==null?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...te.errToObj(e)})}regex(e,a){return this._addCheck({kind:"regex",regex:e,...te.errToObj(a)})}includes(e,a){return this._addCheck({kind:"includes",value:e,position:a==null?void 0:a.position,...te.errToObj(a==null?void 0:a.message)})}startsWith(e,a){return this._addCheck({kind:"startsWith",value:e,...te.errToObj(a)})}endsWith(e,a){return this._addCheck({kind:"endsWith",value:e,...te.errToObj(a)})}min(e,a){return this._addCheck({kind:"min",value:e,...te.errToObj(a)})}max(e,a){return this._addCheck({kind:"max",value:e,...te.errToObj(a)})}length(e,a){return this._addCheck({kind:"length",value:e,...te.errToObj(a)})}nonempty(e){return this.min(1,te.errToObj(e))}trim(){return new Bt({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new Bt({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new Bt({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(const a of this._def.checks)a.kind==="min"&&(e===null||a.value>e)&&(e=a.value);return e}get maxLength(){let e=null;for(const a of this._def.checks)a.kind==="max"&&(e===null||a.value<e)&&(e=a.value);return e}}Bt.create=t=>new Bt({checks:[],typeName:U.ZodString,coerce:(t==null?void 0:t.coerce)??!1,...me(t)});function Nv(t,e){const a=(t.toString().split(".")[1]||"").length,s=(e.toString().split(".")[1]||"").length,r=a>s?a:s,n=Number.parseInt(t.toFixed(r).replace(".","")),i=Number.parseInt(e.toFixed(r).replace(".",""));return n%i/10**r}class Hr extends $e{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)!==W.number){const n=this._getOrReturnCtx(e);return J(n,{code:q.invalid_type,expected:W.number,received:n.parsedType}),oe}let s;const r=new it;for(const n of this._def.checks)n.kind==="int"?Se.isInteger(e.data)||(s=this._getOrReturnCtx(e,s),J(s,{code:q.invalid_type,expected:"integer",received:"float",message:n.message}),r.dirty()):n.kind==="min"?(n.inclusive?e.data<n.value:e.data<=n.value)&&(s=this._getOrReturnCtx(e,s),J(s,{code:q.too_small,minimum:n.value,type:"number",inclusive:n.inclusive,exact:!1,message:n.message}),r.dirty()):n.kind==="max"?(n.inclusive?e.data>n.value:e.data>=n.value)&&(s=this._getOrReturnCtx(e,s),J(s,{code:q.too_big,maximum:n.value,type:"number",inclusive:n.inclusive,exact:!1,message:n.message}),r.dirty()):n.kind==="multipleOf"?Nv(e.data,n.value)!==0&&(s=this._getOrReturnCtx(e,s),J(s,{code:q.not_multiple_of,multipleOf:n.value,message:n.message}),r.dirty()):n.kind==="finite"?Number.isFinite(e.data)||(s=this._getOrReturnCtx(e,s),J(s,{code:q.not_finite,message:n.message}),r.dirty()):Se.assertNever(n);return{status:r.value,value:e.data}}gte(e,a){return this.setLimit("min",e,!0,te.toString(a))}gt(e,a){return this.setLimit("min",e,!1,te.toString(a))}lte(e,a){return this.setLimit("max",e,!0,te.toString(a))}lt(e,a){return this.setLimit("max",e,!1,te.toString(a))}setLimit(e,a,s,r){return new Hr({...this._def,checks:[...this._def.checks,{kind:e,value:a,inclusive:s,message:te.toString(r)}]})}_addCheck(e){return new Hr({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:te.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:te.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:te.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:te.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:te.toString(e)})}multipleOf(e,a){return this._addCheck({kind:"multipleOf",value:e,message:te.toString(a)})}finite(e){return this._addCheck({kind:"finite",message:te.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:te.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:te.toString(e)})}get minValue(){let e=null;for(const a of this._def.checks)a.kind==="min"&&(e===null||a.value>e)&&(e=a.value);return e}get maxValue(){let e=null;for(const a of this._def.checks)a.kind==="max"&&(e===null||a.value<e)&&(e=a.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&Se.isInteger(e.value))}get isFinite(){let e=null,a=null;for(const s of this._def.checks){if(s.kind==="finite"||s.kind==="int"||s.kind==="multipleOf")return!0;s.kind==="min"?(a===null||s.value>a)&&(a=s.value):s.kind==="max"&&(e===null||s.value<e)&&(e=s.value)}return Number.isFinite(a)&&Number.isFinite(e)}}Hr.create=t=>new Hr({checks:[],typeName:U.ZodNumber,coerce:(t==null?void 0:t.coerce)||!1,...me(t)});class _a extends $e{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)!==W.bigint)return this._getInvalidInput(e);let s;const r=new it;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),J(s,{code:q.too_small,type:"bigint",minimum:n.value,inclusive:n.inclusive,message:n.message}),r.dirty()):n.kind==="max"?(n.inclusive?e.data>n.value:e.data>=n.value)&&(s=this._getOrReturnCtx(e,s),J(s,{code:q.too_big,type:"bigint",maximum:n.value,inclusive:n.inclusive,message:n.message}),r.dirty()):n.kind==="multipleOf"?e.data%n.value!==BigInt(0)&&(s=this._getOrReturnCtx(e,s),J(s,{code:q.not_multiple_of,multipleOf:n.value,message:n.message}),r.dirty()):Se.assertNever(n);return{status:r.value,value:e.data}}_getInvalidInput(e){const a=this._getOrReturnCtx(e);return J(a,{code:q.invalid_type,expected:W.bigint,received:a.parsedType}),oe}gte(e,a){return this.setLimit("min",e,!0,te.toString(a))}gt(e,a){return this.setLimit("min",e,!1,te.toString(a))}lte(e,a){return this.setLimit("max",e,!0,te.toString(a))}lt(e,a){return this.setLimit("max",e,!1,te.toString(a))}setLimit(e,a,s,r){return new _a({...this._def,checks:[...this._def.checks,{kind:e,value:a,inclusive:s,message:te.toString(r)}]})}_addCheck(e){return new _a({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:te.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:te.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:te.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:te.toString(e)})}multipleOf(e,a){return this._addCheck({kind:"multipleOf",value:e,message:te.toString(a)})}get minValue(){let e=null;for(const a of this._def.checks)a.kind==="min"&&(e===null||a.value>e)&&(e=a.value);return e}get maxValue(){let e=null;for(const a of this._def.checks)a.kind==="max"&&(e===null||a.value<e)&&(e=a.value);return e}}_a.create=t=>new _a({checks:[],typeName:U.ZodBigInt,coerce:(t==null?void 0:t.coerce)??!1,...me(t)});class gi extends $e{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==W.boolean){const s=this._getOrReturnCtx(e);return J(s,{code:q.invalid_type,expected:W.boolean,received:s.parsedType}),oe}return vt(e.data)}}gi.create=t=>new gi({typeName:U.ZodBoolean,coerce:(t==null?void 0:t.coerce)||!1,...me(t)});class us extends $e{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==W.date){const n=this._getOrReturnCtx(e);return J(n,{code:q.invalid_type,expected:W.date,received:n.parsedType}),oe}if(Number.isNaN(e.data.getTime())){const n=this._getOrReturnCtx(e);return J(n,{code:q.invalid_date}),oe}const s=new it;let r;for(const n of this._def.checks)n.kind==="min"?e.data.getTime()<n.value&&(r=this._getOrReturnCtx(e,r),J(r,{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&&(r=this._getOrReturnCtx(e,r),J(r,{code:q.too_big,message:n.message,inclusive:!0,exact:!1,maximum:n.value,type:"date"}),s.dirty()):Se.assertNever(n);return{status:s.value,value:new Date(e.data.getTime())}}_addCheck(e){return new us({...this._def,checks:[...this._def.checks,e]})}min(e,a){return this._addCheck({kind:"min",value:e.getTime(),message:te.toString(a)})}max(e,a){return this._addCheck({kind:"max",value:e.getTime(),message:te.toString(a)})}get minDate(){let e=null;for(const a of this._def.checks)a.kind==="min"&&(e===null||a.value>e)&&(e=a.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(const a of this._def.checks)a.kind==="max"&&(e===null||a.value<e)&&(e=a.value);return e!=null?new Date(e):null}}us.create=t=>new us({checks:[],coerce:(t==null?void 0:t.coerce)||!1,typeName:U.ZodDate,...me(t)});class Oc extends $e{_parse(e){if(this._getType(e)!==W.symbol){const s=this._getOrReturnCtx(e);return J(s,{code:q.invalid_type,expected:W.symbol,received:s.parsedType}),oe}return vt(e.data)}}Oc.create=t=>new Oc({typeName:U.ZodSymbol,...me(t)});class yi extends $e{_parse(e){if(this._getType(e)!==W.undefined){const s=this._getOrReturnCtx(e);return J(s,{code:q.invalid_type,expected:W.undefined,received:s.parsedType}),oe}return vt(e.data)}}yi.create=t=>new yi({typeName:U.ZodUndefined,...me(t)});class _i extends $e{_parse(e){if(this._getType(e)!==W.null){const s=this._getOrReturnCtx(e);return J(s,{code:q.invalid_type,expected:W.null,received:s.parsedType}),oe}return vt(e.data)}}_i.create=t=>new _i({typeName:U.ZodNull,...me(t)});class $i extends $e{constructor(){super(...arguments),this._any=!0}_parse(e){return vt(e.data)}}$i.create=t=>new $i({typeName:U.ZodAny,...me(t)});class wi extends $e{constructor(){super(...arguments),this._unknown=!0}_parse(e){return vt(e.data)}}wi.create=t=>new wi({typeName:U.ZodUnknown,...me(t)});class or extends $e{_parse(e){const a=this._getOrReturnCtx(e);return J(a,{code:q.invalid_type,expected:W.never,received:a.parsedType}),oe}}or.create=t=>new or({typeName:U.ZodNever,...me(t)});class Tc extends $e{_parse(e){if(this._getType(e)!==W.undefined){const s=this._getOrReturnCtx(e);return J(s,{code:q.invalid_type,expected:W.void,received:s.parsedType}),oe}return vt(e.data)}}Tc.create=t=>new Tc({typeName:U.ZodVoid,...me(t)});class Mt extends $e{_parse(e){const{ctx:a,status:s}=this._processInputParams(e),r=this._def;if(a.parsedType!==W.array)return J(a,{code:q.invalid_type,expected:W.array,received:a.parsedType}),oe;if(r.exactLength!==null){const i=a.data.length>r.exactLength.value,o=a.data.length<r.exactLength.value;(i||o)&&(J(a,{code:i?q.too_big:q.too_small,minimum:o?r.exactLength.value:void 0,maximum:i?r.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:r.exactLength.message}),s.dirty())}if(r.minLength!==null&&a.data.length<r.minLength.value&&(J(a,{code:q.too_small,minimum:r.minLength.value,type:"array",inclusive:!0,exact:!1,message:r.minLength.message}),s.dirty()),r.maxLength!==null&&a.data.length>r.maxLength.value&&(J(a,{code:q.too_big,maximum:r.maxLength.value,type:"array",inclusive:!0,exact:!1,message:r.maxLength.message}),s.dirty()),a.common.async)return Promise.all([...a.data].map((i,o)=>r.type._parseAsync(new xt(a,i,a.path,o)))).then(i=>it.mergeArray(s,i));const n=[...a.data].map((i,o)=>r.type._parseSync(new xt(a,i,a.path,o)));return it.mergeArray(s,n)}get element(){return this._def.type}min(e,a){return new Mt({...this._def,minLength:{value:e,message:te.toString(a)}})}max(e,a){return new Mt({...this._def,maxLength:{value:e,message:te.toString(a)}})}length(e,a){return new Mt({...this._def,exactLength:{value:e,message:te.toString(a)}})}nonempty(e){return this.min(1,e)}}Mt.create=(t,e)=>new Mt({type:t,minLength:null,maxLength:null,exactLength:null,typeName:U.ZodArray,...me(e)});function Zr(t){if(t instanceof Ze){const e={};for(const a in t.shape){const s=t.shape[a];e[a]=Qt.create(Zr(s))}return new Ze({...t._def,shape:()=>e})}else return t instanceof Mt?new Mt({...t._def,type:Zr(t.element)}):t instanceof Qt?Qt.create(Zr(t.unwrap())):t instanceof Pr?Pr.create(Zr(t.unwrap())):t instanceof wr?wr.create(t.items.map(e=>Zr(e))):t}class Ze extends $e{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(),a=Se.objectKeys(e);return this._cached={shape:e,keys:a},this._cached}_parse(e){if(this._getType(e)!==W.object){const l=this._getOrReturnCtx(e);return J(l,{code:q.invalid_type,expected:W.object,received:l.parsedType}),oe}const{status:s,ctx:r}=this._processInputParams(e),{shape:n,keys:i}=this._getCached(),o=[];if(!(this._def.catchall instanceof or&&this._def.unknownKeys==="strip"))for(const l in r.data)i.includes(l)||o.push(l);const c=[];for(const l of i){const u=n[l],f=r.data[l];c.push({key:{status:"valid",value:l},value:u._parse(new xt(r,f,r.path,l)),alwaysSet:l in r.data})}if(this._def.catchall instanceof or){const l=this._def.unknownKeys;if(l==="passthrough")for(const u of o)c.push({key:{status:"valid",value:u},value:{status:"valid",value:r.data[u]}});else if(l==="strict")o.length>0&&(J(r,{code:q.unrecognized_keys,keys:o}),s.dirty());else if(l!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const l=this._def.catchall;for(const u of o){const f=r.data[u];c.push({key:{status:"valid",value:u},value:l._parse(new xt(r,f,r.path,u)),alwaysSet:u in r.data})}}return r.common.async?Promise.resolve().then(async()=>{const l=[];for(const u of c){const f=await u.key,y=await u.value;l.push({key:f,value:y,alwaysSet:u.alwaysSet})}return l}).then(l=>it.mergeObjectSync(s,l)):it.mergeObjectSync(s,c)}get shape(){return this._def.shape()}strict(e){return te.errToObj,new Ze({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(a,s)=>{var n,i;const r=((i=(n=this._def).errorMap)==null?void 0:i.call(n,a,s).message)??s.defaultError;return a.code==="unrecognized_keys"?{message:te.errToObj(e).message??r}:{message:r}}}:{}})}strip(){return new Ze({...this._def,unknownKeys:"strip"})}passthrough(){return new Ze({...this._def,unknownKeys:"passthrough"})}extend(e){return new Ze({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new Ze({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:U.ZodObject})}setKey(e,a){return this.augment({[e]:a})}catchall(e){return new Ze({...this._def,catchall:e})}pick(e){const a={};for(const s of Se.objectKeys(e))e[s]&&this.shape[s]&&(a[s]=this.shape[s]);return new Ze({...this._def,shape:()=>a})}omit(e){const a={};for(const s of Se.objectKeys(this.shape))e[s]||(a[s]=this.shape[s]);return new Ze({...this._def,shape:()=>a})}deepPartial(){return Zr(this)}partial(e){const a={};for(const s of Se.objectKeys(this.shape)){const r=this.shape[s];e&&!e[s]?a[s]=r:a[s]=r.optional()}return new Ze({...this._def,shape:()=>a})}required(e){const a={};for(const s of Se.objectKeys(this.shape))if(e&&!e[s])a[s]=this.shape[s];else{let n=this.shape[s];for(;n instanceof Qt;)n=n._def.innerType;a[s]=n}return new Ze({...this._def,shape:()=>a})}keyof(){return Ic(Se.objectKeys(this.shape))}}Ze.create=(t,e)=>new Ze({shape:()=>t,unknownKeys:"strip",catchall:or.create(),typeName:U.ZodObject,...me(e)}),Ze.strictCreate=(t,e)=>new Ze({shape:()=>t,unknownKeys:"strict",catchall:or.create(),typeName:U.ZodObject,...me(e)}),Ze.lazycreate=(t,e)=>new Ze({shape:t,unknownKeys:"strip",catchall:or.create(),typeName:U.ZodObject,...me(e)});class ds extends $e{_parse(e){const{ctx:a}=this._processInputParams(e),s=this._def.options;function r(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 a.common.issues.push(...o.ctx.common.issues),o.result;const i=n.map(o=>new Kt(o.ctx.common.issues));return J(a,{code:q.invalid_union,unionErrors:i}),oe}if(a.common.async)return Promise.all(s.map(async n=>{const i={...a,common:{...a.common,issues:[]},parent:null};return{result:await n._parseAsync({data:a.data,path:a.path,parent:i}),ctx:i}})).then(r);{let n;const i=[];for(const c of s){const l={...a,common:{...a.common,issues:[]},parent:null},u=c._parseSync({data:a.data,path:a.path,parent:l});if(u.status==="valid")return u;u.status==="dirty"&&!n&&(n={result:u,ctx:l}),l.common.issues.length&&i.push(l.common.issues)}if(n)return a.common.issues.push(...n.ctx.common.issues),n.result;const o=i.map(c=>new Kt(c));return J(a,{code:q.invalid_union,unionErrors:o}),oe}}get options(){return this._def.options}}ds.create=(t,e)=>new ds({options:t,typeName:U.ZodUnion,...me(e)});const Jt=t=>t instanceof Pi?Jt(t.schema):t instanceof Er?Jt(t.innerType()):t instanceof ps?[t.value]:t instanceof br?t.options:t instanceof Si?Se.objectValues(t.enum):t instanceof vs?Jt(t._def.innerType):t instanceof yi?[void 0]:t instanceof _i?[null]:t instanceof Qt?[void 0,...Jt(t.unwrap())]:t instanceof Pr?[null,...Jt(t.unwrap())]:t instanceof Ac||t instanceof ys?Jt(t.unwrap()):t instanceof gs?Jt(t._def.innerType):[];class bi extends $e{_parse(e){const{ctx:a}=this._processInputParams(e);if(a.parsedType!==W.object)return J(a,{code:q.invalid_type,expected:W.object,received:a.parsedType}),oe;const s=this.discriminator,r=a.data[s],n=this.optionsMap.get(r);return n?a.common.async?n._parseAsync({data:a.data,path:a.path,parent:a}):n._parseSync({data:a.data,path:a.path,parent:a}):(J(a,{code:q.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[s]}),oe)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,a,s){const r=new Map;for(const n of a){const i=Jt(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(r.has(o))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(o)}`);r.set(o,n)}}return new bi({typeName:U.ZodDiscriminatedUnion,discriminator:e,options:a,optionsMap:r,...me(s)})}}function Ei(t,e){const a=ir(t),s=ir(e);if(t===e)return{valid:!0,data:t};if(a===W.object&&s===W.object){const r=Se.objectKeys(e),n=Se.objectKeys(t).filter(o=>r.indexOf(o)!==-1),i={...t,...e};for(const o of n){const c=Ei(t[o],e[o]);if(!c.valid)return{valid:!1};i[o]=c.data}return{valid:!0,data:i}}else if(a===W.array&&s===W.array){if(t.length!==e.length)return{valid:!1};const r=[];for(let n=0;n<t.length;n++){const i=t[n],o=e[n],c=Ei(i,o);if(!c.valid)return{valid:!1};r.push(c.data)}return{valid:!0,data:r}}else return a===W.date&&s===W.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}class fs extends $e{_parse(e){const{status:a,ctx:s}=this._processInputParams(e),r=(n,i)=>{if(Ec(n)||Ec(i))return oe;const o=Ei(n.value,i.value);return o.valid?((Pc(n)||Pc(i))&&a.dirty(),{status:a.value,value:o.data}):(J(s,{code:q.invalid_intersection_types}),oe)};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])=>r(n,i)):r(this._def.left._parseSync({data:s.data,path:s.path,parent:s}),this._def.right._parseSync({data:s.data,path:s.path,parent:s}))}}fs.create=(t,e,a)=>new fs({left:t,right:e,typeName:U.ZodIntersection,...me(a)});class wr extends $e{_parse(e){const{status:a,ctx:s}=this._processInputParams(e);if(s.parsedType!==W.array)return J(s,{code:q.invalid_type,expected:W.array,received:s.parsedType}),oe;if(s.data.length<this._def.items.length)return J(s,{code:q.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),oe;!this._def.rest&&s.data.length>this._def.items.length&&(J(s,{code:q.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),a.dirty());const n=[...s.data].map((i,o)=>{const c=this._def.items[o]||this._def.rest;return c?c._parse(new xt(s,i,s.path,o)):null}).filter(i=>!!i);return s.common.async?Promise.all(n).then(i=>it.mergeArray(a,i)):it.mergeArray(a,n)}get items(){return this._def.items}rest(e){return new wr({...this._def,rest:e})}}wr.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new wr({items:t,typeName:U.ZodTuple,rest:null,...me(e)})};class hs extends $e{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:a,ctx:s}=this._processInputParams(e);if(s.parsedType!==W.object)return J(s,{code:q.invalid_type,expected:W.object,received:s.parsedType}),oe;const r=[],n=this._def.keyType,i=this._def.valueType;for(const o in s.data)r.push({key:n._parse(new xt(s,o,s.path,o)),value:i._parse(new xt(s,s.data[o],s.path,o)),alwaysSet:o in s.data});return s.common.async?it.mergeObjectAsync(a,r):it.mergeObjectSync(a,r)}get element(){return this._def.valueType}static create(e,a,s){return a instanceof $e?new hs({keyType:e,valueType:a,typeName:U.ZodRecord,...me(s)}):new hs({keyType:Bt.create(),valueType:e,typeName:U.ZodRecord,...me(a)})}}class Cc extends $e{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:a,ctx:s}=this._processInputParams(e);if(s.parsedType!==W.map)return J(s,{code:q.invalid_type,expected:W.map,received:s.parsedType}),oe;const r=this._def.keyType,n=this._def.valueType,i=[...s.data.entries()].map(([o,c],l)=>({key:r._parse(new xt(s,o,s.path,[l,"key"])),value:n._parse(new xt(s,c,s.path,[l,"value"]))}));if(s.common.async){const o=new Map;return Promise.resolve().then(async()=>{for(const c of i){const l=await c.key,u=await c.value;if(l.status==="aborted"||u.status==="aborted")return oe;(l.status==="dirty"||u.status==="dirty")&&a.dirty(),o.set(l.value,u.value)}return{status:a.value,value:o}})}else{const o=new Map;for(const c of i){const l=c.key,u=c.value;if(l.status==="aborted"||u.status==="aborted")return oe;(l.status==="dirty"||u.status==="dirty")&&a.dirty(),o.set(l.value,u.value)}return{status:a.value,value:o}}}}Cc.create=(t,e,a)=>new Cc({valueType:e,keyType:t,typeName:U.ZodMap,...me(a)});class $a extends $e{_parse(e){const{status:a,ctx:s}=this._processInputParams(e);if(s.parsedType!==W.set)return J(s,{code:q.invalid_type,expected:W.set,received:s.parsedType}),oe;const r=this._def;r.minSize!==null&&s.data.size<r.minSize.value&&(J(s,{code:q.too_small,minimum:r.minSize.value,type:"set",inclusive:!0,exact:!1,message:r.minSize.message}),a.dirty()),r.maxSize!==null&&s.data.size>r.maxSize.value&&(J(s,{code:q.too_big,maximum:r.maxSize.value,type:"set",inclusive:!0,exact:!1,message:r.maxSize.message}),a.dirty());const n=this._def.valueType;function i(c){const l=new Set;for(const u of c){if(u.status==="aborted")return oe;u.status==="dirty"&&a.dirty(),l.add(u.value)}return{status:a.value,value:l}}const o=[...s.data.values()].map((c,l)=>n._parse(new xt(s,c,s.path,l)));return s.common.async?Promise.all(o).then(c=>i(c)):i(o)}min(e,a){return new $a({...this._def,minSize:{value:e,message:te.toString(a)}})}max(e,a){return new $a({...this._def,maxSize:{value:e,message:te.toString(a)}})}size(e,a){return this.min(e,a).max(e,a)}nonempty(e){return this.min(1,e)}}$a.create=(t,e)=>new $a({valueType:t,minSize:null,maxSize:null,typeName:U.ZodSet,...me(e)});class Pi extends $e{get schema(){return this._def.getter()}_parse(e){const{ctx:a}=this._processInputParams(e);return this._def.getter()._parse({data:a.data,path:a.path,parent:a})}}Pi.create=(t,e)=>new Pi({getter:t,typeName:U.ZodLazy,...me(e)});class ps extends $e{_parse(e){if(e.data!==this._def.value){const a=this._getOrReturnCtx(e);return J(a,{received:a.data,code:q.invalid_literal,expected:this._def.value}),oe}return{status:"valid",value:e.data}}get value(){return this._def.value}}ps.create=(t,e)=>new ps({value:t,typeName:U.ZodLiteral,...me(e)});function Ic(t,e){return new br({values:t,typeName:U.ZodEnum,...me(e)})}class br extends $e{_parse(e){if(typeof e.data!="string"){const a=this._getOrReturnCtx(e),s=this._def.values;return J(a,{expected:Se.joinValues(s),received:a.parsedType,code:q.invalid_type}),oe}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){const a=this._getOrReturnCtx(e),s=this._def.values;return J(a,{received:a.data,code:q.invalid_enum_value,options:s}),oe}return vt(e.data)}get options(){return this._def.values}get enum(){const e={};for(const a of this._def.values)e[a]=a;return e}get Values(){const e={};for(const a of this._def.values)e[a]=a;return e}get Enum(){const e={};for(const a of this._def.values)e[a]=a;return e}extract(e,a=this._def){return br.create(e,{...this._def,...a})}exclude(e,a=this._def){return br.create(this.options.filter(s=>!e.includes(s)),{...this._def,...a})}}br.create=Ic;class Si extends $e{_parse(e){const a=Se.getValidEnumValues(this._def.values),s=this._getOrReturnCtx(e);if(s.parsedType!==W.string&&s.parsedType!==W.number){const r=Se.objectValues(a);return J(s,{expected:Se.joinValues(r),received:s.parsedType,code:q.invalid_type}),oe}if(this._cache||(this._cache=new Set(Se.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){const r=Se.objectValues(a);return J(s,{received:s.data,code:q.invalid_enum_value,options:r}),oe}return vt(e.data)}get enum(){return this._def.values}}Si.create=(t,e)=>new Si({values:t,typeName:U.ZodNativeEnum,...me(e)});class ms extends $e{unwrap(){return this._def.type}_parse(e){const{ctx:a}=this._processInputParams(e);if(a.parsedType!==W.promise&&a.common.async===!1)return J(a,{code:q.invalid_type,expected:W.promise,received:a.parsedType}),oe;const s=a.parsedType===W.promise?a.data:Promise.resolve(a.data);return vt(s.then(r=>this._def.type.parseAsync(r,{path:a.path,errorMap:a.common.contextualErrorMap})))}}ms.create=(t,e)=>new ms({type:t,typeName:U.ZodPromise,...me(e)});class Er extends $e{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===U.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:a,ctx:s}=this._processInputParams(e),r=this._def.effect||null,n={addIssue:i=>{J(s,i),i.fatal?a.abort():a.dirty()},get path(){return s.path}};if(n.addIssue=n.addIssue.bind(n),r.type==="preprocess"){const i=r.transform(s.data,n);if(s.common.async)return Promise.resolve(i).then(async o=>{if(a.value==="aborted")return oe;const c=await this._def.schema._parseAsync({data:o,path:s.path,parent:s});return c.status==="aborted"?oe:c.status==="dirty"||a.value==="dirty"?ya(c.value):c});{if(a.value==="aborted")return oe;const o=this._def.schema._parseSync({data:i,path:s.path,parent:s});return o.status==="aborted"?oe:o.status==="dirty"||a.value==="dirty"?ya(o.value):o}}if(r.type==="refinement"){const i=o=>{const c=r.refinement(o,n);if(s.common.async)return Promise.resolve(c);if(c instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return o};if(s.common.async===!1){const o=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});return o.status==="aborted"?oe:(o.status==="dirty"&&a.dirty(),i(o.value),{status:a.value,value:o.value})}else return this._def.schema._parseAsync({data:s.data,path:s.path,parent:s}).then(o=>o.status==="aborted"?oe:(o.status==="dirty"&&a.dirty(),i(o.value).then(()=>({status:a.value,value:o.value}))))}if(r.type==="transform")if(s.common.async===!1){const i=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});if(!zr(i))return oe;const o=r.transform(i.value,n);if(o instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:a.value,value:o}}else return this._def.schema._parseAsync({data:s.data,path:s.path,parent:s}).then(i=>zr(i)?Promise.resolve(r.transform(i.value,n)).then(o=>({status:a.value,value:o})):oe);Se.assertNever(r)}}Er.create=(t,e,a)=>new Er({schema:t,typeName:U.ZodEffects,effect:e,...me(a)}),Er.createWithPreprocess=(t,e,a)=>new Er({schema:e,effect:{type:"preprocess",transform:t},typeName:U.ZodEffects,...me(a)});class Qt extends $e{_parse(e){return this._getType(e)===W.undefined?vt(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Qt.create=(t,e)=>new Qt({innerType:t,typeName:U.ZodOptional,...me(e)});class Pr extends $e{_parse(e){return this._getType(e)===W.null?vt(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Pr.create=(t,e)=>new Pr({innerType:t,typeName:U.ZodNullable,...me(e)});class vs extends $e{_parse(e){const{ctx:a}=this._processInputParams(e);let s=a.data;return a.parsedType===W.undefined&&(s=this._def.defaultValue()),this._def.innerType._parse({data:s,path:a.path,parent:a})}removeDefault(){return this._def.innerType}}vs.create=(t,e)=>new vs({innerType:t,typeName:U.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...me(e)});class gs extends $e{_parse(e){const{ctx:a}=this._processInputParams(e),s={...a,common:{...a.common,issues:[]}},r=this._def.innerType._parse({data:s.data,path:s.path,parent:{...s}});return cs(r)?r.then(n=>({status:"valid",value:n.status==="valid"?n.value:this._def.catchValue({get error(){return new Kt(s.common.issues)},input:s.data})})):{status:"valid",value:r.status==="valid"?r.value:this._def.catchValue({get error(){return new Kt(s.common.issues)},input:s.data})}}removeCatch(){return this._def.innerType}}gs.create=(t,e)=>new gs({innerType:t,typeName:U.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...me(e)});class Nc extends $e{_parse(e){if(this._getType(e)!==W.nan){const s=this._getOrReturnCtx(e);return J(s,{code:q.invalid_type,expected:W.nan,received:s.parsedType}),oe}return{status:"valid",value:e.data}}}Nc.create=t=>new Nc({typeName:U.ZodNaN,...me(t)});class Ac extends $e{_parse(e){const{ctx:a}=this._processInputParams(e),s=a.data;return this._def.type._parse({data:s,path:a.path,parent:a})}unwrap(){return this._def.type}}class Ri extends $e{_parse(e){const{status:a,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"?oe:n.status==="dirty"?(a.dirty(),ya(n.value)):this._def.out._parseAsync({data:n.value,path:s.path,parent:s})})();{const r=this._def.in._parseSync({data:s.data,path:s.path,parent:s});return r.status==="aborted"?oe:r.status==="dirty"?(a.dirty(),{status:"dirty",value:r.value}):this._def.out._parseSync({data:r.value,path:s.path,parent:s})}}static create(e,a){return new Ri({in:e,out:a,typeName:U.ZodPipeline})}}class ys extends $e{_parse(e){const a=this._def.innerType._parse(e),s=r=>(zr(r)&&(r.value=Object.freeze(r.value)),r);return cs(a)?a.then(r=>s(r)):s(a)}unwrap(){return this._def.innerType}}ys.create=(t,e)=>new ys({innerType:t,typeName:U.ZodReadonly,...me(e)});var U;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(U||(U={}));const C=Bt.create,We=Hr.create,Qe=gi.create,Av=$i.create,wa=wi.create;or.create;const X=Mt.create,H=Ze.create,ot=ds.create,jv=bi.create;fs.create,wr.create;const ba=hs.create,ue=ps.create,Gt=br.create;ms.create;const L=Qt.create;Pr.create;const Dv=oe,Sr="2025-06-18",xv="2025-03-26",ki=[Sr,"2025-03-26","2024-11-05","2024-10-07"],Ea="2.0",Oi=ot([C(),We().int()]),Ti=C(),Mv=H({progressToken:L(Oi)}).passthrough(),gt=H({_meta:L(Mv)}).passthrough(),lt=H({method:C(),params:L(gt)}),Pa=H({_meta:L(H({}).passthrough())}).passthrough(),Rt=H({method:C(),params:L(Pa)}),pt=H({_meta:L(H({}).passthrough())}).passthrough(),Sa=ot([C(),We().int()]),Ci=H({jsonrpc:ue(Ea),id:Sa}).merge(lt).strict(),Ii=t=>Ci.safeParse(t).success,Ni=H({jsonrpc:ue(Ea)}).merge(Rt).strict(),jc=t=>Ni.safeParse(t).success,Ai=H({jsonrpc:ue(Ea),id:Sa,result:pt}).strict(),_s=t=>Ai.safeParse(t).success;R.ErrorCode=void 0,function(t){t[t.ConnectionClosed=-32e3]="ConnectionClosed",t[t.RequestTimeout=-32001]="RequestTimeout",t[t.ParseError=-32700]="ParseError",t[t.InvalidRequest=-32600]="InvalidRequest",t[t.MethodNotFound=-32601]="MethodNotFound",t[t.InvalidParams=-32602]="InvalidParams",t[t.InternalError=-32603]="InternalError"}(R.ErrorCode||(R.ErrorCode={}));const ji=H({jsonrpc:ue(Ea),id:Sa,error:H({code:We().int(),message:C(),data:L(wa())})}).strict(),Dc=t=>ji.safeParse(t).success,Ra=ot([Ci,Ni,Ai,ji]),lr=pt.strict(),$s=Rt.extend({method:ue("notifications/cancelled"),params:Pa.extend({requestId:Sa,reason:C().optional()})}),xc=H({src:C(),mimeType:L(C()),sizes:L(X(C()))}).passthrough(),Kr=H({icons:X(xc).optional()}).passthrough(),Br=H({name:C(),title:L(C())}).passthrough(),Di=Br.extend({version:C(),websiteUrl:L(C())}).merge(Kr),Mc=H({experimental:L(H({}).passthrough()),sampling:L(H({}).passthrough()),elicitation:L(H({}).passthrough()),roots:L(H({listChanged:L(Qe())}).passthrough())}).passthrough(),ws=lt.extend({method:ue("initialize"),params:gt.extend({protocolVersion:C(),capabilities:Mc,clientInfo:Di})}),Lv=t=>ws.safeParse(t).success,Lc=H({experimental:L(H({}).passthrough()),logging:L(H({}).passthrough()),completions:L(H({}).passthrough()),prompts:L(H({listChanged:L(Qe())}).passthrough()),resources:L(H({subscribe:L(Qe()),listChanged:L(Qe())}).passthrough()),tools:L(H({listChanged:L(Qe())}).passthrough())}).passthrough(),xi=pt.extend({protocolVersion:C(),capabilities:Lc,serverInfo:Di,instructions:L(C())}),bs=Rt.extend({method:ue("notifications/initialized")}),Fc=t=>bs.safeParse(t).success,Es=lt.extend({method:ue("ping")}),qc=H({progress:We(),total:L(We()),message:L(C())}).passthrough(),Ps=Rt.extend({method:ue("notifications/progress"),params:Pa.merge(qc).extend({progressToken:Oi})}),ka=lt.extend({params:gt.extend({cursor:L(Ti)}).optional()}),Oa=pt.extend({nextCursor:L(Ti)}),Mi=H({uri:C(),mimeType:L(C()),_meta:L(H({}).passthrough())}).passthrough(),Li=Mi.extend({text:C()}),Fi=C().refine(t=>{try{return atob(t),!0}catch{return!1}},{message:"Invalid Base64 string"}),qi=Mi.extend({blob:Fi}),Ui=Br.extend({uri:C(),description:L(C()),mimeType:L(C()),_meta:L(H({}).passthrough())}).merge(Kr),Uc=Br.extend({uriTemplate:C(),description:L(C()),mimeType:L(C()),_meta:L(H({}).passthrough())}).merge(Kr),Ss=ka.extend({method:ue("resources/list")}),Vi=Oa.extend({resources:X(Ui)}),Rs=ka.extend({method:ue("resources/templates/list")}),zi=Oa.extend({resourceTemplates:X(Uc)}),ks=lt.extend({method:ue("resources/read"),params:gt.extend({uri:C()})}),Hi=pt.extend({contents:X(ot([Li,qi]))}),Vc=Rt.extend({method:ue("notifications/resources/list_changed")}),zc=lt.extend({method:ue("resources/subscribe"),params:gt.extend({uri:C()})}),Hc=lt.extend({method:ue("resources/unsubscribe"),params:gt.extend({uri:C()})}),Zc=Rt.extend({method:ue("notifications/resources/updated"),params:Pa.extend({uri:C()})}),Kc=H({name:C(),description:L(C()),required:L(Qe())}).passthrough(),Bc=Br.extend({description:L(C()),arguments:L(X(Kc)),_meta:L(H({}).passthrough())}).merge(Kr),Os=ka.extend({method:ue("prompts/list")}),Zi=Oa.extend({prompts:X(Bc)}),Ts=lt.extend({method:ue("prompts/get"),params:gt.extend({name:C(),arguments:L(ba(C()))})}),Cs=H({type:ue("text"),text:C(),_meta:L(H({}).passthrough())}).passthrough(),Is=H({type:ue("image"),data:Fi,mimeType:C(),_meta:L(H({}).passthrough())}).passthrough(),Ns=H({type:ue("audio"),data:Fi,mimeType:C(),_meta:L(H({}).passthrough())}).passthrough(),Jc=H({type:ue("resource"),resource:ot([Li,qi]),_meta:L(H({}).passthrough())}).passthrough(),Qc=Ui.extend({type:ue("resource_link")}),Ki=ot([Cs,Is,Ns,Qc,Jc]),Gc=H({role:Gt(["user","assistant"]),content:Ki}).passthrough(),Bi=pt.extend({description:L(C()),messages:X(Gc)}),Wc=Rt.extend({method:ue("notifications/prompts/list_changed")}),Yc=H({title:L(C()),readOnlyHint:L(Qe()),destructiveHint:L(Qe()),idempotentHint:L(Qe()),openWorldHint:L(Qe())}).passthrough(),Xc=Br.extend({description:L(C()),inputSchema:H({type:ue("object"),properties:L(H({}).passthrough()),required:L(X(C()))}).passthrough(),outputSchema:L(H({type:ue("object"),properties:L(H({}).passthrough()),required:L(X(C()))}).passthrough()),annotations:L(Yc),_meta:L(H({}).passthrough())}).merge(Kr),As=ka.extend({method:ue("tools/list")}),Ji=Oa.extend({tools:X(Xc)}),js=pt.extend({content:X(Ki).default([]),structuredContent:H({}).passthrough().optional(),isError:L(Qe())}),Fv=js.or(pt.extend({toolResult:wa()})),Ds=lt.extend({method:ue("tools/call"),params:gt.extend({name:C(),arguments:L(ba(wa()))})}),eu=Rt.extend({method:ue("notifications/tools/list_changed")}),Ta=Gt(["debug","info","notice","warning","error","critical","alert","emergency"]),Qi=lt.extend({method:ue("logging/setLevel"),params:gt.extend({level:Ta})}),tu=Rt.extend({method:ue("notifications/message"),params:Pa.extend({level:Ta,logger:L(C()),data:wa()})}),ru=H({name:C().optional()}).passthrough(),au=H({hints:L(X(ru)),costPriority:L(We().min(0).max(1)),speedPriority:L(We().min(0).max(1)),intelligencePriority:L(We().min(0).max(1))}).passthrough(),su=H({role:Gt(["user","assistant"]),content:ot([Cs,Is,Ns])}).passthrough(),nu=lt.extend({method:ue("sampling/createMessage"),params:gt.extend({messages:X(su),systemPrompt:L(C()),includeContext:L(Gt(["none","thisServer","allServers"])),temperature:L(We()),maxTokens:We().int(),stopSequences:L(X(C())),metadata:L(H({}).passthrough()),modelPreferences:L(au)})}),Gi=pt.extend({model:C(),stopReason:L(Gt(["endTurn","stopSequence","maxTokens"]).or(C())),role:Gt(["user","assistant"]),content:jv("type",[Cs,Is,Ns])}),iu=H({type:ue("boolean"),title:L(C()),description:L(C()),default:L(Qe())}).passthrough(),ou=H({type:ue("string"),title:L(C()),description:L(C()),minLength:L(We()),maxLength:L(We()),format:L(Gt(["email","uri","date","date-time"]))}).passthrough(),lu=H({type:Gt(["number","integer"]),title:L(C()),description:L(C()),minimum:L(We()),maximum:L(We())}).passthrough(),cu=H({type:ue("string"),title:L(C()),description:L(C()),enum:X(C()),enumNames:L(X(C()))}).passthrough(),uu=ot([iu,ou,lu,cu]),du=lt.extend({method:ue("elicitation/create"),params:gt.extend({message:C(),requestedSchema:H({type:ue("object"),properties:ba(C(),uu),required:L(X(C()))}).passthrough()})}),Wi=pt.extend({action:Gt(["accept","decline","cancel"]),content:L(ba(C(),wa()))}),Yi=H({type:ue("ref/resource"),uri:C()}).passthrough(),qv=Yi,fu=H({type:ue("ref/prompt"),name:C()}).passthrough(),xs=lt.extend({method:ue("completion/complete"),params:gt.extend({ref:ot([fu,Yi]),argument:H({name:C(),value:C()}).passthrough(),context:L(H({arguments:L(ba(C(),C()))}))})}),Xi=pt.extend({completion:H({values:X(C()).max(100),total:L(We().int()),hasMore:L(Qe())}).passthrough()}),hu=H({uri:C().startsWith("file://"),name:L(C()),_meta:L(H({}).passthrough())}).passthrough(),pu=lt.extend({method:ue("roots/list")}),eo=pt.extend({roots:X(hu)}),mu=Rt.extend({method:ue("notifications/roots/list_changed")}),Uv=ot([Es,ws,xs,Qi,Ts,Os,Ss,Rs,ks,zc,Hc,Ds,As]),Vv=ot([$s,Ps,bs,mu]),zv=ot([lr,Gi,Wi,eo]),Hv=ot([Es,nu,du,pu]),Zv=ot([$s,Ps,tu,Zc,Vc,eu,Wc]),Kv=ot([lr,xi,Xi,Bi,Zi,Vi,zi,Hi,js,Ji]);class Ce extends Error{constructor(e,a,s){super(`MCP error ${e}: ${a}`),this.code=e,this.data=s,this.name="McpError"}}const vu=1e6,to=1e6,gu=1e4,Bv=1e6;class Wt{static isTemplate(e){return/\{[^}\s]+\}/.test(e)}static validateLength(e,a,s){if(e.length>a)throw new Error(`${s} exceeds maximum length of ${a} characters (got ${e.length})`)}get variableNames(){return this.parts.flatMap(e=>typeof e=="string"?[]:e.names)}constructor(e){Wt.validateLength(e,vu,"Template"),this.template=e,this.parts=this.parse(e)}toString(){return this.template}parse(e){const a=[];let s="",r=0,n=0;for(;r<e.length;)if(e[r]==="{"){s&&(a.push(s),s="");const i=e.indexOf("}",r);if(i===-1)throw new Error("Unclosed template expression");if(n++,n>gu)throw new Error(`Template contains too many expressions (max ${gu})`);const o=e.slice(r+1,i),c=this.getOperator(o),l=o.includes("*"),u=this.getNames(o),f=u[0];for(const y of u)Wt.validateLength(y,to,"Variable name");a.push({name:f,operator:c,names:u,exploded:l}),r=i+1}else s+=e[r],r++;return s&&a.push(s),a}getOperator(e){return["+","#",".","/","?","&"].find(s=>e.startsWith(s))||""}getNames(e){const a=this.getOperator(e);return e.slice(a.length).split(",").map(s=>s.replace("*","").trim()).filter(s=>s.length>0)}encodeValue(e,a){return Wt.validateLength(e,to,"Variable value"),a==="+"||a==="#"?encodeURI(e):encodeURIComponent(e)}expandPart(e,a){if(e.operator==="?"||e.operator==="&"){const i=e.names.map(c=>{const l=a[c];if(l===void 0)return"";const u=Array.isArray(l)?l.map(f=>this.encodeValue(f,e.operator)).join(","):this.encodeValue(l.toString(),e.operator);return`${c}=${u}`}).filter(c=>c.length>0);return i.length===0?"":(e.operator==="?"?"?":"&")+i.join("&")}if(e.names.length>1){const i=e.names.map(o=>a[o]).filter(o=>o!==void 0);return i.length===0?"":i.map(o=>Array.isArray(o)?o[0]:o).join(",")}const s=a[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 a="",s=!1;for(const r of this.parts){if(typeof r=="string"){a+=r;continue}const n=this.expandPart(r,e);n&&((r.operator==="?"||r.operator==="&")&&s?a+=n.replace("?","&"):a+=n,(r.operator==="?"||r.operator==="&")&&(s=!0))}return a}escapeRegExp(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}partToRegExp(e){const a=[];for(const n of e.names)Wt.validateLength(n,to,"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:"&";a.push({pattern:o+this.escapeRegExp(i)+"=([^&]+)",name:i})}return a}let s;const r=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 a.push({pattern:s,name:r}),a}match(e){Wt.validateLength(e,vu,"URI");let a="^";const s=[];for(const o of this.parts)if(typeof o=="string")a+=this.escapeRegExp(o);else{const c=this.partToRegExp(o);for(const{pattern:l,name:u}of c)a+=l,s.push({name:u,exploded:o.exploded})}a+="$",Wt.validateLength(a,Bv,"Generated regex pattern");const r=new RegExp(a),n=e.match(r);if(!n)return null;const i={};for(let o=0;o<s.length;o++){const{name:c,exploded:l}=s[o],u=n[o+1],f=c.replace("*","");l&&u.includes(",")?i[f]=u.split(","):i[f]=u}return i}}R.McpZodTypeKind=void 0,function(t){t.Completable="McpCompletable"}(R.McpZodTypeKind||(R.McpZodTypeKind={}));class Ca extends $e{_parse(e){const{ctx:a}=this._processInputParams(e),s=a.data;return this._def.type._parse({data:s,path:a.path,parent:a})}unwrap(){return this._def.type}}Ca.create=(t,e)=>new Ca({type:t,typeName:R.McpZodTypeKind.Completable,complete:e.complete,...Qv(e)});function Jv(t,e){return Ca.create(t,{...t._def,complete:e})}function Qv(t){if(!t)return{};const{errorMap:e,invalid_type_error:a,required_error:s,description:r}=t;if(e&&(a||s))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:r}:{errorMap:(i,o)=>{var c,l;const{message:u}=t;return i.code==="invalid_enum_value"?{message:u??o.defaultError}:typeof o.data>"u"?{message:(c=u??s)!==null&&c!==void 0?c:o.defaultError}:i.code!=="invalid_type"?{message:o.defaultError}:{message:(l=u??a)!==null&&l!==void 0?l:o.defaultError}},description:r}}function Gv(t){var e;if(t.title!==void 0&&t.title!=="")return t.title;if("annotations"in t){const a=t;if(!((e=a.annotations)===null||e===void 0)&&e.title)return a.annotations.title}return t.name}const yu=6e4;class ro{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($s,a=>{const s=this._requestHandlerAbortControllers.get(a.params.requestId);s==null||s.abort(a.params.reason)}),this.setNotificationHandler(Ps,a=>{this._onprogress(a)}),this.setRequestHandler(Es,a=>({}))}_setupTimeout(e,a,s,r,n=!1){this._timeoutInfo.set(e,{timeoutId:setTimeout(r,a),startTime:Date.now(),timeout:a,maxTotalTimeout:s,resetTimeoutOnProgress:n,onTimeout:r})}_resetTimeout(e){const a=this._timeoutInfo.get(e);if(!a)return!1;const s=Date.now()-a.startTime;if(a.maxTotalTimeout&&s>=a.maxTotalTimeout)throw this._timeoutInfo.delete(e),new Ce(R.ErrorCode.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:a.maxTotalTimeout,totalElapsed:s});return clearTimeout(a.timeoutId),a.timeoutId=setTimeout(a.onTimeout,a.timeout),!0}_cleanupTimeout(e){const a=this._timeoutInfo.get(e);a&&(clearTimeout(a.timeoutId),this._timeoutInfo.delete(e))}async connect(e){var a,s,r;this._transport=e;const n=(a=this.transport)===null||a===void 0?void 0:a.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=c=>{i==null||i(c),this._onerror(c)};const o=(r=this._transport)===null||r===void 0?void 0:r.onmessage;this._transport.onmessage=(c,l)=>{o==null||o(c,l),_s(c)||Dc(c)?this._onresponse(c):Ii(c)?this._onrequest(c,l):jc(c)?this._onnotification(c):this._onerror(new Error(`Unknown message type: ${JSON.stringify(c)}`))},await this._transport.start()}_onclose(){var e;const a=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 Ce(R.ErrorCode.ConnectionClosed,"Connection closed");for(const r of a.values())r(s)}_onerror(e){var a;(a=this.onerror)===null||a===void 0||a.call(this,e)}_onnotification(e){var a;const s=(a=this._notificationHandlers.get(e.method))!==null&&a!==void 0?a:this.fallbackNotificationHandler;s!==void 0&&Promise.resolve().then(()=>s(e)).catch(r=>this._onerror(new Error(`Uncaught error in notification handler: ${r}`)))}_onrequest(e,a){var s,r;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:R.ErrorCode.MethodNotFound,message:"Method not found"}}).catch(l=>this._onerror(new Error(`Failed to send an error response: ${l}`)));return}const o=new AbortController;this._requestHandlerAbortControllers.set(e.id,o);const c={signal:o.signal,sessionId:i==null?void 0:i.sessionId,_meta:(r=e.params)===null||r===void 0?void 0:r._meta,sendNotification:l=>this.notification(l,{relatedRequestId:e.id}),sendRequest:(l,u,f)=>this.request(l,u,{...f,relatedRequestId:e.id}),authInfo:a==null?void 0:a.authInfo,requestId:e.id,requestInfo:a==null?void 0:a.requestInfo};Promise.resolve().then(()=>n(e,c)).then(l=>{if(!o.signal.aborted)return i==null?void 0:i.send({result:l,jsonrpc:"2.0",id:e.id})},l=>{var u;if(!o.signal.aborted)return i==null?void 0:i.send({jsonrpc:"2.0",id:e.id,error:{code:Number.isSafeInteger(l.code)?l.code:R.ErrorCode.InternalError,message:(u=l.message)!==null&&u!==void 0?u:"Internal error"}})}).catch(l=>this._onerror(new Error(`Failed to send response: ${l}`))).finally(()=>{this._requestHandlerAbortControllers.delete(e.id)})}_onprogress(e){const{progressToken:a,...s}=e.params,r=Number(a),n=this._progressHandlers.get(r);if(!n){this._onerror(new Error(`Received a progress notification for an unknown token: ${JSON.stringify(e)}`));return}const i=this._responseHandlers.get(r),o=this._timeoutInfo.get(r);if(o&&i&&o.resetTimeoutOnProgress)try{this._resetTimeout(r)}catch(c){i(c);return}n(s)}_onresponse(e){const a=Number(e.id),s=this._responseHandlers.get(a);if(s===void 0){this._onerror(new Error(`Received a response for an unknown message ID: ${JSON.stringify(e)}`));return}if(this._responseHandlers.delete(a),this._progressHandlers.delete(a),this._cleanupTimeout(a),_s(e))s(e);else{const r=new Ce(e.error.code,e.error.message,e.error.data);s(r)}}get transport(){return this._transport}async close(){var e;await((e=this._transport)===null||e===void 0?void 0:e.close())}request(e,a,s){const{relatedRequestId:r,resumptionToken:n,onresumptiontoken:i}=s??{};return new Promise((o,c)=>{var l,u,f,y,d,m;if(!this._transport){c(new Error("Not connected"));return}((l=this._options)===null||l===void 0?void 0:l.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:{...((f=e.params)===null||f===void 0?void 0:f._meta)||{},progressToken:p}});const v=k=>{var T;this._responseHandlers.delete(p),this._progressHandlers.delete(p),this._cleanupTimeout(p),(T=this._transport)===null||T===void 0||T.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:p,reason:String(k)}},{relatedRequestId:r,resumptionToken:n,onresumptiontoken:i}).catch(x=>this._onerror(new Error(`Failed to send cancellation: ${x}`))),c(k)};this._responseHandlers.set(p,k=>{var T;if(!(!((T=s==null?void 0:s.signal)===null||T===void 0)&&T.aborted)){if(k instanceof Error)return c(k);try{const x=a.parse(k.result);o(x)}catch(x){c(x)}}}),(y=s==null?void 0:s.signal)===null||y===void 0||y.addEventListener("abort",()=>{var k;v((k=s==null?void 0:s.signal)===null||k===void 0?void 0:k.reason)});const $=(d=s==null?void 0:s.timeout)!==null&&d!==void 0?d:yu,P=()=>v(new Ce(R.ErrorCode.RequestTimeout,"Request timed out",{timeout:$}));this._setupTimeout(p,$,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:r,resumptionToken:n,onresumptiontoken:i}).catch(k=>{this._cleanupTimeout(p),c(k)})})}async notification(e,a){var s,r;if(!this._transport)throw new Error("Not connected");if(this.assertNotificationCapability(e.method),((r=(s=this._options)===null||s===void 0?void 0:s.debouncedNotificationMethods)!==null&&r!==void 0?r:[]).includes(e.method)&&!e.params&&!(a!=null&&a.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 l={...e,jsonrpc:"2.0"};(c=this._transport)===null||c===void 0||c.send(l,a).catch(u=>this._onerror(u))});return}const o={...e,jsonrpc:"2.0"};await this._transport.send(o,a)}setRequestHandler(e,a){const s=e.shape.method.value;this.assertRequestHandlerCapability(s),this._requestHandlers.set(s,(r,n)=>Promise.resolve(a(e.parse(r),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,a){this._notificationHandlers.set(e.shape.method.value,s=>Promise.resolve(a(e.parse(s))))}removeNotificationHandler(e){this._notificationHandlers.delete(e)}}function ao(t,e){return Object.entries(e).reduce((a,[s,r])=>(r&&typeof r=="object"?a[s]=a[s]?{...a[s],...r}:r:a[s]=r,a),{...t})}var so={exports:{}};/** @license URI.js v4.4.1 (c) 2011 Gary Court. License: http://github.com/garycourt/uri-js */(function(t,e){(function(a,s){s(e)})(aa,function(a){function s(){for(var b=arguments.length,_=Array(b),E=0;E<b;E++)_[E]=arguments[E];if(_.length>1){_[0]=_[0].slice(0,-1);for(var N=_.length-1,I=1;I<N;++I)_[I]=_[I].slice(1,-1);return _[N]=_[N].slice(1),_.join("")}else return _[0]}function r(b){return"(?:"+b+")"}function n(b){return b===void 0?"undefined":b===null?"null":Object.prototype.toString.call(b).split(" ").pop().split("]").shift().toLowerCase()}function i(b){return b.toUpperCase()}function o(b){return b!=null?b instanceof Array?b:typeof b.length!="number"||b.split||b.setInterval||b.call?[b]:Array.prototype.slice.call(b):[]}function c(b,_){var E=b;if(_)for(var N in _)E[N]=_[N];return E}function l(b){var _="[A-Za-z]",E="[0-9]",N=s(E,"[A-Fa-f]"),I=r(r("%[EFef]"+N+"%"+N+N+"%"+N+N)+"|"+r("%[89A-Fa-f]"+N+"%"+N+N)+"|"+r("%"+N+N)),se="[\\:\\/\\?\\#\\[\\]\\@]",ne="[\\!\\$\\&\\'\\(\\)\\*\\+\\,\\;\\=]",Pe=s(se,ne),Ae=b?"[\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]":"[]",ze=b?"[\\uE000-\\uF8FF]":"[]",Ee=s(_,E,"[\\-\\.\\_\\~]",Ae);r(_+s(_,E,"[\\+\\-\\.]")+"*"),r(r(I+"|"+s(Ee,ne,"[\\:]"))+"*");var Ie=r(r("25[0-5]")+"|"+r("2[0-4]"+E)+"|"+r("1"+E+E)+"|"+r("0?[1-9]"+E)+"|0?0?"+E),He=r(Ie+"\\."+Ie+"\\."+Ie+"\\."+Ie),ce=r(N+"{1,4}"),De=r(r(ce+"\\:"+ce)+"|"+He),Be=r(r(ce+"\\:")+"{6}"+De),xe=r("\\:\\:"+r(ce+"\\:")+"{5}"+De),pr=r(r(ce)+"?\\:\\:"+r(ce+"\\:")+"{4}"+De),qt=r(r(r(ce+"\\:")+"{0,1}"+ce)+"?\\:\\:"+r(ce+"\\:")+"{3}"+De),Ut=r(r(r(ce+"\\:")+"{0,2}"+ce)+"?\\:\\:"+r(ce+"\\:")+"{2}"+De),ra=r(r(r(ce+"\\:")+"{0,3}"+ce)+"?\\:\\:"+ce+"\\:"+De),Ir=r(r(r(ce+"\\:")+"{0,4}"+ce)+"?\\:\\:"+De),wt=r(r(r(ce+"\\:")+"{0,5}"+ce)+"?\\:\\:"+ce),Vt=r(r(r(ce+"\\:")+"{0,6}"+ce)+"?\\:\\:"),Nr=r([Be,xe,pr,qt,Ut,ra,Ir,wt,Vt].join("|")),tr=r(r(Ee+"|"+I)+"+");r("[vV]"+N+"+\\."+s(Ee,ne,"[\\:]")+"+"),r(r(I+"|"+s(Ee,ne))+"*");var La=r(I+"|"+s(Ee,ne,"[\\:\\@]"));return r(r(I+"|"+s(Ee,ne,"[\\@]"))+"+"),r(r(La+"|"+s("[\\/\\?]",ze))+"*"),{NOT_SCHEME:new RegExp(s("[^]",_,E,"[\\+\\-\\.]"),"g"),NOT_USERINFO:new RegExp(s("[^\\%\\:]",Ee,ne),"g"),NOT_HOST:new RegExp(s("[^\\%\\[\\]\\:]",Ee,ne),"g"),NOT_PATH:new RegExp(s("[^\\%\\/\\:\\@]",Ee,ne),"g"),NOT_PATH_NOSCHEME:new RegExp(s("[^\\%\\/\\@]",Ee,ne),"g"),NOT_QUERY:new RegExp(s("[^\\%]",Ee,ne,"[\\:\\@\\/\\?]",ze),"g"),NOT_FRAGMENT:new RegExp(s("[^\\%]",Ee,ne,"[\\:\\@\\/\\?]"),"g"),ESCAPE:new RegExp(s("[^]",Ee,ne),"g"),UNRESERVED:new RegExp(Ee,"g"),OTHER_CHARS:new RegExp(s("[^\\%]",Ee,Pe),"g"),PCT_ENCODED:new RegExp(I,"g"),IPV4ADDRESS:new RegExp("^("+He+")$"),IPV6ADDRESS:new RegExp("^\\[?("+Nr+")"+r(r("\\%25|\\%(?!"+N+"{2})")+"("+tr+")")+"?\\]?$")}}var u=l(!1),f=l(!0),y=function(){function b(_,E){var N=[],I=!0,se=!1,ne=void 0;try{for(var Pe=_[Symbol.iterator](),Ae;!(I=(Ae=Pe.next()).done)&&(N.push(Ae.value),!(E&&N.length===E));I=!0);}catch(ze){se=!0,ne=ze}finally{try{!I&&Pe.return&&Pe.return()}finally{if(se)throw ne}}return N}return function(_,E){if(Array.isArray(_))return _;if(Symbol.iterator in Object(_))return b(_,E);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),d=function(b){if(Array.isArray(b)){for(var _=0,E=Array(b.length);_<b.length;_++)E[_]=b[_];return E}else return Array.from(b)},m=2147483647,p=36,h=1,v=26,$=38,P=700,k=72,T=128,x="-",K=/^xn--/,V=/[^\0-\x7E]/,z=/[\x2E\u3002\uFF0E\uFF61]/g,Y={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},ee=p-h,B=Math.floor,F=String.fromCharCode;function M(b){throw new RangeError(Y[b])}function re(b,_){for(var E=[],N=b.length;N--;)E[N]=_(b[N]);return E}function _e(b,_){var E=b.split("@"),N="";E.length>1&&(N=E[0]+"@",b=E[1]),b=b.replace(z,".");var I=b.split("."),se=re(I,_).join(".");return N+se}function ve(b){for(var _=[],E=0,N=b.length;E<N;){var I=b.charCodeAt(E++);if(I>=55296&&I<=56319&&E<N){var se=b.charCodeAt(E++);(se&64512)==56320?_.push(((I&1023)<<10)+(se&1023)+65536):(_.push(I),E--)}else _.push(I)}return _}var be=function(_){return String.fromCodePoint.apply(String,d(_))},de=function(_){return _-48<10?_-22:_-65<26?_-65:_-97<26?_-97:p},j=function(_,E){return _+22+75*(_<26)-((E!=0)<<5)},S=function(_,E,N){var I=0;for(_=N?B(_/P):_>>1,_+=B(_/E);_>ee*v>>1;I+=p)_=B(_/ee);return B(I+(ee+1)*_/(_+$))},D=function(_){var E=[],N=_.length,I=0,se=T,ne=k,Pe=_.lastIndexOf(x);Pe<0&&(Pe=0);for(var Ae=0;Ae<Pe;++Ae)_.charCodeAt(Ae)>=128&&M("not-basic"),E.push(_.charCodeAt(Ae));for(var ze=Pe>0?Pe+1:0;ze<N;){for(var Ee=I,Ie=1,He=p;;He+=p){ze>=N&&M("invalid-input");var ce=de(_.charCodeAt(ze++));(ce>=p||ce>B((m-I)/Ie))&&M("overflow"),I+=ce*Ie;var De=He<=ne?h:He>=ne+v?v:He-ne;if(ce<De)break;var Be=p-De;Ie>B(m/Be)&&M("overflow"),Ie*=Be}var xe=E.length+1;ne=S(I-Ee,xe,Ee==0),B(I/xe)>m-se&&M("overflow"),se+=B(I/xe),I%=xe,E.splice(I++,0,se)}return String.fromCodePoint.apply(String,E)},O=function(_){var E=[];_=ve(_);var N=_.length,I=T,se=0,ne=k,Pe=!0,Ae=!1,ze=void 0;try{for(var Ee=_[Symbol.iterator](),Ie;!(Pe=(Ie=Ee.next()).done);Pe=!0){var He=Ie.value;He<128&&E.push(F(He))}}catch(Fa){Ae=!0,ze=Fa}finally{try{!Pe&&Ee.return&&Ee.return()}finally{if(Ae)throw ze}}var ce=E.length,De=ce;for(ce&&E.push(x);De<N;){var Be=m,xe=!0,pr=!1,qt=void 0;try{for(var Ut=_[Symbol.iterator](),ra;!(xe=(ra=Ut.next()).done);xe=!0){var Ir=ra.value;Ir>=I&&Ir<Be&&(Be=Ir)}}catch(Fa){pr=!0,qt=Fa}finally{try{!xe&&Ut.return&&Ut.return()}finally{if(pr)throw qt}}var wt=De+1;Be-I>B((m-se)/wt)&&M("overflow"),se+=(Be-I)*wt,I=Be;var Vt=!0,Nr=!1,tr=void 0;try{for(var La=_[Symbol.iterator](),Jd;!(Vt=(Jd=La.next()).done);Vt=!0){var Qd=Jd.value;if(Qd<I&&++se>m&&M("overflow"),Qd==I){for(var cn=se,un=p;;un+=p){var dn=un<=ne?h:un>=ne+v?v:un-ne;if(cn<dn)break;var Gd=cn-dn,Wd=p-dn;E.push(F(j(dn+Gd%Wd,0))),cn=B(Gd/Wd)}E.push(F(j(cn,0))),ne=S(se,wt,De==ce),se=0,++De}}}catch(Fa){Nr=!0,tr=Fa}finally{try{!Vt&&La.return&&La.return()}finally{if(Nr)throw tr}}++se,++I}return E.join("")},g=function(_){return _e(_,function(E){return K.test(E)?D(E.slice(4).toLowerCase()):E})},w=function(_){return _e(_,function(E){return V.test(E)?"xn--"+O(E):E})},A={version:"2.1.0",ucs2:{decode:ve,encode:be},decode:D,encode:O,toASCII:w,toUnicode:g},Z={};function Q(b){var _=b.charCodeAt(0),E=void 0;return _<16?E="%0"+_.toString(16).toUpperCase():_<128?E="%"+_.toString(16).toUpperCase():_<2048?E="%"+(_>>6|192).toString(16).toUpperCase()+"%"+(_&63|128).toString(16).toUpperCase():E="%"+(_>>12|224).toString(16).toUpperCase()+"%"+(_>>6&63|128).toString(16).toUpperCase()+"%"+(_&63|128).toString(16).toUpperCase(),E}function fe(b){for(var _="",E=0,N=b.length;E<N;){var I=parseInt(b.substr(E+1,2),16);if(I<128)_+=String.fromCharCode(I),E+=3;else if(I>=194&&I<224){if(N-E>=6){var se=parseInt(b.substr(E+4,2),16);_+=String.fromCharCode((I&31)<<6|se&63)}else _+=b.substr(E,6);E+=6}else if(I>=224){if(N-E>=9){var ne=parseInt(b.substr(E+4,2),16),Pe=parseInt(b.substr(E+7,2),16);_+=String.fromCharCode((I&15)<<12|(ne&63)<<6|Pe&63)}else _+=b.substr(E,9);E+=9}else _+=b.substr(E,3),E+=3}return _}function ie(b,_){function E(N){var I=fe(N);return I.match(_.UNRESERVED)?I:N}return b.scheme&&(b.scheme=String(b.scheme).replace(_.PCT_ENCODED,E).toLowerCase().replace(_.NOT_SCHEME,"")),b.userinfo!==void 0&&(b.userinfo=String(b.userinfo).replace(_.PCT_ENCODED,E).replace(_.NOT_USERINFO,Q).replace(_.PCT_ENCODED,i)),b.host!==void 0&&(b.host=String(b.host).replace(_.PCT_ENCODED,E).toLowerCase().replace(_.NOT_HOST,Q).replace(_.PCT_ENCODED,i)),b.path!==void 0&&(b.path=String(b.path).replace(_.PCT_ENCODED,E).replace(b.scheme?_.NOT_PATH:_.NOT_PATH_NOSCHEME,Q).replace(_.PCT_ENCODED,i)),b.query!==void 0&&(b.query=String(b.query).replace(_.PCT_ENCODED,E).replace(_.NOT_QUERY,Q).replace(_.PCT_ENCODED,i)),b.fragment!==void 0&&(b.fragment=String(b.fragment).replace(_.PCT_ENCODED,E).replace(_.NOT_FRAGMENT,Q).replace(_.PCT_ENCODED,i)),b}function he(b){return b.replace(/^0*(.*)/,"$1")||"0"}function st(b,_){var E=b.match(_.IPV4ADDRESS)||[],N=y(E,2),I=N[1];return I?I.split(".").map(he).join("."):b}function Ve(b,_){var E=b.match(_.IPV6ADDRESS)||[],N=y(E,3),I=N[1],se=N[2];if(I){for(var ne=I.toLowerCase().split("::").reverse(),Pe=y(ne,2),Ae=Pe[0],ze=Pe[1],Ee=ze?ze.split(":").map(he):[],Ie=Ae.split(":").map(he),He=_.IPV4ADDRESS.test(Ie[Ie.length-1]),ce=He?7:8,De=Ie.length-ce,Be=Array(ce),xe=0;xe<ce;++xe)Be[xe]=Ee[xe]||Ie[De+xe]||"";He&&(Be[ce-1]=st(Be[ce-1],_));var pr=Be.reduce(function(wt,Vt,Nr){if(!Vt||Vt==="0"){var tr=wt[wt.length-1];tr&&tr.index+tr.length===Nr?tr.length++:wt.push({index:Nr,length:1})}return wt},[]),qt=pr.sort(function(wt,Vt){return Vt.length-wt.length})[0],Ut=void 0;if(qt&&qt.length>1){var ra=Be.slice(0,qt.index),Ir=Be.slice(qt.index+qt.length);Ut=ra.join(":")+"::"+Ir.join(":")}else Ut=Be.join(":");return se&&(Ut+="%"+se),Ut}else return b}var Te=/^(?:([^:\/?#]+):)?(?:\/\/((?:([^\/?#@]*)@)?(\[[^\/?#\]]+\]|[^\/?#:]*)(?:\:(\d*))?))?([^?#]*)(?:\?([^#]*))?(?:#((?:.|\n|\r)*))?/i,yt="".match(/(){0}/)[1]===void 0;function Ke(b){var _=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},E={},N=_.iri!==!1?f:u;_.reference==="suffix"&&(b=(_.scheme?_.scheme+":":"")+"//"+b);var I=b.match(Te);if(I){yt?(E.scheme=I[1],E.userinfo=I[3],E.host=I[4],E.port=parseInt(I[5],10),E.path=I[6]||"",E.query=I[7],E.fragment=I[8],isNaN(E.port)&&(E.port=I[5])):(E.scheme=I[1]||void 0,E.userinfo=b.indexOf("@")!==-1?I[3]:void 0,E.host=b.indexOf("//")!==-1?I[4]:void 0,E.port=parseInt(I[5],10),E.path=I[6]||"",E.query=b.indexOf("?")!==-1?I[7]:void 0,E.fragment=b.indexOf("#")!==-1?I[8]:void 0,isNaN(E.port)&&(E.port=b.match(/\/\/(?:.|\n)*\:(?:\/|\?|\#|$)/)?I[4]:void 0)),E.host&&(E.host=Ve(st(E.host,N),N)),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",_.reference&&_.reference!=="suffix"&&_.reference!==E.reference&&(E.error=E.error||"URI is not a "+_.reference+" reference.");var se=Z[(_.scheme||E.scheme||"").toLowerCase()];if(!_.unicodeSupport&&(!se||!se.unicodeSupport)){if(E.host&&(_.domainHost||se&&se.domainHost))try{E.host=A.toASCII(E.host.replace(N.PCT_ENCODED,fe).toLowerCase())}catch(ne){E.error=E.error||"Host's domain name can not be converted to ASCII via punycode: "+ne}ie(E,u)}else ie(E,N);se&&se.parse&&se.parse(E,_)}else E.error=E.error||"URI can not be parsed.";return E}function Lt(b,_){var E=_.iri!==!1?f:u,N=[];return b.userinfo!==void 0&&(N.push(b.userinfo),N.push("@")),b.host!==void 0&&N.push(Ve(st(String(b.host),E),E).replace(E.IPV6ADDRESS,function(I,se,ne){return"["+se+(ne?"%25"+ne:"")+"]"})),(typeof b.port=="number"||typeof b.port=="string")&&(N.push(":"),N.push(String(b.port))),N.length?N.join(""):void 0}var It=/^\.\.?\//,qe=/^\/\.(\/|$)/,_t=/^\/\.\.(\/|$)/,Xt=/^\/?(?:.|\n)*?(?=\/|$)/;function Me(b){for(var _=[];b.length;)if(b.match(It))b=b.replace(It,"");else if(b.match(qe))b=b.replace(qe,"/");else if(b.match(_t))b=b.replace(_t,"/"),_.pop();else if(b==="."||b==="..")b="";else{var E=b.match(Xt);if(E){var N=E[0];b=b.slice(N.length),_.push(N)}else throw new Error("Unexpected dot segment condition")}return _.join("")}function Le(b){var _=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},E=_.iri?f:u,N=[],I=Z[(_.scheme||b.scheme||"").toLowerCase()];if(I&&I.serialize&&I.serialize(b,_),b.host&&!E.IPV6ADDRESS.test(b.host)){if(_.domainHost||I&&I.domainHost)try{b.host=_.iri?A.toUnicode(b.host):A.toASCII(b.host.replace(E.PCT_ENCODED,fe).toLowerCase())}catch(Pe){b.error=b.error||"Host's domain name can not be converted to "+(_.iri?"Unicode":"ASCII")+" via punycode: "+Pe}}ie(b,E),_.reference!=="suffix"&&b.scheme&&(N.push(b.scheme),N.push(":"));var se=Lt(b,_);if(se!==void 0&&(_.reference!=="suffix"&&N.push("//"),N.push(se),b.path&&b.path.charAt(0)!=="/"&&N.push("/")),b.path!==void 0){var ne=b.path;!_.absolutePath&&(!I||!I.absolutePath)&&(ne=Me(ne)),se===void 0&&(ne=ne.replace(/^\/\//,"/%2F")),N.push(ne)}return b.query!==void 0&&(N.push("?"),N.push(b.query)),b.fragment!==void 0&&(N.push("#"),N.push(b.fragment)),N.join("")}function Ye(b,_){var E=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},N=arguments[3],I={};return N||(b=Ke(Le(b,E),E),_=Ke(Le(_,E),E)),E=E||{},!E.tolerant&&_.scheme?(I.scheme=_.scheme,I.userinfo=_.userinfo,I.host=_.host,I.port=_.port,I.path=Me(_.path||""),I.query=_.query):(_.userinfo!==void 0||_.host!==void 0||_.port!==void 0?(I.userinfo=_.userinfo,I.host=_.host,I.port=_.port,I.path=Me(_.path||""),I.query=_.query):(_.path?(_.path.charAt(0)==="/"?I.path=Me(_.path):((b.userinfo!==void 0||b.host!==void 0||b.port!==void 0)&&!b.path?I.path="/"+_.path:b.path?I.path=b.path.slice(0,b.path.lastIndexOf("/")+1)+_.path:I.path=_.path,I.path=Me(I.path)),I.query=_.query):(I.path=b.path,_.query!==void 0?I.query=_.query:I.query=b.query),I.userinfo=b.userinfo,I.host=b.host,I.port=b.port),I.scheme=b.scheme),I.fragment=_.fragment,I}function hr(b,_,E){var N=c({scheme:"null"},E);return Le(Ye(Ke(b,N),Ke(_,N),N,!0),N)}function er(b,_){return typeof b=="string"?b=Le(Ke(b,_),_):n(b)==="object"&&(b=Ke(Le(b,_),_)),b}function Tr(b,_,E){return typeof b=="string"?b=Le(Ke(b,E),E):n(b)==="object"&&(b=Le(b,E)),typeof _=="string"?_=Le(Ke(_,E),E):n(_)==="object"&&(_=Le(_,E)),b===_}function ln(b,_){return b&&b.toString().replace(!_||!_.iri?u.ESCAPE:f.ESCAPE,Q)}function $t(b,_){return b&&b.toString().replace(!_||!_.iri?u.PCT_ENCODED:f.PCT_ENCODED,fe)}var Cr={scheme:"http",domainHost:!0,parse:function(_,E){return _.host||(_.error=_.error||"HTTP URIs must have a host."),_},serialize:function(_,E){var N=String(_.scheme).toLowerCase()==="https";return(_.port===(N?443:80)||_.port==="")&&(_.port=void 0),_.path||(_.path="/"),_}},qd={scheme:"https",domainHost:Cr.domainHost,parse:Cr.parse,serialize:Cr.serialize};function Ud(b){return typeof b.secure=="boolean"?b.secure:String(b.scheme).toLowerCase()==="wss"}var Ma={scheme:"ws",domainHost:!0,parse:function(_,E){var N=_;return N.secure=Ud(N),N.resourceName=(N.path||"/")+(N.query?"?"+N.query:""),N.path=void 0,N.query=void 0,N},serialize:function(_,E){if((_.port===(Ud(_)?443:80)||_.port==="")&&(_.port=void 0),typeof _.secure=="boolean"&&(_.scheme=_.secure?"wss":"ws",_.secure=void 0),_.resourceName){var N=_.resourceName.split("?"),I=y(N,2),se=I[0],ne=I[1];_.path=se&&se!=="/"?se:void 0,_.query=ne,_.resourceName=void 0}return _.fragment=void 0,_}},Vd={scheme:"wss",domainHost:Ma.domainHost,parse:Ma.parse,serialize:Ma.serialize},P0={},zd="[A-Za-z0-9\\-\\.\\_\\~\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]",Ft="[0-9A-Fa-f]",S0=r(r("%[EFef]"+Ft+"%"+Ft+Ft+"%"+Ft+Ft)+"|"+r("%[89A-Fa-f]"+Ft+"%"+Ft+Ft)+"|"+r("%"+Ft+Ft)),R0="[A-Za-z0-9\\!\\$\\%\\'\\*\\+\\-\\^\\_\\`\\{\\|\\}\\~]",k0="[\\!\\$\\%\\'\\(\\)\\*\\+\\,\\-\\.0-9\\<\\>A-Z\\x5E-\\x7E]",O0=s(k0,'[\\"\\\\]'),T0="[\\!\\$\\'\\(\\)\\*\\+\\,\\;\\:\\@]",C0=new RegExp(zd,"g"),ta=new RegExp(S0,"g"),I0=new RegExp(s("[^]",R0,"[\\.]",'[\\"]',O0),"g"),Hd=new RegExp(s("[^]",zd,T0),"g"),N0=Hd;function el(b){var _=fe(b);return _.match(C0)?_:b}var Zd={scheme:"mailto",parse:function(_,E){var N=_,I=N.to=N.path?N.path.split(","):[];if(N.path=void 0,N.query){for(var se=!1,ne={},Pe=N.query.split("&"),Ae=0,ze=Pe.length;Ae<ze;++Ae){var Ee=Pe[Ae].split("=");switch(Ee[0]){case"to":for(var Ie=Ee[1].split(","),He=0,ce=Ie.length;He<ce;++He)I.push(Ie[He]);break;case"subject":N.subject=$t(Ee[1],E);break;case"body":N.body=$t(Ee[1],E);break;default:se=!0,ne[$t(Ee[0],E)]=$t(Ee[1],E);break}}se&&(N.headers=ne)}N.query=void 0;for(var De=0,Be=I.length;De<Be;++De){var xe=I[De].split("@");if(xe[0]=$t(xe[0]),E.unicodeSupport)xe[1]=$t(xe[1],E).toLowerCase();else try{xe[1]=A.toASCII($t(xe[1],E).toLowerCase())}catch(pr){N.error=N.error||"Email address's domain name can not be converted to ASCII via punycode: "+pr}I[De]=xe.join("@")}return N},serialize:function(_,E){var N=_,I=o(_.to);if(I){for(var se=0,ne=I.length;se<ne;++se){var Pe=String(I[se]),Ae=Pe.lastIndexOf("@"),ze=Pe.slice(0,Ae).replace(ta,el).replace(ta,i).replace(I0,Q),Ee=Pe.slice(Ae+1);try{Ee=E.iri?A.toUnicode(Ee):A.toASCII($t(Ee,E).toLowerCase())}catch(De){N.error=N.error||"Email address's domain name can not be converted to "+(E.iri?"Unicode":"ASCII")+" via punycode: "+De}I[se]=ze+"@"+Ee}N.path=I.join(",")}var Ie=_.headers=_.headers||{};_.subject&&(Ie.subject=_.subject),_.body&&(Ie.body=_.body);var He=[];for(var ce in Ie)Ie[ce]!==P0[ce]&&He.push(ce.replace(ta,el).replace(ta,i).replace(Hd,Q)+"="+Ie[ce].replace(ta,el).replace(ta,i).replace(N0,Q));return He.length&&(N.query=He.join("&")),N}},A0=/^([^\:]+)\:(.*)/,Kd={scheme:"urn",parse:function(_,E){var N=_.path&&_.path.match(A0),I=_;if(N){var se=E.scheme||I.scheme||"urn",ne=N[1].toLowerCase(),Pe=N[2],Ae=se+":"+(E.nid||ne),ze=Z[Ae];I.nid=ne,I.nss=Pe,I.path=void 0,ze&&(I=ze.parse(I,E))}else I.error=I.error||"URN can not be parsed.";return I},serialize:function(_,E){var N=E.scheme||_.scheme||"urn",I=_.nid,se=N+":"+(E.nid||I),ne=Z[se];ne&&(_=ne.serialize(_,E));var Pe=_,Ae=_.nss;return Pe.path=(I||E.nid)+":"+Ae,Pe}},j0=/^[0-9A-Fa-f]{8}(?:\-[0-9A-Fa-f]{4}){3}\-[0-9A-Fa-f]{12}$/,Bd={scheme:"urn:uuid",parse:function(_,E){var N=_;return N.uuid=N.nss,N.nss=void 0,!E.tolerant&&(!N.uuid||!N.uuid.match(j0))&&(N.error=N.error||"UUID is not valid."),N},serialize:function(_,E){var N=_;return N.nss=(_.uuid||"").toLowerCase(),N}};Z[Cr.scheme]=Cr,Z[qd.scheme]=qd,Z[Ma.scheme]=Ma,Z[Vd.scheme]=Vd,Z[Zd.scheme]=Zd,Z[Kd.scheme]=Kd,Z[Bd.scheme]=Bd,a.SCHEMES=Z,a.pctEncChar=Q,a.pctDecChars=fe,a.parse=Ke,a.removeDotSegments=Me,a.serialize=Le,a.resolveComponents=Ye,a.resolve=hr,a.normalize=er,a.equal=Tr,a.escapeComponent=ln,a.unescapeComponent=$t,Object.defineProperty(a,"__esModule",{value:!0})})})(so,so.exports);var Wv=so.exports,Yv=function(e){for(var a=0,s=e.length,r=0,n;r<s;)a++,n=e.charCodeAt(r++),n>=55296&&n<=56319&&r<s&&(n=e.charCodeAt(r),(n&64512)==56320&&r++);return a},Jr={copy:Xv,checkDataType:no,checkDataTypes:eg,coerceToTypes:tg,toHash:io,getProperty:oo,escapeQuotes:lo,equal:ia,ucs2length:Yv,varOccurences:sg,varReplace:ng,schemaHasRules:ig,schemaHasRulesExcept:og,schemaUnknownRules:lg,toQuotedString:co,getPathExpr:cg,getPath:ug,getData:hg,unescapeFragment:pg,unescapeJsonPointer:fo,escapeFragment:mg,escapeJsonPointer:uo};function Xv(t,e){e=e||{};for(var a in t)e[a]=t[a];return e}function no(t,e,a,s){var r=s?" !== ":" === ",n=s?" || ":" && ",i=s?"!":"",o=s?"":"!";switch(t){case"null":return e+r+"null";case"array":return i+"Array.isArray("+e+")";case"object":return"("+i+e+n+"typeof "+e+r+'"object"'+n+o+"Array.isArray("+e+"))";case"integer":return"(typeof "+e+r+'"number"'+n+o+"("+e+" % 1)"+n+e+r+e+(a?n+i+"isFinite("+e+")":"")+")";case"number":return"(typeof "+e+r+'"'+t+'"'+(a?n+i+"isFinite("+e+")":"")+")";default:return"typeof "+e+r+'"'+t+'"'}}function eg(t,e,a){switch(t.length){case 1:return no(t[0],e,a,!0);default:var s="",r=io(t);r.array&&r.object&&(s=r.null?"(":"(!"+e+" || ",s+="typeof "+e+' !== "object")',delete r.null,delete r.array,delete r.object),r.number&&delete r.integer;for(var n in r)s+=(s?" && ":"")+no(n,e,a,!0);return s}}var _u=io(["string","number","integer","boolean","null"]);function tg(t,e){if(Array.isArray(e)){for(var a=[],s=0;s<e.length;s++){var r=e[s];(_u[r]||t==="array"&&r==="array")&&(a[a.length]=r)}if(a.length)return a}else{if(_u[e])return[e];if(t==="array"&&e==="array")return["array"]}}function io(t){for(var e={},a=0;a<t.length;a++)e[t[a]]=!0;return e}var rg=/^[a-z$_][a-z$_0-9]*$/i,ag=/'|\\/g;function oo(t){return typeof t=="number"?"["+t+"]":rg.test(t)?"."+t:"['"+lo(t)+"']"}function lo(t){return t.replace(ag,"\\$&").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\f/g,"\\f").replace(/\t/g,"\\t")}function sg(t,e){e+="[^0-9]";var a=t.match(new RegExp(e,"g"));return a?a.length:0}function ng(t,e,a){return e+="([^0-9])",a=a.replace(/\$/g,"$$$$"),t.replace(new RegExp(e,"g"),a+"$1")}function ig(t,e){if(typeof t=="boolean")return!t;for(var a in t)if(e[a])return!0}function og(t,e,a){if(typeof t=="boolean")return!t&&a!="not";for(var s in t)if(s!=a&&e[s])return!0}function lg(t,e){if(typeof t!="boolean"){for(var a in t)if(!e[a])return a}}function co(t){return"'"+lo(t)+"'"}function cg(t,e,a,s){var r=a?"'/' + "+e+(s?"":".replace(/~/g, '~0').replace(/\\//g, '~1')"):s?"'[' + "+e+" + ']'":"'[\\'' + "+e+" + '\\']'";return $u(t,r)}function ug(t,e,a){var s=co(a?"/"+uo(e):oo(e));return $u(t,s)}var dg=/^\/(?:[^~]|~0|~1)*$/,fg=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function hg(t,e,a){var s,r,n,i;if(t==="")return"rootData";if(t[0]=="/"){if(!dg.test(t))throw new Error("Invalid JSON-pointer: "+t);r=t,n="rootData"}else{if(i=t.match(fg),!i)throw new Error("Invalid JSON-pointer: "+t);if(s=+i[1],r=i[2],r=="#"){if(s>=e)throw new Error("Cannot access property/index "+s+" levels up, current level is "+e);return a[e-s]}if(s>e)throw new Error("Cannot access data "+s+" levels up, current level is "+e);if(n="data"+(e-s||""),!r)return n}for(var o=n,c=r.split("/"),l=0;l<c.length;l++){var u=c[l];u&&(n+=oo(fo(u)),o+=" && "+n)}return o}function $u(t,e){return t=='""'?e:(t+" + "+e).replace(/([^\\])' \+ '/g,"$1")}function pg(t){return fo(decodeURIComponent(t))}function mg(t){return encodeURIComponent(uo(t))}function uo(t){return t.replace(/~/g,"~0").replace(/\//g,"~1")}function fo(t){return t.replace(/~1/g,"/").replace(/~0/g,"~")}var vg=Jr,wu=gg;function gg(t){vg.copy(t,this)}var bu={exports:{}},cr=bu.exports=function(t,e,a){typeof e=="function"&&(a=e,e={}),a=e.cb||a;var s=typeof a=="function"?a:a.pre||function(){},r=a.post||function(){};Ms(e,s,r,t,"",t)};cr.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0},cr.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0},cr.propsKeywords={definitions:!0,properties:!0,patternProperties:!0,dependencies:!0},cr.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 Ms(t,e,a,s,r,n,i,o,c,l){if(s&&typeof s=="object"&&!Array.isArray(s)){e(s,r,n,i,o,c,l);for(var u in s){var f=s[u];if(Array.isArray(f)){if(u in cr.arrayKeywords)for(var y=0;y<f.length;y++)Ms(t,e,a,f[y],r+"/"+u+"/"+y,n,r,u,s,y)}else if(u in cr.propsKeywords){if(f&&typeof f=="object")for(var d in f)Ms(t,e,a,f[d],r+"/"+u+"/"+yg(d),n,r,u,s,d)}else(u in cr.keywords||t.allKeys&&!(u in cr.skipKeywords))&&Ms(t,e,a,f,r+"/"+u,n,r,u,s)}a(s,r,n,i,o,c,l)}}function yg(t){return t.replace(/~/g,"~0").replace(/\//g,"~1")}var _g=bu.exports,Ia=Wv,Eu=ia,Ls=Jr,Fs=wu,$g=_g,ho=ur;ur.normalizeId=dr,ur.fullPath=Us,ur.url=Vs,ur.ids=Sg,ur.inlineRef=po,ur.schema=qs;function ur(t,e,a){var s=this._refs[a];if(typeof s=="string")if(this._refs[s])s=this._refs[s];else return ur.call(this,t,e,s);if(s=s||this._schemas[a],s instanceof Fs)return po(s.schema,this._opts.inlineRefs)?s.schema:s.validate||this._compile(s);var r=qs.call(this,e,a),n,i,o;return r&&(n=r.schema,e=r.root,o=r.baseId),n instanceof Fs?i=n.validate||t.call(this,n.schema,e,void 0,o):n!==void 0&&(i=po(n,this._opts.inlineRefs)?n:t.call(this,n,e,void 0,o)),i}function qs(t,e){var a=Ia.parse(e),s=Su(a),r=Us(this._getId(t.schema));if(Object.keys(t.schema).length===0||s!==r){var n=dr(s),i=this._refs[n];if(typeof i=="string")return wg.call(this,t,i,a);if(i instanceof Fs)i.validate||this._compile(i),t=i;else if(i=this._schemas[n],i instanceof Fs){if(i.validate||this._compile(i),n==dr(e))return{schema:i,root:t,baseId:r};t=i}else return;if(!t.schema)return;r=Us(this._getId(t.schema))}return Pu.call(this,a,r,t.schema,t)}function wg(t,e,a){var s=qs.call(this,t,e);if(s){var r=s.schema,n=s.baseId;t=s.root;var i=this._getId(r);return i&&(n=Vs(n,i)),Pu.call(this,a,n,r,t)}}var bg=Ls.toHash(["properties","patternProperties","enum","dependencies","definitions"]);function Pu(t,e,a,s){if(t.fragment=t.fragment||"",t.fragment.slice(0,1)=="/"){for(var r=t.fragment.split("/"),n=1;n<r.length;n++){var i=r[n];if(i){if(i=Ls.unescapeFragment(i),a=a[i],a===void 0)break;var o;if(!bg[i]&&(o=this._getId(a),o&&(e=Vs(e,o)),a.$ref)){var c=Vs(e,a.$ref),l=qs.call(this,s,c);l&&(a=l.schema,s=l.root,e=l.baseId)}}}if(a!==void 0&&a!==s.schema)return{schema:a,root:s,baseId:e}}}var Eg=Ls.toHash(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum"]);function po(t,e){if(e===!1)return!1;if(e===void 0||e===!0)return mo(t);if(e)return vo(t)<=e}function mo(t){var e;if(Array.isArray(t)){for(var a=0;a<t.length;a++)if(e=t[a],typeof e=="object"&&!mo(e))return!1}else for(var s in t)if(s=="$ref"||(e=t[s],typeof e=="object"&&!mo(e)))return!1;return!0}function vo(t){var e=0,a;if(Array.isArray(t)){for(var s=0;s<t.length;s++)if(a=t[s],typeof a=="object"&&(e+=vo(a)),e==1/0)return 1/0}else for(var r in t){if(r=="$ref")return 1/0;if(Eg[r])e++;else if(a=t[r],typeof a=="object"&&(e+=vo(a)+1),e==1/0)return 1/0}return e}function Us(t,e){e!==!1&&(t=dr(t));var a=Ia.parse(t);return Su(a)}function Su(t){return Ia.serialize(t).split("#")[0]+"#"}var Pg=/#\/?$/;function dr(t){return t?t.replace(Pg,""):""}function Vs(t,e){return e=dr(e),Ia.resolve(t,e)}function Sg(t){var e=dr(this._getId(t)),a={"":e},s={"":Us(e,!1)},r={},n=this;return $g(t,{allKeys:!0},function(i,o,c,l,u,f,y){if(o!==""){var d=n._getId(i),m=a[l],p=s[l]+"/"+u;if(y!==void 0&&(p+="/"+(typeof y=="number"?y:Ls.escapeFragment(y))),typeof d=="string"){d=m=dr(m?Ia.resolve(m,d):d);var h=n._refs[d];if(typeof h=="string"&&(h=n._refs[h]),h&&h.schema){if(!Eu(i,h.schema))throw new Error('id "'+d+'" resolves to more than one schema')}else if(d!=dr(p))if(d[0]=="#"){if(r[d]&&!Eu(i,r[d]))throw new Error('id "'+d+'" resolves to more than one schema');r[d]=i}else n._refs[d]=p}a[o]=m,s[o]=p}}),r}var go=ho,yo={Validation:Ru(Rg),MissingRef:Ru(_o)};function Rg(t){this.message="validation failed",this.errors=t,this.ajv=this.validation=!0}_o.message=function(t,e){return"can't resolve reference "+e+" from id "+t};function _o(t,e,a){this.message=a||_o.message(t,e),this.missingRef=go.url(t,e),this.missingSchema=go.normalizeId(go.fullPath(this.missingRef))}function Ru(t){return t.prototype=Object.create(Error.prototype),t.prototype.constructor=t,t}var ku=function(t,e){e||(e={}),typeof e=="function"&&(e={cmp:e});var a=typeof e.cycles=="boolean"?e.cycles:!1,s=e.cmp&&function(n){return function(i){return function(o,c){var l={key:o,value:i[o]},u={key:c,value:i[c]};return n(l,u)}}}(e.cmp),r=[];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,c;if(Array.isArray(i)){for(c="[",o=0;o<i.length;o++)o&&(c+=","),c+=n(i[o])||"null";return c+"]"}if(i===null)return"null";if(r.indexOf(i)!==-1){if(a)return JSON.stringify("__cycle__");throw new TypeError("Converting circular structure to JSON")}var l=r.push(i)-1,u=Object.keys(i).sort(s&&s(i));for(c="",o=0;o<u.length;o++){var f=u[o],y=n(i[f]);y&&(c&&(c+=","),c+=JSON.stringify(f)+":"+y)}return r.splice(l,1),"{"+c+"}"}}(t)},Ou=function(e,a,s){var r="",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 c=e.util.schemaUnknownRules(e.schema,e.RULES.keywords);if(c){var l="unknown keyword: "+c;if(e.opts.strictKeywords==="log")e.logger.warn(l);else throw new Error(l)}}if(e.isTop&&(r+=" var validate = ",n&&(e.async=!0,r+="async "),r+="function(data, dataPath, parentData, parentDataProperty, rootData) { 'use strict'; ",o&&(e.opts.sourceCode||e.opts.processCode)&&(r+=" "+("/*# sourceURL="+o+" */")+" ")),typeof e.schema=="boolean"||!(i||e.schema.$ref)){var a="false schema",u=e.level,f=e.dataLevel,y=e.schema[a],d=e.schemaPath+e.util.getProperty(a),m=e.errSchemaPath+"/"+a,T=!e.opts.allErrors,V,p="data"+(f||""),k="valid"+u;if(e.schema===!1){e.isTop?T=!0:r+=" var "+k+" = false; ";var h=h||[];h.push(r),r="",e.createErrors!==!1?(r+=" { keyword: '"+(V||"false schema")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(m)+" , params: {} ",e.opts.messages!==!1&&(r+=" , message: 'boolean schema is false' "),e.opts.verbose&&(r+=" , schema: false , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),r+=" } "):r+=" {} ";var v=r;r=h.pop(),!e.compositeRule&&T?e.async?r+=" throw new ValidationError(["+v+"]); ":r+=" validate.errors = ["+v+"]; return false; ":r+=" var err = "+v+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "}else e.isTop?n?r+=" return data; ":r+=" validate.errors = null; return true; ":r+=" var "+k+" = true; ";return e.isTop&&(r+=" }; return validate; "),r}if(e.isTop){var $=e.isTop,u=e.level=0,f=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)}r+=" var vErrors = null; ",r+=" var errors = 0; ",r+=" if (rootData === undefined) rootData = data; "}else{var u=e.level,f=e.dataLevel,p="data"+(f||"");if(o&&(e.baseId=e.resolve.url(e.baseId,o)),n&&!e.async)throw new Error("async schema in sync schema");r+=" var errs_"+u+" = errors;"}var k="valid"+u,T=!e.opts.allErrors,x="",K="",V,z=e.schema.type,Y=Array.isArray(z);if(z&&e.opts.nullable&&e.schema.nullable===!0&&(Y?z.indexOf("null")==-1&&(z=z.concat("null")):z!="null"&&(z=[z,"null"],Y=!0)),Y&&z.length==1&&(z=z[0],Y=!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&&(r+=" "+e.RULES.all.$comment.code(e,"$comment")),z){if(e.opts.coerceTypes)var ee=e.util.coerceToTypes(e.opts.coerceTypes,z);var B=e.RULES.types[z];if(ee||Y||B===!0||B&&!qe(B)){var d=e.schemaPath+".type",m=e.errSchemaPath+"/type",d=e.schemaPath+".type",m=e.errSchemaPath+"/type",F=Y?"checkDataTypes":"checkDataType";if(r+=" if ("+e.util[F](z,p,e.opts.strictNumbers,!0)+") { ",ee){var M="dataType"+u,re="coerced"+u;r+=" var "+M+" = typeof "+p+"; var "+re+" = undefined; ",e.opts.coerceTypes=="array"&&(r+=" 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)+") "+re+" = "+p+"; } "),r+=" if ("+re+" !== undefined) ; ";var _e=ee;if(_e)for(var ve,be=-1,de=_e.length-1;be<de;)ve=_e[be+=1],ve=="string"?r+=" else if ("+M+" == 'number' || "+M+" == 'boolean') "+re+" = '' + "+p+"; else if ("+p+" === null) "+re+" = ''; ":ve=="number"||ve=="integer"?(r+=" else if ("+M+" == 'boolean' || "+p+" === null || ("+M+" == 'string' && "+p+" && "+p+" == +"+p+" ",ve=="integer"&&(r+=" && !("+p+" % 1)"),r+=")) "+re+" = +"+p+"; "):ve=="boolean"?r+=" else if ("+p+" === 'false' || "+p+" === 0 || "+p+" === null) "+re+" = false; else if ("+p+" === 'true' || "+p+" === 1) "+re+" = true; ":ve=="null"?r+=" else if ("+p+" === '' || "+p+" === 0 || "+p+" === false) "+re+" = null; ":e.opts.coerceTypes=="array"&&ve=="array"&&(r+=" else if ("+M+" == 'string' || "+M+" == 'number' || "+M+" == 'boolean' || "+p+" == null) "+re+" = ["+p+"]; ");r+=" else { ";var h=h||[];h.push(r),r="",e.createErrors!==!1?(r+=" { keyword: '"+(V||"type")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(m)+" , params: { type: '",Y?r+=""+z.join(","):r+=""+z,r+="' } ",e.opts.messages!==!1&&(r+=" , message: 'should be ",Y?r+=""+z.join(","):r+=""+z,r+="' "),e.opts.verbose&&(r+=" , schema: validate.schema"+d+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),r+=" } "):r+=" {} ";var v=r;r=h.pop(),!e.compositeRule&&T?e.async?r+=" throw new ValidationError(["+v+"]); ":r+=" validate.errors = ["+v+"]; return false; ":r+=" var err = "+v+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" } if ("+re+" !== undefined) { ";var j=f?"data"+(f-1||""):"parentData",S=f?e.dataPathArr[f]:"parentDataProperty";r+=" "+p+" = "+re+"; ",f||(r+="if ("+j+" !== undefined)"),r+=" "+j+"["+S+"] = "+re+"; } "}else{var h=h||[];h.push(r),r="",e.createErrors!==!1?(r+=" { keyword: '"+(V||"type")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(m)+" , params: { type: '",Y?r+=""+z.join(","):r+=""+z,r+="' } ",e.opts.messages!==!1&&(r+=" , message: 'should be ",Y?r+=""+z.join(","):r+=""+z,r+="' "),e.opts.verbose&&(r+=" , schema: validate.schema"+d+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),r+=" } "):r+=" {} ";var v=r;r=h.pop(),!e.compositeRule&&T?e.async?r+=" throw new ValidationError(["+v+"]); ":r+=" validate.errors = ["+v+"]; return false; ":r+=" var err = "+v+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "}r+=" } "}}if(e.schema.$ref&&!i)r+=" "+e.RULES.all.$ref.code(e,"$ref")+" ",T&&(r+=" } if (errors === ",$?r+="0":r+="errs_"+u,r+=") { ",K+="}");else{var D=e.RULES;if(D){for(var B,O=-1,g=D.length-1;O<g;)if(B=D[O+=1],qe(B)){if(B.type&&(r+=" if ("+e.util.checkDataType(B.type,p,e.opts.strictNumbers)+") { "),e.opts.useDefaults){if(B.type=="object"&&e.schema.properties){var y=e.schema.properties,w=Object.keys(y),A=w;if(A)for(var Z,Q=-1,fe=A.length-1;Q<fe;){Z=A[Q+=1];var ie=y[Z];if(ie.default!==void 0){var he=p+e.util.getProperty(Z);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 r+=" if ("+he+" === undefined ",e.opts.useDefaults=="empty"&&(r+=" || "+he+" === null || "+he+" === '' "),r+=" ) "+he+" = ",e.opts.useDefaults=="shared"?r+=" "+e.useDefault(ie.default)+" ":r+=" "+JSON.stringify(ie.default)+" ",r+="; "}}}else if(B.type=="array"&&Array.isArray(e.schema.items)){var st=e.schema.items;if(st){for(var ie,be=-1,Ve=st.length-1;be<Ve;)if(ie=st[be+=1],ie.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 r+=" if ("+he+" === undefined ",e.opts.useDefaults=="empty"&&(r+=" || "+he+" === null || "+he+" === '' "),r+=" ) "+he+" = ",e.opts.useDefaults=="shared"?r+=" "+e.useDefault(ie.default)+" ":r+=" "+JSON.stringify(ie.default)+" ",r+="; "}}}}var Te=B.rules;if(Te){for(var yt,Ke=-1,Lt=Te.length-1;Ke<Lt;)if(yt=Te[Ke+=1],_t(yt)){var It=yt.code(e,yt.keyword,B.type);It&&(r+=" "+It+" ",T&&(x+="}"))}}if(T&&(r+=" "+x+" ",x=""),B.type&&(r+=" } ",z&&z===B.type&&!ee)){r+=" else { ";var d=e.schemaPath+".type",m=e.errSchemaPath+"/type",h=h||[];h.push(r),r="",e.createErrors!==!1?(r+=" { keyword: '"+(V||"type")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(m)+" , params: { type: '",Y?r+=""+z.join(","):r+=""+z,r+="' } ",e.opts.messages!==!1&&(r+=" , message: 'should be ",Y?r+=""+z.join(","):r+=""+z,r+="' "),e.opts.verbose&&(r+=" , schema: validate.schema"+d+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),r+=" } "):r+=" {} ";var v=r;r=h.pop(),!e.compositeRule&&T?e.async?r+=" throw new ValidationError(["+v+"]); ":r+=" validate.errors = ["+v+"]; return false; ":r+=" var err = "+v+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" } "}T&&(r+=" if (errors === ",$?r+="0":r+="errs_"+u,r+=") { ",K+="}")}}}T&&(r+=" "+K+" "),$?(n?(r+=" if (errors === 0) return data; ",r+=" else throw new ValidationError(vErrors); "):(r+=" validate.errors = vErrors; ",r+=" return errors === 0; "),r+=" }; return validate;"):r+=" var "+k+" = errors === errs_"+u+";";function qe(Me){for(var Le=Me.rules,Ye=0;Ye<Le.length;Ye++)if(_t(Le[Ye]))return!0}function _t(Me){return e.schema[Me.keyword]!==void 0||Me.implements&&Xt(Me)}function Xt(Me){for(var Le=Me.implements,Ye=0;Ye<Le.length;Ye++)if(e.schema[Le[Ye]]!==void 0)return!0}return r},zs=ho,Hs=Jr,Tu=yo,kg=ku,Cu=Ou,Og=Hs.ucs2length,Tg=ia,Cg=Tu.Validation,Ig=$o;function $o(t,e,a,s){var r=this,n=this._opts,i=[void 0],o={},c=[],l={},u=[],f={},y=[];e=e||{schema:t,refVal:i,refs:o};var d=Ng.call(this,t,e,s),m=this._compilations[d.index];if(d.compiling)return m.callValidate=P;var p=this._formats,h=this.RULES;try{var v=k(t,e,a,s);m.validate=v;var $=m.callValidate;return $&&($.schema=v.schema,$.errors=null,$.refs=v.refs,$.refVal=v.refVal,$.root=v.root,$.$async=v.$async,n.sourceCode&&($.source=v.source)),v}finally{Ag.call(this,t,e,s)}function P(){var F=m.validate,M=F.apply(this,arguments);return P.errors=F.errors,M}function k(F,M,re,_e){var ve=!M||M&&M.schema==F;if(M.schema!=e.schema)return $o.call(r,F,M,re,_e);var be=F.$async===!0,de=Cu({isTop:!0,schema:F,isRoot:ve,baseId:_e,root:M,schemaPath:"",errSchemaPath:"#",errorPath:'""',MissingRefError:Tu.MissingRef,RULES:h,validate:Cu,util:Hs,resolve:zs,resolveRef:T,usePattern:Y,useDefault:ee,useCustomRule:B,opts:n,formats:p,logger:r.logger,self:r});de=Zs(i,xg)+Zs(c,jg)+Zs(u,Dg)+Zs(y,Mg)+de,n.processCode&&(de=n.processCode(de,F));var j;try{var S=new Function("self","RULES","formats","root","refVal","defaults","customRules","equal","ucs2length","ValidationError",de);j=S(r,h,p,e,i,u,y,Tg,Og,Cg),i[0]=j}catch(D){throw r.logger.error("Error compiling schema, function code:",de),D}return j.schema=F,j.errors=null,j.refs=o,j.refVal=i,j.root=ve?j:M,be&&(j.$async=!0),n.sourceCode===!0&&(j.source={code:de,patterns:c,defaults:u}),j}function T(F,M,re){M=zs.url(F,M);var _e=o[M],ve,be;if(_e!==void 0)return ve=i[_e],be="refVal["+_e+"]",z(ve,be);if(!re&&e.refs){var de=e.refs[M];if(de!==void 0)return ve=e.refVal[de],be=x(M,ve),z(ve,be)}be=x(M);var j=zs.call(r,k,e,M);if(j===void 0){var S=a&&a[M];S&&(j=zs.inlineRef(S,n.inlineRefs)?S:$o.call(r,S,e,a,F))}if(j===void 0)K(M);else return V(M,j),z(j,be)}function x(F,M){var re=i.length;return i[re]=M,o[F]=re,"refVal"+re}function K(F){delete o[F]}function V(F,M){var re=o[F];i[re]=M}function z(F,M){return typeof F=="object"||typeof F=="boolean"?{code:M,schema:F,inline:!0}:{code:M,$async:F&&!!F.$async}}function Y(F){var M=l[F];return M===void 0&&(M=l[F]=c.length,c[M]=F),"pattern"+M}function ee(F){switch(typeof F){case"boolean":case"number":return""+F;case"string":return Hs.toQuotedString(F);case"object":if(F===null)return"null";var M=kg(F),re=f[M];return re===void 0&&(re=f[M]=u.length,u[re]=F),"default"+re}}function B(F,M,re,_e){if(r._opts.validateSchema!==!1){var ve=F.definition.dependencies;if(ve&&!ve.every(function(A){return Object.prototype.hasOwnProperty.call(re,A)}))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 j="keyword schema is invalid: "+r.errorsText(be.errors);if(r._opts.validateSchema=="log")r.logger.error(j);else throw new Error(j)}}}var S=F.definition.compile,D=F.definition.inline,O=F.definition.macro,g;if(S)g=S.call(r,M,re,_e);else if(O)g=O.call(r,M,re,_e),n.validateSchema!==!1&&r.validateSchema(g,!0);else if(D)g=D.call(r,_e,F.keyword,M,re);else if(g=F.definition.validate,!g)return;if(g===void 0)throw new Error('custom keyword "'+F.keyword+'"failed to compile');var w=y.length;return y[w]=g,{code:"customRule"+w,validate:g}}}function Ng(t,e,a){var s=Iu.call(this,t,e,a);return s>=0?{index:s,compiling:!0}:(s=this._compilations.length,this._compilations[s]={schema:t,root:e,baseId:a},{index:s,compiling:!1})}function Ag(t,e,a){var s=Iu.call(this,t,e,a);s>=0&&this._compilations.splice(s,1)}function Iu(t,e,a){for(var s=0;s<this._compilations.length;s++){var r=this._compilations[s];if(r.schema==t&&r.root==e&&r.baseId==a)return s}return-1}function jg(t,e){return"var pattern"+t+" = new RegExp("+Hs.toQuotedString(e[t])+");"}function Dg(t){return"var default"+t+" = defaults["+t+"];"}function xg(t,e){return e[t]===void 0?"":"var refVal"+t+" = refVal["+t+"];"}function Mg(t){return"var customRule"+t+" = customRules["+t+"];"}function Zs(t,e){if(!t.length)return"";for(var a="",s=0;s<t.length;s++)a+=e(s,t);return a}var Nu={exports:{}},Ks=Nu.exports=function(){this._cache={}};Ks.prototype.put=function(e,a){this._cache[e]=a},Ks.prototype.get=function(e){return this._cache[e]},Ks.prototype.del=function(e){delete this._cache[e]},Ks.prototype.clear=function(){this._cache={}};var Lg=Nu.exports,Fg=Jr,qg=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,Ug=[0,31,28,31,30,31,30,31,31,30,31,30,31],Vg=/^(\d\d):(\d\d):(\d\d)(\.\d+)?(z|[+-]\d\d(?::?\d\d)?)?$/i,Au=/^(?=.{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,zg=/^(?:[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,Hg=/^(?:[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,ju=/^(?:(?:[^\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,Du=/^(?:(?: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,xu=/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,Mu=/^(?:\/(?:[^~/]|~0|~1)*)*$/,Lu=/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,Fu=/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,Zg=Bs;function Bs(t){return t=t=="full"?"full":"fast",Fg.copy(Bs[t])}Bs.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":ju,url:Du,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:Au,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:Vu,uuid:xu,"json-pointer":Mu,"json-pointer-uri-fragment":Lu,"relative-json-pointer":Fu},Bs.full={date:qu,time:Uu,"date-time":Jg,uri:Gg,"uri-reference":Hg,"uri-template":ju,url:Du,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:Au,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:Vu,uuid:xu,"json-pointer":Mu,"json-pointer-uri-fragment":Lu,"relative-json-pointer":Fu};function Kg(t){return t%4===0&&(t%100!==0||t%400===0)}function qu(t){var e=t.match(qg);if(!e)return!1;var a=+e[1],s=+e[2],r=+e[3];return s>=1&&s<=12&&r>=1&&r<=(s==2&&Kg(a)?29:Ug[s])}function Uu(t,e){var a=t.match(Vg);if(!a)return!1;var s=a[1],r=a[2],n=a[3],i=a[5];return(s<=23&&r<=59&&n<=59||s==23&&r==59&&n==60)&&(!e||i)}var Bg=/t|\s/i;function Jg(t){var e=t.split(Bg);return e.length==2&&qu(e[0])&&Uu(e[1],!0)}var Qg=/\/|:/;function Gg(t){return Qg.test(t)&&zg.test(t)}var Wg=/[^\\]\\Z/;function Vu(t){if(Wg.test(t))return!1;try{return new RegExp(t),!0}catch{return!1}}var Yg=function(e,a,s){var r=" ",n=e.level,i=e.dataLevel,o=e.schema[a],c=e.errSchemaPath+"/"+a,l=!e.opts.allErrors,u="data"+(i||""),f="valid"+n,y,d;if(o=="#"||o=="#/")e.isRoot?(y=e.async,d="validate"):(y=e.root.schema.$async===!0,d="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(r),r="",e.createErrors!==!1?(r+=" { keyword: '$ref' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { ref: '"+e.util.escapeQuotes(o)+"' } ",e.opts.messages!==!1&&(r+=" , message: 'can\\'t resolve reference "+e.util.escapeQuotes(o)+"' "),e.opts.verbose&&(r+=" , schema: "+e.util.toQuotedString(o)+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+u+" "),r+=" } "):r+=" {} ";var v=r;r=h.pop(),!e.compositeRule&&l?e.async?r+=" throw new ValidationError(["+v+"]); ":r+=" validate.errors = ["+v+"]; return false; ":r+=" var err = "+v+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",l&&(r+=" if (false) { ")}else if(e.opts.missingRefs=="ignore")e.logger.warn(p),l&&(r+=" if (true) { ");else throw new e.MissingRefError(e.baseId,o,p)}else if(m.inline){var $=e.util.copy(e);$.level++;var P="valid"+$.level;$.schema=m.schema,$.schemaPath="",$.errSchemaPath=o;var k=e.validate($).replace(/validate\.schema/g,m.code);r+=" "+k+" ",l&&(r+=" if ("+P+") { ")}else y=m.$async===!0||e.async&&m.$async!==!1,d=m.code}if(d){var h=h||[];h.push(r),r="",e.opts.passContext?r+=" "+d+".call(this, ":r+=" "+d+"( ",r+=" "+u+", (dataPath || '')",e.errorPath!='""'&&(r+=" + "+e.errorPath);var T=i?"data"+(i-1||""):"parentData",x=i?e.dataPathArr[i]:"parentDataProperty";r+=" , "+T+" , "+x+", rootData) ";var K=r;if(r=h.pop(),y){if(!e.async)throw new Error("async schema referenced by sync schema");l&&(r+=" var "+f+"; "),r+=" try { await "+K+"; ",l&&(r+=" "+f+" = true; "),r+=" } catch (e) { if (!(e instanceof ValidationError)) throw e; if (vErrors === null) vErrors = e.errors; else vErrors = vErrors.concat(e.errors); errors = vErrors.length; ",l&&(r+=" "+f+" = false; "),r+=" } ",l&&(r+=" if ("+f+") { ")}else r+=" if (!"+K+") { if (vErrors === null) vErrors = "+d+".errors; else vErrors = vErrors.concat("+d+".errors); errors = vErrors.length; } ",l&&(r+=" else { ")}return r},Xg=function(e,a,s){var r=" ",n=e.schema[a],i=e.schemaPath+e.util.getProperty(a),o=e.errSchemaPath+"/"+a,c=!e.opts.allErrors,l=e.util.copy(e),u="";l.level++;var f="valid"+l.level,y=l.baseId,d=!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))&&(d=!1,l.schema=p,l.schemaPath=i+"["+h+"]",l.errSchemaPath=o+"/"+h,r+=" "+e.validate(l)+" ",l.baseId=y,c&&(r+=" if ("+f+") { ",u+="}"));return c&&(d?r+=" if (true) { ":r+=" "+u.slice(0,-1)+" "),r},ey=function(e,a,s){var r=" ",n=e.level,i=e.dataLevel,o=e.schema[a],c=e.schemaPath+e.util.getProperty(a),l=e.errSchemaPath+"/"+a,u=!e.opts.allErrors,f="data"+(i||""),y="valid"+n,d="errs__"+n,m=e.util.copy(e),p="";m.level++;var h="valid"+m.level,v=o.every(function(V){return e.opts.strictKeywords?typeof V=="object"&&Object.keys(V).length>0||V===!1:e.util.schemaHasRules(V,e.RULES.all)});if(v){var $=m.baseId;r+=" var "+d+" = errors; var "+y+" = false; ";var P=e.compositeRule;e.compositeRule=m.compositeRule=!0;var k=o;if(k)for(var T,x=-1,K=k.length-1;x<K;)T=k[x+=1],m.schema=T,m.schemaPath=c+"["+x+"]",m.errSchemaPath=l+"/"+x,r+=" "+e.validate(m)+" ",m.baseId=$,r+=" "+y+" = "+y+" || "+h+"; if (!"+y+") { ",p+="}";e.compositeRule=m.compositeRule=P,r+=" "+p+" if (!"+y+") { var err = ",e.createErrors!==!1?(r+=" { keyword: 'anyOf' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(l)+" , params: {} ",e.opts.messages!==!1&&(r+=" , message: 'should match some schema in anyOf' "),e.opts.verbose&&(r+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),r+=" } "):r+=" {} ",r+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!e.compositeRule&&u&&(e.async?r+=" throw new ValidationError(vErrors); ":r+=" validate.errors = vErrors; return false; "),r+=" } else { errors = "+d+"; if (vErrors !== null) { if ("+d+") vErrors.length = "+d+"; else vErrors = null; } ",e.opts.allErrors&&(r+=" } ")}else u&&(r+=" if (true) { ");return r},ty=function(e,a,s){var r=" ",n=e.schema[a],i=e.errSchemaPath+"/"+a;e.opts.allErrors;var o=e.util.toQuotedString(n);return e.opts.$comment===!0?r+=" console.log("+o+");":typeof e.opts.$comment=="function"&&(r+=" self._opts.$comment("+o+", "+e.util.toQuotedString(i)+", validate.root.schema);"),r},ry=function(e,a,s){var r=" ",n=e.level,i=e.dataLevel,o=e.schema[a],c=e.schemaPath+e.util.getProperty(a),l=e.errSchemaPath+"/"+a,u=!e.opts.allErrors,f="data"+(i||""),y="valid"+n,d=e.opts.$data&&o&&o.$data;d&&(r+=" var schema"+n+" = "+e.util.getData(o.$data,i,e.dataPathArr)+"; "),d||(r+=" var schema"+n+" = validate.schema"+c+";"),r+="var "+y+" = equal("+f+", schema"+n+"); if (!"+y+") { ";var m=m||[];m.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'const' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(l)+" , params: { allowedValue: schema"+n+" } ",e.opts.messages!==!1&&(r+=" , message: 'should be equal to constant' "),e.opts.verbose&&(r+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),r+=" } "):r+=" {} ";var p=r;return r=m.pop(),!e.compositeRule&&u?e.async?r+=" throw new ValidationError(["+p+"]); ":r+=" validate.errors = ["+p+"]; return false; ":r+=" var err = "+p+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" }",u&&(r+=" else { "),r},ay=function(e,a,s){var r=" ",n=e.level,i=e.dataLevel,o=e.schema[a],c=e.schemaPath+e.util.getProperty(a),l=e.errSchemaPath+"/"+a,u=!e.opts.allErrors,f="data"+(i||""),y="valid"+n,d="errs__"+n,m=e.util.copy(e),p="";m.level++;var h="valid"+m.level,v="i"+n,$=m.dataLevel=e.dataLevel+1,P="data"+$,k=e.baseId,T=e.opts.strictKeywords?typeof o=="object"&&Object.keys(o).length>0||o===!1:e.util.schemaHasRules(o,e.RULES.all);if(r+="var "+d+" = errors;var "+y+";",T){var x=e.compositeRule;e.compositeRule=m.compositeRule=!0,m.schema=o,m.schemaPath=c,m.errSchemaPath=l,r+=" var "+h+" = false; for (var "+v+" = 0; "+v+" < "+f+".length; "+v+"++) { ",m.errorPath=e.util.getPathExpr(e.errorPath,v,e.opts.jsonPointers,!0);var K=f+"["+v+"]";m.dataPathArr[$]=v;var V=e.validate(m);m.baseId=k,e.util.varOccurences(V,P)<2?r+=" "+e.util.varReplace(V,P,K)+" ":r+=" var "+P+" = "+K+"; "+V+" ",r+=" if ("+h+") break; } ",e.compositeRule=m.compositeRule=x,r+=" "+p+" if (!"+h+") {"}else r+=" if ("+f+".length == 0) {";var z=z||[];z.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'contains' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(l)+" , params: {} ",e.opts.messages!==!1&&(r+=" , message: 'should contain a valid item' "),e.opts.verbose&&(r+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),r+=" } "):r+=" {} ";var Y=r;return r=z.pop(),!e.compositeRule&&u?e.async?r+=" throw new ValidationError(["+Y+"]); ":r+=" validate.errors = ["+Y+"]; return false; ":r+=" var err = "+Y+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" } else { ",T&&(r+=" errors = "+d+"; if (vErrors !== null) { if ("+d+") vErrors.length = "+d+"; else vErrors = null; } "),e.opts.allErrors&&(r+=" } "),r},sy=function(e,a,s){var r=" ",n=e.level,i=e.dataLevel,o=e.schema[a],c=e.schemaPath+e.util.getProperty(a),l=e.errSchemaPath+"/"+a,u=!e.opts.allErrors,f="data"+(i||""),y="errs__"+n,d=e.util.copy(e),m="";d.level++;var p="valid"+d.level,h={},v={},$=e.opts.ownProperties;for(x in o)if(x!="__proto__"){var P=o[x],k=Array.isArray(P)?v:h;k[x]=P}r+="var "+y+" = errors;";var T=e.errorPath;r+="var missing"+n+";";for(var x in v)if(k=v[x],k.length){if(r+=" if ( "+f+e.util.getProperty(x)+" !== undefined ",$&&(r+=" && Object.prototype.hasOwnProperty.call("+f+", '"+e.util.escapeQuotes(x)+"') "),u){r+=" && ( ";var K=k;if(K)for(var V,z=-1,Y=K.length-1;z<Y;){V=K[z+=1],z&&(r+=" || ");var ee=e.util.getProperty(V),B=f+ee;r+=" ( ( "+B+" === undefined ",$&&(r+=" || ! Object.prototype.hasOwnProperty.call("+f+", '"+e.util.escapeQuotes(V)+"') "),r+=") && (missing"+n+" = "+e.util.toQuotedString(e.opts.jsonPointers?V:ee)+") ) "}r+=")) { ";var F="missing"+n,M="' + "+F+" + '";e.opts._errorDataPathProperty&&(e.errorPath=e.opts.jsonPointers?e.util.getPathExpr(T,F,!0):T+" + "+F);var re=re||[];re.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'dependencies' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(l)+" , params: { property: '"+e.util.escapeQuotes(x)+"', missingProperty: '"+M+"', depsCount: "+k.length+", deps: '"+e.util.escapeQuotes(k.length==1?k[0]:k.join(", "))+"' } ",e.opts.messages!==!1&&(r+=" , message: 'should have ",k.length==1?r+="property "+e.util.escapeQuotes(k[0]):r+="properties "+e.util.escapeQuotes(k.join(", ")),r+=" when property "+e.util.escapeQuotes(x)+" is present' "),e.opts.verbose&&(r+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),r+=" } "):r+=" {} ";var _e=r;r=re.pop(),!e.compositeRule&&u?e.async?r+=" throw new ValidationError(["+_e+"]); ":r+=" validate.errors = ["+_e+"]; return false; ":r+=" var err = "+_e+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "}else{r+=" ) { ";var ve=k;if(ve)for(var V,be=-1,de=ve.length-1;be<de;){V=ve[be+=1];var ee=e.util.getProperty(V),M=e.util.escapeQuotes(V),B=f+ee;e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPath(T,V,e.opts.jsonPointers)),r+=" if ( "+B+" === undefined ",$&&(r+=" || ! Object.prototype.hasOwnProperty.call("+f+", '"+e.util.escapeQuotes(V)+"') "),r+=") { var err = ",e.createErrors!==!1?(r+=" { keyword: 'dependencies' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(l)+" , params: { property: '"+e.util.escapeQuotes(x)+"', missingProperty: '"+M+"', depsCount: "+k.length+", deps: '"+e.util.escapeQuotes(k.length==1?k[0]:k.join(", "))+"' } ",e.opts.messages!==!1&&(r+=" , message: 'should have ",k.length==1?r+="property "+e.util.escapeQuotes(k[0]):r+="properties "+e.util.escapeQuotes(k.join(", ")),r+=" when property "+e.util.escapeQuotes(x)+" is present' "),e.opts.verbose&&(r+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),r+=" } "):r+=" {} ",r+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } "}}r+=" } ",u&&(m+="}",r+=" else { ")}e.errorPath=T;var j=d.baseId;for(var x in h){var P=h[x];(e.opts.strictKeywords?typeof P=="object"&&Object.keys(P).length>0||P===!1:e.util.schemaHasRules(P,e.RULES.all))&&(r+=" "+p+" = true; if ( "+f+e.util.getProperty(x)+" !== undefined ",$&&(r+=" && Object.prototype.hasOwnProperty.call("+f+", '"+e.util.escapeQuotes(x)+"') "),r+=") { ",d.schema=P,d.schemaPath=c+e.util.getProperty(x),d.errSchemaPath=l+"/"+e.util.escapeFragment(x),r+=" "+e.validate(d)+" ",d.baseId=j,r+=" } ",u&&(r+=" if ("+p+") { ",m+="}"))}return u&&(r+=" "+m+" if ("+y+" == errors) {"),r},ny=function(e,a,s){var r=" ",n=e.level,i=e.dataLevel,o=e.schema[a],c=e.schemaPath+e.util.getProperty(a),l=e.errSchemaPath+"/"+a,u=!e.opts.allErrors,f="data"+(i||""),y="valid"+n,d=e.opts.$data&&o&&o.$data;d&&(r+=" var schema"+n+" = "+e.util.getData(o.$data,i,e.dataPathArr)+"; ");var m="i"+n,p="schema"+n;d||(r+=" var "+p+" = validate.schema"+c+";"),r+="var "+y+";",d&&(r+=" if (schema"+n+" === undefined) "+y+" = true; else if (!Array.isArray(schema"+n+")) "+y+" = false; else {"),r+=""+y+" = false;for (var "+m+"=0; "+m+"<"+p+".length; "+m+"++) if (equal("+f+", "+p+"["+m+"])) { "+y+" = true; break; }",d&&(r+=" } "),r+=" if (!"+y+") { ";var h=h||[];h.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'enum' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(l)+" , params: { allowedValues: schema"+n+" } ",e.opts.messages!==!1&&(r+=" , message: 'should be equal to one of the allowed values' "),e.opts.verbose&&(r+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),r+=" } "):r+=" {} ";var v=r;return r=h.pop(),!e.compositeRule&&u?e.async?r+=" throw new ValidationError(["+v+"]); ":r+=" validate.errors = ["+v+"]; return false; ":r+=" var err = "+v+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" }",u&&(r+=" else { "),r},iy=function(e,a,s){var r=" ",n=e.level,i=e.dataLevel,o=e.schema[a],c=e.schemaPath+e.util.getProperty(a),l=e.errSchemaPath+"/"+a,u=!e.opts.allErrors,f="data"+(i||"");if(e.opts.format===!1)return u&&(r+=" if (true) { "),r;var y=e.opts.$data&&o&&o.$data,d;y?(r+=" var schema"+n+" = "+e.util.getData(o.$data,i,e.dataPathArr)+"; ",d="schema"+n):d=o;var m=e.opts.unknownFormats,p=Array.isArray(m);if(y){var h="format"+n,v="isObject"+n,$="formatType"+n;r+=" var "+h+" = formats["+d+"]; var "+v+" = typeof "+h+" == 'object' && !("+h+" instanceof RegExp) && "+h+".validate; var "+$+" = "+v+" && "+h+".type || 'string'; if ("+v+") { ",e.async&&(r+=" var async"+n+" = "+h+".async; "),r+=" "+h+" = "+h+".validate; } if ( ",y&&(r+=" ("+d+" !== undefined && typeof "+d+" != 'string') || "),r+=" (",m!="ignore"&&(r+=" ("+d+" && !"+h+" ",p&&(r+=" && self._opts.unknownFormats.indexOf("+d+") == -1 "),r+=") || "),r+=" ("+h+" && "+$+" == '"+s+"' && !(typeof "+h+" == 'function' ? ",e.async?r+=" (async"+n+" ? await "+h+"("+f+") : "+h+"("+f+")) ":r+=" "+h+"("+f+") ",r+=" : "+h+".test("+f+"))))) {"}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&&(r+=" if (true) { "),r;if(p&&m.indexOf(o)>=0)return u&&(r+=" if (true) { "),r;throw new Error('unknown format "'+o+'" is used in schema at path "'+e.errSchemaPath+'"')}var v=typeof h=="object"&&!(h instanceof RegExp)&&h.validate,$=v&&h.type||"string";if(v){var P=h.async===!0;h=h.validate}if($!=s)return u&&(r+=" if (true) { "),r;if(P){if(!e.async)throw new Error("async format in sync schema");var k="formats"+e.util.getProperty(o)+".validate";r+=" if (!(await "+k+"("+f+"))) { "}else{r+=" if (! ";var k="formats"+e.util.getProperty(o);v&&(k+=".validate"),typeof h=="function"?r+=" "+k+"("+f+") ":r+=" "+k+".test("+f+") ",r+=") { "}}var T=T||[];T.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'format' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(l)+" , params: { format: ",y?r+=""+d:r+=""+e.util.toQuotedString(o),r+=" } ",e.opts.messages!==!1&&(r+=` , message: 'should match format "`,y?r+="' + "+d+" + '":r+=""+e.util.escapeQuotes(o),r+=`"' `),e.opts.verbose&&(r+=" , schema: ",y?r+="validate.schema"+c:r+=""+e.util.toQuotedString(o),r+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),r+=" } "):r+=" {} ";var x=r;return r=T.pop(),!e.compositeRule&&u?e.async?r+=" throw new ValidationError(["+x+"]); ":r+=" validate.errors = ["+x+"]; return false; ":r+=" var err = "+x+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" } ",u&&(r+=" else { "),r},oy=function(e,a,s){var r=" ",n=e.level,i=e.dataLevel,o=e.schema[a],c=e.schemaPath+e.util.getProperty(a),l=e.errSchemaPath+"/"+a,u=!e.opts.allErrors,f="data"+(i||""),y="valid"+n,d="errs__"+n,m=e.util.copy(e);m.level++;var p="valid"+m.level,h=e.schema.then,v=e.schema.else,$=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)),k=m.baseId;if($||P){var T;m.createErrors=!1,m.schema=o,m.schemaPath=c,m.errSchemaPath=l,r+=" var "+d+" = errors; var "+y+" = true; ";var x=e.compositeRule;e.compositeRule=m.compositeRule=!0,r+=" "+e.validate(m)+" ",m.baseId=k,m.createErrors=!0,r+=" errors = "+d+"; if (vErrors !== null) { if ("+d+") vErrors.length = "+d+"; else vErrors = null; } ",e.compositeRule=m.compositeRule=x,$?(r+=" if ("+p+") { ",m.schema=e.schema.then,m.schemaPath=e.schemaPath+".then",m.errSchemaPath=e.errSchemaPath+"/then",r+=" "+e.validate(m)+" ",m.baseId=k,r+=" "+y+" = "+p+"; ",$&&P?(T="ifClause"+n,r+=" var "+T+" = 'then'; "):T="'then'",r+=" } ",P&&(r+=" else { ")):r+=" if (!"+p+") { ",P&&(m.schema=e.schema.else,m.schemaPath=e.schemaPath+".else",m.errSchemaPath=e.errSchemaPath+"/else",r+=" "+e.validate(m)+" ",m.baseId=k,r+=" "+y+" = "+p+"; ",$&&P?(T="ifClause"+n,r+=" var "+T+" = 'else'; "):T="'else'",r+=" } "),r+=" if (!"+y+") { var err = ",e.createErrors!==!1?(r+=" { keyword: 'if' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(l)+" , params: { failingKeyword: "+T+" } ",e.opts.messages!==!1&&(r+=` , message: 'should match "' + `+T+` + '" schema' `),e.opts.verbose&&(r+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),r+=" } "):r+=" {} ",r+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!e.compositeRule&&u&&(e.async?r+=" throw new ValidationError(vErrors); ":r+=" validate.errors = vErrors; return false; "),r+=" } ",u&&(r+=" else { ")}else u&&(r+=" if (true) { ");return r},ly=function(e,a,s){var r=" ",n=e.level,i=e.dataLevel,o=e.schema[a],c=e.schemaPath+e.util.getProperty(a),l=e.errSchemaPath+"/"+a,u=!e.opts.allErrors,f="data"+(i||""),y="valid"+n,d="errs__"+n,m=e.util.copy(e),p="";m.level++;var h="valid"+m.level,v="i"+n,$=m.dataLevel=e.dataLevel+1,P="data"+$,k=e.baseId;if(r+="var "+d+" = errors;var "+y+";",Array.isArray(o)){var T=e.schema.additionalItems;if(T===!1){r+=" "+y+" = "+f+".length <= "+o.length+"; ";var x=l;l=e.errSchemaPath+"/additionalItems",r+=" if (!"+y+") { ";var K=K||[];K.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'additionalItems' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(l)+" , params: { limit: "+o.length+" } ",e.opts.messages!==!1&&(r+=" , message: 'should NOT have more than "+o.length+" items' "),e.opts.verbose&&(r+=" , schema: false , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),r+=" } "):r+=" {} ";var V=r;r=K.pop(),!e.compositeRule&&u?e.async?r+=" throw new ValidationError(["+V+"]); ":r+=" validate.errors = ["+V+"]; return false; ":r+=" var err = "+V+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" } ",l=x,u&&(p+="}",r+=" else { ")}var z=o;if(z){for(var Y,ee=-1,B=z.length-1;ee<B;)if(Y=z[ee+=1],e.opts.strictKeywords?typeof Y=="object"&&Object.keys(Y).length>0||Y===!1:e.util.schemaHasRules(Y,e.RULES.all)){r+=" "+h+" = true; if ("+f+".length > "+ee+") { ";var F=f+"["+ee+"]";m.schema=Y,m.schemaPath=c+"["+ee+"]",m.errSchemaPath=l+"/"+ee,m.errorPath=e.util.getPathExpr(e.errorPath,ee,e.opts.jsonPointers,!0),m.dataPathArr[$]=ee;var M=e.validate(m);m.baseId=k,e.util.varOccurences(M,P)<2?r+=" "+e.util.varReplace(M,P,F)+" ":r+=" var "+P+" = "+F+"; "+M+" ",r+=" } ",u&&(r+=" if ("+h+") { ",p+="}")}}if(typeof T=="object"&&(e.opts.strictKeywords?typeof T=="object"&&Object.keys(T).length>0||T===!1:e.util.schemaHasRules(T,e.RULES.all))){m.schema=T,m.schemaPath=e.schemaPath+".additionalItems",m.errSchemaPath=e.errSchemaPath+"/additionalItems",r+=" "+h+" = true; if ("+f+".length > "+o.length+") { for (var "+v+" = "+o.length+"; "+v+" < "+f+".length; "+v+"++) { ",m.errorPath=e.util.getPathExpr(e.errorPath,v,e.opts.jsonPointers,!0);var F=f+"["+v+"]";m.dataPathArr[$]=v;var M=e.validate(m);m.baseId=k,e.util.varOccurences(M,P)<2?r+=" "+e.util.varReplace(M,P,F)+" ":r+=" var "+P+" = "+F+"; "+M+" ",u&&(r+=" if (!"+h+") break; "),r+=" } } ",u&&(r+=" 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=c,m.errSchemaPath=l,r+=" for (var "+v+" = 0; "+v+" < "+f+".length; "+v+"++) { ",m.errorPath=e.util.getPathExpr(e.errorPath,v,e.opts.jsonPointers,!0);var F=f+"["+v+"]";m.dataPathArr[$]=v;var M=e.validate(m);m.baseId=k,e.util.varOccurences(M,P)<2?r+=" "+e.util.varReplace(M,P,F)+" ":r+=" var "+P+" = "+F+"; "+M+" ",u&&(r+=" if (!"+h+") break; "),r+=" }"}return u&&(r+=" "+p+" if ("+d+" == errors) {"),r},zu=function(e,a,s){var r=" ",n=e.level,i=e.dataLevel,o=e.schema[a],c=e.schemaPath+e.util.getProperty(a),l=e.errSchemaPath+"/"+a,u=!e.opts.allErrors,k,f="data"+(i||""),y=e.opts.$data&&o&&o.$data,d;y?(r+=" var schema"+n+" = "+e.util.getData(o.$data,i,e.dataPathArr)+"; ",d="schema"+n):d=o;var m=a=="maximum",p=m?"exclusiveMaximum":"exclusiveMinimum",h=e.schema[p],v=e.opts.$data&&h&&h.$data,$=m?"<":">",P=m?">":"<",k=void 0;if(!(y||typeof o=="number"||o===void 0))throw new Error(a+" 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 T=e.util.getData(h.$data,i,e.dataPathArr),x="exclusive"+n,K="exclType"+n,V="exclIsNumber"+n,z="op"+n,Y="' + "+z+" + '";r+=" var schemaExcl"+n+" = "+T+"; ",T="schemaExcl"+n,r+=" var "+x+"; var "+K+" = typeof "+T+"; if ("+K+" != 'boolean' && "+K+" != 'undefined' && "+K+" != 'number') { ";var k=p,ee=ee||[];ee.push(r),r="",e.createErrors!==!1?(r+=" { keyword: '"+(k||"_exclusiveLimit")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(l)+" , params: {} ",e.opts.messages!==!1&&(r+=" , message: '"+p+" should be boolean' "),e.opts.verbose&&(r+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),r+=" } "):r+=" {} ";var B=r;r=ee.pop(),!e.compositeRule&&u?e.async?r+=" throw new ValidationError(["+B+"]); ":r+=" validate.errors = ["+B+"]; return false; ":r+=" var err = "+B+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" } else if ( ",y&&(r+=" ("+d+" !== undefined && typeof "+d+" != 'number') || "),r+=" "+K+" == 'number' ? ( ("+x+" = "+d+" === undefined || "+T+" "+$+"= "+d+") ? "+f+" "+P+"= "+T+" : "+f+" "+P+" "+d+" ) : ( ("+x+" = "+T+" === true) ? "+f+" "+P+"= "+d+" : "+f+" "+P+" "+d+" ) || "+f+" !== "+f+") { var op"+n+" = "+x+" ? '"+$+"' : '"+$+"='; ",o===void 0&&(k=p,l=e.errSchemaPath+"/"+p,d=T,y=v)}else{var V=typeof h=="number",Y=$;if(V&&y){var z="'"+Y+"'";r+=" if ( ",y&&(r+=" ("+d+" !== undefined && typeof "+d+" != 'number') || "),r+=" ( "+d+" === undefined || "+h+" "+$+"= "+d+" ? "+f+" "+P+"= "+h+" : "+f+" "+P+" "+d+" ) || "+f+" !== "+f+") { "}else{V&&o===void 0?(x=!0,k=p,l=e.errSchemaPath+"/"+p,d=h,P+="="):(V&&(d=Math[m?"min":"max"](h,o)),h===(V?d:!0)?(x=!0,k=p,l=e.errSchemaPath+"/"+p,P+="="):(x=!1,Y+="="));var z="'"+Y+"'";r+=" if ( ",y&&(r+=" ("+d+" !== undefined && typeof "+d+" != 'number') || "),r+=" "+f+" "+P+" "+d+" || "+f+" !== "+f+") { "}}k=k||a;var ee=ee||[];ee.push(r),r="",e.createErrors!==!1?(r+=" { keyword: '"+(k||"_limit")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(l)+" , params: { comparison: "+z+", limit: "+d+", exclusive: "+x+" } ",e.opts.messages!==!1&&(r+=" , message: 'should be "+Y+" ",y?r+="' + "+d:r+=""+d+"'"),e.opts.verbose&&(r+=" , schema: ",y?r+="validate.schema"+c:r+=""+o,r+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),r+=" } "):r+=" {} ";var B=r;return r=ee.pop(),!e.compositeRule&&u?e.async?r+=" throw new ValidationError(["+B+"]); ":r+=" validate.errors = ["+B+"]; return false; ":r+=" var err = "+B+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" } ",u&&(r+=" else { "),r},Hu=function(e,a,s){var r=" ",n=e.level,i=e.dataLevel,o=e.schema[a],c=e.schemaPath+e.util.getProperty(a),l=e.errSchemaPath+"/"+a,u=!e.opts.allErrors,p,f="data"+(i||""),y=e.opts.$data&&o&&o.$data,d;if(y?(r+=" var schema"+n+" = "+e.util.getData(o.$data,i,e.dataPathArr)+"; ",d="schema"+n):d=o,!(y||typeof o=="number"))throw new Error(a+" must be number");var m=a=="maxItems"?">":"<";r+="if ( ",y&&(r+=" ("+d+" !== undefined && typeof "+d+" != 'number') || "),r+=" "+f+".length "+m+" "+d+") { ";var p=a,h=h||[];h.push(r),r="",e.createErrors!==!1?(r+=" { keyword: '"+(p||"_limitItems")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(l)+" , params: { limit: "+d+" } ",e.opts.messages!==!1&&(r+=" , message: 'should NOT have ",a=="maxItems"?r+="more":r+="fewer",r+=" than ",y?r+="' + "+d+" + '":r+=""+o,r+=" items' "),e.opts.verbose&&(r+=" , schema: ",y?r+="validate.schema"+c:r+=""+o,r+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),r+=" } "):r+=" {} ";var v=r;return r=h.pop(),!e.compositeRule&&u?e.async?r+=" throw new ValidationError(["+v+"]); ":r+=" validate.errors = ["+v+"]; return false; ":r+=" var err = "+v+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+="} ",u&&(r+=" else { "),r},Zu=function(e,a,s){var r=" ",n=e.level,i=e.dataLevel,o=e.schema[a],c=e.schemaPath+e.util.getProperty(a),l=e.errSchemaPath+"/"+a,u=!e.opts.allErrors,p,f="data"+(i||""),y=e.opts.$data&&o&&o.$data,d;if(y?(r+=" var schema"+n+" = "+e.util.getData(o.$data,i,e.dataPathArr)+"; ",d="schema"+n):d=o,!(y||typeof o=="number"))throw new Error(a+" must be number");var m=a=="maxLength"?">":"<";r+="if ( ",y&&(r+=" ("+d+" !== undefined && typeof "+d+" != 'number') || "),e.opts.unicode===!1?r+=" "+f+".length ":r+=" ucs2length("+f+") ",r+=" "+m+" "+d+") { ";var p=a,h=h||[];h.push(r),r="",e.createErrors!==!1?(r+=" { keyword: '"+(p||"_limitLength")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(l)+" , params: { limit: "+d+" } ",e.opts.messages!==!1&&(r+=" , message: 'should NOT be ",a=="maxLength"?r+="longer":r+="shorter",r+=" than ",y?r+="' + "+d+" + '":r+=""+o,r+=" characters' "),e.opts.verbose&&(r+=" , schema: ",y?r+="validate.schema"+c:r+=""+o,r+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),r+=" } "):r+=" {} ";var v=r;return r=h.pop(),!e.compositeRule&&u?e.async?r+=" throw new ValidationError(["+v+"]); ":r+=" validate.errors = ["+v+"]; return false; ":r+=" var err = "+v+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+="} ",u&&(r+=" else { "),r},Ku=function(e,a,s){var r=" ",n=e.level,i=e.dataLevel,o=e.schema[a],c=e.schemaPath+e.util.getProperty(a),l=e.errSchemaPath+"/"+a,u=!e.opts.allErrors,p,f="data"+(i||""),y=e.opts.$data&&o&&o.$data,d;if(y?(r+=" var schema"+n+" = "+e.util.getData(o.$data,i,e.dataPathArr)+"; ",d="schema"+n):d=o,!(y||typeof o=="number"))throw new Error(a+" must be number");var m=a=="maxProperties"?">":"<";r+="if ( ",y&&(r+=" ("+d+" !== undefined && typeof "+d+" != 'number') || "),r+=" Object.keys("+f+").length "+m+" "+d+") { ";var p=a,h=h||[];h.push(r),r="",e.createErrors!==!1?(r+=" { keyword: '"+(p||"_limitProperties")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(l)+" , params: { limit: "+d+" } ",e.opts.messages!==!1&&(r+=" , message: 'should NOT have ",a=="maxProperties"?r+="more":r+="fewer",r+=" than ",y?r+="' + "+d+" + '":r+=""+o,r+=" properties' "),e.opts.verbose&&(r+=" , schema: ",y?r+="validate.schema"+c:r+=""+o,r+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),r+=" } "):r+=" {} ";var v=r;return r=h.pop(),!e.compositeRule&&u?e.async?r+=" throw new ValidationError(["+v+"]); ":r+=" validate.errors = ["+v+"]; return false; ":r+=" var err = "+v+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+="} ",u&&(r+=" else { "),r},cy=function(e,a,s){var r=" ",n=e.level,i=e.dataLevel,o=e.schema[a],c=e.schemaPath+e.util.getProperty(a),l=e.errSchemaPath+"/"+a,u=!e.opts.allErrors,f="data"+(i||""),y=e.opts.$data&&o&&o.$data,d;if(y?(r+=" var schema"+n+" = "+e.util.getData(o.$data,i,e.dataPathArr)+"; ",d="schema"+n):d=o,!(y||typeof o=="number"))throw new Error(a+" must be number");r+="var division"+n+";if (",y&&(r+=" "+d+" !== undefined && ( typeof "+d+" != 'number' || "),r+=" (division"+n+" = "+f+" / "+d+", ",e.opts.multipleOfPrecision?r+=" Math.abs(Math.round(division"+n+") - division"+n+") > 1e-"+e.opts.multipleOfPrecision+" ":r+=" division"+n+" !== parseInt(division"+n+") ",r+=" ) ",y&&(r+=" ) "),r+=" ) { ";var m=m||[];m.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'multipleOf' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(l)+" , params: { multipleOf: "+d+" } ",e.opts.messages!==!1&&(r+=" , message: 'should be multiple of ",y?r+="' + "+d:r+=""+d+"'"),e.opts.verbose&&(r+=" , schema: ",y?r+="validate.schema"+c:r+=""+o,r+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),r+=" } "):r+=" {} ";var p=r;return r=m.pop(),!e.compositeRule&&u?e.async?r+=" throw new ValidationError(["+p+"]); ":r+=" validate.errors = ["+p+"]; return false; ":r+=" var err = "+p+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+="} ",u&&(r+=" else { "),r},uy=function(e,a,s){var r=" ",n=e.level,i=e.dataLevel,o=e.schema[a],c=e.schemaPath+e.util.getProperty(a),l=e.errSchemaPath+"/"+a,u=!e.opts.allErrors,f="data"+(i||""),y="errs__"+n,d=e.util.copy(e);d.level++;var m="valid"+d.level;if(e.opts.strictKeywords?typeof o=="object"&&Object.keys(o).length>0||o===!1:e.util.schemaHasRules(o,e.RULES.all)){d.schema=o,d.schemaPath=c,d.errSchemaPath=l,r+=" var "+y+" = errors; ";var p=e.compositeRule;e.compositeRule=d.compositeRule=!0,d.createErrors=!1;var h;d.opts.allErrors&&(h=d.opts.allErrors,d.opts.allErrors=!1),r+=" "+e.validate(d)+" ",d.createErrors=!0,h&&(d.opts.allErrors=h),e.compositeRule=d.compositeRule=p,r+=" if ("+m+") { ";var v=v||[];v.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'not' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(l)+" , params: {} ",e.opts.messages!==!1&&(r+=" , message: 'should NOT be valid' "),e.opts.verbose&&(r+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),r+=" } "):r+=" {} ";var $=r;r=v.pop(),!e.compositeRule&&u?e.async?r+=" throw new ValidationError(["+$+"]); ":r+=" validate.errors = ["+$+"]; return false; ":r+=" var err = "+$+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" } else { errors = "+y+"; if (vErrors !== null) { if ("+y+") vErrors.length = "+y+"; else vErrors = null; } ",e.opts.allErrors&&(r+=" } ")}else r+=" var err = ",e.createErrors!==!1?(r+=" { keyword: 'not' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(l)+" , params: {} ",e.opts.messages!==!1&&(r+=" , message: 'should NOT be valid' "),e.opts.verbose&&(r+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),r+=" } "):r+=" {} ",r+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",u&&(r+=" if (false) { ");return r},dy=function(e,a,s){var r=" ",n=e.level,i=e.dataLevel,o=e.schema[a],c=e.schemaPath+e.util.getProperty(a),l=e.errSchemaPath+"/"+a,u=!e.opts.allErrors,f="data"+(i||""),y="valid"+n,d="errs__"+n,m=e.util.copy(e),p="";m.level++;var h="valid"+m.level,v=m.baseId,$="prevValid"+n,P="passingSchemas"+n;r+="var "+d+" = errors , "+$+" = false , "+y+" = false , "+P+" = null; ";var k=e.compositeRule;e.compositeRule=m.compositeRule=!0;var T=o;if(T)for(var x,K=-1,V=T.length-1;K<V;)x=T[K+=1],(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=c+"["+K+"]",m.errSchemaPath=l+"/"+K,r+=" "+e.validate(m)+" ",m.baseId=v):r+=" var "+h+" = true; ",K&&(r+=" if ("+h+" && "+$+") { "+y+" = false; "+P+" = ["+P+", "+K+"]; } else { ",p+="}"),r+=" if ("+h+") { "+y+" = "+$+" = true; "+P+" = "+K+"; }";return e.compositeRule=m.compositeRule=k,r+=""+p+"if (!"+y+") { var err = ",e.createErrors!==!1?(r+=" { keyword: 'oneOf' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(l)+" , params: { passingSchemas: "+P+" } ",e.opts.messages!==!1&&(r+=" , message: 'should match exactly one schema in oneOf' "),e.opts.verbose&&(r+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),r+=" } "):r+=" {} ",r+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!e.compositeRule&&u&&(e.async?r+=" throw new ValidationError(vErrors); ":r+=" validate.errors = vErrors; return false; "),r+="} else { errors = "+d+"; if (vErrors !== null) { if ("+d+") vErrors.length = "+d+"; else vErrors = null; }",e.opts.allErrors&&(r+=" } "),r},fy=function(e,a,s){var r=" ",n=e.level,i=e.dataLevel,o=e.schema[a],c=e.schemaPath+e.util.getProperty(a),l=e.errSchemaPath+"/"+a,u=!e.opts.allErrors,f="data"+(i||""),y=e.opts.$data&&o&&o.$data,d;y?(r+=" var schema"+n+" = "+e.util.getData(o.$data,i,e.dataPathArr)+"; ",d="schema"+n):d=o;var m=y?"(new RegExp("+d+"))":e.usePattern(o);r+="if ( ",y&&(r+=" ("+d+" !== undefined && typeof "+d+" != 'string') || "),r+=" !"+m+".test("+f+") ) { ";var p=p||[];p.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'pattern' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(l)+" , params: { pattern: ",y?r+=""+d:r+=""+e.util.toQuotedString(o),r+=" } ",e.opts.messages!==!1&&(r+=` , message: 'should match pattern "`,y?r+="' + "+d+" + '":r+=""+e.util.escapeQuotes(o),r+=`"' `),e.opts.verbose&&(r+=" , schema: ",y?r+="validate.schema"+c:r+=""+e.util.toQuotedString(o),r+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),r+=" } "):r+=" {} ";var h=r;return r=p.pop(),!e.compositeRule&&u?e.async?r+=" throw new ValidationError(["+h+"]); ":r+=" validate.errors = ["+h+"]; return false; ":r+=" var err = "+h+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+="} ",u&&(r+=" else { "),r},hy=function(e,a,s){var r=" ",n=e.level,i=e.dataLevel,o=e.schema[a],c=e.schemaPath+e.util.getProperty(a),l=e.errSchemaPath+"/"+a,u=!e.opts.allErrors,f="data"+(i||""),y="errs__"+n,d=e.util.copy(e),m="";d.level++;var p="valid"+d.level,h="key"+n,v="idx"+n,$=d.dataLevel=e.dataLevel+1,P="data"+$,k="dataProperties"+n,T=Object.keys(o||{}).filter(be),x=e.schema.patternProperties||{},K=Object.keys(x).filter(be),V=e.schema.additionalProperties,z=T.length||K.length,Y=V===!1,ee=typeof V=="object"&&Object.keys(V).length,B=e.opts.removeAdditional,F=Y||ee||B,M=e.opts.ownProperties,re=e.baseId,_e=e.schema.required;if(_e&&!(e.opts.$data&&_e.$data)&&_e.length<e.opts.loopRequired)var ve=e.util.toHash(_e);function be(Tr){return Tr!=="__proto__"}if(r+="var "+y+" = errors;var "+p+" = true;",M&&(r+=" var "+k+" = undefined;"),F){if(M?r+=" "+k+" = "+k+" || Object.keys("+f+"); for (var "+v+"=0; "+v+"<"+k+".length; "+v+"++) { var "+h+" = "+k+"["+v+"]; ":r+=" for (var "+h+" in "+f+") { ",z){if(r+=" var isAdditional"+n+" = !(false ",T.length)if(T.length>8)r+=" || validate.schema"+c+".hasOwnProperty("+h+") ";else{var de=T;if(de)for(var j,S=-1,D=de.length-1;S<D;)j=de[S+=1],r+=" || "+h+" == "+e.util.toQuotedString(j)+" "}if(K.length){var O=K;if(O)for(var g,w=-1,A=O.length-1;w<A;)g=O[w+=1],r+=" || "+e.usePattern(g)+".test("+h+") "}r+=" ); if (isAdditional"+n+") { "}if(B=="all")r+=" delete "+f+"["+h+"]; ";else{var Z=e.errorPath,Q="' + "+h+" + '";if(e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPathExpr(e.errorPath,h,e.opts.jsonPointers)),Y)if(B)r+=" delete "+f+"["+h+"]; ";else{r+=" "+p+" = false; ";var fe=l;l=e.errSchemaPath+"/additionalProperties";var ie=ie||[];ie.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'additionalProperties' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(l)+" , params: { additionalProperty: '"+Q+"' } ",e.opts.messages!==!1&&(r+=" , message: '",e.opts._errorDataPathProperty?r+="is an invalid additional property":r+="should NOT have additional properties",r+="' "),e.opts.verbose&&(r+=" , schema: false , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),r+=" } "):r+=" {} ";var he=r;r=ie.pop(),!e.compositeRule&&u?e.async?r+=" throw new ValidationError(["+he+"]); ":r+=" validate.errors = ["+he+"]; return false; ":r+=" var err = "+he+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",l=fe,u&&(r+=" break; ")}else if(ee)if(B=="failing"){r+=" var "+y+" = errors; ";var st=e.compositeRule;e.compositeRule=d.compositeRule=!0,d.schema=V,d.schemaPath=e.schemaPath+".additionalProperties",d.errSchemaPath=e.errSchemaPath+"/additionalProperties",d.errorPath=e.opts._errorDataPathProperty?e.errorPath:e.util.getPathExpr(e.errorPath,h,e.opts.jsonPointers);var Ve=f+"["+h+"]";d.dataPathArr[$]=h;var Te=e.validate(d);d.baseId=re,e.util.varOccurences(Te,P)<2?r+=" "+e.util.varReplace(Te,P,Ve)+" ":r+=" var "+P+" = "+Ve+"; "+Te+" ",r+=" if (!"+p+") { errors = "+y+"; if (validate.errors !== null) { if (errors) validate.errors.length = errors; else validate.errors = null; } delete "+f+"["+h+"]; } ",e.compositeRule=d.compositeRule=st}else{d.schema=V,d.schemaPath=e.schemaPath+".additionalProperties",d.errSchemaPath=e.errSchemaPath+"/additionalProperties",d.errorPath=e.opts._errorDataPathProperty?e.errorPath:e.util.getPathExpr(e.errorPath,h,e.opts.jsonPointers);var Ve=f+"["+h+"]";d.dataPathArr[$]=h;var Te=e.validate(d);d.baseId=re,e.util.varOccurences(Te,P)<2?r+=" "+e.util.varReplace(Te,P,Ve)+" ":r+=" var "+P+" = "+Ve+"; "+Te+" ",u&&(r+=" if (!"+p+") break; ")}e.errorPath=Z}z&&(r+=" } "),r+=" } ",u&&(r+=" if ("+p+") { ",m+="}")}var yt=e.opts.useDefaults&&!e.compositeRule;if(T.length){var Ke=T;if(Ke)for(var j,Lt=-1,It=Ke.length-1;Lt<It;){j=Ke[Lt+=1];var qe=o[j];if(e.opts.strictKeywords?typeof qe=="object"&&Object.keys(qe).length>0||qe===!1:e.util.schemaHasRules(qe,e.RULES.all)){var _t=e.util.getProperty(j),Ve=f+_t,Xt=yt&&qe.default!==void 0;d.schema=qe,d.schemaPath=c+_t,d.errSchemaPath=l+"/"+e.util.escapeFragment(j),d.errorPath=e.util.getPath(e.errorPath,j,e.opts.jsonPointers),d.dataPathArr[$]=e.util.toQuotedString(j);var Te=e.validate(d);if(d.baseId=re,e.util.varOccurences(Te,P)<2){Te=e.util.varReplace(Te,P,Ve);var Me=Ve}else{var Me=P;r+=" var "+P+" = "+Ve+"; "}if(Xt)r+=" "+Te+" ";else{if(ve&&ve[j]){r+=" if ( "+Me+" === undefined ",M&&(r+=" || ! Object.prototype.hasOwnProperty.call("+f+", '"+e.util.escapeQuotes(j)+"') "),r+=") { "+p+" = false; ";var Z=e.errorPath,fe=l,Le=e.util.escapeQuotes(j);e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPath(Z,j,e.opts.jsonPointers)),l=e.errSchemaPath+"/required";var ie=ie||[];ie.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(l)+" , params: { missingProperty: '"+Le+"' } ",e.opts.messages!==!1&&(r+=" , message: '",e.opts._errorDataPathProperty?r+="is a required property":r+="should have required property \\'"+Le+"\\'",r+="' "),e.opts.verbose&&(r+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),r+=" } "):r+=" {} ";var he=r;r=ie.pop(),!e.compositeRule&&u?e.async?r+=" throw new ValidationError(["+he+"]); ":r+=" validate.errors = ["+he+"]; return false; ":r+=" var err = "+he+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",l=fe,e.errorPath=Z,r+=" } else { "}else u?(r+=" if ( "+Me+" === undefined ",M&&(r+=" || ! Object.prototype.hasOwnProperty.call("+f+", '"+e.util.escapeQuotes(j)+"') "),r+=") { "+p+" = true; } else { "):(r+=" if ("+Me+" !== undefined ",M&&(r+=" && Object.prototype.hasOwnProperty.call("+f+", '"+e.util.escapeQuotes(j)+"') "),r+=" ) { ");r+=" "+Te+" } "}}u&&(r+=" if ("+p+") { ",m+="}")}}if(K.length){var Ye=K;if(Ye)for(var g,hr=-1,er=Ye.length-1;hr<er;){g=Ye[hr+=1];var qe=x[g];if(e.opts.strictKeywords?typeof qe=="object"&&Object.keys(qe).length>0||qe===!1:e.util.schemaHasRules(qe,e.RULES.all)){d.schema=qe,d.schemaPath=e.schemaPath+".patternProperties"+e.util.getProperty(g),d.errSchemaPath=e.errSchemaPath+"/patternProperties/"+e.util.escapeFragment(g),M?r+=" "+k+" = "+k+" || Object.keys("+f+"); for (var "+v+"=0; "+v+"<"+k+".length; "+v+"++) { var "+h+" = "+k+"["+v+"]; ":r+=" for (var "+h+" in "+f+") { ",r+=" if ("+e.usePattern(g)+".test("+h+")) { ",d.errorPath=e.util.getPathExpr(e.errorPath,h,e.opts.jsonPointers);var Ve=f+"["+h+"]";d.dataPathArr[$]=h;var Te=e.validate(d);d.baseId=re,e.util.varOccurences(Te,P)<2?r+=" "+e.util.varReplace(Te,P,Ve)+" ":r+=" var "+P+" = "+Ve+"; "+Te+" ",u&&(r+=" if (!"+p+") break; "),r+=" } ",u&&(r+=" else "+p+" = true; "),r+=" } ",u&&(r+=" if ("+p+") { ",m+="}")}}}return u&&(r+=" "+m+" if ("+y+" == errors) {"),r},py=function(e,a,s){var r=" ",n=e.level,i=e.dataLevel,o=e.schema[a],c=e.schemaPath+e.util.getProperty(a),l=e.errSchemaPath+"/"+a,u=!e.opts.allErrors,f="data"+(i||""),y="errs__"+n,d=e.util.copy(e),m="";d.level++;var p="valid"+d.level;if(r+="var "+y+" = errors;",e.opts.strictKeywords?typeof o=="object"&&Object.keys(o).length>0||o===!1:e.util.schemaHasRules(o,e.RULES.all)){d.schema=o,d.schemaPath=c,d.errSchemaPath=l;var h="key"+n,v="idx"+n,$="i"+n,P="' + "+h+" + '",k=d.dataLevel=e.dataLevel+1,T="data"+k,x="dataProperties"+n,K=e.opts.ownProperties,V=e.baseId;K&&(r+=" var "+x+" = undefined; "),K?r+=" "+x+" = "+x+" || Object.keys("+f+"); for (var "+v+"=0; "+v+"<"+x+".length; "+v+"++) { var "+h+" = "+x+"["+v+"]; ":r+=" for (var "+h+" in "+f+") { ",r+=" var startErrs"+n+" = errors; ";var z=h,Y=e.compositeRule;e.compositeRule=d.compositeRule=!0;var ee=e.validate(d);d.baseId=V,e.util.varOccurences(ee,T)<2?r+=" "+e.util.varReplace(ee,T,z)+" ":r+=" var "+T+" = "+z+"; "+ee+" ",e.compositeRule=d.compositeRule=Y,r+=" if (!"+p+") { for (var "+$+"=startErrs"+n+"; "+$+"<errors; "+$+"++) { vErrors["+$+"].propertyName = "+h+"; } var err = ",e.createErrors!==!1?(r+=" { keyword: 'propertyNames' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(l)+" , params: { propertyName: '"+P+"' } ",e.opts.messages!==!1&&(r+=" , message: 'property name \\'"+P+"\\' is invalid' "),e.opts.verbose&&(r+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),r+=" } "):r+=" {} ",r+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!e.compositeRule&&u&&(e.async?r+=" throw new ValidationError(vErrors); ":r+=" validate.errors = vErrors; return false; "),u&&(r+=" break; "),r+=" } }"}return u&&(r+=" "+m+" if ("+y+" == errors) {"),r},my=function(e,a,s){var r=" ",n=e.level,i=e.dataLevel,o=e.schema[a],c=e.schemaPath+e.util.getProperty(a),l=e.errSchemaPath+"/"+a,u=!e.opts.allErrors,f="data"+(i||""),y="valid"+n,d=e.opts.$data&&o&&o.$data;d&&(r+=" var schema"+n+" = "+e.util.getData(o.$data,i,e.dataPathArr)+"; ");var m="schema"+n;if(!d)if(o.length<e.opts.loopRequired&&e.schema.properties&&Object.keys(e.schema.properties).length){var p=[],h=o;if(h)for(var v,$=-1,P=h.length-1;$<P;){v=h[$+=1];var k=e.schema.properties[v];k&&(e.opts.strictKeywords?typeof k=="object"&&Object.keys(k).length>0||k===!1:e.util.schemaHasRules(k,e.RULES.all))||(p[p.length]=v)}}else var p=o;if(d||p.length){var T=e.errorPath,x=d||p.length>=e.opts.loopRequired,K=e.opts.ownProperties;if(u)if(r+=" var missing"+n+"; ",x){d||(r+=" var "+m+" = validate.schema"+c+"; ");var V="i"+n,z="schema"+n+"["+V+"]",Y="' + "+z+" + '";e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPathExpr(T,z,e.opts.jsonPointers)),r+=" var "+y+" = true; ",d&&(r+=" if (schema"+n+" === undefined) "+y+" = true; else if (!Array.isArray(schema"+n+")) "+y+" = false; else {"),r+=" for (var "+V+" = 0; "+V+" < "+m+".length; "+V+"++) { "+y+" = "+f+"["+m+"["+V+"]] !== undefined ",K&&(r+=" && Object.prototype.hasOwnProperty.call("+f+", "+m+"["+V+"]) "),r+="; if (!"+y+") break; } ",d&&(r+=" } "),r+=" if (!"+y+") { ";var ee=ee||[];ee.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(l)+" , params: { missingProperty: '"+Y+"' } ",e.opts.messages!==!1&&(r+=" , message: '",e.opts._errorDataPathProperty?r+="is a required property":r+="should have required property \\'"+Y+"\\'",r+="' "),e.opts.verbose&&(r+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),r+=" } "):r+=" {} ";var B=r;r=ee.pop(),!e.compositeRule&&u?e.async?r+=" throw new ValidationError(["+B+"]); ":r+=" validate.errors = ["+B+"]; return false; ":r+=" var err = "+B+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" } else { "}else{r+=" if ( ";var F=p;if(F)for(var M,V=-1,re=F.length-1;V<re;){M=F[V+=1],V&&(r+=" || ");var _e=e.util.getProperty(M),ve=f+_e;r+=" ( ( "+ve+" === undefined ",K&&(r+=" || ! Object.prototype.hasOwnProperty.call("+f+", '"+e.util.escapeQuotes(M)+"') "),r+=") && (missing"+n+" = "+e.util.toQuotedString(e.opts.jsonPointers?M:_e)+") ) "}r+=") { ";var z="missing"+n,Y="' + "+z+" + '";e.opts._errorDataPathProperty&&(e.errorPath=e.opts.jsonPointers?e.util.getPathExpr(T,z,!0):T+" + "+z);var ee=ee||[];ee.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(l)+" , params: { missingProperty: '"+Y+"' } ",e.opts.messages!==!1&&(r+=" , message: '",e.opts._errorDataPathProperty?r+="is a required property":r+="should have required property \\'"+Y+"\\'",r+="' "),e.opts.verbose&&(r+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),r+=" } "):r+=" {} ";var B=r;r=ee.pop(),!e.compositeRule&&u?e.async?r+=" throw new ValidationError(["+B+"]); ":r+=" validate.errors = ["+B+"]; return false; ":r+=" var err = "+B+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" } else { "}else if(x){d||(r+=" var "+m+" = validate.schema"+c+"; ");var V="i"+n,z="schema"+n+"["+V+"]",Y="' + "+z+" + '";e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPathExpr(T,z,e.opts.jsonPointers)),d&&(r+=" if ("+m+" && !Array.isArray("+m+")) { var err = ",e.createErrors!==!1?(r+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(l)+" , params: { missingProperty: '"+Y+"' } ",e.opts.messages!==!1&&(r+=" , message: '",e.opts._errorDataPathProperty?r+="is a required property":r+="should have required property \\'"+Y+"\\'",r+="' "),e.opts.verbose&&(r+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),r+=" } "):r+=" {} ",r+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } else if ("+m+" !== undefined) { "),r+=" for (var "+V+" = 0; "+V+" < "+m+".length; "+V+"++) { if ("+f+"["+m+"["+V+"]] === undefined ",K&&(r+=" || ! Object.prototype.hasOwnProperty.call("+f+", "+m+"["+V+"]) "),r+=") { var err = ",e.createErrors!==!1?(r+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(l)+" , params: { missingProperty: '"+Y+"' } ",e.opts.messages!==!1&&(r+=" , message: '",e.opts._errorDataPathProperty?r+="is a required property":r+="should have required property \\'"+Y+"\\'",r+="' "),e.opts.verbose&&(r+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),r+=" } "):r+=" {} ",r+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } } ",d&&(r+=" } ")}else{var be=p;if(be)for(var M,de=-1,j=be.length-1;de<j;){M=be[de+=1];var _e=e.util.getProperty(M),Y=e.util.escapeQuotes(M),ve=f+_e;e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPath(T,M,e.opts.jsonPointers)),r+=" if ( "+ve+" === undefined ",K&&(r+=" || ! Object.prototype.hasOwnProperty.call("+f+", '"+e.util.escapeQuotes(M)+"') "),r+=") { var err = ",e.createErrors!==!1?(r+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(l)+" , params: { missingProperty: '"+Y+"' } ",e.opts.messages!==!1&&(r+=" , message: '",e.opts._errorDataPathProperty?r+="is a required property":r+="should have required property \\'"+Y+"\\'",r+="' "),e.opts.verbose&&(r+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),r+=" } "):r+=" {} ",r+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } "}}e.errorPath=T}else u&&(r+=" if (true) {");return r},vy=function(e,a,s){var r=" ",n=e.level,i=e.dataLevel,o=e.schema[a],c=e.schemaPath+e.util.getProperty(a),l=e.errSchemaPath+"/"+a,u=!e.opts.allErrors,f="data"+(i||""),y="valid"+n,d=e.opts.$data&&o&&o.$data,m;if(d?(r+=" var schema"+n+" = "+e.util.getData(o.$data,i,e.dataPathArr)+"; ",m="schema"+n):m=o,(o||d)&&e.opts.uniqueItems!==!1){d&&(r+=" var "+y+"; if ("+m+" === false || "+m+" === undefined) "+y+" = true; else if (typeof "+m+" != 'boolean') "+y+" = false; else { "),r+=" var i = "+f+".length , "+y+" = 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))r+=" outer: for (;i--;) { for (j = i; j--;) { if (equal("+f+"[i], "+f+"[j])) { "+y+" = false; break outer; } } } ";else{r+=" var itemIndices = {}, item; for (;i--;) { var item = "+f+"[i]; ";var v="checkDataType"+(h?"s":"");r+=" if ("+e.util[v](p,"item",e.opts.strictNumbers,!0)+") continue; ",h&&(r+=` if (typeof item == 'string') item = '"' + item; `),r+=" if (typeof itemIndices[item] == 'number') { "+y+" = false; j = itemIndices[item]; break; } itemIndices[item] = i; } "}r+=" } ",d&&(r+=" } "),r+=" if (!"+y+") { ";var $=$||[];$.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'uniqueItems' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(l)+" , params: { i: i, j: j } ",e.opts.messages!==!1&&(r+=" , message: 'should NOT have duplicate items (items ## ' + j + ' and ' + i + ' are identical)' "),e.opts.verbose&&(r+=" , schema: ",d?r+="validate.schema"+c:r+=""+o,r+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),r+=" } "):r+=" {} ";var P=r;r=$.pop(),!e.compositeRule&&u?e.async?r+=" throw new ValidationError(["+P+"]); ":r+=" validate.errors = ["+P+"]; return false; ":r+=" var err = "+P+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" } ",u&&(r+=" else { ")}else u&&(r+=" if (true) { ");return r},gy={$ref:Yg,allOf:Xg,anyOf:ey,$comment:ty,const:ry,contains:ay,dependencies:sy,enum:ny,format:iy,if:oy,items:ly,maximum:zu,minimum:zu,maxItems:Hu,minItems:Hu,maxLength:Zu,minLength:Zu,maxProperties:Ku,minProperties:Ku,multipleOf:cy,not:uy,oneOf:dy,pattern:fy,properties:hy,propertyNames:py,required:my,uniqueItems:vy,validate:Ou},Bu=gy,wo=Jr.toHash,yy=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"]}],a=["type","$comment"],s=["$schema","$id","id","$data","$async","title","description","default","definitions","examples","readOnly","writeOnly","contentMediaType","contentEncoding","additionalItems","then","else"],r=["number","integer","string","array","object","boolean","null"];return e.all=wo(a),e.types=wo(r),e.forEach(function(n){n.rules=n.rules.map(function(i){var o;if(typeof i=="object"){var c=Object.keys(i)[0];o=i[c],i=c,o.forEach(function(u){a.push(u),e.all[u]=!0})}a.push(i);var l=e.all[i]={keyword:i,code:Bu[i],implements:o};return l}),e.all.$comment={keyword:"$comment",code:Bu.$comment},n.type&&(e.types[n.type]=n)}),e.keywords=wo(a.concat(s)),e.custom={},e},Ju=["multipleOf","maximum","exclusiveMaximum","minimum","exclusiveMinimum","maxLength","minLength","pattern","additionalItems","maxItems","minItems","uniqueItems","maxProperties","minProperties","required","additionalProperties","enum","format","const"],_y=function(t,e){for(var a=0;a<e.length;a++){t=JSON.parse(JSON.stringify(t));var s=e[a].split("/"),r=t,n;for(n=1;n<s.length;n++)r=r[s[n]];for(n=0;n<Ju.length;n++){var i=Ju[n],o=r[i];o&&(r[i]={anyOf:[o,{$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"}]})}}return t},$y=yo.MissingRef,wy=Qu;function Qu(t,e,a){var s=this;if(typeof this._opts.loadSchema!="function")throw new Error("options.loadSchema should be a function");typeof e=="function"&&(a=e,e=void 0);var r=n(t).then(function(){var o=s._addSchema(t,void 0,e);return o.validate||i(o)});return a&&r.then(function(o){a(null,o)},a),r;function n(o){var c=o.$schema;return c&&!s.getSchema(c)?Qu.call(s,{$ref:c},!0):Promise.resolve()}function i(o){try{return s._compile(o)}catch(l){if(l instanceof $y)return c(l);throw l}function c(l){var u=l.missingSchema;if(d(u))throw new Error("Schema "+u+" is loaded but "+l.missingRef+" cannot be resolved");var f=s._loadingSchemas[u];return f||(f=s._loadingSchemas[u]=s._opts.loadSchema(u),f.then(y,y)),f.then(function(m){if(!d(u))return n(m).then(function(){d(u)||s.addSchema(m,u,void 0,e)})}).then(function(){return i(o)});function y(){delete s._loadingSchemas[u]}function d(m){return s._refs[m]||s._schemas[m]}}}}var by=function(e,a,s){var r=" ",n=e.level,i=e.dataLevel,o=e.schema[a],c=e.schemaPath+e.util.getProperty(a),l=e.errSchemaPath+"/"+a,u=!e.opts.allErrors,f,y="data"+(i||""),d="valid"+n,m="errs__"+n,p=e.opts.$data&&o&&o.$data,h;p?(r+=" var schema"+n+" = "+e.util.getData(o.$data,i,e.dataPathArr)+"; ",h="schema"+n):h=o;var v=this,$="definition"+n,P=v.definition,k="",T,x,K,V,z;if(p&&P.$data){z="keywordValidate"+n;var Y=P.validateSchema;r+=" var "+$+" = RULES.custom['"+a+"'].definition; var "+z+" = "+$+".validate;"}else{if(V=e.useCustomRule(v,o,e.schema,e),!V)return;h="validate.schema"+c,z=V.code,T=P.compile,x=P.inline,K=P.macro}var ee=z+".errors",B="i"+n,F="ruleErr"+n,M=P.async;if(M&&!e.async)throw new Error("async keyword in sync schema");if(x||K||(r+=""+ee+" = null;"),r+="var "+m+" = errors;var "+d+";",p&&P.$data&&(k+="}",r+=" if ("+h+" === undefined) { "+d+" = true; } else { ",Y&&(k+="}",r+=" "+d+" = "+$+".validateSchema("+h+"); if ("+d+") { ")),x)P.statements?r+=" "+V.validate+" ":r+=" "+d+" = "+V.validate+"; ";else if(K){var re=e.util.copy(e),k="";re.level++;var _e="valid"+re.level;re.schema=V.validate,re.schemaPath="";var ve=e.compositeRule;e.compositeRule=re.compositeRule=!0;var be=e.validate(re).replace(/validate\.schema/g,z);e.compositeRule=re.compositeRule=ve,r+=" "+be}else{var de=de||[];de.push(r),r="",r+=" "+z+".call( ",e.opts.passContext?r+="this":r+="self",T||P.schema===!1?r+=" , "+y+" ":r+=" , "+h+" , "+y+" , validate.schema"+e.schemaPath+" ",r+=" , (dataPath || '')",e.errorPath!='""'&&(r+=" + "+e.errorPath);var j=i?"data"+(i-1||""):"parentData",S=i?e.dataPathArr[i]:"parentDataProperty";r+=" , "+j+" , "+S+" , rootData ) ";var D=r;r=de.pop(),P.errors===!1?(r+=" "+d+" = ",M&&(r+="await "),r+=""+D+"; "):M?(ee="customErrors"+n,r+=" var "+ee+" = null; try { "+d+" = await "+D+"; } catch (e) { "+d+" = false; if (e instanceof ValidationError) "+ee+" = e.errors; else throw e; } "):r+=" "+ee+" = null; "+d+" = "+D+"; "}if(P.modifying&&(r+=" if ("+j+") "+y+" = "+j+"["+S+"];"),r+=""+k,P.valid)u&&(r+=" if (true) { ");else{r+=" if ( ",P.valid===void 0?(r+=" !",K?r+=""+_e:r+=""+d):r+=" "+!P.valid+" ",r+=") { ",f=v.keyword;var de=de||[];de.push(r),r="";var de=de||[];de.push(r),r="",e.createErrors!==!1?(r+=" { keyword: '"+(f||"custom")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(l)+" , params: { keyword: '"+v.keyword+"' } ",e.opts.messages!==!1&&(r+=` , message: 'should pass "`+v.keyword+`" keyword validation' `),e.opts.verbose&&(r+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+y+" "),r+=" } "):r+=" {} ";var O=r;r=de.pop(),!e.compositeRule&&u?e.async?r+=" throw new ValidationError(["+O+"]); ":r+=" validate.errors = ["+O+"]; return false; ":r+=" var err = "+O+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";var g=r;r=de.pop(),x?P.errors?P.errors!="full"&&(r+=" for (var "+B+"="+m+"; "+B+"<errors; "+B+"++) { var "+F+" = vErrors["+B+"]; if ("+F+".dataPath === undefined) "+F+".dataPath = (dataPath || '') + "+e.errorPath+"; if ("+F+".schemaPath === undefined) { "+F+'.schemaPath = "'+l+'"; } ',e.opts.verbose&&(r+=" "+F+".schema = "+h+"; "+F+".data = "+y+"; "),r+=" } "):P.errors===!1?r+=" "+g+" ":(r+=" if ("+m+" == errors) { "+g+" } else { for (var "+B+"="+m+"; "+B+"<errors; "+B+"++) { var "+F+" = vErrors["+B+"]; if ("+F+".dataPath === undefined) "+F+".dataPath = (dataPath || '') + "+e.errorPath+"; if ("+F+".schemaPath === undefined) { "+F+'.schemaPath = "'+l+'"; } ',e.opts.verbose&&(r+=" "+F+".schema = "+h+"; "+F+".data = "+y+"; "),r+=" } } "):K?(r+=" var err = ",e.createErrors!==!1?(r+=" { keyword: '"+(f||"custom")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(l)+" , params: { keyword: '"+v.keyword+"' } ",e.opts.messages!==!1&&(r+=` , message: 'should pass "`+v.keyword+`" keyword validation' `),e.opts.verbose&&(r+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+y+" "),r+=" } "):r+=" {} ",r+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!e.compositeRule&&u&&(e.async?r+=" throw new ValidationError(vErrors); ":r+=" validate.errors = vErrors; return false; ")):P.errors===!1?r+=" "+g+" ":(r+=" if (Array.isArray("+ee+")) { if (vErrors === null) vErrors = "+ee+"; else vErrors = vErrors.concat("+ee+"); errors = vErrors.length; for (var "+B+"="+m+"; "+B+"<errors; "+B+"++) { var "+F+" = vErrors["+B+"]; if ("+F+".dataPath === undefined) "+F+".dataPath = (dataPath || '') + "+e.errorPath+"; "+F+'.schemaPath = "'+l+'"; ',e.opts.verbose&&(r+=" "+F+".schema = "+h+"; "+F+".data = "+y+"; "),r+=" } } else { "+g+" } "),r+=" } ",u&&(r+=" else { ")}return r};const Gu={$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 Wu=Gu,Ey={$id:"https://github.com/ajv-validator/ajv/blob/master/lib/definition_schema.js",definitions:{simpleTypes:Wu.definitions.simpleTypes},type:"object",dependencies:{schema:["validate"],$data:["validate"],statements:["inline"],valid:{not:{required:["macro"]}}},properties:{type:Wu.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"}]}}},Py=/^[a-z_$][a-z0-9_$-]*$/i,Sy=by,Ry=Ey,ky={add:Oy,get:Ty,remove:Cy,validate:bo};function Oy(t,e){var a=this.RULES;if(a.keywords[t])throw new Error("Keyword "+t+" is already defined");if(!Py.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 r=0;r<s.length;r++)i(t,s[r],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))}a.keywords[t]=a.all[t]=!0;function i(o,c,l){for(var u,f=0;f<a.length;f++){var y=a[f];if(y.type==c){u=y;break}}u||(u={type:c,rules:[]},a.push(u));var d={keyword:o,definition:l,custom:!0,code:Sy,implements:l.implements};u.rules.push(d),a.custom[o]=d}return this}function Ty(t){var e=this.RULES.custom[t];return e?e.definition:this.RULES.keywords[t]||!1}function Cy(t){var e=this.RULES;delete e.keywords[t],delete e.all[t],delete e.custom[t];for(var a=0;a<e.length;a++)for(var s=e[a].rules,r=0;r<s.length;r++)if(s[r].keyword==t){s.splice(r,1);break}return this}function bo(t,e){bo.errors=null;var a=this._validateKeyword=this._validateKeyword||this.compile(Ry,!0);if(a(t))return!0;if(bo.errors=a.errors,e)throw new Error("custom keyword definition is invalid: "+this.errorsText(a.errors));return!1}const Iy={$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 Yu=Ig,Rr=ho,Ny=Lg,Xu=wu,Ay=ku,jy=Zg,Dy=yy,ed=_y,td=Jr,xy=Fe;Fe.prototype.validate=Ly,Fe.prototype.compile=Fy,Fe.prototype.addSchema=qy,Fe.prototype.addMetaSchema=Uy,Fe.prototype.validateSchema=Vy,Fe.prototype.getSchema=Hy,Fe.prototype.removeSchema=Ky,Fe.prototype.addFormat=e_,Fe.prototype.errorsText=Xy,Fe.prototype._addSchema=By,Fe.prototype._compile=Jy,Fe.prototype.compileAsync=wy;var Js=ky;Fe.prototype.addKeyword=Js.add,Fe.prototype.getKeyword=Js.get,Fe.prototype.removeKeyword=Js.remove,Fe.prototype.validateKeyword=Js.validate;var rd=yo;Fe.ValidationError=rd.Validation,Fe.MissingRefError=rd.MissingRef,Fe.$dataMetaSchema=ed;var Qs="http://json-schema.org/draft-07/schema",ad=["removeAdditional","useDefaults","coerceTypes","strictDefaults"],My=["/properties"];function Fe(t){if(!(this instanceof Fe))return new Fe(t);t=this._opts=td.copy(t)||{},i_(this),this._schemas={},this._refs={},this._fragments={},this._formats=jy(t.format),this._cache=t.cache||new Ny,this._loadingSchemas={},this._compilations=[],this.RULES=Dy(),this._getId=Qy(t),t.loopRequired=t.loopRequired||1/0,t.errorDataPath=="property"&&(t._errorDataPathProperty=!0),t.serialize===void 0&&(t.serialize=Ay),this._metaOpts=n_(this),t.formats&&a_(this),t.keywords&&s_(this),t_(this),typeof t.meta=="object"&&this.addMetaSchema(t.meta),t.nullable&&this.addKeyword("nullable",{metaSchema:{type:"boolean"}}),r_(this)}function Ly(t,e){var a;if(typeof t=="string"){if(a=this.getSchema(t),!a)throw new Error('no schema with key or ref "'+t+'"')}else{var s=this._addSchema(t);a=s.validate||this._compile(s)}var r=a(e);return a.$async!==!0&&(this.errors=a.errors),r}function Fy(t,e){var a=this._addSchema(t,void 0,e);return a.validate||this._compile(a)}function qy(t,e,a,s){if(Array.isArray(t)){for(var r=0;r<t.length;r++)this.addSchema(t[r],void 0,a,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=Rr.normalizeId(e||n),nd(this,e),this._schemas[e]=this._addSchema(t,a,s,!0),this}function Uy(t,e,a){return this.addSchema(t,e,a,!0),this}function Vy(t,e){var a=t.$schema;if(a!==void 0&&typeof a!="string")throw new Error("$schema must be a string");if(a=a||this._opts.defaultMeta||zy(this),!a)return this.logger.warn("meta-schema not available"),this.errors=null,!0;var s=this.validate(a,t);if(!s&&e){var r="schema is invalid: "+this.errorsText();if(this._opts.validateSchema=="log")this.logger.error(r);else throw new Error(r)}return s}function zy(t){var e=t._opts.meta;return t._opts.defaultMeta=typeof e=="object"?t._getId(e)||e:t.getSchema(Qs)?Qs:void 0,t._opts.defaultMeta}function Hy(t){var e=sd(this,t);switch(typeof e){case"object":return e.validate||this._compile(e);case"string":return this.getSchema(e);case"undefined":return Zy(this,t)}}function Zy(t,e){var a=Rr.schema.call(t,{schema:{}},e);if(a){var s=a.schema,r=a.root,n=a.baseId,i=Yu.call(t,s,r,void 0,n);return t._fragments[e]=new Xu({ref:e,fragment:!0,schema:s,root:r,baseId:n,validate:i}),i}}function sd(t,e){return e=Rr.normalizeId(e),t._schemas[e]||t._refs[e]||t._fragments[e]}function Ky(t){if(t instanceof RegExp)return Gs(this,this._schemas,t),Gs(this,this._refs,t),this;switch(typeof t){case"undefined":return Gs(this,this._schemas),Gs(this,this._refs),this._cache.clear(),this;case"string":var e=sd(this,t);return e&&this._cache.del(e.cacheKey),delete this._schemas[t],delete this._refs[t],this;case"object":var a=this._opts.serialize,s=a?a(t):t;this._cache.del(s);var r=this._getId(t);r&&(r=Rr.normalizeId(r),delete this._schemas[r],delete this._refs[r])}return this}function Gs(t,e,a){for(var s in e){var r=e[s];!r.meta&&(!a||a.test(s))&&(t._cache.del(r.cacheKey),delete e[s])}}function By(t,e,a,s){if(typeof t!="object"&&typeof t!="boolean")throw new Error("schema should be object or boolean");var r=this._opts.serialize,n=r?r(t):t,i=this._cache.get(n);if(i)return i;s=s||this._opts.addUsedSchema!==!1;var o=Rr.normalizeId(this._getId(t));o&&s&&nd(this,o);var c=this._opts.validateSchema!==!1&&!e,l;c&&!(l=o&&o==Rr.normalizeId(t.$schema))&&this.validateSchema(t,!0);var u=Rr.ids.call(this,t),f=new Xu({id:o,schema:t,localRefs:u,cacheKey:n,meta:a});return o[0]!="#"&&s&&(this._refs[o]=f),this._cache.put(n,f),c&&l&&this.validateSchema(t,!0),f}function Jy(t,e){if(t.compiling)return t.validate=r,r.schema=t.schema,r.errors=null,r.root=e||r,t.schema.$async===!0&&(r.$async=!0),r;t.compiling=!0;var a;t.meta&&(a=this._opts,this._opts=this._metaOpts);var s;try{s=Yu.call(this,t.schema,e,t.localRefs)}catch(n){throw delete t.validate,n}finally{t.compiling=!1,t.meta&&(this._opts=a)}return t.validate=s,t.refs=s.refs,t.refVal=s.refVal,t.root=s.root,s;function r(){var n=t.validate,i=n.apply(this,arguments);return r.errors=n.errors,i}}function Qy(t){switch(t.schemaId){case"auto":return Yy;case"id":return Gy;default:return Wy}}function Gy(t){return t.$id&&this.logger.warn("schema $id ignored",t.$id),t.id}function Wy(t){return t.id&&this.logger.warn("schema id ignored",t.id),t.$id}function Yy(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 Xy(t,e){if(t=t||this.errors,!t)return"No errors";e=e||{};for(var a=e.separator===void 0?", ":e.separator,s=e.dataVar===void 0?"data":e.dataVar,r="",n=0;n<t.length;n++){var i=t[n];i&&(r+=s+i.dataPath+" "+i.message+a)}return r.slice(0,-a.length)}function e_(t,e){return typeof e=="string"&&(e=new RegExp(e)),this._formats[t]=e,this}function t_(t){var e;if(t._opts.$data&&(e=Iy,t.addMetaSchema(e,e.$id,!0)),t._opts.meta!==!1){var a=Gu;t._opts.$data&&(a=ed(a,My)),t.addMetaSchema(a,Qs,!0),t._refs["http://json-schema.org/schema"]=Qs}}function r_(t){var e=t._opts.schemas;if(e)if(Array.isArray(e))t.addSchema(e);else for(var a in e)t.addSchema(e[a],a)}function a_(t){for(var e in t._opts.formats){var a=t._opts.formats[e];t.addFormat(e,a)}}function s_(t){for(var e in t._opts.keywords){var a=t._opts.keywords[e];t.addKeyword(e,a)}}function nd(t,e){if(t._schemas[e]||t._refs[e])throw new Error('schema with key or id "'+e+'" already exists')}function n_(t){for(var e=td.copy(t._opts),a=0;a<ad.length;a++)delete e[ad[a]];return e}function i_(t){var e=t._opts.logger;if(e===!1)t.logger={log:Eo,warn:Eo,error:Eo};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 Eo(){}const id=tl(xy);class o_ extends ro{constructor(e,a){var s;super(a),this._clientInfo=e,this._cachedToolOutputValidators=new Map,this._capabilities=(s=a==null?void 0:a.capabilities)!==null&&s!==void 0?s:{},this._ajv=new id}registerCapabilities(e){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=ao(this._capabilities,e)}assertCapability(e,a){var s;if(!(!((s=this._serverCapabilities)===null||s===void 0)&&s[e]))throw new Error(`Server does not support ${e} (required for ${a})`)}async connect(e,a){if(await super.connect(e),e.sessionId===void 0)try{const s=await this.request({method:"initialize",params:{protocolVersion:Sr,capabilities:this._capabilities,clientInfo:this._clientInfo}},xi,a);if(s===void 0)throw new Error(`Server sent invalid initialize result: ${s}`);if(!ki.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 a,s,r,n,i;switch(e){case"logging/setLevel":if(!(!((a=this._serverCapabilities)===null||a===void 0)&&a.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(!(!((r=this._serverCapabilities)===null||r===void 0)&&r.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 a;switch(e){case"notifications/roots/list_changed":if(!(!((a=this._capabilities.roots)===null||a===void 0)&&a.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"},lr,e)}async complete(e,a){return this.request({method:"completion/complete",params:e},Xi,a)}async setLoggingLevel(e,a){return this.request({method:"logging/setLevel",params:{level:e}},lr,a)}async getPrompt(e,a){return this.request({method:"prompts/get",params:e},Bi,a)}async listPrompts(e,a){return this.request({method:"prompts/list",params:e},Zi,a)}async listResources(e,a){return this.request({method:"resources/list",params:e},Vi,a)}async listResourceTemplates(e,a){return this.request({method:"resources/templates/list",params:e},zi,a)}async readResource(e,a){return this.request({method:"resources/read",params:e},Hi,a)}async subscribeResource(e,a){return this.request({method:"resources/subscribe",params:e},lr,a)}async unsubscribeResource(e,a){return this.request({method:"resources/unsubscribe",params:e},lr,a)}async callTool(e,a=js,s){const r=await this.request({method:"tools/call",params:e},a,s),n=this.getToolOutputValidator(e.name);if(n){if(!r.structuredContent&&!r.isError)throw new Ce(R.ErrorCode.InvalidRequest,`Tool ${e.name} has an output schema but did not return structured content`);if(r.structuredContent)try{if(!n(r.structuredContent))throw new Ce(R.ErrorCode.InvalidParams,`Structured content does not match the tool's output schema: ${this._ajv.errorsText(n.errors)}`)}catch(i){throw i instanceof Ce?i:new Ce(R.ErrorCode.InvalidParams,`Failed to validate structured content: ${i instanceof Error?i.message:String(i)}`)}}return r}cacheToolOutputSchemas(e){this._cachedToolOutputValidators.clear();for(const a of e)if(a.outputSchema)try{const s=this._ajv.compile(a.outputSchema);this._cachedToolOutputValidators.set(a.name,s)}catch{}}getToolOutputValidator(e){return this._cachedToolOutputValidators.get(e)}async listTools(e,a){const s=await this.request({method:"tools/list",params:e},Ji,a);return this.cacheToolOutputSchemas(s.tools),s}async sendRootsListChanged(){return this.notification({method:"notifications/roots/list_changed"})}}let Po;Po=globalThis.crypto;async function l_(t){return(await Po).getRandomValues(new Uint8Array(t))}async function c_(t){const e="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-._~";let a="";const s=await l_(t);for(let r=0;r<t;r++){const n=s[r]%e.length;a+=e[n]}return a}async function u_(t){return await c_(t)}async function d_(t){const e=await(await Po).subtle.digest("SHA-256",new TextEncoder().encode(t));return btoa(String.fromCharCode(...new Uint8Array(e))).replace(/\//g,"_").replace(/\+/g,"-").replace(/=/g,"")}async function f_(t){if(t||(t=43),t<43||t>128)throw`Expected a length between 43 and 128. Received ${t}.`;const e=await u_(t),a=await d_(e);return{code_verifier:e,code_challenge:a}}const tt=C().url().superRefine((t,e)=>{if(!URL.canParse(t))return e.addIssue({code:q.custom,message:"URL must be parseable",fatal:!0}),Dv}).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"}),h_=H({resource:C().url(),authorization_servers:X(tt).optional(),jwks_uri:C().url().optional(),scopes_supported:X(C()).optional(),bearer_methods_supported:X(C()).optional(),resource_signing_alg_values_supported:X(C()).optional(),resource_name:C().optional(),resource_documentation:C().optional(),resource_policy_uri:C().url().optional(),resource_tos_uri:C().url().optional(),tls_client_certificate_bound_access_tokens:Qe().optional(),authorization_details_types_supported:X(C()).optional(),dpop_signing_alg_values_supported:X(C()).optional(),dpop_bound_access_tokens_required:Qe().optional()}).passthrough(),So=H({issuer:C(),authorization_endpoint:tt,token_endpoint:tt,registration_endpoint:tt.optional(),scopes_supported:X(C()).optional(),response_types_supported:X(C()),response_modes_supported:X(C()).optional(),grant_types_supported:X(C()).optional(),token_endpoint_auth_methods_supported:X(C()).optional(),token_endpoint_auth_signing_alg_values_supported:X(C()).optional(),service_documentation:tt.optional(),revocation_endpoint:tt.optional(),revocation_endpoint_auth_methods_supported:X(C()).optional(),revocation_endpoint_auth_signing_alg_values_supported:X(C()).optional(),introspection_endpoint:C().optional(),introspection_endpoint_auth_methods_supported:X(C()).optional(),introspection_endpoint_auth_signing_alg_values_supported:X(C()).optional(),code_challenge_methods_supported:X(C()).optional()}).passthrough(),p_=H({issuer:C(),authorization_endpoint:tt,token_endpoint:tt,userinfo_endpoint:tt.optional(),jwks_uri:tt,registration_endpoint:tt.optional(),scopes_supported:X(C()).optional(),response_types_supported:X(C()),response_modes_supported:X(C()).optional(),grant_types_supported:X(C()).optional(),acr_values_supported:X(C()).optional(),subject_types_supported:X(C()),id_token_signing_alg_values_supported:X(C()),id_token_encryption_alg_values_supported:X(C()).optional(),id_token_encryption_enc_values_supported:X(C()).optional(),userinfo_signing_alg_values_supported:X(C()).optional(),userinfo_encryption_alg_values_supported:X(C()).optional(),userinfo_encryption_enc_values_supported:X(C()).optional(),request_object_signing_alg_values_supported:X(C()).optional(),request_object_encryption_alg_values_supported:X(C()).optional(),request_object_encryption_enc_values_supported:X(C()).optional(),token_endpoint_auth_methods_supported:X(C()).optional(),token_endpoint_auth_signing_alg_values_supported:X(C()).optional(),display_values_supported:X(C()).optional(),claim_types_supported:X(C()).optional(),claims_supported:X(C()).optional(),service_documentation:C().optional(),claims_locales_supported:X(C()).optional(),ui_locales_supported:X(C()).optional(),claims_parameter_supported:Qe().optional(),request_parameter_supported:Qe().optional(),request_uri_parameter_supported:Qe().optional(),require_request_uri_registration:Qe().optional(),op_policy_uri:tt.optional(),op_tos_uri:tt.optional()}).passthrough().merge(So.pick({code_challenge_methods_supported:!0})),od=H({access_token:C(),id_token:C().optional(),token_type:C(),expires_in:We().optional(),scope:C().optional(),refresh_token:C().optional()}).strip(),m_=H({error:C(),error_description:C().optional(),error_uri:C().optional()}),ld=tt.optional().or(ue("").transform(()=>{})),v_=H({redirect_uris:X(tt),token_endpoint_auth_method:C().optional(),grant_types:X(C()).optional(),response_types:X(C()).optional(),client_name:C().optional(),client_uri:tt.optional(),logo_uri:ld,scope:C().optional(),contacts:X(C()).optional(),tos_uri:ld,policy_uri:C().optional(),jwks_uri:tt.optional(),jwks:Av().optional(),software_id:C().optional(),software_version:C().optional(),software_statement:C().optional()}).strip(),g_=H({client_id:C(),client_secret:C().optional(),client_id_issued_at:We().optional(),client_secret_expires_at:We().optional()}).strip(),y_=v_.merge(g_);H({error:C(),error_description:C().optional()}).strip(),H({token:C(),token_type_hint:C().optional()}).strip();function __(t){const e=typeof t=="string"?new URL(t):new URL(t.href);return e.hash="",e}function $_({requestedResource:t,configuredResource:e}){const a=typeof t=="string"?new URL(t):new URL(t.href),s=typeof e=="string"?new URL(e):new URL(e.href);if(a.origin!==s.origin||a.pathname.length<s.pathname.length)return!1;const r=a.pathname.endsWith("/")?a.pathname:a.pathname+"/",n=s.pathname.endsWith("/")?s.pathname:s.pathname+"/";return r.startsWith(n)}class rt extends Error{constructor(e,a){super(e),this.errorUri=a,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 Ro extends rt{}Ro.errorCode="invalid_request";class Ws extends rt{}Ws.errorCode="invalid_client";class Ys extends rt{}Ys.errorCode="invalid_grant";class Xs extends rt{}Xs.errorCode="unauthorized_client";class ko extends rt{}ko.errorCode="unsupported_grant_type";class Oo extends rt{}Oo.errorCode="invalid_scope";class To extends rt{}To.errorCode="access_denied";class Qr extends rt{}Qr.errorCode="server_error";class Co extends rt{}Co.errorCode="temporarily_unavailable";class Io extends rt{}Io.errorCode="unsupported_response_type";class No extends rt{}No.errorCode="unsupported_token_type";class Ao extends rt{}Ao.errorCode="invalid_token";class jo extends rt{}jo.errorCode="method_not_allowed";class Do extends rt{}Do.errorCode="too_many_requests";class xo extends rt{}xo.errorCode="invalid_client_metadata";class Mo extends rt{}Mo.errorCode="insufficient_scope";const w_={[Ro.errorCode]:Ro,[Ws.errorCode]:Ws,[Ys.errorCode]:Ys,[Xs.errorCode]:Xs,[ko.errorCode]:ko,[Oo.errorCode]:Oo,[To.errorCode]:To,[Qr.errorCode]:Qr,[Co.errorCode]:Co,[Io.errorCode]:Io,[No.errorCode]:No,[Ao.errorCode]:Ao,[jo.errorCode]:jo,[Do.errorCode]:Do,[xo.errorCode]:xo,[Mo.errorCode]:Mo};class kt extends Error{constructor(e){super(e??"Unauthorized")}}const Lo="code",Fo="S256";function cd(t,e){const a=t.client_secret!==void 0;return e.length===0?a?"client_secret_post":"none":a&&e.includes("client_secret_basic")?"client_secret_basic":a&&e.includes("client_secret_post")?"client_secret_post":e.includes("none")?"none":a?"client_secret_post":"none"}function ud(t,e,a,s){const{client_id:r,client_secret:n}=e;switch(t){case"client_secret_basic":b_(r,n,a);return;case"client_secret_post":E_(r,n,s);return;case"none":P_(r,s);return;default:throw new Error(`Unsupported client authentication method: ${t}`)}}function b_(t,e,a){if(!e)throw new Error("client_secret_basic authentication requires a client_secret");const s=btoa(`${t}:${e}`);a.set("Authorization",`Basic ${s}`)}function E_(t,e,a){a.set("client_id",t),e&&a.set("client_secret",e)}function P_(t,e){e.set("client_id",t)}async function en(t){const e=t instanceof Response?t.status:void 0,a=t instanceof Response?await t.text():t;try{const s=m_.parse(JSON.parse(a)),{error:r,error_description:n,error_uri:i}=s,o=w_[r]||Qr;return new o(n||"",i)}catch(s){const r=`${e?`HTTP ${e}: `:""}Invalid OAuth error response: ${s}. Raw body: ${a}`;return new Qr(r)}}async function kr(t,e){var a,s;try{return await qo(t,e)}catch(r){if(r instanceof Ws||r instanceof Xs)return await((a=t.invalidateCredentials)===null||a===void 0?void 0:a.call(t,"all")),await qo(t,e);if(r instanceof Ys)return await((s=t.invalidateCredentials)===null||s===void 0?void 0:s.call(t,"tokens")),await qo(t,e);throw r}}async function qo(t,{serverUrl:e,authorizationCode:a,scope:s,resourceMetadataUrl:r,fetchFn:n}){let i,o;try{i=await fd(e,{resourceMetadataUrl:r},n),i.authorization_servers&&i.authorization_servers.length>0&&(o=i.authorization_servers[0])}catch{}o||(o=e);const c=await dd(e,t,i),l=await vd(o,{fetchFn:n});let u=await Promise.resolve(t.clientInformation());if(!u){if(a!==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 $d(o,{metadata:l,clientMetadata:t.clientMetadata,fetchFn:n});await t.saveClientInformation(p),u=p}if(a!==void 0){const p=await t.codeVerifier(),h=await yd(o,{metadata:l,clientInformation:u,authorizationCode:a,codeVerifier:p,redirectUri:t.redirectUrl,resource:c,addClientAuthentication:t.addClientAuthentication,fetchFn:n});return await t.saveTokens(h),"AUTHORIZED"}const f=await t.tokens();if(f!=null&&f.refresh_token)try{const p=await _d(o,{metadata:l,clientInformation:u,refreshToken:f.refresh_token,resource:c,addClientAuthentication:t.addClientAuthentication,fetchFn:n});return await t.saveTokens(p),"AUTHORIZED"}catch(p){if(!(!(p instanceof rt)||p instanceof Qr))throw p}const y=t.state?await t.state():void 0,{authorizationUrl:d,codeVerifier:m}=await gd(o,{metadata:l,clientInformation:u,state:y,redirectUrl:t.redirectUrl,scope:s||t.clientMetadata.scope,resource:c});return await t.saveCodeVerifier(m),await t.redirectToAuthorization(d),"REDIRECT"}async function dd(t,e,a){const s=__(t);if(e.validateResourceURL)return await e.validateResourceURL(s,a==null?void 0:a.resource);if(a){if(!$_({requestedResource:s,configuredResource:a.resource}))throw new Error(`Protected resource ${a.resource} does not match expected ${s} (or origin)`);return new URL(a.resource)}}function tn(t){const e=t.headers.get("WWW-Authenticate");if(!e)return;const[a,s]=e.split(" ");if(a.toLowerCase()!=="bearer"||!s)return;const n=/resource_metadata="([^"]*)"/.exec(e);if(n)try{return new URL(n[1])}catch{return}}async function fd(t,e,a=fetch){const s=await pd(t,"oauth-protected-resource",a,{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 h_.parse(await s.json())}async function Uo(t,e,a=fetch){try{return await a(t,{headers:e})}catch(s){if(s instanceof TypeError)return e?Uo(t,void 0,a):void 0;throw s}}function S_(t,e="",a={}){return e.endsWith("/")&&(e=e.slice(0,-1)),a.prependPathname?`${e}/.well-known/${t}`:`/.well-known/${t}${e}`}async function hd(t,e,a=fetch){return await Uo(t,{"MCP-Protocol-Version":e},a)}function R_(t,e){return!t||t.status>=400&&t.status<500&&e!=="/"}async function pd(t,e,a,s){var r,n;const i=new URL(t),o=(r=s==null?void 0:s.protocolVersion)!==null&&r!==void 0?r:Sr;let c;if(s!=null&&s.metadataUrl)c=new URL(s.metadataUrl);else{const u=S_(e,i.pathname);c=new URL(u,(n=s==null?void 0:s.metadataServerUrl)!==null&&n!==void 0?n:i),c.search=i.search}let l=await hd(c,o,a);if(!(s!=null&&s.metadataUrl)&&R_(l,i.pathname)){const u=new URL(`/.well-known/${e}`,i);l=await hd(u,o,a)}return l}async function k_(t,{authorizationServerUrl:e,protocolVersion:a}={},s=fetch){typeof t=="string"&&(t=new URL(t)),e||(e=t),typeof e=="string"&&(e=new URL(e)),a??(a=Sr);const r=await pd(e,"oauth-authorization-server",s,{protocolVersion:a,metadataServerUrl:e});if(!(!r||r.status===404)){if(!r.ok)throw new Error(`HTTP ${r.status} trying to load well-known OAuth metadata`);return So.parse(await r.json())}}function md(t){const e=typeof t=="string"?new URL(t):t,a=e.pathname!=="/",s=[];if(!a)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 r=e.pathname;return r.endsWith("/")&&(r=r.slice(0,-1)),s.push({url:new URL(`/.well-known/oauth-authorization-server${r}`,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${r}`,e.origin),type:"oidc"}),s.push({url:new URL(`${r}/.well-known/openid-configuration`,e.origin),type:"oidc"}),s}async function vd(t,{fetchFn:e=fetch,protocolVersion:a=Sr}={}){const s={"MCP-Protocol-Version":a,Accept:"application/json"},r=md(t);for(const{url:n,type:i}of r){const o=await Uo(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"?So.parse(await o.json()):p_.parse(await o.json())}}}async function gd(t,{metadata:e,clientInformation:a,redirectUrl:s,scope:r,state:n,resource:i}){let o;if(e){if(o=new URL(e.authorization_endpoint),!e.response_types_supported.includes(Lo))throw new Error(`Incompatible auth server: does not support response type ${Lo}`);if(e.code_challenge_methods_supported&&!e.code_challenge_methods_supported.includes(Fo))throw new Error(`Incompatible auth server: does not support code challenge method ${Fo}`)}else o=new URL("/authorize",t);const c=await f_(),l=c.code_verifier,u=c.code_challenge;return o.searchParams.set("response_type",Lo),o.searchParams.set("client_id",a.client_id),o.searchParams.set("code_challenge",u),o.searchParams.set("code_challenge_method",Fo),o.searchParams.set("redirect_uri",String(s)),n&&o.searchParams.set("state",n),r&&o.searchParams.set("scope",r),r!=null&&r.includes("offline_access")&&o.searchParams.append("prompt","consent"),i&&o.searchParams.set("resource",i.href),{authorizationUrl:o,codeVerifier:l}}async function yd(t,{metadata:e,clientInformation:a,authorizationCode:s,codeVerifier:r,redirectUri:n,resource:i,addClientAuthentication:o,fetchFn:c}){var l;const u="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(u))throw new Error(`Incompatible auth server: does not support grant type ${u}`);const y=new Headers({"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"}),d=new URLSearchParams({grant_type:u,code:s,code_verifier:r,redirect_uri:String(n)});if(o)o(y,d,t,e);else{const p=(l=e==null?void 0:e.token_endpoint_auth_methods_supported)!==null&&l!==void 0?l:[],h=cd(a,p);ud(h,a,y,d)}i&&d.set("resource",i.href);const m=await(c??fetch)(f,{method:"POST",headers:y,body:d});if(!m.ok)throw await en(m);return od.parse(await m.json())}async function _d(t,{metadata:e,clientInformation:a,refreshToken:s,resource:r,addClientAuthentication:n,fetchFn:i}){var o;const c="refresh_token";let l;if(e){if(l=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 l=new URL("/token",t);const u=new Headers({"Content-Type":"application/x-www-form-urlencoded"}),f=new URLSearchParams({grant_type:c,refresh_token:s});if(n)n(u,f,t,e);else{const d=(o=e==null?void 0:e.token_endpoint_auth_methods_supported)!==null&&o!==void 0?o:[],m=cd(a,d);ud(m,a,u,f)}r&&f.set("resource",r.href);const y=await(i??fetch)(l,{method:"POST",headers:u,body:f});if(!y.ok)throw await en(y);return od.parse({refresh_token:s,...await y.json()})}async function $d(t,{metadata:e,clientMetadata:a,fetchFn:s}){let r;if(e){if(!e.registration_endpoint)throw new Error("Incompatible auth server: does not support dynamic client registration");r=new URL(e.registration_endpoint)}else r=new URL("/register",t);const n=await(s??fetch)(r,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)});if(!n.ok)throw await en(n);return y_.parse(await n.json())}class wd extends Error{constructor(e,a){super(e),this.name="ParseError",this.type=a.type,this.field=a.field,this.value=a.value,this.line=a.line}}function Vo(t){}function bd(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=Vo,onError:a=Vo,onRetry:s=Vo,onComment:r}=t;let n="",i=!0,o,c="",l="";function u(p){const h=i?p.replace(/^\xEF\xBB\xBF/,""):p,[v,$]=O_(`${n}${h}`);for(const P of v)f(P);n=$,i=!1}function f(p){if(p===""){d();return}if(p.startsWith(":")){r&&r(p.slice(p.startsWith(": ")?2:1));return}const h=p.indexOf(":");if(h!==-1){const v=p.slice(0,h),$=p[h+1]===" "?2:1,P=p.slice(h+$);y(v,P,p);return}y(p,"",p)}function y(p,h,v){switch(p){case"event":l=h;break;case"data":c=`${c}${h}
|
|
9
|
-
`;break;case"id":o=h.includes("\0")?void 0:h;break;case"retry":/^\d+$/.test(h)?s(parseInt(h,10)):a(new wd(`Invalid \`retry\` value: "${h}"`,{type:"invalid-retry",value:h,line:v}));break;default:a(new wd(`Unknown field "${p.length>20?`${p.slice(0,20)}…`:p}"`,{type:"unknown-field",field:p,value:h,line:v}));break}}function d(){c.length>0&&e({id:o,event:l||void 0,data:c.endsWith(`
|
|
10
|
-
`)?c.slice(0,-1):c}),o=void 0,c="",l=""}function m(p={}){n&&p.consume&&f(n),i=!0,o=void 0,c="",l="",n=""}return{feed:u,reset:m}}function O_(t){const e=[];let a="",s=0;for(;s<t.length;){const r=t.indexOf("\r",s),n=t.indexOf(`
|
|
11
|
-
`,s);let i=-1;if(r!==-1&&n!==-1?i=Math.min(r,n):r!==-1?r===t.length-1?i=-1:i=r:n!==-1&&(i=n),i===-1){a=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,a]}class Ed extends Event{constructor(e,a){var s,r;super(e),this.code=(s=a==null?void 0:a.code)!=null?s:void 0,this.message=(r=a==null?void 0:a.message)!=null?r:void 0}[Symbol.for("nodejs.util.inspect.custom")](e,a,s){return s(Pd(this),a)}[Symbol.for("Deno.customInspect")](e,a){return e(Pd(this),a)}}function T_(t){const e=globalThis.DOMException;return typeof e=="function"?new e(t,"SyntaxError"):new SyntaxError(t)}function zo(t){return t instanceof Error?"errors"in t&&Array.isArray(t.errors)?t.errors.map(zo).join(", "):"cause"in t&&t.cause instanceof Error?`${t}: ${zo(t.cause)}`:t.message:`${t}`}function Pd(t){return{type:t.type,message:t.message,code:t.code,defaultPrevented:t.defaultPrevented,cancelable:t.cancelable,timeStamp:t.timeStamp}}var Sd=t=>{throw TypeError(t)},Ho=(t,e,a)=>e.has(t)||Sd("Cannot "+a),we=(t,e,a)=>(Ho(t,e,"read from private field"),a?a.call(t):e.get(t)),Ge=(t,e,a)=>e.has(t)?Sd("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,a),je=(t,e,a,s)=>(Ho(t,e,"write to private field"),e.set(t,a),a),Yt=(t,e,a)=>(Ho(t,e,"access private method"),a),ft,Or,Gr,rn,an,Na,Wr,Aa,fr,Yr,Xr,ea,ja,Ot,Zo,Ko,Bo,Rd,Jo,Qo,Da,Go,Wo;class sn extends EventTarget{constructor(e,a){var s,r;super(),Ge(this,Ot),this.CONNECTING=0,this.OPEN=1,this.CLOSED=2,Ge(this,ft),Ge(this,Or),Ge(this,Gr),Ge(this,rn),Ge(this,an),Ge(this,Na),Ge(this,Wr),Ge(this,Aa,null),Ge(this,fr),Ge(this,Yr),Ge(this,Xr,null),Ge(this,ea,null),Ge(this,ja,null),Ge(this,Ko,async n=>{var i;we(this,Yr).reset();const{body:o,redirected:c,status:l,headers:u}=n;if(l===204){Yt(this,Ot,Da).call(this,"Server sent HTTP 204, not reconnecting",204),this.close();return}if(c?je(this,Gr,new URL(n.url)):je(this,Gr,void 0),l!==200){Yt(this,Ot,Da).call(this,`Non-200 status code (${l})`,l);return}if(!(u.get("content-type")||"").startsWith("text/event-stream")){Yt(this,Ot,Da).call(this,'Invalid content type, expected "text/event-stream"',l);return}if(we(this,ft)===this.CLOSED)return;je(this,ft,this.OPEN);const f=new Event("open");if((i=we(this,ja))==null||i.call(this,f),this.dispatchEvent(f),typeof o!="object"||!o||!("getReader"in o)){Yt(this,Ot,Da).call(this,"Invalid response body, expected a web ReadableStream",l),this.close();return}const y=new TextDecoder,d=o.getReader();let m=!0;do{const{done:p,value:h}=await d.read();h&&we(this,Yr).feed(y.decode(h,{stream:!p})),p&&(m=!1,we(this,Yr).reset(),Yt(this,Ot,Go).call(this))}while(m)}),Ge(this,Bo,n=>{je(this,fr,void 0),!(n.name==="AbortError"||n.type==="aborted")&&Yt(this,Ot,Go).call(this,zo(n))}),Ge(this,Jo,n=>{typeof n.id=="string"&&je(this,Aa,n.id);const i=new MessageEvent(n.event||"message",{data:n.data,origin:we(this,Gr)?we(this,Gr).origin:we(this,Or).origin,lastEventId:n.id||""});we(this,ea)&&(!n.event||n.event==="message")&&we(this,ea).call(this,i),this.dispatchEvent(i)}),Ge(this,Qo,n=>{je(this,Na,n)}),Ge(this,Wo,()=>{je(this,Wr,void 0),we(this,ft)===this.CONNECTING&&Yt(this,Ot,Zo).call(this)});try{if(e instanceof URL)je(this,Or,e);else if(typeof e=="string")je(this,Or,new URL(e,C_()));else throw new Error("Invalid URL")}catch{throw T_("An invalid or illegal string was specified")}je(this,Yr,bd({onEvent:we(this,Jo),onRetry:we(this,Qo)})),je(this,ft,this.CONNECTING),je(this,Na,3e3),je(this,an,(s=a==null?void 0:a.fetch)!=null?s:globalThis.fetch),je(this,rn,(r=a==null?void 0:a.withCredentials)!=null?r:!1),Yt(this,Ot,Zo).call(this)}get readyState(){return we(this,ft)}get url(){return we(this,Or).href}get withCredentials(){return we(this,rn)}get onerror(){return we(this,Xr)}set onerror(e){je(this,Xr,e)}get onmessage(){return we(this,ea)}set onmessage(e){je(this,ea,e)}get onopen(){return we(this,ja)}set onopen(e){je(this,ja,e)}addEventListener(e,a,s){const r=a;super.addEventListener(e,r,s)}removeEventListener(e,a,s){const r=a;super.removeEventListener(e,r,s)}close(){we(this,Wr)&&clearTimeout(we(this,Wr)),we(this,ft)!==this.CLOSED&&(we(this,fr)&&we(this,fr).abort(),je(this,ft,this.CLOSED),je(this,fr,void 0))}}ft=new WeakMap,Or=new WeakMap,Gr=new WeakMap,rn=new WeakMap,an=new WeakMap,Na=new WeakMap,Wr=new WeakMap,Aa=new WeakMap,fr=new WeakMap,Yr=new WeakMap,Xr=new WeakMap,ea=new WeakMap,ja=new WeakMap,Ot=new WeakSet,Zo=function(){je(this,ft,this.CONNECTING),je(this,fr,new AbortController),we(this,an)(we(this,Or),Yt(this,Ot,Rd).call(this)).then(we(this,Ko)).catch(we(this,Bo))},Ko=new WeakMap,Bo=new WeakMap,Rd=function(){var t;const e={mode:"cors",redirect:"follow",headers:{Accept:"text/event-stream",...we(this,Aa)?{"Last-Event-ID":we(this,Aa)}:void 0},cache:"no-store",signal:(t=we(this,fr))==null?void 0:t.signal};return"window"in globalThis&&(e.credentials=this.withCredentials?"include":"same-origin"),e},Jo=new WeakMap,Qo=new WeakMap,Da=function(t,e){var a;we(this,ft)!==this.CLOSED&&je(this,ft,this.CLOSED);const s=new Ed("error",{code:e,message:t});(a=we(this,Xr))==null||a.call(this,s),this.dispatchEvent(s)},Go=function(t,e){var a;if(we(this,ft)===this.CLOSED)return;je(this,ft,this.CONNECTING);const s=new Ed("error",{code:e,message:t});(a=we(this,Xr))==null||a.call(this,s),this.dispatchEvent(s),je(this,Wr,setTimeout(we(this,Wo),we(this,Na)))},Wo=new WeakMap,sn.CONNECTING=0,sn.OPEN=1,sn.CLOSED=2;function C_(){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}class kd extends Error{constructor(e,a,s){super(`SSE error: ${a}`),this.code=e,this.event=s}}class I_{constructor(e,a){this._url=e,this._resourceMetadataUrl=void 0,this._eventSourceInit=a==null?void 0:a.eventSourceInit,this._requestInit=a==null?void 0:a.requestInit,this._authProvider=a==null?void 0:a.authProvider,this._fetch=a==null?void 0:a.fetch}async _authThenStart(){var e;if(!this._authProvider)throw new kt("No auth provider");let a;try{a=await kr(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(a!=="AUTHORIZED")throw new kt;return await this._startOrAuth()}async _commonHeaders(){var e;const a={};if(this._authProvider){const s=await this._authProvider.tokens();s&&(a.Authorization=`Bearer ${s.access_token}`)}return this._protocolVersion&&(a["mcp-protocol-version"]=this._protocolVersion),new Headers({...a,...(e=this._requestInit)===null||e===void 0?void 0:e.headers})}_startOrAuth(){var e,a,s;const r=(s=(a=(e=this===null||this===void 0?void 0:this._eventSourceInit)===null||e===void 0?void 0:e.fetch)!==null&&a!==void 0?a:this._fetch)!==null&&s!==void 0?s:fetch;return new Promise((n,i)=>{this._eventSource=new sn(this._url.href,{...this._eventSourceInit,fetch:async(o,c)=>{const l=await this._commonHeaders();l.set("Accept","text/event-stream");const u=await r(o,{...c,headers:l});return u.status===401&&u.headers.has("www-authenticate")&&(this._resourceMetadataUrl=tn(u)),u}}),this._abortController=new AbortController,this._eventSource.onerror=o=>{var c;if(o.code===401&&this._authProvider){this._authThenStart().then(n,i);return}const l=new kd(o.code,o.message,o);i(l),(c=this.onerror)===null||c===void 0||c.call(this,l)},this._eventSource.onopen=()=>{},this._eventSource.addEventListener("endpoint",o=>{var c;const l=o;try{if(this._endpoint=new URL(l.data,this._url),this._endpoint.origin!==this._url.origin)throw new Error(`Endpoint origin does not match connection origin: ${this._endpoint.origin}`)}catch(u){i(u),(c=this.onerror)===null||c===void 0||c.call(this,u),this.close();return}n()}),this._eventSource.onmessage=o=>{var c,l;const u=o;let f;try{f=Ra.parse(JSON.parse(u.data))}catch(y){(c=this.onerror)===null||c===void 0||c.call(this,y);return}(l=this.onmessage)===null||l===void 0||l.call(this,f)}})}async start(){if(this._eventSource)throw new Error("SSEClientTransport already started! If using Client class, note that connect() calls start() automatically.");return await this._startOrAuth()}async finishAuth(e){if(!this._authProvider)throw new kt("No auth provider");if(await kr(this._authProvider,{serverUrl:this._url,authorizationCode:e,resourceMetadataUrl:this._resourceMetadataUrl,fetchFn:this._fetch})!=="AUTHORIZED")throw new kt("Failed to authorize")}async close(){var e,a,s;(e=this._abortController)===null||e===void 0||e.abort(),(a=this._eventSource)===null||a===void 0||a.close(),(s=this.onclose)===null||s===void 0||s.call(this)}async send(e){var a,s,r;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:(a=this._abortController)===null||a===void 0?void 0:a.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=tn(o),await kr(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,fetchFn:this._fetch})!=="AUTHORIZED")throw new kt;return this.send(e)}const c=await o.text().catch(()=>null);throw new Error(`Error POSTing to endpoint (HTTP ${o.status}): ${c}`)}}catch(n){throw(r=this.onerror)===null||r===void 0||r.call(this,n),n}}setProtocolVersion(e){this._protocolVersion=e}}class N_ extends TransformStream{constructor({onError:e,onRetry:a,onComment:s}={}){let r;super({start(n){r=bd({onEvent:i=>{n.enqueue(i)},onError(i){e==="terminate"?n.error(i):typeof e=="function"&&e(i)},onRetry:a,onComment:s})},transform(n){r.feed(n)}})}}const A_={initialReconnectionDelay:1e3,maxReconnectionDelay:3e4,reconnectionDelayGrowFactor:1.5,maxRetries:2};class xa extends Error{constructor(e,a){super(`Streamable HTTP error: ${a}`),this.code=e}}class j_{constructor(e,a){var s;this._hasCompletedAuthFlow=!1,this._url=e,this._resourceMetadataUrl=void 0,this._requestInit=a==null?void 0:a.requestInit,this._authProvider=a==null?void 0:a.authProvider,this._fetch=a==null?void 0:a.fetch,this._sessionId=a==null?void 0:a.sessionId,this._reconnectionOptions=(s=a==null?void 0:a.reconnectionOptions)!==null&&s!==void 0?s:A_}async _authThenStart(){var e;if(!this._authProvider)throw new kt("No auth provider");let a;try{a=await kr(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(a!=="AUTHORIZED")throw new kt;return await this._startOrAuthSse({resumptionToken:void 0})}async _commonHeaders(){var e;const a={};if(this._authProvider){const r=await this._authProvider.tokens();r&&(a.Authorization=`Bearer ${r.access_token}`)}this._sessionId&&(a["mcp-session-id"]=this._sessionId),this._protocolVersion&&(a["mcp-protocol-version"]=this._protocolVersion);const s=this._normalizeHeaders((e=this._requestInit)===null||e===void 0?void 0:e.headers);return new Headers({...a,...s})}async _startOrAuthSse(e){var a,s,r;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((a=this._fetch)!==null&&a!==void 0?a: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 xa(o.status,`Failed to open SSE stream: ${o.statusText}`)}this._handleSseStream(o.body,e,!0)}catch(i){throw(r=this.onerror)===null||r===void 0||r.call(this,i),i}}_getNextReconnectionDelay(e){const a=this._reconnectionOptions.initialReconnectionDelay,s=this._reconnectionOptions.reconnectionDelayGrowFactor,r=this._reconnectionOptions.maxReconnectionDelay;return Math.min(a*Math.pow(s,e),r)}_normalizeHeaders(e){return e?e instanceof Headers?Object.fromEntries(e.entries()):Array.isArray(e)?Object.fromEntries(e):{...e}:{}}_scheduleReconnection(e,a=0){var s;const r=this._reconnectionOptions.maxRetries;if(r>0&&a>=r){(s=this.onerror)===null||s===void 0||s.call(this,new Error(`Maximum reconnection attempts (${r}) exceeded.`));return}const n=this._getNextReconnectionDelay(a);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,a+1)})},n)}_handleSseStream(e,a,s){if(!e)return;const{onresumptiontoken:r,replayMessageId:n}=a;let i;(async()=>{var c,l,u,f;try{const y=e.pipeThrough(new TextDecoderStream).pipeThrough(new N_).getReader();for(;;){const{value:d,done:m}=await y.read();if(m)break;if(d.id&&(i=d.id,r==null||r(d.id)),!d.event||d.event==="message")try{const p=Ra.parse(JSON.parse(d.data));n!==void 0&&_s(p)&&(p.id=n),(c=this.onmessage)===null||c===void 0||c.call(this,p)}catch(p){(l=this.onerror)===null||l===void 0||l.call(this,p)}}}catch(y){if((u=this.onerror)===null||u===void 0||u.call(this,new Error(`SSE stream disconnected: ${y}`)),s&&this._abortController&&!this._abortController.signal.aborted)try{this._scheduleReconnection({resumptionToken:i,onresumptiontoken:r,replayMessageId:n},0)}catch(d){(f=this.onerror)===null||f===void 0||f.call(this,new Error(`Failed to reconnect: ${d instanceof Error?d.message:String(d)}`))}}})()}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 kt("No auth provider");if(await kr(this._authProvider,{serverUrl:this._url,authorizationCode:e,resourceMetadataUrl:this._resourceMetadataUrl,fetchFn:this._fetch})!=="AUTHORIZED")throw new kt("Failed to authorize")}async close(){var e,a;(e=this._abortController)===null||e===void 0||e.abort(),(a=this.onclose)===null||a===void 0||a.call(this)}async send(e,a){var s,r,n,i;try{const{resumptionToken:o,onresumptiontoken:c}=a||{};if(o){this._startOrAuthSse({resumptionToken:o,replayMessageId:Ii(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 l=await this._commonHeaders();l.set("content-type","application/json"),l.set("accept","application/json, text/event-stream");const u={...this._requestInit,method:"POST",headers:l,body:JSON.stringify(e),signal:(s=this._abortController)===null||s===void 0?void 0:s.signal},f=await((r=this._fetch)!==null&&r!==void 0?r:fetch)(this._url,u),y=f.headers.get("mcp-session-id");if(y&&(this._sessionId=y),!f.ok){if(f.status===401&&this._authProvider){if(this._hasCompletedAuthFlow)throw new xa(401,"Server returned 401 after successful authentication");if(this._resourceMetadataUrl=tn(f),await kr(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,fetchFn:this._fetch})!=="AUTHORIZED")throw new kt;return this._hasCompletedAuthFlow=!0,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,f.status===202){Fc(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=f.headers.get("content-type");if(m)if(p!=null&&p.includes("text/event-stream"))this._handleSseStream(f.body,{onresumptiontoken:c},!1);else if(p!=null&&p.includes("application/json")){const h=await f.json(),v=Array.isArray(h)?h.map($=>Ra.parse($)):[Ra.parse(h)];for(const $ of v)(n=this.onmessage)===null||n===void 0||n.call(this,$)}else throw new xa(-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,a,s;if(this._sessionId)try{const r=await this._commonHeaders(),n={...this._requestInit,method:"DELETE",headers:r,signal:(e=this._abortController)===null||e===void 0?void 0:e.signal},i=await((a=this._fetch)!==null&&a!==void 0?a:fetch)(this._url,n);if(!i.ok&&i.status!==405)throw new xa(i.status,`Failed to terminate session: ${i.statusText}`);this._sessionId=void 0}catch(r){throw(s=this.onerror)===null||s===void 0||s.call(this,r),r}}setProtocolVersion(e){this._protocolVersion=e}get protocolVersion(){return this._protocolVersion}}class D_ extends ro{constructor(e,a){var s;super(a),this._serverInfo=e,this._loggingLevels=new Map,this.LOG_LEVEL_SEVERITY=new Map(Ta.options.map((r,n)=>[r,n])),this.isMessageIgnored=(r,n)=>{const i=this._loggingLevels.get(n);return i?this.LOG_LEVEL_SEVERITY.get(r)<this.LOG_LEVEL_SEVERITY.get(i):!1},this._capabilities=(s=a==null?void 0:a.capabilities)!==null&&s!==void 0?s:{},this._instructions=a==null?void 0:a.instructions,this.setRequestHandler(ws,r=>this._oninitialize(r)),this.setNotificationHandler(bs,()=>{var r;return(r=this.oninitialized)===null||r===void 0?void 0:r.call(this)}),this._capabilities.logging&&this.setRequestHandler(Qi,async(r,n)=>{var i;const o=n.sessionId||((i=n.requestInfo)===null||i===void 0?void 0:i.headers["mcp-session-id"])||void 0,{level:c}=r.params,l=Ta.safeParse(c);return l.success&&this._loggingLevels.set(o,l.data),{}})}registerCapabilities(e){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=ao(this._capabilities,e)}assertCapabilityForMethod(e){var a,s,r;switch(e){case"sampling/createMessage":if(!(!((a=this._clientCapabilities)===null||a===void 0)&&a.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(!(!((r=this._clientCapabilities)===null||r===void 0)&&r.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 a=e.params.protocolVersion;return this._clientCapabilities=e.params.capabilities,this._clientVersion=e.params.clientInfo,{protocolVersion:ki.includes(a)?a:Sr,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"},lr)}async createMessage(e,a){return this.request({method:"sampling/createMessage",params:e},Gi,a)}async elicitInput(e,a){const s=await this.request({method:"elicitation/create",params:e},Wi,a);if(s.action==="accept"&&s.content)try{const r=new id,n=r.compile(e.requestedSchema);if(!n(s.content))throw new Ce(R.ErrorCode.InvalidParams,`Elicitation response content does not match requested schema: ${r.errorsText(n.errors)}`)}catch(r){throw r instanceof Ce?r:new Ce(R.ErrorCode.InternalError,`Error validating elicitation response: ${r}`)}return s}async listRoots(e,a){return this.request({method:"roots/list",params:e},eo,a)}async sendLoggingMessage(e,a){if(this._capabilities.logging&&!this.isMessageIgnored(e.level,a))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 x_=Symbol("Let zodToJsonSchema decide on which parser to use"),Od={name:void 0,$refStrategy:"root",basePath:["#"],effectStrategy:"input",pipeStrategy:"all",dateStrategy:"format:date-time",mapStrategy:"entries",removeAdditionalStrategy:"passthrough",allowedAdditionalProperties:!0,rejectedAdditionalProperties:!1,definitionPath:"definitions",target:"jsonSchema7",strictUnions:!1,definitions:{},errorMessages:!1,markdownDescription:!1,patternStrategy:"escape",applyRegexFlags:!1,emailStrategy:"format:email",base64Strategy:"contentEncoding:base64",nameStrategy:"ref",openAiAnyTypeName:"OpenAiAnyType"},M_=t=>typeof t=="string"?{...Od,name:t}:{...Od,...t},L_=t=>{const e=M_(t),a=e.name!==void 0?[...e.basePath,e.definitionPath,e.name]:e.basePath;return{...e,flags:{hasReferencedOpenAiAnyType:!1},currentPath:a,propertyPath:void 0,seen:new Map(Object.entries(e.definitions).map(([s,r])=>[r._def,{def:r._def,path:[...e.basePath,e.definitionPath,s],jsonSchema:void 0}]))}};function Td(t,e,a,s){s!=null&&s.errorMessages&&a&&(t.errorMessage={...t.errorMessage,[e]:a})}function ke(t,e,a,s,r){t[e]=a,Td(t,e,s,r)}const Cd=(t,e)=>{let a=0;for(;a<t.length&&a<e.length&&t[a]===e[a];a++);return[(t.length-a).toString(),...e.slice(a)].join("/")};function ht(t){if(t.target!=="openAi")return{};const e=[...t.basePath,t.definitionPath,t.openAiAnyTypeName];return t.flags.hasReferencedOpenAiAnyType=!0,{$ref:t.$refStrategy==="relative"?Cd(e,t.currentPath):e.join("/")}}function F_(t,e){var s,r,n;const a={type:"array"};return(s=t.type)!=null&&s._def&&((n=(r=t.type)==null?void 0:r._def)==null?void 0:n.typeName)!==U.ZodAny&&(a.items=Re(t.type._def,{...e,currentPath:[...e.currentPath,"items"]})),t.minLength&&ke(a,"minItems",t.minLength.value,t.minLength.message,e),t.maxLength&&ke(a,"maxItems",t.maxLength.value,t.maxLength.message,e),t.exactLength&&(ke(a,"minItems",t.exactLength.value,t.exactLength.message,e),ke(a,"maxItems",t.exactLength.value,t.exactLength.message,e)),a}function q_(t,e){const a={type:"integer",format:"int64"};if(!t.checks)return a;for(const s of t.checks)switch(s.kind){case"min":e.target==="jsonSchema7"?s.inclusive?ke(a,"minimum",s.value,s.message,e):ke(a,"exclusiveMinimum",s.value,s.message,e):(s.inclusive||(a.exclusiveMinimum=!0),ke(a,"minimum",s.value,s.message,e));break;case"max":e.target==="jsonSchema7"?s.inclusive?ke(a,"maximum",s.value,s.message,e):ke(a,"exclusiveMaximum",s.value,s.message,e):(s.inclusive||(a.exclusiveMaximum=!0),ke(a,"maximum",s.value,s.message,e));break;case"multipleOf":ke(a,"multipleOf",s.value,s.message,e);break}return a}function U_(){return{type:"boolean"}}function Id(t,e){return Re(t.type._def,e)}const V_=(t,e)=>Re(t.innerType._def,e);function Nd(t,e,a){const s=a??e.dateStrategy;if(Array.isArray(s))return{anyOf:s.map((r,n)=>Nd(t,e,r))};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 z_(t,e)}}const z_=(t,e)=>{const a={type:"integer",format:"unix-time"};if(e.target==="openApi3")return a;for(const s of t.checks)switch(s.kind){case"min":ke(a,"minimum",s.value,s.message,e);break;case"max":ke(a,"maximum",s.value,s.message,e);break}return a};function H_(t,e){return{...Re(t.innerType._def,e),default:t.defaultValue()}}function Z_(t,e){return e.effectStrategy==="input"?Re(t.schema._def,e):ht(e)}function K_(t){return{type:"string",enum:Array.from(t.values)}}const B_=t=>"type"in t&&t.type==="string"?!1:"allOf"in t;function J_(t,e){const a=[Re(t.left._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),Re(t.right._def,{...e,currentPath:[...e.currentPath,"allOf","1"]})].filter(n=>!!n);let s=e.target==="jsonSchema2019-09"?{unevaluatedProperties:!1}:void 0;const r=[];return a.forEach(n=>{if(B_(n))r.push(...n.allOf),n.unevaluatedProperties===void 0&&(s=void 0);else{let i=n;if("additionalProperties"in n&&n.additionalProperties===!1){const{additionalProperties:o,...c}=n;i=c}else s=void 0;r.push(i)}}),r.length?{allOf:r,...s}:void 0}function Q_(t,e){const a=typeof t.value;return a!=="bigint"&&a!=="number"&&a!=="boolean"&&a!=="string"?{type:Array.isArray(t.value)?"array":"object"}:e.target==="openApi3"?{type:a==="bigint"?"integer":a,enum:[t.value]}:{type:a==="bigint"?"integer":a,const:t.value}}let Yo;const Tt={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:()=>(Yo===void 0&&(Yo=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),Yo),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 Ad(t,e){const a={type:"string"};if(t.checks)for(const s of t.checks)switch(s.kind){case"min":ke(a,"minLength",typeof a.minLength=="number"?Math.max(a.minLength,s.value):s.value,s.message,e);break;case"max":ke(a,"maxLength",typeof a.maxLength=="number"?Math.min(a.maxLength,s.value):s.value,s.message,e);break;case"email":switch(e.emailStrategy){case"format:email":Ct(a,"email",s.message,e);break;case"format:idn-email":Ct(a,"idn-email",s.message,e);break;case"pattern:zod":ct(a,Tt.email,s.message,e);break}break;case"url":Ct(a,"uri",s.message,e);break;case"uuid":Ct(a,"uuid",s.message,e);break;case"regex":ct(a,s.regex,s.message,e);break;case"cuid":ct(a,Tt.cuid,s.message,e);break;case"cuid2":ct(a,Tt.cuid2,s.message,e);break;case"startsWith":ct(a,RegExp(`^${Xo(s.value,e)}`),s.message,e);break;case"endsWith":ct(a,RegExp(`${Xo(s.value,e)}$`),s.message,e);break;case"datetime":Ct(a,"date-time",s.message,e);break;case"date":Ct(a,"date",s.message,e);break;case"time":Ct(a,"time",s.message,e);break;case"duration":Ct(a,"duration",s.message,e);break;case"length":ke(a,"minLength",typeof a.minLength=="number"?Math.max(a.minLength,s.value):s.value,s.message,e),ke(a,"maxLength",typeof a.maxLength=="number"?Math.min(a.maxLength,s.value):s.value,s.message,e);break;case"includes":{ct(a,RegExp(Xo(s.value,e)),s.message,e);break}case"ip":{s.version!=="v6"&&Ct(a,"ipv4",s.message,e),s.version!=="v4"&&Ct(a,"ipv6",s.message,e);break}case"base64url":ct(a,Tt.base64url,s.message,e);break;case"jwt":ct(a,Tt.jwt,s.message,e);break;case"cidr":{s.version!=="v6"&&ct(a,Tt.ipv4Cidr,s.message,e),s.version!=="v4"&&ct(a,Tt.ipv6Cidr,s.message,e);break}case"emoji":ct(a,Tt.emoji(),s.message,e);break;case"ulid":{ct(a,Tt.ulid,s.message,e);break}case"base64":{switch(e.base64Strategy){case"format:binary":{Ct(a,"binary",s.message,e);break}case"contentEncoding:base64":{ke(a,"contentEncoding","base64",s.message,e);break}case"pattern:zod":{ct(a,Tt.base64,s.message,e);break}}break}case"nanoid":ct(a,Tt.nanoid,s.message,e)}return a}function Xo(t,e){return e.patternStrategy==="escape"?W_(t):t}const G_=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function W_(t){let e="";for(let a=0;a<t.length;a++)G_.has(t[a])||(e+="\\"),e+=t[a];return e}function Ct(t,e,a,s){var r;t.format||(r=t.anyOf)!=null&&r.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,...a&&s.errorMessages&&{errorMessage:{format:a}}})):ke(t,"format",e,a,s)}function ct(t,e,a,s){var r;t.pattern||(r=t.allOf)!=null&&r.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:jd(e,s),...a&&s.errorMessages&&{errorMessage:{pattern:a}}})):ke(t,"pattern",jd(e,s),a,s)}function jd(t,e){var c;if(!e.applyRegexFlags||!t.flags)return t.source;const a={i:t.flags.includes("i"),m:t.flags.includes("m"),s:t.flags.includes("s")},s=a.i?t.source.toLowerCase():t.source;let r="",n=!1,i=!1,o=!1;for(let l=0;l<s.length;l++){if(n){r+=s[l],n=!1;continue}if(a.i){if(i){if(s[l].match(/[a-z]/)){o?(r+=s[l],r+=`${s[l-2]}-${s[l]}`.toUpperCase(),o=!1):s[l+1]==="-"&&((c=s[l+2])!=null&&c.match(/[a-z]/))?(r+=s[l],o=!0):r+=`${s[l]}${s[l].toUpperCase()}`;continue}}else if(s[l].match(/[a-z]/)){r+=`[${s[l]}${s[l].toUpperCase()}]`;continue}}if(a.m){if(s[l]==="^"){r+=`(^|(?<=[\r
|
|
13
|
-
]))`;continue}else if(s[l]==="$"){r+=`($|(?=[\r
|
|
14
|
-
]))`;continue}}if(a.s&&s[l]==="."){r+=i?`${s[l]}\r
|
|
15
|
-
`:`[${s[l]}\r
|
|
16
|
-
]`;continue}r+=s[l],s[l]==="\\"?n=!0:i&&s[l]==="]"?i=!1:!i&&s[l]==="["&&(i=!0)}try{new RegExp(r)}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 r}function Dd(t,e){var s,r,n,i,o,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"&&((s=t.keyType)==null?void 0:s._def.typeName)===U.ZodEnum)return{type:"object",required:t.keyType._def.values,properties:t.keyType._def.values.reduce((l,u)=>({...l,[u]:Re(t.valueType._def,{...e,currentPath:[...e.currentPath,"properties",u]})??ht(e)}),{}),additionalProperties:e.rejectedAdditionalProperties};const a={type:"object",additionalProperties:Re(t.valueType._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]})??e.allowedAdditionalProperties};if(e.target==="openApi3")return a;if(((r=t.keyType)==null?void 0:r._def.typeName)===U.ZodString&&((n=t.keyType._def.checks)!=null&&n.length)){const{type:l,...u}=Ad(t.keyType._def,e);return{...a,propertyNames:u}}else{if(((i=t.keyType)==null?void 0:i._def.typeName)===U.ZodEnum)return{...a,propertyNames:{enum:t.keyType._def.values}};if(((o=t.keyType)==null?void 0:o._def.typeName)===U.ZodBranded&&t.keyType._def.type._def.typeName===U.ZodString&&((c=t.keyType._def.type._def.checks)!=null&&c.length)){const{type:l,...u}=Id(t.keyType._def,e);return{...a,propertyNames:u}}}return a}function Y_(t,e){if(e.mapStrategy==="record")return Dd(t,e);const a=Re(t.keyType._def,{...e,currentPath:[...e.currentPath,"items","items","0"]})||ht(e),s=Re(t.valueType._def,{...e,currentPath:[...e.currentPath,"items","items","1"]})||ht(e);return{type:"array",maxItems:125,items:{type:"array",items:[a,s],minItems:2,maxItems:2}}}function X_(t){const e=t.values,s=Object.keys(t.values).filter(n=>typeof e[e[n]]!="number").map(n=>e[n]),r=Array.from(new Set(s.map(n=>typeof n)));return{type:r.length===1?r[0]==="string"?"string":"number":["string","number"],enum:s}}function e0(t){return t.target==="openAi"?void 0:{not:ht({...t,currentPath:[...t.currentPath,"not"]})}}function t0(t){return t.target==="openApi3"?{enum:["null"],nullable:!0}:{type:"null"}}const nn={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};function r0(t,e){if(e.target==="openApi3")return xd(t,e);const a=t.options instanceof Map?Array.from(t.options.values()):t.options;if(a.every(s=>s._def.typeName in nn&&(!s._def.checks||!s._def.checks.length))){const s=a.reduce((r,n)=>{const i=nn[n._def.typeName];return i&&!r.includes(i)?[...r,i]:r},[]);return{type:s.length>1?s:s[0]}}else if(a.every(s=>s._def.typeName==="ZodLiteral"&&!s.description)){const s=a.reduce((r,n)=>{const i=typeof n._def.value;switch(i){case"string":case"number":case"boolean":return[...r,i];case"bigint":return[...r,"integer"];case"object":if(n._def.value===null)return[...r,"null"];case"symbol":case"undefined":case"function":default:return r}},[]);if(s.length===a.length){const r=s.filter((n,i,o)=>o.indexOf(n)===i);return{type:r.length>1?r:r[0],enum:a.reduce((n,i)=>n.includes(i._def.value)?n:[...n,i._def.value],[])}}}else if(a.every(s=>s._def.typeName==="ZodEnum"))return{type:"string",enum:a.reduce((s,r)=>[...s,...r._def.values.filter(n=>!s.includes(n))],[])};return xd(t,e)}const xd=(t,e)=>{const a=(t.options instanceof Map?Array.from(t.options.values()):t.options).map((s,r)=>Re(s._def,{...e,currentPath:[...e.currentPath,"anyOf",`${r}`]})).filter(s=>!!s&&(!e.strictUnions||typeof s=="object"&&Object.keys(s).length>0));return a.length?{anyOf:a}:void 0};function a0(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:nn[t.innerType._def.typeName],nullable:!0}:{type:[nn[t.innerType._def.typeName],"null"]};if(e.target==="openApi3"){const s=Re(t.innerType._def,{...e,currentPath:[...e.currentPath]});return s&&"$ref"in s?{allOf:[s],nullable:!0}:s&&{...s,nullable:!0}}const a=Re(t.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","0"]});return a&&{anyOf:[a,{type:"null"}]}}function s0(t,e){const a={type:"number"};if(!t.checks)return a;for(const s of t.checks)switch(s.kind){case"int":a.type="integer",Td(a,"type",s.message,e);break;case"min":e.target==="jsonSchema7"?s.inclusive?ke(a,"minimum",s.value,s.message,e):ke(a,"exclusiveMinimum",s.value,s.message,e):(s.inclusive||(a.exclusiveMinimum=!0),ke(a,"minimum",s.value,s.message,e));break;case"max":e.target==="jsonSchema7"?s.inclusive?ke(a,"maximum",s.value,s.message,e):ke(a,"exclusiveMaximum",s.value,s.message,e):(s.inclusive||(a.exclusiveMaximum=!0),ke(a,"maximum",s.value,s.message,e));break;case"multipleOf":ke(a,"multipleOf",s.value,s.message,e);break}return a}function n0(t,e){const a=e.target==="openAi",s={type:"object",properties:{}},r=[],n=t.shape();for(const o in n){let c=n[o];if(c===void 0||c._def===void 0)continue;let l=o0(c);l&&a&&(c._def.typeName==="ZodOptional"&&(c=c._def.innerType),c.isNullable()||(c=c.nullable()),l=!1);const u=Re(c._def,{...e,currentPath:[...e.currentPath,"properties",o],propertyPath:[...e.currentPath,"properties",o]});u!==void 0&&(s.properties[o]=u,l||r.push(o))}r.length&&(s.required=r);const i=i0(t,e);return i!==void 0&&(s.additionalProperties=i),s}function i0(t,e){if(t.catchall._def.typeName!=="ZodNever")return Re(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 o0(t){try{return t.isOptional()}catch{return!0}}const l0=(t,e)=>{var s;if(e.currentPath.toString()===((s=e.propertyPath)==null?void 0:s.toString()))return Re(t.innerType._def,e);const a=Re(t.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","1"]});return a?{anyOf:[{not:ht(e)},a]}:ht(e)},c0=(t,e)=>{if(e.pipeStrategy==="input")return Re(t.in._def,e);if(e.pipeStrategy==="output")return Re(t.out._def,e);const a=Re(t.in._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),s=Re(t.out._def,{...e,currentPath:[...e.currentPath,"allOf",a?"1":"0"]});return{allOf:[a,s].filter(r=>r!==void 0)}};function u0(t,e){return Re(t.type._def,e)}function d0(t,e){const s={type:"array",uniqueItems:!0,items:Re(t.valueType._def,{...e,currentPath:[...e.currentPath,"items"]})};return t.minSize&&ke(s,"minItems",t.minSize.value,t.minSize.message,e),t.maxSize&&ke(s,"maxItems",t.maxSize.value,t.maxSize.message,e),s}function f0(t,e){return t.rest?{type:"array",minItems:t.items.length,items:t.items.map((a,s)=>Re(a._def,{...e,currentPath:[...e.currentPath,"items",`${s}`]})).reduce((a,s)=>s===void 0?a:[...a,s],[]),additionalItems:Re(t.rest._def,{...e,currentPath:[...e.currentPath,"additionalItems"]})}:{type:"array",minItems:t.items.length,maxItems:t.items.length,items:t.items.map((a,s)=>Re(a._def,{...e,currentPath:[...e.currentPath,"items",`${s}`]})).reduce((a,s)=>s===void 0?a:[...a,s],[])}}function h0(t){return{not:ht(t)}}function p0(t){return ht(t)}const m0=(t,e)=>Re(t.innerType._def,e),v0=(t,e,a)=>{switch(e){case U.ZodString:return Ad(t,a);case U.ZodNumber:return s0(t,a);case U.ZodObject:return n0(t,a);case U.ZodBigInt:return q_(t,a);case U.ZodBoolean:return U_();case U.ZodDate:return Nd(t,a);case U.ZodUndefined:return h0(a);case U.ZodNull:return t0(a);case U.ZodArray:return F_(t,a);case U.ZodUnion:case U.ZodDiscriminatedUnion:return r0(t,a);case U.ZodIntersection:return J_(t,a);case U.ZodTuple:return f0(t,a);case U.ZodRecord:return Dd(t,a);case U.ZodLiteral:return Q_(t,a);case U.ZodEnum:return K_(t);case U.ZodNativeEnum:return X_(t);case U.ZodNullable:return a0(t,a);case U.ZodOptional:return l0(t,a);case U.ZodMap:return Y_(t,a);case U.ZodSet:return d0(t,a);case U.ZodLazy:return()=>t.getter()._def;case U.ZodPromise:return u0(t,a);case U.ZodNaN:case U.ZodNever:return e0(a);case U.ZodEffects:return Z_(t,a);case U.ZodAny:return ht(a);case U.ZodUnknown:return p0(a);case U.ZodDefault:return H_(t,a);case U.ZodBranded:return Id(t,a);case U.ZodReadonly:return m0(t,a);case U.ZodCatch:return V_(t,a);case U.ZodPipeline:return c0(t,a);case U.ZodFunction:case U.ZodVoid:case U.ZodSymbol:return;default:return(s=>{})()}};function Re(t,e,a=!1){var o;const s=e.seen.get(t);if(e.override){const c=(o=e.override)==null?void 0:o.call(e,t,e,s,a);if(c!==x_)return c}if(s&&!a){const c=g0(s,e);if(c!==void 0)return c}const r={def:t,path:e.currentPath,jsonSchema:void 0};e.seen.set(t,r);const n=v0(t,t.typeName,e),i=typeof n=="function"?Re(n(),e):n;if(i&&y0(t,e,i),e.postProcess){const c=e.postProcess(i,t,e);return r.jsonSchema=i,c}return r.jsonSchema=i,i}const g0=(t,e)=>{switch(e.$refStrategy){case"root":return{$ref:t.path.join("/")};case"relative":return{$ref:Cd(e.currentPath,t.path)};case"none":case"seen":return t.path.length<e.currentPath.length&&t.path.every((a,s)=>e.currentPath[s]===a)?(console.warn(`Recursive reference detected at ${e.currentPath.join("/")}! Defaulting to any`),ht(e)):e.$refStrategy==="seen"?ht(e):void 0}},y0=(t,e,a)=>(t.description&&(a.description=t.description,e.markdownDescription&&(a.markdownDescription=t.description)),a),Md=(t,e)=>{const a=L_(e);let s=typeof e=="object"&&e.definitions?Object.entries(e.definitions).reduce((c,[l,u])=>({...c,[l]:Re(u._def,{...a,currentPath:[...a.basePath,a.definitionPath,l]},!0)??ht(a)}),{}):void 0;const r=typeof e=="string"?e:(e==null?void 0:e.nameStrategy)==="title"||e==null?void 0:e.name,n=Re(t._def,r===void 0?a:{...a,currentPath:[...a.basePath,a.definitionPath,r]},!1)??ht(a),i=typeof e=="object"&&e.name!==void 0&&e.nameStrategy==="title"?e.name:void 0;i!==void 0&&(n.title=i),a.flags.hasReferencedOpenAiAnyType&&(s||(s={}),s[a.openAiAnyTypeName]||(s[a.openAiAnyTypeName]={type:["string","number","integer","boolean","array","null"],items:{$ref:a.$refStrategy==="relative"?"1":[...a.basePath,a.definitionPath,a.openAiAnyTypeName].join("/")}}));const o=r===void 0?s?{...n,[a.definitionPath]:s}:n:{$ref:[...a.$refStrategy==="relative"?[]:a.basePath,a.definitionPath,r].join("/"),[a.definitionPath]:{...s,[r]:n}};return a.target==="jsonSchema7"?o.$schema="http://json-schema.org/draft-07/schema#":(a.target==="jsonSchema2019-09"||a.target==="openAi")&&(o.$schema="https://json-schema.org/draft/2019-09/schema#"),a.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};class _0{constructor(e,a){this._registeredResources={},this._registeredResourceTemplates={},this._registeredTools={},this._registeredPrompts={},this._toolHandlersInitialized=!1,this._completionHandlerInitialized=!1,this._resourceHandlersInitialized=!1,this._promptHandlersInitialized=!1,this.server=new D_(e,a)}async connect(e){return await this.server.connect(e)}async close(){await this.server.close()}setToolRequestHandlers(){this._toolHandlersInitialized||(this.server.assertCanSetRequestHandler(As.shape.method.value),this.server.assertCanSetRequestHandler(Ds.shape.method.value),this.server.registerCapabilities({tools:{listChanged:!0}}),this.server.setRequestHandler(As,()=>({tools:Object.entries(this._registeredTools).filter(([,e])=>e.enabled).map(([e,a])=>{const s={name:e,title:a.title,description:a.description,inputSchema:a.inputSchema?Md(a.inputSchema,{strictUnions:!0}):w0,annotations:a.annotations,_meta:a._meta};return a.outputSchema&&(s.outputSchema=Md(a.outputSchema,{strictUnions:!0})),s})})),this.server.setRequestHandler(Ds,async(e,a)=>{const s=this._registeredTools[e.params.name];if(!s)throw new Ce(R.ErrorCode.InvalidParams,`Tool ${e.params.name} not found`);if(!s.enabled)throw new Ce(R.ErrorCode.InvalidParams,`Tool ${e.params.name} disabled`);let r;if(s.inputSchema){const n=await s.inputSchema.safeParseAsync(e.params.arguments);if(!n.success)throw new Ce(R.ErrorCode.InvalidParams,`Invalid arguments for tool ${e.params.name}: ${n.error.message}`);const i=n.data,o=s.callback;try{r=await Promise.resolve(o(i,a))}catch(c){r={content:[{type:"text",text:c instanceof Error?c.message:String(c)}],isError:!0}}}else{const n=s.callback;try{r=await Promise.resolve(n(a))}catch(i){r={content:[{type:"text",text:i instanceof Error?i.message:String(i)}],isError:!0}}}if(s.outputSchema&&!r.isError){if(!r.structuredContent)throw new Ce(R.ErrorCode.InvalidParams,`Tool ${e.params.name} has an output schema but no structured content was provided`);const n=await s.outputSchema.safeParseAsync(r.structuredContent);if(!n.success)throw new Ce(R.ErrorCode.InvalidParams,`Invalid structured content for tool ${e.params.name}: ${n.error.message}`)}return r}),this._toolHandlersInitialized=!0)}setCompletionRequestHandler(){this._completionHandlerInitialized||(this.server.assertCanSetRequestHandler(xs.shape.method.value),this.server.registerCapabilities({completions:{}}),this.server.setRequestHandler(xs,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 Ce(R.ErrorCode.InvalidParams,`Invalid completion reference: ${e.params.ref}`)}}),this._completionHandlerInitialized=!0)}async handlePromptCompletion(e,a){const s=this._registeredPrompts[a.name];if(!s)throw new Ce(R.ErrorCode.InvalidParams,`Prompt ${a.name} not found`);if(!s.enabled)throw new Ce(R.ErrorCode.InvalidParams,`Prompt ${a.name} disabled`);if(!s.argsSchema)return on;const r=s.argsSchema.shape[e.params.argument.name];if(!(r instanceof Ca))return on;const i=await r._def.complete(e.params.argument.value,e.params.context);return Fd(i)}async handleResourceCompletion(e,a){const s=Object.values(this._registeredResourceTemplates).find(i=>i.resourceTemplate.uriTemplate.toString()===a.uri);if(!s){if(this._registeredResources[a.uri])return on;throw new Ce(R.ErrorCode.InvalidParams,`Resource template ${e.params.ref.uri} not found`)}const r=s.resourceTemplate.completeCallback(e.params.argument.name);if(!r)return on;const n=await r(e.params.argument.value,e.params.context);return Fd(n)}setResourceRequestHandlers(){this._resourceHandlersInitialized||(this.server.assertCanSetRequestHandler(Ss.shape.method.value),this.server.assertCanSetRequestHandler(Rs.shape.method.value),this.server.assertCanSetRequestHandler(ks.shape.method.value),this.server.registerCapabilities({resources:{listChanged:!0}}),this.server.setRequestHandler(Ss,async(e,a)=>{const s=Object.entries(this._registeredResources).filter(([n,i])=>i.enabled).map(([n,i])=>({uri:n,name:i.name,...i.metadata})),r=[];for(const n of Object.values(this._registeredResourceTemplates)){if(!n.resourceTemplate.listCallback)continue;const i=await n.resourceTemplate.listCallback(a);for(const o of i.resources)r.push({...n.metadata,...o})}return{resources:[...s,...r]}}),this.server.setRequestHandler(Rs,async()=>({resourceTemplates:Object.entries(this._registeredResourceTemplates).map(([a,s])=>({name:a,uriTemplate:s.resourceTemplate.uriTemplate.toString(),...s.metadata}))})),this.server.setRequestHandler(ks,async(e,a)=>{const s=new URL(e.params.uri),r=this._registeredResources[s.toString()];if(r){if(!r.enabled)throw new Ce(R.ErrorCode.InvalidParams,`Resource ${s} disabled`);return r.readCallback(s,a)}for(const n of Object.values(this._registeredResourceTemplates)){const i=n.resourceTemplate.uriTemplate.match(s.toString());if(i)return n.readCallback(s,i,a)}throw new Ce(R.ErrorCode.InvalidParams,`Resource ${s} not found`)}),this.setCompletionRequestHandler(),this._resourceHandlersInitialized=!0)}setPromptRequestHandlers(){this._promptHandlersInitialized||(this.server.assertCanSetRequestHandler(Os.shape.method.value),this.server.assertCanSetRequestHandler(Ts.shape.method.value),this.server.registerCapabilities({prompts:{listChanged:!0}}),this.server.setRequestHandler(Os,()=>({prompts:Object.entries(this._registeredPrompts).filter(([,e])=>e.enabled).map(([e,a])=>({name:e,title:a.title,description:a.description,arguments:a.argsSchema?E0(a.argsSchema):void 0}))})),this.server.setRequestHandler(Ts,async(e,a)=>{const s=this._registeredPrompts[e.params.name];if(!s)throw new Ce(R.ErrorCode.InvalidParams,`Prompt ${e.params.name} not found`);if(!s.enabled)throw new Ce(R.ErrorCode.InvalidParams,`Prompt ${e.params.name} disabled`);if(s.argsSchema){const r=await s.argsSchema.safeParseAsync(e.params.arguments);if(!r.success)throw new Ce(R.ErrorCode.InvalidParams,`Invalid arguments for prompt ${e.params.name}: ${r.error.message}`);const n=r.data,i=s.callback;return await Promise.resolve(i(n,a))}else{const r=s.callback;return await Promise.resolve(r(a))}}),this.setCompletionRequestHandler(),this._promptHandlersInitialized=!0)}resource(e,a,...s){let r;typeof s[0]=="object"&&(r=s.shift());const n=s[0];if(typeof a=="string"){if(this._registeredResources[a])throw new Error(`Resource ${a} is already registered`);const i=this._createRegisteredResource(e,void 0,a,r,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,a,r,n);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),i}}registerResource(e,a,s,r){if(typeof a=="string"){if(this._registeredResources[a])throw new Error(`Resource ${a} is already registered`);const n=this._createRegisteredResource(e,s.title,a,s,r);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,a,s,r);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),n}}_createRegisteredResource(e,a,s,r,n){const i={name:e,title:a,metadata:r,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,a,s,r,n){const i={resourceTemplate:s,title:a,metadata:r,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,a,s,r,n){const i={title:a,description:s,argsSchema:r===void 0?void 0:H(r),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=H(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,a,s,r,n,i,o,c){const l={title:a,description:s,inputSchema:r===void 0?void 0:H(r),outputSchema:n===void 0?void 0:H(n),annotations:i,_meta:o,callback:c,enabled:!0,disable:()=>l.update({enabled:!1}),enable:()=>l.update({enabled:!0}),remove:()=>l.update({name:null}),update:u=>{typeof u.name<"u"&&u.name!==e&&(delete this._registeredTools[e],u.name&&(this._registeredTools[u.name]=l)),typeof u.title<"u"&&(l.title=u.title),typeof u.description<"u"&&(l.description=u.description),typeof u.paramsSchema<"u"&&(l.inputSchema=H(u.paramsSchema)),typeof u.callback<"u"&&(l.callback=u.callback),typeof u.annotations<"u"&&(l.annotations=u.annotations),typeof u._meta<"u"&&(l._meta=u._meta),typeof u.enabled<"u"&&(l.enabled=u.enabled),this.sendToolListChanged()}};return this._registeredTools[e]=l,this.setToolRequestHandlers(),this.sendToolListChanged(),l}tool(e,...a){if(this._registeredTools[e])throw new Error(`Tool ${e} is already registered`);let s,r,n,i;if(typeof a[0]=="string"&&(s=a.shift()),a.length>1){const c=a[0];Ld(c)?(r=a.shift(),a.length>1&&typeof a[0]=="object"&&a[0]!==null&&!Ld(a[0])&&(i=a.shift())):typeof c=="object"&&c!==null&&(i=a.shift())}const o=a[0];return this._createRegisteredTool(e,void 0,s,r,n,i,void 0,o)}registerTool(e,a,s){if(this._registeredTools[e])throw new Error(`Tool ${e} is already registered`);const{title:r,description:n,inputSchema:i,outputSchema:o,annotations:c,_meta:l}=a;return this._createRegisteredTool(e,r,n,i,o,c,l,s)}prompt(e,...a){if(this._registeredPrompts[e])throw new Error(`Prompt ${e} is already registered`);let s;typeof a[0]=="string"&&(s=a.shift());let r;a.length>1&&(r=a.shift());const n=a[0],i=this._createRegisteredPrompt(e,void 0,s,r,n);return this.setPromptRequestHandlers(),this.sendPromptListChanged(),i}registerPrompt(e,a,s){if(this._registeredPrompts[e])throw new Error(`Prompt ${e} is already registered`);const{title:r,description:n,argsSchema:i}=a,o=this._createRegisteredPrompt(e,r,n,i,s);return this.setPromptRequestHandlers(),this.sendPromptListChanged(),o}isConnected(){return this.server.transport!==void 0}async sendLoggingMessage(e,a){return this.server.sendLoggingMessage(e,a)}sendResourceListChanged(){this.isConnected()&&this.server.sendResourceListChanged()}sendToolListChanged(){this.isConnected()&&this.server.sendToolListChanged()}sendPromptListChanged(){this.isConnected()&&this.server.sendPromptListChanged()}}class $0{constructor(e,a){this._callbacks=a,this._uriTemplate=typeof e=="string"?new Wt(e):e}get uriTemplate(){return this._uriTemplate}get listCallback(){return this._callbacks.list}completeCallback(e){var a;return(a=this._callbacks.complete)===null||a===void 0?void 0:a[e]}}const w0={type:"object",properties:{}};function Ld(t){return typeof t!="object"||t===null?!1:Object.keys(t).length===0||Object.values(t).some(b0)}function b0(t){return t!==null&&typeof t=="object"&&"parse"in t&&typeof t.parse=="function"&&"safeParse"in t&&typeof t.safeParse=="function"}function E0(t){return Object.entries(t.shape).map(([e,a])=>({name:e,description:a.description,required:!a.isOptional()}))}function Fd(t){return{completion:{values:t.slice(0,100),total:t.length,hasMore:t.length>100}}}const on={completion:{values:[],hasMore:!1}};R.Ajv=ov,R.AudioContentSchema=Ns,R.BaseMetadataSchema=Br,R.BlobResourceContentsSchema=qi,R.BooleanSchemaSchema=iu,R.CallToolRequestSchema=Ds,R.CallToolResultSchema=js,R.CancelledNotificationSchema=$s,R.Client=o_,R.ClientCapabilitiesSchema=Mc,R.ClientNotificationSchema=Vv,R.ClientRequestSchema=Uv,R.ClientResultSchema=zv,R.CompatibilityCallToolResultSchema=Fv,R.Completable=Ca,R.CompleteRequestSchema=xs,R.CompleteResultSchema=Xi,R.ContentBlockSchema=Ki,R.CreateMessageRequestSchema=nu,R.CreateMessageResultSchema=Gi,R.CursorSchema=Ti,R.DEFAULT_NEGOTIATED_PROTOCOL_VERSION=xv,R.DEFAULT_REQUEST_TIMEOUT_MSEC=yu,R.ElicitRequestSchema=du,R.ElicitResultSchema=Wi,R.EmbeddedResourceSchema=Jc,R.EmptyResultSchema=lr,R.EnumSchemaSchema=cu,R.GetPromptRequestSchema=Ts,R.GetPromptResultSchema=Bi,R.IconSchema=xc,R.IconsSchema=Kr,R.ImageContentSchema=Is,R.ImplementationSchema=Di,R.InitializeRequestSchema=ws,R.InitializeResultSchema=xi,R.InitializedNotificationSchema=bs,R.JSONRPCErrorSchema=ji,R.JSONRPCMessageSchema=Ra,R.JSONRPCNotificationSchema=Ni,R.JSONRPCRequestSchema=Ci,R.JSONRPCResponseSchema=Ai,R.JSONRPC_VERSION=Ea,R.LATEST_PROTOCOL_VERSION=Sr,R.ListPromptsRequestSchema=Os,R.ListPromptsResultSchema=Zi,R.ListResourceTemplatesRequestSchema=Rs,R.ListResourceTemplatesResultSchema=zi,R.ListResourcesRequestSchema=Ss,R.ListResourcesResultSchema=Vi,R.ListRootsRequestSchema=pu,R.ListRootsResultSchema=eo,R.ListToolsRequestSchema=As,R.ListToolsResultSchema=Ji,R.LoggingLevelSchema=Ta,R.LoggingMessageNotificationSchema=tu,R.McpError=Ce,R.McpServer=_0,R.ModelHintSchema=ru,R.ModelPreferencesSchema=au,R.NotificationSchema=Rt,R.NumberSchemaSchema=lu,R.PaginatedRequestSchema=ka,R.PaginatedResultSchema=Oa,R.PingRequestSchema=Es,R.PrimitiveSchemaDefinitionSchema=uu,R.ProgressNotificationSchema=Ps,R.ProgressSchema=qc,R.ProgressTokenSchema=Oi,R.PromptArgumentSchema=Kc,R.PromptListChangedNotificationSchema=Wc,R.PromptMessageSchema=Gc,R.PromptReferenceSchema=fu,R.PromptSchema=Bc,R.Protocol=ro,R.ReadResourceRequestSchema=ks,R.ReadResourceResultSchema=Hi,R.RequestIdSchema=Sa,R.RequestSchema=lt,R.ResourceContentsSchema=Mi,R.ResourceLinkSchema=Qc,R.ResourceListChangedNotificationSchema=Vc,R.ResourceReferenceSchema=qv,R.ResourceSchema=Ui,R.ResourceTemplate=$0,R.ResourceTemplateReferenceSchema=Yi,R.ResourceTemplateSchema=Uc,R.ResourceUpdatedNotificationSchema=Zc,R.ResultSchema=pt,R.RootSchema=hu,R.RootsListChangedNotificationSchema=mu,R.SSEClientTransport=I_,R.SUPPORTED_PROTOCOL_VERSIONS=ki,R.SamplingMessageSchema=su,R.ServerCapabilitiesSchema=Lc,R.ServerNotificationSchema=Zv,R.ServerRequestSchema=Hv,R.ServerResultSchema=Kv,R.SetLevelRequestSchema=Qi,R.SseError=kd,R.StreamableHTTPClientTransport=j_,R.StreamableHTTPError=xa,R.StringSchemaSchema=ou,R.SubscribeRequestSchema=zc,R.TextContentSchema=Cs,R.TextResourceContentsSchema=Li,R.ToolAnnotationsSchema=Yc,R.ToolListChangedNotificationSchema=eu,R.ToolSchema=Xc,R.UnauthorizedError=kt,R.UnsubscribeRequestSchema=Hc,R.UriTemplate=Wt,R.auth=kr,R.buildDiscoveryUrls=md,R.completable=Jv,R.discoverAuthorizationServerMetadata=vd,R.discoverOAuthMetadata=k_,R.discoverOAuthProtectedResourceMetadata=fd,R.exchangeAuthorization=yd,R.extractResourceMetadataUrl=tn,R.getDisplayName=Gv,R.isInitializeRequest=Lv,R.isInitializedNotification=Fc,R.isJSONRPCError=Dc,R.isJSONRPCNotification=jc,R.isJSONRPCRequest=Ii,R.isJSONRPCResponse=_s,R.mergeCapabilities=ao,R.parseErrorResponse=en,R.refreshAuthorization=_d,R.registerClient=$d,R.selectResourceURL=dd,R.startAuthorization=gd,Object.defineProperty(R,Symbol.toStringTag,{value:"Module"})});
|