context-doctor 0.46.0 → 0.48.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (68) hide show
  1. package/README.md +9 -4
  2. package/dist/ab.d.ts +51 -3
  3. package/dist/ab.js +71 -28
  4. package/dist/abclaude.d.ts +167 -0
  5. package/dist/abclaude.js +511 -0
  6. package/dist/abstore.d.ts +46 -0
  7. package/dist/abstore.js +58 -0
  8. package/dist/autopilot.js +9 -5
  9. package/dist/blob.js +66 -12
  10. package/dist/budget.d.ts +8 -2
  11. package/dist/budget.js +30 -7
  12. package/dist/ci.js +2 -1
  13. package/dist/claudeplugin.d.ts +97 -0
  14. package/dist/claudeplugin.js +142 -0
  15. package/dist/cli.js +128 -36
  16. package/dist/compactcost.d.ts +74 -0
  17. package/dist/compactcost.js +115 -0
  18. package/dist/cursor.js +2 -0
  19. package/dist/doctor.js +90 -18
  20. package/dist/extract.js +4 -3
  21. package/dist/fanout.d.ts +15 -0
  22. package/dist/fanout.js +30 -9
  23. package/dist/firstfix.d.ts +43 -0
  24. package/dist/firstfix.js +80 -0
  25. package/dist/fix.d.ts +53 -4
  26. package/dist/fix.js +101 -13
  27. package/dist/httpguard.d.ts +13 -0
  28. package/dist/httpguard.js +22 -0
  29. package/dist/install.d.ts +21 -9
  30. package/dist/install.js +213 -40
  31. package/dist/limits.d.ts +5 -0
  32. package/dist/limits.js +26 -2
  33. package/dist/mcp.d.ts +4 -0
  34. package/dist/mcp.js +142 -97
  35. package/dist/mcpclient.js +73 -42
  36. package/dist/missledger.js +5 -3
  37. package/dist/mod/api.d.ts +8 -2
  38. package/dist/mod/api.js +2 -2
  39. package/dist/mod/logic.d.ts +13 -1
  40. package/dist/mod/logic.js +24 -2
  41. package/dist/mod/register.d.ts +2 -0
  42. package/dist/mod/register.js +19 -5
  43. package/dist/modelids.d.ts +62 -3
  44. package/dist/modelids.js +156 -8
  45. package/dist/modelswitch.js +8 -4
  46. package/dist/modmeasure.js +13 -1
  47. package/dist/orgrates.d.ts +18 -0
  48. package/dist/orgrates.js +51 -2
  49. package/dist/pack.d.ts +13 -0
  50. package/dist/pack.js +38 -2
  51. package/dist/preferences.js +2 -1
  52. package/dist/pricing.d.ts +8 -0
  53. package/dist/pricing.js +30 -2
  54. package/dist/progresssummaries.d.ts +148 -0
  55. package/dist/progresssummaries.js +248 -0
  56. package/dist/proxy.d.ts +1 -1
  57. package/dist/proxy.js +1 -1
  58. package/dist/prune.d.ts +8 -0
  59. package/dist/prune.js +11 -1
  60. package/dist/spend.d.ts +34 -0
  61. package/dist/spend.js +48 -4
  62. package/dist/subagentmodel.d.ts +12 -0
  63. package/dist/subagentmodel.js +17 -4
  64. package/dist/subagentpay.d.ts +8 -0
  65. package/dist/subagentpay.js +8 -1
  66. package/dist/toolcwd.d.ts +14 -0
  67. package/dist/toolcwd.js +17 -0
  68. package/package.json +6 -3
package/dist/mcpclient.js CHANGED
@@ -1,45 +1,76 @@
1
1
  import { createRequire as __cdRequire } from 'module'; const require = __cdRequire(import.meta.url);
2
- var f_=Object.create;var ls=Object.defineProperty;var m_=Object.getOwnPropertyDescriptor;var h_=Object.getOwnPropertyNames;var g_=Object.getPrototypeOf,__=Object.prototype.hasOwnProperty;var lt=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,r)=>(typeof require<"u"?require:t)[r]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')});var b=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),ds=(e,t)=>{for(var r in t)ls(e,r,{get:t[r],enumerable:!0})},y_=(e,t,r,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of h_(t))!__.call(e,n)&&n!==r&&ls(e,n,{get:()=>t[n],enumerable:!(o=m_(t,n))||o.enumerable});return e};var Zo=(e,t,r)=>(r=e!=null?f_(g_(e)):{},y_(t||!e||!e.__esModule?ls(r,"default",{value:e,enumerable:!0}):r,e));var Kr=b(V=>{"use strict";Object.defineProperty(V,"__esModule",{value:!0});V.regexpCode=V.getEsmExportName=V.getProperty=V.safeStringify=V.stringify=V.strConcat=V.addCodeArg=V.str=V._=V.nil=V._Code=V.Name=V.IDENTIFIER=V._CodeOrName=void 0;var Hr=class{};V._CodeOrName=Hr;V.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;var Tt=class extends Hr{constructor(t){if(super(),!V.IDENTIFIER.test(t))throw new Error("CodeGen: name must be a valid identifier");this.str=t}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}};V.Name=Tt;var Ne=class extends Hr{constructor(t){super(),this._items=typeof t=="string"?[t]:t}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let t=this._items[0];return t===""||t==='""'}get str(){var t;return(t=this._str)!==null&&t!==void 0?t:this._str=this._items.reduce((r,o)=>`${r}${o}`,"")}get names(){var t;return(t=this._names)!==null&&t!==void 0?t:this._names=this._items.reduce((r,o)=>(o instanceof Tt&&(r[o.str]=(r[o.str]||0)+1),r),{})}};V._Code=Ne;V.nil=new Ne("");function Lp(e,...t){let r=[e[0]],o=0;for(;o<t.length;)Ai(r,t[o]),r.push(e[++o]);return new Ne(r)}V._=Lp;var Ci=new Ne("+");function Fp(e,...t){let r=[Br(e[0])],o=0;for(;o<t.length;)r.push(Ci),Ai(r,t[o]),r.push(Ci,Br(e[++o]));return z0(r),new Ne(r)}V.str=Fp;function Ai(e,t){t instanceof Ne?e.push(...t._items):t instanceof Tt?e.push(t):e.push(P0(t))}V.addCodeArg=Ai;function z0(e){let t=1;for(;t<e.length-1;){if(e[t]===Ci){let r=S0(e[t-1],e[t+1]);if(r!==void 0){e.splice(t-1,3,r);continue}e[t++]="+"}t++}}function S0(e,t){if(t==='""')return e;if(e==='""')return t;if(typeof e=="string")return t instanceof Tt||e[e.length-1]!=='"'?void 0:typeof t!="string"?`${e.slice(0,-1)}${t}"`:t[0]==='"'?e.slice(0,-1)+t.slice(1):void 0;if(typeof t=="string"&&t[0]==='"'&&!(e instanceof Tt))return`"${e}${t.slice(1)}`}function k0(e,t){return t.emptyStr()?e:e.emptyStr()?t:Fp`${e}${t}`}V.strConcat=k0;function P0(e){return typeof e=="number"||typeof e=="boolean"||e===null?e:Br(Array.isArray(e)?e.join(","):e)}function E0(e){return new Ne(Br(e))}V.stringify=E0;function Br(e){return JSON.stringify(e).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}V.safeStringify=Br;function T0(e){return typeof e=="string"&&V.IDENTIFIER.test(e)?new Ne(`.${e}`):Lp`[${e}]`}V.getProperty=T0;function R0(e){if(typeof e=="string"&&V.IDENTIFIER.test(e))return new Ne(`${e}`);throw new Error(`CodeGen: invalid export name: ${e}, use explicit $id name mapping`)}V.getEsmExportName=R0;function I0(e){return new Ne(e.toString())}V.regexpCode=I0});var Zi=b(Pe=>{"use strict";Object.defineProperty(Pe,"__esModule",{value:!0});Pe.ValueScope=Pe.ValueScopeName=Pe.Scope=Pe.varKinds=Pe.UsedValueState=void 0;var ke=Kr(),Ni=class extends Error{constructor(t){super(`CodeGen: "code" for ${t} not defined`),this.value=t.value}},_n;(function(e){e[e.Started=0]="Started",e[e.Completed=1]="Completed"})(_n||(Pe.UsedValueState=_n={}));Pe.varKinds={const:new ke.Name("const"),let:new ke.Name("let"),var:new ke.Name("var")};var yn=class{constructor({prefixes:t,parent:r}={}){this._names={},this._prefixes=t,this._parent=r}toName(t){return t instanceof ke.Name?t:this.name(t)}name(t){return new ke.Name(this._newName(t))}_newName(t){let r=this._names[t]||this._nameGroup(t);return`${t}${r.index++}`}_nameGroup(t){var r,o;if(!((o=(r=this._parent)===null||r===void 0?void 0:r._prefixes)===null||o===void 0)&&o.has(t)||this._prefixes&&!this._prefixes.has(t))throw new Error(`CodeGen: prefix "${t}" is not allowed in this scope`);return this._names[t]={prefix:t,index:0}}};Pe.Scope=yn;var vn=class extends ke.Name{constructor(t,r){super(r),this.prefix=t}setValue(t,{property:r,itemIndex:o}){this.value=t,this.scopePath=(0,ke._)`.${new ke.Name(r)}[${o}]`}};Pe.ValueScopeName=vn;var O0=(0,ke._)`\n`,ji=class extends yn{constructor(t){super(t),this._values={},this._scope=t.scope,this.opts={...t,_n:t.lines?O0:ke.nil}}get(){return this._scope}name(t){return new vn(t,this._newName(t))}value(t,r){var o;if(r.ref===void 0)throw new Error("CodeGen: ref must be passed in value");let n=this.toName(t),{prefix:s}=n,i=(o=r.key)!==null&&o!==void 0?o:r.ref,a=this._values[s];if(a){let u=a.get(i);if(u)return u}else a=this._values[s]=new Map;a.set(i,n);let c=this._scope[s]||(this._scope[s]=[]),l=c.length;return c[l]=r.ref,n.setValue(r,{property:s,itemIndex:l}),n}getValue(t,r){let o=this._values[t];if(o)return o.get(r)}scopeRefs(t,r=this._values){return this._reduceValues(r,o=>{if(o.scopePath===void 0)throw new Error(`CodeGen: name "${o}" has no value`);return(0,ke._)`${t}${o.scopePath}`})}scopeCode(t=this._values,r,o){return this._reduceValues(t,n=>{if(n.value===void 0)throw new Error(`CodeGen: name "${n}" has no value`);return n.value.code},r,o)}_reduceValues(t,r,o={},n){let s=ke.nil;for(let i in t){let a=t[i];if(!a)continue;let c=o[i]=o[i]||new Map;a.forEach(l=>{if(c.has(l))return;c.set(l,_n.Started);let u=r(l);if(u){let d=this.opts.es5?Pe.varKinds.var:Pe.varKinds.const;s=(0,ke._)`${s}${d} ${l} = ${u};${this.opts._n}`}else if(u=n?.(l))s=(0,ke._)`${s}${u}${this.opts._n}`;else throw new Ni(l);c.set(l,_n.Completed)})}return s}};Pe.ValueScope=ji});var j=b(Z=>{"use strict";Object.defineProperty(Z,"__esModule",{value:!0});Z.or=Z.and=Z.not=Z.CodeGen=Z.operators=Z.varKinds=Z.ValueScopeName=Z.ValueScope=Z.Scope=Z.Name=Z.regexpCode=Z.stringify=Z.getProperty=Z.nil=Z.strConcat=Z.str=Z._=void 0;var D=Kr(),Fe=Zi(),mt=Kr();Object.defineProperty(Z,"_",{enumerable:!0,get:function(){return mt._}});Object.defineProperty(Z,"str",{enumerable:!0,get:function(){return mt.str}});Object.defineProperty(Z,"strConcat",{enumerable:!0,get:function(){return mt.strConcat}});Object.defineProperty(Z,"nil",{enumerable:!0,get:function(){return mt.nil}});Object.defineProperty(Z,"getProperty",{enumerable:!0,get:function(){return mt.getProperty}});Object.defineProperty(Z,"stringify",{enumerable:!0,get:function(){return mt.stringify}});Object.defineProperty(Z,"regexpCode",{enumerable:!0,get:function(){return mt.regexpCode}});Object.defineProperty(Z,"Name",{enumerable:!0,get:function(){return mt.Name}});var bn=Zi();Object.defineProperty(Z,"Scope",{enumerable:!0,get:function(){return bn.Scope}});Object.defineProperty(Z,"ValueScope",{enumerable:!0,get:function(){return bn.ValueScope}});Object.defineProperty(Z,"ValueScopeName",{enumerable:!0,get:function(){return bn.ValueScopeName}});Object.defineProperty(Z,"varKinds",{enumerable:!0,get:function(){return bn.varKinds}});Z.operators={GT:new D._Code(">"),GTE:new D._Code(">="),LT:new D._Code("<"),LTE:new D._Code("<="),EQ:new D._Code("==="),NEQ:new D._Code("!=="),NOT:new D._Code("!"),OR:new D._Code("||"),AND:new D._Code("&&"),ADD:new D._Code("+")};var ot=class{optimizeNodes(){return this}optimizeNames(t,r){return this}},qi=class extends ot{constructor(t,r,o){super(),this.varKind=t,this.name=r,this.rhs=o}render({es5:t,_n:r}){let o=t?Fe.varKinds.var:this.varKind,n=this.rhs===void 0?"":` = ${this.rhs}`;return`${o} ${this.name}${n};`+r}optimizeNames(t,r){if(t[this.name.str])return this.rhs&&(this.rhs=ar(this.rhs,t,r)),this}get names(){return this.rhs instanceof D._CodeOrName?this.rhs.names:{}}},wn=class extends ot{constructor(t,r,o){super(),this.lhs=t,this.rhs=r,this.sideEffects=o}render({_n:t}){return`${this.lhs} = ${this.rhs};`+t}optimizeNames(t,r){if(!(this.lhs instanceof D.Name&&!t[this.lhs.str]&&!this.sideEffects))return this.rhs=ar(this.rhs,t,r),this}get names(){let t=this.lhs instanceof D.Name?{}:{...this.lhs.names};return xn(t,this.rhs)}},Mi=class extends wn{constructor(t,r,o,n){super(t,o,n),this.op=r}render({_n:t}){return`${this.lhs} ${this.op}= ${this.rhs};`+t}},Di=class extends ot{constructor(t){super(),this.label=t,this.names={}}render({_n:t}){return`${this.label}:`+t}},Ui=class extends ot{constructor(t){super(),this.label=t,this.names={}}render({_n:t}){return`break${this.label?` ${this.label}`:""};`+t}},Li=class extends ot{constructor(t){super(),this.error=t}render({_n:t}){return`throw ${this.error};`+t}get names(){return this.error.names}},Fi=class extends ot{constructor(t){super(),this.code=t}render({_n:t}){return`${this.code};`+t}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(t,r){return this.code=ar(this.code,t,r),this}get names(){return this.code instanceof D._CodeOrName?this.code.names:{}}},Wr=class extends ot{constructor(t=[]){super(),this.nodes=t}render(t){return this.nodes.reduce((r,o)=>r+o.render(t),"")}optimizeNodes(){let{nodes:t}=this,r=t.length;for(;r--;){let o=t[r].optimizeNodes();Array.isArray(o)?t.splice(r,1,...o):o?t[r]=o:t.splice(r,1)}return t.length>0?this:void 0}optimizeNames(t,r){let{nodes:o}=this,n=o.length;for(;n--;){let s=o[n];s.optimizeNames(t,r)||(C0(t,s.names),o.splice(n,1))}return o.length>0?this:void 0}get names(){return this.nodes.reduce((t,r)=>Ot(t,r.names),{})}},nt=class extends Wr{render(t){return"{"+t._n+super.render(t)+"}"+t._n}},Vi=class extends Wr{},ir=class extends nt{};ir.kind="else";var Rt=class e extends nt{constructor(t,r){super(r),this.condition=t}render(t){let r=`if(${this.condition})`+super.render(t);return this.else&&(r+="else "+this.else.render(t)),r}optimizeNodes(){super.optimizeNodes();let t=this.condition;if(t===!0)return this.nodes;let r=this.else;if(r){let o=r.optimizeNodes();r=this.else=Array.isArray(o)?new ir(o):o}if(r)return t===!1?r instanceof e?r:r.nodes:this.nodes.length?this:new e(Vp(t),r instanceof e?[r]:r.nodes);if(!(t===!1||!this.nodes.length))return this}optimizeNames(t,r){var o;if(this.else=(o=this.else)===null||o===void 0?void 0:o.optimizeNames(t,r),!!(super.optimizeNames(t,r)||this.else))return this.condition=ar(this.condition,t,r),this}get names(){let t=super.names;return xn(t,this.condition),this.else&&Ot(t,this.else.names),t}};Rt.kind="if";var It=class extends nt{};It.kind="for";var Hi=class extends It{constructor(t){super(),this.iteration=t}render(t){return`for(${this.iteration})`+super.render(t)}optimizeNames(t,r){if(super.optimizeNames(t,r))return this.iteration=ar(this.iteration,t,r),this}get names(){return Ot(super.names,this.iteration.names)}},Bi=class extends It{constructor(t,r,o,n){super(),this.varKind=t,this.name=r,this.from=o,this.to=n}render(t){let r=t.es5?Fe.varKinds.var:this.varKind,{name:o,from:n,to:s}=this;return`for(${r} ${o}=${n}; ${o}<${s}; ${o}++)`+super.render(t)}get names(){let t=xn(super.names,this.from);return xn(t,this.to)}},$n=class extends It{constructor(t,r,o,n){super(),this.loop=t,this.varKind=r,this.name=o,this.iterable=n}render(t){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(t)}optimizeNames(t,r){if(super.optimizeNames(t,r))return this.iterable=ar(this.iterable,t,r),this}get names(){return Ot(super.names,this.iterable.names)}},Gr=class extends nt{constructor(t,r,o){super(),this.name=t,this.args=r,this.async=o}render(t){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(t)}};Gr.kind="func";var Jr=class extends Wr{render(t){return"return "+super.render(t)}};Jr.kind="return";var Ki=class extends nt{render(t){let r="try"+super.render(t);return this.catch&&(r+=this.catch.render(t)),this.finally&&(r+=this.finally.render(t)),r}optimizeNodes(){var t,r;return super.optimizeNodes(),(t=this.catch)===null||t===void 0||t.optimizeNodes(),(r=this.finally)===null||r===void 0||r.optimizeNodes(),this}optimizeNames(t,r){var o,n;return super.optimizeNames(t,r),(o=this.catch)===null||o===void 0||o.optimizeNames(t,r),(n=this.finally)===null||n===void 0||n.optimizeNames(t,r),this}get names(){let t=super.names;return this.catch&&Ot(t,this.catch.names),this.finally&&Ot(t,this.finally.names),t}},Qr=class extends nt{constructor(t){super(),this.error=t}render(t){return`catch(${this.error})`+super.render(t)}};Qr.kind="catch";var Yr=class extends nt{render(t){return"finally"+super.render(t)}};Yr.kind="finally";var Wi=class{constructor(t,r={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...r,_n:r.lines?`
3
- `:""},this._extScope=t,this._scope=new Fe.Scope({parent:t}),this._nodes=[new Vi]}toString(){return this._root.render(this.opts)}name(t){return this._scope.name(t)}scopeName(t){return this._extScope.name(t)}scopeValue(t,r){let o=this._extScope.value(t,r);return(this._values[o.prefix]||(this._values[o.prefix]=new Set)).add(o),o}getScopeValue(t,r){return this._extScope.getValue(t,r)}scopeRefs(t){return this._extScope.scopeRefs(t,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(t,r,o,n){let s=this._scope.toName(r);return o!==void 0&&n&&(this._constants[s.str]=o),this._leafNode(new qi(t,s,o)),s}const(t,r,o){return this._def(Fe.varKinds.const,t,r,o)}let(t,r,o){return this._def(Fe.varKinds.let,t,r,o)}var(t,r,o){return this._def(Fe.varKinds.var,t,r,o)}assign(t,r,o){return this._leafNode(new wn(t,r,o))}add(t,r){return this._leafNode(new Mi(t,Z.operators.ADD,r))}code(t){return typeof t=="function"?t():t!==D.nil&&this._leafNode(new Fi(t)),this}object(...t){let r=["{"];for(let[o,n]of t)r.length>1&&r.push(","),r.push(o),(o!==n||this.opts.es5)&&(r.push(":"),(0,D.addCodeArg)(r,n));return r.push("}"),new D._Code(r)}if(t,r,o){if(this._blockNode(new Rt(t)),r&&o)this.code(r).else().code(o).endIf();else if(r)this.code(r).endIf();else if(o)throw new Error('CodeGen: "else" body without "then" body');return this}elseIf(t){return this._elseNode(new Rt(t))}else(){return this._elseNode(new ir)}endIf(){return this._endBlockNode(Rt,ir)}_for(t,r){return this._blockNode(t),r&&this.code(r).endFor(),this}for(t,r){return this._for(new Hi(t),r)}forRange(t,r,o,n,s=this.opts.es5?Fe.varKinds.var:Fe.varKinds.let){let i=this._scope.toName(t);return this._for(new Bi(s,i,r,o),()=>n(i))}forOf(t,r,o,n=Fe.varKinds.const){let s=this._scope.toName(t);if(this.opts.es5){let i=r instanceof D.Name?r:this.var("_arr",r);return this.forRange("_i",0,(0,D._)`${i}.length`,a=>{this.var(s,(0,D._)`${i}[${a}]`),o(s)})}return this._for(new $n("of",n,s,r),()=>o(s))}forIn(t,r,o,n=this.opts.es5?Fe.varKinds.var:Fe.varKinds.const){if(this.opts.ownProperties)return this.forOf(t,(0,D._)`Object.keys(${r})`,o);let s=this._scope.toName(t);return this._for(new $n("in",n,s,r),()=>o(s))}endFor(){return this._endBlockNode(It)}label(t){return this._leafNode(new Di(t))}break(t){return this._leafNode(new Ui(t))}return(t){let r=new Jr;if(this._blockNode(r),this.code(t),r.nodes.length!==1)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(Jr)}try(t,r,o){if(!r&&!o)throw new Error('CodeGen: "try" without "catch" and "finally"');let n=new Ki;if(this._blockNode(n),this.code(t),r){let s=this.name("e");this._currNode=n.catch=new Qr(s),r(s)}return o&&(this._currNode=n.finally=new Yr,this.code(o)),this._endBlockNode(Qr,Yr)}throw(t){return this._leafNode(new Li(t))}block(t,r){return this._blockStarts.push(this._nodes.length),t&&this.code(t).endBlock(r),this}endBlock(t){let r=this._blockStarts.pop();if(r===void 0)throw new Error("CodeGen: not in self-balancing block");let o=this._nodes.length-r;if(o<0||t!==void 0&&o!==t)throw new Error(`CodeGen: wrong number of nodes: ${o} vs ${t} expected`);return this._nodes.length=r,this}func(t,r=D.nil,o,n){return this._blockNode(new Gr(t,r,o)),n&&this.code(n).endFunc(),this}endFunc(){return this._endBlockNode(Gr)}optimize(t=1){for(;t-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(t){return this._currNode.nodes.push(t),this}_blockNode(t){this._currNode.nodes.push(t),this._nodes.push(t)}_endBlockNode(t,r){let o=this._currNode;if(o instanceof t||r&&o instanceof r)return this._nodes.pop(),this;throw new Error(`CodeGen: not in block "${r?`${t.kind}/${r.kind}`:t.kind}"`)}_elseNode(t){let r=this._currNode;if(!(r instanceof Rt))throw new Error('CodeGen: "else" without "if"');return this._currNode=r.else=t,this}get _root(){return this._nodes[0]}get _currNode(){let t=this._nodes;return t[t.length-1]}set _currNode(t){let r=this._nodes;r[r.length-1]=t}};Z.CodeGen=Wi;function Ot(e,t){for(let r in t)e[r]=(e[r]||0)+(t[r]||0);return e}function xn(e,t){return t instanceof D._CodeOrName?Ot(e,t.names):e}function ar(e,t,r){if(e instanceof D.Name)return o(e);if(!n(e))return e;return new D._Code(e._items.reduce((s,i)=>(i instanceof D.Name&&(i=o(i)),i instanceof D._Code?s.push(...i._items):s.push(i),s),[]));function o(s){let i=r[s.str];return i===void 0||t[s.str]!==1?s:(delete t[s.str],i)}function n(s){return s instanceof D._Code&&s._items.some(i=>i instanceof D.Name&&t[i.str]===1&&r[i.str]!==void 0)}}function C0(e,t){for(let r in t)e[r]=(e[r]||0)-(t[r]||0)}function Vp(e){return typeof e=="boolean"||typeof e=="number"||e===null?!e:(0,D._)`!${Gi(e)}`}Z.not=Vp;var A0=Hp(Z.operators.AND);function N0(...e){return e.reduce(A0)}Z.and=N0;var j0=Hp(Z.operators.OR);function Z0(...e){return e.reduce(j0)}Z.or=Z0;function Hp(e){return(t,r)=>t===D.nil?r:r===D.nil?t:(0,D._)`${Gi(t)} ${e} ${Gi(r)}`}function Gi(e){return e instanceof D.Name?e:(0,D._)`(${e})`}});var U=b(q=>{"use strict";Object.defineProperty(q,"__esModule",{value:!0});q.checkStrictMode=q.getErrorPath=q.Type=q.useFunc=q.setEvaluated=q.evaluatedPropsToName=q.mergeEvaluated=q.eachItem=q.unescapeJsonPointer=q.escapeJsonPointer=q.escapeFragment=q.unescapeFragment=q.schemaRefOrVal=q.schemaHasRulesButRef=q.schemaHasRules=q.checkUnknownRules=q.alwaysValidSchema=q.toHash=void 0;var G=j(),q0=Kr();function M0(e){let t={};for(let r of e)t[r]=!0;return t}q.toHash=M0;function D0(e,t){return typeof t=="boolean"?t:Object.keys(t).length===0?!0:(Wp(e,t),!Gp(t,e.self.RULES.all))}q.alwaysValidSchema=D0;function Wp(e,t=e.schema){let{opts:r,self:o}=e;if(!r.strictSchema||typeof t=="boolean")return;let n=o.RULES.keywords;for(let s in t)n[s]||Yp(e,`unknown keyword: "${s}"`)}q.checkUnknownRules=Wp;function Gp(e,t){if(typeof e=="boolean")return!e;for(let r in e)if(t[r])return!0;return!1}q.schemaHasRules=Gp;function U0(e,t){if(typeof e=="boolean")return!e;for(let r in e)if(r!=="$ref"&&t.all[r])return!0;return!1}q.schemaHasRulesButRef=U0;function L0({topSchemaRef:e,schemaPath:t},r,o,n){if(!n){if(typeof r=="number"||typeof r=="boolean")return r;if(typeof r=="string")return(0,G._)`${r}`}return(0,G._)`${e}${t}${(0,G.getProperty)(o)}`}q.schemaRefOrVal=L0;function F0(e){return Jp(decodeURIComponent(e))}q.unescapeFragment=F0;function V0(e){return encodeURIComponent(Qi(e))}q.escapeFragment=V0;function Qi(e){return typeof e=="number"?`${e}`:e.replace(/~/g,"~0").replace(/\//g,"~1")}q.escapeJsonPointer=Qi;function Jp(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}q.unescapeJsonPointer=Jp;function H0(e,t){if(Array.isArray(e))for(let r of e)t(r);else t(e)}q.eachItem=H0;function Bp({mergeNames:e,mergeToName:t,mergeValues:r,resultToName:o}){return(n,s,i,a)=>{let c=i===void 0?s:i instanceof G.Name?(s instanceof G.Name?e(n,s,i):t(n,s,i),i):s instanceof G.Name?(t(n,i,s),s):r(s,i);return a===G.Name&&!(c instanceof G.Name)?o(n,c):c}}q.mergeEvaluated={props:Bp({mergeNames:(e,t,r)=>e.if((0,G._)`${r} !== true && ${t} !== undefined`,()=>{e.if((0,G._)`${t} === true`,()=>e.assign(r,!0),()=>e.assign(r,(0,G._)`${r} || {}`).code((0,G._)`Object.assign(${r}, ${t})`))}),mergeToName:(e,t,r)=>e.if((0,G._)`${r} !== true`,()=>{t===!0?e.assign(r,!0):(e.assign(r,(0,G._)`${r} || {}`),Yi(e,r,t))}),mergeValues:(e,t)=>e===!0?!0:{...e,...t},resultToName:Qp}),items:Bp({mergeNames:(e,t,r)=>e.if((0,G._)`${r} !== true && ${t} !== undefined`,()=>e.assign(r,(0,G._)`${t} === true ? true : ${r} > ${t} ? ${r} : ${t}`)),mergeToName:(e,t,r)=>e.if((0,G._)`${r} !== true`,()=>e.assign(r,t===!0?!0:(0,G._)`${r} > ${t} ? ${r} : ${t}`)),mergeValues:(e,t)=>e===!0?!0:Math.max(e,t),resultToName:(e,t)=>e.var("items",t)})};function Qp(e,t){if(t===!0)return e.var("props",!0);let r=e.var("props",(0,G._)`{}`);return t!==void 0&&Yi(e,r,t),r}q.evaluatedPropsToName=Qp;function Yi(e,t,r){Object.keys(r).forEach(o=>e.assign((0,G._)`${t}${(0,G.getProperty)(o)}`,!0))}q.setEvaluated=Yi;var Kp={};function B0(e,t){return e.scopeValue("func",{ref:t,code:Kp[t.code]||(Kp[t.code]=new q0._Code(t.code))})}q.useFunc=B0;var Ji;(function(e){e[e.Num=0]="Num",e[e.Str=1]="Str"})(Ji||(q.Type=Ji={}));function K0(e,t,r){if(e instanceof G.Name){let o=t===Ji.Num;return r?o?(0,G._)`"[" + ${e} + "]"`:(0,G._)`"['" + ${e} + "']"`:o?(0,G._)`"/" + ${e}`:(0,G._)`"/" + ${e}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return r?(0,G.getProperty)(e).toString():"/"+Qi(e)}q.getErrorPath=K0;function Yp(e,t,r=e.opts.strictSchema){if(r){if(t=`strict mode: ${t}`,r===!0)throw new Error(t);e.self.logger.warn(t)}}q.checkStrictMode=Yp});var st=b(Xi=>{"use strict";Object.defineProperty(Xi,"__esModule",{value:!0});var ve=j(),W0={data:new ve.Name("data"),valCxt:new ve.Name("valCxt"),instancePath:new ve.Name("instancePath"),parentData:new ve.Name("parentData"),parentDataProperty:new ve.Name("parentDataProperty"),rootData:new ve.Name("rootData"),dynamicAnchors:new ve.Name("dynamicAnchors"),vErrors:new ve.Name("vErrors"),errors:new ve.Name("errors"),this:new ve.Name("this"),self:new ve.Name("self"),scope:new ve.Name("scope"),json:new ve.Name("json"),jsonPos:new ve.Name("jsonPos"),jsonLen:new ve.Name("jsonLen"),jsonPart:new ve.Name("jsonPart")};Xi.default=W0});var Xr=b(we=>{"use strict";Object.defineProperty(we,"__esModule",{value:!0});we.extendErrors=we.resetErrorsCount=we.reportExtraError=we.reportError=we.keyword$DataError=we.keywordError=void 0;var L=j(),zn=U(),be=st();we.keywordError={message:({keyword:e})=>(0,L.str)`must pass "${e}" keyword validation`};we.keyword$DataError={message:({keyword:e,schemaType:t})=>t?(0,L.str)`"${e}" keyword must be ${t} ($data)`:(0,L.str)`"${e}" keyword is invalid ($data)`};function G0(e,t=we.keywordError,r,o){let{it:n}=e,{gen:s,compositeRule:i,allErrors:a}=n,c=tf(e,t,r);o??(i||a)?Xp(s,c):ef(n,(0,L._)`[${c}]`)}we.reportError=G0;function J0(e,t=we.keywordError,r){let{it:o}=e,{gen:n,compositeRule:s,allErrors:i}=o,a=tf(e,t,r);Xp(n,a),s||i||ef(o,be.default.vErrors)}we.reportExtraError=J0;function Q0(e,t){e.assign(be.default.errors,t),e.if((0,L._)`${be.default.vErrors} !== null`,()=>e.if(t,()=>e.assign((0,L._)`${be.default.vErrors}.length`,t),()=>e.assign(be.default.vErrors,null)))}we.resetErrorsCount=Q0;function Y0({gen:e,keyword:t,schemaValue:r,data:o,errsCount:n,it:s}){if(n===void 0)throw new Error("ajv implementation error");let i=e.name("err");e.forRange("i",n,be.default.errors,a=>{e.const(i,(0,L._)`${be.default.vErrors}[${a}]`),e.if((0,L._)`${i}.instancePath === undefined`,()=>e.assign((0,L._)`${i}.instancePath`,(0,L.strConcat)(be.default.instancePath,s.errorPath))),e.assign((0,L._)`${i}.schemaPath`,(0,L.str)`${s.errSchemaPath}/${t}`),s.opts.verbose&&(e.assign((0,L._)`${i}.schema`,r),e.assign((0,L._)`${i}.data`,o))})}we.extendErrors=Y0;function Xp(e,t){let r=e.const("err",t);e.if((0,L._)`${be.default.vErrors} === null`,()=>e.assign(be.default.vErrors,(0,L._)`[${r}]`),(0,L._)`${be.default.vErrors}.push(${r})`),e.code((0,L._)`${be.default.errors}++`)}function ef(e,t){let{gen:r,validateName:o,schemaEnv:n}=e;n.$async?r.throw((0,L._)`new ${e.ValidationError}(${t})`):(r.assign((0,L._)`${o}.errors`,t),r.return(!1))}var Ct={keyword:new L.Name("keyword"),schemaPath:new L.Name("schemaPath"),params:new L.Name("params"),propertyName:new L.Name("propertyName"),message:new L.Name("message"),schema:new L.Name("schema"),parentSchema:new L.Name("parentSchema")};function tf(e,t,r){let{createErrors:o}=e.it;return o===!1?(0,L._)`{}`:X0(e,t,r)}function X0(e,t,r={}){let{gen:o,it:n}=e,s=[ew(n,r),tw(e,r)];return rw(e,t,s),o.object(...s)}function ew({errorPath:e},{instancePath:t}){let r=t?(0,L.str)`${e}${(0,zn.getErrorPath)(t,zn.Type.Str)}`:e;return[be.default.instancePath,(0,L.strConcat)(be.default.instancePath,r)]}function tw({keyword:e,it:{errSchemaPath:t}},{schemaPath:r,parentSchema:o}){let n=o?t:(0,L.str)`${t}/${e}`;return r&&(n=(0,L.str)`${n}${(0,zn.getErrorPath)(r,zn.Type.Str)}`),[Ct.schemaPath,n]}function rw(e,{params:t,message:r},o){let{keyword:n,data:s,schemaValue:i,it:a}=e,{opts:c,propertyName:l,topSchemaRef:u,schemaPath:d}=a;o.push([Ct.keyword,n],[Ct.params,typeof t=="function"?t(e):t||(0,L._)`{}`]),c.messages&&o.push([Ct.message,typeof r=="function"?r(e):r]),c.verbose&&o.push([Ct.schema,i],[Ct.parentSchema,(0,L._)`${u}${d}`],[be.default.data,s]),l&&o.push([Ct.propertyName,l])}});var of=b(cr=>{"use strict";Object.defineProperty(cr,"__esModule",{value:!0});cr.boolOrEmptySchema=cr.topBoolOrEmptySchema=void 0;var ow=Xr(),nw=j(),sw=st(),iw={message:"boolean schema is false"};function aw(e){let{gen:t,schema:r,validateName:o}=e;r===!1?rf(e,!1):typeof r=="object"&&r.$async===!0?t.return(sw.default.data):(t.assign((0,nw._)`${o}.errors`,null),t.return(!0))}cr.topBoolOrEmptySchema=aw;function cw(e,t){let{gen:r,schema:o}=e;o===!1?(r.var(t,!1),rf(e)):r.var(t,!0)}cr.boolOrEmptySchema=cw;function rf(e,t){let{gen:r,data:o}=e,n={gen:r,keyword:"false schema",data:o,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:e};(0,ow.reportError)(n,iw,void 0,t)}});var ea=b(ur=>{"use strict";Object.defineProperty(ur,"__esModule",{value:!0});ur.getRules=ur.isJSONType=void 0;var uw=["string","number","integer","boolean","null","object","array"],lw=new Set(uw);function dw(e){return typeof e=="string"&&lw.has(e)}ur.isJSONType=dw;function pw(){let e={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...e,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},e.number,e.string,e.array,e.object],post:{rules:[]},all:{},keywords:{}}}ur.getRules=pw});var ta=b(ht=>{"use strict";Object.defineProperty(ht,"__esModule",{value:!0});ht.shouldUseRule=ht.shouldUseGroup=ht.schemaHasRulesForType=void 0;function fw({schema:e,self:t},r){let o=t.RULES.types[r];return o&&o!==!0&&nf(e,o)}ht.schemaHasRulesForType=fw;function nf(e,t){return t.rules.some(r=>sf(e,r))}ht.shouldUseGroup=nf;function sf(e,t){var r;return e[t.keyword]!==void 0||((r=t.definition.implements)===null||r===void 0?void 0:r.some(o=>e[o]!==void 0))}ht.shouldUseRule=sf});var eo=b($e=>{"use strict";Object.defineProperty($e,"__esModule",{value:!0});$e.reportTypeError=$e.checkDataTypes=$e.checkDataType=$e.coerceAndCheckDataType=$e.getJSONTypes=$e.getSchemaTypes=$e.DataType=void 0;var mw=ea(),hw=ta(),gw=Xr(),N=j(),af=U(),lr;(function(e){e[e.Correct=0]="Correct",e[e.Wrong=1]="Wrong"})(lr||($e.DataType=lr={}));function _w(e){let t=cf(e.type);if(t.includes("null")){if(e.nullable===!1)throw new Error("type: null contradicts nullable: false")}else{if(!t.length&&e.nullable!==void 0)throw new Error('"nullable" cannot be used without "type"');e.nullable===!0&&t.push("null")}return t}$e.getSchemaTypes=_w;function cf(e){let t=Array.isArray(e)?e:e?[e]:[];if(t.every(mw.isJSONType))return t;throw new Error("type must be JSONType or JSONType[]: "+t.join(","))}$e.getJSONTypes=cf;function yw(e,t){let{gen:r,data:o,opts:n}=e,s=vw(t,n.coerceTypes),i=t.length>0&&!(s.length===0&&t.length===1&&(0,hw.schemaHasRulesForType)(e,t[0]));if(i){let a=oa(t,o,n.strictNumbers,lr.Wrong);r.if(a,()=>{s.length?ww(e,t,s):na(e)})}return i}$e.coerceAndCheckDataType=yw;var uf=new Set(["string","number","integer","boolean","null"]);function vw(e,t){return t?e.filter(r=>uf.has(r)||t==="array"&&r==="array"):[]}function ww(e,t,r){let{gen:o,data:n,opts:s}=e,i=o.let("dataType",(0,N._)`typeof ${n}`),a=o.let("coerced",(0,N._)`undefined`);s.coerceTypes==="array"&&o.if((0,N._)`${i} == 'object' && Array.isArray(${n}) && ${n}.length == 1`,()=>o.assign(n,(0,N._)`${n}[0]`).assign(i,(0,N._)`typeof ${n}`).if(oa(t,n,s.strictNumbers),()=>o.assign(a,n))),o.if((0,N._)`${a} !== undefined`);for(let l of r)(uf.has(l)||l==="array"&&s.coerceTypes==="array")&&c(l);o.else(),na(e),o.endIf(),o.if((0,N._)`${a} !== undefined`,()=>{o.assign(n,a),$w(e,a)});function c(l){switch(l){case"string":o.elseIf((0,N._)`${i} == "number" || ${i} == "boolean"`).assign(a,(0,N._)`"" + ${n}`).elseIf((0,N._)`${n} === null`).assign(a,(0,N._)`""`);return;case"number":o.elseIf((0,N._)`${i} == "boolean" || ${n} === null
4
- || (${i} == "string" && ${n} && ${n} == +${n})`).assign(a,(0,N._)`+${n}`);return;case"integer":o.elseIf((0,N._)`${i} === "boolean" || ${n} === null
5
- || (${i} === "string" && ${n} && ${n} == +${n} && !(${n} % 1))`).assign(a,(0,N._)`+${n}`);return;case"boolean":o.elseIf((0,N._)`${n} === "false" || ${n} === 0 || ${n} === null`).assign(a,!1).elseIf((0,N._)`${n} === "true" || ${n} === 1`).assign(a,!0);return;case"null":o.elseIf((0,N._)`${n} === "" || ${n} === 0 || ${n} === false`),o.assign(a,null);return;case"array":o.elseIf((0,N._)`${i} === "string" || ${i} === "number"
6
- || ${i} === "boolean" || ${n} === null`).assign(a,(0,N._)`[${n}]`)}}}function $w({gen:e,parentData:t,parentDataProperty:r},o){e.if((0,N._)`${t} !== undefined`,()=>e.assign((0,N._)`${t}[${r}]`,o))}function ra(e,t,r,o=lr.Correct){let n=o===lr.Correct?N.operators.EQ:N.operators.NEQ,s;switch(e){case"null":return(0,N._)`${t} ${n} null`;case"array":s=(0,N._)`Array.isArray(${t})`;break;case"object":s=(0,N._)`${t} && typeof ${t} == "object" && !Array.isArray(${t})`;break;case"integer":s=i((0,N._)`!(${t} % 1) && !isNaN(${t})`);break;case"number":s=i();break;default:return(0,N._)`typeof ${t} ${n} ${e}`}return o===lr.Correct?s:(0,N.not)(s);function i(a=N.nil){return(0,N.and)((0,N._)`typeof ${t} == "number"`,a,r?(0,N._)`isFinite(${t})`:N.nil)}}$e.checkDataType=ra;function oa(e,t,r,o){if(e.length===1)return ra(e[0],t,r,o);let n,s=(0,af.toHash)(e);if(s.array&&s.object){let i=(0,N._)`typeof ${t} != "object"`;n=s.null?i:(0,N._)`!${t} || ${i}`,delete s.null,delete s.array,delete s.object}else n=N.nil;s.number&&delete s.integer;for(let i in s)n=(0,N.and)(n,ra(i,t,r,o));return n}$e.checkDataTypes=oa;var xw={message:({schema:e})=>`must be ${e}`,params:({schema:e,schemaValue:t})=>typeof e=="string"?(0,N._)`{type: ${e}}`:(0,N._)`{type: ${t}}`};function na(e){let t=bw(e);(0,gw.reportError)(t,xw)}$e.reportTypeError=na;function bw(e){let{gen:t,data:r,schema:o}=e,n=(0,af.schemaRefOrVal)(e,o,"type");return{gen:t,keyword:"type",data:r,schema:o.type,schemaCode:n,schemaValue:n,parentSchema:o,params:{},it:e}}});var df=b(Sn=>{"use strict";Object.defineProperty(Sn,"__esModule",{value:!0});Sn.assignDefaults=void 0;var dr=j(),zw=U();function Sw(e,t){let{properties:r,items:o}=e.schema;if(t==="object"&&r)for(let n in r)lf(e,n,r[n].default);else t==="array"&&Array.isArray(o)&&o.forEach((n,s)=>lf(e,s,n.default))}Sn.assignDefaults=Sw;function lf(e,t,r){let{gen:o,compositeRule:n,data:s,opts:i}=e;if(r===void 0)return;let a=(0,dr._)`${s}${(0,dr.getProperty)(t)}`;if(n){(0,zw.checkStrictMode)(e,`default is ignored for: ${a}`);return}let c=(0,dr._)`${a} === undefined`;i.useDefaults==="empty"&&(c=(0,dr._)`${c} || ${a} === null || ${a} === ""`),o.if(c,(0,dr._)`${a} = ${(0,dr.stringify)(r)}`)}});var je=b(K=>{"use strict";Object.defineProperty(K,"__esModule",{value:!0});K.validateUnion=K.validateArray=K.usePattern=K.callValidateCode=K.schemaProperties=K.allSchemaProperties=K.noPropertyInData=K.propertyInData=K.isOwnProperty=K.hasPropFunc=K.reportMissingProp=K.checkMissingProp=K.checkReportMissingProp=void 0;var re=j(),sa=U(),gt=st(),kw=U();function Pw(e,t){let{gen:r,data:o,it:n}=e;r.if(aa(r,o,t,n.opts.ownProperties),()=>{e.setParams({missingProperty:(0,re._)`${t}`},!0),e.error()})}K.checkReportMissingProp=Pw;function Ew({gen:e,data:t,it:{opts:r}},o,n){return(0,re.or)(...o.map(s=>(0,re.and)(aa(e,t,s,r.ownProperties),(0,re._)`${n} = ${s}`)))}K.checkMissingProp=Ew;function Tw(e,t){e.setParams({missingProperty:t},!0),e.error()}K.reportMissingProp=Tw;function pf(e){return e.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:(0,re._)`Object.prototype.hasOwnProperty`})}K.hasPropFunc=pf;function ia(e,t,r){return(0,re._)`${pf(e)}.call(${t}, ${r})`}K.isOwnProperty=ia;function Rw(e,t,r,o){let n=(0,re._)`${t}${(0,re.getProperty)(r)} !== undefined`;return o?(0,re._)`${n} && ${ia(e,t,r)}`:n}K.propertyInData=Rw;function aa(e,t,r,o){let n=(0,re._)`${t}${(0,re.getProperty)(r)} === undefined`;return o?(0,re.or)(n,(0,re.not)(ia(e,t,r))):n}K.noPropertyInData=aa;function ff(e){return e?Object.keys(e).filter(t=>t!=="__proto__"):[]}K.allSchemaProperties=ff;function Iw(e,t){return ff(t).filter(r=>!(0,sa.alwaysValidSchema)(e,t[r]))}K.schemaProperties=Iw;function Ow({schemaCode:e,data:t,it:{gen:r,topSchemaRef:o,schemaPath:n,errorPath:s},it:i},a,c,l){let u=l?(0,re._)`${e}, ${t}, ${o}${n}`:t,d=[[gt.default.instancePath,(0,re.strConcat)(gt.default.instancePath,s)],[gt.default.parentData,i.parentData],[gt.default.parentDataProperty,i.parentDataProperty],[gt.default.rootData,gt.default.rootData]];i.opts.dynamicRef&&d.push([gt.default.dynamicAnchors,gt.default.dynamicAnchors]);let m=(0,re._)`${u}, ${r.object(...d)}`;return c!==re.nil?(0,re._)`${a}.call(${c}, ${m})`:(0,re._)`${a}(${m})`}K.callValidateCode=Ow;var Cw=(0,re._)`new RegExp`;function Aw({gen:e,it:{opts:t}},r){let o=t.unicodeRegExp?"u":"",{regExp:n}=t.code,s=n(r,o);return e.scopeValue("pattern",{key:s.toString(),ref:s,code:(0,re._)`${n.code==="new RegExp"?Cw:(0,kw.useFunc)(e,n)}(${r}, ${o})`})}K.usePattern=Aw;function Nw(e){let{gen:t,data:r,keyword:o,it:n}=e,s=t.name("valid");if(n.allErrors){let a=t.let("valid",!0);return i(()=>t.assign(a,!1)),a}return t.var(s,!0),i(()=>t.break()),s;function i(a){let c=t.const("len",(0,re._)`${r}.length`);t.forRange("i",0,c,l=>{e.subschema({keyword:o,dataProp:l,dataPropType:sa.Type.Num},s),t.if((0,re.not)(s),a)})}}K.validateArray=Nw;function jw(e){let{gen:t,schema:r,keyword:o,it:n}=e;if(!Array.isArray(r))throw new Error("ajv implementation error");if(r.some(c=>(0,sa.alwaysValidSchema)(n,c))&&!n.opts.unevaluated)return;let i=t.let("valid",!1),a=t.name("_valid");t.block(()=>r.forEach((c,l)=>{let u=e.subschema({keyword:o,schemaProp:l,compositeRule:!0},a);t.assign(i,(0,re._)`${i} || ${a}`),e.mergeValidEvaluated(u,a)||t.if((0,re.not)(i))})),e.result(i,()=>e.reset(),()=>e.error(!0))}K.validateUnion=jw});var gf=b(Ge=>{"use strict";Object.defineProperty(Ge,"__esModule",{value:!0});Ge.validateKeywordUsage=Ge.validSchemaType=Ge.funcKeywordCode=Ge.macroKeywordCode=void 0;var ze=j(),At=st(),Zw=je(),qw=Xr();function Mw(e,t){let{gen:r,keyword:o,schema:n,parentSchema:s,it:i}=e,a=t.macro.call(i.self,n,s,i),c=hf(r,o,a);i.opts.validateSchema!==!1&&i.self.validateSchema(a,!0);let l=r.name("valid");e.subschema({schema:a,schemaPath:ze.nil,errSchemaPath:`${i.errSchemaPath}/${o}`,topSchemaRef:c,compositeRule:!0},l),e.pass(l,()=>e.error(!0))}Ge.macroKeywordCode=Mw;function Dw(e,t){var r;let{gen:o,keyword:n,schema:s,parentSchema:i,$data:a,it:c}=e;Lw(c,t);let l=!a&&t.compile?t.compile.call(c.self,s,i,c):t.validate,u=hf(o,n,l),d=o.let("valid");e.block$data(d,m),e.ok((r=t.valid)!==null&&r!==void 0?r:d);function m(){if(t.errors===!1)h(),t.modifying&&mf(e),_(()=>e.error());else{let w=t.async?f():g();t.modifying&&mf(e),_(()=>Uw(e,w))}}function f(){let w=o.let("ruleErrs",null);return o.try(()=>h((0,ze._)`await `),$=>o.assign(d,!1).if((0,ze._)`${$} instanceof ${c.ValidationError}`,()=>o.assign(w,(0,ze._)`${$}.errors`),()=>o.throw($))),w}function g(){let w=(0,ze._)`${u}.errors`;return o.assign(w,null),h(ze.nil),w}function h(w=t.async?(0,ze._)`await `:ze.nil){let $=c.opts.passContext?At.default.this:At.default.self,x=!("compile"in t&&!a||t.schema===!1);o.assign(d,(0,ze._)`${w}${(0,Zw.callValidateCode)(e,u,$,x)}`,t.modifying)}function _(w){var $;o.if((0,ze.not)(($=t.valid)!==null&&$!==void 0?$:d),w)}}Ge.funcKeywordCode=Dw;function mf(e){let{gen:t,data:r,it:o}=e;t.if(o.parentData,()=>t.assign(r,(0,ze._)`${o.parentData}[${o.parentDataProperty}]`))}function Uw(e,t){let{gen:r}=e;r.if((0,ze._)`Array.isArray(${t})`,()=>{r.assign(At.default.vErrors,(0,ze._)`${At.default.vErrors} === null ? ${t} : ${At.default.vErrors}.concat(${t})`).assign(At.default.errors,(0,ze._)`${At.default.vErrors}.length`),(0,qw.extendErrors)(e)},()=>e.error())}function Lw({schemaEnv:e},t){if(t.async&&!e.$async)throw new Error("async keyword in sync schema")}function hf(e,t,r){if(r===void 0)throw new Error(`keyword "${t}" failed to compile`);return e.scopeValue("keyword",typeof r=="function"?{ref:r}:{ref:r,code:(0,ze.stringify)(r)})}function Fw(e,t,r=!1){return!t.length||t.some(o=>o==="array"?Array.isArray(e):o==="object"?e&&typeof e=="object"&&!Array.isArray(e):typeof e==o||r&&typeof e>"u")}Ge.validSchemaType=Fw;function Vw({schema:e,opts:t,self:r,errSchemaPath:o},n,s){if(Array.isArray(n.keyword)?!n.keyword.includes(s):n.keyword!==s)throw new Error("ajv implementation error");let i=n.dependencies;if(i?.some(a=>!Object.prototype.hasOwnProperty.call(e,a)))throw new Error(`parent schema must have dependencies of ${s}: ${i.join(",")}`);if(n.validateSchema&&!n.validateSchema(e[s])){let c=`keyword "${s}" value is invalid at path "${o}": `+r.errorsText(n.validateSchema.errors);if(t.validateSchema==="log")r.logger.error(c);else throw new Error(c)}}Ge.validateKeywordUsage=Vw});var yf=b(_t=>{"use strict";Object.defineProperty(_t,"__esModule",{value:!0});_t.extendSubschemaMode=_t.extendSubschemaData=_t.getSubschema=void 0;var Je=j(),_f=U();function Hw(e,{keyword:t,schemaProp:r,schema:o,schemaPath:n,errSchemaPath:s,topSchemaRef:i}){if(t!==void 0&&o!==void 0)throw new Error('both "keyword" and "schema" passed, only one allowed');if(t!==void 0){let a=e.schema[t];return r===void 0?{schema:a,schemaPath:(0,Je._)`${e.schemaPath}${(0,Je.getProperty)(t)}`,errSchemaPath:`${e.errSchemaPath}/${t}`}:{schema:a[r],schemaPath:(0,Je._)`${e.schemaPath}${(0,Je.getProperty)(t)}${(0,Je.getProperty)(r)}`,errSchemaPath:`${e.errSchemaPath}/${t}/${(0,_f.escapeFragment)(r)}`}}if(o!==void 0){if(n===void 0||s===void 0||i===void 0)throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:o,schemaPath:n,topSchemaRef:i,errSchemaPath:s}}throw new Error('either "keyword" or "schema" must be passed')}_t.getSubschema=Hw;function Bw(e,t,{dataProp:r,dataPropType:o,data:n,dataTypes:s,propertyName:i}){if(n!==void 0&&r!==void 0)throw new Error('both "data" and "dataProp" passed, only one allowed');let{gen:a}=t;if(r!==void 0){let{errorPath:l,dataPathArr:u,opts:d}=t,m=a.let("data",(0,Je._)`${t.data}${(0,Je.getProperty)(r)}`,!0);c(m),e.errorPath=(0,Je.str)`${l}${(0,_f.getErrorPath)(r,o,d.jsPropertySyntax)}`,e.parentDataProperty=(0,Je._)`${r}`,e.dataPathArr=[...u,e.parentDataProperty]}if(n!==void 0){let l=n instanceof Je.Name?n:a.let("data",n,!0);c(l),i!==void 0&&(e.propertyName=i)}s&&(e.dataTypes=s);function c(l){e.data=l,e.dataLevel=t.dataLevel+1,e.dataTypes=[],t.definedProperties=new Set,e.parentData=t.data,e.dataNames=[...t.dataNames,l]}}_t.extendSubschemaData=Bw;function Kw(e,{jtdDiscriminator:t,jtdMetadata:r,compositeRule:o,createErrors:n,allErrors:s}){o!==void 0&&(e.compositeRule=o),n!==void 0&&(e.createErrors=n),s!==void 0&&(e.allErrors=s),e.jtdDiscriminator=t,e.jtdMetadata=r}_t.extendSubschemaMode=Kw});var ca=b((L1,vf)=>{"use strict";vf.exports=function e(t,r){if(t===r)return!0;if(t&&r&&typeof t=="object"&&typeof r=="object"){if(t.constructor!==r.constructor)return!1;var o,n,s;if(Array.isArray(t)){if(o=t.length,o!=r.length)return!1;for(n=o;n--!==0;)if(!e(t[n],r[n]))return!1;return!0}if(t.constructor===RegExp)return t.source===r.source&&t.flags===r.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===r.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===r.toString();if(s=Object.keys(t),o=s.length,o!==Object.keys(r).length)return!1;for(n=o;n--!==0;)if(!Object.prototype.hasOwnProperty.call(r,s[n]))return!1;for(n=o;n--!==0;){var i=s[n];if(!e(t[i],r[i]))return!1}return!0}return t!==t&&r!==r}});var $f=b((F1,wf)=>{"use strict";var yt=wf.exports=function(e,t,r){typeof t=="function"&&(r=t,t={}),r=t.cb||r;var o=typeof r=="function"?r:r.pre||function(){},n=r.post||function(){};kn(t,o,n,e,"",e)};yt.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0};yt.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};yt.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};yt.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 kn(e,t,r,o,n,s,i,a,c,l){if(o&&typeof o=="object"&&!Array.isArray(o)){t(o,n,s,i,a,c,l);for(var u in o){var d=o[u];if(Array.isArray(d)){if(u in yt.arrayKeywords)for(var m=0;m<d.length;m++)kn(e,t,r,d[m],n+"/"+u+"/"+m,s,n,u,o,m)}else if(u in yt.propsKeywords){if(d&&typeof d=="object")for(var f in d)kn(e,t,r,d[f],n+"/"+u+"/"+Ww(f),s,n,u,o,f)}else(u in yt.keywords||e.allKeys&&!(u in yt.skipKeywords))&&kn(e,t,r,d,n+"/"+u,s,n,u,o)}r(o,n,s,i,a,c,l)}}function Ww(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}});var to=b(Ee=>{"use strict";Object.defineProperty(Ee,"__esModule",{value:!0});Ee.getSchemaRefs=Ee.resolveUrl=Ee.normalizeId=Ee._getFullPath=Ee.getFullPath=Ee.inlineRef=void 0;var Gw=U(),Jw=ca(),Qw=$f(),Yw=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function Xw(e,t=!0){return typeof e=="boolean"?!0:t===!0?!ua(e):t?xf(e)<=t:!1}Ee.inlineRef=Xw;var e$=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function ua(e){for(let t in e){if(e$.has(t))return!0;let r=e[t];if(Array.isArray(r)&&r.some(ua)||typeof r=="object"&&ua(r))return!0}return!1}function xf(e){let t=0;for(let r in e){if(r==="$ref")return 1/0;if(t++,!Yw.has(r)&&(typeof e[r]=="object"&&(0,Gw.eachItem)(e[r],o=>t+=xf(o)),t===1/0))return 1/0}return t}function bf(e,t="",r){r!==!1&&(t=pr(t));let o=e.parse(t);return zf(e,o)}Ee.getFullPath=bf;function zf(e,t){return e.serialize(t).split("#")[0]+"#"}Ee._getFullPath=zf;var t$=/#\/?$/;function pr(e){return e?e.replace(t$,""):""}Ee.normalizeId=pr;function r$(e,t,r){return r=pr(r),e.resolve(t,r)}Ee.resolveUrl=r$;var o$=/^[a-z_][-a-z0-9._]*$/i;function n$(e,t){if(typeof e=="boolean")return{};let{schemaId:r,uriResolver:o}=this.opts,n=pr(e[r]||t),s={"":n},i=bf(o,n,!1),a={},c=new Set;return Qw(e,{allKeys:!0},(d,m,f,g)=>{if(g===void 0)return;let h=i+m,_=s[g];typeof d[r]=="string"&&(_=w.call(this,d[r])),$.call(this,d.$anchor),$.call(this,d.$dynamicAnchor),s[m]=_;function w(x){let T=this.opts.uriResolver.resolve;if(x=pr(_?T(_,x):x),c.has(x))throw u(x);c.add(x);let v=this.refs[x];return typeof v=="string"&&(v=this.refs[v]),typeof v=="object"?l(d,v.schema,x):x!==pr(h)&&(x[0]==="#"?(l(d,a[x],x),a[x]=d):this.refs[x]=h),x}function $(x){if(typeof x=="string"){if(!o$.test(x))throw new Error(`invalid anchor "${x}"`);w.call(this,`#${x}`)}}}),a;function l(d,m,f){if(m!==void 0&&!Jw(d,m))throw u(f)}function u(d){return new Error(`reference "${d}" resolves to more than one schema`)}}Ee.getSchemaRefs=n$});var no=b(vt=>{"use strict";Object.defineProperty(vt,"__esModule",{value:!0});vt.getData=vt.KeywordCxt=vt.validateFunctionCode=void 0;var Tf=of(),Sf=eo(),da=ta(),Pn=eo(),s$=df(),oo=gf(),la=yf(),E=j(),A=st(),i$=to(),it=U(),ro=Xr();function a$(e){if(Of(e)&&(Cf(e),If(e))){l$(e);return}Rf(e,()=>(0,Tf.topBoolOrEmptySchema)(e))}vt.validateFunctionCode=a$;function Rf({gen:e,validateName:t,schema:r,schemaEnv:o,opts:n},s){n.code.es5?e.func(t,(0,E._)`${A.default.data}, ${A.default.valCxt}`,o.$async,()=>{e.code((0,E._)`"use strict"; ${kf(r,n)}`),u$(e,n),e.code(s)}):e.func(t,(0,E._)`${A.default.data}, ${c$(n)}`,o.$async,()=>e.code(kf(r,n)).code(s))}function c$(e){return(0,E._)`{${A.default.instancePath}="", ${A.default.parentData}, ${A.default.parentDataProperty}, ${A.default.rootData}=${A.default.data}${e.dynamicRef?(0,E._)`, ${A.default.dynamicAnchors}={}`:E.nil}}={}`}function u$(e,t){e.if(A.default.valCxt,()=>{e.var(A.default.instancePath,(0,E._)`${A.default.valCxt}.${A.default.instancePath}`),e.var(A.default.parentData,(0,E._)`${A.default.valCxt}.${A.default.parentData}`),e.var(A.default.parentDataProperty,(0,E._)`${A.default.valCxt}.${A.default.parentDataProperty}`),e.var(A.default.rootData,(0,E._)`${A.default.valCxt}.${A.default.rootData}`),t.dynamicRef&&e.var(A.default.dynamicAnchors,(0,E._)`${A.default.valCxt}.${A.default.dynamicAnchors}`)},()=>{e.var(A.default.instancePath,(0,E._)`""`),e.var(A.default.parentData,(0,E._)`undefined`),e.var(A.default.parentDataProperty,(0,E._)`undefined`),e.var(A.default.rootData,A.default.data),t.dynamicRef&&e.var(A.default.dynamicAnchors,(0,E._)`{}`)})}function l$(e){let{schema:t,opts:r,gen:o}=e;Rf(e,()=>{r.$comment&&t.$comment&&Nf(e),h$(e),o.let(A.default.vErrors,null),o.let(A.default.errors,0),r.unevaluated&&d$(e),Af(e),y$(e)})}function d$(e){let{gen:t,validateName:r}=e;e.evaluated=t.const("evaluated",(0,E._)`${r}.evaluated`),t.if((0,E._)`${e.evaluated}.dynamicProps`,()=>t.assign((0,E._)`${e.evaluated}.props`,(0,E._)`undefined`)),t.if((0,E._)`${e.evaluated}.dynamicItems`,()=>t.assign((0,E._)`${e.evaluated}.items`,(0,E._)`undefined`))}function kf(e,t){let r=typeof e=="object"&&e[t.schemaId];return r&&(t.code.source||t.code.process)?(0,E._)`/*# sourceURL=${r} */`:E.nil}function p$(e,t){if(Of(e)&&(Cf(e),If(e))){f$(e,t);return}(0,Tf.boolOrEmptySchema)(e,t)}function If({schema:e,self:t}){if(typeof e=="boolean")return!e;for(let r in e)if(t.RULES.all[r])return!0;return!1}function Of(e){return typeof e.schema!="boolean"}function f$(e,t){let{schema:r,gen:o,opts:n}=e;n.$comment&&r.$comment&&Nf(e),g$(e),_$(e);let s=o.const("_errs",A.default.errors);Af(e,s),o.var(t,(0,E._)`${s} === ${A.default.errors}`)}function Cf(e){(0,it.checkUnknownRules)(e),m$(e)}function Af(e,t){if(e.opts.jtd)return Pf(e,[],!1,t);let r=(0,Sf.getSchemaTypes)(e.schema),o=(0,Sf.coerceAndCheckDataType)(e,r);Pf(e,r,!o,t)}function m$(e){let{schema:t,errSchemaPath:r,opts:o,self:n}=e;t.$ref&&o.ignoreKeywordsWithRef&&(0,it.schemaHasRulesButRef)(t,n.RULES)&&n.logger.warn(`$ref: keywords ignored in schema at path "${r}"`)}function h$(e){let{schema:t,opts:r}=e;t.default!==void 0&&r.useDefaults&&r.strictSchema&&(0,it.checkStrictMode)(e,"default is ignored in the schema root")}function g$(e){let t=e.schema[e.opts.schemaId];t&&(e.baseId=(0,i$.resolveUrl)(e.opts.uriResolver,e.baseId,t))}function _$(e){if(e.schema.$async&&!e.schemaEnv.$async)throw new Error("async schema in sync schema")}function Nf({gen:e,schemaEnv:t,schema:r,errSchemaPath:o,opts:n}){let s=r.$comment;if(n.$comment===!0)e.code((0,E._)`${A.default.self}.logger.log(${s})`);else if(typeof n.$comment=="function"){let i=(0,E.str)`${o}/$comment`,a=e.scopeValue("root",{ref:t.root});e.code((0,E._)`${A.default.self}.opts.$comment(${s}, ${i}, ${a}.schema)`)}}function y$(e){let{gen:t,schemaEnv:r,validateName:o,ValidationError:n,opts:s}=e;r.$async?t.if((0,E._)`${A.default.errors} === 0`,()=>t.return(A.default.data),()=>t.throw((0,E._)`new ${n}(${A.default.vErrors})`)):(t.assign((0,E._)`${o}.errors`,A.default.vErrors),s.unevaluated&&v$(e),t.return((0,E._)`${A.default.errors} === 0`))}function v$({gen:e,evaluated:t,props:r,items:o}){r instanceof E.Name&&e.assign((0,E._)`${t}.props`,r),o instanceof E.Name&&e.assign((0,E._)`${t}.items`,o)}function Pf(e,t,r,o){let{gen:n,schema:s,data:i,allErrors:a,opts:c,self:l}=e,{RULES:u}=l;if(s.$ref&&(c.ignoreKeywordsWithRef||!(0,it.schemaHasRulesButRef)(s,u))){n.block(()=>Zf(e,"$ref",u.all.$ref.definition));return}c.jtd||w$(e,t),n.block(()=>{for(let m of u.rules)d(m);d(u.post)});function d(m){(0,da.shouldUseGroup)(s,m)&&(m.type?(n.if((0,Pn.checkDataType)(m.type,i,c.strictNumbers)),Ef(e,m),t.length===1&&t[0]===m.type&&r&&(n.else(),(0,Pn.reportTypeError)(e)),n.endIf()):Ef(e,m),a||n.if((0,E._)`${A.default.errors} === ${o||0}`))}}function Ef(e,t){let{gen:r,schema:o,opts:{useDefaults:n}}=e;n&&(0,s$.assignDefaults)(e,t.type),r.block(()=>{for(let s of t.rules)(0,da.shouldUseRule)(o,s)&&Zf(e,s.keyword,s.definition,t.type)})}function w$(e,t){e.schemaEnv.meta||!e.opts.strictTypes||($$(e,t),e.opts.allowUnionTypes||x$(e,t),b$(e,e.dataTypes))}function $$(e,t){if(t.length){if(!e.dataTypes.length){e.dataTypes=t;return}t.forEach(r=>{jf(e.dataTypes,r)||pa(e,`type "${r}" not allowed by context "${e.dataTypes.join(",")}"`)}),S$(e,t)}}function x$(e,t){t.length>1&&!(t.length===2&&t.includes("null"))&&pa(e,"use allowUnionTypes to allow union type keyword")}function b$(e,t){let r=e.self.RULES.all;for(let o in r){let n=r[o];if(typeof n=="object"&&(0,da.shouldUseRule)(e.schema,n)){let{type:s}=n.definition;s.length&&!s.some(i=>z$(t,i))&&pa(e,`missing type "${s.join(",")}" for keyword "${o}"`)}}}function z$(e,t){return e.includes(t)||t==="number"&&e.includes("integer")}function jf(e,t){return e.includes(t)||t==="integer"&&e.includes("number")}function S$(e,t){let r=[];for(let o of e.dataTypes)jf(t,o)?r.push(o):t.includes("integer")&&o==="number"&&r.push("integer");e.dataTypes=r}function pa(e,t){let r=e.schemaEnv.baseId+e.errSchemaPath;t+=` at "${r}" (strictTypes)`,(0,it.checkStrictMode)(e,t,e.opts.strictTypes)}var En=class{constructor(t,r,o){if((0,oo.validateKeywordUsage)(t,r,o),this.gen=t.gen,this.allErrors=t.allErrors,this.keyword=o,this.data=t.data,this.schema=t.schema[o],this.$data=r.$data&&t.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,it.schemaRefOrVal)(t,this.schema,o,this.$data),this.schemaType=r.schemaType,this.parentSchema=t.schema,this.params={},this.it=t,this.def=r,this.$data)this.schemaCode=t.gen.const("vSchema",qf(this.$data,t));else if(this.schemaCode=this.schemaValue,!(0,oo.validSchemaType)(this.schema,r.schemaType,r.allowUndefined))throw new Error(`${o} value must be ${JSON.stringify(r.schemaType)}`);("code"in r?r.trackErrors:r.errors!==!1)&&(this.errsCount=t.gen.const("_errs",A.default.errors))}result(t,r,o){this.failResult((0,E.not)(t),r,o)}failResult(t,r,o){this.gen.if(t),o?o():this.error(),r?(this.gen.else(),r(),this.allErrors&&this.gen.endIf()):this.allErrors?this.gen.endIf():this.gen.else()}pass(t,r){this.failResult((0,E.not)(t),void 0,r)}fail(t){if(t===void 0){this.error(),this.allErrors||this.gen.if(!1);return}this.gen.if(t),this.error(),this.allErrors?this.gen.endIf():this.gen.else()}fail$data(t){if(!this.$data)return this.fail(t);let{schemaCode:r}=this;this.fail((0,E._)`${r} !== undefined && (${(0,E.or)(this.invalid$data(),t)})`)}error(t,r,o){if(r){this.setParams(r),this._error(t,o),this.setParams({});return}this._error(t,o)}_error(t,r){(t?ro.reportExtraError:ro.reportError)(this,this.def.error,r)}$dataError(){(0,ro.reportError)(this,this.def.$dataError||ro.keyword$DataError)}reset(){if(this.errsCount===void 0)throw new Error('add "trackErrors" to keyword definition');(0,ro.resetErrorsCount)(this.gen,this.errsCount)}ok(t){this.allErrors||this.gen.if(t)}setParams(t,r){r?Object.assign(this.params,t):this.params=t}block$data(t,r,o=E.nil){this.gen.block(()=>{this.check$data(t,o),r()})}check$data(t=E.nil,r=E.nil){if(!this.$data)return;let{gen:o,schemaCode:n,schemaType:s,def:i}=this;o.if((0,E.or)((0,E._)`${n} === undefined`,r)),t!==E.nil&&o.assign(t,!0),(s.length||i.validateSchema)&&(o.elseIf(this.invalid$data()),this.$dataError(),t!==E.nil&&o.assign(t,!1)),o.else()}invalid$data(){let{gen:t,schemaCode:r,schemaType:o,def:n,it:s}=this;return(0,E.or)(i(),a());function i(){if(o.length){if(!(r instanceof E.Name))throw new Error("ajv implementation error");let c=Array.isArray(o)?o:[o];return(0,E._)`${(0,Pn.checkDataTypes)(c,r,s.opts.strictNumbers,Pn.DataType.Wrong)}`}return E.nil}function a(){if(n.validateSchema){let c=t.scopeValue("validate$data",{ref:n.validateSchema});return(0,E._)`!${c}(${r})`}return E.nil}}subschema(t,r){let o=(0,la.getSubschema)(this.it,t);(0,la.extendSubschemaData)(o,this.it,t),(0,la.extendSubschemaMode)(o,t);let n={...this.it,...o,items:void 0,props:void 0};return p$(n,r),n}mergeEvaluated(t,r){let{it:o,gen:n}=this;o.opts.unevaluated&&(o.props!==!0&&t.props!==void 0&&(o.props=it.mergeEvaluated.props(n,t.props,o.props,r)),o.items!==!0&&t.items!==void 0&&(o.items=it.mergeEvaluated.items(n,t.items,o.items,r)))}mergeValidEvaluated(t,r){let{it:o,gen:n}=this;if(o.opts.unevaluated&&(o.props!==!0||o.items!==!0))return n.if(r,()=>this.mergeEvaluated(t,E.Name)),!0}};vt.KeywordCxt=En;function Zf(e,t,r,o){let n=new En(e,r,t);"code"in r?r.code(n,o):n.$data&&r.validate?(0,oo.funcKeywordCode)(n,r):"macro"in r?(0,oo.macroKeywordCode)(n,r):(r.compile||r.validate)&&(0,oo.funcKeywordCode)(n,r)}var k$=/^\/(?:[^~]|~0|~1)*$/,P$=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function qf(e,{dataLevel:t,dataNames:r,dataPathArr:o}){let n,s;if(e==="")return A.default.rootData;if(e[0]==="/"){if(!k$.test(e))throw new Error(`Invalid JSON-pointer: ${e}`);n=e,s=A.default.rootData}else{let l=P$.exec(e);if(!l)throw new Error(`Invalid JSON-pointer: ${e}`);let u=+l[1];if(n=l[2],n==="#"){if(u>=t)throw new Error(c("property/index",u));return o[t-u]}if(u>t)throw new Error(c("data",u));if(s=r[t-u],!n)return s}let i=s,a=n.split("/");for(let l of a)l&&(s=(0,E._)`${s}${(0,E.getProperty)((0,it.unescapeJsonPointer)(l))}`,i=(0,E._)`${i} && ${s}`);return i;function c(l,u){return`Cannot access ${l} ${u} levels up, current level is ${t}`}}vt.getData=qf});var Tn=b(ma=>{"use strict";Object.defineProperty(ma,"__esModule",{value:!0});var fa=class extends Error{constructor(t){super("validation failed"),this.errors=t,this.ajv=this.validation=!0}};ma.default=fa});var so=b(_a=>{"use strict";Object.defineProperty(_a,"__esModule",{value:!0});var ha=to(),ga=class extends Error{constructor(t,r,o,n){super(n||`can't resolve reference ${o} from id ${r}`),this.missingRef=(0,ha.resolveUrl)(t,r,o),this.missingSchema=(0,ha.normalizeId)((0,ha.getFullPath)(t,this.missingRef))}};_a.default=ga});var In=b(Ze=>{"use strict";Object.defineProperty(Ze,"__esModule",{value:!0});Ze.resolveSchema=Ze.getCompilingSchema=Ze.resolveRef=Ze.compileSchema=Ze.SchemaEnv=void 0;var Ve=j(),E$=Tn(),Nt=st(),He=to(),Mf=U(),T$=no(),fr=class{constructor(t){var r;this.refs={},this.dynamicAnchors={};let o;typeof t.schema=="object"&&(o=t.schema),this.schema=t.schema,this.schemaId=t.schemaId,this.root=t.root||this,this.baseId=(r=t.baseId)!==null&&r!==void 0?r:(0,He.normalizeId)(o?.[t.schemaId||"$id"]),this.schemaPath=t.schemaPath,this.localRefs=t.localRefs,this.meta=t.meta,this.$async=o?.$async,this.refs={}}};Ze.SchemaEnv=fr;function va(e){let t=Df.call(this,e);if(t)return t;let r=(0,He.getFullPath)(this.opts.uriResolver,e.root.baseId),{es5:o,lines:n}=this.opts.code,{ownProperties:s}=this.opts,i=new Ve.CodeGen(this.scope,{es5:o,lines:n,ownProperties:s}),a;e.$async&&(a=i.scopeValue("Error",{ref:E$.default,code:(0,Ve._)`require("ajv/dist/runtime/validation_error").default`}));let c=i.scopeName("validate");e.validateName=c;let l={gen:i,allErrors:this.opts.allErrors,data:Nt.default.data,parentData:Nt.default.parentData,parentDataProperty:Nt.default.parentDataProperty,dataNames:[Nt.default.data],dataPathArr:[Ve.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:i.scopeValue("schema",this.opts.code.source===!0?{ref:e.schema,code:(0,Ve.stringify)(e.schema)}:{ref:e.schema}),validateName:c,ValidationError:a,schema:e.schema,schemaEnv:e,rootId:r,baseId:e.baseId||r,schemaPath:Ve.nil,errSchemaPath:e.schemaPath||(this.opts.jtd?"":"#"),errorPath:(0,Ve._)`""`,opts:this.opts,self:this},u;try{this._compilations.add(e),(0,T$.validateFunctionCode)(l),i.optimize(this.opts.code.optimize);let d=i.toString();u=`${i.scopeRefs(Nt.default.scope)}return ${d}`,this.opts.code.process&&(u=this.opts.code.process(u,e));let f=new Function(`${Nt.default.self}`,`${Nt.default.scope}`,u)(this,this.scope.get());if(this.scope.value(c,{ref:f}),f.errors=null,f.schema=e.schema,f.schemaEnv=e,e.$async&&(f.$async=!0),this.opts.code.source===!0&&(f.source={validateName:c,validateCode:d,scopeValues:i._values}),this.opts.unevaluated){let{props:g,items:h}=l;f.evaluated={props:g instanceof Ve.Name?void 0:g,items:h instanceof Ve.Name?void 0:h,dynamicProps:g instanceof Ve.Name,dynamicItems:h instanceof Ve.Name},f.source&&(f.source.evaluated=(0,Ve.stringify)(f.evaluated))}return e.validate=f,e}catch(d){throw delete e.validate,delete e.validateName,u&&this.logger.error("Error compiling schema, function code:",u),d}finally{this._compilations.delete(e)}}Ze.compileSchema=va;function R$(e,t,r){var o;r=(0,He.resolveUrl)(this.opts.uriResolver,t,r);let n=e.refs[r];if(n)return n;let s=C$.call(this,e,r);if(s===void 0){let i=(o=e.localRefs)===null||o===void 0?void 0:o[r],{schemaId:a}=this.opts;i&&(s=new fr({schema:i,schemaId:a,root:e,baseId:t}))}if(s!==void 0)return e.refs[r]=I$.call(this,s)}Ze.resolveRef=R$;function I$(e){return(0,He.inlineRef)(e.schema,this.opts.inlineRefs)?e.schema:e.validate?e:va.call(this,e)}function Df(e){for(let t of this._compilations)if(O$(t,e))return t}Ze.getCompilingSchema=Df;function O$(e,t){return e.schema===t.schema&&e.root===t.root&&e.baseId===t.baseId}function C$(e,t){let r;for(;typeof(r=this.refs[t])=="string";)t=r;return r||this.schemas[t]||Rn.call(this,e,t)}function Rn(e,t){let r=this.opts.uriResolver.parse(t),o=(0,He._getFullPath)(this.opts.uriResolver,r),n=(0,He.getFullPath)(this.opts.uriResolver,e.baseId,void 0);if(Object.keys(e.schema).length>0&&o===n)return ya.call(this,r,e);let s=(0,He.normalizeId)(o),i=this.refs[s]||this.schemas[s];if(typeof i=="string"){let a=Rn.call(this,e,i);return typeof a?.schema!="object"?void 0:ya.call(this,r,a)}if(typeof i?.schema=="object"){if(i.validate||va.call(this,i),s===(0,He.normalizeId)(t)){let{schema:a}=i,{schemaId:c}=this.opts,l=a[c];return l&&(n=(0,He.resolveUrl)(this.opts.uriResolver,n,l)),new fr({schema:a,schemaId:c,root:e,baseId:n})}return ya.call(this,r,i)}}Ze.resolveSchema=Rn;var A$=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function ya(e,{baseId:t,schema:r,root:o}){var n;if(((n=e.fragment)===null||n===void 0?void 0:n[0])!=="/")return;for(let a of e.fragment.slice(1).split("/")){if(typeof r=="boolean")return;let c=r[(0,Mf.unescapeFragment)(a)];if(c===void 0)return;r=c;let l=typeof r=="object"&&r[this.opts.schemaId];!A$.has(a)&&l&&(t=(0,He.resolveUrl)(this.opts.uriResolver,t,l))}let s;if(typeof r!="boolean"&&r.$ref&&!(0,Mf.schemaHasRulesButRef)(r,this.RULES)){let a=(0,He.resolveUrl)(this.opts.uriResolver,t,r.$ref);s=Rn.call(this,o,a)}let{schemaId:i}=this.opts;if(s=s||new fr({schema:r,schemaId:i,root:o,baseId:t}),s.schema!==s.root.schema)return s}});var Uf=b((G1,N$)=>{N$.exports={$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 Sa=b((J1,Gf)=>{"use strict";var j$=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),$a=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),Z$=RegExp.prototype.test.bind(/^\d*$/u),jt=RegExp.prototype.test.bind(/^[\da-f]{2}$/iu),xa=RegExp.prototype.test.bind(/^[\da-z\-._~]$/iu),Ff=RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:@/]$/u),ba=RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:@/?]$/u),q$=RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:]$/u),Te=new Array(256);{let e="0123456789ABCDEF";for(let t=0;t<256;t++)Te[t]="%"+e[t>>4]+e[t&15]}function xe(e){return e<2048?Te[192|e>>6]+Te[128|e&63]:e<65536?Te[224|e>>12]+Te[128|e>>6&63]+Te[128|e&63]:Te[240|e>>18]+Te[128|e>>12&63]+Te[128|e>>6&63]+Te[128|e&63]}function M$(e){let t="",r=0,o=0;for(o=0;o<e.length;o++)if(r=e[o].charCodeAt(0),r!==48){if(!(r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";t+=e[o];break}for(o+=1;o<e.length;o++){if(r=e[o].charCodeAt(0),!(r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";t+=e[o]}return t}var D$=RegExp.prototype.test.bind(/^[\dA-Fa-f]{1,4}$/),U$=RegExp.prototype.test.bind(/^[vV][\dA-Fa-f]+\.[A-Za-z\d\-._~!$&'()*+,;=:]+$/),L$=RegExp.prototype.test.bind(/^[A-Za-z\d\-._~]$/),F$=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function V$(e){if(e.length===0)return!1;for(let t=0;t<e.length;t++)if(!L$(e[t])){if(e[t]==="%"&&t+2<e.length&&jt(e.slice(t+1,t+3))){t+=2;continue}return!1}return!0}function Lf(e){let t=-1,r=0,o=-1,n=0;for(let a=0;a<e.length;a++)e[a]==="0"?(o===-1&&(o=a),n++,n>r&&(r=n,t=o)):(o=-1,n=0);if(r<2)return e.join(":");let s=e.slice(0,t).join(":"),i=e.slice(t+r).join(":");return s+"::"+i}function H$(e){let t=e.indexOf("::");if(t!==-1&&e.indexOf("::",t+1)!==-1)return;let r=t===-1?e.split(":"):e.slice(0,t).split(":"),o=t===-1?[]:e.slice(t+2).split(":");t!==-1&&(r.length===1&&r[0]===""&&(r.length=0),o.length===1&&o[0]===""&&(o.length=0));let n=r.concat(o),s=0;for(let a=0;a<n.length;a++){let c=n[a];if(c==="")return;if(c.indexOf(".")!==-1){if(a!==n.length-1||t!==-1&&o.length===0||!$a(c))return;s+=2;continue}if(!D$(c))return;n[a]=parseInt(c,16).toString(16),s++}if(t===-1)return s!==8?void 0:Lf(n);if(s>=8)return;let i=n.slice(0,r.length);for(let a=s;a<8;a++)i.push("0");for(let a=r.length;a<n.length;a++)i.push(n[a]);return Lf(i)}function wa(e){let t=e[0]==="["&&e[e.length-1]==="]";if((e[0]==="["||e[e.length-1]==="]")&&!t)return{host:e,isIPV6:!1,error:!0};let o=t?e.slice(1,-1):e;if(t&&U$(o))return o=o.toLowerCase(),{host:`[${o}]`,escapedHost:o,isIPV6:!1,isIPVFuture:!0};if(B$(o,":")<2)return{host:e,isIPV6:!1,error:t};let n="",s=o.indexOf("%");if(s!==-1){let a=o.slice(s,s+3).toLowerCase()==="%25"?3:1;if(n=o.slice(s+a),!V$(n))return{host:e,isIPV6:!1,error:!0};o=o.slice(0,s)}let i=H$(o);return i===void 0?{host:e,isIPV6:!1,error:!0}:{host:i+(n?"%"+n:""),escapedHost:i+(n?"%25"+n:""),isIPV6:!0}}function B$(e,t){let r=0;for(let o=0;o<e.length;o++)e[o]===t&&r++;return r}function Vf(e){let t=e,r=[],o=-1,n=0;for(;n=t.length;){if(n===1){if(t===".")break;if(t==="/"){r.push("/");break}else{r.push(t);break}}else if(n===2){if(t[0]==="."){if(t[1]===".")break;if(t[1]==="/"){t=t.slice(2);continue}}else if(t[0]==="/"&&(t[1]==="."||t[1]==="/")){r.push("/");break}}else if(n===3&&t==="/.."){r.length!==0&&r.pop(),r.push("/");break}if(t[0]==="."){if(t[1]==="."){if(t[2]==="/"){t=t.slice(3);continue}}else if(t[1]==="/"){t=t.slice(2);continue}}else if(t[0]==="/"&&t[1]==="."){if(t[2]==="/"){t=t.slice(2);continue}else if(t[2]==="."&&t[3]==="/"){t=t.slice(3),r.length!==0&&r.pop();continue}}if((o=t.indexOf("/",1))===-1){r.push(t);break}else r.push(t.slice(0,o)),t=t.slice(o)}return r.join("")}function K$(e){if(e===""||e[0]==="/")return Vf(e);let t=e.split("/"),r=t.length-1,o=[],n=!1;for(let s=0;s<=r;s++){let i=t[s];i==="."||i===".."?(i===".."&&(o.length!==0&&o[o.length-1]!==".."?o.pop():o.push("..")),n=s===r):o.push(i)}return n&&o[o.length-1]!==".."&&o.push(""),(o.length===0||o[0]===""||o[0].includes(":"))&&o.unshift("."),o.join("/")}var W$={"@":"%40","/":"%2F","?":"%3F","#":"%23",":":"%3A"},G$=/[@/?#:]/g,J$=/[@/?#]/g;function Hf(e,t){let r=t?J$:G$;return r.lastIndex=0,e.replace(r,o=>W$[o])}function Bf(e,t=!1){if(e.indexOf("%")===-1)return e;let r="";for(let o=0;o<e.length;o++){if(e[o]==="%"&&o+2<e.length){let n=e.slice(o+1,o+3);if(jt(n)){let s=n.toUpperCase(),i=String.fromCharCode(parseInt(s,16));t&&xa(i)?r+=i:r+="%"+s,o+=2;continue}}r+=e[o]}return r}function Q$(e){let t="";for(let r=0;r<e.length;r++){let o=e[r];if(o==="%"&&r+2<e.length){let n=e.slice(r+1,r+3);if(jt(n)){let s=n.toUpperCase(),i=String.fromCharCode(parseInt(s,16));i!=="."&&xa(i)?t+=i:t+="%"+s,r+=2;continue}}if(Ff(o))t+=o;else{let n=e.charCodeAt(r);if(n<128)t+=Wf(n)?o:Te[n];else if(n<55296||n>57343)t+=xe(n);else if(n<=56319&&r+1<e.length){let s=e.charCodeAt(r+1);s>=56320&&s<=57343?(t+=xe(65536+(n-55296<<10)+(s-56320)),r++):t+=xe(65533)}else t+=xe(65533)}}return t}function Y$(e,t=!1){let r="",o=t&&e[0]!=="/";for(let n=0;n<e.length;n++){let s=e[n];if(s==="%"&&n+2<e.length){let i=e.slice(n+1,n+3);if(jt(i)){r+="%"+i.toUpperCase(),n+=2;continue}}if(s==="/"&&(o=!1),Ff(s)&&(s!==":"||!o))r+=s;else{let i=e.charCodeAt(n);if(i<128)r+=Te[i];else if(i<55296||i>57343)r+=xe(i);else if(i<=56319&&n+1<e.length){let a=e.charCodeAt(n+1);a>=56320&&a<=57343?(r+=xe(65536+(i-55296<<10)+(a-56320)),n++):r+=xe(65533)}else r+=xe(65533)}}return r}function za(e,t){let r="";for(let o=0;o<e.length;o++){let n=e[o];if(n==="%"&&o+2<e.length){let s=e.slice(o+1,o+3);if(jt(s)){r+="%"+s.toUpperCase(),o+=2;continue}}if(t(n))r+=n;else{let s=e.charCodeAt(o);if(s<128)r+=Te[s];else if(s<55296||s>57343)r+=xe(s);else if(s<=56319&&o+1<e.length){let i=e.charCodeAt(o+1);i>=56320&&i<=57343?(r+=xe(65536+(s-55296<<10)+(i-56320)),o++):r+=xe(65533)}else r+=xe(65533)}}return r}function Kf(e){return za(e,q$)}function X$(e){return za(e,ba)}function ex(e){return za(e,ba)}function Wf(e){return e>=48&&e<=57||e>=65&&e<=90||e>=97&&e<=122||e===42||e===43||e===45||e===46||e===47||e===64||e===95}function tx(e){let t="";for(let r=0;r<e.length;r++){let o=e[r];if(o==="%"&&r+2<e.length){let n=e.slice(r+1,r+3);if(jt(n)){let s=n.toUpperCase(),i=String.fromCharCode(parseInt(s,16));xa(i)?t+=i:t+="%"+s,r+=2;continue}}if(ba(o))t+=o;else{let n=e.charCodeAt(r);if(n<128)t+=Wf(n)?o:Te[n];else if(n<55296||n>57343)t+=xe(n);else if(n<=56319&&r+1<e.length){let s=e.charCodeAt(r+1);s>=56320&&s<=57343?(t+=xe(65536+(n-55296<<10)+(s-56320)),r++):t+=xe(65533)}else t+=xe(65533)}}return t}function rx(e){let t="";for(let r=0;r<e.length;r++){if(e[r]==="%"&&r+2<e.length){let o=e.slice(r+1,r+3);if(jt(o)){t+="%"+o.toUpperCase(),r+=2;continue}}t+=escape(e[r])}return t}function ox(e){let t=[];if(e.userinfo!==void 0&&(t.push(Kf(e.userinfo)),t.push("@")),e.host!==void 0){let r=e.host;if(!$a(r)){let o=wa(r);o.isIPV6!==!0&&o.isIPVFuture!==!0&&(r=Bf(r,!0),o=wa(r)),o.isIPV6===!0||o.isIPVFuture===!0?r=`[${o.escapedHost}]`:r=Hf(r,!1)}t.push(r)}if(typeof e.port=="number"||typeof e.port=="string"){let r=String(e.port);if(!Z$(r))throw new TypeError("URI port is malformed.");t.push(":"),t.push(r)}return t.length?t.join(""):void 0}Gf.exports={nonSimpleDomain:F$,recomposeAuthority:ox,reescapeHostDelimiters:Hf,normalizePercentEncoding:Bf,normalizePathEncoding:Q$,serializePathEncoding:Y$,normalizeQueryFragmentEncoding:tx,encodeUserinfo:Kf,encodeQuery:X$,encodeFragment:ex,escapePreservingEscapes:rx,removeDotSegments:Vf,removeDotSegmentsRelative:K$,isIPv4:$a,isUUID:j$,normalizeIPv6:wa,stringArrayToHexStripped:M$}});var em=b((Q1,Xf)=>{"use strict";var{isUUID:nx}=Sa(),sx=/^([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-./:;=@]|%[\da-f]{2})+)$/iu,ix=["http","https","ws","wss","urn","urn:uuid"];function ax(e){return ix.indexOf(e)!==-1}function ka(e){return e.secure===!0?!0:e.secure===!1?!1:e.scheme?e.scheme.length===3&&(e.scheme[0]==="w"||e.scheme[0]==="W")&&(e.scheme[1]==="s"||e.scheme[1]==="S")&&(e.scheme[2]==="s"||e.scheme[2]==="S"):!1}function Jf(e){return e.host||(e.error=e.error||"HTTP URIs must have a host."),e}function Qf(e){let t=String(e.scheme).toLowerCase()==="https";return(e.port===(t?443:80)||e.port==="")&&(e.port=void 0),e.path||(e.path="/"),e}function cx(e){return e.secure=ka(e),e.resourceName=(e.path||"/")+(e.query?"?"+e.query:""),e.path=void 0,e.query=void 0,e}function ux(e){if((e.port===(ka(e)?443:80)||e.port==="")&&(e.port=void 0),typeof e.secure=="boolean"&&(e.scheme=e.secure?"wss":"ws",e.secure=void 0),e.resourceName){let t=e.resourceName.indexOf("?"),r=t===-1?e.resourceName:e.resourceName.slice(0,t);e.path=r&&r!=="/"?r:void 0,e.query=t===-1?void 0:e.resourceName.slice(t+1),e.resourceName=void 0}return e.fragment=void 0,e}function lx(e,t){if(!e.path)return e.error="URN can not be parsed",e;let r=e.path.match(sx);if(r&&r[0]===e.path){let o=t.scheme||e.scheme||"urn";e.nid=r[1].toLowerCase(),e.nss=r[2];let n=`${o}:${t.nid||e.nid}`,s=Pa(n);e.path=void 0,s&&(e=s.parse(e,t))}else e.error=e.error||"URN can not be parsed.";return e}function dx(e,t){if(e.nid===void 0)throw new Error("URN without nid cannot be serialized");let r=t.scheme||e.scheme||"urn",o=e.nid.toLowerCase(),n=`${r}:${t.nid||o}`,s=Pa(n);s&&(e=s.serialize(e,t));let i=e,a=e.nss;return i.path=`${o||t.nid}:${a}`,t.skipEscape=!0,i}function px(e,t){let r=e;return r.uuid=r.nss,r.nss=void 0,!t.tolerant&&(!r.uuid||!nx(r.uuid))&&(r.error=r.error||"UUID is not valid."),r}function fx(e){let t=e;return t.nss=(e.uuid||"").toLowerCase(),t}var Yf={scheme:"http",domainHost:!0,parse:Jf,serialize:Qf},mx={scheme:"https",domainHost:Yf.domainHost,parse:Jf,serialize:Qf},On={scheme:"ws",domainHost:!0,parse:cx,serialize:ux},hx={scheme:"wss",domainHost:On.domainHost,parse:On.parse,serialize:On.serialize},gx={scheme:"urn",parse:lx,serialize:dx,skipNormalize:!0},_x={scheme:"urn:uuid",parse:px,serialize:fx,skipNormalize:!0},Cn={http:Yf,https:mx,ws:On,wss:hx,urn:gx,"urn:uuid":_x};Object.setPrototypeOf(Cn,null);function Pa(e){return e&&(Cn[e]||Cn[e.toLowerCase()])||void 0}Xf.exports={wsIsSecure:ka,SCHEMES:Cn,isValidSchemeName:ax,getSchemeHandler:Pa}});var hm=b((Y1,qn)=>{"use strict";var{normalizeIPv6:sm,removeDotSegments:ao,removeDotSegmentsRelative:im,recomposeAuthority:yx,normalizePercentEncoding:Ea,normalizePathEncoding:vx,serializePathEncoding:tm,normalizeQueryFragmentEncoding:rm,encodeQuery:wx,encodeFragment:$x,reescapeHostDelimiters:xx,isIPv4:am,nonSimpleDomain:bx}=Sa(),{SCHEMES:cm,getSchemeHandler:Ta}=em(),um=/^[A-Za-z][A-Za-z0-9+.-]*$/u,lm="URI scheme is malformed.",An="URI host is malformed.",zx=/[\0-\x20"#/:<>?@[\\\]^`{|}\x7F]/u;function om(e){let t=String(e);if(!um.test(t))throw new TypeError(lm);return t}function Sx(e,t){return typeof e=="string"?e=Ax(e,t):typeof e=="object"&&(e=jn(Zt(e,t),t)),e}function kx(e,t,r){let o=r?Object.assign({scheme:"null"},r):{scheme:"null"},{parsed:n,malformedAuthorityOrPort:s,malformedPercentEncoding:i,malformedSchemeSpecific:a,malformedHost:c,malformedScheme:l}=Nn(e,o),{parsed:u,malformedAuthorityOrPort:d,malformedPercentEncoding:m,malformedSchemeSpecific:f,malformedHost:g,malformedScheme:h}=Nn(t,o);if(s||d||i||m||a||f||c||g||l||h)throw new Error(n.error||u.error||"URI is malformed.");let _=dm(n,u,o,!0),w=Ta(r&&r.scheme||_.scheme),$=_.host,x=$!==void 0&&$!==""&&(am($)||sm($).isIPV6);if(fm(_,r||{},w,x))throw new Error(An);pm(_,r||{},w,x);let T=$&&$.indexOf("%")!==-1&&!new RegExp("\\P{ASCII}","u").test($);if(_.error&&!T)throw new Error(_.error);return o.skipEscape=!0,Zt(_,o)}function dm(e,t,r,o){let n={};if(o||(e=jn(Zt(e,r),r),t=jn(Zt(t,r),r)),r=r||{},!r.tolerant&&t.scheme)n.scheme=t.scheme,n.userinfo=t.userinfo,n.host=t.host,n.port=t.port,n.path=ao(t.path||""),n.query=t.query;else{if(t.userinfo!==void 0||t.host!==void 0||t.port!==void 0)n.userinfo=t.userinfo,n.host=t.host,n.port=t.port,n.path=ao(t.path||""),n.query=t.query;else{if(!t.path)n.path=e.path,t.query!==void 0?n.query=t.query:n.query=e.query;else{if(t.path[0]==="/")n.path=ao(t.path);else{let s=e.userinfo!==void 0||e.host!==void 0||e.port!==void 0;s&&!e.path?n.path="/"+t.path:e.path?n.path=e.path.slice(0,e.path.lastIndexOf("/")+1)+t.path:n.path=t.path,n.path=e.scheme===void 0&&!s&&n.path[0]!=="/"?im(n.path):ao(n.path)}n.query=t.query}n.userinfo=e.userinfo,n.host=e.host,n.port=e.port}n.scheme=e.scheme}return n.fragment=t.fragment,n}function Px(e,t,r){let o=nm(e,r),n=nm(t,r);return o!==void 0&&n!==void 0&&o===n}function Zt(e,t){let r={host:e.host,scheme:e.scheme,userinfo:e.userinfo,port:e.port,path:e.path,query:e.query,nid:e.nid,nss:e.nss,uuid:e.uuid,fragment:e.fragment,reference:e.reference,resourceName:e.resourceName,secure:e.secure,error:""},o=Object.assign({},t),n=[];r.scheme&&(r.scheme=om(r.scheme));let s=Ta(o.scheme||r.scheme);s&&s.serialize&&s.serialize(r,o);let i=r.userinfo!==void 0||r.host!==void 0||r.port!==void 0,a=(r.scheme===void 0||o.reference==="suffix")&&!i,c=!o.skipEscape&&a;r.path!==void 0&&(o.skipEscape?r.path=Ea(r.path):r.path=tm(r.path,c)),o.reference!=="suffix"&&r.scheme&&(r.scheme=om(r.scheme),n.push(r.scheme,":"));let l=yx(r);if(l!==void 0&&(o.reference!=="suffix"&&n.push("//"),n.push(l),r.path&&r.path[0]!=="/"&&n.push("/")),r.path!==void 0){let u=r.path;!o.absolutePath&&(!s||!s.absolutePath)&&(u=a&&u[0]!=="/"?im(u):ao(u)),a&&(u=tm(u,!0)),l===void 0&&u[0]==="/"&&u[1]==="/"&&(u="/%2F"+u.slice(2)),n.push(u)}return r.query!==void 0&&n.push("?",wx(r.query)),r.fragment!==void 0&&n.push("#",$x(r.fragment)),n.join("")}var Ex=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u,Tx=/^(?:[^#/:?]+:)?\/\/([^/?#]*)/,Rx=/^(?:[^#/:?]+:)?([/\\\t\n\r]*)/;function Ix(e,t){if(t[2]!==void 0&&e.path&&e.path[0]!=="/")return'URI path must start with "/" when authority is present.';if(typeof e.port=="number"&&(e.port<0||e.port>65535))return"URI port is malformed."}function io(e){if(e===void 0)return!1;let t=e.indexOf("%");for(;t!==-1;){if(t+2>=e.length||!/^[\da-f]{2}$/iu.test(e.slice(t+1,t+3)))return!0;t=e.indexOf("%",t+3)}return!1}function Zn(e){return e[0]==="["&&e[e.length-1]==="]"}function Ox(e){let t=e[4];return io(e[3])||t!==void 0&&!Zn(t)&&io(t)||io(e[6])||io(e[7])||io(e[8])}function pm(e,t,r,o){if(fm(e,t,r,o))return e.error=e.error||An,!0;if(!t.unicodeSupport&&(!r||!r.unicodeSupport)&&e.host&&!Zn(e.host)&&(t.domainHost||r&&r.domainHost)&&o===!1&&bx(e.host)){let n;try{n=new URL("http://"+e.host)}catch(s){return e.error=e.error||"Host's domain name can not be converted to ASCII: "+s,!0}if(!Cx(n))return e.error=e.error||An,!0;e.host=n.hostname}return!1}function fm(e,t,r,o){return!!(e.host&&o===!1&&!Zn(e.host)&&(t.domainHost||r&&r.domainHost)&&zx.test(e.host))}function Cx(e){return e.username===""&&e.password===""&&e.port===""&&e.pathname==="/"&&e.search===""&&e.hash===""&&e.hostname!==""}function Nn(e,t){let r=Object.assign({},t),o={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0},n=!1,s=!1,i=!1,a=!1,c=!1,l=!1,u=!1;r.reference==="suffix"&&(r.scheme?e=r.scheme+":"+e:e="//"+e);let d=e.match(Tx);d!==null&&d[1].indexOf("\\")!==-1&&(o.error="URI authority must not contain a literal backslash.",n=!0);let m=e.match(Rx);if(m!==null){let g=m[1],h=g.replace(/[\t\n\r]/g,"");h.length>=2&&(h.slice(0,2)!=="//"?(o.error=o.error||"URI authority must not contain a literal backslash.",n=!0):g.length!==h.length&&(o.error=o.error||"URI authority introducer must not contain whitespace.",n=!0))}let f=e.match(Ex);if(f){o.scheme=f[1],o.userinfo=f[3],o.host=f[4],o.port=parseInt(f[5],10),o.path=f[6]||"",o.query=f[7],o.fragment=f[8],o.scheme!==void 0&&(um.test(o.scheme)?o.scheme=o.scheme.toLowerCase():(o.error=o.error||lm,l=!0)),s=Ox(f),s&&(o.error=o.error||"URI contains malformed percent-encoding."),isNaN(o.port)&&(o.port=f[5]);let g=Ix(o,f);if(g!==void 0&&(o.error=o.error||g,n=!0),o.host)if(am(o.host)===!1){let w=Zn(o.host),$=o.host.indexOf("[")!==-1||o.host.indexOf("]")!==-1,x=sm(o.host);u=x.isIPV6||x.isIPVFuture===!0,c=$&&(!w||x.error===!0),o.host=u?x.host:x.host.toLowerCase(),c&&(o.error=o.error||An,n=!0)}else u=!0;o.scheme===void 0&&o.userinfo===void 0&&o.host===void 0&&o.port===void 0&&o.query===void 0&&!o.path?o.reference="same-document":o.scheme===void 0?o.reference="relative":o.fragment===void 0?o.reference="absolute":o.reference="uri",r.reference&&r.reference!=="suffix"&&r.reference!==o.reference&&(o.error=o.error||"URI is not a "+r.reference+" reference.");let h=Ta(r.scheme||o.scheme);if(c||(a=pm(o,r,h,u)),e.indexOf("%")!==-1&&o.host!==void 0&&!c){let _=u?o.host:Ea(o.host,!0);u||(_=Ea(_.toLowerCase())),o.host=u||r.scheme!=="null"?xx(_,u):_}(!h||h&&!h.skipNormalize)&&(o.path&&(o.path=vx(o.path)),o.query&&(o.query=rm(o.query)),o.fragment&&(o.fragment=rm(o.fragment))),h&&h.parse&&(h.parse(o,r),h===cm.urn&&o.nid===void 0&&(i=!0))}else o.error=o.error||"URI can not be parsed.";return{parsed:o,malformedAuthorityOrPort:n,malformedPercentEncoding:s,malformedSchemeSpecific:i,malformedHost:a,malformedScheme:l}}function jn(e,t){return Nn(e,t).parsed}function Ax(e,t){return mm(e,t).normalized}function mm(e,t){let{parsed:r,malformedAuthorityOrPort:o,malformedPercentEncoding:n,malformedSchemeSpecific:s,malformedHost:i,malformedScheme:a}=Nn(e,t);return{normalized:o||n||s||i||a?e:Zt(r,t),malformedAuthorityOrPort:o,malformedPercentEncoding:n,malformedSchemeSpecific:s,malformedHost:i,malformedScheme:a}}function nm(e,t){if(typeof e!="string"&&typeof e!="object")return;let r;try{r=typeof e=="string"?e:Zt(e,t)}catch{return}let{normalized:o,malformedAuthorityOrPort:n,malformedPercentEncoding:s,malformedSchemeSpecific:i,malformedHost:a,malformedScheme:c}=mm(r,t);return n||s||i||a||c?void 0:o}var Ra={SCHEMES:cm,normalize:Sx,resolve:kx,resolveComponent:dm,equal:Px,serialize:Zt,parse:jn};qn.exports=Ra;qn.exports.default=Ra;qn.exports.fastUri=Ra});var _m=b(Ia=>{"use strict";Object.defineProperty(Ia,"__esModule",{value:!0});var gm=hm();gm.code='require("ajv/dist/runtime/uri").default';Ia.default=gm});var Sm=b(he=>{"use strict";Object.defineProperty(he,"__esModule",{value:!0});he.CodeGen=he.Name=he.nil=he.stringify=he.str=he._=he.KeywordCxt=void 0;var Nx=no();Object.defineProperty(he,"KeywordCxt",{enumerable:!0,get:function(){return Nx.KeywordCxt}});var mr=j();Object.defineProperty(he,"_",{enumerable:!0,get:function(){return mr._}});Object.defineProperty(he,"str",{enumerable:!0,get:function(){return mr.str}});Object.defineProperty(he,"stringify",{enumerable:!0,get:function(){return mr.stringify}});Object.defineProperty(he,"nil",{enumerable:!0,get:function(){return mr.nil}});Object.defineProperty(he,"Name",{enumerable:!0,get:function(){return mr.Name}});Object.defineProperty(he,"CodeGen",{enumerable:!0,get:function(){return mr.CodeGen}});var jx=Tn(),xm=so(),Zx=ea(),co=In(),qx=j(),uo=to(),Mn=eo(),Ca=U(),ym=Uf(),Mx=_m(),bm=(e,t)=>new RegExp(e,t);bm.code="new RegExp";var Dx=["removeAdditional","useDefaults","coerceTypes"],Ux=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),Lx={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."},Fx={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},vm=200;function Vx(e){var t,r,o,n,s,i,a,c,l,u,d,m,f,g,h,_,w,$,x,T,v,z,C,J,M;let ue=e.strict,Kt=(t=e.code)===null||t===void 0?void 0:t.optimize,Sr=Kt===!0||Kt===void 0?1:Kt||0,jo=(o=(r=e.code)===null||r===void 0?void 0:r.regExp)!==null&&o!==void 0?o:bm,ut=(n=e.uriResolver)!==null&&n!==void 0?n:Mx.default;return{strictSchema:(i=(s=e.strictSchema)!==null&&s!==void 0?s:ue)!==null&&i!==void 0?i:!0,strictNumbers:(c=(a=e.strictNumbers)!==null&&a!==void 0?a:ue)!==null&&c!==void 0?c:!0,strictTypes:(u=(l=e.strictTypes)!==null&&l!==void 0?l:ue)!==null&&u!==void 0?u:"log",strictTuples:(m=(d=e.strictTuples)!==null&&d!==void 0?d:ue)!==null&&m!==void 0?m:"log",strictRequired:(g=(f=e.strictRequired)!==null&&f!==void 0?f:ue)!==null&&g!==void 0?g:!1,code:e.code?{...e.code,optimize:Sr,regExp:jo}:{optimize:Sr,regExp:jo},loopRequired:(h=e.loopRequired)!==null&&h!==void 0?h:vm,loopEnum:(_=e.loopEnum)!==null&&_!==void 0?_:vm,meta:(w=e.meta)!==null&&w!==void 0?w:!0,messages:($=e.messages)!==null&&$!==void 0?$:!0,inlineRefs:(x=e.inlineRefs)!==null&&x!==void 0?x:!0,schemaId:(T=e.schemaId)!==null&&T!==void 0?T:"$id",addUsedSchema:(v=e.addUsedSchema)!==null&&v!==void 0?v:!0,validateSchema:(z=e.validateSchema)!==null&&z!==void 0?z:!0,validateFormats:(C=e.validateFormats)!==null&&C!==void 0?C:!0,unicodeRegExp:(J=e.unicodeRegExp)!==null&&J!==void 0?J:!0,int32range:(M=e.int32range)!==null&&M!==void 0?M:!0,uriResolver:ut}}var lo=class{constructor(t={}){this.schemas={},this.refs={},this.formats=Object.create(null),this._compilations=new Set,this._loading={},this._cache=new Map,t=this.opts={...t,...Vx(t)};let{es5:r,lines:o}=this.opts.code;this.scope=new qx.ValueScope({scope:{},prefixes:Ux,es5:r,lines:o}),this.logger=Jx(t.logger);let n=t.validateFormats;t.validateFormats=!1,this.RULES=(0,Zx.getRules)(),wm.call(this,Lx,t,"NOT SUPPORTED"),wm.call(this,Fx,t,"DEPRECATED","warn"),this._metaOpts=Wx.call(this),t.formats&&Bx.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),t.keywords&&Kx.call(this,t.keywords),typeof t.meta=="object"&&this.addMetaSchema(t.meta),Hx.call(this),t.validateFormats=n}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:t,meta:r,schemaId:o}=this.opts,n=ym;o==="id"&&(n={...ym},n.id=n.$id,delete n.$id),r&&t&&this.addMetaSchema(n,n[o],!1)}defaultMeta(){let{meta:t,schemaId:r}=this.opts;return this.opts.defaultMeta=typeof t=="object"?t[r]||t:void 0}validate(t,r){let o;if(typeof t=="string"){if(o=this.getSchema(t),!o)throw new Error(`no schema with key or ref "${t}"`)}else o=this.compile(t);let n=o(r);return"$async"in o||(this.errors=o.errors),n}compile(t,r){let o=this._addSchema(t,r);return o.validate||this._compileSchemaEnv(o)}compileAsync(t,r){if(typeof this.opts.loadSchema!="function")throw new Error("options.loadSchema should be a function");let{loadSchema:o}=this.opts;return n.call(this,t,r);async function n(u,d){await s.call(this,u.$schema);let m=this._addSchema(u,d);return m.validate||i.call(this,m)}async function s(u){u&&!this.getSchema(u)&&await n.call(this,{$ref:u},!0)}async function i(u){try{return this._compileSchemaEnv(u)}catch(d){if(!(d instanceof xm.default))throw d;return a.call(this,d),await c.call(this,d.missingSchema),i.call(this,u)}}function a({missingSchema:u,missingRef:d}){if(this.refs[u])throw new Error(`AnySchema ${u} is loaded but ${d} cannot be resolved`)}async function c(u){let d=await l.call(this,u);this.refs[u]||await s.call(this,d.$schema),this.refs[u]||this.addSchema(d,u,r)}async function l(u){let d=this._loading[u];if(d)return d;try{return await(this._loading[u]=o(u))}finally{delete this._loading[u]}}}addSchema(t,r,o,n=this.opts.validateSchema){if(Array.isArray(t)){for(let i of t)this.addSchema(i,void 0,o,n);return this}let s;if(typeof t=="object"){let{schemaId:i}=this.opts;if(s=t[i],s!==void 0&&typeof s!="string")throw new Error(`schema ${i} must be string`)}return r=(0,uo.normalizeId)(r||s),this._checkUnique(r),this.schemas[r]=this._addSchema(t,o,r,n,!0),this}addMetaSchema(t,r,o=this.opts.validateSchema){return this.addSchema(t,r,!0,o),this}validateSchema(t,r){if(typeof t=="boolean")return!0;let o;if(o=t.$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;let n=this.validate(o,t);if(!n&&r){let s="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(s);else throw new Error(s)}return n}getSchema(t){let r;for(;typeof(r=$m.call(this,t))=="string";)t=r;if(r===void 0){let{schemaId:o}=this.opts,n=new co.SchemaEnv({schema:{},schemaId:o});if(r=co.resolveSchema.call(this,n,t),!r)return;this.refs[t]=r}return r.validate||this._compileSchemaEnv(r)}removeSchema(t){if(t instanceof RegExp)return this._removeAllSchemas(this.schemas,t),this._removeAllSchemas(this.refs,t),this;switch(typeof t){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{let r=$m.call(this,t);return typeof r=="object"&&this._cache.delete(r.schema),delete this.schemas[t],delete this.refs[t],this}case"object":{let r=t;this._cache.delete(r);let o=t[this.opts.schemaId];return o&&(o=(0,uo.normalizeId)(o),delete this.schemas[o],delete this.refs[o]),this}default:throw new Error("ajv.removeSchema: invalid parameter")}}addVocabulary(t){for(let r of t)this.addKeyword(r);return this}addKeyword(t,r){let o;if(typeof t=="string")o=t,typeof r=="object"&&(this.logger.warn("these parameters are deprecated, see docs for addKeyword"),r.keyword=o);else if(typeof t=="object"&&r===void 0){if(r=t,o=r.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(Yx.call(this,o,r),!r)return(0,Ca.eachItem)(o,s=>Oa.call(this,s)),this;eb.call(this,r);let n={...r,type:(0,Mn.getJSONTypes)(r.type),schemaType:(0,Mn.getJSONTypes)(r.schemaType)};return(0,Ca.eachItem)(o,n.type.length===0?s=>Oa.call(this,s,n):s=>n.type.forEach(i=>Oa.call(this,s,n,i))),this}getKeyword(t){let r=this.RULES.all[t];return typeof r=="object"?r.definition:!!r}removeKeyword(t){let{RULES:r}=this;delete r.keywords[t],delete r.all[t];for(let o of r.rules){let n=o.rules.findIndex(s=>s.keyword===t);n>=0&&o.rules.splice(n,1)}return this}addFormat(t,r){return typeof r=="string"&&(r=new RegExp(r)),this.formats[t]=r,this}errorsText(t=this.errors,{separator:r=", ",dataVar:o="data"}={}){return!t||t.length===0?"No errors":t.map(n=>`${o}${n.instancePath} ${n.message}`).reduce((n,s)=>n+r+s)}$dataMetaSchema(t,r){let o=this.RULES.all;t=JSON.parse(JSON.stringify(t));for(let n of r){let s=n.split("/").slice(1),i=t;for(let a of s)i=i[a];for(let a in o){let c=o[a];if(typeof c!="object")continue;let{$data:l}=c.definition,u=i[a];l&&u&&(i[a]=zm(u))}}return t}_removeAllSchemas(t,r){for(let o in t){let n=t[o];(!r||r.test(o))&&(typeof n=="string"?delete t[o]:n&&!n.meta&&(this._cache.delete(n.schema),delete t[o]))}}_addSchema(t,r,o,n=this.opts.validateSchema,s=this.opts.addUsedSchema){let i,{schemaId:a}=this.opts;if(typeof t=="object")i=t[a];else{if(this.opts.jtd)throw new Error("schema must be object");if(typeof t!="boolean")throw new Error("schema must be object or boolean")}let c=this._cache.get(t);if(c!==void 0)return c;o=(0,uo.normalizeId)(i||o);let l=uo.getSchemaRefs.call(this,t,o);return c=new co.SchemaEnv({schema:t,schemaId:a,meta:r,baseId:o,localRefs:l}),this._cache.set(c.schema,c),s&&!o.startsWith("#")&&(o&&this._checkUnique(o),this.refs[o]=c),n&&this.validateSchema(t,!0),c}_checkUnique(t){if(this.schemas[t]||this.refs[t])throw new Error(`schema with key or id "${t}" already exists`)}_compileSchemaEnv(t){if(t.meta?this._compileMetaSchema(t):co.compileSchema.call(this,t),!t.validate)throw new Error("ajv implementation error");return t.validate}_compileMetaSchema(t){let r=this.opts;this.opts=this._metaOpts;try{co.compileSchema.call(this,t)}finally{this.opts=r}}};lo.ValidationError=jx.default;lo.MissingRefError=xm.default;he.default=lo;function wm(e,t,r,o="error"){for(let n in e){let s=n;s in t&&this.logger[o](`${r}: option ${n}. ${e[s]}`)}}function $m(e){return e=(0,uo.normalizeId)(e),this.schemas[e]||this.refs[e]}function Hx(){let e=this.opts.schemas;if(e)if(Array.isArray(e))this.addSchema(e);else for(let t in e)this.addSchema(e[t],t)}function Bx(){for(let e in this.opts.formats){let t=this.opts.formats[e];t&&this.addFormat(e,t)}}function Kx(e){if(Array.isArray(e)){this.addVocabulary(e);return}this.logger.warn("keywords option as map is deprecated, pass array");for(let t in e){let r=e[t];r.keyword||(r.keyword=t),this.addKeyword(r)}}function Wx(){let e={...this.opts};for(let t of Dx)delete e[t];return e}var Gx={log(){},warn(){},error(){}};function Jx(e){if(e===!1)return Gx;if(e===void 0)return console;if(e.log&&e.warn&&e.error)return e;throw new Error("logger must implement log, warn and error methods")}var Qx=/^[a-z_$][a-z0-9_$:-]*$/i;function Yx(e,t){let{RULES:r}=this;if((0,Ca.eachItem)(e,o=>{if(r.keywords[o])throw new Error(`Keyword ${o} is already defined`);if(!Qx.test(o))throw new Error(`Keyword ${o} has invalid name`)}),!!t&&t.$data&&!("code"in t||"validate"in t))throw new Error('$data keyword must have "code" or "validate" function')}function Oa(e,t,r){var o;let n=t?.post;if(r&&n)throw new Error('keyword with "post" flag cannot have "type"');let{RULES:s}=this,i=n?s.post:s.rules.find(({type:c})=>c===r);if(i||(i={type:r,rules:[]},s.rules.push(i)),s.keywords[e]=!0,!t)return;let a={keyword:e,definition:{...t,type:(0,Mn.getJSONTypes)(t.type),schemaType:(0,Mn.getJSONTypes)(t.schemaType)}};t.before?Xx.call(this,i,a,t.before):i.rules.push(a),s.all[e]=a,(o=t.implements)===null||o===void 0||o.forEach(c=>this.addKeyword(c))}function Xx(e,t,r){let o=e.rules.findIndex(n=>n.keyword===r);o>=0?e.rules.splice(o,0,t):(e.rules.push(t),this.logger.warn(`rule ${r} is not defined`))}function eb(e){let{metaSchema:t}=e;t!==void 0&&(e.$data&&this.opts.$data&&(t=zm(t)),e.validateSchema=this.compile(t,!0))}var tb={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function zm(e){return{anyOf:[e,tb]}}});var km=b(Aa=>{"use strict";Object.defineProperty(Aa,"__esModule",{value:!0});var rb={keyword:"id",code(){throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};Aa.default=rb});var Rm=b(qt=>{"use strict";Object.defineProperty(qt,"__esModule",{value:!0});qt.callRef=qt.getValidate=void 0;var ob=so(),Pm=je(),Re=j(),hr=st(),Em=In(),Dn=U(),nb={keyword:"$ref",schemaType:"string",code(e){let{gen:t,schema:r,it:o}=e,{baseId:n,schemaEnv:s,validateName:i,opts:a,self:c}=o,{root:l}=s;if((r==="#"||r==="#/")&&n===l.baseId)return d();let u=Em.resolveRef.call(c,l,n,r);if(u===void 0)throw new ob.default(o.opts.uriResolver,n,r);if(u instanceof Em.SchemaEnv)return m(u);return f(u);function d(){if(s===l)return Un(e,i,s,s.$async);let g=t.scopeValue("root",{ref:l});return Un(e,(0,Re._)`${g}.validate`,l,l.$async)}function m(g){let h=Tm(e,g);Un(e,h,g,g.$async)}function f(g){let h=t.scopeValue("schema",a.code.source===!0?{ref:g,code:(0,Re.stringify)(g)}:{ref:g}),_=t.name("valid"),w=e.subschema({schema:g,dataTypes:[],schemaPath:Re.nil,topSchemaRef:h,errSchemaPath:r},_);e.mergeEvaluated(w),e.ok(_)}}};function Tm(e,t){let{gen:r}=e;return t.validate?r.scopeValue("validate",{ref:t.validate}):(0,Re._)`${r.scopeValue("wrapper",{ref:t})}.validate`}qt.getValidate=Tm;function Un(e,t,r,o){let{gen:n,it:s}=e,{allErrors:i,schemaEnv:a,opts:c}=s,l=c.passContext?hr.default.this:Re.nil;o?u():d();function u(){if(!a.$async)throw new Error("async schema referenced by sync schema");let g=n.let("valid");n.try(()=>{n.code((0,Re._)`await ${(0,Pm.callValidateCode)(e,t,l)}`),f(t),i||n.assign(g,!0)},h=>{n.if((0,Re._)`!(${h} instanceof ${s.ValidationError})`,()=>n.throw(h)),m(h),i||n.assign(g,!1)}),e.ok(g)}function d(){e.result((0,Pm.callValidateCode)(e,t,l),()=>f(t),()=>m(t))}function m(g){let h=(0,Re._)`${g}.errors`;n.assign(hr.default.vErrors,(0,Re._)`${hr.default.vErrors} === null ? ${h} : ${hr.default.vErrors}.concat(${h})`),n.assign(hr.default.errors,(0,Re._)`${hr.default.vErrors}.length`)}function f(g){var h;if(!s.opts.unevaluated)return;let _=(h=r?.validate)===null||h===void 0?void 0:h.evaluated;if(s.props!==!0)if(_&&!_.dynamicProps)_.props!==void 0&&(s.props=Dn.mergeEvaluated.props(n,_.props,s.props));else{let w=n.var("props",(0,Re._)`${g}.evaluated.props`);s.props=Dn.mergeEvaluated.props(n,w,s.props,Re.Name)}if(s.items!==!0)if(_&&!_.dynamicItems)_.items!==void 0&&(s.items=Dn.mergeEvaluated.items(n,_.items,s.items));else{let w=n.var("items",(0,Re._)`${g}.evaluated.items`);s.items=Dn.mergeEvaluated.items(n,w,s.items,Re.Name)}}}qt.callRef=Un;qt.default=nb});var Im=b(Na=>{"use strict";Object.defineProperty(Na,"__esModule",{value:!0});var sb=km(),ib=Rm(),ab=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",sb.default,ib.default];Na.default=ab});var Om=b(ja=>{"use strict";Object.defineProperty(ja,"__esModule",{value:!0});var Ln=j(),wt=Ln.operators,Fn={maximum:{okStr:"<=",ok:wt.LTE,fail:wt.GT},minimum:{okStr:">=",ok:wt.GTE,fail:wt.LT},exclusiveMaximum:{okStr:"<",ok:wt.LT,fail:wt.GTE},exclusiveMinimum:{okStr:">",ok:wt.GT,fail:wt.LTE}},cb={message:({keyword:e,schemaCode:t})=>(0,Ln.str)`must be ${Fn[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>(0,Ln._)`{comparison: ${Fn[e].okStr}, limit: ${t}}`},ub={keyword:Object.keys(Fn),type:"number",schemaType:"number",$data:!0,error:cb,code(e){let{keyword:t,data:r,schemaCode:o}=e;e.fail$data((0,Ln._)`${r} ${Fn[t].fail} ${o} || isNaN(${r})`)}};ja.default=ub});var Cm=b(Za=>{"use strict";Object.defineProperty(Za,"__esModule",{value:!0});var po=j(),lb={message:({schemaCode:e})=>(0,po.str)`must be multiple of ${e}`,params:({schemaCode:e})=>(0,po._)`{multipleOf: ${e}}`},db={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:lb,code(e){let{gen:t,data:r,schemaCode:o,it:n}=e,s=n.opts.multipleOfPrecision,i=t.let("res"),a=s?(0,po._)`Math.abs(Math.round(${i}) - ${i}) > 1e-${s}`:(0,po._)`${i} !== parseInt(${i})`;e.fail$data((0,po._)`(${o} === 0 || (${i} = ${r}/${o}, ${a}))`)}};Za.default=db});var Nm=b(qa=>{"use strict";Object.defineProperty(qa,"__esModule",{value:!0});function Am(e){let t=e.length,r=0,o=0,n;for(;o<t;)r++,n=e.charCodeAt(o++),n>=55296&&n<=56319&&o<t&&(n=e.charCodeAt(o),(n&64512)===56320&&o++);return r}qa.default=Am;Am.code='require("ajv/dist/runtime/ucs2length").default'});var jm=b(Ma=>{"use strict";Object.defineProperty(Ma,"__esModule",{value:!0});var Mt=j(),pb=U(),fb=Nm(),mb={message({keyword:e,schemaCode:t}){let r=e==="maxLength"?"more":"fewer";return(0,Mt.str)`must NOT have ${r} than ${t} characters`},params:({schemaCode:e})=>(0,Mt._)`{limit: ${e}}`},hb={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:mb,code(e){let{keyword:t,data:r,schemaCode:o,it:n}=e,s=t==="maxLength"?Mt.operators.GT:Mt.operators.LT,i=n.opts.unicode===!1?(0,Mt._)`${r}.length`:(0,Mt._)`${(0,pb.useFunc)(e.gen,fb.default)}(${r})`;e.fail$data((0,Mt._)`${i} ${s} ${o}`)}};Ma.default=hb});var Zm=b(Da=>{"use strict";Object.defineProperty(Da,"__esModule",{value:!0});var gb=je(),_b=U(),gr=j(),yb={message:({schemaCode:e})=>(0,gr.str)`must match pattern "${e}"`,params:({schemaCode:e})=>(0,gr._)`{pattern: ${e}}`},vb={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:yb,code(e){let{gen:t,data:r,$data:o,schema:n,schemaCode:s,it:i}=e,a=i.opts.unicodeRegExp?"u":"";if(o){let{regExp:c}=i.opts.code,l=c.code==="new RegExp"?(0,gr._)`new RegExp`:(0,_b.useFunc)(t,c),u=t.let("valid");t.try(()=>t.assign(u,(0,gr._)`${l}(${s}, ${a}).test(${r})`),()=>t.assign(u,!1)),e.fail$data((0,gr._)`!${u}`)}else{let c=(0,gb.usePattern)(e,n);e.fail$data((0,gr._)`!${c}.test(${r})`)}}};Da.default=vb});var qm=b(Ua=>{"use strict";Object.defineProperty(Ua,"__esModule",{value:!0});var fo=j(),wb={message({keyword:e,schemaCode:t}){let r=e==="maxProperties"?"more":"fewer";return(0,fo.str)`must NOT have ${r} than ${t} properties`},params:({schemaCode:e})=>(0,fo._)`{limit: ${e}}`},$b={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:wb,code(e){let{keyword:t,data:r,schemaCode:o}=e,n=t==="maxProperties"?fo.operators.GT:fo.operators.LT;e.fail$data((0,fo._)`Object.keys(${r}).length ${n} ${o}`)}};Ua.default=$b});var Mm=b(La=>{"use strict";Object.defineProperty(La,"__esModule",{value:!0});var mo=je(),ho=j(),xb=U(),bb={message:({params:{missingProperty:e}})=>(0,ho.str)`must have required property '${e}'`,params:({params:{missingProperty:e}})=>(0,ho._)`{missingProperty: ${e}}`},zb={keyword:"required",type:"object",schemaType:"array",$data:!0,error:bb,code(e){let{gen:t,schema:r,schemaCode:o,data:n,$data:s,it:i}=e,{opts:a}=i;if(!s&&r.length===0)return;let c=r.length>=a.loopRequired;if(i.allErrors?l():u(),a.strictRequired){let f=e.parentSchema.properties,{definedProperties:g}=e.it;for(let h of r)if(f?.[h]===void 0&&!g.has(h)){let _=i.schemaEnv.baseId+i.errSchemaPath,w=`required property "${h}" is not defined at "${_}" (strictRequired)`;(0,xb.checkStrictMode)(i,w,i.opts.strictRequired)}}function l(){if(c||s)e.block$data(ho.nil,d);else for(let f of r)(0,mo.checkReportMissingProp)(e,f)}function u(){let f=t.let("missing");if(c||s){let g=t.let("valid",!0);e.block$data(g,()=>m(f,g)),e.ok(g)}else t.if((0,mo.checkMissingProp)(e,r,f)),(0,mo.reportMissingProp)(e,f),t.else()}function d(){t.forOf("prop",o,f=>{e.setParams({missingProperty:f}),t.if((0,mo.noPropertyInData)(t,n,f,a.ownProperties),()=>e.error())})}function m(f,g){e.setParams({missingProperty:f}),t.forOf(f,o,()=>{t.assign(g,(0,mo.propertyInData)(t,n,f,a.ownProperties)),t.if((0,ho.not)(g),()=>{e.error(),t.break()})},ho.nil)}}};La.default=zb});var Dm=b(Fa=>{"use strict";Object.defineProperty(Fa,"__esModule",{value:!0});var go=j(),Sb={message({keyword:e,schemaCode:t}){let r=e==="maxItems"?"more":"fewer";return(0,go.str)`must NOT have ${r} than ${t} items`},params:({schemaCode:e})=>(0,go._)`{limit: ${e}}`},kb={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:Sb,code(e){let{keyword:t,data:r,schemaCode:o}=e,n=t==="maxItems"?go.operators.GT:go.operators.LT;e.fail$data((0,go._)`${r}.length ${n} ${o}`)}};Fa.default=kb});var Vn=b(Va=>{"use strict";Object.defineProperty(Va,"__esModule",{value:!0});var Um=ca();Um.code='require("ajv/dist/runtime/equal").default';Va.default=Um});var Lm=b(Ba=>{"use strict";Object.defineProperty(Ba,"__esModule",{value:!0});var Ha=eo(),ge=j(),Pb=U(),Eb=Vn(),Tb={message:({params:{i:e,j:t}})=>(0,ge.str)`must NOT have duplicate items (items ## ${t} and ${e} are identical)`,params:({params:{i:e,j:t}})=>(0,ge._)`{i: ${e}, j: ${t}}`},Rb={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:Tb,code(e){let{gen:t,data:r,$data:o,schema:n,parentSchema:s,schemaCode:i,it:a}=e;if(!o&&!n)return;let c=t.let("valid"),l=s.items?(0,Ha.getSchemaTypes)(s.items):[];e.block$data(c,u,(0,ge._)`${i} === false`),e.ok(c);function u(){let g=t.let("i",(0,ge._)`${r}.length`),h=t.let("j");e.setParams({i:g,j:h}),t.assign(c,!0),t.if((0,ge._)`${g} > 1`,()=>(d()?m:f)(g,h))}function d(){return l.length>0&&!l.some(g=>g==="object"||g==="array")}function m(g,h){let _=t.name("item"),w=(0,Ha.checkDataTypes)(l,_,a.opts.strictNumbers,Ha.DataType.Wrong),$=t.const("indices",(0,ge._)`{}`);t.for((0,ge._)`;${g}--;`,()=>{t.let(_,(0,ge._)`${r}[${g}]`),t.if(w,(0,ge._)`continue`),l.length>1&&t.if((0,ge._)`typeof ${_} == "string"`,(0,ge._)`${_} += "_"`),t.if((0,ge._)`typeof ${$}[${_}] == "number"`,()=>{t.assign(h,(0,ge._)`${$}[${_}]`),e.error(),t.assign(c,!1).break()}).code((0,ge._)`${$}[${_}] = ${g}`)})}function f(g,h){let _=(0,Pb.useFunc)(t,Eb.default),w=t.name("outer");t.label(w).for((0,ge._)`;${g}--;`,()=>t.for((0,ge._)`${h} = ${g}; ${h}--;`,()=>t.if((0,ge._)`${_}(${r}[${g}], ${r}[${h}])`,()=>{e.error(),t.assign(c,!1).break(w)})))}}};Ba.default=Rb});var Fm=b(Wa=>{"use strict";Object.defineProperty(Wa,"__esModule",{value:!0});var Ka=j(),Ib=U(),Ob=Vn(),Cb={message:"must be equal to constant",params:({schemaCode:e})=>(0,Ka._)`{allowedValue: ${e}}`},Ab={keyword:"const",$data:!0,error:Cb,code(e){let{gen:t,data:r,$data:o,schemaCode:n,schema:s}=e;o||s&&typeof s=="object"?e.fail$data((0,Ka._)`!${(0,Ib.useFunc)(t,Ob.default)}(${r}, ${n})`):e.fail((0,Ka._)`${s} !== ${r}`)}};Wa.default=Ab});var Vm=b(Ga=>{"use strict";Object.defineProperty(Ga,"__esModule",{value:!0});var _o=j(),Nb=U(),jb=Vn(),Zb={message:"must be equal to one of the allowed values",params:({schemaCode:e})=>(0,_o._)`{allowedValues: ${e}}`},qb={keyword:"enum",schemaType:"array",$data:!0,error:Zb,code(e){let{gen:t,data:r,$data:o,schema:n,schemaCode:s,it:i}=e;if(!o&&n.length===0)throw new Error("enum must have non-empty array");let a=n.length>=i.opts.loopEnum,c,l=()=>c??(c=(0,Nb.useFunc)(t,jb.default)),u;if(a||o)u=t.let("valid"),e.block$data(u,d);else{if(!Array.isArray(n))throw new Error("ajv implementation error");let f=t.const("vSchema",s);u=(0,_o.or)(...n.map((g,h)=>m(f,h)))}e.pass(u);function d(){t.assign(u,!1),t.forOf("v",s,f=>t.if((0,_o._)`${l()}(${r}, ${f})`,()=>t.assign(u,!0).break()))}function m(f,g){let h=n[g];return typeof h=="object"&&h!==null?(0,_o._)`${l()}(${r}, ${f}[${g}])`:(0,_o._)`${r} === ${h}`}}};Ga.default=qb});var Hm=b(Ja=>{"use strict";Object.defineProperty(Ja,"__esModule",{value:!0});var Mb=Om(),Db=Cm(),Ub=jm(),Lb=Zm(),Fb=qm(),Vb=Mm(),Hb=Dm(),Bb=Lm(),Kb=Fm(),Wb=Vm(),Gb=[Mb.default,Db.default,Ub.default,Lb.default,Fb.default,Vb.default,Hb.default,Bb.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},Kb.default,Wb.default];Ja.default=Gb});var Ya=b(yo=>{"use strict";Object.defineProperty(yo,"__esModule",{value:!0});yo.validateAdditionalItems=void 0;var Dt=j(),Qa=U(),Jb={message:({params:{len:e}})=>(0,Dt.str)`must NOT have more than ${e} items`,params:({params:{len:e}})=>(0,Dt._)`{limit: ${e}}`},Qb={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:Jb,code(e){let{parentSchema:t,it:r}=e,{items:o}=t;if(!Array.isArray(o)){(0,Qa.checkStrictMode)(r,'"additionalItems" is ignored when "items" is not an array of schemas');return}Bm(e,o)}};function Bm(e,t){let{gen:r,schema:o,data:n,keyword:s,it:i}=e;i.items=!0;let a=r.const("len",(0,Dt._)`${n}.length`);if(o===!1)e.setParams({len:t.length}),e.pass((0,Dt._)`${a} <= ${t.length}`);else if(typeof o=="object"&&!(0,Qa.alwaysValidSchema)(i,o)){let l=r.var("valid",(0,Dt._)`${a} <= ${t.length}`);r.if((0,Dt.not)(l),()=>c(l)),e.ok(l)}function c(l){r.forRange("i",t.length,a,u=>{e.subschema({keyword:s,dataProp:u,dataPropType:Qa.Type.Num},l),i.allErrors||r.if((0,Dt.not)(l),()=>r.break())})}}yo.validateAdditionalItems=Bm;yo.default=Qb});var Xa=b(vo=>{"use strict";Object.defineProperty(vo,"__esModule",{value:!0});vo.validateTuple=void 0;var Km=j(),Hn=U(),Yb=je(),Xb={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(e){let{schema:t,it:r}=e;if(Array.isArray(t))return Wm(e,"additionalItems",t);r.items=!0,!(0,Hn.alwaysValidSchema)(r,t)&&e.ok((0,Yb.validateArray)(e))}};function Wm(e,t,r=e.schema){let{gen:o,parentSchema:n,data:s,keyword:i,it:a}=e;u(n),a.opts.unevaluated&&r.length&&a.items!==!0&&(a.items=Hn.mergeEvaluated.items(o,r.length,a.items));let c=o.name("valid"),l=o.const("len",(0,Km._)`${s}.length`);r.forEach((d,m)=>{(0,Hn.alwaysValidSchema)(a,d)||(o.if((0,Km._)`${l} > ${m}`,()=>e.subschema({keyword:i,schemaProp:m,dataProp:m},c)),e.ok(c))});function u(d){let{opts:m,errSchemaPath:f}=a,g=r.length,h=g===d.minItems&&(g===d.maxItems||d[t]===!1);if(m.strictTuples&&!h){let _=`"${i}" is ${g}-tuple, but minItems or maxItems/${t} are not specified or different at path "${f}"`;(0,Hn.checkStrictMode)(a,_,m.strictTuples)}}}vo.validateTuple=Wm;vo.default=Xb});var Gm=b(ec=>{"use strict";Object.defineProperty(ec,"__esModule",{value:!0});var ez=Xa(),tz={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:e=>(0,ez.validateTuple)(e,"items")};ec.default=tz});var Qm=b(tc=>{"use strict";Object.defineProperty(tc,"__esModule",{value:!0});var Jm=j(),rz=U(),oz=je(),nz=Ya(),sz={message:({params:{len:e}})=>(0,Jm.str)`must NOT have more than ${e} items`,params:({params:{len:e}})=>(0,Jm._)`{limit: ${e}}`},iz={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:sz,code(e){let{schema:t,parentSchema:r,it:o}=e,{prefixItems:n}=r;o.items=!0,!(0,rz.alwaysValidSchema)(o,t)&&(n?(0,nz.validateAdditionalItems)(e,n):e.ok((0,oz.validateArray)(e)))}};tc.default=iz});var Ym=b(rc=>{"use strict";Object.defineProperty(rc,"__esModule",{value:!0});var qe=j(),Bn=U(),az={message:({params:{min:e,max:t}})=>t===void 0?(0,qe.str)`must contain at least ${e} valid item(s)`:(0,qe.str)`must contain at least ${e} and no more than ${t} valid item(s)`,params:({params:{min:e,max:t}})=>t===void 0?(0,qe._)`{minContains: ${e}}`:(0,qe._)`{minContains: ${e}, maxContains: ${t}}`},cz={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:az,code(e){let{gen:t,schema:r,parentSchema:o,data:n,it:s}=e,i,a,{minContains:c,maxContains:l}=o;s.opts.next?(i=c===void 0?1:c,a=l):i=1;let u=t.const("len",(0,qe._)`${n}.length`);if(e.setParams({min:i,max:a}),a===void 0&&i===0){(0,Bn.checkStrictMode)(s,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(a!==void 0&&i>a){(0,Bn.checkStrictMode)(s,'"minContains" > "maxContains" is always invalid'),e.fail();return}if((0,Bn.alwaysValidSchema)(s,r)){let h=(0,qe._)`${u} >= ${i}`;a!==void 0&&(h=(0,qe._)`${h} && ${u} <= ${a}`),e.pass(h);return}s.items=!0;let d=t.name("valid");a===void 0&&i===1?f(d,()=>t.if(d,()=>t.break())):i===0?(t.let(d,!0),a!==void 0&&t.if((0,qe._)`${n}.length > 0`,m)):(t.let(d,!1),m()),e.result(d,()=>e.reset());function m(){let h=t.name("_valid"),_=t.let("count",0);f(h,()=>t.if(h,()=>g(_)))}function f(h,_){t.forRange("i",0,u,w=>{e.subschema({keyword:"contains",dataProp:w,dataPropType:Bn.Type.Num,compositeRule:!0},h),_()})}function g(h){t.code((0,qe._)`${h}++`),a===void 0?t.if((0,qe._)`${h} >= ${i}`,()=>t.assign(d,!0).break()):(t.if((0,qe._)`${h} > ${a}`,()=>t.assign(d,!1).break()),i===1?t.assign(d,!0):t.if((0,qe._)`${h} >= ${i}`,()=>t.assign(d,!0)))}}};rc.default=cz});var th=b(Qe=>{"use strict";Object.defineProperty(Qe,"__esModule",{value:!0});Qe.validateSchemaDeps=Qe.validatePropertyDeps=Qe.error=void 0;var oc=j(),uz=U(),wo=je();Qe.error={message:({params:{property:e,depsCount:t,deps:r}})=>{let o=t===1?"property":"properties";return(0,oc.str)`must have ${o} ${r} when property ${e} is present`},params:({params:{property:e,depsCount:t,deps:r,missingProperty:o}})=>(0,oc._)`{property: ${e},
7
- missingProperty: ${o},
8
- depsCount: ${t},
9
- deps: ${r}}`};var lz={keyword:"dependencies",type:"object",schemaType:"object",error:Qe.error,code(e){let[t,r]=dz(e);Xm(e,t),eh(e,r)}};function dz({schema:e}){let t={},r={};for(let o in e){if(o==="__proto__")continue;let n=Array.isArray(e[o])?t:r;n[o]=e[o]}return[t,r]}function Xm(e,t=e.schema){let{gen:r,data:o,it:n}=e;if(Object.keys(t).length===0)return;let s=r.let("missing");for(let i in t){let a=t[i];if(a.length===0)continue;let c=(0,wo.propertyInData)(r,o,i,n.opts.ownProperties);e.setParams({property:i,depsCount:a.length,deps:a.join(", ")}),n.allErrors?r.if(c,()=>{for(let l of a)(0,wo.checkReportMissingProp)(e,l)}):(r.if((0,oc._)`${c} && (${(0,wo.checkMissingProp)(e,a,s)})`),(0,wo.reportMissingProp)(e,s),r.else())}}Qe.validatePropertyDeps=Xm;function eh(e,t=e.schema){let{gen:r,data:o,keyword:n,it:s}=e,i=r.name("valid");for(let a in t)(0,uz.alwaysValidSchema)(s,t[a])||(r.if((0,wo.propertyInData)(r,o,a,s.opts.ownProperties),()=>{let c=e.subschema({keyword:n,schemaProp:a},i);e.mergeValidEvaluated(c,i)},()=>r.var(i,!0)),e.ok(i))}Qe.validateSchemaDeps=eh;Qe.default=lz});var oh=b(nc=>{"use strict";Object.defineProperty(nc,"__esModule",{value:!0});var rh=j(),pz=U(),fz={message:"property name must be valid",params:({params:e})=>(0,rh._)`{propertyName: ${e.propertyName}}`},mz={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:fz,code(e){let{gen:t,schema:r,data:o,it:n}=e;if((0,pz.alwaysValidSchema)(n,r))return;let s=t.name("valid");t.forIn("key",o,i=>{e.setParams({propertyName:i}),e.subschema({keyword:"propertyNames",data:i,dataTypes:["string"],propertyName:i,compositeRule:!0},s),t.if((0,rh.not)(s),()=>{e.error(!0),n.allErrors||t.break()})}),e.ok(s)}};nc.default=mz});var ic=b(sc=>{"use strict";Object.defineProperty(sc,"__esModule",{value:!0});var Kn=je(),Be=j(),hz=st(),Wn=U(),gz={message:"must NOT have additional properties",params:({params:e})=>(0,Be._)`{additionalProperty: ${e.additionalProperty}}`},_z={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:gz,code(e){let{gen:t,schema:r,parentSchema:o,data:n,errsCount:s,it:i}=e;if(!s)throw new Error("ajv implementation error");let{allErrors:a,opts:c}=i;if(i.props=!0,c.removeAdditional!=="all"&&(0,Wn.alwaysValidSchema)(i,r))return;let l=(0,Kn.allSchemaProperties)(o.properties),u=(0,Kn.allSchemaProperties)(o.patternProperties);d(),e.ok((0,Be._)`${s} === ${hz.default.errors}`);function d(){t.forIn("key",n,_=>{!l.length&&!u.length?g(_):t.if(m(_),()=>g(_))})}function m(_){let w;if(l.length>8){let $=(0,Wn.schemaRefOrVal)(i,o.properties,"properties");w=(0,Kn.isOwnProperty)(t,$,_)}else l.length?w=(0,Be.or)(...l.map($=>(0,Be._)`${_} === ${$}`)):w=Be.nil;return u.length&&(w=(0,Be.or)(w,...u.map($=>(0,Be._)`${(0,Kn.usePattern)(e,$)}.test(${_})`))),(0,Be.not)(w)}function f(_){t.code((0,Be._)`delete ${n}[${_}]`)}function g(_){if(c.removeAdditional==="all"||c.removeAdditional&&r===!1){f(_);return}if(r===!1){e.setParams({additionalProperty:_}),e.error(),a||t.break();return}if(typeof r=="object"&&!(0,Wn.alwaysValidSchema)(i,r)){let w=t.name("valid");c.removeAdditional==="failing"?(h(_,w,!1),t.if((0,Be.not)(w),()=>{e.reset(),f(_)})):(h(_,w),a||t.if((0,Be.not)(w),()=>t.break()))}}function h(_,w,$){let x={keyword:"additionalProperties",dataProp:_,dataPropType:Wn.Type.Str};$===!1&&Object.assign(x,{compositeRule:!0,createErrors:!1,allErrors:!1}),e.subschema(x,w)}}};sc.default=_z});var ih=b(cc=>{"use strict";Object.defineProperty(cc,"__esModule",{value:!0});var yz=no(),nh=je(),ac=U(),sh=ic(),vz={keyword:"properties",type:"object",schemaType:"object",code(e){let{gen:t,schema:r,parentSchema:o,data:n,it:s}=e;s.opts.removeAdditional==="all"&&o.additionalProperties===void 0&&sh.default.code(new yz.KeywordCxt(s,sh.default,"additionalProperties"));let i=(0,nh.allSchemaProperties)(r);for(let d of i)s.definedProperties.add(d);s.opts.unevaluated&&i.length&&s.props!==!0&&(s.props=ac.mergeEvaluated.props(t,(0,ac.toHash)(i),s.props));let a=i.filter(d=>!(0,ac.alwaysValidSchema)(s,r[d]));if(a.length===0)return;let c=t.name("valid");for(let d of a)l(d)?u(d):(t.if((0,nh.propertyInData)(t,n,d,s.opts.ownProperties)),u(d),s.allErrors||t.else().var(c,!0),t.endIf()),e.it.definedProperties.add(d),e.ok(c);function l(d){return s.opts.useDefaults&&!s.compositeRule&&r[d].default!==void 0}function u(d){e.subschema({keyword:"properties",schemaProp:d,dataProp:d},c)}}};cc.default=vz});var lh=b(uc=>{"use strict";Object.defineProperty(uc,"__esModule",{value:!0});var ah=je(),Gn=j(),ch=U(),uh=U(),wz={keyword:"patternProperties",type:"object",schemaType:"object",code(e){let{gen:t,schema:r,data:o,parentSchema:n,it:s}=e,{opts:i}=s,a=(0,ah.allSchemaProperties)(r),c=a.filter(h=>(0,ch.alwaysValidSchema)(s,r[h]));if(a.length===0||c.length===a.length&&(!s.opts.unevaluated||s.props===!0))return;let l=i.strictSchema&&!i.allowMatchingProperties&&n.properties,u=t.name("valid");s.props!==!0&&!(s.props instanceof Gn.Name)&&(s.props=(0,uh.evaluatedPropsToName)(t,s.props));let{props:d}=s;m();function m(){for(let h of a)l&&f(h),s.allErrors?g(h):(t.var(u,!0),g(h),t.if(u))}function f(h){for(let _ in l)new RegExp(h).test(_)&&(0,ch.checkStrictMode)(s,`property ${_} matches pattern ${h} (use allowMatchingProperties)`)}function g(h){t.forIn("key",o,_=>{t.if((0,Gn._)`${(0,ah.usePattern)(e,h)}.test(${_})`,()=>{let w=c.includes(h);w||e.subschema({keyword:"patternProperties",schemaProp:h,dataProp:_,dataPropType:uh.Type.Str},u),s.opts.unevaluated&&d!==!0?t.assign((0,Gn._)`${d}[${_}]`,!0):!w&&!s.allErrors&&t.if((0,Gn.not)(u),()=>t.break())})})}}};uc.default=wz});var dh=b(lc=>{"use strict";Object.defineProperty(lc,"__esModule",{value:!0});var $z=U(),xz={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(e){let{gen:t,schema:r,it:o}=e;if((0,$z.alwaysValidSchema)(o,r)){e.fail();return}let n=t.name("valid");e.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},n),e.failResult(n,()=>e.reset(),()=>e.error())},error:{message:"must NOT be valid"}};lc.default=xz});var ph=b(dc=>{"use strict";Object.defineProperty(dc,"__esModule",{value:!0});var bz=je(),zz={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:bz.validateUnion,error:{message:"must match a schema in anyOf"}};dc.default=zz});var fh=b(pc=>{"use strict";Object.defineProperty(pc,"__esModule",{value:!0});var Jn=j(),Sz=U(),kz={message:"must match exactly one schema in oneOf",params:({params:e})=>(0,Jn._)`{passingSchemas: ${e.passing}}`},Pz={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:kz,code(e){let{gen:t,schema:r,parentSchema:o,it:n}=e;if(!Array.isArray(r))throw new Error("ajv implementation error");if(n.opts.discriminator&&o.discriminator)return;let s=r,i=t.let("valid",!1),a=t.let("passing",null),c=t.name("_valid");e.setParams({passing:a}),t.block(l),e.result(i,()=>e.reset(),()=>e.error(!0));function l(){s.forEach((u,d)=>{let m;(0,Sz.alwaysValidSchema)(n,u)?t.var(c,!0):m=e.subschema({keyword:"oneOf",schemaProp:d,compositeRule:!0},c),d>0&&t.if((0,Jn._)`${c} && ${i}`).assign(i,!1).assign(a,(0,Jn._)`[${a}, ${d}]`).else(),t.if(c,()=>{t.assign(i,!0),t.assign(a,d),m&&e.mergeEvaluated(m,Jn.Name)})})}}};pc.default=Pz});var mh=b(fc=>{"use strict";Object.defineProperty(fc,"__esModule",{value:!0});var Ez=U(),Tz={keyword:"allOf",schemaType:"array",code(e){let{gen:t,schema:r,it:o}=e;if(!Array.isArray(r))throw new Error("ajv implementation error");let n=t.name("valid");r.forEach((s,i)=>{if((0,Ez.alwaysValidSchema)(o,s))return;let a=e.subschema({keyword:"allOf",schemaProp:i},n);e.ok(n),e.mergeEvaluated(a)})}};fc.default=Tz});var _h=b(mc=>{"use strict";Object.defineProperty(mc,"__esModule",{value:!0});var Qn=j(),gh=U(),Rz={message:({params:e})=>(0,Qn.str)`must match "${e.ifClause}" schema`,params:({params:e})=>(0,Qn._)`{failingKeyword: ${e.ifClause}}`},Iz={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:Rz,code(e){let{gen:t,parentSchema:r,it:o}=e;r.then===void 0&&r.else===void 0&&(0,gh.checkStrictMode)(o,'"if" without "then" and "else" is ignored');let n=hh(o,"then"),s=hh(o,"else");if(!n&&!s)return;let i=t.let("valid",!0),a=t.name("_valid");if(c(),e.reset(),n&&s){let u=t.let("ifClause");e.setParams({ifClause:u}),t.if(a,l("then",u),l("else",u))}else n?t.if(a,l("then")):t.if((0,Qn.not)(a),l("else"));e.pass(i,()=>e.error(!0));function c(){let u=e.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},a);e.mergeEvaluated(u)}function l(u,d){return()=>{let m=e.subschema({keyword:u},a);t.assign(i,a),e.mergeValidEvaluated(m,i),d?t.assign(d,(0,Qn._)`${u}`):e.setParams({ifClause:u})}}}};function hh(e,t){let r=e.schema[t];return r!==void 0&&!(0,gh.alwaysValidSchema)(e,r)}mc.default=Iz});var yh=b(hc=>{"use strict";Object.defineProperty(hc,"__esModule",{value:!0});var Oz=U(),Cz={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:e,parentSchema:t,it:r}){t.if===void 0&&(0,Oz.checkStrictMode)(r,`"${e}" without "if" is ignored`)}};hc.default=Cz});var vh=b(gc=>{"use strict";Object.defineProperty(gc,"__esModule",{value:!0});var Az=Ya(),Nz=Gm(),jz=Xa(),Zz=Qm(),qz=Ym(),Mz=th(),Dz=oh(),Uz=ic(),Lz=ih(),Fz=lh(),Vz=dh(),Hz=ph(),Bz=fh(),Kz=mh(),Wz=_h(),Gz=yh();function Jz(e=!1){let t=[Vz.default,Hz.default,Bz.default,Kz.default,Wz.default,Gz.default,Dz.default,Uz.default,Mz.default,Lz.default,Fz.default];return e?t.push(Nz.default,Zz.default):t.push(Az.default,jz.default),t.push(qz.default),t}gc.default=Jz});var wh=b(_c=>{"use strict";Object.defineProperty(_c,"__esModule",{value:!0});var ae=j(),Qz={message:({schemaCode:e})=>(0,ae.str)`must match format "${e}"`,params:({schemaCode:e})=>(0,ae._)`{format: ${e}}`},Yz={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:Qz,code(e,t){let{gen:r,data:o,$data:n,schema:s,schemaCode:i,it:a}=e,{opts:c,errSchemaPath:l,schemaEnv:u,self:d}=a;if(!c.validateFormats)return;n?m():f();function m(){let g=r.scopeValue("formats",{ref:d.formats,code:c.code.formats}),h=r.const("fDef",(0,ae._)`${g}[${i}]`),_=r.let("fType"),w=r.let("format");r.if((0,ae._)`typeof ${h} == "object" && !(${h} instanceof RegExp)`,()=>r.assign(_,(0,ae._)`${h}.type || "string"`).assign(w,(0,ae._)`${h}.validate`),()=>r.assign(_,(0,ae._)`"string"`).assign(w,h)),e.fail$data((0,ae.or)($(),x()));function $(){return c.strictSchema===!1?ae.nil:(0,ae._)`${i} && !${w}`}function x(){let T=u.$async?(0,ae._)`(${h}.async ? await ${w}(${o}) : ${w}(${o}))`:(0,ae._)`${w}(${o})`,v=(0,ae._)`(typeof ${w} == "function" ? ${T} : ${w}.test(${o}))`;return(0,ae._)`${w} && ${w} !== true && ${_} === ${t} && !${v}`}}function f(){let g=d.formats[s];if(!g){$();return}if(g===!0)return;let[h,_,w]=x(g);h===t&&e.pass(T());function $(){if(c.strictSchema===!1){d.logger.warn(v());return}throw new Error(v());function v(){return`unknown format "${s}" ignored in schema at path "${l}"`}}function x(v){let z=v instanceof RegExp?(0,ae.regexpCode)(v):c.code.formats?(0,ae._)`${c.code.formats}${(0,ae.getProperty)(s)}`:void 0,C=r.scopeValue("formats",{key:s,ref:v,code:z});return typeof v=="object"&&!(v instanceof RegExp)?[v.type||"string",v.validate,(0,ae._)`${C}.validate`]:["string",v,C]}function T(){if(typeof g=="object"&&!(g instanceof RegExp)&&g.async){if(!u.$async)throw new Error("async format in sync schema");return(0,ae._)`await ${w}(${o})`}return typeof _=="function"?(0,ae._)`${w}(${o})`:(0,ae._)`${w}.test(${o})`}}}};_c.default=Yz});var $h=b(yc=>{"use strict";Object.defineProperty(yc,"__esModule",{value:!0});var Xz=wh(),eS=[Xz.default];yc.default=eS});var xh=b(_r=>{"use strict";Object.defineProperty(_r,"__esModule",{value:!0});_r.contentVocabulary=_r.metadataVocabulary=void 0;_r.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];_r.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]});var zh=b(vc=>{"use strict";Object.defineProperty(vc,"__esModule",{value:!0});var tS=Im(),rS=Hm(),oS=vh(),nS=$h(),bh=xh(),sS=[tS.default,rS.default,(0,oS.default)(),nS.default,bh.metadataVocabulary,bh.contentVocabulary];vc.default=sS});var kh=b(Yn=>{"use strict";Object.defineProperty(Yn,"__esModule",{value:!0});Yn.DiscrError=void 0;var Sh;(function(e){e.Tag="tag",e.Mapping="mapping"})(Sh||(Yn.DiscrError=Sh={}))});var Eh=b($c=>{"use strict";Object.defineProperty($c,"__esModule",{value:!0});var yr=j(),wc=kh(),Ph=In(),iS=so(),aS=U(),cS={message:({params:{discrError:e,tagName:t}})=>e===wc.DiscrError.Tag?`tag "${t}" must be string`:`value of tag "${t}" must be in oneOf`,params:({params:{discrError:e,tag:t,tagName:r}})=>(0,yr._)`{error: ${e}, tag: ${r}, tagValue: ${t}}`},uS={keyword:"discriminator",type:"object",schemaType:"object",error:cS,code(e){let{gen:t,data:r,schema:o,parentSchema:n,it:s}=e,{oneOf:i}=n;if(!s.opts.discriminator)throw new Error("discriminator: requires discriminator option");let a=o.propertyName;if(typeof a!="string")throw new Error("discriminator: requires propertyName");if(o.mapping)throw new Error("discriminator: mapping is not supported");if(!i)throw new Error("discriminator: requires oneOf keyword");let c=t.let("valid",!1),l=t.const("tag",(0,yr._)`${r}${(0,yr.getProperty)(a)}`);t.if((0,yr._)`typeof ${l} == "string"`,()=>u(),()=>e.error(!1,{discrError:wc.DiscrError.Tag,tag:l,tagName:a})),e.ok(c);function u(){let f=m();t.if(!1);for(let g in f)t.elseIf((0,yr._)`${l} === ${g}`),t.assign(c,d(f[g]));t.else(),e.error(!1,{discrError:wc.DiscrError.Mapping,tag:l,tagName:a}),t.endIf()}function d(f){let g=t.name("valid"),h=e.subschema({keyword:"oneOf",schemaProp:f},g);return e.mergeEvaluated(h,yr.Name),g}function m(){var f;let g={},h=w(n),_=!0;for(let T=0;T<i.length;T++){let v=i[T];if(v?.$ref&&!(0,aS.schemaHasRulesButRef)(v,s.self.RULES)){let C=v.$ref;if(v=Ph.resolveRef.call(s.self,s.schemaEnv.root,s.baseId,C),v instanceof Ph.SchemaEnv&&(v=v.schema),v===void 0)throw new iS.default(s.opts.uriResolver,s.baseId,C)}let z=(f=v?.properties)===null||f===void 0?void 0:f[a];if(typeof z!="object")throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${a}"`);_=_&&(h||w(v)),$(z,T)}if(!_)throw new Error(`discriminator: "${a}" must be required`);return g;function w({required:T}){return Array.isArray(T)&&T.includes(a)}function $(T,v){if(T.const)x(T.const,v);else if(T.enum)for(let z of T.enum)x(z,v);else throw new Error(`discriminator: "properties/${a}" must have "const" or "enum"`)}function x(T,v){if(typeof T!="string"||T in g)throw new Error(`discriminator: "${a}" values must be unique strings`);g[T]=v}}}};$c.default=uS});var Th=b((DO,lS)=>{lS.exports={$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 bc=b((oe,xc)=>{"use strict";Object.defineProperty(oe,"__esModule",{value:!0});oe.MissingRefError=oe.ValidationError=oe.CodeGen=oe.Name=oe.nil=oe.stringify=oe.str=oe._=oe.KeywordCxt=oe.Ajv=void 0;var dS=Sm(),pS=zh(),fS=Eh(),Rh=Th(),mS=["/properties"],Xn="http://json-schema.org/draft-07/schema",vr=class extends dS.default{_addVocabularies(){super._addVocabularies(),pS.default.forEach(t=>this.addVocabulary(t)),this.opts.discriminator&&this.addKeyword(fS.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let t=this.opts.$data?this.$dataMetaSchema(Rh,mS):Rh;this.addMetaSchema(t,Xn,!1),this.refs["http://json-schema.org/schema"]=Xn}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(Xn)?Xn:void 0)}};oe.Ajv=vr;xc.exports=oe=vr;xc.exports.Ajv=vr;Object.defineProperty(oe,"__esModule",{value:!0});oe.default=vr;var hS=no();Object.defineProperty(oe,"KeywordCxt",{enumerable:!0,get:function(){return hS.KeywordCxt}});var wr=j();Object.defineProperty(oe,"_",{enumerable:!0,get:function(){return wr._}});Object.defineProperty(oe,"str",{enumerable:!0,get:function(){return wr.str}});Object.defineProperty(oe,"stringify",{enumerable:!0,get:function(){return wr.stringify}});Object.defineProperty(oe,"nil",{enumerable:!0,get:function(){return wr.nil}});Object.defineProperty(oe,"Name",{enumerable:!0,get:function(){return wr.Name}});Object.defineProperty(oe,"CodeGen",{enumerable:!0,get:function(){return wr.CodeGen}});var gS=Tn();Object.defineProperty(oe,"ValidationError",{enumerable:!0,get:function(){return gS.default}});var _S=so();Object.defineProperty(oe,"MissingRefError",{enumerable:!0,get:function(){return _S.default}})});var qh=b(Xe=>{"use strict";Object.defineProperty(Xe,"__esModule",{value:!0});Xe.formatNames=Xe.fastFormats=Xe.fullFormats=void 0;function Ye(e,t){return{validate:e,compare:t}}Xe.fullFormats={date:Ye(Ah,Pc),time:Ye(Sc(!0),Ec),"date-time":Ye(Ih(!0),jh),"iso-time":Ye(Sc(),Nh),"iso-date-time":Ye(Ih(),Zh),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:bS,"uri-reference":/^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,"uri-template":/^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i,url:/^(?:https?|ftp):\/\/(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)(?:\.(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu,email:/^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i,hostname:/^(?=.{1,253}\.?$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*\.?$/i,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)$/,ipv6:/^((([0-9a-f]{1,4}:){7}([0-9a-f]{1,4}|:))|(([0-9a-f]{1,4}:){6}(:[0-9a-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){5}(((:[0-9a-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){4}(((:[0-9a-f]{1,4}){1,3})|((:[0-9a-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){3}(((:[0-9a-f]{1,4}){1,4})|((:[0-9a-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){2}(((:[0-9a-f]{1,4}){1,5})|((:[0-9a-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){1}(((:[0-9a-f]{1,4}){1,6})|((:[0-9a-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9a-f]{1,4}){1,7})|((:[0-9a-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))$/i,regex:RS,uuid:/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,"json-pointer":/^(?:\/(?:[^~/]|~0|~1)*)*$/,"json-pointer-uri-fragment":/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,"relative-json-pointer":/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,byte:zS,int32:{type:"number",validate:PS},int64:{type:"number",validate:ES},float:{type:"number",validate:Ch},double:{type:"number",validate:Ch},password:!0,binary:!0};Xe.fastFormats={...Xe.fullFormats,date:Ye(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,Pc),time:Ye(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,Ec),"date-time":Ye(/^\d\d\d\d-[0-1]\d-[0-3]\dt(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,jh),"iso-time":Ye(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,Nh),"iso-date-time":Ye(/^\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,Zh),uri:/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i,"uri-reference":/^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,email:/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i};Xe.formatNames=Object.keys(Xe.fullFormats);function yS(e){return e%4===0&&(e%100!==0||e%400===0)}var vS=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,wS=[0,31,28,31,30,31,30,31,31,30,31,30,31];function Ah(e){let t=vS.exec(e);if(!t)return!1;let r=+t[1],o=+t[2],n=+t[3];return o>=1&&o<=12&&n>=1&&n<=(o===2&&yS(r)?29:wS[o])}function Pc(e,t){if(e&&t)return e>t?1:e<t?-1:0}var zc=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function Sc(e){return function(r){let o=zc.exec(r);if(!o)return!1;let n=+o[1],s=+o[2],i=+o[3],a=o[4],c=o[5]==="-"?-1:1,l=+(o[6]||0),u=+(o[7]||0);if(l>23||u>59||e&&!a)return!1;if(n<=23&&s<=59&&i<60)return!0;let d=s-u*c,m=n-l*c-(d<0?1:0);return(m===23||m===-1)&&(d===59||d===-1)&&i<61}}function Ec(e,t){if(!(e&&t))return;let r=new Date("2020-01-01T"+e).valueOf(),o=new Date("2020-01-01T"+t).valueOf();if(r&&o)return r-o}function Nh(e,t){if(!(e&&t))return;let r=zc.exec(e),o=zc.exec(t);if(r&&o)return e=r[1]+r[2]+r[3],t=o[1]+o[2]+o[3],e>t?1:e<t?-1:0}var kc=/t|\s/i;function Ih(e){let t=Sc(e);return function(o){let n=o.split(kc);return n.length===2&&Ah(n[0])&&t(n[1])}}function jh(e,t){if(!(e&&t))return;let r=new Date(e).valueOf(),o=new Date(t).valueOf();if(r&&o)return r-o}function Zh(e,t){if(!(e&&t))return;let[r,o]=e.split(kc),[n,s]=t.split(kc),i=Pc(r,n);if(i!==void 0)return i||Ec(o,s)}var $S=/\/|:/,xS=/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)(?:\?(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i;function bS(e){return $S.test(e)&&xS.test(e)}var Oh=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function zS(e){return Oh.lastIndex=0,Oh.test(e)}var SS=-(2**31),kS=2**31-1;function PS(e){return Number.isInteger(e)&&e<=kS&&e>=SS}function ES(e){return Number.isInteger(e)}function Ch(){return!0}var TS=/[^\\]\\Z/;function RS(e){if(TS.test(e))return!1;try{return new RegExp(e),!0}catch{return!1}}});var Mh=b($r=>{"use strict";Object.defineProperty($r,"__esModule",{value:!0});$r.formatLimitDefinition=void 0;var IS=bc(),Ke=j(),$t=Ke.operators,es={formatMaximum:{okStr:"<=",ok:$t.LTE,fail:$t.GT},formatMinimum:{okStr:">=",ok:$t.GTE,fail:$t.LT},formatExclusiveMaximum:{okStr:"<",ok:$t.LT,fail:$t.GTE},formatExclusiveMinimum:{okStr:">",ok:$t.GT,fail:$t.LTE}},OS={message:({keyword:e,schemaCode:t})=>(0,Ke.str)`should be ${es[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>(0,Ke._)`{comparison: ${es[e].okStr}, limit: ${t}}`};$r.formatLimitDefinition={keyword:Object.keys(es),type:"string",schemaType:"string",$data:!0,error:OS,code(e){let{gen:t,data:r,schemaCode:o,keyword:n,it:s}=e,{opts:i,self:a}=s;if(!i.validateFormats)return;let c=new IS.KeywordCxt(s,a.RULES.all.format.definition,"format");c.$data?l():u();function l(){let m=t.scopeValue("formats",{ref:a.formats,code:i.code.formats}),f=t.const("fmt",(0,Ke._)`${m}[${c.schemaCode}]`);e.fail$data((0,Ke.or)((0,Ke._)`typeof ${f} != "object"`,(0,Ke._)`${f} instanceof RegExp`,(0,Ke._)`typeof ${f}.compare != "function"`,d(f)))}function u(){let m=c.schema,f=a.formats[m];if(!f||f===!0)return;if(typeof f!="object"||f instanceof RegExp||typeof f.compare!="function")throw new Error(`"${n}": format "${m}" does not define "compare" function`);let g=t.scopeValue("formats",{key:m,ref:f,code:i.code.formats?(0,Ke._)`${i.code.formats}${(0,Ke.getProperty)(m)}`:void 0});e.fail$data(d(g))}function d(m){return(0,Ke._)`${m}.compare(${r}, ${o}) ${es[n].fail} 0`}},dependencies:["format"]};var CS=e=>(e.addKeyword($r.formatLimitDefinition),e);$r.default=CS});var Fh=b(($o,Lh)=>{"use strict";Object.defineProperty($o,"__esModule",{value:!0});var xr=qh(),AS=Mh(),Tc=j(),Dh=new Tc.Name("fullFormats"),NS=new Tc.Name("fastFormats"),Rc=(e,t={keywords:!0})=>{if(Array.isArray(t))return Uh(e,t,xr.fullFormats,Dh),e;let[r,o]=t.mode==="fast"?[xr.fastFormats,NS]:[xr.fullFormats,Dh],n=t.formats||xr.formatNames;return Uh(e,n,r,o),t.keywords&&(0,AS.default)(e),e};Rc.get=(e,t="full")=>{let o=(t==="fast"?xr.fastFormats:xr.fullFormats)[e];if(!o)throw new Error(`Unknown format "${e}"`);return o};function Uh(e,t,r,o){var n,s;(n=(s=e.opts.code).formats)!==null&&n!==void 0||(s.formats=(0,Tc._)`require("ajv-formats/dist/formats").${o}`);for(let i of t)e.addFormat(i,r[i])}Lh.exports=$o=Rc;Object.defineProperty($o,"__esModule",{value:!0});$o.default=Rc});var Yh=b((eC,Qh)=>{Qh.exports=Jh;Jh.sync=MS;var Wh=lt("fs");function qS(e,t){var r=t.pathExt!==void 0?t.pathExt:process.env.PATHEXT;if(!r||(r=r.split(";"),r.indexOf("")!==-1))return!0;for(var o=0;o<r.length;o++){var n=r[o].toLowerCase();if(n&&e.substr(-n.length).toLowerCase()===n)return!0}return!1}function Gh(e,t,r){return!e.isSymbolicLink()&&!e.isFile()?!1:qS(t,r)}function Jh(e,t,r){Wh.stat(e,function(o,n){r(o,o?!1:Gh(n,e,t))})}function MS(e,t){return Gh(Wh.statSync(e),e,t)}});var og=b((tC,rg)=>{rg.exports=eg;eg.sync=DS;var Xh=lt("fs");function eg(e,t,r){Xh.stat(e,function(o,n){r(o,o?!1:tg(n,t))})}function DS(e,t){return tg(Xh.statSync(e),t)}function tg(e,t){return e.isFile()&&US(e,t)}function US(e,t){var r=e.mode,o=e.uid,n=e.gid,s=t.uid!==void 0?t.uid:process.getuid&&process.getuid(),i=t.gid!==void 0?t.gid:process.getgid&&process.getgid(),a=parseInt("100",8),c=parseInt("010",8),l=parseInt("001",8),u=a|c,d=r&l||r&c&&n===i||r&a&&o===s||r&u&&s===0;return d}});var sg=b((oC,ng)=>{var rC=lt("fs"),ns;process.platform==="win32"||global.TESTING_WINDOWS?ns=Yh():ns=og();ng.exports=Oc;Oc.sync=LS;function Oc(e,t,r){if(typeof t=="function"&&(r=t,t={}),!r){if(typeof Promise!="function")throw new TypeError("callback not provided");return new Promise(function(o,n){Oc(e,t||{},function(s,i){s?n(s):o(i)})})}ns(e,t||{},function(o,n){o&&(o.code==="EACCES"||t&&t.ignoreErrors)&&(o=null,n=!1),r(o,n)})}function LS(e,t){try{return ns.sync(e,t||{})}catch(r){if(t&&t.ignoreErrors||r.code==="EACCES")return!1;throw r}}});var pg=b((nC,dg)=>{var br=process.platform==="win32"||process.env.OSTYPE==="cygwin"||process.env.OSTYPE==="msys",ig=lt("path"),FS=br?";":":",ag=sg(),cg=e=>Object.assign(new Error(`not found: ${e}`),{code:"ENOENT"}),ug=(e,t)=>{let r=t.colon||FS,o=e.match(/\//)||br&&e.match(/\\/)?[""]:[...br?[process.cwd()]:[],...(t.path||process.env.PATH||"").split(r)],n=br?t.pathExt||process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",s=br?n.split(r):[""];return br&&e.indexOf(".")!==-1&&s[0]!==""&&s.unshift(""),{pathEnv:o,pathExt:s,pathExtExe:n}},lg=(e,t,r)=>{typeof t=="function"&&(r=t,t={}),t||(t={});let{pathEnv:o,pathExt:n,pathExtExe:s}=ug(e,t),i=[],a=l=>new Promise((u,d)=>{if(l===o.length)return t.all&&i.length?u(i):d(cg(e));let m=o[l],f=/^".*"$/.test(m)?m.slice(1,-1):m,g=ig.join(f,e),h=!f&&/^\.[\\\/]/.test(e)?e.slice(0,2)+g:g;u(c(h,l,0))}),c=(l,u,d)=>new Promise((m,f)=>{if(d===n.length)return m(a(u+1));let g=n[d];ag(l+g,{pathExt:s},(h,_)=>{if(!h&&_)if(t.all)i.push(l+g);else return m(l+g);return m(c(l,u,d+1))})});return r?a(0).then(l=>r(null,l),r):a(0)},VS=(e,t)=>{t=t||{};let{pathEnv:r,pathExt:o,pathExtExe:n}=ug(e,t),s=[];for(let i=0;i<r.length;i++){let a=r[i],c=/^".*"$/.test(a)?a.slice(1,-1):a,l=ig.join(c,e),u=!c&&/^\.[\\\/]/.test(e)?e.slice(0,2)+l:l;for(let d=0;d<o.length;d++){let m=u+o[d];try{if(ag.sync(m,{pathExt:n}))if(t.all)s.push(m);else return m}catch{}}}if(t.all&&s.length)return s;if(t.nothrow)return null;throw cg(e)};dg.exports=lg;lg.sync=VS});var mg=b((sC,Cc)=>{"use strict";var fg=(e={})=>{let t=e.env||process.env;return(e.platform||process.platform)!=="win32"?"PATH":Object.keys(t).reverse().find(o=>o.toUpperCase()==="PATH")||"Path"};Cc.exports=fg;Cc.exports.default=fg});var yg=b((iC,_g)=>{"use strict";var hg=lt("path"),HS=pg(),BS=mg();function gg(e,t){let r=e.options.env||process.env,o=process.cwd(),n=e.options.cwd!=null,s=n&&process.chdir!==void 0&&!process.chdir.disabled;if(s)try{process.chdir(e.options.cwd)}catch{}let i;try{i=HS.sync(e.command,{path:r[BS({env:r})],pathExt:t?hg.delimiter:void 0})}catch{}finally{s&&process.chdir(o)}return i&&(i=hg.resolve(n?e.options.cwd:"",i)),i}function KS(e){return gg(e)||gg(e,!0)}_g.exports=KS});var vg=b((aC,Nc)=>{"use strict";var Ac=/([()\][%!^"`<>&|;, *?])/g;function WS(e){return e=e.replace(Ac,"^$1"),e}function GS(e,t){return e=`${e}`,e=e.replace(/(?=(\\+?)?)\1"/g,'$1$1\\"'),e=e.replace(/(?=(\\+?)?)\1$/,"$1$1"),e=`"${e}"`,e=e.replace(Ac,"^$1"),t&&(e=e.replace(Ac,"^$1")),e}Nc.exports.command=WS;Nc.exports.argument=GS});var $g=b((cC,wg)=>{"use strict";wg.exports=/^#!(.*)/});var bg=b((uC,xg)=>{"use strict";var JS=$g();xg.exports=(e="")=>{let t=e.match(JS);if(!t)return null;let[r,o]=t[0].replace(/#! ?/,"").split(" "),n=r.split("/").pop();return n==="env"?o:o?`${n} ${o}`:n}});var Sg=b((lC,zg)=>{"use strict";var jc=lt("fs"),QS=bg();function YS(e){let r=Buffer.alloc(150),o;try{o=jc.openSync(e,"r"),jc.readSync(o,r,0,150,0),jc.closeSync(o)}catch{}return QS(r.toString())}zg.exports=YS});var Tg=b((dC,Eg)=>{"use strict";var XS=lt("path"),kg=yg(),Pg=vg(),ek=Sg(),tk=process.platform==="win32",rk=/\.(?:com|exe)$/i,ok=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function nk(e){e.file=kg(e);let t=e.file&&ek(e.file);return t?(e.args.unshift(e.file),e.command=t,kg(e)):e.file}function sk(e){if(!tk)return e;let t=nk(e),r=!rk.test(t);if(e.options.forceShell||r){let o=ok.test(t);e.command=XS.normalize(e.command),e.command=Pg.command(e.command),e.args=e.args.map(s=>Pg.argument(s,o));let n=[e.command].concat(e.args).join(" ");e.args=["/d","/s","/c",`"${n}"`],e.command=process.env.comspec||"cmd.exe",e.options.windowsVerbatimArguments=!0}return e}function ik(e,t,r){t&&!Array.isArray(t)&&(r=t,t=null),t=t?t.slice(0):[],r=Object.assign({},r);let o={command:e,args:t,options:r,file:void 0,original:{command:e,args:t}};return r.shell?o:sk(o)}Eg.exports=ik});var Og=b((pC,Ig)=>{"use strict";var Zc=process.platform==="win32";function qc(e,t){return Object.assign(new Error(`${t} ${e.command} ENOENT`),{code:"ENOENT",errno:"ENOENT",syscall:`${t} ${e.command}`,path:e.command,spawnargs:e.args})}function ak(e,t){if(!Zc)return;let r=e.emit;e.emit=function(o,n){if(o==="exit"){let s=Rg(n,t);if(s)return r.call(e,"error",s)}return r.apply(e,arguments)}}function Rg(e,t){return Zc&&e===1&&!t.file?qc(t.original,"spawn"):null}function ck(e,t){return Zc&&e===1&&!t.file?qc(t.original,"spawnSync"):null}Ig.exports={hookChildProcess:ak,verifyENOENT:Rg,verifyENOENTSync:ck,notFoundError:qc}});var Ng=b((fC,zr)=>{"use strict";var Cg=lt("child_process"),Mc=Tg(),Dc=Og();function Ag(e,t,r){let o=Mc(e,t,r),n=Cg.spawn(o.command,o.args,o.options);return Dc.hookChildProcess(n,o),n}function uk(e,t,r){let o=Mc(e,t,r),n=Cg.spawnSync(o.command,o.args,o.options);return n.error=n.error||Dc.verifyENOENTSync(n.status,o),n}zr.exports=Ag;zr.exports.spawn=Ag;zr.exports.sync=uk;zr.exports._parse=Mc;zr.exports._enoent=Dc});var Ug=b(Fc=>{"use strict";var qg=/; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g,hk=/^[\u000b\u0020-\u007e\u0080-\u00ff]+$/,Mg=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/,gk=/\\([\u000b\u0020-\u00ff])/g,_k=/([\\"])/g,Dg=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;Fc.format=yk;Fc.parse=vk;function yk(e){if(!e||typeof e!="object")throw new TypeError("argument obj is required");var t=e.parameters,r=e.type;if(!r||!Dg.test(r))throw new TypeError("invalid type");var o=r;if(t&&typeof t=="object")for(var n,s=Object.keys(t).sort(),i=0;i<s.length;i++){if(n=s[i],!Mg.test(n))throw new TypeError("invalid parameter name");o+="; "+n+"="+$k(t[n])}return o}function vk(e){if(!e)throw new TypeError("argument string is required");var t=typeof e=="object"?wk(e):e;if(typeof t!="string")throw new TypeError("argument string is required to be a string");var r=t.indexOf(";"),o=r!==-1?t.slice(0,r).trim():t.trim();if(!Dg.test(o))throw new TypeError("invalid media type");var n=new xk(o.toLowerCase());if(r!==-1){var s,i,a;for(qg.lastIndex=r;i=qg.exec(t);){if(i.index!==r)throw new TypeError("invalid parameter format");r+=i[0].length,s=i[1].toLowerCase(),a=i[2],a.charCodeAt(0)===34&&(a=a.slice(1,-1),a.indexOf("\\")!==-1&&(a=a.replace(gk,"$1"))),n.parameters[s]=a}if(r!==t.length)throw new TypeError("invalid parameter format")}return n}function wk(e){var t;if(typeof e.getHeader=="function"?t=e.getHeader("content-type"):typeof e.headers=="object"&&(t=e.headers&&e.headers["content-type"]),typeof t!="string")throw new TypeError("content-type header is missing from object");return t}function $k(e){var t=String(e);if(Mg.test(t))return t;if(t.length>0&&!hk.test(t))throw new TypeError("invalid parameter value");return'"'+t.replace(_k,"\\$1")+'"'}function xk(e){this.parameters=Object.create(null),this.type=e}});var ps=Object.freeze({status:"aborted"});function y(e,t,r){function o(a,c){var l;Object.defineProperty(a,"_zod",{value:a._zod??{},enumerable:!1}),(l=a._zod).traits??(l.traits=new Set),a._zod.traits.add(e),t(a,c);for(let u in i.prototype)u in a||Object.defineProperty(a,u,{value:i.prototype[u].bind(a)});a._zod.constr=i,a._zod.def=c}let n=r?.Parent??Object;class s extends n{}Object.defineProperty(s,"name",{value:e});function i(a){var c;let l=r?.Parent?new s:this;o(l,a),(c=l._zod).deferred??(c.deferred=[]);for(let u of l._zod.deferred)u();return l}return Object.defineProperty(i,"init",{value:o}),Object.defineProperty(i,Symbol.hasInstance,{value:a=>r?.Parent&&a instanceof r.Parent?!0:a?._zod?.traits?.has(e)}),Object.defineProperty(i,"name",{value:e}),i}var v_=Symbol("zod_brand"),et=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},qo={};function Ie(e){return e&&Object.assign(qo,e),qo}var H={};ds(H,{BIGINT_FORMAT_RANGES:()=>su,Class:()=>ms,NUMBER_FORMAT_RANGES:()=>xs,aborted:()=>zt,allowsEval:()=>vs,assert:()=>z_,assertEqual:()=>w_,assertIs:()=>x_,assertNever:()=>b_,assertNotEqual:()=>$_,assignProp:()=>ys,cached:()=>Pr,captureStackTrace:()=>Do,cleanEnum:()=>Z_,cleanRegex:()=>Tr,clone:()=>Me,createTransparentProxy:()=>R_,defineLazy:()=>Q,esc:()=>bt,escapeRegex:()=>dt,extend:()=>C_,finalizeIssue:()=>De,floatSafeRemainder:()=>_s,getElementAtPath:()=>S_,getEnumValues:()=>hs,getLengthableOrigin:()=>Rr,getParsedType:()=>T_,getSizableOrigin:()=>iu,isObject:()=>Wt,isPlainObject:()=>Gt,issue:()=>bs,joinValues:()=>Mo,jsonStringifyReplacer:()=>gs,merge:()=>A_,normalizeParams:()=>R,nullish:()=>Er,numKeys:()=>E_,omit:()=>O_,optionalKeys:()=>$s,partial:()=>N_,pick:()=>I_,prefixIssues:()=>We,primitiveTypes:()=>nu,promiseAllObject:()=>k_,propertyKeyTypes:()=>ws,randomString:()=>P_,required:()=>j_,stringifyPrimitive:()=>Uo,unwrapMessage:()=>kr});function w_(e){return e}function $_(e){return e}function x_(e){}function b_(e){throw new Error}function z_(e){}function hs(e){let t=Object.values(e).filter(o=>typeof o=="number");return Object.entries(e).filter(([o,n])=>t.indexOf(+o)===-1).map(([o,n])=>n)}function Mo(e,t="|"){return e.map(r=>Uo(r)).join(t)}function gs(e,t){return typeof t=="bigint"?t.toString():t}function Pr(e){return{get value(){{let r=e();return Object.defineProperty(this,"value",{value:r}),r}throw new Error("cached value already set")}}}function Er(e){return e==null}function Tr(e){let t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}function _s(e,t){let r=(e.toString().split(".")[1]||"").length,o=(t.toString().split(".")[1]||"").length,n=r>o?r:o,s=Number.parseInt(e.toFixed(n).replace(".","")),i=Number.parseInt(t.toFixed(n).replace(".",""));return s%i/10**n}function Q(e,t,r){Object.defineProperty(e,t,{get(){{let n=r();return e[t]=n,n}throw new Error("cached value already set")},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function ys(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function S_(e,t){return t?t.reduce((r,o)=>r?.[o],e):e}function k_(e){let t=Object.keys(e),r=t.map(o=>e[o]);return Promise.all(r).then(o=>{let n={};for(let s=0;s<t.length;s++)n[t[s]]=o[s];return n})}function P_(e=10){let t="abcdefghijklmnopqrstuvwxyz",r="";for(let o=0;o<e;o++)r+=t[Math.floor(Math.random()*t.length)];return r}function bt(e){return JSON.stringify(e)}var Do=Error.captureStackTrace?Error.captureStackTrace:(...e)=>{};function Wt(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}var vs=Pr(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let e=Function;return new e(""),!0}catch{return!1}});function Gt(e){if(Wt(e)===!1)return!1;let t=e.constructor;if(t===void 0)return!0;let r=t.prototype;return!(Wt(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function E_(e){let t=0;for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&t++;return t}var T_=e=>{let t=typeof e;switch(t){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN(e)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":return Array.isArray(e)?"array":e===null?"null":e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?"promise":typeof Map<"u"&&e instanceof Map?"map":typeof Set<"u"&&e instanceof Set?"set":typeof Date<"u"&&e instanceof Date?"date":typeof File<"u"&&e instanceof File?"file":"object";default:throw new Error(`Unknown data type: ${t}`)}},ws=new Set(["string","number","symbol"]),nu=new Set(["string","number","bigint","boolean","symbol","undefined"]);function dt(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Me(e,t,r){let o=new e._zod.constr(t??e._zod.def);return(!t||r?.parent)&&(o._zod.parent=e),o}function R(e){let t=e;if(!t)return{};if(typeof t=="string")return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?{...t,error:()=>t.error}:t}function R_(e){let t;return new Proxy({},{get(r,o,n){return t??(t=e()),Reflect.get(t,o,n)},set(r,o,n,s){return t??(t=e()),Reflect.set(t,o,n,s)},has(r,o){return t??(t=e()),Reflect.has(t,o)},deleteProperty(r,o){return t??(t=e()),Reflect.deleteProperty(t,o)},ownKeys(r){return t??(t=e()),Reflect.ownKeys(t)},getOwnPropertyDescriptor(r,o){return t??(t=e()),Reflect.getOwnPropertyDescriptor(t,o)},defineProperty(r,o,n){return t??(t=e()),Reflect.defineProperty(t,o,n)}})}function Uo(e){return typeof e=="bigint"?e.toString()+"n":typeof e=="string"?`"${e}"`:`${e}`}function $s(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}var xs={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},su={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function I_(e,t){let r={},o=e._zod.def;for(let n in t){if(!(n in o.shape))throw new Error(`Unrecognized key: "${n}"`);t[n]&&(r[n]=o.shape[n])}return Me(e,{...e._zod.def,shape:r,checks:[]})}function O_(e,t){let r={...e._zod.def.shape},o=e._zod.def;for(let n in t){if(!(n in o.shape))throw new Error(`Unrecognized key: "${n}"`);t[n]&&delete r[n]}return Me(e,{...e._zod.def,shape:r,checks:[]})}function C_(e,t){if(!Gt(t))throw new Error("Invalid input to extend: expected a plain object");let r={...e._zod.def,get shape(){let o={...e._zod.def.shape,...t};return ys(this,"shape",o),o},checks:[]};return Me(e,r)}function A_(e,t){return Me(e,{...e._zod.def,get shape(){let r={...e._zod.def.shape,...t._zod.def.shape};return ys(this,"shape",r),r},catchall:t._zod.def.catchall,checks:[]})}function N_(e,t,r){let o=t._zod.def.shape,n={...o};if(r)for(let s in r){if(!(s in o))throw new Error(`Unrecognized key: "${s}"`);r[s]&&(n[s]=e?new e({type:"optional",innerType:o[s]}):o[s])}else for(let s in o)n[s]=e?new e({type:"optional",innerType:o[s]}):o[s];return Me(t,{...t._zod.def,shape:n,checks:[]})}function j_(e,t,r){let o=t._zod.def.shape,n={...o};if(r)for(let s in r){if(!(s in n))throw new Error(`Unrecognized key: "${s}"`);r[s]&&(n[s]=new e({type:"nonoptional",innerType:o[s]}))}else for(let s in o)n[s]=new e({type:"nonoptional",innerType:o[s]});return Me(t,{...t._zod.def,shape:n,checks:[]})}function zt(e,t=0){for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue!==!0)return!0;return!1}function We(e,t){return t.map(r=>{var o;return(o=r).path??(o.path=[]),r.path.unshift(e),r})}function kr(e){return typeof e=="string"?e:e?.message}function De(e,t,r){let o={...e,path:e.path??[]};if(!e.message){let n=kr(e.inst?._zod.def?.error?.(e))??kr(t?.error?.(e))??kr(r.customError?.(e))??kr(r.localeError?.(e))??"Invalid input";o.message=n}return delete o.inst,delete o.continue,t?.reportInput||delete o.input,o}function iu(e){return e instanceof Set?"set":e instanceof Map?"map":e instanceof File?"file":"unknown"}function Rr(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function bs(...e){let[t,r,o]=e;return typeof t=="string"?{message:t,code:"custom",input:r,inst:o}:{...t}}function Z_(e){return Object.entries(e).filter(([t,r])=>Number.isNaN(Number.parseInt(t,10))).map(t=>t[1])}var ms=class{constructor(...t){}};var au=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),Object.defineProperty(e,"message",{get(){return JSON.stringify(t,gs,2)},enumerable:!0}),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},Lo=y("$ZodError",au),zs=y("$ZodError",au,{Parent:Error});function Ss(e,t=r=>r.message){let r={},o=[];for(let n of e.issues)n.path.length>0?(r[n.path[0]]=r[n.path[0]]||[],r[n.path[0]].push(t(n))):o.push(t(n));return{formErrors:o,fieldErrors:r}}function ks(e,t){let r=t||function(s){return s.message},o={_errors:[]},n=s=>{for(let i of s.issues)if(i.code==="invalid_union"&&i.errors.length)i.errors.map(a=>n({issues:a}));else if(i.code==="invalid_key")n({issues:i.issues});else if(i.code==="invalid_element")n({issues:i.issues});else if(i.path.length===0)o._errors.push(r(i));else{let a=o,c=0;for(;c<i.path.length;){let l=i.path[c];c===i.path.length-1?(a[l]=a[l]||{_errors:[]},a[l]._errors.push(r(i))):a[l]=a[l]||{_errors:[]},a=a[l],c++}}};return n(e),o}var cu=e=>(t,r,o,n)=>{let s=o?Object.assign(o,{async:!1}):{async:!1},i=t._zod.run({value:r,issues:[]},s);if(i instanceof Promise)throw new et;if(i.issues.length){let a=new(n?.Err??e)(i.issues.map(c=>De(c,s,Ie())));throw Do(a,n?.callee),a}return i.value};var uu=e=>async(t,r,o,n)=>{let s=o?Object.assign(o,{async:!0}):{async:!0},i=t._zod.run({value:r,issues:[]},s);if(i instanceof Promise&&(i=await i),i.issues.length){let a=new(n?.Err??e)(i.issues.map(c=>De(c,s,Ie())));throw Do(a,n?.callee),a}return i.value};var Ps=e=>(t,r,o)=>{let n=o?{...o,async:!1}:{async:!1},s=t._zod.run({value:r,issues:[]},n);if(s instanceof Promise)throw new et;return s.issues.length?{success:!1,error:new(e??Lo)(s.issues.map(i=>De(i,n,Ie())))}:{success:!0,data:s.value}},Ir=Ps(zs),Es=e=>async(t,r,o)=>{let n=o?Object.assign(o,{async:!0}):{async:!0},s=t._zod.run({value:r,issues:[]},n);return s instanceof Promise&&(s=await s),s.issues.length?{success:!1,error:new e(s.issues.map(i=>De(i,n,Ie())))}:{success:!0,data:s.value}},Fo=Es(zs);var lu=/^[cC][^\s-]{8,}$/,du=/^[0-9a-z]+$/,pu=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,fu=/^[0-9a-vA-V]{20}$/,mu=/^[A-Za-z0-9]{27}$/,hu=/^[a-zA-Z0-9_-]{21}$/,gu=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/;var _u=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,Ts=e=>e?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000)$/;var yu=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;var M_="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function vu(){return new RegExp(M_,"u")}var wu=/^(?:(?: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])$/,$u=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})$/,xu=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,bu=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,zu=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Rs=/^[A-Za-z0-9_-]*$/,Su=/^([a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+$/;var ku=/^\+(?:[0-9]){6,14}[0-9]$/,Pu="(?:(?:\\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])))",Eu=new RegExp(`^${Pu}$`);function Tu(e){let t="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof e.precision=="number"?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function Ru(e){return new RegExp(`^${Tu(e)}$`)}function Iu(e){let t=Tu({precision:e.precision}),r=["Z"];e.local&&r.push(""),e.offset&&r.push("([+-]\\d{2}:\\d{2})");let o=`${t}(?:${r.join("|")})`;return new RegExp(`^${Pu}T(?:${o})$`)}var Ou=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},Cu=/^\d+n?$/,Au=/^\d+$/,Nu=/^-?\d+(?:\.\d+)?/i,ju=/true|false/i,Zu=/null/i;var qu=/^[^A-Z]*$/,Mu=/^[^a-z]*$/;var ye=y("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])}),Du={number:"number",bigint:"bigint",object:"date"},Is=y("$ZodCheckLessThan",(e,t)=>{ye.init(e,t);let r=Du[typeof t.value];e._zod.onattach.push(o=>{let n=o._zod.bag,s=(t.inclusive?n.maximum:n.exclusiveMaximum)??Number.POSITIVE_INFINITY;t.value<s&&(t.inclusive?n.maximum=t.value:n.exclusiveMaximum=t.value)}),e._zod.check=o=>{(t.inclusive?o.value<=t.value:o.value<t.value)||o.issues.push({origin:r,code:"too_big",maximum:t.value,input:o.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Os=y("$ZodCheckGreaterThan",(e,t)=>{ye.init(e,t);let r=Du[typeof t.value];e._zod.onattach.push(o=>{let n=o._zod.bag,s=(t.inclusive?n.minimum:n.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>s&&(t.inclusive?n.minimum=t.value:n.exclusiveMinimum=t.value)}),e._zod.check=o=>{(t.inclusive?o.value>=t.value:o.value>t.value)||o.issues.push({origin:r,code:"too_small",minimum:t.value,input:o.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Uu=y("$ZodCheckMultipleOf",(e,t)=>{ye.init(e,t),e._zod.onattach.push(r=>{var o;(o=r._zod.bag).multipleOf??(o.multipleOf=t.value)}),e._zod.check=r=>{if(typeof r.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof r.value=="bigint"?r.value%t.value===BigInt(0):_s(r.value,t.value)===0)||r.issues.push({origin:typeof r.value,code:"not_multiple_of",divisor:t.value,input:r.value,inst:e,continue:!t.abort})}}),Lu=y("$ZodCheckNumberFormat",(e,t)=>{ye.init(e,t),t.format=t.format||"float64";let r=t.format?.includes("int"),o=r?"int":"number",[n,s]=xs[t.format];e._zod.onattach.push(i=>{let a=i._zod.bag;a.format=t.format,a.minimum=n,a.maximum=s,r&&(a.pattern=Au)}),e._zod.check=i=>{let a=i.value;if(r){if(!Number.isInteger(a)){i.issues.push({expected:o,format:t.format,code:"invalid_type",input:a,inst:e});return}if(!Number.isSafeInteger(a)){a>0?i.issues.push({input:a,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:o,continue:!t.abort}):i.issues.push({input:a,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:o,continue:!t.abort});return}}a<n&&i.issues.push({origin:"number",input:a,code:"too_small",minimum:n,inclusive:!0,inst:e,continue:!t.abort}),a>s&&i.issues.push({origin:"number",input:a,code:"too_big",maximum:s,inst:e})}});var Fu=y("$ZodCheckMaxLength",(e,t)=>{var r;ye.init(e,t),(r=e._zod.def).when??(r.when=o=>{let n=o.value;return!Er(n)&&n.length!==void 0}),e._zod.onattach.push(o=>{let n=o._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<n&&(o._zod.bag.maximum=t.maximum)}),e._zod.check=o=>{let n=o.value;if(n.length<=t.maximum)return;let i=Rr(n);o.issues.push({origin:i,code:"too_big",maximum:t.maximum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),Vu=y("$ZodCheckMinLength",(e,t)=>{var r;ye.init(e,t),(r=e._zod.def).when??(r.when=o=>{let n=o.value;return!Er(n)&&n.length!==void 0}),e._zod.onattach.push(o=>{let n=o._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>n&&(o._zod.bag.minimum=t.minimum)}),e._zod.check=o=>{let n=o.value;if(n.length>=t.minimum)return;let i=Rr(n);o.issues.push({origin:i,code:"too_small",minimum:t.minimum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),Hu=y("$ZodCheckLengthEquals",(e,t)=>{var r;ye.init(e,t),(r=e._zod.def).when??(r.when=o=>{let n=o.value;return!Er(n)&&n.length!==void 0}),e._zod.onattach.push(o=>{let n=o._zod.bag;n.minimum=t.length,n.maximum=t.length,n.length=t.length}),e._zod.check=o=>{let n=o.value,s=n.length;if(s===t.length)return;let i=Rr(n),a=s>t.length;o.issues.push({origin:i,...a?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:o.value,inst:e,continue:!t.abort})}}),Or=y("$ZodCheckStringFormat",(e,t)=>{var r,o;ye.init(e,t),e._zod.onattach.push(n=>{let s=n._zod.bag;s.format=t.format,t.pattern&&(s.patterns??(s.patterns=new Set),s.patterns.add(t.pattern))}),t.pattern?(r=e._zod).check??(r.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:"string",code:"invalid_format",format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(o=e._zod).check??(o.check=()=>{})}),Bu=y("$ZodCheckRegex",(e,t)=>{Or.init(e,t),e._zod.check=r=>{t.pattern.lastIndex=0,!t.pattern.test(r.value)&&r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),Ku=y("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=qu),Or.init(e,t)}),Wu=y("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=Mu),Or.init(e,t)}),Gu=y("$ZodCheckIncludes",(e,t)=>{ye.init(e,t);let r=dt(t.includes),o=new RegExp(typeof t.position=="number"?`^.{${t.position}}${r}`:r);t.pattern=o,e._zod.onattach.push(n=>{let s=n._zod.bag;s.patterns??(s.patterns=new Set),s.patterns.add(o)}),e._zod.check=n=>{n.value.includes(t.includes,t.position)||n.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),Ju=y("$ZodCheckStartsWith",(e,t)=>{ye.init(e,t);let r=new RegExp(`^${dt(t.prefix)}.*`);t.pattern??(t.pattern=r),e._zod.onattach.push(o=>{let n=o._zod.bag;n.patterns??(n.patterns=new Set),n.patterns.add(r)}),e._zod.check=o=>{o.value.startsWith(t.prefix)||o.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:o.value,inst:e,continue:!t.abort})}}),Qu=y("$ZodCheckEndsWith",(e,t)=>{ye.init(e,t);let r=new RegExp(`.*${dt(t.suffix)}$`);t.pattern??(t.pattern=r),e._zod.onattach.push(o=>{let n=o._zod.bag;n.patterns??(n.patterns=new Set),n.patterns.add(r)}),e._zod.check=o=>{o.value.endsWith(t.suffix)||o.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:o.value,inst:e,continue:!t.abort})}});var Yu=y("$ZodCheckOverwrite",(e,t)=>{ye.init(e,t),e._zod.check=r=>{r.value=t.tx(r.value)}});var Ho=class{constructor(t=[]){this.content=[],this.indent=0,this&&(this.args=t)}indented(t){this.indent+=1,t(this),this.indent-=1}write(t){if(typeof t=="function"){t(this,{execution:"sync"}),t(this,{execution:"async"});return}let o=t.split(`
10
- `).filter(i=>i),n=Math.min(...o.map(i=>i.length-i.trimStart().length)),s=o.map(i=>i.slice(n)).map(i=>" ".repeat(this.indent*2)+i);for(let i of s)this.content.push(i)}compile(){let t=Function,r=this?.args,n=[...(this?.content??[""]).map(s=>` ${s}`)];return new t(...r,n.join(`
11
- `))}};var el={major:4,minor:0,patch:0};var B=y("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=el;let o=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&o.unshift(e);for(let n of o)for(let s of n._zod.onattach)s(e);if(o.length===0)(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let n=(s,i,a)=>{let c=zt(s),l;for(let u of i){if(u._zod.def.when){if(!u._zod.def.when(s))continue}else if(c)continue;let d=s.issues.length,m=u._zod.check(s);if(m instanceof Promise&&a?.async===!1)throw new et;if(l||m instanceof Promise)l=(l??Promise.resolve()).then(async()=>{await m,s.issues.length!==d&&(c||(c=zt(s,d)))});else{if(s.issues.length===d)continue;c||(c=zt(s,d))}}return l?l.then(()=>s):s};e._zod.run=(s,i)=>{let a=e._zod.parse(s,i);if(a instanceof Promise){if(i.async===!1)throw new et;return a.then(c=>n(c,o,i))}return n(a,o,i)}}e["~standard"]={validate:n=>{try{let s=Ir(e,n);return s.success?{value:s.data}:{issues:s.error?.issues}}catch{return Fo(e,n).then(i=>i.success?{value:i.data}:{issues:i.error?.issues})}},vendor:"zod",version:1}}),Ko=y("$ZodString",(e,t)=>{B.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??Ou(e._zod.bag),e._zod.parse=(r,o)=>{if(t.coerce)try{r.value=String(r.value)}catch{}return typeof r.value=="string"||r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:e}),r}}),ee=y("$ZodStringFormat",(e,t)=>{Or.init(e,t),Ko.init(e,t)}),ll=y("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=_u),ee.init(e,t)}),dl=y("$ZodUUID",(e,t)=>{if(t.version){let o={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(o===void 0)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=Ts(o))}else t.pattern??(t.pattern=Ts());ee.init(e,t)}),pl=y("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=yu),ee.init(e,t)}),fl=y("$ZodURL",(e,t)=>{ee.init(e,t),e._zod.check=r=>{try{let o=r.value,n=new URL(o),s=n.href;t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(n.hostname)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:Su.source,input:r.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(n.protocol.endsWith(":")?n.protocol.slice(0,-1):n.protocol)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:r.value,inst:e,continue:!t.abort})),!o.endsWith("/")&&s.endsWith("/")?r.value=s.slice(0,-1):r.value=s;return}catch{r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort})}}}),ml=y("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=vu()),ee.init(e,t)}),hl=y("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=hu),ee.init(e,t)}),gl=y("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=lu),ee.init(e,t)}),_l=y("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=du),ee.init(e,t)}),yl=y("$ZodULID",(e,t)=>{t.pattern??(t.pattern=pu),ee.init(e,t)}),vl=y("$ZodXID",(e,t)=>{t.pattern??(t.pattern=fu),ee.init(e,t)}),wl=y("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=mu),ee.init(e,t)}),$l=y("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=Iu(t)),ee.init(e,t)}),xl=y("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=Eu),ee.init(e,t)}),bl=y("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=Ru(t)),ee.init(e,t)}),zl=y("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=gu),ee.init(e,t)}),Sl=y("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=wu),ee.init(e,t),e._zod.onattach.push(r=>{let o=r._zod.bag;o.format="ipv4"})}),kl=y("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=$u),ee.init(e,t),e._zod.onattach.push(r=>{let o=r._zod.bag;o.format="ipv6"}),e._zod.check=r=>{try{new URL(`http://[${r.value}]`)}catch{r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:e,continue:!t.abort})}}}),Pl=y("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=xu),ee.init(e,t)}),El=y("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=bu),ee.init(e,t),e._zod.check=r=>{let[o,n]=r.value.split("/");try{if(!n)throw new Error;let s=Number(n);if(`${s}`!==n)throw new Error;if(s<0||s>128)throw new Error;new URL(`http://[${o}]`)}catch{r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:e,continue:!t.abort})}}});function Tl(e){if(e==="")return!0;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}var Rl=y("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=zu),ee.init(e,t),e._zod.onattach.push(r=>{r._zod.bag.contentEncoding="base64"}),e._zod.check=r=>{Tl(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}});function D_(e){if(!Rs.test(e))return!1;let t=e.replace(/[-_]/g,o=>o==="-"?"+":"/"),r=t.padEnd(Math.ceil(t.length/4)*4,"=");return Tl(r)}var Il=y("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=Rs),ee.init(e,t),e._zod.onattach.push(r=>{r._zod.bag.contentEncoding="base64url"}),e._zod.check=r=>{D_(r.value)||r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:e,continue:!t.abort})}}),Ol=y("$ZodE164",(e,t)=>{t.pattern??(t.pattern=ku),ee.init(e,t)});function U_(e,t=null){try{let r=e.split(".");if(r.length!==3)return!1;let[o]=r;if(!o)return!1;let n=JSON.parse(atob(o));return!("typ"in n&&n?.typ!=="JWT"||!n.alg||t&&(!("alg"in n)||n.alg!==t))}catch{return!1}}var Cl=y("$ZodJWT",(e,t)=>{ee.init(e,t),e._zod.check=r=>{U_(r.value,t.alg)||r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:e,continue:!t.abort})}});var As=y("$ZodNumber",(e,t)=>{B.init(e,t),e._zod.pattern=e._zod.bag.pattern??Nu,e._zod.parse=(r,o)=>{if(t.coerce)try{r.value=Number(r.value)}catch{}let n=r.value;if(typeof n=="number"&&!Number.isNaN(n)&&Number.isFinite(n))return r;let s=typeof n=="number"?Number.isNaN(n)?"NaN":Number.isFinite(n)?void 0:"Infinity":void 0;return r.issues.push({expected:"number",code:"invalid_type",input:n,inst:e,...s?{received:s}:{}}),r}}),Al=y("$ZodNumber",(e,t)=>{Lu.init(e,t),As.init(e,t)}),Nl=y("$ZodBoolean",(e,t)=>{B.init(e,t),e._zod.pattern=ju,e._zod.parse=(r,o)=>{if(t.coerce)try{r.value=!!r.value}catch{}let n=r.value;return typeof n=="boolean"||r.issues.push({expected:"boolean",code:"invalid_type",input:n,inst:e}),r}}),jl=y("$ZodBigInt",(e,t)=>{B.init(e,t),e._zod.pattern=Cu,e._zod.parse=(r,o)=>{if(t.coerce)try{r.value=BigInt(r.value)}catch{}return typeof r.value=="bigint"||r.issues.push({expected:"bigint",code:"invalid_type",input:r.value,inst:e}),r}});var Zl=y("$ZodNull",(e,t)=>{B.init(e,t),e._zod.pattern=Zu,e._zod.values=new Set([null]),e._zod.parse=(r,o)=>{let n=r.value;return n===null||r.issues.push({expected:"null",code:"invalid_type",input:n,inst:e}),r}}),ql=y("$ZodAny",(e,t)=>{B.init(e,t),e._zod.parse=r=>r}),Ml=y("$ZodUnknown",(e,t)=>{B.init(e,t),e._zod.parse=r=>r}),Dl=y("$ZodNever",(e,t)=>{B.init(e,t),e._zod.parse=(r,o)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:e}),r)});var Ul=y("$ZodDate",(e,t)=>{B.init(e,t),e._zod.parse=(r,o)=>{if(t.coerce)try{r.value=new Date(r.value)}catch{}let n=r.value,s=n instanceof Date;return s&&!Number.isNaN(n.getTime())||r.issues.push({expected:"date",code:"invalid_type",input:n,...s?{received:"Invalid Date"}:{},inst:e}),r}});function tl(e,t,r){e.issues.length&&t.issues.push(...We(r,e.issues)),t.value[r]=e.value}var Ll=y("$ZodArray",(e,t)=>{B.init(e,t),e._zod.parse=(r,o)=>{let n=r.value;if(!Array.isArray(n))return r.issues.push({expected:"array",code:"invalid_type",input:n,inst:e}),r;r.value=Array(n.length);let s=[];for(let i=0;i<n.length;i++){let a=n[i],c=t.element._zod.run({value:a,issues:[]},o);c instanceof Promise?s.push(c.then(l=>tl(l,r,i))):tl(c,r,i)}return s.length?Promise.all(s).then(()=>r):r}});function Bo(e,t,r){e.issues.length&&t.issues.push(...We(r,e.issues)),t.value[r]=e.value}function rl(e,t,r,o){e.issues.length?o[r]===void 0?r in o?t.value[r]=void 0:t.value[r]=e.value:t.issues.push(...We(r,e.issues)):e.value===void 0?r in o&&(t.value[r]=void 0):t.value[r]=e.value}var Fl=y("$ZodObject",(e,t)=>{B.init(e,t);let r=Pr(()=>{let d=Object.keys(t.shape);for(let f of d)if(!(t.shape[f]instanceof B))throw new Error(`Invalid element at key "${f}": expected a Zod schema`);let m=$s(t.shape);return{shape:t.shape,keys:d,keySet:new Set(d),numKeys:d.length,optionalKeys:new Set(m)}});Q(e._zod,"propValues",()=>{let d=t.shape,m={};for(let f in d){let g=d[f]._zod;if(g.values){m[f]??(m[f]=new Set);for(let h of g.values)m[f].add(h)}}return m});let o=d=>{let m=new Ho(["shape","payload","ctx"]),f=r.value,g=$=>{let x=bt($);return`shape[${x}]._zod.run({ value: input[${x}], issues: [] }, ctx)`};m.write("const input = payload.value;");let h=Object.create(null),_=0;for(let $ of f.keys)h[$]=`key_${_++}`;m.write("const newResult = {}");for(let $ of f.keys)if(f.optionalKeys.has($)){let x=h[$];m.write(`const ${x} = ${g($)};`);let T=bt($);m.write(`
12
- if (${x}.issues.length) {
13
- if (input[${T}] === undefined) {
14
- if (${T} in input) {
15
- newResult[${T}] = undefined;
16
- }
17
- } else {
18
- payload.issues = payload.issues.concat(
19
- ${x}.issues.map((iss) => ({
20
- ...iss,
21
- path: iss.path ? [${T}, ...iss.path] : [${T}],
22
- }))
23
- );
2
+ var Ry=Object.create;var wc=Object.defineProperty;var $y=Object.getOwnPropertyDescriptor;var Py=Object.getOwnPropertyNames;var Ey=Object.getPrototypeOf,Ty=Object.prototype.hasOwnProperty;var Dt=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,r)=>(typeof require<"u"?require:t)[r]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')});var rt=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),Rc=(e,t)=>{for(var r in t)wc(e,r,{get:t[r],enumerable:!0})},ky=(e,t,r,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of Py(t))!Ty.call(e,n)&&n!==r&&wc(e,n,{get:()=>t[n],enumerable:!(o=$y(t,n))||o.enumerable});return e};var Cy=(e,t,r)=>(r=e!=null?Ry(Ey(e)):{},ky(t||!e||!e.__esModule?wc(r,"default",{value:e,enumerable:!0}):r,e));var qS=rt((eC,MS)=>{MS.exports=jS;jS.sync=n$;var NS=Dt("fs");function o$(e,t){var r=t.pathExt!==void 0?t.pathExt:process.env.PATHEXT;if(!r||(r=r.split(";"),r.indexOf("")!==-1))return!0;for(var o=0;o<r.length;o++){var n=r[o].toLowerCase();if(n&&e.substr(-n.length).toLowerCase()===n)return!0}return!1}function AS(e,t,r){return!e.isSymbolicLink()&&!e.isFile()?!1:o$(t,r)}function jS(e,t,r){NS.stat(e,function(o,n){r(o,o?!1:AS(n,e,t))})}function n$(e,t){return AS(NS.statSync(e),e,t)}});var VS=rt((tC,ZS)=>{ZS.exports=DS;DS.sync=s$;var LS=Dt("fs");function DS(e,t,r){LS.stat(e,function(o,n){r(o,o?!1:US(n,t))})}function s$(e,t){return US(LS.statSync(e),t)}function US(e,t){return e.isFile()&&i$(e,t)}function i$(e,t){var r=e.mode,o=e.uid,n=e.gid,s=t.uid!==void 0?t.uid:process.getuid&&process.getuid(),i=t.gid!==void 0?t.gid:process.getgid&&process.getgid(),c=parseInt("100",8),a=parseInt("010",8),u=parseInt("001",8),l=c|a,d=r&u||r&a&&n===i||r&c&&o===s||r&l&&s===0;return d}});var HS=rt((oC,FS)=>{var rC=Dt("fs"),bc;process.platform==="win32"||global.TESTING_WINDOWS?bc=qS():bc=VS();FS.exports=Pd;Pd.sync=a$;function Pd(e,t,r){if(typeof t=="function"&&(r=t,t={}),!r){if(typeof Promise!="function")throw new TypeError("callback not provided");return new Promise(function(o,n){Pd(e,t||{},function(s,i){s?n(s):o(i)})})}bc(e,t||{},function(o,n){o&&(o.code==="EACCES"||t&&t.ignoreErrors)&&(o=null,n=!1),r(o,n)})}function a$(e,t){try{return bc.sync(e,t||{})}catch(r){if(t&&t.ignoreErrors||r.code==="EACCES")return!1;throw r}}});var XS=rt((nC,YS)=>{var zo=process.platform==="win32"||process.env.OSTYPE==="cygwin"||process.env.OSTYPE==="msys",BS=Dt("path"),c$=zo?";":":",JS=HS(),KS=e=>Object.assign(new Error(`not found: ${e}`),{code:"ENOENT"}),GS=(e,t)=>{let r=t.colon||c$,o=e.match(/\//)||zo&&e.match(/\\/)?[""]:[...zo?[process.cwd()]:[],...(t.path||process.env.PATH||"").split(r)],n=zo?t.pathExt||process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",s=zo?n.split(r):[""];return zo&&e.indexOf(".")!==-1&&s[0]!==""&&s.unshift(""),{pathEnv:o,pathExt:s,pathExtExe:n}},WS=(e,t,r)=>{typeof t=="function"&&(r=t,t={}),t||(t={});let{pathEnv:o,pathExt:n,pathExtExe:s}=GS(e,t),i=[],c=u=>new Promise((l,d)=>{if(u===o.length)return t.all&&i.length?l(i):d(KS(e));let h=o[u],_=/^".*"$/.test(h)?h.slice(1,-1):h,y=BS.join(_,e),z=!_&&/^\.[\\\/]/.test(e)?e.slice(0,2)+y:y;l(a(z,u,0))}),a=(u,l,d)=>new Promise((h,_)=>{if(d===n.length)return h(c(l+1));let y=n[d];JS(u+y,{pathExt:s},(z,b)=>{if(!z&&b)if(t.all)i.push(u+y);else return h(u+y);return h(a(u,l,d+1))})});return r?c(0).then(u=>r(null,u),r):c(0)},u$=(e,t)=>{t=t||{};let{pathEnv:r,pathExt:o,pathExtExe:n}=GS(e,t),s=[];for(let i=0;i<r.length;i++){let c=r[i],a=/^".*"$/.test(c)?c.slice(1,-1):c,u=BS.join(a,e),l=!a&&/^\.[\\\/]/.test(e)?e.slice(0,2)+u:u;for(let d=0;d<o.length;d++){let h=l+o[d];try{if(JS.sync(h,{pathExt:n}))if(t.all)s.push(h);else return h}catch{}}}if(t.all&&s.length)return s;if(t.nothrow)return null;throw KS(e)};YS.exports=WS;WS.sync=u$});var ey=rt((sC,Ed)=>{"use strict";var QS=(e={})=>{let t=e.env||process.env;return(e.platform||process.platform)!=="win32"?"PATH":Object.keys(t).reverse().find(o=>o.toUpperCase()==="PATH")||"Path"};Ed.exports=QS;Ed.exports.default=QS});var ny=rt((iC,oy)=>{"use strict";var ty=Dt("path"),l$=XS(),d$=ey();function ry(e,t){let r=e.options.env||process.env,o=process.cwd(),n=e.options.cwd!=null,s=n&&process.chdir!==void 0&&!process.chdir.disabled;if(s)try{process.chdir(e.options.cwd)}catch{}let i;try{i=l$.sync(e.command,{path:r[d$({env:r})],pathExt:t?ty.delimiter:void 0})}catch{}finally{s&&process.chdir(o)}return i&&(i=ty.resolve(n?e.options.cwd:"",i)),i}function p$(e){return ry(e)||ry(e,!0)}oy.exports=p$});var sy=rt((aC,kd)=>{"use strict";var Td=/([()\][%!^"`<>&|;, *?])/g;function m$(e){return e=e.replace(Td,"^$1"),e}function h$(e,t){return e=`${e}`,e=e.replace(/(?=(\\+?)?)\1"/g,'$1$1\\"'),e=e.replace(/(?=(\\+?)?)\1$/,"$1$1"),e=`"${e}"`,e=e.replace(Td,"^$1"),t&&(e=e.replace(Td,"^$1")),e}kd.exports.command=m$;kd.exports.argument=h$});var ay=rt((cC,iy)=>{"use strict";iy.exports=/^#!(.*)/});var uy=rt((uC,cy)=>{"use strict";var f$=ay();cy.exports=(e="")=>{let t=e.match(f$);if(!t)return null;let[r,o]=t[0].replace(/#! ?/,"").split(" "),n=r.split("/").pop();return n==="env"?o:o?`${n} ${o}`:n}});var dy=rt((lC,ly)=>{"use strict";var Cd=Dt("fs"),g$=uy();function _$(e){let r=Buffer.alloc(150),o;try{o=Cd.openSync(e,"r"),Cd.readSync(o,r,0,150,0),Cd.closeSync(o)}catch{}return g$(r.toString())}ly.exports=_$});var fy=rt((dC,hy)=>{"use strict";var S$=Dt("path"),py=ny(),my=sy(),y$=dy(),v$=process.platform==="win32",b$=/\.(?:com|exe)$/i,z$=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function w$(e){e.file=py(e);let t=e.file&&y$(e.file);return t?(e.args.unshift(e.file),e.command=t,py(e)):e.file}function R$(e){if(!v$)return e;let t=w$(e),r=!b$.test(t);if(e.options.forceShell||r){let o=z$.test(t);e.command=S$.normalize(e.command),e.command=my.command(e.command),e.args=e.args.map(s=>my.argument(s,o));let n=[e.command].concat(e.args).join(" ");e.args=["/d","/s","/c",`"${n}"`],e.command=process.env.comspec||"cmd.exe",e.options.windowsVerbatimArguments=!0}return e}function $$(e,t,r){t&&!Array.isArray(t)&&(r=t,t=null),t=t?t.slice(0):[],r=Object.assign({},r);let o={command:e,args:t,options:r,file:void 0,original:{command:e,args:t}};return r.shell?o:R$(o)}hy.exports=$$});var Sy=rt((pC,_y)=>{"use strict";var Od=process.platform==="win32";function Id(e,t){return Object.assign(new Error(`${t} ${e.command} ENOENT`),{code:"ENOENT",errno:"ENOENT",syscall:`${t} ${e.command}`,path:e.command,spawnargs:e.args})}function P$(e,t){if(!Od)return;let r=e.emit;e.emit=function(o,n){if(o==="exit"){let s=gy(n,t);if(s)return r.call(e,"error",s)}return r.apply(e,arguments)}}function gy(e,t){return Od&&e===1&&!t.file?Id(t.original,"spawn"):null}function E$(e,t){return Od&&e===1&&!t.file?Id(t.original,"spawnSync"):null}_y.exports={hookChildProcess:P$,verifyENOENT:gy,verifyENOENTSync:E$,notFoundError:Id}});var by=rt((mC,wo)=>{"use strict";var yy=Dt("child_process"),xd=fy(),Nd=Sy();function vy(e,t,r){let o=xd(e,t,r),n=yy.spawn(o.command,o.args,o.options);return Nd.hookChildProcess(n,o),n}function T$(e,t,r){let o=xd(e,t,r),n=yy.spawnSync(o.command,o.args,o.options);return n.error=n.error||Nd.verifyENOENTSync(n.status,o),n}wo.exports=vy;wo.exports.spawn=vy;wo.exports.sync=T$;wo.exports._parse=xd;wo.exports._enoent=Nd});var Oy=Object.create,$s=Object.defineProperty,Iy=Object.getOwnPropertyDescriptor,xy=Object.getOwnPropertyNames,Ny=Object.getPrototypeOf,Ay=Object.prototype.hasOwnProperty,H=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),Md=(e,t)=>{let r={};for(var o in e)$s(r,o,{get:e[o],enumerable:!0});return t&&$s(r,Symbol.toStringTag,{value:"Module"}),r},jy=(e,t,r,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(var n=xy(t),s=0,i=n.length,c;s<i;s++)c=n[s],!Ay.call(e,c)&&c!==r&&$s(e,c,{get:(a=>t[a]).bind(null,c),enumerable:!(o=Iy(t,c))||o.enumerable});return e},Ps=(e,t,r)=>(r=e!=null?Oy(Ny(e)):{},jy(t||!e||!e.__esModule?$s(r,"default",{value:e,enumerable:!0}):r,e));var My=new Set(["https://json-schema.org/draft/2020-12/schema","http://json-schema.org/draft/2020-12/schema"]),qd=new Set(["https://json-schema.org/draft/2019-09/schema","http://json-schema.org/draft/2019-09/schema"]),qy=new Set(["https://json-schema.org/draft-07/schema","http://json-schema.org/draft-07/schema"]),Ly=new Set(["https://json-schema.org/draft-06/schema","http://json-schema.org/draft-06/schema"]);function Ld(e){return typeof e=="string"&&qd.has(e.replace(/#$/,""))}function Dd(e,t){if(!("$schema"in e)||typeof e.$schema!="string")return"2020-12";let r=e.$schema.replace(/#$/,"");if(My.has(r))return"2020-12";if(qd.has(r))return"2019-09";if(qy.has(r)||Ly.has(r))return"draft-7";throw new Error(`JSON Schema declares an unsupported dialect ("$schema": "${e.$schema.slice(0,200)}"). The default validator supports JSON Schema 2020-12, 2019-09, draft-07, and draft-06; ${t}`)}var le={};Rc(le,{BIGINT_FORMAT_RANGES:()=>Cs,CONSTANT_CATCH:()=>Yd,Class:()=>Ec,NUMBER_FORMAT_RANGES:()=>Qo,aborted:()=>lt,allowsEval:()=>xc,assert:()=>Fy,assertEqual:()=>Dy,assertIs:()=>Zy,assertNever:()=>Vy,assertNotEqual:()=>Uy,assignProp:()=>We,attachSchema:()=>en,base64ToUint8Array:()=>Gd,base64urlToUint8Array:()=>uv,cached:()=>Dr,captureStackTrace:()=>Ts,cleanEnum:()=>cv,cleanRegex:()=>Xo,clone:()=>at,cloneDef:()=>Jy,codePointLength:()=>tn,constantCatch:()=>Xd,createTransparentProxy:()=>Qy,defineLazy:()=>Cc,defineLazyInternal:()=>_e,derived:()=>mv,esc:()=>Oc,escapeRegex:()=>Rt,explicitlyAborted:()=>jc,extend:()=>rv,finalizeIssue:()=>dt,floatSafeRemainder:()=>kc,getElementAtPath:()=>Ky,getEnumValues:()=>qr,getLengthableOrigin:()=>rn,getParsedType:()=>Xy,getSizableOrigin:()=>Kd,hexToUint8Array:()=>dv,hide:()=>xs,installLazyProp:()=>_v,isObject:()=>hr,isPlainObject:()=>Vt,issue:()=>Zr,joinValues:()=>Es,jsonStringifyReplacer:()=>Lr,members:()=>qc,merge:()=>nv,mergeDefs:()=>wt,normalizeParams:()=>ce,nullish:()=>Tc,numKeys:()=>Yy,objectClone:()=>Hy,omit:()=>tv,optionalKeys:()=>Ac,own:()=>Zt,parsedType:()=>Mc,partial:()=>sv,pick:()=>ev,prefixIssues:()=>$t,primitiveTypes:()=>Bd,promiseAllObject:()=>Gy,propertyKeyTypes:()=>Nc,randomString:()=>Wy,rawShape:()=>Ur,required:()=>iv,safeExtend:()=>ov,shallowClone:()=>Hd,sizeCaps:()=>Is,slugify:()=>Ic,stringifyPrimitive:()=>ks,toZod:()=>Zd,uint8ArrayToBase64:()=>Wd,uint8ArrayToBase64url:()=>lv,uint8ArrayToHex:()=>pv,unwrapMessage:()=>Mr});function Dy(e){return e}function Uy(e){return e}function Zd(){return e=>e}function Zy(e){}function Vy(e){throw new Error("Unexpected value in exhaustive check")}function Fy(e){}function qr(e){let t=Object.values(e).filter(o=>typeof o=="number");return Object.entries(e).filter(([o,n])=>t.indexOf(+o)===-1).map(([o,n])=>n)}function Es(e,t="|"){return e.map(r=>ks(r)).join(t)}function Lr(e,t){return typeof t=="bigint"?t.toString():t}var Pc=class{constructor(t){this._getter=t,this._value=void 0}get value(){let t=this._getter;return t!==void 0&&(this._value=t(),this._getter=void 0),this._value}};function Dr(e){return new Pc(e)}function Tc(e){return e==null}function Xo(e){let t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}function kc(e,t){let r=e/t,o=Math.round(r),n=4*Number.EPSILON*Math.max(Math.abs(r),1);return Math.abs(r-o)<n?0:r-o}var Ud=Symbol("evaluating");function Cc(e,t,r){let o;Object.defineProperty(e,t,{get(){if(o!==Ud)return o===void 0&&(o=Ud,o=r()),o},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function Hy(e){return Object.create(Object.getPrototypeOf(e),Object.getOwnPropertyDescriptors(e))}function We(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function Ur(e){let t=Object.getOwnPropertyDescriptor(e,"shape");return t?.get?t.get.raw:t?.value}function zt(e){return Ur(e._zod.def)??e._zod.def.shape}function Vd(e,t,r){Object.defineProperty(e,t,{get(){let o=r();return We(this,t,o),o},enumerable:!0,configurable:!0})}function Fd(e,t,r){t in e?We(e,t,r):e[t]=r}function mr(e,t,r,o){let n=zt(t);for(let s of r){let i=Object.getOwnPropertyDescriptor(n,s);i.enumerable&&(i.get?Vd(e,s,()=>{let c=t._zod.def.shape[s];return o?o(c,s):c}):Fd(e,s,o?o(i.value,s):i.value))}}function By(e,t){for(let r of Reflect.ownKeys(t)){let o=Object.getOwnPropertyDescriptor(t,r);o.enumerable&&(o.get?Vd(e,r,()=>t[r]):Fd(e,r,o.value))}}function wt(...e){let t={};for(let r of e){let o=Object.getOwnPropertyDescriptors(r);Object.assign(t,o)}return Object.defineProperties({},t)}function Jy(e){return wt(e._zod.def)}function Ky(e,t){return t?t.reduce((r,o)=>r?.[o],e):e}function Gy(e){let t=Object.keys(e),r=t.map(o=>e[o]);return Promise.all(r).then(o=>{let n={};for(let s=0;s<t.length;s++)n[t[s]]=o[s];return n})}function Wy(e=10){let t="abcdefghijklmnopqrstuvwxyz",r="";for(let o=0;o<e;o++)r+=t[Math.floor(Math.random()*t.length)];return r}function Oc(e){return JSON.stringify(e)}function Ic(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var Ts="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function hr(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}var xc=Dr(()=>{if(Ye.jitless||typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let e=Function;return new e(""),!0}catch{return!1}});function Vt(e){if(hr(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!="function")return!0;let r=t.prototype;return!(hr(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function Hd(e){return Vt(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}function Yy(e){let t=0;for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&t++;return t}var Xy=e=>{let t=typeof e;switch(t){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN(e)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":return Array.isArray(e)?"array":e===null?"null":e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?"promise":typeof Map<"u"&&e instanceof Map?"map":typeof Set<"u"&&e instanceof Set?"set":typeof Date<"u"&&e instanceof Date?"date":typeof File<"u"&&e instanceof File?"file":"object";default:throw new Error(`Unknown data type: ${t}`)}},Nc=new Set(["string","number","symbol"]),Bd=new Set(["string","number","bigint","boolean","symbol","undefined"]);function Rt(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function at(e,t,r){let o=new e._zod.constr(t??e._zod.def);return(!t||r?.parent)&&(o._zod.parent=e),o}function ce(e){let t=e;if(!t)return{};if(typeof t=="string")return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?{...t,error:()=>t.error}:t}function Qy(e){let t;return new Proxy({},{get(r,o,n){return t??(t=e()),Reflect.get(t,o,n)},set(r,o,n,s){return t??(t=e()),Reflect.set(t,o,n,s)},has(r,o){return t??(t=e()),Reflect.has(t,o)},deleteProperty(r,o){return t??(t=e()),Reflect.deleteProperty(t,o)},ownKeys(r){return t??(t=e()),Reflect.ownKeys(t)},getOwnPropertyDescriptor(r,o){return t??(t=e()),Reflect.getOwnPropertyDescriptor(t,o)},defineProperty(r,o,n){return t??(t=e()),Reflect.defineProperty(t,o,n)}})}function ks(e){return typeof e=="bigint"?e.toString()+"n":typeof e=="string"?`"${e}"`:`${e}`}function Ac(e){return Object.keys(e).filter(t=>e[t]._zod.optin!==void 0&&e[t]._zod.optout==="optional")}var Qo={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},Cs={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function ev(e,t){let r=e._zod.def,o=r.checks;if(o&&o.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");let s={};return mr(s,e,Os(e,t)),at(e,wt(r,{shape:s,checks:[]}))}function Os(e,t){let r=zt(e),o=[];for(let n of Reflect.ownKeys(t)){if(!Object.getOwnPropertyDescriptor(r,n)?.enumerable)throw new Error(`Unrecognized key: "${String(n)}"`);t[n]&&o.push(n)}return o}function tv(e,t){let r=e._zod.def,o=r.checks;if(o&&o.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");let s=new Set(Os(e,t)),i={};return mr(i,e,Reflect.ownKeys(zt(e)).filter(c=>!s.has(c))),at(e,wt(r,{shape:i,checks:[]}))}function rv(e,t){if(!Vt(t))throw new Error("Invalid input to extend: expected a plain object");let r=e._zod.def.checks;if(r&&r.length>0){let n=zt(e);for(let s of Reflect.ownKeys(t))if(Object.getOwnPropertyDescriptor(n,s)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return at(e,wt(e._zod.def,{shape:Jd(e,t)}))}function Jd(e,t){let r={};return mr(r,e,Reflect.ownKeys(zt(e))),By(r,t),r}function ov(e,t){if(!Vt(t))throw new Error("Invalid input to safeExtend: expected a plain object");return at(e,wt(e._zod.def,{shape:Jd(e,t)}))}function nv(e,t){if(!t?._zod?.def)throw new Error("Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.");if(e._zod.def.checks?.length)throw new Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");let r={};mr(r,e,Reflect.ownKeys(zt(e))),mr(r,t,Reflect.ownKeys(zt(t)));let o=wt(e._zod.def,{shape:r,get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]});return at(e,o)}function sv(e,t,r,o="partial"){let s=t._zod.def.checks;if(s&&s.length>0)throw new Error(`.${o}() cannot be used on object schemas containing refinements`);let c=r?new Set(Os(t,r)):void 0,a={};return mr(a,t,Reflect.ownKeys(zt(t)),e&&((u,l)=>c&&!c.has(l)?u:new e({type:"optional",innerType:u}))),at(t,wt(t._zod.def,{shape:a,checks:[]}))}function iv(e,t,r){let o=r?new Set(Os(t,r)):void 0,n={};return mr(n,t,Reflect.ownKeys(zt(t)),(s,i)=>o&&!o.has(i)?s:new e({type:"nonoptional",innerType:s})),at(t,wt(t._zod.def,{shape:n}))}function lt(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue!==!0)return!0;return!1}function jc(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue===!1)return!0;return!1}function $t(e,t){return t.map(r=>{var o;return(o=r).path??(o.path=[]),r.path.unshift(e),r})}function Mr(e){return typeof e=="string"?e:e?.message}function Is(e){let t=[];for(let r of e??[]){let o=r._zod.def;if(!/_(length|size)$|_equals$/.test(o.check))break;let n=o.maximum??o.length??o.size;n>=0&&t.push([n,r])}return t}function en(e,t,r){var o;for(let n=t;n<e.length;n++)(o=e[n]).schema??(o.schema=r)}function dt(e,t,r){var o;let n=e.inst?._zod?.traits;n?.has("$ZodType")&&(n.has("$ZodCheck")?(o=e).schema??(o.schema=e.inst):e.schema=e.inst);let s=e.schema!==e.inst?e.schema?._zod.def?.error:void 0,i=e.message?e.message:Mr(e.inst?._zod.def?.error?.(e))??Mr(s?.(e))??Mr(t?.error?.(e))??Mr(r.customError?.(e))??Mr(r.localeError?.(e))??"Invalid input",c={};for(let a of Object.keys(e))a==="inst"||a==="schema"||a==="continue"||a==="input"||a==="__proto__"||(c[a]=e[a]);return c.path??(c.path=[]),c.message=i,t?.reportInput&&(c.input=e.input),c}function Kd(e){return e instanceof Set?"set":e instanceof Map?"map":e instanceof File?"file":"unknown"}var av=/[\uD800-\uDBFF]/;function tn(e){let t=e.length;if(!av.test(e))return t;let r=t;for(let o=0;o<t-1;o++)(e.charCodeAt(o)&64512)===55296&&(e.charCodeAt(o+1)&64512)===56320&&(r--,o++);return r}function rn(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function Mc(e){let t=typeof e;switch(t){case"number":return Number.isNaN(e)?"nan":"number";case"object":{if(e===null)return"null";if(Array.isArray(e))return"array";let r=e;if(r&&Object.getPrototypeOf(r)!==Object.prototype&&"constructor"in r&&r.constructor)return r.constructor.name}}return t}function Zr(...e){let[t,r,o]=e;return typeof t=="string"?{message:t,code:"custom",input:r,inst:o}:{...t}}function cv(e){return Object.entries(e).filter(([t,r])=>Number.isNaN(Number.parseInt(t,10))).map(t=>t[1])}function Gd(e){let t=atob(e),r=new Uint8Array(t.length);for(let o=0;o<t.length;o++)r[o]=t.charCodeAt(o);return r}function Wd(e){let t="";for(let r=0;r<e.length;r++)t+=String.fromCharCode(e[r]);return btoa(t)}function uv(e){let t=e.replace(/-/g,"+").replace(/_/g,"/"),r="=".repeat((4-t.length%4)%4);return Gd(t+r)}function lv(e){return Wd(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function dv(e){let t=e.replace(/^0x/,"");if(t.length%2!==0)throw new Error("Invalid hex string length");let r=new Uint8Array(t.length/2);for(let o=0;o<t.length;o+=2)r[o/2]=Number.parseInt(t.slice(o,o+2),16);return r}function pv(e){return Array.from(e).map(t=>t.toString(16).padStart(2,"0")).join("")}var Ec=class{constructor(...t){}};function qc(e,t){for(let r in t){let o=Object.getOwnPropertyDescriptor(t,r);o.get?Object.defineProperty(e,r,{...o,enumerable:!1}):hv(e,r,o.value)}}function Zt(e,t,r,o=!0){return Object.defineProperty(e,t,{configurable:!0,writable:!0,enumerable:o,value:r}),r}function xs(e,t,r){return Zt(e,t,r,!1)}function mv(e,t){for(let r in e){let o=e[r];Object.defineProperty(t,r,{configurable:!0,enumerable:!0,get(){return Zt(this,r,o(this))},set(n){Zt(this,r,n)}})}return t}function hv(e,t,r){Object.defineProperty(e,t,{configurable:!0,get(){return this==null?r:Zt(this,t,r.bind(this))},set(o){Zt(this,t,o)}})}function fv(e,t){let r=Object.getPrototypeOf(e);return t in r?void 0:r}var $c,Ut=!1,gv={configurable:!0,get(){Ut=!0}};function _e(e,t,r){let o=Object.getPrototypeOf(e._zod);if(t in o&&$c!==e._zod){$c=void 0;return}$c=e._zod,Object.defineProperty(o,t,{configurable:!0,get(){Object.defineProperty(this,t,gv);let n=Ut;Ut=!1;try{let s=r(this);return Ut?delete this[t]:Object.defineProperty(this,t,{configurable:!0,writable:!0,value:s}),Ut=Ut||n,s}catch(s){throw delete this[t],Ut=Ut||n,s}},set(n){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:n})}})}function _v(e,t,r,o){let n=fv(e,t);n&&Object.defineProperty(n,t,{configurable:!0,get(){let s={configurable:!0,writable:!0,enumerable:o,value:void 0};return Object.defineProperty(this,t,s),s.value=r(this),Object.defineProperty(this,t,s),s.value},set(s){Object.defineProperty(this,t,{configurable:!0,writable:!0,enumerable:o,value:s})}})}var Yd="~constantCatch";function Xd(e){let t=()=>e;return t[Yd]=!0,t}var Qd,Dc=Object.freeze({status:"aborted"}),Lc={value:void 0,enumerable:!1},ep="captureStackTrace"in Error?Error:null;function Sv(e){let t=ep;if(t){let r=t.stackTraceLimit;if(typeof r=="number"){try{t.stackTraceLimit=0}catch{return ep=null,new e}try{return new e}finally{t.stackTraceLimit=r}}}return new e}function D(e,t,r,o){let n={};function s(h){this.def=h,this.constr=d,this.traits=new Set}s.prototype=n;let i=r,c=i&&new WeakSet;function a(h,_){if(h._zod){if(h._zod.traits.has(e))return}else{Lc.value=new s(_);try{Object.defineProperty(h,"_zod",Lc)}finally{Lc.value=void 0}}if(h._zod.traits.add(e),t(h,_),c){let z=Object.getPrototypeOf(h),b=h._zod.constr.prototype,g=z;for(;g&&g!==b;)g=Object.getPrototypeOf(g);let P=g??z;c.has(P)||(c.add(P),qc(P,i))}let y=d.prototype;for(let z in y)Object.prototype.hasOwnProperty.call(y,z)&&(z in h||(h[z]=y[z].bind(h)))}let u=o?.Parent??Object;class l extends u{}Object.defineProperty(l,"name",{value:e});function d(h){let _=o?.Parent?Sv(l):this;a(_,h);let y=_._zod.deferred;if(y){for(let b of y)b();_._zod.deferred=void 0}let z=globalThis.__zod_globalConfig?.postProcessor;return z&&z(_),_}return Object.defineProperty(d,"init",{value:a}),Object.defineProperty(d,Symbol.hasInstance,{value:h=>o?.Parent&&h instanceof o.Parent?!0:h?._zod?.traits?.has(e)}),Object.defineProperty(d,"name",{value:e}),d}var pt=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},Vr=class extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}};(Qd=globalThis).__zod_globalConfig??(Qd.__zod_globalConfig={});var Ye=globalThis.__zod_globalConfig;function Xe(e){return e&&Object.assign(Ye,e),Ye}function yv(){let e=this._zod;return e.message??(e.message=JSON.stringify(e.def,Lr,2)),e.message}function vv(e){this._zod.message=e}var bv={get:yv,set:vv,enumerable:!0,configurable:!0},Zc={value:void 0,enumerable:!1},tp=new WeakSet([Object.prototype,Error.prototype]),rp=(e,t)=>{e.name="$ZodError",Zc.value=t,Object.defineProperty(e,"issues",Zc),Zc.value=void 0,Object.defineProperty(e,"message",bv);let r=Object.getPrototypeOf(e);tp.has(r)||(tp.add(r),Object.defineProperty(r,"toString",{configurable:!0,enumerable:!1,get(){let o=()=>this.message;return Object.defineProperty(this,"toString",{value:o,configurable:!0,writable:!0}),o},set(o){Object.defineProperty(this,"toString",{value:o,configurable:!0,writable:!0})}}))},op=D("$ZodError",rp),L$=D("$ZodError",rp,void 0,{Parent:Error});function zv(e,t,r){return Object.prototype.hasOwnProperty.call(e,t)||(t==="__proto__"?Object.defineProperty(e,t,{value:r(),writable:!0,enumerable:!0,configurable:!0}):e[t]=r()),e[t]}function Vc(e,t=r=>r.message){let r={},o=[];for(let n of e.issues)n.path.length>0?zv(r,n.path[0],()=>[]).push(t(n)):o.push(t(n));return{formErrors:o,fieldErrors:r}}function Fc(e,t=r=>r.message){let r={_errors:[]},o=(n,s=[])=>{for(let i of n.issues)if(i.code==="invalid_union"&&i.errors.length)i.errors.map(c=>o({issues:c},[...s,...i.path]));else if(i.code==="invalid_key")o({issues:i.issues},[...s,...i.path]);else if(i.code==="invalid_element")o({issues:i.issues},[...s,...i.path]);else{let c=[...s,...i.path];if(c.length===0)r._errors.push(t(i));else{let a=r,u=0;for(;u<c.length;){let l=c[u],d=u===c.length-1;if(l==="_errors"){d&&a._errors.push(t(i)),u++;continue}Object.prototype.hasOwnProperty.call(a,l)||Object.defineProperty(a,l,{value:{_errors:[]},enumerable:!0,writable:!0,configurable:!0});let h=a[l];d&&h._errors.push(t(i)),a=h,u++}}}};return o(e),r}function Ns(e,t){return{callee:t?.callee??e,Err:t?.Err}}var As=e=>{let t=(r,o,n,s)=>{let i=n?{...n,async:!1}:{async:!1},c=r._zod.run({value:o,issues:[]},i);if(c instanceof Promise)throw new pt;if(c.issues.length){let a=new(s?.Err??e)(c.issues.map(u=>dt(u,i,Xe())));throw Ts(a,s?.callee??t),a}return c.value};return t};var js=e=>{let t=async(r,o,n,s)=>{let i=n?{...n,async:!0}:{async:!0},c=r._zod.run({value:o,issues:[]},i);if(c instanceof Promise&&(c=await c),c.issues.length){let a=new(s?.Err??e)(c.issues.map(u=>dt(u,i,Xe())));throw Ts(a,s?.callee??t),a}return c.value};return t};var Ms=e=>(t,r,o)=>{let n=o?{...o,async:!1}:{async:!1},s=t._zod.run({value:r,issues:[]},n);if(s instanceof Promise)throw new pt;return s.issues.length?np(e,s.issues,n):{success:!0,data:s.value}};function np(e,t,r){let o;return{success:!1,get error(){return o||(o=new e(t.map(n=>dt(n,r,Xe()))),t=void 0,r=void 0),o},set error(n){o=n,t=void 0,r=void 0}}}var qs=e=>async(t,r,o)=>{let n=o?{...o,async:!0}:{async:!0},s=t._zod.run({value:r,issues:[]},n);return s instanceof Promise&&(s=await s),s.issues.length?np(e,s.issues,n):{success:!0,data:s.value}};var wv=Symbol.for("zod.compile.invalid"),Rv=Symbol.for("zod.compile.fallback"),Hc=((e,t,r)=>{let o=e._zod.bag.validator;if(o!==void 0){if(o(t)!==wv)return!0;if(o.definite===!0&&r===void 0)return!1}return $v(e,t,r)});function $v(e,t,r){let o=r?{...r,async:!1,abortEarly:!0}:{async:!1,abortEarly:!0},n=e._zod.bag.fallbackRun,s;if(n?(o[Rv]=!0,s=n({value:t,issues:[]},o)):s=e._zod.run({value:t,issues:[]},o),s instanceof Promise)throw new pt;return s.issues.length===0}var Bc=async(e,t,r)=>{let o=r?{...r,async:!0,abortEarly:!0}:{async:!0,abortEarly:!0},n=e._zod.run({value:t,issues:[]},o);return n instanceof Promise&&(n=await n),n.issues.length===0},sp=e=>{let t=As(e),r=(o,n,s,i)=>{let c=s?{...s,direction:"backward"}:{direction:"backward"};return t(o,n,c,Ns(r,i))};return r};var ip=e=>{let t=As(e),r=(o,n,s,i)=>t(o,n,s,Ns(r,i));return r};var ap=e=>{let t=js(e),r=async(o,n,s,i)=>{let c=s?{...s,direction:"backward"}:{direction:"backward"};return await t(o,n,c,Ns(r,i))};return r};var cp=e=>{let t=js(e),r=async(o,n,s,i)=>await t(o,n,s,Ns(r,i));return r};var up=e=>(t,r,o)=>{let n=o?{...o,direction:"backward"}:{direction:"backward"};return Ms(e)(t,r,n)};var lp=e=>(t,r,o)=>Ms(e)(t,r,o);var dp=e=>async(t,r,o)=>{let n=o?{...o,direction:"backward"}:{direction:"backward"};return qs(e)(t,r,n)};var pp=e=>async(t,r,o)=>qs(e)(t,r,o);var mp=/^[cC][0-9a-z]{6,}$/,hp=/^[0-9a-z]+$/,fp=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/,gp=/^[0-9a-vA-V]{20}$/,_p=/^[A-Za-z0-9]{27}$/,Sp=/^[a-zA-Z0-9_-]{21}$/;function yp(e){return new RegExp(`^[a-zA-Z0-9_-]{${e}}$`)}var vp=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/;var bp=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,Kc=e=>e?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/;var zp=/^(?:[A-Za-z0-9_'+\-]+\.)*[A-Za-z0-9_'+\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;var Pv="^(?=[\\s\\S]*[\\p{Extended_Pictographic}\\p{Regional_Indicator}\\u20E3])[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$";function wp(){return new RegExp(Pv,"u")}var Rp=/^(?:(?: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])$/,$p=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/;var Pp=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,Ep=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Tp=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,kp=/^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$/;var Cp=/^https?$/,Op=/^\+[1-9]\d{6,14}$/;var Ip="(?:(?:\\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])))";function Ev(e){return new RegExp(`^${e}$`)}var xp=Ev(Ip);function Jc(e){let t="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof e.precision=="number"?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:e.seconds?`${t}:[0-5]\\d(?:\\.\\d+)?`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function Np(e){return new RegExp(`^${Jc(e)}$`)}function Ap(e){let t=["Z"];e.offset&&t.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let r=`${Jc({precision:e.precision,seconds:!0})}(?:${t.join("|")})`,o=e.local?`${r}|${Jc({precision:e.precision})}`:r;return new RegExp(`^${Ip}T(?:${o})$`)}var jp=/^[\s\S]{0,}$/;var Mp=/^-?\d+n?$/,Gc=/^-?\d+$/,on=/^-?\d+(?:\.\d+)?$/,qp=/^(?:true|false)$/i,Lp=/^null$/i;var Dp=/^[^A-Z]*$/,Up=/^[^a-z]*$/;var Ze=D("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])});var Wc=e=>{let t=e.value;return!Tc(t)&&t.length!==void 0},Ls={number:"number",bigint:"bigint",object:"date"},Yc=D("$ZodCheckLessThan",(e,t)=>{Ze.init(e,t);let r=Ls[typeof t.value];e._zod.check=o=>{(t.inclusive?o.value<=t.value:o.value<t.value)||o.issues.push({origin:Ls[typeof o.value]??r,code:"too_big",maximum:typeof t.value=="object"?t.value.getTime():t.value,input:o.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Xc=D("$ZodCheckGreaterThan",(e,t)=>{Ze.init(e,t);let r=Ls[typeof t.value];e._zod.check=o=>{(t.inclusive?o.value>=t.value:o.value>t.value)||o.issues.push({origin:Ls[typeof o.value]??r,code:"too_small",minimum:typeof t.value=="object"?t.value.getTime():t.value,input:o.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Zp=D("$ZodCheckMultipleOf",(e,t)=>{Ze.init(e,t),e._zod.check=r=>{if(typeof r.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof r.value=="bigint"?t.value!==BigInt(0)&&r.value%t.value===BigInt(0):kc(r.value,t.value)===0)||r.issues.push({origin:typeof r.value,code:"not_multiple_of",divisor:t.value,input:r.value,inst:e,continue:!t.abort})}}),Vp=D("$ZodCheckNumberFormat",(e,t)=>{Ze.init(e,t),t.format=t.format||"float64";let r=t.format?.includes("int"),o=r?"int":"number",[n,s]=Qo[t.format];e._zod.check=i=>{let c=i.value;if(r){if(!Number.isInteger(c)){i.issues.push({expected:o,format:t.format,code:"invalid_type",continue:!1,input:c,inst:e});return}if(!Number.isSafeInteger(c)){c>0?i.issues.push({input:c,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:o,inclusive:!0,continue:!t.abort}):i.issues.push({input:c,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:o,inclusive:!0,continue:!t.abort});return}}c<n&&i.issues.push({origin:"number",input:c,code:"too_small",minimum:n,inclusive:!0,inst:e,continue:!t.abort}),c>s&&i.issues.push({origin:"number",input:c,code:"too_big",maximum:s,inclusive:!0,inst:e,continue:!t.abort})}});var Fp=D("$ZodCheckMaxLength",(e,t)=>{var r;Ze.init(e,t),(r=e._zod.def).when??(r.when=Wc),e._zod.check=o=>{let n=o.value,s=n.length;if((typeof n=="string"&&s>t.maximum?tn(n):s)<=t.maximum)return;let c=rn(n);o.issues.push({origin:c,code:"too_big",maximum:t.maximum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),Hp=D("$ZodCheckMinLength",(e,t)=>{var r;Ze.init(e,t),(r=e._zod.def).when??(r.when=Wc),e._zod.check=o=>{let n=o.value,s=n.length;if((typeof n=="string"&&s>=t.minimum&&s<t.minimum*2?tn(n):s)>=t.minimum)return;let c=rn(n);o.issues.push({origin:c,code:"too_small",minimum:t.minimum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),Bp=D("$ZodCheckLengthEquals",(e,t)=>{var r;Ze.init(e,t),(r=e._zod.def).when??(r.when=Wc),e._zod.check=o=>{let n=o.value,s=n.length,i=typeof n=="string"&&s>=t.length&&s<=t.length*2?tn(n):s;if(i===t.length)return;let c=rn(n),a=i>t.length;o.issues.push({origin:c,...a?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:o.value,inst:e,continue:!t.abort})}}),nn=D("$ZodCheckStringFormat",(e,t)=>{var r,o;Ze.init(e,t),t.pattern?(r=e._zod).check??(r.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:"string",code:"invalid_format",format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(o=e._zod).check??(o.check=()=>{})}),Jp=D("$ZodCheckRegex",(e,t)=>{nn.init(e,t),e._zod.check=r=>{t.pattern.lastIndex=0,!t.pattern.test(r.value)&&r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),Kp=D("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=Dp),nn.init(e,t)}),Gp=D("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=Up),nn.init(e,t)}),Wp=D("$ZodCheckIncludes",(e,t)=>{Ze.init(e,t);let r=Rt(t.includes),o=new RegExp(typeof t.position=="number"?`^.{${t.position},}${r}`:r);t.pattern=o,e._zod.check=n=>{n.value.includes(t.includes,t.position)||n.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),Yp=D("$ZodCheckStartsWith",(e,t)=>{Ze.init(e,t);let r=new RegExp(`^${Rt(t.prefix)}.*`);t.pattern??(t.pattern=r),e._zod.check=o=>{o.value.startsWith(t.prefix)||o.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:o.value,inst:e,continue:!t.abort})}}),Xp=D("$ZodCheckEndsWith",(e,t)=>{Ze.init(e,t);let r=new RegExp(`.*${Rt(t.suffix)}$`);t.pattern??(t.pattern=r),e._zod.check=o=>{o.value.endsWith(t.suffix)||o.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:o.value,inst:e,continue:!t.abort})}});var Qp=D("$ZodCheckOverwrite",(e,t)=>{Ze.init(e,t),e._zod.check=r=>{r.value=t.tx(r.value)}});var Ds=class{constructor(t=[],r={}){this.content=[],this.indent=0,this.args=t,this.closed=r}indented(t){this.indent+=1;try{t(this)}finally{this.indent-=1}}write(t){if(typeof t=="function"){t(this,{execution:"sync"}),t(this,{execution:"async"});return}let o=t.split(`
3
+ `).filter(i=>i),n=Math.min(...o.map(i=>i.length-i.trimStart().length)),s=o.map(i=>i.slice(n)).map(i=>" ".repeat(this.indent*2)+i);for(let i of s)this.content.push(i)}compile(){let t=Function,r=this?.content??[""];return new t(...Object.keys(this.closed),`return function (${this.args.join(", ")}) {
4
+ ${r.join(`
5
+ `)}
6
+ };`)(...Object.values(this.closed))}};var tm={major:4,minor:6,patch:7};var Re=D("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=tm;let o=e._zod.def.checks,n=e._zod.traits.has("$ZodCheck")?[e,...o??[]]:o?.length?[...o]:[];for(let s of n)for(let i of s._zod.onattach)i(e);if(n.length===0)(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let s=(c,a,u)=>{if(c.memo)return c;let l=lt(c),d;for(let h of a){if(h._zod.def.when){if(jc(c)||!h._zod.def.when(c))continue}else if(l)continue;let _=c.issues.length,y=h._zod.check(c);if(y instanceof Promise&&u?.async===!1)throw new pt;if(d||y instanceof Promise)d=(d??Promise.resolve()).then(async()=>{await y,c.issues.length!==_&&(en(c.issues,_,e),l||(l=lt(c,_)))});else{if(c.issues.length===_)continue;en(c.issues,_,e),l||(l=lt(c,_))}}return d?d.then(()=>c):c},i=(c,a,u)=>{if(lt(c))return c.aborted=!0,c;let l=s(a,n,u);if(l instanceof Promise){if(u.async===!1)throw new pt;return l.then(d=>e._zod.parse(d,u))}return e._zod.parse(l,u)};e._zod.run=(c,a)=>{if(a.skipChecks)return e._zod.parse(c,a);if(a.direction==="backward"){let l=e._zod.parse({value:c.value,issues:[]},{...a,skipChecks:!0});return l instanceof Promise?l.then(d=>i(d,c,a)):i(l,c,a)}let u=e._zod.parse(c,a);if(u instanceof Promise){if(a.async===!1)throw new pt;return u.then(l=>s(l,n,a))}return s(u,n,a)}}},{get"~standard"(){return xs(this,"~standard",eu(this))},set"~standard"(e){Zt(this,"~standard",e)}}),pm=(e,t)=>e.issues.length?{issues:e.issues.map(r=>dt(r,t,Xe()))}:{value:e.value};async function Tv(e,t){let r={async:!0};return pm(await e._zod.run({value:t,issues:[]},r),r)}function eu(e){return{validate:t=>{let r={async:!1};try{let o=e._zod.run({value:t,issues:[]},r);if(!(o instanceof Promise))return pm(o,r)}catch{}return Tv(e,t)},vendor:"zod",version:1}}var Fs=D("$ZodString",(e,t)=>{Re.init(e,t),e._zod.pattern=t.pattern??jp,e._zod.parse=(r,o)=>{if(t.coerce)try{r.value=String(r.value)}catch{}return typeof r.value=="string"||r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:e}),r}}),ke=D("$ZodStringFormat",(e,t)=>{nn.init(e,t),Fs.init(e,t)}),mm=D("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=bp),ke.init(e,t)}),hm=D("$ZodUUID",(e,t)=>{if(t.version){let o={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(o===void 0)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=Kc(o))}else t.pattern??(t.pattern=Kc());ke.init(e,t)}),fm=D("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=zp),ke.init(e,t)}),gm=1,Zs=2;function _m(e){try{return typeof URL<"u"&&typeof URL.canParse=="function"?URL.canParse(e):(new URL(e),!0)}catch{return!1}}function kv(e,t){return!("normalize"in t)&&!("hostname"in t)&&!("protocol"in t)?_m(e)||Zs:Cv(e,t)}function Cv(e,t){if(!t.normalize&&t.protocol?.source===Cp.source&&!/^https?:\/\//i.test(e))return gm;try{if(typeof URL<"u"){let r=URL;if(typeof r.parse=="function")return r.parse(e)??Zs}return new URL(e)}catch{return Zs}}var Ov=/[\t\n\r]/g;function rm(e){return e.replace(Ov,"")}function Iv(e,t){return t.lastIndex=0,t.test(e.hostname)}function xv(e,t){return t.lastIndex=0,t.test(e.protocol.endsWith(":")?e.protocol.slice(0,-1):e.protocol)}var Sm=D("$ZodURL",(e,t)=>{ke.init(e,t),e._zod.check=r=>{try{let o=r.value.trim(),n=kv(o,t);if(n===gm){r.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:r.value,inst:e,continue:!t.abort});return}if(n===Zs){r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort});return}if(n===!0){r.value=rm(o);return}t.hostname&&!Iv(n,t.hostname)&&r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:r.value,inst:e,continue:!t.abort}),t.protocol&&!xv(n,t.protocol)&&r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:r.value,inst:e,continue:!t.abort}),r.value=t.normalize?n.href:rm(o);return}catch{r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort})}}}),ym=D("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=wp()),ke.init(e,t)}),vm=D("$ZodNanoID",(e,t)=>{if(t.length!==void 0&&(!Number.isInteger(t.length)||t.length<1))throw new Error(`Invalid nanoid length: ${t.length}`);t.pattern??(t.pattern=t.length===void 0?Sp:yp(t.length)),ke.init(e,t)}),bm=D("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=mp),ke.init(e,t)}),zm=D("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=hp),ke.init(e,t)}),wm=D("$ZodULID",(e,t)=>{t.pattern??(t.pattern=fp),ke.init(e,t)}),Rm=D("$ZodXID",(e,t)=>{t.pattern??(t.pattern=gp),ke.init(e,t)}),$m=D("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=_p),ke.init(e,t)}),Pm=D("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=Ap(t)),ke.init(e,t)}),Em=D("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=xp),ke.init(e,t)}),Tm=D("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=Np(t)),ke.init(e,t)}),km=D("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=vp),ke.init(e,t)}),Cm=D("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=Rp),ke.init(e,t)}),Nv=/^[0-9a-fA-F:.]+$/;function Om(e){return Nv.test(e)?_m(`http://[${e}]`):!1}var Im=D("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=$p),ke.init(e,t),e._zod.check=r=>{Om(r.value)||r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:e,continue:!t.abort})}});var xm=D("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=Pp),ke.init(e,t)});function Av(e){let t=e.split("/");if(t.length!==2)return!1;let[r,o]=t;if(!o)return!1;let n=Number(o);return`${n}`!==o||n<0||n>128?!1:Om(r)}var Nm=D("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=Ep),ke.init(e,t),e._zod.check=r=>{Av(r.value)||r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:e,continue:!t.abort})}});function Am(e){if(e==="")return!0;if(/\s/.test(e)||e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}var tu=/^[0-9a-zA-Z+/]*={0,2}$/,jm=D("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=tu),ke.init(e,t),e._zod.check=r=>{Am(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}}),Hs=/^[A-Za-z0-9_-]*$/;function jv(e){if(!Hs.test(e))return!1;let t=e.replace(/[-_]/g,o=>o==="-"?"+":"/"),r=t.padEnd(Math.ceil(t.length/4)*4,"=");return Am(r)}var Mm=D("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=Hs),ke.init(e,t),e._zod.check=r=>{jv(r.value)||r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:e,continue:!t.abort})}}),qm=D("$ZodE164",(e,t)=>{t.pattern??(t.pattern=Op),ke.init(e,t)});function Mv(e,t=null){try{let r=e.split(".");if(r.length!==3)return!1;let[o]=r;if(!o)return!1;let n=JSON.parse(atob(o));return!("typ"in n&&n?.typ!=="JWT"||!n.alg||t&&(!("alg"in n)||n.alg!==t))}catch{return!1}}var Lm=D("$ZodJWT",(e,t)=>{ke.init(e,t),e._zod.check=r=>{Mv(r.value,t.alg)||r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:e,continue:!t.abort})}});var ru=D("$ZodNumber",(e,t)=>{Re.init(e,t),e._zod.pattern=on,e._zod.parse=(r,o)=>{if(t.coerce)try{r.value=Number(r.value)}catch{}let n=r.value;if(typeof n=="number"&&!Number.isNaN(n)&&Number.isFinite(n))return r;let s=typeof n=="number"?Number.isNaN(n)?"NaN":Number.isFinite(n)?void 0:String(n):void 0;return r.issues.push({expected:"number",code:"invalid_type",input:n,inst:e,...s?{received:s}:{}}),r}}),Dm=D("$ZodNumberFormat",(e,t)=>{Vp.init(e,t),ru.init(e,t)}),Um=D("$ZodBoolean",(e,t)=>{Re.init(e,t),e._zod.pattern=qp,e._zod.parse=(r,o)=>{if(t.coerce)try{r.value=!!r.value}catch{}let n=r.value;return typeof n=="boolean"||r.issues.push({expected:"boolean",code:"invalid_type",input:n,inst:e}),r}}),Zm=D("$ZodBigInt",(e,t)=>{Re.init(e,t),e._zod.pattern=Mp,e._zod.parse=(r,o)=>{if(t.coerce)try{r.value=BigInt(r.value)}catch{}return typeof r.value=="bigint"||r.issues.push({expected:"bigint",code:"invalid_type",input:r.value,inst:e}),r}});var Vm=D("$ZodNull",(e,t)=>{Re.init(e,t),e._zod.pattern=Lp,e._zod.values=new Set([null]),e._zod.parse=(r,o)=>{let n=r.value;return n===null||r.issues.push({expected:"null",code:"invalid_type",input:n,inst:e}),r}}),Fm=D("$ZodAny",(e,t)=>{Re.init(e,t),e._zod.parse=r=>r}),Hm=D("$ZodUnknown",(e,t)=>{Re.init(e,t),e._zod.parse=r=>r}),Bm=D("$ZodNever",(e,t)=>{Re.init(e,t),e._zod.parse=(r,o)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:e}),r)});var Jm=D("$ZodDate",(e,t)=>{Re.init(e,t),e._zod.parse=(r,o)=>{if(t.coerce)try{r.value=new Date(r.value)}catch{}let n=r.value,s=n instanceof Date;return s&&!Number.isNaN(n.getTime())||r.issues.push({expected:"date",code:"invalid_type",input:n,...s?{received:"Invalid Date"}:{},inst:e}),r}});function qv(e,t){let r=Is(e._zod.def.checks);if(!r.length)return;let o=Math.min(...r.map(s=>s[0])),n=e._zod.parse;e._zod.parse=(s,i)=>{let c=t(s.value);if(c>o&&!i?.skipChecks&&i?.direction!=="backward"){for(let[a,u]of Is(e._zod.def.checks))if(c>a&&u._zod.def.when(s)){let l=s.issues.length;return u._zod.check(s),s.issues[l].continue=!1,en(s.issues,l,e),s}}return n(s,i)}}var Lv=e=>Array.isArray(e)?e.length:-1;function om(e,t,r){e.issues.length&&t.issues.push(...$t(r,e.issues)),t.value[r]=e.value}var Km=D("$ZodArray",(e,t)=>{Re.init(e,t);let r=Ye.memoizer;r?.attach(e),e._zod.parse=(o,n)=>{let s=o.value;if(!Array.isArray(s))return o.issues.push({expected:"array",code:"invalid_type",input:s,inst:e}),o;o.value=r?r.alloc(e,o,Array(s.length),n):Array(s.length);let i=[],c=n?.abortEarly;for(let a=0;a<s.length;a++){let u=s[a],l=t.element._zod.run({value:u,issues:[]},n);if(l instanceof Promise)i.push(l.then(d=>om(d,o,a)));else if(om(l,o,a),c&&l.issues.length!==0&&lt(l))break}return i.length?Promise.all(i).then(()=>o):o},qv(e,Lv)});function Vs(e,t,r,o,n,s){let i=r in o,c=s==="optional";if(!(!i&&c&&n==="optional")){if(e.issues.length){if(n!==void 0&&c&&!i)return;t.issues.push(...$t(r,e.issues))}if(!i&&n===void 0){e.issues.length||t.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[r]});return}e.value===void 0?(i||n==="defaulted"&&!c)&&(t.value[r]=void 0):t.value[r]=e.value}}var Dv=[];function Gm(e){let t=Object.keys(e.shape),r=Object.getOwnPropertySymbols(e.shape),o=r.length?r:Dv,n=o.length?[...t,...o]:t;for(let i of n)if(!e.shape?.[i]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${String(i)}": expected a Zod schema`);let s=Ac(e.shape);return{...e,allKeys:n,symbolKeys:o,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(s)}}function Wm(e,t,r,o,n,s,i){let c=[],a=n.keySet,u=n.catchall._zod,l=u.def.type,d=u.optin,h=u.optout,_=0;for(let y in t){if(i&&r.issues.length!==_){if(lt(r,_))break;_=r.issues.length}if(a.has(y))continue;if(y==="__proto__"){l==="never"&&c.push(y);continue}if(l==="never"){c.push(y);continue}let z=u.run({value:t[y],issues:[]},o);z instanceof Promise?e.push(z.then(b=>Vs(b,r,y,t,d,h))):Vs(z,r,y,t,d,h)}return c.length&&r.issues.push({code:"unrecognized_keys",keys:c,input:t,inst:s,continue:!0}),e.length?Promise.all(e).then(()=>r):r}var Uv=D("$ZodObject",(e,t)=>{Re.init(e,t);let r=Object.getOwnPropertyDescriptor(t,"shape"),o=r?.get?r.get.raw:t.shape??{};if(o){let u=()=>{let l={...o};return Object.defineProperty(t,"shape",{value:l}),u.raw=l,l};u.raw=o,Object.defineProperty(t,"shape",{get:u})}let n=Dr(()=>Gm(t));_e(e,"propValues",u=>{let l=u.def.shape,d={};for(let h in l){let _=l[h]._zod;if(_.values){Object.prototype.hasOwnProperty.call(d,h)||We(d,h,new Set);for(let y of _.values)d[h].add(y);_.optin!==void 0&&d[h].add(void 0)}}return d});let s=hr,i=t.catchall,c,a=Ye.memoizer;a?.attach(e),e._zod.parse=(u,l)=>{c??(c=n.value);let d=u.value;if(!s(d))return u.issues.push({expected:"object",code:"invalid_type",input:d,inst:e}),u;u.value=a?a.alloc(e,u,{},l):{};let h=[],_=c.shape,y=l?.abortEarly,z=u.issues.length;for(let b of c.allKeys){if(y&&u.issues.length!==z){if(lt(u,z))break;z=u.issues.length}if(b==="__proto__")continue;let g=_[b],P=g._zod.optin,$=g._zod.optout,E=g._zod.run({value:d[b],issues:[]},l);E instanceof Promise?h.push(E.then(k=>Vs(k,u,b,d,P,$))):Vs(E,u,b,d,P,$)}return i?Wm(h,d,u,l,n.value,e,y===!0):h.length?Promise.all(h).then(()=>u):u}}),Ym=D("$ZodObjectJIT",(e,t)=>{Uv.init(e,t);let r=e._zod.parse,o=Dr(()=>Gm(t)),n=Ye.memoizer,s=_=>{let y=o.value,z=y.symbolKeys,b=new Ds(["payload","ctx"],{shape:_,inst:e,memo:n,syms:z}),g=k=>`shape[${k}]._zod.run({ value: input[${k}], issues: [] }, ctx)`,P=(k,v)=>`
7
+ let ${k}_ab = false;
8
+ for (let i = 0; i < ${k}.issues.length; i++) {
9
+ const iss = ${k}.issues[i];
10
+ iss.path = iss.path ? [${v}, ...iss.path] : [${v}];
11
+ payload.issues.push(iss);
12
+ if (iss.continue !== true) ${k}_ab = true;
24
13
  }
25
- } else if (${x}.value === undefined) {
26
- if (${T} in input) newResult[${T}] = undefined;
27
- } else {
28
- newResult[${T}] = ${x}.value;
14
+ if (${k}_ab && ctx && ctx.abortEarly) {
15
+ payload.value = newResult;
16
+ return payload;
17
+ }`;b.write("const input = payload.value;");let $=Object.create(null),E=0;for(let k of y.allKeys)$[k]=`key_${E++}`;b.write(n?"const newResult = memo.alloc(inst, payload, {}, ctx);":"const newResult = {};");for(let k of y.allKeys){if(k==="__proto__")continue;let v=$[k],S=typeof k=="symbol"?`syms[${z.indexOf(k)}]`:Oc(k),T=`${S} in input`,A=_[k],F=A?._zod?.optin,L=F!==void 0,U=A?._zod?.optout==="optional";if(b.write(`const ${v} = ${g(S)};`),L&&U){let K=F==="optional"?`${v}_present`:`${v}.value !== undefined || ${v}_present`;b.write(`
18
+ const ${v}_present = ${T};
19
+ if (!${v}.issues.length || ${v}_present) {
20
+ if (${v}.issues.length) {${P(v,S)}
21
+ }
22
+
23
+ if (${K}) {
24
+ newResult[${S}] = ${v}.value;
25
+ }
26
+ }
27
+
28
+ `)}else L?(b.write(`
29
+ if (${v}.issues.length) {${P(v,S)}
30
+ }
31
+ `),F==="defaulted"?b.write(`newResult[${S}] = ${v}.value;`):b.write(`
32
+ if (${v}.value !== undefined || ${T}) {
33
+ newResult[${S}] = ${v}.value;
34
+ }
35
+ `)):b.write(`
36
+ const ${v}_present = ${T};
37
+ if (${v}.issues.length) {${P(v,S)}
38
+ }
39
+ if (!${v}_present && !${v}.issues.length) {
40
+ payload.issues.push({
41
+ code: "invalid_type",
42
+ expected: "nonoptional",
43
+ input: undefined,
44
+ path: [${S}]
45
+ });
46
+ if (ctx && ctx.abortEarly) {
47
+ payload.value = newResult;
48
+ return payload;
49
+ }
50
+ }
51
+
52
+ if (${v}_present) {
53
+ newResult[${S}] = ${v}.value;
29
54
  }
30
- `)}else{let x=h[$];m.write(`const ${x} = ${g($)};`),m.write(`
31
- if (${x}.issues.length) payload.issues = payload.issues.concat(${x}.issues.map(iss => ({
32
- ...iss,
33
- path: iss.path ? [${bt($)}, ...iss.path] : [${bt($)}]
34
- })));`),m.write(`newResult[${bt($)}] = ${x}.value`)}m.write("payload.value = newResult;"),m.write("return payload;");let w=m.compile();return($,x)=>w(d,$,x)},n,s=Wt,i=!qo.jitless,c=i&&vs.value,l=t.catchall,u;e._zod.parse=(d,m)=>{u??(u=r.value);let f=d.value;if(!s(f))return d.issues.push({expected:"object",code:"invalid_type",input:f,inst:e}),d;let g=[];if(i&&c&&m?.async===!1&&m.jitless!==!0)n||(n=o(t.shape)),d=n(d,m);else{d.value={};let x=u.shape;for(let T of u.keys){let v=x[T],z=v._zod.run({value:f[T],issues:[]},m),C=v._zod.optin==="optional"&&v._zod.optout==="optional";z instanceof Promise?g.push(z.then(J=>C?rl(J,d,T,f):Bo(J,d,T))):C?rl(z,d,T,f):Bo(z,d,T)}}if(!l)return g.length?Promise.all(g).then(()=>d):d;let h=[],_=u.keySet,w=l._zod,$=w.def.type;for(let x of Object.keys(f)){if(_.has(x))continue;if($==="never"){h.push(x);continue}let T=w.run({value:f[x],issues:[]},m);T instanceof Promise?g.push(T.then(v=>Bo(v,d,x))):Bo(T,d,x)}return h.length&&d.issues.push({code:"unrecognized_keys",keys:h,input:f,inst:e}),g.length?Promise.all(g).then(()=>d):d}});function ol(e,t,r,o){for(let n of e)if(n.issues.length===0)return t.value=n.value,t;return t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map(n=>n.issues.map(s=>De(s,o,Ie())))}),t}var Ns=y("$ZodUnion",(e,t)=>{B.init(e,t),Q(e._zod,"optin",()=>t.options.some(r=>r._zod.optin==="optional")?"optional":void 0),Q(e._zod,"optout",()=>t.options.some(r=>r._zod.optout==="optional")?"optional":void 0),Q(e._zod,"values",()=>{if(t.options.every(r=>r._zod.values))return new Set(t.options.flatMap(r=>Array.from(r._zod.values)))}),Q(e._zod,"pattern",()=>{if(t.options.every(r=>r._zod.pattern)){let r=t.options.map(o=>o._zod.pattern);return new RegExp(`^(${r.map(o=>Tr(o.source)).join("|")})$`)}}),e._zod.parse=(r,o)=>{let n=!1,s=[];for(let i of t.options){let a=i._zod.run({value:r.value,issues:[]},o);if(a instanceof Promise)s.push(a),n=!0;else{if(a.issues.length===0)return a;s.push(a)}}return n?Promise.all(s).then(i=>ol(i,r,e,o)):ol(s,r,e,o)}}),Vl=y("$ZodDiscriminatedUnion",(e,t)=>{Ns.init(e,t);let r=e._zod.parse;Q(e._zod,"propValues",()=>{let n={};for(let s of t.options){let i=s._zod.propValues;if(!i||Object.keys(i).length===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(s)}"`);for(let[a,c]of Object.entries(i)){n[a]||(n[a]=new Set);for(let l of c)n[a].add(l)}}return n});let o=Pr(()=>{let n=t.options,s=new Map;for(let i of n){let a=i._zod.propValues[t.discriminator];if(!a||a.size===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(i)}"`);for(let c of a){if(s.has(c))throw new Error(`Duplicate discriminator value "${String(c)}"`);s.set(c,i)}}return s});e._zod.parse=(n,s)=>{let i=n.value;if(!Wt(i))return n.issues.push({code:"invalid_type",expected:"object",input:i,inst:e}),n;let a=o.value.get(i?.[t.discriminator]);return a?a._zod.run(n,s):t.unionFallback?r(n,s):(n.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",input:i,path:[t.discriminator],inst:e}),n)}}),Hl=y("$ZodIntersection",(e,t)=>{B.init(e,t),e._zod.parse=(r,o)=>{let n=r.value,s=t.left._zod.run({value:n,issues:[]},o),i=t.right._zod.run({value:n,issues:[]},o);return s instanceof Promise||i instanceof Promise?Promise.all([s,i]).then(([c,l])=>nl(r,c,l)):nl(r,s,i)}});function Cs(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(Gt(e)&&Gt(t)){let r=Object.keys(t),o=Object.keys(e).filter(s=>r.indexOf(s)!==-1),n={...e,...t};for(let s of o){let i=Cs(e[s],t[s]);if(!i.valid)return{valid:!1,mergeErrorPath:[s,...i.mergeErrorPath]};n[s]=i.data}return{valid:!0,data:n}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let r=[];for(let o=0;o<e.length;o++){let n=e[o],s=t[o],i=Cs(n,s);if(!i.valid)return{valid:!1,mergeErrorPath:[o,...i.mergeErrorPath]};r.push(i.data)}return{valid:!0,data:r}}return{valid:!1,mergeErrorPath:[]}}function nl(e,t,r){if(t.issues.length&&e.issues.push(...t.issues),r.issues.length&&e.issues.push(...r.issues),zt(e))return e;let o=Cs(t.value,r.value);if(!o.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(o.mergeErrorPath)}`);return e.value=o.data,e}var Bl=y("$ZodRecord",(e,t)=>{B.init(e,t),e._zod.parse=(r,o)=>{let n=r.value;if(!Gt(n))return r.issues.push({expected:"record",code:"invalid_type",input:n,inst:e}),r;let s=[];if(t.keyType._zod.values){let i=t.keyType._zod.values;r.value={};for(let c of i)if(typeof c=="string"||typeof c=="number"||typeof c=="symbol"){let l=t.valueType._zod.run({value:n[c],issues:[]},o);l instanceof Promise?s.push(l.then(u=>{u.issues.length&&r.issues.push(...We(c,u.issues)),r.value[c]=u.value})):(l.issues.length&&r.issues.push(...We(c,l.issues)),r.value[c]=l.value)}let a;for(let c in n)i.has(c)||(a=a??[],a.push(c));a&&a.length>0&&r.issues.push({code:"unrecognized_keys",input:n,inst:e,keys:a})}else{r.value={};for(let i of Reflect.ownKeys(n)){if(i==="__proto__")continue;let a=t.keyType._zod.run({value:i,issues:[]},o);if(a instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(a.issues.length){r.issues.push({origin:"record",code:"invalid_key",issues:a.issues.map(l=>De(l,o,Ie())),input:i,path:[i],inst:e}),r.value[a.value]=a.value;continue}let c=t.valueType._zod.run({value:n[i],issues:[]},o);c instanceof Promise?s.push(c.then(l=>{l.issues.length&&r.issues.push(...We(i,l.issues)),r.value[a.value]=l.value})):(c.issues.length&&r.issues.push(...We(i,c.issues)),r.value[a.value]=c.value)}}return s.length?Promise.all(s).then(()=>r):r}});var Kl=y("$ZodEnum",(e,t)=>{B.init(e,t);let r=hs(t.entries);e._zod.values=new Set(r),e._zod.pattern=new RegExp(`^(${r.filter(o=>ws.has(typeof o)).map(o=>typeof o=="string"?dt(o):o.toString()).join("|")})$`),e._zod.parse=(o,n)=>{let s=o.value;return e._zod.values.has(s)||o.issues.push({code:"invalid_value",values:r,input:s,inst:e}),o}}),Wl=y("$ZodLiteral",(e,t)=>{B.init(e,t),e._zod.values=new Set(t.values),e._zod.pattern=new RegExp(`^(${t.values.map(r=>typeof r=="string"?dt(r):r?r.toString():String(r)).join("|")})$`),e._zod.parse=(r,o)=>{let n=r.value;return e._zod.values.has(n)||r.issues.push({code:"invalid_value",values:t.values,input:n,inst:e}),r}});var Gl=y("$ZodTransform",(e,t)=>{B.init(e,t),e._zod.parse=(r,o)=>{let n=t.transform(r.value,r);if(o.async)return(n instanceof Promise?n:Promise.resolve(n)).then(i=>(r.value=i,r));if(n instanceof Promise)throw new et;return r.value=n,r}}),Jl=y("$ZodOptional",(e,t)=>{B.init(e,t),e._zod.optin="optional",e._zod.optout="optional",Q(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),Q(e._zod,"pattern",()=>{let r=t.innerType._zod.pattern;return r?new RegExp(`^(${Tr(r.source)})?$`):void 0}),e._zod.parse=(r,o)=>t.innerType._zod.optin==="optional"?t.innerType._zod.run(r,o):r.value===void 0?r:t.innerType._zod.run(r,o)}),Ql=y("$ZodNullable",(e,t)=>{B.init(e,t),Q(e._zod,"optin",()=>t.innerType._zod.optin),Q(e._zod,"optout",()=>t.innerType._zod.optout),Q(e._zod,"pattern",()=>{let r=t.innerType._zod.pattern;return r?new RegExp(`^(${Tr(r.source)}|null)$`):void 0}),Q(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(r,o)=>r.value===null?r:t.innerType._zod.run(r,o)}),Yl=y("$ZodDefault",(e,t)=>{B.init(e,t),e._zod.optin="optional",Q(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,o)=>{if(r.value===void 0)return r.value=t.defaultValue,r;let n=t.innerType._zod.run(r,o);return n instanceof Promise?n.then(s=>sl(s,t)):sl(n,t)}});function sl(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}var Xl=y("$ZodPrefault",(e,t)=>{B.init(e,t),e._zod.optin="optional",Q(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,o)=>(r.value===void 0&&(r.value=t.defaultValue),t.innerType._zod.run(r,o))}),ed=y("$ZodNonOptional",(e,t)=>{B.init(e,t),Q(e._zod,"values",()=>{let r=t.innerType._zod.values;return r?new Set([...r].filter(o=>o!==void 0)):void 0}),e._zod.parse=(r,o)=>{let n=t.innerType._zod.run(r,o);return n instanceof Promise?n.then(s=>il(s,e)):il(n,e)}});function il(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}var td=y("$ZodCatch",(e,t)=>{B.init(e,t),e._zod.optin="optional",Q(e._zod,"optout",()=>t.innerType._zod.optout),Q(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,o)=>{let n=t.innerType._zod.run(r,o);return n instanceof Promise?n.then(s=>(r.value=s.value,s.issues.length&&(r.value=t.catchValue({...r,error:{issues:s.issues.map(i=>De(i,o,Ie()))},input:r.value}),r.issues=[]),r)):(r.value=n.value,n.issues.length&&(r.value=t.catchValue({...r,error:{issues:n.issues.map(s=>De(s,o,Ie()))},input:r.value}),r.issues=[]),r)}});var rd=y("$ZodPipe",(e,t)=>{B.init(e,t),Q(e._zod,"values",()=>t.in._zod.values),Q(e._zod,"optin",()=>t.in._zod.optin),Q(e._zod,"optout",()=>t.out._zod.optout),e._zod.parse=(r,o)=>{let n=t.in._zod.run(r,o);return n instanceof Promise?n.then(s=>al(s,t,o)):al(n,t,o)}});function al(e,t,r){return zt(e)?e:t.out._zod.run({value:e.value,issues:e.issues},r)}var od=y("$ZodReadonly",(e,t)=>{B.init(e,t),Q(e._zod,"propValues",()=>t.innerType._zod.propValues),Q(e._zod,"values",()=>t.innerType._zod.values),Q(e._zod,"optin",()=>t.innerType._zod.optin),Q(e._zod,"optout",()=>t.innerType._zod.optout),e._zod.parse=(r,o)=>{let n=t.innerType._zod.run(r,o);return n instanceof Promise?n.then(cl):cl(n)}});function cl(e){return e.value=Object.freeze(e.value),e}var nd=y("$ZodCustom",(e,t)=>{ye.init(e,t),B.init(e,t),e._zod.parse=(r,o)=>r,e._zod.check=r=>{let o=r.value,n=t.fn(o);if(n instanceof Promise)return n.then(s=>ul(s,r,o,e));ul(n,r,o,e)}});function ul(e,t,r,o){if(!e){let n={code:"custom",input:r,inst:o,path:[...o._zod.def.path??[]],continue:!o._zod.def.abort};o._zod.def.params&&(n.params=o._zod.def.params),t.issues.push(bs(n))}}var L_=e=>{let t=typeof e;switch(t){case"number":return Number.isNaN(e)?"NaN":"number";case"object":{if(Array.isArray(e))return"array";if(e===null)return"null";if(Object.getPrototypeOf(e)!==Object.prototype&&e.constructor)return e.constructor.name}}return t},F_=()=>{let e={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"}};function t(o){return e[o]??null}let r={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",jwt:"JWT",template_literal:"input"};return o=>{switch(o.code){case"invalid_type":return`Invalid input: expected ${o.expected}, received ${L_(o.input)}`;case"invalid_value":return o.values.length===1?`Invalid input: expected ${Uo(o.values[0])}`:`Invalid option: expected one of ${Mo(o.values,"|")}`;case"too_big":{let n=o.inclusive?"<=":"<",s=t(o.origin);return s?`Too big: expected ${o.origin??"value"} to have ${n}${o.maximum.toString()} ${s.unit??"elements"}`:`Too big: expected ${o.origin??"value"} to be ${n}${o.maximum.toString()}`}case"too_small":{let n=o.inclusive?">=":">",s=t(o.origin);return s?`Too small: expected ${o.origin} to have ${n}${o.minimum.toString()} ${s.unit}`:`Too small: expected ${o.origin} to be ${n}${o.minimum.toString()}`}case"invalid_format":{let n=o;return n.format==="starts_with"?`Invalid string: must start with "${n.prefix}"`:n.format==="ends_with"?`Invalid string: must end with "${n.suffix}"`:n.format==="includes"?`Invalid string: must include "${n.includes}"`:n.format==="regex"?`Invalid string: must match pattern ${n.pattern}`:`Invalid ${r[n.format]??o.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${o.divisor}`;case"unrecognized_keys":return`Unrecognized key${o.keys.length>1?"s":""}: ${Mo(o.keys,", ")}`;case"invalid_key":return`Invalid key in ${o.origin}`;case"invalid_union":return"Invalid input";case"invalid_element":return`Invalid value in ${o.origin}`;default:return"Invalid input"}}};function sd(){return{localeError:F_()}}var V_=Symbol("ZodOutput"),H_=Symbol("ZodInput"),js=class{constructor(){this._map=new Map,this._idmap=new Map}add(t,...r){let o=r[0];if(this._map.set(t,o),o&&typeof o=="object"&&"id"in o){if(this._idmap.has(o.id))throw new Error(`ID ${o.id} already exists in the registry`);this._idmap.set(o.id,t)}return this}clear(){return this._map=new Map,this._idmap=new Map,this}remove(t){let r=this._map.get(t);return r&&typeof r=="object"&&"id"in r&&this._idmap.delete(r.id),this._map.delete(t),this}get(t){let r=t._zod.parent;if(r){let o={...this.get(r)??{}};return delete o.id,{...o,...this._map.get(t)}}return this._map.get(t)}has(t){return this._map.has(t)}};function id(){return new js}var Jt=id();function ad(e,t){return new e({type:"string",...R(t)})}function cd(e,t){return new e({type:"string",coerce:!0,...R(t)})}function ud(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...R(t)})}function Zs(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...R(t)})}function ld(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...R(t)})}function dd(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...R(t)})}function pd(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...R(t)})}function fd(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...R(t)})}function qs(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...R(t)})}function md(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...R(t)})}function hd(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...R(t)})}function gd(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...R(t)})}function _d(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...R(t)})}function yd(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...R(t)})}function vd(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...R(t)})}function wd(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...R(t)})}function $d(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...R(t)})}function xd(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...R(t)})}function bd(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...R(t)})}function zd(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...R(t)})}function Sd(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...R(t)})}function kd(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...R(t)})}function Pd(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...R(t)})}function Ed(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...R(t)})}function Td(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...R(t)})}function Rd(e,t){return new e({type:"string",format:"date",check:"string_format",...R(t)})}function Id(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...R(t)})}function Od(e,t){return new e({type:"string",format:"duration",check:"string_format",...R(t)})}function Cd(e,t){return new e({type:"number",checks:[],...R(t)})}function Ad(e,t){return new e({type:"number",coerce:!0,checks:[],...R(t)})}function Nd(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...R(t)})}function jd(e,t){return new e({type:"boolean",...R(t)})}function Zd(e,t){return new e({type:"boolean",coerce:!0,...R(t)})}function qd(e,t){return new e({type:"bigint",coerce:!0,...R(t)})}function Md(e,t){return new e({type:"null",...R(t)})}function Dd(e){return new e({type:"any"})}function Ud(e){return new e({type:"unknown"})}function Ld(e,t){return new e({type:"never",...R(t)})}function Fd(e,t){return new e({type:"date",coerce:!0,...R(t)})}function Qt(e,t){return new Is({check:"less_than",...R(t),value:e,inclusive:!1})}function tt(e,t){return new Is({check:"less_than",...R(t),value:e,inclusive:!0})}function Yt(e,t){return new Os({check:"greater_than",...R(t),value:e,inclusive:!1})}function Ue(e,t){return new Os({check:"greater_than",...R(t),value:e,inclusive:!0})}function Cr(e,t){return new Uu({check:"multiple_of",...R(t),value:e})}function Wo(e,t){return new Fu({check:"max_length",...R(t),maximum:e})}function Xt(e,t){return new Vu({check:"min_length",...R(t),minimum:e})}function Go(e,t){return new Hu({check:"length_equals",...R(t),length:e})}function Ms(e,t){return new Bu({check:"string_format",format:"regex",...R(t),pattern:e})}function Ds(e){return new Ku({check:"string_format",format:"lowercase",...R(e)})}function Us(e){return new Wu({check:"string_format",format:"uppercase",...R(e)})}function Ls(e,t){return new Gu({check:"string_format",format:"includes",...R(t),includes:e})}function Fs(e,t){return new Ju({check:"string_format",format:"starts_with",...R(t),prefix:e})}function Vs(e,t){return new Qu({check:"string_format",format:"ends_with",...R(t),suffix:e})}function St(e){return new Yu({check:"overwrite",tx:e})}function Hs(e){return St(t=>t.normalize(e))}function Bs(){return St(e=>e.trim())}function Ks(){return St(e=>e.toLowerCase())}function Ws(){return St(e=>e.toUpperCase())}function Vd(e,t,r){return new e({type:"array",element:t,...R(r)})}function Hd(e,t,r){let o=R(r);return o.abort??(o.abort=!0),new e({type:"custom",check:"custom",fn:t,...o})}function Bd(e,t,r){return new e({type:"custom",check:"custom",fn:t,...R(r)})}function Jo(e){return!!e._zod}function Le(e,t){return Jo(e)?Ir(e,t):e.safeParse(t)}function Qo(e){if(!e)return;let t;if(Jo(e)?t=e._zod?.def?.shape:t=e.shape,!!t){if(typeof t=="function")try{return t()}catch{return}return t}}function Yo(e){if(Jo(e)){let s=e._zod?.def;if(s){if(s.value!==void 0)return s.value;if(Array.isArray(s.values)&&s.values.length>0)return s.values[0]}}let r=e._def;if(r){if(r.value!==void 0)return r.value;if(Array.isArray(r.values)&&r.values.length>0)return r.values[0]}let o=e.value;if(o!==void 0)return o}var Ar={};ds(Ar,{ZodISODate:()=>Wd,ZodISODateTime:()=>Kd,ZodISODuration:()=>Jd,ZodISOTime:()=>Gd,date:()=>Js,datetime:()=>Gs,duration:()=>Ys,time:()=>Qs});var Kd=y("ZodISODateTime",(e,t)=>{$l.init(e,t),ne.init(e,t)});function Gs(e){return Td(Kd,e)}var Wd=y("ZodISODate",(e,t)=>{xl.init(e,t),ne.init(e,t)});function Js(e){return Rd(Wd,e)}var Gd=y("ZodISOTime",(e,t)=>{bl.init(e,t),ne.init(e,t)});function Qs(e){return Id(Gd,e)}var Jd=y("ZodISODuration",(e,t)=>{zl.init(e,t),ne.init(e,t)});function Ys(e){return Od(Jd,e)}var Yd=(e,t)=>{Lo.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:r=>ks(e,r)},flatten:{value:r=>Ss(e,r)},addIssue:{value:r=>e.issues.push(r)},addIssues:{value:r=>e.issues.push(...r)},isEmpty:{get(){return e.issues.length===0}}})},WP=y("ZodError",Yd),Nr=y("ZodError",Yd,{Parent:Error});var Xd=cu(Nr),ep=uu(Nr),tp=Ps(Nr),rp=Es(Nr);var Y=y("ZodType",(e,t)=>(B.init(e,t),e.def=t,Object.defineProperty(e,"_def",{value:t}),e.check=(...r)=>e.clone({...t,checks:[...t.checks??[],...r.map(o=>typeof o=="function"?{_zod:{check:o,def:{check:"custom"},onattach:[]}}:o)]}),e.clone=(r,o)=>Me(e,r,o),e.brand=()=>e,e.register=((r,o)=>(r.add(e,o),e)),e.parse=(r,o)=>Xd(e,r,o,{callee:e.parse}),e.safeParse=(r,o)=>tp(e,r,o),e.parseAsync=async(r,o)=>ep(e,r,o,{callee:e.parseAsync}),e.safeParseAsync=async(r,o)=>rp(e,r,o),e.spa=e.safeParseAsync,e.refine=(r,o)=>e.check(My(r,o)),e.superRefine=r=>e.check(Dy(r)),e.overwrite=r=>e.check(St(r)),e.optional=()=>ie(e),e.nullable=()=>sp(e),e.nullish=()=>ie(sp(e)),e.nonoptional=r=>Oy(e,r),e.array=()=>S(e),e.or=r=>te([e,r]),e.and=r=>tn(e,r),e.transform=r=>ei(e,hp(r)),e.default=r=>Ty(e,r),e.prefault=r=>Iy(e,r),e.catch=r=>Ay(e,r),e.pipe=r=>ei(e,r),e.readonly=()=>Zy(e),e.describe=r=>{let o=e.clone();return Jt.add(o,{description:r}),o},Object.defineProperty(e,"description",{get(){return Jt.get(e)?.description},configurable:!0}),e.meta=(...r)=>{if(r.length===0)return Jt.get(e);let o=e.clone();return Jt.add(o,r[0]),o},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e)),ip=y("_ZodString",(e,t)=>{Ko.init(e,t),Y.init(e,t);let r=e._zod.bag;e.format=r.format??null,e.minLength=r.minimum??null,e.maxLength=r.maximum??null,e.regex=(...o)=>e.check(Ms(...o)),e.includes=(...o)=>e.check(Ls(...o)),e.startsWith=(...o)=>e.check(Fs(...o)),e.endsWith=(...o)=>e.check(Vs(...o)),e.min=(...o)=>e.check(Xt(...o)),e.max=(...o)=>e.check(Wo(...o)),e.length=(...o)=>e.check(Go(...o)),e.nonempty=(...o)=>e.check(Xt(1,...o)),e.lowercase=o=>e.check(Ds(o)),e.uppercase=o=>e.check(Us(o)),e.trim=()=>e.check(Bs()),e.normalize=(...o)=>e.check(Hs(...o)),e.toLowerCase=()=>e.check(Ks()),e.toUpperCase=()=>e.check(Ws())}),ti=y("ZodString",(e,t)=>{Ko.init(e,t),ip.init(e,t),e.email=r=>e.check(ud(X_,r)),e.url=r=>e.check(qs(ap,r)),e.jwt=r=>e.check(Ed(my,r)),e.emoji=r=>e.check(md(ey,r)),e.guid=r=>e.check(Zs(op,r)),e.uuid=r=>e.check(ld(Xo,r)),e.uuidv4=r=>e.check(dd(Xo,r)),e.uuidv6=r=>e.check(pd(Xo,r)),e.uuidv7=r=>e.check(fd(Xo,r)),e.nanoid=r=>e.check(hd(ty,r)),e.guid=r=>e.check(Zs(op,r)),e.cuid=r=>e.check(gd(ry,r)),e.cuid2=r=>e.check(_d(oy,r)),e.ulid=r=>e.check(yd(ny,r)),e.base64=r=>e.check(Sd(dy,r)),e.base64url=r=>e.check(kd(py,r)),e.xid=r=>e.check(vd(sy,r)),e.ksuid=r=>e.check(wd(iy,r)),e.ipv4=r=>e.check($d(ay,r)),e.ipv6=r=>e.check(xd(cy,r)),e.cidrv4=r=>e.check(bd(uy,r)),e.cidrv6=r=>e.check(zd(ly,r)),e.e164=r=>e.check(Pd(fy,r)),e.datetime=r=>e.check(Gs(r)),e.date=r=>e.check(Js(r)),e.time=r=>e.check(Qs(r)),e.duration=r=>e.check(Ys(r))});function p(e){return ad(ti,e)}var ne=y("ZodStringFormat",(e,t)=>{ee.init(e,t),ip.init(e,t)}),X_=y("ZodEmail",(e,t)=>{pl.init(e,t),ne.init(e,t)});var op=y("ZodGUID",(e,t)=>{ll.init(e,t),ne.init(e,t)});var Xo=y("ZodUUID",(e,t)=>{dl.init(e,t),ne.init(e,t)});var ap=y("ZodURL",(e,t)=>{fl.init(e,t),ne.init(e,t)});function cp(e){return qs(ap,e)}var ey=y("ZodEmoji",(e,t)=>{ml.init(e,t),ne.init(e,t)});var ty=y("ZodNanoID",(e,t)=>{hl.init(e,t),ne.init(e,t)});var ry=y("ZodCUID",(e,t)=>{gl.init(e,t),ne.init(e,t)});var oy=y("ZodCUID2",(e,t)=>{_l.init(e,t),ne.init(e,t)});var ny=y("ZodULID",(e,t)=>{yl.init(e,t),ne.init(e,t)});var sy=y("ZodXID",(e,t)=>{vl.init(e,t),ne.init(e,t)});var iy=y("ZodKSUID",(e,t)=>{wl.init(e,t),ne.init(e,t)});var ay=y("ZodIPv4",(e,t)=>{Sl.init(e,t),ne.init(e,t)});var cy=y("ZodIPv6",(e,t)=>{kl.init(e,t),ne.init(e,t)});var uy=y("ZodCIDRv4",(e,t)=>{Pl.init(e,t),ne.init(e,t)});var ly=y("ZodCIDRv6",(e,t)=>{El.init(e,t),ne.init(e,t)});var dy=y("ZodBase64",(e,t)=>{Rl.init(e,t),ne.init(e,t)});var py=y("ZodBase64URL",(e,t)=>{Il.init(e,t),ne.init(e,t)});var fy=y("ZodE164",(e,t)=>{Ol.init(e,t),ne.init(e,t)});var my=y("ZodJWT",(e,t)=>{Cl.init(e,t),ne.init(e,t)});var en=y("ZodNumber",(e,t)=>{As.init(e,t),Y.init(e,t),e.gt=(o,n)=>e.check(Yt(o,n)),e.gte=(o,n)=>e.check(Ue(o,n)),e.min=(o,n)=>e.check(Ue(o,n)),e.lt=(o,n)=>e.check(Qt(o,n)),e.lte=(o,n)=>e.check(tt(o,n)),e.max=(o,n)=>e.check(tt(o,n)),e.int=o=>e.check(np(o)),e.safe=o=>e.check(np(o)),e.positive=o=>e.check(Yt(0,o)),e.nonnegative=o=>e.check(Ue(0,o)),e.negative=o=>e.check(Qt(0,o)),e.nonpositive=o=>e.check(tt(0,o)),e.multipleOf=(o,n)=>e.check(Cr(o,n)),e.step=(o,n)=>e.check(Cr(o,n)),e.finite=()=>e;let r=e._zod.bag;e.minValue=Math.max(r.minimum??Number.NEGATIVE_INFINITY,r.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(r.maximum??Number.POSITIVE_INFINITY,r.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(r.format??"").includes("int")||Number.isSafeInteger(r.multipleOf??.5),e.isFinite=!0,e.format=r.format??null});function F(e){return Cd(en,e)}var hy=y("ZodNumberFormat",(e,t)=>{Al.init(e,t),en.init(e,t)});function np(e){return Nd(hy,e)}var ri=y("ZodBoolean",(e,t)=>{Nl.init(e,t),Y.init(e,t)});function W(e){return jd(ri,e)}var up=y("ZodBigInt",(e,t)=>{jl.init(e,t),Y.init(e,t),e.gte=(o,n)=>e.check(Ue(o,n)),e.min=(o,n)=>e.check(Ue(o,n)),e.gt=(o,n)=>e.check(Yt(o,n)),e.gte=(o,n)=>e.check(Ue(o,n)),e.min=(o,n)=>e.check(Ue(o,n)),e.lt=(o,n)=>e.check(Qt(o,n)),e.lte=(o,n)=>e.check(tt(o,n)),e.max=(o,n)=>e.check(tt(o,n)),e.positive=o=>e.check(Yt(BigInt(0),o)),e.negative=o=>e.check(Qt(BigInt(0),o)),e.nonpositive=o=>e.check(tt(BigInt(0),o)),e.nonnegative=o=>e.check(Ue(BigInt(0),o)),e.multipleOf=(o,n)=>e.check(Cr(o,n));let r=e._zod.bag;e.minValue=r.minimum??null,e.maxValue=r.maximum??null,e.format=r.format??null});var gy=y("ZodNull",(e,t)=>{Zl.init(e,t),Y.init(e,t)});function lp(e){return Md(gy,e)}var _y=y("ZodAny",(e,t)=>{ql.init(e,t),Y.init(e,t)});function dp(){return Dd(_y)}var yy=y("ZodUnknown",(e,t)=>{Ml.init(e,t),Y.init(e,t)});function se(){return Ud(yy)}var vy=y("ZodNever",(e,t)=>{Dl.init(e,t),Y.init(e,t)});function wy(e){return Ld(vy,e)}var pp=y("ZodDate",(e,t)=>{Ul.init(e,t),Y.init(e,t),e.min=(o,n)=>e.check(Ue(o,n)),e.max=(o,n)=>e.check(tt(o,n));let r=e._zod.bag;e.minDate=r.minimum?new Date(r.minimum):null,e.maxDate=r.maximum?new Date(r.maximum):null});var $y=y("ZodArray",(e,t)=>{Ll.init(e,t),Y.init(e,t),e.element=t.element,e.min=(r,o)=>e.check(Xt(r,o)),e.nonempty=r=>e.check(Xt(1,r)),e.max=(r,o)=>e.check(Wo(r,o)),e.length=(r,o)=>e.check(Go(r,o)),e.unwrap=()=>e.element});function S(e,t){return Vd($y,e,t)}var fp=y("ZodObject",(e,t)=>{Fl.init(e,t),Y.init(e,t),H.defineLazy(e,"shape",()=>t.shape),e.keyof=()=>Se(Object.keys(e._zod.def.shape)),e.catchall=r=>e.clone({...e._zod.def,catchall:r}),e.passthrough=()=>e.clone({...e._zod.def,catchall:se()}),e.loose=()=>e.clone({...e._zod.def,catchall:se()}),e.strict=()=>e.clone({...e._zod.def,catchall:wy()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=r=>H.extend(e,r),e.merge=r=>H.merge(e,r),e.pick=r=>H.pick(e,r),e.omit=r=>H.omit(e,r),e.partial=(...r)=>H.partial(gp,e,r[0]),e.required=(...r)=>H.required(_p,e,r[0])});function k(e,t){let r={type:"object",get shape(){return H.assignProp(this,"shape",{...e}),this.shape},...H.normalizeParams(t)};return new fp(r)}function le(e,t){return new fp({type:"object",get shape(){return H.assignProp(this,"shape",{...e}),this.shape},catchall:se(),...H.normalizeParams(t)})}var mp=y("ZodUnion",(e,t)=>{Ns.init(e,t),Y.init(e,t),e.options=t.options});function te(e,t){return new mp({type:"union",options:e,...H.normalizeParams(t)})}var xy=y("ZodDiscriminatedUnion",(e,t)=>{mp.init(e,t),Vl.init(e,t)});function oi(e,t,r){return new xy({type:"union",options:t,discriminator:e,...H.normalizeParams(r)})}var by=y("ZodIntersection",(e,t)=>{Hl.init(e,t),Y.init(e,t)});function tn(e,t){return new by({type:"intersection",left:e,right:t})}var zy=y("ZodRecord",(e,t)=>{Bl.init(e,t),Y.init(e,t),e.keyType=t.keyType,e.valueType=t.valueType});function X(e,t,r){return new zy({type:"record",keyType:e,valueType:t,...H.normalizeParams(r)})}var Xs=y("ZodEnum",(e,t)=>{Kl.init(e,t),Y.init(e,t),e.enum=t.entries,e.options=Object.values(t.entries);let r=new Set(Object.keys(t.entries));e.extract=(o,n)=>{let s={};for(let i of o)if(r.has(i))s[i]=t.entries[i];else throw new Error(`Key ${i} not found in enum`);return new Xs({...t,checks:[],...H.normalizeParams(n),entries:s})},e.exclude=(o,n)=>{let s={...t.entries};for(let i of o)if(r.has(i))delete s[i];else throw new Error(`Key ${i} not found in enum`);return new Xs({...t,checks:[],...H.normalizeParams(n),entries:s})}});function Se(e,t){let r=Array.isArray(e)?Object.fromEntries(e.map(o=>[o,o])):e;return new Xs({type:"enum",entries:r,...H.normalizeParams(t)})}var Sy=y("ZodLiteral",(e,t)=>{Wl.init(e,t),Y.init(e,t),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function P(e,t){return new Sy({type:"literal",values:Array.isArray(e)?e:[e],...H.normalizeParams(t)})}var ky=y("ZodTransform",(e,t)=>{Gl.init(e,t),Y.init(e,t),e._zod.parse=(r,o)=>{r.addIssue=s=>{if(typeof s=="string")r.issues.push(H.issue(s,r.value,t));else{let i=s;i.fatal&&(i.continue=!1),i.code??(i.code="custom"),i.input??(i.input=r.value),i.inst??(i.inst=e),i.continue??(i.continue=!0),r.issues.push(H.issue(i))}};let n=t.transform(r.value,r);return n instanceof Promise?n.then(s=>(r.value=s,r)):(r.value=n,r)}});function hp(e){return new ky({type:"transform",transform:e})}var gp=y("ZodOptional",(e,t)=>{Jl.init(e,t),Y.init(e,t),e.unwrap=()=>e._zod.def.innerType});function ie(e){return new gp({type:"optional",innerType:e})}var Py=y("ZodNullable",(e,t)=>{Ql.init(e,t),Y.init(e,t),e.unwrap=()=>e._zod.def.innerType});function sp(e){return new Py({type:"nullable",innerType:e})}var Ey=y("ZodDefault",(e,t)=>{Yl.init(e,t),Y.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Ty(e,t){return new Ey({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():t}})}var Ry=y("ZodPrefault",(e,t)=>{Xl.init(e,t),Y.init(e,t),e.unwrap=()=>e._zod.def.innerType});function Iy(e,t){return new Ry({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():t}})}var _p=y("ZodNonOptional",(e,t)=>{ed.init(e,t),Y.init(e,t),e.unwrap=()=>e._zod.def.innerType});function Oy(e,t){return new _p({type:"nonoptional",innerType:e,...H.normalizeParams(t)})}var Cy=y("ZodCatch",(e,t)=>{td.init(e,t),Y.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Ay(e,t){return new Cy({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}var Ny=y("ZodPipe",(e,t)=>{rd.init(e,t),Y.init(e,t),e.in=t.in,e.out=t.out});function ei(e,t){return new Ny({type:"pipe",in:e,out:t})}var jy=y("ZodReadonly",(e,t)=>{od.init(e,t),Y.init(e,t)});function Zy(e){return new jy({type:"readonly",innerType:e})}var yp=y("ZodCustom",(e,t)=>{nd.init(e,t),Y.init(e,t)});function qy(e){let t=new ye({check:"custom"});return t._zod.check=e,t}function vp(e,t){return Hd(yp,e??(()=>!0),t)}function My(e,t={}){return Bd(yp,e,t)}function Dy(e){let t=qy(r=>(r.addIssue=o=>{if(typeof o=="string")r.issues.push(H.issue(o,r.value,t._zod.def));else{let n=o;n.fatal&&(n.continue=!1),n.code??(n.code="custom"),n.input??(n.input=r.value),n.inst??(n.inst=t),n.continue??(n.continue=!t._zod.def.abort),r.issues.push(H.issue(n))}},e(r.value,r)));return t}function ni(e,t){return ei(hp(e),t)}var wp={invalid_type:"invalid_type",too_big:"too_big",too_small:"too_small",invalid_format:"invalid_format",not_multiple_of:"not_multiple_of",unrecognized_keys:"unrecognized_keys",invalid_union:"invalid_union",invalid_key:"invalid_key",invalid_element:"invalid_element",invalid_value:"invalid_value",custom:"custom"};var rn={};ds(rn,{bigint:()=>Vy,boolean:()=>Fy,date:()=>Hy,number:()=>Ly,string:()=>Uy});function Uy(e){return cd(ti,e)}function Ly(e){return Ad(en,e)}function Fy(e){return Zd(ri,e)}function Vy(e){return qd(up,e)}function Hy(e){return Fd(pp,e)}Ie(sd());var rr="2025-11-25";var $p=[rr,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],pt="io.modelcontextprotocol/related-task",nn="2.0",de=vp(e=>e!==null&&(typeof e=="object"||typeof e=="function")),xp=te([p(),F().int()]),bp=p(),LE=le({ttl:F().optional(),pollInterval:F().optional()}),Ky=k({ttl:F().optional()}),Wy=k({taskId:p()}),ii=le({progressToken:xp.optional(),[pt]:Wy.optional()}),Oe=k({_meta:ii.optional()}),jr=Oe.extend({task:Ky.optional()}),zp=e=>jr.safeParse(e).success,pe=k({method:p(),params:Oe.loose().optional()}),Ce=k({_meta:ii.optional()}),Ae=k({method:p(),params:Ce.loose().optional()}),fe=le({_meta:ii.optional()}),sn=te([p(),F().int()]),Sp=k({jsonrpc:P(nn),id:sn,...pe.shape}).strict(),Zr=e=>Sp.safeParse(e).success,kp=k({jsonrpc:P(nn),...Ae.shape}).strict(),Pp=e=>kp.safeParse(e).success,ai=k({jsonrpc:P(nn),id:sn,result:fe}).strict(),kt=e=>ai.safeParse(e).success;var O;(function(e){e[e.ConnectionClosed=-32e3]="ConnectionClosed",e[e.RequestTimeout=-32001]="RequestTimeout",e[e.ParseError=-32700]="ParseError",e[e.InvalidRequest=-32600]="InvalidRequest",e[e.MethodNotFound=-32601]="MethodNotFound",e[e.InvalidParams=-32602]="InvalidParams",e[e.InternalError=-32603]="InternalError",e[e.UrlElicitationRequired=-32042]="UrlElicitationRequired"})(O||(O={}));var ci=k({jsonrpc:P(nn),id:sn.optional(),error:k({code:F().int(),message:p(),data:se().optional()})}).strict();var Ep=e=>ci.safeParse(e).success;var or=te([Sp,kp,ai,ci]),FE=te([ai,ci]),Pt=fe.strict(),Gy=Ce.extend({requestId:sn.optional(),reason:p().optional()}),an=Ae.extend({method:P("notifications/cancelled"),params:Gy}),Jy=k({src:p(),mimeType:p().optional(),sizes:S(p()).optional(),theme:Se(["light","dark"]).optional()}),qr=k({icons:S(Jy).optional()}),tr=k({name:p(),title:p().optional()}),Tp=tr.extend({...tr.shape,...qr.shape,version:p(),websiteUrl:p().optional(),description:p().optional()}),Qy=tn(k({applyDefaults:W().optional()}),X(p(),se())),Yy=ni(e=>e&&typeof e=="object"&&!Array.isArray(e)&&Object.keys(e).length===0?{form:{}}:e,tn(k({form:Qy.optional(),url:de.optional()}),X(p(),se()).optional())),Xy=le({list:de.optional(),cancel:de.optional(),requests:le({sampling:le({createMessage:de.optional()}).optional(),elicitation:le({create:de.optional()}).optional()}).optional()}),ev=le({list:de.optional(),cancel:de.optional(),requests:le({tools:le({call:de.optional()}).optional()}).optional()}),tv=k({experimental:X(p(),de).optional(),sampling:k({context:de.optional(),tools:de.optional()}).optional(),elicitation:Yy.optional(),roots:k({listChanged:W().optional()}).optional(),tasks:Xy.optional(),extensions:X(p(),de).optional()}),rv=Oe.extend({protocolVersion:p(),capabilities:tv,clientInfo:Tp}),ov=pe.extend({method:P("initialize"),params:rv});var nv=k({experimental:X(p(),de).optional(),logging:de.optional(),completions:de.optional(),prompts:k({listChanged:W().optional()}).optional(),resources:k({subscribe:W().optional(),listChanged:W().optional()}).optional(),tools:k({listChanged:W().optional()}).optional(),tasks:ev.optional(),extensions:X(p(),de).optional()}),ui=fe.extend({protocolVersion:p(),capabilities:nv,serverInfo:Tp,instructions:p().optional()}),Rp=Ae.extend({method:P("notifications/initialized"),params:Ce.optional()}),Ip=e=>Rp.safeParse(e).success,cn=pe.extend({method:P("ping"),params:Oe.optional()}),sv=k({progress:F(),total:ie(F()),message:ie(p())}),iv=k({...Ce.shape,...sv.shape,progressToken:xp}),un=Ae.extend({method:P("notifications/progress"),params:iv}),av=Oe.extend({cursor:bp.optional()}),Mr=pe.extend({params:av.optional()}),Dr=fe.extend({nextCursor:bp.optional()}),cv=Se(["working","input_required","completed","failed","cancelled"]),Ur=k({taskId:p(),status:cv,ttl:te([F(),lp()]),createdAt:p(),lastUpdatedAt:p(),pollInterval:ie(F()),statusMessage:ie(p())}),Et=fe.extend({task:Ur}),uv=Ce.merge(Ur),Lr=Ae.extend({method:P("notifications/tasks/status"),params:uv}),ln=pe.extend({method:P("tasks/get"),params:Oe.extend({taskId:p()})}),dn=fe.merge(Ur),pn=pe.extend({method:P("tasks/result"),params:Oe.extend({taskId:p()})}),VE=fe.loose(),fn=Mr.extend({method:P("tasks/list")}),mn=Dr.extend({tasks:S(Ur)}),hn=pe.extend({method:P("tasks/cancel"),params:Oe.extend({taskId:p()})}),Op=fe.merge(Ur),Cp=k({uri:p(),mimeType:ie(p()),_meta:X(p(),se()).optional()}),Ap=Cp.extend({text:p()}),li=p().refine(e=>{try{return atob(e),!0}catch{return!1}},{message:"Invalid Base64 string"}),Np=Cp.extend({blob:li}),Fr=Se(["user","assistant"]),nr=k({audience:S(Fr).optional(),priority:F().min(0).max(1).optional(),lastModified:Ar.datetime({offset:!0}).optional()}),jp=k({...tr.shape,...qr.shape,uri:p(),description:ie(p()),mimeType:ie(p()),size:ie(F()),annotations:nr.optional(),_meta:ie(le({}))}),lv=k({...tr.shape,...qr.shape,uriTemplate:p(),description:ie(p()),mimeType:ie(p()),annotations:nr.optional(),_meta:ie(le({}))}),dv=Mr.extend({method:P("resources/list")}),di=Dr.extend({resources:S(jp)}),pv=Mr.extend({method:P("resources/templates/list")}),pi=Dr.extend({resourceTemplates:S(lv)}),fi=Oe.extend({uri:p()}),fv=fi,mv=pe.extend({method:P("resources/read"),params:fv}),mi=fe.extend({contents:S(te([Ap,Np]))}),hi=Ae.extend({method:P("notifications/resources/list_changed"),params:Ce.optional()}),hv=fi,gv=pe.extend({method:P("resources/subscribe"),params:hv}),_v=fi,yv=pe.extend({method:P("resources/unsubscribe"),params:_v}),vv=Ce.extend({uri:p()}),wv=Ae.extend({method:P("notifications/resources/updated"),params:vv}),$v=k({name:p(),description:ie(p()),required:ie(W())}),xv=k({...tr.shape,...qr.shape,description:ie(p()),arguments:ie(S($v)),_meta:ie(le({}))}),bv=Mr.extend({method:P("prompts/list")}),gi=Dr.extend({prompts:S(xv)}),zv=Oe.extend({name:p(),arguments:X(p(),p()).optional()}),Sv=pe.extend({method:P("prompts/get"),params:zv}),_i=k({type:P("text"),text:p(),annotations:nr.optional(),_meta:X(p(),se()).optional()}),yi=k({type:P("image"),data:li,mimeType:p(),annotations:nr.optional(),_meta:X(p(),se()).optional()}),vi=k({type:P("audio"),data:li,mimeType:p(),annotations:nr.optional(),_meta:X(p(),se()).optional()}),kv=k({type:P("tool_use"),name:p(),id:p(),input:X(p(),se()),_meta:X(p(),se()).optional()}),Pv=k({type:P("resource"),resource:te([Ap,Np]),annotations:nr.optional(),_meta:X(p(),se()).optional()}),Ev=jp.extend({type:P("resource_link")}),wi=te([_i,yi,vi,Ev,Pv]),Tv=k({role:Fr,content:wi}),$i=fe.extend({description:p().optional(),messages:S(Tv)}),xi=Ae.extend({method:P("notifications/prompts/list_changed"),params:Ce.optional()}),Rv=k({title:p().optional(),readOnlyHint:W().optional(),destructiveHint:W().optional(),idempotentHint:W().optional(),openWorldHint:W().optional()}),Iv=k({taskSupport:Se(["required","optional","forbidden"]).optional()}),Zp=k({...tr.shape,...qr.shape,description:p().optional(),inputSchema:k({type:P("object"),properties:X(p(),de).optional(),required:S(p()).optional()}).catchall(se()),outputSchema:k({type:P("object"),properties:X(p(),de).optional(),required:S(p()).optional()}).catchall(se()).optional(),annotations:Rv.optional(),execution:Iv.optional(),_meta:X(p(),se()).optional()}),Ov=Mr.extend({method:P("tools/list")}),bi=Dr.extend({tools:S(Zp)}),sr=fe.extend({content:S(wi).default([]),structuredContent:X(p(),se()).optional(),isError:W().optional()}),HE=sr.or(fe.extend({toolResult:se()})),Cv=jr.extend({name:p(),arguments:X(p(),se()).optional()}),Av=pe.extend({method:P("tools/call"),params:Cv}),zi=Ae.extend({method:P("notifications/tools/list_changed"),params:Ce.optional()}),qp=k({autoRefresh:W().default(!0),debounceMs:F().int().nonnegative().default(300)}),Mp=Se(["debug","info","notice","warning","error","critical","alert","emergency"]),Nv=Oe.extend({level:Mp}),jv=pe.extend({method:P("logging/setLevel"),params:Nv}),Zv=Ce.extend({level:Mp,logger:p().optional(),data:se()}),qv=Ae.extend({method:P("notifications/message"),params:Zv}),Mv=k({name:p().optional()}),Dv=k({hints:S(Mv).optional(),costPriority:F().min(0).max(1).optional(),speedPriority:F().min(0).max(1).optional(),intelligencePriority:F().min(0).max(1).optional()}),Uv=k({mode:Se(["auto","required","none"]).optional()}),Lv=k({type:P("tool_result"),toolUseId:p().describe("The unique identifier for the corresponding tool call."),content:S(wi).default([]),structuredContent:k({}).loose().optional(),isError:W().optional(),_meta:X(p(),se()).optional()}),Fv=oi("type",[_i,yi,vi]),on=oi("type",[_i,yi,vi,kv,Lv]),Vv=k({role:Fr,content:te([on,S(on)]),_meta:X(p(),se()).optional()}),Hv=jr.extend({messages:S(Vv),modelPreferences:Dv.optional(),systemPrompt:p().optional(),includeContext:Se(["none","thisServer","allServers"]).optional(),temperature:F().optional(),maxTokens:F().int(),stopSequences:S(p()).optional(),metadata:de.optional(),tools:S(Zp).optional(),toolChoice:Uv.optional()}),Si=pe.extend({method:P("sampling/createMessage"),params:Hv}),ki=fe.extend({model:p(),stopReason:ie(Se(["endTurn","stopSequence","maxTokens"]).or(p())),role:Fr,content:Fv}),Pi=fe.extend({model:p(),stopReason:ie(Se(["endTurn","stopSequence","maxTokens","toolUse"]).or(p())),role:Fr,content:te([on,S(on)])}),Bv=k({type:P("boolean"),title:p().optional(),description:p().optional(),default:W().optional()}),Kv=k({type:P("string"),title:p().optional(),description:p().optional(),minLength:F().optional(),maxLength:F().optional(),format:Se(["email","uri","date","date-time"]).optional(),default:p().optional()}),Wv=k({type:Se(["number","integer"]),title:p().optional(),description:p().optional(),minimum:F().optional(),maximum:F().optional(),default:F().optional()}),Gv=k({type:P("string"),title:p().optional(),description:p().optional(),enum:S(p()),default:p().optional()}),Jv=k({type:P("string"),title:p().optional(),description:p().optional(),oneOf:S(k({const:p(),title:p()})),default:p().optional()}),Qv=k({type:P("string"),title:p().optional(),description:p().optional(),enum:S(p()),enumNames:S(p()).optional(),default:p().optional()}),Yv=te([Gv,Jv]),Xv=k({type:P("array"),title:p().optional(),description:p().optional(),minItems:F().optional(),maxItems:F().optional(),items:k({type:P("string"),enum:S(p())}),default:S(p()).optional()}),e0=k({type:P("array"),title:p().optional(),description:p().optional(),minItems:F().optional(),maxItems:F().optional(),items:k({anyOf:S(k({const:p(),title:p()}))}),default:S(p()).optional()}),t0=te([Xv,e0]),r0=te([Qv,Yv,t0]),o0=te([r0,Bv,Kv,Wv]),n0=jr.extend({mode:P("form").optional(),message:p(),requestedSchema:k({type:P("object"),properties:X(p(),o0),required:S(p()).optional()})}),s0=jr.extend({mode:P("url"),message:p(),elicitationId:p(),url:p().url()}),i0=te([n0,s0]),Ei=pe.extend({method:P("elicitation/create"),params:i0}),a0=Ce.extend({elicitationId:p()}),c0=Ae.extend({method:P("notifications/elicitation/complete"),params:a0}),Ti=fe.extend({action:Se(["accept","decline","cancel"]),content:ni(e=>e===null?void 0:e,X(p(),te([p(),F(),W(),S(p())])).optional())}),u0=k({type:P("ref/resource"),uri:p()});var l0=k({type:P("ref/prompt"),name:p()}),d0=Oe.extend({ref:te([l0,u0]),argument:k({name:p(),value:p()}),context:k({arguments:X(p(),p()).optional()}).optional()}),p0=pe.extend({method:P("completion/complete"),params:d0});var Ri=fe.extend({completion:le({values:S(p()).max(100),total:ie(F().int()),hasMore:ie(W())})}),f0=k({uri:p().startsWith("file://"),name:p().optional(),_meta:X(p(),se()).optional()}),m0=pe.extend({method:P("roots/list"),params:Oe.optional()}),h0=fe.extend({roots:S(f0)}),g0=Ae.extend({method:P("notifications/roots/list_changed"),params:Ce.optional()}),BE=te([cn,ov,p0,jv,Sv,bv,dv,pv,mv,gv,yv,Av,Ov,ln,pn,fn,hn]),KE=te([an,un,Rp,g0,Lr]),WE=te([Pt,ki,Pi,Ti,h0,dn,mn,Et]),GE=te([cn,Si,Ei,m0,ln,pn,fn,hn]),JE=te([an,un,qv,wv,hi,zi,xi,Lr,c0]),QE=te([Pt,ui,Ri,$i,gi,di,pi,mi,sr,bi,dn,mn,Et]),I=class e extends Error{constructor(t,r,o){super(`MCP error ${t}: ${r}`),this.code=t,this.data=o,this.name="McpError"}static fromError(t,r,o){if(t===O.UrlElicitationRequired&&o){let n=o;if(n.elicitations)return new si(n.elicitations,r)}return new e(t,r,o)}},si=class extends I{constructor(t,r=`URL elicitation${t.length>1?"s":""} required`){super(O.UrlElicitationRequired,r,{elicitations:t})}get elicitations(){return this.data?.elicitations??[]}};function ft(e){return e==="completed"||e==="failed"||e==="cancelled"}var _0=Symbol("Let zodToJsonSchema decide on which parser to use");var RT=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function Ii(e){let r=Qo(e)?.method;if(!r)throw new Error("Schema is missing a method literal");let o=Yo(r);if(typeof o!="string")throw new Error("Schema method literal must be a string");return o}function Oi(e,t){let r=Le(e,t);if(!r.success)throw r.error;return r.data}var b0=6e4,gn=class{constructor(t){this._options=t,this._requestMessageId=0,this._requestHandlers=new Map,this._requestHandlerAbortControllers=new Map,this._notificationHandlers=new Map,this._responseHandlers=new Map,this._progressHandlers=new Map,this._timeoutInfo=new Map,this._pendingDebouncedNotifications=new Set,this._taskProgressTokens=new Map,this._requestResolvers=new Map,this.setNotificationHandler(an,r=>{this._oncancel(r)}),this.setNotificationHandler(un,r=>{this._onprogress(r)}),this.setRequestHandler(cn,r=>({})),this._taskStore=t?.taskStore,this._taskMessageQueue=t?.taskMessageQueue,this._taskStore&&(this.setRequestHandler(ln,async(r,o)=>{let n=await this._taskStore.getTask(r.params.taskId,o.sessionId);if(!n)throw new I(O.InvalidParams,"Failed to retrieve task: Task not found");return{...n}}),this.setRequestHandler(pn,async(r,o)=>{let n=async()=>{let s=r.params.taskId;if(!await this._taskStore.getTask(s,o.sessionId))throw new I(O.InvalidParams,`Task not found: ${s}`);if(this._taskMessageQueue){let a;for(;a=await this._taskMessageQueue.dequeue(s,o.sessionId);){if(a.type==="response"||a.type==="error"){let c=a.message,l=c.id,u=this._requestResolvers.get(l);if(u)if(this._requestResolvers.delete(l),a.type==="response")u(c);else{let d=c,m=new I(d.error.code,d.error.message,d.error.data);u(m)}else{let d=a.type==="response"?"Response":"Error";this._onerror(new Error(`${d} handler missing for request ${l}`))}continue}await this._transport?.send(a.message,{relatedRequestId:o.requestId})}}let i=await this._taskStore.getTask(s,o.sessionId);if(!i)throw new I(O.InvalidParams,`Task not found: ${s}`);if(!ft(i.status))return await this._waitForTaskUpdate(s,o.signal,o.sessionId),await n();if(ft(i.status)){let a=await this._taskStore.getTaskResult(s,o.sessionId);return this._clearTaskQueue(s,o.sessionId),{...a,_meta:{...a._meta,[pt]:{taskId:s}}}}return await n()};return await n()}),this.setRequestHandler(fn,async(r,o)=>{try{let{tasks:n,nextCursor:s}=await this._taskStore.listTasks(r.params?.cursor,o.sessionId);return{tasks:n,nextCursor:s,_meta:{}}}catch(n){throw new I(O.InvalidParams,`Failed to list tasks: ${n instanceof Error?n.message:String(n)}`)}}),this.setRequestHandler(hn,async(r,o)=>{try{let n=await this._taskStore.getTask(r.params.taskId,o.sessionId);if(!n)throw new I(O.InvalidParams,`Task not found: ${r.params.taskId}`);if(ft(n.status))throw new I(O.InvalidParams,`Cannot cancel task in terminal status: ${n.status}`);await this._taskStore.updateTaskStatus(r.params.taskId,"cancelled","Client cancelled task execution.",o.sessionId),this._clearTaskQueue(r.params.taskId,o.sessionId);let s=await this._taskStore.getTask(r.params.taskId,o.sessionId);if(!s)throw new I(O.InvalidParams,`Task not found after cancellation: ${r.params.taskId}`);return{_meta:{},...s}}catch(n){throw n instanceof I?n:new I(O.InvalidRequest,`Failed to cancel task: ${n instanceof Error?n.message:String(n)}`)}}))}async _oncancel(t){if(!t.params.requestId)return;this._requestHandlerAbortControllers.get(t.params.requestId)?.abort(t.params.reason)}_setupTimeout(t,r,o,n,s=!1){this._timeoutInfo.set(t,{timeoutId:setTimeout(n,r),startTime:Date.now(),timeout:r,maxTotalTimeout:o,resetTimeoutOnProgress:s,onTimeout:n})}_resetTimeout(t){let r=this._timeoutInfo.get(t);if(!r)return!1;let o=Date.now()-r.startTime;if(r.maxTotalTimeout&&o>=r.maxTotalTimeout)throw this._timeoutInfo.delete(t),I.fromError(O.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:r.maxTotalTimeout,totalElapsed:o});return clearTimeout(r.timeoutId),r.timeoutId=setTimeout(r.onTimeout,r.timeout),!0}_cleanupTimeout(t){let r=this._timeoutInfo.get(t);r&&(clearTimeout(r.timeoutId),this._timeoutInfo.delete(t))}async connect(t){if(this._transport)throw new Error("Already connected to a transport. Call close() before connecting to a new transport, or use a separate Protocol instance per connection.");this._transport=t;let r=this.transport?.onclose;this._transport.onclose=()=>{r?.(),this._onclose()};let o=this.transport?.onerror;this._transport.onerror=s=>{o?.(s),this._onerror(s)};let n=this._transport?.onmessage;this._transport.onmessage=(s,i)=>{n?.(s,i),kt(s)||Ep(s)?this._onresponse(s):Zr(s)?this._onrequest(s,i):Pp(s)?this._onnotification(s):this._onerror(new Error(`Unknown message type: ${JSON.stringify(s)}`))},await this._transport.start()}_onclose(){let t=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._taskProgressTokens.clear(),this._pendingDebouncedNotifications.clear();for(let o of this._timeoutInfo.values())clearTimeout(o.timeoutId);this._timeoutInfo.clear();for(let o of this._requestHandlerAbortControllers.values())o.abort();this._requestHandlerAbortControllers.clear();let r=I.fromError(O.ConnectionClosed,"Connection closed");this._transport=void 0,this.onclose?.();for(let o of t.values())o(r)}_onerror(t){this.onerror?.(t)}_onnotification(t){let r=this._notificationHandlers.get(t.method)??this.fallbackNotificationHandler;r!==void 0&&Promise.resolve().then(()=>r(t)).catch(o=>this._onerror(new Error(`Uncaught error in notification handler: ${o}`)))}_onrequest(t,r){let o=this._requestHandlers.get(t.method)??this.fallbackRequestHandler,n=this._transport,s=t.params?._meta?.[pt]?.taskId,i=n?.sessionId,a=this._taskStore,c=!0,l;if(s&&a&&this._taskMessageQueue&&i!==void 0&&(c=!1,l=(async()=>{if(!await a.getTask(s,i))throw new I(O.InvalidParams,`Task not found: ${s}`);c=!0})()),o===void 0){let g={jsonrpc:"2.0",id:t.id,error:{code:O.MethodNotFound,message:"Method not found"}};if(s&&l){let h={type:"error",message:g,timestamp:Date.now()};l.then(()=>this._enqueueTaskMessage(s,h,i),()=>n?.send(g)).catch(_=>this._onerror(new Error(`Failed to send an error response: ${_}`)))}else s&&this._taskMessageQueue?this._enqueueTaskMessage(s,{type:"error",message:g,timestamp:Date.now()},n?.sessionId).catch(h=>this._onerror(new Error(`Failed to enqueue error response: ${h}`))):n?.send(g).catch(h=>this._onerror(new Error(`Failed to send an error response: ${h}`)));return}let u=new AbortController;this._requestHandlerAbortControllers.set(t.id,u);let d=zp(t.params)?t.params.task:void 0,m=this._taskStore?this.requestTaskStore(t,n?.sessionId):void 0,f={signal:u.signal,sessionId:n?.sessionId,_meta:t.params?._meta,sendNotification:async g=>{if(u.signal.aborted)return;let h={relatedRequestId:t.id};s&&(h.relatedTask={taskId:s}),await this.notification(g,h)},sendRequest:async(g,h,_)=>{if(u.signal.aborted)throw new I(O.ConnectionClosed,"Request was cancelled");let w={..._,relatedRequestId:t.id};s&&!w.relatedTask&&(w.relatedTask={taskId:s});let $=w.relatedTask?.taskId??s;return $&&m&&await m.updateTaskStatus($,"input_required"),await this.request(g,h,w)},authInfo:r?.authInfo,requestId:t.id,requestInfo:r?.requestInfo,taskId:s,taskStore:m,taskRequestedTtl:d?.ttl,closeSSEStream:r?.closeSSEStream,closeStandaloneSSEStream:r?.closeStandaloneSSEStream};(l??Promise.resolve()).then(()=>{if(l&&u.signal.aborted)throw new I(O.ConnectionClosed,"Request was cancelled");d&&this.assertTaskHandlerCapability(t.method)}).then(()=>o(t,f)).then(async g=>{if(u.signal.aborted)return;let h={result:g,jsonrpc:"2.0",id:t.id};s&&this._taskMessageQueue?await this._enqueueTaskMessage(s,{type:"response",message:h,timestamp:Date.now()},n?.sessionId):await n?.send(h)},async g=>{if(u.signal.aborted)return;let h={jsonrpc:"2.0",id:t.id,error:{code:Number.isSafeInteger(g.code)?g.code:O.InternalError,message:g.message??"Internal error",...g.data!==void 0&&{data:g.data}}};s&&this._taskMessageQueue&&c?await this._enqueueTaskMessage(s,{type:"error",message:h,timestamp:Date.now()},n?.sessionId):await n?.send(h)}).catch(g=>this._onerror(new Error(`Failed to send response: ${g}`))).finally(()=>{this._requestHandlerAbortControllers.get(t.id)===u&&this._requestHandlerAbortControllers.delete(t.id)})}_onprogress(t){let{progressToken:r,...o}=t.params,n=Number(r),s=this._progressHandlers.get(n);if(!s){this._onerror(new Error(`Received a progress notification for an unknown token: ${JSON.stringify(t)}`));return}let i=this._responseHandlers.get(n),a=this._timeoutInfo.get(n);if(a&&i&&a.resetTimeoutOnProgress)try{this._resetTimeout(n)}catch(c){this._responseHandlers.delete(n),this._progressHandlers.delete(n),this._cleanupTimeout(n),i(c);return}s(o)}_onresponse(t){let r=Number(t.id),o=this._requestResolvers.get(r);if(o){if(this._requestResolvers.delete(r),kt(t))o(t);else{let i=new I(t.error.code,t.error.message,t.error.data);o(i)}return}let n=this._responseHandlers.get(r);if(n===void 0){this._onerror(new Error(`Received a response for an unknown message ID: ${JSON.stringify(t)}`));return}this._responseHandlers.delete(r),this._cleanupTimeout(r);let s=!1;if(kt(t)&&t.result&&typeof t.result=="object"){let i=t.result;if(i.task&&typeof i.task=="object"){let a=i.task;typeof a.taskId=="string"&&(s=!0,this._taskProgressTokens.set(a.taskId,r))}}if(s||this._progressHandlers.delete(r),kt(t))n(t);else{let i=I.fromError(t.error.code,t.error.message,t.error.data);n(i)}}get transport(){return this._transport}async close(){await this._transport?.close()}async*requestStream(t,r,o){let{task:n}=o??{};if(!n){try{yield{type:"result",result:await this.request(t,r,o)}}catch(i){yield{type:"error",error:i instanceof I?i:new I(O.InternalError,String(i))}}return}let s;try{let i=await this.request(t,Et,o);if(i.task)s=i.task.taskId,yield{type:"taskCreated",task:i.task};else throw new I(O.InternalError,"Task creation did not return a task");for(;;){let a=await this.getTask({taskId:s},o);if(yield{type:"taskStatus",task:a},ft(a.status)){a.status==="completed"?yield{type:"result",result:await this.getTaskResult({taskId:s},r,o)}:a.status==="failed"?yield{type:"error",error:new I(O.InternalError,`Task ${s} failed`)}:a.status==="cancelled"&&(yield{type:"error",error:new I(O.InternalError,`Task ${s} was cancelled`)});return}if(a.status==="input_required"){yield{type:"result",result:await this.getTaskResult({taskId:s},r,o)};return}let c=a.pollInterval??this._options?.defaultTaskPollInterval??1e3;await new Promise(l=>setTimeout(l,c)),o?.signal?.throwIfAborted()}}catch(i){yield{type:"error",error:i instanceof I?i:new I(O.InternalError,String(i))}}}request(t,r,o){let{relatedRequestId:n,resumptionToken:s,onresumptiontoken:i,task:a,relatedTask:c}=o??{};return new Promise((l,u)=>{let d=$=>{u($)};if(!this._transport){d(new Error("Not connected"));return}if(this._options?.enforceStrictCapabilities===!0)try{this.assertCapabilityForMethod(t.method),a&&this.assertTaskCapability(t.method)}catch($){d($);return}o?.signal?.throwIfAborted();let m=this._requestMessageId++,f={...t,jsonrpc:"2.0",id:m};o?.onprogress&&(this._progressHandlers.set(m,o.onprogress),f.params={...t.params,_meta:{...t.params?._meta||{},progressToken:m}}),a&&(f.params={...f.params,task:a}),c&&(f.params={...f.params,_meta:{...f.params?._meta||{},[pt]:c}});let g=$=>{this._responseHandlers.delete(m),this._progressHandlers.delete(m),this._cleanupTimeout(m),this._transport?.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:m,reason:String($)}},{relatedRequestId:n,resumptionToken:s,onresumptiontoken:i}).catch(T=>this._onerror(new Error(`Failed to send cancellation: ${T}`)));let x=$ instanceof I?$:new I(O.RequestTimeout,String($));u(x)};this._responseHandlers.set(m,$=>{if(!o?.signal?.aborted){if($ instanceof Error)return u($);try{let x=Le(r,$.result);x.success?l(x.data):u(x.error)}catch(x){u(x)}}}),o?.signal?.addEventListener("abort",()=>{g(o?.signal?.reason)});let h=o?.timeout??b0,_=()=>g(I.fromError(O.RequestTimeout,"Request timed out",{timeout:h}));this._setupTimeout(m,h,o?.maxTotalTimeout,_,o?.resetTimeoutOnProgress??!1);let w=c?.taskId;if(w){let $=x=>{let T=this._responseHandlers.get(m);T?T(x):this._onerror(new Error(`Response handler missing for side-channeled request ${m}`))};this._requestResolvers.set(m,$),this._enqueueTaskMessage(w,{type:"request",message:f,timestamp:Date.now()}).catch(x=>{this._cleanupTimeout(m),u(x)})}else this._transport.send(f,{relatedRequestId:n,resumptionToken:s,onresumptiontoken:i}).catch($=>{this._cleanupTimeout(m),u($)})})}async getTask(t,r){return this.request({method:"tasks/get",params:t},dn,r)}async getTaskResult(t,r,o){return this.request({method:"tasks/result",params:t},r,o)}async listTasks(t,r){return this.request({method:"tasks/list",params:t},mn,r)}async cancelTask(t,r){return this.request({method:"tasks/cancel",params:t},Op,r)}async notification(t,r){if(!this._transport)throw new Error("Not connected");this.assertNotificationCapability(t.method);let o=r?.relatedTask?.taskId;if(o){let a={...t,jsonrpc:"2.0",params:{...t.params,_meta:{...t.params?._meta||{},[pt]:r.relatedTask}}};await this._enqueueTaskMessage(o,{type:"notification",message:a,timestamp:Date.now()});return}if((this._options?.debouncedNotificationMethods??[]).includes(t.method)&&!t.params&&!r?.relatedRequestId&&!r?.relatedTask){if(this._pendingDebouncedNotifications.has(t.method))return;this._pendingDebouncedNotifications.add(t.method),Promise.resolve().then(()=>{if(this._pendingDebouncedNotifications.delete(t.method),!this._transport)return;let a={...t,jsonrpc:"2.0"};r?.relatedTask&&(a={...a,params:{...a.params,_meta:{...a.params?._meta||{},[pt]:r.relatedTask}}}),this._transport?.send(a,r).catch(c=>this._onerror(c))});return}let i={...t,jsonrpc:"2.0"};r?.relatedTask&&(i={...i,params:{...i.params,_meta:{...i.params?._meta||{},[pt]:r.relatedTask}}}),await this._transport.send(i,r)}setRequestHandler(t,r){let o=Ii(t);this.assertRequestHandlerCapability(o),this._requestHandlers.set(o,(n,s)=>{let i=Oi(t,n);return Promise.resolve(r(i,s))})}removeRequestHandler(t){this._requestHandlers.delete(t)}assertCanSetRequestHandler(t){if(this._requestHandlers.has(t))throw new Error(`A request handler for ${t} already exists, which would be overridden`)}setNotificationHandler(t,r){let o=Ii(t);this._notificationHandlers.set(o,n=>{let s=Oi(t,n);return Promise.resolve(r(s))})}removeNotificationHandler(t){this._notificationHandlers.delete(t)}_cleanupTaskProgressHandler(t){let r=this._taskProgressTokens.get(t);r!==void 0&&(this._progressHandlers.delete(r),this._taskProgressTokens.delete(t))}async _enqueueTaskMessage(t,r,o){if(!this._taskStore||!this._taskMessageQueue)throw new Error("Cannot enqueue task message: taskStore and taskMessageQueue are not configured");let n=this._options?.maxTaskQueueSize;await this._taskMessageQueue.enqueue(t,r,o??this._transport?.sessionId,n)}async _clearTaskQueue(t,r){if(this._taskMessageQueue){let o=await this._taskMessageQueue.dequeueAll(t,r);for(let n of o)if(n.type==="request"&&Zr(n.message)){let s=n.message.id,i=this._requestResolvers.get(s);i?(i(new I(O.InternalError,"Task cancelled or completed")),this._requestResolvers.delete(s)):this._onerror(new Error(`Resolver missing for request ${s} during task ${t} cleanup`))}}}async _waitForTaskUpdate(t,r,o){let n=this._options?.defaultTaskPollInterval??1e3;try{let s=await this._taskStore?.getTask(t,o);s?.pollInterval&&(n=s.pollInterval)}catch{}return new Promise((s,i)=>{if(r.aborted){i(new I(O.InvalidRequest,"Request cancelled"));return}let a=setTimeout(s,n);r.addEventListener("abort",()=>{clearTimeout(a),i(new I(O.InvalidRequest,"Request cancelled"))},{once:!0})})}requestTaskStore(t,r){let o=this._taskStore;if(!o)throw new Error("No task store configured");return{createTask:async n=>{if(!t)throw new Error("No request provided");return await o.createTask(n,t.id,{method:t.method,params:t.params},r)},getTask:async n=>{let s=await o.getTask(n,r);if(!s)throw new I(O.InvalidParams,"Failed to retrieve task: Task not found");return s},storeTaskResult:async(n,s,i)=>{await o.storeTaskResult(n,s,i,r);let a=await o.getTask(n,r);if(a){let c=Lr.parse({method:"notifications/tasks/status",params:a});await this.notification(c),ft(a.status)&&this._cleanupTaskProgressHandler(n)}},getTaskResult:n=>o.getTaskResult(n,r),updateTaskStatus:async(n,s,i)=>{let a=await o.getTask(n,r);if(!a)throw new I(O.InvalidParams,`Task "${n}" not found - it may have been cleaned up`);if(ft(a.status))throw new I(O.InvalidParams,`Cannot update task "${n}" from terminal status "${a.status}" to "${s}". Terminal states (completed, failed, cancelled) cannot transition to other states.`);await o.updateTaskStatus(n,s,i,r);let c=await o.getTask(n,r);if(c){let l=Lr.parse({method:"notifications/tasks/status",params:c});await this.notification(l),ft(c.status)&&this._cleanupTaskProgressHandler(n)}},listTasks:n=>o.listTasks(n,r)}}};function Dp(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function Up(e,t){let r={...e};for(let o in t){let n=o,s=t[n];if(s===void 0)continue;let i=r[n];Dp(i)&&Dp(s)?r[n]={...i,...s}:r[n]=s}return r}var Vh=Zo(bc(),1),Hh=Zo(Fh(),1);function jS(){let e=new Vh.default({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return(0,Hh.default)(e),e}var ts=class{constructor(t){this._ajv=t??jS()}getValidator(t){let r="$id"in t&&typeof t.$id=="string"?this._ajv.getSchema(t.$id)??this._ajv.compile(t):this._ajv.compile(t);return o=>r(o)?{valid:!0,data:o,errorMessage:void 0}:{valid:!1,data:void 0,errorMessage:this._ajv.errorsText(r.errors)}}};var rs=class{constructor(t){this._client=t}async*callToolStream(t,r=sr,o){let n=this._client,s={...o,task:o?.task??(n.isToolTask(t.name)?{}:void 0)},i=n.requestStream({method:"tools/call",params:t},r,s),a=n.getToolOutputValidator(t.name);for await(let c of i){if(c.type==="result"&&a){let l=c.result;if(!l.structuredContent&&!l.isError){yield{type:"error",error:new I(O.InvalidRequest,`Tool ${t.name} has an output schema but did not return structured content`)};return}if(l.structuredContent)try{let u=a(l.structuredContent);if(!u.valid){yield{type:"error",error:new I(O.InvalidParams,`Structured content does not match the tool's output schema: ${u.errorMessage}`)};return}}catch(u){if(u instanceof I){yield{type:"error",error:u};return}yield{type:"error",error:new I(O.InvalidParams,`Failed to validate structured content: ${u instanceof Error?u.message:String(u)}`)};return}}yield c}}async getTask(t,r){return this._client.getTask({taskId:t},r)}async getTaskResult(t,r,o){return this._client.getTaskResult({taskId:t},r,o)}async listTasks(t,r){return this._client.listTasks(t?{cursor:t}:void 0,r)}async cancelTask(t,r){return this._client.cancelTask({taskId:t},r)}requestStream(t,r,o){return this._client.requestStream(t,r,o)}};function Bh(e,t,r){if(!e)throw new Error(`${r} does not support task creation (required for ${t})`);switch(t){case"tools/call":if(!e.tools?.call)throw new Error(`${r} does not support task creation for tools/call (required for ${t})`);break;default:break}}function Kh(e,t,r){if(!e)throw new Error(`${r} does not support task creation (required for ${t})`);switch(t){case"sampling/createMessage":if(!e.sampling?.createMessage)throw new Error(`${r} does not support task creation for sampling/createMessage (required for ${t})`);break;case"elicitation/create":if(!e.elicitation?.create)throw new Error(`${r} does not support task creation for elicitation/create (required for ${t})`);break;default:break}}function os(e,t){if(!(!e||t===null||typeof t!="object")){if(e.type==="object"&&e.properties&&typeof e.properties=="object"){let r=t,o=e.properties;for(let n of Object.keys(o)){let s=o[n];r[n]===void 0&&Object.prototype.hasOwnProperty.call(s,"default")&&(r[n]=s.default),r[n]!==void 0&&os(s,r[n])}}if(Array.isArray(e.anyOf))for(let r of e.anyOf)typeof r!="boolean"&&os(r,t);if(Array.isArray(e.oneOf))for(let r of e.oneOf)typeof r!="boolean"&&os(r,t)}}function ZS(e){if(!e)return{supportsFormMode:!1,supportsUrlMode:!1};let t=e.form!==void 0,r=e.url!==void 0;return{supportsFormMode:t||!t&&!r,supportsUrlMode:r}}var Ic=class extends gn{constructor(t,r){super(r),this._clientInfo=t,this._cachedToolOutputValidators=new Map,this._cachedKnownTaskTools=new Set,this._cachedRequiredTaskTools=new Set,this._listChangedDebounceTimers=new Map,this._capabilities=r?.capabilities??{},this._jsonSchemaValidator=r?.jsonSchemaValidator??new ts,r?.listChanged&&(this._pendingListChangedConfig=r.listChanged)}_setupListChangedHandlers(t){t.tools&&this._serverCapabilities?.tools?.listChanged&&this._setupListChangedHandler("tools",zi,t.tools,async()=>(await this.listTools()).tools),t.prompts&&this._serverCapabilities?.prompts?.listChanged&&this._setupListChangedHandler("prompts",xi,t.prompts,async()=>(await this.listPrompts()).prompts),t.resources&&this._serverCapabilities?.resources?.listChanged&&this._setupListChangedHandler("resources",hi,t.resources,async()=>(await this.listResources()).resources)}get experimental(){return this._experimental||(this._experimental={tasks:new rs(this)}),this._experimental}registerCapabilities(t){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=Up(this._capabilities,t)}setRequestHandler(t,r){let n=Qo(t)?.method;if(!n)throw new Error("Schema is missing a method literal");let s=Yo(n);if(typeof s!="string")throw new Error("Schema method literal must be a string");let i=s;if(i==="elicitation/create"){let a=async(c,l)=>{let u=Le(Ei,c);if(!u.success){let $=u.error instanceof Error?u.error.message:String(u.error);throw new I(O.InvalidParams,`Invalid elicitation request: ${$}`)}let{params:d}=u.data;d.mode=d.mode??"form";let{supportsFormMode:m,supportsUrlMode:f}=ZS(this._capabilities.elicitation);if(d.mode==="form"&&!m)throw new I(O.InvalidParams,"Client does not support form-mode elicitation requests");if(d.mode==="url"&&!f)throw new I(O.InvalidParams,"Client does not support URL-mode elicitation requests");let g=await Promise.resolve(r(c,l));if(d.task){let $=Le(Et,g);if(!$.success){let x=$.error instanceof Error?$.error.message:String($.error);throw new I(O.InvalidParams,`Invalid task creation result: ${x}`)}return $.data}let h=Le(Ti,g);if(!h.success){let $=h.error instanceof Error?h.error.message:String(h.error);throw new I(O.InvalidParams,`Invalid elicitation result: ${$}`)}let _=h.data,w=d.mode==="form"?d.requestedSchema:void 0;if(d.mode==="form"&&_.action==="accept"&&_.content&&w&&this._capabilities.elicitation?.form?.applyDefaults)try{os(w,_.content)}catch{}return _};return super.setRequestHandler(t,a)}if(i==="sampling/createMessage"){let a=async(c,l)=>{let u=Le(Si,c);if(!u.success){let _=u.error instanceof Error?u.error.message:String(u.error);throw new I(O.InvalidParams,`Invalid sampling request: ${_}`)}let{params:d}=u.data,m=await Promise.resolve(r(c,l));if(d.task){let _=Le(Et,m);if(!_.success){let w=_.error instanceof Error?_.error.message:String(_.error);throw new I(O.InvalidParams,`Invalid task creation result: ${w}`)}return _.data}let g=d.tools||d.toolChoice?Pi:ki,h=Le(g,m);if(!h.success){let _=h.error instanceof Error?h.error.message:String(h.error);throw new I(O.InvalidParams,`Invalid sampling result: ${_}`)}return h.data};return super.setRequestHandler(t,a)}return super.setRequestHandler(t,r)}assertCapability(t,r){if(!this._serverCapabilities?.[t])throw new Error(`Server does not support ${t} (required for ${r})`)}async connect(t,r){if(await super.connect(t),t.sessionId===void 0)try{let o=await this.request({method:"initialize",params:{protocolVersion:rr,capabilities:this._capabilities,clientInfo:this._clientInfo}},ui,r);if(o===void 0)throw new Error(`Server sent invalid initialize result: ${o}`);if(!$p.includes(o.protocolVersion))throw new Error(`Server's protocol version is not supported: ${o.protocolVersion}`);this._serverCapabilities=o.capabilities,this._serverVersion=o.serverInfo,t.setProtocolVersion&&t.setProtocolVersion(o.protocolVersion),this._instructions=o.instructions,await this.notification({method:"notifications/initialized"}),this._pendingListChangedConfig&&(this._setupListChangedHandlers(this._pendingListChangedConfig),this._pendingListChangedConfig=void 0)}catch(o){throw this.close(),o}}getServerCapabilities(){return this._serverCapabilities}getServerVersion(){return this._serverVersion}getInstructions(){return this._instructions}assertCapabilityForMethod(t){switch(t){case"logging/setLevel":if(!this._serverCapabilities?.logging)throw new Error(`Server does not support logging (required for ${t})`);break;case"prompts/get":case"prompts/list":if(!this._serverCapabilities?.prompts)throw new Error(`Server does not support prompts (required for ${t})`);break;case"resources/list":case"resources/templates/list":case"resources/read":case"resources/subscribe":case"resources/unsubscribe":if(!this._serverCapabilities?.resources)throw new Error(`Server does not support resources (required for ${t})`);if(t==="resources/subscribe"&&!this._serverCapabilities.resources.subscribe)throw new Error(`Server does not support resource subscriptions (required for ${t})`);break;case"tools/call":case"tools/list":if(!this._serverCapabilities?.tools)throw new Error(`Server does not support tools (required for ${t})`);break;case"completion/complete":if(!this._serverCapabilities?.completions)throw new Error(`Server does not support completions (required for ${t})`);break;case"initialize":break;case"ping":break}}assertNotificationCapability(t){switch(t){case"notifications/roots/list_changed":if(!this._capabilities.roots?.listChanged)throw new Error(`Client does not support roots list changed notifications (required for ${t})`);break;case"notifications/initialized":break;case"notifications/cancelled":break;case"notifications/progress":break}}assertRequestHandlerCapability(t){if(this._capabilities)switch(t){case"sampling/createMessage":if(!this._capabilities.sampling)throw new Error(`Client does not support sampling capability (required for ${t})`);break;case"elicitation/create":if(!this._capabilities.elicitation)throw new Error(`Client does not support elicitation capability (required for ${t})`);break;case"roots/list":if(!this._capabilities.roots)throw new Error(`Client does not support roots capability (required for ${t})`);break;case"tasks/get":case"tasks/list":case"tasks/result":case"tasks/cancel":if(!this._capabilities.tasks)throw new Error(`Client does not support tasks capability (required for ${t})`);break;case"ping":break}}assertTaskCapability(t){Bh(this._serverCapabilities?.tasks?.requests,t,"Server")}assertTaskHandlerCapability(t){this._capabilities&&Kh(this._capabilities.tasks?.requests,t,"Client")}async ping(t){return this.request({method:"ping"},Pt,t)}async complete(t,r){return this.request({method:"completion/complete",params:t},Ri,r)}async setLoggingLevel(t,r){return this.request({method:"logging/setLevel",params:{level:t}},Pt,r)}async getPrompt(t,r){return this.request({method:"prompts/get",params:t},$i,r)}async listPrompts(t,r){return this.request({method:"prompts/list",params:t},gi,r)}async listResources(t,r){return this.request({method:"resources/list",params:t},di,r)}async listResourceTemplates(t,r){return this.request({method:"resources/templates/list",params:t},pi,r)}async readResource(t,r){return this.request({method:"resources/read",params:t},mi,r)}async subscribeResource(t,r){return this.request({method:"resources/subscribe",params:t},Pt,r)}async unsubscribeResource(t,r){return this.request({method:"resources/unsubscribe",params:t},Pt,r)}async callTool(t,r=sr,o){if(this.isToolTaskRequired(t.name))throw new I(O.InvalidRequest,`Tool "${t.name}" requires task-based execution. Use client.experimental.tasks.callToolStream() instead.`);let n=await this.request({method:"tools/call",params:t},r,o),s=this.getToolOutputValidator(t.name);if(s){if(!n.structuredContent&&!n.isError)throw new I(O.InvalidRequest,`Tool ${t.name} has an output schema but did not return structured content`);if(n.structuredContent)try{let i=s(n.structuredContent);if(!i.valid)throw new I(O.InvalidParams,`Structured content does not match the tool's output schema: ${i.errorMessage}`)}catch(i){throw i instanceof I?i:new I(O.InvalidParams,`Failed to validate structured content: ${i instanceof Error?i.message:String(i)}`)}}return n}isToolTask(t){return this._serverCapabilities?.tasks?.requests?.tools?.call?this._cachedKnownTaskTools.has(t):!1}isToolTaskRequired(t){return this._cachedRequiredTaskTools.has(t)}cacheToolMetadata(t){this._cachedToolOutputValidators.clear(),this._cachedKnownTaskTools.clear(),this._cachedRequiredTaskTools.clear();for(let r of t){if(r.outputSchema){let n=this._jsonSchemaValidator.getValidator(r.outputSchema);this._cachedToolOutputValidators.set(r.name,n)}let o=r.execution?.taskSupport;(o==="required"||o==="optional")&&this._cachedKnownTaskTools.add(r.name),o==="required"&&this._cachedRequiredTaskTools.add(r.name)}}getToolOutputValidator(t){return this._cachedToolOutputValidators.get(t)}async listTools(t,r){let o=await this.request({method:"tools/list",params:t},bi,r);return this.cacheToolMetadata(o.tools),o}_setupListChangedHandler(t,r,o,n){let s=qp.safeParse(o);if(!s.success)throw new Error(`Invalid ${t} listChanged options: ${s.error.message}`);if(typeof o.onChanged!="function")throw new Error(`Invalid ${t} listChanged options: onChanged must be a function`);let{autoRefresh:i,debounceMs:a}=s.data,{onChanged:c}=o,l=async()=>{if(!i){c(null,null);return}try{let d=await n();c(null,d)}catch(d){let m=d instanceof Error?d:new Error(String(d));c(m,null)}},u=()=>{if(a){let d=this._listChangedDebounceTimers.get(t);d&&clearTimeout(d);let m=setTimeout(l,a);this._listChangedDebounceTimers.set(t,m)}else l()};this.setNotificationHandler(r,u)}async sendRootsListChanged(){return this.notification({method:"notifications/roots/list_changed"})}};var Zg=Zo(Ng(),1);import Lc from"node:process";import{PassThrough as pk}from"node:stream";var lk=10*1024*1024,ss=class{constructor(t){this._maxBufferSize=t?.maxBufferSize??lk}append(t){if((this._buffer?.length??0)+t.length>this._maxBufferSize)throw this.clear(),new Error(`ReadBuffer exceeded maximum size of ${this._maxBufferSize} bytes`);this._buffer=this._buffer?Buffer.concat([this._buffer,t]):t}readMessage(){if(!this._buffer)return null;let t=this._buffer.indexOf(`
35
- `);if(t===-1)return null;let r=this._buffer.toString("utf8",0,t).replace(/\r$/,"");return this._buffer=this._buffer.subarray(t+1),dk(r)}clear(){this._buffer=void 0}};function dk(e){return or.parse(JSON.parse(e))}function jg(e){return JSON.stringify(e)+`
36
- `}var fk=Lc.platform==="win32"?["APPDATA","HOMEDRIVE","HOMEPATH","LOCALAPPDATA","PATH","PROCESSOR_ARCHITECTURE","SYSTEMDRIVE","SYSTEMROOT","TEMP","USERNAME","USERPROFILE","PROGRAMFILES"]:["HOME","LOGNAME","PATH","SHELL","TERM","USER"];function mk(){let e={};for(let t of fk){let r=Lc.env[t];r!==void 0&&(r.startsWith("()")||(e[t]=r))}return e}var Uc=class{constructor(t){this._stderrStream=null,this._serverParams=t,this._readBuffer=new ss({maxBufferSize:t.maxBufferSize}),(t.stderr==="pipe"||t.stderr==="overlapped")&&(this._stderrStream=new pk)}async start(){if(this._process)throw new Error("StdioClientTransport already started! If using Client class, note that connect() calls start() automatically.");return new Promise((t,r)=>{this._process=(0,Zg.default)(this._serverParams.command,this._serverParams.args??[],{env:{...mk(),...this._serverParams.env},stdio:["pipe","pipe",this._serverParams.stderr??"inherit"],shell:!1,windowsHide:Lc.platform==="win32",cwd:this._serverParams.cwd}),this._process.on("error",o=>{r(o),this.onerror?.(o)}),this._process.on("spawn",()=>{t()}),this._process.on("close",o=>{this._process=void 0,this.onclose?.()}),this._process.stdin?.on("error",o=>{this.onerror?.(o)}),this._process.stdout?.on("data",o=>{try{this._readBuffer.append(o),this.processReadBuffer()}catch(n){this.onerror?.(n),this.close().catch(()=>{})}}),this._process.stdout?.on("error",o=>{this.onerror?.(o)}),this._stderrStream&&this._process.stderr&&this._process.stderr.pipe(this._stderrStream)})}get stderr(){return this._stderrStream?this._stderrStream:this._process?.stderr??null}get pid(){return this._process?.pid??null}processReadBuffer(){for(;;)try{let t=this._readBuffer.readMessage();if(t===null)break;this.onmessage?.(t)}catch(t){this.onerror?.(t)}}async close(){if(this._process){let t=this._process;this._process=void 0;let r=new Promise(o=>{t.once("close",()=>{o()})});try{t.stdin?.end()}catch{}if(await Promise.race([r,new Promise(o=>setTimeout(o,2e3).unref())]),t.exitCode===null){try{t.kill("SIGTERM")}catch{}await Promise.race([r,new Promise(o=>setTimeout(o,2e3).unref())])}if(t.exitCode===null)try{t.kill("SIGKILL")}catch{}}this._readBuffer.clear()}send(t){return new Promise(r=>{if(!this._process?.stdin)throw new Error("Not connected");let o=jg(t);this._process.stdin.write(o)?r():this._process.stdin.once("drain",r)})}};var Lg=Zo(Ug(),1);function Fg(e){if(e)try{return Lg.default.parse(e).type}catch{let t=(e.split(";",1)[0]??"").trim().toLowerCase();return t===""||e.slice(t.length).includes(",")?void 0:t}}function is(e){return e?e instanceof Headers?Object.fromEntries(e.entries()):Array.isArray(e)?Object.fromEntries(e):{...e}:{}}function Vg(e=fetch,t){return t?async(r,o)=>{let n={...t,...o,headers:o?.headers?{...is(t.headers),...is(o.headers)}:t.headers};return e(r,n)}:e}var bk=5,zk=[301,302,303,307,308];function Sk(e,t){return e.protocol===t.protocol&&e.hostname===t.hostname&&e.port===t.port?!0:e.hostname===t.hostname&&e.protocol==="http:"&&e.port===""&&t.protocol==="https:"&&t.port===""}function Hg(e,t){let r=zk.includes(e.status)?e.headers.get("location"):null;try{return r?new URL(r,t):void 0}catch{return}}function as(e,t,r,o,n=0){let s=Hg(o,t),i=o.status===307||o.status===308||(r?.method??"GET").toUpperCase()==="GET";if(!s||n===bk||!i)return;let a=new URL(t);if(!((s.username||s.password)&&(s.username!==a.username||s.password!==a.password)||!Sk(a,s)))return Promise.resolve(o.body?.cancel()).then(()=>e(s,{...r,redirect:"manual"})).then(l=>as(e,s,r,l,n+1)??l)}var Bg=new WeakSet;function Vc(e){let t=(r,o)=>(e??fetch)(r,o);return Bg.add(t),t}function Ut(e=fetch){return Bg.has(e)?e:(t,r)=>r?.redirect==="error"||r?.redirect==="manual"?e(t,r):Promise.resolve(e(t,{...r,redirect:"manual"})).then(o=>as(e,t,r,o)??o)}function cs(e,t){if(e.type==="opaqueredirect")return"Redirect not followed: this runtime does not expose the redirect target";let r=e.url||t,o=Hg(e,r);if(o)return o.username=o.password=o.search=o.hash="",o.protocol==="http:"&&new URL(r).protocol==="https:"?(o.protocol="https:",`Redirect to plain http not followed; try ${o.href} instead`):`Redirect to ${o.href} not followed`}var Hc;Hc=globalThis.crypto?.webcrypto??globalThis.crypto??import("node:crypto").then(e=>e.webcrypto);async function kk(e){return(await Hc).getRandomValues(new Uint8Array(e))}async function Pk(e){let t="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-._~",r=Math.pow(2,8)-Math.pow(2,8)%t.length,o="";for(;o.length<e;){let n=await kk(e-o.length);for(let s of n)s<r&&(o+=t[s%t.length])}return o}async function Ek(e){return await Pk(e)}async function Tk(e){let t=await(await Hc).subtle.digest("SHA-256",new TextEncoder().encode(e));return btoa(String.fromCharCode(...new Uint8Array(t))).replace(/\//g,"_").replace(/\+/g,"-").replace(/=/g,"")}async function Bc(e){if(e||(e=43),e<43||e>128)throw`Expected a length between 43 and 128. Received ${e}.`;let t=await Ek(e),r=await Tk(t);return{code_verifier:t,code_challenge:r}}var _e=cp().superRefine((e,t)=>{if(!URL.canParse(e))return t.addIssue({code:wp.custom,message:"URL must be parseable",fatal:!0}),ps}).refine(e=>{let t=new URL(e);return t.protocol!=="javascript:"&&t.protocol!=="data:"&&t.protocol!=="vbscript:"},{message:"URL cannot use javascript:, data:, or vbscript: scheme"}),Wg=le({resource:p().url(),authorization_servers:S(_e).optional(),jwks_uri:p().url().optional(),scopes_supported:S(p()).optional(),bearer_methods_supported:S(p()).optional(),resource_signing_alg_values_supported:S(p()).optional(),resource_name:p().optional(),resource_documentation:p().optional(),resource_policy_uri:p().url().optional(),resource_tos_uri:p().url().optional(),tls_client_certificate_bound_access_tokens:W().optional(),authorization_details_types_supported:S(p()).optional(),dpop_signing_alg_values_supported:S(p()).optional(),dpop_bound_access_tokens_required:W().optional()}),Kc=le({issuer:p(),authorization_endpoint:_e,token_endpoint:_e,registration_endpoint:_e.optional(),scopes_supported:S(p()).optional(),response_types_supported:S(p()),response_modes_supported:S(p()).optional(),grant_types_supported:S(p()).optional(),token_endpoint_auth_methods_supported:S(p()).optional(),token_endpoint_auth_signing_alg_values_supported:S(p()).optional(),service_documentation:_e.optional(),revocation_endpoint:_e.optional(),revocation_endpoint_auth_methods_supported:S(p()).optional(),revocation_endpoint_auth_signing_alg_values_supported:S(p()).optional(),introspection_endpoint:p().optional(),introspection_endpoint_auth_methods_supported:S(p()).optional(),introspection_endpoint_auth_signing_alg_values_supported:S(p()).optional(),code_challenge_methods_supported:S(p()).optional(),client_id_metadata_document_supported:W().optional()}),Rk=le({issuer:p(),authorization_endpoint:_e,token_endpoint:_e,userinfo_endpoint:_e.optional(),jwks_uri:_e,registration_endpoint:_e.optional(),scopes_supported:S(p()).optional(),response_types_supported:S(p()),response_modes_supported:S(p()).optional(),grant_types_supported:S(p()).optional(),acr_values_supported:S(p()).optional(),subject_types_supported:S(p()),id_token_signing_alg_values_supported:S(p()),id_token_encryption_alg_values_supported:S(p()).optional(),id_token_encryption_enc_values_supported:S(p()).optional(),userinfo_signing_alg_values_supported:S(p()).optional(),userinfo_encryption_alg_values_supported:S(p()).optional(),userinfo_encryption_enc_values_supported:S(p()).optional(),request_object_signing_alg_values_supported:S(p()).optional(),request_object_encryption_alg_values_supported:S(p()).optional(),request_object_encryption_enc_values_supported:S(p()).optional(),token_endpoint_auth_methods_supported:S(p()).optional(),token_endpoint_auth_signing_alg_values_supported:S(p()).optional(),display_values_supported:S(p()).optional(),claim_types_supported:S(p()).optional(),claims_supported:S(p()).optional(),service_documentation:p().optional(),claims_locales_supported:S(p()).optional(),ui_locales_supported:S(p()).optional(),claims_parameter_supported:W().optional(),request_parameter_supported:W().optional(),request_uri_parameter_supported:W().optional(),require_request_uri_registration:W().optional(),op_policy_uri:_e.optional(),op_tos_uri:_e.optional(),client_id_metadata_document_supported:W().optional()}),Gg=k({...Rk.shape,...Kc.pick({code_challenge_methods_supported:!0}).shape}),Jg=k({access_token:p(),id_token:p().optional(),token_type:p(),expires_in:rn.number().optional(),scope:p().optional(),refresh_token:p().optional(),issuer:p().optional().catch(void 0)}).strip(),Qg=k({error:p(),error_description:p().optional(),error_uri:p().optional()}),Kg=_e.optional().or(P("").transform(()=>{})),Ik=k({redirect_uris:S(_e),token_endpoint_auth_method:p().optional(),grant_types:S(p()).optional(),response_types:S(p()).optional(),client_name:p().optional(),client_uri:_e.optional(),logo_uri:Kg,scope:p().optional(),contacts:S(p()).optional(),tos_uri:Kg,policy_uri:p().optional(),jwks_uri:_e.optional(),jwks:dp().optional(),software_id:p().optional(),software_version:p().optional(),software_statement:p().optional()}).strip(),Ok=k({client_id:p(),client_secret:p().optional(),client_id_issued_at:F().optional(),client_secret_expires_at:F().optional(),issuer:p().optional().catch(void 0)}).strip(),Yg=Ik.merge(Ok),zC=k({error:p(),error_description:p().optional()}).strip(),SC=k({token:p(),token_type_hint:p().optional()}).strip();function Xg(e){let t=typeof e=="string"?new URL(e):new URL(e.href);return t.hash="",t}function e_({requestedResource:e,configuredResource:t}){let r=typeof e=="string"?new URL(e):new URL(e.href),o=typeof t=="string"?new URL(t):new URL(t.href);if(r.origin!==o.origin||r.pathname.length<o.pathname.length)return!1;let n=r.pathname.endsWith("/")?r.pathname:r.pathname+"/",s=o.pathname.endsWith("/")?o.pathname:o.pathname+"/";return n.startsWith(s)}var ce=class extends Error{constructor(t,r){super(t),this.errorUri=r,this.name=this.constructor.name}toResponseObject(){let t={error:this.errorCode,error_description:this.message};return this.errorUri&&(t.error_uri=this.errorUri),t}get errorCode(){return this.constructor.errorCode}},xo=class extends ce{};xo.errorCode="invalid_request";var Lt=class extends ce{};Lt.errorCode="invalid_client";var Ft=class extends ce{};Ft.errorCode="invalid_grant";var Vt=class extends ce{};Vt.errorCode="unauthorized_client";var bo=class extends ce{};bo.errorCode="unsupported_grant_type";var zo=class extends ce{};zo.errorCode="invalid_scope";var So=class extends ce{};So.errorCode="access_denied";var at=class extends ce{};at.errorCode="server_error";var ko=class extends ce{};ko.errorCode="temporarily_unavailable";var Po=class extends ce{};Po.errorCode="unsupported_response_type";var Eo=class extends ce{};Eo.errorCode="unsupported_token_type";var To=class extends ce{};To.errorCode="invalid_token";var Ro=class extends ce{};Ro.errorCode="method_not_allowed";var Io=class extends ce{};Io.errorCode="too_many_requests";var Ht=class extends ce{};Ht.errorCode="invalid_client_metadata";var Oo=class extends ce{};Oo.errorCode="insufficient_scope";var Co=class extends ce{};Co.errorCode="invalid_target";var t_={[xo.errorCode]:xo,[Lt.errorCode]:Lt,[Ft.errorCode]:Ft,[Vt.errorCode]:Vt,[bo.errorCode]:bo,[zo.errorCode]:zo,[So.errorCode]:So,[at.errorCode]:at,[ko.errorCode]:ko,[Po.errorCode]:Po,[Eo.errorCode]:Eo,[To.errorCode]:To,[Ro.errorCode]:Ro,[Io.errorCode]:Io,[Ht.errorCode]:Ht,[Oo.errorCode]:Oo,[Co.errorCode]:Co};var ct=class extends Error{constructor(t){super(t??"Unauthorized")}};function Ck(e){return["client_secret_basic","client_secret_post","none"].includes(e)}var Wc="code",Gc="S256";function Ak(e,t){let r=e.client_secret!==void 0;return"token_endpoint_auth_method"in e&&e.token_endpoint_auth_method&&Ck(e.token_endpoint_auth_method)&&(t.length===0||t.includes(e.token_endpoint_auth_method))?e.token_endpoint_auth_method:t.length===0?r?"client_secret_basic":"none":r&&t.includes("client_secret_basic")?"client_secret_basic":r&&t.includes("client_secret_post")?"client_secret_post":t.includes("none")?"none":r?"client_secret_post":"none"}function Nk(e,t,r,o){let{client_id:n,client_secret:s}=t;switch(e){case"client_secret_basic":jk(n,s,r);return;case"client_secret_post":Zk(n,s,o);return;case"none":qk(n,o);return;default:throw new Error(`Unsupported client authentication method: ${e}`)}}function jk(e,t,r){if(!t)throw new Error("client_secret_basic authentication requires a client_secret");let o=btoa(`${e}:${t}`);r.set("Authorization",`Basic ${o}`)}function Zk(e,t,r){r.set("client_id",e),t&&r.set("client_secret",t)}function qk(e,t){t.set("client_id",e)}async function o_(e){let t=e instanceof Response?e.status:void 0,r=e instanceof Response?await e.text():e;try{let o=Qg.parse(JSON.parse(r)),{error:n,error_description:s,error_uri:i}=o,a=t_[n]||at;return new a(s||"",i)}catch(o){let n=e instanceof Response?cs(e,e.url):void 0,s=`${t?`HTTP ${t}: `:""}${n??`Invalid OAuth error response: ${o}. Raw body: ${r}`}`;return new at(s)}}function Mk(e,t){let[r,o]=[e,t];try{[r,o]=[new URL(e).href,new URL(t).href]}catch{}return r===o||r.endsWith("/")&&r.slice(0,-1)===o||o.endsWith("/")&&o.slice(0,-1)===r}function Yc(e,t){if(e)return typeof e.issuer!="string"?e.issuer==null?e:{...e,issuer:void 0}:Mk(e.issuer,t)?e:void 0}var Dk=Jg.omit({issuer:!0}),Uk=Yg.omit({issuer:!0});function n_(e,t){return new Error(`OAuth client information is bound to authorization server ${e.issuer} and is not presented to ${t}. Clear the stored client information, or correct \`expectedIssuer\`, if the authorization server has moved.`)}async function Ao(e,t){try{return await Jc(e,t)}catch(r){if(r instanceof Lt||r instanceof Vt)return await e.invalidateCredentials?.("all"),await Jc(e,t);if(r instanceof Ft)return await e.invalidateCredentials?.("tokens"),await Jc(e,t);throw r}}async function Jc(e,{serverUrl:t,authorizationCode:r,scope:o,resourceMetadataUrl:n,fetchFn:s}){let i=await e.discoveryState?.(),a,c,l,u=n;if(!u&&i?.resourceMetadataUrl&&(u=new URL(i.resourceMetadataUrl)),i?.authorizationServerUrl){if(c=i.authorizationServerUrl,a=i.resourceMetadata,l=i.authorizationServerMetadata??await i_(c,{fetchFn:s}),!a)try{a=await s_(t,{resourceMetadataUrl:u},s)}catch{}(l!==i.authorizationServerMetadata||a!==i.resourceMetadata)&&await e.saveDiscoveryState?.({authorizationServerUrl:String(c),resourceMetadataUrl:u?.toString(),resourceMetadata:a,authorizationServerMetadata:l})}else{let M=await Wk(t,{resourceMetadataUrl:u,fetchFn:s});c=M.authorizationServerUrl,l=M.authorizationServerMetadata,a=M.resourceMetadata,await e.saveDiscoveryState?.({authorizationServerUrl:String(c),resourceMetadataUrl:u?.toString(),resourceMetadata:a,authorizationServerMetadata:l})}let d=String(c),m=await Fk(t,e,a),f=m&&a&&!e.validateResourceURL?a.resource:m,g=o||a?.scopes_supported?.join(" ")||e.clientMetadata.scope,h=await Promise.resolve(e.clientInformation()),_=Yc(h,d),w=e.saveClientInformation!==void 0&&!!e.redirectUrl;if(h&&!_&&!w)throw n_(h,d);let $=_?.issuer==null?_:void 0,x=async()=>{try{$&&await e.saveClientInformation?.({...$,issuer:d})}catch{}};if(!_){if(r!==void 0)throw new Error("Existing OAuth client information is required when exchanging an authorization code");let M=l?.client_id_metadata_document_supported===!0,ue=e.clientMetadataUrl;if(ue&&!Lk(ue))throw new Ht(`clientMetadataUrl must be a valid HTTPS URL with a non-root pathname, got: ${ue}`);if(M&&ue)_={client_id:ue,issuer:d},await e.saveClientInformation?.(_);else{if(!e.saveClientInformation)throw new Error("OAuth client information must be saveable for dynamic registration");_={...await Xk(c,{metadata:l,clientMetadata:e.clientMetadata,scope:g,fetchFn:s}),issuer:d},await e.saveClientInformation(_)}}let T=!e.redirectUrl;if(r!==void 0||T){let M=await Yk(e,c,{metadata:l,resource:f,authorizationCode:r,fetchFn:s});return await x(),await e.saveTokens({...M,issuer:d}),"AUTHORIZED"}let v=Yc(await e.tokens(),d);if(v?.refresh_token&&v.issuer==null&&console.warn("[mcp-sdk] stored OAuth tokens have no 'issuer' property (saved by an earlier version, or by a provider that does not keep it) and are used as-is; make sure your OAuthClientProvider stores what saveTokens() and saveClientInformation() receive unchanged."),v?.refresh_token)try{let M=await Qk(c,{metadata:l,clientInformation:_,refreshToken:v.refresh_token,resource:f,addClientAuthentication:e.addClientAuthentication,fetchFn:s});return await x(),await e.saveTokens({...M,issuer:d}),"AUTHORIZED"}catch(M){if(!(!(M instanceof ce)||M instanceof at))throw M}let z=e.state?await e.state():void 0,{authorizationUrl:C,codeVerifier:J}=await Gk(c,{metadata:l,clientInformation:_,state:z,redirectUrl:e.redirectUrl,scope:g,resource:f});return await e.saveCodeVerifier(J),await e.redirectToAuthorization(C),"REDIRECT"}function Lk(e){if(!e)return!1;try{let t=new URL(e);return t.protocol==="https:"&&t.pathname!=="/"}catch{return!1}}async function Fk(e,t,r){let o=Xg(e);if(t.validateResourceURL)return await t.validateResourceURL(o,r?.resource);if(r){if(!e_({requestedResource:o,configuredResource:r.resource}))throw new Error(`Protected resource ${r.resource} does not match expected ${o} (or origin)`);return new URL(r.resource)}}function Xc(e){let t=e.headers.get("WWW-Authenticate");if(!t)return{};let[r,o]=t.split(" ");if(r.toLowerCase()!=="bearer"||!o)return{};let n=Qc(e,"resource_metadata")||void 0,s;if(n)try{s=new URL(n)}catch{}let i=Qc(e,"scope")||void 0,a=Qc(e,"error")||void 0;return{resourceMetadataUrl:s,scope:i,error:a}}function Qc(e,t){let r=e.headers.get("WWW-Authenticate");if(!r)return null;let o=new RegExp(`${t}=(?:"([^"]+)"|([^\\s,]+))`),n=r.match(o);return n?n[1]||n[2]:null}async function s_(e,t,r=fetch){let o=await Bk(e,"oauth-protected-resource",r,{protocolVersion:t?.protocolVersion,metadataUrl:t?.resourceMetadataUrl});if(!o||o.status===404)throw await o?.body?.cancel(),new Error("Resource server does not implement OAuth 2.0 Protected Resource Metadata.");if(!o.ok)throw await o.body?.cancel(),new Error(`HTTP ${o.status} trying to load well-known OAuth protected resource metadata.`);return Wg.parse(await o.json())}async function eu(e,t,r=fetch){try{return await Ut(r)(e,{headers:t})}catch(o){if(o instanceof TypeError)return t?eu(e,void 0,r):void 0;throw o}}function Vk(e,t="",r={}){return t.endsWith("/")&&(t=t.slice(0,-1)),r.prependPathname?`${t}/.well-known/${e}`:`/.well-known/${e}${t}`}async function r_(e,t,r=fetch){return await eu(e,{"MCP-Protocol-Version":t},r)}function Hk(e,t){return!e||!e.ok&&e.status<500&&t!=="/"}async function Bk(e,t,r,o){let n=new URL(e),s=o?.protocolVersion??rr,i;if(o?.metadataUrl)i=new URL(o.metadataUrl);else{let c=Vk(t,n.pathname);i=new URL(c,o?.metadataServerUrl??n),i.search=n.search}let a=await r_(i,s,r);if(!o?.metadataUrl&&Hk(a,n.pathname)){let c=new URL(`/.well-known/${t}`,n);a=await r_(c,s,r)}return a}function Kk(e){let t=typeof e=="string"?new URL(e):e,r=t.pathname!=="/",o=[];if(!r)return o.push({url:new URL("/.well-known/oauth-authorization-server",t.origin),type:"oauth"}),o.push({url:new URL("/.well-known/openid-configuration",t.origin),type:"oidc"}),o;let n=t.pathname;return n.endsWith("/")&&(n=n.slice(0,-1)),o.push({url:new URL(`/.well-known/oauth-authorization-server${n}`,t.origin),type:"oauth"}),o.push({url:new URL(`/.well-known/openid-configuration${n}`,t.origin),type:"oidc"}),o.push({url:new URL(`${n}/.well-known/openid-configuration`,t.origin),type:"oidc"}),o}async function i_(e,{fetchFn:t=fetch,protocolVersion:r=rr}={}){let o={"MCP-Protocol-Version":r,Accept:"application/json"},n=Kk(e);for(let{url:s,type:i}of n){let a=await eu(s,o,t);if(a){if(!a.ok){if(await a.body?.cancel(),a.status<500)continue;throw new Error(`HTTP ${a.status} trying to load ${i==="oauth"?"OAuth":"OpenID provider"} metadata from ${s}`)}return i==="oauth"?Kc.parse(await a.json()):Gg.parse(await a.json())}}}async function Wk(e,t){let r,o;try{r=await s_(e,{resourceMetadataUrl:t?.resourceMetadataUrl},t?.fetchFn),r.authorization_servers&&r.authorization_servers.length>0&&(o=r.authorization_servers[0])}catch{}o||(o=String(new URL("/",e)));let n=await i_(o,{fetchFn:t?.fetchFn});return{authorizationServerUrl:o,authorizationServerMetadata:n,resourceMetadata:r}}function a_(e){return typeof e=="string"?e:e.href}async function Gk(e,{metadata:t,clientInformation:r,redirectUrl:o,scope:n,state:s,resource:i}){let a;if(t){if(a=new URL(t.authorization_endpoint),!t.response_types_supported.includes(Wc))throw new Error(`Incompatible auth server: does not support response type ${Wc}`);if(t.code_challenge_methods_supported&&!t.code_challenge_methods_supported.includes(Gc))throw new Error(`Incompatible auth server: does not support code challenge method ${Gc}`)}else a=new URL("/authorize",e);let c=await Bc(),l=c.code_verifier,u=c.code_challenge;return a.searchParams.set("response_type",Wc),a.searchParams.set("client_id",r.client_id),a.searchParams.set("code_challenge",u),a.searchParams.set("code_challenge_method",Gc),a.searchParams.set("redirect_uri",String(o)),s&&a.searchParams.set("state",s),n&&a.searchParams.set("scope",n),n?.includes("offline_access")&&a.searchParams.append("prompt","consent"),i&&a.searchParams.set("resource",a_(i)),{authorizationUrl:a,codeVerifier:l}}function Jk(e,t,r){return new URLSearchParams({grant_type:"authorization_code",code:e,code_verifier:t,redirect_uri:String(r)})}async function c_(e,{metadata:t,tokenRequestParams:r,clientInformation:o,addClientAuthentication:n,resource:s,fetchFn:i}){let a=t?.token_endpoint?new URL(t.token_endpoint):new URL("/token",e),c=new Headers({"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"});if(s&&r.set("resource",a_(s)),n)await n(c,r,a,t);else if(o){let u=t?.token_endpoint_auth_methods_supported??[],d=Ak(o,u);Nk(d,o,c,r)}let l=await Ut(i??fetch)(a,{method:"POST",headers:c,body:r});if(!l.ok)throw await o_(l);return Dk.parse(await l.json())}async function Qk(e,{metadata:t,clientInformation:r,refreshToken:o,resource:n,addClientAuthentication:s,fetchFn:i}){let a=new URLSearchParams({grant_type:"refresh_token",refresh_token:o}),c=await c_(e,{metadata:t,tokenRequestParams:a,clientInformation:r,addClientAuthentication:s,resource:n,fetchFn:i});return{refresh_token:o,...c}}async function Yk(e,t,{metadata:r,resource:o,authorizationCode:n,fetchFn:s}={}){let i=async()=>{let u=await e.clientInformation(),d=Yc(u,String(t));if(u&&!d)throw n_(u,String(t));return d},a=await i(),c=e.clientMetadata.scope,l;if(e.prepareTokenRequest&&(l=await e.prepareTokenRequest(c)),!l){if(!n)throw new Error("Either provider.prepareTokenRequest() or authorizationCode is required");if(!e.redirectUrl)throw new Error("redirectUrl is required for authorization_code flow");let u=await e.codeVerifier();l=Jk(n,u,e.redirectUrl)}return a??(a=await i()),c_(t,{metadata:r,tokenRequestParams:l,clientInformation:a,addClientAuthentication:e.addClientAuthentication,resource:o,fetchFn:s})}async function Xk(e,{metadata:t,clientMetadata:r,scope:o,fetchFn:n}){let s;if(t){if(!t.registration_endpoint)throw new Error("Incompatible auth server: does not support dynamic client registration");s=new URL(t.registration_endpoint)}else s=new URL("/register",e);let i=await Ut(n??fetch)(s,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...r,...o!==void 0?{scope:o}:{}})});if(!i.ok)throw await o_(i);return Uk.parse(await i.json())}var No=class extends Error{constructor(t,r){super(t),this.name="ParseError",this.type=r.type,this.field=r.field,this.value=r.value,this.line=r.line}},u_=10,eP=13,Bt=32;function tu(e){}function p_(e){if(typeof e=="function")throw new TypeError("`config` must be an object, got a function instead. Did you mean `createParser({onEvent: fn})`?");let{onEvent:t=tu,onError:r=tu,onRetry:o=tu,onComment:n,maxBufferSize:s}=e,i=[],a=0,c=!0,l,u="",d=0,m,f=!1;function g(v){if(f)throw new Error("Cannot feed parser: it was terminated after exceeding the configured max buffer size. Call `reset()` to resume parsing.");if(c&&(c=!1,v.charCodeAt(0)===239&&v.charCodeAt(1)===187&&v.charCodeAt(2)===191&&(v=v.slice(3))),i.length===0){let J=_(v);J!==""&&(i.push(J),a=J.length),h();return}if(v.indexOf(`
37
- `)===-1&&v.indexOf("\r")===-1){i.push(v),a+=v.length,h();return}i.push(v);let z=i.join("");i.length=0,a=0;let C=_(z);C!==""&&(i.push(C),a=C.length),h()}function h(){s!==void 0&&(a+u.length<=s||(f=!0,i.length=0,a=0,l=void 0,u="",d=0,m=void 0,r(new No(`Buffered data exceeded max buffer size of ${s} characters`,{type:"max-buffer-size-exceeded"}))))}function _(v){let z=0;if(v.indexOf("\r")===-1){let C=v.indexOf(`
38
- `,z);for(;C!==-1;){if(z===C){d>0&&t({id:l,event:m,data:u}),l=void 0,u="",d=0,m=void 0,z=C+1,C=v.indexOf(`
39
- `,z);continue}let J=v.charCodeAt(z);if(l_(v,z,J)){let M=v.charCodeAt(z+5)===Bt?z+6:z+5,ue=v.slice(M,C);if(d===0&&v.charCodeAt(C+1)===u_){t({id:l,event:m,data:ue}),l=void 0,u="",m=void 0,z=C+2,C=v.indexOf(`
40
- `,z);continue}u=d===0?ue:`${u}
41
- ${ue}`,d++}else d_(v,z,J)?m=v.slice(v.charCodeAt(z+6)===Bt?z+7:z+6,C)||void 0:w(v,z,C);z=C+1,C=v.indexOf(`
42
- `,z)}return v.slice(z)}for(;z<v.length;){let C=v.indexOf("\r",z),J=v.indexOf(`
43
- `,z),M=-1;if(C!==-1&&J!==-1?M=C<J?C:J:C!==-1?C===v.length-1?M=-1:M=C:J!==-1&&(M=J),M===-1)break;w(v,z,M),z=M+1,v.charCodeAt(z-1)===eP&&v.charCodeAt(z)===u_&&z++}return v.slice(z)}function w(v,z,C){if(z===C){x();return}let J=v.charCodeAt(z);if(l_(v,z,J)){let ut=v.charCodeAt(z+5)===Bt?z+6:z+5,ou=v.slice(ut,C);u=d===0?ou:`${u}
44
- ${ou}`,d++;return}if(d_(v,z,J)){m=v.slice(v.charCodeAt(z+6)===Bt?z+7:z+6,C)||void 0;return}if(J===105&&v.charCodeAt(z+1)===100&&v.charCodeAt(z+2)===58){let ut=v.slice(v.charCodeAt(z+3)===Bt?z+4:z+3,C);ut.includes("\0")||(l=ut);return}if(J===58){if(n){let ut=v.slice(z,C);n(ut.slice(v.charCodeAt(z+1)===Bt?2:1))}return}let M=v.slice(z,C),ue=M.indexOf(":");if(ue===-1){$(M,"",M);return}let Kt=M.slice(0,ue),Sr=M.charCodeAt(ue+1)===Bt?2:1,jo=M.slice(ue+Sr);$(Kt,jo,M)}function $(v,z,C){switch(v){case"event":m=z||void 0;break;case"data":u=d===0?z:`${u}
45
- ${z}`,d++;break;case"id":z.includes("\0")||(l=z);break;case"retry":/^\d+$/.test(z)?o(parseInt(z,10)):r(new No(`Invalid \`retry\` value: "${z}"`,{type:"invalid-retry",value:z,line:C}));break;default:r(new No(`Unknown field "${v.length>20?`${v.slice(0,20)}\u2026`:v}"`,{type:"unknown-field",field:v,value:z,line:C}));break}}function x(){d>0&&t({id:l,event:m,data:u}),l=void 0,u="",d=0,m=void 0}function T(v={}){if(v.consume&&i.length>0){let z=i.join("");w(z,0,z.length)}c=!0,l=void 0,u="",d=0,m=void 0,i.length=0,a=0,f=!1}return{feed:g,reset:T}}function l_(e,t,r){return r===100&&e.charCodeAt(t+1)===97&&e.charCodeAt(t+2)===116&&e.charCodeAt(t+3)===97&&e.charCodeAt(t+4)===58}function d_(e,t,r){return r===101&&e.charCodeAt(t+1)===118&&e.charCodeAt(t+2)===101&&e.charCodeAt(t+3)===110&&e.charCodeAt(t+4)===116&&e.charCodeAt(t+5)===58}var us=class extends TransformStream{constructor({onError:t,onRetry:r,onComment:o,maxBufferSize:n}={}){let s;super({start(i){s=p_({onEvent:a=>{i.enqueue(a)},onError(a){typeof t=="function"&&t(a),(t==="terminate"||a.type==="max-buffer-size-exceeded")&&i.error(a)},onRetry:r,onComment:o,maxBufferSize:n})},transform(i){s.feed(i)}})}};var tP={initialReconnectionDelay:1e3,maxReconnectionDelay:3e4,reconnectionDelayGrowFactor:1.5,maxRetries:2},xt=class extends Error{constructor(t,r){super(`Streamable HTTP error: ${r}`),this.code=t}},ru=class{constructor(t,r){this._hasCompletedAuthFlow=!1,this._url=t,this._resourceMetadataUrl=void 0,this._scope=void 0,this._requestInit=r?.requestInit,this._authProvider=r?.authProvider,this._fetch=r?.fetch,this._fetchWithInit=Vg(r?.fetch,r?.requestInit),this._followRedirects=r?.redirectPolicy==="follow",this._followRedirects&&(this._fetch=Vc(this._fetch),this._fetchWithInit=Vc(this._fetchWithInit)),this._sessionId=r?.sessionId,this._reconnectionOptions=r?.reconnectionOptions??tP}_unfollowedRedirect(t,r){let o=cs(t,r);return o&&!this._followRedirects?`${o} (redirectPolicy: 'same-origin')`:o}async _authThenStart(){if(!this._authProvider)throw new ct("No auth provider");let t;try{t=await Ao(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})}catch(r){throw this.onerror?.(r),r}if(t!=="AUTHORIZED")throw new ct;return await this._startOrAuthSse({resumptionToken:void 0})}async _commonHeaders(){let t={};if(this._authProvider){let o=await this._authProvider.tokens();o&&(t.Authorization=`Bearer ${o.access_token}`)}this._sessionId&&(t["mcp-session-id"]=this._sessionId),this._protocolVersion&&(t["mcp-protocol-version"]=this._protocolVersion);let r=is(this._requestInit?.headers);return new Headers({...t,...r})}async _startOrAuthSse(t){let{resumptionToken:r}=t;try{let o=await this._commonHeaders();o.set("Accept","text/event-stream"),r&&o.set("last-event-id",r);let n=this._fetch??fetch,s={method:"GET",headers:o,signal:this._abortController?.signal},i=await n(this._url,this._followRedirects?s:{...s,redirect:"manual"}),a=this._followRedirects?void 0:as(n,this._url,s,i);if(a&&(i=await a),!i.ok){if(await i.body?.cancel(),i.status===401&&this._authProvider)return await this._authThenStart();if(i.status===405)return;throw new xt(i.status,`Failed to open SSE stream: ${this._unfollowedRedirect(i,this._url)??i.statusText}`)}this._handleSseStream(i.body,t,!0)}catch(o){throw this.onerror?.(o),o}}_getNextReconnectionDelay(t){if(this._serverRetryMs!==void 0)return this._serverRetryMs;let r=this._reconnectionOptions.initialReconnectionDelay,o=this._reconnectionOptions.reconnectionDelayGrowFactor,n=this._reconnectionOptions.maxReconnectionDelay;return Math.min(r*Math.pow(o,t),n)}_scheduleReconnection(t,r=0){let o=this._reconnectionOptions.maxRetries;if(r>=o){this.onerror?.(new Error(`Maximum reconnection attempts (${o}) exceeded.`));return}let n=this._getNextReconnectionDelay(r);this._reconnectionTimeout=setTimeout(()=>{this._startOrAuthSse(t).catch(s=>{this.onerror?.(new Error(`Failed to reconnect SSE stream: ${s instanceof Error?s.message:String(s)}`)),this._scheduleReconnection(t,r+1)})},n)}_handleSseStream(t,r,o){if(!t)return;let{onresumptiontoken:n,replayMessageId:s}=r,i,a=!1,c=!1;(async()=>{try{let u=t.pipeThrough(new TextDecoderStream).pipeThrough(new us({onRetry:f=>{this._serverRetryMs=f}})).getReader();for(;;){let{value:f,done:g}=await u.read();if(g)break;if(f.id&&(i=f.id,a=!0,n?.(f.id)),!!f.data&&(!f.event||f.event==="message"))try{let h=or.parse(JSON.parse(f.data));kt(h)&&(c=!0,s!==void 0&&(h.id=s)),this.onmessage?.(h)}catch(h){this.onerror?.(h)}}(o||a)&&!c&&this._abortController&&!this._abortController.signal.aborted&&this._scheduleReconnection({resumptionToken:i,onresumptiontoken:n,replayMessageId:s},0)}catch(u){if(this.onerror?.(new Error(`SSE stream disconnected: ${u}`)),(o||a)&&!c&&this._abortController&&!this._abortController.signal.aborted)try{this._scheduleReconnection({resumptionToken:i,onresumptiontoken:n,replayMessageId:s},0)}catch(f){this.onerror?.(new Error(`Failed to reconnect: ${f instanceof Error?f.message:String(f)}`))}}})()}async start(){if(this._abortController)throw new Error("StreamableHTTPClientTransport already started! If using Client class, note that connect() calls start() automatically.");this._abortController=new AbortController}async finishAuth(t){if(!this._authProvider)throw new ct("No auth provider");if(await Ao(this._authProvider,{serverUrl:this._url,authorizationCode:t,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})!=="AUTHORIZED")throw new ct("Failed to authorize")}async close(){this._reconnectionTimeout&&(clearTimeout(this._reconnectionTimeout),this._reconnectionTimeout=void 0),this._abortController?.abort(),this.onclose?.()}async send(t,r){try{let{resumptionToken:o,onresumptiontoken:n}=r||{};if(o){this._startOrAuthSse({resumptionToken:o,replayMessageId:Zr(t)?t.id:void 0}).catch(f=>this.onerror?.(f));return}let s=await this._commonHeaders();s.set("content-type","application/json"),s.set("accept","application/json, text/event-stream");let i={...this._requestInit,method:"POST",headers:s,body:JSON.stringify(t),signal:this._abortController?.signal},a=await Ut(this._fetch??fetch)(this._url,i),c=a.headers.get("mcp-session-id");if(c&&(this._sessionId=c),!a.ok){let f=await a.text().catch(()=>null);if(a.status===401&&this._authProvider){if(this._hasCompletedAuthFlow)throw new xt(401,"Server returned 401 after successful authentication");let{resourceMetadataUrl:g,scope:h}=Xc(a);if(this._resourceMetadataUrl=g,this._scope=h,await Ao(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})!=="AUTHORIZED")throw new ct;return this._hasCompletedAuthFlow=!0,this.send(t)}if(a.status===403&&this._authProvider){let{resourceMetadataUrl:g,scope:h,error:_}=Xc(a);if(_==="insufficient_scope"){let w=a.headers.get("WWW-Authenticate");if(this._lastUpscopingHeader===w)throw new xt(403,"Server returned 403 after trying upscoping");if(h&&(this._scope=h),g&&(this._resourceMetadataUrl=g),this._lastUpscopingHeader=w??void 0,await Ao(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetch})!=="AUTHORIZED")throw new ct;return this.send(t)}}throw new xt(a.status,`Error POSTing to endpoint: ${this._unfollowedRedirect(a,this._url)??f}`)}if(this._hasCompletedAuthFlow=!1,this._lastUpscopingHeader=void 0,a.status===202){await a.body?.cancel(),Ip(t)&&this._startOrAuthSse({resumptionToken:void 0}).catch(f=>this.onerror?.(f));return}let u=(Array.isArray(t)?t:[t]).filter(f=>"method"in f&&"id"in f&&f.id!==void 0).length>0,d=a.headers.get("content-type"),m=Fg(d);if(u)if(m==="text/event-stream")this._handleSseStream(a.body,{onresumptiontoken:n},!1);else if(m==="application/json"){let f=await a.json(),g=Array.isArray(f)?f.map(h=>or.parse(h)):[or.parse(f)];for(let h of g)this.onmessage?.(h)}else throw await a.body?.cancel(),new xt(-1,`Unexpected content type: ${d}`);else await a.body?.cancel()}catch(o){throw this.onerror?.(o),o}}get sessionId(){return this._sessionId}async terminateSession(){if(this._sessionId)try{let t=await this._commonHeaders(),r={...this._requestInit,method:"DELETE",headers:t,signal:this._abortController?.signal},o=await Ut(this._fetch??fetch)(this._url,r);if(await o.body?.cancel(),!o.ok&&o.status!==405)throw new xt(o.status,`Failed to terminate session: ${this._unfollowedRedirect(o,this._url)??o.statusText}`);this._sessionId=void 0}catch(t){throw this.onerror?.(t),t}}setProtocolVersion(t){this._protocolVersion=t}get protocolVersion(){return this._protocolVersion}async resumeStream(t,r){await this._startOrAuthSse({resumptionToken:t,onresumptiontoken:r?.onresumptiontoken})}};export{Ic as Client,Uc as StdioClientTransport,ru as StreamableHTTPClientTransport};
55
+
56
+ `)}return b.write("payload.value = newResult;"),b.write("return payload;"),b.compile()},i,c=hr,a=!Ye.jitless,l=a&&xc.value,d=t.catchall,h;e._zod.parse=(_,y)=>{h??(h=o.value);let z=_.value;return c(z)?a&&l&&y?.async===!1&&y.jitless!==!0?(i||(i=s(t.shape)),_=i(_,y),d?Wm([],z,_,y,h,e,y?.abortEarly===!0):_):r(_,y):(_.issues.push({expected:"object",code:"invalid_type",input:z,inst:e}),_)}});function nm(e,t,r,o){for(let s of e)if(s.issues.length===0)return t.value=s.value,t;let n=e.filter(s=>!lt(s));return n.length===1?(t.value=n[0].value,n[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map(s=>s.issues.map(i=>dt(i,o,Xe())))}),t)}var ou=D("$ZodUnion",(e,t)=>{Re.init(e,t),_e(e,"optin",o=>o.def.options.some(n=>n._zod.optin==="defaulted")?"defaulted":o.def.options.some(n=>n._zod.optin!==void 0)?"optional":void 0),_e(e,"optout",o=>o.def.options.some(n=>n._zod.optout==="optional")?"optional":void 0),_e(e,"values",o=>{if(o.def.options.every(n=>n._zod.values))return new Set(o.def.options.flatMap(n=>Array.from(n._zod.values)))}),_e(e,"pattern",o=>{if(o.def.options.every(n=>n._zod.pattern)){let n=o.def.options.map(s=>s._zod.pattern);return new RegExp(`^(${n.map(s=>Xo(s.source)).join("|")})$`)}});let r=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(o,n)=>{if(r)return r(o,n);let s=!1,i=[];for(let c of t.options){let a=c._zod.run({value:o.value,issues:[]},n);if(a instanceof Promise)i.push(a),s=!0;else{if(a.issues.length===0)return a;i.push(a)}}return s?Promise.all(i).then(c=>nm(c,o,e,n)):nm(i,o,e,n)}});function Zv(e){let t=new Map;for(let r of e.options){let o=r._zod.propValues?.[e.discriminator];if(!o||o.size===0)throw new Error(`Invalid discriminated union option at index "${e.options.indexOf(r)}"`);for(let n of o)if(t.has(n)){if(n!==void 0)throw new Error(`Duplicate discriminator value "${String(n)}"`);t.set(n,null)}else t.set(n,r)}return t}var Xm=D("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,ou.init(e,t);let r=e._zod.parse;_e(e,"propValues",n=>{let s={},i=0;for(let c of n.def.options){let a=c._zod.propValues;if(!a||Object.keys(a).length===0)throw new Error(`Invalid discriminated union option at index "${n.def.options.indexOf(c)}"`);a[n.def.discriminator]?.has(void 0)&&i++;for(let[u,l]of Object.entries(a)){Object.prototype.hasOwnProperty.call(s,u)||We(s,u,new Set);for(let d of l)s[u].add(d)}}return!n.def.unionFallback&&i>1&&s[n.def.discriminator]?.delete(void 0),s}),t.options.forEach((n,s)=>{let i=Ur(n._zod.def);if(i&&!Object.prototype.hasOwnProperty.call(i,t.discriminator))throw new Error(`Invalid discriminated union option at index "${s}"`)});let o=Dr(()=>Zv(t));e._zod.parse=(n,s)=>{let i=n.value;if(!hr(i))return n.issues.push({code:"invalid_type",expected:"object",input:i,inst:e}),n;let c=i?.[t.discriminator],a=o.value.get(c);return a&&(c!==void 0||s.direction!=="backward")?a._zod.run(n,s):t.unionFallback||s.direction==="backward"?r(n,s):(n.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,options:Array.from(o.value.keys()).filter(u=>o.value.get(u)!==null),input:i,path:[t.discriminator],inst:e}),n)}}),Qm=D("$ZodIntersection",(e,t)=>{Re.init(e,t),e._zod.parse=(r,o)=>{let n=r.value,s=t.left._zod.run({value:n,issues:[]},o),i=t.right._zod.run({value:n,issues:[]},o);return s instanceof Promise||i instanceof Promise?Promise.all([s,i]).then(([a,u])=>sm(r,a,u)):sm(r,s,i)}});function Qc(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(Vt(e)&&Vt(t)){let r=Object.keys(t),o=Object.keys(e).filter(s=>r.indexOf(s)!==-1),n={...e,...t};Object.prototype.hasOwnProperty.call(n,"__proto__")&&delete n.__proto__;for(let s of o){if(s==="__proto__")continue;let i=Qc(e[s],t[s]);if(!i.valid)return{valid:!1,mergeErrorPath:[s,...i.mergeErrorPath]};n[s]=i.data}return{valid:!0,data:n}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let r=[];for(let o=0;o<e.length;o++){let n=e[o],s=t[o],i=Qc(n,s);if(!i.valid)return{valid:!1,mergeErrorPath:[o,...i.mergeErrorPath]};r.push(i.data)}return{valid:!0,data:r}}return{valid:!1,mergeErrorPath:[]}}function sm(e,t,r){let o=new Map,n,s=new Map,i=(u,l)=>{let d;if(u.code==="unrecognized_keys"&&!u.path?.length)n??(n=u),d=u.keys;else if(u.code==="invalid_key"&&u.origin==="record"&&u.path?.length===1){let h=String(u.path[0]);s.has(h)||s.set(h,u),d=[h]}else return!1;for(let h of d)o.has(h)||o.set(h,{}),o.get(h)[l]=!0;return!0};for(let u of t.issues)i(u,"l")||e.issues.push(u);for(let u of r.issues)i(u,"r")||e.issues.push(u);let c=[...o].filter(([,u])=>u.l&&u.r).map(([u])=>u);if(c.length){let u=n?c.filter(l=>n.keys.includes(l)):[];u.length&&e.issues.push({...n,keys:u});for(let l of c)!u.includes(l)&&s.has(l)&&e.issues.push(s.get(l))}let a=Qc(t.value,r.value);if(!a.valid){if(lt(e))return e;throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(a.mergeErrorPath)}`)}return e.value=a.data,e}var eh=D("$ZodRecord",(e,t)=>{Re.init(e,t);let r=Ye.memoizer;r?.attach(e),e._zod.parse=(o,n)=>{let s=o.value;if(!Vt(s))return o.issues.push({expected:"record",code:"invalid_type",input:s,inst:e}),o;let i=[],c=t.keyType._zod.values;if(c&&!t.partial){o.value=r?r.alloc(e,o,{},n):{};let a=new Set;for(let l of c)if(typeof l=="string"||typeof l=="number"||typeof l=="symbol"){if(a.add(typeof l=="number"?l.toString():l),l==="__proto__")continue;let d=t.keyType._zod.run({value:l,issues:[]},n);if(d instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(d.issues.length){o.issues.push({code:"invalid_key",origin:"record",issues:d.issues.map(y=>dt(y,n,Xe())),input:l,path:[l],inst:e});continue}let h=d.value;if(h==="__proto__")continue;let _=t.valueType._zod.run({value:s[l],issues:[]},n);_ instanceof Promise?i.push(_.then(y=>{y.issues.length&&o.issues.push(...$t(l,y.issues)),o.value[h]=y.value})):(_.issues.length&&o.issues.push(...$t(l,_.issues)),o.value[h]=_.value)}let u;for(let l in s)if(!a.has(l))if(t.mode==="loose"){if(l==="__proto__")continue;o.value[l]=s[l]}else u=u??[],u.push(l);u&&u.length>0&&o.issues.push({code:"unrecognized_keys",input:s,inst:e,keys:u,continue:!0})}else{o.value=r?r.alloc(e,o,{},n):{};let a;for(let u of Reflect.ownKeys(s)){if(u==="__proto__"||!Object.prototype.propertyIsEnumerable.call(s,u))continue;let l=t.keyType._zod.run({value:u,issues:[]},n);if(l instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(typeof u=="string"&&on.test(u)&&l.issues.length){let y=t.keyType._zod.run({value:Number(u),issues:[]},n);if(y instanceof Promise)throw new Error("Async schemas not supported in object keys currently");y.issues.length===0&&(l=y)}if(l.issues.length){t.mode==="loose"?o.value[u]=s[u]:c?(a=a??[],a.push(u)):o.issues.push({code:"invalid_key",origin:"record",issues:l.issues.map(y=>dt(y,n,Xe())),input:u,path:[u],inst:e});continue}let h=l.value;if(h==="__proto__")continue;let _=t.valueType._zod.run({value:s[u],issues:[]},n);_ instanceof Promise?i.push(_.then(y=>{y.issues.length&&o.issues.push(...$t(u,y.issues)),o.value[h]=y.value})):(_.issues.length&&o.issues.push(...$t(u,_.issues)),o.value[h]=_.value)}a&&a.length>0&&o.issues.push({code:"unrecognized_keys",input:s,inst:e,keys:a,continue:!0})}return i.length?Promise.all(i).then(()=>o):o}});var th=D("$ZodEnum",(e,t)=>{Re.init(e,t);let r=qr(t.entries),o=new Set(r);e._zod.values=o,_e(e,"pattern",n=>{let s=qr(n.def.entries).filter(i=>Nc.has(typeof i));return new RegExp(s.length?`^(${s.map(i=>Rt(i.toString())).join("|")})$`:"^[^\\s\\S]$")}),e._zod.parse=(n,s)=>{let i=n.value;return o.has(i)||n.issues.push({code:"invalid_value",values:r,input:i,inst:e}),n}}),rh=D("$ZodLiteral",(e,t)=>{Re.init(e,t);let r=new Set(t.values);e._zod.values=r,_e(e,"pattern",o=>{let n=o.def.values;return new RegExp(n.length?`^(${n.map(s=>typeof s=="string"?Rt(s):s?Rt(s.toString()):String(s)).join("|")})$`:"^[^\\s\\S]$")}),e._zod.parse=(o,n)=>{let s=o.value;return r.has(s)||o.issues.push({code:"invalid_value",values:t.values,input:s,inst:e}),o}});var oh=D("$ZodTransform",(e,t)=>{Re.init(e,t),e._zod.optin="optional",Ye.memoizer?.guard(e),e._zod.parse=(r,o)=>{if(o.direction==="backward")throw new Vr(e.constructor.name);let n=t.transform(r.value,r);if(o.async)return(n instanceof Promise?n:Promise.resolve(n)).then(i=>(r.value=i,r));if(n instanceof Promise)throw new pt;return r.value=n,r}});function im(e,t){return e.value=t.issues.length?void 0:t.value,e}var nu=D("$ZodOptional",(e,t)=>{Re.init(e,t),_e(e,"optin",r=>r.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),e._zod.optout="optional",_e(e,"values",r=>{let o=r.def.innerType._zod.values;return o?new Set([...o,void 0]):void 0}),_e(e,"pattern",r=>{let o=r.def.innerType._zod.pattern;return o?new RegExp(`^(${Xo(o.source)})?$`):void 0}),e._zod.parse=(r,o)=>{if(r.value===void 0){if(t.innerType._zod.optin!=="defaulted")return r;let n=t.innerType._zod.run({value:r.value,issues:[]},o);return n instanceof Promise?n.then(s=>im(r,s)):im(r,n)}return t.innerType._zod.run(r,o)}}),nh=D("$ZodExactOptional",(e,t)=>{nu.init(e,t),_e(e,"values",r=>r.def.innerType._zod.values),_e(e,"pattern",r=>r.def.innerType._zod.pattern),e._zod.parse=(r,o)=>t.innerType._zod.run(r,o)}),sh=D("$ZodNullable",(e,t)=>{Re.init(e,t),_e(e,"optin",r=>r.def.innerType._zod.optin),_e(e,"optout",r=>r.def.innerType._zod.optout),_e(e,"pattern",r=>{let o=r.def.innerType._zod.pattern;return o?new RegExp(`^(${Xo(o.source)}|null)$`):void 0}),_e(e,"values",r=>r.def.innerType._zod.values?new Set([...r.def.innerType._zod.values,null]):void 0),e._zod.parse=(r,o)=>r.value===null?r:t.innerType._zod.run(r,o)}),ih=D("$ZodDefault",(e,t)=>{Re.init(e,t),e._zod.optin="defaulted",_e(e,"values",r=>r.def.innerType._zod.values),e._zod.parse=(r,o)=>{if(o.direction==="backward")return t.innerType._zod.run(r,o);if(r.value===void 0)return r.value=t.defaultValue,r;let n=t.innerType._zod.run(r,o);return n instanceof Promise?n.then(s=>am(s,t)):am(n,t)}});function am(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}var ah=D("$ZodPrefault",(e,t)=>{Re.init(e,t),e._zod.optin="defaulted",_e(e,"values",r=>r.def.innerType._zod.values),e._zod.parse=(r,o)=>(o.direction==="backward"||r.value===void 0&&(r.value=t.defaultValue),t.innerType._zod.run(r,o))}),ch=D("$ZodNonOptional",(e,t)=>{Re.init(e,t),_e(e,"values",r=>{let o=r.def.innerType._zod.values;return o?new Set([...o].filter(n=>n!==void 0)):void 0}),e._zod.parse=(r,o)=>{let n=t.innerType._zod.run(r,o);return n instanceof Promise?n.then(s=>cm(s,e)):cm(n,e)}});function cm(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}function um(e,t,r,o){return t.issues.length?(e.value=r.catchValue({...t,value:e.value,error:{issues:t.issues.map(n=>dt(n,o,Xe()))},input:e.value}),e):(e.value=t.value,t.memo&&(e.memo=!0),e)}var uh=D("$ZodCatch",(e,t)=>{Re.init(e,t),_e(e,"optin",r=>r.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),_e(e,"optout",r=>r.def.innerType._zod.optout),_e(e,"values",r=>r.def.innerType._zod.values),e._zod.parse=(r,o)=>{if(o.direction==="backward")return t.innerType._zod.run(r,o);let n=t.innerType._zod.run({value:r.value,issues:[]},o);return n instanceof Promise?n.then(s=>um(r,s,t,o)):um(r,n,t,o)}});var su=D("$ZodPipe",(e,t)=>{Re.init(e,t),_e(e,"values",r=>r.def.in._zod.values),_e(e,"optin",r=>r.def.in._zod.optin),_e(e,"optout",r=>r.def.out._zod.optout),_e(e,"propValues",r=>r.def.in._zod.propValues),e._zod.parse=(r,o)=>{if(o.direction==="backward"){let s=t.out._zod.run(r,o);return s instanceof Promise?s.then(i=>Us(i,t.in,o)):Us(s,t.in,o)}let n=t.in._zod.run(r,o);return n instanceof Promise?n.then(s=>Us(s,t.out,o)):Us(n,t.out,o)}});function Us(e,t,r){return e.issues.some(o=>o.code!=="unrecognized_keys")?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},r)}var lh=D("$ZodPreprocess",(e,t)=>{su.init(e,t)}),dh=D("$ZodReadonly",(e,t)=>{Re.init(e,t),_e(e,"propValues",r=>r.def.innerType._zod.propValues),_e(e,"values",r=>r.def.innerType._zod.values),_e(e,"optin",r=>r.def.innerType?._zod?.optin),_e(e,"optout",r=>r.def.innerType?._zod?.optout),e._zod.parse=(r,o)=>{if(o.direction==="backward")return t.innerType._zod.run(r,o);let n=t.innerType._zod.run(r,o);return n instanceof Promise?n.then(lm):lm(n)}});function lm(e){return e.memo||(e.value=Object.freeze(e.value)),e}var ph=D("$ZodLazy",(e,t)=>{Re.init(e,t),Cc(e._zod,"innerType",()=>{let r=t;return r._cachedInner||(r._cachedInner=t.getter()),r._cachedInner}),_e(e,"pattern",r=>r.innerType?._zod?.pattern),_e(e,"propValues",r=>r.innerType?._zod?.propValues),_e(e,"optin",r=>r.innerType?._zod?.optin??void 0),_e(e,"optout",r=>r.innerType?._zod?.optout??void 0),e._zod.parse=(r,o)=>e._zod.innerType._zod.run(r,o)}),mh=D("$ZodCustom",(e,t)=>{Ze.init(e,t),Re.init(e,t),e._zod.parse=(r,o)=>r,e._zod.check=r=>{let o=r.value,n=t.fn(o);if(n instanceof Promise)return n.then(s=>dm(s,r,o,e));dm(n,r,o,e)}});function dm(e,t,r,o){if(!e){let n={code:"custom",input:r,inst:o,path:[...o._zod.def.path??[]],continue:!o._zod.def.abort};o._zod.def.params&&(n.params=o._zod.def.params),t.issues.push(Zr(n))}}var au=class extends Error{constructor(){super("Cannot parse a reference cycle that closes through a transform"),this.name="ZodCyclicError"}},cu="~memo",hh=[];function fh(e){return e!==null&&typeof e=="object"}function iu(e){return e.map(t=>t.path?{...t,path:t.path.slice()}:{...t})}var gh=new WeakMap,sn=0,Ks=1,an=2;function Gs(e,t,r){let o=gh.get(e);if(o!==void 0)return o?an:sn;if(t.has(e))return an;t.add(e);let n=sn,s=l=>{if(n!==an&&l?._zod){let d=Gs(l,t,r);d>n&&(n=d)}},i=(l,d)=>{let h=sn;for(let _ of Reflect.ownKeys(l)){let y=Object.getOwnPropertyDescriptor(l,_);if(d&&!y.enumerable)continue;let z=y.get?Ks:y.value?._zod?Gs(y.value,t,r):sn;z>h&&(h=z)}return h},c=l=>{l>n&&(n=l)},a=e._zod.def,u=a.type;switch(u){case"object":{let l=Ur(a);c(l?i(l,!0):Ks),s(a.catchall);break}case"array":s(a.element);break;case"tuple":for(let l of a.items)s(l);s(a.rest);break;case"record":case"map":s(a.keyType),s(a.valueType);break;case"set":s(a.valueType);break;case"union":for(let l of a.options)s(l);break;case"intersection":s(a.left),s(a.right);break;case"optional":case"nullable":case"default":case"prefault":case"catch":case"readonly":case"nonoptional":case"promise":case"success":s(a.innerType);break;case"pipe":s(a.in),s(a.out);break;case"function":s(a.input),s(a.output);break;case"lazy":{let l=a._cachedInner??(r?e._zod.innerType:void 0);c(l?Gs(l,t,!1):Ks);break}case"template_literal":case"string":case"number":case"int":case"boolean":case"bigint":case"symbol":case"undefined":case"null":case"void":case"never":case"any":case"unknown":case"date":case"nan":case"enum":case"literal":case"file":case"transform":case"custom":break;default:for(let l in a){let d=Object.getOwnPropertyDescriptor(a,l);if(!d||d.get)continue;let h=d.value;if(!(!h||typeof h!="object")){if(h._zod)s(h);else if(Array.isArray(h))for(let _ of h)s(_)}}}return t.delete(e),Vv(e,n)}function Vv(e,t){return t!==Ks&&gh.set(e,t===an),t}function Fv(e,t){let r=e.buckets.get(t);return r||(r=new WeakMap,e.buckets.set(t,r)),r}var Bs,Js=[],Hv={alloc(e,t,r){let o=Bs;if(!o)return r;Bs=void 0;let n={value:r,issues:null};return o.set(t.value,n),Js.push(n),r},guard(e){var t;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let r=e._zod.parse,o=(n,s)=>{if(s.direction!=="backward"&&Bv(s,n.value))throw new au;return r(n,s)};e._zod.parse=o,e._zod.run===r&&(e._zod.run=o)})},attach(e){var t;let r,o=!1,n,s;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let i=e._zod.parse,c=(a,u)=>{if(r===void 0){let g=Gs(e,new Set,!1);if(g===sn)return e._zod.parse=i,e._zod.run===c&&(e._zod.run=i),i(a,u);g===an||o?r=!0:o=!0}let l=a.value;if(!fh(l))return i(a,u);let d=u[cu];d||(d={buckets:new WeakMap,backEdges:void 0},u[cu]=d);let h;n===u?h=s:(h=Fv(d,e),n=u,s=h);let _=h.get(l);if(_)return a.value=_.value,_.issues?_.issues.length&&a.issues.push(...iu(_.issues)):(a.memo=!0,d.backEdges??(d.backEdges=new WeakSet),d.backEdges.add(_.value)),a;Bs=h;let y=Js.length,z=i(a,u);Bs=void 0;let b=Js.length>y?Js.pop():void 0;return z instanceof Promise?z.then(g=>(b&&(b.issues=g.issues.length?iu(g.issues):hh),g)):(b&&(b.issues=z.issues.length?iu(z.issues):hh),z)};e._zod.parse=c,e._zod.run===i&&(e._zod.run=c)})}};function uu(){return Hv}function Bv(e,t){let r=e[cu]?.backEdges;return r!==void 0&&fh(t)&&r.has(t)}var Jv=()=>{let e={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"},map:{unit:"entries",verb:"to have"}};function t(s){return e[s]??null}let r={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",mac:"MAC address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",currency_code:"currency code",credit_card:"credit card number",iban:"IBAN",jwt:"JWT",template_literal:"input"},o={nan:"NaN"};function n(s,i){return s==="number"&&typeof i=="number"&&!Number.isFinite(i)?String(i):o[s]??s}return s=>{switch(s.code){case"invalid_type":{let i=n(s.expected),c=Mc(s.input),a=n(c,s.input);return`Invalid input: expected ${i}, received ${a}`}case"invalid_value":return s.values.length===1?`Invalid input: expected ${ks(s.values[0])}`:`Invalid option: expected one of ${Es(s.values,"|")}`;case"too_big":{let i=s.exact?"exactly ":s.inclusive?"<=":"<",c=t(s.origin);return c?`Too big: expected ${s.origin??"value"} to have ${i}${s.maximum.toString()} ${c.unit??"elements"}`:`Too big: expected ${s.origin??"value"} to be ${i}${s.maximum.toString()}`}case"too_small":{let i=s.exact?"exactly ":s.inclusive?">=":">",c=t(s.origin);return c?`Too small: expected ${s.origin} to have ${i}${s.minimum.toString()} ${c.unit}`:`Too small: expected ${s.origin} to be ${i}${s.minimum.toString()}`}case"invalid_format":{let i=s;return i.format==="starts_with"?`Invalid string: must start with "${i.prefix}"`:i.format==="ends_with"?`Invalid string: must end with "${i.suffix}"`:i.format==="includes"?`Invalid string: must include "${i.includes}"`:i.format==="regex"?`Invalid string: must match pattern ${i.pattern}`:`Invalid ${r[i.format]??s.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${s.divisor}`;case"unrecognized_keys":return`Unrecognized key${s.keys.length>1?"s":""}: ${Es(s.keys,", ")}`;case"invalid_key":return`Invalid key in ${s.origin}`;case"invalid_union":return s.options&&Array.isArray(s.options)&&s.options.length>0?`Invalid discriminator value. Expected ${s.options.map(c=>`'${c}'`).join(" | ")}`:s.inclusive===!1?"Invalid input: more than one option matched":"Invalid input";case"invalid_element":return`Invalid value in ${s.origin}`;default:return"Invalid input"}}};function _h(){return{localeError:Jv()}}var Sh;var lu=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(t,...r){let o=r[0];return this._map.set(t,o),o&&typeof o=="object"&&"id"in o&&this._idmap.set(o.id,t),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(t){let r=this._map.get(t);return r&&typeof r=="object"&&"id"in r&&this._idmap.delete(r.id),this._map.delete(t),this}get(t){let r=t._zod.parent;if(r){let o={...this.get(r)??{}};delete o.id;let n={...o,...this._map.get(t)};return Object.keys(n).length?n:void 0}return this._map.get(t)}has(t){return this._map.has(t)}};function yh(){return new lu}(Sh=globalThis).__zod_globalRegistry??(Sh.__zod_globalRegistry=yh());var Ft=globalThis.__zod_globalRegistry;function Ws(e){return e.checks&&(e.checks=[...e.checks]),e}function vh(e,t){return new e(Ws({type:"string",...ce(t)}))}function bh(e,t){return new e(Ws({type:"string",coerce:!0,...ce(t)}))}function du(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...ce(t)})}function zh(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...ce(t)})}function wh(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...ce(t)})}function Rh(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...ce(t)})}function $h(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...ce(t)})}function Ph(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...ce(t)})}function pu(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...ce(t)})}function Eh(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...ce(t)})}function Th(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...ce(t)})}function kh(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...ce(t)})}function Ch(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...ce(t)})}function Oh(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...ce(t)})}function Ih(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...ce(t)})}function xh(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...ce(t)})}function Nh(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...ce(t)})}function Ah(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...ce(t)})}function jh(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...ce(t)})}function Mh(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...ce(t)})}function qh(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...ce(t)})}function Lh(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...ce(t)})}function Dh(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...ce(t)})}function Uh(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...ce(t)})}function Ys(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...ce(t)})}function Xs(e,t){return new e({type:"string",format:"date",check:"string_format",...ce(t)})}function Qs(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...ce(t)})}function ei(e,t){return new e({type:"string",format:"duration",check:"string_format",...ce(t)})}function Zh(e,t){return new e(Ws({type:"number",checks:[],...ce(t)}))}function Vh(e,t){return new e(Ws({type:"number",coerce:!0,checks:[],...ce(t)}))}function Fh(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...ce(t)})}function Hh(e,t){return new e({type:"boolean",...ce(t)})}function Bh(e,t){return new e({type:"boolean",coerce:!0,...ce(t)})}function Jh(e,t){return new e({type:"bigint",coerce:!0,...ce(t)})}function Kh(e,t){return new e({type:"null",...ce(t)})}function Gh(e){return new e({type:"any"})}function Wh(e){return new e({type:"unknown"})}function Yh(e,t){return new e({type:"never",...ce(t)})}function Xh(e,t){return new e({type:"date",coerce:!0,...ce(t)})}function Hr(e,t){return new Yc({check:"less_than",...ce(t),value:e,inclusive:!1})}function Pt(e,t){return new Yc({check:"less_than",...ce(t),value:e,inclusive:!0})}function Br(e,t){return new Xc({check:"greater_than",...ce(t),value:e,inclusive:!1})}function Et(e,t){return new Xc({check:"greater_than",...ce(t),value:e,inclusive:!0})}function cn(e,t){return new Zp({check:"multiple_of",...ce(t),value:e})}function ti(e,t){return new Fp({check:"max_length",...ce(t),maximum:e})}function Jr(e,t){return new Hp({check:"min_length",...ce(t),minimum:e})}function ri(e,t){return new Bp({check:"length_equals",...ce(t),length:e})}function mu(e,t){return new Jp({check:"string_format",format:"regex",...ce(t),pattern:e})}function hu(e){return new Kp({check:"string_format",format:"lowercase",...ce(e)})}function fu(e){return new Gp({check:"string_format",format:"uppercase",...ce(e)})}function gu(e,t){return new Wp({check:"string_format",format:"includes",...ce(t),includes:e})}function _u(e,t){return new Yp({check:"string_format",format:"starts_with",...ce(t),prefix:e})}function Su(e,t){return new Xp({check:"string_format",format:"ends_with",...ce(t),suffix:e})}function Ht(e){return new Qp({check:"overwrite",tx:e})}function yu(e){return Ht(t=>t.normalize(e))}function vu(){return Ht(e=>e.trim())}function bu(){return Ht(e=>e.toLowerCase())}function zu(){return Ht(e=>e.toUpperCase())}function wu(){return Ht(e=>Ic(e))}function Qh(e,t,r){return new e({type:"array",element:t,...ce(r)})}function ef(e,t,r){return new e({type:"custom",check:"custom",fn:t,...ce(r)})}function tf(e,t){let r=Kv(o=>(o.addIssue=n=>{if(typeof n=="string")o.issues.push(Zr(n,o.value,r._zod.def));else{let s=n;s.fatal&&(s.continue=!1),s.code??(s.code="custom"),"input"in s||(s.input=o.value),s.inst??(s.inst=r),s.continue??(s.continue=!r._zod.def.abort),o.issues.push(Zr(s))}},e(o.value,o)),t);return r}function Kv(e,t){let r=new Ze({check:"custom",...ce(t)});return r._zod.check=e,r}function un(e,...t){for(let r of t)for(let o of Reflect.ownKeys(r))Object.prototype.propertyIsEnumerable.call(r,o)&&We(e,o,r[o]);return e}function dn(e){let t=e?.target??"draft-2020-12";return t==="draft-4"&&(t="draft-04"),t==="draft-7"&&(t="draft-07"),{processors:e.processors??{},metadataRegistry:e?.metadata??Ft,target:t,unrepresentable:e?.unrepresentable??"throw",override:e?.override??(()=>{}),io:e?.io??"output",counter:0,seen:new Map,sharedDefsExtractedFor:void 0,sharedEmitDoneFor:void 0,cycles:e?.cycles??"ref",reused:e?.reused??"inline",intersections:[],deferred:[],external:e?.external??void 0}}function Le(e,t,r,o,n){let s=typeof t.unrepresentable=="function"?t.unrepresentable({zodSchema:e,path:o.path,message:n}):t.unrepresentable;if(s==="any")return!1;if(s===void 0||s==="throw")throw new Error(n);return Object.assign(r,s),!0}function Pe(e,t,r={path:[],schemaPath:[]}){var o;let n=e._zod.def,s=t.seen.get(e);if(s)return s.count++,r.schemaPath.includes(e)&&(s.cycle=r.path),s.schema;let i={schema:{},count:1,cycle:void 0,path:r.path};t.seen.set(e,i),t.sharedDefsExtractedFor=void 0,t.sharedEmitDoneFor=void 0;let c=e._zod.toJSONSchema?.();if(c)i.schema=c;else{let l={...r,schemaPath:[...r.schemaPath,e],path:r.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,i.schema,l);else{let h=i.schema,_=t.processors[n.type];if(!_)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${n.type}`);_(e,t,h,l)}let d=e._zod.parent;d&&(i.ref||(i.ref=d),Pe(d,t,l),t.seen.get(d).isParent=!0)}let a=t.metadataRegistry.get(e);return a&&un(i.schema,a),t.io==="input"&&Ke(e)&&(delete i.schema.examples,delete i.schema.default),t.io==="input"&&"_prefault"in i.schema&&((o=i.schema).default??(o.default=i.schema._prefault)),delete i.schema._prefault,t.seen.get(e).schema}function rf(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}function pn(e,t){let r=e.seen.get(t);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");if(e.external&&e.sharedDefsExtractedFor===e.external)return;let o=new Map;for(let i of e.seen.entries()){let c=e.metadataRegistry.get(i[0])?.id;if(c){let a=o.get(c);if(a&&a!==i[0])throw new Error(`Duplicate schema id "${c}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);o.set(c,i[0])}}let n=i=>{let c=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){let d=e.external.registry.get(i[0])?.id,h=e.external.uri??(y=>y);if(d)return{ref:h(d)};let _=i[1].defId??i[1].schema.id??`schema${e.counter++}`;return i[1].defId=_,{defId:_,ref:`${h("__shared")}#/${c}/${rf(_)}`}}let a="#",u=`${a}/${c}/`;if(i[1]===r&&!i[1].schema.id)return{ref:a};let l=i[1].schema.id??`__schema${e.counter++}`;return{defId:l,ref:u+rf(l)}},s=i=>{if(i[1].schema.$ref)return;let c=i[1],{ref:a,defId:u}=n(i);c.def={...c.schema},u&&(c.defId=u);let l=c.schema;for(let d in l)delete l[d];l.$ref=a};if(e.cycles==="throw")for(let i of e.seen.entries()){let c=i[1];if(c.cycle)throw new Error(`Cycle detected: #/${c.cycle?.join("/")}/<root>
57
+
58
+ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let i of e.seen.entries()){let c=i[1];if(t===i[0]){s(i);continue}if(e.external){let u=e.external.registry.get(i[0])?.id;if(t!==i[0]&&u){s(i);continue}}if(e.metadataRegistry.get(i[0])?.id){s(i);continue}if(c.cycle){s(i);continue}c.count>1&&e.reused==="ref"&&s(i)}e.external&&(e.sharedDefsExtractedFor=e.external)}function sf(e){let t=e.anyOf;if(!Array.isArray(t)||t.length===0||e.type!==void 0)return;let r=[];for(let o of t){if(!o||typeof o!="object")return;sf(o);let n=Object.keys(o);if(n.length!==1||n[0]!=="type")return;let s=o.type;for(let i of Array.isArray(s)?s:[s]){if(typeof i!="string")return;r.includes(i)||r.push(i)}}delete e.anyOf,e.type=r.length===1?r[0]:r}var af=new Set(["type","properties","required","additionalProperties"]),of=["oneOf","anyOf"];function nf(e){let t=e.additionalProperties;return t===void 0||t===!1||typeof t!="object"||t===null?null:Object.keys(t).length?t:null}function Ru(e){let t=[];for(let s of e){if(typeof s!="object"||s.type!=="object")return null;for(let i in s)if(!af.has(i))return null;t.push(s)}let r={},o=new Set;for(let s of t){for(let i in s.properties){if(Object.prototype.hasOwnProperty.call(r,i))continue;let c=[];for(let u of t){let l=u.properties?.[i]??nf(u);l!=null&&(c.some(d=>JSON.stringify(d)===JSON.stringify(l))||c.push(l))}let a=c.length===1?c[0]:Ru(c)??{allOf:c};We(r,i,a)}for(let i of s.required??[])o.add(i)}let n={type:"object",properties:r};if(o.size&&(n.required=[...o]),t.every(s=>s.additionalProperties===!1))n.additionalProperties=!1;else{let s=[];for(let i of t){let c=nf(i);c&&!s.some(a=>JSON.stringify(a)===JSON.stringify(c))&&s.push(c)}s.length===1?n.additionalProperties=s[0]:s.length>1&&(n.additionalProperties={allOf:s})}return n}function Gv(e){let t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(let n of af)if(n in e)return;let r=t.filter(n=>of.some(s=>Array.isArray(n[s]))),o=null;if(!r.length)o=Ru(t);else{let n=r[0],s=of.find(a=>Array.isArray(n[a]));if(Object.keys(n).length!==1)return;let i=t.filter(a=>a!==n),c=n[s].map(a=>Ru([...i,a]));if(c.some(a=>!a))return;o={[s]:c}}o&&(delete e.allOf,un(e,o))}function mn(e,t){let r=e.seen.get(t);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");let o=c=>{let a=e.seen.get(c);if(a.ref===null)return;let u=a.def??a.schema,l={...u},d=a.ref;if(a.ref=null,d){o(d);let _=e.seen.get(d),y=_.schema;if(y.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(u.allOf=u.allOf??[],u.allOf.push(y)):un(u,y),un(u,l),c._zod.parent===d)for(let b in u)b==="$ref"||b==="allOf"||b in l||delete u[b];if(y.$ref&&_.def)for(let b in u)b==="$ref"||b==="allOf"||b in _.def&&JSON.stringify(u[b])===JSON.stringify(_.def[b])&&delete u[b]}let h=c._zod.parent;if(h&&h!==d){o(h);let _=e.seen.get(h);if(_?.schema.$ref&&(u.$ref=_.schema.$ref,_.def))for(let y in u)y==="$ref"||y==="allOf"||y in _.def&&JSON.stringify(u[y])===JSON.stringify(_.def[y])&&delete u[y]}e.override({zodSchema:c,jsonSchema:u,path:a.path??[]})};if(!e.external||e.sharedEmitDoneFor!==e.external){for(let c of[...e.seen.entries()].reverse())o(c[0]);if(e.target!=="openapi-3.0")for(let c of e.seen.entries())sf(c[1].def??c[1].schema);for(let c of e.deferred)c();if(e.intersections.length){let c=new Map;for(let a of e.seen.values())for(let u of[a.schema,a.def]){let l=u?.allOf;if(!Array.isArray(l))continue;let d=c.get(l);d?d.push(u):c.set(l,[u])}for(let a of e.intersections)for(let u of c.get(a)??[])Gv(u)}}let n={};if(e.target==="draft-2020-12"?n.$schema="https://json-schema.org/draft/2020-12/schema":e.target==="draft-07"?n.$schema="http://json-schema.org/draft-07/schema#":e.target==="draft-04"?n.$schema="http://json-schema.org/draft-04/schema#":e.target,e.external?.uri){let c=e.external.registry.get(t)?.id;if(!c)throw new Error("Schema is missing an `id` property");n.$id=e.external.uri(c)}un(n,r.defId?r.schema:r.def??r.schema);let s=e.metadataRegistry.get(t)?.id;s!==void 0&&n.id===s&&delete n.id;let i=e.external?.defs??{};if(!e.external||e.sharedEmitDoneFor!==e.external)for(let c of e.seen.entries()){let a=c[1];a.def&&a.defId&&(a.def.id===a.defId&&delete a.def.id,We(i,a.defId,a.def))}e.external&&(e.sharedEmitDoneFor=e.external),e.external||Object.keys(i).length>0&&(e.target==="draft-2020-12"?n.$defs=i:n.definitions=i);try{let c=JSON.parse(JSON.stringify(n));return Object.defineProperty(c,"~standard",{value:{...t["~standard"],jsonSchema:{input:ln(t,"input",e.processors),output:ln(t,"output",e.processors)}},enumerable:!1,writable:!1}),c}catch{throw new Error("Error converting schema to JSON.")}}function Ke(e,t){let r=t??{seen:new Set};if(r.seen.has(e))return!1;r.seen.add(e);let o=e._zod.def;if(o.type==="transform")return!0;if(o.type==="array")return Ke(o.element,r);if(o.type==="set")return Ke(o.valueType,r);if(o.type==="lazy")return Ke(o.getter(),r);if(o.type==="promise"||o.type==="optional"||o.type==="nonoptional"||o.type==="nullable"||o.type==="readonly"||o.type==="default"||o.type==="prefault"||o.type==="catch")return Ke(o.innerType,r);if(o.type==="intersection")return Ke(o.left,r)||Ke(o.right,r);if(o.type==="record"||o.type==="map")return Ke(o.keyType,r)||Ke(o.valueType,r);if(o.type==="pipe")return e._zod.traits.has("$ZodCodec")?!0:Ke(o.in,r)||Ke(o.out,r);if(o.type==="object"){for(let n in o.shape)if(Ke(o.shape[n],r))return!0;return!1}if(o.type==="union"){for(let n of o.options)if(Ke(n,r))return!0;return!1}if(o.type==="tuple"){for(let n of o.items)if(Ke(n,r))return!0;return!!(o.rest&&Ke(o.rest,r))}return!1}var cf=(e,t={})=>r=>{let o=dn({...r,processors:t});return Pe(e,o),pn(o,e),mn(o,e)},ln=(e,t,r={})=>o=>{let{libraryOptions:n,target:s}=o??{},i=dn({...n??{},target:s,io:t,processors:r});return Pe(e,i),pn(i,e),mn(i,e)};var Kr=(e,t,r)=>{(e[t]===void 0||r>e[t])&&(e[t]=r)},Gr=(e,t,r)=>{(e[t]===void 0||r<e[t])&&(e[t]=r)},uf=(e,t)=>{Kr(e,"minimum",t),Gr(e,"maximum",t)},hf=(e,t)=>{e.multipleOf??(e.multipleOf=[]),e.multipleOf.includes(t)||e.multipleOf.push(t)},ff=(e,t)=>{e.patterns??(e.patterns=new Set),e.patterns.add(t)},gf=(e,t)=>{e.mime=e.mime?e.mime.filter(r=>t.includes(r)):[...t]},_f=(e,t)=>{e.format=t,t.includes("int")&&(e.isInt=!0)},lf=(e,t)=>Kr(e,"minimum",t.minimum),df=(e,t)=>Gr(e,"maximum",t.maximum),pf=e=>(t,r)=>{_f(t,r.format);let[o,n]=e[r.format];Kr(t,"minimum",o),Gr(t,"maximum",n)},Wv={greater_than:(e,t)=>Kr(e,t.inclusive?"minimum":"exclusiveMinimum",t.value),less_than:(e,t)=>Gr(e,t.inclusive?"maximum":"exclusiveMaximum",t.value),multiple_of:(e,t)=>hf(e,t.value),number_format:pf(Qo),bigint_format:pf(Cs),min_length:lf,max_length:df,length_equals:(e,t)=>uf(e,t.length),min_size:lf,max_size:df,size_equals:(e,t)=>uf(e,t.size),string_format:(e,t)=>{_f(e,t.format),t.pattern&&ff(e,t.pattern),(t.format==="base64"||t.format==="base64url")&&(e.contentEncoding=t.format),(t.local||t.precision===-1)&&(e.laxFormat=!0)},mime_type:(e,t)=>gf(e,t.mime)};function Me(e){let t={},r=e._zod.def,o=e._zod.traits.has("$ZodCheck")?[e,...r.checks??[]]:r.checks??[];for(let s of o)Wv[s._zod.def.check]?.(t,s._zod.def);let n=e._zod.bag;n.minimum!==void 0&&Kr(t,"minimum",n.minimum),n.exclusiveMinimum!==void 0&&Kr(t,"exclusiveMinimum",n.exclusiveMinimum),n.maximum!==void 0&&Gr(t,"maximum",n.maximum),n.exclusiveMaximum!==void 0&&Gr(t,"exclusiveMaximum",n.exclusiveMaximum),n.multipleOf!==void 0&&hf(t,n.multipleOf),n.format!==void 0&&(t.format??(t.format=n.format),n.format.includes("int")&&(t.isInt=!0)),n.mime&&gf(t,n.mime);for(let s of n.patterns??[])ff(t,s);return t}var Yv={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},Xv=new Map([[tu,Tp],[Hs,kp]]),Sf=e=>Xv.get(e)??e,Eu=(e,t,r,o)=>{let n=r;n.type="string";let{minimum:s,maximum:i,format:c,patterns:a,contentEncoding:u,laxFormat:l}=Me(e);if(typeof s=="number"&&(n.minLength=s),typeof i=="number"&&(n.maxLength=i),c&&(n.format=Yv[c]??c,n.format===""&&delete n.format,(c==="time"||l)&&delete n.format),u&&(n.contentEncoding=u),a&&a.size>0){let d=[...a].map(Sf);d.length===1?n.pattern=d[0].source:d.length>1&&(n.allOf=[...d.map(h=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:h.source}))])}},Tu=(e,t,r,o)=>{let n=r,{minimum:s,maximum:i,multipleOf:c,exclusiveMaximum:a,exclusiveMinimum:u,isInt:l}=Me(e);n.type=l?"integer":"number";let d=typeof u=="number"&&u>=(s??Number.NEGATIVE_INFINITY),h=typeof a=="number"&&a<=(i??Number.POSITIVE_INFINITY),_=t.target==="draft-04"||t.target==="openapi-3.0";if(d?_?(n.minimum=u,n.exclusiveMinimum=!0):n.exclusiveMinimum=u:typeof s=="number"&&(n.minimum=s),h?_?(n.maximum=a,n.exclusiveMaximum=!0):n.exclusiveMaximum=a:typeof i=="number"&&(n.maximum=i),c){let y=new Set;for(let g of c)Number.isFinite(g)&&g!==0?y.add(Math.abs(g)):Le(e,t,n,o,`A multipleOf divisor of ${g} cannot be represented in JSON Schema`);let[z,...b]=y;z!==void 0&&(n.multipleOf=z),b.length&&(n.allOf=[...n.allOf??[],...b.map(g=>({multipleOf:g}))])}},ku=(e,t,r,o)=>{r.type="boolean"},Cu=(e,t,r,o)=>{Le(e,t,r,o,"BigInt cannot be represented in JSON Schema")},yf=(e,t,r,o)=>{Le(e,t,r,o,"Symbols cannot be represented in JSON Schema")},Ou=(e,t,r,o)=>{t.target==="openapi-3.0"?(r.type="string",r.nullable=!0,r.enum=[null]):r.type="null"},vf=(e,t,r,o)=>{Le(e,t,r,o,"Undefined cannot be represented in JSON Schema")},bf=(e,t,r,o)=>{Le(e,t,r,o,"Void cannot be represented in JSON Schema")},Iu=(e,t,r,o)=>{r.not={}},xu=(e,t,r,o)=>{},Nu=(e,t,r,o)=>{},Au=(e,t,r,o)=>{Le(e,t,r,o,"Date cannot be represented in JSON Schema")},ju=(e,t,r,o)=>{let n=e._zod.def,s=qr(n.entries);if(s.length===0){r.not={};return}s.every(i=>typeof i=="number")&&(r.type="number"),s.every(i=>typeof i=="string")&&(r.type="string"),r.enum=s},Mu=(e,t,r,o)=>{let n=e._zod.def;if(n.values.length===0){r.not={};return}let s=[];for(let i of n.values)if(i===void 0){if(Le(e,t,r,o,"Literal `undefined` cannot be represented in JSON Schema"))return}else if(typeof i=="bigint"){if(Le(e,t,r,o,"BigInt literals cannot be represented in JSON Schema"))return;s.push(Number(i))}else s.push(i);if(s.length!==0)if(s.length===1){let i=s[0];r.type=i===null?"null":typeof i,t.target==="draft-04"||t.target==="openapi-3.0"?r.enum=[i]:r.const=i}else s.every(i=>typeof i=="number")&&(r.type="number"),s.every(i=>typeof i=="string")&&(r.type="string"),s.every(i=>typeof i=="boolean")&&(r.type="boolean"),s.every(i=>i===null)&&(r.type="null"),r.enum=s},zf=(e,t,r,o)=>{Le(e,t,r,o,"NaN cannot be represented in JSON Schema")},wf=(e,t,r,o)=>{let n=r,s=e._zod.pattern;if(!s)throw new Error("Pattern not found in template literal");n.type="string",n.pattern=s.source},Rf=(e,t,r,o)=>{let n=r;n.type="string",n.format="binary",n.contentEncoding="binary";let{minimum:s,maximum:i,mime:c}=Me(e);s!==void 0&&(n.minLength=s),i!==void 0&&(n.maxLength=i),c&&(c.length===0?n.not={}:c.length===1?n.contentMediaType=c[0]:n.anyOf=c.map(a=>({contentMediaType:a})))},$f=(e,t,r,o)=>{r.type="boolean"},qu=(e,t,r,o)=>{Le(e,t,r,o,"Custom types cannot be represented in JSON Schema")},Pf=(e,t,r,o)=>{Le(e,t,r,o,"Function types cannot be represented in JSON Schema")},Lu=(e,t,r,o)=>{Le(e,t,r,o,"Transforms cannot be represented in JSON Schema")},Ef=(e,t,r,o)=>{Le(e,t,r,o,"Map cannot be represented in JSON Schema")},Tf=(e,t,r,o)=>{Le(e,t,r,o,"Set cannot be represented in JSON Schema")},Du=(e,t,r,o)=>{let n=r,s=e._zod.def,{minimum:i,maximum:c}=Me(e);typeof i=="number"&&(n.minItems=i),typeof c=="number"&&(n.maxItems=c),n.type="array",n.items=Pe(s.element,t,{...o,path:[...o.path,"items"]})};function hn(e){let t=e._zod.def;return t.type==="pipe"&&t.in._zod.traits.has("$ZodTransform")?hn(t.out):t.type==="catch"?hn(t.innerType):e._zod.optin}var Uu=(e,t,r,o)=>{let n=r,s=e._zod.def,i=s.shape;if(Object.getOwnPropertySymbols(i).length&&Le(e,t,n,o,"Symbol keys cannot be represented in JSON Schema"))return;n.type="object",n.properties={};for(let u in i)We(n.properties,u,Pe(i[u],t,{...o,path:[...o.path,"properties",u]}));let a=[];for(let u of Object.keys(i)){let l=s.shape[u];(t.io==="input"?hn(l)===void 0:l._zod.optout===void 0)&&a.push(u)}a.length>0&&(n.required=a),s.catchall?._zod.def.type==="never"?n.additionalProperties=!1:s.catchall?s.catchall&&(n.additionalProperties=Pe(s.catchall,t,{...o,path:[...o.path,"additionalProperties"]})):t.io==="output"&&(n.additionalProperties=!1)},Zu=(e,t,r,o)=>{let n=e._zod.def,s=n.inclusive===!1,i=n.options.map((c,a)=>Pe(c,t,{...o,path:[...o.path,s?"oneOf":"anyOf",a]}));s?r.oneOf=i:r.anyOf=i},Vu=(e,t,r,o)=>{let n=e._zod.def,s=Pe(n.left,t,{...o,path:[...o.path,"allOf",0]}),i=Pe(n.right,t,{...o,path:[...o.path,"allOf",1]}),c=u=>"allOf"in u&&Object.keys(u).length===1,a=[...c(s)?s.allOf:[s],...c(i)?i.allOf:[i]];r.allOf=a,t.intersections.push(a)},kf=(e,t,r,o)=>{let n=r,s=e._zod.def;n.type="array";let i=t.target==="draft-2020-12"?"prefixItems":"items",c=t.target==="draft-2020-12"||t.target==="openapi-3.0"?"items":"additionalItems",a=s.items.map((z,b)=>Pe(z,t,{...o,path:[...o.path,i,b]})),u=s.rest?Pe(s.rest,t,{...o,path:[...o.path,c,...t.target==="openapi-3.0"?[s.items.length]:[]]}):null,l=s.items.length;for(;l>0;){let z=s.items[l-1];if(!(t.io==="input"?hn(z)!==void 0:z._zod.optout==="optional"))break;l--}let d=s.items.length,h=!s.rest;t.target==="draft-2020-12"?(n.prefixItems=a,h?n.items=!1:u&&(n.items=u),l>0&&(n.minItems=l),h&&(n.maxItems=d)):t.target==="openapi-3.0"?(n.items={anyOf:a},u&&n.items.anyOf.push(u),l>0&&(n.minItems=l),h&&(n.maxItems=d)):(n.items=a,h?n.additionalItems=!1:u&&(n.additionalItems=u),l>0&&(n.minItems=l),h&&(n.maxItems=d));let{minimum:_,maximum:y}=Me(e);typeof _=="number"&&(n.minItems=_),typeof y=="number"&&(n.maxItems=y)};function $u(e,t,r){if(t.$ref){if(r.has(t))return t;r.add(t);let y=e.get(t)?.def;if(!y)return t;let z=$u(e,y,r);return z===y?t:z}for(let y of["anyOf","oneOf"]){let z=t[y];if(!Array.isArray(z))continue;let b=z.map(g=>$u(e,g,r));b.some((g,P)=>g!==z[P])&&(t={...t,[y]:b})}let o=Array.isArray(t.type)?t.type:[t.type],n=!o.includes("string")&&o.some(y=>y==="number"||y==="integer"),s=t.enum??(t.const!==void 0?[t.const]:void 0);if(!n&&!s?.some(y=>typeof y=="number"))return t;let{minimum:i,maximum:c,exclusiveMinimum:a,exclusiveMaximum:u,multipleOf:l,format:d,id:h,..._}=t;return _.enum?_.enum=_.enum.map(y=>typeof y=="number"?String(y):y):typeof _.const=="number"&&(_.const=String(_.const)),n&&(_.type="string",s||(_.pattern=(o.includes("number")?on:Gc).source)),_}var Pu=new WeakMap;function Qv(e){let t=new Map;for(let o of e.seen.values())o.def&&!t.has(o.schema)&&t.set(o.schema,o);let r=new Map;for(let o of Pu.get(e)??[]){let n=e.seen.get(o),s=(n?.def??n?.schema)?.propertyNames;if(!s||s===!0||r.has(s))continue;let i=$u(t,s,new Set);i!==s&&r.set(s,i)}if(r.size)for(let o of e.seen.values())for(let n of[o.schema,o.def]){let s=n&&r.get(n.propertyNames);s&&(n.propertyNames=s)}}var Fu=(e,t,r,o)=>{let n=r,s=e._zod.def;n.type="object";let i=s.keyType,c=Me(i).patterns;if(s.mode==="loose"&&c&&c.size>0){let l=Pe(s.valueType,t,{...o,path:[...o.path,"patternProperties","*"]});n.patternProperties={};for(let d of c)We(n.patternProperties,Sf(d).source,l)}else{if(t.target==="draft-07"||t.target==="draft-2020-12"){n.propertyNames=Pe(s.keyType,t,{...o,path:[...o.path,"propertyNames"]});let l=Pu.get(t);l||(l=[],Pu.set(t,l),t.deferred.push(()=>Qv(t))),l.push(e)}n.additionalProperties=Pe(s.valueType,t,{...o,path:[...o.path,"additionalProperties"]})}let a=i._zod.values,u=t.io==="input"&&hn(s.valueType)!==void 0;if(a&&!s.partial&&!u){let l=[...a].filter(d=>typeof d=="string"||typeof d=="number");l.length>0&&(n.required=l.map(String))}},Hu=(e,t,r,o)=>{let n=e._zod.def,s=Pe(n.innerType,t,o),i=t.seen.get(e);t.target==="openapi-3.0"?(i.ref=n.innerType,r.nullable=!0):r.anyOf=[s,{type:"null"}]},Bu=(e,t,r,o)=>{let n=e._zod.def;Pe(n.innerType,t,o);let s=t.seen.get(e);s.ref=n.innerType},Ju=Symbol();function Cf(e,t,r,o,n){let s=!1,i=JSON.stringify(e,(c,a)=>typeof a!="bigint"?a:(s=!0,null));return s?(Le(t,r,o,n,"BigInt defaults cannot be represented in JSON Schema"),Ju):JSON.parse(i)}var Ku=(e,t,r,o)=>{let n=e._zod.def;Pe(n.innerType,t,o);let s=t.seen.get(e);s.ref=n.innerType;let i=Cf(n.defaultValue,e,t,r,o);i!==Ju&&(r.default=i)},Gu=(e,t,r,o)=>{let n=e._zod.def;Pe(n.innerType,t,o);let s=t.seen.get(e);if(s.ref=n.innerType,t.io!=="input")return;let i=Cf(n.defaultValue,e,t,r,o);i!==Ju&&(r._prefault=i)},Wu=(e,t,r,o)=>{let n=e._zod.def;Pe(n.innerType,t,o);let s=t.seen.get(e);s.ref=n.innerType;let i;try{i=n.catchValue(void 0)}catch{Le(e,t,r,o,"Dynamic catch values are not supported in JSON Schema");return}r.default=i},Yu=(e,t,r,o)=>{let n=e._zod.def,s=n.in._zod.traits.has("$ZodTransform"),i=t.io==="input"?s?n.out:n.in:n.out;Pe(i,t,o);let c=t.seen.get(e);c.ref=i},Xu=(e,t,r,o)=>{let n=e._zod.def;Pe(n.innerType,t,o);let s=t.seen.get(e);s.ref=n.innerType,r.readOnly=!0},Of=(e,t,r,o)=>{let n=e._zod.def;Pe(n.innerType,t,o);let s=t.seen.get(e);s.ref=n.innerType},oi=(e,t,r,o)=>{let n=e._zod.def;Pe(n.innerType,t,o);let s=t.seen.get(e);s.ref=n.innerType},Qu=(e,t,r,o)=>{let n=e._zod.innerType;Pe(n,t,o);let s=t.seen.get(e);s.ref=n},mf={string:Eu,number:Tu,boolean:ku,bigint:Cu,symbol:yf,null:Ou,undefined:vf,void:bf,never:Iu,any:xu,unknown:Nu,date:Au,enum:ju,literal:Mu,nan:zf,template_literal:wf,file:Rf,success:$f,custom:qu,function:Pf,transform:Lu,map:Ef,set:Tf,array:Du,object:Uu,union:Zu,intersection:Vu,tuple:kf,record:Fu,nullable:Hu,nonoptional:Bu,default:Ku,prefault:Gu,catch:Wu,pipe:Yu,readonly:Xu,promise:Of,optional:oi,lazy:Qu};function ni(e,t){if("_idmap"in e){let o=e,n=dn({...t,processors:mf}),s={};for(let a of o._idmap.entries()){let[u,l]=a;Pe(l,n)}let i={},c={registry:o,uri:t?.uri,defs:s};n.external=c;for(let a of o._idmap.entries()){let[u,l]=a;pn(n,l),We(i,u,mn(n,l))}if(Object.keys(s).length>0){let a=n.target==="draft-2020-12"?"$defs":"definitions";i.__shared={[a]:s}}return{schemas:i}}let r=dn({...t,processors:mf});return Pe(e,r),pn(r,e),mn(r,e)}var If=new WeakSet([Object.prototype,Error.prototype]);function si(e,t,r){Object.defineProperty(e,t,{configurable:!0,enumerable:!1,get(){let o=r(this);return Object.defineProperty(this,t,{value:o,configurable:!0,writable:!0}),o},set(o){Object.defineProperty(this,t,{value:o,configurable:!0,writable:!0})}})}var cb=(e,t)=>{op.init(e,t),e.name="ZodError";let r=Object.getPrototypeOf(e);If.has(r)||(If.add(r),si(r,"format",o=>n=>Fc(o,n)),si(r,"flatten",o=>n=>Vc(o,n)),si(r,"addIssue",o=>n=>{o.issues.push(n),o.message=JSON.stringify(o.issues,Lr,2)}),si(r,"addIssues",o=>n=>{o.issues.push(...n),o.message=JSON.stringify(o.issues,Lr,2)}),Object.defineProperty(r,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}}))};var ot=D("ZodError",cb,void 0,{Parent:Error});var xf=As(ot),Nf=js(ot),ii=Ms(ot),Af=qs(ot),jf=sp(ot),Mf=ip(ot),qf=ap(ot),Lf=cp(ot),Df=up(ot),Uf=lp(ot),Zf=dp(ot),Vf=pp(ot);function lb(){Ye.localeError||Xe(_h())}function ci(){Ye.memoizer||Xe({memoizer:uu()})}var $e=D("ZodType",(e,t)=>(lb(),Re.init(e,t),e.def=t,e.type=t.type,e),{check(...e){let t=this.def;return this.clone(le.mergeDefs(t,{checks:[...t.checks??[],...e.map(r=>typeof r=="function"?{_zod:{check:r,def:{check:"custom"},onattach:[]}}:r)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return at(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(Xb(e,t))},superRefine(e,t){return this.check(Qb(e,t))},overwrite(e){return this.check(Ht(e))},optional(){return ne(this)},exactOptional(){return qb(this)},nullable(){return Bf(this)},nullish(){return ne(Bf(this))},nonoptional(e){return Fb(this,e)},array(){return N(this)},or(e){return Q([this,e])},and(e){return Tt(this,e)},transform(e){return Jf(this,og(e))},default(e){return Ub(this,e)},prefault(e){return Vb(this,e)},catch(e){return Bb(this,e)},pipe(e){return Jf(this,e)},readonly(){return Gb(this)},describe(e){let t=this.clone();return Ft.add(t,{description:e}),t},meta(...e){if(e.length===0)return Ft.get(this);let t=this.clone();return Ft.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e,...t){return t.length===0?e(this):e(this,...t)},get"~standard"(){return le.hide(this,"~standard",{...eu(this),jsonSchema:{input:ln(this,"input"),output:ln(this,"output")}})},set"~standard"(e){le.own(this,"~standard",e)},parse:function e(t,r){return xf(this,t,r,{callee:e})},parseAsync:async function e(t,r){return await Nf(this,t,r,{callee:e})},safeParse(e,t){return ii(this,e,t)},async safeParseAsync(e,t){return Af(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){le.own(this,"spa",e)},validate(e,t){return Hc(this,e,t)},validateAsync(e,t){return Bc(this,e,t)},encode:function e(t,r){return jf(this,t,r,{callee:e})},decode:function e(t,r){return Mf(this,t,r,{callee:e})},encodeAsync:async function e(t,r){return await qf(this,t,r,{callee:e})},decodeAsync:async function e(t,r){return await Lf(this,t,r,{callee:e})},safeEncode(e,t){return Df(this,e,t)},safeDecode(e,t){return Uf(this,e,t)},async safeEncodeAsync(e,t){return Zf(this,e,t)},async safeDecodeAsync(e,t){return Vf(this,e,t)},toJSONSchema(e){return cf(this,{})(e)},get description(){return Ft.get(this)?.description},get _def(){return this._zod.def}}),Kf=D("_ZodString",(e,t)=>{Fs.init(e,t),$e.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Eu(e,r,o,n)},le.derived({format:e=>Me(e).format??null,minLength:e=>Me(e).minimum??null,maxLength:e=>Me(e).maximum??null},{regex(...e){return this.check(mu(...e))},includes(...e){return this.check(gu(...e))},startsWith(...e){return this.check(_u(...e))},endsWith(...e){return this.check(Su(...e))},min(...e){return this.check(Jr(...e))},max(...e){return this.check(ti(...e))},length(...e){return this.check(ri(...e))},nonempty(...e){return this.check(Jr(1,...e))},lowercase(e){return this.check(hu(e))},uppercase(e){return this.check(fu(e))},trim(){return this.check(vu())},normalize(...e){return this.check(yu(...e))},toLowerCase(){return this.check(bu())},toUpperCase(){return this.check(zu())},slugify(){return this.check(wu())}})),tl=D("ZodString",(e,t)=>{Fs.init(e,t),Kf.init(e,t)},{email(e){return this.check(du(Gf,e))},url(e){return this.check(pu(Yf,e))},jwt(e){return this.check(Uh(Pb,e))},emoji(e){return this.check(Eh(pb,e))},guid(e){return this.check(zh(db,e))},uuid(e){return this.check(wh(ai,e))},uuidv4(e){return this.check(Rh(ai,e))},uuidv6(e){return this.check($h(ai,e))},uuidv7(e){return this.check(Ph(ai,e))},nanoid(e){return this.check(Th(mb,e))},cuid(e){return this.check(kh(hb,e))},cuid2(e){return this.check(Ch(fb,e))},ulid(e){return this.check(Oh(gb,e))},base64(e){return this.check(qh(wb,e))},base64url(e){return this.check(Lh(Rb,e))},xid(e){return this.check(Ih(_b,e))},ksuid(e){return this.check(xh(Sb,e))},ipv4(e){return this.check(Nh(yb,e))},ipv6(e){return this.check(Ah(vb,e))},cidrv4(e){return this.check(jh(bb,e))},cidrv6(e){return this.check(Mh(zb,e))},e164(e){return this.check(Dh($b,e))},datetime(e){return this.check(Ys(fn,e))},date(e){return this.check(Xs(gn,e))},time(e){return this.check(Qs(_n,e))},duration(e){return this.check(ei(Sn,e))}});function p(e){return vh(tl,e)}var Oe=D("ZodStringFormat",(e,t)=>{ke.init(e,t),Kf.init(e,t)}),fn=D("ZodISODateTime",(e,t)=>{Pm.init(e,t),Oe.init(e,t)}),gn=D("ZodISODate",(e,t)=>{Em.init(e,t),Oe.init(e,t)}),_n=D("ZodISOTime",(e,t)=>{Tm.init(e,t),Oe.init(e,t)}),Sn=D("ZodISODuration",(e,t)=>{km.init(e,t),Oe.init(e,t)}),Gf=D("ZodEmail",(e,t)=>{fm.init(e,t),Oe.init(e,t)});function Wf(e){return du(Gf,e)}var db=D("ZodGUID",(e,t)=>{mm.init(e,t),Oe.init(e,t)});var ai=D("ZodUUID",(e,t)=>{hm.init(e,t),Oe.init(e,t)});var Yf=D("ZodURL",(e,t)=>{Sm.init(e,t),Oe.init(e,t)});function ui(e){return pu(Yf,e)}var pb=D("ZodEmoji",(e,t)=>{ym.init(e,t),Oe.init(e,t)});var mb=D("ZodNanoID",(e,t)=>{vm.init(e,t),Oe.init(e,t)});var hb=D("ZodCUID",(e,t)=>{bm.init(e,t),Oe.init(e,t)});var fb=D("ZodCUID2",(e,t)=>{zm.init(e,t),Oe.init(e,t)});var gb=D("ZodULID",(e,t)=>{wm.init(e,t),Oe.init(e,t)});var _b=D("ZodXID",(e,t)=>{Rm.init(e,t),Oe.init(e,t)});var Sb=D("ZodKSUID",(e,t)=>{$m.init(e,t),Oe.init(e,t)});var yb=D("ZodIPv4",(e,t)=>{Cm.init(e,t),Oe.init(e,t)});var vb=D("ZodIPv6",(e,t)=>{Im.init(e,t),Oe.init(e,t)});var bb=D("ZodCIDRv4",(e,t)=>{xm.init(e,t),Oe.init(e,t)});var zb=D("ZodCIDRv6",(e,t)=>{Nm.init(e,t),Oe.init(e,t)});var wb=D("ZodBase64",(e,t)=>{jm.init(e,t),Oe.init(e,t)});var Rb=D("ZodBase64URL",(e,t)=>{Mm.init(e,t),Oe.init(e,t)});var $b=D("ZodE164",(e,t)=>{qm.init(e,t),Oe.init(e,t)});var Pb=D("ZodJWT",(e,t)=>{Lm.init(e,t),Oe.init(e,t)});var li=D("ZodNumber",(e,t)=>{ru.init(e,t),$e.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Tu(e,r,o,n),e.isFinite=!0},le.derived({minValue:e=>{let{minimum:t,exclusiveMinimum:r}=Me(e);return Math.max(t??Number.NEGATIVE_INFINITY,r??Number.NEGATIVE_INFINITY)},maxValue:e=>{let{maximum:t,exclusiveMaximum:r}=Me(e);return Math.min(t??Number.POSITIVE_INFINITY,r??Number.POSITIVE_INFINITY)},isInt:e=>{let{isInt:t,multipleOf:r}=Me(e);return!!t||!!r?.some(Number.isSafeInteger)},format:e=>Me(e).format??null},{gt(e,t){return this.check(Br(e,t))},gte(e,t){return this.check(Et(e,t))},min(e,t){return this.check(Et(e,t))},lt(e,t){return this.check(Hr(e,t))},lte(e,t){return this.check(Pt(e,t))},max(e,t){return this.check(Pt(e,t))},int(e){return this.check(Ff(e))},safe(e){return this.check(Ff(e))},positive(e){return this.check(Br(0,e))},nonnegative(e){return this.check(Et(0,e))},negative(e){return this.check(Hr(0,e))},nonpositive(e){return this.check(Pt(0,e))},multipleOf(e,t){return this.check(cn(e,t))},step(e,t){return this.check(cn(e,t))},finite(){return this}}));function B(e){return Zh(li,e)}var Eb=D("ZodNumberFormat",(e,t)=>{Dm.init(e,t),li.init(e,t)});function Ff(e){return Fh(Eb,e)}var rl=D("ZodBoolean",(e,t)=>{Um.init(e,t),$e.init(e,t),e._zod.processJSONSchema=(r,o,n)=>ku(e,r,o,n)});function X(e){return Hh(rl,e)}var Xf=D("ZodBigInt",(e,t)=>{Zm.init(e,t),$e.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Cu(e,r,o,n)},le.derived({minValue:e=>Me(e).minimum??null,maxValue:e=>Me(e).maximum??null,format:e=>Me(e).format??null},{gte(e,t){return this.check(Et(e,t))},min(e,t){return this.check(Et(e,t))},gt(e,t){return this.check(Br(e,t))},lt(e,t){return this.check(Hr(e,t))},lte(e,t){return this.check(Pt(e,t))},max(e,t){return this.check(Pt(e,t))},positive(e){return this.check(Br(BigInt(0),e))},negative(e){return this.check(Hr(BigInt(0),e))},nonpositive(e){return this.check(Pt(BigInt(0),e))},nonnegative(e){return this.check(Et(BigInt(0),e))},multipleOf(e,t){return this.check(cn(e,t))}}));var Tb=D("ZodNull",(e,t)=>{Vm.init(e,t),$e.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Ou(e,r,o,n)});function fr(e){return Kh(Tb,e)}var kb=D("ZodAny",(e,t)=>{Fm.init(e,t),$e.init(e,t),e._zod.processJSONSchema=(r,o,n)=>xu(e,r,o,n)});function Qf(){return Gh(kb)}var Cb=D("ZodUnknown",(e,t)=>{Hm.init(e,t),$e.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Nu(e,r,o,n)});function se(){return Wh(Cb)}var Ob=D("ZodNever",(e,t)=>{Bm.init(e,t),$e.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Iu(e,r,o,n)});function Ib(e){return Yh(Ob,e)}var eg=D("ZodDate",(e,t)=>{Jm.init(e,t),$e.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Au(e,r,o,n),e.min=(r,o)=>e.check(Et(r,o)),e.max=(r,o)=>e.check(Pt(r,o))},le.derived({minDate:e=>{let{minimum:t}=Me(e);return t?new Date(t):null},maxDate:e=>{let{maximum:t}=Me(e);return t?new Date(t):null}},{}));var xb=D("ZodArray",(e,t)=>{ci(),Km.init(e,t),$e.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Du(e,r,o,n),e.element=t.element},{min(e,t){return this.check(Jr(e,t))},nonempty(e){return this.check(Jr(1,e))},max(e,t){return this.check(ti(e,t))},length(e,t){return this.check(ri(e,t))},unwrap(){return this.element}});function N(e,t){return Qh(xb,e,t)}var tg=D("ZodObject",(e,t)=>{ci(),Ym.init(e,t),$e.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Uu(e,r,o,n),le.installLazyProp(e,"shape",r=>r._zod.def.shape,!1)},{keyof(){return pe(Object.keys(this._zod.def.shape))},catchall(e){return this.clone(le.mergeDefs(this._zod.def,{catchall:e}))},passthrough(){return this.clone(le.mergeDefs(this._zod.def,{catchall:se()}))},loose(){return this.clone(le.mergeDefs(this._zod.def,{catchall:se()}))},strict(){return this.clone(le.mergeDefs(this._zod.def,{catchall:Ib()}))},strip(){return this.clone(le.mergeDefs(this._zod.def,{catchall:void 0}))},extend(e){return le.extend(this,e)},safeExtend(e){return le.safeExtend(this,e)},merge(e){return le.merge(this,e)},pick(e){return le.pick(this,e)},omit(e){return le.omit(this,e)},partial(...e){return le.partial(ng,this,e[0])},exactPartial(...e){return le.partial(sg,this,e[0],"exactPartial")},required(...e){return le.required(ig,this,e[0])}});function O(e,t){let r={type:"object",shape:e??{},...le.normalizeParams(t)};return new tg(r)}function ae(e,t){return new tg({type:"object",shape:e,catchall:se(),...le.normalizeParams(t)})}var rg=D("ZodUnion",(e,t)=>{ou.init(e,t),$e.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Zu(e,r,o,n),e.options=t.options});function Q(e,t){return new rg({type:"union",options:e,...le.normalizeParams(t)})}var Nb=D("ZodDiscriminatedUnion",(e,t)=>{rg.init(e,t),Xm.init(e,t)});function Yr(e,t,r){return new Nb({type:"union",options:t,discriminator:e,...le.normalizeParams(r)})}var Ab=D("ZodIntersection",(e,t)=>{Qm.init(e,t),$e.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Vu(e,r,o,n)});function Tt(e,t){return new Ab({type:"intersection",left:e,right:t})}var Hf=D("ZodRecord",(e,t)=>{ci(),eh.init(e,t),$e.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Fu(e,r,o,n),e.keyType=t.keyType,e.valueType=t.valueType});function Y(e,t,r){return!t||!t._zod?new Hf({type:"record",keyType:p(),valueType:e,...le.normalizeParams(t)}):new Hf({type:"record",keyType:e,valueType:t,...le.normalizeParams(r)})}var el=D("ZodEnum",(e,t)=>{th.init(e,t),$e.init(e,t),e._zod.processJSONSchema=(o,n,s)=>ju(e,o,n,s),e.enum=t.entries,e.options=[...e._zod.values];let r=new Set(Object.keys(t.entries));e.extract=(o,n)=>{let s={};for(let i of o)if(r.has(i))s[i]=t.entries[i];else throw new Error(`Key ${i} not found in enum`);return new el({...t,checks:[],...le.normalizeParams(n),entries:s})},e.exclude=(o,n)=>{let s={...t.entries};for(let i of o)if(r.has(i))delete s[i];else throw new Error(`Key ${i} not found in enum`);return new el({...t,checks:[],...le.normalizeParams(n),entries:s})}});function pe(e,t){let r=Array.isArray(e)?Object.fromEntries(e.map(o=>[o,o])):e;return new el({type:"enum",entries:r,...le.normalizeParams(t)})}var jb=D("ZodLiteral",(e,t)=>{rh.init(e,t),$e.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Mu(e,r,o,n),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function j(e,t){return new jb({type:"literal",values:Array.isArray(e)?e:[e],...le.normalizeParams(t)})}var Mb=D("ZodTransform",(e,t)=>{ci(),oh.init(e,t),$e.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Lu(e,r,o,n),e._zod.parse=(r,o)=>{if(o.direction==="backward")throw new Vr(e.constructor.name);r.addIssue=s=>{if(typeof s=="string")r.issues.push(le.issue(s,r.value,t));else{let i=s;i.fatal&&(i.continue=!1),i.code??(i.code="custom"),"input"in i||(i.input=r.value),i.inst??(i.inst=e),r.issues.push(le.issue(i))}};let n=t.transform(r.value,r);return n instanceof Promise?n.then(s=>(r.value=s,r)):(r.value=n,r)}});function og(e){return new Mb({type:"transform",transform:e})}var ng=D("ZodOptional",(e,t)=>{nu.init(e,t),$e.init(e,t),e._zod.processJSONSchema=(r,o,n)=>oi(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function ne(e){return new ng({type:"optional",innerType:e})}var sg=D("ZodExactOptional",(e,t)=>{nh.init(e,t),$e.init(e,t),e._zod.processJSONSchema=(r,o,n)=>oi(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function qb(e){return new sg({type:"optional",innerType:e})}var Lb=D("ZodNullable",(e,t)=>{sh.init(e,t),$e.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Hu(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function Bf(e){return new Lb({type:"nullable",innerType:e})}var Db=D("ZodDefault",(e,t)=>{ih.init(e,t),$e.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Ku(e,r,o,n),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Ub(e,t){return new Db({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():le.shallowClone(t)}})}var Zb=D("ZodPrefault",(e,t)=>{ah.init(e,t),$e.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Gu(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function Vb(e,t){return new Zb({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():le.shallowClone(t)}})}var ig=D("ZodNonOptional",(e,t)=>{ch.init(e,t),$e.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Bu(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function Fb(e,t){return new ig({type:"nonoptional",innerType:e,...le.normalizeParams(t)})}var Hb=D("ZodCatch",(e,t)=>{uh.init(e,t),$e.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Wu(e,r,o,n),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Bb(e,t){return new Hb({type:"catch",innerType:e,catchValue:typeof t=="function"?t:le.constantCatch(t)})}var ag=D("ZodPipe",(e,t)=>{su.init(e,t),$e.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Yu(e,r,o,n),e.in=t.in,e.out=t.out});function Jf(e,t){return new ag({type:"pipe",in:e,out:t})}var Jb=D("ZodPreprocess",(e,t)=>{ag.init(e,t),lh.init(e,t)}),Kb=D("ZodReadonly",(e,t)=>{dh.init(e,t),$e.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Xu(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function Gb(e){return new Kb({type:"readonly",innerType:e})}var Wb=D("ZodLazy",(e,t)=>{ph.init(e,t),$e.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Qu(e,r,o,n),e.unwrap=()=>e._zod.def.getter()});function yn(e){return new Wb({type:"lazy",getter:e})}var Yb=D("ZodCustom",(e,t)=>{mh.init(e,t),$e.init(e,t),e._zod.processJSONSchema=(r,o,n)=>qu(e,r,o,n)});function Xb(e,t={}){return ef(Yb,e,t)}function Qb(e,t){return tf(e,t)}function gr(e,t){return new Jb({type:"pipe",in:og(e),out:t})}var ug={invalid_type:"invalid_type",too_big:"too_big",too_small:"too_small",invalid_format:"invalid_format",not_multiple_of:"not_multiple_of",unrecognized_keys:"unrecognized_keys",invalid_union:"invalid_union",invalid_key:"invalid_key",invalid_element:"invalid_element",invalid_value:"invalid_value",custom:"custom"};var cg;cg||(cg={});var kt={};Rc(kt,{ZodISODate:()=>gn,ZodISODateTime:()=>fn,ZodISODuration:()=>Sn,ZodISOTime:()=>_n,date:()=>rz,datetime:()=>tz,duration:()=>nz,time:()=>oz});function tz(e){return Ys(fn,e)}function rz(e){return Xs(gn,e)}function oz(e){return Qs(_n,e)}function nz(e){return ei(Sn,e)}var di={};Rc(di,{bigint:()=>cz,boolean:()=>az,date:()=>uz,number:()=>iz,string:()=>sz});function sz(e){return bh(tl,e)}function iz(e){return Vh(li,e)}function az(e){return Bh(rl,e)}function cz(e){return Jh(Xf,e)}function uz(e){return Xh(eg,e)}var Sr="2025-11-25";var pi=[Sr,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],mi="io.modelcontextprotocol/related-task",Ot="io.modelcontextprotocol/protocolVersion",Xr="io.modelcontextprotocol/clientInfo",_t="io.modelcontextprotocol/serverInfo",yr="io.modelcontextprotocol/clientCapabilities",Qr="io.modelcontextprotocol/subscriptionId",eo="io.modelcontextprotocol/logLevel";var vr="2.0";var Bt=yn(()=>Q([p(),B(),X(),fr(),Y(p(),Bt),N(Bt)])),xe=Y(p(),Bt),ol=N(Bt),vn=Q([p(),B().int()]),bn=p(),hi=O({ttl:B().optional()}),fi=O({taskId:p()}),zn=ae({progressToken:vn.optional(),[mi]:fi.optional()}),De=O({_meta:zn.optional()}),br=De.extend({task:hi.optional()}),Ne=O({method:p(),params:De.loose().optional()}),He=O({_meta:zn.optional()}),Be=O({method:p(),params:He.loose().optional()}),wn=ae({get[_t](){return oo.optional().catch(void 0)}}),Ae=ae({_meta:wn.optional()}),Jt=Q([p(),B().int()]),Rn=O({jsonrpc:j(vr),id:Jt,...Ne.shape}).strict(),$n=O({jsonrpc:j(vr),...Be.shape}).strict(),to=O({jsonrpc:j(vr),id:Jt,result:Ae}).strict(),ro=O({jsonrpc:j(vr),id:Jt.optional(),error:O({code:B().int(),message:p(),data:se().optional()})}).strict(),It=Q([Rn,$n,to,ro]),nl=Q([to,ro]),Pn=Ae.strict(),gi=He.extend({requestId:Jt.optional(),reason:p().optional()}),En=Be.extend({method:j("notifications/cancelled"),params:gi}),_i=O({src:p(),mimeType:p().optional(),sizes:N(p()).optional(),theme:pe(["light","dark"]).optional()}),Kt=O({icons:N(_i).optional()}),Ct=O({name:p(),title:p().optional()}),oo=Ct.extend({...Ct.shape,...Kt.shape,version:p(),websiteUrl:p().optional(),description:p().optional()}),lz=Tt(O({applyDefaults:X().optional()}),xe),dz=gr(e=>e&&typeof e=="object"&&!Array.isArray(e)&&Object.keys(e).length===0?{form:{}}:e,Tt(O({form:lz.optional(),url:xe.optional()}),xe.optional())),Si=ae({list:xe.optional(),cancel:xe.optional(),requests:ae({sampling:ae({createMessage:xe.optional()}).optional(),elicitation:ae({create:xe.optional()}).optional()}).optional()}),yi=ae({list:xe.optional(),cancel:xe.optional(),requests:ae({tools:ae({call:xe.optional()}).optional()}).optional()}),vi=O({experimental:Y(p(),xe).optional(),sampling:O({context:xe.optional(),tools:xe.optional()}).optional(),elicitation:dz.optional(),roots:O({listChanged:X().optional()}).optional(),tasks:Si.optional(),extensions:Y(p(),xe).optional()}),bi=De.extend({protocolVersion:p(),capabilities:vi,clientInfo:oo}),Tn=Ne.extend({method:j("initialize"),params:bi}),kn=O({experimental:Y(p(),xe).optional(),logging:xe.optional(),completions:xe.optional(),prompts:O({listChanged:X().optional()}).optional(),resources:O({subscribe:X().optional(),listChanged:X().optional()}).optional(),tools:O({listChanged:X().optional()}).optional(),tasks:yi.optional(),extensions:Y(p(),xe).optional()}),zi=Ae.extend({protocolVersion:p(),capabilities:kn,serverInfo:oo,instructions:p().optional()}),Cn=Be.extend({method:j("notifications/initialized"),params:He.optional()}),wi=Ne.extend({method:j("server/discover"),params:De.optional()}),zr=Ae.extend({supportedVersions:N(p()),capabilities:kn,instructions:p().optional()}),On=Ne.extend({method:j("ping"),params:De.optional()}),Ri=O({progress:B(),total:ne(B()),message:ne(p())}),$i=O({...He.shape,...Ri.shape,progressToken:vn}),In=Be.extend({method:j("notifications/progress"),params:$i}),Pi=De.extend({cursor:bn.optional()}),Gt=Ne.extend({params:Pi.optional()}),Wt=Ae.extend({nextCursor:bn.optional()}),xn=O({uri:p(),mimeType:ne(p()),_meta:Y(p(),se()).optional()}),Nn=xn.extend({text:p()}),sl=p().refine(e=>{try{return atob(e),!0}catch{return!1}},{message:"Invalid Base64 string"}),An=xn.extend({blob:sl}),Yt=pe(["user","assistant"]),xt=O({audience:N(Yt).optional(),priority:B().min(0).max(1).optional(),lastModified:kt.datetime({offset:!0}).optional()}),jn=O({...Ct.shape,...Kt.shape,uri:p(),description:ne(p()),mimeType:ne(p()),size:ne(B()),annotations:xt.optional(),_meta:ne(ae({}))}),Ei=O({...Ct.shape,...Kt.shape,uriTemplate:p(),description:ne(p()),mimeType:ne(p()),annotations:xt.optional(),_meta:ne(ae({}))}),Ti=Gt.extend({method:j("resources/list")}),ki=Wt.extend({resources:N(jn)}),Ci=Gt.extend({method:j("resources/templates/list")}),Oi=Wt.extend({resourceTemplates:N(Ei)}),no=De.extend({uri:p()}),Ii=no,xi=Ne.extend({method:j("resources/read"),params:Ii}),Ni=Ae.extend({contents:N(Q([Nn,An]))}),Ai=Be.extend({method:j("notifications/resources/list_changed"),params:He.optional()}),ji=no,Mi=Ne.extend({method:j("resources/subscribe"),params:ji}),qi=no,Li=Ne.extend({method:j("resources/unsubscribe"),params:qi}),Mn=O({toolsListChanged:X().optional(),promptsListChanged:X().optional(),resourcesListChanged:X().optional(),resourceSubscriptions:N(p()).optional()}),Di=De.extend({notifications:Mn}),Ui=Ne.extend({method:j("subscriptions/listen"),params:Di}),Zi=He.extend({notifications:Mn}),Vi=Be.extend({method:j("notifications/subscriptions/acknowledged"),params:Zi}),Fi=wn.extend({[Qr]:Jt}),Hi=Ae.extend({_meta:Fi}),Bi=He.extend({uri:p()}),Ji=Be.extend({method:j("notifications/resources/updated"),params:Bi}),Ki=O({name:p(),description:ne(p()),required:ne(X())}),Gi=O({...Ct.shape,...Kt.shape,description:ne(p()),arguments:ne(N(Ki)),_meta:ne(ae({}))}),Wi=Gt.extend({method:j("prompts/list")}),Yi=Wt.extend({prompts:N(Gi)}),Xi=De.extend({name:p(),arguments:Y(p(),p()).optional()}),Qi=Ne.extend({method:j("prompts/get"),params:Xi}),so=O({type:j("text"),text:p(),annotations:xt.optional(),_meta:Y(p(),se()).optional()}),io=O({type:j("image"),data:sl,mimeType:p(),annotations:xt.optional(),_meta:Y(p(),se()).optional()}),ao=O({type:j("audio"),data:sl,mimeType:p(),annotations:xt.optional(),_meta:Y(p(),se()).optional()}),ea=O({type:j("tool_use"),name:p(),id:p(),input:Y(p(),se()),_meta:Y(p(),se()).optional()}),ta=O({type:j("resource"),resource:Q([Nn,An]),annotations:xt.optional(),_meta:Y(p(),se()).optional()}),ra=jn.extend({type:j("resource_link")}),co=Q([so,io,ao,ra,ta]),oa=O({role:Yt,content:co}),na=Ae.extend({description:p().optional(),messages:N(oa)}),sa=Be.extend({method:j("notifications/prompts/list_changed"),params:He.optional()}),ia=O({title:p().optional(),readOnlyHint:X().optional(),destructiveHint:X().optional(),idempotentHint:X().optional(),openWorldHint:X().optional()}),aa=O({taskSupport:pe(["required","optional","forbidden"]).optional()}),qn=O({...Ct.shape,...Kt.shape,description:p().optional(),inputSchema:O({type:j("object"),properties:Y(p(),Bt).optional(),required:N(p()).optional()}).catchall(se()),outputSchema:ae({$schema:p().optional()}).optional(),annotations:ia.optional(),execution:aa.optional(),_meta:Y(p(),se()).optional()}),ca=Gt.extend({method:j("tools/list")}),ua=Wt.extend({tools:N(qn)}),Ln=Ae.extend({content:N(co).default([]),structuredContent:se().optional(),isError:X().optional()}),il=Ln.or(Ae.extend({toolResult:se()})),la=br.extend({name:p(),arguments:Y(p(),se()).optional()}),da=Ne.extend({method:j("tools/call"),params:la}),pa=Be.extend({method:j("notifications/tools/list_changed"),params:He.optional()}),Dn=O({autoRefresh:X().default(!0),debounceMs:B().int().nonnegative().default(300)}),Un=pe(["debug","info","notice","warning","error","critical","alert","emergency"]),ma=De.extend({level:Un}),ha=Ne.extend({method:j("logging/setLevel"),params:ma}),fa=He.extend({level:Un,logger:p().optional(),data:se()}),ga=Be.extend({method:j("notifications/message"),params:fa}),_a=O({name:p().optional()}),Sa=O({hints:N(_a).optional(),costPriority:B().min(0).max(1).optional(),speedPriority:B().min(0).max(1).optional(),intelligencePriority:B().min(0).max(1).optional()}),ya=O({mode:pe(["auto","required","none"]).optional()}),va=O({type:j("tool_result"),toolUseId:p().describe("The unique identifier for the corresponding tool call."),content:N(co),structuredContent:se().optional(),isError:X().optional(),_meta:Y(p(),se()).optional()}),ba=Yr("type",[so,io,ao]),_r=Yr("type",[so,io,ao,ea,va]),za=O({role:Yt,content:Q([_r,N(_r)]),_meta:Y(p(),se()).optional()}),wa=br.extend({messages:N(za),modelPreferences:Sa.optional(),systemPrompt:p().optional(),includeContext:pe(["none","thisServer","allServers"]).optional(),temperature:B().optional(),maxTokens:B().int(),stopSequences:N(p()).optional(),metadata:xe.optional(),tools:N(qn).optional(),toolChoice:ya.optional()}),Ra=Ne.extend({method:j("sampling/createMessage"),params:wa}),$a=Ae.extend({model:p(),stopReason:ne(pe(["endTurn","stopSequence","maxTokens"]).or(p())),role:Yt,content:ba}),Pa=Ae.extend({model:p(),stopReason:ne(pe(["endTurn","stopSequence","maxTokens","toolUse"]).or(p())),role:Yt,content:Q([_r,N(_r)])}),Zn=O({type:j("boolean"),title:p().optional(),description:p().optional(),default:X().optional()}),uo=O({type:j("string"),title:p().optional(),description:p().optional(),minLength:B().optional(),maxLength:B().optional(),format:pe(["email","uri","date","date-time"]).optional(),default:p().optional()}),lo=O({type:pe(["number","integer"]),title:p().optional(),description:p().optional(),minimum:B().optional(),maximum:B().optional(),default:B().optional()}),Vn=O({type:j("string"),title:p().optional(),description:p().optional(),enum:N(p()),default:p().optional()}),Fn=O({type:j("string"),title:p().optional(),description:p().optional(),oneOf:N(O({const:p(),title:p()})),default:p().optional()}),Hn=O({type:j("string"),title:p().optional(),description:p().optional(),enum:N(p()),enumNames:N(p()).optional(),default:p().optional()}),Ea=Q([Vn,Fn]),Bn=O({type:j("array"),title:p().optional(),description:p().optional(),minItems:B().optional(),maxItems:B().optional(),items:O({type:j("string"),enum:N(p())}),default:N(p()).optional()}),Jn=O({type:j("array"),title:p().optional(),description:p().optional(),minItems:B().optional(),maxItems:B().optional(),items:O({anyOf:N(O({const:p(),title:p()}))}),default:N(p()).optional()}),Ta=Q([Bn,Jn]),ka=Q([Hn,Ea,Ta]),Kn=Q([ka,Zn,uo,lo]),po=br.extend({mode:j("form").optional(),message:p(),requestedSchema:O({type:j("object"),properties:Y(p(),Kn),required:N(p()).optional()}).catchall(se())}),Ca=br.extend({mode:j("url"),message:p(),elicitationId:p(),url:p().url()}),Oa=Q([po,Ca]),Ia=Ne.extend({method:j("elicitation/create"),params:Oa}),xa=He.extend({elicitationId:p()}),Na=Be.extend({method:j("notifications/elicitation/complete"),params:xa}),Aa=Ae.extend({action:pe(["accept","decline","cancel"]),content:gr(e=>e===null?void 0:e,Y(p(),Q([p(),B(),X(),N(p())])).optional())}),ja=O({type:j("ref/resource"),uri:p()}),Ma=O({type:j("ref/prompt"),name:p()}),qa=De.extend({ref:Q([Ma,ja]),argument:O({name:p(),value:p()}),context:O({arguments:Y(p(),p()).optional()}).optional()}),La=Ne.extend({method:j("completion/complete"),params:qa}),Da=Ae.extend({completion:ae({values:N(p()).max(100),total:ne(B().int()),hasMore:ne(X())})}),Ua=O({uri:p().startsWith("file://"),name:p().optional(),_meta:Y(p(),se()).optional()}),Za=Ne.extend({method:j("roots/list"),params:De.optional()}),Va=Ae.extend({roots:N(Ua)}),Fa=Be.extend({method:j("notifications/roots/list_changed"),params:He.optional()}),al=ae({ttl:B().optional(),pollInterval:B().optional()}),Ha=pe(["working","input_required","completed","failed","cancelled"]),Xt=O({taskId:p(),status:Ha,ttl:Q([B(),fr()]),createdAt:p(),lastUpdatedAt:p(),pollInterval:ne(B()),statusMessage:ne(p())}),cl=Ae.extend({task:Xt}),Ba=He.merge(Xt),ul=Be.extend({method:j("notifications/tasks/status"),params:Ba}),ll=Ne.extend({method:j("tasks/get"),params:De.extend({taskId:p()})}),dl=Ae.merge(Xt),pl=Ne.extend({method:j("tasks/result"),params:De.extend({taskId:p()})}),ml=Ae.loose(),hl=Gt.extend({method:j("tasks/list")}),fl=Wt.extend({tasks:N(Xt)}),gl=Ne.extend({method:j("tasks/cancel"),params:De.extend({taskId:p()})}),_l=Ae.merge(Xt),Sl=Q([On,Tn,wi,La,ha,Qi,Wi,Ti,Ci,xi,Mi,Li,Ui,da,ca]),yl=Q([En,In,Cn,Fa]),vl=Q([Pn,$a,Pa,Aa,Va]),bl=Q([On,Ra,Ia,Za]),zl=Q([En,In,ga,Ji,Ai,pa,sa,Vi,Na]),wl=Q([Pn,zi,zr,Da,na,Yi,ki,Oi,Ni,Ln,ua,Hi]);var Ue=ui().superRefine((e,t)=>{if(!URL.canParse(e))return t.addIssue({code:ug.custom,message:"URL must be parseable",fatal:!0}),Dc}).refine(e=>{let t=new URL(e);return t.protocol!=="javascript:"&&t.protocol!=="data:"&&t.protocol!=="vbscript:"},{message:"URL cannot use javascript:, data:, or vbscript: scheme"}),Gn=ae({resource:p().url(),authorization_servers:N(Ue).optional(),jwks_uri:p().url().optional(),scopes_supported:N(p()).optional(),bearer_methods_supported:N(p()).optional(),resource_signing_alg_values_supported:N(p()).optional(),resource_name:p().optional(),resource_documentation:p().optional(),resource_policy_uri:p().url().optional(),resource_tos_uri:p().url().optional(),tls_client_certificate_bound_access_tokens:X().optional(),authorization_details_types_supported:N(p()).optional(),dpop_signing_alg_values_supported:N(p()).optional(),dpop_bound_access_tokens_required:X().optional()}),mo=ae({issuer:p(),authorization_endpoint:Ue,token_endpoint:Ue,registration_endpoint:Ue.optional(),scopes_supported:N(p()).optional(),response_types_supported:N(p()),response_modes_supported:N(p()).optional(),grant_types_supported:N(p()).optional(),token_endpoint_auth_methods_supported:N(p()).optional(),token_endpoint_auth_signing_alg_values_supported:N(p()).optional(),service_documentation:Ue.optional(),revocation_endpoint:Ue.optional(),revocation_endpoint_auth_methods_supported:N(p()).optional(),revocation_endpoint_auth_signing_alg_values_supported:N(p()).optional(),introspection_endpoint:p().optional(),introspection_endpoint_auth_methods_supported:N(p()).optional(),introspection_endpoint_auth_signing_alg_values_supported:N(p()).optional(),code_challenge_methods_supported:N(p()).optional(),client_id_metadata_document_supported:X().optional(),authorization_response_iss_parameter_supported:X().optional().catch(void 0),dpop_signing_alg_values_supported:N(p()).optional()}),Ja=ae({issuer:p(),authorization_endpoint:Ue,token_endpoint:Ue,userinfo_endpoint:Ue.optional(),jwks_uri:Ue,registration_endpoint:Ue.optional(),scopes_supported:N(p()).optional(),response_types_supported:N(p()),response_modes_supported:N(p()).optional(),grant_types_supported:N(p()).optional(),acr_values_supported:N(p()).optional(),subject_types_supported:N(p()),id_token_signing_alg_values_supported:N(p()),id_token_encryption_alg_values_supported:N(p()).optional(),id_token_encryption_enc_values_supported:N(p()).optional(),userinfo_signing_alg_values_supported:N(p()).optional(),userinfo_encryption_alg_values_supported:N(p()).optional(),userinfo_encryption_enc_values_supported:N(p()).optional(),request_object_signing_alg_values_supported:N(p()).optional(),request_object_encryption_alg_values_supported:N(p()).optional(),request_object_encryption_enc_values_supported:N(p()).optional(),token_endpoint_auth_methods_supported:N(p()).optional(),token_endpoint_auth_signing_alg_values_supported:N(p()).optional(),display_values_supported:N(p()).optional(),claim_types_supported:N(p()).optional(),claims_supported:N(p()).optional(),service_documentation:p().optional(),claims_locales_supported:N(p()).optional(),ui_locales_supported:N(p()).optional(),claims_parameter_supported:X().optional(),request_parameter_supported:X().optional(),request_uri_parameter_supported:X().optional(),require_request_uri_registration:X().optional(),op_policy_uri:Ue.optional(),op_tos_uri:Ue.optional(),client_id_metadata_document_supported:X().optional(),authorization_response_iss_parameter_supported:X().optional().catch(void 0)}),Wn=O({...Ja.shape,...mo.pick({code_challenge_methods_supported:!0}).shape}),ho=O({access_token:p(),id_token:p().optional(),token_type:p(),expires_in:di.number().optional(),scope:p().optional(),refresh_token:p().optional(),issuer:p().optional().catch(void 0)}).strip(),Ka=O({issued_token_type:j("urn:ietf:params:oauth:token-type:id-jag"),access_token:p(),token_type:p().optional(),expires_in:B().optional(),scope:p().optional()}).strip(),fo=O({error:p(),error_description:p().optional(),error_uri:p().optional()}),Rl=Ue.optional().or(j("").transform(()=>{})),Ga=O({redirect_uris:N(Ue),token_endpoint_auth_method:p().optional(),grant_types:N(p()).optional(),response_types:N(p()).optional(),application_type:p().optional(),client_name:p().optional(),client_uri:Ue.optional(),logo_uri:Rl,scope:p().optional(),contacts:N(p()).optional(),tos_uri:Rl,policy_uri:p().optional(),jwks_uri:Ue.optional(),jwks:Qf().optional(),software_id:p().optional(),software_version:p().optional(),software_statement:p().optional()}).strip(),Wa=O({client_id:p(),client_secret:p().optional(),client_id_issued_at:B().optional(),client_secret_expires_at:B().optional(),issuer:p().optional().catch(void 0)}).strip(),Yn=Ga.merge(Wa),$l=O({error:p(),error_description:p().optional()}).strip(),Pl=O({token:p(),token_type_hint:p().optional()}).strip();var Ol=Symbol.for("mcp.sdk.errorBrands");function er(e,t){let r=new Set,o=t;for(;typeof o=="function";){let n=o.mcpBrand;Object.prototype.hasOwnProperty.call(o,"mcpBrand")&&typeof n=="string"&&r.add(n),o=Object.getPrototypeOf(o)}r.size!==0&&Object.defineProperty(e,Ol,{value:r,enumerable:!1,configurable:!0})}function Qe(e,t){try{if(typeof t=="object"&&t!==null&&Object.prototype.hasOwnProperty.call(e,"mcpBrand")&&typeof e.mcpBrand=="string"&&Object.prototype.hasOwnProperty.call(t,Ol)){let r=t[Ol];if(r&&typeof r.has=="function"&&r.has(e.mcpBrand))return!0}}catch{}return Function.prototype[Symbol.hasInstance].call(e,t)}var St=(function(e){return e.InvalidRequest="invalid_request",e.InvalidClient="invalid_client",e.InvalidGrant="invalid_grant",e.UnauthorizedClient="unauthorized_client",e.UnsupportedGrantType="unsupported_grant_type",e.InvalidScope="invalid_scope",e.AccessDenied="access_denied",e.ServerError="server_error",e.TemporarilyUnavailable="temporarily_unavailable",e.UnsupportedResponseType="unsupported_response_type",e.UnsupportedTokenType="unsupported_token_type",e.InvalidToken="invalid_token",e.MethodNotAllowed="method_not_allowed",e.TooManyRequests="too_many_requests",e.InvalidClientMetadata="invalid_client_metadata",e.InvalidRedirectUri="invalid_redirect_uri",e.InsufficientScope="insufficient_scope",e.InvalidTarget="invalid_target",e.InvalidDpopProof="invalid_dpop_proof",e.UseDpopNonce="use_dpop_nonce",e})({}),tr=class xg extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.OAuthError"})}static[Symbol.hasInstance](t){return Qe(this,t)}static isInstance(t){if(typeof this!="function")throw new TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return Qe(this,t)}constructor(t,r,o){super(r),this.code=t,this.errorUri=o,this.name="OAuthError",er(this,new.target)}toResponseObject(){let t={error:this.code,error_description:this.message};return this.errorUri&&(t.error_uri=this.errorUri),t}static fromResponse(t){return new xg(t.error,t.error_description??t.error,t.error_uri)}},ee=(function(e){return e.NotConnected="NOT_CONNECTED",e.AlreadyConnected="ALREADY_CONNECTED",e.NotInitialized="NOT_INITIALIZED",e.CapabilityNotSupported="CAPABILITY_NOT_SUPPORTED",e.RequestTimeout="REQUEST_TIMEOUT",e.ConnectionClosed="CONNECTION_CLOSED",e.SendFailed="SEND_FAILED",e.InvalidResult="INVALID_RESULT",e.UnsupportedResultType="UNSUPPORTED_RESULT_TYPE",e.InputRequiredRoundsExceeded="INPUT_REQUIRED_ROUNDS_EXCEEDED",e.ListPaginationExceeded="LIST_PAGINATION_EXCEEDED",e.MethodNotSupportedByProtocolVersion="METHOD_NOT_SUPPORTED_BY_PROTOCOL_VERSION",e.EraNegotiationFailed="ERA_NEGOTIATION_FAILED",e.ClientHttpNotImplemented="CLIENT_HTTP_NOT_IMPLEMENTED",e.ClientHttpAuthentication="CLIENT_HTTP_AUTHENTICATION",e.ClientHttpForbidden="CLIENT_HTTP_FORBIDDEN",e.ClientHttpUnexpectedContent="CLIENT_HTTP_UNEXPECTED_CONTENT",e.ClientHttpFailedToOpenStream="CLIENT_HTTP_FAILED_TO_OPEN_STREAM",e.ClientHttpFailedToTerminateSession="CLIENT_HTTP_FAILED_TO_TERMINATE_SESSION",e})({}),re=class extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.SdkError"})}static[Symbol.hasInstance](e){return Qe(this,e)}static isInstance(e){if(typeof this!="function")throw new TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return Qe(this,e)}constructor(e,t,r,o){super(t,o),this.code=e,this.data=r,this.name="SdkError",er(this,new.target)}},mt=class extends re{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.SdkHttpError"})}constructor(e,t,r,o){super(e,t,r,o),this.name="SdkHttpError"}get status(){return this.data.status}get statusText(){return this.data.statusText}};function jl(e){let t=typeof e=="string"?new URL(e):new URL(e.href);return t.hash="",t}function oc(e){if(typeof e!="object"||e===null||Array.isArray(e))return e;let t={...e};return delete t.issuer,t}function Ml({requestedResource:e,configuredResource:t}){let r=typeof e=="string"?new URL(e):new URL(e.href),o=typeof t=="string"?new URL(t):new URL(t.href);if(r.origin!==o.origin||r.pathname.length<o.pathname.length)return!1;let n=r.pathname.endsWith("/")?r.pathname:r.pathname+"/",s=o.pathname.endsWith("/")?o.pathname:o.pathname+"/";return n.startsWith(s)}var Ng="2026-07-28",ql=[Ng];function yt(e){return e>=Ng}function Ll(e){return e.filter(t=>!yt(t))}function os(e){return e.filter(t=>yt(t))}function Ag(e){let t=e.structuredContent;return t===void 0||!(typeof t!="object"||t===null||Array.isArray(t))||(e.content?.some(r=>r.type==="text")??!1)?e:{...e,content:[...e.content??[],{type:"text",text:JSON.stringify(t)}]}}var jg=["task","inputRequests","requestState"];function pz(e){return e===null||typeof e!="object"||Array.isArray(e)||e.content!==void 0||jg.some(t=>t in e)?e:{...e,content:[]}}function mz(){let e=yn(()=>Q([p(),B(),X(),fr(),Y(p(),e),N(e)])),t=Y(p(),e),r=Q([p(),B().int()]),o=p(),n=O({ttl:B().optional()}),s=O({taskId:p()}),i=ae({progressToken:r.optional(),"io.modelcontextprotocol/related-task":s.optional()}),c=O({_meta:i.optional()}),a=c.extend({task:n.optional()}),u=O({method:p(),params:c.loose().optional()}),l=O({_meta:i.optional()}),d=O({method:p(),params:l.loose().optional()}),h=ae({_meta:i.optional()}),_=Q([p(),B().int()]),y=h.strict(),z=l.extend({requestId:_.optional(),reason:p().optional()}),b=d.extend({method:j("notifications/cancelled"),params:z}),g=O({src:p(),mimeType:p().optional(),sizes:N(p()).optional(),theme:pe(["light","dark"]).optional()}),P=O({icons:N(g).optional()}),$=O({name:p(),title:p().optional()}),E=$.extend({...$.shape,...P.shape,version:p(),websiteUrl:p().optional(),description:p().optional()}),k=Tt(O({applyDefaults:X().optional()}),t),v=gr(Fe=>Fe&&typeof Fe=="object"&&!Array.isArray(Fe)&&Object.keys(Fe).length===0?{form:{}}:Fe,Tt(O({form:k.optional(),url:t.optional()}),t.optional())),S=ae({list:t.optional(),cancel:t.optional(),requests:ae({sampling:ae({createMessage:t.optional()}).optional(),elicitation:ae({create:t.optional()}).optional()}).optional()}),T=ae({list:t.optional(),cancel:t.optional(),requests:ae({tools:ae({call:t.optional()}).optional()}).optional()}),A=O({experimental:Y(p(),t).optional(),sampling:O({context:t.optional(),tools:t.optional()}).optional(),elicitation:v.optional(),roots:O({listChanged:X().optional()}).optional(),tasks:S.optional(),extensions:Y(p(),t).optional()}),F=c.extend({protocolVersion:p(),capabilities:A,clientInfo:E}),L=u.extend({method:j("initialize"),params:F}),U=O({experimental:Y(p(),t).optional(),logging:t.optional(),completions:t.optional(),prompts:O({listChanged:X().optional()}).optional(),resources:O({subscribe:X().optional(),listChanged:X().optional()}).optional(),tools:O({listChanged:X().optional()}).optional(),tasks:T.optional(),extensions:Y(p(),t).optional()}),K=h.extend({protocolVersion:p(),capabilities:U,serverInfo:E,instructions:p().optional()}),J=d.extend({method:j("notifications/initialized"),params:l.optional()}),de=u.extend({method:j("ping"),params:c.optional()}),ve=O({progress:B(),total:ne(B()),message:ne(p())}),ye=O({...l.shape,...ve.shape,progressToken:r}),Ee=d.extend({method:j("notifications/progress"),params:ye}),fe=c.extend({cursor:o.optional()}),x=u.extend({params:fe.optional()}),M=h.extend({nextCursor:o.optional()}),w=O({uri:p(),mimeType:ne(p()),_meta:Y(p(),se()).optional()}),m=w.extend({text:p()}),f=p().refine(Fe=>{try{return atob(Fe),!0}catch{return!1}},{message:"Invalid Base64 string"}),R=w.extend({blob:f}),I=pe(["user","assistant"]),Z=O({audience:N(I).optional(),priority:B().min(0).max(1).optional(),lastModified:kt.datetime({offset:!0}).optional()}),W=O({...$.shape,...P.shape,uri:p(),description:ne(p()),mimeType:ne(p()),size:ne(B()),annotations:Z.optional(),_meta:ne(ae({}))}),G=O({...$.shape,...P.shape,uriTemplate:p(),description:ne(p()),mimeType:ne(p()),annotations:Z.optional(),_meta:ne(ae({}))}),me=x.extend({method:j("resources/list")}),ze=M.extend({resources:N(W)}),C=x.extend({method:j("resources/templates/list")}),q=M.extend({resourceTemplates:N(G)}),V=c.extend({uri:p()}),te=V,oe=u.extend({method:j("resources/read"),params:te}),ie=h.extend({contents:N(Q([m,R]))}),ge=d.extend({method:j("notifications/resources/list_changed"),params:l.optional()}),Ce=V,we=u.extend({method:j("resources/subscribe"),params:Ce}),Ie=V,Te=u.extend({method:j("resources/unsubscribe"),params:Ie}),st=l.extend({uri:p()}),qe=d.extend({method:j("notifications/resources/updated"),params:st}),vt=O({name:p(),description:ne(p()),required:ne(X())}),ct=O({...$.shape,...P.shape,description:ne(p()),arguments:ne(N(vt)),_meta:ne(ae({}))}),bt=x.extend({method:j("prompts/list")}),At=M.extend({prompts:N(ct)}),jt=c.extend({name:p(),arguments:Y(p(),p()).optional()}),or=u.extend({method:j("prompts/get"),params:jt}),nr=O({type:j("text"),text:p(),annotations:Z.optional(),_meta:Y(p(),se()).optional()}),sr=O({type:j("image"),data:f,mimeType:p(),annotations:Z.optional(),_meta:Y(p(),se()).optional()}),ir=O({type:j("audio"),data:f,mimeType:p(),annotations:Z.optional(),_meta:Y(p(),se()).optional()}),Ro=O({type:j("tool_use"),name:p(),id:p(),input:Y(p(),se()),_meta:Y(p(),se()).optional()}),Mt=O({type:j("resource"),resource:Q([m,R]),annotations:Z.optional(),_meta:Y(p(),se()).optional()}),$o=W.extend({type:j("resource_link")}),it=Q([nr,sr,ir,$o,Mt]),Pr=O({role:I,content:it}),Er=h.extend({description:p().optional(),messages:N(Pr)}),ar=d.extend({method:j("notifications/prompts/list_changed"),params:l.optional()}),Po=O({title:p().optional(),readOnlyHint:X().optional(),destructiveHint:X().optional(),idempotentHint:X().optional(),openWorldHint:X().optional()}),Tr=O({taskSupport:pe(["required","optional","forbidden"]).optional()}),cr=O({...$.shape,...P.shape,description:p().optional(),inputSchema:O({type:j("object"),properties:Y(p(),e).optional(),required:N(p()).optional()}).catchall(se()),outputSchema:O({type:j("object"),properties:Y(p(),e).optional(),required:N(p()).optional()}).catchall(se()).optional(),annotations:Po.optional(),execution:Tr.optional(),_meta:Y(p(),se()).optional()}),kr=x.extend({method:j("tools/list")}),Cr=M.extend({tools:N(cr)}),Or=h.extend({content:N(it),structuredContent:Y(p(),se()).optional(),isError:X().optional()}),Ve=a.extend({name:p(),arguments:Y(p(),se()).optional()}),Eo=u.extend({method:j("tools/call"),params:Ve}),us=d.extend({method:j("notifications/tools/list_changed"),params:l.optional()}),Ir=pe(["debug","info","notice","warning","error","critical","alert","emergency"]),To=c.extend({level:Ir}),ko=u.extend({method:j("logging/setLevel"),params:To}),Co=l.extend({level:Ir,logger:p().optional(),data:se()}),Oo=d.extend({method:j("notifications/message"),params:Co}),Io=O({name:p().optional()}),xo=O({hints:N(Io).optional(),costPriority:B().min(0).max(1).optional(),speedPriority:B().min(0).max(1).optional(),intelligencePriority:B().min(0).max(1).optional()}),No=O({mode:pe(["auto","required","none"]).optional()}),ls=O({type:j("tool_result"),toolUseId:p().describe("The unique identifier for the corresponding tool call."),content:N(it),structuredContent:O({}).loose().optional(),isError:X().optional(),_meta:Y(p(),se()).optional()}),Ao=Yr("type",[nr,sr,ir]),qt=Yr("type",[nr,sr,ir,Ro,ls]),jo=O({role:I,content:Q([qt,N(qt)]),_meta:Y(p(),se()).optional()}),Mo=a.extend({messages:N(jo),modelPreferences:xo.optional(),systemPrompt:p().optional(),includeContext:pe(["none","thisServer","allServers"]).optional(),temperature:B().optional(),maxTokens:B().int(),stopSequences:N(p()).optional(),metadata:t.optional(),tools:N(cr).optional(),toolChoice:No.optional()}),qo=u.extend({method:j("sampling/createMessage"),params:Mo}),Lo=h.extend({model:p(),stopReason:ne(pe(["endTurn","stopSequence","maxTokens"]).or(p())),role:I,content:Ao}),Do=h.extend({model:p(),stopReason:ne(pe(["endTurn","stopSequence","maxTokens","toolUse"]).or(p())),role:I,content:Q([qt,N(qt)])}),Uo=O({type:j("boolean"),title:p().optional(),description:p().optional(),default:X().optional()}),Zo=O({type:j("string"),title:p().optional(),description:p().optional(),minLength:B().optional(),maxLength:B().optional(),format:pe(["email","uri","date","date-time"]).optional(),default:p().optional()}),Vo=O({type:pe(["number","integer"]),title:p().optional(),description:p().optional(),minimum:B().optional(),maximum:B().optional(),default:B().optional()}),Fo=O({type:j("string"),title:p().optional(),description:p().optional(),enum:N(p()),default:p().optional()}),Ho=O({type:j("string"),title:p().optional(),description:p().optional(),oneOf:N(O({const:p(),title:p()})),default:p().optional()}),Bo=O({type:j("string"),title:p().optional(),description:p().optional(),enum:N(p()),enumNames:N(p()).optional(),default:p().optional()}),Jo=Q([Fo,Ho]),ur=O({type:j("array"),title:p().optional(),description:p().optional(),minItems:B().optional(),maxItems:B().optional(),items:O({type:j("string"),enum:N(p())}),default:N(p()).optional()}),lr=O({type:j("array"),title:p().optional(),description:p().optional(),minItems:B().optional(),maxItems:B().optional(),items:O({anyOf:N(O({const:p(),title:p()}))}),default:N(p()).optional()}),ds=Q([ur,lr]),ps=Q([Bo,Jo,ds]),et=Q([ps,Uo,Zo,Vo]),tt=a.extend({mode:j("form").optional(),message:p(),requestedSchema:O({type:j("object"),properties:Y(p(),et),required:N(p()).optional()}).catchall(se())}),Ko=a.extend({mode:j("url"),message:p(),elicitationId:p(),url:p().url()}),ut=Q([tt,Ko]),ms=u.extend({method:j("elicitation/create"),params:ut}),hs=l.extend({elicitationId:p()}),fs=d.extend({method:j("notifications/elicitation/complete"),params:hs}),gs=h.extend({action:pe(["accept","decline","cancel"]),content:gr(Fe=>Fe===null?void 0:Fe,Y(p(),Q([p(),B(),X(),N(p())])).optional())}),_s=O({type:j("ref/resource"),uri:p()}),Ss=O({type:j("ref/prompt"),name:p()}),ys=c.extend({ref:Q([Ss,_s]),argument:O({name:p(),value:p()}),context:O({arguments:Y(p(),p()).optional()}).optional()}),Go=u.extend({method:j("completion/complete"),params:ys}),vs=h.extend({completion:ae({values:N(p()).max(100),total:ne(B().int()),hasMore:ne(X())})}),bs=O({uri:p().startsWith("file://"),name:p().optional(),_meta:Y(p(),se()).optional()}),xr=u.extend({method:j("roots/list"),params:c.optional()}),Wo=h.extend({roots:N(bs)}),zs=d.extend({method:j("notifications/roots/list_changed"),params:l.optional()}),ws=ae({ttl:B().optional(),pollInterval:B().optional()}),Yo=pe(["working","input_required","completed","failed","cancelled"]),Lt=O({taskId:p(),status:Yo,ttl:Q([B(),fr()]),createdAt:p(),lastUpdatedAt:p(),pollInterval:ne(B()),statusMessage:ne(p())}),Ge=h.extend({task:Lt}),Rs=l.merge(Lt),dr=d.extend({method:j("notifications/tasks/status"),params:Rs}),Nr=u.extend({method:j("tasks/get"),params:c.extend({taskId:p()})}),Ar=h.merge(Lt),jr=u.extend({method:j("tasks/result"),params:c.extend({taskId:p()})}),zc=h.loose(),Je=x.extend({method:j("tasks/list")}),je=M.extend({tasks:N(Lt)}),pr=u.extend({method:j("tasks/cancel"),params:c.extend({taskId:p()})});return{JSONValueSchema:e,JSONObjectSchema:t,ProgressTokenSchema:r,CursorSchema:o,TaskMetadataSchema:n,RelatedTaskMetadataSchema:s,RequestMetaSchema:i,BaseRequestParamsSchema:c,TaskAugmentedRequestParamsSchema:a,RequestSchema:u,NotificationsParamsSchema:l,NotificationSchema:d,ResultSchema:h,RequestIdSchema:_,EmptyResultSchema:y,CancelledNotificationParamsSchema:z,CancelledNotificationSchema:b,IconSchema:g,IconsSchema:P,BaseMetadataSchema:$,ImplementationSchema:E,ClientTasksCapabilitySchema:S,ServerTasksCapabilitySchema:T,ClientCapabilitiesSchema:A,InitializeRequestParamsSchema:F,InitializeRequestSchema:L,ServerCapabilitiesSchema:U,InitializeResultSchema:K,InitializedNotificationSchema:J,PingRequestSchema:de,ProgressSchema:ve,ProgressNotificationParamsSchema:ye,ProgressNotificationSchema:Ee,PaginatedRequestParamsSchema:fe,PaginatedRequestSchema:x,PaginatedResultSchema:M,ResourceContentsSchema:w,TextResourceContentsSchema:m,BlobResourceContentsSchema:R,RoleSchema:I,AnnotationsSchema:Z,ResourceSchema:W,ResourceTemplateSchema:G,ListResourcesRequestSchema:me,ListResourcesResultSchema:ze,ListResourceTemplatesRequestSchema:C,ListResourceTemplatesResultSchema:q,ResourceRequestParamsSchema:V,ReadResourceRequestParamsSchema:te,ReadResourceRequestSchema:oe,ReadResourceResultSchema:ie,ResourceListChangedNotificationSchema:ge,SubscribeRequestParamsSchema:Ce,SubscribeRequestSchema:we,UnsubscribeRequestParamsSchema:Ie,UnsubscribeRequestSchema:Te,ResourceUpdatedNotificationParamsSchema:st,ResourceUpdatedNotificationSchema:qe,PromptArgumentSchema:vt,PromptSchema:ct,ListPromptsRequestSchema:bt,ListPromptsResultSchema:At,GetPromptRequestParamsSchema:jt,GetPromptRequestSchema:or,TextContentSchema:nr,ImageContentSchema:sr,AudioContentSchema:ir,ToolUseContentSchema:Ro,EmbeddedResourceSchema:Mt,ResourceLinkSchema:$o,ContentBlockSchema:it,PromptMessageSchema:Pr,GetPromptResultSchema:Er,PromptListChangedNotificationSchema:ar,ToolAnnotationsSchema:Po,ToolExecutionSchema:Tr,ToolSchema:cr,ListToolsRequestSchema:kr,ListToolsResultSchema:Cr,CallToolResultSchema:Or,CallToolRequestParamsSchema:Ve,CallToolRequestSchema:Eo,ToolListChangedNotificationSchema:us,LoggingLevelSchema:Ir,SetLevelRequestParamsSchema:To,SetLevelRequestSchema:ko,LoggingMessageNotificationParamsSchema:Co,LoggingMessageNotificationSchema:Oo,ModelHintSchema:Io,ModelPreferencesSchema:xo,ToolChoiceSchema:No,ToolResultContentSchema:ls,SamplingContentSchema:Ao,SamplingMessageContentBlockSchema:qt,SamplingMessageSchema:jo,CreateMessageRequestParamsSchema:Mo,CreateMessageRequestSchema:qo,CreateMessageResultSchema:Lo,CreateMessageResultWithToolsSchema:Do,BooleanSchemaSchema:Uo,StringSchemaSchema:Zo,NumberSchemaSchema:Vo,UntitledSingleSelectEnumSchemaSchema:Fo,TitledSingleSelectEnumSchemaSchema:Ho,LegacyTitledEnumSchemaSchema:Bo,SingleSelectEnumSchemaSchema:Jo,UntitledMultiSelectEnumSchemaSchema:ur,TitledMultiSelectEnumSchemaSchema:lr,MultiSelectEnumSchemaSchema:ds,EnumSchemaSchema:ps,PrimitiveSchemaDefinitionSchema:et,ElicitRequestFormParamsSchema:tt,ElicitRequestURLParamsSchema:Ko,ElicitRequestParamsSchema:ut,ElicitRequestSchema:ms,ElicitationCompleteNotificationParamsSchema:hs,ElicitationCompleteNotificationSchema:fs,ElicitResultSchema:gs,ResourceTemplateReferenceSchema:_s,PromptReferenceSchema:Ss,CompleteRequestParamsSchema:ys,CompleteRequestSchema:Go,CompleteResultSchema:vs,RootSchema:bs,ListRootsRequestSchema:xr,ListRootsResultSchema:Wo,RootsListChangedNotificationSchema:zs,TaskCreationParamsSchema:ws,TaskStatusSchema:Yo,TaskSchema:Lt,CreateTaskResultSchema:Ge,TaskStatusNotificationParamsSchema:Rs,TaskStatusNotificationSchema:dr,GetTaskRequestSchema:Nr,GetTaskResultSchema:Ar,GetTaskPayloadRequestSchema:jr,GetTaskPayloadResultSchema:zc,ListTasksRequestSchema:Je,ListTasksResultSchema:je,CancelTaskRequestSchema:pr,CancelTaskResultSchema:h.merge(Lt),ClientRequestSchema:Q([de,L,Go,ko,or,bt,me,C,oe,we,Te,Eo,kr,Nr,jr,Je,pr]),ClientNotificationSchema:Q([b,Ee,J,zs,dr]),ClientResultSchema:Q([y,Lo,Do,gs,Wo,Ar,je,Ge]),ServerRequestSchema:Q([de,qo,ms,xr,Nr,jr,Je,pr]),ServerNotificationSchema:Q([b,Ee,Oo,qe,ge,us,ar,dr,fs]),ServerResultSchema:Q([y,K,vs,Er,At,ze,q,ie,Or,Cr,Ar,je,Ge]),CallToolResultWireSchema:se().superRefine((Fe,wy)=>{if(!(typeof Fe!="object"||Fe===null||Array.isArray(Fe)||Fe.content!==void 0)){for(let jd of jg)if(jd in Fe){wy.addIssue({code:"custom",message:`content is required when the body carries '${jd}' \u2014 another result family cannot default into an empty tools/call success`});return}}}).transform(pz).pipe(Or)}}var hz;function Mg(){return hz??=mz()}function qg(e){return e.type!=="object"}var fz=new Set(["const","enum","default","examples"]),gz=new Set(["properties","patternProperties","$defs","definitions","dependentSchemas","dependencies"]);function vg(e){return e!==void 0&&!(typeof e=="string"&&e.startsWith("#"))}function _z(e){let t=typeof e.$schema=="string"?e.$schema:void 0;if(vg(e.$id))return{...t!==void 0&&{$schema:t},type:"object",properties:{result:e},required:["result"]};let r=Ld(e.$schema)&&e.$recursiveAnchor!==!0,o=(n,s)=>{if(Array.isArray(n))return n.map(a=>o(a,!1));if(n===null||typeof n!="object"||!s&&vg(n.$id))return n;let i={},c=!1;for(let[a,u]of Object.entries(n))s?i[a]=o(u,!1):(a==="$ref"||a==="$dynamicRef")&&typeof u=="string"?i[a]=u==="#"?"#/properties/result":u.startsWith("#/")?`#/properties/result${u.slice(1)}`:u:a==="$recursiveRef"&&u==="#"&&r?c=!0:fz.has(a)?i[a]=u:gz.has(a)?i[a]=o(u,!0):i[a]=o(u,!1);return c&&("$ref"in i?i.allOf=[...Array.isArray(i.allOf)?i.allOf:[],{$ref:"#/properties/result"}]:i.$ref="#/properties/result"),i};return{...t!==void 0&&{$schema:t},type:"object",properties:{result:o(e,!1)},required:["result"]}}var Lg={ping:null,initialize:null,"completion/complete":null,"logging/setLevel":null,"prompts/get":null,"prompts/list":null,"resources/list":null,"resources/templates/list":null,"resources/read":null,"resources/subscribe":null,"resources/unsubscribe":null,"tools/call":null,"tools/list":null,"tasks/get":null,"tasks/result":null,"tasks/list":null,"tasks/cancel":null,"sampling/createMessage":null,"elicitation/create":null,"roots/list":null},Dg={"notifications/cancelled":null,"notifications/progress":null,"notifications/initialized":null,"notifications/roots/list_changed":null,"notifications/tasks/status":null,"notifications/message":null,"notifications/resources/updated":null,"notifications/resources/list_changed":null,"notifications/tools/list_changed":null,"notifications/prompts/list_changed":null,"notifications/elicitation/complete":null},Sz={ping:null,initialize:null,"completion/complete":null,"logging/setLevel":null,"prompts/get":null,"prompts/list":null,"resources/list":null,"resources/templates/list":null,"resources/read":null,"resources/subscribe":null,"resources/unsubscribe":null,"tools/call":null,"tools/list":null,"sampling/createMessage":null,"elicitation/create":null,"roots/list":null},Ya;function Dl(){if(Ya)return Ya;let e=Mg();return Ya={requestSchemas:{ping:e.PingRequestSchema,initialize:e.InitializeRequestSchema,"completion/complete":e.CompleteRequestSchema,"logging/setLevel":e.SetLevelRequestSchema,"prompts/get":e.GetPromptRequestSchema,"prompts/list":e.ListPromptsRequestSchema,"resources/list":e.ListResourcesRequestSchema,"resources/templates/list":e.ListResourceTemplatesRequestSchema,"resources/read":e.ReadResourceRequestSchema,"resources/subscribe":e.SubscribeRequestSchema,"resources/unsubscribe":e.UnsubscribeRequestSchema,"tools/call":e.CallToolRequestSchema,"tools/list":e.ListToolsRequestSchema,"tasks/get":e.GetTaskRequestSchema,"tasks/result":e.GetTaskPayloadRequestSchema,"tasks/list":e.ListTasksRequestSchema,"tasks/cancel":e.CancelTaskRequestSchema,"sampling/createMessage":e.CreateMessageRequestSchema,"elicitation/create":e.ElicitRequestSchema,"roots/list":e.ListRootsRequestSchema},notificationSchemas:{"notifications/cancelled":e.CancelledNotificationSchema,"notifications/progress":e.ProgressNotificationSchema,"notifications/initialized":e.InitializedNotificationSchema,"notifications/roots/list_changed":e.RootsListChangedNotificationSchema,"notifications/tasks/status":e.TaskStatusNotificationSchema,"notifications/message":e.LoggingMessageNotificationSchema,"notifications/resources/updated":e.ResourceUpdatedNotificationSchema,"notifications/resources/list_changed":e.ResourceListChangedNotificationSchema,"notifications/tools/list_changed":e.ToolListChangedNotificationSchema,"notifications/prompts/list_changed":e.PromptListChangedNotificationSchema,"notifications/elicitation/complete":e.ElicitationCompleteNotificationSchema},resultSchemas:{ping:e.EmptyResultSchema,initialize:e.InitializeResultSchema,"completion/complete":e.CompleteResultSchema,"logging/setLevel":e.EmptyResultSchema,"prompts/get":e.GetPromptResultSchema,"prompts/list":e.ListPromptsResultSchema,"resources/list":e.ListResourcesResultSchema,"resources/templates/list":e.ListResourceTemplatesResultSchema,"resources/read":e.ReadResourceResultSchema,"resources/subscribe":e.EmptyResultSchema,"resources/unsubscribe":e.EmptyResultSchema,"tools/call":e.CallToolResultWireSchema,"tools/list":e.ListToolsResultSchema,"sampling/createMessage":e.CreateMessageResultWithToolsSchema,"elicitation/create":e.ElicitResultSchema,"roots/list":e.ListRootsResultSchema}},Ya}function Ug(e){return Object.prototype.hasOwnProperty.call(Lg,e)}function Zg(e){return Object.prototype.hasOwnProperty.call(Dg,e)}function yz(e){return Object.prototype.hasOwnProperty.call(Sz,e)}function vz(e){return yz(e)?Dl().resultSchemas[e]:void 0}function bz(e){return Ug(e)?Dl().requestSchemas[e]:void 0}function zz(e){return Zg(e)?Dl().notificationSchemas[e]:void 0}var sT=Object.keys(Lg),iT=Object.keys(Dg);function Il(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function Xa(e,t){if(e===void 0)return{ok:!1,reason:"not-in-era"};let r=e.safeParse(t);return r.success?{ok:!0,value:r.data}:{ok:!1,reason:"invalid",message:String(r.error)}}var bg={ok:!1,reason:"not-in-era"};function zg(e){return Il(e)&&Il(e.outputSchema)&&qg(e.outputSchema)}var Ul={era:"2025-11-25",hasRequestMethod:Ug,hasNotificationMethod:Zg,validateRequest:(e,t)=>Xa(bz(e),t),validateResult:(e,t)=>Xa(vz(e),t),validateNotification:(e,t)=>Xa(zz(e),t),hasInputRequestMethod:()=>!1,validateInputRequest:()=>bg,validateInputResponse:()=>bg,samplingResultVariant:((e,t)=>{let r=Mg();return Xa(e?r.CreateMessageResultWithToolsSchema:r.CreateMessageResultSchema,t)}),outboundEnvelope:e=>{},validateEnvelopeMeta:e=>[],projectCallToolResult(e,t){let r=Ag(e),o=r.structuredContent;if(o===void 0)return r;let n=typeof o!="object"||o===null||Array.isArray(o),s=t!==void 0&&qg(t);return!n&&!s?r:{...r,structuredContent:{result:o}}},decodeResult(e,t){if(Il(t)&&"resultType"in t){let r={...t};return delete r.resultType,{kind:"complete",result:r}}return{kind:"complete",result:t}},encodeResult(e,t){if(e!=="tools/list")return t;let r=t.tools;return!Array.isArray(r)||!r.some(o=>zg(o))?t:{...t,tools:r.map(o=>zg(o)?{...o,outputSchema:_z(o.outputSchema)}:o)}},encodeErrorCode:e=>e===-32002?-32602:e,checkInboundEnvelope:e=>{}};function wz(){let e=yn(()=>Q([p(),B(),X(),fr(),Y(p(),e),N(e)])),t=Y(p(),e),r=Q([p(),B().int()]),o=p(),n=Q([p(),B().int()]),s=pe(["user","assistant"]),i=pe(["debug","info","notice","warning","error","critical","alert","emergency"]),c=p().refine(je=>{try{return atob(je),!0}catch{return!1}},{message:"Invalid Base64 string"}),a=O({ttl:B().optional()}),u=O({taskId:p()}),l=ae({progressToken:r.optional(),"io.modelcontextprotocol/related-task":u.optional()}),d=O({_meta:l.optional()}),h=d.extend({task:a.optional()}),_=O({_meta:l.optional()}),y=O({method:p(),params:_.loose().optional()}),z=O({src:p(),mimeType:p().optional(),sizes:N(p()).optional(),theme:pe(["light","dark"]).optional()}),b=O({icons:N(z).optional()}),g=O({name:p(),title:p().optional()}),P=g.extend({...g.shape,...b.shape,version:p(),websiteUrl:p().optional(),description:p().optional()}),$=Tt(O({applyDefaults:X().optional()}),t),E=gr(je=>je&&typeof je=="object"&&!Array.isArray(je)&&Object.keys(je).length===0?{form:{}}:je,Tt(O({form:$.optional(),url:t.optional()}),t.optional())),k=ae({list:t.optional(),cancel:t.optional(),requests:ae({sampling:ae({createMessage:t.optional()}).optional(),elicitation:ae({create:t.optional()}).optional()}).optional()}),v=ae({list:t.optional(),cancel:t.optional(),requests:ae({tools:ae({call:t.optional()}).optional()}).optional()}),S=O({experimental:Y(p(),t).optional(),sampling:O({context:t.optional(),tools:t.optional()}).optional(),elicitation:E.optional(),roots:O({listChanged:X().optional()}).optional(),tasks:k.optional(),extensions:Y(p(),t).optional()}),T=O({experimental:Y(p(),t).optional(),logging:t.optional(),completions:t.optional(),prompts:O({listChanged:X().optional()}).optional(),resources:O({subscribe:X().optional(),listChanged:X().optional()}).optional(),tools:O({listChanged:X().optional()}).optional(),tasks:v.optional(),extensions:Y(p(),t).optional()}),A=O({progress:B(),total:ne(B()),message:ne(p())}),F=O({..._.shape,...A.shape,progressToken:r}),L=y.extend({method:j("notifications/progress"),params:F}),U=_.extend({level:i,logger:p().optional(),data:se()}),K=y.extend({method:j("notifications/message"),params:U}),J=O({uri:p(),mimeType:ne(p()),_meta:Y(p(),se()).optional()}),de=J.extend({text:p()}),ve=J.extend({blob:c}),ye=O({audience:N(s).optional(),priority:B().min(0).max(1).optional(),lastModified:kt.datetime({offset:!0}).optional()}),Ee=O({...g.shape,...b.shape,uri:p(),description:ne(p()),mimeType:ne(p()),size:ne(B()),annotations:ye.optional(),_meta:ne(ae({}))}),fe=O({...g.shape,...b.shape,uriTemplate:p(),description:ne(p()),mimeType:ne(p()),annotations:ye.optional(),_meta:ne(ae({}))}),x=y.extend({method:j("notifications/resources/list_changed"),params:_.optional()}),M=_.extend({uri:p()}),w=y.extend({method:j("notifications/resources/updated"),params:M}),m=O({name:p(),description:ne(p()),required:ne(X())}),f=O({...g.shape,...b.shape,description:ne(p()),arguments:ne(N(m)),_meta:ne(ae({}))}),R=y.extend({method:j("notifications/prompts/list_changed"),params:_.optional()}),I=O({type:j("text"),text:p(),annotations:ye.optional(),_meta:Y(p(),se()).optional()}),Z=O({type:j("image"),data:c,mimeType:p(),annotations:ye.optional(),_meta:Y(p(),se()).optional()}),W=O({type:j("audio"),data:c,mimeType:p(),annotations:ye.optional(),_meta:Y(p(),se()).optional()}),G=O({type:j("tool_use"),name:p(),id:p(),input:Y(p(),se()),_meta:Y(p(),se()).optional()}),me=O({type:j("resource"),resource:Q([de,ve]),annotations:ye.optional(),_meta:Y(p(),se()).optional()}),ze=Ee.extend({type:j("resource_link")}),C=Q([I,Z,W,ze,me]),q=O({role:s,content:C}),V=O({title:p().optional(),readOnlyHint:X().optional(),destructiveHint:X().optional(),idempotentHint:X().optional(),openWorldHint:X().optional()}),te=y.extend({method:j("notifications/tools/list_changed"),params:_.optional()}),oe=O({name:p().optional()}),ie=O({hints:N(oe).optional(),costPriority:B().min(0).max(1).optional(),speedPriority:B().min(0).max(1).optional(),intelligencePriority:B().min(0).max(1).optional()}),ge=O({mode:pe(["auto","required","none"]).optional()}),Ce=O({type:j("boolean"),title:p().optional(),description:p().optional(),default:X().optional()}),we=O({type:j("string"),title:p().optional(),description:p().optional(),minLength:B().optional(),maxLength:B().optional(),format:pe(["email","uri","date","date-time"]).optional(),default:p().optional()}),Ie=O({type:pe(["number","integer"]),title:p().optional(),description:p().optional(),minimum:B().optional(),maximum:B().optional(),default:B().optional()}),Te=O({type:j("string"),title:p().optional(),description:p().optional(),enum:N(p()),default:p().optional()}),st=O({type:j("string"),title:p().optional(),description:p().optional(),oneOf:N(O({const:p(),title:p()})),default:p().optional()}),qe=O({type:j("string"),title:p().optional(),description:p().optional(),enum:N(p()),enumNames:N(p()).optional(),default:p().optional()}),vt=Q([Te,st]),ct=O({type:j("array"),title:p().optional(),description:p().optional(),minItems:B().optional(),maxItems:B().optional(),items:O({type:j("string"),enum:N(p())}),default:N(p()).optional()}),bt=O({type:j("array"),title:p().optional(),description:p().optional(),minItems:B().optional(),maxItems:B().optional(),items:O({anyOf:N(O({const:p(),title:p()}))}),default:N(p()).optional()}),At=Q([ct,bt]),jt=Q([qe,vt,At]),or=Q([jt,Ce,we,Ie]),nr=h.extend({mode:j("form").optional(),message:p(),requestedSchema:O({type:j("object"),properties:Y(p(),or),required:N(p()).optional()}).catchall(se())}),sr=O({type:j("ref/resource"),uri:p()}),ir=O({type:j("ref/prompt"),name:p()}),Ro=O({uri:p().startsWith("file://"),name:p().optional(),_meta:Y(p(),se()).optional()}),Mt=S.shape,$o=O({experimental:Mt.experimental,sampling:Mt.sampling,elicitation:Mt.elicitation,roots:Mt.roots,extensions:Mt.extensions}),it=T.shape,Pr=O({experimental:it.experimental,logging:it.logging,completions:it.completions,prompts:it.prompts,resources:it.resources,tools:it.tools,extensions:it.extensions}),Er=ae({progressToken:r.optional(),[Ot]:p(),[Xr]:P.optional(),[yr]:$o,[eo]:i.optional()}),ar=O({...g.shape,...b.shape,description:p().optional(),inputSchema:ae({$schema:p().optional(),type:j("object")}),outputSchema:ae({$schema:p().optional()}).optional(),annotations:V.optional(),_meta:Y(p(),se()).optional()}),Po=O({type:j("tool_result"),toolUseId:p(),content:N(C),structuredContent:se().optional(),isError:X().optional(),_meta:Y(p(),se()).optional()}),Tr=Q([I,Z,W,G,Po]),cr=O({role:s,content:Q([Tr,N(Tr)]),_meta:Y(p(),se()).optional()}),kr=p(),Cr=ae({[_t]:P.optional().catch(void 0)}),Or=Cr.optional();function Ve(je){return ae({_meta:Or,resultType:kr.default("complete"),...je})}let Eo=Ve({}),us=Ve({nextCursor:o.optional()}),Ir=Ve({content:N(C),structuredContent:se().optional(),isError:X().optional()}),To=Ve({ttlMs:B().int().min(0),cacheScope:pe(["public","private"]),tools:N(ar),nextCursor:o.optional()}),ko=Ve({ttlMs:B().int().min(0),cacheScope:pe(["public","private"]),prompts:N(f),nextCursor:o.optional()}),Co=Ve({description:p().optional(),messages:N(q)}),Oo=Ve({ttlMs:B().int().min(0),cacheScope:pe(["public","private"]),resources:N(Ee),nextCursor:o.optional()}),Io=Ve({ttlMs:B().int().min(0),cacheScope:pe(["public","private"]),resourceTemplates:N(fe),nextCursor:o.optional()}),xo=Ve({ttlMs:B().int().min(0),cacheScope:pe(["public","private"]),contents:N(Q([de,ve]))}),No=Ve({completion:O({values:N(p()).max(100),total:B().int().optional(),hasMore:X().optional()}).loose()}),ls=Ve({ttlMs:B().int().min(0),cacheScope:pe(["public","private"])}),Ao=Ve({ttlMs:B().int().min(0).catch(0),cacheScope:pe(["public","private"]).catch("private"),supportedVersions:N(p()),capabilities:Pr,instructions:p().optional()}),qt=O({messages:N(cr),modelPreferences:ie.optional(),systemPrompt:p().optional(),includeContext:pe(["none","thisServer","allServers"]).optional(),temperature:B().optional(),maxTokens:B().int(),stopSequences:N(p()).optional(),metadata:t.optional(),tools:N(ar).optional(),toolChoice:ge.optional()}),jo=O({method:j("sampling/createMessage"),params:qt}),Mo=O({method:j("roots/list"),params:O({_meta:Y(p(),se()).optional()}).optional()}),qo=O({...cr.shape,model:p(),stopReason:p().optional()}),Lo=O({roots:N(Ro)}),Do=O({action:pe(["accept","decline","cancel"]),content:Y(p(),Q([p(),B(),X(),N(p())])).optional()}),Uo=O({mode:j("url"),message:p(),url:p().url()}),Zo=Q([nr,Uo]),Vo=O({method:j("elicitation/create"),params:Zo}),Fo=Q([jo,Mo,Vo]),Ho=Q([qo,Lo,Do]),Bo=Y(p(),Fo),Jo=Y(p(),Ho),ur=Ve({inputRequests:Bo.optional(),requestState:p().optional()}),lr={inputResponses:Jo.optional(),requestState:p().optional()},ds=O({_meta:Er,...lr}),ps=ae({progressToken:r.optional()});function et(je,pr){return O({method:j(je),params:O({_meta:Er,...pr})})}function tt(je,pr){return O({method:j(je),params:O({_meta:ps.optional(),...pr}).optional()})}let Ko={name:p(),arguments:Y(p(),se()).optional(),...lr},ut={cursor:o.optional()},ms=et("tools/call",Ko),hs=et("tools/list",ut),fs=et("prompts/list",ut),gs=et("prompts/get",{name:p(),arguments:Y(p(),p()).optional(),...lr}),_s=et("resources/list",ut),Ss=et("resources/templates/list",ut),ys=et("resources/read",{uri:p(),...lr}),Go={ref:Q([ir,sr]),argument:O({name:p(),value:p()}),context:O({arguments:Y(p(),p()).optional()}).optional()},vs=et("completion/complete",Go),bs=et("server/discover",{}),xr=O({toolsListChanged:X().optional(),promptsListChanged:X().optional(),resourcesListChanged:X().optional(),resourceSubscriptions:N(p()).optional()}),Wo={notifications:xr},zs=et("subscriptions/listen",Wo),ws=Cr.extend({"io.modelcontextprotocol/subscriptionId":n}),Yo=ae({_meta:ws,resultType:kr.default("complete")}),Lt={"tools/call":tt("tools/call",Ko),"tools/list":tt("tools/list",ut),"prompts/get":tt("prompts/get",{name:p(),arguments:Y(p(),p()).optional()}),"prompts/list":tt("prompts/list",ut),"resources/list":tt("resources/list",ut),"resources/templates/list":tt("resources/templates/list",ut),"resources/read":tt("resources/read",{uri:p()}),"completion/complete":tt("completion/complete",Go),"server/discover":tt("server/discover",{}),"subscriptions/listen":tt("subscriptions/listen",Wo)};function Ge(je){return ae({_meta:Or,...je})}let Rs={"tools/call":Ge({content:N(C),structuredContent:se().optional(),isError:X().optional()}),"tools/list":Ge({ttlMs:B().int().min(0),cacheScope:pe(["public","private"]),tools:N(ar),nextCursor:o.optional()}),"prompts/get":Ge({description:p().optional(),messages:N(q)}),"prompts/list":Ge({ttlMs:B().int().min(0),cacheScope:pe(["public","private"]),prompts:N(f),nextCursor:o.optional()}),"resources/list":Ge({ttlMs:B().int().min(0),cacheScope:pe(["public","private"]),resources:N(Ee),nextCursor:o.optional()}),"resources/templates/list":Ge({ttlMs:B().int().min(0),cacheScope:pe(["public","private"]),resourceTemplates:N(fe),nextCursor:o.optional()}),"resources/read":Ge({ttlMs:B().int().min(0),cacheScope:pe(["public","private"]),contents:N(Q([de,ve]))}),"completion/complete":Ge({completion:O({values:N(p()).max(100),total:B().int().optional(),hasMore:X().optional()}).loose()}),"server/discover":Ge({ttlMs:B().int().min(0).catch(0),cacheScope:pe(["public","private"]).catch("private"),supportedVersions:N(p()),capabilities:Pr,instructions:p().optional()}),"subscriptions/listen":Ge({})},dr=ae({"io.modelcontextprotocol/subscriptionId":n.optional()}),Nr=O({method:j("notifications/subscriptions/acknowledged"),params:O({_meta:dr.optional(),notifications:xr})}),Ar=O({_meta:dr.optional(),requestId:n,reason:p().optional()}),jr=O({method:j("notifications/cancelled"),params:Ar}),zc={"notifications/cancelled":jr,"notifications/progress":L,"notifications/message":K,"notifications/resources/updated":w,"notifications/resources/list_changed":x,"notifications/tools/list_changed":te,"notifications/prompts/list_changed":R,"notifications/subscriptions/acknowledged":Nr},Je=je=>O({jsonrpc:j("2.0"),id:Q([p(),B().int()]),result:je}).strict();return{JSONValueSchema:e,JSONObjectSchema:t,ProgressTokenSchema:r,CursorSchema:o,RequestIdSchema:n,RoleSchema:s,LoggingLevelSchema:i,TaskMetadataSchema:a,RelatedTaskMetadataSchema:u,RequestMetaSchema:l,BaseRequestParamsSchema:d,TaskAugmentedRequestParamsSchema:h,NotificationsParamsSchema:_,NotificationSchema:y,IconSchema:z,IconsSchema:b,BaseMetadataSchema:g,ImplementationSchema:P,ClientTasksCapabilitySchema:k,ServerTasksCapabilitySchema:v,ClientCapabilitiesSchema:S,ServerCapabilitiesSchema:T,ProgressSchema:A,ProgressNotificationParamsSchema:F,ProgressNotificationSchema:L,LoggingMessageNotificationParamsSchema:U,LoggingMessageNotificationSchema:K,ResourceContentsSchema:J,TextResourceContentsSchema:de,BlobResourceContentsSchema:ve,AnnotationsSchema:ye,ResourceSchema:Ee,ResourceTemplateSchema:fe,ResourceListChangedNotificationSchema:x,ResourceUpdatedNotificationParamsSchema:M,ResourceUpdatedNotificationSchema:w,PromptArgumentSchema:m,PromptSchema:f,PromptListChangedNotificationSchema:R,TextContentSchema:I,ImageContentSchema:Z,AudioContentSchema:W,ToolUseContentSchema:G,EmbeddedResourceSchema:me,ResourceLinkSchema:ze,ContentBlockSchema:C,PromptMessageSchema:q,ToolAnnotationsSchema:V,ToolListChangedNotificationSchema:te,ModelHintSchema:oe,ModelPreferencesSchema:ie,ToolChoiceSchema:ge,BooleanSchemaSchema:Ce,StringSchemaSchema:we,NumberSchemaSchema:Ie,UntitledSingleSelectEnumSchemaSchema:Te,TitledSingleSelectEnumSchemaSchema:st,LegacyTitledEnumSchemaSchema:qe,SingleSelectEnumSchemaSchema:vt,UntitledMultiSelectEnumSchemaSchema:ct,TitledMultiSelectEnumSchemaSchema:bt,MultiSelectEnumSchemaSchema:At,EnumSchemaSchema:jt,PrimitiveSchemaDefinitionSchema:or,ElicitRequestFormParamsSchema:nr,ResourceTemplateReferenceSchema:sr,PromptReferenceSchema:ir,RootSchema:Ro,ClientCapabilities2026Schema:$o,ServerCapabilities2026Schema:Pr,RequestMetaEnvelopeSchema:Er,ToolSchema:ar,ToolResultContentSchema:Po,SamplingMessageContentBlockSchema:Tr,SamplingMessageSchema:cr,ResultTypeSchema:kr,ResultMetaSchema:Cr,ResultSchema:Eo,PaginatedResultSchema:us,CallToolResultSchema:Ir,ListToolsResultSchema:To,ListPromptsResultSchema:ko,GetPromptResultSchema:Co,ListResourcesResultSchema:Oo,ListResourceTemplatesResultSchema:Io,ReadResourceResultSchema:xo,CompleteResultSchema:No,CacheableResultSchema:ls,DiscoverResultSchema:Ao,CreateMessageRequestParamsSchema:qt,CreateMessageRequestSchema:jo,ListRootsRequestSchema:Mo,CreateMessageResultSchema:qo,ListRootsResultSchema:Lo,ElicitResultSchema:Do,ElicitRequestURLParamsSchema:Uo,ElicitRequestParamsSchema:Zo,ElicitRequestSchema:Vo,InputRequestSchema:Fo,InputResponseSchema:Ho,InputRequestsSchema:Bo,InputResponsesSchema:Jo,InputRequiredResultSchema:ur,InputResponseRequestParamsSchema:ds,CallToolRequestSchema:ms,ListToolsRequestSchema:hs,ListPromptsRequestSchema:fs,GetPromptRequestSchema:gs,ListResourcesRequestSchema:_s,ListResourceTemplatesRequestSchema:Ss,ReadResourceRequestSchema:ys,CompleteRequestSchema:vs,DiscoverRequestSchema:bs,SubscriptionFilterSchema:xr,SubscriptionsListenRequestSchema:zs,SubscriptionsListenResultMetaSchema:ws,SubscriptionsListenResultSchema:Yo,dispatchRequestSchemas:Lt,dispatchResultSchemas:Rs,NotificationMetaSchema:dr,SubscriptionsAcknowledgedNotificationSchema:Nr,CancelledNotificationParamsSchema:Ar,CancelledNotificationSchema:jr,notificationSchemas2026:zc,JSONRPCResultResponseSchema:Je(Eo),CallToolResultResponseSchema:Je(Q([Ir,ur])),ListToolsResultResponseSchema:Je(To),ListPromptsResultResponseSchema:Je(ko),GetPromptResultResponseSchema:Je(Q([Co,ur])),ListResourcesResultResponseSchema:Je(Oo),ListResourceTemplatesResultResponseSchema:Je(Io),ReadResourceResultResponseSchema:Je(Q([xo,ur])),CompleteResultResponseSchema:Je(No),DiscoverResultResponseSchema:Je(Ao),SubscriptionsListenResultResponseSchema:Je(Yo)}}var Rz;function Qt(){return Rz??=wz()}var $z=["tools/list","prompts/list","resources/list","resources/templates/list","resources/read","server/discover"];function Pz(e){return $z.includes(e)}var Zl=Symbol("modelcontextprotocol.resultCacheHintFallback");function Ez(e){return e[Zl]}function Vg(e){return typeof e=="number"&&Number.isSafeInteger(e)&&e>=0}function Fg(e){return e==="public"||e==="private"}var ue=(function(e){return e[e.ParseError=-32700]="ParseError",e[e.InvalidRequest=-32600]="InvalidRequest",e[e.MethodNotFound=-32601]="MethodNotFound",e[e.InvalidParams=-32602]="InvalidParams",e[e.InternalError=-32603]="InternalError",e[e.ResourceNotFound=-32002]="ResourceNotFound",e[e.MissingRequiredClientCapability=-32021]="MissingRequiredClientCapability",e[e.UnsupportedProtocolVersion=-32022]="UnsupportedProtocolVersion",e[e.UrlElicitationRequired=-32042]="UrlElicitationRequired",e})({}),be=class Hg extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.ProtocolError"})}static[Symbol.hasInstance](t){return Qe(this,t)}static isInstance(t){if(typeof this!="function")throw new TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return Qe(this,t)}constructor(t,r,o){super(r),this.code=t,this.data=o,this.name="ProtocolError",er(this,new.target)}static fromError(t,r,o){if(t===ue.UrlElicitationRequired&&o){let n=o;if(n.elicitations)return new Jg(n.elicitations,r)}if(t===ue.UnsupportedProtocolVersion&&o){let n=o;if(Array.isArray(n.supported)&&typeof n.requested=="string")return new ns({supported:n.supported,requested:n.requested},r)}if(t===ue.InvalidParams||t===ue.ResourceNotFound){let n=o;if(typeof n?.uri=="string"&&(t===ue.ResourceNotFound||Object.keys(n).length===1))return new Bg(n.uri,r)}if(t===ue.MissingRequiredClientCapability&&o){let n=o;if(n.requiredCapabilities!==null&&typeof n.requiredCapabilities=="object"&&!Array.isArray(n.requiredCapabilities))return new Kg({requiredCapabilities:n.requiredCapabilities},r)}return new Hg(t,r,o)}},Bg=class extends be{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.ResourceNotFoundError"})}constructor(e,t=`Resource not found: ${e}`){super(ue.InvalidParams,t,{uri:e})}get uri(){return this.data.uri}},Jg=class extends be{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.UrlElicitationRequiredError"})}constructor(e,t=`URL elicitation${e.length>1?"s":""} required`){super(ue.UrlElicitationRequired,t,{elicitations:e})}get elicitations(){return this.data?.elicitations??[]}},ns=class extends be{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.UnsupportedProtocolVersionError"})}constructor(e,t=`Unsupported protocol version: ${e.requested}`){super(ue.UnsupportedProtocolVersion,t,e)}get supported(){return this.data.supported}get requested(){return this.data.requested}},Kg=class extends be{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.MissingRequiredClientCapabilityError"})}constructor(e,t=`Missing required client capabilities: ${Object.keys(e.requiredCapabilities).join(", ")}`){super(ue.MissingRequiredClientCapability,t,e)}get requiredCapabilities(){return this.data.requiredCapabilities}},Tz=0,kz="private",Cz=["tools/call","prompts/get","resources/read"];function Oz(e,t){let r=t.resultType;if(r===void 0)return{...t,resultType:"complete"};if(r==="complete"||Cz.includes(e))return t;throw new be(ue.InternalError,`Handler for ${e} returned resultType '${String(r)}', but results of ${e} only support 'complete' on protocol revision 2026-07-28`)}function Iz(e,t){let r=Ez(t);if(t.resultType!=="complete"||!Pz(e))return r===void 0?t:Mz(t);let o=t,n=Vg(o.ttlMs)?o.ttlMs:Az(r),s=Fg(o.cacheScope)?o.cacheScope:jz(r),i={...o,ttlMs:n,cacheScope:s};return delete i[Zl],i}function xz(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function Nz(e,t){if(t===void 0)return e;let r=e._meta;return r===void 0?{...e,_meta:{[_t]:t}}:!xz(r)||r[_t]!==void 0?e:{...e,_meta:{...r,[_t]:t}}}function Az(e){return e!==void 0&&Vg(e.ttlMs)?e.ttlMs:Tz}function jz(e){return e!==void 0&&Fg(e.cacheScope)?e.cacheScope:kz}function Mz(e){let t={...e};return delete t[Zl],t}var qz=["elicitation/create","sampling/createMessage","roots/list"],Qa;function Gg(){if(Qa)return Qa;let e=Qt();return Qa={request:{"elicitation/create":O({method:j("elicitation/create"),params:e.ElicitRequestParamsSchema}),"sampling/createMessage":O({method:j("sampling/createMessage"),params:e.CreateMessageRequestParamsSchema}),"roots/list":O({method:j("roots/list"),params:ae({}).optional()})},response:{"elicitation/create":e.ElicitResultSchema,"sampling/createMessage":e.CreateMessageResultSchema,"roots/list":e.ListRootsResultSchema}},Qa}function Wg(e){return qz.includes(e)}function El(e){return Wg(e)?Gg().request[e]:void 0}function Lz(e){return Wg(e)?Gg().response[e]:void 0}var Vl={"tools/call":null,"tools/list":null,"prompts/get":null,"prompts/list":null,"resources/list":null,"resources/templates/list":null,"resources/read":null,"completion/complete":null,"server/discover":null,"subscriptions/listen":null},Yg={"notifications/cancelled":null,"notifications/progress":null,"notifications/message":null,"notifications/resources/updated":null,"notifications/resources/list_changed":null,"notifications/tools/list_changed":null,"notifications/prompts/list_changed":null,"notifications/subscriptions/acknowledged":null};function Xg(e){return Object.prototype.hasOwnProperty.call(Vl,e)}function Qg(e){return Object.prototype.hasOwnProperty.call(Yg,e)}function Dz(e){return Object.prototype.hasOwnProperty.call(Vl,e)}function Uz(e){return Xg(e)?Qt().dispatchRequestSchemas[e]:void 0}function Zz(e){return Dz(e)?Qt().dispatchResultSchemas[e]:void 0}function Vz(e){return Qg(e)?Qt().notificationSchemas2026[e]:void 0}var aT=Object.keys(Vl),cT=Object.keys(Yg);function es(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function Xn(e,t){if(e===void 0)return{ok:!1,reason:"not-in-era"};let r=e.safeParse(t);return r.success?{ok:!0,value:r.data}:{ok:!1,reason:"invalid",message:String(r.error)}}var Fz={ok:!1,reason:"not-in-era"},Hz=[Ot,yr];function Bz(e,t){let r=t,o=!1,n=()=>(o||(r={...r},o=!0),r),s=t.tools;e==="tools/list"&&Array.isArray(s)&&s.some(c=>es(c)&&"execution"in c)&&(n().tools=s.map(c=>{if(!es(c)||!("execution"in c))return c;let a={...c};return delete a.execution,a}));let i=t.capabilities;if(es(i)&&"tasks"in i){let c={...i};delete c.tasks,n().capabilities=c}return r}var Fl={era:"2026-07-28",hasRequestMethod:Xg,hasNotificationMethod:Qg,hasInputRequestMethod:e=>El(e)!==void 0,validateRequest:(e,t)=>Xn(Uz(e),t),validateResult:(e,t)=>Xn(Zz(e),t),validateNotification:(e,t)=>Xn(Vz(e),t),validateInputRequest:(e,t)=>Xn(El(e),t),validateInputResponse:(e,t)=>Xn(Lz(e),t),samplingResultVariant:()=>Fz,outboundEnvelope(e){return{[Ot]:e.protocolVersion,[Xr]:e.clientInfo,[yr]:e.clientCapabilities,...e.logLevel!==void 0&&{[eo]:e.logLevel}}},validateEnvelopeMeta(e){let t=[];for(let o of Hz)o in e||t.push({key:o,problem:"missing"});let r=Qt().RequestMetaEnvelopeSchema.safeParse(e);if(!r.success)for(let o of r.error.issues){let n=o.path.map(String),s=n.length>0?n.join("."):"_meta";n.length===1&&t.some(i=>i.key===s&&i.problem==="missing")||t.push({key:s,problem:o.message})}return t},projectCallToolResult:e=>Ag(e),inputRequestSchema:El,decodeResult(e,t){if(!es(t))return{kind:"invalid",error:new re(ee.InvalidResult,`Invalid result for ${e}: not an object`,{method:e})};let r=t.resultType;if(r===void 0)return{kind:"invalid",error:new re(ee.InvalidResult,`Invalid result for ${e}: missing required resultType \u2014 servers implementing protocol revision 2026-07-28 MUST include it (the absent-means-complete bridge applies only to earlier-revision servers)`,{method:e,violation:"missing-resultType"})};if(typeof r!="string")return{kind:"invalid",error:new re(ee.InvalidResult,`Invalid result for ${e}: non-string resultType`,{method:e,resultType:r})};if(r==="input_required"){let i=t.inputRequests,c=es(i)?i:{},a=t.requestState,u=t._meta===void 0?void 0:Qt().ResultMetaSchema.safeParse(t._meta),l=u?.success?u.data:void 0;return Object.keys(c).length===0&&typeof a!="string"?{kind:"invalid",error:new re(ee.InvalidResult,`Invalid result for ${e}: input_required carries neither inputRequests nor requestState (every input_required result must include at least one of the two)`,{method:e,violation:"input-required-missing-both"})}:{kind:"input_required",inputRequests:c,...typeof a=="string"&&{requestState:a},...l!==void 0&&{_meta:l}}}if(r!=="complete")return{kind:"invalid",error:new re(ee.UnsupportedResultType,`Unsupported result type '${r}' for ${e}`,{resultType:r,method:e})};let o=Jz(),n=Object.hasOwn(o,e)?o[e]:void 0;if(n!==void 0){let i=n.safeParse(t);if(!i.success)return{kind:"invalid",error:new re(ee.InvalidResult,`Invalid result for ${e}: ${i.error}`,{method:e})}}let s={...t};return delete s.resultType,{kind:"complete",result:s}},encodeResult(e,t,r){return Nz(Iz(e,Oz(e,Bz(e,t))),r)},encodeErrorCode:e=>e===-32002?-32602:e,checkInboundEnvelope(e){if(e.envelope===void 0)return"Request is missing the required _meta envelope for protocol revision 2026-07-28 (io.modelcontextprotocol/protocolVersion, io.modelcontextprotocol/clientCapabilities)";let t=Qt().RequestMetaEnvelopeSchema.safeParse(e.envelope);if(!t.success)return`Invalid _meta envelope for protocol revision 2026-07-28: ${t.error.issues.map(r=>r.message).join("; ")}`}},ec;function Jz(){if(ec)return ec;let e=Qt();return ec={"tools/call":e.CallToolResultSchema,"tools/list":e.ListToolsResultSchema,"prompts/get":e.GetPromptResultSchema,"prompts/list":e.ListPromptsResultSchema,"resources/list":e.ListResourcesResultSchema,"resources/templates/list":e.ListResourceTemplatesResultSchema,"resources/read":e.ReadResourceResultSchema,"completion/complete":e.CompleteResultSchema,"server/discover":e.DiscoverResultSchema},ec}var nc="2026-07-28";function Nt(e){return e!==void 0&&yt(e)?Fl:Ul}function wg(e){return e.revision!==void 0?Nt(e.revision).era:e.era==="modern"?Fl.era:Ul.era}function Tl(e){return e_.some(t=>t.hasRequestMethod(e))}function kl(e){return e_.some(t=>t.hasNotificationMethod(e))}function Rg(e){return e==="tasks/get"||e==="tasks/cancel"}var e_=[Ul,Fl],Kz=Md({AnnotationsSchema:()=>xt,AudioContentSchema:()=>ao,BaseMetadataSchema:()=>Ct,BaseRequestParamsSchema:()=>De,BlobResourceContentsSchema:()=>An,BooleanSchemaSchema:()=>Zn,CallToolRequestParamsSchema:()=>la,CallToolRequestSchema:()=>da,CallToolResultSchema:()=>Ln,CancelTaskRequestSchema:()=>gl,CancelTaskResultSchema:()=>_l,CancelledNotificationParamsSchema:()=>gi,CancelledNotificationSchema:()=>En,ClientCapabilitiesSchema:()=>vi,ClientNotificationSchema:()=>yl,ClientRequestSchema:()=>Sl,ClientResultSchema:()=>vl,ClientTasksCapabilitySchema:()=>Si,CompatibilityCallToolResultSchema:()=>il,CompleteRequestParamsSchema:()=>qa,CompleteRequestSchema:()=>La,CompleteResultSchema:()=>Da,ContentBlockSchema:()=>co,CreateMessageRequestParamsSchema:()=>wa,CreateMessageRequestSchema:()=>Ra,CreateMessageResultSchema:()=>$a,CreateMessageResultWithToolsSchema:()=>Pa,CreateTaskResultSchema:()=>cl,CursorSchema:()=>bn,DiscoverRequestSchema:()=>wi,DiscoverResultSchema:()=>zr,ElicitRequestFormParamsSchema:()=>po,ElicitRequestParamsSchema:()=>Oa,ElicitRequestSchema:()=>Ia,ElicitRequestURLParamsSchema:()=>Ca,ElicitResultSchema:()=>Aa,ElicitationCompleteNotificationParamsSchema:()=>xa,ElicitationCompleteNotificationSchema:()=>Na,EmbeddedResourceSchema:()=>ta,EmptyResultSchema:()=>Pn,EnumSchemaSchema:()=>ka,GetPromptRequestParamsSchema:()=>Xi,GetPromptRequestSchema:()=>Qi,GetPromptResultSchema:()=>na,GetTaskPayloadRequestSchema:()=>pl,GetTaskPayloadResultSchema:()=>ml,GetTaskRequestSchema:()=>ll,GetTaskResultSchema:()=>dl,IconSchema:()=>_i,IconsSchema:()=>Kt,ImageContentSchema:()=>io,ImplementationSchema:()=>oo,InitializeRequestParamsSchema:()=>bi,InitializeRequestSchema:()=>Tn,InitializeResultSchema:()=>zi,InitializedNotificationSchema:()=>Cn,JSONArraySchema:()=>ol,JSONObjectSchema:()=>xe,JSONRPCErrorResponseSchema:()=>ro,JSONRPCMessageSchema:()=>It,JSONRPCNotificationSchema:()=>$n,JSONRPCRequestSchema:()=>Rn,JSONRPCResponseSchema:()=>nl,JSONRPCResultResponseSchema:()=>to,JSONValueSchema:()=>Bt,LegacyTitledEnumSchemaSchema:()=>Hn,ListChangedOptionsBaseSchema:()=>Dn,ListPromptsRequestSchema:()=>Wi,ListPromptsResultSchema:()=>Yi,ListResourceTemplatesRequestSchema:()=>Ci,ListResourceTemplatesResultSchema:()=>Oi,ListResourcesRequestSchema:()=>Ti,ListResourcesResultSchema:()=>ki,ListRootsRequestSchema:()=>Za,ListRootsResultSchema:()=>Va,ListTasksRequestSchema:()=>hl,ListTasksResultSchema:()=>fl,ListToolsRequestSchema:()=>ca,ListToolsResultSchema:()=>ua,LoggingLevelSchema:()=>Un,LoggingMessageNotificationParamsSchema:()=>fa,LoggingMessageNotificationSchema:()=>ga,ModelHintSchema:()=>_a,ModelPreferencesSchema:()=>Sa,MultiSelectEnumSchemaSchema:()=>Ta,NotificationSchema:()=>Be,NotificationsParamsSchema:()=>He,NumberSchemaSchema:()=>lo,PaginatedRequestParamsSchema:()=>Pi,PaginatedRequestSchema:()=>Gt,PaginatedResultSchema:()=>Wt,PingRequestSchema:()=>On,PrimitiveSchemaDefinitionSchema:()=>Kn,ProgressNotificationParamsSchema:()=>$i,ProgressNotificationSchema:()=>In,ProgressSchema:()=>Ri,ProgressTokenSchema:()=>vn,PromptArgumentSchema:()=>Ki,PromptListChangedNotificationSchema:()=>sa,PromptMessageSchema:()=>oa,PromptReferenceSchema:()=>Ma,PromptSchema:()=>Gi,ReadResourceRequestParamsSchema:()=>Ii,ReadResourceRequestSchema:()=>xi,ReadResourceResultSchema:()=>Ni,RelatedTaskMetadataSchema:()=>fi,RequestIdSchema:()=>Jt,RequestMetaSchema:()=>zn,RequestSchema:()=>Ne,ResourceContentsSchema:()=>xn,ResourceLinkSchema:()=>ra,ResourceListChangedNotificationSchema:()=>Ai,ResourceRequestParamsSchema:()=>no,ResourceSchema:()=>jn,ResourceTemplateReferenceSchema:()=>ja,ResourceTemplateSchema:()=>Ei,ResourceUpdatedNotificationParamsSchema:()=>Bi,ResourceUpdatedNotificationSchema:()=>Ji,ResultMetaObjectSchema:()=>wn,ResultSchema:()=>Ae,RoleSchema:()=>Yt,RootSchema:()=>Ua,RootsListChangedNotificationSchema:()=>Fa,SamplingContentSchema:()=>ba,SamplingMessageContentBlockSchema:()=>_r,SamplingMessageSchema:()=>za,ServerCapabilitiesSchema:()=>kn,ServerNotificationSchema:()=>zl,ServerRequestSchema:()=>bl,ServerResultSchema:()=>wl,ServerTasksCapabilitySchema:()=>yi,SetLevelRequestParamsSchema:()=>ma,SetLevelRequestSchema:()=>ha,SingleSelectEnumSchemaSchema:()=>Ea,StringSchemaSchema:()=>uo,SubscribeRequestParamsSchema:()=>ji,SubscribeRequestSchema:()=>Mi,SubscriptionFilterSchema:()=>Mn,SubscriptionsAcknowledgedNotificationParamsSchema:()=>Zi,SubscriptionsAcknowledgedNotificationSchema:()=>Vi,SubscriptionsListenRequestParamsSchema:()=>Di,SubscriptionsListenRequestSchema:()=>Ui,SubscriptionsListenResultMetaSchema:()=>Fi,SubscriptionsListenResultSchema:()=>Hi,TaskAugmentedRequestParamsSchema:()=>br,TaskCreationParamsSchema:()=>al,TaskMetadataSchema:()=>hi,TaskSchema:()=>Xt,TaskStatusNotificationParamsSchema:()=>Ba,TaskStatusNotificationSchema:()=>ul,TaskStatusSchema:()=>Ha,TextContentSchema:()=>so,TextResourceContentsSchema:()=>Nn,TitledMultiSelectEnumSchemaSchema:()=>Jn,TitledSingleSelectEnumSchemaSchema:()=>Fn,ToolAnnotationsSchema:()=>ia,ToolChoiceSchema:()=>ya,ToolExecutionSchema:()=>aa,ToolListChangedNotificationSchema:()=>pa,ToolResultContentSchema:()=>va,ToolSchema:()=>qn,ToolUseContentSchema:()=>ea,UnsubscribeRequestParamsSchema:()=>qi,UnsubscribeRequestSchema:()=>Li,UntitledMultiSelectEnumSchemaSchema:()=>Bn,UntitledSingleSelectEnumSchemaSchema:()=>Vn});var rr=e=>Rn.safeParse(e).success,t_=e=>$n.safeParse(e).success,wr=e=>to.safeParse(e).success,Rr=e=>ro.safeParse(e).success;var r_=e=>typeof e=="object"&&e!==null&&!Array.isArray(e)&&e.resultType==="input_required";var Hl=e=>Tn.safeParse(e).success,o_=e=>Cn.safeParse(e).success;var Gz="Mcp-Param-",$g="x-mcp-header",Wz=/^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/,Yz=new Set(["string","integer","boolean"]);function Bl(e){let t=[],r=new Map,o,n=(i,c,a)=>{if(i===null||typeof i!="object")return;let u=i;if($g in u){if(!a||c.length===0)return`${tc(c)}: x-mcp-header is only permitted on properties statically reachable via a chain of 'properties' keys (not under items, additionalProperties, oneOf/anyOf/allOf/not, if/then/else, or $ref)`;let d=u[$g];if(typeof d!="string"||d.length===0)return`${tc(c)}: x-mcp-header MUST be a non-empty string`;if(!Wz.test(d))return`${tc(c)}: x-mcp-header '${d}' is not a valid RFC 9110 token (no spaces, control characters or HTTP delimiters)`;let h=typeof u.type=="string"?u.type:void 0;if(h===void 0||!Yz.has(h)){let z=`${tc(c)}: x-mcp-header is only permitted on primitive-typed properties (string, integer, boolean); got ${h??"<none>"}`;if(h!=="number")return z;o??=z}let _=d.toLowerCase(),y=r.get(_);if(y!==void 0)return`x-mcp-header '${d}' is not case-insensitively unique (also declared as '${y}')`;r.set(_,d),t.push({path:c,headerName:d,type:h})}let l=u.properties;if(l!==null&&typeof l=="object")for(let[d,h]of Object.entries(l)){let _=n(h,[...c,d],a);if(_!==void 0)return _}for(let d of Xz){let h=u[d];if(h===void 0)continue;let _=Array.isArray(h)?h:h!==null&&typeof h=="object"&&Qz.has(d)?Object.values(h):[h];for(let y of _){let z=n(y,[...c,`<${d}>`],!1);if(z!==void 0)return z}}},s=n(e,[],!0);return s!==void 0?{valid:!1,reason:o??s}:o===void 0?{valid:!0,declarations:t}:{valid:!1,reason:o,declarations:t}}var Xz=["items","prefixItems","contains","additionalProperties","unevaluatedProperties","unevaluatedItems","propertyNames","patternProperties","dependentSchemas","oneOf","anyOf","allOf","not","if","then","else","$defs","definitions"],Qz=new Set(["patternProperties","dependentSchemas","$defs","definitions"]);function tc(e){return e.length===0?"<root>":e.join(".")}var n_="=?base64?",s_="?=";function e0(e){if(typeof e=="string")return e;if(typeof e=="boolean")return e?"true":"false";if(typeof e=="number")return!Number.isFinite(e)||Number.isInteger(e)&&!Number.isSafeInteger(e)?void 0:String(e)}function t0(e){if(e.length===0||e.startsWith(n_)&&e.endsWith(s_)||e!==e.trim())return!0;for(let t=0;t<e.length;t++){let r=e.codePointAt(t);if(!(r===9||r>=32&&r<=126))return!0}return!1}function r0(e){let t=new TextEncoder().encode(e),r="";for(let o of t)r+=String.fromCodePoint(o);return btoa(r)}function Jl(e){return t0(e)?`${n_}${r0(e)}${s_}`:e}function o0(e,t){let r=e;for(let o of t){if(r===null||typeof r!="object")return;r=r[o]}return r}function i_(e,t){let r={};for(let o of e){let n=o0(t,o.path);if(n==null)continue;let s=e0(n);s!==void 0&&(r[`${Gz}${o.headerName}`]=Jl(s))}return r}var go=-32020,uT=[{rung:"http-method",order:1,evaluatedAt:"edge",codes:[-32e3],conformance:[],rationale:"The modern era is POST-only; GET/DELETE are body-less 2025-era session operations and are method-routed to legacy serving (405 when legacy serving is not configured), before any body is read."},{rung:"jsonrpc-shape",order:2,evaluatedAt:"edge",codes:[ue.InvalidRequest],conformance:["server-stateless"],rationale:"The body must be a JSON-RPC request or notification: posted responses and batch arrays containing a modern or invalid element are rejected before classification (element-wise batch rule); all-legacy arrays stay legacy traffic."},{rung:"era-classification",order:3,evaluatedAt:"edge",codes:[go,ue.UnsupportedProtocolVersion],conformance:["server-stateless","http-header-validation","http-custom-header-server-validation"],rationale:"Body-primary era classification with the protocol-version header as a cross-check; a header/body disagreement is rejected with -32020 (HeaderMismatch), and an envelope-less request on a modern-only endpoint is answered with the unsupported-protocol-version error naming the supported revisions."},{rung:"envelope",order:4,evaluatedAt:"edge",codes:[ue.InvalidParams],conformance:["server-stateless"],rationale:"A present envelope claim with a malformed envelope \u2014 and a missing envelope on a request whose protocol-version header names a modern revision \u2014 is an invalid-params rejection naming the offending or missing key(s); never a silent fall back to legacy handling. This is the only place an invalid-params rejection maps to HTTP 400."},{rung:"method-registry",order:5,evaluatedAt:"dispatch",codes:[ue.MethodNotFound],conformance:["server-stateless"],rationale:"Method existence outranks parameter validity: a method absent from the negotiated revision\u2019s registry (or with no handler installed) answers method-not-found before params or capabilities are looked at."},{rung:"request-params",order:6,evaluatedAt:"dispatch",codes:[ue.InvalidParams],conformance:[],rationale:"Per-method params validation; emitted in-band by the dispatch layer (HTTP 200), never via the ladder status table."},{rung:"standard-header-validation",order:7,evaluatedAt:"pre-dispatch",codes:[go],conformance:["http-header-validation"],rationale:"SEP-2243 standard `MCP-Protocol-Version` / `Mcp-Method` / `Mcp-Name` headers \u2014 presence, sentinel decoding, and `Mcp-Name` \u2194 body cross-check \u2014 are validated by the HTTP entry on a modern-classified request after the supported-revision gate and before dispatch. The spec requires `MCP-Protocol-Version` and `Mcp-Method` on every modern *request* POST (`Mcp-Name` only for the methods that mirror `params.name` / `params.uri` / `params.taskId`, see `MCP_NAME_HEADER_SOURCE`) and names them in that order, so a request missing several is answered by the earliest. Notification POSTs are exempt: the presence half runs on requests only, so a modern-enveloped notification is dispatched even with no standard headers at all. The classifier\u2019s own header-mismatch cells (protocol-version, `Mcp-Method` mismatch) stay on the edge `era-classification` rung; this rung carries the entry-layer presence/`Mcp-Name` half \u2014 including the missing `MCP-Protocol-Version` cell, which cannot live on the edge rung without breaking body-primary classification. Evaluated before the capability gate, the factory call, and the `Mcp-Param-*` rung so a request that fails several rungs is answered by the standard-header rung first. The documented order (after method-registry 5 and request-params 6) is NOT the observed precedence: serveModern evaluates this rung immediately after the supported-revision gate, so a request that also fails a dispatch rung is answered here before the dispatch rungs (5\u20136) are consulted."},{rung:"client-capabilities",order:8,evaluatedAt:"pre-dispatch",codes:[ue.MissingRequiredClientCapability],conformance:["server-stateless"],rationale:"The capability requirement is checked by the HTTP entry, pre-dispatch, against the validated envelope the classifier produced \u2014 pinning the spec-mandated HTTP 400 independently of how dispatch- and handler-produced errors are mapped. The documented order (after method resolution and params validation) is preserved observably only while the requirement table is empty: once a served method gains a requirement entry, a request that is missing the capability and would also fail a dispatch rung is answered by this gate first, so the entry must consult the method registry before the gate if the documented precedence is to stay observable."},{rung:"param-header-validation",order:9,evaluatedAt:"pre-dispatch",codes:[go],conformance:["http-custom-header-server-validation"],rationale:"SEP-2243 `Mcp-Param-*` headers are validated against the named tool\u2019s `x-mcp-header` declarations and the body `arguments` after the tool registry is known and before dispatch reaches the handler; a missing/disagreeing/malformed header is rejected 400 / -32020 with the same shape as the standard-header cross-checks. The documented order (after method resolution and params validation) is preserved observably only when the body `arguments` would otherwise validate: the check runs pre-dispatch, so a `tools/call` that fails BOTH this rung and a dispatch-time rung (e.g. order-6 `request-params`, -32602) is answered by this gate first with 400 / -32020, not by the earlier-ordered rung."}],lT={[ue.ParseError]:400,[ue.InvalidRequest]:400,[ue.MethodNotFound]:404,[ue.UnsupportedProtocolVersion]:400,[ue.MissingRequiredClientCapability]:400,[go]:400},Pg={"tools/call":"name","prompts/get":"name","resources/read":"uri","tasks/get":"taskId","tasks/update":"taskId","tasks/cancel":"taskId"};function a_(e,t){let r=Object.hasOwn(Pg,e)?Pg[e]:void 0;if(r===void 0)return;let o=n0(t)?t[r]:void 0;return{field:r,value:typeof o=="string"?o:void 0}}function n0(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function sc(e,t){return ii(e,t)}function Qn(e){return new Set(e.flatMap(t=>Object.keys(t.shape)))}function xl(e){if(e==null)return!1;let t=typeof e;return t!=="object"&&t!=="function"||!("~standard"in e)?!1:typeof e["~standard"]?.validate=="function"}var Eg=!1,Nl="draft-2020-12";function s0(e,t="input"){let r=e["~standard"],o;if(r.jsonSchema)o=r.jsonSchema[t]({target:Nl});else if(r.vendor==="zod"){if(!("_zod"in e))throw new Error("Schema appears to be from zod 3, which the SDK cannot convert to JSON Schema. Upgrade to zod >=4.2.0, or wrap your JSON Schema with fromJsonSchema().");Eg||(Eg=!0,console.warn("[mcp-sdk] Your zod version does not implement `~standard.jsonSchema` (added in zod 4.2.0). Falling back to z.toJSONSchema(). Upgrade to zod >=4.2.0 to silence this warning.")),o=ni(e,{target:Nl,io:t})}else throw new Error(`Schema library "${r.vendor}" does not implement StandardJSONSchemaV1 (\`~standard.jsonSchema\`). Upgrade to a version that does, or wrap your JSON Schema with fromJsonSchema().`);if(t==="output")return o.type!==void 0?o:c_(o)?{type:"object",...o}:o;if(o.type!==void 0&&o.type!=="object")throw new Error(`MCP tool and prompt schemas must describe objects (got type: ${JSON.stringify(o.type)}). Wrap your schema in z.object({...}) or equivalent.`);return{type:"object",...o}}var i0=/^#\/(\$defs|definitions)\/([^/~%]+)$/;function c_(e,t=e){if("properties"in e||"patternProperties"in e||"additionalProperties"in e||"required"in e)return!0;let r=typeof e.$ref=="string"&&i0.exec(e.$ref);if(r&&t[r[1]]?.[r[2]]?.type==="object")return!0;for(let o of["oneOf","anyOf","allOf"]){let n=e[o];if(Array.isArray(n)&&n.length>0)return n.every(s=>s!==null&&typeof s=="object"&&(s.type==="object"||c_(s,"$id"in s?{}:t)))}return!1}function a0(e){return e.path?.length?`${e.path.map(t=>String(typeof t=="object"?t.key:t)).join(".")}: ${e.message}`:e.message}async function Cl(e,t){let r=await e["~standard"].validate(t);return r.issues&&r.issues.length>0?{success:!1,error:r.issues.map(o=>a0(o)).join(", ")}:{success:!0,data:r.value}}function c0(e){let t=ni(e,{target:Nl,io:"input"});return typeof t.pattern=="string"?t.pattern:void 0}var u0=/\\\.\\d\{(\d+)\}/;function l0(e){let t=u0.exec(e),r=[void 0,-1,0];return t&&r.push(Number(t[1])),[!1,!0].flatMap(o=>[!1,!0].flatMap(n=>r.map(s=>kt.datetime({local:o,offset:n,precision:s}))))}function d0(e,t){let r;switch(e){case"email":r=[Wf()];break;case"uri":r=[ui()];break;case"date":r=[kt.date()];break;case"date-time":r=l0(t);break}return new Set(r.map(o=>c0(o)).filter(o=>o!==void 0))}function p0(e,t,r){return r!=="zod"?!0:d0(e,t).has(t)}function rs(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function m0(e){try{return s0(e,"input")}catch(t){let r=t instanceof Error?t.message:String(t);throw new be(ue.InvalidParams,`Elicitation requestedSchema must describe an object with flat primitive properties: ${r}`)}}var h0=new Set(["$comment","deprecated","description","examples","readOnly","title","writeOnly"]);function Kl(e){return h0.has(e)||e.startsWith("x-")}var f0=new Set(["$schema",...Object.keys(po.shape.requestedSchema.shape)]),Tg={string:Qn([uo,Vn,Fn,Hn]),number:Qn([lo]),integer:Qn([lo]),boolean:Qn([Zn]),array:Qn([Bn,Jn])},g0=new Set(uo.shape.format.unwrap().options);function _0(e,t,r,o){if(!rs(e))return e;let n=typeof e.type=="string"&&Object.hasOwn(Tg,e.type)?Tg[e.type]:void 0;if(n===void 0)return e;let s={};for(let[i,c]of Object.entries(e))n.has(i)||Kl(i)?s[i]=c:i==="pattern"&&e.type==="string"&&typeof e.format=="string"?g0.has(e.format)?(typeof c!="string"||!p0(e.format,c,r))&&o.push(`${t}.${i}`):s[i]=c:o.push(`${t}.${i}`);return s}function S0(e,t){let r={},o=[];for(let[n,s]of Object.entries(e))n==="properties"&&rs(s)?r[n]=Object.fromEntries(Object.entries(s).map(([i,c])=>[i,_0(c,`properties.${i}`,t,o)])):f0.has(n)?r[n]=s:Kl(n)||o.push(n);if(o.length>0)throw new be(ue.InvalidParams,`Elicitation requestedSchema contains unsupported JSON Schema constraint(s) after Standard Schema conversion: ${o.join(", ")}`);return r}function y0(e,t){if(!rs(e.properties))return t;let r=Object.entries(e.properties).filter(([,o])=>!sc(Kn,o).success).map(([o])=>`properties.${o}`);return r.length>0?r.join(", "):t}function Al(e,t,r=""){return Array.isArray(e)&&Array.isArray(t)?e.flatMap((o,n)=>Al(o,t[n],`${r}[${n}]`)):!rs(e)||!rs(t)?[]:Object.entries(e).flatMap(([o,n])=>{let s=r?`${r}.${o}`:o;return Object.prototype.hasOwnProperty.call(t,o)?Al(n,t[o],s):Kl(o)?[]:[s]})}function v0(e){if(!xl(e.requestedSchema))return{...e,mode:"form",requestedSchema:e.requestedSchema};let t=e.requestedSchema["~standard"].vendor,r=S0(m0(e.requestedSchema),t),o=sc(po.shape.requestedSchema,r);if(!o.success)throw new be(ue.InvalidParams,`Elicitation requestedSchema only supports flat primitive properties (string, number, integer, boolean, and string enums): ${y0(r,o.error.message)}`);let n=Al(r,o.data);if(n.length>0)throw new be(ue.InvalidParams,`Elicitation requestedSchema contains unsupported JSON Schema constraint(s) after Standard Schema conversion: ${n.join(", ")}`);let s=(o.data.required??[]).filter(i=>!Object.prototype.hasOwnProperty.call(o.data.properties,i));if(s.length>0)throw new be(ue.InvalidParams,`Elicitation requestedSchema lists required properties that are not defined in properties: ${s.join(", ")}`);return{...e,mode:"form",requestedSchema:o.data}}function b0(e){let t=e.inputRequests!==void 0&&Object.keys(e.inputRequests).length>0,r=typeof e.requestState=="string";if(!t&&!r)throw new TypeError("inputRequired() requires at least one of inputRequests (with at least one entry) or requestState (spec: every InputRequiredResult MUST include at least one of the two)");return{resultType:"input_required",...e.inputRequests!==void 0&&{inputRequests:e.inputRequests},...e.requestState!==void 0&&{requestState:e.requestState}}}var dT=Object.assign(b0,{elicit(e){try{return{method:"elicitation/create",params:v0(e)}}catch(t){throw t instanceof be?new TypeError(t.message,{cause:t}):t}},elicitUrl(e){return{method:"elicitation/create",params:{...e,mode:"url"}}},createMessage(e){return{method:"sampling/createMessage",params:e}},listRoots(){return{method:"roots/list"}}});var z0=!0,w0=10,R0=250;function u_(e){return{autoFulfill:e?.autoFulfill??z0,maxRounds:e?.maxRounds??w0}}function $0(e,t,r){let o=t!==void 0&&Object.keys(t).length>0;return!o&&r===void 0?e:{...e,...o&&{inputResponses:t},...r!==void 0&&{requestState:r}}}function P0(e,t){return`Multi-round-trip request '${e}' still required input after ${t} rounds (inputRequired.maxRounds)`}function E0(e,t){return new Promise((r,o)=>{if(t?.aborted){o(t.reason instanceof re?t.reason:new re(ee.RequestTimeout,String(t.reason)));return}let n=setTimeout(()=>{t?.removeEventListener("abort",s),r()},e),s=()=>{clearTimeout(n),o(t?.reason instanceof re?t.reason:new re(ee.RequestTimeout,String(t?.reason)))};t?.addEventListener("abort",s,{once:!0})})}function T0(e){let t=new AbortController,r=()=>t.abort(e?.reason);return e?.addEventListener("abort",r,{once:!0}),e?.aborted&&t.abort(e.reason),{signal:t.signal,abort:o=>t.abort(o),dispose:()=>e?.removeEventListener("abort",r)}}async function k0(e){let{config:t,method:r,originalParams:o,requestOptions:n,hooks:s,signal:i}=e,c=e.flowStartedAt??Date.now(),a=e.firstPayload,u=0;for(;;){if(u+=1,u>t.maxRounds)throw new re(ee.InputRequiredRoundsExceeded,P0(r,t.maxRounds),{rounds:t.maxRounds,lastResult:{inputRequests:a.inputRequests,...a.requestState!==void 0&&{requestState:a.requestState}}});n.onprogress?.({progress:u,message:`Fulfilling input required by '${r}' (round ${u})`});let l=Object.entries(a.inputRequests??{}),d;if(l.length>0){let y=T0(i);try{let z=await Promise.all(l.map(async([b,g])=>{try{return[b,await s.dispatchInputRequest(b,g,y.signal)]}catch(P){throw y.abort(P),P}}));d=Object.fromEntries(z)}finally{y.dispose()}}else await E0(R0,i);let h={...n.timeout!==void 0&&{timeout:n.timeout}};if(n.maxTotalTimeout!==void 0){let y=Date.now()-c,z=n.maxTotalTimeout-y;if(z<=0)throw new re(ee.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:n.maxTotalTimeout,totalElapsed:y});h.maxTotalTimeout=z}let _=await s.retry($0(o,d,a.requestState),h);if(r_(_)){a={inputRequests:_.inputRequests??{},..._.requestState!==void 0&&{requestState:_.requestState}};continue}return _}}var C0=["AnnotationsSchema","AudioContentSchema","BaseMetadataSchema","BlobResourceContentsSchema","BooleanSchemaSchema","CallToolRequestSchema","CallToolRequestParamsSchema","CallToolResultSchema","CancelledNotificationSchema","CancelledNotificationParamsSchema","CancelTaskRequestSchema","CancelTaskResultSchema","ClientCapabilitiesSchema","ClientNotificationSchema","ClientRequestSchema","ClientResultSchema","CompatibilityCallToolResultSchema","CompleteRequestSchema","CompleteRequestParamsSchema","CompleteResultSchema","ContentBlockSchema","CreateMessageRequestSchema","CreateMessageRequestParamsSchema","CreateMessageResultSchema","CreateMessageResultWithToolsSchema","CreateTaskResultSchema","CursorSchema","DiscoverRequestSchema","DiscoverResultSchema","ElicitationCompleteNotificationSchema","ElicitationCompleteNotificationParamsSchema","ElicitRequestSchema","ElicitRequestFormParamsSchema","ElicitRequestParamsSchema","ElicitRequestURLParamsSchema","ElicitResultSchema","EmbeddedResourceSchema","EmptyResultSchema","EnumSchemaSchema","GetPromptRequestSchema","GetPromptRequestParamsSchema","GetPromptResultSchema","GetTaskPayloadRequestSchema","GetTaskPayloadResultSchema","GetTaskRequestSchema","GetTaskResultSchema","IconSchema","IconsSchema","ImageContentSchema","ImplementationSchema","InitializedNotificationSchema","InitializeRequestSchema","InitializeRequestParamsSchema","InitializeResultSchema","JSONArraySchema","JSONObjectSchema","JSONRPCErrorResponseSchema","JSONRPCMessageSchema","JSONRPCNotificationSchema","JSONRPCRequestSchema","JSONRPCResponseSchema","JSONRPCResultResponseSchema","JSONValueSchema","LegacyTitledEnumSchemaSchema","ListPromptsRequestSchema","ListPromptsResultSchema","ListResourcesRequestSchema","ListResourcesResultSchema","ListResourceTemplatesRequestSchema","ListResourceTemplatesResultSchema","ListRootsRequestSchema","ListRootsResultSchema","ListTasksRequestSchema","ListTasksResultSchema","ListToolsRequestSchema","ListToolsResultSchema","LoggingLevelSchema","LoggingMessageNotificationSchema","LoggingMessageNotificationParamsSchema","ModelHintSchema","ModelPreferencesSchema","MultiSelectEnumSchemaSchema","NotificationSchema","NumberSchemaSchema","PaginatedRequestSchema","PaginatedRequestParamsSchema","PaginatedResultSchema","PingRequestSchema","PrimitiveSchemaDefinitionSchema","ProgressSchema","ProgressNotificationSchema","ProgressNotificationParamsSchema","ProgressTokenSchema","PromptSchema","PromptArgumentSchema","PromptListChangedNotificationSchema","PromptMessageSchema","PromptReferenceSchema","ReadResourceRequestSchema","ReadResourceRequestParamsSchema","ReadResourceResultSchema","RelatedTaskMetadataSchema","RequestSchema","RequestIdSchema","RequestMetaSchema","ResourceSchema","ResourceContentsSchema","ResourceLinkSchema","ResourceListChangedNotificationSchema","ResourceRequestParamsSchema","ResourceTemplateSchema","ResourceTemplateReferenceSchema","ResourceUpdatedNotificationSchema","ResourceUpdatedNotificationParamsSchema","ResultMetaObjectSchema","ResultSchema","RoleSchema","RootSchema","RootsListChangedNotificationSchema","SamplingContentSchema","SamplingMessageSchema","SamplingMessageContentBlockSchema","ServerCapabilitiesSchema","ServerNotificationSchema","ServerRequestSchema","ServerResultSchema","SetLevelRequestSchema","SetLevelRequestParamsSchema","SingleSelectEnumSchemaSchema","StringSchemaSchema","SubscribeRequestSchema","SubscribeRequestParamsSchema","SubscriptionFilterSchema","SubscriptionsAcknowledgedNotificationSchema","SubscriptionsAcknowledgedNotificationParamsSchema","SubscriptionsListenRequestSchema","SubscriptionsListenRequestParamsSchema","SubscriptionsListenResultSchema","SubscriptionsListenResultMetaSchema","TaskAugmentedRequestParamsSchema","TaskCreationParamsSchema","TaskMetadataSchema","TaskSchema","TaskStatusSchema","TaskStatusNotificationSchema","TaskStatusNotificationParamsSchema","TextContentSchema","TextResourceContentsSchema","TitledMultiSelectEnumSchemaSchema","TitledSingleSelectEnumSchemaSchema","ToolSchema","ToolAnnotationsSchema","ToolChoiceSchema","ToolExecutionSchema","ToolListChangedNotificationSchema","ToolResultContentSchema","ToolUseContentSchema","UnsubscribeRequestSchema","UnsubscribeRequestParamsSchema","UntitledMultiSelectEnumSchemaSchema","UntitledSingleSelectEnumSchemaSchema"],O0={IdJagTokenExchangeResponseSchema:Ka,OAuthClientInformationFullSchema:Yn,OAuthClientInformationSchema:Wa,OAuthClientMetadataSchema:Ga,OAuthClientRegistrationErrorSchema:$l,OAuthErrorResponseSchema:fo,OAuthMetadataSchema:mo,OAuthProtectedResourceMetadataSchema:Gn,OAuthTokenRevocationRequestSchema:Pl,OAuthTokensSchema:ho,OpenIdProviderDiscoveryMetadataSchema:Wn,OpenIdProviderMetadataSchema:Ja},l_={},d_={};function p_(e,t){let r=e.slice(0,-6);l_[r]=t,d_[r]=o=>t.safeParse(o).success}for(let e of C0)p_(e,Kz[e]);for(let[e,t]of Object.entries(O0))p_(e,t);var I0=Object.freeze(l_),Gl=Object.freeze(d_);function x0(e){switch(e){case"initialize":case"notifications/initialized":return Nt(void 0);case"server/discover":return Nt(nc);default:return}}var ss=6e4,N0=[Ot,Xr,yr,eo],A0=["inputResponses","requestState"];function kg(e,t){let r=e.params;if(!ts(r))return{message:e,lifted:{}};let o=r._meta,n=ts(o)?N0.filter(a=>a in o):[],s=t==="request"?A0.filter(a=>a in r):[];if(n.length===0&&s.length===0)return{message:e,lifted:{}};let i={},c={...r};if(n.length>0&&ts(o)){let a={},u={...o};for(let l of n)a[l]=o[l],delete u[l];i.envelope=a,Object.keys(u).length>0?c._meta=u:delete c._meta}for(let a of s)a==="inputResponses"&&(i.inputResponses=c[a]),a==="requestState"&&(i.requestState=c[a]),delete c[a];return{message:{...e,params:c},lifted:i}}function Cg(e,t){let r=e.validateResult(t,void 0);if(!(!r.ok&&r.reason==="not-in-era"))return{"~standard":{version:1,vendor:"mcp-wire-codec",validate(o){let n=e.validateResult(t,o);return n.ok?{value:n.value}:{issues:[{message:n.reason==="invalid"?n.message:`not-in-era: ${t}`}]}}}}}function Wl(e){return()=>e}var j0=Wl(void 0),M0,Yl=class{_transport;_requestMessageId=0;_requestHandlers=new Map;_customSchemaRequestMethods=new Set;_requestHandlerAbortControllers=new Map;_notificationHandlers=new Map;_responseHandlers=new Map;_progressHandlers=new Map;_timeoutInfo=new Map;_pendingDebouncedNotifications=new Set;_negotiatedProtocolVersion;static{M0=(e,t)=>{e._negotiatedProtocolVersion=t}}_supportedProtocolVersions;onclose;onerror;fallbackRequestHandler;fallbackNotificationHandler;constructor(e){this._options=e,this._supportedProtocolVersions=e?.supportedProtocolVersions??pi,this.setNotificationHandler("notifications/cancelled",t=>{this._oncancel(t)}),this.setNotificationHandler("notifications/progress",t=>{this._onprogress(t)}),this.setRequestHandler("ping",t=>({}))}_shouldDropInbound(e){}_outboundMetaEnvelope(){}_envelopeOutbound(e){let t=this._outboundMetaEnvelope();if(t===void 0)return e;let r=e.params??{};return{...e,params:{...r,_meta:{...t,...r._meta}}}}_resolveNonCompleteResult(e,t){return Promise.reject(new re(ee.UnsupportedResultType,`Unsupported result type '${e.kind}' for ${t.request.method}`,{resultType:e.kind,method:t.request.method}))}_getRequestHandler(e){return this._requestHandlers.get(e)}async _oncancel(e){e.params.requestId!==void 0&&this._requestHandlerAbortControllers.get(e.params.requestId)?.abort(e.params.reason)}_setupTimeout(e,t,r,o,n=!1){this._timeoutInfo.set(e,{timeoutId:setTimeout(o,t),startTime:Date.now(),timeout:t,maxTotalTimeout:r,resetTimeoutOnProgress:n,onTimeout:o})}_resetTimeout(e){let t=this._timeoutInfo.get(e);if(!t)return!1;let r=Date.now()-t.startTime;if(t.maxTotalTimeout&&r>=t.maxTotalTimeout)throw this._timeoutInfo.delete(e),new re(ee.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:t.maxTotalTimeout,totalElapsed:r});return clearTimeout(t.timeoutId),t.timeoutId=setTimeout(t.onTimeout,t.timeout),!0}_cleanupTimeout(e){let t=this._timeoutInfo.get(e);t&&(clearTimeout(t.timeoutId),this._timeoutInfo.delete(e))}async connect(e){this._transport=e;let t=this.transport?.onclose;this._transport.onclose=()=>{try{t?.()}finally{this._onclose()}};let r=this.transport?.onerror;this._transport.onerror=n=>{r?.(n),this._onerror(n)};let o=this._transport?.onmessage;this._transport.onmessage=(n,s)=>{o?.(n,s),wr(n)||Rr(n)?this._onresponse(n):rr(n)?this._onrequest(n,s):t_(n)?this._onnotification(n,s):this._onerror(new Error(`Unknown message type: ${JSON.stringify(n)}`))},e.setSupportedProtocolVersions?.(this._supportedProtocolVersions),await this._transport.start()}_onclose(){let e=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._pendingDebouncedNotifications.clear();for(let o of this._timeoutInfo.values())clearTimeout(o.timeoutId);this._timeoutInfo.clear();let t=this._requestHandlerAbortControllers;this._requestHandlerAbortControllers=new Map;let r=new re(ee.ConnectionClosed,"Connection closed");this._transport=void 0;try{this.onclose?.()}finally{for(let o of e.values())o(r);for(let o of t.values())o.abort(r)}}_onerror(e){this.onerror?.(e)}_onnotification(e,t){let{message:r}=kg(e,"notification"),o=this._negotiatedWireCodec();if(t?.classification===void 0&&this._shouldDropInbound(e)==="drop")return;if(t?.classification!==void 0){let i=wg(t.classification);if(i!==o.era){this._onerror(new Error(`Era mismatch on inbound notification '${r.method}': classified as ${i} but this instance serves ${o.era}`));return}}if(kl(r.method)&&!o.hasNotificationMethod(r.method))return;let n=this._notificationHandlers.get(r.method),s=this.fallbackNotificationHandler;n===void 0&&s===void 0||Promise.resolve().then(()=>n===void 0?s(r):n(r,o)).catch(i=>this._onerror(new Error(`Uncaught error in notification handler: ${i}`)))}_onrequest(e,t){let{message:r,lifted:o}=kg(e,"request"),n=this._negotiatedWireCodec();if(t?.classification===void 0&&this._shouldDropInbound(e)==="drop"){this._onerror(new Error(`Dropped inbound request '${e.method}': not servable on this connection's protocol era`));return}let s=this._transport,i=(z,b,g)=>{let P={jsonrpc:"2.0",id:r.id,error:{code:z,message:b,...g!==void 0&&{data:g}}};s?.send(P).catch($=>this._onerror(new Error(`Failed to send an error response: ${$}`)))};if(t?.classification!==void 0){let z=wg(t.classification);if(z!==n.era){this._onerror(new Error(`Era mismatch on inbound request '${r.method}': classified as ${z} but this instance serves ${n.era}`));let b=t.classification.revision??z;i(ue.UnsupportedProtocolVersion,`Unsupported protocol version: ${b}`,{supported:this._supportedProtocolVersions,requested:b});return}}if(Tl(r.method)&&!n.hasRequestMethod(r.method)&&!(Rg(r.method)&&this._customSchemaRequestMethods.has(r.method))){i(ue.MethodNotFound,"Method not found");return}let c=this._requestHandlers.get(r.method)??this.fallbackRequestHandler;if(c===void 0){i(ue.MethodNotFound,"Method not found");return}let a=n.checkInboundEnvelope(o);if(a!==void 0){i(ue.InvalidParams,a);return}let u=(z,b)=>this._notificationViaCodec(this._resolveOutboundCodec(z.method),z,{...b,relatedRequestId:r.id}),l=(z,b,g)=>this._requestWithSchemaViaCodec(this._resolveOutboundCodec(z.method),z,b,{...g,relatedRequestId:r.id}),d=new AbortController;this._requestHandlerAbortControllers.set(r.id,d);let h=o.inputResponses===void 0?void 0:q0(o.inputResponses),_={sessionId:s?.sessionId,mcpReq:{id:r.id,method:r.method,_meta:r.params?._meta,...o.envelope!==void 0&&{envelope:o.envelope},...h!==void 0&&{inputResponses:h.accepted},...h!==void 0&&h.droppedKeys.length>0&&{droppedInputResponseKeys:h.droppedKeys},requestState:o.requestState===void 0?j0:Wl(o.requestState),signal:d.signal,send:((z,b,g)=>{let P=this._resolveOutboundCodec(z.method);if(this._assertOutboundRequestInEra(P,z.method),xl(b))return l(z,b,g);let $=Cg(P,z.method);if($===void 0)throw new TypeError(`'${z.method}' is not a spec method; pass a result schema as the second argument to ctx.mcpReq.send().`);return l(z,$,b)}),notify:u},http:t?.authInfo?{authInfo:t.authInfo}:void 0},y=this.buildContext(_,t);Promise.resolve().then(()=>c(r,y)).then(async z=>{if(d.signal.aborted)return;let b;try{b=n.encodeResult(r.method,z,this._outboundServerInfo())}catch(P){this._onerror(new Error(`Failed to encode result for ${r.method}: ${P}`)),i(ue.InternalError,"Internal error");return}let g={result:b,jsonrpc:"2.0",id:r.id};await s?.send(g)},async z=>{if(d.signal.aborted)return;let b=Number.isSafeInteger(z.code)?z.code:ue.InternalError,g={jsonrpc:"2.0",id:r.id,error:{code:n.encodeErrorCode(b),message:z.message??"Internal error",...z.data!==void 0&&{data:z.data}}};await s?.send(g)}).catch(z=>this._onerror(new Error(`Failed to send response: ${z}`))).finally(()=>{this._requestHandlerAbortControllers.get(r.id)===d&&this._requestHandlerAbortControllers.delete(r.id)})}_onprogress(e){let{progressToken:t,...r}=e.params,o=Number(t),n=this._progressHandlers.get(o);if(!n){this._onerror(new Error(`Received a progress notification for an unknown token: ${JSON.stringify(e)}`));return}let s=this._responseHandlers.get(o),i=this._timeoutInfo.get(o);if(i&&s&&i.resetTimeoutOnProgress)try{this._resetTimeout(o)}catch(c){this._responseHandlers.delete(o),this._progressHandlers.delete(o),this._cleanupTimeout(o),s(c);return}n(r)}_onresponse(e){let t=Number(e.id),r=this._responseHandlers.get(t);if(r===void 0){this._onerror(new Error(`Received a response for an unknown message ID: ${JSON.stringify(e)}`));return}this._responseHandlers.delete(t),this._cleanupTimeout(t),this._progressHandlers.delete(t),wr(e)?r(e):r(be.fromError(e.error.code,e.error.message,e.error.data))}get transport(){return this._transport}async close(){await this._transport?.close()}request(e,t,r){let o=this._resolveOutboundCodec(e.method);if(xl(t))return Rg(e.method)||this._assertOutboundRequestInEra(o,e.method),this._requestWithSchemaViaCodec(o,e,t,r);this._assertOutboundRequestInEra(o,e.method);let n=Cg(o,e.method);if(n===void 0)throw new TypeError(`'${e.method}' is not a spec method; pass a result schema as the second argument to request().`);return this._requestWithSchemaViaCodec(o,e,n,t)}_negotiatedWireCodec(){return Nt(this._negotiatedProtocolVersion)}_wireCodec(){return this._negotiatedWireCodec()}_resolveOutboundCodec(e){if(this._negotiatedProtocolVersion===void 0){let t=x0(e);if(t)return t}return this._negotiatedWireCodec()}_assertOutboundRequestInEra(e,t){if(Tl(t)&&!e.hasRequestMethod(t))throw new re(ee.MethodNotSupportedByProtocolVersion,`Method '${t}' is not supported by the negotiated protocol version (wire era ${e.era})`,{method:t,era:e.era})}_requestWithSchema(e,t,r){let o=this._resolveOutboundCodec(e.method);return this._assertOutboundRequestInEra(o,e.method),this._requestWithSchemaViaCodec(o,e,t,r)}_requestWithSchemaViaCodec(e,t,r,o){let{relatedRequestId:n,resumptionToken:s,onresumptiontoken:i,headers:c}=o??{},a=Date.now(),u,l;return new Promise((d,h)=>{let _=v=>{h(v)};if(!this._transport){_(new Error("Not connected"));return}if(this._options?.enforceStrictCapabilities===!0)try{this.assertCapabilityForMethod(t.method)}catch(v){_(v);return}if(o?.signal?.aborted){let v=o.signal.reason;throw v instanceof re?v:new re(ee.RequestTimeout,String(v))}let y=e.era===nc&&this._transport.hasPerRequestStream===!0?new AbortController:void 0,z=this._requestMessageId++;l=z;let b={...t,jsonrpc:"2.0",id:z};o?.onprogress&&(this._progressHandlers.set(z,o.onprogress),b.params={...t.params,_meta:{...t.params?._meta,progressToken:z}});let g=this._envelopeOutbound(b),P=!1,$=v=>{P||(this._progressHandlers.delete(z),y===void 0?t.method!=="initialize"&&this._transport?.send(this._envelopeOutbound({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:z,reason:String(v)}}),{relatedRequestId:n,resumptionToken:s,onresumptiontoken:i}).catch(S=>this._onerror(new Error(`Failed to send cancellation: ${S}`))):y.abort(),h(v instanceof re?v:new re(ee.RequestTimeout,String(v))))};this._responseHandlers.set(z,v=>{if(o?.signal?.aborted)return;if(P=!0,v instanceof Error)return h(v);let S;try{S=e.decodeResult(t.method,v.result)}catch(A){return h(A instanceof Error?A:new Error(String(A)))}if(S.kind==="invalid")return h(S.error);if(S.kind==="input_required"){if(o?.allowInputRequired===!0)return d(Z0(S));let A={codec:e,request:t,resultSchema:r,options:o,flowStartedAt:a,retry:(F,L)=>this._requestWithSchemaViaCodec(e,F===void 0?{method:t.method}:{method:t.method,params:F},r,L)};return d(this._resolveNonCompleteResult(S,A))}let T=S.result;Cl(r,T).then(A=>{A.success?d(A.data):h(new re(ee.InvalidResult,`Invalid result for ${t.method}: ${A.error}`))},h)}),u=()=>$(o?.signal?.reason),o?.signal?.addEventListener("abort",u,{once:!0});let E=o?.timeout??ss,k=()=>$(new re(ee.RequestTimeout,"Request timed out",{timeout:E}));this._setupTimeout(z,E,o?.maxTotalTimeout,k,o?.resetTimeoutOnProgress??!1),this._transport.send(g,{relatedRequestId:n,resumptionToken:s,onresumptiontoken:i,headers:c,requestSignal:y?.signal}).catch(v=>{this._progressHandlers.delete(z),h(v)})}).finally(()=>{u&&o?.signal?.removeEventListener("abort",u),l!==void 0&&(this._responseHandlers.delete(l),this._cleanupTimeout(l))})}async notification(e,t){return await this._notificationViaCodec(this._resolveOutboundCodec(e.method),e,t)}async _notificationViaCodec(e,t,r){if(!this._transport)throw new re(ee.NotConnected,"Not connected");if(kl(t.method)&&!e.hasNotificationMethod(t.method))throw new re(ee.MethodNotSupportedByProtocolVersion,`Notification '${t.method}' is not supported by the negotiated protocol version (wire era ${e.era})`,{method:t.method,era:e.era});this.assertNotificationCapability(t.method);let o=this._envelopeOutbound({jsonrpc:"2.0",...t});if((this._options?.debouncedNotificationMethods??[]).includes(t.method)&&!t.params&&r?.relatedRequestId===void 0){if(this._pendingDebouncedNotifications.has(t.method))return;this._pendingDebouncedNotifications.add(t.method),Promise.resolve().then(()=>{this._pendingDebouncedNotifications.delete(t.method),this._transport&&this._transport?.send(o,r).catch(n=>this._onerror(n))});return}await this._transport.send(o,r)}setRequestHandler(e,t,r){this.assertRequestHandlerCapability(e);let o;if(typeof t=="function"){if(!Tl(e))throw new TypeError(`'${e}' is not a spec request method; pass schemas as the second argument to setRequestHandler().`);o=(n,s)=>{let i=this._negotiatedWireCodec(),c=i.validateRequest(e,n);if(!c.ok&&c.reason==="not-in-era"&&(c=i.validateInputRequest(e,n)),!c.ok)throw c.reason==="not-in-era"?new be(ue.InternalError,`No wire schema for ${e} in the resolved era`):new Error(c.message);return Promise.resolve(t(c.value,s))}}else if(r)o=async(n,s)=>{let i=await Cl(t.params,{...n.params});if(!i.success)throw new be(ue.InvalidParams,`Invalid params for ${e}: ${i.error}`);return r(i.data,s)};else throw new TypeError("setRequestHandler: handler is required");typeof t=="function"?this._customSchemaRequestMethods.delete(e):this._customSchemaRequestMethods.add(e),this._requestHandlers.set(e,this._wrapHandler(e,o))}_wrapHandler(e,t){return t}_outboundServerInfo(){}removeRequestHandler(e){this._requestHandlers.delete(e),this._customSchemaRequestMethods.delete(e)}assertCanSetRequestHandler(e){if(this._requestHandlers.has(e))throw new Error(`A request handler for ${e} already exists, which would be overridden`)}setNotificationHandler(e,t,r){if(typeof t=="function"){if(!kl(e))throw new TypeError(`'${e}' is not a spec notification method; pass schemas as the second argument to setNotificationHandler().`);this._notificationHandlers.set(e,(o,n)=>{let s=n.validateNotification(e,o);if(!s.ok)throw s.reason==="not-in-era"?new be(ue.InternalError,`No wire schema for ${e} in the resolved era`):new Error(s.message);return Promise.resolve(t(s.value))});return}if(!r)throw new TypeError("setNotificationHandler: handler is required");this._notificationHandlers.set(e,async o=>{let n=await Cl(t.params,{...o.params});if(!n.success)throw new be(ue.InvalidParams,`Invalid params for notification ${e}: ${n.error}`);await r(n.data,o)})}removeNotificationHandler(e){this._notificationHandlers.delete(e)}};function ts(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function Xl(e,t){let r={...e};for(let o in t){let n=o,s=t[n];if(s===void 0)continue;let i=r[n];r[n]=ts(i)&&ts(s)?{...i,...s}:s}return r}function rc(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function q0(e){let t={},r=[];if(!rc(e))return{accepted:t,droppedKeys:r};for(let[o,n]of Object.entries(e)){if(!rc(n)||"method"in n||"result"in n){r.push(o);continue}t[o]=n}return{accepted:t,droppedKeys:r}}function Og(e){throw new re(ee.SendFailed,`ctx.mcpReq.${e} is not available while fulfilling an embedded input request: the request is fulfilled locally and has no related peer request`)}function L0(e,t,r,o,n){return{sessionId:n,mcpReq:{id:e,method:t,_meta:r?._meta,requestState:Wl(void 0),signal:o,send:(()=>Og("send")),notify:()=>Og("notify")}}}async function D0(e,t,r,o,n){if(!rc(o)||typeof o.method!="string")throw new re(ee.InvalidResult,`Invalid input request '${r}': each inputRequests entry must be an embedded request object with a method`,{key:r});let s=o.method;if(!t.hasInputRequestMethod(s))throw new re(ee.InvalidResult,`Invalid input request '${r}': '${s}' is not an embedded request the ${t.era} revision defines (expected elicitation/create, sampling/createMessage, or roots/list)`,{key:r,method:s});let i=e.getRequestHandler(s);if(i===void 0)throw new re(ee.CapabilityNotSupported,`Cannot fulfil input request '${r}': no handler is registered for '${s}' on this client. Declare the corresponding capability and register a handler, or handle input_required results manually.`,{key:r,method:s});let c=rc(o.params)?o.params:void 0;return await i({jsonrpc:"2.0",id:r,method:s,...c!==void 0&&{params:c}},e.buildContext(L0(r,s,c,n,e.sessionId)))}function U0(e,t){return{...e?.signal!==void 0&&{signal:e.signal},...e?.onprogress!==void 0&&{onprogress:e.onprogress},...e?.resetTimeoutOnProgress!==void 0&&{resetTimeoutOnProgress:e.resetTimeoutOnProgress},...e?.headers!==void 0&&{headers:e.headers},...t.timeout!==void 0&&{timeout:t.timeout},...t.maxTotalTimeout!==void 0&&{maxTotalTimeout:t.maxTotalTimeout},allowInputRequired:!0}}function m_(e,t,r,o){let{codec:n,request:s,options:i,flowStartedAt:c}=o,a={inputRequests:r.inputRequests,...r.requestState!==void 0&&{requestState:r.requestState}},u={dispatchInputRequest:(l,d,h)=>D0(e,n,l,d,h),retry:(l,d)=>o.retry(l,U0(i,d))};return k0({config:t,method:s.method,originalParams:s.params,firstPayload:a,flowStartedAt:c,signal:i?.signal,requestOptions:{...i?.timeout!==void 0&&{timeout:i.timeout},...i?.maxTotalTimeout!==void 0&&{maxTotalTimeout:i.maxTotalTimeout},...i?.onprogress!==void 0&&{onprogress:i.onprogress}},hooks:u})}function Z0(e){return{resultType:"input_required",inputRequests:e.inputRequests,...e.requestState!==void 0&&{requestState:e.requestState},...e._meta!==void 0&&{_meta:e._meta}}}var V0=H((e=>{var t=/; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g,r=/\\([\u000b\u0020-\u00ff])/g,o=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;e.parse=n;function n(c){if(!c)throw new TypeError("argument string is required");var a=typeof c=="object"?s(c):c;if(typeof a!="string")throw new TypeError("argument string is required to be a string");var u=a.indexOf(";"),l=u!==-1?a.slice(0,u).trim():a.trim();if(!o.test(l))throw new TypeError("invalid media type");var d=new i(l.toLowerCase());if(u!==-1){var h,_,y;for(t.lastIndex=u;_=t.exec(a);){if(_.index!==u)throw new TypeError("invalid parameter format");u+=_[0].length,h=_[1].toLowerCase(),y=_[2],y.charCodeAt(0)===34&&(y=y.slice(1,-1),y.indexOf("\\")!==-1&&(y=y.replace(r,"$1"))),d.parameters[h]=y}if(u!==a.length)throw new TypeError("invalid parameter format")}return d}function s(c){var a;if(typeof c.getHeader=="function"?a=c.getHeader("content-type"):typeof c.headers=="object"&&(a=c.headers&&c.headers["content-type"]),typeof a!="string")throw new TypeError("content-type header is missing from object");return a}function i(c){this.parameters=Object.create(null),this.type=c}})),F0=Ps(V0(),1);function h_(e){if(e)try{return F0.parse(e).type}catch{let t=(e.split(";",1)[0]??"").trim().toLowerCase();return t===""||e.slice(t.length).includes(",")?void 0:t}}var f_=10*1024*1024,Ql=class{_buffer;_maxBufferSize;constructor(e){this._maxBufferSize=e?.maxBufferSize??f_}append(e){if((this._buffer?.length??0)+e.length>this._maxBufferSize)throw this.clear(),new Error(`ReadBuffer exceeded maximum size of ${this._maxBufferSize} bytes`);this._buffer=this._buffer?Buffer.concat([this._buffer,e]):e}readMessage(){for(;this._buffer;){let e=this._buffer.indexOf(`
59
+ `);if(e===-1)return null;let t=this._buffer.toString("utf8",0,e).replace(/\r$/,"");this._buffer=this._buffer.subarray(e+1);try{return g_(t)}catch(r){if(r instanceof SyntaxError)continue;throw r}}return null}clear(){this._buffer=void 0}};function g_(e){return It.parse(JSON.parse(e))}function ed(e){return JSON.stringify(e)+`
60
+ `}function Ig(e){return e?e instanceof Headers?Object.fromEntries(e.entries()):Array.isArray(e)?Object.fromEntries(e):{...e}:{}}function __(e=fetch,t){return t?async(r,o)=>e(r,{...t,...o,headers:o?.headers?{...Ig(t.headers),...Ig(o.headers)}:t.headers}):e}var H0=new Set([301,302,303,307,308]),B0=5;function J0(e,t){return e.protocol===t.protocol&&e.host===t.host?!0:e.protocol==="http:"&&t.protocol==="https:"&&e.hostname===t.hostname&&!e.port&&!t.port}function S_(e,t){let r=H0.has(t.status)?t.headers?.get("location"):void 0;if(r)try{return new URL(r,e)}catch{return}}var y_=new WeakSet;function v_(e){let t=(r,o)=>e(r,o);return y_.add(t),t}function _o(e){return y_.has(e)?e:async(t,r)=>{if(r?.redirect==="error"||r?.redirect==="manual")return e(t,r);let o=(r?.method??"GET").toUpperCase(),n=t;for(let s=0;;s++){let i=await e(n,{...r,redirect:"manual"}),c=S_(n,i);if(!c||s===B0)return i;let a=new URL(n),u=o==="GET"||i.status===307||i.status===308,l=!(c.username||c.password)||c.username===a.username&&c.password===a.password;if(!u||!l||!J0(a,c))return i;await i.text?.().catch(()=>{}),n=c}}}function b_(e,t){if(t.type==="opaqueredirect")return"Redirect not followed: this runtime does not expose where it points";let r=S_(t.url||e,t);if(r)return r.username=r.password=r.search=r.hash="",r.protocol==="http:"&&new URL(t.url||e).protocol==="https:"?(r.protocol="https:",`Redirect from https to plain http not followed; try ${r.href} as the endpoint`):`Redirect to ${r.href} not followed; use that URL as the endpoint if it is the intended server`}var ac=H((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.regexpCode=e.getEsmExportName=e.getProperty=e.safeStringify=e.stringify=e.strConcat=e.addCodeArg=e.str=e._=e.nil=e._Code=e.Name=e.IDENTIFIER=e._CodeOrName=void 0;var t=class{};e._CodeOrName=t,e.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;var r=class extends t{constructor(g){if(super(),!e.IDENTIFIER.test(g))throw new Error("CodeGen: name must be a valid identifier");this.str=g}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}};e.Name=r;var o=class extends t{constructor(g){super(),this._items=typeof g=="string"?[g]:g}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let g=this._items[0];return g===""||g==='""'}get str(){var g;return(g=this._str)!==null&&g!==void 0?g:this._str=this._items.reduce((P,$)=>`${P}${$}`,"")}get names(){var g;return(g=this._names)!==null&&g!==void 0?g:this._names=this._items.reduce((P,$)=>($ instanceof r&&(P[$.str]=(P[$.str]||0)+1),P),{})}};e._Code=o,e.nil=new o("");function n(g,...P){let $=[g[0]],E=0;for(;E<P.length;)c($,P[E]),$.push(g[++E]);return new o($)}e._=n;let s=new o("+");function i(g,...P){let $=[_(g[0])],E=0;for(;E<P.length;)$.push(s),c($,P[E]),$.push(s,_(g[++E]));return a($),new o($)}e.str=i;function c(g,P){P instanceof o?g.push(...P._items):P instanceof r?g.push(P):g.push(d(P))}e.addCodeArg=c;function a(g){let P=1;for(;P<g.length-1;){if(g[P]===s){let $=u(g[P-1],g[P+1]);if($!==void 0){g.splice(P-1,3,$);continue}g[P++]="+"}P++}}function u(g,P){if(P==='""')return g;if(g==='""')return P;if(typeof g=="string")return P instanceof r||g[g.length-1]!=='"'?void 0:typeof P!="string"?`${g.slice(0,-1)}${P}"`:P[0]==='"'?g.slice(0,-1)+P.slice(1):void 0;if(typeof P=="string"&&P[0]==='"'&&!(g instanceof r))return`"${g}${P.slice(1)}`}function l(g,P){return P.emptyStr()?g:g.emptyStr()?P:i`${g}${P}`}e.strConcat=l;function d(g){return typeof g=="number"||typeof g=="boolean"||g===null?g:_(Array.isArray(g)?g.join(","):g)}function h(g){return new o(_(g))}e.stringify=h;function _(g){return JSON.stringify(g).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}e.safeStringify=_;function y(g){return typeof g=="string"&&e.IDENTIFIER.test(g)?new o(`.${g}`):n`[${g}]`}e.getProperty=y;function z(g){if(typeof g=="string"&&e.IDENTIFIER.test(g))return new o(`${g}`);throw new Error(`CodeGen: invalid export name: ${g}, use explicit $id name mapping`)}e.getEsmExportName=z;function b(g){return new o(g.toString())}e.regexpCode=b})),z_=H((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.ValueScope=e.ValueScopeName=e.Scope=e.varKinds=e.UsedValueState=void 0;let t=ac();var r=class extends Error{constructor(a){super(`CodeGen: "code" for ${a} not defined`),this.value=a.value}},o;(function(a){a[a.Started=0]="Started",a[a.Completed=1]="Completed"})(o||(e.UsedValueState=o={})),e.varKinds={const:new t.Name("const"),let:new t.Name("let"),var:new t.Name("var")};var n=class{constructor({prefixes:a,parent:u}={}){this._names={},this._prefixes=a,this._parent=u}toName(a){return a instanceof t.Name?a:this.name(a)}name(a){return new t.Name(this._newName(a))}_newName(a){let u=this._names[a]||this._nameGroup(a);return`${a}${u.index++}`}_nameGroup(a){var u,l;if(!((l=(u=this._parent)===null||u===void 0?void 0:u._prefixes)===null||l===void 0)&&l.has(a)||this._prefixes&&!this._prefixes.has(a))throw new Error(`CodeGen: prefix "${a}" is not allowed in this scope`);return this._names[a]={prefix:a,index:0}}};e.Scope=n;var s=class extends t.Name{constructor(a,u){super(u),this.prefix=a}setValue(a,{property:u,itemIndex:l}){this.value=a,this.scopePath=(0,t._)`.${new t.Name(u)}[${l}]`}};e.ValueScopeName=s;let i=(0,t._)`\n`;var c=class extends n{constructor(a){super(a),this._values={},this._scope=a.scope,this.opts={...a,_n:a.lines?i:t.nil}}get(){return this._scope}name(a){return new s(a,this._newName(a))}value(a,u){var l;if(u.ref===void 0)throw new Error("CodeGen: ref must be passed in value");let d=this.toName(a),{prefix:h}=d,_=(l=u.key)!==null&&l!==void 0?l:u.ref,y=this._values[h];if(y){let g=y.get(_);if(g)return g}else y=this._values[h]=new Map;y.set(_,d);let z=this._scope[h]||(this._scope[h]=[]),b=z.length;return z[b]=u.ref,d.setValue(u,{property:h,itemIndex:b}),d}getValue(a,u){let l=this._values[a];if(l)return l.get(u)}scopeRefs(a,u=this._values){return this._reduceValues(u,l=>{if(l.scopePath===void 0)throw new Error(`CodeGen: name "${l}" has no value`);return(0,t._)`${a}${l.scopePath}`})}scopeCode(a=this._values,u,l){return this._reduceValues(a,d=>{if(d.value===void 0)throw new Error(`CodeGen: name "${d}" has no value`);return d.value.code},u,l)}_reduceValues(a,u,l={},d){let h=t.nil;for(let _ in a){let y=a[_];if(!y)continue;let z=l[_]=l[_]||new Map;y.forEach(b=>{if(z.has(b))return;z.set(b,o.Started);let g=u(b);if(g){let P=this.opts.es5?e.varKinds.var:e.varKinds.const;h=(0,t._)`${h}${P} ${b} = ${g};${this.opts._n}`}else if(g=d?.(b))h=(0,t._)`${h}${g}${this.opts._n}`;else throw new r(b);z.set(b,o.Completed)})}return h}};e.ValueScope=c})),he=H((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.or=e.and=e.not=e.CodeGen=e.operators=e.varKinds=e.ValueScopeName=e.ValueScope=e.Scope=e.Name=e.regexpCode=e.stringify=e.getProperty=e.nil=e.strConcat=e.str=e._=void 0;let t=ac(),r=z_();var o=ac();Object.defineProperty(e,"_",{enumerable:!0,get:function(){return o._}}),Object.defineProperty(e,"str",{enumerable:!0,get:function(){return o.str}}),Object.defineProperty(e,"strConcat",{enumerable:!0,get:function(){return o.strConcat}}),Object.defineProperty(e,"nil",{enumerable:!0,get:function(){return o.nil}}),Object.defineProperty(e,"getProperty",{enumerable:!0,get:function(){return o.getProperty}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return o.stringify}}),Object.defineProperty(e,"regexpCode",{enumerable:!0,get:function(){return o.regexpCode}}),Object.defineProperty(e,"Name",{enumerable:!0,get:function(){return o.Name}});var n=z_();Object.defineProperty(e,"Scope",{enumerable:!0,get:function(){return n.Scope}}),Object.defineProperty(e,"ValueScope",{enumerable:!0,get:function(){return n.ValueScope}}),Object.defineProperty(e,"ValueScopeName",{enumerable:!0,get:function(){return n.ValueScopeName}}),Object.defineProperty(e,"varKinds",{enumerable:!0,get:function(){return n.varKinds}}),e.operators={GT:new t._Code(">"),GTE:new t._Code(">="),LT:new t._Code("<"),LTE:new t._Code("<="),EQ:new t._Code("==="),NEQ:new t._Code("!=="),NOT:new t._Code("!"),OR:new t._Code("||"),AND:new t._Code("&&"),ADD:new t._Code("+")};var s=class{optimizeNodes(){return this}optimizeNames(m,f){return this}},i=class extends s{constructor(m,f,R){super(),this.varKind=m,this.name=f,this.rhs=R}render({es5:m,_n:f}){let R=m?r.varKinds.var:this.varKind,I=this.rhs===void 0?"":` = ${this.rhs}`;return`${R} ${this.name}${I};`+f}optimizeNames(m,f){if(m[this.name.str])return this.rhs&&(this.rhs=J(this.rhs,m,f)),this}get names(){return this.rhs instanceof t._CodeOrName?this.rhs.names:{}}},c=class extends s{constructor(m,f,R){super(),this.lhs=m,this.rhs=f,this.sideEffects=R}render({_n:m}){return`${this.lhs} = ${this.rhs};`+m}optimizeNames(m,f){if(!(this.lhs instanceof t.Name&&!m[this.lhs.str]&&!this.sideEffects))return this.rhs=J(this.rhs,m,f),this}get names(){return K(this.lhs instanceof t.Name?{}:{...this.lhs.names},this.rhs)}},a=class extends c{constructor(m,f,R,I){super(m,R,I),this.op=f}render({_n:m}){return`${this.lhs} ${this.op}= ${this.rhs};`+m}},u=class extends s{constructor(m){super(),this.label=m,this.names={}}render({_n:m}){return`${this.label}:`+m}},l=class extends s{constructor(m){super(),this.label=m,this.names={}}render({_n:m}){return`break${this.label?` ${this.label}`:""};`+m}},d=class extends s{constructor(m){super(),this.error=m}render({_n:m}){return`throw ${this.error};`+m}get names(){return this.error.names}},h=class extends s{constructor(m){super(),this.code=m}render({_n:m}){return`${this.code};`+m}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(m,f){return this.code=J(this.code,m,f),this}get names(){return this.code instanceof t._CodeOrName?this.code.names:{}}},_=class extends s{constructor(m=[]){super(),this.nodes=m}render(m){return this.nodes.reduce((f,R)=>f+R.render(m),"")}optimizeNodes(){let{nodes:m}=this,f=m.length;for(;f--;){let R=m[f].optimizeNodes();Array.isArray(R)?m.splice(f,1,...R):R?m[f]=R:m.splice(f,1)}return m.length>0?this:void 0}optimizeNames(m,f){let{nodes:R}=this,I=R.length;for(;I--;){let Z=R[I];Z.optimizeNames(m,f)||(de(m,Z.names),R.splice(I,1))}return R.length>0?this:void 0}get names(){return this.nodes.reduce((m,f)=>U(m,f.names),{})}},y=class extends _{render(m){return"{"+m._n+super.render(m)+"}"+m._n}},z=class extends _{},b=class extends y{};b.kind="else";var g=class ic extends y{constructor(f,R){super(R),this.condition=f}render(f){let R=`if(${this.condition})`+super.render(f);return this.else&&(R+="else "+this.else.render(f)),R}optimizeNodes(){super.optimizeNodes();let f=this.condition;if(f===!0)return this.nodes;let R=this.else;if(R){let I=R.optimizeNodes();R=this.else=Array.isArray(I)?new b(I):I}if(R)return f===!1?R instanceof ic?R:R.nodes:this.nodes.length?this:new ic(ve(f),R instanceof ic?[R]:R.nodes);if(!(f===!1||!this.nodes.length))return this}optimizeNames(f,R){var I;if(this.else=(I=this.else)===null||I===void 0?void 0:I.optimizeNames(f,R),!!(super.optimizeNames(f,R)||this.else))return this.condition=J(this.condition,f,R),this}get names(){let f=super.names;return K(f,this.condition),this.else&&U(f,this.else.names),f}};g.kind="if";var P=class extends y{};P.kind="for";var $=class extends P{constructor(m){super(),this.iteration=m}render(m){return`for(${this.iteration})`+super.render(m)}optimizeNames(m,f){if(super.optimizeNames(m,f))return this.iteration=J(this.iteration,m,f),this}get names(){return U(super.names,this.iteration.names)}},E=class extends P{constructor(m,f,R,I){super(),this.varKind=m,this.name=f,this.from=R,this.to=I}render(m){let f=m.es5?r.varKinds.var:this.varKind,{name:R,from:I,to:Z}=this;return`for(${f} ${R}=${I}; ${R}<${Z}; ${R}++)`+super.render(m)}get names(){return K(K(super.names,this.from),this.to)}},k=class extends P{constructor(m,f,R,I){super(),this.loop=m,this.varKind=f,this.name=R,this.iterable=I}render(m){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(m)}optimizeNames(m,f){if(super.optimizeNames(m,f))return this.iterable=J(this.iterable,m,f),this}get names(){return U(super.names,this.iterable.names)}},v=class extends y{constructor(m,f,R){super(),this.name=m,this.args=f,this.async=R}render(m){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(m)}};v.kind="func";var S=class extends _{render(m){return"return "+super.render(m)}};S.kind="return";var T=class extends y{render(m){let f="try"+super.render(m);return this.catch&&(f+=this.catch.render(m)),this.finally&&(f+=this.finally.render(m)),f}optimizeNodes(){var m,f;return super.optimizeNodes(),(m=this.catch)===null||m===void 0||m.optimizeNodes(),(f=this.finally)===null||f===void 0||f.optimizeNodes(),this}optimizeNames(m,f){var R,I;return super.optimizeNames(m,f),(R=this.catch)===null||R===void 0||R.optimizeNames(m,f),(I=this.finally)===null||I===void 0||I.optimizeNames(m,f),this}get names(){let m=super.names;return this.catch&&U(m,this.catch.names),this.finally&&U(m,this.finally.names),m}},A=class extends y{constructor(m){super(),this.error=m}render(m){return`catch(${this.error})`+super.render(m)}};A.kind="catch";var F=class extends y{render(m){return"finally"+super.render(m)}};F.kind="finally";var L=class{constructor(m,f={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...f,_n:f.lines?`
61
+ `:""},this._extScope=m,this._scope=new r.Scope({parent:m}),this._nodes=[new z]}toString(){return this._root.render(this.opts)}name(m){return this._scope.name(m)}scopeName(m){return this._extScope.name(m)}scopeValue(m,f){let R=this._extScope.value(m,f);return(this._values[R.prefix]||(this._values[R.prefix]=new Set)).add(R),R}getScopeValue(m,f){return this._extScope.getValue(m,f)}scopeRefs(m){return this._extScope.scopeRefs(m,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(m,f,R,I){let Z=this._scope.toName(f);return R!==void 0&&I&&(this._constants[Z.str]=R),this._leafNode(new i(m,Z,R)),Z}const(m,f,R){return this._def(r.varKinds.const,m,f,R)}let(m,f,R){return this._def(r.varKinds.let,m,f,R)}var(m,f,R){return this._def(r.varKinds.var,m,f,R)}assign(m,f,R){return this._leafNode(new c(m,f,R))}add(m,f){return this._leafNode(new a(m,e.operators.ADD,f))}code(m){return typeof m=="function"?m():m!==t.nil&&this._leafNode(new h(m)),this}object(...m){let f=["{"];for(let[R,I]of m)f.length>1&&f.push(","),f.push(R),(R!==I||this.opts.es5)&&(f.push(":"),(0,t.addCodeArg)(f,I));return f.push("}"),new t._Code(f)}if(m,f,R){if(this._blockNode(new g(m)),f&&R)this.code(f).else().code(R).endIf();else if(f)this.code(f).endIf();else if(R)throw new Error('CodeGen: "else" body without "then" body');return this}elseIf(m){return this._elseNode(new g(m))}else(){return this._elseNode(new b)}endIf(){return this._endBlockNode(g,b)}_for(m,f){return this._blockNode(m),f&&this.code(f).endFor(),this}for(m,f){return this._for(new $(m),f)}forRange(m,f,R,I,Z=this.opts.es5?r.varKinds.var:r.varKinds.let){let W=this._scope.toName(m);return this._for(new E(Z,W,f,R),()=>I(W))}forOf(m,f,R,I=r.varKinds.const){let Z=this._scope.toName(m);if(this.opts.es5){let W=f instanceof t.Name?f:this.var("_arr",f);return this.forRange("_i",0,(0,t._)`${W}.length`,G=>{this.var(Z,(0,t._)`${W}[${G}]`),R(Z)})}return this._for(new k("of",I,Z,f),()=>R(Z))}forIn(m,f,R,I=this.opts.es5?r.varKinds.var:r.varKinds.const){if(this.opts.ownProperties)return this.forOf(m,(0,t._)`Object.keys(${f})`,R);let Z=this._scope.toName(m);return this._for(new k("in",I,Z,f),()=>R(Z))}endFor(){return this._endBlockNode(P)}label(m){return this._leafNode(new u(m))}break(m){return this._leafNode(new l(m))}return(m){let f=new S;if(this._blockNode(f),this.code(m),f.nodes.length!==1)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(S)}try(m,f,R){if(!f&&!R)throw new Error('CodeGen: "try" without "catch" and "finally"');let I=new T;if(this._blockNode(I),this.code(m),f){let Z=this.name("e");this._currNode=I.catch=new A(Z),f(Z)}return R&&(this._currNode=I.finally=new F,this.code(R)),this._endBlockNode(A,F)}throw(m){return this._leafNode(new d(m))}block(m,f){return this._blockStarts.push(this._nodes.length),m&&this.code(m).endBlock(f),this}endBlock(m){let f=this._blockStarts.pop();if(f===void 0)throw new Error("CodeGen: not in self-balancing block");let R=this._nodes.length-f;if(R<0||m!==void 0&&R!==m)throw new Error(`CodeGen: wrong number of nodes: ${R} vs ${m} expected`);return this._nodes.length=f,this}func(m,f=t.nil,R,I){return this._blockNode(new v(m,f,R)),I&&this.code(I).endFunc(),this}endFunc(){return this._endBlockNode(v)}optimize(m=1){for(;m-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(m){return this._currNode.nodes.push(m),this}_blockNode(m){this._currNode.nodes.push(m),this._nodes.push(m)}_endBlockNode(m,f){let R=this._currNode;if(R instanceof m||f&&R instanceof f)return this._nodes.pop(),this;throw new Error(`CodeGen: not in block "${f?`${m.kind}/${f.kind}`:m.kind}"`)}_elseNode(m){let f=this._currNode;if(!(f instanceof g))throw new Error('CodeGen: "else" without "if"');return this._currNode=f.else=m,this}get _root(){return this._nodes[0]}get _currNode(){let m=this._nodes;return m[m.length-1]}set _currNode(m){let f=this._nodes;f[f.length-1]=m}};e.CodeGen=L;function U(m,f){for(let R in f)m[R]=(m[R]||0)+(f[R]||0);return m}function K(m,f){return f instanceof t._CodeOrName?U(m,f.names):m}function J(m,f,R){if(m instanceof t.Name)return I(m);if(!Z(m))return m;return new t._Code(m._items.reduce((W,G)=>(G instanceof t.Name&&(G=I(G)),G instanceof t._Code?W.push(...G._items):W.push(G),W),[]));function I(W){let G=R[W.str];return G===void 0||f[W.str]!==1?W:(delete f[W.str],G)}function Z(W){return W instanceof t._Code&&W._items.some(G=>G instanceof t.Name&&f[G.str]===1&&R[G.str]!==void 0)}}function de(m,f){for(let R in f)m[R]=(m[R]||0)-(f[R]||0)}function ve(m){return typeof m=="boolean"||typeof m=="number"||m===null?!m:(0,t._)`!${w(m)}`}e.not=ve;let ye=M(e.operators.AND);function Ee(...m){return m.reduce(ye)}e.and=Ee;let fe=M(e.operators.OR);function x(...m){return m.reduce(fe)}e.or=x;function M(m){return(f,R)=>f===t.nil?R:R===t.nil?f:(0,t._)`${w(f)} ${m} ${w(R)}`}function w(m){return m instanceof t.Name?m:(0,t._)`(${m})`}})),Se=H((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.checkStrictMode=e.getErrorPath=e.Type=e.useFunc=e.setEvaluated=e.evaluatedPropsToName=e.mergeEvaluated=e.eachItem=e.unescapeJsonPointer=e.escapeJsonPointer=e.escapeFragment=e.unescapeFragment=e.schemaRefOrVal=e.schemaHasRulesButRef=e.schemaHasRules=e.checkUnknownRules=e.alwaysValidSchema=e.toHash=void 0;let t=he(),r=ac();function o(v){let S={};for(let T of v)S[T]=!0;return S}e.toHash=o;function n(v,S){return typeof S=="boolean"?S:Object.keys(S).length===0?!0:(s(v,S),!i(S,v.self.RULES.all))}e.alwaysValidSchema=n;function s(v,S=v.schema){let{opts:T,self:A}=v;if(!T.strictSchema||typeof S=="boolean")return;let F=A.RULES.keywords;for(let L in S)F[L]||k(v,`unknown keyword: "${L}"`)}e.checkUnknownRules=s;function i(v,S){if(typeof v=="boolean")return!v;for(let T in v)if(S[T])return!0;return!1}e.schemaHasRules=i;function c(v,S){if(typeof v=="boolean")return!v;for(let T in v)if(T!=="$ref"&&S.all[T])return!0;return!1}e.schemaHasRulesButRef=c;function a({topSchemaRef:v,schemaPath:S},T,A,F){if(!F){if(typeof T=="number"||typeof T=="boolean")return T;if(typeof T=="string")return(0,t._)`${T}`}return(0,t._)`${v}${S}${(0,t.getProperty)(A)}`}e.schemaRefOrVal=a;function u(v){return h(decodeURIComponent(v))}e.unescapeFragment=u;function l(v){return encodeURIComponent(d(v))}e.escapeFragment=l;function d(v){return typeof v=="number"?`${v}`:v.replace(/~/g,"~0").replace(/\//g,"~1")}e.escapeJsonPointer=d;function h(v){return v.replace(/~1/g,"/").replace(/~0/g,"~")}e.unescapeJsonPointer=h;function _(v,S){if(Array.isArray(v))for(let T of v)S(T);else S(v)}e.eachItem=_;function y({mergeNames:v,mergeToName:S,mergeValues:T,resultToName:A}){return(F,L,U,K)=>{let J=U===void 0?L:U instanceof t.Name?(L instanceof t.Name?v(F,L,U):S(F,L,U),U):L instanceof t.Name?(S(F,U,L),L):T(L,U);return K===t.Name&&!(J instanceof t.Name)?A(F,J):J}}e.mergeEvaluated={props:y({mergeNames:(v,S,T)=>v.if((0,t._)`${T} !== true && ${S} !== undefined`,()=>{v.if((0,t._)`${S} === true`,()=>v.assign(T,!0),()=>v.assign(T,(0,t._)`${T} || {}`).code((0,t._)`Object.assign(${T}, ${S})`))}),mergeToName:(v,S,T)=>v.if((0,t._)`${T} !== true`,()=>{S===!0?v.assign(T,!0):(v.assign(T,(0,t._)`${T} || {}`),b(v,T,S))}),mergeValues:(v,S)=>v===!0?!0:{...v,...S},resultToName:z}),items:y({mergeNames:(v,S,T)=>v.if((0,t._)`${T} !== true && ${S} !== undefined`,()=>v.assign(T,(0,t._)`${S} === true ? true : ${T} > ${S} ? ${T} : ${S}`)),mergeToName:(v,S,T)=>v.if((0,t._)`${T} !== true`,()=>v.assign(T,S===!0?!0:(0,t._)`${T} > ${S} ? ${T} : ${S}`)),mergeValues:(v,S)=>v===!0?!0:Math.max(v,S),resultToName:(v,S)=>v.var("items",S)})};function z(v,S){if(S===!0)return v.var("props",!0);let T=v.var("props",(0,t._)`{}`);return S!==void 0&&b(v,T,S),T}e.evaluatedPropsToName=z;function b(v,S,T){Object.keys(T).forEach(A=>v.assign((0,t._)`${S}${(0,t.getProperty)(A)}`,!0))}e.setEvaluated=b;let g={};function P(v,S){return v.scopeValue("func",{ref:S,code:g[S.code]||(g[S.code]=new r._Code(S.code))})}e.useFunc=P;var $;(function(v){v[v.Num=0]="Num",v[v.Str=1]="Str"})($||(e.Type=$={}));function E(v,S,T){if(v instanceof t.Name){let A=S===$.Num;return T?A?(0,t._)`"[" + ${v} + "]"`:(0,t._)`"['" + ${v} + "']"`:A?(0,t._)`"/" + ${v}`:(0,t._)`"/" + ${v}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return T?(0,t.getProperty)(v).toString():"/"+d(v)}e.getErrorPath=E;function k(v,S,T=v.opts.strictSchema){if(T){if(S=`strict mode: ${S}`,T===!0)throw new Error(S);v.self.logger.warn(S)}}e.checkStrictMode=k})),ht=H((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=he(),r={data:new t.Name("data"),valCxt:new t.Name("valCxt"),instancePath:new t.Name("instancePath"),parentData:new t.Name("parentData"),parentDataProperty:new t.Name("parentDataProperty"),rootData:new t.Name("rootData"),dynamicAnchors:new t.Name("dynamicAnchors"),vErrors:new t.Name("vErrors"),errors:new t.Name("errors"),this:new t.Name("this"),self:new t.Name("self"),scope:new t.Name("scope"),json:new t.Name("json"),jsonPos:new t.Name("jsonPos"),jsonLen:new t.Name("jsonLen"),jsonPart:new t.Name("jsonPart")};e.default=r})),uc=H((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.extendErrors=e.resetErrorsCount=e.reportExtraError=e.reportError=e.keyword$DataError=e.keywordError=void 0;let t=he(),r=Se(),o=ht();e.keywordError={message:({keyword:b})=>(0,t.str)`must pass "${b}" keyword validation`},e.keyword$DataError={message:({keyword:b,schemaType:g})=>g?(0,t.str)`"${b}" keyword must be ${g} ($data)`:(0,t.str)`"${b}" keyword is invalid ($data)`};function n(b,g=e.keywordError,P,$){let{it:E}=b,{gen:k,compositeRule:v,allErrors:S}=E,T=d(b,g,P);$??(v||S)?a(k,T):u(E,(0,t._)`[${T}]`)}e.reportError=n;function s(b,g=e.keywordError,P){let{it:$}=b,{gen:E,compositeRule:k,allErrors:v}=$;a(E,d(b,g,P)),k||v||u($,o.default.vErrors)}e.reportExtraError=s;function i(b,g){b.assign(o.default.errors,g),b.if((0,t._)`${o.default.vErrors} !== null`,()=>b.if(g,()=>b.assign((0,t._)`${o.default.vErrors}.length`,g),()=>b.assign(o.default.vErrors,null)))}e.resetErrorsCount=i;function c({gen:b,keyword:g,schemaValue:P,data:$,errsCount:E,it:k}){if(E===void 0)throw new Error("ajv implementation error");let v=b.name("err");b.forRange("i",E,o.default.errors,S=>{b.const(v,(0,t._)`${o.default.vErrors}[${S}]`),b.if((0,t._)`${v}.instancePath === undefined`,()=>b.assign((0,t._)`${v}.instancePath`,(0,t.strConcat)(o.default.instancePath,k.errorPath))),b.assign((0,t._)`${v}.schemaPath`,(0,t.str)`${k.errSchemaPath}/${g}`),k.opts.verbose&&(b.assign((0,t._)`${v}.schema`,P),b.assign((0,t._)`${v}.data`,$))})}e.extendErrors=c;function a(b,g){let P=b.const("err",g);b.if((0,t._)`${o.default.vErrors} === null`,()=>b.assign(o.default.vErrors,(0,t._)`[${P}]`),(0,t._)`${o.default.vErrors}.push(${P})`),b.code((0,t._)`${o.default.errors}++`)}function u(b,g){let{gen:P,validateName:$,schemaEnv:E}=b;E.$async?P.throw((0,t._)`new ${b.ValidationError}(${g})`):(P.assign((0,t._)`${$}.errors`,g),P.return(!1))}let l={keyword:new t.Name("keyword"),schemaPath:new t.Name("schemaPath"),params:new t.Name("params"),propertyName:new t.Name("propertyName"),message:new t.Name("message"),schema:new t.Name("schema"),parentSchema:new t.Name("parentSchema")};function d(b,g,P){let{createErrors:$}=b.it;return $===!1?(0,t._)`{}`:h(b,g,P)}function h(b,g,P={}){let{gen:$,it:E}=b,k=[_(E,P),y(b,P)];return z(b,g,k),$.object(...k)}function _({errorPath:b},{instancePath:g}){let P=g?(0,t.str)`${b}${(0,r.getErrorPath)(g,r.Type.Str)}`:b;return[o.default.instancePath,(0,t.strConcat)(o.default.instancePath,P)]}function y({keyword:b,it:{errSchemaPath:g}},{schemaPath:P,parentSchema:$}){let E=$?g:(0,t.str)`${g}/${b}`;return P&&(E=(0,t.str)`${E}${(0,r.getErrorPath)(P,r.Type.Str)}`),[l.schemaPath,E]}function z(b,{params:g,message:P},$){let{keyword:E,data:k,schemaValue:v,it:S}=b,{opts:T,propertyName:A,topSchemaRef:F,schemaPath:L}=S;$.push([l.keyword,E],[l.params,typeof g=="function"?g(b):g||(0,t._)`{}`]),T.messages&&$.push([l.message,typeof P=="function"?P(b):P]),T.verbose&&$.push([l.schema,v],[l.parentSchema,(0,t._)`${F}${L}`],[o.default.data,k]),A&&$.push([l.propertyName,A])}})),K0=H((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.boolOrEmptySchema=e.topBoolOrEmptySchema=void 0;let t=uc(),r=he(),o=ht(),n={message:"boolean schema is false"};function s(a){let{gen:u,schema:l,validateName:d}=a;l===!1?c(a,!1):typeof l=="object"&&l.$async===!0?u.return(o.default.data):(u.assign((0,r._)`${d}.errors`,null),u.return(!0))}e.topBoolOrEmptySchema=s;function i(a,u){let{gen:l,schema:d}=a;d===!1?(l.var(u,!1),c(a)):l.var(u,!0)}e.boolOrEmptySchema=i;function c(a,u){let{gen:l,data:d}=a,h={gen:l,keyword:"false schema",data:d,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:a};(0,t.reportError)(h,n,void 0,u)}})),w_=H((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.getRules=e.isJSONType=void 0;let t=new Set(["string","number","integer","boolean","null","object","array"]);function r(n){return typeof n=="string"&&t.has(n)}e.isJSONType=r;function o(){let n={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...n,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},n.number,n.string,n.array,n.object],post:{rules:[]},all:{},keywords:{}}}e.getRules=o})),R_=H((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.shouldUseRule=e.shouldUseGroup=e.schemaHasRulesForType=void 0;function t({schema:n,self:s},i){let c=s.RULES.types[i];return c&&c!==!0&&r(n,c)}e.schemaHasRulesForType=t;function r(n,s){return s.rules.some(i=>o(n,i))}e.shouldUseGroup=r;function o(n,s){var i;return n[s.keyword]!==void 0||((i=s.definition.implements)===null||i===void 0?void 0:i.some(c=>n[c]!==void 0))}e.shouldUseRule=o})),cc=H((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.reportTypeError=e.checkDataTypes=e.checkDataType=e.coerceAndCheckDataType=e.getJSONTypes=e.getSchemaTypes=e.DataType=void 0;let t=w_(),r=R_(),o=uc(),n=he(),s=Se();var i;(function($){$[$.Correct=0]="Correct",$[$.Wrong=1]="Wrong"})(i||(e.DataType=i={}));function c($){let E=a($.type);if(E.includes("null")){if($.nullable===!1)throw new Error("type: null contradicts nullable: false")}else{if(!E.length&&$.nullable!==void 0)throw new Error('"nullable" cannot be used without "type"');$.nullable===!0&&E.push("null")}return E}e.getSchemaTypes=c;function a($){let E=Array.isArray($)?$:$?[$]:[];if(E.every(t.isJSONType))return E;throw new Error("type must be JSONType or JSONType[]: "+E.join(","))}e.getJSONTypes=a;function u($,E){let{gen:k,data:v,opts:S}=$,T=d(E,S.coerceTypes),A=E.length>0&&!(T.length===0&&E.length===1&&(0,r.schemaHasRulesForType)($,E[0]));if(A){let F=z(E,v,S.strictNumbers,i.Wrong);k.if(F,()=>{T.length?h($,E,T):g($)})}return A}e.coerceAndCheckDataType=u;let l=new Set(["string","number","integer","boolean","null"]);function d($,E){return E?$.filter(k=>l.has(k)||E==="array"&&k==="array"):[]}function h($,E,k){let{gen:v,data:S,opts:T}=$,A=v.let("dataType",(0,n._)`typeof ${S}`),F=v.let("coerced",(0,n._)`undefined`);T.coerceTypes==="array"&&v.if((0,n._)`${A} == 'object' && Array.isArray(${S}) && ${S}.length == 1`,()=>v.assign(S,(0,n._)`${S}[0]`).assign(A,(0,n._)`typeof ${S}`).if(z(E,S,T.strictNumbers),()=>v.assign(F,S))),v.if((0,n._)`${F} !== undefined`);for(let U of k)(l.has(U)||U==="array"&&T.coerceTypes==="array")&&L(U);v.else(),g($),v.endIf(),v.if((0,n._)`${F} !== undefined`,()=>{v.assign(S,F),_($,F)});function L(U){switch(U){case"string":v.elseIf((0,n._)`${A} == "number" || ${A} == "boolean"`).assign(F,(0,n._)`"" + ${S}`).elseIf((0,n._)`${S} === null`).assign(F,(0,n._)`""`);return;case"number":v.elseIf((0,n._)`${A} == "boolean" || ${S} === null
62
+ || (${A} == "string" && ${S} && ${S} == +${S})`).assign(F,(0,n._)`+${S}`);return;case"integer":v.elseIf((0,n._)`${A} === "boolean" || ${S} === null
63
+ || (${A} === "string" && ${S} && ${S} == +${S} && !(${S} % 1))`).assign(F,(0,n._)`+${S}`);return;case"boolean":v.elseIf((0,n._)`${S} === "false" || ${S} === 0 || ${S} === null`).assign(F,!1).elseIf((0,n._)`${S} === "true" || ${S} === 1`).assign(F,!0);return;case"null":v.elseIf((0,n._)`${S} === "" || ${S} === 0 || ${S} === false`),v.assign(F,null);return;case"array":v.elseIf((0,n._)`${A} === "string" || ${A} === "number"
64
+ || ${A} === "boolean" || ${S} === null`).assign(F,(0,n._)`[${S}]`)}}}function _({gen:$,parentData:E,parentDataProperty:k},v){$.if((0,n._)`${E} !== undefined`,()=>$.assign((0,n._)`${E}[${k}]`,v))}function y($,E,k,v=i.Correct){let S=v===i.Correct?n.operators.EQ:n.operators.NEQ,T;switch($){case"null":return(0,n._)`${E} ${S} null`;case"array":T=(0,n._)`Array.isArray(${E})`;break;case"object":T=(0,n._)`${E} && typeof ${E} == "object" && !Array.isArray(${E})`;break;case"integer":T=A((0,n._)`!(${E} % 1) && !isNaN(${E})`);break;case"number":T=A();break;default:return(0,n._)`typeof ${E} ${S} ${$}`}return v===i.Correct?T:(0,n.not)(T);function A(F=n.nil){return(0,n.and)((0,n._)`typeof ${E} == "number"`,F,k?(0,n._)`isFinite(${E})`:n.nil)}}e.checkDataType=y;function z($,E,k,v){if($.length===1)return y($[0],E,k,v);let S,T=(0,s.toHash)($);if(T.array&&T.object){let A=(0,n._)`typeof ${E} != "object"`;S=T.null?A:(0,n._)`!${E} || ${A}`,delete T.null,delete T.array,delete T.object}else S=n.nil;T.number&&delete T.integer;for(let A in T)S=(0,n.and)(S,y(A,E,k,v));return S}e.checkDataTypes=z;let b={message:({schema:$})=>`must be ${$}`,params:({schema:$,schemaValue:E})=>typeof $=="string"?(0,n._)`{type: ${$}}`:(0,n._)`{type: ${E}}`};function g($){let E=P($);(0,o.reportError)(E,b)}e.reportTypeError=g;function P($){let{gen:E,data:k,schema:v}=$,S=(0,s.schemaRefOrVal)($,v,"type");return{gen:E,keyword:"type",data:k,schema:v.type,schemaCode:S,schemaValue:S,parentSchema:v,params:{},it:$}}})),G0=H((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.assignDefaults=void 0;let t=he(),r=Se();function o(s,i){let{properties:c,items:a}=s.schema;if(i==="object"&&c)for(let u in c)n(s,u,c[u].default);else i==="array"&&Array.isArray(a)&&a.forEach((u,l)=>n(s,l,u.default))}e.assignDefaults=o;function n(s,i,c){let{gen:a,compositeRule:u,data:l,opts:d}=s;if(c===void 0)return;let h=(0,t._)`${l}${(0,t.getProperty)(i)}`;if(u){(0,r.checkStrictMode)(s,`default is ignored for: ${h}`);return}let _=(0,t._)`${h} === undefined`;d.useDefaults==="empty"&&(_=(0,t._)`${_} || ${h} === null || ${h} === ""`),a.if(_,(0,t._)`${h} = ${(0,t.stringify)(c)}`)}})),ft=H((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.validateUnion=e.validateArray=e.usePattern=e.callValidateCode=e.schemaProperties=e.allSchemaProperties=e.noPropertyInData=e.propertyInData=e.isOwnProperty=e.hasPropFunc=e.reportMissingProp=e.checkMissingProp=e.checkReportMissingProp=void 0;let t=he(),r=Se(),o=ht(),n=Se();function s($,E){let{gen:k,data:v,it:S}=$;k.if(d(k,v,E,S.opts.ownProperties),()=>{$.setParams({missingProperty:(0,t._)`${E}`},!0),$.error()})}e.checkReportMissingProp=s;function i({gen:$,data:E,it:{opts:k}},v,S){return(0,t.or)(...v.map(T=>(0,t.and)(d($,E,T,k.ownProperties),(0,t._)`${S} = ${T}`)))}e.checkMissingProp=i;function c($,E){$.setParams({missingProperty:E},!0),$.error()}e.reportMissingProp=c;function a($){return $.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:(0,t._)`Object.prototype.hasOwnProperty`})}e.hasPropFunc=a;function u($,E,k){return(0,t._)`${a($)}.call(${E}, ${k})`}e.isOwnProperty=u;function l($,E,k,v){let S=(0,t._)`${E}${(0,t.getProperty)(k)} !== undefined`;return v?(0,t._)`${S} && ${u($,E,k)}`:S}e.propertyInData=l;function d($,E,k,v){let S=(0,t._)`${E}${(0,t.getProperty)(k)} === undefined`;return v?(0,t.or)(S,(0,t.not)(u($,E,k))):S}e.noPropertyInData=d;function h($){return $?Object.keys($).filter(E=>E!=="__proto__"):[]}e.allSchemaProperties=h;function _($,E){return h(E).filter(k=>!(0,r.alwaysValidSchema)($,E[k]))}e.schemaProperties=_;function y({schemaCode:$,data:E,it:{gen:k,topSchemaRef:v,schemaPath:S,errorPath:T},it:A},F,L,U){let K=U?(0,t._)`${$}, ${E}, ${v}${S}`:E,J=[[o.default.instancePath,(0,t.strConcat)(o.default.instancePath,T)],[o.default.parentData,A.parentData],[o.default.parentDataProperty,A.parentDataProperty],[o.default.rootData,o.default.rootData]];A.opts.dynamicRef&&J.push([o.default.dynamicAnchors,o.default.dynamicAnchors]);let de=(0,t._)`${K}, ${k.object(...J)}`;return L!==t.nil?(0,t._)`${F}.call(${L}, ${de})`:(0,t._)`${F}(${de})`}e.callValidateCode=y;let z=(0,t._)`new RegExp`;function b({gen:$,it:{opts:E}},k){let v=E.unicodeRegExp?"u":"",{regExp:S}=E.code,T=S(k,v);return $.scopeValue("pattern",{key:T.toString(),ref:T,code:(0,t._)`${S.code==="new RegExp"?z:(0,n.useFunc)($,S)}(${k}, ${v})`})}e.usePattern=b;function g($){let{gen:E,data:k,keyword:v,it:S}=$,T=E.name("valid");if(S.allErrors){let F=E.let("valid",!0);return A(()=>E.assign(F,!1)),F}return E.var(T,!0),A(()=>E.break()),T;function A(F){let L=E.const("len",(0,t._)`${k}.length`);E.forRange("i",0,L,U=>{$.subschema({keyword:v,dataProp:U,dataPropType:r.Type.Num},T),E.if((0,t.not)(T),F)})}}e.validateArray=g;function P($){let{gen:E,schema:k,keyword:v,it:S}=$;if(!Array.isArray(k))throw new Error("ajv implementation error");if(k.some(F=>(0,r.alwaysValidSchema)(S,F))&&!S.opts.unevaluated)return;let T=E.let("valid",!1),A=E.name("_valid");E.block(()=>k.forEach((F,L)=>{let U=$.subschema({keyword:v,schemaProp:L,compositeRule:!0},A);E.assign(T,(0,t._)`${T} || ${A}`),$.mergeValidEvaluated(U,A)||E.if((0,t.not)(T))})),$.result(T,()=>$.reset(),()=>$.error(!0))}e.validateUnion=P})),W0=H((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.validateKeywordUsage=e.validSchemaType=e.funcKeywordCode=e.macroKeywordCode=void 0;let t=he(),r=ht(),o=ft(),n=uc();function s(_,y){let{gen:z,keyword:b,schema:g,parentSchema:P,it:$}=_,E=y.macro.call($.self,g,P,$),k=l(z,b,E);$.opts.validateSchema!==!1&&$.self.validateSchema(E,!0);let v=z.name("valid");_.subschema({schema:E,schemaPath:t.nil,errSchemaPath:`${$.errSchemaPath}/${b}`,topSchemaRef:k,compositeRule:!0},v),_.pass(v,()=>_.error(!0))}e.macroKeywordCode=s;function i(_,y){var z;let{gen:b,keyword:g,schema:P,parentSchema:$,$data:E,it:k}=_;u(k,y);let v=l(b,g,!E&&y.compile?y.compile.call(k.self,P,$,k):y.validate),S=b.let("valid");_.block$data(S,T),_.ok((z=y.valid)!==null&&z!==void 0?z:S);function T(){if(y.errors===!1)L(),y.modifying&&c(_),U(()=>_.error());else{let K=y.async?A():F();y.modifying&&c(_),U(()=>a(_,K))}}function A(){let K=b.let("ruleErrs",null);return b.try(()=>L((0,t._)`await `),J=>b.assign(S,!1).if((0,t._)`${J} instanceof ${k.ValidationError}`,()=>b.assign(K,(0,t._)`${J}.errors`),()=>b.throw(J))),K}function F(){let K=(0,t._)`${v}.errors`;return b.assign(K,null),L(t.nil),K}function L(K=y.async?(0,t._)`await `:t.nil){let J=k.opts.passContext?r.default.this:r.default.self,de=!("compile"in y&&!E||y.schema===!1);b.assign(S,(0,t._)`${K}${(0,o.callValidateCode)(_,v,J,de)}`,y.modifying)}function U(K){var J;b.if((0,t.not)((J=y.valid)!==null&&J!==void 0?J:S),K)}}e.funcKeywordCode=i;function c(_){let{gen:y,data:z,it:b}=_;y.if(b.parentData,()=>y.assign(z,(0,t._)`${b.parentData}[${b.parentDataProperty}]`))}function a(_,y){let{gen:z}=_;z.if((0,t._)`Array.isArray(${y})`,()=>{z.assign(r.default.vErrors,(0,t._)`${r.default.vErrors} === null ? ${y} : ${r.default.vErrors}.concat(${y})`).assign(r.default.errors,(0,t._)`${r.default.vErrors}.length`),(0,n.extendErrors)(_)},()=>_.error())}function u({schemaEnv:_},y){if(y.async&&!_.$async)throw new Error("async keyword in sync schema")}function l(_,y,z){if(z===void 0)throw new Error(`keyword "${y}" failed to compile`);return _.scopeValue("keyword",typeof z=="function"?{ref:z}:{ref:z,code:(0,t.stringify)(z)})}function d(_,y,z=!1){return!y.length||y.some(b=>b==="array"?Array.isArray(_):b==="object"?_&&typeof _=="object"&&!Array.isArray(_):typeof _==b||z&&typeof _>"u")}e.validSchemaType=d;function h({schema:_,opts:y,self:z,errSchemaPath:b},g,P){if(Array.isArray(g.keyword)?!g.keyword.includes(P):g.keyword!==P)throw new Error("ajv implementation error");let $=g.dependencies;if($?.some(E=>!Object.prototype.hasOwnProperty.call(_,E)))throw new Error(`parent schema must have dependencies of ${P}: ${$.join(",")}`);if(g.validateSchema&&!g.validateSchema(_[P])){let E=`keyword "${P}" value is invalid at path "${b}": `+z.errorsText(g.validateSchema.errors);if(y.validateSchema==="log")z.logger.error(E);else throw new Error(E)}}e.validateKeywordUsage=h})),Y0=H((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.extendSubschemaMode=e.extendSubschemaData=e.getSubschema=void 0;let t=he(),r=Se();function o(i,{keyword:c,schemaProp:a,schema:u,schemaPath:l,errSchemaPath:d,topSchemaRef:h}){if(c!==void 0&&u!==void 0)throw new Error('both "keyword" and "schema" passed, only one allowed');if(c!==void 0){let _=i.schema[c];return a===void 0?{schema:_,schemaPath:(0,t._)`${i.schemaPath}${(0,t.getProperty)(c)}`,errSchemaPath:`${i.errSchemaPath}/${c}`}:{schema:_[a],schemaPath:(0,t._)`${i.schemaPath}${(0,t.getProperty)(c)}${(0,t.getProperty)(a)}`,errSchemaPath:`${i.errSchemaPath}/${c}/${(0,r.escapeFragment)(a)}`}}if(u!==void 0){if(l===void 0||d===void 0||h===void 0)throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:u,schemaPath:l,topSchemaRef:h,errSchemaPath:d}}throw new Error('either "keyword" or "schema" must be passed')}e.getSubschema=o;function n(i,c,{dataProp:a,dataPropType:u,data:l,dataTypes:d,propertyName:h}){if(l!==void 0&&a!==void 0)throw new Error('both "data" and "dataProp" passed, only one allowed');let{gen:_}=c;if(a!==void 0){let{errorPath:z,dataPathArr:b,opts:g}=c;y(_.let("data",(0,t._)`${c.data}${(0,t.getProperty)(a)}`,!0)),i.errorPath=(0,t.str)`${z}${(0,r.getErrorPath)(a,u,g.jsPropertySyntax)}`,i.parentDataProperty=(0,t._)`${a}`,i.dataPathArr=[...b,i.parentDataProperty]}l!==void 0&&(y(l instanceof t.Name?l:_.let("data",l,!0)),h!==void 0&&(i.propertyName=h)),d&&(i.dataTypes=d);function y(z){i.data=z,i.dataLevel=c.dataLevel+1,i.dataTypes=[],c.definedProperties=new Set,i.parentData=c.data,i.dataNames=[...c.dataNames,z]}}e.extendSubschemaData=n;function s(i,{jtdDiscriminator:c,jtdMetadata:a,compositeRule:u,createErrors:l,allErrors:d}){u!==void 0&&(i.compositeRule=u),l!==void 0&&(i.createErrors=l),d!==void 0&&(i.allErrors=d),i.jtdDiscriminator=c,i.jtdMetadata=a}e.extendSubschemaMode=s})),$_=H(((e,t)=>{t.exports=function r(o,n){if(o===n)return!0;if(o&&n&&typeof o=="object"&&typeof n=="object"){if(o.constructor!==n.constructor)return!1;var s,i,c;if(Array.isArray(o)){if(s=o.length,s!=n.length)return!1;for(i=s;i--!==0;)if(!r(o[i],n[i]))return!1;return!0}if(o.constructor===RegExp)return o.source===n.source&&o.flags===n.flags;if(o.valueOf!==Object.prototype.valueOf)return o.valueOf()===n.valueOf();if(o.toString!==Object.prototype.toString)return o.toString()===n.toString();if(c=Object.keys(o),s=c.length,s!==Object.keys(n).length)return!1;for(i=s;i--!==0;)if(!Object.prototype.hasOwnProperty.call(n,c[i]))return!1;for(i=s;i--!==0;){var a=c[i];if(!r(o[a],n[a]))return!1}return!0}return o!==o&&n!==n}})),X0=H(((e,t)=>{var r=t.exports=function(s,i,c){typeof i=="function"&&(c=i,i={}),c=i.cb||c;var a=typeof c=="function"?c:c.pre||function(){},u=c.post||function(){};o(i,a,u,s,"",s)};r.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0},r.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0},r.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0},r.skipKeywords={default:!0,enum:!0,const:!0,required:!0,maximum:!0,minimum:!0,exclusiveMaximum:!0,exclusiveMinimum:!0,multipleOf:!0,maxLength:!0,minLength:!0,pattern:!0,format:!0,maxItems:!0,minItems:!0,uniqueItems:!0,maxProperties:!0,minProperties:!0};function o(s,i,c,a,u,l,d,h,_,y){if(a&&typeof a=="object"&&!Array.isArray(a)){i(a,u,l,d,h,_,y);for(var z in a){var b=a[z];if(Array.isArray(b)){if(z in r.arrayKeywords)for(var g=0;g<b.length;g++)o(s,i,c,b[g],u+"/"+z+"/"+g,l,u,z,a,g)}else if(z in r.propsKeywords){if(b&&typeof b=="object")for(var P in b)o(s,i,c,b[P],u+"/"+z+"/"+n(P),l,u,z,a,P)}else(z in r.keywords||s.allKeys&&!(z in r.skipKeywords))&&o(s,i,c,b,u+"/"+z,l,u,z,a)}c(a,u,l,d,h,_,y)}}function n(s){return s.replace(/~/g,"~0").replace(/\//g,"~1")}})),lc=H((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.getSchemaRefs=e.resolveUrl=e.normalizeId=e._getFullPath=e.getFullPath=e.inlineRef=void 0;let t=Se(),r=$_(),o=X0(),n=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function s(b,g=!0){return typeof b=="boolean"?!0:g===!0?!c(b):g?a(b)<=g:!1}e.inlineRef=s;let i=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function c(b){for(let g in b){if(i.has(g))return!0;let P=b[g];if(Array.isArray(P)&&P.some(c)||typeof P=="object"&&c(P))return!0}return!1}function a(b){let g=0;for(let P in b){if(P==="$ref")return 1/0;if(g++,!n.has(P)&&(typeof b[P]=="object"&&(0,t.eachItem)(b[P],$=>g+=a($)),g===1/0))return 1/0}return g}function u(b,g="",P){return P!==!1&&(g=h(g)),l(b,b.parse(g))}e.getFullPath=u;function l(b,g){return b.serialize(g).split("#")[0]+"#"}e._getFullPath=l;let d=/#\/?$/;function h(b){return b?b.replace(d,""):""}e.normalizeId=h;function _(b,g,P){return P=h(P),b.resolve(g,P)}e.resolveUrl=_;let y=/^[a-z_][-a-z0-9._]*$/i;function z(b,g){if(typeof b=="boolean")return{};let{schemaId:P,uriResolver:$}=this.opts,E=h(b[P]||g),k={"":E},v=u($,E,!1),S={},T=new Set;return o(b,{allKeys:!0},(L,U,K,J)=>{if(J===void 0)return;let de=v+U,ve=k[J];typeof L[P]=="string"&&(ve=ye.call(this,L[P])),Ee.call(this,L.$anchor),Ee.call(this,L.$dynamicAnchor),k[U]=ve;function ye(fe){let x=this.opts.uriResolver.resolve;if(fe=h(ve?x(ve,fe):fe),T.has(fe))throw F(fe);T.add(fe);let M=this.refs[fe];return typeof M=="string"&&(M=this.refs[M]),typeof M=="object"?A(L,M.schema,fe):fe!==h(de)&&(fe[0]==="#"?(A(L,S[fe],fe),S[fe]=L):this.refs[fe]=de),fe}function Ee(fe){if(typeof fe=="string"){if(!y.test(fe))throw new Error(`invalid anchor "${fe}"`);ye.call(this,`#${fe}`)}}}),S;function A(L,U,K){if(U!==void 0&&!r(L,U))throw F(K)}function F(L){return new Error(`reference "${L}" resolves to more than one schema`)}}e.getSchemaRefs=z})),So=H((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.getData=e.KeywordCxt=e.validateFunctionCode=void 0;let t=K0(),r=cc(),o=R_(),n=cc(),s=G0(),i=W0(),c=Y0(),a=he(),u=ht(),l=lc(),d=Se(),h=uc();function _(C){if(v(C)&&(T(C),k(C))){g(C);return}y(C,()=>(0,t.topBoolOrEmptySchema)(C))}e.validateFunctionCode=_;function y({gen:C,validateName:q,schema:V,schemaEnv:te,opts:oe},ie){oe.code.es5?C.func(q,(0,a._)`${u.default.data}, ${u.default.valCxt}`,te.$async,()=>{C.code((0,a._)`"use strict"; ${$(V,oe)}`),b(C,oe),C.code(ie)}):C.func(q,(0,a._)`${u.default.data}, ${z(oe)}`,te.$async,()=>C.code($(V,oe)).code(ie))}function z(C){return(0,a._)`{${u.default.instancePath}="", ${u.default.parentData}, ${u.default.parentDataProperty}, ${u.default.rootData}=${u.default.data}${C.dynamicRef?(0,a._)`, ${u.default.dynamicAnchors}={}`:a.nil}}={}`}function b(C,q){C.if(u.default.valCxt,()=>{C.var(u.default.instancePath,(0,a._)`${u.default.valCxt}.${u.default.instancePath}`),C.var(u.default.parentData,(0,a._)`${u.default.valCxt}.${u.default.parentData}`),C.var(u.default.parentDataProperty,(0,a._)`${u.default.valCxt}.${u.default.parentDataProperty}`),C.var(u.default.rootData,(0,a._)`${u.default.valCxt}.${u.default.rootData}`),q.dynamicRef&&C.var(u.default.dynamicAnchors,(0,a._)`${u.default.valCxt}.${u.default.dynamicAnchors}`)},()=>{C.var(u.default.instancePath,(0,a._)`""`),C.var(u.default.parentData,(0,a._)`undefined`),C.var(u.default.parentDataProperty,(0,a._)`undefined`),C.var(u.default.rootData,u.default.data),q.dynamicRef&&C.var(u.default.dynamicAnchors,(0,a._)`{}`)})}function g(C){let{schema:q,opts:V,gen:te}=C;y(C,()=>{V.$comment&&q.$comment&&J(C),L(C),te.let(u.default.vErrors,null),te.let(u.default.errors,0),V.unevaluated&&P(C),A(C),de(C)})}function P(C){let{gen:q,validateName:V}=C;C.evaluated=q.const("evaluated",(0,a._)`${V}.evaluated`),q.if((0,a._)`${C.evaluated}.dynamicProps`,()=>q.assign((0,a._)`${C.evaluated}.props`,(0,a._)`undefined`)),q.if((0,a._)`${C.evaluated}.dynamicItems`,()=>q.assign((0,a._)`${C.evaluated}.items`,(0,a._)`undefined`))}function $(C,q){let V=typeof C=="object"&&C[q.schemaId];return V&&(q.code.source||q.code.process)?(0,a._)`/*# sourceURL=${V} */`:a.nil}function E(C,q){if(v(C)&&(T(C),k(C))){S(C,q);return}(0,t.boolOrEmptySchema)(C,q)}function k({schema:C,self:q}){if(typeof C=="boolean")return!C;for(let V in C)if(q.RULES.all[V])return!0;return!1}function v(C){return typeof C.schema!="boolean"}function S(C,q){let{schema:V,gen:te,opts:oe}=C;oe.$comment&&V.$comment&&J(C),U(C),K(C);let ie=te.const("_errs",u.default.errors);A(C,ie),te.var(q,(0,a._)`${ie} === ${u.default.errors}`)}function T(C){(0,d.checkUnknownRules)(C),F(C)}function A(C,q){if(C.opts.jtd)return ye(C,[],!1,q);let V=(0,r.getSchemaTypes)(C.schema);ye(C,V,!(0,r.coerceAndCheckDataType)(C,V),q)}function F(C){let{schema:q,errSchemaPath:V,opts:te,self:oe}=C;q.$ref&&te.ignoreKeywordsWithRef&&(0,d.schemaHasRulesButRef)(q,oe.RULES)&&oe.logger.warn(`$ref: keywords ignored in schema at path "${V}"`)}function L(C){let{schema:q,opts:V}=C;q.default!==void 0&&V.useDefaults&&V.strictSchema&&(0,d.checkStrictMode)(C,"default is ignored in the schema root")}function U(C){let q=C.schema[C.opts.schemaId];q&&(C.baseId=(0,l.resolveUrl)(C.opts.uriResolver,C.baseId,q))}function K(C){if(C.schema.$async&&!C.schemaEnv.$async)throw new Error("async schema in sync schema")}function J({gen:C,schemaEnv:q,schema:V,errSchemaPath:te,opts:oe}){let ie=V.$comment;if(oe.$comment===!0)C.code((0,a._)`${u.default.self}.logger.log(${ie})`);else if(typeof oe.$comment=="function"){let ge=(0,a.str)`${te}/$comment`,Ce=C.scopeValue("root",{ref:q.root});C.code((0,a._)`${u.default.self}.opts.$comment(${ie}, ${ge}, ${Ce}.schema)`)}}function de(C){let{gen:q,schemaEnv:V,validateName:te,ValidationError:oe,opts:ie}=C;V.$async?q.if((0,a._)`${u.default.errors} === 0`,()=>q.return(u.default.data),()=>q.throw((0,a._)`new ${oe}(${u.default.vErrors})`)):(q.assign((0,a._)`${te}.errors`,u.default.vErrors),ie.unevaluated&&ve(C),q.return((0,a._)`${u.default.errors} === 0`))}function ve({gen:C,evaluated:q,props:V,items:te}){V instanceof a.Name&&C.assign((0,a._)`${q}.props`,V),te instanceof a.Name&&C.assign((0,a._)`${q}.items`,te)}function ye(C,q,V,te){let{gen:oe,schema:ie,data:ge,allErrors:Ce,opts:we,self:Ie}=C,{RULES:Te}=Ie;if(ie.$ref&&(we.ignoreKeywordsWithRef||!(0,d.schemaHasRulesButRef)(ie,Te))){oe.block(()=>W(C,"$ref",Te.all.$ref.definition));return}we.jtd||fe(C,q),oe.block(()=>{for(let qe of Te.rules)st(qe);st(Te.post)});function st(qe){(0,o.shouldUseGroup)(ie,qe)&&(qe.type?(oe.if((0,n.checkDataType)(qe.type,ge,we.strictNumbers)),Ee(C,qe),q.length===1&&q[0]===qe.type&&V&&(oe.else(),(0,n.reportTypeError)(C)),oe.endIf()):Ee(C,qe),Ce||oe.if((0,a._)`${u.default.errors} === ${te||0}`))}}function Ee(C,q){let{gen:V,schema:te,opts:{useDefaults:oe}}=C;oe&&(0,s.assignDefaults)(C,q.type),V.block(()=>{for(let ie of q.rules)(0,o.shouldUseRule)(te,ie)&&W(C,ie.keyword,ie.definition,q.type)})}function fe(C,q){C.schemaEnv.meta||!C.opts.strictTypes||(x(C,q),C.opts.allowUnionTypes||M(C,q),w(C,C.dataTypes))}function x(C,q){if(q.length){if(!C.dataTypes.length){C.dataTypes=q;return}q.forEach(V=>{f(C.dataTypes,V)||I(C,`type "${V}" not allowed by context "${C.dataTypes.join(",")}"`)}),R(C,q)}}function M(C,q){q.length>1&&!(q.length===2&&q.includes("null"))&&I(C,"use allowUnionTypes to allow union type keyword")}function w(C,q){let V=C.self.RULES.all;for(let te in V){let oe=V[te];if(typeof oe=="object"&&(0,o.shouldUseRule)(C.schema,oe)){let{type:ie}=oe.definition;ie.length&&!ie.some(ge=>m(q,ge))&&I(C,`missing type "${ie.join(",")}" for keyword "${te}"`)}}}function m(C,q){return C.includes(q)||q==="number"&&C.includes("integer")}function f(C,q){return C.includes(q)||q==="integer"&&C.includes("number")}function R(C,q){let V=[];for(let te of C.dataTypes)f(q,te)?V.push(te):q.includes("integer")&&te==="number"&&V.push("integer");C.dataTypes=V}function I(C,q){let V=C.schemaEnv.baseId+C.errSchemaPath;q+=` at "${V}" (strictTypes)`,(0,d.checkStrictMode)(C,q,C.opts.strictTypes)}var Z=class{constructor(C,q,V){if((0,i.validateKeywordUsage)(C,q,V),this.gen=C.gen,this.allErrors=C.allErrors,this.keyword=V,this.data=C.data,this.schema=C.schema[V],this.$data=q.$data&&C.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,d.schemaRefOrVal)(C,this.schema,V,this.$data),this.schemaType=q.schemaType,this.parentSchema=C.schema,this.params={},this.it=C,this.def=q,this.$data)this.schemaCode=C.gen.const("vSchema",ze(this.$data,C));else if(this.schemaCode=this.schemaValue,!(0,i.validSchemaType)(this.schema,q.schemaType,q.allowUndefined))throw new Error(`${V} value must be ${JSON.stringify(q.schemaType)}`);("code"in q?q.trackErrors:q.errors!==!1)&&(this.errsCount=C.gen.const("_errs",u.default.errors))}result(C,q,V){this.failResult((0,a.not)(C),q,V)}failResult(C,q,V){this.gen.if(C),V?V():this.error(),q?(this.gen.else(),q(),this.allErrors&&this.gen.endIf()):this.allErrors?this.gen.endIf():this.gen.else()}pass(C,q){this.failResult((0,a.not)(C),void 0,q)}fail(C){if(C===void 0){this.error(),this.allErrors||this.gen.if(!1);return}this.gen.if(C),this.error(),this.allErrors?this.gen.endIf():this.gen.else()}fail$data(C){if(!this.$data)return this.fail(C);let{schemaCode:q}=this;this.fail((0,a._)`${q} !== undefined && (${(0,a.or)(this.invalid$data(),C)})`)}error(C,q,V){if(q){this.setParams(q),this._error(C,V),this.setParams({});return}this._error(C,V)}_error(C,q){(C?h.reportExtraError:h.reportError)(this,this.def.error,q)}$dataError(){(0,h.reportError)(this,this.def.$dataError||h.keyword$DataError)}reset(){if(this.errsCount===void 0)throw new Error('add "trackErrors" to keyword definition');(0,h.resetErrorsCount)(this.gen,this.errsCount)}ok(C){this.allErrors||this.gen.if(C)}setParams(C,q){q?Object.assign(this.params,C):this.params=C}block$data(C,q,V=a.nil){this.gen.block(()=>{this.check$data(C,V),q()})}check$data(C=a.nil,q=a.nil){if(!this.$data)return;let{gen:V,schemaCode:te,schemaType:oe,def:ie}=this;V.if((0,a.or)((0,a._)`${te} === undefined`,q)),C!==a.nil&&V.assign(C,!0),(oe.length||ie.validateSchema)&&(V.elseIf(this.invalid$data()),this.$dataError(),C!==a.nil&&V.assign(C,!1)),V.else()}invalid$data(){let{gen:C,schemaCode:q,schemaType:V,def:te,it:oe}=this;return(0,a.or)(ie(),ge());function ie(){if(V.length){if(!(q instanceof a.Name))throw new Error("ajv implementation error");let Ce=Array.isArray(V)?V:[V];return(0,a._)`${(0,n.checkDataTypes)(Ce,q,oe.opts.strictNumbers,n.DataType.Wrong)}`}return a.nil}function ge(){if(te.validateSchema){let Ce=C.scopeValue("validate$data",{ref:te.validateSchema});return(0,a._)`!${Ce}(${q})`}return a.nil}}subschema(C,q){let V=(0,c.getSubschema)(this.it,C);(0,c.extendSubschemaData)(V,this.it,C),(0,c.extendSubschemaMode)(V,C);let te={...this.it,...V,items:void 0,props:void 0};return E(te,q),te}mergeEvaluated(C,q){let{it:V,gen:te}=this;V.opts.unevaluated&&(V.props!==!0&&C.props!==void 0&&(V.props=d.mergeEvaluated.props(te,C.props,V.props,q)),V.items!==!0&&C.items!==void 0&&(V.items=d.mergeEvaluated.items(te,C.items,V.items,q)))}mergeValidEvaluated(C,q){let{it:V,gen:te}=this;if(V.opts.unevaluated&&(V.props!==!0||V.items!==!0))return te.if(q,()=>this.mergeEvaluated(C,a.Name)),!0}};e.KeywordCxt=Z;function W(C,q,V,te){let oe=new Z(C,V,q);"code"in V?V.code(oe,te):oe.$data&&V.validate?(0,i.funcKeywordCode)(oe,V):"macro"in V?(0,i.macroKeywordCode)(oe,V):(V.compile||V.validate)&&(0,i.funcKeywordCode)(oe,V)}let G=/^\/(?:[^~]|~0|~1)*$/,me=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function ze(C,{dataLevel:q,dataNames:V,dataPathArr:te}){let oe,ie;if(C==="")return u.default.rootData;if(C[0]==="/"){if(!G.test(C))throw new Error(`Invalid JSON-pointer: ${C}`);oe=C,ie=u.default.rootData}else{let Ie=me.exec(C);if(!Ie)throw new Error(`Invalid JSON-pointer: ${C}`);let Te=+Ie[1];if(oe=Ie[2],oe==="#"){if(Te>=q)throw new Error(we("property/index",Te));return te[q-Te]}if(Te>q)throw new Error(we("data",Te));if(ie=V[q-Te],!oe)return ie}let ge=ie,Ce=oe.split("/");for(let Ie of Ce)Ie&&(ie=(0,a._)`${ie}${(0,a.getProperty)((0,d.unescapeJsonPointer)(Ie))}`,ge=(0,a._)`${ge} && ${ie}`);return ge;function we(Ie,Te){return`Cannot access ${Ie} ${Te} levels up, current level is ${q}`}}e.getData=ze})),is=H((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=class extends Error{constructor(r){super("validation failed"),this.errors=r,this.ajv=this.validation=!0}};e.default=t})),yo=H((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=lc();var r=class extends Error{constructor(o,n,s,i){super(i||`can't resolve reference ${s} from id ${n}`),this.missingRef=(0,t.resolveUrl)(o,n,s),this.missingSchema=(0,t.normalizeId)((0,t.getFullPath)(o,this.missingRef))}};e.default=r})),dc=H((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.resolveSchema=e.getCompilingSchema=e.resolveRef=e.compileSchema=e.SchemaEnv=void 0;let t=he(),r=is(),o=ht(),n=lc(),s=Se(),i=So();var c=class{constructor(g){var P;this.refs={},this.dynamicAnchors={};let $;typeof g.schema=="object"&&($=g.schema),this.schema=g.schema,this.schemaId=g.schemaId,this.root=g.root||this,this.baseId=(P=g.baseId)!==null&&P!==void 0?P:(0,n.normalizeId)($?.[g.schemaId||"$id"]),this.schemaPath=g.schemaPath,this.localRefs=g.localRefs,this.meta=g.meta,this.$async=$?.$async,this.refs={}}};e.SchemaEnv=c;function a(g){let P=d.call(this,g);if(P)return P;let $=(0,n.getFullPath)(this.opts.uriResolver,g.root.baseId),{es5:E,lines:k}=this.opts.code,{ownProperties:v}=this.opts,S=new t.CodeGen(this.scope,{es5:E,lines:k,ownProperties:v}),T;g.$async&&(T=S.scopeValue("Error",{ref:r.default,code:(0,t._)`require("ajv/dist/runtime/validation_error").default`}));let A=S.scopeName("validate");g.validateName=A;let F={gen:S,allErrors:this.opts.allErrors,data:o.default.data,parentData:o.default.parentData,parentDataProperty:o.default.parentDataProperty,dataNames:[o.default.data],dataPathArr:[t.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:S.scopeValue("schema",this.opts.code.source===!0?{ref:g.schema,code:(0,t.stringify)(g.schema)}:{ref:g.schema}),validateName:A,ValidationError:T,schema:g.schema,schemaEnv:g,rootId:$,baseId:g.baseId||$,schemaPath:t.nil,errSchemaPath:g.schemaPath||(this.opts.jtd?"":"#"),errorPath:(0,t._)`""`,opts:this.opts,self:this},L;try{this._compilations.add(g),(0,i.validateFunctionCode)(F),S.optimize(this.opts.code.optimize);let U=S.toString();L=`${S.scopeRefs(o.default.scope)}return ${U}`,this.opts.code.process&&(L=this.opts.code.process(L,g));let K=new Function(`${o.default.self}`,`${o.default.scope}`,L)(this,this.scope.get());if(this.scope.value(A,{ref:K}),K.errors=null,K.schema=g.schema,K.schemaEnv=g,g.$async&&(K.$async=!0),this.opts.code.source===!0&&(K.source={validateName:A,validateCode:U,scopeValues:S._values}),this.opts.unevaluated){let{props:J,items:de}=F;K.evaluated={props:J instanceof t.Name?void 0:J,items:de instanceof t.Name?void 0:de,dynamicProps:J instanceof t.Name,dynamicItems:de instanceof t.Name},K.source&&(K.source.evaluated=(0,t.stringify)(K.evaluated))}return g.validate=K,g}catch(U){throw delete g.validate,delete g.validateName,L&&this.logger.error("Error compiling schema, function code:",L),U}finally{this._compilations.delete(g)}}e.compileSchema=a;function u(g,P,$){var E;$=(0,n.resolveUrl)(this.opts.uriResolver,P,$);let k=g.refs[$];if(k)return k;let v=_.call(this,g,$);if(v===void 0){let S=(E=g.localRefs)===null||E===void 0?void 0:E[$],{schemaId:T}=this.opts;S&&(v=new c({schema:S,schemaId:T,root:g,baseId:P}))}if(v!==void 0)return g.refs[$]=l.call(this,v)}e.resolveRef=u;function l(g){return(0,n.inlineRef)(g.schema,this.opts.inlineRefs)?g.schema:g.validate?g:a.call(this,g)}function d(g){for(let P of this._compilations)if(h(P,g))return P}e.getCompilingSchema=d;function h(g,P){return g.schema===P.schema&&g.root===P.root&&g.baseId===P.baseId}function _(g,P){let $;for(;typeof($=this.refs[P])=="string";)P=$;return $||this.schemas[P]||y.call(this,g,P)}function y(g,P){let $=this.opts.uriResolver.parse(P),E=(0,n._getFullPath)(this.opts.uriResolver,$),k=(0,n.getFullPath)(this.opts.uriResolver,g.baseId,void 0);if(Object.keys(g.schema).length>0&&E===k)return b.call(this,$,g);let v=(0,n.normalizeId)(E),S=this.refs[v]||this.schemas[v];if(typeof S=="string"){let T=y.call(this,g,S);return typeof T?.schema!="object"?void 0:b.call(this,$,T)}if(typeof S?.schema=="object"){if(S.validate||a.call(this,S),v===(0,n.normalizeId)(P)){let{schema:T}=S,{schemaId:A}=this.opts,F=T[A];return F&&(k=(0,n.resolveUrl)(this.opts.uriResolver,k,F)),new c({schema:T,schemaId:A,root:g,baseId:k})}return b.call(this,$,S)}}e.resolveSchema=y;let z=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function b(g,{baseId:P,schema:$,root:E}){var k;if(((k=g.fragment)===null||k===void 0?void 0:k[0])!=="/")return;for(let T of g.fragment.slice(1).split("/")){if(typeof $=="boolean")return;let A=$[(0,s.unescapeFragment)(T)];if(A===void 0)return;$=A;let F=typeof $=="object"&&$[this.opts.schemaId];!z.has(T)&&F&&(P=(0,n.resolveUrl)(this.opts.uriResolver,P,F))}let v;if(typeof $!="boolean"&&$.$ref&&!(0,s.schemaHasRulesButRef)($,this.RULES)){let T=(0,n.resolveUrl)(this.opts.uriResolver,P,$.$ref);v=y.call(this,E,T)}let{schemaId:S}=this.opts;if(v=v||new c({schema:$,schemaId:S,root:E,baseId:P}),v.schema!==v.root.schema)return v}})),Q0=H(((e,t)=>{t.exports={$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}})),P_=H(((e,t)=>{let r=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),o=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),n=RegExp.prototype.test.bind(/^\d*$/u),s=RegExp.prototype.test.bind(/^[\da-f]{2}$/iu),i=RegExp.prototype.test.bind(/^[\da-z\-._~]$/iu),c=RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:@/]$/u),a=RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:@/?]$/u),u=RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:]$/u),l=new Array(256);{let w="0123456789ABCDEF";for(let m=0;m<256;m++)l[m]="%"+w[m>>4]+w[m&15]}function d(w){return w<2048?l[192|w>>6]+l[128|w&63]:w<65536?l[224|w>>12]+l[128|w>>6&63]+l[128|w&63]:l[240|w>>18]+l[128|w>>12&63]+l[128|w>>6&63]+l[128|w&63]}function h(w){let m="",f=0,R=0;for(R=0;R<w.length;R++)if(f=w[R].charCodeAt(0),f!==48){if(!(f>=48&&f<=57||f>=65&&f<=70||f>=97&&f<=102))return"";m+=w[R];break}for(R+=1;R<w.length;R++){if(f=w[R].charCodeAt(0),!(f>=48&&f<=57||f>=65&&f<=70||f>=97&&f<=102))return"";m+=w[R]}return m}let _=RegExp.prototype.test.bind(/^[\dA-Fa-f]{1,4}$/),y=RegExp.prototype.test.bind(/^[vV][\dA-Fa-f]+\.[A-Za-z\d\-._~!$&'()*+,;=:]+$/),z=RegExp.prototype.test.bind(/^[A-Za-z\d\-._~]$/),b=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function g(w){if(w.length===0)return!1;for(let m=0;m<w.length;m++)if(!z(w[m])){if(w[m]==="%"&&m+2<w.length&&s(w.slice(m+1,m+3))){m+=2;continue}return!1}return!0}function P(w){let m=-1,f=0,R=-1,I=0;for(let G=0;G<w.length;G++)w[G]==="0"?(R===-1&&(R=G),I++,I>f&&(f=I,m=R)):(R=-1,I=0);if(f<2)return w.join(":");let Z=w.slice(0,m).join(":"),W=w.slice(m+f).join(":");return Z+"::"+W}function $(w){let m=w.indexOf("::");if(m!==-1&&w.indexOf("::",m+1)!==-1)return;let f=m===-1?w.split(":"):w.slice(0,m).split(":"),R=m===-1?[]:w.slice(m+2).split(":");m!==-1&&(f.length===1&&f[0]===""&&(f.length=0),R.length===1&&R[0]===""&&(R.length=0));let I=f.concat(R),Z=0;for(let G=0;G<I.length;G++){let me=I[G];if(me==="")return;if(me.indexOf(".")!==-1){if(G!==I.length-1||m!==-1&&R.length===0||!o(me))return;Z+=2;continue}if(!_(me))return;I[G]=parseInt(me,16).toString(16),Z++}if(m===-1)return Z!==8?void 0:P(I);if(Z>=8)return;let W=I.slice(0,f.length);for(let G=Z;G<8;G++)W.push("0");for(let G=f.length;G<I.length;G++)W.push(I[G]);return P(W)}function E(w){let m=w[0]==="["&&w[w.length-1]==="]";if((w[0]==="["||w[w.length-1]==="]")&&!m)return{host:w,isIPV6:!1,error:!0};let f=m?w.slice(1,-1):w;if(m&&y(f))return f=f.toLowerCase(),{host:`[${f}]`,escapedHost:f,isIPV6:!1,isIPVFuture:!0};if(k(f,":")<2)return{host:w,isIPV6:!1,error:m};let R="",I=f.indexOf("%");if(I!==-1){let W=f.slice(I,I+3).toLowerCase()==="%25"?3:1;if(R=f.slice(I+W),!g(R))return{host:w,isIPV6:!1,error:!0};f=f.slice(0,I)}let Z=$(f);return Z===void 0?{host:w,isIPV6:!1,error:!0}:{host:Z+(R?"%"+R:""),escapedHost:Z+(R?"%25"+R:""),isIPV6:!0}}function k(w,m){let f=0;for(let R=0;R<w.length;R++)w[R]===m&&f++;return f}function v(w){let m=w,f=[],R=-1,I=0;for(;I=m.length;){if(I===1){if(m===".")break;if(m==="/"){f.push("/");break}else{f.push(m);break}}else if(I===2){if(m[0]==="."){if(m[1]===".")break;if(m[1]==="/"){m=m.slice(2);continue}}else if(m[0]==="/"&&(m[1]==="."||m[1]==="/")){f.push("/");break}}else if(I===3&&m==="/.."){f.length!==0&&f.pop(),f.push("/");break}if(m[0]==="."){if(m[1]==="."){if(m[2]==="/"){m=m.slice(3);continue}}else if(m[1]==="/"){m=m.slice(2);continue}}else if(m[0]==="/"&&m[1]==="."){if(m[2]==="/"){m=m.slice(2);continue}else if(m[2]==="."&&m[3]==="/"){m=m.slice(3),f.length!==0&&f.pop();continue}}if((R=m.indexOf("/",1))===-1){f.push(m);break}else f.push(m.slice(0,R)),m=m.slice(R)}return f.join("")}let S={"@":"%40","/":"%2F","?":"%3F","#":"%23",":":"%3A"},T=/[@/?#:]/g,A=/[@/?#]/g;function F(w,m){let f=m?A:T;return f.lastIndex=0,w.replace(f,R=>S[R])}function L(w,m=!1){if(w.indexOf("%")===-1)return w;let f="";for(let R=0;R<w.length;R++){if(w[R]==="%"&&R+2<w.length){let I=w.slice(R+1,R+3);if(s(I)){let Z=I.toUpperCase(),W=String.fromCharCode(parseInt(Z,16));m&&i(W)?f+=W:f+="%"+Z,R+=2;continue}}f+=w[R]}return f}function U(w){let m="";for(let f=0;f<w.length;f++){let R=w[f];if(R==="%"&&f+2<w.length){let I=w.slice(f+1,f+3);if(s(I)){let Z=I.toUpperCase(),W=String.fromCharCode(parseInt(Z,16));W!=="."&&i(W)?m+=W:m+="%"+Z,f+=2;continue}}if(c(R))m+=R;else{let I=w.charCodeAt(f);if(I<128)m+=Ee(I)?R:l[I];else if(I<55296||I>57343)m+=d(I);else if(I<=56319&&f+1<w.length){let Z=w.charCodeAt(f+1);Z>=56320&&Z<=57343?(m+=d(65536+(I-55296<<10)+(Z-56320)),f++):m+=d(65533)}else m+=d(65533)}}return m}function K(w,m=!1){let f="",R=m&&w[0]!=="/";for(let I=0;I<w.length;I++){let Z=w[I];if(Z==="%"&&I+2<w.length){let W=w.slice(I+1,I+3);if(s(W)){f+="%"+W.toUpperCase(),I+=2;continue}}if(Z==="/"&&(R=!1),c(Z)&&(Z!==":"||!R))f+=Z;else{let W=w.charCodeAt(I);if(W<128)f+=l[W];else if(W<55296||W>57343)f+=d(W);else if(W<=56319&&I+1<w.length){let G=w.charCodeAt(I+1);G>=56320&&G<=57343?(f+=d(65536+(W-55296<<10)+(G-56320)),I++):f+=d(65533)}else f+=d(65533)}}return f}function J(w,m){let f="";for(let R=0;R<w.length;R++){let I=w[R];if(I==="%"&&R+2<w.length){let Z=w.slice(R+1,R+3);if(s(Z)){f+="%"+Z.toUpperCase(),R+=2;continue}}if(m(I))f+=I;else{let Z=w.charCodeAt(R);if(Z<128)f+=l[Z];else if(Z<55296||Z>57343)f+=d(Z);else if(Z<=56319&&R+1<w.length){let W=w.charCodeAt(R+1);W>=56320&&W<=57343?(f+=d(65536+(Z-55296<<10)+(W-56320)),R++):f+=d(65533)}else f+=d(65533)}}return f}function de(w){return J(w,u)}function ve(w){return J(w,a)}function ye(w){return J(w,a)}function Ee(w){return w>=48&&w<=57||w>=65&&w<=90||w>=97&&w<=122||w===42||w===43||w===45||w===46||w===47||w===64||w===95}function fe(w){let m="";for(let f=0;f<w.length;f++){let R=w[f];if(R==="%"&&f+2<w.length){let I=w.slice(f+1,f+3);if(s(I)){let Z=I.toUpperCase(),W=String.fromCharCode(parseInt(Z,16));i(W)?m+=W:m+="%"+Z,f+=2;continue}}if(a(R))m+=R;else{let I=w.charCodeAt(f);if(I<128)m+=Ee(I)?R:l[I];else if(I<55296||I>57343)m+=d(I);else if(I<=56319&&f+1<w.length){let Z=w.charCodeAt(f+1);Z>=56320&&Z<=57343?(m+=d(65536+(I-55296<<10)+(Z-56320)),f++):m+=d(65533)}else m+=d(65533)}}return m}function x(w){let m="";for(let f=0;f<w.length;f++){if(w[f]==="%"&&f+2<w.length){let R=w.slice(f+1,f+3);if(s(R)){m+="%"+R.toUpperCase(),f+=2;continue}}m+=escape(w[f])}return m}function M(w){let m=[];if(w.userinfo!==void 0&&(m.push(de(w.userinfo)),m.push("@")),w.host!==void 0){let f=w.host;if(!o(f)){let R=E(f);R.isIPV6!==!0&&R.isIPVFuture!==!0&&(f=L(f,!0),R=E(f)),R.isIPV6===!0||R.isIPVFuture===!0?f=`[${R.escapedHost}]`:f=F(f,!1)}m.push(f)}if(typeof w.port=="number"||typeof w.port=="string"){let f=String(w.port);if(!n(f))throw new TypeError("URI port is malformed.");m.push(":"),m.push(f)}return m.length?m.join(""):void 0}t.exports={nonSimpleDomain:b,recomposeAuthority:M,reescapeHostDelimiters:F,normalizePercentEncoding:L,normalizePathEncoding:U,serializePathEncoding:K,normalizeQueryFragmentEncoding:fe,encodeUserinfo:de,encodeQuery:ve,encodeFragment:ye,escapePreservingEscapes:x,removeDotSegments:v,isIPv4:o,isUUID:r,normalizeIPv6:E,stringArrayToHexStripped:h}})),ew=H(((e,t)=>{let{isUUID:r}=P_(),o=/^([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-./:;=@]|%[\da-f]{2})+)$/iu,n=["http","https","ws","wss","urn","urn:uuid"];function s(S){return n.indexOf(S)!==-1}function i(S){return S.secure===!0?!0:S.secure===!1?!1:S.scheme?S.scheme.length===3&&(S.scheme[0]==="w"||S.scheme[0]==="W")&&(S.scheme[1]==="s"||S.scheme[1]==="S")&&(S.scheme[2]==="s"||S.scheme[2]==="S"):!1}function c(S){return S.host||(S.error=S.error||"HTTP URIs must have a host."),S}function a(S){let T=String(S.scheme).toLowerCase()==="https";return(S.port===(T?443:80)||S.port==="")&&(S.port=void 0),S.path||(S.path="/"),S}function u(S){return S.secure=i(S),S.resourceName=(S.path||"/")+(S.query?"?"+S.query:""),S.path=void 0,S.query=void 0,S}function l(S){if((S.port===(i(S)?443:80)||S.port==="")&&(S.port=void 0),typeof S.secure=="boolean"&&(S.scheme=S.secure?"wss":"ws",S.secure=void 0),S.resourceName){let T=S.resourceName.indexOf("?"),A=T===-1?S.resourceName:S.resourceName.slice(0,T);S.path=A&&A!=="/"?A:void 0,S.query=T===-1?void 0:S.resourceName.slice(T+1),S.resourceName=void 0}return S.fragment=void 0,S}function d(S,T){if(!S.path)return S.error="URN can not be parsed",S;let A=S.path.match(o);if(A&&A[0]===S.path){let F=T.scheme||S.scheme||"urn";S.nid=A[1].toLowerCase(),S.nss=A[2];let L=v(`${F}:${T.nid||S.nid}`);S.path=void 0,L&&(S=L.parse(S,T))}else S.error=S.error||"URN can not be parsed.";return S}function h(S,T){if(S.nid===void 0)throw new Error("URN without nid cannot be serialized");let A=T.scheme||S.scheme||"urn",F=S.nid.toLowerCase(),L=v(`${A}:${T.nid||F}`);L&&(S=L.serialize(S,T));let U=S,K=S.nss;return U.path=`${F||T.nid}:${K}`,T.skipEscape=!0,U}function _(S,T){let A=S;return A.uuid=A.nss,A.nss=void 0,!T.tolerant&&(!A.uuid||!r(A.uuid))&&(A.error=A.error||"UUID is not valid."),A}function y(S){let T=S;return T.nss=(S.uuid||"").toLowerCase(),T}let z={scheme:"http",domainHost:!0,parse:c,serialize:a},b={scheme:"https",domainHost:z.domainHost,parse:c,serialize:a},g={scheme:"ws",domainHost:!0,parse:u,serialize:l},P={scheme:"wss",domainHost:g.domainHost,parse:g.parse,serialize:g.serialize},k={http:z,https:b,ws:g,wss:P,urn:{scheme:"urn",parse:d,serialize:h,skipNormalize:!0},"urn:uuid":{scheme:"urn:uuid",parse:_,serialize:y,skipNormalize:!0}};Object.setPrototypeOf(k,null);function v(S){return S&&(k[S]||k[S.toLowerCase()])||void 0}t.exports={wsIsSecure:i,SCHEMES:k,isValidSchemeName:s,getSchemeHandler:v}})),tw=H(((e,t)=>{let{normalizeIPv6:r,removeDotSegments:o,recomposeAuthority:n,normalizePercentEncoding:s,normalizePathEncoding:i,serializePathEncoding:c,normalizeQueryFragmentEncoding:a,encodeQuery:u,encodeFragment:l,reescapeHostDelimiters:d,isIPv4:h,nonSimpleDomain:_}=P_(),{SCHEMES:y,getSchemeHandler:z}=ew(),b=/^[A-Za-z][A-Za-z0-9+.-]*$/u,g="URI scheme is malformed.";function P(w){let m=unescape(String(w));if(!b.test(m))throw new TypeError(g);return m}function $(w,m){return typeof w=="string"?w=Ee(w,m):typeof w=="object"&&(w=ye(S(w,m),m)),w}function E(w,m,f){let R=f?Object.assign({scheme:"null"},f):{scheme:"null"},{parsed:I,malformedAuthorityOrPort:Z,malformedPercentEncoding:W,malformedSchemeSpecific:G,malformedHost:me,malformedScheme:ze}=ve(w,R),{parsed:C,malformedAuthorityOrPort:q,malformedPercentEncoding:V,malformedSchemeSpecific:te,malformedHost:oe,malformedScheme:ie}=ve(m,R);if(Z||q||W||V||G||te||me||oe||ze||ie)throw new Error(I.error||C.error||"URI is malformed.");let ge=k(I,C,R,!0),Ce=z(f&&f.scheme||ge.scheme),we=ge.host,Ie=we!==void 0&&we!==""&&(h(we)||r(we).isIPV6);de(ge,f||{},Ce,Ie);let Te=we&&we.indexOf("%")!==-1&&!new RegExp("\\P{ASCII}","u").test(we);if(ge.error&&!Te)throw new Error(ge.error);return R.skipEscape=!0,S(ge,R)}function k(w,m,f,R){let I={};return R||(w=ye(S(w,f),f),m=ye(S(m,f),f)),f=f||{},!f.tolerant&&m.scheme?(I.scheme=m.scheme,I.userinfo=m.userinfo,I.host=m.host,I.port=m.port,I.path=o(m.path||""),I.query=m.query):(m.userinfo!==void 0||m.host!==void 0||m.port!==void 0?(I.userinfo=m.userinfo,I.host=m.host,I.port=m.port,I.path=o(m.path||""),I.query=m.query):(m.path?(m.path[0]==="/"?I.path=o(m.path):((w.userinfo!==void 0||w.host!==void 0||w.port!==void 0)&&!w.path?I.path="/"+m.path:w.path?I.path=w.path.slice(0,w.path.lastIndexOf("/")+1)+m.path:I.path=m.path,I.path=o(I.path)),I.query=m.query):(I.path=w.path,m.query!==void 0?I.query=m.query:I.query=w.query),I.userinfo=w.userinfo,I.host=w.host,I.port=w.port),I.scheme=w.scheme),I.fragment=m.fragment,I}function v(w,m,f){let R=x(w,f),I=x(m,f);return R!==void 0&&I!==void 0&&R===I}function S(w,m){let f={host:w.host,scheme:w.scheme,userinfo:w.userinfo,port:w.port,path:w.path,query:w.query,nid:w.nid,nss:w.nss,uuid:w.uuid,fragment:w.fragment,reference:w.reference,resourceName:w.resourceName,secure:w.secure,error:""},R=Object.assign({},m),I=[];f.scheme&&(f.scheme=P(f.scheme));let Z=z(R.scheme||f.scheme);Z&&Z.serialize&&Z.serialize(f,R);let W=f.userinfo!==void 0||f.host!==void 0||f.port!==void 0,G=!R.skipEscape&&f.scheme===void 0&&!W;f.path!==void 0&&(R.skipEscape?f.path=s(f.path):f.path=c(f.path,G)),R.reference!=="suffix"&&f.scheme&&(f.scheme=P(f.scheme),I.push(f.scheme,":"));let me=n(f);if(me!==void 0&&(R.reference!=="suffix"&&I.push("//"),I.push(me),f.path&&f.path[0]!=="/"&&I.push("/")),f.path!==void 0){let ze=f.path;!R.absolutePath&&(!Z||!Z.absolutePath)&&(ze=o(ze)),G&&(ze=c(ze,!0)),me===void 0&&ze[0]==="/"&&ze[1]==="/"&&(ze="/%2F"+ze.slice(2)),I.push(ze)}return f.query!==void 0&&I.push("?",u(f.query)),f.fragment!==void 0&&I.push("#",l(f.fragment)),I.join("")}let T=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u,A=/^(?:[^#/:?]+:)?\/\/([^/?#]*)/,F=/^(?:[^#/:?]+:)?([/\\\t\n\r]*)/;function L(w,m){if(m[2]!==void 0&&w.path&&w.path[0]!=="/")return'URI path must start with "/" when authority is present.';if(typeof w.port=="number"&&(w.port<0||w.port>65535))return"URI port is malformed."}function U(w){if(w===void 0)return!1;let m=w.indexOf("%");for(;m!==-1;){if(m+2>=w.length||!/^[\da-f]{2}$/iu.test(w.slice(m+1,m+3)))return!0;m=w.indexOf("%",m+3)}return!1}function K(w){return w[0]==="["&&w[w.length-1]==="]"}function J(w){let m=w[4];return U(w[3])||m!==void 0&&!K(m)&&U(m)||U(w[6])||U(w[7])||U(w[8])}function de(w,m,f,R){if(!m.unicodeSupport&&(!f||!f.unicodeSupport)&&w.host&&!K(w.host)&&(m.domainHost||f&&f.domainHost)&&R===!1&&_(w.host))try{w.host=new URL("http://"+w.host).hostname}catch(I){return w.error=w.error||"Host's domain name can not be converted to ASCII: "+I,!0}return!1}function ve(w,m){let f=Object.assign({},m),R={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0},I=!1,Z=!1,W=!1,G=!1,me=!1,ze=!1,C=!1;f.reference==="suffix"&&(f.scheme?w=f.scheme+":"+w:w="//"+w);let q=w.match(A);q!==null&&q[1].indexOf("\\")!==-1&&(R.error="URI authority must not contain a literal backslash.",I=!0);let V=w.match(F);if(V!==null){let oe=V[1],ie=oe.replace(/[\t\n\r]/g,"");ie.length>=2&&(ie.slice(0,2)!=="//"?(R.error=R.error||"URI authority must not contain a literal backslash.",I=!0):oe.length!==ie.length&&(R.error=R.error||"URI authority introducer must not contain whitespace.",I=!0))}let te=w.match(T);if(te){if(R.scheme=te[1],R.userinfo=te[3],R.host=te[4],R.port=parseInt(te[5],10),R.path=te[6]||"",R.query=te[7],R.fragment=te[8],R.scheme!==void 0){let ge=unescape(R.scheme);b.test(ge)?R.scheme=ge.toLowerCase():(R.error=R.error||g,ze=!0)}Z=J(te),Z&&(R.error=R.error||"URI contains malformed percent-encoding."),isNaN(R.port)&&(R.port=te[5]);let oe=L(R,te);if(oe!==void 0&&(R.error=R.error||oe,I=!0),R.host)if(h(R.host)===!1){let ge=K(R.host),Ce=R.host.indexOf("[")!==-1||R.host.indexOf("]")!==-1,we=r(R.host);C=we.isIPV6||we.isIPVFuture===!0,me=Ce&&(!ge||we.error===!0),R.host=C?we.host:we.host.toLowerCase(),me&&(R.error=R.error||"URI host is malformed.",I=!0)}else C=!0;R.scheme===void 0&&R.userinfo===void 0&&R.host===void 0&&R.port===void 0&&R.query===void 0&&!R.path?R.reference="same-document":R.scheme===void 0?R.reference="relative":R.fragment===void 0?R.reference="absolute":R.reference="uri",f.reference&&f.reference!=="suffix"&&f.reference!==R.reference&&(R.error=R.error||"URI is not a "+f.reference+" reference.");let ie=z(f.scheme||R.scheme);if(me||(G=de(R,f,ie,C)),w.indexOf("%")!==-1&&R.host!==void 0&&!me){let ge=C?R.host:s(R.host,!0);C||(ge=s(ge.toLowerCase())),R.host=d(ge,C)}(!ie||ie&&!ie.skipNormalize)&&(R.path&&(R.path=i(R.path)),R.query&&(R.query=a(R.query)),R.fragment&&(R.fragment=a(R.fragment))),ie&&ie.parse&&(ie.parse(R,f),ie===y.urn&&R.nid===void 0&&(W=!0))}else R.error=R.error||"URI can not be parsed.";return{parsed:R,malformedAuthorityOrPort:I,malformedPercentEncoding:Z,malformedSchemeSpecific:W,malformedHost:G,malformedScheme:ze}}function ye(w,m){return ve(w,m).parsed}function Ee(w,m){return fe(w,m).normalized}function fe(w,m){let{parsed:f,malformedAuthorityOrPort:R,malformedPercentEncoding:I,malformedSchemeSpecific:Z,malformedHost:W,malformedScheme:G}=ve(w,m);return{normalized:R||I||Z||W||G?w:S(f,m),malformedAuthorityOrPort:R,malformedPercentEncoding:I,malformedSchemeSpecific:Z,malformedHost:W,malformedScheme:G}}function x(w,m){if(typeof w!="string"&&typeof w!="object")return;let f;try{f=typeof w=="string"?w:S(w,m)}catch{return}let{normalized:R,malformedAuthorityOrPort:I,malformedPercentEncoding:Z,malformedSchemeSpecific:W,malformedHost:G,malformedScheme:me}=fe(f,m);return I||Z||W||G||me?void 0:R}let M={SCHEMES:y,normalize:$,resolve:E,resolveComponent:k,equal:v,serialize:S,parse:ye};t.exports=M,t.exports.default=M,t.exports.fastUri=M})),rw=H((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=tw();t.code='require("ajv/dist/runtime/uri").default',e.default=t})),rd=H((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.CodeGen=e.Name=e.nil=e.stringify=e.str=e._=e.KeywordCxt=void 0;var t=So();Object.defineProperty(e,"KeywordCxt",{enumerable:!0,get:function(){return t.KeywordCxt}});var r=he();Object.defineProperty(e,"_",{enumerable:!0,get:function(){return r._}}),Object.defineProperty(e,"str",{enumerable:!0,get:function(){return r.str}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return r.stringify}}),Object.defineProperty(e,"nil",{enumerable:!0,get:function(){return r.nil}}),Object.defineProperty(e,"Name",{enumerable:!0,get:function(){return r.Name}}),Object.defineProperty(e,"CodeGen",{enumerable:!0,get:function(){return r.CodeGen}});let o=is(),n=yo(),s=w_(),i=dc(),c=he(),a=lc(),u=cc(),l=Se(),d=Q0(),h=rw(),_=(x,M)=>new RegExp(x,M);_.code="new RegExp";let y=["removeAdditional","useDefaults","coerceTypes"],z=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),b={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."},g={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},P=200;function $(x){var M,w,m,f,R,I,Z,W,G,me,ze,C,q,V,te,oe,ie,ge,Ce,we,Ie,Te,st,qe,vt;let ct=x.strict,bt=(M=x.code)===null||M===void 0?void 0:M.optimize,At=bt===!0||bt===void 0?1:bt||0,jt=(m=(w=x.code)===null||w===void 0?void 0:w.regExp)!==null&&m!==void 0?m:_,or=(f=x.uriResolver)!==null&&f!==void 0?f:h.default;return{strictSchema:(I=(R=x.strictSchema)!==null&&R!==void 0?R:ct)!==null&&I!==void 0?I:!0,strictNumbers:(W=(Z=x.strictNumbers)!==null&&Z!==void 0?Z:ct)!==null&&W!==void 0?W:!0,strictTypes:(me=(G=x.strictTypes)!==null&&G!==void 0?G:ct)!==null&&me!==void 0?me:"log",strictTuples:(C=(ze=x.strictTuples)!==null&&ze!==void 0?ze:ct)!==null&&C!==void 0?C:"log",strictRequired:(V=(q=x.strictRequired)!==null&&q!==void 0?q:ct)!==null&&V!==void 0?V:!1,code:x.code?{...x.code,optimize:At,regExp:jt}:{optimize:At,regExp:jt},loopRequired:(te=x.loopRequired)!==null&&te!==void 0?te:P,loopEnum:(oe=x.loopEnum)!==null&&oe!==void 0?oe:P,meta:(ie=x.meta)!==null&&ie!==void 0?ie:!0,messages:(ge=x.messages)!==null&&ge!==void 0?ge:!0,inlineRefs:(Ce=x.inlineRefs)!==null&&Ce!==void 0?Ce:!0,schemaId:(we=x.schemaId)!==null&&we!==void 0?we:"$id",addUsedSchema:(Ie=x.addUsedSchema)!==null&&Ie!==void 0?Ie:!0,validateSchema:(Te=x.validateSchema)!==null&&Te!==void 0?Te:!0,validateFormats:(st=x.validateFormats)!==null&&st!==void 0?st:!0,unicodeRegExp:(qe=x.unicodeRegExp)!==null&&qe!==void 0?qe:!0,int32range:(vt=x.int32range)!==null&&vt!==void 0?vt:!0,uriResolver:or}}var E=class{constructor(x={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,x=this.opts={...x,...$(x)};let{es5:M,lines:w}=this.opts.code;this.scope=new c.ValueScope({scope:{},prefixes:z,es5:M,lines:w}),this.logger=U(x.logger);let m=x.validateFormats;x.validateFormats=!1,this.RULES=(0,s.getRules)(),k.call(this,b,x,"NOT SUPPORTED"),k.call(this,g,x,"DEPRECATED","warn"),this._metaOpts=F.call(this),x.formats&&T.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),x.keywords&&A.call(this,x.keywords),typeof x.meta=="object"&&this.addMetaSchema(x.meta),S.call(this),x.validateFormats=m}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:x,meta:M,schemaId:w}=this.opts,m=d;w==="id"&&(m={...d},m.id=m.$id,delete m.$id),M&&x&&this.addMetaSchema(m,m[w],!1)}defaultMeta(){let{meta:x,schemaId:M}=this.opts;return this.opts.defaultMeta=typeof x=="object"?x[M]||x:void 0}validate(x,M){let w;if(typeof x=="string"){if(w=this.getSchema(x),!w)throw new Error(`no schema with key or ref "${x}"`)}else w=this.compile(x);let m=w(M);return"$async"in w||(this.errors=w.errors),m}compile(x,M){let w=this._addSchema(x,M);return w.validate||this._compileSchemaEnv(w)}compileAsync(x,M){if(typeof this.opts.loadSchema!="function")throw new Error("options.loadSchema should be a function");let{loadSchema:w}=this.opts;return m.call(this,x,M);async function m(G,me){await f.call(this,G.$schema);let ze=this._addSchema(G,me);return ze.validate||R.call(this,ze)}async function f(G){G&&!this.getSchema(G)&&await m.call(this,{$ref:G},!0)}async function R(G){try{return this._compileSchemaEnv(G)}catch(me){if(!(me instanceof n.default))throw me;return I.call(this,me),await Z.call(this,me.missingSchema),R.call(this,G)}}function I({missingSchema:G,missingRef:me}){if(this.refs[G])throw new Error(`AnySchema ${G} is loaded but ${me} cannot be resolved`)}async function Z(G){let me=await W.call(this,G);this.refs[G]||await f.call(this,me.$schema),this.refs[G]||this.addSchema(me,G,M)}async function W(G){let me=this._loading[G];if(me)return me;try{return await(this._loading[G]=w(G))}finally{delete this._loading[G]}}}addSchema(x,M,w,m=this.opts.validateSchema){if(Array.isArray(x)){for(let R of x)this.addSchema(R,void 0,w,m);return this}let f;if(typeof x=="object"){let{schemaId:R}=this.opts;if(f=x[R],f!==void 0&&typeof f!="string")throw new Error(`schema ${R} must be string`)}return M=(0,a.normalizeId)(M||f),this._checkUnique(M),this.schemas[M]=this._addSchema(x,w,M,m,!0),this}addMetaSchema(x,M,w=this.opts.validateSchema){return this.addSchema(x,M,!0,w),this}validateSchema(x,M){if(typeof x=="boolean")return!0;let w;if(w=x.$schema,w!==void 0&&typeof w!="string")throw new Error("$schema must be a string");if(w=w||this.opts.defaultMeta||this.defaultMeta(),!w)return this.logger.warn("meta-schema not available"),this.errors=null,!0;let m=this.validate(w,x);if(!m&&M){let f="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(f);else throw new Error(f)}return m}getSchema(x){let M;for(;typeof(M=v.call(this,x))=="string";)x=M;if(M===void 0){let{schemaId:w}=this.opts,m=new i.SchemaEnv({schema:{},schemaId:w});if(M=i.resolveSchema.call(this,m,x),!M)return;this.refs[x]=M}return M.validate||this._compileSchemaEnv(M)}removeSchema(x){if(x instanceof RegExp)return this._removeAllSchemas(this.schemas,x),this._removeAllSchemas(this.refs,x),this;switch(typeof x){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{let M=v.call(this,x);return typeof M=="object"&&this._cache.delete(M.schema),delete this.schemas[x],delete this.refs[x],this}case"object":{let M=x;this._cache.delete(M);let w=x[this.opts.schemaId];return w&&(w=(0,a.normalizeId)(w),delete this.schemas[w],delete this.refs[w]),this}default:throw new Error("ajv.removeSchema: invalid parameter")}}addVocabulary(x){for(let M of x)this.addKeyword(M);return this}addKeyword(x,M){let w;if(typeof x=="string")w=x,typeof M=="object"&&(this.logger.warn("these parameters are deprecated, see docs for addKeyword"),M.keyword=w);else if(typeof x=="object"&&M===void 0){if(M=x,w=M.keyword,Array.isArray(w)&&!w.length)throw new Error("addKeywords: keyword must be string or non-empty array")}else throw new Error("invalid addKeywords parameters");if(J.call(this,w,M),!M)return(0,l.eachItem)(w,f=>de.call(this,f)),this;ye.call(this,M);let m={...M,type:(0,u.getJSONTypes)(M.type),schemaType:(0,u.getJSONTypes)(M.schemaType)};return(0,l.eachItem)(w,m.type.length===0?f=>de.call(this,f,m):f=>m.type.forEach(R=>de.call(this,f,m,R))),this}getKeyword(x){let M=this.RULES.all[x];return typeof M=="object"?M.definition:!!M}removeKeyword(x){let{RULES:M}=this;delete M.keywords[x],delete M.all[x];for(let w of M.rules){let m=w.rules.findIndex(f=>f.keyword===x);m>=0&&w.rules.splice(m,1)}return this}addFormat(x,M){return typeof M=="string"&&(M=new RegExp(M)),this.formats[x]=M,this}errorsText(x=this.errors,{separator:M=", ",dataVar:w="data"}={}){return!x||x.length===0?"No errors":x.map(m=>`${w}${m.instancePath} ${m.message}`).reduce((m,f)=>m+M+f)}$dataMetaSchema(x,M){let w=this.RULES.all;x=JSON.parse(JSON.stringify(x));for(let m of M){let f=m.split("/").slice(1),R=x;for(let I of f)R=R[I];for(let I in w){let Z=w[I];if(typeof Z!="object")continue;let{$data:W}=Z.definition,G=R[I];W&&G&&(R[I]=fe(G))}}return x}_removeAllSchemas(x,M){for(let w in x){let m=x[w];(!M||M.test(w))&&(typeof m=="string"?delete x[w]:m&&!m.meta&&(this._cache.delete(m.schema),delete x[w]))}}_addSchema(x,M,w,m=this.opts.validateSchema,f=this.opts.addUsedSchema){let R,{schemaId:I}=this.opts;if(typeof x=="object")R=x[I];else{if(this.opts.jtd)throw new Error("schema must be object");if(typeof x!="boolean")throw new Error("schema must be object or boolean")}let Z=this._cache.get(x);if(Z!==void 0)return Z;w=(0,a.normalizeId)(R||w);let W=a.getSchemaRefs.call(this,x,w);return Z=new i.SchemaEnv({schema:x,schemaId:I,meta:M,baseId:w,localRefs:W}),this._cache.set(Z.schema,Z),f&&!w.startsWith("#")&&(w&&this._checkUnique(w),this.refs[w]=Z),m&&this.validateSchema(x,!0),Z}_checkUnique(x){if(this.schemas[x]||this.refs[x])throw new Error(`schema with key or id "${x}" already exists`)}_compileSchemaEnv(x){if(x.meta?this._compileMetaSchema(x):i.compileSchema.call(this,x),!x.validate)throw new Error("ajv implementation error");return x.validate}_compileMetaSchema(x){let M=this.opts;this.opts=this._metaOpts;try{i.compileSchema.call(this,x)}finally{this.opts=M}}};E.ValidationError=o.default,E.MissingRefError=n.default,e.default=E;function k(x,M,w,m="error"){for(let f in x){let R=f;R in M&&this.logger[m](`${w}: option ${f}. ${x[R]}`)}}function v(x){return x=(0,a.normalizeId)(x),this.schemas[x]||this.refs[x]}function S(){let x=this.opts.schemas;if(x)if(Array.isArray(x))this.addSchema(x);else for(let M in x)this.addSchema(x[M],M)}function T(){for(let x in this.opts.formats){let M=this.opts.formats[x];M&&this.addFormat(x,M)}}function A(x){if(Array.isArray(x)){this.addVocabulary(x);return}this.logger.warn("keywords option as map is deprecated, pass array");for(let M in x){let w=x[M];w.keyword||(w.keyword=M),this.addKeyword(w)}}function F(){let x={...this.opts};for(let M of y)delete x[M];return x}let L={log(){},warn(){},error(){}};function U(x){if(x===!1)return L;if(x===void 0)return console;if(x.log&&x.warn&&x.error)return x;throw new Error("logger must implement log, warn and error methods")}let K=/^[a-z_$][a-z0-9_$:-]*$/i;function J(x,M){let{RULES:w}=this;if((0,l.eachItem)(x,m=>{if(w.keywords[m])throw new Error(`Keyword ${m} is already defined`);if(!K.test(m))throw new Error(`Keyword ${m} has invalid name`)}),!!M&&M.$data&&!("code"in M||"validate"in M))throw new Error('$data keyword must have "code" or "validate" function')}function de(x,M,w){var m;let f=M?.post;if(w&&f)throw new Error('keyword with "post" flag cannot have "type"');let{RULES:R}=this,I=f?R.post:R.rules.find(({type:W})=>W===w);if(I||(I={type:w,rules:[]},R.rules.push(I)),R.keywords[x]=!0,!M)return;let Z={keyword:x,definition:{...M,type:(0,u.getJSONTypes)(M.type),schemaType:(0,u.getJSONTypes)(M.schemaType)}};M.before?ve.call(this,I,Z,M.before):I.rules.push(Z),R.all[x]=Z,(m=M.implements)===null||m===void 0||m.forEach(W=>this.addKeyword(W))}function ve(x,M,w){let m=x.rules.findIndex(f=>f.keyword===w);m>=0?x.rules.splice(m,0,M):(x.rules.push(M),this.logger.warn(`rule ${w} is not defined`))}function ye(x){let{metaSchema:M}=x;M!==void 0&&(x.$data&&this.opts.$data&&(M=fe(M)),x.validateSchema=this.compile(M,!0))}let Ee={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function fe(x){return{anyOf:[x,Ee]}}})),ow=H((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t={keyword:"id",code(){throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};e.default=t})),od=H((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.callRef=e.getValidate=void 0;let t=yo(),r=ft(),o=he(),n=ht(),s=dc(),i=Se(),c={keyword:"$ref",schemaType:"string",code(l){let{gen:d,schema:h,it:_}=l,{baseId:y,schemaEnv:z,validateName:b,opts:g,self:P}=_,{root:$}=z;if((h==="#"||h==="#/")&&y===$.baseId)return k();let E=s.resolveRef.call(P,$,y,h);if(E===void 0)throw new t.default(_.opts.uriResolver,y,h);if(E instanceof s.SchemaEnv)return v(E);return S(E);function k(){if(z===$)return u(l,b,z,z.$async);let T=d.scopeValue("root",{ref:$});return u(l,(0,o._)`${T}.validate`,$,$.$async)}function v(T){u(l,a(l,T),T,T.$async)}function S(T){let A=d.scopeValue("schema",g.code.source===!0?{ref:T,code:(0,o.stringify)(T)}:{ref:T}),F=d.name("valid"),L=l.subschema({schema:T,dataTypes:[],schemaPath:o.nil,topSchemaRef:A,errSchemaPath:h},F);l.mergeEvaluated(L),l.ok(F)}}};function a(l,d){let{gen:h}=l;return d.validate?h.scopeValue("validate",{ref:d.validate}):(0,o._)`${h.scopeValue("wrapper",{ref:d})}.validate`}e.getValidate=a;function u(l,d,h,_){let{gen:y,it:z}=l,{allErrors:b,schemaEnv:g,opts:P}=z,$=P.passContext?n.default.this:o.nil;_?E():k();function E(){if(!g.$async)throw new Error("async schema referenced by sync schema");let T=y.let("valid");y.try(()=>{y.code((0,o._)`await ${(0,r.callValidateCode)(l,d,$)}`),S(d),b||y.assign(T,!0)},A=>{y.if((0,o._)`!(${A} instanceof ${z.ValidationError})`,()=>y.throw(A)),v(A),b||y.assign(T,!1)}),l.ok(T)}function k(){l.result((0,r.callValidateCode)(l,d,$),()=>S(d),()=>v(d))}function v(T){let A=(0,o._)`${T}.errors`;y.assign(n.default.vErrors,(0,o._)`${n.default.vErrors} === null ? ${A} : ${n.default.vErrors}.concat(${A})`),y.assign(n.default.errors,(0,o._)`${n.default.vErrors}.length`)}function S(T){var A;if(!z.opts.unevaluated)return;let F=(A=h?.validate)===null||A===void 0?void 0:A.evaluated;if(z.props!==!0)if(F&&!F.dynamicProps)F.props!==void 0&&(z.props=i.mergeEvaluated.props(y,F.props,z.props));else{let L=y.var("props",(0,o._)`${T}.evaluated.props`);z.props=i.mergeEvaluated.props(y,L,z.props,o.Name)}if(z.items!==!0)if(F&&!F.dynamicItems)F.items!==void 0&&(z.items=i.mergeEvaluated.items(y,F.items,z.items));else{let L=y.var("items",(0,o._)`${T}.evaluated.items`);z.items=i.mergeEvaluated.items(y,L,z.items,o.Name)}}}e.callRef=u,e.default=c})),E_=H((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=ow(),r=od(),o=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",t.default,r.default];e.default=o})),nw=H((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=he(),r=t.operators,o={maximum:{okStr:"<=",ok:r.LTE,fail:r.GT},minimum:{okStr:">=",ok:r.GTE,fail:r.LT},exclusiveMaximum:{okStr:"<",ok:r.LT,fail:r.GTE},exclusiveMinimum:{okStr:">",ok:r.GT,fail:r.LTE}},n={keyword:Object.keys(o),type:"number",schemaType:"number",$data:!0,error:{message:({keyword:s,schemaCode:i})=>(0,t.str)`must be ${o[s].okStr} ${i}`,params:({keyword:s,schemaCode:i})=>(0,t._)`{comparison: ${o[s].okStr}, limit: ${i}}`},code(s){let{keyword:i,data:c,schemaCode:a}=s;s.fail$data((0,t._)`${c} ${o[i].fail} ${a} || isNaN(${c})`)}};e.default=n})),sw=H((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=he(),r={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:{message:({schemaCode:o})=>(0,t.str)`must be multiple of ${o}`,params:({schemaCode:o})=>(0,t._)`{multipleOf: ${o}}`},code(o){let{gen:n,data:s,schemaCode:i,it:c}=o,a=c.opts.multipleOfPrecision,u=n.let("res"),l=a?(0,t._)`Math.abs(Math.round(${u}) - ${u}) > 1e-${a}`:(0,t._)`${u} !== parseInt(${u})`;o.fail$data((0,t._)`(${i} === 0 || (${u} = ${s}/${i}, ${l}))`)}};e.default=r})),iw=H((e=>{Object.defineProperty(e,"__esModule",{value:!0});function t(r){let o=r.length,n=0,s=0,i;for(;s<o;)n++,i=r.charCodeAt(s++),i>=55296&&i<=56319&&s<o&&(i=r.charCodeAt(s),(i&64512)===56320&&s++);return n}e.default=t,t.code='require("ajv/dist/runtime/ucs2length").default'})),aw=H((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=he(),r=Se(),o=iw(),n={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:{message({keyword:s,schemaCode:i}){let c=s==="maxLength"?"more":"fewer";return(0,t.str)`must NOT have ${c} than ${i} characters`},params:({schemaCode:s})=>(0,t._)`{limit: ${s}}`},code(s){let{keyword:i,data:c,schemaCode:a,it:u}=s,l=i==="maxLength"?t.operators.GT:t.operators.LT,d=u.opts.unicode===!1?(0,t._)`${c}.length`:(0,t._)`${(0,r.useFunc)(s.gen,o.default)}(${c})`;s.fail$data((0,t._)`${d} ${l} ${a}`)}};e.default=n})),cw=H((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=ft(),r=Se(),o=he(),n={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:{message:({schemaCode:s})=>(0,o.str)`must match pattern "${s}"`,params:({schemaCode:s})=>(0,o._)`{pattern: ${s}}`},code(s){let{gen:i,data:c,$data:a,schema:u,schemaCode:l,it:d}=s,h=d.opts.unicodeRegExp?"u":"";if(a){let{regExp:_}=d.opts.code,y=_.code==="new RegExp"?(0,o._)`new RegExp`:(0,r.useFunc)(i,_),z=i.let("valid");i.try(()=>i.assign(z,(0,o._)`${y}(${l}, ${h}).test(${c})`),()=>i.assign(z,!1)),s.fail$data((0,o._)`!${z}`)}else{let _=(0,t.usePattern)(s,u);s.fail$data((0,o._)`!${_}.test(${c})`)}}};e.default=n})),uw=H((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=he(),r={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:{message({keyword:o,schemaCode:n}){let s=o==="maxProperties"?"more":"fewer";return(0,t.str)`must NOT have ${s} than ${n} properties`},params:({schemaCode:o})=>(0,t._)`{limit: ${o}}`},code(o){let{keyword:n,data:s,schemaCode:i}=o,c=n==="maxProperties"?t.operators.GT:t.operators.LT;o.fail$data((0,t._)`Object.keys(${s}).length ${c} ${i}`)}};e.default=r})),lw=H((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=ft(),r=he(),o=Se(),n={keyword:"required",type:"object",schemaType:"array",$data:!0,error:{message:({params:{missingProperty:s}})=>(0,r.str)`must have required property '${s}'`,params:({params:{missingProperty:s}})=>(0,r._)`{missingProperty: ${s}}`},code(s){let{gen:i,schema:c,schemaCode:a,data:u,$data:l,it:d}=s,{opts:h}=d;if(!l&&c.length===0)return;let _=c.length>=h.loopRequired;if(d.allErrors?y():z(),h.strictRequired){let P=s.parentSchema.properties,{definedProperties:$}=s.it;for(let E of c)if(P?.[E]===void 0&&!$.has(E)){let k=`required property "${E}" is not defined at "${d.schemaEnv.baseId+d.errSchemaPath}" (strictRequired)`;(0,o.checkStrictMode)(d,k,d.opts.strictRequired)}}function y(){if(_||l)s.block$data(r.nil,b);else for(let P of c)(0,t.checkReportMissingProp)(s,P)}function z(){let P=i.let("missing");if(_||l){let $=i.let("valid",!0);s.block$data($,()=>g(P,$)),s.ok($)}else i.if((0,t.checkMissingProp)(s,c,P)),(0,t.reportMissingProp)(s,P),i.else()}function b(){i.forOf("prop",a,P=>{s.setParams({missingProperty:P}),i.if((0,t.noPropertyInData)(i,u,P,h.ownProperties),()=>s.error())})}function g(P,$){s.setParams({missingProperty:P}),i.forOf(P,a,()=>{i.assign($,(0,t.propertyInData)(i,u,P,h.ownProperties)),i.if((0,r.not)($),()=>{s.error(),i.break()})},r.nil)}}};e.default=n})),dw=H((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=he(),r={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:{message({keyword:o,schemaCode:n}){let s=o==="maxItems"?"more":"fewer";return(0,t.str)`must NOT have ${s} than ${n} items`},params:({schemaCode:o})=>(0,t._)`{limit: ${o}}`},code(o){let{keyword:n,data:s,schemaCode:i}=o,c=n==="maxItems"?t.operators.GT:t.operators.LT;o.fail$data((0,t._)`${s}.length ${c} ${i}`)}};e.default=r})),nd=H((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=$_();t.code='require("ajv/dist/runtime/equal").default',e.default=t})),pw=H((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=cc(),r=he(),o=Se(),n=nd(),s={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:{message:({params:{i,j:c}})=>(0,r.str)`must NOT have duplicate items (items ## ${c} and ${i} are identical)`,params:({params:{i,j:c}})=>(0,r._)`{i: ${i}, j: ${c}}`},code(i){let{gen:c,data:a,$data:u,schema:l,parentSchema:d,schemaCode:h,it:_}=i;if(!u&&!l)return;let y=c.let("valid"),z=d.items?(0,t.getSchemaTypes)(d.items):[];i.block$data(y,b,(0,r._)`${h} === false`),i.ok(y);function b(){let E=c.let("i",(0,r._)`${a}.length`),k=c.let("j");i.setParams({i:E,j:k}),c.assign(y,!0),c.if((0,r._)`${E} > 1`,()=>(g()?P:$)(E,k))}function g(){return z.length>0&&!z.some(E=>E==="object"||E==="array")}function P(E,k){let v=c.name("item"),S=(0,t.checkDataTypes)(z,v,_.opts.strictNumbers,t.DataType.Wrong),T=c.const("indices",(0,r._)`{}`);c.for((0,r._)`;${E}--;`,()=>{c.let(v,(0,r._)`${a}[${E}]`),c.if(S,(0,r._)`continue`),z.length>1&&c.if((0,r._)`typeof ${v} == "string"`,(0,r._)`${v} += "_"`),c.if((0,r._)`typeof ${T}[${v}] == "number"`,()=>{c.assign(k,(0,r._)`${T}[${v}]`),i.error(),c.assign(y,!1).break()}).code((0,r._)`${T}[${v}] = ${E}`)})}function $(E,k){let v=(0,o.useFunc)(c,n.default),S=c.name("outer");c.label(S).for((0,r._)`;${E}--;`,()=>c.for((0,r._)`${k} = ${E}; ${k}--;`,()=>c.if((0,r._)`${v}(${a}[${E}], ${a}[${k}])`,()=>{i.error(),c.assign(y,!1).break(S)})))}}};e.default=s})),mw=H((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=he(),r=Se(),o=nd(),n={keyword:"const",$data:!0,error:{message:"must be equal to constant",params:({schemaCode:s})=>(0,t._)`{allowedValue: ${s}}`},code(s){let{gen:i,data:c,$data:a,schemaCode:u,schema:l}=s;a||l&&typeof l=="object"?s.fail$data((0,t._)`!${(0,r.useFunc)(i,o.default)}(${c}, ${u})`):s.fail((0,t._)`${l} !== ${c}`)}};e.default=n})),hw=H((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=he(),r=Se(),o=nd(),n={keyword:"enum",schemaType:"array",$data:!0,error:{message:"must be equal to one of the allowed values",params:({schemaCode:s})=>(0,t._)`{allowedValues: ${s}}`},code(s){let{gen:i,data:c,$data:a,schema:u,schemaCode:l,it:d}=s;if(!a&&u.length===0)throw new Error("enum must have non-empty array");let h=u.length>=d.opts.loopEnum,_,y=()=>_??(_=(0,r.useFunc)(i,o.default)),z;if(h||a)z=i.let("valid"),s.block$data(z,b);else{if(!Array.isArray(u))throw new Error("ajv implementation error");let P=i.const("vSchema",l);z=(0,t.or)(...u.map(($,E)=>g(P,E)))}s.pass(z);function b(){i.assign(z,!1),i.forOf("v",l,P=>i.if((0,t._)`${y()}(${c}, ${P})`,()=>i.assign(z,!0).break()))}function g(P,$){let E=u[$];return typeof E=="object"&&E!==null?(0,t._)`${y()}(${c}, ${P}[${$}])`:(0,t._)`${c} === ${E}`}}};e.default=n})),T_=H((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=nw(),r=sw(),o=aw(),n=cw(),s=uw(),i=lw(),c=dw(),a=pw(),u=mw(),l=hw(),d=[t.default,r.default,o.default,n.default,s.default,i.default,c.default,a.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},u.default,l.default];e.default=d})),k_=H((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.validateAdditionalItems=void 0;let t=he(),r=Se(),o={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:{message:({params:{len:s}})=>(0,t.str)`must NOT have more than ${s} items`,params:({params:{len:s}})=>(0,t._)`{limit: ${s}}`},code(s){let{parentSchema:i,it:c}=s,{items:a}=i;if(!Array.isArray(a)){(0,r.checkStrictMode)(c,'"additionalItems" is ignored when "items" is not an array of schemas');return}n(s,a)}};function n(s,i){let{gen:c,schema:a,data:u,keyword:l,it:d}=s;d.items=!0;let h=c.const("len",(0,t._)`${u}.length`);if(a===!1)s.setParams({len:i.length}),s.pass((0,t._)`${h} <= ${i.length}`);else if(typeof a=="object"&&!(0,r.alwaysValidSchema)(d,a)){let y=c.var("valid",(0,t._)`${h} <= ${i.length}`);c.if((0,t.not)(y),()=>_(y)),s.ok(y)}function _(y){c.forRange("i",i.length,h,z=>{s.subschema({keyword:l,dataProp:z,dataPropType:r.Type.Num},y),d.allErrors||c.if((0,t.not)(y),()=>c.break())})}}e.validateAdditionalItems=n,e.default=o})),C_=H((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.validateTuple=void 0;let t=he(),r=Se(),o=ft(),n={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(i){let{schema:c,it:a}=i;if(Array.isArray(c))return s(i,"additionalItems",c);a.items=!0,!(0,r.alwaysValidSchema)(a,c)&&i.ok((0,o.validateArray)(i))}};function s(i,c,a=i.schema){let{gen:u,parentSchema:l,data:d,keyword:h,it:_}=i;b(l),_.opts.unevaluated&&a.length&&_.items!==!0&&(_.items=r.mergeEvaluated.items(u,a.length,_.items));let y=u.name("valid"),z=u.const("len",(0,t._)`${d}.length`);a.forEach((g,P)=>{(0,r.alwaysValidSchema)(_,g)||(u.if((0,t._)`${z} > ${P}`,()=>i.subschema({keyword:h,schemaProp:P,dataProp:P},y)),i.ok(y))});function b(g){let{opts:P,errSchemaPath:$}=_,E=a.length,k=E===g.minItems&&(E===g.maxItems||g[c]===!1);if(P.strictTuples&&!k){let v=`"${h}" is ${E}-tuple, but minItems or maxItems/${c} are not specified or different at path "${$}"`;(0,r.checkStrictMode)(_,v,P.strictTuples)}}}e.validateTuple=s,e.default=n})),fw=H((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=C_(),r={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:o=>(0,t.validateTuple)(o,"items")};e.default=r})),gw=H((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=he(),r=Se(),o=ft(),n=k_(),s={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:{message:({params:{len:i}})=>(0,t.str)`must NOT have more than ${i} items`,params:({params:{len:i}})=>(0,t._)`{limit: ${i}}`},code(i){let{schema:c,parentSchema:a,it:u}=i,{prefixItems:l}=a;u.items=!0,!(0,r.alwaysValidSchema)(u,c)&&(l?(0,n.validateAdditionalItems)(i,l):i.ok((0,o.validateArray)(i)))}};e.default=s})),_w=H((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=he(),r=Se(),o={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:{message:({params:{min:n,max:s}})=>s===void 0?(0,t.str)`must contain at least ${n} valid item(s)`:(0,t.str)`must contain at least ${n} and no more than ${s} valid item(s)`,params:({params:{min:n,max:s}})=>s===void 0?(0,t._)`{minContains: ${n}}`:(0,t._)`{minContains: ${n}, maxContains: ${s}}`},code(n){let{gen:s,schema:i,parentSchema:c,data:a,it:u}=n,l,d,{minContains:h,maxContains:_}=c;u.opts.next?(l=h===void 0?1:h,d=_):l=1;let y=s.const("len",(0,t._)`${a}.length`);if(n.setParams({min:l,max:d}),d===void 0&&l===0){(0,r.checkStrictMode)(u,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(d!==void 0&&l>d){(0,r.checkStrictMode)(u,'"minContains" > "maxContains" is always invalid'),n.fail();return}if((0,r.alwaysValidSchema)(u,i)){let $=(0,t._)`${y} >= ${l}`;d!==void 0&&($=(0,t._)`${$} && ${y} <= ${d}`),n.pass($);return}u.items=!0;let z=s.name("valid");d===void 0&&l===1?g(z,()=>s.if(z,()=>s.break())):l===0?(s.let(z,!0),d!==void 0&&s.if((0,t._)`${a}.length > 0`,b)):(s.let(z,!1),b()),n.result(z,()=>n.reset());function b(){let $=s.name("_valid"),E=s.let("count",0);g($,()=>s.if($,()=>P(E)))}function g($,E){s.forRange("i",0,y,k=>{n.subschema({keyword:"contains",dataProp:k,dataPropType:r.Type.Num,compositeRule:!0},$),E()})}function P($){s.code((0,t._)`${$}++`),d===void 0?s.if((0,t._)`${$} >= ${l}`,()=>s.assign(z,!0).break()):(s.if((0,t._)`${$} > ${d}`,()=>s.assign(z,!1).break()),l===1?s.assign(z,!0):s.if((0,t._)`${$} >= ${l}`,()=>s.assign(z,!0)))}}};e.default=o})),sd=H((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.validateSchemaDeps=e.validatePropertyDeps=e.error=void 0;let t=he(),r=Se(),o=ft();e.error={message:({params:{property:a,depsCount:u,deps:l}})=>{let d=u===1?"property":"properties";return(0,t.str)`must have ${d} ${l} when property ${a} is present`},params:({params:{property:a,depsCount:u,deps:l,missingProperty:d}})=>(0,t._)`{property: ${a},
65
+ missingProperty: ${d},
66
+ depsCount: ${u},
67
+ deps: ${l}}`};let n={keyword:"dependencies",type:"object",schemaType:"object",error:e.error,code(a){let[u,l]=s(a);i(a,u),c(a,l)}};function s({schema:a}){let u={},l={};for(let d in a){if(d==="__proto__")continue;let h=Array.isArray(a[d])?u:l;h[d]=a[d]}return[u,l]}function i(a,u=a.schema){let{gen:l,data:d,it:h}=a;if(Object.keys(u).length===0)return;let _=l.let("missing");for(let y in u){let z=u[y];if(z.length===0)continue;let b=(0,o.propertyInData)(l,d,y,h.opts.ownProperties);a.setParams({property:y,depsCount:z.length,deps:z.join(", ")}),h.allErrors?l.if(b,()=>{for(let g of z)(0,o.checkReportMissingProp)(a,g)}):(l.if((0,t._)`${b} && (${(0,o.checkMissingProp)(a,z,_)})`),(0,o.reportMissingProp)(a,_),l.else())}}e.validatePropertyDeps=i;function c(a,u=a.schema){let{gen:l,data:d,keyword:h,it:_}=a,y=l.name("valid");for(let z in u)(0,r.alwaysValidSchema)(_,u[z])||(l.if((0,o.propertyInData)(l,d,z,_.opts.ownProperties),()=>{let b=a.subschema({keyword:h,schemaProp:z},y);a.mergeValidEvaluated(b,y)},()=>l.var(y,!0)),a.ok(y))}e.validateSchemaDeps=c,e.default=n})),Sw=H((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=he(),r=Se(),o={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:{message:"property name must be valid",params:({params:n})=>(0,t._)`{propertyName: ${n.propertyName}}`},code(n){let{gen:s,schema:i,data:c,it:a}=n;if((0,r.alwaysValidSchema)(a,i))return;let u=s.name("valid");s.forIn("key",c,l=>{n.setParams({propertyName:l}),n.subschema({keyword:"propertyNames",data:l,dataTypes:["string"],propertyName:l,compositeRule:!0},u),s.if((0,t.not)(u),()=>{n.error(!0),a.allErrors||s.break()})}),n.ok(u)}};e.default=o})),O_=H((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=ft(),r=he(),o=ht(),n=Se(),s={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:{message:"must NOT have additional properties",params:({params:i})=>(0,r._)`{additionalProperty: ${i.additionalProperty}}`},code(i){let{gen:c,schema:a,parentSchema:u,data:l,errsCount:d,it:h}=i;if(!d)throw new Error("ajv implementation error");let{allErrors:_,opts:y}=h;if(h.props=!0,y.removeAdditional!=="all"&&(0,n.alwaysValidSchema)(h,a))return;let z=(0,t.allSchemaProperties)(u.properties),b=(0,t.allSchemaProperties)(u.patternProperties);g(),i.ok((0,r._)`${d} === ${o.default.errors}`);function g(){c.forIn("key",l,v=>{!z.length&&!b.length?E(v):c.if(P(v),()=>E(v))})}function P(v){let S;if(z.length>8){let T=(0,n.schemaRefOrVal)(h,u.properties,"properties");S=(0,t.isOwnProperty)(c,T,v)}else z.length?S=(0,r.or)(...z.map(T=>(0,r._)`${v} === ${T}`)):S=r.nil;return b.length&&(S=(0,r.or)(S,...b.map(T=>(0,r._)`${(0,t.usePattern)(i,T)}.test(${v})`))),(0,r.not)(S)}function $(v){c.code((0,r._)`delete ${l}[${v}]`)}function E(v){if(y.removeAdditional==="all"||y.removeAdditional&&a===!1){$(v);return}if(a===!1){i.setParams({additionalProperty:v}),i.error(),_||c.break();return}if(typeof a=="object"&&!(0,n.alwaysValidSchema)(h,a)){let S=c.name("valid");y.removeAdditional==="failing"?(k(v,S,!1),c.if((0,r.not)(S),()=>{i.reset(),$(v)})):(k(v,S),_||c.if((0,r.not)(S),()=>c.break()))}}function k(v,S,T){let A={keyword:"additionalProperties",dataProp:v,dataPropType:n.Type.Str};T===!1&&Object.assign(A,{compositeRule:!0,createErrors:!1,allErrors:!1}),i.subschema(A,S)}}};e.default=s})),yw=H((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=So(),r=ft(),o=Se(),n=O_(),s={keyword:"properties",type:"object",schemaType:"object",code(i){let{gen:c,schema:a,parentSchema:u,data:l,it:d}=i;d.opts.removeAdditional==="all"&&u.additionalProperties===void 0&&n.default.code(new t.KeywordCxt(d,n.default,"additionalProperties"));let h=(0,r.allSchemaProperties)(a);for(let g of h)d.definedProperties.add(g);d.opts.unevaluated&&h.length&&d.props!==!0&&(d.props=o.mergeEvaluated.props(c,(0,o.toHash)(h),d.props));let _=h.filter(g=>!(0,o.alwaysValidSchema)(d,a[g]));if(_.length===0)return;let y=c.name("valid");for(let g of _)z(g)?b(g):(c.if((0,r.propertyInData)(c,l,g,d.opts.ownProperties)),b(g),d.allErrors||c.else().var(y,!0),c.endIf()),i.it.definedProperties.add(g),i.ok(y);function z(g){return d.opts.useDefaults&&!d.compositeRule&&a[g].default!==void 0}function b(g){i.subschema({keyword:"properties",schemaProp:g,dataProp:g},y)}}};e.default=s})),vw=H((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=ft(),r=he(),o=Se(),n=Se(),s={keyword:"patternProperties",type:"object",schemaType:"object",code(i){let{gen:c,schema:a,data:u,parentSchema:l,it:d}=i,{opts:h}=d,_=(0,t.allSchemaProperties)(a),y=_.filter(k=>(0,o.alwaysValidSchema)(d,a[k]));if(_.length===0||y.length===_.length&&(!d.opts.unevaluated||d.props===!0))return;let z=h.strictSchema&&!h.allowMatchingProperties&&l.properties,b=c.name("valid");d.props!==!0&&!(d.props instanceof r.Name)&&(d.props=(0,n.evaluatedPropsToName)(c,d.props));let{props:g}=d;P();function P(){for(let k of _)z&&$(k),d.allErrors?E(k):(c.var(b,!0),E(k),c.if(b))}function $(k){for(let v in z)new RegExp(k).test(v)&&(0,o.checkStrictMode)(d,`property ${v} matches pattern ${k} (use allowMatchingProperties)`)}function E(k){c.forIn("key",u,v=>{c.if((0,r._)`${(0,t.usePattern)(i,k)}.test(${v})`,()=>{let S=y.includes(k);S||i.subschema({keyword:"patternProperties",schemaProp:k,dataProp:v,dataPropType:n.Type.Str},b),d.opts.unevaluated&&g!==!0?c.assign((0,r._)`${g}[${v}]`,!0):!S&&!d.allErrors&&c.if((0,r.not)(b),()=>c.break())})})}}};e.default=s})),bw=H((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=Se(),r={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(o){let{gen:n,schema:s,it:i}=o;if((0,t.alwaysValidSchema)(i,s)){o.fail();return}let c=n.name("valid");o.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},c),o.failResult(c,()=>o.reset(),()=>o.error())},error:{message:"must NOT be valid"}};e.default=r})),zw=H((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:ft().validateUnion,error:{message:"must match a schema in anyOf"}};e.default=t})),ww=H((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=he(),r=Se(),o={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:{message:"must match exactly one schema in oneOf",params:({params:n})=>(0,t._)`{passingSchemas: ${n.passing}}`},code(n){let{gen:s,schema:i,parentSchema:c,it:a}=n;if(!Array.isArray(i))throw new Error("ajv implementation error");if(a.opts.discriminator&&c.discriminator)return;let u=i,l=s.let("valid",!1),d=s.let("passing",null),h=s.name("_valid");n.setParams({passing:d}),s.block(_),n.result(l,()=>n.reset(),()=>n.error(!0));function _(){u.forEach((y,z)=>{let b;(0,r.alwaysValidSchema)(a,y)?s.var(h,!0):b=n.subschema({keyword:"oneOf",schemaProp:z,compositeRule:!0},h),z>0&&s.if((0,t._)`${h} && ${l}`).assign(l,!1).assign(d,(0,t._)`[${d}, ${z}]`).else(),s.if(h,()=>{s.assign(l,!0),s.assign(d,z),b&&n.mergeEvaluated(b,t.Name)})})}}};e.default=o})),Rw=H((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=Se(),r={keyword:"allOf",schemaType:"array",code(o){let{gen:n,schema:s,it:i}=o;if(!Array.isArray(s))throw new Error("ajv implementation error");let c=n.name("valid");s.forEach((a,u)=>{if((0,t.alwaysValidSchema)(i,a))return;let l=o.subschema({keyword:"allOf",schemaProp:u},c);o.ok(c),o.mergeEvaluated(l)})}};e.default=r})),$w=H((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=he(),r=Se(),o={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:{message:({params:s})=>(0,t.str)`must match "${s.ifClause}" schema`,params:({params:s})=>(0,t._)`{failingKeyword: ${s.ifClause}}`},code(s){let{gen:i,parentSchema:c,it:a}=s;c.then===void 0&&c.else===void 0&&(0,r.checkStrictMode)(a,'"if" without "then" and "else" is ignored');let u=n(a,"then"),l=n(a,"else");if(!u&&!l)return;let d=i.let("valid",!0),h=i.name("_valid");if(_(),s.reset(),u&&l){let z=i.let("ifClause");s.setParams({ifClause:z}),i.if(h,y("then",z),y("else",z))}else u?i.if(h,y("then")):i.if((0,t.not)(h),y("else"));s.pass(d,()=>s.error(!0));function _(){let z=s.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},h);s.mergeEvaluated(z)}function y(z,b){return()=>{let g=s.subschema({keyword:z},h);i.assign(d,h),s.mergeValidEvaluated(g,d),b?i.assign(b,(0,t._)`${z}`):s.setParams({ifClause:z})}}}};function n(s,i){let c=s.schema[i];return c!==void 0&&!(0,r.alwaysValidSchema)(s,c)}e.default=o})),Pw=H((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=Se(),r={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:o,parentSchema:n,it:s}){n.if===void 0&&(0,t.checkStrictMode)(s,`"${o}" without "if" is ignored`)}};e.default=r})),I_=H((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=k_(),r=fw(),o=C_(),n=gw(),s=_w(),i=sd(),c=Sw(),a=O_(),u=yw(),l=vw(),d=bw(),h=zw(),_=ww(),y=Rw(),z=$w(),b=Pw();function g(P=!1){let $=[d.default,h.default,_.default,y.default,z.default,b.default,c.default,a.default,i.default,u.default,l.default];return P?$.push(r.default,n.default):$.push(t.default,o.default),$.push(s.default),$}e.default=g})),Ew=H((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=he(),r={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:{message:({schemaCode:o})=>(0,t.str)`must match format "${o}"`,params:({schemaCode:o})=>(0,t._)`{format: ${o}}`},code(o,n){let{gen:s,data:i,$data:c,schema:a,schemaCode:u,it:l}=o,{opts:d,errSchemaPath:h,schemaEnv:_,self:y}=l;if(!d.validateFormats)return;c?z():b();function z(){let g=s.scopeValue("formats",{ref:y.formats,code:d.code.formats}),P=s.const("fDef",(0,t._)`${g}[${u}]`),$=s.let("fType"),E=s.let("format");s.if((0,t._)`typeof ${P} == "object" && !(${P} instanceof RegExp)`,()=>s.assign($,(0,t._)`${P}.type || "string"`).assign(E,(0,t._)`${P}.validate`),()=>s.assign($,(0,t._)`"string"`).assign(E,P)),o.fail$data((0,t.or)(k(),v()));function k(){return d.strictSchema===!1?t.nil:(0,t._)`${u} && !${E}`}function v(){let S=_.$async?(0,t._)`(${P}.async ? await ${E}(${i}) : ${E}(${i}))`:(0,t._)`${E}(${i})`,T=(0,t._)`(typeof ${E} == "function" ? ${S} : ${E}.test(${i}))`;return(0,t._)`${E} && ${E} !== true && ${$} === ${n} && !${T}`}}function b(){let g=y.formats[a];if(!g){k();return}if(g===!0)return;let[P,$,E]=v(g);P===n&&o.pass(S());function k(){if(d.strictSchema===!1){y.logger.warn(T());return}throw new Error(T());function T(){return`unknown format "${a}" ignored in schema at path "${h}"`}}function v(T){let A=T instanceof RegExp?(0,t.regexpCode)(T):d.code.formats?(0,t._)`${d.code.formats}${(0,t.getProperty)(a)}`:void 0,F=s.scopeValue("formats",{key:a,ref:T,code:A});return typeof T=="object"&&!(T instanceof RegExp)?[T.type||"string",T.validate,(0,t._)`${F}.validate`]:["string",T,F]}function S(){if(typeof g=="object"&&!(g instanceof RegExp)&&g.async){if(!_.$async)throw new Error("async format in sync schema");return(0,t._)`await ${E}(${i})`}return typeof $=="function"?(0,t._)`${E}(${i})`:(0,t._)`${E}.test(${i})`}}}};e.default=r})),x_=H((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=[Ew().default];e.default=t})),N_=H((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.contentVocabulary=e.metadataVocabulary=void 0,e.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"],e.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]})),A_=H((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=E_(),r=T_(),o=I_(),n=x_(),s=N_(),i=[t.default,r.default,(0,o.default)(),n.default,s.metadataVocabulary,s.contentVocabulary];e.default=i})),Tw=H((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.DiscrError=void 0;var t;(function(r){r.Tag="tag",r.Mapping="mapping"})(t||(e.DiscrError=t={}))})),id=H((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=he(),r=Tw(),o=dc(),n=yo(),s=Se(),i={keyword:"discriminator",type:"object",schemaType:"object",error:{message:({params:{discrError:c,tagName:a}})=>c===r.DiscrError.Tag?`tag "${a}" must be string`:`value of tag "${a}" must be in oneOf`,params:({params:{discrError:c,tag:a,tagName:u}})=>(0,t._)`{error: ${c}, tag: ${u}, tagValue: ${a}}`},code(c){let{gen:a,data:u,schema:l,parentSchema:d,it:h}=c,{oneOf:_}=d;if(!h.opts.discriminator)throw new Error("discriminator: requires discriminator option");let y=l.propertyName;if(typeof y!="string")throw new Error("discriminator: requires propertyName");if(l.mapping)throw new Error("discriminator: mapping is not supported");if(!_)throw new Error("discriminator: requires oneOf keyword");let z=a.let("valid",!1),b=a.const("tag",(0,t._)`${u}${(0,t.getProperty)(y)}`);a.if((0,t._)`typeof ${b} == "string"`,()=>g(),()=>c.error(!1,{discrError:r.DiscrError.Tag,tag:b,tagName:y})),c.ok(z);function g(){let E=$();a.if(!1);for(let k in E)a.elseIf((0,t._)`${b} === ${k}`),a.assign(z,P(E[k]));a.else(),c.error(!1,{discrError:r.DiscrError.Mapping,tag:b,tagName:y}),a.endIf()}function P(E){let k=a.name("valid"),v=c.subschema({keyword:"oneOf",schemaProp:E},k);return c.mergeEvaluated(v,t.Name),k}function $(){var E;let k={},v=T(d),S=!0;for(let L=0;L<_.length;L++){let U=_[L];if(U?.$ref&&!(0,s.schemaHasRulesButRef)(U,h.self.RULES)){let J=U.$ref;if(U=o.resolveRef.call(h.self,h.schemaEnv.root,h.baseId,J),U instanceof o.SchemaEnv&&(U=U.schema),U===void 0)throw new n.default(h.opts.uriResolver,h.baseId,J)}let K=(E=U?.properties)===null||E===void 0?void 0:E[y];if(typeof K!="object")throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${y}"`);S=S&&(v||T(U)),A(K,L)}if(!S)throw new Error(`discriminator: "${y}" must be required`);return k;function T({required:L}){return Array.isArray(L)&&L.includes(y)}function A(L,U){if(L.const)F(L.const,U);else if(L.enum)for(let K of L.enum)F(K,U);else throw new Error(`discriminator: "properties/${y}" must have "const" or "enum"`)}function F(L,U){if(typeof L!="string"||L in k)throw new Error(`discriminator: "${y}" values must be unique strings`);k[L]=U}}}};e.default=i})),kw=H(((e,t)=>{t.exports={$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}})),j_=H(((e,t)=>{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;let r=rd(),o=A_(),n=id(),s=kw(),i=["/properties"],c="http://json-schema.org/draft-07/schema";var a=class extends r.default{_addVocabularies(){super._addVocabularies(),o.default.forEach(_=>this.addVocabulary(_)),this.opts.discriminator&&this.addKeyword(n.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let _=this.opts.$data?this.$dataMetaSchema(s,i):s;this.addMetaSchema(_,c,!1),this.refs["http://json-schema.org/schema"]=c}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(c)?c:void 0)}};e.Ajv=a,t.exports=e=a,t.exports.Ajv=a,Object.defineProperty(e,"__esModule",{value:!0}),e.default=a;var u=So();Object.defineProperty(e,"KeywordCxt",{enumerable:!0,get:function(){return u.KeywordCxt}});var l=he();Object.defineProperty(e,"_",{enumerable:!0,get:function(){return l._}}),Object.defineProperty(e,"str",{enumerable:!0,get:function(){return l.str}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return l.stringify}}),Object.defineProperty(e,"nil",{enumerable:!0,get:function(){return l.nil}}),Object.defineProperty(e,"Name",{enumerable:!0,get:function(){return l.Name}}),Object.defineProperty(e,"CodeGen",{enumerable:!0,get:function(){return l.CodeGen}});var d=is();Object.defineProperty(e,"ValidationError",{enumerable:!0,get:function(){return d.default}});var h=yo();Object.defineProperty(e,"MissingRefError",{enumerable:!0,get:function(){return h.default}})})),M_=H((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.dynamicAnchor=void 0;let t=he(),r=ht(),o=dc(),n=od(),s={keyword:"$dynamicAnchor",schemaType:"string",code:a=>i(a,a.schema)};function i(a,u){let{gen:l,it:d}=a;d.schemaEnv.root.dynamicAnchors[u]=!0;let h=(0,t._)`${r.default.dynamicAnchors}${(0,t.getProperty)(u)}`,_=d.errSchemaPath==="#"?d.validateName:c(a);l.if((0,t._)`!${h}`,()=>l.assign(h,_))}e.dynamicAnchor=i;function c(a){let{schemaEnv:u,schema:l,self:d}=a.it,{root:h,baseId:_,localRefs:y,meta:z}=u.root,{schemaId:b}=d.opts,g=new o.SchemaEnv({schema:l,schemaId:b,root:h,baseId:_,localRefs:y,meta:z});return o.compileSchema.call(d,g),(0,n.getValidate)(a,g)}e.default=s})),q_=H((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.dynamicRef=void 0;let t=he(),r=ht(),o=od(),n={keyword:"$dynamicRef",schemaType:"string",code:i=>s(i,i.schema)};function s(i,c){let{gen:a,keyword:u,it:l}=i;if(c[0]!=="#")throw new Error(`"${u}" only supports hash fragment reference`);let d=c.slice(1);if(l.allErrors)h();else{let y=a.let("valid",!1);h(y),i.ok(y)}function h(y){if(l.schemaEnv.root.dynamicAnchors[d]){let z=a.let("_v",(0,t._)`${r.default.dynamicAnchors}${(0,t.getProperty)(d)}`);a.if(z,_(z,y),_(l.validateName,y))}else _(l.validateName,y)()}function _(y,z){return z?()=>a.block(()=>{(0,o.callRef)(i,y),a.let(z,!0)}):()=>(0,o.callRef)(i,y)}}e.dynamicRef=s,e.default=n})),Cw=H((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=M_(),r=Se(),o={keyword:"$recursiveAnchor",schemaType:"boolean",code(n){n.schema?(0,t.dynamicAnchor)(n,""):(0,r.checkStrictMode)(n.it,"$recursiveAnchor: false is ignored")}};e.default=o})),Ow=H((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=q_(),r={keyword:"$recursiveRef",schemaType:"string",code:o=>(0,t.dynamicRef)(o,o.schema)};e.default=r})),L_=H((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=M_(),r=q_(),o=Cw(),n=Ow(),s=[t.default,r.default,o.default,n.default];e.default=s})),Iw=H((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=sd(),r={keyword:"dependentRequired",type:"object",schemaType:"object",error:t.error,code:o=>(0,t.validatePropertyDeps)(o)};e.default=r})),xw=H((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=sd(),r={keyword:"dependentSchemas",type:"object",schemaType:"object",code:o=>(0,t.validateSchemaDeps)(o)};e.default=r})),Nw=H((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=Se(),r={keyword:["maxContains","minContains"],type:"array",schemaType:"number",code({keyword:o,parentSchema:n,it:s}){n.contains===void 0&&(0,t.checkStrictMode)(s,`"${o}" without "contains" is ignored`)}};e.default=r})),D_=H((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=Iw(),r=xw(),o=Nw(),n=[t.default,r.default,o.default];e.default=n})),Aw=H((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=he(),r=Se(),o=ht(),n={keyword:"unevaluatedProperties",type:"object",schemaType:["boolean","object"],trackErrors:!0,error:{message:"must NOT have unevaluated properties",params:({params:s})=>(0,t._)`{unevaluatedProperty: ${s.unevaluatedProperty}}`},code(s){let{gen:i,schema:c,data:a,errsCount:u,it:l}=s;if(!u)throw new Error("ajv implementation error");let{allErrors:d,props:h}=l;h instanceof t.Name?i.if((0,t._)`${h} !== true`,()=>i.forIn("key",a,b=>i.if(y(h,b),()=>_(b)))):h!==!0&&i.forIn("key",a,b=>h===void 0?_(b):i.if(z(h,b),()=>_(b))),l.props=!0,s.ok((0,t._)`${u} === ${o.default.errors}`);function _(b){if(c===!1){s.setParams({unevaluatedProperty:b}),s.error(),d||i.break();return}if(!(0,r.alwaysValidSchema)(l,c)){let g=i.name("valid");s.subschema({keyword:"unevaluatedProperties",dataProp:b,dataPropType:r.Type.Str},g),d||i.if((0,t.not)(g),()=>i.break())}}function y(b,g){return(0,t._)`!${b} || !${b}[${g}]`}function z(b,g){let P=[];for(let $ in b)b[$]===!0&&P.push((0,t._)`${g} !== ${$}`);return(0,t.and)(...P)}}};e.default=n})),jw=H((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=he(),r=Se(),o={keyword:"unevaluatedItems",type:"array",schemaType:["boolean","object"],error:{message:({params:{len:n}})=>(0,t.str)`must NOT have more than ${n} items`,params:({params:{len:n}})=>(0,t._)`{limit: ${n}}`},code(n){let{gen:s,schema:i,data:c,it:a}=n,u=a.items||0;if(u===!0)return;let l=s.const("len",(0,t._)`${c}.length`);if(i===!1)n.setParams({len:u}),n.fail((0,t._)`${l} > ${u}`);else if(typeof i=="object"&&!(0,r.alwaysValidSchema)(a,i)){let h=s.var("valid",(0,t._)`${l} <= ${u}`);s.if((0,t.not)(h),()=>d(h,u)),n.ok(h)}a.items=!0;function d(h,_){s.forRange("i",_,l,y=>{n.subschema({keyword:"unevaluatedItems",dataProp:y,dataPropType:r.Type.Num},h),a.allErrors||s.if((0,t.not)(h),()=>s.break())})}}};e.default=o})),U_=H((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=Aw(),r=jw(),o=[t.default,r.default];e.default=o})),Mw=H(((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2019-09/schema",$id:"https://json-schema.org/draft/2019-09/schema",$vocabulary:{"https://json-schema.org/draft/2019-09/vocab/core":!0,"https://json-schema.org/draft/2019-09/vocab/applicator":!0,"https://json-schema.org/draft/2019-09/vocab/validation":!0,"https://json-schema.org/draft/2019-09/vocab/meta-data":!0,"https://json-schema.org/draft/2019-09/vocab/format":!1,"https://json-schema.org/draft/2019-09/vocab/content":!0},$recursiveAnchor:!0,title:"Core and Validation specifications meta-schema",allOf:[{$ref:"meta/core"},{$ref:"meta/applicator"},{$ref:"meta/validation"},{$ref:"meta/meta-data"},{$ref:"meta/format"},{$ref:"meta/content"}],type:["object","boolean"],properties:{definitions:{$comment:"While no longer an official keyword as it is replaced by $defs, this keyword is retained in the meta-schema to prevent incompatible extensions as it remains in common use.",type:"object",additionalProperties:{$recursiveRef:"#"},default:{}},dependencies:{$comment:'"dependencies" is no longer a keyword, but schema authors should avoid redefining it to facilitate a smooth transition to "dependentSchemas" and "dependentRequired"',type:"object",additionalProperties:{anyOf:[{$recursiveRef:"#"},{$ref:"meta/validation#/$defs/stringArray"}]}}}}})),qw=H(((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2019-09/schema",$id:"https://json-schema.org/draft/2019-09/meta/applicator",$vocabulary:{"https://json-schema.org/draft/2019-09/vocab/applicator":!0},$recursiveAnchor:!0,title:"Applicator vocabulary meta-schema",type:["object","boolean"],properties:{additionalItems:{$recursiveRef:"#"},unevaluatedItems:{$recursiveRef:"#"},items:{anyOf:[{$recursiveRef:"#"},{$ref:"#/$defs/schemaArray"}]},contains:{$recursiveRef:"#"},additionalProperties:{$recursiveRef:"#"},unevaluatedProperties:{$recursiveRef:"#"},properties:{type:"object",additionalProperties:{$recursiveRef:"#"},default:{}},patternProperties:{type:"object",additionalProperties:{$recursiveRef:"#"},propertyNames:{format:"regex"},default:{}},dependentSchemas:{type:"object",additionalProperties:{$recursiveRef:"#"}},propertyNames:{$recursiveRef:"#"},if:{$recursiveRef:"#"},then:{$recursiveRef:"#"},else:{$recursiveRef:"#"},allOf:{$ref:"#/$defs/schemaArray"},anyOf:{$ref:"#/$defs/schemaArray"},oneOf:{$ref:"#/$defs/schemaArray"},not:{$recursiveRef:"#"}},$defs:{schemaArray:{type:"array",minItems:1,items:{$recursiveRef:"#"}}}}})),Lw=H(((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2019-09/schema",$id:"https://json-schema.org/draft/2019-09/meta/content",$vocabulary:{"https://json-schema.org/draft/2019-09/vocab/content":!0},$recursiveAnchor:!0,title:"Content vocabulary meta-schema",type:["object","boolean"],properties:{contentMediaType:{type:"string"},contentEncoding:{type:"string"},contentSchema:{$recursiveRef:"#"}}}})),Dw=H(((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2019-09/schema",$id:"https://json-schema.org/draft/2019-09/meta/core",$vocabulary:{"https://json-schema.org/draft/2019-09/vocab/core":!0},$recursiveAnchor:!0,title:"Core vocabulary meta-schema",type:["object","boolean"],properties:{$id:{type:"string",format:"uri-reference",$comment:"Non-empty fragments not allowed.",pattern:"^[^#]*#?$"},$schema:{type:"string",format:"uri"},$anchor:{type:"string",pattern:"^[A-Za-z][-A-Za-z0-9.:_]*$"},$ref:{type:"string",format:"uri-reference"},$recursiveRef:{type:"string",format:"uri-reference"},$recursiveAnchor:{type:"boolean",default:!1},$vocabulary:{type:"object",propertyNames:{type:"string",format:"uri"},additionalProperties:{type:"boolean"}},$comment:{type:"string"},$defs:{type:"object",additionalProperties:{$recursiveRef:"#"},default:{}}}}})),Uw=H(((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2019-09/schema",$id:"https://json-schema.org/draft/2019-09/meta/format",$vocabulary:{"https://json-schema.org/draft/2019-09/vocab/format":!0},$recursiveAnchor:!0,title:"Format vocabulary meta-schema",type:["object","boolean"],properties:{format:{type:"string"}}}})),Zw=H(((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2019-09/schema",$id:"https://json-schema.org/draft/2019-09/meta/meta-data",$vocabulary:{"https://json-schema.org/draft/2019-09/vocab/meta-data":!0},$recursiveAnchor:!0,title:"Meta-data vocabulary meta-schema",type:["object","boolean"],properties:{title:{type:"string"},description:{type:"string"},default:!0,deprecated:{type:"boolean",default:!1},readOnly:{type:"boolean",default:!1},writeOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0}}}})),Vw=H(((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2019-09/schema",$id:"https://json-schema.org/draft/2019-09/meta/validation",$vocabulary:{"https://json-schema.org/draft/2019-09/vocab/validation":!0},$recursiveAnchor:!0,title:"Validation vocabulary meta-schema",type:["object","boolean"],properties:{multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/$defs/nonNegativeInteger"},minLength:{$ref:"#/$defs/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},maxItems:{$ref:"#/$defs/nonNegativeInteger"},minItems:{$ref:"#/$defs/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},maxContains:{$ref:"#/$defs/nonNegativeInteger"},minContains:{$ref:"#/$defs/nonNegativeInteger",default:1},maxProperties:{$ref:"#/$defs/nonNegativeInteger"},minProperties:{$ref:"#/$defs/nonNegativeIntegerDefault0"},required:{$ref:"#/$defs/stringArray"},dependentRequired:{type:"object",additionalProperties:{$ref:"#/$defs/stringArray"}},const:!0,enum:{type:"array",items:!0},type:{anyOf:[{$ref:"#/$defs/simpleTypes"},{type:"array",items:{$ref:"#/$defs/simpleTypes"},minItems:1,uniqueItems:!0}]}},$defs:{nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{$ref:"#/$defs/nonNegativeInteger",default:0},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}}}})),Fw=H((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=Mw(),r=qw(),o=Lw(),n=Dw(),s=Uw(),i=Zw(),c=Vw(),a=["/properties"];function u(l){return[t,r,o,n,d(this,s),i,d(this,c)].forEach(h=>this.addMetaSchema(h,void 0,!1)),this;function d(h,_){return l?h.$dataMetaSchema(_,a):_}}e.default=u})),Hw=H(((e,t)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.MissingRefError=e.ValidationError=e.CodeGen=e.Name=e.nil=e.stringify=e.str=e._=e.KeywordCxt=e.Ajv2019=void 0;let r=rd(),o=A_(),n=L_(),s=D_(),i=U_(),c=id(),a=Fw(),u="https://json-schema.org/draft/2019-09/schema";var l=class extends r.default{constructor(z={}){super({...z,dynamicRef:!0,next:!0,unevaluated:!0})}_addVocabularies(){super._addVocabularies(),this.addVocabulary(n.default),o.default.forEach(z=>this.addVocabulary(z)),this.addVocabulary(s.default),this.addVocabulary(i.default),this.opts.discriminator&&this.addKeyword(c.default)}_addDefaultMetaSchema(){super._addDefaultMetaSchema();let{$data:z,meta:b}=this.opts;b&&(a.default.call(this,z),this.refs["http://json-schema.org/schema"]=u)}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(u)?u:void 0)}};e.Ajv2019=l,t.exports=e=l,t.exports.Ajv2019=l,Object.defineProperty(e,"__esModule",{value:!0}),e.default=l;var d=So();Object.defineProperty(e,"KeywordCxt",{enumerable:!0,get:function(){return d.KeywordCxt}});var h=he();Object.defineProperty(e,"_",{enumerable:!0,get:function(){return h._}}),Object.defineProperty(e,"str",{enumerable:!0,get:function(){return h.str}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return h.stringify}}),Object.defineProperty(e,"nil",{enumerable:!0,get:function(){return h.nil}}),Object.defineProperty(e,"Name",{enumerable:!0,get:function(){return h.Name}}),Object.defineProperty(e,"CodeGen",{enumerable:!0,get:function(){return h.CodeGen}});var _=is();Object.defineProperty(e,"ValidationError",{enumerable:!0,get:function(){return _.default}});var y=yo();Object.defineProperty(e,"MissingRefError",{enumerable:!0,get:function(){return y.default}})})),Bw=H((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=E_(),r=T_(),o=I_(),n=L_(),s=D_(),i=U_(),c=x_(),a=N_(),u=[n.default,t.default,r.default,(0,o.default)(!0),c.default,a.metadataVocabulary,a.contentVocabulary,s.default,i.default];e.default=u})),Jw=H(((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/schema",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/core":!0,"https://json-schema.org/draft/2020-12/vocab/applicator":!0,"https://json-schema.org/draft/2020-12/vocab/unevaluated":!0,"https://json-schema.org/draft/2020-12/vocab/validation":!0,"https://json-schema.org/draft/2020-12/vocab/meta-data":!0,"https://json-schema.org/draft/2020-12/vocab/format-annotation":!0,"https://json-schema.org/draft/2020-12/vocab/content":!0},$dynamicAnchor:"meta",title:"Core and Validation specifications meta-schema",allOf:[{$ref:"meta/core"},{$ref:"meta/applicator"},{$ref:"meta/unevaluated"},{$ref:"meta/validation"},{$ref:"meta/meta-data"},{$ref:"meta/format-annotation"},{$ref:"meta/content"}],type:["object","boolean"],$comment:"This meta-schema also defines keywords that have appeared in previous drafts in order to prevent incompatible extensions as they remain in common use.",properties:{definitions:{$comment:'"definitions" has been replaced by "$defs".',type:"object",additionalProperties:{$dynamicRef:"#meta"},deprecated:!0,default:{}},dependencies:{$comment:'"dependencies" has been split and replaced by "dependentSchemas" and "dependentRequired" in order to serve their differing semantics.',type:"object",additionalProperties:{anyOf:[{$dynamicRef:"#meta"},{$ref:"meta/validation#/$defs/stringArray"}]},deprecated:!0,default:{}},$recursiveAnchor:{$comment:'"$recursiveAnchor" has been replaced by "$dynamicAnchor".',$ref:"meta/core#/$defs/anchorString",deprecated:!0},$recursiveRef:{$comment:'"$recursiveRef" has been replaced by "$dynamicRef".',$ref:"meta/core#/$defs/uriReferenceString",deprecated:!0}}}})),Kw=H(((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/applicator",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/applicator":!0},$dynamicAnchor:"meta",title:"Applicator vocabulary meta-schema",type:["object","boolean"],properties:{prefixItems:{$ref:"#/$defs/schemaArray"},items:{$dynamicRef:"#meta"},contains:{$dynamicRef:"#meta"},additionalProperties:{$dynamicRef:"#meta"},properties:{type:"object",additionalProperties:{$dynamicRef:"#meta"},default:{}},patternProperties:{type:"object",additionalProperties:{$dynamicRef:"#meta"},propertyNames:{format:"regex"},default:{}},dependentSchemas:{type:"object",additionalProperties:{$dynamicRef:"#meta"},default:{}},propertyNames:{$dynamicRef:"#meta"},if:{$dynamicRef:"#meta"},then:{$dynamicRef:"#meta"},else:{$dynamicRef:"#meta"},allOf:{$ref:"#/$defs/schemaArray"},anyOf:{$ref:"#/$defs/schemaArray"},oneOf:{$ref:"#/$defs/schemaArray"},not:{$dynamicRef:"#meta"}},$defs:{schemaArray:{type:"array",minItems:1,items:{$dynamicRef:"#meta"}}}}})),Gw=H(((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/unevaluated",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/unevaluated":!0},$dynamicAnchor:"meta",title:"Unevaluated applicator vocabulary meta-schema",type:["object","boolean"],properties:{unevaluatedItems:{$dynamicRef:"#meta"},unevaluatedProperties:{$dynamicRef:"#meta"}}}})),Ww=H(((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/content",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/content":!0},$dynamicAnchor:"meta",title:"Content vocabulary meta-schema",type:["object","boolean"],properties:{contentEncoding:{type:"string"},contentMediaType:{type:"string"},contentSchema:{$dynamicRef:"#meta"}}}})),Yw=H(((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/core",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/core":!0},$dynamicAnchor:"meta",title:"Core vocabulary meta-schema",type:["object","boolean"],properties:{$id:{$ref:"#/$defs/uriReferenceString",$comment:"Non-empty fragments not allowed.",pattern:"^[^#]*#?$"},$schema:{$ref:"#/$defs/uriString"},$ref:{$ref:"#/$defs/uriReferenceString"},$anchor:{$ref:"#/$defs/anchorString"},$dynamicRef:{$ref:"#/$defs/uriReferenceString"},$dynamicAnchor:{$ref:"#/$defs/anchorString"},$vocabulary:{type:"object",propertyNames:{$ref:"#/$defs/uriString"},additionalProperties:{type:"boolean"}},$comment:{type:"string"},$defs:{type:"object",additionalProperties:{$dynamicRef:"#meta"}}},$defs:{anchorString:{type:"string",pattern:"^[A-Za-z_][-A-Za-z0-9._]*$"},uriString:{type:"string",format:"uri"},uriReferenceString:{type:"string",format:"uri-reference"}}}})),Xw=H(((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/format-annotation",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/format-annotation":!0},$dynamicAnchor:"meta",title:"Format vocabulary meta-schema for annotation results",type:["object","boolean"],properties:{format:{type:"string"}}}})),Qw=H(((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/meta-data",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/meta-data":!0},$dynamicAnchor:"meta",title:"Meta-data vocabulary meta-schema",type:["object","boolean"],properties:{title:{type:"string"},description:{type:"string"},default:!0,deprecated:{type:"boolean",default:!1},readOnly:{type:"boolean",default:!1},writeOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0}}}})),eR=H(((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/validation",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/validation":!0},$dynamicAnchor:"meta",title:"Validation vocabulary meta-schema",type:["object","boolean"],properties:{type:{anyOf:[{$ref:"#/$defs/simpleTypes"},{type:"array",items:{$ref:"#/$defs/simpleTypes"},minItems:1,uniqueItems:!0}]},const:!0,enum:{type:"array",items:!0},multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/$defs/nonNegativeInteger"},minLength:{$ref:"#/$defs/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},maxItems:{$ref:"#/$defs/nonNegativeInteger"},minItems:{$ref:"#/$defs/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},maxContains:{$ref:"#/$defs/nonNegativeInteger"},minContains:{$ref:"#/$defs/nonNegativeInteger",default:1},maxProperties:{$ref:"#/$defs/nonNegativeInteger"},minProperties:{$ref:"#/$defs/nonNegativeIntegerDefault0"},required:{$ref:"#/$defs/stringArray"},dependentRequired:{type:"object",additionalProperties:{$ref:"#/$defs/stringArray"}}},$defs:{nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{$ref:"#/$defs/nonNegativeInteger",default:0},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}}}})),tR=H((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=Jw(),r=Kw(),o=Gw(),n=Ww(),s=Yw(),i=Xw(),c=Qw(),a=eR(),u=["/properties"];function l(d){return[t,r,o,n,s,h(this,i),c,h(this,a)].forEach(_=>this.addMetaSchema(_,void 0,!1)),this;function h(_,y){return d?_.$dataMetaSchema(y,u):y}}e.default=l})),rR=H(((e,t)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.MissingRefError=e.ValidationError=e.CodeGen=e.Name=e.nil=e.stringify=e.str=e._=e.KeywordCxt=e.Ajv2020=void 0;let r=rd(),o=Bw(),n=id(),s=tR(),i="https://json-schema.org/draft/2020-12/schema";var c=class extends r.default{constructor(h={}){super({...h,dynamicRef:!0,next:!0,unevaluated:!0})}_addVocabularies(){super._addVocabularies(),o.default.forEach(h=>this.addVocabulary(h)),this.opts.discriminator&&this.addKeyword(n.default)}_addDefaultMetaSchema(){super._addDefaultMetaSchema();let{$data:h,meta:_}=this.opts;_&&(s.default.call(this,h),this.refs["http://json-schema.org/schema"]=i)}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(i)?i:void 0)}};e.Ajv2020=c,t.exports=e=c,t.exports.Ajv2020=c,Object.defineProperty(e,"__esModule",{value:!0}),e.default=c;var a=So();Object.defineProperty(e,"KeywordCxt",{enumerable:!0,get:function(){return a.KeywordCxt}});var u=he();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 l=is();Object.defineProperty(e,"ValidationError",{enumerable:!0,get:function(){return l.default}});var d=yo();Object.defineProperty(e,"MissingRefError",{enumerable:!0,get:function(){return d.default}})})),oR=H((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.formatNames=e.fastFormats=e.fullFormats=void 0;function t(L,U){return{validate:L,compare:U}}e.fullFormats={date:t(s,i),time:t(a(!0),u),"date-time":t(h(!0),_),"iso-time":t(a(),l),"iso-date-time":t(h(),y),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:g,"uri-reference":/^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,"uri-template":/^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i,url:/^(?:https?|ftp):\/\/(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)(?:\.(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu,email:/^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i,hostname:/^(?=.{1,253}\.?$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*\.?$/i,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)$/,ipv6:/^((([0-9a-f]{1,4}:){7}([0-9a-f]{1,4}|:))|(([0-9a-f]{1,4}:){6}(:[0-9a-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){5}(((:[0-9a-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){4}(((:[0-9a-f]{1,4}){1,3})|((:[0-9a-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){3}(((:[0-9a-f]{1,4}){1,4})|((:[0-9a-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){2}(((:[0-9a-f]{1,4}){1,5})|((:[0-9a-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){1}(((:[0-9a-f]{1,4}){1,6})|((:[0-9a-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9a-f]{1,4}){1,7})|((:[0-9a-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))$/i,regex:F,uuid:/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,"json-pointer":/^(?:\/(?:[^~/]|~0|~1)*)*$/,"json-pointer-uri-fragment":/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,"relative-json-pointer":/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,byte:$,int32:{type:"number",validate:v},int64:{type:"number",validate:S},float:{type:"number",validate:T},double:{type:"number",validate:T},password:!0,binary:!0},e.fastFormats={...e.fullFormats,date:t(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,i),time:t(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,u),"date-time":t(/^\d\d\d\d-[0-1]\d-[0-3]\dt(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,_),"iso-time":t(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,l),"iso-date-time":t(/^\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,y),uri:/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i,"uri-reference":/^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,email:/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i},e.formatNames=Object.keys(e.fullFormats);function r(L){return L%4===0&&(L%100!==0||L%400===0)}let o=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,n=[0,31,28,31,30,31,30,31,31,30,31,30,31];function s(L){let U=o.exec(L);if(!U)return!1;let K=+U[1],J=+U[2],de=+U[3];return J>=1&&J<=12&&de>=1&&de<=(J===2&&r(K)?29:n[J])}function i(L,U){if(L&&U)return L>U?1:L<U?-1:0}let c=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function a(L){return function(K){let J=c.exec(K);if(!J)return!1;let de=+J[1],ve=+J[2],ye=+J[3],Ee=J[4],fe=J[5]==="-"?-1:1,x=+(J[6]||0),M=+(J[7]||0);if(x>23||M>59||L&&!Ee)return!1;if(de<=23&&ve<=59&&ye<60)return!0;let w=ve-M*fe,m=de-x*fe-(w<0?1:0);return(m===23||m===-1)&&(w===59||w===-1)&&ye<61}}function u(L,U){if(!(L&&U))return;let K=new Date("2020-01-01T"+L).valueOf(),J=new Date("2020-01-01T"+U).valueOf();if(K&&J)return K-J}function l(L,U){if(!(L&&U))return;let K=c.exec(L),J=c.exec(U);if(K&&J)return L=K[1]+K[2]+K[3],U=J[1]+J[2]+J[3],L>U?1:L<U?-1:0}let d=/t|\s/i;function h(L){let U=a(L);return function(J){let de=J.split(d);return de.length===2&&s(de[0])&&U(de[1])}}function _(L,U){if(!(L&&U))return;let K=new Date(L).valueOf(),J=new Date(U).valueOf();if(K&&J)return K-J}function y(L,U){if(!(L&&U))return;let[K,J]=L.split(d),[de,ve]=U.split(d),ye=i(K,de);if(ye!==void 0)return ye||u(J,ve)}let z=/\/|:/,b=/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)(?:\?(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i;function g(L){return z.test(L)&&b.test(L)}let P=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function $(L){return P.lastIndex=0,P.test(L)}let E=-(2**31),k=2**31-1;function v(L){return Number.isInteger(L)&&L<=k&&L>=E}function S(L){return Number.isInteger(L)}function T(){return!0}let A=/[^\\]\\Z/;function F(L){if(A.test(L))return!1;try{return new RegExp(L),!0}catch{return!1}}})),nR=H((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.formatLimitDefinition=void 0;let t=j_(),r=he(),o=r.operators,n={formatMaximum:{okStr:"<=",ok:o.LTE,fail:o.GT},formatMinimum:{okStr:">=",ok:o.GTE,fail:o.LT},formatExclusiveMaximum:{okStr:"<",ok:o.LT,fail:o.GTE},formatExclusiveMinimum:{okStr:">",ok:o.GT,fail:o.LTE}},s={message:({keyword:c,schemaCode:a})=>(0,r.str)`should be ${n[c].okStr} ${a}`,params:({keyword:c,schemaCode:a})=>(0,r._)`{comparison: ${n[c].okStr}, limit: ${a}}`};e.formatLimitDefinition={keyword:Object.keys(n),type:"string",schemaType:"string",$data:!0,error:s,code(c){let{gen:a,data:u,schemaCode:l,keyword:d,it:h}=c,{opts:_,self:y}=h;if(!_.validateFormats)return;let z=new t.KeywordCxt(h,y.RULES.all.format.definition,"format");z.$data?b():g();function b(){let $=a.scopeValue("formats",{ref:y.formats,code:_.code.formats}),E=a.const("fmt",(0,r._)`${$}[${z.schemaCode}]`);c.fail$data((0,r.or)((0,r._)`typeof ${E} != "object"`,(0,r._)`${E} instanceof RegExp`,(0,r._)`typeof ${E}.compare != "function"`,P(E)))}function g(){let $=z.schema,E=y.formats[$];if(!E||E===!0)return;if(typeof E!="object"||E instanceof RegExp||typeof E.compare!="function")throw new Error(`"${d}": format "${$}" does not define "compare" function`);let k=a.scopeValue("formats",{key:$,ref:E,code:_.code.formats?(0,r._)`${_.code.formats}${(0,r.getProperty)($)}`:void 0});c.fail$data(P(k))}function P($){return(0,r._)`${$}.compare(${u}, ${l}) ${n[d].fail} 0`}},dependencies:["format"]};let i=c=>(c.addKeyword(e.formatLimitDefinition),c);e.default=i})),sR=H(((e,t)=>{Object.defineProperty(e,"__esModule",{value:!0});let r=oR(),o=nR(),n=he(),s=new n.Name("fullFormats"),i=new n.Name("fastFormats"),c=(u,l={keywords:!0})=>{if(Array.isArray(l))return a(u,l,r.fullFormats,s),u;let[d,h]=l.mode==="fast"?[r.fastFormats,i]:[r.fullFormats,s];return a(u,l.formats||r.formatNames,d,h),l.keywords&&(0,o.default)(u),u};c.get=(u,l="full")=>{let d=(l==="fast"?r.fastFormats:r.fullFormats)[u];if(!d)throw new Error(`Unknown format "${u}"`);return d};function a(u,l,d,h){var _,y;(_=(y=u.opts.code).formats)!==null&&_!==void 0||(y.formats=(0,n._)`require("ajv-formats/dist/formats").${h}`);for(let z of l)u.addFormat(z,d[z])}t.exports=e=c,Object.defineProperty(e,"__esModule",{value:!0}),e.default=c})),Z_=j_(),iR=Hw(),aR=rR(),cR=Ps(sR(),1),uR=cR.default;function td(e){let t=new e({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return uR(t),t}var pc=class{_ajv;_ajvDraft7;_ajv2019;_userAjv;constructor(e){this._userAjv=e!==void 0,this._ajv=e}get ajv(){return this._ajv??=td(aR.Ajv2020)}_engineFor(e){if(this._userAjv)return this.ajv;let t=Dd(e,"pass a pre-configured Ajv instance to AjvJsonSchemaValidator(ajv) to validate other dialects.");return t==="2020-12"?this.ajv:t==="2019-09"?this._ajv2019??=td(iR.Ajv2019):this._ajvDraft7??=td(Z_.Ajv)}getValidator(e){let t=this._engineFor(e),r="$id"in e&&typeof e.$id=="string"?t.getSchema(e.$id)??t.compile(e):t.compile(e);return o=>r(o)?{valid:!0,data:o,errorMessage:void 0}:{valid:!1,data:void 0,errorMessage:t.errorsText(r.errors)}}},wT=Z_.Ajv;var V_=!1;var ad;ad=globalThis.crypto?.webcrypto??globalThis.crypto??import("node:crypto").then(e=>e.webcrypto);async function lR(e){return(await ad).getRandomValues(new Uint8Array(e))}async function dR(e){let t="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-._~",r=Math.pow(2,8)-Math.pow(2,8)%t.length,o="";for(;o.length<e;){let n=await lR(e-o.length);for(let s of n)s<r&&(o+=t[s%t.length])}return o}async function pR(e){return await dR(e)}async function mR(e){let t=await(await ad).subtle.digest("SHA-256",new TextEncoder().encode(e));return btoa(String.fromCharCode(...new Uint8Array(t))).replace(/\//g,"_").replace(/\+/g,"-").replace(/=/g,"")}async function cd(e){if(e||(e=43),e<43||e>128)throw`Expected a length between 43 and 128. Received ${e}.`;let t=await pR(e),r=await mR(t);return{code_verifier:t,code_challenge:r}}var vo=class extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.OAuthClientFlowError"})}static[Symbol.hasInstance](e){return Qe(this,e)}static isInstance(e){if(typeof this!="function")throw new TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return Qe(this,e)}constructor(e){super(e),this.name=new.target.name,er(this,new.target)}},gc=class extends vo{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.IssuerMismatchError"})}kind;expected;received;constructor(e,t,r){super(`Issuer mismatch in ${e==="metadata"?"authorization server metadata (RFC 8414 \xA73.3)":"authorization response (RFC 9207)"}: expected ${JSON.stringify(t)}, received ${JSON.stringify(r)}`),this.kind=e,this.expected=t,this.received=r}},Q_=class extends vo{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.RegistrationRejectedError"})}status;body;submittedMetadata;constructor(e){super(`Dynamic Client Registration rejected (HTTP ${e.status}): ${e.body}`),this.status=e.status,this.body=e.body,this.submittedMetadata=e.submittedMetadata}},Sd=class extends vo{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.InsecureTokenEndpointError"})}tokenEndpoint;constructor(e){super(`Refusing to send credentials to non-https token endpoint '${e}'. OAuth token requests MUST use TLS (localhost / *.localhost / 127.0.0.1 / ::1 are exempt).`),this.tokenEndpoint=e}},as=class extends vo{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.AuthorizationServerMismatchError"})}constructor(e,t){super(`Authorization server mismatch: credentials are bound to ${JSON.stringify(e)} but this call resolved ${JSON.stringify(t)}; refusing to present them to a different authorization server`),this.recordedIssuer=e,this.currentIssuer=t}},yd=class extends vo{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.InsufficientScopeError"})}requiredScope;resourceMetadataUrl;errorDescription;constructor(e){super(`Insufficient scope${e.requiredScope?`: required "${e.requiredScope}"`:""}`),this.requiredScope=e.requiredScope,this.resourceMetadataUrl=e.resourceMetadataUrl,this.errorDescription=e.errorDescription}};function fd(e,t,r){if(e)return typeof e.issuer!="string"?(r?.canPersistStamp!==!1&&console.warn("[mcp-sdk] SEP-2352: stored OAuth credential has no 'issuer' stamp (pre-upgrade storage or provider not round-tripping the value). SEP-2352 isolation is inactive for this read; ensure your provider round-trips the issuer field."),e.issuer===void 0?e:{...e,issuer:void 0}):eS(e.issuer,t)?e:void 0}function eS(e,t){return e===t||e.endsWith("/")&&e.slice(0,-1)===t||t.endsWith("/")&&t.slice(0,-1)===e}function tS(e){if(e==null)return!1;let t=e;return typeof t.tokens=="function"&&typeof t.clientInformation=="function"}async function hR(e,t,r){let{resourceMetadataUrl:o,scope:n}=bo(t.response);if(await yc(e,{serverUrl:t.serverUrl,resourceMetadataUrl:o,scope:n,fetchFn:t.fetchFn,...r})!=="AUTHORIZED")throw new gt}function rS(e,t){return{token:async()=>(await e.tokens())?.access_token,onUnauthorized:async r=>hR(e,r,t)}}var gt=class extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.UnauthorizedError"})}static[Symbol.hasInstance](e){return Qe(this,e)}static isInstance(e){if(typeof this!="function")throw new TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return Qe(this,e)}constructor(e){super(e??"Unauthorized"),this.name="UnauthorizedError",er(this,new.target)}};function vd(e){return e?.authorization_response_iss_parameter_supported===!0}function _c({iss:e,expectedIssuer:t,issParameterSupported:r}){if(t!==void 0){if(e===void 0){if(r)throw new gc("authorization_response",t,void 0);return}if(e!==t)throw new gc("authorization_response",t,e)}}function Sc(...e){let t=new Set;for(let r of e)if(r)for(let o of r.split(/\s+/))o&&t.add(o);return t.size>0?[...t].join(" "):void 0}function oS(e,t){if(!e)return!1;let r=new Set((t??"").split(/\s+/).filter(Boolean));for(let o of e.split(/\s+/))if(o&&!r.has(o))return!0;return!1}async function nS(e,t,r,o,n){if(typeof e=="string")return{authorizationCode:e,iss:t};let s=e.get("iss")??void 0,i=e.get("code");if(i)return{authorizationCode:i,iss:s};let c=(await r.discoveryState?.())?.authorizationServerMetadata;if(!c)try{c=(await wd(o,n)).authorizationServerMetadata}catch{c=void 0}if(!c)throw new gt("Authorization callback failed and the issuer could not be verified");_c({iss:s,expectedIssuer:c.issuer,issParameterSupported:vd(c)});let a=e.get("error");throw a?new tr(a,e.get("error_description")??a,e.get("error_uri")??void 0):new gt("Authorization callback contained neither `code` nor `error`")}function fR(e){return["client_secret_basic","client_secret_post","none"].includes(e)}var ud="code",ld="S256";function sS(e,t){let r=e.client_secret!==void 0;return"token_endpoint_auth_method"in e&&e.token_endpoint_auth_method&&fR(e.token_endpoint_auth_method)&&(t.length===0||t.includes(e.token_endpoint_auth_method))?e.token_endpoint_auth_method:t.length===0?r?"client_secret_basic":"none":r&&t.includes("client_secret_basic")?"client_secret_basic":r&&t.includes("client_secret_post")?"client_secret_post":t.includes("none")?"none":r?"client_secret_post":"none"}function iS(e,t,r,o){let{client_id:n,client_secret:s}=t;switch(e){case"client_secret_basic":gR(n,s,r);return;case"client_secret_post":_R(n,s,o);return;case"none":SR(n,o);return;default:throw new Error(`Unsupported client authentication method: ${e}`)}}function gR(e,t,r){if(!t)throw new Error("client_secret_basic authentication requires a client_secret");let o=btoa(`${e}:${t}`);r.set("Authorization",`Basic ${o}`)}function _R(e,t,r){r.set("client_id",e),t&&r.set("client_secret",t)}function SR(e,t){t.set("client_id",e)}function aS(e){return e==="localhost"||e.endsWith(".localhost")||e==="127.0.0.1"||e==="[::1]"||e==="::1"}function cS(e){let t=new URL(String(e));if(t.protocol!=="https:"&&!aS(t.hostname))throw new Sd(t.href);return t}function yR(e){for(let t of e??[]){let r;try{r=new URL(t)}catch{continue}if(r.protocol!=="http:"&&r.protocol!=="https:"||aS(r.hostname))return"native"}return"web"}function uS(e){let t=e.clientMetadata;return{...t,grant_types:t.grant_types??(e.redirectUrl===void 0?void 0:["authorization_code","refresh_token"]),application_type:t.application_type??yR(t.redirect_uris)}}async function gd(e){let t=e instanceof Response?e.status:void 0,r=e instanceof Response?await e.text():e;try{let o=fo.parse(JSON.parse(r));return tr.fromResponse(o)}catch(o){let n=`${t?`HTTP ${t}: `:""}Invalid OAuth error response: ${o}. Raw body: ${r}`;return new tr(St.ServerError,n)}}function F_(e,t,r){let o=e.invalidateCredentials===void 0?`retrying authorization without discarding the stored ${r} (provider implements no invalidateCredentials())`:`invalidating the stored ${r} and retrying authorization`;console.warn(`[mcp-sdk] OAuth ${JSON.stringify(t.code)} \u2014 ${o}. Cause: ${JSON.stringify(t.message)}`)}async function yc(e,t){try{return await dd(e,t)}catch(r){if(r instanceof tr){if(r.code===St.InvalidClient||r.code===St.UnauthorizedClient)return F_(e,r,"client credentials and tokens"),await e.invalidateCredentials?.("client"),await e.invalidateCredentials?.("tokens"),await dd(e,t);if(r.code===St.InvalidGrant||r.code===St.InvalidDpopProof)return F_(e,r,"tokens"),await e.invalidateCredentials?.("tokens"),await dd(e,t)}throw r}}function vR(e){let{requestedScope:t,resourceMetadata:r,authServerMetadata:o,clientMetadata:n}=e,s=t||r?.scopes_supported?.join(" ")||n.scope;return s&&o?.scopes_supported?.includes("offline_access")&&!s.split(" ").includes("offline_access")&&n.grant_types?.includes("refresh_token")&&(s=`${s} offline_access`),s}async function dd(e,{serverUrl:t,authorizationCode:r,iss:o,scope:n,resourceMetadataUrl:s,fetchFn:i,skipIssuerMetadataValidation:c,forceReauthorization:a}){let u=uS(e),l=await e.discoveryState?.(),d,h,_,y,z=s;if(!z&&l?.resourceMetadataUrl&&(z=new URL(l.resourceMetadataUrl)),l?.authorizationServerUrl){if(h=l.authorizationServerUrl,d=l.resourceMetadata,_=l.authorizationServerMetadata??await zd(h,{fetchFn:i,skipIssuerValidation:c}),!d)try{d=await bd(t,{resourceMetadataUrl:z},i)}catch(U){if(U instanceof TypeError)throw U}(_!==l.authorizationServerMetadata||d!==l.resourceMetadata)&&await e.saveDiscoveryState?.({authorizationServerUrl:String(h),resourceMetadataUrl:z?.toString(),resourceMetadata:d,authorizationServerMetadata:_})}else{let U=await wd(t,{resourceMetadataUrl:z,fetchFn:i,skipIssuerMetadataValidation:c});h=U.authorizationServerUrl,_=U.authorizationServerMetadata,d=U.resourceMetadata,y={authorizationServerUrl:String(h),resourceMetadataUrl:z?.toString(),resourceMetadata:d,authorizationServerMetadata:_}}let b=_?.issuer??String(h),g={issuer:b};if(await e.saveAuthorizationServerUrl?.(b),r!==void 0){let U=l?.authorizationServerMetadata?.issuer??l?.authorizationServerUrl;if(U===void 0){if(e.saveDiscoveryState!==void 0)throw new as("discoveryState was not available on the callback leg; ensure your provider persists discoveryState alongside codeVerifier",b);console.warn("[mcp-sdk] OAuthClientProvider does not implement saveDiscoveryState()/discoveryState(); the SEP-2352 callback-leg authorization-server binding cannot be checked. Implement discoveryState (persist alongside codeVerifier) \u2014 see docs/migration/upgrade-to-v2.md \xA7SEP-2352.")}else if(!eS(U,b))throw new as(U,b)}y&&await e.saveDiscoveryState?.(y);let P=await dS(t,e,d),$=P&&d&&!e.validateResourceURL?d.resource:P;$&&await e.saveResourceUrl?.(Rd($));let E=vR({requestedScope:n,resourceMetadata:d,authServerMetadata:_,clientMetadata:e.clientMetadata}),k=await Promise.resolve(e.clientInformation(g)),v=fd(k,b,{canPersistStamp:e.saveClientInformation!==void 0});if(v===void 0&&k?.issuer&&e.saveClientInformation===void 0)throw new as(k.issuer,b);if(v&&v.issuer===void 0&&(v={...v,issuer:b},await e.saveClientInformation?.(v,g)),!v){if(r!==void 0)throw new Error("Existing OAuth client information is required when exchanging an authorization code");let U=_?.client_id_metadata_document_supported===!0,K=e.clientMetadataUrl;if(K&&!lS(K))throw new tr(St.InvalidClientMetadata,`clientMetadataUrl must be a valid HTTPS URL with a non-root pathname, got: ${K}`);if(U&&K)v={client_id:K,issuer:b},await e.saveClientInformation?.(v,g);else{if(!e.saveClientInformation)throw new Error("OAuth client information must be saveable for dynamic registration");v={...await yS(h,{metadata:_,clientMetadata:u,scope:E,fetchFn:i}),issuer:b},await e.saveClientInformation(v,g)}}let S=!e.redirectUrl;if(r!==void 0||S){r!==void 0&&_c({iss:o,expectedIssuer:_?.issuer,issParameterSupported:vd(_)});let U=await SS(e,h,{metadata:_,resource:$,authorizationCode:r,iss:o,scope:E,fetchFn:i});return await e.saveTokens({...U,issuer:b},g),"AUTHORIZED"}let T=fd(await e.tokens(g),b);if(T&&T.issuer===void 0&&(T={...T,issuer:b},await e.saveTokens(T,g)),T?.refresh_token&&!a){let U=await e.scopeForRefresh?.(T),K;try{K=await _S(h,{metadata:_,clientInformation:v,refreshToken:T.refresh_token,scope:U,resource:$,addClientAuthentication:e.addClientAuthentication,dpop:await e.dpop?.(),fetchFn:i})}catch(J){if(J instanceof Sd)throw J;if(!(J instanceof tr)||J.code===St.ServerError)console.warn(`[mcp-sdk] Could not refresh OAuth tokens; falling back to a new authorization request. Cause: ${JSON.stringify(J instanceof Error?J.message:String(J))}`);else throw J}if(K)return await e.saveTokens({...K,issuer:b},g),"AUTHORIZED"}let A=e.state?await e.state():void 0,{authorizationUrl:F,codeVerifier:L}=await hS(h,{metadata:_,clientInformation:v,state:A,redirectUrl:e.redirectUrl,scope:E,resource:$});return await e.saveCodeVerifier(L),await e.redirectToAuthorization(F),"REDIRECT"}function lS(e){if(!e)return!1;try{let t=new URL(e);return t.protocol==="https:"&&t.pathname!=="/"}catch{return!1}}async function dS(e,t,r){let o=jl(e);if(t.validateResourceURL)return await t.validateResourceURL(o,r?.resource);if(r){if(!Ml({requestedResource:o,configuredResource:r.resource}))throw new Error(`Protected resource ${r.resource} does not match expected ${o} (or origin)`);return new URL(r.resource)}}var bR=new Set(["bearer","dpop"]);function bo(e){let t=e.headers.get("WWW-Authenticate");if(!t)return{};let[r,o]=t.split(" ");if(!r||!bR.has(r.toLowerCase())||!o)return{};let n=mc(e,"resource_metadata")||void 0,s;if(n)try{s=new URL(n)}catch{}let i=mc(e,"scope")||void 0,c=mc(e,"error")||void 0,a=mc(e,"error_description")||void 0;return{resourceMetadataUrl:s,scope:i,error:c,errorDescription:a}}function mc(e,t){let r=e.headers.get("WWW-Authenticate");if(!r)return null;let o=new RegExp(String.raw`${t}=(?:"([^"]+)"|([^\s,]+))`),n=r.match(o);if(n){let s=n[1]||n[2];if(s)return s}return null}async function bd(e,t,r=fetch){let o=await RR(e,"oauth-protected-resource",r,{protocolVersion:t?.protocolVersion,metadataUrl:t?.resourceMetadataUrl});if(!o||o.status===404)throw await o?.text?.().catch(()=>{}),new Error("Resource server does not implement OAuth 2.0 Protected Resource Metadata.");if(!o.ok)throw await o.text?.().catch(()=>{}),new Error(`HTTP ${o.status} trying to load well-known OAuth protected resource metadata.`);return Gn.parse(await o.json())}async function pS(e,t,r=fetch){let o=_o(r);try{return await o(e,{headers:t})}catch(n){if(!(n instanceof TypeError)||!V_)throw n;if(t)try{return await o(e,{})}catch(s){if(!(s instanceof TypeError))throw s;return}return}}function zR(e,t="",r={}){return t.endsWith("/")&&(t=t.slice(0,-1)),r.prependPathname?`${t}/.well-known/${e}`:`/.well-known/${e}${t}`}async function H_(e,t,r=fetch){return await pS(e,{"MCP-Protocol-Version":t},r)}function wR(e,t){return e?t==="/"?!1:!e.ok&&e.status<500||e.status===502:!0}async function RR(e,t,r,o){let n=new URL(e),s=o?.protocolVersion??Sr,i;if(o?.metadataUrl)i=new URL(o.metadataUrl);else{let a=zR(t,n.pathname);i=new URL(a,o?.metadataServerUrl??n),i.search=n.search}let c=await H_(i,s,r);return!o?.metadataUrl&&wR(c,n.pathname)&&(c=await H_(new URL(`/.well-known/${t}`,n),s,r)),c}function mS(e){let t=typeof e=="string"?new URL(e):e,r=t.pathname!=="/",o=[];if(!r)return o.push({url:new URL("/.well-known/oauth-authorization-server",t.origin),type:"oauth"},{url:new URL("/.well-known/openid-configuration",t.origin),type:"oidc"}),o;let n=t.pathname;return n.endsWith("/")&&(n=n.slice(0,-1)),o.push({url:new URL(`/.well-known/oauth-authorization-server${n}`,t.origin),type:"oauth"},{url:new URL(`/.well-known/openid-configuration${n}`,t.origin),type:"oidc"},{url:new URL(`${n}/.well-known/openid-configuration`,t.origin),type:"oidc"}),o}async function zd(e,{fetchFn:t=fetch,protocolVersion:r=Sr,skipIssuerValidation:o=!1}={}){let n={"MCP-Protocol-Version":r,Accept:"application/json"},s=mS(e);for(let{url:i,type:c}of s){let a=await pS(i,n,t);if(!a)continue;if(!a.ok){if(await a.text?.().catch(()=>{}),a.status<500||a.status===502)continue;throw new Error(`HTTP ${a.status} trying to load ${c==="oauth"?"OAuth":"OpenID provider"} metadata from ${i}`)}let u=c==="oauth"?mo.parse(await a.json()):Wn.parse(await a.json());if(!o){let l=typeof e=="string"?e:e.href;if(!(u.issuer===l||l.endsWith("/")&&u.issuer===l.slice(0,-1)))throw new gc("metadata",l,u.issuer)}return u}}async function wd(e,t){let r,o;try{r=await bd(e,{resourceMetadataUrl:t?.resourceMetadataUrl},t?.fetchFn),r.authorization_servers&&r.authorization_servers.length>0&&(o=r.authorization_servers[0])}catch(s){if(s instanceof TypeError)throw s}o||(o=String(new URL("/",e)));let n=await zd(o,{fetchFn:t?.fetchFn,skipIssuerValidation:t?.skipIssuerMetadataValidation});return{authorizationServerUrl:o,authorizationServerMetadata:n,resourceMetadata:r}}function Rd(e){return typeof e=="string"?e:e.href}async function hS(e,{metadata:t,clientInformation:r,redirectUrl:o,scope:n,state:s,resource:i}){let c;if(t){if(c=new URL(t.authorization_endpoint),!t.response_types_supported.includes(ud))throw new Error(`Incompatible auth server: does not support response type ${ud}`);if(t.code_challenge_methods_supported&&!t.code_challenge_methods_supported.includes(ld))throw new Error(`Incompatible auth server: does not support code challenge method ${ld}`)}else c=new URL("/authorize",e);let a=await cd(),u=a.code_verifier,l=a.code_challenge;return c.searchParams.set("response_type",ud),c.searchParams.set("client_id",r.client_id),c.searchParams.set("code_challenge",l),c.searchParams.set("code_challenge_method",ld),c.searchParams.set("redirect_uri",String(o)),s&&c.searchParams.set("state",s),n&&c.searchParams.set("scope",n),n?.split(" ").includes("offline_access")&&c.searchParams.append("prompt","consent"),i&&c.searchParams.set("resource",Rd(i)),{authorizationUrl:c,codeVerifier:u}}function fS(e,t,r){return new URLSearchParams({grant_type:"authorization_code",code:e,code_verifier:t,redirect_uri:String(r)})}async function gS(e,{metadata:t,tokenRequestParams:r,clientInformation:o,addClientAuthentication:n,resource:s,dpop:i,fetchFn:c}){let a=cS(t?.token_endpoint??new URL("/token",e)),u=new Headers({"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"});s&&r.set("resource",Rd(s)),!n&&o&&iS(sS(o,t?.token_endpoint_auth_methods_supported??[]),o,u,r);let l=async()=>{let _=new Headers(u);return n&&await n(_,r,a,t),i&&_.set("DPoP",await i.buildProof({htm:"POST",htu:a})),_o(c??fetch)(a,{method:"POST",headers:_,body:r})},d=await l();if(i&&d.status===400&&(await d.clone().json().catch(()=>{}))?.error===St.UseDpopNonce&&(i.observeNonce(d,a),d=await l()),i?.observeNonce(d,a),!d.ok)throw await gd(d);let h=await d.json();try{return ho.parse(oc(h))}catch(_){throw typeof h=="object"&&h!==null&&"error"in h?await gd(JSON.stringify(h)):_}}async function _S(e,{metadata:t,clientInformation:r,refreshToken:o,scope:n,resource:s,addClientAuthentication:i,dpop:c,fetchFn:a}){let u=new URLSearchParams({grant_type:"refresh_token",refresh_token:o});n&&u.set("scope",n);let l=await gS(e,{metadata:t,tokenRequestParams:u,clientInformation:r,addClientAuthentication:i,resource:s,dpop:c,fetchFn:a});return{refresh_token:o,...l,...n&&!l.scope&&{scope:n}}}async function SS(e,t,{metadata:r,resource:o,authorizationCode:n,iss:s,scope:i,fetchFn:c}={}){n!==void 0&&_c({iss:s,expectedIssuer:r?.issuer,issParameterSupported:vd(r)});let a=r?.issuer??String(t),u=async()=>{let _=await e.clientInformation({issuer:a}),y=fd(_,a,{canPersistStamp:!1});if(_&&y===void 0)throw new as(String(_.issuer),a);return y},l=await u(),d=i??e.clientMetadata.scope,h;if(e.prepareTokenRequest&&(h=await e.prepareTokenRequest(d)),!h){if(!n)throw new Error("Either provider.prepareTokenRequest() or authorizationCode is required");if(!e.redirectUrl)throw new Error("redirectUrl is required for authorization_code flow");h=fS(n,await e.codeVerifier(),e.redirectUrl)}return l??=await u(),gS(t,{metadata:r,tokenRequestParams:h,clientInformation:l,addClientAuthentication:e.addClientAuthentication,resource:o,dpop:await e.dpop?.(),fetchFn:c})}async function yS(e,{metadata:t,clientMetadata:r,scope:o,fetchFn:n}){let s;if(t){if(!t.registration_endpoint)throw new Error("Incompatible auth server: does not support dynamic client registration");s=new URL(t.registration_endpoint)}else s=new URL("/register",e);let i={...r,...o===void 0?{}:{scope:o}},c=await _o(n??fetch)(s,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(i)});if(!c.ok)throw new Q_({status:c.status,body:await c.text(),submittedMetadata:i});return Yn.parse(oc(await c.json()))}var hc=new Set(["tools/list","prompts/list","resources/list","resources/templates/list","server/discover"]),vS=class{_entries=new Map;_maxEntries;_stamp=0;_cappedSize=0;constructor(e){this._maxEntries=e?.maxEntries??512}get size(){return this._entries.size}get(e){return this._entries.get(pd(e))}set(e,t){let r=pd(e),o=hc.has(e.method),n=!this._entries.has(r);if(!o&&n&&this._maxEntries>0&&this._cappedSize>=this._maxEntries){for(let i of this._entries.keys())if(!hc.has(i.slice(0,i.indexOf("\0")))){this._entries.delete(i),this._cappedSize--;break}}let s=++this._stamp;return this._entries.set(r,{...t,stamp:s}),n&&!o&&this._cappedSize++,s}delete(e){this._entries.delete(pd(e))&&!hc.has(e.method)&&this._cappedSize--}evict(e){let t=`${e}\0`,r=hc.has(e);for(let o of this._entries.keys())o.startsWith(t)&&(this._entries.delete(o),r||this._cappedSize--)}clear(){this._entries.clear(),this._cappedSize=0}};function pd(e){return`${e.method}\0${JSON.stringify([e.partition??"",e.params??""])}`}function md(e,t){return t===void 0?e:`${e}\0${t}`}var bS=864e5,$R=class{_evictionGeneration=new Map;_toolIndex;_toolOutputValidatorIndex;_serverIdentity="";constructor(e,t,r=()=>{},o="",n=Date.now){this._store=e,this._isUserSupplied=t,this._reportError=r,this._cachePartition=o,this._now=n}now(){return this._now()}setServerIdentity(e){this._serverIdentity=e}_partitionFor(e){return JSON.stringify([this._serverIdentity,e==="public"?"":this._cachePartition])}async _probe(e,t){let r={method:e,params:t??""},o=this._partitionFor("private"),n=await this._store.get({...r,partition:o});if(n!==void 0)return n;let s=this._partitionFor("public");if(s===o)return;let i=await this._store.get({...r,partition:s});return i?.scope==="public"?i:void 0}async evict(e){this._evictionGeneration.set(e,(this._evictionGeneration.get(e)??0)+1),await this._deleteBoth(e,"")}async _deleteBoth(e,t){let r=this._partitionFor("private"),o=this._partitionFor("public");try{await this._store.delete({method:e,params:t,partition:r})}catch(n){this._reportError(n)}if(o!==r)try{await this._store.delete({method:e,params:t,partition:o})}catch(n){this._reportError(n)}}async evictKey(e,t){let r=md(e,t),o=this._evictionGeneration.get(r);o!==void 0&&this._evictionGeneration.set(r,o+1),await this._deleteBoth(e,t)}captureGeneration(e,t){let r=md(e,t),o=this._evictionGeneration.get(r)??0;return this._evictionGeneration.set(r,o),o}async write(e,t,r,o){if((this._evictionGeneration.get(md(e,o?.params))??0)!==r)return;let n=o?.params??"",s=this._partitionFor("private"),i=this._partitionFor("public"),c=(o?.scope??"private")==="public"?i:s;try{await this._store.set({method:e,params:n,partition:c},{value:PR(t),expiresAt:o?.expiresAt,scope:o?.scope})}catch(a){this._reportError(a)}if(i!==s)try{await this._store.delete({method:e,params:n,partition:c===s?i:s})}catch(a){this._reportError(a)}}async read(e,t){let r=await this._probe(e,t);if(!(r?.expiresAt===void 0||!(r.expiresAt>this.now())))try{let o=JSON.parse(r.value);if(typeof o!="object"||o===null||Array.isArray(o))throw new TypeError("cached document is not an object");return{value:o}}catch(o){this._reportError(o),await this._deleteBoth(e,t??"");return}}resetForReconnect(){this._isUserSupplied||this._store.clear(),this._evictionGeneration.clear(),this._toolIndex=void 0,this._toolOutputValidatorIndex=void 0,this._serverIdentity=""}async toolDefinition(e){let t=await this._probe("tools/list");if(t===void 0){this._toolIndex=void 0;return}if(this._toolIndex?.stamp!==t.stamp){let r=this._decodeListTools(t),o=new Map;if(r!==void 0)for(let n of r.tools)o.set(n.name,n);this._toolIndex={stamp:t.stamp,byName:o}}return this._toolIndex.byName.get(e)}async outputValidator(e,t){let r=await this._probe("tools/list");if(r===void 0){this._toolOutputValidatorIndex=void 0;return}if(this._toolOutputValidatorIndex?.stamp!==r.stamp){let o=this._decodeListTools(r)??{tools:[]},n=new Map;for(let s of o.tools){let i=t(s);i!==void 0&&n.set(s.name,i)}this._toolOutputValidatorIndex={stamp:r.stamp,byName:n}}return this._toolOutputValidatorIndex.byName.get(e)}_decodeListTools(e){try{let t=JSON.parse(e.value);if(!Array.isArray(t?.tools)||!t.tools.every(r=>r!==null&&typeof r=="object"))throw new TypeError("cached tools/list document has a malformed tools array");return t}catch(t){this._reportError(t);return}}};function PR(e){let t;try{t=JSON.stringify(e)}catch(r){throw new TypeError(`cache value is not JSON-serializable: ${r instanceof Error?r.message:String(r)}`)}if(typeof t!="string")throw new TypeError("cache value is not JSON-serializable: it has no JSON representation");return t}var zS=Symbol.for("mcp.authSeamEscape");function nt(e){if(typeof e=="object"&&e!==null||typeof e=="function")try{Object.defineProperty(e,zS,{value:!0,configurable:!0})}catch{}return e}function ER(e){return(typeof e=="object"&&e!==null||typeof e=="function")&&e[zS]===!0}var TR=-32022,kR=new Set([-32001,-32020,-32021]);function CR(e,t){switch(e.kind){case"result":return OR(e.result,t);case"rpc-error":return wS(e,t);case"http-error":return IR(e,t);case"network-error":return B_(e.error,t);case"unusable-reply":return{kind:"error",error:new re(ee.EraNegotiationFailed,`Version negotiation probe failed: the server answered with an unusable reply (${RS(e.error)})`,{cause:e.error},{cause:e.error})};case"auth-required":return{kind:"error",error:e.error};case"closed":return t.transportKind==="stdio"?{kind:"legacy"}:B_(new Error("Connection closed during the version negotiation probe"),t);case"timeout":return t.transportKind==="stdio"?{kind:"legacy"}:{kind:"error",error:new re(ee.RequestTimeout,`Version negotiation probe timed out after ${e.timeoutMs}ms`,{timeout:e.timeoutMs})}}}function OR(e,t){let r=Nt(nc).validateResult("server/discover",e);if(!r.ok)return{kind:"legacy"};let o=r.value.supportedVersions,n=t.clientModernVersions.find(s=>o.includes(s));return n!==void 0?{kind:"modern",version:n,discover:r.value}:t.fallbackAvailable?{kind:"legacy"}:{kind:"error",error:new ns({supported:[...o],requested:t.requestedVersion})}}function wS(e,t){let{code:r,message:o,data:n}=e;if(r===TR){let s=NR(n);if(s===void 0)return{kind:"legacy"};let i=new ns({supported:s,requested:AR(n)??t.requestedVersion},o),c=os(s),a=t.clientModernVersions.find(u=>c.includes(u));return a!==void 0?{kind:"corrective",version:a,error:i}:c.length>0?{kind:"error",error:i}:t.fallbackAvailable?{kind:"legacy"}:{kind:"error",error:i}}return kR.has(r)?{kind:"legacy"}:{kind:"legacy"}}function IR(e,t){if(e.status===401||e.status===403){let o=e.status===403;return{kind:"error",error:new mt(o?ee.ClientHttpForbidden:ee.ClientHttpAuthentication,`Version negotiation failed: ${o?"the server denied access (HTTP 403)":"the server requires authorization (HTTP 401)"}`,{status:e.status,statusText:e.statusText,text:e.body})}}if(e.status>=500)return{kind:"error",error:new mt(ee.EraNegotiationFailed,`Version negotiation failed: the server answered the probe with HTTP ${e.status}`,{status:e.status,statusText:e.statusText,text:e.body})};let r=jR(e.body);return r!==void 0?wS(r,t):{kind:"legacy"}}function B_(e,t){return t.environment==="browser"&&xR(e)?{kind:"legacy"}:{kind:"error",error:new re(ee.EraNegotiationFailed,`Version negotiation probe failed: ${RS(e)}`,{cause:e},{cause:e})}}function xR(e){return e instanceof TypeError||e instanceof Error&&e.name==="TypeError"}function RS(e){return e instanceof Error?e.message:String(e)}function NR(e){if(typeof e!="object"||e===null)return;let t=e.supported;if(!(!Array.isArray(t)||t.length===0||!t.every(r=>typeof r=="string")))return t}function AR(e){if(typeof e!="object"||e===null)return;let t=e.requested;return typeof t=="string"?t:void 0}function jR(e){if(e===void 0||e==="")return;let t;try{t=JSON.parse(e)}catch{return}if(typeof t!="object"||t===null)return;let r=t.error;if(typeof r!="object"||r===null)return;let{code:o,message:n,data:s}=r;if(typeof o=="number")return{code:o,message:typeof n=="string"?n:"",data:s}}var MR="legacy";function qR(e,t){let r=e?.mode??MR;if(r==="legacy")return{kind:"legacy"};let o=e?.probe??{};if(typeof r=="object"){if(!yt(r.pin))throw new TypeError(`versionNegotiation: { pin: '${r.pin}' } is not a modern protocol revision \u2014 pinning is for 2026-07-28 and later; omit versionNegotiation (or use mode: 'legacy') for 2025-era servers.`);return{kind:"pin",version:r.pin,probe:o}}let n=t?os(t):[];return{kind:"auto",modernVersions:n.length>0?n:[...ql],fallbackAvailable:t?Ll(t).length>0:!0,probe:o}}function J_(){let e=globalThis;return e.window!==void 0&&e.document!==void 0?"browser":"node"}function K_(e){return"stderr"in e&&"pid"in e?"stdio":"http"}var LR=class $S{_pending;_probeCounter=0;_savedOnMessage;_savedOnError;_savedOnClose;_closeDelivered=!1;constructor(t){this._transport=t,this._savedOnMessage=t.onmessage,this._savedOnError=t.onerror,this._savedOnClose=t.onclose}static async open(t){let r=new $S(t);t.onmessage=o=>{let n=r._pending;if(n!==void 0&&(wr(o)||Rr(o))&&o.id===n.id){r._pending=void 0,wr(o)?n.resolve({kind:"response",result:o.result}):n.resolve({kind:"response",error:o.error});return}},t.onerror=o=>{r._savedOnError?.(o)},t.onclose=()=>{let o=r._pending;o!==void 0&&(r._pending=void 0,o.resolve({kind:"closed"})),r._closeDelivered=!0,r._savedOnClose?.()};try{await t.start()}catch(o){throw r.detach(),o}return r}async exchange(t,r){let o=`server-discover-probe-${++this._probeCounter}`;return new Promise(n=>{let s=!1,i=a=>{s||(s=!0,clearTimeout(c),this._pending?.id===o&&(this._pending=void 0),n(a))},c=setTimeout(()=>i({kind:"timeout"}),r);this._pending={id:o,resolve:i},this._transport.send(t(o)).catch(a=>i({kind:"send-error",error:a}))})}detach(){if(this._pending=void 0,this._transport.onmessage=this._savedOnMessage,this._transport.onerror=this._savedOnError,this._closeDelivered&&this._savedOnClose!==void 0){let t=this._savedOnClose,r=this._transport,o=!1,n=()=>{if(!o){o=!0;return}t()};r.onclose=n,_d.set(r,()=>{r.onclose===n&&(r.onclose=t)})}else this._transport.onclose=this._savedOnClose}release(){this.detach();let t=this._transport,r=t.start,o=!0;t.start=async function(){if(o){o=!1,t.start=r;return}return r.call(t)}}},_d=new WeakMap;function G_(e){let t=_d.get(e);_d.delete(e),t?.()}function DR(e,t,r,o){return{jsonrpc:"2.0",id:e,method:"server/discover",params:{_meta:Nt(t).outboundEnvelope({protocolVersion:t,clientInfo:r,clientCapabilities:o})}}}function UR(e){return e instanceof re&&e.code===ee.ClientHttpUnexpectedContent?!0:e instanceof Error&&e.name==="SyntaxError"}function ZR(e,t){switch(e.kind){case"response":return e.error===void 0?{kind:"result",result:e.result}:{kind:"rpc-error",...e.error};case"send-error":{let r=e.error;if(ER(r)||r instanceof gt||r instanceof Error&&r.name==="UnauthorizedError")return{kind:"auth-required",error:r};if(r instanceof mt){let o=r.data?.text;return{kind:"http-error",status:r.data.status,body:typeof o=="string"?o:void 0,statusText:r.data.statusText}}return UR(r)?{kind:"unusable-reply",error:r}:{kind:"network-error",error:r}}case"closed":return{kind:"closed"};case"timeout":return{kind:"timeout",timeoutMs:t}}}async function PS(e,t){let r=e.probe.timeoutMs??t.defaultTimeoutMs,o=Math.max(0,e.probe.maxRetries??0),n=e.kind==="pin"?[e.version]:e.modernVersions,s=e.kind==="auto"&&e.fallbackAvailable,i=await LR.open(t.transport),c=async()=>{let u=n[0],l=!1,d=o;for(;;){let h=await i.exchange(z=>DR(z,u,t.clientInfo,t.capabilities),r);if(h.kind==="timeout"&&d>0){d--;continue}let _=ZR(h,r),y=CR(_,{clientModernVersions:n,requestedVersion:u,fallbackAvailable:s,environment:t.environment,transportKind:t.transportKind});switch(y.kind){case"modern":return{era:"modern",version:y.version,discover:y.discover};case"corrective":if(l)throw y.error;l=!0,u=y.version;continue;case"legacy":{let z=_.kind==="closed"?"the connection closed during the server/discover probe":void 0;if(e.kind==="pin")throw new re(ee.EraNegotiationFailed,z===void 0?`Version negotiation failed: the server did not offer pinned protocol version ${e.version} via server/discover (no fallback in pin mode)`:`Version negotiation failed: ${z} before the server offered pinned protocol version ${e.version} (no fallback in pin mode)`);if(!e.fallbackAvailable)throw new re(ee.EraNegotiationFailed,z===void 0?"Version negotiation failed: the server gave no modern evidence and this client supports no pre-2026-07-28 protocol version to fall back to":`Version negotiation failed: ${z} and this client supports no pre-2026-07-28 protocol version to fall back to`);if(z!==void 0&&t.disposableProbe!==!0)throw new re(ee.EraNegotiationFailed,`Version negotiation failed: ${z} (this transport probed in place \u2014 the disposable sibling probe requires the SDK's base StdioClientTransport)`);return{era:"legacy"}}case"error":throw y.error}}},a;try{a=await c()}catch(u){throw i.detach(),u}return i.release(),a}function VR(e){let t=Object.getPrototypeOf(e);if(t===null||!Object.prototype.hasOwnProperty.call(t,"_dispose"))return;let r=e._serverParams;return typeof r=="object"&&r!==null&&typeof r.command=="string"?r:void 0}async function FR(e,t,r,o){let n=t.constructor,s=new n({...r,stderr:"ignore"}),i=t.close,c=!1,a,u=new Promise((d,h)=>{a=()=>h(W_())});t.close=async function(){return c=!0,a?.(),i.call(t)};let l;try{let d=PS(e,{...o,transport:s,transportKind:"stdio",disposableProbe:!0});d.catch(()=>{}),l=await Promise.race([d,u])}finally{await HR(s),t.close=i}if(c)throw W_();return l}function W_(){return new re(ee.EraNegotiationFailed,"Version negotiation failed: the transport was closed during the server/discover probe")}async function HR(e){try{let t=e._dispose;await(typeof t=="function"?t.call(e):e.close())}catch{}}function Y_(e){let t=e._meta?.[_t];return Gl.Implementation(t)?t:void 0}function fc(e,t){if(!(!e||t===null||typeof t!="object")){if(e.type==="object"&&e.properties&&typeof e.properties=="object"){let r=t,o=e.properties;for(let n of Object.keys(o)){let s=o[n];r[n]===void 0&&Object.prototype.hasOwnProperty.call(s,"default")&&(r[n]=s.default),r[n]!==void 0&&fc(s,r[n])}}if(Array.isArray(e.anyOf))for(let r of e.anyOf)typeof r!="boolean"&&fc(r,t);if(Array.isArray(e.oneOf))for(let r of e.oneOf)typeof r!="boolean"&&fc(r,t)}}function ES(e){if(!e)return{supportsFormMode:!1,supportsUrlMode:!1};let t=e.form!==void 0,r=e.url!==void 0;return{supportsFormMode:t||!t&&!r,supportsUrlMode:r}}function BR(e){if(typeof e=="object"&&e!==null&&(e.kind==="legacy"&&!("supportedVersions"in e)&&!("discover"in e)||e.kind==="modern"&&zr.safeParse(e.discover).success))return e;throw new re(ee.EraNegotiationFailed,"connect({ prior }): unrecognized prior \u2014 expected { kind: 'modern', discover } or { kind: 'legacy' }")}var X_={"notifications/tools/list_changed":["tools/list"],"notifications/prompts/list_changed":["prompts/list"],"notifications/resources/list_changed":["resources/list","resources/templates/list"]},JR=64,hd={},TS=class extends Yl{_serverCapabilities;_serverVersion;_capabilities;_instructions;_jsonSchemaValidator;_cache;_defaultCacheTtlMs;_listMaxPages;_listChangedDebounceTimers=new Map;_listChangedConfig;_enforceStrictCapabilities;_versionNegotiation;_supportedProtocolVersionsOption;_inputRequiredDriverConfig;_listenState=new Map;_nextListenId=0;_autoOpenedSubscription;_discoverResult;static{hd.enforceStrictCapabilities=e=>e._enforceStrictCapabilities,hd.walkPages=(e,t,r,o)=>e._walkPages(t,r,o),hd.readResource=(e,t,r)=>e._readResource(t,r)}_resetConnectionState(){if(this._negotiatedProtocolVersion=void 0,this._serverCapabilities=void 0,this._serverVersion=void 0,this._instructions=void 0,this._discoverResult=void 0,this._autoOpenedSubscription=void 0,this._listenState.size>0){let e=new re(ee.ConnectionClosed,"subscriptions/listen: client reconnected or closed; subscription state from the previous connection was reset");for(let t of this._listenState.values())t.settle({cause:"remote",error:e})}this._listenState.clear();for(let e of this._listChangedDebounceTimers.values())clearTimeout(e);this._listChangedDebounceTimers.clear(),this._cache.resetForReconnect()}async close(){try{await super.close()}finally{this._resetConnectionState()}}constructor(e,t){super(t),this._clientInfo=e,this._capabilities=t?.capabilities?{...t.capabilities}:{},this._jsonSchemaValidator=t?.jsonSchemaValidator??new pc,this._enforceStrictCapabilities=t?.enforceStrictCapabilities??!1,this._versionNegotiation=t?.versionNegotiation,this._supportedProtocolVersionsOption=t?.supportedProtocolVersions,this._inputRequiredDriverConfig=u_(t?.inputRequired),this._cache=new $R(t?.responseCacheStore??new vS,t?.responseCacheStore!==void 0,r=>this._reportStoreError(r),t?.cachePartition??""),this._defaultCacheTtlMs=t?.defaultCacheTtlMs??0,this._listMaxPages=t?.listMaxPages??JR,t?.listChanged&&(this._listChangedConfig=t.listChanged)}buildContext(e,t){return e}_shouldDropInbound(e){if(this._negotiatedProtocolVersion!==void 0&&yt(this._negotiatedProtocolVersion)&&rr(e))return"drop"}_outboundMetaEnvelope(){let e=this._negotiatedProtocolVersion;if(e!==void 0)return this._wireCodec().outboundEnvelope({protocolVersion:e,clientInfo:this._clientInfo,clientCapabilities:this._capabilities})}_resolveNonCompleteResult(e,t){return this._inputRequiredDriverConfig.autoFulfill?m_({getRequestHandler:r=>this._getRequestHandler(r),buildContext:r=>this.buildContext(r,void 0),sessionId:this.transport?.sessionId},this._inputRequiredDriverConfig,e,t):Promise.reject(new re(ee.UnsupportedResultType,`Unsupported result type 'input_required' for ${t.request.method}: multi-round-trip auto-fulfilment is not enabled on this instance \u2014 pass allowInputRequired: true to handle it manually, or enable inputRequired.autoFulfill`,{resultType:"input_required",method:t.request.method}))}_setupListChangedHandlers(e){e.tools&&this._serverCapabilities?.tools?.listChanged&&this._setupListChangedHandler("tools","notifications/tools/list_changed",e.tools,async()=>(await this.listTools(void 0,{cacheMode:"refresh"})).tools),e.prompts&&this._serverCapabilities?.prompts?.listChanged&&this._setupListChangedHandler("prompts","notifications/prompts/list_changed",e.prompts,async()=>(await this.listPrompts(void 0,{cacheMode:"refresh"})).prompts),e.resources&&this._serverCapabilities?.resources?.listChanged&&this._setupListChangedHandler("resources","notifications/resources/list_changed",e.resources,async()=>(await this.listResources(void 0,{cacheMode:"refresh"})).resources)}registerCapabilities(e){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=Xl(this._capabilities,e)}setVersionNegotiation(e){if(this.transport)throw new Error("Cannot configure version negotiation after connecting to transport");this._versionNegotiation=e}_wrapHandler(e,t){return e==="elicitation/create"?async(r,o)=>{let n=Nt(this._negotiatedProtocolVersion),s=n.validateRequest("elicitation/create",r);if(!s.ok&&s.reason==="not-in-era"&&(s=n.validateInputRequest("elicitation/create",r)),!s.ok)throw new be(s.reason==="not-in-era"?ue.InternalError:ue.InvalidParams,s.reason==="not-in-era"?"No wire schema for elicitation/create in the resolved era":`Invalid elicitation request: ${s.message}`);let{params:i}=s.value;i.mode=i.mode??"form";let{supportsFormMode:c,supportsUrlMode:a}=ES(this._capabilities.elicitation);if(i.mode==="form"&&!c)throw new be(ue.InvalidParams,"Client does not support form-mode elicitation requests");if(i.mode==="url"&&!a)throw new be(ue.InvalidParams,"Client does not support URL-mode elicitation requests");let u=await t(r,o),l=n.validateResult("elicitation/create",u);if(!l.ok&&l.reason==="not-in-era"&&(l=n.validateInputResponse("elicitation/create",u)),!l.ok)throw new be(l.reason==="not-in-era"?ue.InternalError:ue.InvalidParams,l.reason==="not-in-era"?"No wire schema for elicitation/create in the resolved era":`Invalid elicitation result: ${l.message}`);let d=l.value,h=i.mode==="form"?i.requestedSchema:void 0;if(i.mode==="form"&&d.action==="accept"&&d.content&&h&&this._capabilities.elicitation?.form?.applyDefaults)try{fc(h,d.content)}catch{}return d}:e==="sampling/createMessage"?async(r,o)=>{let n=Nt(this._negotiatedProtocolVersion),s=n.validateRequest("sampling/createMessage",r);if(!s.ok&&s.reason==="not-in-era"&&(s=n.validateInputRequest("sampling/createMessage",r)),!s.ok)throw new be(s.reason==="not-in-era"?ue.InternalError:ue.InvalidParams,s.reason==="not-in-era"?"No wire schema for sampling/createMessage in the resolved era":`Invalid sampling request: ${s.message}`);let{params:i}=s.value,c=await t(r,o),a=!!(i.tools||i.toolChoice),u=n.samplingResultVariant(a,c);if(!u.ok&&u.reason==="not-in-era"&&(u=n.validateInputResponse("sampling/createMessage",c)),!u.ok)throw new be(u.reason==="not-in-era"?ue.InternalError:ue.InvalidParams,u.reason==="not-in-era"?"No result schema for sampling/createMessage in the resolved era":`Invalid sampling result: ${u.message}`);return u.value}:t}assertCapability(e,t){if(!this._serverCapabilities?.[e])throw new re(ee.CapabilityNotSupported,`Server does not support ${e} (required for ${t})`)}async connect(e,t){if(t?.prior!=null)return this._connectFromPrior(e,BR(t.prior),t);let r=qR(this._versionNegotiation,this._supportedProtocolVersionsOption);return r.kind!=="legacy"?this._connectNegotiated(e,r,t):this._connectPlainLegacy(e,t)}async _connectPlainLegacy(e,t){if(await super.connect(e),e.sessionId!==void 0){let r=this._negotiatedProtocolVersion;r!==void 0&&e.setProtocolVersion?.(r);return}this._resetConnectionState(),await this._legacyHandshake(e,t)}async _legacyHandshake(e,t){let r=Ll(this._supportedProtocolVersions);try{let o=r[0];if(o===void 0)throw new re(ee.EraNegotiationFailed,"Cannot run the initialize handshake: supportedProtocolVersions contains no pre-2026-07-28 protocol version");let n=await this.request({method:"initialize",params:{protocolVersion:o,capabilities:this._capabilities,clientInfo:this._clientInfo}},t);if(n===void 0)throw new Error(`Server sent invalid initialize result: ${n}`);if(!r.includes(n.protocolVersion))throw new Error(`Server's protocol version is not supported: ${n.protocolVersion}`);this._serverCapabilities=n.capabilities,this._serverVersion=n.serverInfo,this._cache.setServerIdentity(this._deriveServerIdentity(e)),e.setProtocolVersion&&e.setProtocolVersion(n.protocolVersion),this._instructions=n.instructions,await this.notification({method:"notifications/initialized"}),this._negotiatedProtocolVersion=n.protocolVersion,this._listChangedConfig&&this._setupListChangedHandlers(this._listChangedConfig)}catch(o){throw this.close(),o}}async _connectNegotiated(e,t,r){if(e.sessionId!==void 0){await super.connect(e);let n=this._negotiatedProtocolVersion;n!==void 0&&e.setProtocolVersion&&e.setProtocolVersion(n);return}this._resetConnectionState();let o;try{let n=K_(e),s={clientInfo:this._clientInfo,capabilities:this._capabilities,environment:J_(),defaultTimeoutMs:r?.timeout??ss},i=n==="stdio"?VR(e):void 0;o=i===void 0?await PS(t,{...s,transport:e,transportKind:n}):await FR(t,e,i,s)}catch(n){throw await e.close().catch(()=>{}),G_(e),n}if(G_(e),await super.connect(e),o.era==="legacy"){await this._legacyHandshake(e,r);return}if(this._serverCapabilities=o.discover.capabilities,this._serverVersion=Y_(o.discover),this._cache.setServerIdentity(this._deriveServerIdentity(e)),this._instructions=o.discover.instructions,this._discoverResult=o.discover,this._negotiatedProtocolVersion=o.version,e.setProtocolVersion&&e.setProtocolVersion(o.version),this._listChangedConfig){let n=this._listChangedConfig,s=this._serverCapabilities,i={...n.tools&&s?.tools?.listChanged&&{tools:n.tools},...n.prompts&&s?.prompts?.listChanged&&{prompts:n.prompts},...n.resources&&s?.resources?.listChanged&&{resources:n.resources}},c=!0;try{this._setupListChangedHandlers(i)}catch(u){c=!1,this.onerror?.(u instanceof Error?u:new Error(String(u)))}let a=c?{...i.tools&&{toolsListChanged:!0},...i.prompts&&{promptsListChanged:!0},...i.resources&&{resourcesListChanged:!0}}:{};if(Object.keys(a).length>0){let u=new AbortController,l=()=>u.abort(r?.signal?.reason);r?.signal?.aborted&&l(),r?.signal?.addEventListener("abort",l);try{this._autoOpenedSubscription=await this.listen(a,{timeout:r?.timeout,signal:u.signal})}catch(d){if(r?.signal?.aborted)throw await this.close().catch(()=>{}),d;this.onerror?.(d instanceof Error?d:new Error(String(d)))}finally{r?.signal?.removeEventListener("abort",l)}}}}async _connectFromPrior(e,t,r){if(t.kind==="legacy")return this._connectPlainLegacy(e,r);let o=t.discover;this._resetConnectionState();let n=this._supportedProtocolVersionsOption,s=(n&&os(n).length>0?os(n):ql).find(i=>o.supportedVersions.includes(i));if(s===void 0)throw new re(ee.EraNegotiationFailed,"connect({ prior }) with a modern verdict requires a 2026-07-28+ mutual protocol version; the supplied DiscoverResult and this client's supportedProtocolVersions have no modern overlap. For a server known to be legacy, pass prior: { kind: 'legacy' } to skip the probe and initialize directly, or use versionNegotiation: { mode: 'auto' } to re-probe with legacy fallback.");if(await super.connect(e),this._discoverResult=o,this._serverCapabilities=o.capabilities,this._serverVersion=Y_(o),this._cache.setServerIdentity(this._deriveServerIdentity(e)),this._instructions=o.instructions,this._negotiatedProtocolVersion=s,e.setProtocolVersion?.(s),this._listChangedConfig)try{this._setupListChangedHandlers(this._listChangedConfig)}catch(i){this.onerror?.(i instanceof Error?i:new Error(String(i)))}}getServerCapabilities(){return this._serverCapabilities}getServerVersion(){return this._serverVersion}_deriveServerIdentity(e){let t=this._serverVersion;return t!==void 0?`${t.name}@${t.version}`:e.sessionId??`anonymous:${Date.now()}-${Math.random().toString(36).slice(2)}`}getNegotiatedProtocolVersion(){return this._negotiatedProtocolVersion}getProtocolEra(){let e=this._negotiatedProtocolVersion;if(e!==void 0)return yt(e)?"modern":"legacy"}getInstructions(){return this._instructions}getDiscoverResult(){return this._discoverResult}assertCapabilityForMethod(e){switch(e){case"logging/setLevel":if(!this._serverCapabilities?.logging)throw new re(ee.CapabilityNotSupported,`Server does not support logging (required for ${e})`);break;case"prompts/get":case"prompts/list":if(!this._serverCapabilities?.prompts)throw new re(ee.CapabilityNotSupported,`Server does not support prompts (required for ${e})`);break;case"resources/list":case"resources/templates/list":case"resources/read":case"resources/subscribe":case"resources/unsubscribe":if(!this._serverCapabilities?.resources)throw new re(ee.CapabilityNotSupported,`Server does not support resources (required for ${e})`);if(e==="resources/subscribe"&&!this._serverCapabilities.resources.subscribe)throw new re(ee.CapabilityNotSupported,`Server does not support resource subscriptions (required for ${e})`);break;case"tools/call":case"tools/list":if(!this._serverCapabilities?.tools)throw new re(ee.CapabilityNotSupported,`Server does not support tools (required for ${e})`);break;case"completion/complete":if(!this._serverCapabilities?.completions)throw new re(ee.CapabilityNotSupported,`Server does not support completions (required for ${e})`);break;case"initialize":break;case"server/discover":break;case"ping":break}}assertNotificationCapability(e){switch(e){case"notifications/roots/list_changed":if(!this._capabilities.roots?.listChanged)throw new re(ee.CapabilityNotSupported,`Client does not support roots list changed notifications (required for ${e})`);break;case"notifications/initialized":break;case"notifications/cancelled":break;case"notifications/progress":break}}assertRequestHandlerCapability(e){switch(e){case"sampling/createMessage":if(!this._capabilities.sampling)throw new re(ee.CapabilityNotSupported,`Client does not support sampling capability (required for ${e})`);break;case"elicitation/create":if(!this._capabilities.elicitation)throw new re(ee.CapabilityNotSupported,`Client does not support elicitation capability (required for ${e})`);break;case"roots/list":if(!this._capabilities.roots)throw new re(ee.CapabilityNotSupported,`Client does not support roots capability (required for ${e})`);break;case"ping":break}}async ping(e){return this.request({method:"ping"},e)}async discover(e){let t=await this._requestWithSchema({method:"server/discover"},zr,e);return this._discoverResult=t,t}async complete(e,t){return this.request({method:"completion/complete",params:e},t)}async setLoggingLevel(e,t){return this.request({method:"logging/setLevel",params:{level:e}},t)}async getPrompt(e,t){return this.request({method:"prompts/get",params:e},t)}async listPrompts(e,t){if(!this._serverCapabilities?.prompts&&!this._enforceStrictCapabilities)return console.debug("Client.listPrompts() called but server does not advertise prompts capability - returning empty list"),{prompts:[]};if(e?.cursor!==void 0)return this.request({method:"prompts/list",params:e},t);let r=await this._serveFromCache("prompts/list",void 0,t);return r!==void 0?r:this._listAllPages("prompts/list",e,t,o=>o.prompts)}async listResources(e,t){if(!this._serverCapabilities?.resources&&!this._enforceStrictCapabilities)return console.debug("Client.listResources() called but server does not advertise resources capability - returning empty list"),{resources:[]};if(e?.cursor!==void 0)return this.request({method:"resources/list",params:e},t);let r=await this._serveFromCache("resources/list",void 0,t);return r!==void 0?r:this._listAllPages("resources/list",e,t,o=>o.resources)}async listResourceTemplates(e,t){if(!this._serverCapabilities?.resources&&!this._enforceStrictCapabilities)return console.debug("Client.listResourceTemplates() called but server does not advertise resources capability - returning empty list"),{resourceTemplates:[]};if(e?.cursor!==void 0)return this.request({method:"resources/templates/list",params:e},t);let r=await this._serveFromCache("resources/templates/list",void 0,t);return r!==void 0?r:this._listAllPages("resources/templates/list",e,t,o=>o.resourceTemplates)}async _listAllPages(e,t,r,o,n){let s=r?.cacheMode==="bypass",i=this._cache.captureGeneration(e),c=u=>{let l=u===void 0?t&&{...t}:{...t,cursor:u};return this.request({method:e,...l&&{params:l}},r)},a=await this._walkPages(e,c,o);return delete a.nextCursor,n?.(a),s||await this._cache.write(e,a,i,this._freshness(a)),a}async _walkPages(e,t,r){let o=await t(void 0),n=o.nextCursor,s=o,i=1;for(;n!==void 0;){if(this._listMaxPages!==0&&i>=this._listMaxPages)throw new re(ee.ListPaginationExceeded,`${e}: exceeded listMaxPages (${this._listMaxPages}); server pagination did not terminate`,{method:e,listMaxPages:this._listMaxPages});let c=await t(n);if(c.nextCursor===n&&JSON.stringify(r(c))===JSON.stringify(r(s)))break;r(o).push(...r(c)),s=c,n=c.nextCursor,i++}return o}_freshness(e,t){let r=e,o=typeof r.ttlMs=="number"?r.ttlMs:this._defaultCacheTtlMs,n=r.cacheScope==="public"?"public":"private";return{expiresAt:this._cache.now()+Math.min(Math.max(0,o),bS),scope:n,params:t}}async _serveFromCache(e,t,r){if(r?.cacheMode==="bypass"||r?.cacheMode==="refresh")return;let o=await this._cache.read(e,t).catch(n=>void this._reportStoreError(n));if(o!==void 0){if(r?.signal?.aborted){let n=r.signal.reason;throw n instanceof re?n:new re(ee.RequestTimeout,String(n))}return o.value}}_reportStoreError(e){this.onerror?.(e instanceof Error?e:new Error(String(e)))}_compileOutputValidator(e){if(e.outputSchema)try{return{ok:!0,validator:this._jsonSchemaValidator.getValidator(e.outputSchema)}}catch(t){return{ok:!1,compileError:t}}}async _resolveXMcpHeaderScan(e,t){let r=t??await this._cache.toolDefinition(e);return r===void 0?void 0:Bl(r.inputSchema)}async readResource(e,t){let{result:r}=await this._readResource(e,t);return r}async _readResource(e,t){let r=await this._serveFromCache("resources/read",e.uri,t);if(r!==void 0)return{result:r,cached:!0};let o=this._cache.captureGeneration("resources/read",e.uri),n=await this.request({method:"resources/read",params:e},t);if(t?.cacheMode!=="bypass"){let s=this._freshness(n,e.uri);s.expiresAt>this._cache.now()?await this._cache.write("resources/read",n,o,s):t?.cacheMode==="refresh"&&await this._cache.evictKey("resources/read",e.uri)}return{result:n,cached:!1}}async subscribeResource(e,t){return this.request({method:"resources/subscribe",params:e},t)}async unsubscribeResource(e,t){return this.request({method:"resources/unsubscribe",params:e},t)}async listen(e,t){if(this.transport===void 0)throw new re(ee.NotConnected,"Not connected");let r=this._negotiatedProtocolVersion;if(r===void 0||!yt(r))throw new re(ee.MethodNotSupportedByProtocolVersion,`subscriptions/listen requires a 2026-07-28-era connection (negotiated: ${r??"none"}). On a 2025-era connection, change notifications are delivered unsolicited: use ClientOptions.listChanged and resources/subscribe instead.`,{method:"subscriptions/listen",protocolVersion:r});if(t?.signal?.aborted){let $=t.signal.reason;throw $ instanceof re?$:new re(ee.RequestTimeout,String($))}let o=new AbortController,n=`listen:${this._nextListenId++}`,s="opening",i,c,a,u,l=new Promise(($,E)=>{a=$,u=E}),d,h=new Promise($=>{d=$}),_=$=>{if(s==="closed")return;let E=s==="opening";if(i!==void 0&&(clearTimeout(i),i=void 0),"ack"in $){s="open",a($.ack);return}s="closed",c!==void 0&&t?.signal?.removeEventListener("abort",c),this._listenState.delete(n),o.abort(),d($.cause),E&&u($.error??new re(ee.ConnectionClosed,"subscriptions/listen closed before the server acknowledged"))},y=async()=>{o.abort(),await this.notification({method:"notifications/cancelled",params:{requestId:n}}).catch(()=>{})},z=async()=>{s!=="closed"&&(_({cause:"local"}),await y())};this._listenState.set(n,{settle:_});let b=t?.timeout??ss;if(i=setTimeout(()=>{_({cause:"remote",error:new re(ee.RequestTimeout,"subscriptions/listen ack timed out",{timeout:b})}),y().catch(()=>{})},b),t?.signal){let $=t.signal;c=()=>{if(s==="closed")return;let E=$.reason;_({cause:"local",error:E instanceof Error?E:new Error(String(E??"Aborted"))}),y().catch(()=>{})},$.addEventListener("abort",c,{once:!0})}let g={jsonrpc:"2.0",id:n,method:"subscriptions/listen",params:{_meta:{...this._outboundMetaEnvelope()},notifications:e}},P=$=>{_({cause:"remote",error:$ instanceof Error?$:new Error(String($))})};try{this.transport.send(g,{requestSignal:o.signal,onRequestStreamEnd:()=>_({cause:"remote",error:new Error("subscriptions/listen: stream ended")})}).catch(P)}catch($){P($)}return{honoredFilter:await l,close:z,closed:h}}get autoOpenedSubscription(){return this._autoOpenedSubscription}_onnotification(e,t){let r=Object.hasOwn(X_,e.method)?X_[e.method]:void 0;if(e.method==="notifications/resources/updated"){let o=e.params?.uri;typeof o=="string"&&this._cache.evictKey("resources/read",o)}else if(r!==void 0)for(let o of r)this._cache.evict(o);if(e.method==="notifications/subscriptions/acknowledged"){let o=e.params?._meta?.[Qr],n=typeof o=="string"?this._listenState.get(o):void 0;if(n!==void 0){let s=this._wireCodec().validateNotification("notifications/subscriptions/acknowledged",e);n.settle({ack:s.ok?s.value.params.notifications:{}});return}}if(e.method==="notifications/cancelled"){let o=e.params?.requestId,n=typeof o=="string"?this._listenState.get(o):void 0;if(n!==void 0){n.settle({cause:"remote",error:new Error("subscriptions/listen: server cancelled the subscription")});return}}super._onnotification(e,t)}_onresponse(e){let t=e.id,r=typeof t=="string"?this._listenState.get(t):void 0;if(r!==void 0){Rr(e)?r.settle({cause:"remote",error:be.fromError(e.error.code,e.error.message,e.error.data)}):r.settle({cause:"graceful",error:new re(ee.ConnectionClosed,"subscriptions/listen: server closed the subscription gracefully before acknowledging")});return}super._onresponse(e)}_onclose(){if(this._listenState.size>0){let e=new re(ee.ConnectionClosed,"Connection closed");for(let t of this._listenState.values())t.settle({cause:"remote",error:e});this._listenState.clear()}super._onclose()}async callTool(e,t){let r=this.getProtocolEra()==="modern"&&J_()!=="browser",o=async()=>{if(!r)return t;let a;try{a=await this._resolveXMcpHeaderScan(e.name,t?.toolDefinition)}catch(l){this._reportStoreError(l)}if(!a?.valid||a.declarations.length===0)return t;let u=i_(a.declarations,e.arguments);return Object.keys(u).length===0?t:{...t,headers:{...t?.headers,...u}}},n=t?.toolDefinition===void 0?await this._cache.outputValidator(e.name,a=>this._compileOutputValidator(a)).catch(a=>void this._reportStoreError(a)):this._compileOutputValidator(t.toolDefinition),s=()=>{if(n===void 0||n.ok)return;let a=n.compileError,u=(a instanceof Error?a.message:String(a)).slice(0,200);throw new be(ue.InvalidParams,`Tool '${e.name}' has an invalid outputSchema: ${u}`)};s();let i;try{i=await this.request({method:"tools/call",params:e},await o())}catch(a){let u=a instanceof be&&a.code===go;if(!r||!u||t?.toolDefinition!==void 0)throw a;let l={signal:t?.signal,timeout:t?.timeout,cacheMode:"refresh"};await this._cache.evict("tools/list"),await this.listTools(void 0,l).catch(d=>this._reportStoreError(d)),n=await this._cache.outputValidator(e.name,d=>this._compileOutputValidator(d)).catch(d=>void this._reportStoreError(d)),s(),i=await this.request({method:"tools/call",params:e},await o())}let c=n!==void 0&&n.ok?n.validator:void 0;if(c){if(i.structuredContent===void 0&&!i.isError)throw new be(ue.InvalidRequest,`Tool ${e.name} has an output schema but did not return structured content`);if(i.structuredContent!==void 0&&!i.isError)try{let a=c(i.structuredContent);if(!a.valid)throw new be(ue.InvalidParams,`Structured content does not match the tool's output schema: ${a.errorMessage}`)}catch(a){throw a instanceof be?a:new be(ue.InvalidParams,`Failed to validate structured content: ${a instanceof Error?a.message:String(a)}`)}}return i}async listTools(e,t){if(!this._serverCapabilities?.tools&&!this._enforceStrictCapabilities)return console.debug("Client.listTools() called but server does not advertise tools capability - returning empty list"),{tools:[]};if(e?.cursor!==void 0){let o=await this.request({method:"tools/list",params:e},t);return this._excludeInvalidXMcpHeaderTools(o),o}let r=await this._serveFromCache("tools/list",void 0,t);return r!==void 0?r:this._listAllPages("tools/list",e,t,o=>o.tools,o=>this._excludeInvalidXMcpHeaderTools(o))}_excludeInvalidXMcpHeaderTools(e){if(this.getProtocolEra()!=="modern"||!this.transport||K_(this.transport)==="stdio")return;let t=e.tools.filter(r=>{let o=Bl(r.inputSchema);return o.valid?!0:(console.warn(`[mcp-sdk] excluding tool '${r.name}' from tools/list: invalid x-mcp-header declaration \u2014 ${o.reason}`),!1)});t.length!==e.tools.length&&(e.tools=t)}_setupListChangedHandler(e,t,r,o){let n=sc(Dn,r);if(!n.success)throw new Error(`Invalid ${e} listChanged options: ${n.error.message}`);if(typeof r.onChanged!="function")throw new TypeError(`Invalid ${e} listChanged options: onChanged must be a function`);let{autoRefresh:s,debounceMs:i}=n.data,{onChanged:c}=r,a=async()=>{if(!s){c(null,null);return}try{c(null,await o())}catch(l){c(l instanceof Error?l:new Error(String(l)),null)}},u=()=>{if(i){let l=this._listChangedDebounceTimers.get(e);l&&clearTimeout(l);let d=setTimeout(a,i);this._listChangedDebounceTimers.set(e,d)}else a()};this.setNotificationHandler(t,u)}async sendRootsListChanged(){return this.notification({method:"notifications/roots/list_changed"})}};var cs=class extends Error{constructor(t,r){super(t),this.name="ParseError",this.type=r.type,this.field=r.field,this.value=r.value,this.line=r.line}},kS=10,KR=13,$r=32;function $d(e){}function IS(e){if(typeof e=="function")throw new TypeError("`config` must be an object, got a function instead. Did you mean `createParser({onEvent: fn})`?");let{onEvent:t=$d,onError:r=$d,onRetry:o=$d,onComment:n,maxBufferSize:s}=e,i=[],c=0,a=!0,u,l="",d=0,h,_=!1;function y(k){if(_)throw new Error("Cannot feed parser: it was terminated after exceeding the configured max buffer size. Call `reset()` to resume parsing.");if(a&&(a=!1,k.charCodeAt(0)===239&&k.charCodeAt(1)===187&&k.charCodeAt(2)===191&&(k=k.slice(3))),i.length===0){let T=b(k);T!==""&&(i.push(T),c=T.length),z();return}if(k.indexOf(`
68
+ `)===-1&&k.indexOf("\r")===-1){i.push(k),c+=k.length,z();return}i.push(k);let v=i.join("");i.length=0,c=0;let S=b(v);S!==""&&(i.push(S),c=S.length),z()}function z(){s!==void 0&&(c+l.length<=s||(_=!0,i.length=0,c=0,u=void 0,l="",d=0,h=void 0,r(new cs(`Buffered data exceeded max buffer size of ${s} characters`,{type:"max-buffer-size-exceeded"}))))}function b(k){let v=0;if(k.indexOf("\r")===-1){let S=k.indexOf(`
69
+ `,v);for(;S!==-1;){if(v===S){d>0&&t({id:u,event:h,data:l}),u=void 0,l="",d=0,h=void 0,v=S+1,S=k.indexOf(`
70
+ `,v);continue}let T=k.charCodeAt(v);if(CS(k,v,T)){let A=k.charCodeAt(v+5)===$r?v+6:v+5,F=k.slice(A,S);if(d===0&&k.charCodeAt(S+1)===kS){t({id:u,event:h,data:F}),u=void 0,l="",h=void 0,v=S+2,S=k.indexOf(`
71
+ `,v);continue}l=d===0?F:`${l}
72
+ ${F}`,d++}else OS(k,v,T)?h=k.slice(k.charCodeAt(v+6)===$r?v+7:v+6,S)||void 0:g(k,v,S);v=S+1,S=k.indexOf(`
73
+ `,v)}return k.slice(v)}for(;v<k.length;){let S=k.indexOf("\r",v),T=k.indexOf(`
74
+ `,v),A=-1;if(S!==-1&&T!==-1?A=S<T?S:T:S!==-1?S===k.length-1?A=-1:A=S:T!==-1&&(A=T),A===-1)break;g(k,v,A),v=A+1,k.charCodeAt(v-1)===KR&&k.charCodeAt(v)===kS&&v++}return k.slice(v)}function g(k,v,S){if(v===S){$();return}let T=k.charCodeAt(v);if(CS(k,v,T)){let J=k.charCodeAt(v+5)===$r?v+6:v+5,de=k.slice(J,S);l=d===0?de:`${l}
75
+ ${de}`,d++;return}if(OS(k,v,T)){h=k.slice(k.charCodeAt(v+6)===$r?v+7:v+6,S)||void 0;return}if(T===105&&k.charCodeAt(v+1)===100&&k.charCodeAt(v+2)===58){let J=k.slice(k.charCodeAt(v+3)===$r?v+4:v+3,S);J.includes("\0")||(u=J);return}if(T===58){if(n){let J=k.slice(v,S);n(J.slice(k.charCodeAt(v+1)===$r?2:1))}return}let A=k.slice(v,S),F=A.indexOf(":");if(F===-1){P(A,"",A);return}let L=A.slice(0,F),U=A.charCodeAt(F+1)===$r?2:1,K=A.slice(F+U);P(L,K,A)}function P(k,v,S){switch(k){case"event":h=v||void 0;break;case"data":l=d===0?v:`${l}
76
+ ${v}`,d++;break;case"id":v.includes("\0")||(u=v);break;case"retry":/^\d+$/.test(v)?o(parseInt(v,10)):r(new cs(`Invalid \`retry\` value: "${v}"`,{type:"invalid-retry",value:v,line:S}));break;default:r(new cs(`Unknown field "${k.length>20?`${k.slice(0,20)}\u2026`:k}"`,{type:"unknown-field",field:k,value:v,line:S}));break}}function $(){d>0&&t({id:u,event:h,data:l}),u=void 0,l="",d=0,h=void 0}function E(k={}){if(k.consume&&i.length>0){let v=i.join("");g(v,0,v.length)}a=!0,u=void 0,l="",d=0,h=void 0,i.length=0,c=0,_=!1}return{feed:y,reset:E}}function CS(e,t,r){return r===100&&e.charCodeAt(t+1)===97&&e.charCodeAt(t+2)===116&&e.charCodeAt(t+3)===97&&e.charCodeAt(t+4)===58}function OS(e,t,r){return r===101&&e.charCodeAt(t+1)===118&&e.charCodeAt(t+2)===101&&e.charCodeAt(t+3)===110&&e.charCodeAt(t+4)===116&&e.charCodeAt(t+5)===58}var vc=class extends TransformStream{constructor({onError:t,onRetry:r,onComment:o,maxBufferSize:n}={}){let s;super({start(i){s=IS({onEvent:c=>{i.enqueue(c)},onError(c){typeof t=="function"&&t(c),(t==="terminate"||c.type==="max-buffer-size-exceeded")&&i.error(c)},onRetry:r,onComment:o,maxBufferSize:n})},transform(i){s.feed(i)}})}};function GR(e){return/(?:^|,)\s*dpop(?:\s|$|,)/i.test(e)}function WR(e){if(e.status!==401)return!1;let t=e.headers.get("www-authenticate")??"";return GR(t)&&/use_dpop_nonce/i.test(t)}var YR=(e,t)=>r=>{let o=typeof e=="function"?e:()=>e;return async(n,s)=>{let i=(s?.method??"GET").toUpperCase(),c=new URL(n.toString()),a=await o();if(!a)return r(n,s);let u=async()=>{let d=await t();if(!d)return r(n,s);let h=new Headers(s?.headers),_=await a.buildProof({htm:i,htu:c,accessToken:d});return h.set("Authorization",`DPoP ${d}`),h.set("DPoP",_),r(n,{...s,headers:h})},l=await u();return WR(l)&&l.headers.has("dpop-nonce")&&(a.observeNonce(l,c),await l.text?.().catch(()=>{}),l=await u()),a.observeNonce(l,c),l}},XR=e=>YR(async()=>{try{return await e.dpop?.()}catch(t){throw nt(t)}},async()=>{let t;try{t=await e.tokens()}catch(r){throw nt(r)}return t?.token_type?.toLowerCase()==="dpop"?t.access_token:void 0});var Wk=class extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.SseError"})}static[Symbol.hasInstance](e){return Qe(this,e)}static isInstance(e){if(typeof this!="function")throw new TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return Qe(this,e)}constructor(e,t,r){super(`SSE error: ${t}`),this.code=e,this.event=r,er(this,new.target)}};var QR=1,e$={initialReconnectionDelay:1e3,maxReconnectionDelay:3e4,reconnectionDelayGrowFactor:1.5,maxRetries:2},t$=new Set(["authorization","dpop","content-type","mcp-protocol-version","mcp-method","mcp-name","mcp-session-id"]);function xS(e,t){if(typeof AbortSignal.any=="function")return AbortSignal.any([e,t]);let r=new AbortController;if(e.aborted)return r.abort(e.reason),r.signal;if(t.aborted)return r.abort(t.reason),r.signal;let o=()=>{e.removeEventListener("abort",n),t.removeEventListener("abort",s)};function n(){o(),r.abort(e.reason)}function s(){o(),r.abort(t.reason)}return e.addEventListener("abort",n,{once:!0}),t.addEventListener("abort",s,{once:!0}),r.signal}var r$=class{_abortController;_url;_resourceMetadataUrl;_scope;_requestInit;_authProvider;_oauthProvider;_skipIssuerMetadataValidation;_fetch;_fetchWithInit;_redirectPolicy;_sessionId;_reconnectionOptions;_protocolVersion;_onInsufficientScope;_maxStepUpRetries;_serverRetryMs;_reconnectionScheduler;_cancelReconnection;onclose;onerror;onmessage;hasPerRequestStream=!0;constructor(e,t){this._url=e,this._resourceMetadataUrl=void 0,this._scope=void 0,this._requestInit=t?.requestInit,this._skipIssuerMetadataValidation=t?.skipIssuerMetadataValidation,this._fetch=t?.fetch,tS(t?.authProvider)?(this._oauthProvider=t.authProvider,this._authProvider=rS(t.authProvider,{skipIssuerMetadataValidation:t.skipIssuerMetadataValidation}),t.authProvider.dpop&&(this._fetch=XR(t.authProvider)(t.fetch??fetch))):this._authProvider=t?.authProvider,this._redirectPolicy=t?.redirectPolicy,this._fetchWithInit=__(t?.fetch,t?.requestInit),this._redirectPolicy==="follow"&&(this._fetchWithInit=v_(this._fetchWithInit)),this._sessionId=t?.sessionId,this._protocolVersion=t?.protocolVersion,this._reconnectionOptions=t?.reconnectionOptions??e$,this._reconnectionScheduler=t?.reconnectionScheduler,this._onInsufficientScope=t?.onInsufficientScope??"reauthorize",this._maxStepUpRetries=Math.max(0,t?.maxStepUpRetries??QR)}async _stepUpAuthorize(e,t){try{return await this._stepUpAuthorizeInner(e,t)}catch(r){throw nt(r)}}async _stepUpAuthorizeInner(e,t){if(this._onInsufficientScope==="throw")throw new yd({requiredScope:e.scope,resourceMetadataUrl:e.resourceMetadataUrl,errorDescription:e.errorDescription});if(!this._oauthProvider)throw new yd({requiredScope:e.scope,resourceMetadataUrl:e.resourceMetadataUrl,errorDescription:e.errorDescription});if(t>=this._maxStepUpRetries)throw new mt(ee.ClientHttpForbidden,`Server returned 403 insufficient_scope after step-up re-authorization (retry limit ${this._maxStepUpRetries} reached)`,{status:403,statusText:e.statusText??"Forbidden",text:e.text});e.resourceMetadataUrl&&(this._resourceMetadataUrl=e.resourceMetadataUrl);let r=await this._oauthProvider.tokens(),o=Sc(this._scope,r?.scope,e.scope);this._scope=o;let n=oS(o,r?.scope);return yc(this._oauthProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:o,forceReauthorization:n,fetchFn:this._fetchWithInit,skipIssuerMetadataValidation:this._skipIssuerMetadataValidation})}_redirects(e){return this._redirectPolicy==="follow"?e:_o(e)}_unfollowedRedirect(e,t){let r=this._redirectPolicy==="follow"?void 0:b_(e,t);return r&&`${r} (redirectPolicy: 'same-origin')`}async _commonHeaders(){let e=new Headers(this._requestInit?.headers||void 0),t;try{t=await this._authProvider?.token()}catch(r){throw nt(r)}return t&&e.set("Authorization",`Bearer ${t}`),this._sessionId&&e.set("mcp-session-id",this._sessionId),this._protocolVersion&&e.set("mcp-protocol-version",this._protocolVersion),e}_applyBodyDerivedHeaders(e,t){if(Array.isArray(t)||!rr(t))return;let r=t.params?._meta?.[Ot];if(typeof r!="string")return;e.set("mcp-protocol-version",r),e.set("mcp-method",t.method);let o=a_(t.method,t.params);o?.value!==void 0&&e.set("mcp-name",Jl(o.value))}_isModernEnvelopedRequest(e){if(Array.isArray(e)||!rr(e))return!1;let t=e.params?._meta?.[Ot];return typeof t=="string"&&yt(t)}async _startOrAuthSse(e,t=!1,r=0){let{resumptionToken:o,requestSignal:n}=e,s=()=>this._abortController?.signal.aborted===!0||n?.aborted===!0;try{let i=await this._commonHeaders(),c=[...i.get("accept")?.split(",").map(d=>d.trim().toLowerCase())??[],"text/event-stream"];i.set("accept",[...new Set(c)].join(", ")),o&&i.set("last-event-id",o);let a=this._abortController?.signal,u=n!==void 0&&a!==void 0?xS(a,n):n??a,l=await this._redirects(this._fetch??fetch)(this._url,{...this._requestInit,method:"GET",headers:i,signal:u});if(!l.ok){if(l.status===401&&this._authProvider){if(l.headers.has("www-authenticate")){let{resourceMetadataUrl:h,scope:_}=bo(l);this._resourceMetadataUrl=h,this._scope=Sc(this._scope,_)}if(this._authProvider.onUnauthorized&&!t){try{await this._authProvider.onUnauthorized({response:l,serverUrl:this._url,fetchFn:this._fetchWithInit})}catch(h){throw nt(h)}return await l.text?.().catch(()=>{}),this._startOrAuthSse(e,!0,r)}throw await l.text?.().catch(()=>{}),t?nt(new mt(ee.ClientHttpAuthentication,"Server returned 401 after re-authentication",{status:401,statusText:l.statusText})):nt(new gt)}if(l.status===403){let{resourceMetadataUrl:h,scope:_,error:y,errorDescription:z}=bo(l);if(y==="insufficient_scope"){let b=await l.text?.().catch(()=>null);if(await this._stepUpAuthorize({scope:_,resourceMetadataUrl:h,errorDescription:z,statusText:l.statusText,text:b},r)!=="AUTHORIZED")throw nt(new gt);return this._startOrAuthSse(e,t,r+1)}}if(await l.text?.().catch(()=>{}),l.status===405){e.onRequestStreamEnd?.();return}let d=this._unfollowedRedirect(this._url,l)??l.statusText;throw new mt(ee.ClientHttpFailedToOpenStream,`Failed to open SSE stream: ${d}`,{status:l.status,statusText:l.statusText})}this._handleSseStream(l.body,e,!0)}catch(i){throw s()||this.onerror?.(i),i}}_getNextReconnectionDelay(e){if(this._serverRetryMs!==void 0)return this._serverRetryMs;let t=this._reconnectionOptions.initialReconnectionDelay,r=this._reconnectionOptions.reconnectionDelayGrowFactor,o=this._reconnectionOptions.maxReconnectionDelay;return Math.min(t*Math.pow(r,e),o)}_scheduleReconnection(e,t=0){let r=this._reconnectionOptions.maxRetries;if(t>=r){this.onerror?.(new Error(`Maximum reconnection attempts (${r}) exceeded.`)),e.onRequestStreamEnd?.();return}let o=this._getNextReconnectionDelay(t),n=()=>{this._cancelReconnection=void 0,!(this._abortController?.signal.aborted||e.requestSignal?.aborted)&&this._startOrAuthSse(e).catch(s=>{if(!(this._abortController?.signal.aborted||e.requestSignal?.aborted)){this.onerror?.(new Error(`Failed to reconnect SSE stream: ${s instanceof Error?s.message:String(s)}`));try{this._scheduleReconnection(e,t+1)}catch(i){this.onerror?.(i instanceof Error?i:new Error(String(i)))}}})};if(this._reconnectionScheduler){let s=this._reconnectionScheduler(n,o,t);this._cancelReconnection=typeof s=="function"?s:void 0}else{let s=setTimeout(n,o);this._cancelReconnection=()=>clearTimeout(s)}}_handleSseStream(e,t,r){if(!e){t.onRequestStreamEnd?.();return}let{onresumptiontoken:o,replayMessageId:n,requestSignal:s,onRequestStreamEnd:i}=t,c=()=>this._abortController?.signal.aborted===!0||s?.aborted===!0,a,u=!1,l=!1;(async()=>{try{let h=e.pipeThrough(new TextDecoderStream).pipeThrough(new vc({onRetry:_=>{this._serverRetryMs=_}})).getReader();for(;;){let{value:_,done:y}=await h.read();if(y)break;if(_.id&&(a=_.id,u=!0,o?.(_.id)),!!_.data&&(!_.event||_.event==="message"))try{let z=It.parse(JSON.parse(_.data));(wr(z)||Rr(z))&&(l=!0,n!==void 0&&(z.id=n)),this.onmessage?.(z)}catch(z){this.onerror?.(z)}}(r||u)&&!l&&this._abortController&&!c()?this._scheduleReconnection({resumptionToken:a,onresumptiontoken:o,replayMessageId:n,requestSignal:s,onRequestStreamEnd:i},0):c()||i?.()}catch(h){if(c())return;if(this.onerror?.(new Error(`SSE stream disconnected: ${h}`)),(r||u)&&!l&&this._abortController&&!c())try{this._scheduleReconnection({resumptionToken:a,onresumptiontoken:o,replayMessageId:n,requestSignal:s,onRequestStreamEnd:i},0)}catch(_){this.onerror?.(new Error(`Failed to reconnect: ${_ instanceof Error?_.message:String(_)}`)),i?.()}else i?.()}})()}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,t){if(!this._oauthProvider)throw new gt("finishAuth requires an OAuthClientProvider");let{authorizationCode:r,iss:o}=await nS(e,t,this._oauthProvider,this._url,{fetchFn:this._fetchWithInit,resourceMetadataUrl:this._resourceMetadataUrl});if(await yc(this._oauthProvider,{serverUrl:this._url,authorizationCode:r,iss:o,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit,skipIssuerMetadataValidation:this._skipIssuerMetadataValidation})!=="AUTHORIZED")throw new gt("Failed to authorize")}async close(){try{this._cancelReconnection?.()}finally{this._cancelReconnection=void 0,this._abortController?.abort(),this.onclose?.()}}async send(e,t){return this._send(e,t,!1)}async _send(e,t,r,o=0){try{let{resumptionToken:n,onresumptiontoken:s}=t||{};if(n){this._startOrAuthSse({resumptionToken:n,replayMessageId:rr(e)?e.id:void 0,requestSignal:t?.requestSignal}).catch(b=>this.onerror?.(b));return}let i=await this._commonHeaders();this._applyBodyDerivedHeaders(i,e);let c=Array.isArray(e)?e.some(b=>Hl(b)):Hl(e);if(c&&i.delete("mcp-session-id"),t?.headers!==void 0)for(let[b,g]of Object.entries(t.headers))t$.has(b.toLowerCase())||i.set(b,g);i.set("content-type","application/json");let a=[...i.get("accept")?.split(",").map(b=>b.trim().toLowerCase())??[],"application/json","text/event-stream"];i.set("accept",[...new Set(a)].join(", "));let u=this._abortController?.signal,l=t?.requestSignal!==void 0&&u!==void 0?xS(u,t.requestSignal):t?.requestSignal??u,d={...this._requestInit,method:"POST",headers:i,body:JSON.stringify(e),signal:l},h=await this._redirects(this._fetch??fetch)(this._url,d);if(c&&h.ok&&(this._sessionId=h.headers.get("mcp-session-id")||void 0),!h.ok){if(h.status===401&&this._authProvider){if(h.headers.has("www-authenticate")){let{resourceMetadataUrl:P,scope:$}=bo(h);this._resourceMetadataUrl=P,this._scope=Sc(this._scope,$)}if(this._authProvider.onUnauthorized&&!r){try{await this._authProvider.onUnauthorized({response:h,serverUrl:this._url,fetchFn:this._fetchWithInit})}catch(P){throw nt(P)}return await h.text?.().catch(()=>{}),this._send(e,t,!0,o)}throw await h.text?.().catch(()=>{}),r?nt(new mt(ee.ClientHttpAuthentication,"Server returned 401 after re-authentication",{status:401,statusText:h.statusText})):nt(new gt)}let b=await h.text?.().catch(()=>null);if(h.status===403){let{resourceMetadataUrl:P,scope:$,error:E,errorDescription:k}=bo(h);if(E==="insufficient_scope"){if(await this._stepUpAuthorize({scope:$,resourceMetadataUrl:P,errorDescription:k,statusText:h.statusText,text:b},o)!=="AUTHORIZED")throw nt(new gt);return this._send(e,t,r,o+1)}}if(h.status===400&&typeof b=="string"&&this._isModernEnvelopedRequest(e))try{let P=It.parse(JSON.parse(b)),$=(Array.isArray(e)?e:[e]).filter(E=>rr(E));if(Rr(P)&&$.some(E=>E.id===P.id)){this.onmessage?.(P);return}}catch{}let g=this._unfollowedRedirect(this._url,h)??b;throw new mt(ee.ClientHttpNotImplemented,`Error POSTing to endpoint: ${g}`,{status:h.status,statusText:h.statusText,text:b})}if(h.status===202){await h.text?.().catch(()=>{}),o_(e)&&this._startOrAuthSse({resumptionToken:void 0}).catch(b=>this.onerror?.(b));return}let _=(Array.isArray(e)?e:[e]).some(b=>"method"in b&&"id"in b&&b.id!==void 0),y=h.headers.get("content-type"),z=h_(y);if(_)if(z==="text/event-stream")this._handleSseStream(h.body,{onresumptiontoken:s,requestSignal:t?.requestSignal,onRequestStreamEnd:t?.onRequestStreamEnd},!1);else if(z==="application/json"){let b=await h.json(),g=Array.isArray(b)?b.map(P=>It.parse(P)):[It.parse(b)];for(let P of g)this.onmessage?.(P)}else throw await h.text?.().catch(()=>{}),new re(ee.ClientHttpUnexpectedContent,`Unexpected content type: ${y}`,{contentType:y});else await h.text?.().catch(()=>{})}catch(n){throw t?.requestSignal?.aborted!==!0&&this.onerror?.(n),n}}get sessionId(){return this._sessionId}async terminateSession(){if(this._sessionId)try{let e=await this._commonHeaders(),t={...this._requestInit,method:"DELETE",headers:e,signal:this._abortController?.signal},r=await this._redirects(this._fetch??fetch)(this._url,t);if(await r.text?.().catch(()=>{}),!r.ok&&r.status!==405)throw new mt(ee.ClientHttpFailedToTerminateSession,`Failed to terminate session: ${this._unfollowedRedirect(this._url,r)??r.statusText}`,{status:r.status,statusText:r.statusText});this._sessionId=void 0}catch(e){throw this.onerror?.(e),e}}setProtocolVersion(e){this._protocolVersion=e}get protocolVersion(){return this._protocolVersion}async resumeStream(e,t){await this._startOrAuthSse({resumptionToken:e,onresumptiontoken:t?.onresumptiontoken})}};var zy=Cy(by(),1);import Ad from"node:process";import{PassThrough as k$}from"node:stream";var C$=Ad.platform==="win32"?["APPDATA","COMSPEC","HOMEDRIVE","HOMEPATH","LOCALAPPDATA","PATH","PATHEXT","PROCESSOR_ARCHITECTURE","PROGRAMDATA","PROGRAMFILES","PROGRAMFILES(X86)","PROGRAMW6432","SYSTEMDRIVE","SYSTEMROOT","TEMP","USERNAME","USERPROFILE","WINDIR"]:["HOME","LOGNAME","PATH","SHELL","TERM","USER"];function O$(){let e={};for(let t of C$){let r=Ad.env[t];r!==void 0&&(r.startsWith("()")||(e[t]=r))}return e}var I$=class{_process;_readBuffer;_serverParams;_stderrStream=null;onclose;onerror;onmessage;constructor(e){this._serverParams=e,this._readBuffer=new Ql({maxBufferSize:e.maxBufferSize}),(e.stderr==="pipe"||e.stderr==="overlapped")&&(this._stderrStream=new k$)}async start(){if(this._process)throw new Error("StdioClientTransport already started! If using Client class, note that connect() calls start() automatically.");return new Promise((e,t)=>{this._process=(0,zy.default)(this._serverParams.command,this._serverParams.args??[],{env:{...O$(),...this._serverParams.env},stdio:["pipe","pipe",this._serverParams.stderr??"inherit"],shell:!1,windowsHide:Ad.platform==="win32",cwd:this._serverParams.cwd}),this._process.on("error",r=>{t(r),this.onerror?.(r)}),this._process.on("spawn",()=>{e()}),this._process.on("close",r=>{this._process=void 0,this.onclose?.()}),this._process.stdin?.on("error",r=>{this.onerror?.(r)}),this._process.stdout?.on("data",r=>{try{this._readBuffer.append(r),this.processReadBuffer()}catch(o){this.onerror?.(o),this.close().catch(()=>{})}}),this._process.stdout?.on("error",r=>{this.onerror?.(r)}),this._stderrStream&&this._process.stderr&&this._process.stderr.pipe(this._stderrStream)})}get stderr(){return this._stderrStream?this._stderrStream:this._process?.stderr??null}get pid(){return this._process?.pid??null}processReadBuffer(){for(;;)try{let e=this._readBuffer.readMessage();if(e===null)break;this.onmessage?.(e)}catch(e){this.onerror?.(e)}}async _dispose(){let e=this._process;if(this._process=void 0,e&&e.exitCode===null&&e.signalCode===null){let t=new Promise(r=>e.once("exit",()=>r()));try{e.stdin?.end()}catch{}try{e.kill("SIGTERM")}catch{}if(await Promise.race([t,new Promise(r=>setTimeout(r,1e3).unref())]),e.exitCode===null&&e.signalCode===null)try{e.kill("SIGKILL")}catch{}await t}try{e?.stdout?.destroy()}catch{}try{e?.stdin?.destroy()}catch{}try{e?.stderr?.destroy()}catch{}this._readBuffer.clear()}async close(){if(this._process){let e=this._process;this._process=void 0;let t=new Promise(r=>{e.once("close",()=>{r()})});try{e.stdin?.end()}catch{}if(await Promise.race([t,new Promise(r=>setTimeout(r,2e3).unref())]),e.exitCode===null){try{e.kill("SIGTERM")}catch{}await Promise.race([t,new Promise(r=>setTimeout(r,2e3).unref())])}if(e.exitCode===null)try{e.kill("SIGKILL")}catch{}}this._readBuffer.clear()}send(e){return new Promise(t=>{if(!this._process?.stdin)throw new re(ee.NotConnected,"Not connected");let r=ed(e);this._process.stdin.write(r)?t():this._process.stdin.once("drain",t)})}};export{TS as Client,I$ as StdioClientTransport,r$ as StreamableHTTPClientTransport};